@swissgeo/coordinates 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/ol.cjs +1 -1
- package/dist/ol.d.ts +4 -3
- package/dist/ol.js +320 -320
- package/package.json +3 -3
- package/src/DevApp.vue +2 -1
- package/src/ol.ts +11 -10
package/README.md
CHANGED
|
@@ -89,9 +89,10 @@ import { getLV95View, getLV95TileGrid, registerSwissGeoProjections } from '@swis
|
|
|
89
89
|
import TileLayer from 'ol/layer/Tile'
|
|
90
90
|
import Map from 'ol/Map'
|
|
91
91
|
import XYZ from 'ol/source/XYZ'
|
|
92
|
+
import proj4 from 'proj4'
|
|
92
93
|
|
|
93
94
|
// 1. Register projections in proj4 and OpenLayers
|
|
94
|
-
registerSwissGeoProjections()
|
|
95
|
+
registerSwissGeoProjections(proj4)
|
|
95
96
|
|
|
96
97
|
// 2. Use helpers to create View and TileGrid
|
|
97
98
|
const map = new Map({
|
package/dist/ol.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./registerProj4-BuUOcPpF.cjs"),Ge={PROPERTYCHANGE:"propertychange"},Le={CHANGE:"change"};class ze{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function ae(i,t){return i>t?1:i<t?-1:0}function St(i,t,e){if(i[0]<=t)return 0;const n=i.length;if(t<=i[n-1])return n-1;if(typeof e=="function"){for(let s=1;s<n;++s){const r=i[s];if(r===t)return s;if(r<t)return e(t,i[s-1],r)>0?s-1:s}return n-1}if(e>0){for(let s=1;s<n;++s)if(i[s]<t)return s-1;return n-1}if(e<0){for(let s=1;s<n;++s)if(i[s]<=t)return s;return n-1}for(let s=1;s<n;++s){if(i[s]==t)return s;if(i[s]<t)return i[s-1]-t<t-i[s]?s-1:s}return n-1}function be(i,t){const e=Array.isArray(t)?t:[t],n=e.length;for(let s=0;s<n;s++)i[i.length]=e[s]}function Ve(i,t){const e=i.length;if(e!==t.length)return!1;for(let n=0;n<e;n++)if(i[n]!==t[n])return!1;return!0}function Ue(i,t,e){const n=t||ae;return i.every(function(s,r){if(r===0)return!0;const o=n(i[r-1],s);return!(o>0||o===0)})}function Mt(){}function De(i){let t,e,n;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==n||!Ve(s,e))&&(n=this,e=s,t=i.apply(this,arguments)),t}}function le(i){for(const t in i)delete i[t]}function We(i){let t;for(t in i)return!1;return!t}class ue{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class $e extends ze{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const n=this.listeners_||(this.listeners_={}),s=n[t]||(n[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",n=e?t:t.type,s=this.listeners_&&this.listeners_[n];if(!s)return;const r=e?new ue(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let h=0,u=s.length;h<u;++h)if("handleEvent"in s[h]?l=s[h].handleEvent(r):l=s[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[n]===0){let h=a[n];for(delete a[n];h--;)this.removeEventListener(n,Mt);delete o[n]}return l}disposeInternal(){this.listeners_&&le(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:!1}removeEventListener(t,e){if(!this.listeners_)return;const n=this.listeners_[t];if(!n)return;const s=n.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[s]=Mt,++this.pendingRemovals_[t]):(n.splice(s,1),n.length===0&&delete this.listeners_[t]))}}function Ct(i,t,e,n,s){if(s){const o=e;e=function(a){return i.removeEventListener(t,e),o.call(this,a)}}const r={target:i,type:t,listener:e};return i.addEventListener(t,e),r}function Zt(i,t,e,n){return Ct(i,t,e,n,!0)}function jt(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),le(i))}class He extends $e{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Le.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const n=t.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=Ct(this,t[r],e);return s}return Ct(this,t,e)}onceInternal(t,e){let n;if(Array.isArray(t)){const s=t.length;n=new Array(s);for(let r=0;r<s;++r)n[r]=Zt(this,t[r],e)}else n=Zt(this,t,e);return e.ol_key=n,n}unInternal(t,e){const n=e.ol_key;if(n)ke(n);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}function ke(i){if(Array.isArray(i))for(let t=0,e=i.length;t<e;++t)jt(i[t]);else jt(i)}function T(){throw new Error("Unimplemented abstract method.")}let qe=0;function Be(i){return i.ol_uid||(i.ol_uid=String(++qe))}class Ot extends ue{constructor(t,e,n){super(t),this.key=e,this.oldValue=n}}class he extends He{constructor(t){super(),this.on,this.once,this.un,Be(this),this.values_=null,t!==void 0&&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_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let n;n=`change:${t}`,this.hasListener(n)&&this.dispatchEvent(new Ot(n,t,e)),n=Ge.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Ot(n,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,n){const s=this.values_||(this.values_={});if(n)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const n in t)this.set(n,t[n],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const n=this.values_[t];delete this.values_[t],We(this.values_)&&(this.values_=null),e||this.notify(t,n)}}}function y(i,t){if(!i)throw new Error(t)}const M={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ce(i,t,e){let n,s;return t<i[0]?n=i[0]-t:i[2]<t?n=t-i[2]:n=0,e<i[1]?s=i[1]-e:i[3]<e?s=e-i[3]:s=0,n*n+s*s}function Ke(i,t,e){return i[0]<=t&&t<=i[2]&&i[1]<=e&&e<=i[3]}function Gt(i,t){const e=i[0],n=i[1],s=i[2],r=i[3],o=t[0],a=t[1];let l=M.UNKNOWN;return o<e?l=l|M.LEFT:o>s&&(l=l|M.RIGHT),a<n?l=l|M.BELOW:a>r&&(l=l|M.ABOVE),l===M.UNKNOWN&&(l=M.INTERSECTING),l}function fe(){return[1/0,1/0,-1/0,-1/0]}function ct(i,t,e,n,s){return s?(s[0]=i,s[1]=t,s[2]=e,s[3]=n,s):[i,t,e,n]}function ge(i){return ct(1/0,1/0,-1/0,-1/0,i)}function Je(i,t){const e=i[0],n=i[1];return ct(e,n,e,n,t)}function Qe(i,t,e,n,s){const r=ge(s);return de(r,i,t,e,n)}function de(i,t,e,n,s){for(;e<n;e+=s)tn(i,t[e],t[e+1]);return i}function tn(i,t,e){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}function en(i,t){let e;return e=t(nn(i)),e||(e=t(sn(i)),e)||(e=t(an(i)),e)||(e=t(me(i)),e)?e:!1}function nn(i){return[i[0],i[1]]}function sn(i){return[i[2],i[1]]}function rt(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function rn(i,t,e,n,s){const[r,o,a,l,h,u,c,f]=on(i,t,e,n);return ct(Math.min(r,a,h,c),Math.min(o,l,u,f),Math.max(r,a,h,c),Math.max(o,l,u,f),s)}function on(i,t,e,n){const s=t*n[0]/2,r=t*n[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,h=s*a,u=r*o,c=r*a,f=i[0],g=i[1];return[f-l+c,g-h-u,f-l-c,g-h+u,f+l-c,g+h+u,f+l+c,g+h-u,f-l+c,g-h-u]}function k(i){return i[3]-i[1]}function me(i){return[i[0],i[3]]}function an(i){return[i[2],i[3]]}function D(i){return i[2]-i[0]}function ln(i,t){return i[0]<=t[2]&&i[2]>=t[0]&&i[1]<=t[3]&&i[3]>=t[1]}function _e(i){return i[2]<i[0]||i[3]<i[1]}function un(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i}function hn(i,t,e){let n=!1;const s=Gt(i,t),r=Gt(i,e);if(s===M.INTERSECTING||r===M.INTERSECTING)n=!0;else{const o=i[0],a=i[1],l=i[2],h=i[3],u=t[0],c=t[1],f=e[0],g=e[1],d=(g-c)/(f-u);let m,_;r&M.ABOVE&&!(s&M.ABOVE)&&(m=f-(g-h)/d,n=m>=o&&m<=l),!n&&r&M.RIGHT&&!(s&M.RIGHT)&&(_=g-(f-l)*d,n=_>=a&&_<=h),!n&&r&M.BELOW&&!(s&M.BELOW)&&(m=f-(g-a)/d,n=m>=o&&m<=l),!n&&r&M.LEFT&&!(s&M.LEFT)&&(_=g-(f-o)*d,n=_>=a&&_<=h)}return n}function I(i,t,e){return Math.min(Math.max(i,t),e)}function cn(i,t,e,n,s,r){const o=s-e,a=r-n;if(o!==0||a!==0){const l=((i-e)*o+(t-n)*a)/(o*o+a*a);l>1?(e=s,n=r):l>0&&(e+=o*l,n+=a*l)}return V(i,t,e,n)}function V(i,t,e,n){const s=e-i,r=n-t;return s*s+r*r}function Lt(i){return i*180/Math.PI}function H(i){return i*Math.PI/180}function zt(i,t){const e=i%t;return e*t<0?e+t:e}function fn(i,t,e){return i+e*(t-i)}function Re(i,t){const e=Math.pow(10,t);return Math.round(i*e)/e}function K(i,t){return Math.floor(Re(i,t))}function J(i,t){return Math.ceil(Re(i,t))}function Et(i,t,e){if(i>=t&&i<e)return i;const n=e-t;return((i-t)%n+n)%n+t}function gn(...i){console.warn(...i)}function dn(i,t){return i[0]+=+t[0],i[1]+=+t[1],i}function ot(i,t){let e=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=t[n]){e=!1;break}return e}function mn(i,t){const e=Math.cos(t),n=Math.sin(t),s=i[0]*e-i[1]*n,r=i[1]*e+i[0]*n;return i[0]=s,i[1]=r,i}function _n(i,t,e){const n=t.getExtent();let s=0;return t.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(e=e||D(n),s=Math.floor((i[0]-n[0])/e)),s}const xe={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class ft{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,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 B=6378137,b=Math.PI*B,Rn=[-b,-b,b,b],xn=[-180,-85,180,85],Q=B*Math.log(Math.tan(Math.PI/2));class O extends ft{constructor(t){super({code:t,units:"m",extent:Rn,global:!0,worldExtent:xn,getPointResolution:function(e,n){return e/Math.cosh(n[1]/B)}})}}const bt=[new O("EPSG:3857"),new O("EPSG:102100"),new O("EPSG:102113"),new O("EPSG:900913"),new O("http://www.opengis.net/def/crs/EPSG/0/3857"),new O("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Mn(i,t,e,n){const s=i.length;e=e>1?e:2,n=n??e,t===void 0&&(e>2?t=i.slice():t=new Array(s));for(let r=0;r<s;r+=n){t[r]=b*i[r]/180;let o=B*Math.log(Math.tan(Math.PI*(+i[r+1]+90)/360));o>Q?o=Q:o<-Q&&(o=-Q),t[r+1]=o}return t}function Cn(i,t,e,n){const s=i.length;e=e>1?e:2,n=n??e,t===void 0&&(e>2?t=i.slice():t=new Array(s));for(let r=0;r<s;r+=n)t[r]=180*i[r]/b,t[r+1]=360*Math.atan(Math.exp(i[r+1]/B))/Math.PI-90;return t}const En=6378137,Vt=[-180,-90,180,90],Tn=Math.PI*En/180;class X extends ft{constructor(t,e){super({code:t,units:"degrees",extent:Vt,axisOrientation:e,global:!0,metersPerUnit:Tn,worldExtent:Vt})}}const Ut=[new X("CRS:84"),new X("EPSG:4326","neu"),new X("urn:ogc:def:crs:OGC:1.3:CRS84"),new X("urn:ogc:def:crs:OGC:2:84"),new X("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new X("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new X("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Tt={};function it(i){return Tt[i]||Tt[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function pn(i,t){Tt[i]=t}let U={};function Z(i,t,e){const n=i.getCode(),s=t.getCode();n in U||(U[n]={}),U[n][s]=e}function st(i,t){return i in U&&t in U[i]?U[i][t]:null}const at=.9996,p=.00669438,gt=p*p,dt=gt*p,N=p/(1-p),Dt=Math.sqrt(1-p),W=(1-Dt)/(1+Dt),Me=W*W,yt=Me*W,wt=yt*W,Ce=wt*W,Ee=1-p/4-3*gt/64-5*dt/256,In=3*p/8+3*gt/32+45*dt/1024,Sn=15*gt/256+45*dt/1024,yn=35*dt/3072,wn=3/2*W-27/32*yt+269/512*Ce,An=21/16*Me-55/32*wt,vn=151/96*yt-417/128*Ce,Pn=1097/512*wt,lt=6378137;function Fn(i,t,e){const n=i-5e5,o=(e.north?t:t-1e7)/at/(lt*Ee),a=o+wn*Math.sin(2*o)+An*Math.sin(4*o)+vn*Math.sin(6*o)+Pn*Math.sin(8*o),l=Math.sin(a),h=l*l,u=Math.cos(a),c=l/u,f=c*c,g=f*f,d=1-p*h,m=Math.sqrt(1-p*h),_=lt/m,x=(1-p)/d,R=N*u**2,w=R*R,C=n/(_*at),F=C*C,$=F*C,Nt=$*C,Yt=Nt*C,je=Yt*C,Oe=a-c/x*(F/2-Nt/24*(5+3*f+10*R-4*w-9*N))+je/720*(61+90*f+298*R+45*g-252*N-3*w);let mt=(C-$/6*(1+2*f+R)+Yt/120*(5-2*R+28*f-3*w+8*N+24*g))/u;return mt=Et(mt+H(Te(e.number)),-Math.PI,Math.PI),[Lt(mt),Lt(Oe)]}const Wt=-80,$t=84,Xn=-180,Nn=180;function Yn(i,t,e){i=Et(i,Xn,Nn),t<Wt?t=Wt:t>$t&&(t=$t);const n=H(t),s=Math.sin(n),r=Math.cos(n),o=s/r,a=o*o,l=a*a,h=H(i),u=Te(e.number),c=H(u),f=lt/Math.sqrt(1-p*s**2),g=N*r**2,d=r*Et(h-c,-Math.PI,Math.PI),m=d*d,_=m*d,x=_*d,R=x*d,w=R*d,C=lt*(Ee*n-In*Math.sin(2*n)+Sn*Math.sin(4*n)-yn*Math.sin(6*n)),F=at*f*(d+_/6*(1-a+g)+R/120*(5-18*a+l+72*g-58*N))+5e5;let $=at*(C+f*o*(m/2+x/24*(5-a+9*g+4*g**2)+w/720*(61-58*a+l+600*g-330*N)));return e.north||($+=1e7),[F,$]}function Te(i){return(i-1)*6-180+3}const Zn=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function pe(i){let t=0;for(const s of Zn){const r=i.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,n=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(n=!0,e=t-32600),e?{number:e,north:n}:null}function Ht(i,t){return function(e,n,s,r){const o=e.length;s=s>1?s:2,r=r??s,n||(s>2?n=e.slice():n=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],u=i(l,h,t);n[a]=u[0],n[a+1]=u[1]}return n}}function jn(i){return pe(i)?new ft({code:i,units:"m"}):null}function On(i){const t=pe(i.getCode());return t?{forward:Ht(Yn,t),inverse:Ht(Fn,t)}:null}const Gn=[On],Ln=[jn];let pt=!0;function zn(i){pt=!1}function Ie(i,t){if(t!==void 0){for(let e=0,n=i.length;e<n;++e)t[e]=i[e];t=t}else t=i.slice();return t}function ut(i){pn(i.getCode(),i),Z(i,i,Ie)}function bn(i){i.forEach(ut)}function j(i){if(typeof i!="string")return i;const t=it(i);if(t)return t;for(const e of Ln){const n=e(i);if(n)return n}return null}function It(i){bn(i),i.forEach(function(t){i.forEach(function(e){t!==e&&Z(t,e,Ie)})})}function Vn(i,t,e,n){i.forEach(function(s){t.forEach(function(r){Z(s,r,e),Z(r,s,n)})})}function At(i,t){return i?typeof i=="string"?j(i):i:j(t)}function kt(i){return function(t,e,n,s){const r=t.length;n=n!==void 0?n:2,s=s??n,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=s){const a=i(t.slice(o,o+n)),l=a.length;for(let h=0,u=s;h<u;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e}}function Un(i,t,e,n){const s=j(i),r=j(t);Z(s,r,kt(e)),Z(r,s,kt(n))}function Dn(i,t){const e=i.getCode(),n=t.getCode();let s=st(e,n);if(s)return s;let r=null,o=null;for(const l of Gn)r||(r=l(i)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=_t(r.inverse,o.forward);else{const l=st(e,a);l&&(s=_t(l,o.forward))}else{const l=st(a,n);l&&(s=_t(r.inverse,l))}return s&&(ut(i),ut(t),Z(i,t,s)),s}function _t(i,t){return function(e,n,s,r){return n=i(e,n,s,r),t(n,n,s,r)}}function qt(i,t){const e=j(i),n=j(t);return Dn(e,n)}function Bt(i,t){return i}function A(i,t){return pt&&!ot(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(pt=!1,gn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function Wn(i,t){return i}function tt(i,t){return i}function Kt(i,t,e){return function(n){let s,r;if(i.canWrapX()){const o=i.getExtent(),a=D(o);n=n.slice(0),r=_n(n,i,a),r&&(n[0]=n[0]-r*a),n[0]=I(n[0],o[0],o[2]),n[1]=I(n[1],o[1],o[3]),s=e(n)}else s=e(n);return r&&t.canWrapX()&&(s[0]+=r*D(t.getExtent())),s}}function $n(){It(bt),It(Ut),Vn(Ut,bt,Mn,Cn)}$n();new Array(6);function Hn(){return[1,0,0,1,0,0]}function kn(i,t,e,n,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return i[0]=n*h,i[1]=s*l,i[2]=-n*l,i[3]=s*h,i[4]=o*n*h-a*n*l+t,i[5]=o*s*l+a*s*h+e,i}function qn(i,t,e,n,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=n){const h=i[l],u=i[l+1];r[a++]=s[0]*h+s[2]*u+s[4],r[a++]=s[1]*h+s[3]*u+s[5];for(let c=2;c<o;c++)r[a++]=i[l+c]}return r&&r.length!=a&&(r.length=a),r}function Bn(i,t,e,n,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],u=r[1];let c=0;for(let f=t;f<e;f+=n){const g=i[f]-h,d=i[f+1]-u;o[c++]=h+g*a-d*l,o[c++]=u+g*l+d*a;for(let m=f+2;m<f+n;++m)o[c++]=i[m]}return o&&o.length!=c&&(o.length=c),o}function Kn(i,t,e,n,s,r,o,a){a=a||[];const l=o[0],h=o[1];let u=0;for(let c=t;c<e;c+=n){const f=i[c]-l,g=i[c+1]-h;a[u++]=l+s*f,a[u++]=h+r*g;for(let d=c+2;d<c+n;++d)a[u++]=i[d]}return a&&a.length!=u&&(a.length=u),a}function Jn(i,t,e,n,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=n){o[a++]=i[l]+s,o[a++]=i[l+1]+r;for(let h=l+2;h<l+n;++h)o[a++]=i[h]}return o&&o.length!=a&&(o.length=a),o}const Jt=Hn(),Qn=[NaN,NaN];class ti extends he{constructor(){super(),this.extent_=fe(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=De((t,e,n)=>{if(!n)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(n),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return T()}closestPointXY(t,e,n,s){return T()}containsXY(t,e){return this.closestPointXY(t,e,Qn,Number.MIN_VALUE)===0}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 T()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&ge(e),this.extentRevision_=this.getRevision()}return un(this.extent_,t)}rotate(t,e){T()}scale(t,e,n){T()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return T()}getType(){return T()}applyTransform(t){T()}intersectsExtent(t){return T()}translate(t,e){T()}transform(t,e){const n=j(t),s=n.getUnits()=="tile-pixels"?function(r,o,a){const l=n.getExtent(),h=n.getWorldExtent(),u=k(h)/k(l);kn(Jt,h[0],h[3],u,-u,0,0,0);const c=qn(r,0,r.length,a,Jt,o),f=qt(n,e);return f?f(c,c,a):c}:qt(n,e);return this.applyTransform(s),this}}class vt extends ti{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Qe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return T()}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||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&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=Qt(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){T()}setLayout(t,e,n){let s;if(t)s=Qt(t);else{for(let r=0;r<n;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=ei(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();Bn(n,0,n.length,s,t,e,n),this.changed()}}scale(t,e,n){e===void 0&&(e=t),n||(n=rt(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();Kn(s,0,s.length,r,t,e,n,s),this.changed()}}translate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();Jn(n,0,n.length,s,t,e,n),this.changed()}}}function ei(i){let t;return i==2?t="XY":i==3?t="XYZ":i==4&&(t="XYZM"),t}function Qt(i){let t;return i=="XY"?t=2:i=="XYZ"||i=="XYM"?t=3:i=="XYZM"&&(t=4),t}function Se(i,t,e,n){let s=0;const r=i[e-n],o=i[e-n+1];let a=0,l=0;for(;t<e;t+=n){const h=i[t]-r,u=i[t+1]-o;s+=l*h-a*u,a=h,l=u}return s/2}function ni(i,t,e,n){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=Se(i,t,a,n),t=a}return s}function te(i,t,e,n,s,r,o){const a=i[t],l=i[t+1],h=i[e]-a,u=i[e+1]-l;let c;if(h===0&&u===0)c=t;else{const f=((s-a)*h+(r-l)*u)/(h*h+u*u);if(f>1)c=e;else if(f>0){for(let g=0;g<n;++g)o[g]=fn(i[t+g],i[e+g],f);o.length=n;return}else c=t}for(let f=0;f<n;++f)o[f]=i[c+f];o.length=n}function ye(i,t,e,n,s){let r=i[t],o=i[t+1];for(t+=n;t<e;t+=n){const a=i[t],l=i[t+1],h=V(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function ii(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=ye(i,t,a,n,s),t=a}return s}function we(i,t,e,n,s,r,o,a,l,h,u){if(t==e)return h;let c,f;if(s===0){if(f=V(o,a,i[t],i[t+1]),f<h){for(c=0;c<n;++c)l[c]=i[t+c];return l.length=n,f}return h}u=u||[NaN,NaN];let g=t+n;for(;g<e;)if(te(i,g-n,g,n,o,a,u),f=V(o,a,u[0],u[1]),f<h){for(h=f,c=0;c<n;++c)l[c]=u[c];l.length=n,g+=n}else g+=n*Math.max((Math.sqrt(f)-Math.sqrt(h))/s|0,1);if(te(i,e-n,t,n,o,a,u),f=V(o,a,u[0],u[1]),f<h){for(h=f,c=0;c<n;++c)l[c]=u[c];l.length=n}return h}function si(i,t,e,n,s,r,o,a,l,h,u){u=u||[NaN,NaN];for(let c=0,f=e.length;c<f;++c){const g=e[c];h=we(i,t,g,n,s,r,o,a,l,h,u),t=g}return h}function ri(i,t,e,n){for(let s=0,r=e.length;s<r;++s)i[t++]=e[s];return t}function Ae(i,t,e,n){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<n;++a)i[t++]=o[a]}return t}function oi(i,t,e,n,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Ae(i,t,e[o],n);s[r++]=l,t=l}return s.length=r,s}function ve(i,t,e,n,s){s=s!==void 0?s:[];let r=0;for(let o=t;o<e;o+=n)s[r++]=i.slice(o,o+n);return s.length=r,s}function ai(i,t,e,n,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=ve(i,t,l,n,s[r]),t=l}return s.length=r,s}function li(i,t,e,n,s,r,o){const a=(e-t)/n;if(a<3){for(;t<e;t+=n)r[o++]=i[t],r[o++]=i[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-n];let u=0;for(;h.length>0;){const c=h.pop(),f=h.pop();let g=0;const d=i[f],m=i[f+1],_=i[c],x=i[c+1];for(let R=f+n;R<c;R+=n){const w=i[R],C=i[R+1],F=cn(w,C,d,m,_,x);F>g&&(u=R,g=F)}g>s&&(l[(u-t)/n]=1,f+n<u&&h.push(f,u),u+n<c&&h.push(u,c))}for(let c=0;c<a;++c)l[c]&&(r[o++]=i[t+c*n],r[o++]=i[t+c*n+1]);return o}function G(i,t){return t*Math.round(i/t)}function ui(i,t,e,n,s,r,o){if(t==e)return o;let a=G(i[t],s),l=G(i[t+1],s);t+=n,r[o++]=a,r[o++]=l;let h,u;do if(h=G(i[t],s),u=G(i[t+1],s),t+=n,t==e)return r[o++]=h,r[o++]=u,o;while(h==a&&u==l);for(;t<e;){const c=G(i[t],s),f=G(i[t+1],s);if(t+=n,c==h&&f==u)continue;const g=h-a,d=u-l,m=c-a,_=f-l;if(g*_==d*m&&(g<0&&m<g||g==m||g>0&&m>g)&&(d<0&&_<d||d==_||d>0&&_>d)){h=c,u=f;continue}r[o++]=h,r[o++]=u,a=h,l=u,h=c,u=f}return r[o++]=h,r[o++]=u,o}function hi(i,t,e,n,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const u=e[l];o=ui(i,t,u,n,s,r,o),a.push(o),t=u}return o}class q extends vt{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new q(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,n,s){return s<ce(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ye(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),we(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,n,s))}getArea(){return Se(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ve(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=li(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new q(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ae(this.flatCoordinates,0,t,this.stride),this.changed()}}class Pt extends vt{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Pt(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){const r=this.flatCoordinates,o=V(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)n[l]=r[l];return n.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Je(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Ke(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ri(this.flatCoordinates,0,t,this.stride),this.changed()}}function ci(i,t,e,n,s){return!en(s,function(o){return!Y(i,t,e,n,o[0],o[1])})}function Y(i,t,e,n,s,r){let o=0,a=i[e-n],l=i[e-n+1];for(;t<e;t+=n){const h=i[t],u=i[t+1];l<=r?u>r&&(h-a)*(r-l)-(s-a)*(u-l)>0&&o++:u<=r&&(h-a)*(r-l)-(s-a)*(u-l)<0&&o--,a=h,l=u}return o!==0}function Pe(i,t,e,n,s,r){if(e.length===0||!Y(i,t,e[0],n,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(Y(i,e[o-1],e[o],n,s,r))return!1;return!0}function fi(i,t,e,n,s,r,o){let a,l,h,u,c,f,g;const d=s[r+1],m=[];for(let R=0,w=e.length;R<w;++R){const C=e[R];for(u=i[C-n],f=i[C-n+1],a=t;a<C;a+=n)c=i[a],g=i[a+1],(d<=f&&g<=d||f<=d&&d<=g)&&(h=(d-f)/(g-f)*(c-u)+u,m.push(h)),u=c,f=g}let _=NaN,x=-1/0;for(m.sort(ae),u=m[0],a=1,l=m.length;a<l;++a){c=m[a];const R=Math.abs(c-u);R>x&&(h=(u+c)/2,Pe(i,t,e,n,h,d)&&(_=h,x=R)),u=c}return isNaN(_)&&(_=s[r]),[_,d,x]}function gi(i,t,e,n,s){let r;for(t+=n;t<e;t+=n)if(r=s(i.slice(t-n,t),i.slice(t,t+n)),r)return r;return!1}function Fe(i,t,e,n,s,r){return r=r??de(fe(),i,t,e,n),ln(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:gi(i,t,e,n,function(o,a){return hn(s,o,a)}):!1}function Xe(i,t,e,n,s){return!!(Fe(i,t,e,n,s)||Y(i,t,e,n,s[0],s[1])||Y(i,t,e,n,s[0],s[3])||Y(i,t,e,n,s[2],s[1])||Y(i,t,e,n,s[2],s[3]))}function di(i,t,e,n,s){if(!Xe(i,t,e[0],n,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(ci(i,e[r-1],e[r],n,s)&&!Fe(i,e[r-1],e[r],n,s))return!1;return!0}function mi(i,t,e,n){for(;t<e-n;){for(let s=0;s<n;++s){const r=i[t+s];i[t+s]=i[e-n+s],i[e-n+s]=r}t+=n,e-=n}}function Ne(i,t,e,n){let s=0,r=i[e-n],o=i[e-n+1];for(;t<e;t+=n){const a=i[t],l=i[t+1];s+=(a-r)*(l+o),r=a,o=l}return s===0?void 0:s>0}function _i(i,t,e,n,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Ne(i,t,a,n);if(r===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;t=a}return!0}function ee(i,t,e,n,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Ne(i,t,a,n);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&mi(i,t,a,n),t=a}return t}class ht extends vt{constructor(t,e,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&n?(this.setFlatCoordinates(e,t),this.ends_=n):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?be(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new ht(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<ce(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ii(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),si(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,n,s))}containsXY(t,e){return Pe(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return ni(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),ee(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,ai(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=rt(this.getExtent());this.flatInteriorPoint_=fi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Pt(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new q(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,n=this.ends_,s=[];let r=0;for(let o=0,a=n.length;o<a;++o){const l=n[o],h=new q(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;_i(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=ee(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=hi(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,n),new ht(e,"XY",n)}getType(){return"Polygon"}intersectsExtent(t){return di(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=oi(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function ne(i){if(_e(i))throw new Error("Cannot create polygon from empty extent");const t=i[0],e=i[1],n=i[2],s=i[3],r=[t,e,t,s,n,s,n,e,t,e];return new ht(r,"XY",[r.length])}function et(i,t){return Array.isArray(i)?i:(t===void 0?t=[i,i]:(t[0]=i,t[1]=i),t)}const v={ANIMATING:0,INTERACTING:1},S={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function ie(i,t,e){return function(n,s,r,o,a){if(!n)return;if(!s&&!t)return n;const l=t?0:r[0]*s,h=t?0:r[1]*s,u=a?a[0]:0,c=a?a[1]:0;let f=i[0]+l/2+u,g=i[2]-l/2+u,d=i[1]+h/2+c,m=i[3]-h/2+c;f>g&&(f=(g+f)/2,g=f),d>m&&(d=(m+d)/2,m=d);let _=I(n[0],f,g),x=I(n[1],d,m);if(o&&e&&s){const R=30*s;_+=-R*Math.log(1+Math.max(0,f-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-g)/R),x+=-R*Math.log(1+Math.max(0,d-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-m)/R)}return[_,x]}}function Ri(i){return i}function xi(i){return Math.pow(i,3)}function Mi(i){return 1-xi(1-i)}function Ci(i){return 3*i*i-2*i*i*i}function Ft(i,t,e,n){const s=D(t)/e[0],r=k(t)/e[1];return n?Math.min(i,Math.max(s,r)):Math.min(i,Math.min(s,r))}function Xt(i,t,e){let n=Math.min(i,t);const s=50;return n*=Math.log(1+s*Math.max(0,i/t-1))/s+1,e&&(n=Math.max(n,e),n/=Math.log(1+s*Math.max(0,e/i-1))/s+1),I(n,e/2,t*2)}function Ei(i,t,e,n){return t=t!==void 0?t:!0,function(s,r,o,a){if(s!==void 0){const l=i[0],h=i[i.length-1],u=e?Ft(l,e,o,n):l;if(a)return t?Xt(s,u,h):I(s,h,u);const c=Math.min(u,s),f=Math.floor(St(i,c,r));return i[f]>u&&f<i.length-1?i[f+1]:i[f]}}}function Ti(i,t,e,n,s,r){return n=n!==void 0?n:!0,e=e!==void 0?e:0,function(o,a,l,h){if(o!==void 0){const u=s?Ft(t,s,l,r):t;if(h)return n?Xt(o,u,e):I(o,e,u);const c=1e-9,f=Math.ceil(Math.log(t/u)/Math.log(i)-c),g=-a*(.5-c)+.5,d=Math.min(u,o),m=Math.floor(Math.log(t/d)/Math.log(i)+g),_=Math.max(f,m),x=t/Math.pow(i,_);return I(x,e,u)}}}function se(i,t,e,n,s){return e=e!==void 0?e:!0,function(r,o,a,l){if(r!==void 0){const h=n?Ft(i,n,a,s):i;return!e||!l?I(r,t,h):Xt(r,h,t)}}}function pi(i){if(i!==void 0)return 0}function re(i){if(i!==void 0)return i}function Ii(i){const t=2*Math.PI/i;return function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e}}function Si(i){const t=H(5);return function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e}}const Ye=256,Rt=0;class yi extends he{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=At(t.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,t.projection&&zn(),t.center&&(t.center=A(t.center,this.projection_)),t.extent&&(t.extent=tt(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in S)delete e[a];this.setProperties(e,!0);const n=Ai(t);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=n.minZoom;const s=wi(t),r=n.constraint,o=vi(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const n=this.getCenterInternal();if(n){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let n=0;n<e.length;++n){let s=arguments[n];s.center&&(s=Object.assign({},s),s.center=A(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=A(s.anchor,this.getProjection())),e[n]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,n;e>1&&typeof arguments[e-1]=="function"&&(n=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const u=arguments[s];u.center&&this.setCenterInternal(u.center),u.zoom!==void 0?this.setZoom(u.zoom):u.resolution&&this.setResolution(u.resolution),u.rotation!==void 0&&this.setRotation(u.rotation)}if(s===e){n&&nt(n,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;s<e;++s){const u=arguments[s],c={start:r,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||Ci,callback:n};if(u.center&&(c.sourceCenter=o,c.targetCenter=u.center.slice(),o=c.targetCenter),u.zoom!==void 0?(c.sourceResolution=a,c.targetResolution=this.getResolutionForZoom(u.zoom),a=c.targetResolution):u.resolution&&(c.sourceResolution=a,c.targetResolution=u.resolution,a=c.targetResolution),u.rotation!==void 0){c.sourceRotation=l;const f=zt(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;c.targetRotation=l+f,l=c.targetRotation}Pi(c)?c.complete=!0:r+=c.duration,h.push(c)}this.animations_.push(h),this.setHint(v.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[v.ANIMATING]>0}getInteracting(){return this.hints_[v.INTERACTING]>0}cancelAnimations(){this.setHint(v.ANIMATING,-this.hints_[v.ANIMATING]);let t;for(let e=0,n=this.animations_.length;e<n;++e){const s=this.animations_[e];if(s[0].callback&&nt(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let n=this.animations_.length-1;n>=0;--n){const s=this.animations_[n];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const h=t-l.start;let u=l.duration>0?h/l.duration:1;u>=1?(l.complete=!0,u=1):r=!1;const c=l.easing(u);if(l.sourceCenter){const f=l.sourceCenter[0],g=l.sourceCenter[1],d=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=f+c*(d-f),x=g+c*(m-g);this.targetCenter_=[_,x]}if(l.sourceResolution&&l.targetResolution){const f=c===1?l.targetResolution:l.sourceResolution+c*(l.targetResolution-l.sourceResolution);if(l.anchor){const g=this.getViewportSize_(this.getRotation()),d=this.constraints_.resolution(f,0,g,!0);this.targetCenter_=this.calculateCenterZoom(d,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=f,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const f=c===1?zt(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+c*(l.targetRotation-l.sourceRotation);if(l.anchor){const g=this.constraints_.rotation(f,!0);this.targetCenter_=this.calculateCenterRotate(g,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=f}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[n]=null,this.setHint(v.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&nt(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let n;const s=this.getCenterInternal();return s!==void 0&&(n=[s[0]-e[0],s[1]-e[1]],mn(n,t-this.getRotation()),dn(n,e)),n}calculateCenterZoom(t,e){let n;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;n=[o,a]}return n}getViewportSize_(t){const e=this.viewportSize_;if(t){const n=e[0],s=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&Bt(t,this.getProjection())}getCenterInternal(){return this.get(S.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return Wn(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();y(e,"The view center is not defined");const n=this.getResolution();y(n!==void 0,"The view resolution is not defined");const s=this.getRotation();return y(s!==void 0,"The view rotation is not defined"),rn(e,n,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(S.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(tt(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=D(t)/e[0],s=k(t)/e[1];return Math.max(n,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(e/n)/Math.log(t);return function(r){return e/Math.pow(t,r*s)}}getRotation(){return this.get(S.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(n/s)/e;return function(o){return Math.log(n/o)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),n=this.getRotation();let s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=xt(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,n)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,n,s;if(this.resolutions_){const r=St(this.resolutions_,t,1);e=r,n=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=n/this.resolutions_[r+1]}else n=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(n/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];const e=I(Math.floor(t),0,this.resolutions_.length-2),n=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(n,I(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let n;if(y(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){y(!_e(t),"Cannot fit empty extent provided as `geometry`");const s=tt(t,this.getProjection());n=ne(s)}else if(t.getType()==="Circle"){const s=tt(t.getExtent(),this.getProjection());n=ne(s),n.rotate(this.getRotation(),rt(s))}else n=t;this.fitInternal(n,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),n=Math.cos(e),s=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,u=-1/0;for(let c=0,f=r.length;c<f;c+=o){const g=r[c]*n-r[c+1]*s,d=r[c]*s+r[c+1]*n;a=Math.min(a,g),l=Math.min(l,d),h=Math.max(h,g),u=Math.max(u,d)}return[a,l,h,u]}fitInternal(t,e){e=e||{};let n=e.size;n||(n=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],r=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[n[0]-s[1]-s[3],n[1]-s[0]-s[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const h=this.getRotation(),u=Math.sin(h),c=Math.cos(h),f=rt(a);f[0]+=(s[1]-s[3])/2*l,f[1]+=(s[0]-s[2])/2*l;const g=f[0]*c-f[1]*u,d=f[1]*c+f[0]*u,m=this.getConstrainedCenter([g,d],l),_=e.callback?e.callback:Mt;e.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),nt(_,!0))}centerOn(t,e,n){this.centerOnInternal(A(t,this.getProjection()),e,n)}centerOnInternal(t,e,n){this.setCenterInternal(xt(t,e,n,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,n,s){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-n),l=xt(t,s,[a[0]/2+o[3],a[1]/2+o[0]],e,n);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=Bt(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&A(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,s,n);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=A(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,n);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&A(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const n=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,n),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,0,r,n),a=this.constraints_.center(this.targetCenter_,o,r,n,this.calculateCenterShift(this.targetCenter_,o,s,r));this.get(S.ROTATION)!==s&&this.set(S.ROTATION,s),this.get(S.RESOLUTION)!==o&&(this.set(S.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(S.CENTER)||!ot(this.get(S.CENTER),a))&&this.set(S.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,n){t=t!==void 0?t:200;const s=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,s,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}n=n||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!ot(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:Mi,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(v.INTERACTING,1)}endInteraction(t,e,n){n=n&&A(n,this.getProjection()),this.endInteractionInternal(t,e,n)}endInteractionInternal(t,e,n){this.getInteracting()&&(this.setHint(v.INTERACTING,-1),this.resolveConstraints(t,e,n))}getConstrainedCenter(t,e){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),n)}getConstrainedZoom(t,e){const n=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(n,e))}getConstrainedResolution(t,e){e=e||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,n)}}function nt(i,t){setTimeout(function(){i(t)},0)}function wi(i){if(i.extent!==void 0){const e=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return ie(i.extent,i.constrainOnlyCenter,e)}const t=At(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,ie(e,!1,!1)}return Ri}function Ai(i){let t,e,n,o=i.minZoom!==void 0?i.minZoom:Rt,a=i.maxZoom!==void 0?i.maxZoom:28;const l=i.zoomFactor!==void 0?i.zoomFactor:2,h=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,c=i.showFullExtent!==void 0?i.showFullExtent:!1,f=At(i.projection,"EPSG:3857"),g=f.getExtent();let d=i.constrainOnlyCenter,m=i.extent;if(!h&&!m&&f.isGlobal()&&(d=!1,m=g),i.resolutions!==void 0){const _=i.resolutions;e=_[o],n=_[a]!==void 0?_[a]:_[_.length-1],i.constrainResolution?t=Ei(_,u,!d&&m,c):t=se(e,n,u,!d&&m,c)}else{const x=(g?Math.max(D(g),k(g)):360*xe.degrees/f.getMetersPerUnit())/Ye/Math.pow(2,Rt),R=x/Math.pow(2,28-Rt);e=i.maxResolution,e!==void 0?o=0:e=x/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=e/Math.pow(l,a):n=x/Math.pow(l,a):n=R),a=o+Math.floor(Math.log(e/n)/Math.log(l)),n=e/Math.pow(l,a-o),i.constrainResolution?t=Ti(l,e,n,u,!d&&m,c):t=se(e,n,u,!d&&m,c)}return{constraint:t,maxResolution:e,minResolution:n,minZoom:o,zoomFactor:l}}function vi(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const e=i.constrainRotation;return e===void 0||e===!0?Si():e===!1?re:typeof e=="number"?Ii(e):re}return pi}function Pi(i){return!(i.sourceCenter&&i.targetCenter&&!ot(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function xt(i,t,e,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=i[0]*r-i[1]*o,l=i[1]*r+i[0]*o;a+=(t[0]/2-e[0])*n,l+=(e[1]-t[1]/2)*n,o=-o;const h=a*r-l*o,u=l*r+a*o;return[h,u]}class Ze{constructor(t,e,n,s){this.minX=t,this.maxX=e,this.minY=n,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function L(i,t,e,n,s){return s!==void 0?(s.minX=i,s.maxX=t,s.minY=e,s.maxY=n,s):new Ze(i,t,e,n)}function Fi(i){const t=Object.keys(i.defs),e=t.length;let n,s;for(n=0;n<e;++n){const r=t[n];if(!it(r)){const o=i.defs(r);let a=o.units;!a&&o.projName==="longlat"&&(a="degrees"),ut(new ft({code:r,axisOrientation:o.axis,metersPerUnit:o.to_meter,units:a}))}}for(n=0;n<e;++n){const r=t[n],o=it(r);for(s=0;s<e;++s){const a=t[s],l=it(a);if(!st(r,a))if(i.defs[r]===i.defs[a])It([o,l]);else{const h=i(r,a);Un(o,l,Kt(o,l,h.forward),Kt(l,o,h.inverse))}}}}function oe(i,t,e,n){return n!==void 0?(n[0]=i,n[1]=t,n[2]=e,n):[i,t,e]}const z=[0,0,0],P=5;class Xi{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,y(Ue(this.resolutions_,(s,r)=>r-s),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,y(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=t.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=me(n)),y(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,y(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:Ye,y(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n!==void 0?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((s,r)=>{const o=new Ze(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(n){const a=this.getTileRangeForExtentAndZ(n,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,n){const s=this.getTileRangeForExtentAndZ(t,e);for(let r=s.minX,o=s.maxX;r<=o;++r)for(let a=s.minY,l=s.maxY;a<=l;++a)n([e,r,a])}forEachTileCoordParentTileRange(t,e,n,s){let r,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=L(o,o,a,a,n)):r=this.getTileRangeForExtentAndZ(l,h,n),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,n){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return L(r,r+1,o,o+1,e)}const s=this.getTileCoordExtent(t,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,n){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],r=t[1],o=t[2];if(e===s)return L(r,o,r,o,n);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-s),h=Math.floor(r*l),u=Math.floor(o*l);if(e<s)return L(h,h,u,u,n);const c=Math.floor(l*(r+1))-1,f=Math.floor(l*(o+1))-1;return L(h,c,u,f,n)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,n)}getTileRangeForExtentAndZ(t,e,n){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,z);const s=z[1],r=z[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,z);const o=z[1],a=z[2];return L(s,o,r,a,n)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=et(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*n,e[1]-(t[2]+.5)*s[1]*n]}getTileCoordExtent(t,e){const n=this.getOrigin(t[0]),s=this.getResolution(t[0]),r=et(this.getTileSize(t[0]),this.tmpSize_),o=n[0]+t[1]*r[0]*s,a=n[1]-(t[2]+1)*r[1]*s,l=o+r[0]*s,h=a+r[1]*s;return ct(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,n){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,n)}getTileCoordForXYAndResolution_(t,e,n,s,r){const o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),h=et(this.getTileSize(o),this.tmpSize_);let u=a*(t-l[0])/n/h[0],c=a*(l[1]-e)/n/h[1];return s?(u=J(u,P)-1,c=J(c,P)-1):(u=K(u,P),c=K(c,P)),oe(o,u,c,r)}getTileCoordForXYAndZ_(t,e,n,s,r){const o=this.getOrigin(n),a=this.getResolution(n),l=et(this.getTileSize(n),this.tmpSize_);let h=(t-o[0])/a/l[0],u=(o[1]-e)/a/l[1];return s?(h=J(h,P)-1,u=J(u,P)-1):(h=K(h,P),u=K(u,P)),oe(n,h,u,r)}getTileCoordForCoordAndZ(t,e,n){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,n)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const n=St(this.resolutions_,t,e||0);return I(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Xe(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,n=new Array(e);for(let s=this.minZoom;s<e;++s)n[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=n}}class Ni extends Xi{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}}function Yi(){E.registerProj4(E.proj4),Fi(E.proj4)}function Zi(i){const t=E.LV95.getResolutionSteps(),e=t.find(n=>n.resolution===i);return e?t.indexOf(e):t.length-1}function ji(i=.25){const t=Zi(i);let e=E.LV95.getResolutionSteps();return e.length>t&&(e=e.slice(0,t+1)),new Ni({resolutions:e.map(n=>n.resolution),origin:E.LV95.getTileOrigin(),matrixIds:e.map((n,s)=>s.toString()),extent:E.LV95.bounds?.flatten})}function Oi(){return new yi({projection:E.LV95.epsg,center:E.LV95.bounds.center,zoom:E.LV95.getDefaultZoom(),minResolution:E.LV95_RESOLUTIONS[E.LV95_RESOLUTIONS.length-1],resolutions:E.LV95_RESOLUTIONS,extent:E.LV95.bounds.flatten,constrainOnlyCenter:!0})}exports.getLV95TileGrid=ji;exports.getLV95View=Oi;exports.registerSwissGeoProjections=Yi;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./registerProj4-BuUOcPpF.cjs"),Ge={PROPERTYCHANGE:"propertychange"},Le={CHANGE:"change"};class ze{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function ae(i,t){return i>t?1:i<t?-1:0}function St(i,t,e){if(i[0]<=t)return 0;const n=i.length;if(t<=i[n-1])return n-1;if(typeof e=="function"){for(let s=1;s<n;++s){const r=i[s];if(r===t)return s;if(r<t)return e(t,i[s-1],r)>0?s-1:s}return n-1}if(e>0){for(let s=1;s<n;++s)if(i[s]<t)return s-1;return n-1}if(e<0){for(let s=1;s<n;++s)if(i[s]<=t)return s;return n-1}for(let s=1;s<n;++s){if(i[s]==t)return s;if(i[s]<t)return i[s-1]-t<t-i[s]?s-1:s}return n-1}function be(i,t){const e=Array.isArray(t)?t:[t],n=e.length;for(let s=0;s<n;s++)i[i.length]=e[s]}function Ve(i,t){const e=i.length;if(e!==t.length)return!1;for(let n=0;n<e;n++)if(i[n]!==t[n])return!1;return!0}function Ue(i,t,e){const n=t||ae;return i.every(function(s,r){if(r===0)return!0;const o=n(i[r-1],s);return!(o>0||o===0)})}function Mt(){}function De(i){let t,e,n;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==n||!Ve(s,e))&&(n=this,e=s,t=i.apply(this,arguments)),t}}function le(i){for(const t in i)delete i[t]}function We(i){let t;for(t in i)return!1;return!t}class ue{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class $e extends ze{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const n=this.listeners_||(this.listeners_={}),s=n[t]||(n[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",n=e?t:t.type,s=this.listeners_&&this.listeners_[n];if(!s)return;const r=e?new ue(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let h=0,u=s.length;h<u;++h)if("handleEvent"in s[h]?l=s[h].handleEvent(r):l=s[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[n]===0){let h=a[n];for(delete a[n];h--;)this.removeEventListener(n,Mt);delete o[n]}return l}disposeInternal(){this.listeners_&&le(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:!1}removeEventListener(t,e){if(!this.listeners_)return;const n=this.listeners_[t];if(!n)return;const s=n.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[s]=Mt,++this.pendingRemovals_[t]):(n.splice(s,1),n.length===0&&delete this.listeners_[t]))}}function Ct(i,t,e,n,s){if(s){const o=e;e=function(a){return i.removeEventListener(t,e),o.call(this,a)}}const r={target:i,type:t,listener:e};return i.addEventListener(t,e),r}function Zt(i,t,e,n){return Ct(i,t,e,n,!0)}function Ot(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),le(i))}class He extends $e{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Le.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const n=t.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=Ct(this,t[r],e);return s}return Ct(this,t,e)}onceInternal(t,e){let n;if(Array.isArray(t)){const s=t.length;n=new Array(s);for(let r=0;r<s;++r)n[r]=Zt(this,t[r],e)}else n=Zt(this,t,e);return e.ol_key=n,n}unInternal(t,e){const n=e.ol_key;if(n)ke(n);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}function ke(i){if(Array.isArray(i))for(let t=0,e=i.length;t<e;++t)Ot(i[t]);else Ot(i)}function E(){throw new Error("Unimplemented abstract method.")}let qe=0;function Be(i){return i.ol_uid||(i.ol_uid=String(++qe))}class jt extends ue{constructor(t,e,n){super(t),this.key=e,this.oldValue=n}}class he extends He{constructor(t){super(),this.on,this.once,this.un,Be(this),this.values_=null,t!==void 0&&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_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let n;n=`change:${t}`,this.hasListener(n)&&this.dispatchEvent(new jt(n,t,e)),n=Ge.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new jt(n,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,n){const s=this.values_||(this.values_={});if(n)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const n in t)this.set(n,t[n],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const n=this.values_[t];delete this.values_[t],We(this.values_)&&(this.values_=null),e||this.notify(t,n)}}}function y(i,t){if(!i)throw new Error(t)}const M={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ce(i,t,e){let n,s;return t<i[0]?n=i[0]-t:i[2]<t?n=t-i[2]:n=0,e<i[1]?s=i[1]-e:i[3]<e?s=e-i[3]:s=0,n*n+s*s}function Ke(i,t,e){return i[0]<=t&&t<=i[2]&&i[1]<=e&&e<=i[3]}function Gt(i,t){const e=i[0],n=i[1],s=i[2],r=i[3],o=t[0],a=t[1];let l=M.UNKNOWN;return o<e?l=l|M.LEFT:o>s&&(l=l|M.RIGHT),a<n?l=l|M.BELOW:a>r&&(l=l|M.ABOVE),l===M.UNKNOWN&&(l=M.INTERSECTING),l}function fe(){return[1/0,1/0,-1/0,-1/0]}function ct(i,t,e,n,s){return s?(s[0]=i,s[1]=t,s[2]=e,s[3]=n,s):[i,t,e,n]}function ge(i){return ct(1/0,1/0,-1/0,-1/0,i)}function Je(i,t){const e=i[0],n=i[1];return ct(e,n,e,n,t)}function Qe(i,t,e,n,s){const r=ge(s);return de(r,i,t,e,n)}function de(i,t,e,n,s){for(;e<n;e+=s)tn(i,t[e],t[e+1]);return i}function tn(i,t,e){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}function en(i,t){let e;return e=t(nn(i)),e||(e=t(sn(i)),e)||(e=t(an(i)),e)||(e=t(me(i)),e)?e:!1}function nn(i){return[i[0],i[1]]}function sn(i){return[i[2],i[1]]}function rt(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function rn(i,t,e,n,s){const[r,o,a,l,h,u,c,f]=on(i,t,e,n);return ct(Math.min(r,a,h,c),Math.min(o,l,u,f),Math.max(r,a,h,c),Math.max(o,l,u,f),s)}function on(i,t,e,n){const s=t*n[0]/2,r=t*n[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,h=s*a,u=r*o,c=r*a,f=i[0],g=i[1];return[f-l+c,g-h-u,f-l-c,g-h+u,f+l-c,g+h+u,f+l+c,g+h-u,f-l+c,g-h-u]}function k(i){return i[3]-i[1]}function me(i){return[i[0],i[3]]}function an(i){return[i[2],i[3]]}function D(i){return i[2]-i[0]}function ln(i,t){return i[0]<=t[2]&&i[2]>=t[0]&&i[1]<=t[3]&&i[3]>=t[1]}function _e(i){return i[2]<i[0]||i[3]<i[1]}function un(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i}function hn(i,t,e){let n=!1;const s=Gt(i,t),r=Gt(i,e);if(s===M.INTERSECTING||r===M.INTERSECTING)n=!0;else{const o=i[0],a=i[1],l=i[2],h=i[3],u=t[0],c=t[1],f=e[0],g=e[1],d=(g-c)/(f-u);let m,_;r&M.ABOVE&&!(s&M.ABOVE)&&(m=f-(g-h)/d,n=m>=o&&m<=l),!n&&r&M.RIGHT&&!(s&M.RIGHT)&&(_=g-(f-l)*d,n=_>=a&&_<=h),!n&&r&M.BELOW&&!(s&M.BELOW)&&(m=f-(g-a)/d,n=m>=o&&m<=l),!n&&r&M.LEFT&&!(s&M.LEFT)&&(_=g-(f-o)*d,n=_>=a&&_<=h)}return n}function I(i,t,e){return Math.min(Math.max(i,t),e)}function cn(i,t,e,n,s,r){const o=s-e,a=r-n;if(o!==0||a!==0){const l=((i-e)*o+(t-n)*a)/(o*o+a*a);l>1?(e=s,n=r):l>0&&(e+=o*l,n+=a*l)}return V(i,t,e,n)}function V(i,t,e,n){const s=e-i,r=n-t;return s*s+r*r}function Lt(i){return i*180/Math.PI}function H(i){return i*Math.PI/180}function zt(i,t){const e=i%t;return e*t<0?e+t:e}function fn(i,t,e){return i+e*(t-i)}function Re(i,t){const e=Math.pow(10,t);return Math.round(i*e)/e}function K(i,t){return Math.floor(Re(i,t))}function J(i,t){return Math.ceil(Re(i,t))}function Et(i,t,e){if(i>=t&&i<e)return i;const n=e-t;return((i-t)%n+n)%n+t}function gn(...i){console.warn(...i)}function dn(i,t){return i[0]+=+t[0],i[1]+=+t[1],i}function ot(i,t){let e=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=t[n]){e=!1;break}return e}function mn(i,t){const e=Math.cos(t),n=Math.sin(t),s=i[0]*e-i[1]*n,r=i[1]*e+i[0]*n;return i[0]=s,i[1]=r,i}function _n(i,t,e){const n=t.getExtent();let s=0;return t.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(e=e||D(n),s=Math.floor((i[0]-n[0])/e)),s}const xe={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class ft{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,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 B=6378137,b=Math.PI*B,Rn=[-b,-b,b,b],xn=[-180,-85,180,85],Q=B*Math.log(Math.tan(Math.PI/2));class j extends ft{constructor(t){super({code:t,units:"m",extent:Rn,global:!0,worldExtent:xn,getPointResolution:function(e,n){return e/Math.cosh(n[1]/B)}})}}const bt=[new j("EPSG:3857"),new j("EPSG:102100"),new j("EPSG:102113"),new j("EPSG:900913"),new j("http://www.opengis.net/def/crs/EPSG/0/3857"),new j("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Mn(i,t,e,n){const s=i.length;e=e>1?e:2,n=n??e,t===void 0&&(e>2?t=i.slice():t=new Array(s));for(let r=0;r<s;r+=n){t[r]=b*i[r]/180;let o=B*Math.log(Math.tan(Math.PI*(+i[r+1]+90)/360));o>Q?o=Q:o<-Q&&(o=-Q),t[r+1]=o}return t}function Cn(i,t,e,n){const s=i.length;e=e>1?e:2,n=n??e,t===void 0&&(e>2?t=i.slice():t=new Array(s));for(let r=0;r<s;r+=n)t[r]=180*i[r]/b,t[r+1]=360*Math.atan(Math.exp(i[r+1]/B))/Math.PI-90;return t}const En=6378137,Vt=[-180,-90,180,90],Tn=Math.PI*En/180;class X extends ft{constructor(t,e){super({code:t,units:"degrees",extent:Vt,axisOrientation:e,global:!0,metersPerUnit:Tn,worldExtent:Vt})}}const Ut=[new X("CRS:84"),new X("EPSG:4326","neu"),new X("urn:ogc:def:crs:OGC:1.3:CRS84"),new X("urn:ogc:def:crs:OGC:2:84"),new X("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new X("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new X("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Tt={};function it(i){return Tt[i]||Tt[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function pn(i,t){Tt[i]=t}let U={};function Z(i,t,e){const n=i.getCode(),s=t.getCode();n in U||(U[n]={}),U[n][s]=e}function st(i,t){return i in U&&t in U[i]?U[i][t]:null}const at=.9996,p=.00669438,gt=p*p,dt=gt*p,N=p/(1-p),Dt=Math.sqrt(1-p),W=(1-Dt)/(1+Dt),Me=W*W,yt=Me*W,wt=yt*W,Ce=wt*W,Ee=1-p/4-3*gt/64-5*dt/256,In=3*p/8+3*gt/32+45*dt/1024,Sn=15*gt/256+45*dt/1024,yn=35*dt/3072,wn=3/2*W-27/32*yt+269/512*Ce,An=21/16*Me-55/32*wt,vn=151/96*yt-417/128*Ce,Pn=1097/512*wt,lt=6378137;function Fn(i,t,e){const n=i-5e5,o=(e.north?t:t-1e7)/at/(lt*Ee),a=o+wn*Math.sin(2*o)+An*Math.sin(4*o)+vn*Math.sin(6*o)+Pn*Math.sin(8*o),l=Math.sin(a),h=l*l,u=Math.cos(a),c=l/u,f=c*c,g=f*f,d=1-p*h,m=Math.sqrt(1-p*h),_=lt/m,x=(1-p)/d,R=N*u**2,w=R*R,C=n/(_*at),F=C*C,$=F*C,Nt=$*C,Yt=Nt*C,Oe=Yt*C,je=a-c/x*(F/2-Nt/24*(5+3*f+10*R-4*w-9*N))+Oe/720*(61+90*f+298*R+45*g-252*N-3*w);let mt=(C-$/6*(1+2*f+R)+Yt/120*(5-2*R+28*f-3*w+8*N+24*g))/u;return mt=Et(mt+H(Te(e.number)),-Math.PI,Math.PI),[Lt(mt),Lt(je)]}const Wt=-80,$t=84,Xn=-180,Nn=180;function Yn(i,t,e){i=Et(i,Xn,Nn),t<Wt?t=Wt:t>$t&&(t=$t);const n=H(t),s=Math.sin(n),r=Math.cos(n),o=s/r,a=o*o,l=a*a,h=H(i),u=Te(e.number),c=H(u),f=lt/Math.sqrt(1-p*s**2),g=N*r**2,d=r*Et(h-c,-Math.PI,Math.PI),m=d*d,_=m*d,x=_*d,R=x*d,w=R*d,C=lt*(Ee*n-In*Math.sin(2*n)+Sn*Math.sin(4*n)-yn*Math.sin(6*n)),F=at*f*(d+_/6*(1-a+g)+R/120*(5-18*a+l+72*g-58*N))+5e5;let $=at*(C+f*o*(m/2+x/24*(5-a+9*g+4*g**2)+w/720*(61-58*a+l+600*g-330*N)));return e.north||($+=1e7),[F,$]}function Te(i){return(i-1)*6-180+3}const Zn=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function pe(i){let t=0;for(const s of Zn){const r=i.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,n=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(n=!0,e=t-32600),e?{number:e,north:n}:null}function Ht(i,t){return function(e,n,s,r){const o=e.length;s=s>1?s:2,r=r??s,n||(s>2?n=e.slice():n=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],u=i(l,h,t);n[a]=u[0],n[a+1]=u[1]}return n}}function On(i){return pe(i)?new ft({code:i,units:"m"}):null}function jn(i){const t=pe(i.getCode());return t?{forward:Ht(Yn,t),inverse:Ht(Fn,t)}:null}const Gn=[jn],Ln=[On];let pt=!0;function zn(i){pt=!1}function Ie(i,t){if(t!==void 0){for(let e=0,n=i.length;e<n;++e)t[e]=i[e];t=t}else t=i.slice();return t}function ut(i){pn(i.getCode(),i),Z(i,i,Ie)}function bn(i){i.forEach(ut)}function O(i){if(typeof i!="string")return i;const t=it(i);if(t)return t;for(const e of Ln){const n=e(i);if(n)return n}return null}function It(i){bn(i),i.forEach(function(t){i.forEach(function(e){t!==e&&Z(t,e,Ie)})})}function Vn(i,t,e,n){i.forEach(function(s){t.forEach(function(r){Z(s,r,e),Z(r,s,n)})})}function At(i,t){return i?typeof i=="string"?O(i):i:O(t)}function kt(i){return function(t,e,n,s){const r=t.length;n=n!==void 0?n:2,s=s??n,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=s){const a=i(t.slice(o,o+n)),l=a.length;for(let h=0,u=s;h<u;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e}}function Un(i,t,e,n){const s=O(i),r=O(t);Z(s,r,kt(e)),Z(r,s,kt(n))}function Dn(i,t){const e=i.getCode(),n=t.getCode();let s=st(e,n);if(s)return s;let r=null,o=null;for(const l of Gn)r||(r=l(i)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=_t(r.inverse,o.forward);else{const l=st(e,a);l&&(s=_t(l,o.forward))}else{const l=st(a,n);l&&(s=_t(r.inverse,l))}return s&&(ut(i),ut(t),Z(i,t,s)),s}function _t(i,t){return function(e,n,s,r){return n=i(e,n,s,r),t(n,n,s,r)}}function qt(i,t){const e=O(i),n=O(t);return Dn(e,n)}function Bt(i,t){return i}function A(i,t){return pt&&!ot(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(pt=!1,gn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function Wn(i,t){return i}function tt(i,t){return i}function Kt(i,t,e){return function(n){let s,r;if(i.canWrapX()){const o=i.getExtent(),a=D(o);n=n.slice(0),r=_n(n,i,a),r&&(n[0]=n[0]-r*a),n[0]=I(n[0],o[0],o[2]),n[1]=I(n[1],o[1],o[3]),s=e(n)}else s=e(n);return r&&t.canWrapX()&&(s[0]+=r*D(t.getExtent())),s}}function $n(){It(bt),It(Ut),Vn(Ut,bt,Mn,Cn)}$n();new Array(6);function Hn(){return[1,0,0,1,0,0]}function kn(i,t,e,n,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return i[0]=n*h,i[1]=s*l,i[2]=-n*l,i[3]=s*h,i[4]=o*n*h-a*n*l+t,i[5]=o*s*l+a*s*h+e,i}function qn(i,t,e,n,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=n){const h=i[l],u=i[l+1];r[a++]=s[0]*h+s[2]*u+s[4],r[a++]=s[1]*h+s[3]*u+s[5];for(let c=2;c<o;c++)r[a++]=i[l+c]}return r&&r.length!=a&&(r.length=a),r}function Bn(i,t,e,n,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],u=r[1];let c=0;for(let f=t;f<e;f+=n){const g=i[f]-h,d=i[f+1]-u;o[c++]=h+g*a-d*l,o[c++]=u+g*l+d*a;for(let m=f+2;m<f+n;++m)o[c++]=i[m]}return o&&o.length!=c&&(o.length=c),o}function Kn(i,t,e,n,s,r,o,a){a=a||[];const l=o[0],h=o[1];let u=0;for(let c=t;c<e;c+=n){const f=i[c]-l,g=i[c+1]-h;a[u++]=l+s*f,a[u++]=h+r*g;for(let d=c+2;d<c+n;++d)a[u++]=i[d]}return a&&a.length!=u&&(a.length=u),a}function Jn(i,t,e,n,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=n){o[a++]=i[l]+s,o[a++]=i[l+1]+r;for(let h=l+2;h<l+n;++h)o[a++]=i[h]}return o&&o.length!=a&&(o.length=a),o}const Jt=Hn(),Qn=[NaN,NaN];class ti extends he{constructor(){super(),this.extent_=fe(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=De((t,e,n)=>{if(!n)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(n),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return E()}closestPointXY(t,e,n,s){return E()}containsXY(t,e){return this.closestPointXY(t,e,Qn,Number.MIN_VALUE)===0}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 E()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&ge(e),this.extentRevision_=this.getRevision()}return un(this.extent_,t)}rotate(t,e){E()}scale(t,e,n){E()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return E()}getType(){return E()}applyTransform(t){E()}intersectsExtent(t){return E()}translate(t,e){E()}transform(t,e){const n=O(t),s=n.getUnits()=="tile-pixels"?function(r,o,a){const l=n.getExtent(),h=n.getWorldExtent(),u=k(h)/k(l);kn(Jt,h[0],h[3],u,-u,0,0,0);const c=qn(r,0,r.length,a,Jt,o),f=qt(n,e);return f?f(c,c,a):c}:qt(n,e);return this.applyTransform(s),this}}class vt extends ti{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Qe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return E()}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||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&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=Qt(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){E()}setLayout(t,e,n){let s;if(t)s=Qt(t);else{for(let r=0;r<n;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=ei(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();Bn(n,0,n.length,s,t,e,n),this.changed()}}scale(t,e,n){e===void 0&&(e=t),n||(n=rt(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();Kn(s,0,s.length,r,t,e,n,s),this.changed()}}translate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();Jn(n,0,n.length,s,t,e,n),this.changed()}}}function ei(i){let t;return i==2?t="XY":i==3?t="XYZ":i==4&&(t="XYZM"),t}function Qt(i){let t;return i=="XY"?t=2:i=="XYZ"||i=="XYM"?t=3:i=="XYZM"&&(t=4),t}function Se(i,t,e,n){let s=0;const r=i[e-n],o=i[e-n+1];let a=0,l=0;for(;t<e;t+=n){const h=i[t]-r,u=i[t+1]-o;s+=l*h-a*u,a=h,l=u}return s/2}function ni(i,t,e,n){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=Se(i,t,a,n),t=a}return s}function te(i,t,e,n,s,r,o){const a=i[t],l=i[t+1],h=i[e]-a,u=i[e+1]-l;let c;if(h===0&&u===0)c=t;else{const f=((s-a)*h+(r-l)*u)/(h*h+u*u);if(f>1)c=e;else if(f>0){for(let g=0;g<n;++g)o[g]=fn(i[t+g],i[e+g],f);o.length=n;return}else c=t}for(let f=0;f<n;++f)o[f]=i[c+f];o.length=n}function ye(i,t,e,n,s){let r=i[t],o=i[t+1];for(t+=n;t<e;t+=n){const a=i[t],l=i[t+1],h=V(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function ii(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=ye(i,t,a,n,s),t=a}return s}function we(i,t,e,n,s,r,o,a,l,h,u){if(t==e)return h;let c,f;if(s===0){if(f=V(o,a,i[t],i[t+1]),f<h){for(c=0;c<n;++c)l[c]=i[t+c];return l.length=n,f}return h}u=u||[NaN,NaN];let g=t+n;for(;g<e;)if(te(i,g-n,g,n,o,a,u),f=V(o,a,u[0],u[1]),f<h){for(h=f,c=0;c<n;++c)l[c]=u[c];l.length=n,g+=n}else g+=n*Math.max((Math.sqrt(f)-Math.sqrt(h))/s|0,1);if(te(i,e-n,t,n,o,a,u),f=V(o,a,u[0],u[1]),f<h){for(h=f,c=0;c<n;++c)l[c]=u[c];l.length=n}return h}function si(i,t,e,n,s,r,o,a,l,h,u){u=u||[NaN,NaN];for(let c=0,f=e.length;c<f;++c){const g=e[c];h=we(i,t,g,n,s,r,o,a,l,h,u),t=g}return h}function ri(i,t,e,n){for(let s=0,r=e.length;s<r;++s)i[t++]=e[s];return t}function Ae(i,t,e,n){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<n;++a)i[t++]=o[a]}return t}function oi(i,t,e,n,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Ae(i,t,e[o],n);s[r++]=l,t=l}return s.length=r,s}function ve(i,t,e,n,s){s=s!==void 0?s:[];let r=0;for(let o=t;o<e;o+=n)s[r++]=i.slice(o,o+n);return s.length=r,s}function ai(i,t,e,n,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=ve(i,t,l,n,s[r]),t=l}return s.length=r,s}function li(i,t,e,n,s,r,o){const a=(e-t)/n;if(a<3){for(;t<e;t+=n)r[o++]=i[t],r[o++]=i[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-n];let u=0;for(;h.length>0;){const c=h.pop(),f=h.pop();let g=0;const d=i[f],m=i[f+1],_=i[c],x=i[c+1];for(let R=f+n;R<c;R+=n){const w=i[R],C=i[R+1],F=cn(w,C,d,m,_,x);F>g&&(u=R,g=F)}g>s&&(l[(u-t)/n]=1,f+n<u&&h.push(f,u),u+n<c&&h.push(u,c))}for(let c=0;c<a;++c)l[c]&&(r[o++]=i[t+c*n],r[o++]=i[t+c*n+1]);return o}function G(i,t){return t*Math.round(i/t)}function ui(i,t,e,n,s,r,o){if(t==e)return o;let a=G(i[t],s),l=G(i[t+1],s);t+=n,r[o++]=a,r[o++]=l;let h,u;do if(h=G(i[t],s),u=G(i[t+1],s),t+=n,t==e)return r[o++]=h,r[o++]=u,o;while(h==a&&u==l);for(;t<e;){const c=G(i[t],s),f=G(i[t+1],s);if(t+=n,c==h&&f==u)continue;const g=h-a,d=u-l,m=c-a,_=f-l;if(g*_==d*m&&(g<0&&m<g||g==m||g>0&&m>g)&&(d<0&&_<d||d==_||d>0&&_>d)){h=c,u=f;continue}r[o++]=h,r[o++]=u,a=h,l=u,h=c,u=f}return r[o++]=h,r[o++]=u,o}function hi(i,t,e,n,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const u=e[l];o=ui(i,t,u,n,s,r,o),a.push(o),t=u}return o}class q extends vt{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new q(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,n,s){return s<ce(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ye(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),we(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,n,s))}getArea(){return Se(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ve(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=li(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new q(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ae(this.flatCoordinates,0,t,this.stride),this.changed()}}class Pt extends vt{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Pt(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){const r=this.flatCoordinates,o=V(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)n[l]=r[l];return n.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Je(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Ke(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ri(this.flatCoordinates,0,t,this.stride),this.changed()}}function ci(i,t,e,n,s){return!en(s,function(o){return!Y(i,t,e,n,o[0],o[1])})}function Y(i,t,e,n,s,r){let o=0,a=i[e-n],l=i[e-n+1];for(;t<e;t+=n){const h=i[t],u=i[t+1];l<=r?u>r&&(h-a)*(r-l)-(s-a)*(u-l)>0&&o++:u<=r&&(h-a)*(r-l)-(s-a)*(u-l)<0&&o--,a=h,l=u}return o!==0}function Pe(i,t,e,n,s,r){if(e.length===0||!Y(i,t,e[0],n,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(Y(i,e[o-1],e[o],n,s,r))return!1;return!0}function fi(i,t,e,n,s,r,o){let a,l,h,u,c,f,g;const d=s[r+1],m=[];for(let R=0,w=e.length;R<w;++R){const C=e[R];for(u=i[C-n],f=i[C-n+1],a=t;a<C;a+=n)c=i[a],g=i[a+1],(d<=f&&g<=d||f<=d&&d<=g)&&(h=(d-f)/(g-f)*(c-u)+u,m.push(h)),u=c,f=g}let _=NaN,x=-1/0;for(m.sort(ae),u=m[0],a=1,l=m.length;a<l;++a){c=m[a];const R=Math.abs(c-u);R>x&&(h=(u+c)/2,Pe(i,t,e,n,h,d)&&(_=h,x=R)),u=c}return isNaN(_)&&(_=s[r]),[_,d,x]}function gi(i,t,e,n,s){let r;for(t+=n;t<e;t+=n)if(r=s(i.slice(t-n,t),i.slice(t,t+n)),r)return r;return!1}function Fe(i,t,e,n,s,r){return r=r??de(fe(),i,t,e,n),ln(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:gi(i,t,e,n,function(o,a){return hn(s,o,a)}):!1}function Xe(i,t,e,n,s){return!!(Fe(i,t,e,n,s)||Y(i,t,e,n,s[0],s[1])||Y(i,t,e,n,s[0],s[3])||Y(i,t,e,n,s[2],s[1])||Y(i,t,e,n,s[2],s[3]))}function di(i,t,e,n,s){if(!Xe(i,t,e[0],n,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(ci(i,e[r-1],e[r],n,s)&&!Fe(i,e[r-1],e[r],n,s))return!1;return!0}function mi(i,t,e,n){for(;t<e-n;){for(let s=0;s<n;++s){const r=i[t+s];i[t+s]=i[e-n+s],i[e-n+s]=r}t+=n,e-=n}}function Ne(i,t,e,n){let s=0,r=i[e-n],o=i[e-n+1];for(;t<e;t+=n){const a=i[t],l=i[t+1];s+=(a-r)*(l+o),r=a,o=l}return s===0?void 0:s>0}function _i(i,t,e,n,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Ne(i,t,a,n);if(r===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;t=a}return!0}function ee(i,t,e,n,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Ne(i,t,a,n);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&mi(i,t,a,n),t=a}return t}class ht extends vt{constructor(t,e,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&n?(this.setFlatCoordinates(e,t),this.ends_=n):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?be(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new ht(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<ce(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ii(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),si(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,n,s))}containsXY(t,e){return Pe(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return ni(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),ee(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,ai(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=rt(this.getExtent());this.flatInteriorPoint_=fi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Pt(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new q(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,n=this.ends_,s=[];let r=0;for(let o=0,a=n.length;o<a;++o){const l=n[o],h=new q(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;_i(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=ee(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=hi(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,n),new ht(e,"XY",n)}getType(){return"Polygon"}intersectsExtent(t){return di(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=oi(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function ne(i){if(_e(i))throw new Error("Cannot create polygon from empty extent");const t=i[0],e=i[1],n=i[2],s=i[3],r=[t,e,t,s,n,s,n,e,t,e];return new ht(r,"XY",[r.length])}function et(i,t){return Array.isArray(i)?i:(t===void 0?t=[i,i]:(t[0]=i,t[1]=i),t)}const v={ANIMATING:0,INTERACTING:1},S={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function ie(i,t,e){return function(n,s,r,o,a){if(!n)return;if(!s&&!t)return n;const l=t?0:r[0]*s,h=t?0:r[1]*s,u=a?a[0]:0,c=a?a[1]:0;let f=i[0]+l/2+u,g=i[2]-l/2+u,d=i[1]+h/2+c,m=i[3]-h/2+c;f>g&&(f=(g+f)/2,g=f),d>m&&(d=(m+d)/2,m=d);let _=I(n[0],f,g),x=I(n[1],d,m);if(o&&e&&s){const R=30*s;_+=-R*Math.log(1+Math.max(0,f-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-g)/R),x+=-R*Math.log(1+Math.max(0,d-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-m)/R)}return[_,x]}}function Ri(i){return i}function xi(i){return Math.pow(i,3)}function Mi(i){return 1-xi(1-i)}function Ci(i){return 3*i*i-2*i*i*i}function Ft(i,t,e,n){const s=D(t)/e[0],r=k(t)/e[1];return n?Math.min(i,Math.max(s,r)):Math.min(i,Math.min(s,r))}function Xt(i,t,e){let n=Math.min(i,t);const s=50;return n*=Math.log(1+s*Math.max(0,i/t-1))/s+1,e&&(n=Math.max(n,e),n/=Math.log(1+s*Math.max(0,e/i-1))/s+1),I(n,e/2,t*2)}function Ei(i,t,e,n){return t=t!==void 0?t:!0,function(s,r,o,a){if(s!==void 0){const l=i[0],h=i[i.length-1],u=e?Ft(l,e,o,n):l;if(a)return t?Xt(s,u,h):I(s,h,u);const c=Math.min(u,s),f=Math.floor(St(i,c,r));return i[f]>u&&f<i.length-1?i[f+1]:i[f]}}}function Ti(i,t,e,n,s,r){return n=n!==void 0?n:!0,e=e!==void 0?e:0,function(o,a,l,h){if(o!==void 0){const u=s?Ft(t,s,l,r):t;if(h)return n?Xt(o,u,e):I(o,e,u);const c=1e-9,f=Math.ceil(Math.log(t/u)/Math.log(i)-c),g=-a*(.5-c)+.5,d=Math.min(u,o),m=Math.floor(Math.log(t/d)/Math.log(i)+g),_=Math.max(f,m),x=t/Math.pow(i,_);return I(x,e,u)}}}function se(i,t,e,n,s){return e=e!==void 0?e:!0,function(r,o,a,l){if(r!==void 0){const h=n?Ft(i,n,a,s):i;return!e||!l?I(r,t,h):Xt(r,h,t)}}}function pi(i){if(i!==void 0)return 0}function re(i){if(i!==void 0)return i}function Ii(i){const t=2*Math.PI/i;return function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e}}function Si(i){const t=H(5);return function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e}}const Ye=256,Rt=0;class yi extends he{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=At(t.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,t.projection&&zn(),t.center&&(t.center=A(t.center,this.projection_)),t.extent&&(t.extent=tt(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in S)delete e[a];this.setProperties(e,!0);const n=Ai(t);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=n.minZoom;const s=wi(t),r=n.constraint,o=vi(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const n=this.getCenterInternal();if(n){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let n=0;n<e.length;++n){let s=arguments[n];s.center&&(s=Object.assign({},s),s.center=A(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=A(s.anchor,this.getProjection())),e[n]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,n;e>1&&typeof arguments[e-1]=="function"&&(n=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const u=arguments[s];u.center&&this.setCenterInternal(u.center),u.zoom!==void 0?this.setZoom(u.zoom):u.resolution&&this.setResolution(u.resolution),u.rotation!==void 0&&this.setRotation(u.rotation)}if(s===e){n&&nt(n,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;s<e;++s){const u=arguments[s],c={start:r,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||Ci,callback:n};if(u.center&&(c.sourceCenter=o,c.targetCenter=u.center.slice(),o=c.targetCenter),u.zoom!==void 0?(c.sourceResolution=a,c.targetResolution=this.getResolutionForZoom(u.zoom),a=c.targetResolution):u.resolution&&(c.sourceResolution=a,c.targetResolution=u.resolution,a=c.targetResolution),u.rotation!==void 0){c.sourceRotation=l;const f=zt(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;c.targetRotation=l+f,l=c.targetRotation}Pi(c)?c.complete=!0:r+=c.duration,h.push(c)}this.animations_.push(h),this.setHint(v.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[v.ANIMATING]>0}getInteracting(){return this.hints_[v.INTERACTING]>0}cancelAnimations(){this.setHint(v.ANIMATING,-this.hints_[v.ANIMATING]);let t;for(let e=0,n=this.animations_.length;e<n;++e){const s=this.animations_[e];if(s[0].callback&&nt(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let n=this.animations_.length-1;n>=0;--n){const s=this.animations_[n];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const h=t-l.start;let u=l.duration>0?h/l.duration:1;u>=1?(l.complete=!0,u=1):r=!1;const c=l.easing(u);if(l.sourceCenter){const f=l.sourceCenter[0],g=l.sourceCenter[1],d=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=f+c*(d-f),x=g+c*(m-g);this.targetCenter_=[_,x]}if(l.sourceResolution&&l.targetResolution){const f=c===1?l.targetResolution:l.sourceResolution+c*(l.targetResolution-l.sourceResolution);if(l.anchor){const g=this.getViewportSize_(this.getRotation()),d=this.constraints_.resolution(f,0,g,!0);this.targetCenter_=this.calculateCenterZoom(d,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=f,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const f=c===1?zt(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+c*(l.targetRotation-l.sourceRotation);if(l.anchor){const g=this.constraints_.rotation(f,!0);this.targetCenter_=this.calculateCenterRotate(g,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=f}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[n]=null,this.setHint(v.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&nt(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let n;const s=this.getCenterInternal();return s!==void 0&&(n=[s[0]-e[0],s[1]-e[1]],mn(n,t-this.getRotation()),dn(n,e)),n}calculateCenterZoom(t,e){let n;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;n=[o,a]}return n}getViewportSize_(t){const e=this.viewportSize_;if(t){const n=e[0],s=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&Bt(t,this.getProjection())}getCenterInternal(){return this.get(S.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return Wn(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();y(e,"The view center is not defined");const n=this.getResolution();y(n!==void 0,"The view resolution is not defined");const s=this.getRotation();return y(s!==void 0,"The view rotation is not defined"),rn(e,n,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(S.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(tt(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=D(t)/e[0],s=k(t)/e[1];return Math.max(n,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(e/n)/Math.log(t);return function(r){return e/Math.pow(t,r*s)}}getRotation(){return this.get(S.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(n/s)/e;return function(o){return Math.log(n/o)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),n=this.getRotation();let s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=xt(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,n)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,n,s;if(this.resolutions_){const r=St(this.resolutions_,t,1);e=r,n=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=n/this.resolutions_[r+1]}else n=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(n/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];const e=I(Math.floor(t),0,this.resolutions_.length-2),n=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(n,I(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let n;if(y(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){y(!_e(t),"Cannot fit empty extent provided as `geometry`");const s=tt(t,this.getProjection());n=ne(s)}else if(t.getType()==="Circle"){const s=tt(t.getExtent(),this.getProjection());n=ne(s),n.rotate(this.getRotation(),rt(s))}else n=t;this.fitInternal(n,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),n=Math.cos(e),s=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,u=-1/0;for(let c=0,f=r.length;c<f;c+=o){const g=r[c]*n-r[c+1]*s,d=r[c]*s+r[c+1]*n;a=Math.min(a,g),l=Math.min(l,d),h=Math.max(h,g),u=Math.max(u,d)}return[a,l,h,u]}fitInternal(t,e){e=e||{};let n=e.size;n||(n=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],r=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[n[0]-s[1]-s[3],n[1]-s[0]-s[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const h=this.getRotation(),u=Math.sin(h),c=Math.cos(h),f=rt(a);f[0]+=(s[1]-s[3])/2*l,f[1]+=(s[0]-s[2])/2*l;const g=f[0]*c-f[1]*u,d=f[1]*c+f[0]*u,m=this.getConstrainedCenter([g,d],l),_=e.callback?e.callback:Mt;e.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),nt(_,!0))}centerOn(t,e,n){this.centerOnInternal(A(t,this.getProjection()),e,n)}centerOnInternal(t,e,n){this.setCenterInternal(xt(t,e,n,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,n,s){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-n),l=xt(t,s,[a[0]/2+o[3],a[1]/2+o[0]],e,n);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=Bt(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&A(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,s,n);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=A(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,n);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&A(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const n=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,n),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,0,r,n),a=this.constraints_.center(this.targetCenter_,o,r,n,this.calculateCenterShift(this.targetCenter_,o,s,r));this.get(S.ROTATION)!==s&&this.set(S.ROTATION,s),this.get(S.RESOLUTION)!==o&&(this.set(S.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(S.CENTER)||!ot(this.get(S.CENTER),a))&&this.set(S.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,n){t=t!==void 0?t:200;const s=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,s,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}n=n||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!ot(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:Mi,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(v.INTERACTING,1)}endInteraction(t,e,n){n=n&&A(n,this.getProjection()),this.endInteractionInternal(t,e,n)}endInteractionInternal(t,e,n){this.getInteracting()&&(this.setHint(v.INTERACTING,-1),this.resolveConstraints(t,e,n))}getConstrainedCenter(t,e){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),n)}getConstrainedZoom(t,e){const n=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(n,e))}getConstrainedResolution(t,e){e=e||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,n)}}function nt(i,t){setTimeout(function(){i(t)},0)}function wi(i){if(i.extent!==void 0){const e=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return ie(i.extent,i.constrainOnlyCenter,e)}const t=At(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,ie(e,!1,!1)}return Ri}function Ai(i){let t,e,n,o=i.minZoom!==void 0?i.minZoom:Rt,a=i.maxZoom!==void 0?i.maxZoom:28;const l=i.zoomFactor!==void 0?i.zoomFactor:2,h=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,c=i.showFullExtent!==void 0?i.showFullExtent:!1,f=At(i.projection,"EPSG:3857"),g=f.getExtent();let d=i.constrainOnlyCenter,m=i.extent;if(!h&&!m&&f.isGlobal()&&(d=!1,m=g),i.resolutions!==void 0){const _=i.resolutions;e=_[o],n=_[a]!==void 0?_[a]:_[_.length-1],i.constrainResolution?t=Ei(_,u,!d&&m,c):t=se(e,n,u,!d&&m,c)}else{const x=(g?Math.max(D(g),k(g)):360*xe.degrees/f.getMetersPerUnit())/Ye/Math.pow(2,Rt),R=x/Math.pow(2,28-Rt);e=i.maxResolution,e!==void 0?o=0:e=x/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=e/Math.pow(l,a):n=x/Math.pow(l,a):n=R),a=o+Math.floor(Math.log(e/n)/Math.log(l)),n=e/Math.pow(l,a-o),i.constrainResolution?t=Ti(l,e,n,u,!d&&m,c):t=se(e,n,u,!d&&m,c)}return{constraint:t,maxResolution:e,minResolution:n,minZoom:o,zoomFactor:l}}function vi(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const e=i.constrainRotation;return e===void 0||e===!0?Si():e===!1?re:typeof e=="number"?Ii(e):re}return pi}function Pi(i){return!(i.sourceCenter&&i.targetCenter&&!ot(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function xt(i,t,e,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=i[0]*r-i[1]*o,l=i[1]*r+i[0]*o;a+=(t[0]/2-e[0])*n,l+=(e[1]-t[1]/2)*n,o=-o;const h=a*r-l*o,u=l*r+a*o;return[h,u]}class Ze{constructor(t,e,n,s){this.minX=t,this.maxX=e,this.minY=n,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function L(i,t,e,n,s){return s!==void 0?(s.minX=i,s.maxX=t,s.minY=e,s.maxY=n,s):new Ze(i,t,e,n)}function Fi(i){const t=Object.keys(i.defs),e=t.length;let n,s;for(n=0;n<e;++n){const r=t[n];if(!it(r)){const o=i.defs(r);let a=o.units;!a&&o.projName==="longlat"&&(a="degrees"),ut(new ft({code:r,axisOrientation:o.axis,metersPerUnit:o.to_meter,units:a}))}}for(n=0;n<e;++n){const r=t[n],o=it(r);for(s=0;s<e;++s){const a=t[s],l=it(a);if(!st(r,a))if(i.defs[r]===i.defs[a])It([o,l]);else{const h=i(r,a);Un(o,l,Kt(o,l,h.forward),Kt(l,o,h.inverse))}}}}function oe(i,t,e,n){return n!==void 0?(n[0]=i,n[1]=t,n[2]=e,n):[i,t,e]}const z=[0,0,0],P=5;class Xi{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,y(Ue(this.resolutions_,(s,r)=>r-s),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,y(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=t.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=me(n)),y(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,y(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:Ye,y(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n!==void 0?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((s,r)=>{const o=new Ze(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(n){const a=this.getTileRangeForExtentAndZ(n,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,n){const s=this.getTileRangeForExtentAndZ(t,e);for(let r=s.minX,o=s.maxX;r<=o;++r)for(let a=s.minY,l=s.maxY;a<=l;++a)n([e,r,a])}forEachTileCoordParentTileRange(t,e,n,s){let r,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=L(o,o,a,a,n)):r=this.getTileRangeForExtentAndZ(l,h,n),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,n){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return L(r,r+1,o,o+1,e)}const s=this.getTileCoordExtent(t,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,n){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],r=t[1],o=t[2];if(e===s)return L(r,o,r,o,n);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-s),h=Math.floor(r*l),u=Math.floor(o*l);if(e<s)return L(h,h,u,u,n);const c=Math.floor(l*(r+1))-1,f=Math.floor(l*(o+1))-1;return L(h,c,u,f,n)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,n)}getTileRangeForExtentAndZ(t,e,n){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,z);const s=z[1],r=z[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,z);const o=z[1],a=z[2];return L(s,o,r,a,n)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=et(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*n,e[1]-(t[2]+.5)*s[1]*n]}getTileCoordExtent(t,e){const n=this.getOrigin(t[0]),s=this.getResolution(t[0]),r=et(this.getTileSize(t[0]),this.tmpSize_),o=n[0]+t[1]*r[0]*s,a=n[1]-(t[2]+1)*r[1]*s,l=o+r[0]*s,h=a+r[1]*s;return ct(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,n){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,n)}getTileCoordForXYAndResolution_(t,e,n,s,r){const o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),h=et(this.getTileSize(o),this.tmpSize_);let u=a*(t-l[0])/n/h[0],c=a*(l[1]-e)/n/h[1];return s?(u=J(u,P)-1,c=J(c,P)-1):(u=K(u,P),c=K(c,P)),oe(o,u,c,r)}getTileCoordForXYAndZ_(t,e,n,s,r){const o=this.getOrigin(n),a=this.getResolution(n),l=et(this.getTileSize(n),this.tmpSize_);let h=(t-o[0])/a/l[0],u=(o[1]-e)/a/l[1];return s?(h=J(h,P)-1,u=J(u,P)-1):(h=K(h,P),u=K(u,P)),oe(n,h,u,r)}getTileCoordForCoordAndZ(t,e,n){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,n)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const n=St(this.resolutions_,t,e||0);return I(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Xe(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,n=new Array(e);for(let s=this.minZoom;s<e;++s)n[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=n}}class Ni extends Xi{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}}function Yi(i){T.registerProj4(i),Fi(i)}function Zi(i){const t=T.LV95.getResolutionSteps(),e=t.find(n=>n.resolution===i);return e?t.indexOf(e):t.length-1}function Oi(i=.25){const t=Zi(i);let e=T.LV95.getResolutionSteps();return e.length>t&&(e=e.slice(0,t+1)),new Ni({resolutions:e.map(n=>n.resolution),origin:T.LV95.getTileOrigin(),matrixIds:e.map((n,s)=>s.toString()),extent:T.LV95.bounds?.flatten})}function ji(){return new yi({projection:T.LV95.epsg,center:T.LV95.bounds.center,zoom:T.LV95.getDefaultZoom(),minResolution:T.LV95_RESOLUTIONS[T.LV95_RESOLUTIONS.length-1],resolutions:T.LV95_RESOLUTIONS,extent:T.LV95.bounds.flatten,constrainOnlyCenter:!0})}exports.getLV95TileGrid=Oi;exports.getLV95View=ji;exports.registerSwissGeoProjections=Yi;
|
package/dist/ol.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { default as default_2 } from '
|
|
1
|
+
import { default as default_2 } from 'proj4';
|
|
2
|
+
import { default as default_3 } from 'ol/tilegrid/WMTS';
|
|
2
3
|
import { View } from 'ol';
|
|
3
4
|
|
|
4
|
-
export declare function getLV95TileGrid(maxResolution?: number):
|
|
5
|
+
export declare function getLV95TileGrid(maxResolution?: number): default_3;
|
|
5
6
|
|
|
6
7
|
export declare function getLV95View(): View;
|
|
7
8
|
|
|
8
|
-
export declare function registerSwissGeoProjections(): void;
|
|
9
|
+
export declare function registerSwissGeoProjections(proj4Instance: typeof default_2): void;
|
|
9
10
|
|
|
10
11
|
export { }
|