clone

an offline map explorer where each world, from a game map to a city's open data, ships as one .atlas file

fix: hold the address to one baseline

Dami committed ed7e608
The principal character was set larger as well as heavier, and mixing
sizes on one line moves the em boxes: the prefix rode high and the
address wobbled. One size for both cuts now, on both projections --
weight alone carries the faintness on the chart, weight and alpha on
the globe -- and the baseline holds.
commit
ed7e608615e592899d4be31031ce58abf6c3ad38
parent
0bc9eac9844aad3775b3be4105470db21cce23e0
author
Dami <dami.etoile@gmail.com>
3 files changed, +9 -7
Massets/app.js4++--
Mfrontend/src/globe.js4+++-
Mfrontend/src/styles.js8++++----
M assets/app.js +2 -2
@@ -3,7 +3,7 @@
33 44 `).trim()}function Bc(i){return new Intl.NumberFormat().format(i)}function ls(i,e,t){return Math.min(t,Math.max(e,i))}function eS(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var oae=100;function Rd(){if(!ye.searchResults)return;let i=U.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,oae),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=U.search?"No visible locations match.":"Nothing is enabled. Show a category to list its locations.",t.append(n)}for(let n of e){let r=document.createElement("button");r.type="button",r.className="search-result",U.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),Ng(r,n.category);let s=document.createElement("span");s.className="result-dot",Lg(s,n.category,Oc(n.category.title));let o=document.createElement("span"),a=document.createElement("strong");a.textContent=n.location.title;let l=document.createElement("small");l.textContent=`${n.category.title} \xB7 ${n.group.title}`,o.append(a,l),r.append(s,o),t.append(r)}if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${Bc(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ye.searchResults.replaceChildren(t),lae(i.length),aae()}var Yz=28;function aae(){let i=U.selectedPin?.location.title||"",e=i.length>Yz?`${i.slice(0,Yz-1).trimEnd()}\u2026`:i;ye.dockRailName.textContent=e?` \xB7 ${e}`:"",ye.dockRailName.hidden=!e}function lae(i){ye.dockCount.textContent=`${Bc(i)} ${i===1?"location":"locations"}`,U.search?(ye.dockFlag.textContent=`\u201C${U.search}\u201D`,ye.dockFlag.hidden=!1):U.hiddenCategories.size>0?(ye.dockFlag.textContent="filtered",ye.dockFlag.hidden=!1):ye.dockFlag.hidden=!0}function tS(){!U.dockFolded||U.dockDismissed||nS(!1)}function cI(i){U.dockDismissed=i,nS(i)}function nS(i,e=!0){U.dockFolded=i,ye.dock.classList.toggle("is-folded",i),ye.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ye.dockFold.setAttribute("aria-label",t),ye.dockFold.setAttribute("title",t),e&&Lc()}function uI(i){U.hiddenCategories.delete(i.category.id),Ox(),$l(),Pd(),Fx(i,!0)}function Fx(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),Cu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),ye.detailTitle.textContent=i.location.title,ye.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,ye.detailDescription.textContent="",ye.detailLinks.hidden=!0,uae(i),ye.detailID.textContent=String(i.location.id),ye.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Qw(i.coordinate);ye.detailCell.textContent=t,ye.detailCellField.hidden=!t;let n=cae(i);if(ye.detailSource.textContent=n,ye.detailSourceField.hidden=!n,Ng(ye.detailDot,i.category),Lg(ye.detailDot,i.category,Oc(i.category.title)),ye.detail.hidden=!1,tS(),Rd(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(Ru(U.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function cae(i){let e=U.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(U.pinSourceIndex?.map!==U.map){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)}}U.pinSourceIndex={map:U.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return U.pinSourceIndex.byID.get(i.location.id)||t}async function uae(i){let e=await Zz();if(U.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ye.detailDescription.textContent=$z(t.d)||"No description is included in the archive.",hae(i)}function hae(i){let e=(i.location.links||[]).filter(n=>U.pinByID.has(n.locationId));if(ye.detailLinks.hidden=e.length===0,!e.length){ye.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)}ye.detailLinks.replaceChildren(t)}function Fc(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(Cu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed()),ye.detail.hidden=!0,i&&Rd()}function Pu(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function Kz(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function lf(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="equirect")return null;let t=(e["atlas.geometry.equirect.px"]||"").split(",").map(Number),n=(e["atlas.geometry.equirect.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;return!o||!a||c===f||l===u?null:{toLatLng(p,x){return[c-(x-s)/a*(c-f),l+(p-r)/o*(u-l)]},toWorld(p,x){return[r+(x-l)/(u-l)*o,s+(c-p)/(c-f)*a]}}}var rS=[NaN,NaN,NaN,0],hI;function fae(){return hI||(hI=Ti(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),hI}var dae=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,pae=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Aae=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,mae=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function iS(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Ux(i){throw new Error('failed to parse "'+i+'" as color')}function Qz(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(pae)||i.match(dae)||i.match(Aae);if(s){let o=s[4],a=100/255;return[xi(iS(s[1],a)+.5|0,0,255),xi(iS(s[2],a)+.5|0,0,255),xi(iS(s[3],a)+.5|0,0,255),o!==void 0?xi(iS(o,100),0,1):1]}Ux(i)}if(i.startsWith("#")){if(mae.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}Ux(i)}let e=fae();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&&Ux(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Qz(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]=V0(r[3]/255,3),r}function Jz(i){return typeof i=="string"?i:Gx(i)}var gae=1024,Bx={},fI=0;function eV(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function dI(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function pI(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function AI(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function mI(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function gI(i){let e=AI(i[0]),t=AI(i[1]),n=AI(i[2]),r=mI(e*.222488403+t*.716873169+n*.06060791),s=500*(mI(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-mI(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 tV(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=pI(e),s=pI(e+t/500*Math.cos(n)),o=pI(e-t/200*Math.sin(n)),a=dI(s*3.021973625-r*1.617392459-o*.404875592),l=dI(s*-.943766287+r*1.916279586+o*.027607165),c=dI(s*.069407491-r*.22898585+o*1.159737864);return[xi(a+.5|0,0,255),xi(l+.5|0,0,255),xi(c+.5|0,0,255),i[3]]}function kx(i){if(i==="none")return rS;if(Bx.hasOwnProperty(i))return Bx[i];if(fI>=gae){let t=0;for(let n in Bx)(t++&3)===0&&(delete Bx[n],--fI)}let e=Qz(i);e.length!==4&&Ux(i);for(let t of e)isNaN(t)&&Ux(i);return Bx[i]=e,++fI,e}function Yl(i){return Array.isArray(i)?i:kx(i)}function Gx(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 xI=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=_I(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=_I(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=_I(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===Mn.IDLE&&n.load(),n.getImageState()===Mn.LOADING?n.ready().then(()=>{this.patternCache_[s]=Cx().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Cx().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function _I(i,e){let t=e?Yl(e):"null";return i+":"+t}var Oo=new xI;var zx=null,sS=class extends Sd{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?Mn.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_===Mn.LOADED){zx||(zx=Ti(1,1,void 0,{willReadFrequently:!0})),zx.drawImage(this.image_,0,0);try{zx.getImageData(0,0,1,1),this.tainted_=!1}catch{zx=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Jt.CHANGE)}handleImageError_(){this.imageState_=Mn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mn.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=Ti(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_===Mn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&nz(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_!==Mn.LOADED)return;let t=this.image_,n=Ti(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=Jz(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_===Mn.LOADED||this.imageState_===Mn.ERROR)e();else{let t=()=>{(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)&&(this.removeEventListener(Jt.CHANGE,t),e())};this.addEventListener(Jt.CHANGE,t)}})),this.ready_}};function Id(i,e,t,n,r,s){let o=e===void 0?void 0:Oo.get(e,r);return o||(o=new sS(i,i&&"src"in i?i.src||void 0:e,t,n,r),Oo.set(e,r,o,s)),s&&o&&!Oo.getPattern(e,r)&&Oo.set(e,r,o,s),o}var nV=sS;function qa(i){return i?Array.isArray(i)?Gx(i):typeof i=="object"&&"src"in i?_ae(i):i:null}function _ae(i){if(!i.offset||!i.size)return Oo.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=Oo.getPattern(e,i.color);if(t)return t;let n=Oo.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Ti(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]),Id(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Oo.getPattern(e,i.color)}var Vx="ol-hidden";var Nd="ol-unselectable";var Dg="ol-control",yI="ol-collapsed",xae=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"),iV=["style","variant","weight","size","lineHeight","family"],oS={normal:400,bold:700},aS=function(i){let e=i.match(xae);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=iV.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[iV[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in oS&&(t.weight=oS[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var lS="10px sans-serif",ks="#000",Iu="round",Ha=[],Wa=0,Nu="round",cf=10,sV=0,Bo="#000",Ld="center",nA="middle",uf=[0,0,0,0],hf=1,tA=new bs,qx=null,rV,vI={},yae=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function vae(i,e,t){return`${i} ${e} 16px "${t}"`}var oV=(function(){let e,t;async function n(s){await t.ready;let o=aS(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=oS[f.weight]||f.weight;p===a&&f.style===o.style&&x==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=tA.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)?(Su(vI),tA.set(c,100)):(u+=10,tA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Us?self.fonts:document.fonts);let o=aS(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(yae.has(c))continue;let u=vae(o.style,o.weight,c);tA.get(u)===void 0&&(tA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),bae=(function(){let i;return function(e){let t=vI[e];if(t==null){if(Us){let n=aS(e),r=aV(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);vI[e]=t}return t}})();function aV(i,e){return qx||(qx=Ti(1,1)),i!=rV&&(qx.font=i,rV=qx.font),qx.measureText(e)}function lV(i,e){return aV(i,e).width}function bI(i,e,t){if(e in t)return t[e];let n=e.split(`55 `).reduce((r,s)=>Math.max(r,lV(i,s)),0);return t[e]=n,n}function cV(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===`6-`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let p=e[c+1]||i.font,x=lV(p,f);t.push(x),o+=x;let v=bae(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function uV(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]),wae(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 wae(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 wI=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=jr(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 Zn()}getImage(e){return Zn()}getHitDetectionImage(){return Zn()}getPixelRatio(e){return 1}getImageState(){return Zn()}getImageSize(){return Zn()}getOrigin(){return Zn()}getSize(){return Zn()}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_=jr(e)}listenImageChange(e){Zn()}load(){Zn()}unlistenImageChange(e){Zn()}ready(){return Promise.resolve()}},cS=wI;var SI=class i extends cS{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()?Mn.LOADING:Mn.LOADED,this.imageState_===Mn.LOADING&&this.ready().then(()=>this.imageState_=Mn.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=Oo.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Ti(o,o);this.draw_(s,a,e),r=a.canvas;let l=new nV(r,void 0,null,Mn.LOADED,null);Oo.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),p=f/l;if(e==="miter"&&p<=n)return p*t;let x=t/2/p,v=t/2*(u/f),S=Math.sqrt((r+x)*(r+x)+v*v)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),P=Math.sqrt(r*r-T*T),R=s-P,L=Math.sqrt(T*T+R*R)/T;if(L<=n){let D=L*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=Iu,t=Nu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=qa(this.stroke_.getColor()??Bo),a=this.stroke_.getWidth()??hf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Nu,e=this.stroke_.getLineCap()??Iu,n=this.stroke_.getMiterLimit()??cf);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=ks),t.fillStyle=qa(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=Yl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Ti(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=ks,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()}},uS=SI;var TI=class i extends uS{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}},hS=TI;var EI=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=Id(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()===Mn.IDLE&&t.load(),t.getImageState()===Mn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Ln(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Yl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},Xr=EI;function hV(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 MI=class i extends cS{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;Vn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Ln(o)),Vn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Vn(!((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=Mn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Mn.LOADED:Mn.IDLE:l=Mn.LOADING:l=Mn.LOADED),this.color_=e.color!==void 0?Yl(e.color):null,this.iconImage_=Id(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 p=()=>{if(this.unlistenImageChange(p),!this.initialOptions_)return;let x=this.iconImage_.getSize();this.setScale(hV(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(hV(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?Yl(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?Mn.IDLE:this.iconImage_.getImageState();this.iconImage_=Id(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_=Id(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Mn.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()==Mn.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()==Mn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(Jt.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(Jt.CHANGE,e)}ready(){return this.iconImage_.ready()}},iA=MI;var CI=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}},ho=CI;var fS=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=fV,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_=fV,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function dV(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(Vn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var RI=null;function PI(i,e){if(!RI){let t=new Xr({color:"rgba(255,255,255,0.4)"}),n=new ho({color:"#3399CC",width:1.25});RI=[new fS({image:new hS({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return RI}function fV(i){return i.getGeometry()}var ws=fS;var Sae="#333",II=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_=jr(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 Xr({color:Sae}),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 Xr?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_=jr(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}},ff=II;function Zl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function mV(i){let e=i.get("pin");return!e||Kl(e)||e.insideHighlightedZone||Fg(e)?null:NI(e,!1)}function gV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Kl(e)||Fg(e)?null:NI(e,!1)}function _V(i){let e=i.get("pin");return!e||Kl(e)||!U.labelsHeld?null:wV(e)}function xV(i){let e=i.get("pin");if(!e||Kl(e)||e.insideHighlightedZone||Fg(e)||jx())return null;if(U.labelsHeld)return Hx(e,!1);let t=U.fitZoom+Math.log2(IV(e.category));return(U.engine.getView().getZoom()||0)<t?null:Hx(e,!1)}function yV(i){let e=i.get("pin");return!e||Kl(e)||e.insideHighlightedZone||Fg(e)||!jx()?null:Hx(e,!1)}function vV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Kl(e)||Fg(e)?null:Hx(e,!1)}function bV(i){let e=i.get("pin");if(!e||Kl(e))return null;if(Pu(e.category)==="text")return Hx(e,e===U.selectedPin);let t=NI(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,wV(e)]:t}function NI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=eA(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Wx(i.category)),o;return s?o=new ws({image:new iA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new ws({text:new ff({text:Oc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new Xr({color:n}),stroke:new ho({color:J0(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function wV(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new ws({text:new ff({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new Xr({color:"#f2ece0"}),stroke:new ho({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new Xr({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return U.styleCache.set(e,t),t}function SV(i){if(!i.iconAsset)return;let e=Wx(i);if(U.markerIcons.has(e))return;U.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=eA(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=J0(),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),U.markerIcons.set(e,n.toDataURL("image/png")),Tae(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=lI(i.iconAsset)}function Tae(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Wx(i){return`${i.iconAsset||""}:${eA(i)}:${U.map?.iconOutset||"light"}`}function Hx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new ws({text:new ff({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new Xr({color:e?"#7fd0ea":"#f2ece0"}),stroke:new ho({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new Xr({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new ho({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return U.styleCache.set(t,r),r}function dS(i,e){return`${i} ${e}px ${Li.labelFont}`}function LI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Li.neighborLabelSizePx:Li.labelSizePx,s=dS(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=Eae(t,s,r,o,e),l=Zw(t,{subgridVisible:U.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(U.styleCache.has(c))return U.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new ws({fill:l.fill?new Xr({color:af(l.fill.color,l.fill.opacity)}):void 0,stroke:new ho({color:af(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let p=l.label.prefix?[l.label.prefix,dS(500,r-2),l.label.final,dS(900,r)]:l.label.final,x=Li.labelInsetPx*e;f.push(new ws({geometry:new Dc([t.extent[2]-x,t.extent[1]+x]),text:new ff({text:p,font:dS(900,r),textAlign:"right",textBaseline:"bottom",fill:new Xr({color:af(l.label.color,l.label.textAlpha)}),backgroundFill:new Xr({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return U.styleCache.set(c,f),f}function Eae(i,e,t,n,r){if(!r)return!0;let s=DI(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 pV=document.createElement("canvas").getContext("2d"),AV=new Map;function DI(i,e){let t=`${e}|${i}`,n=AV.get(t);return n===void 0&&(pV.font=e,n=pV.measureText(i).width,AV.set(t,n)),n}var Mae=new ws({fill:new Xr({color:"rgba(5, 8, 16, 0.62)"})});function TV(){return U.zonesVisible?Mae:null}function EV(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=PV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color");if(r){let c=new ws({stroke:new ho({color:af(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return U.styleCache.set(s,c),c}let a=new ws({fill:new Xr({color:af(o,t?.035:.07)}),stroke:new ho({color:af(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return U.styleCache.set(s,a),a;let l=[new ws({stroke:new ho({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new ws({fill:new Xr({color:af(o,.22)}),stroke:new ho({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function MV(i){if(!U.zonesVisible||jx())return null;let e=i.get("child"),t=U.highlightedZones.has(i.get("zone").id),n=U.engine.getView().getZoom()||0;if(!t&&e&&n<U.fitZoom+3)return null;let r=i.get("span")/U.engine.getView().getResolution();return!t&&U.zoneTitleCount>40&&r<52?null:RV(i)}function CV(i){return!U.zonesVisible||!jx()?null:RV(i)}function RV(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=PV(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color"),a=new ws({text:new ff({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new Xr({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new ho({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 Xr({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new ho({color:n?"#ffffff":af(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return U.styleCache.set(s,a),a}function PV(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(Cae(i,e))return!1;return!0}function Cae(i,e){let t=new Set,n=U.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=U.zoneRecords.get(n)?.zone.parentRegionId}return!1}var FI=class i extends Tu{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Ic(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<gd(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=Tc(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 Eu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Dc(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 Dc(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(xx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Rx(this.flatCoordinates,0,e,this.stride),this.changed()}},NV=FI;function pS(i,e,t,n){let r=[],s=Pr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=ug(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 OI=class i extends Tu{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 p=0,x=f.length;p<x;++p)f[p]+=u;Ic(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;Ic(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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Oz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Bz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return qG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Dz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),rI(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Px(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=pS(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=jw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new NV(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;zz(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=rI(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=kz(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 Mu(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,p=l.length;f<p;++f)l[f]-=s;let u=new Mu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return WG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Lz(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()}},LV=OI;function BI(){let i=(U.map.zones||[]).filter(GI);U.renderedShard=U.variant?.shard||0,U.sources.zones.clear(),U.sources.zoneTitles.clear(),U.zoneRecords.clear(),U.highlightedZones.clear(),U.focusedZoneID=null,U.zoneTitleCount=0,AS(!0),ye.zoneIndex.hidden=i.length===0,ye.zoneCount.textContent=Bc(i.length);for(let e of i){let t=Pr(),n=[],r=!1;for(let l of e.features||[]){let c=Iae(l);c&&(r=!0,n.push(c),pw(t,c.getExtent()),U.sources.zones.addFeature(new Td({geometry:c,zone:e,color:Jw(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=Jw(e.id),o=e.center?Og(e.center.lat,e.center.lng):Ga(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new Td({geometry:new Dc(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),U.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}U.zoneTitleCount=U.sources.zoneTitles.getFeatures().length,FV(),Rae()}function FV(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[DV([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of U.highlightedZones)for(let o of U.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(DV(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new Td({geometry:new Mu(r)}))}function DV(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 Rae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of Pae()){let n=U.zoneRecords.get(e.id);if(!n)continue;let r=document.createElement("button");r.type="button",r.className="zone-index-item",r.dataset.zone=String(e.id),r.style.setProperty("--zone-color",n.color),r.style.setProperty("--zone-depth",String(t)),r.setAttribute("aria-pressed","false"),r.title=`${e.title}: click to jump; right-click to toggle highlight`;let s=document.createElement("span");s.className="zone-index-marker",s.setAttribute("aria-hidden","true");let o=document.createElement("span");o.textContent=e.title,r.append(s,o),i.append(r)}ye.zoneList.replaceChildren(i),ye.zoneIndex.hidden=U.zoneRecords.size===0}function Pae(){let i=[...U.zoneRecords.values()].map(o=>o.zone),e=new Set(i.map(o=>o.id)),t=new Map;for(let o of i){let a=e.has(o.parentRegionId)?o.parentRegionId:null;t.has(a)||t.set(a,[]),t.get(a).push(o)}for(let o of t.values())o.sort((a,l)=>a.title.localeCompare(l.title,void 0,{numeric:!0,sensitivity:"base"}));let n=[],r=new Set,s=(o,a)=>{if(!r.has(o.id)){r.add(o.id),n.push({zone:o,depth:a});for(let l of t.get(o.id)||[])s(l,a+1)}};for(let o of t.get(null)||[])s(o,0);for(let o of i)s(o,0);return n}function AS(i){U.zonesVisible=i,ye.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function OV(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,UV(),Fc(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:Ru(U.variant),duration:220}),ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"))}function BV(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),AS(!0)),U.hoveredPin=null,UI(),kI(),UV(),FV(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function UV(){ye.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of ye.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=U.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",U.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function Iae(i){if(!i?.coordinates)return null;let e=([t,n])=>Og(n,t);return i.type==="Polygon"?new Mu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new LV(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Og(i,e){let t=Nae(),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 Nae(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function kV(){U.sources.pins.clear(),U.sources.text.clear(),U.sources.priority.clear(),U.pins=[],U.pinByID.clear();for(let i of U.map.groups)for(let e of i.categories){Pu(e)!=="text"&&SV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Og(t.lat,t.lng),filteredHidden:!1,priority:Oae(e,t),feature:null};n.feature=new Td({geometry:new Dc(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),Pu(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}$l()}function $l(){for(let i of U.pins){let e=U.hiddenCategories.has(i.category.id),t=U.search&&!i.location.title.toLocaleLowerCase().includes(U.search);i.filteredHidden=!!(e||t)}UI(),kI(),U.selectedPin?.filteredHidden&&Fc(),Rd(),document.dispatchEvent(new Event("atlas:filters"))}function UI(){if(!U.highlightedZones.size){for(let e of U.pins)e.insideHighlightedZone=!1;return}let i=[...U.highlightedZones].map(e=>U.zoneRecords.get(e)).filter(Boolean);for(let e of U.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>Lae(n,e.coordinate)))}function Lae(i,e){if(i.intersectsCoordinate(e))return!0;let t=i.getClosestPoint(e),n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r<=1}function kI(){U.eligibleLocations=U.pins.filter(i=>!Kl(i)).length,Cu(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.zoneText.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),rA()}function Cu(){U.sources.priority.clear();for(let i of U.pins){if(Kl(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Cd(i))&&U.sources.priority.addFeature(i.feature)}}function Bg(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(Cu(),U.layers.pins.changed(),U.layers.priority.changed()))}function mS(i){U.labelsHeld!==i&&(U.labelsHeld=i,ye.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",U.layers.pinLabels.changed(),U.layers.text.changed(),document.dispatchEvent(new Event("atlas:labels")))}function Fg(i){return i===U.selectedPin||i===U.hoveredPin||Cd(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Kl(i){return i.filteredHidden||Dae(i)||Fae(i)||!GI(i.location)}function GI(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function Dae(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Fae(i){return!U.gridEnabled||!U.gridPrefix||Cd(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Oae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Xz(e.id)%1e3}function IV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function jx(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function GV(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Pu(s)==="text"?t:r).push(s);r.length&&e.push({key:`group-${n.id}`,title:n.title,categories:r})}return t.length&&e.unshift({key:"text",title:"Text",categories:t}),e}function zV(){let i=document.createDocumentFragment();for(let e of U.map.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.categories.reduce((s,o)=>s+o.locations.length,0);t.append(Bae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(Uae(s));t.append(r),i.append(t)}ye.legend.replaceChildren(i),gS(),Pd()}function Bae(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=Bc(t),r.append(s,o,a);let l=VV(`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 VV(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 Uae(i){let e=Pu(i)==="text",t=document.createElement("label");t.className="category-row",Ng(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!U.hiddenCategories.has(i.id);let r=document.createElement("span");e?(r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label"):(r.className="category-icon",Lg(r,i,Oc(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=document.createElement("span");o.className="category-count",o.textContent=Bc(i.locations.length);let a=VV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function zI(i){if(U.collapsedSections.clear(),i)for(let e of ye.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);gS()}function gS(){for(let i of ye.layers.querySelectorAll("[data-section]")){let e=U.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Lc()}function Xx(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Ox(),$l(),Rd(),Pd()}function Ox(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function qV(i){let e=U.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!U.hiddenCategories.has(n.id));for(let n of e.categories)t?U.hiddenCategories.add(n.id):U.hiddenCategories.delete(n.id);Ox(),$l(),Pd()}function HV(i){if(U.map){if(kae(i)){Xx(!0);return}U.hiddenCategories.clear();for(let e of U.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&U.hiddenCategories.add(n.id)}Ox(),$l(),Rd(),Pd()}}function kae(i){for(let e of U.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===U.hiddenCategories.has(t.id))return!1;return!0}function Gae(){let i=ye.soloChip;if(!U.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.map.sections){let a=0;for(let l of o.categories)U.hiddenCategories.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.categories.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 Pd(){if(U.map){for(let i of U.map.sections){let e=ye.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}Gae(),Lc()}}async function WV(i){let[e,t]=await Promise.all([fetch(`${U.game.base}/maps/${i.slug}.json`),fetch(`${U.game.base}/maps/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`map ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(o=>o.categories);return zae(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:GV(n.groups)}}function zae(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!==2)throw new Error(`location payload is version ${r}, and this reads 2`);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),p=new Uint32Array(i,o+=s*4,s+1),x=new Uint16Array(i,o+=(s+1)*4,s),v=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.locations=[];for(let S=0;S<s;S++)e[x[S]].locations.push({id:a[S],title:w.decode(v.subarray(p[S],p[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function Zz(){let i=`${U.game.base}/${U.map.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.game.base}/maps/${U.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByMap.get(i)}var _S=null;function sA(){return _S||(_S=Vae().finally(()=>{_S=null})),_S}async function Vae(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),U0(ye.game,U.catalog.games,"title"),VI(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=Rg();await df(n.game||Cg()?.game||U.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByMap.keys())r.startsWith(e.base+"/")&&U.textByMap.delete(r);let n=U.engine?.getView();U.restore={game:t.slug,map:U.map?.slug,variant:U.map?U.map.variants.indexOf(U.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},await df(t.slug,U.map?.slug);return}U.game=t,ye.game.value=t.slug}function VI(){let i=!U.catalog?.games?.length;ye.emptyState.hidden=!i,U.catalog?.bundlesDir&&(ye.emptyPath.textContent=U.catalog.bundlesDir)}async function qI(){for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await sA();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await df(t)}finally{for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!1}}var Qs={ADD:"add",REMOVE:"remove"};var jV={LENGTH:"length"},Ug=class extends Zs{constructor(e,t,n){super(e),this.element=t,this.index=n}},HI=class extends bs{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(jV.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 Ug(Qs.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 Ug(Qs.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 Ug(Qs.REMOVE,r,e)),this.dispatchEvent(new Ug(Qs.ADD,t,e))}updateLength_(){this.set(jV.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=HI;var WI=class extends Zs{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Dd=WI;var jI=class extends Dd{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()}},Lu=jI;var rr={SINGLECLICK:"singleclick",CLICK:Jt.CLICK,DBLCLICK:Jt.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var $x={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var XI=class extends Sd{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_=kn(n,$x.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=kn(n,$x.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,Dw?{passive:!1}:!1)}emulateClick_(e){let t=new Lu(rr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Lu(rr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Lu(rr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==rr.POINTERUP||t.type==rr.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==rr.POINTERDOWN||t.type==rr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Lu(rr.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(ri),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 Lu(rr.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(kn(n,rr.POINTERMOVE,this.handlePointerMove_,this),kn(n,rr.POINTERUP,this.handlePointerUp_,this),kn(this.element_,rr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(kn(this.element_.getRootNode(),rr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Lu(rr.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 Lu(rr.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_&&(ri(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ri(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ri),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},XV=XI;var Du={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var po={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Yx=1/0,$I=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,Su(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){Vn(!(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!=Yx?(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==Yx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},$V=$I;var YI=class extends $V{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(Jt.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===rn.LOADED||n===rn.ERROR||n===rn.EMPTY){n!==rn.ERROR&&t.removeEventListener(Jt.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()===rn.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},YV=YI;function ZV(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Yx;if(!i.wantedTiles[t][e.getKey()])return Yx;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 Gs={ANIMATING:0,INTERACTING:1};var Ql={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function ZI(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,p=i[0]+l/2+u,x=i[2]-l/2+u,v=i[1]+c/2+f,w=i[3]-c/2+f;p>x&&(p=(x+p)/2,x=p),v>w&&(v=(w+v)/2,w=v);let S=xi(n[0],p,x),T=xi(n[1],v,w);if(o&&t&&r){let P=30*r;S+=-P*Math.log(1+Math.max(0,p-n[0])/P)+P*Math.log(1+Math.max(0,n[0]-x)/P),T+=-P*Math.log(1+Math.max(0,v-n[1])/P)+P*Math.log(1+Math.max(0,n[1]-w)/P)}return[S,T]})}function KV(i){return i}function KI(i,e,t,n){let r=jn(e)/t[0],s=xr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function QI(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),xi(n,t/2,e*2)}function QV(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?KI(l,t,o,n):l;if(a)return e?QI(r,u,c):xi(r,c,u);let f=Math.min(u,r),p=Math.floor(vg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function JV(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?KI(e,r,l,s):e;if(c)return n?QI(o,u,t):xi(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,v=Math.min(u,o),w=Math.floor(Math.log(e/v)/Math.log(i)+x),S=Math.max(p,w),T=e/Math.pow(i,S);return xi(T,t,u)}})}function JI(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?KI(i,n,a,r):i;return!t||!l?xi(s,e,c):QI(s,c,e)}})}function kg(i){if(i!==void 0)return 0}function e5(i){if(i!==void 0)return i}function eq(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 tq(i){let e=i===void 0?Ec(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var t5=0,i5=class extends bs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Mw(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&&LG(),e.center&&(e.center=Rc(e.center,this.projection_)),e.extent&&(e.extent=Pc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Ql)delete t[a];this.setProperties(t,!0);let n=Hae(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=qae(e),s=n.constraint,o=Wae(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=Rc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Rc(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&&xS(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||iz,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 p=wu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}jae(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Gs.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Gs.ANIMATING]>0}getInteracting(){return this.hints_[Gs.INTERACTING]>0}cancelAnimations(){this.setHint(Gs.ANIMATING,-this.hints_[Gs.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&xS(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 p=l.sourceCenter[0],x=l.sourceCenter[1],v=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=p+f*(v-p),T=x+f*(w-x);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let p=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let x=this.getViewportSize_(this.getRotation()),v=this.constraints_.resolution(p,0,x,!0);this.targetCenter_=this.calculateCenterZoom(v,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=p,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let p=f===1?wu(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let x=this.constraints_.rotation(p,!0);this.targetCenter_=this.calculateCenterRotate(x,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=p}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(Gs.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&xS(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]],pg(n,e-this.getRotation()),fG(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&&Tx(e,this.getProjection())}getCenterInternal(){return this.get(Ql.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 yd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();Vn(t,"The view center is not defined");let n=this.getResolution();Vn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return Vn(r!==void 0,"The view rotation is not defined"),vx(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(Ql.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Pc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=jn(e)/t[0],r=xr(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(Ql.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=n5(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=vg(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=xi(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,xi(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Vn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Vn(!bu(e),"Cannot fit empty extent provided as `geometry`");let r=Pc(e,this.getProjection());n=sI(r)}else if(e.getType()==="Circle"){let r=Pc(e.getExtent(),this.getProjection());n=sI(r),n.rotate(this.getRotation(),Ga(r))}else{let r=X0();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,p=s.length;f<p;f+=o){let x=s[f]*n-s[f+1]*r,v=s[f]*r+s[f+1]*n;a=Math.min(a,x),l=Math.min(l,v),c=Math.max(c,x),u=Math.max(u,v)}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),p=Ga(a);p[0]+=(r[1]-r[3])/2*l,p[1]+=(r[0]-r[2])/2*l;let x=p[0]*f-p[1]*u,v=p[1]*f+p[0]*u,w=this.getConstrainedCenter([x,v],l),S=t.callback?t.callback:of;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),xS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Rc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(n5(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=n5(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=Tx(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&&Rc(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=Rc(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&&Rc(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(Ql.ROTATION)!==r&&this.set(Ql.ROTATION,r),this.get(Ql.RESOLUTION)!==o&&(this.set(Ql.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ql.CENTER)||!q0(this.get(Ql.CENTER),a))&&this.set(Ql.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()||!q0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:jl,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Gs.INTERACTING,1)}endInteraction(e,t,n){n=n&&Rc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Gs.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 xS(i,e){setTimeout(function(){i(e)},0)}function qae(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return ZI(i.extent,i.constrainOnlyCenter,t)}let e=Mw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,ZI(t,!1,!1)}return KV}function Hae(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:t5,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,p=Mw(i.projection,"EPSG:3857"),x=p.getExtent(),v=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&p.isGlobal()&&(v=!1,w=x),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=QV(S,u,!v&&w,f):e=JI(t,n,u,!v&&w,f)}else{let T=(x?Math.max(jn(x),xr(x)):360*tf.degrees/p.getMetersPerUnit())/256/Math.pow(2,t5),P=T/Math.pow(2,28-t5);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=P),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=JV(l,t,n,u,!v&&w,f):e=JI(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Wae(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?tq():t===!1?e5:typeof t=="number"?eq(t):e5}return kg}function jae(i){return!(i.sourceCenter&&i.targetCenter&&!q0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function n5(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 pl=i5;var r5=class extends bs{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)ri(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!==of&&this.listenerKeys.push(kn(e,Du.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Gg=r5;var s5=class extends Gg{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(Jt.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Nd+" "+Dg+(this.collapsed_&&this.collapsible_?" "+yI:"")+(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=>QG(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Fo(t,this.renderedAttributions_)){sz(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(yI),this.collapsed_?IP(this.collapseLabel_,this.label_):IP(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)}},nq=s5;var o5=class extends Gg{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(Jt.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Nd+" "+Dg,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(Vx)}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:jl}):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(Vx);!s&&n===0?this.element.classList.add(Vx):s&&n!==0&&this.element.classList.remove(Vx)}this.label_.style.transform=r}this.rotation_=n}},iq=o5;var a5=class extends Gg{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(Jt.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(Jt.CLICK,this.handleClick_.bind(this,-n),!1);let p=t+" "+Nd+" "+Dg,x=this.element;x.className=p,x.appendChild(u),x.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:jl})):n.setZoom(s)}}},rq=a5;function yS(i){i=i||{};let e=new fo;return(i.zoom===void 0||i.zoom)&&e.push(new rq(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new iq(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new nq(i.attributionOptions)),e}var l5=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_}},sq=l5;var c5={ACTIVE:"active"};var u5=class extends bs{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(c5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(c5.ACTIVE,e)}setMap(e){this.map_=e}};function oq(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:rz,center:i.getConstrainedCenter(r)})}}function zg(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:jl})}var Fu=u5;var h5=class extends Fu{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==rr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();zg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},aq=h5;function Zx(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 lq=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Xae=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)},vS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Xae(i):!0},cq=rf;var bS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(JG&&EP&&e.ctrlKey)};var wS=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var uq=function(i){let e=i.originalEvent;return EP?e.metaKey:e.ctrlKey},hq=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},SS=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},TS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var fq=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var f5=class extends Fu{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==rr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==rr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==rr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==rr.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 Vg(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 Ou=f5;var d5=class extends Ou{constructor(e){super({stopDown:sf}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Zx(wS,fq);this.condition_=e.onFocusOnly?Zx(vS,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(Vg(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();dG(s,a.getResolution()),pg(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:jl})}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}},dq=d5;var p5=class extends Ou{constructor(e){e=e||{},super({stopDown:sf}),this.condition_=e.condition?e.condition:lq,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!TS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===kg)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 TS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return TS(e)&&bS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},pq=p5;var A5=class extends wd{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 Mu([r])}getGeometry(){return this.geometry_}},Aq=A5;var qg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},oA=class extends Zs{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},m5=class extends Ou{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new Aq(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??bS,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 oA(qg.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 oA(t?qg.BOXEND:qg.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 oA(qg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new oA(qg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new oA(qg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},mq=m5;var g5=class extends mq{constructor(e){e=e||{};let t=e.condition?e.condition:hq;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:jl})}},gq=g5;var Fd={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var _5=class extends Fu{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return wS(t)&&SS(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==Jt.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Fd.DOWN||r==Fd.LEFT||r==Fd.RIGHT||r==Fd.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Fd.DOWN?c=-a:r==Fd.LEFT?l=-a:r==Fd.RIGHT?l=a:c=a;let u=[l,c];pg(u,o.getRotation()),oq(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},_q=_5;var x5=class extends Fu{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!uq(t)&&SS(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==Jt.KEYDOWN||e.type==Jt.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();zg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},xq=x5;var $ae=40,Yae=300,Zae=3,y5=class extends Fu{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:cq;this.condition_=e.onFocusOnly?Zx(vS,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(ri),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(kn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),kn(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!==Jt.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*=$ae;break;case WheelEvent.DOM_DELTA_PAGE:o*=Yae;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*Zae),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=-xi(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),zg(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)}},yq=y5;var v5=class extends Ou{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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!==kg&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Vg(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}},vq=v5;var b5=class extends Ou{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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(Vg(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}},bq=b5;function ES(i){i=i||{};let e=new fo,t=new sq(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new pq),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new aq({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new dq({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new vq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new bq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new _q),e.push(new xq({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new yq({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new gq({duration:i.zoomDuration})),e}var Ei={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 w5=class extends bs{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[Ei.OPACITY]=e.opacity!==void 0?e.opacity:1,Vn(typeof t[Ei.OPACITY]=="number","Layer opacity must be a number"),t[Ei.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ei.Z_INDEX]=e.zIndex,t[Ei.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ei.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ei.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ei.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=xi(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 Zn()}getLayerStatesArray(e){return Zn()}getExtent(){return this.get(Ei.EXTENT)}getMaxResolution(){return this.get(Ei.MAX_RESOLUTION)}getMinResolution(){return this.get(Ei.MIN_RESOLUTION)}getMinZoom(){return this.get(Ei.MIN_ZOOM)}getMaxZoom(){return this.get(Ei.MAX_ZOOM)}getOpacity(){return this.get(Ei.OPACITY)}getSourceState(){return Zn()}getVisible(){return this.get(Ei.VISIBLE)}getZIndex(){return this.get(Ei.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ei.EXTENT,e)}setMaxResolution(e){this.set(Ei.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ei.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ei.MAX_ZOOM,e)}setMinZoom(e){this.set(Ei.MIN_ZOOM,e)}setOpacity(e){Vn(typeof e=="number","Layer opacity must be a number"),this.set(Ei.OPACITY,e)}setVisible(e){this.set(Ei.VISIBLE,e)}setZIndex(e){this.set(Ei.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},MS=w5;var Od={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Uc=class extends Zs{constructor(e,t){super(e),this.layer=t}},S5={LAYERS:"layers"},T5=class i extends MS{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(S5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new fo(n.slice(),{unique:!0}):Vn(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(ri),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(kn(e,Qs.ADD,this.handleLayersAdd_,this),kn(e,Qs.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ri);Su(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 Uc(Od.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[kn(e,Nc.PROPERTYCHANGE,this.handleLayerChange_,this),kn(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(kn(e,Od.ADDLAYER,this.handleLayerGroupAdd_,this),kn(e,Od.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ln(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Uc(Od.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Uc(Od.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Uc(Od.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Ln(t);this.listenerKeys_[n].forEach(ri),delete this.listenerKeys_[n],this.dispatchEvent(new Uc(Od.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(S5.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 Uc(Od.REMOVELAYER,n[r]))}this.set(S5.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=vu(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Kx=T5;var Ao={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var E5=class extends MS{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(Ei.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(Ei.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_&&(ri(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=kn(e,Jt.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 pl?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 Qx(r,t.viewState)&&(!s||yr(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof pl?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(Ei.MAP,e)}getMapInternal(){return this.get(Ei.MAP)}setMap(e){this.mapPrecomposeKey_&&(ri(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ri(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=kn(e,Ao.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=kn(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);Vn(!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(Ei.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 Qx(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 aA=E5;function CS(i,e,t=0,n=i.length-1,r=Kae){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),p=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),x=Math.max(t,Math.floor(e-c*f/l+p)),v=Math.min(n,Math.floor(e+(l-c)*f/l+p));CS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(Jx(i,t,e),r(i[n],s)>0&&Jx(i,t,n);o<a;){for(Jx(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Jx(i,t,a):(a++,Jx(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Jx(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Kae(i,e){return i<e?-1:i>e?1:0}var lA=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(!PS(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;PS(e,l)&&(t.leaf?n.push(a):C5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!PS(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(PS(e,o)){if(t.leaf||C5(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=Wg([]),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=Qae(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&C5(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=Wg(e.slice(t,n+1)),Hg(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Wg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));wq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);wq(e,u,f,l,this.compareMinY);for(let p=u;p<=f;p+=l){let x=Math.min(p+l-1,f);a.children.push(this._build(e,p,x,r-1))}}return Hg(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=M5(c),f=tle(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),ty(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=Wg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Hg(n,this.toBBox),Hg(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Wg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Hg(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=ey(e,0,a,this.toBBox),c=ey(e,a,n,this.toBBox),u=nle(l,c),f=M5(l)+M5(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:Jae,s=e.leaf?this.compareMinY:ele,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=ey(e,0,t,s),a=ey(e,n-t,n,s),l=RS(o)+RS(a);for(let c=t;c<n-t;c++){let u=e.children[c];ty(o,e.leaf?s(u):u),l+=RS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];ty(a,e.leaf?s(u):u),l+=RS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)ty(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():Hg(e[t],this.toBBox)}};function Qae(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 Hg(i,e){ey(i,0,i.children.length,e,i)}function ey(i,e,t,n,r){r||(r=Wg(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];ty(r,i.leaf?n(o):o)}return r}function ty(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 Jae(i,e){return i.minX-e.minX}function ele(i,e){return i.minY-e.minY}function M5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function RS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function tle(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 nle(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 C5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function PS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Wg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function wq(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;CS(i,o,e,t,r),s.push(e,o,o,t)}}var uA=0,NS=0,Uo=1<<uA++,si=1<<uA++,ko=1<<uA++,la=1<<uA++,Af=1<<uA++,cA=1<<uA++,LS=Math.pow(2,uA)-1,P5={[Uo]:"boolean",[si]:"number",[ko]:"string",[la]:"color",[Af]:"number[]",[cA]:"size"},ile=Object.keys(P5).map(Number).sort(za);function rle(i){return i in P5}function pf(i){let e=[];for(let t of ile)ny(i,t)&&e.push(P5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function ny(i,e){return(i&e)===e}function IS(i,e){return!!(i&e)}function Bd(i,e){return i===e}var Nr=class{constructor(e,t){if(!rle(e))throw new Error(`literal expressions must have a specific type, got ${pf(e)}`);this.type=e,this.value=t}},DS=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function FS(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function $r(i,e,t){switch(typeof i){case"boolean":{if(Bd(e,ko))return new Nr(ko,i?"true":"false");if(!ny(e,Uo))throw new Error(`got a boolean, but expected ${pf(e)}`);return new Nr(Uo,i)}case"number":{if(Bd(e,cA))return new Nr(cA,jr(i));if(Bd(e,Uo))return new Nr(Uo,!!i);if(Bd(e,ko))return new Nr(ko,i.toString());if(!ny(e,si))throw new Error(`got a number, but expected ${pf(e)}`);return new Nr(si,i)}case"string":{if(Bd(e,la))return new Nr(la,kx(i));if(Bd(e,Uo))return new Nr(Uo,!!i);if(!ny(e,ko))throw new Error(`got a string, but expected ${pf(e)}`);return new Nr(ko,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 mle(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Bd(e,cA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Nr(cA,i)}if(Bd(e,la)){if(i.length===3)return new Nr(la,[...i,1]);if(i.length===4)return new Nr(la,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!ny(e,Af))throw new Error(`got an array of numbers, but expected ${pf(e)}`);return new Nr(Af,i)}var Je={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"},sle={[Je.Get]:Fn(Kn(1,1/0),Sq),[Je.Var]:ole(),[Je.Has]:Fn(Kn(1,1/0),Sq),[Je.Id]:Fn(ale,jg),[Je.Concat]:Fn(Kn(2,1/0),zi(ko)),[Je.GeometryType]:Fn(lle,jg),[Je.LineMetric]:Fn(cle,jg),[Je.Resolution]:Fn(R5,jg),[Je.Zoom]:Fn(R5,jg),[Je.Time]:Fn(R5,jg),[Je.Any]:Fn(Kn(2,1/0),zi(Uo)),[Je.All]:Fn(Kn(2,1/0),zi(Uo)),[Je.Not]:Fn(Kn(1,1),zi(Uo)),[Je.Equal]:Fn(Kn(2,2),Eq()),[Je.NotEqual]:Fn(Kn(2,2),Eq()),[Je.GreaterThan]:Fn(Kn(2,2),zi(si)),[Je.GreaterThanOrEqualTo]:Fn(Kn(2,2),zi(si)),[Je.LessThan]:Fn(Kn(2,2),zi(si)),[Je.LessThanOrEqualTo]:Fn(Kn(2,2),zi(si)),[Je.Multiply]:Fn(Kn(2,1/0),Tq),[Je.Coalesce]:Fn(Kn(2,1/0),Tq),[Je.Divide]:Fn(Kn(2,2),zi(si)),[Je.Add]:Fn(Kn(2,1/0),zi(si)),[Je.Subtract]:Fn(Kn(2,2),zi(si)),[Je.Clamp]:Fn(Kn(3,3),zi(si)),[Je.Mod]:Fn(Kn(2,2),zi(si)),[Je.Pow]:Fn(Kn(2,2),zi(si)),[Je.Abs]:Fn(Kn(1,1),zi(si)),[Je.Floor]:Fn(Kn(1,1),zi(si)),[Je.Ceil]:Fn(Kn(1,1),zi(si)),[Je.Round]:Fn(Kn(1,1),zi(si)),[Je.Sin]:Fn(Kn(1,1),zi(si)),[Je.Cos]:Fn(Kn(1,1),zi(si)),[Je.Atan]:Fn(Kn(1,2),zi(si)),[Je.Sqrt]:Fn(Kn(1,1),zi(si)),[Je.Match]:Fn(Kn(4,1/0),Mq,hle),[Je.Between]:Fn(Kn(3,3),zi(si)),[Je.Interpolate]:Fn(Kn(6,1/0),Mq,fle),[Je.Case]:Fn(Kn(3,1/0),ule,dle),[Je.In]:Fn(Kn(2,2),ple),[Je.Number]:Fn(Kn(1,1/0),zi(LS)),[Je.String]:Fn(Kn(1,1/0),zi(LS)),[Je.Array]:Fn(Kn(1,1/0),zi(si)),[Je.Color]:Fn(Kn(1,4),zi(si)),[Je.Band]:Fn(Kn(1,3),zi(si)),[Je.Palette]:Fn(Kn(2,2),Ale),[Je.ToString]:Fn(Kn(1,1),zi(Uo|si|ko|la))};function Sq(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 Nr(si,o);break}case"string":{r[s]=new Nr(ko,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 ole(){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=$r(s,LS,t);if(!(o instanceof Nr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&IS(r,la)&&!IS(r,ko)?a=la:Array.isArray(s)&&s.length===2&&IS(r,cA)&&!IS(r,Af)&&(a=cA),r&=a,r===NS)throw new Error(`the type expected from the var operator (${pf(e)}) did not have any overlap with the type of the corresponding style variables (${pf(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===NS)throw new Error(`a new type expected from the var operator (${pf(e)}) did not have any overlap with the previous type expected for it (${pf(o)}), variable name: ${n}`)}return t.variables.set(n,r),new DS(r,"var",new Nr(ko,n))}}function ale(i,e,t){t.featureId=!0}function lle(i,e,t){t.geometryType=!0}function cle(i,e,t){t.mCoordinate=!0}function R5(i,e,t){t.mapState=!0}function jg(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Kn(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 Tq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=$r(i[s+1],e,t);r[s]=o}return r}function zi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=$r(e[o+1],i,n);s[o]=a}return s}}function Eq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=LS;for(let a=0;a<r;++a){let l=$r(i[a+1],o,t);o&=l.type}if(o===NS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=$r(i[a+1],o,t);s[a]=l}return s}}function ule(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 Mq(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 hle(i,e,t){let n=i.length-1,r=$r(i[i.length-1],e,t),s=ko|si|Uo,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=$r(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===NS)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=$r(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=$r(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[$r(i[1],s,t),...o,r]}function fle(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 Nr(si,r),o;try{o=$r(i[2],si,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=$r(i[l+3],si,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=$r(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 dle(i,e,t){let n=$r(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=$r(i[s+1],Uo,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=$r(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 ple(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=ko:r=si;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=$r(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[$r(i[1],r,t),...s]}function Ale(i,e,t){let n;try{n=$r(i[1],si,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=$r(r[o],la,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Nr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Fn(...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 DS(t,r,...s)}}function mle(i,e,t){let n=i[0],r=sle[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function OS(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 OS(i.getGeometries()[0]);default:return""}}function I5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Gc(i,e,t){let n=$r(i,e,t);return kc(n,t)}function kc(i,e){if(i instanceof Nr){if(i.type===la&&typeof i.value=="string"){let n=kx(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case Je.Number:case Je.String:case Je.Coalesce:return gle(i,e);case Je.Get:case Je.Var:case Je.Has:return _le(i,e);case Je.Id:return n=>n.featureId;case Je.GeometryType:return n=>n.geometryType;case Je.Concat:{let n=i.args.map(r=>kc(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case Je.Resolution:return n=>n.resolution;case Je.Any:case Je.All:case Je.Between:case Je.In:case Je.Not:return yle(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return xle(i,e);case Je.Multiply:case Je.Divide:case Je.Add:case Je.Subtract:case Je.Clamp:case Je.Mod:case Je.Pow:case Je.Abs:case Je.Floor:case Je.Ceil:case Je.Round:case Je.Sin:case Je.Cos:case Je.Atan:case Je.Sqrt:return vle(i,e);case Je.Case:return ble(i,e);case Je.Match:return wle(i,e);case Je.Interpolate:return Sle(i,e);case Je.ToString:return Tle(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function gle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=kc(i.args[s],e);switch(t){case Je.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 Je.Number:case Je.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 _le(i,e){let n=i.args[0].value;switch(i.operator){case Je.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 Je.Var:return r=>r.variables[n];case Je.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 xle(i,e){let t=i.operator,n=kc(i.args[0],e),r=kc(i.args[1],e);switch(t){case Je.Equal:return s=>n(s)===r(s);case Je.NotEqual:return s=>n(s)!==r(s);case Je.LessThan:return s=>n(s)<r(s);case Je.LessThanOrEqualTo:return s=>n(s)<=r(s);case Je.GreaterThan:return s=>n(s)>r(s);case Je.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function yle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=kc(i.args[s],e);switch(t){case Je.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case Je.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case Je.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case Je.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 Je.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function vle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=kc(i.args[s],e);switch(t){case Je.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case Je.Divide:return s=>r[0](s)/r[1](s);case Je.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case Je.Subtract:return s=>r[0](s)-r[1](s);case Je.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 Je.Mod:return s=>r[0](s)%r[1](s);case Je.Pow:return s=>Math.pow(r[0](s),r[1](s));case Je.Abs:return s=>Math.abs(r[0](s));case Je.Floor:return s=>Math.floor(r[0](s));case Je.Ceil:return s=>Math.ceil(r[0](s));case Je.Round:return s=>Math.round(r[0](s));case Je.Sin:return s=>Math.sin(r[0](s));case Je.Cos:return s=>Math.cos(r[0](s));case Je.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case Je.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function ble(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=kc(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 wle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=kc(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 Sle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=kc(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),p=Array.isArray(f);if(p&&(f=eV(f)),u>=o)return c===2?f:p?Ele(s,o,a,l,u,f):iy(s,o,a,l,u,f);a=u,l=f}return l}}function Tle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=kc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===la?Gx(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function iy(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 Ele(i,e,t,n,r,s){if(r-t===0)return n;let a=gI(n),l=gI(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[iy(i,e,t,a[0],r,l[0]),iy(i,e,t,a[1],r,l[1]),a[2]+iy(i,e,t,0,r,c),iy(i,e,t,n[3],r,s[3])];return tV(u)}function Mle(i){return!0}function Cle(i,e){e=e??FS();let t=Rle(i,e),n=I5();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=OS(r.getGeometry())),t(n)}}function Cq(i,e){e=e??FS();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=N5(i[o],e);let r=I5(),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=OS(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 Nq(i,e){if(e=e??FS(),!Array.isArray(i))return Cq([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 Cle(s,e)}return Cq(i,e)}function Rle(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?Gc(s.filter,Uo,e):Mle,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=N5(s.style[c],e)}else a=[N5(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 N5(i,e){let t=ry(i,"",e),n=sy(i,"",e),r=Ple(i,e),s=Ile(i,e),o=mo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Mc(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new ws;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 ry(i,e,t){let n;if(e+"fill-pattern-src"in i)n=Fle(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=US(i,e+"fill-color",t)}if(!n)return null;let r=new Xr;return function(s){let o=n(s);return o===rS?null:(r.setColor(o),r)}}function sy(i,e,t){let n=mo(i,e+"stroke-width",t),r=US(i,e+"stroke-color",t);if(!n&&!r)return null;let s=mf(i,e+"stroke-line-cap",t),o=mf(i,e+"stroke-line-join",t),a=Lq(i,e+"stroke-line-dash",t),l=mo(i,e+"stroke-line-dash-offset",t),c=mo(i,e+"stroke-miter-limit",t),u=mo(i,e+"stroke-offset",t),f=new ho;return function(p){if(r){let x=r(p);if(x===rS)return null;f.setColor(x)}if(n&&f.setWidth(n(p)),s){let x=s(p);if(x!=="butt"&&x!=="round"&&x!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(x)}if(o){let x=o(p);if(x!=="bevel"&&x!=="round"&&x!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(x)}return a&&f.setLineDash(a(p)),l&&f.setLineDashOffset(l(p)),c&&f.setMiterLimit(c(p)),u&&f.setOffset(u(p)),f}}function Ple(i,e){let t="text-",n=mf(i,t+"value",e);if(!n)return null;let r=ry(i,t,e),s=ry(i,t+"background-",e),o=sy(i,t,e),a=sy(i,t+"background-",e),l=mf(i,t+"font",e),c=mo(i,t+"max-angle",e),u=mo(i,t+"offset-x",e),f=mo(i,t+"offset-y",e),p=Xg(i,t+"overflow",e),x=mf(i,t+"placement",e),v=mo(i,t+"repeat",e),w=kS(i,t+"scale",e),S=Xg(i,t+"rotate-with-view",e),T=mo(i,t+"rotation",e),P=mf(i,t+"align",e),R=mf(i,t+"justify",e),C=mf(i,t+"baseline",e),L=Xg(i,t+"keep-upright",e),D=Lq(i,t+"padding",e),F=GS(i,t+"declutter-mode"),N=new ff({declutterMode:F});return function(B){if(N.setText(n(B)),r&&N.setFill(r(B)),s&&N.setBackgroundFill(s(B)),o&&N.setStroke(o(B)),a&&N.setBackgroundStroke(a(B)),l&&N.setFont(l(B)),c&&N.setMaxAngle(c(B)),u&&N.setOffsetX(u(B)),f&&N.setOffsetY(f(B)),p&&N.setOverflow(p(B)),x){let z=x(B);if(z!=="point"&&z!=="line")throw new Error("Expected point or line for text-placement");N.setPlacement(z)}if(v&&N.setRepeat(v(B)),w&&N.setScale(w(B)),S&&N.setRotateWithView(S(B)),T&&N.setRotation(T(B)),P){let z=P(B);if(z!=="left"&&z!=="center"&&z!=="right"&&z!=="end"&&z!=="start")throw new Error("Expected left, right, center, start, or end for text-align");N.setTextAlign(z)}if(R){let z=R(B);if(z!=="left"&&z!=="right"&&z!=="center")throw new Error("Expected left, right, or center for text-justify");N.setJustify(z)}if(C){let z=C(B);if(z!=="bottom"&&z!=="top"&&z!=="middle"&&z!=="alphabetic"&&z!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");N.setTextBaseline(z)}return D&&N.setPadding(D(B)),L&&N.setKeepUpright(L(B)),N}}function Ile(i,e){return"icon-src"in i?Nle(i,e):"shape-points"in i?Lle(i,e):"circle-radius"in i?Dle(i,e):null}function Nle(i,e){let t="icon-",n=t+"src",r=Dq(i[n],n),s=BS(i,t+"anchor",e),o=kS(i,t+"scale",e),a=mo(i,t+"opacity",e),l=BS(i,t+"displacement",e),c=mo(i,t+"rotation",e),u=Xg(i,t+"rotate-with-view",e),f=Pq(i,t+"anchor-origin"),p=Iq(i,t+"anchor-x-units"),x=Iq(i,t+"anchor-y-units"),v=gf(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=US(i,t+"color",e):w=Fq(v,t+"color"));let T=Ble(i,t+"cross-origin"),P=Ule(i,t+"offset"),R=Pq(i,t+"offset-origin"),C=L5(i,t+"width"),L=L5(i,t+"height"),D=Ole(i,t+"size"),F=GS(i,t+"declutter-mode"),N={src:r,anchorOrigin:f,anchorXUnits:p,anchorYUnits:x,crossOrigin:T,offset:P,offsetOrigin:R,height:L,width:C,size:D,declutterMode:F},B=null;return function(z){if(B)S&&B.setColor(S(z));else{let V=S?S(z):w;B=new iA(V!==void 0?Object.assign({},N,{color:V}):Object.assign({},N))}return a&&B.setOpacity(a(z)),l&&B.setDisplacement(l(z)),c&&B.setRotation(c(z)),u&&B.setRotateWithView(u(z)),o&&B.setScale(o(z)),s&&B.setAnchor(s(z)),B}}function Lle(i,e){let t="shape-",n=t+"points",r=t+"radius",s=D5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=mo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=mo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=ry(i,t,e),p=sy(i,t,e),x=kS(i,t+"scale",e),v=BS(i,t+"displacement",e),w=mo(i,t+"rotation",e),S=Xg(i,t+"rotate-with-view",e),T=L5(i,t+"angle"),P=GS(i,t+"declutter-mode"),R=new uS({points:s,radius:a,radius2:u,angle:T,declutterMode:P});return function(C){return o&&R.setRadius(o(C)),c&&R.setRadius2(c(C)),f&&R.setFill(f(C)),p&&R.setStroke(p(C)),v&&R.setDisplacement(v(C)),w&&R.setRotation(w(C)),S&&R.setRotateWithView(S(C)),x&&R.setScale(x(C)),R}}function Dle(i,e){let t="circle-",n=ry(i,t,e),r=sy(i,t,e),s=mo(i,t+"radius",e),o=kS(i,t+"scale",e),a=BS(i,t+"displacement",e),l=mo(i,t+"rotation",e),c=Xg(i,t+"rotate-with-view",e),u=GS(i,t+"declutter-mode"),f=new hS({radius:5,declutterMode:u});return function(p){return s&&f.setRadius(s(p)),n&&f.setFill(n(p)),r&&f.setStroke(r(p)),a&&f.setDisplacement(a(p)),l&&f.setRotation(l(p)),c&&f.setRotateWithView(c(p)),o&&f.setScale(o(p)),f}}function gf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function mo(i,e,t){let n=gf(i,e);if(n===void 0)return;let r=Gc(n,si,t);return function(s){return D5(r(s),e)}}function mf(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,ko,t);return function(s){return Dq(r(s),e)}}function Fle(i,e,t){let n=mf(i,e+"pattern-src",t),r=Rq(i,e+"pattern-offset",t),s=Rq(i,e+"pattern-size",t),o=US(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Xg(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,Uo,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function US(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,la,t);return function(s){return Fq(r(s),e)}}function Lq(i,e,t){let n=gf(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=Gc(o,si,t);return function(c){return D5(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=Gc(n,Af,t);return function(s){return oy(r(s),e)}}function BS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,Af,t);return function(s){let o=oy(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function Rq(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,Af,t);return function(s){return Oq(r(s),e)}}function kS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,Af|si,t);return function(s){return kle(r(s),e)}}function L5(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 Ole(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return jr(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 Ble(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 Pq(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 Iq(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 Ule(i,e){let t=i[e];if(t!==void 0)return oy(t,e)}function GS(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 oy(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 Dq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function D5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function Fq(i,e){if(typeof i=="string")return i;let t=oy(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 Oq(i,e){let t=oy(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function kle(i,e){return typeof i=="number"?i:Oq(i,e)}var Bq={RENDER_ORDER:"renderOrder"},F5=class extends aA{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(Bq.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 lA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Bq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?PI:e;let t=Gle(e);this.styleFunction_=e===null?void 0:dV(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function Gle(i){if(i===void 0)return PI;if(!i)return null;if(typeof i=="function"||i instanceof ws)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof ws){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof ws))throw new Error("Expected a list of style instances");n[r]=s}return n}return Nq(i)}var zS=F5;var O5=class extends Zs{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},VS=O5;var B5=class extends wd{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Zn()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;uo(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Uw(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(C,L,D,F){return s.call(o,L,C?D:null,F)}let p=u.projection,x=yw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=jn(C);v.push([-L,0],[L,0])}let w=t.layerStatesArray,S=w.length,T=[],P=[];for(let C=0;C<v.length;C++)for(let L=S-1;L>=0;--L){let D=w[L],F=D.layer;if(F.hasRenderer()&&Qx(D,u)&&a.call(l,F)){let N=F.getRenderer(),B=F.getSource();if(N&&B){let z=B.getWrapX()?x:e,V=f.bind(null,D.managed);P[0]=z[0]+v[C][0],P[1]=z[1]+v[C][1],c=N.forEachFeatureAtCoordinate(P,t,n,V,T)}if(c)return c}}if(T.length===0)return;let R=1/T.length;return T.forEach((C,L)=>C.distanceSq+=L*R),T.sort((C,L)=>C.distanceSq-L.distanceSq),T.some(C=>c=C.callback(C.feature,C.layer,C.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,rf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){Zn()}scheduleExpireIconCache(e){Oo.canExpireCache()&&e.postRenderFunctions.push(zle)}};function zle(i,e){Oo.expire()}var Uq=B5;var U5=class extends Uq{constructor(e){super(e),this.fontChangeListenerKey_=kn(tA,Nc.PROPERTYCHANGE,e.redrawText,e),this.element_=Us?Fw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Nd+" 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 VS(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ri(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(Ao.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof zS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;dl(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 p=t[u];e.layerIndex=u;let x=p.layer,v=x.getSourceState();if(!Qx(p,r)||v!="ready"&&v!="undefined"){x.unrender();continue}let w=x.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(p))}this.declutter(e,l),oz(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!dl(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!dl(f)||f.width===0)continue;a.save();let x=u.style.opacity||f.style.opacity;a.globalAlpha=x===""?1:Number(x);let v=f.style.transform;if(v)a.transform(...Bw(v));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(Ao.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))}}},kq=U5;function Gq(i){if(i instanceof aA){i.setMapInternal(null);return}i instanceof Kx&&i.getLayers().forEach(Gq)}function zq(i,e){if(i instanceof aA){i.setMapInternal(e);return}if(i instanceof Kx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)zq(t[n],e)}}var k5=class extends bs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=Vle(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:ez,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Ks(),this.pixelToCoordinateTransform_=Ks(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Us||(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,Us||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Us?new fo:yS()),this.interactions=t.interactions||(Us?new fo:ES({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new YV(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(po.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(po.VIEW,this.handleViewChanged_),this.addChangeListener(po.SIZE,this.handleSizeChanged_),this.addChangeListener(po.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof pl)&&e.view.then(function(r){n.setView(new pl(r))}),this.controls.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Qs.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Qs.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){zq(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:rf,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 Kx?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:rf,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(po.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Tx(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Ir(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(po.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=Rc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Ir(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(po.SIZE)}getView(){return this.get(po.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 ZV(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Lu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===$x.POINTERDOWN||n===Jt.WHEEL||n===Jt.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[Gs.ANIMATING]||o[Gs.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(Ao.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Ao.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Dd(Du.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Dd(Du.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)ri(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!dl(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(dl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new kq(this)),!dl(t)){this.mapBrowserEventHandler_=new XV(this,this.moveTolerance_);for(let r in rr)this.mapBrowserEventHandler_.addEventListener(rr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,Dw?{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_=[kn(n,Jt.KEYDOWN,this.handleBrowserEvent,this),kn(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!dl(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_&&(ri(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ri(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=kn(e,Nc.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=kn(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ri),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Uc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[kn(e,Nc.PROPERTYCHANGE,this.render,this),kn(e,Jt.CHANGE,this.render,this),kn(e,"addlayer",this.handleLayerAdd_,this),kn(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){Gq(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&&xP(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:vx(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:Ln(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=vx(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_||!bu(this.previousExtent_)&&!G0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Dd(Du.MOVESTART,this,r)),this.previousExtent_=k0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Gs.ANIMATING]&&!s.viewHints[Gs.INTERACTING]&&!G0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Dd(Du.MOVEEND,this,s)),fw(s.extent,this.previousExtent_))),this.dispatchEvent(new Dd(Du.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Du.LOADSTART)||this.hasListener(Du.LOADEND)||this.hasListener(Ao.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 Uc("removelayer",t)),this.set(po.LAYERGROUP,e)}setSize(e){this.set(po.SIZE,e)}setTarget(e){this.set(po.TARGET,e)}setView(e){if(!e||e instanceof pl){this.set(po.VIEW,e);return}this.set(po.VIEW,new pl);let t=this;e.then(function(n){t.setView(new pl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(dl(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)],!xP(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&gw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Fo(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function Vle(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 Kx({layers:i.layers});t[po.LAYERGROUP]=n,t[po.TARGET]=i.target,t[po.VIEW]=i.view instanceof pl?i.view:new pl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new fo(i.controls.slice()):(Vn(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()):(Vn(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()):(Vn(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 Vq=k5;function qS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var qle=new Error("disposed");var Hle=[256,256],G5=class extends Eg{constructor(e){let t=rn.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=qS(this.data_);return e?[e.width,e.height]:Hle}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==rn.IDLE&&this.state!==rn.ERROR)return;this.state=rn.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=rn.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=rn.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(qle),this.controller_=null),super.disposeInternal()}},z5=G5;var V5=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 wd&&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 Vn(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 Vn(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){Vn(!(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}},q5=V5;var H5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Cx(),{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}},HS=H5;var Wle=5,W5=class extends Gw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=Wle,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 Zn()}getData(e){return null}prepareFrame(e){return Zn()}renderFrame(e,t){return Zn()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Mn.LOADED||t.getState()===Mn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Mn.LOADED&&t!=Mn.ERROR&&e.addEventListener(Jt.CHANGE,this.boundHandleImageChange_),t==Mn.IDLE&&(e.load(),t=e.getState()),t==Mn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},qq=W5;var X5=[],$g=null;function jle(){$g=Ti(1,1,void 0,{willReadFrequently:!0})}var j5=class extends qq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Ks(),this.pixelTransform=Ks(),this.inversePixelTransform=Ks(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){$g||jle(),$g.clearRect(0,0,1,1);let r;try{$g.drawImage(e,t,n,1,1,0,0,1,1),r=$g.getImageData(0,0,1,1).data}catch{return $g=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(dl(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&&Fo(Yl(e.style.backgroundColor),Yl(n)))){let c=e.firstElementChild;dl(c)&&(l=c.getContext("2d"))}if(l&&dz(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=Us?Fw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Ti();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=Hl(n),s=dg(n),o=fg(n),a=hg(n);Ir(t.coordinateToPixelTransform,r),Ir(t.coordinateToPixelTransform,s),Ir(t.coordinateToPixelTransform,o),Ir(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Ir(l,r),Ir(l,s),Ir(l,o),Ir(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(jn(n)/r*o),l=Math.round(xr(n)/r*o);uo(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Uw(this.inversePixelTransform,this.pixelTransform);let c=fz(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 VS(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Ao.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Ao.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new HS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Ao.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Ao.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,p=-e[0]+a,x=-e[1];return uo(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},WS=j5;function $5(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 Xle(i,e,t){let n=i[t];return n?n.delete(e):!1}function Hq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=vu(e,Pc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=vu(e,r))}return e}var Y5=class extends WS{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=Pr(),this.tempTileRange_=new Rw(0,0,0,0),this.tempTileCoord_=bg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new q5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new q5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=wg(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||xg(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=Ir(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!Sc(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),p=this.getTile(u,f[1],f[2],t);if(!p||p.getState()!==rn.LOADED)continue;let x=l.getOrigin(u),v=jr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof Ow||p instanceof kw)S=p.getImage();else if(p instanceof z5){if(S=qS(p.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-x[0])/w-f[1]*v[0])),P=Math.floor(c*((x[1]-r[1])/w-f[2]*v[1])),R=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+R,P+R)}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=Ln(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],p=a.getMapInternal(),x=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),p?p.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),v=o.rotation,w=v?rP(o.center,o.resolution,v,e.size):void 0;for(let S=n;S>=x;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),P=c.getResolution(S);for(let R=T.minX;R<=T.maxX;++R)for(let C=T.minY;C<=T.maxY;++C){if(v&&!c.tileCoordIntersectsViewport([S,R,C],w))continue;let L=this.getTile(S,R,C,e);if(!L||!$5(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=bg(S,R,C,this.tempTileCoord_);e.tileQueue.enqueue([L,u,c.getTileCoordCenter(N),P])}}}}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=wg(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===rn.LOADED)return u.endTransition(Ln(this)),$5(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 p=wg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&($5(r,v,n),x=!0)}x||(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),p=f.getZForResolution(o,u.zDirection),x=f.getResolution(p);this.updateStaleKeys(u.getKey());let v=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?Pc(n.extent,s):null,this.layerExtent&&(v=vu(v,this.layerExtent));let P=x*S/2/w,R=x*T/2/w,C=[a[0]-P,a[1]-R,a[0]+P,a[1]+R],L={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let K=f.getZForResolution(r.nextResolution,u.zDirection),ee=Hq(e,e.nextExtent);this.enqueueTiles(e,ee,K,L,D)}let F=Hq(e,v);if(this.enqueueTiles(e,F,p,L,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,F,p-1,L,D-1)},0),!(p in L))return this.container;let N=Ln(this),B=e.time;for(let K of L[p]){let ee=K.getState();if(ee===rn.EMPTY)continue;let ae=K.tileCoord;if(ee===rn.LOADED&&K.getAlpha(N,B)===1){K.endTransition(N);continue}if(ee!==rn.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ae,L)){Xle(L,K,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let be=f.getMinZoom();for(let Ie=p-1;Ie>=be&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);uo(this.tempTransform,S/2,T/2,z,z,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(V,e,this.layerExtent),u.getInterpolate()||(V.imageSmoothingEnabled=!1),this.preRender(V,e);let H=Object.keys(L).map(Number);H.sort(za);let Z=[],J=[],j=[];for(let K=H.length-1;K>=0;--K){let ee=H[K],ae=u.getTilePixelSize(ee,l,s),de=f.getResolution(ee)/x,be=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(Hl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Ir(this.tempTransform,[w*(Ue[0]-C[0])/x,w*(C[3]-Ue[3])/x]),Me=w*u.getGutterForProjection(s);for(let ze of L[ee]){if(ze.getState()!==rn.LOADED)continue;let $e=ze.tileCoord,Et=Qe[1]-$e[1],Tt=Math.round(mt[0]-(Et-1)*be),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*be),Xe=Math.round(mt[1]-Ct*Ie),st=Tt-Gt,tt=un-Xe,vt=ee===p;if(vt&&ze.inTransition(N)){j.push({tile:ze,x:Gt,y:Xe,w:st,h:tt,gutter:Me}),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze);continue}let yt=[Gt,Xe,Gt+st,Xe+tt],ln=[];for(let Qt=0,xn=Z.length;Qt<xn;++Qt)ee<J[Qt]&&yr(yt,Z[Qt])&&ln.push(Z[Qt]);let Kt;ln.length>0&&(Kt=lG(yt,ln)),Z.push(yt),J.push(ee),this.drawTile(ze,e,Gt,Xe,st,tt,Me,vt,Kt),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze)}}for(let K=0,ee=j.length;K<ee;++K){let{tile:ae,x:ce,y:de,w:be,h:Ie,gutter:Qe}=j[K];this.drawTile(ae,e,ce,de,be,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!G0(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&V.restore(),V.imageSmoothingEnabled=!0,this.renderComplete){let K=(ee,ae)=>{let ce=Ln(u),de=ae.wantedTiles[ce],be=de?Object.keys(de).length:0;this.updateCacheSize(be),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(K)}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 z5){if(u=qS(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),p=Ln(this),x=t.layerStatesArray[t.layerIndex],v=x.opacity*(l?e.getAlpha(p,t.time):1),w=v!==f.globalAlpha;w&&(f.save(),f.globalAlpha=v);let S=u.width-2*a,T=u.height-2*a;if(c){let P=S/s,R=T/o;for(let C=0,L=c.length;C<L;++C){let D=c[C],F=D[0],N=D[1],B=D[2]-D[0],z=D[3]-D[1];f.drawImage(u,a+(F-n)*P,a+(N-r)*R,B*P,z*R,F,N,B,z)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),v!==x.opacity?t.animate=!0:l&&e.endTransition(p)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Ln(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Wq=Y5;var ay={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var Z5=class extends aA{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(ay.PRELOAD)}setPreload(e){this.set(ay.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(ay.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(ay.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},jq=Z5;var K5=class extends jq{constructor(e){super(e)}createRenderer(){return new Wq(this,{cacheSize:this.getCacheSize()})}},Q5=K5;var J5=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){}},jS=J5;var ly={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},cy=[ly.FILL],Bu=[ly.STROKE],_f=[ly.BEGIN_PATH],eN=[ly.CLOSE_PATH],An=ly;var tN=class extends jS{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],Sc(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],p=this.tmpCoordinate_,x=!0,v,w,S;for(v=t+r;v<n;v+=r)p[0]=e[v],p[1]=e[v+1],S=hw(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===ys.INTERSECTING?(a[l++]=p[0],a[l++]=p[1],x=!1):x=!0,u=p[0],f=p[1],w=S;return(s&&x||v===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,p,x;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),p=[];let v=e.getEndss();x=0;for(let w=0,S=v.length;w<S;++w){let T=[];x=this.drawCustomCoordinates_(c,x,v[w],a,T),p.push(T)}this.instructions.push([An.CUSTOM,l,p,e,n,Px,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,Px,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),x=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([An.CUSTOM,l,f,e,n,Pg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,Pg,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([An.CUSTOM,l,u,e,n,Eu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Eu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,Eu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Eu,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([An.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[An.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[An.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==An.END_GEOMETRY?o=t:s==An.BEGIN_GEOMETRY&&(r[2]=t,GG(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=qa(n||ks)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=qa(n||Bo);let r=e.getLineCap();t.lineCap=r!==void 0?r:Iu;let s=e.getLineDash();t.lineDash=s?s.slice():Ha;let o=e.getLineDashOffset();t.lineDashOffset=o||Wa;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Nu;let l=e.getWidth();t.lineWidth=l!==void 0?l:hf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:cf;let u=e.getOffset();t.strokeOffset=u??sV,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=[An.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[An.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&&!Fo(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=[An.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=fw(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;cg(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Uu=tN;var nN=class extends Uu{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&&!Sc(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([An.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([An.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||Sc(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([An.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([An.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}},Xq=nN;var iN=class extends Uu{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([An.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([An.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([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ha,Wa],_f);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Bu),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([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ha,Wa],_f);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinates_(c,f,l[p],u,a);this.hitDetectionInstructions.push(Bu),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Bu),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Bu),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(_f)}},$q=iN;var rN=class extends Uu{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(_f),this.hitDetectionInstructions.push(_f);for(let u=0;u<c;++u){let f=n[u],p=this.coordinates.length,x=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([An.MOVE_TO_LINE_TO,p,x,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,p,x,s,!0]),l&&(this.instructions.push(eN),this.hitDetectionInstructions.push(eN)),t=f}return a&&(this.instructions.push(cy),this.hitDetectionInstructions.push(cy)),l&&(this.instructions.push(Bu),this.hitDetectionInstructions.push(Bu)),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([An.SET_FILL_STYLE,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ha,Wa]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[An.CIRCLE,u,a];this.instructions.push(_f,f),this.hitDetectionInstructions.push(_f,f),r.fillStyle!==void 0&&(this.instructions.push(cy),this.hitDetectionInstructions.push(cy)),r.strokeStyle!==void 0&&(this.instructions.push(Bu),this.hitDetectionInstructions.push(Bu)),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([An.SET_FILL_STYLE,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ha,Wa]);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([An.SET_FILL_STYLE,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ha,Wa]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinatess_(c,f,l[p],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]=Ed(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}},sN=rN;var oN=0,aN=1;function $le(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 p=(i-r)/l,x=(t-r)/l;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let p=(e-s)/c,x=(n-s)/c;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}return oN=u,aN=f,!0}function Yq(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,p,x=0;for(let v=0,w=e.length;v<w;++v){let S=e[v],T=i[x],P=i[x+1],R=!1;for(let C=x+t;C<S;C+=t){let L=i[C],D=i[C+1];if($le(r,s,o,a,T,P,L,D)){let F=L-T,N=D-P,B=T+oN*F,z=P+oN*N,V=T+aN*F,H=P+aN*N;u&&R&&B===f&&z===p?l.push(V,H):(u&&c.push(l.length),l.push(B,z,V,H),u=!0),f=V,p=H,R=!0}T=L,P=D}x=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function Zq(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],p=e[o+r+1],x=Math.sqrt((f-c)*(f-c)+(p-u)*(p-u));if(a+=x,a>=i){let v=(i-a+x)/x,w=Do(c,f,v),S=Do(u,p,v);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 v=x-a,w=Do(c,f,v/x),S=Do(u,p,v/x);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function Kq(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,p,x,v,w,S,T,P,R;for(f=t;f<n;f+=r){let C=e[f],L=e[f+1];v!==void 0&&(P=C-v,R=L-w,x=Math.sqrt(P*P+R*R),S!==void 0&&(l+=p,u=Math.acos((S*P+T*R)/(p*x)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),p=x,S=P,T=R),v=C,w=L}return l+=x,l>a?[c,f]:[s,o]}var uy={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},lN=class extends Uu{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[ks]={fillStyle:ks},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 p=e.getExtent();if(!yr(this.maxExtent,p))return;let x;if(u=e.getFlatCoordinates(),c=="LineString")x=[u.length];else if(c=="MultiLineString")x=e.getEnds();else if(c=="Polygon")x=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();x=[];for(let P=0,R=T.length;P<R;++P)x.push(T[P][0])}if((c=="LineString"||c=="MultiLineString")&&!yu(this.getBufferedMaxExtent(),p)){let T=Yq(u,x,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,x=T.ends,f=2,x.length===0)return}this.beginGeometry(e,t,n);let v=o.repeat,w=v?void 0:o.textAlign,S=0;for(let T=0,P=x.length;T<P;++T){let R;v?R=Zq(v*this.resolution,u,S,x[T],f):R=[u.slice(S,x[T])];for(let C=0,L=R.length;C<L;++C){let D=R[C],F=0,N=D.length;if(w==null){let z=Kq(o.maxAngle,D,0,D.length,2);F=z[0],N=z[1]}for(let z=F;z<N;z+=f)a.push(D[z],D[z+1]);let B=a.length;S=x[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let p=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||p.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let C=e.getFlatInteriorPoints();u=[];for(let L=0,D=C.length;L<D;L+=3)o.overflow||p.push(C[L+2]/this.resolution),u.push(C[L],C[L+1]);if(u.length===0)return;f=2;break;default:}let x=this.appendFlatPointCoordinates(u,f);if(x===l)return;if(p&&(x-l)/2!==u.length/f){let C=l/2;p=p.filter((L,D)=>{let F=a[(C+D)*2]===u[D*f]&&a[(C+D)*2+1]===u[D*f+1];return F||--C,F})}this.saveTextStates_();let v=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!=uf&&(o.scale[0]<0||o.scale[1]<0)){let C=o.padding[0],L=o.padding[1],D=o.padding[2],F=o.padding[3];o.scale[0]<0&&(L=-L,F=-F),o.scale[1]<0&&(C=-C,D=-D),S=[C,L,D,F]}let T=this.pixelRatio;this.instructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==uf?uf:S.map(function(C){return C*T}),v,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);let P=1/T,R=v?v.slice(0):null;R&&(R[1]=ks),this.hitDetectionInstructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[P,P],NaN,this.declutterMode_,this.declutterImageWithText_,S,R,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ks:this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]),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||Ld,justify:t.justify,textBaseline:t.textBaseline||nA,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=uy[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,p=this.text_,x=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,x*l,p,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a&&ks,r.maxAngle,l,f,s,x*l,p,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=qa(o.getColor()||ks)):(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(),P=a.getMiterLimit();s.lineCap=a.getLineCap()||Iu,s.lineDash=w?w.slice():Ha,s.lineDashOffset=S===void 0?Wa:S,s.lineJoin=a.getLineJoin()||Nu,s.lineWidth=T===void 0?hf:T,s.miterLimit=P===void 0?cf:P,s.strokeStyle=qa(a.getColor()||Bo)}n=this.textState_;let l=e.getFont()||lS;oV(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()||nA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||uf,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),p=e.getRotateWithView(),x=e.getKeepUpright(),v=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=p===void 0?!1:p,this.textKeepUpright_=x===void 0?!0:x,this.textRotation_=v===void 0?0:v,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Ln(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:"|"+Ln(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Qq=lN;var Yle={Circle:sN,Default:Uu,Image:Xq,LineString:$q,Polygon:sN,Text:Qq},cN=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=Yle[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},Jq=cN;function eH(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}function XS(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],p,x,v,w,S,T,P,R,C=0;for(let L=e;L<t;L+=n){v=p,w=x,S=void 0,T=void 0,L+n<t&&(S=i[L+n],T=i[L+n+1]),s&&L===e&&(v=u,w=f),s&&L===t-n&&(S=l,T=c),p=i[L],x=i[L+1],[P,R]=Zle(p,x,v,w,S,T,r),o[C++]=P,o[C++]=R;for(let D=2;D<a;D++)o[C++]=i[L+D]}return o.length!=C&&(o.length=C),o}function Zle(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 p=AG([i,e],[t,n],[r,s]);if(Math.cos(p)>.998)return[i+u*o,e+f*o];let x=Math.cos(p/2),v=Math.sin(p/2),w=v*a+x*l,S=-x*a+v*l,T=w*(1/v),P=S*(1/v);return[i+T*o,e+P*o]}function $S(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],p=i[o+1],x=i[o+e],v=i[o+e+1],w=(v-p)*(c-a)-(x-f)*(u-l);if(w===0)continue;let S=((x-f)*(l-p)-(v-p)*(a-f))/w,T=((c-a)*(l-p)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let P=a+S*(c-a),R=l+S*(u-l);i[n+e]=P,i[n+e+1]=R,i.splice(n+2*e,o-n-e);break}}}return i}var uN;function Kle(){return uN||(uN=new Intl.Segmenter(void 0,{granularity:"grapheme"})),uN}function tH(i,e,t,n,r,s,o,a,l,c,u,f,p=!0){let x=i[e],v=i[e+1],w=0,S=0,T=0,P=0;function R(){w=x,S=v,e+=n,x=i[e],v=i[e+1],P+=T,T=Math.sqrt((x-w)*(x-w)+(v-S)*(v-S))}do R();while(e<t-n&&P+T<s);let C=T===0?0:(s-P)/T,L=Do(w,x,C),D=Do(S,v,C),F=e-n,N=P,B=s+a*l(c,r,u);for(;e<t-n&&P+T<B;)R();C=T===0?0:(B-P)/T;let z=Do(w,x,C),V=Do(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Ww(ae,0,4,2,f,ae,ae),H=ae[0]>ae[2]}else H=L>z;let Z=Math.PI,J=[],j=F+n===e;e=F,T=0,P=N,x=i[e],v=i[e+1];let K;if(j){R(),K=Math.atan2(v-S,x-w),H&&(K+=K>0?-Z:Z);let ae=(z+L)/2,ce=(V+D)/2;return J[0]=[ae,ce,(B-s)/2,K,r],J}r=r.replace(/\n/g," ");let ee=Array.from(Kle().segment(r),ae=>ae.segment);for(let ae=0,ce=ee.length;ae<ce;){R();let de=Math.atan2(v-S,x-w);if(H&&(de+=de>0?-Z:Z),K!==void 0){let Me=de-K;if(Me+=Me>Z?-2*Z:Me<-Z?2*Z:0,Math.abs(Me)>o)return null}K=de;let be=ae,Ie=0;for(;ae<ce;++ae){let Me=H?ce-ae-1:ae,ze=a*l(c,ee[Me],u);if(e+n<t&&P+T<s+Ie+ze/2)break;Ie+=ze}if(ae===be)continue;let Qe=(H?ee.slice(ce-ae,ce-be):ee.slice(be,ae)).join("");C=T===0?0:(s+Ie/2-P)/T;let Ue=Do(w,x,C),mt=Do(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var Yg=Pr(),Ud=[],xf=[],yf=[],kd=[];function nH(i){return i[3].declutterBox}var iH=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function hN(i,e){return e==="start"?e=iH.test(i)?"right":"left":e==="end"&&(e=iH.test(i)?"left":"right"),uy[e]}function Qle(i,e,t){return t>0&&i.push(`6+`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let p=e[c+1]||i.font,x=lV(p,f);t.push(x),o+=x;let v=bae(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function uV(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]),wae(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 wae(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 wI=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=jr(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 Zn()}getImage(e){return Zn()}getHitDetectionImage(){return Zn()}getPixelRatio(e){return 1}getImageState(){return Zn()}getImageSize(){return Zn()}getOrigin(){return Zn()}getSize(){return Zn()}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_=jr(e)}listenImageChange(e){Zn()}load(){Zn()}unlistenImageChange(e){Zn()}ready(){return Promise.resolve()}},cS=wI;var SI=class i extends cS{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()?Mn.LOADING:Mn.LOADED,this.imageState_===Mn.LOADING&&this.ready().then(()=>this.imageState_=Mn.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=Oo.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Ti(o,o);this.draw_(s,a,e),r=a.canvas;let l=new nV(r,void 0,null,Mn.LOADED,null);Oo.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),p=f/l;if(e==="miter"&&p<=n)return p*t;let x=t/2/p,v=t/2*(u/f),S=Math.sqrt((r+x)*(r+x)+v*v)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),P=Math.sqrt(r*r-T*T),R=s-P,L=Math.sqrt(T*T+R*R)/T;if(L<=n){let D=L*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=Iu,t=Nu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=qa(this.stroke_.getColor()??Bo),a=this.stroke_.getWidth()??hf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Nu,e=this.stroke_.getLineCap()??Iu,n=this.stroke_.getMiterLimit()??cf);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=ks),t.fillStyle=qa(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=Yl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Ti(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=ks,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()}},uS=SI;var TI=class i extends uS{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}},hS=TI;var EI=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=Id(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()===Mn.IDLE&&t.load(),t.getImageState()===Mn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Ln(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Yl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},Xr=EI;function hV(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 MI=class i extends cS{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;Vn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Ln(o)),Vn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Vn(!((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=Mn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Mn.LOADED:Mn.IDLE:l=Mn.LOADING:l=Mn.LOADED),this.color_=e.color!==void 0?Yl(e.color):null,this.iconImage_=Id(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 p=()=>{if(this.unlistenImageChange(p),!this.initialOptions_)return;let x=this.iconImage_.getSize();this.setScale(hV(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(hV(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?Yl(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?Mn.IDLE:this.iconImage_.getImageState();this.iconImage_=Id(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_=Id(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Mn.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()==Mn.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()==Mn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(Jt.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(Jt.CHANGE,e)}ready(){return this.iconImage_.ready()}},iA=MI;var CI=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}},ho=CI;var fS=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=fV,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_=fV,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function dV(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(Vn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var RI=null;function PI(i,e){if(!RI){let t=new Xr({color:"rgba(255,255,255,0.4)"}),n=new ho({color:"#3399CC",width:1.25});RI=[new fS({image:new hS({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return RI}function fV(i){return i.getGeometry()}var ws=fS;var Sae="#333",II=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_=jr(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 Xr({color:Sae}),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 Xr?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_=jr(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}},ff=II;function Zl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function mV(i){let e=i.get("pin");return!e||Kl(e)||e.insideHighlightedZone||Fg(e)?null:NI(e,!1)}function gV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Kl(e)||Fg(e)?null:NI(e,!1)}function _V(i){let e=i.get("pin");return!e||Kl(e)||!U.labelsHeld?null:wV(e)}function xV(i){let e=i.get("pin");if(!e||Kl(e)||e.insideHighlightedZone||Fg(e)||jx())return null;if(U.labelsHeld)return Hx(e,!1);let t=U.fitZoom+Math.log2(IV(e.category));return(U.engine.getView().getZoom()||0)<t?null:Hx(e,!1)}function yV(i){let e=i.get("pin");return!e||Kl(e)||e.insideHighlightedZone||Fg(e)||!jx()?null:Hx(e,!1)}function vV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Kl(e)||Fg(e)?null:Hx(e,!1)}function bV(i){let e=i.get("pin");if(!e||Kl(e))return null;if(Pu(e.category)==="text")return Hx(e,e===U.selectedPin);let t=NI(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,wV(e)]:t}function NI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=eA(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Wx(i.category)),o;return s?o=new ws({image:new iA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new ws({text:new ff({text:Oc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new Xr({color:n}),stroke:new ho({color:J0(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function wV(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new ws({text:new ff({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new Xr({color:"#f2ece0"}),stroke:new ho({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new Xr({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return U.styleCache.set(e,t),t}function SV(i){if(!i.iconAsset)return;let e=Wx(i);if(U.markerIcons.has(e))return;U.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=eA(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=J0(),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),U.markerIcons.set(e,n.toDataURL("image/png")),Tae(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=lI(i.iconAsset)}function Tae(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Wx(i){return`${i.iconAsset||""}:${eA(i)}:${U.map?.iconOutset||"light"}`}function Hx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new ws({text:new ff({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new Xr({color:e?"#7fd0ea":"#f2ece0"}),stroke:new ho({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new Xr({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new ho({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return U.styleCache.set(t,r),r}function dS(i,e){return`${i} ${e}px ${Li.labelFont}`}function LI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Li.neighborLabelSizePx:Li.labelSizePx,s=dS(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=Eae(t,s,r,o,e),l=Zw(t,{subgridVisible:U.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(U.styleCache.has(c))return U.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new ws({fill:l.fill?new Xr({color:af(l.fill.color,l.fill.opacity)}):void 0,stroke:new ho({color:af(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let p=l.label.prefix?[l.label.prefix,dS(500,r),l.label.final,dS(900,r)]:l.label.final,x=Li.labelInsetPx*e;f.push(new ws({geometry:new Dc([t.extent[2]-x,t.extent[1]+x]),text:new ff({text:p,font:dS(900,r),textAlign:"right",textBaseline:"bottom",fill:new Xr({color:af(l.label.color,l.label.textAlpha)}),backgroundFill:new Xr({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return U.styleCache.set(c,f),f}function Eae(i,e,t,n,r){if(!r)return!0;let s=DI(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 pV=document.createElement("canvas").getContext("2d"),AV=new Map;function DI(i,e){let t=`${e}|${i}`,n=AV.get(t);return n===void 0&&(pV.font=e,n=pV.measureText(i).width,AV.set(t,n)),n}var Mae=new ws({fill:new Xr({color:"rgba(5, 8, 16, 0.62)"})});function TV(){return U.zonesVisible?Mae:null}function EV(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=PV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color");if(r){let c=new ws({stroke:new ho({color:af(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return U.styleCache.set(s,c),c}let a=new ws({fill:new Xr({color:af(o,t?.035:.07)}),stroke:new ho({color:af(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return U.styleCache.set(s,a),a;let l=[new ws({stroke:new ho({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new ws({fill:new Xr({color:af(o,.22)}),stroke:new ho({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function MV(i){if(!U.zonesVisible||jx())return null;let e=i.get("child"),t=U.highlightedZones.has(i.get("zone").id),n=U.engine.getView().getZoom()||0;if(!t&&e&&n<U.fitZoom+3)return null;let r=i.get("span")/U.engine.getView().getResolution();return!t&&U.zoneTitleCount>40&&r<52?null:RV(i)}function CV(i){return!U.zonesVisible||!jx()?null:RV(i)}function RV(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=PV(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color"),a=new ws({text:new ff({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new Xr({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new ho({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 Xr({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new ho({color:n?"#ffffff":af(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return U.styleCache.set(s,a),a}function PV(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(Cae(i,e))return!1;return!0}function Cae(i,e){let t=new Set,n=U.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=U.zoneRecords.get(n)?.zone.parentRegionId}return!1}var FI=class i extends Tu{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Ic(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<gd(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=Tc(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 Eu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Dc(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 Dc(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(xx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Rx(this.flatCoordinates,0,e,this.stride),this.changed()}},NV=FI;function pS(i,e,t,n){let r=[],s=Pr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=ug(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 OI=class i extends Tu{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 p=0,x=f.length;p<x;++p)f[p]+=u;Ic(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;Ic(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<gd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Oz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Bz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return qG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Dz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),rI(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Px(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=pS(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=jw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new NV(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;zz(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=rI(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=kz(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 Mu(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,p=l.length;f<p;++f)l[f]-=s;let u=new Mu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return WG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Lz(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()}},LV=OI;function BI(){let i=(U.map.zones||[]).filter(GI);U.renderedShard=U.variant?.shard||0,U.sources.zones.clear(),U.sources.zoneTitles.clear(),U.zoneRecords.clear(),U.highlightedZones.clear(),U.focusedZoneID=null,U.zoneTitleCount=0,AS(!0),ye.zoneIndex.hidden=i.length===0,ye.zoneCount.textContent=Bc(i.length);for(let e of i){let t=Pr(),n=[],r=!1;for(let l of e.features||[]){let c=Iae(l);c&&(r=!0,n.push(c),pw(t,c.getExtent()),U.sources.zones.addFeature(new Td({geometry:c,zone:e,color:Jw(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=Jw(e.id),o=e.center?Og(e.center.lat,e.center.lng):Ga(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new Td({geometry:new Dc(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),U.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}U.zoneTitleCount=U.sources.zoneTitles.getFeatures().length,FV(),Rae()}function FV(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[DV([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of U.highlightedZones)for(let o of U.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(DV(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new Td({geometry:new Mu(r)}))}function DV(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 Rae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of Pae()){let n=U.zoneRecords.get(e.id);if(!n)continue;let r=document.createElement("button");r.type="button",r.className="zone-index-item",r.dataset.zone=String(e.id),r.style.setProperty("--zone-color",n.color),r.style.setProperty("--zone-depth",String(t)),r.setAttribute("aria-pressed","false"),r.title=`${e.title}: click to jump; right-click to toggle highlight`;let s=document.createElement("span");s.className="zone-index-marker",s.setAttribute("aria-hidden","true");let o=document.createElement("span");o.textContent=e.title,r.append(s,o),i.append(r)}ye.zoneList.replaceChildren(i),ye.zoneIndex.hidden=U.zoneRecords.size===0}function Pae(){let i=[...U.zoneRecords.values()].map(o=>o.zone),e=new Set(i.map(o=>o.id)),t=new Map;for(let o of i){let a=e.has(o.parentRegionId)?o.parentRegionId:null;t.has(a)||t.set(a,[]),t.get(a).push(o)}for(let o of t.values())o.sort((a,l)=>a.title.localeCompare(l.title,void 0,{numeric:!0,sensitivity:"base"}));let n=[],r=new Set,s=(o,a)=>{if(!r.has(o.id)){r.add(o.id),n.push({zone:o,depth:a});for(let l of t.get(o.id)||[])s(l,a+1)}};for(let o of t.get(null)||[])s(o,0);for(let o of i)s(o,0);return n}function AS(i){U.zonesVisible=i,ye.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function OV(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,UV(),Fc(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:Ru(U.variant),duration:220}),ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"))}function BV(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),AS(!0)),U.hoveredPin=null,UI(),kI(),UV(),FV(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function UV(){ye.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of ye.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=U.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",U.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function Iae(i){if(!i?.coordinates)return null;let e=([t,n])=>Og(n,t);return i.type==="Polygon"?new Mu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new LV(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Og(i,e){let t=Nae(),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 Nae(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function kV(){U.sources.pins.clear(),U.sources.text.clear(),U.sources.priority.clear(),U.pins=[],U.pinByID.clear();for(let i of U.map.groups)for(let e of i.categories){Pu(e)!=="text"&&SV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Og(t.lat,t.lng),filteredHidden:!1,priority:Oae(e,t),feature:null};n.feature=new Td({geometry:new Dc(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),Pu(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}$l()}function $l(){for(let i of U.pins){let e=U.hiddenCategories.has(i.category.id),t=U.search&&!i.location.title.toLocaleLowerCase().includes(U.search);i.filteredHidden=!!(e||t)}UI(),kI(),U.selectedPin?.filteredHidden&&Fc(),Rd(),document.dispatchEvent(new Event("atlas:filters"))}function UI(){if(!U.highlightedZones.size){for(let e of U.pins)e.insideHighlightedZone=!1;return}let i=[...U.highlightedZones].map(e=>U.zoneRecords.get(e)).filter(Boolean);for(let e of U.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>Lae(n,e.coordinate)))}function Lae(i,e){if(i.intersectsCoordinate(e))return!0;let t=i.getClosestPoint(e),n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r<=1}function kI(){U.eligibleLocations=U.pins.filter(i=>!Kl(i)).length,Cu(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.zoneText.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),rA()}function Cu(){U.sources.priority.clear();for(let i of U.pins){if(Kl(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Cd(i))&&U.sources.priority.addFeature(i.feature)}}function Bg(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(Cu(),U.layers.pins.changed(),U.layers.priority.changed()))}function mS(i){U.labelsHeld!==i&&(U.labelsHeld=i,ye.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",U.layers.pinLabels.changed(),U.layers.text.changed(),document.dispatchEvent(new Event("atlas:labels")))}function Fg(i){return i===U.selectedPin||i===U.hoveredPin||Cd(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Kl(i){return i.filteredHidden||Dae(i)||Fae(i)||!GI(i.location)}function GI(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function Dae(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Fae(i){return!U.gridEnabled||!U.gridPrefix||Cd(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Oae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Xz(e.id)%1e3}function IV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function jx(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function GV(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Pu(s)==="text"?t:r).push(s);r.length&&e.push({key:`group-${n.id}`,title:n.title,categories:r})}return t.length&&e.unshift({key:"text",title:"Text",categories:t}),e}function zV(){let i=document.createDocumentFragment();for(let e of U.map.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.categories.reduce((s,o)=>s+o.locations.length,0);t.append(Bae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(Uae(s));t.append(r),i.append(t)}ye.legend.replaceChildren(i),gS(),Pd()}function Bae(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=Bc(t),r.append(s,o,a);let l=VV(`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 VV(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 Uae(i){let e=Pu(i)==="text",t=document.createElement("label");t.className="category-row",Ng(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!U.hiddenCategories.has(i.id);let r=document.createElement("span");e?(r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label"):(r.className="category-icon",Lg(r,i,Oc(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=document.createElement("span");o.className="category-count",o.textContent=Bc(i.locations.length);let a=VV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function zI(i){if(U.collapsedSections.clear(),i)for(let e of ye.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);gS()}function gS(){for(let i of ye.layers.querySelectorAll("[data-section]")){let e=U.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Lc()}function Xx(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Ox(),$l(),Rd(),Pd()}function Ox(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function qV(i){let e=U.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!U.hiddenCategories.has(n.id));for(let n of e.categories)t?U.hiddenCategories.add(n.id):U.hiddenCategories.delete(n.id);Ox(),$l(),Pd()}function HV(i){if(U.map){if(kae(i)){Xx(!0);return}U.hiddenCategories.clear();for(let e of U.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&U.hiddenCategories.add(n.id)}Ox(),$l(),Rd(),Pd()}}function kae(i){for(let e of U.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===U.hiddenCategories.has(t.id))return!1;return!0}function Gae(){let i=ye.soloChip;if(!U.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.map.sections){let a=0;for(let l of o.categories)U.hiddenCategories.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.categories.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 Pd(){if(U.map){for(let i of U.map.sections){let e=ye.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}Gae(),Lc()}}async function WV(i){let[e,t]=await Promise.all([fetch(`${U.game.base}/maps/${i.slug}.json`),fetch(`${U.game.base}/maps/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`map ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(o=>o.categories);return zae(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:GV(n.groups)}}function zae(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!==2)throw new Error(`location payload is version ${r}, and this reads 2`);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),p=new Uint32Array(i,o+=s*4,s+1),x=new Uint16Array(i,o+=(s+1)*4,s),v=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.locations=[];for(let S=0;S<s;S++)e[x[S]].locations.push({id:a[S],title:w.decode(v.subarray(p[S],p[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function Zz(){let i=`${U.game.base}/${U.map.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.game.base}/maps/${U.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByMap.get(i)}var _S=null;function sA(){return _S||(_S=Vae().finally(()=>{_S=null})),_S}async function Vae(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),U0(ye.game,U.catalog.games,"title"),VI(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=Rg();await df(n.game||Cg()?.game||U.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByMap.keys())r.startsWith(e.base+"/")&&U.textByMap.delete(r);let n=U.engine?.getView();U.restore={game:t.slug,map:U.map?.slug,variant:U.map?U.map.variants.indexOf(U.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},await df(t.slug,U.map?.slug);return}U.game=t,ye.game.value=t.slug}function VI(){let i=!U.catalog?.games?.length;ye.emptyState.hidden=!i,U.catalog?.bundlesDir&&(ye.emptyPath.textContent=U.catalog.bundlesDir)}async function qI(){for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await sA();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await df(t)}finally{for(let i of[ye.emptyOpen,ye.addBundles])i.disabled=!1}}var Qs={ADD:"add",REMOVE:"remove"};var jV={LENGTH:"length"},Ug=class extends Zs{constructor(e,t,n){super(e),this.element=t,this.index=n}},HI=class extends bs{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(jV.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 Ug(Qs.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 Ug(Qs.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 Ug(Qs.REMOVE,r,e)),this.dispatchEvent(new Ug(Qs.ADD,t,e))}updateLength_(){this.set(jV.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=HI;var WI=class extends Zs{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Dd=WI;var jI=class extends Dd{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()}},Lu=jI;var rr={SINGLECLICK:"singleclick",CLICK:Jt.CLICK,DBLCLICK:Jt.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var $x={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var XI=class extends Sd{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_=kn(n,$x.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=kn(n,$x.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,Dw?{passive:!1}:!1)}emulateClick_(e){let t=new Lu(rr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Lu(rr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Lu(rr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==rr.POINTERUP||t.type==rr.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==rr.POINTERDOWN||t.type==rr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Lu(rr.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(ri),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 Lu(rr.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(kn(n,rr.POINTERMOVE,this.handlePointerMove_,this),kn(n,rr.POINTERUP,this.handlePointerUp_,this),kn(this.element_,rr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(kn(this.element_.getRootNode(),rr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Lu(rr.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 Lu(rr.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_&&(ri(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ri(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ri),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},XV=XI;var Du={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var po={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Yx=1/0,$I=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,Su(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){Vn(!(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!=Yx?(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==Yx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},$V=$I;var YI=class extends $V{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(Jt.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===rn.LOADED||n===rn.ERROR||n===rn.EMPTY){n!==rn.ERROR&&t.removeEventListener(Jt.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()===rn.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},YV=YI;function ZV(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Yx;if(!i.wantedTiles[t][e.getKey()])return Yx;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 Gs={ANIMATING:0,INTERACTING:1};var Ql={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function ZI(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,p=i[0]+l/2+u,x=i[2]-l/2+u,v=i[1]+c/2+f,w=i[3]-c/2+f;p>x&&(p=(x+p)/2,x=p),v>w&&(v=(w+v)/2,w=v);let S=xi(n[0],p,x),T=xi(n[1],v,w);if(o&&t&&r){let P=30*r;S+=-P*Math.log(1+Math.max(0,p-n[0])/P)+P*Math.log(1+Math.max(0,n[0]-x)/P),T+=-P*Math.log(1+Math.max(0,v-n[1])/P)+P*Math.log(1+Math.max(0,n[1]-w)/P)}return[S,T]})}function KV(i){return i}function KI(i,e,t,n){let r=jn(e)/t[0],s=xr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function QI(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),xi(n,t/2,e*2)}function QV(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?KI(l,t,o,n):l;if(a)return e?QI(r,u,c):xi(r,c,u);let f=Math.min(u,r),p=Math.floor(vg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function JV(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?KI(e,r,l,s):e;if(c)return n?QI(o,u,t):xi(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,v=Math.min(u,o),w=Math.floor(Math.log(e/v)/Math.log(i)+x),S=Math.max(p,w),T=e/Math.pow(i,S);return xi(T,t,u)}})}function JI(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?KI(i,n,a,r):i;return!t||!l?xi(s,e,c):QI(s,c,e)}})}function kg(i){if(i!==void 0)return 0}function e5(i){if(i!==void 0)return i}function eq(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 tq(i){let e=i===void 0?Ec(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var t5=0,i5=class extends bs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Mw(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&&LG(),e.center&&(e.center=Rc(e.center,this.projection_)),e.extent&&(e.extent=Pc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Ql)delete t[a];this.setProperties(t,!0);let n=Hae(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=qae(e),s=n.constraint,o=Wae(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=Rc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Rc(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&&xS(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||iz,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 p=wu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}jae(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Gs.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Gs.ANIMATING]>0}getInteracting(){return this.hints_[Gs.INTERACTING]>0}cancelAnimations(){this.setHint(Gs.ANIMATING,-this.hints_[Gs.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&xS(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 p=l.sourceCenter[0],x=l.sourceCenter[1],v=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=p+f*(v-p),T=x+f*(w-x);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let p=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let x=this.getViewportSize_(this.getRotation()),v=this.constraints_.resolution(p,0,x,!0);this.targetCenter_=this.calculateCenterZoom(v,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=p,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let p=f===1?wu(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let x=this.constraints_.rotation(p,!0);this.targetCenter_=this.calculateCenterRotate(x,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=p}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(Gs.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&xS(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]],pg(n,e-this.getRotation()),fG(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&&Tx(e,this.getProjection())}getCenterInternal(){return this.get(Ql.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 yd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();Vn(t,"The view center is not defined");let n=this.getResolution();Vn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return Vn(r!==void 0,"The view rotation is not defined"),vx(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(Ql.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Pc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=jn(e)/t[0],r=xr(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(Ql.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=n5(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=vg(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=xi(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,xi(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Vn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Vn(!bu(e),"Cannot fit empty extent provided as `geometry`");let r=Pc(e,this.getProjection());n=sI(r)}else if(e.getType()==="Circle"){let r=Pc(e.getExtent(),this.getProjection());n=sI(r),n.rotate(this.getRotation(),Ga(r))}else{let r=X0();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,p=s.length;f<p;f+=o){let x=s[f]*n-s[f+1]*r,v=s[f]*r+s[f+1]*n;a=Math.min(a,x),l=Math.min(l,v),c=Math.max(c,x),u=Math.max(u,v)}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),p=Ga(a);p[0]+=(r[1]-r[3])/2*l,p[1]+=(r[0]-r[2])/2*l;let x=p[0]*f-p[1]*u,v=p[1]*f+p[0]*u,w=this.getConstrainedCenter([x,v],l),S=t.callback?t.callback:of;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),xS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Rc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(n5(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=n5(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=Tx(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&&Rc(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=Rc(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&&Rc(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(Ql.ROTATION)!==r&&this.set(Ql.ROTATION,r),this.get(Ql.RESOLUTION)!==o&&(this.set(Ql.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ql.CENTER)||!q0(this.get(Ql.CENTER),a))&&this.set(Ql.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()||!q0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:jl,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Gs.INTERACTING,1)}endInteraction(e,t,n){n=n&&Rc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Gs.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 xS(i,e){setTimeout(function(){i(e)},0)}function qae(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return ZI(i.extent,i.constrainOnlyCenter,t)}let e=Mw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,ZI(t,!1,!1)}return KV}function Hae(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:t5,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,p=Mw(i.projection,"EPSG:3857"),x=p.getExtent(),v=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&p.isGlobal()&&(v=!1,w=x),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=QV(S,u,!v&&w,f):e=JI(t,n,u,!v&&w,f)}else{let T=(x?Math.max(jn(x),xr(x)):360*tf.degrees/p.getMetersPerUnit())/256/Math.pow(2,t5),P=T/Math.pow(2,28-t5);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=P),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=JV(l,t,n,u,!v&&w,f):e=JI(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Wae(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?tq():t===!1?e5:typeof t=="number"?eq(t):e5}return kg}function jae(i){return!(i.sourceCenter&&i.targetCenter&&!q0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function n5(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 pl=i5;var r5=class extends bs{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)ri(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!==of&&this.listenerKeys.push(kn(e,Du.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Gg=r5;var s5=class extends Gg{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(Jt.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Nd+" "+Dg+(this.collapsed_&&this.collapsible_?" "+yI:"")+(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=>QG(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Fo(t,this.renderedAttributions_)){sz(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(yI),this.collapsed_?IP(this.collapseLabel_,this.label_):IP(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)}},nq=s5;var o5=class extends Gg{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(Jt.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Nd+" "+Dg,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(Vx)}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:jl}):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(Vx);!s&&n===0?this.element.classList.add(Vx):s&&n!==0&&this.element.classList.remove(Vx)}this.label_.style.transform=r}this.rotation_=n}},iq=o5;var a5=class extends Gg{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(Jt.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(Jt.CLICK,this.handleClick_.bind(this,-n),!1);let p=t+" "+Nd+" "+Dg,x=this.element;x.className=p,x.appendChild(u),x.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:jl})):n.setZoom(s)}}},rq=a5;function yS(i){i=i||{};let e=new fo;return(i.zoom===void 0||i.zoom)&&e.push(new rq(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new iq(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new nq(i.attributionOptions)),e}var l5=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_}},sq=l5;var c5={ACTIVE:"active"};var u5=class extends bs{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(c5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(c5.ACTIVE,e)}setMap(e){this.map_=e}};function oq(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:rz,center:i.getConstrainedCenter(r)})}}function zg(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:jl})}var Fu=u5;var h5=class extends Fu{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==rr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();zg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},aq=h5;function Zx(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 lq=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Xae=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)},vS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Xae(i):!0},cq=rf;var bS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(JG&&EP&&e.ctrlKey)};var wS=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var uq=function(i){let e=i.originalEvent;return EP?e.metaKey:e.ctrlKey},hq=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},SS=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},TS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var fq=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var f5=class extends Fu{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==rr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==rr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==rr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==rr.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 Vg(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 Ou=f5;var d5=class extends Ou{constructor(e){super({stopDown:sf}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Zx(wS,fq);this.condition_=e.onFocusOnly?Zx(vS,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(Vg(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();dG(s,a.getResolution()),pg(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:jl})}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}},dq=d5;var p5=class extends Ou{constructor(e){e=e||{},super({stopDown:sf}),this.condition_=e.condition?e.condition:lq,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!TS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===kg)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 TS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return TS(e)&&bS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},pq=p5;var A5=class extends wd{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 Mu([r])}getGeometry(){return this.geometry_}},Aq=A5;var qg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},oA=class extends Zs{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},m5=class extends Ou{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new Aq(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??bS,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 oA(qg.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 oA(t?qg.BOXEND:qg.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 oA(qg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new oA(qg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new oA(qg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},mq=m5;var g5=class extends mq{constructor(e){e=e||{};let t=e.condition?e.condition:hq;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:jl})}},gq=g5;var Fd={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var _5=class extends Fu{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return wS(t)&&SS(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==Jt.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Fd.DOWN||r==Fd.LEFT||r==Fd.RIGHT||r==Fd.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Fd.DOWN?c=-a:r==Fd.LEFT?l=-a:r==Fd.RIGHT?l=a:c=a;let u=[l,c];pg(u,o.getRotation()),oq(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},_q=_5;var x5=class extends Fu{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!uq(t)&&SS(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==Jt.KEYDOWN||e.type==Jt.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();zg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},xq=x5;var $ae=40,Yae=300,Zae=3,y5=class extends Fu{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:cq;this.condition_=e.onFocusOnly?Zx(vS,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(ri),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(kn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),kn(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!==Jt.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*=$ae;break;case WheelEvent.DOM_DELTA_PAGE:o*=Yae;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*Zae),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=-xi(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),zg(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)}},yq=y5;var v5=class extends Ou{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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!==kg&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Vg(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}},vq=v5;var b5=class extends Ou{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=sf),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(Vg(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}},bq=b5;function ES(i){i=i||{};let e=new fo,t=new sq(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new pq),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new aq({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new dq({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new vq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new bq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new _q),e.push(new xq({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new yq({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new gq({duration:i.zoomDuration})),e}var Ei={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 w5=class extends bs{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[Ei.OPACITY]=e.opacity!==void 0?e.opacity:1,Vn(typeof t[Ei.OPACITY]=="number","Layer opacity must be a number"),t[Ei.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ei.Z_INDEX]=e.zIndex,t[Ei.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ei.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ei.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ei.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=xi(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 Zn()}getLayerStatesArray(e){return Zn()}getExtent(){return this.get(Ei.EXTENT)}getMaxResolution(){return this.get(Ei.MAX_RESOLUTION)}getMinResolution(){return this.get(Ei.MIN_RESOLUTION)}getMinZoom(){return this.get(Ei.MIN_ZOOM)}getMaxZoom(){return this.get(Ei.MAX_ZOOM)}getOpacity(){return this.get(Ei.OPACITY)}getSourceState(){return Zn()}getVisible(){return this.get(Ei.VISIBLE)}getZIndex(){return this.get(Ei.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ei.EXTENT,e)}setMaxResolution(e){this.set(Ei.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ei.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ei.MAX_ZOOM,e)}setMinZoom(e){this.set(Ei.MIN_ZOOM,e)}setOpacity(e){Vn(typeof e=="number","Layer opacity must be a number"),this.set(Ei.OPACITY,e)}setVisible(e){this.set(Ei.VISIBLE,e)}setZIndex(e){this.set(Ei.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},MS=w5;var Od={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Uc=class extends Zs{constructor(e,t){super(e),this.layer=t}},S5={LAYERS:"layers"},T5=class i extends MS{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(S5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new fo(n.slice(),{unique:!0}):Vn(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(ri),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(kn(e,Qs.ADD,this.handleLayersAdd_,this),kn(e,Qs.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ri);Su(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 Uc(Od.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[kn(e,Nc.PROPERTYCHANGE,this.handleLayerChange_,this),kn(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(kn(e,Od.ADDLAYER,this.handleLayerGroupAdd_,this),kn(e,Od.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ln(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Uc(Od.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Uc(Od.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Uc(Od.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Ln(t);this.listenerKeys_[n].forEach(ri),delete this.listenerKeys_[n],this.dispatchEvent(new Uc(Od.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(S5.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 Uc(Od.REMOVELAYER,n[r]))}this.set(S5.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=vu(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Kx=T5;var Ao={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var E5=class extends MS{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(Ei.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(Ei.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_&&(ri(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=kn(e,Jt.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 pl?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 Qx(r,t.viewState)&&(!s||yr(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof pl?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(Ei.MAP,e)}getMapInternal(){return this.get(Ei.MAP)}setMap(e){this.mapPrecomposeKey_&&(ri(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ri(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=kn(e,Ao.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=kn(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);Vn(!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(Ei.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 Qx(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 aA=E5;function CS(i,e,t=0,n=i.length-1,r=Kae){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),p=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),x=Math.max(t,Math.floor(e-c*f/l+p)),v=Math.min(n,Math.floor(e+(l-c)*f/l+p));CS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(Jx(i,t,e),r(i[n],s)>0&&Jx(i,t,n);o<a;){for(Jx(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Jx(i,t,a):(a++,Jx(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Jx(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Kae(i,e){return i<e?-1:i>e?1:0}var lA=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(!PS(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;PS(e,l)&&(t.leaf?n.push(a):C5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!PS(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(PS(e,o)){if(t.leaf||C5(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=Wg([]),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=Qae(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&C5(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=Wg(e.slice(t,n+1)),Hg(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Wg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));wq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);wq(e,u,f,l,this.compareMinY);for(let p=u;p<=f;p+=l){let x=Math.min(p+l-1,f);a.children.push(this._build(e,p,x,r-1))}}return Hg(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=M5(c),f=tle(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),ty(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=Wg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Hg(n,this.toBBox),Hg(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Wg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Hg(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=ey(e,0,a,this.toBBox),c=ey(e,a,n,this.toBBox),u=nle(l,c),f=M5(l)+M5(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:Jae,s=e.leaf?this.compareMinY:ele,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=ey(e,0,t,s),a=ey(e,n-t,n,s),l=RS(o)+RS(a);for(let c=t;c<n-t;c++){let u=e.children[c];ty(o,e.leaf?s(u):u),l+=RS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];ty(a,e.leaf?s(u):u),l+=RS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)ty(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():Hg(e[t],this.toBBox)}};function Qae(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 Hg(i,e){ey(i,0,i.children.length,e,i)}function ey(i,e,t,n,r){r||(r=Wg(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];ty(r,i.leaf?n(o):o)}return r}function ty(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 Jae(i,e){return i.minX-e.minX}function ele(i,e){return i.minY-e.minY}function M5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function RS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function tle(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 nle(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 C5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function PS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Wg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function wq(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;CS(i,o,e,t,r),s.push(e,o,o,t)}}var uA=0,NS=0,Uo=1<<uA++,si=1<<uA++,ko=1<<uA++,la=1<<uA++,Af=1<<uA++,cA=1<<uA++,LS=Math.pow(2,uA)-1,P5={[Uo]:"boolean",[si]:"number",[ko]:"string",[la]:"color",[Af]:"number[]",[cA]:"size"},ile=Object.keys(P5).map(Number).sort(za);function rle(i){return i in P5}function pf(i){let e=[];for(let t of ile)ny(i,t)&&e.push(P5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function ny(i,e){return(i&e)===e}function IS(i,e){return!!(i&e)}function Bd(i,e){return i===e}var Nr=class{constructor(e,t){if(!rle(e))throw new Error(`literal expressions must have a specific type, got ${pf(e)}`);this.type=e,this.value=t}},DS=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function FS(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function $r(i,e,t){switch(typeof i){case"boolean":{if(Bd(e,ko))return new Nr(ko,i?"true":"false");if(!ny(e,Uo))throw new Error(`got a boolean, but expected ${pf(e)}`);return new Nr(Uo,i)}case"number":{if(Bd(e,cA))return new Nr(cA,jr(i));if(Bd(e,Uo))return new Nr(Uo,!!i);if(Bd(e,ko))return new Nr(ko,i.toString());if(!ny(e,si))throw new Error(`got a number, but expected ${pf(e)}`);return new Nr(si,i)}case"string":{if(Bd(e,la))return new Nr(la,kx(i));if(Bd(e,Uo))return new Nr(Uo,!!i);if(!ny(e,ko))throw new Error(`got a string, but expected ${pf(e)}`);return new Nr(ko,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 mle(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Bd(e,cA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Nr(cA,i)}if(Bd(e,la)){if(i.length===3)return new Nr(la,[...i,1]);if(i.length===4)return new Nr(la,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!ny(e,Af))throw new Error(`got an array of numbers, but expected ${pf(e)}`);return new Nr(Af,i)}var Je={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"},sle={[Je.Get]:Fn(Kn(1,1/0),Sq),[Je.Var]:ole(),[Je.Has]:Fn(Kn(1,1/0),Sq),[Je.Id]:Fn(ale,jg),[Je.Concat]:Fn(Kn(2,1/0),zi(ko)),[Je.GeometryType]:Fn(lle,jg),[Je.LineMetric]:Fn(cle,jg),[Je.Resolution]:Fn(R5,jg),[Je.Zoom]:Fn(R5,jg),[Je.Time]:Fn(R5,jg),[Je.Any]:Fn(Kn(2,1/0),zi(Uo)),[Je.All]:Fn(Kn(2,1/0),zi(Uo)),[Je.Not]:Fn(Kn(1,1),zi(Uo)),[Je.Equal]:Fn(Kn(2,2),Eq()),[Je.NotEqual]:Fn(Kn(2,2),Eq()),[Je.GreaterThan]:Fn(Kn(2,2),zi(si)),[Je.GreaterThanOrEqualTo]:Fn(Kn(2,2),zi(si)),[Je.LessThan]:Fn(Kn(2,2),zi(si)),[Je.LessThanOrEqualTo]:Fn(Kn(2,2),zi(si)),[Je.Multiply]:Fn(Kn(2,1/0),Tq),[Je.Coalesce]:Fn(Kn(2,1/0),Tq),[Je.Divide]:Fn(Kn(2,2),zi(si)),[Je.Add]:Fn(Kn(2,1/0),zi(si)),[Je.Subtract]:Fn(Kn(2,2),zi(si)),[Je.Clamp]:Fn(Kn(3,3),zi(si)),[Je.Mod]:Fn(Kn(2,2),zi(si)),[Je.Pow]:Fn(Kn(2,2),zi(si)),[Je.Abs]:Fn(Kn(1,1),zi(si)),[Je.Floor]:Fn(Kn(1,1),zi(si)),[Je.Ceil]:Fn(Kn(1,1),zi(si)),[Je.Round]:Fn(Kn(1,1),zi(si)),[Je.Sin]:Fn(Kn(1,1),zi(si)),[Je.Cos]:Fn(Kn(1,1),zi(si)),[Je.Atan]:Fn(Kn(1,2),zi(si)),[Je.Sqrt]:Fn(Kn(1,1),zi(si)),[Je.Match]:Fn(Kn(4,1/0),Mq,hle),[Je.Between]:Fn(Kn(3,3),zi(si)),[Je.Interpolate]:Fn(Kn(6,1/0),Mq,fle),[Je.Case]:Fn(Kn(3,1/0),ule,dle),[Je.In]:Fn(Kn(2,2),ple),[Je.Number]:Fn(Kn(1,1/0),zi(LS)),[Je.String]:Fn(Kn(1,1/0),zi(LS)),[Je.Array]:Fn(Kn(1,1/0),zi(si)),[Je.Color]:Fn(Kn(1,4),zi(si)),[Je.Band]:Fn(Kn(1,3),zi(si)),[Je.Palette]:Fn(Kn(2,2),Ale),[Je.ToString]:Fn(Kn(1,1),zi(Uo|si|ko|la))};function Sq(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 Nr(si,o);break}case"string":{r[s]=new Nr(ko,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 ole(){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=$r(s,LS,t);if(!(o instanceof Nr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&IS(r,la)&&!IS(r,ko)?a=la:Array.isArray(s)&&s.length===2&&IS(r,cA)&&!IS(r,Af)&&(a=cA),r&=a,r===NS)throw new Error(`the type expected from the var operator (${pf(e)}) did not have any overlap with the type of the corresponding style variables (${pf(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===NS)throw new Error(`a new type expected from the var operator (${pf(e)}) did not have any overlap with the previous type expected for it (${pf(o)}), variable name: ${n}`)}return t.variables.set(n,r),new DS(r,"var",new Nr(ko,n))}}function ale(i,e,t){t.featureId=!0}function lle(i,e,t){t.geometryType=!0}function cle(i,e,t){t.mCoordinate=!0}function R5(i,e,t){t.mapState=!0}function jg(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Kn(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 Tq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=$r(i[s+1],e,t);r[s]=o}return r}function zi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=$r(e[o+1],i,n);s[o]=a}return s}}function Eq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=LS;for(let a=0;a<r;++a){let l=$r(i[a+1],o,t);o&=l.type}if(o===NS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=$r(i[a+1],o,t);s[a]=l}return s}}function ule(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 Mq(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 hle(i,e,t){let n=i.length-1,r=$r(i[i.length-1],e,t),s=ko|si|Uo,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=$r(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===NS)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=$r(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=$r(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[$r(i[1],s,t),...o,r]}function fle(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 Nr(si,r),o;try{o=$r(i[2],si,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=$r(i[l+3],si,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=$r(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 dle(i,e,t){let n=$r(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=$r(i[s+1],Uo,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=$r(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 ple(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=ko:r=si;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=$r(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[$r(i[1],r,t),...s]}function Ale(i,e,t){let n;try{n=$r(i[1],si,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=$r(r[o],la,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Nr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Fn(...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 DS(t,r,...s)}}function mle(i,e,t){let n=i[0],r=sle[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function OS(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 OS(i.getGeometries()[0]);default:return""}}function I5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Gc(i,e,t){let n=$r(i,e,t);return kc(n,t)}function kc(i,e){if(i instanceof Nr){if(i.type===la&&typeof i.value=="string"){let n=kx(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case Je.Number:case Je.String:case Je.Coalesce:return gle(i,e);case Je.Get:case Je.Var:case Je.Has:return _le(i,e);case Je.Id:return n=>n.featureId;case Je.GeometryType:return n=>n.geometryType;case Je.Concat:{let n=i.args.map(r=>kc(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case Je.Resolution:return n=>n.resolution;case Je.Any:case Je.All:case Je.Between:case Je.In:case Je.Not:return yle(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return xle(i,e);case Je.Multiply:case Je.Divide:case Je.Add:case Je.Subtract:case Je.Clamp:case Je.Mod:case Je.Pow:case Je.Abs:case Je.Floor:case Je.Ceil:case Je.Round:case Je.Sin:case Je.Cos:case Je.Atan:case Je.Sqrt:return vle(i,e);case Je.Case:return ble(i,e);case Je.Match:return wle(i,e);case Je.Interpolate:return Sle(i,e);case Je.ToString:return Tle(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function gle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=kc(i.args[s],e);switch(t){case Je.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 Je.Number:case Je.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 _le(i,e){let n=i.args[0].value;switch(i.operator){case Je.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 Je.Var:return r=>r.variables[n];case Je.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 xle(i,e){let t=i.operator,n=kc(i.args[0],e),r=kc(i.args[1],e);switch(t){case Je.Equal:return s=>n(s)===r(s);case Je.NotEqual:return s=>n(s)!==r(s);case Je.LessThan:return s=>n(s)<r(s);case Je.LessThanOrEqualTo:return s=>n(s)<=r(s);case Je.GreaterThan:return s=>n(s)>r(s);case Je.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function yle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=kc(i.args[s],e);switch(t){case Je.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case Je.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case Je.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case Je.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 Je.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function vle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=kc(i.args[s],e);switch(t){case Je.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case Je.Divide:return s=>r[0](s)/r[1](s);case Je.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case Je.Subtract:return s=>r[0](s)-r[1](s);case Je.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 Je.Mod:return s=>r[0](s)%r[1](s);case Je.Pow:return s=>Math.pow(r[0](s),r[1](s));case Je.Abs:return s=>Math.abs(r[0](s));case Je.Floor:return s=>Math.floor(r[0](s));case Je.Ceil:return s=>Math.ceil(r[0](s));case Je.Round:return s=>Math.round(r[0](s));case Je.Sin:return s=>Math.sin(r[0](s));case Je.Cos:return s=>Math.cos(r[0](s));case Je.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case Je.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function ble(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=kc(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 wle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=kc(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 Sle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=kc(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),p=Array.isArray(f);if(p&&(f=eV(f)),u>=o)return c===2?f:p?Ele(s,o,a,l,u,f):iy(s,o,a,l,u,f);a=u,l=f}return l}}function Tle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=kc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===la?Gx(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function iy(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 Ele(i,e,t,n,r,s){if(r-t===0)return n;let a=gI(n),l=gI(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[iy(i,e,t,a[0],r,l[0]),iy(i,e,t,a[1],r,l[1]),a[2]+iy(i,e,t,0,r,c),iy(i,e,t,n[3],r,s[3])];return tV(u)}function Mle(i){return!0}function Cle(i,e){e=e??FS();let t=Rle(i,e),n=I5();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=OS(r.getGeometry())),t(n)}}function Cq(i,e){e=e??FS();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=N5(i[o],e);let r=I5(),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=OS(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 Nq(i,e){if(e=e??FS(),!Array.isArray(i))return Cq([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 Cle(s,e)}return Cq(i,e)}function Rle(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?Gc(s.filter,Uo,e):Mle,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=N5(s.style[c],e)}else a=[N5(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 N5(i,e){let t=ry(i,"",e),n=sy(i,"",e),r=Ple(i,e),s=Ile(i,e),o=mo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Mc(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new ws;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 ry(i,e,t){let n;if(e+"fill-pattern-src"in i)n=Fle(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=US(i,e+"fill-color",t)}if(!n)return null;let r=new Xr;return function(s){let o=n(s);return o===rS?null:(r.setColor(o),r)}}function sy(i,e,t){let n=mo(i,e+"stroke-width",t),r=US(i,e+"stroke-color",t);if(!n&&!r)return null;let s=mf(i,e+"stroke-line-cap",t),o=mf(i,e+"stroke-line-join",t),a=Lq(i,e+"stroke-line-dash",t),l=mo(i,e+"stroke-line-dash-offset",t),c=mo(i,e+"stroke-miter-limit",t),u=mo(i,e+"stroke-offset",t),f=new ho;return function(p){if(r){let x=r(p);if(x===rS)return null;f.setColor(x)}if(n&&f.setWidth(n(p)),s){let x=s(p);if(x!=="butt"&&x!=="round"&&x!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(x)}if(o){let x=o(p);if(x!=="bevel"&&x!=="round"&&x!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(x)}return a&&f.setLineDash(a(p)),l&&f.setLineDashOffset(l(p)),c&&f.setMiterLimit(c(p)),u&&f.setOffset(u(p)),f}}function Ple(i,e){let t="text-",n=mf(i,t+"value",e);if(!n)return null;let r=ry(i,t,e),s=ry(i,t+"background-",e),o=sy(i,t,e),a=sy(i,t+"background-",e),l=mf(i,t+"font",e),c=mo(i,t+"max-angle",e),u=mo(i,t+"offset-x",e),f=mo(i,t+"offset-y",e),p=Xg(i,t+"overflow",e),x=mf(i,t+"placement",e),v=mo(i,t+"repeat",e),w=kS(i,t+"scale",e),S=Xg(i,t+"rotate-with-view",e),T=mo(i,t+"rotation",e),P=mf(i,t+"align",e),R=mf(i,t+"justify",e),C=mf(i,t+"baseline",e),L=Xg(i,t+"keep-upright",e),D=Lq(i,t+"padding",e),F=GS(i,t+"declutter-mode"),N=new ff({declutterMode:F});return function(B){if(N.setText(n(B)),r&&N.setFill(r(B)),s&&N.setBackgroundFill(s(B)),o&&N.setStroke(o(B)),a&&N.setBackgroundStroke(a(B)),l&&N.setFont(l(B)),c&&N.setMaxAngle(c(B)),u&&N.setOffsetX(u(B)),f&&N.setOffsetY(f(B)),p&&N.setOverflow(p(B)),x){let z=x(B);if(z!=="point"&&z!=="line")throw new Error("Expected point or line for text-placement");N.setPlacement(z)}if(v&&N.setRepeat(v(B)),w&&N.setScale(w(B)),S&&N.setRotateWithView(S(B)),T&&N.setRotation(T(B)),P){let z=P(B);if(z!=="left"&&z!=="center"&&z!=="right"&&z!=="end"&&z!=="start")throw new Error("Expected left, right, center, start, or end for text-align");N.setTextAlign(z)}if(R){let z=R(B);if(z!=="left"&&z!=="right"&&z!=="center")throw new Error("Expected left, right, or center for text-justify");N.setJustify(z)}if(C){let z=C(B);if(z!=="bottom"&&z!=="top"&&z!=="middle"&&z!=="alphabetic"&&z!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");N.setTextBaseline(z)}return D&&N.setPadding(D(B)),L&&N.setKeepUpright(L(B)),N}}function Ile(i,e){return"icon-src"in i?Nle(i,e):"shape-points"in i?Lle(i,e):"circle-radius"in i?Dle(i,e):null}function Nle(i,e){let t="icon-",n=t+"src",r=Dq(i[n],n),s=BS(i,t+"anchor",e),o=kS(i,t+"scale",e),a=mo(i,t+"opacity",e),l=BS(i,t+"displacement",e),c=mo(i,t+"rotation",e),u=Xg(i,t+"rotate-with-view",e),f=Pq(i,t+"anchor-origin"),p=Iq(i,t+"anchor-x-units"),x=Iq(i,t+"anchor-y-units"),v=gf(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=US(i,t+"color",e):w=Fq(v,t+"color"));let T=Ble(i,t+"cross-origin"),P=Ule(i,t+"offset"),R=Pq(i,t+"offset-origin"),C=L5(i,t+"width"),L=L5(i,t+"height"),D=Ole(i,t+"size"),F=GS(i,t+"declutter-mode"),N={src:r,anchorOrigin:f,anchorXUnits:p,anchorYUnits:x,crossOrigin:T,offset:P,offsetOrigin:R,height:L,width:C,size:D,declutterMode:F},B=null;return function(z){if(B)S&&B.setColor(S(z));else{let V=S?S(z):w;B=new iA(V!==void 0?Object.assign({},N,{color:V}):Object.assign({},N))}return a&&B.setOpacity(a(z)),l&&B.setDisplacement(l(z)),c&&B.setRotation(c(z)),u&&B.setRotateWithView(u(z)),o&&B.setScale(o(z)),s&&B.setAnchor(s(z)),B}}function Lle(i,e){let t="shape-",n=t+"points",r=t+"radius",s=D5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=mo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=mo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=ry(i,t,e),p=sy(i,t,e),x=kS(i,t+"scale",e),v=BS(i,t+"displacement",e),w=mo(i,t+"rotation",e),S=Xg(i,t+"rotate-with-view",e),T=L5(i,t+"angle"),P=GS(i,t+"declutter-mode"),R=new uS({points:s,radius:a,radius2:u,angle:T,declutterMode:P});return function(C){return o&&R.setRadius(o(C)),c&&R.setRadius2(c(C)),f&&R.setFill(f(C)),p&&R.setStroke(p(C)),v&&R.setDisplacement(v(C)),w&&R.setRotation(w(C)),S&&R.setRotateWithView(S(C)),x&&R.setScale(x(C)),R}}function Dle(i,e){let t="circle-",n=ry(i,t,e),r=sy(i,t,e),s=mo(i,t+"radius",e),o=kS(i,t+"scale",e),a=BS(i,t+"displacement",e),l=mo(i,t+"rotation",e),c=Xg(i,t+"rotate-with-view",e),u=GS(i,t+"declutter-mode"),f=new hS({radius:5,declutterMode:u});return function(p){return s&&f.setRadius(s(p)),n&&f.setFill(n(p)),r&&f.setStroke(r(p)),a&&f.setDisplacement(a(p)),l&&f.setRotation(l(p)),c&&f.setRotateWithView(c(p)),o&&f.setScale(o(p)),f}}function gf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function mo(i,e,t){let n=gf(i,e);if(n===void 0)return;let r=Gc(n,si,t);return function(s){return D5(r(s),e)}}function mf(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,ko,t);return function(s){return Dq(r(s),e)}}function Fle(i,e,t){let n=mf(i,e+"pattern-src",t),r=Rq(i,e+"pattern-offset",t),s=Rq(i,e+"pattern-size",t),o=US(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Xg(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,Uo,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function US(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,la,t);return function(s){return Fq(r(s),e)}}function Lq(i,e,t){let n=gf(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=Gc(o,si,t);return function(c){return D5(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=Gc(n,Af,t);return function(s){return oy(r(s),e)}}function BS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,Af,t);return function(s){let o=oy(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function Rq(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,Af,t);return function(s){return Oq(r(s),e)}}function kS(i,e,t){let n=gf(i,e);if(n===void 0)return null;let r=Gc(n,Af|si,t);return function(s){return kle(r(s),e)}}function L5(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 Ole(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return jr(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 Ble(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 Pq(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 Iq(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 Ule(i,e){let t=i[e];if(t!==void 0)return oy(t,e)}function GS(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 oy(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 Dq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function D5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function Fq(i,e){if(typeof i=="string")return i;let t=oy(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 Oq(i,e){let t=oy(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function kle(i,e){return typeof i=="number"?i:Oq(i,e)}var Bq={RENDER_ORDER:"renderOrder"},F5=class extends aA{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(Bq.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 lA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Bq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?PI:e;let t=Gle(e);this.styleFunction_=e===null?void 0:dV(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function Gle(i){if(i===void 0)return PI;if(!i)return null;if(typeof i=="function"||i instanceof ws)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof ws){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof ws))throw new Error("Expected a list of style instances");n[r]=s}return n}return Nq(i)}var zS=F5;var O5=class extends Zs{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},VS=O5;var B5=class extends wd{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Zn()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;uo(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Uw(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(C,L,D,F){return s.call(o,L,C?D:null,F)}let p=u.projection,x=yw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=jn(C);v.push([-L,0],[L,0])}let w=t.layerStatesArray,S=w.length,T=[],P=[];for(let C=0;C<v.length;C++)for(let L=S-1;L>=0;--L){let D=w[L],F=D.layer;if(F.hasRenderer()&&Qx(D,u)&&a.call(l,F)){let N=F.getRenderer(),B=F.getSource();if(N&&B){let z=B.getWrapX()?x:e,V=f.bind(null,D.managed);P[0]=z[0]+v[C][0],P[1]=z[1]+v[C][1],c=N.forEachFeatureAtCoordinate(P,t,n,V,T)}if(c)return c}}if(T.length===0)return;let R=1/T.length;return T.forEach((C,L)=>C.distanceSq+=L*R),T.sort((C,L)=>C.distanceSq-L.distanceSq),T.some(C=>c=C.callback(C.feature,C.layer,C.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,rf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){Zn()}scheduleExpireIconCache(e){Oo.canExpireCache()&&e.postRenderFunctions.push(zle)}};function zle(i,e){Oo.expire()}var Uq=B5;var U5=class extends Uq{constructor(e){super(e),this.fontChangeListenerKey_=kn(tA,Nc.PROPERTYCHANGE,e.redrawText,e),this.element_=Us?Fw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Nd+" 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 VS(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ri(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(Ao.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof zS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;dl(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 p=t[u];e.layerIndex=u;let x=p.layer,v=x.getSourceState();if(!Qx(p,r)||v!="ready"&&v!="undefined"){x.unrender();continue}let w=x.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(p))}this.declutter(e,l),oz(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!dl(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!dl(f)||f.width===0)continue;a.save();let x=u.style.opacity||f.style.opacity;a.globalAlpha=x===""?1:Number(x);let v=f.style.transform;if(v)a.transform(...Bw(v));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(Ao.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))}}},kq=U5;function Gq(i){if(i instanceof aA){i.setMapInternal(null);return}i instanceof Kx&&i.getLayers().forEach(Gq)}function zq(i,e){if(i instanceof aA){i.setMapInternal(e);return}if(i instanceof Kx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)zq(t[n],e)}}var k5=class extends bs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=Vle(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:ez,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Ks(),this.pixelToCoordinateTransform_=Ks(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Us||(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,Us||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Us?new fo:yS()),this.interactions=t.interactions||(Us?new fo:ES({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new YV(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(po.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(po.VIEW,this.handleViewChanged_),this.addChangeListener(po.SIZE,this.handleSizeChanged_),this.addChangeListener(po.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof pl)&&e.view.then(function(r){n.setView(new pl(r))}),this.controls.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Qs.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Qs.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){zq(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:rf,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 Kx?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:rf,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(po.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Tx(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Ir(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(po.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=Rc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Ir(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(po.SIZE)}getView(){return this.get(po.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 ZV(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Lu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===$x.POINTERDOWN||n===Jt.WHEEL||n===Jt.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[Gs.ANIMATING]||o[Gs.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(Ao.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Ao.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Dd(Du.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Dd(Du.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)ri(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!dl(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(dl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new kq(this)),!dl(t)){this.mapBrowserEventHandler_=new XV(this,this.moveTolerance_);for(let r in rr)this.mapBrowserEventHandler_.addEventListener(rr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,Dw?{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_=[kn(n,Jt.KEYDOWN,this.handleBrowserEvent,this),kn(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!dl(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_&&(ri(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ri(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=kn(e,Nc.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=kn(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ri),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Uc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[kn(e,Nc.PROPERTYCHANGE,this.render,this),kn(e,Jt.CHANGE,this.render,this),kn(e,"addlayer",this.handleLayerAdd_,this),kn(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){Gq(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&&xP(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:vx(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:Ln(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=vx(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_||!bu(this.previousExtent_)&&!G0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Dd(Du.MOVESTART,this,r)),this.previousExtent_=k0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Gs.ANIMATING]&&!s.viewHints[Gs.INTERACTING]&&!G0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Dd(Du.MOVEEND,this,s)),fw(s.extent,this.previousExtent_))),this.dispatchEvent(new Dd(Du.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Du.LOADSTART)||this.hasListener(Du.LOADEND)||this.hasListener(Ao.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 Uc("removelayer",t)),this.set(po.LAYERGROUP,e)}setSize(e){this.set(po.SIZE,e)}setTarget(e){this.set(po.TARGET,e)}setView(e){if(!e||e instanceof pl){this.set(po.VIEW,e);return}this.set(po.VIEW,new pl);let t=this;e.then(function(n){t.setView(new pl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(dl(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)],!xP(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&gw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Fo(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function Vle(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 Kx({layers:i.layers});t[po.LAYERGROUP]=n,t[po.TARGET]=i.target,t[po.VIEW]=i.view instanceof pl?i.view:new pl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new fo(i.controls.slice()):(Vn(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()):(Vn(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()):(Vn(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 Vq=k5;function qS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var qle=new Error("disposed");var Hle=[256,256],G5=class extends Eg{constructor(e){let t=rn.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=qS(this.data_);return e?[e.width,e.height]:Hle}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==rn.IDLE&&this.state!==rn.ERROR)return;this.state=rn.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=rn.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=rn.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(qle),this.controller_=null),super.disposeInternal()}},z5=G5;var V5=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 wd&&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 Vn(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 Vn(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){Vn(!(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}},q5=V5;var H5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Cx(),{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}},HS=H5;var Wle=5,W5=class extends Gw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=Wle,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 Zn()}getData(e){return null}prepareFrame(e){return Zn()}renderFrame(e,t){return Zn()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Mn.LOADED||t.getState()===Mn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Mn.LOADED&&t!=Mn.ERROR&&e.addEventListener(Jt.CHANGE,this.boundHandleImageChange_),t==Mn.IDLE&&(e.load(),t=e.getState()),t==Mn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},qq=W5;var X5=[],$g=null;function jle(){$g=Ti(1,1,void 0,{willReadFrequently:!0})}var j5=class extends qq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Ks(),this.pixelTransform=Ks(),this.inversePixelTransform=Ks(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){$g||jle(),$g.clearRect(0,0,1,1);let r;try{$g.drawImage(e,t,n,1,1,0,0,1,1),r=$g.getImageData(0,0,1,1).data}catch{return $g=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(dl(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&&Fo(Yl(e.style.backgroundColor),Yl(n)))){let c=e.firstElementChild;dl(c)&&(l=c.getContext("2d"))}if(l&&dz(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=Us?Fw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Ti();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=Hl(n),s=dg(n),o=fg(n),a=hg(n);Ir(t.coordinateToPixelTransform,r),Ir(t.coordinateToPixelTransform,s),Ir(t.coordinateToPixelTransform,o),Ir(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Ir(l,r),Ir(l,s),Ir(l,o),Ir(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(jn(n)/r*o),l=Math.round(xr(n)/r*o);uo(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Uw(this.inversePixelTransform,this.pixelTransform);let c=fz(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 VS(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Ao.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Ao.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new HS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Ao.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Ao.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,p=-e[0]+a,x=-e[1];return uo(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},WS=j5;function $5(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 Xle(i,e,t){let n=i[t];return n?n.delete(e):!1}function Hq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=vu(e,Pc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=vu(e,r))}return e}var Y5=class extends WS{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=Pr(),this.tempTileRange_=new Rw(0,0,0,0),this.tempTileCoord_=bg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new q5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new q5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=wg(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||xg(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=Ir(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!Sc(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),p=this.getTile(u,f[1],f[2],t);if(!p||p.getState()!==rn.LOADED)continue;let x=l.getOrigin(u),v=jr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof Ow||p instanceof kw)S=p.getImage();else if(p instanceof z5){if(S=qS(p.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-x[0])/w-f[1]*v[0])),P=Math.floor(c*((x[1]-r[1])/w-f[2]*v[1])),R=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+R,P+R)}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=Ln(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],p=a.getMapInternal(),x=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),p?p.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),v=o.rotation,w=v?rP(o.center,o.resolution,v,e.size):void 0;for(let S=n;S>=x;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),P=c.getResolution(S);for(let R=T.minX;R<=T.maxX;++R)for(let C=T.minY;C<=T.maxY;++C){if(v&&!c.tileCoordIntersectsViewport([S,R,C],w))continue;let L=this.getTile(S,R,C,e);if(!L||!$5(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=bg(S,R,C,this.tempTileCoord_);e.tileQueue.enqueue([L,u,c.getTileCoordCenter(N),P])}}}}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=wg(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===rn.LOADED)return u.endTransition(Ln(this)),$5(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 p=wg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&($5(r,v,n),x=!0)}x||(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),p=f.getZForResolution(o,u.zDirection),x=f.getResolution(p);this.updateStaleKeys(u.getKey());let v=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?Pc(n.extent,s):null,this.layerExtent&&(v=vu(v,this.layerExtent));let P=x*S/2/w,R=x*T/2/w,C=[a[0]-P,a[1]-R,a[0]+P,a[1]+R],L={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let K=f.getZForResolution(r.nextResolution,u.zDirection),ee=Hq(e,e.nextExtent);this.enqueueTiles(e,ee,K,L,D)}let F=Hq(e,v);if(this.enqueueTiles(e,F,p,L,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,F,p-1,L,D-1)},0),!(p in L))return this.container;let N=Ln(this),B=e.time;for(let K of L[p]){let ee=K.getState();if(ee===rn.EMPTY)continue;let ae=K.tileCoord;if(ee===rn.LOADED&&K.getAlpha(N,B)===1){K.endTransition(N);continue}if(ee!==rn.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ae,L)){Xle(L,K,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let be=f.getMinZoom();for(let Ie=p-1;Ie>=be&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);uo(this.tempTransform,S/2,T/2,z,z,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(V,e,this.layerExtent),u.getInterpolate()||(V.imageSmoothingEnabled=!1),this.preRender(V,e);let H=Object.keys(L).map(Number);H.sort(za);let Z=[],J=[],j=[];for(let K=H.length-1;K>=0;--K){let ee=H[K],ae=u.getTilePixelSize(ee,l,s),de=f.getResolution(ee)/x,be=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(Hl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Ir(this.tempTransform,[w*(Ue[0]-C[0])/x,w*(C[3]-Ue[3])/x]),Me=w*u.getGutterForProjection(s);for(let ze of L[ee]){if(ze.getState()!==rn.LOADED)continue;let $e=ze.tileCoord,Et=Qe[1]-$e[1],Tt=Math.round(mt[0]-(Et-1)*be),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*be),Xe=Math.round(mt[1]-Ct*Ie),st=Tt-Gt,tt=un-Xe,vt=ee===p;if(vt&&ze.inTransition(N)){j.push({tile:ze,x:Gt,y:Xe,w:st,h:tt,gutter:Me}),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze);continue}let yt=[Gt,Xe,Gt+st,Xe+tt],ln=[];for(let Qt=0,xn=Z.length;Qt<xn;++Qt)ee<J[Qt]&&yr(yt,Z[Qt])&&ln.push(Z[Qt]);let Kt;ln.length>0&&(Kt=lG(yt,ln)),Z.push(yt),J.push(ee),this.drawTile(ze,e,Gt,Xe,st,tt,Me,vt,Kt),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze)}}for(let K=0,ee=j.length;K<ee;++K){let{tile:ae,x:ce,y:de,w:be,h:Ie,gutter:Qe}=j[K];this.drawTile(ae,e,ce,de,be,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!G0(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&V.restore(),V.imageSmoothingEnabled=!0,this.renderComplete){let K=(ee,ae)=>{let ce=Ln(u),de=ae.wantedTiles[ce],be=de?Object.keys(de).length:0;this.updateCacheSize(be),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(K)}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 z5){if(u=qS(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),p=Ln(this),x=t.layerStatesArray[t.layerIndex],v=x.opacity*(l?e.getAlpha(p,t.time):1),w=v!==f.globalAlpha;w&&(f.save(),f.globalAlpha=v);let S=u.width-2*a,T=u.height-2*a;if(c){let P=S/s,R=T/o;for(let C=0,L=c.length;C<L;++C){let D=c[C],F=D[0],N=D[1],B=D[2]-D[0],z=D[3]-D[1];f.drawImage(u,a+(F-n)*P,a+(N-r)*R,B*P,z*R,F,N,B,z)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),v!==x.opacity?t.animate=!0:l&&e.endTransition(p)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Ln(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Wq=Y5;var ay={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var Z5=class extends aA{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(ay.PRELOAD)}setPreload(e){this.set(ay.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(ay.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(ay.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},jq=Z5;var K5=class extends jq{constructor(e){super(e)}createRenderer(){return new Wq(this,{cacheSize:this.getCacheSize()})}},Q5=K5;var J5=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){}},jS=J5;var ly={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},cy=[ly.FILL],Bu=[ly.STROKE],_f=[ly.BEGIN_PATH],eN=[ly.CLOSE_PATH],An=ly;var tN=class extends jS{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],Sc(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],p=this.tmpCoordinate_,x=!0,v,w,S;for(v=t+r;v<n;v+=r)p[0]=e[v],p[1]=e[v+1],S=hw(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===ys.INTERSECTING?(a[l++]=p[0],a[l++]=p[1],x=!1):x=!0,u=p[0],f=p[1],w=S;return(s&&x||v===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,p,x;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),p=[];let v=e.getEndss();x=0;for(let w=0,S=v.length;w<S;++w){let T=[];x=this.drawCustomCoordinates_(c,x,v[w],a,T),p.push(T)}this.instructions.push([An.CUSTOM,l,p,e,n,Px,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,Px,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),x=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([An.CUSTOM,l,f,e,n,Pg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,Pg,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([An.CUSTOM,l,u,e,n,Eu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Eu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,Eu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Eu,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([An.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[An.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[An.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==An.END_GEOMETRY?o=t:s==An.BEGIN_GEOMETRY&&(r[2]=t,GG(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=qa(n||ks)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=qa(n||Bo);let r=e.getLineCap();t.lineCap=r!==void 0?r:Iu;let s=e.getLineDash();t.lineDash=s?s.slice():Ha;let o=e.getLineDashOffset();t.lineDashOffset=o||Wa;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Nu;let l=e.getWidth();t.lineWidth=l!==void 0?l:hf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:cf;let u=e.getOffset();t.strokeOffset=u??sV,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=[An.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[An.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&&!Fo(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=[An.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=fw(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;cg(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Uu=tN;var nN=class extends Uu{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&&!Sc(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([An.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([An.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||Sc(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([An.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([An.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}},Xq=nN;var iN=class extends Uu{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([An.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([An.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([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ha,Wa],_f);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Bu),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([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ha,Wa],_f);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinates_(c,f,l[p],u,a);this.hitDetectionInstructions.push(Bu),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Bu),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Bu),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(_f)}},$q=iN;var rN=class extends Uu{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(_f),this.hitDetectionInstructions.push(_f);for(let u=0;u<c;++u){let f=n[u],p=this.coordinates.length,x=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([An.MOVE_TO_LINE_TO,p,x,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,p,x,s,!0]),l&&(this.instructions.push(eN),this.hitDetectionInstructions.push(eN)),t=f}return a&&(this.instructions.push(cy),this.hitDetectionInstructions.push(cy)),l&&(this.instructions.push(Bu),this.hitDetectionInstructions.push(Bu)),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([An.SET_FILL_STYLE,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ha,Wa]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[An.CIRCLE,u,a];this.instructions.push(_f,f),this.hitDetectionInstructions.push(_f,f),r.fillStyle!==void 0&&(this.instructions.push(cy),this.hitDetectionInstructions.push(cy)),r.strokeStyle!==void 0&&(this.instructions.push(Bu),this.hitDetectionInstructions.push(Bu)),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([An.SET_FILL_STYLE,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ha,Wa]);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([An.SET_FILL_STYLE,ks]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Bo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ha,Wa]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinatess_(c,f,l[p],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]=Ed(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}},sN=rN;var oN=0,aN=1;function $le(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 p=(i-r)/l,x=(t-r)/l;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let p=(e-s)/c,x=(n-s)/c;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}return oN=u,aN=f,!0}function Yq(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,p,x=0;for(let v=0,w=e.length;v<w;++v){let S=e[v],T=i[x],P=i[x+1],R=!1;for(let C=x+t;C<S;C+=t){let L=i[C],D=i[C+1];if($le(r,s,o,a,T,P,L,D)){let F=L-T,N=D-P,B=T+oN*F,z=P+oN*N,V=T+aN*F,H=P+aN*N;u&&R&&B===f&&z===p?l.push(V,H):(u&&c.push(l.length),l.push(B,z,V,H),u=!0),f=V,p=H,R=!0}T=L,P=D}x=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function Zq(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],p=e[o+r+1],x=Math.sqrt((f-c)*(f-c)+(p-u)*(p-u));if(a+=x,a>=i){let v=(i-a+x)/x,w=Do(c,f,v),S=Do(u,p,v);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 v=x-a,w=Do(c,f,v/x),S=Do(u,p,v/x);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function Kq(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,p,x,v,w,S,T,P,R;for(f=t;f<n;f+=r){let C=e[f],L=e[f+1];v!==void 0&&(P=C-v,R=L-w,x=Math.sqrt(P*P+R*R),S!==void 0&&(l+=p,u=Math.acos((S*P+T*R)/(p*x)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),p=x,S=P,T=R),v=C,w=L}return l+=x,l>a?[c,f]:[s,o]}var uy={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},lN=class extends Uu{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[ks]={fillStyle:ks},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 p=e.getExtent();if(!yr(this.maxExtent,p))return;let x;if(u=e.getFlatCoordinates(),c=="LineString")x=[u.length];else if(c=="MultiLineString")x=e.getEnds();else if(c=="Polygon")x=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();x=[];for(let P=0,R=T.length;P<R;++P)x.push(T[P][0])}if((c=="LineString"||c=="MultiLineString")&&!yu(this.getBufferedMaxExtent(),p)){let T=Yq(u,x,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,x=T.ends,f=2,x.length===0)return}this.beginGeometry(e,t,n);let v=o.repeat,w=v?void 0:o.textAlign,S=0;for(let T=0,P=x.length;T<P;++T){let R;v?R=Zq(v*this.resolution,u,S,x[T],f):R=[u.slice(S,x[T])];for(let C=0,L=R.length;C<L;++C){let D=R[C],F=0,N=D.length;if(w==null){let z=Kq(o.maxAngle,D,0,D.length,2);F=z[0],N=z[1]}for(let z=F;z<N;z+=f)a.push(D[z],D[z+1]);let B=a.length;S=x[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let p=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||p.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let C=e.getFlatInteriorPoints();u=[];for(let L=0,D=C.length;L<D;L+=3)o.overflow||p.push(C[L+2]/this.resolution),u.push(C[L],C[L+1]);if(u.length===0)return;f=2;break;default:}let x=this.appendFlatPointCoordinates(u,f);if(x===l)return;if(p&&(x-l)/2!==u.length/f){let C=l/2;p=p.filter((L,D)=>{let F=a[(C+D)*2]===u[D*f]&&a[(C+D)*2+1]===u[D*f+1];return F||--C,F})}this.saveTextStates_();let v=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!=uf&&(o.scale[0]<0||o.scale[1]<0)){let C=o.padding[0],L=o.padding[1],D=o.padding[2],F=o.padding[3];o.scale[0]<0&&(L=-L,F=-F),o.scale[1]<0&&(C=-C,D=-D),S=[C,L,D,F]}let T=this.pixelRatio;this.instructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==uf?uf:S.map(function(C){return C*T}),v,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);let P=1/T,R=v?v.slice(0):null;R&&(R[1]=ks),this.hitDetectionInstructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[P,P],NaN,this.declutterMode_,this.declutterImageWithText_,S,R,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ks:this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]),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||Ld,justify:t.justify,textBaseline:t.textBaseline||nA,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=uy[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,p=this.text_,x=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,x*l,p,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a&&ks,r.maxAngle,l,f,s,x*l,p,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=qa(o.getColor()||ks)):(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(),P=a.getMiterLimit();s.lineCap=a.getLineCap()||Iu,s.lineDash=w?w.slice():Ha,s.lineDashOffset=S===void 0?Wa:S,s.lineJoin=a.getLineJoin()||Nu,s.lineWidth=T===void 0?hf:T,s.miterLimit=P===void 0?cf:P,s.strokeStyle=qa(a.getColor()||Bo)}n=this.textState_;let l=e.getFont()||lS;oV(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()||nA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||uf,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),p=e.getRotateWithView(),x=e.getKeepUpright(),v=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=p===void 0?!1:p,this.textKeepUpright_=x===void 0?!0:x,this.textRotation_=v===void 0?0:v,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Ln(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:"|"+Ln(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Qq=lN;var Yle={Circle:sN,Default:Uu,Image:Xq,LineString:$q,Polygon:sN,Text:Qq},cN=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=Yle[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},Jq=cN;function eH(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}function XS(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],p,x,v,w,S,T,P,R,C=0;for(let L=e;L<t;L+=n){v=p,w=x,S=void 0,T=void 0,L+n<t&&(S=i[L+n],T=i[L+n+1]),s&&L===e&&(v=u,w=f),s&&L===t-n&&(S=l,T=c),p=i[L],x=i[L+1],[P,R]=Zle(p,x,v,w,S,T,r),o[C++]=P,o[C++]=R;for(let D=2;D<a;D++)o[C++]=i[L+D]}return o.length!=C&&(o.length=C),o}function Zle(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 p=AG([i,e],[t,n],[r,s]);if(Math.cos(p)>.998)return[i+u*o,e+f*o];let x=Math.cos(p/2),v=Math.sin(p/2),w=v*a+x*l,S=-x*a+v*l,T=w*(1/v),P=S*(1/v);return[i+T*o,e+P*o]}function $S(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],p=i[o+1],x=i[o+e],v=i[o+e+1],w=(v-p)*(c-a)-(x-f)*(u-l);if(w===0)continue;let S=((x-f)*(l-p)-(v-p)*(a-f))/w,T=((c-a)*(l-p)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let P=a+S*(c-a),R=l+S*(u-l);i[n+e]=P,i[n+e+1]=R,i.splice(n+2*e,o-n-e);break}}}return i}var uN;function Kle(){return uN||(uN=new Intl.Segmenter(void 0,{granularity:"grapheme"})),uN}function tH(i,e,t,n,r,s,o,a,l,c,u,f,p=!0){let x=i[e],v=i[e+1],w=0,S=0,T=0,P=0;function R(){w=x,S=v,e+=n,x=i[e],v=i[e+1],P+=T,T=Math.sqrt((x-w)*(x-w)+(v-S)*(v-S))}do R();while(e<t-n&&P+T<s);let C=T===0?0:(s-P)/T,L=Do(w,x,C),D=Do(S,v,C),F=e-n,N=P,B=s+a*l(c,r,u);for(;e<t-n&&P+T<B;)R();C=T===0?0:(B-P)/T;let z=Do(w,x,C),V=Do(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Ww(ae,0,4,2,f,ae,ae),H=ae[0]>ae[2]}else H=L>z;let Z=Math.PI,J=[],j=F+n===e;e=F,T=0,P=N,x=i[e],v=i[e+1];let K;if(j){R(),K=Math.atan2(v-S,x-w),H&&(K+=K>0?-Z:Z);let ae=(z+L)/2,ce=(V+D)/2;return J[0]=[ae,ce,(B-s)/2,K,r],J}r=r.replace(/\n/g," ");let ee=Array.from(Kle().segment(r),ae=>ae.segment);for(let ae=0,ce=ee.length;ae<ce;){R();let de=Math.atan2(v-S,x-w);if(H&&(de+=de>0?-Z:Z),K!==void 0){let Me=de-K;if(Me+=Me>Z?-2*Z:Me<-Z?2*Z:0,Math.abs(Me)>o)return null}K=de;let be=ae,Ie=0;for(;ae<ce;++ae){let Me=H?ce-ae-1:ae,ze=a*l(c,ee[Me],u);if(e+n<t&&P+T<s+Ie+ze/2)break;Ie+=ze}if(ae===be)continue;let Qe=(H?ee.slice(ce-ae,ce-be):ee.slice(be,ae)).join("");C=T===0?0:(s+Ie/2-P)/T;let Ue=Do(w,x,C),mt=Do(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var Yg=Pr(),Ud=[],xf=[],yf=[],kd=[];function nH(i){return i[3].declutterBox}var iH=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function hN(i,e){return e==="start"?e=iH.test(i)?"right":"left":e==="end"&&(e=iH.test(i)?"left":"right"),uy[e]}function Qle(i,e,t){return t>0&&i.push(`77 `,""),i.push(e,""),i}function Jle(i,e,t){return t%2===0&&(i+=e),i}var fN=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_=Ks(),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 HS: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?uy[l.justify]:hN(Array.isArray(e)?e[0]:e,l.textAlign||Ld),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`88 `).reduce(Qle,[]),{width:v,height:w,widths:S,heights:T,lineWidths:P}=cV(l,x),R=v+p,C=[],L=(R+2)*u[0],D=(w+p)*u[1],F={width:L<0?Math.floor(L):Math.ceil(L),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:C};(u[0]!=1||u[1]!=1)&&C.push("scale",u),r&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",p),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),n&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");let N=.5-f,B=f*R+N*p,z=[],V=[],H=0,Z=0,J=0,j=0,K;for(let ee=0,ae=x.length;ee<ae;ee+=2){let ce=x[ee];if(ce===`99 `){Z+=H,H=0,B=f*R+N*p,++j;continue}let de=x[ee+1]||l.font;de!==K&&(r&&z.push("font",de),n&&V.push("font",de),K=de),H=Math.max(H,T[J]);let be=[ce,B+N*S[J]+f*(S[J]-P[j]),.5*(p+H)+Z];B+=S[J],r&&z.push("strokeText",be),n&&V.push("fillText",be),++J}return Array.prototype.push.apply(C,z),Array.prototype.push.apply(C,V),this.labels_[s]=F,F}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,p,x,v,w,S){a*=p[0],l*=p[1];let T=n-a,P=r-l,R=s+c>e?e-c:s,C=o+u>t?t-u:o,L=v[3]+R*p[0]+v[1],D=v[0]+C*p[1]+v[2],F=T-v[3],N=P-v[0];(w||f!==0)&&(Ud[0]=F,kd[0]=F,Ud[1]=N,xf[1]=N,xf[0]=F+L,yf[0]=xf[0],yf[1]=N+D,kd[1]=yf[1]);let B;return f!==0?(B=uo(Ks(),n,r,1,1,f,-n,-r),Ir(B,Ud),Ir(B,xf),Ir(B,yf),Ir(B,kd),fl(Math.min(Ud[0],xf[0],yf[0],kd[0]),Math.min(Ud[1],xf[1],yf[1],kd[1]),Math.max(Ud[0],xf[0],yf[0],kd[0]),Math.max(Ud[1],xf[1],yf[1],kd[1]),Yg)):fl(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),Yg),x&&(T=Math.round(T),P=Math.round(P)),{drawImageX:T,drawImageY:P,drawImageW:R,drawImageH:C,originX:c,originY:u,declutterBox:{minX:Yg[0],minY:Yg[1],maxX:Yg[2],maxY:Yg[3],value:S},canvasTransform:B,scale:p}}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,Ud,xf,yf,kd,o,a),uV(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=Ir(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=hN(Array.isArray(e)?e[0]:e,s.textAlign||Ld),u=uy[s.textBaseline||nA],f=a&&a.lineWidth?a.lineWidth:0,p=o.width/l-2*s.scale[0],x=c*p+2*(.5-c)*f,v=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:x,anchorY:v}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&Fo(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=Va(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),hz(this.renderedTransform_,n));let f=0,p=r.length,x=0,v,w=[],S,T,P,R,C,L,D,F,N,B,z,V,H,Z=0,J=0,j=this.coordinateCache_,K=this.viewRotation_,ee=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,ae={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:K},ce=this.instructions!=r||this.overlaps?0:200,de,be,Ie,Qe;for(;f<p;){let Ue=r[f];switch(Ue[0]){case An.BEGIN_GEOMETRY:de=Ue[1],Qe=Ue[3],de.getGeometry()?a!==void 0&&!yr(a,Qe.getExtent())?f=Ue[2]+1:++f:f=Ue[2],c&&(c.zIndex=Ue[4]);break;case An.BEGIN_PATH:Z>ce&&(this.fill_(e),Z=0),J>ce&&(e.stroke(),J=0),!Z&&!J&&(e.beginPath(),C=NaN,L=NaN),++f;break;case An.CIRCLE:x=Ue[1],P=Ue[2]??0;let Me=u[x],ze=u[x+1],$e=u[x+2]-P,Et=u[x+3]-P,Tt=$e-Me,Ct=Et-ze,un=Math.sqrt(Tt*Tt+Ct*Ct);e.moveTo(Me+un,ze),e.arc(Me,ze,un,0,2*Math.PI,!0),++f;break;case An.CLOSE_PATH:e.closePath(),++f;break;case An.CUSTOM:x=Ue[1],v=Ue[2];let Gt=Ue[3],Xe=Ue[4],st=Ue[5];ae.geometry=Gt,ae.feature=de,f in j||(j[f]=[]);let tt=j[f];st?st(u,x,v,2,tt):(tt[0]=u[x],tt[1]=u[x+1],tt.length=2),c&&(c.zIndex=Ue[6]),Xe(tt,ae),++f;break;case An.DRAW_IMAGE:x=Ue[1],v=Ue[2],N=Ue[3],S=Ue[4],T=Ue[5];let vt=Ue[6],yt=Ue[7],ln=Ue[8],Kt=Ue[9],Qt=Ue[10],xn=Ue[11],ge=Ue[12],pi=Ue[13];R=Ue[14]||"declutter";let Bn=Ue[15];if(!N&&Ue.length>=20){B=Ue[19],z=Ue[20],V=Ue[21],H=Ue[22];let Nn=this.drawLabelWithPointPlacement_(B,z,V,H);N=Nn.label,Ue[3]=N;let Vr=Ue[23];S=(Nn.anchorX-Vr)*this.pixelRatio,Ue[4]=S;let _r=Ue[24];T=(Nn.anchorY-_r)*this.pixelRatio,Ue[5]=T,vt=N.height,Ue[6]=vt,pi=N.width,Ue[13]=pi}let le;Ue.length>25&&(le=Ue[25]);let X,Te,Pe;Ue.length>17?(X=Ue[16],Te=Ue[17],Pe=Ue[18]):(X=uf,Te=null,Pe=null),Qt&&ee?xn+=K:!Qt&&!ee&&(xn-=K);let Ve=0;for(;x<v;x+=2){if(le&&le[Ve++]<pi/this.pixelRatio)continue;let Nn=this.calculateImageOrLabelDimensions_(N.width,N.height,u[x],u[x+1],pi,vt,S,T,ln,Kt,xn,ge,s,X,!!Te||!!Pe,de),Vr=[e,t,N,Nn,yt,Te,Pe];if(l){let _r,al,ra;if(Bn){let ar=v-x;if(!Bn[ar]){Bn[ar]={args:Vr,declutterMode:R};continue}let Ds=Bn[ar];_r=Ds.args,al=Ds.declutterMode,delete Bn[ar],ra=nH(_r)}let ll,Da;if(_r&&(al!=="declutter"||!l.collides(ra))&&(ll=!0),(R!=="declutter"||!l.collides(Nn.declutterBox))&&(Da=!0),al==="declutter"&&R==="declutter"){let ar=ll&&Da;ll=ar,Da=ar}ll&&(al!=="none"&&l.insert(ra),this.replayImageOrLabel_.apply(this,_r)),Da&&(R!=="none"&&l.insert(Nn.declutterBox),this.replayImageOrLabel_.apply(this,Vr))}else this.replayImageOrLabel_.apply(this,Vr)}++f;break;case An.DRAW_CHARS:let gt=Ue[1],St=Ue[2],qe=Ue[3],Ke=Ue[4];H=Ue[5];let Rt=Ue[6],en=Ue[7],Pt=Ue[8];V=Ue[9];let Mt=Ue[10];B=Ue[11],Array.isArray(B)&&(B=B.reduce(Jle,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];R=Ue[14]||"declutter";let yn=Ue[15],Pn=Ue[16],xe=this.textStates[z],bt=xe.font,Ye=[xe.scale[0]*en,xe.scale[1]*en],wt;bt in this.widths_?wt=this.widths_[bt]:(wt={},this.widths_[bt]=wt);let Dt=eH(u,gt,St,2),ct=Math.abs(Ye[0])*bI(bt,B,wt);if(Ke||ct<=Dt){let Nn=this.textStates[z].textAlign,Vr=(Dt-ct)*hN(B,Nn),_r=tH(u,gt,St,2,B,Vr,Rt,Math.abs(Ye[0]),bI,bt,wt,ee?0:this.viewRotation_,yn);e:if(_r){let al=[],ra,ll,Da,ar,Ds;if(V)for(ra=0,ll=_r.length;ra<ll;++ra){Ds=_r[ra],Da=Ds[4],ar=this.createLabel(Da,z,"",V),S=Ds[2]+(Ye[0]<0?-Mt:Mt)-Pn,T=qe*ar.height+(.5-qe)*2*Mt*Ye[1]/Ye[0]-Pt;let cl=this.calculateImageOrLabelDimensions_(ar.width,ar.height,Ds[0],Ds[1],ar.width,ar.height,S,T,0,0,Ds[3],cn,!1,uf,!1,de);if(l&&R==="declutter"&&l.collides(cl.declutterBox))break e;al.push([e,t,ar,cl,1,null,null])}if(H)for(ra=0,ll=_r.length;ra<ll;++ra){Ds=_r[ra],Da=Ds[4],ar=this.createLabel(Da,z,H,""),S=Ds[2]-Pn,T=qe*ar.height-Pt;let cl=this.calculateImageOrLabelDimensions_(ar.width,ar.height,Ds[0],Ds[1],ar.width,ar.height,S,T,0,0,Ds[3],cn,!1,uf,!1,de);if(l&&R==="declutter"&&l.collides(cl.declutterBox))break e;al.push([e,t,ar,cl,1,null,null])}l&&R!=="none"&&l.load(al.map(nH));for(let cl=0,gu=al.length;cl<gu;++cl)this.replayImageOrLabel_.apply(this,al[cl])}}++f;break;case An.END_GEOMETRY:if(o!==void 0){de=Ue[1];let Nn=o(de,Qe,R);if(Nn)return Nn}++f;break;case An.FILL:ce?Z++:this.fill_(e),++f;break;case An.MOVE_TO_LINE_TO:x=Ue[1],v=Ue[2],P=Ue[3];let Ce,jt,Wi;if(P){let Vr=(Ue[4]??!1)||Math.abs(u[x]-u[v-2])<1e-6&&Math.abs(u[x+1]-u[v-1])<1e-6;XS(u,x,v,2,P,Vr,w),$S(w,2,Vr),Ce=w,jt=0,Wi=Ce.length}else Ce=u,jt=x,Wi=v;be=Ce[jt],Ie=Ce[jt+1],e.moveTo(be,Ie),C=be+.5|0,L=Ie+.5|0;for(let Nn=jt+2;Nn<Wi;Nn+=2)be=Ce[Nn],Ie=Ce[Nn+1],D=be+.5|0,F=Ie+.5|0,(Nn==Wi-2||D!==C||F!==L)&&(e.lineTo(be,Ie),C=D,L=F);++f;break;case An.SET_FILL_STYLE:this.alignAndScaleFill_=Ue[2],Z?(this.fill_(e),Z=0,J&&(e.stroke(),J=0)):J&&Ue[1]&&(e.stroke(),J=0),e.fillStyle=Ue[1],++f;break;case An.SET_STROKE_STYLE:Z&&Ue[1]&&(this.fill_(e),Z=0),J&&(e.stroke(),J=0),this.setStrokeStyle_(e,Ue),++f;break;case An.STROKE:ce?J++:e.stroke(),++f;break;default:++f;break}}Z&&this.fill_(e),J&&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)}},rH=fN;var Gd=["Polygon","Circle","LineString","Image","Text","Default"],AN=["Image","Text"],sH=Gd.filter(i=>!AN.includes(i)),oH=!1,aH=!1;function ece(){let i=0,e=n=>{let r=Ti(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};oH={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],aH=!0}var pN=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_=Ks(),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 rH(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){aH===!1&&ece(),r=Math.round(r);let a=r*2+1,l=uo(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Ti(a,a,null,{willReadFrequently:oH}));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=Pr(),z0(f,e),cg(f,t*(this.renderBuffer_+r),f));let p=tce(r),x;function v(L,D,F){let N=u.getImageData(0,0,a,a).data;for(let B=0,z=p.length;B<z;B++)if(N[p[B]]>0){if(!o||F==="none"||x!=="Image"&&x!=="Text"||o.includes(L)){let V=(p[B]-3)/4,H=r-V%a,Z=r-(V/a|0),J=s(L,D,H*H+Z*Z);if(J)return J}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(za);let S,T,P,R,C;for(S=w.length-1;S>=0;--S){let L=w[S].toString();for(P=this.executorsByZIndex_[L],T=Gd.length-1;T>=0;--T)if(x=Gd[T],R=P[x],R!==void 0&&(C=R.executeHitDetection(u,l,n,v,f),C))return C}}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 Va(a,0,8,2,e,a),a}isEmpty(){return Mc(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?kG:za),o=o||Gd;let c=Gd.length;for(let u=0,f=l.length;u<f;++u){let p=l[u].toString(),x=this.executorsByZIndex_[p];for(let v=0,w=o.length;v<w;++v){let S=o[v],T=x[S];if(T!==void 0){let P=a===null?void 0:T.getZIndexContext(),R=P?P.getContext():e,C=this.maxExtent_&&S!=="Image"&&S!=="Text";if(C&&(R.save(),this.clip(R,n)),!P||S==="Text"||S==="Image"?T.execute(R,t,n,r,s,a):P.pushFunction(L=>T.execute(L,t,n,r,s,a)),C&&R.restore(),P){P.offset();let L=l[u]*c+Gd.indexOf(S);this.deferredZIndexContexts_[L]||(this.deferredZIndexContexts_[L]=[]),this.deferredZIndexContexts_[L].push(P)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(za);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}},dN={};function tce(i){if(dN[i]!==void 0)return dN[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 dN[i]=r,r}var lH=pN;var mN=class extends jS{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?V0(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_=Ks()}drawImages_(e,t,n,r){if(!this.image_)return;let s=Va(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 p=s[u]-this.imageAnchorX_,x=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let v=p+this.imageAnchorX_,w=x+this.imageAnchorY_;uo(a,v,w,1,1,c,-v,-w),o.save(),o.transform.apply(o,a),o.translate(v,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_,p,x,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=Va(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=Va(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=XS(l,0,u,2,o,f,l),$S(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_)),!!yr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Iz(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_)),!!yr(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(yr(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_)),!!yr(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_)),!!yr(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),Fo(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:Ld;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:qa(n||ks)}}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||Ha,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Iu,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||Wa)*this.pixelRatio_,lineJoin:a!==void 0?a:Nu,lineWidth:(l!==void 0?l:hf)*this.pixelRatio_,miterLimit:c!==void 0?c:cf,strokeStyle:qa(n||Bo),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 x=t.getColor();this.textFillState_={fillStyle:qa(x||ks)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let x=n.getColor(),v=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),P=n.getWidth(),R=n.getMiterLimit();this.textStrokeState_={lineCap:v!==void 0?v:Iu,lineDash:w||Ha,lineDashOffset:S||Wa,lineJoin:T!==void 0?T:Nu,lineWidth:P!==void 0?P:hf,miterLimit:R!==void 0?R:cf,strokeStyle:qa(x||Bo)}}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(),p=e.getTextBaseline();this.textState_={font:r!==void 0?r:lS,textAlign:f!==void 0?f:Ld,textBaseline:p!==void 0?p:nA},this.text_=u!==void 0?Array.isArray(u)?u.reduce((x,v,w)=>x+=w%2?" ":v,""):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]]}}},cH=mN;var zc=.5;function uH(i,e,t,n,r,s,o,a,l){let c=l?yd(r,l):r,u=i[0]*zc,f=i[1]*zc,p=Ti(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,v=new cH(p,zc,r,null,o,a,l?W0(X0(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let R=1;R<=w;++R){let C=t[R-1],L=C.getStyleFunction()||n;if(!L)continue;let D=L(C,s);if(!D)continue;Array.isArray(D)||(D=[D]);let N=(R*S).toString(16).padStart(7,"#00000");for(let B=0,z=D.length;B<z;++B){let V=D[B],H=V.getGeometryFunction()(C);if(!H||!yr(c,H.getExtent()))continue;let Z=V.clone(),J=Z.getFill();J&&J.setColor(N);let j=Z.getStroke();j&&(j.setColor(N),j.setLineDash(null)),Z.setText(void 0);let K=V.getImage();if(K){let de=K.getImageSize();if(!de)continue;let be=Ti(de[0],de[1],void 0,{alpha:!1}),Ie=be.canvas;be.fillStyle=N,be.fillRect(0,0,Ie.width,Ie.height),Z.setImage(new iA({img:Ie,anchor:K.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:K.getOrigin(),opacity:1,size:K.getSize(),scale:K.getScale(),rotation:K.getRotation(),rotateWithView:K.getRotateWithView()}))}let ee=Z.getZIndex()||0,ae=T[ee];ae||(ae={},T[ee]=ae,ae.Polygon=[],ae.Circle=[],ae.LineString=[],ae.Point=[]);let ce=H.getType();if(ce==="GeometryCollection"){let de=H.getGeometriesArrayRecursive();for(let be=0,Ie=de.length;be<Ie;++be){let Qe=de[be];ae[Qe.getType().replace("Multi","")].push(Qe,Z)}}else ae[ce.replace("Multi","")].push(H,Z)}}let P=Object.keys(T).map(Number).sort(za);for(let R=0,C=P.length;R<C;++R){let L=T[P[R]];for(let D in L){let F=L[D];for(let N=0,B=F.length;N<B;N+=2){v.setStyle(F[N+1]);for(let z=0,V=e.length;z<V;++z)v.setTransform(e[z]),v.drawGeometry(F[N])}}}return p.getImageData(0,0,x.width,x.height)}function hH(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*zc),s=Math.floor(Math.round(i[1])*zc),o=(xi(r,0,t.width-1)+xi(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 nce=.5,fH={Point:cce,LineString:oce,Polygon:hce,MultiPoint:uce,MultiLineString:ace,MultiPolygon:lce,GeometryCollection:sce,Circle:ice};function dH(i,e){return parseInt(Ln(i),10)-parseInt(Ln(e),10)}function gN(i,e){let t=_N(i,e);return t*t}function _N(i,e){return nce*i/e}function ice(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 xN(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let p=!0,x=c.getImageState();x==Mn.LOADED||x==Mn.ERROR?p=!1:x==Mn.IDLE&&c.load(),p&&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)),rce(i,e,t,n,s,o,a),f}function rce(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())pH(i,l,t,e,o);else{let u=fH[l.getType()];u(i,l,t,e,o,s)}}function pH(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)pH(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function sce(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=fH[o[a].getType()];c(i,o[a],t,n,r,s)}}function oce(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 ace(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 lce(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 cce(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()!=Mn.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 uce(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()!=Mn.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 hce(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 yN=class extends WS{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_=Pr(),this.wrappedRenderedExtent_=Pr(),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(),p=this.getLayer().getDeclutter(),x=t.pixelRatio,v=t.viewHints,w=!(v[Gs.ANIMATING]||v[Gs.INTERACTING]),S=this.context,T=Math.round(jn(r)/a*x),P=Math.round(xr(r)/a*x),R=f.getWrapX()&&l.canWrapX(),C=R?jn(u):null,L=R?Math.ceil((r[2]-u[2])/C)+(this.extendX_?2:1):1,D=R?Math.floor((r[0]-u[0])/C)-(this.extendX_?1:0):0;do{let F=this.getRenderTransform(o,a,0,x,T,P,D*C);t.declutter&&(F=F.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],F,c,w,n===void 0?Gd:n?AN:sH,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Ti(this.context.canvas.width,this.context.canvas.height,X5))}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,Z0(this.context),X5.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(Ao.PRERENDER)||this.getLayer().hasListener(Ao.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=Pc(n.extent,l);a=yr(u,e.extent),a&&!yu(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]*zc,p=n[1]*zc;u.push(this.getRenderTransform(r,s,o,zc,f,p,0).slice());let x=c.getSource(),v=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!yu(v,l)){let S=l[0],T=jn(v),P=0,R;for(;S<v[0];)--P,R=T*P,u.push(this.getRenderTransform(r,s,o,zc,f,p,R).slice()),S+=T;for(P=0,S=l[2];S>v[2];)++P,R=T*P,u.push(this.getRenderTransform(r,s,o,zc,f,p,R).slice()),S-=T}let w=X0();this.hitDetectionImageData_=uH(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,gN(s,this.renderedPixelRatio_),w?a:null)}t(hH(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(p,x,v){let w=Ln(p),S=c[w];if(S){if(S!==!0&&v<S.distanceSq){if(v===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(p,l,x);S.geometry=x,S.distanceSq=v}}else{if(v===0)return c[w]=!0,r(p,l,x);s.push(c[w]={feature:p,layer:l,geometry:x,distanceSq:v,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(p=>p.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[Gs.ANIMATING],s=e.viewHints[Gs.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,p=e.pixelRatio,x=t.getRevision(),v=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=dH);let S=c.center.slice(),T=cg(l,v*f),P=T.slice(),R=[T.slice()],C=u.getExtent(),L=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,L){let K=n.getExtent();K&&!bu(K)&&(this.extendX_=K[0]<C[0]||K[2]>C[2])}if(L&&(!yu(C,e.extent)||this.extendX_)){let K=jn(C),ee=Math.max(jn(T)/2,K),ae=C[0],ce=C[2];this.extendX_&&(ae-=K,ce+=K),T[0]=ae-ee,T[2]=ce+ee,yw(S,u);let de=oP(R[0],u);de[0]<C[0]&&de[2]<C[2]?R.push([de[0]+K,de[1],de[2]+K,de[3]]):de[0]>C[0]&&de[2]>C[2]&&R.push([de[0]-K,de[1],de[2]-K,de[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===p&&this.renderedRevision_==x&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&yu(this.wrappedRenderedExtent_,T))return Fo(this.renderedExtent_,P)||(this.hitDetectionImageData_=null,this.renderedExtent_=P),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new Jq(_N(f,p),T,f,p),F=X0(),N;if(F){for(let K=0,ee=R.length;K<ee;++K){let ae=R[K],ce=yd(ae,u);n.loadFeatures(ce,OG(f,u),F)}N=W0(F,u)}else for(let K=0,ee=R.length;K<ee;++K)n.loadFeatures(R[K],f,u);let B=gN(f,p),z=!0,V=(K,ee)=>{let ae,ce=K.getStyleFunction()||t.getStyleFunction();if(ce&&(ae=ce(K,f)),ae){let de=this.renderFeature(K,B,ae,D,N,this.getLayer().getDeclutter(),ee);z=z&&!de}},H=yd(T,u),Z=n.getFeaturesInExtent(H);w&&Z.sort(w);for(let K=0,ee=Z.length;K<ee;++K)V(Z[K],K);this.renderedFeatures_=Z,this.ready=z;let J=D.finish(),j=new lH(T,f,p,n.getOverlaps(),J,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=x,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=P,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=p,this.replayGroup_=j,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=xN(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=xN(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},AH=yN;var vN=class extends zS{constructor(e){super(e)}createRenderer(){return new AH(this)}},mH=vN;var fce=!1;function dce(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=fce,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 bN(i,e){return function(t,n,r,s,o){dce(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function gH(i,e){return[[-1/0,-1/0,1/0,1/0]]}function wN(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],p=0,x=[0];for(let S=e+n;S<t;S+=n){let T=i[S],P=i[S+1];p+=Math.sqrt((T-u)*(T-u)+(P-f)*(P-f)),x.push(p),u=T,f=P}let v=r*p,w=UG(x,v);w<0?(l=(v-x[-w-2])/(x[-w-1]-x[-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]:Do(i[a+u],i[a+n+u],l);return s}var _H=Ks(),hy=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"?dw(this.flatCoordinates_):ug(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Ga(this.getExtent());this.flatInteriorPoints_=Lx(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=Vz(this.flatCoordinates_,this.ends_),t=pS(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=jw(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=wN(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=wN(e,t,o,this.stride_,.5);Ic(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=vs(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=xr(n)/xr(t);uo(_H,n[0],n[3],r,-r,0,0,0),Va(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,_H,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=Lw((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=Ix(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=Uz(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Nx(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}};hy.prototype.getFlatCoordinates=hy.prototype.getOrientedFlatCoordinates;var hA=hy;var SN=class{constructor(e){this.rbush_=new lA(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_[Ln(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_[Ln(a)]=l}this.rbush_.load(n)}remove(e){let t=Ln(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Ln(t)],r=[n.minX,n.minY,n.maxX,n.maxY];G0(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 Mc(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return fl(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]}},TN=SN;var Al={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var ku=class extends Zs{constructor(e,t,n){super(e),this.feature=t,this.features=n}},EN=class extends Vw{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_=of,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&&(Vn(this.format_,"`format` must be set when `url` is set"),this.loader_=bN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:gH;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new TN:null,this.loadedExtentsRtree_=new TN,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=Ln(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 ku(Al.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof hA||(this.featureChangeKeys_[e]=[kn(t,Jt.CHANGE,this.handleFeatureChange_,this),kn(t,Nc.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 hA){let s=this.idIndex_[r];s instanceof hA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(Vn(!(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=Ln(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Ln(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(Al.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new ku(Al.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Al.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(Al.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(Qs.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Qs.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(ri);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 ku(Al.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 hA||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 hA||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(),Mc(this.nullGeometryFeatures_)||Ic(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=mw(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||rf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof hA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let p=Math.sqrt(a);l[0]=n-p,l[1]=r-p,l[2]=n+p,l[3]=r+p}}}),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=Ln(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 ku(Al.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 Ln(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Mc(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 yu(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new ku(Al.FEATURESLOADSTART));let u=v=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new ku(Al.FEATURESLOADEND,void 0,v))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new ku(Al.FEATURESLOADERROR))},p=!1,x=this.loader_.call(this,l,t,n,v=>p||u(v),()=>p||f());x instanceof Promise?(p=!0,x.then(v=>{this.addFeatures(v),u(v)}).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=sP(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=Ln(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(ri),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(Al.REMOVEFEATURE)&&this.dispatchEvent(new ku(Al.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){Vn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(bN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},vf=EN;var xa={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ap={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},e3=0,r2=1,t3=2;var pL=0,lp=1,n3=2,tc=3,_o=0,hi=1,sr=2,Kr=0,cs=1,Xu=2,$u=3,Yu=4,Uf=5,s2=6,zs=100,o2=101,a2=102,i3=103,r3=104,$c=200,l2=201,c2=202,u2=203,$d=204,Yd=205,h2=206,f2=207,d2=208,p2=209,A2=210,aW=211,lW=212,cW=213,uW=214,mA=0,gA=1,_A=2,Vu=3,xA=4,yA=5,vA=6,bA=7,kA=0,s3=1,o3=2,Vs=0,m2=1,g2=2,_2=3,x2=4,AL=5,y2=6,v2=7;var b2=300,vl=301,nc=302,cp=303,up=304,Zu=306,If=1e3,Vo=1001,Nf=1002,yi=1003,w2=1004;var ic=1005;var bi=1006,hp=1007;var yo=1008,mL=1008,Vi=1009,Ku=1010,Qu=1011,Ya=1012,Fr=1013,Ai=1014,Ki=1015,Fi=1016,GA=1017,zA=1018,Ho=1020,VA=35902,qA=35899,N_=1021,kf=1022,wr=1023,Ts=1026,eo=1027,Gf=1028,Ju=1029,Rs=1030,eh=1031,S2=1032,fp=1033,th=33776,nh=33777,ih=33778,rh=33779,HA=35840,WA=35841,jA=35842,XA=35843,dp=36196,pp=37492,Ap=37496,mp=37488,gp=37489,sh=37490,_p=37491,xp=37808,yp=37809,vp=37810,bp=37811,wp=37812,Sp=37813,Tp=37814,Ep=37815,Mp=37816,Cp=37817,Rp=37818,Pp=37819,Ip=37820,Np=37821,Lp=36492,Dp=36494,Fp=36495,Op=36283,Bp=36284,oh=36285,Up=36286;var Ty=2300,CT=2301,ET=2302,tL=2303,nL=2400,iL=2401,rL=2402;var gL=0,_L=1,a3=2,hW=3200;var bl=0,l3=1,Wo="",vr="srgb",Zd="srgb-linear",Kd="linear",Bt="srgb",T2="",c3="rg",xL="ga",yL=0,Mf=7680,vL=7681,bL=7682,wL=7683,SL=34055,TL=34056,EL=5386,ML=512,CL=513,RL=514,PL=515,IL=516,NL=517,LL=518,Ey=519,E2=512,L_=513,M2=514,ah=515,$A=516,C2=517,Yc=518,R2=519,Qd=35044,YA=35048;var DL="300 es",go=2e3,ja=2001,rc={COMPUTE:"compute",RENDER:"render"};var zf={TEXTURE_COMPARE:"depthTextureCompare"};function pce(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function D_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function m_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function u3(){let i=m_("canvas");return i.style.display="block",i}var xH={},g_=null;function wA(...i){let e="THREE."+i.shift();g_?g_("log",e,...i):console.log(e,...i)}function fW(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 je(...i){i=fW(i);let e="THREE."+i.shift();if(g_)g_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=fW(i);let e="THREE."+i.shift();if(g_)g_("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Qn(...i){let e=i.join(" ");e in xH||(xH[e]=!0,je(...i))}function FL(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function dW(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 P2={[mA]:gA,[_A]:vA,[xA]:bA,[Vu]:yA,[gA]:mA,[vA]:_A,[bA]:xA,[yA]:Vu},qo=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}}},Go=["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"],yH=1234567,vy=Math.PI/180,Lf=180/Math.PI;function zu(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Go[i&255]+Go[i>>8&255]+Go[i>>16&255]+Go[i>>24&255]+"-"+Go[e&255]+Go[e>>8&255]+"-"+Go[e>>16&15|64]+Go[e>>24&255]+"-"+Go[t&63|128]+Go[t>>8&255]+"-"+Go[t>>16&255]+Go[t>>24&255]+Go[n&255]+Go[n>>8&255]+Go[n>>16&255]+Go[n>>24&255]).toLowerCase()}function In(i,e,t){return Math.max(e,Math.min(t,i))}function OL(i,e){return(i%e+e)%e}function Ace(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function mce(i,e,t){return i!==e?(t-i)/(e-i):0}function by(i,e,t){return(1-t)*i+t*e}function gce(i,e,t,n){return by(i,e,1-Math.exp(-t*n))}function _ce(i,e=1){return e-Math.abs(OL(i,e*2)-e)}function xce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function yce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function vce(i,e){return i+Math.floor(Math.random()*(e-i+1))}function bce(i,e){return i+Math.random()*(e-i)}function wce(i){return i*(.5-Math.random())}function Sce(i){i!==void 0&&(yH=i);let e=yH+=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 Tce(i){return i*vy}function Ece(i){return i*Lf}function Mce(i){return(i&i-1)===0&&i!==0}function Cce(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Rce(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Pce(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),p=o((e-n)/2),x=s((n-e)/2),v=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*p,a*c);break;case"YZY":i.set(l*p,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*p,a*u,a*c);break;case"XZX":i.set(a*u,l*v,l*x,a*c);break;case"YXY":i.set(l*x,a*u,l*v,a*c);break;case"ZYZ":i.set(l*v,l*x,a*u,a*c);break;default:je("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ha(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 Wn(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 Zc={DEG2RAD:vy,RAD2DEG:Lf,generateUUID:zu,clamp:In,euclideanModulo:OL,mapLinear:Ace,inverseLerp:mce,lerp:by,damp:gce,pingpong:_ce,smoothstep:xce,smootherstep:yce,randInt:vce,randFloat:bce,randFloatSpread:wce,seededRandom:Sce,degToRad:Tce,radToDeg:Ece,isPowerOfTwo:Mce,ceilPowerOfTwo:Cce,floorPowerOfTwo:Rce,setQuaternionFromProperEuler:Pce,normalize:Wn,denormalize:ha},zL=class zL{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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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(In(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}};zL.prototype.isVector2=!0;var Oe=zL,Es=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],p=s[o+0],x=s[o+1],v=s[o+2],w=s[o+3];if(f!==w||l!==p||c!==x||u!==v){let S=l*p+c*x+u*v+f*w;S<0&&(p=-p,x=-x,v=-v,w=-w,S=-S);let T=1-a;if(S<.9995){let P=Math.acos(S),R=Math.sin(P);T=Math.sin(T*P)/R,a=Math.sin(a*P)/R,l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a}else{l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a;let P=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=P,c*=P,u*=P,f*=P}}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],p=s[o+1],x=s[o+2],v=s[o+3];return e[t]=a*v+u*f+l*x-c*p,e[t+1]=l*v+u*p+c*f-a*x,e[t+2]=c*v+u*x+a*p-l*f,e[t+3]=u*v-a*f-l*p-c*x,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),p=l(n/2),x=l(r/2),v=l(s/2);switch(o){case"XYZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"YXZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"ZXY":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"ZYX":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"YZX":this._x=p*u*f+c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f-p*x*v;break;case"XZY":this._x=p*u*f-c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f+p*x*v;break;default:je("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],p=n+a+f;if(p>0){let x=.5/Math.sqrt(p+1);this._w=.25/x,this._x=(u-l)*x,this._y=(s-c)*x,this._z=(o-r)*x}else if(n>a&&n>f){let x=2*Math.sqrt(1+n-a-f);this._w=(u-l)/x,this._x=.25*x,this._y=(r+o)/x,this._z=(s+c)/x}else if(a>f){let x=2*Math.sqrt(1+a-n-f);this._w=(s-c)/x,this._x=(r+o)/x,this._y=.25*x,this._z=(l+u)/x}else{let x=2*Math.sqrt(1+f-n-a);this._w=(o-r)/x,this._x=(s+c)/x,this._y=(l+u)/x,this._z=.25*x}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(In(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}},VL=class VL{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(vH.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(vH.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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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 MN.copy(this).projectOnVector(e),this.sub(MN)}reflect(e){return this.sub(MN.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(In(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}};VL.prototype.isVector3=!0;var ie=VL,MN=new ie,vH=new Es,qL=class qL{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],p=n[2],x=n[5],v=n[8],w=r[0],S=r[3],T=r[6],P=r[1],R=r[4],C=r[7],L=r[2],D=r[5],F=r[8];return s[0]=o*w+a*P+l*L,s[3]=o*S+a*R+l*D,s[6]=o*T+a*C+l*F,s[1]=c*w+u*P+f*L,s[4]=c*S+u*R+f*D,s[7]=c*T+u*C+f*F,s[2]=p*w+x*P+v*L,s[5]=p*S+x*R+v*D,s[8]=p*T+x*C+v*F,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,p=a*l-u*s,x=c*s-o*l,v=t*f+n*p+r*x;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/v;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=p*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=x*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 Qn("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(CN.makeScale(e,t)),this}rotate(e){return Qn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(CN.makeRotation(-e)),this}translate(e,t){return Qn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(CN.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)}};qL.prototype.isMatrix3=!0;var Sn=qL,CN=new Sn,bH=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),wH=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ice(){let i={enabled:!0,workingColorSpace:Zd,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=Pf(r.r),r.g=Pf(r.g),r.b=Pf(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===Bt&&(r.r=A_(r.r),r.g=A_(r.g),r.b=A_(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===Wo?Kd: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 Qn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Qn("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({[Zd]:{primaries:e,whitePoint:n,transfer:Kd,toXYZ:bH,fromXYZ:wH,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:vr},outputColorSpaceConfig:{drawingBufferColorSpace:vr}},[vr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:bH,fromXYZ:wH,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:vr}}}),i}var sn=Ice();function Pf(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function A_(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Zg,RT=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{Zg===void 0&&(Zg=m_("canvas")),Zg.width=e.width,Zg.height=e.height;let r=Zg.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Zg}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=m_("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]=Pf(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(Pf(t[n]/255)*255):t[n]=Pf(t[n]);return{data:t,width:e.width,height:e.height}}else return je("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Nce=0,__=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Nce++}),this.uuid=zu(),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(RN(r[o].image)):s.push(RN(r[o]))}else s=RN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function RN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?RT.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(je("Texture: Unable to serialize Texture."),{})}var Lce=0,PN=new ie,Ms=class i extends qo{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=Vo,r=Vo,s=bi,o=yo,a=wr,l=Vi,c=i.DEFAULT_ANISOTROPY,u=Wo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Lce++}),this.uuid=zu(),this.name="",this.source=new __(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 Sn,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(PN).x}get height(){return this.source.getSize(PN).y}get depth(){return this.source.getSize(PN).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){je(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`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!==b2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case If:e.x=e.x-Math.floor(e.x);break;case Vo:e.x=e.x<0?0:1;break;case Nf: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 If:e.y=e.y-Math.floor(e.y);break;case Vo:e.y=e.y<0?0:1;break;case Nf: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++}};Ms.DEFAULT_IMAGE=null;Ms.DEFAULT_MAPPING=b2;Ms.DEFAULT_ANISOTROPY=1;var HL=class HL{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],p=l[1],x=l[5],v=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-w)<.01&&Math.abs(v-S)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+w)<.1&&Math.abs(v+S)<.1&&Math.abs(c+x+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let R=(c+1)/2,C=(x+1)/2,L=(T+1)/2,D=(u+p)/4,F=(f+w)/4,N=(v+S)/4;return R>C&&R>L?R<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(R),r=D/n,s=F/n):C>L?C<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(C),n=D/r,s=N/r):L<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(L),n=F/s,r=N/s),this.set(n,r,s,t),this}let P=Math.sqrt((S-v)*(S-v)+(f-w)*(f-w)+(p-u)*(p-u));return Math.abs(P)<.001&&(P=1),this.x=(S-v)/P,this.y=(f-w)/P,this.z=(p-u)/P,this.w=Math.acos((c+x+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=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this.w=In(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this.w=In(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(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}};HL.prototype.isVector4=!0;var gn=HL,fa=class extends qo{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:bi,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 gn(0,0,e,t),this.scissorTest=!1,this.viewport=new gn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new Ms(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:bi,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 __(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"})}},da=class extends fa{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},SA=class extends Ms{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=yi,this.minFilter=yi,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var PT=class extends Ms{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=yi,this.minFilter=yi,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var JT=class JT{constructor(e,t,n,r,s,o,a,l,c,u,f,p,x,v,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,p,x,v,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,p,x,v,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]=p,T[3]=x,T[7]=v,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 JT().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/Kg.setFromMatrixColumn(e,0).length(),s=1/Kg.setFromMatrixColumn(e,1).length(),o=1/Kg.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 p=o*u,x=o*f,v=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=x+v*c,t[5]=p-w*c,t[9]=-a*l,t[2]=w-p*c,t[6]=v+x*c,t[10]=o*l}else if(e.order==="YXZ"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p+w*a,t[4]=v*a-x,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=x*a-v,t[6]=w+p*a,t[10]=o*l}else if(e.order==="ZXY"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p-w*a,t[4]=-o*f,t[8]=v+x*a,t[1]=x+v*a,t[5]=o*u,t[9]=w-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let p=o*u,x=o*f,v=a*u,w=a*f;t[0]=l*u,t[4]=v*c-x,t[8]=p*c+w,t[1]=l*f,t[5]=w*c+p,t[9]=x*c-v,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=w-p*f,t[8]=v*f+x,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=x*f+v,t[10]=p-w*f}else if(e.order==="XZY"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=p*f+w,t[5]=o*u,t[9]=x*f-v,t[2]=v*f-x,t[6]=a*u,t[10]=w*f+p}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(Dce,e,Fce)}lookAt(e,t,n){let r=this.elements;return ml.subVectors(e,t),ml.lengthSq()===0&&(ml.z=1),ml.normalize(),zd.crossVectors(n,ml),zd.lengthSq()===0&&(Math.abs(n.z)===1?ml.x+=1e-4:ml.z+=1e-4,ml.normalize(),zd.crossVectors(n,ml)),zd.normalize(),YS.crossVectors(ml,zd),r[0]=zd.x,r[4]=YS.x,r[8]=ml.x,r[1]=zd.y,r[5]=YS.y,r[9]=ml.y,r[2]=zd.z,r[6]=YS.z,r[10]=ml.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],p=n[9],x=n[13],v=n[2],w=n[6],S=n[10],T=n[14],P=n[3],R=n[7],C=n[11],L=n[15],D=r[0],F=r[4],N=r[8],B=r[12],z=r[1],V=r[5],H=r[9],Z=r[13],J=r[2],j=r[6],K=r[10],ee=r[14],ae=r[3],ce=r[7],de=r[11],be=r[15];return s[0]=o*D+a*z+l*J+c*ae,s[4]=o*F+a*V+l*j+c*ce,s[8]=o*N+a*H+l*K+c*de,s[12]=o*B+a*Z+l*ee+c*be,s[1]=u*D+f*z+p*J+x*ae,s[5]=u*F+f*V+p*j+x*ce,s[9]=u*N+f*H+p*K+x*de,s[13]=u*B+f*Z+p*ee+x*be,s[2]=v*D+w*z+S*J+T*ae,s[6]=v*F+w*V+S*j+T*ce,s[10]=v*N+w*H+S*K+T*de,s[14]=v*B+w*Z+S*ee+T*be,s[3]=P*D+R*z+C*J+L*ae,s[7]=P*F+R*V+C*j+L*ce,s[11]=P*N+R*H+C*K+L*de,s[15]=P*B+R*Z+C*ee+L*be,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],p=e[10],x=e[14],v=e[3],w=e[7],S=e[11],T=e[15],P=l*x-c*p,R=a*x-c*f,C=a*p-l*f,L=o*x-c*u,D=o*p-l*u,F=o*f-a*u;return t*(w*P-S*R+T*C)-n*(v*P-S*L+T*D)+r*(v*R-w*L+T*F)-s*(v*C-w*D+S*F)}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],p=e[10],x=e[11],v=e[12],w=e[13],S=e[14],T=e[15],P=t*a-n*o,R=t*l-r*o,C=t*c-s*o,L=n*l-r*a,D=n*c-s*a,F=r*c-s*l,N=u*w-f*v,B=u*S-p*v,z=u*T-x*v,V=f*S-p*w,H=f*T-x*w,Z=p*T-x*S,J=P*Z-R*H+C*V+L*z-D*B+F*N;if(J===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let j=1/J;return e[0]=(a*Z-l*H+c*V)*j,e[1]=(r*H-n*Z-s*V)*j,e[2]=(w*F-S*D+T*L)*j,e[3]=(p*D-f*F-x*L)*j,e[4]=(l*z-o*Z-c*B)*j,e[5]=(t*Z-r*z+s*B)*j,e[6]=(S*C-v*F-T*R)*j,e[7]=(u*F-p*C+x*R)*j,e[8]=(o*H-a*z+c*N)*j,e[9]=(n*z-t*H-s*N)*j,e[10]=(v*D-w*C+T*P)*j,e[11]=(f*C-u*D-x*P)*j,e[12]=(a*B-o*V-l*N)*j,e[13]=(t*V-n*B+r*N)*j,e[14]=(w*R-v*L-S*P)*j,e[15]=(u*L-f*R+p*P)*j,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,p=s*c,x=s*u,v=s*f,w=o*u,S=o*f,T=a*f,P=l*c,R=l*u,C=l*f,L=n.x,D=n.y,F=n.z;return r[0]=(1-(w+T))*L,r[1]=(x+C)*L,r[2]=(v-R)*L,r[3]=0,r[4]=(x-C)*D,r[5]=(1-(p+T))*D,r[6]=(S+P)*D,r[7]=0,r[8]=(v+R)*F,r[9]=(S-P)*F,r[10]=(1-(p+w))*F,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=Kg.set(r[0],r[1],r[2]).length(),a=Kg.set(r[4],r[5],r[6]).length(),l=Kg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Vc.copy(this);let c=1/o,u=1/a,f=1/l;return Vc.elements[0]*=c,Vc.elements[1]*=c,Vc.elements[2]*=c,Vc.elements[4]*=u,Vc.elements[5]*=u,Vc.elements[6]*=u,Vc.elements[8]*=f,Vc.elements[9]*=f,Vc.elements[10]*=f,t.setFromRotationMatrix(Vc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=go,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),p=(t+e)/(t-e),x=(n+r)/(n-r),v,w;if(l)v=s/(o-s),w=o*s/(o-s);else if(a===go)v=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===ja)v=-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]=p,c[12]=0,c[1]=0,c[5]=f,c[9]=x,c[13]=0,c[2]=0,c[6]=0,c[10]=v,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=go,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),p=-(t+e)/(t-e),x=-(n+r)/(n-r),v,w;if(l)v=1/(o-s),w=o/(o-s);else if(a===go)v=-2/(o-s),w=-(o+s)/(o-s);else if(a===ja)v=-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]=p,c[1]=0,c[5]=f,c[9]=0,c[13]=x,c[2]=0,c[6]=0,c[10]=v,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}};JT.prototype.isMatrix4=!0;var on=JT,Kg=new ie,Vc=new on,Dce=new ie(0,0,0),Fce=new ie(1,1,1),zd=new ie,YS=new ie,ml=new ie,SH=new on,TH=new Es,pa=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],p=r[6],x=r[10];switch(t){case"XYZ":this._y=Math.asin(In(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-In(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(In(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,x),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-In(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(In(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,x));break;case"XZY":this._z=Math.asin(-In(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,x),this._y=0);break;default:je("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return SH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(SH,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return TH.setFromEuler(this),this.setFromQuaternion(TH,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}};pa.DEFAULT_ORDER="XYZ";var x_=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}},Oce=0,EH=new ie,Qg=new Es,bf=new on,ZS=new ie,fy=new ie,Bce=new ie,Uce=new Es,MH=new ie(1,0,0),CH=new ie(0,1,0),RH=new ie(0,0,1),PH={type:"added"},kce={type:"removed"},Jg={type:"childadded",child:null},IN={type:"childremoved",child:null},Zi=class i extends qo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Oce++}),this.uuid=zu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new ie,t=new pa,n=new Es,r=new ie(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 on},normalMatrix:{value:new Sn}}),this.matrix=new on,this.matrixWorld=new on,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new x_,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 Qg.setFromAxisAngle(e,t),this.quaternion.multiply(Qg),this}rotateOnWorldAxis(e,t){return Qg.setFromAxisAngle(e,t),this.quaternion.premultiply(Qg),this}rotateX(e){return this.rotateOnAxis(MH,e)}rotateY(e){return this.rotateOnAxis(CH,e)}rotateZ(e){return this.rotateOnAxis(RH,e)}translateOnAxis(e,t){return EH.copy(e).applyQuaternion(this.quaternion),this.position.add(EH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(MH,e)}translateY(e){return this.translateOnAxis(CH,e)}translateZ(e){return this.translateOnAxis(RH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(bf.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ZS.copy(e):ZS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),fy.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?bf.lookAt(fy,ZS,this.up):bf.lookAt(ZS,fy,this.up),this.quaternion.setFromRotationMatrix(bf),r&&(bf.extractRotation(r.matrixWorld),Qg.setFromRotationMatrix(bf),this.quaternion.premultiply(Qg.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("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(PH),Jg.child=e,this.dispatchEvent(Jg),Jg.child=null):Ge("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(kce),IN.child=e,this.dispatchEvent(IN),IN.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),bf.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),bf.multiply(e.parent.matrixWorld)),e.applyMatrix4(bf),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(PH),Jg.child=e,this.dispatchEvent(Jg),Jg.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(fy,e,Bce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fy,Uce,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),p=o(e.skeletons),x=o(e.animations),v=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),p.length>0&&(n.skeletons=p),x.length>0&&(n.animations=x),v.length>0&&(n.nodes=v)}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}};Zi.DEFAULT_UP=new ie(0,1,0);Zi.DEFAULT_MATRIX_AUTO_UPDATE=!0;Zi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var br=class extends Zi{constructor(){super(),this.isGroup=!0,this.type="Group"}},Gce={type:"move"},Jd=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 ie,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ie),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 ie,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ie,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"],p=u.position.distanceTo(f.position),x=.02,v=.005;c.inputState.pinching&&p>x+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=x-v&&(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(Gce)))}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]}},pW={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},Vd={h:0,s:0,l:0},KS={h:0,s:0,l:0};function NN(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 Ut=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=vr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,sn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=sn.workingColorSpace){return this.r=e,this.g=t,this.b=n,sn.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=sn.workingColorSpace){if(e=OL(e,1),t=In(t,0,1),n=In(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=NN(o,s,e+1/3),this.g=NN(o,s,e),this.b=NN(o,s,e-1/3)}return sn.colorSpaceToWorking(this,r),this}setStyle(e,t=vr){function n(s){s!==void 0&&parseFloat(s)<1&&je("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:je("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);je("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=vr){let n=pW[e.toLowerCase()];return n!==void 0?this.setHex(n,t):je("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=Pf(e.r),this.g=Pf(e.g),this.b=Pf(e.b),this}copyLinearToSRGB(e){return this.r=A_(e.r),this.g=A_(e.g),this.b=A_(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=vr){return sn.workingToColorSpace(zo.copy(this),e),Math.round(In(zo.r*255,0,255))*65536+Math.round(In(zo.g*255,0,255))*256+Math.round(In(zo.b*255,0,255))}getHexString(e=vr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.workingToColorSpace(zo.copy(this),t);let n=zo.r,r=zo.g,s=zo.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=sn.workingColorSpace){return sn.workingToColorSpace(zo.copy(this),t),e.r=zo.r,e.g=zo.g,e.b=zo.b,e}getStyle(e=vr){sn.workingToColorSpace(zo.copy(this),e);let t=zo.r,n=zo.g,r=zo.b;return e!==vr?`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(Vd),this.setHSL(Vd.h+e,Vd.s+t,Vd.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(Vd),e.getHSL(KS);let n=by(Vd.h,KS.h,t),r=by(Vd.s,KS.s,t),s=by(Vd.l,KS.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}},zo=new Ut;Ut.NAMES=pW;var ep=class extends Zi{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 pa,this.environmentIntensity=1,this.environmentRotation=new pa,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}},qc=new ie,wf=new ie,LN=new ie,Sf=new ie,e_=new ie,t_=new ie,IH=new ie,DN=new ie,FN=new ie,ON=new ie,BN=new gn,UN=new gn,kN=new gn,Cf=class i{constructor(e=new ie,t=new ie,n=new ie){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),qc.subVectors(e,t),r.cross(qc);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){qc.subVectors(r,t),wf.subVectors(n,t),LN.subVectors(e,t);let o=qc.dot(qc),a=qc.dot(wf),l=qc.dot(LN),c=wf.dot(wf),u=wf.dot(LN),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let p=1/f,x=(c*l-a*u)*p,v=(o*u-a*l)*p;return s.set(1-x-v,v,x)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Sf)===null?!1:Sf.x>=0&&Sf.y>=0&&Sf.x+Sf.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,Sf)===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,Sf.x),l.addScaledVector(o,Sf.y),l.addScaledVector(a,Sf.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return BN.setScalar(0),UN.setScalar(0),kN.setScalar(0),BN.fromBufferAttribute(e,t),UN.fromBufferAttribute(e,n),kN.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(BN,s.x),o.addScaledVector(UN,s.y),o.addScaledVector(kN,s.z),o}static isFrontFacing(e,t,n,r){return qc.subVectors(n,t),wf.subVectors(e,t),qc.cross(wf).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 qc.subVectors(this.c,this.b),wf.subVectors(this.a,this.b),qc.cross(wf).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;e_.subVectors(r,n),t_.subVectors(s,n),DN.subVectors(e,n);let l=e_.dot(DN),c=t_.dot(DN);if(l<=0&&c<=0)return t.copy(n);FN.subVectors(e,r);let u=e_.dot(FN),f=t_.dot(FN);if(u>=0&&f<=u)return t.copy(r);let p=l*f-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(e_,o);ON.subVectors(e,s);let x=e_.dot(ON),v=t_.dot(ON);if(v>=0&&x<=v)return t.copy(s);let w=x*c-l*v;if(w<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(n).addScaledVector(t_,a);let S=u*v-x*f;if(S<=0&&f-u>=0&&x-v>=0)return IH.subVectors(s,r),a=(f-u)/(f-u+(x-v)),t.copy(r).addScaledVector(IH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector(e_,o).addScaledVector(t_,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Aa=class{constructor(e=new ie(1/0,1/0,1/0),t=new ie(-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(Hc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Hc.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=Hc.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,Hc):Hc.fromBufferAttribute(s,o),Hc.applyMatrix4(e.matrixWorld),this.expandByPoint(Hc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),QS.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),QS.copy(n.boundingBox)),QS.applyMatrix4(e.matrixWorld),this.union(QS)}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,Hc),Hc.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(dy),JS.subVectors(this.max,dy),n_.subVectors(e.a,dy),i_.subVectors(e.b,dy),r_.subVectors(e.c,dy),qd.subVectors(i_,n_),Hd.subVectors(r_,i_),fA.subVectors(n_,r_);let t=[0,-qd.z,qd.y,0,-Hd.z,Hd.y,0,-fA.z,fA.y,qd.z,0,-qd.x,Hd.z,0,-Hd.x,fA.z,0,-fA.x,-qd.y,qd.x,0,-Hd.y,Hd.x,0,-fA.y,fA.x,0];return!GN(t,n_,i_,r_,JS)||(t=[1,0,0,0,1,0,0,0,1],!GN(t,n_,i_,r_,JS))?!1:(eT.crossVectors(qd,Hd),t=[eT.x,eT.y,eT.z],GN(t,n_,i_,r_,JS))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Hc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Hc).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:(Tf[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Tf[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Tf[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Tf[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Tf[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Tf[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Tf[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Tf[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Tf),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}},Tf=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],Hc=new ie,QS=new Aa,n_=new ie,i_=new ie,r_=new ie,qd=new ie,Hd=new ie,fA=new ie,dy=new ie,JS=new ie,eT=new ie,dA=new ie;function GN(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){dA.fromArray(i,s);let a=r.x*Math.abs(dA.x)+r.y*Math.abs(dA.y)+r.z*Math.abs(dA.z),l=e.dot(dA),c=t.dot(dA),u=n.dot(dA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Rf=zce();function zce(){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 gl(i){Math.abs(i)>65504&&je("DataUtils.toHalfFloat(): Value out of range."),i=In(i,-65504,65504),Rf.floatView[0]=i;let e=Rf.uint32View[0],t=e>>23&511;return Rf.baseTable[t]+((e&8388607)>>Rf.shiftTable[t])}function tT(i){let e=i>>10;return Rf.uint32View[0]=Rf.mantissaTable[Rf.offsetTable[e]+(i&1023)]+Rf.exponentTable[e],Rf.floatView[0]}var Ss=new ie,nT=new Oe,Vce=0,Di=class extends qo{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:Vce++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Qd,this.updateRanges=[],this.gpuType=Ki,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++)nT.fromBufferAttribute(this,t),nT.applyMatrix3(e),this.setXY(t,nT.x,nT.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyMatrix3(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyMatrix4(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.applyNormalMatrix(e),this.setXYZ(t,Ss.x,Ss.y,Ss.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ss.fromBufferAttribute(this,t),Ss.transformDirection(e),this.setXYZ(t,Ss.x,Ss.y,Ss.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=ha(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ha(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ha(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(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=ha(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(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=ha(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(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!==Qd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var TA=class extends Di{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var EA=class extends Di{constructor(e,t,n){super(new Uint32Array(e),t,n)}},y_=class extends Di{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=tT(this.array[e*this.itemSize]);return this.normalized&&(t=ha(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=gl(t),this}getY(e){let t=tT(this.array[e*this.itemSize+1]);return this.normalized&&(t=ha(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+1]=gl(t),this}getZ(e){let t=tT(this.array[e*this.itemSize+2]);return this.normalized&&(t=ha(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+2]=gl(t),this}getW(e){let t=tT(this.array[e*this.itemSize+3]);return this.normalized&&(t=ha(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=gl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array)),this.array[e+0]=gl(t),this.array[e+1]=gl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array)),this.array[e+0]=gl(t),this.array[e+1]=gl(n),this.array[e+2]=gl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(s,this.array)),this.array[e+0]=gl(t),this.array[e+1]=gl(n),this.array[e+2]=gl(r),this.array[e+3]=gl(s),this}},Rn=class extends Di{constructor(e,t,n){super(new Float32Array(e),t,n)}},qce=new Aa,py=new ie,zN=new ie,Xa=class{constructor(e=new ie,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):qce.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;py.subVectors(e,this.center);let t=py.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(py,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):(zN.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(py.copy(e.center).add(zN)),this.expandByPoint(py.copy(e.center).sub(zN))),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}},Hce=0,Jl=new on,VN=new Zi,s_=new ie,_l=new Aa,Ay=new Aa,Js=new ie,qn=class i extends qo{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Hce++}),this.uuid=zu(),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(pce(e)?EA:TA)(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 Sn().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 Jl.makeRotationFromQuaternion(e),this.applyMatrix4(Jl),this}rotateX(e){return Jl.makeRotationX(e),this.applyMatrix4(Jl),this}rotateY(e){return Jl.makeRotationY(e),this.applyMatrix4(Jl),this}rotateZ(e){return Jl.makeRotationZ(e),this.applyMatrix4(Jl),this}translate(e,t,n){return Jl.makeTranslation(e,t,n),this.applyMatrix4(Jl),this}scale(e,t,n){return Jl.makeScale(e,t,n),this.applyMatrix4(Jl),this}lookAt(e){return VN.lookAt(e),VN.updateMatrix(),this.applyMatrix4(VN.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(s_).negate(),this.translate(s_.x,s_.y,s_.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 Rn(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&&je("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 Aa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ie(-1/0,-1/0,-1/0),new ie(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];_l.setFromBufferAttribute(s),this.morphTargetsRelative?(Js.addVectors(this.boundingBox.min,_l.min),this.boundingBox.expandByPoint(Js),Js.addVectors(this.boundingBox.max,_l.max),this.boundingBox.expandByPoint(Js)):(this.boundingBox.expandByPoint(_l.min),this.boundingBox.expandByPoint(_l.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('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 Xa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ie,1/0);return}if(e){let n=this.boundingSphere.center;if(_l.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];Ay.setFromBufferAttribute(a),this.morphTargetsRelative?(Js.addVectors(_l.min,Ay.min),_l.expandByPoint(Js),Js.addVectors(_l.max,Ay.max),_l.expandByPoint(Js)):(_l.expandByPoint(Ay.min),_l.expandByPoint(Ay.max))}_l.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Js.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Js));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++)Js.fromBufferAttribute(a,c),l&&(s_.fromBufferAttribute(e,c),Js.add(s_)),r=Math.max(r,n.distanceToSquared(Js))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ge('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){Ge("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 Di(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let N=0;N<n.count;N++)a[N]=new ie,l[N]=new ie;let c=new ie,u=new ie,f=new ie,p=new Oe,x=new Oe,v=new Oe,w=new ie,S=new ie;function T(N,B,z){c.fromBufferAttribute(n,N),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,z),p.fromBufferAttribute(s,N),x.fromBufferAttribute(s,B),v.fromBufferAttribute(s,z),u.sub(c),f.sub(c),x.sub(p),v.sub(p);let V=1/(x.x*v.y-v.x*x.y);isFinite(V)&&(w.copy(u).multiplyScalar(v.y).addScaledVector(f,-x.y).multiplyScalar(V),S.copy(f).multiplyScalar(x.x).addScaledVector(u,-v.x).multiplyScalar(V),a[N].add(w),a[B].add(w),a[z].add(w),l[N].add(S),l[B].add(S),l[z].add(S))}let P=this.groups;P.length===0&&(P=[{start:0,count:e.count}]);for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let Z=V,J=V+H;Z<J;Z+=3)T(e.getX(Z+0),e.getX(Z+1),e.getX(Z+2))}let R=new ie,C=new ie,L=new ie,D=new ie;function F(N){L.fromBufferAttribute(r,N),D.copy(L);let B=a[N];R.copy(B),R.sub(L.multiplyScalar(L.dot(B))).normalize(),C.crossVectors(D,B);let V=C.dot(l[N])<0?-1:1;o.setXYZW(N,R.x,R.y,R.z,V)}for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let Z=V,J=V+H;Z<J;Z+=3)F(e.getX(Z+0)),F(e.getX(Z+1)),F(e.getX(Z+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 Di(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,x=n.count;p<x;p++)n.setXYZ(p,0,0,0);let r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie,u=new ie,f=new ie;if(e)for(let p=0,x=e.count;p<x;p+=3){let v=e.getX(p+0),w=e.getX(p+1),S=e.getX(p+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,v),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(v,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 p=0,x=t.count;p<x;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(p+0,u.x,u.y,u.z),n.setXYZ(p+1,u.x,u.y,u.z),n.setXYZ(p+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++)Js.fromBufferAttribute(e,t),Js.normalize(),e.setXYZ(t,Js.x,Js.y,Js.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,p=new c.constructor(l.length*u),x=0,v=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?x=l[w]*a.data.stride+a.offset:x=l[w]*u;for(let T=0;T<u;T++)p[v++]=c[x++]}return new Di(p,u,f)}if(this.index===null)return je("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 p=c[u],x=e(p,n);l.push(x)}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,p=c.length;f<p;f++){let x=c[f];u.push(x.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 p=0,x=f.length;p<x;p++)u.push(f[p].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"})}},Df=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Qd,this.updateRanges=[],this.version=0,this.uuid=zu()}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=zu()),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=zu()),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}}},ca=new ie,xo=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++)ca.fromBufferAttribute(this,t),ca.applyMatrix4(e),this.setXYZ(t,ca.x,ca.y,ca.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ca.fromBufferAttribute(this,t),ca.applyNormalMatrix(e),this.setXYZ(t,ca.x,ca.y,ca.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ca.fromBufferAttribute(this,t),ca.transformDirection(e),this.setXYZ(t,ca.x,ca.y,ca.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=ha(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Wn(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=ha(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ha(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ha(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ha(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wn(t,this.array),n=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(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=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(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){wA("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 Di(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){wA("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}}},Wce=0,Cs=class extends qo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Wce++}),this.uuid=zu(),this.name="",this.type="Material",this.blending=cs,this.side=_o,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=$d,this.blendDst=Yd,this.blendEquation=zs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=Vu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ey,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Mf,this.stencilZFail=Mf,this.stencilZPass=Mf,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){je(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`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!==cs&&(n.blending=this.blending),this.side!==_o&&(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!==$d&&(n.blendSrc=this.blendSrc),this.blendDst!==Yd&&(n.blendDst=this.blendDst),this.blendEquation!==zs&&(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!==Vu&&(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!==Ey&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Mf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Mf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Mf&&(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 Ut().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++}},qu=class extends Cs{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ut(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}},o_,my=new ie,a_=new ie,l_=new ie,c_=new Oe,gy=new Oe,AW=new on,iT=new ie,_y=new ie,rT=new ie,NH=new Oe,qN=new Oe,LH=new Oe,MA=class extends Zi{constructor(e=new qu){if(super(),this.isSprite=!0,this.type="Sprite",o_===void 0){o_=new qn;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 Df(t,5);o_.setIndex([0,1,2,0,2,3]),o_.setAttribute("position",new xo(n,3,0,!1)),o_.setAttribute("uv",new xo(n,2,3,!1))}this.geometry=o_,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),a_.setFromMatrixScale(this.matrixWorld),AW.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),l_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&a_.multiplyScalar(-l_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;sT(iT.set(-.5,-.5,0),l_,o,a_,r,s),sT(_y.set(.5,-.5,0),l_,o,a_,r,s),sT(rT.set(.5,.5,0),l_,o,a_,r,s),NH.set(0,0),qN.set(1,0),LH.set(1,1);let a=e.ray.intersectTriangle(iT,_y,rT,!1,my);if(a===null&&(sT(_y.set(-.5,.5,0),l_,o,a_,r,s),qN.set(0,1),a=e.ray.intersectTriangle(iT,rT,_y,!1,my),a===null))return;let l=e.ray.origin.distanceTo(my);l<e.near||l>e.far||t.push({distance:l,point:my.clone(),uv:Cf.getInterpolation(my,iT,_y,rT,NH,qN,LH,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 sT(i,e,t,n,r,s){c_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(gy.x=s*c_.x-r*c_.y,gy.y=r*c_.x+s*c_.y):gy.copy(c_),i.copy(e),i.x+=gy.x,i.y+=gy.y,i.applyMatrix4(AW)}var Ef=new ie,HN=new ie,oT=new ie,Wd=new ie,WN=new ie,aT=new ie,jN=new ie,Ff=class{constructor(e=new ie,t=new ie(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,Ef)),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=Ef.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ef.copy(this.origin).addScaledVector(this.direction,t),Ef.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){HN.copy(e).add(t).multiplyScalar(.5),oT.copy(t).sub(e).normalize(),Wd.copy(this.origin).sub(HN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(oT),a=Wd.dot(this.direction),l=-Wd.dot(oT),c=Wd.lengthSq(),u=Math.abs(1-o*o),f,p,x,v;if(u>0)if(f=o*l-a,p=o*a-l,v=s*u,f>=0)if(p>=-v)if(p<=v){let w=1/u;f*=w,p*=w,x=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p<=-v?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c):p<=v?(f=0,p=Math.min(Math.max(-s,-l),s),x=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(HN).addScaledVector(oT,p),x}intersectSphere(e,t){Ef.subVectors(e.center,this.origin);let n=Ef.dot(this.direction),r=Ef.dot(Ef)-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,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.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,Ef)!==null}intersectTriangle(e,t,n,r,s){WN.subVectors(t,e),aT.subVectors(n,e),jN.crossVectors(WN,aT);let o=this.direction.dot(jN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Wd.subVectors(this.origin,e);let l=a*this.direction.dot(aT.crossVectors(Wd,aT));if(l<0)return null;let c=a*this.direction.dot(WN.cross(Wd));if(c<0||l+c>o)return null;let u=-a*Wd.dot(jN);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)}},Yr=class extends Cs{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ut(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 pa,this.combine=kA,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}},DH=new on,pA=new Ff,lT=new Xa,FH=new ie,cT=new ie,uT=new ie,hT=new ie,XN=new ie,fT=new ie,OH=new ie,dT=new ie,Gn=class extends Zi{constructor(e=new qn,t=new Yr){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){fT.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(XN.fromBufferAttribute(f,e),o?fT.addScaledVector(XN,u):fT.addScaledVector(XN.sub(t),u))}t.add(fT)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),lT.copy(n.boundingSphere),lT.applyMatrix4(s),pA.copy(e.ray).recast(e.near),!(lT.containsPoint(pA.origin)===!1&&(pA.intersectSphere(lT,FH)===null||pA.origin.distanceToSquared(FH)>(e.far-e.near)**2))&&(DH.copy(s).invert(),pA.copy(e.ray).applyMatrix4(DH),!(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,p=s.groups,x=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=a.getX(C),F=a.getX(C+1),N=a.getX(C+2);r=pT(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let v=Math.max(0,x.start),w=Math.min(a.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let P=a.getX(S),R=a.getX(S+1),C=a.getX(S+2);r=pT(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=C,F=C+1,N=C+2;r=pT(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let v=Math.max(0,x.start),w=Math.min(l.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let P=S,R=S+1,C=S+2;r=pT(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function jce(i,e,t,n,r,s,o,a){let l;if(e.side===hi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===_o,a),l===null)return null;dT.copy(a),dT.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(dT);return c<t.near||c>t.far?null:{distance:c,point:dT.clone(),object:i}}function pT(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,cT),i.getVertexPosition(l,uT),i.getVertexPosition(c,hT);let u=jce(i,e,t,n,cT,uT,hT,OH);if(u){let f=new ie;Cf.getBarycoord(OH,cT,uT,hT,f),r&&(u.uv=Cf.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=Cf.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=Cf.getInterpolatedAttribute(o,a,l,c,f,new ie),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let p={a,b:l,c,normal:new ie,materialIndex:0};Cf.getNormal(cT,uT,hT,p.normal),u.face=p,u.barycoord=f}return u}var CA=class extends Ms{constructor(e=null,t=1,n=1,r,s,o,a,l,c=yi,u=yi,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var xl=class extends Di{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 $N=new ie,Xce=new ie,$ce=new Sn,ua=class{constructor(e=new ie(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=$N.subVectors(n,t).cross(Xce.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($N),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||$ce.getNormalMatrix(e),r=this.coplanarPoint($N).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)}},AA=new Xa,Yce=new Oe(.5,.5),AT=new ie,ec=class{constructor(e=new ua,t=new ua,n=new ua,r=new ua,s=new ua,o=new ua){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=go,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],p=s[6],x=s[7],v=s[8],w=s[9],S=s[10],T=s[11],P=s[12],R=s[13],C=s[14],L=s[15];if(r[0].setComponents(c-o,x-u,T-v,L-P).normalize(),r[1].setComponents(c+o,x+u,T+v,L+P).normalize(),r[2].setComponents(c+a,x+f,T+w,L+R).normalize(),r[3].setComponents(c-a,x-f,T-w,L-R).normalize(),n)r[4].setComponents(l,p,S,C).normalize(),r[5].setComponents(c-l,x-p,T-S,L-C).normalize();else if(r[4].setComponents(c-l,x-p,T-S,L-C).normalize(),t===go)r[5].setComponents(c+l,x+p,T+S,L+C).normalize();else if(t===ja)r[5].setComponents(l,p,S,C).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(),AA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),AA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(AA)}intersectsSprite(e){AA.center.set(0,0,0);let t=Yce.distanceTo(e.center);return AA.radius=.7071067811865476+t,AA.applyMatrix4(e.matrixWorld),this.intersectsSphere(AA)}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(AT.x=r.normal.x>0?e.max.x:e.min.x,AT.y=r.normal.y>0?e.max.y:e.min.y,AT.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(AT)<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)}},BH=new on,My=class i{constructor(){this.coordinateSystem=go,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];BH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new ec),n[r].setFromProjectionMatrix(BH,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 ec),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Wc=class extends Cs{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ut(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}},IT=new ie,NT=new ie,UH=new on,xy=new Ff,mT=new Xa,YN=new ie,kH=new ie,tp=class extends Zi{constructor(e=new qn,t=new Wc){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++)IT.fromBufferAttribute(t,r-1),NT.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=IT.distanceTo(NT);e.setAttribute("lineDistance",new Rn(n,1))}else je("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(),mT.copy(n.boundingSphere),mT.applyMatrix4(r),mT.radius+=s,e.ray.intersectsSphere(mT)===!1)return;UH.copy(r).invert(),xy.copy(e.ray).applyMatrix4(UH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,p=n.attributes.position;if(u!==null){let x=Math.max(0,o.start),v=Math.min(u.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=u.getX(w),P=u.getX(w+1),R=gT(this,e,xy,l,T,P,w);R&&t.push(R)}if(this.isLineLoop){let w=u.getX(v-1),S=u.getX(x),T=gT(this,e,xy,l,w,S,v-1);T&&t.push(T)}}else{let x=Math.max(0,o.start),v=Math.min(p.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=gT(this,e,xy,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=gT(this,e,xy,l,v-1,x,v-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 gT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(IT.fromBufferAttribute(a,r),NT.fromBufferAttribute(a,s),t.distanceSqToSegment(IT,NT,YN,kH)>n)return;YN.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(YN);if(!(c<e.near||c>e.far))return{distance:c,point:kH.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var GH=new ie,zH=new ie,v_=class extends tp{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)GH.fromBufferAttribute(t,r),zH.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+GH.distanceTo(zH);e.setAttribute("lineDistance",new Rn(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var np=class extends Cs{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ut(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}},VH=new on,sL=new Ff,_T=new Xa,xT=new ie,Cy=class extends Zi{constructor(e=new qn,t=new np){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(),_T.copy(n.boundingSphere),_T.applyMatrix4(r),_T.radius+=s,e.ray.intersectsSphere(_T)===!1)return;VH.copy(r).invert(),sL.copy(e.ray).applyMatrix4(VH);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 p=Math.max(0,o.start),x=Math.min(c.count,o.start+o.count);for(let v=p,w=x;v<w;v++){let S=c.getX(v);xT.fromBufferAttribute(f,S),qH(xT,S,l,r,e,t,this)}}else{let p=Math.max(0,o.start),x=Math.min(f.count,o.start+o.count);for(let v=p,w=x;v<w;v++)xT.fromBufferAttribute(f,v),qH(xT,v,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 qH(i,e,t,n,r,s,o){let a=sL.distanceSqToPoint(i);if(a<t){let l=new ie;sL.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 RA=class extends Ms{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=yi,this.minFilter=yi,this.generateMipmaps=!1,this.needsUpdate=!0}};var Hu=class extends Ms{constructor(e=[],t=vl,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 us=class extends Ms{constructor(e,t,n=Ai,r,s,o,a=yi,l=yi,c,u=Ts,f=1){if(u!==Ts&&u!==eo)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let p={width:e,height:t,depth:f};super(p,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 __(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}},b_=class extends us{constructor(e,t=Ai,n=vl,r,s,o=yi,a=yi,l,c=Ts){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}},Ry=class extends Ms{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},jc=class i extends qn{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=[],p=0,x=0;v("z","y","x",-1,-1,n,t,e,o,s,0),v("z","y","x",1,-1,n,t,-e,o,s,1),v("x","z","y",1,1,e,n,t,r,o,2),v("x","z","y",1,-1,e,n,-t,r,o,3),v("x","y","z",1,-1,e,t,n,r,s,4),v("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Rn(c,3)),this.setAttribute("normal",new Rn(u,3)),this.setAttribute("uv",new Rn(f,2));function v(w,S,T,P,R,C,L,D,F,N,B){let z=C/F,V=L/N,H=C/2,Z=L/2,J=D/2,j=F+1,K=N+1,ee=0,ae=0,ce=new ie;for(let de=0;de<K;de++){let be=de*V-Z;for(let Ie=0;Ie<j;Ie++){let Qe=Ie*z-H;ce[w]=Qe*P,ce[S]=be*R,ce[T]=J,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(Ie/F),f.push(1-de/N),ee+=1}}for(let de=0;de<N;de++)for(let be=0;be<F;be++){let Ie=p+be+j*de,Qe=p+be+j*(de+1),Ue=p+(be+1)+j*(de+1),mt=p+(be+1)+j*de;l.push(Ie,Qe,mt),l.push(Qe,Ue,mt),ae+=6}a.addGroup(x,ae,B),x+=ae,p+=ee}}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 w_=class i extends qn{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 ie,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,p=3;f<=t;f++,p+=3){let x=n+f/t*r;c.x=e*Math.cos(x),c.y=e*Math.sin(x),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[p]/e+1)/2,u.y=(o[p+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 Rn(o,3)),this.setAttribute("normal",new Rn(a,3)),this.setAttribute("uv",new Rn(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)}},PA=class i extends qn{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=[],p=[],x=[],v=0,w=[],S=n/2,T=0;P(),o===!1&&(e>0&&R(!0),t>0&&R(!1)),this.setIndex(u),this.setAttribute("position",new Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(x,2));function P(){let C=new ie,L=new ie,D=0,F=(t-e)/n;for(let N=0;N<=s;N++){let B=[],z=N/s,V=z*(t-e)+e;for(let H=0;H<=r;H++){let Z=H/r,J=Z*l+a,j=Math.sin(J),K=Math.cos(J);L.x=V*j,L.y=-z*n+S,L.z=V*K,f.push(L.x,L.y,L.z),C.set(j,F,K).normalize(),p.push(C.x,C.y,C.z),x.push(Z,1-z),B.push(v++)}w.push(B)}for(let N=0;N<r;N++)for(let B=0;B<s;B++){let z=w[B][N],V=w[B+1][N],H=w[B+1][N+1],Z=w[B][N+1];(e>0||B!==0)&&(u.push(z,V,Z),D+=3),(t>0||B!==s-1)&&(u.push(V,H,Z),D+=3)}c.addGroup(T,D,0),T+=D}function R(C){let L=v,D=new Oe,F=new ie,N=0,B=C===!0?e:t,z=C===!0?1:-1;for(let H=1;H<=r;H++)f.push(0,S*z,0),p.push(0,z,0),x.push(.5,.5),v++;let V=v;for(let H=0;H<=r;H++){let J=H/r*l+a,j=Math.cos(J),K=Math.sin(J);F.x=B*K,F.y=S*z,F.z=B*j,f.push(F.x,F.y,F.z),p.push(0,z,0),D.x=j*.5+.5,D.y=K*.5*z+.5,x.push(D.x,D.y),v++}for(let H=0;H<r;H++){let Z=L+H,J=V+H;C===!0?u.push(J,J+1,Z):u.push(J+1,J,Z),N+=3}c.addGroup(T,N,C===!0?1:2),T+=N}}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 ma=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){je("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],p=n[r+1]-u,x=(o-u)/p;return(r+x)/(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 ie);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 ie,r=[],s=[],o=[],a=new ie,l=new on;for(let x=0;x<=e;x++){let v=x/e;r[x]=this.getTangentAt(v,new ie)}s[0]=new ie,o[0]=new ie;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),p=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),p<=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 x=1;x<=e;x++){if(s[x]=s[x-1].clone(),o[x]=o[x-1].clone(),a.crossVectors(r[x-1],r[x]),a.length()>Number.EPSILON){a.normalize();let v=Math.acos(In(r[x-1].dot(r[x]),-1,1));s[x].applyMatrix4(l.makeRotationAxis(a,v))}o[x].crossVectors(r[x],s[x])}if(t===!0){let x=Math.acos(In(s[0].dot(s[e]),-1,1));x/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(x=-x);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],x*v)),o[v].crossVectors(r[v],s[v])}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}},S_=class extends ma{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),p=l-this.aX,x=c-this.aY;l=p*u-x*f+this.aX,c=p*f+x*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}},LT=class extends S_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function BL(){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 p=(o-s)/c-(a-s)/(c+u)+(a-o)/u,x=(a-o)/u-(l-o)/(u+f)+(l-a)/f;p*=u,x*=u,r(o,a,p,x)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var HH=new ie,WH=new ie,ZN=new BL,KN=new BL,QN=new BL,DT=class extends ma{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 ie){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]:(WH.subVectors(r[0],r[1]).add(r[0]),c=WH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(HH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=HH),this.curveType==="centripetal"||this.curveType==="chordal"){let x=this.curveType==="chordal"?.5:.25,v=Math.pow(c.distanceToSquared(f),x),w=Math.pow(f.distanceToSquared(p),x),S=Math.pow(p.distanceToSquared(u),x);w<1e-4&&(w=1),v<1e-4&&(v=w),S<1e-4&&(S=w),ZN.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,v,w,S),KN.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,v,w,S),QN.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,v,w,S)}else this.curveType==="catmullrom"&&(ZN.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),KN.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),QN.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(ZN.calc(l),KN.calc(l),QN.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 ie().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function jH(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 Zce(i,e){let t=1-i;return t*t*e}function Kce(i,e){return 2*(1-i)*i*e}function Qce(i,e){return i*i*e}function wy(i,e,t,n){return Zce(i,e)+Kce(i,t)+Qce(i,n)}function Jce(i,e){let t=1-i;return t*t*t*e}function eue(i,e){let t=1-i;return 3*t*t*i*e}function tue(i,e){return 3*(1-i)*i*i*e}function nue(i,e){return i*i*i*e}function Sy(i,e,t,n,r){return Jce(i,e)+eue(i,t)+tue(i,n)+nue(i,r)}var Py=class extends ma{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(Sy(e,r.x,s.x,o.x,a.x),Sy(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}},T_=class extends ma{constructor(e=new ie,t=new ie,n=new ie,r=new ie){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Sy(e,r.x,s.x,o.x,a.x),Sy(e,r.y,s.y,o.y,a.y),Sy(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}},Iy=class extends ma{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}},FT=class extends ma{constructor(e=new ie,t=new ie){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new ie){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 ie){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}},Ny=class extends ma{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(wy(e,r.x,s.x,o.x),wy(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}},Ly=class extends ma{constructor(e=new ie,t=new ie,n=new ie){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(wy(e,r.x,s.x,o.x),wy(e,r.y,s.y,o.y),wy(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}},Dy=class extends ma{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(jH(a,l.x,c.x,u.x,f.x),jH(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}},OT=Object.freeze({__proto__:null,ArcCurve:LT,CatmullRomCurve3:DT,CubicBezierCurve:Py,CubicBezierCurve3:T_,EllipseCurve:S_,LineCurve:Iy,LineCurve3:FT,QuadraticBezierCurve:Ny,QuadraticBezierCurve3:Ly,SplineCurve:Dy}),BT=class extends ma{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 OT[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 OT[r.type]().fromJSON(r))}return this}},IA=class extends BT{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 Iy(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 Ny(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 Py(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 Dy(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 S_(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}},Fy=class extends IA{constructor(e){super(e),this.uuid=zu(),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 IA().fromJSON(r))}return this}};function iue(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=mW(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=lue(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let p=t;p<r;p+=t){let x=i[p],v=i[p+1];x<a&&(a=x),v<l&&(l=v),x>u&&(u=x),v>f&&(f=v)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return Oy(s,o,t,a,l,c,0),o}function mW(i,e,t,n,r){let s;if(r===xue(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=XH(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=XH(o/n|0,i[o],i[o+1],s);return s&&E_(s,s.next)&&(Uy(s),s=s.next),s}function NA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(E_(t,t.next)||Dr(t.prev,t,t.next)===0)){if(Uy(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Oy(i,e,t,n,r,s,o){if(!i)return;!o&&s&&due(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?sue(i,n,r,s):rue(i)){e.push(l.i,i.i,c.i),Uy(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=oue(NA(i),e),Oy(i,e,t,n,r,s,2)):o===2&&aue(i,e,t,n,r,s):Oy(NA(i),e,t,n,r,s,1);break}}}function rue(i){let e=i.prev,t=i,n=i.next;if(Dr(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),p=Math.max(r,s,o),x=Math.max(a,l,c),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&yy(r,a,s,l,o,c,v.x,v.y)&&Dr(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function sue(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Dr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,p=o.y,x=Math.min(a,l,c),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=oL(x,v,e,t,n),P=oL(w,S,e,t,n),R=i.prevZ,C=i.nextZ;for(;R&&R.z>=T&&C&&C.z<=P;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&yy(a,u,l,f,c,p,R.x,R.y)&&Dr(R.prev,R,R.next)>=0||(R=R.prevZ,C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&yy(a,u,l,f,c,p,C.x,C.y)&&Dr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&yy(a,u,l,f,c,p,R.x,R.y)&&Dr(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&yy(a,u,l,f,c,p,C.x,C.y)&&Dr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function oue(i,e){let t=i;do{let n=t.prev,r=t.next.next;!E_(n,r)&&_W(n,t,t.next,r)&&By(n,r)&&By(r,n)&&(e.push(n.i,t.i,r.i),Uy(t),Uy(t.next),t=i=r),t=t.next}while(t!==i);return NA(t)}function aue(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&mue(o,a)){let l=xW(o,a);o=NA(o,o.next),l=NA(l,l.next),Oy(o,e,t,n,r,s,0),Oy(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function lue(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=mW(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(Aue(c))}r.sort(cue);for(let s=0;s<r.length;s++)t=uue(r[s],t);return t}function cue(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 uue(i,e){let t=hue(i,e);if(!t)return e;let n=xW(t,i);return NA(n,n.next),NA(t,t.next)}function hue(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(E_(i,t))return t;do{if(E_(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&&gW(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);By(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&fue(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function fue(i,e){return Dr(i.prev,i,e.prev)<0&&Dr(e.next,i,i.next)<0}function due(i,e,t,n){let r=i;do r.z===0&&(r.z=oL(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,pue(r)}function pue(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 oL(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 Aue(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 gW(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 yy(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&gW(i,e,t,n,r,s,o,a)}function mue(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!gue(i,e)&&(By(i,e)&&By(e,i)&&_ue(i,e)&&(Dr(i.prev,i,e.prev)||Dr(i,e.prev,e))||E_(i,e)&&Dr(i.prev,i,i.next)>0&&Dr(e.prev,e,e.next)>0)}function Dr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function E_(i,e){return i.x===e.x&&i.y===e.y}function _W(i,e,t,n){let r=vT(Dr(i,e,t)),s=vT(Dr(i,e,n)),o=vT(Dr(t,n,i)),a=vT(Dr(t,n,e));return!!(r!==s&&o!==a||r===0&&yT(i,t,e)||s===0&&yT(i,n,e)||o===0&&yT(t,i,n)||a===0&&yT(t,e,n))}function yT(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 vT(i){return i>0?1:i<0?-1:0}function gue(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&&_W(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function By(i,e){return Dr(i.prev,i,i.next)<0?Dr(i,e,i.next)>=0&&Dr(i,i.prev,e)>=0:Dr(i,e,i.prev)<0||Dr(i,i.next,e)<0}function _ue(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 xW(i,e){let t=aL(i.i,i.x,i.y),n=aL(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 XH(i,e,t,n){let r=aL(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 Uy(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 aL(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function xue(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 lL=class{static triangulate(e,t,n=2){return iue(e,t,n)}},Xd=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=[];$H(e),YH(n,e);let o=e.length;t.forEach($H);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,YH(n,t[l]);let a=lL.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function $H(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function YH(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var ky=class i extends qn{constructor(e=new Fy([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 Rn(r,3)),this.setAttribute("uv",new Rn(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,p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,x=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:x-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,P=t.UVGenerator!==void 0?t.UVGenerator:yue,R,C=!1,L,D,F,N;if(T){R=T.getSpacedPoints(u),C=!0,p=!1;let Xe=T.isCatmullRomCurve3?T.closed:!1;L=T.computeFrenetFrames(u,Xe),D=new ie,F=new ie,N=new ie}p||(S=0,x=0,v=0,w=0);let B=a.extractPoints(c),z=B.shape,V=B.holes;if(!Xd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];Xd.isClockWise(tt)&&(V[Xe]=tt.reverse())}}function Z(Xe){let tt=10000000000000001e-36,vt=Xe[0];for(let yt=1;yt<=Xe.length;yt++){let ln=yt%Xe.length,Kt=Xe[ln],Qt=Kt.x-vt.x,xn=Kt.y-vt.y,ge=Qt*Qt+xn*xn,pi=Math.max(Math.abs(Kt.x),Math.abs(Kt.y),Math.abs(vt.x),Math.abs(vt.y)),Bn=tt*pi*pi;if(ge<=Bn){Xe.splice(ln,1),yt--;continue}vt=Kt}}Z(z),V.forEach(Z);let J=V.length,j=z;for(let Xe=0;Xe<J;Xe++){let st=V[Xe];z=z.concat(st)}function K(Xe,st,tt){return st||Ge("ExtrudeGeometry: vec does not exist"),Xe.clone().addScaledVector(st,tt)}let ee=z.length;function ae(Xe,st,tt){let vt,yt,ln,Kt=Xe.x-st.x,Qt=Xe.y-st.y,xn=tt.x-Xe.x,ge=tt.y-Xe.y,pi=Kt*Kt+Qt*Qt,Bn=Kt*ge-Qt*xn;if(Math.abs(Bn)>Number.EPSILON){let le=Math.sqrt(pi),X=Math.sqrt(xn*xn+ge*ge),Te=st.x-Qt/le,Pe=st.y+Kt/le,Ve=tt.x-ge/X,gt=tt.y+xn/X,St=((Ve-Te)*ge-(gt-Pe)*xn)/(Kt*ge-Qt*xn);vt=Te+Kt*St-Xe.x,yt=Pe+Qt*St-Xe.y;let qe=vt*vt+yt*yt;if(qe<=2)return new Oe(vt,yt);ln=Math.sqrt(qe/2)}else{let le=!1;Kt>Number.EPSILON?xn>Number.EPSILON&&(le=!0):Kt<-Number.EPSILON?xn<-Number.EPSILON&&(le=!0):Math.sign(Qt)===Math.sign(ge)&&(le=!0),le?(vt=-Qt,yt=Kt,ln=Math.sqrt(pi)):(vt=Kt,yt=Qt,ln=Math.sqrt(pi/2))}return new Oe(vt/ln,yt/ln)}let ce=[];for(let Xe=0,st=j.length,tt=st-1,vt=Xe+1;Xe<st;Xe++,tt++,vt++)tt===st&&(tt=0),vt===st&&(vt=0),ce[Xe]=ae(j[Xe],j[tt],j[vt]);let de=[],be,Ie=ce.concat();for(let Xe=0,st=J;Xe<st;Xe++){let tt=V[Xe];be=[];for(let vt=0,yt=tt.length,ln=yt-1,Kt=vt+1;vt<yt;vt++,ln++,Kt++)ln===yt&&(ln=0),Kt===yt&&(Kt=0),be[vt]=ae(tt[vt],tt[ln],tt[Kt]);de.push(be),Ie=Ie.concat(be)}let Qe;if(S===0)Qe=Xd.triangulateShape(j,V);else{let Xe=[],st=[];for(let tt=0;tt<S;tt++){let vt=tt/S,yt=x*Math.cos(vt*Math.PI/2),ln=v*Math.sin(vt*Math.PI/2)+w;for(let Kt=0,Qt=j.length;Kt<Qt;Kt++){let xn=K(j[Kt],ce[Kt],ln);Et(xn.x,xn.y,-yt),vt===0&&Xe.push(xn)}for(let Kt=0,Qt=J;Kt<Qt;Kt++){let xn=V[Kt];be=de[Kt];let ge=[];for(let pi=0,Bn=xn.length;pi<Bn;pi++){let le=K(xn[pi],be[pi],ln);Et(le.x,le.y,-yt),vt===0&&ge.push(le)}vt===0&&st.push(ge)}}Qe=Xd.triangulateShape(Xe,st)}let Ue=Qe.length,mt=v+w;for(let Xe=0;Xe<ee;Xe++){let st=p?K(z[Xe],Ie[Xe],mt):z[Xe];C?(F.copy(L.normals[0]).multiplyScalar(st.x),D.copy(L.binormals[0]).multiplyScalar(st.y),N.copy(R[0]).add(F).add(D),Et(N.x,N.y,N.z)):Et(st.x,st.y,0)}for(let Xe=1;Xe<=u;Xe++)for(let st=0;st<ee;st++){let tt=p?K(z[st],Ie[st],mt):z[st];C?(F.copy(L.normals[Xe]).multiplyScalar(tt.x),D.copy(L.binormals[Xe]).multiplyScalar(tt.y),N.copy(R[Xe]).add(F).add(D),Et(N.x,N.y,N.z)):Et(tt.x,tt.y,f/u*Xe)}for(let Xe=S-1;Xe>=0;Xe--){let st=Xe/S,tt=x*Math.cos(st*Math.PI/2),vt=v*Math.sin(st*Math.PI/2)+w;for(let yt=0,ln=j.length;yt<ln;yt++){let Kt=K(j[yt],ce[yt],vt);Et(Kt.x,Kt.y,f+tt)}for(let yt=0,ln=V.length;yt<ln;yt++){let Kt=V[yt];be=de[yt];for(let Qt=0,xn=Kt.length;Qt<xn;Qt++){let ge=K(Kt[Qt],be[Qt],vt);C?Et(ge.x,ge.y+R[u-1].y,R[u-1].x+tt):Et(ge.x,ge.y,f+tt)}}}Me(),ze();function Me(){let Xe=r.length/3;if(p){let st=0,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[2]+tt,yt[1]+tt,yt[0]+tt)}st=u+S*2,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[0]+tt,yt[1]+tt,yt[2]+tt)}}else{for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[2],tt[1],tt[0])}for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[0]+ee*u,tt[1]+ee*u,tt[2]+ee*u)}}n.addGroup(Xe,r.length/3-Xe,0)}function ze(){let Xe=r.length/3,st=0;$e(j,st),st+=j.length;for(let tt=0,vt=V.length;tt<vt;tt++){let yt=V[tt];$e(yt,st),st+=yt.length}n.addGroup(Xe,r.length/3-Xe,1)}function $e(Xe,st){let tt=Xe.length;for(;--tt>=0;){let vt=tt,yt=tt-1;yt<0&&(yt=Xe.length-1);for(let ln=0,Kt=u+S*2;ln<Kt;ln++){let Qt=ee*ln,xn=ee*(ln+1),ge=st+vt+Qt,pi=st+yt+Qt,Bn=st+yt+xn,le=st+vt+xn;Ct(ge,pi,Bn,le)}}}function Et(Xe,st,tt){l.push(Xe),l.push(st),l.push(tt)}function Tt(Xe,st,tt){un(Xe),un(st),un(tt);let vt=r.length/3,yt=P.generateTopUV(n,r,vt-3,vt-2,vt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function Ct(Xe,st,tt,vt){un(Xe),un(st),un(vt),un(st),un(tt),un(vt);let yt=r.length/3,ln=P.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(ln[0]),Gt(ln[1]),Gt(ln[3]),Gt(ln[1]),Gt(ln[2]),Gt(ln[3])}function un(Xe){r.push(l[Xe*3+0]),r.push(l[Xe*3+1]),r.push(l[Xe*3+2])}function Gt(Xe){s.push(Xe.x),s.push(Xe.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 vue(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 OT[r.type]().fromJSON(r)),new i(n,e.options)}},yue={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],p=e[r*3],x=e[r*3+1],v=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(p,1-v),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(x,1-v),new Oe(S,1-T)]}};function vue(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 LA=class i extends qn{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,p=t/l,x=[],v=[],w=[],S=[];for(let T=0;T<u;T++){let P=T*p-o;for(let R=0;R<c;R++){let C=R*f-s;v.push(C,-P,0),w.push(0,0,1),S.push(R/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let P=0;P<a;P++){let R=P+c*T,C=P+c*(T+1),L=P+1+c*(T+1),D=P+1+c*T;x.push(R,C,D),x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(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 ga=class i extends qn{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 ie,p=new ie,x=[],v=[],w=[],S=[];for(let T=0;T<=n;T++){let P=[],R=T/n,C=o+R*a,L=e*Math.cos(C),D=Math.sqrt(e*e-L*L),F=0;T===0&&o===0?F=.5/t:T===n&&l===Math.PI&&(F=-.5/t);for(let N=0;N<=t;N++){let B=N/t,z=r+B*s;f.x=-D*Math.cos(z),f.y=L,f.z=D*Math.sin(z),v.push(f.x,f.y,f.z),p.copy(f).normalize(),w.push(p.x,p.y,p.z),S.push(B+F,1-R),P.push(c++)}u.push(P)}for(let T=0;T<n;T++)for(let P=0;P<t;P++){let R=u[T][P+1],C=u[T][P],L=u[T+1][P],D=u[T+1][P+1];(T!==0||o>0)&&x.push(R,C,D),(T!==n-1||l<Math.PI)&&x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(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 Gy=class i extends qn{constructor(e=new Ly(new ie(-1,-1,0),new ie(-1,1,0),new ie(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 ie,l=new ie,c=new Oe,u=new ie,f=[],p=[],x=[],v=[];w(),this.setIndex(v),this.setAttribute("position",new Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(x,2));function w(){for(let R=0;R<t;R++)S(R);S(s===!1?t:0),P(),T()}function S(R){u=e.getPointAt(R/t,u);let C=o.normals[R],L=o.binormals[R];for(let D=0;D<=r;D++){let F=D/r*Math.PI*2,N=Math.sin(F),B=-Math.cos(F);l.x=B*C.x+N*L.x,l.y=B*C.y+N*L.y,l.z=B*C.z+N*L.z,l.normalize(),p.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 R=1;R<=t;R++)for(let C=1;C<=r;C++){let L=(r+1)*(R-1)+(C-1),D=(r+1)*R+(C-1),F=(r+1)*R+C,N=(r+1)*(R-1)+C;v.push(L,D,N),v.push(D,F,N)}}function P(){for(let R=0;R<=t;R++)for(let C=0;C<=r;C++)c.x=R/t,c.y=C/r,x.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 OT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},zy=class extends qn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new ie,s=new ie;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],p=f.start,x=f.count;for(let v=p,w=p+x;v<w;v+=3)for(let S=0;S<3;S++){let T=a.getX(v+S),P=a.getX(v+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,P),ZH(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),ZH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Rn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function ZH(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 Vy=class extends Cs{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ut(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 ZA(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(KH(r))r.isRenderTargetTexture?(je("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(KH(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 jo(i){let e={};for(let t=0;t<i.length;t++){let n=ZA(i[t]);for(let r in n)e[r]=n[r]}return e}function KH(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function bue(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function UL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var KA={clone:ZA,merge:jo},wue=`void main() {
@@ -5286,4 +5286,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52865286 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e4e(i,e){return XRe(i)||KRe(i,e)||Cie(i,e)||QRe()}function ng(i){return $Re(i)||ZRe(i)||Cie(i)||JRe()}function t4e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function n4e(i){var e=t4e(i,"string");return typeof e=="symbol"?e:e+""}function Cie(i,e){if(i){if(typeof i=="string")return Xk(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Xk(i,e):void 0}}var Rie=function(e){e instanceof Array?e.forEach(Rie):(e.map&&e.map.dispose(),e.dispose())},Pie=function(e){e.geometry&&e.geometry.dispose(),e.material&&Rie(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Pie)},i4e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Pie(t)}},Cr=window.THREE?window.THREE:{WebGLRenderer:A3,Scene:ep,PerspectiveCamera:Lr,Raycaster:t2,SRGBColorSpace:vr,TextureLoader:$a,Vector2:Oe,Vector3:ie,Box3:Aa,Color:Ut,Mesh:Gn,SphereGeometry:ga,MeshBasicMaterial:Yr,BackSide:hi,Timer:UA},$k=Or({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.timer.update().getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(o){return o.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(o,a){return e.hoverOrderComparator(o.object,a.object)});var s=r.find(function(o){return e.hoverFilter(o.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&rt(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var o,a,l=t,c=n||{x:0,y:0,z:0};if((o=e.povPosTween)===null||o===void 0||o.end(),(a=e.povTgtTween)===null||a===void 0||a.end(),!r)p(l),x(c);else{var u=Object.assign({},s.position),f=v();e.tweenGroup.add(e.povPosTween=new Ws(u).to(l,r).easing(Br.Quadratic.Out).onUpdate(p).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new Ws(f).to(c,r/3).easing(Br.Quadratic.Out).onUpdate(x).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:v()});function p(w){var S=w.x,T=w.y,P=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),P!==void 0&&(s.position.z=P)}function x(w){var S=new Cr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function v(){return Object.assign(new Cr.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),o=3;o<r;o++)s[o-3]=arguments[o];return this.fitToBbox(this.getBbox.apply(this,s),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var o=new Cr.Vector3(0,0,0),a=Math.max.apply(Math,ng(Object.entries(t).map(function(x){var v=e4e(x,2),w=v[0],S=v[1];return Math.max.apply(Math,ng(S.map(function(T){return Math.abs(o[w]-T)})))})))*2,l=(1-r*2/e.height)*s.fov,c=a/Math.atan(l*Math.PI/180),u=c/s.aspect,f=Math.max(c,u);if(f>0){var p=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(p,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Cr.Box3(new Cr.Vector3(0,0,0),new Cr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,ng(["x","y","z"].map(function(s){return YRe({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Cr.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new Cr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Cr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Cr.Vector3))},intersectingObjects:function(e,t,n){var r=new Cr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Cr.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls},_destructor:function(e){var t,n,r;i4e(e.scene),(t=e.controls)===null||t===void 0||t.dispose(),(n=e.renderer)===null||n===void 0||n.dispose(),(r=e.postProcessingComposer)===null||r===void 0||r.dispose()}},stateInit:function(){return{scene:new Cr.Scene,camera:new Cr.PerspectiveCamera,timer:new Cr.Timer,tweenGroup:new em,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,o=n.useWebGPU,a=o===void 0?!1:o,l=n.rendererConfig,c=l===void 0?{}:l,u=n.extraRenderers,f=u===void 0?[]:u,p=n.waitForLoadComplete,x=p===void 0?!0:p;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new Mie(t.container),t.pointerPos=new Cr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(v){return t.container.addEventListener(v,function(w){if(v==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&w.type==="pointermove"&&(w.pressure>0||t.isPointerPressed)&&(w.pointerType==="mouse"||w.movementX===void 0||[w.movementX,w.movementY].some(function(P){return Math.abs(P)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var S=T(t.container);t.pointerPos.x=w.pageX-S.left,t.pointerPos.y=w.pageY-S.top}function T(P){var R=P.getBoundingClientRect(),C=window.pageXOffset||document.documentElement.scrollLeft,L=window.pageYOffset||document.documentElement.scrollTop;return{top:R.top+L,left:R.left+C}}},{passive:!0})}),t.container.addEventListener("pointerup",function(v){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){v.button===0&&t.onClick(t.hoverObj||null,v,t.intersection),v.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,v,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(v){t.onRightClick&&v.preventDefault()}),t.renderer=new(a?V1:Cr.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=f,t.extraRenderers.forEach(function(v){v.domElement.style.position="absolute",v.domElement.style.top="0px",v.domElement.style.pointerEvents="none",t.container.appendChild(v.domElement)}),t.postProcessingComposer=new BR(t.renderer),t.postProcessingComposer.addPass(new UR(t.scene,t.camera)),t.controls=new{trackball:PR,orbit:NR,fly:LR}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(ng(t.extraRenderers)).forEach(function(v){return v.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new Cr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!x,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(ng(e.extraRenderers)).forEach(function(x){return x.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(x){return x})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(ng(o),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,l=e.width,c=e.height,u=e.viewOffset.slice(0,2);u.some(function(x){return x})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(ng(u),[l,c])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new Cr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=M0(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Cr.Color(xne(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Cr.TextureLoader().load(e.backgroundImageUrl,function(x){x.colorSpace=Cr.SRGBColorSpace,e.skysphere.material=new Cr.MeshBasicMaterial({map:x,side:Cr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&p()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&p())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(x){return e.scene.remove(x)}),e.lights.forEach(function(x){return e.scene.add(x)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(x){return e.scene.remove(x)}),e.objects.forEach(function(x){return e.scene.add(x)}));function p(){e.loadComplete=e.scene.visible=!0}}});function r4e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var s4e=`.scene-container .clickable {52875287 cursor: pointer;52885288 }`;r4e(s4e);function Yk(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function o4e(i){if(Array.isArray(i))return Yk(i)}function qb(i,e,t){return(e=f4e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function a4e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function l4e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5289-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Iie(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function ig(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Iie(Object(t),!0).forEach(function(n){qb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Iie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function c4e(i,e){if(i==null)return{};var t,n,r=u4e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function u4e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function s4(i){return o4e(i)||a4e(i)||d4e(i)||l4e()}function h4e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function f4e(i){var e=h4e(i,"string");return typeof e=="symbol"?e:e+""}function d4e(i,e){if(i){if(typeof i=="string")return Yk(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Yk(i,e):void 0}}function Nie(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var p4e=["rendererConfig","waitForGlobeReady"],Vb=ig(ig({},window.THREE?window.THREE:{AmbientLight:BA,DirectionalLight:OA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:x3}),Lie=Nie("globe",mk),A4e=Object.assign.apply(Object,s4(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return qb({},i,Lie.linkProp(i))}))),m4e=Object.assign.apply(Object,s4(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return qb({},i,Lie.linkMethod(i))}))),Die=Nie("renderObjs",$k),g4e=Object.assign.apply(Object,s4(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return qb({},i,Die.linkProp(i))}))),_4e=Object.assign.apply(Object,s4(["lights","postProcessingComposer"].map(function(i){return qb({},i,Die.linkMethod(i))}))),Fie=Or({props:ig(ig({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},A4e),g4e),methods:ig(ig({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s,o=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(c){return o[c]=+o[c]}),(s=e.povTween)===null||s===void 0||s.end(),!n)l(o);else{for(;r.lng-o.lng>180;)r.lng-=360;for(;r.lng-o.lng<-180;)r.lng+=360;e.tweenGroup.add(e.povTween=new Ws(r).to(o,n).easing(Br.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,p=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,p)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},m4e),_4e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=c4e(e,p4e),o=new mk(ig({waitForGlobeReady:r},s));return{globe:o,renderObjs:$k({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Vb.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Vb.AmbientLight(13421772,Math.PI),new Vb.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new em}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new Vb.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),o=t.renderObjs.controls();t.renderObjs.camera().near=.05,o.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),o.maxDistance=s*100,o.enablePan=!1,o.enableDamping=!0,o.dampingFactor=.1,o.rotateSpeed=.3,o.zoomSpeed=.3,o.zoomToCursor=!0,o.addEventListener("change",function(){o.target.setScalar(0);var c=n.pointOfView();o.rotateSpeed=c.altitude*.3,o.zoomSpeed=Math.sqrt(c.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(c)});var a=function(u){for(var f=u;f&&!f.hasOwnProperty("__globeObjType");)f=f.parent;return f},l={point:function(u){return u},arc:function(u){return u},polygon:function(u){return u.data},path:function(u){return u},heatmap:function(u){return u},hexbin:function(u){return u},hexPolygon:function(u){return u},tile:function(u){return u},particles:function(u,f){return!f||!f.hasOwnProperty("index")||u.length<=f.index?u:u[f.index]},label:function(u){return u},object:function(u){return u},custom:function(u){return u}};Vb.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var p=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(x){return x===f})&&Array.isArray(p)?!1:t.pointerEventsFilter(u,p)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},p=a(c),x=p&&p.__globeObjType;return p&&x&&f.hasOwnProperty(x)&&l.hasOwnProperty(x)&&rt(f[x])(l[x](p.__data,u))||""}).onHover(function(c,u,f){var p={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},x={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},v=a(c);if(v&&!p.hasOwnProperty(v.__globeObjType)&&(v=null),v!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,P=v?v.__globeObjType:null,R=(w=v)!==null&&w!==void 0&&w.__data?l[P](v.__data,f):null;S&&S!==P&&p[S]&&p[S](null,T||null),P&&p[P]&&p[P](R,S===P?T:null),t.renderObjs.renderer().domElement.classList[P&&x[P]&&rt(t.showPointerCursor)(P,R)?"add":"remove"]("clickable"),t.hoverObj=v,t.hoverData=R}}).onClick(function(c,u,f){if(c){var p={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}).onRightClick(function(c,u,f){if(c){var p={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}),this._animationCycle()}});var Uie=4,Wb=100,Xb=Wb+.2,cd=8,x4e=96,kie=.045,Gie=.08;function $b(i,e,t){let n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var $n=null,a4="",gs={group:null,tiles:new Map,key:"",variant:""},Lo={group:null,prefix:null,fitKey:""},mu={group:null,key:""},y4e=180,Kk=null,ix=new Map,u4=new Map,Oie=new Map;function zie(){let i=Kz(U.map)==="sphere"&&lf(U.map)!==null;ye.globeToggle.hidden=!i,Vie(),!i&&$n&&(Hb(),gs.group=null,Lo.group=null,Lo.prefix=null,mu.group=null,mu.key="",$n._destructor(),$n=null,a4="",Kk=null,ye.globe.replaceChildren())}function h4(){U.globeActive?Vie():Wie()}var jb=2.5,l4=2,rx=.08,f4=4;function v4e(i){let e=Number.isFinite(i)?i:l4;return ls(jb/2**(e-l4),rx,f4)}function Jk(i){let e=Number.isFinite(i)?Math.max(i,rx/2):jb,t=(U.variant?.maxZoom??l4)+2;return ls(l4+Math.log2(jb/e),0,t)}function e9(i){if(!$n||!U.globeActive)return;let e=$n.pointOfView(),t=ls((Number.isFinite(e.altitude)?e.altitude:jb)/2**i,rx,f4);$n.pointOfView({altitude:t},180)}function Vie(){let i=lf(U.map),e=U.engine?.getView();if($n&&U.globeActive&&i&&e){let t=$n.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(Jk(t.altitude)))}U.globeActive=!1,ye.globe.hidden=!0,ye.globeToggle.setAttribute("aria-pressed","false"),ye.viewport.hidden=!1,Hb(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function qie(){if(!$n||!U.globeActive)return null;let i=$n.pointOfView();return{lat:i.lat,lng:i.lng}}function Hie(i,e,t){if(!$n)return;let n=$n.pointOfView().altitude;$n.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Wie(){let i=lf(U.map);if(!i)return;if(U.globeActive=!0,ye.viewport.hidden=!0,ye.globe.hidden=!1,ye.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!$n){$n=Fie({animateIn:!1})(ye.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===U.selectedPin?.03:.014).objectThreeObject(o=>L4e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Fx(o.pin)).onObjectHover(o=>{ye.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Bie(),o4(),D4e()}),document.addEventListener("atlas:selection",N4e),document.addEventListener("atlas:filters",Zk),document.addEventListener("atlas:grid",()=>{c4(),Zk(),o4()}),document.addEventListener("atlas:labels",o4),$n.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=lf(U.map);if(!l)return;let[c,u]=l.toWorld(o,a),f=Qw([c,-u],U.gridPrefix.length+1);f&&Q0(f)});let s=$n.controls();s.minDistance=Wb*(1+rx),s.maxDistance=Wb*(1+f4),gs.group=new br,$n.scene().add(gs.group),Lo.group=new br,$n.scene().add(Lo.group),mu.group=new br,$n.scene().add(mu.group),window.__atlasGlobe={detail:gs,grid:Lo,labels:mu,sprites:ix}}t9();let e=U.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);$n.pointOfView({lat:s,lng:o,altitude:v4e(e.getZoom())})}else $n.pointOfView({lat:10,lng:0,altitude:jb});let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if(a4!==r){a4=r;let s=await O4e(n);s&&a4===r&&$n.globeImageUrl(s)}Kk!==U.pins&&(Kk=U.pins,ix.clear(),u4.clear(),$n.objectsData(F4e(i))),Zk(),$ie(),Bie(),c4(),o4(),document.dispatchEvent(new Event("atlas:globe-camera"))}function c4(){if(!$n||!Lo.group)return;for(let e of[...Lo.group.children])Lo.group.remove(e),e.geometry?.dispose(),e.material?.map?.dispose(),e.material?.dispose();let i=U.globeActive?lf(U.map):null;if(!i||!U.gridEnabled){Lo.prefix=null;return}for(let e of Kw()){let t=jie(e.extent,i),n=Zw(e,{subgridVisible:U.subgridVisible,labelled:w4e(e,t)});n&&(n.fill&&Lo.group.add(S4e(t,n.fill)),Lo.group.add(C4e(t,n.line)),n.label&&Lo.group.add(R4e(n.label,t)))}Lo.prefix!==null&&Lo.prefix!==U.gridPrefix&&P4e(i),Lo.prefix=U.gridPrefix}function b4e(i){let e=$n.pointOfView(),t=Math.max(e.altitude,rx/2),n=50*Math.PI/180,r=2*t*Wb*Math.tan(n/2)/Math.max(1,ye.globe.clientHeight||1),s=Wb*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function w4e(i,e){let n=i.role==="neighbor"?Li.neighborLabelSizePx:Li.labelSizePx,r=`900 ${n}px ${Li.labelFont}`,s=b4e(e);return DI(i.hash,r)+9<=s.width&&n+6<=s.height}function S4e(i,e){let t=T4e(i,Xb+.12),n=new Yr({color:e.color,transparent:!0,opacity:e.opacity,depthWrite:!1}),r=new Gn(t,n);return r.renderOrder=1,r}function T4e(i,e){let t=[],n=[],r=Math.max(Math.abs(i.east-i.west),Math.abs(i.north-i.south)),s=ls(Math.ceil(r/2),6,48);for(let a=0;a<=s;a++){let l=i.north+(i.south-i.north)*a/s;for(let c=0;c<=s;c++){let u=i.west+(i.east-i.west)*c/s;t.push(...$b(l,u,e))}}for(let a=0;a<s;a++)for(let l=0;l<s;l++){let c=a*(s+1)+l;n.push(c,c+s+1,c+1),n.push(c+1,c+s+1,c+s+2)}let o=new qn;return o.setAttribute("position",new Rn(t,3)),o.setIndex(n),o}function o4(){if(!$n||!mu.group)return;let i=U.globeActive&&U.labelsHeld,e=i?$n.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${U.gridPrefix}`:"";if(t===mu.key)return;mu.key=t;for(let r of[...mu.group.children])mu.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of ix){if(!s.visible)continue;let o=u4.get(r);if(!o)continue;let a=E4e(e,o);a>85||n.push({pin:r,stood:o,distance:a})}n.sort((r,s)=>r.distance-s.distance);for(let{pin:r,stood:s}of n.slice(0,y4e))mu.group.add(M4e(r,s))}function E4e(i,e){let t=Math.PI/180,n=Math.sin(i.lat*t)*Math.sin(e.lat*t)+Math.cos(i.lat*t)*Math.cos(e.lat*t)*Math.cos((i.lng-e.lng)*t);return Math.acos(ls(n,-1,1))*180/Math.PI}function M4e(i,e){let t=i.location.title,n=document.createElement("canvas"),r=n.getContext("2d"),s="600 26px Inter, system-ui, sans-serif";r.font=s;let o=Math.ceil(r.measureText(t).width)+24;n.width=o,n.height=40,r.font=s,r.textAlign="center",r.textBaseline="middle",r.fillStyle="rgba(10, 13, 17, 0.78)",r.fillRect(0,0,o,40),r.fillStyle="#e6ebf0",r.fillText(t,o/2,21);let a=new qu({depthWrite:!1,sizeAttenuation:!1,transparent:!0});new $a().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new MA(a);l.position.set(...$b(e.lat,e.lng,Xb+.4));let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function jie(i,e){let[t,n]=e.toLatLng(i[0],-i[3]).reverse(),[r,s]=e.toLatLng(i[2],-i[1]).reverse();return{west:t,north:n,east:r,south:s}}function C4e(i,e){let t=[],n=Math.max(Math.abs(i.east-i.west),Math.abs(i.north-i.south)),r=ls(Math.ceil(n/2),12,48),s=(u,f,p,x,v)=>[f+(x-f)*u,p+(v-p)*u],o=[[i.north,i.west,i.north,i.east],[i.north,i.east,i.south,i.east],[i.south,i.east,i.south,i.west],[i.south,i.west,i.north,i.west]];for(let u of o)for(let f=0;f<r;f++)t.push(...$b(...s(f/r,...u),Xb+.25));t.push(...t.slice(0,3));let a=new y0;a.setPositions(t);let l=new Vh({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});l.resolution.set(ye.globe.clientWidth||1,ye.globe.clientHeight||1);let c=new Y1(a,l);return c.computeLineDistances(),c.renderOrder=2,c}function R4e(i,e){let n=i.sizePx*2,r=`500 ${n-4}px ${Li.labelFont}`,s=`900 ${n}px ${Li.labelFont}`,o=document.createElement("canvas"),a=o.getContext("2d");a.font=r;let l=i.prefix?a.measureText(i.prefix).width:0;a.font=s;let c=a.measureText(i.final).width,u=10;o.width=Math.ceil(l+c+u*2),o.height=n+u*1.4,a.fillStyle=i.chip,a.fillRect(0,0,o.width,o.height),a.textBaseline="middle";let f=o.height/2+2;i.prefix&&(a.font=r,a.fillStyle=i.color,a.globalAlpha=Li.prefixAlpha*i.textAlpha,a.fillText(i.prefix,u,f)),a.font=s,a.globalAlpha=i.textAlpha,a.fillStyle=i.color,a.fillText(i.final,u+l,f),a.globalAlpha=1;let p=new qu({depthWrite:!1,transparent:!0,sizeAttenuation:!1});new $a().load(o.toDataURL("image/png"),P=>{p.map=P,p.needsUpdate=!0});let x=new MA(p),v=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;x.position.set(...$b(e.south+v,e.east-w,Xb+.35));let S=Math.max(1,ye.globe.clientHeight||1),T=o.height/2/S;return x.scale.set(T*o.width/o.height,T,1),x.center.set(1,0),x.renderOrder=3,x}function P4e(i){let t=Kw().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let n=jie(t.extent,i),r=(n.north+n.south)/2,s=(n.west+n.east)/2,o=Math.max(Math.abs(n.east-n.west),Math.abs(n.north-n.south)),a=ls(o/45,rx,f4);$n.pointOfView({lat:r,lng:s,altitude:a},400)}function Bie(){if(!$n||!gs.group)return;let i=U.globeActive?U.variant||U.map.variants[0]:null;if(!i){Hb();return}gs.variant!==i.tiles&&(Hb(),gs.variant=i.tiles);let e=$n.pointOfView(),t=Math.min(Math.round(Jk(e.altitude))+1,i.maxZoom);if(t<=Uie||!i.formats[t]){Hb(),gs.key="";return}let n=2**t,r=n/2,s=360/n,o=Math.acos(1/(1+e.altitude))*180/Math.PI+s,a=Math.floor(((e.lng+180)%360+360)%360/s),l=Math.floor((90-e.lat)/s),c=Math.ceil(o/s);for(;(2*c+1)**2>x4e&&c>1;)c--;let u=new Set;for(let p=-c;p<=c;p++){let x=l+p;if(!(x<0||x>=r))for(let v=-c;v<=c;v++){let w=((a+v)%n+n)%n;u.add(`${t}/${w}/${x}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==gs.key){gs.key=f;for(let[p,x]of gs.tiles)u.has(p)||(gs.group.remove(x),Xie(x),gs.tiles.delete(p));for(let p of u){if(gs.tiles.has(p))continue;let[x,v,w]=p.split("/").map(Number),S=I4e(i,x,v,w);gs.tiles.set(p,S),gs.group.add(S)}}}function I4e(i,e,t,n){let r=360/2**e,s=-180+t*r,o=90-n*r,a=[],l=[],c=[];for(let w=0;w<=cd;w++){let S=o-w/cd*r;for(let T=0;T<=cd;T++){let P=s+T/cd*r;a.push(...$b(S,P,Xb)),l.push(T/cd,1-w/cd)}}let u=cd+1;for(let w=0;w<cd;w++)for(let S=0;S<cd;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new qn;f.setAttribute("position",new Rn(a,3)),f.setAttribute("uv",new Rn(l,2)),f.setIndex(c);let p=new Yr,x=new Gn(f,p);x.visible=!1;let v=`${U.game.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new $a().load(v,w=>{w.colorSpace=vr,p.map=w,p.needsUpdate=!0,x.visible=!0}),x}function Hb(){if(gs.group){for(let i of gs.tiles.values())gs.group.remove(i),Xie(i);gs.tiles.clear(),gs.key=""}}function Xie(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function $ie(){if($n){for(let[i,e]of ix){let t=i===U.selectedPin;e.material=Zie(i.category,t);let n=t?Gie:kie;e.scale.set(n,n,1)}$n.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function N4e(){if(!$n||!U.globeActive)return;$ie();let i=u4.get(U.selectedPin);if(i){let e=$n.pointOfView().altitude;$n.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function Yie(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridPrefix&&!Cd(i))}function Zk(){if(!(!$n||!U.globeActive))for(let[i,e]of ix)e.visible=Yie(i)}function L4e(i){let e=new MA(Zie(i.category,i===U.selectedPin)),t=i===U.selectedPin?Gie:kie;return e.scale.set(t,t,1),e.visible=Yie(i),ix.set(i,e),e}function Zie(i,e){let t=`${Wx(i)}:${e?"ringed":"plain"}`,n=Oie.get(t);if(n)return n;n=new qu({depthWrite:!1,sizeAttenuation:!1}),Oie.set(t,n);let r=U.markerIcons.get(Wx(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=J0(),l.strokeText(Oc(i.title),40,41),l.fillStyle=eA(i),l.fillText(Oc(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new $a().load(a.toDataURL("image/png"),c=>{n.map=c,n.needsUpdate=!0})};if(r){let o=new Image;o.onload=()=>s(o),o.onerror=()=>s(null),o.src=r}else s(null);return n}function Kie(){U.globeActive&&Wie()}function t9(){!$n||ye.globe.hidden||($n.width(ye.globe.clientWidth).height(ye.globe.clientHeight),c4())}function D4e(){if(!$n||!U.globeActive||!U.gridEnabled)return;let i=$n.pointOfView(),e=`${U.gridPrefix}:${Math.round(Jk(i.altitude)*2)}`;e!==Lo.fitKey&&(Lo.fitKey=e,c4())}function F4e(i){let e=[];for(let t of U.pins){let[n,r]=Og(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),u4.set(t,{lat:s,lng:o})}return e}async function O4e(i){let e=Math.min(Uie,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${U.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(B4e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function B4e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function Qie(){let i=U.variant,e=ye.overviewCanvas,t=e.getContext("2d"),n=Xl(),r=U.game.tileGrid.size,s=U.game.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++U.overviewRun,f=i.formats[l],p=Math.floor(n[0]/r*2**l),x=Math.ceil(n[2]/r*2**l),v=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=v;S<w;S++)for(let T=p;T<x;T++){if(!f||!p4(i,l,T,S))continue;let P=new Image;P.onload=()=>{U.overviewRun===u&&t.drawImage(P,T*s-n[0]*c,S*s+n[3]*c,s,s)},P.src=`${U.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}sx()}function sx(){let i=qie();if(i){let w=lf(U.map);if(!w||!U.variant)return;let S=Xl(),[T,P]=w.toWorld(i.lat,i.lng),R=ye.overviewCanvas,C=ls((T-S[0])/(S[2]-S[0]),0,1),L=ls((P+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",ye.overviewShelf.hidden=!1;let D=ye.overviewViewport.style,F=22;D.left=`${C*R.width-F/2}px`,D.top=`${L*R.height-F/2}px`,D.width=`${F}px`,D.height=`${F}px`;return}let e=U.engine?.getView();if(!e||!U.variant)return;let t=Xl(),n=e.calculateExtent(U.engine.getSize()),r=t[2]-t[0],s=t[3]-t[1],o=(e.getResolution()||0)*4,a=n[0]<=t[0]+o&&n[1]<=t[1]+o&&n[2]>=t[2]-o&&n[3]>=t[3]-o,l=a?"hidden":n.map(Math.round).join(",");if(l===U.overviewKey||(U.overviewKey=l,ye.overviewShelf.hidden=a,a))return;let c=ye.overviewCanvas,u=ls((n[0]-t[0])/r,0,1),f=ls((n[2]-t[0])/r,0,1),p=ls((t[3]-n[3])/s,0,1),x=ls((t[3]-n[1])/s,0,1),v=ye.overviewViewport.style;v.left=`${u*c.width}px`,v.top=`${p*c.height}px`,v.width=`${Math.max(8,(f-u)*c.width)}px`,v.height=`${Math.max(8,(x-p)*c.height)}px`}function d4(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,ox()),ye.overviewShelf.classList.toggle("is-docked",i),ye.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ye.overviewDock.setAttribute("aria-label",t),ye.overviewDock.title=t,e&&Lc()}function n9(i,e){let t=ye.overviewCanvas.getBoundingClientRect(),n=Xl(),r=(a,l,c)=>ls((a-l)/(c-l),0,1);if(U.globeActive){let a=lf(U.map);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);Hie(u,f,e);return}let s=U.engine?.getView();if(!s||!U.variant)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function kl(i){return new mH({updateWhileAnimating:!0,...i})}function Jie(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new _d({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new vf({wrapX:!1}),gridContext:new vf({wrapX:!1}),zoneScrim:new vf({wrapX:!1}),zones:new vf({wrapX:!1}),zoneTitles:new vf({wrapX:!1}),text:new vf({wrapX:!1}),pins:new vf({wrapX:!1}),priority:new vf({wrapX:!1})},U.layers={raster:new Q5({zIndex:0}),rasterDetail:new Q5({zIndex:1}),grid:kl({source:U.sources.grid,style:LI,renderOrder:Zl,renderBuffer:40,zIndex:5}),zoneScrim:kl({source:U.sources.zoneScrim,style:TV,zIndex:6}),zones:kl({source:U.sources.zones,style:EV,renderBuffer:32,zIndex:10}),zoneTitles:kl({source:U.sources.zoneTitles,style:MV,renderOrder:Zl,renderBuffer:160,zIndex:20}),zoneTitleDetail:kl({source:U.sources.zoneTitles,style:CV,renderOrder:Zl,renderBuffer:160,zIndex:44}),text:kl({source:U.sources.text,style:xV,renderOrder:Zl,renderBuffer:220,zIndex:30}),textDetail:kl({source:U.sources.text,style:yV,renderOrder:Zl,renderBuffer:220,zIndex:45}),zoneText:kl({source:U.sources.text,style:vV,renderOrder:Zl,renderBuffer:220,zIndex:41}),pins:kl({source:U.sources.pins,style:mV,renderOrder:Zl,renderBuffer:48,zIndex:40}),zonePins:kl({source:U.sources.pins,style:gV,renderOrder:Zl,renderBuffer:48,zIndex:42}),pinLabels:kl({source:U.sources.pins,style:_V,renderOrder:Zl,renderBuffer:180,zIndex:45}),gridContext:kl({source:U.sources.gridContext,style:LI,renderOrder:Zl,renderBuffer:40,zIndex:48}),priority:kl({source:U.sources.priority,style:bV,renderOrder:Zl,renderBuffer:220,zIndex:50})},U.engine=new Vq({target:ye.viewport,layers:Object.values(U.layers),controls:yS({attribution:!1,rotate:!1,zoom:!1}),interactions:ES({onFocusOnly:!1}),view:m4(5)}),U.engine.on("movestart",()=>{U.engine.getViewport().classList.add("is-dragging")}),U.engine.on("moveend",()=>{U.engine.getViewport().classList.remove("is-dragging"),U.overviewPointer===null&&ox()}),U.engine.on("postrender",sx),ye.viewport.addEventListener("wheel",()=>{document.activeElement!==ye.viewport&&ye.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),U.engine.on("singleclick",t=>{if(U.gridEnabled){let r=U.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("gridCell");return o&&o.role!=="leaf"&&o.role!=="scope"?o:null},{hitTolerance:1,layerFilter:s=>s===U.layers.grid||s===U.layers.gridContext});if(r){Q0(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>A4(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:A4});n&&Fx(n)}),U.engine.on("pointermove",t=>{if(t.dragging){Bg(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>A4(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:A4}),r=n&&Pu(n.category)==="text"?null:n;Bg(r||null);let s=U.gridEnabled&&U.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===U.layers.grid||o===U.layers.gridContext});U.engine.getTargetElement().style.cursor=n||s?"pointer":""}),U.engine.getViewport().addEventListener("pointerleave",()=>Bg(null))}function A4(i){return i===U.layers.pins||i===U.layers.zonePins||i===U.layers.pinLabels||i===U.layers.priority||i===U.layers.text||i===U.layers.textDetail||i===U.layers.zoneText}function m4(i,e=null){let t=U.game.tileGrid.size,n=e||[0,-t,t,0];return new pl({projection:U.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:i9(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function i9(i){let e=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function df(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||Jie(),!e&&!U.restore&&(U.restore=Cg(U.game.slug)),ye.game.value=U.game.slug,U0(ye.map,U.game.maps,"title"),ye.map.disabled=U.game.maps.length===1,ye.map.title=ye.map.disabled?"This game has one map":"Choose a map";let t=U.restore?.game===U.game.slug?U.restore:null,n=e&&U.game.maps.find(r=>r.slug===e)||t&&U.game.maps.find(r=>r.slug===t.map);await r9((n||U.game.maps[0]).slug)}async function r9(i){let e=U.game.maps.find(s=>s.slug===i)||U.game.maps[0],t=++U.mapRun;ye.loading.hidden=!1;let n;try{n=await WV(e)}catch{U.mapRun===t&&(ye.loading.hidden=!0,sA());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",J0()),ye.map.value=U.map.slug,U0(ye.variant,U.map.variants,"name"),ye.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),Bg(null),U.gridPrefix="",U.hiddenCategories.clear(),U.collapsedSections.clear(),U.collapsedSections.add("zones");for(let s of U.map.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.map.slug?U.restore:null;r&&(U.hiddenCategories=new Set(r.hidden),U.collapsedSections=new Set(r.collapsed)),d4(!!U.restore?.overviewDocked,!1),nS(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",ye.search.value="",ye.dock.hidden=!1,Fc(),zV(),BI(),kV(),s9(r?ls(r.variant,0,U.map.variants.length-1):0,!0),zie(),U.restore=null,ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"),Tz(),U.settling=!1,Lc()}function s9(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:G4e(t,n),s=Ru(n);if(ye.variant.value=String(U.map.variants.indexOf(U.variant)),e)U.engine.setView(m4(s,Xl()));else{let w=U.engine.getView(),S=m4(s,Xl());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),U.engine.setView(S)}let o=++U.tileRun,a=0;U.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ye.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{U.tileRun===o&&(a++,U.tileStats.requested++,U.tileStats.peakPending=Math.max(U.tileStats.peakPending,a))});let S=T=>{U.tileRun===o&&(a=Math.max(0,a-1),T?U.tileStats.errors++:U.tileStats.loaded++,a===0&&U.tileStats.loaded>0&&(ye.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new wz({projection:U.projection,tileGrid:new Mx({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:i9(w),tileSize:U.game.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,P,R])=>{let C=n.formats[T];if(!(!C||P<0||R<0||!S(T,P,R)))return`${U.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${P}/${R}.${C}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>p4(n,w,S,T)),p=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Xl()),U.layers.raster.setBackground(n.background||void 0),p?.clear();let x=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&p4(n,w,S,T))),U.layers.rasterDetail.setExtent(Xl()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),x?.clear(),Yw(),U.gridEnabled&&(Cu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",Qie();let v=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(BI(),$l()),v?.center&&Number.isFinite(v.zoom)){let w=U.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),U.fitZoom=v.zoom,rA()}else e?requestAnimationFrame(z4e):(r&&U.engine.getView().animate({center:r,duration:200}),rA());Lc()}function p4(i,e,t,n){let r=i.coverage?.[e];if(!r)return!0;let s=t-r.x,o=n-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=k4e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function k4e(i,e,t){if(!t.decoded){let n=atob(t.bits),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);t.decoded=r}return t.decoded}function Ru(i){return i.maxZoom+2}function ox(){rA(),Lc()}function G4e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=U.engine?.getView()?.getCenter();if(!n)return null;let r=(n[0]-i.bounds.x)/i.bounds.width,s=(-n[1]-i.bounds.y)/i.bounds.height;return[e.bounds.x+ls(r,0,1)*e.bounds.width,-(e.bounds.y+ls(s,0,1)*e.bounds.height)]}function ere(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ye.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Xl(){let i=U.game.tileGrid.size,e=U.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function z4e(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit(Xl(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,rA()}function Yb(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:ls(t+i,U.variant.minZoom,Ru(U.variant)),duration:140})}function rA(){let i=U.engine?.getView().getZoom();if(ye.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){ye.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Kl(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}ye.visibleCount.textContent=`${Bc(U.eligibleLocations)} enabled \xB7 ${Bc(t)} in view`}function tre(){ye.game.addEventListener("change",()=>{df(ye.game.value)}),ye.map.addEventListener("change",()=>{r9(ye.map.value)}),ye.addBundles.addEventListener("click",()=>{qI()}),ye.emptyOpen.addEventListener("click",()=>{qI()}),ye.variant.addEventListener("change",()=>{s9(Number(ye.variant.value)),Kie()}),ye.globeToggle.addEventListener("click",()=>h4()),ye.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){qV(r.dataset.sectionToggle);return}if(!r.dataset.category)return;let s=Number(r.dataset.category);r.checked?U.hiddenCategories.delete(s):U.hiddenCategories.add(s),$l(),Pd()});let i=null,e=()=>{for(let s of ye.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!i)return;let r=document.elementFromPoint(i.x,i.y)?.closest(".category-row, .layer-header");r&&ye.layers.contains(r)&&r.classList.add("is-hovered")};ye.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ye.layers.addEventListener("pointerleave",()=>{i=null,e()}),ye.layers.addEventListener("scroll",e,{passive:!0}),ye.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),HV(r.dataset.onlyCategory?{category:Number(r.dataset.onlyCategory)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-section]");if(!s)return;let o=s.dataset.section;U.collapsedSections.has(o)?U.collapsedSections.delete(o):U.collapsedSections.add(o),gS()}),ye.soloChip.addEventListener("click",()=>Xx(!0)),nn("#expand-all").addEventListener("click",()=>zI(!1)),nn("#collapse-all").addEventListener("click",()=>zI(!0)),nn("#show-all").addEventListener("click",()=>Xx(!0)),nn("#hide-all").addEventListener("click",()=>Xx(!1)),ye.zoneToggle.addEventListener("change",()=>{AS(ye.zoneToggle.checked)}),ye.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&OV(Number(r.dataset.zone))}),ye.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),BV(Number(r.dataset.zone)))}),ye.search.addEventListener("input",()=>{U.search=ye.search.value.trim().toLocaleLowerCase(),$l(),U.search&&tS()}),ye.dockFold.addEventListener("click",()=>{cI(!U.dockFolded)}),ye.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&uI(s)}),ye.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&uI(s)}),nn("#close-detail").addEventListener("click",Fc),nn("#zoom-in").addEventListener("click",()=>U.globeActive?e9(1):Yb(1)),nn("#zoom-out").addEventListener("click",()=>U.globeActive?e9(-1):Yb(-1)),ye.gridBack.addEventListener("click",aI),ye.gridInput.addEventListener("input",()=>{let n=Md(),r=[...ye.gridInput.value.toLocaleLowerCase()].filter(s=>wc.includes(s)).slice(0,n).join("");ye.gridInput.value=r,Q0(r)}),ye.subgridToggle.addEventListener("click",()=>{Dx(!U.subgridVisible),ye.viewport.focus({preventScroll:!0})}),ye.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Dx(!U.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ye.globeToggle.hidden||h4();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ye.viewport.focus({preventScroll:!0}))}),ye.viewport.addEventListener("keydown",n=>{if(!eS(n.target)){if(n.key==="+"||n.key==="=")Yb(1);else if(n.key==="-")Yb(-1);else if(n.key==="Escape")Fc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{eS(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!eS(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ye.globeToggle.hidden||(n.preventDefault(),h4());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ye.search.focus(),ye.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ye.dock.hidden||cI(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),ere();return}Hz(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||mS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&mS(!1)}),window.addEventListener("blur",()=>mS(!1)),window.addEventListener("hashchange",()=>{let n=Rg();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,df(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),sx(),t9()}),document.addEventListener("atlas:globe-camera",()=>sx()),ye.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ye.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,n9(n,!0))}),ye.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),n9(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,ox())};ye.overview.addEventListener("pointerup",t),ye.overview.addEventListener("pointercancel",t),ye.overviewDock.addEventListener("click",()=>{d4(!U.overviewDocked),ye.viewport.focus({preventScroll:!0})}),ye.mobileLegend.addEventListener("click",()=>{let n=ye.sidebar.classList.toggle("is-open");ye.mobileLegend.setAttribute("aria-expanded",String(n))})}function nre(){let i=()=>({game:U.game?.title,map:U.map?.title,variant:U.variant?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.variant?.maxZoom,maxZoom:U.variant?Ru(U.variant):null,interpolate:U.variant?.interpolate,tileStats:{...U.tileStats},pins:U.pins.length,eligibleLocations:U.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:U.labelsHeld,hoveredPin:U.hoveredPin?.location.title||null,selectedPin:U.selectedPin?.location.title||null,fitZoom:U.fitZoom,filters:{hiddenCategories:[...U.hiddenCategories].sort(),collapsedSections:[...U.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!ye.detail.hidden,detailTitle:ye.detail.hidden?null:ye.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!ye.searchResults.hidden,soloChip:ye.soloChip.hidden?null:ye.soloChip.textContent,visibleCountText:ye.visibleCount.textContent,overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed,subgridVisible:U.subgridVisible},zones:{visible:U.zonesVisible,count:U.zoneRecords.size,focused:U.zoneRecords.get(U.focusedZoneID)?.zone.title||null,highlighted:[...U.highlightedZones].map(e=>U.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:U.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:U.gridEnabled,prefix:U.gridPrefix,maximumDepth:Md(),extent:U.gridEnabled?Ig():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridPrefix?U.pins.filter(e=>!e.filteredHidden&&Cd(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:sA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>U.engine?.renderSync()}async function ire(){tre();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(U.catalog=await i.json(),U0(ye.game,U.catalog.games,"title"),VI(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{sA()}),U.catalog.games.length){let e=Rg(),t=Cg(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await df(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else ye.loading.hidden=!0;nre(),requestAnimationFrame(()=>ye.viewport.focus({preventScroll:!0}))}catch(i){ye.loading.hidden=!0,ye.fatalMessage.textContent=i instanceof Error?i.message:String(i),ye.fatal.hidden=!1}}ire();})();5289+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Iie(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function ig(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Iie(Object(t),!0).forEach(function(n){qb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Iie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function c4e(i,e){if(i==null)return{};var t,n,r=u4e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function u4e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function s4(i){return o4e(i)||a4e(i)||d4e(i)||l4e()}function h4e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function f4e(i){var e=h4e(i,"string");return typeof e=="symbol"?e:e+""}function d4e(i,e){if(i){if(typeof i=="string")return Yk(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Yk(i,e):void 0}}function Nie(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var p4e=["rendererConfig","waitForGlobeReady"],Vb=ig(ig({},window.THREE?window.THREE:{AmbientLight:BA,DirectionalLight:OA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:x3}),Lie=Nie("globe",mk),A4e=Object.assign.apply(Object,s4(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return qb({},i,Lie.linkProp(i))}))),m4e=Object.assign.apply(Object,s4(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return qb({},i,Lie.linkMethod(i))}))),Die=Nie("renderObjs",$k),g4e=Object.assign.apply(Object,s4(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return qb({},i,Die.linkProp(i))}))),_4e=Object.assign.apply(Object,s4(["lights","postProcessingComposer"].map(function(i){return qb({},i,Die.linkMethod(i))}))),Fie=Or({props:ig(ig({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},A4e),g4e),methods:ig(ig({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s,o=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(c){return o[c]=+o[c]}),(s=e.povTween)===null||s===void 0||s.end(),!n)l(o);else{for(;r.lng-o.lng>180;)r.lng-=360;for(;r.lng-o.lng<-180;)r.lng+=360;e.tweenGroup.add(e.povTween=new Ws(r).to(o,n).easing(Br.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,p=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,p)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},m4e),_4e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=c4e(e,p4e),o=new mk(ig({waitForGlobeReady:r},s));return{globe:o,renderObjs:$k({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Vb.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Vb.AmbientLight(13421772,Math.PI),new Vb.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new em}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new Vb.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),o=t.renderObjs.controls();t.renderObjs.camera().near=.05,o.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),o.maxDistance=s*100,o.enablePan=!1,o.enableDamping=!0,o.dampingFactor=.1,o.rotateSpeed=.3,o.zoomSpeed=.3,o.zoomToCursor=!0,o.addEventListener("change",function(){o.target.setScalar(0);var c=n.pointOfView();o.rotateSpeed=c.altitude*.3,o.zoomSpeed=Math.sqrt(c.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(c)});var a=function(u){for(var f=u;f&&!f.hasOwnProperty("__globeObjType");)f=f.parent;return f},l={point:function(u){return u},arc:function(u){return u},polygon:function(u){return u.data},path:function(u){return u},heatmap:function(u){return u},hexbin:function(u){return u},hexPolygon:function(u){return u},tile:function(u){return u},particles:function(u,f){return!f||!f.hasOwnProperty("index")||u.length<=f.index?u:u[f.index]},label:function(u){return u},object:function(u){return u},custom:function(u){return u}};Vb.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var p=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(x){return x===f})&&Array.isArray(p)?!1:t.pointerEventsFilter(u,p)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},p=a(c),x=p&&p.__globeObjType;return p&&x&&f.hasOwnProperty(x)&&l.hasOwnProperty(x)&&rt(f[x])(l[x](p.__data,u))||""}).onHover(function(c,u,f){var p={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},x={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},v=a(c);if(v&&!p.hasOwnProperty(v.__globeObjType)&&(v=null),v!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,P=v?v.__globeObjType:null,R=(w=v)!==null&&w!==void 0&&w.__data?l[P](v.__data,f):null;S&&S!==P&&p[S]&&p[S](null,T||null),P&&p[P]&&p[P](R,S===P?T:null),t.renderObjs.renderer().domElement.classList[P&&x[P]&&rt(t.showPointerCursor)(P,R)?"add":"remove"]("clickable"),t.hoverObj=v,t.hoverData=R}}).onClick(function(c,u,f){if(c){var p={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}).onRightClick(function(c,u,f){if(c){var p={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}),this._animationCycle()}});var Uie=4,Wb=100,Xb=Wb+.2,cd=8,x4e=96,kie=.045,Gie=.08;function $b(i,e,t){let n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var $n=null,a4="",gs={group:null,tiles:new Map,key:"",variant:""},Lo={group:null,prefix:null,fitKey:""},mu={group:null,key:""},y4e=180,Kk=null,ix=new Map,u4=new Map,Oie=new Map;function zie(){let i=Kz(U.map)==="sphere"&&lf(U.map)!==null;ye.globeToggle.hidden=!i,Vie(),!i&&$n&&(Hb(),gs.group=null,Lo.group=null,Lo.prefix=null,mu.group=null,mu.key="",$n._destructor(),$n=null,a4="",Kk=null,ye.globe.replaceChildren())}function h4(){U.globeActive?Vie():Wie()}var jb=2.5,l4=2,rx=.08,f4=4;function v4e(i){let e=Number.isFinite(i)?i:l4;return ls(jb/2**(e-l4),rx,f4)}function Jk(i){let e=Number.isFinite(i)?Math.max(i,rx/2):jb,t=(U.variant?.maxZoom??l4)+2;return ls(l4+Math.log2(jb/e),0,t)}function e9(i){if(!$n||!U.globeActive)return;let e=$n.pointOfView(),t=ls((Number.isFinite(e.altitude)?e.altitude:jb)/2**i,rx,f4);$n.pointOfView({altitude:t},180)}function Vie(){let i=lf(U.map),e=U.engine?.getView();if($n&&U.globeActive&&i&&e){let t=$n.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(Jk(t.altitude)))}U.globeActive=!1,ye.globe.hidden=!0,ye.globeToggle.setAttribute("aria-pressed","false"),ye.viewport.hidden=!1,Hb(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function qie(){if(!$n||!U.globeActive)return null;let i=$n.pointOfView();return{lat:i.lat,lng:i.lng}}function Hie(i,e,t){if(!$n)return;let n=$n.pointOfView().altitude;$n.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Wie(){let i=lf(U.map);if(!i)return;if(U.globeActive=!0,ye.viewport.hidden=!0,ye.globe.hidden=!1,ye.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!$n){$n=Fie({animateIn:!1})(ye.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===U.selectedPin?.03:.014).objectThreeObject(o=>L4e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Fx(o.pin)).onObjectHover(o=>{ye.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Bie(),o4(),D4e()}),document.addEventListener("atlas:selection",N4e),document.addEventListener("atlas:filters",Zk),document.addEventListener("atlas:grid",()=>{c4(),Zk(),o4()}),document.addEventListener("atlas:labels",o4),$n.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=lf(U.map);if(!l)return;let[c,u]=l.toWorld(o,a),f=Qw([c,-u],U.gridPrefix.length+1);f&&Q0(f)});let s=$n.controls();s.minDistance=Wb*(1+rx),s.maxDistance=Wb*(1+f4),gs.group=new br,$n.scene().add(gs.group),Lo.group=new br,$n.scene().add(Lo.group),mu.group=new br,$n.scene().add(mu.group),window.__atlasGlobe={detail:gs,grid:Lo,labels:mu,sprites:ix}}t9();let e=U.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);$n.pointOfView({lat:s,lng:o,altitude:v4e(e.getZoom())})}else $n.pointOfView({lat:10,lng:0,altitude:jb});let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if(a4!==r){a4=r;let s=await O4e(n);s&&a4===r&&$n.globeImageUrl(s)}Kk!==U.pins&&(Kk=U.pins,ix.clear(),u4.clear(),$n.objectsData(F4e(i))),Zk(),$ie(),Bie(),c4(),o4(),document.dispatchEvent(new Event("atlas:globe-camera"))}function c4(){if(!$n||!Lo.group)return;for(let e of[...Lo.group.children])Lo.group.remove(e),e.geometry?.dispose(),e.material?.map?.dispose(),e.material?.dispose();let i=U.globeActive?lf(U.map):null;if(!i||!U.gridEnabled){Lo.prefix=null;return}for(let e of Kw()){let t=jie(e.extent,i),n=Zw(e,{subgridVisible:U.subgridVisible,labelled:w4e(e,t)});n&&(n.fill&&Lo.group.add(S4e(t,n.fill)),Lo.group.add(C4e(t,n.line)),n.label&&Lo.group.add(R4e(n.label,t)))}Lo.prefix!==null&&Lo.prefix!==U.gridPrefix&&P4e(i),Lo.prefix=U.gridPrefix}function b4e(i){let e=$n.pointOfView(),t=Math.max(e.altitude,rx/2),n=50*Math.PI/180,r=2*t*Wb*Math.tan(n/2)/Math.max(1,ye.globe.clientHeight||1),s=Wb*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function w4e(i,e){let n=i.role==="neighbor"?Li.neighborLabelSizePx:Li.labelSizePx,r=`900 ${n}px ${Li.labelFont}`,s=b4e(e);return DI(i.hash,r)+9<=s.width&&n+6<=s.height}function S4e(i,e){let t=T4e(i,Xb+.12),n=new Yr({color:e.color,transparent:!0,opacity:e.opacity,depthWrite:!1}),r=new Gn(t,n);return r.renderOrder=1,r}function T4e(i,e){let t=[],n=[],r=Math.max(Math.abs(i.east-i.west),Math.abs(i.north-i.south)),s=ls(Math.ceil(r/2),6,48);for(let a=0;a<=s;a++){let l=i.north+(i.south-i.north)*a/s;for(let c=0;c<=s;c++){let u=i.west+(i.east-i.west)*c/s;t.push(...$b(l,u,e))}}for(let a=0;a<s;a++)for(let l=0;l<s;l++){let c=a*(s+1)+l;n.push(c,c+s+1,c+1),n.push(c+1,c+s+1,c+s+2)}let o=new qn;return o.setAttribute("position",new Rn(t,3)),o.setIndex(n),o}function o4(){if(!$n||!mu.group)return;let i=U.globeActive&&U.labelsHeld,e=i?$n.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${U.gridPrefix}`:"";if(t===mu.key)return;mu.key=t;for(let r of[...mu.group.children])mu.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of ix){if(!s.visible)continue;let o=u4.get(r);if(!o)continue;let a=E4e(e,o);a>85||n.push({pin:r,stood:o,distance:a})}n.sort((r,s)=>r.distance-s.distance);for(let{pin:r,stood:s}of n.slice(0,y4e))mu.group.add(M4e(r,s))}function E4e(i,e){let t=Math.PI/180,n=Math.sin(i.lat*t)*Math.sin(e.lat*t)+Math.cos(i.lat*t)*Math.cos(e.lat*t)*Math.cos((i.lng-e.lng)*t);return Math.acos(ls(n,-1,1))*180/Math.PI}function M4e(i,e){let t=i.location.title,n=document.createElement("canvas"),r=n.getContext("2d"),s="600 26px Inter, system-ui, sans-serif";r.font=s;let o=Math.ceil(r.measureText(t).width)+24;n.width=o,n.height=40,r.font=s,r.textAlign="center",r.textBaseline="middle",r.fillStyle="rgba(10, 13, 17, 0.78)",r.fillRect(0,0,o,40),r.fillStyle="#e6ebf0",r.fillText(t,o/2,21);let a=new qu({depthWrite:!1,sizeAttenuation:!1,transparent:!0});new $a().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new MA(a);l.position.set(...$b(e.lat,e.lng,Xb+.4));let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function jie(i,e){let[t,n]=e.toLatLng(i[0],-i[3]).reverse(),[r,s]=e.toLatLng(i[2],-i[1]).reverse();return{west:t,north:n,east:r,south:s}}function C4e(i,e){let t=[],n=Math.max(Math.abs(i.east-i.west),Math.abs(i.north-i.south)),r=ls(Math.ceil(n/2),12,48),s=(u,f,p,x,v)=>[f+(x-f)*u,p+(v-p)*u],o=[[i.north,i.west,i.north,i.east],[i.north,i.east,i.south,i.east],[i.south,i.east,i.south,i.west],[i.south,i.west,i.north,i.west]];for(let u of o)for(let f=0;f<r;f++)t.push(...$b(...s(f/r,...u),Xb+.25));t.push(...t.slice(0,3));let a=new y0;a.setPositions(t);let l=new Vh({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});l.resolution.set(ye.globe.clientWidth||1,ye.globe.clientHeight||1);let c=new Y1(a,l);return c.computeLineDistances(),c.renderOrder=2,c}function R4e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Li.labelFont}`,s=`900 ${n}px ${Li.labelFont}`,o=document.createElement("canvas"),a=o.getContext("2d");a.font=r;let l=i.prefix?a.measureText(i.prefix).width:0;a.font=s;let c=a.measureText(i.final).width,u=10;o.width=Math.ceil(l+c+u*2),o.height=n+u*1.4,a.fillStyle=i.chip,a.fillRect(0,0,o.width,o.height),a.textBaseline="middle";let f=o.height/2+2;i.prefix&&(a.font=r,a.fillStyle=i.color,a.globalAlpha=Li.prefixAlpha*i.textAlpha,a.fillText(i.prefix,u,f)),a.font=s,a.globalAlpha=i.textAlpha,a.fillStyle=i.color,a.fillText(i.final,u+l,f),a.globalAlpha=1;let p=new qu({depthWrite:!1,transparent:!0,sizeAttenuation:!1});new $a().load(o.toDataURL("image/png"),P=>{p.map=P,p.needsUpdate=!0});let x=new MA(p),v=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;x.position.set(...$b(e.south+v,e.east-w,Xb+.35));let S=Math.max(1,ye.globe.clientHeight||1),T=o.height/2/S;return x.scale.set(T*o.width/o.height,T,1),x.center.set(1,0),x.renderOrder=3,x}function P4e(i){let t=Kw().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let n=jie(t.extent,i),r=(n.north+n.south)/2,s=(n.west+n.east)/2,o=Math.max(Math.abs(n.east-n.west),Math.abs(n.north-n.south)),a=ls(o/45,rx,f4);$n.pointOfView({lat:r,lng:s,altitude:a},400)}function Bie(){if(!$n||!gs.group)return;let i=U.globeActive?U.variant||U.map.variants[0]:null;if(!i){Hb();return}gs.variant!==i.tiles&&(Hb(),gs.variant=i.tiles);let e=$n.pointOfView(),t=Math.min(Math.round(Jk(e.altitude))+1,i.maxZoom);if(t<=Uie||!i.formats[t]){Hb(),gs.key="";return}let n=2**t,r=n/2,s=360/n,o=Math.acos(1/(1+e.altitude))*180/Math.PI+s,a=Math.floor(((e.lng+180)%360+360)%360/s),l=Math.floor((90-e.lat)/s),c=Math.ceil(o/s);for(;(2*c+1)**2>x4e&&c>1;)c--;let u=new Set;for(let p=-c;p<=c;p++){let x=l+p;if(!(x<0||x>=r))for(let v=-c;v<=c;v++){let w=((a+v)%n+n)%n;u.add(`${t}/${w}/${x}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==gs.key){gs.key=f;for(let[p,x]of gs.tiles)u.has(p)||(gs.group.remove(x),Xie(x),gs.tiles.delete(p));for(let p of u){if(gs.tiles.has(p))continue;let[x,v,w]=p.split("/").map(Number),S=I4e(i,x,v,w);gs.tiles.set(p,S),gs.group.add(S)}}}function I4e(i,e,t,n){let r=360/2**e,s=-180+t*r,o=90-n*r,a=[],l=[],c=[];for(let w=0;w<=cd;w++){let S=o-w/cd*r;for(let T=0;T<=cd;T++){let P=s+T/cd*r;a.push(...$b(S,P,Xb)),l.push(T/cd,1-w/cd)}}let u=cd+1;for(let w=0;w<cd;w++)for(let S=0;S<cd;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new qn;f.setAttribute("position",new Rn(a,3)),f.setAttribute("uv",new Rn(l,2)),f.setIndex(c);let p=new Yr,x=new Gn(f,p);x.visible=!1;let v=`${U.game.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new $a().load(v,w=>{w.colorSpace=vr,p.map=w,p.needsUpdate=!0,x.visible=!0}),x}function Hb(){if(gs.group){for(let i of gs.tiles.values())gs.group.remove(i),Xie(i);gs.tiles.clear(),gs.key=""}}function Xie(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function $ie(){if($n){for(let[i,e]of ix){let t=i===U.selectedPin;e.material=Zie(i.category,t);let n=t?Gie:kie;e.scale.set(n,n,1)}$n.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function N4e(){if(!$n||!U.globeActive)return;$ie();let i=u4.get(U.selectedPin);if(i){let e=$n.pointOfView().altitude;$n.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function Yie(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridPrefix&&!Cd(i))}function Zk(){if(!(!$n||!U.globeActive))for(let[i,e]of ix)e.visible=Yie(i)}function L4e(i){let e=new MA(Zie(i.category,i===U.selectedPin)),t=i===U.selectedPin?Gie:kie;return e.scale.set(t,t,1),e.visible=Yie(i),ix.set(i,e),e}function Zie(i,e){let t=`${Wx(i)}:${e?"ringed":"plain"}`,n=Oie.get(t);if(n)return n;n=new qu({depthWrite:!1,sizeAttenuation:!1}),Oie.set(t,n);let r=U.markerIcons.get(Wx(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=J0(),l.strokeText(Oc(i.title),40,41),l.fillStyle=eA(i),l.fillText(Oc(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new $a().load(a.toDataURL("image/png"),c=>{n.map=c,n.needsUpdate=!0})};if(r){let o=new Image;o.onload=()=>s(o),o.onerror=()=>s(null),o.src=r}else s(null);return n}function Kie(){U.globeActive&&Wie()}function t9(){!$n||ye.globe.hidden||($n.width(ye.globe.clientWidth).height(ye.globe.clientHeight),c4())}function D4e(){if(!$n||!U.globeActive||!U.gridEnabled)return;let i=$n.pointOfView(),e=`${U.gridPrefix}:${Math.round(Jk(i.altitude)*2)}`;e!==Lo.fitKey&&(Lo.fitKey=e,c4())}function F4e(i){let e=[];for(let t of U.pins){let[n,r]=Og(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),u4.set(t,{lat:s,lng:o})}return e}async function O4e(i){let e=Math.min(Uie,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${U.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(B4e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function B4e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function Qie(){let i=U.variant,e=ye.overviewCanvas,t=e.getContext("2d"),n=Xl(),r=U.game.tileGrid.size,s=U.game.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++U.overviewRun,f=i.formats[l],p=Math.floor(n[0]/r*2**l),x=Math.ceil(n[2]/r*2**l),v=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=v;S<w;S++)for(let T=p;T<x;T++){if(!f||!p4(i,l,T,S))continue;let P=new Image;P.onload=()=>{U.overviewRun===u&&t.drawImage(P,T*s-n[0]*c,S*s+n[3]*c,s,s)},P.src=`${U.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}sx()}function sx(){let i=qie();if(i){let w=lf(U.map);if(!w||!U.variant)return;let S=Xl(),[T,P]=w.toWorld(i.lat,i.lng),R=ye.overviewCanvas,C=ls((T-S[0])/(S[2]-S[0]),0,1),L=ls((P+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",ye.overviewShelf.hidden=!1;let D=ye.overviewViewport.style,F=22;D.left=`${C*R.width-F/2}px`,D.top=`${L*R.height-F/2}px`,D.width=`${F}px`,D.height=`${F}px`;return}let e=U.engine?.getView();if(!e||!U.variant)return;let t=Xl(),n=e.calculateExtent(U.engine.getSize()),r=t[2]-t[0],s=t[3]-t[1],o=(e.getResolution()||0)*4,a=n[0]<=t[0]+o&&n[1]<=t[1]+o&&n[2]>=t[2]-o&&n[3]>=t[3]-o,l=a?"hidden":n.map(Math.round).join(",");if(l===U.overviewKey||(U.overviewKey=l,ye.overviewShelf.hidden=a,a))return;let c=ye.overviewCanvas,u=ls((n[0]-t[0])/r,0,1),f=ls((n[2]-t[0])/r,0,1),p=ls((t[3]-n[3])/s,0,1),x=ls((t[3]-n[1])/s,0,1),v=ye.overviewViewport.style;v.left=`${u*c.width}px`,v.top=`${p*c.height}px`,v.width=`${Math.max(8,(f-u)*c.width)}px`,v.height=`${Math.max(8,(x-p)*c.height)}px`}function d4(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,ox()),ye.overviewShelf.classList.toggle("is-docked",i),ye.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ye.overviewDock.setAttribute("aria-label",t),ye.overviewDock.title=t,e&&Lc()}function n9(i,e){let t=ye.overviewCanvas.getBoundingClientRect(),n=Xl(),r=(a,l,c)=>ls((a-l)/(c-l),0,1);if(U.globeActive){let a=lf(U.map);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);Hie(u,f,e);return}let s=U.engine?.getView();if(!s||!U.variant)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function kl(i){return new mH({updateWhileAnimating:!0,...i})}function Jie(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new _d({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new vf({wrapX:!1}),gridContext:new vf({wrapX:!1}),zoneScrim:new vf({wrapX:!1}),zones:new vf({wrapX:!1}),zoneTitles:new vf({wrapX:!1}),text:new vf({wrapX:!1}),pins:new vf({wrapX:!1}),priority:new vf({wrapX:!1})},U.layers={raster:new Q5({zIndex:0}),rasterDetail:new Q5({zIndex:1}),grid:kl({source:U.sources.grid,style:LI,renderOrder:Zl,renderBuffer:40,zIndex:5}),zoneScrim:kl({source:U.sources.zoneScrim,style:TV,zIndex:6}),zones:kl({source:U.sources.zones,style:EV,renderBuffer:32,zIndex:10}),zoneTitles:kl({source:U.sources.zoneTitles,style:MV,renderOrder:Zl,renderBuffer:160,zIndex:20}),zoneTitleDetail:kl({source:U.sources.zoneTitles,style:CV,renderOrder:Zl,renderBuffer:160,zIndex:44}),text:kl({source:U.sources.text,style:xV,renderOrder:Zl,renderBuffer:220,zIndex:30}),textDetail:kl({source:U.sources.text,style:yV,renderOrder:Zl,renderBuffer:220,zIndex:45}),zoneText:kl({source:U.sources.text,style:vV,renderOrder:Zl,renderBuffer:220,zIndex:41}),pins:kl({source:U.sources.pins,style:mV,renderOrder:Zl,renderBuffer:48,zIndex:40}),zonePins:kl({source:U.sources.pins,style:gV,renderOrder:Zl,renderBuffer:48,zIndex:42}),pinLabels:kl({source:U.sources.pins,style:_V,renderOrder:Zl,renderBuffer:180,zIndex:45}),gridContext:kl({source:U.sources.gridContext,style:LI,renderOrder:Zl,renderBuffer:40,zIndex:48}),priority:kl({source:U.sources.priority,style:bV,renderOrder:Zl,renderBuffer:220,zIndex:50})},U.engine=new Vq({target:ye.viewport,layers:Object.values(U.layers),controls:yS({attribution:!1,rotate:!1,zoom:!1}),interactions:ES({onFocusOnly:!1}),view:m4(5)}),U.engine.on("movestart",()=>{U.engine.getViewport().classList.add("is-dragging")}),U.engine.on("moveend",()=>{U.engine.getViewport().classList.remove("is-dragging"),U.overviewPointer===null&&ox()}),U.engine.on("postrender",sx),ye.viewport.addEventListener("wheel",()=>{document.activeElement!==ye.viewport&&ye.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),U.engine.on("singleclick",t=>{if(U.gridEnabled){let r=U.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("gridCell");return o&&o.role!=="leaf"&&o.role!=="scope"?o:null},{hitTolerance:1,layerFilter:s=>s===U.layers.grid||s===U.layers.gridContext});if(r){Q0(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>A4(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:A4});n&&Fx(n)}),U.engine.on("pointermove",t=>{if(t.dragging){Bg(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>A4(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:A4}),r=n&&Pu(n.category)==="text"?null:n;Bg(r||null);let s=U.gridEnabled&&U.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===U.layers.grid||o===U.layers.gridContext});U.engine.getTargetElement().style.cursor=n||s?"pointer":""}),U.engine.getViewport().addEventListener("pointerleave",()=>Bg(null))}function A4(i){return i===U.layers.pins||i===U.layers.zonePins||i===U.layers.pinLabels||i===U.layers.priority||i===U.layers.text||i===U.layers.textDetail||i===U.layers.zoneText}function m4(i,e=null){let t=U.game.tileGrid.size,n=e||[0,-t,t,0];return new pl({projection:U.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:i9(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function i9(i){let e=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function df(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||Jie(),!e&&!U.restore&&(U.restore=Cg(U.game.slug)),ye.game.value=U.game.slug,U0(ye.map,U.game.maps,"title"),ye.map.disabled=U.game.maps.length===1,ye.map.title=ye.map.disabled?"This game has one map":"Choose a map";let t=U.restore?.game===U.game.slug?U.restore:null,n=e&&U.game.maps.find(r=>r.slug===e)||t&&U.game.maps.find(r=>r.slug===t.map);await r9((n||U.game.maps[0]).slug)}async function r9(i){let e=U.game.maps.find(s=>s.slug===i)||U.game.maps[0],t=++U.mapRun;ye.loading.hidden=!1;let n;try{n=await WV(e)}catch{U.mapRun===t&&(ye.loading.hidden=!0,sA());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",J0()),ye.map.value=U.map.slug,U0(ye.variant,U.map.variants,"name"),ye.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),Bg(null),U.gridPrefix="",U.hiddenCategories.clear(),U.collapsedSections.clear(),U.collapsedSections.add("zones");for(let s of U.map.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.map.slug?U.restore:null;r&&(U.hiddenCategories=new Set(r.hidden),U.collapsedSections=new Set(r.collapsed)),d4(!!U.restore?.overviewDocked,!1),nS(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",ye.search.value="",ye.dock.hidden=!1,Fc(),zV(),BI(),kV(),s9(r?ls(r.variant,0,U.map.variants.length-1):0,!0),zie(),U.restore=null,ye.sidebar.classList.remove("is-open"),ye.mobileLegend.setAttribute("aria-expanded","false"),Tz(),U.settling=!1,Lc()}function s9(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:G4e(t,n),s=Ru(n);if(ye.variant.value=String(U.map.variants.indexOf(U.variant)),e)U.engine.setView(m4(s,Xl()));else{let w=U.engine.getView(),S=m4(s,Xl());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),U.engine.setView(S)}let o=++U.tileRun,a=0;U.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ye.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{U.tileRun===o&&(a++,U.tileStats.requested++,U.tileStats.peakPending=Math.max(U.tileStats.peakPending,a))});let S=T=>{U.tileRun===o&&(a=Math.max(0,a-1),T?U.tileStats.errors++:U.tileStats.loaded++,a===0&&U.tileStats.loaded>0&&(ye.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new wz({projection:U.projection,tileGrid:new Mx({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:i9(w),tileSize:U.game.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,P,R])=>{let C=n.formats[T];if(!(!C||P<0||R<0||!S(T,P,R)))return`${U.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${P}/${R}.${C}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>p4(n,w,S,T)),p=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Xl()),U.layers.raster.setBackground(n.background||void 0),p?.clear();let x=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&p4(n,w,S,T))),U.layers.rasterDetail.setExtent(Xl()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),x?.clear(),Yw(),U.gridEnabled&&(Cu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",Qie();let v=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(BI(),$l()),v?.center&&Number.isFinite(v.zoom)){let w=U.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),U.fitZoom=v.zoom,rA()}else e?requestAnimationFrame(z4e):(r&&U.engine.getView().animate({center:r,duration:200}),rA());Lc()}function p4(i,e,t,n){let r=i.coverage?.[e];if(!r)return!0;let s=t-r.x,o=n-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=k4e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function k4e(i,e,t){if(!t.decoded){let n=atob(t.bits),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);t.decoded=r}return t.decoded}function Ru(i){return i.maxZoom+2}function ox(){rA(),Lc()}function G4e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=U.engine?.getView()?.getCenter();if(!n)return null;let r=(n[0]-i.bounds.x)/i.bounds.width,s=(-n[1]-i.bounds.y)/i.bounds.height;return[e.bounds.x+ls(r,0,1)*e.bounds.width,-(e.bounds.y+ls(s,0,1)*e.bounds.height)]}function ere(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ye.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Xl(){let i=U.game.tileGrid.size,e=U.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function z4e(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit(Xl(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,rA()}function Yb(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:ls(t+i,U.variant.minZoom,Ru(U.variant)),duration:140})}function rA(){let i=U.engine?.getView().getZoom();if(ye.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){ye.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Kl(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}ye.visibleCount.textContent=`${Bc(U.eligibleLocations)} enabled \xB7 ${Bc(t)} in view`}function tre(){ye.game.addEventListener("change",()=>{df(ye.game.value)}),ye.map.addEventListener("change",()=>{r9(ye.map.value)}),ye.addBundles.addEventListener("click",()=>{qI()}),ye.emptyOpen.addEventListener("click",()=>{qI()}),ye.variant.addEventListener("change",()=>{s9(Number(ye.variant.value)),Kie()}),ye.globeToggle.addEventListener("click",()=>h4()),ye.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){qV(r.dataset.sectionToggle);return}if(!r.dataset.category)return;let s=Number(r.dataset.category);r.checked?U.hiddenCategories.delete(s):U.hiddenCategories.add(s),$l(),Pd()});let i=null,e=()=>{for(let s of ye.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!i)return;let r=document.elementFromPoint(i.x,i.y)?.closest(".category-row, .layer-header");r&&ye.layers.contains(r)&&r.classList.add("is-hovered")};ye.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ye.layers.addEventListener("pointerleave",()=>{i=null,e()}),ye.layers.addEventListener("scroll",e,{passive:!0}),ye.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),HV(r.dataset.onlyCategory?{category:Number(r.dataset.onlyCategory)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-section]");if(!s)return;let o=s.dataset.section;U.collapsedSections.has(o)?U.collapsedSections.delete(o):U.collapsedSections.add(o),gS()}),ye.soloChip.addEventListener("click",()=>Xx(!0)),nn("#expand-all").addEventListener("click",()=>zI(!1)),nn("#collapse-all").addEventListener("click",()=>zI(!0)),nn("#show-all").addEventListener("click",()=>Xx(!0)),nn("#hide-all").addEventListener("click",()=>Xx(!1)),ye.zoneToggle.addEventListener("change",()=>{AS(ye.zoneToggle.checked)}),ye.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&OV(Number(r.dataset.zone))}),ye.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),BV(Number(r.dataset.zone)))}),ye.search.addEventListener("input",()=>{U.search=ye.search.value.trim().toLocaleLowerCase(),$l(),U.search&&tS()}),ye.dockFold.addEventListener("click",()=>{cI(!U.dockFolded)}),ye.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&uI(s)}),ye.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&uI(s)}),nn("#close-detail").addEventListener("click",Fc),nn("#zoom-in").addEventListener("click",()=>U.globeActive?e9(1):Yb(1)),nn("#zoom-out").addEventListener("click",()=>U.globeActive?e9(-1):Yb(-1)),ye.gridBack.addEventListener("click",aI),ye.gridInput.addEventListener("input",()=>{let n=Md(),r=[...ye.gridInput.value.toLocaleLowerCase()].filter(s=>wc.includes(s)).slice(0,n).join("");ye.gridInput.value=r,Q0(r)}),ye.subgridToggle.addEventListener("click",()=>{Dx(!U.subgridVisible),ye.viewport.focus({preventScroll:!0})}),ye.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Dx(!U.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ye.globeToggle.hidden||h4();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ye.viewport.focus({preventScroll:!0}))}),ye.viewport.addEventListener("keydown",n=>{if(!eS(n.target)){if(n.key==="+"||n.key==="=")Yb(1);else if(n.key==="-")Yb(-1);else if(n.key==="Escape")Fc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{eS(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!eS(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ye.globeToggle.hidden||(n.preventDefault(),h4());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ye.search.focus(),ye.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ye.dock.hidden||cI(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),ere();return}Hz(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||mS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&mS(!1)}),window.addEventListener("blur",()=>mS(!1)),window.addEventListener("hashchange",()=>{let n=Rg();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,df(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),sx(),t9()}),document.addEventListener("atlas:globe-camera",()=>sx()),ye.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ye.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,n9(n,!0))}),ye.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),n9(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,ox())};ye.overview.addEventListener("pointerup",t),ye.overview.addEventListener("pointercancel",t),ye.overviewDock.addEventListener("click",()=>{d4(!U.overviewDocked),ye.viewport.focus({preventScroll:!0})}),ye.mobileLegend.addEventListener("click",()=>{let n=ye.sidebar.classList.toggle("is-open");ye.mobileLegend.setAttribute("aria-expanded",String(n))})}function nre(){let i=()=>({game:U.game?.title,map:U.map?.title,variant:U.variant?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.variant?.maxZoom,maxZoom:U.variant?Ru(U.variant):null,interpolate:U.variant?.interpolate,tileStats:{...U.tileStats},pins:U.pins.length,eligibleLocations:U.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:U.labelsHeld,hoveredPin:U.hoveredPin?.location.title||null,selectedPin:U.selectedPin?.location.title||null,fitZoom:U.fitZoom,filters:{hiddenCategories:[...U.hiddenCategories].sort(),collapsedSections:[...U.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!ye.detail.hidden,detailTitle:ye.detail.hidden?null:ye.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!ye.searchResults.hidden,soloChip:ye.soloChip.hidden?null:ye.soloChip.textContent,visibleCountText:ye.visibleCount.textContent,overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed,subgridVisible:U.subgridVisible},zones:{visible:U.zonesVisible,count:U.zoneRecords.size,focused:U.zoneRecords.get(U.focusedZoneID)?.zone.title||null,highlighted:[...U.highlightedZones].map(e=>U.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:U.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:U.gridEnabled,prefix:U.gridPrefix,maximumDepth:Md(),extent:U.gridEnabled?Ig():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridPrefix?U.pins.filter(e=>!e.filteredHidden&&Cd(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:sA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>U.engine?.renderSync()}async function ire(){tre();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(U.catalog=await i.json(),U0(ye.game,U.catalog.games,"title"),VI(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{sA()}),U.catalog.games.length){let e=Rg(),t=Cg(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await df(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else ye.loading.hidden=!0;nre(),requestAnimationFrame(()=>ye.viewport.focus({preventScroll:!0}))}catch(i){ye.loading.hidden=!0,ye.fatalMessage.textContent=i instanceof Error?i.message:String(i),ye.fatal.hidden=!1}}ire();})();
M frontend/src/globe.js +3 -1
M frontend/src/styles.js +4 -4