UNPKG

dicom-microscopy-viewer-changed

Version:
1 lines 766 kB
var ol=function(){"use strict";const t={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:'`renderMode` must be `"hybrid"` or `"vector"`',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"};class e extends Error{constructor(e){const i=t[e];super(i),this.code=e,this.name="AssertionError",this.message=i}}var i=e;function n(t){t.stopPropagation()}var r=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},s="propertychange";var o=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function a(t,e,i){let n,r;i=i||l;let s=0,o=t.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function l(t,e){return t>e?1:t<e?-1:0}function h(t,e){return t<e?1:t>e?-1:0}function c(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r<n;++r){const n=t[r];if(n===e)return r;if(n<e)return i(e,t[r-1],n)>0?r-1:r}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function u(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function d(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function g(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function f(t,e,i){const n=e||l;return t.every((function(e,r){if(0===r)return!0;const s=n(t[r-1],e);return!(s>0||i&&0===s)}))}function p(){return!0}function m(){return!1}function _(){}function y(t){let e,i,n,r=!1;return function(){const s=Array.prototype.slice.call(arguments);return r&&this===n&&g(s,i)||(r=!0,n=this,i=s,e=t.apply(this,arguments)),e}}function x(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}function v(t){for(const e in t)delete t[e]}function S(t){let e;for(e in t)return!1;return!e}var w=class extends o{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const s=e?new r(t):t;s.target||(s.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});let l;i in o||(o[i]=0,a[i]=0),++o[i];for(let t=0,e=n.length;t<e;++t)if(l="handleEvent"in n[t]?n[t].handleEvent(s):n[t].call(this,s),!1===l||s.propagationStopped){l=!1;break}if(0==--o[i]){let t=a[i];for(delete a[i];t--;)this.removeEventListener(i,_);delete o[i]}return l}disposeInternal(){this.listeners_&&v(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){const i=this.listeners_&&this.listeners_[t];if(i){const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=_,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}},E="change",T="error",C="contextmenu",R="click",b="dblclick",P="dragenter",I="dragover",F="drop",L="keydown",M="keypress",A="load",O="touchmove",N="wheel";function D(t,e,i,n,r){if(n&&n!==t&&(i=i.bind(n)),r){const n=i;i=function(){t.removeEventListener(e,i),n.apply(this,arguments)}}const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function k(t,e,i,n){return D(t,e,i,n,!0)}function G(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),v(t))}class j extends w{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(E)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=D(this,t[r],e);return n}return D(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=k(this,t[r],e)}else i=k(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)B(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}function B(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)G(t[e]);else G(t)}j.prototype.on,j.prototype.once,j.prototype.un;var U=j;function z(){throw new Error("Unimplemented abstract method.")}let X=0;function V(t){return t.ol_uid||(t.ol_uid=String(++X))}class W extends r{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}var Z=class extends U{constructor(t){super(),this.on,this.once,this.un,V(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new W(i,t,e)),i=s,this.hasListener(i)&&this.dispatchEvent(new W(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],S(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},Y="add",K="remove";const H="length";class q extends r{constructor(t,e,i){super(t),this.element=e,this.index=i}}class $ extends Z{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let t=0,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(H)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new q(Y,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new q(K,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new q(K,i,t)),this.dispatchEvent(new q(Y,e,t))}updateLength_(){this.set(H,this.array_.length)}assertUnique_(t,e){for(let n=0,r=this.array_.length;n<r;++n)if(this.array_[n]===t&&n!==e)throw new i(58)}}var J=0,Q=1,tt=2,et=3,it=4;function nt(t){return Math.pow(t,3)}function rt(t){return 1-nt(1-t)}function st(t){return 3*t*t-2*t*t*t}function ot(t){return t}var at=class extends w{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(E)}release(){this.state===et&&this.setState(it)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==tt)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==tt){t.interimTile=null;break}t.getState()==Q?e=t:t.getState()==J?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==et&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){z()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:nt(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}};const lt="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",ht=lt.includes("firefox"),ct=lt.includes("safari")&&!lt.includes("chrom"),ut=ct&&(lt.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(lt)),dt=lt.includes("webkit")&&!lt.includes("edge"),gt=lt.includes("macintosh"),ft="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,pt="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,mt="undefined"!=typeof Image&&Image.prototype.decode,_t=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}();function yt(t,e,i,n){let r;return r=i&&i.length?i.shift():pt?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}function xt(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function vt(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function St(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function wt(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function Et(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}function Tt(t){for(;t.lastChild;)t.removeChild(t.lastChild)}function Ct(t,e){const i=t.childNodes;for(let n=0;;++n){const r=i[n],s=e[n];if(!r&&!s)break;r!==s&&(r?s?t.insertBefore(s,r):(t.removeChild(r),--n):t.appendChild(s))}}function Rt(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?t:null}function bt(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t instanceof DataView?t:null}let Pt=null;function It(t){Pt||(Pt=yt(t.width,t.height,void 0,{willReadFrequently:!0}));const e=Pt.canvas,i=t.width;e.width!==i&&(e.width=i);const n=t.height;return e.height!==n&&(e.height=n),Pt.clearRect(0,0,i,n),Pt.drawImage(t,0,0),Pt.getImageData(0,0,i,n).data}const Ft=[256,256];var Lt=class extends at{constructor(t){const e=J;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null}getSize(){if(this.size_)return this.size_;const t=Rt(this.data_);return t?[t.width,t.height]:Ft}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==J&&this.state!==et)return;this.state=Q,this.changed();const t=this;this.loader_().then((function(e){t.data_=e,t.state=tt,t.changed()})).catch((function(e){t.error_=e,t.state=et,t.changed()}))}};function Mt(t,e){if(!t)throw new i(e)}class At extends Z{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new At(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());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_&&(G(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=D(t,E,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Ot(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Ot(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{Mt("function"==typeof t.getZIndex,41);e=[t]}return function(){return e}}var Nt=At;const Dt=new Array(6);function kt(){return[1,0,0,1,0,0]}function Gt(t){return Bt(t,1,0,0,1,0,0)}function jt(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],c=e[2],u=e[3],d=e[4],g=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*c+r*u,t[3]=n*c+s*u,t[4]=i*d+r*g+o,t[5]=n*d+s*g+a,t}function Bt(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function Ut(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function zt(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Xt(t,e){const i=Math.cos(e),n=Math.sin(e);return jt(t,Bt(Dt,i,n,-n,i,0,0))}function Vt(t,e,i){return jt(t,Bt(Dt,e,0,0,i,0,0))}function Wt(t,e,i){return Bt(t,e,0,0,i,0,0)}function Zt(t,e,i){return jt(t,Bt(Dt,1,0,0,1,e,i))}function Yt(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function Kt(t,e){const i=Ht(e);Mt(0!==i,32);const n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return t[0]=o/i,t[1]=-r/i,t[2]=-s/i,t[3]=n/i,t[4]=(s*l-o*a)/i,t[5]=-(n*l-r*a)/i,t}function Ht(t){return t[0]*t[3]-t[1]*t[2]}let qt;function $t(t){const e="matrix("+t.join(", ")+")";if(pt)return e;const i=qt||(qt=document.createElement("div"));return i.style.transform=e,i.style.transform}var Jt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Qt(t){const e=ae();for(let i=0,n=t.length;i<n;++i)pe(e,t[i]);return e}function te(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function ee(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function ie(t,e,i){let n,r;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,r=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+r*r}function ne(t,e){return se(t,e[0],e[1])}function re(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function se(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function oe(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=e[0],a=e[1];let l=Jt.UNKNOWN;return o<i?l|=Jt.LEFT:o>r&&(l|=Jt.RIGHT),a<n?l|=Jt.BELOW:a>s&&(l|=Jt.ABOVE),l===Jt.UNKNOWN&&(l=Jt.INTERSECTING),l}function ae(){return[1/0,1/0,-1/0,-1/0]}function le(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function he(t){return le(1/0,1/0,-1/0,-1/0,t)}function ce(t,e){const i=t[0],n=t[1];return le(i,n,i,n,e)}function ue(t,e,i,n,r){return _e(he(r),t,e,i,n)}function de(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ge(t,e,i){return Math.abs(t[0]-e[0])<i&&Math.abs(t[2]-e[2])<i&&Math.abs(t[1]-e[1])<i&&Math.abs(t[3]-e[3])<i}function fe(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function pe(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function me(t,e){for(let i=0,n=e.length;i<n;++i)pe(t,e[i]);return t}function _e(t,e,i,n,r){for(;i<n;i+=r)xe(t,e[i],e[i+1]);return t}function ye(t,e){for(let i=0,n=e.length;i<n;++i)me(t,e[i]);return t}function xe(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function ve(t,e){let i;return i=e(we(t)),i||(i=e(Ee(t)),i||(i=e(Le(t)),i||(i=e(Fe(t)),i||!1)))}function Se(t){let e=0;return Oe(t)||(e=Me(t)*Pe(t)),e}function we(t){return[t[0],t[1]]}function Ee(t){return[t[2],t[1]]}function Te(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Ce(t,e){let i;return"bottom-left"===e?i=we(t):"bottom-right"===e?i=Ee(t):"top-left"===e?i=Fe(t):"top-right"===e?i=Le(t):Mt(!1,13),i}function Re(t,e,i,n,r){const[s,o,a,l,h,c,u,d]=be(t,e,i,n);return le(Math.min(s,a,h,u),Math.min(o,l,c,d),Math.max(s,a,h,u),Math.max(o,l,c,d),r)}function be(t,e,i,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=r*o,h=r*a,c=s*o,u=s*a,d=t[0],g=t[1];return[d-l+u,g-h-c,d-l-u,g-h+c,d+l-u,g+h+c,d+l+u,g+h-c,d-l+u,g-h-c]}function Pe(t){return t[3]-t[1]}function Ie(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return Ae(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):he(n),n}function Fe(t){return[t[0],t[3]]}function Le(t){return[t[2],t[3]]}function Me(t){return t[2]-t[0]}function Ae(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Oe(t){return t[2]<t[0]||t[3]<t[1]}function Ne(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}function De(t,e){const i=(t[2]-t[0])/2*(e-1),n=(t[3]-t[1])/2*(e-1);t[0]-=i,t[2]+=i,t[1]-=n,t[3]+=n}function ke(t,e,i){let n=!1;const r=oe(t,e),s=oe(t,i);if(r===Jt.INTERSECTING||s===Jt.INTERSECTING)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],c=e[0],u=e[1],d=i[0],g=i[1],f=(g-u)/(d-c);let p,m;s&Jt.ABOVE&&!(r&Jt.ABOVE)&&(p=d-(g-h)/f,n=p>=o&&p<=l),n||!(s&Jt.RIGHT)||r&Jt.RIGHT||(m=g-(d-l)*f,n=m>=a&&m<=h),n||!(s&Jt.BELOW)||r&Jt.BELOW||(p=d-(g-a)/f,n=p>=o&&p<=l),n||!(s&Jt.LEFT)||r&Jt.LEFT||(m=g-(d-o)*f,n=m>=a&&m<=h)}return n}function Ge(t,e,i,n){if(Oe(t))return he(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s<n;++s)r.push(t[0]+e*s/n,t[1],t[2],t[1]+i*s/n,t[2]-e*s/n,t[3],t[0],t[3]-i*s/n)}else r=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(r,r,2);const s=[],o=[];for(let t=0,e=r.length;t<e;t+=2)s.push(r[t]),o.push(r[t+1]);return function(t,e,i){return le(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(s,o,i)}function je(t,e){const i=e.getExtent(),n=Te(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=Me(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function Be(t,e){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];je(t,e);const n=Me(i);if(Me(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]<i[0])return[[t[0]+n,t[1],i[2],t[3]],[i[0],t[1],t[2],t[3]]];if(t[2]>i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}const Ue={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function ze(t){return Ue[t]}const Xe={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Ve=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Xe[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}};const We=6378137,Ze=Math.PI*We,Ye=[-Ze,-Ze,Ze,Ze],Ke=[-180,-85,180,85],He=We*Math.log(Math.tan(Math.PI/2));class qe extends Ve{constructor(t){super({code:t,units:"m",extent:Ye,global:!0,worldExtent:Ke,getPointResolution:function(t,e){return t/Math.cosh(e[1]/We)}})}}const $e=[new qe("EPSG:3857"),new qe("EPSG:102100"),new qe("EPSG:102113"),new qe("EPSG:900913"),new qe("http://www.opengis.net/def/crs/EPSG/0/3857"),new qe("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Je(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let r=0;r<n;r+=i){e[r]=Ze*t[r]/180;let i=We*Math.log(Math.tan(Math.PI*(+t[r+1]+90)/360));i>He?i=He:i<-He&&(i=-He),e[r+1]=i}return e}function Qe(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let r=0;r<n;r+=i)e[r]=180*t[r]/Ze,e[r+1]=360*Math.atan(Math.exp(t[r+1]/We))/Math.PI-90;return e}const ti=6378137,ei=[-180,-90,180,90],ii=Math.PI*ti/180;class ni extends Ve{constructor(t,e){super({code:t,units:"degrees",extent:ei,axisOrientation:e,global:!0,metersPerUnit:ii,worldExtent:ei})}}const ri=[new ni("CRS:84"),new ni("EPSG:4326","neu"),new ni("urn:ogc:def:crs:OGC:1.3:CRS84"),new ni("urn:ogc:def:crs:OGC:2:84"),new ni("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ni("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ni("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let si={};function oi(){si={}}function ai(t){return si[t]||si[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function li(t,e){si[t]=e}let hi={};function ci(){hi={}}function ui(t,e,i){const n=t.getCode(),r=e.getCode();n in hi||(hi[n]={}),hi[n][r]=i}function di(t,e){let i;return t in hi&&e in hi[t]&&(i=hi[t][e]),i}function gi(t,e,i){return Math.min(Math.max(t,e),i)}function fi(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return pi(t,e,i,n)}function pi(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function mi(t){const e=t.length;for(let i=0;i<e;i++){let n=i,r=Math.abs(t[i][i]);for(let s=i+1;s<e;s++){const e=Math.abs(t[s][i]);e>r&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n<e;n++){const r=-t[n][i]/t[i][i];for(let s=i;s<e+1;s++)i==s?t[n][s]=0:t[n][s]+=r*t[i][s]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}function _i(t){return 180*t/Math.PI}function yi(t){return t*Math.PI/180}function xi(t,e){const i=t%e;return i*e<0?i+e:i}function vi(t,e,i){return t+i*(e-t)}function Si(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function wi(t,e){return Math.round(Si(t,e))}function Ei(t,e){return Math.floor(Si(t,e))}function Ti(t,e){return Math.ceil(Si(t,e))}function Ci(t,e,i){const n=void 0!==i?t.toFixed(i):""+t;let r=n.indexOf(".");return r=-1===r?n.length:r,r>e?n:new Array(1+e-r).join("0")+n}function Ri(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;t<Math.max(i.length,n.length);t++){const e=parseInt(i[t]||"0",10),r=parseInt(n[t]||"0",10);if(e>r)return 1;if(r>e)return-1}return 0}function bi(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Pi(t,e){const i=e.getRadius(),n=e.getCenter(),r=n[0],s=n[1];let o=t[0]-r;const a=t[1]-s;0===o&&0===a&&(o=1);const l=Math.sqrt(o*o+a*a);return[r+i*o/l,s+i*a/l]}function Ii(t,e){const i=t[0],n=t[1],r=e[0],s=e[1],o=r[0],a=r[1],l=s[0],h=s[1],c=l-o,u=h-a,d=0===c&&0===u?0:(c*(i-o)+u*(n-a))/(c*c+u*u||0);let g,f;return d<=0?(g=o,f=a):d>=1?(g=l,f=h):(g=o+d*c,f=a+d*u),[g,f]}function Fi(t,e,i){const n=xi(e+180,360)-180,r=Math.abs(3600*n),s=i||0;let o=Math.floor(r/3600),a=Math.floor((r-3600*o)/60),l=Si(r-3600*o-60*a,s);l>=60&&(l=0,a+=1),a>=60&&(a=0,o+=1);let h=o+"°";return 0===a&&0===l||(h+=" "+Ci(a,2)+"′"),0!==l&&(h+=" "+Ci(l,2,s)+"″"),0!==n&&(h+=" "+t.charAt(n<0?1:0)),h}function Li(t,e,i){return t?e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i)):""}function Mi(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Ai(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function Oi(t,e){return t[0]*=e,t[1]*=e,t}function Ni(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Di(t,e){return Math.sqrt(Ni(t,e))}function ki(t,e){return Ni(t,Ii(t,e))}function Gi(t,e){return Li(t,"{x}, {y}",e)}function ji(t,e){if(e.canWrapX()){const i=Me(e.getExtent()),n=Bi(t,e,i);n&&(t[0]-=n*i)}return t}function Bi(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||Me(n),r=Math.floor((t[0]-n[0])/i)),r}const Ui=6371008.8;function zi(t,e,i){i=i||Ui;const n=yi(t[1]),r=yi(e[1]),s=(r-n)/2,o=yi(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Xi(t,e){let i=0;for(let n=0,r=t.length;n<r-1;++n)i+=zi(t[n],t[n+1],e);return i}function Vi(t,e){let i=0;const n=t.length;let r=t[n-1][0],s=t[n-1][1];for(let e=0;e<n;e++){const n=t[e][0],o=t[e][1];i+=yi(n-r)*(2+Math.sin(yi(s))+Math.sin(yi(o))),r=n,s=o}return i*e*e/2}function Wi(t,e,i,n){n=n||Ui;const r=yi(t[1]),s=yi(t[0]),o=e/n,a=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(i));return[_i(s+Math.atan2(Math.sin(i)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(a))),_i(a)]}const Zi={info:1,warn:2,error:3,none:4};let Yi=Zi.info;function Ki(...t){Yi>Zi.warn||console.warn(...t)}function Hi(...t){Yi>Zi.error||console.error(...t)}let qi=!0;function $i(t){qi=!(void 0===t||t)}function Ji(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function Qi(t,e){if(void 0!==e&&t!==e){for(let i=0,n=t.length;i<n;++i)e[i]=t[i];t=e}return t}function tn(t){li(t.getCode(),t),ui(t,t,Ji)}function en(t){t.forEach(tn)}function nn(t){return"string"==typeof t?ai(t):t||null}function rn(t,e,i,n){let r;const s=(t=nn(t)).getPointResolutionFunc();if(s){if(r=s(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(r=r*e/Xe[n])}}else{const s=t.getUnits();if("degrees"==s&&!n||"degrees"==n)r=e;else{const o=un(t,nn("EPSG:4326"));if(o===Qi&&"degrees"!==s)r=e*t.getMetersPerUnit();else{let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2);r=(zi(t.slice(0,2),t.slice(2,4))+zi(t.slice(4,6),t.slice(6,8)))/2}const a=n?Xe[n]:t.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function sn(t){en(t),t.forEach((function(e){t.forEach((function(t){e!==t&&ui(e,t,Ji)}))}))}function on(t,e,i,n){t.forEach((function(t){e.forEach((function(e){ui(t,e,i),ui(e,t,n)}))}))}function an(t,e){return t?"string"==typeof t?nn(t):t:nn(e)}function ln(t){return function(e,i,n){const r=e.length;n=void 0!==n?n:2,i=void 0!==i?i:new Array(r);for(let s=0;s<r;s+=n){const r=t(e.slice(s,s+n)),o=r.length;for(let t=0,a=n;t<a;++t)i[s+t]=t>=o?e[s+t]:r[t]}return i}}function hn(t,e,i,n){const r=nn(t),s=nn(e);ui(r,s,ln(i)),ui(s,r,ln(n))}function cn(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return un(t,e)===Ji&&i}function un(t,e){let i=di(t.getCode(),e.getCode());return i||(i=Qi),i}function dn(t,e){return un(nn(t),nn(e))}function gn(t,e,i){return dn(e,i)(t,void 0,t.length)}function fn(t,e,i,n){return Ge(t,dn(e,i),void 0,n)}let pn=null;function mn(t){pn=nn(t)}function _n(){return pn}function yn(t,e){return pn?gn(t,e,pn):t}function xn(t,e){return pn?gn(t,pn,e):(qi&&!Mi(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(qi=!1,Ki("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function vn(t,e){return pn?fn(t,e,pn):t}function Sn(t,e){return pn?fn(t,pn,e):t}function wn(t,e){if(!pn)return t;const i=nn(e).getUnits(),n=pn.getUnits();return i&&n?t*Xe[i]/Xe[n]:t}function En(t,e){if(!pn)return t;const i=nn(e).getUnits(),n=pn.getUnits();return i&&n?t*Xe[n]/Xe[i]:t}function Tn(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=Me(e);s=Bi(n=n.slice(0),t,o),s&&(n[0]=n[0]-s*o),n[0]=gi(n[0],e[0],e[2]),n[1]=gi(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*Me(e.getExtent())),r}}function Cn(){sn($e),sn(ri),on(ri,$e,Je,Qe)}function Rn(t,e,i,n,r,s){s=s||[];let o=0;for(let a=e;a<i;a+=n){const e=t[a],i=t[a+1];s[o++]=r[0]*e+r[2]*i+r[4],s[o++]=r[1]*e+r[3]*i+r[5]}return s&&s.length!=o&&(s.length=o),s}function bn(t,e,i,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),h=s[0],c=s[1];let u=0;for(let r=e;r<i;r+=n){const e=t[r]-h,i=t[r+1]-c;o[u++]=h+e*a-i*l,o[u++]=c+e*l+i*a;for(let e=r+2;e<r+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}function Pn(t,e,i,n,r,s,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let o=e;o<i;o+=n){const e=t[o]-l,i=t[o+1]-h;a[c++]=l+r*e,a[c++]=h+s*i;for(let e=o+2;e<o+n;++e)a[c++]=t[e]}return a&&a.length!=c&&(a.length=c),a}function In(t,e,i,n,r,s,o){o=o||[];let a=0;for(let l=e;l<i;l+=n){o[a++]=t[l]+r,o[a++]=t[l+1]+s;for(let e=l+2;e<l+n;++e)o[a++]=t[e]}return o&&o.length!=a&&(o.length=a),o}Cn();const Fn=[1,0,0,1,0,0];var Ln=class extends Z{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=y((function(t,e,i){if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)}))}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return z()}closestPointXY(t,e,i,n){return z()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return z()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&he(t),this.extentRevision_=this.getRevision()}return Ne(this.extent_,t)}rotate(t,e){z()}scale(t,e,i){z()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return z()}getType(){return z()}applyTransform(t){z()}intersectsExtent(t){return z()}translate(t,e){z()}transform(t,e){const i=nn(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=Pe(o)/Pe(s);return Yt(Fn,o[0],o[3],a,-a,0,0,0),Rn(t,0,t.length,r,Fn,n),dn(i,e)(t,n,r)}:dn(i,e);return this.applyTransform(n),this}};function Mn(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function An(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const r=t.getStride();return Rn(n,0,n.length,r,e,i)}var On=class extends Ln{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return ue(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return z()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Mn(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){z()}setLayout(t,e,i){let n;if(t)n=Mn(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=function(t){let e;2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM");return e}(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();bn(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=Te(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();Pn(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();In(i,0,i.length,n,t,e,i),this.changed()}}};function Nn(t,e,i,n,r,s,o){const a=t[e],l=t[e+1],h=t[i]-a,c=t[i+1]-l;let u;if(0===h&&0===c)u=e;else{const d=((r-a)*h+(s-l)*c)/(h*h+c*c);if(d>1)u=i;else{if(d>0){for(let r=0;r<n;++r)o[r]=vi(t[e+r],t[i+r],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function Dn(t,e,i,n,r){let s=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=pi(s,o,i,n);a>r&&(r=a),s=i,o=n}return r}function kn(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=Dn(t,e,o,n,r),e=o}return r}function Gn(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=kn(t,e,o,n,r),e=o[o.length-1]}return r}function jn(t,e,i,n,r,s,o,a,l,h,c){if(e==i)return h;let u,d;if(0===r){if(d=pi(o,a,t[e],t[e+1]),d<h){for(u=0;u<n;++u)l[u]=t[e+u];return l.length=n,d}return h}c=c||[NaN,NaN];let g=e+n;for(;g<i;)if(Nn(t,g-n,g,n,o,a,c),d=pi(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,g+=n}else g+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(s&&(Nn(t,i-n,e,n,o,a,c),d=pi(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function Bn(t,e,i,n,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=jn(t,e,d,n,r,s,o,a,l,h,c),e=d}return h}function Un(t,e,i,n,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=Bn(t,e,d,n,r,s,o,a,l,h,c),e=d[d.length-1]}return h}function zn(t,e,i,n){for(let n=0,r=i.length;n<r;++n)t[e++]=i[n];return e}function Xn(t,e,i,n){for(let r=0,s=i.length;r<s;++r){const s=i[r];for(let i=0;i<n;++i)t[e++]=s[i]}return e}function Vn(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=Xn(t,e,i[o],n);r[s++]=a,e=a}return r.length=s,r}function Wn(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=Vn(t,e,i[o],n,r[s]);0===a.length&&(a[0]=e),r[s++]=a,e=a[a.length-1]}return r.length=s,r}function Zn(t,e,i,n,r,s,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let c=0;for(;h.length>0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],u=t[s+1],d=t[i],g=t[i+1];for(let e=s+n;e<i;e+=n){const i=fi(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>r&&(l[(c-e)/n]=1,s+n<c&&h.push(s,c),c+n<i&&h.push(c,i))}for(let i=0;i<a;++i)l[i]&&(s[o++]=t[e+i*n],s[o++]=t[e+i*n+1]);return o}function Yn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=Zn(t,e,h,n,r,s,o),a.push(o),e=h}return o}function Kn(t,e,i,n,r,s,o){if(i<=e+n){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}let a=t[e],l=t[e+1];s[o++]=a,s[o++]=l;let h=a,c=l;for(e+=n;e<i;e+=n)h=t[e],c=t[e+1],pi(a,l,h,c)>r&&(s[o++]=h,s[o++]=c,a=h,l=c);return h==a&&c==l||(s[o++]=h,s[o++]=c),o}function Hn(t,e){return e*Math.round(t/e)}function qn(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=Hn(t[e],r),c=Hn(t[e+1],r);e+=n,s[o++]=h,s[o++]=c;do{if(a=Hn(t[e],r),l=Hn(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==c);for(;e<i;){const i=Hn(t[e],r),u=Hn(t[e+1],r);if(e+=n,i==a&&u==l)continue;const d=a-h,g=l-c,f=i-h,p=u-c;d*p==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&p<g||g==p||g>0&&p>g)?(a=i,l=u):(s[o++]=a,s[o++]=l,h=a,c=l,a=i,l=u)}return s[o++]=a,s[o++]=l,o}function $n(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=qn(t,e,h,n,r,s,o),a.push(o),e=h}return o}function Jn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],c=[];o=$n(t,e,h,n,r,s,o,c),a.push(c),e=h[h.length-1]}return o}function Qn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=e;o<i;o+=n)r[s++]=t.slice(o,o+n);return r.length=s,r}function tr(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=Qn(t,e,a,n,r[s]),e=a}return r.length=s,r}function er(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=1===a.length&&a[0]===e?[]:tr(t,e,a,n,r[s]),e=a[a.length-1]}return r.length=s,r}function ir(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=o*i-s*n,s=i,o=n}return r/2}function nr(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=ir(t,e,o,n),e=o}return r}function rr(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=nr(t,e,o,n),e=o[o.length-1]}return r}class sr extends On{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new sr(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<ie(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Dn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),jn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return ir(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Zn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new sr(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Xn(this.flatCoordinates,0,t,this.stride),this.changed()}}var or=sr;class ar extends On{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new ar(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=pi(t,e,r[0],r[1]);if(s<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=r[e];return i.length=t,s}return n}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(t){return ce(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return se(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=zn(this.flatCoordinates,0,t,this.stride),this.changed()}}var lr=ar;function hr(t,e,i,n,r){return!ve(r,(function(r){return!cr(t,e,i,n,r[0],r[1])}))}function cr(t,e,i,n,r,s){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=s?n>s&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function ur(t,e,i,n,r,s){if(0===i.length)return!1;if(!cr(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e<o;++e)if(cr(t,i[e-1],i[e],n,r,s))return!1;return!0}function dr(t,e,i,n,r,s){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(ur(t,e,a,n,r,s))return!0;e=a[a.length-1]}return!1}function gr(t,e,i,n,r,s,o){let a,h,c,u,d,g,f;const p=r[s+1],m=[];for(let r=0,s=i.length;r<s;++r){const s=i[r];for(u=t[s-n],g=t[s-n+1],a=e;a<s;a+=n)d=t[a],f=t[a+1],(p<=g&&f<=p||g<=p&&p<=f)&&(c=(p-g)/(f-g)*(d-u)+u,m.push(c)),u=d,g=f}let _=NaN,y=-1/0;for(m.sort(l),u=m[0],a=1,h=m.length;a<h;++a){d=m[a];const r=Math.abs(d-u);r>y&&(c=(u+d)/2,ur(t,e,i,n,c,p)&&(_=c,y=r)),u=d}return isNaN(_)&&(_=r[s]),o?(o.push(_,p,y),o):[_,p,y]}function fr(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=gr(t,e,a,n,r,2*o,s),e=a[a.length-1]}return s}function pr(t,e,i,n,r){let s;for(e+=n;e<i;e+=n)if(s=r(t.slice(e-n,e),t.slice(e,e+n)),s)return s;return!1}function mr(t,e,i,n,r){const s=_e([1/0,1/0,-1/0,-1/0],t,e,i,n);return!!Ae(r,s)&&(!!re(r,s)||(s[0]>=r[0]&&s[2]<=r[2]||(s[1]>=r[1]&&s[3]<=r[3]||pr(t,e,i,n,(function(t,e){return ke(r,t,e)})))))}function _r(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){if(mr(t,e,i[s],n,r))return!0;e=i[s]}return!1}function yr(t,e,i,n,r){return!!mr(t,e,i,n,r)||(!!cr(t,e,i,n,r[0],r[1])||(!!cr(t,e,i,n,r[0],r[3])||(!!cr(t,e,i,n,r[2],r[1])||!!cr(t,e,i,n,r[2],r[3]))))}function xr(t,e,i,n,r){if(!yr(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e<s;++e)if(hr(t,i[e-1],i[e],n,r)&&!mr(t,i[e-1],i[e],n,r))return!1;return!0}function vr(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(xr(t,e,o,n,r))return!0;e=o[o.length-1]}return!1}function Sr(t,e,i,n){for(;e<i-n;){for(let r=0;r<n;++r){const s=t[e+r];t[e+r]=t[i-n+r],t[i-n+r]=s}e+=n,i-=n}}function wr(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=(i-s)*(n+o),s=i,o=n}return 0===r?void 0:r>0}function Er(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=wr(t,e,o,n);if(0===s){if(r&&a||!r&&!a)return!1}else if(r&&!a||!r&&a)return!1;e=o}return!0}function Tr(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(!Er(t,e,o,n,r))return!1;o.length&&(e=o[o.length-1])}return!0}function Cr(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=wr(t,e,o,n);(0===s?r&&a||!r&&!a:r&&!a||!r&&a)&&Sr(t,e,o,n),e=o}return e}function Rr(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=Cr(t,e,i[s],n,r);return e}function br(t,e){const i=[];let n=0,r=0;for(let s=0,o=e.length;s<o;++s){const o=e[s];if(wr(t,n,o,2)){if(0===i.length)continue;i[i.length-1].push(e[r])}else i.push(e.slice(r,s+1));r=s+1,n=o}return i}class Pr extends On{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?d(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Pr(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<ie(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(kn(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Bn(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return ur(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return nr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Cr(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,tr(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Te(this.getExtent());this.flatInteriorPoint_=gr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new lr(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new or(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=new or(e.slice(r,o),t);n.push(a),r=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Er(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Cr(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=$n(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Pr(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return xr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Vn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var Ir=Pr;function Fr(t,e,i,n){i=i||32;const r=[];for(let s=0;s<i;++s)d(r,Wi(t,e,2*Math.PI*s/i,n));return r.push(r[0],r[1]),new Pr(r,"XY",[r.length])}function Lr(t){if(Oe(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],r=t[3],s=[e,i,e,r,n,r,n,i,e,i];return new Pr(s,"XY",[s.length])}function Mr(t,e,i){e=e||32;const n=t.getStride(),r=t.getLayout(),s=t.getCenter(),o=n*(e+1),a=new Array(o);for(let t=0;t<o;t+=n){a[t]=0,a[t+1]=0;for(let e=2;e<n;e++)a[t+e]=s[e]}const l=[a.length],h=new Pr(a,r,l);return Ar(h,s,t.getRadius(),i),h}function Ar(t,e,i,n){const r=t.getFlatCoordinates(),s=t.getStride(),o=r.length/s-1,a=n||0;for(let t=0;t<=o;++t){const n=t*s,l=a+2*xi(t,o)*Math.PI/o;r[n]=e[0]+i*Math.cos(l),r[n+1]=e[1]+i*Math.sin(l)}t.changed()}const Or="accuracy",Nr="accuracyGeometry",Dr="altitude",kr="altitudeAccuracy",Gr="heading",jr="position",Br="projection",Ur="speed",zr="tracking",Xr="trackingOptions",Vr="error";class Wr extends r{constructor(t){super(Vr),this.code=t.code,this.message=t.message}}var Zr=class extends Z{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.position_=null,this.transform_=Qi,this.watchId_=void 0,this.addChangeListener(Br,this.handleProjectionChanged_),this.addChangeListener(zr,this.handleTrackingChanged_),void 0!==t.projection&&this.setProjection(t.projection),void 0!==t.trackingOptions&&this.setTrackingOptions(t.trackingOptions),this.setTracking(void 0!==t.tracking&&t.tracking)}disposeInternal(){this.setTracking(!1),super.disposeInternal()}handleProjectionChanged_(){const t=this.getProjection();t&&(this.transform_=un(nn("EPSG:4326"),t),this.position_&&this.set(jr,this.transform_(this.position_)))}handleTrackingChanged_(){if("geolocation"in navigator){const t=this.getTracking();t&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):t||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}}positionChange_(t){const e=t.coords;this.set(Or,e.accuracy),this.se