Files
marco/release/assets/main-B2gk-G51.js
T
raucao 387fd6efed
CI / Lint (push) Successful in 53s
CI / Test (push) Successful in 1m4s
1.26.0
2026-08-07 07:33:52 -06:00

1 line
1.9 MiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var __create=Object.create,__defProp$1=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),__exportAll=(e,t)=>{let r={};for(var n in e)__defProp$1(r,n,{get:e[n],enumerable:!0});return t||__defProp$1(r,Symbol.toStringTag,{value:"Module"}),r},__copyProps=(e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var i,o=__getOwnPropNames(t),s=0,a=o.length;s<a;s++)i=o[s],__hasOwnProp.call(e,i)||i===r||__defProp$1(e,i,{get:(e=>t[e]).bind(null,i),enumerable:!(n=__getOwnPropDesc(t,i))||n.enumerable});return e},__toESM=(e,t,r)=>(r=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule&&__hasOwnProp.call(e,"default")?r:__defProp$1(r,"default",{value:e,enumerable:!0}),e));!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const r of e)if("childList"===r.type)for(const e of r.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var objectPrototype=Object.prototype,counters,UNDEFINED=Symbol("undefined"),ListenerKind=function(e){return e[e.ADD=0]="ADD",e[e.ONCE=1]="ONCE",e[e.REMOVE=2]="REMOVE",e}(ListenerKind||{}),currentListenerVersion=1,Meta=class{_descriptors;_mixins;_isInit;_lazyChains;_values;_revisions;source;proto;_parent;_listeners;_listenersVersion=1;_inheritedEnd=-1;_flattenedVersion=0;constructor(e){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=e,this.proto=void 0===e.constructor?void 0:e.constructor.prototype,this._listeners=void 0}get parent(){let e=this._parent;if(void 0===e){let t=getPrototypeOf$3(this.source);this._parent=e=null===t||t===objectPrototype?null:meta$1(t)}return e}setInitializing(){this._isInit=!0}unsetInitializing(){this._isInit=!1}isInitializing(){return this._isInit}isPrototypeMeta(e){return this.proto===this.source&&this.source===e}_getOrCreateOwnMap(e){return this[e]||(this[e]=Object.create(null))}_getOrCreateOwnSet(e){return this[e]||(this[e]=new Set)}_findInheritedMap(e,t){let r=this;for(;null!==r;){let n=r[e];if(void 0!==n){let e=n.get(t);if(void 0!==e)return e}r=r.parent}}_hasInInheritedSet(e,t){let r=this;for(;null!==r;){let n=r[e];if(void 0!==n&&n.has(t))return!0;r=r.parent}return!1}valueFor(e){let t=this._values;return void 0!==t?t[e]:void 0}setValueFor(e,t){this._getOrCreateOwnMap("_values")[e]=t}revisionFor(e){let t=this._revisions;return void 0!==t?t[e]:void 0}setRevisionFor(e,t){this._getOrCreateOwnMap("_revisions")[e]=t}writableLazyChainsFor(e){let t=this._getOrCreateOwnMap("_lazyChains"),r=t[e];return void 0===r&&(r=t[e]=[]),r}readableLazyChainsFor(e){let t=this._lazyChains;if(void 0!==t)return t[e]}addMixin(e){this._getOrCreateOwnSet("_mixins").add(e)}hasMixin(e){return this._hasInInheritedSet("_mixins",e)}forEachMixins(e){let t,r=this;for(;null!==r;){let n=r._mixins;void 0!==n&&(t=void 0===t?new Set:t,n.forEach(r=>{t.has(r)||(t.add(r),e(r))})),r=r.parent}}writeDescriptors(e,t){(this._descriptors||(this._descriptors=new Map)).set(e,t)}peekDescriptors(e){let t=this._findInheritedMap("_descriptors",e);return t===UNDEFINED?void 0:t}removeDescriptors(e){this.writeDescriptors(e,UNDEFINED)}forEachDescriptors(e){let t,r=this;for(;null!==r;){let n=r._descriptors;void 0!==n&&(t=void 0===t?new Set:t,n.forEach((r,n)=>{t.has(n)||(t.add(n),r!==UNDEFINED&&e(n,r))})),r=r.parent}}addToListeners(e,t,r,n,i){this.pushListener(e,t,r,n?ListenerKind.ONCE:ListenerKind.ADD,i)}removeFromListeners(e,t,r){this.pushListener(e,t,r,ListenerKind.REMOVE)}pushListener(e,t,r,n,i=!1){let o=this.writableListeners(),s=indexOfListener(o,e,t,r);if(-1!==s&&s<this._inheritedEnd&&(o.splice(s,1),this._inheritedEnd--,s=-1),-1===s)o.push({event:e,target:t,method:r,kind:n,sync:i});else{let e=o[s];n===ListenerKind.REMOVE&&e.kind!==ListenerKind.REMOVE?o.splice(s,1):(e.kind=n,e.sync=i)}}writableListeners(){return this._flattenedVersion!==currentListenerVersion||this.source!==this.proto&&-1!==this._inheritedEnd||currentListenerVersion++,-1===this._inheritedEnd&&(this._inheritedEnd=0,this._listeners=[]),this._listeners}flattenedListeners(){if(this._flattenedVersion<currentListenerVersion){let e=this.parent;if(null!==e){let t=e.flattenedListeners();if(void 0!==t)if(void 0===this._listeners)this._listeners=t;else{let e=this._listeners;this._inheritedEnd>0&&(e.splice(0,this._inheritedEnd),this._inheritedEnd=0);for(let r of t)-1===indexOfListener(e,r.event,r.target,r.method)&&(e.unshift(r),this._inheritedEnd++)}}this._flattenedVersion=currentListenerVersion}return this._listeners}matchingListeners(e){let t,r=this.flattenedListeners();if(void 0!==r)for(let n of r)n.event!==e||n.kind!==ListenerKind.ADD&&n.kind!==ListenerKind.ONCE||(void 0===t&&(t=[]),t.push(n.target,n.method,n.kind===ListenerKind.ONCE));return t}observerEvents(){let e,t=this.flattenedListeners();if(void 0!==t)for(let r of t)r.kind!==ListenerKind.ADD&&r.kind!==ListenerKind.ONCE||-1===r.event.indexOf(":change")||(void 0===e&&(e=[]),e.push(r));return e}},getPrototypeOf$3=Object.getPrototypeOf,metaStore=new WeakMap;function setMeta(e,t){metaStore.set(e,t)}function peekMeta(e){let t=metaStore.get(e);if(void 0!==t)return t;let r=getPrototypeOf$3(e);for(;null!==r;){if(t=metaStore.get(r),void 0!==t)return t.proto!==r&&(t.proto=r),t;r=getPrototypeOf$3(r)}return null}var meta$1=function(e){let t=peekMeta(e);if(null!==t&&t.source===e)return t;let r=new Meta(e);return setMeta(e,r),r};function indexOfListener(e,t,r,n){for(let i=e.length-1;i>=0;i--){let o=e[i];if(o.event===t&&o.target===r&&o.method===n)return i}return-1}function isElementDescriptor(e){let[t,r,n]=e;return 3===e.length&&("function"==typeof t||"object"==typeof t&&null!==t)&&"string"==typeof r&&("object"==typeof n&&null!==n||void 0===n)}function nativeDescDecorator(e){let t=function(){return e};return setClassicDecorator(t),t}var ComputedDescriptor=class{enumerable=!0;configurable=!0;_dependentKeys=void 0;_meta=void 0;setup(e,t,r,n){n.writeDescriptors(t,this)}teardown(e,t,r){r.removeDescriptors(t)}};function DESCRIPTOR_GETTER_FUNCTION(e,t){return function(){return t.get(this,e)}}function DESCRIPTOR_SETTER_FUNCTION(e,t){let r=function(r){return t.set(this,e,r)};return COMPUTED_SETTERS.add(r),r}var COMPUTED_SETTERS=new WeakSet;function makeComputedDecorator(e,t){let r=function(t,r,n,i){let o=3===arguments.length?meta$1(t):i;return e.setup(t,r,n,o),{enumerable:e.enumerable,configurable:e.configurable,get:DESCRIPTOR_GETTER_FUNCTION(r,e),set:DESCRIPTOR_SETTER_FUNCTION(r,e)}};return setClassicDecorator(r,e),Object.setPrototypeOf(r,t.prototype),r}var DECORATOR_DESCRIPTOR_MAP=new WeakMap;function descriptorForProperty(e,t,r){let n=void 0===r?peekMeta(e):r;if(null!==n)return n.peekDescriptors(t)}function descriptorForDecorator(e){return DECORATOR_DESCRIPTOR_MAP.get(e)}function isClassicDecorator(e){return"function"==typeof e&&DECORATOR_DESCRIPTOR_MAP.has(e)}function setClassicDecorator(e,t=!0){DECORATOR_DESCRIPTOR_MAP.set(e,t)}var ENV$1={ENABLE_OPTIONAL_FEATURES:!1,EXTEND_PROTOTYPES:{Array:!1},LOG_STACKTRACE_ON_DEPRECATION:!0,LOG_VERSION:!0,LOG_INSPECTOR_HINT:!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,FEATURES:{}},EmberENV=globalThis.EmberENV;if("object"==typeof EmberENV&&null!==EmberENV){for(let t in EmberENV){if(!Object.prototype.hasOwnProperty.call(EmberENV,t)||"EXTEND_PROTOTYPES"===t||"EMBER_LOAD_HOOKS"===t)continue;let e=ENV$1[t];ENV$1[t]=!0===e?!1!==EmberENV[t]:!1===e?!0===EmberENV[t]:EmberENV[t]}let{FEATURES:e}=EmberENV;if("object"==typeof e&&null!==e)for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(ENV$1.FEATURES[t]=!0===e[t])}function getENV(){return ENV$1}var scheduleRevalidate=()=>{},scheduleDestroy,scheduleDestroyed,toIterator$1,toBool$1,getProp,setProp,getPath,setPath,warnIfStyleNotTrusted,assert$5,deprecate$2;function setGlobalContext(e){scheduleRevalidate=e.scheduleRevalidate,scheduleDestroy=e.scheduleDestroy,scheduleDestroyed=e.scheduleDestroyed,toIterator$1=e.toIterator,toBool$1=e.toBool,getProp=e.getProp,setProp=e.setProp,getPath=e.getPath,setPath=e.setPath,warnIfStyleNotTrusted=e.warnIfStyleNotTrusted,assert$5=e.assert,deprecate$2=e.deprecate}var LIVE_STATE=0,DESTROYING_STATE=1,DESTROYED_STATE=2,DESTROYABLE_META=new WeakMap,branded=Symbol("BrandedArray"),enableDestroyableTracking,assertDestroyablesDestroyed;function isBrandedArray(e){return Array.isArray(e)&&branded in e}function push(e,t){if(null===e)return t;if(isBrandedArray(e))return e.push(t),e;{const r=[e,t];return r[branded]=!0,r}}function iterate$1(e,t){isBrandedArray(e)?e.forEach(t):null!==e&&t(e)}function remove(e,t){if(isBrandedArray(e)&&e.length>1){let r=e.indexOf(t),n=e.length-1;return r!==n&&(e[r]=e[n]),e.length=n,e}return null}function getDestroyableMeta(e){let t=DESTROYABLE_META.get(e);return void 0===t&&(t={parents:null,children:null,eagerDestructors:null,destructors:null,state:LIVE_STATE},DESTROYABLE_META.set(e,t)),t}function associateDestroyableChild(e,t){let r=getDestroyableMeta(e),n=getDestroyableMeta(t);return r.children=push(r.children,t),n.parents=push(n.parents,e),t}function registerDestructor$1(e,t,r=!1){let n=getDestroyableMeta(e),i=r?"eagerDestructors":"destructors";return n[i]=push(n[i],t),t}function unregisterDestructor$1(e,t,r=!1){let n=getDestroyableMeta(e),i=r?"eagerDestructors":"destructors";n[i]=remove(n[i],t)}function destroy(e){let t=getDestroyableMeta(e);if(t.state>=DESTROYING_STATE)return;let{parents:r,children:n,eagerDestructors:i,destructors:o}=t;t.state=DESTROYING_STATE,iterate$1(n,destroy),iterate$1(i,t=>{t(e)}),iterate$1(o,t=>{scheduleDestroy(e,t)}),scheduleDestroyed(()=>{iterate$1(r,t=>{removeChildFromParent(e,t)}),t.state=DESTROYED_STATE})}function removeChildFromParent(e,t){let r=getDestroyableMeta(t);r.state!==DESTROYED_STATE&&(r.children=remove(r.children,e))}function destroyChildren(e){let{children:t}=getDestroyableMeta(e);iterate$1(t,destroy)}function _hasDestroyableChildren(e){let t=DESTROYABLE_META.get(e);return void 0!==t&&null!==t.children}function isDestroying(e){let t=DESTROYABLE_META.get(e);return void 0!==t&&t.state>=DESTROYING_STATE}function isDestroyed(e){let t=DESTROYABLE_META.get(e);return void 0!==t&&t.state>=DESTROYED_STATE}function unwrap$2(e){if(null==e)throw new Error("Expected value to be present");return e}var INITIAL=1,VOLATILE=NaN,$REVISION=1;function bump(){$REVISION++}var DIRYTABLE_TAG_ID=0,UPDATABLE_TAG_ID=1,COMBINATOR_TAG_ID=2,CONSTANT_TAG_ID=3,COMPUTE$1=Symbol("TAG_COMPUTE");function valueForTag(e){return e[COMPUTE$1]()}function validateTag(e,t){return t>=e[COMPUTE$1]()}Reflect.set(globalThis,"COMPUTE_SYMBOL",COMPUTE$1);var TYPE$1=Symbol("TAG_TYPE"),ALLOW_CYCLES,MonomorphicTagImpl=class e{static combine(t){switch(t.length){case 0:return CONSTANT_TAG;case 1:return t[0];default:{let r=new e(COMBINATOR_TAG_ID);return r.subtag=t,r}}}revision=1;lastChecked=1;lastValue=1;isUpdating=!1;subtag=null;subtagBufferCache=null;constructor(e){this[TYPE$1]=e}[COMPUTE$1](){let{lastChecked:e}=this;if(this.isUpdating)this.lastChecked=++$REVISION;else if(e!==$REVISION){this.isUpdating=!0,this.lastChecked=$REVISION;try{let{subtag:e,revision:t}=this;if(null!==e)if(Array.isArray(e))for(const r of e){let e=r[COMPUTE$1]();t=Math.max(e,t)}else{let r=e[COMPUTE$1]();r===this.subtagBufferCache?t=Math.max(t,this.lastValue):(this.subtagBufferCache=null,t=Math.max(t,r))}this.lastValue=t}finally{this.isUpdating=!1}}return this.lastValue}static updateTag(e,t){let r=e,n=t;n===CONSTANT_TAG?r.subtag=null:(r.subtagBufferCache=n[COMPUTE$1](),r.subtag=n)}static dirtyTag(e,t){e.revision=++$REVISION,scheduleRevalidate()}},DIRTY_TAG$1=MonomorphicTagImpl.dirtyTag,UPDATE_TAG=MonomorphicTagImpl.updateTag;function createTag(){return new MonomorphicTagImpl(DIRYTABLE_TAG_ID)}function createUpdatableTag(){return new MonomorphicTagImpl(UPDATABLE_TAG_ID)}var CONSTANT_TAG=new MonomorphicTagImpl(CONSTANT_TAG_ID);function isConstTag(e){return e===CONSTANT_TAG}var VOLATILE_TAG_ID=100,VolatileTag=class{[TYPE$1]=VOLATILE_TAG_ID;[COMPUTE$1](){return VOLATILE}},VOLATILE_TAG=new VolatileTag,CURRENT_TAG_ID=101,CurrentTag=class{[TYPE$1]=CURRENT_TAG_ID;[COMPUTE$1](){return $REVISION}},CURRENT_TAG=new CurrentTag,combine=MonomorphicTagImpl.combine,tag1=createUpdatableTag(),tag2=createUpdatableTag(),tag3=createUpdatableTag();valueForTag(tag1),DIRTY_TAG$1(tag1),valueForTag(tag1),UPDATE_TAG(tag1,combine([tag2,tag3])),valueForTag(tag1),DIRTY_TAG$1(tag2),valueForTag(tag1),DIRTY_TAG$1(tag3),valueForTag(tag1),UPDATE_TAG(tag1,tag3),valueForTag(tag1),DIRTY_TAG$1(tag3),valueForTag(tag1);var Tracker=class{tags=new Set;last=null;add(e){e!==CONSTANT_TAG&&(this.tags.add(e),this.last=e)}combine(){let{tags:e}=this;return 0===e.size?CONSTANT_TAG:1===e.size?this.last:combine(Array.from(this.tags))}},CURRENT_TRACKER=null,OPEN_TRACK_FRAMES=[];function beginTrackFrame(){OPEN_TRACK_FRAMES.push(CURRENT_TRACKER),CURRENT_TRACKER=new Tracker}function endTrackFrame(){let e=CURRENT_TRACKER;return CURRENT_TRACKER=OPEN_TRACK_FRAMES.pop()||null,unwrap$2(e).combine()}function beginUntrackFrame(){OPEN_TRACK_FRAMES.push(CURRENT_TRACKER),CURRENT_TRACKER=null}function endUntrackFrame(){CURRENT_TRACKER=OPEN_TRACK_FRAMES.pop()||null}function resetTracking(){for(;OPEN_TRACK_FRAMES.length>0;)OPEN_TRACK_FRAMES.pop();CURRENT_TRACKER=null}function isTracking(){return null!==CURRENT_TRACKER}function consumeTag(e){null!==CURRENT_TRACKER&&CURRENT_TRACKER.add(e)}var FN=Symbol("FN"),LAST_VALUE=Symbol("LAST_VALUE"),TAG=Symbol("TAG"),SNAPSHOT=Symbol("SNAPSHOT");function createCache(e){return{[FN]:e,[LAST_VALUE]:void 0,[TAG]:void 0,[SNAPSHOT]:-1}}function getValue$1(e){let t=e[FN],r=e[TAG],n=e[SNAPSHOT];if(void 0!==r&&validateTag(r,n))consumeTag(r);else{beginTrackFrame();try{e[LAST_VALUE]=t()}finally{r=endTrackFrame(),e[TAG]=r,e[SNAPSHOT]=valueForTag(r),consumeTag(r)}}return e[LAST_VALUE]}function isConst(e){return isConstTag(e[TAG])}function track(e){let t;beginTrackFrame();try{e()}finally{t=endTrackFrame()}return t}function untrack(e){beginUntrackFrame();try{return e()}finally{endUntrackFrame()}}var TRACKED_TAGS=new WeakMap;function dirtyTagFor(e,t,r){let n=void 0===r?TRACKED_TAGS.get(e):r;if(void 0===n)return;let i=n.get(t);void 0!==i&&DIRTY_TAG$1(i,!0)}function tagMetaFor(e){let t=TRACKED_TAGS.get(e);return void 0===t&&(t=new Map,TRACKED_TAGS.set(e,t)),t}function tagFor(e,t,r){let n=void 0===r?tagMetaFor(e):r,i=n.get(t);return void 0===i&&(i=createUpdatableTag(),n.set(t,i)),i}function isObject(e){return null!==e&&("object"==typeof e||"function"==typeof e)}function isPresentArray(e){return!!e&&e.length>0}function getLast(e){return 0===e.length?void 0:e[e.length-1]}function getFirst(e){return 0===e.length?void 0:e[0]}function unwrap$1(e){return e}function expect(e){return e}function dict(){return Object.create(null)}function isDict(e){return null!=e}function isIndexable$2(e){return"function"==typeof e||"object"==typeof e&&null!==e}var StackImpl=class{stack;current=null;constructor(e=[]){this.stack=e}get size(){return this.stack.length}push(e){this.current=e,this.stack.push(e)}pop(){let e=this.stack.pop();return this.current=getLast(this.stack)??null,void 0===e?null:e}nth(e){let t=this.stack.length;return t<e?null:unwrap$1(this.stack[t-e])}isEmpty(){return 0===this.stack.length}snapshot(){return[...this.stack]}toArray(){return this.stack}},REFERENCE=Symbol("REFERENCE"),CONSTANT=0,COMPUTE=1,UNBOUND=2,INVOKABLE=3,ReferenceImpl=class{[REFERENCE];tag=null;lastRevision=1;lastValue;children=null;compute=null;update=null;debugLabel;constructor(e){this[REFERENCE]=e}};function createPrimitiveRef(e){const t=new ReferenceImpl(UNBOUND);return t.tag=CONSTANT_TAG,t.lastValue=e,t}var UNDEFINED_REFERENCE=createPrimitiveRef(void 0),NULL_REFERENCE=createPrimitiveRef(null),TRUE_REFERENCE=createPrimitiveRef(!0),FALSE_REFERENCE=createPrimitiveRef(!1),createDebugAliasRef;function createConstRef(e){const t=new ReferenceImpl(CONSTANT);return t.lastValue=e,t.tag=CONSTANT_TAG,t}function createUnboundRef(e){const t=new ReferenceImpl(UNBOUND);return t.lastValue=e,t.tag=CONSTANT_TAG,t}function createComputeRef(e,t=null){const r=new ReferenceImpl(COMPUTE);return r.compute=e,r.update=t,r}function createReadOnlyRef(e){return isUpdatableRef(e)?createComputeRef(()=>valueForRef(e),null,e.debugLabel):e}function isInvokableRef(e){return e[REFERENCE]===INVOKABLE}function createInvokableRef(e){const t=createComputeRef(()=>valueForRef(e),t=>updateRef(e,t));return t.debugLabel=e.debugLabel,t[REFERENCE]=INVOKABLE,t}function isConstRef(e){return e.tag===CONSTANT_TAG}function isUpdatableRef(e){return null!==e.update}function valueForRef(e){const t=e;let{tag:r}=t;if(r===CONSTANT_TAG)return t.lastValue;const{lastRevision:n}=t;let i;if(null!==r&&validateTag(r,n))i=t.lastValue;else{const{compute:e}=t,n=track(()=>{i=t.lastValue=e()});r=t.tag=n,t.lastRevision=valueForTag(n)}return consumeTag(r),i}function updateRef(e,t){expect(e.update)(t)}function childRefFor(e,t){const r=e,n=r[REFERENCE];let i,o=r.children;if(null===o)o=r.children=new Map;else{const e=o.get(t);if(e)return e}if(n===UNBOUND){const e=valueForRef(r);i=isDict(e)?createUnboundRef(e[t]):UNDEFINED_REFERENCE}else i=createComputeRef(()=>{const e=valueForRef(r);if(isDict(e))return getProp(e,t)},e=>{const n=valueForRef(r);if(isDict(n))return setProp(n,t,e)});return o.set(t,i),i}function childRefFromParts(e,t){let r=e;for(const n of t)r=childRefFor(r,n);return r}var CUSTOM_TAG_FOR=new WeakMap;function getCustomTagFor(e){return CUSTOM_TAG_FOR.get(e)}function setCustomTagFor(e,t){CUSTOM_TAG_FOR.set(e,t)}function convertToInt$1(e){if("symbol"==typeof e)return null;const t=Number(e);return isNaN(t)?null:t%1==0?t:null}function tagForNamedArg(e,t){return track(()=>{t in e&&valueForRef(e[t])})}function tagForPositionalArg(e,t){return track(()=>{"[]"===t&&e.forEach(valueForRef);const r=convertToInt$1(t);null!==r&&r>=0&&r<e.length&&valueForRef(e[r])})}var NamedArgsProxy=class{constructor(e){this.named=e}get(e,t){const r=this.named[t];if(void 0!==r)return valueForRef(r)}has(e,t){return t in this.named}ownKeys(){return Object.keys(this.named)}isExtensible(){return!1}getOwnPropertyDescriptor(e,t){return{enumerable:!0,configurable:!0}}},PositionalArgsProxy=class{constructor(e){this.positional=e}get(e,t){let{positional:r}=this;if("length"===t)return r.length;const n=convertToInt$1(t);return null!==n&&n>=0&&n<r.length?valueForRef(r[n]):e[t]}isExtensible(){return!1}has(e,t){const r=convertToInt$1(t);return null!==r&&r>=0&&r<this.positional.length}},argsProxyFor=e=>{const{named:t,positional:r}=e,n=new NamedArgsProxy(t),i=new PositionalArgsProxy(r),o=Object.create(null),s=new Proxy(o,n),a=new Proxy([],i);return setCustomTagFor(s,(e,r)=>tagForNamedArg(t,r)),setCustomTagFor(a,(e,t)=>tagForPositionalArg(r,t)),{named:s,positional:a}};function objectAt(e,t){return Array.isArray(e)?e[t]:e.objectAt(t)}var SELF_TAG=Symbol("SELF_TAG");function tagForProperty(e,t,r=!1,n){let i=getCustomTagFor(e);return void 0!==i?i(e,t,r):tagFor(e,t,n)}function tagForObject(e){return isObject(e)?tagFor(e,SELF_TAG):CONSTANT_TAG}function markObjectAsDirty(e,t){dirtyTagFor(e,t),dirtyTagFor(e,SELF_TAG)}var CHAIN_PASS_THROUGH=new WeakSet;function finishLazyChains(e,t,r){let n=e.readableLazyChainsFor(t);if(void 0!==n){if(isObject(r))for(let[e,t]of n)UPDATE_TAG(e,getChainTagsForKey(r,t,tagMetaFor(r),peekMeta(r)));n.length=0}}function getChainTagsForKeys(e,t,r,n){let i=[];for(let o of t)getChainTags(i,e,o,r,n);return combine(i)}function getChainTagsForKey(e,t,r,n){return combine(getChainTags([],e,t,r,n))}function getChainTags(e,t,r,n,i){let o,s,a=t,l=n,c=i,u=r.length,h=-1;for(;;){let t=h+1;if(h=r.indexOf(".",t),-1===h&&(h=u),o=r.slice(t,h),"@each"===o&&h!==u){t=h+1,h=r.indexOf(".",t);let n=a.length;if("number"!=typeof n||!Array.isArray(a)&&!("objectAt"in a))break;if(0===n){e.push(tagForProperty(a,"[]"));break}o=-1===h?r.slice(t):r.slice(t,h);for(let t=0;t<n;t++){let r=objectAt(a,t);r&&(e.push(tagForProperty(r,o,!0)),c=peekMeta(r),s=null!==c?c.peekDescriptors(o):void 0,void 0!==s&&"string"==typeof s.altKey&&r[o])}e.push(tagForProperty(a,"[]",!0,l));break}let n=tagForProperty(a,o,!0,l);if(s=null!==c?c.peekDescriptors(o):void 0,e.push(n),h===u){CHAIN_PASS_THROUGH.has(s)&&a[o];break}if(void 0===s)a=o in a||"function"!=typeof a.unknownProperty?a[o]:a.unknownProperty(o);else if(CHAIN_PASS_THROUGH.has(s))a=a[o];else{let t=c.source===a?c:meta$1(a),i=t.revisionFor(o);if(void 0===i||!validateTag(n,i)){let n=t.writableLazyChainsFor(o),i=r.substring(h+1),s=createUpdatableTag();n.push([s,i]),e.push(s);break}a=t.valueFor(o)}if(!isObject(a))break;l=tagMetaFor(a),c=peekMeta(a)}return e}var HAS_SUPER_PATTERN=/\.(_super|call\(this|apply\(this)/,fnToString=Function.prototype.toString,checkHasSuper=fnToString.call(function(){return this}).indexOf("return this")>-1?function(e){return HAS_SUPER_PATTERN.test(fnToString.call(e))}:function(){return!0},HAS_SUPER_MAP=new WeakMap,ROOT=Object.freeze(function(){});function hasSuper(e){let t=HAS_SUPER_MAP.get(e);return void 0===t&&(t=checkHasSuper(e),HAS_SUPER_MAP.set(e,t)),t}HAS_SUPER_MAP.set(ROOT,!1);var ObserverListenerMeta=class{listeners=void 0;observers=void 0},OBSERVERS_LISTENERS_MAP=new WeakMap;function createObserverListenerMetaFor(e){let t=OBSERVERS_LISTENERS_MAP.get(e);return void 0===t&&(t=new ObserverListenerMeta,OBSERVERS_LISTENERS_MAP.set(e,t)),t}function observerListenerMetaFor(e){return OBSERVERS_LISTENERS_MAP.get(e)}function setObservers(e,t){createObserverListenerMetaFor(e).observers=t}function setListeners(e,t){createObserverListenerMetaFor(e).listeners=t}var IS_WRAPPED_FUNCTION_SET=new WeakSet;function wrap$2(e,t){return hasSuper(e)?!IS_WRAPPED_FUNCTION_SET.has(t)&&hasSuper(t)?_wrap(e,_wrap(t,ROOT)):_wrap(e,t):e}function _wrap(e,t){function r(){let r=this._super;this._super=t;let n=e.apply(this,arguments);return this._super=r,n}IS_WRAPPED_FUNCTION_SET.add(r);let n=OBSERVERS_LISTENERS_MAP.get(e);return void 0!==n&&OBSERVERS_LISTENERS_MAP.set(r,n),r}function addListener(e,t,r,n,i,o=!0){n||"function"!=typeof r||(n=r,r=null),meta$1(e).addToListeners(t,r,n,!0===i,o)}function removeListener(e,t,r,n){let i,o;"object"==typeof r?(i=r,o=n):(i=null,o=r),meta$1(e).removeFromListeners(t,i,o)}function sendEvent(e,t,r,n,i){if(void 0===n){let r=void 0===i?peekMeta(e):i;n=null!==r?r.matchingListeners(t):void 0}if(void 0===n||0===n.length)return!1;for(let o=n.length-3;o>=0;o-=3){let i=n[o],s=n[o+1],a=n[o+2];if(!s)continue;a&&removeListener(e,t,i,s),i||(i=e);let l=typeof s;"string"!==l&&"symbol"!==l||(s=i[s]),s.apply(i,r)}return!0}function hasListeners(e,t){let r=peekMeta(e);if(null===r)return!1;let n=r.matchingListeners(t);return void 0!==n&&n.length>0}function on$3(...e){let t=e.pop();return setListeners(t,e),t}var AFTER_OBSERVERS=":change";function changeEvent(e){return e+AFTER_OBSERVERS}var SYNC_DEFAULT=!ENV$1._DEFAULT_ASYNC_OBSERVERS,SYNC_OBSERVERS=new Map,ASYNC_OBSERVERS=new Map;function addObserver(e,t,r,n,i=SYNC_DEFAULT){let o=changeEvent(t);addListener(e,o,r,n,!1,i);let s=peekMeta(e);null!==s&&(s.isPrototypeMeta(e)||s.isInitializing())||activateObserver(e,o,i)}function removeObserver(e,t,r,n,i=SYNC_DEFAULT){let o=changeEvent(t),s=peekMeta(e);null!==s&&(s.isPrototypeMeta(e)||s.isInitializing())||deactivateObserver(e,o,i),removeListener(e,o,r,n)}function getOrCreateActiveObserversFor(e,t){let r=!0===t?SYNC_OBSERVERS:ASYNC_OBSERVERS;return r.has(e)||(r.set(e,new Map),registerDestructor$1(e,()=>destroyObservers(e),!0)),r.get(e)}function activateObserver(e,t,r=!1){let n=getOrCreateActiveObserversFor(e,r);if(n.has(t))n.get(t).count++;else{let r=t.substring(0,t.lastIndexOf(":")),i=getChainTagsForKey(e,r,tagMetaFor(e),peekMeta(e));n.set(t,{count:1,path:r,tag:i,lastRevision:valueForTag(i),suspended:!1})}}var DEACTIVATE_SUSPENDED=!1,SCHEDULED_DEACTIVATE=[];function deactivateObserver(e,t,r=!1){if(!0===DEACTIVATE_SUSPENDED)return void SCHEDULED_DEACTIVATE.push([e,t,r]);let n=!0===r?SYNC_OBSERVERS:ASYNC_OBSERVERS,i=n.get(e);if(void 0!==i){let r=i.get(t);r.count--,0===r.count&&(i.delete(t),0===i.size&&n.delete(e))}}function suspendedObserverDeactivation(){DEACTIVATE_SUSPENDED=!0}function resumeObserverDeactivation(){DEACTIVATE_SUSPENDED=!1;for(let[e,t,r]of SCHEDULED_DEACTIVATE)deactivateObserver(e,t,r);SCHEDULED_DEACTIVATE=[]}function revalidateObservers(e){ASYNC_OBSERVERS.has(e)&&ASYNC_OBSERVERS.get(e).forEach(t=>{t.tag=getChainTagsForKey(e,t.path,tagMetaFor(e),peekMeta(e)),t.lastRevision=valueForTag(t.tag)}),SYNC_OBSERVERS.has(e)&&SYNC_OBSERVERS.get(e).forEach(t=>{t.tag=getChainTagsForKey(e,t.path,tagMetaFor(e),peekMeta(e)),t.lastRevision=valueForTag(t.tag)})}var lastKnownRevision=0;function flushAsyncObservers(e){let t=valueForTag(CURRENT_TAG);lastKnownRevision!==t&&(lastKnownRevision=t,ASYNC_OBSERVERS.forEach((t,r)=>{let n=peekMeta(r);t.forEach((t,i)=>{if(!validateTag(t.tag,t.lastRevision)){let o=()=>{try{sendEvent(r,i,[r,t.path],void 0,n)}finally{t.tag=getChainTagsForKey(r,t.path,tagMetaFor(r),peekMeta(r)),t.lastRevision=valueForTag(t.tag)}};e?e("actions",o):o()}})}))}function flushSyncObservers(){SYNC_OBSERVERS.forEach((e,t)=>{let r=peekMeta(t);e.forEach((e,n)=>{if(!e.suspended&&!validateTag(e.tag,e.lastRevision))try{e.suspended=!0,sendEvent(t,n,[t,e.path],void 0,r)}finally{e.tag=getChainTagsForKey(t,e.path,tagMetaFor(t),peekMeta(t)),e.lastRevision=valueForTag(e.tag),e.suspended=!1}})})}function setObserverSuspended(e,t,r){let n=SYNC_OBSERVERS.get(e);if(!n)return;let i=n.get(changeEvent(t));i&&(i.suspended=r)}function destroyObservers(e){SYNC_OBSERVERS.size>0&&SYNC_OBSERVERS.delete(e),ASYNC_OBSERVERS.size>0&&ASYNC_OBSERVERS.delete(e)}var assert$4=()=>{},{toString:objectToString}=Object.prototype,{toString:functionToString}=Function.prototype,{isArray:isArray$7}=Array,{keys:objectKeys}=Object,{stringify:stringify}=JSON,LIST_LIMIT=100,DEPTH_LIMIT=4,SAFE_KEY=/^[\w$]+$/;function inspect(e){return"number"==typeof e&&2===arguments.length?this:inspectValue(e,0)}function inspectValue(e,t,r){let n=!1;switch(typeof e){case"undefined":return"undefined";case"object":if(null===e)return"null";if(isArray$7(e)){n=!0;break}if(e.toString===objectToString||void 0===e.toString)break;return e.toString();case"function":return e.toString===functionToString?e.name?`[Function:${e.name}]`:"[Function]":e.toString();case"string":return stringify(e);default:return e.toString()}if(void 0===r)r=new WeakSet;else if(r.has(e))return"[Circular]";return r.add(e),n?inspectArray(e,t+1,r):inspectObject(e,t+1,r)}function inspectKey(e){return SAFE_KEY.test(e)?e:stringify(e)}function inspectObject(e,t,r){if(t>DEPTH_LIMIT)return"[Object]";let n="{",i=objectKeys(e);for(let o=0;o<i.length;o++){if(n+=0===o?" ":", ",o>=LIST_LIMIT){n+=`... ${i.length-LIST_LIMIT} more keys`;break}let s=i[o];assert$4("has key",s),n+=`${inspectKey(String(s))}: ${inspectValue(e[s],t,r)}`}return n+=" }",n}function inspectArray(e,t,r){if(t>DEPTH_LIMIT)return"[Array]";let n="[";for(let i=0;i<e.length;i++){if(n+=0===i?" ":", ",i>=LIST_LIMIT){n+=`... ${e.length-LIST_LIMIT} more items`;break}n+=inspectValue(e[i],t,r)}return n+=" ]",n}var END_WITH_EACH_REGEX=/\.@each$/;function expandProperties(e,t){let r=e.indexOf("{");r<0?t(e.replace(END_WITH_EACH_REGEX,".[]")):dive("",e,r,t)}function dive(e,t,r,n){let i,o,s=t.indexOf("}"),a=0,l=t.substring(r+1,s).split(","),c=t.substring(s+1);for(e+=t.substring(0,r),o=l.length;a<o;)i=c.indexOf("{"),i<0?n((e+l[a++]+c).replace(END_WITH_EACH_REGEX,".[]")):dive(e+l[a++],c,i,n)}function defineProperty(e,t,r,n,i){let o=void 0===i?meta$1(e):i,s=descriptorForProperty(e,t,o),a=void 0!==s;a&&s.teardown(e,t,o),isClassicDecorator(r)?defineDecorator(e,t,r,o):null==r?defineValue(e,t,n,a,!0):Object.defineProperty(e,t,r),o.isPrototypeMeta(e)||revalidateObservers(e)}function defineDecorator(e,t,r,n){let i;return i=r(e,t,void 0,n),Object.defineProperty(e,t,i),r}function defineValue(e,t,r,n,i=!0){return!0===n||!1===i?Object.defineProperty(e,t,{configurable:!0,enumerable:i,writable:!0,value:r}):e[t]=r,r}var PROPERTY_DID_CHANGE=Symbol("PROPERTY_DID_CHANGE"),deferred$2=0;function notifyPropertyChange(e,t,r,n){let i=void 0===r?peekMeta(e):r;null!==i&&(i.isInitializing()||i.isPrototypeMeta(e))||(markObjectAsDirty(e,t),deferred$2<=0&&flushSyncObservers(),PROPERTY_DID_CHANGE in e&&(4===arguments.length?e[PROPERTY_DID_CHANGE](t,n):e[PROPERTY_DID_CHANGE](t)))}function beginPropertyChanges(){deferred$2++,suspendedObserverDeactivation()}function endPropertyChanges(){--deferred$2<=0&&(flushSyncObservers(),resumeObserverDeactivation())}function changeProperties(e){beginPropertyChanges();try{e()}finally{endPropertyChanges()}}function noop$4(){}var ComputedProperty=class extends ComputedDescriptor{_readOnly=!1;_hasConfig=!1;_getter=void 0;_setter=void 0;constructor(e){super();let t=e[e.length-1];if("function"==typeof t||null!==t&&"object"==typeof t){this._hasConfig=!0;let t=e.pop();if("function"==typeof t)this._getter=t;else{const e=t;this._getter=e.get||noop$4,this._setter=e.set}}e.length>0&&this._property(...e)}setup(e,t,r,n){if(super.setup(e,t,r,n),!1===this._hasConfig){let{get:e,set:t}=r;void 0!==e&&(this._getter=e),void 0!==t&&(this._setter=function(r,n){let i=t.call(this,n);return void 0!==e&&void 0===i?e.call(this):i})}}_property(...e){let t=[];function r(e){t.push(e)}for(let n of e)expandProperties(n,r);this._dependentKeys=t}get(e,t){let r,n=meta$1(e),i=tagMetaFor(e),o=tagFor(e,t,i),s=n.revisionFor(t);if(void 0!==s&&validateTag(o,s))r=n.valueFor(t);else{let{_getter:s,_dependentKeys:a}=this;untrack(()=>{r=s.call(e,t)}),void 0!==a&&UPDATE_TAG(o,getChainTagsForKeys(e,a,i,n)),n.setValueFor(t,r),n.setRevisionFor(t,valueForTag(o)),finishLazyChains(n,t,r)}return consumeTag(o),Array.isArray(r)&&consumeTag(tagFor(r,"[]")),r}set(e,t,r){this._readOnly&&this._throwReadOnlyError(e,t);let n,i=meta$1(e);i.isInitializing()&&void 0!==this._dependentKeys&&this._dependentKeys.length>0&&"function"==typeof e[PROPERTY_DID_CHANGE]&&e.isComponent&&addObserver(e,t,()=>{e[PROPERTY_DID_CHANGE](t)},void 0,!0);try{beginPropertyChanges(),n=this._set(e,t,r,i),finishLazyChains(i,t,n);let o=tagMetaFor(e),s=tagFor(e,t,o),{_dependentKeys:a}=this;void 0!==a&&UPDATE_TAG(s,getChainTagsForKeys(e,a,o,i)),i.setRevisionFor(t,valueForTag(s))}finally{endPropertyChanges()}return n}_throwReadOnlyError(e,t){throw new Error(`Cannot set read-only property "${t}" on object: ${inspect(e)}`)}_set(e,t,r,n){let i,o=void 0!==n.revisionFor(t),s=n.valueFor(t),{_setter:a}=this;setObserverSuspended(e,t,!0);try{i=a.call(e,t,r,s)}finally{setObserverSuspended(e,t,!1)}return o&&s===i||(n.setValueFor(t,i),notifyPropertyChange(e,t,n,r)),i}teardown(e,t,r){void 0!==r.revisionFor(t)&&(r.setRevisionFor(t,void 0),r.setValueFor(t,void 0)),super.teardown(e,t,r)}},AutoComputedProperty=class extends ComputedProperty{get(e,t){let r,n=meta$1(e),i=tagMetaFor(e),o=tagFor(e,t,i),s=n.revisionFor(t);if(void 0!==s&&validateTag(o,s))r=n.valueFor(t);else{let{_getter:i}=this,s=track(()=>{r=i.call(e,t)});UPDATE_TAG(o,s),n.setValueFor(t,r),n.setRevisionFor(t,valueForTag(o)),finishLazyChains(n,t,r)}return consumeTag(o),Array.isArray(r)&&consumeTag(tagFor(r,"[]",i)),r}},ComputedDecoratorImpl=class extends Function{readOnly(){return descriptorForDecorator(this)._readOnly=!0,this}meta(e){let t=descriptorForDecorator(this);return 0===arguments.length?t._meta||{}:(t._meta=e,this)}get _getter(){return descriptorForDecorator(this)._getter}set enumerable(e){descriptorForDecorator(this).enumerable=e}};function computed(...e){return isElementDescriptor(e)?makeComputedDecorator(new ComputedProperty([]),ComputedDecoratorImpl)(e[0],e[1],e[2]):makeComputedDecorator(new ComputedProperty(e),ComputedDecoratorImpl)}function autoComputed(...e){return makeComputedDecorator(new AutoComputedProperty(e),ComputedDecoratorImpl)}function isComputed(e,t){return Boolean(descriptorForProperty(e,t))}function getCachedValueFor(e,t){let r=peekMeta(e);return r?r.valueFor(t):void 0}var PROXIES=new WeakSet;function isProxy(e){return!!isObject(e)&&PROXIES.has(e)}function setProxy(e){isObject(e)&&PROXIES.add(e)}var EMBER_ARRAYS=new WeakSet;function setEmberArray(e){EMBER_ARRAYS.add(e)}function isEmberArray(e){return EMBER_ARRAYS.has(e)}var Cache$1=class{size=0;misses=0;hits=0;constructor(e,t,r=new Map){this.limit=e,this.func=t,this.store=r}get(e){return this.store.has(e)?(this.hits++,this.store.get(e)):(this.misses++,this.set(e,this.func(e)))}set(e,t){return this.limit>this.size&&(this.size++,this.store.set(e,t)),t}purge(){this.store.clear(),this.size=0,this.hits=0,this.misses=0}},firstDotIndexCache=new Cache$1(1e3,e=>e.indexOf("."));function isPath(e){return"string"==typeof e&&-1!==firstDotIndexCache.get(e)}var PROXY_CONTENT=Symbol("PROXY_CONTENT");function hasUnknownProperty(e){return"object"==typeof e&&null!==e&&"function"==typeof e.unknownProperty}function get$7(e,t){return isPath(t)?_getPath(e,t):_getProp(e,t)}function _getProp(e,t){if(null==e)return;let r;return"object"==typeof e||"function"==typeof e?(r=e[t],void 0===r&&"object"==typeof e&&!(t in e)&&hasUnknownProperty(e)&&(r=e.unknownProperty(t)),isTracking()&&(consumeTag(tagFor(e,t)),(Array.isArray(r)||isEmberArray(r))&&consumeTag(tagFor(r,"[]")))):r=e[t],r}function _getPath(e,t,r){let n="string"==typeof t?t.split("."):t;for(let i of n){if(null==e||e.isDestroyed)return;if(r&&("__proto__"===i||"constructor"===i))return;e=_getProp(e,i)}return e}_getProp("foo","a"),_getProp("foo",1),_getProp({},"a"),_getProp({},1),_getProp({unknownProperty(){}},"a"),_getProp({unknownProperty(){}},1),get$7({},"foo"),get$7({},"foo.bar");var fakeProxy={};function lookupDescriptor(e,t){let r=e;do{let e=Object.getOwnPropertyDescriptor(r,t);if(void 0!==e)return e;r=Object.getPrototypeOf(r)}while(null!==r);return null}function set$1(e,t,r,n){return e.isDestroyed?r:isPath(t)?_setPath(e,t,r,n):_setProp(e,t,r)}function _setProp(e,t,r){let n,i=lookupDescriptor(e,t);return null!==i&&COMPUTED_SETTERS.has(i.set)?(e[t]=r,r):(n=e[t],void 0!==n||"object"!=typeof e||t in e||"function"!=typeof e.setUnknownProperty?(e[t]=r,n!==r&&notifyPropertyChange(e,t)):e.setUnknownProperty(t,r),r)}function _setPath(e,t,r,n){let i=t.split("."),o=i.pop(),s=_getPath(e,i,!0);if(null!=s)return set$1(s,o,r);if(!n)throw new Error(`Property set failed: object in path "${i.join(".")}" could not be found.`)}function trySet(e,t,r){return set$1(e,t,r,!0)}function alias(e){return makeComputedDecorator(new AliasedProperty(e),AliasDecoratorImpl)}setProxy(fakeProxy),track(()=>_getProp({},"a")),track(()=>_getProp({},1)),track(()=>_getProp({a:[]},"a")),track(()=>_getProp({a:fakeProxy},"a"));var AliasDecoratorImpl=class extends Function{readOnly(){return descriptorForDecorator(this).readOnly(),this}oneWay(){return descriptorForDecorator(this).oneWay(),this}meta(e){let t=descriptorForDecorator(this);if(0===arguments.length)return t._meta||{};t._meta=e}},AliasedProperty=class extends ComputedDescriptor{altKey;constructor(e){super(),this.altKey=e}setup(e,t,r,n){super.setup(e,t,r,n),CHAIN_PASS_THROUGH.add(this)}get(e,t){let r,n=meta$1(e),i=tagMetaFor(e),o=tagFor(e,t,i);untrack(()=>{r=get$7(e,this.altKey)});let s=n.revisionFor(t);return void 0!==s&&validateTag(o,s)||(UPDATE_TAG(o,getChainTagsForKey(e,this.altKey,i,n)),n.setRevisionFor(t,valueForTag(o)),finishLazyChains(n,t,r)),consumeTag(o),r}set(e,t,r){return set$1(e,this.altKey,r)}readOnly(){this.set=AliasedProperty_readOnlySet}oneWay(){this.set=AliasedProperty_oneWaySet}};function AliasedProperty_readOnlySet(e,t){throw new Error(`Cannot set read-only property '${t}' on object: ${inspect(e)}`)}function AliasedProperty_oneWaySet(e,t,r){return defineProperty(e,t,null),set$1(e,t,r)}function arrayContentWillChange(e,t,r,n){return void 0===t?(t=0,r=n=-1):(void 0===r&&(r=-1),void 0===n&&(n=-1)),sendEvent(e,"@array:before",[e,t,r,n]),e}function arrayContentDidChange(e,t,r,n,i=!0){void 0===t?(t=0,r=n=-1):(void 0===r&&(r=-1),void 0===n&&(n=-1));let o=peekMeta(e);if(i&&((n<0||r<0||n-r!==0)&&notifyPropertyChange(e,"length",o),notifyPropertyChange(e,"[]",o)),sendEvent(e,"@array:change",[e,t,r,n]),null!==o){let i=-1===r?0:r,s=e.length-((-1===n?0:n)-i),a=t<0?s+t:t;void 0!==o.revisionFor("firstObject")&&0===a&&notifyPropertyChange(e,"firstObject",o),void 0!==o.revisionFor("lastObject")&&s-1<a+i&&notifyPropertyChange(e,"lastObject",o)}return e}var EMPTY_ARRAY$4=Object.freeze([]);function isMutableArray(e){return null!=e&&"function"==typeof e.replace}function replace(e,t,r,n=EMPTY_ARRAY$4){isMutableArray(e)?e.replace(t,r,n):replaceInNativeArray(e,t,r,n)}var CHUNK_SIZE=6e4;function replaceInNativeArray(e,t,r,n){if(arrayContentWillChange(e,t,r,n.length),n.length<=CHUNK_SIZE)e.splice(t,r,...n);else{e.splice(t,r);for(let r=0;r<n.length;r+=CHUNK_SIZE){let i=n.slice(r,r+CHUNK_SIZE);e.splice(t+r,0,...i)}}arrayContentDidChange(e,t,r,n.length)}function arrayObserversHelper(e,t,r,n){let{willChange:i,didChange:o}=r;return n(e,"@array:before",t,i),n(e,"@array:change",t,o),e._revalidate?.(),e}function addArrayObserver(e,t,r){return arrayObserversHelper(e,t,r,addListener)}function removeArrayObserver(e,t,r){return arrayObserversHelper(e,t,r,removeListener)}var version_exports=__exportAll({default:()=>VERSION}),VERSION="7.1.0",Libraries=class{_registry;_coreLibIndex;constructor(){this._registry=[],this._coreLibIndex=0}_getLibraryByName(e){let t=this._registry;for(let r of t)if(r.name===e)return r}register(e,t,r){let n=this._registry.length;this._getLibraryByName(e)||(r&&(n=this._coreLibIndex++),this._registry.splice(n,0,{name:e,version:t}))}registerCoreLibrary(e,t){this.register(e,t,!0)}deRegister(e){let t,r=this._getLibraryByName(e);r&&(t=this._registry.indexOf(r),this._registry.splice(t,1))}},LIBRARIES=new Libraries;function getProperties(e,t){let r,n={},i=1;for(2===arguments.length&&Array.isArray(t)?(i=0,r=arguments[1]):r=Array.from(arguments);i<r.length;i++){let t=r[i];n[t]=get$7(e,t)}return n}function setProperties(e,t){return null===t||"object"!=typeof t||changeProperties(()=>{let r=Object.keys(t);for(let n of r)set$1(e,n,t[n])}),t}LIBRARIES.registerCoreLibrary("Ember",VERSION);var OWNER$1=Symbol("OWNER"),DEBUG_INJECTION_FUNCTIONS;function getOwner$3(e){return e[OWNER$1]}function setOwner$2(e,t){e[OWNER$1]=t}function isFactory(e){return null!=e&&"function"==typeof e.create}function getOwner$2(e){return getOwner$3(e)}function setOwner$1(e,t){setOwner$2(e,t)}function inject$2(e,...t){let r,n;isElementDescriptor(t)?r=t:"string"==typeof t[0]&&(n=t[0]);let i=computed({get:function(t){return(getOwner$2(this)||this.container).lookup(`${e}:${n||t}`)},set(e,t){defineProperty(this,e,null,t)}});return r?i(r[0],r[1],r[2]):i}function trackedData(e,t){let r=new WeakMap,n="function"==typeof t;return{getter:function(i){let o;return consumeTag(tagFor(i,e)),n&&!r.has(i)?(o=t.call(i),r.set(i,o)):o=r.get(i),o},setter:function(t,n){dirtyTagFor(t,e),r.set(t,n)}}}function tracked(...e){if(!isElementDescriptor(e)){let t=e[0],r=t?t.initializer:void 0,n=t?t.value:void 0,i=function(e,t){return descriptorForField([e,t,{initializer:r||(()=>n)}])};return setClassicDecorator(i),i}return descriptorForField(e)}function descriptorForField([e,t,r]){let{getter:n,setter:i}=trackedData(t,r?r.initializer:void 0);function o(){let e=n(this);return(Array.isArray(e)||isEmberArray(e))&&consumeTag(tagFor(e,"[]")),e}function s(e){i(this,e),dirtyTagFor(this,SELF_TAG)}let a={enumerable:!0,configurable:!0,isTracked:!0,get:o,set:s};return COMPUTED_SETTERS.add(s),meta$1(e).writeDescriptors(t,new TrackedDescriptor(o,s)),a}var TrackedDescriptor=class{constructor(e,t){this._get=e,this._set=t,CHAIN_PASS_THROUGH.add(this)}get(e){return this._get.call(e)}set(e,t,r){this._set.call(e,r)}},cached=(...e)=>{const[t,r,n]=e,i=new WeakMap,o=n.get;n.get=function(){return i.has(this)||i.set(this,createCache(o.bind(this))),getValue$1(i.get(this))}},environment_exports$1=__exportAll({ENV:()=>ENV$1,context:()=>context$2,getENV:()=>getENV,getLookup:()=>getLookup,setLookup:()=>setLookup}),global$1=globalThis,Ember=global$1.Ember,context$2=void 0===Ember?{imports:global$1,exports:global$1,lookup:global$1}:{imports:Ember.imports||global$1,exports:Ember.exports||global$1,lookup:Ember.lookup||global$1};function getLookup(){return context$2.lookup}function setLookup(e){context$2.lookup=e}var NAMES=new WeakMap;function setName(e,t){isObject(e)&&NAMES.set(e,t)}function getName(e){return NAMES.get(e)}var hasOwnProperty$3=Object.prototype.hasOwnProperty,searchDisabled=!1,flags={_set:0,_unprocessedNamespaces:!1,get unprocessedNamespaces(){return this._unprocessedNamespaces},set unprocessedNamespaces(e){this._set++,this._unprocessedNamespaces=e}},unprocessedMixins=!1,NAMESPACES=[],NAMESPACES_BY_ID=Object.create(null);function addNamespace(e){flags.unprocessedNamespaces=!0,NAMESPACES.push(e)}function removeNamespace(e){let t=getName(e);delete NAMESPACES_BY_ID[t],NAMESPACES.splice(NAMESPACES.indexOf(e),1),t in context$2.lookup&&e===context$2.lookup[t]&&(context$2.lookup[t]=void 0)}function findNamespaces(){if(!flags.unprocessedNamespaces)return;let e=context$2.lookup,t=Object.keys(e);for(let r of t){if(!isUppercase(r.charCodeAt(0)))continue;let t=tryIsNamespace(e,r);t&&setName(t,r)}}function findNamespace(e){return searchDisabled||processAllNamespaces(),NAMESPACES_BY_ID[e]}function processNamespace(e){_processNamespace([e.toString()],e,new Set)}function processAllNamespaces(){let e=flags.unprocessedNamespaces;if(e&&(findNamespaces(),flags.unprocessedNamespaces=!1),e||unprocessedMixins){let e=NAMESPACES;for(let t of e)processNamespace(t);unprocessedMixins=!1}}function isSearchDisabled(){return searchDisabled}function setSearchDisabled(e){searchDisabled=Boolean(e)}function setUnprocessedMixins(){unprocessedMixins=!0}function _processNamespace(e,t,r){let n=e.length,i=e.join(".");NAMESPACES_BY_ID[i]=t,setName(t,i);for(let o in t){if(!hasOwnProperty$3.call(t,o))continue;let i=t[o];if(e[n]=o,i&&void 0===getName(i))setName(i,e.join("."));else if(i&&isNamespace(i)){if(r.has(i))continue;r.add(i),_processNamespace(e,i,r)}}e.length=n}function isNamespace(e){return null!=e&&"object"==typeof e&&e.isNamespace}function isUppercase(e){return e>=65&&e<=90}function tryIsNamespace(e,t){try{let r=e[t];return(null!==r&&"object"==typeof r||"function"==typeof r)&&r.isNamespace&&r}catch(r){}}var metal_exports=__exportAll({ASYNC_OBSERVERS:()=>ASYNC_OBSERVERS,ComputedDescriptor:()=>ComputedDescriptor,ComputedProperty:()=>ComputedProperty,DEBUG_INJECTION_FUNCTIONS:()=>DEBUG_INJECTION_FUNCTIONS,Libraries:()=>Libraries,NAMESPACES:()=>NAMESPACES,NAMESPACES_BY_ID:()=>NAMESPACES_BY_ID,PROPERTY_DID_CHANGE:()=>PROPERTY_DID_CHANGE,PROXY_CONTENT:()=>PROXY_CONTENT,SYNC_OBSERVERS:()=>SYNC_OBSERVERS,TrackedDescriptor:()=>TrackedDescriptor,_getPath:()=>_getPath,_getProp:()=>_getProp,_setProp:()=>_setProp,activateObserver:()=>activateObserver,addArrayObserver:()=>addArrayObserver,addListener:()=>addListener,addNamespace:()=>addNamespace,addObserver:()=>addObserver,alias:()=>alias,arrayContentDidChange:()=>arrayContentDidChange,arrayContentWillChange:()=>arrayContentWillChange,autoComputed:()=>autoComputed,beginPropertyChanges:()=>beginPropertyChanges,cached:()=>cached,changeProperties:()=>changeProperties,computed:()=>computed,createCache:()=>createCache,defineDecorator:()=>defineDecorator,defineProperty:()=>defineProperty,defineValue:()=>defineValue,deprecateProperty:()=>deprecateProperty,descriptorForDecorator:()=>descriptorForDecorator,descriptorForProperty:()=>descriptorForProperty,eachProxyArrayDidChange:()=>eachProxyArrayDidChange,eachProxyArrayWillChange:()=>eachProxyArrayWillChange,endPropertyChanges:()=>endPropertyChanges,expandProperties:()=>expandProperties,findNamespace:()=>findNamespace,findNamespaces:()=>findNamespaces,flushAsyncObservers:()=>flushAsyncObservers,get:()=>get$7,getCachedValueFor:()=>getCachedValueFor,getProperties:()=>getProperties,getValue:()=>getValue$1,hasListeners:()=>hasListeners,hasUnknownProperty:()=>hasUnknownProperty,inject:()=>inject$2,isClassicDecorator:()=>isClassicDecorator,isComputed:()=>isComputed,isConst:()=>isConst,isElementDescriptor:()=>isElementDescriptor,isNamespaceSearchDisabled:()=>isSearchDisabled,libraries:()=>LIBRARIES,makeComputedDecorator:()=>makeComputedDecorator,markObjectAsDirty:()=>markObjectAsDirty,nativeDescDecorator:()=>nativeDescDecorator,notifyPropertyChange:()=>notifyPropertyChange,objectAt:()=>objectAt,on:()=>on$3,processAllNamespaces:()=>processAllNamespaces,processNamespace:()=>processNamespace,removeArrayObserver:()=>removeArrayObserver,removeListener:()=>removeListener,removeNamespace:()=>removeNamespace,removeObserver:()=>removeObserver,replace:()=>replace,replaceInNativeArray:()=>replaceInNativeArray,revalidateObservers:()=>revalidateObservers,sendEvent:()=>sendEvent,set:()=>set$1,setClassicDecorator:()=>setClassicDecorator,setNamespaceSearchDisabled:()=>setSearchDisabled,setProperties:()=>setProperties,setUnprocessedMixins:()=>setUnprocessedMixins,tagForObject:()=>tagForObject,tagForProperty:()=>tagForProperty,tracked:()=>tracked,trySet:()=>trySet});function deprecateProperty(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,set(e){set$1(this,r,e)},get(){return get$7(this,r)}})}var EACH_PROXIES=new WeakMap,onerror;function eachProxyArrayWillChange(e,t,r,n){let i=EACH_PROXIES.get(e);void 0!==i&&i.arrayWillChange(e,t,r,n)}function eachProxyArrayDidChange(e,t,r,n){let i=EACH_PROXIES.get(e);void 0!==i&&i.arrayDidChange(e,t,r,n)}var onErrorTarget={get onerror(){return onerror}};function getOnerror(){return onerror}var dispatchOverride=null;function getDispatchOverride(){return dispatchOverride}var SET_TIMEOUT=setTimeout,NOOP$3=()=>{};function buildNext(e){if("function"==typeof Promise){const t=Promise.resolve();return()=>t.then(e)}if("function"==typeof MutationObserver){let t=0,r=new MutationObserver(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),()=>(t=++t%2,n.data=""+t,t)}return()=>SET_TIMEOUT(e,0)}function buildPlatform(e){let t=NOOP$3;return{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now(),next:buildNext(e),clearNext:t}}var NUMBER=/\d+/,TIMERS_OFFSET=6;function isCoercableNumber(e){let t=typeof e;return"number"===t&&e==e||"string"===t&&NUMBER.test(e)}function getOnError(e){return e.onError||e.onErrorTarget&&e.onErrorTarget[e.onErrorMethod]}function findItem$1(e,t,r){let n=-1;for(let i=0,o=r.length;i<o;i+=4)if(r[i]===e&&r[i+1]===t){n=i;break}return n}function findTimerItem(e,t,r){let n=-1;for(let i=2,o=r.length;i<o;i+=6)if(r[i]===e&&r[i+1]===t){n=i-2;break}return n}function getQueueItems(e,t,r=0){let n=[];for(let i=0;i<e.length;i+=t){let t=e[i+3+r],o={target:e[i+0+r],method:e[i+1+r],args:e[i+2+r],stack:void 0!==t&&"stack"in t?t.stack:""};n.push(o)}return n}function binarySearch$4(e,t){let r,n,i=0,o=t.length-TIMERS_OFFSET;for(;i<o;)n=(o-i)/TIMERS_OFFSET,r=i+n-n%TIMERS_OFFSET,e>=t[r]?i=r+TIMERS_OFFSET:o=r;return e>=t[i]?i+TIMERS_OFFSET:i}var QUEUE_ITEM_LENGTH=4,Queue$1=class{constructor(e,t={},r={}){this._queueBeingFlushed=[],this.targetQueues=new Map,this.index=0,this._queue=[],this.name=e,this.options=t,this.globalOptions=r}stackFor(e){if(e<this._queue.length){let t=this._queue[3*e+QUEUE_ITEM_LENGTH];return t?t.stack:null}}flush(e){let t,r,n,i,o,{before:s,after:a}=this.options;this.targetQueues.clear(),0===this._queueBeingFlushed.length&&(this._queueBeingFlushed=this._queue,this._queue=[]),void 0!==s&&s();let l=this._queueBeingFlushed;if(l.length>0){let e=getOnError(this.globalOptions);o=e?this.invokeWithOnError:this.invoke;for(let s=this.index;s<l.length;s+=QUEUE_ITEM_LENGTH)if(this.index+=QUEUE_ITEM_LENGTH,r=l[s+1],null!==r&&(t=l[s],n=l[s+2],i=l[s+3],o(t,r,n,e,i)),this.index!==this._queueBeingFlushed.length&&this.globalOptions.mustYield&&this.globalOptions.mustYield())return 1}void 0!==a&&a(),this._queueBeingFlushed.length=0,this.index=0,!1!==e&&this._queue.length>0&&this.flush(!0)}hasWork(){return this._queueBeingFlushed.length>0||this._queue.length>0}cancel({target:e,method:t}){let r=this._queue,n=this.targetQueues.get(e);void 0!==n&&n.delete(t);let i=findItem$1(e,t,r);return i>-1?(r[i+1]=null,!0):(r=this._queueBeingFlushed,i=findItem$1(e,t,r),i>-1&&(r[i+1]=null,!0))}push(e,t,r,n){return this._queue.push(e,t,r,n),{queue:this,target:e,method:t}}pushUnique(e,t,r,n){let i=this.targetQueues.get(e);void 0===i&&(i=new Map,this.targetQueues.set(e,i));let o=i.get(t);if(void 0===o){let o=this._queue.push(e,t,r,n)-QUEUE_ITEM_LENGTH;i.set(t,o)}else{let e=this._queue;e[o+2]=r,e[o+3]=n}return{queue:this,target:e,method:t}}_getDebugInfo(e){if(e)return getQueueItems(this._queue,QUEUE_ITEM_LENGTH)}invoke(e,t,r){void 0===r?t.call(e):t.apply(e,r)}invokeWithOnError(e,t,r,n,i){try{void 0===r?t.call(e):t.apply(e,r)}catch(error){n(error,i)}}},DeferredActionQueues=class{constructor(e=[],t){this.queues={},this.queueNameIndex=0,this.queueNames=e,e.reduce(function(e,r){return e[r]=new Queue$1(r,t[r],t),e},this.queues)}schedule(e,t,r,n,i,o){let s=this.queues[e];if(void 0===s)throw new Error(`You attempted to schedule an action in a queue (${e}) that doesn't exist`);if(null==r)throw new Error(`You attempted to schedule an action in a queue (${e}) for a method that doesn't exist`);return this.queueNameIndex=0,i?s.pushUnique(t,r,n,o):s.push(t,r,n,o)}flush(e=!1){let t,r,n=this.queueNames.length;for(;this.queueNameIndex<n;)if(r=this.queueNames[this.queueNameIndex],t=this.queues[r],!1===t.hasWork()){if(this.queueNameIndex++,e&&this.queueNameIndex<n)return 1}else if(1===t.flush(!1))return 1}_getDebugInfo(e){if(e){let t,r,n={},i=this.queueNames.length,o=0;for(;o<i;)r=this.queueNames[o],t=this.queues[r],n[r]=t._getDebugInfo(e),o++;return n}}};function iteratorDrain(e){let t=e(),r=t.next();for(;!1===r.done;)r.value(),r=t.next()}var noop$3=function(){},DISABLE_SCHEDULE=Object.freeze([]);function parseArgs(){let e,t,r,n=arguments.length;if(0===n);else if(1===n)r=null,t=arguments[0];else{let i=2,o=arguments[0],s=arguments[1],a=typeof s;if("function"===a?(r=o,t=s):null!==o&&"string"===a&&s in o?(r=o,t=r[s]):"function"==typeof o&&(i=1,r=null,t=o),n>i){let t=n-i;e=new Array(t);for(let r=0;r<t;r++)e[r]=arguments[r+i]}}return[r,t,e]}function parseTimerArgs(){let[e,t,r]=parseArgs(...arguments),n=0,i=void 0!==r?r.length:0;return i>0&&isCoercableNumber(r[i-1])&&(n=parseInt(r.pop(),10)),[e,t,r,n]}function parseDebounceArgs(){let e,t,r,n,i;return 2===arguments.length?(t=arguments[0],i=arguments[1],e=null):([e,t,n]=parseArgs(...arguments),void 0===n?i=0:(i=n.pop(),isCoercableNumber(i)||(r=!0===i,i=n.pop()))),i=parseInt(i,10),[e,t,n,i,r]}var UUID=0,beginCount=0,endCount=0,beginEventCount=0,endEventCount=0,runCount=0,joinCount=0,deferCount=0,scheduleCount=0,scheduleIterableCount=0,deferOnceCount=0,scheduleOnceCount=0,setTimeoutCount=0,laterCount=0,throttleCount=0,debounceCount=0,cancelTimersCount=0,cancelCount=0,autorunsCreatedCount=0,autorunsCompletedCount=0,deferredActionQueuesCreatedCount=0,nestedDeferredActionQueuesCreated=0,Backburner=class{constructor(e,t){this.DEBUG=!1,this.currentInstance=null,this.instanceStack=[],this._eventCallbacks={end:[],begin:[]},this._timerTimeoutId=null,this._timers=[],this._autorun=!1,this._autorunStack=null,this.queueNames=e,this.options=t||{},"string"==typeof this.options.defaultQueue?this._defaultQueue=this.options.defaultQueue:this._defaultQueue=this.queueNames[0],this._onBegin=this.options.onBegin||noop$3,this._onEnd=this.options.onEnd||noop$3,this._boundRunExpiredTimers=this._runExpiredTimers.bind(this),this._boundAutorunEnd=()=>{autorunsCompletedCount++,!1!==this._autorun&&(this._autorun=!1,this._autorunStack=null,this._end(!0))};let r=this.options._buildPlatform||buildPlatform;this._platform=r(this._boundAutorunEnd)}get counters(){return{begin:beginCount,end:endCount,events:{begin:beginEventCount,end:endEventCount},autoruns:{created:autorunsCreatedCount,completed:autorunsCompletedCount},run:runCount,join:joinCount,defer:deferCount,schedule:scheduleCount,scheduleIterable:scheduleIterableCount,deferOnce:deferOnceCount,scheduleOnce:scheduleOnceCount,setTimeout:setTimeoutCount,later:laterCount,throttle:throttleCount,debounce:debounceCount,cancelTimers:cancelTimersCount,cancel:cancelCount,loops:{total:deferredActionQueuesCreatedCount,nested:nestedDeferredActionQueuesCreated}}}get defaultQueue(){return this._defaultQueue}begin(){beginCount++;let e,t=this.options,r=this.currentInstance;return!1!==this._autorun?(e=r,this._cancelAutorun()):(null!==r&&(nestedDeferredActionQueuesCreated++,this.instanceStack.push(r)),deferredActionQueuesCreatedCount++,e=this.currentInstance=new DeferredActionQueues(this.queueNames,t),beginEventCount++,this._trigger("begin",e,r)),this._onBegin(e,r),e}end(){endCount++,this._end(!1)}on(e,t){if("function"!=typeof t)throw new TypeError("Callback must be a function");let r=this._eventCallbacks[e];if(void 0===r)throw new TypeError(`Cannot on() event ${e} because it does not exist`);r.push(t)}off(e,t){let r=this._eventCallbacks[e];if(!e||void 0===r)throw new TypeError(`Cannot off() event ${e} because it does not exist`);let n=!1;if(t)for(let i=0;i<r.length;i++)r[i]===t&&(n=!0,r.splice(i,1),i--);if(!n)throw new TypeError("Cannot off() callback that does not exist")}run(){runCount++;let[e,t,r]=parseArgs(...arguments);return this._run(e,t,r)}join(){joinCount++;let[e,t,r]=parseArgs(...arguments);return this._join(e,t,r)}defer(e,t,r,...n){return deferCount++,this.schedule(e,t,r,...n)}schedule(e,...t){scheduleCount++;let[r,n,i]=parseArgs(...t),o=this.DEBUG?new Error:void 0;return this._ensureInstance().schedule(e,r,n,i,!1,o)}scheduleIterable(e,t){scheduleIterableCount++;let r=this.DEBUG?new Error:void 0;return this._ensureInstance().schedule(e,null,iteratorDrain,[t],!1,r)}deferOnce(e,t,r,...n){return deferOnceCount++,this.scheduleOnce(e,t,r,...n)}scheduleOnce(e,...t){scheduleOnceCount++;let[r,n,i]=parseArgs(...t),o=this.DEBUG?new Error:void 0;return this._ensureInstance().schedule(e,r,n,i,!0,o)}setTimeout(){return setTimeoutCount++,this.later(...arguments)}later(){laterCount++;let[e,t,r,n]=parseTimerArgs(...arguments);return this._later(e,t,r,n)}throttle(){throttleCount++;let e,[t,r,n,i,o=!0]=parseDebounceArgs(...arguments),s=findTimerItem(t,r,this._timers);if(-1===s)e=this._later(t,r,o?DISABLE_SCHEDULE:n,i),o&&this._join(t,r,n);else{e=this._timers[s+1];let t=s+4;this._timers[t]!==DISABLE_SCHEDULE&&(this._timers[t]=n)}return e}debounce(){debounceCount++;let e,[t,r,n,i,o=!1]=parseDebounceArgs(...arguments),s=this._timers,a=findTimerItem(t,r,s);if(-1===a)e=this._later(t,r,o?DISABLE_SCHEDULE:n,i),o&&this._join(t,r,n);else{let o=this._platform.now()+i,l=a+4;s[l]===DISABLE_SCHEDULE&&(n=DISABLE_SCHEDULE),e=s[a+1];let c=binarySearch$4(o,s);if(a+TIMERS_OFFSET===c)s[a]=o,s[l]=n;else{let i=this._timers[a+5];this._timers.splice(c,0,o,e,t,r,n,i),this._timers.splice(a,TIMERS_OFFSET)}0===a&&this._reinstallTimerTimeout()}return e}cancelTimers(){cancelTimersCount++,this._clearTimerTimeout(),this._timers=[],this._cancelAutorun()}hasTimers(){return this._timers.length>0||this._autorun}cancel(e){if(cancelCount++,null==e)return!1;let t=typeof e;return"number"===t?this._cancelLaterTimer(e):!("object"!==t||!e.queue||!e.method)&&e.queue.cancel(e)}ensureInstance(){this._ensureInstance()}getDebugInfo(){if(this.DEBUG)return{autorun:this._autorunStack,counters:this.counters,timers:getQueueItems(this._timers,TIMERS_OFFSET,2),instanceStack:[this.currentInstance,...this.instanceStack].map(e=>e&&e._getDebugInfo(this.DEBUG))}}_end(e){let t=this.currentInstance,r=null;if(null===t)throw new Error("end called without begin");let n,i=!1;try{n=t.flush(e)}finally{if(!i)if(i=!0,1===n){const e=this.queueNames[t.queueNameIndex];this._scheduleAutorun(e)}else this.currentInstance=null,this.instanceStack.length>0&&(r=this.instanceStack.pop(),this.currentInstance=r),this._trigger("end",t,r),this._onEnd(t,r)}}_join(e,t,r){return null===this.currentInstance?this._run(e,t,r):void 0===e&&void 0===r?t():t.apply(e,r)}_run(e,t,r){let n=getOnError(this.options);if(this.begin(),n)try{return t.apply(e,r)}catch(error){n(error)}finally{this.end()}else try{return t.apply(e,r)}finally{this.end()}}_cancelAutorun(){this._autorun&&(this._platform.clearNext(),this._autorun=!1,this._autorunStack=null)}_later(e,t,r,n){let i=this.DEBUG?new Error:void 0,o=this._platform.now()+n,s=UUID++;if(0===this._timers.length)this._timers.push(o,s,e,t,r,i),this._installTimerTimeout();else{let n=binarySearch$4(o,this._timers);this._timers.splice(n,0,o,s,e,t,r,i),this._reinstallTimerTimeout()}return s}_cancelLaterTimer(e){for(let t=1;t<this._timers.length;t+=TIMERS_OFFSET)if(this._timers[t]===e)return this._timers.splice(t-1,TIMERS_OFFSET),1===t&&this._reinstallTimerTimeout(),!0;return!1}_trigger(e,t,r){let n=this._eventCallbacks[e];if(void 0!==n)for(let i=0;i<n.length;i++)n[i](t,r)}_runExpiredTimers(){this._timerTimeoutId=null,this._timers.length>0&&(this.begin(),this._scheduleExpiredTimers(),this.end())}_scheduleExpiredTimers(){let e=this._timers,t=0,r=e.length,n=this._defaultQueue,i=this._platform.now();for(;t<r&&!(e[t]>i);t+=TIMERS_OFFSET){let r=e[t+4];if(r!==DISABLE_SCHEDULE){let i=e[t+2],o=e[t+3],s=e[t+5];this.currentInstance.schedule(n,i,o,r,!1,s)}}e.splice(0,t),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 e=this._timers[0],t=this._platform.now(),r=Math.max(0,e-t);this._timerTimeoutId=this._platform.setTimeout(this._boundRunExpiredTimers,r)}_ensureInstance(){let e=this.currentInstance;return null===e&&(this._autorunStack=this.DEBUG?new Error:void 0,e=this.begin(),this._scheduleAutorun(this.queueNames[0])),e}_scheduleAutorun(e){autorunsCreatedCount++;const t=this._platform.next,r=this.options.flush;r?r(e,t):t(),this._autorun=!0}};Backburner.Queue=Queue$1,Backburner.buildPlatform=buildPlatform,Backburner.buildNext=buildNext;var runloop_exports=__exportAll({_backburner:()=>_backburner,_cancelTimers:()=>_cancelTimers,_getCurrentRunLoop:()=>_getCurrentRunLoop,_hasScheduledTimers:()=>_hasScheduledTimers,_queues:()=>_queues,_rsvpErrorQueue:()=>_rsvpErrorQueue,begin:()=>begin,bind:()=>bind$1,cancel:()=>cancel,debounce:()=>debounce,end:()=>end,join:()=>join$2,later:()=>later,next:()=>next,once:()=>once,run:()=>run,schedule:()=>schedule,scheduleOnce:()=>scheduleOnce,throttle:()=>throttle}),currentRunLoop=null;function _getCurrentRunLoop(){return currentRunLoop}function onBegin(e){currentRunLoop=e}function onEnd(e,t){currentRunLoop=t,flushAsyncObservers(schedule)}function flush$1(e,t){"render"!==e&&e!==_rsvpErrorQueue||flushAsyncObservers(schedule),t()}var _rsvpErrorQueue=`${Math.random()}${Date.now()}`.replace(".",""),_queues=["actions","routerTransitions","render","afterRender","destroy",_rsvpErrorQueue],_backburner=new Backburner(_queues,{defaultQueue:"actions",onBegin:onBegin,onEnd:onEnd,onErrorTarget:onErrorTarget,onErrorMethod:"onerror",flush:flush$1});function run(...e){return _backburner.run(...e)}function join$2(e,t,...r){return _backburner.join(e,t,...r)}function bind$1(...e){return(...t)=>join$2(...e.concat(t))}function begin(){_backburner.begin()}function end(){_backburner.end()}function schedule(...e){return _backburner.schedule(...e)}function _hasScheduledTimers(){return _backburner.hasTimers()}function _cancelTimers(){_backburner.cancelTimers()}function later(...e){return _backburner.later(...e)}function once(...e){return _backburner.scheduleOnce("actions",...e)}function scheduleOnce(...e){return _backburner.scheduleOnce(...e)}function next(...e){return _backburner.later(...e,1)}function cancel(e){return _backburner.cancel(e)}function debounce(...e){return _backburner.debounce(...e)}function throttle(...e){return _backburner.throttle(...e)}var ARRAY_GETTER_METHODS=new Set([Symbol.iterator,"concat","entries","every","filter","find","findIndex","flat","flatMap","forEach","includes","indexOf","join","keys","lastIndexOf","map","reduce","reduceRight","slice","some","values"]),ARRAY_WRITE_THEN_READ_METHODS=new Set(["fill","push","unshift"]);function convertToInt(e){if("symbol"==typeof e)return null;const t=Number(e);return isNaN(t)?null:t%1==0?t:null}var TrackedArray=class e{#e;constructor(t,r){this.#e=r;const n=t.slice(),i=this,o=new Map;let s=!1;return new Proxy(n,{get(e,t){const r=convertToInt(t);if(null!==r)return i.#t(r),consumeTag(i.#r),e[r];if("length"===t)return s?s=!1:consumeTag(i.#r),e[t];if(ARRAY_WRITE_THEN_READ_METHODS.has(t)&&(s=!0),ARRAY_GETTER_METHODS.has(t)){let r=o.get(t);return void 0===r&&(r=(...r)=>(consumeTag(i.#r),e[t](...r)),o.set(t,r)),r}return e[t]},set(e,t,r){if(i.#e.equals(e[t],r))return!0;e[t]=r;const n=convertToInt(t);return null!==n?(i.#n(n),i.#i()):"length"===t&&i.#i(),!0},getPrototypeOf:()=>e.prototype})}#r=createUpdatableTag();#o=new Map;#t(e){let t=this.#o.get(e);void 0===t&&(t=createUpdatableTag(),this.#o.set(e,t)),consumeTag(t)}#n(e){const t=this.#o.get(e);t&&DIRTY_TAG$1(t)}#i(){DIRTY_TAG$1(this.#r),this.#o.clear()}};function trackedArray(e,t){return new TrackedArray(e??[],{equals:t?.equals??Object.is,description:t?.description})}function trackedMap(e,t){const r=t?.equals??Object.is,n=e instanceof Map?new Map(e.entries()):new Map(e??[]),i=createUpdatableTag(),o=new Map;function s(e){let t=o.get(e);return void 0===t&&(t=createUpdatableTag(),o.set(e,t)),t}function a(e){const t=o.get(e);t&&DIRTY_TAG$1(t)}const l=new Proxy(n,{get(e,t,n){if("set"===t)return function(t,n){return e.has(t)&&r(e.get(t),n)||(a(t),DIRTY_TAG$1(i),e.set(t,n)),l};if("delete"===t)return function(t){return!!e.has(t)&&(a(t),DIRTY_TAG$1(i),o.delete(t),e.delete(t))};if("clear"===t)return function(){0!==e.size&&(o.forEach(e=>DIRTY_TAG$1(e)),o.clear(),DIRTY_TAG$1(i),e.clear())};if("get"===t)return function(t){return consumeTag(s(t)),e.get(t)};if("has"===t)return function(t){return consumeTag(s(t)),e.has(t)};if("size"===t)return consumeTag(i),e.size;const c=Reflect.get(e,t,n);return"function"==typeof c?function(...t){return consumeTag(i),c.apply(e,t)}:c}});return l}Object.setPrototypeOf(TrackedArray.prototype,Array.prototype);var TrackedObject=class e{#e;#o=new Map;#r=createUpdatableTag();#t(e){let t=this.#o.get(e);void 0===t&&(t=createUpdatableTag(),this.#o.set(e,t)),consumeTag(t)}#n(e){const t=this.#o.get(e);t&&DIRTY_TAG$1(t)}#i(){DIRTY_TAG$1(this.#r)}constructor(t,r){this.#e=r;const n=Object.getPrototypeOf(t),i=Object.getOwnPropertyDescriptors(t),o=Object.create(n);for(const e in i)Object.defineProperty(o,e,i[e]);const s=this;return new Proxy(o,{get:(e,t)=>(s.#t(t),e[t]),has:(e,t)=>(s.#t(t),t in e),ownKeys:e=>(consumeTag(s.#r),Reflect.ownKeys(e)),set:(e,t,r)=>(s.#e.equals(e[t],r)||(e[t]=r,s.#n(t),s.#i()),!0),deleteProperty:(e,t)=>(t in e&&(delete e[t],s.#n(t),s.#o.delete(t),s.#i()),!0),getPrototypeOf:()=>e.prototype})}};function trackedObject(e,t){return new TrackedObject(e??{},{equals:t?.equals??Object.is,description:t?.description})}function trackedSet(e,t){const r=t?.equals??Object.is,n=new Set(e??[]),i=createUpdatableTag(),o=new Map;function s(e){const t=o.get(e);t&&DIRTY_TAG$1(t)}const a=new Proxy(n,{get(e,t,n){if("add"===t)return function(t){if(e.has(t)){if(r(t,t))return a}else DIRTY_TAG$1(i);return s(t),e.add(t),a};if("delete"===t)return function(t){return!!e.has(t)&&(s(t),DIRTY_TAG$1(i),o.delete(t),e.delete(t))};if("clear"===t)return function(){0!==e.size&&(o.forEach(e=>DIRTY_TAG$1(e)),DIRTY_TAG$1(i),o.clear(),e.clear())};if("has"===t)return function(t){return consumeTag(function(e){let t=o.get(e);return void 0===t&&(t=createUpdatableTag(),o.set(e,t)),t}(t)),e.has(t)};if("size"===t)return consumeTag(i),e.size;const l=Reflect.get(e,t,n);return"function"==typeof l?function(...t){return consumeTag(i),l.apply(e,t)}:l}});return a}function trackedWeakMap(e,t){const r=t?.equals??Object.is,n=e??[],i=n instanceof WeakMap?n:new WeakMap(n),o=new WeakMap;function s(e){let t=o.get(e);return void 0===t&&(t=createUpdatableTag(),o.set(e,t)),t}function a(e){const t=o.get(e);t&&DIRTY_TAG$1(t)}const l=new Proxy(i,{get(e,t,n){if("set"===t)return function(t,n){return e.has(t)&&r(e.get(t),n)||(a(t),e.set(t,n)),l};if("delete"===t)return function(t){return!!e.has(t)&&(a(t),o.delete(t),e.delete(t))};if("get"===t)return function(t){return consumeTag(s(t)),e.get(t)};if("has"===t)return function(t){return consumeTag(s(t)),e.has(t)};const i=Reflect.get(e,t,n);return"function"==typeof i?i.bind(e):i}});return l}function trackedWeakSet(e,t){const r=t?.equals??Object.is,n=new WeakSet(e??[]),i=new WeakMap;function o(e){const t=i.get(e);t&&DIRTY_TAG$1(t)}const s=new Proxy(n,{get(e,t,n){if("add"===t)return function(t){return e.has(t)&&r(t,t)||(e.add(t),o(t)),s};if("delete"===t)return function(t){return!!e.has(t)&&(o(t),i.delete(t),e.delete(t))};if("has"===t)return function(t){return consumeTag(function(e){let t=i.get(e);return void 0===t&&(t=createUpdatableTag(),i.set(e,t)),t}(t)),e.has(t)};const a=Reflect.get(e,t,n);return"function"==typeof a?a.bind(e):a}});return s}var validator_exports=__exportAll({ALLOW_CYCLES:()=>ALLOW_CYCLES,COMPUTE:()=>COMPUTE$1,CONSTANT:()=>0,CONSTANT_TAG:()=>CONSTANT_TAG,CURRENT_TAG:()=>CURRENT_TAG,CurrentTag:()=>CurrentTag,INITIAL:()=>1,VOLATILE:()=>VOLATILE,VOLATILE_TAG:()=>VOLATILE_TAG,VolatileTag:()=>VolatileTag,beginTrackFrame:()=>beginTrackFrame,beginUntrackFrame:()=>beginUntrackFrame,bump:()=>bump,combine:()=>combine,consumeTag:()=>consumeTag,createCache:()=>createCache,createTag:()=>createTag,createUpdatableTag:()=>createUpdatableTag,debug:()=>debug$2,dirtyTag:()=>DIRTY_TAG$1,dirtyTagFor:()=>dirtyTagFor,endTrackFrame:()=>endTrackFrame,endUntrackFrame:()=>endUntrackFrame,getValue:()=>getValue$1,isConst:()=>isConst,isConstTag:()=>isConstTag,isTracking:()=>isTracking,resetTracking:()=>resetTracking,tagFor:()=>tagFor,tagMetaFor:()=>tagMetaFor,track:()=>track,trackedArray:()=>trackedArray,trackedData:()=>trackedData,trackedMap:()=>trackedMap,trackedObject:()=>trackedObject,trackedSet:()=>trackedSet,trackedWeakMap:()=>trackedWeakMap,trackedWeakSet:()=>trackedWeakSet,untrack:()=>untrack,updateTag:()=>UPDATE_TAG,validateTag:()=>validateTag,valueForTag:()=>valueForTag}),debug$2={},GLIMMER_VALIDATOR_REGISTRATION=Symbol("GLIMMER_VALIDATOR_REGISTRATION");if(Reflect.has(globalThis,GLIMMER_VALIDATOR_REGISTRATION))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,GLIMMER_VALIDATOR_REGISTRATION,!0);var name="@warp-drive/core",version="5.8.2",GlobalRef=globalThis,UniversalCache=GlobalRef.__warpDrive_universalCache=GlobalRef.__warpDrive_universalCache??{};GlobalRef[name]=GlobalRef[name]??{__version:version};var GlobalSink=GlobalRef[name],ModuleScopedCaches=GlobalSink.__warpDrive_ModuleScopedCaches??{};if(GlobalSink.__warpDrive_hasOtherCopy)throw new Error("Multiple copies of WarpDrive detected, the application will malfunction.");function getOrSetGlobal(e,t){return t}function peekTransient(e){return ModuleScopedCaches[`(transient) ${e}`]??null}function setTransient(e,t){return ModuleScopedCaches[`(transient) ${e}`]=t}function getOrSetUniversal(e,t){return t}GlobalSink.__warpDrive_hasOtherCopy=!0;var SkipCache=getOrSetUniversal("SkipCache",Symbol.for("wd:skip-cache")),EnableHydration=getOrSetUniversal("EnableHydration",Symbol.for("wd:enable-hydration")),IS_FUTURE=getOrSetGlobal("IS_FUTURE",Symbol("IS_FUTURE")),STRUCTURED=getOrSetGlobal("DOC",Symbol("DOC"));getOrSetGlobal("IS_FROZEN",Symbol("FROZEN")),getOrSetGlobal("IS_COLLECTION",Symbol.for("Collection"));var PromiseCache=getOrSetUniversal("PromiseCache",new WeakMap),RequestMap=getOrSetUniversal("RequestMap",new Map);function setPromiseResult(e,t){PromiseCache.set(e,t)}function getPromiseResult(e){return PromiseCache.get(e)}var IS_CACHE_HANDLER=getOrSetGlobal("IS_CACHE_HANDLER",Symbol("IS_CACHE_HANDLER")),ARRAY_SIGNAL=getOrSetGlobal("#[]",Symbol("#[]")),OBJECT_SIGNAL=getOrSetGlobal("#{}",Symbol("#{}"));function setupSignals(e){setTransient("signalHooks",e({wellknown:{Array:ARRAY_SIGNAL}}))}function createSignal(e,t){return peekTransient("signalHooks").createSignal(e,t)}function consumeSignal(e){return peekTransient("signalHooks").consumeSignal(e)}function notifySignal(e){return peekTransient("signalHooks").notifySignal(e)}function createMemo(e,t,r){return peekTransient("signalHooks").createMemo(e,t,r)}var INITIALIZER_PROTO={isInitializer:!0};function isInitializer(e){return"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===INITIALIZER_PROTO}var Signals=getOrSetGlobal("Signals",Symbol("Signals"));function withSignalStore(e){return e[Signals]||initializeSignalStore(e),e[Signals]}function initializeSignalStore(e){e[Signals]=new Map}function createInternalSignal(e,t,r,n){const i={key:r,context:t,signal:createSignal(t,r),value:isInitializer(n)?n.value.call(t):n,isStale:!1};return e.set(r,i),i}function getOrCreateInternalSignal(e,t,r,n){let i=peekInternalSignal(e,r);return i||(i=createInternalSignal(e,t,r,n)),i}function createInternalMemo(e,t,r,n){{const i=createMemo(t,r,n);return e.set(r,i),i}}function peekInternalSignal(e,t){return e?.get(t)}function consumeInternalSignal(e){TrackingFrame?.signals.add(e),consumeSignal(e.signal)}function notifyInternalSignal(e){e&&(e.isStale=!0,notifySignal(e.signal))}var TrackingFrame=null;function entangleSignal(e,t,r,n){let i=peekInternalSignal(e,r);return i||(i=createInternalSignal(e,t,r,n)),consumeInternalSignal(i),i}function createSignalDescriptor(e,t){return{enumerable:!0,configurable:!1,get(){const r=entangleSignal(withSignalStore(this),this,e,t);return r.isStale=!1,r.value},set(r){const n=getOrCreateInternalSignal(withSignalStore(this),this,e,t);n.value!==r&&(n.value=r,notifyInternalSignal(n))}}}function defineSignal(e,t,r){Object.defineProperty(e,t,createSignalDescriptor(t,r))}function defineNonEnumerableSignal(e,t,r){const n=createSignalDescriptor(t,r);n.enumerable=!1,Object.defineProperty(e,t,n)}function memoized(e,t,r){const n=r.get;return r.get=function(){const e=withSignalStore(this);let r=e.get(t);return r||(r=createInternalMemo(e,this,t,n.bind(this))),r()},r}var RequestCache=new WeakMap;function isAbortError(e){return e instanceof DOMException&&"AbortError"===e.name}function upgradeLoadingState(e){return e}async function watchStream(e,t){const r=upgradeLoadingState(t),n=e.getReader();let i=0,o=null!==r._stream&&r._stream.readable.locked,s=o,a=r._stream?.writable.getWriter();const l=[];for(r._isPending=!1,r._isStarted=!0,r._startTime=performance.now();;){const{value:e,done:t}=await n.read();if(t)break;if(i+=e.byteLength,r._bytesLoaded=i,r._lastPacketTime=performance.now(),o=o||null!==r._stream&&r._stream.readable.locked,o){if(!s){s=!0,a=r._stream.writable.getWriter();for(const e of l)await a.ready,await a.write(e);l.length=0}await a.ready,await a.write(e)}else l.push(e)}s?(await a.ready,await a.close()):r._stream&&(await r._stream.readable.cancel("The Stream Has Already Ended"),r._stream=null),r._endTime=performance.now(),r._isComplete=!0,r._isStarted=!1}var RequestLoadingState=class{_stream=null;_future;_triggered=!1;_trigger(){if(this._triggered)return;this._triggered=!0;const e=this._future.getStream();e.sizeHint&&(this._sizeHint=e.sizeHint),this.promise=e.then(e=>e?watchStream(e,this):(this._isPending=!1,void(this._isComplete=!0)),e=>{this._isPending=!1,this._isStarted=!1,isAbortError(e)&&(this._isCancelled=!0,this._isComplete=!0),this._isErrored=!0,this._error=e})}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(e){this._future=e}abort=()=>{this._future.abort()}};defineNonEnumerableSignal(RequestLoadingState.prototype,"_isPending",!0),defineNonEnumerableSignal(RequestLoadingState.prototype,"_isStarted",!1),defineNonEnumerableSignal(RequestLoadingState.prototype,"_isComplete",!1),defineNonEnumerableSignal(RequestLoadingState.prototype,"_isCancelled",!1),defineNonEnumerableSignal(RequestLoadingState.prototype,"_isErrored",!1),defineNonEnumerableSignal(RequestLoadingState.prototype,"_error",null),defineNonEnumerableSignal(RequestLoadingState.prototype,"_sizeHint",0),defineNonEnumerableSignal(RequestLoadingState.prototype,"_bytesLoaded",0),defineNonEnumerableSignal(RequestLoadingState.prototype,"_startTime",0),defineNonEnumerableSignal(RequestLoadingState.prototype,"_endTime",0),defineNonEnumerableSignal(RequestLoadingState.prototype,"_lastPacketTime",0);var RequestStateProto={};function performRefresh(e,t,r){const n=Object.assign({},t),i=Object.assign({},n.cacheOptions);return r?i.reload=!0:!1===r?(delete i.reload,i.backgroundReload=!0):(delete i.backgroundReload,delete i.reload),n.cacheOptions=i,e.request(n)}function createRequestState(e){const t=getPromiseResult(e),r=Object.create(RequestStateProto);return r._request=e,r.reload=()=>performRefresh(e.requester,r.request,!0),r.refresh=(t=!1)=>performRefresh(e.requester,r.request,!0===t&&null),t?t.isError?(r.error=t.result,r.reason=t.result,r.status="rejected",r.isError=!0,r.isPending=!1,r.isLoading=!1,r.request=t.result.request,r.response=t.result.response):(r.result=t.result.content,r.value=t.result.content,r.status="fulfilled",r.isSuccess=!0,r.isPending=!1,r.isLoading=!1,r.request=t.result.request,r.response=t.result.response):e.then(t=>{setPromiseResult(e,{isError:!1,result:t}),r.result=t.content,r.value=t.content,r.status="fulfilled",r.isSuccess=!0,r.isPending=!1,r.isLoading=!1,r.request=t.request,r.response=t.response},t=>{setPromiseResult(e,{isError:!0,result:t}),r.error=t,r.reason=t,r.status="rejected",r.isError=!0,r.isPending=!1,r.isLoading=!1,r.request=t.request,r.response=t.response}),r}function getRequestState(e){let t=RequestCache.get(e);return t||(t=createRequestState(e),RequestCache.set(e,t)),t}function decorateMethodV2$2(e,t,r){let n={...Object.getOwnPropertyDescriptor(e,t)};for(let i of r)n=i(e,t,n)||n;void 0!==n.initializer&&(n.value=n.initializer?n.initializer.call(e):void 0,n.initializer=void 0),Object.defineProperty(e,t,n)}defineSignal(RequestStateProto,"reason",null),defineSignal(RequestStateProto,"value",null),defineSignal(RequestStateProto,"result",null),defineSignal(RequestStateProto,"error",null),defineSignal(RequestStateProto,"status","pending"),defineSignal(RequestStateProto,"isPending",!0),defineSignal(RequestStateProto,"isLoading",!0),defineSignal(RequestStateProto,"isSuccess",!1),defineSignal(RequestStateProto,"isError",!1),defineSignal(RequestStateProto,"request",null),defineSignal(RequestStateProto,"response",null),Object.defineProperty(RequestStateProto,"isCancelled",{get(){return this.isError&&isAbortError(this.reason)}}),Object.defineProperty(RequestStateProto,"loadingState",{get(){return this._loadingState||(this._loadingState=new RequestLoadingState(this._request)),this._loadingState}});var DEFAULT_DEADLINE=3e4,DISPOSE=Symbol.dispose||Symbol.for("dispose"),RequestSubscription=class{_requester;constructor(e,t){this._args=t,this.store=e,this._subscribedTo=null,this._subscription=null,this._intervalStart=null,this._invalidated=!1,this._nextInterval=null,this._requester=null,this.isDestroyed=!1,this[DISPOSE]=_DISPOSE,this._installListeners(),this._beginPolling()}async _beginPolling(){try{this.isIdle||await this.request}catch{}finally{this.isDestroyed||this._scheduleInterval()}}get isIdle(){const{request:e,query:t}=this._args;return Boolean(!e&&!t)}static{decorateMethodV2$2(this.prototype,"isIdle",[memoized])}get autorefreshTypes(){const{autorefresh:e}=this._args;let t;return t=!0===e?["online","invalid"]:"string"==typeof e?e.split(","):[],new Set(t)}static{decorateMethodV2$2(this.prototype,"autorefreshTypes",[memoized])}async _scheduleInterval(){const{autorefreshThreshold:e}=this._args;if("undefined"!=typeof window&&"number"==typeof e&&e>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()},e)}}_clearInterval(){this._nextInterval&&(clearTimeout(this._nextInterval),this._intervalStart=null)}_updateSubscriptions(){if(this.isIdle)return;const e=this._request.lid;if(this._subscribedTo===e)return;this._removeSubscriptions();const t=this._getRequester();this._requester=t,e&&isStore(t)&&(this._subscribedTo=e,this._subscription=t.notifications.subscribe(e,(r,n)=>{if(!this._isUpdating)switch(n){case"invalidated":this.autorefreshTypes.has("invalid")&&(this._invalidated=!0,this._maybeUpdate());break;case"state":{const r=t.requestManager._deduped.get(e)?.priority,n=this.reqState;r?r.blocking&&!n.isLoading?(this.isRefreshing=!1,this._maybeUpdate("policy",!0)):this.isRefreshing=!0:this.isRefreshing=!1}}}))}_removeSubscriptions(){const e=this._requester;this._subscription&&e&&isStore(e)&&(e.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=e=>{this.isOnline="online"===e.type,"offline"===e.type&&null===this._unavailableStart&&(this._unavailableStart=Date.now()),this._maybeUpdate()},this._backgroundChanged=()=>{const e="hidden"===document.visibilityState;this.isHidden=e,e&&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(e,t){if(this.isIdle)return;const{reqState:r}=this;if(r.isPending)return;if(!Boolean(this.isOnline&&!this.isHidden&&(e||this.autorefreshTypes.size))){if(!t&&e&&"_invalidated"!==e)throw new Error("Reload not available: the network is not online or the tab is hidden");return}const{autorefreshTypes:n}=this;let i=this._invalidated||Boolean(e);if(!i&&n.has("online")){const{_unavailableStart:e}=this,{autorefreshThreshold:t}=this._args,r="number"==typeof t?t:DEFAULT_DEADLINE;i=Boolean(e&&Date.now()-e>r)}if(!i&&n.has("interval")){const{_intervalStart:e}=this,{autorefreshThreshold:t}=this._args;e&&"number"==typeof t&&t>0&&(i=Boolean(Date.now()-e>=t))}if(this._unavailableStart=null,this._invalidated=!1,i){this._clearInterval(),this._isUpdating=!0;const t=("_invalidated"===e?null:e)??this._args.autorefreshBehavior??"policy",n=this._getRequester();switch(r._request.requester||(r._request.requester=n),t){case"reload":this._latestRequest=r.reload();break;case"refresh":this._latestRequest=r.refresh();break;case"policy":this._latestRequest=r.refresh(!0)}"refresh"!==t&&(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{decorateMethodV2$2(this.prototype,"errorFeatures",[memoized])}get contentFeatures(){const e={isHidden:this.isHidden,isOnline:this.isOnline,reload:this.retry,refresh:this.refresh,isRefreshing:this.isRefreshing,latestRequest:this._latestRequest};return e.isRefreshing&&(e.abort=()=>{this._latestRequest?.abort()}),e}static{decorateMethodV2$2(this.prototype,"contentFeatures",[memoized])}get _request(){const{request:e,query:t}=this._args,{_localRequest:r,_originalRequest:n,_originalQuery:i}=this;return r&&e===n&&t===i?r:(this._originalQuery=t,this._originalRequest=e,e||this.store.request(t))}static{decorateMethodV2$2(this.prototype,"_request",[memoized])}get request(){{const e=this._request;return this._updateSubscriptions(),e}}static{decorateMethodV2$2(this.prototype,"request",[memoized])}get reqState(){return getRequestState(this.request)}get result(){return this.reqState.result}};function isStore(e){return"requestManager"in e}function upgradeSubscription(e){return e}function _DISPOSE(){const e=upgradeSubscription(this);e.isDestroyed=!0,e._removeSubscriptions(),"undefined"!=typeof window&&(e._clearInterval(),window.removeEventListener("online",e._onlineChanged,{passive:!0,capture:!0}),window.removeEventListener("offline",e._onlineChanged,{passive:!0,capture:!0}),document.removeEventListener("visibilitychange",e._backgroundChanged,{passive:!0,capture:!0}))}defineSignal(RequestSubscription.prototype,"isOnline",!0),defineSignal(RequestSubscription.prototype,"isHidden",!1),defineSignal(RequestSubscription.prototype,"isRefreshing",!1),defineSignal(RequestSubscription.prototype,"_localRequest",void 0),defineSignal(RequestSubscription.prototype,"_latestRequest",void 0);var PromiseStateProto={};defineSignal(PromiseStateProto,"reason",null),defineSignal(PromiseStateProto,"value",null),defineSignal(PromiseStateProto,"result",null),defineSignal(PromiseStateProto,"error",null),defineSignal(PromiseStateProto,"status","pending"),defineSignal(PromiseStateProto,"isPending",!0),defineSignal(PromiseStateProto,"isLoading",!0),defineSignal(PromiseStateProto,"isSuccess",!1),defineSignal(PromiseStateProto,"isError",!1);var emberDirtyTag=DIRTY_TAG$1;function buildSignalConfig(e){const t=e.wellknown.Array;return{createSignal:(e,r)=>r===t?[tagForProperty(e,r),tagForProperty(e,"length"),tagForProperty(e,"[]")]:tagForProperty(e,r),consumeSignal(e){if(Array.isArray(e))return consumeTag(e[0]),consumeTag(e[1]),void consumeTag(e[2]);consumeTag(e)},notifySignal(e){if(Array.isArray(e))return emberDirtyTag(e[0]),emberDirtyTag(e[1]),void emberDirtyTag(e[2]);emberDirtyTag(e)},createMemo:(e,t,r)=>{{const n=tagForProperty(e,t),i=createCache(r);let o;const s=()=>{o=getValue$1(i)};return()=>{const e=track(s);return UPDATE_TAG(n,e),consumeTag(e),o}}},willSyncFlushWatchers:()=>!!_backburner.currentInstance&&!0!==_backburner._autorun,waitFor:async e=>e}}setupSignals(buildSignalConfig);var owner_exports=__exportAll({getOwner:()=>getOwner$1,setOwner:()=>setOwner$1}),getOwner$1=getOwner$2;function makeDictionary(e){let t=Object.create(e);return t._dict=null,delete t._dict,t}var hasDOM="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;function callbacksFor(e){let t=e._promiseCallbacks;return t||(t=e._promiseCallbacks={}),t}var EventTarget={mixin(e){return e.on=this.on,e.off=this.off,e.trigger=this.trigger,e._promiseCallbacks=void 0,e},on(e,t){if("function"!=typeof t)throw new TypeError("Callback must be a function");let r=callbacksFor(this),n=r[e];n||(n=r[e]=[]),-1===n.indexOf(t)&&n.push(t)},off(e,t){let r=callbacksFor(this);if(!t)return void(r[e]=[]);let n=r[e],i=n.indexOf(t);-1!==i&&n.splice(i,1)},trigger(e,t,r){let n=callbacksFor(this)[e];if(n){let e;for(let i=0;i<n.length;i++)e=n[i],e(t,r)}}},config$2={instrument:!1};function configure(e,t){if(2!==arguments.length)return config$2[e];config$2[e]=t}EventTarget.mixin(config$2);var queue$1=[];function scheduleFlush$1(){setTimeout(()=>{for(let e=0;e<queue$1.length;e++){let t=queue$1[e],r=t.payload;r.guid=r.key+r.id,r.childGuid=r.key+r.childId,r.error&&(r.stack=r.error.stack),config$2.trigger(t.name,t.payload)}queue$1.length=0},50)}function instrument$1(e,t,r){1===queue$1.push({name:e,payload:{key:t._guidKey,id:t._id,eventName:e,detail:t._result,childId:r&&r._id,label:t._label,timeStamp:Date.now(),error:config$2["instrument-with-stack"]?new Error(t._label):null}})&&scheduleFlush$1()}function resolve$2(e,t){if(e&&"object"==typeof e&&e.constructor===this)return e;let r=new this(noop$2,t);return resolve$1$1(r,e),r}function withOwnPromise(){return new TypeError("A promises callback cannot return that same promise.")}function objectOrFunction(e){let t=typeof e;return null!==e&&("object"===t||"function"===t)}function noop$2(){}var PENDING=void 0,FULFILLED=1,REJECTED=2;function tryThen(e,t,r,n){try{e.call(t,r,n)}catch(i){return i}}function handleForeignThenable(e,t,r){config$2.async(e=>{let n=!1,i=tryThen(r,t,r=>{n||(n=!0,t===r?fulfill(e,r):resolve$1$1(e,r))},t=>{n||(n=!0,reject$2(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&i&&(n=!0,reject$2(e,i))},e)}function handleOwnThenable(e,t){t._state===FULFILLED?fulfill(e,t._result):t._state===REJECTED?(t._onError=null,reject$2(e,t._result)):subscribe$1(t,void 0,r=>{t===r?fulfill(e,r):resolve$1$1(e,r)},t=>reject$2(e,t))}function handleMaybeThenable(e,t,r){t.constructor===e.constructor&&r===then&&e.constructor.resolve===resolve$2?handleOwnThenable(e,t):"function"==typeof r?handleForeignThenable(e,t,r):fulfill(e,t)}function resolve$1$1(e,t){if(e===t)fulfill(e,t);else if(objectOrFunction(t)){let r;try{r=t.then}catch(error){return void reject$2(e,error)}handleMaybeThenable(e,t,r)}else fulfill(e,t)}function publishRejection(e){e._onError&&e._onError(e._result),publish(e)}function fulfill(e,t){e._state===PENDING&&(e._result=t,e._state=FULFILLED,0===e._subscribers.length?config$2.instrument&&instrument$1("fulfilled",e):config$2.async(publish,e))}function reject$2(e,t){e._state===PENDING&&(e._state=REJECTED,e._result=t,config$2.async(publishRejection,e))}function subscribe$1(e,t,r,n){let i=e._subscribers,o=i.length;e._onError=null,i[o]=t,i[o+FULFILLED]=r,i[o+REJECTED]=n,0===o&&e._state&&config$2.async(publish,e)}function publish(e){let t=e._subscribers,r=e._state;if(config$2.instrument&&instrument$1(r===FULFILLED?"fulfilled":"rejected",e),0===t.length)return;let n,i,o=e._result;for(let s=0;s<t.length;s+=3)n=t[s],i=t[s+r],n?invokeCallback(r,n,i,o):i(o);e._subscribers.length=0}function invokeCallback(e,t,r,n){let i,o,s="function"==typeof r,a=!0;if(s)try{i=r(n)}catch(l){a=!1,o=l}else i=n;t._state!==PENDING||(i===t?reject$2(t,withOwnPromise()):!1===a?reject$2(t,o):s?resolve$1$1(t,i):e===FULFILLED?fulfill(t,i):e===REJECTED&&reject$2(t,i))}function initializePromise(e,t){let r=!1;try{t(t=>{r||(r=!0,resolve$1$1(e,t))},t=>{r||(r=!0,reject$2(e,t))})}catch(n){reject$2(e,n)}}function then(e,t,r){let n=this,i=n._state;if(i===FULFILLED&&!e||i===REJECTED&&!t)return config$2.instrument&&instrument$1("chained",n,n),n;n._onError=null;let o=new n.constructor(noop$2,r),s=n._result;if(config$2.instrument&&instrument$1("chained",n,o),i===PENDING)subscribe$1(n,o,e,t);else{let r=i===FULFILLED?e:t;config$2.async(()=>invokeCallback(i,o,r,s))}return o}var Enumerator=class{constructor(e,t,r,n){this._instanceConstructor=e,this.promise=new e(noop$2,n),this._abortOnReject=r,this._isUsingOwnPromise=e===Promise$1,this._isUsingOwnResolve=e.resolve===resolve$2,this._init(...arguments)}_init(e,t){let r=t.length||0;this.length=r,this._remaining=r,this._result=new Array(r),this._enumerate(t)}_enumerate(e){let t=this.length,r=this.promise;for(let n=0;r._state===PENDING&&n<t;n++)this._eachEntry(e[n],n,!0);this._checkFullfillment()}_checkFullfillment(){if(0===this._remaining){let e=this._result;fulfill(this.promise,e),this._result=null}}_settleMaybeThenable(e,t,r){let n=this._instanceConstructor;if(this._isUsingOwnResolve){let o,s,a=!0;try{o=e.then}catch(i){a=!1,s=i}if(o===then&&e._state!==PENDING)e._onError=null,this._settledAt(e._state,t,e._result,r);else if("function"!=typeof o)this._settledAt(FULFILLED,t,e,r);else if(this._isUsingOwnPromise){let i=new n(noop$2);!1===a?reject$2(i,s):(handleMaybeThenable(i,e,o),this._willSettleAt(i,t,r))}else this._willSettleAt(new n(t=>t(e)),t,r)}else this._willSettleAt(n.resolve(e),t,r)}_eachEntry(e,t,r){null!==e&&"object"==typeof e?this._settleMaybeThenable(e,t,r):this._setResultAt(FULFILLED,t,e,r)}_settledAt(e,t,r,n){let i=this.promise;i._state===PENDING&&(this._abortOnReject&&e===REJECTED?reject$2(i,r):(this._setResultAt(e,t,r,n),this._checkFullfillment()))}_setResultAt(e,t,r,n){this._remaining--,this._result[t]=r}_willSettleAt(e,t,r){subscribe$1(e,void 0,e=>this._settledAt(FULFILLED,t,e,r),e=>this._settledAt(REJECTED,t,e,r))}};function setSettledResult(e,t,r){this._remaining--,this._result[t]=e===FULFILLED?{state:"fulfilled",value:r}:{state:"rejected",reason:r}}function all$1$1(e,t){return Array.isArray(e)?new Enumerator(this,e,!0,t).promise:this.reject(new TypeError("Promise.all must be called with an array"),t)}function race$1(e,t){let r=this,n=new r(noop$2,t);if(!Array.isArray(e))return reject$2(n,new TypeError("Promise.race must be called with an array")),n;for(let i=0;n._state===PENDING&&i<e.length;i++)subscribe$1(r.resolve(e[i]),void 0,e=>resolve$1$1(n,e),e=>reject$2(n,e));return n}function reject$1(e,t){let r=new this(noop$2,t);return reject$2(r,e),r}var guidKey="rsvp_"+Date.now()+"-",counter=0;function needsResolver(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function needsNew(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var Promise$1=class e{constructor(t,r){this._id=counter++,this._label=r,this._state=void 0,this._result=void 0,this._subscribers=[],config$2.instrument&&instrument$1("created",this),noop$2!==t&&("function"!=typeof t&&needsResolver(),this instanceof e?initializePromise(this,t):needsNew())}_onError(e){config$2.after(()=>{this._onError&&config$2.trigger("error",e,this._label)})}catch(e,t){return this.then(void 0,e,t)}finally(e,t){let r=this,n=r.constructor;return"function"==typeof e?r.then(t=>n.resolve(e()).then(()=>t),t=>n.resolve(e()).then(()=>{throw t})):r.then(e,e)}};function makeObject(e,t){let r={},n=e.length,i=new Array(n);for(let o=0;o<n;o++)i[o]=e[o];for(let o=0;o<t.length;o++)r[t[o]]=i[o+1];return r}function arrayResult(e){let t=e.length,r=new Array(t-1);for(let n=1;n<t;n++)r[n-1]=e[n];return r}function wrapThenable(e,t){return{then:(r,n)=>e.call(t,r,n)}}function denodeify(e,t){let r=function(){let r=arguments.length,n=new Array(r+1),i=!1;for(let e=0;e<r;++e){let t=arguments[e];if(!i){if(null!==t&&"object"==typeof t)if(t.constructor===Promise$1)i=!0;else try{i=t.then}catch(error){let t=new Promise$1(noop$2);return reject$2(t,error),t}else i=!1;i&&!0!==i&&(t=wrapThenable(i,t))}n[e]=t}let o=new Promise$1(noop$2);return n[r]=function(e,r){e?reject$2(o,e):void 0===t?resolve$1$1(o,r):!0===t?resolve$1$1(o,arrayResult(arguments)):Array.isArray(t)?resolve$1$1(o,makeObject(arguments,t)):resolve$1$1(o,r)},i?handlePromiseInput(o,n,e,this):handleValueInput(o,n,e,this)};return r.__proto__=e,r}function handleValueInput(e,t,r,n){try{r.apply(n,t)}catch(error){reject$2(e,error)}return e}function handlePromiseInput(e,t,r,n){return Promise$1.all(t).then(t=>handleValueInput(e,t,r,n))}function all$3(e,t){return Promise$1.all(e,t)}Promise$1.cast=resolve$2,Promise$1.all=all$1$1,Promise$1.race=race$1,Promise$1.resolve=resolve$2,Promise$1.reject=reject$1,Promise$1.prototype._guidKey=guidKey,Promise$1.prototype.then=then;var AllSettled=class extends Enumerator{constructor(e,t,r){super(e,t,!1,r)}};function allSettled$1(e,t){return Array.isArray(e)?new AllSettled(Promise$1,e,t).promise:Promise$1.reject(new TypeError("Promise.allSettled must be called with an array"),t)}function race$2(e,t){return Promise$1.race(e,t)}AllSettled.prototype._setResultAt=setSettledResult;var PromiseHash=class extends Enumerator{constructor(e,t,r=!0,n){super(e,t,r,n)}_init(e,t){this._result={},this._enumerate(t)}_enumerate(e){let t,r,n=Object.keys(e),i=n.length,o=this.promise;this._remaining=i;for(let s=0;o._state===PENDING&&s<i;s++)t=n[s],r=e[t],this._eachEntry(r,t,!0);this._checkFullfillment()}};function hash$5(e,t){return Promise$1.resolve(e,t).then(function(e){if(null===e||"object"!=typeof e)throw new TypeError("Promise.hash must be called with an object");return new PromiseHash(Promise$1,e,t).promise})}var HashSettled=class extends PromiseHash{constructor(e,t,r){super(e,t,!1,r)}};function hashSettled$1(e,t){return Promise$1.resolve(e,t).then(function(e){if(null===e||"object"!=typeof e)throw new TypeError("hashSettled must be called with an object");return new HashSettled(Promise$1,e,!1,t).promise})}function rethrow(e){throw setTimeout(()=>{throw e}),e}function defer$1(e){let t={resolve:void 0,reject:void 0};return t.promise=new Promise$1((e,r)=>{t.resolve=e,t.reject=r},e),t}HashSettled.prototype._setResultAt=setSettledResult;var MapEnumerator=class extends Enumerator{constructor(e,t,r,n){super(e,t,!0,n,r)}_init(e,t,r,n,i){let o=t.length||0;this.length=o,this._remaining=o,this._result=new Array(o),this._mapFn=i,this._enumerate(t)}_setResultAt(e,t,r,n){if(n)try{this._eachEntry(this._mapFn(r,t),t,!1)}catch(error){this._settledAt(REJECTED,t,error,!1)}else this._remaining--,this._result[t]=r}};function map$2(e,t,r){return"function"!=typeof t?Promise$1.reject(new TypeError("map expects a function as a second argument"),r):Promise$1.resolve(e,r).then(function(e){if(!Array.isArray(e))throw new TypeError("map must be called with an array");return new MapEnumerator(Promise$1,e,t,r).promise})}function resolve$3(e,t){return Promise$1.resolve(e,t)}function reject(e,t){return Promise$1.reject(e,t)}var EMPTY_OBJECT={},FilterEnumerator=class extends MapEnumerator{_checkFullfillment(){if(0===this._remaining&&null!==this._result){let e=this._result.filter(e=>e!==EMPTY_OBJECT);fulfill(this.promise,e),this._result=null}}_setResultAt(e,t,r,n){if(n){this._result[t]=r;let e,n=!0;try{e=this._mapFn(r,t)}catch(error){n=!1,this._settledAt(REJECTED,t,error,!1)}n&&this._eachEntry(e,t,!1)}else this._remaining--,r||(this._result[t]=EMPTY_OBJECT)}};function filter$1(e,t,r){return"function"!=typeof t?Promise$1.reject(new TypeError("filter expects function as a second argument"),r):Promise$1.resolve(e,r).then(function(e){if(!Array.isArray(e))throw new TypeError("filter must be called with an array");return new FilterEnumerator(Promise$1,e,t,r).promise})}var len=0,vertxNext;function asap(e,t){queue[len]=e,queue[len+1]=t,2===(len+=2)&&scheduleFlush()}var browserWindow="undefined"!=typeof window?window:void 0,browserGlobal=browserWindow||{},BrowserMutationObserver=browserGlobal.MutationObserver||browserGlobal.WebKitMutationObserver,isNode$1="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),isWorker="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function useNextTick(){let e=process.nextTick,t=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);return Array.isArray(t)&&"0"===t[1]&&"10"===t[2]&&(e=setImmediate),()=>e(flush)}function useVertxTimer(){return void 0!==vertxNext?function(){vertxNext(flush)}:useSetTimeout()}function useMutationObserver(){let e=0,t=new BrowserMutationObserver(flush),r=document.createTextNode("");return t.observe(r,{characterData:!0}),()=>r.data=e=++e%2}function useMessageChannel(){let e=new MessageChannel;return e.port1.onmessage=flush,()=>e.port2.postMessage(0)}function useSetTimeout(){return()=>setTimeout(flush,1)}var queue=new Array(1e3),scheduleFlush;function flush(){for(let e=0;e<len;e+=2)(0,queue[e])(queue[e+1]),queue[e]=void 0,queue[e+1]=void 0;len=0}function attemptVertex(){try{const e=Function("return this")().require("vertx");return vertxNext=e.runOnLoop||e.runOnContext,useVertxTimer()}catch(e){return useSetTimeout()}}scheduleFlush=isNode$1?useNextTick():BrowserMutationObserver?useMutationObserver():isWorker?useMessageChannel():void 0===browserWindow&&"function"==typeof window.require?attemptVertex():useSetTimeout(),config$2.async=asap,config$2.after=e=>setTimeout(e,0);var cast=resolve$3,async$1=(e,t)=>config$2.async(e,t);function on$2(){config$2.on(...arguments)}function off(){config$2.off(...arguments)}if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){let e=window.__PROMISE_INSTRUMENTATION__;configure("instrument",!0);for(let t in e)e.hasOwnProperty(t)&&on$2(t,e[t])}var RSVP={asap:asap,cast:cast,Promise:Promise$1,EventTarget:EventTarget,all:all$3,allSettled:allSettled$1,race:race$2,hash:hash$5,hashSettled:hashSettled$1,rethrow:rethrow,defer:defer$1,denodeify:denodeify,configure:configure,on:on$2,off:off,resolve:resolve$3,reject:reject,map:map$2,async:async$1,filter:filter$1},RSVP$1=Object.freeze(Object.defineProperty({__proto__:null,EventTarget:EventTarget,Promise:Promise$1,all:all$3,allSettled:allSettled$1,asap:asap,async:async$1,cast:cast,configure:configure,default:RSVP,defer:defer$1,denodeify:denodeify,filter:filter$1,hash:hash$5,hashSettled:hashSettled$1,map:map$2,off:off,on:on$2,race:race$2,reject:reject,resolve:resolve$3,rethrow:rethrow},Symbol.toStringTag,{value:"Module"}));function onerrorDefault(e){let t=errorFor(e);if(t){let e=getDispatchOverride();if(!e)throw t;e(t)}}function errorFor(e){if(!e)return;let t=e;return t.errorThrown?unwrapErrorThrown(t):"UnrecognizedURLError"!==e.name&&"TransitionAborted"!==e.name?e:void 0}function unwrapErrorThrown(e){let t=e.errorThrown;return"string"==typeof t&&(t=new Error(t)),Object.defineProperty(t,"__reason_with_error_thrown__",{value:e,enumerable:!1}),t}configure("async",(e,t)=>{_backburner.schedule("actions",null,e,t)}),configure("after",e=>{_backburner.schedule(_rsvpErrorQueue,null,e)}),on$2("error",onerrorDefault);var Container=class{static _leakTracking;owner;registry;cache;factoryManagerCache;validationCache;isDestroyed;isDestroying;constructor(e,t={}){this.registry=e,this.owner=t.owner||null,this.cache=makeDictionary(t.cache||null),this.factoryManagerCache=makeDictionary(t.factoryManagerCache||null),this.isDestroyed=!1,this.isDestroying=!1}lookup(e,t){if(this.isDestroyed)throw new Error(`Cannot call \`.lookup('${e}')\` after the owner has been destroyed`);return lookup(this,this.registry.normalize(e),t)}destroy(){this.isDestroying=!0,destroyDestroyables(this)}finalizeDestroy(){resetCache(this),this.isDestroyed=!0}reset(e){this.isDestroyed||(void 0===e?(destroyDestroyables(this),resetCache(this)):resetMember(this,this.registry.normalize(e)))}ownerInjection(){let e={};return setOwner$1(e,this.owner),e}factoryFor(e){if(this.isDestroyed)throw new Error(`Cannot call \`.factoryFor('${e}')\` after the owner has been destroyed`);return factoryFor(this,this.registry.normalize(e),e)}};function isSingleton(e,t){return!1!==e.registry.getOption(t,"singleton")}function isInstantiatable(e,t){return!1!==e.registry.getOption(t,"instantiate")}function lookup(e,t,r={}){let n=t;if(!0===r.singleton||void 0===r.singleton&&isSingleton(e,t)){let t=e.cache[n];if(void 0!==t)return t}return instantiateFactory(e,n,t,r)}function factoryFor(e,t,r){let n=e.factoryManagerCache[t];if(void 0!==n)return n;let i=e.registry.resolve(t);if(void 0===i)return;let o=new InternalFactoryManager(e,i,r,t);return e.factoryManagerCache[t]=o,o}function isSingletonClass(e,t,{instantiate:r,singleton:n}){return!1!==n&&!r&&isSingleton(e,t)&&!isInstantiatable(e,t)}function isSingletonInstance(e,t,{instantiate:r,singleton:n}){return!1!==n&&!1!==r&&(!0===n||isSingleton(e,t))&&isInstantiatable(e,t)}function isFactoryClass(e,t,{instantiate:r,singleton:n}){return!(!1!==r||!1!==n&&isSingleton(e,t)||isInstantiatable(e,t))}function isFactoryInstance(e,t,{instantiate:r,singleton:n}){return!1!==r&&(!1===n||!isSingleton(e,t))&&isInstantiatable(e,t)}function instantiateFactory(e,t,r,n){let i=factoryFor(e,t,r);if(void 0!==i){if(isSingletonInstance(e,r,n)){let r=e.cache[t]=i.create();return e.isDestroying&&"function"==typeof r.destroy&&r.destroy(),r}if(isFactoryInstance(e,r,n))return i.create();if(isSingletonClass(e,r,n)||isFactoryClass(e,r,n))return i.class;throw new Error("Could not create factory")}}function destroyDestroyables(e){let t=e.cache,r=Object.keys(t);for(let n of r){let e=t[n];e.destroy&&e.destroy()}}function resetCache(e){e.cache=makeDictionary(null),e.factoryManagerCache=makeDictionary(null)}function resetMember(e,t){let r=e.cache[t];delete e.factoryManagerCache[t],r&&(delete e.cache[t],r.destroy&&r.destroy())}var INIT_FACTORY=Symbol("INIT_FACTORY");function getFactoryFor(e){return e[INIT_FACTORY]}function setFactoryFor(e,t){e[INIT_FACTORY]=t}var InternalFactoryManager=class{container;owner;class;fullName;normalizedName;madeToString;injections;constructor(e,t,r,n){this.container=e,this.owner=e.owner,this.class=t,this.fullName=r,this.normalizedName=n,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(e){let{container:t}=this;if(t.isDestroyed)throw new Error(`Cannot create new instances after the owner has been destroyed (you attempted to create ${this.fullName})`);let r=e?{...e}:{};return setOwner$1(r,t.owner),setFactoryFor(r,this),this.class.create(r)}};function intern(e){let t=Object.create(null);t[e]=1;for(let r in t)if(r===e)return r;return e}var _uuid$1=0;function uuid$1(){return++_uuid$1}var GUID_PREFIX="ember",OBJECT_GUIDS=new WeakMap,NON_OBJECT_GUIDS=new Map,GUID_KEY=intern(`__ember${Date.now()}`);function generateGuid(e,t=GUID_PREFIX){let r=t+uuid$1().toString();return isObject(e)&&OBJECT_GUIDS.set(e,r),r}function guidFor(e){let t;if(isObject(e))t=OBJECT_GUIDS.get(e),void 0===t&&(t=`${GUID_PREFIX}${uuid$1()}`,OBJECT_GUIDS.set(e,t));else if(t=NON_OBJECT_GUIDS.get(e),void 0===t){let r=typeof e;t="string"===r?`st${uuid$1()}`:"number"===r?`nu${uuid$1()}`:"symbol"===r?`sy${uuid$1()}`:`(${e})`,NON_OBJECT_GUIDS.set(e,t)}return t}var a_concat=Array.prototype.concat;function extractAccessors(e){if(void 0!==e)for(let t of Object.keys(e)){let r=Object.getOwnPropertyDescriptor(e,t);void 0===r.get&&void 0===r.set||Object.defineProperty(e,t,{value:nativeDescDecorator(r)})}return e}function concatenatedMixinProperties(e,t,r,n){let i=r[e]||n[e];return t[e]&&(i=i?a_concat.call(i,t[e]):t[e]),i}function giveDecoratorSuper(e,t,r,n){if(!0===r)return t;let i=r._getter;if(void 0===i)return t;let o=n[e],s="function"==typeof o?descriptorForDecorator(o):o;if(void 0===s||!0===s)return t;let a=s._getter;if(void 0===a)return t;let l,c=wrap$2(i,a),u=r._setter,h=s._setter;if(l=void 0!==h?void 0!==u?wrap$2(u,h):h:u,c!==i||l!==u){let e=r._dependentKeys||[],t=new ComputedProperty([...e,{get:c,set:l}]);return t._readOnly=r._readOnly,t._meta=r._meta,t.enumerable=r.enumerable,makeComputedDecorator(t,ComputedProperty)}return t}function giveMethodSuper(e,t,r,n){if(void 0!==n[e])return t;let i=r[e];return"function"==typeof i?wrap$2(t,i):t}function simpleMakeArray(e){return e?Array.isArray(e)?e:[e]:[]}function applyConcatenatedProperties(e,t,r){return simpleMakeArray(r[e]).concat(simpleMakeArray(t))}function applyMergedProperties(e,t,r){let n=r[e];if(!n)return t;let i=Object.assign({},n),o=!1,s=Object.keys(t);for(let a of s){let e=t[a];"function"==typeof e?(o=!0,i[a]=giveMethodSuper(a,e,n,{})):i[a]=e}return o&&(i._super=ROOT),i}function mergeMixins(e,t,r,n,i,o,s){let a;for(let l=0;l<e.length;l++)if(a=e[l],MIXINS.has(a)){if(t.hasMixin(a))continue;t.addMixin(a);let{properties:e,mixins:l}=a;void 0!==e?mergeProps(t,e,r,n,i,o,s):void 0!==l&&(mergeMixins(l,t,r,n,i,o,s),a instanceof Mixin&&void 0!==a._without&&a._without.forEach(e=>{let t=o.indexOf(e);-1!==t&&o.splice(t,1)}))}else mergeProps(t,a,r,n,i,o,s)}function mergeProps(e,t,r,n,i,o,s){let a=concatenatedMixinProperties("concatenatedProperties",t,n,i),l=concatenatedMixinProperties("mergedProperties",t,n,i),c=Object.keys(t);for(let u of c){let c=t[u];if(void 0===c)continue;if(-1===o.indexOf(u)){o.push(u);let t=e.peekDescriptors(u);if(void 0===t){if(!isClassicDecorator(c)){let e=n[u]=i[u];"function"==typeof e&&updateObserversAndListeners(i,u,e,!1)}}else r[u]=t,s.push(u),t.teardown(i,u,e)}let h="function"==typeof c;if(h){let e=descriptorForDecorator(c);if(void 0!==e){r[u]=giveDecoratorSuper(u,c,e,r),n[u]=void 0;continue}}a&&a.indexOf(u)>=0||"concatenatedProperties"===u||"mergedProperties"===u?c=applyConcatenatedProperties(u,c,n):l&&l.indexOf(u)>-1?c=applyMergedProperties(u,c,n):h&&(c=giveMethodSuper(u,c,n,r)),n[u]=c,r[u]=void 0}}function updateObserversAndListeners(e,t,r,n){let i=observerListenerMetaFor(r);if(void 0===i)return;let{observers:o,listeners:s}=i;if(void 0!==o){let r=n?addObserver:removeObserver;for(let n of o.paths)r(e,n,null,t,o.sync)}if(void 0!==s){let r=n?addListener:removeListener;for(let n of s)r(e,n,null,t)}}function applyMixin(e,t,r=!1){let n=Object.create(null),i=Object.create(null),o=meta$1(e),s=[],a=[];e._super=ROOT,mergeMixins(t,o,n,i,e,s,a);for(let l of s){let t=i[l],s=n[l];void 0!==t?("function"==typeof t&&updateObserversAndListeners(e,l,t,!0),defineValue(e,l,t,-1!==a.indexOf(l),!r)):void 0!==s&&defineDecorator(e,l,s,o)}return o.isPrototypeMeta(e)||revalidateObservers(e),e}var MIXINS=new WeakSet,Mixin=class e{mixins;properties;ownerConstructor;_without;constructor(e,t){MIXINS.add(this),this.properties=extractAccessors(t),this.mixins=buildMixinsArray(e),this.ownerConstructor=void 0,this._without=void 0}static create(...e){return setUnprocessedMixins(),new this(e,void 0)}static mixins(e){let t=peekMeta(e),r=[];return null===t||t.forEachMixins(e=>{e.properties||r.push(e)}),r}reopen(...t){if(0===t.length)return this;if(this.properties){let t=new e(void 0,this.properties);this.properties=void 0,this.mixins=[t]}else this.mixins||(this.mixins=[]);return this.mixins=this.mixins.concat(buildMixinsArray(t)),this}apply(e,t=!1){return applyMixin(e,[this],t)}applyPartial(e){return applyMixin(e,[this])}detect(e){if("object"!=typeof e||null===e)return!1;if(MIXINS.has(e))return _detect(e,this);let t=peekMeta(e);return null!==t&&t.hasMixin(this)}without(...t){let r=new e([this]);return r._without=t,r}keys(){return _keys(this)}toString(){return"(unknown mixin)"}};function buildMixinsArray(e){let t,r=e&&e.length||0;if(r>0){t=new Array(r);for(let n=0;n<r;n++){let r=e[n];MIXINS.has(r)?t[n]=r:t[n]=new Mixin(void 0,r)}}return t}function _detect(e,t,r=new Set){if(r.has(e))return!1;if(r.add(e),e===t)return!0;let n=e.mixins;return!!n&&n.some(e=>_detect(e,t,r))}function _keys(e,t=new Set,r=new Set){if(!r.has(e)){if(r.add(e),e.properties){let r=Object.keys(e.properties);for(let e of r)t.add(e)}else e.mixins&&e.mixins.forEach(e=>_keys(e,t,r));return t}}var ActionHandler=Mixin.create({mergedProperties:["actions"],send(e,...t){if(this.actions&&this.actions[e]&&!0!==this.actions[e].apply(this,t))return;let r=get$7(this,"target");r&&r.send(...arguments)}}),{isArray:isArray$6}=Array;function makeArray(e){return null==e?[]:isArray$6(e)?e:[e]}var core_exports=__exportAll({default:()=>CoreObject});function hasSetUnknownProperty(e){return"object"==typeof e&&null!==e&&"function"==typeof e.setUnknownProperty}function hasToStringExtension(e){return"object"==typeof e&&null!==e&&"function"==typeof e.toStringExtension}var reopen=Mixin.prototype.reopen,wasApplied=new WeakSet,prototypeMixinMap=new WeakMap,destroyCalled=new Set;function ensureDestroyCalled(e){destroyCalled.has(e)||e.destroy()}function initialize(e,t){let r=meta$1(e);if(void 0!==t){let n=e.concatenatedProperties,i=e.mergedProperties,o=Object.keys(t);for(let s of o){let o=t[s],a=descriptorForProperty(e,s,r),l=void 0!==a;if(!l){if(void 0!==n&&n.length>0&&n.includes(s)){let t=e[s];o=t?makeArray(t).concat(o):makeArray(o)}if(void 0!==i&&i.length>0&&i.includes(s)){let t=e[s];o=Object.assign({},t,o)}}l?a.set(e,s,o):hasSetUnknownProperty(e)&&!(s in e)?e.setUnknownProperty(s,o):e[s]=o}}e.init(t),r.unsetInitializing();let n=r.observerEvents();if(void 0!==n)for(let i=0;i<n.length;i++)activateObserver(e,n[i].event,n[i].sync);sendEvent(e,"init",void 0,void 0,r)}var CoreObject=class{[OWNER$1];constructor(e){let t;this[OWNER$1]=e,this.constructor.proto(),t=this;const r=t;registerDestructor$1(t,ensureDestroyCalled,!0),registerDestructor$1(t,()=>r.willDestroy()),meta$1(t).setInitializing()}reopen(...e){return applyMixin(this,e),this}init(e){}get isDestroyed(){return isDestroyed(this)}set isDestroyed(e){}get isDestroying(){return isDestroying(this)}set isDestroying(e){}destroy(){destroyCalled.add(this);try{destroy(this)}finally{destroyCalled.delete(this)}return this}willDestroy(){}toString(){let e=hasToStringExtension(this)?`:${this.toStringExtension()}`:"";return`<${getFactoryFor(this)||"(unknown)"}:${guidFor(this)}${e}>`}static extend(...e){let t=class extends(this){};return reopen.apply(t.PrototypeMixin,e),t}static create(...e){let t,r=e[0];return void 0!==r?(t=new this(getOwner$2(r)),setFactoryFor(t,getFactoryFor(r))):t=new this,e.length<=1?initialize(t,r):initialize(t,flattenProps.apply(this,e)),t}static reopen(...e){return this.willReopen(),reopen.apply(this.PrototypeMixin,e),this}static willReopen(){let e=this.prototype;wasApplied.has(e)&&(wasApplied.delete(e),prototypeMixinMap.has(this)&&prototypeMixinMap.set(this,Mixin.create(this.PrototypeMixin)))}static reopenClass(...e){return applyMixin(this,e),this}static detect(e){if("function"!=typeof e)return!1;for(;e;){if(e===this)return!0;e=e.superclass}return!1}static detectInstance(e){return e instanceof this}static metaForProperty(e){return descriptorForProperty(this.proto(),e)._meta||{}}static eachComputedProperty(e,t=this){this.proto();let r={};meta$1(this.prototype).forEachDescriptors((n,i)=>{if(i.enumerable){let o=i._meta||r;e.call(t,n,o)}})}static get PrototypeMixin(){let e=prototypeMixinMap.get(this);return void 0===e&&(e=Mixin.create(),e.ownerConstructor=this,prototypeMixinMap.set(this,e)),e}static get superclass(){let e=Object.getPrototypeOf(this);return e!==Function.prototype?e:void 0}static proto(){let e=this.prototype;if(!wasApplied.has(e)){wasApplied.add(e);let t=this.superclass;t&&t.proto(),prototypeMixinMap.has(this)&&this.PrototypeMixin.apply(e)}return e}static toString(){return`<${getFactoryFor(this)||"(unknown)"}:constructor>`}static isClass=!0;static isMethod=!1;static _onLookup;static _lazyInjections};function flattenProps(...e){let t={};for(let r of e){let e=Object.keys(r);for(let n=0,i=e.length;n<i;n++){let i=e[n];t[i]=r[i]}}return t}var observable_exports=__exportAll({default:()=>Observable$2}),Observable$2=Mixin.create({get(e){return get$7(this,e)},getProperties(...e){return getProperties(this,...e)},set(e,t){return set$1(this,e,t)},setProperties(e){return setProperties(this,e)},beginPropertyChanges(){return beginPropertyChanges(),this},endPropertyChanges(){return endPropertyChanges(),this},notifyPropertyChange(e){return notifyPropertyChange(this,e),this},addObserver(e,t,r,n){return addObserver(this,e,t,r,n),this},removeObserver(e,t,r,n){return removeObserver(this,e,t,r,n),this},hasObserverFor(e){return hasListeners(this,`${e}:change`)},incrementProperty(e,t=1){return set$1(this,e,(parseFloat(get$7(this,e))||0)+t)},decrementProperty(e,t=1){return set$1(this,e,(get$7(this,e)||0)-t)},toggleProperty(e){return set$1(this,e,!get$7(this,e))},cacheFor(e){let t=peekMeta(this);return null!==t?t.valueFor(e):void 0}}),object_exports=__exportAll({action:()=>action,computed:()=>computed,default:()=>EmberObject,defineProperty:()=>defineProperty,get:()=>get$7,getProperties:()=>getProperties,notifyPropertyChange:()=>notifyPropertyChange,observer:()=>observer,set:()=>set$1,setProperties:()=>setProperties,trySet:()=>trySet}),EmberObject=class extends(CoreObject.extend(Observable$2)){get _debugContainerKey(){let e=getFactoryFor(this);return void 0!==e&&e.fullName}},BINDINGS_MAP=new WeakMap;function hasProto(e){return null!=e&&void 0!==e.constructor&&"function"==typeof e.constructor.proto}function setupAction(e,t,r){if(hasProto(e)&&e.constructor.proto(),!Object.prototype.hasOwnProperty.call(e,"actions")){let t=e.actions;e.actions=t?Object.assign({},t):{}}return e.actions[t]=r,{get(){let e=BINDINGS_MAP.get(this);void 0===e&&(e=new Map,BINDINGS_MAP.set(this,e));let t=e.get(r);return void 0===t&&(t=r.bind(this),e.set(r,t)),t}}}function action(...e){let t;if(!isElementDescriptor(e)){t=e[0];let r=function(e,r){return setupAction(e,r,t)};return setClassicDecorator(r),r}let[r,n,i]=e;return t=i?.value,setupAction(r,n,t)}function observer(...e){let t,r,n,i=e.pop();"function"==typeof i?(t=i,r=e,n=!ENV$1._DEFAULT_ASYNC_OBSERVERS):(t=i.fn,r=i.dependentKeys,n=i.sync);let o=[];for(let s of r)expandProperties(s,e=>o.push(e));return setObservers(t,{paths:o,sync:n}),t}function isSimpleClick(e){if(!(e instanceof MouseEvent))return!1;let t=e.shiftKey||e.metaKey||e.altKey||e.ctrlKey,r=0!==e.button;return!t&&!r}function constructStyleDeprecationMessage(e){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: "'+e+'"'}function getRootViews(e){let t=e.lookup("-view-registry:main"),r=[];return Object.keys(t).forEach(e=>{let n=t[e];null===n.parentView&&r.push(n)}),r}function getViewId(e){return""!==e.tagName&&e.elementId?e.elementId:guidFor(e)}setClassicDecorator(action);var ELEMENT_VIEW=new WeakMap,VIEW_ELEMENT=new WeakMap;function getElementView(e){return ELEMENT_VIEW.get(e)||null}function getViewElement(e){return VIEW_ELEMENT.get(e)||null}function setElementView(e,t){ELEMENT_VIEW.set(e,t)}function setViewElement(e,t){VIEW_ELEMENT.set(e,t)}function clearElementView(e){ELEMENT_VIEW.delete(e)}function clearViewElement(e){VIEW_ELEMENT.delete(e)}var CHILD_VIEW_IDS=new WeakMap;function getChildViews(e){return collectChildViews(e,getOwner$2(e).lookup("-view-registry:main"))}function initChildViews(e){let t=new Set;return CHILD_VIEW_IDS.set(e,t),t}function addChildView(e,t){let r=CHILD_VIEW_IDS.get(e);void 0===r&&(r=initChildViews(e)),r.add(getViewId(t))}function collectChildViews(e,t){let r=[],n=CHILD_VIEW_IDS.get(e);return void 0!==n&&n.forEach(e=>{let n=t[e];!n||n.isDestroying||n.isDestroyed||r.push(n)}),r}function getViewBounds(e){return e.renderer.getBounds(e)}function getViewRange(e){let t=getViewBounds(e),r=document.createRange();return r.setStartBefore(t.firstNode),r.setEndAfter(t.lastNode),r}function getViewClientRects(e){return getViewRange(e).getClientRects()}function getViewBoundingClientRect(e){return getViewRange(e).getBoundingClientRect()}var ROOT_ELEMENT_CLASS="ember-application",EventDispatcher=class extends EmberObject{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(e,t){let r=this.finalEventNameMapping={...get$7(this,"events"),...e};this._reverseEventNameMapping=Object.keys(r).reduce((e,t)=>{let n=r[t];return n?{...e,[n]:t}:e},{});let n=this.lazyEvents;null!=t&&set$1(this,"rootElement",t);let i=get$7(this,"rootElement"),o="string"!=typeof i?i:document.querySelector(i);o.classList.add(ROOT_ELEMENT_CLASS),this._sanitizedRootElement=o;for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&n.set(s,r[s]??null);this._didSetup=!0}setupHandlerForBrowserEvent(e){this.setupHandler(this._sanitizedRootElement,e,this.finalEventNameMapping[e]??null)}setupHandlerForEmberEvent(e){let t=this._reverseEventNameMapping?.[e];t&&this.setupHandler(this._sanitizedRootElement,t,e)}setupHandler(e,t,r){if(null===r||!this.lazyEvents.has(t))return;let n=(e,t)=>{let n=getElementView(e),i=!0;return n&&(i=n.handleEvent(r,t)),i},i=this._eventHandlers[t]=e=>{let t=e.target;do{if(getElementView(t)){if(!1===n(t,e)){e.preventDefault(),e.stopPropagation();break}if(!0===e.cancelBubble)break}t=t.parentNode}while(t instanceof Element)};e.addEventListener(t,i),this.lazyEvents.delete(t)}destroy(){if(!1===this._didSetup)return;let e=this._sanitizedRootElement;if(e){for(let t in this._eventHandlers)e.removeEventListener(t,this._eventHandlers[t]);return e.classList.remove(ROOT_ELEMENT_CLASS),this._super(...arguments)}}toString(){return"(EventDispatcher)"}},VALID_FULL_NAME_REGEXP=/^[^:]+:[^:]+$/,Registry=class{_failSet;resolver;fallback;registrations;_normalizeCache;_options;_resolveCache;_typeOptions;constructor(e={}){this.fallback=e.fallback||null,this.resolver=e.resolver||null,this.registrations=makeDictionary(e.registrations||null),this._normalizeCache=makeDictionary(null),this._resolveCache=makeDictionary(null),this._failSet=new Set,this._options=makeDictionary(null),this._typeOptions=makeDictionary(null)}container(e){return new Container(this,e)}register(e,t,r={}){let n=this.normalize(e);this._failSet.delete(n),this.registrations[n]=t,this._options[n]=r}unregister(e){let t=this.normalize(e);delete this.registrations[t],delete this._resolveCache[t],delete this._options[t],this._failSet.delete(t)}resolve(e){let t=resolve$1(this,this.normalize(e));return void 0===t&&null!==this.fallback&&(t=this.fallback.resolve(e)),t}describe(e){return null!==this.resolver&&this.resolver.lookupDescription?this.resolver.lookupDescription(e):null!==this.fallback?this.fallback.describe(e):e}normalizeFullName(e){return null!==this.resolver&&this.resolver.normalize?this.resolver.normalize(e):null!==this.fallback?this.fallback.normalizeFullName(e):e}normalize(e){return this._normalizeCache[e]||(this._normalizeCache[e]=this.normalizeFullName(e))}makeToString(e,t){return null!==this.resolver&&this.resolver.makeToString?this.resolver.makeToString(e,t):null!==this.fallback?this.fallback.makeToString(e,t):"string"==typeof e?e:e.name??"(unknown class)"}has(e){return!!this.isValidFullName(e)&&has$2(this,this.normalize(e))}optionsForType(e,t){this._typeOptions[e]=t}getOptionsForType(e){let t=this._typeOptions[e];return void 0===t&&null!==this.fallback&&(t=this.fallback.getOptionsForType(e)),t}options(e,t){let r=this.normalize(e);this._options[r]=t}getOptions(e){let t=this.normalize(e),r=this._options[t];return void 0===r&&null!==this.fallback&&(r=this.fallback.getOptions(e)),r}getOption(e,t){let r=this._options[e];if(void 0!==r&&void 0!==r[t])return r[t];let n=e.split(":")[0];return r=this._typeOptions[n],r&&void 0!==r[t]?r[t]:null!==this.fallback?this.fallback.getOption(e,t):void 0}knownForType(e){let t,r,n=makeDictionary(null),i=Object.keys(this.registrations);for(let o of i)o.split(":")[0]===e&&(n[o]=!0);return null!==this.fallback&&(t=this.fallback.knownForType(e)),null!==this.resolver&&this.resolver.knownForType&&(r=this.resolver.knownForType(e)),Object.assign({},t,n,r)}isValidFullName(e){return VALID_FULL_NAME_REGEXP.test(e)}};function resolve$1(e,t){let r,n=t,i=e._resolveCache[n];return void 0!==i?i:e._failSet.has(n)?void 0:(e.resolver&&(r=e.resolver.resolve(n)),void 0===r&&(r=e.registrations[n]),void 0===r?e._failSet.add(n):e._resolveCache[n]=r,r)}function has$2(e,t){return void 0!==e.resolve(t)}var privateNames=makeDictionary(null),privateSuffix=`${Math.random()}${Date.now()}`.replace(".","");function privatize([e]){let t=privateNames[e];if(t)return t;let[r,n]=e.split(":");return privateNames[e]=intern(`${r}:${n}-${privateSuffix}`)}var evented_exports=__exportAll({default:()=>Evented,on:()=>on$3}),Evented=Mixin.create({on(e,t,r){return addListener(this,e,t,r),this},one(e,t,r){return addListener(this,e,t,r,!0),this},trigger(e,...t){sendEvent(this,e,t)},off(e,t,r){return removeListener(this,e,t,r),this},has(e){return hasListeners(this,e)}}),Enumerable=Mixin.create(),mutable_exports=__exportAll({default:()=>MutableEnumerable}),MutableEnumerable=Mixin.create(Enumerable),TYPE_MAP={"[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:toString$2}=Object.prototype;function typeOf$1(e){if(null===e)return"null";if(void 0===e)return"undefined";let t=TYPE_MAP[toString$2.call(e)]||"object";return"function"===t?CoreObject.detect(e)&&(t="class"):"object"===t&&(e instanceof Error?t="error":e instanceof CoreObject?t="instance":e instanceof Date&&(t="date")),t}var Comparable=Mixin.create({compare:null}),TYPE_ORDER={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 spaceship(e,t){return Math.sign(e-t)}function compare$1(e,t){if(e===t)return 0;let r=typeOf$1(e),n=typeOf$1(t);if("instance"===r&&isComparable(e)&&e.constructor.compare)return e.constructor.compare(e,t);if("instance"===n&&isComparable(t)&&t.constructor.compare)return-1*t.constructor.compare(t,e);let i=spaceship(TYPE_ORDER[r],TYPE_ORDER[n]);if(0!==i)return i;switch(r){case"boolean":return spaceship(Number(e),Number(t));case"number":return spaceship(e,t);case"string":return spaceship(e.localeCompare(t),0);case"array":{let r=e.length,n=t.length,i=Math.min(r,n);for(let o=0;o<i;o++){let r=compare$1(e[o],t[o]);if(0!==r)return r}return spaceship(r,n)}case"instance":return isComparable(e)&&e.compare?e.compare(e,t):0;case"date":return spaceship(e.getTime(),t.getTime());default:return 0}}function isComparable(e){return Comparable.detect(e)}var array_exports=__exportAll({A:()=>A$1,MutableArray:()=>MutableArray,NativeArray:()=>NativeArray,default:()=>EmberArray,isArray:()=>isArray$5,makeArray:()=>makeArray,removeAt:()=>removeAt,uniqBy:()=>uniqBy}),EMPTY_ARRAY$3=Object.freeze([]),identityFunction=e=>e;function uniqBy(e,t=identityFunction){let r=A$1(),n=new Set,i="function"==typeof t?t:e=>get$7(e,t);return e.forEach(e=>{let t=i(e);n.has(t)||(n.add(t),r.push(e))}),r}function iter(...e){let t=2===e.length,[r,n]=e;return t?e=>n===get$7(e,r):e=>Boolean(get$7(e,r))}function findIndex(e,t,r){let n=e.length;for(let i=r;i<n;i++)if(t(objectAt(e,i),i,e))return i;return-1}function find(e,t,r=null){let n=findIndex(e,t.bind(r),0);return-1===n?void 0:objectAt(e,n)}function any(e,t,r=null){return-1!==findIndex(e,t.bind(r),0)}function every(e,t,r=null){let n=t.bind(r);return-1===findIndex(e,(e,t,r)=>!n(e,t,r),0)}function indexOf(e,t,r=0,n){let i=e.length;return r<0&&(r+=i),findIndex(e,n&&t!=t?e=>e!=e:e=>e===t,r)}function removeAt(e,t,r){return replace(e,t,r??1,EMPTY_ARRAY$3),e}function insertAt(e,t,r){return replace(e,t,0,[r]),r}function isArray$5(e){if(!e||e.setInterval)return!1;if(Array.isArray(e)||EmberArray.detect(e))return!0;let t=typeOf$1(e);if("array"===t)return!0;let r=e.length;return"number"==typeof r&&r==r&&"object"===t}function nonEnumerableComputed(e){let t=computed(e);return t.enumerable=!1,t}function mapBy(e){return this.map(t=>get$7(t,e))}var EmberArray=Mixin.create(Enumerable,{init(){this._super(...arguments),setEmberArray(this)},objectsAt(e){return e.map(e=>objectAt(this,e))},"[]":nonEnumerableComputed({get(){return this},set(e,t){return this.replace(0,this.length,t),this}}),firstObject:nonEnumerableComputed(function(){return objectAt(this,0)}).readOnly(),lastObject:nonEnumerableComputed(function(){return objectAt(this,this.length-1)}).readOnly(),slice(e=0,t){let r,n=A$1(),i=this.length;for(e<0&&(e=i+e),r=void 0===t||t>i?i:t<0?i+t:t;e<r;)n[n.length]=objectAt(this,e++);return n},indexOf(e,t){return indexOf(this,e,t,!1)},lastIndexOf(e,t){let r=this.length;(void 0===t||t>=r)&&(t=r-1),t<0&&(t+=r);for(let n=t;n>=0;n--)if(objectAt(this,n)===e)return n;return-1},forEach(e,t=null){let r=this.length;for(let n=0;n<r;n++){let r=this.objectAt(n);e.call(t,r,n,this)}return this},getEach:mapBy,setEach(e,t){return this.forEach(r=>set$1(r,e,t))},map(e,t=null){let r=A$1();return this.forEach((n,i,o)=>r[i]=e.call(t,n,i,o)),r},mapBy:mapBy,filter(e,t=null){let r=A$1();return this.forEach((n,i,o)=>{e.call(t,n,i,o)&&r.push(n)}),r},reject(e,t=null){return this.filter(function(){return!e.apply(t,arguments)})},filterBy(){return this.filter(iter(...arguments))},rejectBy(){return this.reject(iter(...arguments))},find(e,t=null){return find(this,e,t)},findBy(){return find(this,iter(...arguments))},every(e,t=null){return every(this,e,t)},isEvery(){return every(this,iter(...arguments))},any(e,t=null){return any(this,e,t)},isAny(){return any(this,iter(...arguments))},reduce(e,t){let r=t,n=0;if(!(arguments.length>1)){if(0===this.length)throw new TypeError("Reduce of empty array with no initial value");r=this.objectAt(0),n=1}for(let i=n;i<this.length;i++)r=e(r,this.objectAt(i),i,this);return r},invoke(e,...t){let r=A$1();return this.forEach(n=>r.push(n[e]?.(...t))),r},toArray(){return this.map(e=>e)},compact(){return this.filter(e=>null!=e)},includes(e,t){return-1!==indexOf(this,e,t,!0)},sortBy(){let e=arguments;return this.toArray().sort((t,r)=>{for(let n=0;n<e.length;n++){let i=e[n],o=compare$1(get$7(t,i),get$7(r,i));if(o)return o}return 0})},uniq(){return uniqBy(this)},uniqBy(e){return uniqBy(this,e)},without(e){if(!this.includes(e))return this;let t=e==e?t=>t!==e:e=>e==e;return this.filter(t)}}),MutableArray=Mixin.create(EmberArray,MutableEnumerable,{clear(){let e=this.length;return 0===e||this.replace(0,e,EMPTY_ARRAY$3),this},insertAt(e,t){return insertAt(this,e,t),this},removeAt(e,t){return removeAt(this,e,t)},pushObject(e){return insertAt(this,this.length,e)},pushObjects(e){return this.replace(this.length,0,e),this},popObject(){let e=this.length;if(0===e)return null;let t=objectAt(this,e-1);return this.removeAt(e-1,1),t},shiftObject(){if(0===this.length)return null;let e=objectAt(this,0);return this.removeAt(0),e},unshiftObject(e){return insertAt(this,0,e)},unshiftObjects(e){return this.replace(0,0,e),this},reverseObjects(){let e=this.length;if(0===e)return this;let t=this.toArray().reverse();return this.replace(0,e,t),this},setObjects(e){if(0===e.length)return this.clear();let t=this.length;return this.replace(0,t,e),this},removeObject(e){let t=this.length||0;for(;--t>=0;)objectAt(this,t)===e&&this.removeAt(t);return this},removeObjects(e){beginPropertyChanges();for(let t=e.length-1;t>=0;t--)this.removeObject(e[t]);return endPropertyChanges(),this},addObject(e){return this.includes(e)||this.pushObject(e),this},addObjects(e){return beginPropertyChanges(),e.forEach(e=>this.addObject(e)),endPropertyChanges(),this}}),NativeArray=Mixin.create(MutableArray,Observable$2,{objectAt(e){return this[e]},replace(e,t,r=EMPTY_ARRAY$3){return replaceInNativeArray(this,e,t,r),this}}),ignore=["length"];NativeArray.keys().forEach(e=>{Array.prototype[e]&&ignore.push(e)}),NativeArray=NativeArray.without(...ignore);var A$1=function(e){return isEmberArray(e)?e:NativeArray.apply(e??[])},FrameworkObject=class extends EmberObject{},controller_exports=__exportAll({ControllerMixin:()=>ControllerMixin,default:()=>Controller,inject:()=>inject$1}),MODEL=Symbol("MODEL"),ControllerMixin=Mixin.create(ActionHandler,{isController:!0,concatenatedProperties:["queryParams"],target:null,store:null,init(){this._super(...arguments);let e=getOwner$2(this);e&&(this.namespace=e.lookup("application:main"),this.target=e.lookup("router:main"))},model:computed({get(){return this[MODEL]},set(e,t){return this[MODEL]=t}}),queryParams:null,_qpDelegate:null,_qpChanged(e,t){let r=t.indexOf(".[]"),n=-1===r?t:t.slice(0,r);(0,e._qpDelegate)(n,get$7(e,n))}}),Controller=class extends(FrameworkObject.extend(ControllerMixin)){};function inject$1(...e){return inject$2("controller",...e)}var testing=!1;function isTesting(){return testing}function setTesting(e){testing=Boolean(e)}var ENGINE_PARENT=Symbol("ENGINE_PARENT");function getEngineParent(e){return e[ENGINE_PARENT]}function setEngineParent(e,t){e[ENGINE_PARENT]=t}var ContainerProxyMixin=Mixin.create({__container__:null,ownerInjection(){return this.__container__.ownerInjection()},lookup(e,t){return this.__container__.lookup(e,t)},destroy(){let e=this.__container__;e&&join$2(()=>{e.destroy(),schedule("destroy",e,"finalizeDestroy")}),this._super()},factoryFor(e){return this.__container__.factoryFor(e)}}),RegistryProxyMixin=Mixin.create({__registry__:null,resolveRegistration(e){return this.__registry__.resolve(e)},register:registryAlias("register"),unregister:registryAlias("unregister"),hasRegistration:registryAlias("has"),registeredOption:registryAlias("getOption"),registerOptions:registryAlias("options"),registeredOptions:registryAlias("getOptions"),registerOptionsForType:registryAlias("optionsForType"),registeredOptionsForType:registryAlias("getOptionsForType")});function registryAlias(e){return function(...t){return this.__registry__[e](...t)}}var EngineInstance=class extends(EmberObject.extend(RegistryProxyMixin,ContainerProxyMixin)){static setupRegistry(e,t){}[ENGINE_PARENT];_booted=!1;init(e){super.init(e),guidFor(this),this.base??=this.application;let t=this.__registry__=new Registry({fallback:this.base.__registry__});this.__container__=t.container({owner:this}),this._booted=!1}_bootPromise=null;boot(e){return this._bootPromise||(this._bootPromise=new RSVP$1.Promise(t=>{t(this._bootSync(e))})),this._bootPromise}_bootSync(e){return this._booted||(this.cloneParentDependencies(),this.setupRegistry(e),this.base.runInstanceInitializers(this),this._booted=!0),this}setupRegistry(e=this.__container__.lookup("-environment:main")){this.constructor.setupRegistry(this.__registry__,e)}unregister(e){this.__container__.reset(e),this.__registry__.unregister(e)}buildChildEngineInstance(e,t={}){let r=this.lookup(`engine:${e}`);if(!r)throw new Error(`You attempted to mount the engine '${e}', but it is not registered with its parent.`);let n=r.buildInstance(t);return setEngineParent(n,this),n}cloneParentDependencies(){const e=getEngineParent(this);["route:basic","service:-routing"].forEach(t=>{let r=e.resolveRegistration(t);this.register(t,r)});let t=e.lookup("-environment:main");this.register("-environment:main",t,{instantiate:!1});let r=["router:main",privatize`-bucket-cache:main`,"-view-registry:main","renderer:-dom","service:-document"];t.isInteractive&&r.push("event_dispatcher:main"),r.forEach(t=>{let r=e.lookup(t);this.register(t,r,{instantiate:!1})})}},wrapGetterSetter=function(e,t,r){let{get:n}=r;return void 0!==n&&(r.get=function(){let e,r=tagFor(this,t),i=track(()=>{e=n.call(this)});return UPDATE_TAG(r,i),consumeTag(i),e}),r};function dependentKeyCompat(...e){if(isElementDescriptor(e)){let[t,r,n]=e;return wrapGetterSetter(t,r,n)}{const t=e[0];let r=function(e,r){return wrapGetterSetter(e,r,t)};return setClassicDecorator(r),r}}setClassicDecorator(dependentKeyCompat);var InternalComponentCapabilities={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},MACHINE_MASK=1024;function buildCapabilities(e){return e}var EMPTY$1=InternalComponentCapabilities.Empty;function capabilityFlagsFrom(e){return EMPTY$1|capability(e,"dynamicLayout")|capability(e,"dynamicTag")|capability(e,"prepareArgs")|capability(e,"createArgs")|capability(e,"attributeHook")|capability(e,"elementHook")|capability(e,"dynamicScope")|capability(e,"createCaller")|capability(e,"updateHook")|capability(e,"createInstance")|capability(e,"wrapped")|capability(e,"willDestroy")|capability(e,"hasSubOwner")}function capability(e,t){return e[t]?InternalComponentCapabilities[t]:EMPTY$1}function managerHasCapability(e,t,r){return!!(t&r)}function hasCapability(e,t){return!!(e&t)}function helperCapabilities(e,t={}){return buildCapabilities({hasValue:Boolean(t.hasValue),hasDestroyable:Boolean(t.hasDestroyable),hasScheduledEffect:Boolean(t.hasScheduledEffect)})}function hasValue(e){return e.capabilities.hasValue}function hasDestroyable(e){return e.capabilities.hasDestroyable}var CustomHelperManager=class{constructor(e){this.factory=e}helperManagerDelegates=new WeakMap;undefinedDelegate=null;getDelegateForOwner(e){let t=this.helperManagerDelegates.get(e);if(void 0===t){let{factory:r}=this;t=r(e),this.helperManagerDelegates.set(e,t)}return t}getDelegateFor(e){if(void 0===e){let{undefinedDelegate:e}=this;if(null===e){let{factory:t}=this;this.undefinedDelegate=e=t(void 0)}return e}return this.getDelegateForOwner(e)}getHelper(e){return(t,r)=>{let n=this.getDelegateFor(r);const i=argsProxyFor(t),o=n.createHelper(e,i);if(hasValue(n)){let e=createComputeRef(()=>n.getValue(o),null,!1);return hasDestroyable(n)&&associateDestroyableChild(e,n.getDestroyable(o)),e}if(hasDestroyable(n)){let e=createConstRef(void 0);return associateDestroyableChild(e,n.getDestroyable(o)),e}return UNDEFINED_REFERENCE}}},FunctionHelperManager=class{capabilities=buildCapabilities({hasValue:!0,hasDestroyable:!1,hasScheduledEffect:!1});createHelper(e,t){return{fn:e,args:t}}getValue({fn:e,args:t}){return Object.keys(t.named).length>0?e(...t.positional,t.named):e(...t.positional)}getDebugName(e){return e.name?`(helper function ${e.name})`:"(anonymous helper function)"}},COMPONENT_MANAGERS=new WeakMap,MODIFIER_MANAGERS=new WeakMap,HELPER_MANAGERS=new WeakMap,getPrototypeOf$2=Object.getPrototypeOf;function setManager(e,t,r){return e.set(r,t),r}function getManager(e,t){let r=t;for(;null!==r;){const t=e.get(r);if(void 0!==t)return t;r=getPrototypeOf$2(r)}}function setInternalModifierManager(e,t){return setManager(MODIFIER_MANAGERS,e,t)}function getInternalModifierManager(e){const t=getManager(MODIFIER_MANAGERS,e);return void 0===t?null:t}function setInternalHelperManager(e,t){return setManager(HELPER_MANAGERS,e,t)}var DEFAULT_MANAGER=new CustomHelperManager(()=>new FunctionHelperManager);function getInternalHelperManager(e){let t=getManager(HELPER_MANAGERS,e);return void 0===t&&"function"==typeof e&&(t=DEFAULT_MANAGER),t||null}function setInternalComponentManager(e,t){return setManager(COMPONENT_MANAGERS,e,t)}function getInternalComponentManager(e){const t=getManager(COMPONENT_MANAGERS,e);return void 0===t?null:t}function hasInternalComponentManager(e){return void 0!==getManager(COMPONENT_MANAGERS,e)}function hasInternalHelperManager(e){return hasDefaultHelperManager(e)||void 0!==getManager(HELPER_MANAGERS,e)}function hasInternalModifierManager(e){return void 0!==getManager(MODIFIER_MANAGERS,e)}function hasDefaultHelperManager(e){return"function"==typeof e}var createObject$1=Object.create;function createMap(){var e=createObject$1(null);return e.__=void 0,delete e.__,e}var Target$1=function(e,t,r){this.path=e,this.matcher=t,this.delegate=r};Target$1.prototype.to=function(e,t){var r=this.delegate;if(r&&r.willAddRoute&&(e=r.willAddRoute(this.matcher.target,e)),this.matcher.add(this.path,e),t){if(0===t.length)throw new Error("You must have an argument in the function passed to `to`");this.matcher.addChild(this.path,e,t,this.delegate)}};var Matcher=function(e){this.routes=createMap(),this.children=createMap(),this.target=e};function generateMatch(e,t,r){return function(n,i){var o=e+n;if(!i)return new Target$1(o,t,r);i(generateMatch(o,t,r))}}function addRoute(e,t,r){for(var n=0,i=0;i<e.length;i++)n+=e[i].path.length;var o={path:t=t.substr(n),handler:r};e.push(o)}function eachRoute(e,t,r,n){for(var i=t.routes,o=Object.keys(i),s=0;s<o.length;s++){var a=o[s],l=e.slice();addRoute(l,a,i[a]);var c=t.children[a];c?eachRoute(l,c,r,n):r.call(n,l)}}Matcher.prototype.add=function(e,t){this.routes[e]=t},Matcher.prototype.addChild=function(e,t,r,n){var i=new Matcher(t);this.children[e]=i;var o=generateMatch(e,i,n);n&&n.contextEntered&&n.contextEntered(t,o),r(o)};var map$1=function(e,t){var r=new Matcher;e(generateMatch("",r,this.delegate)),eachRoute([],r,function(e){t?t(this,e):this.add(e)},this)};function normalizePath(e){return e.split("/").map(normalizeSegment).join("/")}var SEGMENT_RESERVED_CHARS=/%|\//g;function normalizeSegment(e){return e.length<3||-1===e.indexOf("%")?e:decodeURIComponent(e).replace(SEGMENT_RESERVED_CHARS,encodeURIComponent)}var PATH_SEGMENT_ENCODINGS=/%(?:2(?:4|6|B|C)|3(?:B|D|A)|40)/g;function encodePathSegment(e){return encodeURIComponent(e).replace(PATH_SEGMENT_ENCODINGS,decodeURIComponent)}var escapeRegex=/(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\)/g,isArray$4=Array.isArray,hasOwnProperty$2=Object.prototype.hasOwnProperty;function getParam(e,t){if("object"!=typeof e||null===e)throw new Error("You must pass an object as the second argument to `generate`.");if(!hasOwnProperty$2.call(e,t))throw new Error("You must provide param `"+t+"` to `generate`.");var r=e[t],n="string"==typeof r?r:""+r;if(0===n.length)throw new Error("You must provide a param `"+t+"`.");return n}var eachChar=[];eachChar[0]=function(e,t){for(var r=t,n=e.value,i=0;i<n.length;i++){var o=n.charCodeAt(i);r=r.put(o,!1,!1)}return r},eachChar[1]=function(e,t){return t.put(47,!0,!0)},eachChar[2]=function(e,t){return t.put(-1,!1,!0)},eachChar[4]=function(e,t){return t};var regex$2=[];regex$2[0]=function(e){return e.value.replace(escapeRegex,"\\$1")},regex$2[1]=function(){return"([^/]+)"},regex$2[2]=function(){return"(.+)"},regex$2[4]=function(){return""};var generate=[];generate[0]=function(e){return e.value},generate[1]=function(e,t){var r=getParam(t,e.value);return RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS?encodePathSegment(r):r},generate[2]=function(e,t){return getParam(t,e.value)},generate[4]=function(){return""};var EmptyObject=Object.freeze({}),EmptyArray=Object.freeze([]);function parse$2(e,t,r){t.length>0&&47===t.charCodeAt(0)&&(t=t.substr(1));for(var n=t.split("/"),i=void 0,o=void 0,s=0;s<n.length;s++){var a,l,c=n[s];12&(a=2<<(l=""===c?4:58===c.charCodeAt(0)?1:42===c.charCodeAt(0)?2:0))&&(c=c.slice(1),(i=i||[]).push(c),(o=o||[]).push(!!(4&a))),14&a&&r[l]++,e.push({type:l,value:normalizeSegment(c)})}return{names:i||EmptyArray,shouldDecodes:o||EmptyArray}}function isEqualCharSpec(e,t,r){return e.char===t&&e.negate===r}var State=function(e,t,r,n,i){this.states=e,this.id=t,this.char=r,this.negate=n,this.nextStates=i?t:null,this.pattern="",this._regex=void 0,this.handlers=void 0,this.types=void 0};function isMatch(e,t){return e.negate?e.char!==t&&-1!==e.char:e.char===t||-1===e.char}function sortSolutions(e){return e.sort(function(e,t){var r=e.types||[0,0,0],n=r[0],i=r[1],o=r[2],s=t.types||[0,0,0],a=s[0],l=s[1],c=s[2];if(o!==c)return o-c;if(o){if(n!==a)return a-n;if(i!==l)return l-i}return i!==l?i-l:n!==a?a-n:0})}function recognizeChar(e,t){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];r=r.concat(o.match(t))}return r}State.prototype.regex=function(){return this._regex||(this._regex=new RegExp(this.pattern)),this._regex},State.prototype.get=function(e,t){var r=this.nextStates;if(null!==r)if(isArray$4(r))for(var n=0;n<r.length;n++){var i=this.states[r[n]];if(isEqualCharSpec(i,e,t))return i}else{var o=this.states[r];if(isEqualCharSpec(o,e,t))return o}},State.prototype.put=function(e,t,r){var n;if(n=this.get(e,t))return n;var i=this.states;return n=new State(i,i.length,e,t,r),i[i.length]=n,null==this.nextStates?this.nextStates=n.id:isArray$4(this.nextStates)?this.nextStates.push(n.id):this.nextStates=[this.nextStates,n.id],n},State.prototype.match=function(e){var t=this.nextStates;if(!t)return[];var r=[];if(isArray$4(t))for(var n=0;n<t.length;n++){var i=this.states[t[n]];isMatch(i,e)&&r.push(i)}else{var o=this.states[t];isMatch(o,e)&&r.push(o)}return r};var RecognizeResults=function(e){this.length=0,this.queryParams=e||{}};function findHandler(e,t,r){var n=e.handlers,i=e.regex();if(!i||!n)throw new Error("state not initialized");var o=t.match(i),s=1,a=new RecognizeResults(r);a.length=n.length;for(var l=0;l<n.length;l++){var c=n[l],u=c.names,h=c.shouldDecodes,d=EmptyObject,p=!1;if(u!==EmptyArray&&h!==EmptyArray)for(var f=0;f<u.length;f++){p=!0;var g=u[f],m=o&&o[s++];d===EmptyObject&&(d={}),RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS&&h[f]?d[g]=m&&decodeURIComponent(m):d[g]=m}a[l]={handler:c.handler,params:d,isDynamic:p}}return a}function decodeQueryParamPart(e){var t;e=e.replace(/\+/gm,"%20");try{t=decodeURIComponent(e)}catch(error){t=""}return t}RecognizeResults.prototype.splice=Array.prototype.splice,RecognizeResults.prototype.slice=Array.prototype.slice,RecognizeResults.prototype.push=Array.prototype.push;var RouteRecognizer=function(){this.names=createMap();var e=[],t=new State(e,0,-1,!0,!1);e[0]=t,this.states=e,this.rootState=t};function buildTransitionAborted(){let e=new Error("TransitionAborted");return e.name="TransitionAborted",e.code="TRANSITION_ABORTED",e}function isTransitionAborted(e){return"object"==typeof e&&null!==e&&"TRANSITION_ABORTED"===e.code}function isAbortable(e){return"object"==typeof e&&null!==e&&"boolean"==typeof e.isAborted}function throwIfAborted(e){if(isAbortable(e)&&e.isAborted)throw buildTransitionAborted()}RouteRecognizer.prototype.add=function(e,t){for(var r,n=this.rootState,i="^",o=[0,0,0],s=new Array(e.length),a=[],l=!0,c=0,u=0;u<e.length;u++){for(var h=e[u],d=parse$2(a,h.path,o),p=d.names,f=d.shouldDecodes;c<a.length;c++){var g=a[c];4!==g.type&&(l=!1,n=n.put(47,!1,!1),i+="/",n=eachChar[g.type](g,n),i+=regex$2[g.type](g))}s[u]={handler:h.handler,names:p,shouldDecodes:f}}l&&(n=n.put(47,!1,!1),i+="/"),n.handlers=s,n.pattern=i+"$",n.types=o,"object"==typeof t&&null!==t&&t.as&&(r=t.as),r&&(this.names[r]={segments:a,handlers:s})},RouteRecognizer.prototype.handlersFor=function(e){var t=this.names[e];if(!t)throw new Error("There is no route named "+e);for(var r=new Array(t.handlers.length),n=0;n<t.handlers.length;n++){var i=t.handlers[n];r[n]=i}return r},RouteRecognizer.prototype.hasRoute=function(e){return!!this.names[e]},RouteRecognizer.prototype.generate=function(e,t){var r=this.names[e],n="";if(!r)throw new Error("There is no route named "+e);for(var i=r.segments,o=0;o<i.length;o++){var s=i[o];4!==s.type&&(n+="/",n+=generate[s.type](s,t))}return"/"!==n.charAt(0)&&(n="/"+n),t&&t.queryParams&&(n+=this.generateQueryString(t.queryParams)),n},RouteRecognizer.prototype.generateQueryString=function(e){var t=[],r=Object.keys(e);r.sort();for(var n=0;n<r.length;n++){var i=r[n],o=e[i];if(null!=o){var s=encodeURIComponent(i);if(isArray$4(o))for(var a=0;a<o.length;a++){var l=i+"[]="+encodeURIComponent(o[a]);t.push(l)}else s+="="+encodeURIComponent(o),t.push(s)}}return 0===t.length?"":"?"+t.join("&")},RouteRecognizer.prototype.parseQueryString=function(e){for(var t=e.split("&"),r={},n=0;n<t.length;n++){var i=t[n].split("="),o=decodeQueryParamPart(i[0]),s=o.length,a=!1,l=void 0;1===i.length?l="true":(s>2&&"[]"===o.slice(s-2)&&(a=!0,r[o=o.slice(0,s-2)]||(r[o]=[])),l=i[1]?decodeQueryParamPart(i[1]):""),a?r[o].push(l):r[o]=l}return r},RouteRecognizer.prototype.recognize=function(e){var t,r=[this.rootState],n={},i=!1,o=e.indexOf("#");-1!==o&&(e=e.substr(0,o));var s=e.indexOf("?");if(-1!==s){var a=e.substr(s+1,e.length);e=e.substr(0,s),n=this.parseQueryString(a)}"/"!==e.charAt(0)&&(e="/"+e);var l=e;RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS?e=normalizePath(e):(e=decodeURI(e),l=decodeURI(l));var c=e.length;c>1&&"/"===e.charAt(c-1)&&(e=e.substr(0,c-1),l=l.substr(0,l.length-1),i=!0);for(var u=0;u<e.length&&(r=recognizeChar(r,e.charCodeAt(u))).length;u++);for(var h=[],d=0;d<r.length;d++)r[d].handlers&&h.push(r[d]);r=sortSolutions(h);var p=h[0];return p&&p.handlers&&(i&&p.pattern&&"(.+)$"===p.pattern.slice(-5)&&(l+="/"),t=findHandler(p,l,n)),t},RouteRecognizer.VERSION="0.3.4",RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS=!0,RouteRecognizer.Normalizer={normalizeSegment:normalizeSegment,normalizePath:normalizePath,encodePathSegment:encodePathSegment},RouteRecognizer.prototype.map=map$1;var slice$1=Array.prototype.slice,hasOwnProperty$1=Object.prototype.hasOwnProperty;function isPromise$1(e){return null!==e&&"object"==typeof e&&"function"==typeof e.then}function merge$2(e,t){for(let r in t)hasOwnProperty$1.call(t,r)&&(e[r]=t[r])}function extractQueryParams(e){let t,r,n=e&&e.length;if(n&&n>0){let i=e[n-1];if(isQueryParamsContainer(i))return r=i.queryParams,t=slice$1.call(e,0,n-1),[t,r]}return[e,null]}function isQueryParamsContainer(e){if(e&&"object"==typeof e){let t=e;return"queryParams"in t&&Object.keys(t.queryParams).every(e=>"string"==typeof e)}return!1}function coerceQueryParamsToString(e){for(let t in e){let r=e[t];if("number"==typeof r)e[t]=String(r);else if(Array.isArray(r))for(let e=0,t=r.length;e<t;e++)r[e]=String(r[e])}}function log$5(e,...t){if(e.log)if(2===t.length){let[r,n]=t;e.log("Transition #"+r+": "+n)}else{let[r]=t;e.log(r)}}function isParam(e){return"string"==typeof e||e instanceof String||"number"==typeof e||e instanceof Number}function forEach$1(e,t){for(let r=0,n=e.length;r<n&&!1!==t(e[r]);r++);}function getChangelist(e,t){let r,n={all:{},changed:{},removed:{}};merge$2(n.all,t);let i=!1;for(r in coerceQueryParamsToString(e),coerceQueryParamsToString(t),e)hasOwnProperty$1.call(e,r)&&(hasOwnProperty$1.call(t,r)||(i=!0,n.removed[r]=e[r]));for(r in t)if(hasOwnProperty$1.call(t,r)){let o=e[r],s=t[r];if(isArray$3(o)&&isArray$3(s))if(o.length!==s.length)n.changed[r]=t[r],i=!0;else for(let e=0,a=o.length;e<a;e++)o[e]!==s[e]&&(n.changed[r]=t[r],i=!0);else e[r]!==t[r]&&(n.changed[r]=t[r],i=!0)}return i?n:void 0}function isArray$3(e){return Array.isArray(e)}function promiseLabel(e){return"Router: "+e}var STATE_SYMBOL="__STATE__-2619860001345920-3322w3",PARAMS_SYMBOL="__PARAMS__-261986232992830203-23323",QUERY_PARAMS_SYMBOL="__QPS__-2619863929824844-32323",REDIRECT_DESTINATION_SYMBOL="__RDS__-2619863929824844-32323",Transition=class e{[STATE_SYMBOL];from=null;to=void 0;router;data;intent;resolvedModels;[QUERY_PARAMS_SYMBOL];promise;error;[PARAMS_SYMBOL];routeInfos;targetName;pivotHandler;sequence;isAborted=!1;isActive=!0;urlMethod="update";resolveIndex=0;queryParamsOnly=!1;isTransition=!0;isCausedByAbortingTransition=!1;isCausedByInitialTransition=!1;isCausedByAbortingReplaceTransition=!1;_visibleQueryParams={};isIntermediate=!1;[REDIRECT_DESTINATION_SYMBOL];constructor(e,t,r,n,i){if(this[STATE_SYMBOL]=r||e.state,this.intent=t,this.router=e,this.data=t&&t.data||{},this.resolvedModels={},this[QUERY_PARAMS_SYMBOL]={},this.promise=void 0,this.error=void 0,this[PARAMS_SYMBOL]={},this.routeInfos=[],this.targetName=void 0,this.pivotHandler=void 0,this.sequence=-1,n)return this.promise=Promise$1.reject(n),void(this.error=n);if(this.isCausedByAbortingTransition=Boolean(i),this.isCausedByInitialTransition=Boolean(i)&&(i.isCausedByInitialTransition||0===i.sequence),this.isCausedByAbortingReplaceTransition=Boolean(i)&&"replace"===i.urlMethod&&(!i.isCausedByAbortingTransition||i.isCausedByAbortingReplaceTransition),r){this[PARAMS_SYMBOL]=r.params,this[QUERY_PARAMS_SYMBOL]=r.queryParams,this.routeInfos=r.routeInfos;let t=r.routeInfos.length;t&&(this.targetName=r.routeInfos[t-1].name);for(let e=0;e<t;++e){let t=r.routeInfos[e];if(!t.isResolved)break;this.pivotHandler=t.route}this.sequence=e.currentSequence++,this.promise=r.resolve(this).catch(e=>{throw this.router.transitionDidError(e,this)},promiseLabel("Handle Abort"))}else this.promise=Promise$1.resolve(this[STATE_SYMBOL]),this[PARAMS_SYMBOL]={}}then(e,t,r){return this.promise.then(e,t,r)}catch(e,t){return this.promise.catch(e,t)}finally(e,t){return this.promise.finally(e,t)}abort(){this.rollback();let t=new e(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||(log$5(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(e){this[REDIRECT_DESTINATION_SYMBOL]=e,this.rollback(),this.router.routeWillChange(e)}retry(){this.abort();let e=this.router.transitionByIntent(this.intent,!1);return null!==this.urlMethod&&e.method(this.urlMethod),e}method(e){return this.urlMethod=e,this}send(e=!1,t,r,n,i){this.trigger(e,t,r,n,i)}trigger(e=!1,t,...r){"string"==typeof e&&(t=e,e=!1),this.router.triggerEvent(this[STATE_SYMBOL].routeInfos.slice(0,this.resolveIndex+1),e,t,r)}followRedirects(){return this.promise.catch(e=>this[REDIRECT_DESTINATION_SYMBOL]?this[REDIRECT_DESTINATION_SYMBOL].followRedirects():Promise$1.reject(e))}toString(){return"Transition (sequence "+this.sequence+")"}log(e){log$5(this.router,this.sequence,e)}};function logAbort(e){return log$5(e.router,e.sequence,"detected abort."),buildTransitionAborted()}function isTransition(e){return"object"==typeof e&&e instanceof Transition&&e.isTransition}function prepareResult(e){return isTransition(e)?null:e}var UnrecognizedURLError=function(){function e(t){let r=Error.call(this,t);this.name="UnrecognizedURLError",this.message=t||"UnrecognizedURL",Error.captureStackTrace?Error.captureStackTrace(this,e):this.stack=r.stack}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}();function generateControllerFactory(e,t){let r=e.factoryFor("controller:basic").class;r=class extends r{toString(){return`(generated ${t} controller)`}};let n=`controller:${t}`;return e.register(n,r),e.factoryFor(n)}function generateController(e,t){generateControllerFactory(e,t);let r=`controller:${t}`;return e.lookup(r)}var ALL_PERIODS_REGEX=/\./g;function extractRouteArgs(e){let t,r,n=(e=e.slice())[e.length-1];return isRouteOptions(n)?(e.pop(),t=n.queryParams):t={},"string"==typeof e[0]&&(r=e.shift()),{routeName:r,models:e,queryParams:t}}function getActiveTargetName(e){let t=e.activeTransition?e.activeTransition[STATE_SYMBOL].routeInfos:e.state.routeInfos;return t[t.length-1].name}function stashParamNames(e,t){if(t._namesStashed)return;let r,n=t[t.length-1].name,i=e._routerMicrolib.recognizer.handlersFor(n);for(let o=0;o<t.length;++o){let e=t[o],n=i[o].names;n.length&&(r=e),e._names=n,e.route._stashNames(e,r)}t._namesStashed=!0}function _calculateCacheValuePrefix(e,t){let r=e.split("."),n="";for(let i=0;i<r.length;i++){let e=r.slice(0,i+1).join(".");if(0!==t.indexOf(e))break;n=e}return n}function calculateCacheKey(e,t=[],r){let n="";for(let i of t){let t,o=_calculateCacheValuePrefix(e,i);if(r)if(o&&o in r){let e=0===i.indexOf(o)?i.substring(o.length+1):i;t=get$7(r[o],e)}else t=get$7(r,i);n+=`::${i}:${t}`}return e+n.replace(ALL_PERIODS_REGEX,"-")}function normalizeControllerQueryParams(e){let t={};for(let r of e)accumulateQueryParamDescriptors(r,t);return t}function accumulateQueryParamDescriptors(e,t){let r="string"==typeof e?{[e]:{as:null}}:e;for(let n in r){if(!Object.prototype.hasOwnProperty.call(r,n))return;let e=r[n],i="string"==typeof e?{as:e}:e;t[n]={...t[n]||{as:null,scope:"model"},...i}}}function resemblesURL(e){return"string"==typeof e&&(""===e||"/"===e[0])}function prefixRouteNameArg(e,t){let r,n=getOwner$2(e),i=n.mountPoint;if(n.routable&&"string"==typeof t[0]){if(r=t[0],resemblesURL(r))throw new Error("Programmatic transitions by URL cannot be used within an Engine. Please use the route name instead.");r=`${i}.${r}`,t[0]=r}return t}function shallowEqual(e,t){let r=0,n=0;for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(e[i]!==t[i])return!1;r++}for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&n++;return r===n}function isRouteOptions(e){if(e&&"object"==typeof e){let t=e.queryParams;if(t&&"object"==typeof t)return Object.keys(t).every(e=>"string"==typeof e)}return!1}var deferred$1=new WeakMap;function deferDecorator$1(e,t,r){let n=deferred$1.get(e);n||(n=new Map,deferred$1.set(e,n)),n.set(t,r)}function findDeferredDecorator$1(e,t){var r;let n=e.prototype;for(;n;){let e=null==(r=deferred$1.get(n))?void 0:r.get(t);if(e)return e;n=Object.getPrototypeOf(n)}}function decorateFieldV2$1(e,t,r,n){let i={configurable:!0,enumerable:!0,writable:!0,initializer:null};n&&(i.initializer=n);for(let o of r)i=o(e,t,i)||i;void 0===i.initializer?Object.defineProperty(e,t,i):deferDecorator$1(e,t,i)}function decorateMethodV2$1(e,t,r){let n={...Object.getOwnPropertyDescriptor(e,t)};for(let i of r)n=i(e,t,n)||n;void 0!==n.initializer&&(n.value=n.initializer?n.initializer.call(e):void 0,n.initializer=void 0),Object.defineProperty(e,t,n)}function initializeDeferredDecorator$1(e,t){let r=findDeferredDecorator$1(e.constructor,t);r&&Object.defineProperty(e,t,{enumerable:r.enumerable,configurable:r.configurable,writable:r.writable,value:r.initializer?r.initializer.call(e):void 0})}var RENDER=Symbol("render"),RENDER_STATE=Symbol("render-state"),Route=class extends(EmberObject.extend(ActionHandler,Evented)){static isRouteFactory=!0;context={};_bucketCache;_internalName;_names;_router;constructor(e){if(super(e),e){let t=e.lookup("router:main"),r=e.lookup(privatize`-bucket-cache:main`);this._router=t,this._bucketCache=r,this._topLevelViewTemplate=e.lookup("template:-outlet"),this._environment=e.lookup("-environment:main")}}serialize(e,t){if(t.length<1||!e)return;let r={};if(1===t.length){let[n]=t;"object"==typeof e&&n in e?r[n]=get$7(e,n):/_id$/.test(n)?r[n]=get$7(e,"id"):isProxy(e)&&(r[n]=get$7(e,n))}else r=getProperties(e,t);return r}_setRouteName(e){this.routeName=e;let t=getOwner$2(this);this.fullRouteName=getEngineRouteName(t,e)}_stashNames(e,t){if(this._names)return;let r=this._names=e._names;r.length||(r=(e=t)&&e._names||[]);let n=get$7(this,"_qp").qps,i=new Array(r.length);for(let o=0;o<r.length;++o)i[o]=`${e.name}.${r[o]}`;for(let o of n)"model"===o.scope&&(o.parts=i)}_activeQPChanged(e,t){this._router._activeQPChanged(e.scopedPropertyName,t)}_updatingQPChanged(e){this._router._updatingQPChanged(e.urlKey)}paramsFor(e){let t=getOwner$2(this).lookup(`route:${e}`);if(void 0===t)return{};let r=this._router._routerMicrolib.activeTransition,n=r?r[STATE_SYMBOL]:this._router._routerMicrolib.state,i=t.fullRouteName,o={...n.params[i]},s=getQueryParamsFor(t,n);return Object.entries(s).reduce((e,[t,r])=>(e[t]=r,e),o)}serializeQueryParamKey(e){return e}serializeQueryParam(e,t,r){return this._router._serializeQueryParam(e,r)}deserializeQueryParam(e,t,r){return this._router._deserializeQueryParam(e,r)}_optionsForQueryParam(e){const t=get$7(this,"queryParams");return get$7(t,e.urlKey)||get$7(t,e.prop)||t[e.urlKey]||t[e.prop]||{}}resetController(e,t,r){return this}exit(e){this.deactivate(e),this.trigger("deactivate",e),this.teardownViews()}_internalReset(e,t){let r=this.controller;r._qpDelegate=get$7(this,"_qp").states.inactive,this.resetController(r,e,t)}enter(e){this[RENDER_STATE]=void 0,this.activate(e),this.trigger("activate",e)}deactivate(e){}activate(e){}intermediateTransitionTo(...e){let[t,...r]=prefixRouteNameArg(this,e);this._router.intermediateTransitionTo(t,...r)}refresh(){return this._router._routerMicrolib.refresh(this)}setup(e,t){let r=this.controllerName||this.routeName,n=this.controllerFor(r,!0)??this.generateController(r),i=get$7(this,"_qp");if(!this.controller){let e=i.propertyNames;addQueryParamsObservers(n,e),this.controller=n}if(n._qpDelegate=i.states.allowOverrides,t){stashParamNames(this._router,t[STATE_SYMBOL].routeInfos);let e=this._bucketCache,r=t[PARAMS_SYMBOL];i.propertyNames.forEach(t=>{let o=i.map[t];o.values=r;let s=calculateCacheKey(o.route.fullRouteName,o.parts,o.values),a=e.lookup(s,t,o.undecoratedDefaultValue);set$1(n,t,a)});let o=getQueryParamsFor(this,t[STATE_SYMBOL]);setProperties(n,o)}this.setupController(n,e,t),this._environment.options.shouldRender&&this[RENDER](),flushAsyncObservers(!1)}_qpChanged(e,t,r){if(!r)return;let n=this._bucketCache,i=calculateCacheKey(r.route.fullRouteName,r.parts,r.values);n.stash(i,e,t)}beforeModel(e){}afterModel(e,t){}redirect(e,t){}contextDidChange(){this.currentModel=this.context}model(e,t){let r,n,i=get$7(this,"_qp").map;for(let o in e){if("queryParams"===o||i&&o in i)continue;let e=o.match(/^(.*)_id$/);null!==e&&(r=e[1]),n=!0}if(!r){if(n)return Object.assign({},e);if(t.resolveIndex<1)return;return t[STATE_SYMBOL].routeInfos[t.resolveIndex-1].context}}deserialize(e,t){return this.model(this._paramsFor(this.routeName,e),t)}setupController(e,t,r){e&&void 0!==t&&set$1(e,"model",t)}controllerFor(e,t=!1){let r=getOwner$2(this),n=r.lookup(`route:${e}`);return n&&n.controllerName&&(e=n.controllerName),r.lookup(`controller:${e}`)}generateController(e){return generateController(getOwner$2(this),e)}modelFor(e){let t,r=getOwner$2(this),n=this._router&&this._router._routerMicrolib?this._router._routerMicrolib.activeTransition:void 0;t=r.routable&&void 0!==n?getEngineRouteName(r,e):e;let i=r.lookup(`route:${t}`);if(null!=n){let e=i&&i.routeName||t;if(Object.prototype.hasOwnProperty.call(n.resolvedModels,e))return n.resolvedModels[e]}return i?.currentModel}[RENDER_STATE]=void 0;[RENDER](){this[RENDER_STATE]=buildRenderState(this),once(this._router,"_setOutlets")}willDestroy(){this.teardownViews()}teardownViews(){this[RENDER_STATE]&&(this[RENDER_STATE]=void 0,once(this._router,"_setOutlets"))}buildRouteInfoMetadata(){}_paramsFor(e,t){return void 0!==this._router._routerMicrolib.activeTransition?this.paramsFor(e):t}get _store(){const e=getOwner$2(this);return this.routeName,{find(t,r){let n=e.factoryFor(`model:${t}`);if(n)return n=n.class,n.find(r)}}}static{decorateMethodV2$1(this.prototype,"_store",[computed])}get _qp(){let e={},t=this.controllerName||this.routeName,r=getOwner$2(this),n=r.lookup(`controller:${t}`),i=get$7(this,"queryParams"),o=Object.keys(i).length>0;n?e=mergeEachQueryParams(normalizeControllerQueryParams(get$7(n,"queryParams")||[]),i):o&&(n=generateController(r,t),e=i);let s=[],a={},l=[];for(let c in e){if(!Object.prototype.hasOwnProperty.call(e,c))continue;if("unknownProperty"===c||"_super"===c)continue;let r,i=e[c],o=i.scope||"model";"controller"===o&&(r=[]);let u=i.as||this.serializeQueryParamKey(c),h=get$7(n,c);h=copyDefaultValue(h);let d=i.type||typeOf$1(h),p=this.serializeQueryParam(h,u,d),f=`${t}:${c}`,g={undecoratedDefaultValue:get$7(n,c),defaultValue:h,serializedDefaultValue:p,serializedValue:p,type:d,urlKey:u,prop:c,scopedPropertyName:f,controllerName:t,route:this,parts:r,values:null,scope:o};a[c]=a[u]=a[f]=g,s.push(g),l.push(c)}return{qps:s,map:a,propertyNames:l,states:{inactive:(e,t)=>{let r=a[e];this._qpChanged(e,t,r)},active:(e,t)=>{let r=a[e];return this._qpChanged(e,t,r),this._activeQPChanged(r,t)},allowOverrides:(e,t)=>{let r=a[e];return this._qpChanged(e,t,r),this._updatingQPChanged(r)}}}}static{decorateMethodV2$1(this.prototype,"_qp",[computed])}};function getRenderState(e){return e[RENDER_STATE]}function buildRenderState(e){let t,r=getOwner$2(e),n=e.routeName,i=r.lookup(`controller:${e.controllerName||n}`),o=e.currentModel,s=r.lookup(`template:${e.templateName||n}`);return t=s?hasInternalComponentManager(s)?s:s(r):e._topLevelViewTemplate(r),{owner:r,name:n,controller:i,model:o,template:t}}function getFullQueryParams(e,t){if(t.fullQueryParams)return t.fullQueryParams;let r=t.routeInfos.every(e=>e.route),n={...t.queryParams};return e._deserializeQueryParams(t.routeInfos,n),r&&(t.fullQueryParams=n),n}function getQueryParamsFor(e,t){t.queryParamsFor=t.queryParamsFor||{};let r=e.fullRouteName,n=t.queryParamsFor[r];if(n)return n;let i=getFullQueryParams(e._router,t),o=t.queryParamsFor[r]={},s=get$7(e,"_qp").qps;for(let a of s){let e=a.prop in i;o[a.prop]=e?i[a.prop]:copyDefaultValue(a.defaultValue)}return o}function copyDefaultValue(e){return Array.isArray(e)?A$1(e.slice()):e}function mergeEachQueryParams(e,t){let r={},n={defaultValue:!0,type:!0,scope:!0,as:!0};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]={...e[i],...t[i]},n[i]=!0);for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&!n[i]&&(r[i]={...t[i],...e[i]});return r}function addQueryParamsObservers(e,t){t.forEach(t=>{if(void 0===descriptorForProperty(e,t)){let r=lookupDescriptor(e,t);null===r||"function"!=typeof r.get&&"function"!=typeof r.set||defineProperty(e,t,dependentKeyCompat({get:r.get,set:r.set}))}addObserver(e,`${t}.[]`,e,e._qpChanged,!1)})}function getEngineRouteName(e,t){if(e.routable){let r=e.mountPoint;return"application"===t?r:`${r}.${t}`}return t}var defaultSerialize=Route.prototype.serialize;function hasDefaultSerialize(e){return e.serialize===defaultSerialize}Route.reopen({mergedProperties:["queryParams"],queryParams:{},templateName:null,controllerName:null,send(...e){if(this._router&&this._router._routerMicrolib||!isTesting())this._router.send(...e);else{let t=e.shift(),r=this.actions[t];if(r)return r.apply(this,e)}},actions:{queryParamsDidChange(e,t,r){let n=get$7(this,"_qp").map,i=Object.keys(e).concat(Object.keys(r));for(let o of i){let e=n[o];if(e&&get$7(this._optionsForQueryParam(e),"refreshModel")&&this._router.currentState){this.refresh();break}}return!0},finalizeQueryParamChange(e,t,r){if("application"!==this.fullRouteName)return!0;if(!r)return;let n,i=r[STATE_SYMBOL].routeInfos,o=this._router,s=o._queryParamsFor(i),a=o._qpUpdates,l=!1;stashParamNames(o,i);for(let c of s.qps){let i,o,s=c.route,u=s.controller,h=c.urlKey in e&&c.urlKey;if(a.has(c.urlKey)?(i=get$7(u,c.prop),o=s.serializeQueryParam(i,c.urlKey,c.type)):h?(o=e[h],void 0!==o&&(i=s.deserializeQueryParam(o,c.urlKey,c.type))):(o=c.serializedDefaultValue,i=copyDefaultValue(c.defaultValue)),u._qpDelegate=get$7(s,"_qp").states.inactive,o!==c.serializedValue){if(r.queryParamsOnly&&!1!==n){let e=get$7(s._optionsForQueryParam(c),"replace");e?n=!0:!1===e&&(n=!1)}set$1(u,c.prop,i),l=!0}c.serializedValue=o,c.serializedDefaultValue!==o&&t.push({value:o,visible:!0,key:h||c.urlKey})}!0===l&&flushAsyncObservers(!1),n&&r.method("replace"),s.qps.forEach(e=>{let t=get$7(e.route,"_qp");e.route.controller._qpDelegate=get$7(t,"states.active")}),o._qpUpdates.clear()}}});var uuid=0;function isCallback$1(e){return"function"==typeof e}var DSLImpl=class e{parent;matches;enableLoadingSubstates;explicitIndex=!1;options;constructor(e=null,t){this.parent=e,this.enableLoadingSubstates=Boolean(t&&t.enableLoadingSubstates),this.matches=[],this.options=t}route(t,r,n){let i,o=null,s=`/_unused_dummy_error_path_route_${t}/:error`;if(isCallback$1(r)?(i={},o=r):isCallback$1(n)?(i=r,o=n):i=r||{},this.enableLoadingSubstates&&(createRoute(this,`${t}_loading`,{resetNamespace:i.resetNamespace}),createRoute(this,`${t}_error`,{resetNamespace:i.resetNamespace,path:s})),o){let r=getFullName(this,t,i.resetNamespace),n=new e(r,this.options);createRoute(n,"loading"),createRoute(n,"error",{path:s}),o.call(n),createRoute(this,t,i,n.generate())}else createRoute(this,t,i)}push(e,t,r,n){let i=t.split(".");if(this.options.engineInfo){let e=t.slice(this.options.engineInfo.fullName.length+1),r=Object.assign({localFullName:e},this.options.engineInfo);n&&(r.serializeMethod=n),this.options.addRouteForEngine(t,r)}else if(n)throw new Error(`Defining a route serializer on route '${t}' outside an Engine is not allowed.`);""!==e&&"/"!==e&&"index"!==i[i.length-1]||(this.explicitIndex=!0),this.matches.push(e,t,r)}generate(){let e=this.matches;return this.explicitIndex||this.route("index",{path:"/"}),t=>{for(let r=0;r<e.length;r+=3)t(e[r]).to(e[r+1],e[r+2])}}mount(t,r={}){let n=this.options.resolveRouteMap(t),i=t;r.as&&(i=r.as);let o,s=getFullName(this,i,r.resetNamespace),a={name:t,instanceId:uuid++,mountPoint:s,fullName:s},l=r.path;"string"!=typeof l&&(l=`/${i}`);let c=`/_unused_dummy_error_path_route_${i}/:error`;if(n){let t=!1,r=this.options.engineInfo;r&&(t=!0,this.options.engineInfo=a);let i=Object.assign({engineInfo:a},this.options),l=new e(s,i);createRoute(l,"loading"),createRoute(l,"error",{path:c}),n.class.call(l),o=l.generate(),t&&(this.options.engineInfo=r)}let u=Object.assign({localFullName:"application"},a);if(this.enableLoadingSubstates){let e=`${i}_loading`,t="application_loading",n=Object.assign({localFullName:t},a);createRoute(this,e,{resetNamespace:r.resetNamespace}),this.options.addRouteForEngine(e,n),e=`${i}_error`,t="application_error",n=Object.assign({localFullName:t},a),createRoute(this,e,{resetNamespace:r.resetNamespace,path:c}),this.options.addRouteForEngine(e,n)}this.options.addRouteForEngine(s,u),this.push(l,s,o)}};function canNest(e){return"application"!==e.parent}function getFullName(e,t,r){return canNest(e)&&!0!==r?`${e.parent}.${t}`:t}function createRoute(e,t,r={},n){let i=getFullName(e,t,r.resetNamespace);"string"!=typeof r.path&&(r.path=`/${t}`),e.push(r.path,i,n,r.serialize)}var RouterState=class{router;emberRouter;routerJsState;constructor(e,t,r){this.emberRouter=e,this.router=t,this.routerJsState=r}isActiveIntent(e,t,r){let n=this.routerJsState;if(!this.router.isActiveIntent(e,t,void 0,n))return!1;if(void 0!==r&&Object.keys(r).length>0){let i=Object.assign({},r);return this.emberRouter._prepareQueryParams(e,t,i),shallowEqual(i,n.queryParams)}return!0}},ROUTE_INFOS=new WeakMap;function toReadOnlyRouteInfo(e,t={},r={includeAttributes:!1,localizeMapUpdates:!1}){const n=new WeakMap;return e.map((i,o)=>{let{name:s,params:a,paramNames:l,context:c,route:u}=i,h=i;if(ROUTE_INFOS.has(h)&&r.includeAttributes){let e=ROUTE_INFOS.get(h);e=attachMetadata(u,e);let t=createRouteInfoWithAttributes(e,c);return n.set(h,e),r.localizeMapUpdates||ROUTE_INFOS.set(h,t),t}const d=r.localizeMapUpdates?n:ROUTE_INFOS;let p={find(t,r){let n,i=[];3===t.length&&(i=e.map(e=>d.get(e)));for(let o=0;e.length>o;o++)if(n=d.get(e[o]),t.call(r,n,o,i))return n},get name(){return s},get paramNames(){return l},get metadata(){return buildRouteInfoMetadata(i.route)},get parent(){let t=e[o-1];return void 0===t?null:d.get(t)},get child(){let t=e[o+1];return void 0===t?null:d.get(t)},get localName(){let e=this.name.split(".");return e[e.length-1]},get params(){return a},get queryParams(){return t}};return r.includeAttributes&&(p=createRouteInfoWithAttributes(p,c)),n.set(i,p),r.localizeMapUpdates||ROUTE_INFOS.set(i,p),p})}function createRouteInfoWithAttributes(e,t){let r={get attributes(){return t}};return!Object.isExtensible(e)||e.hasOwnProperty("attributes")?Object.freeze(Object.assign({},e,r)):Object.assign(e,r)}function buildRouteInfoMetadata(e){return null!=e&&void 0!==e.buildRouteInfoMetadata?e.buildRouteInfoMetadata():null}function attachMetadata(e,t){let r={get metadata(){return buildRouteInfoMetadata(e)}};return!Object.isExtensible(t)||t.hasOwnProperty("metadata")?Object.freeze(Object.assign({},t,r)):Object.assign(t,r)}var InternalRouteInfo=class{_routePromise=void 0;_route=null;router;params={};isResolved=!1;constructor(e,t,r,n){this.name=t,this.paramNames=r,this.router=e,n&&this._processRoute(n)}getModel(e){return Promise$1.resolve(this.context)}serialize(e){return this.params||{}}resolve(e){return Promise$1.resolve(this.routePromise).then(t=>(throwIfAborted(e),t)).then(()=>this.runBeforeModelHook(e)).then(()=>throwIfAborted(e)).then(()=>this.getModel(e)).then(t=>(throwIfAborted(e),t)).then(t=>this.runAfterModelHook(e,t)).then(t=>this.becomeResolved(e,t))}becomeResolved(e,t){let r,n=this.serialize(t);e&&(this.stashResolvedModel(e,t),e[PARAMS_SYMBOL]=e[PARAMS_SYMBOL]||{},e[PARAMS_SYMBOL][this.name]=n);let i=t===this.context;!("context"in this)&&i||(r=t);let o=ROUTE_INFOS.get(this),s=new ResolvedRouteInfo(this.router,this.name,this.paramNames,n,this.route,r);return void 0!==o&&ROUTE_INFOS.set(s,o),s}shouldSupersede(e){if(!e)return!0;let t=e.context===this.context;return e.name!==this.name||"context"in this&&!t||this.hasOwnProperty("params")&&!paramsMatch(this.params,e.params)}get route(){return null!==this._route?this._route:this.fetchRoute()}set route(e){this._route=e}get routePromise(){return this._routePromise||this.fetchRoute(),this._routePromise}set routePromise(e){this._routePromise=e}log(e,t){e.log&&e.log(this.name+": "+t)}updateRoute(e){return e._internalName=this.name,this.route=e}runBeforeModelHook(e){let t;return e.trigger&&e.trigger(!0,"willResolveModel",e,this.route),this.route&&void 0!==this.route.beforeModel&&(t=this.route.beforeModel(e)),isTransition(t)&&(t=null),Promise$1.resolve(t)}runAfterModelHook(e,t){let r,n=this.name;return this.stashResolvedModel(e,t),void 0!==this.route&&void 0!==this.route.afterModel&&(r=this.route.afterModel(t,e)),r=prepareResult(r),Promise$1.resolve(r).then(()=>e.resolvedModels[n])}stashResolvedModel(e,t){e.resolvedModels=e.resolvedModels||{},e.resolvedModels[this.name]=t}fetchRoute(){let e=this.router.getRoute(this.name);return this._processRoute(e)}_processRoute(e){return this.routePromise=Promise$1.resolve(e),isPromise$1(e)?(this.routePromise=this.routePromise.then(e=>this.updateRoute(e)),void(this.route=void 0)):e?this.updateRoute(e):void 0}},ResolvedRouteInfo=class extends InternalRouteInfo{isResolved;context;constructor(e,t,r,n,i,o){super(e,t,r,i),this.params=n,this.isResolved=!0,this.context=o}resolve(e){return e&&e.resolvedModels&&(e.resolvedModels[this.name]=this.context),Promise$1.resolve(this)}},UnresolvedRouteInfoByParam=class extends InternalRouteInfo{params={};constructor(e,t,r,n,i){super(e,t,r,i),n&&(this.params=n)}getModel(e){let t=this.params;e&&e[QUERY_PARAMS_SYMBOL]&&(t={},merge$2(t,this.params),t.queryParams=e[QUERY_PARAMS_SYMBOL]);let r,n=this.route;return n.deserialize?r=n.deserialize(t,e):n.model&&(r=n.model(t,e)),r&&isTransition(r)&&(r=void 0),Promise$1.resolve(r)}},UnresolvedRouteInfoByObject=class extends InternalRouteInfo{serializer;constructor(e,t,r,n){super(e,t,r),this.context=n,this.serializer=this.router.getSerializer(t)}getModel(e){return void 0!==this.router.log&&this.router.log(this.name+": resolving provided model"),super.getModel(e)}serialize(e){let{paramNames:t,context:r}=this;e||(e=r);let n={};if(isParam(e))return n[t[0]]=e,n;if(this.serializer)return this.serializer.call(null,e,t);if(void 0!==this.route&&this.route.serialize)return this.route.serialize(e,t);if(1!==t.length)return;let i=t[0];return/_id$/.test(i)?n[i]=e.id:n[i]=e,n}};function paramsMatch(e,t){if(e===t)return!0;if(!e||!t)return!1;for(let r in e)if(e.hasOwnProperty(r)&&e[r]!==t[r])return!1;return!0}var TransitionIntent=class{data;router;constructor(e,t={}){this.router=e,this.data=t}preTransitionState};function handleError(e,t,r){let n=e.routeInfos,i=t.resolveIndex>=n.length?n.length-1:t.resolveIndex,o=t.isAborted;throw new TransitionError(r,e.routeInfos[i].route,o,e)}function resolveOneRouteInfo(e,t){if(t.resolveIndex===e.routeInfos.length)return;let r=e.routeInfos[t.resolveIndex],n=proceed.bind(null,e,t);return r.resolve(t).then(n,null,e.promiseLabel("Proceed"))}function proceed(e,t,r){let n=e.routeInfos[t.resolveIndex].isResolved;if(e.routeInfos[t.resolveIndex++]=r,!n){let{route:e}=r;void 0!==e&&e.redirect&&e.redirect(r.context,t)}return throwIfAborted(t),resolveOneRouteInfo(e,t)}var TransitionState=class{routeInfos=[];queryParams={};params={};promiseLabel(e){let t="";return forEach$1(this.routeInfos,function(e){return""!==t&&(t+="."),t+=e.name,!0}),promiseLabel("'"+t+"': "+e)}resolve(e){let t=this.params;forEach$1(this.routeInfos,e=>(t[e.name]=e.params||{},!0)),e.resolveIndex=0;let r=resolveOneRouteInfo.bind(null,this,e),n=handleError.bind(null,this,e);return Promise$1.resolve(null,this.promiseLabel("Start transition")).then(r,null,this.promiseLabel("Resolve route")).catch(n,this.promiseLabel("Handle error")).then(()=>this)}},TransitionError=class{constructor(e,t,r,n){this.error=e,this.route=t,this.wasAborted=r,this.state=n}},NamedTransitionIntent=class extends TransitionIntent{name;pivotHandler;contexts;queryParams;preTransitionState=void 0;constructor(e,t,r,n=[],i={},o){super(e,o),this.name=t,this.pivotHandler=r,this.contexts=n,this.queryParams=i}applyToState(e,t){let r=this.router.recognizer.handlersFor(this.name),n=r[r.length-1].handler;return this.applyToHandlers(e,r,n,t,!1)}applyToHandlers(e,t,r,n,i){let o,s,a=new TransitionState,l=this.contexts.slice(0),c=t.length;if(this.pivotHandler)for(o=0,s=t.length;o<s;++o)if(t[o].handler===this.pivotHandler._internalName){c=o;break}for(o=t.length-1;o>=0;--o){let s=t[o],u=s.handler,h=e.routeInfos[o],d=null;if(d=s.names.length>0?o>=c?this.createParamHandlerInfo(u,s.names,l,h):this.getHandlerInfoForDynamicSegment(u,s.names,l,h,r,o):this.createParamHandlerInfo(u,s.names,l,h),i){d=d.becomeResolved(null,d.context);let e=h&&h.context;s.names.length>0&&void 0!==h.context&&d.context===e&&(d.params=h&&h.params),d.context=e}let p=h;(o>=c||d.shouldSupersede(h))&&(c=Math.min(o,c),p=d),n&&!i&&(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: "+r);return n||this.invalidateChildren(a.routeInfos,c),merge$2(a.queryParams,this.queryParams||{}),n&&e.queryParams&&merge$2(a.queryParams,e.queryParams),a}invalidateChildren(e,t){for(let r=t,n=e.length;r<n;++r)if(e[r].isResolved){let{name:t,params:n,route:i,paramNames:o}=e[r];e[r]=new UnresolvedRouteInfoByParam(this.router,t,o,n,i)}}getHandlerInfoForDynamicSegment(e,t,r,n,i,o){let s;if(r.length>0){if(s=r[r.length-1],isParam(s))return this.createParamHandlerInfo(e,t,r,n);r.pop()}else{if(n&&n.name===e)return n;if(!this.preTransitionState)return n;s=this.preTransitionState.routeInfos[o]?.context}return new UnresolvedRouteInfoByObject(this.router,e,t,s)}createParamHandlerInfo(e,t,r,n){let i={},o=t.length,s=[];for(;o--;){let a=n&&e===n.name&&n.params||{},l=r[r.length-1],c=t[o];isParam(l)?i[c]=String(r.pop()):a.hasOwnProperty(c)?i[c]=a[c]:s.push(c)}if(s.length>0)throw new Error(`You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route ${e}. Missing params: ${s}`);return new UnresolvedRouteInfoByParam(this.router,e,t,i)}},URLTransitionIntent=class extends TransitionIntent{preTransitionState;url;constructor(e,t,r){super(e,r),this.url=t,this.preTransitionState=void 0}applyToState(e){let t,r,n=new TransitionState,i=this.router.recognizer.recognize(this.url);if(!i)throw new UnrecognizedURLError(this.url);let o=!1,s=this.url;function a(e){if(e&&e.inaccessibleByURL)throw new UnrecognizedURLError(s);return e}for(t=0,r=i.length;t<r;++t){let r=i[t],s=r.handler,l=[];this.router.recognizer.hasRoute(s)&&(l=this.router.recognizer.handlersFor(s)[t].names);let c=new UnresolvedRouteInfoByParam(this.router,s,l,r.params),u=c.route;u?a(u):c.routePromise=c.routePromise.then(a);let h=e.routeInfos[t];o||c.shouldSupersede(h)?(o=!0,n.routeInfos[t]=c):n.routeInfos[t]=h}return merge$2(n.queryParams,i.queryParams),n}},Router$2=class{_lastQueryParams={};log;state=void 0;oldState=void 0;activeTransition=void 0;currentRouteInfos=void 0;_changedQueryParams=void 0;currentSequence=0;recognizer;constructor(e){this.log=e,this.recognizer=new RouteRecognizer,this.reset()}map(e){this.recognizer.map(e,function(e,t){for(let r=t.length-1,n=!0;r>=0&&n;--r){let i=t[r],o=i.handler;e.add(t,{as:o}),n="/"===i.path||""===i.path||".index"===o.slice(-6)}})}hasRoute(e){return this.recognizer.hasRoute(e)}queryParamsTransition(e,t,r,n){if(this.fireQueryParamDidChange(n,e),!t&&this.activeTransition)return this.activeTransition;{let e=new Transition(this,void 0,void 0);return e.queryParamsOnly=!0,r.queryParams=this.finalizeQueryParamChange(n.routeInfos,n.queryParams,e),e[QUERY_PARAMS_SYMBOL]=n.queryParams,this.toReadOnlyInfos(e,n),this.routeWillChange(e),e.promise=e.promise.then(t=>(e.isAborted||(this._updateURL(e,r),this.didTransition(this.currentRouteInfos),this.toInfos(e,n.routeInfos,!0),this.routeDidChange(e)),t),null,promiseLabel("Transition complete")),e}}transitionByIntent(e,t){try{return this.getTransitionByIntent(e,t)}catch(r){return new Transition(this,e,void 0,r,void 0)}}recognize(e){let t=new URLTransitionIntent(this,e),r=this.generateNewState(t);if(null===r)return r;let n=toReadOnlyRouteInfo(r.routeInfos,r.queryParams,{includeAttributes:!1,localizeMapUpdates:!0});return n[n.length-1]}recognizeAndLoad(e){let t=new URLTransitionIntent(this,e),r=this.generateNewState(t);if(null===r)return Promise$1.reject(`URL ${e} was not recognized`);let n=new Transition(this,t,r,void 0);return n.then(()=>{let e=toReadOnlyRouteInfo(r.routeInfos,n[QUERY_PARAMS_SYMBOL],{includeAttributes:!0,localizeMapUpdates:!1});return e[e.length-1]})}generateNewState(e){try{return e.applyToState(this.state,!1)}catch(t){return null}}getTransitionByIntent(e,t){let r,n=Boolean(this.activeTransition),i=n?this.activeTransition[STATE_SYMBOL]:this.state,o=e.applyToState(i,t),s=getChangelist(i.queryParams,o.queryParams);if(routeInfosEqual(o.routeInfos,i.routeInfos)){if(s){let e=this.queryParamsTransition(s,n,i,o);return e.queryParamsOnly=!0,e}return this.activeTransition||new Transition(this,void 0,void 0)}if(t){let e=new Transition(this,void 0,o);return e.isIntermediate=!0,this.toReadOnlyInfos(e,o),this.setupContexts(o,e),this.routeWillChange(e),this.activeTransition}return r=new Transition(this,e,o,void 0,this.activeTransition),routeInfosSameExceptQueryParams(o.routeInfos,i.routeInfos)&&(r.queryParamsOnly=!0),this.toReadOnlyInfos(r,o),this.activeTransition&&this.activeTransition.redirect(r),this.activeTransition=r,r.promise=r.promise.then(e=>this.finalizeTransition(r,e),null,promiseLabel("Settle transition promise when transition is finalized")),n||this.notifyExistingHandlers(o,r),this.fireQueryParamDidChange(o,s),r}doTransition(e,t=[],r=!1){let n,i=t[t.length-1],o={};if(i&&Object.prototype.hasOwnProperty.call(i,"queryParams")&&(o=t.pop().queryParams),void 0===e){log$5(this,"Updating query params");let{routeInfos:e}=this.state;n=new NamedTransitionIntent(this,e[e.length-1].name,void 0,[],o)}else"/"===e.charAt(0)?(log$5(this,"Attempting URL transition to "+e),n=new URLTransitionIntent(this,e)):(log$5(this,"Attempting transition to "+e),n=new NamedTransitionIntent(this,e,void 0,t,o));return this.transitionByIntent(n,r)}finalizeTransition(e,t){try{log$5(e.router,e.sequence,"Resolved all models on destination route; finalizing transition.");let r=t.routeInfos;return this.setupContexts(t,e),e.isAborted?(this.state.routeInfos=this.currentRouteInfos,Promise$1.reject(logAbort(e))):(this._updateURL(e,t),e.isActive=!1,this.activeTransition=void 0,this.triggerEvent(this.currentRouteInfos,!0,"didTransition",[]),this.didTransition(this.currentRouteInfos),this.toInfos(e,t.routeInfos,!0),this.routeDidChange(e),log$5(this,e.sequence,"TRANSITION COMPLETE."),r[r.length-1].route)}catch(r){if(!isTransitionAborted(r)){let t=e[STATE_SYMBOL].routeInfos;e.trigger(!0,"error",r,e,t[t.length-1].route),e.abort()}throw r}}setupContexts(e,t){let r,n,i,o=this.partitionRoutes(this.state,e);for(r=0,n=o.exited.length;r<n;r++)i=o.exited[r].route,delete i.context,void 0!==i&&(void 0!==i._internalReset&&i._internalReset(!0,t),void 0!==i.exit&&i.exit(t));let s=this.oldState=this.state;this.state=e;let a=this.currentRouteInfos=o.unchanged.slice();try{for(r=0,n=o.reset.length;r<n;r++)i=o.reset[r].route,void 0!==i&&void 0!==i._internalReset&&i._internalReset(!1,t);for(r=0,n=o.updatedContext.length;r<n;r++)this.routeEnteredOrUpdated(a,o.updatedContext[r],!1,t);for(r=0,n=o.entered.length;r<n;r++)this.routeEnteredOrUpdated(a,o.entered[r],!0,t)}catch(l){throw this.state=s,this.currentRouteInfos=s.routeInfos,l}this.state.queryParams=this.finalizeQueryParamChange(a,e.queryParams,t)}fireQueryParamDidChange(e,t){t&&(this._changedQueryParams=t.all,this.triggerEvent(e.routeInfos,!0,"queryParamsDidChange",[t.changed,t.all,t.removed]),this._changedQueryParams=void 0)}routeEnteredOrUpdated(e,t,r,n){let i=t.route,o=t.context;function s(i){return r&&void 0!==i.enter&&i.enter(n),throwIfAborted(n),i.context=o,void 0!==i.contextDidChange&&i.contextDidChange(),void 0!==i.setup&&i.setup(o,n),throwIfAborted(n),e.push(t),i}return void 0===i?t.routePromise=t.routePromise.then(s):s(i),!0}partitionRoutes(e,t){let r,n,i,o=e.routeInfos,s=t.routeInfos,a={updatedContext:[],exited:[],entered:[],unchanged:[],reset:[]},l=!1;for(n=0,i=s.length;n<i;n++){let e=o[n],t=s[n];e&&e.route===t.route||(r=!0),r?(a.entered.push(t),e&&a.exited.unshift(e)):l||e.context!==t.context?(l=!0,a.updatedContext.push(t)):a.unchanged.push(e)}for(n=s.length,i=o.length;n<i;n++)a.exited.unshift(o[n]);return a.reset=a.updatedContext.slice(),a.reset.reverse(),a}_updateURL(e,t){let r=e.urlMethod;if(!r)return;let{routeInfos:n}=t,{name:i}=n[n.length-1],o={};for(let s=n.length-1;s>=0;--s){let e=n[s];merge$2(o,e.params),e.route.inaccessibleByURL&&(r=null)}if(r){o.queryParams=e._visibleQueryParams||t.queryParams;let n=this.recognizer.generate(i,o),s=e.isCausedByInitialTransition,a="replace"===r&&!e.isCausedByAbortingTransition,l=e.queryParamsOnly&&"replace"===r,c="replace"===r&&e.isCausedByAbortingReplaceTransition;s||a||l||c?this.replaceURL(n):this.updateURL(n)}}finalizeQueryParamChange(e,t,r){for(let o in t)t.hasOwnProperty(o)&&null===t[o]&&delete t[o];let n=[];this.triggerEvent(e,!0,"finalizeQueryParamChange",[t,n,r]),r&&(r._visibleQueryParams={});let i={};for(let o=0,s=n.length;o<s;++o){let e=n[o];i[e.key]=e.value,r&&!1!==e.visible&&(r._visibleQueryParams[e.key]=e.value)}return i}toReadOnlyInfos(e,t){let r=this.state.routeInfos;this.fromInfos(e,r),this.toInfos(e,t.routeInfos),this._lastQueryParams=t.queryParams}fromInfos(e,t){if(void 0!==e&&t.length>0){let r=toReadOnlyRouteInfo(t,Object.assign({},this._lastQueryParams),{includeAttributes:!0,localizeMapUpdates:!1});e.from=r[r.length-1]||null}}toInfos(e,t,r=!1){if(void 0!==e&&t.length>0){let n=toReadOnlyRouteInfo(t,Object.assign({},e[QUERY_PARAMS_SYMBOL]),{includeAttributes:r,localizeMapUpdates:!1});e.to=n[n.length-1]||null}}notifyExistingHandlers(e,t){let r,n,i,o,s=this.state.routeInfos;for(n=s.length,r=0;r<n&&(i=s[r],o=e.routeInfos[r],o&&i.name===o.name);r++)o.isResolved;this.triggerEvent(s,!0,"willTransition",[t]),this.routeWillChange(t),this.willTransition(s,e.routeInfos,t)}reset(){this.state&&forEach$1(this.state.routeInfos.slice().reverse(),function(e){let t=e.route;return void 0!==t&&void 0!==t.exit&&t.exit(),!0}),this.oldState=void 0,this.state=new TransitionState,this.currentRouteInfos=void 0}handleURL(e){return"/"!==e.charAt(0)&&(e="/"+e),this.doTransition(e).method(null)}transitionTo(e,...t){return"object"==typeof e?(t.push(e),this.doTransition(void 0,t,!1)):this.doTransition(e,t)}intermediateTransitionTo(e,...t){return this.doTransition(e,t,!0)}refresh(e){let t=this.activeTransition,r=t?t[STATE_SYMBOL]:this.state,n=r.routeInfos;void 0===e&&(e=n[0].route),log$5(this,"Starting a refresh transition");let i=n[n.length-1].name,o=new NamedTransitionIntent(this,i,e,[],this._changedQueryParams||r.queryParams),s=this.transitionByIntent(o,!1);return t&&"replace"===t.urlMethod&&s.method(t.urlMethod),s}replaceWith(e){return this.doTransition(e).method("replace")}generate(e,...t){let r=extractQueryParams(t),n=r[0],i=r[1],o=new NamedTransitionIntent(this,e,void 0,n).applyToState(this.state,!1),s={};for(let a=0,l=o.routeInfos.length;a<l;++a)merge$2(s,o.routeInfos[a].serialize());return s.queryParams=i,this.recognizer.generate(e,s)}applyIntent(e,t){let r=new NamedTransitionIntent(this,e,void 0,t),n=this.activeTransition&&this.activeTransition[STATE_SYMBOL]||this.state;return r.applyToState(n,!1)}isActiveIntent(e,t,r,n){let i,o,s=n||this.state,a=s.routeInfos;if(!a.length)return!1;let l=a[a.length-1].name,c=this.recognizer.handlersFor(l),u=0;for(o=c.length;u<o&&(i=a[u],i.name!==e);++u);if(u===c.length)return!1;let h=new TransitionState;h.routeInfos=a.slice(0,u+1),c=c.slice(0,u+1);let d=routeInfosEqual(new NamedTransitionIntent(this,l,void 0,t).applyToHandlers(h,c,l,!0,!0).routeInfos,h.routeInfos);if(!r||!d)return d;let p={};merge$2(p,r);let f=s.queryParams;for(let g in f)f.hasOwnProperty(g)&&p.hasOwnProperty(g)&&(p[g]=f[g]);return d&&!getChangelist(p,r)}isActive(e,...t){let[r,n]=extractQueryParams(t);return this.isActiveIntent(e,r,n)}trigger(e,...t){this.triggerEvent(this.currentRouteInfos,!1,e,t)}};function routeInfosEqual(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;++r)if(e[r]!==t[r])return!1;return!0}function routeInfosSameExceptQueryParams(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;++r){if(e[r].name!==t[r].name)return!1;if(!paramsEqual(e[r].params,t[r].params))return!1}return!0}function paramsEqual(e,t){if(e===t)return!0;if(!e||!t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i=0,o=r.length;i<o;++i){let n=r[i];if(e[n]!==t[n])return!1}return!0}function defaultDidTransition(){updatePaths(this),this._cancelSlowTransitionTimer(),this.notifyPropertyChange("url"),this.set("currentState",this.targetState)}function defaultWillTransition(){}function K(){return this}var{slice:slice}=Array.prototype,EmberRouter=class extends(EmberObject.extend(Evented)){_routerMicrolib;_didSetupRouter=!1;_initialTransitionStarted=!1;currentURL=null;currentRouteName=null;currentPath=null;currentRoute=null;_qpCache=Object.create(null);_qpUpdates=new Set;_queuedQPChanges={};_bucketCache;_toplevelView=null;_handledErrors=new Set;_engineInstances=Object.create(null);_engineInfoByRoute=Object.create(null);_routerService;_slowTransitionTimer=null;namespace;static dslCallbacks;static map(e){return this.dslCallbacks||(this.dslCallbacks=[],this.reopenClass({dslCallbacks:this.dslCallbacks})),this.dslCallbacks.push(e),this}static _routePath(e){let t,r,n,i=[];function o(e,t){for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}for(let s=1;s<e.length;s++){for(t=e[s].name,r=t.split("."),n=slice.call(i);n.length&&!o(n,r);)n.shift();i.push(...r.slice(n.length))}return i.join(".")}constructor(e){super(e),this._resetQueuedQueryParameterChanges(),this.namespace=e.lookup("application:main");let t=e.lookup(privatize`-bucket-cache:main`);this._bucketCache=t;let r=e.lookup("service:router");this._routerService=r}_initRouterJs(){let e=get$7(this,"location"),t=this;const r=getOwner$1(this);let n=Object.create(null),i=this._routerMicrolib=new class extends Router$2{getRoute(e){let i=e,o=r,s=t._engineInfoByRoute[i];s&&(o=t._getEngineInstance(s),i=s.localFullName);let a=`route:${i}`,l=o.lookup(a);if(n[e])return l;if(n[e]=!0,!l){let e=o.factoryFor("route:basic").class;o.register(a,class extends e{}),l=o.lookup(a)}if(l._setRouteName(i),s&&!hasDefaultSerialize(l))throw new Error("Defining a custom serialize method on an Engine route is not supported.");return l}getSerializer(e){let r=t._engineInfoByRoute[e];if(r)return r.serializeMethod||defaultSerialize}updateURL(r){once(()=>{e.setURL(r),set$1(t,"currentURL",r)})}didTransition(e){t.didTransition(e)}willTransition(e,r){t.willTransition(e,r)}triggerEvent(e,r,n,i){return triggerEvent.bind(t)(e,r,n,i)}routeWillChange(e){t.trigger("routeWillChange",e),t._routerService.trigger("routeWillChange",e),e.isIntermediate&&t.set("currentRoute",e.to)}routeDidChange(e){t.set("currentRoute",e.to),once(()=>{t.trigger("routeDidChange",e),t._routerService.trigger("routeDidChange",e)})}transitionDidError(e,r){return e.wasAborted||r.isAborted?logAbort(r):(r.trigger(!1,"error",e.error,r,e.route),t._isErrorHandled(e.error)?(r.rollback(),this.routeDidChange(r),e.error):(r.abort(),e.error))}replaceURL(r){e.replaceURL?once(()=>{e.replaceURL(r),set$1(t,"currentURL",r)}):this.updateURL(r)}},o=this.constructor.dslCallbacks||[K],s=this._buildDSL();s.route("application",{path:"/",resetNamespace:!0,overrideNameAssertion:!0},function(){for(let e=0;e<o.length;e++)o[e].call(this)}),i.map(s.generate())}_buildDSL(){let e=this._hasModuleBasedResolver(),t=this;const r=getOwner$1(this);return new DSLImpl(null,{enableLoadingSubstates:e,resolveRouteMap:e=>r.factoryFor(`route-map:${e}`),addRouteForEngine(e,r){t._engineInfoByRoute[e]||(t._engineInfoByRoute[e]=r)}})}_resetQueuedQueryParameterChanges(){this._queuedQPChanges={}}_hasModuleBasedResolver(){let e=get$7(getOwner$1(this),"application.__registry__.resolver.moduleBasedResolver");return Boolean(e)}startRouting(){if(this.setupRouter()){let e=get$7(this,"initialURL");void 0===e&&(e=get$7(this,"location").getURL());let t=this.handleURL(e);if(t&&t.error)throw t.error}}setupRouter(){if(this._didSetupRouter)return!1;this._didSetupRouter=!0,this._setupLocation();let e=get$7(this,"location");return!get$7(e,"cancelRouterSetup")&&(this._initRouterJs(),e.onUpdateURL(e=>{this.handleURL(e)}),!0)}_setOutlets(){if(this.isDestroying||this.isDestroyed)return;let e=this._routerMicrolib.currentRouteInfos;if(!e)return;let t=null,r=null;for(let n of e){let e=getRenderState(n.route);if(!e)break;{let n={render:e,outlets:{main:void 0}};r?r.outlets.main=n:t=n,r=n}}if(null!==t)if(this._toplevelView)this._toplevelView.setOutletState(t);else{let e=getOwner$1(this),r=e.factoryFor("view:-outlet"),n=e.lookup("application:main"),i=e.lookup("-environment:main"),o=e.lookup("template:-outlet");this._toplevelView=r.create({environment:i,template:o,application:n}),this._toplevelView.setOutletState(t),e.lookup("-application-instance:main").didCreateRootView(this._toplevelView)}}handleURL(e){let t=e.split(/#(.+)?/)[0];return this._doURLTransition("handleURL",t)}_doURLTransition(e,t){this._initialTransitionStarted=!0;let r=this._routerMicrolib[e](t||"/");return didBeginTransition(r,this),r}transitionTo(...e){if(resemblesURL(e[0]))return this._doURLTransition("transitionTo",e[0]);let{routeName:t,models:r,queryParams:n}=extractRouteArgs(e);return this._doTransition(t,r,n)}intermediateTransitionTo(e,...t){this._routerMicrolib.intermediateTransitionTo(e,...t),updatePaths(this)}replaceWith(...e){return this.transitionTo(...e).method("replace")}generate(e,...t){let r=this._routerMicrolib.generate(e,...t);return this.location.formatURL(r)}isActive(e){return this._routerMicrolib.isActive(e)}isActiveIntent(e,t,r){return this.currentState.isActiveIntent(e,t,r)}send(e,...t){this._routerMicrolib.trigger(e,...t)}hasRoute(e){return this._routerMicrolib.hasRoute(e)}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 e=this._engineInstances;for(let t in e){let r=e[t];for(let e in r)run(r[e],"destroy")}}_activeQPChanged(e,t){this._queuedQPChanges[e]=t,once(this,this._fireQueryParamTransition)}_updatingQPChanged(e){this._qpUpdates.add(e)}_fireQueryParamTransition(){this.transitionTo({queryParams:this._queuedQPChanges}),this._resetQueuedQueryParameterChanges()}_setupLocation(){let e=this.location,t=this.rootURL,r=getOwner$1(this);"string"==typeof e&&(e=set$1(this,"location",r.lookup(`location:${e}`))),null!==e&&"object"==typeof e&&(t&&set$1(e,"rootURL",t),"function"==typeof e.initState&&e.initState())}_serializeQueryParams(e,t){forEachQueryParam(this,e,t,(e,r,n)=>{if(n)delete t[e],t[n.urlKey]=n.route.serializeQueryParam(r,n.urlKey,n.type);else{if(void 0===r)return;t[e]=this._serializeQueryParam(r,typeOf$1(r))}})}_serializeQueryParam(e,t){return null==e?e:"array"===t?JSON.stringify(e):`${e}`}_deserializeQueryParams(e,t){forEachQueryParam(this,e,t,(e,r,n)=>{n&&(delete t[e],t[n.prop]=n.route.deserializeQueryParam(r,n.urlKey,n.type))})}_deserializeQueryParam(e,t){return null==e?e:"boolean"===t?"true"===e:"number"===t?Number(e).valueOf():"array"===t?A$1(JSON.parse(e)):e}_pruneDefaultQueryParamValues(e,t){let r=this._queryParamsFor(e);for(let n in t){let e=r.map[n];e&&e.serializedDefaultValue===t[n]&&delete t[n]}}_doTransition(e,t,r,n){let i=e||getActiveTargetName(this._routerMicrolib);this._initialTransitionStarted=!0;let o={};this._processActiveTransitionQueryParams(i,t,o,r),Object.assign(o,r),this._prepareQueryParams(i,t,o,Boolean(n));let s=this._routerMicrolib.transitionTo(i,...t,{queryParams:o});return didBeginTransition(s,this),s}_processActiveTransitionQueryParams(e,t,r,n){if(!this._routerMicrolib.activeTransition)return;let i={},o=this._qpUpdates,s=getFullQueryParams(this,this._routerMicrolib.activeTransition[STATE_SYMBOL]);for(let a in s)o.has(a)||(i[a]=s[a]);this._fullyScopeQueryParams(e,t,n),this._fullyScopeQueryParams(e,t,i),Object.assign(r,i)}_prepareQueryParams(e,t,r,n){let i=calculatePostTransitionState(this,e,t);this._hydrateUnsuppliedQueryParams(i,r,Boolean(n)),this._serializeQueryParams(i.routeInfos,r),n||this._pruneDefaultQueryParamValues(i.routeInfos,r)}_getQPMeta(e){let t=e.route;return t&&get$7(t,"_qp")}_queryParamsFor(e){let t=e[e.length-1].name,r=this._qpCache[t];if(void 0!==r)return r;let n,i=!0,o={},s=[];for(let l of e)if(n=this._getQPMeta(l),n){for(let e of n.qps)s.push(e);Object.assign(o,n.map)}else i=!1;let a={qps:s,map:o};return i&&(this._qpCache[t]=a),a}_fullyScopeQueryParams(e,t,r){let n,i=calculatePostTransitionState(this,e,t).routeInfos;for(let o of i)if(n=this._getQPMeta(o),n)for(let e of n.qps){let t=e.prop in r&&e.prop||e.scopedPropertyName in r&&e.scopedPropertyName||e.urlKey in r&&e.urlKey;t&&t!==e.scopedPropertyName&&(r[e.scopedPropertyName]=r[t],delete r[t])}}_hydrateUnsuppliedQueryParams(e,t,r){let n,i,o,s=e.routeInfos,a=this._bucketCache;for(let l of s)if(n=this._getQPMeta(l),n)for(let r=0,s=n.qps.length;r<s;++r)if(i=n.qps[r],o=i.prop in t&&i.prop||i.scopedPropertyName in t&&i.scopedPropertyName||i.urlKey in t&&i.urlKey,o)o!==i.scopedPropertyName&&(t[i.scopedPropertyName]=t[o],delete t[o]);else{let r=calculateCacheKey(i.route.fullRouteName,i.parts,e.params);t[i.scopedPropertyName]=a.lookup(r,i.prop,i.defaultValue)}}_scheduleLoadingEvent(e,t){this._cancelSlowTransitionTimer(),this._slowTransitionTimer=scheduleOnce("routerTransitions",this,this._handleSlowTransition,e,t)}currentState=null;targetState=null;_handleSlowTransition(e,t){if(!this._routerMicrolib.activeTransition)return;let r=new RouterState(this,this._routerMicrolib,this._routerMicrolib.activeTransition[STATE_SYMBOL]);this.set("targetState",r),e.trigger(!0,"loading",e,t)}_cancelSlowTransitionTimer(){this._slowTransitionTimer&&cancel(this._slowTransitionTimer),this._slowTransitionTimer=null}_markErrorAsHandled(e){this._handledErrors.add(e)}_isErrorHandled(e){return this._handledErrors.has(e)}_clearHandledError(e){this._handledErrors.delete(e)}_getEngineInstance({name:e,instanceId:t,mountPoint:r}){let n=this._engineInstances,i=n[e];i||(i=Object.create(null),n[e]=i);let o=i[t];return o||(o=getOwner$1(this).buildChildEngineInstance(e,{routable:!0,mountPoint:r}),o.boot(),i[t]=o),o}};function forEachRouteAbove(e,t){for(let r=e.length-1;r>=0;--r){let n=e[r],i=n.route;if(void 0!==i&&!0!==t(i,n))return}}var defaultActionHandlers={willResolveModel(e,t,r){this._scheduleLoadingEvent(t,r)},error(e,t,r){let n=this,i=e[e.length-1];forEachRouteAbove(e,(e,r)=>{if(r!==i){let r=findRouteStateName(e,"error");if(r)return n._markErrorAsHandled(t),n.intermediateTransitionTo(r,t),!1}let o=findRouteSubstateName(e,"error");return!o||(n._markErrorAsHandled(t),n.intermediateTransitionTo(o,t),!1)}),logError(t,`Error while processing route: ${r.targetName}`)},loading(e,t){let r=this,n=e[e.length-1];forEachRouteAbove(e,(e,i)=>{if(i!==n){let t=findRouteStateName(e,"loading");if(t)return r.intermediateTransitionTo(t),!1}let o=findRouteSubstateName(e,"loading");return o?(r.intermediateTransitionTo(o),!1):t.pivotHandler!==e})}};function logError(e,t){let r,n=[];r=e&&"object"==typeof e&&"object"==typeof e.errorThrown?e.errorThrown:e,t&&n.push(t),r&&(r.message&&n.push(r.message),r.stack&&n.push(r.stack),"string"==typeof r&&n.push(r)),console.error(...n)}function findRouteSubstateName(e,t){let r=getOwner$1(e),{routeName:n,fullRouteName:i,_router:o}=e,s=`${i}_${t}`;return routeHasBeenDefined(r,o,`${n}_${t}`,s)?s:""}function findRouteStateName(e,t){let r=getOwner$1(e),{routeName:n,fullRouteName:i,_router:o}=e,s="application"===i?t:`${i}.${t}`;return routeHasBeenDefined(r,o,"application"===n?t:`${n}.${t}`,s)?s:""}function routeHasBeenDefined(e,t,r,n){let i=t.hasRoute(n),o=e.factoryFor(`template:${r}`)||e.factoryFor(`route:${r}`);return i&&o}function triggerEvent(e,t,r,n){if(!e){if(t)return;throw new Error(`Can't trigger action '${r}' 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 i,o,s,a=!1;for(let c=e.length-1;c>=0;c--)if(i=e[c],o=i.route,s=o&&o.actions&&o.actions[r],s){if(!0!==s.apply(o,n))return void("error"===r&&o._router._markErrorAsHandled(n[0]));a=!0}let l=defaultActionHandlers[r];if(l)l.call(this,e,...n);else if(!a&&!t)throw new Error(`Nothing handled the action '${r}'. 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 calculatePostTransitionState(e,t,r){let n=e._routerMicrolib.applyIntent(t,r),{routeInfos:i,params:o}=n;for(let s of i)s.isResolved?o[s.name]=s.params:o[s.name]=s.serialize(s.context);return n}function updatePaths(e){let t=e._routerMicrolib.currentRouteInfos;if(0===t.length)return;let r=EmberRouter._routePath(t),n=t[t.length-1].name,i=e.location.getURL();set$1(e,"currentPath",r),set$1(e,"currentRouteName",n),set$1(e,"currentURL",i)}function didBeginTransition(e,t){let r=new RouterState(t,t._routerMicrolib,e[STATE_SYMBOL]);t.currentState||t.set("currentState",r),t.set("targetState",r),e.promise=e.catch(e=>{if(!t._isErrorHandled(e))throw e;t._clearHandledError(e)},"Transition Error")}function forEachQueryParam(e,t,r,n){let i=e._queryParamsFor(t);for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n(o,r[o],i.map[o])}function getHash$1(e){return void 0!==e.hash?e.hash.substring(0):""}EmberRouter.reopen({didTransition:defaultDidTransition,willTransition:defaultWillTransition,rootURL:"/",location:"hash",url:computed(function(){let e=get$7(this,"location");if("string"!=typeof e)return e.getURL()})});var HashLocation=class extends EmberObject{_hashchangeHandler;_location;init(){this.location=this._location??window.location,this._hashchangeHandler=void 0}getHash(){return getHash$1(this.location)}getURL(){let e=this.getHash().substring(1),t=e;return"/"!==t[0]&&(t="/",e&&(t+=`#${e}`)),t}setURL(e){this.location.hash=e,this.lastSetURL=e}replaceURL(e){this.location.replace(`#${e}`),this.lastSetURL=e}lastSetURL=null;onUpdateURL(e){this._removeEventListener(),this._hashchangeHandler=bind$1(this,function(){let t=this.getURL();this.lastSetURL!==t&&(this.lastSetURL=null,e(t))}),window.addEventListener("hashchange",this._hashchangeHandler)}formatURL(e){return`#${e}`}willDestroy(){this._removeEventListener()}_removeEventListener(){this._hashchangeHandler&&window.removeEventListener("hashchange",this._hashchangeHandler)}};function _uuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t,r;return t=16*Math.random()|0,r="x"===e?t:3&t|8,r.toString(16)})}var HistoryLocation=class extends EmberObject{history;_popstateHandler;rootURL="/";getHash(){return getHash$1(this.location)}init(){this._super(...arguments);let e=document.querySelector("base"),t="";null!==e&&e.hasAttribute("href")&&(t=e.getAttribute("href")??""),this.baseURL=t,this.location=this.location??window.location,this._popstateHandler=void 0}initState(){let e=this.history??window.history;this.history=e;let{state:t}=e,r=this.formatURL(this.getURL());t&&t.path===r||this.replaceState(r)}getURL(){let{location:e,rootURL:t,baseURL:r}=this,n=e.pathname;t=t.replace(/\/$/,""),r=r.replace(/\/$/,"");let i=n.replace(new RegExp(`^${r}(?=/|$)`),"").replace(new RegExp(`^${t}(?=/|$)`),"").replace(/\/\//g,"/");return i+=(e.search||"")+this.getHash(),i}setURL(e){let{state:t}=this.history;e=this.formatURL(e),t&&t.path===e||this.pushState(e)}replaceURL(e){let{state:t}=this.history;e=this.formatURL(e),t&&t.path===e||this.replaceState(e)}pushState(e){let t={path:e,uuid:_uuid()};this.history.pushState(t,"",e)}replaceState(e){let t={path:e,uuid:_uuid()};this.history.replaceState(t,"",e)}onUpdateURL(e){this._removeEventListener(),this._popstateHandler=()=>{e(this.getURL())},window.addEventListener("popstate",this._popstateHandler)}formatURL(e){let{rootURL:t,baseURL:r}=this;return""!==e?(t=t.replace(/\/$/,""),r=r.replace(/\/$/,"")):"/"===r[0]&&"/"===t[0]&&(r=r.replace(/\/$/,"")),r+t+e}willDestroy(){this._removeEventListener()}_removeEventListener(){this._popstateHandler&&window.removeEventListener("popstate",this._popstateHandler)}},NoneLocation=class extends EmberObject{updateCallback;initState(){this._super(...arguments);let{rootURL:e}=this}getURL(){let{path:e,rootURL:t}=this;return t=t.replace(/\/$/,""),e.replace(new RegExp(`^${t}(?=/|$)`),"")}setURL(e){this.path=e}onUpdateURL(e){this.updateCallback=e}handleURL(e){this.path=e,this.updateCallback&&this.updateCallback(e)}formatURL(e){let{rootURL:t}=this;return""!==e&&(t=t.replace(/\/$/,"")),t+e}};function isEmpty$5(e){if(null==e)return!0;if(!hasUnknownProperty(e)&&"number"==typeof e.size)return!e.size;if("object"==typeof e){let t=get$7(e,"size");if("number"==typeof t)return!t;let r=get$7(e,"length");if("number"==typeof r)return!r}return"number"==typeof e.length&&"function"!=typeof e&&!e.length}function expandPropertiesToArray(e,t){let r=[];function n(e){r.push(e)}for(let i of t)expandProperties(i,n);return r}function generateComputedWithPredicate(e,t){return(r,...n)=>{let i=expandPropertiesToArray(e,[r,...n]);return computed(...i,function(){let e=i.length-1;for(let r=0;r<e;r++){let e=get$7(this,i[r]);if(!t(e))return e}return get$7(this,i[e])})}}NoneLocation.reopen({path:"",rootURL:"/"});var and$1=generateComputedWithPredicate("and",e=>e),or$1=generateComputedWithPredicate("or",e=>!e);function readOnly(e){return alias(e).readOnly()}var STRING_DASHERIZE_REGEXP$1=/[ _]/g,STRING_DASHERIZE_CACHE$1=new Cache$1(1e3,e=>decamelize$1(e).replace(STRING_DASHERIZE_REGEXP$1,"-")),STRING_CLASSIFY_REGEXP_1$1=/^(-|_)+(.)?/,STRING_CLASSIFY_REGEXP_2$1=/(.)(-|_|\.|\s)+(.)?/g,STRING_CLASSIFY_REGEXP_3$1=/(^|\/|\.)([a-z])/g,CLASSIFY_CACHE$1=new Cache$1(1e3,e=>{let t=(e,t,r)=>r?`_${r.toUpperCase()}`:"",r=(e,t,r,n)=>t+(n?n.toUpperCase():""),n=e.split("/");for(let i=0;i<n.length;i++)n[i]=n[i].replace(STRING_CLASSIFY_REGEXP_1$1,t).replace(STRING_CLASSIFY_REGEXP_2$1,r);return n.join("/").replace(STRING_CLASSIFY_REGEXP_3$1,e=>e.toUpperCase())}),STRING_DECAMELIZE_REGEXP$1=/([a-z\d])([A-Z])/g,DECAMELIZE_CACHE$1=new Cache$1(1e3,e=>e.replace(STRING_DECAMELIZE_REGEXP$1,"$1_$2").toLowerCase());function dasherize$1(e){return STRING_DASHERIZE_CACHE$1.get(e)}function classify$1(e){return CLASSIFY_CACHE$1.get(e)}function decamelize$1(e){return DECAMELIZE_CACHE$1.get(e)}function isEnabled(e){return Object.hasOwnProperty.call(e.since,"enabled")||ENV$1._ALL_DEPRECATIONS_ENABLED}var numEmberVersion=parseFloat(ENV$1._OVERRIDE_DEPRECATION_VERSION??"7.1.0");function emberVersionGte(e,t=numEmberVersion){let r=e.replace(/(\.0+)/g,"");return t>=parseFloat(r)}function isRemoved(e){return emberVersionGte(e.until)}function deprecation(e){return{options:e,test:!isEnabled(e),isEnabled:isEnabled(e)||isRemoved(e),isRemoved:isRemoved(e)}}var DEPRECATIONS={DEPRECATE_IMPORT_EMBER:e=>deprecation({id:`deprecate-import-${dasherize$1(e).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-${dasherize$1(e).toLowerCase()}-from-ember`}),DEPRECATE_IMPORT_INJECT:deprecation({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"})};function deprecateUntil(e,t){const{options:r}=t;if(t.isRemoved)throw new Error(`The API deprecated by ${r.id} was removed in ember-source ${r.until}. The message was: ${e}. Please see ${r.url} for more details.`)}var service_exports=__exportAll({default:()=>Service,inject:()=>inject,service:()=>service});function inject(...e){return deprecateUntil("Importing `inject` from `@ember/service` is deprecated. Please import `service` instead.",DEPRECATIONS.DEPRECATE_IMPORT_INJECT),inject$2("service",...e)}function service(...e){return inject$2("service",...e)}var Service=class extends FrameworkObject{static isServiceFactory=!0},ROUTER=Symbol("ROUTER");function cleanURL(e,t){return"/"===t?e:e.substring(t.length)}var RouterService=class extends(Service.extend(Evented)){[ROUTER];get _router(){let e=this[ROUTER];if(void 0!==e)return e;let t=getOwner$2(this).lookup("router:main");return this[ROUTER]=t}willDestroy(){super.willDestroy(),this[ROUTER]=void 0}transitionTo(...e){if(resemblesURL(e[0]))return this._router._doURLTransition("transitionTo",e[0]);let{routeName:t,models:r,queryParams:n}=extractRouteArgs(e);return this._router._doTransition(t,r,n,!0)}replaceWith(...e){return this.transitionTo(...e).method("replace")}urlFor(e,...t){return this._router.setupRouter(),this._router.generate(e,...t)}isActive(...e){let{routeName:t,models:r,queryParams:n}=extractRouteArgs(e);this._router.setupRouter();let i=this._router._routerMicrolib;if(consumeTag(tagFor(this._router,"currentURL")),!i.isActiveIntent(t,r))return!1;if(Object.keys(n).length>0){let e=t;n=Object.assign({},n),this._router._prepareQueryParams(e,r,n,!0);let o=Object.assign({},i.state.queryParams);return this._router._prepareQueryParams(e,r,o,!0),shallowEqual(n,o)}return!0}recognize(e){this._router.setupRouter();let t=cleanURL(e,this.rootURL);return this._router._routerMicrolib.recognize(t)}recognizeAndLoad(e){this._router.setupRouter();let t=cleanURL(e,this.rootURL);return this._router._routerMicrolib.recognizeAndLoad(t)}refresh(e){if(!e)return this._router._routerMicrolib.refresh();let t=getOwner$2(this).lookup(`route:${e}`);return this._router._routerMicrolib.refresh(t)}static{decorateFieldV2$1(this.prototype,"currentRouteName",[readOnly("_router.currentRouteName")])}#s=void initializeDeferredDecorator$1(this,"currentRouteName");static{decorateFieldV2$1(this.prototype,"currentURL",[readOnly("_router.currentURL")])}#a=void initializeDeferredDecorator$1(this,"currentURL");static{decorateFieldV2$1(this.prototype,"location",[readOnly("_router.location")])}#l=void initializeDeferredDecorator$1(this,"location");static{decorateFieldV2$1(this.prototype,"rootURL",[readOnly("_router.rootURL")])}#c=void initializeDeferredDecorator$1(this,"rootURL");static{decorateFieldV2$1(this.prototype,"currentRoute",[readOnly("_router.currentRoute")])}#u=void initializeDeferredDecorator$1(this,"currentRoute")},RoutingService=class extends Service{[ROUTER];get router(){let e=this[ROUTER];if(void 0!==e)return e;let t=getOwner$2(this).lookup("router:main");return t.setupRouter(),this[ROUTER]=t}hasRoute(e){return this.router.hasRoute(e)}transitionTo(e,t,r,n){let i=this.router._doTransition(e,t,r);return n&&i.method("replace"),i}normalizeQueryParams(e,t,r){this.router._prepareQueryParams(e,t,r)}_generateURL(e,t,r){let n={};return r&&(Object.assign(n,r),this.normalizeQueryParams(e,t,n)),this.router.generate(e,...t,{queryParams:n})}generateURL(e,t,r){if(this.router._initialTransitionStarted)return this._generateURL(e,t,r);try{return this._generateURL(e,t,r)}catch(n){return}}isActiveForRoute(e,t,r,n){let i=this.router._routerMicrolib.recognizer.handlersFor(r),o=i[i.length-1].handler,s=numberOfContextsAcceptedByHandler(r,i);return e.length>s&&(r=o),n.isActiveIntent(r,e,t)}};function numberOfContextsAcceptedByHandler(e,t){let r=0;for(let n=0;n<t.length&&(r+=t[n].names.length,t[n].handler!==e);n++);return r}RoutingService.reopen({targetState:readOnly("router.targetState"),currentState:readOnly("router.currentState"),currentRouteName:readOnly("router.currentRouteName"),currentPath:readOnly("router.currentPath")});var BucketCache=class{cache;constructor(){this.cache=new Map}has(e){return this.cache.has(e)}stash(e,t,r){let n=this.cache.get(e);void 0===n&&(n=new Map,this.cache.set(e,n)),n.set(t,r)}lookup(e,t,r){if(!this.has(e))return r;let n=this.cache.get(e);return n.has(t)?n.get(t):r}},window$1=hasDOM?self:null,location$1=hasDOM?self.location:null,history$1=hasDOM?self.history:null,userAgent=hasDOM?self.navigator.userAgent:"Lynx (textmode)",isChrome=!(!hasDOM||"object"!=typeof chrome||"object"==typeof opera),isFirefox=!!hasDOM&&/Firefox|FxiOS/.test(userAgent),environment=Object.freeze(Object.defineProperty({__proto__:null,hasDOM:hasDOM,history:history$1,isChrome:isChrome,isFirefox:isFirefox,location:location$1,userAgent:userAgent,window:window$1},Symbol.toStringTag,{value:"Module"})),SIGN_BIT=-536870913,MAX_INT=536870911,MIN_INT=-536870912;function isHandle(e){return e>=0}function constants(...e){return[!1,!0,null,void 0,...e]}function isSmallInt(e){return e%1==0&&e<=MAX_INT&&e>=MIN_INT}function encodeNegative(e){return e&SIGN_BIT}function decodeNegative(e){return 536870912|e}function encodePositive(e){return~e}function decodePositive(e){return~e}function encodeHandle(e){return e}function decodeHandle(e){return e}function encodeImmediate(e){return(e|=0)<0?encodeNegative(e):encodePositive(e)}function decodeImmediate(e){return(e|=0)>SIGN_BIT?decodePositive(e):decodeNegative(e)}function unwrapHandle(e){if("number"==typeof e)return e;{let t=e.errors[0];throw new Error(`Compile Error: ${t.problem} @ ${t.span.start}..${t.span.end}`)}}function unwrapTemplate$1(e){if("error"===e.result)throw new Error(`Compile Error: ${e.problem} @ ${e.span.start}..${e.span.end}`);return e}[1,-1].forEach(e=>decodeImmediate(encodeImmediate(e)));var TEMPLATES=new WeakMap,getPrototypeOf$1=Reflect.getPrototypeOf;function setComponentTemplate(e,t){return TEMPLATES.set(t,e),t}function getComponentTemplate(e){let t=e;for(;null!==t;){let e=TEMPLATES.get(t);if(void 0!==e)return e;t=getPrototypeOf$1(t)}}var assign=Object.assign;function values(e){return Object.values(e)}function entries(e){return Object.entries(e)}function keys(e){return Object.keys(e)}var EMPTY_ARRAY$2=Object.freeze([]);function emptyArray(){return EMPTY_ARRAY$2}var EMPTY_STRING_ARRAY=emptyArray(),EMPTY_NUMBER_ARRAY=emptyArray();function isEmptyArray(e){return e===EMPTY_ARRAY$2}function*reverse(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function*enumerate(e){let t=0;for(const r of e)yield[t++,r]}function*zipTuples(e,t){for(let r=0;r<e.length;r++)yield[r,e[r],t[r]]}function*zipArrays(e,t){for(let r=0;r<e.length;r++)yield[r<t.length?"retain":"pop",r,e[r],t[r]];for(let r=e.length;r<t.length;r++)yield["push",r,void 0,t[r]]}function isMachineOp(e){return e>=0&&e<=15}function assert$3(){}var InstructionEncoderImpl=class{constructor(e){this.buffer=e}size=0;encode(e,t,...r){if(e>255)throw new Error(`Opcode type over 8-bits. Got ${e}.`);let n=e|t|arguments.length-2<<8;this.buffer.push(n);for(const i of r)this.buffer.push(i);this.size=this.buffer.length}patch(e,t){if(-1!==this.buffer[e+1])throw new Error("Trying to patch operand in populated slot instead of a reserved slot.");this.buffer[e+1]=t}},opcodes={Append:1,TrustingAppend:2,Comment:3,Modifier:4,StrictModifier:5,Block:6,StrictBlock:7,Component:8,OpenElement:10,OpenElementWithSplat:11,FlushElement:12,CloseElement:13,StaticAttr:14,DynamicAttr:15,ComponentAttr:16,AttrSplat:17,Yield:18,DynamicArg:20,StaticArg:21,TrustingDynamicAttr:22,TrustingComponentAttr:23,StaticComponentAttr:24,Debugger:26,Undefined:27,Call:28,Concat:29,GetSymbol:30,GetLexicalSymbol:32,GetStrictKeyword:31,GetFreeAsComponentOrHelperHead:35,GetFreeAsHelperHead:37,GetFreeAsModifierHead:38,GetFreeAsComponentHead:39,InElement:40,If:41,Each:42,Let:44,WithDynamicVars:45,InvokeComponent:46,HasBlock:48,HasBlockParams:49,Curry:50,Not:51,IfInline:52,GetDynamicVar:53,Log:54},$sp=3;function isLowLevelRegister(e){return e<=3}var ContentType={Component:0,Helper:1,String:2,Empty:3,SafeString:4,Fragment:5,Node:6,Other:8};function isGetLikeTuple(e){return Array.isArray(e)&&2===e.length}function makeResolutionTypeVerifier(e){return t=>{if(!isGetLikeTuple(t))return!1;let r=t[0];return r===opcodes.GetStrictKeyword||r===opcodes.GetLexicalSymbol||r===e}}var isGetFreeComponent=makeResolutionTypeVerifier(opcodes.GetFreeAsComponentHead),isGetFreeModifier=makeResolutionTypeVerifier(opcodes.GetFreeAsModifierHead),isGetFreeHelper=makeResolutionTypeVerifier(opcodes.GetFreeAsHelperHead),isGetFreeComponentOrHelper=makeResolutionTypeVerifier(opcodes.GetFreeAsComponentOrHelperHead);function assertResolverInvariants(e){return e}function resolveComponent$1(e,t,r,[,n,i]){if(assert$3(isGetFreeComponent(n)),n[0]===opcodes.GetLexicalSymbol){let{scopeValues:e,owner:o,symbols:{lexical:s}}=r,a=expect(e)[n[1]];i(t.component(a,expect(o),!1,s?.at(n[1])))}else{let{symbols:{upvars:o},owner:s}=assertResolverInvariants(r),a=unwrap$1(o[n[1]]),l=e?.lookupComponent?.(a,s)??null;i(t.resolvedComponent(l,a))}}function resolveHelper$1(e,t,r,[,n,i]){assert$3(isGetFreeHelper(n));let o=n[0];if(o===opcodes.GetLexicalSymbol){let{scopeValues:e}=r,o=expect(e)[n[1]];i(t.helper(o))}else if(o===opcodes.GetStrictKeyword)i(lookupBuiltInHelper(n,e,r,t));else{let{symbols:{upvars:o},owner:s}=assertResolverInvariants(r),a=unwrap$1(o[n[1]]),l=e?.lookupHelper?.(a,s)??null;i(t.helper(l,a))}}function resolveModifier(e,t,r,[,n,i]){assert$3(isGetFreeModifier(n));let o=n[0];if(o===opcodes.GetLexicalSymbol){let{scopeValues:e,symbols:{lexical:o}}=r,s=expect(e)[n[1]];i(t.modifier(s,o?.at(n[1])??void 0))}else if(o===opcodes.GetStrictKeyword){let{symbols:{upvars:o}}=assertResolverInvariants(r),s=unwrap$1(o[n[1]]),a=e?.lookupBuiltInModifier?.(s)??null;i(t.modifier(a,s))}else{let{symbols:{upvars:o},owner:s}=assertResolverInvariants(r),a=unwrap$1(o[n[1]]),l=e?.lookupModifier?.(a,s)??null;i(t.modifier(l))}}function resolveComponentOrHelper(e,t,r,[,n,{ifComponent:i,ifHelper:o}]){assert$3(isGetFreeComponentOrHelper(n));let s=n[0];if(s===opcodes.GetLexicalSymbol){let{scopeValues:e,owner:s,symbols:{lexical:a}}=r,l=expect(e)[n[1]],c=t.component(l,expect(s),!0,a?.at(n[1]));if(null!==c)return void i(c);o(expect(t.helper(l,null,!0)))}else if(s===opcodes.GetStrictKeyword)o(lookupBuiltInHelper(n,e,r,t));else{let{symbols:{upvars:s},owner:a}=assertResolverInvariants(r),l=unwrap$1(s[n[1]]),c=e?.lookupComponent?.(l,a)??null;if(null!==c)i(t.resolvedComponent(c,l));else{let r=e?.lookupHelper?.(l,a)??null;o(t.helper(r,l))}}}function resolveOptionalComponentOrHelper(e,t,r,[,n,{ifComponent:i,ifHelper:o,ifValue:s}]){assert$3(isGetFreeComponentOrHelper(n));let a=n[0];if(a===opcodes.GetLexicalSymbol){let{scopeValues:e,owner:a,symbols:{lexical:l}}=r,c=expect(e)[n[1]];if("function"!=typeof c&&("object"!=typeof c||null===c))return void s(t.value(c));let u=t.component(c,expect(a),!0,l?.at(n[1]));if(null!==u)return void i(u);let h=t.helper(c,null,!0);if(null!==h)return void o(h);s(t.value(c))}else if(a===opcodes.GetStrictKeyword)o(lookupBuiltInHelper(n,e,r,t));else{let{symbols:{upvars:s},owner:a}=assertResolverInvariants(r),l=unwrap$1(s[n[1]]),c=e?.lookupComponent?.(l,a)??null;if(null!==c)return void i(t.resolvedComponent(c,l));let u=e?.lookupHelper?.(l,a)??null;null!==u&&o(t.helper(u,l))}}function lookupBuiltInHelper(e,t,r,n){let{symbols:{upvars:i}}=assertResolverInvariants(r),o=unwrap$1(i[e[1]]),s=t?.lookupBuiltInHelper?.(o)??null;return n.helper(s,o)}var HighLevelResolutionOpcodes={Modifier:1003,Component:1004,Helper:1005,ComponentOrHelper:1007,OptionalComponentOrHelper:1008,Local:1010,TemplateLocal:1011},HighLevelBuilderOpcodes={Label:1e3,StartLabels:1001,StopLabels:1002,Start:1e3},HighLevelOperands={Label:1,IsStrictMode:2,DebugSymbols:3,Block:4,StdLib:5,NonSmallInt:6,SymbolTable:7,Layout:8};function labelOperand(e){return{type:HighLevelOperands.Label,value:e}}function debugSymbolsOperand(e,t,r){return{type:HighLevelOperands.DebugSymbols,value:{locals:e,upvars:t,lexical:r}}}function isStrictMode(){return{type:HighLevelOperands.IsStrictMode,value:void 0}}function blockOperand(e){return{type:HighLevelOperands.Block,value:e}}function stdlibOperand(e){return{type:HighLevelOperands.StdLib,value:e}}function nonSmallIntOperand(e){return{type:HighLevelOperands.NonSmallInt,value:e}}function symbolTableOperand(e){return{type:HighLevelOperands.SymbolTable,value:e}}function layoutOperand(e){return{type:HighLevelOperands.Layout,value:e}}var Labels=class{labels=dict();targets=[];label(e,t){this.labels[e]=t}target(e,t){this.targets.push({at:e,target:t})}patch(e){let{targets:t,labels:r}=this;for(const{at:n,target:i}of t){let t=r[i]-n;assert$3(-1===e.getbyaddr(n)),e.setbyaddr(n,t)}}};function encodeOp(e,t,r,n){let{program:{constants:i},resolver:o}=t;if(isBuilderOpcode(n[0])){let[t,...r]=n;e.push(i,t,...r)}else switch(n[0]){case HighLevelBuilderOpcodes.Label:return e.label(n[1]);case HighLevelBuilderOpcodes.StartLabels:return e.startLabels();case HighLevelBuilderOpcodes.StopLabels:return e.stopLabels();case HighLevelResolutionOpcodes.Component:return resolveComponent$1(o,i,r,n);case HighLevelResolutionOpcodes.Modifier:return resolveModifier(o,i,r,n);case HighLevelResolutionOpcodes.Helper:return resolveHelper$1(o,i,r,n);case HighLevelResolutionOpcodes.ComponentOrHelper:return resolveComponentOrHelper(o,i,r,n);case HighLevelResolutionOpcodes.OptionalComponentOrHelper:return resolveOptionalComponentOrHelper(o,i,r,n);case HighLevelResolutionOpcodes.Local:{let[,e,t]=n;t(expect(r.symbols.upvars)[e],r.moduleName);break}case HighLevelResolutionOpcodes.TemplateLocal:{let[,e,t]=n,o=expect(r.scopeValues)[e];t(i.value(o));break}default:throw new Error(`Unexpected high level opcode ${n[0]}`)}}var EncoderImpl=class{labelsStack=new StackImpl;encoder=new InstructionEncoderImpl([]);errors=[];handle;constructor(e,t,r){this.heap=e,this.meta=t,this.stdlib=r,this.handle=e.malloc()}error(e){this.encoder.encode(30,0),this.errors.push(e)}commit(e){let t=this.handle;return this.heap.pushMachine(5),this.heap.finishMalloc(t,e),isPresentArray(this.errors)?{errors:this.errors,handle:t}:t}push(e,t,...r){let{heap:n}=this,i=t|(isMachineOp(t)?MACHINE_MASK:0)|r.length<<8;n.pushRaw(i);for(let o=0;o<r.length;o++){let t=r[o];n.pushRaw(this.operand(e,t))}}operand(e,t){if("number"==typeof t)return t;if("object"==typeof t&&null!==t){if(Array.isArray(t))return encodeHandle(e.array(t));switch(t.type){case HighLevelOperands.Label:return this.currentLabels.target(this.heap.offset,t.value),-1;case HighLevelOperands.IsStrictMode:return encodeHandle(e.value(this.meta.isStrictMode));case HighLevelOperands.DebugSymbols:return encodeHandle(e.value(t.value));case HighLevelOperands.Block:return encodeHandle(e.value(compilableBlock(t.value,this.meta)));case HighLevelOperands.StdLib:return expect(this.stdlib)[t.value];case HighLevelOperands.NonSmallInt:case HighLevelOperands.SymbolTable:case HighLevelOperands.Layout:return e.value(t.value)}}return encodeHandle(e.value(t))}get currentLabels(){return expect(this.labelsStack.current)}label(e){this.currentLabels.label(e,this.heap.offset+1)}startLabels(){this.labelsStack.push(new Labels)}stopLabels(){expect(this.labelsStack.pop()).patch(this.heap)}};function isBuilderOpcode(e){return e<HighLevelBuilderOpcodes.Start}function templateCompilationContext(e,t){return{evaluation:e,encoder:new EncoderImpl(e.program.heap,t,e.stdlib),meta:t}}var Compilers=class{names={};funcs=[];add(e,t){this.names[e]=this.funcs.push(t)-1}compile(e,t){let r=t[0],n=unwrap$1(this.names[r]),i=this.funcs[n];assert$3(i,`expected an implementation for ${t[0]}`),i(e,t)}},EXPRESSIONS=new Compilers;function withPath(e,t){if(void 0!==t&&0!==t.length)for(let r=0;r<t.length;r++)e(22,t[r])}function expr(e,t){Array.isArray(t)?EXPRESSIONS.compile(e,t):(PushPrimitive(e,t),e(31))}function PushPrimitiveReference(e,t){PushPrimitive(e,t),e(31)}function PushPrimitive(e,t){let r=t;"number"==typeof r&&(r=isSmallInt(r)?encodeImmediate(r):nonSmallIntOperand(r)),e(30,r)}function Call(e,t,r,n){e(0),SimpleArgs(e,r,n,!1),e(16,t),e(1),e(36,8)}function CallDynamic(e,t,r,n){e(0),SimpleArgs(e,t,r,!1),e(33,2,1),e(107),n?(e(36,8),n(),e(1),e(34,1)):(e(1),e(34,1),e(36,8))}function DynamicScope$1(e,t,r){e(59),e(58,t),r(),e(60)}function Curry(e,t,r,n,i){e(0),SimpleArgs(e,n,i,!1),e(86),expr(e,r),e(77,t,isStrictMode()),e(1),e(36,8)}function YieldBlock(e,t,r){SimpleArgs(e,r,null,!0),e(23,t),e(24),e(61),e(64),e(40),e(1)}function PushYieldableBlock(e,t){PushSymbolTable(e,t&&t[1]),e(62),PushCompilable(e,t)}function InvokeStaticBlock(e,t){e(0),PushCompilable(e,t),e(61),e(2),e(1)}function InvokeStaticBlockWithStack(e,t,r){let n=t[1],i=n.length,o=Math.min(r,i);if(0!==o){if(e(0),o){e(39);for(let t=0;t<o;t++)e(33,2,r-t),e(19,n[t])}PushCompilable(e,t),e(61),e(2),o&&e(40),e(1)}else InvokeStaticBlock(e,t)}function PushSymbolTable(e,t){null!==t?e(63,symbolTableOperand({parameters:t})):PushPrimitive(e,null)}function PushCompilable(e,t){null===t?PushPrimitive(e,null):e(28,blockOperand(t))}function CompileArgs(e,t,r,n,i){let o=n.names;for(const l of o)PushYieldableBlock(e,n.get(l));let s=CompilePositional(e,t)<<4;i&&(s|=8),n.hasAny&&(s|=7);let a=EMPTY_ARRAY$2;if(r){a=r[0];let t=r[1];for(let r=0;r<t.length;r++)expr(e,t[r])}e(82,a,o,s)}function SimpleArgs(e,t,r,n){if(null===t&&null===r)return void e(83);let i=CompilePositional(e,t)<<4;n&&(i|=8);let o=EMPTY_STRING_ARRAY;if(r){o=r[0];let t=r[1];for(let r=0;r<t.length;r++)expr(e,t[r])}e(82,o,EMPTY_STRING_ARRAY,i)}function CompilePositional(e,t){if(null===t)return 0;for(let r=0;r<t.length;r++)expr(e,t[r]);return t.length}function meta(e){let[,t,r]=e.block,n=e.scope?.()??null;return{symbols:{locals:t,upvars:r,lexical:n?Object.keys(n):void 0},scopeValues:n?Object.values(n):null,isStrictMode:e.isStrictMode,moduleName:e.moduleName,owner:e.owner,size:t.length}}EXPRESSIONS.add(opcodes.Concat,(e,[,t])=>{for(let r of t)expr(e,r);e(27,t.length)}),EXPRESSIONS.add(opcodes.Call,(e,[,t,r,n])=>{isGetFreeHelper(t)?e(HighLevelResolutionOpcodes.Helper,t,t=>{Call(e,t,r,n)}):(expr(e,t),CallDynamic(e,r,n))}),EXPRESSIONS.add(opcodes.Curry,(e,[,t,r,n,i])=>{Curry(e,r,t,n,i)}),EXPRESSIONS.add(opcodes.GetSymbol,(e,[,t,r])=>{e(21,t),withPath(e,r)}),EXPRESSIONS.add(opcodes.GetLexicalSymbol,(e,[,t,r])=>{e(HighLevelResolutionOpcodes.TemplateLocal,t,t=>{e(29,t),withPath(e,r)})}),EXPRESSIONS.add(opcodes.GetStrictKeyword,(e,t)=>{e(HighLevelResolutionOpcodes.Local,t[1],()=>{e(HighLevelResolutionOpcodes.Helper,t,t=>{Call(e,t,null,null)})})}),EXPRESSIONS.add(opcodes.GetFreeAsHelperHead,(e,t)=>{e(HighLevelResolutionOpcodes.Local,t[1],()=>{e(HighLevelResolutionOpcodes.Helper,t,t=>{Call(e,t,null,null)})})}),EXPRESSIONS.add(opcodes.Undefined,e=>PushPrimitiveReference(e,void 0)),EXPRESSIONS.add(opcodes.HasBlock,(e,[,t])=>{expr(e,t),e(25)}),EXPRESSIONS.add(opcodes.HasBlockParams,(e,[,t])=>{expr(e,t),e(24),e(61),e(26)}),EXPRESSIONS.add(opcodes.IfInline,(e,[,t,r,n])=>{expr(e,n),expr(e,r),expr(e,t),e(109)}),EXPRESSIONS.add(opcodes.Not,(e,[,t])=>{expr(e,t),e(110)}),EXPRESSIONS.add(opcodes.GetDynamicVar,(e,[,t])=>{expr(e,t),e(111)}),EXPRESSIONS.add(opcodes.Log,(e,[,t])=>{e(0),SimpleArgs(e,t,null,!1),e(112),e(1),e(36,8)});var NamedBlocksImpl=class e{names;constructor(e){this.blocks=e,this.names=e?Object.keys(e):[]}get(e){return this.blocks&&this.blocks[e]||null}has(e){let{blocks:t}=this;return null!==t&&e in t}with(t,r){let{blocks:n}=this;return new e(n?assign({},n,{[t]:r}):{[t]:r})}get hasAny(){return null!==this.blocks}},EMPTY_BLOCKS=new NamedBlocksImpl(null);function namedBlocks(e){if(null===e)return EMPTY_BLOCKS;let t=dict(),[r,n]=e;for(const[i,o]of enumerate(r))t[o]=unwrap$1(n[i]);return new NamedBlocksImpl(t)}function SwitchCases(e,t,r){let n=[],i=0;r(function(e,t){n.push({match:e,callback:t,label:"CLAUSE"+i++})}),e(69,1),t(),e(HighLevelBuilderOpcodes.StartLabels);for(let o of n.slice(0,-1))e(67,labelOperand(o.label),o.match);for(let o=n.length-1;o>=0;o--){let t=unwrap$1(n[o]);e(HighLevelBuilderOpcodes.Label,t.label),e(34,1),t.callback(),0!==o&&e(4,labelOperand("END"))}e(HighLevelBuilderOpcodes.Label,"END"),e(HighLevelBuilderOpcodes.StopLabels),e(70)}function Replayable(e,t,r){e(HighLevelBuilderOpcodes.StartLabels),e(0),e(6,labelOperand("ENDINITIAL")),e(69,t()),r(),e(HighLevelBuilderOpcodes.Label,"FINALLY"),e(70),e(5),e(HighLevelBuilderOpcodes.Label,"ENDINITIAL"),e(1),e(HighLevelBuilderOpcodes.StopLabels)}function ReplayableIf(e,t,r,n){return Replayable(e,t,()=>{e(66,labelOperand("ELSE")),r(),e(4,labelOperand("FINALLY")),e(HighLevelBuilderOpcodes.Label,"ELSE"),void 0!==n&&n()})}var ATTRS_BLOCK="&attrs";function InvokeComponent(e,t,r,n,i,o){let{compilable:s,capabilities:a,handle:l}=t,c=r?[r,[]]:null,u=namedBlocks(o);s?(e(78,l),InvokeStaticComponent(e,{capabilities:a,layout:s,elementBlock:c,positional:n,named:i,blocks:u})):(e(78,l),InvokeNonStaticComponent(e,{capabilities:a,elementBlock:c,positional:n,named:i,atNames:!0,blocks:u}))}function InvokeDynamicComponent(e,t,r,n,i,o,s,a){let l=r?[r,[]]:null,c=namedBlocks(o);Replayable(e,()=>(expr(e,t),e(33,3,0),2),()=>{e(66,labelOperand("ELSE")),a?e(81):e(80,isStrictMode()),e(79),InvokeNonStaticComponent(e,{capabilities:!0,elementBlock:l,positional:n,named:i,atNames:s,blocks:c}),e(HighLevelBuilderOpcodes.Label,"ELSE")})}function InvokeStaticComponent(e,{capabilities:t,layout:r,elementBlock:n,positional:i,named:o,blocks:s}){let{symbolTable:a}=r;if(hasCapability(t,InternalComponentCapabilities.prepareArgs))return void InvokeNonStaticComponent(e,{capabilities:t,elementBlock:n,positional:i,named:o,atNames:!0,blocks:s,layout:r});e(36,4),e(33,3,1),e(35,4),e(0);let{symbols:l}=a,c=[],u=[],h=[],d=s.names;if(null!==n){let t=l.indexOf(ATTRS_BLOCK);-1!==t&&(PushYieldableBlock(e,n),c.push(t))}for(const p of d){let t=l.indexOf(`&${p}`);-1!==t&&(PushYieldableBlock(e,s.get(p)),c.push(t))}if(hasCapability(t,InternalComponentCapabilities.createArgs)){let t=CompilePositional(e,i)<<4;t|=8;let r=EMPTY_STRING_ARRAY;if(null!==o){r=o[0];let t=o[1];for(let n=0;n<t.length;n++){let i=l.indexOf(unwrap$1(r[n]));expr(e,t[n]),u.push(i)}}e(82,r,EMPTY_STRING_ARRAY,t),u.push(-1)}else if(null!==o){let t=o[0],r=o[1];for(let n=0;n<r.length;n++){let i=unwrap$1(t[n]),o=l.indexOf(i);-1!==o&&(expr(e,r[n]),u.push(o),h.push(i))}}e(97,4),hasCapability(t,InternalComponentCapabilities.dynamicScope)&&e(59),hasCapability(t,InternalComponentCapabilities.createInstance)&&e(87,0|s.has("default")),e(88,4),hasCapability(t,InternalComponentCapabilities.createArgs)?e(90,4):e(90,4,h),e(37,l.length+1,Object.keys(s).length>0?1:0),e(19,0);for(const p of reverse(u))-1===p?e(34,1):e(19,p+1);null!==i&&e(34,i.length);for(const p of reverse(c))e(20,p+1);e(28,layoutOperand(r)),e(61),e(2),e(100,4),e(1),e(40),hasCapability(t,InternalComponentCapabilities.dynamicScope)&&e(60),e(98),e(35,4)}function InvokeNonStaticComponent(e,{capabilities:t,elementBlock:r,positional:n,named:i,atNames:o,blocks:s,layout:a}){let l=Boolean(s),c=!0===t||hasCapability(t,InternalComponentCapabilities.prepareArgs)||0!==i?.[0].length,u=s.with("attrs",r);e(36,4),e(33,3,1),e(35,4),e(0),CompileArgs(e,n,i,u,o),e(85,4),invokePreparedComponent(e,u.has("default"),l,c,()=>{a?(e(63,symbolTableOperand(a.symbolTable)),e(28,layoutOperand(a)),e(61)):e(92,4),e(95,4)}),e(35,4)}function WrappedComponent(e,t,r){e(HighLevelBuilderOpcodes.StartLabels),WithSavedRegister(e,5,()=>{e(91,4),e(31),e(33,3,0)}),e(66,labelOperand("BODY")),e(36,5),e(89),e(49),e(99,4),YieldBlock(e,r,null),e(54),e(HighLevelBuilderOpcodes.Label,"BODY"),InvokeStaticBlock(e,[t.block[0],[]]),e(36,5),e(66,labelOperand("END")),e(55),e(HighLevelBuilderOpcodes.Label,"END"),e(35,5),e(HighLevelBuilderOpcodes.StopLabels)}function invokePreparedComponent(e,t,r,n,i=null){e(97,4),e(59),e(87,0|t),i&&i(),e(88,4),e(90,4),e(38,4),e(19,0),n&&e(17,4),r&&e(18,4),e(34,1),e(96,4),e(100,4),e(1),e(40),e(60),e(98)}function InvokeBareComponent(e){e(36,4),e(33,3,1),e(35,4),e(0),e(83),e(85,4),invokePreparedComponent(e,!1,!1,!0,()=>{e(92,4),e(95,4)}),e(35,4)}function WithSavedRegister(e,t,r){e(36,t),r(),e(35,t)}var STATEMENTS=new Compilers,INFLATE_ATTR_TABLE=["class","id","value","name","type","style","href"],INFLATE_TAG_TABLE=["div","span","p","a"];function inflateTagName(e){return"string"==typeof e?e:INFLATE_TAG_TABLE[e]}function inflateAttrName(e){return"string"==typeof e?e:INFLATE_ATTR_TABLE[e]}function hashToArgs(e){return null===e?null:[e[0].map(e=>`@${e}`),e[1]]}STATEMENTS.add(opcodes.Comment,(e,t)=>e(42,t[1])),STATEMENTS.add(opcodes.CloseElement,e=>e(55)),STATEMENTS.add(opcodes.FlushElement,e=>e(54)),STATEMENTS.add(opcodes.Modifier,(e,[,t,r,n])=>{isGetFreeModifier(t)?e(HighLevelResolutionOpcodes.Modifier,t,t=>{e(0),SimpleArgs(e,r,n,!1),e(57,t),e(1)}):(expr(e,t),e(0),SimpleArgs(e,r,n,!1),e(33,2,1),e(108),e(1))}),STATEMENTS.add(opcodes.StaticAttr,(e,[,t,r,n])=>{e(51,inflateAttrName(t),r,n??null)}),STATEMENTS.add(opcodes.StaticComponentAttr,(e,[,t,r,n])=>{e(105,inflateAttrName(t),r,n??null)}),STATEMENTS.add(opcodes.DynamicAttr,(e,[,t,r,n])=>{expr(e,r),e(52,inflateAttrName(t),!1,n??null)}),STATEMENTS.add(opcodes.TrustingDynamicAttr,(e,[,t,r,n])=>{expr(e,r),e(52,inflateAttrName(t),!0,n??null)}),STATEMENTS.add(opcodes.ComponentAttr,(e,[,t,r,n])=>{expr(e,r),e(53,inflateAttrName(t),!1,n??null)}),STATEMENTS.add(opcodes.TrustingComponentAttr,(e,[,t,r,n])=>{expr(e,r),e(53,inflateAttrName(t),!0,n??null)}),STATEMENTS.add(opcodes.OpenElement,(e,[,t])=>{e(48,inflateTagName(t))}),STATEMENTS.add(opcodes.OpenElementWithSplat,(e,[,t])=>{e(89),e(48,inflateTagName(t))}),STATEMENTS.add(opcodes.Component,(e,[,t,r,n,i])=>{isGetFreeComponent(t)?e(HighLevelResolutionOpcodes.Component,t,t=>{InvokeComponent(e,t,r,null,n,i)}):InvokeDynamicComponent(e,t,r,null,n,i,!0,!0)}),STATEMENTS.add(opcodes.Yield,(e,[,t,r])=>YieldBlock(e,t,r)),STATEMENTS.add(opcodes.AttrSplat,(e,[,t])=>YieldBlock(e,t,null)),STATEMENTS.add(opcodes.Debugger,(e,[,t,r,n])=>{e(103,debugSymbolsOperand(t,r,n))}),STATEMENTS.add(opcodes.Append,(e,[,t])=>{if(Array.isArray(t))if(isGetFreeComponentOrHelper(t))e(HighLevelResolutionOpcodes.OptionalComponentOrHelper,t,{ifComponent(t){InvokeComponent(e,t,null,null,null,null)},ifHelper(t){e(0),Call(e,t,null,null),e(3,stdlibOperand("cautious-non-dynamic-append")),e(1)},ifValue(t){e(0),e(29,t),e(3,stdlibOperand("cautious-non-dynamic-append")),e(1)}});else if(t[0]===opcodes.Call){let[,r,n,i]=t;isGetFreeComponentOrHelper(r)?e(HighLevelResolutionOpcodes.ComponentOrHelper,r,{ifComponent(t){InvokeComponent(e,t,null,n,hashToArgs(i),null)},ifHelper(t){e(0),Call(e,t,n,i),e(3,stdlibOperand("cautious-non-dynamic-append")),e(1)}}):SwitchCases(e,()=>{expr(e,r),e(106)},t=>{t(ContentType.Component,()=>{e(81),e(79),InvokeNonStaticComponent(e,{capabilities:!0,elementBlock:null,positional:n,named:i,atNames:!1,blocks:namedBlocks(null)})}),t(ContentType.Helper,()=>{CallDynamic(e,n,i,()=>{e(3,stdlibOperand("cautious-non-dynamic-append"))})})})}else e(0),expr(e,t),e(3,stdlibOperand("cautious-append")),e(1);else e(41,null==t?"":String(t))}),STATEMENTS.add(opcodes.TrustingAppend,(e,[,t])=>{Array.isArray(t)?(e(0),expr(e,t),e(3,stdlibOperand("trusting-append")),e(1)):e(41,null==t?"":String(t))}),STATEMENTS.add(opcodes.Block,(e,[,t,r,n,i])=>{isGetFreeComponent(t)?e(HighLevelResolutionOpcodes.Component,t,t=>{InvokeComponent(e,t,null,r,hashToArgs(n),i)}):InvokeDynamicComponent(e,t,null,r,n,i,!1,!1)}),STATEMENTS.add(opcodes.InElement,(e,[,t,r,n,i])=>{ReplayableIf(e,()=>(expr(e,r),void 0===i?PushPrimitiveReference(e,void 0):expr(e,i),expr(e,n),e(33,3,0),4),()=>{e(50),InvokeStaticBlock(e,t),e(56)})}),STATEMENTS.add(opcodes.If,(e,[,t,r,n])=>ReplayableIf(e,()=>(expr(e,t),e(71),1),()=>{InvokeStaticBlock(e,r)},n?()=>{InvokeStaticBlock(e,n)}:void 0)),STATEMENTS.add(opcodes.Each,(e,[,t,r,n,i])=>Replayable(e,()=>(r?expr(e,r):PushPrimitiveReference(e,null),expr(e,t),2),()=>{e(72,labelOperand("BODY"),labelOperand("ELSE")),e(0),e(33,2,1),e(6,labelOperand("ITER")),e(HighLevelBuilderOpcodes.Label,"ITER"),e(74,labelOperand("BREAK")),e(HighLevelBuilderOpcodes.Label,"BODY"),InvokeStaticBlockWithStack(e,n,2),e(34,2),e(4,labelOperand("FINALLY")),e(HighLevelBuilderOpcodes.Label,"BREAK"),e(1),e(73),e(4,labelOperand("FINALLY")),e(HighLevelBuilderOpcodes.Label,"ELSE"),i&&InvokeStaticBlock(e,i)})),STATEMENTS.add(opcodes.Let,(e,[,t,r])=>{InvokeStaticBlockWithStack(e,r,CompilePositional(e,t))}),STATEMENTS.add(opcodes.WithDynamicVars,(e,[,t,r])=>{if(t){let[n,i]=t;CompilePositional(e,i),DynamicScope$1(e,n,()=>{InvokeStaticBlock(e,r)})}else InvokeStaticBlock(e,r)}),STATEMENTS.add(opcodes.InvokeComponent,(e,[,t,r,n,i])=>{isGetFreeComponent(t)?e(HighLevelResolutionOpcodes.Component,t,t=>{InvokeComponent(e,t,null,r,hashToArgs(n),i)}):InvokeDynamicComponent(e,t,null,r,n,i,!1,!1)});var PLACEHOLDER_HANDLE=-1,CompilableTemplateImpl=class{compiled=new WeakMap;constructor(e,t,r,n="plain block"){this.statements=e,this.meta=t,this.symbolTable=r,this.moduleName=n}compile(e){return maybeCompile(this,e)}};function compilable(e,t){let[r,n]=e.block;return new CompilableTemplateImpl(r,meta(e),{symbols:n},t)}function maybeCompile(e,t){if(e.compiled.has(t))return e.compiled.get(t);e.compiled.set(t,PLACEHOLDER_HANDLE);let{statements:r,meta:n}=e,i=compileStatements(r,n,t);return e.compiled.set(t,i),i}function compileStatements(e,t,r){let n=STATEMENTS,i=templateCompilationContext(r,t),{encoder:o,evaluation:s}=i;function a(...e){encodeOp(o,s,t,e)}for(const l of e)n.compile(a,l);return i.encoder.commit(t.size)}function compilableBlock(e,t){return new CompilableTemplateImpl(e[0],t,{parameters:e[1]||EMPTY_ARRAY$2})}var WrappedBuilder=class{symbolTable;compiled=null;attrsBlockNumber;meta;constructor(e,t){this.layout=e,this.moduleName=t;let{block:r}=e,[,n]=r;n=n.slice();let i=n.indexOf(ATTRS_BLOCK);this.attrsBlockNumber=-1===i?n.push(ATTRS_BLOCK):i+1,this.symbolTable={symbols:n},this.meta=meta(e)}compile(e){if(null!==this.compiled)return this.compiled;let t=meta(this.layout),r=templateCompilationContext(e,t),{encoder:n,evaluation:i}=r;WrappedComponent(function(...e){encodeOp(n,i,t,e)},this.layout,this.attrsBlockNumber);let o=r.encoder.commit(t.size);return"number"!=typeof o||(this.compiled=o),o}},clientId=0,templateCacheCounters={cacheHit:0,cacheMiss:0};function templateFactory({id:e,moduleName:t,block:r,scope:n,isStrictMode:i}){let o,s=e||"client-"+clientId++,a=null,l=new WeakMap,c=e=>{if(void 0===o&&(o=JSON.parse(r)),void 0===e)return null===a?(templateCacheCounters.cacheMiss++,a=new TemplateImpl({id:s,block:o,moduleName:t,owner:null,scope:n,isStrictMode:i})):templateCacheCounters.cacheHit++,a;let c=l.get(e);return void 0===c?(templateCacheCounters.cacheMiss++,c=new TemplateImpl({id:s,block:o,moduleName:t,owner:e,scope:n,isStrictMode:i}),l.set(e,c)):templateCacheCounters.cacheHit++,c};return c.__id=s,c.__meta={moduleName:t},c}var TemplateImpl=class{result="ok";layout=null;wrappedLayout=null;constructor(e){this.parsedLayout=e}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=compilable(assign({},this.parsedLayout),this.moduleName)}asWrappedLayout(){return this.wrappedLayout?this.wrappedLayout:this.wrappedLayout=new WrappedBuilder(assign({},this.parsedLayout),this.moduleName)}},RuntimeOpImpl=class{offset=0;constructor(e){this.heap=e}get size(){return 1+((768&this.heap.getbyaddr(this.offset))>>8)}get isMachine(){return 1024&this.heap.getbyaddr(this.offset)?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)}},ALLOCATED=0,FREED=1,PURGED=2,POINTER=3,PAGE_SIZE=1048576,ProgramHeapImpl=class{offset=0;heap;handleTable;handleState;constructor(){this.heap=new Int32Array(PAGE_SIZE),this.handleTable=[],this.handleState=[]}entries(){return this.offset}pushRaw(e){this.sizeCheck(),this.heap[this.offset++]=e}pushOp(e){this.pushRaw(e)}pushMachine(e){this.pushRaw(e|MACHINE_MASK)}sizeCheck(){let{heap:e}=this;if(this.offset===this.heap.length){let t=new Int32Array(e.length+PAGE_SIZE);t.set(e,0),this.heap=t}}getbyaddr(e){return unwrap$1(this.heap[e])}setbyaddr(e,t){this.heap[e]=t}malloc(){return this.handleTable.push(this.offset),this.handleTable.length-1}finishMalloc(e){}size(){return this.offset}getaddr(e){return unwrap$1(this.handleTable[e])}sizeof(e){return sizeof(this.handleTable)}free(e){this.handleState[e]=FREED}compact(){let e=0,{handleTable:t,handleState:r,heap:n}=this;for(let i=0;i<length;i++){let o=unwrap$1(t[i]),s=unwrap$1(t[i+1])-unwrap$1(o),a=r[i];if(a!==PURGED)if(a===FREED)r[i]=PURGED,e+=s;else if(a===ALLOCATED){for(let t=o;t<=i+s;t++)n[t-e]=unwrap$1(n[t]);t[i]=o-e}else a===POINTER&&(t[i]=o-e)}this.offset=this.offset-e}},ProgramImpl=class{_opcode;constructor(e,t){this.constants=e,this.heap=t,this._opcode=new RuntimeOpImpl(this.heap)}opcode(e){return this._opcode.offset=e,this._opcode}};function sizeof(){return-1}var DEFAULT_TEMPLATE_BLOCK=[[[opcodes.Yield,1,null]],["&default"],[]],DEFAULT_TEMPLATE={id:"1b32f5c2-7623-43d6-a0ad-9672898920a1",moduleName:"__default__.hbs",block:JSON.stringify(DEFAULT_TEMPLATE_BLOCK),scope:null,isStrictMode:!0},WELL_KNOWN_EMPTY_ARRAY=Object.freeze([]),STARTER_CONSTANTS=constants(WELL_KNOWN_EMPTY_ARRAY),WELL_KNOWN_EMPTY_ARRAY_POSITION=STARTER_CONSTANTS.indexOf(WELL_KNOWN_EMPTY_ARRAY),ConstantsImpl=class{reifiedArrs={[WELL_KNOWN_EMPTY_ARRAY_POSITION]:WELL_KNOWN_EMPTY_ARRAY};defaultTemplate=templateFactory(DEFAULT_TEMPLATE)();helperDefinitionCount=0;modifierDefinitionCount=0;componentDefinitionCount=0;values=STARTER_CONSTANTS.slice();indexMap=new Map(this.values.map((e,t)=>[e,t]));helperDefinitionCache=new WeakMap;modifierDefinitionCache=new WeakMap;componentDefinitionCache=new WeakMap;value(e){let t=this.indexMap,r=t.get(e);return void 0===r&&(r=this.values.push(e)-1,t.set(e,r)),r}array(e){if(0===e.length)return WELL_KNOWN_EMPTY_ARRAY_POSITION;let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=this.value(e[r]);return this.value(t)}toPool(){return this.values}hasHandle(e){return this.values.length>e}helper(e,t=null,r){let n=this.helperDefinitionCache.get(e);if(void 0===n){let t=getInternalHelperManager(e,r);if(null===t)return this.helperDefinitionCache.set(e,null),null;let i="function"==typeof t?t:t.getHelper(e);n=this.value(i),this.helperDefinitionCache.set(e,n),this.helperDefinitionCount++}return n}modifier(e,t=null,r){let n=this.modifierDefinitionCache.get(e);if(void 0===n){let r=getInternalModifierManager(e);if(null===r)return this.modifierDefinitionCache.set(e,null),null;let i={resolvedName:t,manager:r,state:e};n=this.value(i),this.modifierDefinitionCache.set(e,n),this.modifierDefinitionCount++}return n}component(e,t,r,n){let i=this.componentDefinitionCache.get(e);if(void 0===i){let r=getInternalComponentManager(e);if(null===r)return this.componentDefinitionCache.set(e,null),null;let o,s=capabilityFlagsFrom(r.getCapabilities(e)),a=getComponentTemplate(e),l=null;o=managerHasCapability(r,s,InternalComponentCapabilities.dynamicLayout)?a?.(t):a?.(t)??this.defaultTemplate,void 0!==o&&(o=unwrapTemplate$1(o),l=managerHasCapability(r,s,InternalComponentCapabilities.wrapped)?o.asWrappedLayout():o.asLayout()),i={resolvedName:null,handle:-1,manager:r,capabilities:s,state:e,compilable:l},i.handle=this.value(i),n&&(i.debugName=n),this.componentDefinitionCache.set(e,i),this.componentDefinitionCount++}return i}resolvedComponent(e,t){let r=this.componentDefinitionCache.get(e);if(void 0===r){let{manager:n,state:i,template:o}=e,s=capabilityFlagsFrom(n.getCapabilities(e)),a=null;managerHasCapability(n,s,InternalComponentCapabilities.dynamicLayout)||(o=o??this.defaultTemplate),null!==o&&(o=unwrapTemplate$1(o),a=managerHasCapability(n,s,InternalComponentCapabilities.wrapped)?o.asWrappedLayout():o.asLayout()),r={resolvedName:t,handle:-1,manager:n,capabilities:s,state:i,compilable:a},r.handle=this.value(r),this.componentDefinitionCache.set(e,r),this.componentDefinitionCount++}return expect(r)}getValue(e){return this.values[e]}getArray(e){let t=this.reifiedArrs,r=t[e];if(void 0===r){let n=this.getValue(e);r=new Array(n.length);for(const[e,t]of enumerate(n))r[e]=this.getValue(t);t[e]=r}return r}};function artifacts(){return{constants:new ConstantsImpl,heap:new ProgramHeapImpl}}function setLocalDebugType(){}var CursorImpl=class{constructor(e,t){this.element=e,this.nextSibling=t,setLocalDebugType("cursor",this)}},ConcreteBounds=class{constructor(e,t,r){this.parentNode=e,this.first=t,this.last=r}parentElement(){return this.parentNode}firstNode(){return this.first}lastNode(){return this.last}};function move(e,t){let r=e.parentElement(),n=e.firstNode(),i=e.lastNode(),o=n;for(;;){let e=o.nextSibling;if(r.insertBefore(o,t),o===i)return e;o=expect(e)}}function clear$1(e){let t=e.parentElement(),r=e.firstNode(),n=e.lastNode(),i=r;for(;;){let e=i.nextSibling;if(t.removeChild(i),i===n)return e;i=expect(e)}}function normalizeStringValue(e){return isEmpty$4(e)?"":String(e)}function shouldCoerce(e){return isString(e)||isEmpty$4(e)||"boolean"==typeof e||"number"==typeof e}function isEmpty$4(e){return null==e||"function"!=typeof e.toString}function isIndexable$1(e){return null!==e&&"object"==typeof e}function isSafeString(e){return isIndexable$1(e)&&"function"==typeof e.toHTML}function isNode(e){return isIndexable$1(e)&&"number"==typeof e.nodeType}function isFragment(e){return isIndexable$1(e)&&11===e.nodeType}function isString(e){return"string"==typeof e}function castToSimple(e){return isDocument(e)||isSimpleElement(e),e}function castToBrowser(e){return e}var ELEMENT_NODE=1,DOCUMENT_NODE=9;function isDocument(e){return e.nodeType===DOCUMENT_NODE}function isSimpleElement(e){return e?.nodeType===ELEMENT_NODE}function normalizeProperty(e,t){let r,n;if(t in e)n=t,r="prop";else{let i=t.toLowerCase();i in e?(r="prop",n=i):(r="attr",n=t)}return"prop"!==r||"style"!==n.toLowerCase()&&!preferAttr(e.tagName,n)||(r="attr"),{normalized:n,type:r}}var ATTR_OVERRIDES={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}};function preferAttr(e,t){let r=ATTR_OVERRIDES[e.toUpperCase()];return!(!r||!r[t.toLowerCase()])}var NS_MATHML="http://www.w3.org/1998/Math/MathML",NS_SVG="http://www.w3.org/2000/svg",INSERT_BEFORE_BEGIN="beforebegin",INSERT_BEFORE_END="beforeend",SVG_INTEGRATION_POINTS={foreignObject:1,desc:1,title:1},BLACKLIST_TABLE=Object.create(null),DOMOperations=class{constructor(e){this.document=e,this.setupUselessElement()}setupUselessElement(){this.uselessElement=this.document.createElement("div")}createElement(e,t){let r,n,i,o;if(t?(r="http://www.w3.org/2000/svg"===t.namespaceURI||"svg"===e,i=t.namespaceURI===NS_MATHML||"math"===e,n=!!SVG_INTEGRATION_POINTS[t.tagName]):(r="svg"===e,i="math"===e,n=!1),!i&&!r||n)return this.document.createElement(e);if(BLACKLIST_TABLE[e])throw new Error(`Cannot create a ${e} inside an SVG context`);return o=i?NS_MATHML:NS_SVG,this.document.createElementNS(o,e)}insertBefore(e,t,r){e.insertBefore(t,r)}insertHTMLBefore(e,t,r){if(""===r){const r=this.createComment("");return e.insertBefore(r,t),new ConcreteBounds(e,r,r)}const n=t?t.previousSibling:e.lastChild;let i;if(null===t)e.insertAdjacentHTML(INSERT_BEFORE_END,r),i=expect(e.lastChild);else if(t instanceof HTMLElement)t.insertAdjacentHTML("beforebegin",r),i=expect(t.previousSibling);else{const{uselessElement:n}=this;e.insertBefore(n,t),n.insertAdjacentHTML(INSERT_BEFORE_BEGIN,r),i=expect(n.previousSibling),e.removeChild(n)}const o=expect(n?n.nextSibling:e.firstChild);return new ConcreteBounds(e,o,i)}createTextNode(e){return this.document.createTextNode(e)}createComment(e){return this.document.createComment(e)}},TreeConstruction=class extends DOMOperations{createElementNS(e,t){return this.document.createElementNS(e,t)}setAttribute(e,t,r,n=null){n?e.setAttributeNS(n,t,r):e.setAttribute(t,r)}},DOMTreeConstruction=TreeConstruction,badProtocols=["javascript:","vbscript:"],badTags=["A","BODY","LINK","IMG","IFRAME","BASE","FORM"],badTagsForDataURI=["EMBED"],badAttributes=["href","src","background","action"],badAttributesForDataURI=["src"],_protocolForUrlImplementation;function has$1(e,t){return-1!==e.indexOf(t)}function checkURI(e,t){return(null===e||has$1(badTags,e))&&has$1(badAttributes,t)}function checkDataURI(e,t){return null!==e&&has$1(badTagsForDataURI,e)&&has$1(badAttributesForDataURI,t)}function requiresSanitization(e,t){return checkURI(e,t)||checkDataURI(e,t)}function findProtocolForURL(){const e=URL;if("object"==typeof e&&null!==e&&"function"==typeof e.parse){let t=e;return e=>{let r=null;return"string"==typeof e&&(r=t.parse(e).protocol),null===r?":":r}}if("function"==typeof e)return t=>{try{return new e(t).protocol}catch{return":"}};throw new Error('@glimmer/runtime needs a valid "globalThis.URL"')}function protocolForUrl(e){return _protocolForUrlImplementation||(_protocolForUrlImplementation=findProtocolForURL()),_protocolForUrlImplementation(e)}function sanitizeAttributeValue(e,t,r){if(null==r)return r;if(isSafeString(r))return r.toHTML();const n=e.tagName.toUpperCase();let i=normalizeStringValue(r);if(checkURI(n,t)){let e=protocolForUrl(i);if(has$1(badProtocols,e))return`unsafe:${i}`}return checkDataURI(n,t)?`unsafe:${i}`:i}function dynamicAttribute(e,t,r){const{tagName:n,namespaceURI:i}=e,o={element:e,name:t,namespace:r};if("http://www.w3.org/2000/svg"===i)return buildDynamicAttribute(n,t,o);const{type:s,normalized:a}=normalizeProperty(e,t);return"attr"===s?buildDynamicAttribute(n,a,o):buildDynamicProperty(n,a,o)}function buildDynamicAttribute(e,t,r){return requiresSanitization(e,t)?new SafeDynamicAttribute(r):new SimpleDynamicAttribute(r)}function buildDynamicProperty(e,t,r){return requiresSanitization(e,t)?new SafeDynamicProperty(t,r):isUserInputValue(e,t)?new InputValueDynamicAttribute(t,r):isOptionSelected(e,t)?new OptionSelectedDynamicAttribute(t,r):new DefaultDynamicProperty(t,r)}var DynamicAttribute=class{constructor(e){this.attribute=e}},SimpleDynamicAttribute=class extends DynamicAttribute{set(e,t,r){const n=normalizeValue(t);if(null!==n){const{name:t,namespace:r}=this.attribute;e.__setAttribute(t,n,r)}}update(e,t){const r=normalizeValue(e),{element:n,name:i}=this.attribute;null===r?n.removeAttribute(i):n.setAttribute(i,r)}},DefaultDynamicProperty=class extends DynamicAttribute{constructor(e,t){super(t),this.normalizedName=e}value;set(e,t,r){null!=t&&(this.value=t,e.__setProperty(this.normalizedName,t))}update(e,t){const{element:r}=this.attribute;this.value!==e&&(r[this.normalizedName]=this.value=e,null==e&&this.removeAttribute())}removeAttribute(){const{element:e,namespace:t}=this.attribute;t?e.removeAttributeNS(t,this.normalizedName):e.removeAttribute(this.normalizedName)}},SafeDynamicProperty=class extends DefaultDynamicProperty{set(e,t,r){const{element:n,name:i}=this.attribute,o=sanitizeAttributeValue(n,i,t);super.set(e,o,r)}update(e,t){const{element:r,name:n}=this.attribute,i=sanitizeAttributeValue(r,n,e);super.update(i,t)}},SafeDynamicAttribute=class extends SimpleDynamicAttribute{set(e,t,r){const{element:n,name:i}=this.attribute,o=sanitizeAttributeValue(n,i,t);super.set(e,o,r)}update(e,t){const{element:r,name:n}=this.attribute,i=sanitizeAttributeValue(r,n,e);super.update(i,t)}},InputValueDynamicAttribute=class extends DefaultDynamicProperty{set(e,t){const r=normalizeStringValue(t);e.__setProperty("value",r),""===t&&"INPUT"===this.attribute.element.tagName&&e.__setAttribute("value","",null)}update(e){const t=castToBrowser(this.attribute.element),r=t.value,n=normalizeStringValue(e);r!==n&&(t.value=n)}},OptionSelectedDynamicAttribute=class extends DefaultDynamicProperty{set(e,t){null!=t&&!1!==t&&e.__setProperty("selected",!0)}update(e){castToBrowser(this.attribute.element).selected=!!e}};function isOptionSelected(e,t){return"OPTION"===e&&"selected"===t}function isUserInputValue(e,t){return("INPUT"===e||"TEXTAREA"===e)&&"value"===t}function normalizeValue(e){return!1===e||null==e||void 0===e.toString?null:!0===e?"":"function"==typeof e?null:String(e)}var First=class{constructor(e){this.node=e}firstNode(){return this.node}},Last=class{constructor(e){this.node=e}lastNode(){return this.node}},NewTreeBuilder=class{dom;updateOperations;constructing=null;operations=null;env;cursors=new StackImpl;modifierStack=new StackImpl;blockStack=new StackImpl;static forInitialRender(e,t){return new this(e,t.element,t.nextSibling).initialize()}static resume(e,t){let r=new this(e,t.parentElement(),t.reset(e)).initialize();return r.pushBlock(t),r}constructor(e,t,r){this.pushElement(t,r),this.env=e,this.dom=e.getAppendOperations(),this.updateOperations=e.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 expect(this.blockStack.current)}popElement(){this.cursors.pop(),expect(this.cursors.current)}pushAppendingBlock(){return this.pushBlock(new AppendingBlockImpl(this.element))}pushResettableBlock(){return this.pushBlock(new ResettableBlockImpl(this.element))}pushBlockList(e){return this.pushBlock(new AppendingBlockList(this.element,e))}pushBlock(e,t=!1){let r=this.blockStack.current;return null!==r&&(t||r.didAppendBounds(e)),this.__openBlock(),this.blockStack.push(e),e}popBlock(){return this.block().finalize(this),this.__closeBlock(),expect(this.blockStack.pop())}__openBlock(){}__closeBlock(){}openElement(e){let t=this.__openElement(e);return this.constructing=t,t}__openElement(e){return this.dom.createElement(e,this.element)}flushElement(e){let t=this.element,r=expect(this.constructing);this.__flushElement(t,r),this.constructing=null,this.operations=null,this.pushModifiers(e),this.pushElement(r,null),this.didOpenElement(r)}__flushElement(e,t){this.dom.insertBefore(e,t,this.nextSibling)}closeElement(){return this.willCloseElement(),this.popElement(),this.popModifiers()}pushRemoteElement(e,t,r){return this.__pushRemoteElement(e,t,r)}__pushRemoteElement(e,t,r){if(this.pushElement(e,r),void 0===r)for(;e.lastChild;)e.removeChild(e.lastChild);let n=new RemoteBlock(e);return this.pushBlock(n,!0)}popRemoteElement(){const e=this.popBlock();return this.popElement(),e}pushElement(e,t=null){this.cursors.push(new CursorImpl(e,t))}pushModifiers(e){this.modifierStack.push(e)}popModifiers(){return this.modifierStack.pop()}didAppendBounds(e){return this.block().didAppendBounds(e),e}didAppendNode(e){return this.block().didAppendNode(e),e}didOpenElement(e){return this.block().openElement(e),e}willCloseElement(){this.block().closeElement()}appendText(e){return this.didAppendNode(this.__appendText(e))}__appendText(e){let{dom:t,element:r,nextSibling:n}=this,i=t.createTextNode(e);return t.insertBefore(r,i,n),i}__appendNode(e){return this.dom.insertBefore(this.element,e,this.nextSibling),e}__appendFragment(e){let t=e.firstChild;if(t){let r=new ConcreteBounds(this.element,t,e.lastChild);return this.dom.insertBefore(this.element,e,this.nextSibling),r}{const e=this.__appendComment("");return new ConcreteBounds(this.element,e,e)}}__appendHTML(e){return this.dom.insertHTMLBefore(this.element,this.nextSibling,e)}appendDynamicHTML(e){let t=this.trustedContent(e);this.didAppendBounds(t)}appendDynamicText(e){let t=this.untrustedContent(e);return this.didAppendNode(t),t}appendDynamicFragment(e){let t=this.__appendFragment(e);this.didAppendBounds(t)}appendDynamicNode(e){let t=this.__appendNode(e),r=new ConcreteBounds(this.element,t,t);this.didAppendBounds(r)}trustedContent(e){return this.__appendHTML(e)}untrustedContent(e){return this.__appendText(e)}appendComment(e){return this.didAppendNode(this.__appendComment(e))}__appendComment(e){let{dom:t,element:r,nextSibling:n}=this,i=t.createComment(e);return t.insertBefore(r,i,n),i}__setAttribute(e,t,r){this.dom.setAttribute(this.constructing,e,t,r)}__setProperty(e,t){this.constructing[e]=t}setStaticAttribute(e,t,r){this.__setAttribute(e,t,r)}setDynamicAttribute(e,t,r,n){let i=dynamicAttribute(this.constructing,e,n,r);return i.set(this,t,this.env),i}},AppendingBlockImpl=class{first=null;last=null;nesting=0;constructor(e){this.parent=e,setLocalDebugType("block:simple",this)}parentElement(){return this.parent}firstNode(){return expect(this.first).firstNode()}lastNode(){return expect(this.last).lastNode()}openElement(e){this.didAppendNode(e),this.nesting++}closeElement(){this.nesting--}didAppendNode(e){0===this.nesting&&(this.first||(this.first=new First(e)),this.last=new Last(e))}didAppendBounds(e){0===this.nesting&&(this.first||(this.first=e),this.last=e)}finalize(e){null===this.first&&e.appendComment("")}},RemoteBlock=class extends AppendingBlockImpl{constructor(e){super(e),setLocalDebugType("block:remote",this),registerDestructor$1(this,()=>{this.parentElement()===this.firstNode().parentNode&&clear$1(this)})}},ResettableBlockImpl=class extends AppendingBlockImpl{constructor(e){super(e),setLocalDebugType("block:resettable",this)}reset(){destroy(this);let e=clear$1(this);return this.first=null,this.last=null,this.nesting=0,e}},AppendingBlockList=class{constructor(e,t){this.parent=e,this.boundList=t,this.parent=e,this.boundList=t}parentElement(){return this.parent}firstNode(){return expect(this.boundList[0]).firstNode()}lastNode(){let e=this.boundList;return expect(e[e.length-1]).lastNode()}openElement(e){}closeElement(){}didAppendNode(e){}didAppendBounds(e){}finalize(e){assert$3(this.boundList.length>0)}};function clientBuilder(e,t){return NewTreeBuilder.forInitialRender(e,t)}var CheckRegister=new class{validate(e){switch(e){case 4:case 5:case 3:case 2:case 1:case 0:case 6:case 7:case 8:return!0;default:return!1}}expected(){return"Register"}};function check(e){return e}var AppendOpcodes=class{evaluateOpcode=new Array(113).fill(null);constructor(){}add(e,t,r="syscall"){this.evaluateOpcode[e]={syscall:"machine"!==r,evaluate:t}}evaluate(e,t,r){let n=unwrap$1(this.evaluateOpcode[r]);n.syscall?(assert$3(!t.isMachine,`BUG: Mismatch between operation.syscall (${n.syscall}) and opcode.isMachine (${t.isMachine}) for ${t.type}`),n.evaluate(e,t)):(assert$3(t.isMachine,`BUG: Mismatch between operation.syscall (${n.syscall}) and opcode.isMachine (${t.isMachine}) for ${t.type}`),n.evaluate(e.lowlevel,t))}};function externs(){}var APPEND_OPCODES=new AppendOpcodes,TYPE=Symbol("TYPE"),INNER=Symbol("INNER"),OWNER=Symbol("OWNER"),ARGS=Symbol("ARGS"),RESOLVED=Symbol("RESOLVED"),CURRIED_VALUES=new WeakSet;function isCurriedValue(e){return CURRIED_VALUES.has(e)}function isCurriedType(e,t){return isCurriedValue(e)&&e[TYPE]===t}var CurriedValue=class{[TYPE];[INNER];[OWNER];[ARGS];[RESOLVED];constructor(e,t,r,n,i=!1){CURRIED_VALUES.add(this),this[TYPE]=e,this[INNER]=t,this[OWNER]=r,this[ARGS]=n,this[RESOLVED]=i}};function resolveCurriedValue(e){let t,r,n,i,o,s=e;for(;;){let{[ARGS]:e,[INNER]:a}=s;if(null!==e){let{named:n,positional:i}=e;i.length>0&&(t=void 0===t?i:i.concat(t)),void 0===r&&(r=[]),r.unshift(n)}if(!isCurriedValue(a)){n=a,i=s[OWNER],o=s[RESOLVED];break}s=a}return{definition:n,owner:i,resolved:o,positional:t,named:r}}function curry(e,t,r,n,i=!1){return new CurriedValue(e,t,r,n,i)}function hasCustomDebugRenderTreeLifecycle(e){return"getDebugCustomRenderTree"in e}function resolveComponent(e,t,r,n){let i=e?.lookupComponent?.(r,expect(n))??null;return t.resolvedComponent(i,r)}function createClassListRef(e){return createComputeRef(()=>{let t=[];for(const r of e){let e=normalizeStringValue("string"==typeof r?r:valueForRef(r));e&&t.push(e)}return 0===t.length?null:t.join(" ")})}APPEND_OPCODES.add(39,e=>e.pushChildScope()),APPEND_OPCODES.add(40,e=>e.popScope()),APPEND_OPCODES.add(59,e=>e.pushDynamicScope()),APPEND_OPCODES.add(60,e=>e.popDynamicScope()),APPEND_OPCODES.add(28,(e,{op1:t})=>{e.stack.push(e.constants.getValue(decodeHandle(t)))}),APPEND_OPCODES.add(29,(e,{op1:t})=>{e.stack.push(createConstRef(e.constants.getValue(decodeHandle(t))))}),APPEND_OPCODES.add(30,(e,{op1:t})=>{let r=e.stack;if(isHandle(t)){let n=e.constants.getValue(decodeHandle(t));r.push(n)}else r.push(decodeImmediate(t))}),APPEND_OPCODES.add(31,e=>{let t,r=e.stack,n=check(r.pop());t=void 0===n?UNDEFINED_REFERENCE:null===n?NULL_REFERENCE:!0===n?TRUE_REFERENCE:!1===n?FALSE_REFERENCE:createPrimitiveRef(n),r.push(t)}),APPEND_OPCODES.add(33,(e,{op1:t,op2:r})=>{let n=check(e.fetchValue(check(t,CheckRegister)))-r;e.stack.dup(n)}),APPEND_OPCODES.add(34,(e,{op1:t})=>{e.stack.pop(t)}),APPEND_OPCODES.add(35,(e,{op1:t})=>{e.load(check(t))}),APPEND_OPCODES.add(36,(e,{op1:t})=>{e.fetch(check(t))}),APPEND_OPCODES.add(58,(e,{op1:t})=>{let r=e.constants.getArray(t);e.bindDynamicScope(r)}),APPEND_OPCODES.add(69,(e,{op1:t})=>{e.enter(t)}),APPEND_OPCODES.add(70,e=>{e.exit()}),APPEND_OPCODES.add(63,(e,{op1:t})=>{e.stack.push(e.constants.getValue(t))}),APPEND_OPCODES.add(62,e=>{e.stack.push(e.scope())}),APPEND_OPCODES.add(61,e=>{let t=e.stack,r=t.pop();r?t.push(e.compile(r)):t.push(null)}),APPEND_OPCODES.add(64,e=>{let{stack:t}=e,r=check(t.pop()),n=check(t.pop()),i=check(t.pop()),o=check(t.pop());if(null===i||null===r)return e.lowlevel.pushFrame(),void e.pushScope(n??e.scope());let s=expect(n);{let e=i.parameters,t=e.length;if(t>0){s=s.child();for(let r=0;r<t;r++)s.bindSymbol(unwrap$1(e[r]),o.at(r))}}e.lowlevel.pushFrame(),e.pushScope(s),e.call(r)}),APPEND_OPCODES.add(65,(e,{op1:t})=>{let r=check(e.stack.pop()),n=Boolean(valueForRef(r));isConstRef(r)?n&&e.lowlevel.goto(t):(n&&e.lowlevel.goto(t),e.updateWith(new Assert(r)))}),APPEND_OPCODES.add(66,(e,{op1:t})=>{let r=check(e.stack.pop()),n=Boolean(valueForRef(r));isConstRef(r)?n||e.lowlevel.goto(t):(n||e.lowlevel.goto(t),e.updateWith(new Assert(r)))}),APPEND_OPCODES.add(67,(e,{op1:t,op2:r})=>{check(e.stack.peek())===r&&e.lowlevel.goto(t)}),APPEND_OPCODES.add(68,e=>{let t=check(e.stack.peek());isConstRef(t)||e.updateWith(new Assert(t))}),APPEND_OPCODES.add(71,e=>{let{stack:t}=e,r=check(t.pop());t.push(createComputeRef(()=>toBool$1(valueForRef(r))))});var Assert=class{last;constructor(e){this.ref=e,this.last=valueForRef(e)}evaluate(e){let{last:t,ref:r}=this;t!==valueForRef(r)&&e.throw()}},AssertFilter=class{last;constructor(e,t){this.ref=e,this.filter=t,this.last=t(valueForRef(e))}evaluate(e){let{last:t,ref:r,filter:n}=this;t!==n(valueForRef(r))&&e.throw()}},JumpIfNotModifiedOpcode=class{tag=CONSTANT_TAG;lastRevision=1;target;finalize(e,t){this.target=t,this.didModify(e)}evaluate(e){let{tag:t,target:r,lastRevision:n}=this;!e.alwaysRevalidate&&validateTag(t,n)&&(consumeTag(t),e.goto(expect(r)))}didModify(e){this.tag=e,this.lastRevision=valueForTag(this.tag),consumeTag(e)}},BeginTrackFrameOpcode=class{constructor(e){this.debugLabel=e}evaluate(){beginTrackFrame(this.debugLabel)}},EndTrackFrameOpcode=class{constructor(e){this.target=e}evaluate(){let e=endTrackFrame();this.target.didModify(e)}};APPEND_OPCODES.add(41,(e,{op1:t})=>{e.tree().appendText(e.constants.getValue(t))}),APPEND_OPCODES.add(42,(e,{op1:t})=>{e.tree().appendComment(e.constants.getValue(t))}),APPEND_OPCODES.add(48,(e,{op1:t})=>{e.tree().openElement(e.constants.getValue(t))}),APPEND_OPCODES.add(49,e=>{let t=check(valueForRef(check(e.stack.pop(),CheckReference)));e.tree().openElement(t)}),APPEND_OPCODES.add(50,e=>{let t=check(e.stack.pop()),r=check(e.stack.pop()),n=check(e.stack.pop()),i=check(valueForRef(t)),o=check(valueForRef(r)),s=valueForRef(n);isConstRef(t)||e.updateWith(new Assert(t)),void 0===o||isConstRef(r)||e.updateWith(new Assert(r));let a=e.tree().pushRemoteElement(i,s,o);if(e.associateDestroyable(a),void 0!==e.env.debugRenderTree){let n=createCapturedArgs(void 0===o?{}:{insertBefore:r},[t]);e.env.debugRenderTree.create(a,{type:"keyword",name:"in-element",args:n,instance:null}),registerDestructor$1(a,()=>{e.env.debugRenderTree?.willDestroy(a)})}}),APPEND_OPCODES.add(56,e=>{let t=e.tree().popRemoteElement();void 0!==e.env.debugRenderTree&&e.env.debugRenderTree.didRender(t,t)}),APPEND_OPCODES.add(54,e=>{let t=check(e.fetchValue(6)),r=null;t&&(r=t.flush(e),e.loadValue(6,null)),e.tree().flushElement(r)}),APPEND_OPCODES.add(55,e=>{let t=e.tree().closeElement();null!==t&&t.forEach(t=>{e.env.scheduleInstallModifier(t);const r=t.manager.getDestroyable(t.state);null!==r&&e.associateDestroyable(r)})}),APPEND_OPCODES.add(57,(e,{op1:t})=>{let r=check(e.stack.pop());if(!e.env.isInteractive)return;let n=e.getOwner(),i=e.constants.getValue(t),{manager:o}=i,{constructing:s}=e.tree(),a=r.capture(),l=o.create(n,expect(s),i.state,a),c={manager:o,state:l,definition:i};expect(check(e.fetchValue(6))).addModifier(e,c,a);let u=o.getTag(l);return null!==u?(consumeTag(u),e.updateWith(new UpdateModifierOpcode(u,c))):void 0}),APPEND_OPCODES.add(108,e=>{let{stack:t}=e,r=check(t.pop()),n=check(t.pop());if(!e.env.isInteractive)return;let i=n.capture(),{positional:o,named:s}=i,{constructing:a}=e.tree(),l=e.getOwner(),c=createComputeRef(()=>{let e,t,n=valueForRef(r);if(!isIndexable$2(n))return;if(isCurriedType(n,2)){let{definition:r,owner:a,positional:l,named:c}=resolveCurriedValue(n);t=r,e=a,void 0!==l&&(i.positional=l.concat(o)),void 0!==c&&(i.named=Object.assign({},...c,s))}else t=n,e=l;let c=getInternalModifierManager(t);if(null===c)throw new Error("BUG: modifier manager expected");let u={resolvedName:null,manager:c,state:t};return{manager:c,state:c.create(e,expect(a),u.state,i),definition:u}}),u=valueForRef(c),h=null;return void 0!==u&&(expect(check(e.fetchValue(6))).addModifier(e,u,i),h=u.manager.getTag(u.state),null!==h&&consumeTag(h)),!isConstRef(r)||h?e.updateWith(new UpdateDynamicModifierOpcode(h,u,c)):void 0});var UpdateModifierOpcode=class{lastUpdated;constructor(e,t){this.tag=e,this.modifier=t,this.lastUpdated=valueForTag(e)}evaluate(e){let{modifier:t,tag:r,lastUpdated:n}=this;consumeTag(r),validateTag(r,n)||(e.env.scheduleUpdateModifier(t),this.lastUpdated=valueForTag(r))}},UpdateDynamicModifierOpcode=class{lastUpdated;constructor(e,t,r){this.tag=e,this.instance=t,this.instanceRef=r,this.lastUpdated=valueForTag(e??CURRENT_TAG)}evaluate(e){let{tag:t,lastUpdated:r,instance:n,instanceRef:i}=this,o=valueForRef(i);if(o!==n){if(void 0!==n){let e=n.manager.getDestroyable(n.state);null!==e&&destroy(e)}if(void 0!==o){let{manager:r,state:n}=o,i=r.getDestroyable(n);null!==i&&associateDestroyableChild(this,i),t=r.getTag(n),null!==t&&(this.lastUpdated=valueForTag(t)),this.tag=t,e.env.scheduleInstallModifier(o)}this.instance=o}else null===t||validateTag(t,r)||(e.env.scheduleUpdateModifier(n),this.lastUpdated=valueForTag(t));null!==t&&consumeTag(t)}};APPEND_OPCODES.add(51,(e,{op1:t,op2:r,op3:n})=>{let i=e.constants.getValue(t),o=e.constants.getValue(r),s=n?e.constants.getValue(n):null;e.tree().setStaticAttribute(i,o,s)}),APPEND_OPCODES.add(52,(e,{op1:t,op2:r,op3:n})=>{let i=e.constants.getValue(t),o=e.constants.getValue(r),s=check(e.stack.pop()),a=valueForRef(s),l=n?e.constants.getValue(n):null,c=e.tree().setDynamicAttribute(i,a,o,l);isConstRef(s)||e.updateWith(new UpdateDynamicAttributeOpcode(s,c,e.env))});var UpdateDynamicAttributeOpcode=class{updateRef;constructor(e,t,r){let n=!1;this.updateRef=createComputeRef(()=>{let i=valueForRef(e);n?t.update(i,r):n=!0}),valueForRef(this.updateRef)}evaluate(){valueForRef(this.updateRef)}};APPEND_OPCODES.add(78,(e,{op1:t})=>{let r=e.constants.getValue(t),{manager:n,capabilities:i}=r,o={definition:r,manager:n,capabilities:i,state:null,handle:null,table:null,lookup:null};e.stack.push(o)}),APPEND_OPCODES.add(80,(e,{op1:t})=>{let r,n=e.stack,i=check(valueForRef(check(n.pop()))),o=e.constants,s=e.getOwner();o.getValue(t),e.loadValue(7,null),r="string"==typeof i?expect(resolveComponent(e.context.resolver,o,i,s)):isCurriedValue(i)?i:o.component(i,s),n.push(r)}),APPEND_OPCODES.add(81,e=>{let t,r=e.stack,n=valueForRef(check(r.pop())),i=e.constants;t=isCurriedValue(n)?n:i.component(n,e.getOwner(),!0),r.push(t)}),APPEND_OPCODES.add(79,e=>{let t,r,{stack:n}=e,i=n.pop();isCurriedValue(i)?r=t=null:(r=i.manager,t=i.capabilities),n.push({definition:i,capabilities:t,manager:r,state:null,handle:null,table:null})}),APPEND_OPCODES.add(82,(e,{op1:t,op2:r,op3:n})=>{let i=e.stack,o=e.constants.getArray(t),s=n>>4,a=8&n,l=7&n?e.constants.getArray(r):EMPTY_STRING_ARRAY;e.args.setup(i,o,l,s,!!a),i.push(e.args)}),APPEND_OPCODES.add(83,e=>{let{stack:t}=e;t.push(e.args.empty(t))}),APPEND_OPCODES.add(86,e=>{let t=e.stack,r=check(t.pop()).capture();t.push(r)}),APPEND_OPCODES.add(85,(e,{op1:t})=>{let r=e.stack,n=e.fetchValue(check(t)),i=check(r.pop()),{definition:o}=n;if(isCurriedType(o,0)){assert$3(!o.manager);let t=e.constants,{definition:r,owner:s,resolved:a,positional:l,named:c}=resolveCurriedValue(o);if(a)o=r;else if("string"==typeof r){let n=e.context.resolver?.lookupComponent?.(r,s)??null;o=t.resolvedComponent(expect(n),r)}else o=t.component(r,s);void 0!==c&&i.named.merge(assign({},...c)),void 0!==l&&(i.realloc(l.length),i.positional.prepend(l));let{manager:u}=o;n.definition=o,n.manager=u,n.capabilities=o.capabilities,e.loadValue(7,s)}let{manager:s,state:a}=o;if(!managerHasCapability(s,n.capabilities,InternalComponentCapabilities.prepareArgs))return void r.push(i);let l=i.blocks.values,c=i.blocks.names,u=s.prepareArgs(a,i);if(u){i.clear();for(let i=0;i<l.length;i++)r.push(l[i]);let{positional:e,named:t}=u,n=e.length;for(let i=0;i<n;i++)r.push(e[i]);let o=Object.keys(t);for(let i=0;i<o.length;i++)r.push(t[unwrap$1(o[i])]);i.setup(r,o,c,n,!1)}r.push(i)}),APPEND_OPCODES.add(87,(e,{op1:t})=>{let r=check(e.fetchValue(4)),{definition:n,manager:i,capabilities:o}=r;if(!managerHasCapability(i,o,InternalComponentCapabilities.createInstance))return;let s=null;managerHasCapability(i,o,InternalComponentCapabilities.dynamicScope)&&(s=e.dynamicScope());let a=1&t,l=null;managerHasCapability(i,o,InternalComponentCapabilities.createArgs)&&(l=check(e.stack.peek()));let c=null;managerHasCapability(i,o,InternalComponentCapabilities.createCaller)&&(c=e.getSelf());let u=i.create(e.getOwner(),n.state,l,e.env,s,c,!!a);r.state=u,managerHasCapability(i,o,InternalComponentCapabilities.updateHook)&&e.updateWith(new UpdateComponentOpcode(u,i,s))}),APPEND_OPCODES.add(88,(e,{op1:t})=>{let{manager:r,state:n,capabilities:i}=check(e.fetchValue(check(t,CheckRegister))),o=r.getDestroyable(n);o&&e.associateDestroyable(o)}),APPEND_OPCODES.add(97,(e,{op1:t})=>{e.beginCacheGroup(void 0),e.tree().pushAppendingBlock()}),APPEND_OPCODES.add(89,e=>{e.loadValue(6,new ComponentElementOperations)}),APPEND_OPCODES.add(53,(e,{op1:t,op2:r,op3:n})=>{let i=e.constants.getValue(t),o=e.constants.getValue(r),s=check(e.stack.pop()),a=n?e.constants.getValue(n):null;check(e.fetchValue(6),void 0).setAttribute(i,s,o,a)}),APPEND_OPCODES.add(105,(e,{op1:t,op2:r,op3:n})=>{let i=e.constants.getValue(t),o=e.constants.getValue(r),s=n?e.constants.getValue(n):null;check(e.fetchValue(6),void 0).setStaticAttribute(i,o,s)});var ComponentElementOperations=class{attributes=dict();classes=[];modifiers=[];setAttribute(e,t,r,n){let i={value:t,namespace:n,trusting:r};"class"===e&&this.classes.push(t),this.attributes[e]=i}setStaticAttribute(e,t,r){let n={value:t,namespace:r};"class"===e&&this.classes.push(t),this.attributes[e]=n}addModifier(e,t,r){if(this.modifiers.push(t),void 0!==e.env.debugRenderTree){const{manager:n,definition:i,state:o}=t;if(null===o||"object"!=typeof o&&"function"!=typeof o)return;let{element:s,constructing:a}=e.tree(),l=i.resolvedName??n.getDebugName(i.state),c=n.getDebugInstance(o),u=new ConcreteBounds(s,a,a);e.env.debugRenderTree.create(o,{type:"modifier",name:l,args:r,instance:c}),e.env.debugRenderTree.didRender(o,u),e.associateDestroyable(o),e.updateWith(new DebugRenderTreeUpdateOpcode(o)),e.updateWith(new DebugRenderTreeDidRenderOpcode(o,u)),registerDestructor$1(o,()=>{e.env.debugRenderTree?.willDestroy(o)})}}flush(e){let t,r=this.attributes;for(let n in this.attributes){if("type"===n){t=r[n];continue}let i=unwrap$1(this.attributes[n]);"class"===n?setDeferredAttr(e,"class",mergeClasses(this.classes),i.namespace,i.trusting):setDeferredAttr(e,n,i.value,i.namespace,i.trusting)}return void 0!==t&&setDeferredAttr(e,"type",t.value,t.namespace,t.trusting),this.modifiers}};function mergeClasses(e){return 0===e.length?"":1===e.length?unwrap$1(e[0]):allStringClasses(e)?e.join(" "):createClassListRef(e)}function allStringClasses(e){return e.every(e=>"string"==typeof e)}function setDeferredAttr(e,t,r,n,i=!1){if("string"==typeof r)e.tree().setStaticAttribute(t,r,n);else{let o=e.tree().setDynamicAttribute(t,valueForRef(r),i,n);isConstRef(r)||e.updateWith(new UpdateDynamicAttributeOpcode(r,o,e.env))}}function bindBlock(e,t,r,n,i){let o=r.table.symbols.indexOf(e),s=n.get(t);-1!==o&&i.scope().bindBlock(o+1,s),r.lookup&&(r.lookup[e]=s)}APPEND_OPCODES.add(99,(e,{op1:t})=>{let{definition:r,state:n}=check(e.fetchValue(check(t,CheckRegister))),{manager:i}=r,o=check(e.fetchValue(6));i.didCreateElement(n,expect(e.tree().constructing),o)}),APPEND_OPCODES.add(90,(e,{op1:t,op2:r})=>{let{definition:n,state:i}=check(e.fetchValue(check(t,CheckRegister))),{manager:o}=n,s=o.getSelf(i);if(void 0!==e.env.debugRenderTree){let n,o=check(e.fetchValue(check(t,CheckRegister))),{definition:a,manager:l}=o;if(e.stack.peek()===e.args)n=e.args.capture();else{let t=e.constants.getArray(r);e.args.setup(e.stack,t,[],0,!0),n=e.args.capture()}let c=a.compilable;if(null===c){assert$3(managerHasCapability(l,o.capabilities,InternalComponentCapabilities.dynamicLayout));let t=e.context.resolver;c=null===t?null:l.getDynamicLayout(i,t)}if(e.associateDestroyable(o),hasCustomDebugRenderTreeLifecycle(l))l.getDebugCustomRenderTree(o.definition.state,o.state,n).forEach(t=>{let{bucket:r}=t;e.env.debugRenderTree.create(r,t),registerDestructor$1(o,()=>{e.env.debugRenderTree?.willDestroy(r)}),e.updateWith(new DebugRenderTreeUpdateOpcode(r))});else{let t=getDebugName$1(a,l);e.env.debugRenderTree.create(o,{type:"component",name:t,args:n,instance:valueForRef(s)}),registerDestructor$1(o,()=>{e.env.debugRenderTree?.willDestroy(o)}),e.updateWith(new DebugRenderTreeUpdateOpcode(o))}}e.stack.push(s)}),APPEND_OPCODES.add(91,(e,{op1:t})=>{let{definition:r,state:n}=check(e.fetchValue(check(t,CheckRegister))),{manager:i}=r,o=i.getTagName(n);e.stack.push(o)}),APPEND_OPCODES.add(92,(e,{op1:t})=>{let r=check(e.fetchValue(check(t,CheckRegister))),{manager:n,definition:i}=r,{stack:o}=e,{compilable:s}=i;if(null===s){let{capabilities:t}=r;assert$3(managerHasCapability(n,t,InternalComponentCapabilities.dynamicLayout));let i=e.context.resolver;s=null===i?null:n.getDynamicLayout(r.state,i),null===s&&(s=managerHasCapability(n,t,InternalComponentCapabilities.wrapped)?unwrapTemplate$1(e.constants.defaultTemplate).asWrappedLayout():unwrapTemplate$1(e.constants.defaultTemplate).asLayout())}let a=s.compile(e.context);o.push(s.symbolTable),o.push(a)}),APPEND_OPCODES.add(75,(e,{op1:t})=>{let r=check(e.stack.pop()),n=check(e.stack.pop()),{manager:i,capabilities:o}=r,s={definition:r,manager:i,capabilities:o,state:null,handle:n.handle,table:n.symbolTable,lookup:null};e.loadValue(check(t),s)}),APPEND_OPCODES.add(95,(e,{op1:t})=>{let{stack:r}=e,n=check(r.pop()),i=check(r.pop()),o=check(e.fetchValue(check(t,CheckRegister)));o.handle=n,o.table=i}),APPEND_OPCODES.add(38,(e,{op1:t})=>{let r,{table:n,manager:i,capabilities:o,state:s}=check(e.fetchValue(check(t,CheckRegister)));managerHasCapability(i,o,InternalComponentCapabilities.hasSubOwner)?(r=i.getOwner(s),e.loadValue(7,null)):(r=e.fetchValue(7),null===r?r=e.getOwner():e.loadValue(7,null)),e.pushRootScope(n.symbols.length+1,r)}),APPEND_OPCODES.add(17,(e,{op1:t})=>{let r=check(e.fetchValue(check(t,CheckRegister))),n=e.scope(),i=check(e.stack.peek()),o=i.named.atNames;for(let s=o.length-1;s>=0;s--){let e=unwrap$1(o[s]),t=r.table.symbols.indexOf(e),a=i.named.get(e,!0);-1!==t&&n.bindSymbol(t+1,a),r.lookup&&(r.lookup[e]=a)}}),APPEND_OPCODES.add(18,(e,{op1:t})=>{let r=check(e.fetchValue(check(t,CheckRegister))),{blocks:n}=check(e.stack.peek());for(const[i]of enumerate(n.names))bindBlock(unwrap$1(n.symbolNames[i]),unwrap$1(n.names[i]),r,n,e)}),APPEND_OPCODES.add(96,(e,{op1:t})=>{let r=check(e.fetchValue(check(t,CheckRegister)));e.call(r.handle)}),APPEND_OPCODES.add(100,(e,{op1:t})=>{let r=check(e.fetchValue(check(t,CheckRegister))),{manager:n,state:i,capabilities:o}=r,s=e.tree().popBlock();void 0!==e.env.debugRenderTree&&(hasCustomDebugRenderTreeLifecycle(n)?n.getDebugCustomRenderTree(r.definition.state,i,EMPTY_ARGS).reverse().forEach(t=>{let{bucket:r}=t;e.env.debugRenderTree.didRender(r,s),e.updateWith(new DebugRenderTreeDidRenderOpcode(r,s))}):(e.env.debugRenderTree.didRender(r,s),e.updateWith(new DebugRenderTreeDidRenderOpcode(r,s)))),managerHasCapability(n,o,InternalComponentCapabilities.createInstance)&&(check(n).didRenderLayout(i,s),e.env.didCreate(r),e.updateWith(new DidUpdateLayoutOpcode(r,s)))}),APPEND_OPCODES.add(98,e=>{e.commitCacheGroup()});var UpdateComponentOpcode=class{constructor(e,t,r){this.component=e,this.manager=t,this.dynamicScope=r}evaluate(e){let{component:t,manager:r,dynamicScope:n}=this;r.update(t,n)}},DidUpdateLayoutOpcode=class{constructor(e,t){this.component=e,this.bounds=t}evaluate(e){let{component:t,bounds:r}=this,{manager:n,state:i}=t;n.didUpdateLayout(i,r),e.env.didUpdate(t)}},DebugRenderTreeUpdateOpcode=class{constructor(e){this.bucket=e}evaluate(e){e.env.debugRenderTree?.update(this.bucket)}},DebugRenderTreeDidRenderOpcode=class{constructor(e,t){this.bucket=e,this.bounds=t}evaluate(e){e.env.debugRenderTree?.didRender(this.bucket,this.bounds)}},ReferenceChecker=class{validate(e){return"object"==typeof e&&null!==e&&REFERENCE in e}expected(){return"Reference"}},CheckReference=new ReferenceChecker,VMArgumentsImpl=class{stack=null;positional=new PositionalArgumentsImpl;named=new NamedArgumentsImpl;blocks=new BlockArgumentsImpl;constructor(){setLocalDebugType("args",this)}empty(e){let t=e.registers[3]+1;return this.named.empty(e,t),this.positional.empty(e,t),this.blocks.empty(e,t),this}setup(e,t,r,n,i){this.stack=e;let o=this.named,s=t.length,a=e.registers[3]-s+1;o.setup(e,a,s,t,i);let l=a-n;this.positional.setup(e,l,n);let c=this.blocks,u=r.length,h=l-3*u;c.setup(e,h,u,r)}get base(){return this.blocks.base}get length(){return this.positional.length+this.named.length+3*this.blocks.length}at(e){return this.positional.at(e)}realloc(e){let{stack:t}=this;if(e>0&&null!==t){let{positional:r,named:n}=this,i=r.base+e;for(let e=r.length+n.length-1;e>=0;e--)t.copy(e+r.base,e+i);r.base+=e,n.base+=e,t.registers[3]+=e}}capture(){let e=0===this.positional.length?EMPTY_POSITIONAL:this.positional.capture();return{named:0===this.named.length?EMPTY_NAMED:this.named.capture(),positional:e}}clear(){let{stack:e,length:t}=this;t>0&&null!==e&&e.pop(t)}},EMPTY_REFERENCES=emptyArray(),PositionalArgumentsImpl=class{base=0;length=0;stack=null;_references=null;constructor(){setLocalDebugType("args:positional",this)}empty(e,t){this.stack=e,this.base=t,this.length=0,this._references=EMPTY_REFERENCES}setup(e,t,r){this.stack=e,this.base=t,this.length=r,this._references=0===r?EMPTY_REFERENCES:null}at(e){let{base:t,length:r,stack:n}=this;return e<0||e>=r?UNDEFINED_REFERENCE:check(n.get(e,t))}capture(){return this.references}prepend(e){let t=e.length;if(t>0){let{base:r,length:n,stack:i}=this;this.base=r-=t,this.length=n+t;for(let o=0;o<t;o++)i.set(e[o],o,r);this._references=null}}get references(){let e=this._references;if(!e){let{stack:t,base:r,length:n}=this;e=this._references=t.slice(r,r+n)}return e}},NamedArgumentsImpl=class{base=0;length=0;_references=null;_names=EMPTY_STRING_ARRAY;_atNames=EMPTY_STRING_ARRAY;constructor(){setLocalDebugType("args:named",this)}empty(e,t){this.stack=e,this.base=t,this.length=0,this._references=EMPTY_REFERENCES,this._names=EMPTY_STRING_ARRAY,this._atNames=EMPTY_STRING_ARRAY}setup(e,t,r,n,i){this.stack=e,this.base=t,this.length=r,0===r?(this._references=EMPTY_REFERENCES,this._names=EMPTY_STRING_ARRAY,this._atNames=EMPTY_STRING_ARRAY):(this._references=null,i?(this._names=null,this._atNames=n):(this._names=n,this._atNames=null))}get names(){let e=this._names;return e||(e=this._names=this._atNames.map(this.toSyntheticName)),e}get atNames(){let e=this._atNames;return e||(e=this._atNames=this._names.map(this.toAtName)),e}has(e){return-1!==this.names.indexOf(e)}get(e,t=!1){let{base:r,stack:n}=this,i=(t?this.atNames:this.names).indexOf(e);return-1===i?UNDEFINED_REFERENCE:n.get(i,r)}capture(){let{names:e,references:t}=this,r=dict();for(const[n,i]of enumerate(e))r[i]=unwrap$1(t[n]);return r}merge(e){let t=Object.keys(e);if(t.length>0){let{names:r,length:n,stack:i}=this,o=r.slice();for(const s of t)-1===o.indexOf(s)&&(n=o.push(s),i.push(e[s]));this.length=n,this._references=null,this._names=o,this._atNames=null}}get references(){let e=this._references;if(!e){let{base:t,length:r,stack:n}=this;e=this._references=n.slice(t,t+r)}return e}toSyntheticName(e){return e.slice(1)}toAtName(e){return`@${e}`}};function toSymbolName(e){return`&${e}`}var EMPTY_BLOCK_VALUES=emptyArray(),BlockArgumentsImpl=class{internalValues=null;_symbolNames=null;internalTag=null;names=EMPTY_STRING_ARRAY;length=0;base=0;constructor(){setLocalDebugType("args:blocks",this)}empty(e,t){this.stack=e,this.names=EMPTY_STRING_ARRAY,this.base=t,this.length=0,this._symbolNames=null,this.internalTag=CONSTANT_TAG,this.internalValues=EMPTY_BLOCK_VALUES}setup(e,t,r,n){this.stack=e,this.names=n,this.base=t,this.length=r,this._symbolNames=null,0===r?(this.internalTag=CONSTANT_TAG,this.internalValues=EMPTY_BLOCK_VALUES):(this.internalTag=null,this.internalValues=null)}get values(){let e=this.internalValues;if(!e){let{base:t,length:r,stack:n}=this;e=this.internalValues=n.slice(t,t+3*r)}return e}has(e){return-1!==this.names.indexOf(e)}get(e){let t=this.names.indexOf(e);if(-1===t)return null;let{base:r,stack:n}=this,i=check(n.get(3*t,r)),o=check(n.get(3*t+1,r)),s=check(n.get(3*t+2,r));return null===s?null:[s,o,i]}capture(){return new CapturedBlockArgumentsImpl(this.names,this.values)}get symbolNames(){let e=this._symbolNames;return null===e&&(e=this._symbolNames=this.names.map(toSymbolName)),e}},CapturedBlockArgumentsImpl=class{length;constructor(e,t){this.names=e,this.values=t,this.length=e.length}has(e){return-1!==this.names.indexOf(e)}get(e){let t=this.names.indexOf(e);return-1===t?null:[this.values[3*t+2],this.values[3*t+1],this.values[3*t]]}};function createCapturedArgs(e,t){return{named:e,positional:t}}function reifyNamed(e){let t=dict();for(const[r,n]of Object.entries(e))t[r]=valueForRef(n);return t}function reifyPositional(e){return e.map(valueForRef)}function reifyArgs(e){return{named:reifyNamed(e.named),positional:reifyPositional(e.positional)}}var ARGUMENT_ERROR=Symbol("ARGUMENT_ERROR");function isArgumentError(e){return null!==e&&"object"==typeof e&&e[ARGUMENT_ERROR]}function ArgumentErrorImpl(e){return{[ARGUMENT_ERROR]:!0,error:e}}function reifyNamedDebug(e){let t=dict();for(const[n,i]of Object.entries(e))try{t[n]=valueForRef(i)}catch(r){t[n]=ArgumentErrorImpl(r)}return t}function reifyPositionalDebug(e){return e.map(e=>{try{return valueForRef(e)}catch(t){return ArgumentErrorImpl(t)}})}function reifyArgsDebug(e){return{named:reifyNamedDebug(e.named),positional:reifyPositionalDebug(e.positional)}}var EMPTY_NAMED=Object.freeze(Object.create(null)),EMPTY_POSITIONAL=EMPTY_REFERENCES,EMPTY_ARGS=createCapturedArgs(EMPTY_NAMED,EMPTY_POSITIONAL),GUID=0,Ref=class{id=GUID++;value;constructor(e){this.value=e}get(){return this.value}release(){this.value=null}toString(){let e=`Ref ${this.id}`;if(null===this.value)return`${e} (released)`;try{return`${e}: ${this.value}`}catch{return e}}},DebugRenderTreeImpl=class{stack=new StackImpl;refs=new WeakMap;roots=new Set;nodes=new WeakMap;begin(){this.reset()}create(e,t){let r=assign({},t,{bounds:null,refs:new Set});this.nodes.set(e,r),this.appendChild(r,e),this.enter(e)}update(e){this.enter(e)}didRender(e,t){this.nodeFor(e).bounds=t,this.exit()}willDestroy(e){expect(this.refs.get(e)).release()}commit(){this.reset()}capture(){return this.captureRefs(this.roots)}reset(){if(0!==this.stack.size){let e=expect(this.stack.toArray()[0]),t=this.refs.get(e);for(void 0!==t&&this.roots.delete(t);!this.stack.isEmpty();)this.stack.pop()}}enter(e){this.stack.push(e)}exit(){this.stack.pop()}nodeFor(e){return expect(this.nodes.get(e))}appendChild(e,t){let r=this.stack.current,n=new Ref(t);if(this.refs.set(t,n),r){let t=this.nodeFor(r);t.refs.add(n),e.parent=t}else this.roots.add(n)}captureRefs(e){let t=[];return e.forEach(r=>{let n=r.get();n?t.push(this.captureNode(`render-node:${r.id}`,n)):e.delete(r)}),t}captureNode(e,t){let r=this.nodeFor(t),{type:n,name:i,args:o,instance:s,refs:a}=r,l=this.captureBounds(r),c=this.captureRefs(a);return{id:e,type:n,name:i,args:reifyArgsDebug(o),instance:s,bounds:l,children:c}}captureBounds(e){let t=expect(e.bounds);return{parentElement:t.parentElement(),firstNode:t.firstNode(),lastNode:t.lastNode()}}};function getDebugName$1(e,t=e.manager){return e.resolvedName??e.debugName??t.getDebugName(e.state)}var reference_exports=__exportAll({FALSE_REFERENCE:()=>FALSE_REFERENCE,NULL_REFERENCE:()=>NULL_REFERENCE,REFERENCE:()=>REFERENCE,TRUE_REFERENCE:()=>TRUE_REFERENCE,UNDEFINED_REFERENCE:()=>UNDEFINED_REFERENCE,childRefFor:()=>childRefFor,childRefFromParts:()=>childRefFromParts,createComputeRef:()=>createComputeRef,createConstRef:()=>createConstRef,createDebugAliasRef:()=>createDebugAliasRef,createInvokableRef:()=>createInvokableRef,createIteratorItemRef:()=>createIteratorItemRef,createIteratorRef:()=>createIteratorRef,createPrimitiveRef:()=>createPrimitiveRef,createReadOnlyRef:()=>createReadOnlyRef,createUnboundRef:()=>createUnboundRef,isConstRef:()=>isConstRef,isInvokableRef:()=>isInvokableRef,isUpdatableRef:()=>isUpdatableRef,updateRef:()=>updateRef,valueForRef:()=>valueForRef}),NULL_IDENTITY={},KEY=(e,t)=>t,INDEX=(e,t)=>String(t),IDENTITY=e=>null===e?NULL_IDENTITY:e;function keyForPath(e){return uniqueKeyFor(t=>null==t?t:getPath(t,e))}function makeKeyFor(e){switch(e){case"@key":return uniqueKeyFor(KEY);case"@index":return uniqueKeyFor(INDEX);case"@identity":return uniqueKeyFor(IDENTITY);default:return keyForPath(e)}}var WeakMapWithPrimitives=class{_weakMap;_primitiveMap;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(e,t){isIndexable$2(e)?this.weakMap.set(e,t):this.primitiveMap.set(e,t)}get(e){return isIndexable$2(e)?this.weakMap.get(e):this.primitiveMap.get(e)}},IDENTITIES=new WeakMapWithPrimitives;function identityForNthOccurence(e,t){let r=IDENTITIES.get(e);void 0===r&&(r=[],IDENTITIES.set(e,r));let n=r[t];return void 0===n&&(n={value:e,count:t},r[t]=n),n}function uniqueKeyFor(e){let t=new WeakMapWithPrimitives;return(r,n)=>{let i=e(r,n),o=t.get(i)||0;return t.set(i,o+1),0===o?i:identityForNthOccurence(i,o)}}function createIteratorRef(e,t){return createComputeRef(()=>{let r=valueForRef(e),n=makeKeyFor(t);if(Array.isArray(r))return new ArrayIterator$1(r,n);let i=toIterator$1(r);return null===i?new ArrayIterator$1(EMPTY_ARRAY$2,()=>null):new IteratorWrapper(i,n)})}function createIteratorItemRef(e){let t=e,r=createTag();return createComputeRef(()=>(consumeTag(r),t),e=>{t!==e&&(t=e,DIRTY_TAG$1(r))})}var IteratorWrapper=class{constructor(e,t){this.inner=e,this.keyFor=t}isEmpty(){return this.inner.isEmpty()}next(){let e=this.inner.next();return null!==e&&(e.key=this.keyFor(e.value,e.memo)),e}},ArrayIterator$1=class{current;pos=0;constructor(e,t){this.iterator=e,this.keyFor=t,0===e.length?this.current={kind:"empty"}:this.current={kind:"first",value:e[this.pos]}}isEmpty(){return"empty"===this.current.kind}next(){let e,t=this.current;if("first"===t.kind)this.current={kind:"progress"},e=t.value;else{if(this.pos>=this.iterator.length-1)return null;e=this.iterator[++this.pos]}let{keyFor:r}=this;return{key:r(e,this.pos),value:e,memo:this.pos}}};function debugCallback(e,t){console.info("Use `context`, and `get(<path>)` to debug this template."),t("this")}var callback=debugCallback;function setDebuggerCallback(e){callback=e}function resetDebuggerCallback(){callback=debugCallback}var ScopeInspector=class{#h;constructor(e,t){this.scope=e,this.#h=t}get(e){let t,{scope:r}=this,n=this.#h,i=e.split("."),[o,...s]=e.split(".");return"this"===o?t=r.getSelf():n.locals[o]?t=unwrap$1(r.getSymbol(n.locals[o])):(t=this.scope.getSelf(),s=i),s.reduce((e,t)=>childRefFor(e,t),t)}};APPEND_OPCODES.add(103,(e,{op1:t})=>{let r=e.constants.getValue(decodeHandle(t)),n=new ScopeInspector(e.scope(),r);callback(valueForRef(e.getSelf()),e=>valueForRef(n.get(e)))}),["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(e=>BLACKLIST_TABLE[e]=1);var WHITESPACE=/[\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;function isWhitespace(e){return WHITESPACE.test(e)}var DOMChangesImpl=class extends DOMOperations{namespace;constructor(e){super(e),this.document=e,this.namespace=null}setAttribute(e,t,r){e.setAttribute(t,r)}removeAttribute(e,t){e.removeAttribute(t)}insertAfter(e,t,r){this.insertBefore(e,t,r.nextSibling)}},DOMChanges=DOMChangesImpl,DynamicScopeImpl=class e{bucket;constructor(e){this.bucket=e?assign({},e):{}}get(e){return unwrap$1(this.bucket[e])}set(e,t){return this.bucket[e]=t}child(){return new e(this.bucket)}},ScopeImpl=class e{static root(t,{self:r,size:n=0}){let i=new Array(n+1).fill(UNDEFINED_REFERENCE);return new e(t,i,null).init({self:r})}static sized(t,r=0){let n=new Array(r+1).fill(UNDEFINED_REFERENCE);return new e(t,n,null)}owner;slots;callerScope;constructor(e,t,r){this.owner=e,this.slots=t,this.callerScope=r}init({self:e}){return this.slots[0]=e,this}snapshot(){return this.slots.slice()}getSelf(){return this.get(0)}getSymbol(e){return this.get(e)}getBlock(e){let t=this.get(e);return t===UNDEFINED_REFERENCE?null:t}bind(e,t){this.set(e,t)}bindSelf(e){this.set(0,e)}bindSymbol(e,t){this.set(e,t)}bindBlock(e,t){this.set(e,t)}bindCallerScope(e){this.callerScope=e}getCallerScope(){return this.callerScope}child(){return new e(this.owner,this.slots.slice(),this.callerScope)}get(e){if(e>=this.slots.length)throw new RangeError(`BUG: cannot get $${e} from scope; length=${this.slots.length}`);return this.slots[e]}set(e,t){if(e>=this.slots.length)throw new RangeError(`BUG: cannot get $${e} from scope; length=${this.slots.length}`);this.slots[e]=t}},TRANSACTION=Symbol("TRANSACTION"),TransactionImpl=class{scheduledInstallModifiers=[];scheduledUpdateModifiers=[];createdComponents=[];updatedComponents=[];didCreate(e){this.createdComponents.push(e)}didUpdate(e){this.updatedComponents.push(e)}scheduleInstallModifier(e){this.scheduledInstallModifiers.push(e)}scheduleUpdateModifier(e){this.scheduledUpdateModifiers.push(e)}commit(){let{createdComponents:e,updatedComponents:t}=this;for(const{manager:i,state:o}of e)i.didCreate(o);for(const{manager:i,state:o}of t)i.didUpdate(o);let{scheduledInstallModifiers:r,scheduledUpdateModifiers:n}=this;for(const{manager:i,state:o,definition:s}of r){let e=i.getTag(o);if(null!==e){let t=track(()=>i.install(o));UPDATE_TAG(e,t)}else i.install(o)}for(const{manager:i,state:o,definition:s}of n){let e=i.getTag(o);if(null!==e){let t=track(()=>i.update(o));UPDATE_TAG(e,t)}else i.update(o)}}},EnvironmentImpl=class{[TRANSACTION]=null;updateOperations;isInteractive;isArgumentCaptureError;debugRenderTree;constructor(e,t){this.delegate=t,this.isInteractive=t.isInteractive,this.debugRenderTree=this.delegate.enableDebugTooling?new DebugRenderTreeImpl:void 0,this.isArgumentCaptureError=this.delegate.enableDebugTooling?isArgumentError:void 0,e.appendOperations?(this.appendOperations=e.appendOperations,this.updateOperations=e.updateOperations):e.document&&(this.appendOperations=new DOMTreeConstruction(e.document),this.updateOperations=new DOMChangesImpl(e.document))}getAppendOperations(){return this.appendOperations}getDOM(){return expect(this.updateOperations)}begin(){assert$3(!this[TRANSACTION]),this.debugRenderTree?.begin(),this[TRANSACTION]=new TransactionImpl}get transaction(){return expect(this[TRANSACTION])}didCreate(e){this.transaction.didCreate(e)}didUpdate(e){this.transaction.didUpdate(e)}scheduleInstallModifier(e){this.isInteractive&&this.transaction.scheduleInstallModifier(e)}scheduleUpdateModifier(e){this.isInteractive&&this.transaction.scheduleUpdateModifier(e)}commit(){let e=this.transaction;this[TRANSACTION]=null,e.commit(),this.debugRenderTree?.commit(),this.delegate.onTransactionCommit()}};function runtimeOptions(e,t,r,n){return{env:new EnvironmentImpl(e,t),program:new ProgramImpl(r.constants,r.heap),resolver:n}}function inTransaction(e,t){if(e[TRANSACTION])t();else{e.begin();try{t()}finally{e.commit()}}}function createCurryRef(e,t,r,n){let i,o;return createComputeRef(()=>{let s=valueForRef(t);return s===i||(o=isCurriedType(s,e)?n?curry(e,s,r,n):n:0===e&&"string"==typeof s&&s||isIndexable$2(s)?curry(e,s,r,n):null,i=s),o})}function createConcatRef(e){return createComputeRef(()=>{const t=[];for(const r of e){const e=valueForRef(r);null!=e&&t.push(castToString(e))}return t.length>0?t.join(""):null})}function castToString(e){return"string"==typeof e?e:"function"!=typeof e.toString?"":String(e)}function resolveHelper(e){let t,r=getInternalHelperManager(e,!0);return t=null===r?null:"function"==typeof r?r:r.getHelper(e),t}function isUndefinedReference(e){return e===UNDEFINED_REFERENCE}APPEND_OPCODES.add(77,(e,{op1:t,op2:r})=>{let n=e.stack,i=check(n.pop()),o=check(n.pop()),s=e.getOwner();e.context.resolver,e.loadValue(8,createCurryRef(t,i,s,o))}),APPEND_OPCODES.add(107,e=>{let t,r=e.stack,n=check(r.pop()),i=check(r.pop()).capture(),o=e.getOwner(),s=createComputeRef(()=>{void 0!==t&&destroy(t);let e=valueForRef(n);if(isCurriedType(e,1)){let{definition:r,owner:n,positional:o,named:a}=resolveCurriedValue(e),l=resolveHelper(r);void 0!==a&&(i.named=assign({},...a,i.named)),void 0!==o&&(i.positional=o.concat(i.positional)),t=l(i,n),associateDestroyableChild(s,t)}else isIndexable$2(e)?(t=resolveHelper(e)(i,o),_hasDestroyableChildren(t)&&associateDestroyableChild(s,t)):t=UNDEFINED_REFERENCE}),a=createComputeRef(()=>(valueForRef(s),valueForRef(t)));e.associateDestroyable(s),e.loadValue(8,a)}),APPEND_OPCODES.add(16,(e,{op1:t})=>{let r=e.stack,n=check(e.constants.getValue(t))(check(r.pop()).capture(),e.getOwner(),e.dynamicScope());_hasDestroyableChildren(n)&&e.associateDestroyable(n),e.loadValue(8,n)}),APPEND_OPCODES.add(21,(e,{op1:t})=>{let r=e.referenceForSymbol(t);e.stack.push(r)}),APPEND_OPCODES.add(19,(e,{op1:t})=>{let r=check(e.stack.pop());e.scope().bindSymbol(t,r)}),APPEND_OPCODES.add(20,(e,{op1:t})=>{let r=check(e.stack.pop()),n=check(e.stack.pop()),i=check(e.stack.pop());e.scope().bindBlock(t,[r,n,i])}),APPEND_OPCODES.add(37,(e,{op1:t})=>{e.pushRootScope(t,e.getOwner())}),APPEND_OPCODES.add(22,(e,{op1:t})=>{let r=e.constants.getValue(t),n=check(e.stack.pop());e.stack.push(childRefFor(n,r))}),APPEND_OPCODES.add(23,(e,{op1:t})=>{let{stack:r}=e,n=e.scope().getBlock(t);r.push(n)}),APPEND_OPCODES.add(24,e=>{let{stack:t}=e,r=check(t.pop());if(r&&!isUndefinedReference(r)){let[e,n,i]=r;t.push(i),t.push(n),t.push(e)}else t.push(null),t.push(null),t.push(null)}),APPEND_OPCODES.add(25,e=>{let{stack:t}=e,r=check(t.pop());r&&!isUndefinedReference(r)?t.push(TRUE_REFERENCE):t.push(FALSE_REFERENCE)}),APPEND_OPCODES.add(26,e=>{e.stack.pop(),e.stack.pop();let t=check(e.stack.pop()),r=t&&t.parameters.length;e.stack.push(r?TRUE_REFERENCE:FALSE_REFERENCE)}),APPEND_OPCODES.add(27,(e,{op1:t})=>{let r=new Array(t);for(let n=t;n>0;n--)r[n-1]=check(e.stack.pop());e.stack.push(createConcatRef(r))}),APPEND_OPCODES.add(109,e=>{let t=check(e.stack.pop()),r=check(e.stack.pop()),n=check(e.stack.pop());e.stack.push(createComputeRef(()=>toBool$1(valueForRef(t))?valueForRef(r):valueForRef(n)))}),APPEND_OPCODES.add(110,e=>{let t=check(e.stack.pop());e.stack.push(createComputeRef(()=>!toBool$1(valueForRef(t))))}),APPEND_OPCODES.add(111,e=>{let t=e.dynamicScope(),r=e.stack,n=check(r.pop());r.push(createComputeRef(()=>{let e=String(valueForRef(n));return valueForRef(t.get(e))}))}),APPEND_OPCODES.add(112,e=>{let{positional:t}=check(e.stack.pop()).capture();e.loadValue(8,createComputeRef(()=>{console.log(...reifyPositional(t))}))});var DynamicTextContent=class{constructor(e,t,r){this.node=e,this.reference=t,this.lastValue=r}evaluate(){let e,t=valueForRef(this.reference),{lastValue:r}=this;t!==r&&(e=isEmpty$4(t)?"":isString(t)?t:String(t),e!==r)&&(this.node.nodeValue=this.lastValue=e)}};function toContentType(e){return shouldCoerce(e)?ContentType.String:isCurriedType(e,0)||hasInternalComponentManager(e)?ContentType.Component:isCurriedType(e,1)||hasInternalHelperManager(e)?ContentType.Helper:isSafeString(e)?ContentType.SafeString:isFragment(e)?ContentType.Fragment:isNode(e)?ContentType.Node:ContentType.String}function toDynamicContentType(e){return isIndexable$2(e)?isCurriedType(e,0)||hasInternalComponentManager(e)?ContentType.Component:ContentType.Helper:ContentType.String}function initializeRegistersWithSP(e){return[0,-1,e,0]}APPEND_OPCODES.add(76,e=>{let t=check(e.stack.peek());e.stack.push(toContentType(valueForRef(t))),isConstRef(t)||e.updateWith(new AssertFilter(t,toContentType))}),APPEND_OPCODES.add(106,e=>{let t=check(e.stack.peek());e.stack.push(toDynamicContentType(valueForRef(t))),isConstRef(t)||e.updateWith(new AssertFilter(t,toDynamicContentType))}),APPEND_OPCODES.add(43,e=>{let t=valueForRef(check(e.stack.pop())),r=isEmpty$4(t)?"":String(t);e.tree().appendDynamicHTML(r)}),APPEND_OPCODES.add(44,e=>{let t=check(e.stack.pop()),r=check(valueForRef(t)).toHTML(),n=isEmpty$4(r)?"":check(r);e.tree().appendDynamicHTML(n)}),APPEND_OPCODES.add(47,e=>{let t=check(e.stack.pop()),r=valueForRef(t),n=isEmpty$4(r)?"":String(r),i=e.tree().appendDynamicText(n);isConstRef(t)||e.updateWith(new DynamicTextContent(i,t,n))}),APPEND_OPCODES.add(45,e=>{let t=check(e.stack.pop()),r=check(valueForRef(t));e.tree().appendDynamicFragment(r)}),APPEND_OPCODES.add(46,e=>{let t=check(e.stack.pop()),r=check(valueForRef(t));e.tree().appendDynamicNode(r)}),APPEND_OPCODES.add(72,(e,{op1:t,op2:r})=>{let n=e.stack,i=check(n.pop()),o=valueForRef(check(n.pop())),s=createIteratorRef(i,null===o?"@identity":String(o)),a=valueForRef(s);e.updateWith(new AssertFilter(s,e=>e.isEmpty())),a.isEmpty()?e.lowlevel.goto(r+1):(e.enterList(s,t),e.stack.push(a))}),APPEND_OPCODES.add(73,e=>{e.exitList()}),APPEND_OPCODES.add(74,(e,{op1:t})=>{let r=check(e.stack.peek()).next();null!==r?e.registerItem(e.enterItem(r)):e.lowlevel.goto(t)});var LowLevelVM=class{currentOpSize=0;registers;context;constructor(e,t,r,n){this.stack=e,this.externs=r,this.context=t,this.registers=n}fetchRegister(e){return this.registers[e]}loadRegister(e,t){this.registers[e]=t}setPc(e){this.registers[0]=e}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(e){this.setPc(this.target(e))}target(e){return this.registers[0]+e-this.currentOpSize}call(e){this.registers[1]=this.registers[0],this.setPc(this.context.program.heap.getaddr(e))}returnTo(e){this.registers[1]=this.target(e)}return(){this.setPc(this.registers[1])}nextStatement(){let{registers:e,context:t}=this,r=e[0];if(-1===r)return null;let n=t.program.opcode(r),i=this.currentOpSize=n.size;return this.registers[0]+=i,n}evaluateOuter(e,t){this.evaluateInner(e,t)}evaluateInner(e,t){e.isMachine?this.evaluateMachine(e,t):this.evaluateSyscall(e,t)}evaluateMachine(e,t){switch(e.type){case 0:return void this.pushFrame();case 1:return void this.popFrame();case 3:return void this.call(e.op1);case 2:return void t.call(this.stack.pop());case 4:return void this.goto(e.op1);case 5:return void t.return();case 6:return void this.returnTo(e.op1)}}evaluateSyscall(e,t){APPEND_OPCODES.evaluate(t,e,e.type)}},UpdatingVM=class{env;dom;alwaysRevalidate;frameStack=new StackImpl;constructor(e,{alwaysRevalidate:t=!1}){this.env=e,this.dom=e.getDOM(),this.alwaysRevalidate=t}execute(e,t){this._execute(e,t)}_execute(e,t){let{frameStack:r}=this;for(this.try(e,t);!r.isEmpty();){let e=this.frame.nextStatement();void 0!==e?e.evaluate(this):r.pop()}}get frame(){return expect(this.frameStack.current)}goto(e){this.frame.goto(e)}try(e,t){this.frameStack.push(new UpdatingVMFrame(e,t))}throw(){this.frame.handleException(),this.frameStack.pop()}},BlockOpcode=class{children;bounds;constructor(e,t,r,n){this.state=e,this.context=t,this.children=n,this.bounds=r}parentElement(){return this.bounds.parentElement()}firstNode(){return this.bounds.firstNode()}lastNode(){return this.bounds.lastNode()}evaluate(e){e.try(this.children,null)}},TryOpcode=class extends BlockOpcode{type="try";evaluate(e){e.try(this.children,this)}handleException(){let{state:e,bounds:t,context:{env:r}}=this;destroyChildren(this);let n=NewTreeBuilder.resume(r,t),i=e.evaluate(n),o=this.children=[],s=i.execute(e=>{e.updateWith(this),e.pushUpdating(o)});associateDestroyableChild(this,s.drop)}},ListItemOpcode=class extends TryOpcode{retained=!1;index=-1;constructor(e,t,r,n,i,o){super(e,t,r,[]),this.key=n,this.memo=i,this.value=o}shouldRemove(){return!this.retained}reset(){this.retained=!1}},ListBlockOpcode=class extends BlockOpcode{type="list-block";opcodeMap=new Map;marker=null;lastIterator;constructor(e,t,r,n,i){super(e,t,r,n),this.iterableRef=i,this.lastIterator=valueForRef(i)}initializeChild(e){e.index=this.children.length-1,this.opcodeMap.set(e.key,e)}evaluate(e){let t=valueForRef(this.iterableRef);if(this.lastIterator!==t){let{bounds:r}=this,{dom:n}=e,i=this.marker=n.createComment("");n.insertAfter(r.parentElement(),i,expect(r.lastNode())),this.sync(t),this.parentElement().removeChild(i),this.marker=null,this.lastIterator=t}super.evaluate(e)}sync(e){let{opcodeMap:t,children:r}=this,n=0,i=0;for(this.children=this.bounds.boundList=[];;){let o=e.next();if(null===o)break;let s=r[n],{key:a}=o;for(;void 0!==s&&s.retained;)s=r[++n];if(void 0!==s&&s.key===a)this.retainItem(s,o),n++;else if(t.has(a)){let e=t.get(a);if(e.index<i)this.moveItem(e,o,s);else{i=e.index;let t=!1;for(let e=n+1;e<i;e++)if(!unwrap$1(r[e]).retained){t=!0;break}t?(this.moveItem(e,o,s),n++):(this.retainItem(e,o),n=i+1)}}else this.insertItem(o,s)}for(const o of r)o.retained?o.reset():this.deleteItem(o)}retainItem(e,t){let{children:r}=this;updateRef(e.memo,t.memo),updateRef(e.value,t.value),e.retained=!0,e.index=r.length,r.push(e)}insertItem(e,t){let{opcodeMap:r,bounds:n,state:i,children:o,context:{env:s}}=this,{key:a}=e,l=void 0===t?this.marker:t.firstNode(),c=NewTreeBuilder.forInitialRender(s,{element:n.parentElement(),nextSibling:l});i.evaluate(c).execute(t=>{let n=t.enterItem(e);n.index=o.length,o.push(n),r.set(a,n),associateDestroyableChild(this,n)})}moveItem(e,t,r){let n,i,{children:o}=this;updateRef(e.memo,t.memo),updateRef(e.value,t.value),e.retained=!0,void 0===r?move(e,this.marker):(n=e.lastNode().nextSibling,i=r.firstNode(),n!==i&&move(e,i)),e.index=o.length,o.push(e)}deleteItem(e){destroy(e),clear$1(e),this.opcodeMap.delete(e.key)}},UpdatingVMFrame=class{current=0;constructor(e,t){this.ops=e,this.exceptionHandler=t}goto(e){this.current=e}nextStatement(){return this.ops[this.current++]}handleException(){this.exceptionHandler&&this.exceptionHandler.handleException()}},RenderResultImpl=class{constructor(e,t,r,n){this.env=e,this.updating=t,this.bounds=r,this.drop=n,associateDestroyableChild(this,n),registerDestructor$1(this,()=>clear$1(this.bounds))}rerender({alwaysRevalidate:e=!1}={alwaysRevalidate:!1}){let{env:t,updating:r}=this;new UpdatingVM(t,{alwaysRevalidate:e}).execute(r,this)}parentElement(){return this.bounds.parentElement()}firstNode(){return this.bounds.firstNode()}lastNode(){return this.bounds.lastNode()}handleException(){}},EvaluationStackImpl=class{static restore(e,t){const r=new this(e.slice(),initializeRegistersWithSP(e.length-1));return r.registers[0]=t,r.registers[3]=e.length-1,r.registers[2]=-1,r}registers;constructor(e=[],t){this.stack=e,this.registers=t}push(e){this.stack[++this.registers[3]]=e}dup(e=this.registers[3]){this.stack[++this.registers[3]]=this.stack[e]}copy(e,t){this.stack[t]=this.stack[e]}pop(e=1){let t=this.stack[this.registers[3]];return this.registers[3]-=e,t}peek(e=0){return this.stack[this.registers[3]-e]}get(e,t=this.registers[2]){return this.stack[t+e]}set(e,t,r=this.registers[2]){this.stack[r+t]=e}slice(e,t){return this.stack.slice(e,t)}capture(e){let t=this.registers[3]+1,r=t-e;return this.stack.slice(r,t)}reset(){this.stack.length=0}},Stacks=class{drop={};scope=new StackImpl;dynamicScope=new StackImpl;updating=new StackImpl;cache=new StackImpl;list=new StackImpl;destroyable=new StackImpl;constructor(e,t){this.scope.push(e),this.dynamicScope.push(t),this.destroyable.push(this.drop)}},VM=class e{#d;args;lowlevel;debug;trace;get stack(){return this.lowlevel.stack}get pc(){return this.lowlevel.fetchRegister(0)}#p=[null,null,null,null,null,null,null,null,null];fetch(e){let t=this.fetchValue(e);this.stack.push(t)}load(e){let t=this.stack.pop();this.loadValue(e,t)}loadValue(e,t){this.#p[e]=t}fetchValue(e){return isLowLevelRegister(e)?this.lowlevel.fetchRegister(e):this.#p[e]}call(e){null!==e&&this.lowlevel.call(e)}return(){this.lowlevel.return()}#f;context;constructor({scope:e,dynamicScope:t,stack:r,pc:n},i,o){let s=EvaluationStackImpl.restore(r,n);this.#f=o,this.context=i,this.#d=new Stacks(e,t),this.args=new VMArgumentsImpl,this.lowlevel=new LowLevelVM(s,i,externs(),s.registers),this.pushUpdating()}static initial(t,r){let n=ScopeImpl.root(r.owner,r.scope??{self:UNDEFINED_REFERENCE,size:0});const i=closureState(t.program.heap.getaddr(r.handle),n,r.dynamicScope);return new e(i,t,r.tree)}compile(e){return unwrapHandle(e.compile(this.context))}get constants(){return this.context.program.constants}get program(){return this.context.program}get env(){return this.context.env}captureClosure(e,t=this.lowlevel.fetchRegister(0)){return{pc:t,scope:this.scope(),dynamicScope:this.dynamicScope(),stack:this.stack.capture(e)}}capture(e,t=this.lowlevel.fetchRegister(0)){return new Closure(this.captureClosure(e,t),this.context)}beginCacheGroup(e){let t=this.updating(),r=new JumpIfNotModifiedOpcode;t.push(r),t.push(new BeginTrackFrameOpcode(e)),this.#d.cache.push(r),beginTrackFrame()}commitCacheGroup(){let e=this.updating(),t=expect(this.#d.cache.pop()),r=endTrackFrame();e.push(new EndTrackFrameOpcode(t)),t.finalize(r,e.length)}enter(e){let t=this.capture(e),r=this.tree().pushResettableBlock(),n=new TryOpcode(t,this.context,r,[]);this.didEnter(n)}enterItem({key:e,value:t,memo:r}){let{stack:n}=this,i=createIteratorItemRef(t),o=createIteratorItemRef(r);n.push(i),n.push(o);let s=this.capture(2),a=this.tree().pushResettableBlock(),l=new ListItemOpcode(s,this.context,a,e,o,i);return this.didEnter(l),l}registerItem(e){this.listBlock().initializeChild(e)}enterList(e,t){let r=[],n=this.lowlevel.target(t),i=this.capture(0,n),o=this.tree().pushBlockList(r),s=new ListBlockOpcode(i,this.context,o,r,e);this.#d.list.push(s),this.didEnter(s)}didEnter(e){this.associateDestroyable(e),this.#d.destroyable.push(e),this.updateWith(e),this.pushUpdating(e.children)}exit(){this.#d.destroyable.pop(),this.#f.popBlock(),this.popUpdating()}exitList(){this.exit(),this.#d.list.pop()}pushRootScope(e,t){let r=ScopeImpl.sized(t,e);return this.#d.scope.push(r),r}pushChildScope(){this.#d.scope.push(this.scope().child())}pushScope(e){this.#d.scope.push(e)}popScope(){this.#d.scope.pop()}pushDynamicScope(){let e=this.dynamicScope().child();return this.#d.dynamicScope.push(e),e}bindDynamicScope(e){let t=this.dynamicScope();for(const r of reverse(e))t.set(r,this.stack.pop())}pushUpdating(e=[]){this.#d.updating.push(e)}popUpdating(){return expect(this.#d.updating.pop())}updateWith(e){this.updating().push(e)}listBlock(){return expect(this.#d.list.current)}associateDestroyable(e){associateDestroyableChild(expect(this.#d.destroyable.current),e)}updating(){return expect(this.#d.updating.current)}tree(){return this.#f}scope(){return expect(this.#d.scope.current)}dynamicScope(){return expect(this.#d.dynamicScope.current)}popDynamicScope(){this.#d.dynamicScope.pop()}getOwner(){return this.scope().owner}getSelf(){return this.scope().getSelf()}referenceForSymbol(e){return this.scope().getSymbol(e)}execute(e){return this._execute(e)}_execute(e){let t;e&&e(this);do{t=this.next()}while(!t.done);return t.value}next(){let e,{env:t}=this,r=this.lowlevel.nextStatement();return null!==r?(this.lowlevel.evaluateOuter(r,this),e={done:!1,value:null}):(this.stack.reset(),e={done:!0,value:new RenderResultImpl(t,this.popUpdating(),this.#f.popBlock(),this.#d.drop)}),e}};function closureState(e,t,r){return{pc:e,scope:t,dynamicScope:r,stack:[]}}var Closure=class{state;context;constructor(e,t){this.state=e,this.context=t}evaluate(e){return new VM(this.state,this.context,e)}},TemplateIteratorImpl=class{constructor(e){this.vm=e}next(){return this.vm.next()}sync(){return this.vm.execute()}};function renderSync(e,t){let r;return inTransaction(e,()=>r=t.sync()),r}function renderMain(e,t,r,n,i,o=new DynamicScopeImpl){let s=unwrapHandle(i.compile(e)),a=i.symbolTable.symbols.length,l=VM.initial(e,{scope:{self:r,size:a},dynamicScope:o,tree:n,handle:s,owner:t});return new TemplateIteratorImpl(l)}function renderInvocation(e,t,r,n,i){const o=Object.keys(i).map(e=>[e,i[e]]),s=["main","else","attrs"],a=o.map(([e])=>`@${e}`);let l=e.constants.component(n,r,void 0,"{ROOT}");e.lowlevel.pushFrame();for(let h=0;h<3*s.length;h++)e.stack.push(null);e.stack.push(null),o.forEach(([,t])=>{e.stack.push(t)}),e.args.setup(e.stack,a,s,0,!0);const c=expect(l.compilable),u={handle:unwrapHandle(c.compile(t)),symbolTable:c.symbolTable};return e.stack.push(e.args),e.stack.push(u),e.stack.push(l),new TemplateIteratorImpl(e)}function renderComponent(e,t,r,n,i={},o=new DynamicScopeImpl){return renderInvocation(VM.initial(e,{tree:t,handle:e.stdlib.main,dynamicScope:o,owner:r}),e,r,n,recordToReference(i))}function recordToReference(e){const t=createConstRef(e);return Object.keys(e).reduce((e,r)=>(e[r]=childRefFor(t,r),e),{})}var instrumentation_exports=__exportAll({_instrumentStart:()=>_instrumentStart,flaggedInstrument:()=>flaggedInstrument,instrument:()=>instrument,reset:()=>reset$1,subscribe:()=>subscribe,subscribers:()=>subscribers,unsubscribe:()=>unsubscribe}),subscribers=[],cache$2={};function populateListeners(e){let t=[];for(let r of subscribers)r.regex.test(e)&&t.push(r.object);return cache$2[e]=t,t}var time=()=>performance.now();function isCallback(e){return"function"==typeof e}function instrument(e,t,r,n){let i,o,s;if(arguments.length<=3&&isCallback(t)?(o=t,s=r):(i=t,o=r,s=n),0===subscribers.length)return o.call(s);let a=i||{},l=_instrumentStart(e,()=>a);return l===NOOP$2?o.call(s):withFinalizer(o,l,a,s)}function flaggedInstrument(e,t,r){return r()}function withFinalizer(e,t,r,n){try{return e.call(n)}catch(i){throw r.exception=i,i}finally{t()}}function NOOP$2(){}function _instrumentStart(e,t,r){if(0===subscribers.length)return NOOP$2;let n=cache$2[e];if(n||(n=populateListeners(e)),0===n.length)return NOOP$2;let i,o=t(r),s=ENV$1.STRUCTURED_PROFILE;s&&(i=`${e}: ${o.object}`,console.time(i));let a=[],l=time();for(let u of n)a.push(u.before(e,l,o));const c=n;return function(){let t=time();for(let r=0;r<c.length;r++){let n=c[r];"function"==typeof n.after&&n.after(e,t,o,a[r])}s&&console.timeEnd(i)}}function subscribe(e,t){let r=e.split("."),n=[];for(let s of r)"*"===s?n.push("[^\\.]*"):n.push(s);let i=n.join("\\.");i=`${i}(\\..*)?`;let o={pattern:e,regex:new RegExp(`^${i}$`),object:t};return subscribers.push(o),cache$2={},o}function unsubscribe(e){let t=0;for(let r=0;r<subscribers.length;r++)subscribers[r]===e&&(t=r);subscribers.splice(t,1),cache$2={}}function reset$1(){subscribers.length=0,cache$2={}}var MUTABLE_CELL=Symbol("MUTABLE_CELL");function unwrapTemplate(e){if("error"===e.result)throw new Error(`Compile Error: ${e.problem} @ ${e.span.start}..${e.span.end}`);return e}function isTemplateFactory(e){return"function"==typeof e}function referenceForParts(e,t){return"attrs"===t[0]&&(t.shift(),1===t.length)?childRefFor(e,t[0]):childRefFromParts(e,t)}function parseAttributeBinding(e){let t=e.indexOf(":");return-1===t?[e,e,!0]:[e.substring(0,t),e.substring(t+1),!1]}function installAttributeBinding(e,t,r,n){let[i,o,s]=r;if("id"===o){let t=get$7(e,i);null==t&&(t=e.elementId);let r=createPrimitiveRef(t);return void n.setAttribute("id",r,!0,null)}let a=i.indexOf(".")>-1?referenceForParts(t,i.split(".")):childRefFor(t,i);n.setAttribute(o,a,!1,null)}function createClassNameBindingRef(e,t,r){let[n,i,o]=t.split(":");if(""===n)r.setAttribute("class",createPrimitiveRef(i),!0,null);else{let t,s=n.indexOf(".")>-1,a=s?n.split("."):[],l=s?referenceForParts(e,a):childRefFor(e,n);t=void 0===i?createSimpleClassNameBindingRef(l,s?a[a.length-1]:n):createColonClassNameBindingRef(l,i,o),r.setAttribute("class",t,!1,null)}}function createSimpleClassNameBindingRef(e,t){let r;return createComputeRef(()=>{let n=valueForRef(e);return!0===n?r||(r=dasherize$1(t)):n||0===n?String(n):null})}function createColonClassNameBindingRef(e,t,r){return createComputeRef(()=>valueForRef(e)?t:r)}function NOOP$1(){}var ComponentStateBucket=class{classRef=null;rootRef;argsRevision;constructor(e,t,r,n,i,o){this.component=e,this.args=t,this.argsTag=r,this.finalizer=n,this.hasWrappedElement=i,this.isInteractive=o,this.classRef=null,this.argsRevision=null===t?0:valueForTag(r),this.rootRef=createConstRef(e),registerDestructor$1(this,()=>this.willDestroy(),!0),registerDestructor$1(this,()=>this.component.destroy())}willDestroy(){let{component:e,isInteractive:t}=this;if(t){beginUntrackFrame(),e.trigger("willDestroyElement"),e.trigger("willClearRender"),endUntrackFrame();let t=getViewElement(e);t&&(clearElementView(t),clearViewElement(e))}e.renderer.unregister(e)}finalize(){let{finalizer:e}=this;e(),this.finalizer=NOOP$1}};function processComponentArgs(e){let t=Object.create(null),r=Object.create(null);for(let n in e){let i=e[n],o=valueForRef(i);isUpdatableRef(i)?t[n]=new MutableCell(i,o):t[n]=o,r[n]=o}return r.attrs=t,r}var REF=Symbol("REF"),MutableCell=class{value;[MUTABLE_CELL];[REF];constructor(e,t){this[MUTABLE_CELL]=!0,this[REF]=e,this.value=t}update(e){updateRef(this[REF],e)}},COMPONENT_ARGS_MAP=new WeakMap;function getComponentCapturedArgs(e){return COMPONENT_ARGS_MAP.get(e)}var DIRTY_TAG=Symbol("DIRTY_TAG"),IS_DISPATCHING_ATTRS=Symbol("IS_DISPATCHING_ATTRS"),BOUNDS=Symbol("BOUNDS"),EMBER_VIEW_REF=createPrimitiveRef("ember-view");function aliasIdToElementId(e,t){e.named.has("id")&&(t.elementId=t.id)}function applyAttributeBindings(e,t,r,n){let i=[],o=e.length-1;for(;-1!==o;){let s=parseAttributeBinding(e[o]),a=s[1];-1===i.indexOf(a)&&(i.push(a),installAttributeBinding(t,r,s,n)),o--}if(-1===i.indexOf("id")){let e=t.elementId?t.elementId:guidFor(t);n.setAttribute("id",createPrimitiveRef(e),!1,null)}}var CurlyComponentManager=class{templateFor(e){let t,{layout:r,layoutName:n}=e,i=getOwner$2(e);if(void 0===r){if(void 0===n)return null;t=i.lookup(`template:${n}`)}else{if(!isTemplateFactory(r))return null;t=r}return unwrapTemplate(t(i)).asWrappedLayout()}getDynamicLayout(e){return this.templateFor(e.component)}getTagName(e){let{component:t,hasWrappedElement:r}=e;return r?t&&t.tagName||"div":null}getCapabilities(){return CURLY_CAPABILITIES}prepareArgs(e,t){if(t.named.has("__ARGS__")){let{__ARGS__:e,...r}=t.named.capture(),n=valueForRef(e);return{positional:n.positional,named:{...r,...n.named}}}const{positionalParams:r}=e.class??e;if(null==r||0===t.positional.length)return null;let n;if("string"==typeof r){let e=t.positional.capture();n={[r]:createComputeRef(()=>reifyPositional(e))},Object.assign(n,t.named.capture())}else{if(!(Array.isArray(r)&&r.length>0))return null;{const e=Math.min(r.length,t.positional.length);n={},Object.assign(n,t.named.capture());for(let i=0;i<e;i++)n[r[i]]=t.positional.at(i)}}return{positional:EMPTY_ARRAY$2,named:n}}create(e,t,r,{isInteractive:n},i,o){let s=i.view,a=r.named.capture();beginTrackFrame();let l=processComponentArgs(a),c=endTrackFrame();aliasIdToElementId(r,l),l.parentView=s,l._target=valueForRef(o),setOwner$1(l,e),beginUntrackFrame();let u=t.create(l);COMPONENT_ARGS_MAP.set(u,a);let h=_instrumentStart("render.component",initialRenderInstrumentDetails,u);i.view=u,null!=s&&addChildView(s,u),u.trigger("didReceiveAttrs");let d=""!==u.tagName;d||(n&&u.trigger("willRender"),u._transitionTo("hasElement"),n&&u.trigger("willInsertElement"));let p=new ComponentStateBucket(u,a,c,h,d,n);return r.named.has("class")&&(p.classRef=r.named.get("class")),n&&d&&u.trigger("willRender"),endUntrackFrame(),consumeTag(p.argsTag),consumeTag(u[DIRTY_TAG]),p}getDebugName(e){return e.fullName||e.normalizedName||e.class?.name||e.name}getSelf({rootRef:e}){return e}didCreateElement({component:e,classRef:t,isInteractive:r,rootRef:n},i,o){setViewElement(e,i),setElementView(i,e);let{attributeBindings:s,classNames:a,classNameBindings:l}=e;if(s&&s.length)applyAttributeBindings(s,e,n,o);else{let t=e.elementId?e.elementId:guidFor(e);o.setAttribute("id",createPrimitiveRef(t),!1,null)}if(t){const e=createSimpleClassNameBindingRef(t);o.setAttribute("class",e,!1,null)}a&&a.length&&a.forEach(e=>{o.setAttribute("class",createPrimitiveRef(e),!1,null)}),l&&l.length&&l.forEach(e=>{createClassNameBindingRef(n,e,o)}),o.setAttribute("class",EMBER_VIEW_REF,!1,null),"ariaRole"in e&&o.setAttribute("role",childRefFor(n,"ariaRole"),!1,null),e._transitionTo("hasElement"),r&&(beginUntrackFrame(),e.trigger("willInsertElement"),endUntrackFrame())}didRenderLayout(e,t){e.component[BOUNDS]=t,e.finalize()}didCreate({component:e,isInteractive:t}){t&&(e._transitionTo("inDOM"),e.trigger("didInsertElement"),e.trigger("didRender"))}update(e){let{component:t,args:r,argsTag:n,argsRevision:i,isInteractive:o}=e;if(e.finalizer=_instrumentStart("render.component",rerenderInstrumentDetails,t),beginUntrackFrame(),null!==r&&!validateTag(n,i)){beginTrackFrame();let i=processComponentArgs(r);n=e.argsTag=endTrackFrame(),e.argsRevision=valueForTag(n),t[IS_DISPATCHING_ATTRS]=!0,t.setProperties(i),t[IS_DISPATCHING_ATTRS]=!1,t.trigger("didUpdateAttrs"),t.trigger("didReceiveAttrs")}o&&(t.trigger("willUpdate"),t.trigger("willRender")),endUntrackFrame(),consumeTag(n),consumeTag(t[DIRTY_TAG])}didUpdateLayout(e){e.finalize()}didUpdate({component:e,isInteractive:t}){t&&(e.trigger("didUpdate"),e.trigger("didRender"))}getDestroyable(e){return e}};function initialRenderInstrumentDetails(e){return e.instrumentDetails({initialRender:!0})}function rerenderInstrumentDetails(e){return e.instrumentDetails({initialRender:!1})}var CURLY_CAPABILITIES={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},CURLY_COMPONENT_MANAGER=new CurlyComponentManager;function isCurlyManager(e){return e===CURLY_COMPONENT_MANAGER}function contentFor(e){let t=get$7(e,"content");return UPDATE_TAG(tagForObject(e),tagForObject(t)),t}function customTagForProxy(e,t,r){let n=tagMetaFor(e),i=tagFor(e,t,n);if(t in e)return i;{let o=[i,tagFor(e,"content",n)],s=contentFor(e);return isObject(s)&&o.push(tagForProperty(s,t,r)),combine(o)}}var ProxyMixin=Mixin.create({content:null,init(){this._super(...arguments),setProxy(this),tagForObject(this),setCustomTagFor(this,customTagForProxy)},willDestroy(){this.set("content",null),this._super(...arguments)},isTruthy:computed("content",function(){return Boolean(get$7(this,"content"))}),unknownProperty(e){let t=contentFor(this);return t?get$7(t,e):void 0},setUnknownProperty(e,t){let r=meta$1(this);return r.isInitializing()||r.isPrototypeMeta(this)?(defineProperty(this,e,null,t),t):set$1(contentFor(this),e,t)}});function internalHelper$1(e){return setInternalHelperManager(e,{})}var TrustedHTML=class{__string;constructor(e){this.__string=e}toString(){return`${this.__string}`}toHTML(){return this.toString()}},htmlSafe=trustHTML;function trustHTML(e){return null==e?e="":"string"!=typeof e&&(e=String(e)),new TrustedHTML(e)}var isHTMLSafe=isTrustedHTML;function isTrustedHTML(e){return null!==e&&"object"==typeof e&&"function"==typeof e.toHTML}function internalHelper(e){return setInternalHelperManager(e,{})}var array$1=internalHelper(({positional:e})=>createComputeRef(()=>reifyPositional(e),null,"array"));function buildUntouchableThis(){return null}var context$1=buildUntouchableThis(),fn$1=internalHelper(({positional:e})=>{let t=check(e[0]);return createComputeRef(()=>(...r)=>{let[n,...i]=reifyPositional(e);if(isInvokableRef(t)){let e=i.length>0?i[0]:r[0];return void updateRef(t,e)}return n.call(context$1,...i,...r)},null,"fn")}),hash$4=internalHelper(({named:e})=>{let t=createComputeRef(()=>reifyNamed(e),null,"hash"),r=new Map;for(let n in e)r.set(n,e[n]);return t.children=r,t}),isEmpty$3=e=>null==e||"function"!=typeof e.toString,normalizeTextValue=e=>isEmpty$3(e)?"":String(e),concat$1=internalHelper(({positional:e})=>createComputeRef(()=>reifyPositional(e).map(normalizeTextValue).join(""),null,"concat")),get$6=internalHelper(({positional:e})=>{let t=e[0]??UNDEFINED_REFERENCE,r=e[1]??UNDEFINED_REFERENCE;return createComputeRef(()=>{let e=valueForRef(t);if(isDict(e))return getPath(e,String(valueForRef(r)))},e=>{let n=valueForRef(t);if(isDict(n))return setPath(n,String(valueForRef(r)),e)},"get")}),OnModifierState=class{tag=createUpdatableTag();element;args;listener=null;constructor(e,t){this.element=e,this.args=t,registerDestructor$1(this,()=>{let{element:e,listener:t}=this;if(t){let{eventName:r,callback:n,options:i}=t;removeEventListener(e,r,n,i)}})}updateListener(){let e,t,r,{element:n,args:i,listener:o}=this,s=i.positional[0],a=check(s?valueForRef(s):void 0),l=i.positional[1],c=check(l?valueForRef(l):void 0);{let{once:n,passive:o,capture:s}=i.named;n&&(e=valueForRef(n)),o&&(t=valueForRef(o)),s&&(r=valueForRef(s))}let u,h=!1;if(h=null===o||a!==o.eventName||c!==o.userProvidedCallback||e!==o.once||t!==o.passive||r!==o.capture,h&&(void 0===e&&void 0===t&&void 0===r||(u={once:e,passive:t,capture:r})),h){let i=c;this.listener={eventName:a,callback:i,userProvidedCallback:c,once:e,passive:t,capture:r,options:u},o&&removeEventListener(n,o.eventName,o.callback,o.options),addEventListener(n,a,i,u)}}},adds=0,removes=0;function removeEventListener(e,t,r,n){removes++,e.removeEventListener(t,r,n)}function addEventListener(e,t,r,n){adds++,e.addEventListener(t,r,n)}var OnModifierManager=class{getDebugName(){return"on"}getDebugInstance(){return null}get counters(){return{adds:adds,removes:removes}}create(e,t,r,n){return new OnModifierState(t,n)}getTag({tag:e}){return e}install(e){e.updateListener()}update(e){e.updateListener()}getDestroyable(e){return e}},on$1=setInternalModifierManager(new OnModifierManager,{}),CAPABILITIES$5={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},TemplateOnlyComponentManager=class{getCapabilities(){return CAPABILITIES$5}getDebugName({name:e}){return e}getSelf(){return NULL_REFERENCE}getDestroyable(){return null}},TEMPLATE_ONLY_COMPONENT_MANAGER=new TemplateOnlyComponentManager,TemplateOnlyComponentDefinition=class{constructor(e="@glimmer/component/template-only",t="(unknown template-only component)"){this.moduleName=e,this.name=t}toString(){return this.moduleName}},getDebugName;function templateOnlyComponent(e,t){return new TemplateOnlyComponentDefinition(e,t)}setInternalComponentManager(TEMPLATE_ONLY_COMPONENT_MANAGER,TemplateOnlyComponentDefinition.prototype);var CAPABILITIES$4={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 componentCapabilities(e,t={}){let r=Boolean(t.updateHook);return buildCapabilities({asyncLifeCycleCallbacks:Boolean(t.asyncLifecycleCallbacks),destructor:Boolean(t.destructor),updateHook:r})}function hasAsyncLifeCycleCallbacks(e){return e.capabilities.asyncLifeCycleCallbacks}function hasUpdateHook(e){return e.capabilities.updateHook}function hasAsyncUpdateHook(e){return hasAsyncLifeCycleCallbacks(e)&&hasUpdateHook(e)}function hasDestructors(e){return e.capabilities.destructor}var CustomComponentManager=class{componentManagerDelegates=new WeakMap;constructor(e){this.factory=e}getDelegateFor(e){let{componentManagerDelegates:t}=this,r=t.get(e);if(void 0===r){let{factory:n}=this;r=n(e),t.set(e,r)}return r}create(e,t,r){let n=this.getDelegateFor(e),i=argsProxyFor(r.capture()),o=n.createComponent(t,i);return new CustomComponentState(o,n,i)}getDebugName(e){return"function"==typeof e?e.name:e.toString()}update(e){let{delegate:t}=e;if(hasUpdateHook(t)){let{component:r,args:n}=e;t.updateComponent(r,n)}}didCreate({component:e,delegate:t}){hasAsyncLifeCycleCallbacks(t)&&t.didCreateComponent(e)}didUpdate({component:e,delegate:t}){hasAsyncUpdateHook(t)&&t.didUpdateComponent(e)}didRenderLayout(){}didUpdateLayout(){}getSelf({component:e,delegate:t}){return createConstRef(t.getContext(e))}getDestroyable(e){const{delegate:t}=e;if(hasDestructors(t)){const{component:r}=e;return registerDestructor$1(e,()=>t.destroyComponent(r)),e}return null}getCapabilities(){return CAPABILITIES$4}},CustomComponentState=class{constructor(e,t,r){this.component=e,this.delegate=t,this.args=r}};function modifierCapabilities(e,t={}){return buildCapabilities({disableAutoTracking:Boolean(t.disableAutoTracking)})}var CustomModifierManager=class{componentManagerDelegates=new WeakMap;constructor(e){this.factory=e}getDelegateFor(e){let{componentManagerDelegates:t}=this,r=t.get(e);if(void 0===r){let{factory:n}=this;r=n(e),t.set(e,r)}return r}create(e,t,r,n){let i,o=this.getDelegateFor(e),s=argsProxyFor(n),a=o.createModifier(r,s);return i={tag:createUpdatableTag(),element:t,delegate:o,args:s,modifier:a},registerDestructor$1(i,()=>o.destroyModifier(a,s)),i}getDebugName(e){return"function"==typeof e?e.name||e.toString():"<unknown>"}getDebugInstance({modifier:e}){return e}getTag({tag:e}){return e}install({element:e,args:t,modifier:r,delegate:n}){let{capabilities:i}=n;i.disableAutoTracking?untrack(()=>n.installModifier(r,castToBrowser(e,"ELEMENT"),t)):n.installModifier(r,castToBrowser(e),t)}update({args:e,modifier:t,delegate:r}){let{capabilities:n}=r;n.disableAutoTracking?untrack(()=>r.updateModifier(t,e)):r.updateModifier(t,e)}getDestroyable(e){return e}};function setComponentManager$1(e,t){return setInternalComponentManager(new CustomComponentManager(e),t)}function setModifierManager$1(e,t){return setInternalModifierManager(new CustomModifierManager(e),t)}function setHelperManager(e,t){return setInternalHelperManager(new CustomHelperManager(e),t)}var RECOMPUTE_TAG=Symbol("RECOMPUTE_TAG"),IS_CLASSIC_HELPER=Symbol("IS_CLASSIC_HELPER"),Helper=class extends FrameworkObject{static isHelperFactory=!0;static[IS_CLASSIC_HELPER]=!0;static helper=helper$1;init(e){super.init(e),this[RECOMPUTE_TAG]=createTag()}recompute(){join$2(()=>DIRTY_TAG$1(this[RECOMPUTE_TAG]))}};function isClassicHelper(e){return!0===e[IS_CLASSIC_HELPER]}var ClassicHelperManager=class{capabilities=helperCapabilities("3.23",{hasValue:!0,hasDestroyable:!0});ownerInjection;constructor(e){let t={};setOwner$1(t,e),this.ownerInjection=t}createHelper(e,t){return{instance:isFactoryManager(e)?e.create():e.create(this.ownerInjection),args:t}}getDestroyable({instance:e}){return e}getValue({instance:e,args:t}){let{positional:r,named:n}=t,i=e.compute(r,n);return consumeTag(e[RECOMPUTE_TAG]),i}getDebugName(e){return getDebugName((e.class||e).prototype)}};function isFactoryManager(e){return null!=e&&"class"in e}setHelperManager(e=>new ClassicHelperManager(e),Helper);var CLASSIC_HELPER_MANAGER=getInternalHelperManager(Helper),Wrapper=class{isHelperFactory=!0;constructor(e){this.compute=e}create(){return{compute:this.compute}}},SimpleClassicHelperManager=class{capabilities=helperCapabilities("3.23",{hasValue:!0});createHelper(e,t){return()=>e.compute.call(null,t.positional,t.named)}getValue(e){return e()}getDebugName(e){return getDebugName(e.compute)}},SIMPLE_CLASSIC_HELPER_MANAGER=new SimpleClassicHelperManager;function helper$1(e){return new Wrapper(e)}setHelperManager(()=>SIMPLE_CLASSIC_HELPER_MANAGER,Wrapper.prototype);var uniqueId=internalHelper$1(()=>createConstRef(uniqueId$1()));function uniqueId$1(){return"30000000-1000-4000-2000-100000000000".replace(/[0-3]/g,e=>(4*e^16*Math.random()>>(2&e)).toString(16))}var StdLib=class{constructor(e,t,r,n,i){this.main=e,this.trustingGuardedAppend=t,this.cautiousGuardedAppend=r,this.trustingNonDynamicAppend=n,this.cautiousNonDynamicAppend=i}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(e){return e?this.trustingGuardedAppend:this.cautiousGuardedAppend}};function main(e){e(75,4),invokePreparedComponent(e,!1,!1,!0)}function StdAppend(e,t,r){SwitchCases(e,()=>e(76),n=>{n(ContentType.String,()=>{t?(e(68),e(43)):e(47)}),"number"==typeof r?(n(ContentType.Component,()=>{e(81),e(79),InvokeBareComponent(e)}),n(ContentType.Helper,()=>{CallDynamic(e,null,null,()=>{e(3,r)})})):(n(ContentType.Component,()=>{e(47)}),n(ContentType.Helper,()=>{e(47)})),n(ContentType.SafeString,()=>{e(68),e(44)}),n(ContentType.Fragment,()=>{e(68),e(45)}),n(ContentType.Node,()=>{e(68),e(46)})})}function compileStd(e){let t=build(e,e=>main(e)),r=build(e,e=>StdAppend(e,!0,null)),n=build(e,e=>StdAppend(e,!1,null)),i=build(e,e=>StdAppend(e,!0,r)),o=build(e,e=>StdAppend(e,!1,n));return new StdLib(t,i,o,r,n)}var STDLIB_META={symbols:{locals:null,upvars:null},moduleName:"stdlib",scopeValues:null,isStrictMode:!0,owner:null,size:0};function build(e,t){let r=new EncoderImpl(e.program.heap,STDLIB_META);t(function(...t){encodeOp(r,e,STDLIB_META,t)});let n=r.commit(0);if("number"!=typeof n)throw new Error("Unexpected errors compiling std");return n}var EvaluationContextImpl=class{constants;heap;resolver;stdlib;createOp;env;program;constructor({constants:e,heap:t},r,n){this.constants=e,this.heap=t,this.resolver=n.resolver,this.createOp=r,this.env=n.env,this.program=n.program,this.stdlib=compileStd(this)}};function instrumentationPayload$1(e){return{object:`${e.name}:main`}}var CAPABILITIES$2={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},CAPABILITIES_MASK$1=capabilityFlagsFrom(CAPABILITIES$2),OutletComponentManager=class{create(e,t,r,n,i){let o=i.get("outletState"),s=t.ref;i.set("outletState",s);let a={finalize:_instrumentStart("render.outlet",instrumentationPayload$1,t)};if(void 0!==n.debugRenderTree){let e=valueForRef(o)?.render?.owner,t=valueForRef(s)?.render?.owner;if(e&&e!==t){let{mountPoint:e}=t;e&&(a.engine={mountPoint:e,instance:t})}}return a}getDebugName({name:e}){return`{{outlet}} for ${e}`}getDebugCustomRenderTree(e,t){let r=[];return r.push({bucket:t,type:"outlet",name:"main",args:EMPTY_ARGS,instance:void 0}),t.engine&&r.push({bucket:t.engine,type:"engine",name:t.engine.mountPoint,args:EMPTY_ARGS,instance:t.engine.instance}),r}getCapabilities(){return CAPABILITIES$2}getSelf(){return UNDEFINED_REFERENCE}didCreate(){}didUpdate(){}didRenderLayout(e){e.finalize()}didUpdateLayout(){}getDestroyable(){return null}},OUTLET_MANAGER=new OutletComponentManager,OUTLET_COMPONENT_TEMPLATE=templateFactory({id:null,block:'[[[8,[30,1],null,[["@controller","@model"],[[30,2],[30,3]]],null]],["@Component","@controller","@model"],[]]',moduleName:"(unknown template module)",isStrictMode:!0}),OutletComponent=class{handle=-1;resolvedName=null;manager=OUTLET_MANAGER;capabilities=CAPABILITIES_MASK$1;compilable;constructor(e,t){this.state=t,this.compilable=unwrapTemplate(OUTLET_COMPONENT_TEMPLATE(e)).asLayout()}};function createRootOutlet(e){return new OutletComponent(e.owner,e.state)}var RootComponentManager=class extends CurlyComponentManager{component;constructor(e){super(),this.component=e}create(e,t,r,{isInteractive:n},i){let o=this.component,s=_instrumentStart("render.component",initialRenderInstrumentDetails,o);i.view=o;let a=""!==o.tagName;a||(n&&o.trigger("willRender"),o._transitionTo("hasElement"),n&&o.trigger("willInsertElement"));let l=new ComponentStateBucket(o,null,CONSTANT_TAG,s,a,n);return consumeTag(o[DIRTY_TAG]),l}},ROOT_CAPABILITIES={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},RootComponentDefinition=class{handle=-1;resolvedName="-top-level";state;manager;capabilities=capabilityFlagsFrom(ROOT_CAPABILITIES);compilable=null;constructor(e){this.manager=new RootComponentManager(e);let t=getFactoryFor(e);this.state=t}},EachInWrapper=class{constructor(e){this.inner=e}},eachIn=internalHelper$1(({positional:e})=>{const t=e[0];return createComputeRef(()=>{let e=valueForRef(t);return consumeTag(tagForObject(e)),isProxy(e)&&(e=contentFor(e)),new EachInWrapper(e)})});function toIterator(e){return e instanceof EachInWrapper?toEachInIterator(e.inner):toEachIterator(e)}function toEachInIterator(e){return isIndexable(e)?Array.isArray(e)||isEmberArray(e)?ObjectIterator.fromIndexable(e):isNativeIterable(e)?MapLikeNativeIterator.from(e):hasForEach(e)?ObjectIterator.fromForEachable(e):ObjectIterator.fromIndexable(e):null}function toEachIterator(e){return isObject(e)?Array.isArray(e)?ArrayIterator.from(e):isEmberArray(e)?EmberArrayIterator.from(e):isNativeIterable(e)?ArrayLikeNativeIterator.from(e):hasForEach(e)?ArrayIterator.fromForEachable(e):null:null}var BoundedIterator=class{position=0;constructor(e){this.length=e}isEmpty(){return!1}memoFor(e){return e}next(){let{length:e,position:t}=this;if(t>=e)return null;let r=this.valueFor(t),n=this.memoFor(t);return this.position++,{value:r,memo:n}}},ArrayIterator=class extends BoundedIterator{static from(e){return e.length>0?new this(e):null}static fromForEachable(e){let t=[];return e.forEach(e=>t.push(e)),this.from(t)}constructor(e){super(e.length),this.array=e}valueFor(e){return this.array[e]}},EmberArrayIterator=class extends BoundedIterator{static from(e){return e.length>0?new this(e):null}constructor(e){super(e.length),this.array=e}valueFor(e){return objectAt(this.array,e)}},ObjectIterator=class extends BoundedIterator{static fromIndexable(e){let t=Object.keys(e);if(0===t.length)return null;{let r=[];for(let n of t){let t;t=e[n],isTracking()&&(consumeTag(tagFor(e,n)),Array.isArray(t)&&consumeTag(tagFor(t,"[]"))),r.push(t)}return new this(t,r)}}static fromForEachable(e){let t=[],r=[],n=0,i=!1;return e.forEach(function(e,o){i=i||arguments.length>=2,i&&t.push(o),r.push(e),n++}),0===n?null:i?new this(t,r):new ArrayIterator(r)}constructor(e,t){super(t.length),this.keys=e,this.values=t}valueFor(e){return this.values[e]}memoFor(e){return this.keys[e]}},NativeIterator=class{static from(e){let t=e[Symbol.iterator](),r=t.next(),{done:n}=r;return n?null:new this(t,r)}position=0;constructor(e,t){this.iterable=e,this.result=t}isEmpty(){return!1}next(){let{iterable:e,result:t,position:r}=this;if(t.done)return null;let n=this.valueFor(t,r),i=this.memoFor(t,r);return this.position++,this.result=e.next(),{value:n,memo:i}}},ArrayLikeNativeIterator=class extends NativeIterator{valueFor(e){return e.value}memoFor(e,t){return t}},MapLikeNativeIterator=class extends NativeIterator{valueFor(e){return e.value[1]}memoFor(e){return e.value[0]}};function hasForEach(e){return null!=e&&"function"==typeof e.forEach}function isNativeIterable(e){return null!=e&&"function"==typeof e[Symbol.iterator]}function isIndexable(e){return null!==e&&("object"==typeof e||"function"==typeof e)}function toBool(e){return isProxy(e)?(consumeTag(tagForProperty(e,"content")),Boolean(get$7(e,"isTruthy"))):isArray$5(e)?(consumeTag(tagForProperty(e,"[]")),0!==e.length):isHTMLSafe(e)?Boolean(e.toString()):Boolean(e)}setGlobalContext({scheduleRevalidate(){_backburner.ensureInstance()},toBool:toBool,toIterator:toIterator,getProp:_getProp,setProp:_setProp,getPath:get$7,setPath:set$1,scheduleDestroy(e,t){schedule("actions",null,t,e)},scheduleDestroyed(e){schedule("destroy",null,e)},warnIfStyleNotTrusted(e){},assert(e,t,r){},deprecate(e,t,r){}});var EmberEnvironmentDelegate=class{enableDebugTooling=ENV$1._DEBUG_RENDER_TREE;constructor(e,t){this.owner=e,this.isInteractive=t}onTransactionCommit(){}},disallowDynamicResolution=internalHelper$1(({positional:e,named:t})=>{const r=e[0];let n=t.type,i=t.loc,o=t.original;return valueForRef(n),valueForRef(i),valueForRef(o),createComputeRef(()=>valueForRef(r))}),helper=e=>e.positional[0],inElementNullCheckHelper=internalHelper$1(helper),normalizeClassHelper=internalHelper$1(({positional:e})=>createComputeRef(()=>{let t=e[0],r=e[1],n=valueForRef(t).split("."),i=n[n.length-1],o=valueForRef(r);return!0===o?dasherize$1(i):o||0===o?String(o):""})),resolve=internalHelper$1(({positional:e},t)=>{let r=valueForRef(e[0]);return createConstRef(t.factoryFor(r)?.class)}),trackArray=internalHelper$1(({positional:e})=>{const t=e[0];return createComputeRef(()=>{let e=valueForRef(t);return isObject(e)&&consumeTag(tagForProperty(e,"[]")),e})}),mut=internalHelper$1(({positional:e})=>createInvokableRef(e[0])),readonly=internalHelper$1(({positional:e})=>createReadOnlyRef(e[0])),unbound=internalHelper$1(({positional:e,named:t})=>createUnboundRef(valueForRef(e[0]))),CAPABILITIES$1$1={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},MountManager=class{getDynamicLayout(e){return unwrapTemplate(e.engine.lookup("template:application")(e.engine)).asLayout()}getCapabilities(){return CAPABILITIES$1$1}getOwner(e){return e.engine}create(e,{name:t},r,n){let i=e.buildChildEngineInstance(t);i.boot();let o,s,a,l,c=i.factoryFor("controller:application")||generateControllerFactory(i,"application");if(r.named.has("model")&&(l=r.named.get("model")),void 0===l)o=c.create(),s=createConstRef(o),a={engine:i,controller:o,self:s,modelRef:l};else{let e=valueForRef(l);o=c.create({model:e}),s=createConstRef(o),a={engine:i,controller:o,self:s,modelRef:l}}return n.debugRenderTree&&associateDestroyableChild(i,o),a}getDebugName({name:e}){return e}getDebugCustomRenderTree(e,t,r){return[{bucket:t.engine,instance:t.engine,type:"engine",name:e.name,args:r},{bucket:t.controller,instance:t.controller,type:"route-template",name:"application",args:r}]}getSelf({self:e}){return e}getDestroyable(e){return e.engine}didCreate(){}didUpdate(){}didRenderLayout(){}didUpdateLayout(){}update(e){let{controller:t,modelRef:r}=e;void 0!==r&&t.set("model",valueForRef(r))}},MOUNT_MANAGER=new MountManager,MountDefinition=class{handle=-1;state;manager=MOUNT_MANAGER;compilable=null;capabilities=capabilityFlagsFrom(CAPABILITIES$1$1);constructor(e){this.resolvedName=e,this.state={name:e}}},mountHelper=internalHelper$1((e,t)=>{let r,n,i,o=e.positional[0];return r=createCapturedArgs(e.named,EMPTY_POSITIONAL),createComputeRef(()=>{let e=valueForRef(o);return"string"==typeof e?(n===e||(n=e,i=curry(0,new MountDefinition(e),t,r,!0)),i):(i=null,n=null,null)})}),CAPABILITIES$3={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},CAPABILITIES_MASK=capabilityFlagsFrom(CAPABILITIES$3),RouteTemplateManager=class{create(e,t,r){let n=r.named.get("controller");return{self:n,controller:valueForRef(n)}}getSelf({self:e}){return e}getDebugName({name:e}){return`route-template (${e})`}getDebugCustomRenderTree({name:e},t,r){return[{bucket:t,type:"route-template",name:e,args:r,instance:t.controller}]}getCapabilities(){return CAPABILITIES$3}didRenderLayout(){}didUpdateLayout(){}didCreate(){}didUpdate(){}getDestroyable(){return null}},ROUTE_TEMPLATE_MANAGER=new RouteTemplateManager,RouteTemplate=class{handle=-1;resolvedName;state;manager=ROUTE_TEMPLATE_MANAGER;capabilities=CAPABILITIES_MASK;compilable;constructor(e,t){let r=unwrapTemplate(t);this.resolvedName=e,this.state={name:e},this.compilable=r.asLayout()}};function makeRouteTemplate(e,t,r){return curry(0,new RouteTemplate(t,r),e,null,!0)}var outletHelper=internalHelper$1((e,t,r)=>{let n=createComputeRef(()=>valueForRef(r.get("outletState"))?.outlets?.main),i=null,o=null;return createComputeRef(()=>{let e=valueForRef(n),r=stateFor(n,e);if(!isStable(r,i))if(i=r,null!==r){let s,a=e?.render?.owner??t,l=dict(),c=r.template;s=hasInternalComponentManager(c)?c:makeRouteTemplate(a,r.name,c),l.Component=createConstRef(s),l.controller=createConstRef(r.controller);let u=childRefFromParts(n,["render","model"]),h=valueForRef(u);l.model=createComputeRef(()=>(i===r&&(h=valueForRef(u)),h));let d=createCapturedArgs(l,EMPTY_POSITIONAL);o=curry(0,new OutletComponent(t,r),a,d,!0)}else o=null;return o})});function stateFor(e,t){if(void 0===t)return null;let r=t.render;if(void 0===r)return null;let n=r.template;return null==n?null:{ref:e,name:r.name,template:n,controller:r.controller}}function isStable(e,t){return null!==e&&null!==t&&e.template===t.template&&e.controller===t.controller}function instrumentationPayload(e){return{object:`component:${e}`}}function componentFor(e,t){let r=`component:${e}`;return t.factoryFor(r)||null}function lookupComponentPair(e,t){let r=componentFor(t,e);if(isFactory(r)&&r.class){let e=getComponentTemplate(r.class);if(void 0!==e)return{component:r,layout:e}}return null===r?null:{component:r,layout:null}}var BUILTIN_KEYWORD_HELPERS={mut:mut,readonly:readonly,unbound:unbound,"-hash":hash$4,"-each-in":eachIn,"-normalize-class":normalizeClassHelper,"-resolve":resolve,"-track-array":trackArray,"-mount":mountHelper,"-outlet":outletHelper,"-in-el-null":inElementNullCheckHelper},BUILTIN_HELPERS={...BUILTIN_KEYWORD_HELPERS,array:array$1,concat:concat$1,fn:fn$1,get:get$6,hash:hash$4,"unique-id":uniqueId};BUILTIN_HELPERS["-disallow-dynamic-resolution"]=disallowDynamicResolution;var BUILTIN_KEYWORD_MODIFIERS={},BUILTIN_MODIFIERS={...BUILTIN_KEYWORD_MODIFIERS,on:on$1},ResolverImpl=class{componentDefinitionCache=new Map;lookupPartial(){return null}lookupHelper(e,t){let r=BUILTIN_HELPERS[e];if(void 0!==r)return r;let n=t.factoryFor(`helper:${e}`);if(void 0===n)return null;let i=n.class;return void 0===i?null:"function"==typeof i&&isClassicHelper(i)?(setInternalHelperManager(CLASSIC_HELPER_MANAGER,n),n):i}lookupBuiltInHelper(e){return BUILTIN_KEYWORD_HELPERS[e]??null}lookupModifier(e,t){let r=BUILTIN_MODIFIERS[e];if(void 0!==r)return r;let n=t.factoryFor(`modifier:${e}`);return void 0===n?null:n.class||null}lookupBuiltInModifier(e){return BUILTIN_KEYWORD_MODIFIERS[e]??null}lookupComponent(e,t){let r=lookupComponentPair(t,e);if(null===r)return null;let n,i=null;n=null===r.component?i=r.layout(t):r.component;let o=this.componentDefinitionCache.get(n);if(void 0!==o)return o;null===i&&null!==r.layout&&(i=r.layout(t));let s=_instrumentStart("render.getComponentDefinition",instrumentationPayload,e),a=null;if(null===r.component)a={state:templateOnlyComponent(void 0,e),manager:TEMPLATE_ONLY_COMPONENT_MANAGER,template:i};else{let e=r.component,t=e.class,n=getInternalComponentManager(t);a={state:isCurlyManager(n)?e:t,manager:n,template:i}}return s(),this.componentDefinitionCache.set(n,a),a}},TOP_LEVEL_NAME="-top-level",OutletView=class e{static extend(t){return class extends e{static create(e){return e?super.create(Object.assign({},t,e)):super.create(t)}}}static reopenClass(e){Object.assign(this,e)}static create(t){let{environment:r,application:n,template:i}=t,o=getOwner$2(t),s=i(o);return new e(r,o,s,n)}ref;state;constructor(e,t,r,n){this._environment=e,this.owner=t,this.template=r,this.namespace=n;let i=createTag(),o={outlets:{main:void 0},render:{owner:t,name:TOP_LEVEL_NAME,controller:void 0,model:void 0,template:r}},s=this.ref=createComputeRef(()=>(consumeTag(i),o),e=>{DIRTY_TAG$1(i),o.outlets.main=e});this.state={ref:s,name:TOP_LEVEL_NAME,template:r,controller:void 0}}appendTo(e){let t;t=this._environment.hasDOM&&"string"==typeof e?document.querySelector(e):e,schedule("render",this.owner.lookup("renderer:-dom"),"appendOutletView",this,t)}rerender(){}setOutletState(e){updateRef(this.ref,e)}destroy(){}},DynamicScope=class e{constructor(e,t){this.view=e,this.outletState=t}child(){return new e(this.view,this.outletState)}get(e){return this.outletState}set(e,t){return this.outletState=t,t}},NO_OP=()=>{};function errorLoopTransaction(e){return e}var ComponentRootState=class{type="component";#g;#m;constructor(e,t,r){this.#m=errorLoopTransaction(()=>{let n=renderComponent(e.context,e.builder(e.env,r.into),e.owner,t,r?.args),i=this.#g=n.sync();associateDestroyableChild(this,this.#g),this.#m=errorLoopTransaction(()=>{if(!isDestroying(i)&&!isDestroyed(i))return i.rerender({alwaysRevalidate:!1})})})}isFor(e){return!1}render(){this.#m()}destroy(){destroy(this)}get destroyed(){return isDestroyed(this)}get result(){return this.#g}},ClassicRootState=class{type="classic";id;result;destroyed;render;env;constructor(e,t,r,n,i,o,s,a){this.root=e,this.id=e instanceof OutletView?guidFor(e):getViewId(e),this.result=void 0,this.destroyed=!1,this.env=t.env,this.render=errorLoopTransaction(()=>{let e=unwrapTemplate(n).asLayout(),l=renderMain(t,r,i,a(t.env,{element:o,nextSibling:null}),e,s),c=this.result=l.sync();associateDestroyableChild(this,c),this.render=errorLoopTransaction(()=>{if(!isDestroying(c)&&!isDestroyed(c))return c.rerender({alwaysRevalidate:!1})})})}isFor(e){return this.root===e}destroy(){let{result:e,env:t}=this;this.destroyed=!0,this.root=null,this.result=void 0,this.render=void 0,void 0!==e&&inTransaction(t,()=>destroy(e))}},renderers=[];function register(e){renderers.push(e)}function deregister(e){let t=renderers.indexOf(e);renderers.splice(t,1)}function loopBegin(){for(let e of renderers)e.rerender()}var renderSettledDeferred=null;function renderSettled(){return null===renderSettledDeferred&&(renderSettledDeferred=RSVP.defer(),_getCurrentRunLoop()||_backburner.schedule("actions",null,NO_OP)),renderSettledDeferred.promise}function resolveRenderPromise(){if(null!==renderSettledDeferred){let e=renderSettledDeferred.resolve;renderSettledDeferred=null,_backburner.join(null,e)}}var loops=0;function loopEnd(){for(let e of renderers)if(!e.isValid()){if(loops>ENV$1._RERENDER_LOOP_LIMIT)throw loops=0,e.destroy(),new Error("infinite rendering invalidation detected");return loops++,_backburner.join(null,NO_OP)}loops=0,resolveRenderPromise()}_backburner.on("begin",loopBegin),_backburner.on("end",loopEnd);var RendererState=class e{static create(t,r){const n=new e(t,r);return associateDestroyableChild(r,n),n}#y;#v=-1;#_=!1;#b=!1;#E=[];#w=[];constructor(e,t){this.#y=e,registerDestructor$1(this,()=>{this.clearAllRoots(t)})}get debug(){return{roots:this.#E,inRenderTransaction:this.#_,isInteractive:this.isInteractive}}get roots(){return this.#E}get owner(){return this.#y.owner}get builder(){return this.#y.builder}get context(){return this.#y.context}get env(){return this.context.env}get isInteractive(){return this.#y.context.env.isInteractive}renderRoot(e,t){let r=this.#E;return r.push(e),associateDestroyableChild(this,e),1===r.length&&register(t),this.#C(t),e}#C(e){if(this.#_)return;this.#_=!0;let t=!1;try{this.renderRoots(e),t=!0}finally{t||(this.#v=valueForTag(CURRENT_TAG)),this.#_=!1}}renderRoots(e){let t,r=this.#E,n=this.#w;do{t=r.length,inTransaction(this.context.env,()=>{for(let e=0;e<r.length;e++){let i=r[e];i.destroyed?n.push(i):e>=t||i.render()}this.#v=valueForTag(CURRENT_TAG)})}while(r.length>t);for(;n.length;){let e=n.pop(),t=r.indexOf(e);r.splice(t,1)}0===this.#E.length&&deregister(e)}scheduleRevalidate(e){_backburner.scheduleOnce("render",this,this.revalidate,e)}isValid(){return this.#b||0===this.#E.length||validateTag(CURRENT_TAG,this.#v)}revalidate(e){this.isValid()||this.#C(e)}clearAllRoots(e){let t=this.#E;for(let r of t)destroy(r);this.#w.length=0,this.#E=[],t.length&&deregister(e)}};function intoTarget(e){return"element"in e?e:{element:e,nextSibling:null}}var BaseRenderer=class e{static strict(t,r,n){return new e(t,{hasDOM:hasDOM,...n},r,new ResolverImpl,clientBuilder)}state;constructor(e,t,r,n,i){let o=artifacts(),s=runtimeOptions({document:r},new EmberEnvironmentDelegate(e,t.isInteractive),o,n),a=new EvaluationContextImpl(o,e=>new RuntimeOpImpl(e),s);this.state=RendererState.create({owner:e,context:a,builder:i},this)}get debugRenderTree(){let{debugRenderTree:e}=this.state.env;return e}isValid(){return this.state.isValid()}destroy(){destroy(this)}render(e,t){const r=new ComponentRootState(this.state,e,{args:t.args,into:intoTarget(t.into)});return this.state.renderRoot(r,this)}rerender(){this.state.scheduleRevalidate(this)}},Renderer=class extends BaseRenderer{static strict(e,t,r){return new BaseRenderer(e,{hasDOM:hasDOM,...r},t,new ResolverImpl,clientBuilder)}_rootTemplate;_viewRegistry;static create(e){let{_viewRegistry:t}=e,r=getOwner$2(e),n=r.lookup("service:-document"),i=r.lookup("-environment:main"),o=r.lookup(privatize`template:-root`),s=r.lookup("service:-dom-builder");return new this(r,n,i,o,t,s)}constructor(e,t,r,n,i,o=clientBuilder,s=new ResolverImpl){super(e,r,t,s,o),this._rootTemplate=n(e),this._viewRegistry=i||e.lookup("-view-registry:main")}appendOutletView(e,t){let r=createRootOutlet(e),{name:n,template:i}=e.state,o=dict();o.Component=createConstRef(makeRouteTemplate(e.owner,n,i)),o.controller=UNDEFINED_REFERENCE,o.model=UNDEFINED_REFERENCE;let s=createCapturedArgs(o,EMPTY_POSITIONAL);this._appendDefinition(e,curry(0,r,e.owner,s,!0),t)}appendTo(e,t){let r=new RootComponentDefinition(e);this._appendDefinition(e,curry(0,r,this.state.owner,null,!0),t)}_appendDefinition(e,t,r){let n=createConstRef(t),i=new DynamicScope(null,UNDEFINED_REFERENCE),o=new ClassicRootState(e,this.state.context,this.state.owner,this._rootTemplate,n,r,i,this.state.builder);this.state.renderRoot(o,this)}cleanupRootFor(e){if(isDestroyed(this))return;let t=this.state.roots,r=t.length;for(;r--;){let n=t[r];"classic"===n.type&&n.isFor(e)&&(n.destroy(),t.splice(r,1))}}remove(e){e._transitionTo("destroying"),this.cleanupRootFor(e),this.state.isInteractive&&e.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(e){let t=getViewId(e);this._viewRegistry[t]=e}unregister(e){delete this._viewRegistry[getViewId(e)]}getElement(e){if(this._isInteractive)return getViewElement(e);throw new Error("Accessing `this.element` is not allowed in non-interactive environments (such as FastBoot).")}getBounds(e){let t=e[BOUNDS];return{parentElement:t.parentElement(),firstNode:t.firstNode(),lastNode:t.lastNode()}}},ApplicationInstance=class extends EngineInstance{rootElement=null;init(e){super.init(e),this.application._watchInstance(this),this.register("-application-instance:main",this,{instantiate:!1})}_bootSync(e){return this._booted||(e=new _BootOptions(e),this.setupRegistry(e),e.rootElement?this.rootElement=e.rootElement:this.rootElement=this.application.rootElement,e.location&&set$1(this.router,"location",e.location),this.application.runInstanceInitializers(this),e.isInteractive&&this.setupEventDispatcher(),this._booted=!0),this}setupRegistry(e){this.constructor.setupRegistry(this.__registry__,e)}_router;get router(){if(!this._router){let e=this.lookup("router:main");this._router=e}return this._router}didCreateRootView(e){e.appendTo(this.rootElement)}startRouting(){this.router.startRouting()}setupRouter(){this.router.setupRouter()}handleURL(e){return this.setupRouter(),this.router.handleURL(e)}setupEventDispatcher(){let e=this.lookup("event_dispatcher:main"),t=get$7(this.application,"customEvents"),r=get$7(this,"customEvents"),n=Object.assign({},t,r);return e.setup(n,this.rootElement),e}getURL(){return this.router.url}visit(e){this.setupRouter();let t=this.__container__.lookup("-environment:main"),r=this.router,n=get$7(r,"location");return n.setURL(e),r.handleURL(n.getURL()).followRedirects().then(()=>t.options.shouldRender?renderSettled().then(()=>this):this,e=>{throw e.error&&e.error instanceof Error?e.error:"TransitionAborted"===e.name?new Error(e.message):e})}willDestroy(){super.willDestroy(),this.application._unwatchInstance(this)}static setupRegistry(e,t={}){let r=t instanceof _BootOptions?t:new _BootOptions(t);e.register("-environment:main",r.toEnvironment(),{instantiate:!1}),e.register("service:-document",r.document,{instantiate:!1}),super.setupRegistry(e,r)}},_BootOptions=class{isInteractive;_renderMode;isBrowser;location=null;shouldRender;document;rootElement;constructor(e={}){this.isInteractive=Boolean(hasDOM),this._renderMode=e._renderMode,void 0!==e.isBrowser?this.isBrowser=Boolean(e.isBrowser):this.isBrowser=Boolean(hasDOM),this.isBrowser||(this.isInteractive=!1,this.location="none"),void 0!==e.shouldRender?this.shouldRender=Boolean(e.shouldRender):this.shouldRender=!0,this.shouldRender||(this.isInteractive=!1),e.document?this.document=e.document:this.document="undefined"!=typeof document?document:null,e.rootElement&&(this.rootElement=e.rootElement),void 0!==e.location&&(this.location=e.location),void 0!==e.isInteractive&&(this.isInteractive=Boolean(e.isInteractive))}toEnvironment(){return{...environment,hasDOM:this.isBrowser,isInteractive:this.isInteractive,_renderMode:this._renderMode,options:this}}},namespace_exports=__exportAll({default:()=>Namespace}),Namespace=class extends EmberObject{static NAMESPACES=NAMESPACES;static NAMESPACES_BY_ID=NAMESPACES_BY_ID;static processAll=processAllNamespaces;static byName=findNamespace;init(e){super.init(e),addNamespace(this)}toString(){let e=get$7(this,"name")||get$7(this,"modulePrefix");if(e)return e;findNamespaces();let t=getName(this);return void 0===t&&(t=guidFor(this),setName(this,t)),t}nameClasses(){processNamespace(this)}destroy(){return removeNamespace(this),super.destroy()}};Namespace.prototype.isNamespace=!0;var DAG=function(){function e(){this._vertices=new Vertices}return e.prototype.add=function(e,t,r,n){if(!e)throw new Error("argument `key` is required");var i=this._vertices,o=i.add(e);if(o.val=t,r)if("string"==typeof r)i.addEdge(o,i.add(r));else for(var s=0;s<r.length;s++)i.addEdge(o,i.add(r[s]));if(n)if("string"==typeof n)i.addEdge(i.add(n),o);else for(s=0;s<n.length;s++)i.addEdge(i.add(n[s]),o)},e.prototype.addEdges=function(e,t,r,n){this.add(e,t,r,n)},e.prototype.each=function(e){this._vertices.walk(e)},e.prototype.topsort=function(e){this.each(e)},e}(),Vertices=function(){function e(){this.length=0,this.stack=new IntStack,this.path=new IntStack,this.result=new IntStack}return e.prototype.add=function(e){if(!e)throw new Error("missing key");for(var t,r=0|this.length,n=0;n<r;n++)if((t=this[n]).key===e)return t;return this.length=r+1,this[r]={idx:r,key:e,val:void 0,out:!1,flag:!1,length:0}},e.prototype.addEdge=function(e,t){this.check(e,t.key);for(var r=0|t.length,n=0;n<r;n++)if(t[n]===e.idx)return;t.length=r+1,t[r]=e.idx,e.out=!0},e.prototype.walk=function(e){this.reset();for(var t=0;t<this.length;t++){var r=this[t];r.out||this.visit(r,"")}this.each(this.result,e)},e.prototype.check=function(e,t){if(e.key===t)throw new Error("cycle detected: "+t+" <- "+t);if(0!==e.length){for(var r=0;r<e.length;r++)if(this[e[r]].key===t)throw new Error("cycle detected: "+t+" <- "+e.key+" <- "+t);if(this.reset(),this.visit(e,t),this.path.length>0){var n="cycle detected: "+t;throw this.each(this.path,function(e){n+=" <- "+e}),new Error(n)}}},e.prototype.reset=function(){this.stack.length=0,this.path.length=0,this.result.length=0;for(var e=0,t=this.length;e<t;e++)this[e].flag=!1},e.prototype.visit=function(e,t){var r=this,n=r.stack,i=r.path,o=r.result;for(n.push(e.idx);n.length;){var s=0|n.pop();if(s>=0){var a=this[s];if(a.flag)continue;if(a.flag=!0,i.push(s),t===a.key)break;n.push(~s),this.pushIncoming(a)}else i.pop(),o.push(~s)}},e.prototype.pushIncoming=function(e){for(var t=this.stack,r=e.length-1;r>=0;r--){var n=e[r];this[n].flag||t.push(n)}},e.prototype.each=function(e,t){for(var r=0,n=e.length;r<n;r++){var i=this[e[r]];t(i.key,i.val)}},e}(),IntStack=function(){function e(){this.length=0}return e.prototype.push=function(e){this[this.length++]=0|e},e.prototype.pop=function(){return 0|this[--this.length]},e}(),ContainerDebugAdapter=class extends EmberObject{constructor(e){super(e),this.resolver=getOwner$2(this).lookup("resolver-for-debugging:main")}resolver;canCatalogEntriesByType(e){return"model"!==e&&"template"!==e}catalogEntriesByType(e){let t=Namespace.NAMESPACES,r=[],n=new RegExp(`${classify$1(e)}$`);return t.forEach(e=>{for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.test(t)&&"class"===typeOf$1(e[t])&&r.push(dasherize$1(t.replace(n,"")))}),r}},on=on$1;function NOOP(){}var InternalComponent=class{static toString(){return"internal component"}constructor(e,t,r){this.owner=e,this.args=t,this.caller=r,setOwner$1(this,e)}get id(){return guidFor(this)}get class(){return"ember-view"}validateArguments(){for(let e of Object.keys(this.args.named))this.isSupportedArgument(e)||this.onUnsupportedArgument(e)}named(e){let t=this.args.named[e];return t?valueForRef(t):void 0}positional(e){let t=this.args.positional[e];return t?valueForRef(t):void 0}listenerFor(e){return this.named(e)||NOOP}isSupportedArgument(e){return!1}onUnsupportedArgument(e){}toString(){return`<${this.constructor}:${guidFor(this)}>`}},OPAQUE_CONSTRUCTOR_MAP=new WeakMap;function opaquify(e,t){let r={create(){throw assert$4("Use constructor instead of create")},toString:()=>e.toString()};return OPAQUE_CONSTRUCTOR_MAP.set(r,e),setInternalComponentManager(INTERNAL_COMPONENT_MANAGER,r),setComponentTemplate(t,r),r}function deopaquify(e){return OPAQUE_CONSTRUCTOR_MAP.get(e)}var CAPABILITIES$1={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},InternalManager=class{getCapabilities(){return CAPABILITIES$1}create(e,t,r,n,i,o){let s=new(deopaquify(t))(e,r.capture(),valueForRef(o));return untrack(s.validateArguments.bind(s)),s}didCreate(){}didUpdate(){}didRenderLayout(){}didUpdateLayout(){}getDebugName(e){return e.toString()}getSelf(e){return createConstRef(e)}getDestroyable(e){return e}},INTERNAL_COMPONENT_MANAGER=new InternalManager,InputTemplate=templateFactory({id:null,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:()=>({on:on}),isStrictMode:!0}),UNINITIALIZED=Object.freeze({});function elementForEvent(e){return e.target}function valueForEvent(e){return elementForEvent(e).value}function devirtualize(e){return t=>e(valueForEvent(t),t)}function valueFrom(e){return void 0===e?new LocalValue(void 0):isConstRef(e)?new LocalValue(valueForRef(e)):isUpdatableRef(e)?new UpstreamValue(e):new ForkedValue(e)}var LocalValue=class{static{decorateFieldV2$1(this.prototype,"value",[tracked])}#S=void initializeDeferredDecorator$1(this,"value");constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}},UpstreamValue=class{constructor(e){this.reference=e}get(){return valueForRef(this.reference)}set(e){updateRef(this.reference,e)}},ForkedValue=class{local;upstream;lastUpstreamValue=UNINITIALIZED;constructor(e){this.upstream=new UpstreamValue(e)}get(){let e=this.upstream.get();return e!==this.lastUpstreamValue&&(this.lastUpstreamValue=e,this.local=new LocalValue(e)),this.local.get()}set(e){this.local.set(e)}},AbstractInput=class extends InternalComponent{validateArguments(){super.validateArguments()}_value=valueFrom(this.args.named.value);get value(){return this._value.get()}set value(e){this._value.set(e)}valueDidChange(e){this.value=valueForEvent(e)}static{decorateMethodV2$1(this.prototype,"valueDidChange",[action])}change(e){this.valueDidChange(e)}input(e){this.valueDidChange(e)}keyUp(e){switch(e.key){case"Enter":this.listenerFor("enter")(e),this.listenerFor("insert-newline")(e);break;case"Escape":this.listenerFor("escape-press")(e)}}static{decorateMethodV2$1(this.prototype,"keyUp",[action])}listenerFor(e){let t=super.listenerFor(e);return this.isVirtualEventListener(e,t)?devirtualize(t):t}isVirtualEventListener(e,t){return-1!==["enter","insert-newline","escape-press"].indexOf(e)}},isValidInputType;if(hasDOM){const e=Object.create(null),t=document.createElement("input");e[""]=!1,e.text=!0,e.checkbox=!0,isValidInputType=r=>{let n=e[r];if(void 0===n){try{t.type=r,n=t.type===r}catch(i){n=!1}finally{t.type="text"}e[r]=n}return n}}else isValidInputType=e=>""!==e;var _Input=class extends AbstractInput{static toString(){return"Input"}get class(){return this.isCheckbox?"ember-checkbox ember-view":"ember-text-field ember-view"}get type(){let e=this.named("type");return null==e?"text":isValidInputType(e)?e:"text"}get isCheckbox(){return"checkbox"===this.named("type")}_checked=valueFrom(this.args.named.checked);get checked(){return this.isCheckbox?this._checked.get():void 0}set checked(e){this._checked.set(e)}change(e){this.isCheckbox?this.checkedDidChange(e):super.change(e)}static{decorateMethodV2$1(this.prototype,"change",[action])}input(e){this.isCheckbox||super.input(e)}static{decorateMethodV2$1(this.prototype,"input",[action])}checkedDidChange(e){let t=e.target;this.checked=t.checked}static{decorateMethodV2$1(this.prototype,"checkedDidChange",[action])}isSupportedArgument(e){return-1!==["type","value","checked","enter","insert-newline","escape-press"].indexOf(e)||super.isSupportedArgument(e)}},Input=opaquify(_Input,InputTemplate),TextareaTemplate=templateFactory({id:null,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:()=>({on:on}),isStrictMode:!0}),_Textarea=class extends AbstractInput{static toString(){return"Textarea"}get class(){return"ember-text-area ember-view"}change(e){super.change(e)}static{decorateMethodV2$1(this.prototype,"change",[action])}input(e){super.input(e)}static{decorateMethodV2$1(this.prototype,"input",[action])}isSupportedArgument(e){return-1!==["type","value","enter","insert-newline","escape-press"].indexOf(e)||super.isSupportedArgument(e)}},Textarea=opaquify(_Textarea,TextareaTemplate),LinkToTemplate=templateFactory({id:null,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:()=>({on:on}),isStrictMode:!0}),EMPTY_ARRAY$1=[],EMPTY_QUERY_PARAMS={};function isMissing(e){return null==e}function isPresent(e){return!isMissing(e)}function isQueryParams(e){return"object"==typeof e&&null!==e&&!0===e.isQueryParams}var _LinkTo=class extends InternalComponent{static toString(){return"LinkTo"}static{decorateFieldV2$1(this.prototype,"routing",[service("-routing")])}#T=void initializeDeferredDecorator$1(this,"routing");validateArguments(){super.validateArguments()}get class(){let e="ember-view";return this.isActive?(e+=this.classFor("active"),!1===this.willBeActive&&(e+=" ember-transitioning-out")):this.willBeActive&&(e+=" ember-transitioning-in"),this.isLoading&&(e+=this.classFor("loading")),this.isDisabled&&(e+=this.classFor("disabled")),e}get href(){if(this.isLoading)return"#";let{routing:e,route:t,models:r,query:n}=this;return consumeTag(tagFor(e,"currentState")),e.generateURL(t,r,n)}click(e){if(!isSimpleClick(e))return;let t=e.currentTarget,r=t instanceof SVGAElement?t.target.baseVal:t.target;if(""!==r&&"_self"!==r)return;if(this.preventDefault(e),this.isDisabled)return;if(this.isLoading)return;let{routing:n,route:i,models:o,query:s,replace:a}=this,l={transition:void 0};flaggedInstrument("interaction.link-to",l,()=>{l.transition=n.transitionTo(i,o,s,a)})}static{decorateMethodV2$1(this.prototype,"click",[action])}get route(){if("route"in this.args.named){let e=this.named("route");return e&&this.namespaceRoute(e)}return this.currentRoute}currentRouteCache=createCache(()=>(consumeTag(tagFor(this.routing,"currentState")),untrack(()=>this.routing.currentRouteName)));get currentRoute(){return getValue$1(this.currentRouteCache)}get models(){return"models"in this.args.named?this.named("models"):"model"in this.args.named?[this.named("model")]:EMPTY_ARRAY$1}get query(){return"query"in this.args.named?{...this.named("query")}:EMPTY_QUERY_PARAMS}get replace(){return!0===this.named("replace")}get isActive(){return this.isActiveForState(this.routing.currentState)}get willBeActive(){let e=this.routing.currentState,t=this.routing.targetState;return e===t?null:this.isActiveForState(t)}get isLoading(){return isMissing(this.route)||this.models.some(e=>isMissing(e))}get isDisabled(){return Boolean(this.named("disabled"))}get isEngine(){return void 0!==getEngineParent(this.owner)}get engineMountPoint(){return this.owner.mountPoint}classFor(e){let t=this.named(`${e}Class`);return!0===t||isMissing(t)?` ${e}`:t?` ${t}`:""}namespaceRoute(e){let{engineMountPoint:t}=this;return void 0===t?e:"application"===e?t:`${t}.${e}`}isActiveForState(e){if(!isPresent(e))return!1;if(this.isLoading)return!1;let t=this.named("current-when");if("boolean"==typeof t)return t;if("string"==typeof t){let{routing:r}=this;return t.split(" ").some(t=>r.isActiveForRoute([],void 0,this.namespaceRoute(t),e))}{let{route:t,models:r,query:n,routing:i}=this;return i.isActiveForRoute(r,n,t,e)}}preventDefault(e){e.preventDefault()}isSupportedArgument(e){return-1!==["route","model","models","query","replace","disabled","current-when","activeClass","loadingClass","disabledClass"].indexOf(e)||super.isSupportedArgument(e)}},{prototype:prototype}=_LinkTo,descriptorFor=(e,t)=>e?Object.getOwnPropertyDescriptor(e,t)||descriptorFor(Object.getPrototypeOf(e),t):null;{let e=prototype.onUnsupportedArgument;Object.defineProperty(prototype,"onUnsupportedArgument",{configurable:!0,enumerable:!1,value:function(t){"href"===t||e.call(this,t)}})}{let e=descriptorFor(prototype,"models").get;Object.defineProperty(prototype,"models",{configurable:!0,enumerable:!1,get:function(){let t=e.call(this);return t.length>0&&!("query"in this.args.named)&&isQueryParams(t[t.length-1])&&(t=t.slice(0,-1)),t}});let t=descriptorFor(prototype,"query").get;Object.defineProperty(prototype,"query",{configurable:!0,enumerable:!1,get:function(){if("query"in this.args.named){let e=t.call(this);return isQueryParams(e)?e.values??EMPTY_QUERY_PARAMS:e}{let t=e.call(this);if(t.length>0){let e=t[t.length-1];if(isQueryParams(e)&&null!==e.values)return e.values}return EMPTY_QUERY_PARAMS}}})}{let e=prototype.onUnsupportedArgument;Object.defineProperty(prototype,"onUnsupportedArgument",{configurable:!0,enumerable:!1,value:function(t){"params"!==t&&e.call(this,t)}})}var LinkTo=opaquify(_LinkTo,LinkToTemplate),SERIALIZATION_FIRST_NODE_STRING="%+b:0%";function isSerializationFirstNode(e){return e.nodeValue===SERIALIZATION_FIRST_NODE_STRING}var RehydratingCursor=class extends CursorImpl{candidate=null;openBlockDepth;injectedOmittedNode=!1;constructor(e,t,r){super(e,t),this.startingBlockDepth=r,this.openBlockDepth=r-1}},RehydrateTree=class extends NewTreeBuilder{unmatchedAttributes=null;blockDepth=0;startingBlockOffset;constructor(e,t,r){if(super(e,t,r),r)throw new Error("Rehydration with nextSibling not supported");let n=this.currentCursor.element.firstChild;for(;null!==n&&!isOpenBlock(n);)n=n.nextSibling;this.candidate=n;const i=getBlockDepth(n);if(0!==i){const e=i-1,t=this.dom.createComment(`%+b:${e}%`);n.parentNode.insertBefore(t,this.candidate);let r=n.nextSibling;for(;null!==r&&(!isCloseBlock(r)||getBlockDepth(r)!==i);)r=r.nextSibling;const o=this.dom.createComment(`%-b:${e}%`);n.parentNode.insertBefore(o,r.nextSibling),this.candidate=t,this.startingBlockOffset=e}else this.startingBlockOffset=0}get currentCursor(){return this.cursors.current}get candidate(){return this.currentCursor?this.currentCursor.candidate:null}set candidate(e){this.currentCursor.candidate=e}disableRehydration(e){const t=this.currentCursor;t.candidate=null,t.nextSibling=e}enableRehydration(e){const t=this.currentCursor;t.candidate=e,t.nextSibling=null}pushElement(e,t=null){const r=new RehydratingCursor(e,t,this.blockDepth||0);null!==this.candidate&&(r.candidate=e.firstChild,this.candidate=e.nextSibling),this.cursors.push(r)}clearMismatch(e){let t=e;const r=this.currentCursor;if(null!==r){const e=r.openBlockDepth;if(e>=r.startingBlockDepth)for(;t&&!(isCloseBlock(t)&&e>=getBlockDepthWithOffset(t,this.startingBlockOffset));)t=this.remove(t);else for(;null!==t;)t=this.remove(t);this.disableRehydration(t)}}__openBlock(){const{currentCursor:e}=this;if(null===e)return;const t=this.blockDepth;this.blockDepth++;const{candidate:r}=e;if(null===r)return;const{tagName:n}=e.element;isOpenBlock(r)&&getBlockDepthWithOffset(r,this.startingBlockOffset)===t?(this.candidate=this.remove(r),e.openBlockDepth=t):"TITLE"!==n&&"SCRIPT"!==n&&"STYLE"!==n&&this.clearMismatch(r)}__closeBlock(){const{currentCursor:e}=this;if(null===e)return;const t=e.openBlockDepth;this.blockDepth--;const{candidate:r}=e;let n=!1;if(null!==r)if(n=!0,isCloseBlock(r)&&getBlockDepthWithOffset(r,this.startingBlockOffset)===t){const t=this.remove(r);this.candidate=t,e.openBlockDepth--}else this.clearMismatch(r),n=!1;if(!n){const t=e.nextSibling;if(null!==t&&isCloseBlock(t)&&getBlockDepthWithOffset(t,this.startingBlockOffset)===this.blockDepth){const r=this.remove(t);this.enableRehydration(r),e.openBlockDepth--}}}__appendNode(e){const{candidate:t}=this;return t||super.__appendNode(e)}__appendHTML(e){const t=this.markerBounds();if(t){const e=t.firstNode(),r=t.lastNode(),n=new ConcreteBounds(this.element,e.nextSibling,r.previousSibling),i=this.remove(e);return this.remove(r),null!==i&&isEmpty$2(i)&&(this.candidate=this.remove(i),null!==this.candidate&&this.clearMismatch(this.candidate)),n}return super.__appendHTML(e)}remove(e){const t=expect(e.parentNode),r=e.nextSibling;return t.removeChild(e),r}markerBounds(){const e=this.candidate;if(e&&isMarker(e)){const t=e;let r=expect(t.nextSibling);for(;!isMarker(r);)r=expect(r.nextSibling);return new ConcreteBounds(this.element,t,r)}return null}__appendText(e){const{candidate:t}=this;return t?isTextNode(t)?(t.nodeValue!==e&&(t.nodeValue=e),this.candidate=t.nextSibling,t):isSeparator(t)||isEmpty$2(t)&&""===e?(this.candidate=this.remove(t),this.__appendText(e)):(this.clearMismatch(t),super.__appendText(e)):super.__appendText(e)}__appendComment(e){const t=this.candidate;return t&&isComment(t)?(t.nodeValue!==e&&(t.nodeValue=e),this.candidate=t.nextSibling,t):(t&&this.clearMismatch(t),super.__appendComment(e))}__openElement(e){const t=this.candidate;if(t&&isElement(t)&&isSameNodeType(t,e))return this.unmatchedAttributes=[].slice.call(t.attributes),t;if(t){if(isElement(t)&&"TBODY"===t.tagName)return this.pushElement(t,null),this.currentCursor.injectedOmittedNode=!0,this.__openElement(e);this.clearMismatch(t)}return super.__openElement(e)}__setAttribute(e,t,r){const n=this.unmatchedAttributes;if(n){const r=findByName(n,e);if(r)return r.value!==t&&(r.value=t),void n.splice(n.indexOf(r),1)}return super.__setAttribute(e,t,r)}__setProperty(e,t){const r=this.unmatchedAttributes;if(r){const n=findByName(r,e);if(n)return n.value!==t&&(n.value=t),void r.splice(r.indexOf(n),1)}return super.__setProperty(e,t)}__flushElement(e,t){const{unmatchedAttributes:r}=this;if(r){for(const e of r)this.constructing.removeAttribute(e.name);this.unmatchedAttributes=null}else super.__flushElement(e,t)}willCloseElement(){const{candidate:e,currentCursor:t}=this;null!==e&&this.clearMismatch(e),t&&t.injectedOmittedNode&&this.popElement(),super.willCloseElement()}getMarker(e,t){const r=e.querySelector(`script[glmr="${t}"]`);return r?castToSimple(r):null}__pushRemoteElement(e,t,r){const n=this.getMarker(castToBrowser(e),t);if(assert$3(!n||n.parentNode===e),void 0===r){for(;null!==e.firstChild&&e.firstChild!==n;)this.remove(e.firstChild);r=null}const i=new RehydratingCursor(e,null,this.blockDepth);this.cursors.push(i),null===n?this.disableRehydration(r):this.candidate=this.remove(n);const o=new RemoteBlock(e);return this.pushBlock(o,!0)}didAppendBounds(e){if(super.didAppendBounds(e),this.candidate){const t=e.lastNode();this.candidate=t.nextSibling}return e}};function isTextNode(e){return 3===e.nodeType}function isComment(e){return 8===e.nodeType}function isOpenBlock(e){return 8===e.nodeType&&0===e.nodeValue.lastIndexOf("%+b:",0)}function isCloseBlock(e){return 8===e.nodeType&&0===e.nodeValue.lastIndexOf("%-b:",0)}function getBlockDepth(e){return parseInt(e.nodeValue.slice(4),10)}function getBlockDepthWithOffset(e,t){return getBlockDepth(e)-t}function isElement(e){return 1===e.nodeType}function isMarker(e){return 8===e.nodeType&&"%glmr%"===e.nodeValue}function isSeparator(e){return 8===e.nodeType&&"%|%"===e.nodeValue}function isEmpty$2(e){return 8===e.nodeType&&"% %"===e.nodeValue}function isSameNodeType(e,t){return"http://www.w3.org/2000/svg"===e.namespaceURI?e.tagName===t:e.tagName===t.toUpperCase()}function findByName(e,t){for(const r of e)if(r.name===t)return r}function rehydrationBuilder(e,t){return RehydrateTree.forInitialRender(e,t)}var TEXT_NODE=3,NEEDS_EXTRA_CLOSE=new WeakMap;function currentNode(e){let{element:t,nextSibling:r}=e;return null===r?t.lastChild:r.previousSibling}var SerializeBuilder=class extends NewTreeBuilder{serializeBlockDepth=0;__openBlock(){let{tagName:e}=this.element;if("TITLE"!==e&&"SCRIPT"!==e&&"STYLE"!==e){let e=this.serializeBlockDepth++;this.__appendComment(`%+b:${e}%`)}super.__openBlock()}__closeBlock(){let{tagName:e}=this.element;if(super.__closeBlock(),"TITLE"!==e&&"SCRIPT"!==e&&"STYLE"!==e){let e=--this.serializeBlockDepth;this.__appendComment(`%-b:${e}%`)}}__appendHTML(e){let{tagName:t}=this.element;if("TITLE"===t||"SCRIPT"===t||"STYLE"===t)return super.__appendHTML(e);let r=this.__appendComment("%glmr%");if("TABLE"===t){let t=e.indexOf("<");t>-1&&"tr"===e.slice(t+1,t+3)&&(e=`<tbody>${e}</tbody>`)}""===e?this.__appendComment("% %"):super.__appendHTML(e);let n=this.__appendComment("%glmr%");return new ConcreteBounds(this.element,r,n)}__appendText(e){let{tagName:t}=this.element,r=currentNode(this);return"TITLE"===t||"SCRIPT"===t||"STYLE"===t?super.__appendText(e):""===e?this.__appendComment("% %"):(r&&r.nodeType===TEXT_NODE&&this.__appendComment("%|%"),super.__appendText(e))}closeElement(){return NEEDS_EXTRA_CLOSE.has(this.element)&&(NEEDS_EXTRA_CLOSE.delete(this.element),super.closeElement()),super.closeElement()}openElement(e){return"tr"===e&&"TBODY"!==this.element.tagName&&"THEAD"!==this.element.tagName&&"TFOOT"!==this.element.tagName&&(this.openElement("tbody"),NEEDS_EXTRA_CLOSE.set(this.constructing,!0),this.flushElement(null)),super.openElement(e)}pushRemoteElement(e,t,r=null){let{dom:n}=this,i=n.createElement("script");return i.setAttribute("glmr",t),n.insertBefore(e,i,r),super.pushRemoteElement(e,t,r)}};function serializeBuilder(e,t){return SerializeBuilder.forInitialRender(e,t)}var OutletTemplate=templateFactory({id:null,block:'[[[46,[28,[32,0],null,null],null,null,null]],[],["component"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/outlet.hbs",scope:()=>({outletHelper:outletHelper}),isStrictMode:!0}),RootTemplate=templateFactory({id:null,block:'[[[46,[30,0],null,null,null]],[],["component"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/root.hbs",isStrictMode:!0});function setupApplicationRegistry(e){e.register("service:-dom-builder",{create(e){switch(getOwner$2(e).lookup("-environment:main")._renderMode){case"serialize":return serializeBuilder.bind(null);case"rehydrate":return rehydrationBuilder.bind(null);default:return clientBuilder.bind(null)}}}),e.register(privatize`template:-root`,RootTemplate),e.register("renderer:-dom",Renderer)}function setupEngineRegistry(e){e.optionsForType("template",{instantiate:!1}),e.register("view:-outlet",OutletView),e.register("template:-outlet",OutletTemplate),e.optionsForType("helper",{instantiate:!1}),e.register("component:input",Input),e.register("component:link-to",LinkTo),e.register("component:textarea",Textarea)}function props(e){let t=[];for(let r in e)t.push(r);return t}var Engine=class extends(Namespace.extend(RegistryProxyMixin)){static initializers=Object.create(null);static instanceInitializers=Object.create(null);static initializer=buildInitializerMethod("initializers");static instanceInitializer=buildInitializerMethod("instanceInitializers");static buildRegistry(e){let t=new Registry({resolver:resolverFor(e)});return t.set=set$1,t.register("application:main",e,{instantiate:!1}),commonSetupRegistry$1(t),setupEngineRegistry(t),t}init(e){super.init(e),this.buildRegistry()}_initializersRan=!1;ensureInitializers(){this._initializersRan||(this.runInitializers(),this._initializersRan=!0)}buildInstance(e={}){return this.ensureInitializers(),EngineInstance.create({...e,base:this})}buildRegistry(){return this.__registry__=this.constructor.buildRegistry(this)}initializer(e){this.constructor.initializer(e)}instanceInitializer(e){this.constructor.instanceInitializer(e)}runInitializers(){this._runInitializer("initializers",(e,t)=>{t.initialize(this)})}runInstanceInitializers(e){this._runInitializer("instanceInitializers",(t,r)=>{r.initialize(e)})}_runInitializer(e,t){let r,n=get$7(this.constructor,e),i=props(n),o=new DAG;for(let s of i)r=n[s],o.add(r.name,r,r.before,r.after);o.topsort(t)}};function resolverFor(e){let t={namespace:e};return e.Resolver.create(t)}function buildInitializerMethod(e){return function(t){let r=this.superclass;if(void 0!==r[e]&&r[e]===this[e]){let t={[e]:Object.create(this[e])};this.reopenClass(t)}this[e][t.name]=t}}function commonSetupRegistry$1(e){e.optionsForType("component",{singleton:!1}),e.optionsForType("view",{singleton:!1}),e.register("controller:basic",Controller,{instantiate:!1}),e.register("service:-routing",RoutingService),e.register("resolver-for-debugging:main",e.resolver,{instantiate:!1}),e.register("container-debug-adapter:main",ContainerDebugAdapter)}var application_exports$2=__exportAll({default:()=>Application$1,getOwner:()=>getOwner,setOwner:()=>setOwner}),getOwner=getOwner$1,setOwner=setOwner$1,Application$1=class extends Engine{static buildRegistry(e){let t=super.buildRegistry(e);return commonSetupRegistry(t),setupApplicationRegistry(t),t}static initializer=buildInitializerMethod("initializers");static instanceInitializer=buildInitializerMethod("instanceInitializers");init(e){super.init(e),this.rootElement??="body",this._document??=null,this.eventDispatcher??=null,this.customEvents??=null,this.autoboot??=!0,this._document??=hasDOM?window.document:null,this._readinessDeferrals=1,this._booted=!1,this._applicationInstances=new Set,this.autoboot=Boolean(this.autoboot),this.autoboot&&(this.Router=(this.Router||EmberRouter).extend(),this._buildDeprecatedInstance(),this.waitForDOMReady())}buildInstance(e={}){return ApplicationInstance.create({...e,base:this,application:this})}_watchInstance(e){this._applicationInstances.add(e)}_unwatchInstance(e){return this._applicationInstances.delete(e)}Router;__deprecatedInstance__;__container__;_buildDeprecatedInstance(){let e=this.buildInstance();this.__deprecatedInstance__=e,this.__container__=e.__container__}waitForDOMReady(){const e=this._document;if(null===e||"loading"!==e.readyState)schedule("actions",this,this.domReady);else{let t=()=>{e.removeEventListener("DOMContentLoaded",t),run(this,this.domReady)};e.addEventListener("DOMContentLoaded",t)}}domReady(){this.isDestroying||this.isDestroyed||this._bootSync()}deferReadiness(){this._readinessDeferrals++}advanceReadiness(){this._readinessDeferrals--,0===this._readinessDeferrals&&once(this,this.didBecomeReady)}_bootPromise=null;boot(){if(this._bootPromise)return this._bootPromise;try{this._bootSync()}catch(e){}return this._bootPromise}_bootResolver=null;_bootSync(){if(this._booted||this.isDestroying||this.isDestroyed)return;let e=this._bootResolver=RSVP$1.defer();this._bootPromise=e.promise;try{this.runInitializers(),this.advanceReadiness()}catch(error){throw e.reject(error),error}}reset(){let e=this.__deprecatedInstance__;this._readinessDeferrals=1,this._bootPromise=null,this._bootResolver=null,this._booted=!1,join$2(this,function(){run(e,"destroy"),this._buildDeprecatedInstance(),schedule("actions",this,"_bootSync")})}didBecomeReady(){if(!this.isDestroying&&!this.isDestroyed)try{if(this.autoboot){let e=this.__deprecatedInstance__;e._bootSync(),this.ready(),e.startRouting()}this._bootResolver.resolve(this),this._booted=!0}catch(error){throw this._bootResolver.reject(error),error}}ready(){return this}willDestroy(){super.willDestroy(),this._applicationInstances.size&&(this._applicationInstances.forEach(e=>e.destroy()),this._applicationInstances.clear())}visit(e,t){return this.boot().then(()=>{let r=this.buildInstance();return r.boot(t).then(()=>r.visit(e)).catch(e=>{throw run(r,"destroy"),e})})}};function commonSetupRegistry(e){e.register("router:main",EmberRouter),e.register("-view-registry:main",{create:()=>makeDictionary(null)}),e.register("route:basic",Route),e.register("event_dispatcher:main",EventDispatcher),e.register("location:hash",HashLocation),e.register("location:history",HistoryLocation),e.register("location:none",NoneLocation),e.register(privatize`-bucket-cache:main`,{create:()=>new BucketCache}),e.register("service:router",RouterService)}var _embroider_implicit_modules_default=Object.assign({},{});function config$1(e){return runtimeConfig.packages[e]}function getGlobalConfig(){return runtimeConfig.global}var runtimeConfig=globalThis.__embroider_macros__runtime_config__||={};runtimeConfig.packages||={},runtimeConfig.global||={};var localConfig=initializeRuntimeMacrosConfig();function initializeRuntimeMacrosConfig(){return{packages:{},global:{}}}function updaterMethods(){return{config:config$1,getGlobalConfig:getGlobalConfig,setConfig(e,t){runtimeConfig.packages[e]=t},setGlobalConfig(e,t){runtimeConfig.global[e]=t}}}Object.assign(runtimeConfig.packages,localConfig.packages),Object.assign(runtimeConfig.global,localConfig.global);var updaters="undefined"!=typeof window?window._embroider_macros_runtime_config:void 0;if(updaters){let e=updaterMethods();for(let t of updaters)t(e)}var environment_exports=__exportAll({default:()=>ENV,enterTestMode:()=>enterTestMode}),ENV={modulePrefix:"marco",environment:"production",rootURL:"/",locationType:"history",EmberENV:{},APP:{}};function enterTestMode(){ENV.locationType="none",ENV.APP.rootElement="#ember-testing",ENV.APP.autoboot=!1;const e=getGlobalConfig()["@embroider/macros"];e&&(e.isTesting=!0)}var registerHandler$1=()=>{},deprecate$1=()=>{},registerHandler=()=>{};function captureRenderTree(e){let t=e.lookup("renderer:-dom");if(!t)throw new Error("BUG: owner is missing renderer");return t.debugRenderTree.capture()}var debug_exports=__exportAll({_warnIfUsingStrippedFeatureFlags:()=>_warnIfUsingStrippedFeatureFlags,assert:()=>assert$4,captureRenderTree:()=>captureRenderTree,debug:()=>debug$1,debugFreeze:()=>debugFreeze,debugSeal:()=>debugSeal,deprecate:()=>deprecate,deprecateFunc:()=>deprecateFunc,getDebugFunction:()=>getDebugFunction,info:()=>info,inspect:()=>inspect,isTesting:()=>isTesting,registerDeprecationHandler:()=>registerHandler$1,registerWarnHandler:()=>registerHandler,runInDebug:()=>runInDebug,setDebugFunction:()=>setDebugFunction,setTesting:()=>setTesting,warn:()=>warn$1}),noop$1=()=>{},info=noop$1,warn$1=noop$1,debug$1=noop$1,debugSeal=noop$1,debugFreeze=noop$1,runInDebug=noop$1,setDebugFunction=noop$1,getDebugFunction=noop$1,deprecateFunc=function(){return arguments[arguments.length-1]},_warnIfUsingStrippedFeatureFlags;function deprecate(...e){return deprecate$1(...e)}var LOG_LIMIT=100;function setupDeprecationWorkflow(e){self.deprecationWorkflow=self.deprecationWorkflow||{},self.deprecationWorkflow.deprecationLog={messages:new Set},registerHandler$1((t,r,n)=>handleDeprecationWorkflow(e,t,r,n)),registerHandler$1(deprecationCollector),self.deprecationWorkflow.flushDeprecations=t=>flushDeprecations({config:e,...t})}function matchesWorkflow(e,t){return"string"==typeof e&&e===t||e instanceof RegExp&&e.exec(t)}function detectWorkflow(e,t,r){if(!e||!e.workflow)return;let n,i,o,s;for(n=0;n<e.workflow.length;n++)if(i=e.workflow[n],o=i.matchMessage,s=i.matchId,matchesWorkflow(s,r?.id)||matchesWorkflow(o,t))return i}function flushDeprecations({handler:e="silence",config:t={}}={}){let r=self.deprecationWorkflow.deprecationLog.messages,n=t.workflow??[],i=r.values().filter(e=>!n.some(t=>t.matchId===e)).map(t=>({handler:e,matchId:t})),o={...t,workflow:[...n,...i]};return`import setupDeprecationWorkflow from 'ember-cli-deprecation-workflow';\n\nsetupDeprecationWorkflow(${JSON.stringify(o,void 0,2)});`}function handleDeprecationWorkflow(e,t,r,n){let i=detectWorkflow(e,t,r);if(i)switch(i.handler){case"silence":break;case"log":{let e=r&&r.id||t;self.deprecationWorkflow.logCounts||(self.deprecationWorkflow.logCounts={});let n=self.deprecationWorkflow.logCounts[e]||0;self.deprecationWorkflow.logCounts[e]=++n,n<=LOG_LIMIT&&(console.warn("DEPRECATION: "+t),n===LOG_LIMIT&&console.warn("To avoid console overflow, this deprecation will not be logged any more in this run."));break}case"throw":throw new Error(t+` (id: ${r?.id||"unknown"})`);default:n(t,r)}else{if(e&&e.throwOnUnhandled)throw new Error(t);n(t,r)}}function deprecationCollector(e,t,r){self.deprecationWorkflow.deprecationLog.messages.add(t.id),r(e,t)}var deprecation_workflow_exports=__exportAll({});setupDeprecationWorkflow({throwOnUnhandled:!1,workflow:[]});var WAITERS=function(){const e="TEST_WAITERS",t="undefined"!=typeof Symbol?Symbol.for(e):e,r=getGlobal();let n=r[t];return void 0===n&&(n=r[t]=new Map),n}();function indexable(e){return e}function getGlobal(){if("undefined"!=typeof globalThis)return indexable(globalThis);if("undefined"!=typeof self)return indexable(self);if("undefined"!=typeof window)return indexable(window);throw new Error("unable to locate global object")}var NoopTestWaiter=class{name;constructor(e){this.name=e}beginAsync(){return this}endAsync(){}waitUntil(){return!0}debugInfo(){return[]}reset(){}};function buildWaiter(e){return new NoopTestWaiter(e)}buildWaiter("@ember/test-waiters:promise-waiter"),buildWaiter("@ember/test-waiters:generator-waiter");var destroyable_exports=__exportAll({assertDestroyablesDestroyed:()=>assertDestroyablesDestroyed,associateDestroyableChild:()=>associateDestroyableChild,destroy:()=>destroy,enableDestroyableTracking:()=>enableDestroyableTracking,isDestroyed:()=>isDestroyed,isDestroying:()=>isDestroying,registerDestructor:()=>registerDestructor,unregisterDestructor:()=>unregisterDestructor}),Router$1;function registerDestructor(e,t){return registerDestructor$1(e,t)}function unregisterDestructor(e,t){return unregisterDestructor$1(e,t)}function esCompat(e){return e?.__esModule?e:{default:e,...e}}esCompat(owner_exports).getOwner,Router$1=EmberRouter;var Router$1$1=Router$1,router_exports=__exportAll({default:()=>Router}),Router=class extends Router$1$1{location=ENV.locationType;rootURL=ENV.rootURL};Router.map(function(){this.route("place",{path:"/place/:place_id"}),this.route("place.new",{path:"/place/new"}),this.route("search"),this.route("menu"),this.route("lists",function(){this.route("list",{path:"/:list_id"})}),this.route("oauth",function(){this.route("osm-callback",{path:"/osm/callback"})})});var isRecord$2=e=>e instanceof Object;function validateEvent$3(e){if(!isRecord$2(e))return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.pubkey)return!1;if(!e.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let r=e.tags[t];if(!Array.isArray(r))return!1;for(let e=0;e<r.length;e++)if("string"!=typeof r[e])return!1}return!0}function isRegularKind$1(e){return e<1e4&&0!==e&&3!==e}function isReplaceableKind$2(e){return 0===e||3===e||1e4<=e&&e<2e4}function isAddressableKind$2(e){return 3e4<=e&&e<4e4}function isKind$1(e,t){const r=t instanceof Array?t:[t];return validateEvent$3(e)&&r.includes(e.kind)||!1}function number$2(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bytes$2(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function hash$3(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");number$2(e.outputLen),number$2(e.blockLen)}function exists$2(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output$2(e,t){bytes$2(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var crypto$2="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,u8a$2=e=>e instanceof Uint8Array,createView$3=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr$2=(e,t)=>e<<32-t|e>>>t,isLE$2=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];if(!isLE$2)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes$3(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function toBytes$2(e){if("string"==typeof e&&(e=utf8ToBytes$3(e)),!u8a$2(e))throw new Error("expected Uint8Array, got "+typeof e);return e}function concatBytes$3(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let r=0;return e.forEach(e=>{if(!u8a$2(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length}),t}var Hash$1=class{clone(){return this._cloneInto()}},toStr={}.toString;function wrapConstructor$1(e){const t=t=>e().update(toBytes$2(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function randomBytes$1(e=32){if(crypto$2&&"function"==typeof crypto$2.getRandomValues)return crypto$2.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function setBigUint64$2(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),l=n?4:0,c=n?0:4;e.setUint32(t+l,s,n),e.setUint32(t+c,a,n)}var SHA2$1=class extends Hash$1{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView$3(this.buffer)}update(e){exists$2(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=toBytes$2(e)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const t=createView$3(e);for(;n<=i-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){exists$2(this),output$2(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let u=o;u<n;u++)t[u]=0;setBigUint64$2(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=createView$3(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)s.setUint32(4*u,c[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.length=n,e.pos=s,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}},Chi$2=(e,t,r)=>e&t^~e&r,Maj$2=(e,t,r)=>e&t^e&r^t&r,SHA256_K$2=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV$1=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$2=new Uint32Array(64),SHA256$1=class extends SHA2$1{constructor(){super(64,32,8,!1),this.A=0|IV$1[0],this.B=0|IV$1[1],this.C=0|IV$1[2],this.D=0|IV$1[3],this.E=0|IV$1[4],this.F=0|IV$1[5],this.G=0|IV$1[6],this.H=0|IV$1[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)SHA256_W$2[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=SHA256_W$2[u-15],t=SHA256_W$2[u-2],r=rotr$2(e,7)^rotr$2(e,18)^e>>>3,n=rotr$2(t,17)^rotr$2(t,19)^t>>>10;SHA256_W$2[u]=n+SHA256_W$2[u-7]+r+SHA256_W$2[u-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:l,H:c}=this;for(let u=0;u<64;u++){const e=c+(rotr$2(s,6)^rotr$2(s,11)^rotr$2(s,25))+Chi$2(s,a,l)+SHA256_K$2[u]+SHA256_W$2[u]|0,t=(rotr$2(r,2)^rotr$2(r,13)^rotr$2(r,22))+Maj$2(r,n,i)|0;c=l,l=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+t|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,l,c)}roundClean(){SHA256_W$2.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},sha256$2=wrapConstructor$1(()=>new SHA256$1),utils_exports$1=__exportAll({bitGet:()=>bitGet,bitLen:()=>bitLen,bitMask:()=>bitMask,bitSet:()=>bitSet,bytesToHex:()=>bytesToHex$3,bytesToNumberBE:()=>bytesToNumberBE,bytesToNumberLE:()=>bytesToNumberLE,concatBytes:()=>concatBytes$2,createHmacDrbg:()=>createHmacDrbg,ensureBytes:()=>ensureBytes,equalBytes:()=>equalBytes$1,hexToBytes:()=>hexToBytes$3,hexToNumber:()=>hexToNumber,numberToBytesBE:()=>numberToBytesBE,numberToBytesLE:()=>numberToBytesLE,numberToHexUnpadded:()=>numberToHexUnpadded,numberToVarBytesBE:()=>numberToVarBytesBE,utf8ToBytes:()=>utf8ToBytes$2,validateObject:()=>validateObject$1}),_0n$4=BigInt(0),_1n$4=BigInt(1),_2n$2=BigInt(2),u8a$1=e=>e instanceof Uint8Array,hexes$2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex$3(e){if(!u8a$1(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=hexes$2[e[r]];return t}function numberToHexUnpadded(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function hexToNumber(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function hexToBytes$3(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let n=0;n<r.length;n++){const t=2*n,i=e.slice(t,t+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");r[n]=o}return r}function bytesToNumberBE(e){return hexToNumber(bytesToHex$3(e))}function bytesToNumberLE(e){if(!u8a$1(e))throw new Error("Uint8Array expected");return hexToNumber(bytesToHex$3(Uint8Array.from(e).reverse()))}function numberToBytesBE(e,t){return hexToBytes$3(e.toString(16).padStart(2*t,"0"))}function numberToBytesLE(e,t){return numberToBytesBE(e,t).reverse()}function numberToVarBytesBE(e){return hexToBytes$3(numberToHexUnpadded(e))}function ensureBytes(e,t,r){let n;if("string"==typeof t)try{n=hexToBytes$3(t)}catch(o){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${o}`)}else{if(!u8a$1(t))throw new Error(`${e} must be hex string or Uint8Array`);n=Uint8Array.from(t)}const i=n.length;if("number"==typeof r&&i!==r)throw new Error(`${e} expected ${r} bytes, got ${i}`);return n}function concatBytes$2(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let r=0;return e.forEach(e=>{if(!u8a$1(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length}),t}function equalBytes$1(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function utf8ToBytes$2(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function bitLen(e){let t;for(t=0;e>_0n$4;e>>=_1n$4,t+=1);return t}function bitGet(e,t){return e>>BigInt(t)&_1n$4}var bitSet=(e,t,r)=>e|(r?_1n$4:_0n$4)<<BigInt(t),bitMask=e=>(_2n$2<<BigInt(e-1))-_1n$4,u8n$1=e=>new Uint8Array(e),u8fr=e=>Uint8Array.from(e);function createHmacDrbg(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=u8n$1(e),i=u8n$1(e),o=0;const s=()=>{n.fill(1),i.fill(0),o=0},a=(...e)=>r(i,n,...e),l=(e=u8n$1())=>{i=a(u8fr([0]),e),n=a(),0!==e.length&&(i=a(u8fr([1]),e),n=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=a();const t=n.slice();r.push(t),e+=n.length}return concatBytes$2(...r)};return(e,t)=>{let r;for(s(),l(e);!(r=t(c()));)l();return s(),r}}var validatorFns={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function validateObject$1(e,t,r={}){const n=(t,r,n)=>{const i=validatorFns[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(const[i,o]of Object.entries(t))n(i,o,!1);for(const[i,o]of Object.entries(r))n(i,o,!0);return e}var _0n$3=BigInt(0),_1n$3=BigInt(1),_2n$1=BigInt(2),_3n$1=BigInt(3),_4n=BigInt(4),_5n=BigInt(5),_8n=BigInt(8),_9n=BigInt(9),_16n=BigInt(16);function mod(e,t){const r=e%t;return r>=_0n$3?r:t+r}function pow(e,t,r){if(r<=_0n$3||t<_0n$3)throw new Error("Expected power/modulo > 0");if(r===_1n$3)return _0n$3;let n=_1n$3;for(;t>_0n$3;)t&_1n$3&&(n=n*e%r),e=e*e%r,t>>=_1n$3;return n}function pow2(e,t,r){let n=e;for(;t-- >_0n$3;)n*=n,n%=r;return n}function invert$1(e,t){if(e===_0n$3||t<=_0n$3)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=mod(e,t),n=t,i=_0n$3,o=_1n$3,s=_1n$3,a=_0n$3;for(;r!==_0n$3;){const e=n/r,t=n%r,l=i-s*e,c=o-a*e;n=r,r=t,i=s,o=a,s=l,a=c}if(n!==_1n$3)throw new Error("invert: does not exist");return mod(i,t)}function tonelliShanks(e){const t=(e-_1n$3)/_2n$1;let r,n,i;for(r=e-_1n$3,n=0;r%_2n$1===_0n$3;r/=_2n$1,n++);for(i=_2n$1;i<e&&pow(i,t,e)!==e-_1n$3;i++);if(1===n){const t=(e+_1n$3)/_4n;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}const o=(r+_1n$3)/_2n$1;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=n,l=e.pow(e.mul(e.ONE,i),r),c=e.pow(s,o),u=e.pow(s,r);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(u);t<a&&!e.eql(n,e.ONE);t++)n=e.sqr(n);const r=e.pow(l,_1n$3<<BigInt(a-t-1));l=e.sqr(r),c=e.mul(c,r),u=e.mul(u,l),a=t}return c}}function FpSqrt(e){if(e%_4n===_3n$1){const t=(e+_1n$3)/_4n;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%_8n===_5n){const t=(e-_5n)/_8n;return function(e,r){const n=e.mul(r,_2n$1),i=e.pow(n,t),o=e.mul(r,i),s=e.mul(e.mul(o,_2n$1),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),r))throw new Error("Cannot find square root");return a}}return tonelliShanks(e)}var FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(e){const t=FIELD_FIELDS.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return validateObject$1(e,t)}function FpPow(e,t,r){if(r<_0n$3)throw new Error("Expected power > 0");if(r===_0n$3)return e.ONE;if(r===_1n$3)return t;let n=e.ONE,i=t;for(;r>_0n$3;)r&_1n$3&&(n=e.mul(n,i)),i=e.sqr(i),r>>=_1n$3;return n}function FpInvertBatch(e,t){const r=new Array(t.length),n=t.reduce((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n)),e.ONE),i=e.inv(n);return t.reduceRight((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n)),i),r}function nLength(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function Field(e,t,r=!1,n={}){if(e<=_0n$3)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=nLength(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=FpSqrt(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:bitMask(i),ZERO:_0n$3,ONE:_1n$3,create:t=>mod(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return _0n$3<=t&&t<e},is0:e=>e===_0n$3,isOdd:e=>(e&_1n$3)===_1n$3,neg:t=>mod(-t,e),eql:(e,t)=>e===t,sqr:t=>mod(t*t,e),add:(t,r)=>mod(t+r,e),sub:(t,r)=>mod(t-r,e),mul:(t,r)=>mod(t*r,e),pow:(e,t)=>FpPow(a,e,t),div:(t,r)=>mod(t*invert$1(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>invert$1(t,e),sqrt:n.sqrt||(e=>s(a,e)),invertBatch:e=>FpInvertBatch(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?numberToBytesLE(e,o):numberToBytesBE(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return r?bytesToNumberLE(e):bytesToNumberBE(e)}});return Object.freeze(a)}function getFieldBytesLength(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function getMinHashLength(e){const t=getFieldBytesLength(e);return t+Math.ceil(t/2)}function mapHashToField(e,t,r=!1){const n=e.length,i=getFieldBytesLength(t),o=getMinHashLength(t);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const s=mod(r?bytesToNumberBE(e):bytesToNumberLE(e),t-_1n$3)+_1n$3;return r?numberToBytesLE(s,i):numberToBytesBE(s,i)}var _0n$2=BigInt(0),_1n$2=BigInt(1);function wNAF$1(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>_0n$2;)r&_1n$2&&(n=n.add(i)),i=i.double(),r>>=_1n$2;return n},precomputeWindow(e,t){const{windows:r,windowSize:i}=n(t),o=[];let s=e,a=s;for(let n=0;n<r;n++){a=s,o.push(a);for(let e=1;e<i;e++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(t,i,o){const{windows:s,windowSize:a}=n(t);let l=e.ZERO,c=e.BASE;const u=BigInt(2**t-1),h=2**t,d=BigInt(t);for(let e=0;e<s;e++){const t=e*a;let n=Number(o&u);o>>=d,n>a&&(n-=h,o+=_1n$2);const s=t,p=t+Math.abs(n)-1,f=e%2!=0,g=n<0;0===n?c=c.add(r(f,i[s])):l=l.add(r(g,i[p]))}return{p:l,f:c}},wNAFCached(e,t,r,n){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}}function validateBasic(e){return validateField(e.Fp),validateObject$1(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nLength(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function validatePointOpts(e){const t=validateBasic(e);validateObject$1(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:b2n,hexToBytes:h2b}=utils_exports$1,DER={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=DER;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:b2n(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=DER,r="string"==typeof e?h2b(e):e;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||48!=r[0])throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=DER._parseInt(r.subarray(2)),{d:s,l:a}=DER._parseInt(o);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:s}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),i=t(r(e.r)),o=n.length/2,s=i.length/2,a=r(o),l=r(s);return`30${r(s+o+4)}02${l}${i}02${a}${n}`}},_0n$1=BigInt(0),_1n$1=BigInt(1),_3n=BigInt(3);function weierstrassPoints(e){const t=validatePointOpts(e),{Fp:r}=t,n=t.toBytes||((e,t)=>{const n=t.toAffine();return concatBytes$2(Uint8Array.from([4]),r.toBytes(n.x),r.toBytes(n.y))}),i=t.fromBytes||(e=>{const t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function o(e){const{a:n,b:i}=t,o=r.sqr(e),s=r.mul(o,e);return r.add(r.add(s,r.mul(e,n)),i)}if(!r.eql(r.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function s(e){return"bigint"==typeof e&&_0n$1<e&&e<t.n}function a(e){if(!s(e))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(e){const{allowedPrivateKeyLengths:r,nByteLength:n,wrapPrivateKey:i,n:o}=t;if(r&&"bigint"!=typeof e){if(e instanceof Uint8Array&&(e=bytesToHex$3(e)),"string"!=typeof e||!r.includes(e.length))throw new Error("Invalid key");e=e.padStart(2*n,"0")}let s;try{s="bigint"==typeof e?e:bytesToNumberBE(ensureBytes("private key",e,n))}catch(error){throw new Error(`private key must be ${n} bytes, hex or bigint, not ${typeof e}`)}return i&&(s=mod(s,o)),a(s),s}const c=new Map;function u(e){if(!(e instanceof h))throw new Error("ProjectivePoint expected")}class h{constructor(e,t,n){if(this.px=e,this.py=t,this.pz=n,null==e||!r.isValid(e))throw new Error("x required");if(null==t||!r.isValid(t))throw new Error("y required");if(null==n||!r.isValid(n))throw new Error("z required")}static fromAffine(e){const{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw new Error("invalid affine point");if(e instanceof h)throw new Error("projective point not allowed");const i=e=>r.eql(e,r.ZERO);return i(t)&&i(n)?h.ZERO:new h(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=r.invertBatch(e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(h.fromAffine)}static fromHex(e){const t=h.fromAffine(i(ensureBytes("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return h.BASE.multiply(l(e))}_setWindowSize(e){this._WINDOW_SIZE=e,c.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:n}=this.toAffine();if(!r.isValid(e)||!r.isValid(n))throw new Error("bad point: x or y not FE");const i=r.sqr(n),s=o(e);if(!r.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){u(e);const{px:t,py:n,pz:i}=this,{px:o,py:s,pz:a}=e,l=r.eql(r.mul(t,a),r.mul(o,i)),c=r.eql(r.mul(n,a),r.mul(s,i));return l&&c}negate(){return new h(this.px,r.neg(this.py),this.pz)}double(){const{a:e,b:n}=t,i=r.mul(n,_3n),{px:o,py:s,pz:a}=this;let l=r.ZERO,c=r.ZERO,u=r.ZERO,d=r.mul(o,o),p=r.mul(s,s),f=r.mul(a,a),g=r.mul(o,s);return g=r.add(g,g),u=r.mul(o,a),u=r.add(u,u),l=r.mul(e,u),c=r.mul(i,f),c=r.add(l,c),l=r.sub(p,c),c=r.add(p,c),c=r.mul(l,c),l=r.mul(g,l),u=r.mul(i,u),f=r.mul(e,f),g=r.sub(d,f),g=r.mul(e,g),g=r.add(g,u),u=r.add(d,d),d=r.add(u,d),d=r.add(d,f),d=r.mul(d,g),c=r.add(c,d),f=r.mul(s,a),f=r.add(f,f),d=r.mul(f,g),l=r.sub(l,d),u=r.mul(f,p),u=r.add(u,u),u=r.add(u,u),new h(l,c,u)}add(e){u(e);const{px:n,py:i,pz:o}=this,{px:s,py:a,pz:l}=e;let c=r.ZERO,d=r.ZERO,p=r.ZERO;const f=t.a,g=r.mul(t.b,_3n);let m=r.mul(n,s),y=r.mul(i,a),v=r.mul(o,l),_=r.add(n,i),b=r.add(s,a);_=r.mul(_,b),b=r.add(m,y),_=r.sub(_,b),b=r.add(n,o);let E=r.add(s,l);return b=r.mul(b,E),E=r.add(m,v),b=r.sub(b,E),E=r.add(i,o),c=r.add(a,l),E=r.mul(E,c),c=r.add(y,v),E=r.sub(E,c),p=r.mul(f,b),c=r.mul(g,v),p=r.add(c,p),c=r.sub(y,p),p=r.add(y,p),d=r.mul(c,p),y=r.add(m,m),y=r.add(y,m),v=r.mul(f,v),b=r.mul(g,b),y=r.add(y,v),v=r.sub(m,v),v=r.mul(f,v),b=r.add(b,v),m=r.mul(y,b),d=r.add(d,m),m=r.mul(E,b),c=r.mul(_,c),c=r.sub(c,m),m=r.mul(_,y),p=r.mul(E,p),p=r.add(p,m),new h(c,d,p)}subtract(e){return this.add(e.negate())}is0(){return this.equals(h.ZERO)}wNAF(e){return p.wNAFCached(this,c,e,e=>{const t=r.invertBatch(e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(h.fromAffine)})}multiplyUnsafe(e){const n=h.ZERO;if(e===_0n$1)return n;if(a(e),e===_1n$1)return this;const{endo:i}=t;if(!i)return p.unsafeLadder(this,e);let{k1neg:o,k1:s,k2neg:l,k2:c}=i.splitScalar(e),u=n,d=n,f=this;for(;s>_0n$1||c>_0n$1;)s&_1n$1&&(u=u.add(f)),c&_1n$1&&(d=d.add(f)),f=f.double(),s>>=_1n$1,c>>=_1n$1;return o&&(u=u.negate()),l&&(d=d.negate()),d=new h(r.mul(d.px,i.beta),d.py,d.pz),u.add(d)}multiply(e){a(e);let n,i,o=e;const{endo:s}=t;if(s){const{k1neg:e,k1:t,k2neg:a,k2:l}=s.splitScalar(o);let{p:c,f:u}=this.wNAF(t),{p:d,f:f}=this.wNAF(l);c=p.constTimeNegate(e,c),d=p.constTimeNegate(a,d),d=new h(r.mul(d.px,s.beta),d.py,d.pz),n=c.add(d),i=u.add(f)}else{const{p:e,f:t}=this.wNAF(o);n=e,i=t}return h.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(e,t,r){const n=h.BASE,i=(e,t)=>t!==_0n$1&&t!==_1n$1&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){const{px:t,py:n,pz:i}=this,o=this.is0();null==e&&(e=o?r.ONE:r.inv(i));const s=r.mul(t,e),a=r.mul(n,e),l=r.mul(i,e);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(l,r.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:e,isTorsionFree:r}=t;if(e===_1n$1)return!0;if(r)return r(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:r}=t;return e===_1n$1?this:r?r(h,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),n(h,this,e)}toHex(e=!0){return bytesToHex$3(this.toRawBytes(e))}}h.BASE=new h(t.Gx,t.Gy,r.ONE),h.ZERO=new h(r.ZERO,r.ONE,r.ZERO);const d=t.nBitLength,p=wNAF$1(h,t.endo?Math.ceil(d/2):d);return{CURVE:t,ProjectivePoint:h,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:s}}function validateOpts(e){const t=validateBasic(e);return validateObject$1(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function weierstrass(e){const t=validateOpts(e),{Fp:r,n:n}=t,i=r.BYTES+1,o=2*r.BYTES+1;function s(e){return mod(e,n)}function a(e){return invert$1(e,n)}const{ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:u,isWithinCurveOrder:h}=weierstrassPoints({...t,toBytes(e,t,n){const i=t.toAffine(),o=r.toBytes(i.x),s=concatBytes$2;return n?s(Uint8Array.from([t.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(e){const t=e.length,n=e[0],s=e.subarray(1);if(t!==i||2!==n&&3!==n){if(t===o&&4===n)return{x:r.fromBytes(s.subarray(0,r.BYTES)),y:r.fromBytes(s.subarray(r.BYTES,2*r.BYTES))};throw new Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const e=bytesToNumberBE(s);if(!(_0n$1<(a=e)&&a<r.ORDER))throw new Error("Point is not on curve");const t=u(e);let i=r.sqrt(t);return!(1&~n)!=((i&_1n$1)===_1n$1)&&(i=r.neg(i)),{x:e,y:i}}var a}}),d=e=>bytesToHex$3(numberToBytesBE(e,t.nByteLength));function p(e){return e>n>>_1n$1}const f=(e,t,r)=>bytesToNumberBE(e.slice(t,r));class g{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const r=t.nByteLength;return e=ensureBytes("compactSignature",e,2*r),new g(f(e,0,r),f(e,r,2*r))}static fromDER(e){const{r:t,s:r}=DER.toSig(ensureBytes("DER",e));return new g(t,r)}assertValidity(){if(!h(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!h(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new g(this.r,this.s,e)}recoverPublicKey(e){const{r:n,s:i,recovery:o}=this,c=_(ensureBytes("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const u=2===o||3===o?n+t.n:n;if(u>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const h=1&o?"03":"02",p=l.fromHex(h+d(u)),f=a(u),g=s(-c*f),m=s(i*f),y=l.BASE.multiplyAndAddUnsafe(p,g,m);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$3(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$3(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}const m={isValidPrivateKey(e){try{return c(e),!0}catch(error){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const e=getMinHashLength(t.n);return mapHashToField(t.randomBytes(e),t.n)},precompute:(e=8,t=l.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function y(e){const t=e instanceof Uint8Array,r="string"==typeof e,n=(t||r)&&e.length;return t?n===i||n===o:r?n===2*i||n===2*o:e instanceof l}const v=t.bits2int||function(e){const r=bytesToNumberBE(e),n=8*e.length-t.nBitLength;return n>0?r>>BigInt(n):r},_=t.bits2int_modN||function(e){return s(v(e))},b=bitMask(t.nBitLength);function E(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(_0n$1<=e&&e<b))throw new Error(`bigint expected < 2^${t.nBitLength}`);return numberToBytesBE(e,t.nByteLength)}const w={lowS:t.lowS,prehash:!1},C={lowS:t.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return l.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(y(e))throw new Error("first arg must be private key");if(!y(t))throw new Error("second arg must be public key");return l.fromHex(t).multiply(c(e)).toRawBytes(r)},sign:function(e,n,i=w){const{seed:o,k2sig:u}=function(e,n,i=w){if(["recovered","canonical"].some(e=>e in i))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:u}=t;let{lowS:d,prehash:f,extraEntropy:m}=i;null==d&&(d=!0),e=ensureBytes("msgHash",e),f&&(e=ensureBytes("prehashed msgHash",o(e)));const y=_(e),b=c(n),C=[E(b),E(y)];if(null!=m){const e=!0===m?u(r.BYTES):m;C.push(ensureBytes("extraEntropy",e))}const S=concatBytes$2(...C),T=y;return{seed:S,k2sig:function(e){const t=v(e);if(!h(t))return;const r=a(t),n=l.BASE.multiply(t).toAffine(),i=s(n.x);if(i===_0n$1)return;const o=s(r*s(T+i*b));if(o===_0n$1)return;let c=(n.x===i?0:2)|Number(n.y&_1n$1),u=o;return d&&p(o)&&(u=function(e){return p(e)?s(-e):e}(o),c^=1),new g(i,u,c)}}}(e,n,i),d=t;return createHmacDrbg(d.hash.outputLen,d.nByteLength,d.hmac)(o,u)},verify:function(e,r,n,i=C){const o=e;if(r=ensureBytes("msgHash",r),n=ensureBytes("publicKey",n),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:u}=i;let h,d;try{if("string"==typeof o||o instanceof Uint8Array)try{h=g.fromDER(o)}catch(w){if(!(w instanceof DER.Err))throw w;h=g.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:e,s:t}=o;h=new g(e,t)}}d=l.fromHex(n)}catch(error){if("PARSE"===error.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&h.hasHighS())return!1;u&&(r=t.hash(r));const{r:p,s:f}=h,m=_(r),y=a(f),v=s(m*y),b=s(p*y),E=l.BASE.multiplyAndAddUnsafe(d,v,b)?.toAffine();return!!E&&s(E.x)===p},ProjectivePoint:l,Signature:g,utils:m}}var HMAC$1=class extends Hash$1{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,hash$3(e);const r=toBytes$2(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return exists$2(this),this.iHash.update(e),this}digestInto(e){exists$2(this),bytes$2(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},hmac$1=(e,t,r)=>new HMAC$1(e,t).update(r).digest();function getHash(e){return{hash:e,hmac:(t,...r)=>hmac$1(e,t,concatBytes$3(...r)),randomBytes:randomBytes$1}}function createCurve(e,t){const r=t=>weierstrass({...e,...getHash(t)});return Object.freeze({...r(t),create:r})}hmac$1.create=(e,t)=>new HMAC$1(e,t);var secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n=BigInt(1),_2n=BigInt(2),divNearest=(e,t)=>(e+t/_2n)/t;function sqrtMod(e){const t=secp256k1P,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),l=BigInt(88),c=e*e*e%t,u=c*c*e%t,h=pow2(u,r,t)*u%t,d=pow2(h,r,t)*u%t,p=pow2(d,_2n,t)*c%t,f=pow2(p,i,t)*p%t,g=pow2(f,o,t)*f%t,m=pow2(g,a,t)*g%t,y=pow2(m,l,t)*m%t,v=pow2(y,a,t)*g%t,_=pow2(v,r,t)*u%t,b=pow2(_,s,t)*f%t,E=pow2(b,n,t)*c%t,w=pow2(E,_2n,t);if(!Fp.eql(Fp.sqr(w),e))throw new Error("Cannot find square root");return w}var Fp=Field(secp256k1P,void 0,void 0,{sqrt:sqrtMod}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=secp256k1N,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-_1n*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=divNearest(o*e,t),l=divNearest(-n*e,t);let c=mod(e-a*r-l*i,t),u=mod(-a*n-l*o,t);const h=c>s,d=u>s;if(h&&(c=t-c),d&&(u=t-u),c>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:h,k1:c,k2neg:d,k2:u}}}},sha256$2),_0n=BigInt(0),fe=e=>"bigint"==typeof e&&_0n<e&&e<secp256k1P,ge=e=>"bigint"==typeof e&&_0n<e&&e<secp256k1N,TAGGED_HASH_PREFIXES={};function taggedHash(e,...t){let r=TAGGED_HASH_PREFIXES[e];if(void 0===r){const t=sha256$2(Uint8Array.from(e,e=>e.charCodeAt(0)));r=concatBytes$2(t,t),TAGGED_HASH_PREFIXES[e]=r}return sha256$2(concatBytes$2(r,...t))}var pointToBytes=e=>e.toRawBytes(!0).slice(1),numTo32b$1=e=>numberToBytesBE(e,32),modP=e=>mod(e,secp256k1P),modN=e=>mod(e,secp256k1N),Point$2=secp256k1.ProjectivePoint,GmulAdd=(e,t,r)=>Point$2.BASE.multiplyAndAddUnsafe(e,t,r);function schnorrGetExtPubKey(e){let t=secp256k1.utils.normPrivateKeyToScalar(e),r=Point$2.fromPrivateKey(t);return{scalar:r.hasEvenY()?t:modN(-t),bytes:pointToBytes(r)}}function lift_x$1(e){if(!fe(e))throw new Error("bad x: need 0 < x < p");const t=modP(e*e);let r=sqrtMod(modP(t*e+BigInt(7)));r%_2n!==_0n&&(r=modP(-r));const n=new Point$2(e,r,_1n);return n.assertValidity(),n}function challenge(...e){return modN(bytesToNumberBE(taggedHash("BIP0340/challenge",...e)))}function schnorrGetPublicKey(e){return schnorrGetExtPubKey(e).bytes}function schnorrSign(e,t,r=randomBytes$1(32)){const n=ensureBytes("message",e),{bytes:i,scalar:o}=schnorrGetExtPubKey(t),s=ensureBytes("auxRand",r,32),a=taggedHash("BIP0340/nonce",numTo32b$1(o^bytesToNumberBE(taggedHash("BIP0340/aux",s))),i,n),l=modN(bytesToNumberBE(a));if(l===_0n)throw new Error("sign failed: k is zero");const{bytes:c,scalar:u}=schnorrGetExtPubKey(l),h=challenge(c,i,n),d=new Uint8Array(64);if(d.set(c,0),d.set(numTo32b$1(modN(u+h*o)),32),!schnorrVerify(d,n,i))throw new Error("sign: Invalid signature produced");return d}function schnorrVerify(e,t,r){const n=ensureBytes("signature",e,64),i=ensureBytes("message",t),o=ensureBytes("publicKey",r,32);try{const e=lift_x$1(bytesToNumberBE(o)),t=bytesToNumberBE(n.subarray(0,32));if(!fe(t))return!1;const r=bytesToNumberBE(n.subarray(32,64));if(!ge(r))return!1;const s=challenge(numTo32b$1(t),pointToBytes(e),i),a=GmulAdd(e,r,modN(-s));return!(!a||!a.hasEvenY()||a.toAffine().x!==t)}catch(error){return!1}}var schnorr=(()=>({getPublicKey:schnorrGetPublicKey,sign:schnorrSign,verify:schnorrVerify,utils:{randomPrivateKey:secp256k1.utils.randomPrivateKey,lift_x:lift_x$1,pointToBytes:pointToBytes,numberToBytesBE:numberToBytesBE,bytesToNumberBE:bytesToNumberBE,taggedHash:taggedHash,mod:mod}}))(),crypto$1="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,u8a=e=>e instanceof Uint8Array,createView$2=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr$1=(e,t)=>e<<32-t|e>>>t,isLE$1=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];if(!isLE$1)throw new Error("Non little-endian hardware is not supported");var hexes$1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex$2(e){if(!u8a(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=hexes$1[e[r]];return t}function hexToBytes$2(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let n=0;n<r.length;n++){const t=2*n,i=e.slice(t,t+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");r[n]=o}return r}function utf8ToBytes$1(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function toBytes$1(e){if("string"==typeof e&&(e=utf8ToBytes$1(e)),!u8a(e))throw new Error("expected Uint8Array, got "+typeof e);return e}function concatBytes$1(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let r=0;return e.forEach(e=>{if(!u8a(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length}),t}var Hash=class{clone(){return this._cloneInto()}};function wrapConstructor(e){const t=t=>e().update(toBytes$1(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function randomBytes(e=32){if(crypto$1&&"function"==typeof crypto$1.getRandomValues)return crypto$1.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function number$1(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bool$1(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function bytes$1(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function hash$2(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");number$1(e.outputLen),number$1(e.blockLen)}function exists$1(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output$1(e,t){bytes$1(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var assert$2={number:number$1,bool:bool$1,bytes:bytes$1,hash:hash$2,exists:exists$1,output:output$1};function setBigUint64$1(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),l=n?4:0,c=n?0:4;e.setUint32(t+l,s,n),e.setUint32(t+c,a,n)}var SHA2=class extends Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView$2(this.buffer)}update(e){assert$2.exists(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=toBytes$1(e)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const t=createView$2(e);for(;n<=i-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){assert$2.exists(this),assert$2.output(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let u=o;u<n;u++)t[u]=0;setBigUint64$1(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=createView$2(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)s.setUint32(4*u,c[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.length=n,e.pos=s,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}},Chi$1=(e,t,r)=>e&t^~e&r,Maj$1=(e,t,r)=>e&t^e&r^t&r,SHA256_K$1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$1=new Uint32Array(64),SHA256=class extends SHA2{constructor(){super(64,32,8,!1),this.A=0|IV[0],this.B=0|IV[1],this.C=0|IV[2],this.D=0|IV[3],this.E=0|IV[4],this.F=0|IV[5],this.G=0|IV[6],this.H=0|IV[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)SHA256_W$1[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=SHA256_W$1[u-15],t=SHA256_W$1[u-2],r=rotr$1(e,7)^rotr$1(e,18)^e>>>3,n=rotr$1(t,17)^rotr$1(t,19)^t>>>10;SHA256_W$1[u]=n+SHA256_W$1[u-7]+r+SHA256_W$1[u-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:l,H:c}=this;for(let u=0;u<64;u++){const e=c+(rotr$1(s,6)^rotr$1(s,11)^rotr$1(s,25))+Chi$1(s,a,l)+SHA256_K$1[u]+SHA256_W$1[u]|0,t=(rotr$1(r,2)^rotr$1(r,13)^rotr$1(r,22))+Maj$1(r,n,i)|0;c=l,l=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+t|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,l,c)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},SHA224=class extends SHA256{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}},sha256$1=wrapConstructor(()=>new SHA256),sha224=wrapConstructor(()=>new SHA224);function assertNumber(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function chain$1(...e){const t=(e,t)=>r=>e(t(r));return{encode:Array.from(e).reverse().reduce((e,r)=>e?t(e,r.encode):r.encode,void 0),decode:e.reduce((e,r)=>e?t(e,r.decode):r.decode,void 0)}}function alphabet$1(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map(t=>{if(assertNumber(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]})},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map(t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const r=e.indexOf(t);if(-1===r)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return r})}}}function join$1(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function padding$1(e,t="="){if(assertNumber(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;r.length*e%8;)r.push(t);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function normalize$1(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function convertRadix(e,t,r){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let n=0;const i=[],o=Array.from(e);for(o.forEach(e=>{if(assertNumber(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)});;){let e=0,s=!0;for(let i=n;i<o.length;i++){const a=o[i],l=t*e+a;if(!Number.isSafeInteger(l)||t*e/t!==e||l-a!==t*e)throw new Error("convertRadix: carry overflow");if(e=l%r,o[i]=Math.floor(l/r),!Number.isSafeInteger(o[i])||o[i]*r+e!==l)throw new Error("convertRadix: carry overflow");s&&(o[i]?s=!1:n=i)}if(i.push(e),s)break}for(let s=0;s<e.length-1&&0===e[s];s++)i.push(0);return i.reverse()}var gcd$1=(e,t)=>t?gcd$1(t,e%t):e,radix2carry$1=(e,t)=>e+(t-gcd$1(e,t));function convertRadix2$1(e,t,r,n){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(radix2carry$1(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${radix2carry$1(t,r)}`);let i=0,o=0;const s=2**r-1,a=[];for(const l of e){if(assertNumber(l),l>=2**t)throw new Error(`convertRadix2: invalid data word=${l} from=${t}`);if(i=i<<t|l,o+t>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=r;o-=r)a.push((i>>o-r&s)>>>0);i&=2**o-1}if(i=i<<r-o&s,!n&&o>=t)throw new Error("Excess padding");if(!n&&i)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&a.push(i>>>0),a}function radix(e){return assertNumber(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return convertRadix(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(convertRadix(t,e,256))}}}function radix2$1(e,t=!1){if(assertNumber(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(radix2carry$1(8,e)>32||radix2carry$1(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!(r instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return convertRadix2$1(Array.from(r),8,e,!t)},decode:r=>{if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(convertRadix2$1(r,e,8,t))}}}function unsafeWrapper$1(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(r){}}}var base16$1=chain$1(radix2$1(4),alphabet$1("0123456789ABCDEF"),join$1("")),base32$2=chain$1(radix2$1(5),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),padding$1(5),join$1("")),base32hex$1=chain$1(radix2$1(5),alphabet$1("0123456789ABCDEFGHIJKLMNOPQRSTUV"),padding$1(5),join$1("")),base32crockford$1=chain$1(radix2$1(5),alphabet$1("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),join$1(""),normalize$1(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),base64$1=chain$1(radix2$1(6),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),padding$1(6),join$1("")),base64url$1=chain$1(radix2$1(6),alphabet$1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),padding$1(6),join$1("")),genBase58=e=>chain$1(radix(58),alphabet$1(e),join$1("")),base58=genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),base58flickr=genBase58("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),base58xrp=genBase58("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),XMR_BLOCK_LEN=[0,2,3,5,6,7,9,10,11],base58xmr={encode(e){let t="";for(let r=0;r<e.length;r+=8){const n=e.subarray(r,r+8);t+=base58.encode(n).padStart(XMR_BLOCK_LEN[n.length],"1")}return t},decode(e){let t=[];for(let r=0;r<e.length;r+=11){const n=e.slice(r,r+11),i=XMR_BLOCK_LEN.indexOf(n.length),o=base58.decode(n);for(let e=0;e<o.length-i;e++)if(0!==o[e])throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(o.slice(o.length-i)))}return Uint8Array.from(t)}},BECH_ALPHABET$1=chain$1(alphabet$1("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),join$1("")),POLYMOD_GENERATORS$1=[996825010,642813549,513874426,1027748829,705979059];function bech32Polymod$1(e){const t=e>>25;let r=(33554431&e)<<5;for(let n=0;n<POLYMOD_GENERATORS$1.length;n++)1==(t>>n&1)&&(r^=POLYMOD_GENERATORS$1[n]);return r}function bechChecksum$1(e,t,r=1){const n=e.length;let i=1;for(let o=0;o<n;o++){const t=e.charCodeAt(o);if(t<33||t>126)throw new Error(`Invalid prefix (${e})`);i=bech32Polymod$1(i)^t>>5}i=bech32Polymod$1(i);for(let o=0;o<n;o++)i=bech32Polymod$1(i)^31&e.charCodeAt(o);for(let o of t)i=bech32Polymod$1(i)^o;for(let o=0;o<6;o++)i=bech32Polymod$1(i);return i^=r,BECH_ALPHABET$1.encode(convertRadix2$1([i%2**30],30,5,!1))}function genBech32$1(e){const t="bech32"===e?1:734539939,r=radix2$1(5),n=r.decode,i=r.encode,o=unsafeWrapper$1(n);function s(e,r=90){if("string"!=typeof e)throw new Error("bech32.decode input should be string, not "+typeof e);if(e.length<8||!1!==r&&e.length>r)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${r})`);const n=e.toLowerCase();if(e!==n&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=(e=n).lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=e.slice(0,i),s=e.slice(i+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=BECH_ALPHABET$1.decode(s).slice(0,-6),l=bechChecksum$1(o,a,t);if(!s.endsWith(l))throw new Error(`Invalid checksum in ${e}: expected "${l}"`);return{prefix:o,words:a}}return{encode:function(e,r,n=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof r);const i=e.length+7+r.length;if(!1!==n&&i>n)throw new TypeError(`Length ${i} exceeds limit ${n}`);return`${e=e.toLowerCase()}1${BECH_ALPHABET$1.encode(r)}${bechChecksum$1(e,r,t)}`},decode:s,decodeToBytes:function(e){const{prefix:t,words:r}=s(e,!1);return{prefix:t,words:r,bytes:n(r)}},decodeUnsafe:unsafeWrapper$1(s),fromWords:n,fromWordsUnsafe:o,toWords:i}}var bech32$1=genBech32$1("bech32"),bech32m$1=genBech32$1("bech32m"),utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},hex$1=chain$1(radix2$1(4),alphabet$1("0123456789abcdef"),join$1(""),normalize$1(e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),CODERS={utf8:utf8,hex:hex$1,base16:base16$1,base32:base32$2,base64:base64$1,base64url:base64url$1,base58:base58,base58xmr:base58xmr},coderTypeError=`Invalid encoding type. Available types: ${Object.keys(CODERS).join(", ")}`;function number(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function bool(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function isBytes$3(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function bytes(e,...t){if(!isBytes$3(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function exists(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output(e,t){bytes(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),createView$1=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];if(!isLE)throw new Error("Non little-endian hardware is not supported");var hexes=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bytesToHex$1(e){bytes(e);let t="";for(let r=0;r<e.length;r++)t+=hexes[e[r]];return t}var asciis={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function asciiToBase16(e){return e>=asciis._0&&e<=asciis._9?e-asciis._0:e>=asciis._A&&e<=asciis._F?e-(asciis._A-10):e>=asciis._a&&e<=asciis._f?e-(asciis._a-10):void 0}function hexToBytes$1(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){const t=asciiToBase16(e.charCodeAt(o)),r=asciiToBase16(e.charCodeAt(o+1));if(void 0===t||void 0===r){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}n[i]=16*t+r}return n}function utf8ToBytes(e){if("string"!=typeof e)throw new Error("string expected, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function toBytes(e){if("string"==typeof e)e=utf8ToBytes(e);else{if(!isBytes$3(e))throw new Error("Uint8Array expected, got "+typeof e);e=e.slice()}return e}function checkOpts$1(e,t){if(null==t||"object"!=typeof t)throw new Error("options must be defined");return Object.assign(e,t)}function equalBytes(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}var wrapCipher=(e,t)=>(Object.assign(t,e),t);function setBigUint64(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),l=n?4:0,c=n?0:4;e.setUint32(t+l,s,n),e.setUint32(t+c,a,n)}var BLOCK_SIZE$1=16,ZEROS16$1=new Uint8Array(16),ZEROS32$1=u32(ZEROS16$1),POLY$1=225,mul2$1=(e,t,r,n)=>({s3:r<<31|n>>>1,s2:t<<31|r>>>1,s1:e<<31|t>>>1,s0:e>>>1^POLY$1<<24&-(1&n)}),swapLE=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255;function _toGHASHKey(e){e.reverse();const t=1&e[15];let r=0;for(let n=0;n<e.length;n++){const t=e[n];e[n]=t>>>1|r,r=(1&t)<<7}return e[0]^=225&-t,e}var estimateWindow=e=>e>65536?8:e>1024?4:2,GHASH=class{constructor(e,t){this.blockLen=BLOCK_SIZE$1,this.outputLen=BLOCK_SIZE$1,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,bytes(e=toBytes(e),16);const r=createView$1(e);let n=r.getUint32(0,!1),i=r.getUint32(4,!1),o=r.getUint32(8,!1),s=r.getUint32(12,!1);const a=[];for(let d=0;d<128;d++)a.push({s0:swapLE(n),s1:swapLE(i),s2:swapLE(o),s3:swapLE(s)}),({s0:n,s1:i,s2:o,s3:s}=mul2$1(n,i,o,s));const l=estimateWindow(t||1024);if(![1,2,4,8].includes(l))throw new Error(`ghash: wrong window size=${l}, should be 2, 4 or 8`);this.W=l;const c=128/l,u=this.windowSize=2**l,h=[];for(let d=0;d<c;d++)for(let e=0;e<u;e++){let t=0,r=0,n=0,i=0;for(let o=0;o<l;o++){if(!(e>>>l-o-1&1))continue;const{s0:s,s1:c,s2:u,s3:h}=a[l*d+o];t^=s,r^=c,n^=u,i^=h}h.push({s0:t,s1:r,s2:n,s3:i})}this.t=h}_updateBlock(e,t,r,n){e^=this.s0,t^=this.s1,r^=this.s2,n^=this.s3;const{W:i,t:o,windowSize:s}=this;let a=0,l=0,c=0,u=0;const h=(1<<i)-1;let d=0;for(const p of[e,t,r,n])for(let e=0;e<4;e++){const t=p>>>8*e&255;for(let e=8/i-1;e>=0;e--){const r=t>>>i*e&h,{s0:n,s1:p,s2:f,s3:g}=o[d*s+r];a^=n,l^=p,c^=f,u^=g,d+=1}}this.s0=a,this.s1=l,this.s2=c,this.s3=u}update(e){e=toBytes(e),exists(this);const t=u32(e),r=Math.floor(e.length/BLOCK_SIZE$1),n=e.length%BLOCK_SIZE$1;for(let i=0;i<r;i++)this._updateBlock(t[4*i+0],t[4*i+1],t[4*i+2],t[4*i+3]);return n&&(ZEROS16$1.set(e.subarray(r*BLOCK_SIZE$1)),this._updateBlock(ZEROS32$1[0],ZEROS32$1[1],ZEROS32$1[2],ZEROS32$1[3]),ZEROS32$1.fill(0)),this}destroy(){const{t:e}=this;for(const t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){exists(this),output(e,this),this.finished=!0;const{s0:t,s1:r,s2:n,s3:i}=this,o=u32(e);return o[0]=t,o[1]=r,o[2]=n,o[3]=i,e}digest(){const e=new Uint8Array(BLOCK_SIZE$1);return this.digestInto(e),this.destroy(),e}},Polyval=class extends GHASH{constructor(e,t){const r=_toGHASHKey((e=toBytes(e)).slice());super(r,t),r.fill(0)}update(e){e=toBytes(e),exists(this);const t=u32(e),r=e.length%BLOCK_SIZE$1,n=Math.floor(e.length/BLOCK_SIZE$1);for(let i=0;i<n;i++)this._updateBlock(swapLE(t[4*i+3]),swapLE(t[4*i+2]),swapLE(t[4*i+1]),swapLE(t[4*i+0]));return r&&(ZEROS16$1.set(e.subarray(n*BLOCK_SIZE$1)),this._updateBlock(swapLE(ZEROS32$1[3]),swapLE(ZEROS32$1[2]),swapLE(ZEROS32$1[1]),swapLE(ZEROS32$1[0])),ZEROS32$1.fill(0)),this}digestInto(e){exists(this),output(e,this),this.finished=!0;const{s0:t,s1:r,s2:n,s3:i}=this,o=u32(e);return o[0]=t,o[1]=r,o[2]=n,o[3]=i,e.reverse()}};function wrapConstructorWithKey$1(e){const t=(t,r)=>e(r,t.length).update(toBytes(t)).digest(),r=e(new Uint8Array(16),0);return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=(t,r)=>e(t,r),t}var ghash=wrapConstructorWithKey$1((e,t)=>new GHASH(e,t)),polyval=wrapConstructorWithKey$1((e,t)=>new Polyval(e,t)),BLOCK_SIZE=16,BLOCK_SIZE32=4,EMPTY_BLOCK=new Uint8Array(BLOCK_SIZE),POLY=283;function mul2(e){return e<<1^POLY&-(e>>7)}function mul(e,t){let r=0;for(;t>0;t>>=1)r^=e&-(1&t),e=mul2(e);return r}var sbox=(()=>{let e=new Uint8Array(256);for(let r=0,n=1;r<256;r++,n^=mul2(n))e[r]=n;const t=new Uint8Array(256);t[0]=99;for(let r=0;r<255;r++){let n=e[255-r];n|=n<<8,t[e[r]]=255&(n^n>>4^n>>5^n>>6^n>>7^99)}return t})(),invSbox=sbox.map((e,t)=>sbox.indexOf(t)),rotr32_8=e=>e<<24|e>>>8,rotl32_8=e=>e<<8|e>>>24;function genTtable(e,t){if(256!==e.length)throw new Error("Wrong sbox length");const r=new Uint32Array(256).map((r,n)=>t(e[n])),n=r.map(rotl32_8),i=n.map(rotl32_8),o=i.map(rotl32_8),s=new Uint32Array(65536),a=new Uint32Array(65536),l=new Uint16Array(65536);for(let c=0;c<256;c++)for(let t=0;t<256;t++){const u=256*c+t;s[u]=r[c]^n[t],a[u]=i[c]^o[t],l[u]=e[c]<<8|e[t]}return{sbox:e,sbox2:l,T0:r,T1:n,T2:i,T3:o,T01:s,T23:a}}var tableEncoding=genTtable(sbox,e=>mul(e,3)<<24|e<<16|e<<8|mul(e,2)),tableDecoding=genTtable(invSbox,e=>mul(e,11)<<24|mul(e,13)<<16|mul(e,9)<<8|mul(e,14)),xPowers=(()=>{const e=new Uint8Array(16);for(let t=0,r=1;t<16;t++,r=mul2(r))e[t]=r;return e})();function expandKeyLE(e){bytes(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:r}=tableEncoding,n=u32(e),i=n.length,o=e=>applySbox(r,e,e,e,e),s=new Uint32Array(t+28);s.set(n);for(let a=i;a<s.length;a++){let e=s[a-1];a%i===0?e=o(rotr32_8(e))^xPowers[a/i-1]:i>6&&a%i===4&&(e=o(e)),s[a]=s[a-i]^e}return s}function expandKeyDecLE(e){const t=expandKeyLE(e),r=t.slice(),n=t.length,{sbox2:i}=tableEncoding,{T0:o,T1:s,T2:a,T3:l}=tableDecoding;for(let c=0;c<n;c+=4)for(let e=0;e<4;e++)r[c+e]=t[n-c-4+e];t.fill(0);for(let c=4;c<n-4;c++){const e=r[c],t=applySbox(i,e,e,e,e);r[c]=o[255&t]^s[t>>>8&255]^a[t>>>16&255]^l[t>>>24]}return r}function apply0123(e,t,r,n,i,o){return e[r<<8&65280|n>>>8&255]^t[i>>>8&65280|o>>>24&255]}function applySbox(e,t,r,n,i){return e[255&t|65280&r]|e[n>>>16&255|i>>>16&65280]<<16}function encrypt$1(e,t,r,n,i){const{sbox2:o,T01:s,T23:a}=tableEncoding;let l=0;t^=e[l++],r^=e[l++],n^=e[l++],i^=e[l++];const c=e.length/4-2;for(let u=0;u<c;u++){const o=e[l++]^apply0123(s,a,t,r,n,i),c=e[l++]^apply0123(s,a,r,n,i,t),u=e[l++]^apply0123(s,a,n,i,t,r),h=e[l++]^apply0123(s,a,i,t,r,n);t=o,r=c,n=u,i=h}return{s0:e[l++]^applySbox(o,t,r,n,i),s1:e[l++]^applySbox(o,r,n,i,t),s2:e[l++]^applySbox(o,n,i,t,r),s3:e[l++]^applySbox(o,i,t,r,n)}}function decrypt$1(e,t,r,n,i){const{sbox2:o,T01:s,T23:a}=tableDecoding;let l=0;t^=e[l++],r^=e[l++],n^=e[l++],i^=e[l++];const c=e.length/4-2;for(let u=0;u<c;u++){const o=e[l++]^apply0123(s,a,t,i,n,r),c=e[l++]^apply0123(s,a,r,t,i,n),u=e[l++]^apply0123(s,a,n,r,t,i),h=e[l++]^apply0123(s,a,i,n,r,t);t=o,r=c,n=u,i=h}return{s0:e[l++]^applySbox(o,t,i,n,r),s1:e[l++]^applySbox(o,r,t,i,n),s2:e[l++]^applySbox(o,n,r,t,i),s3:e[l++]^applySbox(o,i,n,r,t)}}function getDst(e,t){if(!t)return new Uint8Array(e);if(bytes(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);return t}function ctrCounter(e,t,r,n){bytes(t,BLOCK_SIZE),bytes(r);const i=r.length;n=getDst(i,n);const o=t,s=u32(o);let{s0:a,s1:l,s2:c,s3:u}=encrypt$1(e,s[0],s[1],s[2],s[3]);const h=u32(r),d=u32(n);for(let f=0;f+4<=h.length;f+=4){d[f+0]=h[f+0]^a,d[f+1]=h[f+1]^l,d[f+2]=h[f+2]^c,d[f+3]=h[f+3]^u;let t=1;for(let e=o.length-1;e>=0;e--)t=t+(255&o[e])|0,o[e]=255&t,t>>>=8;({s0:a,s1:l,s2:c,s3:u}=encrypt$1(e,s[0],s[1],s[2],s[3]))}const p=BLOCK_SIZE*Math.floor(h.length/BLOCK_SIZE32);if(p<i){const e=new Uint32Array([a,l,c,u]),t=u8(e);for(let o=p,s=0;o<i;o++,s++)n[o]=r[o]^t[s]}return n}function ctr32(e,t,r,n,i){bytes(r,BLOCK_SIZE),bytes(n),i=getDst(n.length,i);const o=r,s=u32(o),a=createView$1(o),l=u32(n),c=u32(i),u=t?0:12,h=n.length;let d=a.getUint32(u,t),{s0:p,s1:f,s2:g,s3:m}=encrypt$1(e,s[0],s[1],s[2],s[3]);for(let v=0;v+4<=l.length;v+=4)c[v+0]=l[v+0]^p,c[v+1]=l[v+1]^f,c[v+2]=l[v+2]^g,c[v+3]=l[v+3]^m,d=d+1>>>0,a.setUint32(u,d,t),({s0:p,s1:f,s2:g,s3:m}=encrypt$1(e,s[0],s[1],s[2],s[3]));const y=BLOCK_SIZE*Math.floor(l.length/BLOCK_SIZE32);if(y<h){const e=new Uint32Array([p,f,g,m]),t=u8(e);for(let r=y,o=0;r<h;r++,o++)i[r]=n[r]^t[o]}return i}var ctr=wrapCipher({blockSize:16,nonceLength:16},function(e,t){function r(r,n){const i=expandKeyLE(e),o=t.slice(),s=ctrCounter(i,o,r,n);return i.fill(0),o.fill(0),s}return bytes(e),bytes(t,BLOCK_SIZE),{encrypt:(e,t)=>r(e,t),decrypt:(e,t)=>r(e,t)}});function validateBlockDecrypt(e){if(bytes(e),e.length%BLOCK_SIZE!==0)throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${BLOCK_SIZE}`)}function validateBlockEncrypt(e,t,r){let n=e.length;const i=n%BLOCK_SIZE;if(!t&&0!==i)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");const o=u32(e);if(t){let e=BLOCK_SIZE-i;e||(e=BLOCK_SIZE),n+=e}const s=getDst(n,r);return{b:o,o:u32(s),out:s}}function validatePCKS(e,t){if(!t)return e;const r=e.length;if(!r)throw new Error("aes/pcks5: empty ciphertext not allowed");const n=e[r-1];if(n<=0||n>16)throw new Error(`aes/pcks5: wrong padding byte: ${n}`);const i=e.subarray(0,-n);for(let o=0;o<n;o++)if(e[r-o-1]!==n)throw new Error("aes/pcks5: wrong padding");return i}function padPCKS(e){const t=new Uint8Array(16),r=u32(t);t.set(e);const n=BLOCK_SIZE-e.length;for(let i=BLOCK_SIZE-n;i<BLOCK_SIZE;i++)t[i]=n;return r}var ecb=wrapCipher({blockSize:16},function(e,t={}){bytes(e);const r=!t.disablePadding;return{encrypt:(t,n)=>{bytes(t);const{b:i,o:o,out:s}=validateBlockEncrypt(t,r,n),a=expandKeyLE(e);let l=0;for(;l+4<=i.length;){const{s0:e,s1:t,s2:r,s3:n}=encrypt$1(a,i[l+0],i[l+1],i[l+2],i[l+3]);o[l++]=e,o[l++]=t,o[l++]=r,o[l++]=n}if(r){const e=padPCKS(t.subarray(4*l)),{s0:r,s1:n,s2:i,s3:s}=encrypt$1(a,e[0],e[1],e[2],e[3]);o[l++]=r,o[l++]=n,o[l++]=i,o[l++]=s}return a.fill(0),s},decrypt:(t,n)=>{validateBlockDecrypt(t);const i=expandKeyDecLE(e),o=getDst(t.length,n),s=u32(t),a=u32(o);for(let e=0;e+4<=s.length;){const{s0:t,s1:r,s2:n,s3:o}=decrypt$1(i,s[e+0],s[e+1],s[e+2],s[e+3]);a[e++]=t,a[e++]=r,a[e++]=n,a[e++]=o}return i.fill(0),validatePCKS(o,r)}}}),cbc=wrapCipher({blockSize:16,nonceLength:16},function(e,t,r={}){bytes(e),bytes(t,16);const n=!r.disablePadding;return{encrypt:(r,i)=>{const o=expandKeyLE(e),{b:s,o:a,out:l}=validateBlockEncrypt(r,n,i),c=u32(t);let u=c[0],h=c[1],d=c[2],p=c[3],f=0;for(;f+4<=s.length;)u^=s[f+0],h^=s[f+1],d^=s[f+2],p^=s[f+3],({s0:u,s1:h,s2:d,s3:p}=encrypt$1(o,u,h,d,p)),a[f++]=u,a[f++]=h,a[f++]=d,a[f++]=p;if(n){const e=padPCKS(r.subarray(4*f));u^=e[0],h^=e[1],d^=e[2],p^=e[3],({s0:u,s1:h,s2:d,s3:p}=encrypt$1(o,u,h,d,p)),a[f++]=u,a[f++]=h,a[f++]=d,a[f++]=p}return o.fill(0),l},decrypt:(r,i)=>{validateBlockDecrypt(r);const o=expandKeyDecLE(e),s=u32(t),a=getDst(r.length,i),l=u32(r),c=u32(a);let u=s[0],h=s[1],d=s[2],p=s[3];for(let e=0;e+4<=l.length;){const t=u,r=h,n=d,i=p;u=l[e+0],h=l[e+1],d=l[e+2],p=l[e+3];const{s0:s,s1:a,s2:f,s3:g}=decrypt$1(o,u,h,d,p);c[e++]=s^t,c[e++]=a^r,c[e++]=f^n,c[e++]=g^i}return o.fill(0),validatePCKS(a,n)}}}),cfb=wrapCipher({blockSize:16,nonceLength:16},function(e,t){function r(r,n,i){const o=expandKeyLE(e),s=r.length;i=getDst(s,i);const a=u32(r),l=u32(i),c=n?l:a,u=u32(t);let h=u[0],d=u[1],p=u[2],f=u[3];for(let e=0;e+4<=a.length;){const{s0:t,s1:r,s2:n,s3:i}=encrypt$1(o,h,d,p,f);l[e+0]=a[e+0]^t,l[e+1]=a[e+1]^r,l[e+2]=a[e+2]^n,l[e+3]=a[e+3]^i,h=c[e++],d=c[e++],p=c[e++],f=c[e++]}const g=BLOCK_SIZE*Math.floor(a.length/BLOCK_SIZE32);if(g<s){({s0:h,s1:d,s2:p,s3:f}=encrypt$1(o,h,d,p,f));const e=u8(new Uint32Array([h,d,p,f]));for(let t=g,n=0;t<s;t++,n++)i[t]=r[t]^e[n];e.fill(0)}return o.fill(0),i}return bytes(e),bytes(t,16),{encrypt:(e,t)=>r(e,!0,t),decrypt:(e,t)=>r(e,!1,t)}});function computeTag$1(e,t,r,n,i){const o=e.create(r,n.length+(i?.length||0));i&&o.update(i),o.update(n);const s=new Uint8Array(16),a=createView$1(s);return i&&setBigUint64(a,0,BigInt(8*i.length),t),setBigUint64(a,8,BigInt(8*n.length),t),o.update(s),o.digest()}var gcm=wrapCipher({blockSize:16,nonceLength:12,tagLength:16},function(e,t,r){if(bytes(t),0===t.length)throw new Error("aes/gcm: empty nonce");function n(e,t,n){const i=computeTag$1(ghash,!1,e,n,r);for(let r=0;r<t.length;r++)i[r]^=t[r];return i}function i(){const r=expandKeyLE(e),n=EMPTY_BLOCK.slice(),i=EMPTY_BLOCK.slice();if(ctr32(r,!1,i,i,n),12===t.length)i.set(t);else{const e=EMPTY_BLOCK.slice();setBigUint64(createView$1(e),8,BigInt(8*t.length),!1),ghash.create(n).update(t).update(e).digestInto(i)}return{xk:r,authKey:n,counter:i,tagMask:ctr32(r,!1,i,EMPTY_BLOCK)}}return{encrypt:e=>{bytes(e);const{xk:t,authKey:r,counter:o,tagMask:s}=i(),a=new Uint8Array(e.length+16);ctr32(t,!1,o,e,a);const l=n(r,s,a.subarray(0,a.length-16));return a.set(l,e.length),t.fill(0),a},decrypt:e=>{if(bytes(e),e.length<16)throw new Error("aes/gcm: ciphertext less than tagLen (16)");const{xk:t,authKey:r,counter:o,tagMask:s}=i(),a=e.subarray(0,-16),l=e.subarray(-16);if(!equalBytes(n(r,s,a),l))throw new Error("aes/gcm: invalid ghash tag");const c=ctr32(t,!1,o,a);return r.fill(0),s.fill(0),t.fill(0),c}}}),limit=(e,t,r)=>n=>{if(!Number.isSafeInteger(n)||t>n||n>r)throw new Error(`${e}: invalid value=${n}, must be [${t}..${r}]`)},siv=wrapCipher({blockSize:16,nonceLength:12,tagLength:16},function(e,t,r){const n=limit("AAD",0,2**36),i=limit("plaintext",0,2**36),o=limit("nonce",12,12),s=limit("ciphertext",16,2**36+16);function a(){const r=e.length;if(16!==r&&24!==r&&32!==r)throw new Error(`key length must be 16, 24 or 32 bytes, got: ${r} bytes`);const n=expandKeyLE(e),i=new Uint8Array(r),o=new Uint8Array(16),s=u32(t);let a=0,l=s[0],c=s[1],u=s[2],h=0;for(const e of[o,i].map(u32)){const t=u32(e);for(let e=0;e<t.length;e+=2){const{s0:r,s1:i}=encrypt$1(n,a,l,c,u);t[e+0]=r,t[e+1]=i,a=++h}}return n.fill(0),{authKey:o,encKey:expandKeyLE(i)}}function l(e,n,i){const o=computeTag$1(polyval,!0,n,i,r);for(let r=0;r<12;r++)o[r]^=t[r];o[15]&=127;const s=u32(o);let a=s[0],l=s[1],c=s[2],u=s[3];return({s0:a,s1:l,s2:c,s3:u}=encrypt$1(e,a,l,c,u)),s[0]=a,s[1]=l,s[2]=c,s[3]=u,o}function c(e,t,r){let n=t.slice();return n[15]|=128,ctr32(e,!0,n,r)}return bytes(t),o(t.length),r&&(bytes(r),n(r.length)),{encrypt:e=>{bytes(e),i(e.length);const{encKey:t,authKey:r}=a(),n=l(t,r,e),o=new Uint8Array(e.length+16);return o.set(n,e.length),o.set(c(t,n,e)),t.fill(0),r.fill(0),o},decrypt:e=>{bytes(e),s(e.length);const t=e.subarray(-16),{encKey:r,authKey:n}=a(),i=c(r,t,e.subarray(0,-16)),o=l(r,n,i);if(r.fill(0),n.fill(0),!equalBytes(t,o))throw new Error("invalid polyval tag");return i}}}),u8to16=(e,t)=>255&e[t++]|(255&e[t++])<<8,Poly1305=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,bytes(e=toBytes(e),32);const t=u8to16(e,0),r=u8to16(e,2),n=u8to16(e,4),i=u8to16(e,6),o=u8to16(e,8),s=u8to16(e,10),a=u8to16(e,12),l=u8to16(e,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|r<<3),this.r[2]=7939&(r>>>10|n<<6),this.r[3]=8191&(n>>>7|i<<9),this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,this.r[6]=8191&(o>>>14|s<<2),this.r[7]=8065&(s>>>11|a<<5),this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>5&127;for(let c=0;c<8;c++)this.pad[c]=u8to16(e,16+2*c)}process(e,t,r=!1){const n=r?0:2048,{h:i,r:o}=this,s=o[0],a=o[1],l=o[2],c=o[3],u=o[4],h=o[5],d=o[6],p=o[7],f=o[8],g=o[9],m=u8to16(e,t+0),y=u8to16(e,t+2),v=u8to16(e,t+4),_=u8to16(e,t+6),b=u8to16(e,t+8),E=u8to16(e,t+10),w=u8to16(e,t+12),C=u8to16(e,t+14);let S=i[0]+(8191&m),T=i[1]+(8191&(m>>>13|y<<3)),x=i[2]+(8191&(y>>>10|v<<6)),R=i[3]+(8191&(v>>>7|_<<9)),A=i[4]+(8191&(_>>>4|b<<12)),I=i[5]+(b>>>1&8191),k=i[6]+(8191&(b>>>14|E<<2)),P=i[7]+(8191&(E>>>11|w<<5)),L=i[8]+(8191&(w>>>8|C<<8)),O=i[9]+(C>>>5|n),M=0,D=M+S*s+T*(5*g)+x*(5*f)+R*(5*p)+A*(5*d);M=D>>>13,D&=8191,D+=I*(5*h)+k*(5*u)+P*(5*c)+L*(5*l)+O*(5*a),M+=D>>>13,D&=8191;let N=M+S*a+T*s+x*(5*g)+R*(5*f)+A*(5*p);M=N>>>13,N&=8191,N+=I*(5*d)+k*(5*h)+P*(5*u)+L*(5*c)+O*(5*l),M+=N>>>13,N&=8191;let $=M+S*l+T*a+x*s+R*(5*g)+A*(5*f);M=$>>>13,$&=8191,$+=I*(5*p)+k*(5*d)+P*(5*h)+L*(5*u)+O*(5*c),M+=$>>>13,$&=8191;let F=M+S*c+T*l+x*a+R*s+A*(5*g);M=F>>>13,F&=8191,F+=I*(5*f)+k*(5*p)+P*(5*d)+L*(5*h)+O*(5*u),M+=F>>>13,F&=8191;let B=M+S*u+T*c+x*l+R*a+A*s;M=B>>>13,B&=8191,B+=I*(5*g)+k*(5*f)+P*(5*p)+L*(5*d)+O*(5*h),M+=B>>>13,B&=8191;let U=M+S*h+T*u+x*c+R*l+A*a;M=U>>>13,U&=8191,U+=I*s+k*(5*g)+P*(5*f)+L*(5*p)+O*(5*d),M+=U>>>13,U&=8191;let z=M+S*d+T*h+x*u+R*c+A*l;M=z>>>13,z&=8191,z+=I*a+k*s+P*(5*g)+L*(5*f)+O*(5*p),M+=z>>>13,z&=8191;let V=M+S*p+T*d+x*h+R*u+A*c;M=V>>>13,V&=8191,V+=I*l+k*a+P*s+L*(5*g)+O*(5*f),M+=V>>>13,V&=8191;let j=M+S*f+T*p+x*d+R*h+A*u;M=j>>>13,j&=8191,j+=I*c+k*l+P*a+L*s+O*(5*g),M+=j>>>13,j&=8191;let G=M+S*g+T*f+x*p+R*d+A*h;M=G>>>13,G&=8191,G+=I*u+k*c+P*l+L*a+O*s,M+=G>>>13,G&=8191,M=(M<<2)+M|0,M=M+D|0,D=8191&M,M>>>=13,N+=M,i[0]=D,i[1]=N,i[2]=$,i[3]=F,i[4]=B,i[5]=U,i[6]=z,i[7]=V,i[8]=j,i[9]=G}finalize(){const{h:e,pad:t}=this,r=new Uint16Array(10);let n=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=n,n=e[s]>>>13,e[s]&=8191;e[0]+=5*n,n=e[0]>>>13,e[0]&=8191,e[1]+=n,n=e[1]>>>13,e[1]&=8191,e[2]+=n,r[0]=e[0]+5,n=r[0]>>>13,r[0]&=8191;for(let s=1;s<10;s++)r[s]=e[s]+n,n=r[s]>>>13,r[s]&=8191;r[9]-=8192;let i=(1^n)-1;for(let s=0;s<10;s++)r[s]&=i;i=~i;for(let s=0;s<10;s++)e[s]=e[s]&i|r[s];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let o=e[0]+t[0];e[0]=65535&o;for(let s=1;s<8;s++)o=(e[s]+t[s]|0)+(o>>>16)|0,e[s]=65535&o}update(e){exists(this);const{buffer:t,blockLen:r}=this,n=(e=toBytes(e)).length;for(let i=0;i<n;){const o=Math.min(r-this.pos,n-i);if(o!==r)t.set(e.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===r&&(this.process(t,0,!1),this.pos=0);else for(;r<=n-i;i+=r)this.process(e,i)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(e){exists(this),output(e,this),this.finished=!0;const{buffer:t,h:r}=this;let{pos:n}=this;if(n){for(t[n++]=1;n<16;n++)t[n]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)e[i++]=r[o]>>>0,e[i++]=r[o]>>>8;return e}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}};function wrapConstructorWithKey(e){const t=(t,r)=>e(r).update(toBytes(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}var poly1305=wrapConstructorWithKey(e=>new Poly1305(e)),_utf8ToBytes=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),sigma16=_utf8ToBytes("expand 16-byte k"),sigma32=_utf8ToBytes("expand 32-byte k"),sigma16_32=u32(sigma16),sigma32_32=u32(sigma32),sigma=sigma32_32.slice();function rotl(e,t){return e<<t|e>>>32-t}function isAligned32(e){return e.byteOffset%4==0}var BLOCK_LEN=64,BLOCK_LEN32=16,MAX_COUNTER=2**32-1,U32_EMPTY=new Uint32Array;function runCipher(e,t,r,n,i,o,s,a){const l=i.length,c=new Uint8Array(BLOCK_LEN),u=u32(c),h=isAligned32(i)&&isAligned32(o),d=h?u32(i):U32_EMPTY,p=h?u32(o):U32_EMPTY;for(let f=0;f<l;s++){if(e(t,r,n,u,s,a),s>=MAX_COUNTER)throw new Error("arx: counter overflow");const g=Math.min(BLOCK_LEN,l-f);if(h&&g===BLOCK_LEN){const e=f/4;if(f%4!=0)throw new Error("arx: invalid block position");for(let t,r=0;r<BLOCK_LEN32;r++)t=e+r,p[t]=d[t]^u[r];f+=BLOCK_LEN;continue}for(let e,t=0;t<g;t++)e=f+t,o[e]=i[e]^c[t];f+=g}}function createCipher(e,t){const{allowShortKeys:r,extendNonceFn:n,counterLength:i,counterRight:o,rounds:s}=checkOpts$1({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw new Error("core must be a function");return number(i),number(s),bool(o),bool(r),(t,a,l,c,u=0)=>{bytes(t),bytes(a),bytes(l);const h=l.length;if(c||(c=new Uint8Array(h)),bytes(c),number(u),u<0||u>=MAX_COUNTER)throw new Error("arx: counter overflow");if(c.length<h)throw new Error(`arx: output (${c.length}) is shorter than data (${h})`);const d=[];let p,f,g=t.length;if(32===g)p=t.slice(),d.push(p),f=sigma32_32;else{if(16!==g||!r)throw new Error(`arx: invalid 32-byte key, got length=${g}`);p=new Uint8Array(32),p.set(t),p.set(t,16),f=sigma16_32,d.push(p)}isAligned32(a)||(a=a.slice(),d.push(a));const m=u32(p);if(n){if(24!==a.length)throw new Error("arx: extended nonce must be 24 bytes");n(f,m,u32(a.subarray(0,16)),m),a=a.subarray(16)}const y=16-i;if(y!==a.length)throw new Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){const e=new Uint8Array(12);e.set(a,o?0:12-a.length),a=e,d.push(a)}const v=u32(a);for(runCipher(e,f,m,v,l,c,u,s);d.length>0;)d.pop().fill(0);return c}}function chachaCore(e,t,r,n,i,o=20){let s=e[0],a=e[1],l=e[2],c=e[3],u=t[0],h=t[1],d=t[2],p=t[3],f=t[4],g=t[5],m=t[6],y=t[7],v=i,_=r[0],b=r[1],E=r[2],w=s,C=a,S=l,T=c,x=u,R=h,A=d,I=p,k=f,P=g,L=m,O=y,M=v,D=_,N=b,$=E;for(let B=0;B<o;B+=2)w=w+x|0,M=rotl(M^w,16),k=k+M|0,x=rotl(x^k,12),w=w+x|0,M=rotl(M^w,8),k=k+M|0,x=rotl(x^k,7),C=C+R|0,D=rotl(D^C,16),P=P+D|0,R=rotl(R^P,12),C=C+R|0,D=rotl(D^C,8),P=P+D|0,R=rotl(R^P,7),S=S+A|0,N=rotl(N^S,16),L=L+N|0,A=rotl(A^L,12),S=S+A|0,N=rotl(N^S,8),L=L+N|0,A=rotl(A^L,7),T=T+I|0,$=rotl($^T,16),O=O+$|0,I=rotl(I^O,12),T=T+I|0,$=rotl($^T,8),O=O+$|0,I=rotl(I^O,7),w=w+R|0,$=rotl($^w,16),L=L+$|0,R=rotl(R^L,12),w=w+R|0,$=rotl($^w,8),L=L+$|0,R=rotl(R^L,7),C=C+A|0,M=rotl(M^C,16),O=O+M|0,A=rotl(A^O,12),C=C+A|0,M=rotl(M^C,8),O=O+M|0,A=rotl(A^O,7),S=S+I|0,D=rotl(D^S,16),k=k+D|0,I=rotl(I^k,12),S=S+I|0,D=rotl(D^S,8),k=k+D|0,I=rotl(I^k,7),T=T+x|0,N=rotl(N^T,16),P=P+N|0,x=rotl(x^P,12),T=T+x|0,N=rotl(N^T,8),P=P+N|0,x=rotl(x^P,7);let F=0;n[F++]=s+w|0,n[F++]=a+C|0,n[F++]=l+S|0,n[F++]=c+T|0,n[F++]=u+x|0,n[F++]=h+R|0,n[F++]=d+A|0,n[F++]=p+I|0,n[F++]=f+k|0,n[F++]=g+P|0,n[F++]=m+L|0,n[F++]=y+O|0,n[F++]=v+M|0,n[F++]=_+D|0,n[F++]=b+N|0,n[F++]=E+$|0}function hchacha(e,t,r,n){let i=e[0],o=e[1],s=e[2],a=e[3],l=t[0],c=t[1],u=t[2],h=t[3],d=t[4],p=t[5],f=t[6],g=t[7],m=r[0],y=r[1],v=r[2],_=r[3];for(let E=0;E<20;E+=2)i=i+l|0,m=rotl(m^i,16),d=d+m|0,l=rotl(l^d,12),i=i+l|0,m=rotl(m^i,8),d=d+m|0,l=rotl(l^d,7),o=o+c|0,y=rotl(y^o,16),p=p+y|0,c=rotl(c^p,12),o=o+c|0,y=rotl(y^o,8),p=p+y|0,c=rotl(c^p,7),s=s+u|0,v=rotl(v^s,16),f=f+v|0,u=rotl(u^f,12),s=s+u|0,v=rotl(v^s,8),f=f+v|0,u=rotl(u^f,7),a=a+h|0,_=rotl(_^a,16),g=g+_|0,h=rotl(h^g,12),a=a+h|0,_=rotl(_^a,8),g=g+_|0,h=rotl(h^g,7),i=i+c|0,_=rotl(_^i,16),f=f+_|0,c=rotl(c^f,12),i=i+c|0,_=rotl(_^i,8),f=f+_|0,c=rotl(c^f,7),o=o+u|0,m=rotl(m^o,16),g=g+m|0,u=rotl(u^g,12),o=o+u|0,m=rotl(m^o,8),g=g+m|0,u=rotl(u^g,7),s=s+h|0,y=rotl(y^s,16),d=d+y|0,h=rotl(h^d,12),s=s+h|0,y=rotl(y^s,8),d=d+y|0,h=rotl(h^d,7),a=a+l|0,v=rotl(v^a,16),p=p+v|0,l=rotl(l^p,12),a=a+l|0,v=rotl(v^a,8),p=p+v|0,l=rotl(l^p,7);let b=0;n[b++]=i,n[b++]=o,n[b++]=s,n[b++]=a,n[b++]=m,n[b++]=y,n[b++]=v,n[b++]=_}var chacha20=createCipher(chachaCore,{counterRight:!1,counterLength:4,allowShortKeys:!1}),xchacha20=createCipher(chachaCore,{counterRight:!1,counterLength:8,extendNonceFn:hchacha,allowShortKeys:!1}),ZEROS16=new Uint8Array(16),updatePadded=(e,t)=>{e.update(t);const r=t.length%16;r&&e.update(ZEROS16.subarray(r))},ZEROS32=new Uint8Array(32);function computeTag(e,t,r,n,i){const o=e(t,r,ZEROS32),s=poly1305.create(o);i&&updatePadded(s,i),updatePadded(s,n);const a=new Uint8Array(16),l=createView$1(a);setBigUint64(l,0,BigInt(i?i.length:0),!0),setBigUint64(l,8,BigInt(n.length),!0),s.update(a);const c=s.digest();return o.fill(0),c}var _poly1305_aead=e=>(t,r,n)=>(bytes(t,32),bytes(r),{encrypt:(i,o)=>{const s=i.length,a=s+16;o?bytes(o,a):o=new Uint8Array(a),e(t,r,i,o,1);const l=computeTag(e,t,r,o.subarray(0,-16),n);return o.set(l,s),o},decrypt:(i,o)=>{const s=i.length,a=s-16;if(s<16)throw new Error("encrypted data must be at least 16 bytes");o?bytes(o,a):o=new Uint8Array(a);const l=i.subarray(0,-16);if(!equalBytes(i.subarray(-16),computeTag(e,t,r,l,n)))throw new Error("invalid tag");return e(t,r,l,o,1),o}}),chacha20poly1305=wrapCipher({blockSize:64,nonceLength:12,tagLength:16},_poly1305_aead(chacha20)),xchacha20poly1305=wrapCipher({blockSize:64,nonceLength:24,tagLength:16},_poly1305_aead(xchacha20)),HMAC=class extends Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,assert$2.hash(e);const r=toBytes$1(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return assert$2.exists(this),this.iHash.update(e),this}digestInto(e){assert$2.exists(this),assert$2.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},hmac=(e,t,r)=>new HMAC(e,t).update(r).digest();function extract(e,t,r){return assert$2.hash(e),void 0===r&&(r=new Uint8Array(e.outputLen)),hmac(e,toBytes$1(r),toBytes$1(t))}hmac.create=(e,t)=>new HMAC(e,t);var HKDF_COUNTER=new Uint8Array([0]),EMPTY_BUFFER=new Uint8Array;function expand(e,t,r,n=32){if(assert$2.hash(e),assert$2.number(n),n>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(n/e.outputLen);void 0===r&&(r=EMPTY_BUFFER);const o=new Uint8Array(i*e.outputLen),s=hmac.create(e,t),a=s._cloneInto(),l=new Uint8Array(s.outputLen);for(let c=0;c<i;c++)HKDF_COUNTER[0]=c+1,a.update(0===c?EMPTY_BUFFER:l).update(r).update(HKDF_COUNTER).digestInto(l),o.set(l,e.outputLen*c),s._cloneInto(a);return s.destroy(),a.destroy(),l.fill(0),HKDF_COUNTER.fill(0),o.slice(0,n)}var __defProp=Object.defineProperty,__export=(e,t)=>{for(var r in t)__defProp(e,r,{get:t[r],enumerable:!0})},verifiedSymbol$1=Symbol("verified"),isRecord$1=e=>e instanceof Object;function validateEvent$2(e){if(!isRecord$1(e))return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.pubkey)return!1;if(!e.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let r=e.tags[t];if(!Array.isArray(r))return!1;for(let e=0;e<r.length;e++)if("string"!=typeof r[e])return!1}return!0}var utils_exports={};__export(utils_exports,{Queue:()=>Queue,QueueNode:()=>QueueNode,binarySearch:()=>binarySearch$3,bytesToHex:()=>bytesToHex$2,hexToBytes:()=>hexToBytes$2,insertEventIntoAscendingList:()=>insertEventIntoAscendingList,insertEventIntoDescendingList:()=>insertEventIntoDescendingList$1,normalizeURL:()=>normalizeURL$1,utf8Decoder:()=>utf8Decoder$3,utf8Encoder:()=>utf8Encoder$4});var utf8Decoder$3=new TextDecoder("utf-8"),utf8Encoder$4=new TextEncoder;function normalizeURL$1(e){try{-1===e.indexOf("://")&&(e="wss://"+e);let t=new URL(e);return"http:"===t.protocol?t.protocol="ws:":"https:"===t.protocol&&(t.protocol="wss:"),t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),("80"===t.port&&"ws:"===t.protocol||"443"===t.port&&"wss:"===t.protocol)&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}catch(t){throw new Error(`Invalid URL: ${e}`)}}function insertEventIntoDescendingList$1(e,t){const[r,n]=binarySearch$3(e,e=>t.id===e.id?0:t.created_at===e.created_at?-1:e.created_at-t.created_at);return n||e.splice(r,0,t),e}function insertEventIntoAscendingList(e,t){const[r,n]=binarySearch$3(e,e=>t.id===e.id?0:t.created_at===e.created_at?-1:t.created_at-e.created_at);return n||e.splice(r,0,t),e}function binarySearch$3(e,t){let r=0,n=e.length-1;for(;r<=n;){const i=Math.floor((r+n)/2),o=t(e[i]);if(0===o)return[i,!0];o<0?n=i-1:r=i+1}return[r,!1]}var QueueNode=class{value;next=null;prev=null;constructor(e){this.value=e}},Queue=class{first;last;constructor(){this.first=null,this.last=null}enqueue(e){const t=new QueueNode(e);return this.last?this.last===this.first?(this.last=t,this.last.prev=this.first,this.first.next=t):(t.prev=this.last,this.last.next=t,this.last=t):(this.first=t,this.last=t),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const e=this.first;return this.first=null,this.last=null,e.value}const e=this.first;return this.first=e.next,this.first&&(this.first.prev=null),e.value}},JS$1=class{generateSecretKey(){return schnorr.utils.randomPrivateKey()}getPublicKey(e){return bytesToHex$2(schnorr.getPublicKey(e))}finalizeEvent(e,t){const r=e;return r.pubkey=bytesToHex$2(schnorr.getPublicKey(t)),r.id=getEventHash$1(r),r.sig=bytesToHex$2(schnorr.sign(getEventHash$1(r),t)),r[verifiedSymbol$1]=!0,r}verifyEvent(e){if("boolean"==typeof e[verifiedSymbol$1])return e[verifiedSymbol$1];const t=getEventHash$1(e);if(t!==e.id)return e[verifiedSymbol$1]=!1,!1;try{const r=schnorr.verify(e.sig,t,e.pubkey);return e[verifiedSymbol$1]=r,r}catch(err){return e[verifiedSymbol$1]=!1,!1}}};function serializeEvent$1(e){if(!validateEvent$2(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function getEventHash$1(e){return bytesToHex$2(sha256$1(utf8Encoder$4.encode(serializeEvent$1(e))))}var i$1=new JS$1,generateSecretKey$1=i$1.generateSecretKey,getPublicKey$1=i$1.getPublicKey,finalizeEvent$1=i$1.finalizeEvent,verifyEvent$1=i$1.verifyEvent,kinds_exports={};function isRegularKind(e){return e<1e4&&0!==e&&3!==e}function isReplaceableKind$1(e){return 0===e||3===e||1e4<=e&&e<2e4}function isEphemeralKind$1(e){return 2e4<=e&&e<3e4}function isAddressableKind$1(e){return 3e4<=e&&e<4e4}function classifyKind(e){return isRegularKind(e)?"regular":isReplaceableKind$1(e)?"replaceable":isEphemeralKind$1(e)?"ephemeral":isAddressableKind$1(e)?"parameterized":"unknown"}function isKind(e,t){const r=t instanceof Array?t:[t];return validateEvent$2(e)&&r.includes(e.kind)||!1}__export(kinds_exports,{Application:()=>Application,BadgeAward:()=>BadgeAward,BadgeDefinition:()=>BadgeDefinition,BlockedRelaysList:()=>BlockedRelaysList,BlossomServerList:()=>BlossomServerList,BookmarkList:()=>BookmarkList,Bookmarksets:()=>Bookmarksets,Calendar:()=>Calendar,CalendarEventRSVP:()=>CalendarEventRSVP,ChannelCreation:()=>ChannelCreation,ChannelHideMessage:()=>ChannelHideMessage,ChannelMessage:()=>ChannelMessage,ChannelMetadata:()=>ChannelMetadata,ChannelMuteUser:()=>ChannelMuteUser,ChatMessage:()=>ChatMessage,ClassifiedListing:()=>ClassifiedListing,ClientAuth:()=>ClientAuth$1,Comment:()=>Comment,CommunitiesList:()=>CommunitiesList,CommunityDefinition:()=>CommunityDefinition,CommunityPostApproval:()=>CommunityPostApproval,Contacts:()=>Contacts,CreateOrUpdateProduct:()=>CreateOrUpdateProduct,CreateOrUpdateStall:()=>CreateOrUpdateStall,Curationsets:()=>Curationsets,Date:()=>Date2,DirectMessageRelaysList:()=>DirectMessageRelaysList,DraftClassifiedListing:()=>DraftClassifiedListing,DraftLong:()=>DraftLong,Emojisets:()=>Emojisets,EncryptedDirectMessage:()=>EncryptedDirectMessage,EventDeletion:()=>EventDeletion,FavoriteRelays:()=>FavoriteRelays,FileMessage:()=>FileMessage,FileMetadata:()=>FileMetadata,FileServerPreference:()=>FileServerPreference,Followsets:()=>Followsets,ForumThread:()=>ForumThread,GenericRepost:()=>GenericRepost,Genericlists:()=>Genericlists,GiftWrap:()=>GiftWrap,GroupMetadata:()=>GroupMetadata,HTTPAuth:()=>HTTPAuth,Handlerinformation:()=>Handlerinformation,Handlerrecommendation:()=>Handlerrecommendation,Highlights:()=>Highlights,InterestsList:()=>InterestsList,Interestsets:()=>Interestsets,JobFeedback:()=>JobFeedback,JobRequest:()=>JobRequest,JobResult:()=>JobResult,Label:()=>Label,LightningPubRPC:()=>LightningPubRPC,LiveChatMessage:()=>LiveChatMessage,LiveEvent:()=>LiveEvent,LongFormArticle:()=>LongFormArticle,Metadata:()=>Metadata,Mutelist:()=>Mutelist,NWCWalletInfo:()=>NWCWalletInfo,NWCWalletRequest:()=>NWCWalletRequest,NWCWalletResponse:()=>NWCWalletResponse,NormalVideo:()=>NormalVideo,NostrConnect:()=>NostrConnect,OpenTimestamps:()=>OpenTimestamps,Photo:()=>Photo,Pinlist:()=>Pinlist,Poll:()=>Poll,PollResponse:()=>PollResponse,PrivateDirectMessage:()=>PrivateDirectMessage,ProblemTracker:()=>ProblemTracker,ProfileBadges:()=>ProfileBadges,PublicChatsList:()=>PublicChatsList,Reaction:()=>Reaction,RecommendRelay:()=>RecommendRelay,RelayList:()=>RelayList,RelayReview:()=>RelayReview,Relaysets:()=>Relaysets,Report:()=>Report,Reporting:()=>Reporting,Repost:()=>Repost,Seal:()=>Seal,SearchRelaysList:()=>SearchRelaysList,ShortTextNote:()=>ShortTextNote,ShortVideo:()=>ShortVideo,Time:()=>Time,UserEmojiList:()=>UserEmojiList,UserStatuses:()=>UserStatuses,Voice:()=>Voice,VoiceComment:()=>VoiceComment,Zap:()=>Zap,ZapGoal:()=>ZapGoal,ZapRequest:()=>ZapRequest,classifyKind:()=>classifyKind,isAddressableKind:()=>isAddressableKind$1,isEphemeralKind:()=>isEphemeralKind$1,isKind:()=>isKind,isRegularKind:()=>isRegularKind,isReplaceableKind:()=>isReplaceableKind$1});var Metadata=0,ShortTextNote=1,RecommendRelay=2,Contacts=3,EncryptedDirectMessage=4,EventDeletion=5,Repost=6,Reaction=7,BadgeAward=8,ChatMessage=9,ForumThread=11,Seal=13,PrivateDirectMessage=14,FileMessage=15,GenericRepost=16,Photo=20,NormalVideo=21,ShortVideo=22,ChannelCreation=40,ChannelMetadata=41,ChannelMessage=42,ChannelHideMessage=43,ChannelMuteUser=44,OpenTimestamps=1040,GiftWrap=1059,Poll=1068,FileMetadata=1063,Comment=1111,LiveChatMessage=1311,Voice=1222,VoiceComment=1244,ProblemTracker=1971,Report=1984,Reporting=1984,Label=1985,CommunityPostApproval=4550,JobRequest=5999,JobResult=6999,JobFeedback=7e3,ZapGoal=9041,ZapRequest=9734,Zap=9735,Highlights=9802,PollResponse=1018,Mutelist=1e4,Pinlist=10001,RelayList=10002,BookmarkList=10003,CommunitiesList=10004,PublicChatsList=10005,BlockedRelaysList=10006,SearchRelaysList=10007,FavoriteRelays=10012,InterestsList=10015,UserEmojiList=10030,DirectMessageRelaysList=10050,FileServerPreference=10096,BlossomServerList=10063,NWCWalletInfo=13194,LightningPubRPC=21e3,ClientAuth$1=22242,NWCWalletRequest=23194,NWCWalletResponse=23195,NostrConnect=24133,HTTPAuth=27235,Followsets=3e4,Genericlists=30001,Relaysets=30002,Bookmarksets=30003,Curationsets=30004,ProfileBadges=30008,BadgeDefinition=30009,Interestsets=30015,CreateOrUpdateStall=30017,CreateOrUpdateProduct=30018,LongFormArticle=30023,DraftLong=30024,Emojisets=30030,Application=30078,LiveEvent=30311,UserStatuses=30315,ClassifiedListing=30402,DraftClassifiedListing=30403,Date2=31922,Time=31923,Calendar=31924,CalendarEventRSVP=31925,RelayReview=31987,Handlerrecommendation=31989,Handlerinformation=31990,CommunityDefinition=34550,GroupMetadata=39e3,fakejson_exports={};function getHex64(e,t){let r=t.length+3,n=e.indexOf(`"${t}":`)+r,i=e.slice(n).indexOf('"')+n+1;return e.slice(i,i+64)}function getInt(e,t){let r=t.length,n=e.indexOf(`"${t}":`)+r+3,i=e.slice(n),o=Math.min(i.indexOf(","),i.indexOf("}"));return parseInt(i.slice(0,o),10)}function getSubscriptionId(e){let t=e.slice(0,22).indexOf('"EVENT"');if(-1===t)return null;let r=e.slice(t+7+1).indexOf('"');if(-1===r)return null;let n=t+7+1+r,i=e.slice(n+1,80).indexOf('"');if(-1===i)return null;let o=n+1+i;return e.slice(n+1,o)}function matchEventId(e,t){return t===getHex64(e,"id")}function matchEventPubkey(e,t){return t===getHex64(e,"pubkey")}function matchEventKind(e,t){return t===getInt(e,"kind")}__export(fakejson_exports,{getHex64:()=>getHex64,getInt:()=>getInt,getSubscriptionId:()=>getSubscriptionId,matchEventId:()=>matchEventId,matchEventKind:()=>matchEventKind,matchEventPubkey:()=>matchEventPubkey});var nip42_exports={},_WebSocket,_WebSocket2;function makeAuthEvent$1(e,t){return{kind:ClientAuth$1,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}__export(nip42_exports,{makeAuthEvent:()=>makeAuthEvent$1});try{_WebSocket=WebSocket}catch{}try{_WebSocket2=WebSocket}catch{}var nip19_exports={};__export(nip19_exports,{BECH32_REGEX:()=>BECH32_REGEX,Bech32MaxSize:()=>Bech32MaxSize$1,NostrTypeGuard:()=>NostrTypeGuard,decode:()=>decode$1,decodeNostrURI:()=>decodeNostrURI,encodeBytes:()=>encodeBytes$1,naddrEncode:()=>naddrEncode,neventEncode:()=>neventEncode,noteEncode:()=>noteEncode,nprofileEncode:()=>nprofileEncode,npubEncode:()=>npubEncode$1,nsecEncode:()=>nsecEncode});var NostrTypeGuard={isNProfile:e=>/^nprofile1[a-z\d]+$/.test(e||""),isNEvent:e=>/^nevent1[a-z\d]+$/.test(e||""),isNAddr:e=>/^naddr1[a-z\d]+$/.test(e||""),isNSec:e=>/^nsec1[a-z\d]{58}$/.test(e||""),isNPub:e=>/^npub1[a-z\d]{58}$/.test(e||""),isNote:e=>/^note1[a-z\d]+$/.test(e||""),isNcryptsec:e=>/^ncryptsec1[a-z\d]+$/.test(e||"")},Bech32MaxSize$1=5e3,BECH32_REGEX=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function integerToUint8Array(e){const t=new Uint8Array(4);return t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=255&e,t}function decodeNostrURI(e){try{return e.startsWith("nostr:")&&(e=e.substring(6)),decode$1(e)}catch(t){return{type:"invalid",data:null}}}function decode$1(e){let{prefix:t,words:r}=bech32$1.decode(e,Bech32MaxSize$1),n=new Uint8Array(bech32$1.fromWords(r));switch(t){case"nprofile":{let e=parseTLV$1(n);if(!e[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:bytesToHex$2(e[0][0]),relays:e[1]?e[1].map(e=>utf8Decoder$3.decode(e)):[]}}}case"nevent":{let e=parseTLV$1(n);if(!e[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(e[2]&&32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(e[3]&&4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:bytesToHex$2(e[0][0]),relays:e[1]?e[1].map(e=>utf8Decoder$3.decode(e)):[],author:e[2]?.[0]?bytesToHex$2(e[2][0]):void 0,kind:e[3]?.[0]?parseInt(bytesToHex$2(e[3][0]),16):void 0}}}case"naddr":{let e=parseTLV$1(n);if(!e[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!e[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!e[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:utf8Decoder$3.decode(e[0][0]),pubkey:bytesToHex$2(e[2][0]),kind:parseInt(bytesToHex$2(e[3][0]),16),relays:e[1]?e[1].map(e=>utf8Decoder$3.decode(e)):[]}}}case"nsec":return{type:t,data:n};case"npub":case"note":return{type:t,data:bytesToHex$2(n)};default:throw new Error(`unknown prefix ${t}`)}}function parseTLV$1(e){let t={},r=e;for(;r.length>0;){let e=r[0],n=r[1],i=r.slice(2,2+n);if(r=r.slice(2+n),i.length<n)throw new Error(`not enough data to read on TLV ${e}`);t[e]=t[e]||[],t[e].push(i)}return t}function nsecEncode(e){return encodeBytes$1("nsec",e)}function npubEncode$1(e){return encodeBytes$1("npub",hexToBytes$2(e))}function noteEncode(e){return encodeBytes$1("note",hexToBytes$2(e))}function encodeBech32$1(e,t){let r=bech32$1.toWords(t);return bech32$1.encode(e,r,Bech32MaxSize$1)}function encodeBytes$1(e,t){return encodeBech32$1(e,t)}function nprofileEncode(e){return encodeBech32$1("nprofile",encodeTLV({0:[hexToBytes$2(e.pubkey)],1:(e.relays||[]).map(e=>utf8Encoder$4.encode(e))}))}function neventEncode(e){let t;return void 0!==e.kind&&(t=integerToUint8Array(e.kind)),encodeBech32$1("nevent",encodeTLV({0:[hexToBytes$2(e.id)],1:(e.relays||[]).map(e=>utf8Encoder$4.encode(e)),2:e.author?[hexToBytes$2(e.author)]:[],3:t?[new Uint8Array(t)]:[]}))}function naddrEncode(e){let t=new ArrayBuffer(4);return new DataView(t).setUint32(0,e.kind,!1),encodeBech32$1("naddr",encodeTLV({0:[utf8Encoder$4.encode(e.identifier)],1:(e.relays||[]).map(e=>utf8Encoder$4.encode(e)),2:[hexToBytes$2(e.pubkey)],3:[new Uint8Array(t)]}))}function encodeTLV(e){let t=[];return Object.entries(e).reverse().forEach(([e,r])=>{r.forEach(r=>{let n=new Uint8Array(r.length+2);n.set([parseInt(e)],0),n.set([r.length],1),n.set(r,2),t.push(n)})}),concatBytes$1(...t)}var nip04_exports={};function encrypt(e,t,r){const n=e instanceof Uint8Array?bytesToHex$2(e):e,i=getNormalizedX(secp256k1.getSharedSecret(n,"02"+t));let o=Uint8Array.from(randomBytes(16)),s=utf8Encoder$4.encode(r),a=cbc(i,o).encrypt(s);return`${base64$1.encode(new Uint8Array(a))}?iv=${base64$1.encode(new Uint8Array(o.buffer))}`}function decrypt(e,t,r){const n=e instanceof Uint8Array?bytesToHex$2(e):e;let[i,o]=r.split("?iv="),s=getNormalizedX(secp256k1.getSharedSecret(n,"02"+t)),a=base64$1.decode(o),l=base64$1.decode(i),c=cbc(s,a).decrypt(l);return utf8Decoder$3.decode(c)}function getNormalizedX(e){return e.slice(1,33)}__export(nip04_exports,{decrypt:()=>decrypt,encrypt:()=>encrypt});var nip05_exports={};__export(nip05_exports,{NIP05_REGEX:()=>NIP05_REGEX,isNip05:()=>isNip05,isValid:()=>isValid,queryProfile:()=>queryProfile,searchDomain:()=>searchDomain,useFetchImplementation:()=>useFetchImplementation});var NIP05_REGEX=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,isNip05=e=>NIP05_REGEX.test(e||""),_fetch;try{_fetch=fetch}catch(_){}function useFetchImplementation(e){_fetch=e}async function searchDomain(e,t=""){try{const r=`https://${e}/.well-known/nostr.json?name=${t}`,n=await _fetch(r,{redirect:"manual"});if(200!==n.status)throw Error("Wrong response code");return(await n.json()).names}catch(_){return{}}}async function queryProfile(e){const t=e.match(NIP05_REGEX);if(!t)return null;const[,r="_",n]=t;try{const e=`https://${n}/.well-known/nostr.json?name=${r}`,t=await _fetch(e,{redirect:"manual"});if(200!==t.status)throw Error("Wrong response code");const i=await t.json(),o=i.names[r];return o?{pubkey:o,relays:i.relays?.[o]}:null}catch(i){return null}}async function isValid(e,t){const r=await queryProfile(t);return!!r&&r.pubkey===e}var nip10_exports={};function parse$1(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let r,n;for(let i=e.tags.length-1;i>=0;i--){const o=e.tags[i];if("e"===o[0]&&o[1]){const[e,i,s,a,l]=o,c={id:i,relays:s?[s]:[],author:l};if("root"===a){t.root=c;continue}if("reply"===a){t.reply=c;continue}if("mention"===a){t.mentions.push(c);continue}r?n=c:r=c,t.mentions.push(c);continue}if("q"===o[0]&&o[1]){const[e,r,n]=o;t.quotes.push({id:r,relays:n?[n]:[]})}"p"===o[0]&&o[1]&&t.profiles.push({pubkey:o[1],relays:o[2]?[o[2]]:[]})}return t.root||(t.root=n||r||t.reply),t.reply||(t.reply=r||t.root),[t.reply,t.root].forEach(e=>{if(!e)return;let r=t.mentions.indexOf(e);if(-1!==r&&t.mentions.splice(r,1),e.author){let r=t.profiles.find(t=>t.pubkey===e.author);r&&r.relays&&(e.relays||(e.relays=[]),r.relays.forEach(t=>{-1===e.relays?.indexOf(t)&&e.relays.push(t)}),r.relays=e.relays)}}),t.mentions.forEach(e=>{if(e.author){let r=t.profiles.find(t=>t.pubkey===e.author);r&&r.relays&&(e.relays||(e.relays=[]),r.relays.forEach(t=>{-1===e.relays.indexOf(t)&&e.relays.push(t)}),r.relays=e.relays)}}),t}__export(nip10_exports,{parse:()=>parse$1});var nip11_exports={};function useFetchImplementation2(){}async function fetchRelayInformation(e){return await(await fetch(e.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}__export(nip11_exports,{fetchRelayInformation:()=>fetchRelayInformation,useFetchImplementation:()=>useFetchImplementation2});var nip13_exports={};function getPow(e){let t=0;for(let r=0;r<64;r+=8){const n=parseInt(e.substring(r,r+8),16);if(0!==n){t+=Math.clz32(n);break}t+=32}return t}function minePow(e,t){let r=0;const n=e,i=["nonce",r.toString(),t.toString()];for(n.tags.push(i);;){const e=Math.floor((new Date).getTime()/1e3);if(e!==n.created_at&&(r=0,n.created_at=e),i[1]=(++r).toString(),n.id=fastEventHash(n),getPow(n.id)>=t)break}return n}function fastEventHash(e){return bytesToHex$2(sha256$1(utf8Encoder$4.encode(JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content]))))}__export(nip13_exports,{fastEventHash:()=>fastEventHash,getPow:()=>getPow,minePow:()=>minePow});var nip17_exports={};__export(nip17_exports,{unwrapEvent:()=>unwrapEvent2,unwrapManyEvents:()=>unwrapManyEvents2,wrapEvent:()=>wrapEvent2,wrapManyEvents:()=>wrapManyEvents2});var nip59_exports={};__export(nip59_exports,{createRumor:()=>createRumor,createSeal:()=>createSeal,createWrap:()=>createWrap,unwrapEvent:()=>unwrapEvent,unwrapManyEvents:()=>unwrapManyEvents,wrapEvent:()=>wrapEvent,wrapManyEvents:()=>wrapManyEvents});var nip44_exports={};__export(nip44_exports,{decrypt:()=>decrypt2,encrypt:()=>encrypt2,getConversationKey:()=>getConversationKey,v2:()=>v2});var minPlaintextSize=1,maxPlaintextSize=65535;function getConversationKey(e,t){const r=secp256k1.getSharedSecret(e,"02"+t).subarray(1,33);return extract(sha256$1,r,"nip44-v2")}function getMessageKeys(e,t){const r=expand(sha256$1,e,t,76);return{chacha_key:r.subarray(0,32),chacha_nonce:r.subarray(32,44),hmac_key:r.subarray(44,76)}}function calcPaddedLen(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,r=t<=256?32:t/8;return r*(Math.floor((e-1)/r)+1)}function writeU16BE(e){if(!Number.isSafeInteger(e)||e<minPlaintextSize||e>maxPlaintextSize)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!1),t}function pad(e){const t=utf8Encoder$4.encode(e),r=t.length;return concatBytes$1(writeU16BE(r),t,new Uint8Array(calcPaddedLen(r)-r))}function unpad(e){const t=new DataView(e.buffer).getUint16(0),r=e.subarray(2,2+t);if(t<minPlaintextSize||t>maxPlaintextSize||r.length!==t||e.length!==2+calcPaddedLen(t))throw new Error("invalid padding");return utf8Decoder$3.decode(r)}function hmacAad(e,t,r){if(32!==r.length)throw new Error("AAD associated data must be 32 bytes");const n=concatBytes$1(r,t);return hmac(sha256$1,e,n)}function decodePayload(e){if("string"!=typeof e)throw new Error("payload must be a valid string");const t=e.length;if(t<132||t>87472)throw new Error("invalid payload length: "+t);if("#"===e[0])throw new Error("unknown encryption version");let r;try{r=base64$1.decode(e)}catch(error){throw new Error("invalid base64: "+error.message)}const n=r.length;if(n<99||n>65603)throw new Error("invalid data length: "+n);const i=r[0];if(2!==i)throw new Error("unknown encryption version "+i);return{nonce:r.subarray(1,33),ciphertext:r.subarray(33,-32),mac:r.subarray(-32)}}function encrypt2(e,t,r=randomBytes(32)){const{chacha_key:n,chacha_nonce:i,hmac_key:o}=getMessageKeys(t,r),s=pad(e),a=chacha20(n,i,s),l=hmacAad(o,a,r);return base64$1.encode(concatBytes$1(new Uint8Array([2]),r,a,l))}function decrypt2(e,t){const{nonce:r,ciphertext:n,mac:i}=decodePayload(e),{chacha_key:o,chacha_nonce:s,hmac_key:a}=getMessageKeys(t,r);if(!equalBytes(hmacAad(a,n,r),i))throw new Error("invalid MAC");return unpad(chacha20(o,s,n))}var v2={utils:{getConversationKey:getConversationKey,calcPaddedLen:calcPaddedLen},encrypt:encrypt2,decrypt:decrypt2},TWO_DAYS=172800,now=()=>Math.round(Date.now()/1e3),randomNow=()=>Math.round(now()-Math.random()*TWO_DAYS),nip44ConversationKey=(e,t)=>getConversationKey(e,t),nip44Encrypt=(e,t,r)=>encrypt2(JSON.stringify(e),nip44ConversationKey(t,r)),nip44Decrypt=(e,t)=>JSON.parse(decrypt2(e.content,nip44ConversationKey(t,e.pubkey)));function createRumor(e,t){const r={created_at:now(),content:"",tags:[],...e,pubkey:getPublicKey$1(t)};return r.id=getEventHash$1(r),r}function createSeal(e,t,r){return finalizeEvent$1({kind:Seal,content:nip44Encrypt(e,t,r),created_at:randomNow(),tags:[]},t)}function createWrap(e,t){const r=generateSecretKey$1();return finalizeEvent$1({kind:GiftWrap,content:nip44Encrypt(e,r,t),created_at:randomNow(),tags:[["p",t]]},r)}function wrapEvent(e,t,r){return createWrap(createSeal(createRumor(e,t),t,r),r)}function wrapManyEvents(e,t,r){if(!r||0===r.length)throw new Error("At least one recipient is required.");const n=[wrapEvent(e,t,getPublicKey$1(t))];return r.forEach(r=>{n.push(wrapEvent(e,t,r))}),n}function unwrapEvent(e,t){return nip44Decrypt(nip44Decrypt(e,t),t)}function unwrapManyEvents(e,t){let r=[];return e.forEach(e=>{r.push(unwrapEvent(e,t))}),r.sort((e,t)=>e.created_at-t.created_at),r}function createEvent(e,t,r,n){const i={created_at:Math.ceil(Date.now()/1e3),kind:PrivateDirectMessage,tags:[],content:t};return(Array.isArray(e)?e:[e]).forEach(({publicKey:e,relayUrl:t})=>{i.tags.push(t?["p",e,t]:["p",e])}),n&&i.tags.push(["e",n.eventId,n.relayUrl||"","reply"]),r&&i.tags.push(["subject",r]),i}function wrapEvent2(e,t,r,n,i){return wrapEvent(createEvent(t,r,n,i),e,t.publicKey)}function wrapManyEvents2(e,t,r,n,i){if(!t||0===t.length)throw new Error("At least one recipient is required.");return[{publicKey:getPublicKey$1(e)},...t].map(t=>wrapEvent2(e,t,r,n,i))}var unwrapEvent2=unwrapEvent,unwrapManyEvents2=unwrapManyEvents,nip18_exports={};function finishRepostEvent(e,t,r,n){let i;const o=[...e.tags??[],["e",t.id,r],["p",t.pubkey]];return t.kind===ShortTextNote?i=Repost:(i=GenericRepost,o.push(["k",String(t.kind)])),finalizeEvent$1({kind:i,tags:o,content:""===e.content||t.tags?.find(e=>"-"===e[0])?"":JSON.stringify(t),created_at:e.created_at},n)}function getRepostedEventPointer(e){if(![Repost,GenericRepost].includes(e.kind))return;let t,r;for(let n=e.tags.length-1;n>=0&&(void 0===t||void 0===r);n--){const i=e.tags[n];i.length>=2&&("e"===i[0]&&void 0===t?t=i:"p"===i[0]&&void 0===r&&(r=i))}return void 0!==t?{id:t[1],relays:[t[2],r?.[2]].filter(e=>"string"==typeof e),author:r?.[1]}:void 0}function getRepostedEvent(e,{skipVerification:t}={}){const r=getRepostedEventPointer(e);if(void 0===r||""===e.content)return;let n;try{n=JSON.parse(e.content)}catch(error){return}return n.id===r.id&&(t||verifyEvent$1(n))?n:void 0}__export(nip18_exports,{finishRepostEvent:()=>finishRepostEvent,getRepostedEvent:()=>getRepostedEvent,getRepostedEventPointer:()=>getRepostedEventPointer});var nip21_exports={};__export(nip21_exports,{NOSTR_URI_REGEX:()=>NOSTR_URI_REGEX,parse:()=>parse2,test:()=>test});var NOSTR_URI_REGEX=new RegExp(`nostr:(${BECH32_REGEX.source})`);function test(e){return"string"==typeof e&&new RegExp(`^${NOSTR_URI_REGEX.source}$`).test(e)}function parse2(e){const t=e.match(new RegExp(`^${NOSTR_URI_REGEX.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:decode$1(t[1])}}var nip25_exports={};function finishReactionEvent(e,t,r){const n=t.tags.filter(e=>e.length>=2&&("e"===e[0]||"p"===e[0]));return finalizeEvent$1({...e,kind:Reaction,tags:[...e.tags??[],...n,["e",t.id],["p",t.pubkey]],content:e.content??"+"},r)}function getReactedEventPointer(e){if(e.kind!==Reaction)return;let t,r;for(let n=e.tags.length-1;n>=0&&(void 0===t||void 0===r);n--){const i=e.tags[n];i.length>=2&&("e"===i[0]&&void 0===t?t=i:"p"===i[0]&&void 0===r&&(r=i))}return void 0!==t&&void 0!==r?{id:t[1],relays:[t[2],r[2]].filter(e=>void 0!==e),author:r[1]}:void 0}__export(nip25_exports,{finishReactionEvent:()=>finishReactionEvent,getReactedEventPointer:()=>getReactedEventPointer});var nip27_exports={};__export(nip27_exports,{parse:()=>parse3});var noCharacter=/\W/m,noURLCharacter=/[^\w\/] |[^\w\/]$|$|,| /m,MAX_HASHTAG_LENGTH=42;function*parse3(e){let t=[];if("string"!=typeof e){for(let r=0;r<e.tags.length;r++){const n=e.tags[r];"emoji"===n[0]&&n.length>=3&&t.push({type:"emoji",shortcode:n[1],url:n[2]})}e=e.content}const r=e.length;let n=0,i=0;e:for(;i<r;){const s=e.indexOf(":",i),a=e.indexOf("#",i);if(-1===s&&-1===a)break e;if(-1===s||a>=0&&a<s){if(0===a||" "===e[a-1]){const t=e.slice(a+1,a+MAX_HASHTAG_LENGTH).match(noCharacter),o=t?a+1+t.index:r;yield{type:"text",text:e.slice(n,a)},yield{type:"hashtag",value:e.slice(a+1,o)},i=o,n=i;continue e}i=a+1}else if("nostr"===e.slice(s-5,s)){const t=e.slice(s+60).match(noCharacter),a=t?s+60+t.index:r;try{let t,{data:r,type:o}=decode$1(e.slice(s+1,a));switch(o){case"npub":t={pubkey:r};break;case"note":t={id:r};break;case"nsec":i=a+1;continue;default:t=r}n!==s-5&&(yield{type:"text",text:e.slice(n,s-5)}),yield{type:"reference",pointer:t},i=a,n=i;continue e}catch(o){i=s+1;continue e}}else if("https"===e.slice(s-5,s)||"http"===e.slice(s-4,s)){const t=e.slice(s+4).match(noURLCharacter),a=t?s+4+t.index:r,l="s"===e[s-1]?5:4;try{let t=new URL(e.slice(s-l,a));if(-1===t.hostname.indexOf("."))throw new Error("invalid url");if(n!==s-l&&(yield{type:"text",text:e.slice(n,s-l)}),/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(t.pathname)){yield{type:"image",url:t.toString()},i=a,n=i;continue e}if(/\.(mp4|avi|webm|mkv|mov)$/i.test(t.pathname)){yield{type:"video",url:t.toString()},i=a,n=i;continue e}if(/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(t.pathname)){yield{type:"audio",url:t.toString()},i=a,n=i;continue e}yield{type:"url",url:t.toString()},i=a,n=i;continue e}catch(o){i=a+1;continue e}}else{if("wss"!==e.slice(s-3,s)&&"ws"!==e.slice(s-2,s)){for(let r=0;r<t.length;r++){const o=t[r];if(":"===e[s+o.shortcode.length+1]&&e.slice(s+1,s+o.shortcode.length+1)===o.shortcode){n!==s&&(yield{type:"text",text:e.slice(n,s)}),yield o,i=s+o.shortcode.length+2,n=i;continue e}}i=s+1;continue e}{const t=e.slice(s+4).match(noURLCharacter),a=t?s+4+t.index:r,l="s"===e[s-1]?3:2;try{let t=new URL(e.slice(s-l,a));if(-1===t.hostname.indexOf("."))throw new Error("invalid ws url");n!==s-l&&(yield{type:"text",text:e.slice(n,s-l)}),yield{type:"relay",url:t.toString()},i=a,n=i;continue e}catch(o){i=a+1;continue e}}}}n!==r&&(yield{type:"text",text:e.slice(n)})}var nip28_exports={};__export(nip28_exports,{channelCreateEvent:()=>channelCreateEvent,channelHideMessageEvent:()=>channelHideMessageEvent,channelMessageEvent:()=>channelMessageEvent,channelMetadataEvent:()=>channelMetadataEvent,channelMuteUserEvent:()=>channelMuteUserEvent});var channelCreateEvent=(e,t)=>{let r;if("object"==typeof e.content)r=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;r=e.content}return finalizeEvent$1({kind:ChannelCreation,tags:[...e.tags??[]],content:r,created_at:e.created_at},t)},channelMetadataEvent=(e,t)=>{let r;if("object"==typeof e.content)r=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;r=e.content}return finalizeEvent$1({kind:ChannelMetadata,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:r,created_at:e.created_at},t)},channelMessageEvent=(e,t)=>{const r=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&r.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),finalizeEvent$1({kind:ChannelMessage,tags:[...r,...e.tags??[]],content:e.content,created_at:e.created_at},t)},channelHideMessageEvent=(e,t)=>{let r;if("object"==typeof e.content)r=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;r=e.content}return finalizeEvent$1({kind:ChannelHideMessage,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:r,created_at:e.created_at},t)},channelMuteUserEvent=(e,t)=>{let r;if("object"==typeof e.content)r=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;r=e.content}return finalizeEvent$1({kind:ChannelMuteUser,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:r,created_at:e.created_at},t)},nip30_exports={};__export(nip30_exports,{EMOJI_SHORTCODE_REGEX:()=>EMOJI_SHORTCODE_REGEX,matchAll:()=>matchAll,regex:()=>regex,replaceAll:()=>replaceAll});var EMOJI_SHORTCODE_REGEX=/:(\w+):/,regex=()=>new RegExp(`\\B${EMOJI_SHORTCODE_REGEX.source}\\B`,"g");function*matchAll(e){const t=e.matchAll(regex());for(const n of t)try{const[e,t]=n;yield{shortcode:e,name:t,start:n.index,end:n.index+e.length}}catch(r){}}function replaceAll(e,t){return e.replaceAll(regex(),(e,r)=>t({shortcode:e,name:r}))}var nip39_exports={},_fetch3;__export(nip39_exports,{useFetchImplementation:()=>useFetchImplementation3,validateGithub:()=>validateGithub});try{_fetch3=fetch}catch{}function useFetchImplementation3(e){_fetch3=e}async function validateGithub(e,t,r){try{return await(await _fetch3(`https://gist.github.com/${t}/${r}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch(_){return!1}}var nip47_exports={};function parseConnectionString(e){const{host:t,pathname:r,searchParams:n}=new URL(e),i=r||t,o=n.get("relay"),s=n.get("secret");if(!i||!o||!s)throw new Error("invalid connection string");return{pubkey:i,relay:o,secret:s}}async function makeNwcRequestEvent(e,t,r){const n=encrypt(t,e,JSON.stringify({method:"pay_invoice",params:{invoice:r}}));return finalizeEvent$1({kind:NWCWalletRequest,created_at:Math.round(Date.now()/1e3),content:n,tags:[["p",e]]},t)}__export(nip47_exports,{makeNwcRequestEvent:()=>makeNwcRequestEvent,parseConnectionString:()=>parseConnectionString});var nip54_exports={};function normalizeIdentifier(e){return e=(e=e.trim().toLowerCase()).normalize("NFKC"),Array.from(e).map(e=>/\p{Letter}/u.test(e)||/\p{Number}/u.test(e)?e:"-").join("")}__export(nip54_exports,{normalizeIdentifier:()=>normalizeIdentifier});var nip57_exports={},_fetch4;__export(nip57_exports,{getSatoshisAmountFromBolt11:()=>getSatoshisAmountFromBolt11,getZapEndpoint:()=>getZapEndpoint,makeZapReceipt:()=>makeZapReceipt,makeZapRequest:()=>makeZapRequest,useFetchImplementation:()=>useFetchImplementation4,validateZapRequest:()=>validateZapRequest});try{_fetch4=fetch}catch{}function useFetchImplementation4(e){_fetch4=e}async function getZapEndpoint(e){try{let t="",{lud06:r,lud16:n}=JSON.parse(e.content);if(n){let[e,r]=n.split("@");t=new URL(`/.well-known/lnurlp/${e}`,`https://${r}`).toString()}else{if(!r)return null;{let{words:e}=bech32$1.decode(r,1e3),n=bech32$1.fromWords(e);t=utf8Decoder$3.decode(n)}}let i=await(await _fetch4(t)).json();if(i.allowsNostr&&i.nostrPubkey)return i.callback}catch(err){}return null}function makeZapRequest(e){let t={kind:9734,created_at:Math.round(Date.now()/1e3),content:e.comment||"",tags:[["p","pubkey"in e?e.pubkey:e.event.pubkey],["amount",e.amount.toString()],["relays",...e.relays]]};if("event"in e){if(t.tags.push(["e",e.event.id]),isReplaceableKind$1(e.event.kind)){const r=["a",`${e.event.kind}:${e.event.pubkey}:`];t.tags.push(r)}else if(isAddressableKind$1(e.event.kind)){let r=e.event.tags.find(([e,t])=>"d"===e&&t);if(!r)throw new Error("d tag not found or is empty");const n=["a",`${e.event.kind}:${e.event.pubkey}:${r[1]}`];t.tags.push(n)}t.tags.push(["k",e.event.kind.toString()])}return t}function validateZapRequest(e){let t;try{t=JSON.parse(e)}catch(err){return"Invalid zap request JSON."}if(!validateEvent$2(t))return"Zap request is not a valid Nostr event.";if(!verifyEvent$1(t))return"Invalid signature on zap request.";let r=t.tags.find(([e,t])=>"p"===e&&t);if(!r)return"Zap request doesn't have a 'p' tag.";if(!r[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let n=t.tags.find(([e,t])=>"e"===e&&t);return n&&!n[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find(([e,t])=>"relays"===e&&t)?null:"Zap request doesn't have a 'relays' tag."}function makeZapReceipt({zapRequest:e,preimage:t,bolt11:r,paidAt:n}){let i=JSON.parse(e),o=i.tags.filter(([e])=>"e"===e||"p"===e||"a"===e),s={kind:9735,created_at:Math.round(n.getTime()/1e3),content:"",tags:[...o,["P",i.pubkey],["bolt11",r],["description",e]]};return t&&s.tags.push(["preimage",t]),s}function getSatoshisAmountFromBolt11(e){if(e.length<50)return 0;const t=(e=e.substring(0,50)).lastIndexOf("1");if(-1===t)return 0;const r=e.substring(0,t);if(!r.startsWith("lnbc"))return 0;const n=r.substring(4);if(n.length<1)return 0;const i=n[n.length-1],o=i.charCodeAt(0)-"0".charCodeAt(0),s=o>=0&&o<=9;let a=n.length-1;if(s&&a++,a<1)return 0;const l=parseInt(n.substring(0,a));switch(i){case"m":return 1e5*l;case"u":return 100*l;case"n":return l/10;case"p":return l/1e4;default:return 1e8*l}}var nip77_exports={};__export(nip77_exports,{Negentropy:()=>Negentropy,NegentropyStorageVector:()=>NegentropyStorageVector,NegentropySync:()=>NegentropySync});var PROTOCOL_VERSION=97,ID_SIZE=32,FINGERPRINT_SIZE=16,Mode={Skip:0,Fingerprint:1,IdList:2},WrappedBuffer=class{_raw;length;constructor(e){"number"==typeof e?(this._raw=new Uint8Array(e),this.length=0):e instanceof Uint8Array?(this._raw=new Uint8Array(e),this.length=e.length):(this._raw=new Uint8Array(512),this.length=0)}unwrap(){return this._raw.subarray(0,this.length)}get capacity(){return this._raw.byteLength}extend(e){if(e instanceof WrappedBuffer&&(e=e.unwrap()),"number"!=typeof e.length)throw Error("bad length");const t=e.length+this.length;if(this.capacity<t){const e=this._raw,r=Math.max(2*this.capacity,t);this._raw=new Uint8Array(r),this._raw.set(e)}this._raw.set(e,this.length),this.length+=e.length}shift(){const e=this._raw[0];return this._raw=this._raw.subarray(1),this.length--,e}shiftN(e=1){const t=this._raw.subarray(0,e);return this._raw=this._raw.subarray(e),this.length-=e,t}};function decodeVarInt(e){let t=0;for(;;){if(0===e.length)throw Error("parse ends prematurely");let r=e.shift();if(t=t<<7|127&r,!(128&r))break}return t}function encodeVarInt(e){if(0===e)return new WrappedBuffer(new Uint8Array([0]));let t=[];for(;0!==e;)t.push(127&e),e>>>=7;t.reverse();for(let r=0;r<t.length-1;r++)t[r]|=128;return new WrappedBuffer(new Uint8Array(t))}function getByte(e){return getBytes(e,1)[0]}function getBytes(e,t){if(e.length<t)throw Error("parse ends prematurely");return e.shiftN(t)}var Accumulator=class{buf;constructor(){this.setToZero()}setToZero(){this.buf=new Uint8Array(ID_SIZE)}add(e){let t=0,r=0,n=new DataView(this.buf.buffer),i=new DataView(e.buffer);for(let o=0;o<8;o++){let e=4*o,s=n.getUint32(e,!0);s+=t,s+=i.getUint32(e,!0),s>4294967295&&(r=1),n.setUint32(e,4294967295&s,!0),t=r,r=0}}negate(){let e=new DataView(this.buf.buffer);for(let r=0;r<8;r++){let t=4*r;e.setUint32(t,~e.getUint32(t,!0))}let t=new Uint8Array(ID_SIZE);t[0]=1,this.add(t)}getFingerprint(e){let t=new WrappedBuffer;return t.extend(this.buf),t.extend(encodeVarInt(e)),sha256$1(t.unwrap()).subarray(0,FINGERPRINT_SIZE)}},NegentropyStorageVector=class{items;sealed;constructor(){this.items=[],this.sealed=!1}insert(e,t){if(this.sealed)throw Error("already sealed");const r=hexToBytes$1(t);if(r.byteLength!==ID_SIZE)throw Error("bad id size for added item");this.items.push({timestamp:e,id:r})}seal(){if(this.sealed)throw Error("already sealed");this.sealed=!0,this.items.sort(itemCompare);for(let e=1;e<this.items.length;e++)if(0===itemCompare(this.items[e-1],this.items[e]))throw Error("duplicate item inserted")}unseal(){this.sealed=!1}size(){return this._checkSealed(),this.items.length}getItem(e){if(this._checkSealed(),e>=this.items.length)throw Error("out of range");return this.items[e]}iterate(e,t,r){this._checkSealed(),this._checkBounds(e,t);for(let n=e;n<t&&r(this.items[n],n);++n);}findLowerBound(e,t,r){return this._checkSealed(),this._checkBounds(e,t),this._binarySearch(this.items,e,t,e=>itemCompare(e,r)<0)}fingerprint(e,t){let r=new Accumulator;return r.setToZero(),this.iterate(e,t,e=>(r.add(e.id),!0)),r.getFingerprint(t-e)}_checkSealed(){if(!this.sealed)throw Error("not sealed")}_checkBounds(e,t){if(e>t||t>this.items.length)throw Error("bad range")}_binarySearch(e,t,r,n){let i=r-t;for(;i>0;){let r=t,o=Math.floor(i/2);r+=o,n(e[r])?(t=++r,i-=o+1):i=o}return t}},Negentropy=class{storage;frameSizeLimit;lastTimestampIn;lastTimestampOut;constructor(e,t=6e4){if(t<4096)throw Error("frameSizeLimit too small");this.storage=e,this.frameSizeLimit=t,this.lastTimestampIn=0,this.lastTimestampOut=0}_bound(e,t){return{timestamp:e,id:t||new Uint8Array(0)}}initiate(){let e=new WrappedBuffer;return e.extend(new Uint8Array([PROTOCOL_VERSION])),this.splitRange(0,this.storage.size(),this._bound(Number.MAX_VALUE),e),bytesToHex$1(e.unwrap())}reconcile(e,t,r){const n=new WrappedBuffer(hexToBytes$1(e));this.lastTimestampIn=this.lastTimestampOut=0;let i=new WrappedBuffer;i.extend(new Uint8Array([PROTOCOL_VERSION]));let o=getByte(n);if(o<96||o>111)throw Error("invalid negentropy protocol version byte");if(o!==PROTOCOL_VERSION)throw Error("unsupported negentropy protocol version requested: "+(o-96));let s=this.storage.size(),a=this._bound(0),l=0,c=!1;for(;0!==n.length;){let e=new WrappedBuffer,o=()=>{c&&(c=!1,e.extend(this.encodeBound(a)),e.extend(encodeVarInt(Mode.Skip)))},u=this.decodeBound(n),h=decodeVarInt(n),d=l,p=this.storage.findLowerBound(l,s,u);if(h===Mode.Skip)c=!0;else if(h===Mode.Fingerprint)0!==compareUint8Array(getBytes(n,FINGERPRINT_SIZE),this.storage.fingerprint(d,p))?(o(),this.splitRange(d,p,u,e)):c=!0;else{if(h!==Mode.IdList)throw Error("unexpected mode");{let e=decodeVarInt(n),i={};for(let t=0;t<e;t++){let e=getBytes(n,ID_SIZE);i[bytesToHex$1(e)]=e}if(c=!0,this.storage.iterate(d,p,e=>{let r=e.id;const n=bytesToHex$1(r);return i[n]?delete i[bytesToHex$1(r)]:t?.(n),!0}),r)for(let t of Object.values(i))r(bytesToHex$1(t))}}if(this.exceededFrameSizeLimit(i.length+e.length)){let e=this.storage.fingerprint(p,s);i.extend(this.encodeBound(this._bound(Number.MAX_VALUE))),i.extend(encodeVarInt(Mode.Fingerprint)),i.extend(e);break}i.extend(e),l=p,a=u}return 1===i.length?null:bytesToHex$1(i.unwrap())}splitRange(e,t,r,n){let i=t-e;if(i<32)n.extend(this.encodeBound(r)),n.extend(encodeVarInt(Mode.IdList)),n.extend(encodeVarInt(i)),this.storage.iterate(e,t,e=>(n.extend(e.id),!0));else{let o=Math.floor(i/16),s=i%16,a=e;for(let e=0;e<16;e++){let i,l=o+(e<s?1:0),c=this.storage.fingerprint(a,a+l);if(a+=l,a===t)i=r;else{let e,t;this.storage.iterate(a-1,a+1,(r,n)=>(n===a-1?e=r:t=r,!0)),i=this.getMinimalBound(e,t)}n.extend(this.encodeBound(i)),n.extend(encodeVarInt(Mode.Fingerprint)),n.extend(c)}}}exceededFrameSizeLimit(e){return e>this.frameSizeLimit-200}decodeTimestampIn(e){let t=decodeVarInt(e);return t=0===t?Number.MAX_VALUE:t-1,this.lastTimestampIn===Number.MAX_VALUE||t===Number.MAX_VALUE?(this.lastTimestampIn=Number.MAX_VALUE,Number.MAX_VALUE):(t+=this.lastTimestampIn,this.lastTimestampIn=t,t)}decodeBound(e){let t=this.decodeTimestampIn(e),r=decodeVarInt(e);if(r>ID_SIZE)throw Error("bound key too long");return{timestamp:t,id:getBytes(e,r)}}encodeTimestampOut(e){if(e===Number.MAX_VALUE)return this.lastTimestampOut=Number.MAX_VALUE,encodeVarInt(0);let t=e;return e-=this.lastTimestampOut,this.lastTimestampOut=t,encodeVarInt(e+1)}encodeBound(e){let t=new WrappedBuffer;return t.extend(this.encodeTimestampOut(e.timestamp)),t.extend(encodeVarInt(e.id.length)),t.extend(e.id),t}getMinimalBound(e,t){if(t.timestamp!==e.timestamp)return this._bound(t.timestamp);{let r=0,n=t.id,i=e.id;for(let e=0;e<ID_SIZE&&n[e]===i[e];e++)r++;return this._bound(t.timestamp,t.id.subarray(0,r+1))}}};function compareUint8Array(e,t){for(let r=0;r<e.byteLength;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}function itemCompare(e,t){return e.timestamp===t.timestamp?compareUint8Array(e.id,t.id):e.timestamp-t.timestamp}var NegentropySync=class{relay;storage;neg;filter;subscription;onhave;onneed;constructor(e,t,r,n={}){this.relay=e,this.storage=t,this.neg=new Negentropy(t),this.onhave=n.onhave,this.onneed=n.onneed,this.filter=r,this.subscription=this.relay.prepareSubscription([{}],{label:n.label||"negentropy"}),this.subscription.oncustom=e=>{switch(e[0]){case"NEG-MSG":e.length<3&&console.warn(`got invalid NEG-MSG from ${this.relay.url}: ${e}`);try{const t=this.neg.reconcile(e[2],this.onhave,this.onneed);t?this.relay.send(`["NEG-MSG", "${this.subscription.id}", "${t}"]`):(this.close(),n.onclose?.())}catch(error){console.error("negentropy reconcile error:",error),n?.onclose?.(`reconcile error: ${error}`)}break;case"NEG-CLOSE":{const t=e[2];console.warn("negentropy error:",t),n.onclose?.(t);break}case"NEG-ERR":n.onclose?.()}}}async start(){const e=this.neg.initiate();this.relay.send(`["NEG-OPEN","${this.subscription.id}",${JSON.stringify(this.filter)},"${e}"]`)}close(){this.relay.send(`["NEG-CLOSE","${this.subscription.id}"]`),this.subscription.close()}},nip98_exports={};__export(nip98_exports,{getToken:()=>getToken,hashPayload:()=>hashPayload,unpackEventFromToken:()=>unpackEventFromToken,validateEvent:()=>validateEvent2,validateEventKind:()=>validateEventKind,validateEventMethodTag:()=>validateEventMethodTag,validateEventPayloadTag:()=>validateEventPayloadTag,validateEventTimestamp:()=>validateEventTimestamp,validateEventUrlTag:()=>validateEventUrlTag,validateToken:()=>validateToken});var _authorizationScheme="Nostr ";async function getToken(e,t,r,n=!1,i){const o={kind:HTTPAuth,tags:[["u",e],["method",t]],created_at:Math.round((new Date).getTime()/1e3),content:""};i&&o.tags.push(["payload",hashPayload(i)]);const s=await r(o);return(n?_authorizationScheme:"")+base64$1.encode(utf8Encoder$4.encode(JSON.stringify(s)))}async function validateToken(e,t,r){return await validateEvent2(await unpackEventFromToken(e).catch(e=>{throw e}),t,r).catch(e=>{throw e})}async function unpackEventFromToken(e){if(!e)throw new Error("Missing token");e=e.replace(_authorizationScheme,"");const t=utf8Decoder$3.decode(base64$1.decode(e));if(!t||0===t.length||!t.startsWith("{"))throw new Error("Invalid token");return JSON.parse(t)}function validateEventTimestamp(e){return!!e.created_at&&Math.round((new Date).getTime()/1e3)-e.created_at<60}function validateEventKind(e){return e.kind===HTTPAuth}function validateEventUrlTag(e,t){const r=e.tags.find(e=>"u"===e[0]);return!!r&&r.length>0&&r[1]===t}function validateEventMethodTag(e,t){const r=e.tags.find(e=>"method"===e[0]);return!!r&&r.length>0&&r[1].toLowerCase()===t.toLowerCase()}function hashPayload(e){return bytesToHex$2(sha256$1(utf8Encoder$4.encode(JSON.stringify(e))))}function validateEventPayloadTag(e,t){const r=e.tags.find(e=>"payload"===e[0]);if(!r)return!1;const n=hashPayload(t);return r.length>0&&r[1]===n}async function validateEvent2(e,t,r,n){if(!verifyEvent$1(e))throw new Error("Invalid nostr event, signature invalid");if(!validateEventKind(e))throw new Error("Invalid nostr event, kind invalid");if(!validateEventTimestamp(e))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!validateEventUrlTag(e,t))throw new Error("Invalid nostr event, url tag invalid");if(!validateEventMethodTag(e,r))throw new Error("Invalid nostr event, method tag invalid");if(Boolean(n)&&"object"==typeof n&&Object.keys(n).length>0&&!validateEventPayloadTag(e,n))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}var verifiedSymbol=Symbol("verified"),isRecord=e=>e instanceof Object;function validateEvent$1(e){if(!isRecord(e))return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.pubkey)return!1;if(!e.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let r=e.tags[t];if(!Array.isArray(r))return!1;for(let e=0;e<r.length;e++)if("string"!=typeof r[e])return!1}return!0}new TextDecoder("utf-8");var utf8Encoder$3=new TextEncoder,JS=class{generateSecretKey(){return schnorr.utils.randomPrivateKey()}getPublicKey(e){return bytesToHex$2(schnorr.getPublicKey(e))}finalizeEvent(e,t){const r=e;return r.pubkey=bytesToHex$2(schnorr.getPublicKey(t)),r.id=getEventHash(r),r.sig=bytesToHex$2(schnorr.sign(getEventHash(r),t)),r[verifiedSymbol]=!0,r}verifyEvent(e){if("boolean"==typeof e[verifiedSymbol])return e[verifiedSymbol];const t=getEventHash(e);if(t!==e.id)return e[verifiedSymbol]=!1,!1;try{const r=schnorr.verify(e.sig,t,e.pubkey);return e[verifiedSymbol]=r,r}catch(err){return e[verifiedSymbol]=!1,!1}}};function serializeEvent(e){if(!validateEvent$1(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function getEventHash(e){return bytesToHex$2(sha256$1(utf8Encoder$3.encode(serializeEvent(e))))}var i=new JS,generateSecretKey=i.generateSecretKey,getPublicKey=i.getPublicKey,finalizeEvent=i.finalizeEvent,verifyEvent=i.verifyEvent;function getOrComputeCachedValue(e,t,r){if(Reflect.has(e,t))return Reflect.get(e,t);{const n=r();return Reflect.set(e,t,n),n}}var utf8Decoder$2=new TextDecoder("utf-8"),utf8Encoder$2=new TextEncoder;function insertEventIntoDescendingList(e,t){const[r,n]=binarySearch$2(e,e=>t.id===e.id?0:t.created_at===e.created_at?-1:e.created_at-t.created_at);return n||e.splice(r,0,t),e}function binarySearch$2(e,t){let r=0,n=e.length-1;for(;r<=n;){const i=Math.floor((r+n)/2),o=t(e[i]);if(0===o)return[i,!0];o<0?n=i-1:r=i+1}return[r,!1]}var EventStoreSymbol=Symbol.for("event-store"),EventUIDSymbol$1=Symbol.for("event-uid"),ReplaceableAddressSymbol=Symbol.for("replaceable-address"),FromCacheSymbol=Symbol.for("from-cache"),ReplaceableIdentifierSymbol=Symbol.for("replaceable-identifier");function isEvent(e){return null!=e&&64===e.id?.length&&"string"==typeof e.sig&&"string"==typeof e.pubkey&&64===e.pubkey.length&&"string"==typeof e.content&&Array.isArray(e.tags)&&"number"==typeof e.created_at&&e.created_at>0}function isReplaceable(e){return isReplaceableKind$2(e)||isAddressableKind$2(e)}function getEventUID$1(e){let t=Reflect.get(e,EventUIDSymbol$1);return t||(t=isReplaceable(e.kind)?getReplaceableAddress(e)??e.id:e.id,Reflect.set(e,EventUIDSymbol$1,t)),t}function getReplaceableAddress(e){return isReplaceable(e.kind)?getOrComputeCachedValue(e,ReplaceableAddressSymbol,()=>createReplaceableAddress(e.kind,e.pubkey,getReplaceableIdentifier(e))):null}function createReplaceableAddress(e,t,r){return e+":"+t+":"+(r??"")}function isFromCache(e){return!0===Reflect.get(e,FromCacheSymbol)}function getParentEventStore(e){return Reflect.get(e,EventStoreSymbol)}function notifyEventUpdate(e){if(!isEvent(e))return;const t=getParentEventStore(e);t&&t.update(e)}function getReplaceableIdentifier(e){return getOrComputeCachedValue(e,ReplaceableIdentifierSymbol,()=>e.tags.find(e=>"d"===e[0])?.[1]??"")}var EncryptedContentSymbol=Symbol.for("encrypted-content"),EventContentEncryptionMethod={[kinds_exports.EncryptedDirectMessage]:"nip04",[kinds_exports.Seal]:"nip44",[kinds_exports.GiftWrap]:"nip44"};function setEncryptedContentEncryptionMethod(e,t){return EventContentEncryptionMethod[e]=t,e}function getEncryptedContentEncryptionMethods(e,t,r){const n=r??EventContentEncryptionMethod[e];if(!n)throw new Error(`Event kind ${e} does not support encrypted content`);const i=t[n];if(!i)throw new Error(`Signer does not support ${n} encryption`);return i}function canHaveEncryptedContent(e){return void 0!==EventContentEncryptionMethod[e]}function hasEncryptedContent(e){return e.content.length>0}function getEncryptedContent(e){return Reflect.get(e,EncryptedContentSymbol)}function isEncryptedContentUnlocked(e){return!0===Reflect.has(e,EncryptedContentSymbol)}function setEncryptedContentCache(e,t){Reflect.set(e,EncryptedContentSymbol,t),notifyEventUpdate(e)}var PRESERVE_EVENT_SYMBOLS=new Set([EncryptedContentSymbol]);function identity$2(e){return e}function eventPipe(...e){return pipeFromAsyncArray(e.filter(e=>!!e),PRESERVE_EVENT_SYMBOLS)}function tagPipe(...e){return pipeFromAsyncArray(e.filter(e=>!!e))}function skip(){return e=>e}function pipeFromAsyncArray(e,t){return 0===e.length?identity$2:async function(r){return e.reduce(async(e,r)=>{const n=await r(await e);if(t&&"object"==typeof n&&null!==n&&"object"==typeof e&&null!==e){const e=Reflect.ownKeys(n).filter(e=>"symbol"==typeof e);for(const r of e)t.has(r)||Reflect.deleteProperty(n,r)}return n},r)}}function unixNow(){return Math.round(Date.now()/1e3)}function setEncryptedContent(e,t,r,n){return async i=>{if(!r)throw new Error("Signer required for encrypted content");const o=await getEncryptedContentEncryptionMethods(i.kind,r,n).encrypt(e,t);return{...i,content:o,[EncryptedContentSymbol]:t}}}var urlAlphabet="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",nanoid$1=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=urlAlphabet[63&r[e]];return t};function isNameValueTag(e,t){return void 0!==e[0]&&void 0!==e[1]&&(!t||e[0]===t)}function isETag(e){return isNameValueTag(e,"e")}function isPTag(e){return isNameValueTag(e,"p")}function isRTag(e){return isNameValueTag(e,"r")}function isATag(e){return isNameValueTag(e,"a")}var processTags=(e,...t)=>t.reduce((e,t)=>{const r=[];for(const n of e)try{const e=t(n);if(void 0===e)continue;r.push(e)}catch(error){}return r},e);function ensureSingletonTag(e,t,r=!0){const n=e.find(e=>e[0]===t[0]);return n?r?e.map(e=>e===n?t:e):e:[...e,t]}var utf8Decoder$1=new TextDecoder("utf-8"),utf8Encoder$1=new TextEncoder,Bech32MaxSize=5e3;function decode(e){let{prefix:t,words:r}=bech32$1.decode(e,Bech32MaxSize),n=new Uint8Array(bech32$1.fromWords(r));switch(t){case"nprofile":{let e=parseTLV(n);if(!e[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:bytesToHex$2(e[0][0]),relays:e[1]?e[1].map(e=>utf8Decoder$1.decode(e)):[]}}}case"nevent":{let e=parseTLV(n);if(!e[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(e[2]&&32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(e[3]&&4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:bytesToHex$2(e[0][0]),relays:e[1]?e[1].map(e=>utf8Decoder$1.decode(e)):[],author:e[2]?.[0]?bytesToHex$2(e[2][0]):void 0,kind:e[3]?.[0]?parseInt(bytesToHex$2(e[3][0]),16):void 0}}}case"naddr":{let e=parseTLV(n);if(!e[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!e[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!e[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:utf8Decoder$1.decode(e[0][0]),pubkey:bytesToHex$2(e[2][0]),kind:parseInt(bytesToHex$2(e[3][0]),16),relays:e[1]?e[1].map(e=>utf8Decoder$1.decode(e)):[]}}}case"nsec":return{type:t,data:n};case"npub":case"note":return{type:t,data:bytesToHex$2(n)};default:throw new Error(`unknown prefix ${t}`)}}function parseTLV(e){let t={},r=e;for(;r.length>0;){let e=r[0],n=r[1],i=r.slice(2,2+n);if(r=r.slice(2+n),i.length<n)throw new Error(`not enough data to read on TLV ${e}`);t[e]=t[e]||[],t[e].push(i)}return t}function npubEncode(e){return encodeBytes("npub",hexToBytes$2(e))}function encodeBech32(e,t){let r=bech32$1.toWords(t);return bech32$1.encode(e,r,Bech32MaxSize)}function encodeBytes(e,t){return encodeBech32(e,t)}function ensureProtocol(e,t="https:"){return/^[a-zA-Z][a-zA-Z0-9+.-]+:/.test(e)?e:t+"//"+e}function ensureWebSocketURL(e){const t="string"==typeof e?new URL(ensureProtocol(e,"wss:")):new URL(e);return"http:"===t.protocol?t.protocol="ws:":("https:"===t.protocol||"ws:"!==t.protocol)&&(t.protocol="wss:"),"string"==typeof e?t.toString():t}function ensureHttpURL(e){const t="string"==typeof e?new URL(ensureProtocol(e,"http:")):new URL(e);return"ws:"===t.protocol?t.protocol="http:":("wss:"===t.protocol||"http:"!==t.protocol)&&(t.protocol="https:"),"string"==typeof e?t.toString():t}function normalizeURL(e){let t=new URL(e);return t.pathname=t.pathname.replace(/\/+/g,"/"),("80"!==t.port||"ws:"!==t.protocol&&"http:"!==t.protocol)&&("443"!==t.port||"wss:"!==t.protocol&&"https:"!==t.protocol)||(t.port=""),"string"==typeof e?t.toString():t}var SeenRelaysSymbol=Symbol.for("seen-relays");function normalizeRelayUrl$1(e){return normalizeURL(ensureWebSocketURL(e))}function addSeenRelay(e,t){let r=Reflect.get(e,SeenRelaysSymbol);return r?(r.add(t),r):(r=new Set([t]),Reflect.set(e,SeenRelaysSymbol,r),r)}function getSeenRelays(e){return Reflect.get(e,SeenRelaysSymbol)}var WEBSOCKET_URL_CHECK=/^wss?:\/\/([-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}|localhost)\b([-a-zA-Z0-9()@:%_\+.~#?&\/\/=]*)$/;function isSafeRelayURL(e){return e.length>=8&&WEBSOCKET_URL_CHECK.test(e)}function mergeRelaySets(...e){const t=new Set;for(const r of e)if(r)if("string"==typeof r)try{t.add(normalizeRelayUrl$1(r))}catch(error){}else if(Reflect.has(r,Symbol.iterator))for(const e of r)try{t.add(normalizeRelayUrl$1(e))}catch(error){}return Array.from(t)}var relaySet=mergeRelaySets;function isHex(e){return!!e&&!!e.match(/^[0-9a-f]+$/i)}function isHexKey(e){return!!e&&64===e.length&&!!e.toLowerCase().match(/^[0-9a-f]{64}$/)}function safeDecode(e){try{return decode(e)}catch{return null}}function decodeProfilePointer(e){const t=safeDecode(e);if(!t)return null;const r=getPubkeyFromDecodeResult(t);return r?{pubkey:r,relays:getRelaysFromDecodeResult(t)}:null}function parseReplaceableAddress(e,t=!1){const r=e.split(":"),n=r[0]?parseInt(r[0]):void 0,i=r[1];if(void 0===n)return null;if(void 0===i||""===i||!isHexKey(i))return null;const o=r.slice(2).join(":");return t&&""===o?null:{kind:n,pubkey:i,identifier:o}}function getPubkeyFromDecodeResult(e){if(e)switch(e.type){case"naddr":case"nprofile":return e.data.pubkey;case"npub":return e.data;case"nsec":return getPublicKey(e.data);default:return}}function getRelaysFromDecodeResult(e){if(e)switch(e.type){case"naddr":case"nprofile":case"nevent":return e.data.relays}}function getEventPointerFromETag(e){const t=e[1];if(!t||!isHexKey(t))return null;const r={id:t};return e[2]&&isSafeRelayURL(e[2])&&(r.relays=[normalizeURL(e[2])]),r}function getAddressPointerFromATag(e){if(!e[1])return null;const t=parseReplaceableAddress(e[1]);return t?(e[2]&&isSafeRelayURL(e[2])&&(t.relays=[normalizeURL(e[2])]),t):null}function getProfilePointerFromPTag(e){const t=e[1];if(!t||!isHexKey(t))return null;const r={pubkey:t};return e[2]&&isSafeRelayURL(e[2])&&(r.relays=[normalizeURL(e[2])]),r}function isAddressPointer(e){return"object"==typeof e&&null!==e&&"identifier"in e&&"pubkey"in e&&"kind"in e&&"string"==typeof e.identifier&&"string"==typeof e.pubkey&&"number"==typeof e.kind}function isEventPointer(e){return"object"==typeof e&&null!==e&&"id"in e&&"string"==typeof e.id}function addRelayHintsToPointer(e,t){return t?{...e,relays:relaySet(t,e.relays)}:e}function eventMatchesPointer(e,t){return isEventPointer(t)?e.id===t.id&&(!t.author||e.pubkey===t.author):e.kind===t.kind&&e.pubkey===t.pubkey&&getReplaceableIdentifier(e)===(t.identifier??"")}var HiddenContentSymbol=EncryptedContentSymbol,getHiddenContentEncryptionMethods=getEncryptedContentEncryptionMethods,HiddenContentKinds=new Set([setEncryptedContentEncryptionMethod(kinds_exports.DraftLong,"nip04")]);function setHiddenContentEncryptionMethod(e,t){return HiddenContentKinds.add(setEncryptedContentEncryptionMethod(e,t)),e}function canHaveHiddenContent(e){return canHaveEncryptedContent(e)&&HiddenContentKinds.has(e)}function hasHiddenContent(e){return canHaveHiddenContent(e.kind)&&hasEncryptedContent(e)}function isHiddenContentUnlocked(e){return!!canHaveHiddenContent(e.kind)&&isEncryptedContentUnlocked(e)&&!0===Reflect.has(e,HiddenContentSymbol)}function getHiddenContent(e){if(canHaveHiddenContent(e.kind))return HiddenContentSymbol in e?Reflect.get(e,HiddenContentSymbol):getEncryptedContent(e)}async function unlockHiddenContent(e,t,r){if(!canHaveHiddenContent(e.kind))throw new Error("Event kind does not support hidden content");if(HiddenContentSymbol in e)return Reflect.get(e,HiddenContentSymbol);const n=await getEncryptedContentEncryptionMethods(e.kind,t,r).decrypt(e.pubkey,e.content);return setHiddenContentCache(e,n),n}function setHiddenContentCache(e,t){if(!canHaveHiddenContent(e.kind))throw new Error("Event kind does not support hidden content");setEncryptedContentCache(e,t)}var GROUPS_LIST_KIND=10009,HiddenTagsSymbol=Symbol.for("hidden-tags"),HiddenTagsKinds=new Set([setHiddenContentEncryptionMethod(kinds_exports.BookmarkList,"nip04"),setHiddenContentEncryptionMethod(kinds_exports.InterestsList,"nip04"),setHiddenContentEncryptionMethod(kinds_exports.Mutelist,"nip04"),setHiddenContentEncryptionMethod(kinds_exports.CommunitiesList,"nip04"),setHiddenContentEncryptionMethod(kinds_exports.PublicChatsList,"nip04"),setHiddenContentEncryptionMethod(kinds_exports.SearchRelaysList,"nip04"),setHiddenContentEncryptionMethod(GROUPS_LIST_KIND,"nip04"),setHiddenContentEncryptionMethod(kinds_exports.Bookmarksets,"nip04"),setHiddenContentEncryptionMethod(kinds_exports.Relaysets,"nip04"),setHiddenContentEncryptionMethod(kinds_exports.Followsets,"nip04"),setHiddenContentEncryptionMethod(kinds_exports.Curationsets,"nip04"),setHiddenContentEncryptionMethod(kinds_exports.Interestsets,"nip04")]);function canHaveHiddenTags(e){return canHaveHiddenContent(e)&&HiddenTagsKinds.has(e)}function hasHiddenTags(e){return canHaveHiddenTags(e.kind)&&hasHiddenContent(e)}function getHiddenTagsEncryptionMethods(e,t){return getHiddenContentEncryptionMethods(e,t)}function isHiddenTagsUnlocked(e){if(!canHaveHiddenTags(e.kind))return!1;try{return HiddenTagsSymbol in e||isHiddenContentUnlocked(e)&&void 0!==getHiddenTags(e)}catch{}return!1}function getHiddenTags(e){if(!canHaveHiddenTags(e.kind))return;if(HiddenTagsSymbol in e)return e[HiddenTagsSymbol];const t=getHiddenContent(e);if(void 0===t)return;const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("Content is not an array of tags");const n=r.filter(e=>Array.isArray(e)).map(e=>e.map(e=>String(e)));return Reflect.set(e,HiddenTagsSymbol,n),n}async function unlockHiddenTags(e,t,r){if(!canHaveHiddenTags(e.kind))throw new Error("Event kind does not support hidden tags");if(isHiddenTagsUnlocked(e))return e[HiddenTagsSymbol];await unlockHiddenContent(e,t,r);const n=getHiddenTags(e);if(void 0===n)throw new Error("Failed to unlock hidden tags");return setHiddenTagsCache(e,n),n}function setHiddenTagsCache(e,t){if(!canHaveHiddenTags(e.kind))throw new Error("Event kind does not support hidden tags");Reflect.set(e,HiddenTagsSymbol,t),setHiddenContentCache(e,JSON.stringify(t))}var PublicContactsSymbol=Symbol.for("public-contacts"),HiddenContactsSymbol=Symbol.for("hidden-contacts");function mergeContacts(...e){const t=new Map;for(const r of e)if(Array.isArray(r))for(const e of r)e&&t.set(e.pubkey,e);else r&&t.set(r.pubkey,r);return Array.from(t.values())}function getContacts(e){return mergeContacts(getPublicContacts(e),getHiddenContacts(e))}function getPublicContacts(e){return getOrComputeCachedValue(e,PublicContactsSymbol,()=>processTags(e.tags,e=>isPTag(e)?e:void 0,e=>getProfilePointerFromPTag(e)??void 0))}function getHiddenContacts(e){if(HiddenContactsSymbol in e)return e[HiddenContactsSymbol];const t=getHiddenTags(e);if(!t)return;const r=processTags(t,e=>isPTag(e)?e:void 0,e=>getProfilePointerFromPTag(e)??void 0);return Reflect.set(e,HiddenContactsSymbol,r),r}function getDeleteEventPointers(e){return e.tags.filter(isETag).map(getEventPointerFromETag).filter(e=>null!==e).map(t=>(t.author=e.pubkey,t))}function getDeleteAddressPointers(e){return e.tags.filter(isATag).map(getAddressPointerFromATag).filter(e=>null!==e).filter(t=>t.pubkey===e.pubkey)}var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)};function __awaiter(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(t){o(t)}}function a(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}function __generator(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(l){a=[6,l],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(error){i={error:error}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function __spreadArray(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function __await(e){return this instanceof __await?(this.v=e,this):new __await(e)}function __asyncGenerator(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){i[e]&&(n[e]=function(t){return new Promise(function(r,n){o.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{(r=i[e](t)).value instanceof __await?Promise.resolve(r.value.v).then(l,c):u(o[0][2],r)}catch(n){u(o[0][3],n)}var r}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function __asyncValues(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){!function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}(n,i,(t=e[r](t)).done,t.value)})}}}function isFunction$1(e){return"function"==typeof e}function createErrorClass(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var UnsubscriptionError=createErrorClass(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function arrRemove(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Subscription=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=__values(o),a=s.next();!a.done;a=s.next())a.value.remove(this)}catch(p){e={error:p}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var l=this.initialTeardown;if(isFunction$1(l))try{l()}catch(f){i=f instanceof UnsubscriptionError?f.errors:[f]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=__values(c),h=u.next();!h.done;h=u.next()){var d=h.value;try{execFinalizer(d)}catch(err){i=null!=i?i:[],err instanceof UnsubscriptionError?i=__spreadArray(__spreadArray([],__read(i)),__read(err.errors)):i.push(err)}}}catch(g){r={error:g}}finally{try{h&&!h.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}if(i)throw new UnsubscriptionError(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)execFinalizer(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&arrRemove(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&arrRemove(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),EMPTY_SUBSCRIPTION=Subscription.EMPTY;function isSubscription(e){return e instanceof Subscription||e&&"closed"in e&&isFunction$1(e.remove)&&isFunction$1(e.add)&&isFunction$1(e.unsubscribe)}function execFinalizer(e){isFunction$1(e)?e():e.unsubscribe()}var config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},timeoutProvider={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=timeoutProvider.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,__spreadArray([e,t],__read(r))):setTimeout.apply(void 0,__spreadArray([e,t],__read(r)))},clearTimeout:function(e){var t=timeoutProvider.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function reportUnhandledError(e){timeoutProvider.setTimeout(function(){var t=config.onUnhandledError;if(!t)throw e;t(e)})}function noop(){}var COMPLETE_NOTIFICATION=createNotification("C",void 0,void 0);function errorNotification(e){return createNotification("E",void 0,e)}function nextNotification(e){return createNotification("N",e,void 0)}function createNotification(e,t,r){return{kind:e,value:t,error:r}}var context=null;function errorContext(e){if(config.useDeprecatedSynchronousErrorHandling){var t=!context;if(t&&(context={errorThrown:!1,error:null}),e(),t){var r=context,n=r.errorThrown,i=r.error;if(context=null,n)throw i}}else e()}function captureError(e){config.useDeprecatedSynchronousErrorHandling&&context&&(context.errorThrown=!0,context.error=e)}var Subscriber=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,isSubscription(t)&&t.add(r)):r.destination=EMPTY_OBSERVER,r}return __extends(t,e),t.create=function(e,t,r){return new SafeSubscriber(e,t,r)},t.prototype.next=function(e){this.isStopped?handleStoppedNotification(nextNotification(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?handleStoppedNotification(errorNotification(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?handleStoppedNotification(COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Subscription),_bind=Function.prototype.bind;function bind(e,t){return _bind.call(e,t)}var ConsumerObserver=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(error){handleUnhandledError(error)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(error){handleUnhandledError(error)}else handleUnhandledError(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(error){handleUnhandledError(error)}},e}(),SafeSubscriber=function(e){function t(t,r,n){var i,o,s=e.call(this)||this;return isFunction$1(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&config.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&bind(t.next,o),error:t.error&&bind(t.error,o),complete:t.complete&&bind(t.complete,o)}):i=t,s.destination=new ConsumerObserver(i),s}return __extends(t,e),t}(Subscriber);function handleUnhandledError(e){config.useDeprecatedSynchronousErrorHandling?captureError(e):reportUnhandledError(e)}function defaultErrorHandler(e){throw e}function handleStoppedNotification(e,t){var r=config.onStoppedNotification;r&&timeoutProvider.setTimeout(function(){return r(e,t)})}var EMPTY_OBSERVER={closed:!0,next:noop,error:defaultErrorHandler,complete:noop},observable="function"==typeof Symbol&&Symbol.observable||"@@observable";function identity$1(e){return e}function pipe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return pipeFromArray(e)}function pipeFromArray(e){return 0===e.length?identity$1:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var Observable$1=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n=this,i=isSubscriber(e)?e:new SafeSubscriber(e,t,r);return errorContext(function(){var e=n,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?n._subscribe(i):n._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(err){e.error(err)}},e.prototype.forEach=function(e,t){var r=this;return new(t=getPromiseCtor(t))(function(t,n){var i=new SafeSubscriber({next:function(t){try{e(t)}catch(err){n(err),i.unsubscribe()}},error:n,complete:t});r.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[observable]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return pipeFromArray(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=getPromiseCtor(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function getPromiseCtor(e){var t;return null!==(t=null!=e?e:config.Promise)&&void 0!==t?t:Promise}function isObserver(e){return e&&isFunction$1(e.next)&&isFunction$1(e.error)&&isFunction$1(e.complete)}function isSubscriber(e){return e&&e instanceof Subscriber||isObserver(e)&&isSubscription(e)}function hasLift(e){return isFunction$1(null==e?void 0:e.lift)}function operate(e){return function(t){if(hasLift(t))return t.lift(function(t){try{return e(t,this)}catch(err){this.error(err)}});throw new TypeError("Unable to lift unknown Observable type")}}function createOperatorSubscriber(e,t,r,n,i){return new OperatorSubscriber(e,t,r,n,i)}var OperatorSubscriber=function(e){function t(t,r,n,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=r?function(e){try{r(e)}catch(err){t.error(err)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(err){t.error(err)}finally{this.unsubscribe()}}:e.prototype._complete,a}return __extends(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(Subscriber),ObjectUnsubscribedError=createErrorClass(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Subject=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return __extends(t,e),t.prototype.lift=function(e){var t=new AnonymousSubject(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new ObjectUnsubscribedError},t.prototype.next=function(e){var t=this;errorContext(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=__values(t.currentObservers),o=i.next();!o.done;o=i.next())o.value.next(e)}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var t=this;errorContext(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;errorContext(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,i=r.isStopped,o=r.observers;return n||i?EMPTY_SUBSCRIPTION:(this.currentObservers=null,o.push(e),new Subscription(function(){t.currentObservers=null,arrRemove(o,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new Observable$1;return e.source=this,e},t.create=function(e,t){return new AnonymousSubject(e,t)},t}(Observable$1),AnonymousSubject=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return __extends(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:EMPTY_SUBSCRIPTION},t}(Subject),BehaviorSubject=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return __extends(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(Subject),dateTimestampProvider={now:function(){return(dateTimestampProvider.delegate||Date).now()},delegate:void 0},ReplaySubject=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=dateTimestampProvider);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,r),i}return __extends(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,i=r._buffer,o=r._infiniteTimeWindow,s=r._timestampProvider,a=r._windowTime;n||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!e.closed;i+=r?1:2)e.next(n[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<n.length&&n.splice(0,n.length-o),!i){for(var s=r.now(),a=0,l=1;l<n.length&&n[l]<=s;l+=2)a=l;a&&n.splice(0,a+1)}},t}(Subject),Action=function(e){function t(){return e.call(this)||this}return __extends(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(Subscription),intervalProvider={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=intervalProvider.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,__spreadArray([e,t],__read(r))):setInterval.apply(void 0,__spreadArray([e,t],__read(r)))},clearInterval:function(e){var t=intervalProvider.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},AsyncAction=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return __extends(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,i=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(i,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),intervalProvider.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&intervalProvider.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e){var t,r=!1;try{this.work(e)}catch(n){r=!0,t=n||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),t},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,arrRemove(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Action),Scheduler$1=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=dateTimestampProvider.now,e}(),AsyncScheduler=function(e){function t(t,r){void 0===r&&(r=Scheduler$1.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return __extends(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(Scheduler$1),asyncScheduler=new AsyncScheduler(AsyncAction),async=asyncScheduler,EMPTY=new Observable$1(function(e){return e.complete()});function isScheduler(e){return e&&isFunction$1(e.schedule)}function last(e){return e[e.length-1]}function popResultSelector(e){return isFunction$1(last(e))?e.pop():void 0}function popScheduler(e){return isScheduler(last(e))?e.pop():void 0}function popNumber(e,t){return"number"==typeof last(e)?e.pop():t}var isArrayLike=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function isPromise(e){return isFunction$1(null==e?void 0:e.then)}function isInteropObservable(e){return isFunction$1(e[observable])}function isAsyncIterable(e){return Symbol.asyncIterator&&isFunction$1(null==e?void 0:e[Symbol.asyncIterator])}function createInvalidObservableTypeError(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function getSymbolIterator(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var iterator=getSymbolIterator();function isIterable(e){return isFunction$1(null==e?void 0:e[iterator])}function readableStreamLikeToAsyncGenerator(e){return __asyncGenerator(this,arguments,function(){var t,r,n;return __generator(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,__await(t.read())];case 3:return r=i.sent(),n=r.value,r.done?[4,__await(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,__await(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function isReadableStreamLike(e){return isFunction$1(null==e?void 0:e.getReader)}function innerFrom(e){if(e instanceof Observable$1)return e;if(null!=e){if(isInteropObservable(e))return fromInteropObservable(e);if(isArrayLike(e))return fromArrayLike(e);if(isPromise(e))return fromPromise(e);if(isAsyncIterable(e))return fromAsyncIterable(e);if(isIterable(e))return fromIterable(e);if(isReadableStreamLike(e))return fromReadableStreamLike(e)}throw createInvalidObservableTypeError(e)}function fromInteropObservable(e){return new Observable$1(function(t){var r=e[observable]();if(isFunction$1(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function fromArrayLike(e){return new Observable$1(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function fromPromise(e){return new Observable$1(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,reportUnhandledError)})}function fromIterable(e){return new Observable$1(function(t){var r,n;try{for(var i=__values(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()})}function fromAsyncIterable(e){return new Observable$1(function(t){process$1(e,t).catch(function(e){return t.error(e)})})}function fromReadableStreamLike(e){return fromAsyncIterable(readableStreamLikeToAsyncGenerator(e))}function process$1(e,t){var r,n,i,o;return __awaiter(this,void 0,void 0,function(){var s,a;return __generator(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),r=__asyncValues(e),l.label=1;case 1:return[4,r.next()];case 2:if((n=l.sent()).done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),i={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function executeSchedule(e,t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}function observeOn(e,t){return void 0===t&&(t=0),operate(function(r,n){r.subscribe(createOperatorSubscriber(n,function(r){return executeSchedule(n,e,function(){return n.next(r)},t)},function(){return executeSchedule(n,e,function(){return n.complete()},t)},function(r){return executeSchedule(n,e,function(){return n.error(r)},t)}))})}function subscribeOn(e,t){return void 0===t&&(t=0),operate(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function scheduleObservable(e,t){return innerFrom(e).pipe(subscribeOn(t),observeOn(t))}function schedulePromise(e,t){return innerFrom(e).pipe(subscribeOn(t),observeOn(t))}function scheduleArray(e,t){return new Observable$1(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}function scheduleIterable(e,t){return new Observable$1(function(r){var n;return executeSchedule(r,t,function(){n=e[iterator](),executeSchedule(r,t,function(){var e,t,i;try{t=(e=n.next()).value,i=e.done}catch(err){return void r.error(err)}i?r.complete():r.next(t)},0,!0)}),function(){return isFunction$1(null==n?void 0:n.return)&&n.return()}})}function scheduleAsyncIterable(e,t){if(!e)throw new Error("Iterable cannot be null");return new Observable$1(function(r){executeSchedule(r,t,function(){var n=e[Symbol.asyncIterator]();executeSchedule(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function scheduleReadableStreamLike(e,t){return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(e),t)}function scheduled(e,t){if(null!=e){if(isInteropObservable(e))return scheduleObservable(e,t);if(isArrayLike(e))return scheduleArray(e,t);if(isPromise(e))return schedulePromise(e,t);if(isAsyncIterable(e))return scheduleAsyncIterable(e,t);if(isIterable(e))return scheduleIterable(e,t);if(isReadableStreamLike(e))return scheduleReadableStreamLike(e,t)}throw createInvalidObservableTypeError(e)}function from(e,t){return t?scheduled(e,t):innerFrom(e)}function of(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return from(e,popScheduler(e))}function throwError(e,t){var r=isFunction$1(e)?e:function(){return e},n=function(e){return e.error(r())};return new Observable$1(t?function(e){return t.schedule(n,0,e)}:n)}function isObservable(e){return!!e&&(e instanceof Observable$1||isFunction$1(e.lift)&&isFunction$1(e.subscribe))}var EmptyError=createErrorClass(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function lastValueFrom(e,t){var r="object"==typeof t;return new Promise(function(n,i){var o,s=!1;e.subscribe({next:function(e){o=e,s=!0},error:i,complete:function(){s?n(o):r?n(t.defaultValue):i(new EmptyError)}})})}function firstValueFrom(e,t){var r="object"==typeof t;return new Promise(function(n,i){var o=new SafeSubscriber({next:function(e){n(e),o.unsubscribe()},error:i,complete:function(){r?n(t.defaultValue):i(new EmptyError)}});e.subscribe(o)})}function isValidDate(e){return e instanceof Date&&!isNaN(e)}var TimeoutError$1=createErrorClass(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function timeout$1(e,t){var r=isValidDate(e)?{first:e}:"number"==typeof e?{each:e}:e,n=r.first,i=r.each,o=r.with,s=void 0===o?timeoutErrorFactory:o,a=r.scheduler,l=void 0===a?null!=t?t:asyncScheduler:a,c=r.meta,u=void 0===c?null:c;if(null==n&&null==i)throw new TypeError("No timeout provided.");return operate(function(e,t){var r,o,a=null,c=0,h=function(e){o=executeSchedule(t,l,function(){try{r.unsubscribe(),innerFrom(s({meta:u,lastValue:a,seen:c})).subscribe(t)}catch(err){t.error(err)}},e)};r=e.subscribe(createOperatorSubscriber(t,function(e){null==o||o.unsubscribe(),c++,t.next(a=e),i>0&&h(i)},void 0,void 0,function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),a=null})),!c&&h(null!=n?"number"==typeof n?n:+n-l.now():i)})}function timeoutErrorFactory(e){throw new TimeoutError$1(e)}function map(e,t){return operate(function(r,n){var i=0;r.subscribe(createOperatorSubscriber(n,function(r){n.next(e.call(t,r,i++))}))})}var isArray$2=Array.isArray;function callOrApply(e,t){return isArray$2(t)?e.apply(void 0,__spreadArray([],__read(t))):e(t)}function mapOneOrManyArgs(e){return map(function(t){return callOrApply(e,t)})}var isArray$1=Array.isArray,getPrototypeOf=Object.getPrototypeOf,objectProto=Object.prototype,getKeys=Object.keys;function argsArgArrayOrObject(e){if(1===e.length){var t=e[0];if(isArray$1(t))return{args:t,keys:null};if(isPOJO(t)){var r=getKeys(t);return{args:r.map(function(e){return t[e]}),keys:r}}}return{args:e,keys:null}}function isPOJO(e){return e&&"object"==typeof e&&getPrototypeOf(e)===objectProto}function createObject(e,t){return e.reduce(function(e,r,n){return e[r]=t[n],e},{})}function combineLatest$1(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=popScheduler(e),n=popResultSelector(e),i=argsArgArrayOrObject(e),o=i.args,s=i.keys;if(0===o.length)return from([],r);var a=new Observable$1(combineLatestInit(o,r,s?function(e){return createObject(s,e)}:identity$1));return n?a.pipe(mapOneOrManyArgs(n)):a}function combineLatestInit(e,t,r){return void 0===r&&(r=identity$1),function(n){maybeSchedule(t,function(){for(var i=e.length,o=new Array(i),s=i,a=i,l=function(i){maybeSchedule(t,function(){var l=from(e[i],t),c=!1;l.subscribe(createOperatorSubscriber(n,function(e){o[i]=e,c||(c=!0,a--),a||n.next(r(o.slice()))},function(){--s||n.complete()}))},n)},c=0;c<i;c++)l(c)},n)}}function maybeSchedule(e,t,r){e?executeSchedule(r,e,t):t()}function mergeInternals(e,t,r,n,i,o,s,a){var l=[],c=0,u=0,h=!1,d=function(){!h||l.length||c||t.complete()},p=function(e){return c<n?f(e):l.push(e)},f=function(e){o&&t.next(e),c++;var a=!1;innerFrom(r(e,u++)).subscribe(createOperatorSubscriber(t,function(e){null==i||i(e),o?p(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{c--;for(var e=function(){var e=l.shift();s?executeSchedule(t,s,function(){return f(e)}):f(e)};l.length&&c<n;)e();d()}catch(err){t.error(err)}}))};return e.subscribe(createOperatorSubscriber(t,p,function(){h=!0,d()})),function(){null==a||a()}}function mergeMap(e,t,r){return void 0===r&&(r=1/0),isFunction$1(t)?mergeMap(function(r,n){return map(function(e,i){return t(r,e,n,i)})(innerFrom(e(r,n)))},r):("number"==typeof t&&(r=t),operate(function(t,n){return mergeInternals(t,n,e,r)}))}function mergeAll(e){return void 0===e&&(e=1/0),mergeMap(identity$1,e)}function concatAll(){return mergeAll(1)}function concat(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return concatAll()(from(e,popScheduler(e)))}function defer(e){return new Observable$1(function(t){innerFrom(e()).subscribe(t)})}function timer(e,t,r){void 0===e&&(e=0),void 0===r&&(r=async);var n=-1;return null!=t&&(isScheduler(t)?r=t:n=t),new Observable$1(function(t){var i=isValidDate(e)?+e-r.now():e;i<0&&(i=0);var o=0;return r.schedule(function(){t.closed||(t.next(o++),0<=n?this.schedule(void 0,n):t.complete())},i)})}function merge$1(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=popScheduler(e),n=popNumber(e,1/0),i=e;return i.length?1===i.length?innerFrom(i[0]):mergeAll(n)(from(i,r)):EMPTY}var NEVER=new Observable$1(noop),isArray=Array.isArray;function argsOrArgArray(e){return 1===e.length&&isArray(e[0])?e[0]:e}function filter(e,t){return operate(function(r,n){var i=0;r.subscribe(createOperatorSubscriber(n,function(r){return e.call(t,r,i++)&&n.next(r)}))})}function bufferTime(e){for(var t,r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var o=null!==(t=popScheduler(n))&&void 0!==t?t:asyncScheduler,s=null!==(r=n[0])&&void 0!==r?r:null,a=n[1]||1/0;return operate(function(t,r){var n=[],i=!1,l=function(e){var t=e.buffer;e.subs.unsubscribe(),arrRemove(n,e),r.next(t),i&&c()},c=function(){if(n){var t=new Subscription;r.add(t);var i={buffer:[],subs:t};n.push(i),executeSchedule(t,o,function(){return l(i)},e)}};null!==s&&s>=0?executeSchedule(r,o,c,s,!0):i=!0,c();var u=createOperatorSubscriber(r,function(e){var t,r,i=n.slice();try{for(var o=__values(i),s=o.next();!s.done;s=o.next()){var c=s.value,u=c.buffer;u.push(e),a<=u.length&&l(c)}}catch(h){t={error:h}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},function(){for(;null==n?void 0:n.length;)r.next(n.shift().buffer);null==u||u.unsubscribe(),r.complete(),r.unsubscribe()},void 0,function(){return n=null});t.subscribe(u)})}function catchError(e){return operate(function(t,r){var n,i=null,o=!1;i=t.subscribe(createOperatorSubscriber(r,void 0,void 0,function(s){n=innerFrom(e(s,catchError(e)(t))),i?(i.unsubscribe(),i=null,n.subscribe(r)):o=!0})),o&&(i.unsubscribe(),i=null,n.subscribe(r))})}function scanInternals(e,t,r,n,i){return function(o,s){var a=r,l=t,c=0;o.subscribe(createOperatorSubscriber(s,function(t){var r=c++;l=a?e(l,t,r):(a=!0,t),n&&s.next(l)},i&&function(){a&&s.next(l),s.complete()}))}}function reduce(e,t){return operate(scanInternals(e,t,arguments.length>=2,!1,!0))}var arrReducer=function(e,t){return e.push(t),e};function toArray(){return operate(function(e,t){reduce(arrReducer,[])(e).subscribe(t)})}function combineLatest(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=popResultSelector(e);return r?pipe(combineLatest.apply(void 0,__spreadArray([],__read(e))),mapOneOrManyArgs(r)):operate(function(t,r){combineLatestInit(__spreadArray([t],__read(argsOrArgArray(e))))(r)})}function combineLatestWith(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return combineLatest.apply(void 0,__spreadArray([],__read(e)))}function fromSubscribable(e){return new Observable$1(function(t){return e.subscribe(t)})}var DEFAULT_CONFIG={connector:function(){return new Subject}};function connect(e,t){void 0===t&&(t=DEFAULT_CONFIG);var r=t.connector;return operate(function(t,n){var i=r();innerFrom(e(fromSubscribable(i))).subscribe(n),n.add(t.subscribe(i))})}function defaultIfEmpty(e){return operate(function(t,r){var n=!1;t.subscribe(createOperatorSubscriber(r,function(e){n=!0,r.next(e)},function(){n||r.next(e),r.complete()}))})}function take(e){return e<=0?function(){return EMPTY}:operate(function(t,r){var n=0;t.subscribe(createOperatorSubscriber(r,function(t){++n<=e&&(r.next(t),e<=n&&r.complete())}))})}function ignoreElements(){return operate(function(e,t){e.subscribe(createOperatorSubscriber(t,noop))})}function distinct(e,t){return operate(function(r,n){var i=new Set;r.subscribe(createOperatorSubscriber(n,function(t){var r=e?e(t):t;i.has(r)||(i.add(r),n.next(t))})),t&&innerFrom(t).subscribe(createOperatorSubscriber(n,function(){return i.clear()},noop))})}function distinctUntilChanged(e,t){return void 0===t&&(t=identity$1),e=null!=e?e:defaultCompare$2,operate(function(r,n){var i,o=!0;r.subscribe(createOperatorSubscriber(n,function(r){var s=t(r);!o&&e(i,s)||(o=!1,i=s,n.next(r))}))})}function defaultCompare$2(e,t){return e===t}function endWith(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return concat(t,of.apply(void 0,__spreadArray([],__read(e))))}}function finalize(e){return operate(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}function merge(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=popScheduler(e),n=popNumber(e,1/0);return operate(function(t,i){mergeAll(n)(from(__spreadArray([t],__read(e)),r)).subscribe(i)})}function mergeWith(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return merge.apply(void 0,__spreadArray([],__read(e)))}function repeat(e){var t,r,n=1/0;return null!=e&&("object"==typeof e?(t=e.count,n=void 0===t?1/0:t,r=e.delay):n=e),n<=0?function(){return EMPTY}:operate(function(e,t){var i,o=0,s=function(){if(null==i||i.unsubscribe(),i=null,null!=r){var e="number"==typeof r?timer(r):innerFrom(r(o)),n=createOperatorSubscriber(t,function(){n.unsubscribe(),a()});e.subscribe(n)}else a()},a=function(){var r=!1;i=e.subscribe(createOperatorSubscriber(t,void 0,function(){++o<n?i?s():r=!0:t.complete()})),r&&s()};a()})}function retry(e){var t;void 0===e&&(e=1/0);var r=(t=e&&"object"==typeof e?e:{count:e}).count,n=void 0===r?1/0:r,i=t.delay,o=t.resetOnSuccess,s=void 0!==o&&o;return n<=0?identity$1:operate(function(e,t){var r,o=0,a=function(){var l=!1;r=e.subscribe(createOperatorSubscriber(t,function(e){s&&(o=0),t.next(e)},void 0,function(e){if(o++<n){var s=function(){r?(r.unsubscribe(),r=null,a()):l=!0};if(null!=i){var c="number"==typeof i?timer(i):innerFrom(i(e,o)),u=createOperatorSubscriber(t,function(){u.unsubscribe(),s()},function(){t.complete()});c.subscribe(u)}else s()}else t.error(e)})),l&&(r.unsubscribe(),r=null,a())};a()})}function scan(e,t){return operate(scanInternals(e,t,arguments.length>=2,!0))}function share(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new Subject}:t,n=e.resetOnError,i=void 0===n||n,o=e.resetOnComplete,s=void 0===o||o,a=e.resetOnRefCountZero,l=void 0===a||a;return function(e){var t,n,o,a=0,c=!1,u=!1,h=function(){null==n||n.unsubscribe(),n=void 0},d=function(){h(),t=o=void 0,c=u=!1},p=function(){var e=t;d(),null==e||e.unsubscribe()};return operate(function(e,f){a++,u||c||h();var g=o=null!=o?o:r();f.add(function(){0!==--a||u||c||(n=handleReset(p,l))}),g.subscribe(f),!t&&a>0&&(t=new SafeSubscriber({next:function(e){return g.next(e)},error:function(e){u=!0,h(),n=handleReset(d,i,e),g.error(e)},complete:function(){c=!0,h(),n=handleReset(d,s),g.complete()}}),innerFrom(e).subscribe(t))})(e)}}function handleReset(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==t){if(!1!==t){var i=new SafeSubscriber({next:function(){i.unsubscribe(),e()}});return innerFrom(t.apply(void 0,__spreadArray([],__read(r)))).subscribe(i)}}else e()}function shareReplay(e,t,r){var n,i,o,s,a=!1;return e&&"object"==typeof e?(n=e.bufferSize,s=void 0===n?1/0:n,i=e.windowTime,t=void 0===i?1/0:i,a=void 0!==(o=e.refCount)&&o,r=e.scheduler):s=null!=e?e:1/0,share({connector:function(){return new ReplaySubject(s,t,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function startWith(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=popScheduler(e);return operate(function(t,n){(r?concat(e,t,r):concat(e,t)).subscribe(n)})}function switchMap(e,t){return operate(function(r,n){var i=null,o=0,s=!1,a=function(){return s&&!i&&n.complete()};r.subscribe(createOperatorSubscriber(n,function(r){null==i||i.unsubscribe();var s=0,l=o++;innerFrom(e(r,l)).subscribe(i=createOperatorSubscriber(n,function(e){return n.next(t?t(r,e,l,s++):e)},function(){i=null,a()}))},function(){s=!0,a()}))})}function takeUntil(e){return operate(function(t,r){innerFrom(e).subscribe(createOperatorSubscriber(r,function(){return r.complete()},noop)),!r.closed&&t.subscribe(r)})}function takeWhile(e,t){return void 0===t&&(t=!1),operate(function(r,n){var i=0;r.subscribe(createOperatorSubscriber(n,function(r){var o=e(r,i++);(o||t)&&n.next(r),!o&&n.complete()}))})}function tap(e,t,r){var n=isFunction$1(e)||t||r?{next:e,error:t,complete:r}:e;return n?operate(function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var i=!0;e.subscribe(createOperatorSubscriber(t,function(e){var r;null===(r=n.next)||void 0===r||r.call(n,e),t.next(e)},function(){var e;i=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()},function(e){var r;i=!1,null===(r=n.error)||void 0===r||r.call(n,e),t.error(e)},function(){var e,t;i&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)}))}):identity$1}var require_ms=__commonJSMin((e,t)=>{var r=1e3,n=60*r,i=60*n,o=24*i,s=7*o;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}t.exports=function(e,t){t=t||{};var l,c,u=typeof e;if("string"===u&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*s;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===u&&isFinite(e))return t.long?(l=e,(c=Math.abs(l))>=o?a(l,c,o,"day"):c>=i?a(l,c,i,"hour"):c>=n?a(l,c,n,"minute"):c>=r?a(l,c,r,"second"):l+" ms"):function(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=i?Math.round(e/i)+"h":t>=n?Math.round(e/n)+"m":t>=r?Math.round(e/r)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}),require_common=__commonJSMin((e,t)=>{t.exports=function(e){function t(e){let n,i,o,s=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date);r.diff=i-(n||i),r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,i)=>{if("%%"===n)return"%";o++;const s=t.formatters[i];if("function"==typeof s){const t=e[o];n=s.call(r,t),e.splice(o,1),o--}return n}),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e,t){let r=0,n=0,i=-1,o=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(i=n,o=r,n++):(r++,n++);else{if(-1===i)return!1;n=i+1,o++,r=o}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const n of r)"-"===n[0]?t.skips.push(n.slice(1)):t.names.push(n)},t.enabled=function(e){for(const r of t.skips)if(n(e,r))return!1;for(const r of t.names)if(n(e,r))return!0;return!1},t.humanize=require_ms(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}}),require_browser$1=__commonJSMin((e,t)=>{e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),e.splice(i,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(error){}},e.load=function(){let t;try{t=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch(error){}return!t&&"undefined"!=typeof process&&"env"in process&&(t={}.DEBUG),t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(error){}}(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=require_common()(e);var{formatters:r}=t.exports;r.j=function(e){try{return JSON.stringify(e)}catch(error){return"[UnexpectedJSONParseError]: "+error.message}}}),import_browser$1=__toESM(require_browser$1(),1),logger$1=(0,import_browser$1.default)("applesauce"),log$4=logger$1.extend("event-cache");function persistEventsToCache(e,t,r){const n=r?.batchTime??5e3,i=e.insert$.pipe(filter(e=>!isFromCache(e)),r?.maxBatchSize?bufferTime(n,void 0,r?.maxBatchSize??100):bufferTime(n),filter(e=>e.length>0)).subscribe(e=>{t(e).then(()=>log$4(`Saved ${e.length} events to cache`)).catch(t=>log$4(`Failed to save ${e.length} events to cache`,t))});return()=>i.unsubscribe()}var ExpirationTimestampSymbol=Symbol("expiration-timestamp");function getExpirationTimestamp(e){return getOrComputeCachedValue(e,ExpirationTimestampSymbol,()=>{const t=e.tags.find(e=>"expiration"===e[0])?.[1];return t?parseInt(t):void 0})}var require_fast_deep_equal=__commonJSMin((e,t)=>{t.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!==i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!==i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!==i--;){var s=o[i];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}}),import_fast_deep_equal=__toESM(require_fast_deep_equal(),1),LETTERS$1="abcdefghijklmnopqrstuvwxyz",INDEXABLE_TAGS$1=new Set((LETTERS$1+LETTERS$1.toUpperCase()).split("")),EventIndexableTagsSymbol=Symbol.for("indexable-tags");function getIndexableTags$1(e){let t=Reflect.get(e,EventIndexableTagsSymbol);if(!t){const r=new Set;for(const t of e.tags)t.length>=2&&1===t[0].length&&INDEXABLE_TAGS$1.has(t[0])&&r.add(t[0]+":"+t[1]);t=r,Reflect.set(e,EventIndexableTagsSymbol,r)}return t}function matchFilter$1(e,t){if(e.ids&&-1===e.ids.indexOf(t.id))return!1;if(e.kinds&&-1===e.kinds.indexOf(t.kind))return!1;if(e.authors&&-1===e.authors.indexOf(t.pubkey))return!1;if(e.since&&t.created_at<e.since)return!1;if(e.until&&t.created_at>e.until)return!1;for(let r in e)if("&"===r[0]){let n=r.slice(1),i=e[r];if(i&&i.length>0){const e=getIndexableTags$1(t);for(const t of i)if(!e.has(n+":"+t))return!1}}for(let r in e)if("#"===r[0]){let n=r.slice(1),i=e[r];if(i){const r=e[`&${n}`],o=r?i.filter(e=>!r.includes(e)):i;if(0===o.length)continue;const s=getIndexableTags$1(t);if(!1===o.some(e=>s.has(n+":"+e)))return!1}}return!0}function matchFilters$1(e,t){for(let r=0;r<e.length;r++)if(matchFilter$1(e[r],t))return!0;return!1}function isFilterEqual(e,t){return(0,import_fast_deep_equal.default)(e,t)}function safeParse(e){try{return JSON.parse(e)}catch(error){return}}function normalizeToSecretKey(e){if(e instanceof Uint8Array)return 32!==e.length?null:e;if(isHexKey(e))return hexToBytes$2(e);try{const t=decode(e);return"nsec"!==t.type?null:t.data}catch{return null}}var LRU=class{first=null;items=Object.create(null);last=null;max;resetTtl;size;ttl;constructor(e=0,t=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=r,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){return e.map(e=>[e,this.get(e)])}evict(e=!1){if(e||this.size>0){const e=this.first;delete this.items[e.key],0===--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){let t;if(this.has(e)){const r=this.items[e];this.ttl>0&&r.expiry<=Date.now()?this.delete(e):(t=r.value,this.set(e,t,!0))}return t}has(e){return e in this.items}keys(){const e=[];let t=this.first;for(;null!==t;)e.push(t.key),t=t.next;return e}set(e,t,r=!1,n=this.resetTtl){let i;if(r||this.has(e)){if(i=this.items[e],i.value=t,!1===r&&n&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==i){const e=this.last,t=i.next,r=i.prev;this.first===i&&(this.first=i.next),i.next=null,i.prev=this.last,e.next=i,null!==r&&(r.next=t),null!==t&&(t.prev=r)}}else this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1===++this.size?this.first=i:this.last.next=i;return this.last=i,this}values(e=this.keys()){return e.map(e=>this.get(e))}},MailboxesInboxesSymbol=Symbol.for("mailboxes-inboxes"),MailboxesOutboxesSymbol=Symbol.for("mailboxes-outboxes");function getInboxes(e){return getOrComputeCachedValue(e,MailboxesInboxesSymbol,()=>{const t=[];for(const r of e.tags)if(isRTag(r))try{const[,e,n]=r;!e||!isSafeRelayURL(e)||t.includes(e)||"read"!==n&&void 0!==n||t.push(normalizeURL(e))}catch{}return t})}function getOutboxes(e){return getOrComputeCachedValue(e,MailboxesOutboxesSymbol,()=>{const t=[];for(const r of e.tags)if(isRTag(r))try{const[e,n,i]=r;"r"!==e||!isSafeRelayURL(n)||t.includes(n)||"write"!==i&&void 0!==i||t.push(normalizeURL(n))}catch{}return t})}var ProfileContentSymbol=Symbol.for("profile-content");function getProfileContent(e){return getOrComputeCachedValue(e,ProfileContentSymbol,()=>{const t=safeParse(e.content);if(t)return t.nip05&&"string"!=typeof t.nip05&&(t.nip05=String(t.nip05)),t.website&&t.website?.length>0&&!1===t.website?.startsWith("http")&&(t.website="https://"+t.website),t})}function isValidProfile(e){return!(!e||e.kind!==kinds_exports.Metadata&&e.kind!==kinds_exports.Handlerinformation||!getProfileContent(e))}function selectOptimalRelays(e,{maxConnections:t,maxRelaysPerUser:r,score:n}){const i=e.filter(e=>e.relays&&e.relays.length>0),o=new Map;for(const c of i)if(c.relays)for(const e of c.relays)o.set(e,(o.get(e)||0)+1);let s=Array.from(i);const a=new Map;let l=new Set;for(;s.length>0&&l.size<t;){const e=new Map;for(const r of s)if(r.relays)for(const t of r.relays)l.has(t)||e.set(t,(e.get(t)||0)+1);if(0===e.size)break;const t=Array.from(e.keys()).sort((t,r)=>{const i=(e.get(t)??0)/s.length,a=(e.get(r)??0)/s.length,l=n?n(t,i,o.get(t)??0):i;return(n?n(r,a,o.get(r)??0):a)-l})[0];l.add(t),r&&(s=s.filter(e=>{if(!e.relays||!e.relays.includes(t))return!0;let n=a.get(e.pubkey)||0;return a.set(e.pubkey,n++),!(n>=r)}))}return e.map(e=>({...e,relays:e.relays?.filter(e=>l.has(e))}))}function removeBlacklistedRelays(e,t){return e.map(e=>e.relays&&0!==e.relays.length?{...e,relays:e.relays.filter(e=>!t.includes(e))}:e)}function createFilterMap(e,t){return Object.fromEntries(Array.from(Object.entries(e)).map(([e,r])=>[e,{authors:r.map(e=>e.pubkey),...t}]))}function setSingletonTag(e,t=!0){return r=>ensureSingletonTag(r,e,t)}function removeSingletonTag(e){return t=>t.filter(t=>!(t[0]===e))}function includeSingletonTag(e,t=!0){return modifyPublicTags(setSingletonTag(e,t))}function modifyPublicTags(...e){return async t=>({...t,tags:await tagPipe(...e)(Array.from(t.tags))})}function modifyHiddenTags(e,...t){return 0===(t=t.filter(e=>!!e)).length?skip():async r=>{if(!e)throw new Error("Missing signer for hidden tags");if(!canHaveHiddenTags(r.kind))throw new Error("Event kind does not support hidden tags");let n,i;if(hasHiddenTags(r)?(i=getHiddenTags(r),void 0===i&&(hasHiddenTags(r)?(n=await e.getPublicKey(),i=await unlockHiddenTags({...r,pubkey:n},e)):i=[])):i=[],void 0===i)throw new Error("Failed to find hidden tags");const o=await tagPipe(...t)(i),s=getHiddenTagsEncryptionMethods(r.kind,e);n||(n=await e.getPublicKey());const a=JSON.stringify(o),l=await s.encrypt(n,a);return{...r,content:l,[EncryptedContentSymbol]:a}}}function modifyTags(e,t){let r=[],n=[];return void 0===e?r=n=[]:Array.isArray(e)?r=e:"function"==typeof e?r=[e]:("function"==typeof e.public?r=[e.public]:e.public&&(r=e.public),"function"==typeof e.hidden?n=[e.hidden]:e.hidden&&(n=e.hidden)),eventPipe(r.length>0?modifyPublicTags(...r):void 0,n.length>0?modifyHiddenTags(t,...n):void 0)}function includeAltTag(e){return includeSingletonTag(["alt",e])}function setExpirationTimestamp(e){return includeSingletonTag(["expiration",e.toString()],!0)}function setProtected(e=!0){return modifyPublicTags(e?setSingletonTag(["-"]):removeSingletonTag("-"))}function setMetaTags(e){return eventPipe(e?.protected?setProtected(!0):skip(),e?.expiration?setExpirationTimestamp(e.expiration):skip(),e?.alt?includeAltTag(e.alt):skip())}function stamp(e){return async t=>{if(!e)throw new Error("Missing signer");Reflect.deleteProperty(t,"id"),Reflect.deleteProperty(t,"sig");const r=await e.getPublicKey(),n={...t,pubkey:r};return Reflect.has(t,EncryptedContentSymbol)&&Reflect.set(n,EncryptedContentSymbol,Reflect.get(t,EncryptedContentSymbol)),n}}function sign(e){return async t=>{if(!e)throw new Error("Missing signer");const r=await stamp(e)(t),n=await e.signEvent(r);if(Reflect.has(t,"pubkey")&&Reflect.get(t,"pubkey")!==n.pubkey)throw new Error("Signer modified pubkey");if(!isKind$1(n,t.kind))throw new Error("Signer modified event kind");return Reflect.has(t,EncryptedContentSymbol)&&Reflect.set(n,EncryptedContentSymbol,Reflect.get(t,EncryptedContentSymbol)),n}}function setContentWarning(e){return t=>{let r=Array.from(t.tags);return r=r.filter(e=>"content-warning"!==e[0]),"string"==typeof e?r.push(["content-warning",e]):!0===e&&r.push(["content-warning"]),{...t,tags:r}}}function toEventTemplate(e){return{kind:e.kind,created_at:unixNow(),tags:Array.from(e.tags),content:e.content}}var EventFactory=class e extends Promise{static fromKind(t){return new e(e=>e({kind:t,created_at:unixNow(),tags:[],content:""}))}static fromEvent(t){return new e(e=>e(toEventTemplate(t)))}_signerRef={};get signer(){return this._signerRef.signer}set signer(e){this._signerRef.signer=e}chain(e){const t=new(0,this.constructor)(t=>t(this.then(async t=>{const r=await e(t);for(const e of Reflect.ownKeys(r))"symbol"!=typeof e||PRESERVE_EVENT_SYMBOLS.has(e)||Reflect.deleteProperty(r,e);return r})));return t._signerRef=this._signerRef,t}as(e){return this._signerRef.signer=e,this}strip(){return new e(e=>e(this.then(e=>({content:e.content,tags:e.tags,created_at:e.created_at,kind:e.kind}))))}stamp(t=this.signer){return new e((e,r)=>{if(!t)return r(new Error("Signer required for stamping"));e(this.then(e=>stamp(t)(e)))})}async sign(e=this.signer){if(!e)throw new Error("Missing signer");this.signer||(this.signer=e);const t=await(this),r=await sign(e)(t);if(Reflect.has(t,"pubkey")&&Reflect.get(t,"pubkey")!==r.pubkey)throw new Error("Signer modified pubkey");if(isKind$1(r,t.kind))return r;throw new Error("Signer modified event kind")}kind(t){return new e(e=>({...e,kind:t}))}content(e){return this.chain(t=>({...t,content:e}))}created(e=unixNow()){return e instanceof Date&&(e=Math.floor(e.getTime()/1e3)),this.chain(t=>({...t,created_at:e}))}meta(e){return this.chain(setMetaTags(e))}alt(e){return this.chain(includeAltTag(e))}expiration(e){return this.chain(setExpirationTimestamp(e))}contentWarning(e){return this.chain(setContentWarning(e))}protected(e){return this.chain(setProtected(e))}modifyTags(...e){let t;return t=this.chain(r=>modifyTags(e[0],t.signer)(r)),t}modifyPublicTags(...e){return this.chain(modifyPublicTags(...e))}modifyHiddenTags(...e){let t;return t=this.chain(r=>modifyHiddenTags(t.signer,...e)(r)),t}encryptedContent(e,t,r){let n;return n=this.chain(i=>{const o=n.signer;if(!o)throw new Error("Signer required for encrypted content");return setEncryptedContent(e,t,o,r)(i)}),n}},require_hash_sum=__commonJSMin((e,t)=>{function r(e,t){var r,n;if(0===t.length)return e;for(r=0,n=t.length;r<n;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return e<0?-2*e:e}function n(e,t,i,o){var s,a=r(r(r(e,i),(s=t,Object.prototype.toString.call(s))),typeof t);if(null===t)return r(a,"null");if(void 0===t)return r(a,"undefined");if("object"==typeof t||"function"==typeof t){if(-1!==o.indexOf(t))return r(a,"[Circular]"+i);o.push(t);var l=function(e,t,r){return Object.keys(t).sort().reduce(function(e,i){return n(e,t[i],i,r)},e)}(a,t,o);if(!("valueOf"in t)||"function"!=typeof t.valueOf)return l;try{return r(l,String(t.valueOf()))}catch(err){return r(l,"[valueOf exception]"+(err.stack||err.message))}}return r(a,t.toString())}t.exports=function(e){return function(e){for(;e.length<8;)e="0"+e;return e}(n(0,e,"",[]).toString(16))}}),import_hash_sum=__toESM(require_hash_sum(),1),DeleteManager=class{deleted$;deletedSubject=new Subject;deletedIds=new Map;deletedIdentifiers=new Map;constructor(){this.deleted$=this.deletedSubject.asObservable()}add(e){if(e.kind!==kinds_exports.EventDeletion)return[];const t=e.pubkey,r=[],n=getDeleteEventPointers(e);if(n.length>0){let i=this.deletedIds.get(t);i||(i=new Set,this.deletedIds.set(t,i));for(const t of n){i.add(t.id);const n={pointer:t,until:e.created_at};r.push(n),this.deletedSubject.next(n)}}const i=getDeleteAddressPointers(e);if(i.length>0){let n=this.deletedIdentifiers.get(t);n||(n=new Map,this.deletedIdentifiers.set(t,n));for(const t of i){const i=t.kind+"|"+t.identifier;n.set(i,e.created_at);const o={pointer:t,until:e.created_at};r.push(o),this.deletedSubject.next(o)}}return r}check(e){const t=e.pubkey;if(isReplaceableKind$2(e.kind)||isAddressableKind$2(e.kind)){const r=this.deletedIdentifiers.get(t);if(!r)return!1;const n=getReplaceableIdentifier(e),i=e.kind+"|"+n,o=r.get(i);return void 0!==o&&o>=e.created_at}{const r=this.deletedIds.get(t);return!!r&&r.has(e.id)}}filter(e){return e.filter(e=>!1===this.check(e))}},EventMemory=class{log=logger$1.extend("EventMemory");kinds=new Map;authors=new Map;tags=new LRU;created_at=[];kindAuthor=new Map;events=new LRU;replaceable=new Map;get size(){return this.events.size}hasEvent(e){return this.events.has(e)}getEvent(e){return this.events.get(e)}hasReplaceable(e,t,r){const n=this.replaceable.get(createReplaceableAddress(e,t,r));return!!n&&n.length>0}getReplaceable(e,t,r){const n=createReplaceableAddress(e,t,r);return this.replaceable.get(n)?.[0]}getReplaceableHistory(e,t,r){const n=createReplaceableAddress(e,t,r);return this.replaceable.get(n)}getByFilters(e){return Array.from(this.getEventsForFilters(Array.isArray(e)?e:[e]))}getTimeline(e){const t=[],r=this.getByFilters(e);for(const n of r)insertEventIntoDescendingList(t,n);return t}add(e){const t=e.id,r=this.events.get(t);if(r)return r;this.events.set(t,e),this.getKindIndex(e.kind).add(e),this.getAuthorsIndex(e.pubkey).add(e),this.getKindAuthorIndex(e.kind,e.pubkey).add(e);for(const n of getIndexableTags$1(e))this.tags.has(n)&&this.getTagIndex(n).add(e);if(insertEventIntoDescendingList(this.created_at,e),isReplaceable(e.kind)){const t=e.tags.find(e=>"d"===e[0])?.[1],r=createReplaceableAddress(e.kind,e.pubkey,t);let n=this.replaceable.get(r);this.replaceable.has(r)||(n=[],this.replaceable.set(r,n)),insertEventIntoDescendingList(n,e)}return e}remove(e){let t="string"==typeof e?this.events.get(e):e;if(!t)return!1;const r=t.id;if(!this.events.has(r))return!1;const n=this.authors.get(t.pubkey);n&&(n.delete(t),0===n.size&&this.authors.delete(t.pubkey));const i=this.kinds.get(t.kind);i&&(i.delete(t),0===i.size&&this.kinds.delete(t.kind));const o=`${t.kind}:${t.pubkey}`,s=this.kindAuthor.get(o);s&&(s.delete(t),0===s.size&&this.kindAuthor.delete(o));for(const a of getIndexableTags$1(t))if(this.tags.has(a)){const e=this.getTagIndex(a);e.delete(t),0===e.size&&this.tags.delete(a)}if(this.removeFromSortedArray(this.created_at,t),this.events.delete(r),isReplaceable(t.kind)){const e=t.tags.find(e=>"d"===e[0])?.[1],r=createReplaceableAddress(t.kind,t.pubkey,e),n=this.replaceable.get(r);n&&(this.removeFromSortedArray(n,t),0===n.length&&this.replaceable.delete(r))}return this.claims.delete(t),!0}removeByFilters(e){const t=this.getByFilters(e);let r=0;for(const n of t)this.remove(n)&&r++;return r}update(e){}claims=new WeakMap;touch(e){this.events.has(e.id)&&this.events.set(e.id,e)}claim(e){const t=this.claims.get(e)||0;this.claims.set(e,t+1),this.touch(e)}isClaimed(e){const t=this.claims.get(e);return void 0!==t&&t>0}removeClaim(e){const t=this.claims.get(e);if(void 0!==t&&t>0){const r=t-1;0===r?this.claims.delete(e):this.claims.set(e,r)}}clearClaim(e){this.claims.delete(e)}*unclaimed(){let e=this.events.first;for(;e;){const t=e.value;this.isClaimed(t)||(yield t),e=e.next}return 0}prune(e){let t=0;const r=this.unclaimed();for(const n of r)if(this.remove(n),t++,e&&t>=e)break;return t}getKindIndex(e){return this.kinds.has(e)||this.kinds.set(e,new Set),this.kinds.get(e)}getAuthorsIndex(e){return this.authors.has(e)||this.authors.set(e,new Set),this.authors.get(e)}getKindAuthorIndex(e,t){const r=`${e}:${t}`;return this.kindAuthor.has(r)||this.kindAuthor.set(r,new Set),this.kindAuthor.get(r)}getTagIndex(e){if(!this.tags.has(e)){const t=new Set,r=Date.now();for(const i of this.events.values())getIndexableTags$1(i).has(e)&&t.add(i);const n=Date.now()-r;n>100&&this.log(`Built index ${e} took ${n}ms`),this.tags.set(e,t)}return this.tags.get(e)}removeFromSortedArray(e,t){if(0===e.length)return;const r=binarySearch$2(e,e=>e.created_at-t.created_at);if(r){let n=r[0],i=!1;if(e[n]===t)return void e.splice(n,1);for(let r=n-1;r>=0&&e[r].created_at===t.created_at;r--)if(e[r]===t){e.splice(r,1),i=!0;break}if(i)return;for(let r=n+1;r<e.length&&e[r].created_at===t.created_at;r++)if(e[r]===t)return void e.splice(r,1)}const n=e.indexOf(t);-1!==n&&e.splice(n,1)}*iterateAuthors(e){for(const t of e){const e=this.authors.get(t);if(e)for(const t of e)yield t}}*iterateTag(e,t){for(const r of t){const t=this.getTagIndex(e+":"+r);if(t)for(const e of t)yield e}}*iterateKinds(e){for(const t of e){const e=this.kinds.get(t);if(e)for(const t of e)yield t}}*iterateTime(e,t){if(0===this.created_at.length)return;let r=0,n=this.created_at.length-1,i=t?binarySearch$2(this.created_at,e=>e.created_at-t):void 0;i&&(r=Math.max(0,Math.min(i[0],this.created_at.length-1)));const o=e?binarySearch$2(this.created_at,t=>t.created_at-e):void 0;if(o&&(n=Math.max(0,Math.min(o[0],this.created_at.length-1))),!(r>n))for(let s=r;s<=n;s++){const r=this.created_at[s];if(!(void 0!==t&&r.created_at>t)){if(void 0!==e&&r.created_at<e)break;yield r}}}*iterateIds(e){for(const t of e)this.events.has(t)&&(yield this.events.get(t))}getEventsForFilter(e){if(e.search)return new Set;let t=!0,r=new Set;const n=e=>{const n=e instanceof Set?e:new Set(e);if(t)r=n,t=!1;else for(const t of r)n.has(t)||r.delete(t);return r};e.ids&&n(this.iterateIds(e.ids));let i=null;void 0!==e.since&&(i=Array.from(this.iterateTime(e.since,e.until)),n(i));for(const o of INDEXABLE_TAGS$1){const t=e[`&${o}`];if(t?.length)for(const e of t)n(this.iterateTag(o,[e]))}for(const o of INDEXABLE_TAGS$1){const t=e[`#${o}`];if(t?.length){const r=e[`&${o}`],i=r?t.filter(e=>!r.includes(e)):t;i.length>0&&n(this.iterateTag(o,i))}}if(e.authors&&e.kinds&&e.authors.length*e.kinds.length<=20){const t=new Set;for(const r of e.kinds)for(const n of e.authors){const e=`${r}:${n}`,i=this.kindAuthor.get(e);if(i)for(const r of i)t.add(r)}n(t)}else e.authors&&n(this.iterateAuthors(e.authors)),e.kinds&&n(this.iterateKinds(e.kinds));if(void 0===e.since&&void 0!==e.until&&(i=Array.from(this.iterateTime(e.since,e.until)),n(i)),t)return new Set(this.events.values());if(e.limit&&i){const t=new Set;for(const n of i){if(t.size>=e.limit)break;r.has(n)&&t.add(n)}return t}return r}getEventsForFilters(e){if(0===e.length)return new Set;let t=new Set;for(const r of e){const e=this.getEventsForFilter(r);for(const r of e)t.add(r)}return t}reset(){this.events.clear(),this.kinds.clear(),this.authors.clear(),this.kindAuthor.clear(),this.tags.clear(),this.created_at=[],this.replaceable.clear(),this.claims=new WeakMap}};function claimEvents(e){return t=>{const r=new Set;return t.pipe(tap(t=>{if(void 0!==t)if(Array.isArray(t))for(const n of t)r.has(n)||(r.add(n),e.claim(n));else r.has(t)||(r.add(t),e.claim(t))}),finalize(()=>{for(const t of r)e.removeClaim(t)}))}}function claimLatest(e){return t=>{let r;return t.pipe(tap(t=>{r!==t&&(r&&e.removeClaim(r),t&&e.claim(t),r=t)}),finalize(()=>{r&&e.removeClaim(r)}))}}function getEventFromStores(e,t){const r=e.getEvent(t.id);return r instanceof Promise?from(r):of(r)}function getReplaceableFromStores(e,t){const r=e.getReplaceable(t.kind,t.pubkey,t.identifier);return r instanceof Promise?from(r):of(r)}function getByFiltersFromStores(e,t){const r=e.getByFilters(t);return r instanceof Promise?from(r).pipe(mergeMap(e=>from(e))):from(r)}function loadEventUsingFallback(e,t){return switchMap(r=>r?of(r):e.eventLoader?from(e.eventLoader(t)).pipe(startWith(void 0)):of(r))}function EventModel(e){return"string"==typeof e&&(e={id:e}),t=>merge$1(defer(()=>getEventFromStores(t,e)).pipe(t.eventLoader?loadEventUsingFallback(t,e):identity$1),t.insert$.pipe(filter(t=>t.id===e.id)),t.remove$.pipe(filter(t=>t.id===e.id),take(1),map(()=>{}))).pipe(distinctUntilChanged((e,t)=>e?.id===t?.id),claimLatest(t))}function ReplaceableModel(e){return t=>{let r;return merge$1(defer(()=>getReplaceableFromStores(t,e)).pipe(t.eventLoader?loadEventUsingFallback(t,e):identity$1),t.insert$.pipe(filter(t=>t.pubkey==e.pubkey&&t.kind===e.kind&&(void 0===e.identifier||getReplaceableIdentifier(t)===e.identifier)))).pipe(tap(e=>r=e),mergeWith(t.remove$.pipe(filter(e=>e.id===r?.id),map(()=>{}))),distinctUntilChanged((e,t)=>void 0===e||void 0===t?e===t:t.created_at<e.created_at),claimLatest(t))}}function TimelineModel(e,t){return e=Array.isArray(e)?e:[e],r=>{const n=new Map,i=e=>t?e.id:getEventUID$1(e);return defer(()=>{const t=r.getTimeline(e);return t instanceof Promise?from(t):of(t)}).pipe(claimEvents(r),mergeWith(r.insert$.pipe(filter(t=>matchFilters$1(e,t)),claimEvents(r))),mergeWith(r.remove$.pipe(filter(t=>matchFilters$1(e,t)),map(e=>e.id))),scan((e,r)=>{if("string"==typeof r){const t=e.find(e=>e.id===r);if(t){const e=i(t);n.get(e)?.id===r&&n.delete(e)}return e.filter(e=>e.id!==r)}if(Array.isArray(r)){n.clear();for(const e of r)n.set(i(e),e);return[...r]}let o=[...e];const s=i(r),a=n.get(s);if(a&&(!isReplaceable(r.kind)||!t&&r.created_at<a.created_at))return[...e];if(!t&&isReplaceable(r.kind)){if(n.set(s,r),a){const e=o.indexOf(a);-1!==e&&o.splice(e,1)}}else n.set(s,r);return insertEventIntoDescendingList(o,r),o},[]),distinctUntilChanged(),finalize(()=>n.clear()))}}function FiltersModel(e,t=!1){return e=Array.isArray(e)?e:[e],r=>merge$1(t?EMPTY:defer(()=>getByFiltersFromStores(r,e)),r.insert$.pipe(filter(t=>matchFilters$1(e,t))))}function watchEventUpdates(e){return t=>{let r;return merge$1(t.pipe(tap(e=>r=e)),e.update$.pipe(filter(e=>e.id===r?.id)))}}function ContactsModel(e){return"string"==typeof e&&(e={pubkey:e}),t=>t.replaceable({kind:kinds_exports.Contacts,pubkey:e.pubkey,relays:e.relays}).pipe(watchEventUpdates(t),map(e=>e?getContacts(e):[]))}function MailboxesModel(e){return"string"==typeof e&&(e={pubkey:e}),t=>t.replaceable({kind:kinds_exports.RelayList,pubkey:e.pubkey,relays:e.relays}).pipe(map(e=>e&&{inboxes:getInboxes(e),outboxes:getOutboxes(e)}))}function ProfileModel(e){return"string"==typeof e&&(e={pubkey:e}),t=>t.replaceable({kind:kinds_exports.Metadata,pubkey:e.pubkey,relays:e.relays}).pipe(filter(isValidProfile),map(e=>e&&getProfileContent(e)))}var EventModels=class{models=new Map;modelKeepWarm=6e4;destroy$=new ReplaySubject(1);model(e,...t){let r=this.models.get(e);r||(r=new Map,this.models.set(e,r));const n=e.getKey?e.getKey(...t):(0,import_hash_sum.default)(t);let i=r.get(n);if(!i){const o=()=>{r.get(n)===i&&r.delete(n)};i=e(...t)(this).pipe(finalize(o),share({connector:()=>new ReplaySubject(1),resetOnComplete:()=>merge$1(timer(this.modelKeepWarm),this.destroy$),resetOnRefCountZero:()=>merge$1(timer(this.modelKeepWarm),this.destroy$)}),takeUntil(this.destroy$)),r.set(n,i)}return i}filters(e,t=!1){return Array.isArray(e)||(e=[e]),this.model(FiltersModel,e,t)}event(e){return"string"==typeof e||isEventPointer(e)?this.model(EventModel,e):this.replaceable(e)}replaceable(...e){let t;if(1===e.length)t=e[0];else if(3===e.length||2===e.length){let[r,n,i]=e;t={kind:r,pubkey:n,identifier:i}}if(!t)throw new Error("Invalid arguments, expected address pointer or kind, pubkey, identifier");return this.model(ReplaceableModel,t)}addressable(e){return this.replaceable(e)}timeline(e,t=!1){return this.model(TimelineModel,e,t)}profile(e){return this.model(ProfileModel,e)}contacts(e){return"string"==typeof e&&(e={pubkey:e}),this.model(ContactsModel,e)}mailboxes(e){return"string"==typeof e&&(e={pubkey:e}),this.model(MailboxesModel,e)}dispose(){this.destroy$.next(),this.destroy$.complete()}},ExpirationManager=class{expired$;expiredSubject;expirations=new Map;timer=null;nextCheck=null;constructor(){this.expiredSubject=new Subject,this.expired$=this.expiredSubject.asObservable()}track(e){const t=getExpirationTimestamp(e);if(!t||!Number.isFinite(t))return;const r=unixNow();if(t<=r)return;if(this.expirations.set(e.id,t),this.timer&&this.nextCheck&&this.nextCheck<=t)return;this.timer&&clearTimeout(this.timer);const n=t-r;n>0&&(this.timer=setTimeout(this.emitNotifications.bind(this),1e3*n+10),this.nextCheck=t)}forget(e){this.expirations.delete(e)}check(e){const t=getExpirationTimestamp(e);return!!t&&t<=unixNow()}dispose(){this.timer&&clearTimeout(this.timer),this.timer=null,this.nextCheck=null,this.expirations.clear(),this.expiredSubject.complete()}[Symbol.dispose](){this.dispose()}emitNotifications(){const e=unixNow();let t=1/0;for(const[r,n]of this.expirations)n<=e?(this.expirations.delete(r),this.expiredSubject.next(r)):n<t&&(t=n);if(t!==1/0){this.timer&&clearTimeout(this.timer),this.nextCheck=null,this.timer=null;const r=t-e;r>0&&(this.timer=setTimeout(this.emitNotifications.bind(this),1e3*r+10),this.nextCheck=t)}}},EventStore=class e extends EventModels{database;memory;deletes;expiration;keepOldVersions=!1;keepExpired=!1;keepDeleted=!1;_verifyEventMethod=verifyEvent;get verifyEvent(){return this._verifyEventMethod}set verifyEvent(e){this._verifyEventMethod=e,void 0===e&&console.warn("[applesauce-core] EventStore.verifyEvent is undefined; signature checks are disabled.")}insert$=new Subject;update$=new Subject;remove$=new Subject;eventLoader;internalSubscriptions=new Subscription;constructor(e){super(),e?.database?(this.database=e.database,this.memory=new EventMemory):this.database=this.memory=new EventMemory,void 0!==e?.keepDeleted&&(this.keepDeleted=e.keepDeleted),void 0!==e?.keepExpired&&(this.keepExpired=e.keepExpired),void 0!==e?.keepOldVersions&&(this.keepOldVersions=e.keepOldVersions),e?.verifyEvent&&(this.verifyEvent=e.verifyEvent),this.deletes=e?.deleteManager??new DeleteManager,this.internalSubscriptions.add(this.deletes.deleted$.subscribe(this.handleDeleteNotification.bind(this))),this.expiration=e?.expirationManager??new ExpirationManager,this.internalSubscriptions.add(this.expiration.expired$.subscribe(this.handleExpiredNotification.bind(this)))}mapToMemory(e){if(void 0!==e)return this.memory?this.memory.add(e):e}handleDeleteNotification({pointer:e,until:t}){if(!this.keepDeleted)if(isEventPointer(e)){const r=this.getEvent(e.id);r&&t>=r.created_at&&eventMatchesPointer(r,e)&&this.remove(r)}else if(isAddressPointer(e)){const r=this.getReplaceableHistory(e.kind,e.pubkey,e.identifier);if(r)for(const n of r)t>=n.created_at&&eventMatchesPointer(n,e)&&this.remove(n)}}handleExpiredNotification(e){this.keepExpired||this.remove(e)}static copySymbolsToDuplicateEvent(e,t){if(e.kind!==t.kind)throw new Error("Source and destination events must have the same kind");if(isRegularKind$1(e.kind)&&e.id!==t.id)throw new Error("Source and destination events must have the same ID");if(isReplaceable(e.kind)&&e.pubkey!==t.pubkey&&getReplaceableIdentifier(e)!==getReplaceableIdentifier(t))throw new Error("Source and destination events must have the same pubkey and replaceable identifier");let r=!1;const n=getSeenRelays(e);if(n){for(const e of n)addSeenRelay(t,e);r=!0}const i=[FromCacheSymbol,verifiedSymbol,EncryptedContentSymbol];for(const o of i)o in e&&!(o in t)&&(Reflect.set(t,o,Reflect.get(e,o)),r=!0);return r}add(t,r){if(t.kind===kinds_exports.EventDeletion)return this.deletes.add(t),t;if(this.deletes.check(t))return t;const n=getExpirationTimestamp(t);if(!1===this.keepExpired&&n&&n<=unixNow())return null;r&&addSeenRelay(t,r);const i=isReplaceable(t.kind)?getReplaceableIdentifier(t):void 0;if(!1===this.keepOldVersions&&isReplaceable(t.kind)){const r=this.database.getReplaceableHistory(t.kind,t.pubkey,i);if(r&&r.length>0){let n=r[0];for(const e of r)(e.created_at>n.created_at||e.created_at===n.created_at&&e.id<n.id)&&(n=e);if(!(t.created_at>n.created_at||t.created_at===n.created_at&&t.id<n.id))return e.copySymbolsToDuplicateEvent(t,n)&&this.update(n),n}}if(this.verifyEvent&&!1===this.verifyEvent(t))return null;const o=this.memory.add(t);if(o&&o!==t)return e.copySymbolsToDuplicateEvent(t,o)&&this.update(o),o;const s=this.mapToMemory(this.database.add(t));if(s===t?(Reflect.set(s,EventStoreSymbol,this),this.insert$.next(s)):e.copySymbolsToDuplicateEvent(t,s)&&this.update(s),!1===this.keepOldVersions&&isReplaceable(t.kind)){const e=this.database.getReplaceableHistory(t.kind,t.pubkey,i);if(e&&e.length>0){let t=e[0];for(const n of e)(n.created_at>t.created_at||n.created_at===t.created_at&&n.id<t.id)&&(t=n);const r=e.filter(e=>e!==t);for(const e of r)this.remove(e);if(r.length>0)return t}}return!1===this.keepExpired&&void 0!==n&&this.expiration.track(s),s}remove(e){const t="string"==typeof e?e:e.id;let r=this.memory.getEvent(t);this.expiration.forget(t),r&&Reflect.deleteProperty(r,EventStoreSymbol),this.memory!==this.database&&this.memory.remove(e);const n=this.database.remove(e);return n&&r&&this.remove$.next(r),n}removeByFilters(e){const t=this.getByFilters(e);for(const n of t)this.expiration.forget(n.id);this.memory!==this.database&&this.memory.removeByFilters(e);const r=this.database.removeByFilters(e);for(const n of t)this.remove$.next(n);return r}update(e){return!!this.database.add(e)&&(this.database.update?.(e),this.update$.next(e),!0)}hasEvent(e){return"string"==typeof e?this.memory.hasEvent(e)||this.database.hasEvent(e):isEventPointer(e)?this.memory.hasEvent(e.id)||this.database.hasEvent(e.id):this.hasReplaceable(e.kind,e.pubkey,e.identifier)}getEvent(e){return"string"==typeof e?this.memory.getEvent(e)??this.mapToMemory(this.database.getEvent(e)):isEventPointer(e)?this.memory.getEvent(e.id)??this.mapToMemory(this.database.getEvent(e.id)):this.getReplaceable(e.kind,e.pubkey,e.identifier)}hasReplaceable(e,t,r){return this.memory.hasReplaceable(e,t,r)||this.database.hasReplaceable(e,t,r)}getReplaceable(e,t,r){return this.memory.getReplaceable(e,t,r)??this.mapToMemory(this.database.getReplaceable(e,t,r))}getReplaceableHistory(e,t,r){return this.memory.getReplaceableHistory(e,t,r)??this.database.getReplaceableHistory(e,t,r)?.map(e=>this.mapToMemory(e)??e)}getByFilters(e){const t=this.database.getByFilters(e);return this.memory?t.map(e=>this.mapToMemory(e)):t}getTimeline(e){const t=this.database.getTimeline(e);return this.memory?t.map(e=>this.mapToMemory(e)):t}touch(e){return this.memory.touch(e)}claim(e){return this.memory.claim(e)}isClaimed(e){return this.memory.isClaimed(e)??!1}removeClaim(e){return this.memory.removeClaim(e)}clearClaim(e){return this.memory.clearClaim(e)}unclaimed(){return this.memory.unclaimed()||function*(){}()}prune(e){return this.memory.prune(e)??0}dispose(){const e=this.eventLoader;e&&"function"==typeof e[Symbol.dispose]&&e[Symbol.dispose](),this.eventLoader=void 0,super.dispose(),this.internalSubscriptions.unsubscribe(),this.expiration.dispose?.(),this.insert$.complete(),this.update$.complete(),this.remove$.complete()}[Symbol.dispose](){this.dispose()}};function mapEventsToStore(e,t=!0){return r=>{const n=r.pipe(share());return n.pipe(mergeMap(t=>{if("string"==typeof t)return EMPTY;const r=e.add(t);return r instanceof Promise?from(r):of(r)}),catchError(()=>of(null)),filter(e=>null!==e),t?distinct():identity$1,mergeWith(n.pipe(filter(e=>"string"==typeof e))))}}function filterDuplicateEvents(e){return mapEventsToStore(e,!0)}function includeMailboxes(e,t="outbox"){return switchMap(r=>combineLatest$1(r.map(r=>e.replaceable({kind:10002,pubkey:r.pubkey}).pipe(map(e=>{if(!e)return r;const n="outbox"===t?getOutboxes(e):getInboxes(e);return n?addRelayHintsToPointer(r,n):r})))))}function ignoreBlacklistedRelays(e){return pipe(combineLatestWith(isObservable(e)?e:of(e)),map(([e,t])=>removeBlacklistedRelays(e,t)))}var TimeoutError=class extends Error{};function simpleTimeout(e,t){return timeout$1({first:e,with:()=>throwError(()=>new TimeoutError(t??"Timeout"))})}function OutboxModel(e,t){return r=>r.contacts(e).pipe(t?.blacklist?ignoreBlacklistedRelays(t.blacklist):identity$1,includeMailboxes(r,t.type),map(e=>selectOptimalRelays(e,t)))}OutboxModel.getKey=(e,t)=>{const r="string"==typeof e?e:e.pubkey;return(0,import_hash_sum.default)([r,t.type,t.maxConnections,t.maxRelaysPerUser])};var NEVER_ATTACH_CLIENT_TAG=[kinds_exports.EncryptedDirectMessage,kinds_exports.GiftWrap,kinds_exports.Seal,kinds_exports.PrivateDirectMessage],fromNumH=e=>e/2**32|0,fromNumL=e=>e>>>0;function setU64FromNum(e,t,r,n){const i=fromNumH(r),o=fromNumL(r);e.setUint32(t,n?o:i,n),e.setUint32(t+4,n?i:o,n)}function isBytes$2(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&"BYTES_PER_ELEMENT"in e&&1===e.BYTES_PER_ELEMENT}var atitle=e=>e?`"${e}" `:"";function anumber$1(e,t=""){if("number"!=typeof e)throw new TypeError(atitle(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(atitle(t)+"expected integer >= 0, got "+e);return e}function abytes$2(e,t,r=""){if(isBytes$2(e)&&(void 0===t||e.length===t))return e;void 0!==t&&anumber$1(t,"length");const n=isBytes$2(e),i=void 0!==t?` of length ${t}`:"",o=n?`length=${e.length}`:"type="+typeof e,s=atitle(r)+"expected Uint8Array"+i+", got "+o;if(!n)throw new TypeError(s);throw new RangeError(s)}var aobject=(e,t)=>{if(null===e||"object"!=typeof e||Array.isArray(e))throw new TypeError(("object"===t?"":`"${t}" `)+"expected object, got type="+typeof e)};function aexists(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function aoutput(e,t){abytes$2(e,void 0,"output");const r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function clean(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function createView(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function rotr(e,t){return e<<32-t|e>>>t}function checkOpts(e,t,r="opts"){return aobject(e,"defaults"),void 0!==t&&aobject(t,r),Object.assign(e,t)}function createHasher(e,t={}){if("function"!=typeof e)throw new TypeError('"hashCons" expected function, got type='+typeof e);t=checkOpts({},t,"info");const r=(t,r)=>e(r).update(t).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=t=>e(t),Object.assign(r,t),Object.freeze(r)}var oidNist=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function Chi(e,t,r){return e&t^~e&r}function Maj(e,t,r){return e&t^e&r^t&r}var HashMD=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=createView(this.buffer)}update(e){aexists(this),abytes$2(e);const{view:t,buffer:r,blockLen:n}=this,i=e.length;let o=!1;for(let s=0;s<i;){const a=Math.min(n-this.pos,i-s);if(a===n){const t=createView(e);for(;n<=i-s;s+=n)this.process(t,s);o=!0;continue}r.set(0===s&&a===i?e:e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===n&&(this.process(t,0),this.pos=0,o=!0)}return this.length+=e.length,o&&this.roundClean(),this}digestInto(e){aexists(this),aoutput(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,t.fill(0,o),this.padOffset>n-o&&(this.process(r,0),t.fill(0)),setU64FromNum(r,n-8,8*this.length,i),this.process(r,0),this.roundClean();const s=e===t?r:createView(e),a=this.outputLen,l=a/4,c=this.get();if(a%4||l>c.length)throw new Error("invalid outputLen");for(let u=0;u<l;u++)s.setUint32(4*u,c[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneIntoMeta(e){const{buffer:t,length:r,finished:n,destroyed:i,pos:o}=this;return e.destroyed=i,e.finished=n,e.length=r,e.pos=o,o&&e.buffer.set(t),e}clone(){return this._cloneInto()}},SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_K=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),SHA256_W=new Uint32Array(64),SHA2_32B=class extends HashMD{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(e,t){super(64,e,8,!1),this.A=0|t[0],this.B=0|t[1],this.C=0|t[2],this.D=0|t[3],this.E=0|t[4],this.F=0|t[5],this.G=0|t[6],this.H=0|t[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let u=0;u<16;u++,t+=4)SHA256_W[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=SHA256_W[u-15],t=SHA256_W[u-2],r=rotr(e,7)^rotr(e,18)^e>>>3,n=rotr(t,17)^rotr(t,19)^t>>>10;SHA256_W[u]=n+SHA256_W[u-7]+r+SHA256_W[u-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:l,H:c}=this;for(let u=0;u<64;u++){const e=c+(rotr(s,6)^rotr(s,11)^rotr(s,25))+Chi(s,a,l)+SHA256_K[u]+SHA256_W[u]|0,t=(rotr(r,2)^rotr(r,13)^rotr(r,22))+Maj(r,n,i)|0;c=l,l=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+t|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,l,c)}roundClean(){clean(SHA256_W)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),clean(this.buffer)}},_SHA256=class extends SHA2_32B{constructor(){super(32,SHA256_IV)}},sha256=createHasher(()=>new _SHA256,oidNist(1)),deferred=new WeakMap;function deferDecorator(e,t,r){let n=deferred.get(e);n||(n=new Map,deferred.set(e,n)),n.set(t,r)}function findDeferredDecorator(e,t){var r;let n=e.prototype;for(;n;){let e=null==(r=deferred.get(n))?void 0:r.get(t);if(e)return e;n=Object.getPrototypeOf(n)}}function decorateFieldV2(e,t,r,n){let i={configurable:!0,enumerable:!0,writable:!0,initializer:null};n&&(i.initializer=n);for(let o of r)i=o(e,t,i)||i;void 0===i.initializer?Object.defineProperty(e,t,i):deferDecorator(e,t,i)}function decorateMethodV2(e,t,r){let n={...Object.getOwnPropertyDescriptor(e,t)};for(let i of r)n=i(e,t,n)||n;void 0!==n.initializer&&(n.value=n.initializer?n.initializer.call(e):void 0,n.initializer=void 0),Object.defineProperty(e,t,n)}function initializeDeferredDecorator(e,t){let r=findDeferredDecorator(e.constructor,t);r&&Object.defineProperty(e,t,{enumerable:r.enumerable,configurable:r.configurable,writable:r.writable,value:r.initializer?r.initializer.call(e):void 0})}var blossom_exports=__exportAll({DEFAULT_BLOSSOM_SERVER:()=>DEFAULT_BLOSSOM_SERVER,default:()=>BlossomService}),DEFAULT_BLOSSOM_SERVER="https://blossom.nostr.build";function bufferToHex(e){return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join("")}function getBlossomUrl(e,t){let r=e||"https://blossom.nostr.build";return r.endsWith("/")&&(r=r.slice(0,-1)),t.startsWith("/")?`${r}${t}`:`${r}/${t}`}var BlossomService=class extends Service{static{decorateFieldV2(this.prototype,"nostrAuth",[service])}#x=void initializeDeferredDecorator(this,"nostrAuth");static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");get servers(){const e=this.nostrData.blossomServers,t=e.length?e:[DEFAULT_BLOSSOM_SERVER];return this.settings.nostrPhotoFallbackUploads?t:[t[0]]}async _getAuthHeader(e,t,r){const n=Math.floor(Date.now()/1e3),i=new URL(r).hostname,o=await EventFactory.fromKind(24242).content("upload"===e?"Upload photo for place":"Delete photo").modifyPublicTags(()=>[["t",e],["x",t],["expiration",String(n+3600)],["server",i]]).created(n).as(this.nostrAuth.signer).sign();return`Nostr ${btoa(JSON.stringify(o)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}async _uploadToServer(e,t,r,n){const i=getBlossomUrl(r,"upload");n&&n("signing");const o=await this._getAuthHeader("upload",t,r);n&&n("uploading");const s=await fetch(i,{method:"PUT",headers:{Authorization:o,"X-SHA-256":t},body:e});if(!s.ok){const e=await s.text();throw new Error(`Upload failed (${s.status}): ${e}`)}return s.json()}async upload(e,t={sequential:!1}){if(!this.nostrAuth.isConnected)throw new Error("Not connected");const r=await e.arrayBuffer();let n;n="undefined"!=typeof crypto&&crypto.subtle&&crypto.subtle.digest?await crypto.subtle.digest("SHA-256",r):sha256(new Uint8Array(r));const i=bufferToHex(n),o=this.servers,s=o[0],a=o.slice(1),l=[];let c;if(t.sequential){c=await this._uploadToServer(e,i,s,t.onProgress);for(const r of a)try{const n=await this._uploadToServer(e,i,r,t.onProgress);l.push(n.url)}catch(error){console.warn(`Fallback upload to ${r} failed:`,error)}}else{const r=this._uploadToServer(e,i,s,t.onProgress),n=a.map(r=>this._uploadToServer(e,i,r,t.onProgress));c=await r;const o=await Promise.allSettled(n);for(let e=0;e<o.length;e++){const t=o[e];"fulfilled"===t.status?l.push(t.value.url):console.warn(`Fallback upload to ${a[e]} failed:`,t.reason)}}return{url:c.url,fallbackUrls:l,hash:i,type:e.type}}async _deleteFromServer(e,t){const r=getBlossomUrl(t,e),n=await this._getAuthHeader("delete",e,t),i=await fetch(r,{method:"DELETE",headers:{Authorization:n}});if(!i.ok){const e=await i.text();throw new Error(e||i.statusText)}}async delete(e){if(!this.nostrAuth.isConnected)throw new Error("Not connected");const t=this.servers,r=t[0],n=t.slice(1),i=this._deleteFromServer(e,r),o=n.map(t=>this._deleteFromServer(e,t));await i;const s=await Promise.allSettled(o);for(let a=0;a<s.length;a++){const e=s[a];"rejected"===e.status&&console.warn(`Fallback delete from ${n[a]} failed:`,e.reason)}}};function WorkerWrapper(e){return new Worker("/assets/image-processor-TE4QOxly.js",{name:e?.name})}var image_processor_exports$1=__exportAll({default:()=>ImageProcessorService}),ImageProcessorService=class extends Service{_worker=null;_callbacks=new Map;_msgId=0;constructor(){super(...arguments),this._initWorker()}_initWorker(){if(!this._worker&&void 0!==WorkerWrapper)try{this._worker=new WorkerWrapper,this._worker.onmessage=this._handleMessage.bind(this),this._worker.onerror=this._handleError.bind(this)}catch(e){console.warn("Failed to initialize image-processor worker:",e)}}_handleMessage(e){const{id:t,success:r,blob:n,dim:i,blurhash:o,error:s}=e.data,a=this._callbacks.get(t);a&&(this._callbacks.delete(t),r?a.resolve({blob:n,dim:i,blurhash:o}):a.reject(new Error(s)))}_handleError(e){console.error("Image Processor Worker Error:",e);for(const[,t]of this._callbacks.entries())t.reject(new Error("Worker crashed"));this._callbacks.clear(),this._worker.terminate(),this._worker=null,this._initWorker()}_getImageDimensions(e){return new Promise((t,r)=>{const n=new Image,i=URL.createObjectURL(e);n.onload=()=>{const e={width:n.width,height:n.height};URL.revokeObjectURL(i),t(e)},n.onerror=()=>{URL.revokeObjectURL(i),r(new Error("Could not read image dimensions"))},n.src=i})}async process(e,t,r,n=!1){if(!this._worker)throw new Error("Image processor worker is not available.");try{const{width:i,height:o}=await this._getImageDimensions(e);let s=i,a=o;return i>o?i>t&&(a=Math.round(o*(t/i)),s=t):o>t&&(s=Math.round(i*(t/o)),a=t),new Promise((t,i)=>{const o=++this._msgId;this._callbacks.set(o,{resolve:t,reject:i}),this._worker.postMessage({type:"PROCESS_IMAGE",id:o,file:e,targetWidth:s,targetHeight:a,quality:r,computeBlurhash:n})})}catch(i){throw new Error(`Failed to process image: ${i.message}`,{cause:i})}}willDestroy(){super.willDestroy(...arguments),this._worker&&(this._worker.terminate(),this._worker=null),this._callbacks.clear()}},map_ui_exports=__exportAll({default:()=>MapUiService}),MapUiService=class extends Service{static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");static{decorateFieldV2(this.prototype,"selectedPlace",[tracked],function(){return null})}#I=void initializeDeferredDecorator(this,"selectedPlace");static{decorateFieldV2(this.prototype,"isSearching",[tracked],function(){return!1})}#k=void initializeDeferredDecorator(this,"isSearching");static{decorateFieldV2(this.prototype,"isCreating",[tracked],function(){return!1})}#P=void initializeDeferredDecorator(this,"isCreating");static{decorateFieldV2(this.prototype,"creationCoordinates",[tracked],function(){return null})}#L=void initializeDeferredDecorator(this,"creationCoordinates");static{decorateFieldV2(this.prototype,"returnToSearch",[tracked],function(){return!1})}#O=void initializeDeferredDecorator(this,"returnToSearch");static{decorateFieldV2(this.prototype,"returnToRoute",[tracked],function(){return null})}#M=void initializeDeferredDecorator(this,"returnToRoute");static{decorateFieldV2(this.prototype,"currentCenter",[tracked],function(){return null})}#D=void initializeDeferredDecorator(this,"currentCenter");static{decorateFieldV2(this.prototype,"currentBounds",[tracked],function(){return null})}#N=void initializeDeferredDecorator(this,"currentBounds");static{decorateFieldV2(this.prototype,"currentZoom",[tracked],function(){return null})}#$=void initializeDeferredDecorator(this,"currentZoom");static{decorateFieldV2(this.prototype,"searchBoxHasFocus",[tracked],function(){return!1})}#F=void initializeDeferredDecorator(this,"searchBoxHasFocus");static{decorateFieldV2(this.prototype,"selectionOptions",[tracked],function(){return{}})}#B=void initializeDeferredDecorator(this,"selectionOptions");static{decorateFieldV2(this.prototype,"preventNextZoom",[tracked],function(){return!1})}#U=void initializeDeferredDecorator(this,"preventNextZoom");static{decorateFieldV2(this.prototype,"searchResults",[tracked],function(){return[]})}#z=void initializeDeferredDecorator(this,"searchResults");static{decorateFieldV2(this.prototype,"currentSearch",[tracked],function(){return null})}#V=void initializeDeferredDecorator(this,"currentSearch");static{decorateFieldV2(this.prototype,"loadingState",[tracked],function(){return null})}#j=void initializeDeferredDecorator(this,"loadingState");static{decorateFieldV2(this.prototype,"isSidebarVisible",[tracked],function(){return!1})}#G=void initializeDeferredDecorator(this,"isSidebarVisible");static{decorateFieldV2(this.prototype,"isSidebarOpening",[tracked],function(){return!1})}#H=void initializeDeferredDecorator(this,"isSidebarOpening");scrollPositions={};saveScrollPosition(e,t){this.scrollPositions[e]=t}static{decorateMethodV2(this.prototype,"saveScrollPosition",[action])}getScrollPosition(e){return this.scrollPositions[e]||0}static{decorateMethodV2(this.prototype,"getScrollPosition",[action])}showSidebar(){this.isSidebarVisible||(this.isSidebarVisible=!0,this.isSidebarOpening=!0,setTimeout(()=>{this.isSidebarOpening=!1},250))}hideSidebar(){this.isSidebarVisible=!1,this.isSidebarOpening=!1}selectPlace(e,t={}){this.selectedPlace=e,this.selectionOptions=t,this.nostrData.loadPhotosForPlace(e)}clearSelection(){this.selectedPlace=null,this.selectionOptions={},this.preventNextZoom=!1,this.nostrData.loadPhotosForPlace(null)}setSearchResults(e){this.searchResults=e||[]}clearSearchResults(){this.searchResults=[],this.currentSearch=null}startSearch(){this.isSearching=!0,this.isCreating=!1,this.preventNextZoom=!1}stopSearch(){this.isSearching=!1}startCreating(){this.isCreating=!0,this.isSearching=!1}stopCreating(){this.isCreating=!1,this.creationCoordinates=null}updateCreationCoordinates(e,t){this.creationCoordinates={lat:e,lon:t}}setSearchBoxFocus(e){this.searchBoxHasFocus=e}updateCenter(e,t){this.currentCenter={lat:e,lon:t}}updateZoom(e){this.currentZoom=e}updateBounds(e){this.currentBounds=e}startLoading(e,t){this.loadingState={type:e,value:t}}stopLoading(e=null,t=null){e||t?this.loadingState&&this.loadingState.type===e&&this.loadingState.value===t&&(this.loadingState=null):this.loadingState=null}};function getConnectionMethods(e,t){const r=e.subscriptionMethod||e.pool?.subscription.bind(e.pool)||t?.subscriptionMethod||t?.pool?.subscription.bind(t.pool);if(!r)throw new Error("Missing subscriptionMethod, either pass a method or set subscriptionMethod globally on the class");const n=e.publishMethod||e.pool?.publish.bind(e.pool)||t?.publishMethod||t?.pool?.publish.bind(t.pool);if(!n)throw new Error("Missing publishMethod, either pass a method or set publishMethod globally on the class");return{subscriptionMethod:r,publishMethod:n}}function createDefer(){let e,t;const r=new Promise((r,n)=>{e=r,t=n});return r.resolve=e,r.reject=t,r}var AmberClipboardSigner=class e{static SUPPORTED="navigator"in globalThis&&navigator.userAgent.includes("Android")&&navigator.clipboard&&navigator.clipboard.readText;pendingRequest=null;pubkey;verifyEvent=verifyEvent;nip04;nip44;constructor(){document.addEventListener("visibilitychange",this.onVisibilityChange),this.nip04={encrypt:this.nip04Encrypt.bind(this),decrypt:this.nip04Decrypt.bind(this)},this.nip44={encrypt:this.nip44Encrypt.bind(this),decrypt:this.nip44Decrypt.bind(this)}}onVisibilityChange=()=>{if("visible"===document.visibilityState){if(!this.pendingRequest||!navigator.clipboard)return;setTimeout(()=>{navigator.clipboard.readText().then(e=>this.pendingRequest?.resolve(e)).catch(e=>this.pendingRequest?.reject(e))},200)}};async intentRequest(e){this.rejectPending();const t=createDefer();window.open(e,"_blank"),setTimeout(()=>{this.pendingRequest=t},500);const r=await t;if(0===r.length)throw new Error("Empty clipboard");return r}rejectPending(){this.pendingRequest&&(this.pendingRequest.reject("Canceled"),this.pendingRequest=null)}destroy(){document.removeEventListener("visibilitychange",this.onVisibilityChange)}checkSupport(){if(!e.SUPPORTED)throw new Error("Cant use Amber on non-Android device")}async getPublicKey(){if(this.checkSupport(),this.pubkey)return this.pubkey;const t=await this.intentRequest(e.createGetPublicKeyIntent());if(isHexKey(t))return this.pubkey=t,t;if(t.startsWith("npub")||t.startsWith("nprofile")){const e=decodeProfilePointer(t)?.pubkey;if(!e)throw new Error("Expected npub from clipboard");return this.pubkey=e,e}throw new Error("Expected clipboard to have pubkey")}async signEvent(t){this.checkSupport();const r=t.pubkey||this.pubkey;if(!r)throw new Error("Unknown signer pubkey");const n={...t,id:getEventHash({...t,pubkey:r})},i=await this.intentRequest(e.createSignEventIntent(n));if(!isHex(i))throw new Error("Expected hex signature");const o={...n,sig:i,pubkey:r};if(!this.verifyEvent(o))throw new Error("Invalid signature");return o}async nip04Encrypt(t,r){return this.checkSupport(),await this.intentRequest(e.createNip04EncryptIntent(t,r))}async nip04Decrypt(t,r){return this.checkSupport(),await this.intentRequest(e.createNip04DecryptIntent(t,r))}async nip44Encrypt(t,r){return this.checkSupport(),await this.intentRequest(e.createNip44EncryptIntent(t,r))}async nip44Decrypt(t,r){return this.checkSupport(),await this.intentRequest(e.createNip44DecryptIntent(t,r))}static createGetPublicKeyIntent(){return"intent:#Intent;scheme=nostrsigner;S.compressionType=none;S.returnType=signature;S.type=get_public_key;end"}static createSignEventIntent(e){return`intent:${encodeURIComponent(JSON.stringify(e))}#Intent;scheme=nostrsigner;S.compressionType=none;S.returnType=signature;S.type=sign_event;end`}static createNip04EncryptIntent(e,t){return`intent:${encodeURIComponent(t)}#Intent;scheme=nostrsigner;S.pubKey=${e};S.compressionType=none;S.returnType=signature;S.type=nip04_encrypt;end`}static createNip04DecryptIntent(e,t){return`intent:${encodeURIComponent(t)}#Intent;scheme=nostrsigner;S.pubKey=${e};S.compressionType=none;S.returnType=signature;S.type=nip04_decrypt;end`}static createNip44EncryptIntent(e,t){return`intent:${encodeURIComponent(t)}#Intent;scheme=nostrsigner;S.pubKey=${e};S.compressionType=none;S.returnType=signature;S.type=nip44_encrypt;end`}static createNip44DecryptIntent(e,t){return`intent:${encodeURIComponent(t)}#Intent;scheme=nostrsigner;S.pubKey=${e};S.compressionType=none;S.returnType=signature;S.type=nip44_decrypt;end`}},ExtensionMissingError=class extends Error{},ExtensionSigner=class{get nip04(){return window.nostr?.nip04}get nip44(){return window.nostr?.nip44}pubkey=void 0;async getPublicKey(){if(!window.nostr)throw new ExtensionMissingError("Signer extension missing");if(this.pubkey)return this.pubkey;const e=await window.nostr.getPublicKey();if(!isHexKey(e))throw new Error("Extension returned an invalid public key");return this.pubkey=e,this.pubkey}async signEvent(e){if(!window.nostr)throw new ExtensionMissingError("Signer extension missing");const t=await window.nostr.signEvent(e);if(!verifyEvent(t))throw new Error("Extension returned an invalid event");return t}};function isNIP04Encrypted(e){const t=e.length;return!(t<28)&&"?"==e[t-28]&&"i"==e[t-27]&&"v"==e[t-26]&&"="==e[t-25]}function isBytes$1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&"BYTES_PER_ELEMENT"in e&&1===e.BYTES_PER_ELEMENT}function abytes$1(e){if(!isBytes$1(e))throw new TypeError("Uint8Array expected")}function isArrayOf(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every(e=>"string"==typeof e):t.every(e=>Number.isSafeInteger(e))))}function afn(e){if("function"!=typeof e)throw new TypeError("function expected");return!0}function astr(e,t){if("string"!=typeof t)throw new TypeError(`${e}: string expected`);return!0}function anumber(e){if("number"!=typeof e)throw new TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e))throw new RangeError(`invalid integer: ${e}`)}function aArr(e){if(!Array.isArray(e))throw new TypeError("array expected")}function astrArr(e,t){if(!isArrayOf(!0,t))throw new TypeError(`${e}: array of strings expected`)}function anumArr(e,t){if(!isArrayOf(!1,t))throw new TypeError(`${e}: array of numbers expected`)}function chain(...e){const t=e=>e,r=(e,t)=>r=>e(t(r));return{encode:e.map(e=>e.encode).reduceRight(r,t),decode:e.map(e=>e.decode).reduce(r,t)}}function alphabet(e){const t="string"==typeof e?e.split(""):e,r=t.length;astrArr("alphabet",t);const n=new Map(t.map((e,t)=>[e,t]));return{encode:n=>(aArr(n),n.map(n=>{if(!Number.isSafeInteger(n)||n<0||n>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${n}". Allowed: ${e}`);return t[n]})),decode:t=>(aArr(t),t.map(t=>{astr("alphabet.decode",t);const r=n.get(t);if(void 0===r)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return r}))}}function join(e=""){return astr("join",e),{encode:t=>(astrArr("join.decode",t),t.join(e)),decode:t=>(astr("join.decode",t),t.split(e))}}function padding(e,t="="){return anumber(e),astr("padding",t),{encode(r){for(astrArr("padding.encode",r);r.length*e%8;)r.push(t);return r},decode(r){astrArr("padding.decode",r);let n=r.length;if(n*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if((n-1)*e%8==0)throw new Error("padding: invalid, string has too much padding");return r.slice(0,n)}}}function normalize(e){return afn(e),{encode:e=>e,decode:t=>e(t)}}var gcd=(e,t)=>0===t?e:gcd(t,e%t),radix2carry=(e,t)=>e+(t-gcd(e,t)),powers=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function convertRadix2(e,t,r,n){if(aArr(e),t<=0||t>32)throw new RangeError(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new RangeError(`convertRadix2: wrong to=${r}`);if(radix2carry(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${radix2carry(t,r)}`);let i=0,o=0;const s=powers[t],a=powers[r]-1,l=[];for(const c of e){if(anumber(c),c>=s)throw new Error(`convertRadix2: invalid data word=${c} from=${t}`);if(i=i<<t|c,o+t>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=r;o-=r)l.push((i>>o-r&a)>>>0);const e=powers[o];if(void 0===e)throw new Error("invalid carry");i&=e-1}if(i=i<<r-o&a,!n&&o>=t)throw new Error("Excess padding");if(!n&&i>0)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&l.push(i>>>0),l}function radix2(e,t=!1){if(anumber(e),e<=0||e>32)throw new RangeError("radix2: bits should be in (0..32]");if(radix2carry(8,e)>32||radix2carry(e,8)>32)throw new RangeError("radix2: carry overflow");return{encode:r=>{if(!isBytes$1(r))throw new TypeError("radix2.encode input should be Uint8Array");return convertRadix2(Array.from(r),8,e,!t)},decode:r=>(anumArr("radix2.decode",r),Uint8Array.from(convertRadix2(r,e,8,t)))}}function unsafeWrapper(e){return afn(e),function(...t){try{return e.apply(null,t)}catch(r){}}}var base16=Object.freeze(chain(radix2(4),alphabet("0123456789ABCDEF"),join(""))),base32$1=Object.freeze(chain(radix2(5),alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),padding(5),join(""))),base32nopad=Object.freeze(chain(radix2(5),alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),join(""))),base32hex=Object.freeze(chain(radix2(5),alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"),padding(5),join(""))),base32hexnopad=Object.freeze(chain(radix2(5),alphabet("0123456789ABCDEFGHIJKLMNOPQRSTUV"),join(""))),base32crockford=Object.freeze(chain(radix2(5),alphabet("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),join(""),normalize(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),hasBase64Builtin=(()=>"function"==typeof Uint8Array.from([]).toBase64&&"function"==typeof Uint8Array.fromBase64)(),ASCII_WHITESPACE=/[\t\n\f\r ]/,decodeBase64Builtin=(e,t)=>{astr("base64",e);const r=t?"base64url":"base64";if(e.length>0&&ASCII_WHITESPACE.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},base64=Object.freeze(hasBase64Builtin?{encode:e=>(abytes$1(e),e.toBase64()),decode:e=>decodeBase64Builtin(e,!1)}:chain(radix2(6),alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),padding(6),join(""))),base64nopad=Object.freeze(chain(radix2(6),alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),join(""))),base64url=Object.freeze(hasBase64Builtin?{encode:e=>(abytes$1(e),e.toBase64({alphabet:"base64url"})),decode:e=>decodeBase64Builtin(e,!0)}:chain(radix2(6),alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),padding(6),join(""))),base64urlnopad=Object.freeze(chain(radix2(6),alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),join(""))),BECH_ALPHABET=chain(alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),join("")),POLYMOD_GENERATORS=[996825010,642813549,513874426,1027748829,705979059];function bech32Polymod(e){const t=e>>25;let r=(33554431&e)<<5;for(let n=0;n<POLYMOD_GENERATORS.length;n++)1==(t>>n&1)&&(r^=POLYMOD_GENERATORS[n]);return r}function bechChecksum(e,t,r=1){const n=e.length;let i=1;for(let o=0;o<n;o++){const t=e.charCodeAt(o);if(t<33||t>126)throw new Error(`Invalid prefix (${e})`);i=bech32Polymod(i)^t>>5}i=bech32Polymod(i);for(let o=0;o<n;o++)i=bech32Polymod(i)^31&e.charCodeAt(o);for(let o of t)i=bech32Polymod(i)^o;for(let o=0;o<6;o++)i=bech32Polymod(i);return i^=r,BECH_ALPHABET.encode(convertRadix2([i%powers[30]],30,5,!1))}function genBech32(e){const t="bech32"===e?1:734539939,r=radix2(5),n=r.decode,i=r.encode,o=unsafeWrapper(n);function s(e,r,n=90){astr("bech32.encode prefix",e),isBytes$1(r)&&(r=Array.from(r)),anumArr("bech32.encode",r);const i=e.length;if(0===i)throw new TypeError(`Invalid prefix length ${i}`);const o=i+7+r.length;if(!1!==n&&o>n)throw new TypeError(`Length ${o} exceeds limit ${n}`);const s=e.toLowerCase(),a=bechChecksum(s,r,t);return`${s}1${BECH_ALPHABET.encode(r)}${a}`}function a(e,r=90){astr("bech32.decode input",e);const n=e.length;if(n<8||!1!==r&&n>r)throw new TypeError(`invalid string length: ${n} (${e}). Expected (8..${r})`);const i=e.toLowerCase();if(e!==i&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=i.lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const s=i.slice(0,o),a=i.slice(o+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const l=BECH_ALPHABET.decode(a).slice(0,-6),c=bechChecksum(s,l,t);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:s,words:l}}return{encode:s,decode:a,encodeFromBytes:function(e,t){return s(e,i(t))},decodeToBytes:function(e){const{prefix:t,words:r}=a(e,!1);return{prefix:t,words:r,bytes:n(r)}},decodeUnsafe:unsafeWrapper(a),fromWords:n,fromWordsUnsafe:o,toWords:i}}var bech32=Object.freeze(genBech32("bech32")),bech32m=Object.freeze(genBech32("bech32m")),hasHexBuiltin=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),hexBuiltin={encode:e=>(abytes$1(e),e.toHex()),decode:e=>(astr("hex",e),Uint8Array.fromHex(e))},hex=Object.freeze(hasHexBuiltin?hexBuiltin:chain(radix2(4),alphabet("0123456789abcdef"),join(""),normalize(e=>{if("string"!=typeof e||e.length%2!=0)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}))),encoder=new TextEncoder,decoder=new TextDecoder,TYPE_PUBKEY=0,TYPE_LOCAL_KEY=1,TYPE_RELAY=2,TYPE_SECRET=3,Permission,NostrConnectMethod;function encodeNbunksec(e){try{const t=[],r=hexToBytes$2(e.pubkey);t.push(new Uint8Array([TYPE_PUBKEY,r.length]),r);const n=hexToBytes$2(e.local_key);t.push(new Uint8Array([TYPE_LOCAL_KEY,n.length]),n);for(const a of e.relays){const e=encoder.encode(a);t.push(new Uint8Array([TYPE_RELAY,e.length]),e)}if(e.secret){const r=encoder.encode(e.secret);t.push(new Uint8Array([TYPE_SECRET,r.length]),r)}const i=t.reduce((e,t)=>e+t.length,0),o=new Uint8Array(i);let s=0;for(const e of t)o.set(e,s),s+=e.length;return bech32.encode("nbunksec",bech32.toWords(o),!1)}catch(error){throw new Error(`Failed to encode bunker info: ${error}`)}}function decodeNbunksec(e){try{const{prefix:t,words:r}=bech32.decode(e,!1);if("nbunksec"!==t)throw new Error(`Invalid prefix: ${t}`);const n=bech32.fromWords(r);let i=0;const o={pubkey:"",local_key:"",relays:[]};for(;i<n.length;){const e=n[i],t=n[i+1];i+=2;const r=n.slice(i,i+t);switch(i+=t,e){case TYPE_PUBKEY:o.pubkey=bytesToHex$2(r);break;case TYPE_LOCAL_KEY:o.local_key=bytesToHex$2(r);break;case TYPE_RELAY:o.relays.push(decoder.decode(r));break;case TYPE_SECRET:o.secret=decoder.decode(r);break;default:throw new Error(`Unknown type: ${e}`)}}return o}catch(error){throw new Error(`Failed to decode bunker info: ${error}`)}}function parseBunkerURI(e){const t=new URL(e),r=t.host||t.pathname.replace("//","");if(!isHexKey(r))throw new Error("Invalid bunker URI: remote is not a valid hex key");const n=t.searchParams.getAll("relay");if(0===n.length)throw new Error("Invalid bunker URI: missing relays");const i=t.searchParams.get("secret")??void 0;return{remote:r,relays:n,secret:i,bunkerSecret:i}}function parseNbunksec(e){const t=decodeNbunksec(e);if(!isHexKey(t.pubkey))throw new Error("Invalid nbunksec: remote is not a valid hex key");if(!isHexKey(t.local_key))throw new Error("Invalid nbunksec: clientKey is not a valid hex key");if(0===t.relays.length)throw new Error("Invalid nbunksec: missing relays");return{remote:t.pubkey,clientKey:t.local_key,relays:t.relays,secret:t.secret,bunkerSecret:t.secret}}function createNbunksec(e){if(!isHexKey(e.remote))throw new Error("Invalid nbunksec: remote is not a valid hex key");if(!isHexKey(e.clientKey))throw new Error("Invalid nbunksec: clientKey is not a valid hex key");if(0===e.relays.length)throw new Error("Invalid nbunksec: missing relays");return encodeNbunksec({pubkey:e.remote,local_key:e.clientKey,relays:e.relays,secret:e.bunkerSecret??e.secret})}function createNostrConnectURI(e){const t=new URLSearchParams,r=e.connectSecret??e.secret;if(!r)throw new Error("Invalid nostrconnect URI: missing secret");t.set("secret",r),e.metadata?.name&&t.set("name",e.metadata.name),e.metadata?.url&&t.set("url",String(e.metadata.url)),e.metadata?.image&&t.set("image",e.metadata.image),e.metadata?.permissions&&t.set("perms",e.metadata.permissions.join(","));for(const n of e.relays)t.append("relay",n);return`nostrconnect://${e.client}?`+t.toString()}function buildSigningPermissions(e){return[Permission.GetPublicKey,...e.map(e=>`${Permission.SignEvent}:${e}`)]}setHiddenContentEncryptionMethod(kinds_exports.NostrConnect,"nip44"),function(e){e.GetPublicKey="get_public_key",e.SignEvent="sign_event",e.Ping="ping",e.Nip04Encrypt="nip04_encrypt",e.Nip04Decrypt="nip04_decrypt",e.Nip44Encrypt="nip44_encrypt",e.Nip44Decrypt="nip44_decrypt",e.SwitchRelays="switch_relays"}(Permission||(Permission={})),function(e){e.Connect="connect",e.CreateAccount="create_account",e.GetPublicKey="get_public_key",e.SignEvent="sign_event",e.Ping="ping",e.Nip04Encrypt="nip04_encrypt",e.Nip04Decrypt="nip04_decrypt",e.Nip44Encrypt="nip44_encrypt",e.Nip44Decrypt="nip44_decrypt",e.SwitchRelays="switch_relays",e.Logout="logout"}(NostrConnectMethod||(NostrConnectMethod={}));var PrivateKeySigner=class e{key;constructor(e){this.key=e||generateSecretKey()}async getPublicKey(){return getPublicKey(this.key)}async signEvent(e){return finalizeEvent(e,this.key)}nip04={encrypt:async(e,t)=>nip04_exports.encrypt(this.key,e,t),decrypt:async(e,t)=>nip04_exports.decrypt(this.key,e,t)};nip44={encrypt:async(e,t)=>nip44_exports.v2.encrypt(t,nip44_exports.v2.utils.getConversationKey(this.key,e)),decrypt:async(e,t)=>nip44_exports.v2.decrypt(t,nip44_exports.v2.utils.getConversationKey(this.key,e))};static fromKey(t){const r=normalizeToSecretKey(t);if(!r)throw new Error("Invalid private key");return new e(r)}};async function defaultHandleAuth(e){window.open(e,"auth","width=400,height=600,resizable=no,status=no,location=no,toolbar=no,menubar=no")}var NostrConnectSigner=class e{static subscriptionMethod=void 0;static publishMethod=void 0;static pool=void 0;publishMethod;subscriptionMethod;log=logger$1.extend("NostrConnectSigner");signer;listening=!1;isConnected=!1;pubkey;relays;remote;get clientPubkey(){return getPublicKey(this.signer.key)}onAuth=defaultHandleAuth;verifyEvent=verifyEvent;connectSecret;bunkerSecret;get secret(){return this.connectSecret}set secret(e){this.connectSecret=e}nip04;nip44;constructor(t){this.relays=t.relays,this.pubkey=t.pubkey,this.remote=t.remote,this.connectSecret=t.connectSecret||t.secret||nanoid$1(12),this.bunkerSecret=t.bunkerSecret;const{subscriptionMethod:r,publishMethod:n}=getConnectionMethods(t,e);this.subscriptionMethod=(e,t)=>r(e,t),this.publishMethod=(e,t)=>n(e,t),t.onAuth&&(this.onAuth=t.onAuth),this.signer=t?.signer||new PrivateKeySigner,this.nip04={encrypt:this.nip04Encrypt.bind(this),decrypt:this.nip04Decrypt.bind(this)},this.nip44={encrypt:this.nip44Encrypt.bind(this),decrypt:this.nip44Decrypt.bind(this)}}req;async open(){if(this.listening)return;this.listening=!0;const e=await this.signer.getPublicKey();this.req=from(this.subscriptionMethod(this.relays,[{kinds:[kinds_exports.NostrConnect],"#p":[e]}])).pipe(repeat(),retry(),filter(e=>"string"!=typeof e)).subscribe(this.handleEvent.bind(this)),this.log("Opened",this.relays)}async close(){this.listening=!1,this.isConnected=!1,this.req&&(this.req.unsubscribe(),this.req=void 0),this.waitingPromise&&(this.waitingPromise.reject(new Error("Closed")),this.waitingPromise=null),this.log("Closed")}requests=new Map;auths=new Set;async handleEvent(e){if(this.verifyEvent(e)&&(!this.remote||e.pubkey===this.remote))try{const r=getHiddenContent(e)??(isNIP04Encrypted(e.content)?await this.signer.nip04.decrypt(e.pubkey,e.content):await this.signer.nip44.decrypt(e.pubkey,e.content));if(!r)return;const n=JSON.parse(r);if(!this.remote&&("ack"===n.result||this.connectSecret&&n.result===this.connectSecret))return this.log("Got ack response from",e.pubkey,n.result),this.isConnected=!0,this.remote=e.pubkey,this.waitingPromise?.resolve(),void(this.waitingPromise=null);if(n.id){const e=this.requests.get(n.id);if(!e)return;if(n.error)if(this.log("Got Error",n.id,n.result,n.error),"auth_url"===n.result){if(!this.auths.has(n.id)&&(this.auths.add(n.id),this.onAuth))try{await this.onAuth(n.error)}catch(t){e.reject(t)}}else e.reject(new Error(n.error));else n.result&&(this.log("Got Response",n.id,n.result),e.resolve(n.result))}}catch(t){}}async createRequestEvent(e,t=this.remote,r=kinds_exports.NostrConnect){if(!t)throw new Error("Missing target pubkey");return await this.signer.signEvent({kind:r,created_at:unixNow(),tags:[["p",t]],content:e})}async makeRequest(e,t,r=kinds_exports.NostrConnect){if(!this.remote)throw new Error("Missing remote signer pubkey");const n=nanoid$1(8),i={id:n,method:e,params:t},o=await this.signer.nip44.encrypt(this.remote,JSON.stringify(i)),s=await this.createRequestEvent(o,this.remote,r);this.log(`Sending ${n} (${e}) ${JSON.stringify(t)}`);const a=createDefer();this.requests.set(n,a);const l=this.publishMethod?.(this.relays,s);return l instanceof Promise?await l:"subscribe"in l&&await new Promise(e=>l.subscribe({complete:e})),this.log(`Sent ${n} (${e})`),a}async connect(e,t){if(!this.remote&&this.pubkey&&(this.remote=this.pubkey),!this.remote)throw new Error("Missing remote signer pubkey");await this.open();try{void 0!==e&&(this.bunkerSecret=e);const r=await this.makeRequest(NostrConnectMethod.Connect,[this.remote,this.bunkerSecret||"",t?.join(",")??""]);return this.isConnected=!0,r}catch(r){throw this.isConnected=!1,this.close(),r}}waitingPromise=null;waitForSigner(e){return this.isConnected?Promise.resolve():(this.open(),this.waitingPromise=createDefer(),e?.addEventListener("abort",()=>{this.waitingPromise?.reject(new Error("Aborted")),this.waitingPromise=null,this.close()},!0),this.waitingPromise)}async createAccount(e,t,r,n){if(!this.remote)throw new Error("Remote pubkey must be set");await this.open();try{const i=await this.makeRequest(NostrConnectMethod.CreateAccount,[e,t,r??"",n?.join(",")??""]);return this.pubkey=i,this.isConnected=!0,i}catch(i){throw this.isConnected=!1,this.close(),i}}async requireConnection(){this.isConnected||await this.connect()}async getPublicKey(){if(this.pubkey)return this.pubkey;await this.requireConnection();const e=await this.makeRequest(NostrConnectMethod.GetPublicKey,[]);if(!isHexKey(e))throw new Error("Remote signer returned an invalid public key");return e}async signEvent(e){await this.requireConnection();const t=await this.makeRequest(NostrConnectMethod.SignEvent,[JSON.stringify(e)]),r=JSON.parse(t);if(!this.verifyEvent(r))throw new Error("Invalid event");return r}async nip04Encrypt(e,t){return await this.requireConnection(),this.makeRequest(NostrConnectMethod.Nip04Encrypt,[e,t])}async nip04Decrypt(e,t){await this.requireConnection();const r=await this.makeRequest(NostrConnectMethod.Nip04Decrypt,[e,t]);return r.startsWith('["')&&r.endsWith('"]')?JSON.parse(r)[0]:r}async nip44Encrypt(e,t){return await this.requireConnection(),this.makeRequest(NostrConnectMethod.Nip44Encrypt,[e,t])}async nip44Decrypt(e,t){await this.requireConnection();const r=await this.makeRequest(NostrConnectMethod.Nip44Decrypt,[e,t]);return r.startsWith('["')&&r.endsWith('"]')?JSON.parse(r)[0]:r}async ping(){return await this.requireConnection(),this.makeRequest(NostrConnectMethod.Ping,[])}async switchRelays(){await this.requireConnection();const e=await this.makeRequest(NostrConnectMethod.SwitchRelays,[]);return null!==e&&Array.isArray(e)&&e.length>0&&(this.log("Switching relays from",this.relays,"to",e),this.relays=e,this.listening&&(await this.close(),await this.open())),e}async logout(){try{this.isConnected&&this.remote&&await this.makeRequest(NostrConnectMethod.Logout,[])}catch(error){this.log("Failed to send logout request",error)}finally{this.isConnected=!1,await this.close()}}getNostrConnectURI(e){return createNostrConnectURI({client:getPublicKey(this.signer.key),connectSecret:this.connectSecret,relays:this.relays,metadata:e})}getNbunksec(){if(!this.remote)throw new Error("Cant create nbunksec when remote signer is not set");return createNbunksec({remote:this.remote,clientKey:bytesToHex$2(this.signer.key),relays:this.relays,bunkerSecret:this.bunkerSecret})}static parseBunkerURI(e){return parseBunkerURI(e)}static parseNbunksec(e){return parseNbunksec(e)}static createNbunksec(e){return createNbunksec(e)}static buildSigningPermissions(e){return buildSigningPermissions(e)}static async fromBunkerURI(t,r){const{remote:n,relays:i,bunkerSecret:o}=e.parseBunkerURI(t),s=new e({relays:i,remote:n,bunkerSecret:o,...r});return await s.connect(o,r?.permissions),s}static async fromNbunksec(t,r){const{remote:n,clientKey:i,relays:o,bunkerSecret:s}=e.parseNbunksec(t),a=new e({relays:o,remote:n,signer:new PrivateKeySigner(hexToBytes$2(i)),bunkerSecret:s,...r});return await a.connect(s,r?.permissions),a}},secp256k1_CURVE=Object.freeze({p:115792089237316195423570985008687907853269984665640564039457584007908834671663n,n:115792089237316195423570985008687907852837564279074904382605163141518161494337n,h:1n,a:0n,b:7n,Gx:55066263022277343669578718895168534326250603453777594175500187360389116729240n,Gy:32670510020758816978083085130507043184471273380659243275938904335757337482424n}),{p:P,n:N,Gx:Gx,Gy:Gy,b:_b}=secp256k1_CURVE,L$1=32,L2=64,lengths={publicKey:33,publicKeyUncompressed:65,signature:L2,seed:48},err=(e="",t=Error)=>{const r=new t(e),{captureStackTrace:n}=Error;throw"function"==typeof n&&n(r,err),r},isBytes=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&1===e.BYTES_PER_ELEMENT,abytes=(e,t,r="")=>{const n=isBytes(e),i=e?.length,o=void 0!==t;return!n||o&&i!==t?err((r&&`"${r}" `)+"expected Uint8Array"+(o?` of length ${t}`:"")+", got "+(n?`length=${i}`:"type="+typeof e),n?RangeError:TypeError):e},u8n=e=>new Uint8Array(e),padh=(e,t)=>e.toString(16).padStart(t,"0"),bytesToHex=e=>{let t="";for(const r of abytes(e))t+=padh(r,2);return t},C$1={_0:48,_9:57,A:65,F:70,a:97,f:102},_ch=e=>e>=C$1._0&&e<=C$1._9?e-C$1._0:e>=C$1.A&&e<=C$1.F?e-(C$1.A-10):e>=C$1.a&&e<=C$1.f?e-(C$1.a-10):void 0,hexToBytes=e=>{const t="hex invalid";if("string"!=typeof e)return err(t);const r=e.length,n=r/2;if(r%2)return err(t);const i=u8n(n);for(let o=0,s=0;o<n;o++,s+=2){const r=_ch(e.charCodeAt(s)),n=_ch(e.charCodeAt(s+1));if(void 0===r||void 0===n)return err(t);i[o]=16*r+n}return i},concatBytes=(...e)=>{let t=0;for(const i of e)t+=abytes(i).length;const r=u8n(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r},big=BigInt,arange=(e,t,r,n="bad number: out of range")=>"bigint"!=typeof e?err(n,TypeError):t<=e&&e<r?e:err(n,RangeError),M$1=(e,t=P)=>{const r=e%t;return r>=0n?r:t+r},invert=(e,t)=>{(0n===e||t<=0n)&&err("no inverse n="+e+" mod="+t);let r=M$1(e,t),n=t,i=0n,o=1n,s=1n,a=0n;for(;0n!==r;){const e=n/r,t=n%r,l=i-s*e,c=o-a*e;n=r,r=t,i=s,o=a,s=l,a=c}return 1n===n?M$1(i,t):err("no inverse")},apoint=e=>e instanceof Point$1?e:err("Point expected"),koblitz=e=>M$1(M$1(e*e)*e+_b),FpIsValid=e=>arange(e,0n,P),FpIsValidNot0=e=>arange(e,1n,P),FnIsValidNot0=e=>arange(e,1n,N),isEven=e=>!(1n&e),u8of=e=>Uint8Array.of(e),getPrefix=e=>u8of(isEven(e)?2:3),lift_x=e=>{const t=koblitz(FpIsValidNot0(e));let r=1n;for(let n=t,i=(P+1n)/4n;i>0n;i>>=1n)1n&i&&(r=r*n%P),n=n*n%P;return M$1(r*r)!==t&&err("sqrt invalid"),isEven(r)?r:M$1(-r)},Point$1=class e{static BASE;static ZERO;X;Y;Z;constructor(e,t,r){this.X=FpIsValid(e),this.Y=FpIsValidNot0(t),this.Z=FpIsValid(r),Object.freeze(this)}static CURVE(){return secp256k1_CURVE}static fromAffine(t){const{x:r,y:n}=t;return 0n===r&&0n===n?I:new e(r,n,1n)}static fromBytes(t){abytes(t);const{publicKey:r,publicKeyUncompressed:n}=lengths;let i;const o=t.length,s=t[0],a=t.subarray(1),l=sliceBytesNumBE(a,0,L$1);if(o===r&&(2===s||3===s)){let t=lift_x(l);3===s&&(t=M$1(-t)),i=new e(l,t,1n)}return o===n&&4===s&&(i=new e(l,sliceBytesNumBE(a,L$1,L2),1n)),i?i.assertValidity():err("bad point: not on curve")}static fromHex(t){return e.fromBytes(hexToBytes(t))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(e){const{X:t,Y:r,Z:n}=this,{X:i,Y:o,Z:s}=apoint(e),a=M$1(t*s),l=M$1(i*n),c=M$1(r*s),u=M$1(o*n);return a===l&&c===u}is0(){return this.equals(I)}negate(){return new e(this.X,M$1(-this.Y),this.Z)}double(){return this.add(this)}add(t){const{X:r,Y:n,Z:i}=this,{X:o,Y:s,Z:a}=apoint(t);let l=0n,c=0n,u=0n;const h=M$1(3n*_b);let d=M$1(r*o),p=M$1(n*s),f=M$1(i*a),g=M$1(r+n),m=M$1(o+s);g=M$1(g*m),m=M$1(d+p),g=M$1(g-m),m=M$1(r+i);let y=M$1(o+a);return m=M$1(m*y),y=M$1(d+f),m=M$1(m-y),y=M$1(n+i),l=M$1(s+a),y=M$1(y*l),l=M$1(p+f),y=M$1(y-l),u=M$1(0n*m),l=M$1(h*f),u=M$1(l+u),l=M$1(p-u),u=M$1(p+u),c=M$1(l*u),p=M$1(d+d),p=M$1(p+d),f=M$1(0n*f),m=M$1(h*m),p=M$1(p+f),f=M$1(d-f),f=M$1(0n*f),m=M$1(m+f),d=M$1(p*m),c=M$1(c+d),d=M$1(y*m),l=M$1(g*l),l=M$1(l-d),d=M$1(g*p),u=M$1(y*u),u=M$1(u+d),new e(l,c,u)}subtract(e){return this.add(apoint(e).negate())}multiply(e,t=!0){if(!t&&0n===e)return I;if(FnIsValidNot0(e),1n===e)return this;if(this.equals(G))return wNAF(e).p;let r=I,n=G;for(let i=this;e>0n;i=i.double(),e>>=1n)1n&e?r=r.add(i):t&&(n=n.add(i));return r}multiplyUnsafe(e){return this.multiply(e,!1)}toAffine(){const{X:e,Y:t,Z:r}=this;if(this.equals(I))return{x:0n,y:0n};if(1n===r)return{x:e,y:t};const n=invert(r,P);return 1n!==M$1(r*n)&&err("inverse invalid"),{x:M$1(e*n),y:M$1(t*n)}}assertValidity(){const{x:e,y:t}=this.toAffine();return FpIsValidNot0(e),FpIsValidNot0(t),M$1(t*t)===koblitz(e)?this:err("bad point: not on curve")}toBytes(e=!0){const{x:t,y:r}=this.assertValidity().toAffine(),n=numTo32b(t);return e?concatBytes(getPrefix(r),n):concatBytes(u8of(4),n,numTo32b(r))}toHex(e){return bytesToHex(this.toBytes(e))}},G=new Point$1(Gx,Gy,1n),I=new Point$1(0n,1n,0n);Point$1.BASE=G,Point$1.ZERO=I;var bytesToNumBE=e=>big("0x"+(bytesToHex(e)||"0")),sliceBytesNumBE=(e,t,r)=>bytesToNumBE(e.subarray(t,r)),B256=2n**256n,numTo32b=e=>hexToBytes(padh(arange(e,0n,B256),L2)),W=8,pwindows=Math.ceil(256/W)+1,pwindowSize=128,precompute=()=>{const e=[];let t=G,r=t;for(let n=0;n<pwindows;n++){r=t,e.push(r);for(let n=1;n<pwindowSize;n++)r=r.add(t),e.push(r);t=r.double()}return e},Gpows=void 0,ctneg=(e,t)=>{const r=t.negate();return e?r:t},wNAF=e=>{const t=Gpows||(Gpows=precompute());let r=I,n=G;const i=2**W,o=big(255),s=big(W);for(let a=0;a<pwindows;a++){let l=Number(e&o);e>>=s,l>pwindowSize&&(l-=i,e+=1n);const c=a*pwindowSize,u=c,h=c+Math.abs(l)-1,d=a%2!=0,p=l<0;0===l?n=n.add(ctneg(d,t[u])):r=r.add(ctneg(p,t[h]))}return 0n!==e&&err("invalid wnaf"),{p:r,f:n}},sleep=e=>new Promise(t=>setTimeout(t,e));function xOnlyToXY(e){return Point$1.fromHex(e).toHex().substring(2)}var utf8Decoder=new TextDecoder("utf-8"),utf8Encoder=new TextEncoder;function base64Encode(e){return btoa(String.fromCharCode(...e))}function base64Decode(e){return new Uint8Array(atob(e).split("").map(e=>e.charCodeAt(0)))}var SerialPortSigner=class e{log=logger$1.extend("SerialPortSigner");writer=null;pubkey;get isConnected(){return!!this.writer}verifyEvent=verifyEvent;nip04;constructor(){this.nip04={encrypt:this.nip04Encrypt.bind(this),decrypt:this.nip04Decrypt.bind(this)}}lastCommand=null;async callMethodOnDevice(t,r,n={}){if(!e.SUPPORTED)throw new Error("Serial devices are not supported");if(this.writer||await this.connectToDevice(n),this.lastCommand)throw new Error("Previous command to device still pending!");const i=createDefer();return this.lastCommand=i,this.sendCommand(t,r),setTimeout(()=>{i.reject(new Error("Device timeout")),this.lastCommand===i&&(this.lastCommand=null)},6e3),this.lastCommand}async connectToDevice({onConnect:t,onDisconnect:r,onError:n,onDone:i}){let o,s=await window.navigator.serial.requestPort();await s.open({baudRate:9600}),await sleep(1e3),(async()=>{for(;s&&s.readable;){const t=new window.TextDecoderStream;s.readable.pipeTo(t.writable),o=t.readable.getReader();const r=this.readFromSerialPort(o);try{for(;;){const{value:t,done:n}=await r("\n");if(t){const{method:r,data:n}=this.parseResponse(t);if("/ping"===r&&this.log("Pong"),-1===e.PUBLIC_METHODS.indexOf(r))continue;this.log("Received: ",r,n),this.lastCommand&&(this.lastCommand.resolve(n),this.lastCommand=null)}if(n)return this.lastCommand=null,this.writer=null,void(i&&i())}}catch(error){if(error instanceof Error)throw this.writer=null,n&&n(error),this.lastCommand&&(this.lastCommand.reject(error),this.lastCommand=null),error}}})();const a=new window.TextEncoderStream;a.readable.pipeTo(s.writable),this.writer=a.writable.getWriter(),await this.sendCommand(e.METHOD_PING),await this.sendCommand(e.METHOD_PING,[window.location.host]),t&&t(),s.addEventListener("disconnect",()=>{this.log("Disconnected"),this.lastCommand=null,this.writer=null,r&&r()})}async sendCommand(e,t=[]){if(!this.writer)return;this.log("Send command",e,t);const r=[e].concat(t).join(" ");await this.writer.write(r+"\n")}readFromSerialPort(e){let t,r=[];return async(n="\n")=>{if(r.length)return{value:r.shift().trim(),done:!1};const i=[];for(t&&(i.push(t),t=void 0);;){const{value:o,done:s}=await e.read();if(o){const e=o.split(n);if(e.length>1)return i.push(e.shift()),t=e.pop(),r=e,{value:i.join("").trim(),done:!1};i.push(o)}if(s)return{value:i.join("").trim(),done:!0}}}}parseResponse(e){const t=e.split(" ")[0];return{method:t,data:e.substring(t.length).trim()}}async nip04Encrypt(t,r){const n=hexToBytes$2(await this.callMethodOnDevice(e.METHOD_SHARED_SECRET,[xOnlyToXY(t)]));let i=Uint8Array.from(window.crypto.getRandomValues(new Uint8Array(16))),o=utf8Encoder.encode(r),s=await crypto.subtle.importKey("raw",n,{name:"AES-CBC"},!1,["encrypt"]),a=await crypto.subtle.encrypt({name:"AES-CBC",iv:i},s,o);return`${base64Encode(new Uint8Array(a))}?iv=${base64Encode(new Uint8Array(i.buffer))}`}async nip04Decrypt(t,r){let[n,i]=r.split("?iv=");const o=hexToBytes$2(await this.callMethodOnDevice(e.METHOD_SHARED_SECRET,[xOnlyToXY(t)]));let s=await crypto.subtle.importKey("raw",o,{name:"AES-CBC"},!1,["decrypt"]),a=base64Decode(n),l=base64Decode(i),c=await crypto.subtle.decrypt({name:"AES-CBC",iv:l},s,a);return utf8Decoder.decode(c)}async getPublicKey(){const t=await this.callMethodOnDevice(e.METHOD_PUBLIC_KEY,[]);return this.pubkey=t,t}async restore(t){await this.callMethodOnDevice(e.METHOD_RESTORE,[bytesToHex$2(t)])}async signEvent(t){const r=t.pubkey||this.pubkey;if(!r)throw new Error("Unknown signer pubkey");const n={...t,id:getEventHash({...t,pubkey:r})},i=await this.callMethodOnDevice(e.METHOD_SIGN_MESSAGE,[n.id]),o={...n,sig:i,pubkey:r};if(!this.verifyEvent(o))throw new Error("Invalid signature");return o}ping(){this.sendCommand(e.METHOD_PING,[window.location.host])}static SUPPORTED="navigator"in globalThis&&!!navigator.serial;static METHOD_PING="/ping";static METHOD_LOG="/log";static METHOD_SIGN_MESSAGE="/sign-message";static METHOD_SHARED_SECRET="/shared-secret";static METHOD_PUBLIC_KEY="/public-key";static METHOD_RESTORE="/restore";static PUBLIC_METHODS=[e.METHOD_PUBLIC_KEY,e.METHOD_SIGN_MESSAGE,e.METHOD_SHARED_SECRET,e.METHOD_RESTORE]},device_exports=__exportAll({isMobile:()=>isMobile});function isMobile(){return"undefined"!=typeof navigator&&/Mobi|Android|iPhone|iPad/i.test(navigator.userAgent)}var nostr_auth_exports=__exportAll({default:()=>NostrAuthService}),STORAGE_KEY="marco:nostr_pubkey",STORAGE_KEY_TYPE="marco:nostr_signer_type",STORAGE_KEY_CONNECT_LOCAL_KEY="marco:nostr_connect_local_key",STORAGE_KEY_CONNECT_REMOTE_PUBKEY="marco:nostr_connect_remote_pubkey",STORAGE_KEY_CONNECT_RELAY="marco:nostr_connect_relay",DEFAULT_CONNECT_RELAY="wss://relay.nsec.app",NostrAuthService=class extends Service{static{decorateFieldV2(this.prototype,"nostrRelay",[service])}#q=void initializeDeferredDecorator(this,"nostrRelay");static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");static{decorateFieldV2(this.prototype,"pubkey",[tracked],function(){return null})}#W=void initializeDeferredDecorator(this,"pubkey");static{decorateFieldV2(this.prototype,"signerType",[tracked],function(){return null})}#K=void initializeDeferredDecorator(this,"signerType");static{decorateFieldV2(this.prototype,"connectStatus",[tracked],function(){return null})}#Y=void initializeDeferredDecorator(this,"connectStatus");static{decorateFieldV2(this.prototype,"connectUri",[tracked],function(){return null})}#Z=void initializeDeferredDecorator(this,"connectUri");_signerInstance=null;constructor(){super(...arguments),"undefined"!=typeof localStorage&&(localStorage.debug="applesauce:*");const e=localStorage.getItem(STORAGE_KEY),t=localStorage.getItem(STORAGE_KEY_TYPE);e&&(this.pubkey=e,this.signerType=t||"extension",this._verifyPubkey())}async _verifyPubkey(){if("extension"===this.signerType){if(void 0===window.nostr)return void this.disconnect();try{const e=await(new ExtensionSigner).getPublicKey();e!==this.pubkey&&(this.pubkey=e,localStorage.setItem(STORAGE_KEY,this.pubkey)),this.nostrData.loadProfile(this.pubkey)}catch(e){console.warn("Failed to verify extension nostr pubkey, logging out",e),this.disconnect()}}else if("connect"===this.signerType)try{await this._initConnectSigner()}catch(e){console.warn("Failed to verify connect nostr pubkey, logging out",e),this.disconnect()}}get isMobile(){return isMobile()}get isConnected(){return!!this.pubkey&&("extension"!==this.signerType||void 0!==window.nostr)}get signer(){return this._signerInstance?this._signerInstance:"extension"===this.signerType&&void 0!==window.nostr?new ExtensionSigner:(this.signerType,null)}async connectWithExtension(){if(void 0===window.nostr)throw new Error("No NIP-07 Nostr extension found (e.g., Alby, nos2x).");try{return this._signerInstance=new ExtensionSigner,this.pubkey=await this._signerInstance.getPublicKey(),this.signerType="extension",localStorage.setItem(STORAGE_KEY,this.pubkey),localStorage.setItem(STORAGE_KEY_TYPE,"extension"),this.nostrData.loadProfile(this.pubkey),this.pubkey}catch(error){throw console.error("Failed to get public key from extension:",error),error}}_getLocalSigner(){let e,t=localStorage.getItem(STORAGE_KEY_CONNECT_LOCAL_KEY);return t?e=PrivateKeySigner.fromKey(t):(e=new PrivateKeySigner,t=Array.from(e.key).map(e=>e.toString(16).padStart(2,"0")).join(""),localStorage.setItem(STORAGE_KEY_CONNECT_LOCAL_KEY,t)),e}async connectWithApp(){this.connectStatus="waiting";try{const t=this._getLocalSigner(),r=DEFAULT_CONNECT_RELAY;localStorage.setItem(STORAGE_KEY_CONNECT_RELAY,r),this._signerInstance=new NostrConnectSigner({pool:this.nostrRelay.pool,relays:[r],signer:t,onAuth:async e=>{confirm(`Your signer app requests authentication via a web page. Open it now?\n\nURL: ${e}`)&&window.open(e,"_blank")}}),this.connectUri=this._signerInstance.getNostrConnectURI({name:"Marco",url:window.location.origin,description:"An unhosted maps application.",icons:[]}),this.isMobile&&(console.debug("Mobile detected, triggering deep link intent."),window.location.href=this.connectUri),console.debug("Opening signer connection to relay..."),await this._signerInstance.open(),console.debug("Signer connection opened successfully."),console.debug("Waiting for remote signer to ack via relay...");try{await this._signerInstance.waitForSigner(),console.debug("Remote signer ack received!")}catch(e){throw console.error("Error while waiting for remote signer ack:",e),e}return this.pubkey=await this._signerInstance.getPublicKey(),this.signerType="connect",this.connectStatus="connected",localStorage.setItem(STORAGE_KEY,this.pubkey),localStorage.setItem(STORAGE_KEY_TYPE,"connect"),localStorage.setItem(STORAGE_KEY_CONNECT_REMOTE_PUBKEY,this._signerInstance.remote),this.nostrData.loadProfile(this.pubkey),this.pubkey}catch(error){throw this.connectStatus=null,console.error("Failed to connect via Nostr Connect:",error),error}}async _initConnectSigner(){const e=localStorage.getItem(STORAGE_KEY_CONNECT_REMOTE_PUBKEY),t=localStorage.getItem(STORAGE_KEY_CONNECT_RELAY)||DEFAULT_CONNECT_RELAY;if(!e)throw new Error("Missing Nostr Connect remote pubkey.");const r=this._getLocalSigner();if(this._signerInstance=new NostrConnectSigner({pool:this.nostrRelay.pool,relays:[t],signer:r,remote:e,onAuth:async e=>{confirm(`Your signer app requests authentication via a web page. Open it now?\n\nURL: ${e}`)&&window.open(e,"_blank")}}),await this._signerInstance.open(),await this._signerInstance.getPublicKey()!==this.pubkey)throw new Error("Remote signer pubkey mismatch");this.nostrData.loadProfile(this.pubkey)}async signEvent(e){if(!this.signer)throw new Error("Not connected or extension missing. Please connect Nostr again.");return await this.signer.signEvent(e)}async disconnect(){this.pubkey=null,this.nostrData?.loadProfile(null),this.signerType=null,this.connectStatus=null,this.connectUri=null,this._signerInstance&&"function"==typeof this._signerInstance.close&&await this._signerInstance.close(),this._signerInstance=null,localStorage.removeItem(STORAGE_KEY),localStorage.removeItem(STORAGE_KEY_TYPE),localStorage.removeItem(STORAGE_KEY_CONNECT_LOCAL_KEY),localStorage.removeItem(STORAGE_KEY_CONNECT_REMOTE_PUBKEY),localStorage.removeItem(STORAGE_KEY_CONNECT_RELAY)}},instanceOfAny=(e,t)=>t.some(t=>e instanceof t),idbProxyableTypes,cursorAdvanceMethods;function getIdbProxyableTypes(){return idbProxyableTypes||(idbProxyableTypes=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function getCursorAdvanceMethods(){return cursorAdvanceMethods||(cursorAdvanceMethods=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var transactionDoneMap=new WeakMap,transformCache=new WeakMap,reverseTransformCache=new WeakMap;function promisifyRequest(e){const t=new Promise((t,r)=>{const n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(wrap$1(e.result)),n()},o=()=>{r(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",o)});return reverseTransformCache.set(t,e),t}function cacheDonePromiseForTransaction(e){if(transactionDoneMap.has(e))return;const t=new Promise((t,r)=>{const n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),n()},o=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});transactionDoneMap.set(e,t)}var idbProxyTraps={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return transactionDoneMap.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return wrap$1(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function replaceTraps(e){idbProxyTraps=e(idbProxyTraps)}function wrapFunction(e){return getCursorAdvanceMethods().includes(e)?function(...t){return e.apply(unwrap(this),t),wrap$1(this.request)}:function(...t){return wrap$1(e.apply(unwrap(this),t))}}function transformCachableValue(e){return"function"==typeof e?wrapFunction(e):(e instanceof IDBTransaction&&cacheDonePromiseForTransaction(e),instanceOfAny(e,getIdbProxyableTypes())?new Proxy(e,idbProxyTraps):e)}function wrap$1(e){if(e instanceof IDBRequest)return promisifyRequest(e);if(transformCache.has(e))return transformCache.get(e);const t=transformCachableValue(e);return t!==e&&(transformCache.set(e,t),reverseTransformCache.set(t,e)),t}var unwrap=e=>reverseTransformCache.get(e);function openDB$1(e,t,{blocked:r,upgrade:n,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=wrap$1(s);return n&&s.addEventListener("upgradeneeded",e=>{n(wrap$1(s.result),e.oldVersion,e.newVersion,wrap$1(s.transaction),e)}),r&&s.addEventListener("blocked",e=>r(e.oldVersion,e.newVersion,e)),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}var readMethods=["get","getKey","getAll","getAllKeys","count"],writeMethods=["put","add","delete","clear"],cachedMethods=new Map;function getMethod(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(cachedMethods.get(t))return cachedMethods.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,i=writeMethods.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!i&&!readMethods.includes(r))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;return n&&(s=s.index(t.shift())),(await Promise.all([s[r](...t),i&&o.done]))[0]};return cachedMethods.set(t,o),o}replaceTraps(e=>({...e,get:(t,r,n)=>getMethod(t,r)||e.get(t,r,n),has:(t,r)=>!!getMethod(t,r)||e.has(t,r)}));var advanceMethodProps=["continue","continuePrimaryKey","advance"],methodMap={},advanceResults=new WeakMap,ittrProxiedCursorToOriginalProxy=new WeakMap,cursorIteratorTraps={get(e,t){if(!advanceMethodProps.includes(t))return e[t];let r=methodMap[t];return r||(r=methodMap[t]=function(...e){advanceResults.set(this,ittrProxiedCursorToOriginalProxy.get(this)[t](...e))}),r}};async function*iterate(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const r=new Proxy(t,cursorIteratorTraps);for(ittrProxiedCursorToOriginalProxy.set(r,t),reverseTransformCache.set(r,unwrap(t));t;)yield r,t=await(advanceResults.get(r)||t.continue()),advanceResults.delete(r)}function isIteratorProp(e,t){return t===Symbol.asyncIterator&&instanceOfAny(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&instanceOfAny(e,[IDBIndex,IDBObjectStore])}function validateEvent(e){if("object"!=typeof e||null===e)return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.id)return!1;if(!/^[a-f0-9]{64}$/.test(e.id))return!1;if("string"!=typeof e.pubkey)return!1;if(!/^[a-f0-9]{64}$/.test(e.pubkey))return!1;if(!Array.isArray(e.tags))return!1;for(const t of e.tags){if(!Array.isArray(t))return!1;for(const e of t)if("string"!=typeof e)return!1}return!0}function isReplaceableKind(e){return 0===e||3===e||e>=1e4&&e<2e4}function isAddressableKind(e){return e>=3e4&&e<4e4}function isEphemeralKind(e){return e>=2e4&&e<3e4}replaceTraps(e=>({...e,get:(t,r,n)=>isIteratorProp(t,r)?iterate:e.get(t,r,n),has:(t,r)=>isIteratorProp(t,r)||e.has(t,r)}));var IndexableTagsSymbol=Symbol.for("indexable-tags");function getIndexableTags(e){let t=Reflect.get(e,IndexableTagsSymbol);if(!t){t=new Set;for(const r of e.tags)r.length>=2&&1===r[0].length&&t.add(r[0]+":"+r[1]);Reflect.set(e,IndexableTagsSymbol,t)}return t}function matchFilter(e,t){if(e.ids&&-1===e.ids.indexOf(t.id))return!1;if(e.kinds&&-1===e.kinds.indexOf(t.kind))return!1;if(e.authors&&-1===e.authors.indexOf(t.pubkey))return!1;if(e.since&&t.created_at<e.since)return!1;if(e.until&&t.created_at>e.until)return!1;const r=getIndexableTags(t);for(const n in e)if("&"===n[0]){const t=n.slice(1),i=e[n];if(i&&i.length>0)for(const e of i)if(!r.has(t+":"+e))return!1}for(const n in e)if("#"===n[0]){const t=n.slice(1),i=e[n];if(i){const n=e[`&${t}`],o=n?i.filter(e=>!n.includes(e)):i;if(0===o.length)continue;if(!o.some(e=>r.has(t+":"+e)))return!1}}return!0}function matchFilters(e,t){for(let r=0;r<e.length;r++)if(matchFilter(e[r],t))return!0;return!1}var LETTERS="abcdefghijklmnopqrstuvwxyz",INDEXABLE_TAGS=(LETTERS+LETTERS.toUpperCase()).split(""),EventUIDSymbol=Symbol.for("event-uid");function getEventTags(e){return e.tags.filter(e=>e.length>=2&&1===e[0].length&&INDEXABLE_TAGS.includes(e[0])).map(e=>e[0]+e[1])}function getEventUID(e){if(Reflect.has(e,EventUIDSymbol))return Reflect.get(e,EventUIDSymbol);let t;if(isReplaceableKind(e.kind)||isAddressableKind(e.kind)){const r=e.tags.find(e=>"d"===e[0])?.[1];t=e.kind+":"+e.pubkey+":"+(r??"")}else t=e.id;return Reflect.set(e,EventUIDSymbol,t),t}var NOSTR_IDB_NAME="nostr-idb",NOSTR_IDB_VERSION=3;async function openDB(e=NOSTR_IDB_NAME,t){return await openDB$1(e,3,{...t,async upgrade(e,r,n,i,o){if(0===r){const t=e.createObjectStore("events");t.createIndex("id","event.id",{unique:!0}),t.createIndex("pubkey","event.pubkey"),t.createIndex("kind","event.kind"),t.createIndex("created_at","event.created_at"),t.createIndex("tags","tags",{multiEntry:!0}),e.createObjectStore("used",{keyPath:"uid"}).createIndex("date","date")}1===r&&(e.deleteObjectStore("events"),e.deleteObjectStore("used"),e.deleteObjectStore("seen")),r<=2&&await migrateReplaceableEventUIDs(i),t?.upgrade&&t.upgrade(e,r,n,i,o)}})}async function migrateReplaceableEventUIDs(e){const t=e.objectStore("events");let r=await t.openCursor();const n=[];for(;r;){const e=r.primaryKey,t=r.value,i=t.event;if(isReplaceableKind(i.kind)||isAddressableKind(i.kind)){const r=getEventUID(i);e!==r&&n.push({oldKey:e,newKey:r,value:t})}r=await r.continue()}for(const{oldKey:i,newKey:o,value:s}of n)await t.delete(i),await t.put(s,o)}function sortByDate(e,t){return t.created_at-e.created_at}var query_filter_exports=__exportAll({countEventsForFilters:()=>countEventsForFilters,getEventsForFilters:()=>getEventsForFilters,getIdsForFilter:()=>getIdsForFilter,getIdsForFilters:()=>getIdsForFilters,queryForKinds:()=>queryForKinds,queryForPubkeys:()=>queryForPubkeys,queryForTag:()=>queryForTag,queryForTagAnd:()=>queryForTagAnd,queryForTime:()=>queryForTime});function queryForPubkeys(e,t=[],r){const n=[],i=new Set;if(r)for(const l of t){const e=r.getPubkeyIndex(l);if(e){for(const t of e)i.add(t);n.push(l)}}if(n.length===t.length)return Promise.resolve(i);const o=e.transaction("events","readonly"),s=o.objectStore("events").index("pubkey"),a=t.filter(e=>!n.includes(e)).map(e=>s.getAllKeys(e).then(t=>((e,t)=>{for(const r of t)i.add(r);r&&r.setPubkeyIndex(e,new Set(t))})(e,t)));return o.commit(),Promise.all(a).then(()=>i)}function queryForTag(e,t,r,n){const i=[],o=new Set;if(n)for(const c of r){const e=n.getTagIndex(t+c);if(e){for(const t of e)o.add(t);i.push(c)}}if(i.length===r.length)return Promise.resolve(o);const s=e.transaction("events","readonly"),a=s.objectStore("events").index("tags"),l=r.map(e=>a.getAllKeys(t+e).then(r=>((e,r)=>{for(const t of r)o.add(t);n&&n.setTagIndex(t+e,new Set(r))})(e,r)));return s.commit(),Promise.all(l).then(()=>o)}function queryForTagAnd(e,t,r,n){if(0===r.length)return Promise.resolve(new Set);if(1===r.length)return queryForTag(e,t,r,n);const i=[],o=[];if(n)for(const c of r){const e=n.getTagIndex(t+c);e&&(o.push(e),i.push(c))}if(i.length===r.length)return Promise.resolve(intersectSets(o));const s=e.transaction("events","readonly"),a=s.objectStore("events").index("tags"),l=r.filter(e=>!i.includes(e)).map(e=>a.getAllKeys(t+e).then(r=>((e,r)=>{const i=new Set(r);o.push(i),n&&n.setTagIndex(t+e,i)})(e,r)));return s.commit(),Promise.all(l).then(()=>intersectSets(o))}function intersectSets(e){if(0===e.length)return new Set;const t=e.slice().sort((e,t)=>e.size-t.size);let r=t[0];for(let n=1;n<t.length;n++){const e=t[n],i=new Set;for(const t of r)e.has(t)&&i.add(t);if(r=i,0===r.size)return r}return r}function queryForKinds(e,t=[],r){const n=[],i=new Set;if(r)for(const l of t){const e=r.getKindIndex(l);if(e){for(const t of e)i.add(t);n.push(l)}}if(n.length===t.length)return Promise.resolve(i);const o=e.transaction("events","readonly"),s=o.objectStore("events").index("kind"),a=t.filter(e=>!n.includes(e)).map(e=>s.getAllKeys(e).then(t=>((e,t)=>{for(const r of t)i.add(r);r&&r.setKindIndex(e,new Set(t))})(e,t)));return o.commit(),Promise.all(a).then(()=>i)}async function queryForTime(e,t,r){let n;if(void 0!==t&&void 0!==r)n=IDBKeyRange.bound(t,r);else if(void 0!==t)n=IDBKeyRange.lowerBound(t);else{if(void 0===r)throw new Error("Missing since or until");n=IDBKeyRange.upperBound(r)}return(await e.getAllKeysFromIndex("events","created_at",n)).reverse()}async function getIdsForFilter(e,t,r){if(t.search)return new Set;if(t.ids)return new Set(t.ids);let n=null;const i=e=>{const t=e instanceof Set?e:new Set(e);if(n)for(const r of n)t.has(r)||n.delete(r);else n=t;return n};let o=null;void 0!==t.since&&(o=await queryForTime(e,t.since,t.until),i(o));for(const s of INDEXABLE_TAGS){const n=t[`&${s}`],o=t[`#${s}`];if(n?.length&&i(await queryForTagAnd(e,s,n,r)),o?.length){const t=n?.length?o.filter(e=>!n.includes(e)):o;t.length>0&&i(await queryForTag(e,s,t,r))}}if(t.authors&&i(await queryForPubkeys(e,t.authors,r)),t.kinds&&i(await queryForKinds(e,t.kinds,r)),void 0===t.since&&void 0!==t.until&&(o=await queryForTime(e,t.since,t.until),i(o)),t.limit&&o){const e=new Set;for(const r of o){if(e.size>=t.limit)break;n.has(r)&&e.add(r)}return e}if(null===n)throw new Error("Empty filter");return n}async function getIdsForFilters(e,t,r){if(0===t.length)throw new Error("No Filters");let n=new Set;for(const i of t){const t=await getIdsForFilter(e,i,r);for(const e of t)n.add(e)}return n}async function loadEventsByUID(e,t,r,n){const i=[];let o=[];if(n)for(const d of t){const e=n.get(d);e?i.push(e):o.push(d)}else o=t;const s=e.transaction("events","readonly"),a=s.objectStore("events"),l=e=>e&&i.push(e.event),c=Array.from(o).map(e=>a.get(e).then(l));s.commit();const u=await Promise.all(c).then(()=>i.sort(sortByDate));let h=1/0;for(const d of r)d.limit&&d.limit<h&&(h=d.limit);return u.length>h&&(u.length=h),u}async function getEventsForFilters(e,t,r,n){const i=await getIdsForFilters(e,t,r);return await loadEventsByUID(e,Array.from(i),t,n)}async function countEventsForFilters(e,t,r){return(await getIdsForFilters(e,t,r)).size}function countEvents(e){return e.transaction("events","readonly").store.count()}async function addEvents(e,t){const r=(t=t.filter(e=>validateEvent(e))).filter(e=>isReplaceableKind(e.kind)||isAddressableKind(e.kind)),n={};if(r.length>0){const t=e.transaction("events","readonly"),i=r.map(e=>{const r=getEventUID(e);return t.store.get(r).then(e=>e&&(n[r]=e.event.created_at))});t.commit(),await Promise.all(i)}const i=e.transaction("events","readwrite");for(const o of t){const e=getEventUID(o);(!n[e]||o.created_at>n[e])&&i.objectStore("events").put({event:o,tags:getEventTags(o)},e)}await i.commit()}async function updateUsed(e,t){const r=e.transaction("used","readwrite"),n=Math.floor((new Date).valueOf()/1e3);for(const i of t)r.objectStore("used").put({uid:i,date:n});await r.commit()}var logger=import_browser$1.default("nostr-idb"),log$3=logger.extend("prune");async function pruneLastUsed(e,t,r){const n=await countEvents(e);if(n<=t)return;const i=n-t;if(i<=0)return;log$3(`Pruning database to ${t}`);const o=(await e.getAll("used")).sort((e,t)=>e.date-t.date),s=[];let a=i;for(const h of o){if(a<=0)break;const t=h.uid;if(r){const n=await e.get("events",t);if(n&&r(n.event))continue}s.push(t),a--}if(0===s.length)return;const l=e.transaction("events","readwrite"),c=e.transaction("used","readwrite"),u=[];for(const h of s)u.push(l.store.delete(h)),u.push(c.store.delete(h));l.commit(),c.commit(),await Promise.all(u),log$3(`Removed ${s.length} old events`)}async function deleteEvent(e,t,r){const n=e.transaction("events","readwrite"),i=n.objectStore("events"),o=await i.get(t);if(!o)return await n.commit(),!1;if(await i.delete(t),await n.commit(),r){const e=o.event;r.removeEvent(e)}return!0}async function deleteReplaceable(e,t,r,n,i){if(!isReplaceableKind(r)&&!isAddressableKind(r))throw new Error(`Kind ${r} is not replaceable`);return await deleteEvent(e,`${r}:${t}:${n??""}`,i)}async function deleteByFilters(e,t,r){const n=await getIdsForFilters(e,t,r);return await deleteEventsByIds(e,Array.from(n),r)}async function deleteEventsByIds(e,t,r){if(0===t.length)return 0;const n=e.transaction("events","readwrite"),i=n.objectStore("events");let o=0;const s=[];for(const a of t){const e=await i.get(a);e&&(s.push(e.event),await i.delete(a),o++)}if(await n.commit(),r&&s.length>0)for(const a of s)r.removeEvent(a);return o}async function deleteAllEvents(e,t){const r=e.transaction("events","readwrite");await r.objectStore("events").clear(),await r.commit(),t&&t.clear()}var log$2=logger.extend("WriteQueue"),WriteQueue=class{db;queuedIds=new Set;eventQueue=[];lastUsedQueue=new Set;processEvents=null;constructor(e){this.db=e}addEvent(e){const t=getEventUID(e);this.queuedIds.has(t)||(this.eventQueue.push(e),this.queuedIds.add(t),this.touch(e))}addEvents(e){const t=e.filter(e=>!this.queuedIds.has(getEventUID(e)));if(0!==t.length){this.eventQueue.push(...t);for(const e of t)this.queuedIds.add(getEventUID(e));this.touch(t)}}touch(e){if(Array.isArray(e))for(const t of e)this.lastUsedQueue.add(getEventUID(t));else this.lastUsedQueue.add(getEventUID(e))}matchPending(e){return this.eventQueue.filter(t=>matchFilters(e,t))}async flush(e=1e3){if(this.eventQueue.length>0){let t=[];for(let r=0;r<e;r++){const e=this.eventQueue.shift();if(!e)break;t.push(e),this.queuedIds.delete(getEventUID(e))}this.processEvents&&(t=await this.processEvents(t)||t),await addEvents(this.db,t),log$2(`Wrote ${t.length} to database`),this.eventQueue.length>0&&log$2(`${this.eventQueue.length} left`)}this.lastUsedQueue.size>0&&(await updateUsed(this.db,this.lastUsedQueue),this.lastUsedQueue.clear())}clear(){this.eventQueue=[]}},log$1=logger.extend("cache:indexes"),Index=class extends Set{type;key;constructor(e,t,r){super(e),this.type=t,this.key=r}},IndexCache=class{kinds=new Map;pubkeys=new Map;tags=new Map;get count(){return this.kinds.size+this.pubkeys.size+this.tags.size}max=1e3;lastUsed=[];useIndex(e){const t=this.lastUsed.indexOf(e);-1!==t&&this.lastUsed.splice(t,t+1),this.lastUsed.push(e)}getKindIndex(e){const t=this.kinds.get(e);return t&&this.useIndex(t),t}setKindIndex(e,t){const r=new Index(t,"kind",e);this.kinds.set(e,r),this.useIndex(r),this.pruneIndexes()}getPubkeyIndex(e){const t=this.pubkeys.get(e);return t&&this.useIndex(t),t}setPubkeyIndex(e,t){const r=new Index(t,"pubkey",e);this.pubkeys.set(e,r),this.useIndex(r),this.pruneIndexes()}getTagIndex(e){const t=this.tags.get(e);return t&&this.useIndex(t),t}setTagIndex(e,t){const r=new Index(t,"tag",e);this.tags.set(e,r),this.useIndex(r),this.pruneIndexes()}addEventToIndexes(e){const t=getEventUID(e);this.getKindIndex(e.kind)?.add(t),this.getPubkeyIndex(e.pubkey)?.add(t);const r=getEventTags(e);for(const n of r)this.getTagIndex(n)?.add(t)}removeEvent(e){const t=getEventUID(e);this.getKindIndex(e.kind)?.delete(t),this.getPubkeyIndex(e.pubkey)?.delete(t);const r=getEventTags(e);for(const n of r)this.getTagIndex(n)?.delete(t)}clear(){this.kinds.clear(),this.pubkeys.clear(),this.tags.clear(),this.lastUsed=[]}pruneIndexes(){for(;this.lastUsed.length>0&&this.lastUsed.length>this.max;){const e=this.lastUsed.shift();if(!e)return;switch(log$1(`Forgetting ${e.type}:${e.key}`),e.type){case"kind":this.kinds.delete(e.key);break;case"pubkey":this.pubkeys.delete(e.key);break;case"tag":this.tags.delete(e.key)}}}},nanoid=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),""),scriptRel="modulepreload",assetsURL=function(e){return"/"+e},seen={},__vitePreload=function(e,t,r){let n=Promise.resolve();if(t&&t.length>0){const e=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),s=o?.nonce||o?.getAttribute("nonce");i=t.map(t=>{var n;if(n=t=assetsURL(t,r),(t=import.meta.resolve?import.meta.resolve(n):new URL(n,import.meta.url).href)in seen)return;seen[t]=!0;const i=t.endsWith(".css");for(let r=e.length-1;r>=0;r--){const n=e[r];if(n.href===t&&(!i||"stylesheet"===n.rel))return}const o=document.createElement("link");return o.rel=i?"stylesheet":scriptRel,i||(o.as="script"),o.crossOrigin="",o.href=t,s&&o.setAttribute("nonce",s),document.head.appendChild(o),i?new Promise((e,r)=>{o.addEventListener("load",e),o.addEventListener("error",()=>r(new Error(`Unable to preload CSS for ${t}`)))}):void 0}),n=Promise.all(i.map(e=>Promise.resolve(e).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))}var i;function o(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return n.then(t=>{for(const e of t||[])"rejected"===e.status&&o(e.reason);return e().catch(o)})},defaultOptions={batchWrite:1e3,writeInterval:100,cacheIndexes:1e3,pruneInterval:6e4,maxEvents:1e4},log=logger.extend("nostridb"),NostrIDB=class{options;running=!1;writeInterval;pruneInterval;eventMap=new Map;writeQueue=null;indexCache;db=null;baseEoseTimeout=4400;subscriptions=new Map;constructor(e,t={}){this.options={...defaultOptions,...t},e&&(this.db=e,this.writeQueue=new WriteQueue(e)),this.indexCache=new IndexCache,this.indexCache.max=this.options.cacheIndexes,this.start()}async getDb(){return this.db||(this.db=await openDB()),this.db}async getWriteQueue(){if(this.writeQueue)return this.writeQueue;const e=await this.getDb();return this.writeQueue=new WriteQueue(e),this.writeQueue}async flush(){await(await this.getWriteQueue()).flush(),this.writeInterval=setTimeout(this.flush.bind(this),this.options.writeInterval)}async start(){if(this.running)return;log("Starting"),this.running=!0;const e=await this.getDb();await this.flush(),this.pruneInterval=setInterval(()=>{pruneLastUsed(e,this.options.maxEvents)},this.options.pruneInterval)}async stop(){this.running&&(this.writeInterval&&(clearTimeout(this.writeInterval),this.writeInterval=void 0),this.pruneInterval&&(clearInterval(this.pruneInterval),this.pruneInterval=void 0),this.running=!1,log("Stopped"))}async add(e){isEphemeralKind(e.kind)||((await this.getWriteQueue()).addEvent(e),this.indexCache.addEventToIndexes(e));const t=getEventUID(e);if(!this.eventMap.has(t)){isEphemeralKind(e.kind)||this.eventMap.set(t,e);for(const[t,r]of this.subscriptions)r.event&&matchFilters(r.filters,e)&&r.event(e)}return!0}async event(e){return(await(await this.getDb()).get("events",e))?.event}async replaceable(e,t,r){return this.event([e,t,r??""].join(":"))}async count(e){const t=Array.isArray(e)?e:[e],r=await this.getDb();return await countEventsForFilters(r,t)}async query(e){const t=Array.isArray(e)?e:[e],r=await this.getDb(),n=(await this.getWriteQueue()).matchPending(t),i=await getEventsForFilters(r,t,this.indexCache,this.eventMap);this.addToEventMaps(i);const o=new Set(n.map(e=>getEventUID(e)));return n.length>0?[...i.filter(e=>!o.has(getEventUID(e))),...n].sort(sortByDate):i}async*subscribe(e){const t=Array.isArray(e)?e:[e],r=[],n=new Set;let i=null,o=!1;const s=this.subscribeInternal(t,{event:e=>{const t=getEventUID(e);if(!n.has(t)&&(n.add(t),r.push(e),i)){const e=i;i=null,e()}},complete:()=>{if(o=!0,i){const e=i;i=null,e()}}});try{for(;;){for(;r.length>0;)yield r.shift();if(o)break;await new Promise(e=>{i=e})}}finally{s.close()}}async supports(){return[]}async deleteEvent(e){const t=await this.getDb(),r=await deleteEvent(t,e,this.indexCache);return this.eventMap.delete(e),r}async deleteReplaceable(e,t,r){const n=await this.getDb(),i=await deleteReplaceable(n,e,t,r,this.indexCache);if(i){const n=`${t}:${e}:${r??""}`;this.eventMap.delete(n)}return i}async deleteByFilters(e){const t=Array.isArray(e)?e:[e],r=await this.getDb(),n=await this.getEventIdsForFilters(t),i=await deleteByFilters(r,t,this.indexCache);if(i>0)for(const o of n)this.eventMap.delete(o);return i}async deleteAllEvents(){const e=await this.getDb();await deleteAllEvents(e,this.indexCache),this.eventMap.clear()}async getEventIdsForFilters(e){const t=await this.getDb(),{getIdsForFilters:r}=await __vitePreload(async()=>{const{getIdsForFilters:e}=await Promise.resolve().then(()=>query_filter_exports);return{getIdsForFilters:e}},void 0),n=await r(t,e,this.indexCache);return Array.from(n)}addToEventMaps(e){for(const t of e)this.eventMap.set(getEventUID(t),t)}subscribeInternal(e,t){const r=nanoid(),n={id:r,filters:e,closed:!1,close:()=>this.unsubscribe(r),...t};return this.subscriptions.set(r,n),this.executeSubscription(n),n}async executeSubscription(e){const t=(new Date).valueOf();log(`Running ${e.id}`,e.filters);const r=(await this.getWriteQueue()).matchPending(e.filters);return new Promise(async n=>{const i=await this.getDb(),o=setTimeout(()=>{e.eose&&!e.closed&&e.eose(),n()},this.baseEoseTimeout);getEventsForFilters(i,e.filters,this.indexCache,this.eventMap).then(i=>{if(clearTimeout(o),this.addToEventMaps(i),e.event&&!e.closed){const n=new Set(r.map(e=>getEventUID(e))),o=r.length>0?[...i.filter(e=>!n.has(getEventUID(e))),...r].sort(sortByDate):i;for(const t of o)try{e.event(t)}catch(error){log("event handler failed with error",error)}const s=(new Date).valueOf()-t;log(`Finished ${e.id} took ${s}ms and got ${o.length} events`)}e.eose&&!e.closed&&e.eose(),n()})})}unsubscribe(e){const t=this.subscriptions.get(e);t&&(log(`Closing ${e}`),t.closed=!0,t.complete?.(),this.subscriptions.delete(e))}},nostr_exports=__exportAll({excludeRequiredRelays:()=>excludeRequiredRelays,mergeRequiredRelays:()=>mergeRequiredRelays,normalizeRelayUrl:()=>normalizeRelayUrl,parsePlacePhotos:()=>parsePlacePhotos,uniqNormalizedRelays:()=>uniqNormalizedRelays});function normalizeRelayUrl(e){if(!e)return"";let t=e.trim().toLowerCase();if(!t)return"";for(t.startsWith("ws://")||t.startsWith("wss://")||(t="wss://"+t);t.endsWith("/");)t=t.slice(0,-1);return t}function uniqNormalizedRelays(e=[]){return Array.from(new Set(e.map(normalizeRelayUrl).filter(Boolean)))}function mergeRequiredRelays(e=[],t=[]){const r=new Set(e.filter(Boolean)),n=[...e.filter(Boolean)];for(const i of uniqNormalizedRelays(t))r.has(i)||n.push(i);return n}function excludeRequiredRelays(e=[],t=[]){const r=new Set(t.filter(Boolean));return uniqNormalizedRelays(e).filter(e=>!r.has(e))}function parsePlacePhotos(e){if(!e||0===e.length)return[];const t=[...e].sort((e,t)=>e.created_at-t.created_at),r=[];for(const i of t){const e=i.tags.filter(e=>"t"===e[0]).map(e=>e[1]).filter(Boolean),t=i.tags.filter(e=>"imeta"===e[0]);for(const n of t){let t=null,o=null,s=null,a=!1,l=16/9,c=null,u=i.tags.find(e=>"i"===e[0])?.[1];for(const e of n.slice(1))if(e.startsWith("url "))t=e.substring(4);else if(e.startsWith("thumb "))o=e.substring(6);else if(e.startsWith("blurhash "))s=e.substring(9);else if(e.startsWith("dim ")){const[t,r]=e.substring(4).split("x").map(Number);t&&r&&(l=t/r,t>r&&(a=!0))}else if(e.startsWith("alt ")){const t=e.substring(4).trim();c="A photo of a place"===t?null:t||null}t&&r.push({eventId:i.id,pubkey:i.pubkey,createdAt:i.created_at,url:t,thumbUrl:o,blurhash:s,isLandscape:a,aspectRatio:l,placeIdentifier:u,tags:e,alt:c})}}if(0===r.length)return[];const n=r.findIndex(e=>e.isLandscape);if(n>0){const[e]=r.splice(n,1);r.unshift(e)}return r}var base32="0123456789bcdefghjkmnpqrstuvwxyz",Geohash=class e{static encode(t,r,n){if(void 0===n){for(let n=1;n<=12;n++){const i=e.encode(t,r,n),o=e.decode(i);if(o.lat==t&&o.lon==r)return i}n=12}if(t=Number(t),r=Number(r),n=Number(n),isNaN(t)||isNaN(r)||isNaN(n))throw new Error("Invalid geohash");let i=0,o=0,s=!0,a="",l=-90,c=90,u=-180,h=180;for(;a.length<n;){if(s){const e=(u+h)/2;r>=e?(i=2*i+1,u=e):(i*=2,h=e)}else{const e=(l+c)/2;t>=e?(i=2*i+1,l=e):(i*=2,c=e)}s=!s,5==++o&&(a+=base32.charAt(i),o=0,i=0)}return a}static decode(t){const r=e.bounds(t),n=r.sw.lat,i=r.sw.lon,o=r.ne.lat,s=r.ne.lon;let a=(n+o)/2,l=(i+s)/2;return a=a.toFixed(Math.floor(2-Math.log(o-n)/Math.LN10)),l=l.toFixed(Math.floor(2-Math.log(s-i)/Math.LN10)),{lat:Number(a),lon:Number(l)}}static bounds(e){if(0==e.length)throw new Error("Invalid geohash");e=e.toLowerCase();let t=!0,r=-90,n=90,i=-180,o=180;for(let s=0;s<e.length;s++){const a=e.charAt(s),l=base32.indexOf(a);if(-1==l)throw new Error("Invalid geohash");for(let e=4;e>=0;e--){const s=l>>e&1;if(t){const e=(i+o)/2;1==s?i=e:o=e}else{const e=(r+n)/2;1==s?r=e:n=e}t=!t}}return{sw:{lat:r,lon:i},ne:{lat:n,lon:o}}}static adjacent(t,r){if(t=t.toLowerCase(),r=r.toLowerCase(),0==t.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(r))throw new Error("Invalid direction");const n=t.slice(-1);let i=t.slice(0,-1);const o=t.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[r][o].indexOf(n)&&""!=i&&(i=e.adjacent(i,r)),i+base32.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[r][o].indexOf(n))}static neighbours(t){return{n:e.adjacent(t,"n"),ne:e.adjacent(e.adjacent(t,"n"),"e"),e:e.adjacent(t,"e"),se:e.adjacent(e.adjacent(t,"s"),"e"),s:e.adjacent(t,"s"),sw:e.adjacent(e.adjacent(t,"s"),"w"),w:e.adjacent(t,"w"),nw:e.adjacent(e.adjacent(t,"n"),"w")}}},geohash_coverage_exports=__exportAll({getGeohashPrefixesInBbox:()=>getGeohashPrefixesInBbox});function getGeohashPrefixesInBbox(e){const{minLat:t,minLon:r,maxLat:n,maxLon:i}=e,o=new Set;if(Math.abs(n-t)>20||Math.abs(i-r)>20)return console.debug("BBox too large for 4-char geohash scanning, aborting fine scan."),[];for(let a=t;a<=n+.1;a+=.1)for(let e=r;e<=i+.1;e+=.1){const t=Math.min(a,n),r=Math.min(e,i);try{const e=Geohash.encode(t,r,4);o.add(e)}catch(s){}}try{o.add(Geohash.encode(t,r,4))}catch(s){}try{o.add(Geohash.encode(n,i,4))}catch(s){}try{o.add(Geohash.encode(t,i,4))}catch(s){}try{o.add(Geohash.encode(n,r,4))}catch(s){}return Array.from(o)}var nostr_data_exports=__exportAll({default:()=>NostrDataService}),DIRECTORY_RELAYS=["wss://purplepag.es","wss://relay.damus.io","wss://nos.lol"],DEFAULT_READ_RELAYS=["wss://nostr.kosmos.org"],DEFAULT_WRITE_RELAYS=[],NostrDataService=class extends Service{static{decorateFieldV2(this.prototype,"nostrRelay",[service])}#q=void initializeDeferredDecorator(this,"nostrRelay");static{decorateFieldV2(this.prototype,"nostrAuth",[service])}#x=void initializeDeferredDecorator(this,"nostrAuth");static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");store=new EventStore;static{decorateFieldV2(this.prototype,"profile",[tracked],function(){return null})}#X=void initializeDeferredDecorator(this,"profile");static{decorateFieldV2(this.prototype,"mailboxes",[tracked],function(){return null})}#J=void initializeDeferredDecorator(this,"mailboxes");static{decorateFieldV2(this.prototype,"blossomServers",[tracked],function(){return[]})}#Q=void initializeDeferredDecorator(this,"blossomServers");static{decorateFieldV2(this.prototype,"placePhotos",[tracked],function(){return[]})}#ee=void initializeDeferredDecorator(this,"placePhotos");_profileSub=null;_mailboxesSub=null;_blossomSub=null;_photosSub=null;_requestSub=null;_cachePromise=null;loadedGeohashPrefixes=new Set;constructor(){super(...arguments),this._cachePromise=openDB("applesauce-events").then(async e=>{this.cache=new NostrIDB(e,{cacheIndexes:1e3,maxEvents:1e4}),await this.cache.start(),this._stopPersisting=persistEventsToCache(this.store,async e=>{const t=e.filter(e=>0===e.kind||5===e.kind||10002===e.kind||10063===e.kind||360===e.kind);t.length>0&&await Promise.all(t.map(e=>this.cache.add(e)))},{batchTime:1e3,maxBatchSize:100})}),this.nostrRelay.pool.relays$.subscribe(()=>{})}get requiredReadRelays(){return DEFAULT_READ_RELAYS}get requiredWriteRelays(){return DEFAULT_WRITE_RELAYS}get mailboxReadRelays(){return(this.mailboxes?.inboxes||[]).map(normalizeRelayUrl).filter(Boolean)}get mailboxWriteRelays(){return(this.mailboxes?.outboxes||[]).map(normalizeRelayUrl).filter(Boolean)}get configuredReadRelays(){return excludeRequiredRelays(uniqNormalizedRelays([...this.mailboxReadRelays,...this.settings.nostrReadRelays||[]]),this.settings.nostrReadRelayExclusions||[])}get configuredWriteRelays(){return excludeRequiredRelays(uniqNormalizedRelays([...this.mailboxWriteRelays,...this.settings.nostrWriteRelays||[]]),this.settings.nostrWriteRelayExclusions||[])}get activeReadRelays(){return mergeRequiredRelays(this.requiredReadRelays,this.configuredReadRelays)}get activeWriteRelays(){return mergeRequiredRelays(this.requiredWriteRelays,this.configuredWriteRelays)}async loadPlacesInBounds(e){const t=getGeohashPrefixesInBbox(e).filter(e=>!this.loadedGeohashPrefixes.has(e));if(0!==t.length){console.debug("[nostr-data] Loading place photos for prefixes:",t);try{await this._cachePromise;const e=await this.cache.query([{kinds:[360],"#g":t}]);if(e&&e.length>0)for(const t of e)this.store.add(t)}catch(r){console.warn("[nostr-data] Failed to read photos from local Nostr IDB cache",r)}this.nostrRelay.pool.request(this.activeReadRelays,[{kinds:[360],"#g":t}]).subscribe({next:e=>{this.store.add(e)},error:e=>{console.error("[nostr-data] Error fetching place photos by geohash:",e)}});for(const e of t)this.loadedGeohashPrefixes.add(e)}}async loadPhotosForPlace(e){if(this._photosSub&&(this._photosSub.unsubscribe(),this._photosSub=null),this.placePhotos=[],!e||!e.osmId||!e.osmType)return;const t=`osm:${e.osmType}:${e.osmId}`;this._photosSub=this.store.timeline([{kinds:[360],"#i":[t]}]).subscribe(e=>{this.placePhotos=e});try{await this._cachePromise;const e=await this.cache.query([{kinds:[360,5],"#i":[t]}]);if(e&&e.length>0)for(const t of e)this.store.add(t)}catch(r){console.warn("[nostr-data] Failed to read photos for place from local Nostr IDB cache",r)}this.nostrRelay.pool.request(this.activeReadRelays,[{kinds:[360,5],"#i":[t]}]).subscribe({next:e=>{this.store.add(e)},error:e=>{console.error("[nostr-data] Error fetching place photos for place:",e)}})}async loadProfile(e){if(!e)return;this.profile=null,this.mailboxes=null,this.blossomServers=[],this._cleanupSubscriptions(),this._profileSub=this.store.model(ProfileModel,e).subscribe(e=>{this.profile=e}),this._mailboxesSub=this.store.model(MailboxesModel,e).subscribe(e=>{this.mailboxes=e}),this._blossomSub=this.store.replaceable(10063,e).subscribe(e=>{e&&e.tags?this.blossomServers=e.tags.filter(e=>"server"===e[0]&&e[1]).map(e=>e[1]):this.blossomServers=[]});try{await this._cachePromise;const t=await this.cache.query([{authors:[e],kinds:[0,10002,10063]}]);if(t&&t.length>0)for(const e of t)this.store.add(e)}catch(r){console.warn("Failed to read from local Nostr IDB cache",r)}const t=Array.from(new Set([...DIRECTORY_RELAYS,...this.activeWriteRelays]));this._requestSub=this.nostrRelay.pool.request(t,[{authors:[e],kinds:[0,10002,10063]}]).subscribe({next:e=>{this.store.add(e)},error:e=>{console.error("Error fetching profile events:",e)}})}get userDisplayName(){if(this.profile){if(this.profile.nip05)return this.profile.nip05;if(this.profile.displayName||this.profile.display_name)return this.profile.displayName||this.profile.display_name;if(this.profile.name)return this.profile.name}if(this.nostrAuth.pubkey)try{const e=npubEncode(this.nostrAuth.pubkey);return`${e.slice(0,9)}...${e.slice(-4)}`}catch{return this.nostrAuth.pubkey}return"Not connected"}async clearCache(){await this._cachePromise,this.cache&&await this.cache.deleteAllEvents()}_cleanupSubscriptions(){this._requestSub&&(this._requestSub.unsubscribe(),this._requestSub=null),this._profileSub&&(this._profileSub.unsubscribe(),this._profileSub=null),this._mailboxesSub&&(this._mailboxesSub.unsubscribe(),this._mailboxesSub=null),this._blossomSub&&(this._blossomSub.unsubscribe(),this._blossomSub=null),this._photosSub&&(this._photosSub.unsubscribe(),this._photosSub=null)}willDestroy(){super.willDestroy(...arguments),this._cleanupSubscriptions(),this._stopPersisting&&this._stopPersisting(),this.cache&&this.cache.stop()}};function completeWhen(e,t=e=>!!e){return connect(r=>{const n=t?r.pipe(e,filter(t),take(1)):r.pipe(e,take(1));return r.pipe(takeUntil(n))})}function reverseSwitchMap(e){return operate((t,r)=>{let n=null,i=0,o=!1;const s=()=>{o&&!n&&r.complete()};t.subscribe(createOperatorSubscriber(r,t=>{const o=i++,a=n,l=n=createOperatorSubscriber(r,e=>r.next(e),()=>{n!==l&&null!==n||(n=null,s())});from(e(t,o)).subscribe(n),a?.unsubscribe()},()=>{o=!0,s()}))})}function errorToPublishResponse(e){return catchError(t=>of({ok:!1,from:e.url,message:t?.message||"Unknown error"}))}var RelayGroup=class e{relays$=new BehaviorSubject([]);status$;get relays(){if(this.relays$ instanceof BehaviorSubject)return this.relays$.value;throw new Error("This group was created with an observable, relays are not available")}constructor(e){this.relays$=Array.isArray(e)?new BehaviorSubject(e):e,this.status$=this.relays$.pipe(switchMap(e=>0===e.length?of({}):merge$1(...e.map(e=>e.status$)).pipe(scan((e,t)=>({...e,[t.url]:t}),{}),startWith({}))),shareReplay(1))}get controlled(){return this.relays$ instanceof BehaviorSubject==0}has(e){if(this.controlled)throw new Error("This group was created with an observable, relays are not available");return"string"==typeof e?this.relays.some(t=>t.url===e):this.relays.includes(e)}add(e){this.has(e)||this.relays$.next([...this.relays,e])}remove(e){this.has(e)&&this.relays$.next(this.relays.filter(t=>t!==e))}internalSubscription(e){const t=new WeakMap;return this.relays$.pipe(reverseSwitchMap(r=>{const n=[];for(const i of r){if(t.has(i)){n.push(t.get(i));continue}const r=e(i).pipe(catchError(e=>of({type:"ERROR",from:i.url,error:e})));n.push(r),t.set(i,r)}return merge$1(...n)}),share())}internalPublish(e){const t=new WeakMap;return this.relays$.pipe(take(1),switchMap(r=>{const n=[];for(const i of r){if(t.has(i)){n.push(t.get(i));continue}const r=e(i).pipe(errorToPublishResponse(i));n.push(r),t.set(i,r)}return merge$1(...n)}),share())}req(e,t){return this.internalSubscription(r=>r.req(e,t))}event(e){return this.internalPublish(t=>t.event(e))}async negentropy(e,t,r,n){const i=(await Promise.all(this.relays.map(async e=>[e,await e.getSupported()]))).filter(([e,t])=>t?.includes(77)).map(([e])=>e);if(0===i.length)throw new Error("No relays support NIP-77 negentropy sync");if(!n?.parallel)throw new Error("Negentropy sync must be parallel (for now)");return await Promise.allSettled(i.map(i=>i.negentropy(e,t,r,n))),!0}publish(e,t){return lastValueFrom(this.internalPublish(r=>from(r.publish(e,t))).pipe(toArray(),defaultIfEmpty([])))}request(t,r){const n=r?.complete??e.completeOnAny(e.completeAfterFirstRelay(5e3),e.completeOnAllEose());return this.internalSubscription(e=>e.req(t,{...r,reconnect:r?.reconnect??e.requestReconnect})).pipe(n?completeWhen(n):identity$1,timeout$1({first:r?.timeout??3e4}),filter(e=>"EVENT"===e.type),map(e=>e.event),null===r?.eventStore?identity$1:filterDuplicateEvents(r?.eventStore??new EventMemory),share())}subscription(e,t){return this.internalSubscription(r=>r.req(e,{...t,reconnect:t?.reconnect??r.subscriptionReconnect})).pipe(filter(e=>"EVENT"===e.type),map(e=>e.event),null===t?.eventStore?identity$1:filterDuplicateEvents(t?.eventStore??new EventMemory),share())}count(e,t=nanoid$1()){return this.relays$.pipe(switchMap(r=>combineLatest$1(Object.fromEntries(r.map(r=>[r.url,r.count(e,t)])))),share())}sync(e,t,r){return defer(async()=>{const e=(await Promise.all(this.relays.map(async e=>[e,await e.getSupported()]))).filter(([e,t])=>t?.includes(77)).map(([e])=>e);if(0===e.length)throw new Error("No relays support NIP-77 negentropy sync");return e}).pipe(switchMap(n=>merge$1(...n.map(n=>n.sync(e,t,r)))),share())}static completeAfterFirstRelay(e=5e3){return t=>t.pipe(filter(e=>"EOSE"===e.type)).pipe(take(1),switchMap(()=>timer(e)),map(()=>!0))}static completeOnAllEose(){return e=>e.pipe(filter(e=>"OPEN"===e.type||"EOSE"===e.type||"ERROR"===e.type),scan((e,t)=>e.set(t.from,t.type),new Map),map(e=>Array.from(e.values()).every(e=>"OPEN"!==e)))}static completeOnAny(...e){return connect(t=>merge$1(...e.map(e=>t.pipe(e))))}static completeOnAll(...e){return connect(t=>combineLatest$1(e.map(e=>t.pipe(e))).pipe(map(e=>e.every(e=>!!e))))}},ClientAuth=22242;function makeAuthEvent(e,t){return{kind:ClientAuth,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}var DEFAULT_WEBSOCKET_CONFIG={url:"",deserializer:function(e){return JSON.parse(e.data)},serializer:function(e){return JSON.stringify(e)}},WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",WebSocketSubject=function(e){function t(t,r){var n=e.call(this)||this;if(n._socket=null,t instanceof Observable$1)n.destination=r,n.source=t;else{var i=n._config=__assign({},DEFAULT_WEBSOCKET_CONFIG);if(n._output=new Subject,"string"==typeof t)i.url=t;else for(var o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);if(!i.WebSocketCtor&&WebSocket)i.WebSocketCtor=WebSocket;else if(!i.WebSocketCtor)throw new Error("no WebSocket constructor can be found");n.destination=new ReplaySubject}return n}return __extends(t,e),t.prototype.lift=function(e){var r=new t(this._config,this.destination);return r.operator=e,r.source=this,r},t.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new ReplaySubject),this._output=new Subject},t.prototype.multiplex=function(e,t,r){var n=this;return new Observable$1(function(i){try{n.next(e())}catch(err){i.error(err)}var o=n.subscribe({next:function(e){try{r(e)&&i.next(e)}catch(err){i.error(err)}},error:function(e){return i.error(e)},complete:function(){return i.complete()}});return function(){try{n.next(t())}catch(err){i.error(err)}o.unsubscribe()}})},t.prototype._connectSocket=function(){var e=this,t=this._config,r=t.WebSocketCtor,n=t.protocol,i=t.url,o=t.binaryType,s=this._output,a=null;try{a=n?new r(i,n):new r(i),this._socket=a,o&&(this._socket.binaryType=o)}catch(c){return void s.error(c)}var l=new Subscription(function(){e._socket=null,a&&1===a.readyState&&a.close()});a.onopen=function(t){if(!e._socket)return a.close(),void e._resetState();var r=e._config.openObserver;r&&r.next(t);var n=e.destination;e.destination=Subscriber.create(function(t){if(1===a.readyState)try{var r=e._config.serializer;a.send(r(t))}catch(c){e.destination.error(c)}},function(t){var r=e._config.closingObserver;r&&r.next(void 0),t&&t.code?a.close(t.code,t.reason):s.error(new TypeError(WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT)),e._resetState()},function(){var t=e._config.closingObserver;t&&t.next(void 0),a.close(),e._resetState()}),n&&n instanceof ReplaySubject&&l.add(n.subscribe(e.destination))},a.onerror=function(t){e._resetState(),s.error(t)},a.onclose=function(t){a===e._socket&&e._resetState();var r=e._config.closeObserver;r&&r.next(t),t.wasClean?s.complete():s.error(t)},a.onmessage=function(t){try{var r=e._config.deserializer;s.next(r(t))}catch(err){s.error(err)}}},t.prototype._subscribe=function(e){var t=this,r=this.source;return r?r.subscribe(e):(this._socket||this._connectSocket(),this._output.subscribe(e),e.add(function(){var e=t._socket;0===t._output.observers.length&&(!e||1!==e.readyState&&0!==e.readyState||e.close(),t._resetState())}),e)},t.prototype.unsubscribe=function(){var t=this._socket;!t||1!==t.readyState&&0!==t.readyState||t.close(),this._resetState(),e.prototype.unsubscribe.call(this)},t}(AnonymousSubject);function webSocket(e){return new WebSocketSubject(e)}var AUTH_REQUIRED_PREFIX="auth-required:",DEFAULT_RETRY_CONFIG={count:3,delay:(e,t)=>timer(1e3*t),resetOnSuccess:!0},SyncDirection;function normalizeRetryConfig(e){return"number"==typeof e?{...DEFAULT_RETRY_CONFIG,count:e}:{...DEFAULT_RETRY_CONFIG,...e??{}}}!function(e){e[e.RECEIVE=1]="RECEIVE",e[e.SEND=2]="SEND",e[e.BOTH=3]="BOTH"}(SyncDirection||(SyncDirection={}));var RelayClosedError=class extends Error{reason;constructor(e){super(e),this.reason=e,this.name="RelayClosedError"}},AuthRequiredError=class extends RelayClosedError{constructor(e){super(e),this.name="AuthRequiredError"}},CLOSED_ERROR_PREFIXES={"auth-required":AuthRequiredError,unsupported:RelayClosedError,error:RelayClosedError,blocked:RelayClosedError,restricted:RelayClosedError,"rate-limited":RelayClosedError,pow:RelayClosedError,invalid:RelayClosedError,duplicate:RelayClosedError,mute:RelayClosedError};function parseClosedError(e){const t=CLOSED_ERROR_PREFIXES[e.split(":")[0]];return t?new t(e):null}var PING_FILTER={ids:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],limit:0},Relay=class e{url;log=logger$1.extend("Relay");socket;_ready$=new BehaviorSubject(!0);ready$=this._ready$.asObservable();reconnectTimer;attempts$=new BehaviorSubject(0);connected$=new BehaviorSubject(!1);challenge$=new BehaviorSubject(null);authenticated$;authenticatedAs$;authentication$=new BehaviorSubject(null);authenticationResponse$=new BehaviorSubject(null);notices$=new BehaviorSubject([]);error$=new BehaviorSubject(null);message$;notice$;lastMessageReceivedAt=0;_lastMessageAt$=new BehaviorSubject(0);lastMessageAt$=this._lastMessageAt$.asObservable();status$;information$;_nip11=null;icon$;limitations$;supported$;open$=new Subject;close$=new Subject;closing$=new Subject;reqs$=new BehaviorSubject({});get ready(){return this._ready$.value}get connected(){return this.connected$.value}get challenge(){return this.challenge$.value}get notices(){return this.notices$.value}get authenticated(){return!0===this.authenticationResponse?.ok}get authentication(){return this.authentication$.value}get authenticatedAs(){return this.authenticated?this.authentication?.pubkey??null:null}get authenticationResponse(){return this.authenticationResponse$.value}get information(){return this._nip11}get lastMessageAt(){return this._lastMessageAt$.value}get reqs(){return this.reqs$.value}eventTimeout=1e4;publishTimeout=3e4;keepAlive=3e4;enablePing=!1;pingFrequency=29e3;pingTimeout=2e4;subscriptionReconnect;requestReconnect;publishRetry;onUnresponsive;receivedAuthRequiredForReq=new BehaviorSubject(!1);receivedAuthRequiredForEvent=new BehaviorSubject(!1);authRequiredForRead$;authRequiredForPublish$;resetState(){null!==this.challenge$.value&&this.challenge$.next(null),this.authenticationResponse$.value&&this.authenticationResponse$.next(null),null!==this.authentication$.value&&this.authentication$.next(null),this.notices$.value.length>0&&this.notices$.next([]),this.receivedAuthRequiredForReq.value&&this.receivedAuthRequiredForReq.next(!1),this.receivedAuthRequiredForEvent.value&&this.receivedAuthRequiredForEvent.next(!1)}watchTower;internalSubscriptions=new Subscription;reconnectSubscription=null;destroy$=new ReplaySubject(1);constructor(t,r){this.url=t,this.log=this.log.extend(t),void 0!==r?.eventTimeout&&(this.eventTimeout=r.eventTimeout),void 0!==r?.publishTimeout&&(this.publishTimeout=r.publishTimeout),void 0!==r?.keepAlive&&(this.keepAlive=r.keepAlive),void 0!==r?.enablePing&&(this.enablePing=r.enablePing),void 0!==r?.pingFrequency&&(this.pingFrequency=r.pingFrequency),void 0!==r?.pingTimeout&&(this.pingTimeout=r.pingTimeout),void 0!==r?.onUnresponsive&&(this.onUnresponsive=r.onUnresponsive),this.subscriptionReconnect=normalizeRetryConfig(r?.subscriptionReconnect),this.requestReconnect=normalizeRetryConfig(r?.requestReconnect),this.publishRetry={...DEFAULT_RETRY_CONFIG,...r?.publishRetry??{}},this.authenticated$=this.authenticationResponse$.pipe(map(e=>!0===e?.ok)),this.authenticatedAs$=combineLatest$1([this.authenticated$,this.authentication$]).pipe(map(([e,t])=>e&&t?t.pubkey:null)),this.reconnectTimer=e.createReconnectTimer(t),this.internalSubscriptions.add(this.open$.subscribe(()=>{this.log("Connected"),this.connected$.next(!0),this.attempts$.next(0),this.error$.next(null),this.resetState()})),this.internalSubscriptions.add(this.close$.subscribe(e=>{this.connected$.value?this.log("Disconnected"):this.log("Failed to connect"),this.connected$.value&&this.connected$.next(!1),this.attempts$.next(this.attempts$.value+1),this.resetState(),e.wasClean||this.startReconnectTimer(e)})),this.socket=webSocket({url:t,openObserver:this.open$,closeObserver:this.close$,closingObserver:this.closing$,WebSocketCtor:r?.WebSocket}),this.information$=defer(()=>(this.log("Fetching NIP-11 information document"),e.fetchInformationDocument(this.url))).pipe(catchError(()=>of(null)),tap(e=>this._nip11=e),shareReplay(1)),this.limitations$=this.information$.pipe(map(e=>e?e.limitation:null)),this.supported$=this.information$.pipe(map(e=>e&&Array.isArray(e.supported_nips)?e.supported_nips.filter(e=>"number"==typeof e):null)),this.icon$=this.information$.pipe(map(e=>e?.icon||new URL("/favicon.ico",ensureHttpURL(this.url)).toString())),this.authRequiredForRead$=this.receivedAuthRequiredForReq,this.authRequiredForPublish$=this.receivedAuthRequiredForEvent,this.internalSubscriptions.add(this.authRequiredForRead$.pipe(filter(e=>!0===e),take(1)).subscribe(()=>this.log("Auth required for REQ"))),this.internalSubscriptions.add(this.authRequiredForPublish$.pipe(filter(e=>!0===e),take(1)).subscribe(()=>this.log("Auth required for EVENT"))),this.status$=combineLatest$1({url:of(this.url),connected:this.connected$,authenticated:this.authenticated$,authenticatedAs:this.authenticatedAs$,ready:this._ready$,authRequiredForRead:this.authRequiredForRead$,authRequiredForPublish:this.authRequiredForPublish$,challenge:this.challenge$.asObservable()}).pipe(shareReplay(1));const n=this.socket.pipe(filter(e=>Array.isArray(e)&&"NOTICE"===e[0]),map(e=>e[1]),scan((e,t)=>[...e,t],[]),tap(e=>this.notices$.next(e))),i=this.socket.pipe(filter(e=>"AUTH"===e[0]),map(e=>e[1]),tap(e=>{this.log("Received AUTH challenge",e),this.challenge$.next(e)})),o=new Subject,s=this.socket.pipe(tap(e=>{const t=Date.now();this.lastMessageReceivedAt=t,this._lastMessageAt$.next(t),o.next(e)}));this.message$=o.asObservable(),this.notice$=this.message$.pipe(filter(e=>Array.isArray(e)&&"NOTICE"===e[0]),map(e=>e[1]));const a=this.connected$.pipe(switchMap(e=>e&&this.enablePing?timer(this.pingFrequency,this.pingFrequency).pipe(mergeMap(()=>{if(Date.now()-this.lastMessageReceivedAt<this.pingFrequency)return NEVER;const e="ping:"+nanoid$1();return this.send(["REQ",e,PING_FILTER]),this.message$.pipe(filter(t=>Array.isArray(t)&&("EOSE"===t[0]||"CLOSED"===t[0])&&t[1]===e),take(1),timeout$1({first:this.pingTimeout,with:()=>{const e=Date.now(),t=this.onUnresponsive?.({url:this.url,lastMessageAt:this.lastMessageReceivedAt,now:e,attempts:this.attempts$.value})??"reconnect",r=new Error(`Relay ping timeout after ${this.pingTimeout}ms`);return"reconnect"===t?(this.log("Relay connection has become unresponsive, triggering reconnect"),this.startReconnectTimer(r)):"close"===t?(this.log("Relay connection has become unresponsive, closing connection"),this.error$.next(r),this.socket.complete()):this.log("Relay connection has become unresponsive (ignoring per policy)"),NEVER}}),finalize(()=>this.send(["CLOSE",e])))})):NEVER),catchError(()=>NEVER));this.watchTower=this.ready$.pipe(switchMap(e=>e?merge$1(s,n,i,a).pipe(ignoreElements(),catchError(e=>(this.startReconnectTimer(e instanceof Error?e:new Error("Connection error")),NEVER)),share({resetOnRefCountZero:()=>timer(this.keepAlive).pipe(takeUntil(this.destroy$))})):NEVER),share())}startReconnectTimer(e){this.ready&&(this.error$.next(e instanceof Error?e:new Error("Connection error")),this._ready$.next(!1),this.reconnectSubscription?.unsubscribe(),this.reconnectSubscription=this.reconnectTimer(e,this.attempts$.value).pipe(take(1)).subscribe(()=>{this.reconnectSubscription=null,this._ready$.next(!0)}))}waitForAuth(e,t){return combineLatest$1([e,this.authenticated$]).pipe(mergeWith(this.watchTower),filter(([e,t])=>!e||t),take(1),switchMap(()=>t))}waitForReady(e){return this.ready?e:this.ready$.pipe(filter(e=>e),take(1),switchMap(()=>e))}multiplex(e,t,r){return this.socket.multiplex(e,t,r)}send(e){this.socket.next(e)}req(e,t){const r=t?.id??nanoid$1(),n=t?.waitForAuth??!0;let i;if("function"==typeof e){const t=e(this);i=(isObservable(t)?t:merge$1(of(t),NEVER)).pipe(map(e=>Array.isArray(e)?e:[e]))}else i=(isObservable(e)?e:merge$1(of(e),NEVER)).pipe(map(e=>Array.isArray(e)?e:[e]));const o=i.pipe(ignoreElements(),endWith(!0));let s=!1,a=!1;const l=this.socket.pipe(filter(e=>Array.isArray(e)&&("EVENT"===e[0]||"CLOSED"===e[0]||"EOSE"===e[0])&&e[1]===r),map(e=>"EVENT"===e[0]&&"object"==typeof e[2]?{type:"EVENT",from:this.url,id:e[1],event:e[2]}:"CLOSED"===e[0]?{type:"CLOSED",from:this.url,id:e[1],reason:e[2]??""}:{type:"EOSE",from:this.url,id:e[1]}),tap(e=>{if("CLOSED"===e.type){s=!0;const t=parseClosedError(e.reason);if(t)throw t;a=!0}}),takeWhile(e=>"CLOSED"!==e.type,!0),share()),c=i.pipe(map(e=>(s=!1,a=!1,this.socket.next(["REQ",r,...e]),this.reqs$.next({...this.reqs$.value,[r]:e}),{type:"OPEN",id:r,filters:e,from:this.url})),finalize(()=>{s||this.socket.next(["CLOSE",r]);const{[r]:e,...t}=this.reqs$.value;this.reqs$.next(t)}),switchMap(e=>l.pipe(startWith(e)))),u=merge$1(this.watchTower,c).pipe(takeUntil(l.pipe(ignoreElements(),endWith(!0))),takeUntil(o),tap(e=>{"EVENT"===e.type&&addSeenRelay(e.event,this.url)}),share()),h=n?this.waitForAuth(this.authRequiredForRead$,u):u;return defer(()=>this.waitForReady(h)).pipe(retry({delay:e=>e instanceof AuthRequiredError?(this.log("Auth required for REQ"),this.receivedAuthRequiredForReq.next(!0),n?this.authenticated$.pipe(filter(e=>e),take(1)):throwError(()=>e)):throwError(()=>e)}),this.customConnectionRetryOperator(t?.reconnect),this.customRepeatOperator(t?.resubscribe,()=>a),share())}count(e,t=nanoid$1()){let r=!1;const n=this.socket.pipe(filter(e=>Array.isArray(e)&&("COUNT"===e[0]||"CLOSED"===e[0])&&e[1]===t),map(e=>{if("COUNT"===e[0])return e[2];if("CLOSED"===e[0]){r=!0;const t=parseClosedError(e[2]??"");if(t)throw t}return null}),takeWhile(e=>null!==e,!0),filter(e=>null!==e),share()),i=defer(()=>(r=!1,this.socket.next(Array.isArray(e)?["COUNT",t,...e]:["COUNT",t,e]),n)).pipe(finalize(()=>{r||this.socket.next(["CLOSE",t])})),o=merge$1(this.watchTower,i).pipe(takeUntil(n.pipe(ignoreElements(),endWith(!0))),take(1),catchError(e=>(e instanceof AuthRequiredError&&!this.receivedAuthRequiredForReq.value&&(this.log("Auth required for COUNT"),this.receivedAuthRequiredForReq.next(!0)),throwError(()=>e))),timeout$1({first:1e4,with:()=>throwError(()=>new Error("COUNT timeout"))}));return this.waitForReady(this.waitForAuth(this.authRequiredForRead$,o)).pipe(share())}event(e,t="EVENT"){const r=defer(()=>(this.socket.next([t,e]),this.socket.pipe(filter(t=>"OK"===t[0]&&t[1]===e.id),map(e=>({ok:e[2],message:e[3],from:this.url}))))).pipe(share()),n=merge$1(this.watchTower,r).pipe(takeUntil(r.pipe(ignoreElements(),endWith(!0))),take(1),tap(({ok:e,message:t})=>{!1===e&&t?.startsWith(AUTH_REQUIRED_PREFIX)&&!this.receivedAuthRequiredForEvent.value&&(this.log("Auth required for publish"),this.receivedAuthRequiredForEvent.next(!0))}),timeout$1({first:this.eventTimeout,with:()=>of({ok:!1,from:this.url,message:"Timeout"})}));return"AUTH"===t?this.waitForReady(n).pipe(share()):this.waitForReady(this.waitForAuth(this.authRequiredForPublish$,n)).pipe(share())}auth(e){return this.authentication$.next(e),lastValueFrom(this.event(e,"AUTH").pipe(tap(e=>this.authenticationResponse$.next(e))))}async negentropy(e,t,r,n){if(!1===(await this.getSupported())?.includes(77))throw new Error("Relay does not support NIP-77");const{buildStorageVector:i,buildStorageFromFilter:o,negentropySync:s}=await __vitePreload(async()=>{const{buildStorageVector:e,buildStorageFromFilter:t,negentropySync:r}=await import("./negentropy-D4cKvxXZ.js");return{buildStorageVector:e,buildStorageFromFilter:t,negentropySync:r}},[]);return s(Array.isArray(e)?i(e):await o(e,t),this.socket,t,r,n)}authenticate(e){if(!this.challenge)throw new Error("Have not received authentication challenge");const t=e.signEvent(makeAuthEvent(this.url,this.challenge));return lastValueFrom((t instanceof Promise?from(t):of(t)).pipe(switchMap(e=>this.auth(e))))}customRetryOperator(e,t){return!1===e||void 0===e?identity$1:"number"==typeof e?retry({...t,count:e}):!0===e?t?retry(t):retry():retry({...t,...e})}customConnectionRetryOperator(e,t){if(!1===e||void 0===e)return identity$1;const r="number"==typeof e?{...t,count:e}:!0===e?t??{}:{...t,...e};return retry({...r,delay:(e,t)=>e instanceof RelayClosedError?throwError(()=>e):"number"==typeof r.delay?timer(r.delay):"function"==typeof r.delay?r.delay(e,t):of(null)})}customRepeatOperator(e,t){if(!1===e||void 0===e)return identity$1;const r=r=>{if(t&&!t())return EMPTY;if("object"==typeof e){if("number"==typeof e.delay)return timer(e.delay);if("function"==typeof e.delay)return e.delay(r)}return of(null)};return repeat(!0===e?{delay:r}:"number"==typeof e?{count:e,delay:r}:{...e,delay:r})}customTimeoutOperator(e,t){return!1===e?identity$1:simpleTimeout(!0===e?t:e??t)}subscription(e,t){return this.req(e,{...t,reconnect:t?.reconnect??this.subscriptionReconnect}).pipe(filter(e=>"EOSE"===e.type||"EVENT"===e.type),map(e=>"EOSE"===e.type?"EOSE":e.event),share())}request(e,t){return this.req(e,{...t,reconnect:t?.reconnect??this.requestReconnect}).pipe(t?.complete?completeWhen(t?.complete):identity$1,timeout$1({first:t?.timeout??3e4}),takeWhile(e=>"EOSE"!==e.type),filter(e=>"EVENT"===e.type),map(e=>e.event),share())}publish(e,t){return lastValueFrom(this.event(e).pipe(mergeMap(e=>!1===e.ok&&e.message?.startsWith(AUTH_REQUIRED_PREFIX)?throwError(()=>new AuthRequiredError(e.message??"")):of(e)),this.customRetryOperator(t?.retries??t?.reconnect??!0,this.publishRetry),this.customTimeoutOperator(t?.timeout,this.publishTimeout)))}sync(e,t,r=SyncDirection.RECEIVE){return new Observable$1(n=>{const i=new AbortController;let o=!1;return this.negentropy(e,t,async(t,i)=>{if(r&SyncDirection.SEND&&t.length>0){const r=await(async t=>Array.isArray(e)?e.filter(e=>t.includes(e.id)):e.getByFilters({ids:t}))(t);await Promise.allSettled(r.map(async e=>{const t=await lastValueFrom(this.event(e));return t.ok&&addSeenRelay(e,this.url),t}))}r&SyncDirection.RECEIVE&&i.length>0&&await lastValueFrom(this.req({ids:i}).pipe(takeWhile(e=>"EOSE"!==e.type),filter(e=>"EVENT"===e.type),map(e=>e.event),Reflect.has(e,"add")?mapEventsToStore(e):identity$1,tap(e=>n.next(e))))},{signal:i.signal}).then(()=>{o||n.complete()}).catch(e=>{o||n.error(e)}),()=>{o||(o=!0,i.abort())}}).pipe(share())}close(){this.destroy$.next(),this.destroy$.complete(),this.reconnectSubscription?.unsubscribe(),this.reconnectSubscription=null,this.internalSubscriptions.unsubscribe(),this.connected$.value&&this.connected$.next(!1),this._ready$.next(!1),this._ready$.complete(),this.socket.unsubscribe()}async getInformation(){return firstValueFrom(this.information$)}async getLimitations(){return firstValueFrom(this.limitations$)}async getSupported(){return firstValueFrom(this.supported$)}static fetchInformationDocument(e){return from(fetch(ensureHttpURL(e),{headers:{Accept:"application/nostr+json"}}).then(e=>e.json())).pipe(catchError(()=>of(null)),simpleTimeout(1e4))}static createReconnectTimer(e){return(e,t=0)=>timer(Math.min(1e3*Math.pow(1.5,t),3e5))}static afterOpen(e){return t=>t.pipe(filter(e=>"OPEN"===e.type),switchMap(()=>t.pipe(e)))}static completeOr(...e){return t=>combineLatest$1(e.map(e=>t.pipe(e,startWith(!1)))).pipe(map(e=>e.some(e=>!!e)))}static completeAnd(...e){return t=>combineLatest$1(e.map(e=>t.pipe(e,startWith(!1)))).pipe(map(e=>e.every(e=>!!e)))}static defaultComplete(e,t=1e4){return this.completeOr(()=>timer(e),this.afterOpen(()=>timer(t)))}},RelayPool=class{options;relays$=new BehaviorSubject(new Map);get relays(){return this.relays$.value}status$;ignoreOffline=!1;add$=new Subject;remove$=new Subject;constructor(e){this.options=e,this.status$=this.relays$.pipe(map(e=>Array.from(e.values())),switchMap(e=>0===e.length?of({}):merge$1(...e.map(e=>e.status$)).pipe(scan((e,t)=>({...e,[t.url]:t}),{}),startWith({}))),shareReplay(1))}relay(e){e=normalizeURL(e);let t=this.relays.get(e);return t||(t=new Relay(e,this.options),this.relays.set(e,t),this.relays$.next(this.relays),this.add$.next(t),t)}group(e,t=this.ignoreOffline){let r=Array.isArray(e)?e.map(e=>this.relay(e)):e.pipe(map(e=>e.map(e=>this.relay(e))));return t&&(r=(Array.isArray(r)?of(r):r).pipe(switchMap(e=>0===e.length?of([]):combineLatest$1(e.map(e=>e.ready$.pipe(filter(e=>e),take(1),map(()=>e),startWith(null)))).pipe(map(e=>e.filter(e=>null!==e)))))),new RelayGroup(r)}remove(e,t=!0){let r;if("string"==typeof e){if(r=this.relays.get(e),!r)return}else{if(!Array.from(this.relays.values()).some(t=>t===e))return;r=e}t&&r?.close(),this.relays.delete(r.url),this.relays$.next(this.relays),this.remove$.next(r)}close(){for(const e of[...this.relays.values()])this.remove(e,!0)}req(e,t,r){return this.group(e).req(t,r)}event(e,t){return this.group(e).event(t)}negentropy(e,t,r,n,i){return this.group(e).negentropy(t,r,n,i)}publish(e,t,r){return this.group(e).publish(t,r)}request(e,t,r){return this.group(e).request(t,r)}subscription(e,t,r){return this.group(e).subscription(t,r)}subscriptionMap(e,t){const r=isObservable(e)?e:of(e);return this.group(r.pipe(map(e=>Object.keys(e)))).subscription(e=>r.pipe(map(t=>t[e.url]),distinctUntilChanged(isFilterEqual)),t)}outboxSubscription(e,t,r){const n=isObservable(e)?e.pipe(map(e=>createFilterMap(e,t))):createFilterMap(e,t);return this.subscriptionMap(n,r)}count(e,t,r){return this.group(e,!1).count(t,r)}sync(e,t,r,n){return this.group(e,!1).sync(t,r,n)}},nostr_relay_exports=__exportAll({default:()=>NostrRelayService}),NostrRelayService=class extends Service{pool=new RelayPool({enablePing:!0});async publish(e,t){if(!e||0===e.length)throw new Error("No relays provided to publish the event.");const r=await this.pool.publish(e,t);if(!r.some(e=>e.ok))throw new Error(`Failed to publish event. Responses: ${JSON.stringify(r)}`);return r}},ErrorOAuth2=class{},ErrorUnknown=class extends ErrorOAuth2{constructor(e){super(),this.message=e}},ErrorNoAccessToken=class extends ErrorOAuth2{},ErrorNoAuthCode=class extends ErrorOAuth2{},ErrorInvalidReturnedStateParam=class extends ErrorOAuth2{},ErrorInvalidScope=class extends ErrorOAuth2{},ErrorInvalidRequest=class extends ErrorOAuth2{},ErrorInvalidToken=class extends ErrorOAuth2{},ErrorAuthenticationGrant=class extends ErrorOAuth2{},ErrorUnauthorizedClient=class extends ErrorAuthenticationGrant{},ErrorAccessDenied=class extends ErrorAuthenticationGrant{},ErrorUnsupportedResponseType=class extends ErrorAuthenticationGrant{},ErrorServerError=class extends ErrorAuthenticationGrant{},ErrorTemporarilyUnavailable=class extends ErrorAuthenticationGrant{},ErrorAccessTokenResponse=class extends ErrorOAuth2{},ErrorInvalidClient=class extends ErrorAccessTokenResponse{},ErrorInvalidGrant=class extends ErrorAccessTokenResponse{},ErrorUnsupportedGrantType=class extends ErrorAccessTokenResponse{},ErrorAccessTokenExpired=class extends ErrorOAuth2{},RAW_ERROR_TO_ERROR_CLASS_MAP={invalid_request:ErrorInvalidRequest,invalid_grant:ErrorInvalidGrant,unauthorized_client:ErrorUnauthorizedClient,access_denied:ErrorAccessDenied,unsupported_response_type:ErrorUnsupportedResponseType,invalid_scope:ErrorInvalidScope,server_error:ErrorServerError,temporarily_unavailable:ErrorTemporarilyUnavailable,invalid_client:ErrorInvalidClient,unsupported_grant_type:ErrorUnsupportedGrantType,invalid_token:ErrorInvalidToken},toErrorObject=e=>{const t=RAW_ERROR_TO_ERROR_CLASS_MAP[e];return t?new t:new ErrorUnknown(e)},RECOMMENDED_CODE_VERIFIER_LENGTH=96,PKCE_CHARSET="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",parseWwwAuthenticateHeader=e=>{const t=e.slice(7).replace(/"/g,"").split(",").map(e=>{const[t,r]=e.trim().split("=");return{[t]:r}}).reduce((e,t)=>({...e,...t}),{});return{realm:t.realm,error:t.error,errorDescription:t.error_description,errorUri:t.error_uri}},base64urlEncode=e=>{let t=btoa(e);return t=t.replace(/\+/g,"-"),t=t.replace(/\//g,"_"),t=t.replace(/=/g,""),t},extractParamFromUrl=(e,t)=>{let r=t.split("?");if(r.length<2)return;r=r[1].split("#");const n=r[0].split("&");for(const i of n){const[t,r]=i.split("=");if(t===e)return decodeURIComponent(r)}},objectToQueryString=e=>Object.entries(e).map(([e,t])=>`${e}=${encodeURIComponent(t)}`).join("&"),generatePKCECodeChallengeAndVerifier=async()=>{const e=new Uint32Array(RECOMMENDED_CODE_VERIFIER_LENGTH);crypto.getRandomValues(e);const t=base64urlEncode(Array.from(e).map(e=>PKCE_CHARSET[e%PKCE_CHARSET.length]).join("")),r=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)),n=new Uint8Array(r);let i="";const o=n.byteLength;for(let s=0;s<o;s++)i+=String.fromCharCode(n[s]);return{codeChallenge:base64urlEncode(i),codeVerifier:t}},generateRandomState=e=>{const t=new Uint32Array(e);return crypto.getRandomValues(t),Array.from(t).map(e=>PKCE_CHARSET[e%PKCE_CHARSET.length]).join("")},HEADER_AUTHORIZATION="Authorization",HEADER_WWW_AUTHENTICATE="WWW-Authenticate",RECOMMENDED_STATE_LENGTH=32,OAuth2AuthCodePkceClient=class{constructor(e,t){this.state={},this.config=e,this.storage=t||LocalStorage,this.ready=new Promise(e=>this.setReady=e),this.recoverState()}async reset(){this.state={},await this.saveState(),this.authCodeForAccessTokenPromise=void 0,this.refreshTokenForAccessTokenPromise=void 0}async requestAuthorizationCode(e){const{clientId:t,extraAuthorizationParams:r,redirectUrl:n,scopes:i}=this.config,{codeChallenge:o,codeVerifier:s}=await generatePKCECodeChallengeAndVerifier(),a=generateRandomState(32);this.state={...this.state,codeChallenge:o,codeVerifier:s,stateQueryParam:a},await this.saveState();let l=this.config.authorizationUrl+`?response_type=code&client_id=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(n)}&state=${a}&code_challenge=${encodeURIComponent(o)}&code_challenge_method=S256`;if(i&&(l+=`&scope=${encodeURIComponent(i.join(" "))}`),r||e){const t={...r,...e};l+=`&${objectToQueryString(t)}`}location.replace(l)}isReturningFromAuthServer(){return!!extractParamFromUrl("code",location.href)}async receiveCode(){await this.ready;const e=extractParamFromUrl("error",location.href);if(e)throw toErrorObject(e);if(extractParamFromUrl("state",location.href)!==this.state.stateQueryParam)throw console.warn('"state" parameter doesn\'t match the one sent! Possible malicious activity.'),new ErrorInvalidReturnedStateParam;if(this.state.authorizationCode=extractParamFromUrl("code",location.href),!this.state.authorizationCode)throw new ErrorNoAuthCode;this.saveState()}async getTokens(e){const{accessToken:t,authorizationCode:r,idToken:n,refreshToken:i,scopes:o}=this.state;if(r)return this.exchangeAuthCodeForAccessToken(e);if(!t)throw new ErrorNoAccessToken;if(this.isAccessTokenExpired()){if(this.config.onAccessTokenExpiry)return this.config.onAccessTokenExpiry();throw new ErrorAccessTokenExpired}return Promise.resolve({accessToken:t,idToken:n,refreshToken:i,scopes:o})}async exchangeAuthCodeForAccessToken(e){this.authCodeForAccessTokenPromise||(this.authCodeForAccessTokenPromise=this.fetchAccessTokenUsingCode(e));const t=await this.authCodeForAccessTokenPromise;return this.authCodeForAccessTokenPromise=void 0,this.state.authorizationCode=void 0,this.setTokens(t)}async exchangeRefreshTokenForAccessToken(){this.refreshTokenForAccessTokenPromise||(this.refreshTokenForAccessTokenPromise=this.fetchAccessTokenUsingRefreshToken());const e=await this.refreshTokenForAccessTokenPromise;return this.refreshTokenForAccessTokenPromise=void 0,this.setTokens(e)}makeRetryFetchFunction(e){return async(t,...r)=>{const n=await e(t,...r);if(401===n.status){const i=n.headers.get(HEADER_WWW_AUTHENTICATE.toLowerCase());if(i&&"invalid_token"===parseWwwAuthenticateHeader(i).error)return await this.exchangeRefreshTokenForAccessToken(),t=await this.requestInterceptor(t),e(t,...r)}return n}}decorateFetchWithInterceptors(e){return async(t,...r)=>{"string"==typeof t&&(t=new Request(t)),t=await this.requestInterceptor(t);const n=await e(t,...r);return this.responseInterceptor(n)}}async requestInterceptor(e){const t=await this.getTokens();return e.headers.set(HEADER_AUTHORIZATION,`Bearer ${t.accessToken}`),e}async responseInterceptor(e){if(401!==e.status)return e;const t=e.headers.get(HEADER_WWW_AUTHENTICATE.toLowerCase());if(t){const e=parseWwwAuthenticateHeader(t).error;throw"invalid_grant"===e&&this.config.onInvalidGrant&&await this.config.onInvalidGrant(),"invalid_token"===e&&this.config.onInvalidToken&&await this.config.onInvalidToken(),toErrorObject(e)}return e}getGrantedScopes(){return this.state.scopes}isAuthorized(){return!!this.state.accessToken}isAccessTokenExpired(){const{accessTokenExpiry:e}=this.state;return Boolean(e&&new Date>=new Date(e))}async fetchAccessTokenUsingCode(e){const{authorizationCode:t,codeVerifier:r=""}=this.state,{clientId:n,redirectUrl:i}=this.config;r?t||console.warn("No authorization grant code is being passed."):console.warn("No code verifier is being sent.");const o=this.config.tokenUrl,s={grant_type:"authorization_code",code:t,redirect_uri:i,client_id:n,code_verifier:r,...e},a=new URLSearchParams(s).toString();return this.makeTokenRequest(o,a)}fetchAccessTokenUsingRefreshToken(){const{extraRefreshParams:e,clientId:t,tokenUrl:r}=this.config,{refreshToken:n}=this.state;n||console.warn("No refresh token is present.");const i=r;let o=`grant_type=refresh_token&refresh_token=${n}&client_id=${t}`;return e&&(o=`${o}&${objectToQueryString(e)}`),this.makeTokenRequest(i,o)}async makeTokenRequest(e,t){const r=await fetch(e,{method:"POST",body:t,headers:{"Content-Type":"application/x-www-form-urlencoded"}}),n=await r.json();if(!r.ok)throw"invalid_grant"===n.error&&this.config.onInvalidGrant&&await this.config.onInvalidGrant(),toErrorObject(n.error);const{access_token:i,expires_in:o,id_token:s,refresh_token:a,scope:l}=n;return{accessToken:i,expiresIn:o,idToken:s,refreshToken:a,scope:l}}async setTokens(e){const{accessToken:t,expiresIn:r,idToken:n,refreshToken:i,scope:o}=e;return this.state.accessToken=t,r&&(this.state.accessTokenExpiry=new Date(Date.now()+1e3*parseInt(r,10)).toString()),n&&(this.state.idToken=n),i&&(this.state.refreshToken=i),o&&(this.state.scopes=o.split(" ")),await this.saveState(),{accessToken:this.state.accessToken,idToken:this.state.idToken,refreshToken:this.state.refreshToken,scopes:o?this.state.scopes:[]}}async recoverState(){this.state=JSON.parse(await this.storage.loadState()||"{}"),this.setReady(),this.config.storeRefreshToken||(this.state.refreshToken=this.refreshToken)}async saveState(){this.refreshToken=this.state.refreshToken;const e={...this.state};this.config.storeRefreshToken||delete e.refreshToken,await this.storage.saveState(JSON.stringify(e))}},LOCALSTORAGE_STATE="oauth2authcodepkce-state",LocalStorage={saveState:e=>localStorage.setItem(LOCALSTORAGE_STATE,e),loadState:()=>localStorage.getItem(LOCALSTORAGE_STATE)},osm_auth_exports=__exportAll({default:()=>OsmAuthService}),MarcoOsmAuthStorage=class{saveState(e){localStorage.setItem("marco:osm_auth_state",e)}loadState(){const e=localStorage.getItem("marco:osm_auth_state");if(!e)return!1;try{return JSON.parse(e),e}catch(t){return console.warn("Failed to parse OSM auth state",t),!1}}},OsmAuthService=class extends Service{static{decorateFieldV2(this.prototype,"isConnected",[tracked],function(){return!1})}#te=void initializeDeferredDecorator(this,"isConnected");static{decorateFieldV2(this.prototype,"userDisplayName",[tracked],function(){return null})}#re=void initializeDeferredDecorator(this,"userDisplayName");oauthClient;constructor(){super(...arguments);const e="https://www.openstreetmap.org",t=`${window.location.origin}/oauth/osm/callback`;this.oauthClient=new OAuth2AuthCodePkceClient({scopes:["read_prefs","write_api"],authorizationUrl:`${e}/oauth2/authorize`,tokenUrl:`${e}/oauth2/token`,clientId:"jIn8l5mT8FZOGYiIYXG1Yvj_2FZKB9TJ1edZwOJPsRU",redirectUrl:t,storeRefreshToken:!0,onAccessTokenExpiry(){return this.exchangeRefreshTokenForAccessToken()}},new MarcoOsmAuthStorage),this.restoreSession()}async restoreSession(){try{await this.oauthClient.ready}catch(e){console.warn("oauthClient.ready failed",e)}if(await this.oauthClient.isAuthorized()){this.isConnected=!0;const e=localStorage.getItem("marco:osm_user_display_name");e?this.userDisplayName=e:await this.fetchUserInfo()}}async login(){await this.oauthClient.requestAuthorizationCode()}async handleCallback(){await this.oauthClient.receiveCode(),await this.oauthClient.getTokens(),this.isConnected=!0,await this.fetchUserInfo()}async logout(){await this.oauthClient.reset(),this.isConnected=!1,this.userDisplayName=null,localStorage.removeItem("marco:osm_user_display_name")}async fetchUserInfo(){try{const e=await this.oauthClient.getTokens(),t=await fetch("https://api.openstreetmap.org/api/0.6/user/details.json",{headers:{Authorization:`Bearer ${e.accessToken}`}});if(t.ok){const e=await t.json();console.debug("OSM data:",e);const r=e.user.display_name;this.userDisplayName=r,localStorage.setItem("marco:osm_user_display_name",r)}else console.error("Failed to fetch OSM user info",t.status)}catch(e){console.error("Error fetching OSM user info",e)}}},format_text_exports=__exportAll({capitalize:()=>capitalize,humanizeOsmTag:()=>humanizeOsmTag});function humanizeOsmTag(e){return"string"==typeof e&&e?e.replace(/[_-]/g," ").replace(/\w\S*/g,e=>e.replace(/^\w/,e=>e.toUpperCase())):""}function capitalize(e){return"string"==typeof e&&e?e.charAt(0).toUpperCase()+e.slice(1):""}var osm_exports$1=__exportAll({getLocalizedName:()=>getLocalizedName,getPlaceType:()=>getPlaceType});function getLocalizedName(e,t="Untitled Place"){if(!e)return t;const r=navigator.languages||[navigator.language||"en"];for(const n of r){if(!n)continue;const t=`name:${n.split("-")[0]}`;if(e[t])return e[t]}return e.name?e.name:e["name:en"]?e["name:en"]:t}var PLACE_TYPE_KEYS=["amenity","shop","tourism","historic","leisure","office","craft","building","landuse","public_transport","highway","aeroway","waterway","natural","place","border_type","admin_title"];function getPlaceType(e){if(!e)return null;let t=null;for(const r of PLACE_TYPE_KEYS){const n=e[r];if(n){if("yes"===n){t||(t=r);continue}return humanizeOsmTag(n)}}return t?humanizeOsmTag(t):null}var poi_categories_exports=__exportAll({POI_CATEGORIES:()=>POI_CATEGORIES,getCategoryById:()=>getCategoryById}),POI_CATEGORIES=[{id:"restaurants",label:"Restaurants",icon:"fork-and-knife",filter:['["amenity"~"^(restaurant|fast_food|food_court|pub|cafe)$"]["cuisine"!~"coffee"]'],types:["node","way"]},{id:"coffee",label:"Coffee",icon:"cup-and-saucer",filter:['["amenity"~"^(cafe|ice_cream)$"]','["shop"~"^(coffee|tea)$"]','["cuisine"~"coffee_shop"]'],types:["node","way"]},{id:"groceries",label:"Groceries",icon:"shopping-basket",filter:['["shop"~"^(supermarket|convenience|grocery|greengrocer|bakery|butcher|deli|farm|seafood)$"]'],types:["node","way"]},{id:"things-to-do",label:"Things to do",icon:"feather-camera",filter:['["tourism"~"^(museum|gallery|attraction|viewpoint|zoo|theme_park|aquarium|artwork|information)$"]','["amenity"~"^(cinema|theatre|arts_centre|planetarium)$"]','["leisure"~"^(sports_centre|stadium|water_park)$"]','["historic"]','["shop"="flea_market"]'],types:["node","way","relation"]},{id:"accommodation",label:"Hotels",icon:"person-sleeping-in-bed",filter:['["tourism"~"^(hotel|hostel|motel|chalet|guest_house)$"]'],types:["node","way","relation"]}];function getCategoryById(e){return POI_CATEGORIES.find(t=>t.id===e)}var osm_exports=__exportAll({default:()=>OsmService}),OsmService=class extends Service{static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");controller=null;cachedResults=null;lastQueryKey=null;cachedPlaces=new Map;cancelAll(){this.controller&&(this.controller.abort(),this.controller=null)}async getNearbyPois(e,t,r=50){const n=`${e},${t},${r}`;if(this.lastQueryKey===n&&this.cachedResults)return console.debug("Returning cached Overpass results for:",n),this.cachedResults;this.controller&&this.controller.abort(),this.controller=new AbortController;const i=this.controller.signal,o=[`~"^(${["amenity","shop","tourism","historic","leisure","office","craft","building","landuse","public_transport","aeroway"].join("|")})$"~".*"`],s=Object.entries({public_transport:["stop_area","platform"]}).map(([e,t])=>`["${e}"!~"^(${t.join("|")})$"]`).join(""),a=`\n[out:json][timeout:25];\n(\n node(around:${r},${e},${t})\n [${o}]${s}[~"^name"~"."];\n way(around:${r},${e},${t})\n [${o}]${s}[~"^name"~"."];\n relation(around:${r},${e},${t})\n [${o}]${s}[~"^name"~"."];\n);\nout center;\n `.trim(),l=`${this.settings.overpassApi}?data=${encodeURIComponent(a)}`;try{const e=await this.fetchWithRetry(l,{signal:i});if(!e.ok)throw new Error("Overpass request failed");const t=(await e.json()).elements.map(this.normalizePoi);return this.lastQueryKey=n,this.cachedResults=t,t}catch(c){if("AbortError"===c.name)return console.debug("Overpass request aborted"),[];throw c}}async getCategoryPois(e,t,r,n){const i=getCategoryById(t);if(!i||!e)return[];const o=r&&n?`cat:${t}:${r}:${n}`:null;if(o&&this.lastQueryKey===o&&this.cachedResults)return console.debug("Returning cached category results for:",o),this.cachedResults;this.controller&&this.controller.abort(),this.controller=new AbortController;const s=this.controller.signal,{minLat:a,minLon:l,maxLat:c,maxLon:u}=e,h=[],d=i.types||["node","way","relation"];i.filter.forEach(e=>{d.forEach(t=>{h.push(`${t}${e}[~"^name"~"."];`)})});const p=`\n[out:json][timeout:25][bbox:${a},${l},${c},${u}];\n(\n ${h.join("\n ")}\n);\nout center;\n `.trim(),f=`${this.settings.overpassApi}?data=${encodeURIComponent(p)}`;try{const e=await this.fetchWithRetry(f,{signal:s});if(!e.ok)throw new Error("Overpass request failed");const t=(await e.json()).elements.map(this.normalizePoi);return o&&(this.lastQueryKey=o,this.cachedResults=t),t}catch(g){if("AbortError"===g.name)return console.debug("Category search aborted"),[];throw console.error("Category search failed",g),g}}normalizePoi(e){const t=e.tags||{},r=getPlaceType(t)||"Point of Interest";return{title:getLocalizedName(t),lat:e.lat||e.center?.lat,lon:e.lon||e.center?.lon,url:t.website,osmId:String(e.id),osmType:e.type,osmTags:t,description:t.description,source:"osm",type:r}}async fetchWithRetry(e,t={},r=3){try{const n=await fetch(e,t);return!n.ok&&r>0&&[502,503,504,429].includes(n.status)?(console.warn(`Overpass request failed with ${n.status}. Retrying... (${r} left)`),await new Promise(e=>setTimeout(e,1e3)),this.fetchWithRetry(e,t,r-1)):n}catch(n){if(r>0&&"AbortError"!==n.name)return console.debug(`Retrying Overpass request... (${r} left)`),await new Promise(e=>setTimeout(e,1e3)),this.fetchWithRetry(e,t,r-1);throw n}}async getPoiById(e,t=null){let r;r="node"===t?`[out:json][timeout:25];node(${e});out center;`:"way"===t?`[out:json][timeout:25];way(${e});out center;`:`\n[out:json][timeout:25];\n(\n node(${e});\n way(${e});\n);\nout center;\n `.trim();const n=`${this.settings.overpassApi}?data=${encodeURIComponent(r)}`,i=await this.fetchWithRetry(n);if(!i.ok)throw new Error("Overpass request failed");const o=await i.json();return o.elements[0]?this.normalizePoi(o.elements[0]):null}async fetchOsmObject(e,t){if(!e||!t)return null;const r=`${t}:${e}`,n=this.cachedPlaces.get(r);if(n&&Date.now()-n.timestamp<1e4)return console.debug(`Using in-memory cached OSM object for ${r}`),n.data;let i;if("node"===t)i=`https://www.openstreetmap.org/api/0.6/node/${e}.json`;else if("way"===t)i=`https://www.openstreetmap.org/api/0.6/way/${e}/full.json`;else{if("relation"!==t)return console.error("Unknown OSM type:",t),null;i=`https://www.openstreetmap.org/api/0.6/relation/${e}/full.json`}try{const n=await this.fetchWithRetry(i);if(!n.ok){if(410===n.status)return console.warn("OSM object has been deleted"),null;throw new Error(`OSM API request failed: ${n.status}`)}const o=await n.json(),s=this.normalizeOsmApiData(o.elements,e,t);return this.cachedPlaces.set(r,{data:s,timestamp:Date.now()}),setTimeout(()=>{this.cachedPlaces.delete(r)},1e4),s}catch(o){return console.error("Failed to fetch OSM object:",o),null}}normalizeOsmApiData(e,t,r){if(!e||0===e.length)return null;let n=e.find(e=>String(e.id)===String(t)&&e.type===r);if(!n)return null;let i=n;if("relation"===r&&n.members){const t=n.members.find(e=>"label"===e.role&&"node"===e.type),r=n.members.find(e=>"admin_centre"===e.role&&"node"===e.type),o=t||r;if(o){const t=e.find(e=>String(e.id)===String(o.ref)&&"node"===e.type);t&&(i=t)}}let o=i.lat,s=i.lon,a=null,l=null;if("way"===r&&n.nodes){const t=new Map;e.forEach(e=>{"node"===e.type&&t.set(e.id,[e.lon,e.lat])});const r=n.nodes.map(e=>t.get(e)).filter(Boolean);if(r.length>0){if(i===n){const e=r.reduce((e,t)=>e+t[1],0),t=r.reduce((e,t)=>e+t[0],0);o=e/r.length,s=t/r.length}const e=r.map(e=>e[1]),t=r.map(e=>e[0]);if(a={minLat:Math.min(...e),maxLat:Math.max(...e),minLon:Math.min(...t),maxLon:Math.max(...t)},r.length>1){const e=r[0],t=r[r.length-1];l=e[0]===t[0]&&e[1]===t[1]?{type:"Polygon",coordinates:[r]}:{type:"LineString",coordinates:r}}}}else if("relation"===r&&n.members){const t=[],r=new Map;e.forEach(e=>{"node"===e.type&&r.set(e.id,e)});const c=[];if(n.members.forEach(n=>{if("node"===n.type){const e=r.get(n.ref);e&&t.push(e)}else if("way"===n.type){const i=e.find(e=>"way"===e.type&&e.id===n.ref);if(i&&i.nodes){const e=[];i.nodes.forEach(n=>{const i=r.get(n);i&&(t.push(i),e.push([i.lon,i.lat]))}),e.length>1&&c.push(e)}}}),t.length>0){if(i===n){const e=t.reduce((e,t)=>e+t.lat,0),r=t.reduce((e,t)=>e+t.lon,0);o=e/t.length,s=r/t.length}const e=t.map(e=>e.lat),r=t.map(e=>e.lon);a={minLat:Math.min(...e),maxLat:Math.max(...e),minLon:Math.min(...r),maxLon:Math.max(...r)}}c.length>0&&(l={type:"MultiLineString",coordinates:c})}const c=i.tags||{},u=getPlaceType(c)||"Point of Interest";return{title:getLocalizedName(c),lat:o,lon:s,bbox:a,geojson:l,url:c.website,osmId:String(i.id),osmType:i.type,osmTags:c,description:c.description,source:"osm",type:u}}},photon_exports=__exportAll({default:()=>PhotonService}),PhotonService=class extends Service{static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");controller=null;cancelAll(){this.controller&&(this.controller.abort(),this.controller=null)}get baseUrl(){return this.settings.photonApi}async search(e,t,r,n=10){if(!e||e.length<2)return[];this.controller&&this.controller.abort(),this.controller=new AbortController;const i=this.controller.signal,o=new URLSearchParams({q:e,limit:String(n)});t&&r&&(o.append("lat",parseFloat(t).toFixed(4)),o.append("lon",parseFloat(r).toFixed(4)));const s=`${this.baseUrl}?${o.toString()}`;try{const e=await this.fetchWithRetry(s,{signal:i});if(!e.ok)throw new Error(`Photon request failed with status ${e.status}`);const t=await e.json();return t.features?t.features.map(e=>this.normalizeFeature(e)):[]}catch(a){return"AbortError"===a.name||console.error("Photon search error:",a),[]}}normalizeFeature(e){const t=e.properties||{},r=(e.geometry||{}).coordinates||[],n=r[0],i=r[1],o=[];t.street&&o.push(t.housenumber?`${t.street} ${t.housenumber}`:t.street),t.city&&t.city!==t.name&&o.push(t.city),t.state&&t.state!==t.city&&o.push(t.state),t.country&&o.push(t.country);const s=o.join(", "),a=t.name||s||"Unknown Place",l={...t};t.osm_key&&t.osm_value&&(l[t.osm_key]=t.osm_value);const c=getPlaceType(l)||humanizeOsmTag(t.osm_value);return{title:a,lat:i,lon:n,osmId:t.osm_id,osmType:{N:"node",W:"way",R:"relation"}[t.osm_type]||t.osm_type,osmTags:l,description:t.name?s:o.slice(1).join(", "),source:"photon",type:c}}async fetchWithRetry(e,t={},r=3){try{const n=await fetch(e,t);return!n.ok&&r>0&&[502,503,504,429].includes(n.status)?(console.warn(`Photon request failed with ${n.status}. Retrying... (${r} left)`),await new Promise(e=>setTimeout(e,1e3)),this.fetchWithRetry(e,t,r-1)):n}catch(n){if(r>0&&"AbortError"!==n.name)return console.debug(`Retrying Photon request... (${r} left)`,n),await new Promise(e=>setTimeout(e,1e3)),this.fetchWithRetry(e,t,r-1);throw n}}},settings_exports=__exportAll({default:()=>SettingsService}),DEFAULT_SETTINGS={overpassApi:"https://overpass-api.de/api/interpreter",mapKinetic:!0,photonApi:"https://photon.komoot.io/api/",showQuickSearchButtons:!0,nostrPhotoFallbackUploads:!1,nostrReadRelays:null,nostrWriteRelays:null,nostrReadRelayExclusions:null,nostrWriteRelayExclusions:null,experimentalEnablePhotoDeletion:!1},SettingsService=class extends Service{static{decorateFieldV2(this.prototype,"overpassApi",[tracked],function(){return DEFAULT_SETTINGS.overpassApi})}#ne=void initializeDeferredDecorator(this,"overpassApi");static{decorateFieldV2(this.prototype,"mapKinetic",[tracked],function(){return DEFAULT_SETTINGS.mapKinetic})}#ie=void initializeDeferredDecorator(this,"mapKinetic");static{decorateFieldV2(this.prototype,"photonApi",[tracked],function(){return DEFAULT_SETTINGS.photonApi})}#oe=void initializeDeferredDecorator(this,"photonApi");static{decorateFieldV2(this.prototype,"showQuickSearchButtons",[tracked],function(){return DEFAULT_SETTINGS.showQuickSearchButtons})}#se=void initializeDeferredDecorator(this,"showQuickSearchButtons");static{decorateFieldV2(this.prototype,"nostrPhotoFallbackUploads",[tracked],function(){return DEFAULT_SETTINGS.nostrPhotoFallbackUploads})}#ae=void initializeDeferredDecorator(this,"nostrPhotoFallbackUploads");static{decorateFieldV2(this.prototype,"nostrReadRelays",[tracked],function(){return DEFAULT_SETTINGS.nostrReadRelays})}#le=void initializeDeferredDecorator(this,"nostrReadRelays");static{decorateFieldV2(this.prototype,"nostrWriteRelays",[tracked],function(){return DEFAULT_SETTINGS.nostrWriteRelays})}#ce=void initializeDeferredDecorator(this,"nostrWriteRelays");static{decorateFieldV2(this.prototype,"nostrReadRelayExclusions",[tracked],function(){return DEFAULT_SETTINGS.nostrReadRelayExclusions})}#ue=void initializeDeferredDecorator(this,"nostrReadRelayExclusions");static{decorateFieldV2(this.prototype,"nostrWriteRelayExclusions",[tracked],function(){return DEFAULT_SETTINGS.nostrWriteRelayExclusions})}#he=void initializeDeferredDecorator(this,"nostrWriteRelayExclusions");static{decorateFieldV2(this.prototype,"experimentalEnablePhotoDeletion",[tracked],function(){return DEFAULT_SETTINGS.experimentalEnablePhotoDeletion})}#de=void initializeDeferredDecorator(this,"experimentalEnablePhotoDeletion");overpassApis=[{name:"overpass-api.de (DE)",url:"https://overpass-api.de/api/interpreter"},{name:"private.coffee (AT)",url:"https://overpass.private.coffee/api/interpreter"}];photonApis=[{name:"photon.komoot.io",url:"https://photon.komoot.io/api/"}];constructor(){super(...arguments),this.loadSettings()}loadSettings(){let e={};const t=localStorage.getItem("marco:settings");if(t)try{e=JSON.parse(t)}catch(n){console.error("Failed to parse settings from localStorage",n)}else{const t=localStorage.getItem("marco:overpass-api");t&&(e.overpassApi=t);const r=localStorage.getItem("marco:map-kinetic");null!==r&&(e.mapKinetic="true"===r);const n=localStorage.getItem("marco:show-quick-search");null!==n&&(e.showQuickSearchButtons="true"===n);const i=localStorage.getItem("marco:nostr-photo-fallback-uploads");null!==i&&(e.nostrPhotoFallbackUploads="true"===i);const o=localStorage.getItem("marco:photon-api");o&&(e.photonApi=o)}const r={...DEFAULT_SETTINGS,...e};this.overpassApis.some(e=>e.url===r.overpassApi)||(r.overpassApi=DEFAULT_SETTINGS.overpassApi),this.overpassApi=r.overpassApi,this.mapKinetic=r.mapKinetic,this.photonApi=r.photonApi,this.showQuickSearchButtons=r.showQuickSearchButtons,this.nostrPhotoFallbackUploads=r.nostrPhotoFallbackUploads,this.nostrReadRelays=r.nostrReadRelays,this.nostrWriteRelays=r.nostrWriteRelays,this.nostrReadRelayExclusions=r.nostrReadRelayExclusions,this.nostrWriteRelayExclusions=r.nostrWriteRelayExclusions,this.experimentalEnablePhotoDeletion=r.experimentalEnablePhotoDeletion,this.saveSettings()}saveSettings(){const e={overpassApi:this.overpassApi,mapKinetic:this.mapKinetic,photonApi:this.photonApi,showQuickSearchButtons:this.showQuickSearchButtons,nostrPhotoFallbackUploads:this.nostrPhotoFallbackUploads,nostrReadRelays:this.nostrReadRelays,nostrWriteRelays:this.nostrWriteRelays,nostrReadRelayExclusions:this.nostrReadRelayExclusions,nostrWriteRelayExclusions:this.nostrWriteRelayExclusions,experimentalEnablePhotoDeletion:this.experimentalEnablePhotoDeletion};localStorage.setItem("marco:settings",JSON.stringify(e))}update(e,t){e in DEFAULT_SETTINGS&&(this[e]=t,this.saveSettings())}},require_remotestorage=__commonJSMin((exports,module)=>{var e,t;e=exports,t=function(){return function(){var __webpack_modules__={548:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Access=void 0;class r{constructor(e){this.rs=e,this.reset(!1)}get scopes(){return Object.keys(this.scopeModeMap).map(e=>({name:e,mode:this.scopeModeMap[e]}))}get scopeParameter(){return this.scopes.map(e=>`${this._scopeNameForParameter(e)}:${e.mode}`).join(" ")}claim(e,t){if("string"!=typeof e||-1!==e.indexOf("/")||0===e.length)throw new Error("Scope should be a non-empty string without forward slashes");if("string"!=typeof t||!t.match(/^rw?$/))throw new Error("Mode should be either 'r' or 'rw'");this._adjustRootPaths(e),this.scopeModeMap[e]=t,this._notifyChange()}get(e){return this.scopeModeMap[e]}remove(e){const t={};for(const r in this.scopeModeMap)t[r]=this.scopeModeMap[r];this.reset(!1),delete t[e];for(const r in t)this._adjustRootPaths(r),this.scopeModeMap[r]=t[r];this._notifyChange()}checkPermission(e,t){const r=this.get(e);return r&&("r"===t||"rw"===r)}checkPathPermission(e,t){if(this.checkPermission("*",t))return!0;const r=this._getModuleName(e);return!!this.checkPermission(r,t)}reset(e=!0){this.rootPaths=[],this.scopeModeMap={},e&&this._notifyChange()}_getModuleName(e){if("/"!==e[0])throw new Error("Path should start with a slash");const t=e.replace(/^\/public/,"").match(/^\/([^/]*)\//);return t?t[1]:"*"}_adjustRootPaths(e){"*"in this.scopeModeMap||"*"===e?this.rootPaths=["/"]:e in this.scopeModeMap||(this.rootPaths.push("/"+e+"/"),this.rootPaths.push("/public/"+e+"/"))}_scopeNameForParameter(e){if("*"===e.name&&this.storageType){if("2012.04"===this.storageType)return"";if(this.storageType.match(/remotestorage-0[01]/))return"root"}return e.name}setStorageType(e){this.storageType=e}_notifyChange(){this.rs&&"function"==typeof this.rs._checkScopeChange&&this.rs._checkScopeChange()}static _rs_init(){}}t.Access=r,t.default=r},275:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Authorize=void 0;const o=i(r(28)),s=i(r(334)),a=r(746),l=i(r(503)),c=r(368);let u;function h(e){const t=e||d.getLocation().href,r={};for(const[o,s]of new URL(t).searchParams)r[o]=s;const n=t.indexOf("#");if(-1===n)return r;const i=t.substring(n+1);return i.includes("=")?i.split("&").reduce(function(e,t){const r=t.split("=");if("state"===r[0]&&r[1].match(/rsDiscovery/)){let t=decodeURIComponent(r[1]);const n=t.substr(t.indexOf("rsDiscovery=")).split("&")[0].split("=")[1];e.rsDiscovery=JSON.parse(atob(n)),t=t.replace(new RegExp("&?rsDiscovery="+n),""),t.length>0&&(e.state=t)}else e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]);return e},r):r}class d{static authorize(e,t){if((0,s.default)("[Authorize] authURL = ",t.authURL,"scope = ",t.scope,"redirectUri = ",t.redirectUri,"clientId = ",t.clientId,"response_type =",t.response_type),!t.scope)throw new Error("Cannot authorize due to undefined or empty scope; did you forget to access.claim()?");if("function"==typeof e._rememberPendingScope&&e._rememberPendingScope(t.scope),!(0,a.localStorageAvailable)()&&"remotestorage"===e.backend){t.redirectUri+=t.redirectUri.indexOf("#")>0?"&":"#";const r={userAddress:e.remote.userAddress,href:e.remote.href,storageApi:e.remote.storageApi,properties:e.remote.properties};t.redirectUri+="rsDiscovery="+(0,a.toBase64)(JSON.stringify(r))}const r=function(e){const t=new URL(e.redirectUri);e.state||(e.state=t.hash?t.hash.substring(1):""),e.response_type||(e.response_type="token");const r=new URL(e.authURL);r.searchParams.set("redirect_uri",e.redirectUri.replace(/#.*$/,"")),r.searchParams.set("scope",e.scope),r.searchParams.set("client_id",e.clientId);for(const n of["state","response_type","code_challenge","code_challenge_method","token_access_type"]){const t=e[n];t&&r.searchParams.set(n,t)}return r.href}(t);a.globalContext.cordova&&(d.getLocation().href.startsWith("file:")||"string"==typeof o.default.cordovaRedirectUri&&t.redirectUri===o.default.cordovaRedirectUri)?d.openWindow(r,t.redirectUri,"location=yes,clearsessioncache=yes,clearcache=yes").then(r=>{e.remote.configure({token:r.access_token}),"function"==typeof e._completeAuthorization&&e._completeAuthorization(r.scope||t.scope)}):d.setLocation(r)}static refreshAccessToken(e,t,r){return n(this,void 0,void 0,function*(){var e,n,i;yield t.configure({token:null,tokenType:null});const o=new URLSearchParams({grant_type:"refresh_token",client_id:t.clientId,refresh_token:r}),a=yield(0,c.requestWithTimeout)("POST",t.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o.toString(),responseType:"json"});if(200!==(null==a?void 0:a.status))throw yield t.configure({refreshToken:null}),new l.default("refresh token rejected:"+JSON.stringify(a.response));{(0,s.default)(`[Authorize] access token good for ${null===(e=null==a?void 0:a.response)||void 0===e?void 0:e.expires_in} seconds`);const r={token:null===(n=null==a?void 0:a.response)||void 0===n?void 0:n.access_token,tokenType:null===(i=null==a?void 0:a.response)||void 0===i?void 0:i.token_type};if(!r.token)throw new Error(`no access_token in "successful" refresh: ${a.response}`);yield t.configure(r)}})}static setLocation(e){if("string"==typeof e)document.location.href=e;else{if("object"!=typeof e)throw"Invalid location "+e;document.location.href=e.href}}static _rs_supported(){return"undefined"!=typeof document}static _rs_cleanup(e){e.removeEventListener("features-loaded",u)}}t.Authorize=d,d.IMPLIED_FAKE_TOKEN=!1,d.getLocation=function(){return document.location},d.openWindow=function(e,t,r){return new Promise((n,i)=>{const o=open(e,"_blank",r);function s(){i("Authorization was canceled")}o&&!o.closed?(o.addEventListener("loadstart",function(e){if(0!==e.url.indexOf(t))return;o.removeEventListener("exit",s),o.close();const r=h(e.url);r?n(r):i("Authorization error")}),o.addEventListener("exit",s)):i("Authorization popup was blocked")})},d._rs_init=function(e){const t=h(),r=function(e){return"string"==typeof e.access_token||"string"==typeof e.code||"string"==typeof e.error||"string"==typeof e.remotestorage||"object"==typeof e.rsDiscovery}(t);let i;r&&(i=d.getLocation(),i.hash=""),u=function(){let o=!1;if(r){if(t.error)throw"function"==typeof e._forgetPendingScope&&e._forgetPendingScope(),"access_denied"===t.error?new l.default("Authorization failed: access denied",{code:"access_denied"}):new l.default(`Authorization failed: ${t.error}`);t.rsDiscovery&&e.remote.configure(t.rsDiscovery),t.access_token&&(e.remote.configure({token:t.access_token}),"function"==typeof e._completeAuthorization&&e._completeAuthorization(t.scope),o=!0),t.remotestorage&&(e.connect(t.remotestorage),o=!0),t.state&&(i=d.getLocation(),d.setLocation(i.href.split("#")[0]+"#"+t.state)),t.code&&(function(t){n(this,void 0,void 0,function*(){var r,n,o,a,l;const u=sessionStorage.getItem("remotestorage:codeVerifier");if(!u)return void(0,s.default)("[Authorize] Ignoring OAuth code parameter, because no PKCE code verifier found in sessionStorage");i=d.getLocation();let h=i.origin;"/"!==i.pathname&&(h+=i.pathname);const p=new URLSearchParams({code:t,grant_type:"authorization_code",client_id:e.remote.clientId,redirect_uri:h,code_verifier:u}),f=yield(0,c.requestWithTimeout)("POST",e.remote.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:p.toString(),responseType:"json"});switch(f.status){case 200:{(0,s.default)(`[Authorize] access token good for ${null===(r=null==f?void 0:f.response)||void 0===r?void 0:r.expires_in} seconds`);const t={token:null===(n=null==f?void 0:f.response)||void 0===n?void 0:n.access_token,refreshToken:null===(o=null==f?void 0:f.response)||void 0===o?void 0:o.refresh_token,tokenType:null===(a=null==f?void 0:f.response)||void 0===a?void 0:a.token_type};t.token?(e.remote.configure(t),"function"==typeof e._completeAuthorization&&e._completeAuthorization(null===(l=null==f?void 0:f.response)||void 0===l?void 0:l.scope)):e._emit("error",new Error(`no access_token in "successful" response: ${f.response}`)),sessionStorage.removeItem("remotestorage:codeVerifier");break}default:"function"==typeof e._forgetPendingScope&&e._forgetPendingScope(),e._emit("error",new Error(`${f.statusText}: ${f.response}`))}})}(t.code),o=!0),o||e.remote.stopWaitingForToken()}else e.remote.stopWaitingForToken()},e.on("features-loaded",u)},t.default=d},424:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseClient=void 0;const o=i(r(439)),s=i(r(613)),a=i(r(491)),l=i(r(93)),c=i(r(28)),u=r(746);class h{constructor(e,t){if(this.schemas={configurable:!0,get(){return h.Types.inScope(this.moduleName)}},"/"!==t[t.length-1])throw"Not a folder: "+t;"/"===t&&(this.makePath=e=>("/"===e[0]?"":"/")+e),this.storage=e,this.base=t,this.moduleName=function(e){const t=e.split("/");return e.length>2?t[1]:"root"}(this.base),this.addEvents(["change"]),this.on=this.on.bind(this),e.onChange(this.base,this._fireChange.bind(this))}scope(e){return new h(this.storage,this.makePath(e))}getListing(e,t){return n(this,void 0,void 0,function*(){if("string"!=typeof e)e="";else if(e.length>0&&!(0,u.isFolder)(e))return Promise.reject("Not a folder: "+e);return this.storage.get(this.makePath(e),t).then(e=>404===e.statusCode?{}:e.body)})}getAll(e,t){return n(this,void 0,void 0,function*(){if("string"!=typeof e)e="";else if(e.length>0&&!(0,u.isFolder)(e))return Promise.reject("Not a folder: "+e);return this.storage.get(this.makePath(e),t).then(r=>{if(404===r.statusCode)return{};if("object"==typeof r.body){const n=Object.keys(r.body);if(0===n.length)return{};const i=n.map(n=>this.storage.get(this.makePath(e+n),t).then(e=>{if("string"==typeof e.body)try{e.body=JSON.parse(e.body)}catch(e){}"object"==typeof e.body&&(r.body[n]=e.body)}));return Promise.all(i).then(()=>r.body)}})})}getFile(e,t){return n(this,void 0,void 0,function*(){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.getFile must be a string"):this.storage.get(this.makePath(e),t).then(e=>({data:e.body,contentType:e.contentType,revision:e.revision}))})}storeFile(e,t,r){return n(this,void 0,void 0,function*(){return"string"!=typeof e?Promise.reject("Argument 'contentType' of baseClient.storeFile must be a string"):"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.storeFile must be a string"):"string"!=typeof r&&"object"!=typeof r?Promise.reject("Argument 'body' of baseClient.storeFile must be a string, ArrayBuffer, or ArrayBufferView"):(this.storage.access.checkPathPermission(this.makePath(t),"rw")||console.warn("WARNING: Editing a document to which only read access ('r') was claimed"),this.storage.put(this.makePath(t),r,e).then(e=>200===e.statusCode||201===e.statusCode?e.revision:Promise.reject("Request (PUT "+this.makePath(t)+") failed with status: "+e.statusCode)))})}getObject(e,t){return n(this,void 0,void 0,function*(){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.getObject must be a string"):this.storage.get(this.makePath(e),t).then(t=>{if("object"==typeof t.body)return t.body;if("string"==typeof t.body)try{return JSON.parse(t.body)}catch(t){throw new Error("Not valid JSON: "+this.makePath(e))}else if(void 0!==t.body&&200===t.statusCode)return Promise.reject("Not an object: "+this.makePath(e))})})}storeObject(e,t,r){return n(this,void 0,void 0,function*(){if("string"!=typeof e)return Promise.reject("Argument 'typeAlias' of baseClient.storeObject must be a string");if("string"!=typeof t)return Promise.reject("Argument 'path' of baseClient.storeObject must be a string");if("object"!=typeof r)return Promise.reject("Argument 'object' of baseClient.storeObject must be an object");this._attachType(r,e);try{const e=this.validate(r);if(!e.valid)return Promise.reject(e)}catch(e){return Promise.reject(e)}return this.storage.put(this.makePath(t),JSON.stringify(r),"application/json; charset=UTF-8").then(e=>200===e.statusCode||201===e.statusCode?e.revision:Promise.reject("Request (PUT "+this.makePath(t)+") failed with status: "+e.statusCode))})}remove(e){return n(this,void 0,void 0,function*(){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.remove must be a string"):(this.storage.access.checkPathPermission(this.makePath(e),"rw")||console.warn("WARNING: Removing a document to which only read access ('r') was claimed"),this.storage.delete(this.makePath(e),this.storage.connected))})}getItemURL(e){if("string"!=typeof e)throw"Argument 'path' of baseClient.getItemURL must be a string";return this.storage.connected?(e=(0,u.cleanPath)(this.makePath(e)),this.storage.remote.href+e):void 0}cache(e,t="ALL"){if("string"!=typeof e)throw"Argument 'path' of baseClient.cache must be a string";if("string"!=typeof t)throw"Argument 'strategy' of baseClient.cache must be a string or undefined";if("FLUSH"!==t&&"SEEN"!==t&&"ALL"!==t)throw'Argument \'strategy\' of baseclient.cache must be one of ["FLUSH", "SEEN", "ALL"]';return this.storage.caching.set(this.makePath(e),t),this}declareType(e,t,r){let n;if(r&&"string"==typeof t)n=t;else if(r||"string"==typeof t){if(!r&&"string"==typeof t)throw new Error("declareType() requires a JSON Schema object to be passed, in order to validate object types/formats")}else r=t,n=this._defaultTypeURI(e);h.Types.declare(this.moduleName,e,n,r)}validate(e){const t=h.Types.getSchema(e["@context"]);if(t)return o.default.validateResult(e,t);throw new a.default(e["@context"])}_defaultTypeURI(e){return"http://remotestorage.io/spec/modules/"+encodeURIComponent(this.moduleName)+"/"+encodeURIComponent(e)}_attachType(e,t){e["@context"]=h.Types.resolveAlias(this.moduleName+"/"+t)||this._defaultTypeURI(t)}makePath(e){return this.base+(e||"")}_fireChange(e){c.default.changeEvents[e.origin]&&(["new","old","lastCommon"].forEach(function(t){if((!e[t+"ContentType"]||/^application\/(.*)json(.*)/.exec(e[t+"ContentType"]))&&"string"==typeof e[t+"Value"])try{e[t+"Value"]=JSON.parse(e[t+"Value"])}catch(e){}}),this._emit("change",e))}static _rs_init(){}}t.BaseClient=h,h.Types=s.default,(0,u.applyMixins)(h,[l.default]),t.default=h},285:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Caching=void 0;const i=r(746),o=n(r(334));class s{constructor(e){this.pendingActivations=[],this._access=e.access,this.reset()}set(e,t){if("string"!=typeof e)throw new Error("path should be a string");if(!(0,i.isFolder)(e))throw new Error("path should be a folder");if(!this._access.checkPathPermission(e,"r"))throw new Error('No access to path "'+e+'". You must claim access to it first.');if(void 0===t||!t.match(/^(FLUSH|SEEN|ALL)$/))throw new Error("strategy should be 'FLUSH', 'SEEN', or 'ALL'");this._rootPaths[e]=t,"ALL"===t&&(this.activateHandler?this.activateHandler(e):this.pendingActivations.push(e))}enable(e){this.set(e,"ALL")}disable(e){this.set(e,"FLUSH")}onActivate(e){(0,o.default)("[Caching] Setting activate handler",e,this.pendingActivations),this.activateHandler=e;for(let t=0;t<this.pendingActivations.length;t++)e(this.pendingActivations[t]);this.pendingActivations=[]}resetActivationHandler(){this.activateHandler=void 0,this.pendingActivations=[]}checkPath(e){return void 0!==this._rootPaths[e]?this._rootPaths[e]:"/"===e?"SEEN":this.checkPath((0,i.containingFolder)(e))}reset(){this._rootPaths={}}static _rs_init(){}}t.Caching=s,t.default=s},496:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const o=i(r(451)),s=i(r(93)),a=i(r(28)),l=i(r(334)),c=r(746);function u(e){if("object"==typeof e&&"string"==typeof e.path)if((0,c.isFolder)(e.path)){if(e.local&&e.local.itemsMap)return e.local;if(e.common&&e.common.itemsMap)return e.common}else{if(e.local){if(e.local.body&&e.local.contentType)return e.local;if(!1===e.local.body)return}if(e.common&&e.common.body&&e.common.contentType)return e.common}}function h(e,t){for(const r in e){if(e[r]&&e[r].remote)return!0;const n=u(e[r]);if(n&&n.timestamp&&(new Date).getTime()-n.timestamp<=t)return!1;if(!n)return!0}return!0}function d(e){const t={path:e,common:{}};return(0,c.isFolder)(e)&&(t.common.itemsMap={}),t}function p(e,t){return e.common||(e.common={itemsMap:{}}),e.common.itemsMap||(e.common.itemsMap={}),e.local||(e.local=(0,c.deepClone)(e.common)),e.local.itemsMap||(e.local.itemsMap=e.common.itemsMap),e.local.itemsMap[t]=!0,e}class f{constructor(){this._updateNodesRunning=!1,this._updateNodesQueued=[],(new o.default).isBrowser()&&c.globalContext.BroadcastChannel&&(this.broadcastChannel=new BroadcastChannel("remotestorage:changes"),this.broadcastChannel.onmessage=e=>{this.emitChange(e.data)})}get(e,t,r){return n(this,void 0,void 0,function*(){return"number"==typeof t?this.getNodes((0,c.pathsFromRoot)(e)).then(n=>{const i=u(n[e]);return h(n,t)?r(e):i?{statusCode:200,body:i.body||i.itemsMap,contentType:i.contentType}:{statusCode:404}}):this.getNodes([e]).then(t=>{const r=u(t[e]);if(r){if((0,c.isFolder)(e))for(const e in r.itemsMap)r.itemsMap.hasOwnProperty(e)&&!1===r.itemsMap[e]&&delete r.itemsMap[e];return{statusCode:200,body:r.body||r.itemsMap,contentType:r.contentType}}return{statusCode:404}})})}put(e,t,r){return n(this,void 0,void 0,function*(){const n=(0,c.pathsFromRoot)(e);return this._updateNodes(n,function(e,n){try{for(let i=0,o=e.length;i<o;i++){const o=e[i];let s,a=n[o];a||(n[o]=a=d(o)),0===i?(s=u(a),a.local={body:t,contentType:r,previousBody:s?s.body:void 0,previousContentType:s?s.contentType:void 0}):a=p(a,e[i-1].substring(o.length))}return n}catch(e){throw(0,l.default)("[Cachinglayer] Error during PUT",n,e),e}})})}delete(e,t){return n(this,void 0,void 0,function*(){const r=(0,c.pathsFromRoot)(e);return this._updateNodes(r,function(e,r){for(let n=0,i=e.length;n<i;n++){const i=e[n],o=r[i];let s;if(o)if(0===n)s=u(o),o.local={body:!t&&void 0,previousBody:s?s.body:void 0,previousContentType:s?s.contentType:void 0};else{o.local||(o.local=(0,c.deepClone)(o.common));const t=e[n-1].substring(i.length);if(delete o.local.itemsMap[t],Object.getOwnPropertyNames(o.local.itemsMap).length>0)break}else console.error("Cannot delete non-existing node "+i)}return r})})}flush(e){return this._getAllDescendentPaths(e).then(e=>this.getNodes(e)).then(e=>{for(const t in e){const r=e[t];r&&r.common&&r.local&&this.emitChange({path:r.path,origin:"local",oldValue:!1===r.local.body?void 0:r.local.body,newValue:!1===r.common.body?void 0:r.common.body}),e[t]=void 0}return this.setNodes(e)})}emitChange(e){a.default.changeEvents[e.origin]&&this._emit("change",e)}fireInitial(){a.default.changeEvents.local&&this.forAllNodes(e=>{if((0,c.isDocument)(e.path)){const t=u(e);t&&this.emitChange({path:e.path,origin:"local",oldValue:void 0,oldContentType:void 0,newValue:t.body,newContentType:t.contentType})}}).then(()=>{this._emit("local-events-done")})}onDiff(e){this.diffHandler=e}_updateNodes(e,t){return new Promise((r,n)=>{this._doUpdateNodes(e,t,{resolve:r,reject:n})})}_doUpdateNodes(e,t,r){return n(this,void 0,void 0,function*(){if(this._updateNodesRunning)return void this._updateNodesQueued.push({paths:e,cb:t,promise:r});this._updateNodesRunning=!0;try{let n=yield this.getNodes(e);const i=(0,c.deepClone)(n),o=[];n=t(e,n);for(const e in n){const t=n[e];(0,c.equal)(t,i[e])?delete n[e]:(0,c.isDocument)(e)&&((0,c.equal)(t.local.body,t.local.previousBody)&&t.local.contentType===t.local.previousContentType||o.push({path:e,origin:"window",oldValue:t.local.previousBody,newValue:!1===t.local.body?void 0:t.local.body,oldContentType:t.local.previousContentType,newContentType:t.local.contentType}),void 0===t.local.body?n[e]=void 0:(delete t.local.previousBody,delete t.local.previousContentType))}yield this.setNodes(n),this._emitChangeEvents(o),r.resolve({statusCode:200})}catch(e){r.reject(e)}this._updateNodesRunning=!1;const n=this._updateNodesQueued.shift();n&&(yield this._doUpdateNodes(n.paths,n.cb,n.promise))})}_emitChangeEvents(e){for(let t=0,r=e.length;t<r;t++){const r=e[t];this.emitChange(r),this.diffHandler&&this.diffHandler(r.path),this.broadcastChannel&&"window"===r.origin&&this.broadcastChannel.postMessage(r)}}_getAllDescendentPaths(e){return(0,c.isFolder)(e)?this.getNodes([e]).then(t=>{const r=[e],n=u(t[e]),i=Object.keys(n.itemsMap).map(t=>this._getAllDescendentPaths(e+t).then(e=>{for(let t=0,n=e.length;t<n;t++)r.push(e[t])}));return Promise.all(i).then(()=>r)}):Promise.resolve([e])}_getInternals(){return{getLatest:u,makeNode:d,isOutdated:h}}}(0,c.applyMixins)(f,[s.default]),e.exports=f},28:function(e){e.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(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(r(713)),o=n(r(28)),s=n(r(334)),a=r(746);let l;const c="remotestorage:discover";let u={};const h=function(e){if(e in u)return Promise.resolve(u[e]);const t=new i.default({tls_only:!1,uri_fallback:!0,request_timeout:o.default.discoveryTimeout});let r;const n=new Promise((e,t)=>{r=setTimeout(()=>{t(new Error("timed out"))},o.default.discoveryTimeout)});return Promise.race([t.lookup(e),n]).then(t=>{if(clearTimeout(r),"object"!=typeof t.idx.links.remotestorage||"number"!=typeof t.idx.links.remotestorage.length||t.idx.links.remotestorage.length<=0)throw(0,s.default)("[Discover] WebFinger record for "+e+" does not have remotestorage defined in the links section ",JSON.stringify(t.object)),new Error("WebFinger record for "+e+" does not have remotestorage defined in the links section.");const n=t.idx.links.remotestorage[0],i=n.properties||{},o=i["http://tools.ietf.org/html/rfc6749#section-4.2"]||i["auth-endpoint"],a=i["http://remotestorage.io/spec/version"]||n.type;return u[e]={href:n.href,storageApi:a,authURL:o,properties:i},l&&localStorage.setItem(c,JSON.stringify({cache:u})),u[e]}).catch(e=>{throw clearTimeout(r),e})};(h.DiscoveryError=function(e){this.name="DiscoveryError",this.message=e,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 e=JSON.parse(localStorage.getItem(c));e&&(u=e.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)},e.exports=h},706:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const o=i(r(93)),s=i(r(424)),a=i(r(941)),l=i(r(982)),c=i(r(503)),u=r(746),h=r(368),d=r(684),p=i(r(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";function v(e){return("/remotestorage/"+e).replace(/\/+$/,"").replace(/\/+/g,"/")}const _=/[\u007f-\uffff]/g;function b(e){return JSON.stringify(e).replace(_,function(e){return"\\u"+("000"+e.charCodeAt(0).toString(16)).slice(-4)})}function E(e,t){return new RegExp("^"+t.join("\\/")+"(\\/|$)").test(e.error_summary)}function w(e){return e instanceof ArrayBuffer||(0,h.isArrayBufferView)(e)}class C extends d.RemoteBase{constructor(e){if(super(e),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this._initialFetchDone=!1,this.addEvents(["connected","not-connected"]),this.clientId=e.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 e=(0,u.getJSONFromLocalStorage)(g);e&&this.configure(e),this._itemRefs=(0,u.getJSONFromLocalStorage)(`${g}:shares`)||{}}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}connect(){return n(this,void 0,void 0,function*(){try{if(this.rs.setBackend("dropbox"),this.token)x(this.rs);else{const{codeVerifier:e,codeChallenge:t,state:r}=yield(0,u.generateCodeVerifier)();sessionStorage.setItem("remotestorage:codeVerifier",e),sessionStorage.setItem("remotestorage:state",r),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:r,code_challenge:t,code_challenge_method:"S256",token_access_type:"offline"})}}catch(e){throw this.rs._emit("error",e),this.rs.setBackend(void 0),e}})}configure(e){return n(this,void 0,void 0,function*(){void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.token&&(this.token=e.token),void 0!==e.refreshToken&&(this.refreshToken=e.refreshToken),void 0!==e.tokenType&&(this.tokenType=e.tokenType);const t=()=>{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"),t();else try{const e=yield this.info();this.userAddress=e.email,this._emit("connected"),t()}catch(e){this.connected=!1,this.rs._emit("error",new Error("Could not fetch user info.")),t.apply(this)}else(()=>{this.connected=!1,f&&localStorage.removeItem(g),this.rs.setBackend(void 0)})()})}_getFolder(e){const t=this._revCache,r=r=>{let i;if(200!==r.status&&409!==r.status)return Promise.reject("Unexpected response status: "+r.status);try{i=JSON.parse(r.responseText)}catch(e){return Promise.reject(e)}if(409===r.status)return E(i,["path","not_found"])?Promise.resolve({}):Promise.reject(new Error("API returned an error: "+i.error_summary));const o=i.entries.reduce((r,n)=>{try{const i="folder"===n[".tag"],o=n.path_display.split("/").slice(-1)[0]+(i?"/":"");if(i)r[o]={ETag:t.get(e+o)};else{const t=new Date(n.server_modified);r[o]={ETag:n.rev,"Content-Length":n.size,"Last-Modified":t.toUTCString()},this._revCache.set(e+o,n.rev)}}catch(t){console.error(`[Dropbox] folder “${e}” has entry ${JSON.stringify(n)}:`,t)}return r},{});return i.has_more?n(i.cursor).then(function(e){return Object.assign(o,e)}):Promise.resolve(o)},n=e=>{const t={body:{cursor:e}};return this._request("POST",y,t).then(r)};return this._request("POST",m,{body:{path:v(e)}}).then(r).then(function(r){return Promise.resolve({statusCode:200,body:r,contentType:"application/json; charset=UTF-8",revision:t.get(e)})})}get(e,t={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");const r=this._revCache.get(e);if(null===r)return Promise.resolve({statusCode:404});if(t&&t.ifNoneMatch){if(!this._initialFetchDone)return this.fetchDelta().then(()=>this.get(e,t));if(r&&r===t.ifNoneMatch)return Promise.resolve({statusCode:304})}if("/"===e.slice(-1))return this._getFolder(e);const n={headers:{"Dropbox-API-Arg":b({path:v(e)})},responseType:"arraybuffer"};return t&&t.ifNoneMatch&&(n.headers["If-None-Match"]=t.ifNoneMatch),this._request("GET","https://content.dropboxapi.com/2/files/download",n).then(t=>{const r=t.status;let n,i,o,s;return 200!==r&&409!==r?Promise.resolve({statusCode:r}):(n=t.getResponseHeader("Dropbox-API-Result"),(0,u.getTextFromArrayBuffer)(t.response,"UTF-8").then(a=>{i=a,409===r&&(n=i);try{n=JSON.parse(n)}catch(e){return Promise.reject(e)}if(409===r)return E(n,["path","not_found"])?{statusCode:404}:Promise.reject(new Error('API error while downloading file ("'+e+'"): '+n.error_summary));if(o=t.getResponseHeader("Content-Type"),s=n.rev,this._revCache.set(e,s),this._shareIfNeeded(e),(0,u.shouldBeTreatedAsBinary)(a,o))i=t.response;else try{i=JSON.parse(i),o="application/json; charset=UTF-8"}catch(e){}return{statusCode:r,body:i,contentType:o,revision:s}}))})}put(e,t,r){return n(this,arguments,void 0,function*(e,t,r,n={}){if(!this.connected)throw new Error("not connected (path: "+e+")");const i=this._revCache.get(e);if(n&&n.ifMatch&&i&&i!==n.ifMatch)return{statusCode:412,revision:i};if(n&&"*"===n.ifNoneMatch&&i&&"rev"!==i)return{statusCode:412,revision:i};if(!r.match(/charset=/)&&w(t)&&(r+="; charset=binary"),t.length>157286400)throw new Error("Cannot upload file larger than 150MB");const o={body:t,contentType:r,path:e};if(n&&(n.ifMatch||"*"===n.ifNoneMatch)){const t=yield this._getMetadata(e);if(n&&"*"===n.ifNoneMatch&&t)return{statusCode:412,revision:t.rev};if(n&&n.ifMatch&&t&&t.rev!==n.ifMatch)return{statusCode:412,revision:t.rev}}const s=yield this._uploadSimple(o);return this._shareIfNeeded(e),s})}delete(e){return n(this,arguments,void 0,function*(e,t={}){if(!this.connected)throw new Error("not connected (path: "+e+")");const r=this._revCache.get(e);if((null==t?void 0:t.ifMatch)&&r&&t.ifMatch!==r)return{statusCode:412,revision:r};if(null==t?void 0:t.ifMatch){const r=yield this._getMetadata(e);if((null==t?void 0:t.ifMatch)&&r&&r.rev!==t.ifMatch)return{statusCode:412,revision:r.rev}}return this._deleteSimple(e)})}_shareIfNeeded(e){if(e.match(/^\/public\/.*[^/]$/)&&void 0===this._itemRefs[e])return this.share(e)}share(e){const t={body:{path:v(e)}};return this._request("POST","https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings",t).then(t=>{if(200!==t.status&&409!==t.status)return Promise.reject(new Error("Invalid response status:"+t.status));let r;try{r=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}return 409===t.status?E(r,["shared_link_already_exists"])?this._getSharedLink(e):Promise.reject(new Error("API error: "+r.error_summary)):Promise.resolve(r.url)}).then(t=>(this._itemRefs[e]=t,f&&localStorage.setItem("remotestorage:dropbox:shares",JSON.stringify(this._itemRefs)),Promise.resolve(t)),t=>(t.message='Sharing Dropbox file or folder ("'+e+'") failed: '+t.message,Promise.reject(t)))}info(){return this._request("POST","https://api.dropboxapi.com/2/users/get_current_account",{}).then(function(e){let t;try{const r=JSON.parse(e.responseText);t=null==r?void 0:r.email}catch(t){return Promise.reject(new Error("Could not query current account info: Invalid API response: "+e.responseText))}return Promise.resolve({email:t})})}_request(e,t,r){return n(this,arguments,void 0,function*(e,t,r,n=1){if(this.isForbiddenRequestMethod(e,t))throw`Don't use ${e} on directories!`;if(!this.token)throw new c.default("No access token");r.headers||(r.headers={}),r.headers.Authorization="Bearer "+this.token,"object"!=typeof r.body||w(r.body)||(r.body=JSON.stringify(r.body),r.headers["Content-Type"]="application/json; charset=UTF-8"),this.rs._emit("wire-busy",{method:e,isFolder:(0,u.isFolder)(t)});try{const i=yield(0,h.requestWithTimeout)(e,t,r);return this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,u.isFolder)(t),success:!0}),401===(null==i?void 0:i.status)&&this.refreshToken?n>=3?(console.error(`Abandoned after ${n} attempts: ${e} ${t}`),i):(this.rs._emit("wire-busy",{method:e,isFolder:(0,u.isFolder)(t)}),yield p.default.refreshAccessToken(this.rs,this,this.refreshToken),this.rs._emit("wire-done",{method:e,isFolder:(0,u.isFolder)(t),success:!0}),this._request(e,t,r,n+1)):[503,429].includes(null==i?void 0:i.status)?(this.online&&(this.online=!1,this.rs._emit("network-offline")),n>=3?(console.warn(`Abandoned after ${n} attempts: ${e} ${t}`),i):(yield new Promise(e=>setTimeout(e,(0,h.retryAfterMs)(i))),this._request(e,t,r,n+1))):i}catch(r){throw this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,u.isFolder)(t),success:!1}),r}})}fetchDelta(...e){if(this._fetchDeltaPromise)return this._fetchDeltaPromise;const t=e=>n(this,void 0,void 0,function*(){let r,n;"string"==typeof e?(r=y,n={cursor:e}):(r=m,n={path:"/remotestorage",recursive:!0,include_deleted:!0});try{const i=yield this._request("POST",r,{body:n});if(401===i.status)throw new c.default;if(200!==i.status&&409!==i.status)throw new Error("Invalid response status: "+i.status);let o;try{o=JSON.parse(i.responseText)}catch(e){throw new Error("Invalid response body: "+i.responseText)}if(409===i.status){if(!E(o,["path","not_found"]))throw new Error("API returned an error: "+o.error_summary);o={cursor:null,entries:[],has_more:!1}}if(e||this._revCache.deactivatePropagation(),o.entries.forEach(e=>{const t=e.path_display.slice(14);"deleted"===e[".tag"]?(this._revCache.delete(t),this._revCache.delete(t+"/")):"file"===e[".tag"]&&this._revCache.set(t,e.rev)}),this._fetchDeltaCursor=o.cursor,o.has_more)return t(o.cursor);this._revCache.activatePropagation(),this._initialFetchDone=!0}catch(e){if("timeout"===e)return;throw e}});return this._fetchDeltaPromise=t(this._fetchDeltaCursor).catch(e=>("object"==typeof e&&"message"in e?e.message="Dropbox: fetchDelta: "+e.message:e=`Dropbox: fetchDelta: ${e}`,this.rs._emit("error",e),this._fetchDeltaPromise=null,Promise.reject(e))).then(()=>(this._fetchDeltaPromise=null,Promise.resolve(e))),this._fetchDeltaPromise}_getMetadata(e){const t={path:v(e)};return this._request("POST","https://api.dropboxapi.com/2/files/get_metadata",{body:t}).then(e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status:"+e.status));let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?E(t,["path","not_found"])?Promise.resolve():Promise.reject(new Error("API error: "+t.error_summary)):Promise.resolve(t)}).then(void 0,t=>(t.message='Could not load metadata for file or folder ("'+e+'"): '+t.message,Promise.reject(t)))}_uploadSimple(e){const t={path:v(e.path),mode:{".tag":"overwrite",update:void 0},mute:!0};return e.ifMatch&&(t.mode={".tag":"update",update:e.ifMatch}),this._request("POST","https://content.dropboxapi.com/2/files/upload",{body:e.body,headers:{"Content-Type":"application/octet-stream","Dropbox-API-Arg":b(t)}}).then(t=>{if(200!==t.status&&409!==t.status)return Promise.resolve({statusCode:t.status});let r;try{r=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid API result: "+t.responseText))}return 409===t.status?E(r,["path","conflict"])?this._getMetadata(e.path).then(function(e){return Promise.resolve({statusCode:412,revision:e.rev})}):(this.rs._emit("error",new Error(r.error_summary)),Promise.resolve({statusCode:t.status})):(this._revCache.set(e.path,r.rev),Promise.resolve({statusCode:t.status,revision:r.rev}))})}_deleteSimple(e){const t={path:v(e)};return this._request("POST","https://api.dropboxapi.com/2/files/delete",{body:t}).then(e=>{if(200!==e.status&&409!==e.status)return Promise.resolve({statusCode:e.status});let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}if(409===e.status){if(E(t,["path_lookup","not_found"]))return Promise.resolve({statusCode:404});this.rs._emit("error",new Error(t.error_summary))}return Promise.resolve({statusCode:e.status})}).then(t=>(200!==t.statusCode&&404!==t.statusCode||(this._revCache.delete(e),delete this._itemRefs[e]),Promise.resolve(t)),t=>(t.message='Could not delete Dropbox file or folder ("'+e+'"): '+t.message,Promise.reject(t)))}_getSharedLink(e){return n(this,void 0,void 0,function*(){const t={body:{path:v(e),direct_only:!0}};return this._request("POST","https://api.dropbox.com/2/sharing/list_shared_links",t).then(e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status: "+e.status));let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?Promise.reject(new Error("API error: "+(null==t?void 0:t.error_summary)||0)):t.links.length?Promise.resolve(t.links[0].url):Promise.reject(new Error("No links returned"))},t=>(t.message='Could not get link to a shared file or folder ("'+e+'"): '+t.message,Promise.reject(t)))})}static _rs_init(e){f=(0,u.localStorageAvailable)(),e.apiKeys.dropbox&&(e.dropbox=new C(e)),"dropbox"===e.backend&&x(e)}static _rs_supported(){return!0}static _rs_cleanup(e){(function(e){(function(e){e._origRemote&&(e.remote=e._origRemote,delete e._origRemote)})(e),function(e){e._dropboxOrigSync&&(e.sync.sync=e._dropboxOrigSync,delete e._dropboxOrigSync)}(e),function(e){e._origBaseClientGetItemURL&&(s.default.prototype.getItemURL=e._origBaseClientGetItemURL,delete e._origBaseClientGetItemURL)}(e),T(e)})(e),f&&localStorage.removeItem(g),e.setBackend(void 0)}}function S(e,...t){e._dropboxOrigSync||(e._dropboxOrigSync=e.sync.sync.bind(e.sync),e.sync.sync=function(){return this.dropbox.fetchDelta(e,...t).then(e._dropboxOrigSync,function(t){e._emit("error",new l.default(t)),e._emit("sync-done",{completed:!1})})}.bind(e))}function T(e){e._dropboxOrigSyncCycle&&(e.syncCycle=e._dropboxOrigSyncCycle,delete e._dropboxOrigSyncCycle)}function x(e){(function(e){e._origRemote||(e._origRemote=e.remote,e.remote=e.dropbox)})(e),e.sync?S(e):function(e,...t){e._dropboxOrigSyncCycle||(e._dropboxOrigSyncCycle=e.syncCycle,e.syncCycle=()=>{if(!e.sync)throw new Error("expected sync to be initialized by now");S(e),e._dropboxOrigSyncCycle(e,...t),T(e)})}(e),function(e){e._origBaseClientGetItemURL||(e._origBaseClientGetItemURL=s.default.prototype.getItemURL,s.default.prototype.getItemURL=function(){throw new Error("getItemURL is not implemented for Dropbox yet")})}(e)}(0,u.applyMixins)(C,[o.default]),e.exports=C},451:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(r(93)),o=r(746),s=n(r(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,s.default)("[Env] Going into background mode"),this.goBackground()):((0,s.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,o.applyMixins)(a,[i.default]),e.exports=a},93:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EventHandling=void 0;const i=n(r(334));class o{addEvents(e){e.forEach(e=>this._addEvent(e))}addEventListener(e,t){if("string"!=typeof e)throw new Error("Argument eventName should be a string");if("function"!=typeof t)throw new Error("Argument handler should be a function");(0,i.default)("[EventHandling] Adding event listener",e),this._validateEvent(e),this._handlers[e].push(t)}on(e,t){return this.addEventListener(e,t)}removeEventListener(e,t){this._validateEvent(e);const r=this._handlers[e].length;for(let n=0;n<r;n++)if(this._handlers[e][n]===t)return void this._handlers[e].splice(n,1)}_emit(e,...t){this._validateEvent(e),this._handlers[e].slice().forEach(e=>{e(...t)})}_validateEvent(e){if(!(e in this._handlers))throw new Error("Unknown event: "+e)}_delegateEvent(e,t){t.on(e,t=>{this._emit(e,t)})}_addEvent(e){void 0===this._handlers&&(this._handlers={}),this._handlers[e]=[]}}t.EventHandling=o,t.default=o},545:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(r(28)),o=n(r(451)),s=n(r(334)),a=r(746),l=n(r(370)),c=n(r(548)),u=n(r(275)),h=n(r(373)),d=n(r(424)),p=n(r(801)),f=n(r(706)),g=n(r(600)),m=n(r(313)),y=n(r(285)),v=n(r(567)),_=n(r(794)),b=n(r(365));e.exports={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:o.default},i.default.cache&&(0,a.extend)(this.featureModules,{Caching:y.default,IndexedDB:v.default,LocalStorage:_.default,InMemoryStorage:b.default,Sync:m.default}),i.default.disableFeatures.forEach(e=>{this.featureModules[e]&&delete this.featureModules[e]}),this._allLoaded=!1;for(const e in this.featureModules)this.loadFeature(e)},hasFeature(e){for(let t=this.features.length-1;t>=0;t--)if(this.features[t].name===e)return this.features[t].supported;return!1},loadFeature(e){const t=this.featureModules[e],r=!t._rs_supported||t._rs_supported();(0,s.default)(`[RemoteStorage] [FEATURE ${e}] initializing ...`),"object"==typeof r?r.then(()=>{this.featureSupported(e,!0),this.initFeature(e)},()=>{this.featureSupported(e,!1)}):"boolean"==typeof r?(this.featureSupported(e,r),r&&this.initFeature(e)):this.featureSupported(e,!1)},initFeature(e){const t=this.featureModules[e];let r;try{r=t._rs_init(this)}catch(t){return void this.featureFailed(e,t)}"object"==typeof r&&"function"==typeof r.then?r.then(()=>{this.featureInitialized(e)},t=>{this.featureFailed(e,t)}):this.featureInitialized(e)},featureFailed(e,t){(0,s.default)(`[RemoteStorage] [FEATURE ${e}] initialization failed (${t})`),this.featureDone()},featureSupported(e,t){(0,s.default)(`[RemoteStorage] [FEATURE ${e}]${t?"":"not "} supported`),t||this.featureDone()},featureInitialized(e){(0,s.default)(`[RemoteStorage] [FEATURE ${e}] initialized`),this.features.push({name:e,init:this.featureModules[e]._rs_init,supported:!0,cleanup:this.featureModules[e]._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(e=>{if(this.features.some(t=>t.name===e))return this.features.local=this.featureModules[e],!0})},_fireReady(){try{this.readyFired||(this._emit("ready"),this.readyFired=!0)}catch(e){console.error("'ready' failed: ",e,e.stack),this._emit("error",e)}},featuresLoaded(){(0,s.default)("[RemoteStorage] All features loaded"),this._setCachingModule(),this.local=i.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(e){(0,a.logError)(e),this._emit("error",e)}this._processPending()},_collectCleanupFunctions(){this._cleanups=[];for(let e=0;e<this.features.length;e++){const t=this.features[e].cleanup;"function"==typeof t&&this._cleanups.push(t)}}}},801:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(r(424)),o=n(r(93)),s=r(746),a=r(368),l=r(684),c="remotestorage:googledrive",u="application/vnd.google-apps.folder";let h;function d(e){return"/"===e.substr(-1)&&(e=e.substr(0,e.length-1)),decodeURIComponent(e)}function p(e){return e.replace(/[^\/]+\/?$/,"")}function f(e){const t=e.split("/");return"/"===e.substr(-1)?t[t.length-2]+"/":t[t.length-1]}function g(e){return(0,s.cleanPath)(`/remotestorage/${e}`)}class m{constructor(e){this._items={},this.maxAge=e,this._items={}}get(e){const t=this._items[e],r=(new Date).getTime();return t&&t.t>=r-this.maxAge?t.v:void 0}set(e,t){this._items[e]={v:t,t:(new Date).getTime()}}}class y extends l.RemoteBase{constructor(e,t){if(super(e),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this.addEvents(["connected","not-connected"]),this.clientId=t,this._fileIdCache=new m(300),h=(0,s.localStorageAvailable)(),h){const e=(0,s.getJSONFromLocalStorage)(c);e&&this.configure(e)}}configure(e){void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.token&&(this.token=e.token);const t=function(){h&&localStorage.setItem(c,JSON.stringify({userAddress:this.userAddress,token:this.token}))},r=function(){this.connected=!1,delete this.token,h&&localStorage.removeItem(c)};this.token?(this.connected=!0,this.userAddress?(this._emit("connected"),t.apply(this)):this.info().then(e=>{this.userAddress=e.user.emailAddress,this._emit("connected"),t.apply(this)}).catch(()=>{r.apply(this),this.rs._emit("error",new Error("Could not fetch user info."))})):r.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(e,t={}){return(0,s.isFolder)(e)?this._getFolder(g(e)):this._getFile(g(e),t)}put(e,t,r,n={}){const i=g(e);function o(e){if(e.status>=200&&e.status<300){const t=JSON.parse(e.responseText),r=this.stripQuotes(t.etag);return Promise.resolve({statusCode:200,contentType:t.mimeType,revision:r})}return 412===e.status?Promise.resolve({statusCode:412,revision:"conflict"}):Promise.reject("PUT failed with status "+e.status+" ("+e.responseText+")")}return this._getFileId(i).then(e=>e?n&&"*"===n.ifNoneMatch?o({status:412}):this._updateFile(e,i,t,r,n).then(o):this._createFile(i,t,r).then(o))}delete(e,t={}){const r=g(e);return this._getFileId(r).then(e=>e?this._getMeta(e).then(r=>{let n;return"object"==typeof r&&"string"==typeof r.etag&&(n=this.stripQuotes(r.etag)),t&&t.ifMatch&&t.ifMatch!==n?{statusCode:412,revision:n}:this._request("DELETE","https://www.googleapis.com/drive/v2/files/"+e,{}).then(e=>200===e.status||204===e.status?{statusCode:200}:Promise.reject("Delete failed: "+e.status+" ("+e.responseText+")"))}):Promise.resolve({statusCode:200}))}info(){return this._request("GET","https://www.googleapis.com/drive/v2/about?fields=user",{}).then(function(e){try{const t=JSON.parse(e.responseText);return Promise.resolve(t)}catch(e){return Promise.reject(e)}})}_updateFile(e,t,r,n,i){const o={mimeType:n},s={"Content-Type":"application/json; charset=UTF-8"};return i&&i.ifMatch&&(s["If-Match"]=this.addQuotes(i.ifMatch)),this._request("PUT","https://www.googleapis.com/upload/drive/v2/files/"+e+"?uploadType=resumable",{body:JSON.stringify(o),headers:s}).then(e=>412===e.status?e:this._request("PUT",e.getResponseHeader("Location"),{body:n.match(/^application\/json/)?JSON.stringify(r):r}))}_createFile(e,t,r){return this._getParentId(e).then(n=>{const i={title:d(f(e)),mimeType:r,parents:[{kind:"drive#fileLink",id:n}]};return this._request("POST","https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable",{body:JSON.stringify(i),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then(e=>this._request("POST",e.getResponseHeader("Location"),{body:r.match(/^application\/json/)?JSON.stringify(t):t}))})}_getFile(e,t){return this._getFileId(e).then(e=>this._getMeta(e).then(e=>{let r;if("object"==typeof e&&"string"==typeof e.etag&&(r=this.stripQuotes(e.etag)),t&&t.ifNoneMatch&&r===t.ifNoneMatch)return Promise.resolve({statusCode:304});if(!e.downloadUrl){if(!e.exportLinks||!e.exportLinks["text/html"])return Promise.resolve({statusCode:200,body:"",contentType:e.mimeType,revision:r});e.mimeType+=";export=text/html",e.downloadUrl=e.exportLinks["text/html"]}return this._request("GET",e.downloadUrl,{responseType:"arraybuffer"}).then(t=>(0,s.getTextFromArrayBuffer)(t.response,"UTF-8").then(function(n){let i=n;if(e.mimeType.match(/^application\/json/))try{i=JSON.parse(i)}catch(e){}else(0,s.shouldBeTreatedAsBinary)(n,e.mimeType)&&(i=t.response);return{statusCode:200,body:i,contentType:e.mimeType,revision:r}}))}))}_getFolder(e){return this._getFileId(e).then(t=>{let r,n,i;if(!t)return Promise.resolve({statusCode:404});const o="'"+t+"' in parents";return this._request("GET","https://www.googleapis.com/drive/v2/files?q="+encodeURIComponent(o)+"&fields=items(downloadUrl%2Cetag%2CfileSize%2Cid%2CmimeType%2Ctitle%2Clabels)&maxResults=1000&trashed=false",{}).then(t=>{var o;if(200!==t.status)return Promise.reject("request failed or something: "+t.status);try{r=JSON.parse(t.responseText)}catch(e){return Promise.reject("non-JSON response from GoogleDrive")}i={};for(const a of r.items)null!==(o=a.labels)&&void 0!==o&&o.trashed||(n=this.stripQuotes(a.etag),a.mimeType===u?(this._fileIdCache.set(e+(0,s.cleanPath)(a.title)+"/",a.id),i[a.title+"/"]={ETag:n}):(this._fileIdCache.set(e+(0,s.cleanPath)(a.title),a.id),i[a.title]={ETag:n,"Content-Type":a.mimeType,"Content-Length":a.fileSize}));return Promise.resolve({statusCode:200,body:i,contentType:"application/json; charset=UTF-8",revision:void 0})})})}_getParentId(e){const t=p(e);return this._getFileId(t).then(e=>e?Promise.resolve(e):this._createFolder(t))}_createFolder(e){return this._getParentId(e).then(t=>this._request("POST","https://www.googleapis.com/drive/v2/files",{body:JSON.stringify({title:d(f(e)),mimeType:u,parents:[{id:t}]}),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then(e=>{const t=JSON.parse(e.responseText);return Promise.resolve(t.id)}))}_getFileId(e){let t;return"/"===e?Promise.resolve("root"):(t=this._fileIdCache.get(e))?Promise.resolve(t):this._getFolder(p(e)).then(()=>(t=this._fileIdCache.get(e),t?Promise.resolve(t):"/"===e.substr(-1)?this._createFolder(e).then(()=>this._getFileId(e)):Promise.resolve()))}_getMeta(e){return this._request("GET","https://www.googleapis.com/drive/v2/files/"+e,{}).then(function(t){return 200===t.status?Promise.resolve(JSON.parse(t.responseText)):Promise.reject("request (getting metadata for "+e+") failed with status: "+t.status)})}_request(e,t,r){return this.isForbiddenRequestMethod(e,t)?Promise.reject(`Don't use ${e} on directories!`):(r.headers||(r.headers={}),r.headers.Authorization="Bearer "+this.token,this.rs._emit("wire-busy",{method:e,isFolder:(0,s.isFolder)(t)}),(0,a.requestWithTimeout)(e,t,r).then(r=>r&&401===r.status?void this.connect():(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,s.isFolder)(t),success:!0}),Promise.resolve(r)),r=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,s.isFolder)(t),success:!1}),Promise.reject(r))))}static _rs_init(e){const t=e.apiKeys.googledrive;var r;t&&(e.googledrive=new y(e,t.clientId),"googledrive"===e.backend&&(e._origRemote=e.remote,e.remote=e.googledrive,(r=e)._origBaseClientGetItemURL||(r._origBaseClientGetItemURL=i.default.prototype.getItemURL,i.default.prototype.getItemURL=function(){throw new Error("getItemURL is not implemented for Google Drive yet")})))}static _rs_supported(){return!0}static _rs_cleanup(e){var t;e.setBackend(void 0),e._origRemote&&(e.remote=e._origRemote,delete e._origRemote),(t=e)._origBaseClientGetItemURL&&(i.default.prototype.getItemURL=t._origBaseClientGetItemURL,delete t._origBaseClientGetItemURL)}}(0,s.applyMixins)(y,[o.default]),e.exports=y},567:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const o=i(r(93)),s=i(r(496)),a=i(r(334)),l=r(746),c="remotestorage";let u;class h extends s.default{constructor(e){super(),this.addEvents(["change","local-events-done"]),this.db=e||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(e){return n(this,void 0,void 0,function*(){const t=[],r={};for(let n=0,i=e.length;n<i;n++)void 0!==this.changesQueued[e[n]]?r[e[n]]=(0,l.deepClone)(this.changesQueued[e[n]]||void 0):void 0!==this.changesRunning[e[n]]?r[e[n]]=(0,l.deepClone)(this.changesRunning[e[n]]||void 0):t.push(e[n]);return t.length>0?this.getNodesFromDb(t).then(function(e){for(const t in r)e[t]=r[t];return e}):r})}setNodes(e){return n(this,void 0,void 0,function*(){for(const t in e)this.changesQueued[t]=e[t]||!1;this.maybeFlush()})}maybeFlush(){0===this.putsRunning?this.flushChangesQueued():this.commitSlownessWarning||(this.commitSlownessWarning=r.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(e){return new Promise((t,r)=>{const n=this.db.transaction(["nodes"],"readonly"),i=n.objectStore("nodes"),o={};this.getsRunning++,e.map(e=>{i.get(e).onsuccess=t=>{o[e]=t.target.result}}),n.oncomplete=()=>{t(o),this.getsRunning--},n.onerror=n.onabort=()=>{r("get transaction error/abort"),this.getsRunning--}})}setNodesInDb(e){return n(this,void 0,void 0,function*(){return new Promise((t,r)=>{const n=this.db.transaction(["nodes"],"readwrite"),i=n.objectStore("nodes"),o=(new Date).getTime();this.putsRunning++,(0,a.default)("[IndexedDB] Starting puts",e,this.putsRunning);for(const s in e){const t=e[s];if("object"==typeof t)try{i.put(t)}catch(e){throw(0,a.default)("[IndexedDB] Error while putting",t,e),e}else try{i.delete(s)}catch(e){throw(0,a.default)("[IndexedDB] Error while removing",i,t,e),e}}n.oncomplete=()=>{this.putsRunning--,(0,a.default)("[IndexedDB] Finished puts",e,this.putsRunning,(new Date).getTime()-o+"ms"),t()},n.onerror=()=>{this.putsRunning--,r("transaction error")},n.onabort=()=>{r("transaction abort"),this.putsRunning--}})})}reset(e){const t=this.db.name;this.db.close(),h.clean(t,()=>{h.open(t,(r,n)=>{r?(0,a.default)(`[IndexedDB] Error while resetting database ${t}:`,r):this.db=n,"function"==typeof e&&e(self)})})}forAllNodes(e){return n(this,void 0,void 0,function*(){return new Promise(t=>{this.db.transaction(["nodes"],"readonly").objectStore("nodes").openCursor().onsuccess=r=>{const n=r.target.result;n?(e(n.value),n.continue()):t()}})})}closeDB(){0===this.putsRunning?this.db.close():setTimeout(this.closeDB.bind(this),100)}static open(e,t){const r=setTimeout(function(){t("timeout trying to open db")},1e4);try{const n=indexedDB.open(e,2);n.onerror=function(){(0,a.default)("[IndexedDB] Opening DB failed",n),clearTimeout(r),t(n.error)},n.onupgradeneeded=function(e){const t=n.result;(0,a.default)("[IndexedDB] Upgrade: from ",e.oldVersion," to ",e.newVersion),t.objectStoreNames.contains("nodes")||((0,a.default)("[IndexedDB] Creating object store: nodes"),t.createObjectStore("nodes",{keyPath:"path"})),t.objectStoreNames.contains("changes")||((0,a.default)("[IndexedDB] Creating object store: changes"),t.createObjectStore("changes",{keyPath:"path"}))},n.onsuccess=function(){clearTimeout(r);const i=n.result;if(!i.objectStoreNames.contains("nodes")||!i.objectStoreNames.contains("changes"))return(0,a.default)("[IndexedDB] Missing object store. Resetting the database."),i.close(),void h.clean(e,function(){h.open(e,t)});t(null,n.result)}}catch(n){(0,a.default)("[IndexedDB] Failed to open database: "+n),(0,a.default)("[IndexedDB] Resetting database and trying again."),clearTimeout(r),h.clean(e,function(){h.open(e,t)})}}static clean(e,t){const r=indexedDB.deleteDatabase(e);r.onblocked=function(t){console.warn(`Deleting IndexedDB database "${e}" is blocked by another open connection`,t)},r.onsuccess=function(){(0,a.default)(`[IndexedDB] Deleted database "${e}"`),t()},r.onerror=r.onabort=function(t){console.error('Failed to remove database "'+e+'"',t)}}static _rs_init(e){return new Promise((t,r)=>{h.open(c,function(n,i){if(n)r(n);else{if(!i)return void r(new Error("IndexedDB opened without a database instance"));u=i,i.onerror=t=>{e._emit("error",h.eventToError(t))},t()}})})}static _rs_supported(){return new Promise((e,t)=>{const r=(0,l.getGlobalContext)();let n=!1;if("undefined"!=typeof navigator&&navigator.userAgent.match(/Android (2|3|4\.[0-3])/)&&(navigator.userAgent.match(/Chrome|Firefox/)||(n=!0)),"indexedDB"in r&&!n)try{const r=indexedDB.open("rs-check");r.onerror=function(){t()},r.onsuccess=function(){r.result.close(),indexedDB.deleteDatabase("rs-check"),e()}}catch(e){t()}else t()})}static _rs_cleanup(e){return new Promise(t=>{e.local instanceof h&&e.local.closeDB(),h.clean(c,t)})}static eventToError(e){var t;const r=null==e?void 0:e.target,n=null==r?void 0:r.error;if(n)return n;if(null===(t=null==r?void 0:r.db)||void 0===t?void 0:t.name){const e=r.objectStoreNames,t=e?Array.from(e).join(", "):"";return new Error(`Error in store(s) “${t}” in database “${r.db.name}”`)}return new Error("Unknown IndexedDB error")}diffHandler(){}}(0,l.applyMixins)(h,[o.default]),e.exports=h},365:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(r(93)),o=n(r(496)),s=r(746);class a extends o.default{constructor(){super(),this._storage={},this.addEvents(["change","local-events-done"])}getNodes(e){const t={};for(let r=0,n=e.length;r<n;r++)t[e[r]]=(0,s.deepClone)(this._storage[e[r]]);return Promise.resolve(t)}setNodes(e){for(const t in e)void 0===e[t]?delete this._storage[t]:this._storage[t]=e[t];return Promise.resolve()}forAllNodes(e){for(const t in this._storage)e(this._storage[t]);return Promise.resolve()}diffHandler(){}static _rs_init(){}static _rs_supported(){return!0}static _rs_cleanup(){}}(0,s.applyMixins)(a,[i.default]),e.exports=a},794:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(r(496)),o=n(r(93)),s=n(r(334)),a=r(746),l="remotestorage:cache:nodes:";function c(e){return e.substr(0,26)===l||"remotestorage:cache:changes:"===e.substr(0,28)}class u extends i.default{constructor(){super(),this.addEvents(["change","local-events-done"])}diffHandler(...e){}getNodes(e){const t={};for(let r=0,i=e.length;r<i;r++)try{const n=JSON.parse(localStorage.getItem(l+e[r]));t[e[r]]=n||void 0}catch(n){(0,s.default)(`[LocalStorage] Failed to get node: ${n.message}`),t[e[r]]=void 0}return Promise.resolve(t)}setNodes(e){for(const t in e)localStorage.setItem(l+t,JSON.stringify(e[t]));return Promise.resolve()}forAllNodes(e){let t;for(let r=0,n=localStorage.length;r<n;r++)if(localStorage.key(r).substr(0,26)===l){try{t=JSON.parse(localStorage.getItem(localStorage.key(r)))}catch(e){t=void 0}t&&e(t)}return Promise.resolve()}static _rs_init(){}static _rs_supported(){return(0,a.localStorageAvailable)()}static _rs_cleanup(){const e=[];(0,s.default)("[LocalStorage] Starting cleanup");for(let t=0,r=localStorage.length;t<r;t++){const r=localStorage.key(t);c(r)&&e.push(r)}for(const t in e)(0,s.default)("[LocalStorage] Removing",t),localStorage.removeItem(t)}}(0,a.applyMixins)(u,[o.default]),e.exports=u},334:function(e,t,r){const n=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(r(28));e.exports=function(...e){n.default.logging&&console.log(...e)}},684:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RemoteBase=void 0;const i=n(r(93)),o=r(746);class s extends i.default{constructor(e){super(),this.rs=e,this.connected=!1}stopWaitingForToken(){this.connected||this._emit("not-connected")}addQuotes(e){return"string"!=typeof e?e:"*"===e?"*":'"'+e+'"'}stripQuotes(e){return"string"!=typeof e?e:e.replace(/^["']|["']$/g,"")}isForbiddenRequestMethod(e,t){return("PUT"===e||"DELETE"===e)&&(0,o.isFolder)(t)}}t.RemoteBase=s},423:function(e,t,r){var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),s=0;s<r.length;s++)"default"!==r[s]&&i(t,e,r[s]);return o(t,e),t}),a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RemoteStorage=void 0;const l=a(r(28)),c=a(r(334)),u=r(746),h=a(r(548)),d=a(r(275)),p=a(r(424)),f=a(r(285)),g=r(93),m=a(r(801)),y=a(r(706)),v=a(r(373)),_=a(r(982)),b=a(r(503)),E=a(r(545)),w=s(r(746)),C=(0,u.getGlobalContext)();let S;const T="remotestorage:authorized-scope",x="remotestorage:pending-scope";function R(e){if("string"!=typeof e)return null;const t=e.trim().split(/\s+/).filter(Boolean);return 0===t.length?null:Array.from(new Set(t)).sort().join(" ")}function A(e){const t=(0,u.getJSONFromLocalStorage)(e);return"object"==typeof t&&null!==t?t:null}function I(e){return 403!==e.statusCode&&401!==e.statusCode||this._emit("error",new b.default),Promise.resolve(e)}function k(e){return"number"==typeof e&&e>=2e3&&e<=36e5}var P;!function(e){e.GOOGLE="googledrive",e.DROPBOX="dropbox"}(P||(P={}));class L{constructor(e){if(this._pending=[],this._cleanups=[],this._pathHandlers={change:{}},this.apiKeys={},this._init=E.default.loadFeatures,this.features=E.default.features,this.loadFeature=E.default.loadFeature,this.featureSupported=E.default.featureSupported,this.featureDone=E.default.featureDone,this.featuresDone=E.default.featuresDone,this.featuresLoaded=E.default.featuresLoaded,this.featureInitialized=E.default.featureInitialized,this.featureFailed=E.default.featureFailed,this.hasFeature=E.default.hasFeature,this._setCachingModule=E.default._setCachingModule,this._collectCleanupFunctions=E.default._collectCleanupFunctions,this._fireReady=E.default._fireReady,this.initFeature=E.default.initFeature,"object"==typeof e&&(0,u.extend)(l.default,e),this.addEvents(["ready","authing","connecting","connected","disconnected","not-connected","conflict","error","features-loaded","scope-change-required","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,u.localStorageAvailable)(),S){this.apiKeys=(0,u.getJSONFromLocalStorage)("remotestorage:api-keys")||{};const e=localStorage.getItem("remotestorage:backend");"dropbox"===e||"googledrive"===e?this.setBackend(e):this.setBackend("remotestorage")}this._authorizedScope=this._loadAuthorizedScope(),this._scopeChangeRequired=!1,this._scopeChangeEvent=null;const t=this.on;this.on=function(e,r){const n=t.call(this,e,r);if("scope-change-required"===e&&this._scopeChangeRequired&&this._scopeChangeEvent&&setTimeout(()=>{r(this._scopeChangeEvent)},0),this._allLoaded)switch(e){case"features-loaded":setTimeout(r,0);break;case"ready":this.remote&&setTimeout(r,0);break;case"connected":this.remote&&this.remote.connected&&setTimeout(r,0);break;case"not-connected":this.remote&&!this.remote.connected&&setTimeout(r,0)}return 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}get scopeChangeRequired(){return this._scopeChangeRequired}loadModules(){l.default.modules.forEach(this.addModule.bind(this))}authorize(e){if(this.access.setStorageType(this.remote.storageApi),void 0===e.scope&&(e.scope=this.access.scopeParameter),C.cordova&&"string"==typeof l.default.cordovaRedirectUri)e.redirectUri=l.default.cordovaRedirectUri;else{const t=d.default.getLocation();let r=t.origin;"/"!==t.pathname&&(r+=t.pathname),e.redirectUri=r}void 0===e.clientId&&(e.clientId=e.redirectUri.match(/^(https?:\/\/[^/]+)/)[0]),d.default.authorize(this,e)}impliedauth(e,t){e=e||this.remote.storageApi,t=t||String(document.location),(0,c.default)("ImpliedAuth proceeding due to absent authURL; storageApi = "+e+" redirectUri = "+t),this.remote.configure({token:d.default.IMPLIED_FAKE_TOKEN}),document.location.href=t}connect(e,t){if(this.setBackend("remotestorage"),e.indexOf("@")<0&&!e.match(/^(https?:\/\/)?[^\s\/$\.?#]+\.[^\s]*$/))this._emit("error",new L.DiscoveryError("Not a valid user address or URL."));else{if(e.indexOf("@")<0&&!e.match(/^https?:\/\//)&&(e=`https://${e}`),C.cordova){if("string"!=typeof l.default.cordovaRedirectUri)return void this._emit("error",new L.DiscoveryError("Please supply a custom HTTPS redirect URI for your Cordova app"));if(!C.cordova.InAppBrowser)return void this._emit("error",new L.DiscoveryError("Please include the InAppBrowser Cordova plugin to enable OAuth"))}this.remote.configure({userAddress:e}),this._emit("connecting"),L.Discover(e).then(r=>{if(this._emit("authing"),r.userAddress=e,this.remote.configure(r),!this.remote.connected)if(r.authURL)if(void 0===t)this.authorize({authURL:r.authURL});else{if("string"!=typeof t)throw new Error("Supplied bearer token must be a string");(0,c.default)("Skipping authorization sequence and connecting with known token"),this.remote.configure({token:t}),this._rememberAuthorizedScope(this.access.scopeParameter)}else this.impliedauth()},()=>{this._emit("error",new L.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()}reauthorize(){this.reconnect()}disconnect(){this.remote&&this.remote.configure({userAddress:null,href:null,storageApi:null,token:null,properties:null}),this._forgetPendingScope(),this._rememberAuthorizedScope(null),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")});const e=this._cleanups.length;let t=0;const r=()=>{t++,t>=e&&(this._init(),(0,c.default)('Cleanups done, emitting "disconnected" event'),this._emit("disconnected"))};e>0?this._cleanups.forEach(e=>{const t=e(this);"object"==typeof t&&"function"==typeof t.then?t.then(r):r()}):r()}setBackend(e){if(this.backend=e,S&&(void 0!==e?localStorage.setItem("remotestorage:backend",e):localStorage.removeItem("remotestorage:backend")),void 0===e)return this._authorizedScope=null,this._scopeChangeRequired=!1,void(this._scopeChangeEvent=null);this._authorizedScope=this._loadAuthorizedScope(),this._checkScopeChange()}_rememberPendingScope(e){const t=R(e);S&&(t&&this.backend?localStorage.setItem(x,JSON.stringify({backend:this.backend,scope:t})):localStorage.removeItem(x))}_forgetPendingScope(){S&&localStorage.removeItem(x)}_rememberAuthorizedScope(e){const t=R(e);S?t&&this.backend?(localStorage.setItem(T,JSON.stringify({backend:this.backend,scope:t})),this._authorizedScope=t,this._checkScopeChange()):(localStorage.removeItem(T),this._authorizedScope=null,this._checkScopeChange()):(this._authorizedScope=t,this._checkScopeChange())}_completeAuthorization(e){const t=this._loadPendingScope()||R(e);this._forgetPendingScope(),t?this._rememberAuthorizedScope(t):this._checkScopeChange()}_checkScopeChange(){const e=R(this.access.scopeParameter),t=this._authorizedScope||this._loadAuthorizedScope(),r=!(!e||!t||e===t),n=r&&(!this._scopeChangeRequired||!this._scopeChangeEvent||this._scopeChangeEvent.requestedScope!==e||this._scopeChangeEvent.authorizedScope!==t);this._scopeChangeRequired=r,r?(this._scopeChangeEvent=this._buildScopeChangeEvent(e,t),n&&this._emit("scope-change-required",this._scopeChangeEvent)):this._scopeChangeEvent=null}_loadAuthorizedScope(){if(!S||!this.backend)return null;const e=A(T);return e&&e.backend===this.backend?R(e.scope):null}_loadPendingScope(){if(!S||!this.backend)return null;const e=A(x);return e&&e.backend===this.backend?R(e.scope):null}_buildScopeChangeEvent(e=R(this.access.scopeParameter),t=this._authorizedScope){return{requestedScope:e||"",authorizedScope:t||"",reauthorize:this.reauthorize.bind(this)}}onChange(e,t){this._pathHandlers.change[e]||(this._pathHandlers.change[e]=[]),this._pathHandlers.change[e].push(t)}enableLog(){l.default.logging=!0}disableLog(){l.default.logging=!1}log(...e){c.default.apply(L,e)}setApiKeys(e){const t=[P.GOOGLE,P.DROPBOX];if("object"!=typeof e||!Object.keys(e).every(e=>t.includes(e)))return console.error("setApiKeys() was called with invalid arguments"),!1;Object.keys(e).forEach(t=>{const r=e[t];if(r){switch(t){case P.DROPBOX:this.apiKeys[P.DROPBOX]={appKey:r},void 0!==this.dropbox&&this.dropbox.clientId===r||y.default._rs_init(this);break;case P.GOOGLE:this.apiKeys[P.GOOGLE]={clientId:r},void 0!==this.googledrive&&this.googledrive.clientId===r||m.default._rs_init(this)}return!0}delete this.apiKeys[t]}),S&&localStorage.setItem("remotestorage:api-keys",JSON.stringify(this.apiKeys))}setCordovaRedirectUri(e){if("string"!=typeof e||!e.match(/http(s)?:\/\//))throw new Error("Cordova redirect URI must be a URI string");l.default.cordovaRedirectUri=e}_setGPD(e,t){function r(e){return function(...r){return e.apply(t,r).then(I.bind(this))}}this.get=r(e.get),this.put=r(e.put),this.delete=r(e.delete)}_pendingGPD(e){return(...t)=>{const r=Array.prototype.slice.call(t);return new Promise((t,n)=>{this._pending.push({method:e,args:r,promise:{resolve:t,reject:n}})})}}_processPending(){this._pending.forEach(e=>{try{this[e.method](...e.args).then(e.promise.resolve,e.promise.reject)}catch(t){e.promise.reject(t)}}),this._pending=[]}_bindChange(e){e.on("change",this._dispatchEvent.bind(this,"change"))}_dispatchEvent(e,t){Object.keys(this._pathHandlers[e]).forEach(r=>{const n=r.length;t.path.substr(0,n)===r&&this._pathHandlers[e][r].forEach(e=>{const n={};for(const r in t)n[r]=t[r];n.relativePath=t.path.replace(new RegExp("^"+r),"");try{e(n)}catch(e){console.error("'change' handler failed: ",e,e.stack),this._emit("error",e)}})})}scope(e){if("string"!=typeof e)throw"Argument 'path' of baseClient.scope must be a string";return this.access.checkPathPermission(e,"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 p.default(this,e)}getSyncInterval(){return l.default.syncInterval}setSyncInterval(e){if(!k(e))throw e+" is not a valid sync interval";const t=l.default.syncInterval;l.default.syncInterval=e,this._emit("sync-interval-change",{oldValue:t,newValue:e})}getBackgroundSyncInterval(){return l.default.backgroundSyncInterval}setBackgroundSyncInterval(e){if(!k(e))throw e+" is not a valid sync interval";const t=l.default.backgroundSyncInterval;l.default.backgroundSyncInterval=e,this._emit("sync-interval-change",{oldValue:t,newValue:e})}getCurrentSyncInterval(){return l.default.isBackground?l.default.backgroundSyncInterval:l.default.syncInterval}getRequestTimeout(){return l.default.requestTimeout}setRequestTimeout(e){if("number"!=typeof e)throw e+" is not a valid request timeout";l.default.requestTimeout=e}setupSyncCycle(){this.sync&&!this.sync.stopped&&((0,c.default)("[Sync] Setting up sync cycle"),this.on("sync-done",()=>{(0,c.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 l.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,c.default)("[Sync] Stopping sync"),this.sync.stopped=!0):((0,c.default)("[Sync] Will instantiate sync stopped"),this.syncStopped=!0)}addModule(e){const t=e.name,r=e.builder;if(Object.defineProperty(this,t,{configurable:!0,get:function(){const e=this._loadModule(t,r);return Object.defineProperty(this,t,{value:e}),e}}),-1!==t.indexOf("-")){const e=t.replace(/\-[a-z]/g,function(e){return e[1].toUpperCase()});Object.defineProperty(this,e,{get:function(){return this[t]}})}}_loadModule(e,t){if(t)return t(new p.default(this,"/"+e+"/"),new p.default(this,"/public/"+e+"/")).exports;throw"Unknown module: "+e}}t.RemoteStorage=L,L.SyncError=_.default,L.Unauthorized=b.default,L.Discover=v.default,L.DiscoveryError=v.default.DiscoveryError,L.util=w,Object.defineProperty(L.prototype,"access",{configurable:!0,get:function(){const e=new h.default(this);return Object.defineProperty(this,"access",{value:e,writable:!0,configurable:!0}),e}}),Object.defineProperty(L.prototype,"caching",{configurable:!0,get:function(){const e=new f.default(this);return Object.defineProperty(this,"caching",{value:e,writable:!0,configurable:!0}),e}}),(0,u.applyMixins)(L,[g.EventHandling]),t.default=L},368:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayBufferView=void 0,t.retryAfterMs=function(e){const t=1e3*parseInt(e.getResponseHeader("Retry-After"));return t>=1e3?t:Math.max(1500,Math.min(6e4,Math.round(s.default.syncInterval/(2.9+.2*Math.random()))))},t.requestWithTimeout=function(e,r,i){return n(this,void 0,void 0,function*(){return"function"==typeof fetch?function(e,t,r){return n(this,void 0,void 0,function*(){const n="function"==typeof AbortController?new AbortController:null;let i;const a=new Promise((e,t)=>{i=setTimeout(()=>{n&&n.abort(),t("timeout")},s.default.requestTimeout)});let l;const c={},u=fetch(t,{method:e,headers:r.headers,body:r.body,signal:n?n.signal:void 0}).then(e=>{switch((0,o.default)("[requests fetch]",e),e.headers.forEach((e,t)=>{c[t.toUpperCase()]=e}),l={readyState:4,status:e.status,statusText:e.statusText,response:void 0,getResponseHeader:e=>c[e.toUpperCase()]||null,responseType:r.responseType,responseURL:t},r.responseType){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json();case void 0:case"":case"text":return e.text();default:throw new Error("responseType 'document' is not currently supported using fetch")}}).then(e=>(l.response=e,r.responseType&&"text"!==r.responseType||(l.responseText=e),l)).finally(()=>{clearTimeout(i)});return Promise.race([u,a])})}(e,r,i):"function"==typeof XMLHttpRequest?function(e,r,i){return n(this,void 0,void 0,function*(){return new Promise((n,a)=>{(0,o.default)("[requests XHR]",e,r);let l=!1;const c=setTimeout(()=>{l=!0,a("timeout")},s.default.requestTimeout),u=new XMLHttpRequest;if(u.open(e,r,!0),i.responseType&&(u.responseType=i.responseType),i.headers)for(const e in i.headers)u.setRequestHeader(e,i.headers[e]);u.onload=()=>{l||(clearTimeout(c),n(u))},u.onerror=e=>{l||(clearTimeout(c),a(e))};let h=i.body;"object"==typeof h&&!(0,t.isArrayBufferView)(h)&&h instanceof ArrayBuffer&&(h=new Uint8Array(h)),u.send(h)})})}(e,r,i):Promise.reject("[Requests] You need to add a polyfill for fetch or XMLHttpRequest")})};const o=i(r(334)),s=i(r(28));if("function"==typeof(r.g||window).ArrayBufferView)t.isArrayBufferView=function(e){return e&&e instanceof(r.g||window).ArrayBufferView};else{const e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];t.isArrayBufferView=function(t){for(let r=0;r<8;r++)if(t instanceof e[r])return!0;return!1}}},941:function(e){e.exports=class{constructor(e){this._itemsRev={},this._storage={},this._canPropagate=!1,this.defaultValue=e,this.activatePropagation()}get(e){e=e.toLowerCase();let t=this._storage[e];return void 0===t&&(t=this.defaultValue,this._storage[e]=t),t}set(e,t){return e=e.toLowerCase(),this._storage[e]===t||(this._storage[e]=t,t||delete this._itemsRev[e],this._updateParentFolderItemRev(e,t),this._canPropagate&&this._propagate(e)),t}delete(e){return this.set(e,null)}deactivatePropagation(){return this._canPropagate=!1,!0}activatePropagation(){return this._canPropagate||(this._generateFolderRev("/"),this._canPropagate=!0),!0}_hashCode(e){let t=0;if(0===e.length)return t;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t}_generateHash(e){const t=e.sort().join("|");return""+this._hashCode(t)}_updateParentFolderItemRev(e,t){if("/"!==e){const r=this._getParentFolder(e);this._itemsRev[r]||(this._itemsRev[r]={});const n=this._itemsRev[r];t?n[e]=t:delete n[e],this._updateParentFolderItemRev(r,this.defaultValue)}}_getParentFolder(e){return e.substr(0,e.lastIndexOf("/",e.length-2)+1)}_propagate(e){if("/"!==e){const t=this._getParentFolder(e),r=this._itemsRev[t],n=[];for(const e in r)n.push(r[e]);const i=this._generateHash(n);this.set(t,i)}}_generateFolderRev(e){const t=this._itemsRev[e];let r=this.defaultValue;if(t){const e=[];for(const r in t){let n;n="/"===r.substr(-1)?this._generateFolderRev(r):t[r],e.push(n)}e.length>0&&(r=this._generateHash(e))}return this.set(e,r),r}}},491:function(e){class t extends Error{constructor(e){super();const t=new Error("Schema not found: "+e);return t.name="SchemaNotFound",t}}e.exports=t},982:function(e){class t extends Error{constructor(e){super(),this.name="SyncError",this.message="Sync failed: ","string"==typeof e?this.message+=e:(this.message+=e.message,this.stack=e.stack,this.originalError=e)}}e.exports=t},313:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Sync=void 0;const o=i(r(28)),s=i(r(451)),a=i(r(93)),l=i(r(334)),c=i(r(275)),u=i(r(982)),h=i(r(503)),d=r(746);let p,f;function g(e,t,r){return{action:e,path:t,promise:r}}function m(e,t){return e.common.revision!==t&&(!e.remote||e.remote.revision!==t)}function y(e){return!!e.common&&!!e.common.revision}class v{constructor(e){this.numThreads=10,this._tasks={},this._running={},this._timeStarted={},this._finishedTasks=[],this.rs=e,this.rs.local.onDiff(e=>{this.addTask(e),this.doTasks()}),this.rs.caching.onActivate(e=>{this.addTask(e),this.doTasks()}),this.addEvents(["done","req-done"])}now(){return(new Date).getTime()}queueGetRequest(e){return n(this,void 0,void 0,function*(){return new Promise((t,r)=>{this.rs.remote.connected?this.rs.remote.online?(this.addTask(e,function(){this.rs.local.get(e).then(e=>t(e))}.bind(this)),this.doTasks()):r("cannot fulfill maxAge requirement - remote is not online"):r("cannot fulfill maxAge requirement - remote is not connected")})})}corruptServerItemsMap(e){if("object"!=typeof e||Array.isArray(e))return!0;for(const t in e){const r=e[t];if("object"!=typeof r)return!0;if("string"!=typeof r.ETag)return!0;if((0,d.isFolder)(t)){if(-1!==t.substring(0,t.length-1).indexOf("/"))return!0}else if(-1!==t.indexOf("/"))return!0}return!1}corruptItemsMap(e){if("object"!=typeof e||Array.isArray(e))return!0;for(const t in e)if("boolean"!=typeof e[t])return!0;return!1}corruptRevision(e){return"object"!=typeof e||Array.isArray(e)||e.revision&&"string"!=typeof e.revision||e.body&&"string"!=typeof e.body&&"object"!=typeof e.body||e.contentType&&"string"!=typeof e.contentType||e.contentLength&&"number"!=typeof e.contentLength||e.timestamp&&"number"!=typeof e.timestamp||e.itemsMap&&this.corruptItemsMap(e.itemsMap)}isCorrupt(e){return"object"!=typeof e||Array.isArray(e)||"string"!=typeof e.path||this.corruptRevision(e.common)||e.local&&this.corruptRevision(e.local)||e.remote&&this.corruptRevision(e.remote)||e.push&&this.corruptRevision(e.push)}hasTasks(){return Object.keys(this._tasks).length>0}collectDiffTasks(){return n(this,void 0,void 0,function*(){let e=0;return this.rs.local.forAllNodes(t=>{e>100||(this.isCorrupt(t)?((0,l.default)("[Sync] WARNING: corrupt node in local cache",t),"object"==typeof t&&t.path&&(this.addTask(t.path),e++)):(this.needsFetch(t)&&this.rs.access.checkPathPermission(t.path,"r")||(0,d.isDocument)(t.path)&&this.needsPush(t)&&this.rs.access.checkPathPermission(t.path,"rw"))&&(this.addTask(t.path),e++))}).then(()=>e)})}inConflict(e){return!(!e.local||!e.remote||void 0===e.remote.body&&!e.remote.itemsMap)}needsRefresh(e){return!!e.common&&(!e.common.timestamp||this.now()-e.common.timestamp>o.default.syncInterval)}needsFetch(e){return!!this.inConflict(e)||!(!e.common||void 0!==e.common.itemsMap||void 0!==e.common.body)||!(!e.remote||void 0!==e.remote.itemsMap||void 0!==e.remote.body)}needsPush(e){return!this.inConflict(e)&&(!(!e.local||e.push)||void 0)}needsRemotePut(e){return!(!e.local||void 0===e.local.body||!1===e.local.body)}needsRemoteDelete(e){return e.local&&!1===e.local.body}getParentPath(e){const t=e.match(/^(.*\/)([^\/]+\/?)$/);if(t)return t[1];throw new Error('Not a valid path: "'+e+'"')}deleteChildPathsFromTasks(){for(const e in this._tasks){const t=(0,d.pathsFromRoot)(e);for(let r=1;r<t.length;r++)this._tasks[t[r]]&&(Array.isArray(this._tasks[e])&&this._tasks[e].length&&Array.prototype.push.apply(this._tasks[t[r]],this._tasks[e]),delete this._tasks[e])}}collectRefreshTasks(){return n(this,void 0,void 0,function*(){yield this.rs.local.forAllNodes(e=>{let t;if(this.needsRefresh(e)){try{t=this.getParentPath(e.path)}catch(e){}t&&this.rs.access.checkPathPermission(t,"r")?this.addTask(t):this.rs.access.checkPathPermission(e.path,"r")&&this.addTask(e.path)}}),this.deleteChildPathsFromTasks()})}flush(e){for(const t in e)"FLUSH"===this.rs.caching.checkPath(t)&&e[t]&&!e[t].local&&((0,l.default)("[Sync] Flushing",t),e[t]=void 0);return e}doTask(e){return n(this,void 0,void 0,function*(){return this.rs.local.getNodes([e]).then(t=>{const r=t[e];return void 0===r||function(e){return!(!e.remote||!e.remote.revision||e.remote.itemsMap||e.remote.body)}(r)?g("get",e,this.rs.remote.get(e)):this.needsRemotePut(r)?(r.push=(0,d.deepClone)(r.local),r.push.timestamp=this.now(),this.rs.local.setNodes(this.flush(t)).then(()=>{let t;return t=y(r)?{ifMatch:r.common.revision}:{ifNoneMatch:"*"},g("put",e,this.rs.remote.put(e,r.push.body,r.push.contentType,t))})):this.needsRemoteDelete(r)?(r.push={body:!1,timestamp:this.now()},this.rs.local.setNodes(this.flush(t)).then(()=>y(r)?g("delete",e,this.rs.remote.delete(e,{ifMatch:r.common.revision})):g("get",e,this.rs.remote.get(e)))):y(r)?g("get",e,this.rs.remote.get(e,{ifNoneMatch:r.common.revision})):g("get",e,this.rs.remote.get(e))})})}autoMergeFolder(e){if(e.remote.itemsMap&&(e.common=e.remote,delete e.remote,e.common.itemsMap)){for(const t in e.common.itemsMap)e.local.itemsMap[t]||(e.local.itemsMap[t]=!1);for(const t in e.local.itemsMap)e.common.itemsMap[t]||this.addTask(e.path+t);(0,d.equal)(e.local.itemsMap,e.common.itemsMap)&&delete e.local}return e}autoMergeDocument(e){var t;return function(e){return(!e.remote||!e.remote.revision||e.remote.revision===e.common.revision)&&(void 0===e.common.body&&!1===e.remote.body||e.remote.body===e.common.body&&e.remote.contentType===e.common.contentType)}(e)?delete(e=function(e){return e.remote&&!1===e.remote.body&&e.local&&!1===e.local.body&&delete e.local,e}(e)).remote:void 0!==e.remote.body&&(!1===e.remote.body&&!1===(null===(t=e.local)||void 0===t?void 0:t.body)||((0,l.default)("[Sync] Emitting conflict event"),setTimeout(this.rs.local.emitChange.bind(this.rs.local),10,{origin:"conflict",path:e.path,oldValue:e.local.body,newValue:e.remote.body,lastCommonValue:e.common.body,oldContentType:e.local.contentType,newContentType:e.remote.contentType,lastCommonContentType:e.common.contentType})),!1===e.remote.body?e.common={}:e.common=e.remote,delete e.remote,delete e.local),e}autoMerge(e){if(e.remote){if(e.local)return(0,d.isFolder)(e.path)?this.autoMergeFolder(e):this.autoMergeDocument(e);if((0,d.isFolder)(e.path))void 0!==e.remote.itemsMap&&(e.common=e.remote,delete e.remote);else if(void 0!==e.remote.body){const t={origin:"remote",path:e.path,oldValue:!1===e.common.body?void 0:e.common.body,newValue:!1===e.remote.body?void 0:e.remote.body,oldContentType:e.common.contentType,newContentType:e.remote.contentType};if(void 0===t.oldValue&&void 0===t.newValue||this.rs.local.emitChange(t),!1===e.remote.body)return;e.common=e.remote,delete e.remote}return e}e.common.body&&this.rs.local.emitChange({origin:"remote",path:e.path,oldValue:e.common.body,newValue:void 0,oldContentType:e.common.contentType,newContentType:void 0})}updateCommonTimestamp(e,t){return n(this,void 0,void 0,function*(){return this.rs.local.getNodes([e]).then(r=>(r[e]&&r[e].common&&r[e].common.revision===t&&(r[e].common.timestamp=this.now()),this.rs.local.setNodes(this.flush(r))))})}markChildren(e,t,r,i){return n(this,void 0,void 0,function*(){const n=[],o={},s={};for(const r in t)n.push(e+r),o[e+r]=t[r];for(const t in i)n.push(e+t);const a=yield this.rs.local.getNodes(n);let l,c;for(const t in a)if(c=a[t],o[t])c&&c.common?m(c,o[t].ETag)&&(r[t]=(0,d.deepClone)(c),r[t].remote={revision:o[t].ETag,timestamp:this.now()},r[t]=this.autoMerge(r[t])):(l=this.rs.caching.checkPath(t),"ALL"===l&&(r[t]={path:t,common:{timestamp:this.now()},remote:{revision:o[t].ETag,timestamp:this.now()}})),r[t]&&o[t]["Content-Type"]&&(r[t].remote.contentType=o[t]["Content-Type"]),r[t]&&o[t]["Content-Length"]&&(r[t].remote.contentLength=o[t]["Content-Length"]);else if(i[t.substring(e.length)]&&c&&c.common){if(c.common.itemsMap)for(const e in c.common.itemsMap)s[t+e]=!0;if(c.local&&c.local.itemsMap)for(const e in c.local.itemsMap)s[t+e]=!0;if(c.remote||(0,d.isFolder)(t))r[t]=void 0;else if(r[t]=this.autoMerge(c),void 0===r[t]){const n=r[this.getParentPath(t)],i=t.substring(e.length);n&&n.local&&(delete n.local.itemsMap[i],(0,d.equal)(n.local.itemsMap,n.common.itemsMap)&&delete n.local)}}const u=yield this.markRemoteDeletions(Object.keys(s),r);u&&(yield this.rs.local.setNodes(this.flush(u)))})}markRemoteDeletions(e,t){return n(this,void 0,void 0,function*(){if(0===e.length)return t;const r=yield this.rs.local.getNodes(e),n={};function i(e,t){if(e&&e.itemsMap)for(const r in e.itemsMap)n[t+r]=!0}for(const e in r){const n=r[e];n&&((0,d.isFolder)(e)?(i(n.common,e),i(n.local,e)):n.common&&void 0!==n.common.body&&(t[e]=(0,d.deepClone)(n),t[e].remote={body:!1,timestamp:this.now()},t[e]=this.autoMerge(t[e])))}const o=yield this.markRemoteDeletions(Object.keys(n),t);o&&(yield this.rs.local.setNodes(this.flush(o)))})}completeFetch(e,t,r,i){return n(this,void 0,void 0,function*(){let n,o;const s=(0,d.pathsFromRoot)(e);(0,d.isFolder)(e)?n=[e]:(o=s[1],n=[e,o]);const a=yield this.rs.local.getNodes(n),l=a[o],c={};let u,h=a[e];function p(e){if(e&&e.itemsMap)for(u in e.itemsMap)t[u]||(c[u]=!0)}if("object"==typeof h&&h.path===e&&"object"==typeof h.common||(h={path:e,common:{}},a[e]=h),h.remote={revision:i,timestamp:this.now()},(0,d.isFolder)(e))for(u in p(h.common),p(h.remote),h.remote.itemsMap={},t)h.remote.itemsMap[u]=!0;else h.remote.body=t,h.remote.contentType=r,l&&l.local&&l.local.itemsMap&&(u=e.substring(o.length),!1!==t?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[e]=this.autoMerge(h),{toBeSaved:a,missingChildren:c}})}completePush(e,t,r,i){return n(this,void 0,void 0,function*(){const n=yield this.rs.local.getNodes([e]),o=n[e];if(!o.push)throw this.stopped=!0,new Error("completePush called but no push version!");r?((0,l.default)("[Sync] We have a conflict"),o.remote&&o.remote.revision===i||(o.remote={revision:i||"conflict",timestamp:this.now()},delete o.push),n[e]=this.autoMerge(o)):(o.common={revision:i,timestamp:this.now()},"put"===t?(o.common.body=o.push.body,o.common.contentType=o.push.contentType,(0,d.equal)(o.local.body,o.push.body)&&o.local.contentType===o.push.contentType&&delete o.local,delete o.push):"delete"===t&&(!1===o.local.body?n[e]=void 0:delete o.push)),yield this.rs.local.setNodes(this.flush(n))})}dealWithFailure(e){return n(this,void 0,void 0,function*(){const t=yield this.rs.local.getNodes([e]);if(t[e])return delete t[e].push,this.rs.local.setNodes(this.flush(t))})}interpretStatus(e){const t={statusCode:e,successful:void 0,conflict:void 0,unAuth:void 0,notFound:void 0,changed:void 0,networkProblems:void 0};return"string"!=typeof e||"offline"!==e&&"timeout"!==e?"number"==typeof e?(t.successful=2===Math.floor(e/100)||304===e||412===e||404===e,t.conflict=412===e,t.unAuth=401===e&&this.rs.remote.token!==c.default.IMPLIED_FAKE_TOKEN||402===e||403===e,t.notFound=404===e,t.changed=304!==e,t):void 0:(t.successful=!1,t.networkProblems=!0,t)}handleGetResponse(e,t,r,i,o){return n(this,void 0,void 0,function*(){if(t.notFound&&(r=!!(0,d.isFolder)(e)&&{}),t.changed){const t=yield this.completeFetch(e,r,i,o);if((0,d.isFolder)(e)){if(this.corruptServerItemsMap(r))return(0,l.default)("[Sync] WARNING: Discarding corrupt folder description from server for "+e),!1;yield this.markChildren(e,r,t.toBeSaved,t.missingChildren)}else yield this.rs.local.setNodes(this.flush(t.toBeSaved))}else yield this.updateCommonTimestamp(e,o);return!0})}handleResponse(e,t,r){return n(this,void 0,void 0,function*(){const n=this.interpretStatus(r.statusCode);if(n.successful){if("get"===t)return this.handleGetResponse(e,n,r.body,r.contentType,r.revision);if("put"===t||"delete"===t)return this.completePush(e,t,n.conflict,r.revision).then(function(){return!0});throw new Error(`cannot handle response for unknown action ${t}`)}{let t;return t=n.unAuth?new h.default:n.networkProblems?new u.default("Network request failed."):new Error("HTTP response code "+n.statusCode+" received."),this.dealWithFailure(e).then(()=>{throw this.rs._emit("error",t),t})}})}finishTask(e){return n(this,arguments,void 0,function*(e,t=!0){if(void 0===e.action)return void delete this._running[e.path];if(t&&((0,l.default)("[Sync] queue finished task:",e.path),this._finishedTasks.push(e),this._finishedTasks.length>1))return void(0,l.default)("[Sync] delaying finished task:",e.path);let r;(0,l.default)("[Sync] run task:",e.path);try{r=yield e.promise}catch(t){(0,l.default)("[Sync] wire client rejects its promise",e.path,e.action,t),r={statusCode:"offline"}}try{const t=yield this.handleResponse(e.path,e.action,r);this.finishSuccessfulTask(e,t)}catch(t){this.finishUnsuccessfulTask(e,t)}})}finishSuccessfulTask(e,t){return n(this,void 0,void 0,function*(){if(this._finishedTasks.shift(),delete this._timeStarted[e.path],delete this._running[e.path],t&&this._tasks[e.path]){for(let t=0;t<this._tasks[e.path].length;t++)this._tasks[e.path][t]();delete this._tasks[e.path]}this.rs._emit("sync-req-done",{tasksRemaining:Object.keys(this._tasks).length}),this._finishedTasks.length>0?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(e,t){return n(this,void 0,void 0,function*(){(0,l.default)("[Sync]",t.message),this._finishedTasks.shift(),delete this._timeStarted[e.path],delete this._running[e.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 e=this.tasksWanted()-Object.keys(this._running).length;if(e<=0)return!0;this.hasTasks()&&!this.done&&this.rs._emit("sync-started");let t,r=0;for(t in this._tasks)if(!this._running[t]&&(this._timeStarted[t]=this.now(),this._running[t]=this.doTask(t).then(this.finishTask.bind(this)),r++,r>=e))break;return r>=e}collectTasks(){return n(this,arguments,void 0,function*(e=!0){if(!this.hasTasks()&&!this.stopped)return(yield this.collectDiffTasks())>0?void 0:e?this.collectRefreshTasks():void 0})}addTask(e,t){this._tasks[e]||(this._tasks[e]=[]),"function"==typeof t&&this._tasks[e].push(t)}sync(){return n(this,void 0,void 0,function*(){if(this.done=!1,!this.doTasks()){try{yield this.collectTasks()}catch(e){throw(0,l.default)("[Sync] Sync error",e),new Error("Local cache unavailable")}this.doTasks()}})}static _rs_init(e){p=function(){const t=new s.default;t.isBrowser()&&function(e,t){function r(e){const r=t.getCurrentSyncInterval();o.default.isBackground=!e;const n=t.getCurrentSyncInterval();t._emit("sync-interval-change",{oldValue:r,newValue:n})}e.on("background",()=>r(!1)),e.on("foreground",()=>r(!0))}(t,e),e.sync||(e.sync=new v(e),e.syncStopped&&((0,l.default)("[Sync] Initializing with sync stopped"),e.sync.stopped=!0,delete e.syncStopped)),e.setupSyncCycle()},f=function(){e.removeEventListener("connected",f),e.startSync()},e.on("ready",p),e.on("connected",f)}static _rs_cleanup(e){e.stopSync(),e.removeEventListener("ready",p),e.removeEventListener("connected",f),e.caching.resetActivationHandler(),e.sync=void 0,delete e.sync}}t.Sync=v,(0,d.applyMixins)(v,[a.default]),t.default=v},370:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})};const i=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(r(334));function o(e){return"dropbox"===this.backend&&!!e.match(/^\/public\/.*[^\/]$/)}const s={get:function(e,t){if(this.local){if(void 0===t)t="object"==typeof(r=this).remote&&r.remote.connected&&r.remote.online?2*r.getSyncInterval():((0,i.default)("Not setting default maxAge, because remote is offline or not connected"),!1);else if("number"!=typeof t&&!1!==t)return Promise.reject("Argument 'maxAge' must be 'false' or a number");return this.local.get(e,t,this.sync.queueGetRequest.bind(this.sync))}return this.remote.get(e);var r},put:function(e,t,r){return o.bind(this)(e)?s._wrapBusyDone.call(this,this.remote.put(e,t,r)):this.local?this.local.put(e,t,r):s._wrapBusyDone.call(this,this.remote.put(e,t,r))},delete:function(e,t){return this.local?this.local.delete(e,t):s._wrapBusyDone.call(this,this.remote.delete(e,t))},_wrapBusyDone:function(e){return n(this,void 0,void 0,function*(){return this._emit("wire-busy"),e.then(e=>(this._emit("wire-done",{success:!0}),Promise.resolve(e)),e=>(this._emit("wire-done",{success:!1}),Promise.reject(e)))})}};e.exports=s},613:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BaseClientTypes=void 0;class r{constructor(){this.uris={},this.schemas={},this.aliases={}}declare(e,t,r,n){const i=e+"/"+t;if(n.extends){const t=n.extends.split("/"),r=1===t.length?e+"/"+t.shift():t.join("/"),o=this.uris[r];if(!o)throw"Type '"+i+"' tries to extend unknown schema '"+r+"'";n.extends=this.schemas[o]}this.uris[i]=r,this.aliases[r]=i,this.schemas[r]=n}resolveAlias(e){return this.uris[e]}getSchema(e){return this.schemas[e]}inScope(e){const t=e.length,r={};for(const n in this.uris)if(n.substr(0,t+1)===e+"/"){const e=this.uris[n];r[e]=this.schemas[e]}return r}}t.BaseClientTypes=r,t.default=new r},503:function(e){class t extends Error{constructor(e,t={}){super(),this.name="Unauthorized",this.message=void 0===e?"App authorization expired or revoked.":e,void 0!==t.code&&(this.code=t.code),this.stack=(new Error).stack}}e.exports=t},746:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.toBase64=t.getTextFromArrayBuffer=t.shouldBeTreatedAsBinary=t.getJSONFromLocalStorage=t.localStorageAvailable=t.pathsFromRoot=t.deepClone=t.equal=t.bindAll=t.cleanPath=t.baseName=t.isDocument=t.isFolder=t.containingFolder=t.extend=t.getGlobalContext=t.globalContext=t.logError=void 0,t.generateCodeVerifier=function(){return n(this,arguments,void 0,function*(e=128){const t=new Uint8Array(e);crypto.getRandomValues(t);const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=Array.from(t).map(e=>r[e%66]),i=n.join(""),o=Uint8Array.from(n.map(e=>e.charCodeAt(0))),s=(a=yield crypto.subtle.digest("SHA-256",o),btoa(String.fromCharCode.apply(null,new Uint8Array(a))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""));var a;return crypto.getRandomValues(t),{codeVerifier:i,codeChallenge:s,state:Array.from(t).map(e=>r[e%66]).join("")}})},t.applyMixins=function(e,t){t.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(r=>{Object.defineProperty(e.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r))})})},t.logError=e=>{"string"==typeof e?console.error(e):console.error(e.message,e.stack)},t.globalContext="undefined"!=typeof window?window:"object"==typeof self?self:r.g,t.getGlobalContext=()=>"undefined"!=typeof window?window:"object"==typeof self?self:r.g,t.extend=(...e)=>{const t=e[0];return Array.prototype.slice.call(e,1).forEach(function(e){for(const r in e)t[r]=e[r]}),t},t.containingFolder=e=>{if(""===e)return"/";if(!e)throw"Path not given!";return e.replace(/\/+/g,"/").replace(/[^\/]+\/?$/,"")},t.isFolder=e=>"/"===e.slice(-1),t.isDocument=e=>!(0,t.isFolder)(e),t.baseName=e=>{const r=e.split("/");return(0,t.isFolder)(e)?r[r.length-2]+"/":r[r.length-1]},t.cleanPath=e=>e.replace(/\/+/g,"/").split("/").map(encodeURIComponent).join("/").replace(/'/g,"%27"),t.bindAll=e=>{for(const t in this)"function"==typeof e[t]&&(e[t]=e[t].bind(e))},t.equal=(e,r,n=[])=>{let i;if(typeof e!=typeof r)return!1;if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return e===r;if("function"==typeof e)return e.toString()===r.toString();if(e instanceof ArrayBuffer&&r instanceof ArrayBuffer&&(e=new Uint8Array(e),r=new Uint8Array(r)),null===e||null===r)return e===r;if(e instanceof Array){if(e.length!==r.length)return!1;for(let i=0,o=e.length;i<o;i++)if(!(0,t.equal)(e[i],r[i],n))return!1}else{for(i in e)if(e.hasOwnProperty(i)&&!(i in r))return!1;for(i in r){if(!r.hasOwnProperty(i))continue;if(!(i in e))return!1;let o;if("object"==typeof r[i]){if(n.indexOf(r[i])>=0)continue;o=n.slice(),o.push(r[i])}if(!(0,t.equal)(e[i],r[i],o))return!1}}return!0},t.deepClone=e=>void 0===e?void 0:"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e)),t.pathsFromRoot=e=>{const t=[e],r=e.replace(/\/$/,"").split("/");for(;r.length>1;)r.pop(),t.push(r.join("/")+"/");return t},t.localStorageAvailable=()=>{const e=(0,t.getGlobalContext)();if(!("localStorage"in e))return!1;try{return e.localStorage.setItem("rs-check","1"),e.localStorage.removeItem("rs-check"),!0}catch(e){return!1}},t.getJSONFromLocalStorage=e=>{const r=(0,t.getGlobalContext)();try{return JSON.parse(r.localStorage.getItem(e))}catch(e){}},t.shouldBeTreatedAsBinary=(e,t)=>!!(t&&t.match(/charset=binary/)||/[\x00-\x08\x0E-\x1F\uFFFD]/.test(e)),t.getTextFromArrayBuffer=(e,r)=>new Promise(n=>{if("undefined"==typeof Blob||"undefined"==typeof FileReader)n(Buffer.from(e).toString(r));else{let i;const o=t.globalContext;if(o.BlobBuilder=o.BlobBuilder||o.WebKitBlobBuilder,void 0!==o.BlobBuilder){const t=new o.BlobBuilder;t.append(e),i=t.getBlob()}else i=new Blob([e]);const s=new FileReader;"function"==typeof s.addEventListener?s.addEventListener("loadend",function(e){n(e.target.result)}):s.onloadend=function(e){n(e.target.result)},s.readAsText(i,r)}}),t.toBase64=e=>{const r=(0,t.getGlobalContext)();return"btoa"in r?r.btoa(e):Buffer.from(e).toString("base64")}},600:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const o=i(r(275)),s=i(r(93)),a=i(r(503)),l=i(r(334)),c=r(746),u=r(368),h=r(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(e){if(super(e),this._revisionCache={},d=(0,c.localStorageAvailable)(),this.addEvents(["connected","not-connected"]),d){const e=function(){const{userAddress:e,href:t,storageApi:r,token:n,properties:i}=(0,c.getJSONFromLocalStorage)(p)||{};return{userAddress:e,href:t,storageApi:r,token:n,properties:i}}();e&&setTimeout(()=>{this.configure(e)},0)}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}_request(e,t,r,i,s,h,d){return n(this,void 0,void 0,function*(){if(this.isForbiddenRequestMethod(e,t))return Promise.reject(`Don't use ${e} on directories!`);let n;return r!==o.default.IMPLIED_FAKE_TOKEN&&(i.Authorization="Bearer "+r),this.rs._emit("wire-busy",{method:e,isFolder:(0,c.isFolder)(t)}),(0,u.requestWithTimeout)(e,t,{body:s,headers:i,responseType:"arraybuffer"}).then(r=>{if(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,c.isFolder)(t),success:!0}),i=r.status,[401,403,404,412].indexOf(i)>=0)return(0,l.default)("[WireClient] Error response status",r.status),n=h?this.stripQuotes(r.getResponseHeader("ETag")):void 0,401===r.status&&this.rs._emit("error",new a.default),Promise.resolve({statusCode:r.status,revision:n});if(function(e){return[201,204,304].indexOf(e)>=0}(r.status)||200===r.status&&"GET"!==e)return n=this.stripQuotes(r.getResponseHeader("ETag")),(0,l.default)("[WireClient] Successful request",n),Promise.resolve({statusCode:r.status,revision:n});{const e=r.getResponseHeader("Content-Type");n=h?this.stripQuotes(r.getResponseHeader("ETag")):200===r.status?d:void 0;const t=function(e){let t,r="utf-8";return e&&(t=e.match(/charset=(.+)$/),t&&(r=t[1])),r}(e);return(0,c.shouldBeTreatedAsBinary)(r.response,e)?((0,l.default)("[WireClient] Successful request with unknown or binary mime-type",n),Promise.resolve({statusCode:r.status,body:r.response,contentType:e,revision:n})):(0,c.getTextFromArrayBuffer)(r.response,t).then(t=>((0,l.default)("[WireClient] Successful request",n),Promise.resolve({statusCode:r.status,body:t,contentType:e,revision:n})))}var i},r=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,c.isFolder)(t),success:!1}),Promise.reject(r)))})}configure(e){if("object"!=typeof e)throw new Error("WireClient configure settings parameter should be an object");if(void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.href&&(this.href=e.href),void 0!==e.storageApi&&(this.storageApi=e.storageApi),void 0!==e.token&&(this.token=e.token),void 0!==e.properties&&(this.properties=e.properties),"string"==typeof this.storageApi){const e=f[this.storageApi]||5;this.supportsRevs=e>=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(e,t={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");const r={};return this.supportsRevs&&t.ifNoneMatch&&(r["If-None-Match"]=this.addQuotes(t.ifNoneMatch)),this._request("GET",this.href+(0,c.cleanPath)(e),this.token,r,void 0,this.supportsRevs,this._revisionCache[e]).then(t=>{if(!(0,c.isFolder)(e))return Promise.resolve(t);let r={};if(void 0!==t.body)try{t.body=JSON.parse(t.body)}catch(t){return Promise.reject("Folder description at "+this.href+(0,c.cleanPath)(e)+" is not JSON")}if(200===t.statusCode&&"object"==typeof t.body){if(0===Object.keys(t.body).length)t.statusCode=404;else if("http://remotestorage.io/spec/folder-description"===(n=t.body)["@context"]&&"object"==typeof n.items){for(const r in t.body.items)this._revisionCache[e+r]=t.body.items[r].ETag;r=t.body.items}else Object.keys(t.body).forEach(n=>{this._revisionCache[e+n]=t.body[n],r[n]={ETag:t.body[n]}});return t.body=r,Promise.resolve(t)}return Promise.resolve(t);var n})}put(e,t,r,n={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");!r.match(/charset=/)&&(t instanceof ArrayBuffer||(0,u.isArrayBufferView)(t))&&(r+="; charset=binary");const i={"Content-Type":r};return this.supportsRevs&&(n.ifMatch&&(i["If-Match"]=this.addQuotes(n.ifMatch)),n.ifNoneMatch&&(i["If-None-Match"]=this.addQuotes(n.ifNoneMatch))),this._request("PUT",this.href+(0,c.cleanPath)(e),this.token,i,t,this.supportsRevs)}delete(e,t={}){if(!this.connected)throw new Error("not connected (path: "+e+")");t||(t={});const r={};return this.supportsRevs&&t.ifMatch&&(r["If-Match"]=this.addQuotes(t.ifMatch)),this._request("DELETE",this.href+(0,c.cleanPath)(e),this.token,r,void 0,this.supportsRevs)}static _rs_init(e){e.remote=new g(e),e.remote.online=!0}static _rs_supported(){return"function"==typeof fetch||"function"==typeof XMLHttpRequest}static _rs_cleanup(){d&&delete localStorage[p]}}(0,c.applyMixins)(g,[s.default]),e.exports=g},439:function(e,t){var r;void 0===(r=function(){var e,t,r,n;Object.keys||(Object.keys=(e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=(r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(i){if("object"!=typeof i&&"function"!=typeof i||null===i)throw new TypeError("Object.keys called on non-object");var o=[];for(var s in i)e.call(i,s)&&o.push(s);if(t)for(var a=0;a<n;a++)e.call(i,r[a])&&o.push(r[a]);return o})),Object.create||(Object.create=function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return e.prototype=t,new e}}()),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){if(null===this)throw new TypeError;var t=Object(this),r=t.length>>>0;if(0===r)return-1;var n=0;if(arguments.length>1&&((n=Number(arguments[1]))!=n?n=0:0!==n&&n!==1/0&&n!==-1/0&&(n=(n>0||-1)*Math.floor(Math.abs(n)))),n>=r)return-1;for(var i=n>=0?n:Math.max(r-Math.abs(n),0);i<r;i++)if(i in t&&t[i]===e)return i;return-1}),Object.isFrozen||(Object.isFrozen=function(e){for(var t="tv4_test_frozen_key";e.hasOwnProperty(t);)t+=Math.random();try{return e[t]=!0,delete e[t],!1}catch(e){return!0}});var i={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},o={"*":!0};function s(e){return encodeURI(e).replace(/%25[0-9][0-9]/g,function(e){return"%"+e.substring(3)})}function a(e){var t="";i[e.charAt(0)]&&(t=e.charAt(0),e=e.substring(1));var r="",n="",a=!0,l=!1,c=!1;"+"===t?a=!1:"."===t?(n=".",r="."):"/"===t?(n="/",r="/"):"#"===t?(n="#",a=!1):";"===t?(n=";",r=";",l=!0,c=!0):"?"===t?(n="?",r="&",l=!0):"&"===t&&(n="&",r="&",l=!0);for(var u=[],h=e.split(","),d=[],p={},f=0;f<h.length;f++){var g=h[f],m=null;if(-1!==g.indexOf(":")){var y=g.split(":");g=y[0],m=parseInt(y[1],10)}for(var v={};o[g.charAt(g.length-1)];)v[g.charAt(g.length-1)]=!0,g=g.substring(0,g.length-1);var _={truncate:m,name:g,suffices:v};d.push(_),p[g]=_,u.push(g)}var b=function(e){for(var t="",i=0,o=0;o<d.length;o++){var u=d[o],h=e(u.name);if(null==h||Array.isArray(h)&&0===h.length||"object"==typeof h&&0===Object.keys(h).length)i++;else if(t+=o===i?n:r||",",Array.isArray(h)){l&&(t+=u.name+"=");for(var p=0;p<h.length;p++)p>0&&(t+=u.suffices["*"]&&r||",",u.suffices["*"]&&l&&(t+=u.name+"=")),t+=a?encodeURIComponent(h[p]).replace(/!/g,"%21"):s(h[p])}else if("object"==typeof h){l&&!u.suffices["*"]&&(t+=u.name+"=");var f=!0;for(var g in h)f||(t+=u.suffices["*"]&&r||","),f=!1,t+=a?encodeURIComponent(g).replace(/!/g,"%21"):s(g),t+=u.suffices["*"]?"=":",",t+=a?encodeURIComponent(h[g]).replace(/!/g,"%21"):s(h[g])}else l&&(t+=u.name,c&&""===h||(t+="=")),null!=u.truncate&&(h=h.substring(0,u.truncate)),t+=a?encodeURIComponent(h).replace(/!/g,"%21"):s(h)}return t};return b.varNames=u,{prefix:n,substitution:b}}function l(e){if(!(this instanceof l))return new l(e);for(var t=e.split("{"),r=[t.shift()],n=[],i=[],o=[];t.length>0;){var s=t.shift(),c=s.split("}")[0],u=s.substring(c.length+1),h=a(c);i.push(h.substitution),n.push(h.prefix),r.push(u),o=o.concat(h.substitution.varNames)}this.fill=function(e){for(var t=r[0],n=0;n<i.length;n++)t+=(0,i[n])(e),t+=r[n+1];return t},this.varNames=o,this.template=e}l.prototype={toString:function(){return this.template},fillFromObject:function(e){return this.fill(function(t){return e[t]})}};var c=function(e,t,r,n,i){if(this.missing=[],this.missingMap={},this.formatValidators=e?Object.create(e.formatValidators):{},this.schemas=e?Object.create(e.schemas):{},this.collectMultiple=t,this.errors=[],this.handleError=t?this.collectError:this.returnError,n&&(this.checkRecursive=!0,this.scanned=[],this.scannedFrozen=[],this.scannedFrozenSchemas=[],this.scannedFrozenValidationErrors=[],this.validatedSchemasKey="tv4_validation_id",this.validationErrorsKey="tv4_validation_errors_id"),i&&(this.trackUnknownProperties=!0,this.knownPropertyPaths={},this.unknownPropertyPaths={}),this.errorReporter=r||y("en"),"string"==typeof this.errorReporter)throw new Error("debug");if(this.definedKeywords={},e)for(var o in e.definedKeywords)this.definedKeywords[o]=e.definedKeywords[o].slice(0)};function u(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!u(e[r],t[r]))return!1}else{var n;for(n in e)if(void 0===t[n]&&void 0!==e[n])return!1;for(n in t)if(void 0===e[n]&&void 0!==t[n])return!1;for(n in e)if(!u(e[n],t[n]))return!1}return!0}return!1}c.prototype.defineKeyword=function(e,t){this.definedKeywords[e]=this.definedKeywords[e]||[],this.definedKeywords[e].push(t)},c.prototype.createError=function(e,t,r,n,i,o,s){var a=new w(e,t,r,n,i);return a.message=this.errorReporter(a,o,s),a},c.prototype.returnError=function(e){return e},c.prototype.collectError=function(e){return e&&this.errors.push(e),null},c.prototype.prefixErrors=function(e,t,r){for(var n=e;n<this.errors.length;n++)this.errors[n]=this.errors[n].prefixWith(t,r);return this},c.prototype.banUnknownProperties=function(e,t){for(var r in this.unknownPropertyPaths){var n=this.createError(v.UNKNOWN_PROPERTY,{path:r},r,"",null,e,t),i=this.handleError(n);if(i)return i}return null},c.prototype.addFormat=function(e,t){if("object"==typeof e){for(var r in e)this.addFormat(r,e[r]);return this}this.formatValidators[e]=t},c.prototype.resolveRefs=function(e,t){if(void 0!==e.$ref){if((t=t||{})[e.$ref])return this.createError(v.CIRCULAR_REFERENCE,{urls:Object.keys(t).join(", ")},"","",null,void 0,e);t[e.$ref]=!0,e=this.getSchema(e.$ref,t)}return e},c.prototype.getSchema=function(e,t){var r;if(void 0!==this.schemas[e])return r=this.schemas[e],this.resolveRefs(r,t);var n=e,i="";if(-1!==e.indexOf("#")&&(i=e.substring(e.indexOf("#")+1),n=e.substring(0,e.indexOf("#"))),"object"==typeof this.schemas[n]){r=this.schemas[n];var o=decodeURIComponent(i);if(""===o)return this.resolveRefs(r,t);if("/"!==o.charAt(0))return;for(var s=o.split("/").slice(1),a=0;a<s.length;a++){var l=s[a].replace(/~1/g,"/").replace(/~0/g,"~");if(void 0===r[l]){r=void 0;break}r=r[l]}if(void 0!==r)return this.resolveRefs(r,t)}void 0===this.missing[n]&&(this.missing.push(n),this.missing[n]=n,this.missingMap[n]=n)},c.prototype.searchSchemas=function(e,t){if(Array.isArray(e))for(var r=0;r<e.length;r++)this.searchSchemas(e[r],t);else if(e&&"object"==typeof e)for(var n in"string"==typeof e.id&&function(e,t){if(t.substring(0,e.length)===e){var r=t.substring(e.length);if(t.length>0&&"/"===t.charAt(e.length-1)||"#"===r.charAt(0)||"?"===r.charAt(0))return!0}return!1}(t,e.id)&&void 0===this.schemas[e.id]&&(this.schemas[e.id]=e),e)if("enum"!==n)if("object"==typeof e[n])this.searchSchemas(e[n],t);else if("$ref"===n){var i=g(e[n]);i&&void 0===this.schemas[i]&&void 0===this.missingMap[i]&&(this.missingMap[i]=i)}},c.prototype.addSchema=function(e,t){if("string"!=typeof e||void 0===t){if("object"!=typeof e||"string"!=typeof e.id)return;e=(t=e).id}e===g(e)+"#"&&(e=g(e)),this.schemas[e]=t,delete this.missingMap[e],m(t,e),this.searchSchemas(t,e)},c.prototype.getSchemaMap=function(){var e={};for(var t in this.schemas)e[t]=this.schemas[t];return e},c.prototype.getSchemaUris=function(e){var t=[];for(var r in this.schemas)e&&!e.test(r)||t.push(r);return t},c.prototype.getMissingUris=function(e){var t=[];for(var r in this.missingMap)e&&!e.test(r)||t.push(r);return t},c.prototype.dropSchemas=function(){this.schemas={},this.reset()},c.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},c.prototype.validateAll=function(e,t,r,n,i){var o;if(!(t=this.resolveRefs(t)))return null;if(t instanceof w)return this.errors.push(t),t;var s,a=this.errors.length,l=null,c=null;if(this.checkRecursive&&e&&"object"==typeof e){if(o=!this.scanned.length,e[this.validatedSchemasKey]){var u=e[this.validatedSchemasKey].indexOf(t);if(-1!==u)return this.errors=this.errors.concat(e[this.validationErrorsKey][u]),null}if(Object.isFrozen(e)&&-1!==(s=this.scannedFrozen.indexOf(e))){var h=this.scannedFrozenSchemas[s].indexOf(t);if(-1!==h)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[s][h]),null}if(this.scanned.push(e),Object.isFrozen(e))-1===s&&(s=this.scannedFrozen.length,this.scannedFrozen.push(e),this.scannedFrozenSchemas.push([])),l=this.scannedFrozenSchemas[s].length,this.scannedFrozenSchemas[s][l]=t,this.scannedFrozenValidationErrors[s][l]=[];else{if(!e[this.validatedSchemasKey])try{Object.defineProperty(e,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(e,this.validationErrorsKey,{value:[],configurable:!0})}catch(t){e[this.validatedSchemasKey]=[],e[this.validationErrorsKey]=[]}c=e[this.validatedSchemasKey].length,e[this.validatedSchemasKey][c]=t,e[this.validationErrorsKey][c]=[]}}var d=this.errors.length,p=this.validateBasic(e,t,i)||this.validateNumeric(e,t,i)||this.validateString(e,t,i)||this.validateArray(e,t,i)||this.validateObject(e,t,i)||this.validateCombinations(e,t,i)||this.validateHypermedia(e,t,i)||this.validateFormat(e,t,i)||this.validateDefinedKeywords(e,t,i)||null;if(o){for(;this.scanned.length;)delete this.scanned.pop()[this.validatedSchemasKey];this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(p||d!==this.errors.length)for(;r&&r.length||n&&n.length;){var f=r&&r.length?""+r.pop():null,g=n&&n.length?""+n.pop():null;p&&(p=p.prefixWith(f,g)),this.prefixErrors(d,f,g)}return null!==l?this.scannedFrozenValidationErrors[s][l]=this.errors.slice(a):null!==c&&(e[this.validationErrorsKey][c]=this.errors.slice(a)),this.handleError(p)},c.prototype.validateFormat=function(e,t){if("string"!=typeof t.format||!this.formatValidators[t.format])return null;var r=this.formatValidators[t.format].call(null,e,t);return"string"==typeof r||"number"==typeof r?this.createError(v.FORMAT_CUSTOM,{message:r},"","/format",null,e,t):r&&"object"==typeof r?this.createError(v.FORMAT_CUSTOM,{message:r.message||"?"},r.dataPath||"",r.schemaPath||"/format",null,e,t):null},c.prototype.validateDefinedKeywords=function(e,t,r){for(var n in this.definedKeywords)if(void 0!==t[n])for(var i=this.definedKeywords[n],o=0;o<i.length;o++){var s=(0,i[o])(e,t[n],t,r);if("string"==typeof s||"number"==typeof s)return this.createError(v.KEYWORD_CUSTOM,{key:n,message:s},"","",null,e,t).prefixWith(null,n);if(s&&"object"==typeof s){var a=s.code;if("string"==typeof a){if(!v[a])throw new Error("Undefined error code (use defineError): "+a);a=v[a]}else"number"!=typeof a&&(a=v.KEYWORD_CUSTOM);var l="object"==typeof s.message?s.message:{key:n,message:s.message||"?"},c=s.schemaPath||"/"+n.replace(/~/g,"~0").replace(/\//g,"~1");return this.createError(a,l,s.dataPath||null,c,null,e,t)}}return null},c.prototype.validateBasic=function(e,t,r){var n;return(n=this.validateType(e,t,r))||(n=this.validateEnum(e,t,r))?n.prefixWith(null,"type"):null},c.prototype.validateType=function(e,t){if(void 0===t.type)return null;var r=typeof e;null===e?r="null":Array.isArray(e)&&(r="array");var n=t.type;Array.isArray(n)||(n=[n]);for(var i=0;i<n.length;i++){var o=n[i];if(o===r||"integer"===o&&"number"===r&&e%1==0)return null}return this.createError(v.INVALID_TYPE,{type:r,expected:n.join("/")},"","",null,e,t)},c.prototype.validateEnum=function(e,t){if(void 0===t.enum)return null;for(var r=0;r<t.enum.length;r++)if(u(e,t.enum[r]))return null;return this.createError(v.ENUM_MISMATCH,{value:"undefined"!=typeof JSON?JSON.stringify(e):e},"","",null,e,t)},c.prototype.validateNumeric=function(e,t,r){return this.validateMultipleOf(e,t,r)||this.validateMinMax(e,t,r)||this.validateNaN(e,t,r)||null};var h=Math.pow(2,-51),d=1-h;function p(e){var t=String(e).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return t?{href:t[0]||"",protocol:t[1]||"",authority:t[2]||"",host:t[3]||"",hostname:t[4]||"",port:t[5]||"",pathname:t[6]||"",search:t[7]||"",hash:t[8]||""}:null}function f(e,t){return t=p(t||""),e=p(e||""),t&&e?(t.protocol||e.protocol)+(t.protocol||t.authority?t.authority:e.authority)+(r=t.protocol||t.authority||"/"===t.pathname.charAt(0)?t.pathname:t.pathname?(e.authority&&!e.pathname?"/":"")+e.pathname.slice(0,e.pathname.lastIndexOf("/")+1)+t.pathname:e.pathname,n=[],r.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?n.pop():n.push(e)}),n.join("").replace(/^\//,"/"===r.charAt(0)?"/":""))+(t.protocol||t.authority||t.pathname?t.search:t.search||e.search)+t.hash:null;var r,n}function g(e){return e.split("#")[0]}function m(e,t){if(e&&"object"==typeof e)if(void 0===t?t=e.id:"string"==typeof e.id&&(t=f(t,e.id),e.id=t),Array.isArray(e))for(var r=0;r<e.length;r++)m(e[r],t);else for(var n in"string"==typeof e.$ref&&(e.$ref=f(t,e.$ref)),e)"enum"!==n&&m(e[n],t)}function y(e){var t=C[e=e||"en"];return function(e){var r=t[e.code]||E[e.code];if("string"!=typeof r)return"Unknown error code "+e.code+": "+JSON.stringify(e.messageParams);var n=e.params;return r.replace(/\{([^{}]*)\}/g,function(e,t){var r=n[t];return"string"==typeof r||"number"==typeof r?r:e})}}c.prototype.validateMultipleOf=function(e,t){var r=t.multipleOf||t.divisibleBy;if(void 0===r)return null;if("number"==typeof e){var n=e/r%1;if(n>=h&&n<d)return this.createError(v.NUMBER_MULTIPLE_OF,{value:e,multipleOf:r},"","",null,e,t)}return null},c.prototype.validateMinMax=function(e,t){if("number"!=typeof e)return null;if(void 0!==t.minimum){if(e<t.minimum)return this.createError(v.NUMBER_MINIMUM,{value:e,minimum:t.minimum},"","/minimum",null,e,t);if(t.exclusiveMinimum&&e===t.minimum)return this.createError(v.NUMBER_MINIMUM_EXCLUSIVE,{value:e,minimum:t.minimum},"","/exclusiveMinimum",null,e,t)}if(void 0!==t.maximum){if(e>t.maximum)return this.createError(v.NUMBER_MAXIMUM,{value:e,maximum:t.maximum},"","/maximum",null,e,t);if(t.exclusiveMaximum&&e===t.maximum)return this.createError(v.NUMBER_MAXIMUM_EXCLUSIVE,{value:e,maximum:t.maximum},"","/exclusiveMaximum",null,e,t)}return null},c.prototype.validateNaN=function(e,t){return"number"!=typeof e?null:!0===isNaN(e)||e===1/0||e===-1/0?this.createError(v.NUMBER_NOT_A_NUMBER,{value:e},"","/type",null,e,t):null},c.prototype.validateString=function(e,t,r){return this.validateStringLength(e,t,r)||this.validateStringPattern(e,t,r)||null},c.prototype.validateStringLength=function(e,t){return"string"!=typeof e?null:void 0!==t.minLength&&e.length<t.minLength?this.createError(v.STRING_LENGTH_SHORT,{length:e.length,minimum:t.minLength},"","/minLength",null,e,t):void 0!==t.maxLength&&e.length>t.maxLength?this.createError(v.STRING_LENGTH_LONG,{length:e.length,maximum:t.maxLength},"","/maxLength",null,e,t):null},c.prototype.validateStringPattern=function(e,t){if("string"!=typeof e||"string"!=typeof t.pattern&&!(t.pattern instanceof RegExp))return null;var r;if(t.pattern instanceof RegExp)r=t.pattern;else{var n,i="",o=t.pattern.match(/^\/(.+)\/([img]*)$/);o?(n=o[1],i=o[2]):n=t.pattern,r=new RegExp(n,i)}return r.test(e)?null:this.createError(v.STRING_PATTERN,{pattern:t.pattern},"","/pattern",null,e,t)},c.prototype.validateArray=function(e,t,r){return Array.isArray(e)&&(this.validateArrayLength(e,t,r)||this.validateArrayUniqueItems(e,t,r)||this.validateArrayItems(e,t,r))||null},c.prototype.validateArrayLength=function(e,t){var r;return void 0!==t.minItems&&e.length<t.minItems&&(r=this.createError(v.ARRAY_LENGTH_SHORT,{length:e.length,minimum:t.minItems},"","/minItems",null,e,t),this.handleError(r))||void 0!==t.maxItems&&e.length>t.maxItems&&(r=this.createError(v.ARRAY_LENGTH_LONG,{length:e.length,maximum:t.maxItems},"","/maxItems",null,e,t),this.handleError(r))?r:null},c.prototype.validateArrayUniqueItems=function(e,t){if(t.uniqueItems)for(var r=0;r<e.length;r++)for(var n=r+1;n<e.length;n++)if(u(e[r],e[n])){var i=this.createError(v.ARRAY_UNIQUE,{match1:r,match2:n},"","/uniqueItems",null,e,t);if(this.handleError(i))return i}return null},c.prototype.validateArrayItems=function(e,t,r){if(void 0===t.items)return null;var n,i;if(Array.isArray(t.items)){for(i=0;i<e.length;i++)if(i<t.items.length){if(n=this.validateAll(e[i],t.items[i],[i],["items",i],r+"/"+i))return n}else if(void 0!==t.additionalItems)if("boolean"==typeof t.additionalItems){if(!t.additionalItems&&(n=this.createError(v.ARRAY_ADDITIONAL_ITEMS,{},"/"+i,"/additionalItems",null,e,t),this.handleError(n)))return n}else if(n=this.validateAll(e[i],t.additionalItems,[i],["additionalItems"],r+"/"+i))return n}else for(i=0;i<e.length;i++)if(n=this.validateAll(e[i],t.items,[i],["items"],r+"/"+i))return n;return null},c.prototype.validateObject=function(e,t,r){return"object"!=typeof e||null===e||Array.isArray(e)?null:this.validateObjectMinMaxProperties(e,t,r)||this.validateObjectRequiredProperties(e,t,r)||this.validateObjectProperties(e,t,r)||this.validateObjectDependencies(e,t,r)||null},c.prototype.validateObjectMinMaxProperties=function(e,t){var r,n=Object.keys(e);return void 0!==t.minProperties&&n.length<t.minProperties&&(r=this.createError(v.OBJECT_PROPERTIES_MINIMUM,{propertyCount:n.length,minimum:t.minProperties},"","/minProperties",null,e,t),this.handleError(r))||void 0!==t.maxProperties&&n.length>t.maxProperties&&(r=this.createError(v.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:n.length,maximum:t.maxProperties},"","/maxProperties",null,e,t),this.handleError(r))?r:null},c.prototype.validateObjectRequiredProperties=function(e,t){if(void 0!==t.required)for(var r=0;r<t.required.length;r++){var n=t.required[r];if(void 0===e[n]){var i=this.createError(v.OBJECT_REQUIRED,{key:n},"","/required/"+r,null,e,t);if(this.handleError(i))return i}}return null},c.prototype.validateObjectProperties=function(e,t,r){var n;for(var i in e){var o=r+"/"+i.replace(/~/g,"~0").replace(/\//g,"~1"),s=!1;if(void 0!==t.properties&&void 0!==t.properties[i]&&(s=!0,n=this.validateAll(e[i],t.properties[i],[i],["properties",i],o)))return n;if(void 0!==t.patternProperties)for(var a in t.patternProperties)if(new RegExp(a).test(i)&&(s=!0,n=this.validateAll(e[i],t.patternProperties[a],[i],["patternProperties",a],o)))return n;if(s)this.trackUnknownProperties&&(this.knownPropertyPaths[o]=!0,delete this.unknownPropertyPaths[o]);else if(void 0!==t.additionalProperties){if(this.trackUnknownProperties&&(this.knownPropertyPaths[o]=!0,delete this.unknownPropertyPaths[o]),"boolean"==typeof t.additionalProperties){if(!t.additionalProperties&&(n=this.createError(v.OBJECT_ADDITIONAL_PROPERTIES,{key:i},"","/additionalProperties",null,e,t).prefixWith(i,null),this.handleError(n)))return n}else if(n=this.validateAll(e[i],t.additionalProperties,[i],["additionalProperties"],o))return n}else this.trackUnknownProperties&&!this.knownPropertyPaths[o]&&(this.unknownPropertyPaths[o]=!0)}return null},c.prototype.validateObjectDependencies=function(e,t,r){var n;if(void 0!==t.dependencies)for(var i in t.dependencies)if(void 0!==e[i]){var o=t.dependencies[i];if("string"==typeof o){if(void 0===e[o]&&(n=this.createError(v.OBJECT_DEPENDENCY_KEY,{key:i,missing:o},"","",null,e,t).prefixWith(null,i).prefixWith(null,"dependencies"),this.handleError(n)))return n}else if(Array.isArray(o))for(var s=0;s<o.length;s++){var a=o[s];if(void 0===e[a]&&(n=this.createError(v.OBJECT_DEPENDENCY_KEY,{key:i,missing:a},"","/"+s,null,e,t).prefixWith(null,i).prefixWith(null,"dependencies"),this.handleError(n)))return n}else if(n=this.validateAll(e,o,[],["dependencies",i],r))return n}return null},c.prototype.validateCombinations=function(e,t,r){return this.validateAllOf(e,t,r)||this.validateAnyOf(e,t,r)||this.validateOneOf(e,t,r)||this.validateNot(e,t,r)||null},c.prototype.validateAllOf=function(e,t,r){if(void 0===t.allOf)return null;for(var n,i=0;i<t.allOf.length;i++){var o=t.allOf[i];if(n=this.validateAll(e,o,[],["allOf",i],r))return n}return null},c.prototype.validateAnyOf=function(e,t,r){if(void 0===t.anyOf)return null;var n,i,o=[],s=this.errors.length;this.trackUnknownProperties&&(n=this.unknownPropertyPaths,i=this.knownPropertyPaths);for(var a=!0,l=0;l<t.anyOf.length;l++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var c=t.anyOf[l],u=this.errors.length,h=this.validateAll(e,c,[],["anyOf",l],r);if(null===h&&u===this.errors.length){if(this.errors=this.errors.slice(0,s),this.trackUnknownProperties){for(var d in this.knownPropertyPaths)i[d]=!0,delete n[d];for(var p in this.unknownPropertyPaths)i[p]||(n[p]=!0);a=!1;continue}return null}h&&o.push(h.prefixWith(null,""+l).prefixWith(null,"anyOf"))}return this.trackUnknownProperties&&(this.unknownPropertyPaths=n,this.knownPropertyPaths=i),a?(o=o.concat(this.errors.slice(s)),this.errors=this.errors.slice(0,s),this.createError(v.ANY_OF_MISSING,{},"","/anyOf",o,e,t)):void 0},c.prototype.validateOneOf=function(e,t,r){if(void 0===t.oneOf)return null;var n,i,o=null,s=[],a=this.errors.length;this.trackUnknownProperties&&(n=this.unknownPropertyPaths,i=this.knownPropertyPaths);for(var l=0;l<t.oneOf.length;l++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var c=t.oneOf[l],u=this.errors.length,h=this.validateAll(e,c,[],["oneOf",l],r);if(null===h&&u===this.errors.length){if(null!==o)return this.errors=this.errors.slice(0,a),this.createError(v.ONE_OF_MULTIPLE,{index1:o,index2:l},"","/oneOf",null,e,t);if(o=l,this.trackUnknownProperties){for(var d in this.knownPropertyPaths)i[d]=!0,delete n[d];for(var p in this.unknownPropertyPaths)i[p]||(n[p]=!0)}}else h&&s.push(h)}return this.trackUnknownProperties&&(this.unknownPropertyPaths=n,this.knownPropertyPaths=i),null===o?(s=s.concat(this.errors.slice(a)),this.errors=this.errors.slice(0,a),this.createError(v.ONE_OF_MISSING,{},"","/oneOf",s,e,t)):(this.errors=this.errors.slice(0,a),null)},c.prototype.validateNot=function(e,t,r){if(void 0===t.not)return null;var n,i,o=this.errors.length;this.trackUnknownProperties&&(n=this.unknownPropertyPaths,i=this.knownPropertyPaths,this.unknownPropertyPaths={},this.knownPropertyPaths={});var s=this.validateAll(e,t.not,null,null,r),a=this.errors.slice(o);return this.errors=this.errors.slice(0,o),this.trackUnknownProperties&&(this.unknownPropertyPaths=n,this.knownPropertyPaths=i),null===s&&0===a.length?this.createError(v.NOT_PASSED,{},"","/not",null,e,t):null},c.prototype.validateHypermedia=function(e,t,r){if(!t.links)return null;for(var n,i=0;i<t.links.length;i++){var o=t.links[i];if("describedby"===o.rel){for(var s=new l(o.href),a=!0,c=0;c<s.varNames.length;c++)if(!(s.varNames[c]in e)){a=!1;break}if(a){var u={$ref:s.fillFromObject(e)};if(n=this.validateAll(e,u,[],["links",i],r))return n}}}};var v={INVALID_TYPE:0,ENUM_MISMATCH:1,ANY_OF_MISSING:10,ONE_OF_MISSING:11,ONE_OF_MULTIPLE:12,NOT_PASSED:13,NUMBER_MULTIPLE_OF:100,NUMBER_MINIMUM:101,NUMBER_MINIMUM_EXCLUSIVE:102,NUMBER_MAXIMUM:103,NUMBER_MAXIMUM_EXCLUSIVE:104,NUMBER_NOT_A_NUMBER:105,STRING_LENGTH_SHORT:200,STRING_LENGTH_LONG:201,STRING_PATTERN:202,OBJECT_PROPERTIES_MINIMUM:300,OBJECT_PROPERTIES_MAXIMUM:301,OBJECT_REQUIRED:302,OBJECT_ADDITIONAL_PROPERTIES:303,OBJECT_DEPENDENCY_KEY:304,ARRAY_LENGTH_SHORT:400,ARRAY_LENGTH_LONG:401,ARRAY_UNIQUE:402,ARRAY_ADDITIONAL_ITEMS:403,FORMAT_CUSTOM:500,KEYWORD_CUSTOM:501,CIRCULAR_REFERENCE:600,UNKNOWN_PROPERTY:1e3},_={};for(var b in v)_[v[b]]=b;var E={INVALID_TYPE:"Invalid type: {type} (expected {expected})",ENUM_MISMATCH:"No enum match for: {value}",ANY_OF_MISSING:'Data does not match any schemas from "anyOf"',ONE_OF_MISSING:'Data does not match any schemas from "oneOf"',ONE_OF_MULTIPLE:'Data is valid against more than one schema from "oneOf": indices {index1} and {index2}',NOT_PASSED:'Data matches schema from "not"',NUMBER_MULTIPLE_OF:"Value {value} is not a multiple of {multipleOf}",NUMBER_MINIMUM:"Value {value} is less than minimum {minimum}",NUMBER_MINIMUM_EXCLUSIVE:"Value {value} is equal to exclusive minimum {minimum}",NUMBER_MAXIMUM:"Value {value} is greater than maximum {maximum}",NUMBER_MAXIMUM_EXCLUSIVE:"Value {value} is equal to exclusive maximum {maximum}",NUMBER_NOT_A_NUMBER:"Value {value} is not a valid number",STRING_LENGTH_SHORT:"String is too short ({length} chars), minimum {minimum}",STRING_LENGTH_LONG:"String is too long ({length} chars), maximum {maximum}",STRING_PATTERN:"String does not match pattern: {pattern}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({propertyCount}), minimum {minimum}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({propertyCount}), maximum {maximum}",OBJECT_REQUIRED:"Missing required property: {key}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {missing} (due to key: {key})",ARRAY_LENGTH_SHORT:"Array is too short ({length}), minimum {minimum}",ARRAY_LENGTH_LONG:"Array is too long ({length}), maximum {maximum}",ARRAY_UNIQUE:"Array items are not unique (indices {match1} and {match2})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",FORMAT_CUSTOM:"Format validation failed ({message})",KEYWORD_CUSTOM:"Keyword failed: {key} ({message})",CIRCULAR_REFERENCE:"Circular $refs: {urls}",UNKNOWN_PROPERTY:"Unknown property (not in schema)"};function w(e,t,r,n,i){if(Error.call(this),void 0===e)throw new Error("No error code supplied: "+n);this.message="",this.params=t,this.code=e,this.dataPath=r||"",this.schemaPath=n||"",this.subErrors=i||null;var o=new Error(this.message);if(this.stack=o.stack||o.stacktrace,!this.stack)try{throw o}catch(o){this.stack=o.stack||o.stacktrace}}w.prototype=Object.create(Error.prototype),w.prototype.constructor=w,w.prototype.name="ValidationError",w.prototype.prefixWith=function(e,t){if(null!==e&&(e=e.replace(/~/g,"~0").replace(/\//g,"~1"),this.dataPath="/"+e+this.dataPath),null!==t&&(t=t.replace(/~/g,"~0").replace(/\//g,"~1"),this.schemaPath="/"+t+this.schemaPath),null!==this.subErrors)for(var r=0;r<this.subErrors.length;r++)this.subErrors[r].prefixWith(e,t);return this};var C={},S=function e(t){var r,n,i=new c,o={setErrorReporter:function(e){return"string"==typeof e?this.language(e):(n=e,!0)},addFormat:function(){i.addFormat.apply(i,arguments)},language:function(e){return e?(C[e]||(e=e.split("-")[0]),!!C[e]&&(r=e,e)):r},addLanguage:function(e,t){var r;for(r in v)t[r]&&!t[v[r]]&&(t[v[r]]=t[r]);var n=e.split("-")[0];if(C[n])for(r in C[e]=Object.create(C[n]),t)void 0===C[n][r]&&(C[n][r]=t[r]),C[e][r]=t[r];else C[e]=t,C[n]=t;return this},freshApi:function(t){var r=e();return t&&r.language(t),r},validate:function(e,t,o,s){var a=y(r),l=new c(i,!1,n?function(e,t,r){return n(e,t,r)||a(e,t,r)}:a,o,s);"string"==typeof t&&(t={$ref:t}),l.addSchema("",t);var u=l.validateAll(e,t,null,null,"");return!u&&s&&(u=l.banUnknownProperties(e,t)),this.error=u,this.missing=l.missing,this.valid=null===u,this.valid},validateResult:function(){var e={toString:function(){return this.valid?"valid":this.error.message}};return this.validate.apply(e,arguments),e},validateMultiple:function(e,t,o,s){var a=y(r),l=new c(i,!0,n?function(e,t,r){return n(e,t,r)||a(e,t,r)}:a,o,s);"string"==typeof t&&(t={$ref:t}),l.addSchema("",t),l.validateAll(e,t,null,null,""),s&&l.banUnknownProperties(e,t);var u={toString:function(){return this.valid?"valid":this.error.message}};return u.errors=l.errors,u.missing=l.missing,u.valid=0===u.errors.length,u},addSchema:function(){return i.addSchema.apply(i,arguments)},getSchema:function(){return i.getSchema.apply(i,arguments)},getSchemaMap:function(){return i.getSchemaMap.apply(i,arguments)},getSchemaUris:function(){return i.getSchemaUris.apply(i,arguments)},getMissingUris:function(){return i.getMissingUris.apply(i,arguments)},dropSchemas:function(){i.dropSchemas.apply(i,arguments)},defineKeyword:function(){i.defineKeyword.apply(i,arguments)},defineError:function(e,t,r){if("string"!=typeof e||!/^[A-Z]+(_[A-Z]+)*$/.test(e))throw new Error("Code name must be a string in UPPER_CASE_WITH_UNDERSCORES");if("number"!=typeof t||t%1!=0||t<1e4)throw new Error("Code number must be an integer > 10000");if(void 0!==v[e])throw new Error("Error already defined: "+e+" as "+v[e]);if(void 0!==_[t])throw new Error("Error code already used: "+_[t]+" as "+t);for(var n in v[e]=t,_[t]=e,E[e]=E[t]=r,C){var i=C[n];i[e]&&(i[t]=i[t]||i[e])}},reset:function(){i.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:m,resolveUrl:f,getDocumentUri:g,errorCodes:v};return o.language(t||"en"),o}();return S.addLanguage("en-gb",E),S.tv4=S,S}.apply(t,[]))||(e.exports=r)},713:function(module$2){!function(e,t){{const e=t();module$2.exports=e,module$2.exports.default=e}}("undefined"!=typeof self&&self,function(){var LINK_URI_MAPS={"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"},LINK_PROPERTIES={avatar:[],remotestorage:[],blog:[],vcard:[],updates:[],share:[],profile:[],camlistore:[]},URIS=["webfinger","host-meta","host-meta.json"],IPV4_OCTET="(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)",IPV4_REGEX=new RegExp(`^(?:${IPV4_OCTET}\\.){3}${IPV4_OCTET}$`),IPV4_CAPTURE_REGEX=new RegExp(`^(${IPV4_OCTET})\\.(${IPV4_OCTET})\\.(${IPV4_OCTET})\\.(${IPV4_OCTET})$`),LOCALHOST_REGEX=/^localhost(?:\.localdomain)?(?::\d+)?$/,NUMERIC_PORT_REGEX=/^\d+$/,HOSTNAME_REGEX=/^[a-zA-Z0-9.-]+$/,LOCALHOST_127_REGEX=/^127\.(?:\d{1,3}\.){2}\d{1,3}$/;class WebFingerError extends Error{status;constructor(e,t){super(e),this.name="WebFingerError",this.status=t}}class WebFinger{static default;config;constructor(e={}){this.config={tls_only:void 0===e.tls_only||e.tls_only,uri_fallback:void 0!==e.uri_fallback&&e.uri_fallback,request_timeout:void 0!==e.request_timeout?e.request_timeout:1e4,allow_private_addresses:void 0!==e.allow_private_addresses&&e.allow_private_addresses}}async fetchJRD(e,t=0){if(t>3)throw new WebFingerError("too many redirects");const r=await fetch(e,{headers:{Accept:"application/jrd+json, application/json"},redirect:"manual"});if(r.status>=300&&r.status<400){const n=r.headers.get("location");if(!n)throw new WebFingerError("redirect without location header");let i;try{i=new URL(n,e)}catch{throw new WebFingerError("invalid redirect URL")}const o=WebFinger.validateHost(i.hostname+(i.port?":"+i.port:""));if(!this.config.allow_private_addresses&&WebFinger.isPrivateAddress(o))throw new WebFingerError("redirect to private or internal address blocked");return this.fetchJRD(i.toString(),t+1)}if(404===r.status)throw new WebFingerError("resource not found",404);if(!r.ok)throw new WebFingerError("error during request",r.status);const n=r.headers.get("content-type")||"",i=n.toLowerCase().split(";")[0].trim();"application/jrd+json"===i||("application/json"===i?console.debug('WebFinger: Server uses "application/json" instead of RFC 7033 recommended "application/jrd+json".'):console.warn(`WebFinger: Server returned unexpected content-type "${n}". Expected "application/jrd+json" per RFC 7033.`));const o=await r.text();if(WebFinger.isValidJSON(o))return o;throw new WebFingerError("invalid json")}static isValidJSON(e){try{JSON.parse(e)}catch{return!1}return!0}static isLocalhost(e){return LOCALHOST_REGEX.test(e)}static isPrivateAddress(e){let t=e;if(t.startsWith("[")&&t.includes("]:"))t=t.substring(1,t.lastIndexOf("]:"));else if(t.startsWith("[")&&t.endsWith("]"))t=t.substring(1,t.length-1);else if(t.includes(":")&&1===(t.match(/:/g)||[]).length){const e=t.split(":"),r=e[0],n=e[1];if(n&&!NUMERIC_PORT_REGEX.test(n))throw new WebFingerError("invalid host format");(r.match(IPV4_REGEX)||r.match(HOSTNAME_REGEX))&&(t=r)}if("localhost"===t||"127.0.0.1"===t||t.match(LOCALHOST_127_REGEX)||"::1"===t||"localhost.localdomain"===t)return!0;const r=t.match(IPV4_CAPTURE_REGEX);if(r){const[,e,t,n,i]=r,o=Number(e),s=Number(t),a=Number(n),l=Number(i);if(isNaN(o)||isNaN(s)||isNaN(a)||isNaN(l))return!0;if(10===o)return!0;if(172===o&&s>=16&&s<=31)return!0;if(192===o&&168===s)return!0;if(169===o&&254===s)return!0;if(o>=224&&o<=239)return!0;if(o>=240)return!0}if(t.includes(":")){const e=(t.match(/:/g)||[]).length;if((e>1||1===e&&!t.match(/^[a-zA-Z0-9.-]+:\d+$/))&&(t.match(/^(fc|fd)[0-9a-f]{2}:/i)||t.match(/^fe80:/i)||t.match(/^ff[0-9a-f]{2}:/i)))return!0}return!1}static validateHost(e){const t=e.split("/")[0];if(!t||0===t.length)throw new WebFingerError("invalid host format");if(t.includes("?")||t.includes("#")||t.includes(" "))throw new WebFingerError("invalid characters in host");return t}static async processJRD(e,t){const r=JSON.parse(t);if("object"!=typeof r||"object"!=typeof r.links)throw void 0!==r.error?new WebFingerError(r.error):new WebFingerError("unknown response from server");const n={object:r,idx:{properties:{name:void 0},links:JSON.parse(JSON.stringify(LINK_PROPERTIES))}};(Array.isArray(r.links)?r.links:[]).map(function(e){if(Object.prototype.hasOwnProperty.call(LINK_URI_MAPS,String(e.rel))){const t=LINK_URI_MAPS[String(e.rel)];if(n.idx.links[t]){const r={href:String(e.href||""),rel:String(e.rel||"")};Object.keys(e).map(function(t){"object"==typeof e[t]&&null!==e[t]?r[t]=e[t]:r[t]=String(e[t])}),n.idx.links[t].push(r)}}});const i=r.properties||{};for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&"http://packetizer.com/ns/name"===o&&(n.idx.properties.name=i[o]);return n}async validateDNSResolution(hostname){if(hostname.match(IPV4_REGEX)||hostname.includes(":")||"localhost"===hostname)return;const isNodeJS="undefined"!=typeof process&&process.versions?.node;if(isNodeJS)try{const dnsImport=eval('import("dns")'),dns=await dnsImport.then(e=>e.promises).catch(()=>null);if(dns)try{const[e,t]=await Promise.allSettled([dns.resolve4(hostname).catch(()=>[]),dns.resolve6(hostname).catch(()=>[])]),r="fulfilled"===e.status?e.value:[],n="fulfilled"===t.status?t.value:[];for(const i of[...r,...n])if(WebFinger.isPrivateAddress(i))throw new WebFingerError(`hostname ${hostname} resolves to private address ${i}`)}catch(e){if(e instanceof WebFingerError)throw e}}catch(e){if(e instanceof WebFingerError)throw e}}async lookup(e){if(!e)throw new WebFingerError("address is required");let t="";if(e.indexOf("://")>-1){const r=e.replace(/ /g,"").split("/");if(r.length<3)throw new WebFingerError("invalid URI format");t=r[2]}else{const r=e.replace(/ /g,"").split("@");if(2!==r.length||!r[1])throw new WebFingerError("invalid useraddress format");t=r[1]}if(!t)throw new WebFingerError("could not determine host from address");if(t=WebFinger.validateHost(t),!this.config.allow_private_addresses&&WebFinger.isPrivateAddress(t))throw new WebFingerError("private or internal addresses are not allowed");if(!this.config.allow_private_addresses){const e=t.includes(":")?t.split(":")[0]:t;await this.validateDNSResolution(e)}let r=0,n="https";WebFinger.isLocalhost(t)&&(n="http");const i=async e=>{if(this.config.uri_fallback&&r!==URIS.length-1)return r+=1,o();if(this.config.tls_only||"https"!==n)throw e instanceof Error?e:new WebFingerError(String(e));return r=0,n="http",o()},o=async()=>{const o=(()=>{let i="";return e.split("://")[1]||(i="acct:"),n+"://"+t+"/.well-known/"+URIS[r]+"?resource="+i+e})();try{const e=await this.fetchJRD(o);return WebFinger.processJRD(o,e)}catch(e){return await i(e)}};return o()}async lookupLink(e,t){if(Object.prototype.hasOwnProperty.call(LINK_PROPERTIES,t)){const r=(await this.lookup(e)).idx.links[t];return 0===r.length?Promise.reject('no links found with rel="'+t+'"'):Promise.resolve(r[0])}return Promise.reject("unsupported rel "+t)}}return WebFinger.default=WebFinger,WebFinger})}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var __webpack_exports__=__webpack_require__(423);return __webpack_exports__=__webpack_exports__.default,__webpack_exports__}()},"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("RemoteStorage",[],t):"object"==typeof exports?exports.RemoteStorage=t():e.RemoteStorage=t()}),import_remotestorage=__toESM(require_remotestorage(),1),ENCODING="0123456789ABCDEFGHJKMNPQRSTVWXYZ",ENCODING_LEN=32,RANDOM_LEN=16,TIME_LEN=10,TIME_MAX=0xffffffffffff,ULIDErrorCode;!function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"}(ULIDErrorCode||(ULIDErrorCode={}));var ULIDError=class extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}};function randomChar(e){const t=Math.floor(e()*ENCODING_LEN)%ENCODING_LEN;return ENCODING.charAt(t)}function detectPRNG(){const e=detectRoot(),t=e&&(e.crypto||e.msCrypto)||null;if("function"==typeof t?.getRandomValues)return()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]/256};if("function"==typeof t?.randomBytes)return()=>t.randomBytes(1).readUInt8()/256;throw new ULIDError(ULIDErrorCode.PRNGDetectFailure,"Failed to find a reliable PRNG")}function detectRoot(){return inWebWorker()?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:null}function encodeRandom(e,t){let r="";for(;e>0;e--)r=randomChar(t)+r;return r}function encodeTime(e,t=10){if(isNaN(e))throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>0xffffffffffff)throw new ULIDError(ULIDErrorCode.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${TIME_MAX}: ${e}`);if(e<0)throw new ULIDError(ULIDErrorCode.EncodeTimeNegative,`Time must be positive: ${e}`);if(!1===Number.isInteger(e))throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%ENCODING_LEN,n=ENCODING.charAt(r)+n,e=(e-r)/ENCODING_LEN;return n}function inWebWorker(){return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope}function ulid(e,t){const r=t||detectPRNG();return encodeTime(!e||isNaN(e)?Date.now():e,10)+encodeRandom(RANDOM_LEN,r)}var placeSchema={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"]},listSchema={type:"object",properties:{id:{type:"string"},title:{type:"string"},color:{type:"string"},placeRefs:{type:"array",items:{type:"object",properties:{id:{type:"string"},geohash:{type:"string"}},required:["id","geohash"]},default:[]},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"}},required:["id","title","placeRefs","createdAt"]},Places=function(e){function t(e,t){return`${e.substring(0,2)}/${e.substring(2,4)}/${t}`}e.declareType("place",placeSchema),e.declareType("list",listSchema);const r={async getAll(){const t=await e.getAll("_lists/");return t?Object.values(t):[]},async get(t){const r=`_lists/${t}`;return e.getObject(r)},async getPlaces(r){const n=await this.get(r);if(!n)throw new Error(`List not found: ${r}`);if(!n.placeRefs||!Array.isArray(n.placeRefs))return[];const i=n.placeRefs.map(async r=>{if(!r.id||!r.geohash)return null;const n=t(r.geohash,r.id);return await e.getObject(n)});return(await Promise.all(i)).filter(e=>!!e)},async create(t,r,n){const i=`_lists/${t}`;let o=await e.getObject(i);const s=(new Date).toISOString();return o?(o.title=r,n&&(o.color=n),o.updatedAt=s):o={id:t,title:r,color:n,placeRefs:[],createdAt:s,updatedAt:s},await e.storeObject("list",i,o),o},async delete(t){await e.remove(`_lists/${t}`)},async addPlace(t,r,n){const i=`_lists/${t}`,o=await e.getObject(i);if(!o)throw new Error(`List not found: ${t}`);return-1===o.placeRefs.findIndex(e=>e.id===r)&&(o.placeRefs.push({id:r,geohash:n}),o.updatedAt=(new Date).toISOString(),await e.storeObject("list",i,o)),o},async removePlace(t,r){const n=`_lists/${t}`,i=await e.getObject(n);if(!i)throw new Error(`List not found: ${t}`);const o=i.placeRefs.findIndex(e=>e.id===r);return-1!==o&&(i.placeRefs.splice(o,1),i.updatedAt=(new Date).toISOString(),await e.storeObject("list",n,i)),i},async initDefaults(){for(const e of[{id:"to-go",title:"Want to go",color:"#2e9e4f"},{id:"to-do",title:"To do",color:"#2a7fff"}])await this.get(e.id)||await this.create(e.id,e.title,e.color)}};return{exports:{lists:r,store:async function(r){const n=function(e){const t=(new Date).toISOString(),r=e.id||ulid(),n="number"==typeof e.lat?e.lat:0,i="number"==typeof e.lon?e.lon:0,o=e.title||"Untitled Place",s=e.geohash||Geohash.encode(n,i,10),a={...e,id:r,lat:n,lon:i,geohash:s,title:o,tags:e.tags||[],createdAt:e.createdAt||t,updatedAt:e.id?t:void 0};return Object.keys(a).forEach(e=>{void 0===a[e]&&delete a[e]}),a}(r),i=t(n.geohash,n.id);return await e.storeObject("place",i,n),n},remove:async function(n,i){if(!n||!i)throw new Error("Both id and geohash are required to remove a place");const o=await r.getAll();await Promise.all(o.map(async t=>{const r=t.placeRefs.findIndex(e=>e.id===n);-1!==r&&(t.placeRefs.splice(r,1),t.updatedAt=(new Date).toISOString(),await e.storeObject("list",`_lists/${t.id}`,t))}));const s=t(i,n);return e.remove(s)},get:async function(r,n){if(!r||!n)throw new Error("Both id and geohash are required to get a place");const i=t(n,r);return e.getObject(i)},listByPrefix:async function(t){let r="";return t.length>=2&&(r+=t.substring(0,2)+"/"),t.length>=4&&(r+=t.substring(2,4)+"/"),e.getAll(r)},getPlaces:async function(t){const r=[],n=async t=>{const n=await e.getAll(t,!1);n&&Object.values(n).forEach(e=>{e&&"object"==typeof e&&!e.toString().endsWith("/")&&r.push(e)})};if(t&&t.length>0){const e=t.map(async e=>{if(e.length<4)return;const t=e.substring(0,2),r=e.substring(2,4);await n(`${t}/${r}/`)});await Promise.all(e)}else{const t=e=>{if(!e||"object"!=typeof e)return[];let t=e;return e.items&&"object"==typeof e.items&&(t=e.items),Object.keys(t).filter(e=>e.endsWith("/")&&!e.startsWith("@"))},r=t(await e.getListing("",!1));await Promise.all(r.map(async r=>{const i=await e.getListing(r,!1),o=t(i);await Promise.all(o.map(async e=>{await n(r+e)}))}))}return r}}}},places_default={name:"places",builder:Places},require_widget=__commonJSMin((e,t)=>{var r,n;r=self,n=()=>(()=>{var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function n(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}e.d(t,{default:()=>i});const i=function(){return e=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.rs=t,this.leaveOpen=!!r.leaveOpen&&r.leaveOpen,this.autoCloseAfter=r.autoCloseAfter?r.autoCloseAfter:1500,this.skipInitial=!!r.skipInitial&&r.skipInitial,this.logging=!!r.logging&&r.logging,this.parentContainerEl=null,r.hasOwnProperty("modalBackdrop")){if("boolean"!=typeof r.modalBackdrop&&"onlySmallScreens"!==r.modalBackdrop)throw'options.modalBackdrop has to be true/false or "onlySmallScreens"';this.modalBackdrop=r.modalBackdrop}else this.modalBackdrop="onlySmallScreens";this.active=!1,this.online=!1,this.closed=!1,this.lastSynced=null,this.lastSyncedUpdateLoop=null},t=[{key:"log",value:function(){if(this.logging){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=console).debug.apply(e,["[RS-WIDGET] "].concat(r))}}},{key:"eventHandler",value:function(e,t){var r=this;switch(this.log("EVENT: ",e),e){case"ready":this.setState(this.state);break;case"sync-started":case"sync-req-done":this.handleSyncStarted();break;case"sync-done":if(this.online&&(null==t||!t.completed))return;this.syncInProgress=!1,this.rsSyncButton.classList.remove("rs-rotate"),this.updateLastSyncedStatus(),!this.closed&&this.shouldCloseWhenSyncDone&&setTimeout(this.close.bind(this),this.autoCloseAfter);break;case"disconnected":this.active=!1,this.setOnline(),this.setBackendClass(),this.open(),this.setInitialState();break;case"connected":this.active=!0,this.online=!0,this.rs.hasFeature("Sync")?(this.shouldCloseWhenSyncDone=!0,this.rs.on("sync-req-done",function(e){return r.eventHandler("sync-req-done",e)}),this.rs.on("sync-done",function(e){return r.eventHandler("sync-done",e)})):(this.rsSyncButton.classList.add("rs-hidden"),setTimeout(this.close.bind(this),this.autoCloseAfter));var n=this.rs.remote.userAddress;this.rsConnectedUser.innerHTML=n,this.setBackendClass(this.rs.backend),this.rsConnectedLabel.textContent="Connected",this.setState("connected");break;case"network-offline":this.setOffline();break;case"network-online":this.setOnline();break;case"error":this.setBackendClass(this.rs.backend),"DiscoveryError"===(null==t?void 0:t.name)?this.handleDiscoveryError(t):"SyncError"===(null==t?void 0:t.name)?this.handleSyncError(t):"Unauthorized"===(null==t?void 0:t.name)?this.handleUnauthorized(t):console.debug('Encountered unhandled error: "'.concat(t,'"'))}}},{key:"setState",value:function(e){if(e){this.log("Setting state ",e);var t=this.parentContainerEl.querySelector(".rs-box.rs-selected");t&&(t.classList.remove("rs-selected"),t.setAttribute("aria-hidden","true"));var r=this.parentContainerEl.querySelector(".rs-box.rs-box-"+e);r&&(r.classList.add("rs-selected"),r.setAttribute("aria-hidden","false"));var n=this.rsWidget.className.match(/rs-state-\S+/g)[0];this.rsWidget.classList.remove(n),this.rsWidget.classList.add("rs-state-".concat(e||this.state)),this.state=e}}},{key:"setInitialState",value:function(){this.skipInitial?this.showChooseOrSignIn():this.setState("initial")}},{key:"createHtmlTemplate",value:function(){var e=document.createElement("div");e.id="remotestorage-widget",e.innerHTML='<div class="remotestorage-widget-modal-backdrop"></div> <div class="rs-widget rs-state-initial"> <div class="rs-widget-icon"> <svg class="rs-main-logo" id="rs-main-logo-remotestorage" xmlns="http://www.w3.org/2000/svg" version="1.1" xml:space="preserve" width="0.739008in" height="0.853339in" style="shape-rendering:geometricPrecision;text-rendering:geometricPrecision;image-rendering:optimizeQuality;fill-rule:evenodd;clip-rule:evenodd" viewBox="0 0 739 853" xmlns:xlink="http://www.w3.org/1999/xlink"> <g> <polygon class="rs-logo-shape" points="370,754 0,542 0,640 185,747 370,853 554,747 739,640 739,525 739,525 739,476 739,427 739,378 653,427 370,589 86,427 86,427 86,361 185,418 370,524 554,418 653,361 739,311 739,213 739,213 554,107 370,0 185,107 58,180 144,230 228,181 370,100 511,181 652,263 370,425 87,263 87,263 0,213 0,213 0,311 0,378 0,427 0,476 86,525 185,582 370,689 554,582 653,525 653,590 653,592 "/> </g> </svg> <svg class="rs-main-logo" id="rs-main-logo-dropbox" width="40" height="36" xml:space="preserve" stroke-miterlimit="1.4142" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 97" stroke-linejoin="round" version="1.1" clip-rule="evenodd"> <path d="m30.691 0l-30.691 20.039 21.221 16.994 30.946-19.108-21.476-17.925z" fill="#007ee5"/> <path d="m0 54.028l30.691 20.039 21.476-17.926-30.945-19.108-21.222 16.995z" fill="#007ee5"/> <path d="m52.167 56.142l21.477 17.926 30.696-20.039-21.227-16.995-30.946 19.108z" fill="#007ee5"/> <path d="m104.34 20.039l-30.696-20.039-21.477 17.925 30.946 19.108 21.227-16.994z" fill="#007ee5"/> <path d="m52.23 59.998l-21.538 17.873-9.218-6.018v6.747l30.756 18.443 30.756-18.443v-6.747l-9.216 6.018-21.54-17.873z" fill="#007ee5"/> </svg> <svg class="rs-main-logo" id="rs-main-logo-googledrive" width="40" height="40" version="1.1" stroke-miterlimit="1.4142" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" width="100%" stroke-linejoin="round" clip-rule="evenodd" viewBox="0 0 511 442" height="100%"> <path d="m166.23 0.10955l0.44-0.009998 0.04 0.49-0.56 0.02 0.08-0.5z" fill="#0ba25e"/> <path d="m164.52 3.3896c0.39-0.56 1.15-1.68 1.54-2.24l0.7-0.11c0.52 6.34 2.38 12.45 3.78 18.62 6.02 26.81 12.1 53.6 18.43 80.33 4.15 18.33 8.78 36.57 12.58 54.97 3.3 11.39 5.07 23.14 8.26 34.55 2.06 10.64 5.29 21.02 7.02 31.72-0.7 1.17-1.4 2.35-2.11 3.52-0.17 0.27-0.53 0.83-0.7 1.11l-0.26 0.45c-0.04 0.08-0.13 0.25-0.18 0.33-0.39 0.72-1.17 2.15-1.56 2.86-0.07 0.13-0.22 0.39-0.3 0.52l-0.71 1.26c-0.09 0.15-0.26 0.44-0.34 0.59l-0.83 1.45c-0.04 0.08-0.13 0.24-0.18 0.32l-1.03 1.8c-0.09 0.15-0.27 0.47-0.36 0.63-0.1 0.17-0.3 0.5-0.4 0.67l-1.01 1.74c-0.08 0.13-0.24 0.41-0.32 0.54l-0.62 1.05c-0.1 0.18-0.32 0.55-0.42 0.73-0.4 0.69-1.19 2.07-1.59 2.77-0.07 0.12-0.22 0.37-0.29 0.5l-0.63 1.05c-0.1 0.19-0.32 0.55-0.43 0.74-0.37 0.65-1.13 1.94-1.5 2.59-0.09 0.15-0.26 0.46-0.35 0.61l-0.75 1.35c-0.07 0.12-0.21 0.37-0.28 0.49l-0.77 1.35-0.32 0.56c-0.4 0.66-1.18 1.99-1.57 2.66-0.09 0.15-0.27 0.46-0.36 0.62l-0.71 1.28c-0.07 0.12-0.2 0.35-0.26 0.47l-0.82 1.42c-0.07 0.13-0.22 0.38-0.29 0.5-0.42 0.72-1.25 2.15-1.67 2.87-0.07 0.13-0.23 0.39-0.31 0.52l-0.6 0.99c-0.1 0.18-0.31 0.53-0.41 0.71-0.38 0.66-1.13 1.97-1.51 2.63-0.06 0.11-0.2 0.35-0.26 0.46l-0.82 1.46c-0.06 0.11-0.18 0.32-0.24 0.43l-0.84 1.47c-0.07 0.11-0.21 0.35-0.28 0.46-0.39 0.66-1.18 1.96-1.57 2.62-0.11 0.17-0.31 0.53-0.42 0.71l-0.59 1.1c-0.08 0.14-0.23 0.42-0.3 0.55l-1.03 1.78c-0.08 0.15-0.26 0.45-0.34 0.6-0.09 0.14-0.25 0.43-0.33 0.57-1.69 2.85-3.22 5.79-5.09 8.53-10.65 17.37-20.45 35.28-30.76 52.86-16.74 28.97-33.46 57.94-50.2 86.91-2.51 4.51-5.37 8.83-7.53 13.54-0.11 0.16-0.33 0.48-0.44 0.64-4.01-5.78-7.11-12.16-10.78-18.16-16.74-28.99-33.49-57.97-50.22-86.97-9.3-16.31-18.99-32.42-28.04-48.88 35.84-61.85 71.52-123.81 107.29-185.7 0.03-0.06 0.1-0.17 0.13-0.23l0.98-1.68c0.04-0.07 0.12-0.21 0.17-0.28l0.99-1.69c0.09-0.15 0.27-0.47 0.37-0.62 0.1-0.18 0.3-0.53 0.4-0.71l0.99-1.76 0.28-0.48 0.74-1.18c0.13-0.19 0.39-0.58 0.52-0.78 0.36-0.54 1.09-1.63 1.46-2.17 0.04-0.18 0.11-0.53 0.15-0.7l0.87-1.67 0.16-0.28 1-1.68c0.1-0.16 0.3-0.5 0.4-0.67 0.11-0.19 0.33-0.58 0.45-0.78l0.84-1.47c0.09-0.16 0.27-0.47 0.36-0.62l0.7-1.23c0.08-0.13 0.24-0.41 0.32-0.55 0.39-0.67 1.17-2.01 1.57-2.68l0.32-0.56 0.73-1.33c0.06-0.1 0.18-0.32 0.24-0.42l0.96-1.68c0.12-0.2 0.37-0.61 0.5-0.81l0.65-0.98c0.14-0.2 0.41-0.59 0.55-0.78 0.12-0.2 0.37-0.6 0.5-0.8l0.54-1.04c0.18-0.39 0.55-1.17 0.73-1.56l0.55-0.77c0.1-0.14 0.29-0.41 0.39-0.55 0.37-0.31 1.12-0.95 1.49-1.27l-0.07-1.17c0.06-0.14 0.2-0.42 0.27-0.56l0.85-1.69c0.07-0.12 0.21-0.37 0.28-0.49l0.75-1.22c0.14-0.2 0.41-0.6 0.55-0.8 0.34-0.56 1.03-1.66 1.37-2.21 0.1-0.2 0.28-0.59 0.38-0.79l0.53-1.15c0.16-0.3 0.5-0.91 0.67-1.22l0.66-0.94c0.14-0.19 0.42-0.57 0.56-0.76 0.12-0.2 0.37-0.6 0.49-0.8l0.49-1.03c0.11-0.23 0.34-0.7 0.45-0.93l0.86-1.66c0.13-0.2 0.38-0.62 0.5-0.83l0.66-0.98c0.14-0.2 0.42-0.58 0.56-0.78 0.13-0.2 0.38-0.61 0.5-0.81l0.51-1.04c0.15-0.29 0.44-0.86 0.58-1.15l0.68-1.12c0.12-0.19 0.36-0.57 0.49-0.76 0.36-0.56 1.09-1.68 1.46-2.23 0.04-0.17 0.13-0.51 0.17-0.68l0.87-1.66c0.03-0.07 0.11-0.2 0.15-0.27l1-1.71c0.1-0.17 0.29-0.5 0.39-0.67 0.1-0.16 0.29-0.5 0.39-0.66l1-1.75c0.04-0.07 0.12-0.21 0.16-0.29l0.94-1.63c0.05-0.07 0.14-0.22 0.18-0.3l1.01-1.7c0.09-0.16 0.27-0.46 0.36-0.62 0.1-0.17 0.3-0.52 0.4-0.7l0.96-1.69c0.06-0.11 0.18-0.32 0.24-0.42l0.81-1.31c0.13-0.19 0.39-0.58 0.51-0.77 0.37-0.55 1.09-1.65 1.46-2.2 0.03-0.17 0.11-0.51 0.15-0.68l0.85-1.63c0.07-0.12 0.22-0.37 0.29-0.5l0.76-1.19c0.14-0.19 0.4-0.58 0.54-0.78 0.35-0.56 1.05-1.67 1.4-2.23 0.05-0.16 0.14-0.48 0.19-0.64l0.88-1.65c0.04-0.08 0.12-0.22 0.16-0.3l1.02-1.7204c0.08-0.15 0.26-0.45 0.35-0.6 0.09-0.17 0.27-0.49 0.36-0.65l1-1.78c0.05-0.07 0.13-0.22 0.17-0.29l0.95-1.61c0.03-0.05 0.1-0.16 0.13-0.21z" fill="#0ba25e"/> <path id="#fccd48ff" fill="#fccd48" d="m166.67 0.099552c32.48-0.15 64.97-0.02 97.46-0.07 26.88 0.099998 53.78-0.21 80.65 0.15 0.53 1.02 1.07 2.03 1.64 3.04 0.08 0.13 0.23 0.41 0.31 0.55 2.6 4.53 5.24 9.0404 7.81 13.58 0.05 0.08 0.13 0.23 0.18 0.3 4.98 8.55 9.94 17.11 14.83 25.71 0.04 0.07 0.13 0.21 0.17 0.29 0.89 1.53 1.81 3.06 2.72 4.6 0.08 0.13 0.23 0.4 0.31 0.54 1.25 2.2 2.51 4.39 3.78 6.58 0.05 0.07 0.13 0.21 0.17 0.29 1.27 2.18 2.52 4.38 3.78 6.58 0.08 0.13 0.23 0.39 0.31 0.52 1.27 2.14 2.5 4.3 3.72 6.46 0.08 0.13 0.23 0.4 0.31 0.53 11.94 20.62 23.85 41.25 35.75 61.9-1.36 5.99 1.93 11.95 0.1 17.97-1.11 16.45-7.32 32.46-17.56 45.38-3.33 3.61-0.1 8.62-0.46 12.9-3.59 4.35-8.21 7.6-12.57 11.11 0.01 3.28 0.02 6.56-0.13 9.85-3.89 2.57-8.35 4.06-12.3 6.54-0.42 1.33-0.85 2.67-1.26 4.02-3.17 1.5-6.56 2.47-9.73 3.99-12.55-3.6-24.97-7.61-37.49-11.32-11.65-3.85-23.58-6.87-35.11-11.11l-0.66-1.18c-0.06-0.09-0.16-0.27-0.21-0.36l-0.95-1.61-0.4-0.68c-0.09-0.15-0.25-0.44-0.34-0.59-0.71-1.26-1.36-2.55-1.94-3.87l-0.06-0.13-0.07-0.1c-0.44-0.7-1.33-2.11-1.78-2.81-0.05-0.08-0.15-0.24-0.2-0.33l-0.29-0.46c-0.17-0.29-0.52-0.86-0.69-1.15-0.43-0.73-1.3-2.19-1.73-2.92-0.11-0.18-0.32-0.55-0.43-0.73l-0.61-1.04c-0.08-0.14-0.24-0.41-0.32-0.55l-0.97-1.67c-0.04-0.07-0.13-0.21-0.17-0.29l-1.02-1.75c-0.09-0.16-0.27-0.48-0.36-0.63-0.1-0.18-0.31-0.55-0.41-0.73l-0.83-1.46c-0.1-0.17-0.3-0.53-0.4-0.7l-0.64-1.13c-0.09-0.15-0.26-0.45-0.35-0.6-0.39-0.72-1.18-2.15-1.58-2.87-0.04-0.08-0.14-0.25-0.18-0.33l-0.27-0.47c-0.19-0.28-0.56-0.84-0.75-1.12-0.99-1.66-1.92-3.36-2.81-5.07-0.05-0.08-0.14-0.25-0.18-0.33l-0.26-0.46c-0.19-0.27-0.57-0.81-0.76-1.07-0.44-0.79-1.32-2.37-1.76-3.16-0.05-0.08-0.15-0.25-0.19-0.34l-0.27-0.48c-0.2-0.33-0.59-0.98-0.79-1.31l-0.86-1.45c-0.08-0.14-0.25-0.42-0.34-0.57-0.38-0.66-1.15-1.99-1.54-2.65-0.09-0.15-0.26-0.46-0.35-0.62-0.68-1.13-1.33-2.27-1.97-3.41-0.05-0.09-0.16-0.27-0.21-0.36l-0.95-1.63c-0.1-0.16-0.29-0.48-0.38-0.65-0.09-0.15-0.26-0.45-0.35-0.6l-1.01-1.76c-0.05-0.08-0.14-0.25-0.19-0.33l-0.82-1.47c-0.07-0.12-0.2-0.35-0.27-0.47-0.38-0.67-1.15-2-1.53-2.67-0.08-0.14-0.24-0.41-0.32-0.54-0.62-1.03-1.24-2.07-1.84-3.1-27.73-48.12-55.5-96.21-83.29-144.3-1.74-3.0004-3.32-6.1204-5.45-8.8804l-0.05-0.45005-0.04-0.49z"/> <path d="m166.15 0.60955l0.56-0.02 0.05 0.45005-0.7 0.11 0.09-0.54005z" fill="#089156"/> <path d="m166.76 1.0396c2.13 2.76 3.71 5.88 5.45 8.88 27.79 48.09 55.56 96.18 83.29 144.3-12.84 22.36-25.78 44.67-38.67 67.01-1.73-10.7-4.96-21.08-7.02-31.72-3.19-11.41-4.96-23.16-8.26-34.55-3.8-18.4-8.43-36.64-12.58-54.97-6.33-26.73-12.41-53.52-18.43-80.33-1.4-6.17-3.26-12.28-3.78-18.62z" fill="#089156"/> <path d="m164.39 3.5996c0.03-0.05 0.1-0.16 0.13-0.21-0.03 0.05-0.1 0.16-0.13 0.21z" fill="#089156"/> <path d="m163.27 5.4996c0.05-0.07 0.13-0.22 0.17-0.29-0.04 0.07-0.12 0.22-0.17 0.29z" fill="#089156"/> <path d="m161.91 7.9296c0.09-0.17 0.27-0.49 0.36-0.65-0.09 0.16-0.27 0.48-0.36 0.65z" fill="#089156"/> <path d="m161.56 8.5296c0.08-0.15 0.26-0.45 0.35-0.6-0.09 0.15-0.27 0.45-0.35 0.6z" fill="#089156"/> <path d="m160.38 10.55c0.04-0.08 0.12-0.22 0.16-0.3-0.04 0.08-0.12 0.22-0.16 0.3z" fill="#089156"/> <path d="m159.31 12.84c0.05-0.16 0.14-0.48 0.19-0.64-0.05 0.16-0.14 0.48-0.19 0.64z" fill="#089156"/> <path d="m157.91 15.07c0.35-0.56 1.05-1.67 1.4-2.23-0.35 0.56-1.05 1.67-1.4 2.23z" fill="#089156"/> <path d="m157.37 15.85c0.14-0.19 0.4-0.58 0.54-0.78-0.14 0.2-0.4 0.59-0.54 0.78z" fill="#089156"/> <path d="m156.32 17.54c0.07-0.12 0.22-0.37 0.29-0.5-0.07 0.13-0.22 0.38-0.29 0.5z" fill="#089156"/> <path d="m155.32 19.85c0.03-0.17 0.11-0.51 0.15-0.68-0.04 0.17-0.12 0.51-0.15 0.68z" fill="#089156"/> <path d="m153.86 22.05c0.37-0.55 1.09-1.65 1.46-2.2-0.37 0.55-1.09 1.65-1.46 2.2z" fill="#089156"/> <path d="m153.35 22.82c0.13-0.19 0.39-0.58 0.51-0.77-0.12 0.19-0.38 0.58-0.51 0.77z" fill="#089156"/> <path d="m152.3 24.55c0.06-0.11 0.18-0.32 0.24-0.42-0.06 0.1-0.18 0.31-0.24 0.42z" fill="#089156"/> <path d="m150.94 26.94c0.1-0.17 0.3-0.52 0.4-0.7-0.1 0.18-0.3 0.53-0.4 0.7z" fill="#089156"/> <path d="m150.58 27.56c0.09-0.16 0.27-0.46 0.36-0.62-0.09 0.16-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m149.39 29.56c0.05-0.07 0.14-0.22 0.18-0.3-0.04 0.08-0.13 0.23-0.18 0.3z" fill="#089156"/> <path d="m148.29 31.48c0.04-0.07 0.12-0.21 0.16-0.29-0.04 0.08-0.12 0.22-0.16 0.29z" fill="#089156"/> <path d="m146.9 33.89c0.1-0.16 0.29-0.5 0.39-0.66-0.1 0.16-0.29 0.5-0.39 0.66z" fill="#089156"/> <path d="m146.51 34.56c0.1-0.17 0.29-0.5 0.39-0.67-0.1 0.17-0.29 0.5-0.39 0.67z" fill="#089156"/> <path d="m145.36 36.54c0.03-0.07 0.11-0.2 0.15-0.27-0.04 0.07-0.12 0.2-0.15 0.27z" fill="#089156"/> <path d="m144.32 38.88c0.04-0.17 0.13-0.51 0.17-0.68-0.04 0.17-0.13 0.51-0.17 0.68z" fill="#089156"/> <path d="m142.86 41.11c0.36-0.56 1.09-1.68 1.46-2.23-0.37 0.55-1.1 1.67-1.46 2.23z" fill="#089156"/> <path d="m142.37 41.87c0.12-0.19 0.36-0.57 0.49-0.76-0.13 0.19-0.37 0.57-0.49 0.76z" fill="#089156"/> <path d="m141.11 44.14c0.15-0.29 0.44-0.86 0.58-1.15-0.14 0.29-0.43 0.86-0.58 1.15z" fill="#089156"/> <path d="m140.1 45.99c0.13-0.2 0.38-0.61 0.5-0.81-0.12 0.2-0.37 0.61-0.5 0.81z" fill="#089156"/> <path d="m139.54 46.77c0.14-0.2 0.42-0.58 0.56-0.78-0.14 0.2-0.42 0.58-0.56 0.78z" fill="#089156"/> <path d="m138.38 48.58c0.13-0.2 0.38-0.62 0.5-0.83-0.12 0.21-0.37 0.63-0.5 0.83z" fill="#089156"/> <path d="m137.07 51.17c0.11-0.23 0.34-0.7 0.45-0.93-0.11 0.23-0.34 0.7-0.45 0.93z" fill="#089156"/> <path d="m136.09 53c0.12-0.2 0.37-0.6 0.49-0.8-0.12 0.2-0.37 0.6-0.49 0.8z" fill="#089156"/> <path d="m135.53 53.76c0.14-0.19 0.42-0.57 0.56-0.76-0.14 0.19-0.42 0.57-0.56 0.76z" fill="#089156"/> <path d="m134.2 55.92c0.16-0.3 0.5-0.91 0.67-1.22-0.17 0.31-0.51 0.92-0.67 1.22z" fill="#089156"/> <path d="m133.29 57.86c0.1-0.2 0.28-0.59 0.38-0.79-0.1 0.2-0.28 0.59-0.38 0.79z" fill="#089156"/> <path d="m131.92 60.07c0.34-0.56 1.03-1.66 1.37-2.21-0.34 0.55-1.03 1.65-1.37 2.21z" fill="#089156"/> <path d="m131.37 60.87c0.14-0.2 0.41-0.6 0.55-0.8-0.14 0.2-0.41 0.6-0.55 0.8z" fill="#089156"/> <path d="m130.34 62.58c0.07-0.12 0.21-0.37 0.28-0.49-0.07 0.12-0.21 0.37-0.28 0.49z" fill="#089156"/> <path d="m129.22 64.83c0.06-0.14 0.2-0.42 0.27-0.56-0.07 0.14-0.21 0.42-0.27 0.56z" fill="#089156"/> <path d="m127.8 67.27c0.35-0.61 1.06-1.83 1.42-2.44l0.07 1.17c-0.37 0.32-1.12 0.96-1.49 1.27z" fill="#089156"/> <path d="m127.41 67.82c0.1-0.14 0.29-0.41 0.39-0.55-0.1 0.14-0.29 0.41-0.39 0.55z" fill="#089156"/> <path d="m126.13 70.15c0.18-0.39 0.55-1.17 0.73-1.56-0.18 0.39-0.55 1.17-0.73 1.56z" fill="#089156"/> <path d="m125.09 71.99c0.12-0.2 0.37-0.6 0.5-0.8-0.13 0.2-0.38 0.6-0.5 0.8z" fill="#089156"/> <path d="m124.54 72.77c0.14-0.2 0.41-0.59 0.55-0.78-0.14 0.19-0.41 0.58-0.55 0.78z" fill="#089156"/> <path d="m123.39 74.56c0.12-0.2 0.37-0.61 0.5-0.81-0.13 0.2-0.38 0.61-0.5 0.81z" fill="#089156"/> <path d="m122.19 76.66c0.06-0.1 0.18-0.32 0.24-0.42-0.06 0.1-0.18 0.32-0.24 0.42z" fill="#089156"/> <path d="m121.14 78.55l0.32-0.56-0.32 0.56z" fill="#089156"/> <path d="m119.25 81.78c0.08-0.13 0.24-0.41 0.32-0.55-0.08 0.14-0.24 0.42-0.32 0.55z" fill="#089156"/> <path d="m118.19 83.63c0.09-0.16 0.27-0.47 0.36-0.62-0.09 0.15-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m116.9 85.88c0.11-0.19 0.33-0.58 0.45-0.78-0.12 0.2-0.34 0.59-0.45 0.78z" fill="#089156"/> <path d="m116.5 86.55c0.1-0.16 0.3-0.5 0.4-0.67-0.1 0.17-0.3 0.51-0.4 0.67z" fill="#089156"/> <path d="m115.34 88.51l0.16-0.28-0.16 0.28z" fill="#089156"/> <path d="m114.32 90.88c0.04-0.18 0.11-0.53 0.15-0.7-0.04 0.17-0.11 0.52-0.15 0.7z" fill="#089156"/> <path d="m112.86 93.05c0.36-0.54 1.09-1.63 1.46-2.17-0.37 0.54-1.1 1.63-1.46 2.17z" fill="#089156"/> <path d="m112.34 93.83c0.13-0.19 0.39-0.58 0.52-0.78-0.13 0.2-0.39 0.59-0.52 0.78z" fill="#089156"/> <path d="m111.32 95.49l0.28-0.48-0.28 0.48z" fill="#089156"/> <path d="m109.93 97.96c0.1-0.18 0.3-0.53 0.4-0.71-0.1 0.18-0.3 0.53-0.4 0.71z" fill="#089156"/> <path d="m109.56 98.58c0.09-0.15 0.27-0.47 0.37-0.62-0.1 0.15-0.28 0.47-0.37 0.62z" fill="#089156"/> <path d="m108.4 100.55c0.04-0.07 0.12-0.21 0.17-0.28-0.05 0.07-0.13 0.21-0.17 0.28z" fill="#089156"/> <path d="m107.29 102.46c0.03-0.06 0.1-0.17 0.13-0.23-0.03 0.06-0.1 0.17-0.13 0.23z" fill="#089156"/> <path d="m214.02 225.86c0.17-0.28 0.53-0.84 0.7-1.11-0.17 0.27-0.53 0.83-0.7 1.11z" fill="#089156"/> <path d="m213.58 226.64c0.05-0.08 0.14-0.25 0.18-0.33-0.04 0.08-0.13 0.25-0.18 0.33z" fill="#089156"/> <path d="m211.72 230.02c0.08-0.13 0.23-0.39 0.3-0.52-0.07 0.13-0.22 0.39-0.3 0.52z" fill="#089156"/> <path d="m210.67 231.87c0.08-0.15 0.25-0.44 0.34-0.59-0.09 0.15-0.26 0.44-0.34 0.59z" fill="#089156"/> <path d="m209.66 233.64c0.05-0.08 0.14-0.24 0.18-0.32-0.04 0.08-0.13 0.24-0.18 0.32z" fill="#089156"/> <path d="m208.27 236.07c0.09-0.16 0.27-0.48 0.36-0.63-0.09 0.15-0.27 0.47-0.36 0.63z" fill="#089156"/> <path d="m207.87 236.74c0.1-0.17 0.3-0.5 0.4-0.67-0.1 0.17-0.3 0.5-0.4 0.67z" fill="#089156"/> <path d="m206.54 239.02c0.08-0.13 0.24-0.41 0.32-0.54-0.08 0.13-0.24 0.41-0.32 0.54z" fill="#089156"/> <path d="m205.5 240.8c0.1-0.18 0.32-0.55 0.42-0.73-0.1 0.18-0.32 0.55-0.42 0.73z" fill="#089156"/> <path d="m203.62 244.07c0.07-0.13 0.22-0.38 0.29-0.5-0.07 0.12-0.22 0.37-0.29 0.5z" fill="#089156"/> <path d="m202.56 245.86c0.11-0.19 0.33-0.55 0.43-0.74-0.1 0.19-0.32 0.55-0.43 0.74z" fill="#089156"/> <path d="m200.71 249.06c0.09-0.15 0.26-0.46 0.35-0.61-0.09 0.15-0.26 0.46-0.35 0.61z" fill="#089156"/> <path d="m199.68 250.9c0.07-0.12 0.21-0.37 0.28-0.49-0.07 0.12-0.21 0.37-0.28 0.49z" fill="#089156"/> <path d="m198.59 252.81l0.32-0.56-0.32 0.56z" fill="#089156"/> <path d="m196.66 256.09c0.09-0.16 0.27-0.47 0.36-0.62-0.09 0.15-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m195.69 257.84c0.06-0.12 0.19-0.35 0.26-0.47-0.07 0.12-0.2 0.35-0.26 0.47z" fill="#089156"/> <path d="m194.58 259.76c0.07-0.12 0.22-0.37 0.29-0.5-0.07 0.13-0.22 0.38-0.29 0.5z" fill="#089156"/> <path d="m192.6 263.15c0.08-0.13 0.24-0.39 0.31-0.52-0.07 0.13-0.23 0.39-0.31 0.52z" fill="#089156"/> <path d="m191.59 264.85c0.1-0.18 0.31-0.53 0.41-0.71-0.1 0.18-0.31 0.53-0.41 0.71z" fill="#089156"/> <path d="m189.82 267.94c0.06-0.11 0.2-0.35 0.26-0.46-0.06 0.11-0.2 0.35-0.26 0.46z" fill="#089156"/> <path d="m188.76 269.83c0.06-0.11 0.18-0.32 0.24-0.43-0.06 0.11-0.18 0.32-0.24 0.43z" fill="#089156"/> <path d="m187.64 271.76c0.07-0.11 0.21-0.35 0.28-0.46-0.07 0.11-0.21 0.35-0.28 0.46z" fill="#089156"/> <path d="m185.65 275.09c0.11-0.18 0.31-0.54 0.42-0.71-0.11 0.17-0.31 0.53-0.42 0.71z" fill="#089156"/> <path d="m184.76 276.74c0.07-0.13 0.22-0.41 0.3-0.55-0.08 0.14-0.23 0.42-0.3 0.55z" fill="#089156"/> <path d="m183.39 279.12c0.08-0.15 0.26-0.45 0.34-0.6-0.08 0.15-0.26 0.45-0.34 0.6z" fill="#089156"/> <path d="m183.06 279.69c0.08-0.14 0.24-0.43 0.33-0.57-0.09 0.14-0.25 0.43-0.33 0.57z" fill="#089156"/> <path d="m346.42 3.2196c0.08 0.13 0.23 0.41 0.31 0.55-0.08-0.14-0.23-0.42-0.31-0.55z" fill="#10985b"/> <path d="m354.54 17.35c0.05 0.08 0.13 0.23 0.18 0.3-0.05-0.07-0.13-0.22-0.18-0.3z" fill="#10985b"/> <path d="m369.55 43.36c0.04 0.07 0.13 0.21 0.17 0.29-0.04-0.08-0.13-0.22-0.17-0.29z" fill="#10985b"/> <path d="m372.44 48.25c0.08 0.13 0.23 0.4 0.31 0.54-0.08-0.14-0.23-0.41-0.31-0.54z" fill="#10985b"/> <path d="m376.53 55.37c0.05 0.07 0.13 0.21 0.17 0.29-0.04-0.08-0.12-0.22-0.17-0.29z" fill="#10985b"/> <path d="m380.48 62.24c0.08 0.13 0.23 0.39 0.31 0.52-0.08-0.13-0.23-0.39-0.31-0.52z" fill="#10985b"/> <path d="m384.51 69.22c0.08 0.13 0.23 0.4 0.31 0.53-0.08-0.13-0.23-0.4-0.31-0.53z" fill="#10985b"/> <path d="m420.57 131.65c17.39 30.13 34.89 60.21 52.14 90.43 0.08 0.13 0.24 0.41 0.32 0.54 0.4 0.66 1.2 1.97 1.59 2.62 0.08 0.13 0.24 0.4 0.32 0.53l0.8 1.37c0.05 0.09 0.15 0.28 0.21 0.37l1 1.74c0.1 0.17 0.29 0.52 0.39 0.69 0.09 0.15 0.27 0.46 0.36 0.62l0.98 1.7 0.16 0.28 0.98 1.68c0.04 0.07 0.12 0.2 0.16 0.27l0.98 1.7c0.1 0.17 0.29 0.5 0.39 0.67 0.09 0.17 0.28 0.5 0.37 0.66l1.01 1.78c0.14 0.35 0.42 1.03 0.56 1.37l0.28 0.55 0.13 0.29 0.22 0.29 0.59 0.89c0.21 0.33 0.62 0.99 0.83 1.32 0.12 0.2 0.38 0.6 0.5 0.8l0.66 1.05c0.2 0.45 0.6 1.36 0.8 1.81l0.3 0.54 0.11 0.21 0.09 0.13c0.44 0.65 1.31 1.96 1.75 2.61 0.11 0.18 0.33 0.54 0.45 0.72l0.6 1c0.09 0.16 0.27 0.47 0.36 0.62l1.01 1.77c0.09 0.16 0.27 0.48 0.36 0.64s0.27 0.47 0.36 0.63l1 1.71c0.04 0.08 0.13 0.23 0.18 0.3l0.91 1.6c0.06 0.1 0.18 0.31 0.24 0.41l0.92 1.61c0.11 0.18 0.32 0.55 0.43 0.73 0.09 0.16 0.28 0.48 0.37 0.64 0.74 1.23 1.45 2.48 2.11 3.76 0.1 0.21 0.3 0.63 0.39 0.84l0.46 1.04c0.12 0.2 0.36 0.61 0.47 0.81 0.15 0.2 0.44 0.58 0.59 0.77l0.69 0.98c0.12 0.19 0.36 0.57 0.49 0.77l1.01 1.75c0.09 0.16 0.27 0.48 0.36 0.64s0.27 0.47 0.37 0.63l1 1.72c0.04 0.08 0.12 0.22 0.16 0.29l0.95 1.66c0.04 0.07 0.12 0.2 0.16 0.27l0.97 1.69c0.1 0.17 0.3 0.51 0.4 0.69 0.1 0.17 0.3 0.51 0.39 0.68l1 1.72c0.04 0.07 0.11 0.21 0.15 0.28l1.06 1.98-0.01 0.9c-25.02-7.19-49.64-15.72-74.73-22.65-22.77-7.35-45.75-14.04-68.52-21.35 3.17-1.52 6.56-2.49 9.73-3.99 0.41-1.35 0.84-2.69 1.26-4.02 3.95-2.48 8.41-3.97 12.3-6.54 0.15-3.29 0.14-6.57 0.13-9.85 4.36-3.51 8.98-6.76 12.57-11.11 0.36-4.28-2.87-9.29 0.46-12.9 10.24-12.92 16.45-28.93 17.56-45.38 1.83-6.02-1.46-11.98-0.1-17.97z" fill="#f9c941"/> <path d="m509.91 287.41l0.52 0.02 0.29 0.76-0.59 0.04-0.22-0.82z" fill="#f9c941"/> <path d="m257.34 157.32c0.08 0.13 0.24 0.4 0.32 0.54-0.08-0.14-0.24-0.41-0.32-0.54z" fill="#e3b73a"/> <path d="m259.19 160.53c0.07 0.12 0.2 0.35 0.27 0.47-0.07-0.12-0.2-0.35-0.27-0.47z" fill="#e3b73a"/> <path d="m260.28 162.47c0.05 0.08 0.14 0.25 0.19 0.33-0.05-0.08-0.14-0.25-0.19-0.33z" fill="#e3b73a"/> <path d="m261.48 164.56c0.09 0.15 0.26 0.45 0.35 0.6-0.09-0.15-0.26-0.45-0.35-0.6z" fill="#e3b73a"/> <path d="m261.83 165.16c0.09 0.17 0.28 0.49 0.38 0.65-0.1-0.16-0.29-0.48-0.38-0.65z" fill="#e3b73a"/> <path d="m263.16 167.44c0.05 0.09 0.16 0.27 0.21 0.36-0.05-0.09-0.16-0.27-0.21-0.36z" fill="#e3b73a"/> <path d="m265.34 171.21c0.09 0.16 0.26 0.47 0.35 0.62-0.09-0.15-0.26-0.46-0.35-0.62z" fill="#e3b73a"/> <path d="m267.23 174.48c0.09 0.15 0.26 0.43 0.34 0.57-0.08-0.14-0.25-0.42-0.34-0.57z" fill="#e3b73a"/> <path d="m268.43 176.5c0.2 0.33 0.59 0.98 0.79 1.31-0.2-0.33-0.59-0.98-0.79-1.31z" fill="#e3b73a"/> <path d="m269.49 178.29c0.04 0.09 0.14 0.26 0.19 0.34-0.05-0.08-0.15-0.25-0.19-0.34z" fill="#e3b73a"/> <path d="m271.44 181.79c0.19 0.26 0.57 0.8 0.76 1.07-0.19-0.27-0.57-0.81-0.76-1.07z" fill="#e3b73a"/> <path d="m272.46 183.32c0.04 0.08 0.13 0.25 0.18 0.33-0.05-0.08-0.14-0.25-0.18-0.33z" fill="#e3b73a"/> <path d="m275.45 188.72c0.19 0.28 0.56 0.84 0.75 1.12-0.19-0.28-0.56-0.84-0.75-1.12z" fill="#e3b73a"/> <path d="m276.47 190.31c0.04 0.08 0.14 0.25 0.18 0.33-0.04-0.08-0.14-0.25-0.18-0.33z" fill="#e3b73a"/> <path d="m278.23 193.51c0.09 0.15 0.26 0.45 0.35 0.6-0.09-0.15-0.26-0.45-0.35-0.6z" fill="#e3b73a"/> <path d="m279.22 195.24c0.1 0.17 0.3 0.53 0.4 0.7-0.1-0.17-0.3-0.53-0.4-0.7z" fill="#e3b73a"/> <path d="m280.45 197.4c0.1 0.18 0.31 0.55 0.41 0.73-0.1-0.18-0.31-0.55-0.41-0.73z" fill="#e3b73a"/> <path d="m280.86 198.13c0.09 0.15 0.27 0.47 0.36 0.63-0.09-0.16-0.27-0.48-0.36-0.63z" fill="#e3b73a"/> <path d="m282.24 200.51c0.04 0.08 0.13 0.22 0.17 0.29-0.04-0.07-0.13-0.21-0.17-0.29z" fill="#e3b73a"/> <path d="m283.38 202.47c0.08 0.14 0.24 0.41 0.32 0.55-0.08-0.14-0.24-0.41-0.32-0.55z" fill="#e3b73a"/> <path d="m284.31 204.06c0.11 0.18 0.32 0.55 0.43 0.73-0.11-0.18-0.32-0.55-0.43-0.73z" fill="#e3b73a"/> <path d="m286.47 207.71c0.17 0.29 0.52 0.86 0.69 1.15-0.17-0.29-0.52-0.86-0.69-1.15z" fill="#e3b73a"/> <path d="m287.45 209.32c0.05 0.09 0.15 0.25 0.2 0.33-0.05-0.08-0.15-0.24-0.2-0.33z" fill="#e3b73a"/> <path d="m289.43 212.46l0.07 0.1 0.06 0.13c-0.03-0.06-0.1-0.17-0.13-0.23z" fill="#e3b73a"/> <path d="m291.5 216.56c0.09 0.15 0.25 0.44 0.34 0.59-0.09-0.15-0.25-0.44-0.34-0.59z" fill="#e3b73a"/> <path d="m291.84 217.15l0.4 0.68-0.4-0.68z" fill="#e3b73a"/> <path d="m293.19 219.44c0.05 0.09 0.15 0.27 0.21 0.36-0.06-0.09-0.16-0.27-0.21-0.36z" fill="#e3b73a"/> <path d="m294.06 220.98c11.53 4.24 23.46 7.26 35.11 11.11 12.52 3.71 24.94 7.72 37.49 11.32 22.77 7.31 45.75 14 68.52 21.35-0.34 4.87 0.62 9.86-0.59 14.64-0.93 4.65-6.49 5.38-8.78 9.09-30.77 0.01-61.53 0.1-92.29-0.03l-0.66-0.05c-12.71-22.6-25.93-44.92-38.8-67.43z" fill="#e3b73a"/> <path d="m472.71 222.08c0.08 0.13 0.24 0.41 0.32 0.54-0.08-0.13-0.24-0.41-0.32-0.54z" fill="#e8b835"/> <path d="m474.62 225.24c0.08 0.13 0.24 0.4 0.32 0.53-0.08-0.13-0.24-0.4-0.32-0.53z" fill="#e8b835"/> <path d="m475.74 227.14c0.05 0.09 0.15 0.28 0.21 0.37-0.06-0.09-0.16-0.28-0.21-0.37z" fill="#e8b835"/> <path d="m476.95 229.25c0.1 0.17 0.29 0.52 0.39 0.69-0.1-0.17-0.29-0.52-0.39-0.69z" fill="#e8b835"/> <path d="m477.34 229.94c0.09 0.15 0.27 0.46 0.36 0.62-0.09-0.16-0.27-0.47-0.36-0.62z" fill="#e8b835"/> <path d="m478.68 232.26l0.16 0.28-0.16-0.28z" fill="#e8b835"/> <path d="m479.82 234.22c0.04 0.07 0.12 0.2 0.16 0.27-0.04-0.07-0.12-0.2-0.16-0.27z" fill="#e8b835"/> <path d="m480.96 236.19c0.1 0.17 0.29 0.5 0.39 0.67-0.1-0.17-0.29-0.5-0.39-0.67z" fill="#e8b835"/> <path d="m481.35 236.86c0.09 0.17 0.28 0.5 0.37 0.66-0.09-0.16-0.28-0.49-0.37-0.66z" fill="#e8b835"/> <path d="m482.73 239.3c0.14 0.35 0.42 1.03 0.56 1.37-0.14-0.34-0.42-1.02-0.56-1.37z" fill="#e8b835"/> <path d="m483.57 241.22c0.09 0.15 0.26 0.44 0.35 0.58l-0.22-0.29-0.13-0.29z" fill="#e8b835"/> <path d="m484.51 242.69c0.21 0.33 0.62 0.99 0.83 1.32-0.21-0.33-0.62-0.99-0.83-1.32z" fill="#e8b835"/> <path d="m485.34 244.01c0.12 0.2 0.38 0.6 0.5 0.8-0.12-0.2-0.38-0.6-0.5-0.8z" fill="#e8b835"/> <path d="m486.5 245.86c0.2 0.45 0.6 1.36 0.8 1.81-0.2-0.45-0.6-1.36-0.8-1.81z" fill="#e8b835"/> <path d="m487.6 248.21c0.05 0.09 0.15 0.26 0.2 0.34l-0.09-0.13-0.11-0.21z" fill="#e8b835"/> <path d="m489.55 251.16c0.11 0.18 0.33 0.54 0.45 0.72-0.12-0.18-0.34-0.54-0.45-0.72z" fill="#e8b835"/> <path d="m490.6 252.88c0.09 0.16 0.27 0.47 0.36 0.62-0.09-0.15-0.27-0.46-0.36-0.62z" fill="#e8b835"/> <path d="m491.97 255.27c0.09 0.16 0.27 0.48 0.36 0.64-0.09-0.16-0.27-0.48-0.36-0.64z" fill="#e8b835"/> <path d="m492.33 255.91c0.09 0.16 0.27 0.47 0.36 0.63-0.09-0.16-0.27-0.47-0.36-0.63z" fill="#e8b835"/> <path d="m493.69 258.25c0.04 0.08 0.13 0.23 0.18 0.3-0.05-0.07-0.14-0.22-0.18-0.3z" fill="#e8b835"/> <path d="m494.78 260.15c0.06 0.1 0.18 0.31 0.24 0.41-0.06-0.1-0.18-0.31-0.24-0.41z" fill="#e8b835"/> <path d="m495.94 262.17c0.11 0.18 0.32 0.55 0.43 0.73-0.11-0.18-0.32-0.55-0.43-0.73z" fill="#e8b835"/> <path d="m496.37 262.9c0.09 0.16 0.28 0.48 0.37 0.64-0.09-0.16-0.28-0.48-0.37-0.64z" fill="#e8b835"/> <path d="m435.18 264.76c25.09 6.93 49.71 15.46 74.73 22.65l0.22 0.82c-28.09 0.64-56.22 0.11-84.32 0.26 2.29-3.71 7.85-4.44 8.78-9.09 1.21-4.78 0.25-9.77 0.59-14.64z" fill="#e8b835"/> <path d="m498.85 267.3c0.1 0.21 0.3 0.63 0.39 0.84-0.09-0.21-0.29-0.63-0.39-0.84z" fill="#e8b835"/> <path d="m499.7 269.18c0.12 0.2 0.36 0.61 0.47 0.81-0.11-0.2-0.35-0.61-0.47-0.81z" fill="#e8b835"/> <path d="m500.17 269.99c0.15 0.2 0.44 0.58 0.59 0.77-0.15-0.19-0.44-0.57-0.59-0.77z" fill="#e8b835"/> <path d="m501.45 271.74c0.12 0.19 0.36 0.57 0.49 0.77-0.13-0.2-0.37-0.58-0.49-0.77z" fill="#e8b835"/> <path d="m502.95 274.26c0.09 0.16 0.27 0.48 0.36 0.64-0.09-0.16-0.27-0.48-0.36-0.64z" fill="#e8b835"/> <path d="m503.31 274.9c0.09 0.16 0.27 0.47 0.37 0.63-0.1-0.16-0.28-0.47-0.37-0.63z" fill="#e8b835"/> <path d="m504.68 277.25c0.04 0.08 0.12 0.22 0.16 0.29-0.04-0.07-0.12-0.21-0.16-0.29z" fill="#e8b835"/> <path d="m505.79 279.2c0.04 0.07 0.12 0.2 0.16 0.27-0.04-0.07-0.12-0.2-0.16-0.27z" fill="#e8b835"/> <path d="m506.92 281.16c0.1 0.17 0.3 0.51 0.4 0.69-0.1-0.18-0.3-0.52-0.4-0.69z" fill="#e8b835"/> <path d="m507.32 281.85c0.1 0.17 0.3 0.51 0.39 0.68-0.09-0.17-0.29-0.51-0.39-0.68z" fill="#e8b835"/> <path d="m508.71 284.25c0.04 0.07 0.11 0.21 0.15 0.28-0.04-0.07-0.11-0.21-0.15-0.28z" fill="#e8b835"/> <path d="m509.92 286.51c0.13 0.23 0.38 0.69 0.51 0.92l-0.52-0.02 0.01-0.9z" fill="#e8b835"/> <path d="m147.21 341.08c10.31-17.58 20.11-35.49 30.76-52.86 51.63 0.19 103.27-0.29 154.89 0.19l0.66 0.05c-26.11 0.84-52.29-0.22-78.4 0.44-4.98 3.21-8.3 8.41-13.07 11.91-4.43 3.23-7.69 7.73-11.92 11.18-5.93 4.37-10.34 10.43-16.36 14.71-6.96 7.37-14.99 13.58-22.01 20.91-5.26 4.04-9.66 9.03-14.56 13.48-5.39 3.91-9.52 9.21-14.56 13.53-0.13 0.11-0.38 0.33-0.51 0.45-0.27 0.21-0.8 0.65-1.07 0.86-0.13 0.11-0.37 0.31-0.5 0.42-3.97 3.07-7.01 7.12-10.91 10.27-0.13 0.11-0.38 0.32-0.5 0.42-0.13 0.11-0.38 0.32-0.51 0.42-5.69 4.67-10.25 10.58-16.22 14.93-6.01 5.96-12.79 11.08-18.5 17.36-8.44 6.94-15.74 15.13-24.44 21.78 2.16-4.71 5.02-9.03 7.53-13.54 16.74-28.97 33.46-57.94 50.2-86.91z" fill="#296ad9"/> <path d="m89.04 442.17c0.11-0.16 0.33-0.48 0.44-0.64l-0.03 0.65-0.41-0.01z" fill="#296ad9"/> <path id="#2a71e9ff" fill="#2a71e9" d="m333.52 288.46c30.76 0.13 61.52 0.04 92.29 0.03 28.1-0.15 56.23 0.38 84.32-0.26l0.59-0.04 0.4 0.11v0.08c-29.66 51.27-59.23 102.6-88.89 153.88-110.93-0.03-221.86 0.1-332.78-0.08l0.03-0.65c8.7-6.65 16-14.84 24.44-21.78 5.71-6.28 12.49-11.4 18.5-17.36 5.97-4.35 10.53-10.26 16.22-14.93 0.13-0.1 0.38-0.31 0.51-0.42 0.12-0.1 0.37-0.31 0.5-0.42 3.9-3.15 6.94-7.2 10.91-10.27 0.13-0.11 0.37-0.31 0.5-0.42 0.27-0.21 0.8-0.65 1.07-0.86 0.13-0.12 0.38-0.34 0.51-0.45 5.04-4.32 9.17-9.62 14.56-13.53 4.9-4.45 9.3-9.44 14.56-13.48 7.02-7.33 15.05-13.54 22.01-20.91 6.02-4.28 10.43-10.34 16.36-14.71 4.23-3.45 7.49-7.95 11.92-11.18 4.77-3.5 8.09-8.7 13.07-11.91 26.11-0.66 52.29 0.4 78.4-0.44z"/> <path d="m162.13 375.07c0.13-0.12 0.38-0.34 0.51-0.45-0.13 0.11-0.38 0.33-0.51 0.45z" fill="#286ee6"/> <path d="m161.06 375.93c0.27-0.21 0.8-0.65 1.07-0.86-0.27 0.21-0.8 0.65-1.07 0.86z" fill="#286ee6"/> <path d="m160.56 376.35c0.13-0.11 0.37-0.31 0.5-0.42-0.13 0.11-0.37 0.31-0.5 0.42z" fill="#286ee6"/> <path d="m149.15 387.04c0.12-0.1 0.37-0.31 0.5-0.42-0.13 0.11-0.38 0.32-0.5 0.42z" fill="#286ee6"/> <path d="m148.64 387.46c0.13-0.1 0.38-0.31 0.51-0.42-0.13 0.11-0.38 0.32-0.51 0.42z" fill="#286ee6"/> </svg> </div> <div class="rs-box rs-box-initial" aria-hidden="false"> <h3 class="rs-small-headline">Connect your storage</h3> <span class="rs-sub-headline">To sync data with your account</span> </div> <div class="rs-box rs-box-connected" aria-hidden="true"> <div class="rs-connected-text"> <h1 class="rs-user rs-small-headline">user@provider.com</h1> <span class="rs-sub-headline">Connected</span> </div> <div class="rs-connected-buttons"> <button class="rs-button rs-button-small rs-sync" title="Sync now"> <svg class="rs-icon rs-loop-icon" xml:space="preserve" version="1.1" x="0px" y="0px" height="16" width="16" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512" xmlns="http://www.w3.org/2000/svg"> <path d="m273.4 300.5l-0.3 58c48.9-8.2 86.3-51 86.3-102.5 0-15.9-3.6-31-10-44.5-2.8-5.8-6-11.3-9.8-16.5l47.1-43.5c1.1 1.3 2.1 2.7 3.1 4 20.9 28 33.2 62.8 33.2 100.5v3.7c-1.5 71.5-47.6 132-111.4 154.6-12.3 4.3-25.2 7.3-38.5 8.7l-0.1 57-76.2-67-26.2-23 44.4-38.7 58.4-50.8z"/> <path d="m89 252.3c1.6-72.1 48.3-133 112.9-155.2 11.7-4 24-6.8 36.8-8.1l0.1-57 76.1 66.9 26.2 23.1-44.3 38.6-58.4 50.9 0.2-57.9c-48.8 8.3-86 51.1-86 102.4 0 16 3.6 31.1 10.1 44.7 2.7 5.8 6 11.2 9.7 16.3l-47 43.6c-1.3-1.6-2.6-3.3-3.8-5-20.5-27.9-32.6-62.3-32.6-99.6v-3.7z"/> </svg> </button> <button class="rs-button rs-button-small rs-disconnect" title="Disconnect"> <svg class="rs-icon rs-power-icon" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="16" height="16" style="enable-background:new 0 0 512 512" xml:space="preserve" viewBox="0 0 512 512" version="1.1"> <path d="m256 256c-17.7 0-32-14.3-32-32v-160c0-17.7 14.3-32 32-32s32 14.3 32 32v160c0 17.7-14.3 32-32 32z"/> <path d="m379 68.8c-5-3-10.8-4.8-17-4.8-17.7 0-32 14.3-32 32 0 6.2 1.8 12 4.8 16.9 2 3.2 4.6 6.1 7.6 8.4 1.2 0.9 2.4 1.7 3.7 2.5 8.1 5.6 15.8 11.9 23 19.1 30.3 30.2 46.9 70.4 46.9 113.1s-16.6 82.9-46.9 113.1c-30.2 30.3-70.4 46.9-113.1 46.9s-82.9-16.6-113.1-46.9c-30.3-30.2-46.9-70.4-46.9-113.1s16.6-82.9 46.9-113.1c7.1-7.1 14.8-13.5 22.9-19 1.4-0.8 2.6-1.6 3.9-2.6 3-2.3 5.5-5.1 7.5-8.3 3.1-4.9 4.8-10.7 4.8-16.9 0-17.7-14.3-32-32-32-6.2 0-12 1.8-16.9 4.8l-0.1-0.1c-60.8 40-101 108.9-101 187.2 0 123.7 100.3 224 224 224s224-100.3 224-224c0-78.3-40.2-147.2-101-187.2z"/> </svg> </button> </div> </div> <div class="rs-box rs-box-error" aria-hidden="true"> <div class="rs-error-message"></div> <div class="rs-error-buttons"> <a href="#" class="rs-reconnect rs-hidden">Renew</a> <button class="rs-button rs-button-small rs-disconnect" title="Disconnect"> <svg class="rs-icon rs-power-icon" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="16" height="16" style="enable-background:new 0 0 512 512" xml:space="preserve" viewBox="0 0 512 512" version="1.1"> <path d="m256 256c-17.7 0-32-14.3-32-32v-160c0-17.7 14.3-32 32-32s32 14.3 32 32v160c0 17.7-14.3 32-32 32z"/> <path d="m379 68.8c-5-3-10.8-4.8-17-4.8-17.7 0-32 14.3-32 32 0 6.2 1.8 12 4.8 16.9 2 3.2 4.6 6.1 7.6 8.4 1.2 0.9 2.4 1.7 3.7 2.5 8.1 5.6 15.8 11.9 23 19.1 30.3 30.2 46.9 70.4 46.9 113.1s-16.6 82.9-46.9 113.1c-30.2 30.3-70.4 46.9-113.1 46.9s-82.9-16.6-113.1-46.9c-30.3-30.2-46.9-70.4-46.9-113.1s16.6-82.9 46.9-113.1c7.1-7.1 14.8-13.5 22.9-19 1.4-0.8 2.6-1.6 3.9-2.6 3-2.3 5.5-5.1 7.5-8.3 3.1-4.9 4.8-10.7 4.8-16.9 0-17.7-14.3-32-32-32-6.2 0-12 1.8-16.9 4.8l-0.1-0.1c-60.8 40-101 108.9-101 187.2 0 123.7 100.3 224 224 224s224-100.3 224-224c0-78.3-40.2-147.2-101-187.2z"/> </svg> </button> </div> </div> <div class="rs-box rs-box-choose" aria-hidden="true"> <div class="rs-content"> <h1 class="rs-big-headline">Connect your storage</h1> <p class="rs-short-desc"> This app allows you to sync data with a <a class="rs-help" href="https://remotestorage.io/" target="_blank" rel="noopener">storage provider of your choice</a>. </p> <div class="rs-button-wrap"> <button class="rs-button rs-button-big rs-choose-rs"> <svg class="rs-logo" fill-rule="evenodd" height="40" width="40" xmlns="http://www.w3.org/2000/svg" version="1.1" style="shape-rendering:geometricPrecision;image-rendering:optimizeQuality;text-rendering:geometricPrecision" clip-rule="evenodd" xml:space="preserve" viewBox="0 0 739 853"> <g> <polygon class="rs-logo-shape" points="370 754 0 542 0 640 185 747 370 853 554 747 739 640 739 525 739 525 739 476 739 427 739 378 653 427 370 589 86 427 86 427 86 361 185 418 370 524 554 418 653 361 739 311 739 213 739 213 554 107 370 0 185 107 58 180 144 230 228 181 370 100 511 181 652 263 370 425 87 263 87 263 0 213 0 213 0 311 0 378 0 427 0 476 86 525 185 582 370 689 554 582 653 525 653 590 653 592"/> </g> </svg> <div>RemoteStorage</div> </button> <button class="rs-button rs-button-big rs-choose-dropbox"> <svg class="dropbox-logo" width="40" height="40" xml:space="preserve" stroke-miterlimit="1.4142" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 97" stroke-linejoin="round" version="1.1" clip-rule="evenodd"> <path d="m30.691 0l-30.691 20.039 21.221 16.994 30.946-19.108-21.476-17.925z" fill="#007ee5"/> <path d="m0 54.028l30.691 20.039 21.476-17.926-30.945-19.108-21.222 16.995z" fill="#007ee5"/> <path d="m52.167 56.142l21.477 17.926 30.696-20.039-21.227-16.995-30.946 19.108z" fill="#007ee5"/> <path d="m104.34 20.039l-30.696-20.039-21.477 17.925 30.946 19.108 21.227-16.994z" fill="#007ee5"/> <path d="m52.23 59.998l-21.538 17.873-9.218-6.018v6.747l30.756 18.443 30.756-18.443v-6.747l-9.216 6.018-21.54-17.873z" fill="#007ee5"/> </svg> <div>Dropbox</div> </button> <button class="rs-button rs-button-big rs-choose-googledrive"> <svg class="googledrive-logo" width="40" height="40" version="1.1" stroke-miterlimit="1.4142" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" width="100%" stroke-linejoin="round" clip-rule="evenodd" viewBox="0 0 511 442" height="100%"> <path d="m166.23 0.10955l0.44-0.009998 0.04 0.49-0.56 0.02 0.08-0.5z" fill="#0ba25e"/> <path d="m164.52 3.3896c0.39-0.56 1.15-1.68 1.54-2.24l0.7-0.11c0.52 6.34 2.38 12.45 3.78 18.62 6.02 26.81 12.1 53.6 18.43 80.33 4.15 18.33 8.78 36.57 12.58 54.97 3.3 11.39 5.07 23.14 8.26 34.55 2.06 10.64 5.29 21.02 7.02 31.72-0.7 1.17-1.4 2.35-2.11 3.52-0.17 0.27-0.53 0.83-0.7 1.11l-0.26 0.45c-0.04 0.08-0.13 0.25-0.18 0.33-0.39 0.72-1.17 2.15-1.56 2.86-0.07 0.13-0.22 0.39-0.3 0.52l-0.71 1.26c-0.09 0.15-0.26 0.44-0.34 0.59l-0.83 1.45c-0.04 0.08-0.13 0.24-0.18 0.32l-1.03 1.8c-0.09 0.15-0.27 0.47-0.36 0.63-0.1 0.17-0.3 0.5-0.4 0.67l-1.01 1.74c-0.08 0.13-0.24 0.41-0.32 0.54l-0.62 1.05c-0.1 0.18-0.32 0.55-0.42 0.73-0.4 0.69-1.19 2.07-1.59 2.77-0.07 0.12-0.22 0.37-0.29 0.5l-0.63 1.05c-0.1 0.19-0.32 0.55-0.43 0.74-0.37 0.65-1.13 1.94-1.5 2.59-0.09 0.15-0.26 0.46-0.35 0.61l-0.75 1.35c-0.07 0.12-0.21 0.37-0.28 0.49l-0.77 1.35-0.32 0.56c-0.4 0.66-1.18 1.99-1.57 2.66-0.09 0.15-0.27 0.46-0.36 0.62l-0.71 1.28c-0.07 0.12-0.2 0.35-0.26 0.47l-0.82 1.42c-0.07 0.13-0.22 0.38-0.29 0.5-0.42 0.72-1.25 2.15-1.67 2.87-0.07 0.13-0.23 0.39-0.31 0.52l-0.6 0.99c-0.1 0.18-0.31 0.53-0.41 0.71-0.38 0.66-1.13 1.97-1.51 2.63-0.06 0.11-0.2 0.35-0.26 0.46l-0.82 1.46c-0.06 0.11-0.18 0.32-0.24 0.43l-0.84 1.47c-0.07 0.11-0.21 0.35-0.28 0.46-0.39 0.66-1.18 1.96-1.57 2.62-0.11 0.17-0.31 0.53-0.42 0.71l-0.59 1.1c-0.08 0.14-0.23 0.42-0.3 0.55l-1.03 1.78c-0.08 0.15-0.26 0.45-0.34 0.6-0.09 0.14-0.25 0.43-0.33 0.57-1.69 2.85-3.22 5.79-5.09 8.53-10.65 17.37-20.45 35.28-30.76 52.86-16.74 28.97-33.46 57.94-50.2 86.91-2.51 4.51-5.37 8.83-7.53 13.54-0.11 0.16-0.33 0.48-0.44 0.64-4.01-5.78-7.11-12.16-10.78-18.16-16.74-28.99-33.49-57.97-50.22-86.97-9.3-16.31-18.99-32.42-28.04-48.88 35.84-61.85 71.52-123.81 107.29-185.7 0.03-0.06 0.1-0.17 0.13-0.23l0.98-1.68c0.04-0.07 0.12-0.21 0.17-0.28l0.99-1.69c0.09-0.15 0.27-0.47 0.37-0.62 0.1-0.18 0.3-0.53 0.4-0.71l0.99-1.76 0.28-0.48 0.74-1.18c0.13-0.19 0.39-0.58 0.52-0.78 0.36-0.54 1.09-1.63 1.46-2.17 0.04-0.18 0.11-0.53 0.15-0.7l0.87-1.67 0.16-0.28 1-1.68c0.1-0.16 0.3-0.5 0.4-0.67 0.11-0.19 0.33-0.58 0.45-0.78l0.84-1.47c0.09-0.16 0.27-0.47 0.36-0.62l0.7-1.23c0.08-0.13 0.24-0.41 0.32-0.55 0.39-0.67 1.17-2.01 1.57-2.68l0.32-0.56 0.73-1.33c0.06-0.1 0.18-0.32 0.24-0.42l0.96-1.68c0.12-0.2 0.37-0.61 0.5-0.81l0.65-0.98c0.14-0.2 0.41-0.59 0.55-0.78 0.12-0.2 0.37-0.6 0.5-0.8l0.54-1.04c0.18-0.39 0.55-1.17 0.73-1.56l0.55-0.77c0.1-0.14 0.29-0.41 0.39-0.55 0.37-0.31 1.12-0.95 1.49-1.27l-0.07-1.17c0.06-0.14 0.2-0.42 0.27-0.56l0.85-1.69c0.07-0.12 0.21-0.37 0.28-0.49l0.75-1.22c0.14-0.2 0.41-0.6 0.55-0.8 0.34-0.56 1.03-1.66 1.37-2.21 0.1-0.2 0.28-0.59 0.38-0.79l0.53-1.15c0.16-0.3 0.5-0.91 0.67-1.22l0.66-0.94c0.14-0.19 0.42-0.57 0.56-0.76 0.12-0.2 0.37-0.6 0.49-0.8l0.49-1.03c0.11-0.23 0.34-0.7 0.45-0.93l0.86-1.66c0.13-0.2 0.38-0.62 0.5-0.83l0.66-0.98c0.14-0.2 0.42-0.58 0.56-0.78 0.13-0.2 0.38-0.61 0.5-0.81l0.51-1.04c0.15-0.29 0.44-0.86 0.58-1.15l0.68-1.12c0.12-0.19 0.36-0.57 0.49-0.76 0.36-0.56 1.09-1.68 1.46-2.23 0.04-0.17 0.13-0.51 0.17-0.68l0.87-1.66c0.03-0.07 0.11-0.2 0.15-0.27l1-1.71c0.1-0.17 0.29-0.5 0.39-0.67 0.1-0.16 0.29-0.5 0.39-0.66l1-1.75c0.04-0.07 0.12-0.21 0.16-0.29l0.94-1.63c0.05-0.07 0.14-0.22 0.18-0.3l1.01-1.7c0.09-0.16 0.27-0.46 0.36-0.62 0.1-0.17 0.3-0.52 0.4-0.7l0.96-1.69c0.06-0.11 0.18-0.32 0.24-0.42l0.81-1.31c0.13-0.19 0.39-0.58 0.51-0.77 0.37-0.55 1.09-1.65 1.46-2.2 0.03-0.17 0.11-0.51 0.15-0.68l0.85-1.63c0.07-0.12 0.22-0.37 0.29-0.5l0.76-1.19c0.14-0.19 0.4-0.58 0.54-0.78 0.35-0.56 1.05-1.67 1.4-2.23 0.05-0.16 0.14-0.48 0.19-0.64l0.88-1.65c0.04-0.08 0.12-0.22 0.16-0.3l1.02-1.7204c0.08-0.15 0.26-0.45 0.35-0.6 0.09-0.17 0.27-0.49 0.36-0.65l1-1.78c0.05-0.07 0.13-0.22 0.17-0.29l0.95-1.61c0.03-0.05 0.1-0.16 0.13-0.21z" fill="#0ba25e"/> <path id="#fccd48ff" fill="#fccd48" d="m166.67 0.099552c32.48-0.15 64.97-0.02 97.46-0.07 26.88 0.099998 53.78-0.21 80.65 0.15 0.53 1.02 1.07 2.03 1.64 3.04 0.08 0.13 0.23 0.41 0.31 0.55 2.6 4.53 5.24 9.0404 7.81 13.58 0.05 0.08 0.13 0.23 0.18 0.3 4.98 8.55 9.94 17.11 14.83 25.71 0.04 0.07 0.13 0.21 0.17 0.29 0.89 1.53 1.81 3.06 2.72 4.6 0.08 0.13 0.23 0.4 0.31 0.54 1.25 2.2 2.51 4.39 3.78 6.58 0.05 0.07 0.13 0.21 0.17 0.29 1.27 2.18 2.52 4.38 3.78 6.58 0.08 0.13 0.23 0.39 0.31 0.52 1.27 2.14 2.5 4.3 3.72 6.46 0.08 0.13 0.23 0.4 0.31 0.53 11.94 20.62 23.85 41.25 35.75 61.9-1.36 5.99 1.93 11.95 0.1 17.97-1.11 16.45-7.32 32.46-17.56 45.38-3.33 3.61-0.1 8.62-0.46 12.9-3.59 4.35-8.21 7.6-12.57 11.11 0.01 3.28 0.02 6.56-0.13 9.85-3.89 2.57-8.35 4.06-12.3 6.54-0.42 1.33-0.85 2.67-1.26 4.02-3.17 1.5-6.56 2.47-9.73 3.99-12.55-3.6-24.97-7.61-37.49-11.32-11.65-3.85-23.58-6.87-35.11-11.11l-0.66-1.18c-0.06-0.09-0.16-0.27-0.21-0.36l-0.95-1.61-0.4-0.68c-0.09-0.15-0.25-0.44-0.34-0.59-0.71-1.26-1.36-2.55-1.94-3.87l-0.06-0.13-0.07-0.1c-0.44-0.7-1.33-2.11-1.78-2.81-0.05-0.08-0.15-0.24-0.2-0.33l-0.29-0.46c-0.17-0.29-0.52-0.86-0.69-1.15-0.43-0.73-1.3-2.19-1.73-2.92-0.11-0.18-0.32-0.55-0.43-0.73l-0.61-1.04c-0.08-0.14-0.24-0.41-0.32-0.55l-0.97-1.67c-0.04-0.07-0.13-0.21-0.17-0.29l-1.02-1.75c-0.09-0.16-0.27-0.48-0.36-0.63-0.1-0.18-0.31-0.55-0.41-0.73l-0.83-1.46c-0.1-0.17-0.3-0.53-0.4-0.7l-0.64-1.13c-0.09-0.15-0.26-0.45-0.35-0.6-0.39-0.72-1.18-2.15-1.58-2.87-0.04-0.08-0.14-0.25-0.18-0.33l-0.27-0.47c-0.19-0.28-0.56-0.84-0.75-1.12-0.99-1.66-1.92-3.36-2.81-5.07-0.05-0.08-0.14-0.25-0.18-0.33l-0.26-0.46c-0.19-0.27-0.57-0.81-0.76-1.07-0.44-0.79-1.32-2.37-1.76-3.16-0.05-0.08-0.15-0.25-0.19-0.34l-0.27-0.48c-0.2-0.33-0.59-0.98-0.79-1.31l-0.86-1.45c-0.08-0.14-0.25-0.42-0.34-0.57-0.38-0.66-1.15-1.99-1.54-2.65-0.09-0.15-0.26-0.46-0.35-0.62-0.68-1.13-1.33-2.27-1.97-3.41-0.05-0.09-0.16-0.27-0.21-0.36l-0.95-1.63c-0.1-0.16-0.29-0.48-0.38-0.65-0.09-0.15-0.26-0.45-0.35-0.6l-1.01-1.76c-0.05-0.08-0.14-0.25-0.19-0.33l-0.82-1.47c-0.07-0.12-0.2-0.35-0.27-0.47-0.38-0.67-1.15-2-1.53-2.67-0.08-0.14-0.24-0.41-0.32-0.54-0.62-1.03-1.24-2.07-1.84-3.1-27.73-48.12-55.5-96.21-83.29-144.3-1.74-3.0004-3.32-6.1204-5.45-8.8804l-0.05-0.45005-0.04-0.49z"/> <path d="m166.15 0.60955l0.56-0.02 0.05 0.45005-0.7 0.11 0.09-0.54005z" fill="#089156"/> <path d="m166.76 1.0396c2.13 2.76 3.71 5.88 5.45 8.88 27.79 48.09 55.56 96.18 83.29 144.3-12.84 22.36-25.78 44.67-38.67 67.01-1.73-10.7-4.96-21.08-7.02-31.72-3.19-11.41-4.96-23.16-8.26-34.55-3.8-18.4-8.43-36.64-12.58-54.97-6.33-26.73-12.41-53.52-18.43-80.33-1.4-6.17-3.26-12.28-3.78-18.62z" fill="#089156"/> <path d="m164.39 3.5996c0.03-0.05 0.1-0.16 0.13-0.21-0.03 0.05-0.1 0.16-0.13 0.21z" fill="#089156"/> <path d="m163.27 5.4996c0.05-0.07 0.13-0.22 0.17-0.29-0.04 0.07-0.12 0.22-0.17 0.29z" fill="#089156"/> <path d="m161.91 7.9296c0.09-0.17 0.27-0.49 0.36-0.65-0.09 0.16-0.27 0.48-0.36 0.65z" fill="#089156"/> <path d="m161.56 8.5296c0.08-0.15 0.26-0.45 0.35-0.6-0.09 0.15-0.27 0.45-0.35 0.6z" fill="#089156"/> <path d="m160.38 10.55c0.04-0.08 0.12-0.22 0.16-0.3-0.04 0.08-0.12 0.22-0.16 0.3z" fill="#089156"/> <path d="m159.31 12.84c0.05-0.16 0.14-0.48 0.19-0.64-0.05 0.16-0.14 0.48-0.19 0.64z" fill="#089156"/> <path d="m157.91 15.07c0.35-0.56 1.05-1.67 1.4-2.23-0.35 0.56-1.05 1.67-1.4 2.23z" fill="#089156"/> <path d="m157.37 15.85c0.14-0.19 0.4-0.58 0.54-0.78-0.14 0.2-0.4 0.59-0.54 0.78z" fill="#089156"/> <path d="m156.32 17.54c0.07-0.12 0.22-0.37 0.29-0.5-0.07 0.13-0.22 0.38-0.29 0.5z" fill="#089156"/> <path d="m155.32 19.85c0.03-0.17 0.11-0.51 0.15-0.68-0.04 0.17-0.12 0.51-0.15 0.68z" fill="#089156"/> <path d="m153.86 22.05c0.37-0.55 1.09-1.65 1.46-2.2-0.37 0.55-1.09 1.65-1.46 2.2z" fill="#089156"/> <path d="m153.35 22.82c0.13-0.19 0.39-0.58 0.51-0.77-0.12 0.19-0.38 0.58-0.51 0.77z" fill="#089156"/> <path d="m152.3 24.55c0.06-0.11 0.18-0.32 0.24-0.42-0.06 0.1-0.18 0.31-0.24 0.42z" fill="#089156"/> <path d="m150.94 26.94c0.1-0.17 0.3-0.52 0.4-0.7-0.1 0.18-0.3 0.53-0.4 0.7z" fill="#089156"/> <path d="m150.58 27.56c0.09-0.16 0.27-0.46 0.36-0.62-0.09 0.16-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m149.39 29.56c0.05-0.07 0.14-0.22 0.18-0.3-0.04 0.08-0.13 0.23-0.18 0.3z" fill="#089156"/> <path d="m148.29 31.48c0.04-0.07 0.12-0.21 0.16-0.29-0.04 0.08-0.12 0.22-0.16 0.29z" fill="#089156"/> <path d="m146.9 33.89c0.1-0.16 0.29-0.5 0.39-0.66-0.1 0.16-0.29 0.5-0.39 0.66z" fill="#089156"/> <path d="m146.51 34.56c0.1-0.17 0.29-0.5 0.39-0.67-0.1 0.17-0.29 0.5-0.39 0.67z" fill="#089156"/> <path d="m145.36 36.54c0.03-0.07 0.11-0.2 0.15-0.27-0.04 0.07-0.12 0.2-0.15 0.27z" fill="#089156"/> <path d="m144.32 38.88c0.04-0.17 0.13-0.51 0.17-0.68-0.04 0.17-0.13 0.51-0.17 0.68z" fill="#089156"/> <path d="m142.86 41.11c0.36-0.56 1.09-1.68 1.46-2.23-0.37 0.55-1.1 1.67-1.46 2.23z" fill="#089156"/> <path d="m142.37 41.87c0.12-0.19 0.36-0.57 0.49-0.76-0.13 0.19-0.37 0.57-0.49 0.76z" fill="#089156"/> <path d="m141.11 44.14c0.15-0.29 0.44-0.86 0.58-1.15-0.14 0.29-0.43 0.86-0.58 1.15z" fill="#089156"/> <path d="m140.1 45.99c0.13-0.2 0.38-0.61 0.5-0.81-0.12 0.2-0.37 0.61-0.5 0.81z" fill="#089156"/> <path d="m139.54 46.77c0.14-0.2 0.42-0.58 0.56-0.78-0.14 0.2-0.42 0.58-0.56 0.78z" fill="#089156"/> <path d="m138.38 48.58c0.13-0.2 0.38-0.62 0.5-0.83-0.12 0.21-0.37 0.63-0.5 0.83z" fill="#089156"/> <path d="m137.07 51.17c0.11-0.23 0.34-0.7 0.45-0.93-0.11 0.23-0.34 0.7-0.45 0.93z" fill="#089156"/> <path d="m136.09 53c0.12-0.2 0.37-0.6 0.49-0.8-0.12 0.2-0.37 0.6-0.49 0.8z" fill="#089156"/> <path d="m135.53 53.76c0.14-0.19 0.42-0.57 0.56-0.76-0.14 0.19-0.42 0.57-0.56 0.76z" fill="#089156"/> <path d="m134.2 55.92c0.16-0.3 0.5-0.91 0.67-1.22-0.17 0.31-0.51 0.92-0.67 1.22z" fill="#089156"/> <path d="m133.29 57.86c0.1-0.2 0.28-0.59 0.38-0.79-0.1 0.2-0.28 0.59-0.38 0.79z" fill="#089156"/> <path d="m131.92 60.07c0.34-0.56 1.03-1.66 1.37-2.21-0.34 0.55-1.03 1.65-1.37 2.21z" fill="#089156"/> <path d="m131.37 60.87c0.14-0.2 0.41-0.6 0.55-0.8-0.14 0.2-0.41 0.6-0.55 0.8z" fill="#089156"/> <path d="m130.34 62.58c0.07-0.12 0.21-0.37 0.28-0.49-0.07 0.12-0.21 0.37-0.28 0.49z" fill="#089156"/> <path d="m129.22 64.83c0.06-0.14 0.2-0.42 0.27-0.56-0.07 0.14-0.21 0.42-0.27 0.56z" fill="#089156"/> <path d="m127.8 67.27c0.35-0.61 1.06-1.83 1.42-2.44l0.07 1.17c-0.37 0.32-1.12 0.96-1.49 1.27z" fill="#089156"/> <path d="m127.41 67.82c0.1-0.14 0.29-0.41 0.39-0.55-0.1 0.14-0.29 0.41-0.39 0.55z" fill="#089156"/> <path d="m126.13 70.15c0.18-0.39 0.55-1.17 0.73-1.56-0.18 0.39-0.55 1.17-0.73 1.56z" fill="#089156"/> <path d="m125.09 71.99c0.12-0.2 0.37-0.6 0.5-0.8-0.13 0.2-0.38 0.6-0.5 0.8z" fill="#089156"/> <path d="m124.54 72.77c0.14-0.2 0.41-0.59 0.55-0.78-0.14 0.19-0.41 0.58-0.55 0.78z" fill="#089156"/> <path d="m123.39 74.56c0.12-0.2 0.37-0.61 0.5-0.81-0.13 0.2-0.38 0.61-0.5 0.81z" fill="#089156"/> <path d="m122.19 76.66c0.06-0.1 0.18-0.32 0.24-0.42-0.06 0.1-0.18 0.32-0.24 0.42z" fill="#089156"/> <path d="m121.14 78.55l0.32-0.56-0.32 0.56z" fill="#089156"/> <path d="m119.25 81.78c0.08-0.13 0.24-0.41 0.32-0.55-0.08 0.14-0.24 0.42-0.32 0.55z" fill="#089156"/> <path d="m118.19 83.63c0.09-0.16 0.27-0.47 0.36-0.62-0.09 0.15-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m116.9 85.88c0.11-0.19 0.33-0.58 0.45-0.78-0.12 0.2-0.34 0.59-0.45 0.78z" fill="#089156"/> <path d="m116.5 86.55c0.1-0.16 0.3-0.5 0.4-0.67-0.1 0.17-0.3 0.51-0.4 0.67z" fill="#089156"/> <path d="m115.34 88.51l0.16-0.28-0.16 0.28z" fill="#089156"/> <path d="m114.32 90.88c0.04-0.18 0.11-0.53 0.15-0.7-0.04 0.17-0.11 0.52-0.15 0.7z" fill="#089156"/> <path d="m112.86 93.05c0.36-0.54 1.09-1.63 1.46-2.17-0.37 0.54-1.1 1.63-1.46 2.17z" fill="#089156"/> <path d="m112.34 93.83c0.13-0.19 0.39-0.58 0.52-0.78-0.13 0.2-0.39 0.59-0.52 0.78z" fill="#089156"/> <path d="m111.32 95.49l0.28-0.48-0.28 0.48z" fill="#089156"/> <path d="m109.93 97.96c0.1-0.18 0.3-0.53 0.4-0.71-0.1 0.18-0.3 0.53-0.4 0.71z" fill="#089156"/> <path d="m109.56 98.58c0.09-0.15 0.27-0.47 0.37-0.62-0.1 0.15-0.28 0.47-0.37 0.62z" fill="#089156"/> <path d="m108.4 100.55c0.04-0.07 0.12-0.21 0.17-0.28-0.05 0.07-0.13 0.21-0.17 0.28z" fill="#089156"/> <path d="m107.29 102.46c0.03-0.06 0.1-0.17 0.13-0.23-0.03 0.06-0.1 0.17-0.13 0.23z" fill="#089156"/> <path d="m214.02 225.86c0.17-0.28 0.53-0.84 0.7-1.11-0.17 0.27-0.53 0.83-0.7 1.11z" fill="#089156"/> <path d="m213.58 226.64c0.05-0.08 0.14-0.25 0.18-0.33-0.04 0.08-0.13 0.25-0.18 0.33z" fill="#089156"/> <path d="m211.72 230.02c0.08-0.13 0.23-0.39 0.3-0.52-0.07 0.13-0.22 0.39-0.3 0.52z" fill="#089156"/> <path d="m210.67 231.87c0.08-0.15 0.25-0.44 0.34-0.59-0.09 0.15-0.26 0.44-0.34 0.59z" fill="#089156"/> <path d="m209.66 233.64c0.05-0.08 0.14-0.24 0.18-0.32-0.04 0.08-0.13 0.24-0.18 0.32z" fill="#089156"/> <path d="m208.27 236.07c0.09-0.16 0.27-0.48 0.36-0.63-0.09 0.15-0.27 0.47-0.36 0.63z" fill="#089156"/> <path d="m207.87 236.74c0.1-0.17 0.3-0.5 0.4-0.67-0.1 0.17-0.3 0.5-0.4 0.67z" fill="#089156"/> <path d="m206.54 239.02c0.08-0.13 0.24-0.41 0.32-0.54-0.08 0.13-0.24 0.41-0.32 0.54z" fill="#089156"/> <path d="m205.5 240.8c0.1-0.18 0.32-0.55 0.42-0.73-0.1 0.18-0.32 0.55-0.42 0.73z" fill="#089156"/> <path d="m203.62 244.07c0.07-0.13 0.22-0.38 0.29-0.5-0.07 0.12-0.22 0.37-0.29 0.5z" fill="#089156"/> <path d="m202.56 245.86c0.11-0.19 0.33-0.55 0.43-0.74-0.1 0.19-0.32 0.55-0.43 0.74z" fill="#089156"/> <path d="m200.71 249.06c0.09-0.15 0.26-0.46 0.35-0.61-0.09 0.15-0.26 0.46-0.35 0.61z" fill="#089156"/> <path d="m199.68 250.9c0.07-0.12 0.21-0.37 0.28-0.49-0.07 0.12-0.21 0.37-0.28 0.49z" fill="#089156"/> <path d="m198.59 252.81l0.32-0.56-0.32 0.56z" fill="#089156"/> <path d="m196.66 256.09c0.09-0.16 0.27-0.47 0.36-0.62-0.09 0.15-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m195.69 257.84c0.06-0.12 0.19-0.35 0.26-0.47-0.07 0.12-0.2 0.35-0.26 0.47z" fill="#089156"/> <path d="m194.58 259.76c0.07-0.12 0.22-0.37 0.29-0.5-0.07 0.13-0.22 0.38-0.29 0.5z" fill="#089156"/> <path d="m192.6 263.15c0.08-0.13 0.24-0.39 0.31-0.52-0.07 0.13-0.23 0.39-0.31 0.52z" fill="#089156"/> <path d="m191.59 264.85c0.1-0.18 0.31-0.53 0.41-0.71-0.1 0.18-0.31 0.53-0.41 0.71z" fill="#089156"/> <path d="m189.82 267.94c0.06-0.11 0.2-0.35 0.26-0.46-0.06 0.11-0.2 0.35-0.26 0.46z" fill="#089156"/> <path d="m188.76 269.83c0.06-0.11 0.18-0.32 0.24-0.43-0.06 0.11-0.18 0.32-0.24 0.43z" fill="#089156"/> <path d="m187.64 271.76c0.07-0.11 0.21-0.35 0.28-0.46-0.07 0.11-0.21 0.35-0.28 0.46z" fill="#089156"/> <path d="m185.65 275.09c0.11-0.18 0.31-0.54 0.42-0.71-0.11 0.17-0.31 0.53-0.42 0.71z" fill="#089156"/> <path d="m184.76 276.74c0.07-0.13 0.22-0.41 0.3-0.55-0.08 0.14-0.23 0.42-0.3 0.55z" fill="#089156"/> <path d="m183.39 279.12c0.08-0.15 0.26-0.45 0.34-0.6-0.08 0.15-0.26 0.45-0.34 0.6z" fill="#089156"/> <path d="m183.06 279.69c0.08-0.14 0.24-0.43 0.33-0.57-0.09 0.14-0.25 0.43-0.33 0.57z" fill="#089156"/> <path d="m346.42 3.2196c0.08 0.13 0.23 0.41 0.31 0.55-0.08-0.14-0.23-0.42-0.31-0.55z" fill="#10985b"/> <path d="m354.54 17.35c0.05 0.08 0.13 0.23 0.18 0.3-0.05-0.07-0.13-0.22-0.18-0.3z" fill="#10985b"/> <path d="m369.55 43.36c0.04 0.07 0.13 0.21 0.17 0.29-0.04-0.08-0.13-0.22-0.17-0.29z" fill="#10985b"/> <path d="m372.44 48.25c0.08 0.13 0.23 0.4 0.31 0.54-0.08-0.14-0.23-0.41-0.31-0.54z" fill="#10985b"/> <path d="m376.53 55.37c0.05 0.07 0.13 0.21 0.17 0.29-0.04-0.08-0.12-0.22-0.17-0.29z" fill="#10985b"/> <path d="m380.48 62.24c0.08 0.13 0.23 0.39 0.31 0.52-0.08-0.13-0.23-0.39-0.31-0.52z" fill="#10985b"/> <path d="m384.51 69.22c0.08 0.13 0.23 0.4 0.31 0.53-0.08-0.13-0.23-0.4-0.31-0.53z" fill="#10985b"/> <path d="m420.57 131.65c17.39 30.13 34.89 60.21 52.14 90.43 0.08 0.13 0.24 0.41 0.32 0.54 0.4 0.66 1.2 1.97 1.59 2.62 0.08 0.13 0.24 0.4 0.32 0.53l0.8 1.37c0.05 0.09 0.15 0.28 0.21 0.37l1 1.74c0.1 0.17 0.29 0.52 0.39 0.69 0.09 0.15 0.27 0.46 0.36 0.62l0.98 1.7 0.16 0.28 0.98 1.68c0.04 0.07 0.12 0.2 0.16 0.27l0.98 1.7c0.1 0.17 0.29 0.5 0.39 0.67 0.09 0.17 0.28 0.5 0.37 0.66l1.01 1.78c0.14 0.35 0.42 1.03 0.56 1.37l0.28 0.55 0.13 0.29 0.22 0.29 0.59 0.89c0.21 0.33 0.62 0.99 0.83 1.32 0.12 0.2 0.38 0.6 0.5 0.8l0.66 1.05c0.2 0.45 0.6 1.36 0.8 1.81l0.3 0.54 0.11 0.21 0.09 0.13c0.44 0.65 1.31 1.96 1.75 2.61 0.11 0.18 0.33 0.54 0.45 0.72l0.6 1c0.09 0.16 0.27 0.47 0.36 0.62l1.01 1.77c0.09 0.16 0.27 0.48 0.36 0.64s0.27 0.47 0.36 0.63l1 1.71c0.04 0.08 0.13 0.23 0.18 0.3l0.91 1.6c0.06 0.1 0.18 0.31 0.24 0.41l0.92 1.61c0.11 0.18 0.32 0.55 0.43 0.73 0.09 0.16 0.28 0.48 0.37 0.64 0.74 1.23 1.45 2.48 2.11 3.76 0.1 0.21 0.3 0.63 0.39 0.84l0.46 1.04c0.12 0.2 0.36 0.61 0.47 0.81 0.15 0.2 0.44 0.58 0.59 0.77l0.69 0.98c0.12 0.19 0.36 0.57 0.49 0.77l1.01 1.75c0.09 0.16 0.27 0.48 0.36 0.64s0.27 0.47 0.37 0.63l1 1.72c0.04 0.08 0.12 0.22 0.16 0.29l0.95 1.66c0.04 0.07 0.12 0.2 0.16 0.27l0.97 1.69c0.1 0.17 0.3 0.51 0.4 0.69 0.1 0.17 0.3 0.51 0.39 0.68l1 1.72c0.04 0.07 0.11 0.21 0.15 0.28l1.06 1.98-0.01 0.9c-25.02-7.19-49.64-15.72-74.73-22.65-22.77-7.35-45.75-14.04-68.52-21.35 3.17-1.52 6.56-2.49 9.73-3.99 0.41-1.35 0.84-2.69 1.26-4.02 3.95-2.48 8.41-3.97 12.3-6.54 0.15-3.29 0.14-6.57 0.13-9.85 4.36-3.51 8.98-6.76 12.57-11.11 0.36-4.28-2.87-9.29 0.46-12.9 10.24-12.92 16.45-28.93 17.56-45.38 1.83-6.02-1.46-11.98-0.1-17.97z" fill="#f9c941"/> <path d="m509.91 287.41l0.52 0.02 0.29 0.76-0.59 0.04-0.22-0.82z" fill="#f9c941"/> <path d="m257.34 157.32c0.08 0.13 0.24 0.4 0.32 0.54-0.08-0.14-0.24-0.41-0.32-0.54z" fill="#e3b73a"/> <path d="m259.19 160.53c0.07 0.12 0.2 0.35 0.27 0.47-0.07-0.12-0.2-0.35-0.27-0.47z" fill="#e3b73a"/> <path d="m260.28 162.47c0.05 0.08 0.14 0.25 0.19 0.33-0.05-0.08-0.14-0.25-0.19-0.33z" fill="#e3b73a"/> <path d="m261.48 164.56c0.09 0.15 0.26 0.45 0.35 0.6-0.09-0.15-0.26-0.45-0.35-0.6z" fill="#e3b73a"/> <path d="m261.83 165.16c0.09 0.17 0.28 0.49 0.38 0.65-0.1-0.16-0.29-0.48-0.38-0.65z" fill="#e3b73a"/> <path d="m263.16 167.44c0.05 0.09 0.16 0.27 0.21 0.36-0.05-0.09-0.16-0.27-0.21-0.36z" fill="#e3b73a"/> <path d="m265.34 171.21c0.09 0.16 0.26 0.47 0.35 0.62-0.09-0.15-0.26-0.46-0.35-0.62z" fill="#e3b73a"/> <path d="m267.23 174.48c0.09 0.15 0.26 0.43 0.34 0.57-0.08-0.14-0.25-0.42-0.34-0.57z" fill="#e3b73a"/> <path d="m268.43 176.5c0.2 0.33 0.59 0.98 0.79 1.31-0.2-0.33-0.59-0.98-0.79-1.31z" fill="#e3b73a"/> <path d="m269.49 178.29c0.04 0.09 0.14 0.26 0.19 0.34-0.05-0.08-0.15-0.25-0.19-0.34z" fill="#e3b73a"/> <path d="m271.44 181.79c0.19 0.26 0.57 0.8 0.76 1.07-0.19-0.27-0.57-0.81-0.76-1.07z" fill="#e3b73a"/> <path d="m272.46 183.32c0.04 0.08 0.13 0.25 0.18 0.33-0.05-0.08-0.14-0.25-0.18-0.33z" fill="#e3b73a"/> <path d="m275.45 188.72c0.19 0.28 0.56 0.84 0.75 1.12-0.19-0.28-0.56-0.84-0.75-1.12z" fill="#e3b73a"/> <path d="m276.47 190.31c0.04 0.08 0.14 0.25 0.18 0.33-0.04-0.08-0.14-0.25-0.18-0.33z" fill="#e3b73a"/> <path d="m278.23 193.51c0.09 0.15 0.26 0.45 0.35 0.6-0.09-0.15-0.26-0.45-0.35-0.6z" fill="#e3b73a"/> <path d="m279.22 195.24c0.1 0.17 0.3 0.53 0.4 0.7-0.1-0.17-0.3-0.53-0.4-0.7z" fill="#e3b73a"/> <path d="m280.45 197.4c0.1 0.18 0.31 0.55 0.41 0.73-0.1-0.18-0.31-0.55-0.41-0.73z" fill="#e3b73a"/> <path d="m280.86 198.13c0.09 0.15 0.27 0.47 0.36 0.63-0.09-0.16-0.27-0.48-0.36-0.63z" fill="#e3b73a"/> <path d="m282.24 200.51c0.04 0.08 0.13 0.22 0.17 0.29-0.04-0.07-0.13-0.21-0.17-0.29z" fill="#e3b73a"/> <path d="m283.38 202.47c0.08 0.14 0.24 0.41 0.32 0.55-0.08-0.14-0.24-0.41-0.32-0.55z" fill="#e3b73a"/> <path d="m284.31 204.06c0.11 0.18 0.32 0.55 0.43 0.73-0.11-0.18-0.32-0.55-0.43-0.73z" fill="#e3b73a"/> <path d="m286.47 207.71c0.17 0.29 0.52 0.86 0.69 1.15-0.17-0.29-0.52-0.86-0.69-1.15z" fill="#e3b73a"/> <path d="m287.45 209.32c0.05 0.09 0.15 0.25 0.2 0.33-0.05-0.08-0.15-0.24-0.2-0.33z" fill="#e3b73a"/> <path d="m289.43 212.46l0.07 0.1 0.06 0.13c-0.03-0.06-0.1-0.17-0.13-0.23z" fill="#e3b73a"/> <path d="m291.5 216.56c0.09 0.15 0.25 0.44 0.34 0.59-0.09-0.15-0.25-0.44-0.34-0.59z" fill="#e3b73a"/> <path d="m291.84 217.15l0.4 0.68-0.4-0.68z" fill="#e3b73a"/> <path d="m293.19 219.44c0.05 0.09 0.15 0.27 0.21 0.36-0.06-0.09-0.16-0.27-0.21-0.36z" fill="#e3b73a"/> <path d="m294.06 220.98c11.53 4.24 23.46 7.26 35.11 11.11 12.52 3.71 24.94 7.72 37.49 11.32 22.77 7.31 45.75 14 68.52 21.35-0.34 4.87 0.62 9.86-0.59 14.64-0.93 4.65-6.49 5.38-8.78 9.09-30.77 0.01-61.53 0.1-92.29-0.03l-0.66-0.05c-12.71-22.6-25.93-44.92-38.8-67.43z" fill="#e3b73a"/> <path d="m472.71 222.08c0.08 0.13 0.24 0.41 0.32 0.54-0.08-0.13-0.24-0.41-0.32-0.54z" fill="#e8b835"/> <path d="m474.62 225.24c0.08 0.13 0.24 0.4 0.32 0.53-0.08-0.13-0.24-0.4-0.32-0.53z" fill="#e8b835"/> <path d="m475.74 227.14c0.05 0.09 0.15 0.28 0.21 0.37-0.06-0.09-0.16-0.28-0.21-0.37z" fill="#e8b835"/> <path d="m476.95 229.25c0.1 0.17 0.29 0.52 0.39 0.69-0.1-0.17-0.29-0.52-0.39-0.69z" fill="#e8b835"/> <path d="m477.34 229.94c0.09 0.15 0.27 0.46 0.36 0.62-0.09-0.16-0.27-0.47-0.36-0.62z" fill="#e8b835"/> <path d="m478.68 232.26l0.16 0.28-0.16-0.28z" fill="#e8b835"/> <path d="m479.82 234.22c0.04 0.07 0.12 0.2 0.16 0.27-0.04-0.07-0.12-0.2-0.16-0.27z" fill="#e8b835"/> <path d="m480.96 236.19c0.1 0.17 0.29 0.5 0.39 0.67-0.1-0.17-0.29-0.5-0.39-0.67z" fill="#e8b835"/> <path d="m481.35 236.86c0.09 0.17 0.28 0.5 0.37 0.66-0.09-0.16-0.28-0.49-0.37-0.66z" fill="#e8b835"/> <path d="m482.73 239.3c0.14 0.35 0.42 1.03 0.56 1.37-0.14-0.34-0.42-1.02-0.56-1.37z" fill="#e8b835"/> <path d="m483.57 241.22c0.09 0.15 0.26 0.44 0.35 0.58l-0.22-0.29-0.13-0.29z" fill="#e8b835"/> <path d="m484.51 242.69c0.21 0.33 0.62 0.99 0.83 1.32-0.21-0.33-0.62-0.99-0.83-1.32z" fill="#e8b835"/> <path d="m485.34 244.01c0.12 0.2 0.38 0.6 0.5 0.8-0.12-0.2-0.38-0.6-0.5-0.8z" fill="#e8b835"/> <path d="m486.5 245.86c0.2 0.45 0.6 1.36 0.8 1.81-0.2-0.45-0.6-1.36-0.8-1.81z" fill="#e8b835"/> <path d="m487.6 248.21c0.05 0.09 0.15 0.26 0.2 0.34l-0.09-0.13-0.11-0.21z" fill="#e8b835"/> <path d="m489.55 251.16c0.11 0.18 0.33 0.54 0.45 0.72-0.12-0.18-0.34-0.54-0.45-0.72z" fill="#e8b835"/> <path d="m490.6 252.88c0.09 0.16 0.27 0.47 0.36 0.62-0.09-0.15-0.27-0.46-0.36-0.62z" fill="#e8b835"/> <path d="m491.97 255.27c0.09 0.16 0.27 0.48 0.36 0.64-0.09-0.16-0.27-0.48-0.36-0.64z" fill="#e8b835"/> <path d="m492.33 255.91c0.09 0.16 0.27 0.47 0.36 0.63-0.09-0.16-0.27-0.47-0.36-0.63z" fill="#e8b835"/> <path d="m493.69 258.25c0.04 0.08 0.13 0.23 0.18 0.3-0.05-0.07-0.14-0.22-0.18-0.3z" fill="#e8b835"/> <path d="m494.78 260.15c0.06 0.1 0.18 0.31 0.24 0.41-0.06-0.1-0.18-0.31-0.24-0.41z" fill="#e8b835"/> <path d="m495.94 262.17c0.11 0.18 0.32 0.55 0.43 0.73-0.11-0.18-0.32-0.55-0.43-0.73z" fill="#e8b835"/> <path d="m496.37 262.9c0.09 0.16 0.28 0.48 0.37 0.64-0.09-0.16-0.28-0.48-0.37-0.64z" fill="#e8b835"/> <path d="m435.18 264.76c25.09 6.93 49.71 15.46 74.73 22.65l0.22 0.82c-28.09 0.64-56.22 0.11-84.32 0.26 2.29-3.71 7.85-4.44 8.78-9.09 1.21-4.78 0.25-9.77 0.59-14.64z" fill="#e8b835"/> <path d="m498.85 267.3c0.1 0.21 0.3 0.63 0.39 0.84-0.09-0.21-0.29-0.63-0.39-0.84z" fill="#e8b835"/> <path d="m499.7 269.18c0.12 0.2 0.36 0.61 0.47 0.81-0.11-0.2-0.35-0.61-0.47-0.81z" fill="#e8b835"/> <path d="m500.17 269.99c0.15 0.2 0.44 0.58 0.59 0.77-0.15-0.19-0.44-0.57-0.59-0.77z" fill="#e8b835"/> <path d="m501.45 271.74c0.12 0.19 0.36 0.57 0.49 0.77-0.13-0.2-0.37-0.58-0.49-0.77z" fill="#e8b835"/> <path d="m502.95 274.26c0.09 0.16 0.27 0.48 0.36 0.64-0.09-0.16-0.27-0.48-0.36-0.64z" fill="#e8b835"/> <path d="m503.31 274.9c0.09 0.16 0.27 0.47 0.37 0.63-0.1-0.16-0.28-0.47-0.37-0.63z" fill="#e8b835"/> <path d="m504.68 277.25c0.04 0.08 0.12 0.22 0.16 0.29-0.04-0.07-0.12-0.21-0.16-0.29z" fill="#e8b835"/> <path d="m505.79 279.2c0.04 0.07 0.12 0.2 0.16 0.27-0.04-0.07-0.12-0.2-0.16-0.27z" fill="#e8b835"/> <path d="m506.92 281.16c0.1 0.17 0.3 0.51 0.4 0.69-0.1-0.18-0.3-0.52-0.4-0.69z" fill="#e8b835"/> <path d="m507.32 281.85c0.1 0.17 0.3 0.51 0.39 0.68-0.09-0.17-0.29-0.51-0.39-0.68z" fill="#e8b835"/> <path d="m508.71 284.25c0.04 0.07 0.11 0.21 0.15 0.28-0.04-0.07-0.11-0.21-0.15-0.28z" fill="#e8b835"/> <path d="m509.92 286.51c0.13 0.23 0.38 0.69 0.51 0.92l-0.52-0.02 0.01-0.9z" fill="#e8b835"/> <path d="m147.21 341.08c10.31-17.58 20.11-35.49 30.76-52.86 51.63 0.19 103.27-0.29 154.89 0.19l0.66 0.05c-26.11 0.84-52.29-0.22-78.4 0.44-4.98 3.21-8.3 8.41-13.07 11.91-4.43 3.23-7.69 7.73-11.92 11.18-5.93 4.37-10.34 10.43-16.36 14.71-6.96 7.37-14.99 13.58-22.01 20.91-5.26 4.04-9.66 9.03-14.56 13.48-5.39 3.91-9.52 9.21-14.56 13.53-0.13 0.11-0.38 0.33-0.51 0.45-0.27 0.21-0.8 0.65-1.07 0.86-0.13 0.11-0.37 0.31-0.5 0.42-3.97 3.07-7.01 7.12-10.91 10.27-0.13 0.11-0.38 0.32-0.5 0.42-0.13 0.11-0.38 0.32-0.51 0.42-5.69 4.67-10.25 10.58-16.22 14.93-6.01 5.96-12.79 11.08-18.5 17.36-8.44 6.94-15.74 15.13-24.44 21.78 2.16-4.71 5.02-9.03 7.53-13.54 16.74-28.97 33.46-57.94 50.2-86.91z" fill="#296ad9"/> <path d="m89.04 442.17c0.11-0.16 0.33-0.48 0.44-0.64l-0.03 0.65-0.41-0.01z" fill="#296ad9"/> <path id="#2a71e9ff" fill="#2a71e9" d="m333.52 288.46c30.76 0.13 61.52 0.04 92.29 0.03 28.1-0.15 56.23 0.38 84.32-0.26l0.59-0.04 0.4 0.11v0.08c-29.66 51.27-59.23 102.6-88.89 153.88-110.93-0.03-221.86 0.1-332.78-0.08l0.03-0.65c8.7-6.65 16-14.84 24.44-21.78 5.71-6.28 12.49-11.4 18.5-17.36 5.97-4.35 10.53-10.26 16.22-14.93 0.13-0.1 0.38-0.31 0.51-0.42 0.12-0.1 0.37-0.31 0.5-0.42 3.9-3.15 6.94-7.2 10.91-10.27 0.13-0.11 0.37-0.31 0.5-0.42 0.27-0.21 0.8-0.65 1.07-0.86 0.13-0.12 0.38-0.34 0.51-0.45 5.04-4.32 9.17-9.62 14.56-13.53 4.9-4.45 9.3-9.44 14.56-13.48 7.02-7.33 15.05-13.54 22.01-20.91 6.02-4.28 10.43-10.34 16.36-14.71 4.23-3.45 7.49-7.95 11.92-11.18 4.77-3.5 8.09-8.7 13.07-11.91 26.11-0.66 52.29 0.4 78.4-0.44z"/> <path d="m162.13 375.07c0.13-0.12 0.38-0.34 0.51-0.45-0.13 0.11-0.38 0.33-0.51 0.45z" fill="#286ee6"/> <path d="m161.06 375.93c0.27-0.21 0.8-0.65 1.07-0.86-0.27 0.21-0.8 0.65-1.07 0.86z" fill="#286ee6"/> <path d="m160.56 376.35c0.13-0.11 0.37-0.31 0.5-0.42-0.13 0.11-0.37 0.31-0.5 0.42z" fill="#286ee6"/> <path d="m149.15 387.04c0.12-0.1 0.37-0.31 0.5-0.42-0.13 0.11-0.38 0.32-0.5 0.42z" fill="#286ee6"/> <path d="m148.64 387.46c0.13-0.1 0.38-0.31 0.51-0.42-0.13 0.11-0.38 0.32-0.51 0.42z" fill="#286ee6"/> </svg> <div>Google Drive</div> </button> </div> </div> </div> <div class="rs-box rs-box-sign-in" aria-hidden="true"> <div class="rs-content"> <form name="rs-sign-in-form" class="rs-sign-in-form"> <h1 class="rs-big-headline">Connect your storage</h1> <input type="text" name="rs-user-address" placeholder="user@provider.com" autocapitalize="off"> <div class="rs-sign-in-error rs-hidden"></div> <button type="submit" class="rs-connect">Connect</button> <a href="https://remotestorage.io/get/" class="rs-help" target="_blank" rel="noopener">Need help?</a> </form> </div> </div> </div> ';var t=document.createElement("style");return t.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',e.appendChild(t),e}},{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 e=this;this.rs.on("connected",function(){return e.eventHandler("connected")}),this.rs.on("ready",function(){return e.eventHandler("ready")}),this.rs.on("disconnected",function(){return e.eventHandler("disconnected")}),this.rs.on("network-online",function(){return e.eventHandler("network-online")}),this.rs.on("network-offline",function(){return e.eventHandler("network-offline")}),this.rs.on("error",function(t){return e.eventHandler("error",t)}),this.setEventListeners(),this.setClickHandlers()}},{key:"attach",value:function(e){var t=this.createHtmlTemplate(e);if(this.parentContainerEl,e instanceof HTMLElement)this.parentContainerEl=e;else if("string"==typeof e){if(this.parentContainerEl=document.getElementById(e),!this.parentContainerEl)throw new Error('Failed to find target DOM element with id="'+e+'"')}else{if(e)throw new Error("Unknown element type. Expected instance of HTMLElement or type of string.");this.parentContainerEl=document.body}this.parentContainerEl.appendChild(t),this.setupElements(),this.setupHandlers(),this.setInitialState(),this.setModalClass()}},{key:"setEventListeners",value:function(){var e=this;this.rsSignInForm.addEventListener("submit",function(t){t.preventDefault();var r=e.parentContainerEl.querySelector("input[name=rs-user-address]").value.trim();e.disableConnectButton(),e.rs.connect(r)})}},{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 e=this;this.rsInitial.addEventListener("click",function(){return e.showChooseOrSignIn()}),this.rsChooseRemoteStorageButton.addEventListener("click",function(){e.setState("sign-in"),e.rsAddressInput.focus()}),this.rsChooseDropboxButton.addEventListener("click",function(){return e.rs.dropbox.connect()}),this.rsChooseGoogleDriveButton.addEventListener("click",function(){return e.rs.googledrive.connect()}),this.rsDisconnectButton.addEventListener("click",function(){return e.rs.disconnect()}),this.rsErrorReconnectLink.addEventListener("click",function(){return e.rs.reconnect()}),this.rsErrorDisconnectButton.addEventListener("click",function(){return e.rs.disconnect()}),this.rs.hasFeature("Sync")&&this.rsSyncButton.addEventListener("click",function(){e.rsSyncButton.classList.contains("rs-rotate")?(e.rs.stopSync(),e.rsSyncButton.classList.remove("rs-rotate")):(e.rsConnectedLabel.textContent="Synchronizing",e.rs.startSync(),e.rsSyncButton.classList.add("rs-rotate"))}),document.addEventListener("click",function(){return e.close()}),this.rsWidget.addEventListener("click",function(e){return e.stopPropagation()}),this.rsLogo.addEventListener("click",function(){return e.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 e=this.parentContainerEl.querySelector(".rs-box.rs-selected");e&&e.setAttribute("aria-hidden","false")}},{key:"close",value:function(){var e=this;if("error"!==this.state){if(!this.leaveOpen&&this.active){this.closed=!0,this.rsWidget.classList.add("rs-closed");var t=this.parentContainerEl.querySelector(".rs-box.rs-selected");t&&t.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(){e.rsBackdrop.style.display="none"},300))}}},{key:"disableConnectButton",value:function(){this.rsConnectButton.disabled=!0,this.rsConnectButton.classList.add("rs-connecting"),this.rsConnectButton.innerHTML="Connecting ".concat('<svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#fff">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity=".5" cx="18" cy="18" r="18"/>\n <path d="M36 18c0-9.94-8.06-18-18-18"></path>\n </g>\n </g>\n</svg>\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(e){this.rsWidget.classList.remove("rs-backend-remotestorage"),this.rsWidget.classList.remove("rs-backend-dropbox"),this.rsWidget.classList.remove("rs-backend-googledrive"),e&&this.rsWidget.classList.add("rs-backend-".concat(e))}},{key:"showErrorBox",value:function(e){this.rsErrorBox.innerHTML=e,this.setState("error")}},{key:"hideErrorBox",value:function(){this.rsErrorBox.innerHTML="",this.close()}},{key:"handleSyncStarted",value:function(){var e=this;this.syncInProgress=!0,this.rsSyncButton.classList.add("rs-rotate"),setTimeout(function(){e.syncInProgress&&(e.rsConnectedLabel.textContent="Synchronizing")},1e3)}},{key:"handleDiscoveryError",value:function(e){var t=this.parentContainerEl.querySelector(".rs-sign-in-error");t.innerHTML=e.message,t.classList.remove("rs-hidden"),t.classList.add("rs-visible"),this.enableConnectButton()}},{key:"handleSyncError",value:function(){this.setOffline()}},{key:"handleUnauthorized",value:function(e){e.code&&"access_denied"===e.code?this.rs.disconnect():(this.open(),this.showErrorBox(e.message+" "),this.rsErrorBox.appendChild(this.rsErrorReconnectLink),this.rsErrorReconnectLink.classList.remove("rs-hidden"))}},{key:"updateLastSyncedStatus",value:function(){var e=new Date;this.online?(this.lastSynced=e,this.rsConnectedLabel.textContent="Synced"):this.rsWidget.classList.contains("rs-state-unauthorized")||(this.rsConnectedLabel.textContent="Offline")}},{key:"isSmallScreen",value:function(){return window.innerWidth<421}}],t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return t.default})(),"object"==typeof e&&"object"==typeof t?t.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof e?e.Widget=n():r.Widget=n()}),import_widget=__toESM(require_widget(),1),registeredDebounces=new WeakMap;function debounceTask(e,t,...r){if(assert$4(`Called \`debounceTask\` without a string as the first argument on ${e}.`,"string"==typeof t),assert$4(`Called \`destroyable.debounceTask('${t}', ...)\` where 'destroyable.${t}' is not a function.`,"function"==typeof e[t]),e.isDestroying)return;const n=r[r.length-1],i="boolean"==typeof n?r[r.length-2]:n;assert$4(`Called \`debounceTask\` with incorrect \`spacing\` argument. Expected Number and received \`${i}\``,"number"==typeof i);let o,s=registeredDebounces.get(e);s||(s=new Map,registeredDebounces.set(e,s),registerDestructor(e,getDebouncesDisposable(s))),o=s.has(t)?s.get(t).debouncedTask:(...r)=>{s.delete(t),e[t](...r)};let a=debounce(e,o,...r);s.set(t,{debouncedTask:o,cancelId:a})}function getDebouncesDisposable(e){return function(){0!==e.size&&e.forEach(e=>cancel(e.cancelId))}}var storage_exports=__exportAll({default:()=>StorageService}),StorageService=class extends Service{static{decorateFieldV2(this.prototype,"osm",[service])}#pe=void initializeDeferredDecorator(this,"osm");static{decorateFieldV2(this.prototype,"toast",[service])}#fe=void initializeDeferredDecorator(this,"toast");rs;widget;static{decorateFieldV2(this.prototype,"placesInView",[tracked],function(){return[]})}#ge=void initializeDeferredDecorator(this,"placesInView");static{decorateFieldV2(this.prototype,"savedPlaces",[tracked],function(){return[]})}#me=void initializeDeferredDecorator(this,"savedPlaces");static{decorateFieldV2(this.prototype,"loadedPrefixes",[tracked],function(){return[]})}#ye=void initializeDeferredDecorator(this,"loadedPrefixes");static{decorateFieldV2(this.prototype,"currentBbox",[tracked],function(){return null})}#ve=void initializeDeferredDecorator(this,"currentBbox");static{decorateFieldV2(this.prototype,"lists",[tracked],function(){return[]})}#_e=void initializeDeferredDecorator(this,"lists");static{decorateFieldV2(this.prototype,"version",[tracked],function(){return 0})}#be=void initializeDeferredDecorator(this,"version");static{decorateFieldV2(this.prototype,"initialSyncDone",[tracked],function(){return!1})}#Ee=void initializeDeferredDecorator(this,"initialSyncDone");static{decorateFieldV2(this.prototype,"connected",[tracked],function(){return!1})}#we=void initializeDeferredDecorator(this,"connected");static{decorateFieldV2(this.prototype,"userAddress",[tracked],function(){return null})}#Ce=void initializeDeferredDecorator(this,"userAddress");static{decorateFieldV2(this.prototype,"isWidgetOpen",[tracked],function(){return!1})}#Se=void initializeDeferredDecorator(this,"isWidgetOpen");isNewConnection=!0;constructor(){super(...arguments),this.checkInitialConnectionState(),this.rs=new import_remotestorage.default({modules:[places_default]}),this.rs.access.claim("places","rw"),this.rs.caching.enable("/places/"),window.remoteStorage=this.rs,this.widget=new import_widget.default(this.rs,{leaveOpen:!0,skipInitial:!0}),this.rs.on("ready",()=>{}),this.rs.on("error",e=>{e&&(console.info("[rs] Error —",`${e.name}: ${e.message}`),"Unauthorized"===e.name&&this.showConnectWidget())}),this.rs.on("connected",()=>{this.connected=!0,this.userAddress=this.rs.remote.userAddress,this.isNewConnection&&(this.toast.show("Remote storage connected",3e3),this.isNewConnection=!1),this.loadLists()}),this.rs.on("not-connected",()=>{this.loadLists()}),this.rs.on("disconnected",()=>{this.connected=!1,this.userAddress=null,this.placesInView=[],this.savedPlaces=[],this.loadedPrefixes=[],this.lists=[],this.initialSyncDone=!1,this.isNewConnection=!0}),this.rs.on("sync-done",()=>{this.initialSyncDone||(this.initialSyncDone=!0,this.loadLists())}),this.rs.scope("/places/").on("change",e=>{e.relativePath.startsWith("_lists/")?this.loadLists():(this.handlePlaceChange(e),debounceTask(this,"reloadCurrentView",200))})}checkInitialConnectionState(){this.isNewConnection=!0;try{if(window.localStorage)for(const e of["remotestorage:wireclient","remotestorage:dropbox","remotestorage:googledrive"]){const t=window.localStorage.getItem(e);if(t){const e=JSON.parse(t);if(e&&e.token){this.isNewConnection=!1;break}}}}catch(e){console.warn("Failed to check localStorage for existing connection:",e)}}handlePlaceChange(e){const{newValue:t,relativePath:r}=e,n=r.split("/"),i=n[n.length-1];if(t){const e={...t,id:i},r=this.savedPlaces.findIndex(e=>e.id===i);if(-1!==r){const t=[...this.savedPlaces];t[r]=e,this.savedPlaces=t}else this.savedPlaces=[...this.savedPlaces,e]}else this.savedPlaces=this.savedPlaces.filter(e=>e.id!==i)}get places(){return this.rs.places}notifyChange(){this.version++,debounceTask(this,"reloadCurrentView",200)}reloadCurrentView(){if(!this.currentBbox)return;const e=getGeohashPrefixesInBbox(this.currentBbox);console.debug("Reloading view due to changes, prefixes:",e),this.loadAllPlaces(e)}async loadLists(){try{if(!this.places.lists)return;await this.places.lists.initDefaults();const e=await this.places.lists.getAll();this.lists=e||[],this.lists.forEach(e=>{"to-go"===e.id?e.icon="bookmark":"to-do"===e.id&&(e.icon="check-square")}),this.refreshPlaceListAssociations()}catch(e){console.error("Failed to load lists:",e)}}refreshPlaceListAssociations(){const e=new Map;this.lists.forEach(t=>{t.placeRefs&&Array.isArray(t.placeRefs)&&t.placeRefs.forEach(r=>{r.id&&(e.has(r.id)||e.set(r.id,[]),e.get(r.id).push(t.id))})});const t=t=>(t._listIds=e.get(t.id)||[],t);this.savedPlaces=this.savedPlaces.map(e=>t({...e})),this.placesInView=this.placesInView.map(e=>t({...e}))}async togglePlaceList(e,t,r){if(!e)return;let n=e;if(!e.id||!e.geohash){if(!r)return;n=await this.storePlace(e)}try{return r?await this.places.lists.addPlace(t,n.id,n.geohash):await this.places.lists.removePlace(t,n.id),await this.loadLists(),this.findPlaceById(n.id)}catch(i){throw console.error("Failed to toggle place in list:",i),i}}async getPlacesInList(e){return this.places&&this.places.lists?this.places.lists.getPlaces(e):[]}async loadPlacesInBounds(e){const t=getGeohashPrefixesInBbox(e).filter(e=>!this.loadedPrefixes.includes(e));0!==t.length&&(console.debug("Loading new prefixes:",t),await this.loadAllPlaces(t),this.loadedPrefixes=[...this.loadedPrefixes,...t],this.currentBbox=e)}async loadAllPlaces(e=null){try{const t=await this.places.getPlaces(e);if(t&&Array.isArray(t)){if(e){const r=new Set(e),n=this.placesInView.filter(e=>{if(!e.lat||!e.lon)return!1;try{const t=Geohash.encode(e.lat,e.lon,4);return!r.has(t)}catch{return!0}});this.placesInView=[...n,...t]}else this.placesInView=t;this.refreshPlaceListAssociations()}else e||(this.placesInView=[]);console.debug("Loaded saved places:",this.placesInView.length)}catch(t){console.error("Failed to load places:",t)}}findPlaceById(e){if(!e)return;const t=String(e);let r=this.savedPlaces.find(e=>e.id&&String(e.id)===t);return r||(r=this.placesInView.find(e=>e.id&&String(e.id)===t),r||(r=this.savedPlaces.find(e=>e.osmId&&String(e.osmId)===t),r||(r=this.placesInView.find(e=>e.osmId&&String(e.osmId)===t),r)))}isPlaceSaved(e){return!!this.findPlaceById(e)}async storePlace(e){const t=await this.places.store(e);return this.savedPlaces.some(e=>e.id===t.id)?this.savedPlaces=this.savedPlaces.map(e=>e.id===t.id?t:e):this.savedPlaces=[...this.savedPlaces,t],this.placesInView.some(e=>e.id===t.id)?this.placesInView=this.placesInView.map(e=>e.id===t.id?t:e):this.placesInView=[...this.placesInView,t],t}async updatePlace(e){const t=await this.places.store(e),r=this.savedPlaces.findIndex(e=>e.id===t.id);if(-1!==r){const e=[...this.savedPlaces];e[r]=t,this.savedPlaces=e}return this.placesInView=this.placesInView.map(e=>e.id===t.id?t:e),t}async removePlace(e){await this.places.remove(e.id,e.geohash),this.savedPlaces=this.savedPlaces.filter(t=>t.id!==e.id),this.placesInView.length>0&&(this.placesInView=this.placesInView.filter(t=>t.id!==e.id))}async refreshPlace(e){if(!(e&&e.id&&e.osmId&&e.osmType))return null;try{console.debug(`Checking for updates for ${e.title} (${e.osmId})`);const t=await this.osm.fetchOsmObject(e.osmId,e.osmType);if(!t)return console.warn("Could not fetch fresh data for",e.osmId),null;let r=!1;const n={},i=Math.abs(e.lat-t.lat),o=Math.abs(e.lon-t.lon);(i>1e-5||o>1e-5)&&(r=!0,n.lat=t.lat,n.lon=t.lon);const s=e.osmTags||{},a=t.osmTags||{},l=new Set([...Object.keys(s),...Object.keys(a)]);for(const e of l)if(s[e]!==a[e]){r=!0,n.osmTags=a;break}if(!r)return console.debug("No changes detected for",e.title),null;console.debug("Changes detected:",n);const c={...e,...n},u=getLocalizedName(s),h=getLocalizedName(a);return e.title===u&&u!==h&&(c.title=h),await this.updatePlace(c)}catch(t){return console.error("Failed to refresh place:",t),null}}showConnectWidget(){this.isWidgetOpen=!0,document.querySelector(".rs-widget")||this.widget.attach("rs-widget-container")}static{decorateMethodV2(this.prototype,"showConnectWidget",[action])}closeWidget(){this.isWidgetOpen=!1}static{decorateMethodV2(this.prototype,"closeWidget",[action])}disconnect(){this.rs.disconnect(),this.isWidgetOpen=!1}static{decorateMethodV2(this.prototype,"disconnect",[action])}},toast_exports=__exportAll({default:()=>ToastService}),ToastService=class extends Service{static{decorateFieldV2(this.prototype,"message",[tracked],function(){return null})}#Te=void initializeDeferredDecorator(this,"message");static{decorateFieldV2(this.prototype,"isVisible",[tracked],function(){return!1})}#xe=void initializeDeferredDecorator(this,"isVisible");timeoutId=null;show(e,t=3e3){this.message=e,this.isVisible=!0,this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isVisible=!1},t)}},geo_exports=__exportAll({getDistance:()=>getDistance$1});function getDistance$1(e,t,r,n){const i=e*Math.PI/180,o=r*Math.PI/180,s=(r-e)*Math.PI/180,a=(n-t)*Math.PI/180,l=Math.sin(s/2)*Math.sin(s/2)+Math.cos(i)*Math.cos(o)*Math.sin(a/2)*Math.sin(a/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}var activity_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-activity"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg>',arrow_left_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',bookmark_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bookmark"><path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"></path></svg>',camera_default$1='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-camera"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path><circle cx="12" cy="13" r="4"></circle></svg>',check_square_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-square"><polyline points="9 11 12 14 22 4"></polyline><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg>',chevron_left_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-left"><polyline points="15 18 9 12 15 6"></polyline></svg>',chevron_right_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>',alert_triangle_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-triangle"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',clock_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>',database_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-database"><ellipse cx="12" cy="5" rx="9" ry="3"></ellipse><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"></path><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path></svg>',edit_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>',facebook_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-facebook"><path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"></path></svg>',gift_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-gift"><polyline points="20 12 20 22 4 22 4 12"></polyline><rect x="2" y="7" width="20" height="5"></rect><line x1="12" y1="22" x2="12" y2="7"></line><path d="M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z"></path><path d="M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z"></path></svg>',globe_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-globe"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>',heart_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-heart"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path></svg>',home_default$1='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>',info_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-info"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>',instagram_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-instagram"><rect x="2" y="2" width="20" height="20" rx="5" ry="5"></rect><path d="M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"></path><line x1="17.5" y1="6.5" x2="17.51" y2="6.5"></line></svg>',log_in_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-in"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"></path><polyline points="10 17 15 12 10 7"></polyline><line x1="15" y1="12" x2="3" y2="12"></line></svg>',log_out_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>',mail_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-mail"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>',map_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-map"><polygon points="1 6 1 22 8 18 16 22 23 18 23 2 16 6 8 2 1 6"></polygon><line x1="8" y1="2" x2="8" y2="18"></line><line x1="16" y1="6" x2="16" y2="22"></line></svg>',map_pin_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-map-pin"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>',menu_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>',more_horizontal_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-more-horizontal"><circle cx="12" cy="12" r="1"></circle><circle cx="19" cy="12" r="1"></circle><circle cx="5" cy="12" r="1"></circle></svg>',more_vertical_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-more-vertical"><circle cx="12" cy="12" r="1"></circle><circle cx="12" cy="5" r="1"></circle><circle cx="12" cy="19" r="1"></circle></svg>',navigation_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-navigation"><polygon points="3 11 22 2 13 21 11 13 3 11"></polygon></svg>',phone_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-phone"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"></path></svg>',plus_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>',search_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',server_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-server"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>',settings_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>',target_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-target"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="6"></circle><circle cx="12" cy="12" r="2"></circle></svg>',trash_2_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash-2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>',upload_cloud_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-upload-cloud"><polyline points="16 16 12 12 8 16"></polyline><line x1="12" y1="12" x2="12" y2="21"></line><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"></path><polyline points="16 16 12 12 8 16"></polyline></svg>',user_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>',x_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',check_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><polyline points="20 6 9 17 4 12"></polyline></svg>',alert_circle_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>',zap_default='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-zap"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>',angelfish_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14.94 8.78C13.95 5.9 10.78 1 4.65 1C1.57 1 0 2.18 0 2.18L0.56 2.19C1.42 2.23 3.04 2.33 3.93 2.71C4.02 2.75 4.1 2.82 4.15 2.9L4.22 3.04C4.46 3.55 4.88 4.73 4.28 5.96C4.16 6.18 3.9 6.28 3.67 6.2L3.33 6.09C2.71 5.88 1.79 5.5 1.07 4.97C0.81 4.78 0.44 4.85 0.37 5.16C0.07 6.42 0.07 8.58 0.37 9.84C0.44 10.15 0.81 10.22 1.07 10.03C1.94 9.39 3.08 8.98 3.67 8.8C3.9 8.72 4.16 8.82 4.28 9.04C4.94 10.4 4.37 11.68 4.15 12.1C4.1 12.18 4.02 12.25 3.93 12.29C2.68 12.82 0 12.82 0 12.82C0.58 13.21 2.56 14 5.81 14C11.01 14 13.91 10.86 14.8 9.7C15 9.44 15.06 9.08 14.94 8.78ZM10.46 9.13C9.65 9.13 9 8.48 9 7.68C9 6.88 9.65 6.23 10.46 6.23C11.26 6.23 11.91 6.88 11.91 7.68C11.91 8.48 11.26 9.13 10.46 9.13Z"/>\n</svg>',barbell_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4 3.5c-0.5 0 -1 0.5 -1 1v2.5h-0.5v-1.25c0 -0.41 -0.4 -0.75 -0.75 -0.75s-0.75 0.34 -0.75 0.75v1.25h-0.5c-0.28 0 -0.5 0.26 -0.5 0.5s0.22 0.5 0.5 0.5h0.5v1.25c0 0.41 0.4 0.75 0.75 0.75s0.75 -0.34 0.75 -0.75v-1.25h0.5v2.5c0 0.5 0.5 1 1 1s1 -0.5 1 -1v-2.5h5v2.5c0 0.5 0.5 1 1 1s1 -0.5 1 -1v-2.5h0.5v1.25c0 0.41 0.4 0.75 0.75 0.75s0.75 -0.34 0.75 -0.75v-1.25h0.5c0.28 0 0.5 -0.26 0.5 -0.5s-0.22 -0.5 -0.5 -0.5h-0.5v-1.25c0 -0.41 -0.4 -0.75 -0.75 -0.75s-0.75 0.34 -0.75 0.75v1.25h-0.5v-2.5c0 -0.5 -0.5 -1 -1 -1s-1 0.5 -1 1v2.5h-5v-2.5c0 -0.48 -0.5 -1 -1 -1z"/>\n</svg>',climbing_wall_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.11 0.55L2.9 0c-0.47 0 -0.85 0.43 -0.85 0.95v14.05l10.9 -2.13V1.5c0 -0.52 -0.38 -0.95 -0.84 -0.95ZM9.59 4c0.28 -0.31 0.75 -0.34 1.06 -0.06c0.31 0.28 0.34 0.75 0.06 1.06l-1.06 0.06c-0.31 -0.28 -0.34 -0.75 -0.06 -1.06ZM4.96 7.31l-1.05 0.19c-0.34 -0.24 -0.43 -0.71 -0.19 -1.05s0.71 -0.43 1.05 -0.19s0.43 0.71 0.19 1.05ZM5.22 3.19c-0.12 -0.25 0 -0.55 0.25 -0.66c0.25 -0.11 0.53 -0.01 0.65 0.22c0.1 0.07 0.41 0.05 0.56 -0.02c0 -0.22 0.13 -0.43 0.35 -0.5c0.26 -0.08 0.54 0.06 0.63 0.33c0.12 0.38 -0.03 0.88 -0.65 1.11c-0.21 0.08 -0.44 0.12 -0.66 0.12c-0.48 0 -0.93 -0.19 -1.13 -0.6ZM7.67 12.09l-1.05 0.19c-0.34 -0.24 -0.43 -0.71 -0.19 -1.05s0.71 -0.43 1.05 -0.19s0.43 0.71 0.19 1.05ZM10.74 9.06c-0.21 0.08 -0.44 0.12 -0.66 0.12c-0.48 0 -0.93 -0.19 -1.13 -0.6c-0.12 -0.25 0 -0.55 0.25 -0.66c0.24 -0.11 0.53 -0.01 0.65 0.22c0.1 0.07 0.41 0.05 0.56 -0.02c0 -0.22 0.13 -0.43 0.35 -0.5c0.26 -0.08 0.54 0.06 0.63 0.33c0.12 0.38 -0.03 0.88 -0.65 1.11Z"/>\n</svg>',banknote_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1 3C0.45 3 0 3.45 0 4v7c0 0.55 0.45 1 1 1h13c0.55 0 1 -0.45 1 -1V4c0 -0.55 -0.45 -1 -1 -1H1zM1 4h1.5C2.78 4 3 4.22 3 4.5S2.78 5 2.5 5S2 4.78 2 4.5L1.5 5C1.78 5 2 5.22 2 5.5S1.78 6 1.5 6S1 5.78 1 5.5V4zM7.5 4C8.88 4 10 5.57 10 7.5l0 0C10 9.43 8.88 11 7.5 11S5 9.43 5 7.5S6.12 4 7.5 4zM12.5 4H14v1.5C14 5.78 13.78 6 13.5 6S13 5.78 13 5.5S13.22 5 13.5 5L13 4.5C13 4.78 12.78 5 12.5 5S12 4.78 12 4.5S12.22 4 12.5 4zM7.5 5.5c-0.32 0 -0.53 0.11 -0.68 0.25h1.36C8.03 5.61 7.82 5.5 7.5 5.5zM6.63 6C6.58 6.09 6.56 6.17 6.54 6.25h1.91C8.44 6.17 8.42 6.09 8.38 6H6.63zM6.5 6.5v0.25h2V6.5H6.5zM6.5 7v0.25h2V7H6.5zM6.5 7.5v0.25h2V7.5H6.5zM6.5 8L6.25 8.25h2L8.5 8H6.5zM6 8.5c0 0 0.04 0.1 0.1 0.25H8.38L8 8.5H6zM1.5 9C1.78 9 2 9.22 2 9.5S1.78 10 1.5 10L2 10.5C2 10.22 2.22 10 2.5 10S3 10.22 3 10.5S2.78 11 2.5 11H1V9.5C1 9.22 1.22 9 1.5 9zM6.24 9C6.28 9.09 6.31 9.16 6.38 9.25h2.27C8.71 9.11 8.75 9 8.75 9H6.24zM13.5 9C13.78 9 14 9.22 14 9.5V11h-1.5c-0.28 0 -0.5 -0.22 -0.5 -0.5s0.22 -0.5 0.5 -0.5s0.5 0.22 0.5 0.5l0.5 -0.5C13.22 10 13 9.78 13 9.5S13.22 9 13.5 9zM6.57 9.5c0.08 0.09 0.16 0.18 0.26 0.25h1.42C8.35 9.67 8.43 9.59 8.5 9.5H6.57z"/>\n</svg>',badge_shield_with_fire_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M11.5 0L14.5 2.76C14.02 3.54 12.92 4.69 12.92 5.71C12.92 6.45 13.21 7.15 13.47 7.77C13.69 8.31 14.13 8.92 14.13 9.56C14.13 11.85 12.25 12.57 10.47 13.47L9.83 13.8C8.98 14.23 8.22 14.25 7.5 15C6.78 14.25 6.02 14.23 5.17 13.8L4.53 13.47C2.75 12.57 0.87 11.85 0.87 9.56C0.87 8.92 1.3 8.31 1.53 7.77C1.79 7.15 2.08 6.45 2.08 5.71C2.08 4.69 1.05 3.47 0.5 2.76L3.5 0C3.87 0.39 4.74 1.29 5.5 1.29C6.26 1.29 7.12 0.41 7.5 0C7.86 0.39 8.74 1.29 9.5 1.29C10.26 1.29 11.1 0.43 11.5 0ZM7.5 2.5C4.64 3.39 3.5 6.07 3.5 8.21C3.5 10.36 4.9 11.97 6.7 12.5C5.1 10.17 5.1 8.21 7.5 6.79C7.1 7.75 7.5 9.64 8.3 10.36C8.65 10.07 9.1 9.34 9.1 8.93C10.7 10.36 9.55 11.52 9.1 12.5C9.97 12.1 11.5 11.07 11.5 8.93C11.5 6.79 9.9 6.07 9.9 3.93C8.79 4.36 8.3 5.36 8.3 6.07C7.54 5.67 6.7 4.1 7.5 2.5Z"/>\n</svg>',beach_umbrella_in_ground_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.36 1.67l-0.01 4.02a4.45 4.45 0 0 0 -1.1 -0.11c-0.37 0.1 -0.74 0.63 -1.1 0.76A4.2 4.2 0 0 1 5.36 1.67Zm2.41 -0.64l2.03 3.45a3.18 3.18 0 0 1 0.84 -0.61c0.36 -0.1 0.94 0.17 1.34 0.11A4.2 4.2 0 0 0 7.77 1.03ZM1 13h13c-0.66 -0.66 -2.64 -1.11 -4.34 -1.33l-1.87 -7c0.52 -0.05 1.15 0.03 1.53 0l-2.11 -3.6h-0.01a6.17 6.17 0 0 0 -0.7 0.14a4.38 4.38 0 0 0 -0.64 0.22l-0.01 4.15c0.35 -0.17 0.84 -0.54 1.3 -0.74l1.8 6.74c-0.58 -0.05 -1.09 -0.08 -1.45 -0.08C6.03 11.5 2 12 1 13Z"/>\n</svg>',beer_mug_with_foam_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3.21 0C2.14 0 1.07 1.07 1.07 2.14L1.07 12.86C1.07 13.93 0 15 0 15L11.79 15C11.79 15 10.71 13.93 10.71 12.86L13.93 12.86C15 12.86 15 11.79 15 11.79L15 5.36C15 4.29 13.93 3.21 12.86 3.21L10.71 3.21L10.71 2.14C10.71 0.81 9.93 0 8.57 0L3.21 0ZM4.29 1.07L7.5 1.07C8.98 1.07 9.64 1.45 9.64 2.14C6.43 2.14 4.13 2.35 4.29 5.36C4.29 7.5 2.14 7.5 2.14 5.36L2.14 3.21C2.14 1.6 2.67 1.07 4.29 1.07ZM10.71 4.82L11.79 4.82C12.53 4.82 13.39 4.85 13.39 6.43L13.39 11.25L10.71 11.25L10.71 4.82ZM2.14 12.86L9.64 12.86L9.64 13.93L2.14 13.93L2.14 12.86Z"/>\n</svg>',burger_and_drink_cup_with_straw_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14.67 4.55L13.49 13.8L9.5 13.8L8.32 4.5L13.19 4.5L14.16 1.18L14.7 1.34L13.78 4.54L14.67 4.55L14.67 4.55ZM7.76 9.9C7.76 9.9 7.91 8.7 5.84 8.7L2.55 8.7C0.49 8.7 0.63 9.9 0.63 9.9L7.76 9.9L7.76 9.9ZM0.63 12.6C0.63 12.6 0.48 13.8 2.55 13.8L5.84 13.8C7.91 13.8 7.76 12.6 7.76 12.6L0.63 12.6L0.63 12.6ZM7.45 12C7.79 12 8.06 11.67 8.06 11.25C8.06 10.83 7.79 10.5 7.45 10.5L0.91 10.5C0.58 10.5 0.3 10.83 0.3 11.25C0.3 11.67 0.58 12 0.91 12L7.45 12Z"/>\n</svg>',bridge_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M15 6C13.9 6 13 6.9 13 8L13 12L9.5 12L9.5 8C9.5 6.9 8.6 6 7.5 6C6.4 6 5.5 6.9 5.5 8L5.5 12L2 12L2 8C2 6.9 1.1 6 0 6L0 3L15 3L15 6Z"/>\n</svg>',bus_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M2 3C2 1.9 2.9 1 4 1L11 1C12.1 1 13 1.9 13 3L13 11C13 12 12 12 12 12L12 13C12 13 12 14 11 14C10 14 10 13 10 13L10 12L5 12L5 13C5 13 5 14 4 14C3 14 3 13 3 13L3 12C2 12 2 11 2 11L2 7.2L2 3ZM3.5 2.5C3.22 2.5 3 2.72 3 3L3 7C3 7.28 3.22 7.5 3.5 7.5L11.5 7.5C11.78 7.5 12 7.28 12 7L12 3C12 2.72 11.78 2.5 11.5 2.5L3.5 2.5ZM4 9C3.45 9 3 9.45 3 10C3 10.55 3.45 11 4 11C4.55 11 5 10.55 5 10C5 9.45 4.55 9 4 9ZM11 9C10.45 9 10 9.45 10 10C10 10.55 10.45 11 11 11C11.55 11 12 10.55 12 10C12 9.45 11.55 9 11 9Z"/>\n</svg>',camera_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M6 2C5.45 2 5.25 2.5 5 3L4.5 4h-2C1.67 4 1 4.67 1 5.5v5C1 11.33 1.67 12 2.5 12h10c0.83 0 1.5 -0.67 1.5 -1.5v-5C14 4.67 13.33 4 12.5 4h-2L10 3C9.75 2.5 9.55 2 9 2H6zM2.5 5C2.78 5 3 5.22 3 5.5S2.78 6 2.5 6S2 5.78 2 5.5S2.22 5 2.5 5zM7.5 5c1.66 0 3 1.34 3 3s-1.34 3 -3 3s-3 -1.34 -3 -3S5.84 5 7.5 5zM7.5 6.5C6.67 6.5 6 7.17 6 8l0 0c0 0.83 0.67 1.5 1.5 1.5l0 0C8.33 9.5 9 8.83 9 8l0 0C9 7.17 8.33 6.5 7.5 6.5L7.5 6.5z"/>\n</svg>',boxing_glove_up_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.63 0.01C4.37 0.1 3.36 1.31 3.46 2.56C3.47 3.03 3.44 3.5 3.48 3.96C3.69 4.42 4.35 4.06 4.72 4.3C5.69 4.56 6.15 5.64 6.08 6.57C6.05 6.84 6.18 7.23 5.83 7.34C5.37 7.46 5.34 6.93 5.38 6.62C5.41 6.03 5.33 5.37 4.78 5.04C4 4.51 2.76 4.92 2.56 5.87C2.47 6.6 2.53 7.34 2.52 8.07C2.47 9.38 3.66 10.56 4.97 10.49C6.75 10.48 8.53 10.51 10.31 10.48C11.59 10.39 12.6 9.16 12.48 7.89C12.48 6 12.5 4.1 12.47 2.21C12.39 1 11.27 0 9.92 0.01C8.57 0.01 7.1 -0.02 5.63 0.01ZM4.04 11.61V15H10.81V11.61Z"/>\n</svg>',car_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4.62 2L10.38 2C10.76 2 11.11 2.21 11.28 2.55L13 6C13.55 6 14 6.45 14 7L14 11.5L13 11.5L13 12.5C13 13.05 12.55 13.5 12 13.5L11 13.5C10.45 13.5 10 13.05 10 12.5L10 11.5L5 11.5L5 12.5C5 13.05 4.55 13.5 4 13.5L3 13.5C2.45 13.5 2 13.05 2 12.5L2 11.5L1 11.5L1 7C1 6.45 1.45 6 2 6L3.72 2.55C3.89 2.21 4.24 2 4.62 2ZM4.25 7.5C3.56 7.5 3 8.06 3 8.75C3 9.44 3.56 10 4.25 10C4.94 10 5.5 9.44 5.5 8.75C5.5 8.06 4.94 7.5 4.25 7.5ZM10.75 7.5C10.06 7.5 9.5 8.06 9.5 8.75C9.5 9.44 10.06 10 10.75 10C11.44 10 12 9.44 12 8.75C12 8.06 11.44 7.5 10.75 7.5ZM10.25 3.5L4.75 3.5L3.5 6L11.5 6L10.25 3.5Z"/>\n</svg>',car_and_wrench_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M9.64 6C9.85 6 10.04 6.14 10.11 6.34L11 9C11.55 9 12 9.45 12 10L12 13L11 13L11 14C11 14.55 10.55 15 10 15C9.45 15 9 14.55 9 14L9 13L6 13L6 14C6 14.55 5.55 15 5 15C4.45 15 4 14.55 4 14L4 13L3 13L3 10C3 9.45 3.45 9 4 9L4.89 6.34C4.96 6.14 5.15 6 5.36 6L9.64 6ZM5 10C4.45 10 4 10.45 4 11C4 11.55 4.45 12 5 12C5.55 12 6 11.55 6 11C6 10.45 5.55 10 5 10ZM10 10C9.45 10 9 10.45 9 11C9 11.55 9.45 12 10 12C10.55 12 11 11.55 11 11C11 10.45 10.55 10 10 10ZM9.38 7L5.62 7L5 9L10 9L9.38 7ZM11.5 0.5C12.52 0.5 13.4 1.12 13.79 2L11.5 2L11 3L11.5 4L13.79 4C13.4 4.88 12.52 5.5 11.5 5.5C10.48 5.5 9.6 4.88 9.21 4L3 4C2.45 4 2 3.55 2 3C2 2.45 2.45 2 3 2L9.21 2C9.6 1.12 10.48 0.5 11.5 0.5Z"/>\n</svg>',castle_keep_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M11 4H4C3.45 4 3 3.55 3 3V0.5C3 0.22 3.22 0 3.5 0S4 0.22 4 0.5V2h1V1c0 -0.55 0.45 -1 1 -1s1 0.45 1 1v1h1V1c0 -0.55 0.45 -1 1 -1s1 0.45 1 1v1h1V0.5C11 0.22 11.22 0 11.5 0S12 0.22 12 0.5V3C12 3.55 11.55 4 11 4zM14 14.5c0 0.28 -0.22 0.5 -0.5 0.5h-12C1.22 15 1 14.78 1 14.5S1.22 14 1.5 14H2c0.55 0 1 -0.45 1 -1c0 0 1 -6 1 -7c0 -0.55 0.45 -1 1 -1h5c0.55 0 1 0.45 1 1c0 1 1 7 1 7c0 0.55 0.45 1 1 1h0.5c0.27 0 0.49 0.22 0.5 0.49V14.5zM9 10.5C9 9.67 8.33 9 7.5 9S6 9.67 6 10.5V14h3V10.5z"/>\n</svg>',cigarette_with_smoke_curl_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M13 12L12 12L12 15L13 15L13 12ZM13.93 10.71C13.21 9.64 11.79 8.57 11.79 7.5C11.79 6.43 15 5.36 15 3.21C15 1.07 12.86 1.07 10.71 0C11.07 1.43 12.86 2.14 12.86 3.21C11.79 4.29 9.64 5.36 9.64 7.5C9.64 9.64 10.71 9.64 13.93 10.71ZM15 12L14 12L14 15L15 15L15 12ZM0 15L11 15L11 12L0 12L0 15Z"/>\n</svg>',city_gate_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M0 1.07L0 4.29L15 4.29L15 1.07L12.86 1.07L12.86 3.21L10.71 3.21L10.71 1.07L8.57 1.07L8.57 3.21L6.43 3.21L6.43 1.07L4.29 1.07L4.29 3.21L2.14 3.21L2.14 1.07L0 1.07ZM0 5.36L0 13.93L2.68 13.93C2.68 10.71 3.74 6.96 7.5 6.96C11.15 6.94 12.32 10.71 12.32 13.93L15 13.93L15 5.36L0 5.36ZM7.5 8.57C5.36 8.57 4.29 10.71 4.29 13.93L10.71 13.93C10.71 10.71 9.64 8.57 7.5 8.57Z"/>\n</svg>',classical_building_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.5 0L1 3.5V4h13V3.5L7.5 0zM2 5v5l-1 1.6V13h13v-1.4L13 10V5H2zM4 6h1v5.5H4V6zM7 6h1v5.5H7V6zM10 6h1v5.5h-1V6z"/>\n</svg>',classical_building_with_clock_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M13 4H9l0 -3L7.5 0L6 1v3H2L1 5v1h13V5L13 4zM7.5 1.5c0.4 0 0.7 0.3 0.7 0.8S7.9 3 7.5 3S6.7 2.7 6.7 2.2C6.7 1.8 7.1 1.5 7.5 1.5zM13 7H2v4l-1 1.5V14h13v-1.5L13 11V7zM5 12.5H4V8h1V12.5zM8 12.5H7V8h1V12.5zM11 12.5h-1V8h1V12.5z"/>\n</svg>',classical_building_with_dome_and_flag_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7 1L9 0L11 1L13 0L13 3L11 4L9 3L8 3.5L8 5L7 5L7 1ZM2.5 9L12.5 9L12.5 15L2.5 15L2.5 9ZM4 10L4 14L5 14L5 10L4 10ZM7 10L7 14L8 14L8 10L7 10ZM10 10L10 14L11 14L11 10L10 10ZM2.5 8.5C2.75 5.97 4.89 4 7.5 4C10.11 4 12.25 5.97 12.5 8.5L2.5 8.5Z"/>\n</svg>',classical_building_with_flag_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7 4.17L7 1L9 0L11 1L13 0L13 3L11 4L9 3L8 3.5L8 4.17L13.5 6L13.5 7L1.5 7L1.5 6L7 4.17ZM2.5 7.5L12.5 7.5L12.5 12L13.5 13L13.5 14L1.5 14L1.5 13L2.5 12L2.5 7.5ZM4 8.5L4 12.5L5 12.5L5 8.5L4 8.5ZM7 8.5L7 12.5L8 12.5L8 8.5L7 8.5ZM10 8.5L10 12.5L11 12.5L11 8.5L10 8.5Z"/>\n</svg>',commercial_building_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14 6h-13c0.09 -1.38 0.43 -2.74 1 -4h11c0.57 1.26 0.91 2.62 1 4zm-11 1h9v6h-1v-5h-3v5h-5zm1 3h3v-2h-3z"/>\n</svg>',clothes_hanger_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M6.75 7.14L6.75 5.5C6.75 5.09 7.09 4.75 7.5 4.75C8.19 4.75 8.75 4.19 8.75 3.5C8.75 2.81 8.19 2.25 7.5 2.25C6.81 2.25 6.25 2.81 6.25 3.5C6.25 3.91 5.91 4.25 5.5 4.25C5.09 4.25 4.75 3.91 4.75 3.5C4.75 1.98 5.98 0.75 7.5 0.75C9.02 0.75 10.25 1.98 10.25 3.5C10.25 4.76 9.4 5.82 8.25 6.15L8.25 7.14L14.3 12.03C14.59 12.26 14.76 12.62 14.76 13C14.76 13.69 14.2 14.25 13.51 14.25L1.49 14.25C1.11 14.25 0.75 14.08 0.51 13.79C0.08 13.25 0.16 12.46 0.7 12.03L6.75 7.14ZM12.81 12.75L7.5 8.46L2.19 12.75L12.81 12.75Z"/>\n</svg>',cleaver_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.44 4.2L13.28 4.74C12.92 6.09 12.46 7.19 11.92 8.03C11.24 9.08 10.14 10.15 8.63 11.26L9.47 11.8C10.98 10.7 12.07 9.62 12.75 8.57C13.44 7.52 13.97 6.09 14.37 4.26L9.33 0.99L8.79 0.63C8.33 0.33 7.71 0.46 7.4 0.93C7.35 1.01 7.31 1.09 7.28 1.19C6.98 2.22 6.65 3.08 6.3 3.78C5.81 4.76 4.9 6.16 3.57 7.98L7.79 10.71C9.3 9.61 10.4 8.53 11.08 7.48C11.62 6.64 12.08 5.54 12.44 4.2ZM9.42 2.23C9.88 2.53 10.01 3.15 9.71 3.62C9.41 4.08 8.79 4.21 8.33 3.91C7.87 3.61 7.73 2.99 8.04 2.53C8.34 2.06 8.96 1.93 9.42 2.23ZM3.33 8.41L0.88 12.19C0.42 12.88 0.62 13.81 1.32 14.26C1.97 14.68 2.82 14.53 3.29 13.94L3.38 13.82L3.65 13.39C3.31 12.81 3.33 12.07 3.7 11.5L5 9.5L3.33 8.41Z"/>\n</svg>',cloth_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.98 2.1C8.07 2.06 7.02 0.78 4.93 0.78C2.45 0.78 0.99 1.46 0.37 1.85C-0.1 2.1 0.01 1.62 0.01 1.45C0.01 1.28 0.29 1.12 0.29 1.12C0.86 0.75 2.34 0 4.93 0C7.02 0 8.08 1.28 13 1.32C13 1.32 13.37 1.28 13.37 1.62C13.37 1.95 13.35 2.1 12.98 2.1ZM13.37 14.52C13.37 14.18 13 14.22 13 14.22C8.08 14.19 7.02 12.9 4.93 12.9C2.34 12.9 0.86 13.65 0.29 14.02C0.29 14.02 0.01 14.18 0.01 14.35C0.01 14.52 -0.1 15 0.37 14.75C0.99 14.37 2.45 13.68 4.93 13.68C7.02 13.68 8.07 14.96 12.98 15C13.35 15 13.37 14.85 13.37 14.52ZM13.37 3.21C13.37 2.87 13 2.91 13 2.91C8.08 2.88 7.02 1.59 4.93 1.59C2.34 1.59 0.86 2.34 0.29 2.71C0.29 2.71 0.01 2.87 0.01 3.04L0.01 12.74C0.01 12.91 -0.1 13.39 0.37 13.14C0.99 12.75 2.45 12.07 4.93 12.07C7.02 12.07 8.07 13.35 12.98 13.39C13.35 13.39 13.37 13.24 13.37 12.91L13.37 3.21Z"/>\n</svg>',cocktail_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.5 1c-2 0 -7 0.25 -6.5 0.75L7 8v4c0 1 -3 0.5 -3 2h7c0 -1.5 -3 -1 -3 -2V8l6 -6.25C14.5 1.25 9.5 1 7.5 1zM7.5 2c2.5 0 4.75 0.25 4.75 0.25L11.5 3h-8L2.75 2.25C2.75 2.25 5 2 7.5 2z"/>\n</svg>',coffee_bean_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M13.5 1C14 0.5 6.5 0 3 3.5C1 5.5 0 8.5 0 10C0 12 1 15 3 15C10 15 12.5 9.5 13.5 7.5C14.5 5.5 15 1.5 14 1.5C13.5 1.5 11 3 10 4C9 5 9 7 8 8C7 9 5.5 9 4.5 10C3.5 11 2 12.5 2 12.5C2 12.5 2.5 10 3.5 9C4.5 8 5.5 8 6.5 7C7.5 6 8 4 9 3C10 2 13 1.5 13.5 1z"/>\n</svg>',comedy_mask_and_tragedy_mask_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M2 1c0 0 -1 0 -1 1v5.16C1 8.89 1.35 11 4.5 11H5V8L2.5 9c0 0 0 -2.5 2.5 -2.5V5c0 -0.71 0.09 -1.32 0.5 -1.78C5.88 2.81 6.5 1.97 8.16 2.75L9 3.3V2c0 0 0 -1 -1 -1C7.29 1 6.02 2 5 2S2.79 1 2 1zM3 3c0.55 0 1 0.45 1 1S3.55 5 3 5S2 4.55 2 4S2.45 3 3 3zM7 4c0 0 -1 0 -1 1v5c0 2 1 4 4 4s4 -2 4 -4V5c0 -1 -1 -1 -1 -1c-0.71 0 -1.98 1 -3 1S7.79 4 7 4zM8 6c0.55 0 1 0.45 1 1S8.55 8 8 8S7 7.55 7 7S7.45 6 8 6zM12 6c0.55 0 1 0.45 1 1s-0.45 1 -1 1s-1 -0.45 -1 -1S11.45 6 12 6zM7.5 10H10h2.5c0 0 0 2.5 -2.5 2.5S7.5 10 7.5 10z"/>\n</svg>',croissant_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.29 4.38L6 9.5a0.98 0.98 0 0 0 1 1H8a0.98 0.98 0 0 0 1 -1l0.71 -5.12C9.71 3 7.5 3 7.5 3S5.29 3 5.29 4.38ZM3.5 5C2 5 2 6 2 6l1 4H4.5a0.79 0.79 0 0 0 0.79 -0.76L4.5 5Zm-2 2.5a1.53 1.53 0 0 0 -1.06 0.41A1.37 1.37 0 0 0 0 8.79V11H0.88A1.02 1.02 0 0 0 2 10ZM11.5 5C13 5 13 6 13 6l-1 4H10.5a0.79 0.79 0 0 1 -0.79 -0.76L10.5 5Zm2 2.5a1.53 1.53 0 0 1 1.06 0.41A1.37 1.37 0 0 1 15 8.79V11h-0.88A1.02 1.02 0 0 1 13 10Z"/>\n</svg>',cup_and_saucer_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12 5h-2V3H2v4c0.01 2.21 1.81 3.99 4.02 3.98C7.43 10.97 8.74 10.22 9.45 9H12c1.1 0 2 -0.9 2 -2S13.1 5 12 5zM12 8H9.86C9.95 7.67 10 7.34 10 7V6h2c0.55 0 1 0.45 1 1S12.55 8 12 8zM10 12.5c0 0.28 -0.22 0.5 -0.5 0.5h-7C2.22 13 2 12.78 2 12.5S2.22 12 2.5 12h7C9.78 12 10 12.22 10 12.5z"/>\n</svg>',donut_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.5 0C11.64 0 15 3.36 15 7.5C15 11.64 11.64 15 7.5 15C3.36 15 0 11.64 0 7.5C0 3.36 3.36 0 7.5 0zM7.21 11.12C7.12 10.88 6.35 11.16 6.42 11.38C6.48 11.61 6.83 12.78 6.93 13.04C7.02 13.3 7.83 13.04 7.75 12.78C7.67 12.53 7.3 11.35 7.21 11.12zM3.51 11.31C3.24 11.22 3 12.06 3.23 12.16C3.47 12.27 4.67 12.65 4.88 12.7C5.09 12.75 5.39 11.98 5.15 11.88C4.99 11.8 3.77 11.4 3.51 11.31zM9.7 10.98C9.47 10.89 9.12 11.66 9.39 11.79C9.69 11.92 10.75 12.33 11 12.41C11.25 12.48 11.61 11.73 11.31 11.6C11.02 11.47 9.93 11.07 9.7 10.98zM11.32 9.23C11.05 9.19 10.91 10.04 11.2 10.09C11.48 10.14 12.67 10.32 12.91 10.33C13.16 10.34 13.29 9.51 13.03 9.47C12.78 9.44 11.59 9.28 11.32 9.23zM7.5 5.19C6.23 5.19 5.19 6.23 5.19 7.5C5.19 8.78 6.23 9.81 7.5 9.81C8.78 9.81 9.81 8.78 9.81 7.5C9.81 6.23 8.78 5.19 7.5 5.19zM2.64 8.65C2.42 8.64 2.31 9.49 2.55 9.52C2.8 9.55 3.99 9.68 4.27 9.7C4.56 9.72 4.59 8.86 4.37 8.84C4.14 8.81 2.86 8.67 2.64 8.65zM12.74 6.37C12.65 6.64 12.2 7.86 12.12 8.07C12.05 8.28 12.86 8.54 12.95 8.31C13.05 8.08 13.42 6.94 13.5 6.67C13.58 6.41 12.83 6.11 12.74 6.37zM2.74 5.57C2.54 5.73 1.6 6.61 1.42 6.77C1.25 6.93 1.8 7.58 1.97 7.44C2.14 7.3 3.03 6.46 3.24 6.26C3.44 6.06 2.93 5.41 2.74 5.57zM11.71 3.53C11.59 3.35 10.86 3.69 10.99 3.94C11.13 4.19 11.71 5.25 11.83 5.45C11.95 5.66 12.71 5.24 12.59 5.03C12.47 4.83 11.84 3.72 11.71 3.53zM7.96 3.47C7.77 3.41 7.46 4.2 7.69 4.29C7.92 4.39 9.08 4.75 9.34 4.83C9.59 4.91 9.84 4.09 9.61 4.01C9.38 3.92 8.15 3.54 7.96 3.47zM2.66 3.53C2.28 3.52 2.31 4.39 2.57 4.41C2.83 4.42 4.07 4.52 4.3 4.53C4.56 4.53 4.69 3.64 4.41 3.63C4.21 3.61 3.03 3.55 2.66 3.53zM5.09 1.48C4.94 1.38 4.34 1.99 4.55 2.16C4.77 2.33 5.71 3.09 5.92 3.22C6.13 3.36 6.65 2.72 6.45 2.54C6.25 2.36 5.25 1.59 5.09 1.48zM9.44 1.16C9.19 1.19 7.97 1.39 7.73 1.43C7.48 1.47 7.61 2.31 7.86 2.28C8.11 2.25 9.34 2.07 9.57 2.01C9.8 1.95 9.68 1.13 9.44 1.16z"/>\n</svg>',eyeglasses_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1.78 3.81C2.03 3.31 2.54 3 3.1 3C3.49 3 3.86 3.15 4.14 3.43L4.85 4.15C5.05 4.34 5.05 4.66 4.85 4.85C4.66 5.05 4.34 5.05 4.15 4.85L3.43 4.14C3.34 4.05 3.22 4 3.1 4C2.92 4 2.76 4.1 2.68 4.26L1.31 7H5.25C6.07 7 6.75 7.57 6.94 8.32C7.11 8.28 7.3 8.25 7.5 8.25C7.7 8.25 7.89 8.28 8.06 8.32C8.25 7.57 8.93 7 9.75 7H13.69L12.32 4.26C12.24 4.1 12.08 4 11.9 4C11.78 4 11.66 4.05 11.57 4.14L10.85 4.85C10.66 5.05 10.34 5.05 10.15 4.85C9.95 4.66 9.95 4.34 10.15 4.15L10.86 3.43C11.14 3.15 11.51 3 11.9 3C12.46 3 12.97 3.31 13.22 3.81L14.94 7.26L14.94 7.26C14.98 7.33 15 7.41 15 7.5V8.5C15 8.78 14.78 9 14.5 9H14V9.5C14 11.09 13 12 11.25 12H10.75C9 12 8 11.09 8 9.5V9.34C7.85 9.29 7.67 9.25 7.5 9.25C7.33 9.25 7.15 9.29 7 9.34V9.5C7 11.09 6 12 4.25 12H3.75C2 12 1 11.09 1 9.5V9H0.5C0.22 9 0 8.78 0 8.5V7.5C0 7.41 0.02 7.33 0.06 7.26L0.06 7.26L1.78 3.81ZM9.75 8C9.34 8 9 8.34 9 8.75V9.5C9 10.2 9.2 11 10.75 11H11.25C12.8 11 13 10.2 13 9.5V8.75C13 8.34 12.66 8 12.25 8H9.75ZM2.75 8C2.34 8 2 8.34 2 8.75V9.5C2 10.2 2.2 11 3.75 11H4.25C5.8 11 6 10.2 6 9.5V8.75C6 8.34 5.66 8 5.25 8H2.75Z"/>\n</svg>',fancy_mirror_with_reflection_and_stars_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.54 0C6.14 0 4.99 0.86 4.31 2.04C3.49 2.19 2.71 2.54 2.13 3.18C1.5 3.89 1.14 4.91 1.17 6.17C1.21 7.51 1.86 8.59 2.45 9.59C3.05 10.58 3.58 11.48 3.66 12.45C3.68 12.73 3.9 12.97 4.18 13.01C4.18 13.02 4.21 13.04 4.26 13.11C4.36 13.26 4.52 13.53 4.75 13.82C5.22 14.4 6.09 15.02 7.55 15C8.99 14.98 9.83 14.37 10.27 13.81C10.49 13.53 10.63 13.27 10.74 13.14C10.84 13.01 10.84 13.02 10.89 13.01C11.19 12.97 11.42 12.71 11.42 12.4C11.42 11.35 11.94 10.38 12.53 9.38C13.12 8.39 13.81 7.38 13.83 6.16C13.86 4.06 12.52 2.48 10.78 2.07C10.11 0.87 8.95 0 7.54 0ZM7.62 1.24C8.59 1.27 9.44 1.9 9.88 2.85C9.97 3.03 10.14 3.16 10.34 3.2C11.62 3.41 12.62 4.46 12.59 6.15C12.58 6.87 12.08 7.74 11.47 8.75C10.92 9.69 10.35 10.79 10.25 12.08C10.09 12.19 9.86 12.26 9.76 12.38C9.57 12.63 9.45 12.86 9.3 13.05C9 13.43 8.69 13.75 7.53 13.77C6.38 13.78 6.03 13.44 5.71 13.05C5.56 12.85 5.43 12.63 5.25 12.39C5.15 12.24 4.98 12.09 4.78 11.97C4.59 10.82 4.04 9.83 3.51 8.95C2.93 7.97 2.43 7.08 2.41 6.14C2.38 5.12 2.65 4.46 3.05 4.01C3.45 3.55 4.03 3.28 4.72 3.19C4.93 3.16 5.11 3.03 5.2 2.84C5.64 1.9 6.48 1.28 7.44 1.24L7.16 1.77L6.36 1.86L6.92 2.44L6.76 3.23L7.48 2.87L8.18 3.27L8.07 2.47L8.66 1.93L7.87 1.79L7.62 1.24ZM7.54 3.9C6.34 3.9 6.25 4.24 5.36 6.58C4.8 8.08 5.36 9.02 6.16 9.49C5.68 9.88 5.31 10.46 5.12 11.16C7.11 13.76 8.56 12.67 9.95 11.17C9.77 10.45 9.38 9.86 8.89 9.47C9.64 8.98 10.18 8.03 9.71 6.58C8.99 4.31 8.74 3.9 7.54 3.9ZM4.1 4.63L3.77 5.04L3.24 5L3.53 5.44L3.34 5.93L3.84 5.79L4.24 6.12L4.27 5.6L4.71 5.32L4.22 5.14L4.1 4.63ZM10.64 6.06L10.59 6.42L10.26 6.59L10.59 6.74L10.65 7.11L10.91 6.84L11.27 6.9L11.09 6.57L11.26 6.25L10.9 6.31L10.64 6.06Z"/>\n</svg>',family_restroom_symbol_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4 3L2 3L0.5 11L2 11L2 15L4 15L4 11L5.5 11L4 3ZM14 3.5L13 3L11 3L10 3.5L10 9.5L11 9.5L11 15L13 15L13 9.5L14 9.5L14 3.5ZM12.25 2.5L11.75 2.5C11.13 2.5 10.75 2.13 10.75 1.5L10.75 1C10.75 0.38 11.13 0 11.75 0L12.38 0C12.88 0 13.25 0.38 13.25 1L13.25 1.63C13.25 2.13 12.88 2.5 12.25 2.5ZM3.25 2.5L2.75 2.5C2.13 2.5 1.75 2.13 1.75 1.5L1.75 1C1.75 0.38 2.13 0 2.75 0L3.38 0C3.88 0 4.25 0.38 4.25 1L4.25 1.63C4.25 2.13 3.88 2.5 3.25 2.5ZM7.73 7.31L7.27 7.31C6.68 7.31 6.33 6.96 6.33 6.38L6.33 5.92C6.33 5.35 6.68 5 7.27 5L7.85 5C8.32 5 8.67 5.35 8.67 5.92L8.67 6.5C8.67 6.96 8.32 7.31 7.73 7.31ZM9 8.75L8 7.75L7 7.75L6 8.75L6 12.5L7 15L8 15L9 12.5L9 8.75Z"/>\n</svg>',film_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M2 1C1.45 1 1 1.45 1 2L1 13C1 13.55 1.45 14 2 14L13 14C13.55 14 14 13.55 14 13L14 2C14 1.45 13.55 1 13 1L2 1ZM2.25 2L2.75 2C2.89 2 3 2.11 3 2.25L3 2.75C3 2.89 2.89 3 2.75 3L2.25 3C2.11 3 2 2.89 2 2.75L2 2.25C2 2.11 2.11 2 2.25 2ZM4 2L11 2L11 7L4 7L4 2ZM12.25 2L12.75 2C12.89 2 13 2.11 13 2.25L13 2.75C13 2.89 12.89 3 12.75 3L12.25 3C12.11 3 12 2.89 12 2.75L12 2.25C12 2.11 12.11 2 12.25 2ZM2.25 4L2.75 4C2.89 4 3 4.11 3 4.25L3 4.75C3 4.89 2.89 5 2.75 5L2.25 5C2.11 5 2 4.89 2 4.75L2 4.25C2 4.11 2.11 4 2.25 4ZM12.25 4L12.75 4C12.89 4 13 4.11 13 4.25L13 4.75C13 4.89 12.89 5 12.75 5L12.25 5C12.11 5 12 4.89 12 4.75L12 4.25C12 4.11 12.11 4 12.25 4ZM2.25 6L2.75 6C2.89 6 3 6.11 3 6.25L3 6.75C3 6.89 2.89 7 2.75 7L2.25 7C2.11 7 2 6.89 2 6.75L2 6.25C2 6.11 2.11 6 2.25 6ZM12.25 6L12.75 6C12.89 6 13 6.11 13 6.25L13 6.75C13 6.89 12.89 7 12.75 7L12.25 7C12.11 7 12 6.89 12 6.75L12 6.25C12 6.11 12.11 6 12.25 6ZM2.25 8L2.75 8C2.89 8 3 8.11 3 8.25L3 8.75C3 8.89 2.89 9 2.75 9L2.25 9C2.11 9 2 8.89 2 8.75L2 8.25C2 8.11 2.11 8 2.25 8ZM4 8L11 8L11 13L4 13L4 8ZM12.25 8L12.75 8C12.89 8 13 8.11 13 8.25L13 8.75C13 8.89 12.89 9 12.75 9L12.25 9C12.11 9 12 8.89 12 8.75L12 8.25C12 8.11 12.11 8 12.25 8ZM2.25 10L2.75 10C2.89 10 3 10.11 3 10.25L3 10.75C3 10.89 2.89 11 2.75 11L2.25 11C2.11 11 2 10.89 2 10.75L2 10.25C2 10.11 2.11 10 2.25 10ZM12.25 10L12.75 10C12.89 10 13 10.11 13 10.25L13 10.75C13 10.89 12.89 11 12.75 11L12.25 11C12.11 11 12 10.89 12 10.75L12 10.25C12 10.11 12.11 10 12.25 10ZM2.25 12L2.75 12C2.89 12 3 12.11 3 12.25L3 12.75C3 12.89 2.89 13 2.75 13L2.25 13C2.11 13 2 12.89 2 12.75L2 12.25C2 12.11 2.11 12 2.25 12ZM12.25 12L12.75 12C12.89 12 13 12.11 13 12.25L13 12.75C13 12.89 12.89 13 12.75 13L12.25 13C12.11 13 12 12.89 12 12.75L12 12.25C12 12.11 12.11 12 12.25 12Z"/>\n</svg>',fingernail_polished_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M11 6.5C11.5 9 12 11 12 15L11 15C11 12 10.5 9.5 10.5 9.5C10.5 9.5 10.5 12 7.5 12C4.5 12 4.5 9.5 4.5 9.5C4.5 9.5 4 12 4 15C4 15 3 15 3 15C3 11 3.5 9 4 6.5C4 2 4 0 7.5 0C11 0 11 2 11 6.5zM7.5 1C5 1 5 2.5 5 7C5.5 4 5.5 2 7.5 1z"/>\n</svg>',fish_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14.5 6.38L14.5 6.75C14.5 6.8 13.85 7.07 12.54 7.55C12.46 7.64 12.46 7.64 12.46 7.72C12.46 7.79 12.54 7.88 12.63 7.88L14.88 7.88L14.88 8.25C12.86 9.82 10.75 10.5 8.25 10.5C6.58 10.5 5 9.75 3.5 8.25L0 10.5L0 9.5L1.25 7.5L0 5.5L0 4.5L3.5 6.75C5 5.25 6.58 4.5 8.25 4.5C12.75 4.5 14.5 6.38 14.5 6.38ZM11.5 7.25C11.96 7.25 12.25 6.95 12.25 6.5C12.25 6.05 11.96 5.75 11.5 5.75C11.05 5.75 10.75 6.05 10.75 6.5C10.75 6.95 11.05 7.25 11.5 7.25Z"/>\n</svg>',flag_checkered_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4.99 1.58C5.04 1.31 4.85 1.05 4.58 1.01C4.31 0.96 4.05 1.15 4.01 1.42L2.01 13.42C1.96 13.69 2.15 13.95 2.42 13.99C2.69 14.04 2.95 13.85 2.99 13.58L3.66 9.56C4.47 9.68 5.34 9.72 6.03 10.2C6.45 10.51 6.94 10.7 7.46 10.78C8.42 10.93 9.29 10.4 10.24 10.55L11.53 10.74C11.79 10.78 12.06 10.58 12.1 10.32L12.98 4.39L12.99 4.38C13.02 4.12 12.82 3.86 12.56 3.82L11.27 3.63C10.31 3.48 9.44 4 8.49 3.86C8.06 3.79 7.65 3.63 7.3 3.38C6.56 2.86 5.68 2.78 4.81 2.66L4.99 1.58ZM4.4 5.12L4.73 3.15C5.33 3.23 5.97 3.28 6.52 3.52L6.23 5.48C5.66 5.25 5.01 5.2 4.4 5.12ZM3.75 9.07L4.07 7.1C4.69 7.18 5.35 7.22 5.93 7.46L6.23 5.49C6.89 5.76 7.39 6.22 8.13 6.33L8.43 4.35C9.16 4.46 9.77 4.17 10.48 4.11L10.18 6.08C9.47 6.14 8.86 6.44 8.12 6.33L7.84 8.31C7.1 8.2 6.6 7.73 5.94 7.46L5.64 9.44C5.04 9.2 4.38 9.16 3.75 9.07ZM7.84 8.31C8.57 8.42 9.19 8.12 9.9 8.06L10.18 6.08C10.84 6.02 11.51 6.19 12.15 6.29L11.87 8.26C11.23 8.17 10.56 8 9.9 8.06L9.6 10.03C8.89 10.08 8.27 10.39 7.54 10.28L7.84 8.31Z"/>\n</svg>',flower_bouquet_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1.5 1A2.7 2.7 0 0 1 4 3l0.5 -3L5 3A2.7 2.7 0 0 1 7.5 1c-0.2 0.03 -1 0.26 -1 2v0.08A1.96 1.96 0 0 1 4.5 5H4.42A1.96 1.96 0 0 1 2.5 3C2.5 1.26 1.7 1.03 1.5 1ZM12.01 11l3 -0.5l-3 -0.5A2.69 2.69 0 0 0 14 7.5c-0.03 0.2 -0.25 1 -1.99 1a2 2 0 0 0 0 4c1.74 0 1.96 0.8 1.99 1A2.69 2.69 0 0 0 12.01 11ZM9.69 5.55a1 1 0 0 1 0 -2a1 1 0 0 1 0 -2a0.99 0.99 0 0 1 0.85 0.51l0.02 -0.01a0.98 0.98 0 0 1 -0.12 -0.44a1 1 0 1 1 2 0a0.98 0.98 0 0 1 -0.12 0.44l0.02 0.01a0.99 0.99 0 0 1 0.85 -0.5a1 1 0 0 1 0.03 2a1 1 0 0 1 -0.02 2a0.99 0.99 0 0 1 -0.85 -0.5l-0.02 0.01a0.98 0.98 0 0 1 0.11 0.44a1 1 0 0 1 -2 0a0.98 0.98 0 0 1 0.11 -0.44l-0.02 -0.01a0.99 0.99 0 0 1 -0.85 0.51Zm0.71 -1.99A1.05 1.05 0 1 0 11.45 2.5A1.05 1.05 0 0 0 10.4 3.55v0ZM4.95 11.44l-0.52 -0.51L8.89 6.48A1.75 1.75 0 0 1 8.44 6.22L4.08 10.58l-0.52 -0.52A16.05 16.05 0 0 0 4.91 6a3.37 3.37 0 0 1 -0.41 0.04c-0.04 0 -0.07 -0.01 -0.11 -0.01A16.95 16.95 0 0 1 3.13 9.63L2.76 9.26a0.25 0.25 0 0 0 -0.4 0.08L0.23 14.45a0.29 0.29 0 0 0 -0.02 0.09a0.25 0.25 0 0 0 0.25 0.25a0.29 0.29 0 0 0 0.1 -0.02l5.1 -2.12a0.25 0.25 0 0 0 0.08 -0.4l-0.37 -0.37a16.87 16.87 0 0 1 3.61 -1.26c0 -0.06 -0.01 -0.11 -0.01 -0.17A3.35 3.35 0 0 1 9 10.09A16.08 16.08 0 0 0 4.95 11.44Z"/>\n</svg>',fort_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1.07 1.07L1.07 3.21L6.43 3.21L6.43 1.07L5.36 1.07L5.36 2.14L4.29 2.14L4.29 1.07L3.21 1.07L3.21 2.14L2.14 2.14L2.14 1.07L1.07 1.07ZM8.57 1.07L8.57 3.21L13.93 3.21L13.93 1.07L12.86 1.07L12.86 2.14L11.79 2.14L11.79 1.07L10.71 1.07L10.71 2.14L9.64 2.14L9.64 1.07L8.57 1.07ZM1.07 4.29L1.07 10.71L13.93 10.71L13.93 4.29L8.57 4.29L8.57 6.43L6.43 6.43L6.43 4.29L1.07 4.29ZM3.21 6.43L4.29 6.43L4.29 7.5L3.75 8.57L3.21 7.5L3.21 6.43ZM10.71 6.43L11.79 6.43L11.79 7.5L11.25 8.57L10.71 7.5L10.71 6.43ZM1.07 11.79L0 15L15 15L13.93 11.79L1.07 11.79Z"/>\n</svg>',fork_and_knife_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3.5 0l-0.5 5.5c-0.15 0.81 1.78 1.18 1.75 2l-0.25 6.5c-0.04 1 1 1 1 1s1.04 0 1 -1l-0.25 -6.5c-0.03 -0.82 1.73 -1.18 1.75 -2l-0.5 -5.5h-0.5l-0.25 4l-0.75 0.5l-0.25 -4.5h-0.5l-0.25 4.5l-0.75 -0.5l-0.25 -4zm8.5 0c-0.74 0 -1.96 0.65 -2.46 1.64c-0.4 0.73 -0.54 2.38 -0.54 3.36v2.5c0 0.82 1.09 1 1.5 1l-0.5 5.5c-0.09 1 1 1 1 1s1 0 1 -1z"/>\n</svg>',gravestone_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M11.46 12h-0.68L12 3.55c0.02 -0.29 -0.2 -0.53 -0.49 -0.55C11.49 3 11.46 3 11.44 3h-1.18c0 -0.92 -1.23 -2 -2.75 -2S4.77 2.08 4.77 3H3.54C3.25 2.99 3.01 3.21 3 3.5C3 3.52 3 3.53 3 3.55L4.2 12H3.55C3.26 11.99 3.02 12.21 3 12.5V14h9v-1.51C11.98 12.21 11.74 11.99 11.46 12zM4.5 5h6v1h-6V5z"/>\n</svg>',grecian_vase_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3.21 0L3.21 1.07L4.29 1.07C4.93 1.07 5.19 2.19 5.29 3.11C4.25 2.3 3.24 2.01 2.38 2.18C1.27 2.38 0.54 3.4 0.54 4.55C0.54 5.46 0.87 6.25 1.44 7.06C1.94 7.78 2.64 8.61 3.52 9.61C3.91 11.07 4.63 12.4 5.36 13.13L5.36 13.93L4.29 14.46L4.29 15L10.71 15L10.71 14.46L9.64 13.93L9.64 13.13C10.37 12.4 11.09 11.07 11.48 9.61C12.36 8.61 13.06 7.78 13.56 7.06C14.13 6.25 14.46 5.46 14.46 4.55C14.46 3.4 13.73 2.38 12.62 2.18C11.76 2.01 10.75 2.3 9.71 3.11C9.81 2.19 10.07 1.07 10.71 1.07L11.79 1.07L11.79 0L3.21 0ZM2.54 3.25C3.09 3.15 4 3.36 5.06 4.32C3.86 4.47 3.21 5.52 3.21 7.5C3.21 7.53 3.21 7.57 3.21 7.6C2.85 7.18 2.55 6.8 2.31 6.46C1.81 5.74 1.61 5.21 1.61 4.55C1.61 3.8 1.94 3.36 2.54 3.25ZM11.92 3.25C12.12 3.22 12.3 3.22 12.46 3.25C13.06 3.36 13.39 3.8 13.39 4.55C13.39 5.21 13.19 5.74 12.69 6.46C12.45 6.8 12.15 7.18 11.79 7.6C11.79 7.57 11.79 7.53 11.79 7.5C11.79 5.52 11.14 4.47 9.94 4.32C10.71 3.62 11.39 3.32 11.92 3.25Z"/>\n</svg>',greek_cross_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7 1C6.4 1 6 1.4 6 2v4H2C1.4 6 1 6.4 1 7v1c0 0.6 0.4 1 1 1h4v4c0 0.6 0.4 1 1 1h1c0.6 0 1 -0.4 1 -1V9h4c0.6 0 1 -0.4 1 -1V7c0 -0.6 -0.4 -1 -1 -1H9V2c0 -0.6 -0.4 -1 -1 -1H7z"/>\n</svg>',ice_cream_on_cone_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.44 8.17a3.47 3.47 0 0 0 2 -0.63A3.5 3.5 0 0 0 9 8.14h0.44L8 13.7a0.5 0.5 0 0 1 -0.92 0Zm6 -3.47a2 2 0 0 1 -4 0h0a2 2 0 1 1 -2 -2h0.12a2 2 0 1 1 3.75 0h0.13A2 2 0 0 1 11.44 4.7Z"/>\n</svg>',industrial_building_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14 1v12H1V8.72c0 -0.14 0.06 -0.28 0.17 -0.37l3 -3.22c0.21 -0.18 0.52 -0.16 0.71 0.05C4.96 5.27 5 5.39 5 5.51v3l3.16 -3.37c0.2 -0.19 0.52 -0.18 0.71 0.03C8.95 5.26 9 5.38 9 5.51V11h3V1H14z"/>\n</svg>',info_i_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.5 1C6.7 1 6 1.7 6 2.5S6.7 4 7.5 4S9 3.3 9 2.5S8.3 1 7.5 1zM4 5v1c0 0 2 0 2 2v2c0 2 -2 2 -2 2v1h7v-1c0 0 -2 0 -2 -2V6c0 -0.5 -0.5 -1 -1 -1H4z"/>\n</svg>',jewel_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M15 5.5C15 5.5 11.5 1.5 11.5 1.5C11.5 1.5 3.5 1.5 3.5 1.5C3.5 1.5 0 5.5 0 5.5C0 5.5 7.5 14 7.5 14C7.5 14 15 5.5 15 5.5zM10.75 5.5L11.5 2.5L14 5.5L10.75 5.5zM10.5 6.25L13.25 6.25L8.5 12L10.5 6.25zM10 5.5L8 2.25L10.75 2.25L10 5.5zM5.5 6.25L9.5 6.25L7.5 12.5L5.5 6.25zM5.75 5.5L7.5 2.5L9.25 5.5L5.75 5.5zM5 5.5L4.25 2.25L7 2.25L5 5.5zM6.5 12L1.5 6.25L4.5 6.25L6.5 12zM3.5 2.5L4.25 5.5L1 5.5L3.5 2.5z"/>\n</svg>',lowrise_building_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3 2v11h5v-3h3v3h1V2H3zM7 12H4v-2h3V12zM7 9H4V7h3V9zM7 6H4V4h3V6zM11 9H8V7h3V9zM11 6H8V4h3V6z"/>\n</svg>',market_stall_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1 1L1 1.93L1 2.86C1 3.88 1.83 4.71 2.86 4.71C3.88 4.71 4.71 3.88 4.71 2.86L5.64 2.86C5.64 3.88 6.47 4.71 7.5 4.71C8.53 4.71 9.36 3.88 9.36 2.86L10.29 2.86C10.29 3.88 11.12 4.71 12.14 4.71C13.17 4.71 14 3.88 14 2.86L14 1.93L14 1L12.14 1L1 1ZM1 5.64L1 9.36L1 11.21L1 14L2.86 14L2.86 11.21L12.14 11.21L12.14 14L14 14L14 11.21L14 9.36L14 5.64L12.14 5.64L12.14 9.36L2.86 9.36L2.86 5.64L1 5.64Z"/>\n</svg>',memorial_stone_with_inscription_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M13.5 13L14 15L1 15L1.5 13L13.5 13ZM7.5 0C9.5 0 11 1 12 3L12 12.5L3 12.5L3 3C4 1 5.5 0 7.5 0ZM9.5 8L5.5 8L5.5 9L9.5 9L9.5 8ZM10.5 6L4.5 6L4.5 7L10.5 7L10.5 6ZM9 4L6 4L6 5L9 5L9 4Z"/>\n</svg>',mobile_phone_with_keypad_and_antenna_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10.5 0C10.78 0 11 0.22 11 0.5L11 13.18C11 13.82 10.6 14.4 10 14.63C9.34 14.87 8.64 15 7.93 15L7.07 15C6.36 15 5.66 14.87 5 14.63C4.4 14.4 4 13.82 4 13.18L4 3.82C4 3.18 4.4 2.6 5 2.38C5.66 2.13 6.36 2 7.07 2L7.93 2C8.64 2 9.34 2.13 10 2.38L10 0.5C10 0.22 10.22 0 10.5 0ZM5.75 12L5.25 12C5.11 12 5 12.11 5 12.25L5 12.75C5 12.89 5.11 13 5.25 13L5.75 13C5.89 13 6 12.89 6 12.75L6 12.25C6 12.11 5.89 12 5.75 12ZM7.75 12L7.25 12C7.11 12 7 12.11 7 12.25L7 12.75C7 12.89 7.11 13 7.25 13L7.75 13C7.89 13 8 12.89 8 12.75L8 12.25C8 12.11 7.89 12 7.75 12ZM9.75 12L9.25 12C9.11 12 9 12.11 9 12.25L9 12.75C9 12.89 9.11 13 9.25 13L9.75 13C9.89 13 10 12.89 10 12.75L10 12.25C10 12.11 9.89 12 9.75 12ZM5.75 10L5.25 10C5.11 10 5 10.11 5 10.25L5 10.75C5 10.89 5.11 11 5.25 11L5.75 11C5.89 11 6 10.89 6 10.75L6 10.25C6 10.11 5.89 10 5.75 10ZM7.75 10L7.25 10C7.11 10 7 10.11 7 10.25L7 10.75C7 10.89 7.11 11 7.25 11L7.75 11C7.89 11 8 10.89 8 10.75L8 10.25C8 10.11 7.89 10 7.75 10ZM9.75 10L9.25 10C9.11 10 9 10.11 9 10.25L9 10.75C9 10.89 9.11 11 9.25 11L9.75 11C9.89 11 10 10.89 10 10.75L10 10.25C10 10.11 9.89 10 9.75 10ZM5.75 8L5.25 8C5.11 8 5 8.11 5 8.25L5 8.75C5 8.89 5.11 9 5.25 9L5.75 9C5.89 9 6 8.89 6 8.75L6 8.25C6 8.11 5.89 8 5.75 8ZM7.75 8L7.25 8C7.11 8 7 8.11 7 8.25L7 8.75C7 8.89 7.11 9 7.25 9L7.75 9C7.89 9 8 8.89 8 8.75L8 8.25C8 8.11 7.89 8 7.75 8ZM9.75 8L9.25 8C9.11 8 9 8.11 9 8.25L9 8.75C9 8.89 9.11 9 9.25 9L9.75 9C9.89 9 10 8.89 10 8.75L10 8.25C10 8.11 9.89 8 9.75 8ZM9.5 5L5.5 5C5.22 5 5 5.22 5 5.5L5 6.5C5 6.78 5.22 7 5.5 7L9.5 7C9.78 7 10 6.78 10 6.5L10 5.5C10 5.22 9.78 5 9.5 5ZM8.5 3L6.5 3C6.22 3 6 3.22 6 3.5C6 3.78 6.22 4 6.5 4L8.5 4C8.78 4 9 3.78 9 3.5C9 3.22 8.78 3 8.5 3Z"/>\n</svg>',molar_tooth_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4.36 14c-1 0 -0.56 -2.67 -0.86 -5c-0.1 -0.76 -1 -1.49 -1.12 -2.06C2 5 1.39 1.44 3.66 1S6 3 7.54 3s1.57 -2.36 3.85 -2s1.59 3.9 1.29 5.9c-0.1 0.45 -1.1 1.48 -1.18 2.06c-0.33 2.4 0.32 5 -0.8 5c-0.93 0 -1.32 -2.72 -2 -4.5C8.43 8.63 8.06 8 7.54 8C6 8 5.75 14 4.36 14z"/>\n</svg>',needle_and_spool_of_thread_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.87 1.98L5.13 1.97C4.97 1.97 4.83 1.97 4.68 1.97C3.24 2 2.41 2.16 2.1 2.71C1.65 3.5 2.47 4.27 4.54 5.33L5.23 5.68C5.72 5.93 6.09 6.14 6.35 6.32C6.4 6.35 6.45 6.38 6.49 6.41L6.29 6.46L5.62 6.58L5 6.71C3.41 7.09 2.5 7.73 2.5 9L2.5 13L7.5 13L7.5 9L3.5 9C3.5 8.39 3.99 8.02 5.03 7.74L5.23 7.69C5.36 7.66 5.49 7.63 5.65 7.6L6.37 7.46L6.68 7.39C6.91 7.34 7.08 7.29 7.22 7.22C7.61 7.04 7.84 6.71 7.69 6.28C7.53 5.83 6.88 5.4 5.46 4.67L5.22 4.55C4.25 4.06 3.59 3.66 3.23 3.35L3.07 3.21C3.03 3.17 3.01 3.16 2.99 3.17L2.98 3.19C3.1 3.12 3.69 3.01 4.51 2.98L4.7 2.97C5.09 2.96 5.48 2.97 6.02 2.98L6.37 3C6.39 3 6.41 3 6.43 3L7.54 4.58C8.97 6.6 11.46 10.04 15 14.92L11.07 6.14C9.65 3 8.86 1.28 8.68 0.98C8.24 0.21 7.37 -0.3 6.5 0.2C5.81 0.6 5.68 1.32 5.87 1.98ZM9 13.5L9 8.5C9 8.22 8.78 8 8.5 8C8.22 8 8 8.22 8 8.5L8 13.5C8 13.78 8.22 14 8.5 14C8.78 14 9 13.78 9 13.5ZM2 13.5L2 8.5C2 8.22 1.78 8 1.5 8C1.22 8 1 8.22 1 8.5L1 13.5C1 13.78 1.22 14 1.5 14C1.78 14 2 13.78 2 13.5ZM7.82 3.48L6.82 1.75C6.68 1.51 6.76 1.2 7 1.06C7.24 0.93 7.54 1.01 7.68 1.25L8.68 2.98C8.82 3.22 8.74 3.52 8.5 3.66C8.29 3.78 8.03 3.74 7.87 3.55L7.82 3.48Z"/>\n</svg>',open_book_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M0.09 10.16C-0.01 10.08 0 9.94 0 9.94L0.61 2.77C0.61 2.77 0.62 2.69 0.66 2.66C0.67 2.62 0.7 2.59 0.75 2.57C1.36 2.33 4.67 0.54 6.35 2.2C6.62 2.52 6.92 2.99 6.92 3.35L6.92 9.41C6.92 9.41 6.93 9.54 6.81 9.62C6.78 9.64 6.67 9.69 6.53 9.62C3.96 8.35 1.1 9.79 0.37 10.18C0.23 10.25 0.12 10.17 0.09 10.16ZM14.63 10.18C13.9 9.8 11.04 8.35 8.47 9.62C8.33 9.69 8.22 9.63 8.19 9.62C8.07 9.54 8.08 9.41 8.08 9.41L8.08 3.35C8.08 2.99 8.38 2.52 8.65 2.2C10.33 0.54 13.62 2.33 14.23 2.57C14.28 2.59 14.31 2.62 14.33 2.65C14.37 2.69 14.38 2.77 14.38 2.77L15 9.94C15 9.94 15.01 10.08 14.91 10.16C14.88 10.17 14.77 10.25 14.63 10.18ZM9.07 13.31C9.12 13.3 9.18 13.27 9.21 13.22C9.23 13.18 9.25 13.15 9.25 13.09C9.31 12.02 11.12 11.02 14.62 13.06C14.71 13.11 14.82 13.11 14.9 13.04C15 12.97 15 12.85 15 12.85L15 12.22C15 12.22 15 12.13 14.97 12.09C14.94 12.05 14.91 12.02 14.86 11.98C12.52 10.48 9.57 9.8 8.07 11.8C8.04 11.84 8.02 11.87 7.98 11.9C7.93 11.95 7.85 11.95 7.85 11.95L7.17 11.95C7.17 11.95 7.08 11.95 7.02 11.9C6.97 11.87 6.96 11.84 6.93 11.8C5.43 9.8 2.48 10.45 0.14 11.95C0.09 11.97 0.06 12.01 0.03 12.05C0 12.1 0 12.19 0 12.19L0 12.82C0 12.82 0 12.95 0.09 13.01C0.18 13.08 0.29 13.08 0.37 13.04C3.85 11 5.68 12.03 5.73 13.11C5.73 13.16 5.76 13.19 5.78 13.23C5.8 13.27 5.87 13.31 5.92 13.32C6.76 13.52 7.97 13.6 9.07 13.31Z"/>\n</svg>',palace_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.86 2.14L11.79 3.75L11.79 4.29L15 4.29L15 3.75L13.93 2.14L12.86 2.14ZM1.07 2.14L0 3.75L0 4.29L3.21 4.29L3.21 3.75L2.14 2.14L1.07 2.14ZM4.29 4.29L10.71 4.29L10.71 3.21L7.5 0L4.29 3.21L4.29 4.29ZM0 5.36L0 13.93L5.36 13.93C5.36 12.86 5.36 10.71 7.5 10.71C9.64 10.71 9.64 12.86 9.64 13.93L15 13.93L15 5.36L11.81 5.36L11.79 6.43L10.71 6.43L10.75 5.36L4.33 5.36L4.29 6.43L3.21 6.43L3.21 5.36L0 5.36ZM3.21 8.57C4.29 8.57 4.29 9.64 4.29 10.71L2.14 10.71C2.14 9.64 2.14 8.57 3.21 8.57ZM11.79 8.57C12.86 8.57 12.86 9.35 12.86 10.71L10.71 10.74C10.68 9.37 10.71 8.57 11.79 8.57Z"/>\n</svg>',p_wide_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10 0C12.76 0 15 2.24 15 5C15 7.76 12.76 10 10 10L5 10L5 15L2 15L2 0L10 0ZM5 7L10 7C11.1 7 12 6.1 12 5C12 3.9 11.1 3 10 3L5 3L5 7Z"/>\n</svg>',person_cricket_batting_at_cricket_ball_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M8 1.5C8 2.33 7.33 3 6.5 3S5 2.33 5 1.5S5.67 0 6.5 0S8 0.67 8 1.5zM10.88 7.18L10.88 7.18l-2 -2l0 0l0 0C8.78 5.06 8.63 5 8.48 5H3.75C3.37 4.99 3.05 5.27 3 5.64l0 0l-1 7.7l0 0c-0.01 0.05 -0.01 0.09 0 0.14c0 0.28 0.22 0.5 0.5 0.5c0.23 0.02 0.43 -0.13 0.5 -0.34l0 0l1.2 -3.89l0 0l0.26 -0.83l0.4 0.44l0 0L6 10.6v2.9C6 13.78 6.22 14 6.5 14S7 13.78 7 13.5v-3l0 0l0 0c-0.01 -0.08 -0.04 -0.15 -0.08 -0.22l0 0L5.48 8.5l1 -2.5h1.71l2 1.84l0 0c0.09 0.11 0.23 0.17 0.37 0.17C10.82 7.98 11.01 7.76 11 7.5C11 7.38 10.96 7.27 10.88 7.18zM14 11.27c-0.41 0 -0.75 0.34 -0.75 0.75s0.34 0.75 0.75 0.75s0.75 -0.34 0.75 -0.75S14.41 11.27 14 11.27zM10.76 9.74V9c0 -0.14 -0.11 -0.25 -0.25 -0.25S10.26 8.86 10.26 9v0.74c-0.15 0.09 -0.25 0.25 -0.25 0.42v3.34c0 0.28 0.22 0.5 0.5 0.5s0.5 -0.22 0.5 -0.5v-3.34C11.01 9.99 10.91 9.83 10.76 9.74z"/>\n</svg>',person_boarding_tram_with_destination_display_and_pantograph_on_tram_track_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.5 7.51C5.5 7.64 5.45 7.76 5.35 7.85L4.35 8.85C4.2 9.01 3.96 9.05 3.76 8.94L3.5 8.8L3.5 9.94L4.72 10.55C4.89 10.64 5 10.81 5 11L5 12.5C5 12.78 4.78 13 4.5 13C4.22 13 4 12.78 4 12.5L4 11.31L3.05 10.83C3.03 10.85 3.02 10.86 3 10.87L3 12L2.97 12.16L2.47 13.66C2.39 13.92 2.1 14.06 1.84 13.97C1.58 13.89 1.44 13.6 1.53 13.34L2 11.92L2 10.87C1.7 10.69 1.5 10.37 1.5 10L1.5 8.25C1.5 7.7 1.95 7.25 2.5 7.25C2.71 7.25 2.9 7.31 3.07 7.43L3.91 7.88L4.65 7.15C4.84 6.95 5.16 6.95 5.35 7.15C5.45 7.24 5.5 7.36 5.5 7.49L5.5 4.83C5.5 4.3 5.71 3.79 6.09 3.41L7.5 2L9 2L9 1L7.5 1C7.22 1 7 0.78 7 0.5C7 0.22 7.22 0 7.5 0L11.5 0C11.78 0 12 0.22 12 0.5C12 0.78 11.78 1 11.5 1L10 1L10 2L11.5 2L12.91 3.41C13.29 3.79 13.5 4.3 13.5 4.83L13.5 11C13.5 12.1 12.6 13 11.5 13L7.5 13C6.4 13 5.5 12.1 5.5 11L5.5 7.51ZM8.25 13.5L7.5 15L6 15L6.75 13.5L8.25 13.5ZM12.25 13.5L13 15L11.5 15L10.75 13.5L12.25 13.5ZM10.5 12L11.5 12C12.05 12 12.5 11.55 12.5 11L12.5 10C11.4 10 10.5 10.9 10.5 12ZM8.5 12C8.5 10.9 7.6 10 6.5 10L6.5 11C6.5 11.55 6.95 12 7.5 12L8.5 12ZM6.5 5.5L6.5 8.5C6.5 8.78 6.72 9 7 9L12 9C12.28 9 12.5 8.78 12.5 8.5L12.5 5.5C12.5 5.22 12.28 5 12 5L7 5C6.72 5 6.5 5.22 6.5 5.5ZM7.5 3.5C7.5 3.78 7.72 4 8 4L11 4C11.28 4 11.5 3.78 11.5 3.5C11.5 3.22 11.28 3 11 3L8 3C7.72 3 7.5 3.22 7.5 3.5ZM2.5 7C1.95 7 1.5 6.55 1.5 6C1.5 5.45 1.95 5 2.5 5C3.05 5 3.5 5.45 3.5 6C3.5 6.55 3.05 7 2.5 7Z"/>\n</svg>',person_jockeying_racehorse_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10 1C9.73 1 9.48 1.11 9.29 1.29C9.11 1.48 9 1.73 9 2C9 2.27 9.11 2.52 9.29 2.71C9.48 2.89 9.73 3 10 3C10.27 3 10.52 2.89 10.71 2.71C10.89 2.52 11 2.27 11 2C11 1.73 10.89 1.48 10.71 1.29C10.52 1.11 10.27 1 10 1ZM5.5 3C5.25 3 4.5 3 5 3.75L6.25 6H4.5C4.22 6 3.98 6.1 3.75 6.25C2.94 5.12 2.24 5.55 1.51 6C1.11 6.25 0.69 6.5 0.25 6.5C0.18 6.5 0.12 6.53 0.08 6.58C0.03 6.62 0 6.68 0 6.75C0 6.82 0.03 6.88 0.08 6.92C0.12 6.97 0.18 7 0.25 7C0.63 7.02 1.06 6.91 1.49 6.79C2.14 6.62 2.8 6.45 3.25 6.75C3.16 6.94 3 7.5 3 8L3 9.51C2.79 9.71 2.62 9.63 2.44 9.55C2.3 9.49 2.16 9.42 2 9.5L1 12.45C1 12.7 1.39 12.75 1.5 12.5L2.25 10.74C3 10.74 4.5 10 5 9L9 10L11.5 12.5C11.7 12.7 12.12 12.36 11.96 12.12L10 9L12 6.5C12.25 7 12.5 7 12.99 7H13L13.6 7.75C13.99 8.24 14.82 7.74 14.5 7.25L12.83 4.79L13 4.5C13.06 4.31 12.64 3.92 12.5 4L10.5 5.5L8.89 3.19C8.84 3.13 8.78 3.08 8.72 3.05C8.65 3.02 8.57 3 8.5 3H5.5ZM9 5.25L9.5 6L6.78 7.92C6.72 7.95 6.66 7.98 6.6 8C6.53 8.01 6.46 8.01 6.4 8C6.33 7.99 6.27 7.96 6.21 7.93C6.16 7.89 6.11 7.84 6.07 7.79C6.03 7.73 6.01 7.67 6 7.6C5.98 7.54 5.98 7.47 6 7.4C6.01 7.34 6.04 7.28 6.08 7.22C6.12 7.17 6.17 7.12 6.22 7.08L9 5.25Z"/>\n</svg>',person_playing_tennis_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M13.27 7.26C13.57 7.26 13.82 7.51 13.82 7.82C13.82 8.12 13.57 8.36 13.27 8.36C12.96 8.36 12.72 8.12 12.72 7.82C12.72 7.51 12.96 7.27 13.27 7.27L13.27 7.26ZM5.62 2.69C4.96 2.69 4.43 2.15 4.43 1.49C4.43 0.83 4.96 0.3 5.62 0.3C6.28 0.3 6.82 0.83 6.82 1.49C6.82 2.15 6.28 2.69 5.62 2.69ZM0.48 13.31L2.42 11.02L3.03 7.48L3.56 5.09L2.96 5.43L1.94 7.39C1.86 7.53 1.73 7.64 1.58 7.68C1.42 7.73 1.25 7.72 1.11 7.64C0.97 7.57 0.86 7.44 0.82 7.28C0.77 7.13 0.78 6.96 0.86 6.82L1.99 4.68C2.01 4.65 2.03 4.61 2.07 4.57C2.15 4.49 2.33 4.39 2.33 4.39L4.49 3.17C4.76 3.03 5.06 2.98 5.37 3.05C5.49 3.08 5.61 3.12 5.74 3.2L5.77 3.21C5.88 3.27 6.27 3.5 6.51 4.06L7.62 6.29L9.37 6.63L9.41 6.64L10.99 5.53C11.34 5.28 11.39 4.54 11.39 4.51C11.43 4 11.73 3.52 12.2 3.19C12.62 2.89 13.13 2.76 13.6 2.84C13.97 2.9 14.27 3.09 14.47 3.36C14.63 3.58 14.71 3.84 14.71 4.11L14.69 4.35C14.6 4.82 14.32 5.26 13.89 5.56C13.47 5.87 12.96 5.99 12.49 5.91L12.38 5.89C12.37 5.89 11.67 5.67 11.32 5.9L9.83 6.96L9.87 7.05C9.9 7.1 9.92 7.17 9.91 7.24C9.91 7.28 9.91 7.31 9.9 7.35C9.84 7.68 9.52 7.9 9.19 7.83L7.09 7.42C7.09 7.42 6.91 7.37 6.84 7.31C6.77 7.27 6.72 7.19 6.69 7.14L6.11 5.99L5.73 7.79C5.73 7.81 5.73 7.82 5.73 7.82L7.45 9.63L7.51 9.67C7.67 9.82 7.8 10.01 7.8 10.22L7.8 13.98C7.8 14.39 7.45 14.71 7.05 14.71C6.65 14.71 6.3 14.39 6.3 13.98L6.3 10.85C6 10.69 4.85 9.33 4.5 8.98L4.13 11.09C4.11 11.23 4.04 11.36 3.96 11.46L1.58 14.26C1.46 14.4 1.28 14.5 1.09 14.51C0.89 14.53 0.71 14.47 0.56 14.34C0.39 14.2 0.3 13.99 0.3 13.79C0.3 13.65 0.33 13.52 0.41 13.41L0.48 13.31ZM12 5.12C12.13 5.3 12.33 5.41 12.57 5.45C12.92 5.51 13.3 5.42 13.62 5.18C13.94 4.95 14.16 4.62 14.22 4.28L14.24 4.11C14.24 3.93 14.19 3.77 14.09 3.63C13.77 3.19 13.05 3.16 12.47 3.57C11.94 3.95 11.72 4.58 11.94 5.03L12 5.12Z"/>\n</svg>',person_running_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10.48 2.31C11.12 2.31 11.63 1.79 11.63 1.15C11.63 0.52 11.12 0 10.48 0C9.85 0 9.33 0.52 9.33 1.15C9.33 1.79 9.85 2.31 10.48 2.31ZM1.83 10.38L4.71 10.38L5.87 6.92L7.02 4.9L5.87 4.62L3.21 5.77C2.89 5.9 2.53 5.75 2.4 5.42C2.29 5.14 2.4 4.82 2.65 4.67L2.75 4.62L5.87 3.46L8.17 3.46L10.48 4.62L11.63 5.77L13.37 5.77C13.69 5.77 13.94 6.02 13.94 6.35C13.94 6.67 13.69 6.92 13.37 6.92L10.48 6.92L9.33 5.77L8.17 8.08L10.48 10.38L10.48 14.42C10.48 14.75 10.23 15 9.9 15C9.58 15 9.33 14.75 9.33 14.42L9.33 10.83L7.02 9.23L5.87 11.54L1.83 11.54C1.5 11.54 1.25 11.28 1.25 10.96C1.25 10.64 1.5 10.38 1.83 10.38Z"/>\n</svg>',person_sleeping_in_bed_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M0.5 2.5C0.2 2.5 0 2.7 0 3L0 10.5L0 12.5C0 12.8 0.2 13 0.5 13C0.8 13 1 12.8 1 12.5L1 11L14 11L14 12.5C14 12.8 14.2 13 14.5 13C14.8 13 15 12.8 15 12.5L15 10.5C15 10.2 14.8 10 14.5 10L1 10L1 3C1 2.7 0.8 2.5 0.5 2.5ZM3.5 3C2.7 3 2 3.7 2 4.5L2 4.5C2 5.3 2.7 6 3.5 6L3.5 6C4.3 6 5 5.3 5 4.5L5 4.5C5 3.7 4.3 3 3.5 3L3.5 3ZM7 4C5.5 4 5.5 5.5 5.5 5.5L5.5 7L3 7C2.45 7 2 7.45 2 8C2 8.55 2.45 9 3 9L6 9L6 9L15 9L15 6.5C15 4 12.5 4 12.5 4L7 4Z"/>\n</svg>',person_swimming_in_water_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.5 9.5C12.82 9.5 13.14 9.61 13.39 9.81L13.71 10.07C14.01 10.31 14.39 10.46 14.78 10.5L15 10.5L15 12L14.95 12C14.49 12 14.06 11.84 13.71 11.56L13.39 11.31C13.14 11.11 12.82 11 12.5 11C12.18 11 11.86 11.11 11.61 11.31L11.3 11.56C10.94 11.84 10.5 12 10.05 12L9.95 12C9.5 12 9.06 11.84 8.7 11.56L8.39 11.31C8.14 11.11 7.82 11 7.5 11C7.18 11 6.86 11.11 6.61 11.31L6.3 11.56C5.94 11.84 5.5 12 5.05 12L4.95 12C4.5 12 4.06 11.84 3.7 11.56L3.39 11.31C3.14 11.11 2.82 11 2.5 11C2.18 11 1.86 11.11 1.61 11.31L1.29 11.56C0.99 11.81 0.61 11.96 0.22 11.99L0 12L0 10.5L0.05 10.5C0.51 10.5 0.94 10.35 1.29 10.07L1.61 9.81C1.86 9.61 2.18 9.5 2.5 9.5C2.82 9.5 3.14 9.61 3.39 9.81L3.7 10.06C4.06 10.35 4.5 10.5 4.95 10.5L5.05 10.5C5.5 10.5 5.94 10.35 6.3 10.06L6.61 9.81C6.86 9.61 7.18 9.5 7.5 9.5C7.82 9.5 8.14 9.61 8.39 9.81L8.7 10.06C9.06 10.35 9.5 10.5 9.95 10.5L10.05 10.5C10.5 10.5 10.94 10.35 11.3 10.06L11.61 9.81C11.86 9.61 12.18 9.5 12.5 9.5ZM10.11 2C10.64 2 11 2.29 11 2.5L11.01 2.71C11.01 2.93 10.98 3.2 10.67 3.4L8 5L11.05 8.98L10.67 9.28C10.5 9.42 10.28 9.5 10.05 9.5L9.95 9.5C9.72 9.5 9.5 9.42 9.33 9.28L9.01 9.03C8.58 8.69 8.05 8.5 7.5 8.5C6.95 8.5 6.42 8.69 5.99 9.03L5.67 9.28C5.5 9.42 5.28 9.5 5.05 9.5L4.95 9.5C4.72 9.5 4.5 9.42 4.33 9.28L4.01 9.03C3.7 8.78 3.33 8.61 2.94 8.54L3 8.5L6.97 6.47L6 5.06C5.74 4.71 5.91 4 6.35 3.83L9.68 2.15C9.68 2.15 10 2 10.11 2ZM12.25 5C13.22 5 14 5.78 14 6.75C14 7.72 13.22 8.5 12.25 8.5C11.28 8.5 10.5 7.72 10.5 6.75C10.5 5.78 11.28 5 12.25 5Z"/>\n</svg>',person_swinging_golf_club_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3.4 1.1c0 0.1 0 0.2 0 0.2c0 0.4 0.3 0.7 0.7 0.7c0.3 0 0.5 -0.2 0.6 -0.5l0 0L4.9 1l5.6 2.3L6.6 6C6.2 6.3 6.2 6.7 6.3 7.1l0.9 2.1l-1.3 3.9C5.7 13.6 6.1 14 6.5 14c0.3 0 0.5 -0.1 0.6 -0.5l1.4 -4l0.1 0.3v3.5c0 0 0 0.7 0.7 0.7s0.7 -0.7 0.7 -0.7V10c0 -0.2 0 -0.3 -0.1 -0.5L8.5 6.1l2.7 -1.9c0.2 -0.2 0.4 -0.3 0.4 -0.6s-0.2 -0.5 -0.4 -0.6L4 0.1c-0.09 0 -0.12 0.02 -0.2 0.1L3.4 1.1zM5.5 3C4.7 3 4 3.7 4 4.5S4.7 6 5.5 6S7 5.3 7 4.5S6.3 3 5.5 3z"/>\n</svg>',plant_in_raised_planter_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12 12L12 10.5C12 10.22 12.22 10 12.5 10L13.5 10C13.78 10 14 10.22 14 10.5L14 12L14 13.5C14 13.78 13.78 14 13.5 14L1.5 14C1.22 14 1 13.78 1 13.5L1 12L1 10.5C1 10.22 1.22 10 1.5 10L2.5 10C2.78 10 3 10.22 3 10.5L3 12L12 12ZM7 5.5L5.66 4.83C4.64 4.32 4 3.28 4 2.15L4 1C5.6 1.53 6.87 2.73 7.5 4.26C8.13 2.73 9.4 1.53 11 1L11 2.15C11 3.28 10.36 4.32 9.34 4.83L8 5.5L8 7.96C8.94 6.55 10.35 5.5 12 5C12 7.42 10.28 9.44 8 9.9L8 11.5L7 11.5L7 9.9C4.72 9.44 3 7.42 3 5C4.65 5.5 6.06 6.55 7 7.96L7 5.5Z"/>\n</svg>',place_of_worship_building_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.5 0l-2 2v2h4V2L7.5 0zM5.5 4.5L4 6h7L9.5 4.5H5.5zM2 6.5c-0.55 0 -1 0.45 -1 1V13h2V7.5C3 6.95 2.55 6.5 2 6.5zM4 6.5V13h7V6.5H4zM13 6.5c-0.55 0 -1 0.45 -1 1V13h2V7.5C14 6.95 13.55 6.5 13 6.5z"/>\n</svg>',play_structure_with_slide_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M6 10L6 10.01L6 14L5 14L5 11.13L2.75 13.66C2.38 14.08 1.75 14.11 1.34 13.75C0.92 13.38 0.89 12.75 1.25 12.34L5 8.12L5 4L4 4L4 3L7.5 1L11 3L11 4L10 4L10 8L12.5 12L13 12C13.55 12 14 12.45 14 13L14 13C14 13.55 13.55 14 13 14C13 14 13 14 13 14L11.5 14L10 11.6L10 14L9 14L9 10L6 10ZM6.59 7.69C6.6 7.7 6.6 7.7 6.61 7.71C6.86 7.89 7.17 8 7.5 8C8.33 8 9 7.33 9 6.5C9 5.67 8.33 5 7.5 5C6.67 5 6 5.67 6 6.5C6 6.99 6.23 7.42 6.59 7.69L6.59 7.69Z"/>\n</svg>',police_officer_with_stop_arm_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14 7L14 13.5C14 13.5 14 13.5 14 13.5C14 13.78 13.77 14 13.5 14L8 13.98L14 7ZM7 13.5L7 9L2 9C1.45 9 1 8.55 1 8C1 7.45 1.45 7 2 7L12.5 7L7 13.5ZM13 4C13.09 4.43 12.99 6.5 10.5 6.5C8 6.5 7.98 4.44 8.07 4L10.5 5L13 4ZM14 2.75L10.5 4.25L7 2.75L7 1C7.92 0.95 8.59 0.87 9 0.75C9.41 0.63 9.9 0.38 10.46 0C11.04 0.37 11.55 0.62 12 0.75C12.45 0.88 13.11 0.96 14 1L14 2.75ZM11.5 2.01C11.44 1.94 11.38 1.88 11.3 1.82C10.75 1.38 9.94 1.46 9.5 2.01L9.5 2.01L10.11 2.77C10.13 2.8 10.16 2.83 10.19 2.85C10.4 3.02 10.72 2.99 10.89 2.77L11.5 2.01Z"/>\n</svg>',plane_top_right_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14.12 0.88C14.48 1.24 14.12 3 13.06 4.07L12 5.13L12 13.61L11.3 14.32L9 8.13L6.7 10.43L6.69 13.25L5.98 13.95L4.39 10.59L1.03 9L1.74 8.3L4.58 8.31L6.88 6.01L0.69 3.71L1.4 3L9.88 3L10.94 1.94C12 0.88 13.77 0.53 14.12 0.88Z"/>\n</svg>',round_structure_with_flag_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7 1v2v1.5v0.51C4.17 5.1 2 5.97 2 7v4.5c0 1.1 2.46 2 5.5 2s5.5 -0.9 5.5 -2V7c0 -1.03 -2.17 -1.9 -5 -1.99V4.06L11 2.75L7 1zM3 8.15c0.51 0.27 1.2 0.48 2 0.63v2.97C3.79 11.48 3 11.02 3 10.5V8.15zM12 8.15V10.5c0 0.52 -0.79 0.98 -2 1.25V8.78C10.8 8.63 11.49 8.42 12 8.15zM6 8.92C6.49 8.97 6.99 9 7.5 9C8.01 9 8.51 8.97 9 8.92v2.98C8.53 11.96 8.03 12 7.5 12S6.47 11.96 6 11.91V8.92z"/>\n</svg>',sailing_ship_in_water_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.5 12.5C12.82 12.5 13.14 12.61 13.39 12.81L13.71 13.07C14.01 13.31 14.39 13.46 14.78 13.5L15 13.5L15 15L14.95 15C14.49 15 14.06 14.84 13.71 14.56L13.39 14.31C13.14 14.11 12.82 14 12.5 14C12.18 14 11.86 14.11 11.61 14.31L11.3 14.56C10.94 14.84 10.5 15 10.05 15L9.95 15C9.5 15 9.06 14.84 8.7 14.56L8.39 14.31C8.14 14.11 7.82 14 7.5 14C7.18 14 6.86 14.11 6.61 14.31L6.3 14.56C5.94 14.84 5.5 15 5.05 15L4.95 15C4.5 15 4.06 14.84 3.7 14.56L3.39 14.31C3.14 14.11 2.82 14 2.5 14C2.18 14 1.86 14.11 1.61 14.31L1.29 14.56C0.99 14.81 0.61 14.96 0.22 14.99L0 15L0 13.5L0.05 13.5C0.51 13.5 0.94 13.35 1.29 13.07L1.61 12.81C1.86 12.61 2.18 12.5 2.5 12.5C2.82 12.5 3.14 12.61 3.39 12.81L3.7 13.06C4.06 13.35 4.5 13.5 4.95 13.5L5.05 13.5C5.5 13.5 5.94 13.35 6.3 13.06L6.61 12.81C6.86 12.61 7.18 12.5 7.5 12.5C7.82 12.5 8.14 12.61 8.39 12.81L8.73 13L8.63 13L8.7 13.06C9.01 13.31 9.39 13.46 9.78 13.49L9.95 13.5L10.05 13.5C10.5 13.5 10.94 13.35 11.3 13.06L11.61 12.81C11.86 12.61 12.18 12.5 12.5 12.5ZM7.48 0C7.5 0 7.52 0.01 7.53 0.03C7.54 0.03 7.55 0.06 7.55 0.08L7.6 2.51L9.48 3.66C9.51 3.67 9.53 3.71 9.54 3.74C9.68 4.39 9.83 5.04 9.85 5.7C9.87 6.36 9.74 7.04 9.3 7.7C9.27 7.77 9.2 7.78 9.15 7.75C8.71 7.48 8.22 7.32 7.69 7.24L7.73 9.23C9.41 9.16 10.16 8.6 10.52 8.07C10.89 7.51 10.85 7 10.85 7C10.84 6.86 10.92 6.74 11.05 6.71L13.69 6.09L13.73 6.08C13.84 6.08 13.95 6.16 13.98 6.27C14.03 6.4 13.98 6.53 13.89 6.6L12.15 7.85C12.29 8.71 12.41 9.59 12.27 10.43C12.2 10.8 12.07 11.2 11.86 11.59C11.54 11.67 11.24 11.82 10.98 12.03L10.67 12.28C10.5 12.42 10.28 12.5 10.05 12.5L9.95 12.5C9.72 12.5 9.5 12.42 9.33 12.28L9.01 12.03C8.58 11.69 8.05 11.5 7.5 11.5C6.95 11.5 6.42 11.69 5.99 12.03L5.67 12.28C5.5 12.42 5.28 12.5 5.05 12.5L4.95 12.5C4.72 12.5 4.5 12.42 4.33 12.28L4.01 12.03C3.71 11.79 3.35 11.62 2.97 11.55C2.82 11.13 2.75 10.53 2.78 9.61L1.66 9.27C1.63 9.27 1.6 9.25 1.58 9.23L1.55 9.2C1.24 8.86 1.05 8.41 1.01 7.96C0.97 7.5 1.08 7.02 1.4 6.67C1.46 6.61 1.55 6.58 1.62 6.6L4.06 7.16C4.09 7.17 4.13 7.18 4.16 7.21C5.43 5.26 5.91 3.33 5.32 1.4C5.32 1.36 5.32 1.31 5.34 1.27C5.37 1.24 5.4 1.22 5.45 1.22C5.46 1.22 5.49 1.23 5.51 1.24L7.4 2.39L7.4 1.45L7.39 1.46C7.21 1.52 6.99 1.53 6.78 1.47C6.56 1.43 6.36 1.32 6.21 1.13C6.07 0.94 6.01 0.78 5.94 0.65C5.87 0.52 5.8 0.43 5.62 0.36C5.58 0.34 5.56 0.29 5.56 0.26C5.56 0.22 5.58 0.17 5.62 0.16C5.77 0.1 5.89 0.08 6 0.1C6.1 0.13 6.19 0.19 6.26 0.25L6.42 0.39C6.5 0.46 6.58 0.52 6.69 0.54C6.9 0.57 6.98 0.55 7.06 0.48C7.14 0.41 7.22 0.28 7.38 0.1C7.39 0.1 7.4 0.09 7.41 0.08C7.41 0.03 7.44 0 7.48 0ZM7.54 10.04C7.4 10.04 7.26 10.1 7.16 10.2C7.06 10.3 7 10.44 7 10.59C7 10.9 7.24 11.15 7.54 11.15C7.69 11.15 7.83 11.09 7.93 10.99C8.03 10.89 8.09 10.75 8.09 10.59C8.09 10.44 8.03 10.3 7.93 10.2C7.83 10.1 7.69 10.04 7.54 10.04ZM4.78 9.64C4.63 9.64 4.49 9.7 4.39 9.8C4.29 9.91 4.23 10.05 4.23 10.2C4.23 10.5 4.48 10.76 4.78 10.76C4.93 10.76 5.06 10.69 5.16 10.59C5.26 10.49 5.32 10.35 5.32 10.2C5.32 10.04 5.26 9.91 5.16 9.8C5.06 9.7 4.93 9.64 4.78 9.64ZM10.27 9.52C10.13 9.52 9.99 9.58 9.88 9.68C9.78 9.78 9.73 9.93 9.73 10.08C9.73 10.23 9.78 10.37 9.88 10.47C9.99 10.57 10.13 10.63 10.27 10.63C10.57 10.63 10.82 10.38 10.82 10.08C10.82 9.77 10.57 9.52 10.27 9.52ZM6.93 7.16C6.1 7.14 5.2 7.26 4.26 7.46L4.26 7.53C4.26 7.66 4.29 7.98 4.56 8.31C4.9 8.74 5.66 9.23 7.37 9.24L7.38 8.24L7.38 7.19L6.93 7.16ZM8.57 2.22L8.58 2.22C9.71 2.27 10.46 2.45 10.98 2.71C11.49 2.97 11.76 3.32 11.92 3.67C12.08 4.04 12.15 4.4 12.24 4.73C12.33 5.01 12.45 5.24 12.69 5.42L12.81 5.5C12.83 5.51 12.84 5.53 12.83 5.54C12.82 5.56 12.81 5.56 12.8 5.56C12.43 5.49 11.97 5.65 11.61 5.88C11.43 5.99 11.27 6.12 11.17 6.24C11.06 6.37 11.01 6.49 11.03 6.59C11.03 6.6 11.02 6.61 11.01 6.62L10.98 6.62C10.64 6.38 10.53 6.07 10.51 5.72C10.48 5.37 10.54 4.98 10.53 4.59C10.52 4.19 10.46 3.8 10.17 3.41C9.92 3.04 9.49 2.7 8.78 2.37L8.56 2.28C8.55 2.28 8.54 2.27 8.54 2.26L8.54 2.24C8.54 2.23 8.55 2.22 8.57 2.22Z"/>\n</svg>',open_scissors_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M15 3c0 0 -2 -0.6 -3.5 0.5l-4.3 3C6.4 5.9 5.2 5.2 4 4.8V4c0 -1.1 -0.9 -2 -2 -2C0.9 2 0 2.9 0 4v1.5C0 6 0.5 6 0.5 6H2h0.5C4.5 6 6 7.5 6 7.5S4.5 9 2.5 9H2H0.5C0.5 9 0 9 0 9.5V11c0 1.1 0.9 2 2 2c1.1 0 2 -0.9 2 -2v-0.8c1.2 -0.4 2.4 -1.1 3.2 -1.7l4.3 3C13 12.6 15 12 15 12L8.5 7.5L15 3zM3 5H2H1V4c0 -0.6 0.4 -1 1 -1c0.6 0 1 0.4 1 1V5zM3 11c0 0.6 -0.4 1 -1 1c-0.6 0 -1 -0.4 -1 -1v-1h1h1V11zM7.25 8c-0.28 0 -0.5 -0.22 -0.5 -0.5S6.97 7 7.25 7s0.5 0.22 0.5 0.5S7.53 8 7.25 8z"/>\n</svg>',shipwreck_in_water_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M2.5 11C2.82 11 3.14 11.11 3.39 11.31L3.7 11.56C4.06 11.85 4.5 12 4.95 12L5.05 12C5.5 12 5.94 11.85 6.3 11.56L6.61 11.31C6.86 11.11 7.18 11 7.5 11C7.82 11 8.14 11.11 8.39 11.31L8.7 11.56C9.01 11.81 9.39 11.96 9.78 11.99L9.95 12L10.05 12C10.5 12 10.94 11.85 11.3 11.56L11.61 11.31C11.86 11.11 12.18 11 12.5 11C12.82 11 13.14 11.11 13.39 11.31L13.71 11.57C14.01 11.81 14.39 11.96 14.78 12L15 12L15 13.5L14.95 13.5C14.49 13.5 14.06 13.34 13.71 13.06L13.39 12.81C13.14 12.61 12.82 12.5 12.5 12.5C12.18 12.5 11.86 12.61 11.61 12.81L11.3 13.06C10.94 13.34 10.5 13.5 10.05 13.5L9.95 13.5C9.5 13.5 9.06 13.34 8.7 13.06L8.39 12.81C8.14 12.61 7.82 12.5 7.5 12.5C7.18 12.5 6.86 12.61 6.61 12.81L6.3 13.06C5.94 13.34 5.5 13.5 5.05 13.5L4.95 13.5C4.5 13.5 4.06 13.34 3.7 13.06L3.39 12.81C3.14 12.61 2.82 12.5 2.5 12.5C2.18 12.5 1.86 12.61 1.61 12.81L1.29 13.06C0.94 13.34 0.51 13.5 0.05 13.5L0 13.5L0 12L0.05 12C0.51 12 0.94 11.85 1.29 11.57L1.61 11.31C1.86 11.11 2.18 11 2.5 11ZM5.68 1.82L6.32 3.43L6.75 3.21L7.71 2.79L8.04 3.75L6.64 4.29L8.04 7.5L9.67 6.81C11.53 6.01 12.96 5.36 12.96 5.36L12.66 7.07C12.61 7.37 12.56 7.69 12.51 8.01L12.44 8.45L12.35 9.11C12.31 9.43 12.27 9.74 12.24 10.02C11.78 10.06 11.35 10.24 10.98 10.53L10.67 10.78C10.5 10.92 10.28 11 10.05 11L9.95 11C9.72 11 9.5 10.92 9.33 10.78L9.01 10.53C8.58 10.19 8.05 10 7.5 10C6.95 10 6.42 10.19 5.99 10.53L5.67 10.78C5.5 10.92 5.28 11 5.05 11L4.95 11C4.72 11 4.5 10.92 4.33 10.78L4.01 10.53C3.58 10.19 3.05 10 2.5 10C2.41 10 2.33 10.01 2.24 10.02L2.63 9.84C3.39 9.49 4.7 8.92 6.14 8.31L7.29 7.82L5.89 4.61L4.39 5.25L4.07 4.39L4.82 4.06C5.02 3.96 5.25 3.86 5.46 3.75L4.82 2.14L5.68 1.82Z"/>\n</svg>',steam_train_on_railway_track_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M9 1L9 2C9.55 2 10 2.45 10 3L10 3.88C10.91 4.61 11.5 5.74 11.5 7C11.5 7.69 11.33 8.34 11.02 8.91L11.44 9.71C11.7 10.19 11.52 10.8 11.03 11.06C10.98 11.08 10.93 11.11 10.88 11.12L7.5 12.25L4.12 11.12C3.6 10.95 3.32 10.38 3.49 9.86C3.51 9.81 3.53 9.75 3.56 9.71L3.98 8.91C3.67 8.34 3.5 7.69 3.5 7C3.5 5.74 4.09 4.61 5 3.88L5 3C5 2.45 5.45 2 6 2L6 1L5.5 1C5.22 1 5 0.78 5 0.5C5 0.22 5.22 0 5.5 0L9.5 0C9.78 0 10 0.22 10 0.5C10 0.78 9.78 1 9.5 1L9 1ZM5.79 12.43L5.5 13L9.5 13L9.21 12.43L10.5 12L12 15L10.5 15L10 14L5 14L4.5 15L3 15L4.5 12L5.79 12.43ZM7.5 8C8.05 8 8.5 7.55 8.5 7C8.5 6.45 8.05 6 7.5 6C6.95 6 6.5 6.45 6.5 7C6.5 7.55 6.95 8 7.5 8Z"/>\n</svg>',shopping_bag_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M8.62 1C8.99 1.01 9.35 1.07 9.7 1.18C10.41 1.38 10.95 1.95 11.11 2.67L11.5 5L14.33 5C14.38 5 14.42 5.01 14.47 5.02C14.74 5.11 14.88 5.39 14.8 5.65L12.92 13.95C12.72 14.57 12.15 15 11.5 15L3.5 15C2.85 15 2.27 14.57 2.07 13.95L0.19 5.65C0.18 5.6 0.17 5.55 0.17 5.5C0.17 5.22 0.39 5 0.67 5L3.5 5L3.89 2.67C4.05 1.95 4.59 1.38 5.3 1.18C5.65 1.07 6.01 1.01 6.38 1L8.62 1ZM8.62 2L6.38 2C6.12 2.01 5.87 2.05 5.62 2.13C5.25 2.19 4.96 2.47 4.88 2.83L4.52 5L10.48 5L10.13 2.83C10.05 2.47 9.76 2.19 9.39 2.13C9.14 2.05 8.88 2.01 8.62 2Z"/>\n</svg>',shopping_basket_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3 3.07s0.19 -1.06 1 -1.06H5V1.73a0.5 0.5 0 0 1 0.5 -0.5H9.49a0.5 0.5 0 0 1 0.5 0.5v0.28h1.01a0.83 0.83 0 0 1 0.64 0.29a1.76 1.76 0 0 1 0.36 0.77s0.31 1.57 0.59 2.92h-0.94L11 3L3.98 3L3.33 5.99H2.38Zm11 4.91a1 1 0 0 1 -1 1l-1 3.97s-0.19 1.04 -1 1.04h-7c-0.81 0 -1 -1.04 -1 -1.04L1.98 8.98a1 1 0 0 1 0.02 -2h11A1 1 0 0 1 14 7.98ZM5.03 12.13L5.03 11.01L4.64 9.47a0.54 0.54 0 1 0 -1.06 0.14L3.78 11.01l0.19 1.27A0.54 0.54 0 1 0 5.03 12.13Zm2 -2.6A0.53 0.53 0 0 0 6.5 9l0 0L6.49 9a0.5 0.5 0 0 0 -0.36 0.15a0.53 0.53 0 0 0 -0.16 0.38v2.68a0.53 0.53 0 1 0 1.07 0Zm2 0A0.53 0.53 0 0 0 8.69 9.04a0.5 0.5 0 0 0 -0.39 0a0.53 0.53 0 0 0 -0.34 0.49v2.68a0.53 0.53 0 1 0 1.07 0Zm2.39 0.08a0.54 0.54 0 1 0 -1.06 -0.14L9.96 10.99L9.96 12.13a0.54 0.54 0 1 0 1.06 0.14Z"/>\n</svg>',shopping_cart_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1.75 1.5L1.98 1.5C2.38 1.51 3.31 1.58 3.75 2C4.28 2.52 4.5 2.92 4.5 4L13.8 4L12.41 8.81L12.39 8.84C12.16 9.49 11.55 9.97 10.81 9.99C10.81 10 10.8 10 10.8 10L4.3 10L4.3 10.23C4.31 10.31 4.33 10.52 4.45 10.78L4.5 10.9C4.7 11.3 4.8 11.5 5.6 11.5L12.1 11.5C13.1 11.5 13.1 13 12.1 13L5.7 13C4.5 13 3.6 12.3 3.3 11.6C3 10.9 3 10.3 3 10.3L3 4C3 3.48 2.77 3 2.3 3L1.75 3C1.34 3 1 2.66 1 2.25C1 1.84 1.34 1.5 1.75 1.5ZM5.8 13C6.4 13 6.8 13.4 6.8 14C6.8 14.6 6.4 15 5.8 15C5.2 15 4.8 14.6 4.8 14C4.8 13.4 5.2 13 5.8 13ZM10.8 13C11.4 13 11.8 13.4 11.8 14C11.8 14.6 11.4 15 10.8 15C10.2 15 9.8 14.6 9.8 14C9.8 13.4 10.2 13 10.8 13Z"/>\n</svg>',table_tennis_paddle_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M11.97 10.23a3.81 3.81 0 0 1 -1.91 0.98L3.77 4.93A4.03 4.03 0 0 1 4.77 3.03C7.03 0.77 9.98 0.22 12.38 2.62S14.23 7.97 11.97 10.23Zm-6.99 1.61A3.84 3.84 0 0 1 6.15 11.28A4.53 4.53 0 0 1 8 11.45L3.55 7a4.41 4.41 0 0 1 0.16 1.92a3.66 3.66 0 0 1 -0.52 1.12c-1.07 1.26 -2.13 1.73 -2.13 2.19A1.84 1.84 0 0 0 2.77 13.95C3.23 13.95 3.69 12.94 4.98 11.84Z"/>\n</svg>',tattoo_machine_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M6.41 2.03C5.43 0.69 3.56 0.39 2.22 1.36C1.99 1.53 1.94 1.84 2.11 2.06C2.26 2.26 2.52 2.33 2.73 2.22L2.8 2.17C3.7 1.52 4.95 1.72 5.6 2.62L0.34 6.44C0.12 6.6 0.07 6.91 0.23 7.13C0.39 7.36 0.7 7.41 0.93 7.25L1.33 6.95L3.1 9.38L3.5 9.08L4.09 9.89L3.28 10.48C3.06 10.64 3.01 10.96 3.17 11.18C3.33 11.4 3.64 11.45 3.87 11.29L9.12 7.47L9.71 8.28L9.31 8.57C9.08 8.74 9.04 9.05 9.2 9.27L11.55 12.51C11.71 12.73 12.02 12.78 12.25 12.62L12.65 12.32L13.24 13.13L14.82 14.46L14.05 12.55L13.46 11.74L13.87 11.44C14.09 11.28 14.14 10.97 13.98 10.74L11.62 7.51C11.46 7.28 11.15 7.24 10.93 7.4L10.52 7.69L9.93 6.88L11.55 5.71L11.85 6.11C12.01 6.33 12.32 6.38 12.54 6.22L13.35 5.63C13.58 5.47 13.63 5.16 13.46 4.94L12.29 3.32C12.13 3.09 11.81 3.04 11.59 3.21L10.78 3.79C10.56 3.96 10.51 4.27 10.67 4.49L10.96 4.9L9.35 6.07L6.99 2.84L7.4 2.54C7.62 2.38 7.67 2.07 7.51 1.84C7.35 1.62 7.04 1.57 6.81 1.73L6.41 2.03ZM6.19 3.42L8.54 6.66L7.32 7.54L6.74 6.73L7.14 6.44L5.38 4.01L6.19 3.42ZM2.95 5.78L3.76 5.19L5.52 7.62L5.93 7.32L6.51 8.13L4.9 9.31L4.31 8.5L4.71 8.2L2.95 5.78Z"/>\n</svg>',toolbox_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10.64 4.51C10.57 4.51 10.5 4.46 10.5 4.39L10.5 2.53C10.5 2.46 10.46 2.4 10.39 2.4L4.62 2.4C4.54 2.4 4.5 2.46 4.5 2.53L4.5 4.39C4.5 4.46 4.42 4.5 4.35 4.5L0.44 4.5C0.36 4.5 0.3 4.58 0.3 4.65L0.3 6.71C0.3 6.79 0.36 6.9 0.44 6.9L6.74 6.9C6.81 6.9 6.9 6.79 6.9 6.71L6.9 6.28C6.9 6.2 6.93 6 7.01 6L8 6C8.08 6 8.1 6.2 8.1 6.28L8.1 6.72C8.1 6.79 8.2 6.9 8.27 6.9L14.57 6.9C14.64 6.9 14.7 6.79 14.7 6.72L14.7 4.66C14.7 4.58 14.64 4.5 14.57 4.5L10.66 4.5L10.65 4.51L10.64 4.51ZM5.43 4.5C5.35 4.5 5.4 4.46 5.4 4.39L5.4 3.33C5.4 3.26 5.36 3.3 5.43 3.3L9.57 3.3C9.65 3.3 9.6 3.26 9.6 3.33L9.6 4.39C9.6 4.46 9.65 4.5 9.57 4.5L5.43 4.5ZM8.12 8.91C8.12 8.99 8.07 9 8 9L7 9C6.93 9 6.9 9.03 6.9 8.96L6.9 7.48C6.9 7.41 6.8 7.2 6.73 7.2L0.44 7.2C0.36 7.2 0.3 7.41 0.3 7.48L0.3 11.87C0.3 11.94 0.36 12 0.44 12L14.57 12C14.64 12 14.7 11.94 14.7 11.87L14.7 7.48C14.7 7.41 14.64 7.2 14.57 7.2L8.27 7.2C8.19 7.2 8.1 7.41 8.1 7.48L8.1 8.96L8.12 8.92L8.12 8.91Z"/>\n</svg>',tree_and_bench_with_backrest_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4 10.94L4 14L3 14L3 10.95C1.93 10.73 1.12 9.77 1.12 8.63C1.12 8.5 1.13 8.37 1.15 8.24C1.97 3.41 2.77 1 3.56 1C4.34 1 5.11 3.41 5.86 8.23L5.86 8.23C6.05 9.49 5.23 10.68 4 10.94ZM6 11L14 11L14 14L13 14L13 12L7 12L7 14L6 14L6 11ZM7 8L13 8L13 10.5L7 10.5L7 8Z"/>\n</svg>',village_buildings_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M6.18 1.18a0.25 0.25 0 0 0 -0.35 0l-4.4 4.4A0.25 0.25 0 0 0 1.6 6H3v6.75a0.25 0.25 0 0 0 0.25 0.25h3.5A0.25 0.25 0 0 0 7 12.75v-7.43c0 -0.07 0.03 -0.13 0.07 -0.18L8.5 3.5L6.18 1.18ZM6 11H5v-1h1v1Zm0 -2H5V8h1v1Zm0 -3v1H5V6h1ZM12.75 3h-0.5a0.25 0.25 0 0 0 -0.25 0.25V5l-1.32 -1.82a0.25 0.25 0 0 0 -0.35 0L8.06 5.93A0.25 0.25 0 0 0 8 6.09v6.66a0.25 0.25 0 0 0 0.25 0.25h1.5a0.25 0.25 0 0 0 0.25 -0.25V11h1v1.75a0.25 0.25 0 0 0 0.25 0.25h1.5a0.25 0.25 0 0 0 0.25 -0.25V3.25a0.25 0.25 0 0 0 -0.25 -0.25ZM10 8H9V7h1v1Zm2 0h-1V7h1v1Zm-2 2H9V9h1v1Zm2 0h-1V9h1v1Z"/>\n</svg>',wall_hanging_with_mountains_and_sun_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10.71 3l-2.86 -2.85c-0.19 -0.2 -0.51 -0.2 -0.71 0c0 0 0 0 0 0l-2.85 2.85h-2.79c-0.28 0 -0.5 0.22 -0.5 0.5v9c0 0.28 0.22 0.5 0.5 0.5h12c0.28 0 0.5 -0.22 0.5 -0.5v-9c0 -0.28 -0.22 -0.5 -0.5 -0.5zm-3.21 -1.79l1.79 1.79h-3.58zm5.5 10.79h-11v-8h11zm-8 -5c-0.55 0 -1 -0.45 -1 -1s0.45 -1 1 -1s1 0.45 1 1s-0.45 1 -1 1zm7 4h-7.5l1.5 -3l1.25 2.5l2.25 -4.5z"/>\n</svg>',winding_way_wide_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M2 0L7 0C11.2 1.11 13.53 2.44 14 4C14.7 6.34 9.75 7.27 10 10C10.17 11.82 11.5 13.49 14 15L2 15C0.11 13.32 -0.3 11.32 0.75 9C2.33 5.52 6.68 6.1 7 4C7.21 2.6 5.54 1.27 2 0Z"/>\n</svg>',womens_and_mens_restroom_symbol_default='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.67 3.46L3.33 3.46L1 11.54L3.33 11.54L3.33 15L5.67 15L5.67 11.54L8 11.54L5.67 3.46ZM4.73 2.31L4.27 2.31C3.68 2.31 3.33 1.96 3.33 1.38L3.33 0.92C3.33 0.35 3.68 0 4.27 0L4.85 0C5.32 0 5.67 0.35 5.67 0.92L5.67 1.5C5.67 1.96 5.32 2.31 4.73 2.31ZM12.83 3.53L8.21 3.53L8.21 9.3L9.36 9.3L9.36 15.07L11.67 15.07L11.67 9.3L12.83 9.3L12.83 3.53ZM10.73 2.31L10.27 2.31C9.68 2.31 9.33 1.96 9.33 1.38L9.33 0.92C9.33 0.35 9.68 0 10.27 0L10.85 0C11.32 0 11.67 0.35 11.67 0.92L11.67 1.5C11.67 1.96 11.32 2.31 10.73 2.31Z"/>\n</svg>',_270_ring_default='<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" data-ember-extension="1"><path d="M10.72,19.9a8,8,0,0,1-6.5-9.79A7.77,7.77,0,0,1,10.4,4.16a8,8,0,0,1,9.49,6.52A1.54,1.54,0,0,0,21.38,12h.13a1.37,1.37,0,0,0,1.38-1.54,11,11,0,1,0-12.7,12.39A1.54,1.54,0,0,0,12,21.34h0A1.47,1.47,0,0,0,10.72,19.9Z"><animateTransform attributeName="transform" type="rotate" dur="0.75s" values="0 12 12;360 12 12" repeatCount="indefinite"/></path></svg>',nostrich_2_default='<svg width="24" height="24" viewBox="0 0 24 24" class="icon-nostrich" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M17.7084 10.1607C18.1683 13.3466 14.8705 14.0207 12.9733 13.9618C12.8515 13.958 12.7366 14.0173 12.6647 14.1157C12.4684 14.384 12.1547 14.7309 11.9125 14.7309C11.6405 14.7309 11.3957 15.254 11.284 15.5795C11.2723 15.6137 11.3059 15.6452 11.3403 15.634C14.345 14.6584 15.5241 14.3238 16.032 14.4178C16.4421 14.4937 17.209 15.8665 17.5413 16.5434C16.7155 16.5909 16.4402 15.8507 16.2503 15.7178C16.0985 15.6116 16.0415 16.0974 16.032 16.3536C15.8517 16.2587 15.6239 16.1259 15.6049 15.7178C15.5859 15.3098 15.3771 15.4142 15.2157 15.4332C15.0544 15.4521 12.5769 16.2493 12.2067 16.3536C11.8366 16.458 11.4094 16.6004 11.0582 16.8471C10.4697 17.1318 10.09 16.9325 9.98561 16.4485C9.90208 16.0614 10.4444 14.8701 10.726 14.3229C10.3779 14.4526 9.65529 14.7158 9.54898 14.7309C9.44588 14.7457 8.13815 15.7552 7.43879 16.3038C7.398 16.3358 7.37174 16.3827 7.36236 16.4336C7.25047 17.0416 6.89335 17.2118 6.27423 17.5303C5.77602 17.7867 4.036 20.4606 3.14127 21.9041C3.0794 22.0039 2.9886 22.0806 2.8911 22.1461C2.32279 22.5276 1.74399 23.4985 1.50923 23.9737C1.17511 23.0095 1.61048 22.1802 1.86993 21.886C1.75602 21.7873 1.49341 21.8449 1.37634 21.886C1.69907 20.7757 2.82862 20.7757 2.79066 20.7757C2.99948 20.5954 5.44842 17.0938 5.50538 16.9325C5.56187 16.7725 5.46892 16.0242 6.69975 15.6139C6.7193 15.6073 6.73868 15.5984 6.75601 15.5873C7.71493 14.971 8.43427 13.9774 8.67571 13.5542C7.39547 13.4662 5.92943 12.7525 5.16289 12.294C4.99765 12.1952 4.8224 12.1092 4.63108 12.0875C3.58154 11.9687 2.53067 12.6401 2.10723 13.0228C1.93258 12.7799 2.12938 12.0739 2.24961 11.7513C1.82437 11.6905 1.19916 12.308 0.939711 12.6243C0.658747 12.184 0.904907 11.397 1.06311 11.0585C0.501179 11.0737 0.120232 11.3306 0 11.4571C0.465109 7.99343 4.02275 9.00076 4.06259 9.04675C3.87275 8.84937 3.88857 8.59126 3.92021 8.48688C6.0749 8.54381 7.08105 8.18321 7.71702 7.81313C12.7288 5.01374 14.8882 6.73133 15.6856 7.1631C16.4829 7.59487 17.9304 7.77042 18.9318 7.37187C20.1278 6.83097 19.9478 5.43673 19.7054 4.90461C19.4397 4.32101 17.9399 3.51438 17.4084 2.49428C16.8768 1.47418 17.34 0.233672 17.9558 0.0607684C18.5425 -0.103972 18.9615 0.0876835 19.2831 0.378128C19.4974 0.571763 20.0994 0.710259 20.3509 0.800409C20.6024 0.890558 21.0201 1.00918 20.9964 1.08035C20.9726 1.15152 20.5699 1.14202 20.5075 1.14202C20.3794 1.14202 20.2275 1.161 20.3794 1.23217C20.5575 1.30439 20.8263 1.40936 20.955 1.47846C20.9717 1.48744 20.9683 1.51084 20.95 1.51577C20.0765 1.75085 19.2966 1.26578 18.7183 1.82526C18.1298 2.39463 19.3827 2.83114 20.0282 3.51438C20.6736 4.19762 21.3381 5.01372 20.8065 6.87365C20.395 8.31355 18.6703 9.53781 17.7795 10.0167C17.7282 10.0442 17.7001 10.1031 17.7084 10.1607Z" fill="currentColor"/>\n</svg>\n',remotestorage_default='<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n\x3c!-- Creator: CorelDRAW X7 --\x3e\n\n<svg\n xml:space="preserve"\n width="24"\n height="24"\n version="1.1"\n style="clip-rule:evenodd;fill-rule:evenodd;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"\n viewBox="0 0 249.99729 249.90068"\n id="svg1"\n sodipodi:docname="icon-square.svg"\n inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview\n id="namedview1"\n pagecolor="#ffffff"\n bordercolor="#666666"\n borderopacity="1.0"\n inkscape:showpageshadow="2"\n inkscape:pageopacity="0.0"\n inkscape:pagecheckerboard="true"\n inkscape:deskcolor="#d1d1d1"\n inkscape:document-units="in"\n inkscape:zoom="6.5838793"\n inkscape:cx="2.1264059"\n inkscape:cy="39.414453"\n inkscape:window-width="2160"\n inkscape:window-height="1281"\n inkscape:window-x="0"\n inkscape:window-y="0"\n inkscape:window-maximized="1"\n inkscape:current-layer="Layer_x0020_1" />&#10; <defs\n id="defs1"></defs>&#10; <g\n id="Layer_x0020_1"\n inkscape:label="Layer 1"\n inkscape:groupmode="layer"\n transform="translate(-66.822266,-0.16483529)">&#10; <metadata\n id="CorelCorpID_0Corel-Layer" />&#10; <polygon\n fill="currentColor"\n points="228,181 370,100 511,181 652,263 370,425 87,263 87,263 0,213 0,213 0,311 0,378 0,427 0,476 86,525 185,582 370,689 554,582 653,525 653,590 653,592 370,754 0,542 0,640 185,747 370,853 554,747 739,640 739,525 739,476 739,427 739,378 653,427 370,589 86,427 86,361 185,418 370,524 554,418 653,361 739,311 739,213 554,107 370,0 185,107 58,180 144,230 "\n id="polygon1"\n transform="matrix(0.29308006,0,0,0.29308006,83.527829,-0.02838471)"\n />&#10; </g>&#10;</svg>\n',whatsapp_default='<?xml version="1.0" encoding="UTF-8"?>\n<svg viewBox="-1.66 0 740.82 740.82" xmlns="http://www.w3.org/2000/svg">\n <path d="m630.06 107.66c-69.329-69.387-161.53-107.62-259.76-107.66-202.4 0-367.13 164.67-367.22 367.07-0.027 64.699 16.883 127.86 49.016 183.52l-52.095 190.23 194.67-51.047c53.634 29.244 114.02 44.656 175.48 44.682h0.151c202.38 0 367.13-164.69 367.21-367.09 0.039-98.088-38.121-190.32-107.45-259.71m-259.76 564.8h-0.125c-54.766-0.021-108.48-14.729-155.34-42.529l-11.146-6.613-115.52 30.293 30.834-112.59-7.258-11.543c-30.552-48.58-46.689-104.73-46.665-162.38 0.067-168.23 136.99-305.1 305.34-305.1 81.521 0.031 158.15 31.81 215.78 89.482s89.342 134.33 89.311 215.86c-0.07 168.24-136.99 305.12-305.21 305.12m167.42-228.51c-9.176-4.591-54.286-26.782-62.697-29.843-8.41-3.061-14.526-4.591-20.644 4.592-6.116 9.182-23.7 29.843-29.054 35.964-5.351 6.122-10.703 6.888-19.879 2.296-9.175-4.591-38.739-14.276-73.786-45.526-27.275-24.32-45.691-54.36-51.043-63.542-5.352-9.183-0.569-14.148 4.024-18.72 4.127-4.11 9.175-10.713 13.763-16.07 4.587-5.356 6.116-9.182 9.174-15.303 3.059-6.122 1.53-11.479-0.764-16.07s-20.643-49.739-28.29-68.104c-7.447-17.886-15.012-15.466-20.644-15.746-5.346-0.266-11.469-0.323-17.585-0.323-6.117 0-16.057 2.296-24.468 11.478-8.41 9.183-32.112 31.374-32.112 76.521s32.877 88.763 37.465 94.885c4.587 6.122 64.699 98.771 156.74 138.5 21.891 9.45 38.982 15.093 52.307 19.323 21.981 6.979 41.983 5.994 57.793 3.633 17.628-2.633 54.285-22.19 61.932-43.616 7.646-21.426 7.646-39.791 5.352-43.617-2.293-3.826-8.41-6.122-17.585-10.714" clip-rule="evenodd" fill-rule="evenodd"/>\n</svg>\n',wikipedia_default='<?xml version="1.0" encoding="UTF-8"?>\n<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="7.15 7.15 113.7 113.7" fill="currentColor">\n<path d="M 120.85,29.21 C 120.85,29.62 120.72,29.99 120.47,30.33 C 120.21,30.66 119.94,30.83 119.63,30.83 C 117.14,31.07 115.09,31.87 113.51,33.24 C 111.92,34.6 110.29,37.21 108.6,41.05 L 82.8,99.19 C 82.63,99.73 82.16,100 81.38,100 C 80.77,100 80.3,99.73 79.96,99.19 L 65.49,68.93 L 48.85,99.19 C 48.51,99.73 48.04,100 47.43,100 C 46.69,100 46.2,99.73 45.96,99.19 L 20.61,41.05 C 19.03,37.44 17.36,34.92 15.6,33.49 C 13.85,32.06 11.4,31.17 8.27,30.83 C 8,30.83 7.74,30.69 7.51,30.4 C 7.27,30.12 7.15,29.79 7.15,29.42 C 7.15,28.47 7.42,28 7.96,28 C 10.22,28 12.58,28.1 15.05,28.3 C 17.34,28.51 19.5,28.61 21.52,28.61 C 23.58,28.61 26.01,28.51 28.81,28.3 C 31.74,28.1 34.34,28 36.6,28 C 37.14,28 37.41,28.47 37.41,29.42 C 37.41,30.36 37.24,30.83 36.91,30.83 C 34.65,31 32.87,31.58 31.57,32.55 C 30.27,33.53 29.62,34.81 29.62,36.4 C 29.62,37.21 29.89,38.22 30.43,39.43 L 51.38,86.74 L 63.27,64.28 L 52.19,41.05 C 50.2,36.91 48.56,34.23 47.28,33.03 C 46,31.84 44.06,31.1 41.46,30.83 C 41.22,30.83 41,30.69 40.78,30.4 C 40.56,30.12 40.45,29.79 40.45,29.42 C 40.45,28.47 40.68,28 41.16,28 C 43.42,28 45.49,28.1 47.38,28.3 C 49.2,28.51 51.14,28.61 53.2,28.61 C 55.22,28.61 57.36,28.51 59.62,28.3 C 61.95,28.1 64.24,28 66.5,28 C 67.04,28 67.31,28.47 67.31,29.42 C 67.31,30.36 67.15,30.83 66.81,30.83 C 62.29,31.14 60.03,32.42 60.03,34.68 C 60.03,35.69 60.55,37.26 61.6,39.38 L 68.93,54.26 L 76.22,40.65 C 77.23,38.73 77.74,37.11 77.74,35.79 C 77.74,32.69 75.48,31.04 70.96,30.83 C 70.55,30.83 70.35,30.36 70.35,29.42 C 70.35,29.08 70.45,28.76 70.65,28.46 C 70.86,28.15 71.06,28 71.26,28 C 72.88,28 74.87,28.1 77.23,28.3 C 79.49,28.51 81.35,28.61 82.8,28.61 C 83.84,28.61 85.38,28.52 87.4,28.35 C 89.96,28.12 92.11,28 93.83,28 C 94.23,28 94.43,28.4 94.43,29.21 C 94.43,30.29 94.06,30.83 93.32,30.83 C 90.69,31.1 88.57,31.83 86.97,33.01 C 85.37,34.19 83.37,36.87 80.98,41.05 L 71.26,59.02 L 84.42,85.83 L 103.85,40.65 C 104.52,39 104.86,37.48 104.86,36.1 C 104.86,32.79 102.6,31.04 98.08,30.83 C 97.67,30.83 97.47,30.36 97.47,29.42 C 97.47,28.47 97.77,28 98.38,28 C 100.03,28 101.99,28.1 104.25,28.3 C 106.34,28.51 108.1,28.61 109.51,28.61 C 111,28.61 112.72,28.51 114.67,28.3 C 116.7,28.1 118.52,28 120.14,28 C 120.61,28 120.85,28.4 120.85,29.21 z" />\n</svg>',icons_exports=__exportAll({getIcon:()=>getIcon,isIconFilled:()=>isIconFilled}),ICONS={activity:activity_default,angelfish:angelfish_default,"arrow-left":arrow_left_default,barbell:barbell_default,banknote:banknote_default,"badge-shield-with-fire":badge_shield_with_fire_default,"beach-umbrella-in-ground":beach_umbrella_in_ground_default,"beer-mug-with-foam":beer_mug_with_foam_default,bookmark:bookmark_default,"boxing-glove-up":boxing_glove_up_default,"burger-and-drink-cup-with-straw":burger_and_drink_cup_with_straw_default,bridge:bridge_default,bus:bus_default,camera:camera_default,"feather-camera":camera_default$1,"check-square":check_square_default,"chevron-left":chevron_left_default,"chevron-right":chevron_right_default,"cigarette-with-smoke-curl":cigarette_with_smoke_curl_default,"city-gate":city_gate_default,climbing_wall:climbing_wall_default,check:check_default,"alert-circle":alert_circle_default,"alert-triangle":alert_triangle_default,"classical-building":classical_building_default,"classical-building-with-clock":classical_building_with_clock_default,"classical-building-with-dome-and-flag":classical_building_with_dome_and_flag_default,"classical-building-with-flag":classical_building_with_flag_default,"commercial-building":commercial_building_default,"clothes-hanger":clothes_hanger_default,cleaver:cleaver_default,cloth:cloth_default,cocktail:cocktail_default,clock:clock_default,"coffee-bean":coffee_bean_default,"comedy-mask-and-tragedy-mask":comedy_mask_and_tragedy_mask_default,croissant:croissant_default,"cup-and-saucer":cup_and_saucer_default,database:database_default,donut:donut_default,edit:edit_default,eyeglasses:eyeglasses_default,facebook:facebook_default,"fancy-mirror-with-reflection-and-stars":fancy_mirror_with_reflection_and_stars_default,"family-restroom-symbol":family_restroom_symbol_default,film:film_default,"fingernail-polished":fingernail_polished_default,fish:fish_default,"flag-checkered":flag_checkered_default,"flower-bouquet":flower_bouquet_default,"fork-and-knife":fork_and_knife_default,fort:fort_default,gift:gift_default,globe:globe_default,gravestone:gravestone_default,"grecian-vase":grecian_vase_default,"greek-cross":greek_cross_default,heart:heart_default,home:home_default$1,"ice-cream-on-cone":ice_cream_on_cone_default,"industrial-building":industrial_building_default,info:info_default,"info-i":info_i_default,instagram:instagram_default,jewel:jewel_default,"log-in":log_in_default,"log-out":log_out_default,"lowrise-building":lowrise_building_default,mail:mail_default,map:map_default,"map-pin":map_pin_default,"market-stall":market_stall_default,"memorial-stone-with-inscription":memorial_stone_with_inscription_default,menu:menu_default,"mobile-phone-with-keypad-and-antenna":mobile_phone_with_keypad_and_antenna_default,"molar-tooth":molar_tooth_default,"more-horizontal":more_horizontal_default,"more-vertical":more_vertical_default,navigation:navigation_default,"needle-and-spool-of-thread":needle_and_spool_of_thread_default,nostrich:nostrich_2_default,"open-book":open_book_default,palace:palace_default,"person-cricket-batting-at-cricket-ball":person_cricket_batting_at_cricket_ball_default,"person-boarding-tram-with-destination-display-and-pantograph-on-tram-track":person_boarding_tram_with_destination_display_and_pantograph_on_tram_track_default,"person-jockeying-racehorse":person_jockeying_racehorse_default,"person-playing-tennis":person_playing_tennis_default,"person-running":person_running_default,"person-sleeping-in-bed":person_sleeping_in_bed_default,"person-swimming-in-water":person_swimming_in_water_default,"person-swinging-golf-club":person_swinging_golf_club_default,phone:phone_default,"plane-top-right":plane_top_right_default,"plant-in-raised-planter":plant_in_raised_planter_default,"place-of-worship-building":place_of_worship_building_default,"play-structure-with-slide":play_structure_with_slide_default,"police-officer-with-stop-arm":police_officer_with_stop_arm_default,plus:plus_default,"round-structure-with-flag":round_structure_with_flag_default,remotestorage:remotestorage_default,"sailing-ship-in-water":sailing_ship_in_water_default,"scissors-open":open_scissors_default,"shipwreck-in-water":shipwreck_in_water_default,"steam-train-on-railway-track":steam_train_on_railway_track_default,"shopping-bag":shopping_bag_default,search:search_default,server:server_default,settings:settings_default,"shopping-basket":shopping_basket_default,"shopping-cart":shopping_cart_default,"table-tennis-paddle":table_tennis_paddle_default,"tattoo-machine":tattoo_machine_default,toolbox:toolbox_default,target:target_default,"trash-2":trash_2_default,"upload-cloud":upload_cloud_default,"tree-and-bench-with-backrest":tree_and_bench_with_backrest_default,user:user_default,"village-buildings":village_buildings_default,"wall-hanging-with-mountains-and-sun":wall_hanging_with_mountains_and_sun_default,"womens-and-mens-restroom-symbol":womens_and_mens_restroom_symbol_default,whatsapp:whatsapp_default,wikipedia:wikipedia_default,winding_way_wide:winding_way_wide_default,parking_p:p_wide_default,car:car_default,"car-and-wrench":car_and_wrench_default,"castle-keep":castle_keep_default,x:x_default,zap:zap_default,"loading-ring":_270_ring_default},FILLED_ICONS=["fork-and-knife","wikipedia","whatsapp","cup-and-saucer","coffee-bean","shopping-basket","person-sleeping-in-bed","loading-ring","nostrich"];function getIcon(e){return ICONS[e]}function isIconFilled(e){return FILLED_ICONS.includes(e)}var osm_icons_exports=__exportAll({POI_ICON_RULES:()=>POI_ICON_RULES,getIconNameForTags:()=>getIconNameForTags,getIconSvgForTags:()=>getIconSvgForTags}),POI_ICON_RULES=[{tags:{cuisine:"donut"},icon:"donut"},{tags:{cuisine:"doughnut"},icon:"donut"},{tags:{cuisine:"coffee_shop"},icon:"coffee-bean"},{tags:{cuisine:"coffee"},icon:"coffee-bean"},{tags:{amenity:"ice_cream"},icon:"ice-cream-on-cone"},{tags:{cuisine:"ice_cream"},icon:"ice-cream-on-cone"},{tags:{shop:"ice_cream"},icon:"ice-cream-on-cone"},{tags:{amenity:"cafe"},icon:"cup-and-saucer"},{tags:{amenity:"restaurant"},icon:"fork-and-knife"},{tags:{amenity:"fast_food"},icon:"burger-and-drink-cup-with-straw"},{tags:{amenity:"pub"},icon:"beer-mug-with-foam"},{tags:{amenity:"bar"},icon:"cocktail"},{tags:{amenity:"food_court"},icon:"fork-and-knife"},{tags:{amenity:"childcare"},icon:"family-restroom-symbol"},{tags:{amenity:"community_centre"},icon:"family-restroom-symbol"},{tags:{amenity:"social_centre"},icon:"family-restroom-symbol"},{tags:{amenity:"social_facility"},icon:"family-restroom-symbol"},{tags:{amenity:"bank"},icon:"banknote"},{tags:{amenity:"place_of_worship"},icon:"place-of-worship-building"},{tags:{amenity:"townhall"},icon:"classical-building-with-clock"},{tags:{building:"townhall"},icon:"classical-building-with-clock"},{tags:{amenity:"fire_station"},icon:"badge-shield-with-fire"},{tags:{amenity:"police"},icon:"police-officer-with-stop-arm"},{tags:{amenity:"toilets"},icon:"womens-and-mens-restroom-symbol"},{tags:{amenity:"school"},icon:"open-book"},{tags:{amenity:"driving_school"},icon:"car"},{tags:{shop:"coffee"},icon:"coffee-bean"},{tags:{shop:"tea"},icon:"coffee-bean"},{tags:{shop:"pastry"},icon:"donut"},{tags:{shop:"supermarket"},icon:"shopping-cart"},{tags:{shop:"convenience"},icon:"shopping-basket"},{tags:{shop:"grocery"},icon:"shopping-basket"},{tags:{shop:"greengrocer"},icon:"shopping-basket"},{tags:{shop:"bakery"},icon:"croissant"},{tags:{shop:"butcher"},icon:"cleaver"},{tags:{shop:"seafood"},icon:"fish"},{tags:{shop:"deli"},icon:"shopping-basket"},{tags:{shop:"clothes"},icon:"clothes-hanger"},{tags:{shop:"clothing"},icon:"clothes-hanger"},{tags:{shop:"hairdresser"},icon:"scissors-open"},{tags:{shop:"optician"},icon:"eyeglasses"},{tags:{shop:"fabric"},icon:"cloth"},{tags:{shop:"flea_market"},icon:"market-stall"},{tags:{shop:"kiosk"},icon:"shopping-basket"},{tags:{shop:"leather"},icon:"shopping-bag"},{tags:{shop:"tailor"},icon:"needle-and-spool-of-thread"},{tags:{shop:"jewelry"},icon:"jewel"},{tags:{shop:"jewellery"},icon:"jewel"},{tags:{shop:"tobacco"},icon:"cigarette-with-smoke-curl"},{tags:{shop:"cannabis"},icon:"cigarette-with-smoke-curl"},{tags:{shop:"florist"},icon:"flower-bouquet"},{tags:{shop:"garden_centre"},icon:"plant-in-raised-planter"},{tags:{shop:"estate_agent"},icon:"village-buildings"},{tags:{shop:"mobile_phone"},icon:"mobile-phone-with-keypad-and-antenna"},{tags:{beauty:"nails"},icon:"fingernail-polished"},{tags:{shop:"tattoo"},icon:"tattoo-machine"},{tags:{shop:"beauty"},icon:"fancy-mirror-with-reflection-and-stars"},{tags:{shop:"car_repair"},icon:"car-and-wrench"},{tags:{craft:"tailor"},icon:"needle-and-spool-of-thread"},{tags:{office:"estate_agent"},icon:"village-buildings"},{tags:{office:!0},icon:"commercial-building"},{tags:{craft:!0},icon:"toolbox"},{tags:{shop:!0},icon:"shopping-bag"},{tags:{natural:"beach"},icon:"beach-umbrella-in-ground"},{tags:{leisure:"park"},icon:"tree-and-bench-with-backrest"},{tags:{leisure:"playground"},icon:"play-structure-with-slide"},{tags:{aeroway:"aerodrome"},icon:"plane-top-right"},{tags:{aeroway:"heliport"},icon:"plane-top-right"},{tags:{aeroway:"helipad"},icon:"plane-top-right"},{tags:{highway:"bus_stop"},icon:"bus"},{tags:{bus:!0},icon:"bus"},{tags:{railway:"tram_stop"},icon:"person-boarding-tram-with-destination-display-and-pantograph-on-tram-track"},{tags:{tourism:"museum"},icon:"classical-building"},{tags:{tourism:"gallery"},icon:"wall-hanging-with-mountains-and-sun"},{tags:{tourism:"aquarium"},icon:"angelfish"},{tags:{tourism:"theme_park"},icon:"camera"},{tags:{tourism:"attraction"},icon:"camera"},{tags:{tourism:"viewpoint"},icon:"camera"},{tags:{tourism:"zoo"},icon:"camera"},{tags:{tourism:"artwork"},icon:"camera"},{tags:{tourism:"information"},icon:"info-i"},{tags:{amenity:"cinema"},icon:"film"},{tags:{amenity:"theatre"},icon:"camera"},{tags:{amenity:"arts_centre"},icon:"comedy-mask-and-tragedy-mask"},{tags:{amenity:"arts_center"},icon:"comedy-mask-and-tragedy-mask"},{tags:{historic:"canal"},icon:"winding_way_wide"},{tags:{historic:"bridge"},icon:"bridge"},{tags:{historic:"bridge_site"},icon:"bridge"},{tags:{historic:"fort"},icon:"fort"},{tags:{historic:"city_gate"},icon:"city-gate"},{tags:{historic:"castle"},icon:"palace"},{tags:{building:"tower",historic:"yes"},icon:"castle-keep"},{tags:{historic:"building"},icon:"classical-building-with-flag"},{tags:{historic:"archaeological_site"},icon:"grecian-vase"},{tags:{historic:"memorial"},icon:"memorial-stone-with-inscription"},{tags:{historic:"tomb"},icon:"gravestone"},{tags:{historic:"monument"},icon:"classical-building-with-dome-and-flag"},{tags:{historic:"folly"},icon:"classical-building"},{tags:{historic:"industrial"},icon:"industrial-building"},{tags:{historic:"railway_station"},icon:"steam-train-on-railway-track"},{tags:{historic:"ship"},icon:"sailing-ship-in-water"},{tags:{historic:"wreck"},icon:"shipwreck-in-water"},{tags:{historic:"ruins"},icon:"camera"},{tags:{historic:"ruin"},icon:"camera"},{tags:{historic:"yes"},icon:"camera"},{tags:{tourism:"hotel"},icon:"person-sleeping-in-bed"},{tags:{tourism:"hostel"},icon:"person-sleeping-in-bed"},{tags:{tourism:"motel"},icon:"person-sleeping-in-bed"},{tags:{tourism:"guest_house"},icon:"person-sleeping-in-bed"},{tags:{sport:"motor"},icon:"flag-checkered"},{tags:{sport:"karting"},icon:"flag-checkered"},{tags:{sport:"motocross"},icon:"flag-checkered"},{tags:{sport:"cricket"},icon:"person-cricket-batting-at-cricket-ball"},{tags:{sport:"boxing"},icon:"boxing-glove-up"},{tags:{sport:"martial_arts"},icon:"boxing-glove-up"},{tags:{sport:"tennis"},icon:"person-playing-tennis"},{tags:{sport:"squash"},icon:"person-playing-tennis"},{tags:{sport:"padel"},icon:"person-playing-tennis"},{tags:{sport:"table_tennis"},icon:"table-tennis-paddle"},{tags:{sport:"climbing"},icon:"climbing_wall"},{tags:{leisure:"water_park"},icon:"person-swimming-in-water"},{tags:{sport:"swimming"},icon:"person-swimming-in-water"},{tags:{sport:"golf"},icon:"person-swinging-golf-club"},{tags:{leisure:"golf_course"},icon:"person-swinging-golf-club"},{tags:{sport:"horse_racing"},icon:"person-jockeying-racehorse"},{tags:{sport:"fitness"},icon:"barbell"},{tags:{sport:"fitness_centre"},icon:"barbell"},{tags:{leisure:"fitness_centre"},icon:"barbell"},{tags:{sport:"stadium"},icon:"round-structure-with-flag"},{tags:{leisure:"stadium"},icon:"round-structure-with-flag"},{tags:{leisure:"sports_centre"},icon:"person-running"},{tags:{leisure:"pitch"},icon:"person-running"},{tags:{sport:!0},icon:"person-running"},{tags:{amenity:"dentist"},icon:"molar-tooth"},{tags:{healthcare:"dentist"},icon:"molar-tooth"},{tags:{healthcare:!0},icon:"greek-cross"},{tags:{amenity:"parking"},icon:"parking_p"},{tags:{building:"commercial"},icon:"commercial-building"},{tags:{building:"apartments"},icon:"lowrise-building"}];function getIconNameForTags(e){if(!e)return null;for(const t of POI_ICON_RULES){let r=!0;for(const[n,i]of Object.entries(t.tags)){const t=e[n];if(!t){r=!1;break}const o=t.split(";").map(e=>e.trim());if(!0!==i&&!o.includes(i)){r=!1;break}}if(r)return t.icon}return null}function getIconSvgForTags(e){const t=getIconNameForTags(e);return t?getIcon(t):null}var poi_category_matcher_exports=__exportAll({getMatchingPoiCategories:()=>getMatchingPoiCategories,getMatchingPoiCategoryIds:()=>getMatchingPoiCategoryIds});function getMatchingPoiCategories(e,t){return Array.isArray(t)&&e?t.filter(t=>!!Array.isArray(t.filter)&&t.filter.some(t=>matchesFilter(e,t))):[]}function getMatchingPoiCategoryIds(e,t){return getMatchingPoiCategories(e,t).map(e=>e.id)}function matchesFilter(e,t){const r=parseOverpassClauses(t);return 0!==r.length&&r.every(t=>matchesClause(e,t))}function parseOverpassClauses(e){if(!e)return[];const t=e.match(/\[[^\]]+\]/g);return t?t.map(e=>parseClause(e.slice(1,-1).trim())).filter(Boolean):[]}function parseClause(e){const t=e.match(/^"([^"]+)"$/);if(t)return{type:"presence",key:t[1]};const r=e.match(/^"([^"]+)"\s*=\s*"([^"]*)"$/);if(r)return{type:"equals",key:r[1],value:r[2]};const n=e.match(/^"([^"]+)"\s*~\s*"([^"]*)"$/);if(n)return{type:"regex",key:n[1],pattern:n[2],regex:new RegExp(n[2])};const i=e.match(/^"([^"]+)"\s*!~\s*"([^"]*)"$/);return i?{type:"not-regex",key:i[1],pattern:i[2],regex:new RegExp(i[2])}:null}function matchesClause(e,t){const r=getTagValues(e,t.key);switch(t.type){case"presence":return r.length>0;case"equals":return r.some(e=>e===t.value);case"regex":return r.some(e=>t.regex.test(e));case"not-regex":return 0===r.length||!r.some(e=>t.regex.test(e));default:return!1}}function getTagValues(e,t){if(!e||!t)return[];const r=e[t];return null==r?[]:String(r).split(";").map(e=>e.trim()).filter(Boolean)}var photo_tag_suggestions_exports=__exportAll({CATEGORY_TAGS:()=>CATEGORY_TAGS,getSuggestedPhotoTags:()=>getSuggestedPhotoTags}),CATEGORY_TAGS={restaurants:["food","menu","vibe","front"],coffee:["food","menu","vibe","front"],groceries:["front","food"],"things-to-do":["architecture","amenities","vibe","front"],accommodation:["rooms","amenities","food","vibe","front"]};function getSuggestedPhotoTags(e){const t=getMatchingPoiCategoryIds(e?.osmTags||e?.tags||{},POI_CATEGORIES),r=[];for(const n of t){const e=CATEGORY_TAGS[n];if(Array.isArray(e))for(const t of e)r.includes(t)||r.push(t)}return 0===r.length?[]:r}var place_mapping_exports=__exportAll({mapToStorageSchema:()=>mapToStorageSchema});function mapToStorageSchema(e){return{title:e.title||getLocalizedName(e.osmTags,"Untitled Place"),lat:e.lat,lon:e.lon,tags:[],url:e.osmTags?.website,osmId:String(e.osmId||e.id),osmType:e.osmType,osmTags:e.osmTags||{},description:e.description}}var social_links_exports=__exportAll({getSocialInfo:()=>getSocialInfo}),get$5=(e,...t)=>{for(const r of t)if(e[r])return e[r];return null};function getSocialInfo(e,t){if(!e)return null;const r=`${t}.com`,n=get$5(e,`contact:${t}`,t);if(!n)return null;if(n.startsWith("http"))try{const e=new URL(n);return"facebook"===t&&"/profile.php"===e.pathname&&e.searchParams.has("id")?{url:n,username:e.searchParams.get("id")}:{url:n,username:e.pathname.replace(/^\/|\/$/g,"")||n}}catch{return{url:n,username:n}}const i=n.replace(/^@/,"");return{url:`https://${r}/${i}`,username:i}}var q=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],x=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];t=83*t+q.indexOf(n)}return t},p=(e,t)=>{var r="";for(let n=1;n<=t;n++){let i=Math.floor(e)/Math.pow(83,t-n)%83;r+=q[Math.floor(i)]}return r},f=e=>{let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},h=e=>{let t=Math.max(0,Math.min(1,e));return t<=.0031308?Math.trunc(12.92*t*255+.5):Math.trunc(255*(1.055*Math.pow(t,.4166666666666667)-.055)+.5)},F=e=>e<0?-1:1,M=(e,t)=>F(e)*Math.pow(Math.abs(e),t),d=class extends Error{constructor(e){super(e),this.name="ValidationError",this.message=e}},C=e=>{if(!e||e.length<6)throw new d("The blurhash string must be at least 6 characters");let t=x(e[0]),r=Math.floor(t/9)+1,n=t%9+1;if(e.length!==4+2*n*r)throw new d(`blurhash length mismatch: length is ${e.length} but it should be ${4+2*n*r}`)},z=e=>{let t=e>>8&255,r=255&e;return[f(e>>16),f(t),f(r)]},L=(e,t)=>{let r=Math.floor(e/361),n=Math.floor(e/19)%19,i=e%19;return[M((r-9)/9,2)*t,M((n-9)/9,2)*t,M((i-9)/9,2)*t]},U=(e,t,r,n)=>{C(e),n|=1;let i=x(e[0]),o=Math.floor(i/9)+1,s=i%9+1,a=(x(e[1])+1)/166,l=new Array(s*o);for(let h=0;h<l.length;h++)if(0===h){let t=x(e.substring(2,6));l[h]=z(t)}else{let t=x(e.substring(4+2*h,6+2*h));l[h]=L(t,a*n)}let c=4*t,u=new Uint8ClampedArray(c*r);for(let d=0;d<r;d++)for(let e=0;e<t;e++){let n=0,i=0,a=0;for(let c=0;c<o;c++)for(let o=0;o<s;o++){let u=Math.cos(Math.PI*e*o/t)*Math.cos(Math.PI*d*c/r),h=l[o+c*s];n+=h[0]*u,i+=h[1]*u,a+=h[2]*u}let p=h(n),f=h(i),g=h(a);u[4*e+0+d*c]=p,u[4*e+1+d*c]=f,u[4*e+2+d*c]=g,u[4*e+3+d*c]=255}return u},j=U,A=4,D=(e,t,r,n)=>{let i=0,o=0,s=0,a=t*A;for(let c=0;c<t;c++){let t=A*c;for(let l=0;l<r;l++){let r=t+l*a,u=n(c,l);i+=u*f(e[r]),o+=u*f(e[r+1]),s+=u*f(e[r+2])}}let l=1/(t*r);return[i*l,o*l,s*l]},$=e=>(h(e[0])<<16)+(h(e[1])<<8)+h(e[2]),H=(e,t)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*M(e[0]/t,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*M(e[1]/t,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*M(e[2]/t,.5)+9.5)))),O=(e,t,r,n,i)=>{if(n<1||n>9||i<1||i>9)throw new d("BlurHash must have between 1 and 9 components");if(t*r*4!==e.length)throw new d("Width and height must match the pixels array");let o=[];for(let u=0;u<i;u++)for(let i=0;i<n;i++){let n=0==i&&0==u?1:2,s=D(e,t,r,(e,o)=>n*Math.cos(Math.PI*i*e/t)*Math.cos(Math.PI*u*o/r));o.push(s)}let s,a=o[0],l=o.slice(1),c="";if(c+=p(n-1+9*(i-1),1),l.length>0){let e=Math.max(...l.map(e=>Math.max(...e))),t=Math.floor(Math.max(0,Math.min(82,Math.floor(166*e-.5))));s=(t+1)/166,c+=p(t,1)}else s=1,c+=p(0,1);return c+=p($(a),4),l.forEach(e=>{c+=p(H(e,s),2)}),c},S=O,image_processor_exports=__exportAll({}),_dec$1,_dec2,_class$1,_descriptor$1,_descriptor2;function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:String(t)}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _initializerDefineProperty(e,t,r,n){r&&Object.defineProperty(e,t,{enumerable:r.enumerable,configurable:r.configurable,writable:r.writable,value:r.initializer?r.initializer.call(n):void 0})}function _applyDecoratedDescriptor(e,t,r,n,i){var o={};return Object.keys(n).forEach(function(e){o[e]=n[e]}),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=r.slice().reverse().reduce(function(r,n){return n(e,t,r)||r},o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(e,t,o),o=null),o}self.onmessage=async e=>{if("PROCESS_IMAGE"!==e.data?.type)return;const{id:t,file:r,targetWidth:n,targetHeight:i,quality:o,computeBlurhash:s}=e.data;try{let e,c;try{const t=await createImageBitmap(r,{resizeWidth:n,resizeHeight:i,resizeQuality:"high"});if(e=new OffscreenCanvas(n,i),c=e.getContext("2d"),!c)throw new Error("Failed to get 2d context from OffscreenCanvas");c.drawImage(t,0,0,n,i),t.close()}catch(a){console.warn("Hardware resize failed, falling back to stepped software scaling:",a);const t=await r.arrayBuffer(),o=new Blob([t],{type:r.type}),s=await createImageBitmap(o);let l=s.width,u=s.height,h=new OffscreenCanvas(l,u),d=h.getContext("2d");for(d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high",d.drawImage(s,0,0);.5*h.width>n&&.5*h.height>i;){const e=new OffscreenCanvas(Math.floor(.5*h.width),Math.floor(.5*h.height)),t=e.getContext("2d");t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.drawImage(h,0,0,e.width,e.height),h=e}e=new OffscreenCanvas(n,i),c=e.getContext("2d"),c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high",c.drawImage(h,0,0,n,i),s.close()}let u=null;if(s)try{const e=c.getImageData(0,0,n,i);u=S(e.data,n,i,4,3)}catch(l){console.warn("Could not generate blurhash (possible canvas fingerprinting protection):",l)}const h=await e.convertToBlob({type:"image/jpeg",quality:o}),d=`${n}x${i}`;self.postMessage({id:t,success:!0,blob:h,dim:d,blurhash:u})}catch(error){self.postMessage({id:t,success:!1,error:error.message})}};var isFastBoot="undefined"!=typeof FastBoot,RouterEvent={ROUTE_DID_CHANGE:"routeDidChange"};function hasResolveRegistration(e){return"resolveRegistration"in e}function hasPageTitleConfig(e){return"object"==typeof e&&null!==e&&"pageTitle"in e}var configKeys=["separator","prepend","replace"],PageTitleService=(_dec$1=service("router"),_dec2=service("-document"),_class$1=class extends Service{constructor(e){if(super(e),_initializerDefineProperty(this,"router",_descriptor$1,this),_initializerDefineProperty(this,"document",_descriptor2,this),_defineProperty(this,"tokens",[]),_defineProperty(this,"_defaultConfig",{separator:" | ",prepend:!0,replace:null}),_defineProperty(this,"scheduleTitleUpdate",()=>{scheduleOnce("afterRender",this,this._updateTitle)}),this._validateExistingTitleElement(),hasResolveRegistration(e)){const t=e.resolveRegistration("config:environment");hasPageTitleConfig(t)&&configKeys.forEach(e=>{if(!isEmpty$5(t.pageTitle[e])){const r=t.pageTitle[e];this._defaultConfig[e]=r}})}this.router.on(RouterEvent.ROUTE_DID_CHANGE,this.scheduleTitleUpdate)}applyTokenDefaults(e){const t=this._defaultConfig.separator,r=this._defaultConfig.prepend,n=this._defaultConfig.replace;e.previous??=null,e.next??=null,null==e.separator&&(e.separator=t),null==e.prepend&&null!=r&&(e.prepend=r),null==e.replace&&null!=n&&(e.replace=n)}inheritFromPrevious(e){const t=e.previous;t&&(null==e.separator&&(e.separator=t.separator),null==e.prepend&&(e.prepend=t.prepend))}push(e){const t=this._findTokenById(e.id);if(t){const r=this.tokens.indexOf(t),n=[...this.tokens];return e.previous=t.previous,e.next=t.next,this.inheritFromPrevious(e),this.applyTokenDefaults(e),n.splice(r,1,e),void(this.tokens=n)}const r=this.tokens.slice(-1)[0];r&&(e.previous=r??null,r.next=e,this.inheritFromPrevious(e)),this.applyTokenDefaults(e),this.tokens=[...this.tokens,e]}remove(e){const t=this._findTokenById(e);if(!t)return;const{next:r,previous:n}=t;r&&(r.previous=n),n&&(n.next=r),t.previous=t.next=null;const i=[...this.tokens];i.splice(i.indexOf(t),1),this.tokens=i}get visibleTokens(){const e=this.tokens;let t=e?e.length:0;const r=[];for(;t--;){const n=e[t];if(n){if(n.replace){r.unshift(n);break}r.unshift(n)}}return r}get sortedTokens(){const e=this.visibleTokens;if(!e)return[];let t=!0,r=[];const n=[r],i=[];return e.forEach(e=>{e.front?i.unshift(e):e.prepend?(t&&(t=!1,r=[],n.push(r)),r.unshift(e)):(t||(t=!0,r=[],n.push(r)),r.push(e))}),i.concat(n.reduce((e,t)=>e.concat(t),[]))}toString(){const e=this.sortedTokens,t=[];for(let r=0,n=e.length;r<n;r++){const i=e[r];i&&i.title&&(t.push(i.title),r+1<n&&t.push(i.separator))}return t.join("")}willDestroy(){super.willDestroy(),this.router.off(RouterEvent.ROUTE_DID_CHANGE,this.scheduleTitleUpdate)}_updateTitle(){const e=this.toString();isFastBoot?this.updateFastbootTitle(e):this.document.title=e,this.titleDidUpdate(e)}_validateExistingTitleElement(){isFastBoot||assert$4("[ember-page-title]: Multiple title elements found. Check for other addons like ember-cli-head updating <title> as well.",document.head.querySelectorAll("title").length<=1)}_findTokenById(e){return this.tokens.find(t=>t.id===e)}updateFastbootTitle(e){if(!isFastBoot)return;const t=this.document.head,r=t.childNodes;for(let o=0;o<r.length;o++){const e=r[o];e&&"title"===e.nodeName.toLowerCase()&&t.removeChild(e)}const n=this.document.createElement("title"),i=this.document.createTextNode(e);n.appendChild(i),t.appendChild(n)}titleDidUpdate(e){}},_descriptor$1=_applyDecoratedDescriptor(_class$1.prototype,"router",[_dec$1],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_descriptor2=_applyDecoratedDescriptor(_class$1.prototype,"document",[_dec2],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_class$1),page_title_exports=__exportAll({default:()=>PageTitleService}),TargetActionSupport=Mixin.create({target:null,action:null,actionContext:null,actionContextObject:computed("actionContext",function(){let e=get$7(this,"actionContext");if("string"==typeof e){let t=get$7(this,e);return void 0===t&&(t=get$7(context$2.lookup,e)),t}return e}),triggerAction(e={}){let{action:t,target:r,actionContext:n}=e;t=t||get$7(this,"action"),r=r||getTarget(this),void 0===n&&(n=get$7(this,"actionContextObject")||this);let i=Array.isArray(n)?n:[n];if(r&&t){let e;if(e=isSendable(r)?r.send(t,...i):r[t](...i),!1!==e)return!0}return!1}});function isSendable(e){return null!=e&&"object"==typeof e&&"function"==typeof e.send}function getTarget(e){let t=get$7(e,"target");if(t){if("string"==typeof t){let r=get$7(e,t);return void 0===r&&(r=get$7(context$2.lookup,t)),r}return t}return e._target?e._target:null}var ActionSupport=Mixin.create({send(e,...t){let r=this.actions&&this.actions[e];if(r&&!0!==r.apply(this,t))return;let n=get$7(this,"target");n&&n.send(...arguments)}}),DEFAULT=Object.freeze({appendChild(){throw new Error("You can't use appendChild outside of the rendering process")},handleEvent:()=>!0,rerender(){},destroy(){}}),PRE_RENDER=Object.freeze({...DEFAULT}),HAS_ELEMENT=Object.freeze({...DEFAULT,rerender(e){e.renderer.rerender()},destroy(e){e.renderer.remove(e)},handleEvent:(e,t,r)=>!e.has(t)||flaggedInstrument(`interaction.${t}`,{},()=>join$2(e,e.trigger,t,r))}),IN_DOM=Object.freeze({...HAS_ELEMENT,enter(e){e.renderer.register(e)}}),DESTROYING$1=Object.freeze({...DEFAULT,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")}}),states=Object.freeze({preRender:PRE_RENDER,inDOM:IN_DOM,hasElement:HAS_ELEMENT,destroying:DESTROYING$1}),CoreView=class extends(FrameworkObject.extend(Evented,ActionHandler)){isView=!0;_superTrigger;_superHas;init(e){super.init(e),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{decorateFieldV2$1(this.prototype,"renderer",[inject$2("renderer","-dom")])}#Re=void initializeDeferredDecorator$1(this,"renderer");instrumentDetails(e){return e.object=this.toString(),e.containerKey=this._debugContainerKey,e.view=this,e}_trigger(e,...t){this._superTrigger(e,...t);let r=this[e];if("function"==typeof r)return r.apply(this,t)}_has(e){return"function"==typeof this[e]||this._superHas(e)}static isViewFactory=!0};CoreView.prototype._states=states;var component_exports=__exportAll({Input:()=>Input,Textarea:()=>Textarea,capabilities:()=>componentCapabilities,default:()=>Component$1,getComponentTemplate:()=>getComponentTemplate,setComponentManager:()=>setComponentManager,setComponentTemplate:()=>setComponentTemplate}),lazyEventsProcessed=new WeakMap,EMPTY_ARRAY=Object.freeze([]),Component$1=class extends(CoreView.extend(TargetActionSupport,ActionSupport,{didReceiveAttrs(){},didRender(){},didUpdate(){},didUpdateAttrs(){},willRender(){},willUpdate(){}},{concatenatedProperties:["attributeBindings","classNames","classNameBindings"],classNames:EMPTY_ARRAY,classNameBindings:EMPTY_ARRAY})){isComponent=!0;init(e){super.init(e),this._superRerender=this.rerender,this.rerender=this._rerender,this[IS_DISPATCHING_ATTRS]=!1,this[DIRTY_TAG]=createTag(),this[BOUNDS]=null;const t=this._dispatcher;if(t){let e=lazyEventsProcessed.get(t);e||(e=new WeakSet,lazyEventsProcessed.set(t,e));let r=Object.getPrototypeOf(this);e.has(r)||(t.lazyEvents.forEach((e,r)=>{null!==e&&"function"==typeof this[e]&&t.setupHandlerForBrowserEvent(r)}),e.add(r))}this.elementId||""===this.tagName||(this.elementId=guidFor(this))}__dispatcher;get _dispatcher(){if(void 0===this.__dispatcher){let e=getOwner$2(this);if(e.lookup("-environment:main").isInteractive){let t=e.lookup("event_dispatcher:main");this.__dispatcher=t}else this.__dispatcher=null}return this.__dispatcher}on(e,t,r){return this._dispatcher?.setupHandlerForEmberEvent(e),super.on(e,t,r)}_rerender(){DIRTY_TAG$1(this[DIRTY_TAG]),this._superRerender()}[PROPERTY_DID_CHANGE](e,t){if(this[IS_DISPATCHING_ATTRS])return;let r=getComponentCapturedArgs(this),n=void 0!==r?r[e]:void 0;void 0!==n&&isUpdatableRef(n)&&updateRef(n,2===arguments.length?t:get$7(this,e))}getAttr(e){return this.get(e)}readDOMAttr(e){let t=getViewElement(this),r="http://www.w3.org/2000/svg"===t.namespaceURI,{type:n,normalized:i}=normalizeProperty(t,e);return r||"attr"===n?t.getAttribute(i):t[i]}get childViews(){return getChildViews(this)}static{decorateMethodV2$1(this.prototype,"childViews",[nativeDescDecorator({configurable:!1,enumerable:!1})])}appendChild(e){addChildView(this,e)}_transitionTo(e){let t=this._currentState,r=this._currentState=this._states[e];this._state=e,t&&t.exit&&t.exit(this),r.enter&&r.enter(this)}nearestOfType(e){let t=this.parentView;for(;t;){if(e.detect(t.constructor))return t;t=t.parentView}}nearestWithProperty(e){let t=this.parentView;for(;t;){if(e in t)return t;t=t.parentView}}rerender(){return this._currentState.rerender(this)}get element(){return this.renderer.getElement(this)}static{decorateMethodV2$1(this.prototype,"element",[nativeDescDecorator({configurable:!1,enumerable:!1})])}appendTo(e){let t;return t=hasDOM&&"string"==typeof e?document.querySelector(e):e,this.renderer.appendTo(this,t),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(e,t){return this._currentState.handleEvent(this,e,t)}static isComponentFactory=!0;static toString(){return"@ember/component"}};function setComponentManager(e,t){return setComponentManager$1(e,t)}Component$1.reopenClass({positionalParams:[]}),setInternalComponentManager(CURLY_COMPONENT_MANAGER,Component$1);var templateOnly=templateOnlyComponent,lists_exports$3=__exportAll({default:()=>lists_default}),lists_default=setComponentTemplate(templateFactory({id:null,block:'[[[46,[28,[31,1],null,null],null,null,null]],[],["component","-outlet"]]',moduleName:"(unknown template module)",isStrictMode:!0}),templateOnly()),lists_exports$2=__exportAll({default:()=>ListsRoute}),ListsRoute=class extends Route{static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");activate(){this.mapUi.showSidebar()}},dist_exports=__exportAll({default:()=>Component}),DESTROYING=new WeakMap,DESTROYED=new WeakMap,ARGS_SET;function setDestroying(e){DESTROYING.set(e,!0)}function setDestroyed(e){DESTROYED.set(e,!0)}var GlimmerComponent=class{constructor(e,t){this.args=t,DESTROYING.set(this,!1),DESTROYED.set(this,!1)}args;get isDestroying(){return DESTROYING.get(this)||!1}get isDestroyed(){return DESTROYED.get(this)||!1}willDestroy(){}},BaseComponentManager=class{owner;constructor(e){this.owner=e}createComponent(e,t){return new e(this.owner,t.named)}getContext(e){return e}},CAPABILITIES=componentCapabilities("3.13",{destructor:!0,asyncLifecycleCallbacks:!1,updateHook:!1});function scheduledDestroyComponent(e){e.isDestroyed||(destroy(e),setDestroyed(e))}var EmberGlimmerComponentManager=class extends BaseComponentManager{capabilities=CAPABILITIES;destroyComponent(e){e.isDestroying||(setDestroying(e),schedule("actions",e,e.willDestroy),schedule("destroy",this,scheduledDestroyComponent,e))}},Component=class extends GlimmerComponent{constructor(e,t){super(e,t),setOwner$1(this,e)}};setComponentManager(e=>new EmberGlimmerComponentManager(e),Component);var setModifierManager=setModifierManager$1;function getArgs(e){return getValue$1(e.argsCache)}var SimpleArgsProxy=class{argsCache;constructor(e,t=()=>EMPTY_ARGS){let r=createCache(()=>t(e));this.argsCache=r}get named(){return getArgs(this).named||EMPTY_NAMED}get positional(){return getArgs(this).positional||EMPTY_POSITIONAL}};function invokeHelper(e,t,r){const n=getOwner$3(e),i=getInternalHelperManager(t).getDelegateFor(n);let o,s=new SimpleArgsProxy(e,r),a=i.createHelper(t,s);if(!hasValue(i))throw new Error("TODO: unreachable, to be implemented with hasScheduledEffect");return o=createCache(()=>i.getValue(a)),associateDestroyableChild(e,o),hasDestroyable(i)&&associateDestroyableChild(o,i.getDestroyable(a)),o}var and=internalHelper(({positional:e})=>createComputeRef(()=>{let t;for(let r=0;r<e.length;r++){let n=e[r];if(t=n?valueForRef(n):n,!toBool$1(t))return t}return t},null,"and"));function eq$2(e,t){return e===t}function gt$1(e,t){return e>t}function gte(e,t){return e>=t}function lt$1(e,t){return e<t}function lte(e,t){return e<=t}function neq$1(e,t){return e!==t}var not$1=(...e)=>!toBool$1(e[0]),or=internalHelper(({positional:e})=>createComputeRef(()=>{let t;for(let r=0;r<e.length;r++){let n=e[r];if(t=n?valueForRef(n):n,toBool$1(t))return t}return t},null,"or")),ELEMENT_CAPABILITIES={createInstance:!0,wrapped:!0},ElementComponentManager=class{getCapabilities(){return ELEMENT_CAPABILITIES}getDebugName(e){return`(element "${e.tagName}")`}getSelf(){return NULL_REFERENCE}getDestroyable(){return null}didCreateElement(){}create(e,t){return t.tagName||null}getTagName(e){return e}didRenderLayout(){}didUpdateLayout(){}didCreate(){}didUpdate(){}},ELEMENT_COMPONENT_MANAGER=new ElementComponentManager,ElementComponentDefinition=class{constructor(e){this.tagName=e}toString(){return`(element "${this.tagName}")`}};setInternalComponentManager(ELEMENT_COMPONENT_MANAGER,ElementComponentDefinition.prototype);var ELEMENT_DEFINITIONS=new Map;function getElementDefinition(e){let t=ELEMENT_DEFINITIONS.get(e);return void 0===t&&(t=new ElementComponentDefinition(e),ELEMENT_DEFINITIONS.set(e,t)),t}var element=internalHelper$1(({positional:e,named:t})=>createComputeRef(()=>getElementDefinition(valueForRef(e[0])),null,"element")),fn=fn$1;function truthConvert(e){return"object"==typeof e&&e&&"isTruthy"in e&&"boolean"==typeof e.isTruthy?e.isTruthy:isArray$5(e)?0!==e.length:!!e}var OrHelper=class extends Helper{compute(e){for(let t=0,r=e.length;t<r;t++)if(!0===truthConvert(e[t]))return e[t];return e[e.length-1]}};function eq$1(e,t){return e===t}var AndHelper=class extends Helper{compute(e){for(let t=0,r=e.length;t<r;t++)if(!1===truthConvert(e[t]))return e[t];return e[e.length-1]}};function not(...e){return e.every(e=>!truthConvert(e))}var IconComponent=class extends Component{get svg(){return getIcon(this.args.name)}get size(){return this.args.size||16}get color(){return this.args.color||"#898989"}get style(){return htmlSafe(`width:${this.size}px;height:${this.size}px;color:${this.color}`)}get title(){return this.args.title||""}get isFilled(){return this.args.filled||isIconFilled(this.args.name)}static{setComponentTemplate(templateFactory({id:null,block:'[[[41,[30,0,["svg"]],[[[1," "],[10,1],[15,0,[29,["icon ",[52,[30,0,["isFilled"]],"icon-filled"]]]],[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:"(unknown template module)",scope:()=>({htmlSafe:htmlSafe}),isStrictMode:!0}),this)}},PlaceEditForm=class extends Component{static{decorateFieldV2(this.prototype,"title",[tracked],function(){return""})}#Ie=void initializeDeferredDecorator(this,"title");static{decorateFieldV2(this.prototype,"description",[tracked],function(){return""})}#ke=void initializeDeferredDecorator(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(e){e.preventDefault(),this.args.onSave&&this.args.onSave({title:this.title,description:this.description})}static{decorateMethodV2(this.prototype,"handleSubmit",[action])}updateTitle(e){this.title=e.target.value}static{decorateMethodV2(this.prototype,"updateTitle",[action])}updateDescription(e){this.description=e.target.value}static{decorateMethodV2(this.prototype,"updateDescription",[action])}static{setComponentTemplate(templateFactory({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"],[1," "],[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:"(unknown template module)",scope:()=>({on:on}),isStrictMode:!0}),this)}};function installElement$1(e,t){const r=e;return r.element=t,r}var ClassBasedModifierManager=class{capabilities=modifierCapabilities("3.22");constructor(e){this.owner=e}createModifier(e,t){return{instance:new e(this.owner,t),element:null}}installModifier(e,t,r){installElement$1(e,t).instance.modify(t,r.positional,r.named)}updateModifier(e,t){e.instance.modify(e.element,t.positional,t.named)}destroyModifier({instance:e}){destroy(e)}},ClassBasedModifier=class{constructor(e,t){setOwner(this,e)}modify(e,t,r){}};function installElement(e,t){const r=e;return r.element=t,r}setModifierManager(e=>new ClassBasedModifierManager(e),ClassBasedModifier);var FunctionBasedModifierManager=class{capabilities=modifierCapabilities("3.22");createModifier(e){return{element:null,instance:e}}installModifier(e,t,r){const n=installElement(e,t),{positional:i,named:o}=r,s=e.instance(t,i,o);"function"==typeof s&&(n.teardown=s)}updateModifier(e,t){"function"==typeof e.teardown&&e.teardown();const r=e.instance(e.element,t.positional,t.named);"function"==typeof r&&(e.teardown=r)}destroyModifier(e){"function"==typeof e.teardown&&e.teardown()}getDebugName(e){return e.instance.toString()}getDebugInstance(e){return e}},MANAGER=new FunctionBasedModifierManager;function modifier(e,t){return e.toString=()=>t?.name||e.name,setModifierManager(()=>MANAGER,e)}var on_click_outside_default=modifier((e,[t])=>{const r=r=>{e&&!e.contains(r.target)&&t(r)},n=setTimeout(()=>{document.addEventListener("click",r)},0);return()=>{clearTimeout(n),document.removeEventListener("click",r)}}),PlaceListsManager=class extends Component{static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"_forceClear",[tracked],function(){return!1})}#Oe=void initializeDeferredDecorator(this,"_forceClear");get isSaved(){return this.args.isSaved}get placeListIds(){return this._forceClear?[]:this.args.place._listIds||[]}styleFor(e){return htmlSafe(`background-color: ${e}`)}isInList(e){return!!this.placeListIds&&this.placeListIds.includes(e.id)}static{decorateMethodV2(this.prototype,"isInList",[action])}async toggleSaved(){if(this.isSaved){const{osmId:e,osmType:t}=this.args.place;if(await this.storage.removePlace(this.args.place),this.args.place&&(this.args.place.id=null,this.args.place.createdAt=null,this.args.place._listIds=[],this._forceClear=!0),e&&t){const e={...this.args.place};delete e.id,delete e.createdAt,delete e._listIds,this.router.transitionTo("place",e)}else this.router.transitionTo("index");this.args.onClose&&this.args.onClose()}else await this.storage.storePlace(this.args.place)}static{decorateMethodV2(this.prototype,"toggleSaved",[action])}async toggleList(e){const t=!this.placeListIds.includes(e.id);t&&!this.isSaved&&await this.storage.storePlace(this.args.place);try{await this.storage.togglePlaceList(this.args.place,e.id,t)}catch(r){console.error(r),alert("Failed to update list: "+r.message)}}static{decorateMethodV2(this.prototype,"toggleList",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[11,0],[24,0,"place-lists-manager"],[4,[32,0],[[30,1]],null],[12],[1,"\\n "],[10,0],[14,0,"list-item master-toggle"],[12],[1,"\\n "],[10,"label"],[12],[1,"\\n "],[11,"input"],[16,"checked",[30,0,["isSaved"]]],[24,4,"checkbox"],[4,[32,1],["change",[30,0,["toggleSaved"]]],null],[12],[13],[1,"\\n "],[10,1],[14,0,"list-color-dot"],[12],[13],[1,"\\n "],[10,1],[14,0,"list-name"],[12],[1,"Saved places"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"divider"],[12],[13],[1,"\\n\\n "],[10,0],[14,0,"lists-container"],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["storage","lists"]]],null]],null],null,[[[1," "],[10,0],[14,0,"list-item"],[12],[1,"\\n "],[10,"label"],[12],[1,"\\n "],[11,"input"],[16,"checked",[28,[30,0,["isInList"]],[[30,2]],null]],[16,"disabled",[52,[51,[30,0,["isSaved"]]],true]],[24,4,"checkbox"],[4,[32,1],["change",[28,[32,2],[[30,0,["toggleList"]],[30,2]],null]],null],[12],[13],[1,"\\n"],[1," "],[10,1],[14,0,"list-color-dot"],[15,5,[28,[30,0,["styleFor"]],[[30,2,["color"]]],null]],[12],[13],[1,"\\n "],[10,1],[14,0,"list-name"],[12],[1,[30,2,["title"]]],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[2]],null],[1," "],[13],[1,"\\n"],[13]],["@onClose","list"],["each","-track-array","unless"]]',moduleName:"(unknown template module)",scope:()=>({onClickOutside:on_click_outside_default,on:on,fn:fn}),isStrictMode:!0}),this)}},Environment=class{assert(){}async(e){Promise.resolve().then(e)}reportUncaughtRejection(){this.async(e=>{throw e})}defer(){let e={promise:null,resolve:null,reject:null};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}globalDebuggingEnabled(){return!1}},DEFAULT_ENVIRONMENT=new Environment,BoundedPolicy=class{constructor(e){this.maxConcurrency=e||1}},TYPE_CANCELLED="CANCELLED",TYPE_STARTED="STARTED",TYPE_QUEUED="QUEUED",STARTED={type:TYPE_STARTED},QUEUED={type:TYPE_QUEUED},makeCancelState=e=>({type:TYPE_CANCELLED,reason:e}),CANCELLED$2=makeCancelState("it belongs to a 'drop' Task that was already running"),DropReducer=class{constructor(e){this.remainingSlots=e}step(){return this.remainingSlots>0?(this.remainingSlots--,STARTED):CANCELLED$2}},DropPolicy=class extends BoundedPolicy{makeReducer(){return new DropReducer(this.maxConcurrency)}},EnqueuedReducer=class{constructor(e){this.remainingSlots=e}step(){return this.remainingSlots>0?(this.remainingSlots--,STARTED):QUEUED}},EnqueuedPolicy=class extends BoundedPolicy{makeReducer(){return new EnqueuedReducer(this.maxConcurrency)}},CANCELLED$1=makeCancelState("it belongs to a 'keepLatest' Task that was already running"),KeepLatestReducer=class{constructor(e,t){this.remainingSlots=e,this.numToCancel=t}step(){return this.remainingSlots>0?(this.remainingSlots--,STARTED):this.numToCancel>0?(this.numToCancel--,CANCELLED$1):QUEUED}},KeepLatestPolicy=class extends BoundedPolicy{makeReducer(e,t){let r=e+t;return new KeepLatestReducer(this.maxConcurrency,r-this.maxConcurrency-1)}},CANCELLED=makeCancelState("it belongs to a 'restartable' Task that was .perform()ed again"),RestartableReducer=class{constructor(e){this.numToCancel=e}step(){return this.numToCancel>0?(this.numToCancel--,CANCELLED):STARTED}},RestartablePolicy=class extends BoundedPolicy{makeReducer(e,t){return new RestartableReducer(e+t-this.maxConcurrency)}},UnboundedReducer=class{step(){return STARTED}},SINGLETON_REDUCER=new UnboundedReducer,UnboundedPolicy=class{makeReducer(){return SINGLETON_REDUCER}},LAST_APPLIED_TAGS=new Map,Refresh=class{constructor(e,t,r){this.stateTracker=t,this.schedulerPolicy=e,this.initialTaskInstances=r,this.startingInstances=[]}process(){let[e,t,r]=this.filterFinishedTaskInstances(),n=this.schedulerPolicy.makeReducer(t,r),i=e.filter(e=>this.setTaskInstanceExecutionState(e,n.step()));return this.stateTracker.computeFinalStates(e=>this.applyState(e)),this.startingInstances.forEach(e=>e.start()),i}filterFinishedTaskInstances(){let e=0,t=0;return[this.initialTaskInstances.filter(r=>{let n=this.stateTracker.stateFor(r.task),i=r.executor.state;return i.isFinished?(n.onCompletion(r),!1):(i.hasStarted?e+=1:t+=1,!0)}),e,t]}setTaskInstanceExecutionState(e,t){let r=this.stateTracker.stateFor(e.task);switch(e.executor.counted||(e.executor.counted=!0,r.onPerformed(e)),t.type){case TYPE_CANCELLED:return e.cancel(t.reason),!1;case TYPE_STARTED:return e.executor.state.hasStarted||(this.startingInstances.push(e),r.onStart(e)),r.onRunning(e),!0;case TYPE_QUEUED:return r.onQueued(e),!0}}applyState(e){let{taskable:t}=e;if(!t.onState)return;const{guid:r}=t;if(LAST_APPLIED_TAGS.has(r)&&e.tag<LAST_APPLIED_TAGS.get(r))return;let n=Object.assign({numRunning:e.numRunning,numQueued:e.numQueued,numPerformedInc:e.numPerformedInc},e.attrs);t.onState(n,t),LAST_APPLIED_TAGS.set(r,e.tag)}},RefreshState=class{constructor(e,t){this.taskable=e,this.numRunning=0,this.numQueued=0,this.numPerformedInc=0,this.attrs={},this.tag=t}onCompletion(e){let t=e.completionState;this.attrs.lastRunning=null,this.attrs.lastComplete=e,1===t?this.attrs.lastSuccessful=e:(2===t?this.attrs.lastErrored=e:3===t&&(this.attrs.lastCanceled=e),this.attrs.lastIncomplete=e)}onPerformed(e){this.numPerformedInc+=1,this.attrs.lastPerformed=e}onStart(e){this.attrs.last=e}onRunning(e){this.attrs.lastRunning=e,this.numRunning+=1}onQueued(){this.numQueued+=1}applyStateFrom(e){Object.assign(this.attrs,e.attrs),this.numRunning+=e.numRunning,this.numQueued+=e.numQueued,this.numPerformedInc+=e.numPerformedInc}},CURRENT_REFRESH_TAGS=new Map,StateTracker=class{constructor(){this.states=new Map}stateFor(e){let t=e.guid,r=this.states.get(t);if(!r){let n=CURRENT_REFRESH_TAGS.has(t)?CURRENT_REFRESH_TAGS.get(t):0;r=new RefreshState(e,++n),this.states.set(t,r),CURRENT_REFRESH_TAGS.set(t,n)}return r}computeFinalStates(e){this.forEachState(t=>e(t))}forEachState(e){this.states.forEach(t=>e(t))}},NullState=class{onCompletion(){}onPerformed(){}onStart(){}onRunning(){}onQueued(){}},NULL_STATE=new NullState,NullStateTracker=class{stateFor(){return NULL_STATE}computeFinalStates(){}},Scheduler=class{constructor(e,t){this.schedulerPolicy=e,this.stateTrackingEnabled=t,this.taskInstances=[]}cancelAll(e,t){let r=this.taskInstances.map(r=>{r.task.guids[e]&&r.executor.cancel(t)}).filter(e=>!!e);return Promise.all(r)}perform(e){e.onFinalize(()=>this.scheduleRefresh()),this.taskInstances.push(e),this.refresh()}scheduleRefresh(){Promise.resolve().then(()=>this.refresh())}refresh(){let e=this.stateTrackingEnabled?new StateTracker:new NullStateTracker,t=new Refresh(this.schedulerPolicy,e,this.taskInstances);this.taskInstances=t.process()}},GeneratorStepResult=class{constructor(e,t,r){this.value=e,this.done=t,this.errored=r}},GeneratorState=class{constructor(e){this.done=!1,this.generatorFactory=e,this.iterator=null}step(e,t){try{let{value:r,done:n}=this.getIterator()[t](e);return n?this.finalize(r,!1):new GeneratorStepResult(r,!1,!1)}catch(r){return this.finalize(r,!0)}}getIterator(){return this.iterator||this.done||(this.iterator=this.generatorFactory()),this.iterator}finalize(e,t){return this.done=!0,this.iterator=null,new GeneratorStepResult(e,!0,t)}},cancelableSymbol="__ec_cancel__",yieldableSymbol="__ec_yieldable__",YIELDABLE_CONTINUE="next",YIELDABLE_THROW="throw",YIELDABLE_RETURN="return",YIELDABLE_CANCEL="cancel",YieldableState=class{constructor(e,t){this._taskInstance=e,this._resumeIndex=t}getTaskInstance(){return this._taskInstance}cancel(){let e=this._taskInstance;e.proceed.call(e,this._resumeIndex,YIELDABLE_CANCEL)}next(e){let t=this._taskInstance;t.proceed.call(t,this._resumeIndex,YIELDABLE_CONTINUE,e)}return(e){let t=this._taskInstance;t.proceed.call(t,this._resumeIndex,YIELDABLE_RETURN,e)}throw(e){let t=this._taskInstance;t.proceed.call(t,this._resumeIndex,YIELDABLE_THROW,e)}},Yieldable=class{constructor(){this[yieldableSymbol]=this[yieldableSymbol].bind(this)}onYield(){}_deferable(){let e={resolve:void 0,reject:void 0};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}_toPromise(){let e=this._deferable(),t=this[yieldableSymbol]({proceed(t,r,n){"next"==r||"return"==r?e.resolve(n):e.reject(n)}},0);return e.promise[cancelableSymbol]=t,e.promise}then(...e){return this._toPromise().then(...e)}catch(...e){return this._toPromise().catch(...e)}finally(...e){return this._toPromise().finally(...e)}[yieldableSymbol](e,t){let r=new YieldableState(e,t);return this.onYield(r)}},ForeverYieldable=class extends Yieldable{onYield(){}},forever=new ForeverYieldable,INITIAL_STATE={completionState:0,value:null,error:null,isSuccessful:!1,isError:!1,isCanceled:!1,hasStarted:!1,isFinished:!1},TASK_CANCELATION_NAME="TaskCancelation";function didCancel(e){return e&&"TaskCancelation"===e.name}var CANCEL_KIND_EXPLICIT="explicit",CANCEL_KIND_YIELDABLE_CANCEL="yielded",CANCEL_KIND_LIFESPAN_END="lifespan_end",CANCEL_KIND_PARENT_CANCEL="parent_cancel",CancelRequest=class{constructor(e,t){this.kind=e,this.reason=t,this.promise=new Promise(e=>{this.finalize=e})}},PERFORM_TYPE_DEFAULT="PERFORM_TYPE_DEFAULT",PERFORM_TYPE_UNLINKED="PERFORM_TYPE_UNLINKED",PERFORM_TYPE_LINKED="PERFORM_TYPE_LINKED",CANCEL_RETURN_VALUE_SENTINEL={},TASK_INSTANCE_STACK=[];function getRunningInstance(){return TASK_INSTANCE_STACK[TASK_INSTANCE_STACK.length-1]}var TaskInstanceExecutor=class{constructor({generatorFactory:e,env:t,debug:r}){this.generatorState=new GeneratorState(e),this.state=Object.assign({},INITIAL_STATE),this.index=1,this.disposers=[],this.finalizeCallbacks=[],this.env=t,this.debug=r,this.cancelRequest=null}start(){this.state.hasStarted||this.cancelRequest||(this.setState({hasStarted:!0}),this.proceedSync(YIELDABLE_CONTINUE,void 0))}cancel(e){return this.requestCancel(e)?(this.state.hasStarted?this.proceedWithCancelAsync():this.finalizeWithCancel(),this.cancelRequest.promise):(e.finalize(),e.promise)}setState(e){Object.assign(this.state,e),this.taskInstance.setState(this.state)}proceedChecked(e,t,r){this.state.isFinished||this.advanceIndex(e)&&("cancel"===t?(this.requestCancel(new CancelRequest(CANCEL_KIND_YIELDABLE_CANCEL),r),this.proceedWithCancelAsync()):this.proceedAsync(t,r))}proceedWithCancelAsync(){this.proceedAsync(YIELDABLE_RETURN,CANCEL_RETURN_VALUE_SENTINEL)}proceedAsync(e,t){this.advanceIndex(this.index),this.env.async(()=>this.proceedSync(e,t))}proceedSync(e,t){this.state.isFinished||(this.dispose(),this.generatorState.done?this.handleResolvedReturnedValue(e,t):this.handleResolvedContinueValue(e,t))}handleResolvedContinueValue(e,t){let r=this.index,n=this.generatorStep(t,e);this.advanceIndex(r)&&(n.errored?this.finalize(n.value,2):this.handleYieldedValue(n))}handleResolvedReturnedValue(e,t){switch(e){case YIELDABLE_CONTINUE:case YIELDABLE_RETURN:this.finalize(t,1);break;case YIELDABLE_THROW:this.finalize(t,2)}}handleYieldedUnknownThenable(e){let t=this.index;e.then(e=>{this.proceedChecked(t,YIELDABLE_CONTINUE,e)},e=>{this.proceedChecked(t,YIELDABLE_THROW,e)})}advanceIndex(e){if(this.index===e)return++this.index}handleYieldedValue(e){let t=e.value;t?(this.addDisposer(t[cancelableSymbol]),t.__ec_yieldable__?this.invokeYieldable(t):"function"==typeof t.then?this.handleYieldedUnknownThenable(t):this.proceedWithSimpleValue(t)):this.proceedWithSimpleValue(t)}proceedWithSimpleValue(e){this.proceedAsync(YIELDABLE_CONTINUE,e)}addDisposer(e){"function"==typeof e&&this.disposers.push(e)}dispose(){let e=this.disposers;0!==e.length&&(this.disposers=[],e.forEach(e=>e()))}generatorStep(e,t){TASK_INSTANCE_STACK.push(this);let r=this.generatorState.step(e,t);if(TASK_INSTANCE_STACK.pop(),this._expectsLinkedYield){let e=r.value;e&&"PERFORM_TYPE_LINKED"===e.performType||console.warn("You performed a .linked() task without immediately yielding/returning it. This is currently unsupported (but might be supported in future version of ember-concurrency)."),this._expectsLinkedYield=!1}return r}maybeResolveDefer(){this.defer&&this.state.isFinished&&(1===this.state.completionState?this.defer.resolve(this.state.value):this.defer.reject(this.state.error))}onFinalize(e){this.finalizeCallbacks.push(e),this.state.isFinished&&this.runFinalizeCallbacks()}runFinalizeCallbacks(){this.finalizeCallbacks.forEach(e=>e()),this.finalizeCallbacks=[],this.maybeResolveDefer(),this.maybeThrowUnhandledTaskErrorLater()}promise(){return this.defer||(this.defer=this.env.defer(),this.asyncErrorsHandled=!0,this.maybeResolveDefer()),this.defer.promise}maybeThrowUnhandledTaskErrorLater(){this.asyncErrorsHandled||2!==this.state.completionState||didCancel(this.state.error)||this.env.async(()=>{this.asyncErrorsHandled||this.env.reportUncaughtRejection(this.state.error)})}requestCancel(e){return!this.cancelRequest&&!this.state.isFinished&&(this.cancelRequest=e,!0)}finalize(e,t){if(this.cancelRequest)return this.finalizeWithCancel();let r={completionState:t};1===t?(r.isSuccessful=!0,r.value=e):2===t?(r.isError=!0,r.error=e):3===t&&(r.error=e),this.finalizeShared(r)}finalizeWithCancel(){let e=this.taskInstance.formatCancelReason(this.cancelRequest.reason),t=new Error(e);this.debugEnabled()&&console.log(e),t.name=TASK_CANCELATION_NAME,this.finalizeShared({isCanceled:!0,completionState:3,error:t,cancelReason:e}),this.cancelRequest.finalize()}debugEnabled(){return this.debug||this.env.globalDebuggingEnabled()}finalizeShared(e){this.index++,e.isFinished=!0,this.setState(e),this.runFinalizeCallbacks()}invokeYieldable(e){try{let t=e[yieldableSymbol](this.taskInstance,this.index);this.addDisposer(t)}catch(t){this.env.reportUncaughtRejection(t)}}onYielded(e,t){this.asyncErrorsHandled=!0,this.onFinalize(()=>{let r=this.state.completionState;1===r?e.proceed(t,YIELDABLE_CONTINUE,this.state.value):2===r?e.proceed(t,YIELDABLE_THROW,this.state.error):3===r&&e.proceed(t,YIELDABLE_CANCEL,null)});let r=this.getPerformType();if("PERFORM_TYPE_UNLINKED"!==r)return()=>{this.detectSelfCancelLoop(r,e),this.cancel(new CancelRequest(CANCEL_KIND_PARENT_CANCEL))}}getPerformType(){return this.taskInstance.performType||"PERFORM_TYPE_DEFAULT"}detectSelfCancelLoop(e,t){if("PERFORM_TYPE_DEFAULT"!==e)return;let r=t.executor&&t.executor.cancelRequest;!r||"lifespan_end"!==r.kind||this.cancelRequest||this.state.isFinished||this.taskInstance.selfCancelLoopWarning(t)}},DEFAULT_STATE={last:null,lastRunning:null,lastPerformed:null,lastSuccessful:null,lastComplete:null,lastErrored:null,lastCanceled:null,lastIncomplete:null,performCount:0};Object.freeze(DEFAULT_STATE);var guidId=0;function makeGuid(){return"ec_"+guidId++}var Taskable=class{constructor(e){this.context=e.context,this.debug=e.debug||!1,this.enabledModifiers=e.enabledModifiers,this.env=e.env,this.group=e.group,this.hasEnabledEvents=e.hasEnabledEvents,this.modifierOptions=e.modifierOptions,this.name=e.name,this.onStateCallback=e.onStateCallback,this.scheduler=e.scheduler,this.guid=makeGuid(),this.guids={},this.guids[this.guid]=!0,this.group&&Object.assign(this.guids,this.group.guids)}cancelAll(e){let{reason:t,cancelRequestKind:r,resetState:n}=e||{};t=t||".cancelAll() was explicitly called on the Task";let i=new CancelRequest(r||"explicit",t);return this.scheduler.cancelAll(this.guid,i).then(()=>{n&&this._resetState()})}get _isAlive(){return!0}_resetState(){this.setState(DEFAULT_STATE)}setState(){}};Object.assign(Taskable.prototype,DEFAULT_STATE),Object.assign(Taskable.prototype,{numRunning:0,numQueued:0,isRunning:!1,isQueued:!1,isIdle:!0,state:"idle"});var TaskLinkProxy=class{constructor(e,t,r){this.task=e,this.performType=t,this.linkedObject=r}perform(...e){return this.task._performShared(e,this.performType,this.linkedObject)}},Task$1=class e extends Taskable{constructor(e){super(e),this.generatorFactory=e.generatorFactory,this.perform=this._perform.bind(this)}linked(){let e=getRunningInstance();if(!e)throw new Error("You can only call .linked() from within a task.");return new TaskLinkProxy(this,PERFORM_TYPE_LINKED,e)}unlinked(){return new TaskLinkProxy(this,PERFORM_TYPE_UNLINKED,null)}toString(){return`<Task:${this.name}>`}_clone(){return new e({context:this.context,debug:this.debug,env:this.env,generatorFactory:this.generatorFactory,group:this.group,hasEnabledEvents:this.hasEnabledEvents,name:this.name,onStateCallback:this.onStateCallback,scheduler:this.scheduler})}_curry(...e){let t=this._clone();return t._curryArgs=[...this._curryArgs||[],...e],t}_perform(...e){return this._performShared(e,PERFORM_TYPE_DEFAULT,null)}_performShared(e,t,r){let n=this._curryArgs?[...this._curryArgs,...e]:e,i=this._taskInstanceFactory(n,t,r);return"PERFORM_TYPE_LINKED"===t&&(r._expectsLinkedYield=!0),this._isAlive||i.cancel(),this.scheduler.perform(i),i}_taskInstanceOptions(e,t,r){return{args:e,executor:new TaskInstanceExecutor({generatorFactory:()=>this.generatorFactory(e),env:this.env,debug:this.debug}),performType:t,hasEnabledEvents:this.hasEnabledEvents}}};function assertUnsetBufferPolicy(e){if(e._hasSetBufferPolicy)throw new Error(`Cannot set multiple buffer policies on a task. ${e._schedulerPolicyClass} has already been set for task '${e.name}'`)}var MODIFIER_REGISTRY={enqueue:(e,t)=>t&&e.setBufferPolicy(EnqueuedPolicy),debug:(e,t)=>t&&e.setDebug(t),drop:(e,t)=>t&&e.setBufferPolicy(DropPolicy),keepLatest:(e,t)=>t&&e.setBufferPolicy(KeepLatestPolicy),maxConcurrency:(e,t)=>e.setMaxConcurrency(t),onState:(e,t)=>e.setOnState(t),restartable:(e,t)=>t&&e.setBufferPolicy(RestartablePolicy)};function hasModifier(e){return e in MODIFIER_REGISTRY}var TaskFactory$1=class{env=DEFAULT_ENVIRONMENT;_debug=null;_enabledModifiers=[];_hasSetConcurrencyConstraint=!1;_hasSetBufferPolicy=!1;_hasEnabledEvents=!1;_maxConcurrency=null;_onStateCallback=(e,t)=>t.setState(e);_schedulerPolicyClass=UnboundedPolicy;constructor(e="<unknown>",t=null,r={}){this.name=e,this.taskDefinition=t,this.options=r,this._processModifierOptions(r)}createTask(e){let t=this.getTaskOptions(e);return new Task$1(Object.assign({generatorFactory:t=>this.taskDefinition.apply(e,t)},t))}getModifier(e){if(hasModifier(e))return MODIFIER_REGISTRY[e].bind(null,this)}getOptions(){return this.options}getScheduler(e,t){return new Scheduler(e,t)}getTaskOptions(e){let t,r=this._onStateCallback,n=new this._schedulerPolicyClass(this._maxConcurrency);return t=this.getScheduler(n,r&&"function"==typeof r),{context:e,debug:this._debug,env:this.env,name:this.name,group:void 0,scheduler:t,hasEnabledEvents:this._hasEnabledEvents,onStateCallback:r,enabledModifiers:this._enabledModifiers,modifierOptions:this.getOptions()}}setBufferPolicy(e){return assertUnsetBufferPolicy(this),this._hasSetBufferPolicy=!0,this._hasSetConcurrencyConstraint=!0,this._schedulerPolicyClass=e,this}setDebug(e){return this._debug=e,this}setEvented(e){return this._hasEnabledEvents=e,this}setMaxConcurrency(e){return this._hasSetConcurrencyConstraint=!0,this._maxConcurrency=e,this}setName(e){return this.name=e,this}setOnState(e){return this._onStateCallback=e,this}setTaskDefinition(e){return this.taskDefinition=e,this}_processModifierOptions(e){if(e)for(let t of Object.keys(e)){let r=e[t],n=this.getModifier(t);"function"==typeof n&&n(r)&&this._enabledModifiers.push(t)}}},rsvp_exports=__exportAll({EventTarget:()=>EventTarget,Promise:()=>Promise$1,all:()=>all$3,allSettled:()=>allSettled$1,asap:()=>asap,async:()=>async$1,cast:()=>cast,configure:()=>configure,default:()=>RSVP,defer:()=>defer$1,denodeify:()=>denodeify,filter:()=>filter$1,hash:()=>hash$5,hashSettled:()=>hashSettled$1,map:()=>map$2,off:()=>off,on:()=>on$2,race:()=>race$2,reject:()=>reject,resolve:()=>resolve$3,rethrow:()=>rethrow}),EmberEnvironment=class extends Environment{assert(...e){assert$4(...e)}async(e){join$2(()=>schedule("actions",e))}reportUncaughtRejection(e){next(null,function(){const t=getOnerror();if(!t)throw e;t(e)})}defer(){return defer$1()}globalDebuggingEnabled(){return!1}},EMBER_ENVIRONMENT=new EmberEnvironment,EmberScheduler=class extends Scheduler{scheduleRefresh(){once(this,this.refresh)}},EXPLICIT_CANCEL_REASON=".cancel() was explicitly called",BaseTaskInstance=class{constructor({task:e,args:t,executor:r,performType:n,hasEnabledEvents:i}){this.task=e,this.args=t,this.performType=n,this.executor=r,this.executor.taskInstance=this,this.hasEnabledEvents=i}setState(){}formatCancelReason(){}selfCancelLoopWarning(){}onFinalize(e){this.executor.onFinalize(e)}proceed(e,t,r){this.executor.proceedChecked(e,t,r)}[yieldableSymbol](e,t){return this.executor.onYielded(e,t)}cancel(e=EXPLICIT_CANCEL_REASON){this.executor.cancel(new CancelRequest(CANCEL_KIND_EXPLICIT,e))}then(...e){return this.executor.promise().then(...e)}catch(...e){return this.executor.promise().catch(...e)}finally(...e){return this.executor.promise().finally(...e)}toString(){return`${this.task} TaskInstance`}start(){return this.executor.start(),this}},TRACKED_INITIAL_TASK_STATE,TRACKED_INITIAL_INSTANCE_STATE;function trackMixin(e,t,r){const n=Object.getOwnPropertyDescriptor(e,r);return n.initializer=n.initializer||(()=>e[r]),delete n.value,t[r]=tracked(t,r,n),t}function applyTracked(e,t){return Object.keys(e).reduce((t,r)=>trackMixin(e,t,r),t)}Object.assign(BaseTaskInstance.prototype,INITIAL_STATE),Object.assign(BaseTaskInstance.prototype,{state:"waiting",isDropped:!1,isRunning:!0}),TRACKED_INITIAL_TASK_STATE=applyTracked(DEFAULT_STATE,{}),TRACKED_INITIAL_TASK_STATE=applyTracked({numRunning:0,numQueued:0,isRunning:!1,isQueued:!1,isIdle:!0,state:"idle"},TRACKED_INITIAL_TASK_STATE),TRACKED_INITIAL_INSTANCE_STATE=applyTracked(INITIAL_STATE,{}),TRACKED_INITIAL_INSTANCE_STATE=applyTracked({state:"waiting",isDropped:!1,isRunning:!1},TRACKED_INITIAL_INSTANCE_STATE),Object.freeze(TRACKED_INITIAL_TASK_STATE),Object.freeze(TRACKED_INITIAL_INSTANCE_STATE);var TaskInstance=class extends BaseTaskInstance{setState(e){let t=this._recomputeState(e);Object.assign(this,{...e,isRunning:!e.isFinished,isDropped:"dropped"===t,state:t})}_recomputeState(e){return e.isDropped?"dropped":e.isCanceled?e.hasStarted?"canceled":"dropped":e.isFinished?"finished":e.hasStarted?"running":"waiting"}formatCancelReason(e){return`TaskInstance '${this.getName()}' was canceled because ${e}. For more information, see: http://ember-concurrency.com/docs/task-cancelation-help`}getName(){return this.name||(this.name=this.task&&this.task.name||"<unknown>"),this.name}selfCancelLoopWarning(e){let t=`\`${e.getName()}\``,r=`\`${this.getName()}\``;console.warn(`ember-concurrency detected a potentially hazardous "self-cancel loop" between parent task ${t} and child task ${r}. If you want child task ${r} to be canceled when parent task ${t} is canceled, please change \`.perform()\` to \`.linked().perform()\`. If you want child task ${r} to keep running after parent task ${t} is canceled, change it to \`.unlinked().perform()\``)}triggerEvent(...e){if(!this.hasEnabledEvents)return;let t=this.task,r=t.context,n=t&&t.name;if(r&&r.trigger&&n){let[t,...i]=e;r.trigger(`${n}:${t}`,...i)}}};TRACKED_INITIAL_INSTANCE_STATE&&Object.defineProperties(TaskInstance.prototype,TRACKED_INITIAL_INSTANCE_STATE);var TASKABLE_MIXIN={_performCount:0,setState(e){this._performCount=this._performCount+(e.numPerformedInc||0);let t=e.numRunning>0,r=e.numQueued>0,n=Object.assign({},e,{performCount:this._performCount,isRunning:t,isQueued:r,isIdle:!t&&!r,state:t?"running":"idle"});Object.assign(this,n)},onState(e,t){t.onStateCallback&&t.onStateCallback(e,t)}},Task=class e extends Task$1{constructor(e){super(e),isDestroying(this.context)||registerDestructor(this.context,()=>{this.cancelAll({reason:"the object it lives on was destroyed or unrendered",cancelRequestKind:CANCEL_KIND_LIFESPAN_END})})}get _isAlive(){return!isDestroying(this.context)}_taskInstanceFactory(e,t,r){let n=this._taskInstanceOptions(e,t,r);return n.task=this,new TaskInstance(n)}_clone(){return new e({context:this.context,debug:this.debug,env:this.env,generatorFactory:this.generatorFactory,group:this.group,hasEnabledEvents:this.hasEnabledEvents,name:this.name,onStateCallback:this.onStateCallback,scheduler:this.scheduler})}};TRACKED_INITIAL_TASK_STATE&&Object.defineProperties(Task.prototype,TRACKED_INITIAL_TASK_STATE),Object.assign(Task.prototype,TASKABLE_MIXIN);var TaskFactory=class extends TaskFactory$1{env=EMBER_ENVIRONMENT;createTask(e){assert$4("Cannot create task if a task definition is not provided as generator function",this.taskDefinition);let t=this.getTaskOptions(e);return new Task(Object.assign({generatorFactory:t=>this.taskDefinition.apply(e,t)},t))}getModifier(e){let t=super.getModifier(e);return assert$4(`Task option '${e}' is not recognized as a supported option.`,t),t}getScheduler(e,t){return new EmberScheduler(e,t)}get taskFn(){return this.taskDefinition}set taskFn(e){this.setTaskDefinition(e)}};function buildTask(e,t,r,n){let i=t;n&&(i=Object.assign({},i),i[n]=!0);const o=e();return new TaskFactory(r||"<unknown>",o.generator,i).createTask(o.context)}var Blurhash=class extends Component{renderBlurhash=modifier((e,[t,r,n])=>{if(!t||!e)return;const i=r||32,o=n||18;e.width=i,e.height=o;const s=e.getContext("2d");if(s)try{const e=j(t,i,o),r=s.createImageData(i,o);r.data.set(e),s.putImageData(r,0,0)}catch(a){console.warn("Failed to decode blurhash:",a.message||a)}});static{setComponentTemplate(templateFactory({id:null,block:'[[[11,"canvas"],[24,0,"blurhash-canvas"],[17,1],[4,[30,0,["renderBlurhash"]],[[30,2],[30,3],[30,4]],null],[12],[13]],["&attrs","@hash","@width","@height"],[]]',moduleName:"(unknown template module)",isStrictMode:!0}),this)}},MAX_IMAGE_DIMENSION=1920,IMAGE_QUALITY=.9,MAX_THUMBNAIL_DIMENSION=350,THUMBNAIL_QUALITY=.9,PlacePhotoUploadItem=class extends Component{static{decorateFieldV2(this.prototype,"blossom",[service])}#Me=void initializeDeferredDecorator(this,"blossom");static{decorateFieldV2(this.prototype,"imageProcessor",[service])}#De=void initializeDeferredDecorator(this,"imageProcessor");static{decorateFieldV2(this.prototype,"toast",[service])}#fe=void initializeDeferredDecorator(this,"toast");static{decorateFieldV2(this.prototype,"thumbnailUrl",[tracked],function(){return""})}#Ne=void initializeDeferredDecorator(this,"thumbnailUrl");static{decorateFieldV2(this.prototype,"blurhash",[tracked],function(){return""})}#$e=void initializeDeferredDecorator(this,"blurhash");static{decorateFieldV2(this.prototype,"error",[tracked],function(){return""})}#Fe=void initializeDeferredDecorator(this,"error");static{decorateFieldV2(this.prototype,"statusText",[tracked],function(){return""})}#Be=void initializeDeferredDecorator(this,"statusText");constructor(){super(...arguments),this.args.file&&(this.thumbnailUrl=URL.createObjectURL(this.args.file),this.uploadTask.perform(this.args.file))}willDestroy(){super.willDestroy(...arguments),this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl)}showErrorToast(){this.error&&this.toast.show(this.error)}static{decorateMethodV2(this.prototype,"showErrorToast",[action])}uploadTask=buildTask(()=>({context:this,generator:function*(e){this.error="",this.statusText="Processing";try{const t=yield this.imageProcessor.process(e,MAX_IMAGE_DIMENSION,IMAGE_QUALITY,!0);this.blurhash=t.blurhash;const r=yield this.imageProcessor.process(e,MAX_THUMBNAIL_DIMENSION,THUMBNAIL_QUALITY,!1);let n,i;const o=isMobile(),s=e=>{"signing"===e&&(this.statusText="Signing photo upload"),"uploading"===e&&(this.statusText="Uploading photo")},a=e=>{"signing"===e&&(this.statusText="Signing thumbnail upload"),"uploading"===e&&(this.statusText="Uploading thumbnail")};if(o)n=yield this.blossom.upload(t.blob,{sequential:!0,onProgress:s}),i=yield this.blossom.upload(r.blob,{sequential:!0,onProgress:a});else{const e=this.blossom.upload(t.blob,{onProgress:s}),o=this.blossom.upload(r.blob,{onProgress:a});[n,i]=yield Promise.all([e,o])}this.args.onSuccess&&this.args.onSuccess({file:e,url:n.url,fallbackUrls:n.fallbackUrls,thumbUrl:i.url,blurhash:t.blurhash,type:"image/jpeg",dim:t.dim,hash:n.hash,thumbHash:i.hash})}catch(t){this.error=t.message}}}),null,"uploadTask",null);static{setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[15,0,[29,["photo-upload-item\\n ",[52,[30,0,["uploadTask","isRunning"]],"is-uploading"],"\\n ",[52,[30,0,["error"]],"has-error"]]]],[12],[1,"\\n"],[41,[30,0,["blurhash"]],[[[1," "],[8,[32,0],[[24,0,"place-header-photo-blur"]],[["@hash"],[[30,0,["blurhash"]]]],null],[1,"\\n"]],[]],null],[1," "],[10,"img"],[15,"src",[30,0,["thumbnailUrl"]]],[14,"alt","thumbnail"],[12],[13],[1,"\\n\\n"],[41,[30,0,["uploadTask","isRunning"]],[[[1," "],[10,0],[14,0,"overlay"],[12],[1,"\\n "],[8,[32,1],[[24,0,"spin-animation"]],[["@name","@size","@color"],["loading-ring",24,"white"]],null],[1,"\\n"],[41,[30,0,["statusText"]],[[[1," "],[10,1],[14,0,"upload-status-text"],[12],[1,[30,0,["statusText"]]],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["error"]],[[[1," "],[11,"button"],[24,0,"overlay error-overlay"],[16,"title",[30,0,["error"]]],[24,4,"button"],[4,[32,2],["click",[30,0,["showErrorToast"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["alert-circle",24,"white"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[11,"button"],[24,0,"btn-remove-photo"],[24,"title","Remove photo"],[24,4,"button"],[4,[32,2],["click",[28,[32,3],[[30,1],[30,2]],null]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",16,"white"]],null],[1,"\\n "],[13],[1,"\\n"],[13]],["@onRemove","@file"],["if"]]',moduleName:"(unknown template module)",scope:()=>({Blurhash:Blurhash,Icon:IconComponent,on:on,fn:fn}),isStrictMode:!0}),this)}},capitalize_default=helper$1(function([e]){return capitalize(e)}),includes_default=helper$1(function([e,t]){return!!Array.isArray(e)&&e.includes(t)}),PlacePhotoUpload=class extends Component{static{decorateFieldV2(this.prototype,"nostrAuth",[service])}#x=void initializeDeferredDecorator(this,"nostrAuth");static{decorateFieldV2(this.prototype,"nostrRelay",[service])}#q=void initializeDeferredDecorator(this,"nostrRelay");static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");static{decorateFieldV2(this.prototype,"blossom",[service])}#Me=void initializeDeferredDecorator(this,"blossom");static{decorateFieldV2(this.prototype,"toast",[service])}#fe=void initializeDeferredDecorator(this,"toast");static{decorateFieldV2(this.prototype,"file",[tracked],function(){return null})}#Ue=void initializeDeferredDecorator(this,"file");static{decorateFieldV2(this.prototype,"uploadedPhoto",[tracked],function(){return null})}#ze=void initializeDeferredDecorator(this,"uploadedPhoto");static{decorateFieldV2(this.prototype,"error",[tracked],function(){return""})}#Fe=void initializeDeferredDecorator(this,"error");static{decorateFieldV2(this.prototype,"isPublishing",[tracked],function(){return!1})}#Ve=void initializeDeferredDecorator(this,"isPublishing");static{decorateFieldV2(this.prototype,"isDragging",[tracked],function(){return!1})}#je=void initializeDeferredDecorator(this,"isDragging");static{decorateFieldV2(this.prototype,"selectedTags",[tracked],function(){return[]})}#Ge=void initializeDeferredDecorator(this,"selectedTags");static{decorateFieldV2(this.prototype,"altText",[tracked],function(){return""})}#He=void initializeDeferredDecorator(this,"altText");get place(){return this.args.place||{}}get title(){return this.place.title||"this place"}get allUploaded(){return this.file&&this.uploadedPhoto&&this.file===this.uploadedPhoto.file}get suggestedTags(){return getSuggestedPhotoTags(this.place)}handleFileSelect(e){this.addFile(e.target.files[0]),e.target.value=""}static{decorateMethodV2(this.prototype,"handleFileSelect",[action])}handleDragOver(e){e.preventDefault(),this.isDragging=!0}static{decorateMethodV2(this.prototype,"handleDragOver",[action])}handleDragLeave(e){e.preventDefault(),this.isDragging=!1}static{decorateMethodV2(this.prototype,"handleDragLeave",[action])}handleDrop(e){e.preventDefault(),this.isDragging=!1,e.dataTransfer.files.length>0&&this.addFile(e.dataTransfer.files[0])}static{decorateMethodV2(this.prototype,"handleDrop",[action])}addFile(e){e&&e.type.startsWith("image/")?(this.error="",this.uploadedPhoto&&this.deletePhotoTask.perform(this.uploadedPhoto),this.file=e,this.uploadedPhoto=null,this.args.onUploadStateChange&&this.args.onUploadStateChange(!0)):this.error="Please select a valid image file."}handleUploadSuccess(e){this.uploadedPhoto=e}static{decorateMethodV2(this.prototype,"handleUploadSuccess",[action])}removeFile(){this.uploadedPhoto&&this.deletePhotoTask.perform(this.uploadedPhoto),this.file=null,this.uploadedPhoto=null,this.selectedTags=[],this.altText="",this.args.onUploadStateChange&&this.args.onUploadStateChange(!1)}static{decorateMethodV2(this.prototype,"removeFile",[action])}toggleTag(e){this.selectedTags.includes(e)?this.selectedTags=[]:this.selectedTags=[e]}static{decorateMethodV2(this.prototype,"toggleTag",[action])}updateAltText(e){this.altText=e.target.value}static{decorateMethodV2(this.prototype,"updateAltText",[action])}deletePhotoTask=buildTask(()=>({context:this,generator:function*(e){try{e.hash&&(yield this.blossom.delete(e.hash)),e.thumbHash&&(yield this.blossom.delete(e.thumbHash))}catch(t){this.toast.show(`Failed to delete photo from server: ${t.message}`,5e3)}}}),null,"deletePhotoTask",null);async publish(){if(!this.nostrAuth.isConnected)return void(this.error="You must connect Nostr first.");if(!this.allUploaded)return void(this.error="Please wait for all photos to finish uploading.");const{osmId:e,lat:t,lon:r}=this.place,n=this.place.osmType||"node";if(e){this.error="",this.isPublishing=!0;try{const i=[["i",`osm:${n}:${e}`]];for(const e of this.selectedTags)i.push(["t",e]);t&&r&&(i.push(["g",Geohash.encode(t,r,4)]),i.push(["g",Geohash.encode(t,r,6)]),i.push(["g",Geohash.encode(t,r,7)]),i.push(["g",Geohash.encode(t,r,9)]));const o=this.uploadedPhoto,s=["imeta",`url ${o.url}`];s.push(`m ${o.type}`),o.dim&&s.push(`dim ${o.dim}`);const a=this.altText.trim();if(a&&s.push(`alt ${a}`),o.fallbackUrls&&o.fallbackUrls.length>0)for(const e of o.fallbackUrls)s.push(`fallback ${e}`);o.thumbUrl&&s.push(`thumb ${o.thumbUrl}`),o.blurhash&&s.push(`blurhash ${o.blurhash}`),i.push(s);const l=await EventFactory.fromKind(360).content("").modifyPublicTags(()=>i).as(this.nostrAuth.signer).sign();await this.nostrRelay.publish(this.nostrData.activeWriteRelays,l),this.nostrData.store.add(l),this.toast.show("Photo published successfully"),this.file=null,this.uploadedPhoto=null,this.altText="",this.args.onUploadStateChange&&this.args.onUploadStateChange(!1),this.args.onClose&&this.args.onClose(l.id)}catch(i){this.error="Failed to publish: "+i.message}finally{this.isPublishing=!1}}else this.error="This place does not have a valid OSM ID."}static{decorateMethodV2(this.prototype,"publish",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"place-photo-upload"],[12],[1,"\\n "],[10,"h2"],[12],[1,"Add Photo for "],[1,[30,0,["title"]]],[13],[1,"\\n\\n"],[41,[30,0,["error"]],[[[1," "],[10,0],[14,0,"alert alert-error"],[12],[1,"\\n "],[1,[30,0,["error"]]],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["file"]],[[[1," "],[8,[32,0],null,[["@file","@onSuccess","@onRemove"],[[30,0,["file"]],[30,0,["handleUploadSuccess"]],[30,0,["removeFile"]]]],null],[1,"\\n\\n"],[41,[30,0,["suggestedTags","length"]],[[[1," "],[10,0],[14,0,"photo-tag-suggestions"],[12],[1,"\\n "],[10,2],[14,0,"photo-tag-suggestions-title"],[12],[1,"\\n Choose a tag/category (optional):\\n "],[13],[1,"\\n "],[10,0],[14,0,"photo-tag-suggestions-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["suggestedTags"]]],null]],null],null,[[[1," "],[11,"button"],[16,0,[29,["photo-tag-chip\\n ",[52,[28,[32,1],[[30,0,["selectedTags"]],[30,1]],null],"is-selected"]]]],[24,4,"button"],[4,[32,2],["click",[28,[32,3],[[30,0,["toggleTag"]],[30,1]],null]],null],[12],[1,"\\n "],[1,[28,[32,4],[[30,1]],null]],[1,"\\n "],[13],[1,"\\n"]],[1]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","photo-alt-input"],[12],[1,"Description (optional):"],[13],[1,"\\n "],[11,"input"],[24,1,"photo-alt-input"],[24,0,"form-control"],[24,"placeholder","Describe this photo"],[16,2,[30,0,["altText"]]],[16,"disabled",[30,0,["isPublishing"]]],[24,4,"text"],[4,[32,2],["input",[30,0,["updateAltText"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n\\n "],[11,"button"],[24,0,"btn btn-primary btn-publish"],[16,"disabled",[28,[32,5],[[28,[32,6],[[30,0,["allUploaded"]]],null],[30,0,["isPublishing"]]],null]],[24,4,"button"],[4,[32,2],["click",[30,0,["publish"]]],null],[12],[1,"\\n"],[41,[30,0,["isPublishing"]],[[[1," Publishing...\\n"]],[]],[[[1," Publish Photo\\n"]],[]]],[1," "],[13],[1,"\\n"]],[]],[[[1," "],[11,0],[16,0,[29,["dropzone ",[52,[30,0,["isDragging"]],"is-dragging"]]]],[4,[32,2],["dragover",[30,0,["handleDragOver"]]],null],[4,[32,2],["dragleave",[30,0,["handleDragLeave"]]],null],[4,[32,2],["drop",[30,0,["handleDrop"]]],null],[12],[1,"\\n "],[10,"label"],[14,"for","photo-upload-input"],[14,0,"dropzone-label"],[12],[1,"\\n "],[8,[32,7],null,[["@name","@size","@color"],["upload-cloud",48,"#ccc"]],null],[1,"\\n "],[10,2],[12],[1,"Drag and drop a photo here, or click to browse"],[13],[1,"\\n "],[13],[1,"\\n "],[11,"input"],[24,1,"photo-upload-input"],[24,"accept","image/*"],[24,0,"file-input-hidden"],[16,"disabled",[30,0,["isPublishing"]]],[24,4,"file"],[4,[32,2],["change",[30,0,["handleFileSelect"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n"]],[]]],[13]],["tag"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({PlacePhotoUploadItem:PlacePhotoUploadItem,includes:includes_default,on:on,fn:fn,capitalize:capitalize_default,or:OrHelper,not:not,Icon:IconComponent}),isStrictMode:!0}),this)}},require_can_promise=__commonJSMin((e,t)=>{t.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}}),require_utils$1=__commonJSMin(e=>{var t,r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},e.getSymbolTotalCodewords=function(e){return r[e]},e.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');t=e},e.isKanjiModeEnabled=function(){return void 0!==t},e.toSJIS=function(e){return t(e)}}),require_error_correction_level=__commonJSMin(e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(n){return r}}}),require_bit_buffer=__commonJSMin((e,t)=>{function r(){this.buffer=[],this.length=0}r.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=r}),require_bit_matrix=__commonJSMin((e,t)=>{function r(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}r.prototype.set=function(e,t,r,n){const i=e*this.size+t;this.data[i]=r,n&&(this.reservedBit[i]=!0)},r.prototype.get=function(e,t){return this.data[e*this.size+t]},r.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},r.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=r}),require_alignment_pattern=__commonJSMin(e=>{var t=require_utils$1().getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];const r=Math.floor(e/7)+2,n=t(e),i=145===n?26:2*Math.ceil((n-13)/(2*r-2)),o=[n-7];for(let t=1;t<r-1;t++)o[t]=o[t-1]-i;return o.push(6),o.reverse()},e.getPositions=function(t){const r=[],n=e.getRowColCoords(t),i=n.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)0===e&&0===t||0===e&&t===i-1||e===i-1&&0===t||r.push([n[e],n[t]]);return r}}),require_finder_pattern=__commonJSMin(e=>{var t=require_utils$1().getSymbolSize;e.getPositions=function(e){const r=t(e);return[[0,0],[r-7,0],[0,r-7]]}}),require_mask_pattern=__commonJSMin(e=>{function t(t,r,n){switch(t){case e.Patterns.PATTERN000:return(r+n)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return n%3==0;case e.Patterns.PATTERN011:return(r+n)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case e.Patterns.PATTERN101:return r*n%2+r*n%3==0;case e.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case e.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){const t=e.size;let r=0,n=0,i=0,o=null,s=null;for(let a=0;a<t;a++){n=i=0,o=s=null;for(let l=0;l<t;l++){let t=e.get(a,l);t===o?n++:(n>=5&&(r+=n-5+3),o=t,n=1),t=e.get(l,a),t===s?i++:(i>=5&&(r+=i-5+3),s=t,i=1)}n>=5&&(r+=n-5+3),i>=5&&(r+=i-5+3)}return r},e.getPenaltyN2=function(e){const t=e.size;let r=0;for(let n=0;n<t-1;n++)for(let i=0;i<t-1;i++){const t=e.get(n,i)+e.get(n,i+1)+e.get(n+1,i)+e.get(n+1,i+1);4!==t&&0!==t||r++}return 3*r},e.getPenaltyN3=function(e){const t=e.size;let r=0,n=0,i=0;for(let o=0;o<t;o++){n=i=0;for(let s=0;s<t;s++)n=n<<1&2047|e.get(o,s),s>=10&&(1488===n||93===n)&&r++,i=i<<1&2047|e.get(s,o),s>=10&&(1488===i||93===i)&&r++}return 40*r},e.getPenaltyN4=function(e){let t=0;const r=e.data.length;for(let n=0;n<r;n++)t+=e.data[n];return 10*Math.abs(Math.ceil(100*t/r/5)-10)},e.applyMask=function(e,r){const n=r.size;for(let i=0;i<n;i++)for(let o=0;o<n;o++)r.isReserved(o,i)||r.xor(o,i,t(e,o,i))},e.getBestMask=function(t,r){const n=Object.keys(e.Patterns).length;let i=0,o=1/0;for(let s=0;s<n;s++){r(s),e.applyMask(s,t);const n=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),n<o&&(o=n,i=s)}return i}}),require_error_correction_code=__commonJSMin(e=>{var t=require_error_correction_level(),r=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,n){switch(n){case t.L:return r[4*(e-1)+0];case t.M:return r[4*(e-1)+1];case t.Q:return r[4*(e-1)+2];case t.H:return r[4*(e-1)+3];default:return}},e.getTotalCodewordsCount=function(e,r){switch(r){case t.L:return n[4*(e-1)+0];case t.M:return n[4*(e-1)+1];case t.Q:return n[4*(e-1)+2];case t.H:return n[4*(e-1)+3];default:return}}}),require_galois_field=__commonJSMin(e=>{var t=new Uint8Array(512),r=new Uint8Array(256);!function(){let e=1;for(let n=0;n<255;n++)t[n]=e,r[e]=n,e<<=1,256&e&&(e^=285);for(let r=255;r<512;r++)t[r]=t[r-255]}(),e.log=function(e){if(e<1)throw new Error("log("+e+")");return r[e]},e.exp=function(e){return t[e]},e.mul=function(e,n){return 0===e||0===n?0:t[r[e]+r[n]]}}),require_polynomial=__commonJSMin(e=>{var t=require_galois_field();e.mul=function(e,r){const n=new Uint8Array(e.length+r.length-1);for(let i=0;i<e.length;i++)for(let o=0;o<r.length;o++)n[i+o]^=t.mul(e[i],r[o]);return n},e.mod=function(e,r){let n=new Uint8Array(e);for(;n.length-r.length>=0;){const e=n[0];for(let o=0;o<r.length;o++)n[o]^=t.mul(r[o],e);let i=0;for(;i<n.length&&0===n[i];)i++;n=n.slice(i)}return n},e.generateECPolynomial=function(r){let n=new Uint8Array([1]);for(let i=0;i<r;i++)n=e.mul(n,new Uint8Array([1,t.exp(i)]));return n}}),require_reed_solomon_encoder=__commonJSMin((e,t)=>{var r=require_polynomial();function n(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}n.prototype.initialize=function(e){this.degree=e,this.genPoly=r.generateECPolynomial(this.degree)},n.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=r.mod(t,this.genPoly),i=this.degree-n.length;if(i>0){const e=new Uint8Array(this.degree);return e.set(n,i),e}return n},t.exports=n}),require_version_check=__commonJSMin(e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}}),require_regex=__commonJSMin(e=>{var t="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",r="(?:(?![A-Z0-9 $%*+\\-./:]|"+(t=t.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";e.KANJI=new RegExp(t,"g"),e.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),e.BYTE=new RegExp(r,"g"),e.NUMERIC=new RegExp("[0-9]+","g"),e.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");var n=new RegExp("^"+t+"$"),i=new RegExp("^[0-9]+$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");e.testKanji=function(e){return n.test(e)},e.testNumeric=function(e){return i.test(e)},e.testAlphanumeric=function(e){return o.test(e)}}),require_mode=__commonJSMin(e=>{var t=require_version_check(),r=require_regex();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return r.testNumeric(t)?e.NUMERIC:r.testAlphanumeric(t)?e.ALPHANUMERIC:r.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(n){return r}}}),require_version=__commonJSMin(e=>{var t=require_utils$1(),r=require_error_correction_code(),n=require_error_correction_level(),i=require_mode(),o=require_version_check(),s=t.getBCHDigit(7973);function a(e,t){return i.getCharCountIndicator(e,t)+4}function l(e,t){let r=0;return e.forEach(function(e){const n=a(e.mode,t);r+=n+e.getBitsLength()}),r}e.from=function(e,t){return o.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,n,s){if(!o.isValid(e))throw new Error("Invalid QR Code version");void 0===s&&(s=i.BYTE);const l=8*(t.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,n));if(s===i.MIXED)return l;const c=l-a(s,e);switch(s){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(t,r){let o;const s=n.from(r,n.M);if(Array.isArray(t)){if(t.length>1)return function(t,r){for(let n=1;n<=40;n++)if(l(t,n)<=e.getCapacity(n,r,i.MIXED))return n}(t,s);if(0===t.length)return 1;o=t[0]}else o=t;return function(t,r,n){for(let i=1;i<=40;i++)if(r<=e.getCapacity(i,n,t))return i}(o.mode,o.getLength(),s)},e.getEncodedBits=function(e){if(!o.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;t.getBCHDigit(r)-s>=0;)r^=7973<<t.getBCHDigit(r)-s;return e<<12|r}}),require_format_info=__commonJSMin(e=>{var t=require_utils$1(),r=t.getBCHDigit(1335);e.getEncodedBits=function(e,n){const i=e.bit<<3|n;let o=i<<10;for(;t.getBCHDigit(o)-r>=0;)o^=1335<<t.getBCHDigit(o)-r;return 21522^(i<<10|o)}}),require_numeric_data=__commonJSMin((e,t)=>{var r=require_mode();function n(e){this.mode=r.NUMERIC,this.data=e.toString()}n.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(e){let t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);const i=this.data.length-t;i>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*i+1))},t.exports=n}),require_alphanumeric_data=__commonJSMin((e,t)=>{var r=require_mode(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(e){this.mode=r.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let r=45*n.indexOf(this.data[t]);r+=n.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(n.indexOf(this.data[t]),6)},t.exports=i}),require_byte_data=__commonJSMin((e,t)=>{var r=require_mode();function n(e){this.mode=r.BYTE,this.data="string"==typeof e?(new TextEncoder).encode(e):new Uint8Array(e)}n.getBitsLength=function(e){return 8*e},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)},t.exports=n}),require_kanji_data=__commonJSMin((e,t)=>{var r=require_mode(),n=require_utils$1();function i(e){this.mode=r.KANJI,this.data=e}i.getBitsLength=function(e){return 13*e},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=n.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}},t.exports=i}),require_dijkstra=__commonJSMin((e,t)=>{var r={single_source_shortest_paths:function(e,t,n){var i={},o={};o[t]=0;var s,a,l,c,u,h,d,p=r.PriorityQueue.make();for(p.push(t,0);!p.empty();)for(l in a=(s=p.pop()).value,c=s.cost,u=e[a]||{})u.hasOwnProperty(l)&&(h=c+u[l],d=o[l],(void 0===o[l]||d>h)&&(o[l]=h,p.push(l,h),i[l]=a));if(void 0!==n&&void 0===o[n]){var f=["Could not find a path from ",t," to ",n,"."].join("");throw new Error(f)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,t,n){var i=r.single_source_shortest_paths(e,t,n);return r.extract_shortest_path_from_predecessor_list(i,n)},PriorityQueue:{make:function(e){var t,n=r.PriorityQueue,i={};for(t in e=e||{},n)n.hasOwnProperty(t)&&(i[t]=n[t]);return i.queue=[],i.sorter=e.sorter||n.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==t&&(t.exports=r)}),require_segments=__commonJSMin(e=>{var t=require_mode(),r=require_numeric_data(),n=require_alphanumeric_data(),i=require_byte_data(),o=require_kanji_data(),s=require_regex(),a=require_utils$1(),l=require_dijkstra();function c(e){return unescape(encodeURIComponent(e)).length}function u(e,t,r){const n=[];let i;for(;null!==(i=e.exec(r));)n.push({data:i[0],index:i.index,mode:t,length:i[0].length});return n}function h(e){const r=u(s.NUMERIC,t.NUMERIC,e),n=u(s.ALPHANUMERIC,t.ALPHANUMERIC,e);let i,o;return a.isKanjiModeEnabled()?(i=u(s.BYTE,t.BYTE,e),o=u(s.KANJI,t.KANJI,e)):(i=u(s.BYTE_KANJI,t.BYTE,e),o=[]),r.concat(n,i,o).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function d(e,s){switch(s){case t.NUMERIC:return r.getBitsLength(e);case t.ALPHANUMERIC:return n.getBitsLength(e);case t.KANJI:return o.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e,s){let l;const c=t.getBestModeForData(e);if(l=t.from(s,c),l!==t.BYTE&&l.bit<c.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(l)+".\n Suggested mode is: "+t.toString(c));switch(l!==t.KANJI||a.isKanjiModeEnabled()||(l=t.BYTE),l){case t.NUMERIC:return new r(e);case t.ALPHANUMERIC:return new n(e);case t.KANJI:return new o(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return"string"==typeof t?e.push(p(t,null)):t.data&&e.push(p(t.data,t.mode)),e},[])},e.fromString=function(r,n){const i=function(e,r){const n={},i={start:{}};let o=["start"];for(let s=0;s<e.length;s++){const a=e[s],l=[];for(let e=0;e<a.length;e++){const c=a[e],u=""+s+e;l.push(u),n[u]={node:c,lastCount:0},i[u]={};for(let e=0;e<o.length;e++){const s=o[e];n[s]&&n[s].node.mode===c.mode?(i[s][u]=d(n[s].lastCount+c.length,c.mode)-d(n[s].lastCount,c.mode),n[s].lastCount+=c.length):(n[s]&&(n[s].lastCount=c.length),i[s][u]=d(c.length,c.mode)+4+t.getCharCountIndicator(c.mode,r))}}o=l}for(let t=0;t<o.length;t++)i[o[t]].end=0;return{map:i,table:n}}(function(e){const r=[];for(let n=0;n<e.length;n++){const i=e[n];switch(i.mode){case t.NUMERIC:r.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:r.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:r.push([i,{data:i.data,mode:t.BYTE,length:c(i.data)}]);break;case t.BYTE:r.push([{data:i.data,mode:t.BYTE,length:c(i.data)}])}}return r}(h(r,a.isKanjiModeEnabled())),n),o=l.find_path(i.map,"start","end"),s=[];for(let e=1;e<o.length-1;e++)s.push(i.table[o[e]].node);return e.fromArray(s.reduce(function(e,t){const r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[]))},e.rawSplit=function(t){return e.fromArray(h(t,a.isKanjiModeEnabled()))}}),require_qrcode=__commonJSMin(e=>{var t=require_utils$1(),r=require_error_correction_level(),n=require_bit_buffer(),i=require_bit_matrix(),o=require_alignment_pattern(),s=require_finder_pattern(),a=require_mask_pattern(),l=require_error_correction_code(),c=require_reed_solomon_encoder(),u=require_version(),h=require_format_info(),d=require_mode(),p=require_segments();function f(e,t,r){const n=e.size,i=h.getEncodedBits(t,r);let o,s;for(o=0;o<15;o++)s=1==(i>>o&1),o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(n-15+o,8,s,!0),o<8?e.set(8,n-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(n-8,8,1,!0)}e.create=function(e,h){if(void 0===e||""===e)throw new Error("No input text");let g,m,y=r.M;return void 0!==h&&(y=r.from(h.errorCorrectionLevel,r.M),g=u.from(h.version),m=a.from(h.maskPattern),h.toSJISFunc&&t.setToSJISFunction(h.toSJISFunc)),function(e,r,h,g){let m;if(Array.isArray(e))m=p.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let t=r;if(!t){const r=p.rawSplit(e);t=u.getBestVersionForData(r,h)}m=p.fromString(e,t||40)}}const y=u.getBestVersionForData(m,h);if(!y)throw new Error("The amount of data is too big to be stored in a QR Code");if(r){if(r<y)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+y+".\n")}else r=y;const v=function(e,r,i){const o=new n;i.forEach(function(t){o.put(t.mode.bit,4),o.put(t.getLength(),d.getCharCountIndicator(t.mode,e)),t.write(o)});const s=8*(t.getSymbolTotalCodewords(e)-l.getTotalCodewordsCount(e,r));for(o.getLengthInBits()+4<=s&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(0);const a=(s-o.getLengthInBits())/8;for(let t=0;t<a;t++)o.put(t%2?17:236,8);return function(e,r,n){const i=t.getSymbolTotalCodewords(r),o=i-l.getTotalCodewordsCount(r,n),s=l.getBlocksCount(r,n),a=s-i%s,u=Math.floor(i/s),h=Math.floor(o/s),d=h+1,p=u-h,f=new c(p);let g=0;const m=new Array(s),y=new Array(s);let v=0;const _=new Uint8Array(e.buffer);for(let t=0;t<s;t++){const e=t<a?h:d;m[t]=_.slice(g,g+e),y[t]=f.encode(m[t]),g+=e,v=Math.max(v,e)}const b=new Uint8Array(i);let E,w,C=0;for(E=0;E<v;E++)for(w=0;w<s;w++)E<m[w].length&&(b[C++]=m[w][E]);for(E=0;E<p;E++)for(w=0;w<s;w++)b[C++]=y[w][E];return b}(o,e,r)}(r,h,m),_=t.getSymbolSize(r),b=new i(_);return function(e,t){const r=e.size,n=s.getPositions(t);for(let i=0;i<n.length;i++){const t=n[i][0],o=n[i][1];for(let n=-1;n<=7;n++)if(!(t+n<=-1||r<=t+n))for(let i=-1;i<=7;i++)o+i<=-1||r<=o+i||(n>=0&&n<=6&&(0===i||6===i)||i>=0&&i<=6&&(0===n||6===n)||n>=2&&n<=4&&i>=2&&i<=4?e.set(t+n,o+i,!0,!0):e.set(t+n,o+i,!1,!0))}}(b,r),function(e){const t=e.size;for(let r=8;r<t-8;r++){const t=r%2==0;e.set(r,6,t,!0),e.set(6,r,t,!0)}}(b),function(e,t){const r=o.getPositions(t);for(let n=0;n<r.length;n++){const t=r[n][0],i=r[n][1];for(let r=-2;r<=2;r++)for(let n=-2;n<=2;n++)-2===r||2===r||-2===n||2===n||0===r&&0===n?e.set(t+r,i+n,!0,!0):e.set(t+r,i+n,!1,!0)}}(b,r),f(b,h,0),r>=7&&function(e,t){const r=e.size,n=u.getEncodedBits(t);let i,o,s;for(let a=0;a<18;a++)i=Math.floor(a/3),o=a%3+r-8-3,s=1==(n>>a&1),e.set(i,o,s,!0),e.set(o,i,s,!0)}(b,r),function(e,t){const r=e.size;let n=-1,i=r-1,o=7,s=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!e.isReserved(i,a-r)){let n=!1;s<t.length&&(n=1==(t[s]>>>o&1)),e.set(i,a-r,n),o--,-1===o&&(s++,o=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}(b,v),isNaN(g)&&(g=a.getBestMask(b,f.bind(null,b,h))),a.applyMask(g,b),f(b,h,g),{modules:b,version:r,errorCorrectionLevel:h,maskPattern:g,segments:m}}(e,g,y,m)}}),require_utils=__commonJSMin(e=>{function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),6===t.length&&t.push("F","F");const r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});const r=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,r){const n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){const i=r.modules.size,o=r.modules.data,s=e.getScale(i,n),a=Math.floor((i+2*n.margin)*s),l=n.margin*s,c=[n.color.light,n.color.dark];for(let e=0;e<a;e++)for(let r=0;r<a;r++){let u=4*(e*a+r),h=n.color.light;e>=l&&r>=l&&e<a-l&&r<a-l&&(h=c[o[Math.floor((e-l)/s)*i+Math.floor((r-l)/s)]?1:0]),t[u++]=h.r,t[u++]=h.g,t[u++]=h.b,t[u]=h.a}}}),require_canvas=__commonJSMin(e=>{var t=require_utils();e.render=function(e,r,n){let i=n,o=r;void 0!==i||r&&r.getContext||(i=r,r=void 0),r||(o=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),i=t.getOptions(i);const s=t.getImageWidth(e.modules.size,i),a=o.getContext("2d"),l=a.createImageData(s,s);return t.qrToImageData(l.data,e,i),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(a,o,s),a.putImageData(l,0,0),o},e.renderToDataURL=function(t,r,n){let i=n;void 0!==i||r&&r.getContext||(i=r,r=void 0),i||(i={});const o=e.render(t,r,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}}),require_svg_tag=__commonJSMin(e=>{var t=require_utils();function r(e,t){const r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function n(e,t,r){let n=e+t;return void 0!==r&&(n+=" "+r),n}e.render=function(e,i,o){const s=t.getOptions(i),a=e.modules.size,l=e.modules.data,c=a+2*s.margin,u=s.color.light.a?"<path "+r(s.color.light,"fill")+' d="M0 0h'+c+"v"+c+'H0z"/>':"",h="<path "+r(s.color.dark,"stroke")+' d="'+function(e,t,r){let i="",o=0,s=!1,a=0;for(let l=0;l<e.length;l++){const c=Math.floor(l%t),u=Math.floor(l/t);c||s||(s=!0),e[l]?(a++,l>0&&c>0&&e[l-1]||(i+=s?n("M",c+r,.5+u+r):n("m",o,0),o=0,s=!1),c+1<t&&e[l+1]||(i+=n("h",a),a=0)):o++}return i}(l,a,s.margin)+'"/>',d='viewBox="0 0 '+c+" "+c+'"',p='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+d+' shape-rendering="crispEdges">'+u+h+"</svg>\n";return"function"==typeof o&&o(null,p),p}}),require_browser=__commonJSMin(e=>{var t=require_can_promise(),r=require_qrcode(),n=require_canvas(),i=require_svg_tag();function o(e,n,i,o,s){const a=[].slice.call(arguments,1),l=a.length,c="function"==typeof a[l-1];if(!c&&!t())throw new Error("Callback required as last argument");if(!c){if(l<1)throw new Error("Too few arguments provided");return 1===l?(i=n,n=o=void 0):2!==l||n.getContext||(o=i,i=n,n=void 0),new Promise(function(t,s){try{t(e(r.create(i,o),n,o))}catch(a){s(a)}})}if(l<2)throw new Error("Too few arguments provided");2===l?(s=i,i=n,n=o=void 0):3===l&&(n.getContext&&void 0===s?(s=o,o=void 0):(s=o,o=i,i=n,n=void 0));try{const t=r.create(i,o);s(null,e(t,n,o))}catch(u){s(u)}}e.create=r.create,e.toCanvas=o.bind(null,n.render),e.toDataURL=o.bind(null,n.renderToDataURL),e.toString=o.bind(null,function(e,t,r){return i.render(e,r)})}),import_browser=__toESM(require_browser(),1),qr_code_default=modifier((e,[t])=>{t&&import_browser.toCanvas(e,t,{width:256,margin:2,color:{dark:"#000000",light:"#ffffff"}}).catch(e=>{console.error("Failed to generate QR code",e)})}),NostrConnectComponent=class extends Component{static{decorateFieldV2(this.prototype,"nostrAuth",[service])}#x=void initializeDeferredDecorator(this,"nostrAuth");static{decorateFieldV2(this.prototype,"toast",[service])}#fe=void initializeDeferredDecorator(this,"toast");get hasExtension(){return"undefined"!=typeof window&&void 0!==window.nostr}async connectExtension(){try{await this.nostrAuth.connectWithExtension(),this.toast.show("Nostr connected successfully"),this.args.onConnect&&this.args.onConnect()}catch(e){console.error(e),alert(e.message)}}static{decorateMethodV2(this.prototype,"connectExtension",[action])}async connectApp(){try{await this.nostrAuth.connectWithApp(),this.toast.show("Nostr connected successfully"),this.args.onConnect&&this.args.onConnect()}catch(e){console.error(e),alert(e.message)}}static{decorateMethodV2(this.prototype,"connectApp",[action])}async copyConnectUri(){const e=this.nostrAuth.connectUri;try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e);else{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();const r=document.execCommand("copy");if(document.body.removeChild(t),!r)throw new Error("Fallback copy failed")}this.toast.show("Connection link copied to clipboard")}catch(err){console.error("Failed to copy text: ",err),alert("Failed to copy link")}}static{decorateMethodV2(this.prototype,"copyConnectUri",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"nostr-connect-modal"],[12],[1,"\\n "],[10,"h2"],[12],[1,"Connect with Nostr"],[13],[1,"\\n\\n "],[10,0],[14,0,"nostr-connect-options"],[12],[1,"\\n"],[41,[30,0,["hasExtension"]],[[[1," "],[11,"button"],[24,0,"btn btn-primary"],[24,4,"button"],[4,[32,0],["click",[30,0,["connectExtension"]]],null],[12],[1,"\\n Browser Extension (nos2x, Alby)\\n "],[13],[1,"\\n"]],[]],[[[1," "],[10,"button"],[14,0,"btn btn-outline"],[14,"disabled",""],[14,"title","No Nostr extension found in your browser"],[14,4,"button"],[12],[1,"\\n Browser Extension (Not Found)\\n "],[13],[1,"\\n"]],[]]],[1,"\\n "],[11,"button"],[24,0,"btn btn-primary"],[24,4,"button"],[4,[32,0],["click",[30,0,["connectApp"]]],null],[12],[1,"\\n Mobile Signer App (Amber, etc.)\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[28,[32,1],[[30,0,["nostrAuth","connectStatus"]],"waiting"],null],[[[1," "],[10,0],[14,0,"nostr-connect-status"],[12],[1,"\\n"],[41,[30,0,["nostrAuth","isMobile"]],[[[1," "],[10,2],[12],[1,"Waiting for you to approve the connection in your mobile signer\\n app..."],[13],[1,"\\n "],[10,0],[14,0,"mobile-connect-actions"],[12],[1,"\\n "],[10,3],[15,6,[30,0,["nostrAuth","connectUri"]]],[14,0,"btn btn-primary"],[12],[1,"\\n Open Signer App\\n "],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline"],[24,4,"button"],[4,[32,0],["click",[30,0,["copyConnectUri"]]],null],[12],[1,"\\n Copy Connection Link\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],[[[1," "],[10,2],[12],[1,"Scan this QR code with a Nostr signer app (like Amber):"],[13],[1,"\\n "],[10,0],[14,0,"qr-code-container"],[12],[1,"\\n "],[11,"canvas"],[4,[32,2],[[30,0,["nostrAuth","connectUri"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n"]],[]],null],[13]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({on:on,eq:eq$1,qrCode:qr_code_default}),isStrictMode:!0}),this)}},ModalContent=setComponentTemplate(templateFactory({id:null,block:'[[[11,0],[24,0,"modal-overlay"],[24,"role","dialog"],[24,"tabindex","-1"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[11,0],[24,0,"modal-content"],[24,"role","document"],[24,"tabindex","0"],[4,[32,0],["click",[30,2]],null],[12],[1,"\\n "],[11,"button"],[16,0,[29,["close-modal-btn btn-text ",[52,[30,3],"disabled"]]]],[16,"disabled",[30,3]],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",24,"currentColor"]],null],[1,"\\n "],[13],[1,"\\n "],[18,4,null],[1,"\\n "],[13],[1,"\\n"],[13]],["@close","@stopProp","@disableClose","&default"],["if","yield"]]',moduleName:"(unknown template module)",scope:()=>({on:on,Icon:IconComponent}),isStrictMode:!0}),templateOnly()),Modal=class extends Component{get isTesting(){return"test"===ENV.environment}get destinationElement(){return document.getElementById("modal-portal")||document.body}stopProp(e){e.stopPropagation()}static{decorateMethodV2(this.prototype,"stopProp",[action])}close(){this.args.disableClose||this.args.onClose&&this.args.onClose()}static{decorateMethodV2(this.prototype,"close",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[41,[30,0,["isTesting"]],[[[1," "],[8,[32,0],null,[["@close","@stopProp","@disableClose"],[[30,0,["close"]],[30,0,["stopProp"]],[30,1]]],[["default"],[[[[1,"\\n "],[18,2,null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],[[[40,[[[1," "],[8,[32,0],null,[["@close","@stopProp","@disableClose"],[[30,0,["close"]],[30,0,["stopProp"]],[30,1]]],[["default"],[[[[1,"\\n "],[18,2,null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],"%cursor:0%",[28,[31,3],[[30,0,["destinationElement"]]],null]]],[]]]],["@disableClose","&default"],["if","yield","in-element","-in-el-null"]]',moduleName:"(unknown template module)",scope:()=>({ModalContent:ModalContent}),isStrictMode:!0}),this)}},fade_in_image_default=modifier((e,[t])=>{if(!t)return;let r;e.classList.remove("loaded"),e.classList.remove("loaded-instant");const n=()=>{const t=e.parentElement,r=t&&"PICTURE"===t.tagName?t.parentElement:t;if(r&&r.closest(".photo-carousel.gallery-main")){const e=r.querySelector(".place-header-photo-blur");e&&(e.style.opacity="0")}},i=()=>{e.classList.contains("loaded-instant")||e.classList.add("loaded"),n()};return e.addEventListener("load",i),r=new IntersectionObserver((r,i)=>{r.forEach(r=>{if(r.isIntersecting){i.unobserve(e);const r=new Image;r.src=t,r.complete&&(e.classList.add("loaded-instant"),n());const o=e.parentElement;o&&"PICTURE"===o.tagName&&o.querySelectorAll("source").forEach(e=>{e.dataset.srcset&&(e.srcset=e.dataset.srcset)}),e.dataset.src?e.src=e.dataset.src:e.src=t}})},{root:null,rootMargin:"100px 100%",threshold:0}),r.observe(e),()=>{e.removeEventListener("load",i),r&&r.disconnect()}}),PhotoCarousel=class extends Component{static{decorateFieldV2(this.prototype,"canScrollLeft",[tracked],function(){return!1})}#qe=void initializeDeferredDecorator(this,"canScrollLeft");static{decorateFieldV2(this.prototype,"canScrollRight",[tracked],function(){return!1})}#We=void initializeDeferredDecorator(this,"canScrollRight");internalEventId=null;carouselElement=null;get photos(){return this.args.photos||[]}get showChevrons(){return this.photos.length>1}get cannotScrollLeft(){return!this.canScrollLeft}get cannotScrollRight(){return!this.canScrollRight}get isGalleryMain(){return"gallery-main"===this.args.variant}get isGalleryThumbnails(){return"gallery-thumbnails"===this.args.variant}get variantClass(){return this.args.variant||"inline"}lastResetKey=null;resetScrollPosition=modifier((e,[t])=>{void 0!==t&&t!==this.lastResetKey&&(this.lastResetKey=t,e.scrollLeft=0,setTimeout(()=>this.updateScrollState(),50))});isProgrammaticScroll=!1;scrollToNewPhoto=modifier((e,[t])=>{if(t&&t!==this.lastEventId){const r=!this.lastEventId;if(this.lastEventId=t,this.internalEventId===t)return;this.internalEventId=t,this.isProgrammaticScroll=!0;const n=()=>{const n=e.querySelector(`[data-event-id="${t}"]`);if(n)if(r){const t=e.style.scrollBehavior;e.style.scrollBehavior="auto",e.scrollLeft=n.offsetLeft,setTimeout(()=>{e.style.scrollBehavior=t,this.isProgrammaticScroll=!1},50)}else e.scrollLeft=n.offsetLeft,setTimeout(()=>{this.isProgrammaticScroll=!1},500);else this.isProgrammaticScroll=!1};r?n():setTimeout(n,100)}});setupCarousel=modifier(e=>{let t,r;return this.carouselElement=e,setTimeout(()=>{this.updateScrollState()},50),window.ResizeObserver&&(t=new ResizeObserver(()=>this.updateScrollState()),t.observe(e)),this.args.onVisiblePhotoChange&&window.IntersectionObserver&&"test"!==ENV.environment&&(r=new IntersectionObserver(e=>{if(!this.isProgrammaticScroll)for(let t of e)if(t.isIntersecting&&t.intersectionRatio>=.5){const e=t.target.dataset.eventId;this.internalEventId=e;const r=this.photos.find(t=>t.eventId===e);r&&this.args.onVisiblePhotoChange(r)}},{root:e,threshold:.5}),e.querySelectorAll(".carousel-slide").forEach(e=>r.observe(e))),()=>{t&&t.unobserve(e),r&&r.disconnect()}});updateScrollState(){if(!this.carouselElement)return;const{scrollLeft:e,scrollWidth:t,clientWidth:r}=this.carouselElement;this.canScrollLeft=e>1,this.canScrollRight=e+r<t-1}static{decorateMethodV2(this.prototype,"updateScrollState",[action])}scrollLeft(){this.carouselElement&&this.carouselElement.scrollBy({left:-this.carouselElement.clientWidth,behavior:"smooth"})}static{decorateMethodV2(this.prototype,"scrollLeft",[action])}scrollRight(){this.carouselElement&&this.carouselElement.scrollBy({left:this.carouselElement.clientWidth,behavior:"smooth"})}static{decorateMethodV2(this.prototype,"scrollRight",[action])}handlePhotoClick(e){this.args.onPhotoClick&&this.args.onPhotoClick(e)}static{decorateMethodV2(this.prototype,"handlePhotoClick",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[41,[30,0,["photos","length"]],[[[1," "],[10,0],[15,0,[29,["photo-carousel ",[30,0,["variantClass"]]]]],[12],[1,"\\n "],[11,0],[24,0,"photo-carousel-track"],[4,[30,0,["setupCarousel"]],null,null],[4,[30,0,["resetScrollPosition"]],[[30,1]],null],[4,[30,0,["scrollToNewPhoto"]],[[30,2]],null],[4,[32,0],["scroll",[30,0,["updateScrollState"]]],null],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["photos"]]],null]],null],null,[[[1," "],[11,0],[16,0,[29,["carousel-slide\\n ",[52,[30,3,["isLandscape"]],"landscape","portrait"],"\\n ",[52,[28,[32,1],[[30,2],[28,[32,2],[[30,3,["eventId"]],[30,2]],null]],null],"active"]]]],[16,5,[30,3,["style"]]],[16,"data-event-id",[30,3,["eventId"]]],[4,[32,0],["click",[28,[32,3],[[30,0,["handlePhotoClick"]],[30,3]],null]],null],[12],[1,"\\n"],[41,[30,3,["blurhash"]],[[[1," "],[8,[32,4],[[24,0,"place-header-photo-blur"]],[["@hash","@width","@height"],[[30,3,["blurhash"]],32,18]],null],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["isGalleryMain"]],[[[1," "],[11,"img"],[16,"data-src",[30,3,["url"]]],[16,0,[29,["place-header-photo\\n ",[52,[30,3,["isLandscape"]],"landscape","portrait"]]]],[16,"alt",[30,3,["alt"]]],[4,[32,5],[[30,3,["url"]]],null],[12],[13],[1,"\\n"]],[]],[[[41,[30,0,["isGalleryThumbnails"]],[[[1," "],[11,"img"],[16,"data-src",[52,[30,3,["thumbUrl"]],[30,3,["thumbUrl"]],[30,3,["url"]]]],[16,0,[29,["place-header-photo\\n ",[52,[30,3,["isLandscape"]],"landscape","portrait"]]]],[16,"alt",[30,3,["alt"]]],[4,[32,5],[[52,[30,3,["thumbUrl"]],[30,3,["thumbUrl"]],[30,3,["url"]]]],null],[12],[13],[1,"\\n"]],[]],[[[41,[30,3,["isLandscape"]],[[[1," "],[10,"picture"],[12],[1,"\\n"],[41,[30,3,["thumbUrl"]],[[[1," "],[10,"source"],[14,"media","(max-width: 768px)"],[15,"data-srcset",[30,3,["thumbUrl"]]],[12],[13],[1,"\\n"]],[]],null],[1," "],[11,"img"],[16,"data-src",[30,3,["url"]]],[24,0,"place-header-photo landscape"],[16,"alt",[30,3,["alt"]]],[4,[32,5],[[30,3,["url"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n"]],[]],[[[1," "],[11,"img"],[16,"data-src",[52,[30,3,["thumbUrl"]],[30,3,["thumbUrl"]],[30,3,["url"]]]],[24,0,"place-header-photo portrait"],[16,"alt",[30,3,["alt"]]],[4,[32,5],[[52,[30,3,["thumbUrl"]],[30,3,["thumbUrl"]],[30,3,["url"]]]],null],[12],[13],[1,"\\n"]],[]]],[1," "]],[]]]],[]]],[1," "],[13],[1,"\\n"]],[3]],null],[1,"\\n "],[10,0],[14,0,"carousel-placeholder"],[12],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["showChevrons"]],[[[1," "],[11,"button"],[16,0,[29,["carousel-nav-btn prev\\n ",[52,[30,0,["cannotScrollLeft"]],"disabled"]]]],[16,"disabled",[30,0,["cannotScrollLeft"]]],[24,"aria-label","Previous photo"],[24,4,"button"],[4,[32,0],["click",[30,0,["scrollLeft"]]],null],[12],[1,"\\n "],[8,[32,6],null,[["@name","@color","@size"],["chevron-left","currentColor",[52,[28,[32,2],[[30,4],"gallery-main"],null],24,16]]],null],[1,"\\n "],[13],[1,"\\n\\n "],[11,"button"],[16,0,[29,["carousel-nav-btn next\\n ",[52,[30,0,["cannotScrollRight"]],"disabled"]]]],[16,"disabled",[30,0,["cannotScrollRight"]]],[24,"aria-label","Next photo"],[24,4,"button"],[4,[32,0],["click",[30,0,["scrollRight"]]],null],[12],[1,"\\n "],[8,[32,6],null,[["@name","@color","@size"],["chevron-right","currentColor",[52,[28,[32,2],[[30,4],"gallery-main"],null],24,16]]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"]],[]],null]],["@resetKey","@scrollToEventId","photo","@variant"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({on:on,and:AndHelper,eq:eq$1,fn:fn,Blurhash:Blurhash,fadeInImage:fade_in_image_default,Icon:IconComponent}),isStrictMode:!0}),this)}},DropdownMenu=class extends Component{static{decorateFieldV2(this.prototype,"isOpen",[tracked],function(){return!1})}#Ke=void initializeDeferredDecorator(this,"isOpen");toggleMenu(e){e?.stopPropagation(),this.isOpen=!this.isOpen}static{decorateMethodV2(this.prototype,"toggleMenu",[action])}closeMenu(e){e?.stopPropagation(),this.isOpen=!1}static{decorateMethodV2(this.prototype,"closeMenu",[action])}get triggerIcon(){return this.args.triggerIcon||"more-vertical"}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"dropdown-menu-container"],[12],[1,"\\n "],[11,"button"],[24,0,"dropdown-trigger-btn btn-press"],[16,"title",[30,1]],[24,4,"button"],[4,[32,0],["click",[30,0,["toggleMenu"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],[[30,0,["triggerIcon"]],[30,2],[30,3]]],null],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["isOpen"]],[[[1," "],[10,0],[15,0,[29,["dropdown-popover ",[30,4]]]],[12],[1,"\\n "],[18,5,[[30,0,["closeMenu"]]]],[1,"\\n "],[13],[1,"\\n "],[11,0],[24,0,"menu-backdrop"],[24,"role","button"],[4,[32,0],["click",[30,0,["closeMenu"]]],null],[12],[13],[1,"\\n"]],[]],null],[13]],["@triggerTitle","@iconSize","@iconColor","@popoverClass","&default"],["if","yield"]]',moduleName:"(unknown template module)",scope:()=>({on:on,Icon:IconComponent}),isStrictMode:!0}),this)}},GalleryContent=setComponentTemplate(templateFactory({id:null,block:'[[[11,0],[24,0,"photo-gallery-overlay"],[24,"role","dialog"],[24,"tabindex","-1"],[4,[32,0],["click",[30,1]],null],[4,[30,2],[[30,3]],null],[12],[1,"\\n"],[1," "],[10,0],[14,0,"photo-gallery-content"],[15,"data-current-event-id",[30,4,["eventId"]]],[12],[1,"\\n "],[10,0],[14,0,"actions-btn-container"],[12],[1,"\\n "],[8,[32,1],null,[["@iconSize","@triggerIcon","@iconColor"],[24,"more-horizontal","white"]],[["default"],[[[[1,"\\n "],[11,"button"],[24,0,"dropdown-item"],[24,4,"button"],[4,[32,0],["click",[28,[32,2],[[30,6],[30,5]],null]],null],[12],[1,"Copy Photo Event ID"],[13],[1,"\\n"],[41,[30,7],[[[1," "],[11,"button"],[24,0,"dropdown-item text-danger"],[24,4,"button"],[4,[32,0],["click",[28,[32,2],[[30,8,["perform"]],[30,5]],null]],null],[12],[1,"Delete Photo"],[13],[1,"\\n"]],[]],null],[1," "]],[5]]]]],[1,"\\n "],[13],[1,"\\n\\n "],[11,"button"],[24,0,"close-btn btn-text"],[24,"aria-label","Close gallery"],[24,"title","Close"],[24,4,"button"],[4,[32,0],["click",[30,9]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size","@color"],["x",24,"white"]],null],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"main-photo-container"],[12],[1,"\\n "],[8,[32,4],null,[["@variant","@photos","@scrollToEventId","@onVisiblePhotoChange","@name"],["gallery-main",[30,10],[30,4,["eventId"]],[30,11],[30,12]]],null],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"thumbnail-strip-container"],[12],[1,"\\n "],[8,[32,4],null,[["@variant","@photos","@scrollToEventId","@onPhotoClick","@name"],["gallery-thumbnails",[30,10],[30,4,["eventId"]],[30,13],[30,12]]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@handleBackgroundClick","@bindKeyboard","@handleKeydown","@currentPhoto","closeMenu","@copyEventId","@canDeletePhoto","@deletePhotoTask","@handleClose","@photos","@handleVisiblePhotoChange","@placeName","@selectPhoto"],["if"]]',moduleName:"(unknown template module)",scope:()=>({on:on,DropdownMenu:DropdownMenu,fn:fn,Icon:IconComponent,PhotoCarousel:PhotoCarousel}),isStrictMode:!0}),templateOnly()),PhotoGallery=class extends Component{get isTesting(){return"test"===ENV.environment}get destinationElement(){return document.getElementById("modal-portal")||document.body}static{decorateFieldV2(this.prototype,"toast",[service])}#fe=void initializeDeferredDecorator(this,"toast");static{decorateFieldV2(this.prototype,"nostrAuth",[service])}#x=void initializeDeferredDecorator(this,"nostrAuth");static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");static{decorateFieldV2(this.prototype,"nostrRelay",[service])}#q=void initializeDeferredDecorator(this,"nostrRelay");static{decorateFieldV2(this.prototype,"blossom",[service])}#Me=void initializeDeferredDecorator(this,"blossom");static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");static{decorateFieldV2(this.prototype,"currentPhoto",[tracked],function(){return this.args.selectedPhoto||this.args.photos?.[0]})}#Ye=void initializeDeferredDecorator(this,"currentPhoto");get isCreator(){return this.currentPhoto?.pubkey&&this.nostrAuth.pubkey&&this.currentPhoto.pubkey===this.nostrAuth.pubkey}get canDeletePhoto(){return this.isCreator&&!0===this.settings.experimentalEnablePhotoDeletion}bindKeyboard=modifier((e,[t])=>(document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)));handleClose(){this.args.onClose&&this.args.onClose()}static{decorateMethodV2(this.prototype,"handleClose",[action])}handleBackgroundClick(e){e.target.closest(".thumbnail-strip-container")||e.target.closest(".carousel-nav-btn")||e.target.closest(".close-btn")||e.target.closest(".actions-btn-container")||this.handleClose()}static{decorateMethodV2(this.prototype,"handleBackgroundClick",[action])}selectPhoto(e){this.currentPhoto=e}static{decorateMethodV2(this.prototype,"selectPhoto",[action])}handleVisiblePhotoChange(e){this.currentPhoto!==e&&(this.currentPhoto=e)}static{decorateMethodV2(this.prototype,"handleVisiblePhotoChange",[action])}handleKeydown(e){if(!this.args.photos||0===this.args.photos.length)return;if("Escape"===e.key)return void this.handleClose();const t=this.args.photos.indexOf(this.currentPhoto);-1!==t&&("ArrowLeft"===e.key&&t>0?this.currentPhoto=this.args.photos[t-1]:"ArrowRight"===e.key&&t<this.args.photos.length-1&&(this.currentPhoto=this.args.photos[t+1]))}static{decorateMethodV2(this.prototype,"handleKeydown",[action])}async copyEventId(e){if(this.currentPhoto?.eventId)try{await navigator.clipboard.writeText(this.currentPhoto.eventId),this.toast.show("Event ID copied to clipboard")}catch(err){console.error("Failed to copy event ID:",err),this.toast.show("Failed to copy event ID")}e()}static{decorateMethodV2(this.prototype,"copyEventId",[action])}deletePhotoTask=buildTask(()=>({context:this,generator:function*(e){if(confirm("Are you sure you want to delete this photo? This cannot be undone."))try{const r=[["e",this.currentPhoto.eventId]];this.currentPhoto.placeIdentifier&&r.push(["i",this.currentPhoto.placeIdentifier]);const n=yield EventFactory.fromKind(5).content("Deleted photo").modifyPublicTags(()=>r).as(this.nostrAuth.signer).sign();yield this.nostrRelay.publish(this.nostrData.activeWriteRelays,n),this.nostrData.store.add(n);const i=/[0-9a-f]{64}/i;if(this.currentPhoto.url){const e=this.currentPhoto.url.match(i);if(e)try{yield this.blossom.delete(e[0])}catch(t){console.warn("Failed to delete main image from blossom:",t)}}if(this.currentPhoto.thumbUrl){const e=this.currentPhoto.thumbUrl.match(i);if(e)try{yield this.blossom.delete(e[0])}catch(t){console.warn("Failed to delete thumb image from blossom:",t)}}this.toast.show("Photo deleted successfully"),e&&e(),this.handleClose()}catch(t){console.error("Failed to delete photo:",t),this.toast.show("Failed to delete photo: "+t.message),e&&e()}else e&&e()}}),null,"deletePhotoTask",null);static{setComponentTemplate(templateFactory({id:null,block:'[[[41,[30,0,["isTesting"]],[[[1," "],[8,[32,0],null,[["@handleBackgroundClick","@bindKeyboard","@handleKeydown","@copyEventId","@canDeletePhoto","@deletePhotoTask","@handleClose","@photos","@currentPhoto","@handleVisiblePhotoChange","@placeName","@selectPhoto"],[[30,0,["handleBackgroundClick"]],[30,0,["bindKeyboard"]],[30,0,["handleKeydown"]],[30,0,["copyEventId"]],[30,0,["canDeletePhoto"]],[30,0,["deletePhotoTask"]],[30,0,["handleClose"]],[30,1],[30,0,["currentPhoto"]],[30,0,["handleVisiblePhotoChange"]],[30,2],[30,0,["selectPhoto"]]]],null],[1,"\\n"]],[]],[[[40,[[[1," "],[8,[32,0],null,[["@handleBackgroundClick","@bindKeyboard","@handleKeydown","@copyEventId","@canDeletePhoto","@deletePhotoTask","@handleClose","@photos","@currentPhoto","@handleVisiblePhotoChange","@placeName","@selectPhoto"],[[30,0,["handleBackgroundClick"]],[30,0,["bindKeyboard"]],[30,0,["handleKeydown"]],[30,0,["copyEventId"]],[30,0,["canDeletePhoto"]],[30,0,["deletePhotoTask"]],[30,0,["handleClose"]],[30,1],[30,0,["currentPhoto"]],[30,0,["handleVisiblePhotoChange"]],[30,2],[30,0,["selectPhoto"]]]],null],[1,"\\n"]],[]],"%cursor:0%",[28,[31,2],[[30,0,["destinationElement"]]],null]]],[]]]],["@photos","@placeName"],["if","in-element","-in-el-null"]]',moduleName:"(unknown template module)",scope:()=>({GalleryContent:GalleryContent}),isStrictMode:!0}),this)}},PlaceDetails=class extends Component{static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"nostrAuth",[service])}#x=void initializeDeferredDecorator(this,"nostrAuth");static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");static{decorateFieldV2(this.prototype,"isEditing",[tracked],function(){return!1})}#Ze=void initializeDeferredDecorator(this,"isEditing");static{decorateFieldV2(this.prototype,"showLists",[tracked],function(){return!1})}#Xe=void initializeDeferredDecorator(this,"showLists");static{decorateFieldV2(this.prototype,"isPhotoUploadActive",[tracked],function(){return!1})}#Je=void initializeDeferredDecorator(this,"isPhotoUploadActive");static{decorateFieldV2(this.prototype,"isConnectingNostr",[tracked],function(){return!1})}#Qe=void initializeDeferredDecorator(this,"isConnectingNostr");static{decorateFieldV2(this.prototype,"isGalleryOpen",[tracked],function(){return!1})}#et=void initializeDeferredDecorator(this,"isGalleryOpen");static{decorateFieldV2(this.prototype,"selectedGalleryPhoto",[tracked],function(){return null})}#tt=void initializeDeferredDecorator(this,"selectedGalleryPhoto");static{decorateFieldV2(this.prototype,"isPhotoUploadModalOpen",[tracked],function(){return!1})}#rt=void initializeDeferredDecorator(this,"isPhotoUploadModalOpen");static{decorateFieldV2(this.prototype,"isNostrConnectModalOpen",[tracked],function(){return!1})}#nt=void initializeDeferredDecorator(this,"isNostrConnectModalOpen");static{decorateFieldV2(this.prototype,"newlyUploadedPhotoId",[tracked],function(){return null})}#it=void initializeDeferredDecorator(this,"newlyUploadedPhotoId");handleUploadStateChange(e){this.isPhotoUploadActive=e}static{decorateMethodV2(this.prototype,"handleUploadStateChange",[action])}openPhotoUploadModal(e){e&&e.preventDefault(),this.nostrAuth.isConnected?this.isPhotoUploadModalOpen=!0:this.isNostrConnectModalOpen=!0}static{decorateMethodV2(this.prototype,"openPhotoUploadModal",[action])}closePhotoUploadModal(e){this.isPhotoUploadActive||(this.isPhotoUploadModalOpen=!1,"string"==typeof e&&(this.newlyUploadedPhotoId=e,setTimeout(()=>{const e=document.querySelector(".sidebar-content");e&&(e.scrollTop=0)},50)))}static{decorateMethodV2(this.prototype,"closePhotoUploadModal",[action])}closeNostrConnectModal(){this.isNostrConnectModalOpen=!1}static{decorateMethodV2(this.prototype,"closeNostrConnectModal",[action])}onNostrConnected(){this.isNostrConnectModalOpen=!1,this.isPhotoUploadModalOpen=!0}static{decorateMethodV2(this.prototype,"onNostrConnected",[action])}get isSaved(){return this.storage.isPlaceSaved(this.place.id||this.place.osmId)}get place(){return this.args.place||{}}get saveablePlace(){return this.place.createdAt?this.place:mapToStorageSchema(this.place)}get tags(){return this.place.osmTags||{}}get name(){return this.place.title||getLocalizedName(this.tags)||"Unnamed Place"}get photos(){return parsePlacePhotos(this.nostrData.placePhotos).map(e=>({...e,style:htmlSafe(`--slide-ratio: ${e.aspectRatio};`)}))}startEditing(){this.isSaved&&(this.isEditing=!0)}static{decorateMethodV2(this.prototype,"startEditing",[action])}cancelEditing(){this.isEditing=!1}static{decorateMethodV2(this.prototype,"cancelEditing",[action])}toggleLists(e){e&&e.stopPropagation(),this.showLists=!this.showLists}static{decorateMethodV2(this.prototype,"toggleLists",[action])}closeLists(){this.showLists=!1}static{decorateMethodV2(this.prototype,"closeLists",[action])}async saveChanges(e){this.args.onSave&&await this.args.onSave({...this.place,...e}),this.isEditing=!1}static{decorateMethodV2(this.prototype,"saveChanges",[action])}get type(){return getPlaceType(this.tags)}get address(){const e=this.tags,t=[],r=(...t)=>{for(const r of t)if(e[r])return e[r];return null};let n=r("addr:street","street");const i=r("addr:housenumber","housenumber");n&&(i&&(n=`${n} ${i}`),t.push(n));let o=r("addr:city","city");const s=r("addr:postcode","postcode");o&&(s&&(o=`${s} ${o}`),t.push(o));const a=r("addr:state","state"),l=r("addr:country","country");return a&&a!==o&&t.push(a),l&&t.push(l),0===t.length?null:t.join(", ")}formatMultiLine(e,t){if(!e)return null;const r=[...new Set(e.split(";").map(e=>e.trim()).filter(Boolean))];return 0===r.length?null:htmlSafe("phone"===t?r.map(e=>`<a href="tel:${e.replace(/[\s-]+/g,"")}">${e}</a>`).join("<br>"):"email"===t?r.map(e=>`<a href="mailto:${e}">${e}</a>`).join("<br>"):"whatsapp"===t?r.map(e=>`<a href="https://wa.me/${e.replace(/[\s-]+/g,"")}" target="_blank" rel="noopener noreferrer">${e}</a>`).join("<br>"):"url"===t?r.map(e=>`<a href="${e}" target="_blank" rel="noopener noreferrer">${this.getDomain(e)}</a>`).join("<br>"):r.join("<br>"))}get phone(){const e=[this.tags.phone,this.tags["contact:phone"],this.tags.mobile,this.tags["contact:mobile"]].filter(Boolean);return 0===e.length?null:this.formatMultiLine(e.join(";"),"phone")}get whatsapp(){const e=[this.tags.whatsapp,this.tags["contact:whatsapp"]].filter(Boolean);return 0===e.length?null:this.formatMultiLine(e.join(";"),"whatsapp")}get email(){const e=this.tags.email||this.tags["contact:email"];return this.formatMultiLine(e,"email")}get website(){const e=this.place.url||this.tags.website||this.tags["contact:website"];return this.formatMultiLine(e,"url")}getDomain(e){try{return new URL(e).hostname}catch{return e}}get openingHours(){const e=this.tags.opening_hours;return this.formatMultiLine(e)}get cuisine(){return this.tags.cuisine?this.tags.cuisine.split(";").map(e=>humanizeOsmTag(e)).join(", "):null}get facebook(){return getSocialInfo(this.tags,"facebook")}get instagram(){return getSocialInfo(this.tags,"instagram")}get wikipedia(){const e=this.tags.wikipedia;return e?e.split(";").map(e=>e.trim()).filter(Boolean)[0]:null}get geoLink(){const e=this.place.lat,t=this.place.lon;return e&&t?`geo:${e},${t}?q=${e},${t}(${encodeURIComponent(this.name)})`:"#"}get visibleGeoLink(){const e=this.place.lat,t=this.place.lon;return e&&t?`${Number(e).toFixed(6)}, ${Number(t).toFixed(6)}`:""}get osmUrl(){const e=this.place.osmId;if(e)return`https://www.openstreetmap.org/${this.place.osmType||"node"}/${e}`;const t=this.place.lat,r=this.place.lon;if(!t||!r)return null;const n=this.mapUi.currentCenter?.lat??t,i=this.mapUi.currentCenter?.lon??r,o=this.mapUi.currentZoom??17,s=Math.round(o);return`https://www.openstreetmap.org/search?lat=${t}&lon=${r}&zoom=${s}#map=${s}/${Number(n).toFixed(5)}/${Number(i).toFixed(5)}`}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}get showDescription(){return"photon"!==this.place.source&&!!this.place.description}openGallery(e){this.selectedGalleryPhoto=e,this.isGalleryOpen=!0}static{decorateMethodV2(this.prototype,"openGallery",[action])}closeGallery(){this.isGalleryOpen=!1,this.selectedGalleryPhoto=null}static{decorateMethodV2(this.prototype,"closeGallery",[action])}static{setComponentTemplate(templateFactory({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," "],[8,[32,1],null,[["@variant","@photos","@name","@resetKey","@scrollToEventId","@onPhotoClick"],["inline",[30,0,["photos"]],[30,0,["name"]],[30,0,["place","osmId"]],[30,0,["newlyUploadedPhotoId"]],[30,0,["openGallery"]]]],null],[1,"\\n "],[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,["showDescription"]],[[[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 "],[10,0],[14,0,"save-button-wrapper"],[12],[1,"\\n "],[11,"button"],[16,0,[52,[30,0,["isSaved"]],"btn btn-secondary","btn btn-outline"]],[24,4,"button"],[4,[32,2],["click",[30,0,["toggleLists"]]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@color"],["bookmark",[52,[30,0,["isSaved"]],"currentColor","var(--link-color)"]]],null],[1,"\\n "],[1,[52,[30,0,["isSaved"]],"Saved","Save"]],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["showLists"]],[[[1," "],[8,[32,4],null,[["@place","@onClose","@isSaved"],[[30,0,["saveablePlace"]],[30,0,["closeLists"]],[30,0,["isSaved"]]]],null],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n"],[41,[30,0,["isSaved"]],[[[1," "],[11,"button"],[24,0,"btn btn-outline"],[24,"title","Edit"],[16,"disabled",[30,0,["isEditing"]]],[24,4,"button"],[4,[32,2],["click",[30,0,["startEditing"]]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@color"],["edit","var(--link-color)"]],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],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["fork-and-knife","Cuisine"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[1,[30,0,["cuisine"]]],[1,"\\n "],[13],[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,"\\n "],[1,[30,0,["openingHours"]]],[1,"\\n "],[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],[1,"\\n "],[1,[30,0,["phone"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["whatsapp"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["whatsapp","WhatsApp"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[1,[30,0,["whatsapp"]]],[1,"\\n "],[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],[1,"\\n "],[1,[30,0,["website"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["email"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["mail","Email"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[1,[30,0,["email"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["facebook"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["facebook","Facebook"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["facebook","url"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n "],[1,[30,0,["facebook","username"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["instagram"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["instagram","Instagram"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["instagram","url"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n "],[1,[30,0,["instagram","username"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["wikipedia"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["wikipedia","Wikipedia"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[29,["https://wikipedia.org/wiki/",[30,0,["wikipedia"]]]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n Wikipedia\\n "],[13],[1,"\\n "],[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\\n"],[41,[30,0,["place","osmId"]],[[[1," "],[10,0],[14,0,"meta-info"],[12],[1,"\\n "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name"],["feather-camera"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[11,"button"],[24,0,"btn-link"],[24,4,"button"],[4,[32,2],["click",[30,0,["openPhotoUploadModal"]]],null],[12],[1,"\\n Add a photo\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[13],[1,"\\n\\n"],[41,[30,0,["isPhotoUploadModalOpen"]],[[[1," "],[8,[32,5],null,[["@onClose","@disableClose"],[[30,0,["closePhotoUploadModal"]],[30,0,["isPhotoUploadActive"]]]],[["default"],[[[[1,"\\n "],[8,[32,6],null,[["@place","@onClose","@onUploadStateChange"],[[30,0,["saveablePlace"]],[30,0,["closePhotoUploadModal"]],[30,0,["handleUploadStateChange"]]]],null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["isNostrConnectModalOpen"]],[[[1," "],[8,[32,5],null,[["@onClose"],[[30,0,["closeNostrConnectModal"]]]],[["default"],[[[[1,"\\n "],[8,[32,7],null,[["@onConnect"],[[30,0,["onNostrConnected"]]]],null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["isGalleryOpen"]],[[[1," "],[8,[32,8],null,[["@photos","@selectedPhoto","@placeName","@onClose"],[[30,0,["photos"]],[30,0,["selectedGalleryPhoto"]],[30,0,["name"]],[30,0,["closeGallery"]]]],null],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({PlaceEditForm:PlaceEditForm,PhotoCarousel:PhotoCarousel,on:on,Icon:IconComponent,PlaceListsManager:PlaceListsManager,Modal:Modal,PlacePhotoUpload:PlacePhotoUpload,NostrConnect:NostrConnectComponent,PhotoGallery:PhotoGallery}),isStrictMode:!0}),this)}},humanize_osm_tag_default=helper$1(function([e]){return humanizeOsmTag(e)}),restore_scroll_default=modifier((e,[t])=>{e&&"number"==typeof t&&t>0&&requestAnimationFrame(()=>{e.scrollTop=t})}),PlacesSidebar=class extends Component{static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");createNewPlace(){const e=this.router.currentRoute.queryParams,t=e.lat,r=e.lon;t&&r?this.router.transitionTo("place.new",{queryParams:{lat:t,lon:r}}):this.router.transitionTo("place.new",{queryParams:{lat:0,lon:0}})}static{decorateMethodV2(this.prototype,"createNewPlace",[action])}selectPlace(e){this.args.onSelect&&this.args.onSelect(e)}static{decorateMethodV2(this.prototype,"selectPlace",[action])}clearSelection(){this.args.onSelect&&this.args.onSelect(null)}static{decorateMethodV2(this.prototype,"clearSelection",[action])}async toggleSave(e){if(e)if(e.createdAt)try{if(await this.storage.removePlace(e),console.debug("Place deleted:",e.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate){const t={...e,id:void 0,geohash:void 0,createdAt:void 0};this.args.onUpdate(t)}this.args.onSelect&&this.args.onSelect(null),this.args.onClose&&this.args.onClose()}catch(t){console.error("Failed to delete:",t),alert("Failed to delete: "+t.message)}else{const t={title:getLocalizedName(e.osmTags,"Untitled Place"),lat:e.lat,lon:e.lon,tags:[],url:e.osmTags.website,osmId:String(e.osmId||e.id),osmType:e.osmType,osmTags:e.osmTags};try{const e=await this.storage.storePlace(t);console.debug("Place saved:",t.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate&&this.args.onUpdate(e),this.args.onSelect&&this.args.onSelect(e)}catch(error){console.error("Failed to save place:",error),alert("Failed to save place: "+error.message)}}}static{decorateMethodV2(this.prototype,"toggleSave",[action])}async updateBookmark(e){try{const t=await this.storage.updatePlace(e);console.debug("Place updated:",t.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate&&this.args.onUpdate(t)}catch(t){console.error("Failed to update place:",t),alert("Failed to update place: "+t.message)}}static{decorateMethodV2(this.prototype,"updateBookmark",[action])}get isNearbySearch(){const e=this.router.currentRoute.queryParams;return!e.q&&!e.category&&e.lat&&e.lon}get hasHeaderPhoto(){return this.args.selectedPlace&&this.nostrData.placePhotos&&this.nostrData.placePhotos.length>0}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"sidebar"],[12],[1,"\\n "],[10,0],[15,0,[29,["sidebar-header\\n ",[52,[30,0,["hasHeaderPhoto"]],"no-border"],"\\n ",[52,[28,[32,0],[[28,[32,1],[[30,1]],null],[30,2]],null],"has-back-btn"]]]],[12],[1,"\\n"],[41,[30,1],[[[1," "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,2],["click",[30,0,["clearSelection"]]],null],[12],[8,[32,3],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[13],[1,"\\n"]],[]],[[[41,[30,2],[[[1," "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,2],["click",[30,2]],null],[12],[8,[32,3],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[13],[1,"\\n"]],[]],null],[41,[30,2],[[[1," "],[10,"h2"],[14,0,"sidebar-header-text-centered"],[12],[1,"\\n "],[10,1],[14,0,"sidebar-header-icon-wrapper"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size","@color"],["bookmark",20,[28,[32,4],[[30,3],"#898989"],null]]],null],[1,"\\n "],[13],[1,"\\n "],[1,[30,4]],[1,"\\n "],[13],[1,"\\n"]],[]],[[[41,[30,0,["isNearbySearch"]],[[[1," "],[10,"h2"],[12],[8,[32,3],null,[["@name","@size","@color"],["target",20,"#ea4335"]],null],[1,"\\n Nearby"],[13],[1,"\\n"]],[]],[[[1," "],[10,"h2"],[12],[8,[32,3],null,[["@name","@size","@color"],["search",20,"#333"]],null],[1,"\\n Results"],[13],[1,"\\n"]],[]]]],[]]]],[]]],[1," "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,2],["click",[30,5]],null],[12],[8,[32,3],null,[["@name","@size","@color"],["x",20,"#333"]],null],[13],[1,"\\n "],[13],[1,"\\n\\n "],[11,0],[24,0,"sidebar-content"],[4,[32,5],[[30,6]],null],[12],[1,"\\n"],[41,[30,1],[[[1," "],[8,[32,6],null,[["@place","@onToggleSave","@onSave"],[[30,1],[30,0,["toggleSave"]],[30,0,["updateBookmark"]]]],null],[1,"\\n"]],[]],[[[41,[30,7],[[[1," "],[10,0],[14,0,"sidebar-loading"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size","@color"],["loading-ring",24,"#898989"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],[[[41,[30,8],[[[1," "],[10,"ul"],[14,0,"places-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,8]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,0,"place-item"],[24,4,"button"],[4,[32,2],["click",[28,[32,7],[[30,0,["selectPlace"]],[30,9]],null]],null],[12],[1,"\\n "],[10,0],[14,0,"place-name"],[12],[1,[28,[32,4],[[30,9,["title"]],[30,9,["osmTags","name"]],[30,9,["osmTags","name:en"]],"Unnamed Place"],null]],[13],[1,"\\n "],[10,0],[14,0,"place-type"],[12],[1,"\\n"],[41,[28,[32,8],[[30,9,["source"]],"osm"],null],[[[1," "],[1,[28,[32,9],[[30,9,["type"]]],null]],[1,"\\n"]],[]],[[[41,[28,[32,8],[[30,9,["source"]],"photon"],null],[[[1," "],[1,[30,9,["description"]]],[1,"\\n"]],[]],[[[41,[28,[32,10],[[30,9,["osmTags"]]],null],[[[1," "],[1,[28,[32,10],[[30,9,["osmTags"]]],null]],[1,"\\n"]],[]],[[[1," Saved place\\n "]],[]]]],[]]]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[9]],null],[1," "],[13],[1,"\\n"]],[]],[[[41,[30,0,["isNearbySearch"]],[[[1," "],[10,2],[14,0,"empty-state"],[12],[1,"No places found nearby."],[13],[1,"\\n"]],[]],[[[1," "],[10,2],[14,0,"empty-state"],[12],[1,"No results found."],[13],[1,"\\n"]],[]]]],[]]],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline create-place"],[24,4,"button"],[4,[32,2],["click",[30,0,["createNewPlace"]]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size","@color"],["plus",18,"var(--link-color)"]],null],[1,"\\n Create new place\\n "],[13],[1,"\\n"]],[]]]],[]]],[1," "],[13],[1,"\\n"],[13]],["@selectedPlace","@onBack","@color","@title","@onClose","@scrollTop","@isLoading","@places","place"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({and:AndHelper,not:not,on:on,Icon:IconComponent,or:OrHelper,restoreScroll:restore_scroll_default,PlaceDetails:PlaceDetails,fn:fn,eq:eq$1,humanizeOsmTag:humanize_osm_tag_default,getPlaceType:getPlaceType}),isStrictMode:!0}),this)}},list_exports$2=__exportAll({default:()=>list_default}),list_default=setComponentTemplate(templateFactory({id:null,block:'[[[41,[30,1,["mapUi","isSidebarVisible"]],[[[1," "],[8,[32,0],null,[["@places","@title","@color","@scrollTop","@isLoading","@onSelect","@onClose","@onBack"],[[30,1,["places"]],[30,1,["listTitle"]],[30,1,["listColor"]],[30,1,["scrollTop"]],[30,1,["loadPlacesTask","isRunning"]],[30,1,["selectPlace"]],[30,1,["close"]],[30,1,["backToLists"]]]],null],[1,"\\n"]],[]],null]],["@controller"],["if"]]',moduleName:"(unknown template module)",scope:()=>({PlacesSidebar:PlacesSidebar}),isStrictMode:!0}),templateOnly()),list_exports$1=__exportAll({default:()=>ListsListController});function getPlaceTime(e){const t=e.createdAt;if(!t)return 0;if("number"==typeof t)return t;const r=Date.parse(t);return isNaN(r)?0:r}var ListsListController=class extends Controller{static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"model",[tracked])}#ot=void initializeDeferredDecorator(this,"model");static{decorateFieldV2(this.prototype,"loadedPlaces",[tracked],function(){return[]})}#st=void initializeDeferredDecorator(this,"loadedPlaces");get listId(){return this.model?.list_id}loadPlacesTask=buildTask(()=>({context:this,generator:function*(e){this.loadedPlaces=[];try{this.loadedPlaces=yield this.storage.getPlacesInList(e)}catch(t){console.error("Failed to load places in list",e,t),this.loadedPlaces=[]}}}),{restartable:!0},"loadPlacesTask",null);get scrollTop(){return this.mapUi.getScrollPosition(`list-${this.listId}`)}get listColor(){const e=this.storage.lists.find(e=>e.id===this.listId);return e&&e.color?e.color:getComputedStyle(document.documentElement).getPropertyValue("--default-list-color").trim()}get listTitle(){const e=this.storage.lists.find(e=>e.id===this.listId);return e?e.title:"Collections"}get places(){const e=this.storage.lists.find(e=>e.id===this.listId),t=new Set(e?.placeRefs?.map(e=>e.id)||[]),r=this.storage.savedPlaces.filter(e=>t.has(e.id)),n=[],i=new Set;return r.forEach(e=>{n.push(e),i.add(e.id)}),this.loadedPlaces.forEach(e=>{t.has(e.id)&&!i.has(e.id)&&(n.push(e),i.add(e.id))}),n.sort((e,t)=>getPlaceTime(t)-getPlaceTime(e))}selectPlace(e){if(e){const t=document.querySelector(".sidebar-content");t&&this.mapUi.saveScrollPosition(`list-${this.listId}`,t.scrollTop),this.mapUi.returnToRoute={name:"lists.list",model:this.listId},this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!0,this.router.transitionTo("place",e)}}static{decorateMethodV2(this.prototype,"selectPlace",[action])}close(){this.router.transitionTo("index")}static{decorateMethodV2(this.prototype,"close",[action])}backToLists(){this.router.transitionTo("lists.index")}static{decorateMethodV2(this.prototype,"backToLists",[action])}},list_exports=__exportAll({default:()=>ListsListRoute}),ListsListRoute=class extends Route{static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");model(e){return{list_id:e.list_id}}setupController(e,t){console.debug("DEBUG: setupController controller is:",e),console.debug("DEBUG: controller.loadPlacesTask is:",e?.loadPlacesTask),e.model=t,super.setupController(e,t),e&&e.loadPlacesTask?e.loadPlacesTask.perform(t.list_id):console.error("DEBUG: ERROR! controller.loadPlacesTask is undefined!")}},lists_exports$1=__exportAll({default:()=>ListsIndexTemplate}),ListsIndexTemplate=class extends Component{static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");styleFor(e){const t=e||getComputedStyle(document.documentElement).getPropertyValue("--default-list-color").trim();return htmlSafe(`background-color: ${t}`)}selectList(e){this.router.transitionTo("lists.list",e)}static{decorateMethodV2(this.prototype,"selectList",[action])}close(){this.router.transitionTo("index")}static{decorateMethodV2(this.prototype,"close",[action])}backToMenu(){this.router.transitionTo("menu")}static{decorateMethodV2(this.prototype,"backToMenu",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[41,[30,0,["mapUi","isSidebarVisible"]],[[[1," "],[10,0],[14,0,"sidebar"],[12],[1,"\\n "],[10,0],[14,0,"sidebar-header has-back-btn"],[12],[1,"\\n "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,0],["click",[30,0,["backToMenu"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[10,"h2"],[14,0,"sidebar-header-text-centered"],[12],[1,"\\n "],[10,1],[14,0,"sidebar-header-icon-wrapper"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["bookmark",20,"#898989"]],null],[1,"\\n "],[13],[1,"\\n Collections\\n "],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,0,["close"]]],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,"ul"],[14,0,"places-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["storage","lists"]]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,0,"lists-index-item"],[24,4,"button"],[4,[32,0],["click",[28,[32,2],[[30,0,["selectList"]],[30,1,["id"]]],null]],null],[12],[1,"\\n "],[10,0],[14,0,"lists-index-item-left"],[12],[1,"\\n"],[1," "],[10,1],[14,0,"list-color-dot"],[15,5,[28,[30,0,["styleFor"]],[[30,1,["color"]]],null]],[12],[13],[1,"\\n "],[10,0],[14,0,"lists-index-name"],[12],[1,[30,1,["title"]]],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"lists-index-count"],[12],[1,"\\n"],[41,[30,1,["placeRefs","length"]],[[[1," "],[1,[30,1,["placeRefs","length"]]],[1,"\\n places\\n"]],[]],[[[1," empty\\n"]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[1]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null]],["list"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({on:on,Icon:IconComponent,fn:fn}),isStrictMode:!0}),this)}},lists_exports=__exportAll({default:()=>ListsIndexRoute}),ListsIndexRoute=class extends Route{},search_exports$2=__exportAll({default:()=>SearchTemplate}),SearchTemplate=class extends Component{static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");selectPlace(e){if(e){const t=document.querySelector(".sidebar-content");t&&this.mapUi.saveScrollPosition("search",t.scrollTop),this.mapUi.returnToSearch=!0,this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!0,this.router.transitionTo("place",e)}}static{decorateMethodV2(this.prototype,"selectPlace",[action])}close(){this.mapUi.hideSidebar()}static{decorateMethodV2(this.prototype,"close",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[41,[30,0,["mapUi","isSidebarVisible"]],[[[1," "],[8,[32,0],null,[["@places","@scrollTop","@onSelect","@onClose"],[[30,0,["mapUi","searchResults"]],[28,[30,0,["mapUi","getScrollPosition"]],["search"],null],[30,0,["selectPlace"]],[30,0,["close"]]]],null],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({PlacesSidebar:PlacesSidebar}),isStrictMode:!0}),this)}},search_exports$1=__exportAll({default:()=>SearchController}),SearchController=class extends Controller{static{decorateFieldV2(this.prototype,"osm",[service])}#pe=void initializeDeferredDecorator(this,"osm");static{decorateFieldV2(this.prototype,"photon",[service])}#at=void initializeDeferredDecorator(this,"photon");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"toast",[service])}#fe=void initializeDeferredDecorator(this,"toast");queryParams=["lat","lon","q","selected","category"];lat=null;lon=null;q=null;selected=null;category=null;fetchResultsTask=buildTask(()=>({context:this,generator:function*(e){const t=this.mapUi.currentSearch&&e.q===this.mapUi.currentSearch.q&&e.category===this.mapUi.currentSearch.category&&e.lat===this.mapUi.currentSearch.lat&&e.lon===this.mapUi.currentSearch.lon,r=this.mapUi.searchResults&&this.mapUi.searchResults.length>0;if(t&&r)return void(this.mapUi.isSidebarVisible&&this.mapUi.showSidebar());this.mapUi.hideSidebar(),this.mapUi.clearSearchResults();const n=e.lat?parseFloat(e.lat):null,i=e.lon?parseFloat(e.lon):null;let o=[],s=null,a=null;try{if(e.category&&n&&i){s="category",a=e.category,this.mapUi.startLoading(s,a);let t=this.mapUi.currentBounds;if(!t){const e=.01;t={minLat:n-e,maxLat:n+e,minLon:i-e,maxLon:i+e}}o=yield this.osm.getCategoryPois(t,e.category,n,i),o=o.map(e=>({...e,_distance:getDistance$1(n,i,e.lat,e.lon)})).sort((e,t)=>e._distance-t._distance)}else if(e.q){s="text",a=e.q,this.mapUi.startLoading(s,a),o=yield this.photon.search(e.q,n,i);const t=e.q.toLowerCase();let r=[];t.length>=3&&(r=this.storage.savedPlaces.filter(e=>e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t))),r.forEach(e=>{o.find(t=>e.osmId&&t.osmId===e.osmId||t.id&&t.id===e.id)||o.push(e)})}else if(n&&i){const e=50;o=yield this.osm.getNearbyPois(n,i,e),this.storage.savedPlaces.filter(t=>getDistance$1(n,i,t.lat,t.lon)<=e).forEach(e=>{o.find(t=>e.osmId&&t.osmId===e.osmId||t.id&&t.id===e.id)||o.push(e)}),o=o.map(e=>({...e,_distance:getDistance$1(n,i,e.lat,e.lon)})).sort((e,t)=>e._distance-t._distance)}}catch(error){return console.error("Search request failed.",error),this.toast.show("Search request failed. Please try again."),void this.mapUi.stopSearch()}finally{s&&a&&this.mapUi.stopLoading(s,a)}o=o.map(e=>this.storage.findPlaceById(e.osmId)||e);const l=e.selected||e.q;if(l&&o.length>0){let e=o.find(e=>e.osmTags&&(e.osmTags.name===l||e.osmTags["name:en"]===l));if(!e){const t=o[0];t._distance<=10&&(e=t)}if(e)return this.router.replaceWith("place",e),void this.mapUi.stopSearch()}this.mapUi.setSearchResults(o),this.mapUi.showSidebar(),this.mapUi.stopSearch()}}),{restartable:!0},"fetchResultsTask",null)},search_exports=__exportAll({default:()=>SearchRoute}),SearchRoute=class extends Route{static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");static{decorateFieldV2(this.prototype,"toast",[service])}#fe=void initializeDeferredDecorator(this,"toast");queryParams={lat:{refreshModel:!0},lon:{refreshModel:!0},q:{refreshModel:!0},selected:{refreshModel:!0},category:{refreshModel:!0}};model(e){return e}setupController(e,t){super.setupController(e,t),e.fetchResultsTask.perform(t);const{q:r,category:n,lat:i,lon:o}=this.paramsFor("search");this.mapUi.currentSearch={q:r,category:n,lat:i,lon:o}}resetController(e,t){t&&(e.fetchResultsTask.cancelAll(),this.mapUi.stopSearch())}error(e,t){return this.mapUi.stopSearch(),this.toast.show("Search request failed. Please try again."),t&&t.abort(),!1}static{decorateMethodV2(this.prototype,"error",[action])}},internals_exports=__exportAll({cacheFor:()=>getCachedValueFor,guidFor:()=>guidFor}),_dec,_class,_descriptor,PageTitle=(_dec=service("page-title"),_class=class extends Helper{constructor(e){super(e),_initializerDefineProperty(this,"tokens",_descriptor,this),_defineProperty(this,"tokenId",guidFor(this)),this.tokens.push({id:this.tokenId})}compute(e,t){const r={...t,id:this.tokenId,title:e.join("")};return this.tokens.push(r),this.tokens.scheduleTitleUpdate(),""}willDestroy(){super.willDestroy(),this.tokens.remove(this.tokenId),this.tokens.scheduleTitleUpdate()}},_descriptor=_applyDecoratedDescriptor(_class.prototype,"tokens",[_dec],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_class),CollectionEventType_default={ADD:"add",REMOVE:"remove"},ObjectEventType_default={PROPERTYCHANGE:"propertychange"};function clear(e){for(const t in e)delete e[t]}function isEmpty$1(e){let t;for(t in e)return!1;return!t}function listen(e,t,r,n,i){if(i){const i=r;r=function(o){return e.removeEventListener(t,r),i.call(n??this,o)}}else n&&n!==e&&(r=r.bind(n));const o={target:e,type:t,listener:r};return e.addEventListener(t,r),o}function listenOnce(e,t,r,n){return listen(e,t,r,n,!0)}function unlistenByKey(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),clear(e))}var EventType_default$2={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"},Disposable=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function binarySearch$1(e,t,r){let n,i;r=r||ascending;let o=0,s=e.length,a=!1;for(;o<s;)n=o+(s-o>>1),i=+r(e[n],t),i<0?o=n+1:(s=n,a=!i);return a?o:~o}function ascending(e,t){return e>t?1:e<t?-1:0}function descending(e,t){return e<t?1:e>t?-1:0}function linearFindNearest(e,t,r){if(e[0]<=t)return 0;const n=e.length;if(t<=e[n-1])return n-1;if("function"==typeof r){for(let i=1;i<n;++i){const n=e[i];if(n===t)return i;if(n<t)return r(t,e[i-1],n)>0?i-1:i}return n-1}if(r>0){for(let r=1;r<n;++r)if(e[r]<t)return r-1;return n-1}if(r<0){for(let r=1;r<n;++r)if(e[r]<=t)return r;return n-1}for(let i=1;i<n;++i){if(e[i]==t)return i;if(e[i]<t)return e[i-1]-t<t-e[i]?i-1:i}return n-1}function reverseSubArray(e,t,r){for(;t<r;){const n=e[t];e[t]=e[r],e[r]=n,++t,--r}}function extend$2(e,t){const r=Array.isArray(t)?t:[t],n=r.length;for(let i=0;i<n;i++)e[e.length]=r[i]}function equals$2(e,t){const r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}function isSorted(e,t,r){const n=t||ascending;return e.every(function(t,i){if(0===i)return!0;const o=n(e[i-1],t);return!(o>0||r&&0===o)})}function TRUE(){return!0}function FALSE(){return!1}function VOID(){}function memoizeOne(e){let t,r,n;return function(){const i=Array.prototype.slice.call(arguments);return r&&this===n&&equals$2(i,r)||(n=this,r=i,t=e.apply(this,arguments)),t}}function toPromise(e){return function(){let t;try{t=e()}catch(err){return Promise.reject(err)}return t instanceof Promise?t:Promise.resolve(t)}()}var BaseEvent=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},Target=class extends Disposable{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const r=this.listeners_||(this.listeners_={}),n=r[e]||(r[e]=[]);n.includes(t)||n.push(t)}dispatchEvent(e){const t="string"==typeof e,r=t?e:e.type,n=this.listeners_&&this.listeners_[r];if(!n)return;const i=t?new BaseEvent(e):e;i.target||(i.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),s=this.pendingRemovals_||(this.pendingRemovals_={});let a;r in o||(o[r]=0,s[r]=0),++o[r];for(let l=0,c=n.length;l<c;++l)if(a="handleEvent"in n[l]?n[l].handleEvent(i):n[l].call(this,i),!1===a||i.propagationStopped){a=!1;break}if(0===--o[r]){let e=s[r];for(delete s[r];e--;)this.removeEventListener(r,VOID);delete o[r]}return a}disposeInternal(){this.listeners_&&clear(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return!!this.listeners_&&(e?e in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(e,t){if(!this.listeners_)return;const r=this.listeners_[e];if(!r)return;const n=r.indexOf(t);-1!==n&&(this.pendingRemovals_&&e in this.pendingRemovals_?(r[n]=VOID,++this.pendingRemovals_[e]):(r.splice(n,1),0===r.length&&delete this.listeners_[e]))}},Observable=class extends Target{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(EventType_default$2.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const r=e.length,n=new Array(r);for(let i=0;i<r;++i)n[i]=listen(this,e[i],t);return n}return listen(this,e,t)}onceInternal(e,t){let r;if(Array.isArray(e)){const n=e.length;r=new Array(n);for(let i=0;i<n;++i)r[i]=listenOnce(this,e[i],t)}else r=listenOnce(this,e,t);return t.ol_key=r,r}unInternal(e,t){const r=t.ol_key;if(r)unByKey(r);else if(Array.isArray(e))for(let n=0,i=e.length;n<i;++n)this.removeEventListener(e[n],t);else this.removeEventListener(e,t)}};function unByKey(e){if(Array.isArray(e))for(let t=0,r=e.length;t<r;++t)unlistenByKey(e[t]);else unlistenByKey(e)}function abstract(){throw new Error("Unimplemented abstract method.")}Observable.prototype.on,Observable.prototype.once,Observable.prototype.un;var uidCounter_=0;function getUid(e){return e.ol_uid||(e.ol_uid=String(++uidCounter_))}var ObjectEvent=class extends BaseEvent{constructor(e,t,r){super(e),this.key=t,this.oldValue=r}},BaseObject=class extends Observable{constructor(e){super(),this.on,this.once,this.un,getUid(this),this.values_=null,void 0!==e&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let r;r=`change:${e}`,this.hasListener(r)&&this.dispatchEvent(new ObjectEvent(r,e,t)),r=ObjectEventType_default.PROPERTYCHANGE,this.hasListener(r)&&this.dispatchEvent(new ObjectEvent(r,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,r){const n=this.values_||(this.values_={});if(r)n[e]=t;else{const r=n[e];n[e]=t,r!==t&&this.notify(e,r)}}setProperties(e,t){for(const r in e)this.set(r,e[r],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const r=this.values_[e];delete this.values_[e],isEmpty$1(this.values_)&&(this.values_=null),t||this.notify(e,r)}}},Property$4={LENGTH:"length"},CollectionEvent=class extends BaseEvent{constructor(e,t,r){super(e),this.element=t,this.index=r}},Collection=class extends BaseObject{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let r=1,n=this.array_.length;r<n;++r)this.assertUnique_(this.array_[r],r);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,r=e.length;t<r;++t)this.push(e[t]);return this}forEach(e){const t=this.array_;for(let r=0,n=t.length;r<n;++r)e(t[r],r,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(Property$4.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new CollectionEvent(CollectionEventType_default.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let r=0,n=t.length;r<n;++r)if(t[r]===e)return this.removeAt(r)}removeAt(e){if(e<0||e>=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new CollectionEvent(CollectionEventType_default.REMOVE,t,e)),t}setAt(e,t){if(e>=this.getLength())return void this.insertAt(e,t);if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new CollectionEvent(CollectionEventType_default.REMOVE,r,e)),this.dispatchEvent(new CollectionEvent(CollectionEventType_default.ADD,t,e))}updateLength_(){this.set(Property$4.LENGTH,this.array_.length)}assertUnique_(e,t){const r=this.array_;for(let n=0,i=r.length;n<i;++n)if(r[n]===e&&n!==t)throw new Error("Duplicate item added to a unique collection")}},MapEvent=class extends BaseEvent{constructor(e,t,r){super(e),this.map=t,this.frameState=void 0!==r?r:null}},MapBrowserEvent=class extends MapEvent{constructor(e,t,r,n,i,o){super(e,t,i),this.originalEvent=r,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},MapBrowserEventType_default={SINGLECLICK:"singleclick",CLICK:EventType_default$2.CLICK,DBLCLICK:EventType_default$2.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},ua="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",SAFARI=ua.includes("safari")&&!ua.includes("chrom"),SAFARI_BUG_237906=SAFARI&&(ua.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(ua)),WEBKIT=ua.includes("webkit")&&!ua.includes("edge"),MAC=ua.includes("macintosh"),DEVICE_PIXEL_RATIO="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,WORKER_OFFSCREEN_CANVAS="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,IMAGE_DECODE="undefined"!=typeof Image&&Image.prototype.decode,CREATE_IMAGE_BITMAP="function"==typeof createImageBitmap,PASSIVE_EVENT_LISTENERS=function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return e}(),EventType_default$1={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},MapBrowserEventHandler=class extends Target{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===t?1:t,this.down_=null;const r=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=r,this.pointerdownListenerKey_=listen(r,EventType_default$1.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=listen(r,EventType_default$1.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(EventType_default$2.TOUCHMOVE,this.boundHandleTouchMove_,!!PASSIVE_EVENT_LISTENERS&&{passive:!1})}emulateClick_(e){let t=new MapBrowserEvent(MapBrowserEventType_default.CLICK,this.map_,e);this.dispatchEvent(t),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new MapBrowserEvent(MapBrowserEventType_default.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const t=new MapBrowserEvent(MapBrowserEventType_default.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250)}updateActivePointers_(e){const t=e,r=t.pointerId;if(t.type==MapBrowserEventType_default.POINTERUP||t.type==MapBrowserEventType_default.POINTERCANCEL){delete this.trackedTouches_[r];for(const e in this.trackedTouches_)if(this.trackedTouches_[e].target!==t.target){delete this.trackedTouches_[e];break}}else t.type!=MapBrowserEventType_default.POINTERDOWN&&t.type!=MapBrowserEventType_default.POINTERMOVE||(this.trackedTouches_[r]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new MapBrowserEvent(MapBrowserEventType_default.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(unlistenByKey),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return 0===e.button}handlePointerDown_(e){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(e);const t=new MapBrowserEvent(MapBrowserEventType_default.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),0===this.dragListenerKeys_.length){const e=this.map_.getOwnerDocument();this.dragListenerKeys_.push(listen(e,MapBrowserEventType_default.POINTERMOVE,this.handlePointerMove_,this),listen(e,MapBrowserEventType_default.POINTERUP,this.handlePointerUp_,this),listen(this.element_,MapBrowserEventType_default.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==e&&this.dragListenerKeys_.push(listen(this.element_.getRootNode(),MapBrowserEventType_default.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new MapBrowserEvent(MapBrowserEventType_default.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!(!this.down_||!this.isMoving_(e));this.dispatchEvent(new MapBrowserEvent(MapBrowserEventType_default.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;t&&!t.defaultPrevented||"boolean"==typeof e.cancelable&&!0!==e.cancelable||e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(unlistenByKey(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(EventType_default$2.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(unlistenByKey(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(unlistenByKey),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},MapEventType_default={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},MapProperty_default={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},TileState_default={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function assert$1(e,t){if(!e)throw new Error(t)}var DROP=1/0,PriorityQueue=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,clear(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,r=e[0];1==e.length?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const n=this.keyFunction_(r);return delete this.queuedElements_[n],r}enqueue(e){assert$1(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const t=this.priorityFunction_(e);return t!=1/0&&(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(e){return 2*e+1}getRightChildIndex_(e){return 2*e+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return 0===this.elements_.length}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,r=this.priorities_,n=t.length,i=t[e],o=r[e],s=e;for(;e<n>>1;){const i=this.getLeftChildIndex_(e),o=this.getRightChildIndex_(e),s=o<n&&r[o]<r[i]?o:i;t[e]=t[s],r[e]=r[s],e=s}t[e]=i,r[e]=o,this.siftDown_(s,e)}siftDown_(e,t){const r=this.elements_,n=this.priorities_,i=r[t],o=n[t];for(;t>e;){const e=this.getParentIndex_(t);if(!(n[e]>o))break;r[t]=r[e],n[t]=n[e],t=e}r[t]=i,n[t]=o}reprioritize(){const e=this.priorityFunction_,t=this.elements_,r=this.priorities_;let n=0;const i=t.length;let o,s,a;for(s=0;s<i;++s)o=t[s],a=e(o),a==1/0?delete this.queuedElements_[this.keyFunction_(o)]:(r[n]=a,t[n++]=o);t.length=n,r.length=n,this.heapify_()}},TileQueue=class extends PriorityQueue{constructor(e,t){super(t=>e.apply(null,t),e=>e[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){const t=super.enqueue(e);return t&&e[0].addEventListener(EventType_default$2.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){const t=e.target,r=t.getState();if(r===TileState_default.LOADED||r===TileState_default.ERROR||r===TileState_default.EMPTY){r!==TileState_default.ERROR&&t.removeEventListener(EventType_default$2.CHANGE,this.boundHandleTileChange_);const e=t.getKey();e in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[e],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let r=0;for(;this.tilesLoading_<e&&r<t&&this.getCount()>0;){const e=this.dequeue()[0],t=e.getKey();e.getState()!==TileState_default.IDLE||t in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[t]=!0,++this.tilesLoading_,++r,e.load())}}};function getTilePriority(e,t,r,n,i){if(!e||!(r in e.wantedTiles))return DROP;if(!e.wantedTiles[r][t.getKey()])return DROP;const o=e.viewState.center,s=n[0]-o[0],a=n[1]-o[1];return 65536*Math.log(i)+Math.sqrt(s*s+a*a)/i}var ViewHint_default={ANIMATING:0,INTERACTING:1},ViewProperty_default={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function clamp$1(e,t,r){return Math.min(Math.max(e,t),r)}function squaredSegmentDistance(e,t,r,n,i,o){const s=i-r,a=o-n;if(0!==s||0!==a){const l=((e-r)*s+(t-n)*a)/(s*s+a*a);l>1?(r=i,n=o):l>0&&(r+=s*l,n+=a*l)}return squaredDistance$1(e,t,r,n)}function squaredDistance$1(e,t,r,n){const i=r-e,o=n-t;return i*i+o*o}function solveLinearSystem(e){const t=e.length;for(let n=0;n<t;n++){let r=n,i=Math.abs(e[n][n]);for(let s=n+1;s<t;s++){const t=Math.abs(e[s][n]);t>i&&(i=t,r=s)}if(0===i)return null;const o=e[r];e[r]=e[n],e[n]=o;for(let s=n+1;s<t;s++){const r=-e[s][n]/e[n][n];for(let i=n;i<t+1;i++)n==i?e[s][i]=0:e[s][i]+=r*e[n][i]}}const r=new Array(t);for(let n=t-1;n>=0;n--){r[n]=e[n][t]/e[n][n];for(let i=n-1;i>=0;i--)e[i][t]-=e[i][n]*r[n]}return r}function toDegrees(e){return 180*e/Math.PI}function toRadians(e){return e*Math.PI/180}function modulo(e,t){const r=e%t;return r*t<0?r+t:r}function lerp(e,t,r){return e+r*(t-e)}function toFixed(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}function floor(e,t){return Math.floor(toFixed(e,t))}function ceil(e,t){return Math.ceil(toFixed(e,t))}function wrap(e,t,r){if(e>=t&&e<r)return e;const n=r-t;return((e-t)%n+n)%n+t}function createExtent(e,t,r){return function(n,i,o,s,a){if(!n)return;if(!i&&!t)return n;const l=t?0:o[0]*i,c=t?0:o[1]*i,u=a?a[0]:0,h=a?a[1]:0;let d=e[0]+l/2+u,p=e[2]-l/2+u,f=e[1]+c/2+h,g=e[3]-c/2+h;d>p&&(d=(p+d)/2,p=d),f>g&&(f=(g+f)/2,g=f);let m=clamp$1(n[0],d,p),y=clamp$1(n[1],f,g);if(s&&r&&i){const e=30*i;m+=-e*Math.log(1+Math.max(0,d-n[0])/e)+e*Math.log(1+Math.max(0,n[0]-p)/e),y+=-e*Math.log(1+Math.max(0,f-n[1])/e)+e*Math.log(1+Math.max(0,n[1]-g)/e)}return[m,y]}}function none$1(e){return e}var Relationship_default={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function boundingExtent(e){const t=createEmpty();for(let r=0,n=e.length;r<n;++r)extendCoordinate(t,e[r]);return t}function _boundingExtentXYs(e,t,r){return createOrUpdate$2(Math.min.apply(null,e),Math.min.apply(null,t),Math.max.apply(null,e),Math.max.apply(null,t),r)}function buffer(e,t,r){return r?(r[0]=e[0]-t,r[1]=e[1]-t,r[2]=e[2]+t,r[3]=e[3]+t,r):[e[0]-t,e[1]-t,e[2]+t,e[3]+t]}function clone(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e.slice()}function closestSquaredDistanceXY(e,t,r){let n,i;return n=t<e[0]?e[0]-t:e[2]<t?t-e[2]:0,i=r<e[1]?e[1]-r:e[3]<r?r-e[3]:0,n*n+i*i}function containsCoordinate(e,t){return containsXY(e,t[0],t[1])}function containsExtent(e,t){return e[0]<=t[0]&&t[2]<=e[2]&&e[1]<=t[1]&&t[3]<=e[3]}function containsXY(e,t,r){return e[0]<=t&&t<=e[2]&&e[1]<=r&&r<=e[3]}function coordinateRelationship(e,t){const r=e[0],n=e[1],i=e[2],o=e[3],s=t[0],a=t[1];let l=Relationship_default.UNKNOWN;return s<r?l|=Relationship_default.LEFT:s>i&&(l|=Relationship_default.RIGHT),a<n?l|=Relationship_default.BELOW:a>o&&(l|=Relationship_default.ABOVE),l===Relationship_default.UNKNOWN&&(l=Relationship_default.INTERSECTING),l}function createEmpty(){return[1/0,1/0,-1/0,-1/0]}function createOrUpdate$2(e,t,r,n,i){return i?(i[0]=e,i[1]=t,i[2]=r,i[3]=n,i):[e,t,r,n]}function createOrUpdateEmpty(e){return createOrUpdate$2(1/0,1/0,-1/0,-1/0,e)}function createOrUpdateFromCoordinate(e,t){const r=e[0],n=e[1];return createOrUpdate$2(r,n,r,n,t)}function createOrUpdateFromFlatCoordinates(e,t,r,n,i){return extendFlatCoordinates(createOrUpdateEmpty(i),e,t,r,n)}function equals$1(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function extend$1(e,t){return t[0]<e[0]&&(e[0]=t[0]),t[2]>e[2]&&(e[2]=t[2]),t[1]<e[1]&&(e[1]=t[1]),t[3]>e[3]&&(e[3]=t[3]),e}function extendCoordinate(e,t){t[0]<e[0]&&(e[0]=t[0]),t[0]>e[2]&&(e[2]=t[0]),t[1]<e[1]&&(e[1]=t[1]),t[1]>e[3]&&(e[3]=t[1])}function extendFlatCoordinates(e,t,r,n,i){for(;r<n;r+=i)extendXY(e,t[r],t[r+1]);return e}function extendXY(e,t,r){e[0]=Math.min(e[0],t),e[1]=Math.min(e[1],r),e[2]=Math.max(e[2],t),e[3]=Math.max(e[3],r)}function forEachCorner(e,t){let r;return r=t(getBottomLeft(e)),r||(r=t(getBottomRight(e)),r||(r=t(getTopRight(e)),r||(r=t(getTopLeft(e)),r||!1)))}function getArea(e){let t=0;return isEmpty(e)||(t=getWidth(e)*getHeight(e)),t}function getBottomLeft(e){return[e[0],e[1]]}function getBottomRight(e){return[e[2],e[1]]}function getCenter(e){return[(e[0]+e[2])/2,(e[1]+e[3])/2]}function getCorner(e,t){let r;if("bottom-left"===t)r=getBottomLeft(e);else if("bottom-right"===t)r=getBottomRight(e);else if("top-left"===t)r=getTopLeft(e);else{if("top-right"!==t)throw new Error("Invalid corner");r=getTopRight(e)}return r}function getForViewAndSize(e,t,r,n,i){const[o,s,a,l,c,u,h,d]=getRotatedViewport(e,t,r,n);return createOrUpdate$2(Math.min(o,a,c,h),Math.min(s,l,u,d),Math.max(o,a,c,h),Math.max(s,l,u,d),i)}function getRotatedViewport(e,t,r,n){const i=t*n[0]/2,o=t*n[1]/2,s=Math.cos(r),a=Math.sin(r),l=i*s,c=i*a,u=o*s,h=o*a,d=e[0],p=e[1];return[d-l+h,p-c-u,d-l-h,p-c+u,d+l-h,p+c+u,d+l+h,p+c-u,d-l+h,p-c-u]}function getHeight(e){return e[3]-e[1]}function getIntersection(e,t,r){const n=r||createEmpty();return intersects$1(e,t)?(e[0]>t[0]?n[0]=e[0]:n[0]=t[0],e[1]>t[1]?n[1]=e[1]:n[1]=t[1],e[2]<t[2]?n[2]=e[2]:n[2]=t[2],e[3]<t[3]?n[3]=e[3]:n[3]=t[3]):createOrUpdateEmpty(n),n}function getDifference(e,t){if(!intersects$1(e,t))return[e.slice()];if(containsExtent(t,e))return[];const[r,n,i,o]=e,s=Math.max(r,t[0]),a=Math.max(n,t[1]),l=Math.min(i,t[2]),c=Math.min(o,t[3]),u=[];return s>r&&u.push([r,n,s,o]),l<i&&u.push([l,n,i,o]),a>n&&u.push([s,n,l,a]),c<o&&u.push([s,c,l,o]),u}function getTopLeft(e){return[e[0],e[3]]}function getTopRight(e){return[e[2],e[3]]}function getWidth(e){return e[2]-e[0]}function intersects$1(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function isEmpty(e){return e[2]<e[0]||e[3]<e[1]}function returnOrUpdate(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e}function intersectsSegment(e,t,r){let n=!1;const i=coordinateRelationship(e,t),o=coordinateRelationship(e,r);if(i===Relationship_default.INTERSECTING||o===Relationship_default.INTERSECTING)n=!0;else{const s=e[0],a=e[1],l=e[2],c=e[3],u=t[0],h=t[1],d=r[0],p=r[1],f=(p-h)/(d-u);let g,m;o&Relationship_default.ABOVE&&!(i&Relationship_default.ABOVE)&&(g=d-(p-c)/f,n=g>=s&&g<=l),n||!(o&Relationship_default.RIGHT)||i&Relationship_default.RIGHT||(m=p-(d-l)*f,n=m>=a&&m<=c),n||!(o&Relationship_default.BELOW)||i&Relationship_default.BELOW||(g=d-(p-a)/f,n=g>=s&&g<=l),n||!(o&Relationship_default.LEFT)||i&Relationship_default.LEFT||(m=p-(d-s)*f,n=m>=a&&m<=c)}return n}function applyTransform(e,t,r,n){if(isEmpty(e))return createOrUpdateEmpty(r);let i=[];if(n>1){const t=e[2]-e[0],r=e[3]-e[1];for(let o=0;o<n;++o)i.push(e[0]+t*o/n,e[1],e[2],e[1]+r*o/n,e[2]-t*o/n,e[3],e[0],e[3]-r*o/n)}else i=[e[0],e[1],e[2],e[1],e[2],e[3],e[0],e[3]];t(i,i,2);const o=[],s=[];for(let a=0,l=i.length;a<l;a+=2)o.push(i[a]),s.push(i[a+1]);return _boundingExtentXYs(o,s,r)}function wrapX$2(e,t){const r=t.getExtent(),n=getCenter(e);if(t.canWrapX()&&(n[0]<r[0]||n[0]>=r[2])){const t=getWidth(r),i=Math.floor((n[0]-r[0])/t)*t;e[0]-=i,e[2]-=i}return e}function wrapAndSliceX(e,t,r){if(t.canWrapX()){const n=t.getExtent();if(!isFinite(e[0])||!isFinite(e[2]))return[[n[0],e[1],n[2],e[3]]];wrapX$2(e,t);const i=getWidth(n);if(getWidth(e)>i&&!r)return[[n[0],e[1],n[2],e[3]]];if(e[0]<n[0])return[[e[0]+i,e[1],n[2],e[3]],[n[0],e[1],e[2],e[3]]];if(e[2]>n[2])return[[e[0],e[1],n[2],e[3]],[n[0],e[1],e[2]-i,e[3]]]}return[e]}function subtractExtents(e,t){let r=[e];for(let n=0,i=t.length;n<i&&r.length>0;++n){const e=[];for(let i=0,o=r.length;i<o;++i)e.push(...getDifference(r[i],t[n]));r=e}return r}function add$2(e,t){return e[0]+=+t[0],e[1]+=+t[1],e}function equals(e,t){let r=!0;for(let n=e.length-1;n>=0;--n)if(e[n]!=t[n]){r=!1;break}return r}function rotate$1(e,t){const r=Math.cos(t),n=Math.sin(t),i=e[0]*r-e[1]*n,o=e[1]*r+e[0]*n;return e[0]=i,e[1]=o,e}function scale$3(e,t){return e[0]*=t,e[1]*=t,e}function squaredDistance(e,t){const r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n}function distance(e,t){return Math.sqrt(squaredDistance(e,t))}function wrapX$1(e,t){if(t.canWrapX()){const r=getWidth(t.getExtent()),n=getWorldsAway(e,t,r);n&&(e[0]-=n*r)}return e}function getWorldsAway(e,t,r){const n=t.getExtent();let i=0;return t.canWrapX()&&(e[0]<n[0]||e[0]>n[2])&&(r=r||getWidth(n),i=Math.floor((e[0]-n[0])/r)),i}function angleBetween(e,t,r){const n=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=[(t[0]-e[0])/n,(t[1]-e[1])/n],o=[-i[1],i[0]],s=Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1])),a=[(r[0]-e[0])/s,(r[1]-e[1])/s];let l=0===n||0===s?0:Math.acos(clamp$1(a[0]*i[0]+a[1]*i[1],-1,1));return l=Math.max(l,1e-5),a[0]*o[0]+a[1]*o[1]>0?l:2*Math.PI-l}function easeIn(e){return Math.pow(e,3)}function easeOut(e){return 1-easeIn(1-e)}function inAndOut(e){return 3*e*e-2*e*e*e}function linear(e){return e}var DEFAULT_RADIUS=6371008.8;function getDistance(e,t,r){r=r||6371008.8;const n=toRadians(e[1]),i=toRadians(t[1]),o=(i-n)/2,s=toRadians(t[0]-e[0])/2,a=Math.sin(o)*Math.sin(o)+Math.sin(s)*Math.sin(s)*Math.cos(n)*Math.cos(i);return 2*r*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function offset(e,t,r,n){n=n||6371008.8;const i=toRadians(e[1]),o=toRadians(e[0]),s=t/n,a=Math.asin(Math.sin(i)*Math.cos(s)+Math.cos(i)*Math.sin(s)*Math.cos(r));return[toDegrees(o+Math.atan2(Math.sin(r)*Math.sin(s)*Math.cos(i),Math.cos(s)-Math.sin(i)*Math.sin(a))),toDegrees(a)]}var levels={info:1,warn:2,error:3,none:4},level=levels.info;function warn(...e){level>levels.warn||console.warn(...e)}var METERS_PER_UNIT$1={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},Projection=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=void 0!==e.extent?e.extent:null,this.worldExtent_=void 0!==e.worldExtent?e.worldExtent:null,this.axisOrientation_=void 0!==e.axisOrientation?e.axisOrientation:"enu",this.global_=void 0!==e.global&&e.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||METERS_PER_UNIT$1[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!(!e||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!(!this.global_||!e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},RADIUS$1=6378137,HALF_SIZE=Math.PI*RADIUS$1,EXTENT$2=[-HALF_SIZE,-HALF_SIZE,HALF_SIZE,HALF_SIZE],WORLD_EXTENT=[-180,-85,180,85],MAX_SAFE_Y=RADIUS$1*Math.log(Math.tan(Math.PI/2)),EPSG3857Projection=class extends Projection{constructor(e){super({code:e,units:"m",extent:EXTENT$2,global:!0,worldExtent:WORLD_EXTENT,getPointResolution:function(e,t){return e/Math.cosh(t[1]/RADIUS$1)}})}},PROJECTIONS$1=[new EPSG3857Projection("EPSG:3857"),new EPSG3857Projection("EPSG:102100"),new EPSG3857Projection("EPSG:102113"),new EPSG3857Projection("EPSG:900913"),new EPSG3857Projection("http://www.opengis.net/def/crs/EPSG/0/3857"),new EPSG3857Projection("http://www.opengis.net/gml/srs/epsg.xml#3857")];function fromEPSG4326(e,t,r,n){const i=e.length;r=r>1?r:2,n=n??r,void 0===t&&(t=r>2?e.slice():new Array(i));for(let o=0;o<i;o+=n){t[o]=HALF_SIZE*e[o]/180;let r=RADIUS$1*Math.log(Math.tan(Math.PI*(+e[o+1]+90)/360));r>MAX_SAFE_Y?r=MAX_SAFE_Y:r<-MAX_SAFE_Y&&(r=-MAX_SAFE_Y),t[o+1]=r}return t}function toEPSG4326(e,t,r,n){const i=e.length;r=r>1?r:2,n=n??r,void 0===t&&(t=r>2?e.slice():new Array(i));for(let o=0;o<i;o+=n)t[o]=180*e[o]/HALF_SIZE,t[o+1]=360*Math.atan(Math.exp(e[o+1]/RADIUS$1))/Math.PI-90;return t}var RADIUS=6378137,EXTENT$1=[-180,-90,180,90],METERS_PER_UNIT=Math.PI*RADIUS/180,EPSG4326Projection=class extends Projection{constructor(e,t){super({code:e,units:"degrees",extent:EXTENT$1,axisOrientation:t,global:!0,metersPerUnit:METERS_PER_UNIT,worldExtent:EXTENT$1})}},PROJECTIONS=[new EPSG4326Projection("CRS:84"),new EPSG4326Projection("EPSG:4326","neu"),new EPSG4326Projection("urn:ogc:def:crs:OGC:1.3:CRS84"),new EPSG4326Projection("urn:ogc:def:crs:OGC:2:84"),new EPSG4326Projection("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new EPSG4326Projection("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new EPSG4326Projection("http://www.opengis.net/def/crs/EPSG/0/4326","neu")],cache$1={};function get$4(e){return cache$1[e]||cache$1[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function add$1(e,t){cache$1[e]=t}var transforms={};function add(e,t,r){const n=e.getCode(),i=t.getCode();n in transforms||(transforms[n]={}),transforms[n][i]=r}function get$3(e,t){return e in transforms&&t in transforms[e]?transforms[e][t]:null}var K0=.9996,E=.00669438,E2$1=E*E,E3=E2$1*E,E_P2=E/.99330562,SQRT_E=Math.sqrt(.99330562),_E=(1-SQRT_E)/(1+SQRT_E),_E2=_E*_E,_E3=_E2*_E,_E4=_E3*_E,_E5=_E4*_E,M1=1-E/4-3*E2$1/64-5*E3/256,M2=.002514607064228144,M3=26390466021299826e-22,M4=35*E3/3072,P2=1.5*_E-27/32*_E3+269/512*_E5,P3=21/16*_E2-55/32*_E4,P4=151/96*_E3-417/128*_E5,P5=1097/512*_E4,R=6378137;function toLonLat$1(e,t,r){const n=e-5e5,i=(r.north?t:t-1e7)/K0/(R*M1),o=i+P2*Math.sin(2*i)+P3*Math.sin(4*i)+P4*Math.sin(6*i)+P5*Math.sin(8*i),s=Math.sin(o),a=s*s,l=Math.cos(o),c=s/l,u=c*c,h=u*u,d=1-E*a,p=Math.sqrt(1-E*a),f=E_P2*l**2,g=f*f,m=n/(R/p*K0),y=m*m,v=y*m,_=v*m,b=_*m,w=o-c/(.99330562/d)*(y/2-_/24*(5+3*u+10*f-4*g-9*E_P2))+b*m/720*(61+90*u+298*f+45*h-252*E_P2-3*g);let C=(m-v/6*(1+2*u+f)+b/120*(5-2*f+28*u-3*g+8*E_P2+24*h))/l;return C=wrap(C+toRadians(zoneToCentralLongitude(r.number)),-Math.PI,Math.PI),[toDegrees(C),toDegrees(w)]}var MIN_LATITUDE=-80,MAX_LATITUDE=84,MIN_LONGITUDE=-180,MAX_LONGITUDE=180;function fromLonLat$1(e,t,r){e=wrap(e,MIN_LONGITUDE,MAX_LONGITUDE),t<MIN_LATITUDE?t=MIN_LATITUDE:t>MAX_LATITUDE&&(t=MAX_LATITUDE);const n=toRadians(t),i=Math.sin(n),o=Math.cos(n),s=i/o,a=s*s,l=a*a,c=toRadians(e),u=toRadians(zoneToCentralLongitude(r.number)),h=R/Math.sqrt(1-E*i**2),d=E_P2*o**2,p=o*wrap(c-u,-Math.PI,Math.PI),f=p*p,g=f*p,m=g*p,y=m*p,v=y*p,_=R*(M1*n-M2*Math.sin(2*n)+M3*Math.sin(4*n)-M4*Math.sin(6*n)),b=K0*h*(p+g/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*E_P2))+5e5;let w=K0*(_+h*s*(f/2+m/24*(5-a+9*d+4*d**2)+v/720*(61-58*a+l+600*d-330*E_P2)));return r.north||(w+=1e7),[b,w]}function zoneToCentralLongitude(e){return 6*(e-1)-180+3}var epsgRegExes=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function zoneFromCode(e){let t=0;for(const i of epsgRegExes){const r=e.match(i);if(r){t=parseInt(r[1]);break}}if(!t)return null;let r=0,n=!1;return t>32700&&t<32761?r=t-32700:t>32600&&t<32661&&(n=!0,r=t-32600),r?{number:r,north:n}:null}function makeTransformFunction(e,t){return function(r,n,i,o){const s=r.length;i=i>1?i:2,o=o??i,n||(n=i>2?r.slice():new Array(s));for(let a=0;a<s;a+=o){const i=r[a],o=r[a+1],s=e(i,o,t);n[a]=s[0],n[a+1]=s[1]}return n}}function makeProjection(e){return zoneFromCode(e)?new Projection({code:e,units:"m"}):null}function makeTransforms(e){const t=zoneFromCode(e.getCode());return t?{forward:makeTransformFunction(fromLonLat$1,t),inverse:makeTransformFunction(toLonLat$1,t)}:null}var transformFactories=[makeTransforms],projectionFactories=[makeProjection],showCoordinateWarning=!0;function disableCoordinateWarning(e){showCoordinateWarning=!(void 0===e||e)}function cloneTransform(e,t){if(void 0!==t)for(let r=0,n=e.length;r<n;++r)t[r]=e[r];else t=e.slice();return t}function identityTransform(e,t){if(void 0!==t&&e!==t){for(let r=0,n=e.length;r<n;++r)t[r]=e[r];e=t}return e}function addProjection(e){add$1(e.getCode(),e),add(e,e,cloneTransform)}function addProjections(e){e.forEach(addProjection)}function get$2(e){if("string"!=typeof e)return e;const t=get$4(e);if(t)return t;for(const r of projectionFactories){const t=r(e);if(t)return t}return null}function getPointResolution(e,t,r,n){let i;const o=(e=get$2(e)).getPointResolutionFunc();if(o){if(i=o(t,r),n&&n!==e.getUnits()){const t=e.getMetersPerUnit();t&&(i=i*t/METERS_PER_UNIT$1[n])}}else{const o=e.getUnits();if("degrees"==o&&!n||"degrees"==n)i=t;else{const s=getTransformFromProjections(e,get$2("EPSG:4326"));if(s||"degrees"===o){let e=[r[0]-t/2,r[1],r[0]+t/2,r[1],r[0],r[1]-t/2,r[0],r[1]+t/2];e=s(e,e,2),i=(getDistance(e.slice(0,2),e.slice(2,4))+getDistance(e.slice(4,6),e.slice(6,8)))/2}else i=t*e.getMetersPerUnit();const a=n?METERS_PER_UNIT$1[n]:e.getMetersPerUnit();void 0!==a&&(i/=a)}}return i}function addEquivalentProjections(e){addProjections(e),e.forEach(function(t){e.forEach(function(e){t!==e&&add(t,e,cloneTransform)})})}function addEquivalentTransforms(e,t,r,n){e.forEach(function(e){t.forEach(function(t){add(e,t,r),add(t,e,n)})})}function createProjection(e,t){return e?"string"==typeof e?get$2(e):e:get$2(t)}function createTransformFromCoordinateTransform(e){return function(t,r,n,i){const o=t.length;n=void 0!==n?n:2,i=i??n,r=void 0!==r?r:new Array(o);for(let s=0;s<o;s+=i){const o=e(t.slice(s,s+n)),a=o.length;for(let e=0,n=i;e<n;++e)r[s+e]=e>=a?t[s+e]:o[e]}return r}}function fromLonLat(e,t){return disableCoordinateWarning(),transform(e,"EPSG:4326",void 0!==t?t:"EPSG:3857")}function toLonLat(e,t){const r=transform(e,void 0!==t?t:"EPSG:3857","EPSG:4326"),n=r[0];return(n<-180||n>180)&&(r[0]=modulo(n+180,360)-180),r}function equivalent$1(e,t){if(e===t)return!0;const r=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||getTransformFromProjections(e,t)===cloneTransform)&&r}function getTransformFromProjections(e,t){const r=e.getCode(),n=t.getCode();let i=get$3(r,n);if(i)return i;let o=null,s=null;for(const l of transformFactories)o||(o=l(e)),s||(s=l(t));if(!o&&!s)return null;const a="EPSG:4326";if(s)if(o)i=composeTransformFuncs(o.inverse,s.forward);else{const e=get$3(r,a);e&&(i=composeTransformFuncs(e,s.forward))}else{const e=get$3(a,n);e&&(i=composeTransformFuncs(o.inverse,e))}return i&&(addProjection(e),addProjection(t),add(e,t,i)),i}function composeTransformFuncs(e,t){return function(r,n,i,o){return n=e(r,n,i,o),t(n,n,i,o)}}function getTransform(e,t){return getTransformFromProjections(get$2(e),get$2(t))}function transform(e,t,r){const n=getTransform(t,r);if(!n){const e=get$2(t).getCode(),n=get$2(r).getCode();throw new Error(`No transform available between ${e} and ${n}`)}return n(e,void 0,e.length)}function transformExtent(e,t,r,n){return applyTransform(e,getTransform(t,r),void 0,n)}var userProjection=null;function getUserProjection(){return userProjection}function toUserCoordinate(e,t){return userProjection?transform(e,t,userProjection):e}function fromUserCoordinate(e,t){return userProjection?transform(e,userProjection,t):(showCoordinateWarning&&!equals(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(showCoordinateWarning=!1,warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),e)}function toUserExtent(e,t){return userProjection?transformExtent(e,t,userProjection):e}function fromUserExtent(e,t){return userProjection?transformExtent(e,userProjection,t):e}function toUserResolution(e,t){if(!userProjection)return e;const r=get$2(t).getMetersPerUnit(),n=userProjection.getMetersPerUnit();return r&&n?e*r/n:e}function addCommon(){addEquivalentProjections(PROJECTIONS$1),addEquivalentProjections(PROJECTIONS),addEquivalentTransforms(PROJECTIONS,PROJECTIONS$1,fromEPSG4326,toEPSG4326)}addCommon();var IDENTITY_TRANSFORM=[1,0,0,1,0,0],tmp_=new Array(6);function create(){return IDENTITY_TRANSFORM.slice(0)}function reset(e){return set(e,1,0,0,1,0,0)}function multiply(e,t){const r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=t[0],c=t[1],u=t[2],h=t[3],d=t[4],p=t[5];return e[0]=r*l+i*c,e[1]=n*l+o*c,e[2]=r*u+i*h,e[3]=n*u+o*h,e[4]=r*d+i*p+s,e[5]=n*d+o*p+a,e}function set(e,t,r,n,i,o,s){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=o,e[5]=s,e}function setFromArray(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function apply$1(e,t){const r=t[0],n=t[1];return t[0]=e[0]*r+e[2]*n+e[4],t[1]=e[1]*r+e[3]*n+e[5],t}function scale$2(e,t,r){return multiply(e,set(tmp_,t,0,0,r,0,0))}function translate$1(e,t,r){return multiply(e,set(tmp_,1,0,0,1,t,r))}function compose(e,t,r,n,i,o,s,a){const l=Math.sin(o),c=Math.cos(o);return e[0]=n*c,e[1]=i*l,e[2]=-n*l,e[3]=i*c,e[4]=s*n*c-a*n*l+t,e[5]=s*i*l+a*i*c+r,e}function makeInverse(e,t){const r=determinant(t);assert$1(0!==r,"Transformation matrix cannot be inverted");const n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],l=t[5];return e[0]=s/r,e[1]=-i/r,e[2]=-o/r,e[3]=n/r,e[4]=(o*l-s*a)/r,e[5]=-(n*l-i*a)/r,e}function determinant(e){return e[0]*e[3]-e[1]*e[2]}var matrixPrecision=[1e5,1e5,1e5,1e5,2,2];function toString$1(e){return"matrix("+e.join(", ")+")"}function fromString$1(e){return e.substring(7,e.length-1).split(",").map(parseFloat)}function equivalent(e,t){const r=fromString$1(e),n=fromString$1(t);for(let i=0;i<6;++i)if(0!==Math.round((r[i]-n[i])*matrixPrecision[i]))return!1;return!0}function transform2D(e,t,r,n,i,o,s){o=o||[],s=s||2;let a=0;for(let l=t;l<r;l+=n){const t=e[l],r=e[l+1];o[a++]=i[0]*t+i[2]*r+i[4],o[a++]=i[1]*t+i[3]*r+i[5];for(let n=2;n<s;n++)o[a++]=e[l+n]}return o&&o.length!=a&&(o.length=a),o}function rotate(e,t,r,n,i,o,s){s=s||[];const a=Math.cos(i),l=Math.sin(i),c=o[0],u=o[1];let h=0;for(let d=t;d<r;d+=n){const t=e[d]-c,r=e[d+1]-u;s[h++]=c+t*a-r*l,s[h++]=u+t*l+r*a;for(let i=d+2;i<d+n;++i)s[h++]=e[i]}return s&&s.length!=h&&(s.length=h),s}function scale$1(e,t,r,n,i,o,s,a){a=a||[];const l=s[0],c=s[1];let u=0;for(let h=t;h<r;h+=n){const t=e[h]-l,r=e[h+1]-c;a[u++]=l+i*t,a[u++]=c+o*r;for(let i=h+2;i<h+n;++i)a[u++]=e[i]}return a&&a.length!=u&&(a.length=u),a}function translate(e,t,r,n,i,o,s){s=s||[];let a=0;for(let l=t;l<r;l+=n){s[a++]=e[l]+i,s[a++]=e[l+1]+o;for(let t=l+2;t<l+n;++t)s[a++]=e[t]}return s&&s.length!=a&&(s.length=a),s}var tmpTransform$1=create(),tmpPoint=[NaN,NaN],Geometry=class extends BaseObject{constructor(){super(),this.extent_=createEmpty(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=memoizeOne((e,t,r)=>{if(!r)return this.getSimplifiedGeometry(t);const n=this.clone();return n.applyTransform(r),n.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return abstract()}closestPointXY(e,t,r,n){return abstract()}containsXY(e,t){return 0===this.closestPointXY(e,t,tmpPoint,Number.MIN_VALUE)}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return abstract()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&createOrUpdateEmpty(e),this.extentRevision_=this.getRevision()}return returnOrUpdate(this.extent_,e)}rotate(e,t){abstract()}scale(e,t,r){abstract()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return abstract()}getType(){return abstract()}applyTransform(e){abstract()}intersectsExtent(e){return abstract()}translate(e,t){abstract()}transform(e,t){const r=get$2(e),n="tile-pixels"==r.getUnits()?function(e,n,i){const o=r.getExtent(),s=r.getWorldExtent(),a=getHeight(s)/getHeight(o);compose(tmpTransform$1,s[0],s[3],a,-a,0,0,0);const l=transform2D(e,0,e.length,i,tmpTransform$1,n),c=getTransform(r,t);return c?c(l,l,i):l}:getTransform(r,t);return this.applyTransform(n),this}},SimpleGeometry=class extends Geometry{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return createOrUpdateFromFlatCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return abstract()}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(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=getStrideForLayout(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){abstract()}setLayout(e,t,r){let n;if(e)n=getStrideForLayout(e);else{for(let e=0;e<r;++e){if(0===t.length)return this.layout="XY",void(this.stride=2);t=t[0]}n=t.length,e=getLayoutForStride(n)}this.layout=e,this.stride=n}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){const r=this.getFlatCoordinates();if(r){const n=this.getStride();rotate(r,0,r.length,n,e,t,r),this.changed()}}scale(e,t,r){void 0===t&&(t=e),r||(r=getCenter(this.getExtent()));const n=this.getFlatCoordinates();if(n){const i=this.getStride();scale$1(n,0,n.length,i,e,t,r,n),this.changed()}}translate(e,t){const r=this.getFlatCoordinates();if(r){const n=this.getStride();translate(r,0,r.length,n,e,t,r),this.changed()}}};function getLayoutForStride(e){let t;return 2==e?t="XY":3==e?t="XYZ":4==e&&(t="XYZM"),t}function getStrideForLayout(e){let t;return"XY"==e?t=2:"XYZ"==e||"XYM"==e?t=3:"XYZM"==e&&(t=4),t}function transformGeom2D(e,t,r){const n=e.getFlatCoordinates();if(!n)return null;const i=e.getStride();return transform2D(n,0,n.length,i,t,r)}function linearRing(e,t,r,n){let i=0;const o=e[r-n],s=e[r-n+1];let a=0,l=0;for(;t<r;t+=n){const r=e[t]-o,n=e[t+1]-s;i+=l*r-a*n,a=r,l=n}return i/2}function linearRings(e,t,r,n){let i=0;for(let o=0,s=r.length;o<s;++o){const s=r[o];i+=linearRing(e,t,s,n),t=s}return i}function linearRingss$1(e,t,r,n){let i=0;for(let o=0,s=r.length;o<s;++o){const s=r[o];i+=linearRings(e,t,s,n),t=s[s.length-1]}return i}function assignClosest(e,t,r,n,i,o,s){const a=e[t],l=e[t+1],c=e[r]-a,u=e[r+1]-l;let h;if(0===c&&0===u)h=t;else{const d=((i-a)*c+(o-l)*u)/(c*c+u*u);if(d>1)h=r;else{if(d>0){for(let i=0;i<n;++i)s[i]=lerp(e[t+i],e[r+i],d);return void(s.length=n)}h=t}}for(let d=0;d<n;++d)s[d]=e[h+d];s.length=n}function maxSquaredDelta(e,t,r,n,i){let o=e[t],s=e[t+1];for(t+=n;t<r;t+=n){const r=e[t],n=e[t+1],a=squaredDistance$1(o,s,r,n);a>i&&(i=a),o=r,s=n}return i}function arrayMaxSquaredDelta(e,t,r,n,i){for(let o=0,s=r.length;o<s;++o){const s=r[o];i=maxSquaredDelta(e,t,s,n,i),t=s}return i}function multiArrayMaxSquaredDelta(e,t,r,n,i){for(let o=0,s=r.length;o<s;++o){const s=r[o];i=arrayMaxSquaredDelta(e,t,s,n,i),t=s[s.length-1]}return i}function assignClosestPoint(e,t,r,n,i,o,s,a,l,c,u){if(t==r)return c;let h,d;if(0===i){if(d=squaredDistance$1(s,a,e[t],e[t+1]),d<c){for(h=0;h<n;++h)l[h]=e[t+h];return l.length=n,d}return c}u=u||[NaN,NaN];let p=t+n;for(;p<r;)if(assignClosest(e,p-n,p,n,s,a,u),d=squaredDistance$1(s,a,u[0],u[1]),d<c){for(c=d,h=0;h<n;++h)l[h]=u[h];l.length=n,p+=n}else p+=n*Math.max((Math.sqrt(d)-Math.sqrt(c))/i|0,1);if(o&&(assignClosest(e,r-n,t,n,s,a,u),d=squaredDistance$1(s,a,u[0],u[1]),d<c)){for(c=d,h=0;h<n;++h)l[h]=u[h];l.length=n}return c}function assignClosestArrayPoint(e,t,r,n,i,o,s,a,l,c,u){u=u||[NaN,NaN];for(let h=0,d=r.length;h<d;++h){const d=r[h];c=assignClosestPoint(e,t,d,n,i,o,s,a,l,c,u),t=d}return c}function assignClosestMultiArrayPoint(e,t,r,n,i,o,s,a,l,c,u){u=u||[NaN,NaN];for(let h=0,d=r.length;h<d;++h){const d=r[h];c=assignClosestArrayPoint(e,t,d,n,i,o,s,a,l,c,u),t=d[d.length-1]}return c}function deflateCoordinate(e,t,r){for(let n=0,i=r.length;n<i;++n)e[t++]=r[n];return t}function deflateCoordinates(e,t,r,n){for(let i=0,o=r.length;i<o;++i){const o=r[i];for(let r=0;r<n;++r)e[t++]=o[r]}return t}function deflateCoordinatesArray(e,t,r,n,i){i=i||[];let o=0;for(let s=0,a=r.length;s<a;++s){const a=deflateCoordinates(e,t,r[s],n);i[o++]=a,t=a}return i.length=o,i}function deflateMultiCoordinatesArray(e,t,r,n,i){i=i||[];let o=0;for(let s=0,a=r.length;s<a;++s){const a=deflateCoordinatesArray(e,t,r[s],n,i[o]);0===a.length&&(a[0]=t),i[o++]=a,t=a[a.length-1]}return i.length=o,i}function inflateCoordinates(e,t,r,n,i){i=void 0!==i?i:[];let o=0;for(let s=t;s<r;s+=n)i[o++]=e.slice(s,s+n);return i.length=o,i}function inflateCoordinatesArray(e,t,r,n,i){i=void 0!==i?i:[];let o=0;for(let s=0,a=r.length;s<a;++s){const a=r[s];i[o++]=inflateCoordinates(e,t,a,n,i[o]),t=a}return i.length=o,i}function inflateMultiCoordinatesArray(e,t,r,n,i){i=void 0!==i?i:[];let o=0;for(let s=0,a=r.length;s<a;++s){const a=r[s];i[o++]=1===a.length&&a[0]===t?[]:inflateCoordinatesArray(e,t,a,n,i[o]),t=a[a.length-1]}return i.length=o,i}function linearRingContainsExtent(e,t,r,n,i){return!forEachCorner(i,function(i){return!linearRingContainsXY(e,t,r,n,i[0],i[1])})}function linearRingContainsXY(e,t,r,n,i,o){let s=0,a=e[r-n],l=e[r-n+1];for(;t<r;t+=n){const r=e[t],n=e[t+1];l<=o?n>o&&(r-a)*(o-l)-(i-a)*(n-l)>0&&s++:n<=o&&(r-a)*(o-l)-(i-a)*(n-l)<0&&s--,a=r,l=n}return 0!==s}function linearRingsContainsXY(e,t,r,n,i,o){if(0===r.length)return!1;if(!linearRingContainsXY(e,t,r[0],n,i,o))return!1;for(let s=1,a=r.length;s<a;++s)if(linearRingContainsXY(e,r[s-1],r[s],n,i,o))return!1;return!0}function linearRingssContainsXY(e,t,r,n,i,o){if(0===r.length)return!1;for(let s=0,a=r.length;s<a;++s){const a=r[s];if(linearRingsContainsXY(e,t,a,n,i,o))return!0;t=a[a.length-1]}return!1}function forEach(e,t,r,n,i){let o;for(t+=n;t<r;t+=n)if(o=i(e.slice(t-n,t),e.slice(t,t+n)),o)return o;return!1}function intersectsLineString(e,t,r,n,i,o){return o=o??extendFlatCoordinates(createEmpty(),e,t,r,n),!!intersects$1(i,o)&&(o[0]>=i[0]&&o[2]<=i[2]||o[1]>=i[1]&&o[3]<=i[3]||forEach(e,t,r,n,function(e,t){return intersectsSegment(i,e,t)}))}function intersectsLineStringArray(e,t,r,n,i){for(let o=0,s=r.length;o<s;++o){if(intersectsLineString(e,t,r[o],n,i))return!0;t=r[o]}return!1}function intersectsLinearRing(e,t,r,n,i){return!!(intersectsLineString(e,t,r,n,i)||linearRingContainsXY(e,t,r,n,i[0],i[1])||linearRingContainsXY(e,t,r,n,i[0],i[3])||linearRingContainsXY(e,t,r,n,i[2],i[1])||linearRingContainsXY(e,t,r,n,i[2],i[3]))}function intersectsLinearRingArray(e,t,r,n,i){if(!intersectsLinearRing(e,t,r[0],n,i))return!1;if(1===r.length)return!0;for(let o=1,s=r.length;o<s;++o)if(linearRingContainsExtent(e,r[o-1],r[o],n,i)&&!intersectsLineString(e,r[o-1],r[o],n,i))return!1;return!0}function intersectsLinearRingMultiArray(e,t,r,n,i){for(let o=0,s=r.length;o<s;++o){const s=r[o];if(intersectsLinearRingArray(e,t,s,n,i))return!0;t=s[s.length-1]}return!1}function douglasPeucker(e,t,r,n,i,o,s){const a=(r-t)/n;if(a<3){for(;t<r;t+=n)o[s++]=e[t],o[s++]=e[t+1];return s}const l=new Array(a);l[0]=1,l[a-1]=1;const c=[t,r-n];let u=0;for(;c.length>0;){const r=c.pop(),o=c.pop();let s=0;const a=e[o],h=e[o+1],d=e[r],p=e[r+1];for(let t=o+n;t<r;t+=n){const r=squaredSegmentDistance(e[t],e[t+1],a,h,d,p);r>s&&(u=t,s=r)}s>i&&(l[(u-t)/n]=1,o+n<u&&c.push(o,u),u+n<r&&c.push(u,r))}for(let h=0;h<a;++h)l[h]&&(o[s++]=e[t+h*n],o[s++]=e[t+h*n+1]);return s}function douglasPeuckerArray(e,t,r,n,i,o,s,a){for(let l=0,c=r.length;l<c;++l){const c=r[l];s=douglasPeucker(e,t,c,n,i,o,s),a.push(s),t=c}return s}function snap(e,t){return t*Math.round(e/t)}function quantize(e,t,r,n,i,o,s){if(t==r)return s;let a,l,c=snap(e[t],i),u=snap(e[t+1],i);t+=n,o[s++]=c,o[s++]=u;do{if(a=snap(e[t],i),l=snap(e[t+1],i),(t+=n)==r)return o[s++]=a,o[s++]=l,s}while(a==c&&l==u);for(;t<r;){const r=snap(e[t],i),h=snap(e[t+1],i);if(t+=n,r==a&&h==l)continue;const d=a-c,p=l-u,f=r-c,g=h-u;d*g==p*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(p<0&&g<p||p==g||p>0&&g>p)?(a=r,l=h):(o[s++]=a,o[s++]=l,c=a,u=l,a=r,l=h)}return o[s++]=a,o[s++]=l,s}function quantizeArray(e,t,r,n,i,o,s,a){for(let l=0,c=r.length;l<c;++l){const c=r[l];s=quantize(e,t,c,n,i,o,s),a.push(s),t=c}return s}function quantizeMultiArray(e,t,r,n,i,o,s,a){for(let l=0,c=r.length;l<c;++l){const c=r[l],u=[];s=quantizeArray(e,t,c,n,i,o,s,u),a.push(u),t=c[c.length-1]}return s}var LinearRing=class e extends SimpleGeometry{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===t||Array.isArray(e[0])?this.setCoordinates(e,t):this.setFlatCoordinates(t,e)}clone(){return new e(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,r,n){return n<closestSquaredDistanceXY(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(maxSquaredDelta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),assignClosestPoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,r,n))}getArea(){return linearRing(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return inflateCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const r=[];return r.length=douglasPeucker(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r,0),new e(r,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return intersectsLineString(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=deflateCoordinates(this.flatCoordinates,0,e,this.stride),this.changed()}},Point=class e extends SimpleGeometry{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){const t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,r,n){const i=this.flatCoordinates,o=squaredDistance$1(e,t,i[0],i[1]);if(o<n){const e=this.stride;for(let t=0;t<e;++t)r[t]=i[t];return r.length=e,o}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return createOrUpdateFromCoordinate(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return containsXY(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=deflateCoordinate(this.flatCoordinates,0,e,this.stride),this.changed()}};function getInteriorPointOfArray(e,t,r,n,i,o,s){let a,l,c,u,h,d,p;const f=i[o+1],g=[];for(let v=0,_=r.length;v<_;++v){const i=r[v];for(u=e[i-n],d=e[i-n+1],a=t;a<i;a+=n)h=e[a],p=e[a+1],(f<=d&&p<=f||d<=f&&f<=p)&&(c=(f-d)/(p-d)*(h-u)+u,g.push(c)),u=h,d=p}let m=NaN,y=-1/0;for(g.sort(ascending),u=g[0],a=1,l=g.length;a<l;++a){h=g[a];const i=Math.abs(h-u);i>y&&(c=(u+h)/2,linearRingsContainsXY(e,t,r,n,c,f)&&(m=c,y=i)),u=h}return isNaN(m)&&(m=i[o]),s?(s.push(m,f,y),s):[m,f,y]}function getInteriorPointsOfMultiArray(e,t,r,n,i){let o=[];for(let s=0,a=r.length;s<a;++s){const a=r[s];o=getInteriorPointOfArray(e,t,a,n,i,2*s,o),t=a[a.length-1]}return o}function coordinates(e,t,r,n){for(;t<r-n;){for(let i=0;i<n;++i){const o=e[t+i];e[t+i]=e[r-n+i],e[r-n+i]=o}t+=n,r-=n}}function linearRingIsClockwise(e,t,r,n){let i=0,o=e[r-n],s=e[r-n+1];for(;t<r;t+=n){const r=e[t],n=e[t+1];i+=(r-o)*(n+s),o=r,s=n}return 0===i?void 0:i>0}function linearRingsAreOriented(e,t,r,n,i){i=void 0!==i&&i;for(let o=0,s=r.length;o<s;++o){const s=r[o],a=linearRingIsClockwise(e,t,s,n);if(0===o){if(i&&a||!i&&!a)return!1}else if(i&&!a||!i&&a)return!1;t=s}return!0}function linearRingssAreOriented(e,t,r,n,i){for(let o=0,s=r.length;o<s;++o){const s=r[o];if(!linearRingsAreOriented(e,t,s,n,i))return!1;s.length&&(t=s[s.length-1])}return!0}function orientLinearRings(e,t,r,n,i){i=void 0!==i&&i;for(let o=0,s=r.length;o<s;++o){const s=r[o],a=linearRingIsClockwise(e,t,s,n);(0===o?i&&a||!i&&!a:i&&!a||!i&&a)&&coordinates(e,t,s,n),t=s}return t}function orientLinearRingsArray(e,t,r,n,i){for(let o=0,s=r.length;o<s;++o)t=orientLinearRings(e,t,r[o],n,i);return t}function inflateEnds(e,t){const r=[];let n,i=0,o=0;for(let s=0,a=t.length;s<a;++s){const a=t[s],l=linearRingIsClockwise(e,i,a,2);if(void 0===n&&(n=l),l===n)r.push(t.slice(o,s+1));else{if(0===r.length)continue;r[r.length-1].push(t[o])}o=s+1,i=a}return r}var Polygon=class e extends SimpleGeometry{constructor(e,t,r){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==t&&r?(this.setFlatCoordinates(t,e),this.ends_=r):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?extend$2(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,r,n){return n<closestSquaredDistanceXY(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(arrayMaxSquaredDelta(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),assignClosestArrayPoint(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,r,n))}containsXY(e,t){return linearRingsContainsXY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return void 0!==e?(t=this.getOrientedFlatCoordinates().slice(),orientLinearRings(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,inflateCoordinatesArray(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const e=getCenter(this.getExtent());this.flatInteriorPoint_=getInteriorPointOfArray(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Point(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new LinearRing(this.flatCoordinates.slice(0===e?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){const e=this.layout,t=this.flatCoordinates,r=this.ends_,n=[];let i=0;for(let o=0,s=r.length;o<s;++o){const s=r[o],a=new LinearRing(t.slice(i,s),e);n.push(a),i=s}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;linearRingsAreOriented(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=orientLinearRings(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const r=[],n=[];return r.length=quantizeArray(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),r,0,n),new e(r,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return intersectsLinearRingArray(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const r=deflateCoordinatesArray(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=0===r.length?0:r[r.length-1],this.changed()}};function circular(e,t,r,n){r=r||32;const i=[];for(let o=0;o<r;++o)extend$2(i,offset(e,t,2*Math.PI*o/r,n));return i.push(i[0],i[1]),new Polygon(i,"XY",[i.length])}function fromExtent(e){if(isEmpty(e))throw new Error("Cannot create polygon from empty extent");const t=e[0],r=e[1],n=e[2],i=e[3],o=[t,r,t,i,n,i,n,r,t,r];return new Polygon(o,"XY",[o.length])}function getViewportClampedResolution(e,t,r,n){const i=getWidth(t)/r[0],o=getHeight(t)/r[1];return n?Math.min(e,Math.max(i,o)):Math.min(e,Math.min(i,o))}function getSmoothClampedResolution(e,t,r){let n=Math.min(e,t);return n*=Math.log(1+50*Math.max(0,e/t-1))/50+1,r&&(n=Math.max(n,r),n/=Math.log(1+50*Math.max(0,r/e-1))/50+1),clamp$1(n,r/2,2*t)}function createSnapToResolutions(e,t,r,n){return t=void 0===t||t,function(i,o,s,a){if(void 0!==i){const l=e[0],c=e[e.length-1],u=r?getViewportClampedResolution(l,r,s,n):l;if(a)return t?getSmoothClampedResolution(i,u,c):clamp$1(i,c,u);const h=Math.floor(linearFindNearest(e,Math.min(u,i),o));return e[h]>u&&h<e.length-1?e[h+1]:e[h]}}}function createSnapToPower(e,t,r,n,i,o){return n=void 0===n||n,r=void 0!==r?r:0,function(s,a,l,c){if(void 0!==s){const u=i?getViewportClampedResolution(t,i,l,o):t;if(c)return n?getSmoothClampedResolution(s,u,r):clamp$1(s,r,u);const h=Math.ceil(Math.log(t/u)/Math.log(e)-1e-9),d=.499999999*-a+.5,p=Math.floor(Math.log(t/Math.min(u,s))/Math.log(e)+d);return clamp$1(t/Math.pow(e,Math.max(h,p)),r,u)}}}function createMinMaxResolution(e,t,r,n,i){return r=void 0===r||r,function(o,s,a,l){if(void 0!==o){const s=n?getViewportClampedResolution(e,n,a,i):e;return r&&l?getSmoothClampedResolution(o,s,t):clamp$1(o,t,s)}}}function disable(e){if(void 0!==e)return 0}function none(e){if(void 0!==e)return e}function createSnapToN(e){const t=2*Math.PI/e;return function(e,r){return r?e:void 0!==e?e=Math.floor(e/t+.5)*t:void 0}}function createSnapToZero(e){const t=void 0===e?toRadians(5):e;return function(e,r){return r||void 0===e?e:Math.abs(e)<=t?0:e}}var DEFAULT_MIN_ZOOM=0,View=class extends BaseObject{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=createProjection(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&disableCoordinateWarning(),e.center&&(e.center=fromUserCoordinate(e.center,this.projection_)),e.extent&&(e.extent=fromUserExtent(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){const t=Object.assign({},e);for(const s in ViewProperty_default)delete t[s];this.setProperties(t,!0);const r=createResolutionConstraint(e);this.maxResolution_=r.maxResolution,this.minResolution_=r.minResolution,this.zoomFactor_=r.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=r.minZoom;const n=createCenterConstraint(e),i=r.constraint,o=createRotationConstraint(e);this.constraints_={center:n,resolution:i,rotation:o},this.setRotation(void 0!==e.rotation?e.rotation:0),this.setCenterInternal(void 0!==e.center?e.center:null),void 0!==e.resolution?this.setResolution(e.resolution):void 0!==e.zoom&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;const r=this.getCenterInternal();if(r){const n=e||[0,0,0,0];t=t||[0,0,0,0];const i=this.getResolution(),o=i/2*(n[3]-t[3]+t[1]-n[1]),s=i/2*(n[0]-t[0]+t[2]-n[2]);this.setCenterInternal([r[0]+o,r[1]-s])}}getUpdatedOptions_(e){const t=this.getProperties();return void 0!==t.resolution?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const t=new Array(arguments.length);for(let r=0;r<t.length;++r){let e=arguments[r];e.center&&(e=Object.assign({},e),e.center=fromUserCoordinate(e.center,this.getProjection())),e.anchor&&(e=Object.assign({},e),e.anchor=fromUserCoordinate(e.anchor,this.getProjection())),t[r]=e}this.animateInternal.apply(this,t)}animateInternal(e){let t,r=arguments.length;r>1&&"function"==typeof arguments[r-1]&&(t=arguments[r-1],--r);let n=0;for(;n<r&&!this.isDef();++n){const e=arguments[n];e.center&&this.setCenterInternal(e.center),void 0!==e.zoom?this.setZoom(e.zoom):e.resolution&&this.setResolution(e.resolution),void 0!==e.rotation&&this.setRotation(e.rotation)}if(n===r)return void(t&&animationCallback(t,!0));let i=Date.now(),o=this.targetCenter_.slice(),s=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<r;++n){const e=arguments[n],r={start:i,complete:!1,anchor:e.anchor,duration:void 0!==e.duration?e.duration:1e3,easing:e.easing||inAndOut,callback:t};if(e.center&&(r.sourceCenter=o,r.targetCenter=e.center.slice(),o=r.targetCenter),void 0!==e.zoom?(r.sourceResolution=s,r.targetResolution=this.getResolutionForZoom(e.zoom),s=r.targetResolution):e.resolution&&(r.sourceResolution=s,r.targetResolution=e.resolution,s=r.targetResolution),void 0!==e.rotation){r.sourceRotation=a;const t=modulo(e.rotation-a+Math.PI,2*Math.PI)-Math.PI;r.targetRotation=a+t,a=r.targetRotation}isNoopAnimation(r)?r.complete=!0:i+=r.duration,l.push(r)}this.animations_.push(l),this.setHint(ViewHint_default.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ViewHint_default.ANIMATING]>0}getInteracting(){return this.hints_[ViewHint_default.INTERACTING]>0}cancelAnimations(){let e;this.setHint(ViewHint_default.ANIMATING,-this.hints_[ViewHint_default.ANIMATING]);for(let t=0,r=this.animations_.length;t<r;++t){const r=this.animations_[t];if(r[0].callback&&animationCallback(r[0].callback,!1),!e)for(let t=0,n=r.length;t<n;++t){const n=r[t];if(!n.complete){e=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const e=Date.now();let t=!1;for(let r=this.animations_.length-1;r>=0;--r){const n=this.animations_[r];let i=!0;for(let r=0,o=n.length;r<o;++r){const o=n[r];if(o.complete)continue;const s=e-o.start;let a=o.duration>0?s/o.duration:1;a>=1?(o.complete=!0,a=1):i=!1;const l=o.easing(a);if(o.sourceCenter){const e=o.sourceCenter[0],t=o.sourceCenter[1],r=o.targetCenter[0],n=o.targetCenter[1];this.nextCenter_=o.targetCenter;const i=e+l*(r-e),s=t+l*(n-t);this.targetCenter_=[i,s]}if(o.sourceResolution&&o.targetResolution){const e=1===l?o.targetResolution:o.sourceResolution+l*(o.targetResolution-o.sourceResolution);if(o.anchor){const t=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(e,0,t,!0);this.targetCenter_=this.calculateCenterZoom(r,o.anchor)}this.nextResolution_=o.targetResolution,this.targetResolution_=e,this.applyTargetState_(!0)}if(void 0!==o.sourceRotation&&void 0!==o.targetRotation){const e=1===l?modulo(o.targetRotation+Math.PI,2*Math.PI)-Math.PI:o.sourceRotation+l*(o.targetRotation-o.sourceRotation);if(o.anchor){const t=this.constraints_.rotation(e,!0);this.targetCenter_=this.calculateCenterRotate(t,o.anchor)}this.nextRotation_=o.targetRotation,this.targetRotation_=e}if(this.applyTargetState_(!0),t=!0,!o.complete)break}if(i){this.animations_[r]=null,this.setHint(ViewHint_default.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const e=n[0].callback;e&&animationCallback(e,!0)}}this.animations_=this.animations_.filter(Boolean),t&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let r;const n=this.getCenterInternal();return void 0!==n&&(r=[n[0]-t[0],n[1]-t[1]],rotate$1(r,e-this.getRotation()),add$2(r,t)),r}calculateCenterZoom(e,t){let r;const n=this.getCenterInternal(),i=this.getResolution();return void 0!==n&&void 0!==i&&(r=[t[0]-e*(t[0]-n[0])/i,t[1]-e*(t[1]-n[1])/i]),r}getViewportSize_(e){const t=this.viewportSize_;if(e){const r=t[0],n=t[1];return[Math.abs(r*Math.cos(e))+Math.abs(n*Math.sin(e)),Math.abs(r*Math.sin(e))+Math.abs(n*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e?toUserCoordinate(e,this.getProjection()):e}getCenterInternal(){return this.get(ViewProperty_default.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return void 0!==e?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){return toUserExtent(this.calculateExtentInternal(e),this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();assert$1(t,"The view center is not defined");const r=this.getResolution();assert$1(void 0!==r,"The view resolution is not defined");const n=this.getRotation();return assert$1(void 0!==n,"The view rotation is not defined"),getForViewAndSize(t,r,n,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(ViewProperty_default.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(fromUserExtent(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const r=getWidth(e)/t[0],n=getHeight(e)/t[1];return Math.max(r,n)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,n=Math.log(t/r)/Math.log(e);return function(r){return t/Math.pow(e,r*n)}}getRotation(){return this.get(ViewProperty_default.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/t;return function(e){return Math.log(r/e)/t/i}}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const r=this.padding_;return r&&(t=[t[0]-r[1]-r[3],t[1]-r[0]-r[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),r=this.getRotation();let n=this.getCenterInternal();const i=this.padding_;if(i){const e=this.getViewportSizeMinusPadding_();n=calculateCenterOn(n,this.getViewportSize_(),[e[0]/2+i[3],e[1]/2+i[0]],t,r)}return{center:n.slice(0),projection:void 0!==e?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:r,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e;const t=this.getResolution();return void 0!==t&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t,r,n=this.minZoom_||0;if(this.resolutions_){const i=linearFindNearest(this.resolutions_,e,1);n=i,t=this.resolutions_[i],r=i==this.resolutions_.length-1?2:t/this.resolutions_[i+1]}else t=this.maxResolution_,r=this.zoomFactor_;return n+Math.log(t/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const t=clamp$1(Math.floor(e),0,this.resolutions_.length-2),r=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(r,clamp$1(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let r;if(assert$1(Array.isArray(e)||"function"==typeof e.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))assert$1(!isEmpty(e),"Cannot fit empty extent provided as `geometry`"),r=fromExtent(fromUserExtent(e,this.getProjection()));else if("Circle"===e.getType()){const t=fromUserExtent(e.getExtent(),this.getProjection());r=fromExtent(t),r.rotate(this.getRotation(),getCenter(t))}else{const t=getUserProjection();r=t?e.clone().transform(t,this.getProjection()):e}this.fitInternal(r,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),r=Math.cos(t),n=Math.sin(-t),i=e.getFlatCoordinates(),o=e.getStride();let s=1/0,a=1/0,l=-1/0,c=-1/0;for(let u=0,h=i.length;u<h;u+=o){const e=i[u]*r-i[u+1]*n,t=i[u]*n+i[u+1]*r;s=Math.min(s,e),a=Math.min(a,t),l=Math.max(l,e),c=Math.max(c,t)}return[s,a,l,c]}fitInternal(e,t){let r=(t=t||{}).size;r||(r=this.getViewportSizeMinusPadding_());const n=void 0!==t.padding?t.padding:[0,0,0,0],i=void 0!==t.nearest&&t.nearest;let o;o=void 0!==t.minResolution?t.minResolution:void 0!==t.maxZoom?this.getResolutionForZoom(t.maxZoom):0;const s=this.rotatedExtentForGeometry(e);let a=this.getResolutionForExtentInternal(s,[r[0]-n[1]-n[3],r[1]-n[0]-n[2]]);a=isNaN(a)?o:Math.max(a,o),a=this.getConstrainedResolution(a,i?0:1);const l=this.getRotation(),c=Math.sin(l),u=Math.cos(l),h=getCenter(s);h[0]+=(n[1]-n[3])/2*a,h[1]+=(n[0]-n[2])/2*a;const d=h[0]*u-h[1]*c,p=h[1]*u+h[0]*c,f=this.getConstrainedCenter([d,p],a),g=t.callback?t.callback:VOID;void 0!==t.duration?this.animateInternal({resolution:a,center:f,duration:t.duration,easing:t.easing},g):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),animationCallback(g,!0))}centerOn(e,t,r){this.centerOnInternal(fromUserCoordinate(e,this.getProjection()),t,r)}centerOnInternal(e,t,r){this.setCenterInternal(calculateCenterOn(e,t,r,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,r,n){let i;const o=this.padding_;if(o&&e){const s=this.getViewportSizeMinusPadding_(-r),a=calculateCenterOn(e,n,[s[0]/2+o[3],s[1]/2+o[0]],t,r);i=[e[0]-a[0],e[1]-a[1]]}return i}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(e){const t=toUserCoordinate(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){const t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&fromUserCoordinate(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){const r=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(this.targetResolution_*e,0,n,r);t&&(this.targetCenter_=this.calculateCenterZoom(i,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=fromUserCoordinate(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){const r=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+e,r);t&&(this.targetCenter_=this.calculateCenterRotate(n,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e?fromUserCoordinate(e,this.getProjection()):e)}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){const r=this.getAnimating()||this.getInteracting()||t,n=this.constraints_.rotation(this.targetRotation_,r),i=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,0,i,r),s=this.constraints_.center(this.targetCenter_,o,i,r,this.calculateCenterShift(this.targetCenter_,o,n,i));this.get(ViewProperty_default.ROTATION)!==n&&this.set(ViewProperty_default.ROTATION,n),this.get(ViewProperty_default.RESOLUTION)!==o&&(this.set(ViewProperty_default.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),s&&this.get(ViewProperty_default.CENTER)&&equals(this.get(ViewProperty_default.CENTER),s)||this.set(ViewProperty_default.CENTER,s),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,r){e=void 0!==e?e:200;const n=t||0,i=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(i),s=this.constraints_.resolution(this.targetResolution_,n,o),a=this.constraints_.center(this.targetCenter_,s,o,!1,this.calculateCenterShift(this.targetCenter_,s,i,o));if(0===e&&!this.cancelAnchor_)return this.targetResolution_=s,this.targetRotation_=i,this.targetCenter_=a,void this.applyTargetState_();r=r||(0===e?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===s&&this.getRotation()===i&&this.getCenterInternal()&&equals(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:i,center:a,resolution:s,duration:e,easing:easeOut,anchor:r}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ViewHint_default.INTERACTING,1)}endInteraction(e,t,r){r=r&&fromUserCoordinate(r,this.getProjection()),this.endInteractionInternal(e,t,r)}endInteractionInternal(e,t,r){this.getInteracting()&&(this.setHint(ViewHint_default.INTERACTING,-1),this.resolveConstraints(e,t,r))}getConstrainedCenter(e,t){const r=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),r)}getConstrainedZoom(e,t){const r=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(r,t))}getConstrainedResolution(e,t){t=t||0;const r=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,r)}};function animationCallback(e,t){setTimeout(function(){e(t)},0)}function createCenterConstraint(e){if(void 0!==e.extent){const t=void 0===e.smoothExtentConstraint||e.smoothExtentConstraint;return createExtent(e.extent,e.constrainOnlyCenter,t)}const t=createProjection(e.projection,"EPSG:3857");if(!0!==e.multiWorld&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,createExtent(e,!1,!1)}return none$1}function createResolutionConstraint(e){let t,r,n,i=void 0!==e.minZoom?e.minZoom:DEFAULT_MIN_ZOOM,o=void 0!==e.maxZoom?e.maxZoom:28;const s=void 0!==e.zoomFactor?e.zoomFactor:2,a=void 0!==e.multiWorld&&e.multiWorld,l=void 0===e.smoothResolutionConstraint||e.smoothResolutionConstraint,c=void 0!==e.showFullExtent&&e.showFullExtent,u=createProjection(e.projection,"EPSG:3857"),h=u.getExtent();let d=e.constrainOnlyCenter,p=e.extent;if(a||p||!u.isGlobal()||(d=!1,p=h),void 0!==e.resolutions){const s=e.resolutions;r=s[i],n=void 0!==s[o]?s[o]:s[s.length-1],t=e.constrainResolution?createSnapToResolutions(s,l,!d&&p,c):createMinMaxResolution(r,n,l,!d&&p,c)}else{const a=(h?Math.max(getWidth(h),getHeight(h)):360*METERS_PER_UNIT$1.degrees/u.getMetersPerUnit())/256/Math.pow(2,DEFAULT_MIN_ZOOM),f=a/Math.pow(2,28);r=e.maxResolution,void 0!==r?i=0:r=a/Math.pow(s,i),n=e.minResolution,void 0===n&&(n=void 0!==e.maxZoom?void 0!==e.maxResolution?r/Math.pow(s,o):a/Math.pow(s,o):f),o=i+Math.floor(Math.log(r/n)/Math.log(s)),n=r/Math.pow(s,o-i),t=e.constrainResolution?createSnapToPower(s,r,n,l,!d&&p,c):createMinMaxResolution(r,n,l,!d&&p,c)}return{constraint:t,maxResolution:r,minResolution:n,minZoom:i,zoomFactor:s}}function createRotationConstraint(e){if(void 0===e.enableRotation||e.enableRotation){const t=e.constrainRotation;return void 0===t||!0===t?createSnapToZero():!1===t?none:"number"==typeof t?createSnapToN(t):none}return disable}function isNoopAnimation(e){return!(e.sourceCenter&&e.targetCenter&&!equals(e.sourceCenter,e.targetCenter))&&e.sourceResolution===e.targetResolution&&e.sourceRotation===e.targetRotation}function calculateCenterOn(e,t,r,n,i){const o=Math.cos(-i);let s=Math.sin(-i),a=e[0]*o-e[1]*s,l=e[1]*o+e[0]*s;return a+=(t[0]/2-r[0])*n,l+=(r[1]-t[1]/2)*n,s=-s,[a*o-l*s,l*o+a*s]}var CLASS_HIDDEN="ol-hidden",CLASS_SELECTABLE="ol-selectable",CLASS_UNSELECTABLE="ol-unselectable",CLASS_CONTROL="ol-control",CLASS_COLLAPSED="ol-collapsed",fontRegEx=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z0-9]+?)\\s*$"].join(""),"i"),fontRegExMatchIndex=["style","variant","weight","size","lineHeight","family"],fontWeights$1={normal:400,bold:700},getFontParameters=function(e){const t=e.match(fontRegEx);if(!t)return null;const r={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,i=fontRegExMatchIndex.length;n<i;++n){const e=t[n+1];void 0!==e&&(r[fontRegExMatchIndex[n]]="string"==typeof e?e.trim():e)}return isNaN(Number(r.weight))&&r.weight in fontWeights$1&&(r.weight=fontWeights$1[r.weight]),r.families=r.family.split(/,\s?/).map(e=>e.trim().replace(/^['"]|['"]$/g,"")),r},sharedCanvasContext;function createCanvasContext2D(e,t,r,n){let i;return i=r&&r.length?r.shift():WORKER_OFFSCREEN_CANVAS?new class extends OffscreenCanvas{style={}}(e??300,t??150):document.createElement("canvas"),e&&(i.width=e),t&&(i.height=t),i.getContext("2d",n)}function getSharedCanvasContext2D(){return sharedCanvasContext||(sharedCanvasContext=createCanvasContext2D(1,1)),sharedCanvasContext}function releaseCanvas(e){const t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function outerWidth(e){let t=e.offsetWidth;const r=getComputedStyle(e);return t+=parseInt(r.marginLeft,10)+parseInt(r.marginRight,10),t}function outerHeight(e){let t=e.offsetHeight;const r=getComputedStyle(e);return t+=parseInt(r.marginTop,10)+parseInt(r.marginBottom,10),t}function replaceNode(e,t){const r=t.parentNode;r&&r.replaceChild(e,t)}function removeChildren(e){for(;e.lastChild;)e.lastChild.remove()}function replaceChildren(e,t){const r=e.childNodes;for(let n=0;;++n){const i=r[n],o=t[n];if(!i&&!o)break;i!==o&&(i?o?e.insertBefore(o,i):(e.removeChild(i),--n):e.appendChild(o))}}function createMockDiv(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){const t=this.childNodes.indexOf(e);if(-1===t)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){const r=this.childNodes.indexOf(t);if(-1===r)throw new Error("Reference node not found");return this.childNodes.splice(r,0,e),e},style:{}},{get:(e,t,r)=>"firstElementChild"===t?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,r)})}function isCanvas(e){return"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas}var Control=class extends BaseObject{constructor(e){super();const t=e.element;!t||e.target||t.style.pointerEvents||(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,r=this.listenerKeys.length;t<r;++t)unlistenByKey(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){const t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==VOID&&this.listenerKeys.push(listen(e,MapEventType_default.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_="string"==typeof e?document.getElementById(e):e}},Attribution=class extends Control{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===e.collapsed||e.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==e.collapsible,this.collapsible_=void 0===e.collapsible||e.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;const t=void 0!==e.className?e.className:"ol-attribution",r=void 0!==e.tipLabel?e.tipLabel:"Attributions",n=void 0!==e.expandClassName?e.expandClassName:t+"-expand",i=void 0!==e.collapseLabel?e.collapseLabel:"",o=void 0!==e.collapseClassName?e.collapseClassName:t+"-collapse";"string"==typeof i?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=i,this.collapseLabel_.className=o):this.collapseLabel_=i;const s=void 0!==e.label?e.label:"i";"string"==typeof s?(this.label_=document.createElement("span"),this.label_.textContent=s,this.label_.className=n):this.label_=s;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=r,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(EventType_default$2.CLICK,this.handleClick_.bind(this),!1);const l=t+" "+CLASS_UNSELECTABLE+" "+CLASS_CONTROL+(this.collapsed_&&this.collapsible_?" "+CLASS_COLLAPSED:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=l,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){const t=this.getMap().getAllLayers(),r=new Set(t.flatMap(t=>t.getAttributions(e)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>r.add(e)):r.add(this.attributions_)),!this.overrideCollapsible_){const e=!t.some(e=>!1===e.getSource()?.getAttributionsCollapsible());this.setCollapsible(e)}return Array.from(r)}async updateElement_(e){if(!e)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const t=await Promise.all(this.collectSourceAttributions_(e).map(e=>toPromise(()=>e))),r=t.length>0;if(this.renderedVisible_!=r&&(this.element.style.display=r?"":"none",this.renderedVisible_=r),!equals$2(t,this.renderedAttributions_)){removeChildren(this.ulElement_);for(let e=0,r=t.length;e<r;++e){const r=document.createElement("li");r.innerHTML=t[e],this.ulElement_.appendChild(r)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(CLASS_COLLAPSED),this.collapsed_?replaceNode(this.collapseLabel_,this.label_):replaceNode(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,this.collapsible_&&this.collapsed_!==e&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},Rotate=class extends Control{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});const t=void 0!==e.className?e.className:"ol-rotate",r=void 0!==e.label?e.label:"⇧",n=void 0!==e.compassClassName?e.compassClassName:"ol-compass";this.label_=null,"string"==typeof r?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=r):(this.label_=r,this.label_.classList.add(n));const i=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=i,o.appendChild(this.label_),o.addEventListener(EventType_default$2.CLICK,this.handleClick_.bind(this),!1);const s=t+" "+CLASS_UNSELECTABLE+" "+CLASS_CONTROL,a=this.element;a.className=s,a.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=void 0!==e.duration?e.duration:250,this.autoHide_=void 0===e.autoHide||e.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(CLASS_HIDDEN)}handleClick_(e){e.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const t=e.getRotation();void 0!==t&&(this.duration_>0&&t%(2*Math.PI)!=0?e.animate({rotation:0,duration:this.duration_,easing:easeOut}):e.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const r=t.viewState.rotation;if(r!=this.rotation_){const e="rotate("+r+"rad)";if(this.autoHide_){const e=this.element.classList.contains(CLASS_HIDDEN);e||0!==r?e&&0!==r&&this.element.classList.remove(CLASS_HIDDEN):this.element.classList.add(CLASS_HIDDEN)}this.label_.style.transform=e}this.rotation_=r}},Zoom=class extends Control{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=void 0!==e.className?e.className:"ol-zoom",r=void 0!==e.delta?e.delta:1,n=void 0!==e.zoomInClassName?e.zoomInClassName:t+"-in",i=void 0!==e.zoomOutClassName?e.zoomOutClassName:t+"-out",o=void 0!==e.zoomInLabel?e.zoomInLabel:"+",s=void 0!==e.zoomOutLabel?e.zoomOutLabel:"",a=void 0!==e.zoomInTipLabel?e.zoomInTipLabel:"Zoom in",l=void 0!==e.zoomOutTipLabel?e.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=a,c.appendChild("string"==typeof o?document.createTextNode(o):o),c.addEventListener(EventType_default$2.CLICK,this.handleClick_.bind(this,r),!1);const u=document.createElement("button");u.className=i,u.setAttribute("type","button"),u.title=l,u.appendChild("string"==typeof s?document.createTextNode(s):s),u.addEventListener(EventType_default$2.CLICK,this.handleClick_.bind(this,-r),!1);const h=t+" "+CLASS_UNSELECTABLE+" "+CLASS_CONTROL,d=this.element;d.className=h,d.appendChild(c),d.appendChild(u),this.duration_=void 0!==e.duration?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const t=this.getMap().getView();if(!t)return;const r=t.getZoom();if(void 0!==r){const n=t.getConstrainedZoom(r+e);this.duration_>0?(t.getAnimating()&&t.cancelAnimations(),t.animate({zoom:n,duration:this.duration_,easing:easeOut})):t.setZoom(n)}}};function defaults$1(e){e=e||{};const t=new Collection;return(void 0===e.zoom||e.zoom)&&t.push(new Zoom(e.zoomOptions)),(void 0===e.rotate||e.rotate)&&t.push(new Rotate(e.rotateOptions)),(void 0===e.attribution||e.attribution)&&t.push(new Attribution(e.attributionOptions)),t}var Kinetic=class{constructor(e,t,r){this.decay_=e,this.minVelocity_=t,this.delay_=r,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let r=t-3;for(;r>0&&this.points_[r+2]>e;)r-=3;const n=this.points_[t+2]-this.points_[r+2];if(n<1e3/60)return!1;const i=this.points_[t]-this.points_[r],o=this.points_[t+1]-this.points_[r+1];return this.angle_=Math.atan2(o,i),this.initialVelocity_=Math.sqrt(i*i+o*o)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},Property_default$1={ACTIVE:"active"},Interaction=class extends BaseObject{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Property_default$1.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(Property_default$1.ACTIVE,e)}setMap(e){this.map_=e}};function pan(e,t,r){const n=e.getCenterInternal();if(n){const i=[n[0]+t[0],n[1]+t[1]];e.animateInternal({duration:void 0!==r?r:250,easing:linear,center:e.getConstrainedCenter(i)})}}function zoomByDelta(e,t,r,n){const i=e.getZoom();if(void 0===i)return;const o=e.getConstrainedZoom(i+t),s=e.getResolutionForZoom(o);e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:s,anchor:r,duration:void 0!==n?n:250,easing:easeOut})}var DoubleClickZoom=class extends Interaction{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=void 0!==e.duration?e.duration:250}handleEvent(e){let t=!1;if(e.type==MapBrowserEventType_default.DBLCLICK){const r=e.originalEvent,n=e.map,i=e.coordinate,o=r.shiftKey?-this.delta_:this.delta_;zoomByDelta(n.getView(),o,i,this.duration_),r.preventDefault(),t=!0}return!t}};function all$2(e){const t=arguments;return function(e){let r=!0;for(let n=0,i=t.length;n<i&&(r=r&&t[n](e),r);++n);return r}}var altShiftKeysOnly=function(e){const t=e.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},focus=function(e){const t=e.map.getTargetElement(),r=t.getRootNode(),n=e.map.getOwnerDocument().activeElement;return r instanceof ShadowRoot?r.host.contains(n):t.contains(n)},focusWithTabindex=function(e){const t=e.map.getTargetElement(),r=t.getRootNode();return!(r instanceof ShadowRoot?r.host:t).hasAttribute("tabindex")||focus(e)},always$1=TRUE,mouseActionButton=function(e){const t=e.originalEvent;return"pointerId"in t&&0==t.button&&!(WEBKIT&&MAC&&t.ctrlKey)},noModifierKeys=function(e){const t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},platformModifierKey=function(e){const t=e.originalEvent;return MAC?t.metaKey:t.ctrlKey},shiftKeyOnly=function(e){const t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},targetNotEditable=function(e){const t=e.originalEvent,r=t.target.tagName;return"INPUT"!==r&&"SELECT"!==r&&"TEXTAREA"!==r&&!t.target.isContentEditable},mouseOnly=function(e){const t=e.originalEvent;return"pointerId"in t&&"mouse"==t.pointerType},primaryAction=function(e){const t=e.originalEvent;return"pointerId"in t&&t.isPrimary&&0===t.button},PointerInteraction=class extends Interaction{constructor(e){super(e=e||{}),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==MapBrowserEventType_default.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==MapBrowserEventType_default.POINTERUP){const t=this.handleUpEvent(e);this.handlingDownUpSequence=t&&this.targetPointers.length>0}}else if(e.type==MapBrowserEventType_default.POINTERDOWN){const r=this.handleDownEvent(e);this.handlingDownUpSequence=r,t=this.stopDown(r)}else e.type==MapBrowserEventType_default.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function centroid(e){const t=e.length;let r=0,n=0;for(let i=0;i<t;i++)r+=e[i].clientX,n+=e[i].clientY;return{clientX:r/t,clientY:n/t}}var DragPan=class extends PointerInteraction{constructor(e){super({stopDown:FALSE}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const t=e.condition?e.condition:all$2(noModifierKeys,primaryAction);this.condition_=e.onFocusOnly?all$2(focusWithTabindex,t):t,this.noKinetic_=!1}handleDragEvent(e){const t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());const r=this.targetPointers,n=t.getEventPixel(centroid(r));if(r.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const t=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],r=e.map.getView();scale$3(t,r.getResolution()),rotate$1(t,r.getRotation()),r.adjustCenterInternal(t)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=n,this.lastPointersCount_=r.length,e.originalEvent.preventDefault()}handleUpEvent(e){const t=e.map,r=t.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const e=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),i=r.getCenterInternal(),o=t.getPixelFromCoordinateInternal(i),s=t.getCoordinateFromPixelInternal([o[0]-e*Math.cos(n),o[1]-e*Math.sin(n)]);r.animateInternal({center:r.getConstrainedCenter(s),duration:500,easing:easeOut})}return this.panning_&&(this.panning_=!1,r.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){const t=e.map.getView();return this.lastCentroid=null,t.getAnimating()&&t.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},DragRotate=class extends PointerInteraction{constructor(e){e=e||{},super({stopDown:FALSE}),this.condition_=e.condition?e.condition:altShiftKeysOnly,this.lastAngle_=void 0,this.duration_=void 0!==e.duration?e.duration:250}handleDragEvent(e){if(!mouseOnly(e))return;const t=e.map,r=t.getView();if(r.getConstraints().rotation===disable)return;const n=t.getSize(),i=e.pixel,o=Math.atan2(n[1]/2-i[1],i[0]-n[0]/2);if(void 0!==this.lastAngle_){const e=o-this.lastAngle_;r.adjustRotationInternal(-e)}this.lastAngle_=o}handleUpEvent(e){return!mouseOnly(e)||(e.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(e){return!(!mouseOnly(e)||!mouseActionButton(e)||!this.condition_(e)||(e.map.getView().beginInteraction(),this.lastAngle_=void 0,0))}},RenderBox=class extends Disposable{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,r="px",n=this.element_.style;n.left=Math.min(e[0],t[0])+r,n.top=Math.min(e[1],t[1])+r,n.width=Math.abs(t[0]-e[0])+r,n.height=Math.abs(t[1]-e[1])+r}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new Polygon([r])}getGeometry(){return this.geometry_}},DragBoxEventType={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},DragBoxEvent=class extends BaseEvent{constructor(e,t,r){super(e),this.coordinate=t,this.mapBrowserEvent=r}},DragBox=class extends PointerInteraction{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new RenderBox(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??mouseActionButton,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,r){const n=r[0]-t[0],i=r[1]-t[1];return n*n+i*i>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new DragBoxEvent(t?DragBoxEventType.BOXEND:DragBoxEventType.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return!!this.condition_(e)&&(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXSTART,e.coordinate,e)),!0)}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},DragZoom=class extends DragBox{constructor(e){super({condition:(e=e||{}).condition?e.condition:shiftKeyOnly,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=void 0!==e.duration?e.duration:200,this.out_=void 0!==e.out&&e.out}onBoxEnd(e){const t=this.getMap().getView();let r=this.getGeometry();if(this.out_){const e=t.rotatedExtentForGeometry(r),n=t.getResolutionForExtentInternal(e),i=t.getResolution()/n;r=r.clone(),r.scale(i*i)}t.fitInternal(r,{duration:this.duration_,easing:easeOut})}},Key_default={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"},KeyboardPan=class extends Interaction{constructor(e){super(),e=e||{},this.defaultCondition_=function(e){return noModifierKeys(e)&&targetNotEditable(e)},this.condition_=void 0!==e.condition?e.condition:this.defaultCondition_,this.duration_=void 0!==e.duration?e.duration:100,this.pixelDelta_=void 0!==e.pixelDelta?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==EventType_default$2.KEYDOWN){const r=e.originalEvent,n=r.key;if(this.condition_(e)&&(n==Key_default.DOWN||n==Key_default.LEFT||n==Key_default.RIGHT||n==Key_default.UP)){const i=e.map.getView(),o=i.getResolution()*this.pixelDelta_;let s=0,a=0;n==Key_default.DOWN?a=-o:n==Key_default.LEFT?s=-o:n==Key_default.RIGHT?s=o:a=o;const l=[s,a];rotate$1(l,i.getRotation()),pan(i,l,this.duration_),r.preventDefault(),t=!0}}return!t}},KeyboardZoom=class extends Interaction{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(e){return!platformModifierKey(e)&&targetNotEditable(e)},this.delta_=e.delta?e.delta:1,this.duration_=void 0!==e.duration?e.duration:100}handleEvent(e){let t=!1;if(e.type==EventType_default$2.KEYDOWN||e.type==EventType_default$2.KEYPRESS){const r=e.originalEvent,n=r.key;if(this.condition_(e)&&("+"===n||"-"===n)){const i=e.map,o="+"===n?this.delta_:-this.delta_;zoomByDelta(i.getView(),o,void 0,this.duration_),r.preventDefault(),t=!0}}return!t}},DELTA_LINE_MULTIPLIER=40,DELTA_PAGE_MULTIPLIER=300,DELTA_TRACKPAD_PINCH_TO_ZOOM_MULTIPLIER=3,MouseWheelZoom=class extends Interaction{constructor(e){super(e=e||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==e.maxDelta?e.maxDelta:1,this.duration_=void 0!==e.duration?e.duration:250,this.timeout_=void 0!==e.timeout?e.timeout:80,this.useAnchor_=void 0===e.useAnchor||e.useAnchor,this.constrainResolution_=void 0!==e.constrainResolution&&e.constrainResolution;const t=e.condition?e.condition:always$1;this.condition_=e.onFocusOnly?all$2(focusWithTabindex,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(unlistenByKey),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){const t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(listen(t,"keydown",e=>{"Control"===e.key&&(this.ctrlKeyPressed_=!0)}),listen(t,"keyup",e=>{"Control"===e.key&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;const e=this.getMap();if(!e)return;const t=e.getView(),r=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,r,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e))return!0;if(e.type!==EventType_default$2.WHEEL)return!0;const t=e.map,r=e.originalEvent;r.preventDefault();const n=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let i=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:i*=DELTA_LINE_MULTIPLIER;break;case WheelEvent.DOM_DELTA_PAGE:i*=DELTA_PAGE_MULTIPLIER}if(0===i)return!1;this.lastDelta_=i;const o=Date.now();void 0===this.startTime_&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?"trackpad":"wheel");const s=t.getView();if("trackpad"===this.mode_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),n&&(i*=DELTA_TRACKPAD_PINCH_TO_ZOOM_MULTIPLIER),s.adjustZoom(-i/this.deltaPerZoom_,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=i;const a=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,t),a),!1}handleWheelZoom_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let r=-clamp$1(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(r=r?r>0?1:-1:0),zoomByDelta(t,r,this.lastAnchor_?e.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(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},PinchRotate=class extends PointerInteraction{constructor(e){const t=e=e||{};t.stopDown||(t.stopDown=FALSE),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==e.threshold?e.threshold:.3,this.duration_=void 0!==e.duration?e.duration:250}handleDragEvent(e){let t=0;const r=this.targetPointers[0],n=this.targetPointers[1],i=Math.atan2(n.clientY-r.clientY,n.clientX-r.clientX);if(void 0!==this.lastAngle_){const e=i-this.lastAngle_;this.rotationDelta_+=e,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=e}this.lastAngle_=i;const o=e.map,s=o.getView();s.getConstraints().rotation!==disable&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(centroid(this.targetPointers))),this.rotating_&&(o.render(),s.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return!(this.targetPointers.length<2&&(e.map.getView().endInteraction(this.duration_),1))}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},PinchZoom=class extends PointerInteraction{constructor(e){const t=e=e||{};t.stopDown||(t.stopDown=FALSE),super(t),this.anchor_=null,this.duration_=void 0!==e.duration?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const r=this.targetPointers[0],n=this.targetPointers[1],i=r.clientX-n.clientX,o=r.clientY-n.clientY,s=Math.sqrt(i*i+o*o);void 0!==this.lastDistance_&&(t=this.lastDistance_/s),this.lastDistance_=s;const a=e.map,l=a.getView();1!=t&&(this.lastScaleDelta_=t),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(centroid(this.targetPointers))),a.render(),l.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const t=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return t.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}};function defaults(e){e=e||{};const t=new Collection,r=new Kinetic(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&t.push(new DragRotate),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&t.push(new DoubleClickZoom({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&t.push(new DragPan({onFocusOnly:e.onFocusOnly,kinetic:r})),(void 0===e.pinchRotate||e.pinchRotate)&&t.push(new PinchRotate),(void 0===e.pinchZoom||e.pinchZoom)&&t.push(new PinchZoom({duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(t.push(new KeyboardPan),t.push(new KeyboardZoom({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&t.push(new MouseWheelZoom({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&t.push(new DragZoom({duration:e.zoomDuration})),t}var Property_default={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"},BaseLayer=class extends BaseObject{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);"object"==typeof e.properties&&(delete t.properties,Object.assign(t,e.properties)),t[Property_default.OPACITY]=void 0!==e.opacity?e.opacity:1,assert$1("number"==typeof t[Property_default.OPACITY],"Layer opacity must be a number"),t[Property_default.VISIBLE]=void 0===e.visible||e.visible,t[Property_default.Z_INDEX]=e.zIndex,t[Property_default.MAX_RESOLUTION]=void 0!==e.maxResolution?e.maxResolution:1/0,t[Property_default.MIN_RESOLUTION]=void 0!==e.minResolution?e.minResolution:0,t[Property_default.MIN_ZOOM]=void 0!==e.minZoom?e.minZoom:-1/0,t[Property_default.MAX_ZOOM]=void 0!==e.maxZoom?e.maxZoom:1/0,this.className_=void 0!==t.className?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:void 0===e||e},r=this.getZIndex();return t.opacity=clamp$1(Math.round(100*this.getOpacity())/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=void 0!==r||t.managed?r:1/0,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return abstract()}getLayerStatesArray(e){return abstract()}getExtent(){return this.get(Property_default.EXTENT)}getMaxResolution(){return this.get(Property_default.MAX_RESOLUTION)}getMinResolution(){return this.get(Property_default.MIN_RESOLUTION)}getMinZoom(){return this.get(Property_default.MIN_ZOOM)}getMaxZoom(){return this.get(Property_default.MAX_ZOOM)}getOpacity(){return this.get(Property_default.OPACITY)}getSourceState(){return abstract()}getVisible(){return this.get(Property_default.VISIBLE)}getZIndex(){return this.get(Property_default.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Property_default.EXTENT,e)}setMaxResolution(e){this.set(Property_default.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Property_default.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Property_default.MAX_ZOOM,e)}setMinZoom(e){this.set(Property_default.MIN_ZOOM,e)}setOpacity(e){assert$1("number"==typeof e,"Layer opacity must be a number"),this.set(Property_default.OPACITY,e)}setVisible(e){this.set(Property_default.VISIBLE,e)}setZIndex(e){this.set(Property_default.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},GroupEventType={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},GroupEvent=class extends BaseEvent{constructor(e,t){super(e),this.layer=t}},Property$3={LAYERS:"layers"},LayerGroup=class e extends BaseLayer{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let r=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Property$3.LAYERS,this.handleLayersChanged_),r?Array.isArray(r)?r=new Collection(r.slice(),{unique:!0}):assert$1("function"==typeof r.getArray,"Expected `layers` to be an array or a `Collection`"):r=new Collection(void 0,{unique:!0}),this.setLayers(r)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(unlistenByKey),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push(listen(e,CollectionEventType_default.ADD,this.handleLayersAdd_,this),listen(e,CollectionEventType_default.REMOVE,this.handleLayersRemove_,this));for(const r in this.listenerKeys_)this.listenerKeys_[r].forEach(unlistenByKey);clear(this.listenerKeys_);const t=e.getArray();for(let r=0,n=t.length;r<n;r++){const e=t[r];this.registerLayerListeners_(e),this.dispatchEvent(new GroupEvent(GroupEventType.ADDLAYER,e))}this.changed()}registerLayerListeners_(t){const r=[listen(t,ObjectEventType_default.PROPERTYCHANGE,this.handleLayerChange_,this),listen(t,EventType_default$2.CHANGE,this.handleLayerChange_,this)];t instanceof e&&r.push(listen(t,GroupEventType.ADDLAYER,this.handleLayerGroupAdd_,this),listen(t,GroupEventType.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[getUid(t)]=r}handleLayerGroupAdd_(e){this.dispatchEvent(new GroupEvent(GroupEventType.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new GroupEvent(GroupEventType.REMOVELAYER,e.layer))}handleLayersAdd_(e){const t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new GroupEvent(GroupEventType.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){const t=e.element,r=getUid(t);this.listenerKeys_[r].forEach(unlistenByKey),delete this.listenerKeys_[r],this.dispatchEvent(new GroupEvent(GroupEventType.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(Property$3.LAYERS)}setLayers(e){const t=this.getLayers();if(t){const e=t.getArray();for(let t=0,r=e.length;t<r;++t)this.dispatchEvent(new GroupEvent(GroupEventType.REMOVELAYER,e[t]))}this.set(Property$3.LAYERS,e)}getLayersArray(e){return e=void 0!==e?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){const t=void 0!==e?e:[],r=t.length;this.getLayers().forEach(function(e){e.getLayerStatesArray(t)});const n=this.getLayerState();let i=n.zIndex;e||void 0!==n.zIndex||(i=0);for(let o=r,s=t.length;o<s;o++){const e=t[o];e.opacity*=n.opacity,e.visible=e.visible&&n.visible,e.maxResolution=Math.min(e.maxResolution,n.maxResolution),e.minResolution=Math.max(e.minResolution,n.minResolution),e.minZoom=Math.max(e.minZoom,n.minZoom),e.maxZoom=Math.min(e.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==e.extent?e.extent=getIntersection(e.extent,n.extent):e.extent=n.extent),void 0===e.zIndex&&(e.zIndex=i)}return t}getSourceState(){return"ready"}},EventType_default={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},Layer=class extends BaseLayer{constructor(e){const t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Property_default.SOURCE,this.handleSourcePropertyChange_);const r=e.source?e.source:null;this.setSource(r)}getLayersArray(e){return(e=e||[]).push(this),e}getLayerStatesArray(e){return(e=e||[]).push(this.getLayerState()),e}getSource(){return this.get(Property_default.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(unlistenByKey(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const e=this.getSource();e&&(this.sourceChangeKey_=listen(e,EventType_default$2.CHANGE,this.handleSourceChange_,this),"ready"===e.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return this.renderer_&&this.rendered?this.renderer_.getData(e):null}isVisible(e){let t;const r=this.getMapInternal();let n;if(!e&&r&&(e=r.getView()),t=e instanceof View?{viewState:e.getState(),extent:e.calculateExtent()}:e,!t.layerStatesArray&&r&&(t.layerStatesArray=r.getLayerGroup().getLayerStatesArray()),t.layerStatesArray){if(n=t.layerStatesArray.find(e=>e.layer===this),!n)return!1}else n=this.getLayerState();const i=this.getExtent();return inView(n,t.viewState)&&(!i||intersects$1(i,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];const t=this.getSource()?.getAttributions();if(!t)return[];let r=t(e instanceof View?e.getViewStateAndExtent():e);return Array.isArray(r)||(r=[r]),r}render(e,t){const r=this.getRenderer();return r.prepareFrame(e)?(this.rendered=!0,r.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){const t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Property_default.MAP,e)}getMapInternal(){return this.get(Property_default.MAP)}setMap(e){this.mapPrecomposeKey_&&(unlistenByKey(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(unlistenByKey(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=listen(e,EventType_default.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=listen(this,EventType_default$2.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){const t=e.frameState.layerStatesArray,r=this.getLayerState(!1);assert$1(!t.some(e=>e.layer===r.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(r)}setSource(e){this.set(Property_default.SOURCE,e)}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 inView(e,t){if(!e.visible)return!1;const r=t.resolution;if(r<e.minResolution||r>=e.maxResolution)return!1;const n=t.zoom;return n>e.minZoom&&n<=e.maxZoom}function quickselect$1(e,t,r=0,n=e.length-1,i=defaultCompare$1){for(;n>r;){if(n-r>600){const o=n-r+1,s=t-r+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);quickselect$1(e,t,Math.max(r,Math.floor(t-s*l/o+c)),Math.min(n,Math.floor(t+(o-s)*l/o+c)),i)}const o=e[t];let s=r,a=n;for(swap$1(e,r,t),i(e[n],o)>0&&swap$1(e,r,n);s<a;){for(swap$1(e,s,a),s++,a--;i(e[s],o)<0;)s++;for(;i(e[a],o)>0;)a--}0===i(e[r],o)?swap$1(e,r,a):(a++,swap$1(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}}function swap$1(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function defaultCompare$1(e,t){return e<t?-1:e>t?1:0}var RBush$1=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const r=[];if(!intersects(e,t))return r;const n=this.toBBox,i=[];for(;t;){for(let o=0;o<t.children.length;o++){const s=t.children[o],a=t.leaf?n(s):s;intersects(e,a)&&(t.leaf?r.push(s):contains(e,a)?this._all(s,r):i.push(s))}t=i.pop()}return r}collides(e){let t=this.data;if(!intersects(e,t))return!1;const r=[];for(;t;){for(let n=0;n<t.children.length;n++){const i=t.children[n],o=t.leaf?this.toBBox(i):i;if(intersects(e,o)){if(t.leaf||contains(e,o))return!0;r.push(i)}}t=r.pop()}return!1}load(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}else this.data=t;return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=createNode([]),this}remove(e,t){if(!e)return this;let r=this.data;const n=this.toBBox(e),i=[],o=[];let s,a,l;for(;r||i.length;){if(r||(r=i.pop(),a=i[i.length-1],s=o.pop(),l=!0),r.leaf){const n=findItem(e,r.children,t);if(-1!==n)return r.children.splice(n,1),i.push(r),this._condense(i),this}l||r.leaf||!contains(r,n)?a?(s++,r=a.children[s],l=!1):r=null:(i.push(r),o.push(s),s=0,a=r,r=r.children[0])}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const r=[];for(;e;)e.leaf?t.push(...e.children):r.push(...e.children),e=r.pop();return t}_build(e,t,r,n){const i=r-t+1;let o,s=this._maxEntries;if(i<=s)return o=createNode(e.slice(t,r+1)),calcBBox(o,this.toBBox),o;n||(n=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,n-1))),o=createNode([]),o.leaf=!1,o.height=n;const a=Math.ceil(i/s),l=a*Math.ceil(Math.sqrt(s));multiSelect(e,t,r,l,this.compareMinX);for(let c=t;c<=r;c+=l){const t=Math.min(c+l-1,r);multiSelect(e,c,t,a,this.compareMinY);for(let r=c;r<=t;r+=a){const i=Math.min(r+a-1,t);o.children.push(this._build(e,r,i,n-1))}}return calcBBox(o,this.toBBox),o}_chooseSubtree(e,t,r,n){for(;n.push(t),!t.leaf&&n.length-1!==r;){let r,n=1/0,i=1/0;for(let o=0;o<t.children.length;o++){const s=t.children[o],a=bboxArea(s),l=enlargedArea(e,s)-a;l<i?(i=l,n=a<n?a:n,r=s):l===i&&a<n&&(n=a,r=s)}t=r||t.children[0]}return t}_insert(e,t,r){const n=r?e:this.toBBox(e),i=[],o=this._chooseSubtree(n,this.data,t,i);for(o.children.push(e),extend(o,n);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(n,i,t)}_split(e,t){const r=e[t],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);const o=this._chooseSplitIndex(r,i,n),s=createNode(r.children.splice(o,r.children.length-o));s.height=r.height,s.leaf=r.leaf,calcBBox(r,this.toBBox),calcBBox(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(r,s)}_splitRoot(e,t){this.data=createNode([e,t]),this.data.height=e.height+1,this.data.leaf=!1,calcBBox(this.data,this.toBBox)}_chooseSplitIndex(e,t,r){let n,i=1/0,o=1/0;for(let s=t;s<=r-t;s++){const t=distBBox(e,0,s,this.toBBox),a=distBBox(e,s,r,this.toBBox),l=intersectionArea(t,a),c=bboxArea(t)+bboxArea(a);l<i?(i=l,n=s,o=c<o?c:o):l===i&&c<o&&(o=c,n=s)}return n||r-t}_chooseSplitAxis(e,t,r){const n=e.leaf?this.compareMinX:compareNodeMinX,i=e.leaf?this.compareMinY:compareNodeMinY;this._allDistMargin(e,t,r,n)<this._allDistMargin(e,t,r,i)&&e.children.sort(n)}_allDistMargin(e,t,r,n){e.children.sort(n);const i=this.toBBox,o=distBBox(e,0,t,i),s=distBBox(e,r-t,r,i);let a=bboxMargin(o)+bboxMargin(s);for(let l=t;l<r-t;l++){const t=e.children[l];extend(o,e.leaf?i(t):t),a+=bboxMargin(o)}for(let l=r-t-1;l>=t;l--){const t=e.children[l];extend(s,e.leaf?i(t):t),a+=bboxMargin(s)}return a}_adjustParentBBoxes(e,t,r){for(let n=r;n>=0;n--)extend(t[n],e)}_condense(e){for(let t,r=e.length-1;r>=0;r--)0===e[r].children.length?r>0?(t=e[r-1].children,t.splice(t.indexOf(e[r]),1)):this.clear():calcBBox(e[r],this.toBBox)}};function findItem(e,t,r){if(!r)return t.indexOf(e);for(let n=0;n<t.length;n++)if(r(e,t[n]))return n;return-1}function calcBBox(e,t){distBBox(e,0,e.children.length,t,e)}function distBBox(e,t,r,n,i){i||(i=createNode(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=t;o<r;o++){const t=e.children[o];extend(i,e.leaf?n(t):t)}return i}function extend(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function compareNodeMinX(e,t){return e.minX-t.minX}function compareNodeMinY(e,t){return e.minY-t.minY}function bboxArea(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function bboxMargin(e){return e.maxX-e.minX+(e.maxY-e.minY)}function enlargedArea(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function intersectionArea(e,t){const r=Math.max(e.minX,t.minX),n=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),o=Math.min(e.maxY,t.maxY);return Math.max(0,i-r)*Math.max(0,o-n)}function contains(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function intersects(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function createNode(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect(e,t,r,n,i){const o=[t,r];for(;o.length;){if((r=o.pop())-(t=o.pop())<=n)continue;const s=t+Math.ceil((r-t)/n/2)*n;quickselect$1(e,s,t,r,i),o.push(t,s,s,r)}}var NO_COLOR=[NaN,NaN,NaN,0],colorParseContext;function getColorParseContext(){return colorParseContext||(colorParseContext=createCanvasContext2D(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),colorParseContext}var rgbModernRegEx=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,rgbLegacyAbsoluteRegEx=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,rgbLegacyPercentageRegEx=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,hexRegEx=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function toColorComponent(e,t){return e.endsWith("%")?Number(e.substring(0,e.length-1))/t:Number(e)}function throwInvalidColor(e){throw new Error('failed to parse "'+e+'" as color')}function parseRgba(e){if(e.toLowerCase().startsWith("rgb")){const t=e.match(rgbLegacyAbsoluteRegEx)||e.match(rgbModernRegEx)||e.match(rgbLegacyPercentageRegEx);if(t){const e=t[4],r=100/255;return[clamp$1(toColorComponent(t[1],r)+.5|0,0,255),clamp$1(toColorComponent(t[2],r)+.5|0,0,255),clamp$1(toColorComponent(t[3],r)+.5|0,0,255),void 0!==e?clamp$1(toColorComponent(e,100),0,1):1]}throwInvalidColor(e)}if(e.startsWith("#")){if(hexRegEx.test(e)){const t=e.substring(1),r=t.length<=4?1:2,n=[0,0,0,255];for(let e=0,i=t.length;e<i;e+=r){let i=parseInt(t.substring(e,e+r),16);1===r&&(i+=i<<4),n[e/r]=i}return n[3]=n[3]/255,n}throwInvalidColor(e)}const t=getColorParseContext();t.fillStyle="#abcdef";let r=t.fillStyle;t.fillStyle=e,t.fillStyle===r&&(t.fillStyle="#fedcba",r=t.fillStyle,t.fillStyle=e,t.fillStyle===r&&throwInvalidColor(e));const n=t.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return parseRgba(n);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const i=Array.from(t.getImageData(0,0,1,1).data);return i[3]=toFixed(i[3]/255,3),i}function asString(e){return"string"==typeof e?e:toString(e)}var MAX_CACHE_SIZE=1024,cache={},cacheSize=0;function withAlpha(e){if(4===e.length)return e;const t=e.slice();return t[3]=1,t}function b1(e){return e>.0031308?269.025*Math.pow(e,1/2.4)-14.025:3294.6*e}function b2(e){return e>.2068965?Math.pow(e,3):108/841*(e-4/29)}function a1(e){return e>10.314724?Math.pow((e+14.025)/269.025,2.4):e/3294.6}function a2(e){return e>.0088564?Math.pow(e,1/3):e/(108/841)+4/29}function rgbaToLcha(e){const t=a1(e[0]),r=a1(e[1]),n=a1(e[2]),i=a2(.222488403*t+.716873169*r+.06060791*n),o=500*(a2(.452247074*t+.399439023*r+.148375274*n)-i),s=200*(i-a2(.016863605*t+.117638439*r+.865350722*n)),a=Math.atan2(s,o)*(180/Math.PI);return[116*i-16,Math.sqrt(o*o+s*s),a<0?a+360:a,e[3]]}function lchaToRgba(e){const t=(e[0]+16)/116,r=e[1],n=e[2]*Math.PI/180,i=b2(t),o=b2(t+r/500*Math.cos(n)),s=b2(t-r/200*Math.sin(n)),a=b1(3.021973625*o-1.617392459*i-.404875592*s),l=b1(-.943766287*o+1.916279586*i+.027607165*s),c=b1(.069407491*o-.22898585*i+1.159737864*s);return[clamp$1(a+.5|0,0,255),clamp$1(l+.5|0,0,255),clamp$1(c+.5|0,0,255),e[3]]}function fromString(e){if("none"===e)return NO_COLOR;if(cache.hasOwnProperty(e))return cache[e];if(cacheSize>=MAX_CACHE_SIZE){let e=0;for(const t in cache)3&e++||(delete cache[t],--cacheSize)}const t=parseRgba(e);4!==t.length&&throwInvalidColor(e);for(const r of t)isNaN(r)&&throwInvalidColor(e);return cache[e]=t,++cacheSize,t}function asArray(e){return Array.isArray(e)?e:fromString(e)}function toString(e){let t=e[0];t!=(0|t)&&(t=t+.5|0);let r=e[1];r!=(0|r)&&(r=r+.5|0);let n=e[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+t+","+r+","+n+","+(void 0===e[3]?1:Math.round(1e3*e[3])/1e3)+")"}function hasArea(e){return e[0]>0&&e[1]>0}function scale(e,t,r){return void 0===r&&(r=[0,0]),r[0]=e[0]*t+.5|0,r[1]=e[1]*t+.5|0,r}function toSize(e,t){return Array.isArray(e)?e:(void 0===t?t=[e,e]:(t[0]=e,t[1]=e),t)}var numTypes=0,NoneType=0,BooleanType$1=1<<numTypes++,NumberType$1=1<<numTypes++,StringType$1=1<<numTypes++,ColorType$1=1<<numTypes++,NumberArrayType$1=1<<numTypes++,SizeType=1<<numTypes++,AnyType=Math.pow(2,numTypes)-1,typeNames={[BooleanType$1]:"boolean",[NumberType$1]:"number",[StringType$1]:"string",[ColorType$1]:"color",[NumberArrayType$1]:"number[]",[SizeType]:"size"},namedTypes=Object.keys(typeNames).map(Number).sort(ascending);function isSpecific(e){return e in typeNames}function typeName(e){const t=[];for(const r of namedTypes)includesType(e,r)&&t.push(typeNames[r]);return 0===t.length?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function includesType(e,t){return(e&t)===t}function overlapsType(e,t){return!!(e&t)}function isType(e,t){return e===t}var LiteralExpression=class{constructor(e,t){if(!isSpecific(e))throw new Error(`literal expressions must have a specific type, got ${typeName(e)}`);this.type=e,this.value=t}},CallExpression=class{constructor(e,t,...r){this.type=e,this.operator=t,this.args=r}};function newParsingContext(e){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:e}}function parse(e,t,r){switch(typeof e){case"boolean":if(isType(t,StringType$1))return new LiteralExpression(StringType$1,e?"true":"false");if(!includesType(t,BooleanType$1))throw new Error(`got a boolean, but expected ${typeName(t)}`);return new LiteralExpression(BooleanType$1,e);case"number":if(isType(t,SizeType))return new LiteralExpression(SizeType,toSize(e));if(isType(t,BooleanType$1))return new LiteralExpression(BooleanType$1,!!e);if(isType(t,StringType$1))return new LiteralExpression(StringType$1,e.toString());if(!includesType(t,NumberType$1))throw new Error(`got a number, but expected ${typeName(t)}`);return new LiteralExpression(NumberType$1,e);case"string":if(isType(t,ColorType$1))return new LiteralExpression(ColorType$1,fromString(e));if(isType(t,BooleanType$1))return new LiteralExpression(BooleanType$1,!!e);if(!includesType(t,StringType$1))throw new Error(`got a string, but expected ${typeName(t)}`);return new LiteralExpression(StringType$1,e)}if(!Array.isArray(e))throw new Error("expression must be an array or a primitive value");if(0===e.length)throw new Error("empty expression");if("string"==typeof e[0])return parseCallExpression(e,t,r);for(const n of e)if("number"!=typeof n)throw new Error("expected an array of numbers");if(isType(t,SizeType)){if(2!==e.length)throw new Error(`expected an array of two values for a size, got ${e.length}`);return new LiteralExpression(SizeType,e)}if(isType(t,ColorType$1)){if(3===e.length)return new LiteralExpression(ColorType$1,[...e,1]);if(4===e.length)return new LiteralExpression(ColorType$1,e);throw new Error(`expected an array of 3 or 4 values for a color, got ${e.length}`)}if(!includesType(t,NumberArrayType$1))throw new Error(`got an array of numbers, but expected ${typeName(t)}`);return new LiteralExpression(NumberArrayType$1,e)}var Ops={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},parsers={[Ops.Get]:createCallExpressionParser(hasArgsCount(1,1/0),withGetArgs),[Ops.Var]:createVarExpressionParser(),[Ops.Has]:createCallExpressionParser(hasArgsCount(1,1/0),withGetArgs),[Ops.Id]:createCallExpressionParser(usesFeatureId,withNoArgs),[Ops.Concat]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfType(StringType$1)),[Ops.GeometryType]:createCallExpressionParser(usesGeometryType,withNoArgs),[Ops.LineMetric]:createCallExpressionParser(usesMCoordinate,withNoArgs),[Ops.Resolution]:createCallExpressionParser(usesMapState,withNoArgs),[Ops.Zoom]:createCallExpressionParser(usesMapState,withNoArgs),[Ops.Time]:createCallExpressionParser(usesMapState,withNoArgs),[Ops.Any]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfType(BooleanType$1)),[Ops.All]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfType(BooleanType$1)),[Ops.Not]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(BooleanType$1)),[Ops.Equal]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfIdenticalType()),[Ops.NotEqual]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfIdenticalType()),[Ops.GreaterThan]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType$1)),[Ops.GreaterThanOrEqualTo]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType$1)),[Ops.LessThan]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType$1)),[Ops.LessThanOrEqualTo]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType$1)),[Ops.Multiply]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfReturnType),[Ops.Coalesce]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfReturnType),[Ops.Divide]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType$1)),[Ops.Add]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfType(NumberType$1)),[Ops.Subtract]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType$1)),[Ops.Clamp]:createCallExpressionParser(hasArgsCount(3,3),withArgsOfType(NumberType$1)),[Ops.Mod]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType$1)),[Ops.Pow]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType$1)),[Ops.Abs]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType$1)),[Ops.Floor]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType$1)),[Ops.Ceil]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType$1)),[Ops.Round]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType$1)),[Ops.Sin]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType$1)),[Ops.Cos]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType$1)),[Ops.Atan]:createCallExpressionParser(hasArgsCount(1,2),withArgsOfType(NumberType$1)),[Ops.Sqrt]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType$1)),[Ops.Match]:createCallExpressionParser(hasArgsCount(4,1/0),hasEvenArgs,withMatchArgs),[Ops.Between]:createCallExpressionParser(hasArgsCount(3,3),withArgsOfType(NumberType$1)),[Ops.Interpolate]:createCallExpressionParser(hasArgsCount(6,1/0),hasEvenArgs,withInterpolateArgs),[Ops.Case]:createCallExpressionParser(hasArgsCount(3,1/0),hasOddArgs,withCaseArgs),[Ops.In]:createCallExpressionParser(hasArgsCount(2,2),withInArgs),[Ops.Number]:createCallExpressionParser(hasArgsCount(1,1/0),withArgsOfType(AnyType)),[Ops.String]:createCallExpressionParser(hasArgsCount(1,1/0),withArgsOfType(AnyType)),[Ops.Array]:createCallExpressionParser(hasArgsCount(1,1/0),withArgsOfType(NumberType$1)),[Ops.Color]:createCallExpressionParser(hasArgsCount(1,4),withArgsOfType(NumberType$1)),[Ops.Band]:createCallExpressionParser(hasArgsCount(1,3),withArgsOfType(NumberType$1)),[Ops.Palette]:createCallExpressionParser(hasArgsCount(2,2),withPaletteArgs),[Ops.ToString]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(BooleanType$1|NumberType$1|StringType$1|ColorType$1))};function withGetArgs(e,t,r){const n=e.length-1,i=new Array(n);for(let o=0;o<n;++o){const n=e[o+1];switch(typeof n){case"number":i[o]=new LiteralExpression(NumberType$1,n);break;case"string":i[o]=new LiteralExpression(StringType$1,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===o&&r.properties.set(String(n),t)}return i}function createVarExpressionParser(){return function(e,t,r){const n=e[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");let i=t;const o=r.inputVariables?.[n];if(void 0!==o){const e=parse(o,AnyType,r);if(!(e instanceof LiteralExpression))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let s=e.type;if("string"==typeof o&&overlapsType(i,ColorType$1)&&!overlapsType(i,StringType$1)?s=ColorType$1:Array.isArray(o)&&2===o.length&&overlapsType(i,SizeType)&&!overlapsType(i,NumberArrayType$1)&&(s=SizeType),i&=s,0===i)throw new Error(`the type expected from the var operator (${typeName(t)}) did not have any overlap with the type of the corresponding style variables (${typeName(s)}), variable name: ${n}`)}if(r.variables.has(n)){const e=r.variables.get(n);if(i&=e,0===i)throw new Error(`a new type expected from the var operator (${typeName(t)}) did not have any overlap with the previous type expected for it (${typeName(e)}), variable name: ${n}`)}return r.variables.set(n,i),new CallExpression(i,"var",new LiteralExpression(StringType$1,n))}}function usesFeatureId(e,t,r){r.featureId=!0}function usesGeometryType(e,t,r){r.geometryType=!0}function usesMCoordinate(e,t,r){r.mCoordinate=!0}function usesMapState(e,t,r){r.mapState=!0}function withNoArgs(e){const t=e[0];if(1!==e.length)throw new Error(`expected no arguments for ${t} operation`);return[]}function hasArgsCount(e,t){return function(r){const n=r[0],i=r.length-1;if(e===t){if(i!==e)throw new Error(`expected ${e} argument${1===e?"":"s"} for ${n}, got ${i}`)}else if(i<e||i>t)throw new Error(`expected ${t===1/0?`${e} or more`:`${e} to ${t}`} arguments for ${n}, got ${i}`)}}function withArgsOfReturnType(e,t,r){const n=e.length-1,i=new Array(n);for(let o=0;o<n;++o){const n=parse(e[o+1],t,r);i[o]=n}return i}function withArgsOfType(e){return function(t,r,n){const i=t.length-1,o=new Array(i);for(let s=0;s<i;++s){const r=parse(t[s+1],e,n);o[s]=r}return o}}function withArgsOfIdenticalType(){return function(e,t,r){const n=e[0],i=e.length-1,o=new Array(i);let s=AnyType;for(let a=0;a<i;++a)s&=parse(e[a+1],s,r).type;if(0===s)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<i;++a){const t=parse(e[a+1],s,r);o[a]=t}return o}}function hasOddArgs(e){const t=e[0],r=e.length-1;if(r%2==0)throw new Error(`expected an odd number of arguments for ${t}, got ${r} instead`)}function hasEvenArgs(e){const t=e[0],r=e.length-1;if(r%2==1)throw new Error(`expected an even number of arguments for operation ${t}, got ${r} instead`)}function withMatchArgs(e,t,r){const n=e.length-1,i=parse(e[e.length-1],t,r);let o=StringType$1|NumberType$1|BooleanType$1;const s=new Array(n-2);for(let a=0;a<n-2;a+=2){try{o&=parse(e[a+2],o,r).type}catch(err){throw new Error(`failed to parse argument ${a+1} of match expression: ${err.message}`)}if(0===o)throw new Error("no common type was found among the arguments of match expression")}for(let a=0;a<n-2;a+=2){try{const t=parse(e[a+2],o,r);s[a]=t}catch(err){throw new Error(`failed to parse argument ${a+1} of match expression: ${err.message}`)}try{const t=parse(e[a+3],i.type,r);s[a+1]=t}catch(err){throw new Error(`failed to parse argument ${a+2} of match expression: ${err.message}`)}}return[parse(e[1],o,r),...s,i]}function withInterpolateArgs(e,t,r){const n=e[1];let i;switch(n[0]){case"linear":i=1;break;case"exponential":const e=n[1];if("number"!=typeof e||e<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(e)} instead`);i=e;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const o=new LiteralExpression(NumberType$1,i);let s;try{s=parse(e[2],NumberType$1,r)}catch(err){throw new Error(`failed to parse argument 1 in interpolate expression: ${err.message}`)}const a=new Array(e.length-3);for(let l=0;l<a.length;l+=2){try{const t=parse(e[l+3],NumberType$1,r);a[l]=t}catch(err){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${err.message}`)}try{const n=parse(e[l+4],t,r);a[l+1]=n}catch(err){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${err.message}`)}}return[o,s,...a]}function withCaseArgs(e,t,r){const n=parse(e[e.length-1],t,r),i=new Array(e.length-1);for(let o=0;o<i.length-1;o+=2){try{const t=parse(e[o+1],BooleanType$1,r);i[o]=t}catch(err){throw new Error(`failed to parse argument ${o} of case expression: ${err.message}`)}try{const t=parse(e[o+2],n.type,r);i[o+1]=t}catch(err){throw new Error(`failed to parse argument ${o+1} of case expression: ${err.message}`)}}return i[i.length-1]=n,i}function withInArgs(e,t,r){let n,i=e[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');if("literal"===i[0]){if(i=i[1],!Array.isArray(i))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof i[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');n="string"==typeof i[0]?StringType$1:NumberType$1;const o=new Array(i.length);for(let s=0;s<o.length;s++)try{const e=parse(i[s],n,r);o[s]=e}catch(err){throw new Error(`failed to parse haystack item ${s} for "in" expression: ${err.message}`)}return[parse(e[1],n,r),...o]}function withPaletteArgs(e,t,r){let n;try{n=parse(e[1],NumberType$1,r)}catch(err){throw new Error(`failed to parse first argument in palette expression: ${err.message}`)}const i=e[2];if(!Array.isArray(i))throw new Error("the second argument of palette must be an array");const o=new Array(i.length);for(let s=0;s<o.length;s++){let e;try{e=parse(i[s],ColorType$1,r)}catch(err){throw new Error(`failed to parse color at index ${s} in palette expression: ${err.message}`)}if(!(e instanceof LiteralExpression))throw new Error(`the palette color at index ${s} must be a literal value`);o[s]=e}return[n,...o]}function createCallExpressionParser(...e){return function(t,r,n){const i=t[0];let o;for(let s=0;s<e.length;s++){const i=e[s](t,r,n);if(s==e.length-1){if(!i)throw new Error("expected last argument validator to return the parsed args");o=i}}return new CallExpression(r,i,...o)}}function parseCallExpression(e,t,r){const n=e[0],i=parsers[n];if(!i)throw new Error(`unknown operator: ${n}`);return i(e,t,r)}function computeGeometryType(e){if(!e)return"";const t=e.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return computeGeometryType(e.getGeometries()[0]);default:return""}}function newEvaluationContext(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function buildExpression(e,t,r){return compileExpression(parse(e,t,r),r)}function compileExpression(e,t){if(e instanceof LiteralExpression){if(e.type===ColorType$1&&"string"==typeof e.value){const t=fromString(e.value);return function(){return t}}return function(){return e.value}}const r=e.operator;switch(r){case Ops.Number:case Ops.String:case Ops.Coalesce:return compileAssertionExpression(e,t);case Ops.Get:case Ops.Var:case Ops.Has:return compileAccessorExpression(e,t);case Ops.Id:return e=>e.featureId;case Ops.GeometryType:return e=>e.geometryType;case Ops.Concat:{const r=e.args.map(e=>compileExpression(e,t));return e=>"".concat(...r.map(t=>t(e).toString()))}case Ops.Resolution:return e=>e.resolution;case Ops.Any:case Ops.All:case Ops.Between:case Ops.In:case Ops.Not:return compileLogicalExpression(e,t);case Ops.Equal:case Ops.NotEqual:case Ops.LessThan:case Ops.LessThanOrEqualTo:case Ops.GreaterThan:case Ops.GreaterThanOrEqualTo:return compileComparisonExpression(e,t);case Ops.Multiply:case Ops.Divide:case Ops.Add:case Ops.Subtract:case Ops.Clamp:case Ops.Mod:case Ops.Pow:case Ops.Abs:case Ops.Floor:case Ops.Ceil:case Ops.Round:case Ops.Sin:case Ops.Cos:case Ops.Atan:case Ops.Sqrt:return compileNumericExpression(e,t);case Ops.Case:return compileCaseExpression(e,t);case Ops.Match:return compileMatchExpression(e,t);case Ops.Interpolate:return compileInterpolateExpression(e,t);case Ops.ToString:return compileConvertExpression(e,t);default:throw new Error(`Unsupported operator ${r}`)}}function compileAssertionExpression(e,t){const r=e.operator,n=e.args.length,i=new Array(n);for(let o=0;o<n;++o)i[o]=compileExpression(e.args[o],t);switch(r){case Ops.Coalesce:return e=>{for(let t=0;t<n;++t){const r=i[t](e);if(null!=r)return r}throw new Error("Expected one of the values to be non-null")};case Ops.Number:case Ops.String:return e=>{for(let t=0;t<n;++t){const n=i[t](e);if(typeof n===r)return n}throw new Error(`Expected one of the values to be a ${r}`)};default:throw new Error(`Unsupported assertion operator ${r}`)}}function compileAccessorExpression(e){const t=e.args[0].value;switch(e.operator){case Ops.Get:return r=>{const n=e.args;let i=r.properties[t];for(let e=1,t=n.length;e<t;++e)i=i[n[e].value];return i};case Ops.Var:return e=>e.variables[t];case Ops.Has:return r=>{const n=e.args;if(!(t in r.properties))return!1;let i=r.properties[t];for(let e=1,t=n.length;e<t;++e){const t=n[e].value;if(!i||!Object.hasOwn(i,t))return!1;i=i[t]}return!0};default:throw new Error(`Unsupported accessor operator ${e.operator}`)}}function compileComparisonExpression(e,t){const r=e.operator,n=compileExpression(e.args[0],t),i=compileExpression(e.args[1],t);switch(r){case Ops.Equal:return e=>n(e)===i(e);case Ops.NotEqual:return e=>n(e)!==i(e);case Ops.LessThan:return e=>n(e)<i(e);case Ops.LessThanOrEqualTo:return e=>n(e)<=i(e);case Ops.GreaterThan:return e=>n(e)>i(e);case Ops.GreaterThanOrEqualTo:return e=>n(e)>=i(e);default:throw new Error(`Unsupported comparison operator ${r}`)}}function compileLogicalExpression(e,t){const r=e.operator,n=e.args.length,i=new Array(n);for(let o=0;o<n;++o)i[o]=compileExpression(e.args[o],t);switch(r){case Ops.Any:return e=>{for(let t=0;t<n;++t)if(i[t](e))return!0;return!1};case Ops.All:return e=>{for(let t=0;t<n;++t)if(!i[t](e))return!1;return!0};case Ops.Between:return e=>{const t=i[0](e),r=i[1](e),n=i[2](e);return t>=r&&t<=n};case Ops.In:return e=>{const t=i[0](e);for(let r=1;r<n;++r)if(t===i[r](e))return!0;return!1};case Ops.Not:return e=>!i[0](e);default:throw new Error(`Unsupported logical operator ${r}`)}}function compileNumericExpression(e,t){const r=e.operator,n=e.args.length,i=new Array(n);for(let o=0;o<n;++o)i[o]=compileExpression(e.args[o],t);switch(r){case Ops.Multiply:return e=>{let t=1;for(let r=0;r<n;++r)t*=i[r](e);return t};case Ops.Divide:return e=>i[0](e)/i[1](e);case Ops.Add:return e=>{let t=0;for(let r=0;r<n;++r)t+=i[r](e);return t};case Ops.Subtract:return e=>i[0](e)-i[1](e);case Ops.Clamp:return e=>{const t=i[0](e),r=i[1](e);if(t<r)return r;const n=i[2](e);return t>n?n:t};case Ops.Mod:return e=>i[0](e)%i[1](e);case Ops.Pow:return e=>Math.pow(i[0](e),i[1](e));case Ops.Abs:return e=>Math.abs(i[0](e));case Ops.Floor:return e=>Math.floor(i[0](e));case Ops.Ceil:return e=>Math.ceil(i[0](e));case Ops.Round:return e=>Math.round(i[0](e));case Ops.Sin:return e=>Math.sin(i[0](e));case Ops.Cos:return e=>Math.cos(i[0](e));case Ops.Atan:return 2===n?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case Ops.Sqrt:return e=>Math.sqrt(i[0](e));default:throw new Error(`Unsupported numeric operator ${r}`)}}function compileCaseExpression(e,t){const r=e.args.length,n=new Array(r);for(let i=0;i<r;++i)n[i]=compileExpression(e.args[i],t);return e=>{for(let t=0;t<r-1;t+=2)if(n[t](e))return n[t+1](e);return n[r-1](e)}}function compileMatchExpression(e,t){const r=e.args.length,n=new Array(r);for(let i=0;i<r;++i)n[i]=compileExpression(e.args[i],t);return e=>{const t=n[0](e);for(let i=1;i<r-1;i+=2)if(t===n[i](e))return n[i+1](e);return n[r-1](e)}}function compileInterpolateExpression(e,t){const r=e.args.length,n=new Array(r);for(let i=0;i<r;++i)n[i]=compileExpression(e.args[i],t);return e=>{const t=n[0](e),i=n[1](e);let o,s;for(let a=2;a<r;a+=2){const r=n[a](e);let l=n[a+1](e);const c=Array.isArray(l);if(c&&(l=withAlpha(l)),r>=i)return 2===a?l:c?interpolateColor(t,i,o,s,r,l):interpolateNumber$1(t,i,o,s,r,l);o=r,s=l}return s}}function compileConvertExpression(e,t){const r=e.operator,n=e.args.length,i=new Array(n);for(let o=0;o<n;++o)i[o]=compileExpression(e.args[o],t);if(r===Ops.ToString)return t=>{const r=i[0](t);return e.args[0].type===ColorType$1?toString(r):r.toString()};throw new Error(`Unsupported convert operator ${r}`)}function interpolateNumber$1(e,t,r,n,i,o){const s=i-r;if(0===s)return n;const a=t-r;return n+(1===e?a/s:(Math.pow(e,a)-1)/(Math.pow(e,s)-1))*(o-n)}function interpolateColor(e,t,r,n,i,o){if(i-r===0)return n;const s=rgbaToLcha(n),a=rgbaToLcha(o);let l=a[2]-s[2];return l>180?l-=360:l<-180&&(l+=360),lchaToRgba([interpolateNumber$1(e,t,r,s[0],i,a[0]),interpolateNumber$1(e,t,r,s[1],i,a[1]),s[2]+interpolateNumber$1(e,t,r,0,i,l),interpolateNumber$1(e,t,r,n[3],i,o[3])])}var ImageState_default={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},ImageWrapper=class extends Target{constructor(e,t,r,n){super(),this.extent=e,this.pixelRatio_=r,this.resolution=t,this.state="function"==typeof n?ImageState_default.IDLE:n,this.image_=null,this.loader="function"==typeof n?n:null}changed(){this.dispatchEvent(EventType_default$2.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==ImageState_default.IDLE&&this.loader){this.state=ImageState_default.LOADING,this.changed();const e=this.getResolution(),t=Array.isArray(e)?e[0]:e;toPromise(()=>this.loader(this.getExtent(),t,this.getPixelRatio())).then(e=>{"image"in e&&(this.image_=e.image),"extent"in e&&(this.extent=e.extent),"resolution"in e&&(this.resolution=e.resolution),"pixelRatio"in e&&(this.pixelRatio_=e.pixelRatio),(e instanceof HTMLImageElement||CREATE_IMAGE_BITMAP&&e instanceof ImageBitmap||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement)&&(this.image_=e),this.state=ImageState_default.LOADED}).catch(e=>{this.state=ImageState_default.ERROR,console.error(e)}).finally(()=>this.changed())}}setImage(e){this.image_=e}setResolution(e){this.resolution=e}};function listenImage(e,t,r){const n=e;let i=!0,o=!1,s=!1;const a=[listenOnce(n,EventType_default$2.LOAD,function(){s=!0,o||t()})];return n.src&&IMAGE_DECODE?(o=!0,n.decode().then(function(){i&&t()}).catch(function(){i&&(s?t():r())})):a.push(listenOnce(n,EventType_default$2.ERROR,r)),function(){i=!1,a.forEach(unlistenByKey)}}function load(e,t){return new Promise((r,n)=>{function i(){s(),r(e)}function o(){s(),n(new Error("Image load error"))}function s(){e.removeEventListener("load",i),e.removeEventListener("error",o)}e.addEventListener("load",i),e.addEventListener("error",o),t&&(e.src=t)})}function decodeFallback(e,t){return t&&(e.src=t),e.src&&IMAGE_DECODE?new Promise((t,r)=>e.decode().then(()=>t(e)).catch(n=>e.complete&&e.width?t(e):r(n))):load(e)}var IconImageCache=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 e=0;for(const t in this.cache_){const r=this.cache_[t];3&e++||r.hasListener()||(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){const r=getCacheKey$1(e,t);return r in this.cache_?this.cache_[r]:null}getPattern(e,t){const r=getCacheKey$1(e,t);return r in this.patternCache_?this.patternCache_[r]:null}set(e,t,r,n){const i=getCacheKey$1(e,t),o=i in this.cache_;this.cache_[i]=r,n&&(r.getImageState()===ImageState_default.IDLE&&r.load(),r.getImageState()===ImageState_default.LOADING?r.ready().then(()=>{this.patternCache_[i]=getSharedCanvasContext2D().createPattern(r.getImage(1),"repeat")}):this.patternCache_[i]=getSharedCanvasContext2D().createPattern(r.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function getCacheKey$1(e,t){return e+":"+(t?asArray(t):"null")}var shared=new IconImageCache,taintedTestContext=null,IconImage=class extends Target{constructor(e,t,r,n,i){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.canvas_={},this.color_=i,this.imageState_=void 0===n?ImageState_default.IDLE:n,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===ImageState_default.LOADED){taintedTestContext||(taintedTestContext=createCanvasContext2D(1,1,void 0,{willReadFrequently:!0})),taintedTestContext.drawImage(this.image_,0,0);try{taintedTestContext.getImageData(0,0,1,1),this.tainted_=!1}catch{taintedTestContext=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(EventType_default$2.CHANGE)}handleImageError_(){this.imageState_=ImageState_default.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=ImageState_default.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],r=createCanvasContext2D(e,t);r.fillRect(0,0,e,t),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===ImageState_default.IDLE){this.image_||this.initializeImage_(),this.imageState_=ImageState_default.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&decodeFallback(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==ImageState_default.LOADED)return;const t=this.image_,r=createCanvasContext2D(Math.ceil(t.width*e),Math.ceil(t.height*e)),n=r.canvas;r.scale(e,e),r.drawImage(t,0,0),r.globalCompositeOperation="multiply",r.fillStyle=asString(this.color_),r.fillRect(0,0,n.width/e,n.height/e),r.globalCompositeOperation="destination-in",r.drawImage(t,0,0),this.canvas_[e]=n}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===ImageState_default.LOADED||this.imageState_===ImageState_default.ERROR)e();else{const t=()=>{this.imageState_!==ImageState_default.LOADED&&this.imageState_!==ImageState_default.ERROR||(this.removeEventListener(EventType_default$2.CHANGE,t),e())};this.addEventListener(EventType_default$2.CHANGE,t)}})),this.ready_}};function get$1(e,t,r,n,i,o){let s=void 0===t?void 0:shared.get(t,i);return s||(s=new IconImage(e,e&&"src"in e?e.src||void 0:t,r,n,i),shared.set(t,i,s,o)),o&&s&&!shared.getPattern(t,i)&&shared.set(t,i,s,o),s}function asColorLike(e){return e?Array.isArray(e)?toString(e):"object"==typeof e&&"src"in e?asCanvasPattern(e):e:null}function asCanvasPattern(e){if(!e.offset||!e.size)return shared.getPattern(e.src,e.color);const t=e.src+":"+e.offset,r=shared.getPattern(t,e.color);if(r)return r;const n=shared.get(e.src,null);if(n.getImageState()!==ImageState_default.LOADED)return null;const i=createCanvasContext2D(e.size[0],e.size[1]);return i.drawImage(n.getImage(1),e.offset[0],e.offset[1],e.size[0],e.size[1],0,0,e.size[0],e.size[1]),get$1(i.canvas,t,void 0,ImageState_default.LOADED,e.color,!0),shared.getPattern(t,e.color)}var defaultFont="10px sans-serif",defaultFillStyle="#000",defaultLineCap="round",defaultLineDash=[],defaultLineJoin="round",defaultStrokeStyle="#000",defaultTextAlign="center",defaultTextBaseline="middle",defaultPadding=[0,0,0,0],checkedFonts=new BaseObject,measureContext$1=null,measureFont,textHeights={},genericFontFamilies=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function getFontKey(e,t,r){return`${e} ${t} 16px "${r}"`}var registerFont=function(){const e=100;let t,r;async function n(e){await r.ready;const t=getFontParameters(e),n=t.families[0].toLowerCase(),i=t.weight,o=[];return r.forEach(e=>{const r=e.family.replace(/^['"]|['"]$/g,"").toLowerCase(),s=fontWeights$1[e.weight]||e.weight;r===n&&e.style===t.style&&s==i&&o.push(e)}),0!==o.length&&(await Promise.all(o.map(e=>e.load().then(()=>!0,()=>!1)))).some(e=>e)}async function i(){await r.ready;let o=!0;const s=checkedFonts.getProperties(),a=Object.keys(s).filter(t=>s[t]<e);for(let t=a.length-1;t>=0;--t){const r=a[t];let i=s[r];i<e&&(await n(r)?(clear(textHeights),checkedFonts.set(r,e)):(i+=10,checkedFonts.set(r,i,!0),i<e&&(o=!1)))}t=void 0,o||(t=setTimeout(i,100))}return async function(e){r||(r=WORKER_OFFSCREEN_CANVAS?self.fonts:document.fonts);const n=getFontParameters(e);if(!n)return;const o=n.families;let s=!1;for(const t of o){if(genericFontFamilies.has(t))continue;const e=getFontKey(n.style,n.weight,t);void 0===checkedFonts.get(e)&&(checkedFonts.set(e,0,!0),s=!0)}s&&(clearTimeout(t),t=setTimeout(i,100))}}(),measureTextHeight=function(){let e;return function(t){let r=textHeights[t];if(null==r){if(WORKER_OFFSCREEN_CANVAS){const e=getFontParameters(t),n=measureText$1(t,"Žg");r=(isNaN(Number(e.lineHeight))?1.2:Number(e.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else e||(e=document.createElement("div"),e.innerHTML="M",e.style.minHeight="0",e.style.maxHeight="none",e.style.height="auto",e.style.padding="0",e.style.border="none",e.style.position="absolute",e.style.display="block",e.style.left="-99999px"),e.style.font=t,document.body.appendChild(e),r=e.offsetHeight,document.body.removeChild(e);textHeights[t]=r}return r}}();function measureText$1(e,t){return measureContext$1||(measureContext$1=createCanvasContext2D(1,1)),e!=measureFont&&(measureContext$1.font=e,measureFont=measureContext$1.font),measureContext$1.measureText(t)}function measureTextWidth(e,t){return measureText$1(e,t).width}function measureAndCacheTextWidth(e,t,r){if(t in r)return r[t];const n=t.split("\n").reduce((t,r)=>Math.max(t,measureTextWidth(e,r)),0);return r[t]=n,n}function getTextDimensions(e,t){const r=[],n=[],i=[];let o=0,s=0,a=0,l=0;for(let c=0,u=t.length;c<=u;c+=2){const h=t[c];if("\n"===h||c===u){o=Math.max(o,s),i.push(s),s=0,a+=l,l=0;continue}const d=t[c+1]||e.font,p=measureTextWidth(d,h);r.push(p),s+=p;const f=measureTextHeight(d);n.push(f),l=Math.max(l,f)}return{width:o,height:a,widths:r,heights:n,lineWidths:i}}function drawImageOrLabel(e,t,r,n,i,o,s,a,l,c,u){e.save(),1!==r&&(void 0===e.globalAlpha?e.globalAlpha=e=>e.globalAlpha*=r:e.globalAlpha*=r),t&&e.transform.apply(e,t),n.contextInstructions?(e.translate(l,c),e.scale(u[0],u[1]),executeLabelInstructions(n,e)):u[0]<0||u[1]<0?(e.translate(l,c),e.scale(u[0],u[1]),e.drawImage(n,i,o,s,a,0,0,s,a)):e.drawImage(n,i,o,s,a,l,c,s*u[0],a*u[1]),e.restore()}function executeLabelInstructions(e,t){const r=e.contextInstructions;for(let n=0,i=r.length;n<i;n+=2)Array.isArray(r[n+1])?t[r[n]].apply(t,r[n+1]):t[r[n]]=r[n+1]}var ImageStyle=class e{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=toSize(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const t=this.getScale();return new e({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 abstract()}getImage(e){return abstract()}getHitDetectionImage(){return abstract()}getPixelRatio(e){return 1}getImageState(){return abstract()}getImageSize(){return abstract()}getOrigin(){return abstract()}getSize(){return abstract()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=toSize(e)}listenImageChange(e){abstract()}load(){abstract()}unlistenImageChange(e){abstract()}ready(){return Promise.resolve()}},RegularShape=class e extends ImageStyle{constructor(e){super({opacity:1,rotateWithView:void 0!==e.rotateWithView&&e.rotateWithView,rotation:void 0!==e.rotation?e.rotation:0,scale:void 0!==e.scale?e.scale:1,displacement:void 0!==e.displacement?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==e.fill?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=void 0!==e.angle?e.angle:0,this.stroke_=void 0!==e.stroke?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?ImageState_default.LOADING:ImageState_default.LOADED,this.imageState_===ImageState_default.LOADING&&this.ready().then(()=>this.imageState_=ImageState_default.LOADED),this.render()}clone(){const t=this.getScale(),r=new e({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 r.setOpacity(this.getOpacity()),r}getAnchor(){const e=this.size_,t=this.getDisplacement(),r=this.getScaleArray();return[e[0]/2-t[0]/r[0],e[1]/2+t[1]/r[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){const t=this.fill_?.getKey(),r=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(",");let n=shared.get(r,null)?.getImage(1);if(!n){const t=this.renderOptions_,i=Math.ceil(t.size*e),o=createCanvasContext2D(i,i);this.draw_(t,o,e),n=o.canvas;const s=new IconImage(n,void 0,null,ImageState_default.LOADED,null);shared.set(r,null,s),createImageBitmap(n).then(e=>{s.setImage(e)})}return n}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,r){if(0===t||this.points_===1/0||"bevel"!==e&&"miter"!==e)return t;let n=this.radius,i=void 0===this.radius2_?n:this.radius2_;if(n<i){const e=n;n=i,i=e}const o=void 0===this.radius2_?this.points_:2*this.points_,s=2*Math.PI/o,a=i*Math.sin(s),l=n-Math.sqrt(i*i-a*a),c=Math.sqrt(a*a+l*l),u=c/a;if("miter"===e&&u<=r)return u*t;const h=t/2/u,d=t/2*(l/c),p=Math.sqrt((n+h)*(n+h)+d*d)-n;if(void 0===this.radius2_||"bevel"===e)return 2*p;const f=n*Math.sin(s),g=i-Math.sqrt(n*n-f*f),m=Math.sqrt(f*f+g*g)/f;if(m<=r){const e=m*t/2-i-n;return 2*Math.max(p,e)}return 2*p}createRenderOptions(){let e,t=defaultLineCap,r=defaultLineJoin,n=0,i=null,o=0,s=0;this.stroke_&&(e=asColorLike(this.stroke_.getColor()??"#000"),s=this.stroke_.getWidth()??1,i=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset()??0,r=this.stroke_.getLineJoin()??"round",t=this.stroke_.getLineCap()??"round",n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(r,s,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:e,strokeWidth:s,size:Math.ceil(2*l+a),lineCap:t,lineDash:i,lineDashOffset:o,lineJoin:r,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,r){if(t.scale(r,r),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let e=this.fill_.getColor();null===e&&(e=defaultFillStyle),t.fillStyle=asColorLike(e),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let r=this.fill_.getColor(),n=0;"string"==typeof r&&(r=asArray(r)),null===r?n=1:Array.isArray(r)&&(n=4===r.length?r[3]:1),0===n&&(t=createCanvasContext2D(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_;const r=this.radius;if(t===1/0)e.arc(0,0,r,0,2*Math.PI);else{const n=void 0===this.radius2_?r:this.radius2_;void 0!==this.radius2_&&(t*=2);const i=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let s=0;s<t;s++){const t=i+s*o,a=s%2==0?r:n;e.lineTo(a*Math.cos(t),a*Math.sin(t))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=defaultFillStyle,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},CircleStyle=class e extends RegularShape{constructor(e){super({points:1/0,fill:(e=e||{radius:5}).fill,radius:e.radius,stroke:e.stroke,scale:void 0!==e.scale?e.scale:1,rotation:void 0!==e.rotation?e.rotation:0,rotateWithView:void 0!==e.rotateWithView&&e.rotateWithView,displacement:void 0!==e.displacement?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){const t=this.getScale(),r=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return r.setOpacity(this.getOpacity()),r}},Fill=class e{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,void 0!==e.color&&this.setColor(e.color)}clone(){const t=this.getColor();return new e({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(e){if(null!==e&&"object"==typeof e&&"src"in e){const t=get$1(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===ImageState_default.IDLE&&t.load(),t.getImageState()===ImageState_default.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){const e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?getUid(e):"object"==typeof e&&"src"in e?e.src+":"+e.offset:asArray(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}};function calculateScale(e,t,r,n){return void 0!==r&&void 0!==n?[r/e,n/t]:void 0!==r?r/e:void 0!==n?n/t:1}var Icon=class e extends ImageStyle{constructor(e){const t=void 0!==(e=e||{}).opacity?e.opacity:1,r=void 0!==e.rotation?e.rotation:0,n=void 0!==e.scale?e.scale:1,i=void 0!==e.rotateWithView&&e.rotateWithView;super({opacity:t,rotation:r,scale:n,displacement:void 0!==e.displacement?e.displacement:[0,0],rotateWithView:i,declutterMode:e.declutterMode}),this.anchor_=void 0!==e.anchor?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==e.anchorOrigin?e.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==e.anchorXUnits?e.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==e.anchorYUnits?e.anchorYUnits:"fraction",this.crossOrigin_=void 0!==e.crossOrigin?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;const o=void 0!==e.img?e.img:null;let s,a=e.src;if(assert$1(!(void 0!==a&&o),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!o||(a=o.src||getUid(o)),assert$1(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),assert$1(!((void 0!==e.width||void 0!==e.height)&&void 0!==e.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==e.src?s=ImageState_default.IDLE:void 0!==o&&(s="complete"in o?o.complete?o.src?ImageState_default.LOADED:ImageState_default.IDLE:ImageState_default.LOADING:ImageState_default.LOADED),this.color_=void 0!==e.color?asArray(e.color):null,this.iconImage_=get$1(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_),this.offset_=void 0!==e.offset?e.offset:[0,0],this.offsetOrigin_=void 0!==e.offsetOrigin?e.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==e.size?e.size:null,this.initialOptions_,void 0!==e.width||void 0!==e.height){let t,r;if(e.size)[t,r]=e.size;else{const n=this.getImage(1);if(n.width&&n.height)t=n.width,r=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=e;const t=()=>{if(this.unlistenImageChange(t),!this.initialOptions_)return;const r=this.iconImage_.getSize();this.setScale(calculateScale(r[0],r[1],e.width,e.height))};return void this.listenImageChange(t)}}void 0!==t&&this.setScale(calculateScale(t,r,e.width,e.height))}}clone(){let t,r,n;return this.initialOptions_?(r=this.initialOptions_.width,n=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new e({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_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:r,height:n,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const t=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!t)return null;e=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(e[0]*=t[0]),"fraction"==this.anchorYUnits_&&(e[1]*=t[1])}if("top-left"!=this.anchorOrigin_){if(!t)return null;e===this.anchor_&&(e=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(e[0]=-e[0]+t[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(e[1]=-e[1]+t[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),r=this.getScaleArray();return[e[0]-t[0]/r[0],e[1]+t[1]/r[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){const t=e?asArray(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((e,r)=>e===t[r]))return;this.color_=t;const r=this.getSrc(),n=void 0!==r?null:this.getHitDetectionImage(),i=void 0!==r?ImageState_default.IDLE:this.iconImage_.getImageState();this.iconImage_=get$1(n,r,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},i,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if("top-left"!=this.offsetOrigin_){const t=this.getSize(),r=this.iconImage_.getSize();if(!t||!r)return null;e=e.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(e[0]=r[0]-t[0]-e[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(e[1]=r[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=get$1(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},ImageState_default.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const e=this.getScaleArray();return this.size_?this.size_[0]*e[0]:this.iconImage_.getImageState()==ImageState_default.LOADED?this.iconImage_.getSize()[0]*e[0]:void 0}getHeight(){const e=this.getScaleArray();return this.size_?this.size_[1]*e[1]:this.iconImage_.getImageState()==ImageState_default.LOADED?this.iconImage_.getSize()[1]*e[1]:void 0}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(EventType_default$2.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(EventType_default$2.CHANGE,e)}ready(){return this.iconImage_.ready()}},Stroke=class e{constructor(e){e=e||{},this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){const t=this.getColor();return new e({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(),offset:this.getOffset(),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_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},Style=class e{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=defaultGeometryFunction,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.hitDetectionRenderer_=void 0!==e.hitDetectionRenderer?e.hitDetectionRenderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new e({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(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){"function"==typeof e?this.geometryFunction_=e:"string"==typeof e?this.geometryFunction_=function(t){return t.get(e)}:e?void 0!==e&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=defaultGeometryFunction,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function toFunction(e){let t;if("function"==typeof e)t=e;else{let r;Array.isArray(e)?r=e:(assert$1("function"==typeof e.getZIndex,"Expected an `Style` or an array of `Style`"),r=[e]),t=function(){return r}}return t}var defaultStyles=null;function createDefaultStyle(){if(!defaultStyles){const e=new Fill({color:"rgba(255,255,255,0.4)"}),t=new Stroke({color:"#3399CC",width:1.25});defaultStyles=[new Style({image:new CircleStyle({fill:e,stroke:t,radius:5}),fill:e,stroke:t})]}return defaultStyles}function defaultGeometryFunction(e){return e.getGeometry()}var DEFAULT_FILL_COLOR="#333",Text=class e{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=toSize(void 0!==e.scale?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new Fill({color:DEFAULT_FILL_COLOR}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding,this.declutterMode_=e.declutterMode}clone(){const t=this.getScale();return new e({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(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof Fill?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(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=toSize(void 0!==e?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}};function always(){return!0}function rulesToStyleFunction(e,t){const r=buildRuleSet(e,t=t??newParsingContext()),n=newEvaluationContext();return function(e,i){if(n.properties=e.getPropertiesInternal(),n.resolution=i,t.featureId){const t=e.getId();n.featureId=void 0!==t?t:null}return t.geometryType&&(n.geometryType=computeGeometryType(e.getGeometry())),r(n)}}function flatStylesToStyleFunction(e,t){t=t??newParsingContext();const r=e.length,n=new Array(r);for(let s=0;s<r;++s)n[s]=buildStyle(e[s],t);const i=newEvaluationContext(),o=new Array(r);return function(e,s){if(i.properties=e.getPropertiesInternal(),i.resolution=s,t.featureId){const t=e.getId();i.featureId=void 0!==t?t:null}t.geometryType&&(i.geometryType=computeGeometryType(e.getGeometry()));let a=0;for(let t=0;t<r;++t){const e=n[t](i);e&&(o[a]=e,a+=1)}return o.length=a,o}}function flatStyleLikeToStyleFunction(e,t){if(t=t??newParsingContext(),!Array.isArray(e))return flatStylesToStyleFunction([e],t);const r=e.length;if("style"in e[0]){const n=new Array(r);for(let t=0;t<r;++t){const r=e[t];if(!("style"in r))throw new Error("Expected a list of rules with a style property");n[t]=r}return rulesToStyleFunction(n,t)}return flatStylesToStyleFunction(e,t)}function buildRuleSet(e,t){const r=e.length,n=new Array(r);for(let i=0;i<r;++i){const r=e[i],o="filter"in r?buildExpression(r.filter,BooleanType$1,t):always;let s;if(Array.isArray(r.style)){const e=r.style.length;s=new Array(e);for(let n=0;n<e;++n)s[n]=buildStyle(r.style[n],t)}else s=[buildStyle(r.style,t)];n[i]={filter:o,styles:s}}return function(t){const i=[];let o=!1;for(let s=0;s<r;++s)if((0,n[s].filter)(t)&&(!e[s].else||!o)){o=!0;for(const e of n[s].styles){const r=e(t);r&&i.push(r)}}return i}}function buildStyle(e,t){const r=buildFill(e,"",t),n=buildStroke(e,"",t),i=buildText(e,t),o=buildImage(e,t),s=numberEvaluator(e,"z-index",t);if(!(r||n||i||o||isEmpty$1(e)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(e));const a=new Style;return function(e){let t=!0;if(r){const n=r(e);n&&(t=!1),a.setFill(n)}if(n){const r=n(e);r&&(t=!1),a.setStroke(r)}if(i){const r=i(e);r&&(t=!1),a.setText(r)}if(o){const r=o(e);r&&(t=!1),a.setImage(r)}return s&&a.setZIndex(s(e)),t?null:a}}function buildFill(e,t,r){let n;if(t+"fill-pattern-src"in e)n=patternEvaluator(e,t+"fill-",r);else{if("none"===e[t+"fill-color"])return()=>null;n=colorLikeEvaluator(e,t+"fill-color",r)}if(!n)return null;const i=new Fill;return function(e){const t=n(e);return t===NO_COLOR?null:(i.setColor(t),i)}}function buildStroke(e,t,r){const n=numberEvaluator(e,t+"stroke-width",r),i=colorLikeEvaluator(e,t+"stroke-color",r);if(!n&&!i)return null;const o=stringEvaluator(e,t+"stroke-line-cap",r),s=stringEvaluator(e,t+"stroke-line-join",r),a=numberArrayEvaluator(e,t+"stroke-line-dash",r),l=numberEvaluator(e,t+"stroke-line-dash-offset",r),c=numberEvaluator(e,t+"stroke-miter-limit",r),u=numberEvaluator(e,t+"stroke-offset",r),h=new Stroke;return function(e){if(i){const t=i(e);if(t===NO_COLOR)return null;h.setColor(t)}if(n&&h.setWidth(n(e)),o){const t=o(e);if("butt"!==t&&"round"!==t&&"square"!==t)throw new Error("Expected butt, round, or square line cap");h.setLineCap(t)}if(s){const t=s(e);if("bevel"!==t&&"round"!==t&&"miter"!==t)throw new Error("Expected bevel, round, or miter line join");h.setLineJoin(t)}return a&&h.setLineDash(a(e)),l&&h.setLineDashOffset(l(e)),c&&h.setMiterLimit(c(e)),u&&h.setOffset(u(e)),h}}function buildText(e,t){const r="text-",n=stringEvaluator(e,"text-value",t);if(!n)return null;const i=buildFill(e,r,t),o=buildFill(e,"text-background-",t),s=buildStroke(e,r,t),a=buildStroke(e,"text-background-",t),l=stringEvaluator(e,"text-font",t),c=numberEvaluator(e,"text-max-angle",t),u=numberEvaluator(e,"text-offset-x",t),h=numberEvaluator(e,"text-offset-y",t),d=booleanEvaluator(e,"text-overflow",t),p=stringEvaluator(e,"text-placement",t),f=numberEvaluator(e,"text-repeat",t),g=sizeLikeEvaluator(e,"text-scale",t),m=booleanEvaluator(e,"text-rotate-with-view",t),y=numberEvaluator(e,"text-rotation",t),v=stringEvaluator(e,"text-align",t),_=stringEvaluator(e,"text-justify",t),b=stringEvaluator(e,"text-baseline",t),E=booleanEvaluator(e,"text-keep-upright",t),w=numberArrayEvaluator(e,"text-padding",t),C=optionalDeclutterMode(e,"text-declutter-mode"),S=new Text({declutterMode:C});return function(e){if(S.setText(n(e)),i&&S.setFill(i(e)),o&&S.setBackgroundFill(o(e)),s&&S.setStroke(s(e)),a&&S.setBackgroundStroke(a(e)),l&&S.setFont(l(e)),c&&S.setMaxAngle(c(e)),u&&S.setOffsetX(u(e)),h&&S.setOffsetY(h(e)),d&&S.setOverflow(d(e)),p){const t=p(e);if("point"!==t&&"line"!==t)throw new Error("Expected point or line for text-placement");S.setPlacement(t)}if(f&&S.setRepeat(f(e)),g&&S.setScale(g(e)),m&&S.setRotateWithView(m(e)),y&&S.setRotation(y(e)),v){const t=v(e);if("left"!==t&&"center"!==t&&"right"!==t&&"end"!==t&&"start"!==t)throw new Error("Expected left, right, center, start, or end for text-align");S.setTextAlign(t)}if(_){const t=_(e);if("left"!==t&&"right"!==t&&"center"!==t)throw new Error("Expected left, right, or center for text-justify");S.setJustify(t)}if(b){const t=b(e);if("bottom"!==t&&"top"!==t&&"middle"!==t&&"alphabetic"!==t&&"hanging"!==t)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");S.setTextBaseline(t)}return w&&S.setPadding(w(e)),E&&S.setKeepUpright(E(e)),S}}function buildImage(e,t){return"icon-src"in e?buildIcon(e,t):"shape-points"in e?buildShape(e,t):"circle-radius"in e?buildCircle(e,t):null}function buildIcon(e,t){const r="icon-src",n=requireString(e[r],r),i=coordinateEvaluator(e,"icon-anchor",t),o=sizeLikeEvaluator(e,"icon-scale",t),s=numberEvaluator(e,"icon-opacity",t),a=coordinateEvaluator(e,"icon-displacement",t),l=numberEvaluator(e,"icon-rotation",t),c=booleanEvaluator(e,"icon-rotate-with-view",t),u=optionalIconOrigin(e,"icon-anchor-origin"),h=optionalIconAnchorUnits(e,"icon-anchor-x-units"),d=optionalIconAnchorUnits(e,"icon-anchor-y-units"),p=getExpressionValue(e,"icon-color");let f,g=null;void 0!==p&&(Array.isArray(p)&&p.length>0&&"string"==typeof p[0]?g=colorLikeEvaluator(e,"icon-color",t):f=requireColorLike(p,"icon-color"));const m=optionalString(e,"icon-cross-origin"),y=optionalNumberArray(e,"icon-offset"),v=optionalIconOrigin(e,"icon-offset-origin"),_=optionalNumber(e,"icon-width"),b={src:n,anchorOrigin:u,anchorXUnits:h,anchorYUnits:d,crossOrigin:m,offset:y,offsetOrigin:v,height:optionalNumber(e,"icon-height"),width:_,size:optionalSize(e,"icon-size"),declutterMode:optionalDeclutterMode(e,"icon-declutter-mode")};let E=null;return function(e){if(E)g&&E.setColor(g(e));else{const t=g?g(e):f;E=new Icon(void 0!==t?Object.assign({},b,{color:t}):Object.assign({},b))}return s&&E.setOpacity(s(e)),a&&E.setDisplacement(a(e)),l&&E.setRotation(l(e)),c&&E.setRotateWithView(c(e)),o&&E.setScale(o(e)),i&&E.setAnchor(i(e)),E}}function buildShape(e,t){const r="shape-",n="shape-points",i="shape-radius",o=requireNumber(e[n],n);if(!(i in e))throw new Error(`Expected a number for ${i}`);const s=numberEvaluator(e,i,t),a="number"==typeof e[i]?e[i]:5,l="shape-radius2",c=numberEvaluator(e,l,t),u="number"==typeof e[l]?e[l]:void 0,h=buildFill(e,r,t),d=buildStroke(e,r,t),p=sizeLikeEvaluator(e,"shape-scale",t),f=coordinateEvaluator(e,"shape-displacement",t),g=numberEvaluator(e,"shape-rotation",t),m=booleanEvaluator(e,"shape-rotate-with-view",t),y=optionalNumber(e,"shape-angle"),v=optionalDeclutterMode(e,"shape-declutter-mode"),_=new RegularShape({points:o,radius:a,radius2:u,angle:y,declutterMode:v});return function(e){return s&&_.setRadius(s(e)),c&&_.setRadius2(c(e)),h&&_.setFill(h(e)),d&&_.setStroke(d(e)),f&&_.setDisplacement(f(e)),g&&_.setRotation(g(e)),m&&_.setRotateWithView(m(e)),p&&_.setScale(p(e)),_}}function buildCircle(e,t){const r="circle-",n=buildFill(e,r,t),i=buildStroke(e,r,t),o=numberEvaluator(e,"circle-radius",t),s=sizeLikeEvaluator(e,"circle-scale",t),a=coordinateEvaluator(e,"circle-displacement",t),l=numberEvaluator(e,"circle-rotation",t),c=booleanEvaluator(e,"circle-rotate-with-view",t),u=optionalDeclutterMode(e,"circle-declutter-mode"),h=new CircleStyle({radius:5,declutterMode:u});return function(e){return o&&h.setRadius(o(e)),n&&h.setFill(n(e)),i&&h.setStroke(i(e)),a&&h.setDisplacement(a(e)),l&&h.setRotation(l(e)),c&&h.setRotateWithView(c(e)),s&&h.setScale(s(e)),h}}function getExpressionValue(e,t){if(!(t in e))return;const r=e[t];return void 0===r?void 0:r}function numberEvaluator(e,t,r){const n=getExpressionValue(e,t);if(void 0===n)return;const i=buildExpression(n,NumberType$1,r);return function(e){return requireNumber(i(e),t)}}function stringEvaluator(e,t,r){const n=getExpressionValue(e,t);if(void 0===n)return null;const i=buildExpression(n,StringType$1,r);return function(e){return requireString(i(e),t)}}function patternEvaluator(e,t,r){const n=stringEvaluator(e,t+"pattern-src",r),i=sizeEvaluator(e,t+"pattern-offset",r),o=sizeEvaluator(e,t+"pattern-size",r),s=colorLikeEvaluator(e,t+"color",r);return function(e){return{src:n(e),offset:i&&i(e),size:o&&o(e),color:s&&s(e)}}}function booleanEvaluator(e,t,r){const n=getExpressionValue(e,t);if(void 0===n)return null;const i=buildExpression(n,BooleanType$1,r);return function(e){const r=i(e);if("boolean"!=typeof r)throw new Error(`Expected a boolean for ${t}`);return r}}function colorLikeEvaluator(e,t,r){const n=getExpressionValue(e,t);if(void 0===n)return null;const i=buildExpression(n,ColorType$1,r);return function(e){return requireColorLike(i(e),t)}}function numberArrayEvaluator(e,t,r){const n=getExpressionValue(e,t);if(void 0===n)return null;if(Array.isArray(n)&&(0===n.length||"string"!=typeof n[0])){const e=n.map((e,n)=>{if("number"==typeof e)return()=>e;const i=buildExpression(e,NumberType$1,r);return function(e){return requireNumber(i(e),`${t}[${n}]`)}});return function(t){const r=new Array(e.length);for(let n=0;n<e.length;++n)r[n]=e[n](t);return r}}const i=buildExpression(n,NumberArrayType$1,r);return function(e){return requireNumberArray(i(e),t)}}function coordinateEvaluator(e,t,r){const n=getExpressionValue(e,t);if(void 0===n)return null;const i=buildExpression(n,NumberArrayType$1,r);return function(e){const r=requireNumberArray(i(e),t);if(2!==r.length)throw new Error(`Expected two numbers for ${t}`);return r}}function sizeEvaluator(e,t,r){const n=getExpressionValue(e,t);if(void 0===n)return null;const i=buildExpression(n,NumberArrayType$1,r);return function(e){return requireSize(i(e),t)}}function sizeLikeEvaluator(e,t,r){const n=getExpressionValue(e,t);if(void 0===n)return null;const i=buildExpression(n,NumberArrayType$1|NumberType$1,r);return function(e){return requireSizeLike(i(e),t)}}function optionalNumber(e,t){const r=e[t];if(void 0!==r){if("number"!=typeof r)throw new Error(`Expected a number for ${t}`);return r}}function optionalSize(e,t){const r=e[t];if(void 0!==r){if("number"==typeof r)return toSize(r);if(!Array.isArray(r))throw new Error(`Expected a number or size array for ${t}`);if(2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])throw new Error(`Expected a number or size array for ${t}`);return r}}function optionalString(e,t){const r=e[t];if(void 0!==r){if("string"!=typeof r)throw new Error(`Expected a string for ${t}`);return r}}function optionalIconOrigin(e,t){const r=e[t];if(void 0!==r){if("bottom-left"!==r&&"bottom-right"!==r&&"top-left"!==r&&"top-right"!==r)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return r}}function optionalIconAnchorUnits(e,t){const r=e[t];if(void 0!==r){if("pixels"!==r&&"fraction"!==r)throw new Error(`Expected pixels or fraction for ${t}`);return r}}function optionalNumberArray(e,t){const r=e[t];if(void 0!==r)return requireNumberArray(r,t)}function optionalDeclutterMode(e,t){const r=e[t];if(void 0!==r){if("string"!=typeof r)throw new Error(`Expected a string for ${t}`);if("declutter"!==r&&"obstacle"!==r&&"none"!==r)throw new Error(`Expected declutter, obstacle, or none for ${t}`);return r}}function requireNumberArray(e,t){if(!Array.isArray(e))throw new Error(`Expected an array for ${t}`);const r=e.length;for(let n=0;n<r;++n)if("number"!=typeof e[n])throw new Error(`Expected an array of numbers for ${t}`);return e}function requireString(e,t){if("string"!=typeof e)throw new Error(`Expected a string for ${t}`);return e}function requireNumber(e,t){if("number"!=typeof e)throw new Error(`Expected a number for ${t}`);return e}function requireColorLike(e,t){if("string"==typeof e)return e;const r=requireNumberArray(e,t),n=r.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return r}function requireSize(e,t){const r=requireNumberArray(e,t);if(2!==r.length)throw new Error(`Expected an array of two numbers for ${t}`);return r}function requireSizeLike(e,t){return"number"==typeof e?e:requireSize(e,t)}var Property$2={RENDER_ORDER:"renderOrder"},BaseVectorLayer=class extends Layer{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=void 0!==e.renderBuffer?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=void 0!==e.updateWhileAnimating&&e.updateWhileAnimating,this.updateWhileInteracting_=void 0!==e.updateWhileInteracting&&e.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Property$2.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){const r=this.getDeclutter();r in e.declutter==0&&(e.declutter[r]=new RBush$1(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Property$2.RENDER_ORDER,e)}setStyle(e){this.style_=void 0===e?createDefaultStyle:e;const t=toStyleLike(e);this.styleFunction_=null===e?void 0:toFunction(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function toStyleLike(e){if(void 0===e)return createDefaultStyle;if(!e)return null;if("function"==typeof e)return e;if(e instanceof Style)return e;if(Array.isArray(e)&&0===e.length)return[];if(Array.isArray(e)&&e[0]instanceof Style){const t=e.length,r=new Array(t);for(let n=0;n<t;++n){const t=e[n];if(!(t instanceof Style))throw new Error("Expected a list of style instances");r[n]=t}return r}return flatStyleLikeToStyleFunction(e)}var RenderEvent=class extends BaseEvent{constructor(e,t,r,n){super(e),this.inversePixelTransform=t,this.frameState=r,this.context=n}},MapRenderer=class extends Disposable{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){abstract()}calculateMatrices2D(e){const t=e.viewState,r=e.coordinateToPixelTransform,n=e.pixelToCoordinateTransform;compose(r,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),makeInverse(n,r)}forEachFeatureAtCoordinate(e,t,r,n,i,o,s,a){let l;const c=t.viewState;function u(e,t,r,n){return i.call(o,t,e?r:null,n)}const h=c.projection,d=wrapX$1(e.slice(),h),p=[[0,0]];if(h.canWrapX()&&n){const e=getWidth(h.getExtent());p.push([-e,0],[e,0])}const f=t.layerStatesArray,g=f.length,m=[],y=[];for(let _=0;_<p.length;_++)for(let n=g-1;n>=0;--n){const i=f[n],o=i.layer;if(o.hasRenderer()&&inView(i,c)&&s.call(a,o)){const n=o.getRenderer(),s=o.getSource();if(n&&s){const o=s.getWrapX()?d:e,a=u.bind(null,i.managed);y[0]=o[0]+p[_][0],y[1]=o[1]+p[_][1],l=n.forEachFeatureAtCoordinate(y,t,r,a,m)}if(l)return l}}if(0===m.length)return;const v=1/m.length;return m.forEach((e,t)=>e.distanceSq+=t*v),m.sort((e,t)=>e.distanceSq-t.distanceSq),m.some(e=>l=e.callback(e.feature,e.layer,e.geometry)),l}hasFeatureAtCoordinate(e,t,r,n,i,o){return void 0!==this.forEachFeatureAtCoordinate(e,t,r,n,TRUE,this,i,o)}getMap(){return this.map_}renderFrame(e){abstract()}scheduleExpireIconCache(e){shared.canExpireCache()&&e.postRenderFunctions.push(expireIconCache)}};function expireIconCache(){shared.expire()}var CompositeMapRenderer=class extends MapRenderer{constructor(e){super(e),this.fontChangeListenerKey_=listen(checkedFonts,ObjectEventType_default.PROPERTYCHANGE,e.redrawText,e),this.element_=WORKER_OFFSCREEN_CANVAS?createMockDiv():document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=CLASS_UNSELECTABLE+" ol-layers";const r=e.getViewport();r&&r.insertBefore(this.element_,r.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const r=this.getMap();if(r.hasListener(e)){const n=new RenderEvent(e,void 0,t);r.dispatchEvent(n)}}disposeInternal(){unlistenByKey(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(e),this.dispatchRenderEvent(EventType_default.PRECOMPOSE,e);const t=e.layerStatesArray.sort((e,t)=>e.zIndex-t.zIndex);t.some(e=>e.layer instanceof BaseVectorLayer&&e.layer.getDeclutter())&&(e.declutter={});const r=e.viewState;this.children_.length=0;const n=this.getMap().getTargetElement();let i;isCanvas(n)&&(i=n.getContext("2d"),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,n.width,n.height));const o=[];let s=i?n:null;for(let a=0,l=t.length;a<l;++a){const n=t[a];e.layerIndex=a;const i=n.layer,l=i.getSourceState();if(!inView(n,r)||"ready"!=l&&"undefined"!=l){i.unrender();continue}const c=i.render(e,s);c&&(c!==s&&(this.children_.push(c),s=c),o.push(n))}this.declutter(e,o),replaceChildren(this.element_,this.children_);for(const a of i?this.children_:[]){const e=a.firstElementChild||a,t=a.style.backgroundColor;if(t&&(!isCanvas(e)||e.width>0)&&(i.fillStyle=t,i.fillRect(0,0,i.canvas.width,i.canvas.height)),!isCanvas(e)||0===e.width)continue;i.save();const r=a.style.opacity||e.style.opacity;i.globalAlpha=""===r?1:Number(r);const n=e.style.transform;if(n)i.transform(...fromString$1(n));else{const t=parseFloat(e.style.width)/e.width,r=parseFloat(e.style.height)/e.height;i.transform(t,0,0,r,0,0)}i.drawImage(e,0,0),i.restore()}this.dispatchRenderEvent(EventType_default.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let r=t.length-1;r>=0;--r){const n=t[r],i=n.layer;i.getDeclutter()&&i.renderDeclutter(e,n)}t.forEach(t=>t.layer.renderDeferred(e))}}};function removeLayerMapProperty(e){e instanceof Layer?e.setMapInternal(null):e instanceof LayerGroup&&e.getLayers().forEach(removeLayerMapProperty)}function setLayerMapProperty(e,t){if(e instanceof Layer)e.setMapInternal(t);else if(e instanceof LayerGroup){const r=e.getLayers().getArray();for(let e=0,n=r.length;e<n;++e)setLayerMapProperty(r[e],t)}}var Map$1=class extends BaseObject{constructor(e){super(),e=e||{},this.on,this.once,this.un;const t=createOptionsInternal(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==e.maxTilesLoading?e.maxTilesLoading:16,this.pixelRatio_=void 0!==e.pixelRatio?e.pixelRatio:DEVICE_PIXEL_RATIO,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=create(),this.pixelToCoordinateTransform_=create(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,WORKER_OFFSCREEN_CANVAS||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,WORKER_OFFSCREEN_CANVAS||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(WORKER_OFFSCREEN_CANVAS?new Collection:defaults$1()),this.interactions=t.interactions||(WORKER_OFFSCREEN_CANVAS?new Collection:defaults({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new TileQueue(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(MapProperty_default.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(MapProperty_default.VIEW,this.handleViewChanged_),this.addChangeListener(MapProperty_default.SIZE,this.handleSizeChanged_),this.addChangeListener(MapProperty_default.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const r=this;!e.view||e.view instanceof View||e.view.then(function(e){r.setView(new View(e))}),this.controls.addEventListener(CollectionEventType_default.ADD,e=>{e.element.setMap(this)}),this.controls.addEventListener(CollectionEventType_default.REMOVE,e=>{e.element.setMap(null)}),this.interactions.addEventListener(CollectionEventType_default.ADD,e=>{e.element.setMap(this)}),this.interactions.addEventListener(CollectionEventType_default.REMOVE,e=>{e.element.setMap(null)}),this.overlays_.addEventListener(CollectionEventType_default.ADD,e=>{this.addOverlayInternal_(e.element)}),this.overlays_.addEventListener(CollectionEventType_default.REMOVE,e=>{const t=e.element.getId();void 0!==t&&delete this.overlayIdIndex_[t.toString()],e.element.setMap(null)}),this.controls.forEach(e=>{e.setMap(this)}),this.interactions.forEach(e=>{e.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){setLayerMapProperty(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();void 0!==t&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,r){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(e),i=void 0!==(r=void 0!==r?r:{}).hitTolerance?r.hitTolerance:0,o=void 0!==r.layerFilter?r.layerFilter:TRUE,s=!1!==r.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,i,s,t,null,o,null)}getFeaturesAtPixel(e,t){const r=[];return this.forEachFeatureAtPixel(e,function(e){r.push(e)},t),r}getAllLayers(){const e=[];return function t(r){r.forEach(function(r){r instanceof LayerGroup?t(r.getLayers()):e.push(r)})}(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const r=this.getCoordinateFromPixelInternal(e),n=void 0!==(t=void 0!==t?t:{}).layerFilter?t.layerFilter:TRUE,i=void 0!==t.hitTolerance?t.hitTolerance:0,o=!1!==t.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(r,this.frameState_,i,o,n,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const t=this.viewport_.getBoundingClientRect(),r=this.getSize(),n=t.width/r[0],i=t.height/r[1],o="changedTouches"in e?e.changedTouches[0]:e;return[(o.clientX-t.left)/n,(o.clientY-t.top)/i]}getTarget(){return this.get(MapProperty_default.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return toUserCoordinate(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?apply$1(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return void 0!==t?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(MapProperty_default.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof Collection)return void t.setLayers(e);const r=t.getLayers();r.clear(),r.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,r=e.length;t<r;++t){const r=e[t];if(!r.visible)continue;const n=r.layer.getRenderer();if(n&&!n.ready)return!0;const i=r.layer.getSource();if(i&&i.loading)return!0}return!1}getPixelFromCoordinate(e){const t=fromUserCoordinate(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){const t=this.frameState_;return t?apply$1(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(MapProperty_default.SIZE)}getView(){return this.get(MapProperty_default.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,r,n){return getTilePriority(this.frameState_,e,t,r,n)}handleBrowserEvent(e,t){t=t||e.type;const r=new MapBrowserEvent(t,this,e);this.handleMapBrowserEvent(r)}handleMapBrowserEvent(e){if(!this.frameState_)return;const t=e.originalEvent,r=t.type;if(r===EventType_default$1.POINTERDOWN||r===EventType_default$2.WHEEL||r===EventType_default$2.KEYDOWN){const e=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():e,n=t.target,i=r instanceof ShadowRoot?r.host===n?r.host.ownerDocument:r:r===e?e.documentElement:r;if(this.overlayContainerStopEvent_.contains(n)||!i.contains(n))return}if(e.frameState=this.frameState_,!1!==this.dispatchEvent(e)){const t=this.getInteractions().getArray().slice();for(let r=t.length-1;r>=0;r--){const n=t[r];if(n.getMap()===this&&n.getActive()&&this.getTargetElement()&&(!n.handleEvent(e)||e.propagationStopped))break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,n=r;const i=e?e.viewHints:void 0,o=!!i&&(i[ViewHint_default.ANIMATING]||i[ViewHint_default.INTERACTING]);if(o){const t=Date.now()-e.time>8;r=t?0:8,n=t?0:2}t.getTilesLoading()<r&&(o&&t.reprioritize(),t.loadMoreTiles(r,n))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(EventType_default.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(EventType_default.RENDERCOMPLETE,e),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new MapEvent(MapEventType_default.LOADEND,this,e)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new MapEvent(MapEventType_default.LOADSTART,this,e))));const r=this.postRenderFunctions_;if(e)for(let n=0,i=r.length;n<i;++n)r[n](this,e);r.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let e=0,t=this.targetChangeHandlerKeys_.length;e<t;++e)unlistenByKey(this.targetChangeHandlerKeys_[e]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(EventType_default$2.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(EventType_default$2.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!isCanvas(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const e=this.targetElement_.getRootNode();e instanceof ShadowRoot&&this.resizeObserver_.unobserve(e.host),this.setSize(void 0)}const e=this.getTarget(),t="string"==typeof e?document.getElementById(e):e;if(this.targetElement_=t,t){if(isCanvas(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new CompositeMapRenderer(this)),!isCanvas(t)){this.mapBrowserEventHandler_=new MapBrowserEventHandler(this,this.moveTolerance_);for(const t in MapBrowserEventType_default)this.mapBrowserEventHandler_.addEventListener(MapBrowserEventType_default[t],this.handleMapBrowserEvent.bind(this));let e;if(this.viewport_.addEventListener(EventType_default$2.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(EventType_default$2.WHEEL,this.boundHandleBrowserEvent_,!!PASSIVE_EVENT_LISTENERS&&{passive:!1}),this.keyboardEventTarget_)e=this.keyboardEventTarget_;else{const r=t.getRootNode();e=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[listen(e,EventType_default$2.KEYDOWN,this.handleBrowserEvent,this),listen(e,EventType_default$2.KEYPRESS,this.handleBrowserEvent,this)],!isCanvas(t)){const e=t.getRootNode();e instanceof ShadowRoot&&this.resizeObserver_.observe(e.host),this.resizeObserver_?.observe(t)}}this.updateSize()}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0)}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(unlistenByKey(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(unlistenByKey(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=listen(e,ObjectEventType_default.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=listen(e,EventType_default$2.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(unlistenByKey),this.layerGroupPropertyListenerKeys_=null);const e=this.getLayerGroup();e&&(this.handleLayerAdd_(new GroupEvent("addlayer",e)),this.layerGroupPropertyListenerKeys_=[listen(e,ObjectEventType_default.PROPERTYCHANGE,this.render,this),listen(e,EventType_default$2.CHANGE,this.render,this),listen(e,"addlayer",this.handleLayerAdd_,this),listen(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const e=this.frameState_.layerStatesArray;for(let t=0,r=e.length;t<r;++t){const r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){removeLayerMapProperty(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){const t=this.getSize(),r=this.getView(),n=this.frameState_;let i=null;if(void 0!==t&&hasArea(t)&&r&&r.isDef()){const n=r.getHints(this.frameState_?this.frameState_.viewHints:void 0),o=r.getState();if(i={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:getForViewAndSize(o.center,o.resolution,o.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:o,viewHints:n,wantedTiles:{},mapId:getUid(this),renderTargets:{}},o.nextCenter&&o.nextResolution){const e=isNaN(o.nextRotation)?o.rotation:o.nextRotation;i.nextExtent=getForViewAndSize(o.nextCenter,o.nextResolution,e,t)}}this.frameState_=i,this.renderer_.renderFrame(i),i&&(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),n&&(this.previousExtent_&&(isEmpty(this.previousExtent_)||equals$1(i.extent,this.previousExtent_))||(this.dispatchEvent(new MapEvent(MapEventType_default.MOVESTART,this,n)),this.previousExtent_=createOrUpdateEmpty(this.previousExtent_))),!this.previousExtent_||i.viewHints[ViewHint_default.ANIMATING]||i.viewHints[ViewHint_default.INTERACTING]||equals$1(i.extent,this.previousExtent_)||(this.dispatchEvent(new MapEvent(MapEventType_default.MOVEEND,this,i)),clone(i.extent,this.previousExtent_))),this.dispatchEvent(new MapEvent(MapEventType_default.POSTRENDER,this,i)),this.renderComplete_=(this.hasListener(MapEventType_default.LOADSTART)||this.hasListener(MapEventType_default.LOADEND)||this.hasListener(EventType_default.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new GroupEvent("removelayer",t)),this.set(MapProperty_default.LAYERGROUP,e)}setSize(e){this.set(MapProperty_default.SIZE,e)}setTarget(e){this.set(MapProperty_default.TARGET,e)}setView(e){if(!e||e instanceof View)return void this.set(MapProperty_default.VIEW,e);this.set(MapProperty_default.VIEW,new View);const t=this;e.then(function(e){t.setView(new View(e))})}updateSize(){const e=this.getTargetElement();let t;if(e){let r,n;if(isCanvas(e)){const t=e.getContext("2d").getTransform();r=e.width/t.a,n=e.height/t.d}else{const t=getComputedStyle(e);r=e.offsetWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderRightWidth),n=e.offsetHeight-parseFloat(t.borderTopWidth)-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)-parseFloat(t.borderBottomWidth)}isNaN(r)||isNaN(n)||(t=[Math.max(0,r),Math.max(0,n)],!hasArea(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&warn("No map visible because the map container's width or height are 0."))}const r=this.getSize();!t||r&&equals$2(t,r)||(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){const t=this.getView();t&&t.setViewportSize(e)}};function createOptionsInternal(e){let t=null;void 0!==e.keyboardEventTarget&&(t="string"==typeof e.keyboardEventTarget?document.getElementById(e.keyboardEventTarget):e.keyboardEventTarget);const r={},n=e.layers&&"function"==typeof e.layers.getLayers?e.layers:new LayerGroup({layers:e.layers});let i,o,s;return r[MapProperty_default.LAYERGROUP]=n,r[MapProperty_default.TARGET]=e.target,r[MapProperty_default.VIEW]=e.view instanceof View?e.view:new View,void 0!==e.controls&&(Array.isArray(e.controls)?i=new Collection(e.controls.slice()):(assert$1("function"==typeof e.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),i=e.controls)),void 0!==e.interactions&&(Array.isArray(e.interactions)?o=new Collection(e.interactions.slice()):(assert$1("function"==typeof e.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),o=e.interactions)),void 0!==e.overlays?Array.isArray(e.overlays)?s=new Collection(e.overlays.slice()):(assert$1("function"==typeof e.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),s=e.overlays):s=new Collection,{controls:i,interactions:o,keyboardEventTarget:t,overlays:s,values:r}}var Property$1={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"},Overlay=class extends BaseObject{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=void 0===e.insertFirst||e.insertFirst,this.stopEvent=void 0===e.stopEvent||e.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==e.className?e.className:"ol-overlay-container "+CLASS_SELECTABLE,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===e.autoPan?{}:e.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(Property$1.ELEMENT,this.handleElementChanged),this.addChangeListener(Property$1.MAP,this.handleMapChanged),this.addChangeListener(Property$1.OFFSET,this.handleOffsetChanged),this.addChangeListener(Property$1.POSITION,this.handlePositionChanged),this.addChangeListener(Property$1.POSITIONING,this.handlePositioningChanged),void 0!==e.element&&this.setElement(e.element),this.setOffset(void 0!==e.offset?e.offset:[0,0]),this.setPositioning(e.positioning||"top-left"),void 0!==e.position&&this.setPosition(e.position)}getElement(){return this.get(Property$1.ELEMENT)}getId(){return this.id}getMap(){return this.get(Property$1.MAP)||null}getOffset(){return this.get(Property$1.OFFSET)}getPosition(){return this.get(Property$1.POSITION)}getPositioning(){return this.get(Property$1.POSITIONING)}handleElementChanged(){removeChildren(this.element);const e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),unlistenByKey(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const e=this.getMap();if(e){this.mapPostrenderListenerKey=listen(e,MapEventType_default.POSTRENDER,this.render,this),this.updatePixelPosition();const t=this.stopEvent?e.getOverlayContainerStopEvent():e.getOverlayContainer();this.insertFirst?t.insertBefore(this.element,t.childNodes[0]||null):t.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(Property$1.ELEMENT,e)}setMap(e){this.set(Property$1.MAP,e)}setOffset(e){this.set(Property$1.OFFSET,e)}setPosition(e){this.set(Property$1.POSITION,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){const t=this.getMap();if(!t||!t.getTargetElement()||!this.get(Property$1.POSITION))return;const r=this.getRect(t.getTargetElement(),t.getSize()),n=this.getElement(),i=this.getRect(n,[outerWidth(n),outerHeight(n)]),o=void 0===(e=e||{}).margin?20:e.margin;if(!containsExtent(r,i)){const n=i[0]-r[0],s=r[2]-i[2],a=i[1]-r[1],l=r[3]-i[3],c=[0,0];if(n<0?c[0]=n-o:s<0&&(c[0]=Math.abs(s)+o),a<0?c[1]=a-o:l<0&&(c[1]=Math.abs(l)+o),0!==c[0]||0!==c[1]){const r=t.getView().getCenterInternal(),n=t.getPixelFromCoordinateInternal(r);if(!n)return;const i=[n[0]+c[0],n[1]+c[1]],o=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(i),duration:o.duration,easing:o.easing})}}}getRect(e,t){const r=e.getBoundingClientRect(),n=r.left+window.pageXOffset,i=r.top+window.pageYOffset;return[n,i,n+t[0],i+t[1]]}setPositioning(e){this.set(Property$1.POSITIONING,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)}updatePixelPosition(){const e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t)return void this.setVisible(!1);const r=e.getPixelFromCoordinate(t),n=e.getSize();this.updateRenderedPosition(r,n)}updateRenderedPosition(e,t){const r=this.element.style,n=this.getOffset(),i=this.getPositioning();this.setVisible(!0);let o="0%",s="0%";"bottom-right"==i||"center-right"==i||"top-right"==i?o="-100%":"bottom-center"!=i&&"center-center"!=i&&"top-center"!=i||(o="-50%"),"bottom-left"==i||"bottom-center"==i||"bottom-right"==i?s="-100%":"center-left"!=i&&"center-center"!=i&&"center-right"!=i||(s="-50%");const a=`translate(${o}, ${s}) translate(${e[0]+n[0]}px, ${e[1]+n[1]}px)`;this.rendered.transform_!=a&&(this.rendered.transform_=a,r.transform=a)}getOptions(){return this.options}},Feature=class e extends BaseObject{constructor(e){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_),e)if("function"==typeof e.getSimplifiedGeometry){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const t=new e,r=this.geometryName_;t.setGeometryName(r);const n=this.getPropertiesInternal();if(n){const e=this.getGeometry();for(const i in n)i===r&&e?t.set(i,e.clone()):t.set(i,n[i],!0)}const i=this.getStyle();return i&&t.setStyle(i),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_&&(unlistenByKey(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=listen(e,EventType_default$2.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?createStyleFunction(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function createStyleFunction(e){if("function"==typeof e)return e;let t;return Array.isArray(e)?t=e:(assert$1("function"==typeof e.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[e]),function(){return t}}function interpolatePoint(e,t,r,n,i,o,s){let a,l;const c=(r-t)/n;if(1===c)a=t;else if(2===c)a=t,l=i;else if(0!==c){let o=e[t],s=e[t+1],c=0;const u=[0];for(let i=t+n;i<r;i+=n){const t=e[i],r=e[i+1];c+=Math.sqrt((t-o)*(t-o)+(r-s)*(r-s)),u.push(c),o=t,s=r}const h=i*c,d=binarySearch$1(u,h);d<0?(l=(h-u[-d-2])/(u[-d-1]-u[-d-2]),a=t+(-d-2)*n):a=t+d*n}s=s>1?s:2,o=o||new Array(s);for(let u=0;u<s;++u)o[u]=void 0===a?NaN:void 0===l?e[a+u]:lerp(e[a+u],e[a+n+u],l);return o}function lineStringCoordinateAtM(e,t,r,n,i,o){if(r==t)return null;let s;if(i<e[t+n-1])return o?(s=e.slice(t,t+n),s[n-1]=i,s):null;if(e[r-1]<i)return o?(s=e.slice(r-n,r),s[n-1]=i,s):null;if(i==e[t+n-1])return e.slice(t,t+n);let a=t/n,l=r/n;for(;a<l;){const t=a+l>>1;i<e[(t+1)*n-1]?l=t:a=t+1}const c=e[a*n-1];if(i==c)return e.slice((a-1)*n,(a-1)*n+n);const u=(i-c)/(e[(a+1)*n-1]-c);s=[];for(let h=0;h<n-1;++h)s.push(lerp(e[(a-1)*n+h],e[a*n+h],u));return s.push(i),s}function lineStringsCoordinateAtM(e,t,r,n,i,o,s){if(s)return lineStringCoordinateAtM(e,t,r[r.length-1],n,i,o);let a;if(i<e[n-1])return o?(a=e.slice(0,n),a[n-1]=i,a):null;if(e[e.length-1]<i)return o?(a=e.slice(e.length-n),a[n-1]=i,a):null;for(let l=0,c=r.length;l<c;++l){const o=r[l];if(t!=o){if(i<e[t+n-1])return null;if(i<=e[o-1])return lineStringCoordinateAtM(e,t,o,n,i,!1);t=o}}return null}function lineStringLength(e,t,r,n){let i=e[t],o=e[t+1],s=0;for(let a=t+n;a<r;a+=n){const t=e[a],r=e[a+1];s+=Math.sqrt((t-i)*(t-i)+(r-o)*(r-o)),i=t,o=r}return s}var LineString=class e extends SimpleGeometry{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===t||Array.isArray(e[0])?this.setCoordinates(e,t):this.setFlatCoordinates(t,e)}appendCoordinate(e){extend$2(this.flatCoordinates,e),this.changed()}clone(){const t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,r,n){return n<closestSquaredDistanceXY(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(maxSquaredDelta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),assignClosestPoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,r,n))}forEachSegment(e){return forEach(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(t=void 0!==t&&t,lineStringCoordinateAtM(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return inflateCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return interpolatePoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return lineStringLength(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const r=[];return r.length=douglasPeucker(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r,0),new e(r,"XY")}getType(){return"LineString"}intersectsExtent(e){return intersectsLineString(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=deflateCoordinates(this.flatCoordinates,0,e,this.stride),this.changed()}},MultiLineString=class e extends SimpleGeometry{constructor(e,t,r){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(void 0!==t&&r)this.setFlatCoordinates(t,e),this.ends_=r;else{const t=e,r=[],n=[];for(let e=0,o=t.length;e<o;++e)extend$2(r,t[e].getFlatCoordinates()),n.push(r.length);const i=0===t.length?this.getLayout():t[0].getLayout();this.setFlatCoordinates(i,r),this.ends_=n}}appendLineString(e){extend$2(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,r,n){return n<closestSquaredDistanceXY(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(arrayMaxSquaredDelta(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),assignClosestArrayPoint(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,r,n))}getCoordinateAtM(e,t,r){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(t=void 0!==t&&t,r=void 0!==r&&r,lineStringsCoordinateAtM(this.flatCoordinates,0,this.ends_,this.stride,e,t,r))}getCoordinates(){return inflateCoordinatesArray(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new LineString(this.flatCoordinates.slice(0===e?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){const e=this.flatCoordinates,t=this.ends_,r=this.layout,n=[];let i=0;for(let o=0,s=t.length;o<s;++o){const s=t[o],a=new LineString(e.slice(i,s),r);n.push(a),i=s}return n}getLength(){const e=this.ends_;let t=0,r=0;for(let n=0,i=e.length;n<i;++n)r+=lineStringLength(this.flatCoordinates,t,e[n],this.stride),t=e[n];return r}getFlatMidpoints(){const e=[],t=this.flatCoordinates;let r=0;const n=this.ends_,i=this.stride;for(let o=0,s=n.length;o<s;++o){const s=n[o];extend$2(e,interpolatePoint(t,r,s,i,.5)),r=s}return e}getSimplifiedGeometryInternal(t){const r=[],n=[];return r.length=douglasPeuckerArray(this.flatCoordinates,0,this.ends_,this.stride,t,r,0,n),new e(r,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return intersectsLineStringArray(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const r=deflateCoordinatesArray(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=0===r.length?0:r[r.length-1],this.changed()}},MultiPoint=class e extends SimpleGeometry{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){extend$2(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){const t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,r,n){if(n<closestSquaredDistanceXY(this.getExtent(),e,t))return n;const i=this.flatCoordinates,o=this.stride;for(let s=0,a=i.length;s<a;s+=o){const a=squaredDistance$1(e,t,i[s],i[s+1]);if(a<n){n=a;for(let e=0;e<o;++e)r[e]=i[s+e];r.length=o}}return n}getCoordinates(){return inflateCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){const t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Point(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){const e=this.flatCoordinates,t=this.layout,r=this.stride,n=[];for(let i=0,o=e.length;i<o;i+=r){const o=new Point(e.slice(i,i+r),t);n.push(o)}return n}getType(){return"MultiPoint"}intersectsExtent(e){const t=this.flatCoordinates,r=this.stride;for(let n=0,i=t.length;n<i;n+=r)if(containsXY(e,t[n],t[n+1]))return!0;return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=deflateCoordinates(this.flatCoordinates,0,e,this.stride),this.changed()}};function linearRingss(e,t,r,n){const i=[];let o=createEmpty();for(let s=0,a=r.length;s<a;++s){const a=r[s];o=createOrUpdateFromFlatCoordinates(e,t,a[0],n),i.push((o[0]+o[2])/2,(o[1]+o[3])/2),t=a[a.length-1]}return i}var MultiPolygon=class e extends SimpleGeometry{constructor(e,t,r){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!r&&!Array.isArray(e[0])){const n=e,i=[],o=[];for(let e=0,t=n.length;e<t;++e){const t=n[e],r=i.length,s=t.getEnds();for(let e=0,n=s.length;e<n;++e)s[e]+=r;extend$2(i,t.getFlatCoordinates()),o.push(s)}t=0===n.length?this.getLayout():n[0].getLayout(),e=i,r=o}void 0!==t&&r?(this.setFlatCoordinates(t,e),this.endss_=r):this.setCoordinates(e,t)}appendPolygon(e){let t;if(this.flatCoordinates){const r=this.flatCoordinates.length;extend$2(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let e=0,n=t.length;e<n;++e)t[e]+=r}else this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();this.endss_.push(t),this.changed()}clone(){const t=this.endss_.length,r=new Array(t);for(let e=0;e<t;++e)r[e]=this.endss_[e].slice();const n=new e(this.flatCoordinates.slice(),this.layout,r);return n.applyProperties(this),n}closestPointXY(e,t,r,n){return n<closestSquaredDistanceXY(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(multiArrayMaxSquaredDelta(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),assignClosestMultiArrayPoint(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,r,n))}containsXY(e,t){return linearRingssContainsXY(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return linearRingss$1(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return void 0!==e?(t=this.getOrientedFlatCoordinates().slice(),orientLinearRingsArray(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,inflateMultiCoordinatesArray(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const e=linearRingss(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=getInteriorPointsOfMultiArray(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new MultiPoint(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;linearRingssAreOriented(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=orientLinearRingsArray(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const r=[],n=[];return r.length=quantizeMultiArray(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),r,0,n),new e(r,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(0===e)t=0;else{const r=this.endss_[e-1];t=r[r.length-1]}const r=this.endss_[e].slice(),n=r[r.length-1];if(0!==t)for(let i=0,o=r.length;i<o;++i)r[i]-=t;return new Polygon(this.flatCoordinates.slice(t,n),this.layout,r)}getPolygons(){const e=this.layout,t=this.flatCoordinates,r=this.endss_,n=[];let i=0;for(let o=0,s=r.length;o<s;++o){const s=r[o].slice(),a=s[s.length-1];if(0!==i)for(let e=0,t=s.length;e<t;++e)s[e]-=i;const l=new Polygon(t.slice(i,a),e,s);n.push(l),i=a}return n}getType(){return"MultiPolygon"}intersectsExtent(e){return intersectsLinearRingMultiArray(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);const r=deflateMultiCoordinatesArray(this.flatCoordinates,0,e,this.stride,this.endss_);if(0===r.length)this.flatCoordinates.length=0;else{const e=r[r.length-1];this.flatCoordinates.length=0===e.length?0:e[e.length-1]}this.changed()}},VectorContext=class{drawCustom(e,t,r,n,i){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,r){}drawFeature(e,t,r){}drawGeometryCollection(e,t,r){}drawLineString(e,t,r){}drawMultiLineString(e,t,r){}drawMultiPoint(e,t,r){}drawMultiPolygon(e,t,r){}drawPoint(e,t,r){}drawPolygon(e,t,r){}drawText(e,t,r){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},Instruction={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},fillInstruction=[Instruction.FILL],strokeInstruction=[Instruction.STROKE],beginPathInstruction=[Instruction.BEGIN_PATH],closePathInstruction=[Instruction.CLOSE_PATH],CanvasBuilder=class extends VectorContext{constructor(e,t,r,n){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=r,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){const t=this.pixelRatio;return 1==t?e:e.map(function(e){return e*t})}appendFlatPointCoordinates(e,t){const r=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,i=this.coordinates;let o=i.length;for(let s=0,a=e.length;s<a;s+=t)n[0]=e[s],n[1]=e[s+1],containsCoordinate(r,n)&&(i[o++]=n[0],i[o++]=n[1]);return o}appendFlatLineCoordinates(e,t,r,n,i,o){const s=this.coordinates;let a=s.length;const l=this.getBufferedMaxExtent();o&&(t+=n);let c=e[t],u=e[t+1];const h=this.tmpCoordinate_;let d,p,f,g=!0;for(d=t+n;d<r;d+=n)h[0]=e[d],h[1]=e[d+1],f=coordinateRelationship(l,h),f!==p?(g&&(s[a++]=c,s[a++]=u,g=!1),s[a++]=h[0],s[a++]=h[1]):f===Relationship_default.INTERSECTING?(s[a++]=h[0],s[a++]=h[1],g=!1):g=!0,c=h[0],u=h[1],p=f;return(i&&g||d===t+n)&&(s[a++]=c,s[a++]=u),a}drawCustomCoordinates_(e,t,r,n,i){for(let o=0,s=r.length;o<s;++o){const s=r[o],a=this.appendFlatLineCoordinates(e,t,s,n,!1,!1);i.push(a),t=s}return t}drawCustom(e,t,r,n,i){this.beginGeometry(e,t,i);const o=e.getType(),s=e.getStride(),a=this.coordinates.length;let l,c,u,h,d;switch(o){case"MultiPolygon":l=e.getOrientedFlatCoordinates(),h=[];const t=e.getEndss();d=0;for(let e=0,r=t.length;e<r;++e){const r=[];d=this.drawCustomCoordinates_(l,d,t[e],s,r),h.push(r)}this.instructions.push([Instruction.CUSTOM,a,h,e,r,inflateMultiCoordinatesArray,i]),this.hitDetectionInstructions.push([Instruction.CUSTOM,a,h,e,n||r,inflateMultiCoordinatesArray,i]);break;case"Polygon":case"MultiLineString":u=[],l="Polygon"==o?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,e.getEnds(),s,u),this.instructions.push([Instruction.CUSTOM,a,u,e,r,inflateCoordinatesArray,i]),this.hitDetectionInstructions.push([Instruction.CUSTOM,a,u,e,n||r,inflateCoordinatesArray,i]);break;case"LineString":case"Circle":l=e.getFlatCoordinates(),c=this.appendFlatLineCoordinates(l,0,l.length,s,!1,!1),this.instructions.push([Instruction.CUSTOM,a,c,e,r,inflateCoordinates,i]),this.hitDetectionInstructions.push([Instruction.CUSTOM,a,c,e,n||r,inflateCoordinates,i]);break;case"MultiPoint":l=e.getFlatCoordinates(),c=this.appendFlatPointCoordinates(l,s),c>a&&(this.instructions.push([Instruction.CUSTOM,a,c,e,r,inflateCoordinates,i]),this.hitDetectionInstructions.push([Instruction.CUSTOM,a,c,e,n||r,inflateCoordinates,i]));break;case"Point":l=e.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),c=this.coordinates.length,this.instructions.push([Instruction.CUSTOM,a,c,e,r,void 0,i]),this.hitDetectionInstructions.push([Instruction.CUSTOM,a,c,e,n||r,void 0,i])}this.endGeometry(t)}beginGeometry(e,t,r){this.beginGeometryInstruction1_=[Instruction.BEGIN_GEOMETRY,t,0,e,r],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Instruction.BEGIN_GEOMETRY,t,0,e,r],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;let t;e.reverse();const r=e.length;let n,i,o=-1;for(t=0;t<r;++t)n=e[t],i=n[0],i==Instruction.END_GEOMETRY?o=t:i==Instruction.BEGIN_GEOMETRY&&(n[2]=t,reverseSubArray(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){const r=e.getColor();t.fillPatternScale=r&&"object"==typeof r&&"src"in r?this.pixelRatio:1,t.fillStyle=asColorLike(r||"#000")??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){const r=e.getColor();t.strokeStyle=asColorLike(r||defaultStrokeStyle);const n=e.getLineCap();t.lineCap=void 0!==n?n:defaultLineCap;const i=e.getLineDash();t.lineDash=i?i.slice():defaultLineDash;const o=e.getLineDashOffset();t.lineDashOffset=o||0;const s=e.getLineJoin();t.lineJoin=void 0!==s?s:defaultLineJoin;const a=e.getWidth();t.lineWidth=void 0!==a?a:1;const l=e.getMiterLimit();t.miterLimit=void 0!==l?l:10,t.strokeOffset=e.getOffset()??0,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){const r=this.state;this.fillStyleToState(e,r),this.strokeStyleToState(t,r)}createFill(e){const t=e.fillStyle,r=[Instruction.SET_FILL_STYLE,t];return"string"!=typeof t&&r.push(e.fillPatternScale),r}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[Instruction.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const r=e.fillStyle;(void 0!==r&&"string"!=typeof r||e.currentFillStyle!=r)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=r)}updateStrokeStyle(e,t){const r=e.strokeStyle,n=e.lineCap,i=e.lineDash,o=e.lineDashOffset,s=e.lineJoin,a=e.lineWidth,l=e.miterLimit,c=e.strokeOffset;(e.currentStrokeStyle!=r||e.currentLineCap!=n||i!=e.currentLineDash&&!equals$2(e.currentLineDash,i)||e.currentLineDashOffset!=o||e.currentLineJoin!=s||e.currentLineWidth!=a||e.currentMiterLimit!=l||e.currentStrokeOffset!=c)&&(t.call(this,e),e.currentStrokeStyle=r,e.currentLineCap=n,e.currentLineDash=i,e.currentLineDashOffset=o,e.currentLineJoin=s,e.currentLineWidth=a,e.currentMiterLimit=l,e.currentStrokeOffset=c)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[Instruction.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=clone(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;buffer(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},CanvasImageBuilder=class extends CanvasBuilder{constructor(e,t,r,n){super(e,t,r,n),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(e,t,r){if(!this.image_||this.maxExtent&&!containsCoordinate(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,r);const n=e.getFlatCoordinates(),i=e.getStride(),o=this.coordinates.length,s=this.appendFlatPointCoordinates(n,i);this.instructions.push([Instruction.DRAW_IMAGE,o,s,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([Instruction.DRAW_IMAGE,o,s,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(t)}drawMultiPoint(e,t,r){if(!this.image_)return;this.beginGeometry(e,t,r);const n=e.getFlatCoordinates(),i=[];for(let a=0,l=n.length;a<l;a+=e.getStride())this.maxExtent&&!containsCoordinate(this.maxExtent,n.slice(a,a+2))||i.push(n[a],n[a+1]);const o=this.coordinates.length,s=this.appendFlatPointCoordinates(i,2);this.instructions.push([Instruction.DRAW_IMAGE,o,s,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([Instruction.DRAW_IMAGE,o,s,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(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){const r=e.getAnchor(),n=e.getSize(),i=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=e.getOpacity(),this.originX_=i[0],this.originY_=i[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=n[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},CanvasLineStringBuilder=class extends CanvasBuilder{constructor(e,t,r,n){super(e,t,r,n)}drawFlatCoordinates_(e,t,r,n,i){const o=this.coordinates.length,s=this.appendFlatLineCoordinates(e,t,r,n,!1,!1);return this.instructions.push([Instruction.MOVE_TO_LINE_TO,o,s,i*this.pixelRatio]),this.hitDetectionInstructions.push([Instruction.MOVE_TO_LINE_TO,o,s,i]),r}drawLineString(e,t,r){const n=this.state,i=n.strokeStyle,o=n.lineWidth,s=n.strokeOffset;if(void 0===i||void 0===o)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(e,t,r),this.hitDetectionInstructions.push([Instruction.SET_STROKE_STYLE,defaultStrokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,defaultLineDash,0],beginPathInstruction);const a=e.getFlatCoordinates(),l=e.getStride();this.drawFlatCoordinates_(a,0,a.length,l,s),this.hitDetectionInstructions.push(strokeInstruction),this.endGeometry(t)}drawMultiLineString(e,t,r){const n=this.state,i=n.strokeStyle,o=n.lineWidth,s=n.strokeOffset;if(void 0===i||void 0===o)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(e,t,r),this.hitDetectionInstructions.push([Instruction.SET_STROKE_STYLE,defaultStrokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,defaultLineDash,0],beginPathInstruction);const a=e.getEnds(),l=e.getFlatCoordinates(),c=e.getStride();let u=0;for(let h=0,d=a.length;h<d;++h)u=this.drawFlatCoordinates_(l,u,a[h],c,s);this.hitDetectionInstructions.push(strokeInstruction),this.endGeometry(t)}finish(){const e=this.state;return null!=e.lastStroke&&e.lastStroke!=this.coordinates.length&&this.instructions.push(strokeInstruction),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){null!=e.lastStroke&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(strokeInstruction),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(beginPathInstruction)}},CanvasPolygonBuilder=class extends CanvasBuilder{constructor(e,t,r,n){super(e,t,r,n)}drawFlatCoordinatess_(e,t,r,n,i){const o=this.state,s=void 0!==o.fillStyle,a=void 0!==o.strokeStyle,l=r.length;this.instructions.push(beginPathInstruction),this.hitDetectionInstructions.push(beginPathInstruction);for(let c=0;c<l;++c){const o=r[c],s=this.coordinates.length,l=this.appendFlatLineCoordinates(e,t,o,n,!0,!a);this.instructions.push([Instruction.MOVE_TO_LINE_TO,s,l,i*this.pixelRatio,!0]),this.hitDetectionInstructions.push([Instruction.MOVE_TO_LINE_TO,s,l,i,!0]),a&&(this.instructions.push(closePathInstruction),this.hitDetectionInstructions.push(closePathInstruction)),t=o}return s&&(this.instructions.push(fillInstruction),this.hitDetectionInstructions.push(fillInstruction)),a&&(this.instructions.push(strokeInstruction),this.hitDetectionInstructions.push(strokeInstruction)),t}drawCircle(e,t,r){const n=this.state,i=n.fillStyle,o=n.strokeStyle,s=n.strokeOffset;if(void 0===i&&void 0===o)return;if(this.handleStrokeOffset_(()=>this.drawCircle(e,t,r)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,r),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Instruction.SET_FILL_STYLE,defaultFillStyle]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Instruction.SET_STROKE_STYLE,defaultStrokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,defaultLineDash,0]);const a=e.getFlatCoordinates(),l=e.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const u=[Instruction.CIRCLE,c,s];this.instructions.push(beginPathInstruction,u),this.hitDetectionInstructions.push(beginPathInstruction,u),void 0!==n.fillStyle&&(this.instructions.push(fillInstruction),this.hitDetectionInstructions.push(fillInstruction)),void 0!==n.strokeStyle&&(this.instructions.push(strokeInstruction),this.hitDetectionInstructions.push(strokeInstruction)),this.endGeometry(t)}drawPolygon(e,t,r){const n=this.state,i=n.fillStyle,o=n.strokeStyle,s=n.strokeOffset;if(void 0===i&&void 0===o)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(e,t,r)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,r),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Instruction.SET_FILL_STYLE,defaultFillStyle]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Instruction.SET_STROKE_STYLE,defaultStrokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,defaultLineDash,0]);const a=e.getEnds(),l=e.getOrientedFlatCoordinates(),c=e.getStride();this.drawFlatCoordinatess_(l,0,a,c,s),this.endGeometry(t)}drawMultiPolygon(e,t,r){const n=this.state,i=n.fillStyle,o=n.strokeStyle,s=n.strokeOffset;if(void 0===i&&void 0===o)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,r)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,r),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Instruction.SET_FILL_STYLE,defaultFillStyle]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Instruction.SET_STROKE_STYLE,defaultStrokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,defaultLineDash,0]);const a=e.getEndss(),l=e.getOrientedFlatCoordinates(),c=e.getStride();let u=0;for(let h=0,d=a.length;h<d;++h)u=this.drawFlatCoordinatess_(l,u,a[h],c,s);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(0!==e){const t=this.coordinates;for(let r=0,n=t.length;r<n;++r)t[r]=snap(t[r],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){const t=this.state,r=t.fillStyle,n=t.strokeStyle,i=t.strokeOffset;return Math.abs(i)>0&&void 0!==r&&void 0!==n&&(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=n,t.strokeOffset=i,e(),t.fillStyle=r,!0)}},clipSegmentStart=0,clipSegmentEnd=1;function clipSegment(e,t,r,n,i,o,s,a){const l=s-i,c=a-o;let u=0,h=1;if(0===l){if(i<e||i>r)return!1}else{let t=(e-i)/l,n=(r-i)/l;if(t>n){const e=t;t=n,n=e}if(t>u&&(u=t),n<h&&(h=n),u>h)return!1}if(0===c){if(o<t||o>n)return!1}else{let e=(t-o)/c,r=(n-o)/c;if(e>r){const t=e;e=r,r=t}if(e>u&&(u=e),r<h&&(h=r),u>h)return!1}return clipSegmentStart=u,clipSegmentEnd=h,!0}function clipFlatLineStrings(e,t,r,n){const i=n[0],o=n[1],s=n[2],a=n[3],l=[],c=[];let u,h,d=!1,p=0;for(let f=0,g=t.length;f<g;++f){const n=t[f];let g=e[p],m=e[p+1],y=!1;for(let t=p+r;t<n;t+=r){const r=e[t],n=e[t+1];if(clipSegment(i,o,s,a,g,m,r,n)){const e=r-g,t=n-m,i=g+clipSegmentStart*e,o=m+clipSegmentStart*t,s=g+clipSegmentEnd*e,a=m+clipSegmentEnd*t;d&&y&&i===u&&o===h?l.push(s,a):(d&&c.push(l.length),l.push(i,o,s,a),d=!0),u=s,h=a,y=!0}g=r,m=n}p=n}return d&&c.push(l.length),{flatCoordinates:l,ends:c}}function lineChunk(e,t,r,n,i){const o=[];let s=r,a=0,l=t.slice(r,2);for(;a<e&&s+i<n;){const[r,n]=l.slice(-2),c=t[s+i],u=t[s+i+1],h=Math.sqrt((c-r)*(c-r)+(u-n)*(u-n));if(a+=h,a>=e){const t=(e-a+h)/h,d=lerp(r,c,t),p=lerp(n,u,t);l.push(d,p),o.push(l),l=[d,p],a==e&&(s+=i),a=0}else if(a<e)l.push(t[s+i],t[s+i+1]),s+=i;else{const e=h-a,t=lerp(r,c,e/h),d=lerp(n,u,e/h);l.push(t,d),o.push(l),l=[t,d],a=0,s+=i}}return a>0&&o.push(l),o}function matchingChunk(e,t,r,n,i){let o,s,a,l,c,u,h,d,p,f,g=r,m=r,y=0,v=0,_=r;for(s=r;s<n;s+=i){const r=t[s],n=t[s+1];void 0!==c&&(p=r-c,f=n-u,l=Math.sqrt(p*p+f*f),void 0!==h&&(v+=a,o=Math.acos((h*p+d*f)/(a*l)),o>e&&(v>y&&(y=v,g=_,m=s),v=0,_=s-i)),a=l,h=p,d=f),c=r,u=n}return v+=l,v>y?[_,s]:[g,m]}var TEXT_ALIGN={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},CanvasTextBuilder=class extends CanvasBuilder{constructor(e,t,r,n){super(e,t,r,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[defaultFillStyle]={fillStyle:defaultFillStyle},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,r){const n=this.textFillState_,i=this.textStrokeState_,o=this.textState_;if(""===this.text_||!o||!n&&!i)return;const s=this.coordinates;let a=s.length;const l=e.getType();let c=null,u=e.getStride();if("line"!==o.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=o.overflow?null:[];switch(l){case"Point":case"MultiPoint":c=e.getFlatCoordinates();break;case"LineString":c=e.getFlatMidpoint();break;case"Circle":c=e.getCenter();break;case"MultiLineString":c=e.getFlatMidpoints(),u=2;break;case"Polygon":c=e.getFlatInteriorPoint(),o.overflow||n.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const t=e.getFlatInteriorPoints();c=[];for(let e=0,r=t.length;e<r;e+=3)o.overflow||n.push(t[e+2]/this.resolution),c.push(t[e],t[e+1]);if(0===c.length)return;u=2}const i=this.appendFlatPointCoordinates(c,u);if(i===a)return;if(n&&(i-a)/2!==c.length/u){let e=a/2;n=n.filter((t,r)=>{const n=s[2*(e+r)]===c[r*u]&&s[2*(e+r)+1]===c[r*u+1];return n||--e,n})}this.saveTextStates_();const h=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,d=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,r);let p=o.padding;if(p!=defaultPadding&&(o.scale[0]<0||o.scale[1]<0)){let e=o.padding[0],t=o.padding[1],r=o.padding[2],n=o.padding[3];o.scale[0]<0&&(t=-t,n=-n),o.scale[1]<0&&(e=-e,r=-r),p=[e,t,r,n]}const f=this.pixelRatio;this.instructions.push([Instruction.DRAW_IMAGE,a,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==defaultPadding?defaultPadding:p.map(function(e){return e*f}),h,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const g=1/f,m=h?h.slice(0):null;m&&(m[1]=defaultFillStyle),this.hitDetectionInstructions.push([Instruction.DRAW_IMAGE,a,i,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_?defaultFillStyle:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(t)}else{const n=e.getExtent();if(!intersects$1(this.maxExtent,n))return;let i;if(c=e.getFlatCoordinates(),"LineString"==l)i=[c.length];else if("MultiLineString"==l)i=e.getEnds();else if("Polygon"==l)i=e.getEnds().slice(0,1);else if("MultiPolygon"==l){const t=e.getEndss();i=[];for(let e=0,r=t.length;e<r;++e)i.push(t[e][0])}if(("LineString"==l||"MultiLineString"==l)&&!containsExtent(this.getBufferedMaxExtent(),n)){const e=clipFlatLineStrings(c,i,u,this.getBufferedMaxExtent());if(c=e.flatCoordinates,i=e.ends,u=2,0===i.length)return}this.beginGeometry(e,t,r);const h=o.repeat,d=h?void 0:o.textAlign;let p=0;for(let e=0,t=i.length;e<t;++e){let t;t=h?lineChunk(h*this.resolution,c,p,i[e],u):[c.slice(p,i[e])];for(let r=0,n=t.length;r<n;++r){const n=t[r];let l=0,c=n.length;if(null==d){const e=matchingChunk(o.maxAngle,n,0,n.length,2);l=e[0],c=e[1]}for(let e=l;e<c;e+=u)s.push(n[e],n[e+1]);const h=s.length;p=i[e],this.drawChars_(a,h),a=h}}this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,r=this.textFillState_,n=this.strokeKey_;e&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const i=this.textKey_;i in this.textStates||(this.textStates[i]={font:t.font,textAlign:t.textAlign||"center",justify:t.justify,textBaseline:t.textBaseline||"middle",scale:t.scale});const o=this.fillKey_;r&&(o in this.fillStates||(this.fillStates[o]={fillStyle:r.fillStyle}))}drawChars_(e,t){const r=this.textStrokeState_,n=this.textState_,i=this.strokeKey_,o=this.textKey_,s=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=TEXT_ALIGN[n.textBaseline],c=this.textOffsetX_*a,u=this.textOffsetY_*a,h=this.text_,d=r?r.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([Instruction.DRAW_CHARS,e,t,l,n.overflow,s,n.maxAngle,a,u,i,d*a,h,o,1,this.declutterMode_,this.textKeepUpright_,c]),this.hitDetectionInstructions.push([Instruction.DRAW_CHARS,e,t,l,n.overflow,s?defaultFillStyle:s,n.maxAngle,a,u,i,d*a,h,o,1/a,this.declutterMode_,this.textKeepUpright_,c])}setTextStyle(e,t){let r,n,i;if(e){const t=e.getFill();t?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=asColorLike(t.getColor()||"#000")):(n=null,this.textFillState_=n);const o=e.getStroke();if(o){i=this.textStrokeState_,i||(i={},this.textStrokeState_=i);const e=o.getLineDash(),t=o.getLineDashOffset(),r=o.getWidth(),n=o.getMiterLimit();i.lineCap=o.getLineCap()||"round",i.lineDash=e?e.slice():defaultLineDash,i.lineDashOffset=void 0===t?0:t,i.lineJoin=o.getLineJoin()||"round",i.lineWidth=void 0===r?1:r,i.miterLimit=void 0===n?10:n,i.strokeStyle=asColorLike(o.getColor()||"#000")}else i=null,this.textStrokeState_=i;r=this.textState_;const s=e.getFont()||"10px sans-serif";registerFont(s);const a=e.getScaleArray();r.overflow=e.getOverflow(),r.font=s,r.maxAngle=e.getMaxAngle(),r.placement=e.getPlacement(),r.textAlign=e.getTextAlign(),r.repeat=e.getRepeat(),r.justify=e.getJustify(),r.textBaseline=e.getTextBaseline()||"middle",r.backgroundFill=e.getBackgroundFill(),r.backgroundStroke=e.getBackgroundStroke(),r.padding=e.getPadding()||defaultPadding,r.scale=void 0===a?[1,1]:a;const l=e.getOffsetX(),c=e.getOffsetY(),u=e.getRotateWithView(),h=e.getKeepUpright(),d=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===c?0:c,this.textRotateWithView_=void 0!==u&&u,this.textKeepUpright_=void 0===h||h,this.textRotation_=void 0===d?0:d,this.strokeKey_=i?("string"==typeof i.strokeStyle?i.strokeStyle:getUid(i.strokeStyle))+i.lineCap+i.lineDashOffset+"|"+i.lineWidth+i.lineJoin+i.miterLimit+"["+i.lineDash.join()+"]":"",this.textKey_=r.font+r.scale+(r.textAlign||"?")+(r.repeat||"?")+(r.justify||"?")+(r.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+getUid(n.fillStyle):""}else this.text_="";this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},BATCH_CONSTRUCTORS={Circle:CanvasPolygonBuilder,Default:CanvasBuilder,Image:CanvasImageBuilder,LineString:CanvasLineStringBuilder,Polygon:CanvasPolygonBuilder,Text:CanvasTextBuilder},BuilderGroup=class{constructor(e,t,r,n){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=n,this.resolution_=r,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const r=this.buildersByZIndex_[t];for(const n in r){const i=r[n].finish();e[t][n]=i}}return e}getBuilder(e,t){const r=void 0!==e?e.toString():"0";let n=this.buildersByZIndex_[r];void 0===n&&(n={},this.buildersByZIndex_[r]=n);let i=n[t];return void 0===i&&(i=new(0,BATCH_CONSTRUCTORS[t])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[t]=i),i}},segmenter;function offsetLineString(e,t,r,n,i,o,s,a){s=s??[],a=a??n;const l=e[t+n],c=e[t+n+1],u=e[r-2*n],h=e[r-2*n+1];let d,p,f,g,m,y,v,_,b=0;for(let E=t;E<r;E+=n){f=d,g=p,m=void 0,y=void 0,E+n<r&&(m=e[E+n],y=e[E+n+1]),o&&E===t&&(f=u,g=h),o&&E===r-n&&(m=l,y=c),d=e[E],p=e[E+1],[v,_]=offsetLineVertex(d,p,f,g,m,y,i),s[b++]=v,s[b++]=_;for(let t=2;t<a;t++)s[b++]=e[E+t]}return s.length!=b&&(s.length=b),s}function offsetLineVertex(e,t,r,n,i,o,s){let a,l;void 0!==r&&void 0!==n?(a=e-r,l=t-n):void 0!==i&&void 0!==o?(a=i-e,l=o-t):(a=1,l=0);const c=Math.hypot(a,l),u=a/c,h=l/c;if(a=-h,l=u,void 0===r||void 0===n)return[e+a*s,t+l*s];if(void 0===i||void 0===o)return[e+a*s,t+l*s];const d=angleBetween([e,t],[r,n],[i,o]);if(Math.cos(d)>.998)return[e+u*s,t+h*s];const p=Math.cos(d/2),f=Math.sin(d/2);return[e+1/f*(f*a+p*l)*s,t+1/f*(-p*a+f*l)*s]}function removeOffsetCycles(e,t,r=!1){for(let n=0,i=e.length-2;n<i;n+=t)for(let o=r&&0===n?e.length-3*t:e.length-2*t;o>n+t;o-=t){const r=e[n],i=e[n+1],s=e[n+t],a=e[n+t+1],l=e[o],c=e[o+1],u=e[o+t],h=e[o+t+1],d=(h-c)*(s-r)-(u-l)*(a-i);if(0===d)continue;const p=((u-l)*(i-c)-(h-c)*(r-l))/d,f=((s-r)*(i-c)-(a-i)*(r-l))/d;if(p>0&&p<1&&f>0&&f<1){const l=r+p*(s-r),c=i+p*(a-i);e[n+t]=l,e[n+t+1]=c,e.splice(n+2*t,o-n-t);break}}return e}function getSegmenter(){return segmenter||(segmenter=new Intl.Segmenter(void 0,{granularity:"grapheme"})),segmenter}function drawTextOnPath(e,t,r,n,i,o,s,a,l,c,u,h,d=!0){let p=e[t],f=e[t+1],g=0,m=0,y=0,v=0;function _(){g=p,m=f,p=e[t+=n],f=e[t+1],v+=y,y=Math.sqrt((p-g)*(p-g)+(f-m)*(f-m))}do{_()}while(t<r-n&&v+y<o);let b=0===y?0:(o-v)/y;const E=lerp(g,p,b),w=lerp(m,f,b),C=t-n,S=v,T=o+a*l(c,i,u);for(;t<r-n&&v+y<T;)_();b=0===y?0:(T-v)/y;const x=lerp(g,p,b),R=lerp(m,f,b);let A=!1;if(d)if(h){const e=[E,w,x,R];rotate(e,0,4,2,h,e,e),A=e[0]>e[2]}else A=E>x;const I=Math.PI,k=[],P=C+n===t;let L;if(y=0,v=S,p=e[t=C],f=e[t+1],P)return _(),L=Math.atan2(f-m,p-g),A&&(L+=L>0?-I:I),k[0]=[(x+E)/2,(R+w)/2,(T-o)/2,L,i],k;i=i.replace(/\n/g," ");const O=Array.from(getSegmenter().segment(i),e=>e.segment);for(let M=0,D=O.length;M<D;){_();let e=Math.atan2(f-m,p-g);if(A&&(e+=e>0?-I:I),void 0!==L){let t=e-L;if(t+=t>I?-2*I:t<-I?2*I:0,Math.abs(t)>s)return null}L=e;const i=M;let h=0;for(;M<D;++M){const e=a*l(c,O[A?D-M-1:M],u);if(t+n<r&&v+y<o+h+e/2)break;h+=e}if(M===i)continue;const d=(A?O.slice(D-M,D-i):O.slice(i,M)).join("");b=0===y?0:(o+h/2-v)/y;const E=lerp(g,p,b),w=lerp(m,f,b);k.push([E,w,h/2,e,d]),o+=h}return k}var ZIndexContext=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(getSharedCanvasContext2D(),{get:(e,t)=>{if("function"==typeof e[t])return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,r)=>(this.push_(t,r),!0)})}push_(...e){const t=this.instructions_,r=this.zIndex+this.offset_;t[r]||(t[r]=[]),t[r].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let r=0,n=t.length;r<n;++r){const n=t[r];if("function"==typeof n){n(e);continue}const i=t[++r];"function"==typeof e[n]?e[n](...i):e[n]="function"==typeof i?i(e):i}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},tmpExtent=createEmpty(),p1=[],p2=[],p3=[],p4=[];function getDeclutterBox(e){return e[3].declutterBox}var rtlRegEx=new RegExp("["+String.fromCharCode(1425)+"-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function horizontalTextAlign(e,t){return"start"===t?t=rtlRegEx.test(e)?"right":"left":"end"===t&&(t=rtlRegEx.test(e)?"left":"right"),TEXT_ALIGN[t]}function createTextChunks(e,t,r){return r>0&&e.push("\n",""),e.push(t,""),e}function richTextToPlainText(e,t,r){return r%2==0&&(e+=t),e}var Executor=class{constructor(e,t,r,n,i){this.overlaps=r,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=create(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=i?new ZIndexContext:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,r,n){const i=e+t+r+n;if(this.labels_[i])return this.labels_[i];const o=n?this.strokeStates[n]:null,s=r?this.fillStates[r]:null,a=this.textStates[t],l=this.pixelRatio,c=[a.scale[0]*l,a.scale[1]*l],u=a.justify?TEXT_ALIGN[a.justify]:horizontalTextAlign(Array.isArray(e)?e[0]:e,a.textAlign||"center"),h=n&&o.lineWidth?o.lineWidth:0,d=Array.isArray(e)?e:String(e).split("\n").reduce(createTextChunks,[]),{width:p,height:f,widths:g,heights:m,lineWidths:y}=getTextDimensions(a,d),v=p+h,_=[],b=(v+2)*c[0],E=(f+h)*c[1],w={width:b<0?Math.floor(b):Math.ceil(b),height:E<0?Math.floor(E):Math.ceil(E),contextInstructions:_};1==c[0]&&1==c[1]||_.push("scale",c),n&&(_.push("strokeStyle",o.strokeStyle),_.push("lineWidth",h),_.push("lineCap",o.lineCap),_.push("lineJoin",o.lineJoin),_.push("miterLimit",o.miterLimit),_.push("setLineDash",[o.lineDash]),_.push("lineDashOffset",o.lineDashOffset)),r&&_.push("fillStyle",s.fillStyle),_.push("textBaseline","middle"),_.push("textAlign","center");const C=.5-u;let S=u*v+C*h;const T=[],x=[];let R,A=0,I=0,k=0,P=0;for(let L=0,O=d.length;L<O;L+=2){const e=d[L];if("\n"===e){I+=A,A=0,S=u*v+C*h,++P;continue}const t=d[L+1]||a.font;t!==R&&(n&&T.push("font",t),r&&x.push("font",t),R=t),A=Math.max(A,m[k]);const i=[e,S+C*g[k]+u*(g[k]-y[P]),.5*(h+A)+I];S+=g[k],n&&T.push("strokeText",i),r&&x.push("fillText",i),++k}return Array.prototype.push.apply(_,T),Array.prototype.push.apply(_,x),this.labels_[i]=w,w}replayTextBackground_(e,t,r,n,i,o,s){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,r),e.lineTo.apply(e,n),e.lineTo.apply(e,i),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),s&&(this.setStrokeStyle_(e,s),e.stroke())}calculateImageOrLabelDimensions_(e,t,r,n,i,o,s,a,l,c,u,h,d,p,f,g){let m=r-(s*=h[0]),y=n-(a*=h[1]);const v=i+l>e?e-l:i,_=o+c>t?t-c:o,b=p[3]+v*h[0]+p[1],E=p[0]+_*h[1]+p[2],w=m-p[3],C=y-p[0];let S;return(f||0!==u)&&(p1[0]=w,p4[0]=w,p1[1]=C,p2[1]=C,p2[0]=w+b,p3[0]=p2[0],p3[1]=C+E,p4[1]=p3[1]),0!==u?(S=compose(create(),r,n,1,1,u,-r,-n),apply$1(S,p1),apply$1(S,p2),apply$1(S,p3),apply$1(S,p4),createOrUpdate$2(Math.min(p1[0],p2[0],p3[0],p4[0]),Math.min(p1[1],p2[1],p3[1],p4[1]),Math.max(p1[0],p2[0],p3[0],p4[0]),Math.max(p1[1],p2[1],p3[1],p4[1]),tmpExtent)):createOrUpdate$2(Math.min(w,w+b),Math.min(C,C+E),Math.max(w,w+b),Math.max(C,C+E),tmpExtent),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:v,drawImageH:_,originX:l,originY:c,declutterBox:{minX:tmpExtent[0],minY:tmpExtent[1],maxX:tmpExtent[2],maxY:tmpExtent[3],value:g},canvasTransform:S,scale:h}}replayImageOrLabel_(e,t,r,n,i,o,s){const a=!(!o&&!s),l=n.declutterBox,c=s?s[2]*n.scale[0]/2:0;return l.minX-c<=t[0]&&l.maxX+c>=0&&l.minY-c<=t[1]&&l.maxY+c>=0&&(a&&this.replayTextBackground_(e,p1,p2,p3,p4,o,s),drawImageOrLabel(e,n.canvasTransform,i,r,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(e){const t=this.alignAndScaleFill_;if(t){const r=apply$1(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;e.save(),e.translate(r[0]%n,r[1]%n),1!==t&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,r,n){const i=this.textStates[t],o=this.createLabel(e,t,n,r),s=this.strokeStates[r],a=this.pixelRatio,l=horizontalTextAlign(Array.isArray(e)?e[0]:e,i.textAlign||"center"),c=TEXT_ALIGN[i.textBaseline||"middle"],u=s&&s.lineWidth?s.lineWidth:0;return{label:o,anchorX:l*(o.width/a-2*i.scale[0])+2*(.5-l)*u,anchorY:c*o.height/a+2*(.5-c)*u}}execute_(e,t,r,n,i,o,s,a){const l=this.zIndexContext_;let c;this.pixelCoordinates_&&equals$2(r,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=transform2D(this.coordinates,0,this.coordinates.length,2,r,this.pixelCoordinates_),setFromArray(this.renderedTransform_,r));let u=0;const h=n.length;let d,p=0;const f=[];let g,m,y,v,_,b,E,w,C,S,T,x,R,A=0,I=0;const k=this.coordinateCache_,P=this.viewRotation_,L=Math.round(1e12*Math.atan2(-r[1],r[0]))/1e12,O={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:P},M=this.instructions!=n||this.overlaps?0:200;let D,N,$,F;for(;u<h;){const r=n[u];switch(r[0]){case Instruction.BEGIN_GEOMETRY:D=r[1],F=r[3],D.getGeometry()?void 0===s||intersects$1(s,F.getExtent())?++u:u=r[2]+1:u=r[2],l&&(l.zIndex=r[4]);break;case Instruction.BEGIN_PATH:A>M&&(this.fill_(e),A=0),I>M&&(e.stroke(),I=0),A||I||(e.beginPath(),_=NaN,b=NaN),++u;break;case Instruction.CIRCLE:p=r[1],y=r[2]??0;const n=c[p],h=c[p+1],B=c[p+2]-y-n,U=c[p+3]-y-h,z=Math.sqrt(B*B+U*U);e.moveTo(n+z,h),e.arc(n,h,z,0,2*Math.PI,!0),++u;break;case Instruction.CLOSE_PATH:e.closePath(),++u;break;case Instruction.CUSTOM:p=r[1],d=r[2];const V=r[3],j=r[4],G=r[5];O.geometry=V,O.feature=D,u in k||(k[u]=[]);const H=k[u];G?G(c,p,d,2,H):(H[0]=c[p],H[1]=c[p+1],H.length=2),l&&(l.zIndex=r[6]),j(H,O),++u;break;case Instruction.DRAW_IMAGE:p=r[1],d=r[2],C=r[3],g=r[4],m=r[5];let q=r[6];const W=r[7],K=r[8],Y=r[9],Z=r[10];let X=r[11];const J=r[12];let Q=r[13];v=r[14]||"declutter";const ee=r[15];if(!C&&r.length>=20){S=r[19],T=r[20],x=r[21],R=r[22];const e=this.drawLabelWithPointPlacement_(S,T,x,R);C=e.label,r[3]=C;const t=r[23];g=(e.anchorX-t)*this.pixelRatio,r[4]=g;const n=r[24];m=(e.anchorY-n)*this.pixelRatio,r[5]=m,q=C.height,r[6]=q,Q=C.width,r[13]=Q}let te,re,ne,ie;r.length>25&&(te=r[25]),r.length>17?(re=r[16],ne=r[17],ie=r[18]):(re=defaultPadding,ne=null,ie=null),Z&&L?X+=P:Z||L||(X-=P);let oe=0;for(;p<d;p+=2){if(te&&te[oe++]<Q/this.pixelRatio)continue;const r=this.calculateImageOrLabelDimensions_(C.width,C.height,c[p],c[p+1],Q,q,g,m,K,Y,X,J,i,re,!!ne||!!ie,D),n=[e,t,C,r,W,ne,ie];if(a){let e,t,i,o,s;if(ee){const r=d-p;if(!ee[r]){ee[r]={args:n,declutterMode:v};continue}const o=ee[r];e=o.args,t=o.declutterMode,delete ee[r],i=getDeclutterBox(e)}if(!e||"declutter"===t&&a.collides(i)||(o=!0),"declutter"===v&&a.collides(r.declutterBox)||(s=!0),"declutter"===t&&"declutter"===v){const e=o&&s;o=e,s=e}o&&("none"!==t&&a.insert(i),this.replayImageOrLabel_.apply(this,e)),s&&("none"!==v&&a.insert(r.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++u;break;case Instruction.DRAW_CHARS:const se=r[1],ae=r[2],le=r[3],ce=r[4];R=r[5];const ue=r[6],he=r[7],de=r[8];x=r[9];const pe=r[10];S=r[11],Array.isArray(S)&&(S=S.reduce(richTextToPlainText,"")),T=r[12];const fe=[r[13],r[13]];v=r[14]||"declutter";const ge=r[15],me=r[16],ye=this.textStates[T],ve=ye.font,_e=[ye.scale[0]*he,ye.scale[1]*he];let be;ve in this.widths_?be=this.widths_[ve]:(be={},this.widths_[ve]=be);const Ee=lineStringLength(c,se,ae,2),we=Math.abs(_e[0])*measureAndCacheTextWidth(ve,S,be);if(ce||we<=Ee){const r=drawTextOnPath(c,se,ae,2,S,(Ee-we)*horizontalTextAlign(S,this.textStates[T].textAlign),ue,Math.abs(_e[0]),measureAndCacheTextWidth,ve,be,L?0:this.viewRotation_,ge);e:if(r){const n=[];let i,o,s,l,c;if(x)for(i=0,o=r.length;i<o;++i){c=r[i],s=c[4],l=this.createLabel(s,T,"",x),g=c[2]+(_e[0]<0?-pe:pe)-me,m=le*l.height+2*(.5-le)*pe*_e[1]/_e[0]-de;const o=this.calculateImageOrLabelDimensions_(l.width,l.height,c[0],c[1],l.width,l.height,g,m,0,0,c[3],fe,!1,defaultPadding,!1,D);if(a&&"declutter"===v&&a.collides(o.declutterBox))break e;n.push([e,t,l,o,1,null,null])}if(R)for(i=0,o=r.length;i<o;++i){c=r[i],s=c[4],l=this.createLabel(s,T,R,""),g=c[2]-me,m=le*l.height-de;const o=this.calculateImageOrLabelDimensions_(l.width,l.height,c[0],c[1],l.width,l.height,g,m,0,0,c[3],fe,!1,defaultPadding,!1,D);if(a&&"declutter"===v&&a.collides(o.declutterBox))break e;n.push([e,t,l,o,1,null,null])}a&&"none"!==v&&a.load(n.map(getDeclutterBox));for(let e=0,t=n.length;e<t;++e)this.replayImageOrLabel_.apply(this,n[e])}}++u;break;case Instruction.END_GEOMETRY:if(void 0!==o){D=r[1];const e=o(D,F,v);if(e)return e}++u;break;case Instruction.FILL:M?A++:this.fill_(e),++u;break;case Instruction.MOVE_TO_LINE_TO:let Ce,Se,Te;if(p=r[1],d=r[2],y=r[3],y){const e=(r[4]??!1)||Math.abs(c[p]-c[d-2])<1e-6&&Math.abs(c[p+1]-c[d-1])<1e-6;offsetLineString(c,p,d,2,y,e,f),removeOffsetCycles(f,2,e),Ce=f,Se=0,Te=Ce.length}else Ce=c,Se=p,Te=d;N=Ce[Se],$=Ce[Se+1],e.moveTo(N,$),_=N+.5|0,b=$+.5|0;for(let t=Se+2;t<Te;t+=2)N=Ce[t],$=Ce[t+1],E=N+.5|0,w=$+.5|0,t!=Te-2&&E===_&&w===b||(e.lineTo(N,$),_=E,b=w);++u;break;case Instruction.SET_FILL_STYLE:this.alignAndScaleFill_=r[2],A?(this.fill_(e),A=0,I&&(e.stroke(),I=0)):I&&r[1]&&(e.stroke(),I=0),e.fillStyle=r[1],++u;break;case Instruction.SET_STROKE_STYLE:A&&r[1]&&(this.fill_(e),A=0),I&&(e.stroke(),I=0),this.setStrokeStyle_(e,r),++u;break;case Instruction.STROKE:M?I++:e.stroke(),++u;break;default:++u}}A&&this.fill_(e),I&&e.stroke()}execute(e,t,r,n,i,o){this.viewRotation_=n,this.execute_(e,t,r,this.instructions,i,void 0,void 0,o)}executeHitDetection(e,t,r,n,i){return this.viewRotation_=r,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,n,i)}},ALL=["Polygon","Circle","LineString","Image","Text","Default"],DECLUTTER=["Image","Text"],NON_DECLUTTER=ALL.filter(e=>!DECLUTTER.includes(e)),willReadFrequently=!1,canvasReadsBenchmarked=!1;function benchmarkCanvasReads(){let e=0;const t=t=>{const r=createCanvasContext2D(1,1,null,{willReadFrequently:t});let n=0;const i=performance.now();for(;performance.now()-i<50;++n)r.fillStyle=`rgba(255,0,${n%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return e=n>e?n:e,n};willReadFrequently={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[e],canvasReadsBenchmarked=!0}var ExecutorGroup=class{constructor(e,t,r,n,i,o,s){this.maxExtent_=e,this.overlaps_=n,this.pixelRatio_=r,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=create(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(i,s)}clip(e,t){const r=this.getClipCoords(t);e.beginPath(),e.moveTo(r[0],r[1]),e.lineTo(r[2],r[3]),e.lineTo(r[4],r[5]),e.lineTo(r[6],r[7]),e.clip()}createExecutors_(e,t){for(const r in e){let n=this.executorsByZIndex_[r];void 0===n&&(n={},this.executorsByZIndex_[r]=n);const i=e[r];for(const e in i){const r=i[e];n[e]=new Executor(this.resolution_,this.pixelRatio_,this.overlaps_,r,t)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const r=this.executorsByZIndex_[t];for(let t=0,n=e.length;t<n;++t)if(e[t]in r)return!0}return!1}forEachFeatureAtCoordinate(e,t,r,n,i,o){!1===canvasReadsBenchmarked&&benchmarkCanvasReads();const s=2*(n=Math.round(n))+1,a=compose(this.hitDetectionTransform_,n+.5,n+.5,1/t,-1/t,-r,-e[0],-e[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=createCanvasContext2D(s,s,null,{willReadFrequently:willReadFrequently}));const c=this.hitDetectionContext_;let u;c.canvas.width!==s||c.canvas.height!==s?(c.canvas.width=s,c.canvas.height=s):l||c.clearRect(0,0,s,s),void 0!==this.renderBuffer_&&(u=createEmpty(),extendCoordinate(u,e),buffer(u,t*(this.renderBuffer_+n),u));const h=getPixelIndexArray(n);let d;function p(e,t,r){const a=c.getImageData(0,0,s,s).data;for(let l=0,u=h.length;l<u;l++)if(a[h[l]]>0){if(!o||"none"===r||"Image"!==d&&"Text"!==d||o.includes(e)){const r=(h[l]-3)/4,o=n-r%s,a=n-(r/s|0),c=i(e,t,o*o+a*a);if(c)return c}c.clearRect(0,0,s,s);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let g,m,y,v,_;for(f.sort(ascending),g=f.length-1;g>=0;--g){const e=f[g].toString();for(y=this.executorsByZIndex_[e],m=ALL.length-1;m>=0;--m)if(d=ALL[m],v=y[d],void 0!==v&&(_=v.executeHitDetection(c,a,r,p,u),_))return _}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const r=t[0],n=t[1],i=t[2],o=t[3],s=[r,n,r,o,i,o,i,n];return transform2D(s,0,8,2,e,s),s}isEmpty(){return isEmpty$1(this.executorsByZIndex_)}execute(e,t,r,n,i,o,s){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(s?descending:ascending),o=o||ALL;const l=ALL.length;for(let c=0,u=a.length;c<u;++c){const u=a[c].toString(),h=this.executorsByZIndex_[u];for(let d=0,p=o.length;d<p;++d){const u=o[d],p=h[u];if(void 0!==p){const o=null===s?void 0:p.getZIndexContext(),h=o?o.getContext():e,d=this.maxExtent_&&"Image"!==u&&"Text"!==u;if(d&&(h.save(),this.clip(h,r)),o&&"Text"!==u&&"Image"!==u?o.pushFunction(e=>p.execute(e,t,r,n,i,s)):p.execute(h,t,r,n,i,s),d&&h.restore(),o){o.offset();const e=a[c]*l+ALL.indexOf(u);this.deferredZIndexContexts_[e]||(this.deferredZIndexContexts_[e]=[]),this.deferredZIndexContexts_[e].push(o)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(ascending);for(let r=0,n=t.length;r<n;++r)e[t[r]].forEach(e=>{e.draw(this.renderedContext_),e.clear()}),e[t[r]].length=0}},circlePixelIndexArrayCache={};function getPixelIndexArray(e){if(void 0!==circlePixelIndexArrayCache[e])return circlePixelIndexArrayCache[e];const t=2*e+1,r=e*e,n=new Array(r+1);for(let o=0;o<=e;++o)for(let i=0;i<=e;++i){const s=o*o+i*i;if(s>r)break;let a=n[s];a||(a=[],n[s]=a),a.push(4*((e+o)*t+(e+i))+3),o>0&&a.push(4*((e-o)*t+(e+i))+3),i>0&&(a.push(4*((e+o)*t+(e-i))+3),o>0&&a.push(4*((e-o)*t+(e-i))+3))}const i=[];for(let o=0,s=n.length;o<s;++o)n[o]&&i.push(...n[o]);return circlePixelIndexArrayCache[e]=i,i}var CanvasImmediateRenderer=class extends VectorContext{constructor(e,t,r,n,i,o,s){super(),this.context_=e,this.pixelRatio_=t,this.extent_=r,this.transform_=n,this.transformRotation_=n?toFixed(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=i,this.squaredTolerance_=o,this.userTransform_=s,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_=create()}drawImages_(e,t,r,n){if(!this.image_)return;const i=transform2D(e,t,r,n,this.transform_,this.pixelCoordinates_),o=this.context_,s=this.tmpLocalTransform_,a=o.globalAlpha;1!=this.imageOpacity_&&(o.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let c=0,u=i.length;c<u;c+=2){const e=i[c]-this.imageAnchorX_,t=i[c+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const r=e+this.imageAnchorX_,n=t+this.imageAnchorY_;compose(s,r,n,1,1,l,-r,-n),o.save(),o.transform.apply(o,s),o.translate(r,n),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,t,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(o.globalAlpha=a)}drawText_(e,t,r,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const i=transform2D(e,t,r,n,this.transform_,this.pixelCoordinates_),o=this.context_;let s=this.textRotation_;for(0===this.transformRotation_&&(s-=this.viewRotation_),this.textRotateWithView_&&(s+=this.viewRotation_);t<r;t+=n){const e=i[t]+this.textOffsetX_,r=i[t+1]+this.textOffsetY_;0!==s||1!=this.textScale_[0]||1!=this.textScale_[1]?(o.save(),o.translate(e-this.textOffsetX_,r-this.textOffsetY_),o.rotate(s),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,e,r),this.textFillState_&&o.fillText(this.text_,e,r))}}moveToLineTo_(e,t,r,n,i,o){const s=this.context_;let a=transform2D(e,t,r,n,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){const e=a.length,t=i||Math.abs(a[0]-a[e-2])<1e-6&&Math.abs(a[1]-a[e-1])<1e-6;a=offsetLineString(a,0,e,2,o,t,a),removeOffsetCycles(a,2,t)}s.moveTo(a[0],a[1]);let l=a.length;i&&(l-=2);for(let c=2;c<l;c+=2)s.lineTo(a[c],a[c+1]);return i&&s.closePath(),r}drawRings_(e,t,r,n,i){for(let o=0,s=r.length;o<s;++o)t=this.moveToLineTo_(e,t,r[o],n,!0,i);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),intersects$1(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=transformGeom2D(e,this.transform_,this.pixelCoordinates_),r=t[2]-t[0],n=t[3]-t[1],i=Math.sqrt(r*r+n*n),o=this.context_;o.beginPath(),o.arc(t[0],t[1],i,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}""!==this.text_&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e)}}drawFeature(e,t){const r=t.getGeometryFunction()(e);r&&(this.setStyle(t),this.drawGeometry(r))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let r=0,n=t.length;r<n;++r)this.drawGeometry(t[r])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),r=e.getStride();this.image_&&this.drawImages_(t,0,t.length,r),""!==this.text_&&this.drawText_(t,0,t.length,r)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),r=e.getStride();this.image_&&this.drawImages_(t,0,t.length,r),""!==this.text_&&this.drawText_(t,0,t.length,r)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),intersects$1(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,r=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(r,0,r.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(""!==this.text_){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if(intersects$1(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,r=e.getFlatCoordinates();let n=0;const i=e.getEnds(),o=e.getStride();t.beginPath();for(let e=0,s=i.length;e<s;++e)n=this.moveToLineTo_(r,n,i[e],o,!1,this.strokeState_.strokeOffset);t.stroke()}if(""!==this.text_){const t=e.getFlatMidpoints();this.drawText_(t,0,t.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),intersects$1(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(""!==this.text_){const t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),intersects$1(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_,r=e.getOrientedFlatCoordinates();let n=0;const i=e.getEndss(),o=e.getStride();t.beginPath();for(let e=0,s=i.length;e<s;++e){const t=i[e];n=this.drawRings_(r,n,t,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(""!==this.text_){const t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){const t=this.context_,r=this.contextFillState_;r?r.fillStyle!=e.fillStyle&&(r.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=e.lineCap&&(r.lineCap=e.lineCap,t.lineCap=e.lineCap),equals$2(r.lineDash,e.lineDash)||t.setLineDash(r.lineDash=e.lineDash),r.lineDashOffset!=e.lineDashOffset&&(r.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),r.lineJoin!=e.lineJoin&&(r.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),r.lineWidth!=e.lineWidth&&(r.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),r.miterLimit!=e.miterLimit&&(r.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),r.strokeStyle!=e.strokeStyle&&(r.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){const t=this.context_,r=this.contextTextState_,n=e.textAlign?e.textAlign:defaultTextAlign;r?(r.font!=e.font&&(r.font=e.font,t.font=e.font),r.textAlign!=n&&(r.textAlign=n,t.textAlign=n),r.textBaseline!=e.textBaseline&&(r.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=n,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:n,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(e){const t=e.getColor();this.fillState_={fillStyle:asColorLike(t||defaultFillStyle)}}else this.fillState_=null;if(t){const e=t.getColor(),r=t.getLineCap(),n=t.getLineDash(),i=t.getLineDashOffset(),o=t.getLineJoin(),s=t.getWidth(),a=t.getMiterLimit(),l=n||defaultLineDash,c=t.getOffset();this.strokeState_={lineCap:void 0!==r?r:defaultLineCap,lineDash:1===this.pixelRatio_?l:l.map(e=>e*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:void 0!==o?o:defaultLineJoin,lineWidth:(void 0!==s?s:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:asColorLike(e||defaultStrokeStyle),strokeOffset:(c??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(e){let t;if(!e||!(t=e.getSize()))return void(this.image_=null);const r=e.getPixelRatio(this.pixelRatio_),n=e.getAnchor(),i=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*r,this.imageAnchorY_=n[1]*r,this.imageHeight_=t[1]*r,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/r,o[1]*this.pixelRatio_/r],this.imageWidth_=t[0]*r}setTextStyle(e){if(e){const t=e.getFill();if(t){const e=t.getColor();this.textFillState_={fillStyle:asColorLike(e||defaultFillStyle)}}else this.textFillState_=null;const r=e.getStroke();if(r){const e=r.getColor(),t=r.getLineCap(),n=r.getLineDash(),i=r.getLineDashOffset(),o=r.getLineJoin(),s=r.getWidth(),a=r.getMiterLimit();this.textStrokeState_={lineCap:void 0!==t?t:defaultLineCap,lineDash:n||defaultLineDash,lineDashOffset:i||0,lineJoin:void 0!==o?o:defaultLineJoin,lineWidth:void 0!==s?s:1,miterLimit:void 0!==a?a:10,strokeStyle:asColorLike(e||defaultStrokeStyle)}}else this.textStrokeState_=null;const n=e.getFont(),i=e.getOffsetX(),o=e.getOffsetY(),s=e.getRotateWithView(),a=e.getRotation(),l=e.getScaleArray(),c=e.getText(),u=e.getTextAlign(),h=e.getTextBaseline();this.textState_={font:void 0!==n?n:defaultFont,textAlign:void 0!==u?u:defaultTextAlign,textBaseline:void 0!==h?h:defaultTextBaseline},this.text_=void 0!==c?Array.isArray(c)?c.reduce((e,t,r)=>e+(r%2?" ":t),""):c:"",this.textOffsetX_=void 0!==i?this.pixelRatio_*i:0,this.textOffsetY_=void 0!==o?this.pixelRatio_*o:0,this.textRotateWithView_=void 0!==s&&s,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},HIT_DETECT_RESOLUTION=.5;function createHitDetectionImageData(e,t,r,n,i,o,s,a,l){const c=l?toUserExtent(i,l):i,u=createCanvasContext2D(e[0]*HIT_DETECT_RESOLUTION,e[1]*HIT_DETECT_RESOLUTION);u.imageSmoothingEnabled=!1;const h=u.canvas,d=new CanvasImmediateRenderer(u,HIT_DETECT_RESOLUTION,i,null,s,a,l?getTransformFromProjections(getUserProjection(),l):null),p=r.length,f=Math.floor(16777215/p),g={};for(let y=1;y<=p;++y){const e=r[y-1],t=e.getStyleFunction()||n;if(!t)continue;let i=t(e,o);if(!i)continue;Array.isArray(i)||(i=[i]);const s=(y*f).toString(16).padStart(7,"#00000");for(let r=0,n=i.length;r<n;++r){const t=i[r],n=t.getGeometryFunction()(e);if(!n||!intersects$1(c,n.getExtent()))continue;const o=t.clone(),a=o.getFill();a&&a.setColor(s);const l=o.getStroke();l&&(l.setColor(s),l.setLineDash(null)),o.setText(void 0);const u=t.getImage();if(u){const e=u.getImageSize();if(!e)continue;const t=createCanvasContext2D(e[0],e[1],void 0,{alpha:!1}),r=t.canvas;t.fillStyle=s,t.fillRect(0,0,r.width,r.height),o.setImage(new Icon({img:r,anchor:u.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:u.getOrigin(),opacity:1,size:u.getSize(),scale:u.getScale(),rotation:u.getRotation(),rotateWithView:u.getRotateWithView()}))}const h=o.getZIndex()||0;let d=g[h];d||(d={},g[h]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const p=n.getType();if("GeometryCollection"===p){const e=n.getGeometriesArrayRecursive();for(let t=0,r=e.length;t<r;++t){const r=e[t];d[r.getType().replace("Multi","")].push(r,o)}}else d[p.replace("Multi","")].push(n,o)}}const m=Object.keys(g).map(Number).sort(ascending);for(let y=0,v=m.length;y<v;++y){const e=g[m[y]];for(const r in e){const n=e[r];for(let e=0,r=n.length;e<r;e+=2){d.setStyle(n[e+1]);for(let r=0,i=t.length;r<i;++r)d.setTransform(t[r]),d.drawGeometry(n[e])}}}return u.getImageData(0,0,h.width,h.height)}function hitDetect(e,t,r){const n=[];if(r){const i=Math.floor(Math.round(e[0])*HIT_DETECT_RESOLUTION),o=Math.floor(Math.round(e[1])*HIT_DETECT_RESOLUTION),s=4*(clamp$1(i,0,r.width-1)+clamp$1(o,0,r.height-1)*r.width),a=r.data[s],l=r.data[s+1],c=r.data[s+2]+256*(l+256*a),u=Math.floor(16777215/t.length);c&&c%u===0&&n.push(t[c/u-1])}return n}var SIMPLIFY_TOLERANCE=.5,GEOMETRY_RENDERERS={Point:renderPointGeometry,LineString:renderLineStringGeometry,Polygon:renderPolygonGeometry,MultiPoint:renderMultiPointGeometry,MultiLineString:renderMultiLineStringGeometry,MultiPolygon:renderMultiPolygonGeometry,GeometryCollection:renderGeometryCollectionGeometry,Circle:renderCircleGeometry};function defaultOrder(e,t){return parseInt(getUid(e),10)-parseInt(getUid(t),10)}function getSquaredTolerance(e,t){const r=getTolerance(e,t);return r*r}function getTolerance(e,t){return SIMPLIFY_TOLERANCE*e/t}function renderCircleGeometry(e,t,r,n,i){const o=r.getFill(),s=r.getStroke();if(o||s){const a=e.getBuilder(r.getZIndex(),"Circle");a.setFillStrokeStyle(o,s),a.drawCircle(t,n,i)}const a=r.getText();if(a&&a.getText()){const o=e.getBuilder(r.getZIndex(),"Text");o.setTextStyle(a),o.drawText(t,n,i)}}function renderFeature$1(e,t,r,n,i,o,s,a){const l=[],c=r.getImage();if(c){let e=!0;const t=c.getImageState();t==ImageState_default.LOADED||t==ImageState_default.ERROR?e=!1:t==ImageState_default.IDLE&&c.load(),e&&l.push(c.ready())}const u=r.getFill();u&&u.loading()&&l.push(u.ready());const h=l.length>0;return h&&Promise.all(l).then(()=>i(null)),renderFeatureInternal(e,t,r,n,o,s,a),h}function renderFeatureInternal(e,t,r,n,i,o,s){const a=r.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(n,i);r.getRenderer()?renderGeometry(e,l,r,t,s):(0,GEOMETRY_RENDERERS[l.getType()])(e,l,r,t,s,o)}function renderGeometry(e,t,r,n,i){if("GeometryCollection"==t.getType()){const o=t.getGeometries();for(let t=0,s=o.length;t<s;++t)renderGeometry(e,o[t],r,n,i);return}e.getBuilder(r.getZIndex(),"Default").drawCustom(t,n,r.getRenderer(),r.getHitDetectionRenderer(),i)}function renderGeometryCollectionGeometry(e,t,r,n,i,o){const s=t.getGeometriesArray();let a,l;for(a=0,l=s.length;a<l;++a)(0,GEOMETRY_RENDERERS[s[a].getType()])(e,s[a],r,n,i,o)}function renderLineStringGeometry(e,t,r,n,i){const o=r.getStroke();if(o){const s=e.getBuilder(r.getZIndex(),"LineString");s.setFillStrokeStyle(null,o),s.drawLineString(t,n,i)}const s=r.getText();if(s&&s.getText()){const o=e.getBuilder(r.getZIndex(),"Text");o.setTextStyle(s),o.drawText(t,n,i)}}function renderMultiLineStringGeometry(e,t,r,n,i){const o=r.getStroke();if(o){const s=e.getBuilder(r.getZIndex(),"LineString");s.setFillStrokeStyle(null,o),s.drawMultiLineString(t,n,i)}const s=r.getText();if(s&&s.getText()){const o=e.getBuilder(r.getZIndex(),"Text");o.setTextStyle(s),o.drawText(t,n,i)}}function renderMultiPolygonGeometry(e,t,r,n,i){const o=r.getFill(),s=r.getStroke();if(s||o){const a=e.getBuilder(r.getZIndex(),"Polygon");a.setFillStrokeStyle(o,s),a.drawMultiPolygon(t,n,i)}const a=r.getText();if(a&&a.getText()){const o=e.getBuilder(r.getZIndex(),"Text");o.setTextStyle(a),o.drawText(t,n,i)}}function renderPointGeometry(e,t,r,n,i,o){const s=r.getImage(),a=r.getText(),l=a&&a.getText(),c=o&&s&&l?{}:void 0;if(s){if(s.getImageState()!=ImageState_default.LOADED)return;const o=e.getBuilder(r.getZIndex(),"Image");o.setImageStyle(s,c),o.drawPoint(t,n,i)}if(l){const o=e.getBuilder(r.getZIndex(),"Text");o.setTextStyle(a,c),o.drawText(t,n,i)}}function renderMultiPointGeometry(e,t,r,n,i,o){const s=r.getImage(),a=s&&0!==s.getOpacity(),l=r.getText(),c=l&&l.getText(),u=o&&a&&c?{}:void 0;if(a){if(s.getImageState()!=ImageState_default.LOADED)return;const o=e.getBuilder(r.getZIndex(),"Image");o.setImageStyle(s,u),o.drawMultiPoint(t,n,i)}if(c){const o=e.getBuilder(r.getZIndex(),"Text");o.setTextStyle(l,u),o.drawText(t,n,i)}}function renderPolygonGeometry(e,t,r,n,i){const o=r.getFill(),s=r.getStroke();if(o||s){const a=e.getBuilder(r.getZIndex(),"Polygon");a.setFillStrokeStyle(o,s),a.drawPolygon(t,n,i)}const a=r.getText();if(a&&a.getText()){const o=e.getBuilder(r.getZIndex(),"Text");o.setTextStyle(a),o.drawText(t,n,i)}}var maxStaleKeys=5,LayerRenderer=class extends Observable{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=maxStaleKeys,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return abstract()}getData(e){return null}prepareFrame(e){return abstract()}renderFrame(e,t){return abstract()}forEachFeatureAtCoordinate(e,t,r,n,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){const t=e.target;t.getState()!==ImageState_default.LOADED&&t.getState()!==ImageState_default.ERROR||this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=ImageState_default.LOADED&&t!=ImageState_default.ERROR&&e.addEventListener(EventType_default$2.CHANGE,this.boundHandleImageChange_),t==ImageState_default.IDLE&&(e.load(),t=e.getState()),t==ImageState_default.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&"ready"===e.getSourceState()&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},canvasPool$2=[],pixelContext=null;function createPixelContext(){pixelContext=createCanvasContext2D(1,1,void 0,{willReadFrequently:!0})}var CanvasLayerRenderer=class extends LayerRenderer{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=create(),this.pixelTransform=create(),this.inversePixelTransform=create(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,r){let n;pixelContext||createPixelContext(),pixelContext.clearRect(0,0,1,1);try{pixelContext.drawImage(e,t,r,1,1,0,0,1,1),n=pixelContext.getImageData(0,0,1,1).data}catch{return pixelContext=null,null}return n}getBackground(e){let t=this.getLayer().getBackground();return"function"==typeof t&&(t=t(e.viewState.resolution)),t||void 0}useContainer(e,t,r,n,i){if(isCanvas(e)&&0===this.pixelTransform[1]&&0===this.pixelTransform[2]&&0===this.pixelTransform[4]&&0===this.pixelTransform[5]&&e.width===n&&e.height===i){const t=e,n=t.getContext("2d");if(n)return this.container=e,this.context=n,this.containerReused=!0,void(r&&(n.fillStyle=r,n.fillRect(0,0,t.width,t.height)))}const o=this.getLayer().getClassName();let s,a;if(e&&e.className===o&&(!r||e&&e.style.backgroundColor&&equals$2(asArray(e.style.backgroundColor),asArray(r)))){const t=e.firstElementChild;isCanvas(t)&&(a=t.getContext("2d"))}if(a&&equivalent(a.canvas.style.transform,t)?(this.container=e,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=WORKER_OFFSCREEN_CANVAS?createMockDiv():document.createElement("div"),s.className=o;let e=s.style;e.position="absolute",e.width="100%",e.height="100%",a=createCanvasContext2D();const t=a.canvas;s.appendChild(t),e=t.style,e.position="absolute",e.left="0",e.transformOrigin="top left",this.container=s,this.context=a}this.containerReused||!r||this.container.style.backgroundColor||(this.container.style.backgroundColor=r)}clipUnrotated(e,t,r){const n=getTopLeft(r),i=getTopRight(r),o=getBottomRight(r),s=getBottomLeft(r);apply$1(t.coordinateToPixelTransform,n),apply$1(t.coordinateToPixelTransform,i),apply$1(t.coordinateToPixelTransform,o),apply$1(t.coordinateToPixelTransform,s);const a=this.inversePixelTransform;apply$1(a,n),apply$1(a,i),apply$1(a,o),apply$1(a,s),e.save(),e.beginPath(),e.moveTo(Math.round(n[0]),Math.round(n[1])),e.lineTo(Math.round(i[0]),Math.round(i[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.clip()}prepareContainer(e,t){const r=e.extent,n=e.viewState.resolution,i=e.viewState.rotation,o=e.pixelRatio,s=Math.round(getWidth(r)/n*o),a=Math.round(getHeight(r)/n*o);compose(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,i,-s/2,-a/2),makeInverse(this.inversePixelTransform,this.pixelTransform);const l=toString$1(this.pixelTransform),c=this.getBackground(e);if(this.useContainer(t,l,c,s,a),!this.containerReused){const e=this.context.canvas;e.width!=s||e.height!=a?(e.width=s,e.height=a):this.context.clearRect(0,0,s,a),l!==e.style.transform&&(e.style.transform=l)}}dispatchRenderEvent_(e,t,r){const n=this.getLayer();if(n.hasListener(e)){const i=new RenderEvent(e,this.inversePixelTransform,r,t);n.dispatchEvent(i)}}preRender(e,t){this.frameState=t,t.declutter||this.dispatchRenderEvent_(EventType_default.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(EventType_default.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new ZIndexContext),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(EventType_default.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(EventType_default.POSTRENDER,this.context,e))}getRenderTransform(e,t,r,n,i,o,s){const a=i/2,l=o/2,c=n/t,u=-c,h=-e[0]+s,d=-e[1];return compose(this.tempTransform,a,l,c,u,-r,h,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},CanvasVectorLayerRenderer=class extends CanvasLayerRenderer{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=createEmpty(),this.wrappedRenderedExtent_=createEmpty(),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(e,t,r){const n=t.extent,i=t.viewState,o=i.center,s=i.resolution,a=i.projection,l=i.rotation,c=a.getExtent(),u=this.getLayer().getSource(),h=this.getLayer().getDeclutter(),d=t.pixelRatio,p=t.viewHints,f=!(p[ViewHint_default.ANIMATING]||p[ViewHint_default.INTERACTING]),g=this.context,m=Math.round(getWidth(n)/s*d),y=Math.round(getHeight(n)/s*d),v=u.getWrapX()&&a.canWrapX(),_=v?getWidth(c):null,b=v?Math.ceil((n[2]-c[2])/_)+(this.extendX_?2:1):1;let E=v?Math.floor((n[0]-c[0])/_)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(o,s,0,d,m,y,E*_);t.declutter&&(n=n.slice(0)),e.execute(g,[g.canvas.width,g.canvas.height],n,l,f,void 0===r?ALL:r?DECLUTTER:NON_DECLUTTER,r?h&&t.declutter[h]:void 0)}while(++E<b)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=createCanvasContext2D(this.context.canvas.width,this.context.canvas.height,canvasPool$2))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,releaseCanvas(this.context),canvasPool$2.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){const r=e.layerStatesArray[e.layerIndex];this.opacity_=r.opacity;const n=e.viewState;this.prepareContainer(e,t);const i=this.context,o=this.replayGroup_;let s=o&&!o.isEmpty();if(!s&&!this.getLayer().hasListener(EventType_default.PRERENDER)&&!this.getLayer().hasListener(EventType_default.POSTRENDER))return this.container;this.setDrawContext_(),this.preRender(i,e);const a=n.projection;this.clipExtent_=null;let l=!1;if(s&&r.extent&&this.clipping){const t=fromUserExtent(r.extent,a);s=intersects$1(t,e.extent),s&&!containsExtent(t,e.extent)&&(e.declutter?this.clipExtent_=t:(this.clipUnrotated(i,e,t),l=!0))}return s&&this.renderWorlds(o,e,!this.getLayer().getDeclutter()&&void 0),l&&i.restore(),this.postRender(i,e),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const e=this.frameState.size.slice(),t=this.renderedCenter_,r=this.renderedResolution_,n=this.renderedRotation_,i=this.renderedProjection_,o=this.wrappedRenderedExtent_,s=this.getLayer(),a=[],l=e[0]*HIT_DETECT_RESOLUTION,c=e[1]*HIT_DETECT_RESOLUTION;a.push(this.getRenderTransform(t,r,n,HIT_DETECT_RESOLUTION,l,c,0).slice());const u=s.getSource(),h=i.getExtent();if(u.getWrapX()&&i.canWrapX()&&!containsExtent(h,o)){let e=o[0];const i=getWidth(h);let s,u=0;for(;e<h[0];)--u,s=i*u,a.push(this.getRenderTransform(t,r,n,HIT_DETECT_RESOLUTION,l,c,s).slice()),e+=i;for(u=0,e=o[2];e>h[2];)++u,s=i*u,a.push(this.getRenderTransform(t,r,n,HIT_DETECT_RESOLUTION,l,c,s).slice()),e-=i}const d=getUserProjection();this.hitDetectionImageData_=createHitDetectionImageData(e,a,this.renderedFeatures_,s.getStyleFunction(),o,r,n,getSquaredTolerance(r,this.renderedPixelRatio_),d?i:null)}t(hitDetect(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,r,n,i){if(!this.replayGroup_)return;const o=t.viewState.resolution,s=t.viewState.rotation,a=this.getLayer(),l={},c=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,s,r,function(e,t,r){const o=getUid(e),s=l[o];if(s){if(!0!==s&&r<s.distanceSq){if(0===r)return l[o]=!0,i.splice(i.lastIndexOf(s),1),n(e,a,t);s.geometry=t,s.distanceSq=r}}else{if(0===r)return l[o]=!0,n(e,a,t);i.push(l[o]={feature:e,layer:a,geometry:t,distanceSq:r,callback:n})}},c?t.declutter?.[c]?.all().map(e=>e.value):null)}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),r=t.getSource();if(!r)return!1;const n=e.viewHints[ViewHint_default.ANIMATING],i=e.viewHints[ViewHint_default.INTERACTING],o=t.getUpdateWhileAnimating(),s=t.getUpdateWhileInteracting();if(this.ready&&!o&&n||!s&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=e.extent,l=e.viewState,c=l.projection,u=l.resolution,h=e.pixelRatio,d=t.getRevision(),p=t.getRenderBuffer();let f=t.getRenderOrder();void 0===f&&(f=defaultOrder);const g=l.center.slice(),m=buffer(a,p*u),y=m.slice(),v=[m.slice()],_=c.getExtent(),b=r.getWrapX()&&c.canWrapX();if(this.extendX_=!1,b){const e=r.getExtent();e&&!isEmpty(e)&&(this.extendX_=e[0]<_[0]||e[2]>_[2])}if(b&&(!containsExtent(_,e.extent)||this.extendX_)){const e=getWidth(_),t=Math.max(getWidth(m)/2,e);let r=_[0],n=_[2];this.extendX_&&(r-=e,n+=e),m[0]=r-t,m[2]=n+t,wrapX$1(g,c);const i=wrapX$2(v[0],c);i[0]<_[0]&&i[2]<_[2]?v.push([i[0]+e,i[1],i[2]+e,i[3]]):i[0]>_[0]&&i[2]>_[2]&&v.push([i[0]-e,i[1],i[2]-e,i[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===h&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!e.declutter&&containsExtent(this.wrappedRenderedExtent_,m))return equals$2(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const E=new BuilderGroup(getTolerance(u,h),m,u,h),w=getUserProjection();let C;if(w){for(let e=0,t=v.length;e<t;++e){const t=toUserExtent(v[e],c);r.loadFeatures(t,toUserResolution(u,c),w)}C=getTransformFromProjections(w,c)}else for(let P=0,L=v.length;P<L;++P)r.loadFeatures(v[P],u,c);const S=getSquaredTolerance(u,h);let T=!0;const x=(e,r)=>{let n;const i=e.getStyleFunction()||t.getStyleFunction();if(i&&(n=i(e,u)),n){const t=this.renderFeature(e,S,n,E,C,this.getLayer().getDeclutter(),r);T=T&&!t}},R=toUserExtent(m,c),A=r.getFeaturesInExtent(R);f&&A.sort(f);for(let P=0,L=A.length;P<L;++P)x(A[P],P);this.renderedFeatures_=A,this.ready=T;const I=E.finish(),k=new ExecutorGroup(m,u,h,r.getOverlaps(),I,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=u,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=m,this.renderedCenter_=g,this.renderedProjection_=c,this.renderedPixelRatio_=h,this.replayGroup_=k,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,r,n,i,o,s){if(!r)return!1;let a=!1;if(Array.isArray(r))for(let l=0,c=r.length;l<c;++l)a=renderFeature$1(n,e,r[l],t,this.boundHandleStyleImageChange_,i,o,s)||a;else a=renderFeature$1(n,e,r,t,this.boundHandleStyleImageChange_,i,o,s);return a}},VectorLayer=class extends BaseVectorLayer{constructor(e){super(e)}createRenderer(){return new CanvasVectorLayerRenderer(this)}},withCredentials=!1;function loadFeaturesXhr(e,t,r,n,i,o,s){const a=new XMLHttpRequest;a.open("GET","function"==typeof e?e(r,n,i):e,!0),"arraybuffer"==t.getType()&&(a.responseType="arraybuffer"),a.withCredentials=withCredentials,a.onload=function(){if(!a.status||a.status>=200&&a.status<300){const e=t.getType();try{let n;"text"==e||"json"==e?n=a.responseText:"xml"==e?n=a.responseXML||a.responseText:"arraybuffer"==e&&(n=a.response),n?o(t.readFeatures(n,{extent:r,featureProjection:i}),t.readProjection(n)):s()}catch{s()}}else s()},a.onerror=s,a.send()}function xhr(e,t){return function(r,n,i,o,s){loadFeaturesXhr(e,t,r,n,i,e=>{this.addFeatures(e),void 0!==o&&o(e)},()=>{this.changed(),void 0!==s&&s()})}}function all$1(){return[[-1/0,-1/0,1/0,1/0]]}function bbox(e){return[e]}var tmpTransform=create(),RenderFeature=class e{constructor(e,t,r,n,i,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=r||null,this.properties_=i,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?createOrUpdateFromCoordinate(this.flatCoordinates_):createOrUpdateFromFlatCoordinates(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const e=getCenter(this.getExtent());this.flatInteriorPoints_=getInteriorPointOfArray(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const e=inflateEnds(this.flatCoordinates_,this.ends_),t=linearRingss(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=getInteriorPointsOfMultiArray(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=interpolatePoint(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const e=this.flatCoordinates_;let t=0;const r=this.ends_;for(let n=0,i=r.length;n<i;++n){const i=r[n],o=interpolatePoint(e,t,i,this.stride_,.5);extend$2(this.flatMidpoints_,o),t=i}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){const t=(e=get$2(e)).getExtent(),r=e.getWorldExtent();if(t&&r){const e=getHeight(r)/getHeight(t);compose(tmpTransform,r[0],r[3],e,-e,0,0,0),transform2D(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,tmpTransform,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new e(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=memoizeOne((t,r)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),r&&this.simplifiedGeometry_.applyTransform(r);const n=this.simplifiedGeometry_.getFlatCoordinates();let i;switch(this.type_){case"LineString":n.length=douglasPeucker(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,n,0),i=[n.length];break;case"MultiLineString":i=[],n.length=douglasPeuckerArray(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,n,0,i);break;case"Polygon":i=[],n.length=quantizeArray(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),n,0,i)}return i&&(this.simplifiedGeometry_=new e(this.type_,n,i,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};RenderFeature.prototype.getFlatCoordinates=RenderFeature.prototype.getOrientedFlatCoordinates;var RBush=class{constructor(e){this.rbush_=new RBush$1(e),this.items_={}}insert(e,t){const r={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(r),this.items_[getUid(t)]=r}load(e,t){const r=new Array(t.length);for(let n=0,i=t.length;n<i;n++){const i=e[n],o=t[n],s={minX:i[0],minY:i[1],maxX:i[2],maxY:i[3],value:o};r[n]=s,this.items_[getUid(o)]=s}this.rbush_.load(r)}remove(e){const t=getUid(e),r=this.items_[t];return delete this.items_[t],null!==this.rbush_.remove(r)}update(e,t){const r=this.items_[getUid(t)];equals$1([r.minX,r.minY,r.maxX,r.maxY],e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(e){return e.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let r;for(let n=0,i=e.length;n<i;n++)if(r=t(e[n]),r)return r;return r}isEmpty(){return isEmpty$1(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return createOrUpdate$2(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}},Source=class extends BaseObject{constructor(e){super(),this.projection=get$2(e.projection),this.attributions_=adaptAttributions(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==e.state?e.state:"ready",this.wrapX_=void 0!==e.wrapX&&e.wrapX,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(e,r){t.viewResolver=e,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){const e=this.getState();return"ready"===e?Promise.resolve():"error"===e?Promise.reject(new Error("Source failed to load")):new Promise((e,t)=>{const r=()=>{const n=this.getState();"ready"===n?(this.un("change",r),e()):"error"===n&&(this.un("change",r),t(new Error("Source failed to load")))};this.on("change",r)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=adaptAttributions(e),this.changed()}setState(e){this.state_=e,this.changed()}};function adaptAttributions(e){return e?"function"==typeof e?e:(Array.isArray(e)||(e=[e]),()=>e):null}var VectorEventType_default={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"},VectorSourceEvent=class extends BaseEvent{constructor(e,t,r){super(e),this.feature=t,this.features=r}},VectorSource=class extends Source{constructor(e){super({attributions:(e=e||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===e.wrapX||e.wrapX}),this.on,this.once,this.un,this.loader_=VOID,this.format_=e.format||null,this.overlaps_=void 0===e.overlaps||e.overlaps,this.url_=e.url,void 0!==e.loader?this.loader_=e.loader:void 0!==this.url_&&(assert$1(this.format_,"`format` must be set when `url` is set"),this.loader_=xhr(this.url_,this.format_)),this.strategy_=void 0!==e.strategy?e.strategy:all$1;const t=void 0===e.useSpatialIndex||e.useSpatialIndex;let r,n;this.featuresRtree_=t?new RBush:null,this.loadedExtentsRtree_=new RBush,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(e.features)?n=e.features:e.features&&(r=e.features,n=r.getArray()),t||void 0!==r||(r=new Collection(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==r&&this.bindFeaturesCollection_(r)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=getUid(e);if(!this.addToIndex_(t,e))return void(this.featuresCollection_&&this.featuresCollection_.remove(e));this.setupChangeEvents_(t,e);const r=e.getGeometry();if(r){const t=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(t,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new VectorSourceEvent(VectorEventType_default.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof RenderFeature||(this.featureChangeKeys_[e]=[listen(t,EventType_default$2.CHANGE,this.handleFeatureChange_,this),listen(t,ObjectEventType_default.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let r=!0;if(void 0!==t.getId()){const e=String(t.getId());if(e in this.idIndex_)if(t instanceof RenderFeature){const n=this.idIndex_[e];n instanceof RenderFeature?Array.isArray(n)?n.push(t):this.idIndex_[e]=[n,t]:r=!1}else r=!1;else this.idIndex_[e]=t}return r&&(assert$1(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),r}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],r=[],n=[];for(let i=0,o=e.length;i<o;i++){const t=e[i],n=getUid(t);this.addToIndex_(n,t)&&r.push(t)}for(let i=0,o=r.length;i<o;i++){const e=r[i],o=getUid(e);this.setupChangeEvents_(o,e);const s=e.getGeometry();if(s){const r=s.getExtent();t.push(r),n.push(e)}else this.nullGeometryFeatures_[o]=e}if(this.featuresRtree_&&this.featuresRtree_.load(t,n),this.hasListener(VectorEventType_default.ADDFEATURE))for(let i=0,o=r.length;i<o;i++)this.dispatchEvent(new VectorSourceEvent(VectorEventType_default.ADDFEATURE,r[i]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(VectorEventType_default.ADDFEATURE,function(r){t||(t=!0,e.push(r.feature),t=!1)}),this.addEventListener(VectorEventType_default.REMOVEFEATURE,function(r){t||(t=!0,e.remove(r.feature),t=!1)}),e.addEventListener(CollectionEventType_default.ADD,e=>{t||(t=!0,this.addFeature(e.element),t=!1)}),e.addEventListener(CollectionEventType_default.REMOVE,e=>{t||(t=!0,this.removeFeature(e.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const e in this.featureChangeKeys_)this.featureChangeKeys_[e].forEach(unlistenByKey);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(e=>{this.removeFeatureInternal(e)});for(const e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new VectorSourceEvent(VectorEventType_default.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const r=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(r,function(r){const n=r.getGeometry();if(n instanceof RenderFeature||n.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(r){const n=r.getGeometry();if(n instanceof RenderFeature||n.intersectsExtent(e)){const e=t(r);if(e)return e}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),isEmpty$1(this.nullGeometryFeatures_)||extend$2(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(e){t.push(e)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const r=wrapAndSliceX(e,t);return[].concat(...r.map(e=>this.featuresRtree_.getInExtent(e)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const r=e[0],n=e[1];let i=null;const o=[NaN,NaN];let s=1/0;const a=[-1/0,-1/0,1/0,1/0];return t=t||TRUE,this.featuresRtree_.forEachInExtent(a,function(e){if(t(e)){const t=e.getGeometry(),l=s;if(s=t instanceof RenderFeature?0:t.closestPointXY(r,n,o,s),s<l){i=e;const t=Math.sqrt(s);a[0]=r-t,a[1]=n-t,a[2]=r+t,a[3]=n+t}}}),i}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){const t=this.idIndex_[e.toString()];return void 0!==t?t:null}getFeatureByUid(e){const t=this.uidIndex_[e];return void 0!==t?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){const t=e.target,r=getUid(t),n=t.getGeometry();if(n){const e=n.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(e,t)):this.featuresRtree_&&this.featuresRtree_.update(e,t)}else r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[r]=t);const i=t.getId();if(void 0!==i){const e=i.toString();this.idIndex_[e]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[e]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[r]=t;this.changed(),this.dispatchEvent(new VectorSourceEvent(VectorEventType_default.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();if(void 0!==t){const r=this.idIndex_[String(t)];return Array.isArray(r)?r.includes(e):r===e}return getUid(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&isEmpty$1(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(e,t,r){const n=this.loadedExtentsRtree_,i=this.strategy_(e,t,r);for(let o=0,s=i.length;o<s;++o){const e=i[o];if(!n.forEachInExtent(e,function(t){return containsExtent(t.extent,e)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new VectorSourceEvent(VectorEventType_default.FEATURESLOADSTART));const i=e=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new VectorSourceEvent(VectorEventType_default.FEATURESLOADEND,void 0,e))},o=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new VectorSourceEvent(VectorEventType_default.FEATURESLOADERROR))};let s=!1;const a=this.loader_.call(this,e,t,r,e=>s||i(e),()=>s||o());a instanceof Promise?(s=!0,a.then(e=>{this.addFeatures(e),i(e)}).catch(o)):this.loader_.length<4&&(this.loading=!1),n.insert(e,{extent:e.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_,r=[];t.forEachInExtent(e,function(e){r.push(e)}),r.forEach(r=>{t.remove(r);const n=getDifference(r.extent,e);for(const e of n)t.insert(e,{extent:e})})}removeFeatures(e){let t=!1;for(let r=0,n=e.length;r<n;++r)t=this.removeFeatureInternal(e[r])||t;t&&this.changed()}removeFeature(e){e&&this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=getUid(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(unlistenByKey),delete this.featureChangeKeys_[t];const r=e.getId();if(void 0!==r){const t=r.toString(),n=this.idIndex_[t];n===e?delete this.idIndex_[t]:Array.isArray(n)&&(n.splice(n.indexOf(e),1),1===n.length&&(this.idIndex_[t]=n[0]))}return delete this.uidIndex_[t],this.hasListener(VectorEventType_default.REMOVEFEATURE)&&this.dispatchEvent(new VectorSourceEvent(VectorEventType_default.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(const t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){assert$1(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(xhr(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},GeometryCollection=class e extends Geometry{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(unlistenByKey),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const e=this.geometries_;for(let t=0,r=e.length;t<r;++t)this.changeEventsKeys_.push(listen(e[t],EventType_default$2.CHANGE,this.changed,this))}clone(){const t=new e(cloneGeometries(this.geometries_));return t.applyProperties(this),t}closestPointXY(e,t,r,n){if(n<closestSquaredDistanceXY(this.getExtent(),e,t))return n;const i=this.geometries_;for(let o=0,s=i.length;o<s;++o)n=i[o].closestPointXY(e,t,r,n);return n}containsXY(e,t){const r=this.geometries_;for(let n=0,i=r.length;n<i;++n)if(r[n].containsXY(e,t))return!0;return!1}computeExtent(e){createOrUpdateEmpty(e);const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)extend$1(e,t[r].getExtent());return e}getGeometries(){return cloneGeometries(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[];const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)t[r].getType()===this.getType()?e=e.concat(t[r].getGeometriesArrayRecursive()):e.push(t[r]);return e}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 r=[],n=this.geometries_;let i=!1;for(let e=0,o=n.length;e<o;++e){const o=n[e],s=o.getSimplifiedGeometry(t);r.push(s),s!==o&&(i=!0)}return i?new e(r):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(e){const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)if(t[r].intersectsExtent(e))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(e,t){const r=this.geometries_;for(let n=0,i=r.length;n<i;++n)r[n].rotate(e,t);this.changed()}scale(e,t,r){r||(r=getCenter(this.getExtent()));const n=this.geometries_;for(let i=0,o=n.length;i<o;++i)n[i].scale(e,t,r);this.changed()}setGeometries(e){this.setGeometriesArray(cloneGeometries(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){const t=this.geometries_;for(let r=0,n=t.length;r<n;++r)t[r].applyTransform(e);this.changed()}translate(e,t){const r=this.geometries_;for(let n=0,i=r.length;n<i;++n)r[n].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function cloneGeometries(e){return e.map(e=>e.clone())}var FeatureFormat=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Feature,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let r=t.dataProjection?get$2(t.dataProjection):this.readProjection(e);t.extent&&r&&"tile-pixels"===r.getUnits()&&(r=get$2(r),r.setWorldExtent(t.extent)),t={dataProjection:r,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return abstract()}readFeature(e,t){return abstract()}readFeatures(e,t){return abstract()}readGeometry(e,t){return abstract()}readProjection(e){return abstract()}writeFeature(e,t){return abstract()}writeFeatures(e,t){return abstract()}writeGeometry(e,t){return abstract()}};function transformGeometryWithOptions(e,t,r){const n=r?get$2(r.featureProjection):null,i=r?get$2(r.dataProjection):null;let o=e;if(n&&i&&!equivalent$1(n,i)){t&&(o=e.clone());const r=t?n:i,s=t?i:n;"tile-pixels"===r.getUnits()?o.transform(r,s):o.applyTransform(getTransform(r,s))}if(t&&r&&void 0!==r.decimals){const t=Math.pow(10,r.decimals),n=function(e){for(let r=0,n=e.length;r<n;++r)e[r]=Math.round(e[r]*t)/t;return e};o===e&&(o=e.clone()),o.applyTransform(n)}return o}var GeometryConstructor={Point:Point,LineString:LineString,Polygon:Polygon,MultiPoint:MultiPoint,MultiLineString:MultiLineString,MultiPolygon:MultiPolygon};function orientFlatCoordinates(e,t,r){return Array.isArray(t[0])?(linearRingssAreOriented(e,0,t,r)||orientLinearRingsArray(e=e.slice(),0,t,r),e):(linearRingsAreOriented(e,0,t,r)||orientLinearRings(e=e.slice(),0,t,r),e)}function createRenderFeature(e,t){const r=e.geometry;if(!r)return[];if(Array.isArray(r))return r.map(t=>createRenderFeature({...e,geometry:t})).flat();const n="MultiPolygon"===r.type?"Polygon":r.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const i=r.layout.length;return transformGeometryWithOptions(new RenderFeature(n,"Polygon"===n?orientFlatCoordinates(r.flatCoordinates,r.ends,i):r.flatCoordinates,r.ends?.flat(),i,e.properties||{},e.id).enableSimplifyTransformed(),!1,t)}function createGeometry(e,t){if(!e)return null;if(Array.isArray(e)){const r=e.map(e=>createGeometry(e,t));return new GeometryCollection(r)}return transformGeometryWithOptions(new(0,GeometryConstructor[e.type])(e.flatCoordinates,e.layout||"XY",e.ends),!1,t)}var JSONFeature=class extends FeatureFormat{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject(getObject(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(getObject(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return abstract()}readFeaturesFromObject(e,t){return abstract()}readGeometry(e,t){return this.readGeometryFromObject(getObject(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return abstract()}readProjection(e){return this.readProjectionFromObject(getObject(e))}readProjectionFromObject(e){return abstract()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return abstract()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return abstract()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return abstract()}};function getObject(e){return"string"==typeof e?JSON.parse(e)||null:null!==e?e:null}var GeoJSON=class extends JSONFeature{constructor(e){e=e||{},super(),this.dataProjection=get$2(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=get$2(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let r=null;r="Feature"===e.type?e:{type:"Feature",geometry:e,properties:null};const n=readGeometryInternal(r.geometry,t);if(this.featureClass===RenderFeature)return createRenderFeature({geometry:n,id:r.id,properties:r.properties},t);const i=new(0,this.featureClass);return this.geometryName_?i.setGeometryName(this.geometryName_):this.extractGeometryName_&&r.geometry_name&&i.setGeometryName(r.geometry_name),i.setGeometry(createGeometry(n,t)),"id"in r&&i.setId(r.id),r.properties&&i.setProperties(r.properties,!0),i}readFeaturesFromObject(e,t){let r=null;if("FeatureCollection"===e.type){r=[];const n=e.features;for(let e=0,i=n.length;e<i;++e){const i=this.readFeatureFromObject(n[e],t);i&&r.push(i)}}else r=[this.readFeatureFromObject(e,t)];return r.flat()}readGeometryFromObject(e,t){return readGeometry(e,t)}readProjectionFromObject(e){const t=e.crs;let r;if(t)if("name"==t.type)r=get$2(t.properties.name);else{if("EPSG"!==t.type)throw new Error("Unknown SRS type");r=get$2("EPSG:"+t.properties.code)}else r=this.dataProjection;return r}writeFeatureObject(e,t){t=this.adaptOptions(t);const r={type:"Feature",geometry:null,properties:null},n=e.getId();if(void 0!==n&&(r.id=n),!e.hasProperties())return r;const i=e.getProperties(),o=e.getGeometry();return o&&(r.geometry=writeGeometry(o,t),delete i[e.getGeometryName()]),isEmpty$1(i)||(r.properties=i),r}writeFeaturesObject(e,t){t=this.adaptOptions(t);const r=[];for(let n=0,i=e.length;n<i;++n)r.push(this.writeFeatureObject(e[n],t));return{type:"FeatureCollection",features:r}}writeGeometryObject(e,t){return writeGeometry(e,this.adaptOptions(t))}};function readGeometryInternal(e){if(!e)return null;let t;switch(e.type){case"Point":t=readPointGeometry(e);break;case"LineString":t=readLineStringGeometry(e);break;case"Polygon":t=readPolygonGeometry(e);break;case"MultiPoint":t=readMultiPointGeometry(e);break;case"MultiLineString":t=readMultiLineStringGeometry(e);break;case"MultiPolygon":t=readMultiPolygonGeometry(e);break;case"GeometryCollection":t=readGeometryCollectionGeometry(e);break;default:throw new Error("Unsupported GeoJSON type: "+e.type)}return t}function readGeometry(e,t){return createGeometry(readGeometryInternal(e,t),t)}function readGeometryCollectionGeometry(e,t){return e.geometries.map(function(e){return readGeometryInternal(e,t)})}function readPointGeometry(e){const t=e.coordinates;return{type:"Point",flatCoordinates:t,layout:getLayoutForStride(t.length)}}function readLineStringGeometry(e){const t=e.coordinates,r=t.flat();return{type:"LineString",flatCoordinates:r,ends:[r.length],layout:getLayoutForStride(t[0]?.length||2)}}function readMultiLineStringGeometry(e){const t=e.coordinates,r=t[0]?.[0]?.length||2,n=[];return{type:"MultiLineString",flatCoordinates:n,ends:deflateCoordinatesArray(n,0,t,r),layout:getLayoutForStride(r)}}function readMultiPointGeometry(e){const t=e.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:getLayoutForStride(t[0]?.length||2)}}function readMultiPolygonGeometry(e){const t=e.coordinates,r=[],n=t[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:r,ends:deflateMultiCoordinatesArray(r,0,t,n),layout:getLayoutForStride(n)}}function readPolygonGeometry(e){const t=e.coordinates,r=[],n=t[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:r,ends:deflateCoordinatesArray(r,0,t,n),layout:getLayoutForStride(n)}}function writeGeometry(e,t){const r=(e=transformGeometryWithOptions(e,!0,t)).getType();let n;switch(r){case"Point":n=writePointGeometry(e,t);break;case"LineString":n=writeLineStringGeometry(e,t);break;case"Polygon":n=writePolygonGeometry(e,t);break;case"MultiPoint":n=writeMultiPointGeometry(e,t);break;case"MultiLineString":n=writeMultiLineStringGeometry(e,t);break;case"MultiPolygon":n=writeMultiPolygonGeometry(e,t);break;case"GeometryCollection":n=writeGeometryCollectionGeometry(e,t);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+r)}return n}function writeGeometryCollectionGeometry(e,t){return delete(t=Object.assign({},t)).featureProjection,{type:"GeometryCollection",geometries:e.getGeometriesArray().map(function(e){return writeGeometry(e,t)})}}function writeLineStringGeometry(e){return{type:"LineString",coordinates:e.getCoordinates()}}function writeMultiLineStringGeometry(e){return{type:"MultiLineString",coordinates:e.getCoordinates()}}function writeMultiPointGeometry(e){return{type:"MultiPoint",coordinates:e.getCoordinates()}}function writeMultiPolygonGeometry(e,t){let r;return t&&(r=t.rightHanded),{type:"MultiPolygon",coordinates:e.getCoordinates(r)}}function writePointGeometry(e){return{type:"Point",coordinates:e.getCoordinates()}}function writePolygonGeometry(e,t){let r;return t&&(r=t.rightHanded),{type:"Polygon",coordinates:e.getCoordinates(r)}}var Property={ACCURACY:"accuracy",ACCURACY_GEOMETRY:"accuracyGeometry",ALTITUDE:"altitude",ALTITUDE_ACCURACY:"altitudeAccuracy",HEADING:"heading",POSITION:"position",PROJECTION:"projection",SPEED:"speed",TRACKING:"tracking",TRACKING_OPTIONS:"trackingOptions"},GeolocationErrorType={ERROR:"error"},GeolocationError=class extends BaseEvent{constructor(e){super(GeolocationErrorType.ERROR),this.code=e.code,this.message=e.message}},Geolocation=class extends BaseObject{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.position_=null,this.transform_=identityTransform,this.watchId_=void 0,this.addChangeListener(Property.PROJECTION,this.handleProjectionChanged_),this.addChangeListener(Property.TRACKING,this.handleTrackingChanged_),void 0!==e.projection&&this.setProjection(e.projection),void 0!==e.trackingOptions&&this.setTrackingOptions(e.trackingOptions),this.setTracking(void 0!==e.tracking&&e.tracking)}disposeInternal(){this.setTracking(!1),super.disposeInternal()}handleProjectionChanged_(){const e=this.getProjection();e&&(this.transform_=getTransformFromProjections(get$2("EPSG:4326"),e),this.position_&&this.set(Property.POSITION,this.transform_(this.position_)))}handleTrackingChanged_(){if("geolocation"in navigator){const e=this.getTracking();e&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):e||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}}positionChange_(e){const t=e.coords;this.set(Property.ACCURACY,t.accuracy),this.set(Property.ALTITUDE,null===t.altitude?void 0:t.altitude),this.set(Property.ALTITUDE_ACCURACY,null===t.altitudeAccuracy?void 0:t.altitudeAccuracy),this.set(Property.HEADING,null===t.heading?void 0:toRadians(t.heading)),this.position_?(this.position_[0]=t.longitude,this.position_[1]=t.latitude):this.position_=[t.longitude,t.latitude];const r=this.transform_(this.position_);this.set(Property.POSITION,r.slice()),this.set(Property.SPEED,null===t.speed?void 0:t.speed);const n=circular(this.position_,t.accuracy);n.applyTransform(this.transform_),this.set(Property.ACCURACY_GEOMETRY,n),this.changed()}positionError_(e){this.dispatchEvent(new GeolocationError(e))}getAccuracy(){return this.get(Property.ACCURACY)}getAccuracyGeometry(){return this.get(Property.ACCURACY_GEOMETRY)||null}getAltitude(){return this.get(Property.ALTITUDE)}getAltitudeAccuracy(){return this.get(Property.ALTITUDE_ACCURACY)}getHeading(){return this.get(Property.HEADING)}getPosition(){return this.get(Property.POSITION)}getProjection(){return this.get(Property.PROJECTION)}getSpeed(){return this.get(Property.SPEED)}getTracking(){return this.get(Property.TRACKING)}getTrackingOptions(){return this.get(Property.TRACKING_OPTIONS)}setProjection(e){this.set(Property.PROJECTION,get$2(e))}setTracking(e){this.set(Property.TRACKING,e)}setTrackingOptions(e){this.set(Property.TRACKING_OPTIONS,e)}},layout=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],paint=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],v8_default={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:layout,layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},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:"expression_name",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,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-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,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-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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","feature"]},"property-type":"cross-faded-data-driven"},"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},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"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}},refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function deref(e,t){const r={};for(const n in e)"ref"!==n&&(r[n]=e[n]);return refProperties.forEach(e=>{e in t&&(r[e]=t[e])}),r}function derefLayers(e){e=e.slice();const t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=deref(e[r],t[e[r].ref]));return e}var ValidationError=class{constructor(e,t,r,n){this.message=(e?`${e}: `:"")+r,n&&(this.identifier=n),null!=t&&t.__line__&&(this.line=t.__line__)}};function extendBy(e,...t){for(const r of t)for(const t in r)e[t]=r[t];return e}var ExpressionParsingError=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},Scope=class e{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[r,n]of t)this.bindings[r]=n}concat(t){return new e(this,t)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}},NullType={kind:"null"},NumberType={kind:"number"},StringType={kind:"string"},BooleanType={kind:"boolean"},ColorType={kind:"color"},ProjectionDefinitionType={kind:"projectionDefinition"},ObjectType={kind:"object"},ValueType={kind:"value"},ErrorType={kind:"error"},CollatorType={kind:"collator"},FormattedType={kind:"formatted"},PaddingType={kind:"padding"},ColorArrayType={kind:"colorArray"},NumberArrayType={kind:"numberArray"},ResolvedImageType={kind:"resolvedImage"},VariableAnchorOffsetCollectionType={kind:"variableAnchorOffsetCollection"};function array(e,t){return{kind:"array",itemType:e,N:t}}function typeToString(e){if("array"===e.kind){const t=typeToString(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}var valueMemberTypes=[NullType,NumberType,StringType,BooleanType,ColorType,ProjectionDefinitionType,FormattedType,ObjectType,array(ValueType),PaddingType,NumberArrayType,ColorArrayType,ResolvedImageType,VariableAnchorOffsetCollectionType];function checkSubtype(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!checkSubtype(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of valueMemberTypes)if(!checkSubtype(e,t))return null}return`Expected ${typeToString(e)} but found ${typeToString(t)} instead.`}function isValidType(e,t){return t.some(t=>t.kind===e.kind)}function isValidNativeType(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function verifyType(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}var Xn=.96422,Yn=1,Zn=.82521,t0=4/29,t1=6/29,t2=3*t1*t1,t3=t1*t1*t1,deg2rad$1=Math.PI/180,rad2deg=180/Math.PI;function constrainAngle(e){return(e%=360)<0&&(e+=360),e}function rgbToLab([e,t,r,n]){let i,o;const s=xyz2lab((.2225045*(e=rgb2xyz(e))+.7168786*(t=rgb2xyz(t))+.0606169*(r=rgb2xyz(r)))/Yn);e===t&&t===r?i=o=s:(i=xyz2lab((.4360747*e+.3850649*t+.1430804*r)/Xn),o=xyz2lab((.0139322*e+.0971045*t+.7141733*r)/Zn));const a=116*s-16;return[a<0?0:a,500*(i-s),200*(s-o),n]}function rgb2xyz(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function xyz2lab(e){return e>t3?Math.pow(e,1/3):e/t2+t0}function labToRgb([e,t,r,n]){let i=(e+16)/116,o=isNaN(t)?i:i+t/500,s=isNaN(r)?i:i-r/200;return i=Yn*lab2xyz(i),o=Xn*lab2xyz(o),s=Zn*lab2xyz(s),[xyz2rgb(3.1338561*o-1.6168667*i-.4906146*s),xyz2rgb(-.9787684*o+1.9161415*i+.033454*s),xyz2rgb(.0719453*o-.2289914*i+1.4052427*s),n]}function xyz2rgb(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function lab2xyz(e){return e>t1?e*e*e:t2*(e-t0)}function rgbToHcl(e){const[t,r,n,i]=rgbToLab(e),o=Math.sqrt(r*r+n*n);return[Math.round(1e4*o)?constrainAngle(Math.atan2(n,r)*rad2deg):NaN,o,t,i]}function hclToRgb([e,t,r,n]){return e=isNaN(e)?0:e*deg2rad$1,labToRgb([r,Math.cos(e)*t,Math.sin(e)*t,n])}function hslToRgb([e,t,r,n]){function i(n){const i=(n+e/30)%12,o=t*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(i-3,9-i,1))}return e=constrainAngle(e),t/=100,r/=100,[i(0),i(8),i(4),n]}var hasOwnProperty=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function getOwn(e,t){return hasOwnProperty(e,t)?e[t]:void 0}function parseCssColor(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=getOwn(namedColors,e);if(t){const[e,r,n]=t;return[e/255,r/255,n/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let r=1;return[parseHex(e.slice(r,r+=t)),parseHex(e.slice(r,r+=t)),parseHex(e.slice(r,r+=t)),parseHex(e.slice(r,r+t)||"ff")]}if(e.startsWith("rgb")){const t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[e,r,n,i,o,s,a,l,c,u,h,d]=t,p=[i||" ",a||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[n,s,c].join(""),t="%%%"===e?100:""===e?255:0;if(t){const e=[clamp(+r/t,0,1),clamp(+o/t,0,1),clamp(+l/t,0,1),h?parseAlpha(+h,d):1];if(validateNumbers(e))return e}}return}}const r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){const[e,t,n,i,o,s,a,l,c]=r,u=[n||" ",o||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,clamp(+i,0,100),clamp(+s,0,100),l?parseAlpha(+l,c):1];if(validateNumbers(e))return hslToRgb(e)}}}function parseHex(e){return parseInt(e.padEnd(2,e),16)/255}function parseAlpha(e,t){return clamp(t?e/100:e,0,1)}function clamp(e,t,r){return Math.min(Math.max(t,e),r)}function validateNumbers(e){return!e.some(Number.isNaN)}var namedColors={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 interpolateNumber(e,t,r){return e+r*(t-e)}function interpolateArray(e,t,r){return e.map((e,n)=>interpolateNumber(e,t[n],r))}var Color=class e{constructor(e,t,r,n=1,i=!0){this.r=e,this.g=t,this.b=r,this.a=n,i||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,t,r,n]))}static{this.black=new e(0,0,0,1)}static{this.white=new e(1,1,1,1)}static{this.transparent=new e(0,0,0,0)}static{this.red=new e(1,0,0,1)}static parse(t){if(t instanceof e)return t;if("string"!=typeof t)return;const r=parseCssColor(t);return r?new e(...r,!1):void 0}get rgb(){const{r:e,g:t,b:r,a:n}=this,i=n||1/0;return this.overwriteGetter("rgb",[e/i,t/i,r/i,n])}get hcl(){return this.overwriteGetter("hcl",rgbToHcl(this.rgb))}get lab(){return this.overwriteGetter("lab",rgbToLab(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,r,n]=this.rgb;return`rgba(${[e,t,r].map(e=>Math.round(255*e)).join(",")},${n})`}static interpolate(t,r,n,i="rgb"){switch(i){case"rgb":{const[i,o,s,a]=interpolateArray(t.rgb,r.rgb,n);return new e(i,o,s,a,!1)}case"hcl":{const[i,o,s,a]=t.hcl,[l,c,u,h]=r.hcl;let d,p;if(isNaN(i)||isNaN(l))isNaN(i)?isNaN(l)?d=NaN:(d=l,1!==s&&0!==s||(p=c)):(d=i,1!==u&&0!==u||(p=o));else{let e=l-i;l>i&&e>180?e-=360:l<i&&i-l>180&&(e+=360),d=i+n*e}const[f,g,m,y]=hclToRgb([d,p??interpolateNumber(o,c,n),interpolateNumber(s,u,n),interpolateNumber(a,h,n)]);return new e(f,g,m,y,!1)}case"lab":{const[i,o,s,a]=labToRgb(interpolateArray(t.lab,r.lab,n));return new e(i,o,s,a,!1)}}}},Collator=class{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},VERTICAL_ALIGN_OPTIONS=["bottom","center","top"],FormattedSection=class{constructor(e,t,r,n,i,o){this.text=e,this.image=t,this.scale=r,this.fontStack=n,this.textColor=i,this.verticalAlign=o}},Formatted=class e{constructor(e){this.sections=e}static fromString(t){return new e([new FormattedSection(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(t){return t instanceof e?t:e.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}},Padding=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("number"==typeof t)return new e([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 e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,n){return new e(interpolateArray(t.values,r.values,n))}},NumberArray=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("number"==typeof t)return new e([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,n){return new e(interpolateArray(t.values,r.values,n))}},ColorArray=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("string"==typeof t){const r=Color.parse(t);if(!r)return;return new e([r])}if(!Array.isArray(t))return;const r=[];for(const e of t){if("string"!=typeof e)return;const t=Color.parse(e);if(!t)return;r.push(t)}return new e(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,n,i="rgb"){const o=[];if(t.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let e=0;e<t.values.length;e++)o.push(Color.interpolate(t.values[e],r.values[e],n,i));return new e(o)}},RuntimeError=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},anchors=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),VariableAnchorOffsetCollection=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const r=t[e],n=t[e+1];if("string"!=typeof r||!anchors.has(r))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,n){const i=t.values,o=r.values;if(i.length!==o.length)throw new RuntimeError(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`);const s=[];for(let e=0;e<i.length;e+=2){if(i[e]!==o[e])throw new RuntimeError(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${i[e]}, to[${e}]: ${o[e]}`);s.push(i[e]);const[t,r]=i[e+1],[a,l]=o[e+1];s.push([interpolateNumber(t,a,n),interpolateNumber(r,l,n)])}return new e(s)}},ResolvedImage=class e{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(t){return t?new e({name:t,available:!1}):null}},ProjectionDefinition=class e{constructor(e,t,r){this.from=e,this.to=t,this.transition=r}static interpolate(t,r,n){return new e(t,r,n)}static parse(t){return t instanceof e?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new e(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new e(t.from,t.to,t.transition):"string"==typeof t?new e(t,t,1):void 0}};function validateRGBA(e,t,r,n){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[e,t,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[e,t,r,n]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function isValue(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof ProjectionDefinition||e instanceof Color||e instanceof Collator||e instanceof Formatted||e instanceof Padding||e instanceof NumberArray||e instanceof ColorArray||e instanceof VariableAnchorOffsetCollection||e instanceof ResolvedImage)return!0;if(Array.isArray(e)){for(const t of e)if(!isValue(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!isValue(e[t]))return!1;return!0}return!1}function typeOf(e){if(null===e)return NullType;if("string"==typeof e)return StringType;if("boolean"==typeof e)return BooleanType;if("number"==typeof e)return NumberType;if(e instanceof Color)return ColorType;if(e instanceof ProjectionDefinition)return ProjectionDefinitionType;if(e instanceof Collator)return CollatorType;if(e instanceof Formatted)return FormattedType;if(e instanceof Padding)return PaddingType;if(e instanceof NumberArray)return NumberArrayType;if(e instanceof ColorArray)return ColorArrayType;if(e instanceof VariableAnchorOffsetCollection)return VariableAnchorOffsetCollectionType;if(e instanceof ResolvedImage)return ResolvedImageType;if(Array.isArray(e)){const t=e.length;let r;for(const n of e){const e=typeOf(n);if(r){if(r===e)continue;r=ValueType;break}r=e}return array(r||ValueType,t)}return ObjectType}function valueToString(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Color||e instanceof ProjectionDefinition||e instanceof Formatted||e instanceof Padding||e instanceof NumberArray||e instanceof ColorArray||e instanceof VariableAnchorOffsetCollection||e instanceof ResolvedImage?e.toString():JSON.stringify(e)}var Literal=class e{constructor(e,t){this.type=e,this.value=t}static parse(t,r){if(2!==t.length)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!isValue(t[1]))return r.error("invalid value");const n=t[1];let i=typeOf(n);const o=r.expectedType;return"array"!==i.kind||0!==i.N||!o||"array"!==o.kind||"number"==typeof o.N&&0!==o.N||(i=o),new e(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},types$1={string:StringType,number:NumberType,boolean:BooleanType,object:ObjectType},Assertion=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n,i=1;const o=t[0];if("array"===o){let e,o;if(t.length>2){const n=t[1];if("string"!=typeof n||!(n in types$1)||"object"===n)return r.error('The item type argument of "array" must be one of string, number, boolean',1);e=types$1[n],i++}else e=ValueType;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);o=t[2],i++}n=array(e,o)}else{if(!types$1[o])throw new Error(`Types doesn't contain name = ${o}`);n=types$1[o]}const s=[];for(;i<t.length;i++){const e=r.parse(t[i],i,ValueType);if(!e)return null;s.push(e)}return new e(n,s)}evaluate(e){for(let t=0;t<this.args.length;t++){const r=this.args[t].evaluate(e);if(!checkSubtype(this.type,typeOf(r)))return r;if(t===this.args.length-1)throw new RuntimeError(`Expected value to be of type ${typeToString(this.type)}, but found ${typeToString(typeOf(r))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},types$2={"to-boolean":BooleanType,"to-color":ColorType,"to-number":NumberType,"to-string":StringType},Coercion=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const n=t[0];if(!types$2[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 r.error("Expected one argument.");const i=types$2[n],o=[];for(let e=1;e<t.length;e++){const n=r.parse(t[e],e,ValueType);if(!n)return null;o.push(n)}return new e(i,o)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let t,r;for(const n of this.args){if(t=n.evaluate(e),r=null,t instanceof Color)return t;if("string"==typeof t){const r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:validateRGBA(t[0],t[1],t[2],t[3]),!r))return new Color(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new RuntimeError(r||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const r of this.args){t=r.evaluate(e);const n=Padding.parse(t);if(n)return n}throw new RuntimeError(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const r of this.args){t=r.evaluate(e);const n=NumberArray.parse(t);if(n)return n}throw new RuntimeError(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const r of this.args){t=r.evaluate(e);const n=ColorArray.parse(t);if(n)return n}throw new RuntimeError(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const r of this.args){t=r.evaluate(e);const n=VariableAnchorOffsetCollection.parse(t);if(n)return n}throw new RuntimeError(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const r of this.args){if(t=r.evaluate(e),null===t)return 0;const n=Number(t);if(!isNaN(n))return n}throw new RuntimeError(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Formatted.fromString(valueToString(this.args[0].evaluate(e)));case"resolvedImage":return ResolvedImage.fromString(valueToString(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return valueToString(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},geometryTypes=["Unknown","Point","LineString","Polygon"],EvaluationContext=class{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?geometryTypes[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(e){let t=this._parseColorCache.get(e);return t||(t=Color.parse(e),this._parseColorCache.set(e,t)),t}},ParsingContext=class e{constructor(e,t,r=[],n,i=new Scope,o=[]){this.registry=e,this.path=r,this.key=r.map(e=>`[${e}]`).join(""),this.scope=i,this.errors=o,this.expectedType=n,this._isConstant=t}parse(e,t,r,n,i={}){return t?this.concat(t,r,n)._parse(e,i):this._parse(e,i)}_parse(e,t){function r(e,t,r){return"assert"===r?new Assertion(t,[e]):"coerce"===r?new Coercion(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i=e[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[i];if(o){let i=o.parse(e,this);if(!i)return null;if(this.expectedType){const e=this.expectedType,n=i.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind){if("projectionDefinition"===e.kind&&["string","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===e.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(n.kind))i=r(i,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,n))return null}else i=r(i,e,t.typeAnnotation||"assert")}if(!(i instanceof Literal)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){const e=new EvaluationContext;try{i=new Literal(i.type,i.evaluate(e))}catch(n){return this.error(n.message),null}}return i}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===e?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(t,r,n){const i="number"==typeof t?this.path.concat(t):this.path,o=n?this.scope.concat(n):this.scope;return new e(this.registry,this._isConstant,i,r||null,o,this.errors)}error(e,...t){const r=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new ExpressionParsingError(r,e))}checkSubtype(e,t){const r=checkSubtype(e,t);return r&&this.error(r),r}},Let=class e{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const n=[];for(let e=1;e<t.length-1;e+=2){const i=t[e];if("string"!=typeof i)return r.error(`Expected string, but found ${typeof i} instead.`,e);if(/[^a-zA-Z0-9_]/.test(i))return r.error("Variable names must contain only alphanumeric characters or '_'.",e);const o=r.parse(t[e+1],e+1);if(!o)return null;n.push([i,o])}const i=r.parse(t[t.length-1],t.length-1,r.expectedType,n);return i?new e(n,i):null}outputDefined(){return this.result.outputDefined()}},Var=class e{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(t,r){if(2!==t.length||"string"!=typeof t[1])return r.error("'var' expression requires exactly one string literal argument.");const n=t[1];return r.scope.has(n)?new e(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},At=class e{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(t,r){if(3!==t.length)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,NumberType),i=r.parse(t[2],2,array(r.expectedType||ValueType));if(!n||!i)return null;const o=i.type;return new e(o.itemType,n,i)}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new RuntimeError(`Array index out of bounds: ${t} < 0.`);if(t>=r.length)throw new RuntimeError(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t!==Math.floor(t))throw new RuntimeError(`Array index must be an integer, but found ${t} instead.`);return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},In=class e{constructor(e,t){this.type=BooleanType,this.needle=e,this.haystack=t}static parse(t,r){if(3!==t.length)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,ValueType),i=r.parse(t[2],2,ValueType);return n&&i?isValidType(n.type,[BooleanType,StringType,NumberType,NullType,ValueType])?new e(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${typeToString(n.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!isValidNativeType(t,["boolean","string","number","null"]))throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${typeToString(typeOf(t))} instead.`);if(!isValidNativeType(r,["string","array"]))throw new RuntimeError(`Expected second argument to be of type array or string, but found ${typeToString(typeOf(r))} instead.`);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},IndexOf=class e{constructor(e,t,r){this.type=NumberType,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,ValueType),i=r.parse(t[2],2,ValueType);if(!n||!i)return null;if(!isValidType(n.type,[BooleanType,StringType,NumberType,NullType,ValueType]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${typeToString(n.type)} instead`);if(4===t.length){const o=r.parse(t[3],3,NumberType);return o?new e(n,i,o):null}return new e(n,i)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!isValidNativeType(t,["boolean","string","number","null"]))throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${typeToString(typeOf(t))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),isValidNativeType(r,["string"])){const e=r.indexOf(t,n);return-1===e?-1:[...r.slice(0,e)].length}if(isValidNativeType(r,["array"]))return r.indexOf(t,n);throw new RuntimeError(`Expected second argument to be of type array or string, but found ${typeToString(typeOf(r))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Match=class e{constructor(e,t,r,n,i,o){this.inputType=e,this.type=t,this.input=r,this.cases=n,this.outputs=i,this.otherwise=o}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&"value"!==r.expectedType.kind&&(i=r.expectedType);const o={},s=[];for(let e=2;e<t.length-1;e+=2){let a=t[e];const l=t[e+1];Array.isArray(a)||(a=[a]);const c=r.concat(e);if(0===a.length)return c.error("Expected at least one branch label.");for(const e of a){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,typeOf(e)))return null}else n=typeOf(e);if(void 0!==o[String(e)])return c.error("Branch labels must be unique.");o[String(e)]=s.length}const u=r.parse(l,e,i);if(!u)return null;i=i||u.type,s.push(u)}const a=r.parse(t[1],1,ValueType);if(!a)return null;const l=r.parse(t[t.length-1],t.length-1,i);return l?"value"!==a.type.kind&&r.concat(1).checkSubtype(n,a.type)?null:new e(n,i,a,o,s,l):null}evaluate(e){const t=this.input.evaluate(e);return(typeOf(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},Case=class e{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&"value"!==r.expectedType.kind&&(n=r.expectedType);const i=[];for(let e=1;e<t.length-1;e+=2){const o=r.parse(t[e],e,BooleanType);if(!o)return null;const s=r.parse(t[e+1],e+1,n);if(!s)return null;i.push([o,s]),n=n||s.type}const o=r.parse(t[t.length-1],t.length-1,n);if(!o)return null;if(!n)throw new Error("Can't infer output type");return new e(n,i,o)}evaluate(e){for(const[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},Slice=class e{constructor(e,t,r,n){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=n}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,ValueType),i=r.parse(t[2],2,NumberType);if(!n||!i)return null;if(!isValidType(n.type,[array(ValueType),StringType,ValueType]))return r.error(`Expected first argument to be of type array or string, but found ${typeToString(n.type)} instead`);if(4===t.length){const o=r.parse(t[3],3,NumberType);return o?new e(n.type,n,i,o):null}return new e(n.type,n,i)}evaluate(e){const t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);let n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),isValidNativeType(t,["string"]))return[...t].slice(r,n).join("");if(isValidNativeType(t,["array"]))return t.slice(r,n);throw new RuntimeError(`Expected first argument to be of type array or string, but found ${typeToString(typeOf(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function findStopLessThanOrEqualTo(e,t){const r=e.length-1;let n,i,o=0,s=r,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),n=e[a],i=e[a+1],n<=t){if(a===r||t<i)return a;o=a+1}else{if(!(n>t))throw new RuntimeError("Input is not a number.");s=a-1}return 0}var Step=class e{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[n,i]of r)this.labels.push(n),this.outputs.push(i)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const n=r.parse(t[1],1,NumberType);if(!n)return null;const i=[];let o=null;r.expectedType&&"value"!==r.expectedType.kind&&(o=r.expectedType);for(let e=1;e<t.length;e+=2){const n=1===e?-1/0:t[e],s=t[e+1],a=e,l=e+1;if("number"!=typeof n)return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(i.length&&i[i.length-1][0]>=n)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=r.parse(s,l,o);if(!c)return null;o=o||c.type,i.push([n,c])}return new e(o,n,i)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);const i=t.length;return n>=t[i-1]?r[i-1].evaluate(e):r[findStopLessThanOrEqualTo(t,n)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function unitBezier(e,t,r,n){const i=3*e,o=3*(r-e)-i,s=1-i-o,a=3*t,l=3*(n-t)-a,c=1-a-l;return function(e,t=1e-6){if(e<=0)return 0;if(e>=1)return 1;let r=e;for(let h=0;h<8;h++){const n=((s*r+o)*r+i)*r-e;if(Math.abs(n)<t)return((c*r+l)*r+a)*r;const u=(3*s*r+2*o)*r+i;if(Math.abs(u)<1e-6)break;r-=n/u}let n=0,u=1;r=e;for(let a=0;a<20;a++){const a=((s*r+o)*r+i)*r;if(Math.abs(a-e)<t)break;e>a?n=r:u=r,r=.5*(n+u)}return((c*r+l)*r+a)*r}}var Interpolate=class e{constructor(e,t,r,n,i){this.type=e,this.operator=t,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[o,s]of i)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(e,t,r,n){let i=0;if("exponential"===e.name)i=exponentialInterpolation(t,e.base,r,n);else if("linear"===e.name)i=exponentialInterpolation(t,1,r,n);else if("cubic-bezier"===e.name){const o=e.controlPoints;i=unitBezier(o[0],o[1],o[2],o[3])(exponentialInterpolation(t,1,r,n))}return i}static parse(t,r){let[n,i,o,...s]=t;if(!Array.isArray(i)||0===i.length)return r.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const e=i[1];if("number"!=typeof e)return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:e}}else{if("cubic-bezier"!==i[0])return r.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const e=i.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:e}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,NumberType),!o)return null;const a=[];let l=null;"interpolate-hcl"!==n&&"interpolate-lab"!==n||r.expectedType==ColorArrayType?r.expectedType&&"value"!==r.expectedType.kind&&(l=r.expectedType):l=ColorType;for(let e=0;e<s.length;e+=2){const t=s[e],n=s[e+1],i=e+3,o=e+4;if("number"!=typeof t)return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=t)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const c=r.parse(n,o,l);if(!c)return null;l=l||c.type,a.push([t,c])}return verifyType(l,NumberType)||verifyType(l,ProjectionDefinitionType)||verifyType(l,ColorType)||verifyType(l,PaddingType)||verifyType(l,NumberArrayType)||verifyType(l,ColorArrayType)||verifyType(l,VariableAnchorOffsetCollectionType)||verifyType(l,array(NumberType))?new e(l,n,i,o,a):r.error(`Type ${typeToString(l)} is not interpolatable.`)}evaluate(t){const r=this.labels,n=this.outputs;if(1===r.length)return n[0].evaluate(t);const i=this.input.evaluate(t);if(i<=r[0])return n[0].evaluate(t);const o=r.length;if(i>=r[o-1])return n[o-1].evaluate(t);const s=findStopLessThanOrEqualTo(r,i),a=r[s],l=r[s+1],c=e.interpolationFactor(this.interpolation,i,a,l),u=n[s].evaluate(t),h=n[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return interpolateNumber(u,h,c);case"color":return Color.interpolate(u,h,c);case"padding":return Padding.interpolate(u,h,c);case"colorArray":return ColorArray.interpolate(u,h,c);case"numberArray":return NumberArray.interpolate(u,h,c);case"variableAnchorOffsetCollection":return VariableAnchorOffsetCollection.interpolate(u,h,c);case"array":return interpolateArray(u,h,c);case"projectionDefinition":return ProjectionDefinition.interpolate(u,h,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return Color.interpolate(u,h,c,"hcl");case"colorArray":return ColorArray.interpolate(u,h,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Color.interpolate(u,h,c,"lab");case"colorArray":return ColorArray.interpolate(u,h,c,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function exponentialInterpolation(e,t,r,n){const i=n-r,o=e-r;return 0===i?0:1===t?o/i:(Math.pow(t,o)-1)/(Math.pow(t,i)-1)}var interpolateFactory={color:Color.interpolate,number:interpolateNumber,padding:Padding.interpolate,numberArray:NumberArray.interpolate,colorArray:ColorArray.interpolate,variableAnchorOffsetCollection:VariableAnchorOffsetCollection.interpolate,array:interpolateArray},Coalesce=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=null;const i=r.expectedType;i&&"value"!==i.kind&&(n=i);const o=[];for(const e of t.slice(1)){const t=r.parse(e,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!t)return null;n=n||t.type,o.push(t)}if(!n)throw new Error("No output type");return i&&o.some(e=>checkSubtype(i,e.type))?new e(ValueType,o):new e(n,o)}evaluate(e){let t,r=null,n=0;for(const i of this.args)if(n++,r=i.evaluate(e),r&&r instanceof ResolvedImage&&!r.available&&(t||(t=r.name),r=null,n===this.args.length&&(r=t)),null!==r)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function isComparableType(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function eq(e,t,r){return t===r}function neq(e,t,r){return t!==r}function lt(e,t,r){return t<r}function gt(e,t,r){return t>r}function lteq(e,t,r){return t<=r}function gteq(e,t,r){return t>=r}function eqCollate(e,t,r,n){return 0===n.compare(t,r)}function neqCollate(e,t,r,n){return!eqCollate(e,t,r,n)}function ltCollate(e,t,r,n){return n.compare(t,r)<0}function gtCollate(e,t,r,n){return n.compare(t,r)>0}function lteqCollate(e,t,r,n){return n.compare(t,r)<=0}function gteqCollate(e,t,r,n){return n.compare(t,r)>=0}function makeComparison(e,t,r){const n="=="!==e&&"!="!==e;return class i{constructor(e,t,r){this.type=BooleanType,this.lhs=e,this.rhs=t,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const r=e[0];let o=t.parse(e[1],1,ValueType);if(!o)return null;if(!isComparableType(r,o.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${typeToString(o.type)}'.`);let s=t.parse(e[2],2,ValueType);if(!s)return null;if(!isComparableType(r,s.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${typeToString(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${typeToString(o.type)}' and '${typeToString(s.type)}'.`);n&&("value"===o.type.kind&&"value"!==s.type.kind?o=new Assertion(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new Assertion(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,CollatorType),!a)return null}return new i(o,s,a)}evaluate(i){const o=this.lhs.evaluate(i),s=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const t=typeOf(o),r=typeOf(s);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new RuntimeError(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const e=typeOf(o),r=typeOf(s);if("string"!==e.kind||"string"!==r.kind)return t(i,o,s)}return this.collator?r(i,o,s,this.collator.evaluate(i)):t(i,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}var Equals=makeComparison("==",eq,eqCollate),NotEquals=makeComparison("!=",neq,neqCollate),LessThan=makeComparison("<",lt,ltCollate),GreaterThan=makeComparison(">",gt,gtCollate),LessThanOrEqual=makeComparison("<=",lteq,lteqCollate),GreaterThanOrEqual=makeComparison(">=",gteq,gteqCollate),CollatorExpression=class e{constructor(e,t,r){this.type=CollatorType,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(t,r){if(2!==t.length)return r.error("Expected one argument.");const n=t[1];if("object"!=typeof n||Array.isArray(n))return r.error("Collator options argument must be an object.");const i=r.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,BooleanType);if(!i)return null;const o=r.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,BooleanType);if(!o)return null;let s=null;return n.locale&&(s=r.parse(n.locale,1,StringType),!s)?null:new e(i,o,s)}evaluate(e){return new Collator(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},NumberFormat=class e{constructor(e,t,r,n,i,o){this.type=StringType,this.number=e,this.locale=t,this.currency=r,this.unit=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(t,r){if(3!==t.length)return r.error("Expected two arguments.");const n=r.parse(t[1],1,NumberType);if(!n)return null;const i=t[2];if("object"!=typeof i||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=r.parse(i.locale,1,StringType),!o))return null;let s=null;if(i.currency&&(s=r.parse(i.currency,1,StringType),!s))return null;let a=null;if(i.unit&&(a=r.parse(i.unit,1,StringType),!a))return null;if(s&&a)return r.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(i["min-fraction-digits"]&&(l=r.parse(i["min-fraction-digits"],1,NumberType),!l))return null;let c=null;return i["max-fraction-digits"]&&(c=r.parse(i["max-fraction-digits"],1,NumberType),!c)?null:new e(n,o,s,a,l,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},FormatExpression=class e{constructor(e){this.type=FormattedType,this.sections=e}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const n=t[1];if(!Array.isArray(n)&&"object"==typeof n)return r.error("First argument must be an image or text section.");const i=[];let o=!1;for(let e=1;e<=t.length-1;++e){const n=t[e];if(o&&"object"==typeof n&&!Array.isArray(n)){o=!1;let e=null;if(n["font-scale"]&&(e=r.parse(n["font-scale"],1,NumberType),!e))return null;let t=null;if(n["text-font"]&&(t=r.parse(n["text-font"],1,array(StringType)),!t))return null;let s=null;if(n["text-color"]&&(s=r.parse(n["text-color"],1,ColorType),!s))return null;let a=null;if(n["vertical-align"]){if("string"==typeof n["vertical-align"]&&!VERTICAL_ALIGN_OPTIONS.includes(n["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${n["vertical-align"]}' instead.`);if(a=r.parse(n["vertical-align"],1,StringType),!a)return null}const l=i[i.length-1];l.scale=e,l.font=t,l.textColor=s,l.verticalAlign=a}else{const n=r.parse(t[e],1,ValueType);if(!n)return null;const s=n.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,i.push({content:n,scale:null,font:null,textColor:null,verticalAlign:null})}}return new e(i)}evaluate(e){return new Formatted(this.sections.map(t=>{const r=t.content.evaluate(e);return typeOf(r)===ResolvedImageType?new FormattedSection("",r,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new FormattedSection(valueToString(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}},ImageExpression=class e{constructor(e){this.type=ResolvedImageType,this.input=e}static parse(t,r){if(2!==t.length)return r.error("Expected two arguments.");const n=r.parse(t[1],1,StringType);return n?new e(n):r.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),r=ResolvedImage.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}},Length=class e{constructor(e){this.type=NumberType,this.input=e}static parse(t,r){if(2!==t.length)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=r.parse(t[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?r.error(`Expected argument of type string or array, but found ${typeToString(n.type)} instead.`):new e(n):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new RuntimeError(`Expected value to be of type string or array, but found ${typeToString(typeOf(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},EXTENT=8192;function getTileCoordinates(e,t){const r=mercatorXfromLng(e[0]),n=mercatorYfromLat(e[1]),i=Math.pow(2,t.z);return[Math.round(r*i*EXTENT),Math.round(n*i*EXTENT)]}function getLngLatFromTileCoord(e,t){const r=Math.pow(2,t.z),n=(e[0]/EXTENT+t.x)/r,i=(e[1]/EXTENT+t.y)/r;return[lngFromMercatorXfromLng(n),latFromMercatorY(i)]}function mercatorXfromLng(e){return(180+e)/360}function lngFromMercatorXfromLng(e){return 360*e-180}function mercatorYfromLat(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function latFromMercatorY(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function updateBBox(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function boxWithinBox(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function rayIntersect(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function pointOnBoundary(e,t,r){const n=e[0]-t[0],i=e[1]-t[1],o=e[0]-r[0],s=e[1]-r[1];return n*s-o*i===0&&n*o<=0&&i*s<=0}function segmentIntersectSegment(e,t,r,n){const i=[t[0]-e[0],t[1]-e[1]];return 0!==perp([n[0]-r[0],n[1]-r[1]],i)&&!(!twoSided(e,t,r,n)||!twoSided(r,n,e,t))}function lineIntersectPolygon(e,t,r){for(const n of r)for(let r=0;r<n.length-1;++r)if(segmentIntersectSegment(e,t,n[r],n[r+1]))return!0;return!1}function pointWithinPolygon(e,t,r=!1){let n=!1;for(const i of t)for(let t=0;t<i.length-1;t++){if(pointOnBoundary(e,i[t],i[t+1]))return r;rayIntersect(e,i[t],i[t+1])&&(n=!n)}return n}function pointWithinPolygons(e,t){for(const r of t)if(pointWithinPolygon(e,r))return!0;return!1}function lineStringWithinPolygon(e,t){for(const r of e)if(!pointWithinPolygon(r,t))return!1;for(let r=0;r<e.length-1;++r)if(lineIntersectPolygon(e[r],e[r+1],t))return!1;return!0}function lineStringWithinPolygons(e,t){for(const r of t)if(lineStringWithinPolygon(e,r))return!0;return!1}function perp(e,t){return e[0]*t[1]-e[1]*t[0]}function twoSided(e,t,r,n){const i=e[0]-r[0],o=e[1]-r[1],s=t[0]-r[0],a=t[1]-r[1],l=n[0]-r[0],c=n[1]-r[1],u=i*c-l*o,h=s*c-l*a;return u>0&&h<0||u<0&&h>0}function getTilePolygon(e,t,r){const n=[];for(let i=0;i<e.length;i++){const o=[];for(let n=0;n<e[i].length;n++){const s=getTileCoordinates(e[i][n],r);updateBBox(t,s),o.push(s)}n.push(o)}return n}function getTilePolygons(e,t,r){const n=[];for(let i=0;i<e.length;i++){const o=getTilePolygon(e[i],t,r);n.push(o)}return n}function updatePoint(e,t,r,n){if(e[0]<r[0]||e[0]>r[2]){const t=.5*n;let i=e[0]-r[0]>t?-n:r[0]-e[0]>t?n:0;0===i&&(i=e[0]-r[2]>t?-n:r[2]-e[0]>t?n:0),e[0]+=i}updateBBox(t,e)}function resetBBox(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function getTilePoints(e,t,r,n){const i=Math.pow(2,n.z)*EXTENT,o=[n.x*EXTENT,n.y*EXTENT],s=[];for(const a of e)for(const e of a){const n=[e.x+o[0],e.y+o[1]];updatePoint(n,t,r,i),s.push(n)}return s}function getTileLines(e,t,r,n){const i=Math.pow(2,n.z)*EXTENT,o=[n.x*EXTENT,n.y*EXTENT],s=[];for(const a of e){const e=[];for(const r of a){const n=[r.x+o[0],r.y+o[1]];updateBBox(t,n),e.push(n)}s.push(e)}if(t[2]-t[0]<=i/2){resetBBox(t);for(const e of s)for(const n of e)updatePoint(n,t,r,i)}return s}function pointsWithinPolygons(e,t){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if("Polygon"===t.type){const o=getTilePolygon(t.coordinates,n,i),s=getTilePoints(e.geometry(),r,n,i);if(!boxWithinBox(r,n))return!1;for(const e of s)if(!pointWithinPolygon(e,o))return!1}if("MultiPolygon"===t.type){const o=getTilePolygons(t.coordinates,n,i),s=getTilePoints(e.geometry(),r,n,i);if(!boxWithinBox(r,n))return!1;for(const e of s)if(!pointWithinPolygons(e,o))return!1}return!0}function linesWithinPolygons(e,t){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if("Polygon"===t.type){const o=getTilePolygon(t.coordinates,n,i),s=getTileLines(e.geometry(),r,n,i);if(!boxWithinBox(r,n))return!1;for(const e of s)if(!lineStringWithinPolygon(e,o))return!1}if("MultiPolygon"===t.type){const o=getTilePolygons(t.coordinates,n,i),s=getTileLines(e.geometry(),r,n,i);if(!boxWithinBox(r,n))return!1;for(const e of s)if(!lineStringWithinPolygons(e,o))return!1}return!0}var Within=class e{constructor(e,t){this.type=BooleanType,this.geojson=e,this.geometries=t}static parse(t,r){if(2!==t.length)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(isValue(t[1])){const r=t[1];if("FeatureCollection"===r.type){const t=[];for(const e of r.features){const{type:r,coordinates:n}=e.geometry;"Polygon"===r&&t.push(n),"MultiPolygon"===r&&t.push(...n)}if(t.length)return new e(r,{type:"MultiPolygon",coordinates:t})}else if("Feature"===r.type){const t=r.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new e(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new e(r,r)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return pointsWithinPolygons(e,this.geometries);if("LineString"===e.geometryType())return linesWithinPolygons(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},TinyQueue=class{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,n=t[e];for(;e>0;){const i=e-1>>1,o=t[i];if(r(n,o)>=0)break;t[e]=o,e=i}t[e]=n}_down(e){const{data:t,compare:r}=this,n=this.length>>1,i=t[e];for(;e<n;){let n=1+(e<<1);const o=n+1;if(o<this.length&&r(t[o],t[n])<0&&(n=o),r(t[n],i)>=0)break;t[e]=t[n],e=n}t[e]=i}};function quickselect(e,t,r=0,n=e.length-1,i=defaultCompare){for(;n>r;){if(n-r>600){const o=n-r+1,s=t-r+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);quickselect(e,t,Math.max(r,Math.floor(t-s*l/o+c)),Math.min(n,Math.floor(t+(o-s)*l/o+c)),i)}const o=e[t];let s=r,a=n;for(swap(e,r,t),i(e[n],o)>0&&swap(e,r,n);s<a;){for(swap(e,s,a),s++,a--;i(e[s],o)<0;)s++;for(;i(e[a],o)>0;)a--}0===i(e[r],o)?swap(e,r,a):(a++,swap(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}}function swap(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function defaultCompare(e,t){return e<t?-1:e>t?1:0}function classifyRings(e,t){if(e.length<=1)return[e];const r=[];let n,i;for(const o of e){const e=calculateSignedArea(o);0!==e&&(o.area=Math.abs(e),void 0===i&&(i=e<0),i===e<0?(n&&r.push(n),n=[o]):n.push(o))}if(n&&r.push(n),t>1)for(let o=0;o<r.length;o++)r[o].length<=t||(quickselect(r[o],t,1,r[o].length-1,compareAreas),r[o]=r[o].slice(0,t));return r}function compareAreas(e,t){return t.area-e.area}function calculateSignedArea(e){let t=0;for(let r,n,i=0,o=e.length,s=o-1;i<o;s=i++)r=e[i],n=e[s],t+=(n.x-r.x)*(r.y+n.y);return t}var RE=6378.137,E2=.0066943799901413165,RAD=Math.PI/180,CheapRuler=class{constructor(e){const t=RAD*RE*1e3,r=Math.cos(e*RAD),n=1/(1-E2*(1-r*r)),i=Math.sqrt(n);this.kx=t*i*r,this.ky=t*i*n*.9933056200098587}distance(e,t){const r=this.wrap(e[0]-t[0])*this.kx,n=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+n*n)}pointOnLine(e,t){let r,n,i,o,s=1/0;for(let a=0;a<e.length-1;a++){let l=e[a][0],c=e[a][1],u=this.wrap(e[a+1][0]-l)*this.kx,h=(e[a+1][1]-c)*this.ky,d=0;0===u&&0===h||(d=(this.wrap(t[0]-l)*this.kx*u+(t[1]-c)*this.ky*h)/(u*u+h*h),d>1?(l=e[a+1][0],c=e[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;p<s&&(s=p,r=l,n=c,i=a,o=d)}return{point:[r,n],index:i,t:Math.max(0,Math.min(1,o))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},MinPointsSize=100,MinLinePointsSize=50;function compareDistPair(e,t){return t[0]-e[0]}function getRangeSize(e){return e[1]-e[0]+1}function isRangeSafe(e,t){return e[1]>=e[0]&&e[1]<t}function splitRange(e,t){if(e[0]>e[1])return[null,null];const r=getRangeSize(e);if(t){if(2===r)return[e,null];const t=Math.floor(r/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===r)return[e,null];const n=Math.floor(r/2)-1;return[[e[0],e[0]+n],[e[0]+n+1,e[1]]]}function getBBox(e,t){if(!isRangeSafe(t,e.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let n=t[0];n<=t[1];++n)updateBBox(r,e[n]);return r}function getPolygonBBox(e){const t=[1/0,1/0,-1/0,-1/0];for(const r of e)for(const e of r)updateBBox(t,e);return t}function isValidBBox(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function bboxToBBoxDistance(e,t,r){if(!isValidBBox(e)||!isValidBBox(t))return NaN;let n=0,i=0;return e[2]<t[0]&&(n=t[0]-e[2]),e[0]>t[2]&&(n=e[0]-t[2]),e[1]>t[3]&&(i=e[1]-t[3]),e[3]<t[1]&&(i=t[1]-e[3]),r.distance([0,0],[n,i])}function pointToLineDistance(e,t,r){const n=r.pointOnLine(t,e);return r.distance(e,n.point)}function segmentToSegmentDistance(e,t,r,n,i){const o=Math.min(pointToLineDistance(e,[r,n],i),pointToLineDistance(t,[r,n],i)),s=Math.min(pointToLineDistance(r,[e,t],i),pointToLineDistance(n,[e,t],i));return Math.min(o,s)}function lineToLineDistance(e,t,r,n,i){if(!isRangeSafe(t,e.length)||!isRangeSafe(n,r.length))return 1/0;let o=1/0;for(let s=t[0];s<t[1];++s){const t=e[s],a=e[s+1];for(let e=n[0];e<n[1];++e){const n=r[e],s=r[e+1];if(segmentIntersectSegment(t,a,n,s))return 0;o=Math.min(o,segmentToSegmentDistance(t,a,n,s,i))}}return o}function pointsToPointsDistance(e,t,r,n,i){if(!isRangeSafe(t,e.length)||!isRangeSafe(n,r.length))return NaN;let o=1/0;for(let s=t[0];s<=t[1];++s)for(let t=n[0];t<=n[1];++t)if(o=Math.min(o,i.distance(e[s],r[t])),0===o)return o;return o}function pointToPolygonDistance(e,t,r){if(pointWithinPolygon(e,t,!0))return 0;let n=1/0;for(const i of t){const t=i[0],o=i[i.length-1];if(t!==o&&(n=Math.min(n,pointToLineDistance(e,[o,t],r)),0===n))return n;const s=r.pointOnLine(i,e);if(n=Math.min(n,r.distance(e,s.point)),0===n)return n}return n}function lineToPolygonDistance(e,t,r,n){if(!isRangeSafe(t,e.length))return NaN;for(let o=t[0];o<=t[1];++o)if(pointWithinPolygon(e[o],r,!0))return 0;let i=1/0;for(let o=t[0];o<t[1];++o){const t=e[o],s=e[o+1];for(const e of r)for(let r=0,o=e.length,a=o-1;r<o;a=r++){const o=e[a],l=e[r];if(segmentIntersectSegment(t,s,o,l))return 0;i=Math.min(i,segmentToSegmentDistance(t,s,o,l,n))}}return i}function polygonIntersect(e,t){for(const r of e)for(const e of r)if(pointWithinPolygon(e,t,!0))return!0;return!1}function polygonToPolygonDistance(e,t,r,n=1/0){const i=getPolygonBBox(e),o=getPolygonBBox(t);if(n!==1/0&&bboxToBBoxDistance(i,o,r)>=n)return n;if(boxWithinBox(i,o)){if(polygonIntersect(e,t))return 0}else if(polygonIntersect(t,e))return 0;let s=1/0;for(const a of e)for(let e=0,n=a.length,i=n-1;e<n;i=e++){const n=a[i],o=a[e];for(const e of t)for(let t=0,i=e.length,a=i-1;t<i;a=t++){const i=e[a],l=e[t];if(segmentIntersectSegment(n,o,i,l))return 0;s=Math.min(s,segmentToSegmentDistance(n,o,i,l,r))}}return s}function updateQueue(e,t,r,n,i,o){if(!o)return;const s=bboxToBBoxDistance(getBBox(n,o),i,r);s<t&&e.push([s,o,[0,0]])}function updateQueueTwoSets(e,t,r,n,i,o,s){if(!o||!s)return;const a=bboxToBBoxDistance(getBBox(n,o),getBBox(i,s),r);a<t&&e.push([a,o,s])}function pointsToPolygonDistance(e,t,r,n,i=1/0){let o=Math.min(n.distance(e[0],r[0][0]),i);if(0===o)return o;const s=new TinyQueue([[0,[0,e.length-1],[0,0]]],compareDistPair),a=getPolygonBBox(r);for(;s.length>0;){const i=s.pop();if(i[0]>=o)continue;const l=i[1],c=t?MinLinePointsSize:MinPointsSize;if(getRangeSize(l)<=c){if(!isRangeSafe(l,e.length))return NaN;if(t){const t=lineToPolygonDistance(e,l,r,n);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const i=pointToPolygonDistance(e[t],r,n);if(o=Math.min(o,i),0===o)return 0}}else{const r=splitRange(l,t);updateQueue(s,o,n,e,a,r[0]),updateQueue(s,o,n,e,a,r[1])}}return o}function pointSetToPointSetDistance(e,t,r,n,i,o=1/0){let s=Math.min(o,i.distance(e[0],r[0]));if(0===s)return s;const a=new TinyQueue([[0,[0,e.length-1],[0,r.length-1]]],compareDistPair);for(;a.length>0;){const o=a.pop();if(o[0]>=s)continue;const l=o[1],c=o[2],u=t?MinLinePointsSize:MinPointsSize,h=n?MinLinePointsSize:MinPointsSize;if(getRangeSize(l)<=u&&getRangeSize(c)<=h){if(!isRangeSafe(l,e.length)&&isRangeSafe(c,r.length))return NaN;let o;if(t&&n)o=lineToLineDistance(e,l,r,c,i),s=Math.min(s,o);else if(t&&!n){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=pointToLineDistance(r[e],t,i),s=Math.min(s,o),0===s)return s}else if(!t&&n){const t=r.slice(c[0],c[1]+1);for(let r=l[0];r<=l[1];++r)if(o=pointToLineDistance(e[r],t,i),s=Math.min(s,o),0===s)return s}else o=pointsToPointsDistance(e,l,r,c,i),s=Math.min(s,o)}else{const o=splitRange(l,t),u=splitRange(c,n);updateQueueTwoSets(a,s,i,e,r,o[0],u[0]),updateQueueTwoSets(a,s,i,e,r,o[0],u[1]),updateQueueTwoSets(a,s,i,e,r,o[1],u[0]),updateQueueTwoSets(a,s,i,e,r,o[1],u[1])}}return s}function pointToGeometryDistance(e,t){const r=e.geometry(),n=r.flat().map(t=>getLngLatFromTileCoord([t.x,t.y],e.canonical));if(0===r.length)return NaN;const i=new CheapRuler(n[0][1]);let o=1/0;for(const s of t){switch(s.type){case"Point":o=Math.min(o,pointSetToPointSetDistance(n,!1,[s.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,pointSetToPointSetDistance(n,!1,s.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,pointsToPolygonDistance(n,!1,s.coordinates,i,o))}if(0===o)return o}return o}function lineStringToGeometryDistance(e,t){const r=e.geometry(),n=r.flat().map(t=>getLngLatFromTileCoord([t.x,t.y],e.canonical));if(0===r.length)return NaN;const i=new CheapRuler(n[0][1]);let o=1/0;for(const s of t){switch(s.type){case"Point":o=Math.min(o,pointSetToPointSetDistance(n,!0,[s.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,pointSetToPointSetDistance(n,!0,s.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,pointsToPolygonDistance(n,!0,s.coordinates,i,o))}if(0===o)return o}return o}function polygonToGeometryDistance(e,t){const r=e.geometry();if(0===r.length||0===r[0].length)return NaN;const n=classifyRings(r,0).map(t=>t.map(t=>t.map(t=>getLngLatFromTileCoord([t.x,t.y],e.canonical)))),i=new CheapRuler(n[0][0][0][1]);let o=1/0;for(const s of t)for(const e of n){switch(s.type){case"Point":o=Math.min(o,pointsToPolygonDistance([s.coordinates],!1,e,i,o));break;case"LineString":o=Math.min(o,pointsToPolygonDistance(s.coordinates,!0,e,i,o));break;case"Polygon":o=Math.min(o,polygonToPolygonDistance(e,s.coordinates,i,o))}if(0===o)return o}return o}function toSimpleGeometry(e){return"MultiPolygon"===e.type?e.coordinates.map(e=>({type:"Polygon",coordinates:e})):"MultiLineString"===e.type?e.coordinates.map(e=>({type:"LineString",coordinates:e})):"MultiPoint"===e.type?e.coordinates.map(e=>({type:"Point",coordinates:e})):[e]}var Distance=class e{constructor(e,t){this.type=NumberType,this.geojson=e,this.geometries=t}static parse(t,r){if(2!==t.length)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(isValue(t[1])){const r=t[1];if("FeatureCollection"===r.type)return new e(r,r.features.map(e=>toSimpleGeometry(e.geometry)).flat());if("Feature"===r.type)return new e(r,toSimpleGeometry(r.geometry));if("type"in r&&"coordinates"in r)return new e(r,toSimpleGeometry(r))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return pointToGeometryDistance(e,this.geometries);if("LineString"===e.geometryType())return lineStringToGeometryDistance(e,this.geometries);if("Polygon"===e.geometryType())return polygonToGeometryDistance(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},GlobalState=class e{constructor(e){this.type=ValueType,this.key=e}static parse(t,r){if(2!==t.length)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=t[1];return null==n?r.error("Global state property must be defined."):"string"!=typeof n?r.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new e(n)}evaluate(e){const t=e.globals?.globalState;return t&&0!==Object.keys(t).length?getOwn(t,this.key)??null:null}eachChild(){}outputDefined(){return!1}},expressions={"==":Equals,"!=":NotEquals,">":GreaterThan,"<":LessThan,">=":GreaterThanOrEqual,"<=":LessThanOrEqual,array:Assertion,at:At,boolean:Assertion,case:Case,coalesce:Coalesce,collator:CollatorExpression,format:FormatExpression,image:ImageExpression,in:In,"index-of":IndexOf,interpolate:Interpolate,"interpolate-hcl":Interpolate,"interpolate-lab":Interpolate,length:Length,let:Let,literal:Literal,match:Match,number:Assertion,"number-format":NumberFormat,object:Assertion,slice:Slice,step:Step,string:Assertion,"to-boolean":Coercion,"to-color":Coercion,"to-number":Coercion,"to-string":Coercion,var:Var,within:Within,distance:Distance,"global-state":GlobalState},CompoundExpression=class e{constructor(e,t,r,n){this.name=e,this.type=t,this._evaluate=r,this.args=n}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(t,r){const n=t[0],i=e.definitions[n];if(!i)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(i)?i[0]:i.type,s=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=s.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let l=null;for(const[c,u]of a){l=new ParsingContext(r.registry,isExpressionConstant,r.path,null,r.scope);const i=[];let s=!1;for(let e=1;e<t.length;e++){const r=t[e],n=Array.isArray(c)?c[e-1]:c.type,o=l.parse(r,1+i.length,n);if(!o){s=!0;break}i.push(o)}if(!s)if(Array.isArray(c)&&c.length!==i.length)l.error(`Expected ${c.length} arguments, but found ${i.length} instead.`);else{for(let e=0;e<i.length;e++){const t=Array.isArray(c)?c[e]:c.type,r=i[e];l.concat(e+1).checkSubtype(t,r.type)}if(0===l.errors.length)return new e(n,o,u,i)}}if(1===a.length)r.errors.push(...l.errors);else{const e=(a.length?a:s).map(([e])=>stringifySignature(e)).join(" | "),n=[];for(let i=1;i<t.length;i++){const e=r.parse(t[i],1+n.length);if(!e)return null;n.push(typeToString(e.type))}r.error(`Expected arguments of type ${e}, but found (${n.join(", ")}) instead.`)}return null}static register(t,r){e.definitions=r;for(const n in r)t[n]=e}};function rgba(e,[t,r,n,i]){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);const o=i?i.evaluate(e):1,s=validateRGBA(t,r,n,o);if(s)throw new RuntimeError(s);return new Color(t/255,r/255,n/255,o,!1)}function has(e,t){return e in t}function get(e,t){const r=t[e];return void 0===r?null:r}function binarySearch(e,t,r,n){for(;r<=n;){const i=r+n>>1;if(t[i]===e)return!0;t[i]>e?n=i-1:r=i+1}return!1}function varargs(e){return{type:e}}function stringifySignature(e){return Array.isArray(e)?`(${e.map(typeToString).join(", ")})`:`(${typeToString(e.type)}...)`}function isExpressionConstant(e){if(e instanceof Var)return isExpressionConstant(e.boundExpression);if(e instanceof CompoundExpression&&"error"===e.name)return!1;if(e instanceof CollatorExpression)return!1;if(e instanceof Within)return!1;if(e instanceof Distance)return!1;if(e instanceof GlobalState)return!1;const t=e instanceof Coercion||e instanceof Assertion;let r=!0;return e.eachChild(e=>{r=t?r&&isExpressionConstant(e):r&&e instanceof Literal}),!!r&&isFeatureConstant(e)&&isGlobalPropertyConstant(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function isFeatureConstant(e){if(e instanceof CompoundExpression){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Within)return!1;if(e instanceof Distance)return!1;let t=!0;return e.eachChild(e=>{t&&!isFeatureConstant(e)&&(t=!1)}),t}function isStateConstant(e){if(e instanceof CompoundExpression&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!isStateConstant(e)&&(t=!1)}),t}function isGlobalPropertyConstant(e,t){if(e instanceof CompoundExpression&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!isGlobalPropertyConstant(e,t)&&(r=!1)}),r}function success(e){return{result:"success",value:e}}function error(e){return{result:"error",value:e}}function supportsPropertyExpression(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function supportsZoomExpression(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function supportsInterpolation(e){return!!e.expression&&e.expression.interpolated}function getType(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function isFunction(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&typeOf(e)===ObjectType}CompoundExpression.register(expressions,{error:[ErrorType,[StringType],(e,[t])=>{throw new RuntimeError(t.evaluate(e))}],typeof:[StringType,[ValueType],(e,[t])=>typeToString(typeOf(t.evaluate(e)))],"to-rgba":[array(NumberType,4),[ColorType],(e,[t])=>{const[r,n,i,o]=t.evaluate(e).rgb;return[255*r,255*n,255*i,o]}],rgb:[ColorType,[NumberType,NumberType,NumberType],rgba],rgba:[ColorType,[NumberType,NumberType,NumberType,NumberType],rgba],has:{type:BooleanType,overloads:[[[StringType],(e,[t])=>has(t.evaluate(e),e.properties())],[[StringType,ObjectType],(e,[t,r])=>has(t.evaluate(e),r.evaluate(e))]]},get:{type:ValueType,overloads:[[[StringType],(e,[t])=>get(t.evaluate(e),e.properties())],[[StringType,ObjectType],(e,[t,r])=>get(t.evaluate(e),r.evaluate(e))]]},"feature-state":[ValueType,[StringType],(e,[t])=>get(t.evaluate(e),e.featureState||{})],properties:[ObjectType,[],e=>e.properties()],"geometry-type":[StringType,[],e=>e.geometryType()],id:[ValueType,[],e=>e.id()],zoom:[NumberType,[],e=>e.globals.zoom],"heatmap-density":[NumberType,[],e=>e.globals.heatmapDensity||0],elevation:[NumberType,[],e=>e.globals.elevation||0],"line-progress":[NumberType,[],e=>e.globals.lineProgress||0],accumulated:[ValueType,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[NumberType,varargs(NumberType),(e,t)=>{let r=0;for(const n of t)r+=n.evaluate(e);return r}],"*":[NumberType,varargs(NumberType),(e,t)=>{let r=1;for(const n of t)r*=n.evaluate(e);return r}],"-":{type:NumberType,overloads:[[[NumberType,NumberType],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[NumberType],(e,[t])=>-t.evaluate(e)]]},"/":[NumberType,[NumberType,NumberType],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[NumberType,[NumberType,NumberType],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[NumberType,[],()=>Math.LN2],pi:[NumberType,[],()=>Math.PI],e:[NumberType,[],()=>Math.E],"^":[NumberType,[NumberType,NumberType],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[NumberType,[NumberType],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[NumberType,[NumberType],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[NumberType,[NumberType],(e,[t])=>Math.log(t.evaluate(e))],log2:[NumberType,[NumberType],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[NumberType,[NumberType],(e,[t])=>Math.sin(t.evaluate(e))],cos:[NumberType,[NumberType],(e,[t])=>Math.cos(t.evaluate(e))],tan:[NumberType,[NumberType],(e,[t])=>Math.tan(t.evaluate(e))],asin:[NumberType,[NumberType],(e,[t])=>Math.asin(t.evaluate(e))],acos:[NumberType,[NumberType],(e,[t])=>Math.acos(t.evaluate(e))],atan:[NumberType,[NumberType],(e,[t])=>Math.atan(t.evaluate(e))],min:[NumberType,varargs(NumberType),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[NumberType,varargs(NumberType),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[NumberType,[NumberType],(e,[t])=>Math.abs(t.evaluate(e))],round:[NumberType,[NumberType],(e,[t])=>{const r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[NumberType,[NumberType],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[NumberType,[NumberType],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[BooleanType,[StringType,ValueType],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[BooleanType,[ValueType],(e,[t])=>e.id()===t.value],"filter-type-==":[BooleanType,[StringType],(e,[t])=>e.geometryType()===t.value],"filter-<":[BooleanType,[StringType,ValueType],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[BooleanType,[ValueType],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r<n}],"filter->":[BooleanType,[StringType,ValueType],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[BooleanType,[ValueType],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[BooleanType,[StringType,ValueType],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[BooleanType,[ValueType],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[BooleanType,[StringType,ValueType],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[BooleanType,[ValueType],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[BooleanType,[ValueType],(e,[t])=>t.value in e.properties()],"filter-has-id":[BooleanType,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[BooleanType,[array(StringType)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[BooleanType,[array(ValueType)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[BooleanType,[StringType,array(ValueType)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[BooleanType,[StringType,array(ValueType)],(e,[t,r])=>binarySearch(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:BooleanType,overloads:[[[BooleanType,BooleanType],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[varargs(BooleanType),(e,t)=>{for(const r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:BooleanType,overloads:[[[BooleanType,BooleanType],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[varargs(BooleanType),(e,t)=>{for(const r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[BooleanType,[BooleanType],(e,[t])=>!t.evaluate(e)],"is-supported-script":[BooleanType,[StringType],(e,[t])=>{const r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[StringType,[StringType],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[StringType,[StringType],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[StringType,varargs(ValueType),(e,t)=>t.map(t=>valueToString(t.evaluate(e))).join("")],split:[array(StringType),[StringType,StringType],(e,[t,r])=>t.evaluate(e).split(r.evaluate(e))],join:[StringType,[array(StringType),StringType],(e,[t,r])=>t.evaluate(e).join(r.evaluate(e))],"resolved-locale":[StringType,[CollatorType],(e,[t])=>t.evaluate(e).resolvedLocale()]});var StyleExpression=class{constructor(e,t,r){this.expression=e,this._warningHistory={},this._evaluator=new EvaluationContext,this._defaultValue=t?getDefaultValue(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this._globalState=r}evaluateWithoutErrorHandling(e,t,r,n,i,o){return this._globalState&&(e=addGlobalState(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,n,i,o){this._globalState&&(e=addGlobalState(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new RuntimeError(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,"undefined"!=typeof console&&console.warn(s.message)),this._defaultValue}}};function isExpression(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in expressions}function createExpression(e,t,r){const n=new ParsingContext(expressions,isExpressionConstant,[],t?getExpectedType(t):void 0),i=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return i?success(new StyleExpression(i,t,r)):error(n.errors)}var ZoomConstantExpression=class{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!isStateConstant(t.expression),this.globalStateRefs=findGlobalStateRefs(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,n,i,o){return this._globalState&&(e=addGlobalState(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,i,o)}evaluate(e,t,r,n,i,o){return this._globalState&&(e=addGlobalState(e,this._globalState)),this._styleExpression.evaluate(e,t,r,n,i,o)}},ZoomDependentExpression=class{constructor(e,t,r,n,i){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!isStateConstant(t.expression),this.globalStateRefs=findGlobalStateRefs(t.expression),this.interpolationType=n,this._globalState=i}evaluateWithoutErrorHandling(e,t,r,n,i,o){return this._globalState&&(e=addGlobalState(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,i,o)}evaluate(e,t,r,n,i,o){return this._globalState&&(e=addGlobalState(e,this._globalState)),this._styleExpression.evaluate(e,t,r,n,i,o)}interpolationFactor(e,t,r){return this.interpolationType?Interpolate.interpolationFactor(this.interpolationType,e,t,r):0}};function createPropertyExpression(e,t,r){const n=createExpression(e,t,r);if("error"===n.result)return n;const i=n.value.expression,o=isFeatureConstant(i);if(!o&&!supportsPropertyExpression(t))return error([new ExpressionParsingError("","data expressions not supported")]);const s=isGlobalPropertyConstant(i,["zoom"]);if(!s&&!supportsZoomExpression(t))return error([new ExpressionParsingError("","zoom expressions not supported")]);const a=findZoomCurve(i);if(!a&&!s)return error([new ExpressionParsingError("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof ExpressionParsingError)return error([a]);if(a instanceof Interpolate&&!supportsInterpolation(t))return error([new ExpressionParsingError("",'"interpolate" expressions cannot be used with this property')]);if(!a)return success(new ZoomConstantExpression(o?"constant":"source",n.value,r));const l=a instanceof Interpolate?a.interpolation:void 0;return success(new ZoomDependentExpression(o?"camera":"composite",n.value,a.labels,l,r))}function findZoomCurve(e){let t=null;if(e instanceof Let)t=findZoomCurve(e.result);else if(e instanceof Coalesce){for(const r of e.args)if(t=findZoomCurve(r),t)break}else(e instanceof Step||e instanceof Interpolate)&&e.input instanceof CompoundExpression&&"zoom"===e.input.name&&(t=e);return t instanceof ExpressionParsingError||e.eachChild(e=>{const r=findZoomCurve(e);r instanceof ExpressionParsingError?t=r:!t&&r?t=new ExpressionParsingError("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new ExpressionParsingError("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function findGlobalStateRefs(e,t=new Set){return e instanceof GlobalState&&t.add(e.key),e.eachChild(e=>{findGlobalStateRefs(e,t)}),t}function getExpectedType(e){const t={color:ColorType,string:StringType,number:NumberType,enum:StringType,boolean:BooleanType,formatted:FormattedType,padding:PaddingType,numberArray:NumberArrayType,colorArray:ColorArrayType,projectionDefinition:ProjectionDefinitionType,resolvedImage:ResolvedImageType,variableAnchorOffsetCollection:VariableAnchorOffsetCollectionType};return"array"===e.type?array(t[e.value]||ValueType,e.length):t[e.type]}function getDefaultValue(e){if("color"===e.type&&isFunction(e.default))return new Color(0,0,0,0);switch(e.type){case"color":return Color.parse(e.default)||null;case"padding":return Padding.parse(e.default)||null;case"numberArray":return NumberArray.parse(e.default)||null;case"colorArray":return ColorArray.parse(e.default)||null;case"variableAnchorOffsetCollection":return VariableAnchorOffsetCollection.parse(e.default)||null;case"projectionDefinition":return ProjectionDefinition.parse(e.default)||null;default:return void 0===e.default?null:e.default}}function addGlobalState(e,t){const{zoom:r,heatmapDensity:n,elevation:i,lineProgress:o,isSupportedScript:s,accumulated:a}=e??{};return{zoom:r,heatmapDensity:n,elevation:i,lineProgress:o,isSupportedScript:s,accumulated:a,globalState:t}}function isExpressionFilter(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!isExpressionFilter(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}var filterSpec={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function featureFilter(e,t){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};isExpressionFilter(e)||(e=convertFilter$1(e));const r=createExpression(e,filterSpec,t);if("error"===r.result)throw new Error(r.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,t,n)=>r.value.evaluate(e,t,{},n),needGeometry:geometryNeeded(e),getGlobalStateRefs:()=>findGlobalStateRefs(r.value.expression)}}function compare(e,t){return e<t?-1:e>t?1:0}function geometryNeeded(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(geometryNeeded(e[t]))return!0;return!1}function convertFilter$1(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?convertComparisonOp$1(e[1],e[2],"=="):"!="===t?convertNegation(convertComparisonOp$1(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?convertComparisonOp$1(e[1],e[2],t):"any"===t?convertDisjunctionOp(e.slice(1)):"all"===t?["all"].concat(e.slice(1).map(convertFilter$1)):"none"===t?["all"].concat(e.slice(1).map(convertFilter$1).map(convertNegation)):"in"===t?convertInOp$1(e[1],e.slice(2)):"!in"===t?convertNegation(convertInOp$1(e[1],e.slice(2))):"has"===t?convertHasOp$1(e[1]):"!has"!==t||convertNegation(convertHasOp$1(e[1]))}function convertComparisonOp$1(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function convertDisjunctionOp(e){return["any"].concat(e.map(convertFilter$1))}function convertInOp$1(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(compare)]]:["filter-in-small",e,["literal",t]]}}function convertHasOp$1(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function convertNegation(e){return["!",e]}function convertLiteral(e){return"object"==typeof e?["literal",e]:e}function convertFunction(e,t){let r=e.stops;if(!r)return convertIdentityFunction(e,t);const n=r&&"object"==typeof r[0][0],i=n||void 0!==e.property,o=n||!i;return r=r.map(e=>!i&&t.tokens&&"string"==typeof e[1]?[e[0],convertTokenString(e[1])]:[e[0],convertLiteral(e[1])]),n?convertZoomAndPropertyFunction(e,t,r):o?convertZoomFunction(e,t,r):convertPropertyFunction(e,t,r)}function convertIdentityFunction(e,t){const r=["get",e.property];if(void 0===e.default)return"string"===t.type?["string",r]:r;if("enum"===t.type)return["match",r,Object.keys(t.values),r,e.default];{const n=["color"===t.type?"to-color":t.type,r,convertLiteral(e.default)];return"array"===t.type&&n.splice(1,0,t.value,t.length||null),n}}function getInterpolateOperator(e){switch(e.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function convertZoomAndPropertyFunction(e,t,r){const n={},i={},o=[];for(let s=0;s<r.length;s++){const t=r[s],a=t[0].zoom;void 0===n[a]&&(n[a]={zoom:a,type:e.type,property:e.property,default:e.default},i[a]=[],o.push(a)),i[a].push([t[0].value,t[1]])}if("exponential"===getFunctionType({},t)){const r=[getInterpolateOperator(e),["linear"],["zoom"]];for(const e of o)appendStopPair(r,e,convertPropertyFunction(n[e],t,i[e]),!1);return r}{const e=["step",["zoom"]];for(const r of o)appendStopPair(e,r,convertPropertyFunction(n[r],t,i[r]),!0);return fixupDegenerateStepCurve(e),e}}function coalesce(e,t){return void 0!==e?e:void 0!==t?t:void 0}function getFallback(e,t){const r=convertLiteral(coalesce(e.default,t.default));return void 0===r&&"resolvedImage"===t.type?"":r}function convertPropertyFunction(e,t,r){const n=getFunctionType(e,t),i=["get",e.property];if("categorical"===n&&"boolean"==typeof r[0][0]){const n=["case"];for(const e of r)n.push(["==",i,e[0]],e[1]);return n.push(getFallback(e,t)),n}if("categorical"===n){const n=["match",i];for(const e of r)appendStopPair(n,e[0],e[1],!1);return n.push(getFallback(e,t)),n}if("interval"===n){const t=["step",["number",i]];for(const e of r)appendStopPair(t,e[0],e[1],!0);return fixupDegenerateStepCurve(t),void 0===e.default?t:["case",["==",["typeof",i],"number"],t,convertLiteral(e.default)]}if("exponential"===n){const t=void 0!==e.base?e.base:1,n=[getInterpolateOperator(e),1===t?["linear"]:["exponential",t],["number",i]];for(const e of r)appendStopPair(n,e[0],e[1],!1);return void 0===e.default?n:["case",["==",["typeof",i],"number"],n,convertLiteral(e.default)]}throw new Error(`Unknown property function type ${n}`)}function convertZoomFunction(e,t,r,n=["zoom"]){const i=getFunctionType(e,t);let o,s=!1;if("interval"===i)o=["step",n],s=!0;else{if("exponential"!==i)throw new Error(`Unknown zoom function type "${i}"`);{const t=void 0!==e.base?e.base:1;o=[getInterpolateOperator(e),1===t?["linear"]:["exponential",t],n]}}for(const a of r)appendStopPair(o,a[0],a[1],s);return fixupDegenerateStepCurve(o),o}function fixupDegenerateStepCurve(e){"step"===e[0]&&3===e.length&&(e.push(0),e.push(e[3]))}function appendStopPair(e,t,r,n){e.length>3&&t===e[e.length-2]||(n&&2===e.length||e.push(t),e.push(r))}function getFunctionType(e,t){return e.type?e.type:t.expression.interpolated?"exponential":"interval"}function convertTokenString(e){const t=["concat"],r=/{([^{}]+)}/g;let n=0;for(let i=r.exec(e);null!==i;i=r.exec(e)){const o=e.slice(n,r.lastIndex-i[0].length);n=r.lastIndex,o.length>0&&t.push(o),t.push(["get",i[1]])}if(1===t.length)return e;if(n<e.length)t.push(e.slice(n));else if(2===t.length)return["to-string",t[1]];return t}function validateConstants(e){const t=e.key,r=e.value;return r?[new ValidationError(t,r,"constants have been deprecated as of v8")]:[]}function unbundle(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function deepUnbundle(e){if(Array.isArray(e))return e.map(deepUnbundle);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const r in e)t[r]=deepUnbundle(e[r]);return t}return unbundle(e)}function validateObject(e){const t=e.key,r=e.value,n=e.valueSpec||{},i=e.objectElementValidators||{},o=e.style,s=e.styleSpec,a=e.validateSpec;let l=[];const c=getType(r);if("object"!==c)return[new ValidationError(t,r,`object expected, ${c} found`)];for(const u in r){const e=u.split(".")[0],c=getOwn(n,e)||n["*"];let h;if(getOwn(i,e))h=i[e];else if(getOwn(n,e)){if(void 0===r[u])continue;h=a}else if(i["*"])h=i["*"];else{if(!n["*"]){l.push(new ValidationError(t,r[u],`unknown property "${u}"`));continue}h=a}l=l.concat(h({key:(t?`${t}.`:t)+u,value:r[u],valueSpec:c,style:o,styleSpec:s,object:r,objectKey:u,validateSpec:a},r))}for(const u in n)i[u]||n[u].required&&void 0===n[u].default&&void 0===r[u]&&l.push(new ValidationError(t,r,`missing required property "${u}"`));return l}function validateArray(e){const t=e.value,r=e.valueSpec,n=e.validateSpec,i=e.style,o=e.styleSpec,s=e.key,a=e.arrayElementValidator||n;if("array"!==getType(t))return[new ValidationError(s,t,`array expected, ${getType(t)} found`)];if(r.length&&t.length!==r.length)return[new ValidationError(s,t,`array length ${r.length} expected, length ${t.length} found`)];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),"object"===getType(r.value)&&(l=r.value);let c=[];for(let u=0;u<t.length;u++)c=c.concat(a({array:t,arrayIndex:u,value:t[u],valueSpec:l,validateSpec:e.validateSpec,style:i,styleSpec:o,key:`${s}[${u}]`}));return c}function validateNumber(e){const t=e.key,r=e.value,n=e.valueSpec;let i=getType(r);return"number"===i&&r!=r&&(i="NaN"),"number"!==i?[new ValidationError(t,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new ValidationError(t,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new ValidationError(t,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function validateFunction(e){const t=e.valueSpec,r=unbundle(e.value.type);let n,i,o,s={};const a="categorical"!==r&&void 0===e.value.property,l=!a,c="array"===getType(e.value.stops)&&"array"===getType(e.value.stops[0])&&"object"===getType(e.value.stops[0][0]),u=validateObject({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===r)return[new ValidationError(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const n=e.value;return t=t.concat(validateArray({key:e.key,value:n,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===getType(n)&&0===n.length&&t.push(new ValidationError(e.key,n,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===r&&a&&u.push(new ValidationError(e.key,e.value,'missing required property "property"')),"identity"===r||e.value.stops||u.push(new ValidationError(e.key,e.value,'missing required property "stops"')),"exponential"===r&&e.valueSpec.expression&&!supportsInterpolation(e.valueSpec)&&u.push(new ValidationError(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!supportsPropertyExpression(e.valueSpec)?u.push(new ValidationError(e.key,e.value,"property functions not supported")):a&&!supportsZoomExpression(e.valueSpec)&&u.push(new ValidationError(e.key,e.value,"zoom functions not supported"))),"categorical"!==r&&!c||void 0!==e.value.property||u.push(new ValidationError(e.key,e.value,'"property" property is required')),u;function h(e){let r=[];const n=e.value,a=e.key;if("array"!==getType(n))return[new ValidationError(a,n,`array expected, ${getType(n)} found`)];if(2!==n.length)return[new ValidationError(a,n,`array length 2 expected, length ${n.length} found`)];if(c){if("object"!==getType(n[0]))return[new ValidationError(a,n,`object expected, ${getType(n[0])} found`)];if(void 0===n[0].zoom)return[new ValidationError(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new ValidationError(a,n,"object stop key must have value")];if(o&&o>unbundle(n[0].zoom))return[new ValidationError(a,n[0].zoom,"stop zoom values must appear in ascending order")];unbundle(n[0].zoom)!==o&&(o=unbundle(n[0].zoom),i=void 0,s={}),r=r.concat(validateObject({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:validateNumber,value:d}}))}else r=r.concat(d({key:`${a}[0]`,value:n[0],valueSpec:{},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},n));return isExpression(deepUnbundle(n[1]))?r.concat([new ValidationError(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(e.validateSpec({key:`${a}[1]`,value:n[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const a=getType(e.value),l=unbundle(e.value),c=null!==e.value?e.value:o;if(n){if(a!==n)return[new ValidationError(e.key,c,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new ValidationError(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==r){let n=`number expected, ${a} found`;return supportsPropertyExpression(t)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ValidationError(e.key,c,n)]}return"categorical"!==r||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===a&&void 0!==i&&l<i?[new ValidationError(e.key,c,"stop domain values must appear in ascending order")]:(i=l,"categorical"===r&&l in s?[new ValidationError(e.key,c,"stop domain values must be unique")]:(s[l]=!0,[])):[new ValidationError(e.key,c,`integer expected, found ${l}`)]}}function validateExpression(e){const t=("property"===e.expressionContext?createPropertyExpression:createExpression)(deepUnbundle(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new ValidationError(`${e.key}${t.key}`,e.value,t.message));const r=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!r.outputDefined())return[new ValidationError(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!isStateConstant(r))return[new ValidationError(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!isStateConstant(r))return[new ValidationError(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!isGlobalPropertyConstant(r,["zoom","feature-state"]))return[new ValidationError(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!isFeatureConstant(r))return[new ValidationError(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function validateBoolean(e){const t=e.value,r=e.key,n=getType(t);return"boolean"!==n?[new ValidationError(r,t,`boolean expected, ${n} found`)]:[]}function validateColor(e){const t=e.key,r=e.value,n=getType(r);return"string"!==n?[new ValidationError(t,r,`color expected, ${n} found`)]:Color.parse(String(r))?[]:[new ValidationError(t,r,`color expected, "${r}" found`)]}function validateEnum(e){const t=e.key,r=e.value,n=e.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(unbundle(r))&&i.push(new ValidationError(t,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(unbundle(r))&&i.push(new ValidationError(t,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function validateFilter(e){return isExpressionFilter(deepUnbundle(e.value))?validateExpression(extendBy({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):validateNonExpressionFilter(e)}function validateNonExpressionFilter(e){const t=e.value,r=e.key;if("array"!==getType(t))return[new ValidationError(r,t,`array expected, ${getType(t)} found`)];const n=e.styleSpec;let i,o=[];if(t.length<1)return[new ValidationError(r,t,"filter array must have at least 1 element")];switch(o=o.concat(validateEnum({key:`${r}[0]`,value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),unbundle(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===unbundle(t[1])&&o.push(new ValidationError(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new ValidationError(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(i=getType(t[1]),"string"!==i&&o.push(new ValidationError(`${r}[1]`,t[1],`string expected, ${i} found`)));for(let s=2;s<t.length;s++)i=getType(t[s]),"$type"===unbundle(t[1])?o=o.concat(validateEnum({key:`${r}[${s}]`,value:t[s],valueSpec:n.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&o.push(new ValidationError(`${r}[${s}]`,t[s],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let n=1;n<t.length;n++)o=o.concat(validateNonExpressionFilter({key:`${r}[${n}]`,value:t[n],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=getType(t[1]),2!==t.length?o.push(new ValidationError(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):"string"!==i&&o.push(new ValidationError(`${r}[1]`,t[1],`string expected, ${i} found`))}return o}function validateProperty(e,t){const r=e.key,n=e.validateSpec,i=e.style,o=e.styleSpec,s=e.value,a=e.objectKey,l=o[`${t}_${e.layerType}`];if(!l)return[];const c=a.match(/^(.*)-transition$/);if("paint"===t&&c&&l[c[1]]&&l[c[1]].transition)return n({key:r,value:s,valueSpec:o.transition,style:i,styleSpec:o});const u=e.valueSpec||l[a];if(!u)return[new ValidationError(r,s,`unknown property "${a}"`)];let h;if("string"===getType(s)&&supportsPropertyExpression(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(s)))return[new ValidationError(r,s,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const d=[];return"symbol"===e.layerType&&"text-font"===a&&isFunction(deepUnbundle(s))&&"identity"===unbundle(s.type)&&d.push(new ValidationError(r,s,'"text-font" does not support identity functions')),d.concat(n({key:e.key,value:s,valueSpec:u,style:i,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:a}))}function validatePaintProperty(e){return validateProperty(e,"paint")}function validateLayoutProperty(e){return validateProperty(e,"layout")}function validateLayer(e){let t=[];const r=e.value,n=e.key,i=e.style,o=e.styleSpec;if("object"!==getType(r))return[new ValidationError(n,r,`object expected, ${getType(r)} found`)];r.type||r.ref||t.push(new ValidationError(n,r,'either "type" or "ref" is required'));let s=unbundle(r.type);const a=unbundle(r.ref);if(r.id){const o=unbundle(r.id);for(let s=0;s<e.arrayIndex;s++){const e=i.layers[s];unbundle(e.id)===o&&t.push(new ValidationError(n,r.id,`duplicate layer id "${r.id}", previously used at line ${e.id.__line__}`))}}if("ref"in r){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in r&&t.push(new ValidationError(n,r[e],`"${e}" is prohibited for ref layers`))}),i.layers.forEach(t=>{unbundle(t.id)===a&&(e=t)}),e?e.ref?t.push(new ValidationError(n,r.ref,"ref cannot reference another ref layer")):s=unbundle(e.type):t.push(new ValidationError(n,r.ref,`ref layer "${a}" not found`))}else if("background"!==s)if(r.source){const e=i.sources&&i.sources[r.source],o=e&&unbundle(e.type);e?"vector"===o&&"raster"===s?t.push(new ValidationError(n,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===s||"raster-dem"!==o&&"color-relief"===s?t.push(new ValidationError(n,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==s?t.push(new ValidationError(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==o||r["source-layer"]?"raster-dem"===o&&"hillshade"!==s&&"color-relief"!==s?t.push(new ValidationError(n,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==s||!r.paint||!r.paint["line-gradient"]||"geojson"===o&&e.lineMetrics||t.push(new ValidationError(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new ValidationError(n,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new ValidationError(n,r.source,`source "${r.source}" not found`))}else t.push(new ValidationError(n,r,'missing required property "source"'));return"raster"===s&&r.paint?.resampling&&r.paint?.["raster-resampling"]&&t.push(new ValidationError(n,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),t=t.concat(validateObject({key:n,value:r,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${n}.type`,value:r.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"}),filter:validateFilter,layout:e=>validateObject({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>validateLayoutProperty(extendBy({layerType:s},e))}}),paint:e=>validateObject({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>validatePaintProperty(extendBy({layerType:s},e))}})}})),t}function validateString(e){const t=e.value,r=e.key,n=getType(t);return"string"!==n?[new ValidationError(r,t,`string expected, ${n} found`)]:[]}function validateRasterDEMSource(e){const t=e.sourceName??"",r=e.value,n=e.styleSpec,i=n.source_raster_dem,o=e.style;let s=[];const a=getType(r);if(void 0===r)return s;if("object"!==a)return s.push(new ValidationError("source_raster_dem",r,`object expected, ${a} found`)),s;const l="custom"===unbundle(r.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],u=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const h in r)!l&&c.includes(h)?s.push(new ValidationError(h,r[h],`In "${t}": "${h}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):i[h]?s=s.concat(e.validateSpec({key:h,value:r[h],valueSpec:i[h],validateSpec:e.validateSpec,style:o,styleSpec:n})):s.push(new ValidationError(h,r[h],`unknown property "${h}"`));return s}var objectElementValidators={promoteId:validatePromoteId};function validateSource(e){const t=e.value,r=e.key,n=e.styleSpec,i=e.style,o=e.validateSpec;if(!t.type)return[new ValidationError(r,t,'"type" is required')];const s=unbundle(t.type);let a;switch(s){case"vector":case"raster":return a=validateObject({key:r,value:t,valueSpec:n[`source_${s.replace("-","_")}`],style:e.style,styleSpec:n,objectElementValidators:objectElementValidators,validateSpec:o}),a;case"raster-dem":return a=validateRasterDEMSource({sourceName:r,value:t,style:e.style,styleSpec:n,validateSpec:o}),a;case"geojson":if(a=validateObject({key:r,value:t,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:objectElementValidators}),t.cluster)for(const e in t.clusterProperties){const[n,i]=t.clusterProperties[e],s="string"==typeof n?[n,["accumulated"],["get",e]]:n;a.push(...validateExpression({key:`${r}.${e}.map`,value:i,validateSpec:o,expressionContext:"cluster-map"})),a.push(...validateExpression({key:`${r}.${e}.reduce`,value:s,validateSpec:o,expressionContext:"cluster-reduce"}))}return a;case"video":return validateObject({key:r,value:t,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return validateObject({key:r,value:t,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new ValidationError(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return validateEnum({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:o,styleSpec:n})}}function validatePromoteId({key:e,value:t}){if("string"===getType(t))return validateString({key:e,value:t});{const r=[];for(const n in t)r.push(...validateString({key:`${e}.${n}`,value:t[n]}));return r}}function validateLight(e){const t=e.value,r=e.styleSpec,n=r.light,i=e.style;let o=[];const s=getType(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new ValidationError("light",t,`object expected, ${s} found`)]),o;for(const a in t){const s=a.match(/^(.*)-transition$/);o=s&&n[s[1]]&&n[s[1]].transition?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:r.transition,validateSpec:e.validateSpec,style:i,styleSpec:r})):n[a]?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:n[a],validateSpec:e.validateSpec,style:i,styleSpec:r})):o.concat([new ValidationError(a,t[a],`unknown property "${a}"`)])}return o}function validateSky(e){const t=e.value,r=e.styleSpec,n=r.sky,i=e.style,o=getType(t);if(void 0===t)return[];if("object"!==o)return[new ValidationError("sky",t,`object expected, ${o} found`)];let s=[];for(const a in t)s=n[a]?s.concat(e.validateSpec({key:a,value:t[a],valueSpec:n[a],style:i,styleSpec:r})):s.concat([new ValidationError(a,t[a],`unknown property "${a}"`)]);return s}function validateTerrain(e){const t=e.value,r=e.styleSpec,n=r.terrain,i=e.style;let o=[];const s=getType(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new ValidationError("terrain",t,`object expected, ${s} found`)]),o;for(const a in t)o=n[a]?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:n[a],validateSpec:e.validateSpec,style:i,styleSpec:r})):o.concat([new ValidationError(a,t[a],`unknown property "${a}"`)]);return o}function validateFormatted(e){return 0===validateString(e).length?[]:validateExpression(e)}function validateImage(e){return 0===validateString(e).length?[]:validateExpression(e)}function validatePadding(e){const t=e.key,r=e.value;if("array"===getType(r)){if(r.length<1||r.length>4)return[new ValidationError(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const n={type:"number"};let i=[];for(let o=0;o<r.length;o++)i=i.concat(e.validateSpec({key:`${t}[${o}]`,value:r[o],validateSpec:e.validateSpec,valueSpec:n}));return i}return validateNumber({key:t,value:r,valueSpec:{}})}function validateNumberArray(e){const t=e.key,r=e.value;if("array"===getType(r)){const n={type:"number"};if(r.length<1)return[new ValidationError(t,r,"array length at least 1 expected, length 0 found")];let i=[];for(let o=0;o<r.length;o++)i=i.concat(e.validateSpec({key:`${t}[${o}]`,value:r[o],validateSpec:e.validateSpec,valueSpec:n}));return i}return validateNumber({key:t,value:r,valueSpec:{}})}function validateColorArray(e){const t=e.key,r=e.value;if("array"===getType(r)){if(r.length<1)return[new ValidationError(t,r,"array length at least 1 expected, length 0 found")];let e=[];for(let n=0;n<r.length;n++)e=e.concat(validateColor({key:`${t}[${n}]`,value:r[n],valueSpec:{}}));return e}return validateColor({key:t,value:r,valueSpec:{}})}function validateVariableAnchorOffsetCollection(e){const t=e.key,r=e.value,n=getType(r),i=e.styleSpec;if("array"!==n||r.length<1||r.length%2!=0)return[new ValidationError(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let s=0;s<r.length;s+=2)o=o.concat(validateEnum({key:`${t}[${s}]`,value:r[s],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(validateArray({key:`${t}[${s+1}]`,value:r[s+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return o}function validateSprite(e){let t=[];const r=e.value,n=e.key;if(Array.isArray(r)){const i=[],o=[];for(const s in r)r[s].id&&i.includes(r[s].id)&&t.push(new ValidationError(n,r,`all the sprites' ids must be unique, but ${r[s].id} is duplicated`)),i.push(r[s].id),r[s].url&&o.includes(r[s].url)&&t.push(new ValidationError(n,r,`all the sprites' URLs must be unique, but ${r[s].url} is duplicated`)),o.push(r[s].url),t=t.concat(validateObject({key:`${n}[${s}]`,value:r[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return validateString({key:n,value:r})}function validateProjection(e){const t=e.value,r=e.styleSpec,n=r.projection,i=e.style,o=getType(t);if(void 0===t)return[];if("object"!==o)return[new ValidationError("projection",t,`object expected, ${o} found`)];let s=[];for(const a in t)s=n[a]?s.concat(e.validateSpec({key:a,value:t[a],valueSpec:n[a],style:i,styleSpec:r})):s.concat([new ValidationError(a,t[a],`unknown property "${a}"`)]);return s}function validateProjectionDefinition(e){const t=e.key;let r=e.value;r=r instanceof String?r.valueOf():r;const n=getType(r);return"array"!==n||isProjectionDefinitionValue(r)||isPropertyValueSpecification(r)?["array","string"].includes(n)?[]:[new ValidationError(t,r,`projection expected, invalid type "${n}" found`)]:[new ValidationError(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]}function isPropertyValueSpecification(e){return!!["interpolate","step","literal"].includes(e[0])}function isProjectionDefinitionValue(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}function isObjectLiteral(e){return Boolean(e)&&e.constructor===Object}function validateState(e){return isObjectLiteral(e.value)?[]:[new ValidationError(e.key,e.value,`object expected, ${getType(e.value)} found`)]}function validateFontFaces(e){const t=e.key,r=e.value,n=e.validateSpec,i=e.styleSpec,o=e.style;if(!isObjectLiteral(r))return[new ValidationError(t,r,`object expected, ${getType(r)} found`)];const s=[];for(const a in r){const e=r[a],l=getType(e);if("string"===l)s.push(...validateString({key:`${t}.${a}`,value:e}));else if("array"===l){const r={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,c]of e.entries())s.push(...validateObject({key:`${t}.${a}[${l}]`,value:c,valueSpec:r,styleSpec:i,style:o,validateSpec:n}))}else s.push(new ValidationError(`${t}.${a}`,e,`string or array expected, ${l} found`))}return s}var VALIDATORS={"*":()=>[],array:validateArray,boolean:validateBoolean,number:validateNumber,color:validateColor,constants:validateConstants,enum:validateEnum,filter:validateFilter,function:validateFunction,layer:validateLayer,object:validateObject,source:validateSource,light:validateLight,sky:validateSky,terrain:validateTerrain,projection:validateProjection,projectionDefinition:validateProjectionDefinition,string:validateString,formatted:validateFormatted,resolvedImage:validateImage,padding:validatePadding,numberArray:validateNumberArray,colorArray:validateColorArray,variableAnchorOffsetCollection:validateVariableAnchorOffsetCollection,sprite:validateSprite,state:validateState,fontFaces:validateFontFaces};function validate(e){const t=e.value,r=e.valueSpec,n=e.styleSpec;return e.validateSpec=validate,r.expression&&isFunction(unbundle(t))?validateFunction(e):r.expression&&isExpression(deepUnbundle(t))?validateExpression(e):r.type&&VALIDATORS[r.type]?VALIDATORS[r.type](e):validateObject(extendBy({},e,{valueSpec:r.type?n[r.type]:r}))}function validateGlyphsUrl(e){const t=e.value,r=e.key,n=validateString(e);return n.length||(-1===t.indexOf("{fontstack}")&&n.push(new ValidationError(r,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&n.push(new ValidationError(r,t,'"glyphs" url must include a "{range}" token'))),n}function validateStyleMin(e,t=v8_default){let r=[];return r=r.concat(validate({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:validate,objectElementValidators:{glyphs:validateGlyphsUrl,"*":()=>[]}})),e.constants&&(r=r.concat(validateConstants({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:validate}))),sortErrors(r)}function injectValidateSpec(e){return function(t){return e(Object.assign({},t,{validateSpec:validate}))}}function sortErrors(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function wrapCleanErrors(e){return function(...t){return sortErrors(e.apply(this,t))}}validateStyleMin.source=wrapCleanErrors(injectValidateSpec(validateSource)),validateStyleMin.sprite=wrapCleanErrors(injectValidateSpec(validateSprite)),validateStyleMin.glyphs=wrapCleanErrors(injectValidateSpec(validateGlyphsUrl)),validateStyleMin.light=wrapCleanErrors(injectValidateSpec(validateLight)),validateStyleMin.sky=wrapCleanErrors(injectValidateSpec(validateSky)),validateStyleMin.terrain=wrapCleanErrors(injectValidateSpec(validateTerrain)),validateStyleMin.state=wrapCleanErrors(injectValidateSpec(validateState)),validateStyleMin.layer=wrapCleanErrors(injectValidateSpec(validateLayer)),validateStyleMin.filter=wrapCleanErrors(injectValidateSpec(validateFilter)),validateStyleMin.paintProperty=wrapCleanErrors(injectValidateSpec(validatePaintProperty)),validateStyleMin.layoutProperty=wrapCleanErrors(injectValidateSpec(validateLayoutProperty));var v8=v8_default,SHIFT_LEFT_32=4294967296,SHIFT_RIGHT_32=1/SHIFT_LEFT_32,TEXT_DECODER_MIN_LENGTH=12,utf8TextDecoder="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8"),PBF_VARINT=0,PBF_FIXED64=1,PBF_BYTES=2,PBF_FIXED32=5,PbfReader=class{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,r=this.length){let n;for(;n=this.nextField(r);)e(n,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*SHIFT_LEFT_32;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*SHIFT_LEFT_32;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf,r=t[this.pos++];if(r<128)return r;let n,i=127&r;return n=t[this.pos++],i|=(127&n)<<7,n<128?i:(n=t[this.pos++],i|=(127&n)<<14,n<128?i:(n=t[this.pos++],i|=(127&n)<<21,n<128?i:(n=t[this.pos],i|=(15&n)<<28,readVarintRemainder(i,e,this))))}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=TEXT_DECODER_MIN_LENGTH&&utf8TextDecoder?utf8TextDecoder.decode(this.buf.subarray(t,e)):readUtf8(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===PBF_BYTES?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;const t=this.readVarint();return this.type=7&t,this._valueStart=this.pos,t>>>3}skip(e){const t=7&e;if(t===PBF_VARINT)for(;this.buf[this.pos++]>127;);else if(t===PBF_BYTES)this.pos=this.readVarint()+this.pos;else if(t===PBF_FIXED32)this.pos+=4;else{if(t!==PBF_FIXED64)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}};function readVarintRemainder(e,t,r){const n=r.buf;let i,o;if(o=n[r.pos++],i=(112&o)>>4,o<128)return toNum(e,i,t);if(o=n[r.pos++],i|=(127&o)<<3,o<128)return toNum(e,i,t);if(o=n[r.pos++],i|=(127&o)<<10,o<128)return toNum(e,i,t);if(o=n[r.pos++],i|=(127&o)<<17,o<128)return toNum(e,i,t);if(o=n[r.pos++],i|=(127&o)<<24,o<128)return toNum(e,i,t);if(o=n[r.pos++],i|=(1&o)<<31,o<128)return toNum(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function toNum(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function readUtf8(e,t,r){let n="",i=t;for(;i<r;){const t=e[i];let o,s,a,l=null,c=t>239?4:t>223?3:t>191?2:1;if(i+c>r)break;1===c?t<128&&(l=t):2===c?(o=e[i+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(l=(15&t)<<12|(63&o)<<6|63&s,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&t)<<18|(63&o)<<12|(63&s)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=c}return n}var MVT=class extends FeatureFormat{constructor(e){super(),e=e||{},this.dataProjection=new Projection({code:"",units:"tile-pixels"}),this.featureClass=e.featureClass?e.featureClass:RenderFeature,this.geometryName_=e.geometryName,this.layerName_=e.layerName?e.layerName:"layer",this.layers_=e.layers?e.layers:null,this.idProperty_=e.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(e,t,r,n){e.pos=t.geometry;const i=e.readVarint()+e.pos;let o=1,s=0,a=0,l=0,c=0,u=0;for(;e.pos<i;){if(!s){const t=e.readVarint();o=7&t,s=t>>3}if(s--,1===o||2===o)a+=e.readSVarint(),l+=e.readSVarint(),1===o&&c>u&&(n.push(c),u=c),r.push(a,l),c+=2;else{if(7!==o)throw new Error("Invalid command found in the PBF");c>u&&(r.push(r[u],r[u+1]),c+=2)}}c>u&&(n.push(c),u=c)}createFeature_(e,t,r){const n=t.type;if(0===n)return null;let i;const o=t.properties;let s;this.idProperty_?(s=o[this.idProperty_],delete o[this.idProperty_]):s=t.id,o[this.layerName_]=t.layer.name;const a=[],l=[];this.readRawGeometry_(e,t,a,l);const c=getGeometryType(n,l.length);if(this.featureClass===RenderFeature)i=new this.featureClass(c,a,l,2,o,s),i.transform(r.dataProjection);else{let e;if("Polygon"==c){const t=inflateEnds(a,l);e=t.length>1?new MultiPolygon(a,"XY",t):new Polygon(a,"XY",l)}else e="Point"===c?new Point(a,"XY"):"LineString"===c?new LineString(a,"XY"):"MultiPoint"===c?new MultiPoint(a,"XY"):"MultiLineString"===c?new MultiLineString(a,"XY",l):null;i=new(0,this.featureClass),this.geometryName_&&i.setGeometryName(this.geometryName_);const t=transformGeometryWithOptions(e,!1,r);i.setGeometry(t),void 0!==s&&i.setId(s),i.setProperties(o,!0)}return i}getType(){return"arraybuffer"}readFeatures(e,t){const r=this.layers_,n=get$2((t=this.adaptOptions(t)).dataProjection);n.setWorldExtent(t.extent),t.dataProjection=n;const i=new PbfReader(e),o=i.readFields(layersPBFReader,{}),s=[];for(const a in o){if(r&&!r.includes(a))continue;const e=o[a],l=e?[0,0,e.extent,e.extent]:null;n.setExtent(l);for(let r=0,n=e.length;r<n;++r){const n=readRawFeature(i,e,r),o=this.createFeature_(i,n,t);null!==o&&s.push(o)}}return s}readProjection(e){return this.dataProjection}setLayers(e){this.layers_=e}};function layersPBFReader(e,t,r){if(3===e){const e={keys:[],values:[],features:[]},n=r.readVarint()+r.pos;r.readFields(layerPBFReader,e,n),e.length=e.features.length,e.length&&(t[e.name]=e)}}function layerPBFReader(e,t,r){if(15===e)t.version=r.readVarint();else if(1===e)t.name=r.readString();else if(5===e)t.extent=r.readVarint();else if(2===e)t.features.push(r.pos);else if(3===e)t.keys.push(r.readString());else if(4===e){let n=null;const i=r.readVarint()+r.pos;for(;r.pos<i;)n=1==(e=r.readVarint()>>3)?r.readString():2===e?r.readFloat():3===e?r.readDouble():4===e?r.readVarint(!0):5===e?r.readVarint():6===e?r.readSVarint():7===e?r.readBoolean():null;t.values.push(n)}}function featurePBFReader(e,t,r){if(1==e)t.id=r.readVarint();else if(2==e){const e=r.readVarint()+r.pos;for(;r.pos<e;){const e=t.layer.keys[r.readVarint()],n=t.layer.values[r.readVarint()];t.properties[e]=n}}else 3==e?t.type=r.readVarint():4==e&&(t.geometry=r.pos)}function readRawFeature(e,t,r){e.pos=t.features[r];const n=e.readVarint()+e.pos,i={layer:t,type:0,properties:{}};return e.readFields(featurePBFReader,i,n),i}function getGeometryType(e,t){let r;return 1===e?r=1===t?"Point":"MultiPoint":2===e?r=1===t?"LineString":"MultiLineString":3===e&&(r="Polygon"),r}var Tile=class extends Target{constructor(e,t,r){super(),r=r||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=void 0===r.transition?250:r.transition,this.transitionStarts_={},this.interpolate=!!r.interpolate}changed(){this.dispatchEvent(EventType_default$2.CHANGE)}release(){this.setState(TileState_default.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==TileState_default.EMPTY){if(this.state!==TileState_default.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){abstract()}getAlpha(e,t){if(!this.transition_)return 1;let r=this.transitionStarts_[e];if(r){if(-1===r)return 1}else r=t,this.transitionStarts_[e]=r;const n=t-r+1e3/60;return n>=this.transition_?1:easeIn(n/this.transition_)}inTransition(e){return!!this.transition_&&-1!==this.transitionStarts_[e]}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}};function asImageLike(e){return e instanceof Image||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageBitmap?e:null}var disposedError=new Error("disposed"),defaultSize=[256,256],DataTile=class extends Tile{constructor(e){const t=TileState_default.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;const e=asImageLike(this.data_);return e?[e.width,e.height]:defaultSize}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==TileState_default.IDLE&&this.state!==TileState_default.ERROR)return;this.state=TileState_default.LOADING,this.changed();const e=this;this.loader_().then(function(t){e.data_=t,e.state=TileState_default.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=TileState_default.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(disposedError),this.controller_=null),super.disposeInternal()}},ImageTile=class extends Tile{constructor(e,t,r,n,i,o){super(e,t,o),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=r,this.key=r,this.image_,WORKER_OFFSCREEN_CANVAS?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=i}getImage(){return this.image_}setImage(e){this.image_=e,this.state=TileState_default.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=TileState_default.ERROR,this.unlistenImage_(),this.image_=getBlankImage(),this.changed()}handleImageLoad_(){if(WORKER_OFFSCREEN_CANVAS)this.state=TileState_default.LOADED;else{const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=TileState_default.LOADED:this.state=TileState_default.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==TileState_default.ERROR&&(this.state=TileState_default.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==TileState_default.IDLE&&(this.state=TileState_default.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=listenImage(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()}};function getBlankImage(){const e=createCanvasContext2D(1,1);return e.fillStyle="rgba(0,0,0,0)",e.fillRect(0,0,1,1),e.canvas}var TileRange=class{constructor(e,t,r,n){this.minX=e,this.maxX=t,this.minY=r,this.maxY=n}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}},brokenDiagonalRendering_;function createOrUpdate$1(e,t,r,n,i){return void 0!==i?(i.minX=e,i.maxX=t,i.minY=r,i.maxY=n,i):new TileRange(e,t,r,n)}var canvasPool$1=[];function drawTestTriangle(e,t,r,n,i){e.beginPath(),e.moveTo(0,0),e.lineTo(t,r),e.lineTo(n,i),e.closePath(),e.save(),e.clip(),e.fillRect(0,0,Math.max(t,n)+1,Math.max(r,i)),e.restore()}function verifyBrokenDiagonalRendering(e,t){return Math.abs(e[4*t]-210)>2||Math.abs(e[4*t+3]-191.25)>2}function isBrokenDiagonalRendering(){if(void 0===brokenDiagonalRendering_){const e=createCanvasContext2D(6,6,canvasPool$1);e.globalCompositeOperation="lighter",e.fillStyle="rgba(210, 0, 0, 0.75)",drawTestTriangle(e,4,5,4,0),drawTestTriangle(e,4,5,0,5);const t=e.getImageData(0,0,3,3).data;brokenDiagonalRendering_=verifyBrokenDiagonalRendering(t,0)||verifyBrokenDiagonalRendering(t,4)||verifyBrokenDiagonalRendering(t,8),releaseCanvas(e),canvasPool$1.push(e.canvas)}return brokenDiagonalRendering_}function calculateSourceResolution(e,t,r,n){const i=transform(r,t,e);let o=getPointResolution(t,n,r);const s=t.getMetersPerUnit();void 0!==s&&(o*=s);const a=e.getMetersPerUnit();void 0!==a&&(o/=a);const l=e.getExtent();if(!l||containsCoordinate(l,i)){const t=getPointResolution(e,o,i)/o;isFinite(t)&&t>0&&(o/=t)}return o}function calculateSourceExtentResolution(e,t,r,n){let i=calculateSourceResolution(e,t,getCenter(r),n);return(!isFinite(i)||i<=0)&&forEachCorner(r,function(r){return i=calculateSourceResolution(e,t,r,n),isFinite(i)&&i>0}),i}function render(e,t,r,n,i,o,s,a,l,c,u,h,d,p){const f=createCanvasContext2D(Math.round(r*e),Math.round(r*t),canvasPool$1);if(h||(f.imageSmoothingEnabled=!1),0===l.length)return f.canvas;function g(e){return Math.round(e*r)/r}f.scale(r,r),f.globalCompositeOperation="lighter";const m=createEmpty();let y;l.forEach(function(e){extend$1(m,e.extent)});const v=r/n,_=(h?1:1+Math.pow(2,-24))/v;if(!d||1!==l.length||0!==c){if(y=createCanvasContext2D(Math.round(getWidth(m)*v),Math.round(getHeight(m)*v),canvasPool$1),h||(y.imageSmoothingEnabled=!1),i&&p){const e=(i[0]-m[0])*v,t=-(i[3]-m[3])*v,r=getWidth(i)*v,n=getHeight(i)*v;y.rect(e,t,r,n),y.clip()}l.forEach(function(e){if(e.image.width>0&&e.image.height>0){if(e.clipExtent){y.save();const t=(e.clipExtent[0]-m[0])*v,r=-(e.clipExtent[3]-m[3])*v,n=getWidth(e.clipExtent)*v,i=getHeight(e.clipExtent)*v;y.rect(h?t:Math.round(t),h?r:Math.round(r),h?n:Math.round(t+n)-Math.round(t),h?i:Math.round(r+i)-Math.round(r)),y.clip()}const t=(e.extent[0]-m[0])*v,r=-(e.extent[3]-m[3])*v,n=getWidth(e.extent)*v,i=getHeight(e.extent)*v;y.drawImage(e.image,c,c,e.image.width-2*c,e.image.height-2*c,h?t:Math.round(t),h?r:Math.round(r),h?n:Math.round(t+n)-Math.round(t),h?i:Math.round(r+i)-Math.round(r)),e.clipExtent&&y.restore()}})}const b=getTopLeft(s);return a.getTriangles().forEach(function(e){const t=e.source,r=e.target;let n=t[0][0],i=t[0][1],s=t[1][0],a=t[1][1],c=t[2][0],u=t[2][1];const d=g((r[0][0]-b[0])/o),p=g(-(r[0][1]-b[1])/o),v=g((r[1][0]-b[0])/o),E=g(-(r[1][1]-b[1])/o),w=g((r[2][0]-b[0])/o),C=g(-(r[2][1]-b[1])/o),S=n,T=i;n=0,i=0,s-=S,a-=T,c-=S,u-=T;const x=solveLinearSystem([[s,a,0,0,v-d],[c,u,0,0,w-d],[0,0,s,a,E-p],[0,0,c,u,C-p]]);if(!x)return;if(f.save(),f.beginPath(),isBrokenDiagonalRendering()||!h){f.moveTo(v,E);const e=4,t=d-v,r=p-E;for(let n=0;n<e;n++)f.lineTo(v+g((n+1)*t/e),E+g(n*r/3)),3!=n&&f.lineTo(v+g((n+1)*t/e),E+g((n+1)*r/3));f.lineTo(w,C)}else f.moveTo(v,E),f.lineTo(d,p),f.lineTo(w,C);let R;if(f.clip(),f.transform(x[0],x[2],x[1],x[3],d,p),f.translate(m[0]-S,m[3]-T),y)R=y.canvas,f.scale(_,-_);else{const e=l[0],t=e.extent;R=e.image,f.scale(getWidth(t)/R.width,-getHeight(t)/R.height)}f.drawImage(R,0,0),f.restore()}),y&&(releaseCanvas(y),canvasPool$1.push(y.canvas)),u&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(e){const t=e.target,r=(t[0][0]-b[0])/o,n=-(t[0][1]-b[1])/o,i=(t[1][0]-b[0])/o,s=-(t[1][1]-b[1])/o,a=(t[2][0]-b[0])/o,l=-(t[2][1]-b[1])/o;f.beginPath(),f.moveTo(i,s),f.lineTo(r,n),f.lineTo(a,l),f.closePath(),f.stroke()}),f.restore()),f.canvas}var MAX_SUBDIVISION=10,MAX_TRIANGLE_WIDTH=.25,Triangulation=class{constructor(e,t,r,n,i,o,s){this.sourceProj_=e,this.targetProj_=t;let a={};const l=s?createTransformFromCoordinateTransform(e=>apply$1(s,transform(e,this.targetProj_,this.sourceProj_))):getTransform(this.targetProj_,this.sourceProj_);this.transformInv_=function(e){const t=e[0]+"/"+e[1];return a[t]||(a[t]=l(e)),a[t]},this.maxSourceExtent_=n,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&getWidth(n)>=getWidth(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?getWidth(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?getWidth(this.targetProj_.getExtent()):null;const c=getTopLeft(r),u=getTopRight(r),h=getBottomRight(r),d=getBottomLeft(r),p=this.transformInv_(c),f=this.transformInv_(u),g=this.transformInv_(h),m=this.transformInv_(d),y=MAX_SUBDIVISION+(o?Math.max(0,Math.ceil(Math.log2(getArea(r)/(o*o*256*256)))):0);if(this.addQuad_(c,u,h,d,p,f,g,m,y),this.wrapsXInSource_){let e=1/0;this.triangles_.forEach(function(t){e=Math.min(e,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(t=>{if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-e>this.sourceWorldWidth_/2){const r=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];r[0][0]-e>this.sourceWorldWidth_/2&&(r[0][0]-=this.sourceWorldWidth_),r[1][0]-e>this.sourceWorldWidth_/2&&(r[1][0]-=this.sourceWorldWidth_),r[2][0]-e>this.sourceWorldWidth_/2&&(r[2][0]-=this.sourceWorldWidth_);const n=Math.min(r[0][0],r[1][0],r[2][0]);Math.max(r[0][0],r[1][0],r[2][0])-n<this.sourceWorldWidth_/2&&(t.source=r)}})}a={}}addTriangle_(e,t,r,n,i,o){this.triangles_.push({source:[n,i,o],target:[e,t,r]})}addQuad_(e,t,r,n,i,o,s,a,l){const c=boundingExtent([i,o,s,a]),u=this.sourceWorldWidth_?getWidth(c)/this.sourceWorldWidth_:null,h=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&u>.5&&u<1;let p=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(p=getWidth(boundingExtent([e,t,r,n]))/this.targetWorldWidth_>MAX_TRIANGLE_WIDTH||p),!d&&this.sourceProj_.isGlobal()&&u&&(p=u>MAX_TRIANGLE_WIDTH||p)),!p&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!intersects$1(c,this.maxSourceExtent_))return;let f=0;if(!(p||isFinite(i[0])&&isFinite(i[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)p=!0;else if(f=(isFinite(i[0])&&isFinite(i[1])?0:8)+(isFinite(o[0])&&isFinite(o[1])?0:4)+(isFinite(s[0])&&isFinite(s[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 t=[(e[0]+r[0])/2,(e[1]+r[1])/2],n=this.transformInv_(t);let o;o=d?(modulo(i[0],h)+modulo(s[0],h))/2-modulo(n[0],h):(i[0]+s[0])/2-n[0];const a=(i[1]+s[1])/2-n[1];p=o*o+a*a>this.errorThresholdSquared_}if(p){if(Math.abs(e[0]-r[0])<=Math.abs(e[1]-r[1])){const c=[(t[0]+r[0])/2,(t[1]+r[1])/2],u=this.transformInv_(c),h=[(n[0]+e[0])/2,(n[1]+e[1])/2],d=this.transformInv_(h);this.addQuad_(e,t,c,h,i,o,u,d,l-1),this.addQuad_(h,c,r,n,d,u,s,a,l-1)}else{const c=[(e[0]+t[0])/2,(e[1]+t[1])/2],u=this.transformInv_(c),h=[(r[0]+n[0])/2,(r[1]+n[1])/2],d=this.transformInv_(h);this.addQuad_(e,c,h,n,i,u,d,a,l-1),this.addQuad_(c,t,r,h,u,o,s,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(e,r,n,i,s,a),14&f||this.addTriangle_(e,r,t,i,s,o),f&&(13&f||this.addTriangle_(t,n,e,o,a,i),7&f||this.addTriangle_(t,n,r,o,a,s))}calculateSourceExtent(){const e=createEmpty();return this.triangles_.forEach(function(t){const r=t.source;extendCoordinate(e,r[0]),extendCoordinate(e,r[1]),extendCoordinate(e,r[2])}),e}getTriangles(){return this.triangles_}},ERROR_THRESHOLD=.5,ReprojTile=class extends Tile{constructor(e,t,r,n,i,o,s,a,l,c,u,h){super(i,TileState_default.IDLE,h),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=s,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=n,this.wrappedTileCoord_=o||i,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const g=p?getIntersection(d,p):d;if(0===getArea(g))return void(this.state=TileState_default.EMPTY);const m=e.getExtent();m&&(f=f?getIntersection(f,m):m);const y=n.getResolution(this.wrappedTileCoord_[0]),v=calculateSourceExtentResolution(e,r,g,y);if(!isFinite(v)||v<=0)return void(this.state=TileState_default.EMPTY);const _=void 0!==c?c:ERROR_THRESHOLD;if(this.triangulation_=new Triangulation(e,r,g,f,v*_,y),0===this.triangulation_.getTriangles().length)return void(this.state=TileState_default.EMPTY);this.sourceZ_=t.getZForResolution(v);let b=this.triangulation_.calculateSourceExtent();if(f&&(e.canWrapX()?(b[1]=clamp$1(b[1],f[1],f[3]),b[3]=clamp$1(b[3],f[1],f[3])):b=getIntersection(b,f)),getArea(b)){let r=0,n=0;e.canWrapX()&&(r=getWidth(m),n=Math.floor((b[0]-m[0])/r)),wrapAndSliceX(b.slice(),e,!0).forEach(e=>{const i=t.getTileRangeForExtentAndZ(e,this.sourceZ_);for(let t=i.minX;t<=i.maxX;t++)for(let e=i.minY;e<=i.maxY;e++){const i=n*r;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,s),offset:i})}++n}),0===this.sourceTiles_.length&&(this.state=TileState_default.EMPTY)}else this.state=TileState_default.EMPTY}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{const r=t.tile;if(r&&r.getState()==TileState_default.LOADED){const n=this.sourceTileGrid_.getTileCoordExtent(r.tileCoord);n[0]+=t.offset,n[2]+=t.offset;const i=this.clipExtent_?.slice();i&&(i[0]+=t.offset,i[2]+=t.offset),e.push({extent:n,clipExtent:i,image:r.getImage()})}}),this.sourceTiles_.length=0,0===e.length)this.state=TileState_default.ERROR;else{const t=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(t),n="number"==typeof r?r:r[0],i="number"==typeof r?r:r[1],o=this.targetTileGrid_.getResolution(t),s=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=render(n,i,this.pixelRatio_,s,this.sourceTileGrid_.getExtent(),o,a,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=TileState_default.LOADED}this.changed()}load(){for(const e of this.sourceTiles_)e.tile=e.getTile();if(this.state==TileState_default.IDLE){this.state=TileState_default.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const r=t.getState();if(r==TileState_default.IDLE||r==TileState_default.LOADING){e++;const r=listen(t,EventType_default$2.CHANGE,()=>{const n=t.getState();n!=TileState_default.LOADED&&n!=TileState_default.ERROR&&n!=TileState_default.EMPTY||(unlistenByKey(r),e--,0===e&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),0===e?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e}){e.getState()==TileState_default.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(unlistenByKey),this.sourcesListenerKeys_=null}release(){this.canvas_&&(releaseCanvas(this.canvas_.getContext("2d")),canvasPool$1.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},LRUCache=class{constructor(e){this.highWaterMark=void 0!==e?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const e=this.pop();e instanceof Disposable&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const r=this.entries_[e];return assert$1(void 0!==r,"Tried to get a value for a key that does not exist in the cache"),r===this.newest_||(r===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(r.newer.older=r.older,r.older.newer=r.newer),r.newer=null,r.older=this.newest_,this.newest_.newer=r,this.newest_=r),r.value_}remove(e){const t=this.entries_[e];return assert$1(void 0!==t,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t,r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.key_;return e}getValues(){const e=new Array(this.count_);let t,r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){assert$1(!(e in this.entries_),"Tried to set a value for a key that is used already");const r={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=r:this.oldest_=r,this.newest_=r,this.entries_[e]=r,++this.count_}setSize(e){this.highWaterMark=e}};function createOrUpdate(e,t,r,n){return void 0!==n?(n[0]=e,n[1]=t,n[2]=r,n):[e,t,r]}function getKeyZXY(e,t,r){return e+"/"+t+"/"+r}function getCacheKey(e,t,r,n,i){return`${getUid(e)},${t},${getKeyZXY(r,n,i)}`}function hash$1(e){return hashZXY(e[0],e[1],e[2])}function hashZXY(e,t,r){return(t<<e)+r}function withinExtentAndZ(e,t){const r=e[0],n=e[1],i=e[2];if(t.getMinZoom()>r||r>t.getMaxZoom())return!1;const o=t.getFullTileRange(r);return!o||o.containsXY(n,i)}function addTileToLookup(e,t,r){if(!(r in e))return e[r]=new Set([t]),!0;const n=e[r],i=n.has(t);return i||n.add(t),!i}function removeTileFromLookup(e,t,r){const n=e[r];return!!n&&n.delete(t)}function getRenderExtent(e,t){const r=e.layerStatesArray[e.layerIndex];r.extent&&(t=getIntersection(t,fromUserExtent(r.extent,e.viewState.projection)));const n=r.layer.getRenderSource();if(!n.getWrapX()){const r=n.getTileGridForProjection(e.viewState.projection).getExtent();r&&(t=getIntersection(t,r))}return t}var CanvasTileLayerRenderer=class extends CanvasLayerRenderer{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=createEmpty(),this.tempTileRange_=new TileRange(0,0,0,0),this.tempTileCoord_=createOrUpdate(0,0,0);const r=void 0!==t.cacheSize?t.cacheSize:512;this.tileCache_=new LRUCache(r),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*r}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new LRUCache(512)),this.sourceTileCache_}getOrCreateTile(e,t,r,n){const i=this.tileCache_,o=this.getLayer().getSource(),s=getCacheKey(o,o.getKey(),e,t,r);let a;if(i.containsKey(s))a=i.get(s);else{const l=n.viewState.projection,c=o.getProjection();if(a=o.getTile(e,t,r,n.pixelRatio,l,!c||equivalent$1(c,l)?void 0:this.getSourceTileCache()),!a)return null;i.set(s,a)}return a}getTile(e,t,r,n){return this.getOrCreateTile(e,t,r,n)||null}getData(e){const t=this.frameState;if(!t)return null;const r=this.getLayer(),n=apply$1(t.pixelToCoordinateTransform,e.slice()),i=r.getExtent();if(i&&!containsCoordinate(i,n))return null;const o=t.viewState,s=r.getRenderSource(),a=s.getTileGridForProjection(o.projection),l=s.getTilePixelRatio(t.pixelRatio);for(let c=a.getZForResolution(o.resolution);c>=a.getMinZoom();--c){const e=a.getTileCoordForCoordAndZ(n,c),r=this.getTile(c,e[1],e[2],t);if(!r||r.getState()!==TileState_default.LOADED)continue;const i=a.getOrigin(c),u=toSize(a.getTileSize(c)),h=a.getResolution(c);let d;if(r instanceof ImageTile||r instanceof ReprojTile)d=r.getImage();else{if(!(r instanceof DataTile))continue;if(d=asImageLike(r.getData()),!d)continue}const p=Math.floor(l*((n[0]-i[0])/h-e[1]*u[0])),f=Math.floor(l*((i[1]-n[1])/h-e[2]*u[1])),g=Math.round(l*s.getGutterForProjection(o.projection));return this.getImageData(d,p+g,f+g)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;const t=this.getLayer().getSource();if(!t)return!1;const r=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==r&&(this.renderedSourceRevision_=r,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=r,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,r,n,i){const o=e.viewState,s=this.getLayer(),a=s.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=getUid(a);c in e.wantedTiles||(e.wantedTiles[c]={});const u=e.wantedTiles[c],h=s.getMapInternal(),d=Math.max(r-i,l.getMinZoom(),l.getZForResolution(Math.min(s.getMaxResolution(),h?h.getView().getResolutionForZoom(Math.max(s.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),p=o.rotation,f=p?getRotatedViewport(o.center,o.resolution,p,e.size):void 0;for(let g=r;g>=d;--g){const r=l.getTileRangeForExtentAndZ(t,g,this.tempTileRange_),i=l.getResolution(g);for(let t=r.minX;t<=r.maxX;++t)for(let o=r.minY;o<=r.maxY;++o){if(p&&!l.tileCoordIntersectsViewport([g,t,o],f))continue;const r=this.getTile(g,t,o,e);if(!r)continue;if(!addTileToLookup(n,r,g))continue;const s=r.getKey();if(u[s]=!0,r.getState()===TileState_default.IDLE&&!e.tileQueue.isKeyQueued(s)){const n=createOrUpdate(g,t,o,this.tempTileCoord_);e.tileQueue.enqueue([r,c,l.getTileCoordCenter(n),i])}}}}findStaleTile_(e,t){const r=this.tileCache_,n=e[0],i=e[1],o=e[2],s=this.getStaleKeys();for(let a=0;a<s.length;++a){const e=getCacheKey(this.getLayer().getSource(),s[a],n,i,o);if(r.containsKey(e)){const i=r.peek(e);if(i.getState()===TileState_default.LOADED)return i.endTransition(getUid(this)),addTileToLookup(t,i,n),!0}}return!1}findAltTiles_(e,t,r,n){const i=e.getTileRangeForTileCoordAndZ(t,r,this.tempTileRange_);if(!i)return!1;let o=!0;const s=this.tileCache_,a=this.getLayer().getRenderSource(),l=a.getKey();for(let c=i.minX;c<=i.maxX;++c)for(let e=i.minY;e<=i.maxY;++e){const t=getCacheKey(a,l,r,c,e);let i=!1;if(s.containsKey(t)){const e=s.peek(t);e.getState()===TileState_default.LOADED&&(addTileToLookup(n,e,r),i=!0)}i||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;const r=e.layerStatesArray[e.layerIndex],n=e.viewState,i=n.projection,o=n.resolution,s=n.center,a=e.pixelRatio,l=this.getLayer(),c=l.getSource(),u=c.getTileGridForProjection(i),h=u.getZForResolution(o,c.zDirection),d=u.getResolution(h);this.updateStaleKeys(c.getKey());let p=e.extent;const f=c.getTilePixelRatio(a);this.prepareContainer(e,t);const g=this.context.canvas.width,m=this.context.canvas.height;this.layerExtent=r.extent?fromUserExtent(r.extent,i):null,this.layerExtent&&(p=getIntersection(p,this.layerExtent));const y=d*g/2/f,v=d*m/2/f,_=[s[0]-y,s[1]-v,s[0]+y,s[1]+v],b={};this.renderedTiles.length=0;const E=l.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){const t=u.getZForResolution(n.nextResolution,c.zDirection),r=getRenderExtent(e,e.nextExtent);this.enqueueTiles(e,r,t,b,E)}const w=getRenderExtent(e,p);if(this.enqueueTiles(e,w,h,b,0),E>0&&setTimeout(()=>{this.enqueueTiles(e,w,h-1,b,E-1)},0),!(h in b))return this.container;const C=getUid(this),S=e.time;for(const P of b[h]){const t=P.getState();if(t===TileState_default.EMPTY)continue;const r=P.tileCoord;if(t===TileState_default.LOADED&&1===P.getAlpha(C,S)){P.endTransition(C);continue}if(t!==TileState_default.ERROR&&(this.renderComplete=!1),this.findStaleTile_(r,b)){removeTileFromLookup(b,P,h),e.animate=!0;continue}if(this.findAltTiles_(u,r,h+1,b))continue;const n=u.getMinZoom();for(let e=h-1;e>=n&&!this.findAltTiles_(u,r,e,b);--e);}const T=d/o*a/f,x=this.getRenderContext(e);compose(this.tempTransform,g/2,m/2,T,T,0,-g/2,-m/2),this.layerExtent&&this.clipUnrotated(x,e,this.layerExtent),c.getInterpolate()||(x.imageSmoothingEnabled=!1),this.preRender(x,e);const R=Object.keys(b).map(Number);R.sort(ascending);const A=[],I=[],k=[];for(let P=R.length-1;P>=0;--P){const t=R[P],r=c.getTilePixelSize(t,a,i),n=u.getResolution(t)/d,o=r[0]*n*T,s=r[1]*n*T,l=u.getTileCoordForCoordAndZ(getTopLeft(_),t),p=u.getTileCoordExtent(l),g=apply$1(this.tempTransform,[f*(p[0]-_[0])/d,f*(_[3]-p[3])/d]),m=f*c.getGutterForProjection(i);for(const i of b[t]){if(i.getState()!==TileState_default.LOADED)continue;const r=i.tileCoord,n=l[1]-r[1],a=Math.round(g[0]-(n-1)*o),u=l[2]-r[2],d=Math.round(g[1]-(u-1)*s),p=Math.round(g[0]-n*o),f=Math.round(g[1]-u*s),y=a-p,v=d-f,_=t===h;if(_&&i.inTransition(C)){k.push({tile:i,x:p,y:f,w:y,h:v,gutter:m}),this.renderedTiles.unshift(i),this.updateUsedTiles(e.usedTiles,c,i);continue}const b=[p,f,p+y,f+v],E=[];for(let e=0,i=A.length;e<i;++e)t<I[e]&&intersects$1(b,A[e])&&E.push(A[e]);let w;E.length>0&&(w=subtractExtents(b,E)),A.push(b),I.push(t),this.drawTile(i,e,p,f,y,v,m,_,w),this.renderedTiles.unshift(i),this.updateUsedTiles(e.usedTiles,c,i)}}for(let P=0,L=k.length;P<L;++P){const{tile:t,x:r,y:n,w:i,h:o,gutter:s}=k[P];this.drawTile(t,e,r,n,i,o,s,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!equals$1(this.renderedExtent_,_),this.renderedExtent_=_,this.renderedPixelRatio=a,this.postRender(this.context,e),this.layerExtent&&x.restore(),x.imageSmoothingEnabled=!0,this.renderComplete){const t=(e,t)=>{const r=getUid(c),n=t.wantedTiles[r],i=n?Object.keys(n).length:0;this.updateCacheSize(i),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(t)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*e)}drawTile(e,t,r,n,i,o,s,a,l){let c;if(e instanceof DataTile){if(c=asImageLike(e.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(e);if(!c)return;const u=this.getRenderContext(t),h=getUid(this),d=t.layerStatesArray[t.layerIndex],p=d.opacity*(a?e.getAlpha(h,t.time):1),f=p!==u.globalAlpha;f&&(u.save(),u.globalAlpha=p);const g=c.width-2*s,m=c.height-2*s;if(l){const e=g/i,t=m/o;for(let i=0,o=l.length;i<o;++i){const o=l[i],a=o[0],h=o[1],d=o[2]-o[0],p=o[3]-o[1];u.drawImage(c,s+(a-r)*e,s+(h-n)*t,d*e,p*t,a,h,d,p)}}else u.drawImage(c,s,s,g,m,r,n,i,o);f&&u.restore(),p!==d.opacity?t.animate=!0:a&&e.endTransition(h)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,r){const n=getUid(t);n in e||(e[n]={}),e[n][r.getKey()]=!0}},TileProperty_default={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"},BaseTileLayer=class extends Layer{constructor(e){e=e||{};const t=Object.assign({},e),r=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=r,this.setPreload(void 0!==e.preload?e.preload:0),this.setUseInterimTilesOnError(void 0===e.useInterimTilesOnError||e.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(TileProperty_default.PRELOAD)}setPreload(e){this.set(TileProperty_default.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(TileProperty_default.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(TileProperty_default.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},TileLayer=class extends BaseTileLayer{constructor(e){super(e)}createRenderer(){return new CanvasTileLayerRenderer(this,{cacheSize:this.getCacheSize()})}},IMAGE_REPLAYS={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},VECTOR_REPLAYS={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]},CanvasVectorTileLayerRenderer=class extends CanvasTileLayerRenderer{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=create(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(e,t,r,n,i,o,s,a,l){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,r,n,i,o,s,a,l)}getTile(e,t,r,n){const i=this.getOrCreateTile(e,t,r,n);if(!i)return null;const o=n.viewState,s=o.resolution,a=n.viewHints,l=this.getLayer().getSource(),c=l.getTileGridForProjection(o.projection),u=!(a[ViewHint_default.ANIMATING]||a[ViewHint_default.INTERACTING]),h=c.getZForResolution(s,l.zDirection)===e;return u&&h?i.wantedResolution=s:i.wantedResolution||(i.wantedResolution=c.getResolution(e)),i}prepareFrame(e){const t=this.getLayer().getRevision();return this.renderedLayerRevision_!==t&&(this.renderedLayerRevision_=t,this.renderedTiles.length=0),super.prepareFrame(e)}updateExecutorGroup_(e,t,r){const n=this.getLayer(),i=n.getRevision(),o=n.getRenderOrder()||null,s=e.wantedResolution,a=e.getReplayState(n);if(!a.dirty&&a.renderedResolution===s&&a.renderedRevision==i&&a.renderedPixelRatio===t&&a.renderedRenderOrder==o)return;const l=n.getSource(),c=!!n.getDeclutter(),u=l.getTileGrid(),h=l.getTileGridForProjection(r).getTileCoordExtent(e.wrappedTileCoord),d=l.getSourceTiles(t,r,e),p=getUid(n);delete e.hitDetectionImageData[p],e.executorGroups[p]=[],a.dirty=!1;for(let f=0,g=d.length;f<g;++f){const i=d[f];if(i.getState()!=TileState_default.LOADED)continue;const g=l.getProjection(),m=i.tileCoord;let y=u.getTileCoordExtent(m);r&&g&&!equivalent$1(r,g)&&(y=transformExtent(y,g,r,32));const v=getIntersection(h,y),_=buffer(v,n.getRenderBuffer()*s,this.tempExtent),b=equals$1(y,v)?null:_,E=new BuilderGroup(0,v,s,t),w=getSquaredTolerance(s,t),C=function(e,t){let r;const i=e.getStyleFunction()||n.getStyleFunction();if(i&&(r=i(e,s)),r){const n=this.renderFeature(e,w,r,E,c,t);a.dirty=a.dirty||n}},S=i.getFeatures();o&&o!==a.renderedRenderOrder&&S.sort(o);for(let e=0,t=S.length;e<t;++e){let t=S[e];r&&i.projection&&!equivalent$1(r,i.projection)&&(t=t.clone(),t.getGeometry().applyTransform(getTransform(i.projection,r))),b&&!intersects$1(b,t.getGeometry().getExtent())||C.call(this,t,e)}const T=E.finish(),x="vector"!==n.getRenderMode()&&c&&1===d.length?null:v,R=new ExecutorGroup(x,s,t,l.getOverlaps(),T,n.getRenderBuffer(),!0);e.executorGroups[p].push(R)}a.renderedRevision=i,a.renderedPixelRatio=t,a.renderedRenderOrder=o,a.renderedResolution=s}forEachFeatureAtCoordinate(e,t,r,n,i){const o=t.viewState.resolution,s=t.viewState.rotation;r=null==r?0:r;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(t.viewState.projection),c=a.getRenderBuffer(),u=boundingExtent([e]);buffer(u,o*(c+r),u);const h={},d=function(e,t,r){let o=e.getId();void 0===o&&(o=getUid(e));const s=h[o];if(s){if(!0!==s&&r<s.distanceSq){if(0===r)return h[o]=!0,i.splice(i.lastIndexOf(s),1),n(e,a,t);s.geometry=t,s.distanceSq=r}}else{if(0===r)return h[o]=!0,n(e,a,t);i.push(h[o]={feature:e,layer:a,geometry:t,distanceSq:r,callback:n})}},p=this.renderedTiles,f=getUid(a),g=a.getDeclutter(),m=g?t.declutter?.[g]?.all().map(e=>e.value):null;let y;e:for(let v=p.length-1;v>=0;--v){const t=p[v];if(!intersects$1(l.getTileCoordExtent(t.wrappedTileCoord),u))continue;const n=t.executorGroups[f];for(let i=0,a=n.length;i<a;++i)if(y=n[i].forEachFeatureAtCoordinate(e,o,s,r,d,m),y)break e}return y}getFeatures(e){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise(t=>{const r=this.getLayer(),n=r.getSource(),i=this.renderedProjection,o=i.getExtent(),s=this.renderedResolution,a=n.getTileGridForProjection(i),l=apply$1(this.renderedPixelToCoordinateTransform_,e.slice()),c=a.getTileCoordForCoordAndResolution(l,s).toString(),u=this.renderedTiles.find(e=>e.tileCoord.toString()===c&&e.getState()===TileState_default.LOADED);if(!u||u.loadingSourceTiles>0)return void t([]);n.getWrapX()&&i.canWrapX()&&!containsExtent(o,a.getTileCoordExtent(u.tileCoord))&&wrapX$1(l,i);const h=getUid(r),d=getTopLeft(a.getTileCoordExtent(u.wrappedTileCoord)),p=[(l[0]-d[0])/s,(d[1]-l[1])/s],f=u.getSourceTiles().reduce((e,t)=>e.concat(t.getFeatures()),[]);let g=u.hitDetectionImageData[h];if(!g){const e=toSize(a.getTileSize(a.getZForResolution(s,n.zDirection))),t=this.renderedRotation_;g=createHitDetectionImageData(e,[this.getRenderTransform(a.getTileCoordCenter(u.wrappedTileCoord),s,0,HIT_DETECT_RESOLUTION,e[0]*HIT_DETECT_RESOLUTION,e[1]*HIT_DETECT_RESOLUTION,0)],f,r.getStyleFunction(),a.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(r).renderedResolution,t),u.hitDetectionImageData[h]=g}t(hitDetect(p,f,g))})}getFeaturesInExtent(e){const t=[],r=this.getTileCache();if(0===r.getCount())return t;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),i=n.getZForResolution(this.renderedResolution),o={};return r.forEach(r=>{if(r.tileCoord[0]!==i||r.getState()!==TileState_default.LOADED)return;const s=r.getSourceTiles();for(let i=0,a=s.length;i<a;++i){const r=s[i],a=r.getKey();if(a in o)continue;o[a]=!0;const l=r.tileCoord;if(intersects$1(e,n.getTileCoordExtent(l))){const n=r.getFeatures();if(n)for(let r=0,i=n.length;r<i;++r){const i=n[r],o=i.getGeometry();intersects$1(e,o.getExtent())&&t.push(i)}}}}),t}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&void 0!==this.renderedLayerRevision_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}renderDeclutter(e,t){const r=this.context,n=r.globalAlpha;r.globalAlpha=t.opacity;const i=e.viewHints,o=!(i[ViewHint_default.ANIMATING]||i[ViewHint_default.INTERACTING]),s=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),l=a?e.declutter?.[a]:void 0,c=getUid(this.getLayer()),u=this.renderedTiles;for(let h=0,d=u.length;h<d;++h){const t=u[h],r=t.executorGroups[c];if(r)for(let n=r.length-1;n>=0;--n)r[n].execute(this.context,s,this.getTileRenderTransform(t,e),e.viewState.rotation,o,DECLUTTER,l)}r.globalAlpha=n}renderDeferredInternal(e){const t=this.renderedTiles,r=getUid(this.getLayer()),n=t.reduce((e,t,n)=>(t.executorGroups[r].forEach(t=>e.push({executorGroup:t,index:n})),e),[]),i=n.map(({executorGroup:e})=>e.getDeferredZIndexContexts()),o={};for(let a=0,l=n.length;a<l;++a){const e=n[a].executorGroup.getDeferredZIndexContexts();for(const t in e)o[t]=!0}const s=Object.keys(o).map(Number).sort(ascending);this.layerExtent&&this.clipUnrotated(this.context,e,this.layerExtent),s.forEach(e=>{i.forEach((t,r)=>{t[e]&&(t[e].forEach(e=>{const{executorGroup:t,index:i}=n[r],o=t.getRenderedContext(),s=o.globalAlpha;o.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[i];a&&a.draw(o),e.draw(o),a&&o.restore(),o.globalAlpha=s,e.clear()}),t[e].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(e,t){const r=t.pixelRatio,n=t.viewState,i=n.center,o=n.resolution,s=n.rotation,a=t.size,l=Math.round(a[0]*r),c=Math.round(a[1]*r),u=this.getLayer().getSource().getTileGridForProjection(t.viewState.projection),h=e.tileCoord,d=u.getTileCoordExtent(e.wrappedTileCoord),p=u.getTileCoordExtent(h,this.tempExtent)[0]-d[0];return multiply(scale$2(this.inversePixelTransform.slice(),1/r,1/r),this.getRenderTransform(i,o,s,r,l,c,p))}clipTileContext_(e,t,r,n,i,o){const s=[];for(let l=0,c=r.length;l<c;++l)i<n[l]&&intersects$1(t,r[l])&&s.push(r[l]);if(0===s.length)return!1;const a=subtractExtents(t,s);e.save(),e.beginPath();for(let l=0,c=a.length;l<c;++l){const t=a[l],r=apply$1(o,[t[0],t[1]]),n=apply$1(o,[t[0],t[3]]),i=apply$1(o,[t[2],t[3]]),s=apply$1(o,[t[2],t[1]]);e.moveTo(r[0],r[1]),e.lineTo(n[0],n[1]),e.lineTo(i[0],i[1]),e.lineTo(s[0],s[1]),e.closePath()}return e.clip(),!0}postRender(e,t){const r=t.viewHints,n=!(r[ViewHint_default.ANIMATING]||r[ViewHint_default.INTERACTING]);this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.renderedRotation_=t.viewState.rotation,this.renderedOpacity_=t.layerStatesArray[t.layerIndex].opacity;const i=this.getLayer(),o=i.getRenderMode(),s=e.globalAlpha;e.globalAlpha=this.renderedOpacity_;const a=i.getDeclutter(),l=a?VECTOR_REPLAYS[o].filter(e=>!DECLUTTER.includes(e)):VECTOR_REPLAYS[o],c=t.viewState,u=c.rotation;this.layerExtent&&this.clipUnrotated(e,t,this.layerExtent);const h=i.getSource(),d=h.getTileGridForProjection(c.projection).getZForResolution(c.resolution,h.zDirection),p=this.renderedTiles,f=[],g=[],m=[],y=getUid(i);let v=!0;for(let _=p.length-1;_>=0;--_){const r=p[_];v=v&&!r.getReplayState(i).dirty;const o=r.executorGroups[y].filter(e=>e.hasExecutors(l));if(0===o.length)continue;const s=this.getTileRenderTransform(r,t),c=r.tileCoord[0];let h=!1;const b=o[0].getClipCoords(IDENTITY_TRANSFORM);let E,w=e;if(b){const e=[b[0],b[1],b[4],b[5]];E=new ZIndexContext,w=E.getContext(),d!==c&&(h=this.clipTileContext_(w,e,f,g,c,s)),f.push(e),g.push(c)}for(let i=0,d=o.length;i<d;++i)o[i].execute(e,[e.canvas.width,e.canvas.height],s,u,n,l,t.declutter?.[a]);h&&(w===e?w.restore():m[_]=E)}this.layerExtent&&e.restore(),e.globalAlpha=s,this.ready=v,this.tileClipContexts_=m,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,r,n,i,o){if(!r)return!1;let s=!1;if(Array.isArray(r))for(let a=0,l=r.length;a<l;++a)s=renderFeature$1(n,e,r[a],t,this.boundHandleStyleImageChange_,void 0,i,o)||s;else s=renderFeature$1(n,e,r,t,this.boundHandleStyleImageChange_,void 0,i,o);return s}tileImageNeedsRender_(e){const t=this.getLayer();if("vector"===t.getRenderMode())return!1;const r=e.getReplayState(t),n=t.getRevision(),i=e.wantedResolution;return r.renderedTileResolution!==i||r.renderedTileRevision!==n}renderTileImage_(e,t){const r=this.getLayer(),n=e.getReplayState(r),i=r.getRevision(),o=e.executorGroups[getUid(r)];n.renderedTileRevision=i;const s=e.wrappedTileCoord,a=s[0],l=r.getSource();let c=t.pixelRatio;const u=t.viewState.projection,h=l.getTileGridForProjection(u),d=h.getResolution(e.tileCoord[0]),p=t.pixelRatio/e.wantedResolution*d,f=h.getResolution(a),g=e.getContext();c=Math.round(Math.max(c,p/c));const m=l.getTilePixelSize(a,c,u);g.canvas.width=m[0],g.canvas.height=m[1];const y=c/p;if(1!==y){const e=reset(this.tmpTransform_);scale$2(e,y,y),g.setTransform.apply(g,e)}const v=h.getTileCoordExtent(s,this.tempExtent),_=p/f,b=reset(this.tmpTransform_);scale$2(b,_,-_),translate$1(b,-v[0],-v[3]);for(let E=0,w=o.length;E<w;++E)o[E].execute(g,[g.canvas.width*y,g.canvas.height*y],b,0,!0,IMAGE_REPLAYS[r.getRenderMode()],null);n.renderedTileResolution=e.wantedResolution}},VectorTileLayer=class extends BaseVectorLayer{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload;const r=void 0===e.cacheSize?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=r;const n=e.renderMode||"hybrid";assert$1("hybrid"==n||"vector"==n,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=n,this.setPreload(e.preload?e.preload:0),this.setUseInterimTilesOnError(void 0===e.useInterimTilesOnError||e.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new CanvasVectorTileLayerRenderer(this,{cacheSize:this.cacheSize_})}getFeatures(e){return super.getFeatures(e)}getFeaturesInExtent(e){return this.getRenderer().getFeaturesInExtent(e)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(TileProperty_default.PRELOAD)}getUseInterimTilesOnError(){return this.get(TileProperty_default.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(TileProperty_default.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(TileProperty_default.USE_INTERIM_TILES_ON_ERROR,e)}};function jsonp(e,t,r,n){const i=document.createElement("script"),o="olc_"+getUid(t);function s(){delete window[o],i.parentNode.removeChild(i)}i.async=!0,i.src=e+(e.includes("?")?"&":"?")+(n||"callback")+"="+o;const a=setTimeout(function(){s(),r&&r()},1e4);window[o]=function(e){clearTimeout(a),s(),t(e)},document.head.appendChild(i)}var tmpTileCoord=[0,0,0],DECIMALS=5,TileGrid=class{constructor(e){let t=e.minZoom;const r=e.resolutions;let n;if(void 0===t&&r&&(t=r.findIndex(e=>void 0!==e)),this.minZoom=void 0!==t?t:0,this.resolutions_=r,assert$1(isSorted(this.resolutions_,(e,t)=>t-e,!0),"`resolutions` must be sorted in descending order"),!e.origins)for(let o=0,s=this.resolutions_.length-1;o<s;++o)if(n){if(this.resolutions_[o]/this.resolutions_[o+1]!==n){n=void 0;break}}else n=this.resolutions_[o]/this.resolutions_[o+1];this.zoomFactor_=n,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==e.origin?e.origin:null,this.origins_=null,void 0!==e.origins&&(this.origins_=e.origins,assert$1(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=e.extent;void 0===i||this.origin_||this.origins_||(this.origin_=getTopLeft(i)),assert$1(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==e.tileSizes&&(this.tileSizes_=e.tileSizes,assert$1(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==e.tileSize?e.tileSize:this.tileSizes_?null:256,assert$1(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==i?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==e.tileRanges?this.fullTileRanges_=e.tileRanges:void 0!==e.sizes?this.fullTileRanges_=e.sizes.map((e,t)=>{const r=new TileRange(Math.min(0,e[0]),Math.max(e[0]-1,-1),Math.min(0,e[1]),Math.max(e[1]-1,-1));if(i){const e=this.getTileRangeForExtentAndZ(i,t);r.minX=Math.max(e.minX,r.minX),r.maxX=Math.min(e.maxX,r.maxX),r.minY=Math.max(e.minY,r.minY),r.maxY=Math.min(e.maxY,r.maxY)}return r}):i&&this.calculateTileRanges_(i)}forEachTileCoord(e,t,r){const n=this.getTileRangeForExtentAndZ(e,t);for(let i=n.minX,o=n.maxX;i<=o;++i)for(let e=n.minY,s=n.maxY;e<=s;++e)r([t,i,e])}forEachTileCoordParentTileRange(e,t,r,n){let i,o,s,a=null,l=e[0]-1;for(2===this.zoomFactor_?(o=e[1],s=e[2]):a=this.getTileCoordExtent(e,n);l>=this.minZoom;){if(void 0!==o&&void 0!==s?(o=Math.floor(o/2),s=Math.floor(s/2),i=createOrUpdate$1(o,o,s,s,r)):i=this.getTileRangeForExtentAndZ(a,l,r),t(l,i))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,r){if(e[0]<this.maxZoom){if(2===this.zoomFactor_){const r=2*e[1],n=2*e[2];return createOrUpdate$1(r,r+1,n,n+1,t)}const n=this.getTileCoordExtent(e,r||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,r){if(t>this.maxZoom||t<this.minZoom)return null;const n=e[0],i=e[1],o=e[2];if(t===n)return createOrUpdate$1(i,o,i,o,r);if(this.zoomFactor_){const e=Math.pow(this.zoomFactor_,t-n),s=Math.floor(i*e),a=Math.floor(o*e);return t<n?createOrUpdate$1(s,s,a,a,r):createOrUpdate$1(s,Math.floor(e*(i+1))-1,a,Math.floor(e*(o+1))-1,r)}const s=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t,r)}getTileRangeForExtentAndZ(e,t,r){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,tmpTileCoord);const n=tmpTileCoord[1],i=tmpTileCoord[2];return this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,tmpTileCoord),createOrUpdate$1(n,tmpTileCoord[1],i,tmpTileCoord[2],r)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),r=this.getResolution(e[0]),n=toSize(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*n[0]*r,t[1]-(e[2]+.5)*n[1]*r]}getTileCoordExtent(e,t){const r=this.getOrigin(e[0]),n=this.getResolution(e[0]),i=toSize(this.getTileSize(e[0]),this.tmpSize_),o=r[0]+e[1]*i[0]*n,s=r[1]-(e[2]+1)*i[1]*n;return createOrUpdate$2(o,s,o+i[0]*n,s+i[1]*n,t)}getTileCoordForCoordAndResolution(e,t,r){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,r)}getTileCoordForXYAndResolution_(e,t,r,n,i){const o=this.getZForResolution(r),s=r/this.getResolution(o),a=this.getOrigin(o),l=toSize(this.getTileSize(o),this.tmpSize_);let c=s*(e-a[0])/r/l[0],u=s*(a[1]-t)/r/l[1];return n?(c=ceil(c,DECIMALS)-1,u=ceil(u,DECIMALS)-1):(c=floor(c,DECIMALS),u=floor(u,DECIMALS)),createOrUpdate(o,c,u,i)}getTileCoordForXYAndZ_(e,t,r,n,i){const o=this.getOrigin(r),s=this.getResolution(r),a=toSize(this.getTileSize(r),this.tmpSize_);let l=(e-o[0])/s/a[0],c=(o[1]-t)/s/a[1];return n?(l=ceil(l,DECIMALS)-1,c=ceil(c,DECIMALS)-1):(l=floor(l,DECIMALS),c=floor(c,DECIMALS)),createOrUpdate(r,l,c,i)}getTileCoordForCoordAndZ(e,t,r){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,r)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){return clamp$1(linearFindNearest(this.resolutions_,e,t||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return intersectsLinearRing(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,r=new Array(t);for(let n=this.minZoom;n<t;++n)r[n]=this.getTileRangeForExtentAndZ(e,n);this.fullTileRanges_=r}};function getForProjection(e){let t=e.getDefaultTileGrid();return t||(t=createForProjection(e),e.setDefaultTileGrid(t)),t}function wrapX(e,t,r){const n=t[0],i=e.getTileCoordCenter(t),o=extentFromProjection(r);if(!containsCoordinate(o,i)){const t=getWidth(o),r=Math.ceil((o[0]-i[0])/t);return i[0]+=t*r,e.getTileCoordForCoordAndZ(i,n)}return t}function createForExtent(e,t,r,n){n=void 0!==n?n:"top-left";const i=resolutionsFromExtent(e,t,r);return new TileGrid({extent:e,origin:getCorner(e,n),resolutions:i,tileSize:r})}function createXYZ(e){const t=e||{},r=t.extent||get$2("EPSG:3857").getExtent(),n={extent:r,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:resolutionsFromExtent(r,t.maxZoom,t.tileSize,t.maxResolution)};return new TileGrid(n)}function resolutionsFromExtent(e,t,r,n){t=void 0!==t?t:42,r=toSize(void 0!==r?r:256);const i=getHeight(e),o=getWidth(e);n=n>0?n:Math.max(o/r[0],i/r[1]);const s=t+1,a=new Array(s);for(let l=0;l<s;++l)a[l]=n/Math.pow(2,l);return a}function createForProjection(e,t,r,n){return createForExtent(extentFromProjection(e),t,r,n)}function extentFromProjection(e){let t=(e=get$2(e)).getExtent();if(!t){const r=180*METERS_PER_UNIT$1.degrees/e.getMetersPerUnit();t=createOrUpdate$2(-r,-r,r,r)}return t}var zRegEx=/\{z\}/g,xRegEx=/\{x\}/g,yRegEx=/\{y\}/g,dashYRegEx=/\{-y\}/g;function renderXYZTemplate(e,t,r,n,i){return e.replace(zRegEx,t.toString()).replace(xRegEx,r.toString()).replace(yRegEx,n.toString()).replace(dashYRegEx,function(){if(void 0===i)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(i-n).toString()})}function expandUrl(e){const t=[];let r=/\{([a-z])-([a-z])\}/.exec(e);if(r){const n=r[1].charCodeAt(0),i=r[2].charCodeAt(0);let o;for(o=n;o<=i;++o)t.push(e.replace(r[0],String.fromCharCode(o)));return t}if(r=/\{(\d+)-(\d+)\}/.exec(e),r){const n=parseInt(r[2],10);for(let i=parseInt(r[1],10);i<=n;i++)t.push(e.replace(r[0],i.toString()));return t}return t.push(e),t}function createFromTemplate(e,t){return function(r){if(!r)return;let n;const i=r[0];if(t){const e=t.getFullTileRange(i);e&&(n=e.getHeight()-1)}return renderXYZTemplate(e,i,r[1],r[2],n)}}function createFromTemplates(e,t){const r=e.length,n=new Array(r);for(let i=0;i<r;++i)n[i]=createFromTemplate(e[i],t);return createFromTileUrlFunctions(n)}function createFromTileUrlFunctions(e){return 1===e.length?e[0]:function(t,r,n){if(!t)return;const i=hash$1(t);return e[modulo(i,e.length)](t,r,n)}}var TileSource=class extends Source{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==e.tilePixelRatio?e.tilePixelRatio:1,this.tileGrid=void 0!==e.tileGrid?e.tileGrid:null,this.tileGrid&&toSize(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=e.key||getUid(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,r,n,i,o){return abstract()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:getForProjection(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,r){const n=this.getTileGridForProjection(r),i=this.getTilePixelRatio(t),o=toSize(n.getTileSize(e),this.tmpSize);return 1==i?o:scale(o,i,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){const r=void 0!==t?t:this.getProjection(),n=void 0!==t?this.getTileGridForProjection(r):this.tileGrid||this.getTileGridForProjection(r);return this.getWrapX()&&r.isGlobal()&&(e=wrapX(n,e,r)),withinExtentAndZ(e,n)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},TileSourceEvent=class extends BaseEvent{constructor(e,t){super(e),this.tile=t}},TileEventType_default={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"},UrlTile=class e extends TileSource{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===e.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){const t=e.target,r=getUid(t),n=t.getState();let i;n==TileState_default.LOADING?(this.tileLoadingKeys_[r]=!0,i=TileEventType_default.TILELOADSTART):r in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[r],i=n==TileState_default.ERROR?TileEventType_default.TILELOADERROR:n==TileState_default.LOADED?TileEventType_default.TILELOADEND:void 0),null!=i&&this.dispatchEvent(new TileSourceEvent(i,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,void 0!==t?this.setKey(t):this.changed()}setUrl(e){const t=expandUrl(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(createFromTemplates(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,r){}},TileImage=class extends UrlTile{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:defaultTileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:void 0===e.interpolate||e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=void 0!==e.tileClass?e.tileClass:ImageTile,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!equivalent$1(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||equivalent$1(t,e)))return this.tileGrid;const r=getUid(e);return r in this.tileGridForProjection||(this.tileGridForProjection[r]=getForProjection(e)),this.tileGridForProjection[r]}createTile_(e,t,r,n,i,o){const s=[e,t,r],a=this.getTileCoordForTileUrlFunction(s,i),l=a?this.tileUrlFunction(a,n,i):void 0,c=new this.tileClass(s,void 0!==l?TileState_default.IDLE:TileState_default.EMPTY,void 0!==l?l:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(EventType_default$2.CHANGE,this.handleTileChange.bind(this)),c}getTile(e,t,r,n,i,o){const s=this.getProjection();if(!s||!i||equivalent$1(s,i))return this.getTileInternal(e,t,r,n,s||i);const a=[e,t,r],l=this.getKey(),c=this.getTileGridForProjection(s),u=this.getTileGridForProjection(i),h=this.getTileCoordForTileUrlFunction(a,i),d=new ReprojTile(s,c,i,u,a,h,this.getTilePixelRatio(n),this.getGutter(),(e,t,r,n)=>this.getTileInternal(e,t,r,n,s,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(e,t,r,n,i,o){const s=this.getKey(),a=getCacheKey(this,s,e,t,r);if(o&&o.containsKey(a))return o.get(a);const l=this.createTile_(e,t,r,n,i,s);return o?.set(a,l),l}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){const r=get$2(e);if(r){const e=getUid(r);e in this.tileGridForProjection||(this.tileGridForProjection[e]=t)}}};function defaultTileLoadFunction(e,t){if(WORKER_OFFSCREEN_CANVAS){const r=e.getCrossOrigin();let n="same-origin",i="same-origin";"anonymous"===r||""===r?(n="cors",i="omit"):"use-credentials"===r&&(n="cors",i="include");const o={mode:n,credentials:i,referrerPolicy:e.getReferrerPolicy()};return void fetch(t,o).then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.blob()}).then(e=>createImageBitmap(e)).then(t=>{const r=e.getImage();r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(t,0,0),t.close?.(),r.dispatchEvent(new Event("load"))}).catch(()=>{e.getImage().dispatchEvent(new Event("error"))})}e.getImage().src=t}var TileJSON=class extends TileImage{constructor(e){if(super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:get$2("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:e.zDirection}),this.tileJSON_=null,this.tileSize_=e.tileSize,e.url)if(e.jsonp)jsonp(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",e.url),t.send()}else{if(!e.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(e.tileJSON)}}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let e;try{e=JSON.parse(t.responseText)}catch{return void this.handleTileJSONError()}this.handleTileJSONResponse(e)}else this.handleTileJSONError()}onXHRError_(e){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(e){const t=get$2("EPSG:4326"),r=this.getProjection();let n;if(void 0!==e.bounds){const i=getTransformFromProjections(t,r);n=applyTransform(e.bounds,i)}const i=extentFromProjection(r),o=e.minzoom||0,s=createXYZ({extent:i,maxZoom:e.maxzoom||22,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=s,this.tileUrlFunction=createFromTemplates(e.tiles,s),e.attribution&&!this.getAttributions()){const t=void 0!==n?n:i;this.setAttributions(function(r){return intersects$1(t,r.extent)?[e.attribution]:null})}this.tileJSON_=e,this.setState("ready")}handleTileJSONError(){this.setState("error")}},canvasPool=[],VectorRenderTile=class extends Tile{constructor(e,t,r,n,i){super(e,t,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.removeSourceTiles_=i,this.wrappedTileCoord=r}getContext(){return this.context_||(this.context_=createCanvasContext2D(1,1,canvasPool)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(e){const t=getUid(e);return t in this.replayState_||(this.replayState_[t]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[t]}load(){this.getSourceTiles()}release(){this.context_&&(releaseCanvas(this.context_),canvasPool.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},VectorTile$1=class extends Tile{constructor(e,t,r,n,i,o){super(e,t,o),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=i,this.url_=r,this.key=r}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==TileState_default.IDLE&&(this.setState(TileState_default.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(e,t){this.setFeatures(e)}onError(){this.setState(TileState_default.ERROR)}setFeatures(e){this.features_=e,this.setState(TileState_default.LOADED)}setLoader(e){this.loader_=e}},VectorTile=class extends UrlTile{constructor(e){const t=e.projection||"EPSG:3857",r=e.extent||extentFromProjection(t),n=e.tileGrid||createXYZ({extent:r,maxResolution:e.maxResolution,maxZoom:void 0!==e.maxZoom?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,interpolate:!0,projection:t,state:e.state,tileGrid:n,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:defaultLoadFunction,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:void 0===e.zDirection?1:e.zDirection}),this.format_=e.format?e.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==e.overlaps||e.overlaps,this.tileClass=e.tileClass?e.tileClass:VectorTile$1,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceZ_(e,t,r){const n=this.projection,i=t&&n&&!equivalent$1(t,n)?e/n.getMetersPerUnit()*t.getMetersPerUnit():e;return this.tileGrid.getZForResolution(i,r)}getSourceTiles(e,t,r,n){if(r.getState()===TileState_default.IDLE){r.setState(TileState_default.LOADING);const i=r.wrappedTileCoord,o=this.getTileGridForProjection(t);let s=o.getTileCoordExtent(i);const a=i[0],l=o.getResolution(a);buffer(s,-l,s);const c=this.projection;t&&this.projection&&!equivalent$1(t,c)&&(s=transformExtent(s,t,c));const u=this.tileGrid,h=u.getExtent();h&&getIntersection(s,h,s);const d=this.getSourceZ_(l,t,this.zDirection),p=n||this.tileUrlFunction;u.forEachTileCoord(s,d,n=>{const i=p(n,e,t);this.sourceTiles_[i]||(this.sourceTiles_[i]=new this.tileClass(n,i?TileState_default.IDLE:TileState_default.EMPTY,i,this.format_,this.tileLoadFunction));const o=this.sourceTiles_[i];r.sourceTiles.push(o),this.tileKeysBySourceTileUrl_[i]||(this.tileKeysBySourceTileUrl_[i]=[]),this.tileKeysBySourceTileUrl_[i].push(r.getKey());const s=o.getState();if(s<TileState_default.LOADED){const e=t=>{this.handleTileChange(t);const n=o.getState();if(n===TileState_default.LOADED||n===TileState_default.ERROR){const t=o.getKey();t in r.errorTileKeys?o.getState()===TileState_default.LOADED&&delete r.errorTileKeys[t]:r.loadingSourceTiles--,n===TileState_default.ERROR?r.errorTileKeys[t]=!0:o.removeEventListener(EventType_default$2.CHANGE,e),0===r.loadingSourceTiles&&r.setState(isEmpty$1(r.errorTileKeys)?TileState_default.LOADED:TileState_default.ERROR)}};o.addEventListener(EventType_default$2.CHANGE,e),r.loadingSourceTiles++}s===TileState_default.IDLE&&(o.extent=u.getTileCoordExtent(n),o.projection=this.projection,o.resolution=u.getResolution(n[0]),o.load())}),r.loadingSourceTiles||r.setState(r.sourceTiles.some(e=>e.getState()===TileState_default.ERROR)?TileState_default.ERROR:TileState_default.LOADED)}return r.sourceTiles}removeSourceTiles(e){const t=e.getKey(),r=e.sourceTiles;for(let n=0,i=r.length;n<i;++n){const e=r[n].getTileUrl();if(!this.tileKeysBySourceTileUrl_[e])return;const i=this.tileKeysBySourceTileUrl_[e].indexOf(t);-1!==i&&(this.tileKeysBySourceTileUrl_[e].splice(i,1),0===this.tileKeysBySourceTileUrl_[e].length&&(delete this.tileKeysBySourceTileUrl_[e],delete this.sourceTiles_[e]))}}getTile(e,t,r,n,i){const o=[e,t,r];let s=this.getTileCoordForTileUrlFunction(o,i);const a=this.getTileGrid().getExtent(),l=this.projection,c=this.getTileGridForProjection(i);if(s&&a){const t=c.getTileCoordExtent(s);buffer(t,-c.getResolution(e),t),intersects$1(a,i&&l&&!equivalent$1(i,l)?transformExtent(t,i,l):t)||(s=null)}let u=!0;if(null!==s){const t=this.tileGrid,r=c.getResolution(e),o=this.getSourceZ_(r,i,1),a=c.getTileCoordExtent(s);buffer(a,-r,a),t.forEachTileCoord(i&&l&&!equivalent$1(i,l)?transformExtent(a,i,l):a,o,e=>{u=u&&!this.tileUrlFunction(e,n,l)})}const h=this.tileUrlFunction,d=new VectorRenderTile(o,u?TileState_default.EMPTY:TileState_default.IDLE,s,e=>this.getSourceTiles(n,i,e,h),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(e){const t=e.getCode();let r=this.tileGrids_[t];if(!r){const n=this.projection;if(null!==n&&!equivalent$1(n,e))return getForProjection(e);const i=this.tileGrid,o=i.getResolutions().slice(),s=o.map(function(e,t){return i.getOrigin(t)}),a=o.map(function(e,t){return i.getTileSize(t)}),l=43;for(let e=o.length;e<l;++e)o.push(o[e-1]/2),s.push(s[e-1]),a.push(a[e-1]);r=new TileGrid({extent:i.getExtent(),origins:s,resolutions:o,tileSizes:a}),this.tileGrids_[t]=r}return r}getTilePixelRatio(e){return e}getTilePixelSize(e,t,r){const n=toSize(this.getTileGridForProjection(r).getTileSize(e),this.tmpSize);return[Math.round(n[0]*t),Math.round(n[1]*t)]}setOverlaps(e){this.overlaps_=e,this.changed()}};function defaultLoadFunction(e,t){e.setLoader(function(r,n,i){loadFeaturesXhr(t,e.getFormat(),r,n,i,e.onLoad.bind(e),e.onError.bind(e))})}function hsla(e,t){const r=t[0].evaluate(e),n=t[1].evaluate(e),i=t[2].evaluate(e),o=t[3]?t[3].evaluate(e):1;return Color.parse(`hsla(${r}, ${n}%, ${i}%, ${o})`)}function rgbaToHsla(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=e[3],o=Math.max(t,r,n),s=Math.min(t,r,n),a=(o+s)/2;let l,c;if(o===s)l=0,c=0;else{const e=o-s;switch(c=a>.5?e/(2-o-s):e/(o+s),o){case t:l=(r-n)/e+(r<n?6:0);break;case r:l=(n-t)/e+2;break;case n:l=(t-r)/e+4;break;default:l=0}l/=6}return[360*l,100*c,100*a,i]}function wrapImageExtraArgs(e){if(Array.isArray(e)){if(0===e.length)return e;const t=e[0];if("literal"===t)return e;if("image"===t&&3===e.length&&"object"==typeof e[2]&&null!==e[2]&&!Array.isArray(e[2]))return["image-config",wrapImageExtraArgs(e[1]),["literal",e[2]]];const r=e.length;for(let n=1;n<r;++n){const i=e[n],o=wrapImageExtraArgs(i);if(o!==i){const i=[t];for(let t=1;t<n;++t)i.push(e[t]);i.push(o);for(let t=n+1;t<r;++t)i.push(wrapImageExtraArgs(e[t]));return i}}}return e}var styleConfig={},cameraObj={zoom:0,distanceFromCenter:0};CompoundExpression.register(expressions,{...CompoundExpression.definitions,pitch:[{kind:"number"},[],()=>cameraObj.pitch||0],"distance-from-center":[{kind:"number"},[],()=>cameraObj.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(e,[t])=>rgbaToHsla(fromString(t.evaluate(e)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],hsla],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],hsla],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(e,[t,r])=>t.evaluate(e)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(e,[t])=>{const r=styleConfig[t.evaluate(e)];return void 0===r?{}:r}]});var mapboxBaseUrl="https://api.mapbox.com";function getMapboxPath(e){return 0!==e.indexOf("mapbox://")?"":e.slice(9)}function normalizeSpriteDefinition(e,t,r){if("string"==typeof e)return[{id:"default",url:normalizeSpriteUrl(e,t,r)}];for(const n of e)n.url=normalizeSpriteUrl(n.url,t,r);return e}function normalizeSpriteUrl(e,t,r){const n=getMapboxPath(e);if(!t||!n)return decodeURI(new URL(e,r).href);if(0!==n.indexOf("sprites/"))throw new Error(`unexpected sprites url: ${e}`);const i=n.slice(8);return`${mapboxBaseUrl}/styles/v1/${i}/sprite?access_token=${t}`}function normalizeStyleUrl(e,t){const r=getMapboxPath(e);if(!r||!t)return decodeURI(new URL(e,location.href).href);if(0!==r.indexOf("styles/"))throw new Error(`unexpected style url: ${e}`);const n=r.slice(7);return`${mapboxBaseUrl}/styles/v1/${n}?&access_token=${t}`}var mapboxSubdomains=["a","b","c","d"];function normalizeSourceUrl(e,t,r,n){const i=new URL(e,n||location.href),o=getMapboxPath(e);return o?"mapbox.satellite"===o?[`https://api.mapbox.com/v4/${o}/{z}/{x}/{y}${window.devicePixelRatio>=1.5?"@2x":""}.webp?access_token=${t}`]:mapboxSubdomains.map(e=>`https://${e}.tiles.mapbox.com/v4/${o}/{z}/{x}/{y}.vector.pbf?access_token=${t}`):t?(i.searchParams.has(r)||i.searchParams.set(r,t),[decodeURI(i.href)]):[decodeURI(i.href)]}var CanvasImageLayerRenderer=class extends CanvasLayerRenderer{constructor(e){super(e),this.image=null,this.renderedSourceRevision_=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(e){const t=e.layerStatesArray[e.layerIndex],r=e.pixelRatio,n=e.viewState,i=n.resolution,o=this.getLayer().getSource(),s=e.viewHints;let a=e.extent;if(void 0!==t.extent&&(a=getIntersection(a,fromUserExtent(t.extent,n.projection))),!s[ViewHint_default.ANIMATING]&&!s[ViewHint_default.INTERACTING]&&!isEmpty(a))if(o){this.getLayer().rendered||this.renderedSourceRevision_===o.getRevision()||(this.image=null),this.renderedSourceRevision_=o.getRevision();const e=n.projection,t=o.getImage(a,i,r,e);t&&(this.loadImage(t)?this.image=t:t.getState()===ImageState_default.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(e){const t=this.frameState;if(!t)return null;const r=this.getLayer(),n=apply$1(t.pixelToCoordinateTransform,e.slice()),i=r.getExtent();if(i&&!containsCoordinate(i,n))return null;const o=this.image.getExtent(),s=this.image.getImage(),a=getWidth(o),l=Math.floor(s.width*((n[0]-o[0])/a));if(l<0||l>=s.width)return null;const c=getHeight(o),u=Math.floor(s.height*((o[3]-n[1])/c));return u<0||u>=s.height?null:this.getImageData(s,l,u)}renderFrame(e,t){const r=this.image,n=r.getExtent(),i=r.getResolution(),[o,s]=Array.isArray(i)?i:[i,i],a=r.getPixelRatio(),l=e.layerStatesArray[e.layerIndex],c=e.pixelRatio,u=e.viewState,h=u.center,d=u.resolution,p=c*o/(d*a),f=c*s/(d*a);this.prepareContainer(e,t);const g=this.context.canvas.width,m=this.context.canvas.height,y=this.getRenderContext(e);let v=!1,_=!0;if(l.extent){const t=fromUserExtent(l.extent,u.projection);_=intersects$1(t,e.extent),v=_&&!containsExtent(t,e.extent),v&&this.clipUnrotated(y,e,t)}const b=r.getImage(),E=compose(this.tempTransform,g/2,m/2,p,f,0,a*(n[0]-h[0])/o,a*(h[1]-n[3])/s);this.renderedResolution=s*c/a;const w=b.width*E[0],C=b.height*E[3];if(this.getLayer().getSource().getInterpolate()||(y.imageSmoothingEnabled=!1),this.preRender(y,e),_&&w>=.5&&C>=.5){const e=E[4],t=E[5],r=l.opacity;1!==r&&(y.save(),y.globalAlpha=r),y.drawImage(b,0,0,+b.width,+b.height,e,t,w,C),1!==r&&y.restore()}return this.postRender(this.context,e),v&&y.restore(),y.imageSmoothingEnabled=!0,this.container}},BaseImageLayer=class extends Layer{constructor(e){super(e=e||{})}},ImageLayer=class extends BaseImageLayer{constructor(e){super(e)}createRenderer(){return new CanvasImageLayerRenderer(this)}getData(e){return super.getData(e)}},ImageCanvas=class extends ImageWrapper{constructor(e,t,r,n,i){super(e,t,r,void 0!==i?ImageState_default.IDLE:ImageState_default.LOADED),this.loader_=void 0!==i?i:null,this.canvas_=n,this.error_=null}getError(){return this.error_}handleLoad_(e){e?(this.error_=e,this.state=ImageState_default.ERROR):this.state=ImageState_default.LOADED,this.changed()}load(){this.state==ImageState_default.IDLE&&(this.state=ImageState_default.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}};function fromResolutionLike(e){return Array.isArray(e)?Math.min(...e):e}var ReprojImage=class extends ImageWrapper{constructor(e,t,r,n,i,o,s){let a=e.getExtent();a&&e.canWrapX()&&(a=a.slice(),a[0]=-1/0,a[2]=1/0);let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);const c=l?getIntersection(r,l):r,u=calculateSourceResolution(e,t,getCenter(c),n),h=new Triangulation(e,t,c,a,u*ERROR_THRESHOLD,n),d=h.calculateSourceExtent(),p=isEmpty(d)?null:o(d,u,i),f=p?ImageState_default.IDLE:ImageState_default.EMPTY,g=p?p.getPixelRatio():1;super(r,n,g,f),this.targetProj_=t,this.maxSourceExtent_=a,this.triangulation_=h,this.targetResolution_=n,this.targetExtent_=r,this.sourceImage_=p,this.sourcePixelRatio_=g,this.interpolate_=s,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==ImageState_default.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const e=this.sourceImage_.getState();if(e==ImageState_default.LOADED){const e=getWidth(this.targetExtent_)/this.targetResolution_,t=getHeight(this.targetExtent_)/this.targetResolution_;this.canvas_=render(e,t,this.sourcePixelRatio_,fromResolutionLike(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=e,this.changed()}load(){if(this.state==ImageState_default.IDLE){this.state=ImageState_default.LOADING,this.changed();const e=this.sourceImage_.getState();e==ImageState_default.LOADED||e==ImageState_default.ERROR?this.reproject_():(this.sourceListenerKey_=listen(this.sourceImage_,EventType_default$2.CHANGE,()=>{const e=this.sourceImage_.getState();e!=ImageState_default.LOADED&&e!=ImageState_default.ERROR||(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){unlistenByKey(this.sourceListenerKey_),this.sourceListenerKey_=null}},ImageSourceEventType={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"},ImageSourceEvent=class extends BaseEvent{constructor(e,t){super(e),this.image=t}},ImageSource=class extends Source{constructor(e){super({attributions:e.attributions,projection:e.projection,state:e.state,interpolate:void 0===e.interpolate||e.interpolate}),this.on,this.once,this.un,this.loader=e.loader||null,this.resolutions_=void 0!==e.resolutions?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!e.loader&&0===e.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(e){this.resolutions_=e}findNearestResolution(e){const t=this.getResolutions();return t&&(e=t[linearFindNearest(t,e,0)]),e}getImage(e,t,r,n){const i=this.getProjection();if(!i||!n||equivalent$1(i,n))return i&&(n=i),this.getImageInternal(e,t,r,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&equivalent$1(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==t&&equals$1(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new ReprojImage(i,n,e,t,r,(e,t,r)=>this.getImageInternal(e,t,r,i),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,r,n){if(this.loader){const i=getRequestExtent(e,t,r,1),o=this.findNearestResolution(t);if(this.image&&(this.static_||this.wantedProjection_===n&&(this.wantedExtent_&&containsExtent(this.wantedExtent_,i)||containsExtent(this.image.getExtent(),i))&&(this.wantedResolution_&&fromResolutionLike(this.wantedResolution_)===o||fromResolutionLike(this.image.getResolution())===o)))return this.image;this.wantedProjection_=n,this.wantedExtent_=i,this.wantedResolution_=o,this.image=new ImageWrapper(i,o,r,this.loader),this.image.addEventListener(EventType_default$2.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(e){const t=e.target;let r;switch(t.getState()){case ImageState_default.LOADING:this.loading=!0,r=ImageSourceEventType.IMAGELOADSTART;break;case ImageState_default.LOADED:this.loading=!1,r=ImageSourceEventType.IMAGELOADEND;break;case ImageState_default.ERROR:this.loading=!1,r=ImageSourceEventType.IMAGELOADERROR;break;default:return}this.hasListener(r)&&this.dispatchEvent(new ImageSourceEvent(r,t))}};function getRequestExtent(e,t,r,n){const i=t/r,o=getCenter(e),s=ceil(getWidth(e)/i,4),a=ceil(getHeight(e)/i,4);return getForViewAndSize(o,i,0,[s+2*ceil((n-1)*s/2,4),a+2*ceil((n-1)*a/2,4)])}function createMinion(e){return function(t){const r=t.buffers,n=t.meta,i=t.imageOps,o=t.width,s=t.height,a=r.length,l=r[0].byteLength;if(i){const t=new Array(a);for(let e=0;e<a;++e)t[e]=new ImageData(new Uint8ClampedArray(r[e]),o,s);return e(t,n).data.buffer}const c=new Uint8ClampedArray(l),u=new Array(a),h=new Array(a);for(let e=0;e<a;++e)u[e]=new Uint8ClampedArray(r[e]),h[e]=[0,0,0,0];for(let d=0;d<l;d+=4){for(let e=0;e<a;++e){const t=u[e];h[e][0]=t[d],h[e][1]=t[d+1],h[e][2]=t[d+2],h[e][3]=t[d+3]}const t=e(h,n);c[d]=t[0],c[d+1]=t[1],c[d+2]=t[2],c[d+3]=t[3]}return c.buffer}}function createWorker(e,t){const r=Object.keys(e.lib||{}).map(function(t){return"const "+t+" = "+e.lib[t].toString()+";"}).concat(["const __minion__ = ("+createMinion.toString()+")(",e.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),n=new Worker("undefined"==typeof Blob?"data:text/javascript;base64,"+Buffer.from(r.join("\n"),"binary").toString("base64"):URL.createObjectURL(new Blob(r,{type:"text/javascript"})));return n.addEventListener("message",t),n}function createFauxWorker(e,t){const r=createMinion(e.operation);let n=!1;return{postMessage:function(e){setTimeout(function(){n||t({data:{buffer:r(e),meta:e.meta}})},0)},terminate:function(){n=!0}}}var Processor=class extends Disposable{constructor(e){let t;super(),this.imageOps_=!!e.imageOps,t=0===e.threads?0:this.imageOps_?1:e.threads||1;const r=new Array(t);if(t)for(let n=0;n<t;++n)r[n]=createWorker(e,this.onWorkerMessage_.bind(this,n));else r[0]=createFauxWorker(e,this.onWorkerMessage_.bind(this,0));this.workers_=r,this.queue_=[],this.maxQueueLength_=e.queue||1/0,this.running_=0,this.dataLookup_={},this.job_=null}process(e,t,r){this.enqueue_({inputs:e,meta:t,callback:r}),this.dispatch_()}enqueue_(e){for(this.queue_.push(e);this.queue_.length>this.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||0===this.queue_.length)return;const e=this.queue_.shift();this.job_=e;const t=e.inputs[0].width,r=e.inputs[0].height,n=e.inputs.map(function(e){return e.data.buffer}),i=this.workers_.length;if(this.running_=i,1===i)return void this.workers_[0].postMessage({buffers:n,meta:e.meta,imageOps:this.imageOps_,width:t,height:r},n);const o=e.inputs[0].data.length,s=4*Math.ceil(o/4/i);for(let a=0;a<i;++a){const i=a*s,o=[];for(let e=0,t=n.length;e<t;++e)o.push(n[e].slice(i,i+s));this.workers_[a].postMessage({buffers:o,meta:e.meta,imageOps:this.imageOps_,width:t,height:r},o)}}onWorkerMessage_(e,t){this.disposed||(this.dataLookup_[e]=t.data,--this.running_,0===this.running_&&this.resolveJob_())}resolveJob_(){const e=this.job_,t=this.workers_.length;let r,n;if(1===t)r=new Uint8ClampedArray(this.dataLookup_[0].buffer),n=this.dataLookup_[0].meta;else{const i=e.inputs[0].data.length;r=new Uint8ClampedArray(i),n=new Array(t);const o=4*Math.ceil(i/4/t);for(let e=0;e<t;++e){const t=this.dataLookup_[e].buffer,i=e*o;r.set(new Uint8ClampedArray(t),i),n[e]=this.dataLookup_[e].meta}}this.job_=null,this.dataLookup_={},e.callback(null,new ImageData(r,e.inputs[0].width,e.inputs[0].height),n),this.dispatch_()}disposeInternal(){for(let e=0;e<this.workers_.length;++e)this.workers_[e].terminate();this.workers_.length=0}},RasterEventType={BEFOREOPERATIONS:"beforeoperations",AFTEROPERATIONS:"afteroperations"},RasterSourceEvent=class extends BaseEvent{constructor(e,t,r){super(e),this.extent=t.extent,this.resolution=t.viewState.resolution/t.pixelRatio,this.data=r}},RasterSource=class extends ImageSource{constructor(e){super({interpolate:e.interpolate,projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=void 0!==e.operationType?e.operationType:"pixel",this.threads_=void 0!==e.threads?e.threads:1,this.layers_=createLayers(e.sources);const t=this.changed.bind(this);for(let r=0,n=this.layers_.length;r<n;++r)this.layers_[r].addEventListener(EventType_default$2.CHANGE,t);this.useResolutions_=null!==e.resolutions,this.tileQueue_=new TileQueue(function(){return 1},this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:create(),declutter:null,extent:null,index:0,layerIndex:0,layerStatesArray:getLayerStatesArray(this.layers_),pixelRatio:1,pixelToCoordinateTransform:create(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:getUid(this),renderTargets:{}},this.setAttributions(function(t){const r=[];for(let n=0,i=e.sources.length;n<i;++n){const i=e.sources[n],o=i instanceof Source?i:i.getSource();if(!o)continue;const s=o.getAttributions()?.(t);"string"==typeof s?r.push(s):void 0!==s&&r.push(...s)}return r}),void 0!==e.operation&&this.setOperation(e.operation,e.lib)}setOperation(e,t){this.processor_&&this.processor_.dispose(),this.processor_=new Processor({operation:e,imageOps:"image"===this.operationType_,queue:1,lib:t,threads:this.threads_}),this.changed()}updateFrameState_(e,t,r){const n=Object.assign({},this.frameState_);n.viewState=Object.assign({},n.viewState);const i=getCenter(e);n.size[0]=Math.ceil(getWidth(e)/t),n.size[1]=Math.ceil(getHeight(e)/t),n.extent=[i[0]-n.size[0]*t/2,i[1]-n.size[1]*t/2,i[0]+n.size[0]*t/2,i[1]+n.size[1]*t/2],n.time=Date.now();const o=n.viewState;return o.center=i,o.projection=r,o.resolution=t,n}allSourcesReady_(){let e,t=!0;for(let r=0,n=this.layers_.length;r<n;++r)if(e=this.layers_[r].getSource(),!e||"ready"!==e.getState()){t=!1;break}return t}getImage(e,t,r,n){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),t=this.findNearestResolution(t);const i=this.updateFrameState_(e,t,n);if(this.requestedFrameState_=i,this.renderedImageCanvas_){const e=this.renderedImageCanvas_.getResolution(),r=this.renderedImageCanvas_.getExtent();t===e&&equals$1(i.extent,r)||(this.renderedImageCanvas_=null)}return this.renderedImageCanvas_&&this.getRevision()===this.renderedRevision_||this.processSources_(),i.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const e=this.requestedFrameState_,t=this.layers_.length,r=new Array(t),n=new Array(t);for(let o=0;o<t;++o){const t=this.layers_[o].getSource();r[o]=t.getRevision(),e.layerIndex=o,e.renderTargets={};const i=getImageData(this.layers_[o],e);if(!i)return;n[o]=i}const i={};this.dispatchEvent(new RasterSourceEvent(RasterEventType.BEFOREOPERATIONS,e,i)),this.processor_.process(n,i,this.onWorkerComplete_.bind(this,e,r))}onWorkerComplete_(e,t,r,n,i){if(r||!n)return;const o=e.extent,s=e.viewState.resolution;if(s!==this.requestedFrameState_.viewState.resolution||!equals$1(o,this.requestedFrameState_.extent))return;for(let l=0;l<this.layers_.length;++l){const e=this.layers_[l].getSource();if(t[l]!==e.getRevision())return}let a;this.renderedImageCanvas_?a=this.renderedImageCanvas_.getImage().getContext("2d"):(a=createCanvasContext2D(e.size[0],e.size[1]),this.renderedImageCanvas_=new ImageCanvas(o,s,1,a.canvas)),a.putImageData(n,0,0),e.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new RasterSourceEvent(RasterEventType.AFTEROPERATIONS,e,i))}getResolutions(e){if(!this.useResolutions_)return null;let t=super.getResolutions();if(!t)for(let r=0,n=this.layers_.length;r<n&&(t=this.layers_[r].getSource().getResolutions(e),!t);++r);return t}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}};RasterSource.prototype.dispose;var sharedContext=null;function getImageData(e,t){const r=e.getRenderer();if(!r)throw new Error("Unsupported layer type: "+e);if(!r.prepareFrame(t))return null;const n=t.size[0],i=t.size[1];if(0===n||0===i)return null;const o=r.renderFrame(t,null);let s;if(o instanceof HTMLCanvasElement)s=o;else{if(o&&(s=o.firstElementChild),!(s instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+s);if(s.width===n&&s.height===i)return s.getContext("2d").getImageData(0,0,n,i)}if(sharedContext){const e=sharedContext.canvas;e.width!==n||e.height!==i?sharedContext=createCanvasContext2D(n,i,void 0,{willReadFrequently:!0}):sharedContext.clearRect(0,0,n,i)}else sharedContext=createCanvasContext2D(n,i,void 0,{willReadFrequently:!0});return sharedContext.drawImage(s,0,0,n,i),sharedContext.getImageData(0,0,n,i)}function getLayerStatesArray(e){return e.map(function(e){return e.getLayerState()})}function createLayers(e){const t=e.length,r=new Array(t);for(let n=0;n<t;++n)r[n]=createLayer(e[n]);return r}function createLayer(e){let t;return e instanceof Source?e instanceof TileSource?t=new TileLayer({source:e}):e instanceof ImageSource&&(t=new ImageLayer({source:e})):t=e,t}function hillshade(e,t){const r=e[0],n=r.width,i=r.height,o=r.data,s=new Uint8ClampedArray(o.length),a=2*t.resolution,l=n-1,c=i-1,u=[0,0,0,0],h=Math.PI,d=t.encoding,p=t.exaggeration,f=t.zoom,g=t.method||"standard",m=t.accentColor,y=t.shadowColors||[t.shadowColor],v=t.highlightColors||[t.highlightColor],_=(t.azimuths||[t.sunAz]).map(e=>e*h/180),b=(t.altitudes||[45]).map(e=>e*h/180),E=Math.min(_.length,b.length,y.length,v.length,4),w=f<2?.4:f<4.5?.35:.3,C=f<15?Math.pow(2,(15-f)*w):1;function S(e,t="mapbox"){return"mapbox"===t?.1*(256*e[0]*256+256*e[1]+e[2])-1e4:"terrarium"===t?256*e[0]+e[1]+e[2]/256-32768:0}function T(e,t){return 0!==e?Math.atan2(t,-e):h/2*(t>0?1:-1)}const x="igor"===g?function(e,t){const r=T(e*=2*p,t*=2*p),n=_[0]+h,i=Math.atan(Math.sqrt(e*e+t*t))*(2/h);let o=(r+n)/h+.5;o%=2,o<0&&(o+=2);const s=1-Math.abs(o-1),a=i*s,l=i*(1-s),c=y[0],u=v[0];return[c.r*a+u.r*l,c.g*a+u.g*l,c.b*a+u.b*l,c.a*a+u.a*l]}:"basic"===g?function(e,t){e*=2*p,t*=2*p;const r=_[0]+h,n=Math.cos(r),i=Math.sin(r),o=Math.cos(b[0]),s=(Math.sin(b[0])-(t*n*o-e*i*o))/Math.sqrt(1+e*e+t*t),a=Math.max(0,Math.min(1,s));if(a>.5){const e=2*a-1,t=v[0];return[t.r*e,t.g*e,t.b*e,t.a*e]}const l=1-2*a,c=y[0];return[c.r*l,c.g*l,c.b*l,c.a*l]}:"combined"===g?function(e,t){e*=2*p,t*=2*p;const r=_[0]+h,n=Math.cos(r),i=Math.sin(r),o=Math.cos(b[0]),s=Math.sin(b[0]);let a=Math.acos((s-(t*n*o-e*i*o))/Math.sqrt(1+e*e+t*t));a=Math.max(0,Math.min(h/2,a));const l=Math.atan(Math.sqrt(e*e+t*t))*(4/h/h),c=a*l,u=(h/2-a)*l,d=y[0],f=v[0];return[d.r*c+f.r*u,d.g*c+f.g*u,d.b*c+f.b*u,d.a*c+f.a*u]}:"multidirectional"===g?function(e,t){const r=(e*=2*p)*e+(t*=2*p)*t,n=Math.sqrt(1+r);let i=0,o=0,s=0,a=0;for(let l=0;l<E;l++){const r=Math.cos(b[l]),c=(Math.sin(b[l])-(t*-Math.cos(_[l])*r-e*-Math.sin(_[l])*r))/n,u=Math.max(0,Math.min(1,c)),h=y[Math.min(l,y.length-1)],d=v[Math.min(l,v.length-1)];if(u>.5){const e=(2*u-1)/E;i+=d.r*e,o+=d.g*e,s+=d.b*e,a+=d.a*e}else{const e=(1-2*u)/E;i+=h.r*e,o+=h.g*e,s+=h.b*e,a+=h.a*e}}return[i,o,s,a]}:function(e,t){const r=_[0]+h,n=Math.atan(.625*Math.sqrt(e*e+t*t)),i=T(e,t),o=1.875-1.75*p,s=.5*h,a=.5!==p?(Math.pow(o,n)-1)/(Math.pow(o,s)-1)*s:n,l=Math.cos(a),c=Math.min(Math.max(2*p,0),1),u=(1-l)*c,d=m,f=d.r*u,g=d.g*u,b=d.b*u,E=d.a*u;let w=(i+r)/h+.5;w%=2,w<0&&(w+=2);const C=Math.abs(w-1),S=Math.sin(a)*c,x=y[0],R=v[0],A=(x.r*(1-C)+R.r*C)*S,I=(x.g*(1-C)+R.g*C)*S,k=(x.b*(1-C)+R.b*C)*S,P=(x.a*(1-C)+R.a*C)*S;return[f*(1-P)+A,g*(1-P)+I,b*(1-P)+k,E*(1-P)+P]};let R,A,I,k,P,L,O,M,D,N,$;for(A=0;A<=c;++A)for(P=0===A?0:A-1,L=A===c?c:A+1,R=0;R<=l;++R){I=0===R?0:R-1,k=R===l?l:R+1,O=4*(A*n+I),u[0]=o[O],u[1]=o[O+1],u[2]=o[O+2],u[3]=o[O+3],M=S(u,d),O=4*(A*n+k),u[0]=o[O],u[1]=o[O+1],u[2]=o[O+2],u[3]=o[O+3],D=S(u,d),N=(D-M)/a*C,O=4*(P*n+R),u[0]=o[O],u[1]=o[O+1],u[2]=o[O+2],u[3]=o[O+3],M=S(u,d),O=4*(L*n+R),u[0]=o[O],u[1]=o[O+1],u[2]=o[O+2],u[3]=o[O+3],D=S(u,d),$=(D-M)/a*C;const e=x(N,$),t=e[3];O=4*(A*n+R),t>0&&(s[O]=e[0]/t*255,s[O+1]=e[1]/t*255,s[O+2]=e[2]/t*255),s[O+3]=255*t}return new ImageData(s,n,i)}function raster(e,t){const r=e[0],n=r.width,i=r.height,o=r.data,s=new Uint8ClampedArray(o.length),a=n-1,l=i-1,c=[0,0,0,0];let u,h,d;const p=(f=t.saturation)>0?1-1/(1.001-f):-f;var f;const g=(m=t.contrast)>0?1/(1-m):1+m;var m;const y=function(e){e*=Math.PI/180;const t=Math.sin(e),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}(t.hueRotate),v=y,_=[y[2],y[0],y[1]],b=[y[1],y[2],y[0]],E=t.brightnessLow,w=t.brightnessHigh;for(h=0;h<=l;++h)for(u=0;u<=a;++u){d=4*(h*n+u),c[0]=o[d],c[1]=o[d+1],c[2]=o[d+2],c[3]=o[d+3];const e=c[0],t=c[1],r=c[2],i=(e,t)=>{let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r};let a=i([e,t,r],v),l=i([e,t,r],_),f=i([e,t,r],b);const m=(a+l+f)/3;a+=(m-a)*p,l+=(m-l)*p,f+=(m-f)*p,a=(a-127.5)*g+127.5,l=(l-127.5)*g+127.5,f=(f-127.5)*g+127.5,a=E*(255-a)+w*a,l=E*(255-l)+w*l,f=E*(255-f)+w*f,s[d]=a,s[d+1]=l,s[d+2]=f,s[d+3]=c[3]}return new ImageData(s,n,i)}var fontWeights={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},sp=" ",italicRE=/(italic|oblique)$/i,fontCache={};function mapbox_to_css_font_default(e,t,r){var n=fontCache[e];if(!n){Array.isArray(e)||(e=[e]);for(var i,o,s=400,a="normal",l=[],c=0,u=e.length;c<u;++c){var h=e[c].split(" "),d=h[h.length-1].toLowerCase();for(var p in"normal"==d||"italic"==d||"oblique"==d?(a=o?a:d,o=!0,h.pop(),d=h[h.length-1].toLowerCase()):italicRE.test(d)&&(d=d.replace(italicRE,""),a=o?a:h[h.length-1].replace(d,""),o=!0),fontWeights){var f=h.length>1?h[h.length-2].toLowerCase():"";if(d==p||d==p.replace("-","")||f+"-"+d==p){s=i?s:fontWeights[p],h.pop(),f&&p.startsWith(f)&&h.pop();break}}i||"number"!=typeof d||(s=d,i=!0);var g=h.join(sp).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==g.indexOf(sp)&&(g='"'+g+'"'),l.push(g)}n=fontCache[e]=[a,s,l]}return n[0]+sp+n[1]+sp+t+"px"+(r?"/"+r:"")+sp+n[2]}var emptyObj=Object.freeze({}),functionCacheByStyleId={},filterCacheByStyleId={},styleId=0;function getStyleId(e){return e.id||(e.id=styleId++),e.id}function getStyleFunctionKey(e,t){return getStyleId(e)+"."+getUid(t)}function getFunctionCache(e){let t=functionCacheByStyleId[e.id];return t||(t={},functionCacheByStyleId[getStyleId(e)]=t),t}function getFilterCache(e){let t=filterCacheByStyleId[e.id];return t||(t={},filterCacheByStyleId[getStyleId(e)]=t),t}function deg2rad(e){return e*Math.PI/180}var defaultResolutions=function(){const e=[];for(let t=78271.51696402048;e.length<=24;t/=2)e.push(t);return e}();function createCanvas(e,t){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(e,t);const r=document.createElement("canvas");return r.width=e,r.height=t,r}function getZoomForResolution(e,t){let r=0;const n=t.length;for(;r<n;++r)if(t[r]<e&&r+1<n){const n=t[r]/t[r+1];return r+Math.log(t[r]/e)/Math.log(n)}return n-1}function getResolutionForZoom(e,t){const r=Math.floor(e),n=Math.pow(2,e-r);return t[r]/n}var pendingRequests={};function fetchResource(e,t,r={},n){if(t in pendingRequests)return n&&(n.url=pendingRequests[t][0].url),pendingRequests[t][1];const i=r.transformRequest&&r.transformRequest(t,e)||t,o=function(){return delete pendingRequests[t],Promise.reject(new Error("Error fetching source "+t))},s=function(e){return delete pendingRequests[t],e.ok?e.json():Promise.reject(new Error("Error fetching source "+t))},a=toPromise(()=>i).then(e=>e instanceof Response?(n&&(n.url=e.url),s(e)):(e instanceof Request||(e=new Request(e)),e.headers.get("Accept")||e.headers.set("Accept","application/json"),n&&(n.url=e.url),fetch(e).then(s).catch(o))).catch(o);return pendingRequests[t]=[i,a],a}function getGlStyle(e,t){if("string"!=typeof e)return Promise.resolve(e);if(!e.trim().startsWith("{"))return fetchResource("Style",e=normalizeStyleUrl(e,t.accessToken),t);try{const t=JSON.parse(e);return Promise.resolve(t)}catch(error){return Promise.reject(error)}}var tilejsonCache={};function getTileJson(e,t,r={}){const n=[t,JSON.stringify(e)].toString();let i=tilejsonCache[n];if(!i||r.transformRequest){let o;r.transformRequest&&(o=(e,t)=>{const n=r.transformRequest&&r.transformRequest(t,"Tiles")||t;if(e instanceof VectorTile$1)e.setLoader((t,r,i)=>{const o=function(r){r.arrayBuffer().then(r=>{const n=e.getFormat().readFeatures(r,{extent:t,featureProjection:i});e.setFeatures(n)})};toPromise(()=>n).then(t=>{if(t instanceof Response)return o(t);fetch(t).then(o).catch(()=>e.setState(TileState_default.ERROR))}).catch(()=>e.setState(TileState_default.ERROR))});else{const t=e.getImage();toPromise(()=>n).then(r=>{if("string"==typeof r)return void(t.src=r);const n=e=>e.blob().then(e=>{const r=URL.createObjectURL(e);t.addEventListener("load",()=>URL.revokeObjectURL(r)),t.addEventListener("error",()=>URL.revokeObjectURL(r)),t.src=r});if(r instanceof Response)return n(r);fetch(r).then(n).catch(()=>e.setState(TileState_default.ERROR))}).catch(()=>e.setState(TileState_default.ERROR))}});const s=e.url;if(s&&!e.tiles){const n=normalizeSourceUrl(s,r.accessToken,r.accessTokenParam||"access_token",t||location.href);if(s.startsWith("mapbox://"))i=Promise.resolve({tileJson:Object.assign({},e,{url:void 0,tiles:n}),tileLoadFunction:o});else{const e={};i=fetchResource("Source",n[0],r,e).then(function(t){return t.tiles=t.tiles.map(function(n){return"tms"===t.scheme&&(n=n.replace("{y}","{-y}")),normalizeSourceUrl(n,r.accessToken,r.accessTokenParam||"access_token",e.url)[0]}),Promise.resolve({tileJson:t,tileLoadFunction:o})})}}else e.tiles?(e=Object.assign({},e,{tiles:e.tiles.map(function(n){return"tms"===e.scheme&&(n=n.replace("{y}","{-y}")),normalizeSourceUrl(n,r.accessToken,r.accessTokenParam||"access_token",t||location.href)[0]})}),i=Promise.resolve({tileJson:Object.assign({},e),tileLoadFunction:o})):i=Promise.reject(new Error("source has no `tiles` nor `url`"));tilejsonCache[n]=i}return i}function drawIconHalo(e,t,r,n){const i=[2*r*t.pixelRatio+t.width,2*r*t.pixelRatio+t.height],o=createCanvas(i[0],i[1]),s=o.getContext("2d");s.drawImage(e,t.x,t.y,t.width,t.height,r*t.pixelRatio,r*t.pixelRatio,t.width,t.height);const a=s.getImageData(0,0,i[0],i[1]);s.globalCompositeOperation="destination-over",s.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=a.data;for(let c=0,u=a.width;c<u;++c)for(let e=0,n=a.height;e<n;++e)l[4*(e*u+c)+3]>0&&s.arc(c,e,r*t.pixelRatio,0,2*Math.PI);return s.fill(),o}function smoothstep(e,t,r){const n=Math.max(0,Math.min(1,(r-e)/(t-e)));return n*n*(3-2*n)}function drawSDF(e,t,r){const n=createCanvas(t.width,t.height),i=n.getContext("2d");i.drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height);const o=i.getImageData(0,0,t.width,t.height),s=o.data;for(let a=0,l=o.width;a<l;++a)for(let e=0,t=o.height;e<t;++e){const t=4*(e*l+a),n=smoothstep(.65,.85,s[t+3]/255);n>0?(s[t+0]=Math.round(255*r.r*n),s[t+1]=Math.round(255*r.g*n),s[t+2]=Math.round(255*r.b*n),s[t+3]=Math.round(255*n)):s[t+3]=0}return i.putImageData(o,0,0),n}var hairSpacePool=Array(256).join(""),measureContext;function applyLetterSpacing(e,t){if(t>=.05){let r="";const n=e.split("\n"),i=hairSpacePool.slice(0,Math.round(t/.1));for(let e=0,t=n.length;e<t;++e)e>0&&(r+="\n"),r+=n[e].split("").join(i);return r}return e}function getMeasureContext(){return measureContext||(measureContext=createCanvas(1,1).getContext("2d")),measureContext}function fitWeight(e,t){if(/\d+ \d+/.test(e)){const[r,n]=e.split(" ").map(Number);return r<=t&&t<=n}return e==t}function measureText(e,t){return getMeasureContext().measureText(e).width+(e.length-1)*t}var measureCache={};function wrapText(e,t,r,n){if(-1!==e.indexOf("\n")){const i=e.split("\n"),o=[];for(let e=0,s=i.length;e<s;++e)o.push(wrapText(i[e],t,r,n));return o.join("\n")}const i=r+","+t+","+e+","+n;let o=measureCache[i];if(!o){const s=e.split(" ");if(s.length>1){const e=getMeasureContext();e.font=t;const i=e.measureText("M").width*r;let a="";const l=[];for(let t=0,r=s.length;t<r;++t){const e=s[t],r=a+(a?" ":"")+e;measureText(r,n)<=i?a=r:(a&&l.push(a),a=e)}a&&l.push(a);for(let t=0,r=l.length;t<r&&r>1;++t){const e=l[t];if(measureText(e,n)<.35*i){const i=t>0?measureText(l[t-1],n):1/0,o=t<r-1?measureText(l[t+1],n):1/0;l.splice(t,1),r-=1,i<o?(l[t-1]+=" "+e,t-=1):l[t]=e+" "+l[t]}}for(let t=0,r=l.length-1;t<r;++t){const e=l[t],o=l[t+1];if(measureText(e,n)>.7*i&&measureText(o,n)<.6*i){const s=e.split(" "),a=s.pop();measureText(a,n)<.2*i&&(l[t]=s.join(" "),l[t+1]=a+" "+o),r-=1}}o=l.join("\n")}else o=e;o=applyLetterSpacing(o,n),measureCache[i]=o}return o}checkedFonts.on("propertychange",()=>{for(const e in measureCache)delete measureCache[e]});var webSafeFonts=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],processedFontFamilies={};function getFonts(e,t="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(WORKER_OFFSCREEN_CANVAS)return e;let r;for(let n=0,i=e.length;n<i;++n){const t=e[n];if(t in processedFontFamilies)continue;processedFontFamilies[t]=!0;const i=mapbox_to_css_font_default(t,16).split(" ");r||(r=[]),r.push([i.slice(3).join(" ").replace(/"/g,""),i[1],i[0]])}return r?((async()=>{await document.fonts.ready;for(let e=0,n=r.length;e<n;++e){const n=r[e],i=n[0];if(webSafeFonts.includes(i))continue;const o=n[1],s=n[2];if(!(await document.fonts.load(`${s} ${o} 16px "${i}"`)).some(e=>e.family.replace(/^['"]|['"]$/g,"").toLowerCase()===i.toLowerCase()&&fitWeight(e.weight,o)&&e.style===s)){const e=t.replace("{font-family}",i.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",i.replace(/ /g,"+")).replace("{fontweight}",o).replace("{-fontstyle}",s.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",s);if(!document.querySelector('link[href="'+e+'"]')){const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)}}}})(),e):e}var types={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},anchor={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]},expressionData=function(e,t){let r=createPropertyExpression(e,t);if("error"===r.result){const n=wrapImageExtraArgs(e);n!==e&&(r=createPropertyExpression(n,t))}if("error"===r.result){const n=r.value[0];return console.error("Error parsing expression:",e,n.key,n.message),{evaluate:()=>t.default}}return r.value},renderFeatureCoordinates,renderFeature;function getValue(e,t,r,n,i,o){const s=e.id;i||(i={},console.warn("No functionCache provided to getValue()")),i[s]||(i[s]={});const a=i[s];if(!a[r]){let n=(e[t]||emptyObj)[r];const i=v8[`${t}_${e.type}`]&&v8[`${t}_${e.type}`][r];void 0===n&&i&&(n=i.default);let o=isExpression(n);if(!o&&isFunction(n)&&(n=convertFunction(n,i),o=!0),o){const e=expressionData(n,i);a[r]=e.evaluate.bind(e)}else{const e=i?i.type:typeof n;"color"!==e&&"colorArray"!==e||(n=Color.parse(n));let t=!1;if("array"===e)for(let r=0;r<n.length;++r){const e=n[r];if(isExpression(e)||isFunction(e)){t=!0;break}}if(t){const e=Object.assign({},i,{type:i.value}),t=[];for(let r=0;r<n.length;++r){let i=n[r];if(!isExpression(i)&&isFunction(i)&&(i=convertFunction(i,e)),isExpression(i)){const r=expressionData(i,e);t.push(r.evaluate.bind(r))}else t.push(function(){return i})}a[r]=function(e,r,n){const i=[];for(let o=0;o<t.length;++o)i[o]=t[o](e,r,n);return i}}else a[r]=function(){return n}}}return a[r](cameraObj,n,o)}function getDeclutterMode(e,t,r,n){return getValue(e,"layout",`${r}-allow-overlap`,t,n)?getValue(e,"layout",`${r}-ignore-placement`,t,n)?"none":"obstacle":"declutter"}function evaluateFilter(e,t,r,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(e in n))try{n[e]=featureFilter(t).filter}catch(i){console.warn("Filter will evaluate to false: "+i.message),n[e]=function(){return!1}}return n[e](cameraObj,r)}var renderTransparentEnabled=!1;function colorWithOpacity(e,t){if(e){if(!renderTransparentEnabled&&(0===e.a||0===t))return;const r=e.a;return t=void 0===t?1:t,0===r?"transparent":"rgba("+Math.round(255*e.r/r)+","+Math.round(255*e.g/r)+","+Math.round(255*e.b/r)+","+r*t+")"}return e}var templateRegEx=/\{[^{}}]*\}/g;function fromTemplate(e,t){return e.replace(templateRegEx,function(e){return t[e.slice(1,-1)]||""})}function getSpriteImageForIcon(e,t){let r=e.split(":")[0];return r===e&&(r="default"),t[r]}var recordLayer=!1,styleFunctionArgs={};function stylefunction(e,t,r,n=defaultResolutions,i,o,s,a){if("string"==typeof t&&(t=JSON.parse(t)),t.schema)for(const _ in t.schema){const e=t.schema[_];"default"in e&&(styleConfig[_]=e.default)}if(8!=t.version)throw new Error("glStyle version 8 required.");styleFunctionArgs[getStyleFunctionKey(t,e)]=Array.from(arguments);const l={};("string"==typeof o||o instanceof Request||o instanceof Response||o instanceof Promise)&&(o={default:o});for(const _ in o){const t=o[_];toPromise(()=>t).then(async t=>{let r;if("undefined"!=typeof Image){const n=new Image;if("string"==typeof t)n.crossOrigin="anonymous",n.src=t;else{let e;t instanceof Request?e=await fetch(t):t instanceof Response&&(e=t);const i=await e.blob();r=URL.createObjectURL(i),n.src=r}n.addEventListener("load",function t(){n.removeEventListener("load",t),l[_]={image:n,size:[n.width,n.height]},e.changed(),r&&URL.revokeObjectURL(r)}),n.addEventListener("error",function e(){URL.revokeObjectURL(r),n.removeEventListener("error",e)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const e=self;e.postMessage({action:"loadImage",src:t}),e.addEventListener("message",function(e){"imageLoaded"===e.data.action&&e.data.src===t&&(l[_]={image:e.data.image,size:[e.data.image.width,e.data.image.height]})})}})}const c=derefLayers(t.layers),u={},h=[],d={},p={},f=getFunctionCache(t),g=getFilterCache(t);let m;for(let _=0,b=c.length;_<b;++_){const e=c[_],n=e.id;if("string"==typeof r&&e.source==r||Array.isArray(r)&&-1!==r.indexOf(n)){const r=e["source-layer"];if(m){if(e.source!==m)throw new Error(`Layer "${n}" does not use source "${m}`)}else{m=e.source;const r=t.sources[m];if(!r)throw new Error(`Source "${m}" is not defined`);const n=r.type;if("vector"!==n&&"geojson"!==n)throw new Error(`Source "${m}" is not of type "vector" or "geojson", but "${n}"`)}let i=u[r];i||(i=[],u[r]=i),i.push({layer:e,index:_}),h.push(n)}}const y=[],v=function(r,o,c){const h=e.getSource?.()?.format_?.layerName_??"mvt:layer",m=r.getProperties(),v=u[m[h]];if(!v)return;let _=n.indexOf(o);-1==_&&(_=getZoomForResolution(o,n)),cameraObj.zoom=_,cameraObj.distanceFromCenter=0;const b=r.getGeometry(),E=types[b.getType()],w=e.get("map");if(w&&w instanceof Map$1&&1===E){const e=w.getSize();if(e){const t=w.getView().getCenter(),r=getCenter(b.getExtent());cameraObj.distanceFromCenter=distance(t,r)/o/e[1]}}const C={id:r.getId(),properties:m,type:E},S=e.get("mapbox-featurestate")[r.getId()];let T,x=-1;for(let n=0,u=v.length;n<u;++n){const u=v[n],h=u.layer,b=h.id;if(void 0!==c&&c!==b)continue;const w=h.layout||emptyObj,R=h.paint||emptyObj;if("none"===getValue(h,"layout","visibility",C,f,S)||"minzoom"in h&&_<h.minzoom||"maxzoom"in h&&_>=h.maxzoom)continue;const A=h.filter;if(!A||evaluateFilter(b,A,C,g)){let n,c,g,v,_,b;T=h;const A=u.index;if(3==E&&("fill"==h.type||"fill-extrusion"==h.type))if(c=getValue(h,"paint",h.type+"-opacity",C,f,S),h.type+"-pattern"in R){const e=getValue(h,"paint",h.type+"-pattern",C,f,S);if(e){const t="string"==typeof e?fromTemplate(e,m):e.toString(),r=getSpriteImageForIcon(t,l);if(i&&i[t]&&r){++x,b=y[x],b&&b.getFill()&&!b.getStroke()&&!b.getText()||(b=new Style({fill:new Fill}),y[x]=b),g=b.getFill(),b.setZIndex(A);const e=t+"."+c;let n=p[e];if(!n){const o=i[t],s=createCanvas(o.width,o.height),a=s.getContext("2d");a.globalAlpha=c,a.drawImage(r.image,o.x,o.y,o.width,o.height,0,0,o.width,o.height),n=a.createPattern(s,"repeat"),p[e]=n}g.setColor(n)}}}else if(n=colorWithOpacity(getValue(h,"paint",h.type+"-color",C,f,S),c),h.type+"-outline-color"in R&&(_=colorWithOpacity(getValue(h,"paint",h.type+"-outline-color",C,f,S),c)),_||(_=n),n||_){if(++x,b=y[x],(!b||n&&!b.getFill()||!n&&b.getFill()||_&&!b.getStroke()||!_&&b.getStroke()||b.getText())&&(b=new Style({fill:n?new Fill:void 0,stroke:_?new Stroke:void 0}),y[x]=b),n&&(g=b.getFill(),g.setColor(n)),"fill-extrusion"===h.type){const e=getValue(h,"paint","fill-extrusion-height",C,f,S);if(e>0){const t=Math.max(.1,.9-Math.min(e,225)/280);if(_&&"transparent"!==_){const e=Color.parse(_);_=`rgba(${Math.round(255*e.r*t)},${Math.round(255*e.g*t)},${Math.round(255*e.b*t)},${e.a})`}}}_&&(v=b.getStroke(),v.setColor(_),v.setWidth(.5)),b.setZIndex(A)}if(1!=E&&"line"==h.type){n="line-pattern"in R?void 0:colorWithOpacity(getValue(h,"paint","line-color",C,f,S),getValue(h,"paint","line-opacity",C,f,S));const e=getValue(h,"paint","line-width",C,f,S);n&&e>0&&(++x,b=y[x],b&&b.getStroke()&&!b.getFill()&&!b.getText()||(b=new Style({stroke:new Stroke}),y[x]=b),v=b.getStroke(),v.setLineCap(getValue(h,"layout","line-cap",C,f,S)),v.setLineJoin(getValue(h,"layout","line-join",C,f,S)),v.setMiterLimit(getValue(h,"layout","line-miter-limit",C,f,S)),v.setColor(n),v.setWidth(e),v.setLineDash(R["line-dasharray"]?getValue(h,"paint","line-dasharray",C,f,S).map(function(t){return t*e}):null),"function"==typeof v.setOffset&&v.setOffset(getValue(h,"paint","line-offset",C,f,S)),b.setZIndex(A))}let I,k,P,L,O,M,D,N,$,F=!1,B=null,U=0;if((1==E||2==E)&&"icon-image"in w){const t=getValue(h,"layout","icon-image",C,f,S);if(t){let n;I="string"==typeof t?fromTemplate(t,m):t.toString();const s=a?a(e,I):void 0,c=getSpriteImageForIcon(I,l);if(i&&i[I]&&c||s){const e=getValue(h,"layout","icon-rotation-alignment",C,f,S);if(2==E){const t=r.getGeometry();if(t.getFlatMidpoint||t.getFlatMidpoints){const r=t.getExtent();if(Math.sqrt(Math.max(Math.pow((r[2]-r[0])/o,2),Math.pow((r[3]-r[1])/o,2)))>150){const r="MultiLineString"===t.getType()?t.getFlatMidpoints():t.getFlatMidpoint();if(renderFeature||(renderFeature=new RenderFeature("Point",renderFeatureCoordinates=[NaN,NaN],[],2,{},void 0)),n=renderFeature,renderFeatureCoordinates[0]=r[0],renderFeatureCoordinates[1]=r[1],"line"===getValue(h,"layout","symbol-placement",C,f,S)&&"map"===e){const e=t.getStride(),n=t.getFlatCoordinates();for(let t=0,i=n.length-e;t<i;t+=e){const i=n[t],o=n[t+1],s=n[t+e],a=n[t+e+1],l=Math.min(i,s),c=Math.max(i,s),u=r[0],h=(a-o)*(u-i)-(s-i)*(r[1]-o);if(Math.abs(h)<.001&&u<=c&&u>=l){U=Math.atan2(o-a,s-i);break}}}}}}if(2!==E||n){const t=getValue(h,"layout","icon-size",C,f,S),r=void 0!==R["icon-color"]?getValue(h,"paint","icon-color",C,f,S):null;if(!r||0!==r.a){const n=getValue(h,"paint","icon-halo-color",C,f,S),o=getValue(h,"paint","icon-halo-width",C,f,S);let a=`${I}.${t}.${o}.${n}`;if(null!==r&&(a+=`.${r}`),k=d[a],!k){const l=getDeclutterMode(h,C,"icon",f);let u;"icon-offset"in w&&(u=getValue(h,"layout","icon-offset",C,f,S).slice(0),u[0]*=t,u[1]*=-t);let p=r?[255*r.r,255*r.g,255*r.b,r.a]:void 0;if(s){const r={color:p,rotateWithView:"map"===e,displacement:u,declutterMode:l,scale:t};"string"==typeof s?r.src=s:(r.img=s,r.imgSize=[s.width,s.height]),k=new Icon(r)}else{const s=i[I];let a,h,d;o?s.sdf?(a=drawIconHalo(drawSDF(c.image,s,r||[0,0,0,1]),{x:0,y:0,width:s.width,height:s.height,pixelRatio:s.pixelRatio},o,n),p=void 0):a=drawIconHalo(c.image,s,o,n):(s.sdf&&(c.unSDFed||(c.image=drawSDF(c.image,{x:0,y:0,width:c.size[0],height:c.size[1]},{r:1,g:1,b:1,a:1}),c.unSDFed=!0)),a=c.image,h=[s.width,s.height],d=[s.x,s.y]),k=new Icon({color:p,img:a,imgSize:c.size,size:h,offset:d,rotateWithView:"map"===e,scale:t/s.pixelRatio,displacement:u,declutterMode:l})}d[a]=k}}k&&(++x,b=y[x],b&&b.getImage()&&!b.getFill()&&!b.getStroke()||(b=new Style,y[x]=b),b.setGeometry(n),k.setRotation(U+deg2rad(getValue(h,"layout","icon-rotate",C,f,S))),k.setOpacity(getValue(h,"paint","icon-opacity",C,f,S)),k.setAnchor(anchor[getValue(h,"layout","icon-anchor",C,f,S)]),b.setImage(k),B=b.getText(),b.setText(void 0),b.setZIndex(A),F=!0,P=!1)}else P=!0}}}if(1==E&&"circle"===h.type){++x,b=y[x],b&&b.getImage()&&!b.getFill()&&!b.getStroke()||(b=new Style,y[x]=b);const e="circle-radius"in R?getValue(h,"paint","circle-radius",C,f,S):5,t=colorWithOpacity(getValue(h,"paint","circle-stroke-color",C,f,S),getValue(h,"paint","circle-stroke-opacity",C,f,S)),r=getValue(h,"paint","circle-translate",C,f,S),n=colorWithOpacity(getValue(h,"paint","circle-color",C,f,S),getValue(h,"paint","circle-opacity",C,f,S)),i=getValue(h,"paint","circle-stroke-width",C,f,S),o=e+"."+t+"."+n+"."+i+"."+r[0]+"."+r[1];k=d[o],k||(k=new CircleStyle({radius:e,displacement:[r[0],-r[1]],stroke:t&&i>0?new Stroke({width:i,color:t}):void 0,fill:n?new Fill({color:n}):void 0,declutterMode:"none"}),d[o]=k),b.setImage(k),B=b.getText(),b.setText(void 0),b.setGeometry(void 0),b.setZIndex(A),F=!0}if("text-field"in w){D=Math.round(getValue(h,"layout","text-size",C,f,S));const e=getValue(h,"layout","text-font",C,f,S);M=getValue(h,"layout","text-line-height",C,f,S),O=mapbox_to_css_font_default(s?s(e,t.metadata?t.metadata["ol:webfonts"]:void 0):e,D,M),O.includes("sans-serif")||(O+=",sans-serif"),N=getValue(h,"layout","text-letter-spacing",C,f,S),$=getValue(h,"layout","text-max-width",C,f,S);const r=getValue(h,"layout","text-field",C,f,S);L="object"==typeof r&&r.sections?1===r.sections.length?r.toString():r.sections.reduce((t,r)=>{const n=r.fontStack?r.fontStack.split(","):e,i=mapbox_to_css_font_default(s?s(n):n,D*(r.scale||1),M);let o=r.text;if("\n"===o)return t.push("\n",""),t;if(2==E)return t.push(applyLetterSpacing(o,N),i),t;o=wrapText(o,i,$,N).split("\n");for(let e=0,s=o.length;e<s;++e)e>0&&t.push("\n",""),t.push(o[e],i);return t},[]):fromTemplate(r,m).trim(),c=getValue(h,"paint","text-opacity",C,f,S)}if(L&&c&&!P){F||(++x,b=y[x],b&&b.getText()&&!b.getFill()&&!b.getStroke()||(b=new Style,y[x]=b),b.setImage(void 0),b.setGeometry(void 0));const e=getDeclutterMode(h,C,"text",f);b.getText()||b.setText(B),B=b.getText(),(!B||"getDeclutterMode"in B&&B.getDeclutterMode()!==e)&&(B=new Text({padding:[2,2,2,2],declutterMode:e}),b.setText(B));const t=getValue(h,"layout","text-transform",C,f,S);"uppercase"==t?L=Array.isArray(L)?L.map((e,t)=>t%2?e:e.toUpperCase()):L.toUpperCase():"lowercase"==t&&(L=Array.isArray(L)?L.map((e,t)=>t%2?e:e.toLowerCase()):L.toLowerCase());const r=Array.isArray(L)?L:2==E?applyLetterSpacing(L,N):wrapText(L,O,$,N);if(B.setText(r),B.setFont(O),B.setRotation(deg2rad(getValue(h,"layout","text-rotate",C,f,S))),"function"==typeof B.setKeepUpright){const e=getValue(h,"layout","text-keep-upright",C,f,S);B.setKeepUpright(e)}const n=getValue(h,"layout","text-anchor",C,f,S),i=F||1==E?"point":getValue(h,"layout","symbol-placement",C,f,S);let o;if("line-center"===i?(B.setPlacement("line"),o="center"):B.setPlacement(i),"line"===i&&"function"==typeof B.setRepeat){const e=getValue(h,"layout","symbol-spacing",C,f,S);B.setRepeat(2*e)}B.setOverflow("point"===i);let s=getValue(h,"paint","text-halo-width",C,f,S);const a=getValue(h,"layout","text-offset",C,f,S),l=getValue(h,"paint","text-translate",C,f,S);let u=0,d=0;if("point"==i){o="center",-1!==n.indexOf("left")?(o="left",d=s):-1!==n.indexOf("right")&&(o="right",d=-s);const e=getValue(h,"layout","text-rotation-alignment",C,f,S);B.setRotateWithView("map"==e)}else B.setMaxAngle(deg2rad(getValue(h,"layout","text-max-angle",C,f,S))*L.length/r.length),B.setRotateWithView(!1);B.setTextAlign(o);let p="middle";0==n.indexOf("bottom")?(p="bottom",u=-s-.5*(M-1)*D):0==n.indexOf("top")&&(p="top",u=s+.5*(M-1)*D),B.setTextBaseline(p);const g=getValue(h,"layout","text-justify",C,f,S);B.setJustify("auto"===g?void 0:g),B.setOffsetX(a[0]*D+d+l[0]),B.setOffsetY(a[1]*D+u+l[1]);const m=B.getFill()||new Fill;m.setColor(colorWithOpacity(getValue(h,"paint","text-color",C,f,S),c)),B.setFill(m);const v=colorWithOpacity(getValue(h,"paint","text-halo-color",C,f,S),c);if(v&&s>0){const e=B.getStroke()||new Stroke;e.setColor(v),s*=2;const t=.5*D;e.setWidth(s<=t?s:t),B.setStroke(e)}else B.setStroke(void 0);const _=getValue(h,"layout","text-padding",C,f,S),w=B.getPadding();_!==w[0]&&(w[0]=_,w[1]=_,w[2]=_,w[3]=_),b.setZIndex(A)}}}return x>-1?(y.length=x+1,recordLayer&&("set"in r?r.set("mapbox-layer",T):r.getProperties()["mapbox-layer"]=T),y):void 0};return e.setStyle(v),e.set("mapbox-layers",h),e.set("mapbox-source",m),e.set("mapbox-featurestate",e.get("mapbox-featurestate")||{}),v}var defaultShadowColor=Color.parse("#000000"),defaultHighlightColor=Color.parse("#FFFFFF"),defaultAccentColor=Color.parse("#000000");function createRasterOpLayer(e){return new ImageLayer({source:new RasterSource({operationType:"image",operation:raster,sources:[e]})})}function createHillshadeLayer(e){return new ImageLayer({source:new RasterSource({operationType:"image",operation:hillshade,sources:[e]})})}function configureRasterOpLayer(e,t,r,n){e.getSource().on("beforeoperations",function(e){cameraObj.zoom=getZoomForResolution(e.resolution,r.resolutions||defaultResolutions),cameraObj.distanceFromCenter=0;const i=e.data;i.saturation=getValue(t,"paint","raster-saturation",emptyObj,n),i.contrast=getValue(t,"paint","raster-contrast",emptyObj,n),i.brightnessHigh=getValue(t,"paint","raster-brightness-max",emptyObj,n),i.brightnessLow=getValue(t,"paint","raster-brightness-min",emptyObj,n),i.hueRotate=getValue(t,"paint","raster-hue-rotate",emptyObj,n)})}function configureHillshadeLayer(e,t,r,n,i){e.getSource().on("beforeoperations",function(e){const o=e.data;o.resolution=getPointResolution(n.projection||"EPSG:3857",e.resolution,getCenter(e.extent),"m");const s=getZoomForResolution(e.resolution,n.resolutions||defaultResolutions);cameraObj.zoom=s,cameraObj.distanceFromCenter=0,o.zoom=s,o.encoding=t.encoding,o.method=getValue(r,"paint","hillshade-method",emptyObj,i)||"standard",o.exaggeration=getValue(r,"paint","hillshade-exaggeration",emptyObj,i);let a=getValue(r,"paint","hillshade-illumination-direction",emptyObj,i);null==a&&(a=335),o.azimuths=Array.isArray(a)?a:[a],o.sunAz=o.azimuths[0];let l=getValue(r,"paint","hillshade-illumination-altitude",emptyObj,i);function c(e){return e&&e.values?e.values[0]:e}function u(e){const t=r.paint?.[e];if(Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&void 0!==Color.parse(t[0]))return t.map(e=>Color.parse(e));let n=getValue(r,"paint",e,emptyObj,i);return n=c(n),n?[n]:void 0}null==l&&(l=45),o.altitudes=Array.isArray(l)?l:[l],o.highlightColors=u("hillshade-highlight-color"),o.highlightColor=o.highlightColors?.[0]||defaultHighlightColor,o.highlightColors||(o.highlightColors=[o.highlightColor]),o.shadowColors=u("hillshade-shadow-color"),o.shadowColor=o.shadowColors?.[0]||defaultShadowColor,o.shadowColors||(o.shadowColors=[o.shadowColor]),o.accentColor=c(getValue(r,"paint","hillshade-accent-color",emptyObj,i))||defaultAccentColor})}var rasterOperationKeys=["raster-saturation","raster-contrast","raster-brightness-max","raster-brightness-min","raster-hue-rotate"];function prerenderRasterLayer(e,t,r){let n=null;return function(i){e.paint&&"raster-opacity"in e.paint&&i.frameState.viewState.zoom!==n&&(n=i.frameState.viewState.zoom,delete r[e.id],updateRasterLayerProperties(e,t,n,r))}}function updateRasterLayerProperties(e,t,r,n){cameraObj.zoom=r,cameraObj.distanceFromCenter=0;const i=getValue(e,"paint","raster-opacity",emptyObj,n);t.setOpacity(i)}var SUPPORTED_LAYER_TYPES=["background","circle","fill","fill-extrusion","line","symbol","raster","hillshade"];function getTileResolutions(e,t=512){return e.getExtent()?createXYZ({extent:e.getExtent(),tileSize:t,maxZoom:22}).getResolutions():defaultResolutions}function completeOptions(e,t){return t.accessToken||(t=Object.assign({},t),new URL(e).searchParams.forEach((e,r)=>{t.accessToken=e,t.accessTokenParam=r})),t}function applyStyle(e,t,r="",n={},i){let o,s,a,l,c=!0;return"string"==typeof r||Array.isArray(r)?l=r:(a=r,l=a.source||a.layers,n=a),"string"==typeof n?(o=n,a={}):(o=n.styleUrl,a=n),!1===a.updateSource&&(c=!1),i||(i=a.resolutions),o||"string"!=typeof t||t.trim().startsWith("{")||(o=t),o&&(o=o.startsWith("data:")?location.href:normalizeStyleUrl(o,a.accessToken),a=completeOptions(o,a)),new Promise(function(r,n){getGlStyle(t,a).then(function(t){if(8!=t.version)return n(new Error("glStyle version 8 required."));if(!(e instanceof VectorLayer||e instanceof VectorTileLayer))return n(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=e instanceof VectorTileLayer?"vector":"geojson";if(l?s=Array.isArray(l)?t.layers.find(function(e){return e.id===l[0]}).source:l:(s=t.layers.find(function(e){return e.source&&t.sources[e.source].type===u}).source,l=s),!s)return n(new Error(`No ${u} source found in the glStyle.`));function h(){if(!c)return Promise.resolve();if(e instanceof VectorTileLayer)return setupVectorSource(t.sources[s],o,a).then(function(t){const r=e.getSource();r?t!==r&&(r.setTileUrlFunction(t.getTileUrlFunction()),"function"==typeof r.setUrls&&"function"==typeof t.getUrls&&r.setUrls(t.getUrls()),r.format_||(r.format_=t.format_),r.getAttributions()||r.setAttributions(t.getAttributions()),r.getTileLoadFunction()===defaultLoadFunction&&r.setTileLoadFunction(t.getTileLoadFunction()),equivalent$1(r.getProjection(),t.getProjection())&&(r.tileGrid=t.getTileGrid())):e.setSource(t);const n=e.getSource().getTileGrid();!isFinite(e.getMaxResolution())&&!isFinite(e.getMinZoom())&&n.getMinZoom()>0&&e.setMaxResolution(getResolutionForZoom(Math.max(0,n.getMinZoom()-1e-12),n.getResolutions()))});const r=t.sources[s];let n=e.getSource();n&&n.get("mapbox-source")===r||(n=setupGeoJSONSource(r,o,a));const i=e.getSource();return i?n!==i&&(i.getAttributions()||i.setAttributions(n.getAttributions()),i.format_||(i.format_=n.getFormat()),i.url_=n.getUrl()):e.setSource(n),Promise.resolve()}let d,p;const f={},g={};function m(){if(p||t.sprite&&!f)p?(e.setStyle(p),h().then(r).catch(n)):n(new Error("Something went wrong trying to apply style."));else{if(a.projection&&!i){const e=get$2(a.projection).getUnits();"m"!==e&&(i=defaultResolutions.map(t=>t/METERS_PER_UNIT$1[e]))}let o;const c=e.getSource();c instanceof VectorTile&&c.format_ instanceof MVT&&(o=c.format_.layerName_),p=stylefunction(e,t,l,i,f,g,(e,t=a.webfonts)=>getFonts(e,t),a.getImage,o),e.getStyle()?h().then(r).catch(n):n(new Error(`Nothing to show for source [${s}]`))}}if(t.sprite){const e=normalizeSpriteDefinition(t.sprite,a.accessToken,o||location.href);d=WORKER_OFFSCREEN_CANVAS?1:window.devicePixelRatio>=1.5?.5:1;const r=.5==d?"@2x":"";Promise.all(e.map(function(e){const t=new URL(e.url);let i=t.origin+t.pathname+r+".json"+t.search;return new Promise(function(e,r){fetchResource("Sprite",i,a).then(e).catch(function(){i=t.origin+t.pathname+".json"+t.search,fetchResource("Sprite",i,a).then(e).catch(r)})}).then(function(i){let o;if(void 0===i&&n(new Error("No sprites found.")),o=t.origin+t.pathname+r+".png"+t.search,a.transformRequest){const e=a.transformRequest(o,"SpriteImage")||o;(e instanceof Request||e instanceof Promise)&&(o=e)}g[e.id]=o;for(const t in i){const r="default"==e.id?t:`${e.id}:${t}`;f[r]=i[t]}}).catch(function(e){n(new Error(`Sprites cannot be loaded: ${i}: ${e.message}`))})})).then(m).catch(n)}else m()}).catch(n)})}var REF_INHERITED_PROPS=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function resolveRef(e,t){if(!t.ref)return t;const r=e.find(e=>e.id===t.ref);if(!r)return t;const n=Object.assign({},t);for(const i of REF_INHERITED_PROPS)!(i in n)&&i in r&&(n[i]=r[i]);return n}function extentFromTileJSON(e,t){const r=e.bounds;if(r){const e=fromLonLat([r[0],r[1]],t),n=fromLonLat([r[2],r[3]],t);return[e[0],e[1],n[0],n[1]]}return get$2(t).getExtent()}function sourceOptionsFromTileJSON(e,t,r){const n=new TileJSON({tileJSON:t,tileSize:e.tileSize||t.tileSize||512}),i=n.getTileJSON(),o=n.getTileGrid(),s=get$2(r.projection||"EPSG:3857"),a=extentFromTileJSON(i,s),l=s.getExtent(),c=i.minzoom||0,u=i.maxzoom||22,h={attributions:n.getAttributions(),projection:s,tileGrid:new TileGrid({origin:l?getTopLeft(l):o.getOrigin(0),extent:a||o.getExtent(),minZoom:c,resolutions:getTileResolutions(s,t.tileSize).slice(0,u+1),tileSize:o.getTileSize(0)})};return Array.isArray(i.tiles)?h.urls=i.tiles:h.url=i.tiles,h}function getBackgroundColor(e,t,r,n){const i={id:e.id,type:e.type},o=e.paint||{};let s;i.paint=o,cameraObj.zoom=getZoomForResolution(t,r.resolutions||defaultResolutions),cameraObj.distanceFromCenter=0;const a=getValue(i,"paint","background-color",emptyObj,n);return void 0!==o["background-opacity"]&&(s=getValue(i,"paint","background-opacity",emptyObj,n)),"none"===getValue(i,"layout","visibility",emptyObj,n)?void 0:colorWithOpacity(a,s)}function setupBackgroundLayer(e,t,r){const n=WORKER_OFFSCREEN_CANVAS?{style:{}}:document.createElement("div");return n.className="ol-mapbox-style-background",n.style.position="absolute",n.style.width="100%",n.style.height="100%",new Layer({source:new Source({}),render(i){const o=getBackgroundColor(e,i.viewState.resolution,t,r);return n.style.backgroundColor=o,n}})}function setupVectorSource(e,t,r){return new Promise(function(n,i){getTileJson(e,t,r).then(function({tileJson:t,tileLoadFunction:i}){const o=sourceOptionsFromTileJSON(e,t,r);o.tileLoadFunction=i,o.format=new MVT({layerName:"mvt:layer"});const s=new VectorTile(o);s.set("mapbox-source",e),n(s)}).catch(i)})}function setupVectorLayer(e,t,r){const n=new VectorTileLayer({declutter:!0,visible:!1});return setupVectorSource(e,t,r).then(function(e){n.setSource(e)}).catch(function(){n.setSource(void 0)}),n}function getBboxTemplate(e){return`{bbox-${(e?e.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function setupRasterSource(e,t,r){return new Promise(function(n,i){getTileJson(e,t,r).then(function({tileJson:t,tileLoadFunction:i}){const o=new TileJSON({interpolate:void 0===r.interpolate||r.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:t});o.tileGrid=sourceOptionsFromTileJSON(e,t,r).tileGrid,r.projection&&(o.projection=get$2(r.projection));const s=o.getTileUrlFunction();i&&o.setTileLoadFunction(i),o.setTileUrlFunction(function(e,t,r){const n=getBboxTemplate(r);let i=s(e,t,r);if(-1!=i.indexOf(n)){const t=o.getTileGrid().getTileCoordExtent(e);i=i.replace(n,t.toString())}return i}),o.set("mapbox-source",e),n(o)}).catch(function(e){i(e)})})}function setupRasterLayer(e,t,r){const n=new TileLayer;return setupRasterSource(e,t,r).then(function(e){n.setSource(e)}).catch(function(){n.setSource(void 0)}),n}function setupGeoJSONSource(e,t,r){const n=r.projection?new GeoJSON({dataProjection:r.projection}):new GeoJSON,i=e.data,o={};if("string"==typeof i){const[o]=normalizeSourceUrl(i,r.accessToken,r.accessTokenParam||"access_token",t||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(o)){const t=(e,t,r)=>{const n=getBboxTemplate(r);return o.replace(n,`${e.join(",")}`)},i=new VectorSource({attributions:e.attribution,format:n,loader:(e,n,o,s,a)=>{fetchResource("GeoJSON","function"==typeof t?t(e,n,o):t,r).then(e=>{const t=i.getFormat().readFeatures(e,{featureProjection:o});i.addFeatures(t),s(t)}).catch(()=>{i.removeLoadedExtent(e),a()})},strategy:bbox});return i.set("mapbox-source",e),i}const s=new VectorSource({attributions:e.attribution,format:n,url:o,loader:(e,t,n,i,a)=>{fetchResource("GeoJSON",o,r).then(e=>{const t=s.getFormat().readFeatures(e,{featureProjection:n});s.addFeatures(t),i(t)}).catch(()=>{s.removeLoadedExtent(e),a()})}});return s}o.features=n.readFeatures(i,{featureProjection:getUserProjection()||"EPSG:3857"});const s=new VectorSource(Object.assign({attributions:e.attribution,format:n},o));return s.set("mapbox-source",e),s}function setupGeoJSONLayer(e,t,r){return new VectorLayer({declutter:!0,source:setupGeoJSONSource(e,t,r),visible:!1})}function manageVisibility(e,t,r){function n(){const n=t.get("mapbox-style");if(!n)return;const i=derefLayers(n.layers),o=e.get("mapbox-layers"),s=i.filter(function(e){return o.includes(e.id)}).some(function(e){return!e.layout||"visible"===getValue(e,"layout","visibility",emptyObj,r)});e.get("visible")!==s&&e.setVisible(s)}e.on("change",n),n()}function setupLayer(e,t,r,n){r=resolveRef(e.layers,r);const i=getFunctionCache(e),o=r.type;let s=r.source;const a=e.sources[s];let l;return"background"==o?(l=setupBackgroundLayer(r,n,i),s=void 0):"vector"==a.type?l=setupVectorLayer(a,t,n):"raster"==a.type?(Object.keys(r.paint||{}).find(e=>rasterOperationKeys.includes(e))?(l=createRasterOpLayer(setupRasterLayer(a,t,n)),configureRasterOpLayer(l,r,n,i)):l=setupRasterLayer(a,t,n),l.setVisible(!r.layout||"none"!==getValue(r,"layout","visibility",emptyObj,i)),l.on("prerender",prerenderRasterLayer(r,l,i))):"geojson"==a.type?l=setupGeoJSONLayer(a,t,n):"raster-dem"==a.type&&"hillshade"==r.type&&(l=createHillshadeLayer(setupRasterLayer(a,t,n)),configureHillshadeLayer(l,a,r,n,i),l.setVisible(!r.layout||"none"!==getValue(r,"layout","visibility",emptyObj,i))),l&&l.set("mapbox-source",s),l}function processStyle(e,t,r,n){e.schema&&Object.assign(styleConfig,Object.keys(e.schema).reduce((t,r)=>(t[r]=e.schema[r]?.default,t),{}));const i=[];let o=null;if(t instanceof Map$1){if(o=t.getView(),!o.isDef()&&!o.getRotation()&&!o.getResolutions()){const e=n.projection?get$2(n.projection):o.getProjection();o=new View(Object.assign(o.getProperties(),{maxResolution:defaultResolutions[0]/METERS_PER_UNIT$1[e.getUnits()],projection:n.projection||o.getProjection()})),t.setView(o)}"center"in e&&!o.getCenter()&&o.setCenter(fromLonLat(e.center,o.getProjection())),"zoom"in e&&void 0===o.getZoom()&&o.setResolution(defaultResolutions[0]/METERS_PER_UNIT$1[o.getProjection().getUnits()]/Math.pow(2,e.zoom)),o.getCenter()&&void 0!==o.getZoom()||o.fit(o.getProjection().getExtent(),{nearest:!0,size:t.getSize()})}t.set("mapbox-style",e),t.set("mapbox-metadata",{styleUrl:r,options:n});const s=e.layers;let a,l,c,u=[];for(let h=0,d=s.length;h<d;++h){const o=resolveRef(s,s[h]),d=o.type;SUPPORTED_LAYER_TYPES.includes(d)?(c=o.source,c&&c==l||(u.length&&(i.push(finalizeLayer(a,u,e,r,t,n)),u=[]),a=setupLayer(e,r,o,n),a instanceof VectorLayer||a instanceof VectorTileLayer||(u=[]),l=a.get("mapbox-source")),u.push(o.id)):console.warn(`layers[${h}].type "${d}" not supported`)}return i.push(finalizeLayer(a,u,e,r,t,n)),Promise.all(i)}function apply(e,t,r={}){let n,i;if(WORKER_OFFSCREEN_CANVAS){if(!(e instanceof Map$1||e instanceof LayerGroup))throw new Error("ol-mapbox-style in a web worker requires a Map or a LayerGroup as first argument");i=e}else i="string"==typeof e||e instanceof HTMLElement?new Map$1({target:e}):e;if("string"==typeof t){const e=t.startsWith("data:")?location.href:normalizeStyleUrl(t,r.accessToken);r=completeOptions(e,r),n=new Promise(function(n,o){getGlStyle(t,r).then(function(t){processStyle(t,i,e,r).then(function(){n(i)}).catch(o)}).catch(function(e){o(new Error(`Could not load ${t}: ${e.message}`))})})}else n=new Promise(function(e,n){processStyle(t,i,!r.styleUrl||r.styleUrl.startsWith("data:")?location.href:normalizeStyleUrl(r.styleUrl,r.accessToken),r).then(function(){e(i)}).catch(n)});return n}function finalizeLayer(e,t,r,n,i,o={}){let s=24,a=0;const l=r.layers;for(let c=0,u=l.length;c<u;++c){const e=l[c];-1!==t.indexOf(e.id)&&(s=Math.min("minzoom"in e?e.minzoom:0,s),a=Math.max("maxzoom"in e?e.maxzoom:24,a))}return new Promise(function(l,c){const u=function(){const u=e.getSource();if(u&&"error"!==u.getState()){if("getTileGrid"in u){const t=u.getTileGrid();if(t){const r=t.getMinZoom();(s>0||r>0)&&e.setMaxResolution(Math.min(getResolutionForZoom(Math.max(0,s-1e-12),defaultResolutions),getResolutionForZoom(Math.max(0,r-1e-12),t.getResolutions()))),a<24&&e.setMinResolution(getResolutionForZoom(a,defaultResolutions))}}else s>0&&e.setMaxResolution(getResolutionForZoom(Math.max(0,s-1e-12),defaultResolutions));u instanceof VectorSource||u instanceof VectorTile?applyStyle(e,r,t,Object.assign({styleUrl:n},o)).then(function(){manageVisibility(e,i,getFunctionCache(r)),l()}).catch(c):l()}else c(new Error("Error accessing data for source "+e.get("mapbox-source")))};e.set("mapbox-layers",t);const h=i.getLayers();-1===h.getArray().indexOf(e)&&h.push(e),e.getSource()?u():e.once("change:source",u)})}var MapComponent=class extends Component{static{decorateFieldV2(this.prototype,"osm",[service])}#pe=void initializeDeferredDecorator(this,"osm");static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");mapInstance;bookmarkSource;searchResultsSource;selectedShapeSource;searchOverlay;searchOverlayElement;selectedPinOverlay;selectedPinElement;crosshairElement;crosshairOverlay;ignoreNextMapClick=!1;setupMap=modifier(e=>{if(this.mapInstance)return;const t=new LayerGroup;this.selectedShapeSource=new VectorSource;const r=new VectorLayer({source:this.selectedShapeSource,style:new Style({stroke:new Stroke({color:"#3388ff",width:4}),fill:new Fill({color:"rgba(51, 136, 255, 0.1)"})}),zIndex:5});this.bookmarkSource=new VectorSource;const n=new VectorLayer({source:this.bookmarkSource,style:e=>{const t=e.get("originalPlace");let r=getComputedStyle(document.documentElement).getPropertyValue("--default-list-color").trim()||"#000000";if(t&&t._listIds&&t._listIds.length>0){const e=t._listIds[0],n=this.storage.lists.find(t=>t.id===e);n&&n.color&&(r=n.color)}return[new Style({image:new CircleStyle({radius:10,fill:new Fill({color:"rgba(0, 0, 0, 0.2)"}),displacement:[0,-2]})}),new Style({image:new CircleStyle({radius:9,fill:new Fill({color:r}),stroke:new Stroke({color:"#fff",width:2})})})]},zIndex:10});this.searchResultsSource=new VectorSource;const i=new Map,o=new VectorLayer({source:this.searchResultsSource,style:e=>{const t=e.get("originalPlace"),r=this.mapUi.selectedPlace;if(r){const e=t.osmId&&r.osmId&&t.osmId===r.osmId,n=t.id&&r.id&&t.id===r.id,i=t.lat===r.lat&&t.lon===r.lon;if(e||n||i)return new Style({})}const n=getIconNameForTags(t.osmTags||t),o=n||"default";if(!i.has(o)){const e=getComputedStyle(document.documentElement).getPropertyValue("--marker-color-primary").trim()||"#ea4335";let t=`<circle cx="12" cy="12" r="8" fill="${e}"/>`;if(n){const r=getIcon(n);if(r){let n=r.trim();const i=n.indexOf("<svg"),o=n.indexOf(">",i)+1,s=n.lastIndexOf("</svg>");-1!==i&&-1!==s&&(n=n.substring(o,s)),t=`\n <circle cx="12" cy="12" r="8" fill="${e}"/>\n <g transform="translate(6, 6) scale(0.8)" fill="white">\n ${n}\n </g>\n `}}const r=`\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 -4 32 40" width="40" height="50">\n <defs>\n <filter id="shadow" x="-50%" y="-50%" width="200%" height="200%">\n <feDropShadow dx="0" dy="2" stdDeviation="1.5" flood-color="black" flood-opacity="0.3"/>\n </filter>\n </defs>\n <path d="M12 2C6.5 2 2 6.5 2 12C2 17.5 12 24 12 24C12 24 22 17.5 22 12C22 6.5 17.5 2 12 2Z" fill="white" filter="url(#shadow)"/>\n ${t}\n </svg>\n `;i.set(o,"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(r.trim()))}return new Style({image:new Icon({src:i.get(o),anchor:[.5,.65],scale:1})})},zIndex:11});let s=[14.21683569,27.060114248],a=2.661,l=!1;try{const e=localStorage.getItem("marco:map-view");if(e){const t=JSON.parse(e);t.center&&Array.isArray(t.center)&&2===t.center.length&&"number"==typeof t.zoom&&(s=t.center,a=t.zoom,l=!0)}}catch(T){console.warn("Failed to restore map view:",T)}const c=new View({center:fromLonLat(s),zoom:a,projection:"EPSG:3857"});this.mapInstance=new Map$1({target:e,layers:[t,r,o,n],view:c,controls:defaults$1({zoom:!0,rotate:!0,attribution:!0}),interactions:defaults({dragPan:!1})});const u=toLonLat(c.getCenter());this.mapUi.updateCenter(u[1],u[0]),this.mapUi.updateZoom(c.getZoom()),apply(this.mapInstance,"https://tiles.openfreemap.org/styles/liberty",{webfonts:"data:text/css,"}),this.searchOverlayElement=document.createElement("div"),this.searchOverlayElement.className="search-pulse",this.searchOverlay=new Overlay({element:this.searchOverlayElement,positioning:"center-center",stopEvent:!1}),this.mapInstance.addOverlay(this.searchOverlay),this.selectedPinElement=document.createElement("div"),this.selectedPinElement.className="selected-pin-container";const h=document.createElement("div");h.className="selected-pin",h.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3" style="fill: var(--marker-color-dark); stroke: none;"></circle></svg>';const d=document.createElement("div");d.className="selected-pin-shadow",this.selectedPinElement.appendChild(h),this.selectedPinElement.appendChild(d),this.selectedPinOverlay=new Overlay({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 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="12" y1="5" x2="12" y2="19"></line>\n <line x1="5" y1="12" x2="19" y2="12"></line>\n </svg>\n ',e.appendChild(this.crosshairElement),this.locationOverlayElement=document.createElement("div"),this.locationOverlayElement.className="search-pulse blue",this.locationOverlay=new Overlay({element:this.locationOverlayElement,positioning:"center-center",stopEvent:!1}),this.mapInstance.addOverlay(this.locationOverlay),e.addEventListener("pointerdown",()=>{this.mapUi.searchBoxHasFocus&&(this.ignoreNextMapClick=!0)},!0);const p=new Geolocation({trackingOptions:{enableHighAccuracy:!0},projection:c.getProjection()}),f=new Feature;f.setStyle(new Style({image:new CircleStyle({radius:6,fill:new Fill({color:"#3399CC"}),stroke:new Stroke({color:"#fff",width:2})})}));const g=new VectorSource({features:[f]}),m=new VectorLayer({source:g,zIndex:15});p.on("change:position",function(){const e=p.getPosition();f.setGeometry(e?new Point(e):null)});const y=document.createElement("div");y.className="ol-control ol-locate";const v=document.createElement("button");let _,b;v.style.display="flex",v.style.alignItems="center",v.style.justifyContent="center",v.innerHTML=`<span class="icon" style="width: 14px; height: 14px; display: flex;">${getIcon("navigation")}</span>`,v.title="Locate Me",y.appendChild(v);const E=()=>{_&&(clearTimeout(_),_=null);try{b&&(p.un("change:position",w),b=null)}catch{}this.locationOverlayElement&&this.locationOverlayElement.classList.remove("active")},w=()=>{const e=p.getPosition(),t=p.getAccuracyGeometry(),r=p.getAccuracy();if(console.debug("Geolocation change:",{coordinates:e,accuracy:r}),!e)return;const n=this.mapInstance.getSize(),i=this.mapInstance.getView();let o=null;if(this.locationOverlayElement){const t=i.getResolution(),n=2*(r||50)/getPointResolution(i.getProjection(),t,e);this.locationOverlayElement.style.width=`${n}px`,this.locationOverlayElement.style.height=`${n}px`,this.locationOverlay.setPosition(e)}if(r&&r<=20&&E(),t){const e=t.getExtent();o=3.162*i.getResolutionForExtent(e,n)}else r&&(o=6.325*r/Math.min(n[0],n[1])/getPointResolution(i.getProjection(),1,e));let s={center:e,duration:1e3};if(o){const e=i.getResolutionForZoom(17);s.resolution=Math.max(o,e)}else s.zoom=16;this.mapInstance.getView().animate(s)},C=()=>{console.debug("Getting current geolocation..."),E(),p.setTracking(!0);const e=p.getPosition();this.locationOverlayElement&&this.locationOverlayElement.classList.add("active"),e&&w(),b=p.on("change:position",w),_=setTimeout(()=>{E()},1e4)};v.addEventListener("click",C);const S=new Control({element:y});this.mapInstance.addLayer(m),this.mapInstance.addControl(S),l||"index"!==this.router.currentRouteName||C(),this.mapInstance.on("singleclick",this.handleMapClick),this.mapInstance.on("moveend",this.handleMapMove),this.mapInstance.on("pointermove",e=>{const t=this.mapInstance.getEventPixel(e.originalEvent),r=this.mapInstance.hasFeatureAtPixel(t,{hitTolerance:10});this.mapInstance.getTarget().style.cursor=r?"pointer":""}),this.storage.rs.on("ready",()=>{this.handleMapMove()})});updateInteractions=modifier(()=>{if(!this.mapInstance)return;this.mapInstance.getInteractions().getArray().slice().forEach(e=>{e instanceof DragPan&&this.mapInstance.removeInteraction(e)});const e=!!this.settings.mapKinetic&&new Kinetic(-.005,.05,100);this.settings.mapKinetic&&window.innerWidth<=768&&(e.minVelocity_=.25),this.mapInstance.addInteraction(new DragPan({kinetic:e}))});updateSearchResults=modifier(()=>{if(!this.searchResultsSource)return;this.searchResultsSource.clear();const e=this.mapUi.searchResults;if(!e||0===e.length)return;const t=[];e.forEach(e=>{if(e.lat&&e.lon){const r=new Feature({geometry:new Point(fromLonLat([e.lon,e.lat])),name:e.title,id:e.id,isSearchResult:!0,originalPlace:e});t.push(r)}}),t.length>0&&this.searchResultsSource.addFeatures(t)});updateSelectedPin=modifier(()=>{const e=this.mapUi.selectedPlace,t=this.mapUi.selectionOptions||{};if(this.searchResultsSource&&this.searchResultsSource.changed(),this.selectedPinOverlay&&this.selectedPinElement)if(this.selectedShapeSource&&this.selectedShapeSource.clear(),e&&e.lat&&e.lon){const n=fromLonLat([e.lon,e.lat]);if(this.selectedPinOverlay.setPosition(n),this.selectedPinElement.classList.remove("active"),this.selectedPinElement.offsetWidth,this.selectedPinElement.classList.add("active"),e.geojson&&this.selectedShapeSource)try{const t=(new GeoJSON).readFeature(e.geojson,{featureProjection:"EPSG:3857"});this.selectedShapeSource.addFeature(t)}catch(r){console.warn("Failed to render selected place shape:",r)}t.preventZoom?this.handlePinVisibility(n,{maintainZoom:!0}):e.bbox?this.zoomToBbox(e.bbox):this.handlePinVisibility(n)}else this.selectedPinElement.classList.remove("active"),this.selectedPinOverlay.setPosition(void 0)});zoomToBbox(e){if(!this.mapInstance||!e)return;const t=this.mapInstance.getView(),r=this.mapInstance.getSize(),n=[...fromLonLat([e.minLon,e.minLat]),...fromLonLat([e.maxLon,e.maxLat])];let i=[.15*r[1],.15*r[0],.15*r[1],.15*r[0]];if(r[0]<=768){const e=.5*r[1],t=.15*e,n=.5*r[1]+.15*e;i[0]=t,i[2]=n}else if(this.args.isSidebarOpen){const e=getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width").trim(),t=parseInt(e,10)||360,n=r[0]-t;i[3]=t+.15*n,i[1]=.15*n}const o=t.getZoom();t.fit(n,{padding:i,duration:1e3,easing:e=>e*(2-e),maxZoom:Math.max(o,18)})}handlePinVisibility(e,t={}){if(!this.mapInstance)return;const r=this.mapInstance.getView().getZoom();if(!t.maintainZoom&&r<16)return void this.animateToSmartCenter(e,16);const n=this.mapInstance.getPixelFromCoordinate(e),i=this.mapInstance.getSize();if(!n||n[0]<0||n[0]>i[0]||n[1]<0||n[1]>i[1]){const r=t.maintainZoom?null:16;this.animateToSmartCenter(e,r)}else this.panIfObscured(e)}animateToSmartCenter(e,t=null){if(!this.mapInstance)return;const r=this.mapInstance.getSize(),n=this.mapInstance.getView();let i=n.getResolution();null!==t&&(i=n.getResolutionForZoom(t));let o=e;if(r[0]<=768){const t=r[1],n=document.querySelector(".app-header"),s=n?n.offsetHeight:60,a=(t/2-(s+(t/2-s)/2))*i;o=[e[0],e[1]-a]}else if(this.args.isSidebarOpen){const t=getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width").trim(),r=(parseInt(t,10)||360)/2*i;o=[e[0]-r,e[1]]}const s={center:o,duration:1e3,easing:e=>e*(2-e)};null!==t&&(s.zoom=t),n.animate(s)}panIfObscured(e){if(!this.mapInstance)return;const t=this.mapInstance.getSize(),r=this.mapInstance.getPixelFromCoordinate(e);if(!r)return;const n=this.mapInstance.getView(),i=n.getCenter(),o=n.getResolution();let s=r[0],a=r[1],l=!1;const c=document.querySelector(".app-header"),u=c?c.offsetHeight:60;if(t[0]<=768){const e=t[1],n=e/2;r[1]>n&&(a=u+(e/2-u)/2,l=!0)}else if(this.args.isSidebarOpen){const e=getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width").trim(),n=parseInt(e,10)||360;r[0]<n&&(s=n+(t[0]-n)/2,l=!0)}const h=u+20;if(a<h&&(a=h+30,l=!0),l){const e=r[0]-s,t=r[1]-a,l=i[0]+e*o,c=i[1]-t*o;n.animate({center:[l,c],duration:500,easing:e=>e*(2-e)})}}updateBookmarks=modifier(()=>{const e=this.storage.placesInView;this.loadBookmarks(e)});async loadBookmarks(e=[]){try{if(!this.bookmarkSource)return;e&&0!==e.length||(e=this.storage.placesInView),this.bookmarkSource.clear(),e&&Array.isArray(e)&&e.forEach(e=>{if(e.lat&&e.lon){const t=new Feature({geometry:new Point(fromLonLat([e.lon,e.lat])),name:e.title,id:e.id,isBookmark:!0,originalPlace:e});this.bookmarkSource.addFeature(t)}})}catch(t){console.error("Failed to load bookmarks:",t)}}syncPulse=modifier(()=>{this.searchOverlayElement&&(this.mapUi.isSearching?this.searchOverlayElement.classList.add("active"):this.searchOverlayElement.classList.remove("active"))});syncCreationMode=modifier(()=>{if(this.crosshairElement&&this.mapInstance)if(this.mapUi.isCreating){this.crosshairElement.classList.add("visible");const e=this.mapUi.creationCoordinates;if(e&&e.lat&&e.lon){const t=fromLonLat([e.lon,e.lat]);this.animateToCrosshair(t)}}else this.crosshairElement.classList.remove("visible")});animateToCrosshair(e){if(!this.mapInstance||!this.crosshairElement)return;const t=this.mapInstance.getTargetElement().getBoundingClientRect(),r=this.crosshairElement.getBoundingClientRect(),n=r.left+r.width/2-t.left,i=r.top+r.height/2-t.top,o=this.mapInstance.getSize(),s=n-o[0]/2,a=i-o[1]/2,l=this.mapInstance.getView(),c=l.getResolution(),u=s*c,h=-a*c,d=e[0]-u,p=e[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:e=>e*(2-e)})}handleMapMove=async()=>{if(!this.mapInstance||this.isDestroying||this.isDestroyed)return;const e=this.mapInstance.getView(),t=toLonLat(e.getCenter());if(this.mapUi.updateCenter(t[1],t[0]),this.mapUi.updateZoom(e.getZoom()),this.mapUi.isCreating){const e=this.mapInstance.getTargetElement().getBoundingClientRect(),t=this.crosshairElement.getBoundingClientRect(),r=t.left+t.width/2-e.left,n=t.top+t.height/2-e.top,i=toLonLat(this.mapInstance.getCoordinateFromPixel([r,n])),o=parseFloat(i[1].toFixed(6)),s=parseFloat(i[0].toFixed(6));this.mapUi.updateCreationCoordinates(o,s),this.router.replaceWith("place.new",{queryParams:{lat:o,lon:s}})}const r=this.mapInstance.getSize(),n=this.mapInstance.getView().calculateExtent(r),[i,o]=toLonLat([n[0],n[1]]),[s,a]=toLonLat([n[2],n[3]]),l={minLat:o,minLon:i,maxLat:a,maxLon:s};if(this.mapUi.updateBounds(l),await this.storage.loadPlacesInBounds(l),!this.isDestroying&&!this.isDestroyed){this.nostrData.loadPlacesInBounds(l),this.loadBookmarks(this.storage.placesInView);try{const e=this.mapInstance.getView(),t={center:toLonLat(e.getCenter()),zoom:e.getZoom()};localStorage.setItem("marco:map-view",JSON.stringify(t))}catch(c){console.warn("Failed to save map view:",c)}}};handleMapClick=async e=>{if(this.ignoreNextMapClick)return void(this.ignoreNextMapClick=!1);const t=this.mapInstance.getFeaturesAtPixel(e.pixel,{hitTolerance:10});let r=null,n=null,i=null;if(t&&t.length>0){console.debug(`Found ${t.length} features in map layer:`);for(const r of t)console.debug(r);const e=t.find(e=>e.get("isBookmark")),o=t.find(e=>e.get("isSearchResult"));e?r=e.get("originalPlace"):o&&(n=o.get("originalPlace"));const s=t[0].getProperties();s.name&&(i=s.name)}const o=e=>{("search"===this.router.currentRouteName||this.mapUi.currentSearch&&this.mapUi.searchResults.length>0)&&(this.mapUi.returnToSearch=!0),this.mapUi.preventNextZoom=!0,this.mapUi.selectPlace(e,{preventZoom:!0}),this.mapUi.showSidebar(),this.router.transitionTo("place",e)};if(this.args.isSidebarOpen){const e=r||n;return e?(console.debug("Clicked feature while sidebar open (switching):",e),void o(e)):void(this.args.onOutsideClick&&this.args.onOutsideClick())}if(r)return console.debug("Clicked bookmark:",r),void o(r);if(n)return console.debug("Clicked search result:",n),void o(n);if(this.mapUi.searchResults&&this.mapUi.searchResults.length>0)return console.debug("Clearing active search and markers on map click"),void this.router.transitionTo("index");if(this.mapInstance.getView().getZoom()<16)return;const[s,a]=toLonLat(e.coordinate),l=i?30:50;if(this.searchOverlayElement){const t=this.mapInstance.getView(),r=2*l/getPointResolution(t.getProjection(),t.getResolution(),e.coordinate);this.searchOverlayElement.style.width=`${r}px`,this.searchOverlayElement.style.height=`${r}px`,this.searchOverlay.setPosition(e.coordinate)}this.mapUi.startSearch();const c={lat:a.toFixed(6),lon:s.toFixed(6),q:null,category:null,selected:i||null};this.router.transitionTo("search",{queryParams:c})};static{setComponentTemplate(templateFactory({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,["updateSearchResults"]],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:"(unknown template module)",isStrictMode:!0}),this)}},UserMenuComponent=class extends Component{static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"osmAuth",[service])}#lt=void initializeDeferredDecorator(this,"osmAuth");static{decorateFieldV2(this.prototype,"nostrAuth",[service])}#x=void initializeDeferredDecorator(this,"nostrAuth");static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");static{decorateFieldV2(this.prototype,"isNostrConnectModalOpen",[tracked],function(){return!1})}#nt=void initializeDeferredDecorator(this,"isNostrConnectModalOpen");connectRS(){this.args.onClose(),this.args.storage.showConnectWidget()}static{decorateMethodV2(this.prototype,"connectRS",[action])}disconnectRS(){this.args.storage.disconnect()}static{decorateMethodV2(this.prototype,"disconnectRS",[action])}connectOsm(){this.args.onClose(),this.osmAuth.login()}static{decorateMethodV2(this.prototype,"connectOsm",[action])}disconnectOsm(){this.osmAuth.logout()}static{decorateMethodV2(this.prototype,"disconnectOsm",[action])}openNostrConnectModal(){this.isNostrConnectModalOpen=!0}static{decorateMethodV2(this.prototype,"openNostrConnectModal",[action])}closeNostrConnectModal(){this.isNostrConnectModalOpen=!1}static{decorateMethodV2(this.prototype,"closeNostrConnectModal",[action])}disconnectNostr(){this.nostrAuth.disconnect()}static{decorateMethodV2(this.prototype,"disconnectNostr",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"user-menu-popover"],[12],[1,"\\n "],[10,"ul"],[14,0,"account-list"],[12],[1,"\\n "],[10,"li"],[14,0,"account-item"],[12],[1,"\\n "],[10,0],[14,0,"account-header"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["remotestorage",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 "],[10,0],[14,0,"account-status"],[12],[1,"\\n"],[41,[30,1,["connected"]],[[[1," "],[10,"strong"],[12],[1,[30,1,["userAddress"]]],[13],[1,"\\n"]],[]],[[[1," Not connected\\n"]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,"li"],[14,0,"account-item"],[12],[1,"\\n "],[10,0],[14,0,"account-header"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["map",18]],null],[1,"\\n "],[10,1],[12],[1,"OpenStreetMap"],[13],[1,"\\n "],[13],[1,"\\n"],[41,[30,0,["osmAuth","isConnected"]],[[[1," "],[11,"button"],[24,0,"btn-text text-danger"],[24,4,"button"],[4,[32,1],["click",[30,0,["disconnectOsm"]]],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,["connectOsm"]]],null],[12],[1,"Connect"],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n "],[10,0],[14,0,"account-status"],[12],[1,"\\n"],[41,[30,0,["osmAuth","isConnected"]],[[[1," "],[10,"strong"],[12],[1,[30,0,["osmAuth","userDisplayName"]]],[13],[1,"\\n"]],[]],[[[1," Not connected\\n"]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,"li"],[14,0,"account-item"],[12],[1,"\\n "],[10,0],[14,0,"account-header"],[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"],[41,[30,0,["nostrAuth","isConnected"]],[[[1," "],[11,"button"],[24,0,"btn-text text-danger"],[24,4,"button"],[4,[32,1],["click",[30,0,["disconnectNostr"]]],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,["openNostrConnectModal"]]],null],[12],[1,"Connect"],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n "],[10,0],[14,0,"account-status"],[12],[1,"\\n"],[41,[30,0,["nostrAuth","isConnected"]],[[[1," "],[10,"strong"],[15,"title",[30,0,["nostrAuth","pubkey"]]],[12],[1,"\\n "],[1,[30,0,["nostrData","userDisplayName"]]],[1,"\\n "],[13],[1,"\\n"]],[]],[[[1," Not connected\\n"]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13],[1,"\\n\\n"],[41,[30,0,["isNostrConnectModalOpen"]],[[[1," "],[8,[32,2],null,[["@onClose"],[[30,0,["closeNostrConnectModal"]]]],[["default"],[[[[1,"\\n "],[8,[32,3],null,[["@onConnect"],[[30,0,["closeNostrConnectModal"]]]],null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null]],["@storage"],["if"]]',moduleName:"(unknown template module)",scope:()=>({Icon:IconComponent,on:on,Modal:Modal,NostrConnect:NostrConnectComponent}),isStrictMode:!0}),this)}},all=taskAwareVariantOf(RSVP.Promise,"all",identity),allSettled=taskAwareVariantOf(RSVP,"allSettled",identity),race=taskAwareVariantOf(Promise$1,"race",identity),hash=taskAwareVariantOf(RSVP,"hash",getValues),hashSettled=taskAwareVariantOf(RSVP,"hashSettled",getValues);function identity(e){return e}function getValues(e){return Object.keys(e).map(t=>e[t])}function castForPromiseHelper(e){if(e)if(e instanceof TaskInstance)e.executor.asyncErrorsHandled=!0;else if(e instanceof Yieldable)return e._toPromise();return e}function castAwaitables(e,t){if(Array.isArray(e))return e.map(t);if("object"==typeof e&&null!==e){let r={};return Object.keys(e).forEach(n=>{r[n]=t(e[n])}),r}return e}function taskAwareVariantOf(e,t,r){return function(n){let i=castAwaitables(n,castForPromiseHelper),o=r(i);assert$4(`'${t}' expects an array.`,Array.isArray(o));let s=RSVP.defer();e[t](i).then(s.resolve,s.reject);let a=!1,l=()=>{a||(a=!0,o.forEach(e=>{e&&(e instanceof TaskInstance?e.cancel():"function"==typeof e.__ec_cancel__&&e[cancelableSymbol]())}))},c=s.promise.finally(l);return c[cancelableSymbol]=l,c}}var EmberYieldable=class extends Yieldable{_deferable(){return EMBER_ENVIRONMENT.defer()}},TimeoutYieldable=class extends EmberYieldable{constructor(e){super(),this.ms=e}onYield(e){let t=later(()=>e.next(),this.ms);return()=>cancel(t)}};function timeout(e){return new TimeoutYieldable(e)}var SearchBoxComponent=class extends Component{static{decorateFieldV2(this.prototype,"photon",[service])}#at=void initializeDeferredDecorator(this,"photon");static{decorateFieldV2(this.prototype,"osm",[service])}#pe=void initializeDeferredDecorator(this,"osm");static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");static{decorateFieldV2(this.prototype,"map",[service])}#ct=void initializeDeferredDecorator(this,"map");static{decorateFieldV2(this.prototype,"_internalQuery",[tracked],function(){return""})}#ut=void initializeDeferredDecorator(this,"_internalQuery");static{decorateFieldV2(this.prototype,"results",[tracked],function(){return[]})}#ht=void initializeDeferredDecorator(this,"results");static{decorateFieldV2(this.prototype,"isFocused",[tracked],function(){return!1})}#dt=void initializeDeferredDecorator(this,"isFocused");static{decorateFieldV2(this.prototype,"isLoading",[tracked],function(){return!1})}#pt=void initializeDeferredDecorator(this,"isLoading");get query(){return this.args.query??this._internalQuery}set query(e){this._internalQuery=e}get showPopover(){return this.isFocused&&this.results.length>0}handleInput(e){const t=e.target.value;this.query=t,this.args.onQueryChange&&this.args.onQueryChange(t),t.length<2?this.results=[]:this.searchTask.perform(t)}static{decorateMethodV2(this.prototype,"handleInput",[action])}formatSavedPlace(e){const t=(e._listIds||[]).map(e=>this.storage.lists?.find(t=>t.id===e)?.title).filter(Boolean).join(", "),r=t?`Saved place (${t})`:"Saved place";return{source:"saved",id:e.id,title:e.title,icon:"bookmark",description:r,osmId:e.osmId,osmType:e.osmType,lat:e.lat,lon:e.lon}}searchTask=buildTask(()=>({context:this,generator:function*(e){yield timeout(300);const t="string"==typeof e?e:this.query;if(!(t.length<2)){this.isLoading=!0;try{let e,r;this.mapUi.currentCenter&&({lat:e,lon:r}=this.mapUi.currentCenter);const n=t.toLowerCase(),i=POI_CATEGORIES.filter(e=>e.label.toLowerCase().includes(n)).map(e=>({source:"category",title:e.label,id:e.id,icon:"search"}));let o=[];n.length>=3&&(o=this.storage.savedPlaces.filter(e=>e.title&&e.title.toLowerCase().includes(n)).map(e=>this.formatSavedPlace(e)));const s=yield this.photon.search(t,e,r),a=new Set(o.map(e=>e.osmId).filter(Boolean)),l=s.filter(e=>!a.has(e.osmId));this.results=[...i,...o,...l]}catch(r){console.error("Search failed",r),this.results=[]}finally{this.isLoading=!1}}}}),{restartable:!0},"searchTask",null);handleFocus(){this.isFocused=!0,this.mapUi.setSearchBoxFocus(!0),this.query.length>=2&&0===this.results.length&&this.searchTask.perform()}static{decorateMethodV2(this.prototype,"handleFocus",[action])}handleBlur(){setTimeout(()=>{this.isFocused=!1,this.mapUi.setSearchBoxFocus(!1)},300)}static{decorateMethodV2(this.prototype,"handleBlur",[action])}handleSubmit(e){if(e.preventDefault(),!this.query)return;let t={q:this.query,selected:null,category:null};if(this.mapUi.currentCenter){const{lat:e,lon:r}=this.mapUi.currentCenter;t.lat=parseFloat(e).toFixed(4),t.lon=parseFloat(r).toFixed(4)}this.router.transitionTo("search",{queryParams:t}),this.isFocused=!1}static{decorateMethodV2(this.prototype,"handleSubmit",[action])}selectResult(e){if("category"===e.source){this.query=e.title,this.args.onQueryChange&&this.args.onQueryChange(e.title),this.results=[];let t=null,r=null;return this.mapUi.currentCenter&&(({lat:t,lon:r}=this.mapUi.currentCenter),t=t?.toString(),r=r?.toString()),void this.router.transitionTo("search",{queryParams:{q:e.title,category:e.id,selected:null,lat:t,lon:r}})}if(this.query=e.title,this.args.onQueryChange&&this.args.onQueryChange(e.title),this.results=[],"saved"===e.source&&e.id&&!e.osmId)this.router.transitionTo("place",e.id);else if(e.osmId){const t=`osm:${e.osmType}:${e.osmId}`;this.router.transitionTo("place",t)}else this.router.transitionTo("search",{queryParams:{q:e.title,lat:e.lat,lon:e.lon,selected:null,category:null}})}static{decorateMethodV2(this.prototype,"selectResult",[action])}clear(){this.searchTask.cancelAll(),this.mapUi.stopLoading(),this.osm.cancelAll(),this.photon.cancelAll(),this.query="",this.results=[],this.args.onQueryChange&&this.args.onQueryChange(""),this.router.transitionTo("index")}static{decorateMethodV2(this.prototype,"clear",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"search-box"],[12],[1,"\\n "],[11,"form"],[24,0,"search-form"],[4,[32,0],["submit",[30,0,["handleSubmit"]]],null],[12],[1,"\\n "],[11,"button"],[24,0,"menu-btn-integrated"],[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",20,"#5f6368"]],null],[1,"\\n "],[13],[1,"\\n\\n "],[11,"input"],[24,0,"search-input"],[24,"placeholder","Search places..."],[24,"aria-label","Search places"],[16,2,[30,0,["query"]]],[24,"autocomplete","off"],[24,4,"search"],[4,[32,0],["input",[30,0,["handleInput"]]],null],[4,[32,0],["focus",[30,0,["handleFocus"]]],null],[4,[32,0],["blur",[30,0,["handleBlur"]]],null],[12],[13],[1,"\\n\\n "],[10,"button"],[14,0,"search-submit-btn"],[14,"aria-label","Search"],[14,4,"submit"],[12],[1,"\\n"],[41,[28,[32,2],[[28,[32,3],[[30,0,["mapUi","loadingState","type"]],"text"],null],[28,[32,3],[[30,0,["mapUi","loadingState","type"]],"category"],null]],null],[[[1," "],[8,[32,1],null,[["@name","@size"],["loading-ring",20]],null],[1,"\\n"]],[]],[[[1," "],[8,[32,1],null,[["@name","@size","@color"],["search",20,"#5f6368"]],null],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n\\n"],[41,[30,0,["query"]],[[[1," "],[11,"button"],[24,0,"search-clear-btn"],[24,"aria-label","Clear"],[24,4,"button"],[4,[32,0],["click",[30,0,["clear"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",20,"#5f6368"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n"],[41,[30,0,["showPopover"]],[[[1," "],[10,0],[14,0,"search-results-popover"],[12],[1,"\\n "],[10,"ul"],[14,0,"search-results-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["results"]]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,0,"search-result-item"],[24,4,"button"],[4,[32,0],["click",[28,[32,4],[[30,0,["selectResult"]],[30,2]],null]],null],[12],[1,"\\n "],[10,0],[14,0,"result-icon"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],[[52,[30,2,["icon"]],[30,2,["icon"]],"map-pin"],16,"#666"]],null],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"result-info"],[12],[1,"\\n "],[10,1],[14,0,"result-title"],[12],[1,[30,2,["title"]]],[13],[1,"\\n"],[41,[28,[32,3],[[30,2,["source"]],"osm"],null],[[[1," "],[10,1],[14,0,"result-desc"],[12],[1,[28,[32,5],[[30,2,["type"]]],null]],[13],[1,"\\n"]],[]],[[[41,[30,2,["description"]],[[[1," "],[10,1],[14,0,"result-desc"],[12],[1,[30,2,["description"]]],[13],[1,"\\n"]],[]],null]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[2]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[13]],["@onToggleMenu","result"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({on:on,Icon:IconComponent,or:OrHelper,eq:eq$1,fn:fn,humanizeOsmTag:humanize_osm_tag_default}),isStrictMode:!0}),this)}},CategoryChipsComponent=class extends Component{static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");get categories(){return POI_CATEGORIES}searchCategory(e){this.args.onSelect&&this.args.onSelect(e);let t={category:e.id,q:null};if(this.mapUi.currentCenter){const{lat:e,lon:r}=this.mapUi.currentCenter;t.lat=parseFloat(e).toFixed(4),t.lon=parseFloat(r).toFixed(4)}this.router.transitionTo("search",{queryParams:t})}static{decorateMethodV2(this.prototype,"searchCategory",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"category-chips-scroll"],[12],[1,"\\n "],[10,0],[14,0,"category-chips-container"],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["categories"]]],null]],null],null,[[[1," "],[11,"button"],[24,0,"category-chip"],[16,"aria-label",[30,1,["label"]]],[16,"disabled",[28,[32,0],[[28,[32,1],[[30,0,["mapUi","loadingState","type"]],"category"],null],[28,[32,1],[[30,0,["mapUi","loadingState","value"]],[30,1,["id"]]],null]],null]],[24,4,"button"],[4,[32,2],["click",[28,[32,3],[[30,0,["searchCategory"]],[30,1]],null]],null],[12],[1,"\\n "],[8,[32,4],null,[["@name","@size"],[[30,1,["icon"]],16]],null],[1,"\\n "],[10,1],[12],[1,[30,1,["label"]]],[13],[1,"\\n "],[13],[1,"\\n"]],[1]],null],[1," "],[13],[1,"\\n"],[13]],["category"],["each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({and:AndHelper,eq:eq$1,on:on,fn:fn,Icon:IconComponent}),isStrictMode:!0}),this)}},CACHE_NAME="nostr-image-cache-v1",cached_image_default=modifier((e,[t])=>{let r=null;return async function(){if(t)try{const n=await caches.open(CACHE_NAME),i=await n.match(t);if(i){const t=await i.blob();return r=URL.createObjectURL(t),void(e.src=r)}const o=await fetch(t,{mode:"cors",credentials:"omit"});if(o.ok){const i=o.clone();await n.put(t,i);const s=await o.blob();r=URL.createObjectURL(s),e.src=r}else e.src=t}catch(error){console.warn(`Failed to cache image ${t}, falling back to standard src`,error),e.src=t}else e.src=""}(),()=>{r&&(URL.revokeObjectURL(r),r=null)}}),AppHeaderComponent=class extends Component{static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");static{decorateFieldV2(this.prototype,"nostrAuth",[service])}#x=void initializeDeferredDecorator(this,"nostrAuth");static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"isUserMenuOpen",[tracked],function(){return!1})}#ft=void initializeDeferredDecorator(this,"isUserMenuOpen");static{decorateFieldV2(this.prototype,"searchQuery",[tracked],function(){return""})}#gt=void initializeDeferredDecorator(this,"searchQuery");constructor(){super(...arguments),this.router&&"function"==typeof this.router.on&&this.router.on("routeDidChange",this.syncSearchQuery),this.syncSearchQuery()}willDestroy(){this.router&&"function"==typeof this.router.off&&this.router.off("routeDidChange",this.syncSearchQuery),super.willDestroy(...arguments)}syncSearchQuery(){const e=this.mapUi.currentSearch||this.router?.currentRoute?.queryParams;if(e?.q)this.searchQuery=e.q;else if(e?.category){const t=POI_CATEGORIES.find(t=>t.id===e.category);this.searchQuery=t?t.label:e.category}else this.searchQuery=""}static{decorateMethodV2(this.prototype,"syncSearchQuery",[action])}get isSearching(){return!(!this.mapUi.searchBoxHasFocus||!this.searchQuery)||("search"===this.router?.currentRouteName?!this.mapUi.loadingState&&this.mapUi.searchResults&&this.mapUi.searchResults.length>0:!("search"===this.router?.currentRouteName||!this.searchQuery))}get showQuickSearch(){const e=this.mapUi.currentZoom??13;return this.settings.showQuickSearchButtons&&e>=12}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}static{decorateMethodV2(this.prototype,"toggleUserMenu",[action])}closeUserMenu(){this.isUserMenuOpen=!1}static{decorateMethodV2(this.prototype,"closeUserMenu",[action])}handleQueryChange(e){this.searchQuery=e}static{decorateMethodV2(this.prototype,"handleQueryChange",[action])}handleChipSelect(e){this.searchQuery=e.label}static{decorateMethodV2(this.prototype,"handleChipSelect",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,"header"],[14,0,"app-header"],[12],[1,"\\n "],[10,0],[14,0,"header-left"],[12],[1,"\\n "],[8,[32,0],null,[["@query","@onToggleMenu","@onQueryChange"],[[30,0,["searchQuery"]],[30,1],[30,0,["handleQueryChange"]]]],null],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["showQuickSearch"]],[[[1," "],[10,0],[15,0,[29,["header-center ",[52,[30,0,["isSearching"]],"searching"]]]],[12],[1,"\\n "],[8,[32,1],null,[["@onSelect"],[[30,0,["handleChipSelect"]]]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\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,2],["click",[30,0,["toggleUserMenu"]]],null],[12],[1,"\\n"],[41,[28,[32,3],[[30,0,["nostrAuth","isConnected"]],[30,0,["nostrData","profile","picture"]]],null],[[[1," "],[11,"img"],[24,0,"user-avatar"],[24,"alt","User Avatar"],[4,[32,4],[[30,0,["nostrData","profile","picture"]]],null],[12],[13],[1,"\\n"]],[]],[[[1," "],[10,0],[14,0,"user-avatar-placeholder"],[12],[1,"\\n "],[8,[32,5],null,[["@name","@size","@color"],["user",20,"white"]],null],[1,"\\n "],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n\\n"],[41,[30,0,["isUserMenuOpen"]],[[[1," "],[8,[32,6],null,[["@storage","@onClose"],[[30,0,["storage"]],[30,0,["closeUserMenu"]]]],null],[1,"\\n "],[11,0],[24,0,"menu-backdrop"],[24,"role","button"],[4,[32,2],["click",[30,0,["closeUserMenu"]]],null],[12],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onToggleMenu"],["if"]]',moduleName:"(unknown template module)",scope:()=>({SearchBox:SearchBoxComponent,CategoryChips:CategoryChipsComponent,on:on,and:AndHelper,cachedImage:cached_image_default,Icon:IconComponent,UserMenu:UserMenuComponent}),isStrictMode:!0}),this)}},ToastComponent=class extends Component{static{decorateFieldV2(this.prototype,"toast",[service])}#fe=void initializeDeferredDecorator(this,"toast");static{setComponentTemplate(templateFactory({id:null,block:'[[[41,[30,0,["toast","isVisible"]],[[[1," "],[10,0],[14,0,"toast-notification"],[12],[1,"\\n "],[1,[30,0,["toast","message"]]],[1,"\\n "],[13],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",isStrictMode:!0}),this)}},application_exports$1=__exportAll({default:()=>ApplicationComponent}),ApplicationComponent=class extends Component{static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");get isSidebarOpen(){const e=this.router.currentRouteName;return this.mapUi.isSidebarVisible&&("place"===e||"place.new"===e||"search"===e||"menu"===e||e.startsWith("lists"))}constructor(){super(...arguments),console.debug("Application component constructed"),this.storage}toggleAppMenu(){"menu"===this.router.currentRouteName?this.router.transitionTo("index"):this.router.transitionTo("menu")}static{decorateMethodV2(this.prototype,"toggleAppMenu",[action])}handleOutsideClick(){const e=this.router.currentRouteName;("search"===e||"place"===e||"menu"===e||e.startsWith("lists"))&&(this.mapUi.clearSelection(),this.mapUi.hideSidebar(),"menu"===e||e.startsWith("lists")?this.router.transitionTo("index"):"place"===e&&(this.mapUi.returnToSearch&&this.mapUi.currentSearch?this.router.transitionTo("search",{queryParams:this.mapUi.currentSearch}):this.router.transitionTo("index")))}static{decorateMethodV2(this.prototype,"handleOutsideClick",[action])}refreshBookmarks(){this.storage.notifyChange()}static{decorateMethodV2(this.prototype,"refreshBookmarks",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[1,[28,[32,0],["Marco"],null]],[1,"\\n\\n"],[10,0],[15,0,[52,[30,0,["mapUi","isSidebarOpening"]],"sidebar-opening"]],[12],[1,"\\n "],[8,[32,1],null,[["@onToggleMenu"],[[30,0,["toggleAppMenu"]]]],null],[1,"\\n\\n "],[10,0],[14,1,"rs-widget-container"],[15,0,[52,[30,0,["storage","isWidgetOpen"]],"visible"]],[12],[13],[1,"\\n\\n"],[41,[30,0,["storage","isWidgetOpen"]],[[[1," "],[11,0],[24,0,"rs-backdrop"],[24,"role","button"],[4,[32,2],["click",[30,0,["storage","closeWidget"]]],null],[12],[13],[1,"\\n"]],[]],null],[1,"\\n "],[8,[32,3],null,[["@isSidebarOpen","@onOutsideClick"],[[30,0,["isSidebarOpen"]],[30,0,["handleOutsideClick"]]]],null],[1,"\\n\\n "],[8,[32,4],null,null,null],[1,"\\n\\n "],[46,[28,[31,2],null,null],null,null,null],[1,"\\n"],[13]],[],["if","component","-outlet"]]',moduleName:"(unknown template module)",scope:()=>({pageTitle:PageTitle,AppHeader:AppHeaderComponent,on:on,Map:MapComponent,Toast:ToastComponent}),isStrictMode:!0}),this)}},application_exports=__exportAll({default:()=>ApplicationRoute}),ApplicationRoute=class extends Route{static{decorateFieldV2(this.prototype,"osm",[service])}#pe=void initializeDeferredDecorator(this,"osm");static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage")},routes_exports=__exportAll({default:()=>IndexRoute}),IndexRoute=class extends Route{static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");activate(){this.mapUi.clearSearchResults(),this.mapUi.hideSidebar()}},icon_rounded_default='<svg\n width="1024"\n height="1024"\n viewBox="0 0 1024 1024"\n xmlns="http://www.w3.org/2000/svg"\n>\n \x3c!-- Background --\x3e\n <rect\n x="0"\n y="0"\n width="1024"\n height="1024"\n rx="220"\n fill="#F6E9A6"\n />\n\n \x3c!-- Subtle map grid (kept well outside safe zone) --\x3e\n <g stroke="#E6D88A" stroke-width="10" opacity="0.6">\n <line x1="256" y1="0" x2="256" y2="1024" />\n <line x1="512" y1="0" x2="512" y2="1024" />\n <line x1="768" y1="0" x2="768" y2="1024" />\n\n <line x1="0" y1="256" x2="1024" y2="256" />\n <line x1="0" y1="512" x2="1024" y2="512" />\n <line x1="0" y1="768" x2="1024" y2="768" />\n </g>\n\n \x3c!-- Location pin (exact app shape, larger, centered, safe-zone compliant) --\x3e\n \x3c!-- Safe zone target: ~680px diameter --\x3e\n <g\n transform="\n translate(512 512)\n scale(22)\n translate(-12 -12)\n "\n fill="#ea4335"\n stroke="#b31412"\n stroke-width="1"\n stroke-linecap="round"\n stroke-linejoin="round"\n >\n <path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" />\n <circle cx="12" cy="10" r="3" fill="#b31412" stroke="none" />\n </g>\n</svg>\n',home_default=setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"sidebar-header"],[12],[1,"\\n "],[10,"h2"],[12],[1,"\\n "],[10,1],[14,0,"app-logo-icon"],[12],[1,"\\n "],[1,[28,[32,0],[[32,1]],null]],[1,"\\n "],[13],[1,"\\n Marco\\n "],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,2],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,3],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,"ul"],[14,0,"app-menu"],[12],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,4,"button"],[4,[32,2],["click",[30,2]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size"],["bookmark",20]],null],[1,"\\n "],[10,1],[12],[1,"Collections"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,4,"button"],[4,[32,2],["click",[28,[32,4],[[30,3],"settings"],null]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size"],["settings",20]],null],[1,"\\n "],[10,1],[12],[1,"Settings"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,4,"button"],[4,[32,2],["click",[28,[32,4],[[30,3],"about"],null]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size"],["info",20]],null],[1,"\\n "],[10,1],[12],[1,"About"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onClose","@onSavedPlaces","@onNavigate"],[]]',moduleName:"(unknown template module)",scope:()=>({htmlSafe:htmlSafe,iconRounded:icon_rounded_default,on:on,Icon:IconComponent,fn:fn}),isStrictMode:!0}),templateOnly()),AppMenuSettingsMapUi=class extends Component{static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");static{setComponentTemplate(templateFactory({id:null,block:'[[[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["map",20]],null],[1,"\\n "],[10,1],[12],[1,"Map & UI"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content form-layout"],[12],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","show-quick-search"],[12],[1,"Quick search buttons visible"],[13],[1,"\\n "],[11,"select"],[24,1,"show-quick-search"],[24,0,"form-control"],[4,[32,1],["change",[28,[32,2],[[30,1],"showQuickSearchButtons"],null]],null],[12],[1,"\\n "],[10,"option"],[14,2,"true"],[15,"selected",[52,[30,0,["settings","showQuickSearchButtons"]],"selected"]],[12],[1,"\\n Yes\\n "],[13],[1,"\\n "],[10,"option"],[14,2,"false"],[15,"selected",[52,[51,[30,0,["settings","showQuickSearchButtons"]]],"selected"]],[12],[1,"\\n No\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[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,1],["change",[28,[32,2],[[30,1],"mapKinetic"],null]],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 "],[13],[1,"\\n"],[13]],["@onChange"],["if","unless"]]',moduleName:"(unknown template module)",scope:()=>({Icon:IconComponent,on:on,fn:fn}),isStrictMode:!0}),this)}},AppMenuSettingsApis=class extends Component{static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");static{setComponentTemplate(templateFactory({id:null,block:'[[[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["server",20]],null],[1,"\\n "],[10,1],[12],[1,"API Providers"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content form-layout"],[12],[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,1],["change",[28,[32,2],[[30,1],"overpassApi"],null]],null],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[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 "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","photon-api"],[12],[1,"Photon API Provider"],[13],[1,"\\n "],[11,"select"],[24,1,"photon-api"],[24,0,"form-control"],[4,[32,1],["change",[28,[32,2],[[30,1],"photonApi"],null]],null],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["settings","photonApis"]]],null]],null],null,[[[1," "],[10,"option"],[15,2,[30,3,["url"]]],[15,"selected",[52,[28,[32,3],[[30,3,["url"]],[30,0,["settings","photonApi"]]],null],"selected"]],[12],[1,"\\n "],[1,[30,3,["name"]]],[1,"\\n "],[13],[1,"\\n"]],[3]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onChange","api","api"],["each","-track-array","if"]]',moduleName:"(unknown template module)",scope:()=>({Icon:IconComponent,on:on,fn:fn,eq:eq$1}),isStrictMode:!0}),this)}},stripProtocol=e=>e?e.replace(/^wss?:\/\//,""):"",AppMenuSettingsNostr=class extends Component{static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");static{decorateFieldV2(this.prototype,"nostrData",[service])}#R=void initializeDeferredDecorator(this,"nostrData");static{decorateFieldV2(this.prototype,"toast",[service])}#fe=void initializeDeferredDecorator(this,"toast");static{decorateFieldV2(this.prototype,"newReadRelay",[tracked],function(){return""})}#mt=void initializeDeferredDecorator(this,"newReadRelay");static{decorateFieldV2(this.prototype,"newWriteRelay",[tracked],function(){return""})}#yt=void initializeDeferredDecorator(this,"newWriteRelay");get customReadRelays(){return excludeRequiredRelays(this.settings.nostrReadRelays||[],this.nostrData.requiredReadRelays)}get customWriteRelays(){return excludeRequiredRelays(this.settings.nostrWriteRelays||[],this.nostrData.requiredWriteRelays)}get readRelayExclusions(){return this.settings.nostrReadRelayExclusions||[]}get writeRelayExclusions(){return this.settings.nostrWriteRelayExclusions||[]}get requiredReadRelaySet(){return new Set(this.nostrData.requiredReadRelays.filter(Boolean))}get requiredWriteRelaySet(){return new Set(this.nostrData.requiredWriteRelays.filter(Boolean))}get mailboxReadRelaySet(){return new Set(this.nostrData.mailboxReadRelays)}get mailboxWriteRelaySet(){return new Set(this.nostrData.mailboxWriteRelays)}get hasReadOverrides(){return this.customReadRelays.length>0||this.readRelayExclusions.length>0}get hasWriteOverrides(){return this.customWriteRelays.length>0||this.writeRelayExclusions.length>0}get readRelaysForDisplay(){return this.nostrData.activeReadRelays.map(e=>({url:e,isRequired:this.requiredReadRelaySet.has(e)}))}get writeRelaysForDisplay(){return this.nostrData.activeWriteRelays.map(e=>({url:e,isRequired:this.requiredWriteRelaySet.has(e)}))}updateNewReadRelay(e){this.newReadRelay=e.target.value}static{decorateMethodV2(this.prototype,"updateNewReadRelay",[action])}updateNewWriteRelay(e){this.newWriteRelay=e.target.value}static{decorateMethodV2(this.prototype,"updateNewWriteRelay",[action])}addReadRelay(){const e=normalizeRelayUrl(this.newReadRelay);if(!e)return;const t=excludeRequiredRelays(mergeRequiredRelays(this.nostrData.requiredReadRelays,[...this.customReadRelays,e]),this.nostrData.requiredReadRelays),r=this.readRelayExclusions.filter(t=>normalizeRelayUrl(t)!==e);this.settings.update("nostrReadRelays",t.length>0?t:null),this.settings.update("nostrReadRelayExclusions",r.length>0?r:null),this.newReadRelay=""}static{decorateMethodV2(this.prototype,"addReadRelay",[action])}removeReadRelay(e){if(this.requiredReadRelaySet.has(e))return;const t=normalizeRelayUrl(e),r=this.customReadRelays.filter(e=>normalizeRelayUrl(e)!==t),n=this.mailboxReadRelaySet.has(t)?Array.from(new Set([...this.readRelayExclusions,t])):this.readRelayExclusions;this.settings.update("nostrReadRelays",r.length>0?r:null),this.settings.update("nostrReadRelayExclusions",n.length>0?n:null)}static{decorateMethodV2(this.prototype,"removeReadRelay",[action])}handleReadRelayKeydown(e){"Enter"===e.key&&this.addReadRelay()}static{decorateMethodV2(this.prototype,"handleReadRelayKeydown",[action])}handleWriteRelayKeydown(e){"Enter"===e.key&&this.addWriteRelay()}static{decorateMethodV2(this.prototype,"handleWriteRelayKeydown",[action])}resetReadRelays(){this.settings.update("nostrReadRelays",null),this.settings.update("nostrReadRelayExclusions",null)}static{decorateMethodV2(this.prototype,"resetReadRelays",[action])}addWriteRelay(){const e=normalizeRelayUrl(this.newWriteRelay);if(!e)return;const t=excludeRequiredRelays(mergeRequiredRelays(this.nostrData.requiredWriteRelays,[...this.customWriteRelays,e]),this.nostrData.requiredWriteRelays),r=this.writeRelayExclusions.filter(t=>normalizeRelayUrl(t)!==e);this.settings.update("nostrWriteRelays",t.length>0?t:null),this.settings.update("nostrWriteRelayExclusions",r.length>0?r:null),this.newWriteRelay=""}static{decorateMethodV2(this.prototype,"addWriteRelay",[action])}removeWriteRelay(e){if(this.requiredWriteRelaySet.has(e))return;const t=normalizeRelayUrl(e),r=this.customWriteRelays.filter(e=>normalizeRelayUrl(e)!==t),n=this.mailboxWriteRelaySet.has(t)?Array.from(new Set([...this.writeRelayExclusions,t])):this.writeRelayExclusions;this.settings.update("nostrWriteRelays",r.length>0?r:null),this.settings.update("nostrWriteRelayExclusions",n.length>0?n:null)}static{decorateMethodV2(this.prototype,"removeWriteRelay",[action])}resetWriteRelays(){this.settings.update("nostrWriteRelays",null),this.settings.update("nostrWriteRelayExclusions",null)}static{decorateMethodV2(this.prototype,"resetWriteRelays",[action])}async clearCache(){try{await this.nostrData.clearCache(),this.toast.show("Nostr cache cleared")}catch(e){this.toast.show(`Failed to clear Nostr cache: ${e.message}`)}}static{decorateMethodV2(this.prototype,"clearCache",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["zap",20]],null],[1,"\\n "],[10,1],[12],[1,"Nostr"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content form-layout"],[12],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","new-read-relay"],[12],[1,"Read Relays"],[13],[1,"\\n "],[10,"ul"],[14,0,"relay-list"],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["readRelaysForDisplay"]]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[10,1],[12],[1,[28,[32,1],[[30,1,["url"]]],null]],[13],[1,"\\n"],[41,[51,[30,1,["isRequired"]]],[[[1," "],[11,"button"],[24,0,"btn-remove-relay"],[24,"title","Remove relay"],[24,"aria-label","Remove"],[24,4,"button"],[4,[32,2],["click",[28,[32,3],[[30,0,["removeReadRelay"]],[30,1,["url"]]],null]],null],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size","@color"],["x",14,"currentColor"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"]],[1]],null],[1," "],[13],[1,"\\n "],[10,0],[14,0,"add-relay-input"],[12],[1,"\\n "],[11,"input"],[24,1,"new-read-relay"],[24,0,"form-control"],[24,"placeholder","relay.example.com"],[16,2,[30,0,["newReadRelay"]]],[24,4,"text"],[4,[32,2],["input",[30,0,["updateNewReadRelay"]]],null],[4,[32,2],["keydown",[30,0,["handleReadRelayKeydown"]]],null],[12],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-secondary"],[24,4,"button"],[4,[32,2],["click",[30,0,["addReadRelay"]]],null],[12],[1,"Add"],[13],[1,"\\n "],[13],[1,"\\n"],[41,[30,0,["hasReadOverrides"]],[[[1," "],[11,"button"],[24,0,"btn-link reset-relays"],[24,4,"button"],[4,[32,2],["click",[30,0,["resetReadRelays"]]],null],[12],[1,"\\n Reset to Defaults\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","new-write-relay"],[12],[1,"Write Relays"],[13],[1,"\\n "],[10,"ul"],[14,0,"relay-list"],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["writeRelaysForDisplay"]]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[10,1],[12],[1,[28,[32,1],[[30,2,["url"]]],null]],[13],[1,"\\n"],[41,[51,[30,2,["isRequired"]]],[[[1," "],[11,"button"],[24,0,"btn-remove-relay"],[24,"title","Remove relay"],[24,"aria-label","Remove"],[24,4,"button"],[4,[32,2],["click",[28,[32,3],[[30,0,["removeWriteRelay"]],[30,2,["url"]]],null]],null],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size","@color"],["x",14,"currentColor"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"]],[2]],null],[1," "],[13],[1,"\\n "],[10,0],[14,0,"add-relay-input"],[12],[1,"\\n "],[11,"input"],[24,1,"new-write-relay"],[24,0,"form-control"],[24,"placeholder","relay.example.com"],[16,2,[30,0,["newWriteRelay"]]],[24,4,"text"],[4,[32,2],["input",[30,0,["updateNewWriteRelay"]]],null],[4,[32,2],["keydown",[30,0,["handleWriteRelayKeydown"]]],null],[12],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-secondary"],[24,4,"button"],[4,[32,2],["click",[30,0,["addWriteRelay"]]],null],[12],[1,"Add"],[13],[1,"\\n "],[13],[1,"\\n"],[41,[30,0,["hasWriteOverrides"]],[[[1," "],[11,"button"],[24,0,"btn-link reset-relays"],[24,4,"button"],[4,[32,2],["click",[30,0,["resetWriteRelays"]]],null],[12],[1,"\\n Reset to Defaults\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","nostr-photo-fallback-uploads"],[12],[1,"Upload photos to fallback\\n servers"],[13],[1,"\\n "],[11,"select"],[24,1,"nostr-photo-fallback-uploads"],[24,0,"form-control"],[4,[32,2],["change",[28,[32,3],[[30,3],"nostrPhotoFallbackUploads"],null]],null],[12],[1,"\\n "],[10,"option"],[14,2,"true"],[15,"selected",[52,[30,0,["settings","nostrPhotoFallbackUploads"]],"selected"]],[12],[1,"\\n Yes\\n "],[13],[1,"\\n "],[10,"option"],[14,2,"false"],[15,"selected",[52,[51,[30,0,["settings","nostrPhotoFallbackUploads"]]],"selected"]],[12],[1,"\\n No\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[12],[1,"Cached data"],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline btn-full"],[24,4,"button"],[4,[32,2],["click",[30,0,["clearCache"]]],null],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size","@color"],["database",18,"var(--danger-color)"]],null],[1,"\\n Clear profiles, photos, and reviews\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["relay","relay","@onChange"],["each","-track-array","unless","if"]]',moduleName:"(unknown template module)",scope:()=>({Icon:IconComponent,stripProtocol:stripProtocol,on:on,fn:fn}),isStrictMode:!0}),this)}},AppMenuSettingsExperimental=class extends Component{static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");static{setComponentTemplate(templateFactory({id:null,block:'[[[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["alert-triangle",20]],null],[1,"\\n "],[10,1],[12],[1,"Experimental"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content form-layout"],[12],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","experimental-enable-photo-deletion"],[12],[1,"Enable photo deletion\\n (own photos)"],[13],[1,"\\n "],[11,"select"],[24,1,"experimental-enable-photo-deletion"],[24,0,"form-control"],[4,[32,1],["change",[28,[32,2],[[30,1],"experimentalEnablePhotoDeletion"],null]],null],[12],[1,"\\n "],[10,"option"],[14,2,"true"],[15,"selected",[52,[30,0,["settings","experimentalEnablePhotoDeletion"]],"selected"]],[12],[1,"\\n On\\n "],[13],[1,"\\n "],[10,"option"],[14,2,"false"],[15,"selected",[52,[51,[30,0,["settings","experimentalEnablePhotoDeletion"]]],"selected"]],[12],[1,"\\n Off\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onChange"],["if","unless"]]',moduleName:"(unknown template module)",scope:()=>({Icon:IconComponent,on:on,fn:fn}),isStrictMode:!0}),this)}},AppMenuSettings=class extends Component{static{decorateFieldV2(this.prototype,"settings",[service])}#A=void initializeDeferredDecorator(this,"settings");updateSetting(e,t){let r=t.target.value;"true"===r&&(r=!0),"false"===r&&(r=!1),this.settings.update(e,r)}static{decorateMethodV2(this.prototype,"updateSetting",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"sidebar-header has-back-btn"],[12],[1,"\\n "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[10,"h2"],[14,0,"sidebar-header-text-centered"],[12],[1,"Settings"],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,2]],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 "],[8,[32,2],null,[["@onChange"],[[30,0,["updateSetting"]]]],null],[1,"\\n "],[8,[32,3],null,[["@onChange"],[[30,0,["updateSetting"]]]],null],[1,"\\n "],[8,[32,4],null,[["@onChange"],[[30,0,["updateSetting"]]]],null],[1,"\\n "],[8,[32,5],null,[["@onChange"],[[30,0,["updateSetting"]]]],null],[1,"\\n "],[13],[1,"\\n"],[13]],["@onBack","@onClose"],[]]',moduleName:"(unknown template module)",scope:()=>({on:on,Icon:IconComponent,AppMenuSettingsMapUi:AppMenuSettingsMapUi,AppMenuSettingsApis:AppMenuSettingsApis,AppMenuSettingsNostr:AppMenuSettingsNostr,AppMenuSettingsExperimental:AppMenuSettingsExperimental}),isStrictMode:!0}),this)}},about_default=setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"sidebar-header has-back-btn"],[12],[1,"\\n "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[10,"h2"],[14,0,"sidebar-header-text-centered"],[12],[1,"About"],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,2]],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,"about-section"],[12],[1,"\\n "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Marco"],[13],[1,"\\n (as in\\n "],[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 that respects your\\n privacy and choices.\\n "],[13],[1,"\\n "],[10,2],[12],[1,"\\n Connect your own\\n "],[10,3],[14,6,"https://remotestorage.io/"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"remote storage"],[13],[1,"\\n to sync place bookmarks across apps and devices.\\n "],[13],[1,"\\n\\n "],[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size"],["gift",20]],null],[1,"\\n "],[10,1],[12],[1,"Open Source"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content"],[12],[1,"\\n "],[10,"table"],[12],[1,"\\n "],[10,"thead"],[12],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"th"],[12],[1,"Source"],[13],[1,"\\n "],[10,"th"],[12],[1,"License"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"tbody"],[12],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://gitea.kosmos.org/raucao/marco"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Marco App\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n "],[10,"abbr"],[14,"title","GNU Affero General Public License"],[12],[1,"AGPL"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://openstreetmap.org/copyright"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Map Data\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://opendatacommons.org/licenses/odbl/"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n "],[10,"abbr"],[14,"title","Open Data Commons Open Database License"],[12],[1,"ODbL"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://github.com/feathericons/feather"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Feather Icons\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://en.wikipedia.org/wiki/MIT_License"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n "],[10,"abbr"],[14,"title","MIT License"],[12],[1,"MIT"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://pinhead.ink/"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Pinhead Icons\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://github.com/waysidemapping/pinhead?tab=readme-ov-file#where-the-icons-are-from"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Various\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["heart",20,"#e5533d"]],null],[1,"\\n "],[10,1],[12],[1,"Contribute"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content"],[12],[1,"\\n "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Most impactful:"],[13],[1,"\\n Add and improve data for points of interest in\\n "],[10,3],[14,6,"https://www.openstreetmap.org"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"OpenStreetMap"],[13],[1,".\\n "],[13],[1,"\\n "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Most appreciated:"],[13],[1,"\\n Use this app as much as you can and\\n "],[10,3],[14,6,"https://community.remotestorage.io/t/marco-an-unhosted-maps-app/941"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"submit feedback"],[13],[1,"\\n about your experience, problems, feature wishes, etc.\\n "],[13],[1,"\\n "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Most supportive:"],[13],[1,"\\n Tell others about this app, on social media, in blog posts,\\n educational videos, etc.\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onBack","@onClose"],[]]',moduleName:"(unknown template module)",scope:()=>({on:on,Icon:IconComponent}),isStrictMode:!0}),templateOnly()),AppMenu=class extends Component{static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"currentView",[tracked],function(){return"menu"})}#vt=void initializeDeferredDecorator(this,"currentView");setView(e){this.currentView=e}static{decorateMethodV2(this.prototype,"setView",[action])}goToSavedPlaces(){this.router.transitionTo("lists.index")}static{decorateMethodV2(this.prototype,"goToSavedPlaces",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[10,0],[14,0,"sidebar app-menu-pane"],[12],[1,"\\n"],[41,[28,[32,0],[[30,0,["currentView"]],"menu"],null],[[[1," "],[8,[32,1],null,[["@onNavigate","@onClose","@onSavedPlaces"],[[30,0,["setView"]],[30,1],[30,0,["goToSavedPlaces"]]]],null],[1,"\\n\\n"]],[]],[[[41,[28,[32,0],[[30,0,["currentView"]],"settings"],null],[[[1," "],[8,[32,2],null,[["@onBack","@onClose"],[[28,[32,3],[[30,0,["setView"]],"menu"],null],[30,1]]],null],[1,"\\n\\n"]],[]],[[[41,[28,[32,0],[[30,0,["currentView"]],"about"],null],[[[1," "],[8,[32,4],null,[["@onBack","@onClose"],[[28,[32,3],[[30,0,["setView"]],"menu"],null],[30,1]]],null],[1,"\\n "]],[]],null]],[]]]],[]]],[13]],["@onClose"],["if"]]',moduleName:"(unknown template module)",scope:()=>({eq:eq$1,AppMenuHome:home_default,AppMenuSettings:AppMenuSettings,fn:fn,AppMenuAbout:about_default}),isStrictMode:!0}),this)}},menu_exports$1=__exportAll({default:()=>MenuTemplate}),MenuTemplate=class extends Component{static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");close(){this.router.transitionTo("index")}static{decorateMethodV2(this.prototype,"close",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[8,[32,0],null,[["@onClose"],[[30,0,["close"]]]],null]],[],[]]',moduleName:"(unknown template module)",scope:()=>({AppMenu:AppMenu}),isStrictMode:!0}),this)}},menu_exports=__exportAll({default:()=>MenuRoute}),MenuRoute=class extends Route{static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");activate(){this.mapUi.showSidebar()}},osm_callback_exports=__exportAll({default:()=>OauthOsmCallbackRoute}),OauthOsmCallbackRoute=class extends Route{static{decorateFieldV2(this.prototype,"osmAuth",[service])}#lt=void initializeDeferredDecorator(this,"osmAuth");static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");async model(){try{await this.osmAuth.handleCallback()}catch(e){console.error("Failed to handle OSM OAuth callback",e)}finally{this.router.transitionTo("index")}}},place_exports$1=__exportAll({default:()=>PlaceTemplate}),PlaceTemplate=class extends Component{static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");static{decorateFieldV2(this.prototype,"localPlace",[tracked],function(){return null})}#_t=void initializeDeferredDecorator(this,"localPlace");constructor(){super(...arguments),this.localPlace=this.args.model}get place(){const e=this.args.model,t=e.osmId||e.id;return this.storage.findPlaceById(t)||(!this.localPlace||this.localPlace.osmId!==t&&this.localPlace.id!==t?e.createdAt?{...e,id:void 0,createdAt:void 0,geohash:void 0}:e:this.localPlace)}handleUpdate(e){console.debug("Updating local place state:",e),this.localPlace=e,this.storage.notifyChange()}static{decorateMethodV2(this.prototype,"handleUpdate",[action])}refreshMap(){this.storage.notifyChange()}static{decorateMethodV2(this.prototype,"refreshMap",[action])}navigateBack(e){if(null===e)if(this.mapUi.returnToRoute){this.mapUi.showSidebar();const{name:e,model:t}=this.mapUi.returnToRoute;this.router.transitionTo(e,t)}else this.mapUi.returnToSearch&&this.mapUi.currentSearch?(this.mapUi.showSidebar(),this.router.transitionTo("search",{queryParams:this.mapUi.currentSearch})):this.router.transitionTo("index");else this.mapUi.showSidebar(),this.router.transitionTo("place",e)}static{decorateMethodV2(this.prototype,"navigateBack",[action])}close(){this.mapUi.clearSelection(),this.mapUi.hideSidebar(),this.mapUi.returnToSearch&&this.mapUi.currentSearch?this.router.transitionTo("search",{queryParams:this.mapUi.currentSearch}):this.router.transitionTo("index")}static{decorateMethodV2(this.prototype,"close",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[41,[30,0,["mapUi","isSidebarVisible"]],[[[1," "],[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],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({PlacesSidebar:PlacesSidebar}),isStrictMode:!0}),this)}},place_exports=__exportAll({default:()=>PlaceRoute}),PlaceRoute=class extends Route{static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"osm",[service])}#pe=void initializeDeferredDecorator(this,"osm");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");async model(e){const t=e.place_id;let r,n,i=!1;(t.startsWith("osm:node:")||t.startsWith("osm:way:")||t.startsWith("osm:relation:"))&&(i=!0,[,r,n]=t.split(":"),console.debug(`Fetching explicit OSM ${r}:`,n));let o=null;i&&(o=this.loadOsmPlace(n,r)),await this.waitForSync();let s=i?n:t,a=this.storage.findPlaceById(s);return a&&i&&a.osmType!==r&&(a=null),a?(console.debug("Found in bookmarks:",a.title),a):i?(console.debug(`Not in bookmarks, using explicitly fetched OSM ${r}:`,n),await o):(console.warn("Not in bookmarks:",t),null)}async waitForSync(){if(this.storage.initialSyncDone)return;console.debug("Waiting for initial storage sync...");const e=Date.now();for(;!this.storage.initialSyncDone;){if(Date.now()-e>5e3){console.warn("Timed out waiting for initial sync");break}await new Promise(e=>setTimeout(e,100))}}async afterModel(e){if(e&&e.osmId&&e.osmType&&"node"!==e.osmType&&!e.geojson){console.debug("Model missing geometry, fetching full OSM details...");const t=await this.loadOsmPlace(e.osmId,e.osmType);t&&(Object.assign(e,t),console.debug("Enriched model with full OSM details",e))}if(e){const t={preventZoom:this.mapUi.preventNextZoom};this.mapUi.selectPlace(e,t),this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!1}this.mapUi.stopSearch()}deactivate(){this.mapUi.clearSelection(),this.mapUi.returnToSearch=!1,this.mapUi.returnToRoute=null}async loadOsmPlace(e,t=null){try{const r=await this.osm.fetchOsmObject(e,t);if(r)return console.debug("Found OSM POI:",r),r}catch(r){console.error("Failed to fetch POI",r)}return null}setupController(e,t){super.setupController(e,t),this.checkUpdates(t)}async checkUpdates(e){if(e&&e.id&&e.osmId&&e.osmType){const t=await this.storage.refreshPlace(e);t&&this.mapUi.selectPlace(t,{preventZoom:!0})}}serialize(e){return e.osmId&&e.osmType?{place_id:`osm:${e.osmType}:${e.osmId}`}:e.id?{place_id:e.id}:{place_id:e.osmId}}},new_exports$1=__exportAll({default:()=>PlaceNewTemplate}),PlaceNewTemplate=class extends Component{static{decorateFieldV2(this.prototype,"router",[service])}#Le=void initializeDeferredDecorator(this,"router");static{decorateFieldV2(this.prototype,"storage",[service])}#Pe=void initializeDeferredDecorator(this,"storage");static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");get initialPlace(){return{title:"",description:""}}close(){this.router.transitionTo("index")}static{decorateMethodV2(this.prototype,"close",[action])}async savePlace(e){try{const t=this.mapUi.creationCoordinates||{lat:this.args.model.lat,lon:this.args.model.lon},r=parseFloat(t.lat.toFixed(6)),n=parseFloat(t.lon.toFixed(6)),i={title:e.title||"Untitled Place",description:e.description,lat:r,lon:n,tags:[],osmTags:{}},o=await this.storage.storePlace(i);console.debug("Created private place:",o.title),this.router.replaceWith("place",o)}catch(t){console.error("Failed to create place:",t),alert("Failed to create place: "+t.message)}}static{decorateMethodV2(this.prototype,"savePlace",[action])}static{setComponentTemplate(templateFactory({id:null,block:'[[[41,[30,0,["mapUi","isSidebarVisible"]],[[[1," "],[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],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({Icon:IconComponent,on:on,PlaceEditForm:PlaceEditForm}),isStrictMode:!0}),this)}},new_exports=__exportAll({default:()=>PlaceNewRoute}),PlaceNewRoute=class extends Route{static{decorateFieldV2(this.prototype,"mapUi",[service])}#Ae=void initializeDeferredDecorator(this,"mapUi");queryParams={lat:{refreshModel:!0},lon:{refreshModel:!0}};model(e){return{lat:parseFloat(e.lat),lon:parseFloat(e.lon)}}setupController(e,t){super.setupController(e,t),t.lat&&t.lon&&this.mapUi.updateCreationCoordinates(t.lat,t.lon),this.mapUi.startCreating(),this.mapUi.showSidebar()}deactivate(){this.mapUi.stopCreating()}},exportFastbootModules={},_embroider_entrypoint_default=Object.assign({},_embroider_implicit_modules_default,{"marco/config/environment":environment_exports,"marco/deprecation-workflow":deprecation_workflow_exports,"marco/router":router_exports,"marco/services/blossom":blossom_exports,"marco/services/image-processor":image_processor_exports$1,"marco/services/map-ui":map_ui_exports,"marco/services/nostr-auth":nostr_auth_exports,"marco/services/nostr-data":nostr_data_exports,"marco/services/nostr-relay":nostr_relay_exports,"marco/services/osm-auth":osm_auth_exports,"marco/services/osm":osm_exports,"marco/services/photon":photon_exports,"marco/services/settings":settings_exports,"marco/services/storage":storage_exports,"marco/services/toast":toast_exports,"marco/utils/device":device_exports,"marco/utils/format-text":format_text_exports,"marco/utils/geo":geo_exports,"marco/utils/geohash-coverage":geohash_coverage_exports,"marco/utils/icons":icons_exports,"marco/utils/nostr":nostr_exports,"marco/utils/osm-icons":osm_icons_exports,"marco/utils/osm":osm_exports$1,"marco/utils/photo-tag-suggestions":photo_tag_suggestions_exports,"marco/utils/place-mapping":place_mapping_exports,"marco/utils/poi-categories":poi_categories_exports,"marco/utils/poi-category-matcher":poi_category_matcher_exports,"marco/utils/social-links":social_links_exports,"marco/workers/image-processor":image_processor_exports,"marco/services/page-title":page_title_exports,"marco/templates/lists":lists_exports$3,"marco/routes/lists":lists_exports$2,"marco/templates/lists/list":list_exports$2,"marco/controllers/lists/list":list_exports$1,"marco/routes/lists/list":list_exports,"marco/templates/lists/index":lists_exports$1,"marco/routes/lists/index":lists_exports,"marco/templates/search":search_exports$2,"marco/controllers/search":search_exports$1,"marco/routes/search":search_exports,"marco/templates/application":application_exports$1,"marco/routes/application":application_exports,"marco/routes/index":routes_exports,"marco/templates/menu":menu_exports$1,"marco/routes/menu":menu_exports,"marco/routes/oauth/osm-callback":osm_callback_exports,"marco/templates/place":place_exports$1,"marco/routes/place":place_exports,"marco/templates/place/new":new_exports$1,"marco/routes/place/new":new_exports},exportFastbootModules),Cache=class{constructor(e,t,r){this.limit=e,this.func=t,this.store=r,this.size=0,this.misses=0,this.hits=0,this.store=r||new Map}get(e){let t=this.store.get(e);return this.store.has(e)?(this.hits++,this.store.get(e)):(this.misses++,t=this.set(e,this.func(e)),t)}set(e,t){return this.limit>this.size&&(this.size++,this.store.set(e,t)),t}purge(){this.store.clear(),this.size=0,this.hits=0,this.misses=0}},STRING_DASHERIZE_REGEXP=/[ _]/g,STRING_DASHERIZE_CACHE=new Cache(1e3,e=>decamelize(e).replace(STRING_DASHERIZE_REGEXP,"-")),STRING_CLASSIFY_REGEXP_1=/^(\-|_)+(.)?/,STRING_CLASSIFY_REGEXP_2=/(.)(\-|\_|\.|\s)+(.)?/g,STRING_CLASSIFY_REGEXP_3=/(^|\/|\.)([a-z])/g,CLASSIFY_CACHE=new Cache(1e3,e=>{const t=(e,t,r)=>r?`_${r.toUpperCase()}`:"",r=(e,t,r,n)=>t+(n?n.toUpperCase():""),n=e.split("/");for(let i=0;i<n.length;i++)n[i]=n[i].replace(STRING_CLASSIFY_REGEXP_1,t).replace(STRING_CLASSIFY_REGEXP_2,r);return n.join("/").replace(STRING_CLASSIFY_REGEXP_3,e=>e.toUpperCase())}),STRING_UNDERSCORE_REGEXP_1=/([a-z\d])([A-Z]+)/g,STRING_UNDERSCORE_REGEXP_2=/\-|\s+/g,UNDERSCORE_CACHE=new Cache(1e3,e=>e.replace(STRING_UNDERSCORE_REGEXP_1,"$1_$2").replace(STRING_UNDERSCORE_REGEXP_2,"_").toLowerCase()),STRING_DECAMELIZE_REGEXP=/([a-z\d])([A-Z])/g,DECAMELIZE_CACHE=new Cache(1e3,e=>e.replace(STRING_DECAMELIZE_REGEXP,"$1_$2").toLowerCase());function decamelize(e){return DECAMELIZE_CACHE.get(e)}function dasherize(e){return STRING_DASHERIZE_CACHE.get(e)}function classify(e){return CLASSIFY_CACHE.get(e)}function underscore(e){return UNDERSCORE_CACHE.get(e)}function classFactory(e){return{create:t=>"function"==typeof e.extend?e.extend(t):e}}var ModuleRegistry=class{constructor(e){this._entries=e||globalThis.requirejs.entries}moduleNames(){return Object.keys(this._entries)}has(e){return e in this._entries}get(...e){return globalThis.require(...e)}},Resolver=class{static moduleBasedResolver=!0;moduleBasedResolver=!0;_deprecatedPodModulePrefix=!1;_normalizeCache=Object.create(null);static create(e){return new this(e)}moduleNameLookupPatterns=[this.podBasedModuleName,this.podBasedComponentsInSubdir,this.mainModuleName,this.defaultModuleName,this.nestedColocationComponentModuleName];static withModules(e){return class extends(this){static explicitModules=e}}constructor(e){if(Object.assign(this,e),!this._moduleRegistry){let e=this.constructor.explicitModules;e?this._moduleRegistry={moduleNames:()=>Object.keys(e),has:t=>Boolean(e[t]),get:t=>e[t],addModules(t){e=Object.assign({},e,t)}}:(void 0===globalThis.requirejs.entries&&(globalThis.requirejs.entries=globalThis.requirejs._eak_seen),this._moduleRegistry=new ModuleRegistry)}this.pluralizedTypes=this.pluralizedTypes||Object.create(null),this.pluralizedTypes.config||(this.pluralizedTypes.config="config")}makeToString(e,t){return this.namespace.modulePrefix+"@"+t+":"}shouldWrapInClassFactory(){return!1}parseName(e){if(!0===e.parsedName)return e;let t,r,n,i=e.split("@");if(3===i.length){if(0===i[0].length){t=`@${i[1]}`;let e=i[2].split(":");r=e[0],n=e[1]}else t=`@${i[1]}`,r=i[0].slice(0,-1),n=i[2];"template:components"===r&&(n=`components/${n}`,r="template")}else if(2===i.length){let e=i[0].split(":");if(2===e.length)0===e[1].length?(r=e[0],n=`@${i[1]}`):(t=e[1],r=e[0],n=i[1]);else{let e=i[1].split(":");t=i[0],r=e[0],n=e[1]}"template"===r&&0===t.lastIndexOf("components/",0)&&(n=`components/${n}`,t=t.slice(11))}else i=e.split(":"),r=i[0],n=i[1];let o=n,s=this.namespace;return{parsedName:!0,fullName:e,prefix:t||this.prefix({type:r}),type:r,fullNameWithoutType:o,name:n,root:s,resolveMethodName:"resolve"+classify(r)}}resolveOther(e){assert("`modulePrefix` must be defined",this.namespace.modulePrefix);let t=this.findModuleName(e);if(t){let r=this._extractDefaultExport(t,e);if(void 0===r)throw new Error(` Expected to find: '${e.fullName}' within '${t}' but got 'undefined'. Did you forget to 'export default' within '${t}'?`);return this.shouldWrapInClassFactory(r,e)&&(r=classFactory(r)),r}}normalize(e){return this._normalizeCache[e]||(this._normalizeCache[e]=this._normalize(e))}resolve(e){if("resolver:current"===e)return{create:()=>this};let t,r=this.parseName(e),n=r.resolveMethodName;return"function"==typeof this[n]&&(t=this[n](r)),null==t&&(t=this.resolveOther(r)),t}addModules(e){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(e)}_normalize(e){let t=e.split(":");if(t.length>1){let e=t[0];return"component"===e||"helper"===e||"modifier"===e||"template"===e&&0===t[1].indexOf("components/")?e+":"+t[1].replace(/_/g,"-"):e+":"+dasherize(t[1].replace(/\./g,"/"))}return e}pluralize(e){return this.pluralizedTypes[e]||(this.pluralizedTypes[e]=e+"s")}podBasedLookupWithPrefix(e,t){let r=t.fullNameWithoutType;return"template"===t.type&&(r=r.replace(/^components\//,"")),e+"/"+r+"/"+t.type}podBasedModuleName(e){let t=this.namespace.podModulePrefix||this.namespace.modulePrefix;return this.podBasedLookupWithPrefix(t,e)}podBasedComponentsInSubdir(e){let t=this.namespace.podModulePrefix||this.namespace.modulePrefix;if(t+="/components","component"===e.type||/^components/.test(e.fullNameWithoutType))return this.podBasedLookupWithPrefix(t,e)}resolveEngine(e){let t=e.fullNameWithoutType+"/engine";if(this._moduleRegistry.has(t))return this._extractDefaultExport(t)}resolveRouteMap(e){let t=e.fullNameWithoutType,r=t+"/routes";if(this._moduleRegistry.has(r)){let e=this._extractDefaultExport(r);return assert(`The route map for ${t} should be wrapped by 'buildRoutes' before exporting.`,e.isRouteMap),e}}resolveTemplate(e){return this.resolveOther(e)}mainModuleName(e){if("main"===e.fullNameWithoutType)return e.prefix+"/"+e.type}defaultModuleName(e){return e.prefix+"/"+this.pluralize(e.type)+"/"+e.fullNameWithoutType}nestedColocationComponentModuleName(e){if("component"===e.type)return e.prefix+"/"+this.pluralize(e.type)+"/"+e.fullNameWithoutType+"/index"}prefix(e){let t=this.namespace.modulePrefix;return this.namespace[e.type+"Prefix"]&&(t=this.namespace[e.type+"Prefix"]),t}findModuleName(e){let t,r=this.moduleNameLookupPatterns;for(let n=0,i=r.length;n<i;n++){let i=r[n].call(this,e);if(i&&(i=this.chooseModuleName(i)),i&&this._moduleRegistry.has(i)&&(t=i),t)return t}}chooseModuleName(e){let t=underscore(e);if(e!==t&&this._moduleRegistry.has(e)&&this._moduleRegistry.has(t))throw new TypeError(`Ambiguous module names: '${e}' and '${t}'`);return this._moduleRegistry.has(e)?e:this._moduleRegistry.has(t)?t:void 0}knownForType(e){let t=this._moduleRegistry.moduleNames(),r=Object.create(null);for(let n=0,i=t.length;n<i;n++){let i=t[n],o=this.translateToContainerFullname(e,i);o&&(r[o]=!0)}return r}translateToContainerFullname(e,t){let r=this.prefix({type:e}),n=r+"/",i="/"+e,o=t.indexOf(n),s=t.indexOf(i);if(0===o&&s===t.length-i.length&&t.length>n.length+i.length)return e+":"+t.slice(o+n.length,s);let a=r+"/"+this.pluralize(e)+"/";return 0===t.indexOf(a)&&t.length>a.length?e+":"+t.slice(a.length):void 0}_extractDefaultExport(e){let t=this._moduleRegistry.get(e,null,null,!0);return t&&t.default&&(t=t.default),t}};function assert(e,t){if(!t)throw new Error(e)}function setupGlobal(e,t){globalThis.emberInspectorApps||(globalThis.emberInspectorApps=[]),globalThis.emberInspectorApps.push({app:e,name:`app-${globalThis.emberInspectorApps.length}`,loadCompatInspector:t}),globalThis.dispatchEvent&&globalThis.dispatchEvent(new Event("Ember"))}function ember_source_4_12_default(e){setupGlobal(e,()=>__vitePreload(()=>import("./modules-4-12-Oolr5NSt.js"),[]))}var App=class extends Application$1{modulePrefix=ENV.modulePrefix;podModulePrefix=ENV.podModulePrefix;Resolver=Resolver.withModules(_embroider_entrypoint_default);inspector=ember_source_4_12_default(this)};App.create(ENV.APP);export{fn$1 as $,generateGuid as $n,isDestroying as $r,keys as $t,debug_exports as A,EventDispatcher as An,observerListenerMetaFor as Ar,DOMTreeConstruction as At,modifierCapabilities as B,getViewClientRects as Bn,getFirst as Br,CursorImpl as Bt,map as C,FrameworkObject as Cn,Cache$1 as Cr,EMPTY_NAMED as Ct,Observable$1 as D,MutableEnumerable as Dn,computed as Dr,reifyArgs as Dt,createOperatorSubscriber as E,Comparable as En,PROPERTY_DID_CHANGE as Er,curry as Et,rehydrationBuilder as F,getChildViews as Fn,tagForProperty as Fr,SimpleDynamicAttribute as Ft,TEMPLATE_ONLY_COMPONENT_MANAGER as G,setViewElement as Gn,isObject as Gr,emptyArray as Gt,setHelperManager as H,getViewId as Hn,isDict as Hr,EMPTY_ARRAY$2 as Ht,namespace_exports as I,getElementView as In,getCustomTagFor as Ir,clientBuilder as It,templateOnlyComponent as J,observable_exports as Jn,consumeTag as Jr,reverse as Jt,TemplateOnlyComponentDefinition as K,EmberObject as Kn,tagFor as Kr,enumerate as Kt,CustomComponentManager as L,getRootViews as Ln,setCustomTagFor as Lr,dynamicAttribute as Lt,RehydrateTree as M,clearElementView as Mn,setObservers as Mr,NewTreeBuilder as Mt,SERIALIZATION_FIRST_NODE_STRING as N,clearViewElement as Nn,wrap$2 as Nr,RemoteBlock as Nt,nanoid$1 as O,mutable_exports as On,ROOT as Or,reifyNamed as Ot,isSerializationFirstNode as P,constructStyleDeprecationMessage as Pn,objectAt as Pr,ResettableBlockImpl as Pt,array$1 as Q,GUID_KEY as Qn,isDestroyed as Qr,entries as Qt,CustomModifierManager as R,getViewBoundingClientRect as Rn,StackImpl as Rr,normalizeProperty as Rt,argsOrArgArray as S,controller_exports as Sn,get$7 as Sr,EMPTY_ARGS as St,innerFrom as T,array_exports as Tn,setProxy as Tr,createCapturedArgs as Tt,setModifierManager$1 as U,isSimpleClick as Un,isIndexable$2 as Ur,EMPTY_NUMBER_ARRAY as Ut,setComponentManager$1 as V,getViewElement as Vn,getLast as Vr,clear$1 as Vt,getDebugName as W,setElementView as Wn,isPresentArray as Wr,EMPTY_STRING_ARRAY as Wt,concat$1 as X,ActionHandler as Xn,valueForTag as Xr,zipTuples as Xt,on$1 as Y,core_exports as Yn,validateTag as Yr,zipArrays as Yt,get$6 as Z,Mixin as Zn,destroy as Zr,assign as Zt,ActionSupport as _,capabilityFlagsFrom as _n,arrayContentWillChange as _r,resetDebuggerCallback as _t,gt$1 as a,peekMeta as ai,getInternalComponentManager as an,makeDictionary as ar,DOMChanges as at,logger$1 as b,RegistryProxyMixin as bn,alias as br,reference_exports as bt,lte as c,hasDestroyable as cn,runloop_exports as cr,EnvironmentImpl as ct,or as d,hasInternalModifierManager as dn,setName as dr,UpdatingVM as dt,registerDestructor$1 as ei,values as en,guidFor as er,hash$4 as et,invokeHelper as f,hasValue as fn,environment_exports$1 as fr,inTransaction as ft,states as g,setInternalModifierManager as gn,arrayContentDidChange as gr,renderSync as gt,CoreView as h,setInternalHelperManager as hn,addArrayObserver as hr,renderMain as ht,eq$2 as i,meta$1 as ii,CustomHelperManager as in,RSVP$1 as ir,instrumentation_exports as it,application_exports$2 as j,addChildView as jn,setListeners as jr,DynamicAttribute as jt,destroyable_exports as k,evented_exports as kn,checkHasSuper as kr,reifyPositional as kt,neq$1 as l,hasInternalComponentManager as ln,metal_exports as lr,LowLevelVM as lt,component_exports as m,setInternalComponentManager as mn,version_exports as mr,renderComponent as mt,rsvp_exports as n,UNDEFINED as ni,setComponentTemplate as nn,intern as nr,contentFor as nt,gte as o,setMeta as oi,getInternalHelperManager as on,owner_exports as or,DOMChangesImpl as ot,dist_exports as p,helperCapabilities as pn,setProperties as pr,isWhitespace as pt,TemplateOnlyComponentManager as q,object_exports as qn,combine as qr,isEmptyArray as qt,and as r,counters as ri,service_exports as rn,onerrorDefault as rr,MUTABLE_CELL as rt,lt$1 as s,__exportAll as si,getInternalModifierManager as sn,validator_exports as sr,DynamicScopeImpl as st,internals_exports as t,Meta as ti,getComponentTemplate as tn,uuid$1 as tr,ProxyMixin as tt,not$1 as u,hasInternalHelperManager as un,getName as ur,ScopeImpl as ut,TargetActionSupport as v,hasCapability as vn,removeArrayObserver as vr,runtimeOptions as vt,firstValueFrom as w,MutableArray as wn,isProxy as wr,EMPTY_POSITIONAL as wt,share as x,ContainerProxyMixin as xn,lookupDescriptor as xr,CurriedValue as xt,sha256 as y,managerHasCapability as yn,replace as yr,setDebuggerCallback as yt,componentCapabilities as z,getViewBounds as zn,dict as zr,ConcreteBounds as zt};