The toggle spelled its help twice: the styled chip the legend draws, and the browser's native title a few pixels below it saying the same thing. The chip is the whole tooltip now, and it says only what pressing would do -- Show labels, Hide labels -- because the row already names the collection; the name rides the spoken label alone.
- commit
- 7abce32c049d7d3042640ae236e11f00954eec8f
- parent
- 2668bb94325d79fb9f2659904d79f0c991da4c1c
- author
- Dami <dami.etoile@gmail.com>
| M | assets/ | 2 | +- |
| M | frontend/ | 14 | ++++++++------ |
@@ -4,7 +4,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
44 55 `).trim()}function jl(i){return new Intl.NumberFormat().format(i)}function us(i,e,t){return Math.min(t,Math.max(e,i))}function yE(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var hpe=100;function nd(){if(!ge.searchResults)return;let i=[...O.features.filter(n=>!n.filteredHidden).map(n=>({title:n.location.title,pin:n})),...[...O.zoneRecords.values()].filter(n=>n.zone.title&&!Io(n.zone.collectionId)&&(!O.search||n.zone.title.toLocaleLowerCase().includes(O.search))).map(n=>({title:n.zone.title,record:n}))].sort((n,r)=>n.title.localeCompare(r.title)),e=i.slice(0,hpe),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=O.search?"No visible features match.":"Nothing is enabled. Show a collection to list its features.",t.append(n)}for(let n of e)t.append(n.pin?fpe(n.pin):dpe(n.record));if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${jl(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ge.searchResults.replaceChildren(t),mpe(i.length),ppe()}function fpe(i){let e=document.createElement("button");e.type="button",e.className="search-result",O.selectedPin===i&&e.classList.add("is-selected"),e.dataset.location=String(i.location.id),uv(e,i.category);let t=document.createElement("span");t.className="result-dot",hv(t,i.category,bu(i.category.title));let n=document.createElement("span"),r=document.createElement("strong");r.textContent=i.location.title;let s=document.createElement("small");return s.textContent=[i.category.title,i.category.group].filter(Boolean).join(" \xB7 "),n.append(r,s),e.append(t,n),e}function dpe(i){let e=document.createElement("button");e.type="button",e.className="search-result",O.selectedZone===i.zone&&e.classList.add("is-selected"),e.dataset.zone=String(i.zone.id);let t=document.createElement("span");t.className="result-dot",t.style.setProperty("background",i.color);let n=document.createElement("span"),r=document.createElement("strong");r.textContent=i.zone.title;let s=document.createElement("small");return s.textContent=i.collection?.title||"Zone",n.append(r,s),e.append(t,n),e}var Qj=28;function ppe(){let i=O.selectedPin?.location.title||"",e=i.length>Qj?`${i.slice(0,Qj-1).trimEnd()}\u2026`:i;ge.dockRailName.textContent=e?` \xB7 ${e}`:"",ge.dockRailName.hidden=!e}function mpe(i){ge.dockCount.textContent=`${jl(i)} ${i===1?"feature":"features"}`,O.search?(ge.dockFlag.textContent=`\u201C${O.search}\u201D`,ge.dockFlag.hidden=!1):O.hiddenCollections.size>0?(ge.dockFlag.textContent="filtered",ge.dockFlag.hidden=!1):ge.dockFlag.hidden=!0}function Ny(){!O.dockFolded||O.dockDismissed||bE(!1)}function xN(i){O.dockDismissed=i,bE(i)}function bE(i,e=!0){O.dockFolded=i,ge.dock.classList.toggle("is-folded",i),ge.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ge.dockFold.setAttribute("aria-label",t),ge.dockFold.setAttribute("title",t),e&&Wl()}function wN(i){O.hiddenCollections.delete(i.category.id),dA(),Nc(),ph(),Fy(i,!0)}function Fy(i,e=!1){O.selectedPin=i,O.selectedZone=null,ge.detailCoordinatesField.hidden=!1,document.dispatchEvent(new Event("atlas:selection")),Fc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.priority.changed(),ge.detailTitle.textContent=i.location.title,ge.detailCategory.textContent=[i.category.group,i.category.title].filter(Boolean).join(" / "),ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,SN(),Spe(i),ge.detailID.textContent=String(i.location.id),ge.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=qq(i.coordinate);ge.detailCell.textContent=t,ge.detailCellField.hidden=!t;for(let r of ge.detail.querySelectorAll("[data-cell-system-row]"))r.remove();for(let r of by(O.world)){if(r.slug==="geohash")continue;let s=r.locate(i.coordinate,O.world);if(!s)continue;let o=document.createElement("div");o.dataset.cellSystemRow=r.slug;let a=document.createElement("dt");a.textContent=s.label;let l=document.createElement("dd");l.textContent=s.value,o.append(a,l),ge.detailCellField.after(o)}let n=wpe(i);if(ge.detailSource.textContent=n,ge.detailSourceField.hidden=!n,uv(ge.detailDot,i.category),hv(ge.detailDot,i.category,bu(i.category.title)),ge.detail.hidden=!1,Ny(),nd(),e){let r=O.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(mh(O.lens),Math.max(r.getZoom()||0,4)),duration:220})}}function wE(i){O.selectedPin=null,O.selectedZone=i,document.dispatchEvent(new Event("atlas:selection")),Fc(),O.layers.pins.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed();let e=z1(i);ge.detailTitle.textContent=i.title,ge.detailCategory.textContent=[e?.group,e?.title].filter(Boolean).join(" / ")||i.subtitle||"Zone",ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,ge.detailLinks.replaceChildren(),ge.detailID.textContent=String(i.id),ge.detailCoordinatesField.hidden=!0,ge.detailCellField.hidden=!0;for(let n of ge.detail.querySelectorAll("[data-cell-system-row]"))n.remove();let t=O.world?.merged?.find(n=>n.origin)?.source||"";ge.detailSource.textContent=t,ge.detailSourceField.hidden=!t,ge.detailDot.textContent="",ge.detailDot.removeAttribute("style"),ge.detailDot.style.setProperty("background",cv(i.id)),SN(),Jj([...Ape(i,e),...SD(i.attrs)]),i.hasText?bpe(i):ge.detailDescription.textContent="No description is included in the archive.",ge.detail.hidden=!1,Ny(),nd()}function Ape(i,e){let t=O.zoneRecords.get(i.id);if(!t||!e)return[];let n=[],r=xy(O.world);if(e.kind==="area"){if(r){let o=t.geometries.reduce((a,l)=>a+vpe(l,r),0);o>0&&n.push({label:"Area",value:xpe(o)})}let s=O.features.filter(o=>!o.filteredHidden&&By(o.location)&&t.geometries.some(a=>xD(a,o.coordinate))).length;n.push({label:"Locations inside",value:jl(s)})}if(e.kind==="path"&&r){let s=t.geometries.reduce((o,a)=>o+_pe(a,r),0);s>0&&n.push({label:"Length",value:ype(s)})}return n}var yN=110.574;function bN(i,[e,t]){return i.toLatLng(e,-t)}function gpe(i,e){let t=i.map(o=>bN(e,o));if(t.length<3)return 0;let n=t.reduce((o,a)=>o+a[0],0)/t.length,r=111.32*Math.cos(n*Math.PI/180),s=0;for(let o=0,a=t.length-1;o<t.length;a=o++){let[l,c]=t[a],[u,f]=t[o];s+=c*r*u*yN-f*r*l*yN}return Math.abs(s)/2}function vpe(i,e){let t=i.getType()==="MultiPolygon"?i.getPolygons():i.getType()==="Polygon"?[i]:[],n=0;for(let r of t)r.getLinearRings().forEach((s,o)=>{let a=gpe(s.getCoordinates(),e);n+=o===0?a:-a});return Math.max(0,n)}function _pe(i,e){let t=i.getType()==="MultiLineString"?i.getCoordinates():i.getType()==="LineString"?[i.getCoordinates()]:[],n=0;for(let r of t)for(let s=1;s<r.length;s++){let[o,a]=bN(e,r[s-1]),[l,c]=bN(e,r[s]),u=(o+l)/2*(Math.PI/180),f=(c-a)*111.32*Math.cos(u),d=(l-o)*yN;n+=Math.hypot(f,d)}return n}function xpe(i){return`${i>=10?jl(Math.round(i)):i.toFixed(2)} km\xB2`}function ype(i){return i<1?`${Math.round(i*1e3)} m`:`${i>=10?jl(Math.round(i)):i.toFixed(1)} km`}function SN(){for(let i of ge.detail.querySelectorAll("[data-feature-row]"))i.remove()}function Jj(i){let e=ge.detailSourceField;for(let t of i){let n=document.createElement("div");n.dataset.featureRow="";let r=document.createElement("dt");r.textContent=t.label;let s=document.createElement("dd");s.textContent=t.value,n.append(r,s),e.after(n),e=n}}async function bpe(i){let e=await TN();if(O.selectedZone!==i)return;let t=e[String(i.id)]||{};ge.detailDescription.textContent=_N(t.d)||"No description is included in the archive."}function wpe(i){let e=O.world?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(O.pinSourceIndex?.world!==O.world){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}O.pinSourceIndex={world:O.world,byID:n}}for(let n of e)if(!n.origin&&i.category.group===n.source)return n.source;return O.pinSourceIndex.byID.get(i.location.id)||t}async function Spe(i){let e=await TN();if(O.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ge.detailDescription.textContent=_N(t.d)||"No description is included in the archive.",SN(),Jj(SD(t.a)),Tpe(i)}function Tpe(i){let e=(i.location.links||[]).filter(n=>O.featureByID.has(n.locationId));if(ge.detailLinks.hidden=e.length===0,!e.length){ge.detailLinks.replaceChildren();return}let t=document.createDocumentFragment();for(let n of e){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(n.locationId),r.textContent=n.title,t.append(r)}ge.detailLinks.replaceChildren(t)}function id(){let i=O.selectedPin!==null||O.selectedZone!==null;O.selectedPin=null,O.selectedZone=null,document.dispatchEvent(new Event("atlas:selection")),O.sources&&(Fc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()),ge.detail.hidden=!0,i&&nd()}function Bc(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function Pp(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=Bc(i,e,l,n,r[s]),e=l}return r.length=s,r}function Oy(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=l.length===1&&l[0]===e?[]:Pp(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var EN=class i extends Al{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Do(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<Rc(this.getExtent(),e,t))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let c=pu(e,t,s[a],s[a+1]);if(c<r){r=c;for(let u=0;u<o;++u)n[u]=s[a+u];n.length=o}}return r}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new yu(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=n){let a=new yu(e.slice(s,s+n),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,s=t.length;r<s;r+=n){let o=t[r],a=t[r+1];if(wy(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uA(this.flatCoordinates,0,e,this.stride),this.changed()}},eX=EN;function MN(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1],a=0,l=0;for(;e<t;e+=n){let c=i[e]-s,u=i[e+1]-o;r+=l*c-a*u,a=c,l=u}return r/2}function CN(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=MN(i,e,a,n),e=a}return r}function tX(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=CN(i,e,a,n),e=a[a.length-1]}return r}function nX(i,e,t,n,r,s,o){let a=i[e],l=i[e+1],c=i[t]-a,u=i[t+1]-l,f;if(c===0&&u===0)f=e;else{let d=((r-a)*c+(s-l)*u)/(c*c+u*u);if(d>1)f=t;else if(d>0){for(let A=0;A<n;++A)o[A]=Lo(i[e+A],i[t+A],d);o.length=n;return}else f=e}for(let d=0;d<n;++d)o[d]=i[f+d];o.length=n}function Uy(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){let a=i[e],l=i[e+1],c=pu(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function ky(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=Uy(i,e,a,n,r),e=a}return r}function iX(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=ky(i,e,a,n,r),e=a[a.length-1]}return r}function zy(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,d;if(r===0){if(d=pu(o,a,i[e],i[e+1]),d<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,d}return c}u=u||[NaN,NaN];let A=e+n;for(;A<t;)if(nX(i,A-n,A,n,o,a,u),d=pu(o,a,u[0],u[1]),d<c){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n,A+=n}else A+=n*Math.max((Math.sqrt(d)-Math.sqrt(c))/r|0,1);if(s&&(nX(i,t-n,e,n,o,a,u),d=pu(o,a,u[0],u[1]),d<c)){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function Vy(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=zy(i,e,A,n,r,s,o,a,l,c,u),e=A}return c}function rX(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Vy(i,e,A,n,r,s,o,a,l,c,u),e=A[A.length-1]}return c}function pA(i,e,t,n,r,s,o){let a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[e,t-n],u=0;for(;c.length>0;){let f=c.pop(),d=c.pop(),A=0,y=i[d],w=i[d+1],S=i[f],T=i[f+1];for(let R=d+n;R<f;R+=n){let I=i[R],P=i[R+1],F=MW(I,P,y,w,S,T);F>A&&(u=R,A=F)}A>r&&(l[(u-e)/n]=1,d+n<u&&c.push(d,u),u+n<f&&c.push(u,f))}for(let f=0;f<a;++f)l[f]&&(s[o++]=i[e+f*n],s[o++]=i[e+f*n+1]);return o}function SE(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=pA(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Ip(i,e){return e*Math.round(i/e)}function Epe(i,e,t,n,r,s,o){if(e==t)return o;let a=Ip(i[e],r),l=Ip(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Ip(i[e],r),u=Ip(i[e+1],r),e+=n,e==t)return s[o++]=c,s[o++]=u,o;while(c==a&&u==l);for(;e<t;){let f=Ip(i[e],r),d=Ip(i[e+1],r);if(e+=n,f==c&&d==u)continue;let A=c-a,y=u-l,w=f-a,S=d-l;if(A*S==y*w&&(A<0&&w<A||A==w||A>0&&w>A)&&(y<0&&S<y||y==S||y>0&&S>y)){c=f,u=d;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=d}return s[o++]=c,s[o++]=u,o}function Gy(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Epe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function sX(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Gy(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var RN=class i extends Al{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new i(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Uy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return MN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=pA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return oA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uA(this.flatCoordinates,0,e,this.stride),this.changed()}},PN=RN;function qy(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y=r[s+1],w=[];for(let R=0,I=t.length;R<I;++R){let P=t[R];for(u=i[P-n],d=i[P-n+1],a=e;a<P;a+=n)f=i[a],A=i[a+1],(y<=d&&A<=y||d<=y&&y<=A)&&(c=(y-d)/(A-d)*(f-u)+u,w.push(c)),u=f,d=A}let S=NaN,T=-1/0;for(w.sort(pl),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let R=Math.abs(f-u);R>T&&(c=(u+f)/2,Py(i,e,t,n,c,y)&&(S=c,T=R)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,y,T),o):[S,y,T]}function TE(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=qy(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function oX(i,e,t,n){for(;e<t-n;){for(let r=0;r<n;++r){let s=i[e+r];i[e+r]=i[t-n+r],i[t-n+r]=s}e+=n,t-=n}}function IN(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1];for(;e<t;e+=n){let a=i[e],l=i[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function LN(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=IN(i,e,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function aX(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!LN(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function EE(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=IN(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&oX(i,e,a,n),e=a}return e}function DN(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=EE(i,e,t[s],n,r);return e}function lX(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=IN(i,n,l,2);if(s===void 0&&(s=c),c===s)t.push(e.slice(r,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=o+1,n=l}return t}var ME=class i extends Al{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Do(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Py(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return CN(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),EE(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Pp(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=dl(this.getExtent());this.flatInteriorPoint_=qy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new yu(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new PN(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o],c=new PN(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;LN(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=EE(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Gy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return jD(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Dy(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Ah=ME;function NN(i){if(hh(i))throw new Error("Cannot create polygon from empty extent");let e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new ME(s,"XY",[s.length])}function CE(i,e,t,n){let r=[],s=Wr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=q1(i,e,l[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}var FN=class i extends Al{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let d=0,A=f.length;d<A;++d)f[d]+=u;Do(s,c.getFlatCoordinates()),o.push(f)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;Do(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();let n=new i(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(iX(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),rX(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return oj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return tX(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),DN(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Oy(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=CE(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=TE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new eX(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;aX(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=DN(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=sX(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let s=this.endss_[e-1];t=s[s.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new Ah(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,d=l.length;f<d;++f)l[f]-=s;let u=new Ah(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return lj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Zj(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},RE=FN;function cX(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),uX(),O.gridEnabled?(ge.gridInput.focus(),ge.gridInput.select()):ge.viewport.focus({preventScroll:!0}),!0):i.key===" "&&O.gridEnabled&&i.target!==ge.subgridToggle?(i.preventDefault(),Hy(!O.subgridVisible),!0):i.key==="Escape"&&O.gridEnabled?(i.preventDefault(),BN(),!0):!1}function uX(i=!O.gridEnabled){O.gridEnabled=i,i&&Hy(!0),Wy(),Fc(),O.layers.pins.changed(),O.layers.priority.changed()}function Hy(i){O.subgridVisible=i,O.layers.grid.changed(),O.layers.gridContext.changed(),ge.subgridToggle.setAttribute("aria-pressed",String(i)),ge.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),hX(),document.dispatchEvent(new Event("atlas:grid"))}function hX(){if(!O.gridEnabled){ge.gridHint.textContent="G \xB7 grid off";return}ge.gridHint.textContent=`G-${O.gridCell||"root"}`+(O.subgridVisible?"":" no subgrid")}function mA(i){let e=Ss(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==O.gridCell;O.gridCell=t,O.gridEnabled||(O.gridEnabled=!0),Wy(),Fc(),O.layers.pins.changed(),O.layers.priority.changed(),n&&(id(),O.engine.getView().fit(UN(),{size:O.engine.getSize(),padding:[52,52,52,52],maxZoom:mh(O.lens),duration:180}))}function BN(){if(O.gridEnabled){if(!O.gridCell){uX(!1);return}mA(Ss().parent(O.gridCell))}}function Wy(){if(O.sources){if(O.sources.grid.clear(),O.sources.gridContext.clear(),ge.gridNavigator.hidden=!O.gridEnabled,hX(),Mpe(),O.gridEnabled&&O.lens){let i=Ss();ge.gridInput.maxLength=i.inputLength(O.world),ge.gridInput.value=O.gridCell,ge.gridBack.title=O.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of LE())Ipe(e)}document.dispatchEvent(new Event("atlas:grid"))}}function Mpe(){let i=by(O.world),e=Ss();if(ge.gridSystemName.textContent=e.name,ge.gridSystem.hidden=i.length<2,i.length<2)return;let t=i[(i.indexOf(e)+1)%i.length];ge.gridSystem.textContent=e.short,ge.gridSystem.title=`Dividing by ${e.name} \xB7 \u2318G for ${t.name}`,ge.gridSystem.setAttribute("aria-label",`Cell system: ${e.name}. Switch to ${t.name}`)}function ON(){let i=by(O.world);if(i.length<2)return;let e=i.indexOf(Ss());Cpe(i[(e+1)%i.length].slug)}function Cpe(i){if(i===O.gridSystem)return;let e=Ss(),t=O.gridCell;O.gridSystem=i,O.gridCell=t?_W(e,Ss(),t,O.world):"",Wy(),Fc(),O.layers.pins.changed(),O.layers.priority.changed()}function Rpe(i){return Wf[Ss().colorKey(i)]}function IE(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=Rpe(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Vi.lineWhite:s,opacity:n==="neighbor"?Vi.neighborLineAlpha:n==="child"?Vi.childLineAlpha:1,widthPx:a?Vi.widths.scopeBare:Vi.widths[n]},c=null;n==="neighbor"?c={color:Vi.dimColor,opacity:Math.min(Vi.dimCap,Vi.dimBase+r*Vi.dimStep)}:n==="leaf"?c={color:s,opacity:Vi.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Vi.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:d}=Ss().label(i.hash);u={prefix:f,final:d,color:o?Vi.lineWhite:s,textAlpha:n==="neighbor"?Vi.neighborTextAlpha:1,chip:n==="neighbor"?Vi.neighborChip:Vi.chip,sizePx:n==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function LE(){let i=Ss(),e=[],t=Ppe(i,O.gridCell);for(let n=0;n<t.length-1;n++){let r=t[n+1];for(let s of i.children(t[n]))s!==r&&e.push(PE(i,s,"neighbor",t.length-1-n))}if(O.gridCell&&i.level(O.gridCell)>=i.maxLevel(O.world))return e.push(PE(i,O.gridCell,"leaf",0)),e;O.gridCell&&e.push(PE(i,O.gridCell,"scope",0));for(let n of i.children(O.gridCell))e.push(PE(i,n,"child",0));return e}function Ppe(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function PE(i,e,t,n){return{hash:e,extent:i.bbox(e),ring:i.ring(e),pole:i.poleContained(e),childIndex:i.childIndex(e),role:t,contextDistance:n}}function Ipe(i){let e=Ss(),t=O.features.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Rp({geometry:Lpe(i),gridCell:{hash:i.hash,extent:i.extent,role:i.role,count:t,contextDistance:i.contextDistance},priority:i.role==="neighbor"?-i.contextDistance*100+i.childIndex:i.childIndex});(i.role==="neighbor"?O.sources.gridContext:O.sources.grid).addFeature(n)}function Lpe(i){let e=jf(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1];t=[...t,[t[t.length-1][0],o],[t[0][0],o],t[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new Ah([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=xW(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new RE(s)}function UN(){return Ss().bbox(O.gridCell)}function fX(){return Ss().maxLevel(O.world)}function Lp(i){return!O.gridEnabled||!O.gridCell?!1:Ss().contains(O.gridCell,i.coordinate)}var NE=[NaN,NaN,NaN,0],kN;function Dpe(){return kN||(kN=Di(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),kN}var Npe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Fpe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Bpe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ope=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function DE(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Xy(i){throw new Error('failed to parse "'+i+'" as color')}function dX(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Fpe)||i.match(Npe)||i.match(Bpe);if(s){let o=s[4],a=100/255;return[Si(DE(s[1],a)+.5|0,0,255),Si(DE(s[2],a)+.5|0,0,255),Si(DE(s[3],a)+.5|0,0,255),o!==void 0?Si(DE(o,100),0,1):1]}Xy(i)}if(i.startsWith("#")){if(Ope.test(i)){let s=i.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=s.length;l<c;l+=o){let u=parseInt(s.substring(l,l+o),16);o===1&&(u+=u<<4),a[l/o]=u}return a[3]=a[3]/255,a}Xy(i)}let e=Dpe();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&Xy(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return dX(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);let r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=Jm(r[3]/255,3),r}function pX(i){return typeof i=="string"?i:Yy(i)}var Upe=1024,jy={},zN=0;function mX(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function VN(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function GN(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function qN(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function HN(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function WN(i){let e=qN(i[0]),t=qN(i[1]),n=qN(i[2]),r=HN(e*.222488403+t*.716873169+n*.06060791),s=500*(HN(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-HN(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function AX(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=GN(e),s=GN(e+t/500*Math.cos(n)),o=GN(e-t/200*Math.sin(n)),a=VN(s*3.021973625-r*1.617392459-o*.404875592),l=VN(s*-.943766287+r*1.916279586+o*.027607165),c=VN(s*.069407491-r*.22898585+o*1.159737864);return[Si(a+.5|0,0,255),Si(l+.5|0,0,255),Si(c+.5|0,0,255),i[3]]}function $y(i){if(i==="none")return NE;if(jy.hasOwnProperty(i))return jy[i];if(zN>=Upe){let t=0;for(let n in jy)(t++&3)===0&&(delete jy[n],--zN)}let e=dX(i);e.length!==4&&Xy(i);for(let t of e)isNaN(t)&&Xy(i);return jy[i]=e,++zN,e}function Oc(i){return Array.isArray(i)?i:$y(i)}function Yy(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);let r=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+r+")"}var XN=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=jN(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=jN(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=jN(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===Pn.IDLE&&n.load(),n.getImageState()===Pn.LOADING?n.ready().then(()=>{this.patternCache_[s]=Ly().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Ly().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function jN(i,e){let t=e?Oc(e):"null";return i+":"+t}var na=new XN;var Zy=null,FE=class extends Cp{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?Pn.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Pn.LOADED){Zy||(Zy=Di(1,1,void 0,{willReadFrequently:!0})),Zy.drawImage(this.image_,0,0);try{Zy.getImageData(0,0,1,1),this.tainted_=!1}catch{Zy=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(nn.CHANGE)}handleImageError_(){this.imageState_=Pn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Pn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Di(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Pn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Pn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&_j(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Pn.LOADED)return;let t=this.image_,n=Di(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=pX(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===Pn.LOADED||this.imageState_===Pn.ERROR)e();else{let t=()=>{(this.imageState_===Pn.LOADED||this.imageState_===Pn.ERROR)&&(this.removeEventListener(nn.CHANGE,t),e())};this.addEventListener(nn.CHANGE,t)}})),this.ready_}};function Dp(i,e,t,n,r,s){let o=e===void 0?void 0:na.get(e,r);return o||(o=new FE(i,i&&"src"in i?i.src||void 0:e,t,n,r),na.set(e,r,o,s)),s&&o&&!na.getPattern(e,r)&&na.set(e,r,o,s),o}var gX=FE;function gl(i){return i?Array.isArray(i)?Yy(i):typeof i=="object"&&"src"in i?kpe(i):i:null}function kpe(i){if(!i.offset||!i.size)return na.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=na.getPattern(e,i.color);if(t)return t;let n=na.get(i.src,null);if(n.getImageState()!==Pn.LOADED)return null;let r=Di(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),Dp(r.canvas,e,void 0,Pn.LOADED,i.color,!0),na.getPattern(e,i.color)}var Ky="ol-hidden";var Np="ol-unselectable";var fv="ol-control",$N="ol-collapsed",zpe=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),vX=["style","variant","weight","size","lineHeight","family"],BE={normal:400,bold:700},OE=function(i){let e=i.match(zpe);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=vX.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[vX[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in BE&&(t.weight=BE[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var UE="10px sans-serif",io="#000",gh="round",vl=[],_l=0,vh="round",rd=10,xX=0,ia="#000",Fp="center",gA="middle",sd=[0,0,0,0],od=1,AA=new Us,Qy=null,_X,YN={},Vpe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Gpe(i,e,t){return`${i} ${e} 16px "${t}"`}var yX=(function(){let e,t;async function n(s){await t.ready;let o=OE(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let d=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),A=BE[f.weight]||f.weight;d===a&&f.style===o.style&&A==l&&c.push(f)}),c.length===0?!1:(await Promise.all(c.map(f=>f.load().then(()=>!0,()=>!1)))).some(f=>f)}async function r(){await t.ready;let s=!0,o=AA.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],u=o[c];u<100&&(await n(c)?(dh(YN),AA.set(c,100)):(u+=10,AA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=no?self.fonts:document.fonts);let o=OE(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(Vpe.has(c))continue;let u=Gpe(o.style,o.weight,c);AA.get(u)===void 0&&(AA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),qpe=(function(){let i;return function(e){let t=YN[e];if(t==null){if(no){let n=OE(e),r=bX(e,"\u017Dg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);YN[e]=t}return t}})();function bX(i,e){return Qy||(Qy=Di(1,1)),i!=_X&&(Qy.font=i,_X=Qy.font),Qy.measureText(e)}function wX(i,e){return bX(i,e).width}function ZN(i,e,t){if(e in t)return t[e];let n=e.split(`66 `).reduce((r,s)=>Math.max(r,wX(i,s)),0);return t[e]=n,n}function SX(i,e){let t=[],n=[],r=[],s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){let f=e[c];if(f===`7-`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let d=e[c+1]||i.font,A=wX(d,f);t.push(A),o+=A;let y=qpe(d);n.push(y),l=Math.max(l,y)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function TX(i,e,t,n,r,s,o,a,l,c,u){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=f=>f.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(u[0],u[1]),Hpe(n,i)):u[0]<0||u[1]<0?(i.translate(l,c),i.scale(u[0],u[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,c,o*u[0],a*u[1]),i.restore()}function Hpe(i,e){let t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}var KN=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=cs(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return ei()}getImage(e){return ei()}getHitDetectionImage(){return ei()}getPixelRatio(e){return 1}getImageState(){return ei()}getImageSize(){return ei()}getOrigin(){return ei()}getSize(){return ei()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=cs(e)}listenImageChange(e){ei()}load(){ei()}unlistenImageChange(e){ei()}ready(){return Promise.resolve()}},kE=KN;var QN=class i extends kE{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Pn.LOADING:Pn.LOADED,this.imageState_===Pn.LOADING&&this.ready().then(()=>this.imageState_=Pn.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=na.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Di(o,o);this.draw_(s,a,e),r=a.canvas;let l=new gX(r,void 0,null,Pn.LOADED,null);na.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),d=f/l;if(e==="miter"&&d<=n)return d*t;let A=t/2/d,y=t/2*(u/f),S=Math.sqrt((r+A)*(r+A)+y*y)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),R=Math.sqrt(r*r-T*T),I=s-R,F=Math.sqrt(T*T+I*I)/T;if(F<=n){let D=F*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=gh,t=vh,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=gl(this.stroke_.getColor()??ia),a=this.stroke_.getWidth()??od,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??vh,e=this.stroke_.getLineCap()??gh,n=this.stroke_.getMiterLimit()??rd);let l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),u=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:u,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=io),t.fillStyle=gl(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=Oc(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Di(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=io,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},zE=QN;var JN=class i extends zE{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}},VE=JN;var e5=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=Dp(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Pn.IDLE&&t.load(),t.getImageState()===Pn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Bn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Oc(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},ks=e5;function EX(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}var t5=class i extends kE{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;jn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Bn(o)),jn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),jn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=Pn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Pn.LOADED:Pn.IDLE:l=Pn.LOADING:l=Pn.LOADED),this.color_=e.color!==void 0?Oc(e.color):null,this.iconImage_=Dp(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;let A=this.iconImage_.getSize();this.setScale(EX(A[0],A[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(EX(c,u,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new i({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Oc(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?Pn.IDLE:this.iconImage_.getImageState();this.iconImage_=Dp(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Dp(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Pn.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Pn.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Pn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(nn.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(nn.CHANGE,e)}ready(){return this.iconImage_.ready()}},vA=t5;var n5=class i{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},ro=n5;var GE=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=MX,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new i({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=MX,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function CX(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(jn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var i5=null;function r5(i,e){if(!i5){let t=new ks({color:"rgba(255,255,255,0.4)"}),n=new ro({color:"#3399CC",width:1.25});i5=[new GE({image:new VE({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return i5}function MX(i){return i.getGeometry()}var Xr=GE;var Wpe="#333",s5=class i{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=cs(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new ks({color:Wpe}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof ks?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=cs(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},Bp=s5;function ad(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function IX(i){let e=i.get("pin");return!e||ld(e)||e.passesZoneFilters||u5(e)?null:a5(e,!1)}function LX(i){let e=i.get("pin");return!e||!O.highlightedZones.size||!e.passesZoneFilters||ld(e)||u5(e)?null:a5(e,!1)}function DX(i){let e=i.get("pin");return!e||ld(e)||Zf(null,e.category)!=="always"&&!(O.labelsHeld&&!hW(e.category))?null:FX(e)}function NX(i){let e=i.get("pin");if(!e||ld(e))return null;let t=a5(e,e===O.selectedPin);return e===O.hoveredPin||e===O.selectedPin?[t,FX(e)]:t}function a5(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(O.styleCache.has(t))return O.styleCache.get(t);let n=fA(i.category),r=e?2e7:i.priority,s=O.markerIcons.get(Jy(i.category)),o;return s?o=new Xr({image:new vA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Xr({text:new Bp({text:bu(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new ks({color:n}),stroke:new ro({color:hA(),width:e?4:3})}),zIndex:r}),O.styleCache.set(t,o),o}function FX(i){let e=`marker-label:${i.location.id}`;if(O.styleCache.has(e))return O.styleCache.get(e);let t=new Xr({text:new Bp({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new ks({color:"#f2ece0"}),stroke:new ro({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new ks({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return O.styleCache.set(e,t),t}function BX(i){if(!i.iconAsset)return;let e=Jy(i);if(O.markerIcons.has(e))return;O.markerIcons.set(e,null);let t=new Image;t.onload=()=>{let n=document.createElement("canvas");n.width=64,n.height=64;let r=n.getContext("2d"),s=fA(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=hA(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),O.markerIcons.set(e,n.toDataURL("image/png")),jpe(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.priority.changed()},t.onerror=()=>O.markerIcons.set(e,!1),t.src=vN(i.iconAsset)}function jpe(){for(let i of O.styleCache.keys())i.startsWith("marker:")&&O.styleCache.delete(i)}function Jy(i){return`${i.iconAsset||""}:${fA(i)}:${O.world?.iconOutset||"light"}`}function qE(i,e){return`${i} ${e}px ${Vi.labelFont}`}function l5(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Vi.neighborLabelSizePx:Vi.labelSizePx,s=qE(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=$pe(t,s,r,o,e),l=IE(t,{subgridVisible:O.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${O.gridSystem}:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(O.styleCache.has(c))return O.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new Xr({fill:l.fill?new ks({color:Dc(l.fill.color,l.fill.opacity)}):void 0,stroke:new ro({color:Dc(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let d=l.label.prefix?[l.label.prefix,qE(500,r),l.label.final,qE(900,r)]:l.label.final,A=Vi.labelInsetPx*e,y=Xpe(i.getGeometry());y&&f.push(new Xr({geometry:new yu([y[0]-A,y[1]+A]),text:new Bp({text:d,font:qE(900,r),textAlign:"right",textBaseline:"bottom",fill:new ks({color:Dc(l.label.color,l.label.textAlpha)}),backgroundFill:new ks({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return O.styleCache.set(c,f),f}function Xpe(i){let e=i.getType()==="MultiPolygon"?i.getCoordinates():[i.getCoordinates()],t=null;for(let n of e)for(let[r,s]of n[0]||[])(!t||r-s>t[0]-t[1])&&(t=[r,s]);return t}function $pe(i,e,t,n,r){if(!r)return!0;let s=c5(i.hash,e)+n[1]+n[3],o=t+n[0]+n[2];return s<=(i.extent[2]-i.extent[0])/r&&o<=(i.extent[3]-i.extent[1])/r}var RX=document.createElement("canvas").getContext("2d"),PX=new Map;function c5(i,e){let t=`${e}|${i}`,n=PX.get(t);return n===void 0&&(RX.font=e,n=RX.measureText(i).width,PX.set(t,n)),n}var Ype=new Xr({fill:new ks({color:"rgba(5, 8, 16, 0.62)"})});function OX(){return V1()?Ype:null}function UX(i,e){let t=i.get("zone");if(Io(fu(t)))return null;let n=i.get("child"),r=O.highlightedZones.has(t.id),s=GX(t.id),o=Number(t.attrs?.["atlas.stroke.width_px"])||Number(z1(t)?.attrs?.["atlas.stroke.width_px"])||0;if(o>0&&i.getGeometry()?.getType()==="MultiLineString")return Zpe(t,i.get("color"),o/e,r,s);let a=`zone:${t.id}:${n?1:0}:${r?1:s?2:0}`;if(O.styleCache.has(a))return O.styleCache.get(a);let l=i.get("color");if(s){let f=new Xr({stroke:new ro({color:Dc(l,n?.34:.44),width:n?1:1.3,lineDash:n?[3,4]:[7,5]}),zIndex:n?101:100});return O.styleCache.set(a,f),f}let c=new Xr({fill:new ks({color:Dc(l,n?.035:.07)}),stroke:new ro({color:Dc(l,n?.5:.72),width:n?1.2:1.8,lineDash:n?[3,4]:[7,5]})});if(!r)return O.styleCache.set(a,c),c;let u=[new Xr({stroke:new ro({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Xr({fill:new ks({color:Dc(l,.22)}),stroke:new ro({color:l,width:2.6}),zIndex:9001})];return O.styleCache.set(a,u),u}function Zpe(i,e,t,n,r){let s=Math.max(t,1.5);return n?[new Xr({stroke:new ro({color:"rgba(255,255,255,0.94)",width:s+4,lineCap:"round",lineJoin:"round"}),zIndex:9e3}),new Xr({stroke:new ro({color:Dc(e,.9),width:s,lineCap:"round",lineJoin:"round"}),zIndex:9001})]:[new Xr({stroke:new ro({color:Dc(e,r?.14:.3),width:s,lineCap:"round",lineJoin:"round"})}),new Xr({stroke:new ro({color:Dc(e,r?.4:.8),width:Math.min(1.6,s),lineDash:[7,5]})})]}function kX(i){if(h5())return null;let e=i.get("zone");if(Io(fu(e))||VX(e))return null;let t=O.highlightedZones.has(e.id);if(Zf(e)==="quiet")return o5(i);let n=i.get("child"),r=O.engine.getView().getZoom()||0;if(!t&&n&&r<O.fitZoom+3)return null;let s=i.get("span")/O.engine.getView().getResolution();return!t&&O.zoneTitleCount>40&&s<52?null:o5(i)}function zX(i){if(!h5())return null;let e=i.get("zone");return Io(fu(e))||VX(e)?null:o5(i)}function VX(i){return Zf(i)!=="quiet"||O.highlightedZones.has(i.id)||O.selectedZone===i?!1:O.labelOverrides.get(fu(i))==="quiet"||!O.labelsHeld}function o5(i){let e=i.get("child"),t=i.get("zone"),n=O.highlightedZones.has(t.id),r=GX(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(O.styleCache.has(s))return O.styleCache.get(s);let o=i.get("color"),a=new Xr({text:new Bp({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new ks({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new ro({color:n?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:n?2:r?3:4}),backgroundFill:new ks({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new ro({color:n?"#ffffff":Dc(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return O.styleCache.set(s,a),a}function GX(i){if(!O.highlightedZones.size||O.highlightedZones.has(i))return!1;for(let e of O.highlightedZones)if(Kpe(i,e))return!1;return!0}function Kpe(i,e){let t=new Set,n=O.zoneRecords.get(e)?.zone.parent;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=O.zoneRecords.get(n)?.zone.parent}return!1}function _A(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],d=0,A=[0];for(let S=e+n;S<t;S+=n){let T=i[S],R=i[S+1];d+=Math.sqrt((T-u)*(T-u)+(R-f)*(R-f)),A.push(d),u=T,f=R}let y=r*d,w=tj(A,y);w<0?(l=(y-A[-w-2])/(A[-w-1]-A[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:Lo(i[a+u],i[a+n+u],l);return s}function HE(i,e,t,n,r,s){if(t==e)return null;let o;if(r<i[e+n-1])return s?(o=i.slice(e,e+n),o[n-1]=r,o):null;if(i[t-1]<r)return s?(o=i.slice(t-n,t),o[n-1]=r,o):null;if(r==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){let d=a+l>>1;r<i[(d+1)*n-1]?l=d:a=d+1}let c=i[a*n-1];if(r==c)return i.slice((a-1)*n,(a-1)*n+n);let u=i[(a+1)*n-1],f=(r-c)/(u-c);o=[];for(let d=0;d<n-1;++d)o.push(Lo(i[(a-1)*n+d],i[a*n+d],f));return o.push(r),o}function qX(i,e,t,n,r,s,o){if(o)return HE(i,e,t[t.length-1],n,r,s);let a;if(r<i[n-1])return s?(a=i.slice(0,n),a[n-1]=r,a):null;if(i[i.length-1]<r)return s?(a=i.slice(i.length-n),a[n-1]=r,a):null;for(let l=0,c=t.length;l<c;++l){let u=t[l];if(e!=u){if(r<i[e+n-1])return null;if(r<=i[u-1])return HE(i,e,u,n,r,!1);e=u}}return null}function dv(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}var f5=class i extends Al{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Do(this.flatCoordinates,e),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Uy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return sE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,HE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return _A(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return dv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){let t=[];return t.length=pA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return oA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uA(this.flatCoordinates,0,e,this.stride),this.changed()}},d5=f5;var p5=class i extends Al{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let r=e,s=[],o=[];for(let l=0,c=r.length;l<c;++l){let u=r[l];Do(s,u.getFlatCoordinates()),o.push(s.length)}let a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(e){Do(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,qX(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Pp(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new d5(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o],c=new d5(e.slice(s,l),n);r.push(c),s=l}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,s=e.length;r<s;++r)n+=dv(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){let l=r[o],c=_A(t,n,l,s,.5);Do(e,c),n=l}return e}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=SE(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new i(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return aj(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Dy(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},HX=p5;function m5(){O.renderedShard=O.lens?.shard||0,O.sources.zones.clear(),O.sources.zoneTitles.clear(),O.zoneRecords.clear(),O.highlightedZones.clear(),O.focusedZoneID=null,O.zoneTitleCount=0,Op();for(let i of O.world.collections)if(i.kind!=="point")for(let e of i.features||[]){if(!By(e))continue;e.collectionId=i.id;let t=Wr(),n=[],r=!1;for(let l of e.geometry||[]){let c=e0e(l);c&&(r=!0,n.push(c),qT(t,c.getExtent()),O.sources.zones.addFeature(new Rp({geometry:c,zone:e,color:cv(e.id),child:e.parent!=null})))}if(!r)continue;let s=cv(e.id),o=e.center?pv(e.center.lat,e.center.lng):dl(t),a=Math.max(t[2]-t[0],t[3]-t[1]);O.sources.zoneTitles.addFeature(new Rp({geometry:new yu(o),zone:e,color:s,child:e.parent!=null,span:a,priority:(e.parent==null?2e6:1e6)+Math.round(a)})),O.zoneRecords.set(e.id,{zone:e,collection:i,extent:t.slice(),geometries:n,color:s})}A5(),g5(),Qpe()}function A5(){O.zoneTitleCount=O.sources.zoneTitles.getFeatures().filter(i=>Zf(i.get("zone"))!=="quiet").length}function g5(){if(O.sources.zoneScrim.clear(),!O.highlightedZones.size)return;let[i,e,t,n]=O.projection.getExtent(),r=[WX([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of O.highlightedZones)for(let o of O.zoneRecords.get(s)?.geometries||[]){if(o.getType()==="MultiLineString")continue;let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(WX(c.getCoordinates(),u>0))})}O.sources.zoneScrim.addFeature(new Rp({geometry:new Ah(r)}))}function WX(i,e){let t=0;for(let n=0,r=i.length-1;n<i.length;r=n++)t+=i[r][0]*i[n][1]-i[n][0]*i[r][1];return t<0===e?i:i.slice().reverse()}function Qpe(){for(let i of ge.legend.querySelectorAll(".feature-index")){let e=document.createDocumentFragment();for(let{zone:t,depth:n}of Jpe(wu(i.dataset.featureIndex))){let r=O.zoneRecords.get(t.id);if(!r)continue;let s=document.createElement("button");s.type="button",s.className="zone-index-item",s.dataset.zone=String(t.id),s.style.setProperty("--zone-color",r.color),s.style.setProperty("--zone-depth",String(n)),s.setAttribute("aria-pressed","false"),s.title=`${t.title}: click to jump; right-click to toggle highlight`;let o=document.createElement("span");o.className="zone-index-marker",o.setAttribute("aria-hidden","true");let a=document.createElement("span");a.textContent=t.title,s.append(o,a),e.append(s)}i.replaceChildren(e)}}function Jpe(i){let e=[...O.zoneRecords.values()].filter(a=>a.zone.collectionId===i).map(a=>a.zone),t=new Set(e.map(a=>a.id)),n=new Map;for(let a of e){let l=t.has(a.parent)?a.parent:null;n.has(l)||n.set(l,[]),n.get(l).push(a)}for(let a of n.values())a.sort((l,c)=>l.title.localeCompare(c.title,void 0,{numeric:!0,sensitivity:"base"}));let r=[],s=new Set,o=(a,l)=>{if(!s.has(a.id)){s.add(a.id),r.push({zone:a,depth:l});for(let c of n.get(a.id)||[])o(c,l+1)}};for(let a of n.get(null)||[])o(a,0);for(let a of e)o(a,0);return r}function Op(){let i=V1();O.layers.zoneScrim.setVisible(i),O.layers.zones.setVisible(i),O.layers.zoneTitles.setVisible(i),O.layers.zoneTitleDetail.setVisible(i);let e=!1;for(let t of[...O.highlightedZones]){let n=O.zoneRecords.get(t);(!n||Io(fu(n.zone)))&&(O.highlightedZones.delete(t),e=!0)}e&&(WE(),g5(),_5()),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()}function v5(i){let e=O.zoneRecords.get(i);e&&(O.focusedZoneID=i,_5(),wE(e.zone),O.engine.getView().fit(e.extent,{size:O.engine.getSize(),padding:[54,54,54,54],maxZoom:mh(O.lens),duration:220}),ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"))}function jX(i){let e=O.zoneRecords.get(i);e&&(O.highlightedZones.has(i)?O.highlightedZones.delete(i):(O.highlightedZones.add(i),O.hiddenCollections.delete(fu(e.zone))&&(dA(),ph()),Op()),O.hoveredPin=null,WE(),x5(),_5(),g5(),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed())}function _5(){for(let i of ge.legend.querySelectorAll(".feature-index"))i.classList.toggle("has-highlights",O.highlightedZones.size>0);for(let i of ge.legend.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=O.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",O.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function e0e(i){if(!i?.coordinates)return null;let e=([t,n])=>pv(n,t);return i.type==="Polygon"?new Ah(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new RE(i.coordinates.map(t=>t.map(n=>n.map(e)))):i.type==="MultiLineString"?new HX(i.coordinates.map(t=>t.map(e))):null}function pv(i,e){let t=t0e(),n=2**t.sourceZoom,r=(e+180)/360*n,s=i*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*n;return[(r-t.firstTile)*t.tileSize,-(o-t.firstTile)*t.tileSize]}function t0e(){let i=O.volume.tileGrid,e=O.world?.grid;return e?{...i,...e}:i}function XX(){O.sources.pins.clear(),O.sources.priority.clear(),O.features=[],O.featureByID.clear();for(let i of O.world.collections)if(i.kind==="point"){BX(i);for(let e of i.locations){let t={location:e,category:i,coordinate:pv(e.lat,e.lng),filteredHidden:!1,priority:r0e(i,e),feature:null};t.feature=new Rp({geometry:new yu(t.coordinate),pin:t,priority:t.priority}),O.features.push(t),O.featureByID.set(e.id,t),O.sources.pins.addFeature(t.feature)}}Nc()}function Nc(){for(let i of O.features){let e=Io(i.category.id),t=O.search&&!i.location.title.toLocaleLowerCase().includes(O.search);i.filteredHidden=!!(e||t)}WE(),x5(),O.selectedPin?.filteredHidden&&id(),nd(),document.dispatchEvent(new Event("atlas:filters"))}function WE(){if(!O.highlightedZones.size){for(let e of O.features)e.passesZoneFilters=!1;return}let i=cW([...O.highlightedZones].map(e=>O.zoneRecords.get(e)).filter(Boolean));for(let e of O.features)e.passesZoneFilters=uW(i,e.coordinate)}function x5(){O.eligibleLocations=O.features.filter(i=>!ld(i)).length,Fc(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.pinLabels.changed(),O.layers.priority.changed(),xA()}function Fc(){O.sources.priority.clear();for(let i of O.features){if(ld(i))continue;let e=!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search);(i===O.selectedPin||i===O.hoveredPin||e||Lp(i))&&O.sources.priority.addFeature(i.feature)}}function mv(i){O.hoveredPin!==i&&(O.hoveredPin=i,O.sources&&(Fc(),O.layers.pins.changed(),O.layers.priority.changed()))}function jE(i){O.labelsHeld!==i&&(O.labelsHeld=i,ge.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",O.layers.pinLabels.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),document.dispatchEvent(new Event("atlas:labels")))}function u5(i){return i===O.selectedPin||i===O.hoveredPin||Lp(i)||!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search)}function ld(i){return i.filteredHidden||n0e(i)||i0e(i)||!By(i.location)}function By(i){let e=O.lens?.shard;return!e||!i.shard||i.shard===e}function n0e(i){return!O.highlightedZones.size||i.passesZoneFilters||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function i0e(i){return!O.gridEnabled||!O.gridCell||Lp(i)||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function r0e(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Kj(e.id)%1e3}function h5(){return(O.engine?.getView().getZoom()||0)>=(O.lens?.maxZoom||0)-.05}function $X(i){let e=[],t=new Map,n=(s,o,a)=>{t.has(s)||(t.set(s,e.length),e.push({key:s,title:o,collections:[]})),e[t.get(s)].collections.push(a)},r=[];for(let s of i)s.kind!=="point"&&!s.group?r.push(s):n(`group-${s.group}`,s.group,s);return r.length&&e.unshift({key:"zones",title:"Zones",collections:r}),e}function YX(i){return i.kind||"point"}function ZX(i){return(i.features||i.locations||[]).length}function wu(i){return/^\d+$/.test(i)?Number(i):i}function KX(i){for(let e of O.world?.sections||[])for(let t of e.collections)if(t.id===i)return t;return null}function QX(){let i=document.createDocumentFragment();for(let e of O.world.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.collections.reduce((s,o)=>s+ZX(o),0);t.append(s0e(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.collections)if(r.append(o0e(s)),YX(s)!=="point"){let o=document.createElement("div");o.className="feature-index",o.dataset.featureIndex=String(s.id),r.append(o)}t.append(r),i.append(t)}ge.legend.replaceChildren(i),XE(),t$(),ph()}function s0e(i,e,t){let n=document.createElement("div");n.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=i;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=e;let a=document.createElement("span");a.className="layer-count",a.textContent=jl(t),r.append(s,o,a);let l=JX(`Show only ${e}`);l.dataset.onlySection=i;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.sectionToggle=i,u.setAttribute("aria-label",`Show ${e}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),n.append(r,l,c),n}function JX(i){let e=document.createElement("button");return e.type="button",e.className="only-button",e.dataset.label=i,e.setAttribute("aria-label",i),e.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="4.6"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2"/></svg>',e}function o0e(i){let e=YX(i),t=document.createElement("label");t.className="category-row";let n=document.createElement("input");n.type="checkbox",n.dataset.collection=String(i.id),n.checked=!O.hiddenCollections.has(i.id);let r;e!=="point"?(r=document.createElement("button"),r.type="button",r.className="collection-expand",r.dataset.expandCollection=String(i.id),r.setAttribute("aria-label",`Unfold the ${i.title} index`),r.innerHTML='<svg class="collection-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg>'+(e==="path"?'<svg class="collection-kind" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 12.5c3-6 8-2 11-9"/></svg>':'<svg class="collection-kind collection-kind-area" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 4.2 12.6 11.6H3.4z"/></svg>')):(r=document.createElement("span"),r.className="category-icon",uv(t,i),hv(r,i,bu(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=JX(`Show only ${i.title}`);o.dataset.onlyCollection=String(i.id);let a;e==="area"?(a=document.createElement("button"),a.type="button",a.className="label-toggle",a.dataset.labelToggle=String(i.id),a.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 3.5h9M8 3.5v9"/></svg>',y5(a,i)):e==="point"&&wD(i)==="text"?(a=document.createElement("button"),a.type="button",a.className="label-toggle",a.dataset.labelToggle=String(i.id),a.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8.6 2.5H2.5v6.1l5.4 5.4a1.2 1.2 0 0 0 1.7 0l4.4-4.4a1.2 1.2 0 0 0 0-1.7z"/><path d="M5.6 5.6h.01"/></svg>',y5(a,i)):(a=document.createElement("span"),a.className="label-toggle-spacer");let l=document.createElement("span");return l.className="category-count",l.textContent=jl(ZX(i)),t.append(n,r,s,a,o,l),t}function b5(i){if(O.collapsedSections.clear(),i)for(let e of ge.layers.querySelectorAll("[data-section]"))O.collapsedSections.add(e.dataset.section);XE()}function XE(){for(let i of ge.layers.querySelectorAll("[data-section]")){let e=O.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Wl()}function e$(i){O.expandedCollections.has(i)?O.expandedCollections.delete(i):O.expandedCollections.add(i),t$()}function t$(){for(let i of ge.legend.querySelectorAll("[data-expand-collection]")){let e=O.expandedCollections.has(wu(i.dataset.expandCollection));i.setAttribute("aria-expanded",String(e)),i.closest(".category-row").classList.toggle("is-expanded",e)}for(let i of ge.legend.querySelectorAll(".feature-index"))i.hidden=!O.expandedCollections.has(wu(i.dataset.featureIndex));Wl()}function n$(i){let e=KX(i);if(!e)return;let t=Zf(null,e)==="always"?"quiet":"always";t===bD(e)?O.labelOverrides.delete(e.id):O.labelOverrides.set(e.id,t),a0e(),e.kind==="point"?O.layers.pinLabels.changed():(A5(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()),Wl()}function y5(i,e){let t=Zf(null,e)==="always",n=`${t?"Hide":"Display"} ${e.title} labels`;i.dataset.label=n,i.setAttribute("aria-label",n),i.title=n,i.setAttribute("aria-pressed",String(t))}function a0e(){for(let i of ge.legend.querySelectorAll("[data-label-toggle]")){let e=KX(wu(i.dataset.labelToggle));e&&y5(i,e)}}function e2(i){if(O.hiddenCollections.clear(),!i)for(let e of O.world.sections)for(let t of e.collections)O.hiddenCollections.add(t.id);dA(),Op(),Nc(),nd(),ph()}function dA(){for(let i of document.querySelectorAll("[data-collection]"))i.checked=!O.hiddenCollections.has(wu(i.dataset.collection))}function i$(i){let e=O.world.sections.find(n=>n.key===i);if(!e)return;let t=e.collections.some(n=>!O.hiddenCollections.has(n.id));for(let n of e.collections)t?O.hiddenCollections.add(n.id):O.hiddenCollections.delete(n.id);dA(),Op(),Nc(),ph()}function r$(i){if(O.world){if(l0e(i)){e2(!0);return}O.hiddenCollections.clear();for(let e of O.world.sections){let t=i.section===e.key;for(let n of e.collections)!t&&i.collection!==n.id&&O.hiddenCollections.add(n.id)}dA(),Op(),Nc(),nd(),ph()}}function l0e(i){for(let e of O.world.sections)for(let t of e.collections)if((i.section===e.key||i.collection===t.id)===O.hiddenCollections.has(t.id))return!1;return!0}function c0e(){let i=ge.soloChip;if(!O.world){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of O.world.sections){let a=0;for(let l of o.collections)O.hiddenCollections.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.collections.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function ph(){if(O.world){for(let i of O.world.sections){let e=ge.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.collections.some(t=>!O.hiddenCollections.has(t.id)))}c0e(),Wl()}}async function s$(i){let[e,t]=await Promise.all([fetch(`${O.volume.base}/worlds/${i.slug}.json`),fetch(`${O.volume.base}/worlds/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`world ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.collections||[];u0e(r,s);let o=$X(s);return{...i,grid:n.grid,lenses:n.lenses,collections:s,collectionsById:new Map(s.map(a=>[a.id,a])),attrs:n.attrs||{},merged:n.merged||[],sections:o}}function u0e(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==3)throw new Error(`location payload is version ${r}, and this reads 3`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),d=new Uint32Array(i,o+=s*4,s+1),A=new Uint16Array(i,o+=(s+1)*4,s),y=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.kind==="point"&&(S.locations=[]);for(let S=0;S<s;S++){let T=e[A[S]];if(!T||T.kind!=="point")throw new Error(`location ${a[S]} names collection ${A[S]}, which is no point collection`);T.locations.push({id:a[S],title:w.decode(y.subarray(d[S],d[S+1])),lat:l[S],lng:c[S],memberId:u[S]||void 0,shard:f[S]||void 0})}}async function TN(){let i=`${O.volume.base}/${O.world.slug}`;return O.textByWorld.has(i)||O.textByWorld.set(i,fetch(`${O.volume.base}/worlds/${O.world.slug}.text`).then(e=>e.json()).catch(()=>({}))),O.textByWorld.get(i)}var $E=null;function yA(){return $E||($E=h0e().finally(()=>{$E=null})),$E}async function h0e(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=O.volume;if(O.catalog=await i.json(),qm(ge.volume,O.catalog.volumes,"title"),w5(),!O.catalog.volumes.length)return;let t=e&&O.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=lv();await cd(n.volume||av()?.volume||O.catalog.volumes[0].slug,n.volume?n.world:void 0);return}if(t.stamp!==e.stamp){for(let r of O.textByWorld.keys())r.startsWith(e.base+"/")&&O.textByWorld.delete(r);let n=O.engine?.getView();O.restore={volume:t.slug,world:O.world?.slug,lens:O.world?O.world.lenses.indexOf(O.lens):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},await cd(t.slug,O.world?.slug);return}O.volume=t,ge.volume.value=t.slug}function w5(){let i=!O.catalog?.volumes?.length;ge.emptyState.hidden=!i,O.catalog?.bundlesDir&&(ge.emptyPath.textContent=O.catalog.bundlesDir)}async function S5(){for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await yA();let t=e.imported?.[0];t&&O.catalog.volumes.some(n=>n.slug===t)&&await cd(t)}finally{for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!1}}var vo={ADD:"add",REMOVE:"remove"};var o$={LENGTH:"length"},Av=class extends Ao{constructor(e,t,n){super(e),this.element=t,this.index=n}},T5=class extends Us{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(o$.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Av(vo.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Av(vo.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Av(vo.REMOVE,r,e)),this.dispatchEvent(new Av(vo.ADD,t,e))}updateLength_(){this.set(o$.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}},Fo=T5;var E5=class extends Ao{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Up=E5;var M5=class extends Up{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},_h=M5;var gr={SINGLECLICK:"singleclick",CLICK:nn.CLICK,DBLCLICK:nn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var t2={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var C5=class extends Cp{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=qn(n,t2.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qn(n,t2.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_,cE?{passive:!1}:!1)}emulateClick_(e){let t=new _h(gr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new _h(gr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new _h(gr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==gr.POINTERUP||t.type==gr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==gr.POINTERDOWN||t.type==gr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new _h(gr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new _h(gr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(qn(n,gr.POINTERMOVE,this.handlePointerMove_,this),qn(n,gr.POINTERUP,this.handlePointerUp_,this),qn(this.element_,gr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(qn(this.element_.getRootNode(),gr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new _h(gr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new _h(gr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(li(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},a$=C5;var xh={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Bo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var n2=1/0,R5=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,dh(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){jn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=n2?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){let l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),u=c<r&&n[c]<n[l]?c:l;t[e]=t[u],n[e]=n[u],e=u}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){let a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,s=t.length,o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==n2?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},l$=R5;var P5=class extends l${constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(nn.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===an.LOADED||n===an.ERROR||n===an.EMPTY){n!==an.ERROR&&t.removeEventListener(nn.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===an.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},c$=P5;function u$(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return n2;if(!i.wantedTiles[t][e.getKey()])return n2;let s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var so={ANIMATING:0,INTERACTING:1};var Uc={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function I5(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,d=i[0]+l/2+u,A=i[2]-l/2+u,y=i[1]+c/2+f,w=i[3]-c/2+f;d>A&&(d=(A+d)/2,A=d),y>w&&(y=(w+y)/2,w=y);let S=Si(n[0],d,A),T=Si(n[1],y,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,d-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-A)/R),T+=-R*Math.log(1+Math.max(0,y-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function h$(i){return i}function L5(i,e,t,n){let r=Kn(e)/t[0],s=Nr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function D5(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),Si(n,t/2,e*2)}function f$(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){let l=i[0],c=i[i.length-1],u=t?L5(l,t,o,n):l;if(a)return e?D5(r,u,c):Si(r,c,u);let f=Math.min(u,r),d=Math.floor(ev(i,f,s));return i[d]>u&&d<i.length-1?i[d+1]:i[d]}})}function d$(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,c){if(o!==void 0){let u=r?L5(e,r,l,s):e;if(c)return n?D5(o,u,t):Si(o,t,u);let f=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(i)-f),A=-a*(.5-f)+.5,y=Math.min(u,o),w=Math.floor(Math.log(e/y)/Math.log(i)+A),S=Math.max(d,w),T=e/Math.pow(i,S);return Si(T,t,u)}})}function N5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?L5(i,n,a,r):i;return!t||!l?Si(s,e,c):D5(s,c,e)}})}function gv(i){if(i!==void 0)return 0}function F5(i){if(i!==void 0)return i}function p$(i){let e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function m$(i){let e=i===void 0?mu(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var B5=0,U5=class extends Us{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=nE(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&ZW(),e.center&&(e.center=vu(e.center,this.projection_)),e.extent&&(e.extent=_u(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Uc)delete t[a];this.setProperties(t,!0);let n=d0e(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=f0e(e),s=n.constraint,o=p0e(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t=t||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=vu(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=vu(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let u=arguments[r];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(r===t){n&&YE(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,c=[];for(;r<t;++r){let u=arguments[r],f={start:s,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||xj,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let d=fh(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+d,l=f.targetRotation}m0e(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(so.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[so.ANIMATING]>0}getInteracting(){return this.hints_[so.INTERACTING]>0}cancelAnimations(){this.setHint(so.ANIMATING,-this.hints_[so.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&YE(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,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;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let d=l.sourceCenter[0],A=l.sourceCenter[1],y=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=d+f*(y-d),T=A+f*(w-A);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let d=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let A=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(d,0,A,!0);this.targetCenter_=this.calculateCenterZoom(y,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let d=f===1?fh(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let A=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(A,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(so.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&YE(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],X1(n,e-this.getRotation()),RW(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Ry(e,this.getProjection())}getCenterInternal(){return this.get(Uc.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return Sp(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();jn(t,"The view center is not defined");let n=this.getResolution();jn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return jn(r!==void 0,"The view rotation is not defined"),Ty(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Uc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(_u(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Kn(e)/t[0],r=Nr(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get(Uc.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=O5(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let s=ev(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=Si(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,Si(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(jn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){jn(!hh(e),"Cannot fit empty extent provided as `geometry`");let r=_u(e,this.getProjection());n=NN(r)}else if(e.getType()==="Circle"){let r=_u(e.getExtent(),this.getProjection());n=NN(r),n.rotate(this.getRotation(),dl(r))}else{let r=rA();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,d=s.length;f<d;f+=o){let A=s[f]*n-s[f+1]*r,y=s[f]*r+s[f+1]*n;a=Math.min(a,A),l=Math.min(l,y),c=Math.max(c,A),u=Math.max(u,y)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),d=dl(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;let A=d[0]*f-d[1]*u,y=d[1]*f+d[0]*u,w=this.getConstrainedCenter([A,y],l),S=t.callback?t.callback:td;t.duration!==void 0?this.animateInternal({resolution:l,center:w,duration:t.duration,easing:t.easing},S):(this.targetResolution_=l,this.targetCenter_=w,this.applyTargetState_(!1,!0),YE(S,!0))}centerOn(e,t,n){this.centerOnInternal(vu(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(O5(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s,o=this.padding_;if(o&&e){let a=this.getViewportSizeMinusPadding_(-n),l=O5(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Ry(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&vu(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=vu(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&vu(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(Uc.ROTATION)!==r&&this.set(Uc.ROTATION,r),this.get(Uc.RESOLUTION)!==o&&(this.set(Uc.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Uc.CENTER)||!eA(this.get(Uc.CENTER),a))&&this.set(Uc.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!eA(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Lc,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(so.INTERACTING,1)}endInteraction(e,t,n){n=n&&vu(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(so.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function YE(i,e){setTimeout(function(){i(e)},0)}function f0e(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return I5(i.extent,i.constrainOnlyCenter,t)}let e=nE(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,I5(t,!1,!1)}return h$}function d0e(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:B5,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,d=nE(i.projection,"EPSG:3857"),A=d.getExtent(),y=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&d.isGlobal()&&(y=!1,w=A),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=f$(S,u,!y&&w,f):e=N5(t,n,u,!y&&w,f)}else{let T=(A?Math.max(Kn(A),Nr(A)):360*Kf.degrees/d.getMetersPerUnit())/256/Math.pow(2,B5),R=T/Math.pow(2,28-B5);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=R),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=d$(l,t,n,u,!y&&w,f):e=N5(t,n,u,!y&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function p0e(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?m$():t===!1?F5:typeof t=="number"?p$(t):F5}return gv}function m0e(i){return!(i.sourceCenter&&i.targetCenter&&!eA(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function O5(i,e,t,n,r){let s=Math.cos(-r),o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;let c=a*s-l*o,u=l*s+a*o;return[c,u]}var Xl=U5;var k5=class extends Us{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)li(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==td&&this.listenerKeys.push(qn(e,xh.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},vv=k5;var z5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Np+" "+fv+(this.collapsed_&&this.collapsible_?" "+$N:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){let r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(r=>mj(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!ta(t,this.renderedAttributions_)){bj(this.ulElement_);for(let r=0,s=t.length;r<s;++r){let o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle($N),this.collapsed_?nN(this.collapseLabel_,this.label_):nN(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},A$=z5;var V5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Np+" "+fv,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Ky)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Lc}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains(Ky);!s&&n===0?this.element.classList.add(Ky):s&&n!==0&&this.element.classList.remove(Ky)}this.label_.style.transform=r}this.rotation_=n}},g$=V5;var G5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(nn.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(nn.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+" "+Np+" "+fv,A=this.element;A.className=d,A.appendChild(u),A.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:Lc})):n.setZoom(s)}}},v$=G5;function ZE(i){i=i||{};let e=new Fo;return(i.zoom===void 0||i.zoom)&&e.push(new v$(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new g$(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new A$(i.attributionOptions)),e}var q5=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},_$=q5;var H5={ACTIVE:"active"};var W5=class extends Us{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(H5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(H5.ACTIVE,e)}setMap(e){this.map_=e}};function x$(i,e,t){let n=i.getCenterInternal();if(n){let r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:yj,center:i.getConstrainedCenter(r)})}}function _v(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:Lc})}var yh=W5;var j5=class extends yh{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==gr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();_v(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},y$=j5;function i2(i){let e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}var b$=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},A0e=function(i){let e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},KE=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?A0e(i):!0},w$=Jf;var QE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(Aj&&KD&&e.ctrlKey)};var JE=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var S$=function(i){let e=i.originalEvent;return KD?e.metaKey:e.ctrlKey},T$=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},e3=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},t3=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var E$=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var X5=class extends yh{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==gr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==gr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==gr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==gr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function xv(i){let e=i.length,t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}var bh=X5;var $5=class extends bh{constructor(e){super({stopDown:ed}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:i2(JE,E$);this.condition_=e.onFocusOnly?i2(KE,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(xv(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=e.map.getView();PW(s,a.getResolution()),X1(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Lc})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},M$=$5;var Y5=class extends bh{constructor(e){e=e||{},super({stopDown:ed}),this.condition_=e.condition?e.condition:b$,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!t3(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===gv)return;let r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return t3(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return t3(e)&&QE(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},C$=Y5;var Z5=class extends Mp{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new Ah([r])}getGeometry(){return this.geometry_}},R$=Z5;var yv={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},bA=class extends Ao{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},K5=class extends bh{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new R$(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??QE,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new bA(yv.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new bA(t?yv.BOXEND:yv.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new bA(yv.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new bA(yv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new bA(yv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},P$=K5;var Q5=class extends P${constructor(e){e=e||{};let t=e.condition?e.condition:T$;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Lc})}},I$=Q5;var kp={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var J5=class extends yh{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return JE(t)&&e3(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==kp.DOWN||r==kp.LEFT||r==kp.RIGHT||r==kp.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==kp.DOWN?c=-a:r==kp.LEFT?l=-a:r==kp.RIGHT?l=a:c=a;let u=[l,c];X1(u,o.getRotation()),x$(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},L$=J5;var e6=class extends yh{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!S$(t)&&e3(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN||e.type==nn.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();_v(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},D$=e6;var g0e=40,v0e=300,_0e=3,t6=class extends yh{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;let t=e.condition?e.condition:w$;this.condition_=e.onFocusOnly?i2(KE,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(li),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(qn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),qn(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==nn.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=g0e;break;case WheelEvent.DOM_DELTA_PAGE:o*=v0e;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=n.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*_0e),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-Si(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),_v(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},N$=t6;var n6=class extends bh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=ed),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=s;let o=e.map,a=o.getView();a.getConstraints().rotation!==gv&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(xv(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},F$=n6;var i6=class extends bh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=ed),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;let l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(xv(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},B$=i6;function n3(i){i=i||{};let e=new Fo,t=new _$(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new C$),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new y$({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new M$({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new F$),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new B$({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new L$),e.push(new D$({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new N$({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new I$({duration:i.zoomDuration})),e}var Ni={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var r6=class extends Us{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ni.OPACITY]=e.opacity!==void 0?e.opacity:1,jn(typeof t[Ni.OPACITY]=="number","Layer opacity must be a number"),t[Ni.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ni.Z_INDEX]=e.zIndex,t[Ni.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ni.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ni.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ni.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=Si(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return ei()}getLayerStatesArray(e){return ei()}getExtent(){return this.get(Ni.EXTENT)}getMaxResolution(){return this.get(Ni.MAX_RESOLUTION)}getMinResolution(){return this.get(Ni.MIN_RESOLUTION)}getMinZoom(){return this.get(Ni.MIN_ZOOM)}getMaxZoom(){return this.get(Ni.MAX_ZOOM)}getOpacity(){return this.get(Ni.OPACITY)}getSourceState(){return ei()}getVisible(){return this.get(Ni.VISIBLE)}getZIndex(){return this.get(Ni.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ni.EXTENT,e)}setMaxResolution(e){this.set(Ni.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ni.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ni.MAX_ZOOM,e)}setMinZoom(e){this.set(Ni.MIN_ZOOM,e)}setOpacity(e){jn(typeof e=="number","Layer opacity must be a number"),this.set(Ni.OPACITY,e)}setVisible(e){this.set(Ni.VISIBLE,e)}setZIndex(e){this.set(Ni.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},i3=r6;var zp={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Su=class extends Ao{constructor(e,t){super(e),this.layer=t}},s6={LAYERS:"layers"},o6=class i extends i3{constructor(e){e=e||{};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(s6.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Fo(n.slice(),{unique:!0}):jn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new Fo(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(li),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(qn(e,vo.ADD,this.handleLayersAdd_,this),qn(e,vo.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(li);dh(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Su(zp.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[qn(e,xu.PROPERTYCHANGE,this.handleLayerChange_,this),qn(e,nn.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(qn(e,zp.ADDLAYER,this.handleLayerGroupAdd_,this),qn(e,zp.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Bn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Su(zp.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Su(zp.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Su(zp.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Bn(t);this.listenerKeys_[n].forEach(li),delete this.listenerKeys_[n],this.dispatchEvent(new Su(zp.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(s6.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Su(zp.REMOVELAYER,n[r]))}this.set(s6.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});let r=this.getLayerState(),s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){let l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=uh(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},r2=o6;var Oo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var a6=class extends i3{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ni.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ni.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(li(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=qn(e,nn.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof Xl?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return s2(r,t.viewState)&&(!s||Ar(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Xl?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ni.MAP,e)}getMapInternal(){return this.get(Ni.MAP)}setMap(e){this.mapPrecomposeKey_&&(li(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(li(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=qn(e,Oo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qn(this,nn.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);jn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ni.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function s2(i,e){if(!i.visible)return!1;let t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;let n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}var wA=a6;function r3(i,e,t=0,n=i.length-1,r=x0e){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),A=Math.max(t,Math.floor(e-c*f/l+d)),y=Math.min(n,Math.floor(e+(l-c)*f/l+d));r3(i,e,A,y,r)}let s=i[e],o=t,a=n;for(o2(i,t,e),r(i[n],s)>0&&o2(i,t,n);o<a;){for(o2(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?o2(i,t,a):(a++,o2(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function o2(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function x0e(i,e){return i<e?-1:i>e?1:0}var SA=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!o3(e,t))return n;let r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){let a=t.children[o],l=t.leaf?r(a):a;o3(e,l)&&(t.leaf?n.push(a):c6(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!o3(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let s=t.children[r],o=t.leaf?this.toBBox(s):s;if(o3(e,o)){if(t.leaf||c6(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=wv([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],o=[],a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){let u=y0e(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&c6(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let s=n-t+1,o=this._maxEntries,a;if(s<=o)return a=wv(e.slice(t,n+1)),bv(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=wv([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));O$(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);O$(e,u,f,l,this.compareMinY);for(let d=u;d<=f;d+=l){let A=Math.min(d+l-1,f);a.children.push(this._build(e,d,A,r-1))}}return bv(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){let c=t.children[l],u=l6(c),f=S0e(e,c)-u;f<o?(o=f,s=u<s?u:s,a=c):f===o&&u<s&&(s=u,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),l2(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){let n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);let o=this._chooseSplitIndex(n,s,r),a=wv(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,bv(n,this.toBBox),bv(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=wv([e,t]),this.data.height=e.height+1,this.data.leaf=!1,bv(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){let l=a2(e,0,a,this.toBBox),c=a2(e,a,n,this.toBBox),u=T0e(l,c),f=l6(l)+l6(c);u<s?(s=u,r=a,o=f<o?f:o):u===s&&f<o&&(o=f,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:b0e,s=e.leaf?this.compareMinY:w0e,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let s=this.toBBox,o=a2(e,0,t,s),a=a2(e,n-t,n,s),l=s3(o)+s3(a);for(let c=t;c<n-t;c++){let u=e.children[c];l2(o,e.leaf?s(u):u),l+=s3(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];l2(a,e.leaf?s(u):u),l+=s3(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)l2(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():bv(e[t],this.toBBox)}};function y0e(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function bv(i,e){a2(i,0,i.children.length,e,i)}function a2(i,e,t,n,r){r||(r=wv(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){let o=i.children[s];l2(r,i.leaf?n(o):o)}return r}function l2(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function b0e(i,e){return i.minX-e.minX}function w0e(i,e){return i.minY-e.minY}function l6(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function s3(i){return i.maxX-i.minX+(i.maxY-i.minY)}function S0e(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function T0e(i,e){let t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function c6(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function o3(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function wv(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function O$(i,e,t,n,r){let s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;let o=e+Math.ceil((t-e)/n/2)*n;r3(i,o,e,t,r),s.push(e,o,o,t)}}var EA=0,l3=0,ra=1<<EA++,ci=1<<EA++,sa=1<<EA++,La=1<<EA++,hd=1<<EA++,TA=1<<EA++,c3=Math.pow(2,EA)-1,h6={[ra]:"boolean",[ci]:"number",[sa]:"string",[La]:"color",[hd]:"number[]",[TA]:"size"},E0e=Object.keys(h6).map(Number).sort(pl);function M0e(i){return i in h6}function ud(i){let e=[];for(let t of E0e)c2(i,t)&&e.push(h6[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function c2(i,e){return(i&e)===e}function a3(i,e){return!!(i&e)}function Vp(i,e){return i===e}var $r=class{constructor(e,t){if(!M0e(e))throw new Error(`literal expressions must have a specific type, got ${ud(e)}`);this.type=e,this.value=t}},u3=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function h3(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function hs(i,e,t){switch(typeof i){case"boolean":{if(Vp(e,sa))return new $r(sa,i?"true":"false");if(!c2(e,ra))throw new Error(`got a boolean, but expected ${ud(e)}`);return new $r(ra,i)}case"number":{if(Vp(e,TA))return new $r(TA,cs(i));if(Vp(e,ra))return new $r(ra,!!i);if(Vp(e,sa))return new $r(sa,i.toString());if(!c2(e,ci))throw new Error(`got a number, but expected ${ud(e)}`);return new $r(ci,i)}case"string":{if(Vp(e,La))return new $r(La,$y(i));if(Vp(e,ra))return new $r(ra,!!i);if(!c2(e,sa))throw new Error(`got a string, but expected ${ud(e)}`);return new $r(sa,i)}default:}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return k0e(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Vp(e,TA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new $r(TA,i)}if(Vp(e,La)){if(i.length===3)return new $r(La,[...i,1]);if(i.length===4)return new $r(La,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!c2(e,hd))throw new Error(`got an array of numbers, but expected ${ud(e)}`);return new $r(hd,i)}var et={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},C0e={[et.Get]:Un(ti(1,1/0),U$),[et.Var]:R0e(),[et.Has]:Un(ti(1,1/0),U$),[et.Id]:Un(P0e,Sv),[et.Concat]:Un(ti(2,1/0),Qi(sa)),[et.GeometryType]:Un(I0e,Sv),[et.LineMetric]:Un(L0e,Sv),[et.Resolution]:Un(u6,Sv),[et.Zoom]:Un(u6,Sv),[et.Time]:Un(u6,Sv),[et.Any]:Un(ti(2,1/0),Qi(ra)),[et.All]:Un(ti(2,1/0),Qi(ra)),[et.Not]:Un(ti(1,1),Qi(ra)),[et.Equal]:Un(ti(2,2),z$()),[et.NotEqual]:Un(ti(2,2),z$()),[et.GreaterThan]:Un(ti(2,2),Qi(ci)),[et.GreaterThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.LessThan]:Un(ti(2,2),Qi(ci)),[et.LessThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.Multiply]:Un(ti(2,1/0),k$),[et.Coalesce]:Un(ti(2,1/0),k$),[et.Divide]:Un(ti(2,2),Qi(ci)),[et.Add]:Un(ti(2,1/0),Qi(ci)),[et.Subtract]:Un(ti(2,2),Qi(ci)),[et.Clamp]:Un(ti(3,3),Qi(ci)),[et.Mod]:Un(ti(2,2),Qi(ci)),[et.Pow]:Un(ti(2,2),Qi(ci)),[et.Abs]:Un(ti(1,1),Qi(ci)),[et.Floor]:Un(ti(1,1),Qi(ci)),[et.Ceil]:Un(ti(1,1),Qi(ci)),[et.Round]:Un(ti(1,1),Qi(ci)),[et.Sin]:Un(ti(1,1),Qi(ci)),[et.Cos]:Un(ti(1,1),Qi(ci)),[et.Atan]:Un(ti(1,2),Qi(ci)),[et.Sqrt]:Un(ti(1,1),Qi(ci)),[et.Match]:Un(ti(4,1/0),V$,N0e),[et.Between]:Un(ti(3,3),Qi(ci)),[et.Interpolate]:Un(ti(6,1/0),V$,F0e),[et.Case]:Un(ti(3,1/0),D0e,B0e),[et.In]:Un(ti(2,2),O0e),[et.Number]:Un(ti(1,1/0),Qi(c3)),[et.String]:Un(ti(1,1/0),Qi(c3)),[et.Array]:Un(ti(1,1/0),Qi(ci)),[et.Color]:Un(ti(1,4),Qi(ci)),[et.Band]:Un(ti(1,3),Qi(ci)),[et.Palette]:Un(ti(2,2),U0e),[et.ToString]:Un(ti(1,1),Qi(ra|ci|sa|La))};function U$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=i[s+1];switch(typeof o){case"number":{r[s]=new $r(ci,o);break}case"string":{r[s]=new $r(sa,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.set(String(o),e)}return r}function R0e(){return function(i,e,t){let n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");let r=e,s=t.inputVariables?.[n];if(s!==void 0){let o=hs(s,c3,t);if(!(o instanceof $r))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&a3(r,La)&&!a3(r,sa)?a=La:Array.isArray(s)&&s.length===2&&a3(r,TA)&&!a3(r,hd)&&(a=TA),r&=a,r===l3)throw new Error(`the type expected from the var operator (${ud(e)}) did not have any overlap with the type of the corresponding style variables (${ud(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===l3)throw new Error(`a new type expected from the var operator (${ud(e)}) did not have any overlap with the previous type expected for it (${ud(o)}), variable name: ${n}`)}return t.variables.set(n,r),new u3(r,"var",new $r(sa,n))}}function P0e(i,e,t){t.featureId=!0}function I0e(i,e,t){t.geometryType=!0}function L0e(i,e,t){t.mCoordinate=!0}function u6(i,e,t){t.mapState=!0}function Sv(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function ti(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function k$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=hs(i[s+1],e,t);r[s]=o}return r}function Qi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=hs(e[o+1],i,n);s[o]=a}return s}}function z$(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=c3;for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);o&=l.type}if(o===l3)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);s[a]=l}return s}}function D0e(i,e,t){let n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function V$(i,e,t){let n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function N0e(i,e,t){let n=i.length-1,r=hs(i[i.length-1],e,t),s=sa|ci|ra,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=hs(i[l+2],s,t);s&=c.type}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}if(s===l3)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<n-2;l+=2){try{let c=hs(i[l+2],s,t);o[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{let c=hs(i[l+3],r.type,t);o[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[hs(i[1],s,t),...o,r]}function F0e(i,e,t){let n=i[1],r;switch(n[0]){case"linear":r=1;break;case"exponential":let l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}let s=new $r(ci,r),o;try{o=hs(i[2],ci,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=hs(i[l+3],ci,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=hs(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function B0e(i,e,t){let n=hs(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=hs(i[s+1],ra,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=hs(i[s+2],n.type,t);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=n,r}function O0e(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(n[0]==="literal"){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof n[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof n[0]=="string"?r=sa:r=ci;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=hs(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[hs(i[1],r,t),...s]}function U0e(i,e,t){let n;try{n=hs(i[1],ci,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=hs(r[o],La,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof $r))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Un(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new u3(t,r,...s)}}function k0e(i,e,t){let n=i[0],r=C0e[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function f3(i){if(!i)return"";let e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return f3(i.getGeometries()[0]);default:return""}}function f6(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Eu(i,e,t){let n=hs(i,e,t);return Tu(n,t)}function Tu(i,e){if(i instanceof $r){if(i.type===La&&typeof i.value=="string"){let n=$y(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case et.Number:case et.String:case et.Coalesce:return z0e(i,e);case et.Get:case et.Var:case et.Has:return V0e(i,e);case et.Id:return n=>n.featureId;case et.GeometryType:return n=>n.geometryType;case et.Concat:{let n=i.args.map(r=>Tu(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case et.Resolution:return n=>n.resolution;case et.Any:case et.All:case et.Between:case et.In:case et.Not:return q0e(i,e);case et.Equal:case et.NotEqual:case et.LessThan:case et.LessThanOrEqualTo:case et.GreaterThan:case et.GreaterThanOrEqualTo:return G0e(i,e);case et.Multiply:case et.Divide:case et.Add:case et.Subtract:case et.Clamp:case et.Mod:case et.Pow:case et.Abs:case et.Floor:case et.Ceil:case et.Round:case et.Sin:case et.Cos:case et.Atan:case et.Sqrt:return H0e(i,e);case et.Case:return W0e(i,e);case et.Match:return j0e(i,e);case et.Interpolate:return X0e(i,e);case et.ToString:return $0e(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function z0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case et.Number:case et.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function V0e(i,e){let n=i.args[0].value;switch(i.operator){case et.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case et.Var:return r=>r.variables[n];case et.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function G0e(i,e){let t=i.operator,n=Tu(i.args[0],e),r=Tu(i.args[1],e);switch(t){case et.Equal:return s=>n(s)===r(s);case et.NotEqual:return s=>n(s)!==r(s);case et.LessThan:return s=>n(s)<r(s);case et.LessThanOrEqualTo:return s=>n(s)<=r(s);case et.GreaterThan:return s=>n(s)>r(s);case et.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function q0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case et.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case et.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case et.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case et.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function H0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case et.Divide:return s=>r[0](s)/r[1](s);case et.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case et.Subtract:return s=>r[0](s)-r[1](s);case et.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case et.Mod:return s=>r[0](s)%r[1](s);case et.Pow:return s=>Math.pow(r[0](s),r[1](s));case et.Abs:return s=>Math.abs(r[0](s));case et.Floor:return s=>Math.floor(r[0](s));case et.Ceil:return s=>Math.ceil(r[0](s));case et.Round:return s=>Math.round(r[0](s));case et.Sin:return s=>Math.sin(r[0](s));case et.Cos:return s=>Math.cos(r[0](s));case et.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case et.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function W0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function j0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function X0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),d=Array.isArray(f);if(d&&(f=mX(f)),u>=o)return c===2?f:d?Y0e(s,o,a,l,u,f):u2(s,o,a,l,u,f);a=u,l=f}return l}}function $0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);if(t===et.ToString)return s=>{let o=r[0](s);return i.args[0].type===La?Yy(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function u2(i,e,t,n,r,s){let o=r-t;if(o===0)return n;let a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function Y0e(i,e,t,n,r,s){if(r-t===0)return n;let a=WN(n),l=WN(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[u2(i,e,t,a[0],r,l[0]),u2(i,e,t,a[1],r,l[1]),a[2]+u2(i,e,t,0,r,c),u2(i,e,t,n[3],r,s[3])];return AX(u)}function Z0e(i){return!0}function K0e(i,e){e=e??h3();let t=Q0e(i,e),n=f6();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){let o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=f3(r.getGeometry())),t(n)}}function G$(i,e){e=e??h3();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=d6(i[o],e);let r=f6(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){let c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}e.geometryType&&(r.geometryType=f3(o.getGeometry()));let l=0;for(let c=0;c<t;++c){let u=n[c](r);u&&(s[l]=u,l+=1)}return s.length=l,s}}function j$(i,e){if(e=e??h3(),!Array.isArray(i))return G$([i],e);let t=i.length;if("style"in i[0]){let s=new Array(t);for(let o=0;o<t;++o){let a=i[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return K0e(s,e)}return G$(i,e)}function Q0e(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?Eu(s.filter,ra,e):Z0e,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=d6(s.style[c],e)}else a=[d6(s.style,e)];n[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<t;++a){let l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(let c of n[a].styles){let u=c(r);u&&s.push(u)}}}return s}}function d6(i,e){let t=h2(i,"",e),n=f2(i,"",e),r=J0e(i,e),s=eme(i,e),o=Uo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Au(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Xr;return function(l){let c=!0;if(t){let u=t(l);u&&(c=!1),a.setFill(u)}if(n){let u=n(l);u&&(c=!1),a.setStroke(u)}if(r){let u=r(l);u&&(c=!1),a.setText(u)}if(s){let u=s(l);u&&(c=!1),a.setImage(u)}return o&&a.setZIndex(o(l)),c?null:a}}function h2(i,e,t){let n;if(e+"fill-pattern-src"in i)n=rme(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=p3(i,e+"fill-color",t)}if(!n)return null;let r=new ks;return function(s){let o=n(s);return o===NE?null:(r.setColor(o),r)}}function f2(i,e,t){let n=Uo(i,e+"stroke-width",t),r=p3(i,e+"stroke-color",t);if(!n&&!r)return null;let s=fd(i,e+"stroke-line-cap",t),o=fd(i,e+"stroke-line-join",t),a=X$(i,e+"stroke-line-dash",t),l=Uo(i,e+"stroke-line-dash-offset",t),c=Uo(i,e+"stroke-miter-limit",t),u=Uo(i,e+"stroke-offset",t),f=new ro;return function(d){if(r){let A=r(d);if(A===NE)return null;f.setColor(A)}if(n&&f.setWidth(n(d)),s){let A=s(d);if(A!=="butt"&&A!=="round"&&A!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(A)}if(o){let A=o(d);if(A!=="bevel"&&A!=="round"&&A!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(A)}return a&&f.setLineDash(a(d)),l&&f.setLineDashOffset(l(d)),c&&f.setMiterLimit(c(d)),u&&f.setOffset(u(d)),f}}function J0e(i,e){let t="text-",n=fd(i,t+"value",e);if(!n)return null;let r=h2(i,t,e),s=h2(i,t+"background-",e),o=f2(i,t,e),a=f2(i,t+"background-",e),l=fd(i,t+"font",e),c=Uo(i,t+"max-angle",e),u=Uo(i,t+"offset-x",e),f=Uo(i,t+"offset-y",e),d=Tv(i,t+"overflow",e),A=fd(i,t+"placement",e),y=Uo(i,t+"repeat",e),w=m3(i,t+"scale",e),S=Tv(i,t+"rotate-with-view",e),T=Uo(i,t+"rotation",e),R=fd(i,t+"align",e),I=fd(i,t+"justify",e),P=fd(i,t+"baseline",e),F=Tv(i,t+"keep-upright",e),D=X$(i,t+"padding",e),L=A3(i,t+"declutter-mode"),C=new Bp({declutterMode:L});return function(B){if(C.setText(n(B)),r&&C.setFill(r(B)),s&&C.setBackgroundFill(s(B)),o&&C.setStroke(o(B)),a&&C.setBackgroundStroke(a(B)),l&&C.setFont(l(B)),c&&C.setMaxAngle(c(B)),u&&C.setOffsetX(u(B)),f&&C.setOffsetY(f(B)),d&&C.setOverflow(d(B)),A){let k=A(B);if(k!=="point"&&k!=="line")throw new Error("Expected point or line for text-placement");C.setPlacement(k)}if(y&&C.setRepeat(y(B)),w&&C.setScale(w(B)),S&&C.setRotateWithView(S(B)),T&&C.setRotation(T(B)),R){let k=R(B);if(k!=="left"&&k!=="center"&&k!=="right"&&k!=="end"&&k!=="start")throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(k)}if(I){let k=I(B);if(k!=="left"&&k!=="right"&&k!=="center")throw new Error("Expected left, right, or center for text-justify");C.setJustify(k)}if(P){let k=P(B);if(k!=="bottom"&&k!=="top"&&k!=="middle"&&k!=="alphabetic"&&k!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(k)}return D&&C.setPadding(D(B)),F&&C.setKeepUpright(F(B)),C}}function eme(i,e){return"icon-src"in i?tme(i,e):"shape-points"in i?nme(i,e):"circle-radius"in i?ime(i,e):null}function tme(i,e){let t="icon-",n=t+"src",r=$$(i[n],n),s=d3(i,t+"anchor",e),o=m3(i,t+"scale",e),a=Uo(i,t+"opacity",e),l=d3(i,t+"displacement",e),c=Uo(i,t+"rotation",e),u=Tv(i,t+"rotate-with-view",e),f=H$(i,t+"anchor-origin"),d=W$(i,t+"anchor-x-units"),A=W$(i,t+"anchor-y-units"),y=dd(i,t+"color"),w,S=null;y!==void 0&&(Array.isArray(y)&&y.length>0&&typeof y[0]=="string"?S=p3(i,t+"color",e):w=Y$(y,t+"color"));let T=ome(i,t+"cross-origin"),R=ame(i,t+"offset"),I=H$(i,t+"offset-origin"),P=p6(i,t+"width"),F=p6(i,t+"height"),D=sme(i,t+"size"),L=A3(i,t+"declutter-mode"),C={src:r,anchorOrigin:f,anchorXUnits:d,anchorYUnits:A,crossOrigin:T,offset:R,offsetOrigin:I,height:F,width:P,size:D,declutterMode:L},B=null;return function(k){if(B)S&&B.setColor(S(k));else{let z=S?S(k):w;B=new vA(z!==void 0?Object.assign({},C,{color:z}):Object.assign({},C))}return a&&B.setOpacity(a(k)),l&&B.setDisplacement(l(k)),c&&B.setRotation(c(k)),u&&B.setRotateWithView(u(k)),o&&B.setScale(o(k)),s&&B.setAnchor(s(k)),B}}function nme(i,e){let t="shape-",n=t+"points",r=t+"radius",s=m6(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Uo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Uo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=h2(i,t,e),d=f2(i,t,e),A=m3(i,t+"scale",e),y=d3(i,t+"displacement",e),w=Uo(i,t+"rotation",e),S=Tv(i,t+"rotate-with-view",e),T=p6(i,t+"angle"),R=A3(i,t+"declutter-mode"),I=new zE({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(P){return o&&I.setRadius(o(P)),c&&I.setRadius2(c(P)),f&&I.setFill(f(P)),d&&I.setStroke(d(P)),y&&I.setDisplacement(y(P)),w&&I.setRotation(w(P)),S&&I.setRotateWithView(S(P)),A&&I.setScale(A(P)),I}}function ime(i,e){let t="circle-",n=h2(i,t,e),r=f2(i,t,e),s=Uo(i,t+"radius",e),o=m3(i,t+"scale",e),a=d3(i,t+"displacement",e),l=Uo(i,t+"rotation",e),c=Tv(i,t+"rotate-with-view",e),u=A3(i,t+"declutter-mode"),f=new VE({radius:5,declutterMode:u});return function(d){return s&&f.setRadius(s(d)),n&&f.setFill(n(d)),r&&f.setStroke(r(d)),a&&f.setDisplacement(a(d)),l&&f.setRotation(l(d)),c&&f.setRotateWithView(c(d)),o&&f.setScale(o(d)),f}}function dd(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Uo(i,e,t){let n=dd(i,e);if(n===void 0)return;let r=Eu(n,ci,t);return function(s){return m6(r(s),e)}}function fd(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,sa,t);return function(s){return $$(r(s),e)}}function rme(i,e,t){let n=fd(i,e+"pattern-src",t),r=q$(i,e+"pattern-offset",t),s=q$(i,e+"pattern-size",t),o=p3(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Tv(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,ra,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function p3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,La,t);return function(s){return Y$(r(s),e)}}function X$(i,e,t){let n=dd(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Eu(o,ci,t);return function(c){return m6(l(c),`${e}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Eu(n,hd,t);return function(s){return d2(r(s),e)}}function d3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd,t);return function(s){let o=d2(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function q$(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd,t);return function(s){return Z$(r(s),e)}}function m3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd|ci,t);return function(s){return lme(r(s),e)}}function p6(i,e){let t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function sme(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return cs(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function ome(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function H$(i,e){let t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function W$(i,e){let t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function ame(i,e){let t=i[e];if(t!==void 0)return d2(t,e)}function A3(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function d2(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);let t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function $$(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function m6(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function Y$(i,e){if(typeof i=="string")return i;let t=d2(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function Z$(i,e){let t=d2(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function lme(i,e){return typeof i=="number"?i:Z$(i,e)}var K$={RENDER_ORDER:"renderOrder"},A6=class extends wA{constructor(e){e=e||{};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(K$.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new SA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(K$.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?r5:e;let t=cme(e);this.styleFunction_=e===null?void 0:CX(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function cme(i){if(i===void 0)return r5;if(!i)return null;if(typeof i=="function"||i instanceof Xr)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Xr){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Xr))throw new Error("Expected a list of style instances");n[r]=s}return n}return j$(i)}var g3=A6;var g6=class extends Ao{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},v3=g6;var v6=class extends Mp{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ei()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;No(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),dE(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(P,F,D,L){return s.call(o,F,P?D:null,L)}let d=u.projection,A=YT(e.slice(),d),y=[[0,0]];if(d.canWrapX()&&r){let P=d.getExtent(),F=Kn(P);y.push([-F,0],[F,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];for(let P=0;P<y.length;P++)for(let F=S-1;F>=0;--F){let D=w[F],L=D.layer;if(L.hasRenderer()&&s2(D,u)&&a.call(l,L)){let C=L.getRenderer(),B=L.getSource();if(C&&B){let k=B.getWrapX()?A:e,z=f.bind(null,D.managed);R[0]=k[0]+y[P][0],R[1]=k[1]+y[P][1],c=C.forEachFeatureAtCoordinate(R,t,n,z,T)}if(c)return c}}if(T.length===0)return;let I=1/T.length;return T.forEach((P,F)=>P.distanceSq+=F*I),T.sort((P,F)=>P.distanceSq-F.distanceSq),T.some(P=>c=P.callback(P.feature,P.layer,P.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Jf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ei()}scheduleExpireIconCache(e){na.canExpireCache()&&e.postRenderFunctions.push(ume)}};function ume(i,e){na.expire()}var Q$=v6;var _6=class extends Q${constructor(e){super(e),this.fontChangeListenerKey_=qn(AA,xu.PROPERTYCHANGE,e.redrawText,e),this.element_=no?uE():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Np+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new v3(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){li(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Oo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof g3&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;Hl(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let d=t[u];e.layerIndex=u;let A=d.layer,y=A.getSourceState();if(!s2(d,r)||y!="ready"&&y!="undefined"){A.unrender();continue}let w=A.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(d))}this.declutter(e,l),wj(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,d=u.style.backgroundColor;if(d&&(!Hl(f)||f.width>0)&&(a.fillStyle=d,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!Hl(f)||f.width===0)continue;a.save();let A=u.style.opacity||f.style.opacity;a.globalAlpha=A===""?1:Number(A);let y=f.style.transform;if(y)a.transform(...fE(y));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(Oo.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}},J$=_6;function eY(i){if(i instanceof wA){i.setMapInternal(null);return}i instanceof r2&&i.getLayers().forEach(eY)}function tY(i,e){if(i instanceof wA){i.setMapInternal(e);return}if(i instanceof r2){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)tY(t[n],e)}}var x6=class extends Us{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=hme(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:gj,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=go(),this.pixelToCoordinateTransform_=go(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,no||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,no||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(no?new Fo:ZE()),this.interactions=t.interactions||(no?new Fo:n3({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new c$(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Bo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Bo.VIEW,this.handleViewChanged_),this.addChangeListener(Bo.SIZE,this.handleSizeChanged_),this.addChangeListener(Bo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Xl)&&e.view.then(function(r){n.setView(new Xl(r))}),this.controls.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(vo.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(vo.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){tY(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};let s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:Jf,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(r){r instanceof r2?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};let r=t.layerFilter!==void 0?t.layerFilter:Jf,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(Bo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Ry(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?jr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Bo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof Fo){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let r=e[t];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){let t=vu(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?jr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Bo.SIZE)}getView(){return this.get(Bo.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return u$(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new _h(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===t2.POINTERDOWN||n===nn.WHEEL||n===nn.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[so.ANIMATING]||o[so.INTERACTING]:!1;if(a){let l=Date.now()-e.time>8;r=l?0:8,s=l?0:2}t.getTilesLoading()<r&&(a&&t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Oo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Oo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Up(xh.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Up(xh.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)li(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(nn.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Hl(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Hl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new J$(this)),!Hl(t)){this.mapBrowserEventHandler_=new a$(this,this.moveTolerance_);for(let r in gr)this.mapBrowserEventHandler_.addEventListener(gr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(nn.WHEEL,this.boundHandleBrowserEvent_,cE?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[qn(n,nn.KEYDOWN,this.handleBrowserEvent,this),qn(n,nn.KEYPRESS,this.handleBrowserEvent,this)],!Hl(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(li(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(li(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=qn(e,xu.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qn(e,nn.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(li),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Su("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qn(e,xu.PROPERTYCHANGE,this.render,this),qn(e,nn.CHANGE,this.render,this),qn(e,"addlayer",this.handleLayerAdd_,this),qn(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){eY(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,s=null;if(t!==void 0&&HD(t)&&n&&n.isDef()){let o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Ty(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Bn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=Ty(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!hh(this.previousExtent_)&&!Km(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Up(xh.MOVESTART,this,r)),this.previousExtent_=Zm(this.previousExtent_)),this.previousExtent_&&!s.viewHints[so.ANIMATING]&&!s.viewHints[so.INTERACTING]&&!Km(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Up(xh.MOVEEND,this,s)),VT(s.extent,this.previousExtent_))),this.dispatchEvent(new Up(xh.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(xh.LOADSTART)||this.hasListener(xh.LOADEND)||this.hasListener(Oo.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Su("removelayer",t)),this.set(Bo.LAYERGROUP,e)}setSize(e){this.set(Bo.SIZE,e)}setTarget(e){this.set(Bo.TARGET,e)}setView(e){if(!e||e instanceof Xl){this.set(Bo.VIEW,e);return}this.set(Bo.VIEW,new Xl);let t=this;e.then(function(n){t.setView(new Xl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(Hl(e)){let o=e.getContext("2d").getTransform();r=e.width/o.a,s=e.height/o.d}else{let o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!HD(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&jT("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!ta(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function hme(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);let t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new r2({layers:i.layers});t[Bo.LAYERGROUP]=n,t[Bo.TARGET]=i.target,t[Bo.VIEW]=i.view instanceof Xl?i.view:new Xl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new Fo(i.controls.slice()):(jn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new Fo(i.interactions.slice()):(jn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new Fo(i.overlays.slice()):(jn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new Fo,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var nY=x6;function _3(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var fme=new Error("disposed");var dme=[256,256],y6=class extends sv{constructor(e){let t=an.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=_3(this.data_);return e?[e.width,e.height]:dme}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==an.IDLE&&this.state!==an.ERROR)return;this.state=an.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=an.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=an.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(fme),this.controller_=null),super.disposeInternal()}},b6=y6;var w6=class{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Mp&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return jn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return jn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){jn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},S6=w6;var T6=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Ly(),{get:(e,t)=>{if(typeof e[t]=="function")return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let s=t[n];if(typeof s=="function"){s(e);continue}let o=t[++n];typeof e[s]=="function"?e[s](...o):typeof o=="function"?e[s]=o(e):e[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},x3=T6;var pme=5,E6=class extends mE{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=pme,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return ei()}getData(e){return null}prepareFrame(e){return ei()}renderFrame(e,t){return ei()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Pn.LOADED||t.getState()===Pn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Pn.LOADED&&t!=Pn.ERROR&&e.addEventListener(nn.CHANGE,this.boundHandleImageChange_),t==Pn.IDLE&&(e.load(),t=e.getState()),t==Pn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},iY=E6;var C6=[],Ev=null;function mme(){Ev=Di(1,1,void 0,{willReadFrequently:!0})}var M6=class extends iY{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=go(),this.pixelTransform=go(),this.inversePixelTransform=go(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Ev||mme(),Ev.clearRect(0,0,1,1);let r;try{Ev.drawImage(e,t,n,1,1,0,0,1,1),r=Ev.getImageData(0,0,1,1).data}catch{return Ev=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n,r,s){if(Hl(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===s){let c=e,u=c.getContext("2d");if(u){this.container=e,this.context=u,this.containerReused=!0,n&&(u.fillStyle=n,u.fillRect(0,0,c.width,c.height));return}}let o=this.getLayer().getClassName(),a,l;if(e&&e.className===o&&(!n||e&&e.style.backgroundColor&&ta(Oc(e.style.backgroundColor),Oc(n)))){let c=e.firstElementChild;Hl(c)&&(l=c.getContext("2d"))}if(l&&Pj(l.canvas.style.transform,t)?(this.container=e,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=no?uE():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Di();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Pc(n),s=j1(n),o=W1(n),a=H1(n);jr(t.coordinateToPixelTransform,r),jr(t.coordinateToPixelTransform,s),jr(t.coordinateToPixelTransform,o),jr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;jr(l,r),jr(l,s),jr(l,o),jr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(Kn(n)/r*o),l=Math.round(Nr(n)/r*o);No(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),dE(this.inversePixelTransform,this.pixelTransform);let c=Rj(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,c,u,a,l),!this.containerReused){let f=this.context.canvas;f.width!=a||f.height!=l?(f.width=a,f.height=l):this.context.clearRect(0,0,a,l),c!==f.style.transform&&(f.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let s=new v3(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Oo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Oo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new x3),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Oo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Oo.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,d=-e[0]+a,A=-e[1];return No(this.tempTransform,l,c,u,f,-n,d,A)}disposeInternal(){delete this.frameState,super.disposeInternal()}},y3=M6;function R6(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;let n=i[t],r=n.has(e);return r||n.add(e),!r}function Ame(i,e,t){let n=i[t];return n?n.delete(e):!1}function rY(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=uh(e,_u(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=uh(e,r))}return e}var P6=class extends y3{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Wr(),this.tempTileRange_=new rE(0,0,0,0),this.tempTileCoord_=tv(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new S6(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new S6(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=nv(a,a.getKey(),e,t,n),c;if(s.containsKey(l))c=s.get(l);else{let u=r.viewState.projection,f=a.getProjection();if(c=a.getTile(e,t,n,r.pixelRatio,u,!f||Q1(f,u)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){let s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=jr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!du(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),d=this.getTile(u,f[1],f[2],t);if(!d||d.getState()!==an.LOADED)continue;let A=l.getOrigin(u),y=cs(l.getTileSize(u)),w=l.getResolution(u),S;if(d instanceof hE||d instanceof pE)S=d.getImage();else if(d instanceof b6){if(S=_3(d.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-A[0])/w-f[1]*y[0])),R=Math.floor(c*((A[1]-r[1])/w-f[2]*y[1])),I=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+I,R+I)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Bn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],d=a.getMapInternal(),A=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),y=o.rotation,w=y?RD(o.center,o.resolution,y,e.size):void 0;for(let S=n;S>=A;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let I=T.minX;I<=T.maxX;++I)for(let P=T.minY;P<=T.maxY;++P){if(y&&!c.tileCoordIntersectsViewport([S,I,P],w))continue;let F=this.getTile(S,I,P,e);if(!F||!R6(r,F,S))continue;let L=F.getKey();if(f[L]=!0,F.getState()===an.IDLE&&!e.tileQueue.isKeyQueued(L)){let C=tv(S,I,P,this.tempTileCoord_);e.tileQueue.enqueue([F,u,c.getTileCoordCenter(C),R])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=nv(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===an.LOADED)return u.endTransition(Bn(this)),R6(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let d=nv(l,c,n,u,f),A=!1;if(a.containsKey(d)){let y=a.peek(d);y.getState()===an.LOADED&&(R6(r,y,n),A=!0)}A||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),d=f.getZForResolution(o,u.zDirection),A=f.getResolution(d);this.updateStaleKeys(u.getKey());let y=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?_u(n.extent,s):null,this.layerExtent&&(y=uh(y,this.layerExtent));let R=A*S/2/w,I=A*T/2/w,P=[a[0]-R,a[1]-I,a[0]+R,a[1]+I],F={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let $=f.getZForResolution(r.nextResolution,u.zDirection),J=rY(e,e.nextExtent);this.enqueueTiles(e,J,$,F,D)}let L=rY(e,y);if(this.enqueueTiles(e,L,d,F,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,L,d-1,F,D-1)},0),!(d in F))return this.container;let C=Bn(this),B=e.time;for(let $ of F[d]){let J=$.getState();if(J===an.EMPTY)continue;let te=$.tileCoord;if(J===an.LOADED&&$.getAlpha(C,B)===1){$.endTransition(C);continue}if(J!==an.ERROR&&(this.renderComplete=!1),this.findStaleTile_(te,F)){Ame(F,$,d),e.animate=!0;continue}if(this.findAltTiles_(f,te,d+1,F))continue;let ve=f.getMinZoom();for(let Re=d-1;Re>=ve&&!this.findAltTiles_(f,te,Re,F);--Re);}let k=A/o*l/w,z=this.getRenderContext(e);No(this.tempTransform,S/2,T/2,k,k,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(z,e,this.layerExtent),u.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,e);let G=Object.keys(F).map(Number);G.sort(pl);let W=[],Y=[],H=[];for(let $=G.length-1;$>=0;--$){let J=G[$],te=u.getTilePixelSize(J,l,s),he=f.getResolution(J)/A,ve=te[0]*he*k,Re=te[1]*he*k,Qe=f.getTileCoordForCoordAndZ(Pc(P),J),Fe=f.getTileCoordExtent(Qe),mt=jr(this.tempTransform,[w*(Fe[0]-P[0])/A,w*(P[3]-Fe[3])/A]),Ee=w*u.getGutterForProjection(s);for(let Ve of F[J]){if(Ve.getState()!==an.LOADED)continue;let Ye=Ve.tileCoord,Mt=Qe[1]-Ye[1],Et=Math.round(mt[0]-(Mt-1)*ve),Pt=Qe[2]-Ye[2],dn=Math.round(mt[1]-(Pt-1)*Re),Gt=Math.round(mt[0]-Mt*ve),$e=Math.round(mt[1]-Pt*Re),ot=Et-Gt,nt=dn-$e,bt=J===d;if(bt&&Ve.inTransition(C)){H.push({tile:Ve,x:Gt,y:$e,w:ot,h:nt,gutter:Ee}),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve);continue}let yt=[Gt,$e,Gt+ot,$e+nt],hn=[];for(let tn=0,bn=W.length;tn<bn;++tn)J<Y[tn]&&Ar(yt,W[tn])&&hn.push(W[tn]);let en;hn.length>0&&(en=TW(yt,hn)),W.push(yt),Y.push(J),this.drawTile(Ve,e,Gt,$e,ot,nt,Ee,bt,en),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve)}}for(let $=0,J=H.length;$<J;++$){let{tile:te,x:ce,y:he,w:ve,h:Re,gutter:Qe}=H[$];this.drawTile(te,e,ce,he,ve,Re,Qe,!0,void 0)}if(this.renderedResolution=A,this.extentChanged=!this.renderedExtent_||!Km(this.renderedExtent_,P),this.renderedExtent_=P,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let $=(J,te)=>{let ce=Bn(u),he=te.wantedTiles[ce],ve=he?Object.keys(he).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push($)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof b6){if(u=_3(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),d=Bn(this),A=t.layerStatesArray[t.layerIndex],y=A.opacity*(l?e.getAlpha(d,t.time):1),w=y!==f.globalAlpha;w&&(f.save(),f.globalAlpha=y);let S=u.width-2*a,T=u.height-2*a;if(c){let R=S/s,I=T/o;for(let P=0,F=c.length;P<F;++P){let D=c[P],L=D[0],C=D[1],B=D[2]-D[0],k=D[3]-D[1];f.drawImage(u,a+(L-n)*R,a+(C-r)*I,B*R,k*I,L,C,B,k)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),y!==A.opacity?t.animate=!0:l&&e.endTransition(d)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Bn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},sY=P6;var p2={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var I6=class extends wA{constructor(e){e=e||{};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(p2.PRELOAD)}setPreload(e){this.set(p2.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(p2.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(p2.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},oY=I6;var L6=class extends oY{constructor(e){super(e)}createRenderer(){return new sY(this,{cacheSize:this.getCacheSize()})}},D6=L6;var N6=class{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},b3=N6;var m2={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},A2=[m2.FILL],wh=[m2.STROKE],pd=[m2.BEGIN_PATH],F6=[m2.CLOSE_PATH],vn=m2;var B6=class extends b3{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],du(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],d=this.tmpCoordinate_,A=!0,y,w,S;for(y=t+r;y<n;y+=r)d[0]=e[y],d[1]=e[y+1],S=zT(c,d),S!==w?(A&&(a[l++]=u,a[l++]=f,A=!1),a[l++]=d[0],a[l++]=d[1]):S===Bs.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],A=!1):A=!0,u=d[0],f=d[1],w=S;return(s&&A||y===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,d,A;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];let y=e.getEndss();A=0;for(let w=0,S=y.length;w<S;++w){let T=[];A=this.drawCustomCoordinates_(c,A,y[w],a,T),d.push(T)}this.instructions.push([vn.CUSTOM,l,d,e,n,Oy,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,d,e,r||n,Oy,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),A=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([vn.CUSTOM,l,f,e,n,Pp,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,f,e,r||n,Pp,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([vn.CUSTOM,l,u,e,n,Bc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Bc,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([vn.CUSTOM,l,u,e,n,Bc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Bc,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([vn.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==vn.END_GEOMETRY?o=t:s==vn.BEGIN_GEOMETRY&&(r[2]=t,ij(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=gl(n||io)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=gl(n||ia);let r=e.getLineCap();t.lineCap=r!==void 0?r:gh;let s=e.getLineDash();t.lineDash=s?s.slice():vl;let o=e.getLineDashOffset();t.lineDashOffset=o||_l;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:vh;let l=e.getWidth();t.lineWidth=l!==void 0?l:od;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:rd;let u=e.getOffset();t.strokeOffset=u??xX,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[vn.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[vn.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!ta(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[vn.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=VT(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;G1(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Sh=B6;var O6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!du(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||du(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},aY=O6;var U6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([vn.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],pd);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(wh),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],pd);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinates_(c,f,l[d],u,a);this.hitDetectionInstructions.push(wh),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(wh),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(wh),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(pd)}},lY=U6;var k6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=n.length;this.instructions.push(pd),this.hitDetectionInstructions.push(pd);for(let u=0;u<c;++u){let f=n[u],d=this.coordinates.length,A=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([vn.MOVE_TO_LINE_TO,d,A,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,d,A,s,!0]),l&&(this.instructions.push(F6),this.hitDetectionInstructions.push(F6)),t=f}return a&&(this.instructions.push(A2),this.hitDetectionInstructions.push(A2)),l&&(this.instructions.push(wh),this.hitDetectionInstructions.push(wh)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[vn.CIRCLE,u,a];this.instructions.push(pd,f),this.hitDetectionInstructions.push(pd,f),r.fillStyle!==void 0&&(this.instructions.push(A2),this.hitDetectionInstructions.push(A2)),r.strokeStyle!==void 0&&(this.instructions.push(wh),this.hitDetectionInstructions.push(wh)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinatess_(c,f,l[d],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=Ip(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}},z6=k6;var V6=0,G6=1;function gme(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let d=(i-r)/l,A=(t-r)/l;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let d=(e-s)/c,A=(n-s)/c;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}return V6=u,G6=f,!0}function cY(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,d,A=0;for(let y=0,w=e.length;y<w;++y){let S=e[y],T=i[A],R=i[A+1],I=!1;for(let P=A+t;P<S;P+=t){let F=i[P],D=i[P+1];if(gme(r,s,o,a,T,R,F,D)){let L=F-T,C=D-R,B=T+V6*L,k=R+V6*C,z=T+G6*L,G=R+G6*C;u&&I&&B===f&&k===d?l.push(z,G):(u&&c.push(l.length),l.push(B,k,z,G),u=!0),f=z,d=G,I=!0}T=F,R=D}A=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function uY(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],d=e[o+r+1],A=Math.sqrt((f-c)*(f-c)+(d-u)*(d-u));if(a+=A,a>=i){let y=(i-a+A)/A,w=Lo(c,f,y),S=Lo(u,d,y);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let y=A-a,w=Lo(c,f,y/A),S=Lo(u,d,y/A);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function hY(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,d,A,y,w,S,T,R,I;for(f=t;f<n;f+=r){let P=e[f],F=e[f+1];y!==void 0&&(R=P-y,I=F-w,A=Math.sqrt(R*R+I*I),S!==void 0&&(l+=d,u=Math.acos((S*R+T*I)/(d*A)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),d=A,S=R,T=I),y=P,w=F}return l+=A,l>a?[c,f]:[s,o]}var g2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},q6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[io]={fillStyle:io},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let d=e.getExtent();if(!Ar(this.maxExtent,d))return;let A;if(u=e.getFlatCoordinates(),c=="LineString")A=[u.length];else if(c=="MultiLineString")A=e.getEnds();else if(c=="Polygon")A=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();A=[];for(let R=0,I=T.length;R<I;++R)A.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!ch(this.getBufferedMaxExtent(),d)){let T=cY(u,A,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,A=T.ends,f=2,A.length===0)return}this.beginGeometry(e,t,n);let y=o.repeat,w=y?void 0:o.textAlign,S=0;for(let T=0,R=A.length;T<R;++T){let I;y?I=uY(y*this.resolution,u,S,A[T],f):I=[u.slice(S,A[T])];for(let P=0,F=I.length;P<F;++P){let D=I[P],L=0,C=D.length;if(w==null){let k=hY(o.maxAngle,D,0,D.length,2);L=k[0],C=k[1]}for(let k=L;k<C;k+=f)a.push(D[k],D[k+1]);let B=a.length;S=A[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let d=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||d.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let P=e.getFlatInteriorPoints();u=[];for(let F=0,D=P.length;F<D;F+=3)o.overflow||d.push(P[F+2]/this.resolution),u.push(P[F],P[F+1]);if(u.length===0)return;f=2;break;default:}let A=this.appendFlatPointCoordinates(u,f);if(A===l)return;if(d&&(A-l)/2!==u.length/f){let P=l/2;d=d.filter((F,D)=>{let L=a[(P+D)*2]===u[D*f]&&a[(P+D)*2+1]===u[D*f+1];return L||--P,L})}this.saveTextStates_();let y=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=sd&&(o.scale[0]<0||o.scale[1]<0)){let P=o.padding[0],F=o.padding[1],D=o.padding[2],L=o.padding[3];o.scale[0]<0&&(F=-F,L=-L),o.scale[1]<0&&(P=-P,D=-D),S=[P,F,D,L]}let T=this.pixelRatio;this.instructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==sd?sd:S.map(function(P){return P*T}),y,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);let R=1/T,I=y?y.slice(0):null;I&&(I[1]=io),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[R,R],NaN,this.declutterMode_,this.declutterImageWithText_,S,I,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?io:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Fp,justify:t.justify,textBaseline:t.textBaseline||gA,scale:t.scale});let o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,c=g2[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,d=this.text_,A=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,A*l,d,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a&&io,r.maxAngle,l,f,s,A*l,d,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=gl(o.getColor()||io)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),R=a.getMiterLimit();s.lineCap=a.getLineCap()||gh,s.lineDash=w?w.slice():vl,s.lineDashOffset=S===void 0?_l:S,s.lineJoin=a.getLineJoin()||vh,s.lineWidth=T===void 0?od:T,s.miterLimit=R===void 0?rd:R,s.strokeStyle=gl(a.getColor()||ia)}n=this.textState_;let l=e.getFont()||UE;yX(l);let c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||gA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||sd,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),d=e.getRotateWithView(),A=e.getKeepUpright(),y=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=A===void 0?!0:A,this.textRotation_=y===void 0?0:y,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Bn(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Bn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},fY=q6;var vme={Circle:z6,Default:Sh,Image:aY,LineString:lY,Polygon:z6,Text:fY},H6=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){let n=e!==void 0?e.toString():"0",r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){let o=vme[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},dY=H6;function w3(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],d,A,y,w,S,T,R,I,P=0;for(let F=e;F<t;F+=n){y=d,w=A,S=void 0,T=void 0,F+n<t&&(S=i[F+n],T=i[F+n+1]),s&&F===e&&(y=u,w=f),s&&F===t-n&&(S=l,T=c),d=i[F],A=i[F+1],[R,I]=_me(d,A,y,w,S,T,r),o[P++]=R,o[P++]=I;for(let D=2;D<a;D++)o[P++]=i[F+D]}return o.length!=P&&(o.length=P),o}function _me(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let d=LW([i,e],[t,n],[r,s]);if(Math.cos(d)>.998)return[i+u*o,e+f*o];let A=Math.cos(d/2),y=Math.sin(d/2),w=y*a+A*l,S=-A*a+y*l,T=w*(1/y),R=S*(1/y);return[i+T*o,e+R*o]}function S3(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],d=i[o+1],A=i[o+e],y=i[o+e+1],w=(y-d)*(c-a)-(A-f)*(u-l);if(w===0)continue;let S=((A-f)*(l-d)-(y-d)*(a-f))/w,T=((c-a)*(l-d)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let R=a+S*(c-a),I=l+S*(u-l);i[n+e]=R,i[n+e+1]=I,i.splice(n+2*e,o-n-e);break}}}return i}var W6;function xme(){return W6||(W6=new Intl.Segmenter(void 0,{granularity:"grapheme"})),W6}function pY(i,e,t,n,r,s,o,a,l,c,u,f,d=!0){let A=i[e],y=i[e+1],w=0,S=0,T=0,R=0;function I(){w=A,S=y,e+=n,A=i[e],y=i[e+1],R+=T,T=Math.sqrt((A-w)*(A-w)+(y-S)*(y-S))}do I();while(e<t-n&&R+T<s);let P=T===0?0:(s-R)/T,F=Lo(w,A,P),D=Lo(S,y,P),L=e-n,C=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)I();P=T===0?0:(B-R)/T;let k=Lo(w,A,P),z=Lo(S,y,P),G=!1;if(d)if(f){let te=[F,D,k,z];xE(te,0,4,2,f,te,te),G=te[0]>te[2]}else G=F>k;let W=Math.PI,Y=[],H=L+n===e;e=L,T=0,R=C,A=i[e],y=i[e+1];let $;if(H){I(),$=Math.atan2(y-S,A-w),G&&($+=$>0?-W:W);let te=(k+F)/2,ce=(z+D)/2;return Y[0]=[te,ce,(B-s)/2,$,r],Y}r=r.replace(/\n/g," ");let J=Array.from(xme().segment(r),te=>te.segment);for(let te=0,ce=J.length;te<ce;){I();let he=Math.atan2(y-S,A-w);if(G&&(he+=he>0?-W:W),$!==void 0){let Ee=he-$;if(Ee+=Ee>W?-2*W:Ee<-W?2*W:0,Math.abs(Ee)>o)return null}$=he;let ve=te,Re=0;for(;te<ce;++te){let Ee=G?ce-te-1:te,Ve=a*l(c,J[Ee],u);if(e+n<t&&R+T<s+Re+Ve/2)break;Re+=Ve}if(te===ve)continue;let Qe=(G?J.slice(ce-te,ce-ve):J.slice(ve,te)).join("");P=T===0?0:(s+Re/2-R)/T;let Fe=Lo(w,A,P),mt=Lo(S,y,P);Y.push([Fe,mt,Re/2,he,Qe]),s+=Re}return Y}var Mv=Wr(),Gp=[],md=[],Ad=[],qp=[];function mY(i){return i[3].declutterBox}var AY=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function j6(i,e){return e==="start"?e=AY.test(i)?"right":"left":e==="end"&&(e=AY.test(i)?"left":"right"),g2[e]}function yme(i,e,t){return t>0&&i.push(`7+`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let d=e[c+1]||i.font,A=wX(d,f);t.push(A),o+=A;let y=qpe(d);n.push(y),l=Math.max(l,y)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function TX(i,e,t,n,r,s,o,a,l,c,u){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=f=>f.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(u[0],u[1]),Hpe(n,i)):u[0]<0||u[1]<0?(i.translate(l,c),i.scale(u[0],u[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,c,o*u[0],a*u[1]),i.restore()}function Hpe(i,e){let t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}var KN=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=cs(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return ei()}getImage(e){return ei()}getHitDetectionImage(){return ei()}getPixelRatio(e){return 1}getImageState(){return ei()}getImageSize(){return ei()}getOrigin(){return ei()}getSize(){return ei()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=cs(e)}listenImageChange(e){ei()}load(){ei()}unlistenImageChange(e){ei()}ready(){return Promise.resolve()}},kE=KN;var QN=class i extends kE{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Pn.LOADING:Pn.LOADED,this.imageState_===Pn.LOADING&&this.ready().then(()=>this.imageState_=Pn.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=na.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Di(o,o);this.draw_(s,a,e),r=a.canvas;let l=new gX(r,void 0,null,Pn.LOADED,null);na.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),d=f/l;if(e==="miter"&&d<=n)return d*t;let A=t/2/d,y=t/2*(u/f),S=Math.sqrt((r+A)*(r+A)+y*y)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),R=Math.sqrt(r*r-T*T),I=s-R,F=Math.sqrt(T*T+I*I)/T;if(F<=n){let D=F*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=gh,t=vh,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=gl(this.stroke_.getColor()??ia),a=this.stroke_.getWidth()??od,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??vh,e=this.stroke_.getLineCap()??gh,n=this.stroke_.getMiterLimit()??rd);let l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),u=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:u,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=io),t.fillStyle=gl(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=Oc(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Di(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=io,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},zE=QN;var JN=class i extends zE{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}},VE=JN;var e5=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=Dp(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Pn.IDLE&&t.load(),t.getImageState()===Pn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Bn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Oc(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},ks=e5;function EX(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}var t5=class i extends kE{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;jn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Bn(o)),jn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),jn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=Pn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Pn.LOADED:Pn.IDLE:l=Pn.LOADING:l=Pn.LOADED),this.color_=e.color!==void 0?Oc(e.color):null,this.iconImage_=Dp(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;let A=this.iconImage_.getSize();this.setScale(EX(A[0],A[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(EX(c,u,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new i({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Oc(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?Pn.IDLE:this.iconImage_.getImageState();this.iconImage_=Dp(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Dp(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Pn.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Pn.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Pn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(nn.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(nn.CHANGE,e)}ready(){return this.iconImage_.ready()}},vA=t5;var n5=class i{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},ro=n5;var GE=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=MX,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new i({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=MX,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function CX(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(jn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var i5=null;function r5(i,e){if(!i5){let t=new ks({color:"rgba(255,255,255,0.4)"}),n=new ro({color:"#3399CC",width:1.25});i5=[new GE({image:new VE({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return i5}function MX(i){return i.getGeometry()}var Xr=GE;var Wpe="#333",s5=class i{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=cs(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new ks({color:Wpe}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof ks?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=cs(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},Bp=s5;function ad(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function IX(i){let e=i.get("pin");return!e||ld(e)||e.passesZoneFilters||u5(e)?null:a5(e,!1)}function LX(i){let e=i.get("pin");return!e||!O.highlightedZones.size||!e.passesZoneFilters||ld(e)||u5(e)?null:a5(e,!1)}function DX(i){let e=i.get("pin");return!e||ld(e)||Zf(null,e.category)!=="always"&&!(O.labelsHeld&&!hW(e.category))?null:FX(e)}function NX(i){let e=i.get("pin");if(!e||ld(e))return null;let t=a5(e,e===O.selectedPin);return e===O.hoveredPin||e===O.selectedPin?[t,FX(e)]:t}function a5(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(O.styleCache.has(t))return O.styleCache.get(t);let n=fA(i.category),r=e?2e7:i.priority,s=O.markerIcons.get(Jy(i.category)),o;return s?o=new Xr({image:new vA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Xr({text:new Bp({text:bu(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new ks({color:n}),stroke:new ro({color:hA(),width:e?4:3})}),zIndex:r}),O.styleCache.set(t,o),o}function FX(i){let e=`marker-label:${i.location.id}`;if(O.styleCache.has(e))return O.styleCache.get(e);let t=new Xr({text:new Bp({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new ks({color:"#f2ece0"}),stroke:new ro({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new ks({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return O.styleCache.set(e,t),t}function BX(i){if(!i.iconAsset)return;let e=Jy(i);if(O.markerIcons.has(e))return;O.markerIcons.set(e,null);let t=new Image;t.onload=()=>{let n=document.createElement("canvas");n.width=64,n.height=64;let r=n.getContext("2d"),s=fA(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=hA(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),O.markerIcons.set(e,n.toDataURL("image/png")),jpe(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.priority.changed()},t.onerror=()=>O.markerIcons.set(e,!1),t.src=vN(i.iconAsset)}function jpe(){for(let i of O.styleCache.keys())i.startsWith("marker:")&&O.styleCache.delete(i)}function Jy(i){return`${i.iconAsset||""}:${fA(i)}:${O.world?.iconOutset||"light"}`}function qE(i,e){return`${i} ${e}px ${Vi.labelFont}`}function l5(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Vi.neighborLabelSizePx:Vi.labelSizePx,s=qE(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=$pe(t,s,r,o,e),l=IE(t,{subgridVisible:O.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${O.gridSystem}:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(O.styleCache.has(c))return O.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new Xr({fill:l.fill?new ks({color:Dc(l.fill.color,l.fill.opacity)}):void 0,stroke:new ro({color:Dc(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let d=l.label.prefix?[l.label.prefix,qE(500,r),l.label.final,qE(900,r)]:l.label.final,A=Vi.labelInsetPx*e,y=Xpe(i.getGeometry());y&&f.push(new Xr({geometry:new yu([y[0]-A,y[1]+A]),text:new Bp({text:d,font:qE(900,r),textAlign:"right",textBaseline:"bottom",fill:new ks({color:Dc(l.label.color,l.label.textAlpha)}),backgroundFill:new ks({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return O.styleCache.set(c,f),f}function Xpe(i){let e=i.getType()==="MultiPolygon"?i.getCoordinates():[i.getCoordinates()],t=null;for(let n of e)for(let[r,s]of n[0]||[])(!t||r-s>t[0]-t[1])&&(t=[r,s]);return t}function $pe(i,e,t,n,r){if(!r)return!0;let s=c5(i.hash,e)+n[1]+n[3],o=t+n[0]+n[2];return s<=(i.extent[2]-i.extent[0])/r&&o<=(i.extent[3]-i.extent[1])/r}var RX=document.createElement("canvas").getContext("2d"),PX=new Map;function c5(i,e){let t=`${e}|${i}`,n=PX.get(t);return n===void 0&&(RX.font=e,n=RX.measureText(i).width,PX.set(t,n)),n}var Ype=new Xr({fill:new ks({color:"rgba(5, 8, 16, 0.62)"})});function OX(){return V1()?Ype:null}function UX(i,e){let t=i.get("zone");if(Io(fu(t)))return null;let n=i.get("child"),r=O.highlightedZones.has(t.id),s=GX(t.id),o=Number(t.attrs?.["atlas.stroke.width_px"])||Number(z1(t)?.attrs?.["atlas.stroke.width_px"])||0;if(o>0&&i.getGeometry()?.getType()==="MultiLineString")return Zpe(t,i.get("color"),o/e,r,s);let a=`zone:${t.id}:${n?1:0}:${r?1:s?2:0}`;if(O.styleCache.has(a))return O.styleCache.get(a);let l=i.get("color");if(s){let f=new Xr({stroke:new ro({color:Dc(l,n?.34:.44),width:n?1:1.3,lineDash:n?[3,4]:[7,5]}),zIndex:n?101:100});return O.styleCache.set(a,f),f}let c=new Xr({fill:new ks({color:Dc(l,n?.035:.07)}),stroke:new ro({color:Dc(l,n?.5:.72),width:n?1.2:1.8,lineDash:n?[3,4]:[7,5]})});if(!r)return O.styleCache.set(a,c),c;let u=[new Xr({stroke:new ro({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Xr({fill:new ks({color:Dc(l,.22)}),stroke:new ro({color:l,width:2.6}),zIndex:9001})];return O.styleCache.set(a,u),u}function Zpe(i,e,t,n,r){let s=Math.max(t,1.5);return n?[new Xr({stroke:new ro({color:"rgba(255,255,255,0.94)",width:s+4,lineCap:"round",lineJoin:"round"}),zIndex:9e3}),new Xr({stroke:new ro({color:Dc(e,.9),width:s,lineCap:"round",lineJoin:"round"}),zIndex:9001})]:[new Xr({stroke:new ro({color:Dc(e,r?.14:.3),width:s,lineCap:"round",lineJoin:"round"})}),new Xr({stroke:new ro({color:Dc(e,r?.4:.8),width:Math.min(1.6,s),lineDash:[7,5]})})]}function kX(i){if(h5())return null;let e=i.get("zone");if(Io(fu(e))||VX(e))return null;let t=O.highlightedZones.has(e.id);if(Zf(e)==="quiet")return o5(i);let n=i.get("child"),r=O.engine.getView().getZoom()||0;if(!t&&n&&r<O.fitZoom+3)return null;let s=i.get("span")/O.engine.getView().getResolution();return!t&&O.zoneTitleCount>40&&s<52?null:o5(i)}function zX(i){if(!h5())return null;let e=i.get("zone");return Io(fu(e))||VX(e)?null:o5(i)}function VX(i){return Zf(i)!=="quiet"||O.highlightedZones.has(i.id)||O.selectedZone===i?!1:O.labelOverrides.get(fu(i))==="quiet"||!O.labelsHeld}function o5(i){let e=i.get("child"),t=i.get("zone"),n=O.highlightedZones.has(t.id),r=GX(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(O.styleCache.has(s))return O.styleCache.get(s);let o=i.get("color"),a=new Xr({text:new Bp({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new ks({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new ro({color:n?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:n?2:r?3:4}),backgroundFill:new ks({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new ro({color:n?"#ffffff":Dc(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return O.styleCache.set(s,a),a}function GX(i){if(!O.highlightedZones.size||O.highlightedZones.has(i))return!1;for(let e of O.highlightedZones)if(Kpe(i,e))return!1;return!0}function Kpe(i,e){let t=new Set,n=O.zoneRecords.get(e)?.zone.parent;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=O.zoneRecords.get(n)?.zone.parent}return!1}function _A(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],d=0,A=[0];for(let S=e+n;S<t;S+=n){let T=i[S],R=i[S+1];d+=Math.sqrt((T-u)*(T-u)+(R-f)*(R-f)),A.push(d),u=T,f=R}let y=r*d,w=tj(A,y);w<0?(l=(y-A[-w-2])/(A[-w-1]-A[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:Lo(i[a+u],i[a+n+u],l);return s}function HE(i,e,t,n,r,s){if(t==e)return null;let o;if(r<i[e+n-1])return s?(o=i.slice(e,e+n),o[n-1]=r,o):null;if(i[t-1]<r)return s?(o=i.slice(t-n,t),o[n-1]=r,o):null;if(r==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){let d=a+l>>1;r<i[(d+1)*n-1]?l=d:a=d+1}let c=i[a*n-1];if(r==c)return i.slice((a-1)*n,(a-1)*n+n);let u=i[(a+1)*n-1],f=(r-c)/(u-c);o=[];for(let d=0;d<n-1;++d)o.push(Lo(i[(a-1)*n+d],i[a*n+d],f));return o.push(r),o}function qX(i,e,t,n,r,s,o){if(o)return HE(i,e,t[t.length-1],n,r,s);let a;if(r<i[n-1])return s?(a=i.slice(0,n),a[n-1]=r,a):null;if(i[i.length-1]<r)return s?(a=i.slice(i.length-n),a[n-1]=r,a):null;for(let l=0,c=t.length;l<c;++l){let u=t[l];if(e!=u){if(r<i[e+n-1])return null;if(r<=i[u-1])return HE(i,e,u,n,r,!1);e=u}}return null}function dv(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}var f5=class i extends Al{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Do(this.flatCoordinates,e),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Uy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return sE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,HE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return _A(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return dv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){let t=[];return t.length=pA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return oA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uA(this.flatCoordinates,0,e,this.stride),this.changed()}},d5=f5;var p5=class i extends Al{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let r=e,s=[],o=[];for(let l=0,c=r.length;l<c;++l){let u=r[l];Do(s,u.getFlatCoordinates()),o.push(s.length)}let a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(e){Do(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,qX(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Pp(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new d5(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o],c=new d5(e.slice(s,l),n);r.push(c),s=l}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,s=e.length;r<s;++r)n+=dv(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){let l=r[o],c=_A(t,n,l,s,.5);Do(e,c),n=l}return e}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=SE(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new i(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return aj(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Dy(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},HX=p5;function m5(){O.renderedShard=O.lens?.shard||0,O.sources.zones.clear(),O.sources.zoneTitles.clear(),O.zoneRecords.clear(),O.highlightedZones.clear(),O.focusedZoneID=null,O.zoneTitleCount=0,Op();for(let i of O.world.collections)if(i.kind!=="point")for(let e of i.features||[]){if(!By(e))continue;e.collectionId=i.id;let t=Wr(),n=[],r=!1;for(let l of e.geometry||[]){let c=e0e(l);c&&(r=!0,n.push(c),qT(t,c.getExtent()),O.sources.zones.addFeature(new Rp({geometry:c,zone:e,color:cv(e.id),child:e.parent!=null})))}if(!r)continue;let s=cv(e.id),o=e.center?pv(e.center.lat,e.center.lng):dl(t),a=Math.max(t[2]-t[0],t[3]-t[1]);O.sources.zoneTitles.addFeature(new Rp({geometry:new yu(o),zone:e,color:s,child:e.parent!=null,span:a,priority:(e.parent==null?2e6:1e6)+Math.round(a)})),O.zoneRecords.set(e.id,{zone:e,collection:i,extent:t.slice(),geometries:n,color:s})}A5(),g5(),Qpe()}function A5(){O.zoneTitleCount=O.sources.zoneTitles.getFeatures().filter(i=>Zf(i.get("zone"))!=="quiet").length}function g5(){if(O.sources.zoneScrim.clear(),!O.highlightedZones.size)return;let[i,e,t,n]=O.projection.getExtent(),r=[WX([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of O.highlightedZones)for(let o of O.zoneRecords.get(s)?.geometries||[]){if(o.getType()==="MultiLineString")continue;let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(WX(c.getCoordinates(),u>0))})}O.sources.zoneScrim.addFeature(new Rp({geometry:new Ah(r)}))}function WX(i,e){let t=0;for(let n=0,r=i.length-1;n<i.length;r=n++)t+=i[r][0]*i[n][1]-i[n][0]*i[r][1];return t<0===e?i:i.slice().reverse()}function Qpe(){for(let i of ge.legend.querySelectorAll(".feature-index")){let e=document.createDocumentFragment();for(let{zone:t,depth:n}of Jpe(wu(i.dataset.featureIndex))){let r=O.zoneRecords.get(t.id);if(!r)continue;let s=document.createElement("button");s.type="button",s.className="zone-index-item",s.dataset.zone=String(t.id),s.style.setProperty("--zone-color",r.color),s.style.setProperty("--zone-depth",String(n)),s.setAttribute("aria-pressed","false"),s.title=`${t.title}: click to jump; right-click to toggle highlight`;let o=document.createElement("span");o.className="zone-index-marker",o.setAttribute("aria-hidden","true");let a=document.createElement("span");a.textContent=t.title,s.append(o,a),e.append(s)}i.replaceChildren(e)}}function Jpe(i){let e=[...O.zoneRecords.values()].filter(a=>a.zone.collectionId===i).map(a=>a.zone),t=new Set(e.map(a=>a.id)),n=new Map;for(let a of e){let l=t.has(a.parent)?a.parent:null;n.has(l)||n.set(l,[]),n.get(l).push(a)}for(let a of n.values())a.sort((l,c)=>l.title.localeCompare(c.title,void 0,{numeric:!0,sensitivity:"base"}));let r=[],s=new Set,o=(a,l)=>{if(!s.has(a.id)){s.add(a.id),r.push({zone:a,depth:l});for(let c of n.get(a.id)||[])o(c,l+1)}};for(let a of n.get(null)||[])o(a,0);for(let a of e)o(a,0);return r}function Op(){let i=V1();O.layers.zoneScrim.setVisible(i),O.layers.zones.setVisible(i),O.layers.zoneTitles.setVisible(i),O.layers.zoneTitleDetail.setVisible(i);let e=!1;for(let t of[...O.highlightedZones]){let n=O.zoneRecords.get(t);(!n||Io(fu(n.zone)))&&(O.highlightedZones.delete(t),e=!0)}e&&(WE(),g5(),_5()),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()}function v5(i){let e=O.zoneRecords.get(i);e&&(O.focusedZoneID=i,_5(),wE(e.zone),O.engine.getView().fit(e.extent,{size:O.engine.getSize(),padding:[54,54,54,54],maxZoom:mh(O.lens),duration:220}),ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"))}function jX(i){let e=O.zoneRecords.get(i);e&&(O.highlightedZones.has(i)?O.highlightedZones.delete(i):(O.highlightedZones.add(i),O.hiddenCollections.delete(fu(e.zone))&&(dA(),ph()),Op()),O.hoveredPin=null,WE(),x5(),_5(),g5(),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed())}function _5(){for(let i of ge.legend.querySelectorAll(".feature-index"))i.classList.toggle("has-highlights",O.highlightedZones.size>0);for(let i of ge.legend.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=O.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",O.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function e0e(i){if(!i?.coordinates)return null;let e=([t,n])=>pv(n,t);return i.type==="Polygon"?new Ah(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new RE(i.coordinates.map(t=>t.map(n=>n.map(e)))):i.type==="MultiLineString"?new HX(i.coordinates.map(t=>t.map(e))):null}function pv(i,e){let t=t0e(),n=2**t.sourceZoom,r=(e+180)/360*n,s=i*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*n;return[(r-t.firstTile)*t.tileSize,-(o-t.firstTile)*t.tileSize]}function t0e(){let i=O.volume.tileGrid,e=O.world?.grid;return e?{...i,...e}:i}function XX(){O.sources.pins.clear(),O.sources.priority.clear(),O.features=[],O.featureByID.clear();for(let i of O.world.collections)if(i.kind==="point"){BX(i);for(let e of i.locations){let t={location:e,category:i,coordinate:pv(e.lat,e.lng),filteredHidden:!1,priority:r0e(i,e),feature:null};t.feature=new Rp({geometry:new yu(t.coordinate),pin:t,priority:t.priority}),O.features.push(t),O.featureByID.set(e.id,t),O.sources.pins.addFeature(t.feature)}}Nc()}function Nc(){for(let i of O.features){let e=Io(i.category.id),t=O.search&&!i.location.title.toLocaleLowerCase().includes(O.search);i.filteredHidden=!!(e||t)}WE(),x5(),O.selectedPin?.filteredHidden&&id(),nd(),document.dispatchEvent(new Event("atlas:filters"))}function WE(){if(!O.highlightedZones.size){for(let e of O.features)e.passesZoneFilters=!1;return}let i=cW([...O.highlightedZones].map(e=>O.zoneRecords.get(e)).filter(Boolean));for(let e of O.features)e.passesZoneFilters=uW(i,e.coordinate)}function x5(){O.eligibleLocations=O.features.filter(i=>!ld(i)).length,Fc(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.pinLabels.changed(),O.layers.priority.changed(),xA()}function Fc(){O.sources.priority.clear();for(let i of O.features){if(ld(i))continue;let e=!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search);(i===O.selectedPin||i===O.hoveredPin||e||Lp(i))&&O.sources.priority.addFeature(i.feature)}}function mv(i){O.hoveredPin!==i&&(O.hoveredPin=i,O.sources&&(Fc(),O.layers.pins.changed(),O.layers.priority.changed()))}function jE(i){O.labelsHeld!==i&&(O.labelsHeld=i,ge.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",O.layers.pinLabels.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),document.dispatchEvent(new Event("atlas:labels")))}function u5(i){return i===O.selectedPin||i===O.hoveredPin||Lp(i)||!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search)}function ld(i){return i.filteredHidden||n0e(i)||i0e(i)||!By(i.location)}function By(i){let e=O.lens?.shard;return!e||!i.shard||i.shard===e}function n0e(i){return!O.highlightedZones.size||i.passesZoneFilters||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function i0e(i){return!O.gridEnabled||!O.gridCell||Lp(i)||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function r0e(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Kj(e.id)%1e3}function h5(){return(O.engine?.getView().getZoom()||0)>=(O.lens?.maxZoom||0)-.05}function $X(i){let e=[],t=new Map,n=(s,o,a)=>{t.has(s)||(t.set(s,e.length),e.push({key:s,title:o,collections:[]})),e[t.get(s)].collections.push(a)},r=[];for(let s of i)s.kind!=="point"&&!s.group?r.push(s):n(`group-${s.group}`,s.group,s);return r.length&&e.unshift({key:"zones",title:"Zones",collections:r}),e}function YX(i){return i.kind||"point"}function ZX(i){return(i.features||i.locations||[]).length}function wu(i){return/^\d+$/.test(i)?Number(i):i}function KX(i){for(let e of O.world?.sections||[])for(let t of e.collections)if(t.id===i)return t;return null}function QX(){let i=document.createDocumentFragment();for(let e of O.world.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.collections.reduce((s,o)=>s+ZX(o),0);t.append(s0e(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.collections)if(r.append(o0e(s)),YX(s)!=="point"){let o=document.createElement("div");o.className="feature-index",o.dataset.featureIndex=String(s.id),r.append(o)}t.append(r),i.append(t)}ge.legend.replaceChildren(i),XE(),t$(),ph()}function s0e(i,e,t){let n=document.createElement("div");n.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=i;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=e;let a=document.createElement("span");a.className="layer-count",a.textContent=jl(t),r.append(s,o,a);let l=JX(`Show only ${e}`);l.dataset.onlySection=i;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.sectionToggle=i,u.setAttribute("aria-label",`Show ${e}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),n.append(r,l,c),n}function JX(i){let e=document.createElement("button");return e.type="button",e.className="only-button",e.dataset.label=i,e.setAttribute("aria-label",i),e.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="4.6"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2"/></svg>',e}function o0e(i){let e=YX(i),t=document.createElement("label");t.className="category-row";let n=document.createElement("input");n.type="checkbox",n.dataset.collection=String(i.id),n.checked=!O.hiddenCollections.has(i.id);let r;e!=="point"?(r=document.createElement("button"),r.type="button",r.className="collection-expand",r.dataset.expandCollection=String(i.id),r.setAttribute("aria-label",`Unfold the ${i.title} index`),r.innerHTML='<svg class="collection-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg>'+(e==="path"?'<svg class="collection-kind" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 12.5c3-6 8-2 11-9"/></svg>':'<svg class="collection-kind collection-kind-area" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 4.2 12.6 11.6H3.4z"/></svg>')):(r=document.createElement("span"),r.className="category-icon",uv(t,i),hv(r,i,bu(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=JX(`Show only ${i.title}`);o.dataset.onlyCollection=String(i.id);let a;e==="area"?(a=document.createElement("button"),a.type="button",a.className="label-toggle",a.dataset.labelToggle=String(i.id),a.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 3.5h9M8 3.5v9"/></svg>',y5(a,i)):e==="point"&&wD(i)==="text"?(a=document.createElement("button"),a.type="button",a.className="label-toggle",a.dataset.labelToggle=String(i.id),a.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8.6 2.5H2.5v6.1l5.4 5.4a1.2 1.2 0 0 0 1.7 0l4.4-4.4a1.2 1.2 0 0 0 0-1.7z"/><path d="M5.6 5.6h.01"/></svg>',y5(a,i)):(a=document.createElement("span"),a.className="label-toggle-spacer");let l=document.createElement("span");return l.className="category-count",l.textContent=jl(ZX(i)),t.append(n,r,s,a,o,l),t}function b5(i){if(O.collapsedSections.clear(),i)for(let e of ge.layers.querySelectorAll("[data-section]"))O.collapsedSections.add(e.dataset.section);XE()}function XE(){for(let i of ge.layers.querySelectorAll("[data-section]")){let e=O.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Wl()}function e$(i){O.expandedCollections.has(i)?O.expandedCollections.delete(i):O.expandedCollections.add(i),t$()}function t$(){for(let i of ge.legend.querySelectorAll("[data-expand-collection]")){let e=O.expandedCollections.has(wu(i.dataset.expandCollection));i.setAttribute("aria-expanded",String(e)),i.closest(".category-row").classList.toggle("is-expanded",e)}for(let i of ge.legend.querySelectorAll(".feature-index"))i.hidden=!O.expandedCollections.has(wu(i.dataset.featureIndex));Wl()}function n$(i){let e=KX(i);if(!e)return;let t=Zf(null,e)==="always"?"quiet":"always";t===bD(e)?O.labelOverrides.delete(e.id):O.labelOverrides.set(e.id,t),a0e(),e.kind==="point"?O.layers.pinLabels.changed():(A5(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()),Wl()}function y5(i,e){let t=Zf(null,e)==="always";i.dataset.label=t?"Hide labels":"Show labels",i.setAttribute("aria-label",`${t?"Hide":"Show"} ${e.title} labels`),i.setAttribute("aria-pressed",String(t))}function a0e(){for(let i of ge.legend.querySelectorAll("[data-label-toggle]")){let e=KX(wu(i.dataset.labelToggle));e&&y5(i,e)}}function e2(i){if(O.hiddenCollections.clear(),!i)for(let e of O.world.sections)for(let t of e.collections)O.hiddenCollections.add(t.id);dA(),Op(),Nc(),nd(),ph()}function dA(){for(let i of document.querySelectorAll("[data-collection]"))i.checked=!O.hiddenCollections.has(wu(i.dataset.collection))}function i$(i){let e=O.world.sections.find(n=>n.key===i);if(!e)return;let t=e.collections.some(n=>!O.hiddenCollections.has(n.id));for(let n of e.collections)t?O.hiddenCollections.add(n.id):O.hiddenCollections.delete(n.id);dA(),Op(),Nc(),ph()}function r$(i){if(O.world){if(l0e(i)){e2(!0);return}O.hiddenCollections.clear();for(let e of O.world.sections){let t=i.section===e.key;for(let n of e.collections)!t&&i.collection!==n.id&&O.hiddenCollections.add(n.id)}dA(),Op(),Nc(),nd(),ph()}}function l0e(i){for(let e of O.world.sections)for(let t of e.collections)if((i.section===e.key||i.collection===t.id)===O.hiddenCollections.has(t.id))return!1;return!0}function c0e(){let i=ge.soloChip;if(!O.world){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of O.world.sections){let a=0;for(let l of o.collections)O.hiddenCollections.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.collections.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function ph(){if(O.world){for(let i of O.world.sections){let e=ge.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.collections.some(t=>!O.hiddenCollections.has(t.id)))}c0e(),Wl()}}async function s$(i){let[e,t]=await Promise.all([fetch(`${O.volume.base}/worlds/${i.slug}.json`),fetch(`${O.volume.base}/worlds/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`world ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.collections||[];u0e(r,s);let o=$X(s);return{...i,grid:n.grid,lenses:n.lenses,collections:s,collectionsById:new Map(s.map(a=>[a.id,a])),attrs:n.attrs||{},merged:n.merged||[],sections:o}}function u0e(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==3)throw new Error(`location payload is version ${r}, and this reads 3`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),d=new Uint32Array(i,o+=s*4,s+1),A=new Uint16Array(i,o+=(s+1)*4,s),y=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.kind==="point"&&(S.locations=[]);for(let S=0;S<s;S++){let T=e[A[S]];if(!T||T.kind!=="point")throw new Error(`location ${a[S]} names collection ${A[S]}, which is no point collection`);T.locations.push({id:a[S],title:w.decode(y.subarray(d[S],d[S+1])),lat:l[S],lng:c[S],memberId:u[S]||void 0,shard:f[S]||void 0})}}async function TN(){let i=`${O.volume.base}/${O.world.slug}`;return O.textByWorld.has(i)||O.textByWorld.set(i,fetch(`${O.volume.base}/worlds/${O.world.slug}.text`).then(e=>e.json()).catch(()=>({}))),O.textByWorld.get(i)}var $E=null;function yA(){return $E||($E=h0e().finally(()=>{$E=null})),$E}async function h0e(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=O.volume;if(O.catalog=await i.json(),qm(ge.volume,O.catalog.volumes,"title"),w5(),!O.catalog.volumes.length)return;let t=e&&O.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=lv();await cd(n.volume||av()?.volume||O.catalog.volumes[0].slug,n.volume?n.world:void 0);return}if(t.stamp!==e.stamp){for(let r of O.textByWorld.keys())r.startsWith(e.base+"/")&&O.textByWorld.delete(r);let n=O.engine?.getView();O.restore={volume:t.slug,world:O.world?.slug,lens:O.world?O.world.lenses.indexOf(O.lens):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},await cd(t.slug,O.world?.slug);return}O.volume=t,ge.volume.value=t.slug}function w5(){let i=!O.catalog?.volumes?.length;ge.emptyState.hidden=!i,O.catalog?.bundlesDir&&(ge.emptyPath.textContent=O.catalog.bundlesDir)}async function S5(){for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await yA();let t=e.imported?.[0];t&&O.catalog.volumes.some(n=>n.slug===t)&&await cd(t)}finally{for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!1}}var vo={ADD:"add",REMOVE:"remove"};var o$={LENGTH:"length"},Av=class extends Ao{constructor(e,t,n){super(e),this.element=t,this.index=n}},T5=class extends Us{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(o$.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Av(vo.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Av(vo.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Av(vo.REMOVE,r,e)),this.dispatchEvent(new Av(vo.ADD,t,e))}updateLength_(){this.set(o$.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}},Fo=T5;var E5=class extends Ao{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Up=E5;var M5=class extends Up{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},_h=M5;var gr={SINGLECLICK:"singleclick",CLICK:nn.CLICK,DBLCLICK:nn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var t2={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var C5=class extends Cp{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=qn(n,t2.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qn(n,t2.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_,cE?{passive:!1}:!1)}emulateClick_(e){let t=new _h(gr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new _h(gr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new _h(gr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==gr.POINTERUP||t.type==gr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==gr.POINTERDOWN||t.type==gr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new _h(gr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new _h(gr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(qn(n,gr.POINTERMOVE,this.handlePointerMove_,this),qn(n,gr.POINTERUP,this.handlePointerUp_,this),qn(this.element_,gr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(qn(this.element_.getRootNode(),gr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new _h(gr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new _h(gr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(li(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},a$=C5;var xh={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Bo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var n2=1/0,R5=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,dh(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){jn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=n2?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){let l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),u=c<r&&n[c]<n[l]?c:l;t[e]=t[u],n[e]=n[u],e=u}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){let a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,s=t.length,o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==n2?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},l$=R5;var P5=class extends l${constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(nn.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===an.LOADED||n===an.ERROR||n===an.EMPTY){n!==an.ERROR&&t.removeEventListener(nn.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===an.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},c$=P5;function u$(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return n2;if(!i.wantedTiles[t][e.getKey()])return n2;let s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var so={ANIMATING:0,INTERACTING:1};var Uc={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function I5(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,d=i[0]+l/2+u,A=i[2]-l/2+u,y=i[1]+c/2+f,w=i[3]-c/2+f;d>A&&(d=(A+d)/2,A=d),y>w&&(y=(w+y)/2,w=y);let S=Si(n[0],d,A),T=Si(n[1],y,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,d-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-A)/R),T+=-R*Math.log(1+Math.max(0,y-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function h$(i){return i}function L5(i,e,t,n){let r=Kn(e)/t[0],s=Nr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function D5(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),Si(n,t/2,e*2)}function f$(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){let l=i[0],c=i[i.length-1],u=t?L5(l,t,o,n):l;if(a)return e?D5(r,u,c):Si(r,c,u);let f=Math.min(u,r),d=Math.floor(ev(i,f,s));return i[d]>u&&d<i.length-1?i[d+1]:i[d]}})}function d$(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,c){if(o!==void 0){let u=r?L5(e,r,l,s):e;if(c)return n?D5(o,u,t):Si(o,t,u);let f=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(i)-f),A=-a*(.5-f)+.5,y=Math.min(u,o),w=Math.floor(Math.log(e/y)/Math.log(i)+A),S=Math.max(d,w),T=e/Math.pow(i,S);return Si(T,t,u)}})}function N5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?L5(i,n,a,r):i;return!t||!l?Si(s,e,c):D5(s,c,e)}})}function gv(i){if(i!==void 0)return 0}function F5(i){if(i!==void 0)return i}function p$(i){let e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function m$(i){let e=i===void 0?mu(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var B5=0,U5=class extends Us{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=nE(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&ZW(),e.center&&(e.center=vu(e.center,this.projection_)),e.extent&&(e.extent=_u(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Uc)delete t[a];this.setProperties(t,!0);let n=d0e(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=f0e(e),s=n.constraint,o=p0e(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t=t||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=vu(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=vu(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let u=arguments[r];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(r===t){n&&YE(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,c=[];for(;r<t;++r){let u=arguments[r],f={start:s,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||xj,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let d=fh(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+d,l=f.targetRotation}m0e(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(so.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[so.ANIMATING]>0}getInteracting(){return this.hints_[so.INTERACTING]>0}cancelAnimations(){this.setHint(so.ANIMATING,-this.hints_[so.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&YE(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,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;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let d=l.sourceCenter[0],A=l.sourceCenter[1],y=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=d+f*(y-d),T=A+f*(w-A);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let d=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let A=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(d,0,A,!0);this.targetCenter_=this.calculateCenterZoom(y,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let d=f===1?fh(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let A=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(A,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(so.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&YE(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],X1(n,e-this.getRotation()),RW(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Ry(e,this.getProjection())}getCenterInternal(){return this.get(Uc.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return Sp(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();jn(t,"The view center is not defined");let n=this.getResolution();jn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return jn(r!==void 0,"The view rotation is not defined"),Ty(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Uc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(_u(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Kn(e)/t[0],r=Nr(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get(Uc.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=O5(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let s=ev(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=Si(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,Si(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(jn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){jn(!hh(e),"Cannot fit empty extent provided as `geometry`");let r=_u(e,this.getProjection());n=NN(r)}else if(e.getType()==="Circle"){let r=_u(e.getExtent(),this.getProjection());n=NN(r),n.rotate(this.getRotation(),dl(r))}else{let r=rA();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,d=s.length;f<d;f+=o){let A=s[f]*n-s[f+1]*r,y=s[f]*r+s[f+1]*n;a=Math.min(a,A),l=Math.min(l,y),c=Math.max(c,A),u=Math.max(u,y)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),d=dl(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;let A=d[0]*f-d[1]*u,y=d[1]*f+d[0]*u,w=this.getConstrainedCenter([A,y],l),S=t.callback?t.callback:td;t.duration!==void 0?this.animateInternal({resolution:l,center:w,duration:t.duration,easing:t.easing},S):(this.targetResolution_=l,this.targetCenter_=w,this.applyTargetState_(!1,!0),YE(S,!0))}centerOn(e,t,n){this.centerOnInternal(vu(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(O5(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s,o=this.padding_;if(o&&e){let a=this.getViewportSizeMinusPadding_(-n),l=O5(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Ry(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&vu(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=vu(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&vu(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(Uc.ROTATION)!==r&&this.set(Uc.ROTATION,r),this.get(Uc.RESOLUTION)!==o&&(this.set(Uc.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Uc.CENTER)||!eA(this.get(Uc.CENTER),a))&&this.set(Uc.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!eA(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Lc,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(so.INTERACTING,1)}endInteraction(e,t,n){n=n&&vu(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(so.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function YE(i,e){setTimeout(function(){i(e)},0)}function f0e(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return I5(i.extent,i.constrainOnlyCenter,t)}let e=nE(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,I5(t,!1,!1)}return h$}function d0e(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:B5,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,d=nE(i.projection,"EPSG:3857"),A=d.getExtent(),y=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&d.isGlobal()&&(y=!1,w=A),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=f$(S,u,!y&&w,f):e=N5(t,n,u,!y&&w,f)}else{let T=(A?Math.max(Kn(A),Nr(A)):360*Kf.degrees/d.getMetersPerUnit())/256/Math.pow(2,B5),R=T/Math.pow(2,28-B5);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=R),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=d$(l,t,n,u,!y&&w,f):e=N5(t,n,u,!y&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function p0e(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?m$():t===!1?F5:typeof t=="number"?p$(t):F5}return gv}function m0e(i){return!(i.sourceCenter&&i.targetCenter&&!eA(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function O5(i,e,t,n,r){let s=Math.cos(-r),o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;let c=a*s-l*o,u=l*s+a*o;return[c,u]}var Xl=U5;var k5=class extends Us{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)li(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==td&&this.listenerKeys.push(qn(e,xh.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},vv=k5;var z5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Np+" "+fv+(this.collapsed_&&this.collapsible_?" "+$N:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){let r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(r=>mj(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!ta(t,this.renderedAttributions_)){bj(this.ulElement_);for(let r=0,s=t.length;r<s;++r){let o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle($N),this.collapsed_?nN(this.collapseLabel_,this.label_):nN(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},A$=z5;var V5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Np+" "+fv,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Ky)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Lc}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains(Ky);!s&&n===0?this.element.classList.add(Ky):s&&n!==0&&this.element.classList.remove(Ky)}this.label_.style.transform=r}this.rotation_=n}},g$=V5;var G5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(nn.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(nn.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+" "+Np+" "+fv,A=this.element;A.className=d,A.appendChild(u),A.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:Lc})):n.setZoom(s)}}},v$=G5;function ZE(i){i=i||{};let e=new Fo;return(i.zoom===void 0||i.zoom)&&e.push(new v$(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new g$(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new A$(i.attributionOptions)),e}var q5=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},_$=q5;var H5={ACTIVE:"active"};var W5=class extends Us{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(H5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(H5.ACTIVE,e)}setMap(e){this.map_=e}};function x$(i,e,t){let n=i.getCenterInternal();if(n){let r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:yj,center:i.getConstrainedCenter(r)})}}function _v(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:Lc})}var yh=W5;var j5=class extends yh{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==gr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();_v(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},y$=j5;function i2(i){let e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}var b$=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},A0e=function(i){let e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},KE=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?A0e(i):!0},w$=Jf;var QE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(Aj&&KD&&e.ctrlKey)};var JE=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var S$=function(i){let e=i.originalEvent;return KD?e.metaKey:e.ctrlKey},T$=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},e3=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},t3=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var E$=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var X5=class extends yh{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==gr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==gr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==gr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==gr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function xv(i){let e=i.length,t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}var bh=X5;var $5=class extends bh{constructor(e){super({stopDown:ed}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:i2(JE,E$);this.condition_=e.onFocusOnly?i2(KE,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(xv(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=e.map.getView();PW(s,a.getResolution()),X1(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Lc})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},M$=$5;var Y5=class extends bh{constructor(e){e=e||{},super({stopDown:ed}),this.condition_=e.condition?e.condition:b$,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!t3(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===gv)return;let r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return t3(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return t3(e)&&QE(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},C$=Y5;var Z5=class extends Mp{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new Ah([r])}getGeometry(){return this.geometry_}},R$=Z5;var yv={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},bA=class extends Ao{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},K5=class extends bh{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new R$(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??QE,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new bA(yv.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new bA(t?yv.BOXEND:yv.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new bA(yv.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new bA(yv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new bA(yv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},P$=K5;var Q5=class extends P${constructor(e){e=e||{};let t=e.condition?e.condition:T$;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Lc})}},I$=Q5;var kp={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var J5=class extends yh{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return JE(t)&&e3(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==kp.DOWN||r==kp.LEFT||r==kp.RIGHT||r==kp.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==kp.DOWN?c=-a:r==kp.LEFT?l=-a:r==kp.RIGHT?l=a:c=a;let u=[l,c];X1(u,o.getRotation()),x$(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},L$=J5;var e6=class extends yh{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!S$(t)&&e3(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN||e.type==nn.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();_v(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},D$=e6;var g0e=40,v0e=300,_0e=3,t6=class extends yh{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;let t=e.condition?e.condition:w$;this.condition_=e.onFocusOnly?i2(KE,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(li),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(qn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),qn(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==nn.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=g0e;break;case WheelEvent.DOM_DELTA_PAGE:o*=v0e;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=n.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*_0e),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-Si(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),_v(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},N$=t6;var n6=class extends bh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=ed),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=s;let o=e.map,a=o.getView();a.getConstraints().rotation!==gv&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(xv(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},F$=n6;var i6=class extends bh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=ed),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;let l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(xv(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},B$=i6;function n3(i){i=i||{};let e=new Fo,t=new _$(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new C$),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new y$({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new M$({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new F$),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new B$({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new L$),e.push(new D$({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new N$({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new I$({duration:i.zoomDuration})),e}var Ni={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var r6=class extends Us{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ni.OPACITY]=e.opacity!==void 0?e.opacity:1,jn(typeof t[Ni.OPACITY]=="number","Layer opacity must be a number"),t[Ni.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ni.Z_INDEX]=e.zIndex,t[Ni.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ni.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ni.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ni.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=Si(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return ei()}getLayerStatesArray(e){return ei()}getExtent(){return this.get(Ni.EXTENT)}getMaxResolution(){return this.get(Ni.MAX_RESOLUTION)}getMinResolution(){return this.get(Ni.MIN_RESOLUTION)}getMinZoom(){return this.get(Ni.MIN_ZOOM)}getMaxZoom(){return this.get(Ni.MAX_ZOOM)}getOpacity(){return this.get(Ni.OPACITY)}getSourceState(){return ei()}getVisible(){return this.get(Ni.VISIBLE)}getZIndex(){return this.get(Ni.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ni.EXTENT,e)}setMaxResolution(e){this.set(Ni.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ni.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ni.MAX_ZOOM,e)}setMinZoom(e){this.set(Ni.MIN_ZOOM,e)}setOpacity(e){jn(typeof e=="number","Layer opacity must be a number"),this.set(Ni.OPACITY,e)}setVisible(e){this.set(Ni.VISIBLE,e)}setZIndex(e){this.set(Ni.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},i3=r6;var zp={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Su=class extends Ao{constructor(e,t){super(e),this.layer=t}},s6={LAYERS:"layers"},o6=class i extends i3{constructor(e){e=e||{};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(s6.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Fo(n.slice(),{unique:!0}):jn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new Fo(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(li),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(qn(e,vo.ADD,this.handleLayersAdd_,this),qn(e,vo.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(li);dh(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Su(zp.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[qn(e,xu.PROPERTYCHANGE,this.handleLayerChange_,this),qn(e,nn.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(qn(e,zp.ADDLAYER,this.handleLayerGroupAdd_,this),qn(e,zp.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Bn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Su(zp.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Su(zp.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Su(zp.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Bn(t);this.listenerKeys_[n].forEach(li),delete this.listenerKeys_[n],this.dispatchEvent(new Su(zp.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(s6.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Su(zp.REMOVELAYER,n[r]))}this.set(s6.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});let r=this.getLayerState(),s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){let l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=uh(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},r2=o6;var Oo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var a6=class extends i3{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ni.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ni.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(li(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=qn(e,nn.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof Xl?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return s2(r,t.viewState)&&(!s||Ar(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Xl?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ni.MAP,e)}getMapInternal(){return this.get(Ni.MAP)}setMap(e){this.mapPrecomposeKey_&&(li(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(li(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=qn(e,Oo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qn(this,nn.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);jn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ni.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function s2(i,e){if(!i.visible)return!1;let t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;let n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}var wA=a6;function r3(i,e,t=0,n=i.length-1,r=x0e){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),A=Math.max(t,Math.floor(e-c*f/l+d)),y=Math.min(n,Math.floor(e+(l-c)*f/l+d));r3(i,e,A,y,r)}let s=i[e],o=t,a=n;for(o2(i,t,e),r(i[n],s)>0&&o2(i,t,n);o<a;){for(o2(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?o2(i,t,a):(a++,o2(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function o2(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function x0e(i,e){return i<e?-1:i>e?1:0}var SA=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!o3(e,t))return n;let r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){let a=t.children[o],l=t.leaf?r(a):a;o3(e,l)&&(t.leaf?n.push(a):c6(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!o3(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let s=t.children[r],o=t.leaf?this.toBBox(s):s;if(o3(e,o)){if(t.leaf||c6(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=wv([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],o=[],a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){let u=y0e(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&c6(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let s=n-t+1,o=this._maxEntries,a;if(s<=o)return a=wv(e.slice(t,n+1)),bv(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=wv([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));O$(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);O$(e,u,f,l,this.compareMinY);for(let d=u;d<=f;d+=l){let A=Math.min(d+l-1,f);a.children.push(this._build(e,d,A,r-1))}}return bv(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){let c=t.children[l],u=l6(c),f=S0e(e,c)-u;f<o?(o=f,s=u<s?u:s,a=c):f===o&&u<s&&(s=u,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),l2(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){let n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);let o=this._chooseSplitIndex(n,s,r),a=wv(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,bv(n,this.toBBox),bv(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=wv([e,t]),this.data.height=e.height+1,this.data.leaf=!1,bv(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){let l=a2(e,0,a,this.toBBox),c=a2(e,a,n,this.toBBox),u=T0e(l,c),f=l6(l)+l6(c);u<s?(s=u,r=a,o=f<o?f:o):u===s&&f<o&&(o=f,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:b0e,s=e.leaf?this.compareMinY:w0e,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let s=this.toBBox,o=a2(e,0,t,s),a=a2(e,n-t,n,s),l=s3(o)+s3(a);for(let c=t;c<n-t;c++){let u=e.children[c];l2(o,e.leaf?s(u):u),l+=s3(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];l2(a,e.leaf?s(u):u),l+=s3(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)l2(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():bv(e[t],this.toBBox)}};function y0e(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function bv(i,e){a2(i,0,i.children.length,e,i)}function a2(i,e,t,n,r){r||(r=wv(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){let o=i.children[s];l2(r,i.leaf?n(o):o)}return r}function l2(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function b0e(i,e){return i.minX-e.minX}function w0e(i,e){return i.minY-e.minY}function l6(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function s3(i){return i.maxX-i.minX+(i.maxY-i.minY)}function S0e(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function T0e(i,e){let t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function c6(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function o3(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function wv(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function O$(i,e,t,n,r){let s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;let o=e+Math.ceil((t-e)/n/2)*n;r3(i,o,e,t,r),s.push(e,o,o,t)}}var EA=0,l3=0,ra=1<<EA++,ci=1<<EA++,sa=1<<EA++,La=1<<EA++,hd=1<<EA++,TA=1<<EA++,c3=Math.pow(2,EA)-1,h6={[ra]:"boolean",[ci]:"number",[sa]:"string",[La]:"color",[hd]:"number[]",[TA]:"size"},E0e=Object.keys(h6).map(Number).sort(pl);function M0e(i){return i in h6}function ud(i){let e=[];for(let t of E0e)c2(i,t)&&e.push(h6[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function c2(i,e){return(i&e)===e}function a3(i,e){return!!(i&e)}function Vp(i,e){return i===e}var $r=class{constructor(e,t){if(!M0e(e))throw new Error(`literal expressions must have a specific type, got ${ud(e)}`);this.type=e,this.value=t}},u3=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function h3(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function hs(i,e,t){switch(typeof i){case"boolean":{if(Vp(e,sa))return new $r(sa,i?"true":"false");if(!c2(e,ra))throw new Error(`got a boolean, but expected ${ud(e)}`);return new $r(ra,i)}case"number":{if(Vp(e,TA))return new $r(TA,cs(i));if(Vp(e,ra))return new $r(ra,!!i);if(Vp(e,sa))return new $r(sa,i.toString());if(!c2(e,ci))throw new Error(`got a number, but expected ${ud(e)}`);return new $r(ci,i)}case"string":{if(Vp(e,La))return new $r(La,$y(i));if(Vp(e,ra))return new $r(ra,!!i);if(!c2(e,sa))throw new Error(`got a string, but expected ${ud(e)}`);return new $r(sa,i)}default:}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return k0e(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Vp(e,TA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new $r(TA,i)}if(Vp(e,La)){if(i.length===3)return new $r(La,[...i,1]);if(i.length===4)return new $r(La,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!c2(e,hd))throw new Error(`got an array of numbers, but expected ${ud(e)}`);return new $r(hd,i)}var et={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},C0e={[et.Get]:Un(ti(1,1/0),U$),[et.Var]:R0e(),[et.Has]:Un(ti(1,1/0),U$),[et.Id]:Un(P0e,Sv),[et.Concat]:Un(ti(2,1/0),Qi(sa)),[et.GeometryType]:Un(I0e,Sv),[et.LineMetric]:Un(L0e,Sv),[et.Resolution]:Un(u6,Sv),[et.Zoom]:Un(u6,Sv),[et.Time]:Un(u6,Sv),[et.Any]:Un(ti(2,1/0),Qi(ra)),[et.All]:Un(ti(2,1/0),Qi(ra)),[et.Not]:Un(ti(1,1),Qi(ra)),[et.Equal]:Un(ti(2,2),z$()),[et.NotEqual]:Un(ti(2,2),z$()),[et.GreaterThan]:Un(ti(2,2),Qi(ci)),[et.GreaterThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.LessThan]:Un(ti(2,2),Qi(ci)),[et.LessThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.Multiply]:Un(ti(2,1/0),k$),[et.Coalesce]:Un(ti(2,1/0),k$),[et.Divide]:Un(ti(2,2),Qi(ci)),[et.Add]:Un(ti(2,1/0),Qi(ci)),[et.Subtract]:Un(ti(2,2),Qi(ci)),[et.Clamp]:Un(ti(3,3),Qi(ci)),[et.Mod]:Un(ti(2,2),Qi(ci)),[et.Pow]:Un(ti(2,2),Qi(ci)),[et.Abs]:Un(ti(1,1),Qi(ci)),[et.Floor]:Un(ti(1,1),Qi(ci)),[et.Ceil]:Un(ti(1,1),Qi(ci)),[et.Round]:Un(ti(1,1),Qi(ci)),[et.Sin]:Un(ti(1,1),Qi(ci)),[et.Cos]:Un(ti(1,1),Qi(ci)),[et.Atan]:Un(ti(1,2),Qi(ci)),[et.Sqrt]:Un(ti(1,1),Qi(ci)),[et.Match]:Un(ti(4,1/0),V$,N0e),[et.Between]:Un(ti(3,3),Qi(ci)),[et.Interpolate]:Un(ti(6,1/0),V$,F0e),[et.Case]:Un(ti(3,1/0),D0e,B0e),[et.In]:Un(ti(2,2),O0e),[et.Number]:Un(ti(1,1/0),Qi(c3)),[et.String]:Un(ti(1,1/0),Qi(c3)),[et.Array]:Un(ti(1,1/0),Qi(ci)),[et.Color]:Un(ti(1,4),Qi(ci)),[et.Band]:Un(ti(1,3),Qi(ci)),[et.Palette]:Un(ti(2,2),U0e),[et.ToString]:Un(ti(1,1),Qi(ra|ci|sa|La))};function U$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=i[s+1];switch(typeof o){case"number":{r[s]=new $r(ci,o);break}case"string":{r[s]=new $r(sa,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.set(String(o),e)}return r}function R0e(){return function(i,e,t){let n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");let r=e,s=t.inputVariables?.[n];if(s!==void 0){let o=hs(s,c3,t);if(!(o instanceof $r))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&a3(r,La)&&!a3(r,sa)?a=La:Array.isArray(s)&&s.length===2&&a3(r,TA)&&!a3(r,hd)&&(a=TA),r&=a,r===l3)throw new Error(`the type expected from the var operator (${ud(e)}) did not have any overlap with the type of the corresponding style variables (${ud(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===l3)throw new Error(`a new type expected from the var operator (${ud(e)}) did not have any overlap with the previous type expected for it (${ud(o)}), variable name: ${n}`)}return t.variables.set(n,r),new u3(r,"var",new $r(sa,n))}}function P0e(i,e,t){t.featureId=!0}function I0e(i,e,t){t.geometryType=!0}function L0e(i,e,t){t.mCoordinate=!0}function u6(i,e,t){t.mapState=!0}function Sv(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function ti(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function k$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=hs(i[s+1],e,t);r[s]=o}return r}function Qi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=hs(e[o+1],i,n);s[o]=a}return s}}function z$(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=c3;for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);o&=l.type}if(o===l3)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);s[a]=l}return s}}function D0e(i,e,t){let n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function V$(i,e,t){let n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function N0e(i,e,t){let n=i.length-1,r=hs(i[i.length-1],e,t),s=sa|ci|ra,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=hs(i[l+2],s,t);s&=c.type}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}if(s===l3)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<n-2;l+=2){try{let c=hs(i[l+2],s,t);o[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{let c=hs(i[l+3],r.type,t);o[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[hs(i[1],s,t),...o,r]}function F0e(i,e,t){let n=i[1],r;switch(n[0]){case"linear":r=1;break;case"exponential":let l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}let s=new $r(ci,r),o;try{o=hs(i[2],ci,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=hs(i[l+3],ci,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=hs(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function B0e(i,e,t){let n=hs(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=hs(i[s+1],ra,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=hs(i[s+2],n.type,t);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=n,r}function O0e(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(n[0]==="literal"){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof n[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof n[0]=="string"?r=sa:r=ci;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=hs(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[hs(i[1],r,t),...s]}function U0e(i,e,t){let n;try{n=hs(i[1],ci,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=hs(r[o],La,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof $r))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Un(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new u3(t,r,...s)}}function k0e(i,e,t){let n=i[0],r=C0e[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function f3(i){if(!i)return"";let e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return f3(i.getGeometries()[0]);default:return""}}function f6(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Eu(i,e,t){let n=hs(i,e,t);return Tu(n,t)}function Tu(i,e){if(i instanceof $r){if(i.type===La&&typeof i.value=="string"){let n=$y(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case et.Number:case et.String:case et.Coalesce:return z0e(i,e);case et.Get:case et.Var:case et.Has:return V0e(i,e);case et.Id:return n=>n.featureId;case et.GeometryType:return n=>n.geometryType;case et.Concat:{let n=i.args.map(r=>Tu(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case et.Resolution:return n=>n.resolution;case et.Any:case et.All:case et.Between:case et.In:case et.Not:return q0e(i,e);case et.Equal:case et.NotEqual:case et.LessThan:case et.LessThanOrEqualTo:case et.GreaterThan:case et.GreaterThanOrEqualTo:return G0e(i,e);case et.Multiply:case et.Divide:case et.Add:case et.Subtract:case et.Clamp:case et.Mod:case et.Pow:case et.Abs:case et.Floor:case et.Ceil:case et.Round:case et.Sin:case et.Cos:case et.Atan:case et.Sqrt:return H0e(i,e);case et.Case:return W0e(i,e);case et.Match:return j0e(i,e);case et.Interpolate:return X0e(i,e);case et.ToString:return $0e(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function z0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case et.Number:case et.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function V0e(i,e){let n=i.args[0].value;switch(i.operator){case et.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case et.Var:return r=>r.variables[n];case et.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function G0e(i,e){let t=i.operator,n=Tu(i.args[0],e),r=Tu(i.args[1],e);switch(t){case et.Equal:return s=>n(s)===r(s);case et.NotEqual:return s=>n(s)!==r(s);case et.LessThan:return s=>n(s)<r(s);case et.LessThanOrEqualTo:return s=>n(s)<=r(s);case et.GreaterThan:return s=>n(s)>r(s);case et.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function q0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case et.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case et.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case et.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case et.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function H0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case et.Divide:return s=>r[0](s)/r[1](s);case et.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case et.Subtract:return s=>r[0](s)-r[1](s);case et.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case et.Mod:return s=>r[0](s)%r[1](s);case et.Pow:return s=>Math.pow(r[0](s),r[1](s));case et.Abs:return s=>Math.abs(r[0](s));case et.Floor:return s=>Math.floor(r[0](s));case et.Ceil:return s=>Math.ceil(r[0](s));case et.Round:return s=>Math.round(r[0](s));case et.Sin:return s=>Math.sin(r[0](s));case et.Cos:return s=>Math.cos(r[0](s));case et.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case et.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function W0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function j0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function X0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),d=Array.isArray(f);if(d&&(f=mX(f)),u>=o)return c===2?f:d?Y0e(s,o,a,l,u,f):u2(s,o,a,l,u,f);a=u,l=f}return l}}function $0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);if(t===et.ToString)return s=>{let o=r[0](s);return i.args[0].type===La?Yy(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function u2(i,e,t,n,r,s){let o=r-t;if(o===0)return n;let a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function Y0e(i,e,t,n,r,s){if(r-t===0)return n;let a=WN(n),l=WN(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[u2(i,e,t,a[0],r,l[0]),u2(i,e,t,a[1],r,l[1]),a[2]+u2(i,e,t,0,r,c),u2(i,e,t,n[3],r,s[3])];return AX(u)}function Z0e(i){return!0}function K0e(i,e){e=e??h3();let t=Q0e(i,e),n=f6();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){let o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=f3(r.getGeometry())),t(n)}}function G$(i,e){e=e??h3();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=d6(i[o],e);let r=f6(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){let c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}e.geometryType&&(r.geometryType=f3(o.getGeometry()));let l=0;for(let c=0;c<t;++c){let u=n[c](r);u&&(s[l]=u,l+=1)}return s.length=l,s}}function j$(i,e){if(e=e??h3(),!Array.isArray(i))return G$([i],e);let t=i.length;if("style"in i[0]){let s=new Array(t);for(let o=0;o<t;++o){let a=i[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return K0e(s,e)}return G$(i,e)}function Q0e(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?Eu(s.filter,ra,e):Z0e,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=d6(s.style[c],e)}else a=[d6(s.style,e)];n[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<t;++a){let l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(let c of n[a].styles){let u=c(r);u&&s.push(u)}}}return s}}function d6(i,e){let t=h2(i,"",e),n=f2(i,"",e),r=J0e(i,e),s=eme(i,e),o=Uo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Au(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Xr;return function(l){let c=!0;if(t){let u=t(l);u&&(c=!1),a.setFill(u)}if(n){let u=n(l);u&&(c=!1),a.setStroke(u)}if(r){let u=r(l);u&&(c=!1),a.setText(u)}if(s){let u=s(l);u&&(c=!1),a.setImage(u)}return o&&a.setZIndex(o(l)),c?null:a}}function h2(i,e,t){let n;if(e+"fill-pattern-src"in i)n=rme(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=p3(i,e+"fill-color",t)}if(!n)return null;let r=new ks;return function(s){let o=n(s);return o===NE?null:(r.setColor(o),r)}}function f2(i,e,t){let n=Uo(i,e+"stroke-width",t),r=p3(i,e+"stroke-color",t);if(!n&&!r)return null;let s=fd(i,e+"stroke-line-cap",t),o=fd(i,e+"stroke-line-join",t),a=X$(i,e+"stroke-line-dash",t),l=Uo(i,e+"stroke-line-dash-offset",t),c=Uo(i,e+"stroke-miter-limit",t),u=Uo(i,e+"stroke-offset",t),f=new ro;return function(d){if(r){let A=r(d);if(A===NE)return null;f.setColor(A)}if(n&&f.setWidth(n(d)),s){let A=s(d);if(A!=="butt"&&A!=="round"&&A!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(A)}if(o){let A=o(d);if(A!=="bevel"&&A!=="round"&&A!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(A)}return a&&f.setLineDash(a(d)),l&&f.setLineDashOffset(l(d)),c&&f.setMiterLimit(c(d)),u&&f.setOffset(u(d)),f}}function J0e(i,e){let t="text-",n=fd(i,t+"value",e);if(!n)return null;let r=h2(i,t,e),s=h2(i,t+"background-",e),o=f2(i,t,e),a=f2(i,t+"background-",e),l=fd(i,t+"font",e),c=Uo(i,t+"max-angle",e),u=Uo(i,t+"offset-x",e),f=Uo(i,t+"offset-y",e),d=Tv(i,t+"overflow",e),A=fd(i,t+"placement",e),y=Uo(i,t+"repeat",e),w=m3(i,t+"scale",e),S=Tv(i,t+"rotate-with-view",e),T=Uo(i,t+"rotation",e),R=fd(i,t+"align",e),I=fd(i,t+"justify",e),P=fd(i,t+"baseline",e),F=Tv(i,t+"keep-upright",e),D=X$(i,t+"padding",e),L=A3(i,t+"declutter-mode"),C=new Bp({declutterMode:L});return function(B){if(C.setText(n(B)),r&&C.setFill(r(B)),s&&C.setBackgroundFill(s(B)),o&&C.setStroke(o(B)),a&&C.setBackgroundStroke(a(B)),l&&C.setFont(l(B)),c&&C.setMaxAngle(c(B)),u&&C.setOffsetX(u(B)),f&&C.setOffsetY(f(B)),d&&C.setOverflow(d(B)),A){let k=A(B);if(k!=="point"&&k!=="line")throw new Error("Expected point or line for text-placement");C.setPlacement(k)}if(y&&C.setRepeat(y(B)),w&&C.setScale(w(B)),S&&C.setRotateWithView(S(B)),T&&C.setRotation(T(B)),R){let k=R(B);if(k!=="left"&&k!=="center"&&k!=="right"&&k!=="end"&&k!=="start")throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(k)}if(I){let k=I(B);if(k!=="left"&&k!=="right"&&k!=="center")throw new Error("Expected left, right, or center for text-justify");C.setJustify(k)}if(P){let k=P(B);if(k!=="bottom"&&k!=="top"&&k!=="middle"&&k!=="alphabetic"&&k!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(k)}return D&&C.setPadding(D(B)),F&&C.setKeepUpright(F(B)),C}}function eme(i,e){return"icon-src"in i?tme(i,e):"shape-points"in i?nme(i,e):"circle-radius"in i?ime(i,e):null}function tme(i,e){let t="icon-",n=t+"src",r=$$(i[n],n),s=d3(i,t+"anchor",e),o=m3(i,t+"scale",e),a=Uo(i,t+"opacity",e),l=d3(i,t+"displacement",e),c=Uo(i,t+"rotation",e),u=Tv(i,t+"rotate-with-view",e),f=H$(i,t+"anchor-origin"),d=W$(i,t+"anchor-x-units"),A=W$(i,t+"anchor-y-units"),y=dd(i,t+"color"),w,S=null;y!==void 0&&(Array.isArray(y)&&y.length>0&&typeof y[0]=="string"?S=p3(i,t+"color",e):w=Y$(y,t+"color"));let T=ome(i,t+"cross-origin"),R=ame(i,t+"offset"),I=H$(i,t+"offset-origin"),P=p6(i,t+"width"),F=p6(i,t+"height"),D=sme(i,t+"size"),L=A3(i,t+"declutter-mode"),C={src:r,anchorOrigin:f,anchorXUnits:d,anchorYUnits:A,crossOrigin:T,offset:R,offsetOrigin:I,height:F,width:P,size:D,declutterMode:L},B=null;return function(k){if(B)S&&B.setColor(S(k));else{let z=S?S(k):w;B=new vA(z!==void 0?Object.assign({},C,{color:z}):Object.assign({},C))}return a&&B.setOpacity(a(k)),l&&B.setDisplacement(l(k)),c&&B.setRotation(c(k)),u&&B.setRotateWithView(u(k)),o&&B.setScale(o(k)),s&&B.setAnchor(s(k)),B}}function nme(i,e){let t="shape-",n=t+"points",r=t+"radius",s=m6(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Uo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Uo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=h2(i,t,e),d=f2(i,t,e),A=m3(i,t+"scale",e),y=d3(i,t+"displacement",e),w=Uo(i,t+"rotation",e),S=Tv(i,t+"rotate-with-view",e),T=p6(i,t+"angle"),R=A3(i,t+"declutter-mode"),I=new zE({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(P){return o&&I.setRadius(o(P)),c&&I.setRadius2(c(P)),f&&I.setFill(f(P)),d&&I.setStroke(d(P)),y&&I.setDisplacement(y(P)),w&&I.setRotation(w(P)),S&&I.setRotateWithView(S(P)),A&&I.setScale(A(P)),I}}function ime(i,e){let t="circle-",n=h2(i,t,e),r=f2(i,t,e),s=Uo(i,t+"radius",e),o=m3(i,t+"scale",e),a=d3(i,t+"displacement",e),l=Uo(i,t+"rotation",e),c=Tv(i,t+"rotate-with-view",e),u=A3(i,t+"declutter-mode"),f=new VE({radius:5,declutterMode:u});return function(d){return s&&f.setRadius(s(d)),n&&f.setFill(n(d)),r&&f.setStroke(r(d)),a&&f.setDisplacement(a(d)),l&&f.setRotation(l(d)),c&&f.setRotateWithView(c(d)),o&&f.setScale(o(d)),f}}function dd(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Uo(i,e,t){let n=dd(i,e);if(n===void 0)return;let r=Eu(n,ci,t);return function(s){return m6(r(s),e)}}function fd(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,sa,t);return function(s){return $$(r(s),e)}}function rme(i,e,t){let n=fd(i,e+"pattern-src",t),r=q$(i,e+"pattern-offset",t),s=q$(i,e+"pattern-size",t),o=p3(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Tv(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,ra,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function p3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,La,t);return function(s){return Y$(r(s),e)}}function X$(i,e,t){let n=dd(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Eu(o,ci,t);return function(c){return m6(l(c),`${e}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Eu(n,hd,t);return function(s){return d2(r(s),e)}}function d3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd,t);return function(s){let o=d2(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function q$(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd,t);return function(s){return Z$(r(s),e)}}function m3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Eu(n,hd|ci,t);return function(s){return lme(r(s),e)}}function p6(i,e){let t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function sme(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return cs(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function ome(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function H$(i,e){let t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function W$(i,e){let t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function ame(i,e){let t=i[e];if(t!==void 0)return d2(t,e)}function A3(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function d2(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);let t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function $$(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function m6(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function Y$(i,e){if(typeof i=="string")return i;let t=d2(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function Z$(i,e){let t=d2(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function lme(i,e){return typeof i=="number"?i:Z$(i,e)}var K$={RENDER_ORDER:"renderOrder"},A6=class extends wA{constructor(e){e=e||{};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(K$.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new SA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(K$.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?r5:e;let t=cme(e);this.styleFunction_=e===null?void 0:CX(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function cme(i){if(i===void 0)return r5;if(!i)return null;if(typeof i=="function"||i instanceof Xr)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Xr){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Xr))throw new Error("Expected a list of style instances");n[r]=s}return n}return j$(i)}var g3=A6;var g6=class extends Ao{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},v3=g6;var v6=class extends Mp{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ei()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;No(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),dE(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(P,F,D,L){return s.call(o,F,P?D:null,L)}let d=u.projection,A=YT(e.slice(),d),y=[[0,0]];if(d.canWrapX()&&r){let P=d.getExtent(),F=Kn(P);y.push([-F,0],[F,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];for(let P=0;P<y.length;P++)for(let F=S-1;F>=0;--F){let D=w[F],L=D.layer;if(L.hasRenderer()&&s2(D,u)&&a.call(l,L)){let C=L.getRenderer(),B=L.getSource();if(C&&B){let k=B.getWrapX()?A:e,z=f.bind(null,D.managed);R[0]=k[0]+y[P][0],R[1]=k[1]+y[P][1],c=C.forEachFeatureAtCoordinate(R,t,n,z,T)}if(c)return c}}if(T.length===0)return;let I=1/T.length;return T.forEach((P,F)=>P.distanceSq+=F*I),T.sort((P,F)=>P.distanceSq-F.distanceSq),T.some(P=>c=P.callback(P.feature,P.layer,P.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Jf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ei()}scheduleExpireIconCache(e){na.canExpireCache()&&e.postRenderFunctions.push(ume)}};function ume(i,e){na.expire()}var Q$=v6;var _6=class extends Q${constructor(e){super(e),this.fontChangeListenerKey_=qn(AA,xu.PROPERTYCHANGE,e.redrawText,e),this.element_=no?uE():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Np+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new v3(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){li(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Oo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof g3&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;Hl(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let d=t[u];e.layerIndex=u;let A=d.layer,y=A.getSourceState();if(!s2(d,r)||y!="ready"&&y!="undefined"){A.unrender();continue}let w=A.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(d))}this.declutter(e,l),wj(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,d=u.style.backgroundColor;if(d&&(!Hl(f)||f.width>0)&&(a.fillStyle=d,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!Hl(f)||f.width===0)continue;a.save();let A=u.style.opacity||f.style.opacity;a.globalAlpha=A===""?1:Number(A);let y=f.style.transform;if(y)a.transform(...fE(y));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(Oo.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}},J$=_6;function eY(i){if(i instanceof wA){i.setMapInternal(null);return}i instanceof r2&&i.getLayers().forEach(eY)}function tY(i,e){if(i instanceof wA){i.setMapInternal(e);return}if(i instanceof r2){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)tY(t[n],e)}}var x6=class extends Us{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=hme(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:gj,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=go(),this.pixelToCoordinateTransform_=go(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,no||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,no||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(no?new Fo:ZE()),this.interactions=t.interactions||(no?new Fo:n3({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new c$(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Bo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Bo.VIEW,this.handleViewChanged_),this.addChangeListener(Bo.SIZE,this.handleSizeChanged_),this.addChangeListener(Bo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Xl)&&e.view.then(function(r){n.setView(new Xl(r))}),this.controls.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(vo.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(vo.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){tY(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};let s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:Jf,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(r){r instanceof r2?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};let r=t.layerFilter!==void 0?t.layerFilter:Jf,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(Bo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Ry(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?jr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Bo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof Fo){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let r=e[t];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){let t=vu(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?jr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Bo.SIZE)}getView(){return this.get(Bo.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return u$(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new _h(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===t2.POINTERDOWN||n===nn.WHEEL||n===nn.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[so.ANIMATING]||o[so.INTERACTING]:!1;if(a){let l=Date.now()-e.time>8;r=l?0:8,s=l?0:2}t.getTilesLoading()<r&&(a&&t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Oo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Oo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Up(xh.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Up(xh.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)li(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(nn.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Hl(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Hl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new J$(this)),!Hl(t)){this.mapBrowserEventHandler_=new a$(this,this.moveTolerance_);for(let r in gr)this.mapBrowserEventHandler_.addEventListener(gr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(nn.WHEEL,this.boundHandleBrowserEvent_,cE?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[qn(n,nn.KEYDOWN,this.handleBrowserEvent,this),qn(n,nn.KEYPRESS,this.handleBrowserEvent,this)],!Hl(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(li(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(li(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=qn(e,xu.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qn(e,nn.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(li),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Su("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qn(e,xu.PROPERTYCHANGE,this.render,this),qn(e,nn.CHANGE,this.render,this),qn(e,"addlayer",this.handleLayerAdd_,this),qn(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){eY(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,s=null;if(t!==void 0&&HD(t)&&n&&n.isDef()){let o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Ty(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Bn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=Ty(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!hh(this.previousExtent_)&&!Km(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Up(xh.MOVESTART,this,r)),this.previousExtent_=Zm(this.previousExtent_)),this.previousExtent_&&!s.viewHints[so.ANIMATING]&&!s.viewHints[so.INTERACTING]&&!Km(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Up(xh.MOVEEND,this,s)),VT(s.extent,this.previousExtent_))),this.dispatchEvent(new Up(xh.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(xh.LOADSTART)||this.hasListener(xh.LOADEND)||this.hasListener(Oo.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Su("removelayer",t)),this.set(Bo.LAYERGROUP,e)}setSize(e){this.set(Bo.SIZE,e)}setTarget(e){this.set(Bo.TARGET,e)}setView(e){if(!e||e instanceof Xl){this.set(Bo.VIEW,e);return}this.set(Bo.VIEW,new Xl);let t=this;e.then(function(n){t.setView(new Xl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(Hl(e)){let o=e.getContext("2d").getTransform();r=e.width/o.a,s=e.height/o.d}else{let o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!HD(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&jT("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!ta(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function hme(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);let t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new r2({layers:i.layers});t[Bo.LAYERGROUP]=n,t[Bo.TARGET]=i.target,t[Bo.VIEW]=i.view instanceof Xl?i.view:new Xl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new Fo(i.controls.slice()):(jn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new Fo(i.interactions.slice()):(jn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new Fo(i.overlays.slice()):(jn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new Fo,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var nY=x6;function _3(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var fme=new Error("disposed");var dme=[256,256],y6=class extends sv{constructor(e){let t=an.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=_3(this.data_);return e?[e.width,e.height]:dme}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==an.IDLE&&this.state!==an.ERROR)return;this.state=an.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=an.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=an.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(fme),this.controller_=null),super.disposeInternal()}},b6=y6;var w6=class{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Mp&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return jn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return jn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){jn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},S6=w6;var T6=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Ly(),{get:(e,t)=>{if(typeof e[t]=="function")return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let s=t[n];if(typeof s=="function"){s(e);continue}let o=t[++n];typeof e[s]=="function"?e[s](...o):typeof o=="function"?e[s]=o(e):e[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},x3=T6;var pme=5,E6=class extends mE{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=pme,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return ei()}getData(e){return null}prepareFrame(e){return ei()}renderFrame(e,t){return ei()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Pn.LOADED||t.getState()===Pn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Pn.LOADED&&t!=Pn.ERROR&&e.addEventListener(nn.CHANGE,this.boundHandleImageChange_),t==Pn.IDLE&&(e.load(),t=e.getState()),t==Pn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},iY=E6;var C6=[],Ev=null;function mme(){Ev=Di(1,1,void 0,{willReadFrequently:!0})}var M6=class extends iY{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=go(),this.pixelTransform=go(),this.inversePixelTransform=go(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Ev||mme(),Ev.clearRect(0,0,1,1);let r;try{Ev.drawImage(e,t,n,1,1,0,0,1,1),r=Ev.getImageData(0,0,1,1).data}catch{return Ev=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n,r,s){if(Hl(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===s){let c=e,u=c.getContext("2d");if(u){this.container=e,this.context=u,this.containerReused=!0,n&&(u.fillStyle=n,u.fillRect(0,0,c.width,c.height));return}}let o=this.getLayer().getClassName(),a,l;if(e&&e.className===o&&(!n||e&&e.style.backgroundColor&&ta(Oc(e.style.backgroundColor),Oc(n)))){let c=e.firstElementChild;Hl(c)&&(l=c.getContext("2d"))}if(l&&Pj(l.canvas.style.transform,t)?(this.container=e,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=no?uE():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Di();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Pc(n),s=j1(n),o=W1(n),a=H1(n);jr(t.coordinateToPixelTransform,r),jr(t.coordinateToPixelTransform,s),jr(t.coordinateToPixelTransform,o),jr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;jr(l,r),jr(l,s),jr(l,o),jr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(Kn(n)/r*o),l=Math.round(Nr(n)/r*o);No(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),dE(this.inversePixelTransform,this.pixelTransform);let c=Rj(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,c,u,a,l),!this.containerReused){let f=this.context.canvas;f.width!=a||f.height!=l?(f.width=a,f.height=l):this.context.clearRect(0,0,a,l),c!==f.style.transform&&(f.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let s=new v3(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Oo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Oo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new x3),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Oo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Oo.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,d=-e[0]+a,A=-e[1];return No(this.tempTransform,l,c,u,f,-n,d,A)}disposeInternal(){delete this.frameState,super.disposeInternal()}},y3=M6;function R6(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;let n=i[t],r=n.has(e);return r||n.add(e),!r}function Ame(i,e,t){let n=i[t];return n?n.delete(e):!1}function rY(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=uh(e,_u(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=uh(e,r))}return e}var P6=class extends y3{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Wr(),this.tempTileRange_=new rE(0,0,0,0),this.tempTileCoord_=tv(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new S6(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new S6(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=nv(a,a.getKey(),e,t,n),c;if(s.containsKey(l))c=s.get(l);else{let u=r.viewState.projection,f=a.getProjection();if(c=a.getTile(e,t,n,r.pixelRatio,u,!f||Q1(f,u)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){let s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=jr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!du(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),d=this.getTile(u,f[1],f[2],t);if(!d||d.getState()!==an.LOADED)continue;let A=l.getOrigin(u),y=cs(l.getTileSize(u)),w=l.getResolution(u),S;if(d instanceof hE||d instanceof pE)S=d.getImage();else if(d instanceof b6){if(S=_3(d.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-A[0])/w-f[1]*y[0])),R=Math.floor(c*((A[1]-r[1])/w-f[2]*y[1])),I=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+I,R+I)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Bn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],d=a.getMapInternal(),A=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),y=o.rotation,w=y?RD(o.center,o.resolution,y,e.size):void 0;for(let S=n;S>=A;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let I=T.minX;I<=T.maxX;++I)for(let P=T.minY;P<=T.maxY;++P){if(y&&!c.tileCoordIntersectsViewport([S,I,P],w))continue;let F=this.getTile(S,I,P,e);if(!F||!R6(r,F,S))continue;let L=F.getKey();if(f[L]=!0,F.getState()===an.IDLE&&!e.tileQueue.isKeyQueued(L)){let C=tv(S,I,P,this.tempTileCoord_);e.tileQueue.enqueue([F,u,c.getTileCoordCenter(C),R])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=nv(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===an.LOADED)return u.endTransition(Bn(this)),R6(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let d=nv(l,c,n,u,f),A=!1;if(a.containsKey(d)){let y=a.peek(d);y.getState()===an.LOADED&&(R6(r,y,n),A=!0)}A||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),d=f.getZForResolution(o,u.zDirection),A=f.getResolution(d);this.updateStaleKeys(u.getKey());let y=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?_u(n.extent,s):null,this.layerExtent&&(y=uh(y,this.layerExtent));let R=A*S/2/w,I=A*T/2/w,P=[a[0]-R,a[1]-I,a[0]+R,a[1]+I],F={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let $=f.getZForResolution(r.nextResolution,u.zDirection),J=rY(e,e.nextExtent);this.enqueueTiles(e,J,$,F,D)}let L=rY(e,y);if(this.enqueueTiles(e,L,d,F,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,L,d-1,F,D-1)},0),!(d in F))return this.container;let C=Bn(this),B=e.time;for(let $ of F[d]){let J=$.getState();if(J===an.EMPTY)continue;let te=$.tileCoord;if(J===an.LOADED&&$.getAlpha(C,B)===1){$.endTransition(C);continue}if(J!==an.ERROR&&(this.renderComplete=!1),this.findStaleTile_(te,F)){Ame(F,$,d),e.animate=!0;continue}if(this.findAltTiles_(f,te,d+1,F))continue;let ve=f.getMinZoom();for(let Re=d-1;Re>=ve&&!this.findAltTiles_(f,te,Re,F);--Re);}let k=A/o*l/w,z=this.getRenderContext(e);No(this.tempTransform,S/2,T/2,k,k,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(z,e,this.layerExtent),u.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,e);let G=Object.keys(F).map(Number);G.sort(pl);let W=[],Y=[],H=[];for(let $=G.length-1;$>=0;--$){let J=G[$],te=u.getTilePixelSize(J,l,s),he=f.getResolution(J)/A,ve=te[0]*he*k,Re=te[1]*he*k,Qe=f.getTileCoordForCoordAndZ(Pc(P),J),Fe=f.getTileCoordExtent(Qe),mt=jr(this.tempTransform,[w*(Fe[0]-P[0])/A,w*(P[3]-Fe[3])/A]),Ee=w*u.getGutterForProjection(s);for(let Ve of F[J]){if(Ve.getState()!==an.LOADED)continue;let Ye=Ve.tileCoord,Mt=Qe[1]-Ye[1],Et=Math.round(mt[0]-(Mt-1)*ve),Pt=Qe[2]-Ye[2],dn=Math.round(mt[1]-(Pt-1)*Re),Gt=Math.round(mt[0]-Mt*ve),$e=Math.round(mt[1]-Pt*Re),ot=Et-Gt,nt=dn-$e,bt=J===d;if(bt&&Ve.inTransition(C)){H.push({tile:Ve,x:Gt,y:$e,w:ot,h:nt,gutter:Ee}),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve);continue}let yt=[Gt,$e,Gt+ot,$e+nt],hn=[];for(let tn=0,bn=W.length;tn<bn;++tn)J<Y[tn]&&Ar(yt,W[tn])&&hn.push(W[tn]);let en;hn.length>0&&(en=TW(yt,hn)),W.push(yt),Y.push(J),this.drawTile(Ve,e,Gt,$e,ot,nt,Ee,bt,en),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve)}}for(let $=0,J=H.length;$<J;++$){let{tile:te,x:ce,y:he,w:ve,h:Re,gutter:Qe}=H[$];this.drawTile(te,e,ce,he,ve,Re,Qe,!0,void 0)}if(this.renderedResolution=A,this.extentChanged=!this.renderedExtent_||!Km(this.renderedExtent_,P),this.renderedExtent_=P,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let $=(J,te)=>{let ce=Bn(u),he=te.wantedTiles[ce],ve=he?Object.keys(he).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push($)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof b6){if(u=_3(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),d=Bn(this),A=t.layerStatesArray[t.layerIndex],y=A.opacity*(l?e.getAlpha(d,t.time):1),w=y!==f.globalAlpha;w&&(f.save(),f.globalAlpha=y);let S=u.width-2*a,T=u.height-2*a;if(c){let R=S/s,I=T/o;for(let P=0,F=c.length;P<F;++P){let D=c[P],L=D[0],C=D[1],B=D[2]-D[0],k=D[3]-D[1];f.drawImage(u,a+(L-n)*R,a+(C-r)*I,B*R,k*I,L,C,B,k)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),y!==A.opacity?t.animate=!0:l&&e.endTransition(d)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Bn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},sY=P6;var p2={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var I6=class extends wA{constructor(e){e=e||{};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(p2.PRELOAD)}setPreload(e){this.set(p2.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(p2.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(p2.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},oY=I6;var L6=class extends oY{constructor(e){super(e)}createRenderer(){return new sY(this,{cacheSize:this.getCacheSize()})}},D6=L6;var N6=class{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},b3=N6;var m2={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},A2=[m2.FILL],wh=[m2.STROKE],pd=[m2.BEGIN_PATH],F6=[m2.CLOSE_PATH],vn=m2;var B6=class extends b3{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],du(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],d=this.tmpCoordinate_,A=!0,y,w,S;for(y=t+r;y<n;y+=r)d[0]=e[y],d[1]=e[y+1],S=zT(c,d),S!==w?(A&&(a[l++]=u,a[l++]=f,A=!1),a[l++]=d[0],a[l++]=d[1]):S===Bs.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],A=!1):A=!0,u=d[0],f=d[1],w=S;return(s&&A||y===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,d,A;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];let y=e.getEndss();A=0;for(let w=0,S=y.length;w<S;++w){let T=[];A=this.drawCustomCoordinates_(c,A,y[w],a,T),d.push(T)}this.instructions.push([vn.CUSTOM,l,d,e,n,Oy,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,d,e,r||n,Oy,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),A=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([vn.CUSTOM,l,f,e,n,Pp,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,f,e,r||n,Pp,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([vn.CUSTOM,l,u,e,n,Bc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Bc,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([vn.CUSTOM,l,u,e,n,Bc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Bc,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([vn.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==vn.END_GEOMETRY?o=t:s==vn.BEGIN_GEOMETRY&&(r[2]=t,ij(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=gl(n||io)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=gl(n||ia);let r=e.getLineCap();t.lineCap=r!==void 0?r:gh;let s=e.getLineDash();t.lineDash=s?s.slice():vl;let o=e.getLineDashOffset();t.lineDashOffset=o||_l;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:vh;let l=e.getWidth();t.lineWidth=l!==void 0?l:od;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:rd;let u=e.getOffset();t.strokeOffset=u??xX,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[vn.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[vn.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!ta(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[vn.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=VT(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;G1(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Sh=B6;var O6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!du(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||du(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},aY=O6;var U6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([vn.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],pd);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(wh),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],pd);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinates_(c,f,l[d],u,a);this.hitDetectionInstructions.push(wh),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(wh),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(wh),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(pd)}},lY=U6;var k6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=n.length;this.instructions.push(pd),this.hitDetectionInstructions.push(pd);for(let u=0;u<c;++u){let f=n[u],d=this.coordinates.length,A=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([vn.MOVE_TO_LINE_TO,d,A,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,d,A,s,!0]),l&&(this.instructions.push(F6),this.hitDetectionInstructions.push(F6)),t=f}return a&&(this.instructions.push(A2),this.hitDetectionInstructions.push(A2)),l&&(this.instructions.push(wh),this.hitDetectionInstructions.push(wh)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[vn.CIRCLE,u,a];this.instructions.push(pd,f),this.hitDetectionInstructions.push(pd,f),r.fillStyle!==void 0&&(this.instructions.push(A2),this.hitDetectionInstructions.push(A2)),r.strokeStyle!==void 0&&(this.instructions.push(wh),this.hitDetectionInstructions.push(wh)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,io]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,ia,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinatess_(c,f,l[d],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=Ip(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}},z6=k6;var V6=0,G6=1;function gme(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let d=(i-r)/l,A=(t-r)/l;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let d=(e-s)/c,A=(n-s)/c;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}return V6=u,G6=f,!0}function cY(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,d,A=0;for(let y=0,w=e.length;y<w;++y){let S=e[y],T=i[A],R=i[A+1],I=!1;for(let P=A+t;P<S;P+=t){let F=i[P],D=i[P+1];if(gme(r,s,o,a,T,R,F,D)){let L=F-T,C=D-R,B=T+V6*L,k=R+V6*C,z=T+G6*L,G=R+G6*C;u&&I&&B===f&&k===d?l.push(z,G):(u&&c.push(l.length),l.push(B,k,z,G),u=!0),f=z,d=G,I=!0}T=F,R=D}A=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function uY(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],d=e[o+r+1],A=Math.sqrt((f-c)*(f-c)+(d-u)*(d-u));if(a+=A,a>=i){let y=(i-a+A)/A,w=Lo(c,f,y),S=Lo(u,d,y);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let y=A-a,w=Lo(c,f,y/A),S=Lo(u,d,y/A);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function hY(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,d,A,y,w,S,T,R,I;for(f=t;f<n;f+=r){let P=e[f],F=e[f+1];y!==void 0&&(R=P-y,I=F-w,A=Math.sqrt(R*R+I*I),S!==void 0&&(l+=d,u=Math.acos((S*R+T*I)/(d*A)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),d=A,S=R,T=I),y=P,w=F}return l+=A,l>a?[c,f]:[s,o]}var g2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},q6=class extends Sh{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[io]={fillStyle:io},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let d=e.getExtent();if(!Ar(this.maxExtent,d))return;let A;if(u=e.getFlatCoordinates(),c=="LineString")A=[u.length];else if(c=="MultiLineString")A=e.getEnds();else if(c=="Polygon")A=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();A=[];for(let R=0,I=T.length;R<I;++R)A.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!ch(this.getBufferedMaxExtent(),d)){let T=cY(u,A,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,A=T.ends,f=2,A.length===0)return}this.beginGeometry(e,t,n);let y=o.repeat,w=y?void 0:o.textAlign,S=0;for(let T=0,R=A.length;T<R;++T){let I;y?I=uY(y*this.resolution,u,S,A[T],f):I=[u.slice(S,A[T])];for(let P=0,F=I.length;P<F;++P){let D=I[P],L=0,C=D.length;if(w==null){let k=hY(o.maxAngle,D,0,D.length,2);L=k[0],C=k[1]}for(let k=L;k<C;k+=f)a.push(D[k],D[k+1]);let B=a.length;S=A[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let d=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||d.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let P=e.getFlatInteriorPoints();u=[];for(let F=0,D=P.length;F<D;F+=3)o.overflow||d.push(P[F+2]/this.resolution),u.push(P[F],P[F+1]);if(u.length===0)return;f=2;break;default:}let A=this.appendFlatPointCoordinates(u,f);if(A===l)return;if(d&&(A-l)/2!==u.length/f){let P=l/2;d=d.filter((F,D)=>{let L=a[(P+D)*2]===u[D*f]&&a[(P+D)*2+1]===u[D*f+1];return L||--P,L})}this.saveTextStates_();let y=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=sd&&(o.scale[0]<0||o.scale[1]<0)){let P=o.padding[0],F=o.padding[1],D=o.padding[2],L=o.padding[3];o.scale[0]<0&&(F=-F,L=-L),o.scale[1]<0&&(P=-P,D=-D),S=[P,F,D,L]}let T=this.pixelRatio;this.instructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==sd?sd:S.map(function(P){return P*T}),y,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);let R=1/T,I=y?y.slice(0):null;I&&(I[1]=io),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[R,R],NaN,this.declutterMode_,this.declutterImageWithText_,S,I,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?io:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Fp,justify:t.justify,textBaseline:t.textBaseline||gA,scale:t.scale});let o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,c=g2[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,d=this.text_,A=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,A*l,d,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a&&io,r.maxAngle,l,f,s,A*l,d,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=gl(o.getColor()||io)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),R=a.getMiterLimit();s.lineCap=a.getLineCap()||gh,s.lineDash=w?w.slice():vl,s.lineDashOffset=S===void 0?_l:S,s.lineJoin=a.getLineJoin()||vh,s.lineWidth=T===void 0?od:T,s.miterLimit=R===void 0?rd:R,s.strokeStyle=gl(a.getColor()||ia)}n=this.textState_;let l=e.getFont()||UE;yX(l);let c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||gA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||sd,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),d=e.getRotateWithView(),A=e.getKeepUpright(),y=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=A===void 0?!0:A,this.textRotation_=y===void 0?0:y,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Bn(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Bn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},fY=q6;var vme={Circle:z6,Default:Sh,Image:aY,LineString:lY,Polygon:z6,Text:fY},H6=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){let n=e!==void 0?e.toString():"0",r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){let o=vme[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},dY=H6;function w3(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],d,A,y,w,S,T,R,I,P=0;for(let F=e;F<t;F+=n){y=d,w=A,S=void 0,T=void 0,F+n<t&&(S=i[F+n],T=i[F+n+1]),s&&F===e&&(y=u,w=f),s&&F===t-n&&(S=l,T=c),d=i[F],A=i[F+1],[R,I]=_me(d,A,y,w,S,T,r),o[P++]=R,o[P++]=I;for(let D=2;D<a;D++)o[P++]=i[F+D]}return o.length!=P&&(o.length=P),o}function _me(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let d=LW([i,e],[t,n],[r,s]);if(Math.cos(d)>.998)return[i+u*o,e+f*o];let A=Math.cos(d/2),y=Math.sin(d/2),w=y*a+A*l,S=-A*a+y*l,T=w*(1/y),R=S*(1/y);return[i+T*o,e+R*o]}function S3(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],d=i[o+1],A=i[o+e],y=i[o+e+1],w=(y-d)*(c-a)-(A-f)*(u-l);if(w===0)continue;let S=((A-f)*(l-d)-(y-d)*(a-f))/w,T=((c-a)*(l-d)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let R=a+S*(c-a),I=l+S*(u-l);i[n+e]=R,i[n+e+1]=I,i.splice(n+2*e,o-n-e);break}}}return i}var W6;function xme(){return W6||(W6=new Intl.Segmenter(void 0,{granularity:"grapheme"})),W6}function pY(i,e,t,n,r,s,o,a,l,c,u,f,d=!0){let A=i[e],y=i[e+1],w=0,S=0,T=0,R=0;function I(){w=A,S=y,e+=n,A=i[e],y=i[e+1],R+=T,T=Math.sqrt((A-w)*(A-w)+(y-S)*(y-S))}do I();while(e<t-n&&R+T<s);let P=T===0?0:(s-R)/T,F=Lo(w,A,P),D=Lo(S,y,P),L=e-n,C=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)I();P=T===0?0:(B-R)/T;let k=Lo(w,A,P),z=Lo(S,y,P),G=!1;if(d)if(f){let te=[F,D,k,z];xE(te,0,4,2,f,te,te),G=te[0]>te[2]}else G=F>k;let W=Math.PI,Y=[],H=L+n===e;e=L,T=0,R=C,A=i[e],y=i[e+1];let $;if(H){I(),$=Math.atan2(y-S,A-w),G&&($+=$>0?-W:W);let te=(k+F)/2,ce=(z+D)/2;return Y[0]=[te,ce,(B-s)/2,$,r],Y}r=r.replace(/\n/g," ");let J=Array.from(xme().segment(r),te=>te.segment);for(let te=0,ce=J.length;te<ce;){I();let he=Math.atan2(y-S,A-w);if(G&&(he+=he>0?-W:W),$!==void 0){let Ee=he-$;if(Ee+=Ee>W?-2*W:Ee<-W?2*W:0,Math.abs(Ee)>o)return null}$=he;let ve=te,Re=0;for(;te<ce;++te){let Ee=G?ce-te-1:te,Ve=a*l(c,J[Ee],u);if(e+n<t&&R+T<s+Re+Ve/2)break;Re+=Ve}if(te===ve)continue;let Qe=(G?J.slice(ce-te,ce-ve):J.slice(ve,te)).join("");P=T===0?0:(s+Re/2-R)/T;let Fe=Lo(w,A,P),mt=Lo(S,y,P);Y.push([Fe,mt,Re/2,he,Qe]),s+=Re}return Y}var Mv=Wr(),Gp=[],md=[],Ad=[],qp=[];function mY(i){return i[3].declutterBox}var AY=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function j6(i,e){return e==="start"?e=AY.test(i)?"right":"left":e==="end"&&(e=AY.test(i)?"left":"right"),g2[e]}function yme(i,e,t){return t>0&&i.push(`88 `,""),i.push(e,""),i}function bme(i,e,t){return t%2===0&&(i+=e),i}var X6=class{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=go(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new x3:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let s=e+t+n+r;if(this.labels_[s])return this.labels_[s];let o=r?this.strokeStates[r]:null,a=n?this.fillStates[n]:null,l=this.textStates[t],c=this.pixelRatio,u=[l.scale[0]*c,l.scale[1]*c],f=l.justify?g2[l.justify]:j6(Array.isArray(e)?e[0]:e,l.textAlign||Fp),d=r&&o.lineWidth?o.lineWidth:0,A=Array.isArray(e)?e:String(e).split(`99 `).reduce(yme,[]),{width:y,height:w,widths:S,heights:T,lineWidths:R}=SX(l,A),I=y+d,P=[],F=(I+2)*u[0],D=(w+d)*u[1],L={width:F<0?Math.floor(F):Math.ceil(F),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:P};(u[0]!=1||u[1]!=1)&&P.push("scale",u),r&&(P.push("strokeStyle",o.strokeStyle),P.push("lineWidth",d),P.push("lineCap",o.lineCap),P.push("lineJoin",o.lineJoin),P.push("miterLimit",o.miterLimit),P.push("setLineDash",[o.lineDash]),P.push("lineDashOffset",o.lineDashOffset)),n&&P.push("fillStyle",a.fillStyle),P.push("textBaseline","middle"),P.push("textAlign","center");let C=.5-f,B=f*I+C*d,k=[],z=[],G=0,W=0,Y=0,H=0,$;for(let J=0,te=A.length;J<te;J+=2){let ce=A[J];if(ce===`1010 `){W+=G,G=0,B=f*I+C*d,++H;continue}let he=A[J+1]||l.font;he!==$&&(r&&k.push("font",he),n&&z.push("font",he),$=he),G=Math.max(G,T[Y]);let ve=[ce,B+C*S[Y]+f*(S[Y]-R[H]),.5*(d+G)+W];B+=S[Y],r&&k.push("strokeText",ve),n&&z.push("fillText",ve),++Y}return Array.prototype.push.apply(P,k),Array.prototype.push.apply(P,z),this.labels_[s]=L,L}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){a*=d[0],l*=d[1];let T=n-a,R=r-l,I=s+c>e?e-c:s,P=o+u>t?t-u:o,F=y[3]+I*d[0]+y[1],D=y[0]+P*d[1]+y[2],L=T-y[3],C=R-y[0];(w||f!==0)&&(Gp[0]=L,qp[0]=L,Gp[1]=C,md[1]=C,md[0]=L+F,Ad[0]=md[0],Ad[1]=C+D,qp[1]=Ad[1]);let B;return f!==0?(B=No(go(),n,r,1,1,f,-n,-r),jr(B,Gp),jr(B,md),jr(B,Ad),jr(B,qp),ql(Math.min(Gp[0],md[0],Ad[0],qp[0]),Math.min(Gp[1],md[1],Ad[1],qp[1]),Math.max(Gp[0],md[0],Ad[0],qp[0]),Math.max(Gp[1],md[1],Ad[1],qp[1]),Mv)):ql(Math.min(L,L+F),Math.min(C,C+D),Math.max(L,L+F),Math.max(C,C+D),Mv),A&&(T=Math.round(T),R=Math.round(R)),{drawImageX:T,drawImageY:R,drawImageW:I,drawImageH:P,originX:c,originY:u,declutterBox:{minX:Mv[0],minY:Mv[1],maxX:Mv[2],maxY:Mv[3],value:S},canvasTransform:B,scale:d}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Gp,md,Ad,qp,o,a),TX(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=jr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,c=j6(Array.isArray(e)?e[0]:e,s.textAlign||Fp),u=g2[s.textBaseline||gA],f=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*s.scale[0],A=c*d+2*(.5-c)*f,y=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:A,anchorY:y}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&ta(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=ml(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),Cj(this.renderedTransform_,n));let f=0,d=r.length,A=0,y,w=[],S,T,R,I,P,F,D,L,C,B,k,z,G,W=0,Y=0,H=this.coordinateCache_,$=this.viewRotation_,J=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,te={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:$},ce=this.instructions!=r||this.overlaps?0:200,he,ve,Re,Qe;for(;f<d;){let Fe=r[f];switch(Fe[0]){case vn.BEGIN_GEOMETRY:he=Fe[1],Qe=Fe[3],he.getGeometry()?a!==void 0&&!Ar(a,Qe.getExtent())?f=Fe[2]+1:++f:f=Fe[2],c&&(c.zIndex=Fe[4]);break;case vn.BEGIN_PATH:W>ce&&(this.fill_(e),W=0),Y>ce&&(e.stroke(),Y=0),!W&&!Y&&(e.beginPath(),P=NaN,F=NaN),++f;break;case vn.CIRCLE:A=Fe[1],R=Fe[2]??0;let Ee=u[A],Ve=u[A+1],Ye=u[A+2]-R,Mt=u[A+3]-R,Et=Ye-Ee,Pt=Mt-Ve,dn=Math.sqrt(Et*Et+Pt*Pt);e.moveTo(Ee+dn,Ve),e.arc(Ee,Ve,dn,0,2*Math.PI,!0),++f;break;case vn.CLOSE_PATH:e.closePath(),++f;break;case vn.CUSTOM:A=Fe[1],y=Fe[2];let Gt=Fe[3],$e=Fe[4],ot=Fe[5];te.geometry=Gt,te.feature=he,f in H||(H[f]=[]);let nt=H[f];ot?ot(u,A,y,2,nt):(nt[0]=u[A],nt[1]=u[A+1],nt.length=2),c&&(c.zIndex=Fe[6]),$e(nt,te),++f;break;case vn.DRAW_IMAGE:A=Fe[1],y=Fe[2],C=Fe[3],S=Fe[4],T=Fe[5];let bt=Fe[6],yt=Fe[7],hn=Fe[8],en=Fe[9],tn=Fe[10],bn=Fe[11],_e=Fe[12],vi=Fe[13];I=Fe[14]||"declutter";let zn=Fe[15];if(!C&&Fe.length>=20){B=Fe[19],k=Fe[20],z=Fe[21],G=Fe[22];let Fn=this.drawLabelWithPointPlacement_(B,k,z,G);C=Fn.label,Fe[3]=C;let rs=Fe[23];S=(Fn.anchorX-rs)*this.pixelRatio,Fe[4]=S;let Lr=Fe[24];T=(Fn.anchorY-Lr)*this.pixelRatio,Fe[5]=T,bt=C.height,Fe[6]=bt,vi=C.width,Fe[13]=vi}let le;Fe.length>25&&(le=Fe[25]);let Z,Te,Ie;Fe.length>17?(Z=Fe[16],Te=Fe[17],Ie=Fe[18]):(Z=sd,Te=null,Ie=null),tn&&J?bn+=$:!tn&&!J&&(bn-=$);let Ge=0;for(;A<y;A+=2){if(le&&le[Ge++]<vi/this.pixelRatio)continue;let Fn=this.calculateImageOrLabelDimensions_(C.width,C.height,u[A],u[A+1],vi,bt,S,T,hn,en,bn,_e,s,Z,!!Te||!!Ie,he),rs=[e,t,C,Fn,yt,Te,Ie];if(l){let Lr,Fl,Sa;if(zn){let xr=y-A;if(!zn[xr]){zn[xr]={args:rs,declutterMode:I};continue}let Zs=zn[xr];Lr=Zs.args,Fl=Zs.declutterMode,delete zn[xr],Sa=mY(Lr)}let Bl,rl;if(Lr&&(Fl!=="declutter"||!l.collides(Sa))&&(Bl=!0),(I!=="declutter"||!l.collides(Fn.declutterBox))&&(rl=!0),Fl==="declutter"&&I==="declutter"){let xr=Bl&&rl;Bl=xr,rl=xr}Bl&&(Fl!=="none"&&l.insert(Sa),this.replayImageOrLabel_.apply(this,Lr)),rl&&(I!=="none"&&l.insert(Fn.declutterBox),this.replayImageOrLabel_.apply(this,rs))}else this.replayImageOrLabel_.apply(this,rs)}++f;break;case vn.DRAW_CHARS:let vt=Fe[1],Tt=Fe[2],qe=Fe[3],Je=Fe[4];G=Fe[5];let It=Fe[6],rn=Fe[7],Lt=Fe[8];z=Fe[9];let Rt=Fe[10];B=Fe[11],Array.isArray(B)&&(B=B.reduce(bme,"")),k=Fe[12];let fn=[Fe[13],Fe[13]];I=Fe[14]||"declutter";let wn=Fe[15],Dn=Fe[16],ye=this.textStates[k],wt=ye.font,Ze=[ye.scale[0]*rn,ye.scale[1]*rn],St;wt in this.widths_?St=this.widths_[wt]:(St={},this.widths_[wt]=St);let Bt=dv(u,vt,Tt,2),ut=Math.abs(Ze[0])*ZN(wt,B,St);if(Je||ut<=Bt){let Fn=this.textStates[k].textAlign,rs=(Bt-ut)*j6(B,Fn),Lr=pY(u,vt,Tt,2,B,rs,It,Math.abs(Ze[0]),ZN,wt,St,J?0:this.viewRotation_,wn);e:if(Lr){let Fl=[],Sa,Bl,rl,xr,Zs;if(z)for(Sa=0,Bl=Lr.length;Sa<Bl;++Sa){Zs=Lr[Sa],rl=Zs[4],xr=this.createLabel(rl,k,"",z),S=Zs[2]+(Ze[0]<0?-Rt:Rt)-Dn,T=qe*xr.height+(.5-qe)*2*Rt*Ze[1]/Ze[0]-Lt;let Ol=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Zs[0],Zs[1],xr.width,xr.height,S,T,0,0,Zs[3],fn,!1,sd,!1,he);if(l&&I==="declutter"&&l.collides(Ol.declutterBox))break e;Fl.push([e,t,xr,Ol,1,null,null])}if(G)for(Sa=0,Bl=Lr.length;Sa<Bl;++Sa){Zs=Lr[Sa],rl=Zs[4],xr=this.createLabel(rl,k,G,""),S=Zs[2]-Dn,T=qe*xr.height-Lt;let Ol=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Zs[0],Zs[1],xr.width,xr.height,S,T,0,0,Zs[3],fn,!1,sd,!1,he);if(l&&I==="declutter"&&l.collides(Ol.declutterBox))break e;Fl.push([e,t,xr,Ol,1,null,null])}l&&I!=="none"&&l.load(Fl.map(mY));for(let Ol=0,nh=Fl.length;Ol<nh;++Ol)this.replayImageOrLabel_.apply(this,Fl[Ol])}}++f;break;case vn.END_GEOMETRY:if(o!==void 0){he=Fe[1];let Fn=o(he,Qe,I);if(Fn)return Fn}++f;break;case vn.FILL:ce?W++:this.fill_(e),++f;break;case vn.MOVE_TO_LINE_TO:A=Fe[1],y=Fe[2],R=Fe[3];let Ce,Yt,nr;if(R){let rs=(Fe[4]??!1)||Math.abs(u[A]-u[y-2])<1e-6&&Math.abs(u[A+1]-u[y-1])<1e-6;w3(u,A,y,2,R,rs,w),S3(w,2,rs),Ce=w,Yt=0,nr=Ce.length}else Ce=u,Yt=A,nr=y;ve=Ce[Yt],Re=Ce[Yt+1],e.moveTo(ve,Re),P=ve+.5|0,F=Re+.5|0;for(let Fn=Yt+2;Fn<nr;Fn+=2)ve=Ce[Fn],Re=Ce[Fn+1],D=ve+.5|0,L=Re+.5|0,(Fn==nr-2||D!==P||L!==F)&&(e.lineTo(ve,Re),P=D,F=L);++f;break;case vn.SET_FILL_STYLE:this.alignAndScaleFill_=Fe[2],W?(this.fill_(e),W=0,Y&&(e.stroke(),Y=0)):Y&&Fe[1]&&(e.stroke(),Y=0),e.fillStyle=Fe[1],++f;break;case vn.SET_STROKE_STYLE:W&&Fe[1]&&(this.fill_(e),W=0),Y&&(e.stroke(),Y=0),this.setStrokeStyle_(e,Fe),++f;break;case vn.STROKE:ce?Y++:e.stroke(),++f;break;default:++f;break}}W&&this.fill_(e),Y&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},gY=X6;var Hp=["Polygon","Circle","LineString","Image","Text","Default"],Z6=["Image","Text"],vY=Hp.filter(i=>!Z6.includes(i)),_Y=!1,xY=!1;function wme(){let i=0,e=n=>{let r=Di(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};_Y={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],xY=!0}var Y6=class{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=go(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let s=e[n];for(let o in s){let a=s[o];r[o]=new gY(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,s,o){xY===!1&&wme(),r=Math.round(r);let a=r*2+1,l=No(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Di(a,a,null,{willReadFrequently:_Y}));let u=this.hitDetectionContext_;u.canvas.width!==a||u.canvas.height!==a?(u.canvas.width=a,u.canvas.height=a):c||u.clearRect(0,0,a,a);let f;this.renderBuffer_!==void 0&&(f=Wr(),Qm(f,e),G1(f,t*(this.renderBuffer_+r),f));let d=Sme(r),A;function y(F,D,L){let C=u.getImageData(0,0,a,a).data;for(let B=0,k=d.length;B<k;B++)if(C[d[B]]>0){if(!o||L==="none"||A!=="Image"&&A!=="Text"||o.includes(F)){let z=(d[B]-3)/4,G=r-z%a,W=r-(z/a|0),Y=s(F,D,G*G+W*W);if(Y)return Y}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(pl);let S,T,R,I,P;for(S=w.length-1;S>=0;--S){let F=w[S].toString();for(R=this.executorsByZIndex_[F],T=Hp.length-1;T>=0;--T)if(A=Hp[T],I=R[A],I!==void 0&&(P=I.executeHitDetection(u,l,n,y,f),P))return P}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return ml(a,0,8,2,e,a),a}isEmpty(){return Au(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?nj:pl),o=o||Hp;let c=Hp.length;for(let u=0,f=l.length;u<f;++u){let d=l[u].toString(),A=this.executorsByZIndex_[d];for(let y=0,w=o.length;y<w;++y){let S=o[y],T=A[S];if(T!==void 0){let R=a===null?void 0:T.getZIndexContext(),I=R?R.getContext():e,P=this.maxExtent_&&S!=="Image"&&S!=="Text";if(P&&(I.save(),this.clip(I,n)),!R||S==="Text"||S==="Image"?T.execute(I,t,n,r,s,a):R.pushFunction(F=>T.execute(F,t,n,r,s,a)),P&&I.restore(),R){R.offset();let F=l[u]*c+Hp.indexOf(S);this.deferredZIndexContexts_[F]||(this.deferredZIndexContexts_[F]=[]),this.deferredZIndexContexts_[F].push(R)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(pl);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),e[t[n]].length=0}},$6={};function Sme(i){if($6[i]!==void 0)return $6[i];let e=i*2+1,t=i*i,n=new Array(t+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){let a=s*s+o*o;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*e+(i+o))*4+3),s>0&&l.push(((i-s)*e+(i+o))*4+3),o>0&&(l.push(((i+s)*e+(i-o))*4+3),s>0&&l.push(((i-s)*e+(i-o))*4+3))}let r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return $6[i]=r,r}var yY=Y6;var K6=class extends b3{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?Jm(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=go()}drawImages_(e,t,n,r){if(!this.image_)return;let s=ml(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let u=0,f=s.length;u<f;u+=2){let d=s[u]-this.imageAnchorX_,A=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let y=d+this.imageAnchorX_,w=A+this.imageAnchorY_;No(a,y,w,1,1,c,-y,-w),o.save(),o.transform.apply(o,a),o.translate(y,w),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,A,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=ml(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<n;t+=r){let l=s[t]+this.textOffsetX_,c=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(e,t,n,r,s,o){let a=this.context_,l=ml(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let u=l.length,f=s||Math.abs(l[0]-l[u-2])<1e-6&&Math.abs(l[1]-l[u-1])<1e-6;l=w3(l,0,u,2,o,f,l),S3(l,2,f)}a.moveTo(l[0],l[1]);let c=l.length;s&&(c-=2);for(let u=2;u<c;u+=2)a.lineTo(l[u],l[u+1]);return s&&a.closePath(),n}drawRings_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o)t=this.moveToLineTo_(e,t,n[o],r,!0,s);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=$j(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(Ar(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let n=this.context_,r=e.getFlatCoordinates(),s=0,o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){let n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){let c=s[a];r=this.drawRings_(n,r,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),ta(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:Fp;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let n=e.getColor();this.fillState_={fillStyle:gl(n||io)}}if(!t)this.strokeState_=null;else{let n=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),u=s||vl,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:gh,lineDash:this.pixelRatio_===1?u:u.map(d=>d*this.pixelRatio_),lineDashOffset:(o||_l)*this.pixelRatio_,lineJoin:a!==void 0?a:vh,lineWidth:(l!==void 0?l:od)*this.pixelRatio_,miterLimit:c!==void 0?c:rd,strokeStyle:gl(n||ia),strokeOffset:(f??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let A=t.getColor();this.textFillState_={fillStyle:gl(A||io)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let A=n.getColor(),y=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),R=n.getWidth(),I=n.getMiterLimit();this.textStrokeState_={lineCap:y!==void 0?y:gh,lineDash:w||vl,lineDashOffset:S||_l,lineJoin:T!==void 0?T:vh,lineWidth:R!==void 0?R:od,miterLimit:I!==void 0?I:rd,strokeStyle:gl(A||ia)}}let r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),u=e.getText(),f=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r!==void 0?r:UE,textAlign:f!==void 0?f:Fp,textBaseline:d!==void 0?d:gA},this.text_=u!==void 0?Array.isArray(u)?u.reduce((A,y,w)=>A+=w%2?" ":y,""):u:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},bY=K6;var Mu=.5;function wY(i,e,t,n,r,s,o,a,l){let c=l?Sp(r,l):r,u=i[0]*Mu,f=i[1]*Mu,d=Di(u,f);d.imageSmoothingEnabled=!1;let A=d.canvas,y=new bY(d,Mu,r,null,o,a,l?nA(rA(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let I=1;I<=w;++I){let P=t[I-1],F=P.getStyleFunction()||n;if(!F)continue;let D=F(P,s);if(!D)continue;Array.isArray(D)||(D=[D]);let C=(I*S).toString(16).padStart(7,"#00000");for(let B=0,k=D.length;B<k;++B){let z=D[B],G=z.getGeometryFunction()(P);if(!G||!Ar(c,G.getExtent()))continue;let W=z.clone(),Y=W.getFill();Y&&Y.setColor(C);let H=W.getStroke();H&&(H.setColor(C),H.setLineDash(null)),W.setText(void 0);let $=z.getImage();if($){let he=$.getImageSize();if(!he)continue;let ve=Di(he[0],he[1],void 0,{alpha:!1}),Re=ve.canvas;ve.fillStyle=C,ve.fillRect(0,0,Re.width,Re.height),W.setImage(new vA({img:Re,anchor:$.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:$.getOrigin(),opacity:1,size:$.getSize(),scale:$.getScale(),rotation:$.getRotation(),rotateWithView:$.getRotateWithView()}))}let J=W.getZIndex()||0,te=T[J];te||(te={},T[J]=te,te.Polygon=[],te.Circle=[],te.LineString=[],te.Point=[]);let ce=G.getType();if(ce==="GeometryCollection"){let he=G.getGeometriesArrayRecursive();for(let ve=0,Re=he.length;ve<Re;++ve){let Qe=he[ve];te[Qe.getType().replace("Multi","")].push(Qe,W)}}else te[ce.replace("Multi","")].push(G,W)}}let R=Object.keys(T).map(Number).sort(pl);for(let I=0,P=R.length;I<P;++I){let F=T[R[I]];for(let D in F){let L=F[D];for(let C=0,B=L.length;C<B;C+=2){y.setStyle(L[C+1]);for(let k=0,z=e.length;k<z;++k)y.setTransform(e[k]),y.drawGeometry(L[C])}}}return d.getImageData(0,0,A.width,A.height)}function SY(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Mu),s=Math.floor(Math.round(i[1])*Mu),o=(Si(r,0,t.width-1)+Si(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Tme=.5,TY={Point:Lme,LineString:Rme,Polygon:Nme,MultiPoint:Dme,MultiLineString:Pme,MultiPolygon:Ime,GeometryCollection:Cme,Circle:Eme};function EY(i,e){return parseInt(Bn(i),10)-parseInt(Bn(e),10)}function Q6(i,e){let t=J6(i,e);return t*t}function J6(i,e){return Tme*i/e}function Eme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function e8(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let d=!0,A=c.getImageState();A==Pn.LOADED||A==Pn.ERROR?d=!1:A==Pn.IDLE&&c.load(),d&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),Mme(i,e,t,n,s,o,a),f}function Mme(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())MY(i,l,t,e,o);else{let u=TY[l.getType()];u(i,l,t,e,o,s)}}function MY(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)MY(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function Cme(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=TY[o[a].getType()];c(i,o[a],t,n,r,s)}}function Rme(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Pme(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Ime(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(o||s){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function Lme(i,e,t,n,r,s){let o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Pn.LOADED)return;let u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,c),u.drawPoint(e,n,r)}if(l){let u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(a,c),u.drawText(e,n,r)}}function Dme(i,e,t,n,r,s){let o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=Pn.LOADED)return;let f=i.getBuilder(t.getZIndex(),"Image");f.setImageStyle(o,u),f.drawMultiPoint(e,n,r)}if(c){let f=i.getBuilder(t.getZIndex(),"Text");f.setTextStyle(l,u),f.drawText(e,n,r)}}function Nme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}var t8=class extends y3{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Wr(),this.wrappedRenderedExtent_=Wr(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),A=t.pixelRatio,y=t.viewHints,w=!(y[so.ANIMATING]||y[so.INTERACTING]),S=this.context,T=Math.round(Kn(r)/a*A),R=Math.round(Nr(r)/a*A),I=f.getWrapX()&&l.canWrapX(),P=I?Kn(u):null,F=I?Math.ceil((r[2]-u[2])/P)+(this.extendX_?2:1):1,D=I?Math.floor((r[0]-u[0])/P)-(this.extendX_?1:0):0;do{let L=this.getRenderTransform(o,a,0,A,T,R,D*P);t.declutter&&(L=L.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],L,c,w,n===void 0?Hp:n?Z6:vY,n?d&&t.declutter[d]:void 0)}while(++D<F)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Di(this.context.canvas.width,this.context.canvas.height,C6))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,lA(this.context),C6.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){let n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;let r=e.viewState;this.prepareContainer(e,t);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Oo.PRERENDER)||this.getLayer().hasListener(Oo.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,e);let l=r.projection;this.clipExtent_=null;let c=!1;if(a&&n.extent&&this.clipping){let u=_u(n.extent,l);a=Ar(u,e.extent),a&&!ch(u,e.extent)&&(e.declutter?this.clipExtent_=u:(this.clipUnrotated(s,e,u),c=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),u=[],f=n[0]*Mu,d=n[1]*Mu;u.push(this.getRenderTransform(r,s,o,Mu,f,d,0).slice());let A=c.getSource(),y=a.getExtent();if(A.getWrapX()&&a.canWrapX()&&!ch(y,l)){let S=l[0],T=Kn(y),R=0,I;for(;S<y[0];)--R,I=T*R,u.push(this.getRenderTransform(r,s,o,Mu,f,d,I).slice()),S+=T;for(R=0,S=l[2];S>y[2];)++R,I=T*R,u.push(this.getRenderTransform(r,s,o,Mu,f,d,I).slice()),S-=T}let w=rA();this.hitDetectionImageData_=wY(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,Q6(s,this.renderedPixelRatio_),w?a:null)}t(SY(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;let o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},u=function(d,A,y){let w=Bn(d),S=c[w];if(S){if(S!==!0&&y<S.distanceSq){if(y===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(d,l,A);S.geometry=A,S.distanceSq=y}}else{if(y===0)return c[w]=!0,r(d,l,A);s.push(c[w]={feature:d,layer:l,geometry:A,distanceSq:y,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(d=>d.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[so.ANIMATING],s=e.viewHints[so.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=e.extent,c=e.viewState,u=c.projection,f=c.resolution,d=e.pixelRatio,A=t.getRevision(),y=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=EY);let S=c.center.slice(),T=G1(l,y*f),R=T.slice(),I=[T.slice()],P=u.getExtent(),F=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,F){let $=n.getExtent();$&&!hh($)&&(this.extendX_=$[0]<P[0]||$[2]>P[2])}if(F&&(!ch(P,e.extent)||this.extendX_)){let $=Kn(P),J=Math.max(Kn(T)/2,$),te=P[0],ce=P[2];this.extendX_&&(te-=$,ce+=$),T[0]=te-J,T[2]=ce+J,YT(S,u);let he=ID(I[0],u);he[0]<P[0]&&he[2]<P[2]?I.push([he[0]+$,he[1],he[2]+$,he[3]]):he[0]>P[0]&&he[2]>P[2]&&I.push([he[0]-$,he[1],he[2]-$,he[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===d&&this.renderedRevision_==A&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&ch(this.wrappedRenderedExtent_,T))return ta(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new dY(J6(f,d),T,f,d),L=rA(),C;if(L){for(let $=0,J=I.length;$<J;++$){let te=I[$],ce=Sp(te,u);n.loadFeatures(ce,JW(f,u),L)}C=nA(L,u)}else for(let $=0,J=I.length;$<J;++$)n.loadFeatures(I[$],f,u);let B=Q6(f,d),k=!0,z=($,J)=>{let te,ce=$.getStyleFunction()||t.getStyleFunction();if(ce&&(te=ce($,f)),te){let he=this.renderFeature($,B,te,D,C,this.getLayer().getDeclutter(),J);k=k&&!he}},G=Sp(T,u),W=n.getFeaturesInExtent(G);w&&W.sort(w);for(let $=0,J=W.length;$<J;++$)z(W[$],$);this.renderedFeatures_=W,this.ready=k;let Y=D.finish(),H=new yY(T,f,d,n.getOverlaps(),Y,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=A,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=R,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=d,this.replayGroup_=H,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,u=n.length;c<u;++c)l=e8(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=e8(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},CY=t8;var n8=class extends g3{constructor(e){super(e)}createRenderer(){return new CY(this)}},RY=n8;var Fme=!1;function Bme(i,e,t,n,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,r):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Fme,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let c=e.getType();try{let u;c=="text"||c=="json"?u=a.responseText:c=="xml"?u=a.responseXML||a.responseText:c=="arraybuffer"&&(u=a.response),u?s(e.readFeatures(u,{extent:t,featureProjection:r}),e.readProjection(u)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function i8(i,e){return function(t,n,r,s,o){Bme(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function PY(i,e){return[[-1/0,-1/0,1/0,1/0]]}var IY=go(),v2=class i{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?GT(this.flatCoordinates_):q1(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=dl(this.getExtent());this.flatInteriorPoints_=qy(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=lX(this.flatCoordinates_,this.ends_),t=CE(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=TE(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=_A(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,s=n.length;r<s;++r){let o=n[r],a=_A(e,t,o,this.stride_,.5);Do(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=Os(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=Nr(n)/Nr(t);No(IY,n[0],n[3],r,-r,0,0,0),ml(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,IY,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new i(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=lE((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);let n=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":n.length=pA(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=SE(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Gy(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,r);break;default:}return r&&(this.simplifiedGeometry_=new i(this.type_,n,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};v2.prototype.getFlatCoordinates=v2.prototype.getOrientedFlatCoordinates;var MA=v2;var r8=class{constructor(e){this.rbush_=new SA(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Bn(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Bn(a)]=l}this.rbush_.load(n)}remove(e){let t=Bn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Bn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];Km(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return Au(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return ql(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},s8=r8;var $l={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Th=class extends Ao{constructor(e,t,n){super(e),this.feature=t,this.features=n}},o8=class extends gE{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=td,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(jn(this.format_,"`format` must be set when `url` is set"),this.loader_=i8(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:PY;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new s8:null,this.loadedExtentsRtree_=new s8,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new Fo(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Bn(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Th($l.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof MA||(this.featureChangeKeys_[e]=[qn(t,nn.CHANGE,this.handleFeatureChange_,this),qn(t,xu.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof MA){let s=this.idIndex_[r];s instanceof MA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(jn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Bn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Bn(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener($l.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Th($l.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener($l.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener($l.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(vo.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(vo.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(li);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(let n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Th($l.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(r){let s=r.getGeometry();if(s instanceof MA||s.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof MA||r.intersectsExtent(e)){let s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),Au(this.nullGeometryFeatures_)||Do(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let r=WT(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return t=t||Jf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof MA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let d=Math.sqrt(a);l[0]=n-d,l[1]=r-d,l[2]=n+d,l[3]=r+d}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Bn(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Th($l.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Bn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Au(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(u){return ch(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Th($l.FEATURESLOADSTART));let u=y=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Th($l.FEATURESLOADEND,void 0,y))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Th($l.FEATURESLOADERROR))},d=!1,A=this.loader_.call(this,l,t,n,y=>d||u(y),()=>d||f());A instanceof Promise?(d=!0,A.then(y=>{this.addFeatures(y),u(y)}).catch(f)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(r){n.push(r)}),n.forEach(r=>{t.remove(r);let s=PD(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Bn(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(li),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener($l.REMOVEFEATURE)&&this.dispatchEvent(new Th($l.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){jn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(i8(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},Wp=o8;var qa={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},f0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},PM=0,hb=1,IM=2;var $8=0,d0=1,LM=2,Vc=3,zo=0,mi=1,vr=2,ps=0,Ts=1,Dh=2,Nh=3,Fh=4,Dd=5,fb=6,oo=100,db=101,pb=102,DM=103,NM=104,Nu=200,mb=201,Ab=202,gb=203,Jp=204,e0=205,vb=206,_b=207,xb=208,yb=209,bb=210,xZ=211,yZ=212,bZ=213,wZ=214,LA=0,DA=1,NA=2,Ch=3,FA=4,BA=5,OA=6,UA=7,tg=0,FM=1,BM=2,ao=0,wb=1,Sb=2,Tb=3,Eb=4,Y8=5,Mb=6,Cb=7;var Rb=300,ec=301,Gc=302,p0=303,m0=304,Bh=306,Ed=1e3,la=1001,Md=1002,Ti=1003,Pb=1004;var qc=1005;var Mi=1006,A0=1007;var Go=1008,Z8=1008,Ji=1009,Oh=1010,Uh=1011,wl=1012,Kr=1013,xi=1014,cr=1015,Wi=1016,ng=1017,ig=1018,ua=1020,rg=35902,sg=35899,u_=1021,Nd=1022,Or=1023,Vs=1026,xo=1027,Fd=1028,kh=1029,Ws=1030,zh=1031,Ib=1032,g0=1033,Vh=33776,Gh=33777,qh=33778,Hh=33779,og=35840,ag=35841,lg=35842,cg=35843,v0=36196,_0=37492,x0=37496,y0=37488,b0=37489,Wh=37490,w0=37491,S0=37808,T0=37809,E0=37810,M0=37811,C0=37812,R0=37813,P0=37814,I0=37815,L0=37816,D0=37817,N0=37818,F0=37819,B0=37820,O0=37821,U0=36492,k0=36494,z0=36495,V0=36283,G0=36284,jh=36285,q0=36286;var L2=2300,rM=2301,nM=2302,F8=2303,B8=2400,O8=2401,U8=2402;var K8=0,Q8=1,OM=2,SZ=3200;var tc=0,UM=1,ha="",Fr="srgb",t0="srgb-linear",n0="linear",kt="srgb",Lb="",kM="rg",J8="ga",eF=0,bd=7680,tF=7681,nF=7682,iF=7683,rF=34055,sF=34056,oF=5386,aF=512,lF=513,cF=514,uF=515,hF=516,fF=517,dF=518,D2=519,Db=512,h_=513,Nb=514,Xh=515,ug=516,Fb=517,Fu=518,Bb=519,i0=35044,hg=35048;var pF="300 es",ko=2e3,xl=2001,Hc={COMPUTE:"compute",RENDER:"render"};var Bd={TEXTURE_COMPARE:"depthTextureCompare"};function Ome(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function f_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function $v(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function zM(){let i=$v("canvas");return i.style.display="block",i}var LY={},Yv=null;function kA(...i){let e="THREE."+i.shift();Yv?Yv("log",e,...i):console.log(e,...i)}function TZ(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Xe(...i){i=TZ(i);let e="THREE."+i.shift();if(Yv)Yv("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ze(...i){i=TZ(i);let e="THREE."+i.shift();if(Yv)Yv("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function ni(...i){let e=i.join(" ");e in LY||(LY[e]=!0,Xe(...i))}function mF(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function EZ(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}var Ob={[LA]:DA,[NA]:OA,[FA]:UA,[Ch]:BA,[DA]:LA,[OA]:NA,[UA]:FA,[BA]:Ch},ca=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}},oa=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],DY=1234567,C2=Math.PI/180,Cd=180/Math.PI;function Mh(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(oa[i&255]+oa[i>>8&255]+oa[i>>16&255]+oa[i>>24&255]+"-"+oa[e&255]+oa[e>>8&255]+"-"+oa[e>>16&15|64]+oa[e>>24&255]+"-"+oa[t&63|128]+oa[t>>8&255]+"-"+oa[t>>16&255]+oa[t>>24&255]+oa[n&255]+oa[n>>8&255]+oa[n>>16&255]+oa[n>>24&255]).toLowerCase()}function Nn(i,e,t){return Math.max(e,Math.min(t,i))}function AF(i,e){return(i%e+e)%e}function Ume(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function kme(i,e,t){return i!==e?(t-i)/(e-i):0}function R2(i,e,t){return(1-t)*i+t*e}function zme(i,e,t,n){return R2(i,e,1-Math.exp(-t*n))}function Vme(i,e=1){return e-Math.abs(AF(i,e*2)-e)}function Gme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function qme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Hme(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Wme(i,e){return i+Math.random()*(e-i)}function jme(i){return i*(.5-Math.random())}function Xme(i){i!==void 0&&(DY=i);let e=DY+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function $me(i){return i*C2}function Yme(i){return i*Cd}function Zme(i){return(i&i-1)===0&&i!==0}function Kme(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Qme(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Jme(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),d=o((e-n)/2),A=s((n-e)/2),y=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*d,a*c);break;case"YZY":i.set(l*d,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*d,a*u,a*c);break;case"XZX":i.set(a*u,l*y,l*A,a*c);break;case"YXY":i.set(l*A,a*u,l*y,a*c);break;case"ZYZ":i.set(l*y,l*A,a*u,a*c);break;default:Xe("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Fa(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Zn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var Bu={DEG2RAD:C2,RAD2DEG:Cd,generateUUID:Mh,clamp:Nn,euclideanModulo:AF,mapLinear:Ume,inverseLerp:kme,lerp:R2,damp:zme,pingpong:Vme,smoothstep:Gme,smootherstep:qme,randInt:Hme,randFloat:Wme,randFloatSpread:jme,seededRandom:Xme,degToRad:$me,radToDeg:Yme,isPowerOfTwo:Zme,ceilPowerOfTwo:Kme,floorPowerOfTwo:Qme,setQuaternionFromProperEuler:Jme,normalize:Zn,denormalize:Fa},yF=class yF{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};yF.prototype.isVector2=!0;var Oe=yF,Gs=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],d=s[o+0],A=s[o+1],y=s[o+2],w=s[o+3];if(f!==w||l!==d||c!==A||u!==y){let S=l*d+c*A+u*y+f*w;S<0&&(d=-d,A=-A,y=-y,w=-w,S=-S);let T=1-a;if(S<.9995){let R=Math.acos(S),I=Math.sin(R);T=Math.sin(T*R)/I,a=Math.sin(a*R)/I,l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a}else{l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a;let R=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=R,c*=R,u*=R,f*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],d=s[o+1],A=s[o+2],y=s[o+3];return e[t]=a*y+u*f+l*A-c*d,e[t+1]=l*y+u*d+c*f-a*A,e[t+2]=c*y+u*A+a*d-l*f,e[t+3]=u*y-a*f-l*d-c*A,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),d=l(n/2),A=l(r/2),y=l(s/2);switch(o){case"XYZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"YXZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"ZXY":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"ZYX":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"YZX":this._x=d*u*f+c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f-d*A*y;break;case"XZY":this._x=d*u*f-c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f+d*A*y;break;default:Xe("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],d=n+a+f;if(d>0){let A=.5/Math.sqrt(d+1);this._w=.25/A,this._x=(u-l)*A,this._y=(s-c)*A,this._z=(o-r)*A}else if(n>a&&n>f){let A=2*Math.sqrt(1+n-a-f);this._w=(u-l)/A,this._x=.25*A,this._y=(r+o)/A,this._z=(s+c)/A}else if(a>f){let A=2*Math.sqrt(1+a-n-f);this._w=(s-c)/A,this._x=(r+o)/A,this._y=.25*A,this._z=(l+u)/A}else{let A=2*Math.sqrt(1+f-n-a);this._w=(o-r)/A,this._x=(s+c)/A,this._y=(l+u)/A,this._z=.25*A}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Nn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},bF=class bF{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(NY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(NY.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return a8.copy(this).projectOnVector(e),this.sub(a8)}reflect(e){return this.sub(a8.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};bF.prototype.isVector3=!0;var re=bF,a8=new re,NY=new Gs,wF=class wF{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],d=n[2],A=n[5],y=n[8],w=r[0],S=r[3],T=r[6],R=r[1],I=r[4],P=r[7],F=r[2],D=r[5],L=r[8];return s[0]=o*w+a*R+l*F,s[3]=o*S+a*I+l*D,s[6]=o*T+a*P+l*L,s[1]=c*w+u*R+f*F,s[4]=c*S+u*I+f*D,s[7]=c*T+u*P+f*L,s[2]=d*w+A*R+y*F,s[5]=d*S+A*I+y*D,s[8]=d*T+A*P+y*L,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,d=a*l-u*s,A=c*s-o*l,y=t*f+n*d+r*A;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/y;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=d*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=A*w,e[7]=(n*l-c*t)*w,e[8]=(o*t-n*s)*w,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return ni("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(l8.makeScale(e,t)),this}rotate(e){return ni("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(l8.makeRotation(-e)),this}translate(e,t){return ni("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(l8.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};wF.prototype.isMatrix3=!0;var Mn=wF,l8=new Mn,FY=new Mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),BY=new Mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function eAe(){let i={enabled:!0,workingColorSpace:t0,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===kt&&(r.r=Td(r.r),r.g=Td(r.g),r.b=Td(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===kt&&(r.r=Xv(r.r),r.g=Xv(r.g),r.b=Xv(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ha?n0:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ni("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ni("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[t0]:{primaries:e,whitePoint:n,transfer:n0,toXYZ:FY,fromXYZ:BY,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Fr},outputColorSpaceConfig:{drawingBufferColorSpace:Fr}},[Fr]:{primaries:e,whitePoint:n,transfer:kt,toXYZ:FY,fromXYZ:BY,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Fr}}}),i}var ln=eAe();function Td(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Xv(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Cv,sM=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Cv===void 0&&(Cv=$v("canvas")),Cv.width=e.width,Cv.height=e.height;let r=Cv.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Cv}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=$v("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Td(s[o]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Td(t[n]/255)*255):t[n]=Td(t[n]);return{data:t,width:e.width,height:e.height}}else return Xe("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},tAe=0,Zv=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:tAe++}),this.uuid=Mh(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(c8(r[o].image)):s.push(c8(r[o]))}else s=c8(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function c8(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?sM.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Xe("Texture: Unable to serialize Texture."),{})}var nAe=0,u8=new re,qs=class i extends ca{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=la,r=la,s=Mi,o=Go,a=Or,l=Ji,c=i.DEFAULT_ANISOTROPY,u=ha){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:nAe++}),this.uuid=Mh(),this.name="",this.source=new Zv(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Mn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(u8).x}get height(){return this.source.getSize(u8).y}get depth(){return this.source.getSize(u8).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Xe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Rb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ed:e.x=e.x-Math.floor(e.x);break;case la:e.x=e.x<0?0:1;break;case Md:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ed:e.y=e.y-Math.floor(e.y);break;case la:e.y=e.y<0?0:1;break;case Md:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};qs.DEFAULT_IMAGE=null;qs.DEFAULT_MAPPING=Rb;qs.DEFAULT_ANISOTROPY=1;var SF=class SF{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],f=l[8],d=l[1],A=l[5],y=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-d)<.01&&Math.abs(f-w)<.01&&Math.abs(y-S)<.01){if(Math.abs(u+d)<.1&&Math.abs(f+w)<.1&&Math.abs(y+S)<.1&&Math.abs(c+A+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let I=(c+1)/2,P=(A+1)/2,F=(T+1)/2,D=(u+d)/4,L=(f+w)/4,C=(y+S)/4;return I>P&&I>F?I<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(I),r=D/n,s=L/n):P>F?P<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(P),n=D/r,s=C/r):F<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(F),n=L/s,r=C/s),this.set(n,r,s,t),this}let R=Math.sqrt((S-y)*(S-y)+(f-w)*(f-w)+(d-u)*(d-u));return Math.abs(R)<.001&&(R=1),this.x=(S-y)/R,this.y=(f-w)/R,this.z=(d-u)/R,this.w=Math.acos((c+A+T-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this.w=Nn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this.w=Nn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};SF.prototype.isVector4=!0;var xn=SF,Ba=class extends ca{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Mi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new xn(0,0,e,t),this.scissorTest=!1,this.viewport=new xn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new qs(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:Mi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new Zv(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},Oa=class extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},zA=class extends qs{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ti,this.minFilter=Ti,this.wrapR=la,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var oM=class extends qs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ti,this.minFilter=Ti,this.wrapR=la,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var RM=class RM{constructor(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){let T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=a,T[13]=l,T[2]=c,T[6]=u,T[10]=f,T[14]=d,T[3]=A,T[7]=y,T[11]=w,T[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new RM().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/Rv.setFromMatrixColumn(e,0).length(),s=1/Rv.setFromMatrixColumn(e,1).length(),o=1/Rv.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=A+y*c,t[5]=d-w*c,t[9]=-a*l,t[2]=w-d*c,t[6]=y+A*c,t[10]=o*l}else if(e.order==="YXZ"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d+w*a,t[4]=y*a-A,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=A*a-y,t[6]=w+d*a,t[10]=o*l}else if(e.order==="ZXY"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d-w*a,t[4]=-o*f,t[8]=y+A*a,t[1]=A+y*a,t[5]=o*u,t[9]=w-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=y*c-A,t[8]=d*c+w,t[1]=l*f,t[5]=w*c+d,t[9]=A*c-y,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=w-d*f,t[8]=y*f+A,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=A*f+y,t[10]=d-w*f}else if(e.order==="XZY"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=d*f+w,t[5]=o*u,t[9]=A*f-y,t[2]=y*f-A,t[6]=a*u,t[10]=w*f+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(iAe,e,rAe)}lookAt(e,t,n){let r=this.elements;return Yl.subVectors(e,t),Yl.lengthSq()===0&&(Yl.z=1),Yl.normalize(),jp.crossVectors(n,Yl),jp.lengthSq()===0&&(Math.abs(n.z)===1?Yl.x+=1e-4:Yl.z+=1e-4,Yl.normalize(),jp.crossVectors(n,Yl)),jp.normalize(),T3.crossVectors(Yl,jp),r[0]=jp.x,r[4]=T3.x,r[8]=Yl.x,r[1]=jp.y,r[5]=T3.y,r[9]=Yl.y,r[2]=jp.z,r[6]=T3.z,r[10]=Yl.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],d=n[9],A=n[13],y=n[2],w=n[6],S=n[10],T=n[14],R=n[3],I=n[7],P=n[11],F=n[15],D=r[0],L=r[4],C=r[8],B=r[12],k=r[1],z=r[5],G=r[9],W=r[13],Y=r[2],H=r[6],$=r[10],J=r[14],te=r[3],ce=r[7],he=r[11],ve=r[15];return s[0]=o*D+a*k+l*Y+c*te,s[4]=o*L+a*z+l*H+c*ce,s[8]=o*C+a*G+l*$+c*he,s[12]=o*B+a*W+l*J+c*ve,s[1]=u*D+f*k+d*Y+A*te,s[5]=u*L+f*z+d*H+A*ce,s[9]=u*C+f*G+d*$+A*he,s[13]=u*B+f*W+d*J+A*ve,s[2]=y*D+w*k+S*Y+T*te,s[6]=y*L+w*z+S*H+T*ce,s[10]=y*C+w*G+S*$+T*he,s[14]=y*B+w*W+S*J+T*ve,s[3]=R*D+I*k+P*Y+F*te,s[7]=R*L+I*z+P*H+F*ce,s[11]=R*C+I*G+P*$+F*he,s[15]=R*B+I*W+P*J+F*ve,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],d=e[10],A=e[14],y=e[3],w=e[7],S=e[11],T=e[15],R=l*A-c*d,I=a*A-c*f,P=a*d-l*f,F=o*A-c*u,D=o*d-l*u,L=o*f-a*u;return t*(w*R-S*I+T*P)-n*(y*R-S*F+T*D)+r*(y*I-w*F+T*L)-s*(y*P-w*D+S*L)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],u=e[10];return t*(o*u-a*c)-n*(s*u-a*l)+r*(s*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],d=e[10],A=e[11],y=e[12],w=e[13],S=e[14],T=e[15],R=t*a-n*o,I=t*l-r*o,P=t*c-s*o,F=n*l-r*a,D=n*c-s*a,L=r*c-s*l,C=u*w-f*y,B=u*S-d*y,k=u*T-A*y,z=f*S-d*w,G=f*T-A*w,W=d*T-A*S,Y=R*W-I*G+P*z+F*k-D*B+L*C;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let H=1/Y;return e[0]=(a*W-l*G+c*z)*H,e[1]=(r*G-n*W-s*z)*H,e[2]=(w*L-S*D+T*F)*H,e[3]=(d*D-f*L-A*F)*H,e[4]=(l*k-o*W-c*B)*H,e[5]=(t*W-r*k+s*B)*H,e[6]=(S*P-y*L-T*I)*H,e[7]=(u*L-d*P+A*I)*H,e[8]=(o*G-a*k+c*C)*H,e[9]=(n*k-t*G-s*C)*H,e[10]=(y*D-w*P+T*R)*H,e[11]=(f*P-u*D-A*R)*H,e[12]=(a*B-o*z-l*C)*H,e[13]=(t*z-n*B+r*C)*H,e[14]=(w*I-y*F-S*R)*H,e[15]=(u*F-f*I+d*R)*H,this}scale(e){let t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,d=s*c,A=s*u,y=s*f,w=o*u,S=o*f,T=a*f,R=l*c,I=l*u,P=l*f,F=n.x,D=n.y,L=n.z;return r[0]=(1-(w+T))*F,r[1]=(A+P)*F,r[2]=(y-I)*F,r[3]=0,r[4]=(A-P)*D,r[5]=(1-(d+T))*D,r[6]=(S+R)*D,r[7]=0,r[8]=(y+I)*L,r[9]=(S-R)*L,r[10]=(1-(d+w))*L,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let o=Rv.set(r[0],r[1],r[2]).length(),a=Rv.set(r[4],r[5],r[6]).length(),l=Rv.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Cu.copy(this);let c=1/o,u=1/a,f=1/l;return Cu.elements[0]*=c,Cu.elements[1]*=c,Cu.elements[2]*=c,Cu.elements[4]*=u,Cu.elements[5]*=u,Cu.elements[6]*=u,Cu.elements[8]*=f,Cu.elements[9]*=f,Cu.elements[10]*=f,t.setFromRotationMatrix(Cu),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=ko,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),d=(t+e)/(t-e),A=(n+r)/(n-r),y,w;if(l)y=s/(o-s),w=o*s/(o-s);else if(a===ko)y=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===xl)y=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=f,c[9]=A,c[13]=0,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=ko,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),d=-(t+e)/(t-e),A=-(n+r)/(n-r),y,w;if(l)y=1/(o-s),w=o/(o-s);else if(a===ko)y=-2/(o-s),w=-(o+s)/(o-s);else if(a===xl)y=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=f,c[9]=0,c[13]=A,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};RM.prototype.isMatrix4=!0;var cn=RM,Rv=new re,Cu=new cn,iAe=new re(0,0,0),rAe=new re(1,1,1),jp=new re,T3=new re,Yl=new re,OY=new cn,UY=new Gs,Ua=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],d=r[6],A=r[10];switch(t){case"XYZ":this._y=Math.asin(Nn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,A),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,A),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,A),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,A),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Nn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,A));break;case"XZY":this._z=Math.asin(-Nn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,A),this._y=0);break;default:Xe("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return OY.makeRotationFromQuaternion(e),this.setFromRotationMatrix(OY,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return UY.setFromEuler(this),this.setFromQuaternion(UY,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Ua.DEFAULT_ORDER="XYZ";var Kv=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},sAe=0,kY=new re,Pv=new Gs,gd=new cn,E3=new re,_2=new re,oAe=new re,aAe=new Gs,zY=new re(1,0,0),VY=new re(0,1,0),GY=new re(0,0,1),qY={type:"added"},lAe={type:"removed"},Iv={type:"childadded",child:null},h8={type:"childremoved",child:null},lr=class i extends ca{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:sAe++}),this.uuid=Mh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new re,t=new Ua,n=new Gs,r=new re(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new cn},normalMatrix:{value:new Mn}}),this.matrix=new cn,this.matrixWorld=new cn,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Kv,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Pv.setFromAxisAngle(e,t),this.quaternion.multiply(Pv),this}rotateOnWorldAxis(e,t){return Pv.setFromAxisAngle(e,t),this.quaternion.premultiply(Pv),this}rotateX(e){return this.rotateOnAxis(zY,e)}rotateY(e){return this.rotateOnAxis(VY,e)}rotateZ(e){return this.rotateOnAxis(GY,e)}translateOnAxis(e,t){return kY.copy(e).applyQuaternion(this.quaternion),this.position.add(kY.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(zY,e)}translateY(e){return this.translateOnAxis(VY,e)}translateZ(e){return this.translateOnAxis(GY,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(gd.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?E3.copy(e):E3.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),_2.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?gd.lookAt(_2,E3,this.up):gd.lookAt(E3,_2,this.up),this.quaternion.setFromRotationMatrix(gd),r&&(gd.extractRotation(r.matrixWorld),Pv.setFromRotationMatrix(gd),this.quaternion.premultiply(Pv.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ze("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(qY),Iv.child=e,this.dispatchEvent(Iv),Iv.child=null):ze("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(lAe),h8.child=e,this.dispatchEvent(h8),h8.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),gd.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),gd.multiply(e.parent.matrixWorld)),e.applyMatrix4(gd),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(qY),Iv.child=e,this.dispatchEvent(Iv),Iv.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_2,e,oAe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_2,aAe,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let s=this.children;for(let o=0,a=s.length;o<a;o++)s[o].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),f=o(e.shapes),d=o(e.skeletons),A=o(e.animations),y=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),d.length>0&&(n.skeletons=d),A.length>0&&(n.animations=A),y.length>0&&(n.nodes=y)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}};lr.DEFAULT_UP=new re(0,1,0);lr.DEFAULT_MATRIX_AUTO_UPDATE=!0;lr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Br=class extends lr{constructor(){super(),this.isGroup=!0,this.type="Group"}},cAe={type:"move"},r0=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Br,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Br,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new re,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new re),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Br,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new re,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new re,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(let w of e.hand.values()){let S=t.getJointPose(w,n),T=this._getHandJoint(c,w);S!==null&&(T.matrix.fromArray(S.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.matrixWorldNeedsUpdate=!0,T.jointRadius=S.radius),T.visible=S!==null}let u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],d=u.position.distanceTo(f.position),A=.02,y=.005;c.inputState.pinching&&d>A+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=A-y&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(cAe)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Br;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},MZ={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Xp={h:0,s:0,l:0},M3={h:0,s:0,l:0};function f8(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var zt=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Fr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ln.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ln.workingColorSpace){return this.r=e,this.g=t,this.b=n,ln.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ln.workingColorSpace){if(e=AF(e,1),t=Nn(t,0,1),n=Nn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=f8(o,s,e+1/3),this.g=f8(o,s,e),this.b=f8(o,s,e-1/3)}return ln.colorSpaceToWorking(this,r),this}setStyle(e,t=Fr){function n(s){s!==void 0&&parseFloat(s)<1&&Xe("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Xe("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);Xe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Fr){let n=MZ[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Xe("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Td(e.r),this.g=Td(e.g),this.b=Td(e.b),this}copyLinearToSRGB(e){return this.r=Xv(e.r),this.g=Xv(e.g),this.b=Xv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Fr){return ln.workingToColorSpace(aa.copy(this),e),Math.round(Nn(aa.r*255,0,255))*65536+Math.round(Nn(aa.g*255,0,255))*256+Math.round(Nn(aa.b*255,0,255))}getHexString(e=Fr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ln.workingColorSpace){ln.workingToColorSpace(aa.copy(this),t);let n=aa.r,r=aa.g,s=aa.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=ln.workingColorSpace){return ln.workingToColorSpace(aa.copy(this),t),e.r=aa.r,e.g=aa.g,e.b=aa.b,e}getStyle(e=Fr){ln.workingToColorSpace(aa.copy(this),e);let t=aa.r,n=aa.g,r=aa.b;return e!==Fr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(Xp),this.setHSL(Xp.h+e,Xp.s+t,Xp.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Xp),e.getHSL(M3);let n=R2(Xp.h,M3.h,t),r=R2(Xp.s,M3.s,t),s=R2(Xp.l,M3.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},aa=new zt;zt.NAMES=MZ;var s0=class extends lr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ua,this.environmentIntensity=1,this.environmentRotation=new Ua,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Ru=new re,vd=new re,d8=new re,_d=new re,Lv=new re,Dv=new re,HY=new re,p8=new re,m8=new re,A8=new re,g8=new xn,v8=new xn,_8=new xn,wd=class i{constructor(e=new re,t=new re,n=new re){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Ru.subVectors(e,t),r.cross(Ru);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Ru.subVectors(r,t),vd.subVectors(n,t),d8.subVectors(e,t);let o=Ru.dot(Ru),a=Ru.dot(vd),l=Ru.dot(d8),c=vd.dot(vd),u=vd.dot(d8),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let d=1/f,A=(c*l-a*u)*d,y=(o*u-a*l)*d;return s.set(1-A-y,y,A)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,_d)===null?!1:_d.x>=0&&_d.y>=0&&_d.x+_d.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,_d)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,_d.x),l.addScaledVector(o,_d.y),l.addScaledVector(a,_d.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return g8.setScalar(0),v8.setScalar(0),_8.setScalar(0),g8.fromBufferAttribute(e,t),v8.fromBufferAttribute(e,n),_8.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(g8,s.x),o.addScaledVector(v8,s.y),o.addScaledVector(_8,s.z),o}static isFrontFacing(e,t,n,r){return Ru.subVectors(n,t),vd.subVectors(e,t),Ru.cross(vd).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ru.subVectors(this.c,this.b),vd.subVectors(this.a,this.b),Ru.cross(vd).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;Lv.subVectors(r,n),Dv.subVectors(s,n),p8.subVectors(e,n);let l=Lv.dot(p8),c=Dv.dot(p8);if(l<=0&&c<=0)return t.copy(n);m8.subVectors(e,r);let u=Lv.dot(m8),f=Dv.dot(m8);if(u>=0&&f<=u)return t.copy(r);let d=l*f-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Lv,o);A8.subVectors(e,s);let A=Lv.dot(A8),y=Dv.dot(A8);if(y>=0&&A<=y)return t.copy(s);let w=A*c-l*y;if(w<=0&&c>=0&&y<=0)return a=c/(c-y),t.copy(n).addScaledVector(Dv,a);let S=u*y-A*f;if(S<=0&&f-u>=0&&A-y>=0)return HY.subVectors(s,r),a=(f-u)/(f-u+(A-y)),t.copy(r).addScaledVector(HY,a);let T=1/(S+w+d);return o=w*T,a=d*T,t.copy(n).addScaledVector(Lv,o).addScaledVector(Dv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ka=class{constructor(e=new re(1/0,1/0,1/0),t=new re(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Pu.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Pu.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Pu.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Pu):Pu.fromBufferAttribute(s,o),Pu.applyMatrix4(e.matrixWorld),this.expandByPoint(Pu);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),C3.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),C3.copy(n.boundingBox)),C3.applyMatrix4(e.matrixWorld),this.union(C3)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Pu),Pu.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(x2),R3.subVectors(this.max,x2),Nv.subVectors(e.a,x2),Fv.subVectors(e.b,x2),Bv.subVectors(e.c,x2),$p.subVectors(Fv,Nv),Yp.subVectors(Bv,Fv),CA.subVectors(Nv,Bv);let t=[0,-$p.z,$p.y,0,-Yp.z,Yp.y,0,-CA.z,CA.y,$p.z,0,-$p.x,Yp.z,0,-Yp.x,CA.z,0,-CA.x,-$p.y,$p.x,0,-Yp.y,Yp.x,0,-CA.y,CA.x,0];return!x8(t,Nv,Fv,Bv,R3)||(t=[1,0,0,0,1,0,0,0,1],!x8(t,Nv,Fv,Bv,R3))?!1:(P3.crossVectors($p,Yp),t=[P3.x,P3.y,P3.z],x8(t,Nv,Fv,Bv,R3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pu).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Pu).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(xd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),xd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),xd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),xd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),xd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),xd[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),xd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),xd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(xd),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},xd=[new re,new re,new re,new re,new re,new re,new re,new re],Pu=new re,C3=new ka,Nv=new re,Fv=new re,Bv=new re,$p=new re,Yp=new re,CA=new re,x2=new re,R3=new re,P3=new re,RA=new re;function x8(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){RA.fromArray(i,s);let a=r.x*Math.abs(RA.x)+r.y*Math.abs(RA.y)+r.z*Math.abs(RA.z),l=e.dot(RA),c=t.dot(RA),u=n.dot(RA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Sd=uAe();function uAe(){let i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}let s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Zl(i){Math.abs(i)>65504&&Xe("DataUtils.toHalfFloat(): Value out of range."),i=Nn(i,-65504,65504),Sd.floatView[0]=i;let e=Sd.uint32View[0],t=e>>23&511;return Sd.baseTable[t]+((e&8388607)>>Sd.shiftTable[t])}function I3(i){let e=i>>10;return Sd.uint32View[0]=Sd.mantissaTable[Sd.offsetTable[e]+(i&1023)]+Sd.exponentTable[e],Sd.floatView[0]}var zs=new re,L3=new Oe,hAe=0,Hi=class extends ca{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:hAe++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=i0,this.updateRanges=[],this.gpuType=cr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)L3.fromBufferAttribute(this,t),L3.applyMatrix3(e),this.setXY(t,L3.x,L3.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.applyMatrix3(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.applyMatrix4(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.applyNormalMatrix(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)zs.fromBufferAttribute(this,t),zs.transformDirection(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==i0&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var VA=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var GA=class extends Hi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},Qv=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=I3(this.array[e*this.itemSize]);return this.normalized&&(t=Fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=Zl(t),this}getY(e){let t=I3(this.array[e*this.itemSize+1]);return this.normalized&&(t=Fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=Zl(t),this}getZ(e){let t=I3(this.array[e*this.itemSize+2]);return this.normalized&&(t=Fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=Zl(t),this}getW(e){let t=I3(this.array[e*this.itemSize+3]);return this.normalized&&(t=Fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=Zl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this.array[e+2]=Zl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this.array[e+2]=Zl(r),this.array[e+3]=Zl(s),this}},Ln=class extends Hi{constructor(e,t,n){super(new Float32Array(e),t,n)}},fAe=new ka,y2=new re,y8=new re,yl=class{constructor(e=new re,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):fAe.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;y2.subVectors(e,this.center);let t=y2.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(y2,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(y8.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(y2.copy(e.center).add(y8)),this.expandByPoint(y2.copy(e.center).sub(y8))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},dAe=0,kc=new cn,b8=new lr,Ov=new re,Kl=new ka,b2=new ka,_o=new re,Xn=class i extends ca{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:dAe++}),this.uuid=Mh(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Ome(e)?GA:VA)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Mn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return kc.makeRotationFromQuaternion(e),this.applyMatrix4(kc),this}rotateX(e){return kc.makeRotationX(e),this.applyMatrix4(kc),this}rotateY(e){return kc.makeRotationY(e),this.applyMatrix4(kc),this}rotateZ(e){return kc.makeRotationZ(e),this.applyMatrix4(kc),this}translate(e,t,n){return kc.makeTranslation(e,t,n),this.applyMatrix4(kc),this}scale(e,t,n){return kc.makeScale(e,t,n),this.applyMatrix4(kc),this}lookAt(e){return b8.lookAt(e),b8.updateMatrix(),this.applyMatrix4(b8.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ov).negate(),this.translate(Ov.x,Ov.y,Ov.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Ln(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Xe("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ka);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new re(-1/0,-1/0,-1/0),new re(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];Kl.setFromBufferAttribute(s),this.morphTargetsRelative?(_o.addVectors(this.boundingBox.min,Kl.min),this.boundingBox.expandByPoint(_o),_o.addVectors(this.boundingBox.max,Kl.max),this.boundingBox.expandByPoint(_o)):(this.boundingBox.expandByPoint(Kl.min),this.boundingBox.expandByPoint(Kl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ze('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yl);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new re,1/0);return}if(e){let n=this.boundingSphere.center;if(Kl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];b2.setFromBufferAttribute(a),this.morphTargetsRelative?(_o.addVectors(Kl.min,b2.min),Kl.expandByPoint(_o),_o.addVectors(Kl.max,b2.max),Kl.expandByPoint(_o)):(Kl.expandByPoint(b2.min),Kl.expandByPoint(b2.max))}Kl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)_o.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(_o));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)_o.fromBufferAttribute(a,c),l&&(Ov.fromBufferAttribute(e,c),_o.add(Ov)),r=Math.max(r,n.distanceToSquared(_o))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&ze('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){ze("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Hi(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let C=0;C<n.count;C++)a[C]=new re,l[C]=new re;let c=new re,u=new re,f=new re,d=new Oe,A=new Oe,y=new Oe,w=new re,S=new re;function T(C,B,k){c.fromBufferAttribute(n,C),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,k),d.fromBufferAttribute(s,C),A.fromBufferAttribute(s,B),y.fromBufferAttribute(s,k),u.sub(c),f.sub(c),A.sub(d),y.sub(d);let z=1/(A.x*y.y-y.x*A.y);isFinite(z)&&(w.copy(u).multiplyScalar(y.y).addScaledVector(f,-A.y).multiplyScalar(z),S.copy(f).multiplyScalar(A.x).addScaledVector(u,-y.x).multiplyScalar(z),a[C].add(w),a[B].add(w),a[k].add(w),l[C].add(S),l[B].add(S),l[k].add(S))}let R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)T(e.getX(W+0),e.getX(W+1),e.getX(W+2))}let I=new re,P=new re,F=new re,D=new re;function L(C){F.fromBufferAttribute(r,C),D.copy(F);let B=a[C];I.copy(B),I.sub(F.multiplyScalar(F.dot(B))).normalize(),P.crossVectors(D,B);let z=P.dot(l[C])<0?-1:1;o.setXYZW(C,I.x,I.y,I.z,z)}for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)L(e.getX(W+0)),L(e.getX(W+1)),L(e.getX(W+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Hi(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,A=n.count;d<A;d++)n.setXYZ(d,0,0,0);let r=new re,s=new re,o=new re,a=new re,l=new re,c=new re,u=new re,f=new re;if(e)for(let d=0,A=e.count;d<A;d+=3){let y=e.getX(d+0),w=e.getX(d+1),S=e.getX(d+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,y),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(y,a.x,a.y,a.z),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,c.x,c.y,c.z)}else for(let d=0,A=t.count;d<A;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)_o.fromBufferAttribute(e,t),_o.normalize(),e.setXYZ(t,_o.x,_o.y,_o.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,d=new c.constructor(l.length*u),A=0,y=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?A=l[w]*a.data.stride+a.offset:A=l[w]*u;for(let T=0;T<u;T++)d[y++]=c[A++]}return new Hi(d,u,f)}if(this.index===null)return Xe("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let d=c[u],A=e(d,n);l.push(A)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,d=c.length;f<d;f++){let A=c[f];u.push(A.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let d=0,A=f.length;d<A;d++)u.push(f[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Rd=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=i0,this.updateRanges=[],this.version=0,this.uuid=Mh()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Mh()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Mh()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},Da=new re,Vo=class i{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.applyMatrix4(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.applyNormalMatrix(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.transformDirection(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Fa(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Fa(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Fa(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Fa(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){kA("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Hi(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){kA("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},pAe=0,Hs=class extends ca{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pAe++}),this.uuid=Mh(),this.name="",this.type="Material",this.blending=Ts,this.side=zo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Jp,this.blendDst=e0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new zt(0,0,0),this.blendAlpha=0,this.depthFunc=Ch,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=D2,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=bd,this.stencilZFail=bd,this.stencilZPass=bd,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){Xe(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ts&&(n.blending=this.blending),this.side!==zo&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Jp&&(n.blendSrc=this.blendSrc),this.blendDst!==e0&&(n.blendDst=this.blendDst),this.blendEquation!==oo&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ch&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==D2&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==bd&&(n.stencilFail=this.stencilFail),this.stencilZFail!==bd&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==bd&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new zt().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Rh=class extends Hs{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new zt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Uv,w2=new re,kv=new re,zv=new re,Vv=new Oe,S2=new Oe,CZ=new cn,D3=new re,T2=new re,N3=new re,WY=new Oe,w8=new Oe,jY=new Oe,qA=class extends lr{constructor(e=new Rh){if(super(),this.isSprite=!0,this.type="Sprite",Uv===void 0){Uv=new Xn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Rd(t,5);Uv.setIndex([0,1,2,0,2,3]),Uv.setAttribute("position",new Vo(n,3,0,!1)),Uv.setAttribute("uv",new Vo(n,2,3,!1))}this.geometry=Uv,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&ze('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),kv.setFromMatrixScale(this.matrixWorld),CZ.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),zv.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&kv.multiplyScalar(-zv.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;F3(D3.set(-.5,-.5,0),zv,o,kv,r,s),F3(T2.set(.5,-.5,0),zv,o,kv,r,s),F3(N3.set(.5,.5,0),zv,o,kv,r,s),WY.set(0,0),w8.set(1,0),jY.set(1,1);let a=e.ray.intersectTriangle(D3,T2,N3,!1,w2);if(a===null&&(F3(T2.set(-.5,.5,0),zv,o,kv,r,s),w8.set(0,1),a=e.ray.intersectTriangle(D3,N3,T2,!1,w2),a===null))return;let l=e.ray.origin.distanceTo(w2);l<e.near||l>e.far||t.push({distance:l,point:w2.clone(),uv:wd.getInterpolation(w2,D3,T2,N3,WY,w8,jY,new Oe),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function F3(i,e,t,n,r,s){Vv.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(S2.x=s*Vv.x-r*Vv.y,S2.y=r*Vv.x+s*Vv.y):S2.copy(Vv),i.copy(e),i.x+=S2.x,i.y+=S2.y,i.applyMatrix4(CZ)}var yd=new re,S8=new re,B3=new re,Zp=new re,T8=new re,O3=new re,E8=new re,Pd=class{constructor(e=new re,t=new re(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,yd)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=yd.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(yd.copy(this.origin).addScaledVector(this.direction,t),yd.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){S8.copy(e).add(t).multiplyScalar(.5),B3.copy(t).sub(e).normalize(),Zp.copy(this.origin).sub(S8);let s=e.distanceTo(t)*.5,o=-this.direction.dot(B3),a=Zp.dot(this.direction),l=-Zp.dot(B3),c=Zp.lengthSq(),u=Math.abs(1-o*o),f,d,A,y;if(u>0)if(f=o*l-a,d=o*a-l,y=s*u,f>=0)if(d>=-y)if(d<=y){let w=1/u;f*=w,d*=w,A=f*(f+o*d+2*a)+d*(o*f+d+2*l)+c}else d=s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d=-s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d<=-y?(f=Math.max(0,-(-o*s+a)),d=f>0?-s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c):d<=y?(f=0,d=Math.min(Math.max(-s,-l),s),A=d*(d+2*l)+c):(f=Math.max(0,-(o*s+a)),d=f>0?s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c);else d=o>0?-s:s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(S8).addScaledVector(B3,d),A}intersectSphere(e,t){yd.subVectors(e.center,this.origin);let n=yd.dot(this.direction),r=yd.dot(yd)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-d.z)*f,l=(e.max.z-d.z)*f):(a=(e.max.z-d.z)*f,l=(e.min.z-d.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,yd)!==null}intersectTriangle(e,t,n,r,s){T8.subVectors(t,e),O3.subVectors(n,e),E8.crossVectors(T8,O3);let o=this.direction.dot(E8),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Zp.subVectors(this.origin,e);let l=a*this.direction.dot(O3.crossVectors(Zp,O3));if(l<0)return null;let c=a*this.direction.dot(T8.cross(Zp));if(c<0||l+c>o)return null;let u=-a*Zp.dot(E8);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},fs=class extends Hs{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=tg,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},XY=new cn,PA=new Pd,U3=new yl,$Y=new re,k3=new re,z3=new re,V3=new re,M8=new re,G3=new re,YY=new re,q3=new re,Hn=class extends lr{constructor(e=new Xn,t=new fs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let a=this.morphTargetInfluences;if(s&&a){G3.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(M8.fromBufferAttribute(f,e),o?G3.addScaledVector(M8,u):G3.addScaledVector(M8.sub(t),u))}t.add(G3)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),U3.copy(n.boundingSphere),U3.applyMatrix4(s),PA.copy(e.ray).recast(e.near),!(U3.containsPoint(PA.origin)===!1&&(PA.intersectSphere(U3,$Y)===null||PA.origin.distanceToSquared($Y)>(e.far-e.near)**2))&&(XY.copy(s).invert(),PA.copy(e.ray).applyMatrix4(XY),!(n.boundingBox!==null&&PA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,PA)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,d=s.groups,A=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),I=Math.min(a.count,Math.min(S.start+S.count,A.start+A.count));for(let P=R,F=I;P<F;P+=3){let D=a.getX(P),L=a.getX(P+1),C=a.getX(P+2);r=H3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(P/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(a.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=a.getX(S),I=a.getX(S+1),P=a.getX(S+2);r=H3(this,o,e,n,c,u,f,R,I,P),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),I=Math.min(l.count,Math.min(S.start+S.count,A.start+A.count));for(let P=R,F=I;P<F;P+=3){let D=P,L=P+1,C=P+2;r=H3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(P/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(l.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=S,I=S+1,P=S+2;r=H3(this,o,e,n,c,u,f,R,I,P),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function mAe(i,e,t,n,r,s,o,a){let l;if(e.side===mi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===zo,a),l===null)return null;q3.copy(a),q3.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(q3);return c<t.near||c>t.far?null:{distance:c,point:q3.clone(),object:i}}function H3(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,k3),i.getVertexPosition(l,z3),i.getVertexPosition(c,V3);let u=mAe(i,e,t,n,k3,z3,V3,YY);if(u){let f=new re;wd.getBarycoord(YY,k3,z3,V3,f),r&&(u.uv=wd.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=wd.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=wd.getInterpolatedAttribute(o,a,l,c,f,new re),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let d={a,b:l,c,normal:new re,materialIndex:0};wd.getNormal(k3,z3,V3,d.normal),u.face=d,u.barycoord=f}return u}var HA=class extends qs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=Ti,u=Ti,f,d){super(null,o,a,l,c,u,r,s,f,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Ql=class extends Hi{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var C8=new re,AAe=new re,gAe=new Mn,Na=class{constructor(e=new re(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=C8.subVectors(n,t).cross(AAe.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(C8),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||gAe.getNormalMatrix(e),r=this.coplanarPoint(C8).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},IA=new yl,vAe=new Oe(.5,.5),W3=new re,zc=class{constructor(e=new Na,t=new Na,n=new Na,r=new Na,s=new Na,o=new Na){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=ko,n=!1){let r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],f=s[5],d=s[6],A=s[7],y=s[8],w=s[9],S=s[10],T=s[11],R=s[12],I=s[13],P=s[14],F=s[15];if(r[0].setComponents(c-o,A-u,T-y,F-R).normalize(),r[1].setComponents(c+o,A+u,T+y,F+R).normalize(),r[2].setComponents(c+a,A+f,T+w,F+I).normalize(),r[3].setComponents(c-a,A-f,T-w,F-I).normalize(),n)r[4].setComponents(l,d,S,P).normalize(),r[5].setComponents(c-l,A-d,T-S,F-P).normalize();else if(r[4].setComponents(c-l,A-d,T-S,F-P).normalize(),t===ko)r[5].setComponents(c+l,A+d,T+S,F+P).normalize();else if(t===xl)r[5].setComponents(l,d,S,P).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),IA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),IA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(IA)}intersectsSprite(e){IA.center.set(0,0,0);let t=vAe.distanceTo(e.center);return IA.radius=.7071067811865476+t,IA.applyMatrix4(e.matrixWorld),this.intersectsSphere(IA)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(W3.x=r.normal.x>0?e.max.x:e.min.x,W3.y=r.normal.y>0?e.max.y:e.min.y,W3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(W3)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},ZY=new cn,N2=class i{constructor(){this.coordinateSystem=ko,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let r=0;r<t.length;r++){let s=t[r];ZY.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new zc),n[r].setFromProjectionMatrix(ZY,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new zc),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Iu=class extends Hs{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new zt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},aM=new re,lM=new re,KY=new cn,E2=new Pd,j3=new yl,R8=new re,QY=new re,o0=class extends lr{constructor(e=new Xn,t=new Iu){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)aM.fromBufferAttribute(t,r-1),lM.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=aM.distanceTo(lM);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),j3.copy(n.boundingSphere),j3.applyMatrix4(r),j3.radius+=s,e.ray.intersectsSphere(j3)===!1)return;KY.copy(r).invert(),E2.copy(e.ray).applyMatrix4(KY);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){let A=Math.max(0,o.start),y=Math.min(u.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=u.getX(w),R=u.getX(w+1),I=X3(this,e,E2,l,T,R,w);I&&t.push(I)}if(this.isLineLoop){let w=u.getX(y-1),S=u.getX(A),T=X3(this,e,E2,l,w,S,y-1);T&&t.push(T)}}else{let A=Math.max(0,o.start),y=Math.min(d.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=X3(this,e,E2,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=X3(this,e,E2,l,y-1,A,y-1);w&&t.push(w)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function X3(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(aM.fromBufferAttribute(a,r),lM.fromBufferAttribute(a,s),t.distanceSqToSegment(aM,lM,R8,QY)>n)return;R8.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(R8);if(!(c<e.near||c>e.far))return{distance:c,point:QY.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var JY=new re,eZ=new re,Jv=class extends o0{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)JY.fromBufferAttribute(t,r),eZ.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+JY.distanceTo(eZ);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var a0=class extends Hs{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new zt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},tZ=new cn,k8=new Pd,$3=new yl,Y3=new re,F2=class extends lr{constructor(e=new Xn,t=new a0){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),$3.copy(n.boundingSphere),$3.applyMatrix4(r),$3.radius+=s,e.ray.intersectsSphere($3)===!1)return;tZ.copy(r).invert(),k8.copy(e.ray).applyMatrix4(tZ);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,f=n.attributes.position;if(c!==null){let d=Math.max(0,o.start),A=Math.min(c.count,o.start+o.count);for(let y=d,w=A;y<w;y++){let S=c.getX(y);Y3.fromBufferAttribute(f,S),nZ(Y3,S,l,r,e,t,this)}}else{let d=Math.max(0,o.start),A=Math.min(f.count,o.start+o.count);for(let y=d,w=A;y<w;y++)Y3.fromBufferAttribute(f,y),nZ(Y3,y,l,r,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function nZ(i,e,t,n,r,s,o){let a=k8.distanceSqToPoint(i);if(a<t){let l=new re;k8.closestPointToPoint(i,l),l.applyMatrix4(n);let c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var WA=class extends qs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Ti,this.minFilter=Ti,this.generateMipmaps=!1,this.needsUpdate=!0}};var Ph=class extends qs{constructor(e=[],t=ec,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var Es=class extends qs{constructor(e,t,n=xi,r,s,o,a=Ti,l=Ti,c,u=Vs,f=1){if(u!==Vs&&u!==xo)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:f};super(d,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Zv(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},e_=class extends Es{constructor(e,t=xi,n=ec,r,s,o=Ti,a=Ti,l,c=Vs){let u={width:e,height:e,depth:1},f=[u,u,u,u,u,u];super(e,e,t,n,r,s,o,a,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},B2=class extends qs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Lu=class i extends Xn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],d=0,A=0;y("z","y","x",-1,-1,n,t,e,o,s,0),y("z","y","x",1,-1,n,t,-e,o,s,1),y("x","z","y",1,1,e,n,t,r,o,2),y("x","z","y",1,-1,e,n,-t,r,o,3),y("x","y","z",1,-1,e,t,n,r,s,4),y("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Ln(c,3)),this.setAttribute("normal",new Ln(u,3)),this.setAttribute("uv",new Ln(f,2));function y(w,S,T,R,I,P,F,D,L,C,B){let k=P/L,z=F/C,G=P/2,W=F/2,Y=D/2,H=L+1,$=C+1,J=0,te=0,ce=new re;for(let he=0;he<$;he++){let ve=he*z-W;for(let Re=0;Re<H;Re++){let Qe=Re*k-G;ce[w]=Qe*R,ce[S]=ve*I,ce[T]=Y,c.push(ce.x,ce.y,ce.z),ce[w]=0,ce[S]=0,ce[T]=D>0?1:-1,u.push(ce.x,ce.y,ce.z),f.push(Re/L),f.push(1-he/C),J+=1}}for(let he=0;he<C;he++)for(let ve=0;ve<L;ve++){let Re=d+ve+H*he,Qe=d+ve+H*(he+1),Fe=d+(ve+1)+H*(he+1),mt=d+(ve+1)+H*he;l.push(Re,Qe,mt),l.push(Qe,Fe,mt),te+=6}a.addGroup(A,te,B),A+=te,d+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var t_=class i extends Xn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new re,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,d=3;f<=t;f++,d+=3){let A=n+f/t*r;c.x=e*Math.cos(A),c.y=e*Math.sin(A),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new Ln(o,3)),this.setAttribute("normal",new Ln(a,3)),this.setAttribute("uv",new Ln(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},jA=class i extends Xn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],d=[],A=[],y=0,w=[],S=n/2,T=0;R(),o===!1&&(e>0&&I(!0),t>0&&I(!1)),this.setIndex(u),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function R(){let P=new re,F=new re,D=0,L=(t-e)/n;for(let C=0;C<=s;C++){let B=[],k=C/s,z=k*(t-e)+e;for(let G=0;G<=r;G++){let W=G/r,Y=W*l+a,H=Math.sin(Y),$=Math.cos(Y);F.x=z*H,F.y=-k*n+S,F.z=z*$,f.push(F.x,F.y,F.z),P.set(H,L,$).normalize(),d.push(P.x,P.y,P.z),A.push(W,1-k),B.push(y++)}w.push(B)}for(let C=0;C<r;C++)for(let B=0;B<s;B++){let k=w[B][C],z=w[B+1][C],G=w[B+1][C+1],W=w[B][C+1];(e>0||B!==0)&&(u.push(k,z,W),D+=3),(t>0||B!==s-1)&&(u.push(z,G,W),D+=3)}c.addGroup(T,D,0),T+=D}function I(P){let F=y,D=new Oe,L=new re,C=0,B=P===!0?e:t,k=P===!0?1:-1;for(let G=1;G<=r;G++)f.push(0,S*k,0),d.push(0,k,0),A.push(.5,.5),y++;let z=y;for(let G=0;G<=r;G++){let Y=G/r*l+a,H=Math.cos(Y),$=Math.sin(Y);L.x=B*$,L.y=S*k,L.z=B*H,f.push(L.x,L.y,L.z),d.push(0,k,0),D.x=H*.5+.5,D.y=$*.5*k+.5,A.push(D.x,D.y),y++}for(let G=0;G<r;G++){let W=F+G,Y=z+G;P===!0?u.push(Y,Y+1,W):u.push(Y+1,Y,W),C+=3}c.addGroup(T,C,P===!0?1:2),T+=C}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var za=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Xe("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);let u=n[r],d=n[r+1]-u,A=(o-u)/d;return(r+A)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Oe:new re);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new re,r=[],s=[],o=[],a=new re,l=new cn;for(let A=0;A<=e;A++){let y=A/e;r[A]=this.getTangentAt(y,new re)}s[0]=new re,o[0]=new re;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let A=1;A<=e;A++){if(s[A]=s[A-1].clone(),o[A]=o[A-1].clone(),a.crossVectors(r[A-1],r[A]),a.length()>Number.EPSILON){a.normalize();let y=Math.acos(Nn(r[A-1].dot(r[A]),-1,1));s[A].applyMatrix4(l.makeRotationAxis(a,y))}o[A].crossVectors(r[A],s[A])}if(t===!0){let A=Math.acos(Nn(s[0].dot(s[e]),-1,1));A/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(A=-A);for(let y=1;y<=e;y++)s[y].applyMatrix4(l.makeRotationAxis(r[y],A*y)),o[y].crossVectors(r[y],s[y])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},n_=class extends za{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Oe){let n=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),d=l-this.aX,A=c-this.aY;l=d*u-A*f+this.aX,c=d*f+A*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},cM=class extends n_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function gF(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,f){let d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,A=(a-o)/u-(l-o)/(u+f)+(l-a)/f;d*=u,A*=u,r(o,a,d,A)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var iZ=new re,rZ=new re,P8=new gF,I8=new gF,L8=new gF,uM=class extends za{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new re){let n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(rZ.subVectors(r[0],r[1]).add(r[0]),c=rZ);let f=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(iZ.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=iZ),this.curveType==="centripetal"||this.curveType==="chordal"){let A=this.curveType==="chordal"?.5:.25,y=Math.pow(c.distanceToSquared(f),A),w=Math.pow(f.distanceToSquared(d),A),S=Math.pow(d.distanceToSquared(u),A);w<1e-4&&(w=1),y<1e-4&&(y=w),S<1e-4&&(S=w),P8.initNonuniformCatmullRom(c.x,f.x,d.x,u.x,y,w,S),I8.initNonuniformCatmullRom(c.y,f.y,d.y,u.y,y,w,S),L8.initNonuniformCatmullRom(c.z,f.z,d.z,u.z,y,w,S)}else this.curveType==="catmullrom"&&(P8.initCatmullRom(c.x,f.x,d.x,u.x,this.tension),I8.initCatmullRom(c.y,f.y,d.y,u.y,this.tension),L8.initCatmullRom(c.z,f.z,d.z,u.z,this.tension));return n.set(P8.calc(l),I8.calc(l),L8.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new re().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function sZ(i,e,t,n,r){let s=(n-e)*.5,o=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*i+t}function _Ae(i,e){let t=1-i;return t*t*e}function xAe(i,e){return 2*(1-i)*i*e}function yAe(i,e){return i*i*e}function P2(i,e,t,n){return _Ae(i,e)+xAe(i,t)+yAe(i,n)}function bAe(i,e){let t=1-i;return t*t*t*e}function wAe(i,e){let t=1-i;return 3*t*t*i*e}function SAe(i,e){return 3*(1-i)*i*i*e}function TAe(i,e){return i*i*i*e}function I2(i,e,t,n,r){return bAe(i,e)+wAe(i,t)+SAe(i,n)+TAe(i,r)}var O2=class extends za{constructor(e=new Oe,t=new Oe,n=new Oe,r=new Oe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(I2(e,r.x,s.x,o.x,a.x),I2(e,r.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},i_=class extends za{constructor(e=new re,t=new re,n=new re,r=new re){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(I2(e,r.x,s.x,o.x,a.x),I2(e,r.y,s.y,o.y,a.y),I2(e,r.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},U2=class extends za{constructor(e=new Oe,t=new Oe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Oe){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Oe){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},hM=class extends za{constructor(e=new re,t=new re){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new re){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new re){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},k2=class extends za{constructor(e=new Oe,t=new Oe,n=new Oe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(P2(e,r.x,s.x,o.x),P2(e,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},z2=class extends za{constructor(e=new re,t=new re,n=new re){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(P2(e,r.x,s.x,o.x),P2(e,r.y,s.y,o.y),P2(e,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},V2=class extends za{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Oe){let n=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],f=r[o>r.length-3?r.length-1:o+2];return n.set(sZ(a,l.x,c.x,u.x,f.x),sZ(a,l.y,c.y,u.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new Oe().fromArray(r))}return this}},fM=Object.freeze({__proto__:null,ArcCurve:cM,CatmullRomCurve3:uM,CubicBezierCurve:O2,CubicBezierCurve3:i_,EllipseCurve:n_,LineCurve:U2,LineCurve3:hM,QuadraticBezierCurve:k2,QuadraticBezierCurve3:z2,SplineCurve:V2}),dM=class extends za{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new fM[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=n){let o=r[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(new fM[r.type]().fromJSON(r))}return this}},XA=class extends dM{constructor(e){super(),this.type="Path",this.currentPoint=new Oe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new U2(this.currentPoint.clone(),new Oe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let s=new k2(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,o){let a=new O2(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r),new Oe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new V2(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,s,o,a,l),this}absellipse(e,t,n,r,s,o,a,l){let c=new n_(e,t,n,r,s,o,a,l);if(this.curves.length>0){let f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},G2=class extends XA{constructor(e){super(e),this.uuid=Mh(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(new XA().fromJSON(r))}return this}};function EAe(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=RZ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=IAe(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return q2(s,o,t,a,l,c,0),o}function RZ(i,e,t,n,r){let s;if(r===GAe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=oZ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=oZ(o/n|0,i[o],i[o+1],s);return s&&r_(s,s.next)&&(W2(s),s=s.next),s}function $A(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(r_(t,t.next)||Zr(t.prev,t,t.next)===0)){if(W2(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function q2(i,e,t,n,r,s,o){if(!i)return;!o&&s&&BAe(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?CAe(i,n,r,s):MAe(i)){e.push(l.i,i.i,c.i),W2(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=RAe($A(i),e),q2(i,e,t,n,r,s,2)):o===2&&PAe(i,e,t,n,r,s):q2($A(i),e,t,n,r,s,1);break}}}function MAe(i){let e=i.prev,t=i,n=i.next;if(Zr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&M2(r,a,s,l,o,c,y.x,y.y)&&Zr(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function CAe(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Zr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=z8(A,y,e,t,n),R=z8(w,S,e,t,n),I=i.prevZ,P=i.nextZ;for(;I&&I.z>=T&&P&&P.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&M2(a,u,l,f,c,d,I.x,I.y)&&Zr(I.prev,I,I.next)>=0||(I=I.prevZ,P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&M2(a,u,l,f,c,d,P.x,P.y)&&Zr(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;I&&I.z>=T;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&M2(a,u,l,f,c,d,I.x,I.y)&&Zr(I.prev,I,I.next)>=0)return!1;I=I.prevZ}for(;P&&P.z<=R;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&M2(a,u,l,f,c,d,P.x,P.y)&&Zr(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function RAe(i,e){let t=i;do{let n=t.prev,r=t.next.next;!r_(n,r)&&IZ(n,t,t.next,r)&&H2(n,r)&&H2(r,n)&&(e.push(n.i,t.i,r.i),W2(t),W2(t.next),t=i=r),t=t.next}while(t!==i);return $A(t)}function PAe(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&kAe(o,a)){let l=LZ(o,a);o=$A(o,o.next),l=$A(l,l.next),q2(o,e,t,n,r,s,0),q2(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function IAe(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=RZ(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(UAe(c))}r.sort(LAe);for(let s=0;s<r.length;s++)t=DAe(r[s],t);return t}function LAe(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function DAe(i,e){let t=NAe(i,e);if(!t)return e;let n=LZ(t,i);return $A(n,n.next),$A(t,t.next)}function NAe(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(r_(i,t))return t;do{if(r_(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===n))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,l=o.x,c=o.y,u=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&PZ(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){let f=Math.abs(r-t.y)/(n-t.x);H2(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&FAe(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function FAe(i,e){return Zr(i.prev,i,e.prev)<0&&Zr(e.next,i,i.next)<0}function BAe(i,e,t,n){let r=i;do r.z===0&&(r.z=z8(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,OAe(r)}function OAe(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function z8(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function UAe(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function PZ(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function M2(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&PZ(i,e,t,n,r,s,o,a)}function kAe(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!zAe(i,e)&&(H2(i,e)&&H2(e,i)&&VAe(i,e)&&(Zr(i.prev,i,e.prev)||Zr(i,e.prev,e))||r_(i,e)&&Zr(i.prev,i,i.next)>0&&Zr(e.prev,e,e.next)>0)}function Zr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function r_(i,e){return i.x===e.x&&i.y===e.y}function IZ(i,e,t,n){let r=K3(Zr(i,e,t)),s=K3(Zr(i,e,n)),o=K3(Zr(t,n,i)),a=K3(Zr(t,n,e));return!!(r!==s&&o!==a||r===0&&Z3(i,t,e)||s===0&&Z3(i,n,e)||o===0&&Z3(t,i,n)||a===0&&Z3(t,e,n))}function Z3(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function K3(i){return i>0?1:i<0?-1:0}function zAe(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&IZ(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function H2(i,e){return Zr(i.prev,i,i.next)<0?Zr(i,e,i.next)>=0&&Zr(i,i.prev,e)>=0:Zr(i,e,i.prev)<0||Zr(i,i.next,e)<0}function VAe(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function LZ(i,e){let t=V8(i.i,i.x,i.y),n=V8(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function oZ(i,e,t,n){let r=V8(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function W2(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function V8(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function GAe(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}var G8=class{static triangulate(e,t,n=2){return EAe(e,t,n)}},Qp=class i{static area(e){let t=e.length,n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],r=[],s=[];aZ(e),lZ(n,e);let o=e.length;t.forEach(aZ);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,lZ(n,t[l]);let a=G8.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function aZ(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function lZ(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var j2=class i extends Xn{constructor(e=new G2([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Ln(r,3)),this.setAttribute("uv",new Ln(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,A=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:A-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,R=t.UVGenerator!==void 0?t.UVGenerator:qAe,I,P=!1,F,D,L,C;if(T){I=T.getSpacedPoints(u),P=!0,d=!1;let $e=T.isCatmullRomCurve3?T.closed:!1;F=T.computeFrenetFrames(u,$e),D=new re,L=new re,C=new re}d||(S=0,A=0,y=0,w=0);let B=a.extractPoints(c),k=B.shape,z=B.holes;if(!Qp.isClockWise(k)){k=k.reverse();for(let $e=0,ot=z.length;$e<ot;$e++){let nt=z[$e];Qp.isClockWise(nt)&&(z[$e]=nt.reverse())}}function W($e){let nt=10000000000000001e-36,bt=$e[0];for(let yt=1;yt<=$e.length;yt++){let hn=yt%$e.length,en=$e[hn],tn=en.x-bt.x,bn=en.y-bt.y,_e=tn*tn+bn*bn,vi=Math.max(Math.abs(en.x),Math.abs(en.y),Math.abs(bt.x),Math.abs(bt.y)),zn=nt*vi*vi;if(_e<=zn){$e.splice(hn,1),yt--;continue}bt=en}}W(k),z.forEach(W);let Y=z.length,H=k;for(let $e=0;$e<Y;$e++){let ot=z[$e];k=k.concat(ot)}function $($e,ot,nt){return ot||ze("ExtrudeGeometry: vec does not exist"),$e.clone().addScaledVector(ot,nt)}let J=k.length;function te($e,ot,nt){let bt,yt,hn,en=$e.x-ot.x,tn=$e.y-ot.y,bn=nt.x-$e.x,_e=nt.y-$e.y,vi=en*en+tn*tn,zn=en*_e-tn*bn;if(Math.abs(zn)>Number.EPSILON){let le=Math.sqrt(vi),Z=Math.sqrt(bn*bn+_e*_e),Te=ot.x-tn/le,Ie=ot.y+en/le,Ge=nt.x-_e/Z,vt=nt.y+bn/Z,Tt=((Ge-Te)*_e-(vt-Ie)*bn)/(en*_e-tn*bn);bt=Te+en*Tt-$e.x,yt=Ie+tn*Tt-$e.y;let qe=bt*bt+yt*yt;if(qe<=2)return new Oe(bt,yt);hn=Math.sqrt(qe/2)}else{let le=!1;en>Number.EPSILON?bn>Number.EPSILON&&(le=!0):en<-Number.EPSILON?bn<-Number.EPSILON&&(le=!0):Math.sign(tn)===Math.sign(_e)&&(le=!0),le?(bt=-tn,yt=en,hn=Math.sqrt(vi)):(bt=en,yt=tn,hn=Math.sqrt(vi/2))}return new Oe(bt/hn,yt/hn)}let ce=[];for(let $e=0,ot=H.length,nt=ot-1,bt=$e+1;$e<ot;$e++,nt++,bt++)nt===ot&&(nt=0),bt===ot&&(bt=0),ce[$e]=te(H[$e],H[nt],H[bt]);let he=[],ve,Re=ce.concat();for(let $e=0,ot=Y;$e<ot;$e++){let nt=z[$e];ve=[];for(let bt=0,yt=nt.length,hn=yt-1,en=bt+1;bt<yt;bt++,hn++,en++)hn===yt&&(hn=0),en===yt&&(en=0),ve[bt]=te(nt[bt],nt[hn],nt[en]);he.push(ve),Re=Re.concat(ve)}let Qe;if(S===0)Qe=Qp.triangulateShape(H,z);else{let $e=[],ot=[];for(let nt=0;nt<S;nt++){let bt=nt/S,yt=A*Math.cos(bt*Math.PI/2),hn=y*Math.sin(bt*Math.PI/2)+w;for(let en=0,tn=H.length;en<tn;en++){let bn=$(H[en],ce[en],hn);Mt(bn.x,bn.y,-yt),bt===0&&$e.push(bn)}for(let en=0,tn=Y;en<tn;en++){let bn=z[en];ve=he[en];let _e=[];for(let vi=0,zn=bn.length;vi<zn;vi++){let le=$(bn[vi],ve[vi],hn);Mt(le.x,le.y,-yt),bt===0&&_e.push(le)}bt===0&&ot.push(_e)}}Qe=Qp.triangulateShape($e,ot)}let Fe=Qe.length,mt=y+w;for(let $e=0;$e<J;$e++){let ot=d?$(k[$e],Re[$e],mt):k[$e];P?(L.copy(F.normals[0]).multiplyScalar(ot.x),D.copy(F.binormals[0]).multiplyScalar(ot.y),C.copy(I[0]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(ot.x,ot.y,0)}for(let $e=1;$e<=u;$e++)for(let ot=0;ot<J;ot++){let nt=d?$(k[ot],Re[ot],mt):k[ot];P?(L.copy(F.normals[$e]).multiplyScalar(nt.x),D.copy(F.binormals[$e]).multiplyScalar(nt.y),C.copy(I[$e]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(nt.x,nt.y,f/u*$e)}for(let $e=S-1;$e>=0;$e--){let ot=$e/S,nt=A*Math.cos(ot*Math.PI/2),bt=y*Math.sin(ot*Math.PI/2)+w;for(let yt=0,hn=H.length;yt<hn;yt++){let en=$(H[yt],ce[yt],bt);Mt(en.x,en.y,f+nt)}for(let yt=0,hn=z.length;yt<hn;yt++){let en=z[yt];ve=he[yt];for(let tn=0,bn=en.length;tn<bn;tn++){let _e=$(en[tn],ve[tn],bt);P?Mt(_e.x,_e.y+I[u-1].y,I[u-1].x+nt):Mt(_e.x,_e.y,f+nt)}}}Ee(),Ve();function Ee(){let $e=r.length/3;if(d){let ot=0,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[2]+nt,yt[1]+nt,yt[0]+nt)}ot=u+S*2,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[0]+nt,yt[1]+nt,yt[2]+nt)}}else{for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[2],nt[1],nt[0])}for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[0]+J*u,nt[1]+J*u,nt[2]+J*u)}}n.addGroup($e,r.length/3-$e,0)}function Ve(){let $e=r.length/3,ot=0;Ye(H,ot),ot+=H.length;for(let nt=0,bt=z.length;nt<bt;nt++){let yt=z[nt];Ye(yt,ot),ot+=yt.length}n.addGroup($e,r.length/3-$e,1)}function Ye($e,ot){let nt=$e.length;for(;--nt>=0;){let bt=nt,yt=nt-1;yt<0&&(yt=$e.length-1);for(let hn=0,en=u+S*2;hn<en;hn++){let tn=J*hn,bn=J*(hn+1),_e=ot+bt+tn,vi=ot+yt+tn,zn=ot+yt+bn,le=ot+bt+bn;Pt(_e,vi,zn,le)}}}function Mt($e,ot,nt){l.push($e),l.push(ot),l.push(nt)}function Et($e,ot,nt){dn($e),dn(ot),dn(nt);let bt=r.length/3,yt=R.generateTopUV(n,r,bt-3,bt-2,bt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function Pt($e,ot,nt,bt){dn($e),dn(ot),dn(bt),dn(ot),dn(nt),dn(bt);let yt=r.length/3,hn=R.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(hn[0]),Gt(hn[1]),Gt(hn[3]),Gt(hn[1]),Gt(hn[2]),Gt(hn[3])}function dn($e){r.push(l[$e*3+0]),r.push(l[$e*3+1]),r.push(l[$e*3+2])}function Gt($e){s.push($e.x),s.push($e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return HAe(t,n,e)}static fromJSON(e,t){let n=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];n.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new fM[r.type]().fromJSON(r)),new i(n,e.options)}},qAe={generateTopUV:function(i,e,t,n,r){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new Oe(s,o),new Oe(a,l),new Oe(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],d=e[r*3],A=e[r*3+1],y=e[r*3+2],w=e[s*3],S=e[s*3+1],T=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Oe(o,1-l),new Oe(c,1-f),new Oe(d,1-y),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(A,1-y),new Oe(S,1-T)]}};function HAe(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){let s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var YA=class i extends Xn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,d=t/l,A=[],y=[],w=[],S=[];for(let T=0;T<u;T++){let R=T*d-o;for(let I=0;I<c;I++){let P=I*f-s;y.push(P,-R,0),w.push(0,0,1),S.push(I/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let R=0;R<a;R++){let I=R+c*T,P=R+c*(T+1),F=R+1+c*(T+1),D=R+1+c*T;A.push(I,P,D),A.push(P,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var Va=class i extends Xn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new re,d=new re,A=[],y=[],w=[],S=[];for(let T=0;T<=n;T++){let R=[],I=T/n,P=o+I*a,F=e*Math.cos(P),D=Math.sqrt(e*e-F*F),L=0;T===0&&o===0?L=.5/t:T===n&&l===Math.PI&&(L=-.5/t);for(let C=0;C<=t;C++){let B=C/t,k=r+B*s;f.x=-D*Math.cos(k),f.y=F,f.z=D*Math.sin(k),y.push(f.x,f.y,f.z),d.copy(f).normalize(),w.push(d.x,d.y,d.z),S.push(B+L,1-I),R.push(c++)}u.push(R)}for(let T=0;T<n;T++)for(let R=0;R<t;R++){let I=u[T][R+1],P=u[T][R],F=u[T+1][R],D=u[T+1][R+1];(T!==0||o>0)&&A.push(I,P,D),(T!==n-1||l<Math.PI)&&A.push(P,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var X2=class i extends Xn{constructor(e=new z2(new re(-1,-1,0),new re(-1,1,0),new re(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new re,l=new re,c=new Oe,u=new re,f=[],d=[],A=[],y=[];w(),this.setIndex(y),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function w(){for(let I=0;I<t;I++)S(I);S(s===!1?t:0),R(),T()}function S(I){u=e.getPointAt(I/t,u);let P=o.normals[I],F=o.binormals[I];for(let D=0;D<=r;D++){let L=D/r*Math.PI*2,C=Math.sin(L),B=-Math.cos(L);l.x=B*P.x+C*F.x,l.y=B*P.y+C*F.y,l.z=B*P.z+C*F.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let I=1;I<=t;I++)for(let P=1;P<=r;P++){let F=(r+1)*(I-1)+(P-1),D=(r+1)*I+(P-1),L=(r+1)*I+P,C=(r+1)*(I-1)+P;y.push(F,D,C),y.push(D,L,C)}}function R(){for(let I=0;I<=t;I++)for(let P=0;P<=r;P++)c.x=I/t,c.y=P/r,A.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new i(new fM[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},$2=class extends Xn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new re,s=new re;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],d=f.start,A=f.count;for(let y=d,w=d+A;y<w;y+=3)for(let S=0;S<3;S++){let T=a.getX(y+S),R=a.getX(y+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,R),cZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{let o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){let u=3*a+c,f=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,f),cZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ln(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function cZ(i,e,t){let n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var Y2=class extends Hs{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new zt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function fg(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(uZ(r))r.isRenderTargetTexture?(Xe("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(uZ(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function fa(i){let e={};for(let t=0;t<i.length;t++){let n=fg(i[t]);for(let r in n)e[r]=n[r]}return e}function uZ(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function WAe(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function vF(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ln.workingColorSpace}var dg={clone:fg,merge:fa},jAe=`void main() {@@ -291,14 +291,16 @@ export function toggleLabelPolicy(id) {
291291 }292292 293293 // One toggle, one language: the button says what pressing it would do,294-// "Hide X labels" while the names are speaking and "Display X labels" while295-// they wait, whatever the kind of collection behind it.294+// "Hide labels" while the names are speaking and "Show labels" while they295+// wait, whatever the kind of collection behind it. The chip is the whole296+// tooltip -- no native title, which would say the same thing a second time297+// a few pixels away -- and the row already names the collection, so the298+// spoken label carries the name for ears alone.296299 function syncLabelToggle(button, collection) {297300 const speaking = labelPolicy(null, collection) === "always";298- const help = `${speaking ? "Hide" : "Display"} ${collection.title} labels`;299- button.dataset.label = help;300- button.setAttribute("aria-label", help);301- button.title = help;301+ button.dataset.label = speaking ? "Hide labels" : "Show labels";302+ button.setAttribute("aria-label",303+ `${speaking ? "Hide" : "Show"} ${collection.title} labels`);302304 button.setAttribute("aria-pressed", String(speaking));303305 }304306