@cloudparse/up-miniapps-sdk 0.1.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,880 @@
1
- "use strict";var MiniAppSDK=(()=>{var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var h=(n,e)=>{for(var t in e)c(n,t,{get:e[t],enumerable:!0})},I=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!T.call(n,r)&&r!==t&&c(n,r,{get:()=>e[r],enumerable:!(i=m(e,r))||i.enumerable});return n};var E=n=>I(c({},"__esModule",{value:!0}),n);var O={};h(O,{MiniAppSDK:()=>d,UIEvent:()=>b,default:()=>w,sdk:()=>l});var a=class{callbacks=new Map;eventListeners=new Map;constructor(){if(typeof window<"u"){let e=Object.freeze({onNativeMessage:t=>this.handleNativeMessage(t)});Object.defineProperty(window,"__MiniAppBridge",{configurable:!1,value:e,writable:!1}),window.addEventListener("message",t=>{if(t.data)try{let i=typeof t.data=="string"?JSON.parse(t.data):t.data;i&&typeof i=="object"&&(i.callbackId||i.event)&&this.handleNativeMessage(i)}catch{}})}}on(e,t){let i=this.eventListeners.get(e);return i||(i=[],this.eventListeners.set(e,i)),i.push(t),()=>this.off(e,t)}off(e,t){let i=this.eventListeners.get(e);i&&this.eventListeners.set(e,i.filter(r=>r!==t))}send(e,t,i=3e4){return new Promise((r,o)=>{let s=`${e}_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,u=setTimeout(()=>{this.callbacks.has(s)&&(this.callbacks.delete(s),o(new Error(`Bridge request timeout: ${e}`)))},i);this.callbacks.set(s,{reject:o,resolve:r,timeout:u});let f={callbackId:s,payload:t,type:e},g=window;g.ReactNativeWebView?.postMessage?g.ReactNativeWebView.postMessage(JSON.stringify(f)):(clearTimeout(u),this.callbacks.delete(s),o(new Error("Bridge not available")))})}handleNativeMessage(e){if(!e||typeof e!="object")return;let t=e.callbackId;if(t&&typeof t=="string"){let r=this.callbacks.get(t);if(r){clearTimeout(r.timeout);let{resolve:o,reject:s}=r;e.success===!1||e.error?s(e.error||"Unknown error"):o(e.value??e.payload??e),this.callbacks.delete(t);return}}let i=e.event;if(i&&typeof i=="string"){let r=this.eventListeners.get(i);if(r)for(let o of r)try{o(e.payload||e.value)}catch(s){console.error(`Error in event listener for ${i}:`,s)}}}};function p(n){let e=Object.getOwnPropertyNames(n);for(let t of e){let i=n[t];i&&typeof i=="object"&&!Object.isFrozen(i)&&!(i instanceof a)&&p(i)}return Object.freeze(n)}var d=class{bridge;storage=Object.freeze({get:e=>this.bridge.send("STORAGE_GET",{key:e}),getAll:()=>this.bridge.send("STORAGE_GET_ALL"),set:(e,t)=>this.bridge.send("STORAGE_SET",{key:e,value:t})});secureStore=Object.freeze({get:e=>this.bridge.send("SECURE_GET",{key:e}),set:(e,t)=>this.bridge.send("SECURE_SET",{key:e,value:t})});database=Object.freeze({getUserData:()=>this.bridge.send("DATABASE_GET_USER_DATA"),setUserData:e=>this.bridge.send("DATABASE_SET_USER_DATA",{data:e})});location=Object.freeze({getCurrentPosition:()=>this.bridge.send("GET_LOCATION")});user=Object.freeze({getProfile:e=>this.bridge.send("GET_USER_PROFILE",{fields:e})});permission=Object.freeze({request:((e,t)=>this.bridge.send("REQUEST_PERMISSION",{fields:t,type:e}))});payment=Object.freeze({request:e=>this.bridge.send("PAYMENT_REQUEST",e)});activity=Object.freeze({start:(e,t,i)=>this.bridge.send("START_ACTIVITY",{id:e,status:i,title:t})});haptic=Object.freeze({trigger:e=>this.bridge.send("TRIGGER_HAPTIC",{style:e})});network=Object.freeze({request:e=>this.bridge.send("NETWORK_REQUEST",e)});fidelity=Object.freeze({getFidelityBalance:()=>this.bridge.send("GET_FIDELITY_BALANCE"),getFidelityHistory:e=>this.bridge.send("GET_FIDELITY_HISTORY",e),spendFPoints:e=>this.bridge.send("SPEND_FPOINTS",{intentUuid:e})});ui=Object.freeze({exit:()=>this.bridge.send("EXIT"),setScrollConfig:e=>this.bridge.send("SET_SCROLL_CONFIG",e)});debug=Object.freeze({log:(...e)=>this.bridge.send("DEBUG_LOG",{message:e})});constructor(){this.bridge=new a,this.initialize=this.initialize.bind(this),this.on=this.on.bind(this),this.off=this.off.bind(this)}initialize(e){return this.bridge.send("INITIALIZE",e)}on(e,t){return this.bridge.on(e,t)}off(e,t){this.bridge.off(e,t)}},l=p(new d);var b=(t=>(t.TOP_SCROLL_MORE="TOP_SCROLL_MORE",t.BOTTOM_SCROLL_MORE="BOTTOM_SCROLL_MORE",t))(b||{});var w=l;return E(O);})();
1
+ "use strict";var MiniAppSDK=(()=>{var OE=Object.create;var p0=Object.defineProperty;var BE=Object.getOwnPropertyDescriptor;var FE=Object.getOwnPropertyNames;var NE=Object.getPrototypeOf,UE=Object.prototype.hasOwnProperty;var Ha=(i,a)=>()=>(a||i((a={exports:{}}).exports,a),a.exports),VE=(i,a)=>{for(var u in a)p0(i,u,{get:a[u],enumerable:!0})},bw=(i,a,u,f)=>{if(a&&typeof a=="object"||typeof a=="function")for(let y of FE(a))!UE.call(i,y)&&y!==u&&p0(i,y,{get:()=>a[y],enumerable:!(f=BE(a,y))||f.enumerable});return i};var tt=(i,a,u)=>(u=i!=null?OE(NE(i)):{},bw(a||!i||!i.__esModule?p0(u,"default",{value:i,enumerable:!0}):u,i)),jE=i=>bw(p0({},"__esModule",{value:!0}),i);var Pw=Ha(yt=>{"use strict";var Z_=Symbol.for("react.transitional.element"),qE=Symbol.for("react.portal"),GE=Symbol.for("react.fragment"),ZE=Symbol.for("react.strict_mode"),HE=Symbol.for("react.profiler"),$E=Symbol.for("react.consumer"),XE=Symbol.for("react.context"),YE=Symbol.for("react.forward_ref"),WE=Symbol.for("react.suspense"),KE=Symbol.for("react.memo"),Mw=Symbol.for("react.lazy"),QE=Symbol.for("react.activity"),xw=Symbol.iterator;function JE(i){return i===null||typeof i!="object"?null:(i=xw&&i[xw]||i["@@iterator"],typeof i=="function"?i:null)}var Ew={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Cw=Object.assign,Aw={};function hh(i,a,u){this.props=i,this.context=a,this.refs=Aw,this.updater=u||Ew}hh.prototype.isReactComponent={};hh.prototype.setState=function(i,a){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,a,"setState")};hh.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function zw(){}zw.prototype=hh.prototype;function H_(i,a,u){this.props=i,this.context=a,this.refs=Aw,this.updater=u||Ew}var $_=H_.prototype=new zw;$_.constructor=H_;Cw($_,hh.prototype);$_.isPureReactComponent=!0;var ww=Array.isArray;function G_(){}var zi={H:null,A:null,T:null,S:null},Dw=Object.prototype.hasOwnProperty;function X_(i,a,u){var f=u.ref;return{$$typeof:Z_,type:i,key:a,ref:f!==void 0?f:null,props:u}}function eC(i,a){return X_(i.type,a,i.props)}function Y_(i){return typeof i=="object"&&i!==null&&i.$$typeof===Z_}function tC(i){var a={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(u){return a[u]})}var Tw=/\/+/g;function q_(i,a){return typeof i=="object"&&i!==null&&i.key!=null?tC(""+i.key):a.toString(36)}function iC(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(G_,G_):(i.status="pending",i.then(function(a){i.status==="pending"&&(i.status="fulfilled",i.value=a)},function(a){i.status==="pending"&&(i.status="rejected",i.reason=a)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function uh(i,a,u,f,y){var l=typeof i;(l==="undefined"||l==="boolean")&&(i=null);var D=!1;if(i===null)D=!0;else switch(l){case"bigint":case"string":case"number":D=!0;break;case"object":switch(i.$$typeof){case Z_:case qE:D=!0;break;case Mw:return D=i._init,uh(D(i._payload),a,u,f,y)}}if(D)return y=y(i),D=f===""?"."+q_(i,0):f,ww(y)?(u="",D!=null&&(u=D.replace(Tw,"$&/")+"/"),uh(y,a,u,"",function(K){return K})):y!=null&&(Y_(y)&&(y=eC(y,u+(y.key==null||i&&i.key===y.key?"":(""+y.key).replace(Tw,"$&/")+"/")+D)),a.push(y)),1;D=0;var B=f===""?".":f+":";if(ww(i))for(var q=0;q<i.length;q++)f=i[q],l=B+q_(f,q),D+=uh(f,a,u,l,y);else if(q=JE(i),typeof q=="function")for(i=q.call(i),q=0;!(f=i.next()).done;)f=f.value,l=B+q_(f,q++),D+=uh(f,a,u,l,y);else if(l==="object"){if(typeof i.then=="function")return uh(iC(i),a,u,f,y);throw a=String(i),Error("Objects are not valid as a React child (found: "+(a==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":a)+"). If you meant to render a collection of children, use an array instead.")}return D}function f0(i,a,u){if(i==null)return i;var f=[],y=0;return uh(i,f,"","",function(l){return a.call(u,l,y++)}),f}function nC(i){if(i._status===-1){var a=i._result;a=a(),a.then(function(u){(i._status===0||i._status===-1)&&(i._status=1,i._result=u)},function(u){(i._status===0||i._status===-1)&&(i._status=2,i._result=u)}),i._status===-1&&(i._status=0,i._result=a)}if(i._status===1)return i._result.default;throw i._result}var Sw=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},rC={map:f0,forEach:function(i,a,u){f0(i,function(){a.apply(this,arguments)},u)},count:function(i){var a=0;return f0(i,function(){a++}),a},toArray:function(i){return f0(i,function(a){return a})||[]},only:function(i){if(!Y_(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};yt.Activity=QE;yt.Children=rC;yt.Component=hh;yt.Fragment=GE;yt.Profiler=HE;yt.PureComponent=H_;yt.StrictMode=ZE;yt.Suspense=WE;yt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=zi;yt.__COMPILER_RUNTIME={__proto__:null,c:function(i){return zi.H.useMemoCache(i)}};yt.cache=function(i){return function(){return i.apply(null,arguments)}};yt.cacheSignal=function(){return null};yt.cloneElement=function(i,a,u){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var f=Cw({},i.props),y=i.key;if(a!=null)for(l in a.key!==void 0&&(y=""+a.key),a)!Dw.call(a,l)||l==="key"||l==="__self"||l==="__source"||l==="ref"&&a.ref===void 0||(f[l]=a[l]);var l=arguments.length-2;if(l===1)f.children=u;else if(1<l){for(var D=Array(l),B=0;B<l;B++)D[B]=arguments[B+2];f.children=D}return X_(i.type,y,f)};yt.createContext=function(i){return i={$$typeof:XE,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:$E,_context:i},i};yt.createElement=function(i,a,u){var f,y={},l=null;if(a!=null)for(f in a.key!==void 0&&(l=""+a.key),a)Dw.call(a,f)&&f!=="key"&&f!=="__self"&&f!=="__source"&&(y[f]=a[f]);var D=arguments.length-2;if(D===1)y.children=u;else if(1<D){for(var B=Array(D),q=0;q<D;q++)B[q]=arguments[q+2];y.children=B}if(i&&i.defaultProps)for(f in D=i.defaultProps,D)y[f]===void 0&&(y[f]=D[f]);return X_(i,l,y)};yt.createRef=function(){return{current:null}};yt.forwardRef=function(i){return{$$typeof:YE,render:i}};yt.isValidElement=Y_;yt.lazy=function(i){return{$$typeof:Mw,_payload:{_status:-1,_result:i},_init:nC}};yt.memo=function(i,a){return{$$typeof:KE,type:i,compare:a===void 0?null:a}};yt.startTransition=function(i){var a=zi.T,u={};zi.T=u;try{var f=i(),y=zi.S;y!==null&&y(u,f),typeof f=="object"&&f!==null&&typeof f.then=="function"&&f.then(G_,Sw)}catch(l){Sw(l)}finally{a!==null&&u.types!==null&&(a.types=u.types),zi.T=a}};yt.unstable_useCacheRefresh=function(){return zi.H.useCacheRefresh()};yt.use=function(i){return zi.H.use(i)};yt.useActionState=function(i,a,u){return zi.H.useActionState(i,a,u)};yt.useCallback=function(i,a){return zi.H.useCallback(i,a)};yt.useContext=function(i){return zi.H.useContext(i)};yt.useDebugValue=function(){};yt.useDeferredValue=function(i,a){return zi.H.useDeferredValue(i,a)};yt.useEffect=function(i,a){return zi.H.useEffect(i,a)};yt.useEffectEvent=function(i){return zi.H.useEffectEvent(i)};yt.useId=function(){return zi.H.useId()};yt.useImperativeHandle=function(i,a,u){return zi.H.useImperativeHandle(i,a,u)};yt.useInsertionEffect=function(i,a){return zi.H.useInsertionEffect(i,a)};yt.useLayoutEffect=function(i,a){return zi.H.useLayoutEffect(i,a)};yt.useMemo=function(i,a){return zi.H.useMemo(i,a)};yt.useOptimistic=function(i,a){return zi.H.useOptimistic(i,a)};yt.useReducer=function(i,a,u){return zi.H.useReducer(i,a,u)};yt.useRef=function(i){return zi.H.useRef(i)};yt.useState=function(i){return zi.H.useState(i)};yt.useSyncExternalStore=function(i,a,u){return zi.H.useSyncExternalStore(i,a,u)};yt.useTransition=function(){return zi.H.useTransition()};yt.version="19.2.7"});var Rt=Ha((Az,Rw)=>{"use strict";Rw.exports=Pw()});var kw=Ha(m0=>{"use strict";var aC=Symbol.for("react.transitional.element"),oC=Symbol.for("react.fragment");function Iw(i,a,u){var f=null;if(u!==void 0&&(f=""+u),a.key!==void 0&&(f=""+a.key),"key"in a){u={};for(var y in a)y!=="key"&&(u[y]=a[y])}else u=a;return a=u.ref,{$$typeof:aC,type:i,key:f,ref:a!==void 0?a:null,props:u}}m0.Fragment=oC;m0.jsx=Iw;m0.jsxs=Iw});var ni=Ha((Dz,Lw)=>{"use strict";Lw.exports=kw()});var Qw=Ha((cy,uy)=>{"use strict";(function(i,a){typeof cy=="object"&&typeof uy<"u"?uy.exports=a():typeof define=="function"&&define.amd?define(a):(i=typeof globalThis<"u"?globalThis:i||self,i.maplibregl=a())})(cy,(function(){"use strict";var i={},a={};function u(y,l,D){if(a[y]=D,y==="index"){var B="var sharedModule = {}; ("+a.shared+")(sharedModule); ("+a.worker+")(sharedModule);",q={};return a.shared(q),a.index(i,q),typeof window<"u"&&i.setWorkerUrl(window.URL.createObjectURL(new Blob([B],{type:"text/javascript"}))),i}}u("shared",["exports"],(function(y){"use strict";function l(r,e,n,s){return new(n||(n=Promise))((function(c,d){function m(b){try{x(s.next(b))}catch(S){d(S)}}function _(b){try{x(s.throw(b))}catch(S){d(S)}}function x(b){var S;b.done?c(b.value):(S=b.value,S instanceof n?S:new n((function(w){w(S)}))).then(m,_)}x((s=s.apply(r,e||[])).next())}))}function D(r,e){this.x=r,this.y=e}function B(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var q,K;typeof SuppressedError=="function"&&SuppressedError,D.prototype={clone(){return new D(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){let e=r.x-this.x,n=r.y-this.y;return e*e+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){let e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){let r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){let e=Math.cos(r),n=Math.sin(r),s=n*this.x+e*this.y;return this.x=e*this.x-n*this.y,this.y=s,this},_rotateAround(r,e){let n=Math.cos(r),s=Math.sin(r),c=e.y+s*(this.x-e.x)+n*(this.y-e.y);return this.x=e.x+n*(this.x-e.x)-s*(this.y-e.y),this.y=c,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:D},D.convert=function(r){if(r instanceof D)return r;if(Array.isArray(r))return new D(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new D(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var fe=(function(){if(K)return q;function r(e,n,s,c){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=n,this.p2x=s,this.p2y=c}return K=1,q=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,n){if(n===void 0&&(n=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,c=0;c<8;c++){var d=this.sampleCurveX(s)-e;if(Math.abs(d)<n)return s;var m=this.sampleCurveDerivativeX(s);if(Math.abs(m)<1e-6)break;s-=d/m}var _=0,x=1;for(s=e,c=0;c<20&&(d=this.sampleCurveX(s),!(Math.abs(d-e)<n));c++)e>d?_=s:x=s,s=.5*(x-_)+_;return s},solve:function(e,n){return this.sampleCurveY(this.solveCurveX(e,n))}},q})(),pe=B(fe);let oe,le;function Oe(){return oe!=null||(oe=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),oe}function Ue(){if(le==null&&(le=!1,Oe())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<25;s++){let c=4*s;e.fillStyle=`rgb(${c},${c+1},${c+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}let n=e.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&n[s]!==s){le=!0;break}}}return le||!1}var ye=1e-6,ce=typeof Float32Array<"u"?Float32Array:Array;function se(){var r=new ce(9);return ce!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function de(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function ve(){var r=new ce(3);return ce!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Le(r){var e=r[0],n=r[1],s=r[2];return Math.sqrt(e*e+n*n+s*s)}function Re(r,e,n){var s=new ce(3);return s[0]=r,s[1]=e,s[2]=n,s}function Z(r,e,n){return r[0]=e[0]+n[0],r[1]=e[1]+n[1],r[2]=e[2]+n[2],r}function Y(r,e,n){return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r}function ne(r,e,n){var s=e[0],c=e[1],d=e[2],m=n[0],_=n[1],x=n[2];return r[0]=c*x-d*_,r[1]=d*m-s*x,r[2]=s*_-c*m,r}var xe,De=Le;function nt(r,e,n){var s=e[0],c=e[1],d=e[2],m=e[3];return r[0]=n[0]*s+n[4]*c+n[8]*d+n[12]*m,r[1]=n[1]*s+n[5]*c+n[9]*d+n[13]*m,r[2]=n[2]*s+n[6]*c+n[10]*d+n[14]*m,r[3]=n[3]*s+n[7]*c+n[11]*d+n[15]*m,r}function ze(){var r=new ce(4);return ce!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Be(r,e,n,s){var c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",d=Math.PI/360;e*=d,s*=d,n*=d;var m=Math.sin(e),_=Math.cos(e),x=Math.sin(n),b=Math.cos(n),S=Math.sin(s),w=Math.cos(s);switch(c){case"xyz":r[0]=m*b*w+_*x*S,r[1]=_*x*w-m*b*S,r[2]=_*b*S+m*x*w,r[3]=_*b*w-m*x*S;break;case"xzy":r[0]=m*b*w-_*x*S,r[1]=_*x*w-m*b*S,r[2]=_*b*S+m*x*w,r[3]=_*b*w+m*x*S;break;case"yxz":r[0]=m*b*w+_*x*S,r[1]=_*x*w-m*b*S,r[2]=_*b*S-m*x*w,r[3]=_*b*w+m*x*S;break;case"yzx":r[0]=m*b*w+_*x*S,r[1]=_*x*w+m*b*S,r[2]=_*b*S-m*x*w,r[3]=_*b*w-m*x*S;break;case"zxy":r[0]=m*b*w-_*x*S,r[1]=_*x*w+m*b*S,r[2]=_*b*S+m*x*w,r[3]=_*b*w-m*x*S;break;case"zyx":r[0]=m*b*w-_*x*S,r[1]=_*x*w+m*b*S,r[2]=_*b*S-m*x*w,r[3]=_*b*w+m*x*S;break;default:throw new Error("Unknown angle order "+c)}return r}function He(){var r=new ce(2);return ce!=Float32Array&&(r[0]=0,r[1]=0),r}function We(r,e){var n=new ce(2);return n[0]=r,n[1]=e,n}ve(),xe=new ce(4),ce!=Float32Array&&(xe[0]=0,xe[1]=0,xe[2]=0,xe[3]=0),ve(),Re(1,0,0),Re(0,1,0),ze(),ze(),se(),He();let Ke=8192;function _t(r,e,n){return e*(Ke/(r.tileSize*Math.pow(2,n-r.tileID.overscaledZ)))}function lt(r){return r instanceof Error?r:new Error(typeof r=="string"?r:String(r))}function jt(r,e){return(r%e+e)%e}function Kt(r,e,n){return r*(1-n)+e*n}function Qt(r){if(r<=0)return 0;if(r>=1)return 1;let e=r*r,n=e*r;return 4*(r<.5?n:3*(r-e)+n-.75)}function Gn(r,e,n,s){let c=new pe(r,e,n,s);return d=>c.solve(d)}let ot=Gn(.25,.1,.25,1);function qt(r,e,n){return Math.min(n,Math.max(e,r))}function vn(r,e,n){let s=n-e,c=((r-e)%s+s)%s+e;return c===e?n:c}function pi(r,...e){for(let n of e)for(let s in n)r[s]=n[s];return r}let sn=1;function li(r,e,n){let s={};for(let c in r)s[c]=e.call(this,r[c],c,r);return s}function Ii(r,e,n){let s={};for(let c in r)e.call(this,r[c],c,r)&&(s[c]=r[c]);return s}function Xe(r){return Array.isArray(r)?r.map(Xe):typeof r=="object"&&r?li(r,Xe):r}let ft={};function Gt(r){ft[r]||(typeof console<"u"&&console.warn(r),ft[r]=!0)}function ci(r,e,n){return(n.y-r.y)*(e.x-r.x)>(e.y-r.y)*(n.x-r.x)}function zt(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Nt=null;function ki(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}let Zn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Hn(r,e,n,s,c){return l(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let d=new VideoFrame(r,{timestamp:0});try{let m=d?.format;if(!m||!m.startsWith("BGR")&&!m.startsWith("RGB"))throw new Error(`Unrecognized format ${m}`);let _=m.startsWith("BGR"),x=new Uint8ClampedArray(s*c*4);if(yield d.copyTo(x,(function(b,S,w,A,E){let R=4*Math.max(-S,0),I=(Math.max(0,w)-w)*A*4+R,O=4*A,F=Math.max(0,S),V=Math.max(0,w);return{rect:{x:F,y:V,width:Math.min(b.width,S+A)-F,height:Math.min(b.height,w+E)-V},layout:[{offset:I,stride:O}]}})(r,e,n,s,c)),_)for(let b=0;b<x.length;b+=4){let S=x[b];x[b]=x[b+2],x[b+2]=S}return x}finally{d.close()}}))}let Si,Ki;function xt(r,e,n,s){return r.addEventListener(e,n,s),{unsubscribe:()=>{r.removeEventListener(e,n,s)}}}function _i(r){return r*Math.PI/180}function Dn(r){return r/Math.PI*180}let Qa={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},ha={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},As="AbortError";class zo extends Error{constructor(e=As){super(e instanceof Error?e.message:e),this.name=As,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function $c(r){return r instanceof Error&&r.name===As}function Do(r){if(r.aborted)throw new zo(r.reason)}let Gr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Zr(r){return Gr.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}let bn="global-dispatcher";class Ut extends Error{constructor(e,n,s,c){super(`AJAXError: ${n} (${e}): ${s}`),this.status=e,this.statusText=n,this.url=s,this.body=c}}let Gi=()=>{var r;return zt(self)?(r=self.worker)===null||r===void 0?void 0:r.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href},xn=function(r,e){return l(this,void 0,void 0,(function*(){var n,s;if(r.url.includes("://")&&!/^https?:|^file:/.test(r.url)){let c=Zr(r.url);if(c){let d=yield c(r,e);return d.data||r.type!=="arrayBuffer"?d:pi(d,{data:new ArrayBuffer(0)})}if(zt(self)&&(!((n=self.worker)===null||n===void 0)&&n.actor))return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:bn},e)}if(!(c=>{var d;return c.startsWith("file:")||((d=Gi())===null||d===void 0?void 0:d.startsWith("file:"))&&!/^\w+:/.test(c)})(r.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return(function(c,d){return l(this,void 0,void 0,(function*(){let m=new Request(c.url,{method:c.method||"GET",body:c.body,credentials:c.credentials,headers:c.headers,cache:c.cache,referrer:Gi(),referrerPolicy:c.referrerPolicy,signal:d.signal}),_,x;c.type!=="json"||m.headers.has("Accept")||m.headers.set("Accept","application/json");try{_=yield fetch(m)}catch(S){throw $c(S)?S:new Ut(0,lt(S).message,c.url,new Blob)}if(!_.ok){let S=yield _.blob();throw new Ut(_.status,_.statusText,c.url,S)}x=c.type==="arrayBuffer"||c.type==="image"?_.arrayBuffer():c.type==="json"?_.json():_.text();let b=yield x;return Do(d.signal),{data:b,cacheControl:_.headers.get("Cache-Control"),expires:_.headers.get("Expires"),etag:_.headers.get("ETag")}}))})(r,e);if(zt(self)&&(!((s=self.worker)===null||s===void 0)&&s.actor))return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:bn},e)}return(function(c,d){return new Promise(((m,_)=>{var x;let b=new XMLHttpRequest;b.open(c.method||"GET",c.url,!0),c.type!=="arrayBuffer"&&c.type!=="image"||(b.responseType="arraybuffer");for(let S in c.headers)b.setRequestHeader(S,c.headers[S]);c.type==="json"&&(b.responseType="text",!((x=c.headers)===null||x===void 0)&&x.Accept||b.setRequestHeader("Accept","application/json")),b.withCredentials=c.credentials==="include",b.onerror=()=>{_(new Error(b.statusText))},b.onload=()=>{if(!d.signal.aborted)if((b.status>=200&&b.status<300||b.status===0)&&b.response!==null){let S=b.response;if(c.type==="json")try{S=JSON.parse(b.response)}catch(w){return void _(w)}m({data:S,cacheControl:b.getResponseHeader("Cache-Control"),expires:b.getResponseHeader("Expires"),etag:b.getResponseHeader("ETag")})}else{let S=new Blob([b.response],{type:b.getResponseHeader("Content-Type")});_(new Ut(b.status,b.statusText,c.url,S))}},d.signal.addEventListener("abort",(()=>{b.abort(),_(new zo(d.signal.reason))})),b.send(c.body)}))})(r,e)}))};function Dt(r){if(!r||r.indexOf("://")<=0||r.startsWith("data:image/")||r.startsWith("blob:"))return!0;let e=new URL(r),n=window.location;return e.protocol===n.protocol&&e.host===n.host}function Ui(r,e,n){var s;!((s=n[r])===null||s===void 0)&&s.includes(e)||(n[r]||(n[r]=[]),n[r].push(e))}function da(r,e,n){if(n?.[r]){let s=n[r].indexOf(e);s!==-1&&n[r].splice(s,1)}}class Ja{constructor(e,n={}){pi(this,n),this.type=e}}class eo extends Ja{constructor(e,n={}){super("error",pi({error:e},n))}}class Po{on(e,n){return this._listeners||(this._listeners={}),Ui(e,n,this._listeners),{unsubscribe:()=>{this.off(e,n)}}}off(e,n){return da(e,n,this._listeners),da(e,n,this._oneTimeListeners),this}once(e,n){return n?(this._oneTimeListeners||(this._oneTimeListeners={}),Ui(e,n,this._oneTimeListeners),this):new Promise((s=>this.once(e,s)))}fire(e,n){var s,c;typeof e=="string"&&(e=new Ja(e,n||{}));let d=e.type;if(this.listens(d)){e.target=this;let m=!((s=this._listeners)===null||s===void 0)&&s[d]?this._listeners[d].slice():[];for(let b of m)b.call(this,e);let _=!((c=this._oneTimeListeners)===null||c===void 0)&&c[d]?this._oneTimeListeners[d].slice():[];for(let b of _)da(d,b,this._oneTimeListeners),b.call(this,e);let x=this._eventedParent;x&&(pi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(e))}else e instanceof eo&&console.error(e.error);return this}listens(e){var n,s,c,d,m;return((s=(n=this._listeners)===null||n===void 0?void 0:n[e])===null||s===void 0?void 0:s.length)>0||((d=(c=this._oneTimeListeners)===null||c===void 0?void 0:c[e])===null||d===void 0?void 0:d.length)>0||((m=this._eventedParent)===null||m===void 0?void 0:m.listens(e))}setEventedParent(e,n){return this._eventedParent=e,this._eventedParentData=n,this}}var Ce={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};let sd=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ld(r,e){let n={};for(let s in r)s!=="ref"&&(n[s]=r[s]);return sd.forEach((s=>{s in e&&(n[s]=e[s])})),n}function Vt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(!Vt(r[n],e[n]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let n in r)if(!Vt(r[n],e[n]))return!1;return!0}return r===e}function sr(r,e){r.push(e)}function Ro(r,e,n){sr(n,{command:"addSource",args:[r,e[r]]})}function Ff(r,e,n){sr(e,{command:"removeSource",args:[r]}),n[r]=!0}function Nf(r,e,n,s){Ff(r,n,s),Ro(r,e,n)}function s1(r,e,n){let s;for(s in r[n])if(Object.prototype.hasOwnProperty.call(r[n],s)&&s!=="data"&&!Vt(r[n][s],e[n][s]))return!1;for(s in e[n])if(Object.prototype.hasOwnProperty.call(e[n],s)&&s!=="data"&&!Vt(r[n][s],e[n][s]))return!1;return!0}function Xc(r,e,n,s,c,d){r=r||{},e=e||{};for(let m in r)Object.prototype.hasOwnProperty.call(r,m)&&(Vt(r[m],e[m])||n.push({command:d,args:[s,m,e[m],c]}));for(let m in e)Object.prototype.hasOwnProperty.call(e,m)&&!Object.prototype.hasOwnProperty.call(r,m)&&(Vt(r[m],e[m])||n.push({command:d,args:[s,m,e[m],c]}))}function cd(r){return r.id}function Uf(r,e){return r[e.id]=e,r}class Ve{constructor(e,n,s,c){this.message=(e?`${e}: `:"")+s,c&&(this.identifier=c),n!=null&&n.__line__&&(this.line=n.__line__)}}function Io(r,...e){for(let n of e)for(let s in n)r[s]=n[s];return r}class wn extends Error{constructor(e,n){super(n),this.message=n,this.key=e}}class ud{constructor(e,n=[]){this.parent=e,this.bindings={};for(let[s,c]of n)this.bindings[s]=c}concat(e){return new ud(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let to={kind:"null"},Ze={kind:"number"},ct={kind:"string"},mt={kind:"boolean"},mr={kind:"color"},Yc={kind:"projectionDefinition"},Ra={kind:"object"},ht={kind:"value"},Ol={kind:"collator"},Bl={kind:"formatted"},Wc={kind:"padding"},zs={kind:"colorArray"},Fl={kind:"numberArray"},Ds={kind:"resolvedImage"},Nl={kind:"variableAnchorOffsetCollection"};function Tn(r,e){return{kind:"array",itemType:r,N:e}}function Zt(r){if(r.kind==="array"){let e=Zt(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}let Kc=[to,Ze,ct,mt,mr,Yc,Bl,Ra,Tn(ht),Wc,Fl,zs,Ds,Nl];function Ps(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Ps(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(let n of Kc)if(!Ps(n,e))return null}}return`Expected ${Zt(r)} but found ${Zt(e)} instead.`}function Ul(r,e){return e.some((n=>n.kind===r.kind))}function ko(r,e){return e.some((n=>n==="null"?r===null:n==="array"?Array.isArray(r):n==="object"?r&&!Array.isArray(r)&&typeof r=="object":n===typeof r))}function Hr(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}let Vf=.96422,Lo=.82521,Qc=4/29,Mi=6/29,jf=3*Mi*Mi,qf=Mi*Mi*Mi,Vl=Math.PI/180,Gf=180/Math.PI;function Zf(r){return(r%=360)<0&&(r+=360),r}function Hf([r,e,n,s]){let c,d,m=hd((.2225045*(r=Jc(r))+.7168786*(e=Jc(e))+.0606169*(n=Jc(n)))/1);r===e&&e===n?c=d=m:(c=hd((.4360747*r+.3850649*e+.1430804*n)/Vf),d=hd((.0139322*r+.0971045*e+.7141733*n)/Lo));let _=116*m-16;return[_<0?0:_,500*(c-m),200*(m-d),s]}function Jc(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function hd(r){return r>qf?Math.pow(r,1/3):r/jf+Qc}function dd([r,e,n,s]){let c=(r+16)/116,d=isNaN(e)?c:c+e/500,m=isNaN(n)?c:c-n/200;return c=1*fd(c),d=Vf*fd(d),m=Lo*fd(m),[pd(3.1338561*d-1.6168667*c-.4906146*m),pd(-.9787684*d+1.9161415*c+.033454*m),pd(.0719453*d-.2289914*c+1.4052427*m),s]}function pd(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function fd(r){return r>Mi?r*r*r:jf*(r-Qc)}let l1=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function jl(r,e){return l1(r,e)?r[e]:void 0}function eu(r){return parseInt(r.padEnd(2,r),16)/255}function $f(r,e){return Rs(e?r/100:r,0,1)}function Rs(r,e,n){return Math.min(Math.max(e,r),n)}function md(r){return!r.some(Number.isNaN)}let ql={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function io(r,e,n){return r+n*(e-r)}function Is(r,e,n){return r.map(((s,c)=>io(s,e[c],n)))}class pt{constructor(e,n,s,c=1,d=!0){this.r=e,this.g=n,this.b=s,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[e,n,s,c]))}static parse(e){if(e instanceof pt)return e;if(typeof e!="string")return;let n=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];let c=jl(ql,s);if(c){let[m,_,x]=c;return[m/255,_/255,x/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){let m=s.length<6?1:2,_=1;return[eu(s.slice(_,_+=m)),eu(s.slice(_,_+=m)),eu(s.slice(_,_+=m)),eu(s.slice(_,_+m)||"ff")]}if(s.startsWith("rgb")){let m=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(m){let[_,x,b,S,w,A,E,R,I,O,F,V]=m,U=[S||" ",E||" ",O].join("");if(U===" "||U===" /"||U===",,"||U===",,,"){let j=[b,A,I].join(""),H=j==="%%%"?100:j===""?255:0;if(H){let X=[Rs(+x/H,0,1),Rs(+w/H,0,1),Rs(+R/H,0,1),F?$f(+F,V):1];if(md(X))return X}}return}}let d=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){let[m,_,x,b,S,w,A,E,R]=d,I=[x||" ",S||" ",A].join("");if(I===" "||I===" /"||I===",,"||I===",,,"){let O=[+_,Rs(+b,0,100),Rs(+w,0,100),E?$f(+E,R):1];if(md(O))return(function([F,V,U,j]){function H(X){let ue=(X+F/30)%12,he=V*Math.min(U,1-U);return U-he*Math.max(-1,Math.min(ue-3,9-ue,1))}return F=Zf(F),V/=100,U/=100,[H(0),H(8),H(4),j]})(O)}}})(e);return n?new pt(...n,!1):void 0}get rgb(){let{r:e,g:n,b:s,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[e/d,n/d,s/d,c])}get hcl(){return this.overwriteGetter("hcl",(function(e){let[n,s,c,d]=Hf(e),m=Math.sqrt(s*s+c*c);return[Math.round(1e4*m)?Zf(Math.atan2(c,s)*Gf):NaN,m,n,d]})(this.rgb))}get lab(){return this.overwriteGetter("lab",Hf(this.rgb))}overwriteGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}toString(){let[e,n,s,c]=this.rgb;return`rgba(${[e,n,s].map((d=>Math.round(255*d))).join(",")},${c})`}static interpolate(e,n,s,c="rgb"){switch(c){case"rgb":{let[d,m,_,x]=Is(e.rgb,n.rgb,s);return new pt(d,m,_,x,!1)}case"hcl":{let[d,m,_,x]=e.hcl,[b,S,w,A]=n.hcl,E,R;if(isNaN(d)||isNaN(b))isNaN(d)?isNaN(b)?E=NaN:(E=b,_!==1&&_!==0||(R=S)):(E=d,w!==1&&w!==0||(R=m));else{let U=b-d;b>d&&U>180?U-=360:b<d&&d-b>180&&(U+=360),E=d+s*U}let[I,O,F,V]=(function([U,j,H,X]){return U=isNaN(U)?0:U*Vl,dd([H,Math.cos(U)*j,Math.sin(U)*j,X])})([E,R??io(m,S,s),io(_,w,s),io(x,A,s)]);return new pt(I,O,F,V,!1)}case"lab":{let[d,m,_,x]=dd(Is(e.lab,n.lab,s));return new pt(d,m,_,x,!1)}}}}pt.black=new pt(0,0,0,1),pt.white=new pt(1,1,1,1),pt.transparent=new pt(0,0,0,0),pt.red=new pt(1,0,0,1);class gd{constructor(e,n,s){this.sensitivity=e?n?"variant":"case":n?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,n){return this.collator.compare(e,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let c1=["bottom","center","top"];class _d{constructor(e,n,s,c,d,m){this.text=e,this.image=n,this.scale=s,this.fontStack=c,this.textColor=d,this.verticalAlign=m}}class lr{constructor(e){this.sections=e}static fromString(e){return new lr([new _d(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof lr?e:lr.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class Pn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Pn)return e;if(typeof e=="number")return new Pn([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let n of e)if(typeof n!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Pn(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,n,s){return new Pn(Is(e.values,n.values,s))}}class yi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof yi)return e;if(typeof e=="number")return new yi([e]);if(Array.isArray(e)){for(let n of e)if(typeof n!="number")return;return new yi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,n,s){return new yi(Is(e.values,n.values,s))}}class st{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof st)return e;if(typeof e=="string"){let s=pt.parse(e);return s?new st([s]):void 0}if(!Array.isArray(e))return;let n=[];for(let s of e){if(typeof s!="string")return;let c=pt.parse(s);if(!c)return;n.push(c)}return new st(n)}toString(){return JSON.stringify(this.values)}static interpolate(e,n,s,c="rgb"){let d=[];if(e.values.length!=n.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${n.values.length}), cannot interpolate.`);for(let m=0;m<e.values.length;m++)d.push(pt.interpolate(e.values[m],n.values[m],s,c));return new st(d)}}class Jt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}let no=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class $n{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof $n)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let n=0;n<e.length;n+=2){let s=e[n],c=e[n+1];if(typeof s!="string"||!no.has(s)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new $n(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,n,s){let c=e.values,d=n.values;if(c.length!==d.length)throw new Jt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${n.toString()}`);let m=[];for(let _=0;_<c.length;_+=2){if(c[_]!==d[_])throw new Jt(`Cannot interpolate values containing mismatched anchors. from[${_}]: ${c[_]}, to[${_}]: ${d[_]}`);m.push(c[_]);let[x,b]=c[_+1],[S,w]=d[_+1];m.push([io(x,S,s),io(b,w,s)])}return new $n(m)}}class gr{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new gr({name:e,available:!1}):null}}class Xn{constructor(e,n,s){this.from=e,this.to=n,this.transition=s}static interpolate(e,n,s){return new Xn(e,n,s)}static parse(e){return e instanceof Xn?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new Xn(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new Xn(e.from,e.to,e.transition):typeof e=="string"?new Xn(e,e,1):void 0}}function ks(r,e,n,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof n=="number"&&n>=0&&n<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,n,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,n,s]:[r,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ro(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Xn||r instanceof pt||r instanceof gd||r instanceof lr||r instanceof Pn||r instanceof yi||r instanceof st||r instanceof $n||r instanceof gr)return!0;if(Array.isArray(r)){for(let e of r)if(!ro(e))return!1;return!0}if(typeof r=="object"){for(let e in r)if(!ro(r[e]))return!1;return!0}return!1}function Li(r){if(r===null)return to;if(typeof r=="string")return ct;if(typeof r=="boolean")return mt;if(typeof r=="number")return Ze;if(r instanceof pt)return mr;if(r instanceof Xn)return Yc;if(r instanceof gd)return Ol;if(r instanceof lr)return Bl;if(r instanceof Pn)return Wc;if(r instanceof yi)return Fl;if(r instanceof st)return zs;if(r instanceof $n)return Nl;if(r instanceof gr)return Ds;if(Array.isArray(r)){let e=r.length,n;for(let s of r){let c=Li(s);if(n){if(n===c)continue;n=ht;break}n=c}return Tn(n||ht,e)}return Ra}function Oo(r){let e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof pt||r instanceof Xn||r instanceof lr||r instanceof Pn||r instanceof yi||r instanceof st||r instanceof $n||r instanceof gr?r.toString():JSON.stringify(r)}class pa{constructor(e,n){this.type=e,this.value=n}static parse(e,n){if(e.length!==2)return n.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ro(e[1]))return n.error("invalid value");let s=e[1],c=Li(s),d=n.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new pa(c,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let tu={string:ct,number:Ze,boolean:mt,object:Ra};class cr{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let s,c=1,d=e[0];if(d==="array"){let _,x;if(e.length>2){let b=e[1];if(typeof b!="string"||!(b in tu)||b==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);_=tu[b],c++}else _=ht;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return n.error('The length argument to "array" must be a positive integer literal',2);x=e[2],c++}s=Tn(_,x)}else{if(!tu[d])throw new Error(`Types doesn't contain name = ${d}`);s=tu[d]}let m=[];for(;c<e.length;c++){let _=n.parse(e[c],c,ht);if(!_)return null;m.push(_)}return new cr(s,m)}evaluate(e){for(let n=0;n<this.args.length;n++){let s=this.args[n].evaluate(e);if(!Ps(this.type,Li(s)))return s;if(n===this.args.length-1)throw new Jt(`Expected value to be of type ${Zt(this.type)}, but found ${Zt(Li(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let Bo={"to-boolean":mt,"to-color":mr,"to-number":Ze,"to-string":ct};class Ia{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let s=e[0];if(!Bo[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return n.error("Expected one argument.");let c=Bo[s],d=[];for(let m=1;m<e.length;m++){let _=n.parse(e[m],m,ht);if(!_)return null;d.push(_)}return new Ia(c,d)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let n,s;for(let c of this.args){if(n=c.evaluate(e),s=null,n instanceof pt)return n;if(typeof n=="string"){let d=e.parseColor(n);if(d)return d}else if(Array.isArray(n)&&(s=n.length<3||n.length>4?`Invalid rgba value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:ks(n[0],n[1],n[2],n[3]),!s))return new pt(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new Jt(s||`Could not parse color from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"padding":{let n;for(let s of this.args){n=s.evaluate(e);let c=Pn.parse(n);if(c)return c}throw new Jt(`Could not parse padding from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"numberArray":{let n;for(let s of this.args){n=s.evaluate(e);let c=yi.parse(n);if(c)return c}throw new Jt(`Could not parse numberArray from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"colorArray":{let n;for(let s of this.args){n=s.evaluate(e);let c=st.parse(n);if(c)return c}throw new Jt(`Could not parse colorArray from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"variableAnchorOffsetCollection":{let n;for(let s of this.args){n=s.evaluate(e);let c=$n.parse(n);if(c)return c}throw new Jt(`Could not parse variableAnchorOffsetCollection from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"number":{let n=null;for(let s of this.args){if(n=s.evaluate(e),n===null)return 0;let c=Number(n);if(!isNaN(c))return c}throw new Jt(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return lr.fromString(Oo(this.args[0].evaluate(e)));case"resolvedImage":return gr.fromString(Oo(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Oo(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let Xf=["Unknown","Point","LineString","Polygon"];class yd{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Xf[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let n=this._parseColorCache.get(e);return n||(n=pt.parse(e),this._parseColorCache.set(e,n)),n}}class Fo{constructor(e,n,s=[],c,d=new ud,m=[]){this.registry=e,this.path=s,this.key=s.map((_=>`[${_}]`)).join(""),this.scope=d,this.errors=m,this.expectedType=c,this._isConstant=n}parse(e,n,s,c,d={}){return n?this.concat(n,s,c)._parse(e,d):this._parse(e,d)}_parse(e,n){function s(c,d,m){return m==="assert"?new cr(d,[c]):m==="coerce"?new Ia(d,[c]):c}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let c=e[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let d=this.registry[c];if(d){let m=d.parse(e,this);if(!m)return null;if(this.expectedType){let _=this.expectedType,x=m.type;if(_.kind!=="string"&&_.kind!=="number"&&_.kind!=="boolean"&&_.kind!=="object"&&_.kind!=="array"||x.kind!=="value"){if(_.kind==="projectionDefinition"&&["string","array"].includes(x.kind)||["color","formatted","resolvedImage"].includes(_.kind)&&["value","string"].includes(x.kind)||["padding","numberArray"].includes(_.kind)&&["value","number","array"].includes(x.kind)||_.kind==="colorArray"&&["value","string","array"].includes(x.kind)||_.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(x.kind))m=s(m,_,n.typeAnnotation||"coerce");else if(this.checkSubtype(_,x))return null}else m=s(m,_,n.typeAnnotation||"assert")}if(!(m instanceof pa)&&m.type.kind!=="resolvedImage"&&this._isConstant(m)){let _=new yd;try{m=new pa(m.type,m.evaluate(_))}catch(x){return this.error(x.message),null}}return m}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,n,s){let c=typeof e=="number"?this.path.concat(e):this.path,d=s?this.scope.concat(s):this.scope;return new Fo(this.registry,this._isConstant,c,n||null,d,this.errors)}error(e,...n){let s=`${this.key}${n.map((c=>`[${c}]`)).join("")}`;this.errors.push(new wn(s,e))}checkSubtype(e,n){let s=Ps(e,n);return s&&this.error(s),s}}class ei{constructor(e,n){this.type=n.type,this.bindings=[].concat(e),this.result=n}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let n of this.bindings)e(n[1]);e(this.result)}static parse(e,n){if(e.length<4)return n.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let s=[];for(let d=1;d<e.length-1;d+=2){let m=e[d];if(typeof m!="string")return n.error(`Expected string, but found ${typeof m} instead.`,d);if(/[^a-zA-Z0-9_]/.test(m))return n.error("Variable names must contain only alphanumeric characters or '_'.",d);let _=n.parse(e[d+1],d+1);if(!_)return null;s.push([m,_])}let c=n.parse(e[e.length-1],e.length-1,n.expectedType,s);return c?new ei(s,c):null}outputDefined(){return this.result.outputDefined()}}class Ls{constructor(e,n){this.type=n.type,this.name=e,this.boundExpression=n}static parse(e,n){if(e.length!==2||typeof e[1]!="string")return n.error("'var' expression requires exactly one string literal argument.");let s=e[1];return n.scope.has(s)?new Ls(s,n.scope.get(s)):n.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class wt{constructor(e,n,s){this.type=e,this.index=n,this.input=s}static parse(e,n){if(e.length!==3)return n.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let s=n.parse(e[1],1,Ze),c=n.parse(e[2],2,Tn(n.expectedType||ht));return s&&c?new wt(c.type.itemType,s,c):null}evaluate(e){let n=this.index.evaluate(e),s=this.input.evaluate(e);if(n<0)throw new Jt(`Array index out of bounds: ${n} < 0.`);if(n>=s.length)throw new Jt(`Array index out of bounds: ${n} > ${s.length-1}.`);if(n!==Math.floor(n))throw new Jt(`Array index must be an integer, but found ${n} instead.`);return s[n]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class dt{constructor(e,n){this.type=mt,this.needle=e,this.haystack=n}static parse(e,n){if(e.length!==3)return n.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let s=n.parse(e[1],1,ht),c=n.parse(e[2],2,ht);return s&&c?Ul(s.type,[mt,ct,Ze,to,ht])?new dt(s,c):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${Zt(s.type)} instead`):null}evaluate(e){let n=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!ko(n,["boolean","string","number","null"]))throw new Jt(`Expected first argument to be of type boolean, string, number or null, but found ${Zt(Li(n))} instead.`);if(!ko(s,["string","array"]))throw new Jt(`Expected second argument to be of type array or string, but found ${Zt(Li(s))} instead.`);return s.indexOf(n)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Os{constructor(e,n,s){this.type=Ze,this.needle=e,this.haystack=n,this.fromIndex=s}static parse(e,n){if(e.length<=2||e.length>=5)return n.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let s=n.parse(e[1],1,ht),c=n.parse(e[2],2,ht);if(!s||!c)return null;if(!Ul(s.type,[mt,ct,Ze,to,ht]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${Zt(s.type)} instead`);if(e.length===4){let d=n.parse(e[3],3,Ze);return d?new Os(s,c,d):null}return new Os(s,c)}evaluate(e){let n=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!ko(n,["boolean","string","number","null"]))throw new Jt(`Expected first argument to be of type boolean, string, number or null, but found ${Zt(Li(n))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(e)),ko(s,["string"])){let d=s.indexOf(n,c);return d===-1?-1:[...s.slice(0,d)].length}if(ko(s,["array"]))return s.indexOf(n,c);throw new Jt(`Expected second argument to be of type array or string, but found ${Zt(Li(s))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Tt{constructor(e,n,s,c,d,m){this.inputType=e,this.type=n,this.input=s,this.cases=c,this.outputs=d,this.otherwise=m}static parse(e,n){if(e.length<5)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return n.error("Expected an even number of arguments.");let s,c;n.expectedType&&n.expectedType.kind!=="value"&&(c=n.expectedType);let d={},m=[];for(let b=2;b<e.length-1;b+=2){let S=e[b],w=e[b+1];Array.isArray(S)||(S=[S]);let A=n.concat(b);if(S.length===0)return A.error("Expected at least one branch label.");for(let R of S){if(typeof R!="number"&&typeof R!="string")return A.error("Branch labels must be numbers or strings.");if(typeof R=="number"&&Math.abs(R)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof R=="number"&&Math.floor(R)!==R)return A.error("Numeric branch labels must be integer values.");if(s){if(A.checkSubtype(s,Li(R)))return null}else s=Li(R);if(d[String(R)]!==void 0)return A.error("Branch labels must be unique.");d[String(R)]=m.length}let E=n.parse(w,b,c);if(!E)return null;c=c||E.type,m.push(E)}let _=n.parse(e[1],1,ht);if(!_)return null;let x=n.parse(e[e.length-1],e.length-1,c);return x?_.type.kind!=="value"&&n.concat(1).checkSubtype(s,_.type)?null:new Tt(s,c,_,d,m,x):null}evaluate(e){let n=this.input.evaluate(e);return(Li(n)===this.inputType&&this.outputs[this.cases[n]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class $r{constructor(e,n,s){this.type=e,this.branches=n,this.otherwise=s}static parse(e,n){if(e.length<4)return n.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return n.error("Expected an odd number of arguments.");let s;n.expectedType&&n.expectedType.kind!=="value"&&(s=n.expectedType);let c=[];for(let m=1;m<e.length-1;m+=2){let _=n.parse(e[m],m,mt);if(!_)return null;let x=n.parse(e[m+1],m+1,s);if(!x)return null;c.push([_,x]),s=s||x.type}let d=n.parse(e[e.length-1],e.length-1,s);if(!d)return null;if(!s)throw new Error("Can't infer output type");return new $r(s,c,d)}evaluate(e){for(let[n,s]of this.branches)if(n.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[n,s]of this.branches)e(n),e(s);e(this.otherwise)}outputDefined(){return this.branches.every((([e,n])=>n.outputDefined()))&&this.otherwise.outputDefined()}}class Bs{constructor(e,n,s,c){this.type=e,this.input=n,this.beginIndex=s,this.endIndex=c}static parse(e,n){if(e.length<=2||e.length>=5)return n.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let s=n.parse(e[1],1,ht),c=n.parse(e[2],2,Ze);if(!s||!c)return null;if(!Ul(s.type,[Tn(ht),ct,ht]))return n.error(`Expected first argument to be of type array or string, but found ${Zt(s.type)} instead`);if(e.length===4){let d=n.parse(e[3],3,Ze);return d?new Bs(s.type,s,c,d):null}return new Bs(s.type,s,c)}evaluate(e){let n=this.input.evaluate(e),s=this.beginIndex.evaluate(e),c;if(this.endIndex&&(c=this.endIndex.evaluate(e)),ko(n,["string"]))return[...n].slice(s,c).join("");if(ko(n,["array"]))return n.slice(s,c);throw new Jt(`Expected first argument to be of type array or string, but found ${Zt(Li(n))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function No(r,e){let n=r.length-1,s,c,d=0,m=n,_=0;for(;d<=m;)if(_=Math.floor((d+m)/2),s=r[_],c=r[_+1],s<=e){if(_===n||e<c)return _;d=_+1}else{if(!(s>e))throw new Jt("Input is not a number.");m=_-1}return 0}class Fs{constructor(e,n,s){this.type=e,this.input=n,this.labels=[],this.outputs=[];for(let[c,d]of s)this.labels.push(c),this.outputs.push(d)}static parse(e,n){if(e.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return n.error("Expected an even number of arguments.");let s=n.parse(e[1],1,Ze);if(!s)return null;let c=[],d=null;n.expectedType&&n.expectedType.kind!=="value"&&(d=n.expectedType);for(let m=1;m<e.length;m+=2){let _=m===1?-1/0:e[m],x=e[m+1],b=m,S=m+1;if(typeof _!="number")return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',b);if(c.length&&c[c.length-1][0]>=_)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',b);let w=n.parse(x,S,d);if(!w)return null;d=d||w.type,c.push([_,w])}return new Fs(d,s,c)}evaluate(e){let n=this.labels,s=this.outputs;if(n.length===1)return s[0].evaluate(e);let c=this.input.evaluate(e);if(c<=n[0])return s[0].evaluate(e);let d=n.length;return c>=n[d-1]?s[d-1].evaluate(e):s[No(n,c)].evaluate(e)}eachChild(e){e(this.input);for(let n of this.outputs)e(n)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function vd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var iu,Yf,Wf=(function(){if(Yf)return iu;function r(e,n,s,c){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=n,this.p2x=s,this.p2y=c}return Yf=1,iu=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,n){if(n===void 0&&(n=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,c=0;c<8;c++){var d=this.sampleCurveX(s)-e;if(Math.abs(d)<n)return s;var m=this.sampleCurveDerivativeX(s);if(Math.abs(m)<1e-6)break;s-=d/m}var _=0,x=1;for(s=e,c=0;c<20&&(d=this.sampleCurveX(s),!(Math.abs(d-e)<n));c++)e>d?_=s:x=s,s=.5*(x-_)+_;return s},solve:function(e,n){return this.sampleCurveY(this.solveCurveX(e,n))}},iu})(),Kf=vd(Wf);class Vi{constructor(e,n,s,c,d){this.type=e,this.operator=n,this.interpolation=s,this.input=c,this.labels=[],this.outputs=[];for(let[m,_]of d)this.labels.push(m),this.outputs.push(_)}static interpolationFactor(e,n,s,c){let d=0;if(e.name==="exponential")d=ln(n,e.base,s,c);else if(e.name==="linear")d=ln(n,1,s,c);else if(e.name==="cubic-bezier"){let m=e.controlPoints;d=new Kf(m[0],m[1],m[2],m[3]).solve(ln(n,1,s,c))}return d}static parse(e,n){let[s,c,d,...m]=e;if(!Array.isArray(c)||c.length===0)return n.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){let b=c[1];if(typeof b!="number")return n.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:b}}else{if(c[0]!=="cubic-bezier")return n.error(`Unknown interpolation type ${String(c[0])}`,1,0);{let b=c.slice(1);if(b.length!==4||b.some((S=>typeof S!="number"||S<0||S>1)))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:b}}}if(e.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(d=n.parse(d,2,Ze),!d)return null;let _=[],x=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||n.expectedType==zs?n.expectedType&&n.expectedType.kind!=="value"&&(x=n.expectedType):x=mr;for(let b=0;b<m.length;b+=2){let S=m[b],w=m[b+1],A=b+3,E=b+4;if(typeof S!="number")return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(_.length&&_[_.length-1][0]>=S)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);let R=n.parse(w,E,x);if(!R)return null;x=x||R.type,_.push([S,R])}return Hr(x,Ze)||Hr(x,Yc)||Hr(x,mr)||Hr(x,Wc)||Hr(x,Fl)||Hr(x,zs)||Hr(x,Nl)||Hr(x,Tn(Ze))?new Vi(x,s,c,d,_):n.error(`Type ${Zt(x)} is not interpolatable.`)}evaluate(e){let n=this.labels,s=this.outputs;if(n.length===1)return s[0].evaluate(e);let c=this.input.evaluate(e);if(c<=n[0])return s[0].evaluate(e);let d=n.length;if(c>=n[d-1])return s[d-1].evaluate(e);let m=No(n,c),_=Vi.interpolationFactor(this.interpolation,c,n[m],n[m+1]),x=s[m].evaluate(e),b=s[m+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return io(x,b,_);case"color":return pt.interpolate(x,b,_);case"padding":return Pn.interpolate(x,b,_);case"colorArray":return st.interpolate(x,b,_);case"numberArray":return yi.interpolate(x,b,_);case"variableAnchorOffsetCollection":return $n.interpolate(x,b,_);case"array":return Is(x,b,_);case"projectionDefinition":return Xn.interpolate(x,b,_)}case"interpolate-hcl":switch(this.type.kind){case"color":return pt.interpolate(x,b,_,"hcl");case"colorArray":return st.interpolate(x,b,_,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return pt.interpolate(x,b,_,"lab");case"colorArray":return st.interpolate(x,b,_,"lab")}}}eachChild(e){e(this.input);for(let n of this.outputs)e(n)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function ln(r,e,n,s){let c=s-n,d=r-n;return c===0?0:e===1?d/c:(Math.pow(e,d)-1)/(Math.pow(e,c)-1)}let _r={color:pt.interpolate,number:io,padding:Pn.interpolate,numberArray:yi.interpolate,colorArray:st.interpolate,variableAnchorOffsetCollection:$n.interpolate,array:Is};class Gl{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let s=null,c=n.expectedType;c&&c.kind!=="value"&&(s=c);let d=[];for(let _ of e.slice(1)){let x=n.parse(_,1+d.length,s,void 0,{typeAnnotation:"omit"});if(!x)return null;s=s||x.type,d.push(x)}if(!s)throw new Error("No output type");let m=c&&d.some((_=>Ps(c,_.type)));return new Gl(m?ht:s,d)}evaluate(e){let n,s=null,c=0;for(let d of this.args)if(c++,s=d.evaluate(e),s&&s instanceof gr&&!s.available&&(n||(n=s.name),s=null,c===this.args.length&&(s=n)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Zl(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Qi(r,e,n,s){return s.compare(e,n)===0}function Uo(r,e,n){let s=r!=="=="&&r!=="!=";return class Kw{constructor(d,m,_){this.type=mt,this.lhs=d,this.rhs=m,this.collator=_,this.hasUntypedArgument=d.type.kind==="value"||m.type.kind==="value"}static parse(d,m){if(d.length!==3&&d.length!==4)return m.error("Expected two or three arguments.");let _=d[0],x=m.parse(d[1],1,ht);if(!x)return null;if(!Zl(_,x.type))return m.concat(1).error(`"${_}" comparisons are not supported for type '${Zt(x.type)}'.`);let b=m.parse(d[2],2,ht);if(!b)return null;if(!Zl(_,b.type))return m.concat(2).error(`"${_}" comparisons are not supported for type '${Zt(b.type)}'.`);if(x.type.kind!==b.type.kind&&x.type.kind!=="value"&&b.type.kind!=="value")return m.error(`Cannot compare types '${Zt(x.type)}' and '${Zt(b.type)}'.`);s&&(x.type.kind==="value"&&b.type.kind!=="value"?x=new cr(b.type,[x]):x.type.kind!=="value"&&b.type.kind==="value"&&(b=new cr(x.type,[b])));let S=null;if(d.length===4){if(x.type.kind!=="string"&&b.type.kind!=="string"&&x.type.kind!=="value"&&b.type.kind!=="value")return m.error("Cannot use collator to compare non-string types.");if(S=m.parse(d[3],3,Ol),!S)return null}return new Kw(x,b,S)}evaluate(d){let m=this.lhs.evaluate(d),_=this.rhs.evaluate(d);if(s&&this.hasUntypedArgument){let x=Li(m),b=Li(_);if(x.kind!==b.kind||x.kind!=="string"&&x.kind!=="number")throw new Jt(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${x.kind}, ${b.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){let x=Li(m),b=Li(_);if(x.kind!=="string"||b.kind!=="string")return e(d,m,_)}return this.collator?n(d,m,_,this.collator.evaluate(d)):e(d,m,_)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}let bd=Uo("==",(function(r,e,n){return e===n}),Qi),Qf=Uo("!=",(function(r,e,n){return e!==n}),(function(r,e,n,s){return!Qi(0,e,n,s)})),u1=Uo("<",(function(r,e,n){return e<n}),(function(r,e,n,s){return s.compare(e,n)<0})),Ns=Uo(">",(function(r,e,n){return e>n}),(function(r,e,n,s){return s.compare(e,n)>0})),nu=Uo("<=",(function(r,e,n){return e<=n}),(function(r,e,n,s){return s.compare(e,n)<=0})),xd=Uo(">=",(function(r,e,n){return e>=n}),(function(r,e,n,s){return s.compare(e,n)>=0}));class ru{constructor(e,n,s){this.type=Ol,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=n}static parse(e,n){if(e.length!==2)return n.error("Expected one argument.");let s=e[1];if(typeof s!="object"||Array.isArray(s))return n.error("Collator options argument must be an object.");let c=n.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,mt);if(!c)return null;let d=n.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,mt);if(!d)return null;let m=null;return s.locale&&(m=n.parse(s.locale,1,ct),!m)?null:new ru(c,d,m)}evaluate(e){return new gd(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class au{constructor(e,n,s,c,d,m){this.type=ct,this.number=e,this.locale=n,this.currency=s,this.unit=c,this.minFractionDigits=d,this.maxFractionDigits=m}static parse(e,n){if(e.length!==3)return n.error("Expected two arguments.");let s=n.parse(e[1],1,Ze);if(!s)return null;let c=e[2];if(typeof c!="object"||Array.isArray(c))return n.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=n.parse(c.locale,1,ct),!d))return null;let m=null;if(c.currency&&(m=n.parse(c.currency,1,ct),!m))return null;let _=null;if(c.unit&&(_=n.parse(c.unit,1,ct),!_))return null;if(m&&_)return n.error("NumberFormat options `currency` and `unit` are mutually exclusive");let x=null;if(c["min-fraction-digits"]&&(x=n.parse(c["min-fraction-digits"],1,Ze),!x))return null;let b=null;return c["max-fraction-digits"]&&(b=n.parse(c["max-fraction-digits"],1,Ze),!b)?null:new au(s,d,m,_,x,b)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Vo{constructor(e){this.type=Bl,this.sections=e}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let s=e[1];if(!Array.isArray(s)&&typeof s=="object")return n.error("First argument must be an image or text section.");let c=[],d=!1;for(let m=1;m<=e.length-1;++m){let _=e[m];if(d&&typeof _=="object"&&!Array.isArray(_)){d=!1;let x=null;if(_["font-scale"]&&(x=n.parse(_["font-scale"],1,Ze),!x))return null;let b=null;if(_["text-font"]&&(b=n.parse(_["text-font"],1,Tn(ct)),!b))return null;let S=null;if(_["text-color"]&&(S=n.parse(_["text-color"],1,mr),!S))return null;let w=null;if(_["vertical-align"]){if(typeof _["vertical-align"]=="string"&&!c1.includes(_["vertical-align"]))return n.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${_["vertical-align"]}' instead.`);if(w=n.parse(_["vertical-align"],1,ct),!w)return null}let A=c[c.length-1];A.scale=x,A.font=b,A.textColor=S,A.verticalAlign=w}else{let x=n.parse(e[m],1,ht);if(!x)return null;let b=x.type.kind;if(b!=="string"&&b!=="value"&&b!=="null"&&b!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:x,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Vo(c)}evaluate(e){return new lr(this.sections.map((n=>{let s=n.content.evaluate(e);return Li(s)===Ds?new _d("",s,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new _d(Oo(s),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)})))}eachChild(e){for(let n of this.sections)e(n.content),n.scale&&e(n.scale),n.font&&e(n.font),n.textColor&&e(n.textColor),n.verticalAlign&&e(n.verticalAlign)}outputDefined(){return!1}}class Us{constructor(e){this.type=Ds,this.input=e}static parse(e,n){if(e.length!==2)return n.error("Expected two arguments.");let s=n.parse(e[1],1,ct);return s?new Us(s):n.error("No image name provided.")}evaluate(e){let n=this.input.evaluate(e),s=gr.fromString(n);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(n)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class yr{constructor(e){this.type=Ze,this.input=e}static parse(e,n){if(e.length!==2)return n.error(`Expected 1 argument, but found ${e.length-1} instead.`);let s=n.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?n.error(`Expected argument of type string or array, but found ${Zt(s.type)} instead.`):new yr(s):null}evaluate(e){let n=this.input.evaluate(e);if(typeof n=="string")return[...n].length;if(Array.isArray(n))return n.length;throw new Jt(`Expected value to be of type string or array, but found ${Zt(Li(n))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}let Xr=8192;function ou(r,e){let n=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,c=Math.pow(2,e.z);return[Math.round(n*c*Xr),Math.round(s*c*Xr)]}function wd(r,e){let n=Math.pow(2,e.z);return[(c=(r[0]/Xr+e.x)/n,360*c-180),(s=(r[1]/Xr+e.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,c}function jo(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function Hl(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function h1(r,e,n){let s=r[0]-e[0],c=r[1]-e[1],d=r[0]-n[0],m=r[1]-n[1];return s*m-d*c==0&&s*d<=0&&c*m<=0}function su(r,e,n,s){return(c=[s[0]-n[0],s[1]-n[1]])[0]*(d=[e[0]-r[0],e[1]-r[1]])[1]-c[1]*d[0]!=0&&!(!em(r,e,n,s)||!em(n,s,r,e));var c,d}function d1(r,e,n){for(let s of n)for(let c=0;c<s.length-1;++c)if(su(r,e,s[c],s[c+1]))return!0;return!1}function ka(r,e,n=!1){let s=!1;for(let _ of e)for(let x=0;x<_.length-1;x++){if(h1(r,_[x],_[x+1]))return n;(d=_[x])[1]>(c=r)[1]!=(m=_[x+1])[1]>c[1]&&c[0]<(m[0]-d[0])*(c[1]-d[1])/(m[1]-d[1])+d[0]&&(s=!s)}var c,d,m;return s}function p1(r,e){for(let n of e)if(ka(r,n))return!0;return!1}function Td(r,e){for(let n of r)if(!ka(n,e))return!1;for(let n=0;n<r.length-1;++n)if(d1(r[n],r[n+1],e))return!1;return!0}function Jf(r,e){for(let n of e)if(Td(r,n))return!0;return!1}function em(r,e,n,s){let c=s[0]-n[0],d=s[1]-n[1],m=(r[0]-n[0])*d-c*(r[1]-n[1]),_=(e[0]-n[0])*d-c*(e[1]-n[1]);return m>0&&_<0||m<0&&_>0}function lu(r,e,n){let s=[];for(let c=0;c<r.length;c++){let d=[];for(let m=0;m<r[c].length;m++){let _=ou(r[c][m],n);jo(e,_),d.push(_)}s.push(d)}return s}function tm(r,e,n){let s=[];for(let c=0;c<r.length;c++){let d=lu(r[c],e,n);s.push(d)}return s}function im(r,e,n,s){if(r[0]<n[0]||r[0]>n[2]){let c=.5*s,d=r[0]-n[0]>c?-s:n[0]-r[0]>c?s:0;d===0&&(d=r[0]-n[2]>c?-s:n[2]-r[0]>c?s:0),r[0]+=d}jo(e,r)}function nm(r,e,n,s){let c=Math.pow(2,s.z)*Xr,d=[s.x*Xr,s.y*Xr],m=[];for(let _ of r)for(let x of _){let b=[x.x+d[0],x.y+d[1]];im(b,e,n,c),m.push(b)}return m}function rm(r,e,n,s){let c=Math.pow(2,s.z)*Xr,d=[s.x*Xr,s.y*Xr],m=[];for(let x of r){let b=[];for(let S of x){let w=[S.x+d[0],S.y+d[1]];jo(e,w),b.push(w)}m.push(b)}if(e[2]-e[0]<=c/2){(_=e)[0]=_[1]=1/0,_[2]=_[3]=-1/0;for(let x of m)for(let b of x)im(b,e,n,c)}var _;return m}class qo{constructor(e,n){this.type=mt,this.geojson=e,this.geometries=n}static parse(e,n){if(e.length!==2)return n.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ro(e[1])){let s=e[1];if(s.type==="FeatureCollection"){let c=[];for(let d of s.features){let{type:m,coordinates:_}=d.geometry;m==="Polygon"&&c.push(_),m==="MultiPolygon"&&c.push(..._)}if(c.length)return new qo(s,{type:"MultiPolygon",coordinates:c})}else if(s.type==="Feature"){let c=s.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new qo(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new qo(s,s)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(n,s){let c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],m=n.canonicalID();if(s.type==="Polygon"){let _=lu(s.coordinates,d,m),x=nm(n.geometry(),c,d,m);if(!Hl(c,d))return!1;for(let b of x)if(!ka(b,_))return!1}if(s.type==="MultiPolygon"){let _=tm(s.coordinates,d,m),x=nm(n.geometry(),c,d,m);if(!Hl(c,d))return!1;for(let b of x)if(!p1(b,_))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(n,s){let c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],m=n.canonicalID();if(s.type==="Polygon"){let _=lu(s.coordinates,d,m),x=rm(n.geometry(),c,d,m);if(!Hl(c,d))return!1;for(let b of x)if(!Td(b,_))return!1}if(s.type==="MultiPolygon"){let _=tm(s.coordinates,d,m),x=rm(n.geometry(),c,d,m);if(!Hl(c,d))return!1;for(let b of x)if(!Jf(b,_))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Sd=class{constructor(r=[],e=(n,s)=>n<s?-1:n>s?1:0){if(this.data=r,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;let r=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),r}peek(){return this.data[0]}_up(r){let{data:e,compare:n}=this,s=e[r];for(;r>0;){let c=r-1>>1,d=e[c];if(n(s,d)>=0)break;e[r]=d,r=c}e[r]=s}_down(r){let{data:e,compare:n}=this,s=this.length>>1,c=e[r];for(;r<s;){let d=1+(r<<1),m=d+1;if(m<this.length&&n(e[m],e[d])<0&&(d=m),n(e[d],c)>=0)break;e[r]=e[d],r=d}e[r]=c}};function Md(r,e,n=0,s=r.length-1,c=f1){for(;s>n;){if(s-n>600){let x=s-n+1,b=e-n+1,S=Math.log(x),w=.5*Math.exp(2*S/3),A=.5*Math.sqrt(S*w*(x-w)/x)*(b-x/2<0?-1:1);Md(r,e,Math.max(n,Math.floor(e-b*w/x+A)),Math.min(s,Math.floor(e+(x-b)*w/x+A)),c)}let d=r[e],m=n,_=s;for(Vs(r,n,e),c(r[s],d)>0&&Vs(r,n,s);m<_;){for(Vs(r,m,_),m++,_--;c(r[m],d)<0;)m++;for(;c(r[_],d)>0;)_--}c(r[n],d)===0?Vs(r,n,_):(_++,Vs(r,_,s)),_<=e&&(n=_+1),e<=_&&(s=_-1)}}function Vs(r,e,n){let s=r[e];r[e]=r[n],r[n]=s}function f1(r,e){return r<e?-1:r>e?1:0}function cu(r,e){if(r.length<=1)return[r];let n=[],s,c;for(let d of r){let m=g1(d);m!==0&&(d.area=Math.abs(m),c===void 0&&(c=m<0),c===m<0?(s&&n.push(s),s=[d]):s.push(d))}if(s&&n.push(s),e>1)for(let d=0;d<n.length;d++)n[d].length<=e||(Md(n[d],e,1,n[d].length-1,m1),n[d]=n[d].slice(0,e));return n}function m1(r,e){return e.area-r.area}function g1(r){let e=0;for(let n,s,c=0,d=r.length,m=d-1;c<d;m=c++)n=r[c],s=r[m],e+=(s.x-n.x)*(n.y+s.y);return e}let $l=1/298.257223563,am=$l*(2-$l),om=Math.PI/180;class Ed{constructor(e){let n=6378.137*om*1e3,s=Math.cos(e*om),c=1/(1-am*(1-s*s)),d=Math.sqrt(c);this.kx=n*d*s,this.ky=n*d*c*(1-am)}distance(e,n){let s=this.wrap(e[0]-n[0])*this.kx,c=(e[1]-n[1])*this.ky;return Math.sqrt(s*s+c*c)}pointOnLine(e,n){let s,c,d,m,_=1/0;for(let x=0;x<e.length-1;x++){let b=e[x][0],S=e[x][1],w=this.wrap(e[x+1][0]-b)*this.kx,A=(e[x+1][1]-S)*this.ky,E=0;w===0&&A===0||(E=(this.wrap(n[0]-b)*this.kx*w+(n[1]-S)*this.ky*A)/(w*w+A*A),E>1?(b=e[x+1][0],S=e[x+1][1]):E>0&&(b+=w/this.kx*E,S+=A/this.ky*E)),w=this.wrap(n[0]-b)*this.kx,A=(n[1]-S)*this.ky;let R=w*w+A*A;R<_&&(_=R,s=b,c=S,d=x,m=E)}return{point:[s,c],index:d,t:Math.max(0,Math.min(1,m))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function sm(r,e){return e[0]-r[0]}function js(r){return r[1]-r[0]+1}function fa(r,e){return r[1]>=r[0]&&r[1]<e}function Cd(r,e){if(r[0]>r[1])return[null,null];let n=js(r);if(e){if(n===2)return[r,null];let c=Math.floor(n/2);return[[r[0],r[0]+c],[r[0]+c,r[1]]]}if(n===1)return[r,null];let s=Math.floor(n/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}function Ad(r,e){if(!fa(e,r.length))return[1/0,1/0,-1/0,-1/0];let n=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)jo(n,r[s]);return n}function uu(r){let e=[1/0,1/0,-1/0,-1/0];for(let n of r)for(let s of n)jo(e,s);return e}function zd(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function Dd(r,e,n){if(!zd(r)||!zd(e))return NaN;let s=0,c=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(c=r[1]-e[3]),r[3]<e[1]&&(c=e[1]-r[3]),n.distance([0,0],[s,c])}function Go(r,e,n){let s=n.pointOnLine(e,r);return n.distance(r,s.point)}function Pd(r,e,n,s,c){let d=Math.min(Go(r,[n,s],c),Go(e,[n,s],c)),m=Math.min(Go(n,[r,e],c),Go(s,[r,e],c));return Math.min(d,m)}function lm(r,e,n,s,c){if(!fa(e,r.length)||!fa(s,n.length))return 1/0;let d=1/0;for(let m=e[0];m<e[1];++m){let _=r[m],x=r[m+1];for(let b=s[0];b<s[1];++b){let S=n[b],w=n[b+1];if(su(_,x,S,w))return 0;d=Math.min(d,Pd(_,x,S,w,c))}}return d}function _1(r,e,n,s,c){if(!fa(e,r.length)||!fa(s,n.length))return NaN;let d=1/0;for(let m=e[0];m<=e[1];++m)for(let _=s[0];_<=s[1];++_)if(d=Math.min(d,c.distance(r[m],n[_])),d===0)return d;return d}function y1(r,e,n){if(ka(r,e,!0))return 0;let s=1/0;for(let c of e){let d=c[0],m=c[c.length-1];if(d!==m&&(s=Math.min(s,Go(r,[m,d],n)),s===0))return s;let _=n.pointOnLine(c,r);if(s=Math.min(s,n.distance(r,_.point)),s===0)return s}return s}function v1(r,e,n,s){if(!fa(e,r.length))return NaN;for(let d=e[0];d<=e[1];++d)if(ka(r[d],n,!0))return 0;let c=1/0;for(let d=e[0];d<e[1];++d){let m=r[d],_=r[d+1];for(let x of n)for(let b=0,S=x.length,w=S-1;b<S;w=b++){let A=x[w],E=x[b];if(su(m,_,A,E))return 0;c=Math.min(c,Pd(m,_,A,E,s))}}return c}function cm(r,e){for(let n of r)for(let s of n)if(ka(s,e,!0))return!0;return!1}function Bt(r,e,n,s=1/0){let c=uu(r),d=uu(e);if(s!==1/0&&Dd(c,d,n)>=s)return s;if(Hl(c,d)){if(cm(r,e))return 0}else if(cm(e,r))return 0;let m=1/0;for(let _ of r)for(let x=0,b=_.length,S=b-1;x<b;S=x++){let w=_[S],A=_[x];for(let E of e)for(let R=0,I=E.length,O=I-1;R<I;O=R++){let F=E[O],V=E[R];if(su(w,A,F,V))return 0;m=Math.min(m,Pd(w,A,F,V,n))}}return m}function um(r,e,n,s,c,d){if(!d)return;let m=Dd(Ad(s,d),c,n);m<e&&r.push([m,d,[0,0]])}function hu(r,e,n,s,c,d,m){if(!d||!m)return;let _=Dd(Ad(s,d),Ad(c,m),n);_<e&&r.push([_,d,m])}function du(r,e,n,s,c=1/0){let d=Math.min(s.distance(r[0],n[0][0]),c);if(d===0)return d;let m=new Sd([[0,[0,r.length-1],[0,0]]],sm),_=uu(n);for(;m.length>0;){let x=m.pop();if(x[0]>=d)continue;let b=x[1],S=e?50:100;if(js(b)<=S){if(!fa(b,r.length))return NaN;if(e){let w=v1(r,b,n,s);if(isNaN(w)||w===0)return w;d=Math.min(d,w)}else for(let w=b[0];w<=b[1];++w){let A=y1(r[w],n,s);if(d=Math.min(d,A),d===0)return 0}}else{let w=Cd(b,e);um(m,d,s,r,_,w[0]),um(m,d,s,r,_,w[1])}}return d}function pu(r,e,n,s,c,d=1/0){let m=Math.min(d,c.distance(r[0],n[0]));if(m===0)return m;let _=new Sd([[0,[0,r.length-1],[0,n.length-1]]],sm);for(;_.length>0;){let x=_.pop();if(x[0]>=m)continue;let b=x[1],S=x[2],w=e?50:100,A=s?50:100;if(js(b)<=w&&js(S)<=A){if(!fa(b,r.length)&&fa(S,n.length))return NaN;let E;if(e&&s)E=lm(r,b,n,S,c),m=Math.min(m,E);else if(e&&!s){let R=r.slice(b[0],b[1]+1);for(let I=S[0];I<=S[1];++I)if(E=Go(n[I],R,c),m=Math.min(m,E),m===0)return m}else if(!e&&s){let R=n.slice(S[0],S[1]+1);for(let I=b[0];I<=b[1];++I)if(E=Go(r[I],R,c),m=Math.min(m,E),m===0)return m}else E=_1(r,b,n,S,c),m=Math.min(m,E)}else{let E=Cd(b,e),R=Cd(S,s);hu(_,m,c,r,n,E[0],R[0]),hu(_,m,c,r,n,E[0],R[1]),hu(_,m,c,r,n,E[1],R[0]),hu(_,m,c,r,n,E[1],R[1])}}return m}function Rd(r){return r.type==="MultiPolygon"?r.coordinates.map((e=>({type:"Polygon",coordinates:e}))):r.type==="MultiLineString"?r.coordinates.map((e=>({type:"LineString",coordinates:e}))):r.type==="MultiPoint"?r.coordinates.map((e=>({type:"Point",coordinates:e}))):[r]}class Zo{constructor(e,n){this.type=Ze,this.geojson=e,this.geometries=n}static parse(e,n){if(e.length!==2)return n.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ro(e[1])){let s=e[1];if(s.type==="FeatureCollection")return new Zo(s,s.features.map((c=>Rd(c.geometry))).flat());if(s.type==="Feature")return new Zo(s,Rd(s.geometry));if("type"in s&&"coordinates"in s)return new Zo(s,Rd(s))}return n.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(n,s){let c=n.geometry(),d=c.flat().map((x=>wd([x.x,x.y],n.canonical)));if(c.length===0)return NaN;let m=new Ed(d[0][1]),_=1/0;for(let x of s){switch(x.type){case"Point":_=Math.min(_,pu(d,!1,[x.coordinates],!1,m,_));break;case"LineString":_=Math.min(_,pu(d,!1,x.coordinates,!0,m,_));break;case"Polygon":_=Math.min(_,du(d,!1,x.coordinates,m,_))}if(_===0)return _}return _})(e,this.geometries);if(e.geometryType()==="LineString")return(function(n,s){let c=n.geometry(),d=c.flat().map((x=>wd([x.x,x.y],n.canonical)));if(c.length===0)return NaN;let m=new Ed(d[0][1]),_=1/0;for(let x of s){switch(x.type){case"Point":_=Math.min(_,pu(d,!0,[x.coordinates],!1,m,_));break;case"LineString":_=Math.min(_,pu(d,!0,x.coordinates,!0,m,_));break;case"Polygon":_=Math.min(_,du(d,!0,x.coordinates,m,_))}if(_===0)return _}return _})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(n,s){let c=n.geometry();if(c.length===0||c[0].length===0)return NaN;let d=cu(c,0).map((x=>x.map((b=>b.map((S=>wd([S.x,S.y],n.canonical))))))),m=new Ed(d[0][0][0][1]),_=1/0;for(let x of s)for(let b of d){switch(x.type){case"Point":_=Math.min(_,du([x.coordinates],!1,b,m,_));break;case"LineString":_=Math.min(_,du(x.coordinates,!0,b,m,_));break;case"Polygon":_=Math.min(_,Bt(b,x.coordinates,m,_))}if(_===0)return _}return _})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Xl{constructor(e){this.type=ht,this.key=e}static parse(e,n){if(e.length!==2)return n.error(`Expected 1 argument, but found ${e.length-1} instead.`);let s=e[1];return s==null?n.error("Global state property must be defined."):typeof s!="string"?n.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new Xl(s)}evaluate(e){var n;let s=(n=e.globals)===null||n===void 0?void 0:n.globalState;return s&&Object.keys(s).length!==0?jl(s,this.key):null}eachChild(){}outputDefined(){return!1}}let qs={"==":bd,"!=":Qf,">":Ns,"<":u1,">=":xd,"<=":nu,array:cr,at:wt,boolean:cr,case:$r,coalesce:Gl,collator:ru,format:Vo,image:Us,in:dt,"index-of":Os,interpolate:Vi,"interpolate-hcl":Vi,"interpolate-lab":Vi,length:yr,let:ei,literal:pa,match:Tt,number:cr,"number-format":au,object:cr,slice:Bs,step:Fs,string:cr,"to-boolean":Ia,"to-color":Ia,"to-number":Ia,"to-string":Ia,var:Ls,within:qo,distance:Zo,"global-state":Xl};class Dr{constructor(e,n,s,c){this.name=e,this.type=n,this._evaluate=s,this.args=c}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,n){let s=e[0],c=Dr.definitions[s];if(!c)return n.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);let d=Array.isArray(c)?c[0]:c.type,m=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,_=m.filter((([b])=>!Array.isArray(b)||b.length===e.length-1)),x=null;for(let[b,S]of _){x=new Fo(n.registry,fu,n.path,null,n.scope);let w=[],A=!1;for(let E=1;E<e.length;E++){let R=e[E],I=Array.isArray(b)?b[E-1]:b.type,O=x.parse(R,1+w.length,I);if(!O){A=!0;break}w.push(O)}if(!A)if(Array.isArray(b)&&b.length!==w.length)x.error(`Expected ${b.length} arguments, but found ${w.length} instead.`);else{for(let E=0;E<w.length;E++){let R=Array.isArray(b)?b[E]:b.type,I=w[E];x.concat(E+1).checkSubtype(R,I.type)}if(x.errors.length===0)return new Dr(s,d,S,w)}}if(_.length===1)n.errors.push(...x.errors);else{let b=(_.length?_:m).map((([w])=>{return A=w,Array.isArray(A)?`(${A.map(Zt).join(", ")})`:`(${Zt(A.type)}...)`;var A})).join(" | "),S=[];for(let w=1;w<e.length;w++){let A=n.parse(e[w],1+S.length);if(!A)return null;S.push(Zt(A.type))}n.error(`Expected arguments of type ${b}, but found (${S.join(", ")}) instead.`)}return null}static register(e,n){Dr.definitions=n;for(let s in n)e[s]=Dr}}function hm(r,[e,n,s,c]){e=e.evaluate(r),n=n.evaluate(r),s=s.evaluate(r);let d=c?c.evaluate(r):1,m=ks(e,n,s,d);if(m)throw new Jt(m);return new pt(e/255,n/255,s/255,d,!1)}function dm(r,e){return r in e}function Id(r,e){let n=e[r];return n===void 0?null:n}function Ho(r){return{type:r}}function fu(r){if(r instanceof Ls)return fu(r.boundExpression);if(r instanceof Dr&&r.name==="error"||r instanceof ru||r instanceof qo||r instanceof Zo||r instanceof Xl)return!1;let e=r instanceof Ia||r instanceof cr,n=!0;return r.eachChild((s=>{n=e?n&&fu(s):n&&s instanceof pa})),!!n&&mu(r)&&gu(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function mu(r){if(r instanceof Dr&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof qo||r instanceof Zo)return!1;let e=!0;return r.eachChild((n=>{e&&!mu(n)&&(e=!1)})),e}function Yl(r){if(r instanceof Dr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((n=>{e&&!Yl(n)&&(e=!1)})),e}function gu(r,e){if(r instanceof Dr&&e.indexOf(r.name)>=0)return!1;let n=!0;return r.eachChild((s=>{n&&!gu(s,e)&&(n=!1)})),n}function pm(r){return{result:"success",value:r}}function Gs(r){return{result:"error",value:r}}function Zs(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function fm(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function kd(r){return!!r.expression&&r.expression.interpolated}function gt(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function _u(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Li(r)===Ra}function b1(r){return r}function mm(r,e){let n=r.stops&&typeof r.stops[0][0]=="object",s=n||!(n||r.property!==void 0),c=r.type||(kd(e)?"exponential":"interval"),d=(function(S){switch(S.type){case"color":return pt.parse;case"padding":return Pn.parse;case"numberArray":return yi.parse;case"colorArray":return st.parse;default:return null}})(e);if(d&&((r=Io({},r)).stops&&(r.stops=r.stops.map((S=>[S[0],d(S[1])]))),r.default=d(r.default?r.default:e.default)),r.colorSpace&&(m=r.colorSpace)!=="rgb"&&m!=="hcl"&&m!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var m;let _=(function(S){switch(S){case"exponential":return gm;case"interval":return w1;case"categorical":return x1;case"identity":return T1;default:throw new Error(`Unknown function type "${S}"`)}})(c),x,b;if(c==="categorical"){x=Object.create(null);for(let S of r.stops)x[S[0]]=S[1];b=typeof r.stops[0][0]}if(n){let S={},w=[];for(let R=0;R<r.stops.length;R++){let I=r.stops[R],O=I[0].zoom;S[O]===void 0&&(S[O]={zoom:O,type:r.type,property:r.property,default:r.default,stops:[]},w.push(O)),S[O].stops.push([I[0].value,I[1]])}let A=[];for(let R of w)A.push([S[R].zoom,mm(S[R],e)]);let E={name:"linear"};return{kind:"composite",interpolationType:E,interpolationFactor:Vi.interpolationFactor.bind(void 0,E),zoomStops:A.map((R=>R[0])),evaluate:({zoom:R},I)=>gm({stops:A,base:r.base},e,R).evaluate(R,I)}}if(s){let S=c==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:Vi.interpolationFactor.bind(void 0,S),zoomStops:r.stops.map((w=>w[0])),evaluate:({zoom:w})=>_(r,e,w,x,b)}}return{kind:"source",evaluate(S,w){let A=w&&w.properties?w.properties[r.property]:void 0;return A===void 0?Wl(r.default,e.default):_(r,e,A,x,b)}}}function Wl(r,e,n){return r!==void 0?r:e!==void 0?e:n!==void 0?n:void 0}function x1(r,e,n,s,c){return Wl(typeof n===c?s[n]:void 0,r.default,e.default)}function w1(r,e,n){if(gt(n)!=="number")return Wl(r.default,e.default);let s=r.stops.length;if(s===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[s-1][0])return r.stops[s-1][1];let c=No(r.stops.map((d=>d[0])),n);return r.stops[c][1]}function gm(r,e,n){let s=r.base!==void 0?r.base:1;if(gt(n)!=="number")return Wl(r.default,e.default);let c=r.stops.length;if(c===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[c-1][0])return r.stops[c-1][1];let d=No(r.stops.map((S=>S[0])),n),m=(function(S,w,A,E){let R=E-A,I=S-A;return R===0?0:w===1?I/R:(Math.pow(w,I)-1)/(Math.pow(w,R)-1)})(n,s,r.stops[d][0],r.stops[d+1][0]),_=r.stops[d][1],x=r.stops[d+1][1],b=_r[e.type]||b1;return typeof _.evaluate=="function"?{evaluate(...S){let w=_.evaluate.apply(void 0,S),A=x.evaluate.apply(void 0,S);if(w!==void 0&&A!==void 0)return b(w,A,m,r.colorSpace)}}:b(_,x,m,r.colorSpace)}function T1(r,e,n){switch(e.type){case"color":n=pt.parse(n);break;case"formatted":n=lr.fromString(n.toString());break;case"resolvedImage":n=gr.fromString(n.toString());break;case"padding":n=Pn.parse(n);break;case"colorArray":n=st.parse(n);break;case"numberArray":n=yi.parse(n);break;default:gt(n)===e.type||e.type==="enum"&&e.values[n]||(n=void 0)}return Wl(n,r.default,e.default)}Dr.register(qs,{error:[{kind:"error"},[ct],(r,[e])=>{throw new Jt(e.evaluate(r))}],typeof:[ct,[ht],(r,[e])=>Zt(Li(e.evaluate(r)))],"to-rgba":[Tn(Ze,4),[mr],(r,[e])=>{let[n,s,c,d]=e.evaluate(r).rgb;return[255*n,255*s,255*c,d]}],rgb:[mr,[Ze,Ze,Ze],hm],rgba:[mr,[Ze,Ze,Ze,Ze],hm],has:{type:mt,overloads:[[[ct],(r,[e])=>dm(e.evaluate(r),r.properties())],[[ct,Ra],(r,[e,n])=>dm(e.evaluate(r),n.evaluate(r))]]},get:{type:ht,overloads:[[[ct],(r,[e])=>Id(e.evaluate(r),r.properties())],[[ct,Ra],(r,[e,n])=>Id(e.evaluate(r),n.evaluate(r))]]},"feature-state":[ht,[ct],(r,[e])=>Id(e.evaluate(r),r.featureState||{})],properties:[Ra,[],r=>r.properties()],"geometry-type":[ct,[],r=>r.geometryType()],id:[ht,[],r=>r.id()],zoom:[Ze,[],r=>r.globals.zoom],"heatmap-density":[Ze,[],r=>r.globals.heatmapDensity||0],elevation:[Ze,[],r=>r.globals.elevation||0],"line-progress":[Ze,[],r=>r.globals.lineProgress||0],accumulated:[ht,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Ze,Ho(Ze),(r,e)=>{let n=0;for(let s of e)n+=s.evaluate(r);return n}],"*":[Ze,Ho(Ze),(r,e)=>{let n=1;for(let s of e)n*=s.evaluate(r);return n}],"-":{type:Ze,overloads:[[[Ze,Ze],(r,[e,n])=>e.evaluate(r)-n.evaluate(r)],[[Ze],(r,[e])=>-e.evaluate(r)]]},"/":[Ze,[Ze,Ze],(r,[e,n])=>e.evaluate(r)/n.evaluate(r)],"%":[Ze,[Ze,Ze],(r,[e,n])=>e.evaluate(r)%n.evaluate(r)],ln2:[Ze,[],()=>Math.LN2],pi:[Ze,[],()=>Math.PI],e:[Ze,[],()=>Math.E],"^":[Ze,[Ze,Ze],(r,[e,n])=>Math.pow(e.evaluate(r),n.evaluate(r))],sqrt:[Ze,[Ze],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[Ze,[Ze],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[Ze,[Ze],(r,[e])=>Math.log(e.evaluate(r))],log2:[Ze,[Ze],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[Ze,[Ze],(r,[e])=>Math.sin(e.evaluate(r))],cos:[Ze,[Ze],(r,[e])=>Math.cos(e.evaluate(r))],tan:[Ze,[Ze],(r,[e])=>Math.tan(e.evaluate(r))],asin:[Ze,[Ze],(r,[e])=>Math.asin(e.evaluate(r))],acos:[Ze,[Ze],(r,[e])=>Math.acos(e.evaluate(r))],atan:[Ze,[Ze],(r,[e])=>Math.atan(e.evaluate(r))],min:[Ze,Ho(Ze),(r,e)=>Math.min(...e.map((n=>n.evaluate(r))))],max:[Ze,Ho(Ze),(r,e)=>Math.max(...e.map((n=>n.evaluate(r))))],abs:[Ze,[Ze],(r,[e])=>Math.abs(e.evaluate(r))],round:[Ze,[Ze],(r,[e])=>{let n=e.evaluate(r);return n<0?-Math.round(-n):Math.round(n)}],floor:[Ze,[Ze],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[Ze,[Ze],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[mt,[ct,ht],(r,[e,n])=>r.properties()[e.value]===n.value],"filter-id-==":[mt,[ht],(r,[e])=>r.id()===e.value],"filter-type-==":[mt,[ct],(r,[e])=>r.geometryType()===e.value],"filter-<":[mt,[ct,ht],(r,[e,n])=>{let s=r.properties()[e.value],c=n.value;return typeof s==typeof c&&s<c}],"filter-id-<":[mt,[ht],(r,[e])=>{let n=r.id(),s=e.value;return typeof n==typeof s&&n<s}],"filter->":[mt,[ct,ht],(r,[e,n])=>{let s=r.properties()[e.value],c=n.value;return typeof s==typeof c&&s>c}],"filter-id->":[mt,[ht],(r,[e])=>{let n=r.id(),s=e.value;return typeof n==typeof s&&n>s}],"filter-<=":[mt,[ct,ht],(r,[e,n])=>{let s=r.properties()[e.value],c=n.value;return typeof s==typeof c&&s<=c}],"filter-id-<=":[mt,[ht],(r,[e])=>{let n=r.id(),s=e.value;return typeof n==typeof s&&n<=s}],"filter->=":[mt,[ct,ht],(r,[e,n])=>{let s=r.properties()[e.value],c=n.value;return typeof s==typeof c&&s>=c}],"filter-id->=":[mt,[ht],(r,[e])=>{let n=r.id(),s=e.value;return typeof n==typeof s&&n>=s}],"filter-has":[mt,[ht],(r,[e])=>e.value in r.properties()],"filter-has-id":[mt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[mt,[Tn(ct)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[mt,[Tn(ht)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[mt,[ct,Tn(ht)],(r,[e,n])=>n.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[mt,[ct,Tn(ht)],(r,[e,n])=>(function(s,c,d,m){for(;d<=m;){let _=d+m>>1;if(c[_]===s)return!0;c[_]>s?m=_-1:d=_+1}return!1})(r.properties()[e.value],n.value,0,n.value.length-1)],all:{type:mt,overloads:[[[mt,mt],(r,[e,n])=>e.evaluate(r)&&n.evaluate(r)],[Ho(mt),(r,e)=>{for(let n of e)if(!n.evaluate(r))return!1;return!0}]]},any:{type:mt,overloads:[[[mt,mt],(r,[e,n])=>e.evaluate(r)||n.evaluate(r)],[Ho(mt),(r,e)=>{for(let n of e)if(n.evaluate(r))return!0;return!1}]]},"!":[mt,[mt],(r,[e])=>!e.evaluate(r)],"is-supported-script":[mt,[ct],(r,[e])=>{let n=r.globals&&r.globals.isSupportedScript;return!n||n(e.evaluate(r))}],upcase:[ct,[ct],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[ct,[ct],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[ct,Ho(ht),(r,e)=>e.map((n=>Oo(n.evaluate(r)))).join("")],split:[Tn(ct),[ct,ct],(r,[e,n])=>e.evaluate(r).split(n.evaluate(r))],join:[ct,[Tn(ct),ct],(r,[e,n])=>e.evaluate(r).join(n.evaluate(r))],"resolved-locale":[ct,[Ol],(r,[e])=>e.evaluate(r).resolvedLocale()]});class Kl{constructor(e,n,s){this.expression=e,this._warningHistory={},this._evaluator=new yd,this._defaultValue=n?(function(c){if(c.type==="color"&&_u(c.default))return new pt(0,0,0,0);switch(c.type){case"color":return pt.parse(c.default)||null;case"padding":return Pn.parse(c.default)||null;case"numberArray":return yi.parse(c.default)||null;case"colorArray":return st.parse(c.default)||null;case"variableAnchorOffsetCollection":return $n.parse(c.default)||null;case"projectionDefinition":return Xn.parse(c.default)||null;default:return c.default===void 0?null:c.default}})(n):null,this._enumValues=n&&n.type==="enum"?n.values:null,this._globalState=s}evaluateWithoutErrorHandling(e,n,s,c,d,m){return this._globalState&&(e=$s(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=n,this._evaluator.featureState=s,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=m,this.expression.evaluate(this._evaluator)}evaluate(e,n,s,c,d,m){this._globalState&&(e=$s(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=n||null,this._evaluator.featureState=s||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=m||null;try{let _=this.expression.evaluate(this._evaluator);if(_==null||typeof _=="number"&&_!=_)return this._defaultValue;if(this._enumValues&&!(_ in this._enumValues))throw new Jt(`Expected value to be one of ${Object.keys(this._enumValues).map((x=>JSON.stringify(x))).join(", ")}, but found ${JSON.stringify(_)} instead.`);return _}catch(_){return this._warningHistory[_.message]||(this._warningHistory[_.message]=!0,typeof console<"u"&&console.warn(_.message)),this._defaultValue}}}function yu(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in qs}function Ql(r,e,n){let s=new Fo(qs,fu,[],e?(function(d){let m={color:mr,string:ct,number:Ze,enum:ct,boolean:mt,formatted:Bl,padding:Wc,numberArray:Fl,colorArray:zs,projectionDefinition:Yc,resolvedImage:Ds,variableAnchorOffsetCollection:Nl};return d.type==="array"?Tn(m[d.value]||ht,d.length):m[d.type]})(e):void 0),c=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return c?pm(new Kl(c,e,n)):Gs(s.errors)}class vu{constructor(e,n,s){this.kind=e,this._styleExpression=n,this.isStateDependent=e!=="constant"&&!Yl(n.expression),this.globalStateRefs=Hs(n.expression),this._globalState=s}evaluateWithoutErrorHandling(e,n,s,c,d,m){return this._globalState&&(e=$s(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,n,s,c,d,m)}evaluate(e,n,s,c,d,m){return this._globalState&&(e=$s(e,this._globalState)),this._styleExpression.evaluate(e,n,s,c,d,m)}}class bu{constructor(e,n,s,c,d){this.kind=e,this.zoomStops=s,this._styleExpression=n,this.isStateDependent=e!=="camera"&&!Yl(n.expression),this.globalStateRefs=Hs(n.expression),this.interpolationType=c,this._globalState=d}evaluateWithoutErrorHandling(e,n,s,c,d,m){return this._globalState&&(e=$s(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,n,s,c,d,m)}evaluate(e,n,s,c,d,m){return this._globalState&&(e=$s(e,this._globalState)),this._styleExpression.evaluate(e,n,s,c,d,m)}interpolationFactor(e,n,s){return this.interpolationType?Vi.interpolationFactor(this.interpolationType,e,n,s):0}}function _m(r,e,n){let s=Ql(r,e,n);if(s.result==="error")return s;let c=s.value.expression,d=mu(c);if(!d&&!Zs(e))return Gs([new wn("","data expressions not supported")]);let m=gu(c,["zoom"]);if(!m&&!fm(e))return Gs([new wn("","zoom expressions not supported")]);let _=$o(c);return _||m?_ instanceof wn?Gs([_]):_ instanceof Vi&&!kd(e)?Gs([new wn("",'"interpolate" expressions cannot be used with this property')]):pm(_?new bu(d?"camera":"composite",s.value,_.labels,_ instanceof Vi?_.interpolation:void 0,n):new vu(d?"constant":"source",s.value,n)):Gs([new wn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class xu{constructor(e,n){this._parameters=e,this._specification=n,Io(this,mm(this._parameters,this._specification))}static deserialize(e){return new xu(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function $o(r){let e=null;if(r instanceof ei)e=$o(r.result);else if(r instanceof Gl){for(let n of r.args)if(e=$o(n),e)break}else(r instanceof Fs||r instanceof Vi)&&r.input instanceof Dr&&r.input.name==="zoom"&&(e=r);return e instanceof wn||r.eachChild((n=>{let s=$o(n);s instanceof wn?e=s:!e&&s?e=new wn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new wn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Hs(r,e=new Set){return r instanceof Xl&&e.add(r.key),r.eachChild((n=>{Hs(n,e)})),e}function $s(r,e){let{zoom:n,heatmapDensity:s,elevation:c,lineProgress:d,isSupportedScript:m,accumulated:_}=r??{};return{zoom:n,heatmapDensity:s,elevation:c,lineProgress:d,isSupportedScript:m,accumulated:_,globalState:e}}function Ld(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(let e of r.slice(1))if(!Ld(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}let S1={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Jl(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Ld(r)||(r=ec(r));let n=Ql(r,S1,e);if(n.result==="error")throw new Error(n.value.map((s=>`${s.key}: ${s.message}`)).join(", "));return{filter:(s,c,d)=>n.value.evaluate(s,c,{},d),needGeometry:Od(r),getGlobalStateRefs:()=>Hs(n.value.expression)}}function M1(r,e){return r<e?-1:r>e?1:0}function Od(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(Od(r[e]))return!0;return!1}function ec(r){if(!r)return!0;let e=r[0];return r.length<=1?e!=="any":e==="=="?Bd(r[1],r[2],"=="):e==="!="?tc(Bd(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Bd(r[1],r[2],e):e==="any"?(n=r.slice(1),["any"].concat(n.map(ec))):e==="all"?["all"].concat(r.slice(1).map(ec)):e==="none"?["all"].concat(r.slice(1).map(ec).map(tc)):e==="in"?ym(r[1],r.slice(2)):e==="!in"?tc(ym(r[1],r.slice(2))):e==="has"?Fd(r[1]):e!=="!has"||tc(Fd(r[1]));var n}function Bd(r,e,n){switch(r){case"$type":return[`filter-type-${n}`,e];case"$id":return[`filter-id-${n}`,e];default:return[`filter-${n}`,r,e]}}function ym(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((n=>typeof n!=typeof e[0]))?["filter-in-large",r,["literal",e.sort(M1)]]:["filter-in-small",r,["literal",e]]}}function Fd(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function tc(r){return["!",r]}function wu(r){let e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let c="[";for(let d of r)c+=`${wu(d)},`;return`${c}]`}let n=Object.keys(r).sort(),s="{";for(let c=0;c<n.length;c++)s+=`${JSON.stringify(n[c])}:${wu(r[n[c]])},`;return`${s}}`}function E1(r){let e="";for(let n of sd)e+=`/${wu(r[n])}`;return e}function vm(r){let e=r.value;return e?[new Ve(r.key,e,"constants have been deprecated as of v8")]:[]}function Oi(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Xo(r){if(Array.isArray(r))return r.map(Xo);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){let e={};for(let n in r)e[n]=Xo(r[n]);return e}return Oi(r)}function ur(r){let e=r.key,n=r.value,s=r.valueSpec||{},c=r.objectElementValidators||{},d=r.style,m=r.styleSpec,_=r.validateSpec,x=[],b=gt(n);if(b!=="object")return[new Ve(e,n,`object expected, ${b} found`)];for(let S in n){let w=S.split(".")[0],A=jl(s,w)||s["*"],E;if(jl(c,w))E=c[w];else if(jl(s,w)){if(n[S]===void 0)continue;E=_}else if(c["*"])E=c["*"];else{if(!s["*"]){x.push(new Ve(e,n[S],`unknown property "${S}"`));continue}E=_}x=x.concat(E({key:(e&&`${e}.`)+S,value:n[S],valueSpec:A,style:d,styleSpec:m,object:n,objectKey:S,validateSpec:_},n))}for(let S in s)c[S]||s[S].required&&s[S].default===void 0&&n[S]===void 0&&x.push(new Ve(e,n,`missing required property "${S}"`));return x}function Tu(r){let e=r.value,n=r.valueSpec,s=r.style,c=r.styleSpec,d=r.key,m=r.arrayElementValidator||r.validateSpec;if(gt(e)!=="array")return[new Ve(d,e,`array expected, ${gt(e)} found`)];if(n.length&&e.length!==n.length)return[new Ve(d,e,`array length ${n.length} expected, length ${e.length} found`)];let _={type:n.value,values:n.values};c.$version<7&&(_.function=n.function),gt(n.value)==="object"&&(_=n.value);let x=[];for(let b=0;b<e.length;b++)x=x.concat(m({array:e,arrayIndex:b,value:e[b],valueSpec:_,validateSpec:r.validateSpec,style:s,styleSpec:c,key:`${d}[${b}]`}));return x}function Xs(r){let e=r.key,n=r.value,s=r.valueSpec,c=gt(n);return c==="number"&&n!=n&&(c="NaN"),c!=="number"?[new Ve(e,n,`number expected, ${c} found`)]:"minimum"in s&&n<s.minimum?[new Ve(e,n,`${n} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&n>s.maximum?[new Ve(e,n,`${n} is greater than the maximum value ${s.maximum}`)]:[]}function Su(r){let e=r.valueSpec,n=Oi(r.value.type),s,c,d,m={},_=n!=="categorical"&&r.value.property===void 0,x=!_,b=gt(r.value.stops)==="array"&&gt(r.value.stops[0])==="array"&&gt(r.value.stops[0][0])==="object",S=ur({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(E){if(n==="identity")return[new Ve(E.key,E.value,'identity function may not have a "stops" property')];let R=[],I=E.value;return R=R.concat(Tu({key:E.key,value:I,valueSpec:E.valueSpec,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec,arrayElementValidator:w})),gt(I)==="array"&&I.length===0&&R.push(new Ve(E.key,I,"array must have at least one stop")),R},default:function(E){return E.validateSpec({key:E.key,value:E.value,valueSpec:e,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec})}}});return n==="identity"&&_&&S.push(new Ve(r.key,r.value,'missing required property "property"')),n==="identity"||r.value.stops||S.push(new Ve(r.key,r.value,'missing required property "stops"')),n==="exponential"&&r.valueSpec.expression&&!kd(r.valueSpec)&&S.push(new Ve(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(x&&!Zs(r.valueSpec)?S.push(new Ve(r.key,r.value,"property functions not supported")):_&&!fm(r.valueSpec)&&S.push(new Ve(r.key,r.value,"zoom functions not supported"))),n!=="categorical"&&!b||r.value.property!==void 0||S.push(new Ve(r.key,r.value,'"property" property is required')),S;function w(E){let R=[],I=E.value,O=E.key;if(gt(I)!=="array")return[new Ve(O,I,`array expected, ${gt(I)} found`)];if(I.length!==2)return[new Ve(O,I,`array length 2 expected, length ${I.length} found`)];if(b){if(gt(I[0])!=="object")return[new Ve(O,I,`object expected, ${gt(I[0])} found`)];if(I[0].zoom===void 0)return[new Ve(O,I,"object stop key must have zoom")];if(I[0].value===void 0)return[new Ve(O,I,"object stop key must have value")];if(d&&d>Oi(I[0].zoom))return[new Ve(O,I[0].zoom,"stop zoom values must appear in ascending order")];Oi(I[0].zoom)!==d&&(d=Oi(I[0].zoom),c=void 0,m={}),R=R.concat(ur({key:`${O}[0]`,value:I[0],valueSpec:{zoom:{}},validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec,objectElementValidators:{zoom:Xs,value:A}}))}else R=R.concat(A({key:`${O}[0]`,value:I[0],validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec},I));return yu(Xo(I[1]))?R.concat([new Ve(`${O}[1]`,I[1],"expressions are not allowed in function stops.")]):R.concat(E.validateSpec({key:`${O}[1]`,value:I[1],valueSpec:e,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec}))}function A(E,R){let I=gt(E.value),O=Oi(E.value),F=E.value!==null?E.value:R;if(s){if(I!==s)return[new Ve(E.key,F,`${I} stop domain type must match previous stop domain type ${s}`)]}else s=I;if(I!=="number"&&I!=="string"&&I!=="boolean")return[new Ve(E.key,F,"stop domain value must be a number, string, or boolean")];if(I!=="number"&&n!=="categorical"){let V=`number expected, ${I} found`;return Zs(e)&&n===void 0&&(V+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ve(E.key,F,V)]}return n!=="categorical"||I!=="number"||isFinite(O)&&Math.floor(O)===O?n!=="categorical"&&I==="number"&&c!==void 0&&O<c?[new Ve(E.key,F,"stop domain values must appear in ascending order")]:(c=O,n==="categorical"&&O in m?[new Ve(E.key,F,"stop domain values must be unique")]:(m[O]=!0,[])):[new Ve(E.key,F,`integer expected, found ${O}`)]}}function ao(r){let e=(r.expressionContext==="property"?_m:Ql)(Xo(r.value),r.valueSpec);if(e.result==="error")return e.value.map((s=>new Ve(`${r.key}${s.key}`,r.value,s.message)));let n=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!n.outputDefined())return[new Ve(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Yl(n))return[new Ve(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Yl(n))return[new Ve(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!gu(n,["zoom","feature-state"]))return[new Ve(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!mu(n))return[new Ve(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ic(r){let e=r.key,n=r.value,s=gt(n);return s!=="string"?[new Ve(e,n,`color expected, ${s} found`)]:pt.parse(String(n))?[]:[new Ve(e,n,`color expected, "${n}" found`)]}function Yo(r){let e=r.key,n=r.value,s=r.valueSpec,c=[];return Array.isArray(s.values)?s.values.indexOf(Oi(n))===-1&&c.push(new Ve(e,n,`expected one of [${s.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(s.values).indexOf(Oi(n))===-1&&c.push(new Ve(e,n,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(n)} found`)),c}function Ys(r){return Ld(Xo(r.value))?ao(Io({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):bm(r)}function bm(r){let e=r.value,n=r.key;if(gt(e)!=="array")return[new Ve(n,e,`array expected, ${gt(e)} found`)];let s=r.styleSpec,c,d=[];if(e.length<1)return[new Ve(n,e,"filter array must have at least 1 element")];switch(d=d.concat(Yo({key:`${n}[0]`,value:e[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),Oi(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Oi(e[1])==="$type"&&d.push(new Ve(n,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&d.push(new Ve(n,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=gt(e[1]),c!=="string"&&d.push(new Ve(`${n}[1]`,e[1],`string expected, ${c} found`)));for(let m=2;m<e.length;m++)c=gt(e[m]),Oi(e[1])==="$type"?d=d.concat(Yo({key:`${n}[${m}]`,value:e[m],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new Ve(`${n}[${m}]`,e[m],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let m=1;m<e.length;m++)d=d.concat(bm({key:`${n}[${m}]`,value:e[m],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":c=gt(e[1]),e.length!==2?d.push(new Ve(n,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new Ve(`${n}[1]`,e[1],`string expected, ${c} found`))}return d}function xm(r,e){let n=r.key,s=r.validateSpec,c=r.style,d=r.styleSpec,m=r.value,_=r.objectKey,x=d[`${e}_${r.layerType}`];if(!x)return[];let b=_.match(/^(.*)-transition$/);if(e==="paint"&&b&&x[b[1]]&&x[b[1]].transition)return s({key:n,value:m,valueSpec:d.transition,style:c,styleSpec:d});let S=r.valueSpec||x[_];if(!S)return[new Ve(n,m,`unknown property "${_}"`)];let w;if(gt(m)==="string"&&Zs(S)&&!S.tokens&&(w=/^{([^}]+)}$/.exec(m)))return[new Ve(n,m,`"${_}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];let A=[];return r.layerType==="symbol"&&_==="text-font"&&_u(Xo(m))&&Oi(m.type)==="identity"&&A.push(new Ve(n,m,'"text-font" does not support identity functions')),A.concat(s({key:r.key,value:m,valueSpec:S,style:c,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:_}))}function wm(r){return xm(r,"paint")}function Tm(r){return xm(r,"layout")}function Sm(r){var e,n;let s=[],c=r.value,d=r.key,m=r.style,_=r.styleSpec;if(gt(c)!=="object")return[new Ve(d,c,`object expected, ${gt(c)} found`)];c.type||c.ref||s.push(new Ve(d,c,'either "type" or "ref" is required'));let x=Oi(c.type),b=Oi(c.ref);if(c.id){let S=Oi(c.id);for(let w=0;w<r.arrayIndex;w++){let A=m.layers[w];Oi(A.id)===S&&s.push(new Ve(d,c.id,`duplicate layer id "${c.id}", previously used at line ${A.id.__line__}`))}}if("ref"in c){let S;["type","source","source-layer","filter","layout"].forEach((w=>{w in c&&s.push(new Ve(d,c[w],`"${w}" is prohibited for ref layers`))})),m.layers.forEach((w=>{Oi(w.id)===b&&(S=w)})),S?S.ref?s.push(new Ve(d,c.ref,"ref cannot reference another ref layer")):x=Oi(S.type):s.push(new Ve(d,c.ref,`ref layer "${b}" not found`))}else if(x!=="background")if(c.source){let S=m.sources&&m.sources[c.source],w=S&&Oi(S.type);S?w==="vector"&&x==="raster"?s.push(new Ve(d,c.source,`layer "${c.id}" requires a raster source`)):w!=="raster-dem"&&x==="hillshade"||w!=="raster-dem"&&x==="color-relief"?s.push(new Ve(d,c.source,`layer "${c.id}" requires a raster-dem source`)):w==="raster"&&x!=="raster"?s.push(new Ve(d,c.source,`layer "${c.id}" requires a vector source`)):w!=="vector"||c["source-layer"]?w==="raster-dem"&&x!=="hillshade"&&x!=="color-relief"?s.push(new Ve(d,c.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):x!=="line"||!c.paint||!c.paint["line-gradient"]||w==="geojson"&&S.lineMetrics||s.push(new Ve(d,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new Ve(d,c,`layer "${c.id}" must specify a "source-layer"`)):s.push(new Ve(d,c.source,`source "${c.source}" not found`))}else s.push(new Ve(d,c,'missing required property "source"'));return x==="raster"&&(!((e=c.paint)===null||e===void 0)&&e.resampling)&&(!((n=c.paint)===null||n===void 0)&&n["raster-resampling"])&&s.push(new Ve(d,c.paint,`layer "${c.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),s=s.concat(ur({key:d,value:c,valueSpec:_.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${d}.type`,value:c.type,valueSpec:_.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:c,objectKey:"type"}),filter:Ys,layout:S=>ur({layer:c,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":w=>Tm(Io({layerType:x},w))}}),paint:S=>ur({layer:c,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":w=>wm(Io({layerType:x},w))}})}})),s}function oo(r){let e=r.value,n=r.key,s=gt(e);return s!=="string"?[new Ve(n,e,`string expected, ${s} found`)]:[]}let Nd={promoteId:function({key:r,value:e}){if(gt(e)==="string")return oo({key:r,value:e});{let n=[];for(let s in e)n.push(...oo({key:`${r}.${s}`,value:e[s]}));return n}}};function Ud(r){let e=r.value,n=r.key,s=r.styleSpec,c=r.style,d=r.validateSpec;if(!e.type)return[new Ve(n,e,'"type" is required')];let m=Oi(e.type),_;switch(m){case"vector":case"raster":return _=ur({key:n,value:e,valueSpec:s[`source_${m.replace("-","_")}`],style:r.style,styleSpec:s,objectElementValidators:Nd,validateSpec:d}),_;case"raster-dem":return _=(function(x){var b;let S=(b=x.sourceName)!==null&&b!==void 0?b:"",w=x.value,A=x.styleSpec,E=A.source_raster_dem,R=x.style,I=[],O=gt(w);if(w===void 0)return I;if(O!=="object")return I.push(new Ve("source_raster_dem",w,`object expected, ${O} found`)),I;let F=Oi(w.encoding)==="custom",V=["redFactor","greenFactor","blueFactor","baseShift"],U=x.value.encoding?`"${x.value.encoding}"`:"Default";for(let j in w)!F&&V.includes(j)?I.push(new Ve(j,w[j],`In "${S}": "${j}" is only valid when "encoding" is set to "custom". ${U} encoding found`)):E[j]?I=I.concat(x.validateSpec({key:j,value:w[j],valueSpec:E[j],validateSpec:x.validateSpec,style:R,styleSpec:A})):I.push(new Ve(j,w[j],`unknown property "${j}"`));return I})({sourceName:n,value:e,style:r.style,styleSpec:s,validateSpec:d}),_;case"geojson":if(_=ur({key:n,value:e,valueSpec:s.source_geojson,style:c,styleSpec:s,validateSpec:d,objectElementValidators:Nd}),e.cluster)for(let x in e.clusterProperties){let[b,S]=e.clusterProperties[x],w=typeof b=="string"?[b,["accumulated"],["get",x]]:b;_.push(...ao({key:`${n}.${x}.map`,value:S,expressionContext:"cluster-map"})),_.push(...ao({key:`${n}.${x}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return _;case"video":return ur({key:n,value:e,valueSpec:s.source_video,style:c,validateSpec:d,styleSpec:s});case"image":return ur({key:n,value:e,valueSpec:s.source_image,style:c,validateSpec:d,styleSpec:s});case"canvas":return[new Ve(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Yo({key:`${n}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function nc(r){let e=r.value,n=r.styleSpec,s=n.light,c=r.style,d=[],m=gt(e);if(e===void 0)return d;if(m!=="object")return d=d.concat([new Ve("light",e,`object expected, ${m} found`)]),d;for(let _ in e){let x=_.match(/^(.*)-transition$/);d=d.concat(x&&s[x[1]]&&s[x[1]].transition?r.validateSpec({key:_,value:e[_],valueSpec:n.transition,validateSpec:r.validateSpec,style:c,styleSpec:n}):s[_]?r.validateSpec({key:_,value:e[_],valueSpec:s[_],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new Ve(_,e[_],`unknown property "${_}"`)])}return d}function Mm(r){let e=r.value,n=r.styleSpec,s=n.sky,c=r.style,d=gt(e);if(e===void 0)return[];if(d!=="object")return[new Ve("sky",e,`object expected, ${d} found`)];let m=[];for(let _ in e)m=m.concat(s[_]?r.validateSpec({key:_,value:e[_],valueSpec:s[_],style:c,styleSpec:n}):[new Ve(_,e[_],`unknown property "${_}"`)]);return m}function Vd(r){let e=r.value,n=r.styleSpec,s=n.terrain,c=r.style,d=[],m=gt(e);if(e===void 0)return d;if(m!=="object")return d=d.concat([new Ve("terrain",e,`object expected, ${m} found`)]),d;for(let _ in e)d=d.concat(s[_]?r.validateSpec({key:_,value:e[_],valueSpec:s[_],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new Ve(_,e[_],`unknown property "${_}"`)]);return d}function jd(r){let e=[],n=r.value,s=r.key;if(Array.isArray(n)){let c=[],d=[];for(let m in n)n[m].id&&c.includes(n[m].id)&&e.push(new Ve(s,n,`all the sprites' ids must be unique, but ${n[m].id} is duplicated`)),c.push(n[m].id),n[m].url&&d.includes(n[m].url)&&e.push(new Ve(s,n,`all the sprites' URLs must be unique, but ${n[m].url} is duplicated`)),d.push(n[m].url),e=e.concat(ur({key:`${s}[${m}]`,value:n[m],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return oo({key:s,value:n})}function Em(r){return!!r&&r.constructor===Object}function rc(r){return Em(r.value)?[]:[new Ve(r.key,r.value,`object expected, ${gt(r.value)} found`)]}let qd={"*":()=>[],array:Tu,boolean:function(r){let e=r.value,n=r.key,s=gt(e);return s!=="boolean"?[new Ve(n,e,`boolean expected, ${s} found`)]:[]},number:Xs,color:ic,constants:vm,enum:Yo,filter:Ys,function:Su,layer:Sm,object:ur,source:Ud,light:nc,sky:Mm,terrain:Vd,projection:function(r){let e=r.value,n=r.styleSpec,s=n.projection,c=r.style,d=gt(e);if(e===void 0)return[];if(d!=="object")return[new Ve("projection",e,`object expected, ${d} found`)];let m=[];for(let _ in e)m=m.concat(s[_]?r.validateSpec({key:_,value:e[_],valueSpec:s[_],style:c,styleSpec:n}):[new Ve(_,e[_],`unknown property "${_}"`)]);return m},projectionDefinition:function(r){let e=r.key,n=r.value;n=n instanceof String?n.valueOf():n;let s=gt(n);return s!=="array"||(function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"})(n)||(function(c){return!!["interpolate","step","literal"].includes(c[0])})(n)?["array","string"].includes(s)?[]:[new Ve(e,n,`projection expected, invalid type "${s}" found`)]:[new Ve(e,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:oo,formatted:function(r){return oo(r).length===0?[]:ao(r)},resolvedImage:function(r){return oo(r).length===0?[]:ao(r)},padding:function(r){let e=r.key,n=r.value;if(gt(n)==="array"){if(n.length<1||n.length>4)return[new Ve(e,n,`padding requires 1 to 4 values; ${n.length} values found`)];let s={type:"number"},c=[];for(let d=0;d<n.length;d++)c=c.concat(r.validateSpec({key:`${e}[${d}]`,value:n[d],validateSpec:r.validateSpec,valueSpec:s}));return c}return Xs({key:e,value:n,valueSpec:{}})},numberArray:function(r){let e=r.key,n=r.value;if(gt(n)==="array"){let s={type:"number"};if(n.length<1)return[new Ve(e,n,"array length at least 1 expected, length 0 found")];let c=[];for(let d=0;d<n.length;d++)c=c.concat(r.validateSpec({key:`${e}[${d}]`,value:n[d],validateSpec:r.validateSpec,valueSpec:s}));return c}return Xs({key:e,value:n,valueSpec:{}})},colorArray:function(r){let e=r.key,n=r.value;if(gt(n)==="array"){if(n.length<1)return[new Ve(e,n,"array length at least 1 expected, length 0 found")];let s=[];for(let c=0;c<n.length;c++)s=s.concat(ic({key:`${e}[${c}]`,value:n[c]}));return s}return ic({key:e,value:n})},variableAnchorOffsetCollection:function(r){let e=r.key,n=r.value,s=gt(n),c=r.styleSpec;if(s!=="array"||n.length<1||n.length%2!=0)return[new Ve(e,n,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let m=0;m<n.length;m+=2)d=d.concat(Yo({key:`${e}[${m}]`,value:n[m],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(Tu({key:`${e}[${m+1}]`,value:n[m+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:c}));return d},sprite:jd,state:rc,fontFaces:function(r){let e=r.key,n=r.value,s=r.validateSpec,c=r.styleSpec,d=r.style;if(!Em(n))return[new Ve(e,n,`object expected, ${gt(n)} found`)];let m=[];for(let _ in n){let x=n[_],b=gt(x);if(b==="string")m.push(...oo({key:`${e}.${_}`,value:x}));else if(b==="array"){let S={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[w,A]of x.entries())m.push(...ur({key:`${e}.${_}[${w}]`,value:A,valueSpec:S,styleSpec:c,style:d,validateSpec:s}))}else m.push(new Ve(`${e}.${_}`,x,`string or array expected, ${b} found`))}return m}};function ac(r){let e=r.value,n=r.valueSpec,s=r.styleSpec;return r.validateSpec=ac,n.expression&&_u(Oi(e))?Su(r):n.expression&&yu(Xo(e))?ao(r):n.type&&qd[n.type]?qd[n.type](r):ur(Io({},r,{valueSpec:n.type?s[n.type]:n}))}function Ws(r){let e=r.value,n=r.key,s=oo(r);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new Ve(n,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new Ve(n,e,'"glyphs" url must include a "{range}" token'))),s}function Pr(r,e=Ce){let n=[];return n=n.concat(ac({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:ac,objectElementValidators:{glyphs:Ws,"*":()=>[]}})),r.constants&&(n=n.concat(vm({key:"constants",value:r.constants}))),Cm(n)}function Yr(r){return function(e){return r(Object.assign({},e,{validateSpec:ac}))}}function Cm(r){return[].concat(r).sort(((e,n)=>e.line-n.line))}function Wr(r){return function(...e){return Cm(r.apply(this,e))}}Pr.source=Wr(Yr(Ud)),Pr.sprite=Wr(Yr(jd)),Pr.glyphs=Wr(Yr(Ws)),Pr.light=Wr(Yr(nc)),Pr.sky=Wr(Yr(Mm)),Pr.terrain=Wr(Yr(Vd)),Pr.state=Wr(Yr(rc)),Pr.layer=Wr(Yr(Sm)),Pr.filter=Wr(Yr(Ys)),Pr.paintProperty=Wr(Yr(wm)),Pr.layoutProperty=Wr(Yr(Tm));let C1={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class A1{constructor(e,n){this._globalState=n,this.setValue(e)}evaluate(){var e;return(e=this._literalValue)!==null&&e!==void 0?e:this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none")return this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let n=Ql(e,C1,this._globalState);if(n.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,new Error(n.value.map((s=>`${s.key}: ${s.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=n.value,this._globalStateRefs=Hs(n.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let oc=Ce,ma=Pr,vr=ma.light,sc=ma.sky,Am=ma.paintProperty,z1=ma.layoutProperty;function zm(r,e){let n=!1;if(e?.length)for(let s of e)r.fire(new eo(new Error(s.message))),n=!0;return n}class La{constructor(e,n,s){let c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let m=new Int32Array(this.arrayBuffer);e=m[0],this.d=(n=m[1])+2*(s=m[2]);for(let x=0;x<this.d*this.d;x++){let b=m[3+x],S=m[3+x+1];c.push(b===S?null:m.subarray(b,S))}let _=m[3+c.length+1];this.keys=m.subarray(m[3+c.length],_),this.bboxes=m.subarray(_),this.insert=this._insertReadonly}else{this.d=n+2*s;for(let m=0;m<this.d*this.d;m++)c.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=e,this.padding=s,this.scale=n/e,this.uid=0;let d=s/n*e;this.min=-d,this.max=e+d}insert(e,n,s,c,d){this._forEachCell(n,s,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(c),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,n,s,c,d,m){this.cells[d].push(m)}query(e,n,s,c,d){let m=this.min,_=this.max;if(e<=m&&n<=m&&_<=s&&_<=c&&!d)return[...this.keys];{let x=[];return this._forEachCell(e,n,s,c,this._queryCell,x,{},d),x}}_queryCell(e,n,s,c,d,m,_,x){let b=this.cells[d];if(b!==null){let S=this.keys,w=this.bboxes;for(let A of b)if(_[A]===void 0){let E=4*A;(x?x(w[E+0],w[E+1],w[E+2],w[E+3]):e<=w[E+2]&&n<=w[E+3]&&s>=w[E+0]&&c>=w[E+1])?(_[A]=!0,m.push(S[A])):_[A]=!1}}}_forEachCell(e,n,s,c,d,m,_,x){let b=this._convertToCellCoord(e),S=this._convertToCellCoord(n),w=this._convertToCellCoord(s),A=this._convertToCellCoord(c);for(let E=b;E<=w;E++)for(let R=S;R<=A;R++){let I=this.d*R+E;if((!x||x(this._convertFromCellCoord(E),this._convertFromCellCoord(R),this._convertFromCellCoord(E+1),this._convertFromCellCoord(R+1)))&&d.call(this,e,n,s,c,I,m,_,x))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,n=3+this.cells.length+1+1,s=0;for(let m of this.cells)s+=m.length;let c=new Int32Array(n+s+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=n;for(let m=0;m<e.length;m++){let _=e[m];c[3+m]=d,c.set(_,d),d+=_.length}return c[3+e.length]=d,c.set(this.keys,d),d+=this.keys.length,c[3+e.length+1]=d,c.set(this.bboxes,d),d+=this.bboxes.length,c.buffer}static serialize(e,n){let s=e.toArrayBuffer();return n&&n.push(s),{buffer:s}}static deserialize(e){return new La(e.buffer)}}let ga={};function Ye(r,e,n={}){if(ga[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),ga[r]={klass:e,omit:n.omit||[],shallow:n.shallow||[]}}Ye("Object",Object),Ye("Set",Set),Ye("TransferableGridIndex",La),Ye("Color",pt),Ye("Error",Error),Ye("AJAXError",Ut),Ye("ResolvedImage",gr),Ye("StylePropertyFunction",xu),Ye("StyleExpression",Kl,{omit:["_evaluator"]}),Ye("ZoomDependentExpression",bu),Ye("ZoomConstantExpression",vu),Ye("CompoundExpression",Dr,{omit:["_evaluate"]});for(let r in qs)qs[r]._classRegistryKey||Ye(`Expression_${r}`,qs[r]);function Dm(r){var e;return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||((e=r.constructor)===null||e===void 0?void 0:e.name)==="ArrayBuffer")}function lc(r){return r.$name||r.constructor._classRegistryKey}function Pm(r){return!(function(e){if(e===null||typeof e!="object")return!1;let n=lc(e);return n&&n!=="Object"})(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||Dm(r)||ki(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Oa(r,e){if(Pm(r))return(Dm(r)||ki(r))&&e&&e.push(r),ArrayBuffer.isView(r)&&e&&e.push(r.buffer),r instanceof ImageData&&e&&e.push(r.data.buffer),r;if(Array.isArray(r)){let d=[];for(let m of r)d.push(Oa(m,e));return d}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);let n=lc(r);if(!n)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!ga[n])throw new Error(`${n} is not registered.`);let{klass:s}=ga[n],c=s.serialize?s.serialize(r,e):{};if(s.serialize){if(c===e?.[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let d in r){if(!r.hasOwnProperty(d)||ga[n].omit.includes(d))continue;let m=r[d];c[d]=ga[n].shallow.includes(d)?m:Oa(m,e)}r instanceof Error&&(c.message=r.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(c.$name=n),c}function cc(r){if(Pm(r))return r;if(Array.isArray(r))return r.map(cc);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);let e=lc(r)||"Object";if(!ga[e])throw new Error(`can't deserialize unregistered class ${e}`);let{klass:n}=ga[e];if(!n)throw new Error(`can't deserialize unregistered class ${e}`);if(n.deserialize)return n.deserialize(r);let s=Object.create(n.prototype);for(let c of Object.keys(r)){if(c==="$name")continue;let d=r[c];s[c]=ga[e].shallow.includes(c)?d:cc(d)}return s}class Gd{constructor(){this.first=!0}update(e,n){let s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=n):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=n),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}function D1(r){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function Wo(r){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function Rm(r){return/\s/u.test(String.fromCodePoint(r))}function Zd(r){for(let e of r)if(Wo(e.codePointAt(0)))return!0;return!1}function Mu(r){for(let e of r)if(!Eu(e.codePointAt(0)))return!1;return!0}function Im(r){let e=r.map((n=>{try{return new RegExp(`\\p{sc=${n}}`,"u").source}catch{return null}})).filter((n=>n));return new RegExp(e.join("|"),"u")}let Hd=Im(["Arab","Dupl","Mong","Ougr","Syrc"]);function Eu(r){return!Hd.test(String.fromCodePoint(r))}function $d(r){return!(Wo(r)||(e=r,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))));var e}let km=Im(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Xd(r){return km.test(String.fromCodePoint(r))}function Lm(r,e){return!(!e&&Xd(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function Yd(r){for(let e of r)if(Xd(e.codePointAt(0)))return!0;return!1}let Ba=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(Ba.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,e){return l(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;let n=r.pluginURL,s=new Promise((d=>{this.loadScriptResolve=d}));e(n);let c=new Promise((d=>setTimeout((()=>d()),this.TIMEOUT)));if(yield Promise.race([s,c]),this.isParsed()){let d={pluginStatus:"loaded",pluginURL:n};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)}))}};class ti{constructor(e,n){this.isSupportedScript=Om,this.zoom=e,n?(this.now=n.now||0,this.fadeDuration=n.fadeDuration||0,this.zoomHistory=n.zoomHistory||new Gd,this.transition=n.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Gd,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,n=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:n+(1-n)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*n}}}function Om(r){return(function(e,n){for(let s of e)if(!Lm(s.codePointAt(0),n))return!1;return!0})(r,Ba.getRTLTextPluginStatus()==="loaded")}let Cu="-transition";class uc{constructor(e,n,s){this.property=e,this.value=n,this.expression=(function(c,d,m){if(_u(c))return new xu(c,d);if(yu(c)){let _=_m(c,d,m);if(_.result==="error")throw new Error(_.value.map((x=>`${x.key}: ${x.message}`)).join(", "));return _.value}{let _=c;return d.type==="color"&&typeof c=="string"?_=pt.parse(c):d.type!=="padding"||typeof c!="number"&&!Array.isArray(c)?d.type!=="numberArray"||typeof c!="number"&&!Array.isArray(c)?d.type!=="colorArray"||typeof c!="string"&&!Array.isArray(c)?d.type==="variableAnchorOffsetCollection"&&Array.isArray(c)?_=$n.parse(c):d.type==="projectionDefinition"&&typeof c=="string"&&(_=Xn.parse(c)):_=st.parse(c):_=yi.parse(c):_=Pn.parse(c),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>_}}})(n===void 0?e.specification.default:n,e.specification,s)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,n,s){return this.property.possiblyEvaluate(this,e,n,s)}}class Wd{constructor(e,n){this.property=e,this.value=new uc(e,void 0,n)}transitioned(e,n){return new Qd(this.property,this.value,n,pi({},e.transition,this.transition),e.now)}untransitioned(){return new Qd(this.property,this.value,null,{},0)}}class Kd{constructor(e,n){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=n}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return Xe(this._values[e].value.value)}setValue(e,n){Object.hasOwn(this._values,e)||(this._values[e]=new Wd(this._values[e].property,this._globalState)),this._values[e].value=new uc(this._values[e].property,n===null?void 0:Xe(n),this._globalState)}getTransition(e){return Xe(this._values[e].transition)}setTransition(e,n){Object.hasOwn(this._values,e)||(this._values[e]=new Wd(this._values[e].property,this._globalState)),this._values[e].transition=Xe(n)||void 0}serialize(){let e={};for(let n of Object.keys(this._values)){let s=this.getValue(n);s!==void 0&&(e[n]=s);let c=this.getTransition(n);c!==void 0&&(e[`${n}${Cu}`]=c)}return e}transitioned(e,n){let s=new Bm(this._properties);for(let c of Object.keys(this._values))s._values[c]=this._values[c].transitioned(e,n._values[c]);return s}untransitioned(){let e=new Bm(this._properties);for(let n of Object.keys(this._values))e._values[n]=this._values[n].untransitioned();return e}}class Qd{constructor(e,n,s,c,d){this.property=e,this.value=n,this.begin=d+c.delay||0,this.end=this.begin+c.duration||0,e.specification.transition&&(c.delay||c.duration)&&(this.prior=s)}possiblyEvaluate(e,n,s){let c=e.now||0,d=this.value.possiblyEvaluate(e,n,s),m=this.prior;if(m){if(c>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(c<this.begin)return m.possiblyEvaluate(e,n,s);{let _=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(m.possiblyEvaluate(e,n,s),d,Qt(_))}}return d}}class Bm{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,n,s){let c=new hc(this._properties);for(let d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(e,n,s);return c}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class P1{constructor(e,n){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=n}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return Xe(this._values[e].value)}setValue(e,n){this._values[e]=new uc(this._values[e].property,n===null?void 0:Xe(n),this._globalState)}serialize(){let e={};for(let n of Object.keys(this._values)){let s=this.getValue(n);s!==void 0&&(e[n]=s)}return e}possiblyEvaluate(e,n,s){let c=new hc(this._properties);for(let d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(e,n,s);return c}}class Kr{constructor(e,n,s){this.property=e,this.value=n,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,n,s,c){return this.property.evaluate(this.value,this.parameters,e,n,s,c)}}class hc{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Je{constructor(e){this.specification=e}possiblyEvaluate(e,n){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(n)}interpolate(e,n,s){let c=_r[this.specification.type];return c?c(e,n,s):e}}class it{constructor(e,n){this.specification=e,this.overrides=n}possiblyEvaluate(e,n,s,c){return new Kr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(n,null,{},s,c)}:e.expression,n)}interpolate(e,n,s){if(e.value.kind!=="constant"||n.value.kind!=="constant")return e;if(e.value.value===void 0||n.value.value===void 0)return new Kr(this,{kind:"constant",value:void 0},e.parameters);let c=_r[this.specification.type];if(c){let d=c(e.value.value,n.value.value,s);return new Kr(this,{kind:"constant",value:d},e.parameters)}return e}evaluate(e,n,s,c,d,m){return e.kind==="constant"?e.value:e.evaluate(n,s,c,d,m)}}class so extends it{possiblyEvaluate(e,n,s,c){if(e.value===void 0)return new Kr(this,{kind:"constant",value:void 0},n);if(e.expression.kind==="constant"){let d=e.expression.evaluate(n,null,{},s,c),m=e.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,_=this._calculate(m,m,m,n);return new Kr(this,{kind:"constant",value:_},n)}if(e.expression.kind==="camera"){let d=this._calculate(e.expression.evaluate({zoom:n.zoom-1}),e.expression.evaluate({zoom:n.zoom}),e.expression.evaluate({zoom:n.zoom+1}),n);return new Kr(this,{kind:"constant",value:d},n)}return new Kr(this,e.expression,n)}evaluate(e,n,s,c,d,m){if(e.kind==="source"){let _=e.evaluate(n,s,c,d,m);return this._calculate(_,_,_,n)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(n.zoom)-1},s,c),e.evaluate({zoom:Math.floor(n.zoom)},s,c),e.evaluate({zoom:Math.floor(n.zoom)+1},s,c),n):e.value}_calculate(e,n,s,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:n}:{from:s,to:n}}interpolate(e){return e}}class Fm{constructor(e){this.specification=e}possiblyEvaluate(e,n,s,c){if(e.value!==void 0){if(e.expression.kind==="constant"){let d=e.expression.evaluate(n,null,{},s,c);return this._calculate(d,d,d,n)}return this._calculate(e.expression.evaluate(new ti(Math.floor(n.zoom-1),n)),e.expression.evaluate(new ti(Math.floor(n.zoom),n)),e.expression.evaluate(new ti(Math.floor(n.zoom+1),n)),n)}}_calculate(e,n,s,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:n}:{from:s,to:n}}interpolate(e){return e}}class Ks{constructor(e){this.specification=e}possiblyEvaluate(e,n,s,c){return!!e.expression.evaluate(n,null,{},s,c)}interpolate(){return!1}}class Yn{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let n in e){let s=e[n];s.specification.overridable&&this.overridableProperties.push(n);let c=this.defaultPropertyValues[n]=new uc(s,void 0,void 0),d=this.defaultTransitionablePropertyValues[n]=new Wd(s,void 0);this.defaultTransitioningPropertyValues[n]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=c.possiblyEvaluate({})}}}Ye("DataDrivenProperty",it),Ye("DataConstantProperty",Je),Ye("CrossFadedDataDrivenProperty",so),Ye("CrossFadedProperty",Fm),Ye("ColorRampProperty",Ks);let Nm=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Au=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class Rr extends Po{constructor(e,n,s){if(super(),this.id=e.id,this.type=e.type,this._globalState=s,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(function(c,d){return new A1(c,d)})(this.visibility,s),e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Jl(e.filter,s)),n.layout&&(this._unevaluatedLayout=new P1(n.layout,s)),n.paint)){this._transitionablePaint=new Kd(n.paint,s);for(let c in e.paint)this.setPaintProperty(c,e.paint[c],{validate:!1});for(let c in e.layout)this.setLayoutProperty(c,e.layout[c],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new hc(n.paint)}}setFilter(e){this.filter=e,this._featureFilter=Jl(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){var n;if(e==="visibility")return this.visibility;if(!((n=this._transitionablePaint)===null||n===void 0)&&n.hasProperty(e))throw new Error(e+Nm);if(!this._unevaluatedLayout)throw new Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let n of this._visibilityExpression.getGlobalStateRefs())e.add(n);if(this._unevaluatedLayout)for(let n in this._unevaluatedLayout._values){let s=this._unevaluatedLayout._values[n];for(let c of s.getGlobalStateRefs())e.add(c)}for(let n of this._featureFilter.getGlobalStateRefs())e.add(n);return e}getPaintAffectingGlobalStateRefs(){var e;let n=new globalThis.Map;if(this._transitionablePaint)for(let s in this._transitionablePaint._values){let c=this._transitionablePaint._values[s].value;for(let d of c.getGlobalStateRefs()){let m=(e=n.get(d))!==null&&e!==void 0?e:[];m.push({name:s,value:c.value}),n.set(d,m)}}return n}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,n,s={}){var c;if(e==="visibility")return this.visibility=n,this._visibilityExpression.setValue(n),void this.recalculateVisibility();!((c=this._transitionablePaint)===null||c===void 0)&&c.hasProperty(e)?this.fire(new eo(new Error(e+Nm))):n!=null&&this._validate(z1,`layers.${this.id}.layout.${e}`,e,n,s)||this._unevaluatedLayout.setValue(e,n)}getPaintProperty(e){var n,s;if(e.endsWith(Cu)){let c=e.slice(0,-11);if(c==="visibility"||!((n=this._unevaluatedLayout)===null||n===void 0)&&n.hasProperty(c))throw new Error(e+Au);return this._transitionablePaint.getTransition(c)}if(e==="visibility"||!((s=this._unevaluatedLayout)===null||s===void 0)&&s.hasProperty(e))throw new Error(e+Au);return this._transitionablePaint.getValue(e)}setPaintProperty(e,n,s={}){var c;if(e==="visibility"||!((c=this._unevaluatedLayout)===null||c===void 0)&&c.hasProperty(e))return this.fire(new eo(new Error(e+Au))),!1;if(n!=null&&this._validate(Am,`layers.${this.id}.paint.${e}`,e,n,s))return!1;if(e.endsWith(Cu))return this._transitionablePaint.setTransition(e.slice(0,-11),n||void 0),!1;{let d=this._transitionablePaint._values[e],m=d.property.specification["property-type"]==="cross-faded-data-driven",_=d.value.isDataDriven(),x=d.value;this._transitionablePaint.setValue(e,n),this._handleSpecialPaintPropertyUpdate(e);let b=this._transitionablePaint._values[e].value;return b.isDataDriven()||_||m||this._handleOverridablePaintPropertyUpdate(e,x,b)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,n,s){return!1}isHidden(e=this.minzoom,n=!1){return!!(this.minzoom&&e<(n?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,n){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,n)}serialize(){var e,n;let s={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(e=this._unevaluatedLayout)===null||e===void 0?void 0:e.serialize(),paint:(n=this._transitionablePaint)===null||n===void 0?void 0:n.serialize()};return this.visibility&&(s.layout||(s.layout={}),s.layout.visibility=this.visibility),Ii(s,((c,d)=>!(c===void 0||d==="layout"&&!Object.keys(c).length||d==="paint"&&!Object.keys(c).length)))}_validate(e,n,s,c,d={}){return d?.validate!==!1&&zm(this,e.call(ma,{key:n,layerType:this.type,objectKey:s,value:c,styleSpec:Ce,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let n=this.paint.get(e);if(n instanceof Kr&&Zs(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}let Jd;var R1={get paint(){return Jd=Jd||new Yn({"raster-opacity":new Je(Ce.paint_raster["raster-opacity"]),"raster-hue-rotate":new Je(Ce.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Je(Ce.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Je(Ce.paint_raster["raster-brightness-max"]),"raster-saturation":new Je(Ce.paint_raster["raster-saturation"]),"raster-contrast":new Je(Ce.paint_raster["raster-contrast"]),resampling:new Je(Ce.paint_raster.resampling),"raster-resampling":new Je(Ce.paint_raster["raster-resampling"]),"raster-fade-duration":new Je(Ce.paint_raster["raster-fade-duration"])})}};class I1 extends Rr{constructor(e,n){super(e,R1,n)}}let k1={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class dc{constructor(e,n){this._structArray=e,this._pos1=n*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class vi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,n){return e._trim(),n&&(e.isTransferred=!0,n.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let n=Object.create(this.prototype);return n.arrayBuffer=e.arrayBuffer,n.length=e.length,n.capacity=e.arrayBuffer.byteLength/n.bytesPerElement,n._refreshViews(),n}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let n=this.uint8;this._refreshViews(),n&&this.uint8.set(n)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function ii(r,e=1){let n=0,s=0;return{members:r.map((c=>{let d=k1[c.type].BYTES_PER_ELEMENT,m=n=Um(n,Math.max(e,d)),_=c.components||1;return s=Math.max(s,d),n+=d*_,{name:c.name,type:c.type,components:_,offset:m}})),size:Um(n,Math.max(s,e)),alignment:e}}function Um(r,e){return Math.ceil(r/e)*e}class pc extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,n)}emplace(e,n,s){let c=2*e;return this.int16[c+0]=n,this.int16[c+1]=s,e}}pc.prototype.bytesPerElement=4,Ye("StructArrayLayout2i4",pc);class zu extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,n,s)}emplace(e,n,s,c){let d=3*e;return this.int16[d+0]=n,this.int16[d+1]=s,this.int16[d+2]=c,e}}zu.prototype.bytesPerElement=6,Ye("StructArrayLayout3i6",zu);class Du extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c){let d=this.length;return this.resize(d+1),this.emplace(d,e,n,s,c)}emplace(e,n,s,c,d){let m=4*e;return this.int16[m+0]=n,this.int16[m+1]=s,this.int16[m+2]=c,this.int16[m+3]=d,e}}Du.prototype.bytesPerElement=8,Ye("StructArrayLayout4i8",Du);class Pu extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m){let _=this.length;return this.resize(_+1),this.emplace(_,e,n,s,c,d,m)}emplace(e,n,s,c,d,m,_){let x=6*e;return this.int16[x+0]=n,this.int16[x+1]=s,this.int16[x+2]=c,this.int16[x+3]=d,this.int16[x+4]=m,this.int16[x+5]=_,e}}Pu.prototype.bytesPerElement=12,Ye("StructArrayLayout2i4i12",Pu);class ep extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m){let _=this.length;return this.resize(_+1),this.emplace(_,e,n,s,c,d,m)}emplace(e,n,s,c,d,m,_){let x=4*e,b=8*e;return this.int16[x+0]=n,this.int16[x+1]=s,this.uint8[b+4]=c,this.uint8[b+5]=d,this.uint8[b+6]=m,this.uint8[b+7]=_,e}}ep.prototype.bytesPerElement=8,Ye("StructArrayLayout2i4ub8",ep);class fc extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,n)}emplace(e,n,s){let c=2*e;return this.float32[c+0]=n,this.float32[c+1]=s,e}}fc.prototype.bytesPerElement=8,Ye("StructArrayLayout2f8",fc);class Fa extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x,b,S){let w=this.length;return this.resize(w+1),this.emplace(w,e,n,s,c,d,m,_,x,b,S)}emplace(e,n,s,c,d,m,_,x,b,S,w){let A=10*e;return this.uint16[A+0]=n,this.uint16[A+1]=s,this.uint16[A+2]=c,this.uint16[A+3]=d,this.uint16[A+4]=m,this.uint16[A+5]=_,this.uint16[A+6]=x,this.uint16[A+7]=b,this.uint16[A+8]=S,this.uint16[A+9]=w,e}}Fa.prototype.bytesPerElement=20,Ye("StructArrayLayout10ui20",Fa);class Ru extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x){let b=this.length;return this.resize(b+1),this.emplace(b,e,n,s,c,d,m,_,x)}emplace(e,n,s,c,d,m,_,x,b){let S=8*e;return this.uint16[S+0]=n,this.uint16[S+1]=s,this.uint16[S+2]=c,this.uint16[S+3]=d,this.uint16[S+4]=m,this.uint16[S+5]=_,this.uint16[S+6]=x,this.uint16[S+7]=b,e}}Ru.prototype.bytesPerElement=16,Ye("StructArrayLayout8ui16",Ru);class mc extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x,b,S,w,A){let E=this.length;return this.resize(E+1),this.emplace(E,e,n,s,c,d,m,_,x,b,S,w,A)}emplace(e,n,s,c,d,m,_,x,b,S,w,A,E){let R=12*e;return this.int16[R+0]=n,this.int16[R+1]=s,this.int16[R+2]=c,this.int16[R+3]=d,this.uint16[R+4]=m,this.uint16[R+5]=_,this.uint16[R+6]=x,this.uint16[R+7]=b,this.int16[R+8]=S,this.int16[R+9]=w,this.int16[R+10]=A,this.int16[R+11]=E,e}}mc.prototype.bytesPerElement=24,Ye("StructArrayLayout4i4ui4i24",mc);class Iu extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,n,s)}emplace(e,n,s,c){let d=3*e;return this.float32[d+0]=n,this.float32[d+1]=s,this.float32[d+2]=c,e}}Iu.prototype.bytesPerElement=12,Ye("StructArrayLayout3f12",Iu);class gc extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.uint32[1*e+0]=n,e}}gc.prototype.bytesPerElement=4,Ye("StructArrayLayout1ul4",gc);class tp extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x,b){let S=this.length;return this.resize(S+1),this.emplace(S,e,n,s,c,d,m,_,x,b)}emplace(e,n,s,c,d,m,_,x,b,S){let w=10*e,A=5*e;return this.int16[w+0]=n,this.int16[w+1]=s,this.int16[w+2]=c,this.int16[w+3]=d,this.int16[w+4]=m,this.int16[w+5]=_,this.uint32[A+3]=x,this.uint16[w+8]=b,this.uint16[w+9]=S,e}}tp.prototype.bytesPerElement=20,Ye("StructArrayLayout6i1ul2ui20",tp);class Qs extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m){let _=this.length;return this.resize(_+1),this.emplace(_,e,n,s,c,d,m)}emplace(e,n,s,c,d,m,_){let x=6*e;return this.int16[x+0]=n,this.int16[x+1]=s,this.int16[x+2]=c,this.int16[x+3]=d,this.int16[x+4]=m,this.int16[x+5]=_,e}}Qs.prototype.bytesPerElement=12,Ye("StructArrayLayout2i2i2i12",Qs);class Ko extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d){let m=this.length;return this.resize(m+1),this.emplace(m,e,n,s,c,d)}emplace(e,n,s,c,d,m){let _=4*e,x=8*e;return this.float32[_+0]=n,this.float32[_+1]=s,this.float32[_+2]=c,this.int16[x+6]=d,this.int16[x+7]=m,e}}Ko.prototype.bytesPerElement=16,Ye("StructArrayLayout2f1f2i16",Ko);class ip extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m){let _=this.length;return this.resize(_+1),this.emplace(_,e,n,s,c,d,m)}emplace(e,n,s,c,d,m,_){let x=16*e,b=4*e,S=8*e;return this.uint8[x+0]=n,this.uint8[x+1]=s,this.float32[b+1]=c,this.float32[b+2]=d,this.int16[S+6]=m,this.int16[S+7]=_,e}}ip.prototype.bytesPerElement=16,Ye("StructArrayLayout2ub2f2i16",ip);class _c extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,n,s)}emplace(e,n,s,c){let d=3*e;return this.uint16[d+0]=n,this.uint16[d+1]=s,this.uint16[d+2]=c,e}}_c.prototype.bytesPerElement=6,Ye("StructArrayLayout3ui6",_c);class Qo extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F){let V=this.length;return this.resize(V+1),this.emplace(V,e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F)}emplace(e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F,V){let U=24*e,j=12*e,H=48*e;return this.int16[U+0]=n,this.int16[U+1]=s,this.uint16[U+2]=c,this.uint16[U+3]=d,this.uint32[j+2]=m,this.uint32[j+3]=_,this.uint32[j+4]=x,this.uint16[U+10]=b,this.uint16[U+11]=S,this.uint16[U+12]=w,this.float32[j+7]=A,this.float32[j+8]=E,this.uint8[H+36]=R,this.uint8[H+37]=I,this.uint8[H+38]=O,this.uint32[j+10]=F,this.int16[U+22]=V,e}}Qo.prototype.bytesPerElement=48,Ye("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Qo);class np extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F,V,U,j,H,X,ue,he,be,ge,Me,Ee){let we=this.length;return this.resize(we+1),this.emplace(we,e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F,V,U,j,H,X,ue,he,be,ge,Me,Ee)}emplace(e,n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F,V,U,j,H,X,ue,he,be,ge,Me,Ee,we){let _e=32*e,Fe=16*e;return this.int16[_e+0]=n,this.int16[_e+1]=s,this.int16[_e+2]=c,this.int16[_e+3]=d,this.int16[_e+4]=m,this.int16[_e+5]=_,this.int16[_e+6]=x,this.int16[_e+7]=b,this.uint16[_e+8]=S,this.uint16[_e+9]=w,this.uint16[_e+10]=A,this.uint16[_e+11]=E,this.uint16[_e+12]=R,this.uint16[_e+13]=I,this.uint16[_e+14]=O,this.uint16[_e+15]=F,this.uint16[_e+16]=V,this.uint16[_e+17]=U,this.uint16[_e+18]=j,this.uint16[_e+19]=H,this.uint16[_e+20]=X,this.uint16[_e+21]=ue,this.uint16[_e+22]=he,this.uint32[Fe+12]=be,this.float32[Fe+13]=ge,this.float32[Fe+14]=Me,this.uint16[_e+30]=Ee,this.uint16[_e+31]=we,e}}np.prototype.bytesPerElement=64,Ye("StructArrayLayout8i15ui1ul2f2ui64",np);class ku extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.float32[1*e+0]=n,e}}ku.prototype.bytesPerElement=4,Ye("StructArrayLayout1f4",ku);class Lu extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,n,s)}emplace(e,n,s,c){let d=3*e;return this.uint16[6*e+0]=n,this.float32[d+1]=s,this.float32[d+2]=c,e}}Lu.prototype.bytesPerElement=12,Ye("StructArrayLayout1ui2f12",Lu);class rp extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,n,s)}emplace(e,n,s,c){let d=4*e;return this.uint32[2*e+0]=n,this.uint16[d+2]=s,this.uint16[d+3]=c,e}}rp.prototype.bytesPerElement=8,Ye("StructArrayLayout1ul2ui8",rp);class g extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,n)}emplace(e,n,s){let c=2*e;return this.uint16[c+0]=n,this.uint16[c+1]=s,e}}g.prototype.bytesPerElement=4,Ye("StructArrayLayout2ui4",g);class t extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.uint16[1*e+0]=n,e}}t.prototype.bytesPerElement=2,Ye("StructArrayLayout1ui2",t);class o extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,s,c){let d=this.length;return this.resize(d+1),this.emplace(d,e,n,s,c)}emplace(e,n,s,c,d){let m=4*e;return this.float32[m+0]=n,this.float32[m+1]=s,this.float32[m+2]=c,this.float32[m+3]=d,e}}o.prototype.bytesPerElement=16,Ye("StructArrayLayout4f16",o);class h extends dc{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new D(this.anchorPointX,this.anchorPointY)}}h.prototype.size=20;class p extends tp{get(e){return new h(this,e)}}Ye("CollisionBoxArray",p);class v extends dc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}v.prototype.size=48;class T extends Qo{get(e){return new v(this,e)}}Ye("PlacedSymbolArray",T);class M extends dc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}M.prototype.size=64;class C extends np{get(e){return new M(this,e)}}Ye("SymbolInstanceArray",C);class z extends ku{getoffsetX(e){return this.float32[1*e+0]}}Ye("GlyphOffsetArray",z);class P extends zu{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Ye("SymbolLineVertexArray",P);class k extends dc{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}k.prototype.size=12;class L extends Lu{get(e){return new k(this,e)}}Ye("TextAnchorOffsetArray",L);class N extends dc{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}N.prototype.size=8;class G extends rp{get(e){return new N(this,e)}}Ye("FeatureIndexArray",G);class $ extends pc{}class J extends pc{}class W extends pc{}class ee extends Pu{}class ae extends ep{}class te extends fc{}class Q extends Fa{}class re extends Ru{}class ie extends mc{}class me extends Iu{}class Te extends gc{}class Se extends Qs{}class Ie extends ip{}class Pe extends _c{}class Qe extends g{}let qe=ii([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ae}=qe;class $e{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,n,s,c){let d=this.segments[this.segments.length-1];return e>$e.MAX_VERTEX_ARRAY_LENGTH&&Gt(`Max vertices per segment is ${$e.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${$e.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+e>$e.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(n,s,c):d}createNewSegment(e,n,s){let c={vertexOffset:e.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(c.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(e,n,s){return this.prepareSegment(0,e,n,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let n in e.vaos)e.vaos[n].destroy()}static simpleSegment(e,n,s,c){return new $e([{vertexOffset:e,primitiveOffset:n,vertexLength:s,primitiveLength:c,vaos:{},sortKey:0}])}}function et(r,e){return 256*(r=qt(Math.floor(r),0,255))+qt(Math.floor(e),0,255)}$e.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ye("SegmentVector",$e);let Ft=ii([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),Bi=ii([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var $t,ji,Zi,Rn={exports:{}},Ei={exports:{}},Wn={exports:{}},Sn=(function(){if(Zi)return Rn.exports;Zi=1;var r=($t||($t=1,Ei.exports=function(n,s){var c,d,m,_,x,b,S,w;for(d=n.length-(c=3&n.length),m=s,x=3432918353,b=461845907,w=0;w<d;)S=255&n.charCodeAt(w)|(255&n.charCodeAt(++w))<<8|(255&n.charCodeAt(++w))<<16|(255&n.charCodeAt(++w))<<24,++w,m=27492+(65535&(_=5*(65535&(m=(m^=S=(65535&(S=(S=(65535&S)*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*b+(((S>>>16)*b&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(_>>>16)&65535)<<16);switch(S=0,c){case 3:S^=(255&n.charCodeAt(w+2))<<16;case 2:S^=(255&n.charCodeAt(w+1))<<8;case 1:m^=S=(65535&(S=(S=(65535&(S^=255&n.charCodeAt(w)))*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*b+(((S>>>16)*b&65535)<<16)&4294967295}return m^=n.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0}),Ei.exports),e=(ji||(ji=1,Wn.exports=function(n,s){for(var c,d=n.length,m=s^d,_=0;d>=4;)c=1540483477*(65535&(c=255&n.charCodeAt(_)|(255&n.charCodeAt(++_))<<8|(255&n.charCodeAt(++_))<<16|(255&n.charCodeAt(++_))<<24))+((1540483477*(c>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++_;switch(d){case 3:m^=(255&n.charCodeAt(_+2))<<16;case 2:m^=(255&n.charCodeAt(_+1))<<8;case 1:m=1540483477*(65535&(m^=255&n.charCodeAt(_)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0}),Wn.exports);return Rn.exports=r,Rn.exports.murmur3=r,Rn.exports.murmur2=e,Rn.exports})(),cn=B(Sn);class In{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,n,s,c){this.ids.push(lo(e)),this.positions.push(n,s,c)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let n=lo(e),s=0,c=this.ids.length-1;for(;s<c;){let m=s+c>>1;this.ids[m]>=n?c=m:s=m+1}let d=[];for(;this.ids[s]===n;)d.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return d}static serialize(e,n){let s=new Float64Array(e.ids),c=new Uint32Array(e.positions);return co(s,c,0,s.length-1),n&&n.push(s.buffer,c.buffer),{ids:s,positions:c}}static deserialize(e){let n=new In;return n.ids=e.ids,n.positions=e.positions,n.indexed=!0,n}}function lo(r){let e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:cn(String(r))}function co(r,e,n,s){for(;n<s;){let c=r[n+s>>1],d=n-1,m=s+1;for(;;){do d++;while(r[d]<c);do m--;while(r[m]>c);if(d>=m)break;uo(r,d,m),uo(e,3*d,3*m),uo(e,3*d+1,3*m+1),uo(e,3*d+2,3*m+2)}m-n<s-m?(co(r,e,n,m),n=m+1):(co(r,e,m+1,s),s=m)}}function uo(r,e,n){let s=r[e];r[e]=r[n],r[n]=s}Ye("FeaturePositionMap",In);class kn{constructor(e,n){this.gl=e.gl,this.location=n}}class Na extends kn{constructor(e,n){super(e,n),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class ho extends kn{constructor(e,n){super(e,n),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Ou extends kn{constructor(e,n){super(e,n),this.current=pt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}let _a=new Float32Array(16);function ya(r){return[et(255*r.r,255*r.g),et(255*r.b,255*r.a)]}class br{constructor(e,n,s){this.value=e,this.uniformNames=n.map((c=>`u_${c}`)),this.type=s}setUniform(e,n,s){e.set(s.constantOr(this.value))}getBinding(e,n,s){return this.type==="color"?new Ou(e,n):new Na(e,n)}}class Ir{constructor(e,n){this.uniformNames=n.map((s=>`u_${s}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,n){this.pixelRatioFrom=n.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=n.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,n){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,n.y,n.height,n.width]}setUniform(e,n,s,c){let d=null;c==="u_pattern_to"?d=this.patternTo:c==="u_pattern_from"?d=this.patternFrom:c==="u_dasharray_to"?d=this.dashTo:c==="u_dasharray_from"?d=this.dashFrom:c==="u_pixel_ratio_to"?d=this.pixelRatioTo:c==="u_pixel_ratio_from"&&(d=this.pixelRatioFrom),d!==null&&e.set(d)}getBinding(e,n,s){return s.startsWith("u_pattern")||s.startsWith("u_dasharray_")?new ho(e,n):new Na(e,n)}}class bi{constructor(e,n,s,c){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=n.map((d=>({name:`a_${d}`,type:"Float32",components:s==="color"?2:1,offset:0}))),this.paintVertexArray=new c}populatePaintArray(e,n,s){let c=this.paintVertexArray.length,d=this.expression.evaluate(new ti(0,s),n,{},s.canonical,[],s.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(c,e,d)}updatePaintArray(e,n,s,c,d){let m=this.expression.evaluate(new ti(0,d),s,c);this._setPaintValue(e,n,m)}_setPaintValue(e,n,s){if(this.type==="color"){let c=ya(s);for(let d=e;d<n;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=e;c<n;c++)this.paintVertexArray.emplace(c,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){var n,s;!((n=this.paintVertexArray)===null||n===void 0)&&n.arrayBuffer.byteLength&&(!((s=this.paintVertexBuffer)===null||s===void 0)&&s.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ui{constructor(e,n,s,c,d,m){this.expression=e,this.uniformNames=n.map((_=>`u_${_}_t`)),this.type=s,this.useIntegerZoom=c,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=n.map((_=>({name:`a_${_}`,type:"Float32",components:s==="color"?4:2,offset:0}))),this.paintVertexArray=new m}populatePaintArray(e,n,s){let c=this.expression.evaluate(new ti(this.zoom,s),n,{},s.canonical,[],s.formattedSection),d=this.expression.evaluate(new ti(this.zoom+1,s),n,{},s.canonical,[],s.formattedSection),m=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(m,e,c,d)}updatePaintArray(e,n,s,c,d){let m=this.expression.evaluate(new ti(this.zoom,d),s,c),_=this.expression.evaluate(new ti(this.zoom+1,d),s,c);this._setPaintValue(e,n,m,_)}_setPaintValue(e,n,s,c){if(this.type==="color"){let d=ya(s),m=ya(c);for(let _=e;_<n;_++)this.paintVertexArray.emplace(_,d[0],d[1],m[0],m[1])}else{for(let d=e;d<n;d++)this.paintVertexArray.emplace(d,s,c);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(c))}}upload(e){var n,s;!((n=this.paintVertexArray)===null||n===void 0)&&n.arrayBuffer.byteLength&&(!((s=this.paintVertexBuffer)===null||s===void 0)&&s.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,n){let s=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,c=qt(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,n,s){return new Na(e,n)}}class Hi{constructor(e,n,s,c,d,m){this.expression=e,this.type=n,this.useIntegerZoom=s,this.zoom=c,this.layerId=m,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(e,n,s){let c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(c,e,this.getPositionIds(n),s)}updatePaintArray(e,n,s,c,d){this._setPaintValues(e,n,this.getPositionIds(s),d)}_setPaintValues(e,n,s,c){let d=this.getPositions(c);if(!d||!s)return;let m=d[s.min],_=d[s.mid],x=d[s.max];if(m&&_&&x)for(let b=e;b<n;b++)this.emplace(this.zoomInPaintVertexArray,b,_,m),this.emplace(this.zoomOutPaintVertexArray,b,_,x)}upload(e){var n,s;if(!((n=this.zoomInPaintVertexArray)===null||n===void 0)&&n.arrayBuffer.byteLength&&(!((s=this.zoomOutPaintVertexArray)===null||s===void 0)&&s.arrayBuffer.byteLength)){let c=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,c,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,c,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class xi extends Hi{getPositions(e){return e.imagePositions}getPositionIds(e){var n;return(n=e.patterns)===null||n===void 0?void 0:n[this.layerId]}getVertexAttributes(){return Ft.members}emplace(e,n,s,c){e.emplace(n,s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],c.tlbr[0],c.tlbr[1],c.tlbr[2],c.tlbr[3],s.pixelRatio,c.pixelRatio)}}class Jo extends Hi{getPositions(e){return e.dashPositions}getPositionIds(e){var n;return(n=e.dashes)===null||n===void 0?void 0:n[this.layerId]}getVertexAttributes(){return Bi.members}emplace(e,n,s,c){e.emplace(n,0,s.y,s.height,s.width,0,c.y,c.height,c.width)}}class Bu{constructor(e,n,s){this.binders={},this._buffers=[];let c=[];for(let d in e.paint._values){if(!s(d))continue;let m=e.paint.get(d);if(!(m instanceof Kr&&Zs(m.property.specification)))continue;let _=ap(d,e.type),x=m.value,b=m.property.specification.type,S=m.property.useIntegerZoom,w=m.property.specification["property-type"],A=w==="cross-faded"||w==="cross-faded-data-driven";if(x.kind==="constant")this.binders[d]=A?new Ir(x.value,_):new br(x.value,_,b),c.push(`/u_${d}`);else if(x.kind==="source"||A){let E=Vm(d,b,"source");this.binders[d]=A?d==="line-dasharray"?new Jo(x,b,S,n,E,e.id):new xi(x,b,S,n,E,e.id):new bi(x,_,b,E),c.push(`/a_${d}`)}else{let E=Vm(d,b,"composite");this.binders[d]=new ui(x,_,b,S,n,E),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){let n=this.binders[e];return n instanceof bi||n instanceof ui?n.maxValue:0}populatePaintArrays(e,n,s){for(let c in this.binders){let d=this.binders[c];(d instanceof bi||d instanceof ui||d instanceof Hi)&&d.populatePaintArray(e,n,s)}}setConstantPatternPositions(e,n){for(let s in this.binders){let c=this.binders[s];c instanceof Ir&&c.setConstantPatternPositions(e,n)}}setConstantDashPositions(e,n){for(let s in this.binders){let c=this.binders[s];c instanceof Ir&&c.setConstantDashPositions(e,n)}}updatePaintArrays(e,n,s,c,d){let m=!1;for(let _ in e){let x=n.getPositions(_);for(let b of x){let S=s.feature(b.index);for(let w in this.binders){let A=this.binders[w];if((A instanceof bi||A instanceof ui||A instanceof Hi)&&A.expression.isStateDependent===!0){let E=c.paint.get(w);A.expression=E.value,A.updatePaintArray(b.start,b.end,S,e[_],d),m=!0}}}}return m}defines(){let e=[];for(let n in this.binders){let s=this.binders[n];(s instanceof br||s instanceof Ir)&&e.push(...s.uniformNames.map((c=>`#define HAS_UNIFORM_${c}`)))}return e}getBinderAttributes(){let e=[];for(let n in this.binders){let s=this.binders[n];if(s instanceof bi||s instanceof ui)for(let c of s.paintVertexAttributes)e.push(c.name);else if(s instanceof Hi){let c=s.getVertexAttributes();for(let d of c)e.push(d.name)}}return e}getBinderUniforms(){let e=[];for(let n in this.binders){let s=this.binders[n];if(s instanceof br||s instanceof Ir||s instanceof ui)for(let c of s.uniformNames)e.push(c)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,n){let s=[];for(let c in this.binders){let d=this.binders[c];if(d instanceof br||d instanceof Ir||d instanceof ui){for(let m of d.uniformNames)if(n[m]){let _=d.getBinding(e,n[m],m);s.push({name:m,property:c,binding:_})}}}return s}setUniforms(e,n,s,c){for(let{name:d,property:m,binding:_}of n)this.binders[m].setUniform(_,c,s.get(m),d)}updatePaintBuffers(e){this._buffers=[];for(let n in this.binders){let s=this.binders[n];if(e&&s instanceof Hi){let c=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(s instanceof bi||s instanceof ui)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(let n in this.binders){let s=this.binders[n];(s instanceof bi||s instanceof ui||s instanceof Hi)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let n=this.binders[e];(n instanceof bi||n instanceof ui||n instanceof Hi)&&n.destroy()}}}class Ua{constructor(e,n,s=()=>!0){this.programConfigurations={};for(let c of e)this.programConfigurations[c.id]=new Bu(c,n,s);this.needsUpload=!1,this._featureMap=new In,this._bufferOffset=0}populatePaintArrays(e,n,s,c){for(let d in this.programConfigurations)this.programConfigurations[d].populatePaintArrays(e,n,c);n.id!==void 0&&this._featureMap.add(n.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,n,s,c){for(let d of s)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,n,d,c)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let n in this.programConfigurations)this.programConfigurations[n].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}function ap(r,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function Vm(r,e,n){let s={color:{source:fc,composite:o},number:{source:ku,composite:fc}},c=(function(d){return{"line-pattern":{source:Q,composite:Q},"fill-pattern":{source:Q,composite:Q},"fill-extrusion-pattern":{source:Q,composite:Q},"line-dasharray":{source:re,composite:re}}[d]})(r);return c?.[n]||s[e][n]}Ye("ConstantBinder",br),Ye("CrossFadedConstantBinder",Ir),Ye("SourceExpressionBinder",bi),Ye("CrossFadedPatternBinder",xi),Ye("CrossFadedDasharrayBinder",Jo),Ye("CompositeExpressionBinder",ui),Ye("ProgramConfiguration",Bu,{omit:["_buffers"]}),Ye("ProgramConfigurationSet",Ua);let op=Math.pow(2,14)-1,po=-op-1;function fo(r){let e=Ke/r.extent,n=r.loadGeometry();for(let s of n)for(let c of s){let d=Math.round(c.x*e),m=Math.round(c.y*e);c.x=qt(d,po,op),c.y=qt(m,po,op),(d<c.x||d>c.x+1||m<c.y||m>c.y+1)&&Gt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return n}function mo(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?fo(r):[]}}let sp=-32768;function lp(r,e,n,s,c){r.emplaceBack(sp+8*e+s,sp+8*n+c)}class Fu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((n=>n.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new J,this.indexArray=new Pe,this.segments=new $e,this.programConfigurations=new Ua(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((n=>n.isStateDependent())).map((n=>n.id))}populate(e,n,s){let c=this.layers[0],d=[],m=null,_=!1,x=c.type==="heatmap";if(c.type==="circle"){let S=c;m=S.layout.get("circle-sort-key"),_=!m.isConstant(),x||(x=S.paint.get("circle-pitch-alignment")==="map")}let b=x?n.subdivisionGranularity.circle:1;for(let{feature:S,id:w,index:A,sourceLayerIndex:E}of e){let R=this.layers[0]._featureFilter.needGeometry,I=mo(S,R);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),I,s))continue;let O=_?m.evaluate(I,{},s):void 0,F={id:w,properties:S.properties,type:S.type,sourceLayerIndex:E,index:A,geometry:R?I.geometry:fo(S),patterns:{},sortKey:O};d.push(F)}_&&d.sort(((S,w)=>S.sortKey-w.sortKey));for(let S of d){let{geometry:w,index:A,sourceLayerIndex:E}=S,R=e[A].feature;this.addFeature(S,w,A,s,b),n.featureIndex.insert(R,w,A,E,this.index)}}update(e,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ae),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,n,s,c,d=1){let m;switch(d){case 1:m=[0,7];break;case 3:m=[0,2,5,7];break;case 5:m=[0,1,3,4,6,7];break;case 7:m=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}let _=m.length;for(let x of n)for(let b of x){let S=b.x,w=b.y;if(S<0||S>=Ke||w<0||w>=Ke)continue;let A=this.segments.prepareSegment(_*_,this.layoutVertexArray,this.indexArray,e.sortKey),E=A.vertexLength;for(let R=0;R<_;R++)for(let I=0;I<_;I++)lp(this.layoutVertexArray,S,w,m[I],m[R]);for(let R=0;R<_-1;R++)for(let I=0;I<_-1;I++){let O=E+R*_+I,F=E+(R+1)*_+I;this.indexArray.emplaceBack(O,F+1,O+1),this.indexArray.emplaceBack(O,F,F+1)}A.vertexLength+=_*_,A.primitiveLength+=(_-1)*(_-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:{},canonical:c})}}function Nu(r,e){for(let n of r)if(Uu(e,n))return!0;for(let n of e)if(Uu(r,n))return!0;return L1(r,e)}function jm(r,e,n){return!!Uu(r,e)||O1(e,r,n)}function Qb(r,e){if(r.length===1)return ex(e,r[0]);for(let n of e)for(let s of n)if(Uu(r,s))return!0;for(let n of r)if(ex(e,n))return!0;for(let n of e)if(L1(r,n))return!0;return!1}function jS(r,e,n){if(r.length>1){if(L1(r,e))return!0;for(let s of e)if(O1(s,r,n))return!0}for(let s of r)if(O1(s,e,n))return!0;return!1}function L1(r,e){if(r.length===0||e.length===0)return!1;for(let n=0;n<r.length-1;n++){let s=r[n],c=r[n+1];for(let d=0;d<e.length-1;d++)if(qS(s,c,e[d],e[d+1]))return!0}return!1}function qS(r,e,n,s){return ci(r,n,s)!==ci(e,n,s)&&ci(r,e,n)!==ci(r,e,s)}function O1(r,e,n){let s=n*n;if(e.length===1)return r.distSqr(e[0])<s;for(let c=1;c<e.length;c++)if(Jb(r,e[c-1],e[c])<s)return!0;return!1}function Jb(r,e,n){let s=e.distSqr(n);if(s===0)return r.distSqr(e);let c=((r.x-e.x)*(n.x-e.x)+(r.y-e.y)*(n.y-e.y))/s;return r.distSqr(c<0?e:c>1?n:n.sub(e)._mult(c)._add(e))}function ex(r,e){let n,s,c,d=!1;for(let m of r){n=m;for(let _=0,x=n.length-1;_<n.length;x=_++)s=n[_],c=n[x],s.y>e.y!=c.y>e.y&&e.x<(c.x-s.x)*(e.y-s.y)/(c.y-s.y)+s.x&&(d=!d)}return d}function Uu(r,e){let n=!1;for(let s=0,c=r.length-1;s<r.length;c=s++){let d=r[s],m=r[c];d.y>e.y!=m.y>e.y&&e.x<(m.x-d.x)*(e.y-d.y)/(m.y-d.y)+d.x&&(n=!n)}return n}function GS(r,e,n){let s=n[0],c=n[2];if(r.x<s.x&&e.x<s.x||r.x>c.x&&e.x>c.x||r.y<s.y&&e.y<s.y||r.y>c.y&&e.y>c.y)return!1;let d=ci(r,e,n[0]);return d!==ci(r,e,n[1])||d!==ci(r,e,n[2])||d!==ci(r,e,n[3])}function Vu(r,e,n){let s=e.paint.get(r).value;return s.kind==="constant"?s.value:n.programConfigurations.get(e.id).getMaxValue(r)}function qm(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Gm(r,e,n,s,c){if(!e[0]&&!e[1])return r;let d=D.convert(e)._mult(c);n==="viewport"&&d._rotate(-s);let m=[];for(let _ of r)m.push(_.sub(d));return m}function ZS(r){let e=[];for(let n=0;n<r.length;n++){let s=r[n],c=e.at(-1);(n===0||c&&!s.equals(c))&&e.push(s)}return e}function HS({queryGeometry:r,size:e},n){return jm(r,n,e)}function $S({queryGeometry:r,size:e,transform:n,unwrappedTileID:s,getElevation:c},d){return jm(r,d,e*(n.projectTileCoordinates(d.x,d.y,s,c).signedDistanceFromCamera/n.cameraToCenterDistance))}function XS({queryGeometry:r,size:e,transform:n,unwrappedTileID:s,getElevation:c},d){let m=n.projectTileCoordinates(d.x,d.y,s,c).signedDistanceFromCamera,_=e*(n.cameraToCenterDistance/m);return jm(r,B1(d,n,s,c),_)}function YS({queryGeometry:r,size:e,transform:n,unwrappedTileID:s,getElevation:c},d){return jm(r,B1(d,n,s,c),e)}function tx({queryGeometry:r,size:e,transform:n,unwrappedTileID:s,getElevation:c,pitchAlignment:d="map",pitchScale:m="map"},_){let x=d==="map"?m==="map"?HS:$S:m==="map"?XS:YS,b={queryGeometry:r,size:e,transform:n,unwrappedTileID:s,getElevation:c};for(let S of _)for(let w of S)if(x(b,w))return!0;return!1}function B1(r,e,n,s){let c=e.projectTileCoordinates(r.x,r.y,n,s).point;return new D((.5*c.x+.5)*e.width,(.5*-c.y+.5)*e.height)}let ix,nx;Ye("CircleBucket",Fu,{omit:["layers"]});var WS={get paint(){return nx=nx||new Yn({"circle-radius":new it(Ce.paint_circle["circle-radius"]),"circle-color":new it(Ce.paint_circle["circle-color"]),"circle-blur":new it(Ce.paint_circle["circle-blur"]),"circle-opacity":new it(Ce.paint_circle["circle-opacity"]),"circle-translate":new Je(Ce.paint_circle["circle-translate"]),"circle-translate-anchor":new Je(Ce.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Je(Ce.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Je(Ce.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new it(Ce.paint_circle["circle-stroke-width"]),"circle-stroke-color":new it(Ce.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new it(Ce.paint_circle["circle-stroke-opacity"])})},get layout(){return ix=ix||new Yn({"circle-sort-key":new it(Ce.layout_circle["circle-sort-key"])})}};class KS extends Rr{constructor(e,n){super(e,WS,n)}createBucket(e){return new Fu(e)}queryRadius(e){let n=e;return Vu("circle-radius",this,n)+Vu("circle-stroke-width",this,n)+qm(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:n,featureState:s,geometry:c,transform:d,pixelsToTileUnits:m,unwrappedTileID:_,getElevation:x}){let b=Gm(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,m),S=this.paint.get("circle-radius").evaluate(n,s)+this.paint.get("circle-stroke-width").evaluate(n,s),w=this.paint.get("circle-pitch-scale"),A=this.paint.get("circle-pitch-alignment"),E,R;return A==="map"?(E=b,R=S*m):(E=(function(I,O,F,V){return I.map((U=>B1(U,O,F,V)))})(b,d,_,x),R=S),tx({queryGeometry:E,size:R,transform:d,unwrappedTileID:_,getElevation:x,pitchAlignment:A,pitchScale:w},c)}}class rx extends Fu{}let ax;Ye("HeatmapBucket",rx,{omit:["layers"]});var QS={get paint(){return ax=ax||new Yn({"heatmap-radius":new it(Ce.paint_heatmap["heatmap-radius"]),"heatmap-weight":new it(Ce.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Je(Ce.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ks(Ce.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Je(Ce.paint_heatmap["heatmap-opacity"])})}};function F1(r,{width:e,height:n},s,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==e*n*s)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${e*n*s}`)}else c=new Uint8Array(e*n*s);return r.width=e,r.height=n,r.data=c,r}function ox(r,{width:e,height:n},s){if(e===r.width&&n===r.height)return;let c=F1({},{width:e,height:n},s);N1(r,c,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,n)},s),r.width=e,r.height=n,r.data=c.data}function N1(r,e,n,s,c,d){if(c.width===0||c.height===0)return e;if(c.width>r.width||c.height>r.height||n.x>r.width-c.width||n.y>r.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>e.width||c.height>e.height||s.x>e.width-c.width||s.y>e.height-c.height)throw new RangeError("out of range destination coordinates for image copy");let m=r.data,_=e.data;if(m===_)throw new Error("srcData equals dstData, so image is already copied");for(let x=0;x<c.height;x++){let b=((n.y+x)*r.width+n.x)*d,S=((s.y+x)*e.width+s.x)*d;for(let w=0;w<c.width*d;w++)_[S+w]=m[b+w]}return e}class cp{constructor(e,n){F1(this,e,1,n)}resize(e){ox(this,e,1)}clone(){return new cp({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,n,s,c,d){N1(e,n,s,c,d,1)}}class xr{constructor(e,n){F1(this,e,4,n)}resize(e){ox(this,e,4)}replace(e,n){n?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new xr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,n,s,c,d){N1(e,n,s,c,d,4)}setPixel(e,n,s){let c=4*(e*this.width+n);this.data[c+0]=Math.round(255*s.r/s.a),this.data[c+1]=Math.round(255*s.g/s.a),this.data[c+2]=Math.round(255*s.b/s.a),this.data[c+3]=Math.round(255*s.a)}}function sx(r){let e=new Uint8Array(r.length);for(let n=0;n<r.length;n+=4){let s=r[n+3];e[n+0]=Math.round(r[n+0]*s/255),e[n+1]=Math.round(r[n+1]*s/255),e[n+2]=Math.round(r[n+2]*s/255),e[n+3]=s}return e}function lx(r){let e={},n=r.resolution||256,s=r.clips?r.clips.length:1,c=r.image||new xr({width:n,height:s});if(Math.log(n)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${n}`);let d=(m,_,x)=>{e[r.evaluationKey]=x;let b=r.expression.evaluate(e);c.setPixel(m/4/n,_/4,b)};if(r.clips)for(let m=0,_=0;m<s;++m,_+=4*n)for(let x=0,b=0;x<n;x++,b+=4){let S=x/(n-1),{start:w,end:A}=r.clips[m];d(_,b,w*(1-S)+A*S)}else for(let m=0,_=0;m<n;m++,_+=4)d(0,_,m/(n-1));return c}Ye("AlphaImage",cp),Ye("RGBAImage",xr);let U1="big-fb";class JS extends Rr{createBucket(e){return new rx(e)}constructor(e,n){super(e,QS,n),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=lx({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(U1)&&this.heatmapFbos.delete(U1)}queryRadius(e){return Vu("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:n,featureState:s,geometry:c,transform:d,pixelsToTileUnits:m,unwrappedTileID:_,getElevation:x}){return tx({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(n,s)*m,transform:d,unwrappedTileID:_,getElevation:x},c)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let cx;var e6={get paint(){return cx=cx||new Yn({"hillshade-illumination-direction":new Je(Ce.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Je(Ce.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Je(Ce.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Je(Ce.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Je(Ce.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Je(Ce.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Je(Ce.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Je(Ce.paint_hillshade["hillshade-method"]),resampling:new Je(Ce.paint_hillshade.resampling)})}};class t6 extends Rr{constructor(e,n){super(e,e6,n),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,n=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,c=this.paint.get("hillshade-shadow-color").values,d=Math.max(e.length,n.length,s.length,c.length);e=e.concat(Array(d-e.length).fill(e.at(-1))),n=n.concat(Array(d-n.length).fill(n.at(-1))),s=s.concat(Array(d-s.length).fill(s.at(-1))),c=c.concat(Array(d-c.length).fill(c.at(-1)));let m=n.map(_i);return{directionRadians:e.map(_i),altitudeRadians:m,shadowColor:c,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let ux;var i6={get paint(){return ux=ux||new Yn({"color-relief-opacity":new Je(Ce["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Ks(Ce["paint_color-relief"]["color-relief-color"]),resampling:new Je(Ce["paint_color-relief"].resampling)})}};function hx(r){return"data"in r}class V1{constructor(e,n,s,c){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(n,c)}update(e,n,s){var c;let{width:d,height:m}=e,_=(((c=this.size)===null||c===void 0?void 0:c[0])!==d||this.size[1]!==m)&&!s,{context:x}=this,{gl:b}=x;this.useMipmap=!!n?.useMipmap,b.bindTexture(b.TEXTURE_2D,this.texture),x.pixelStoreUnpackFlipY.set(!1),x.pixelStoreUnpack.set(1);let S=this.format===b.RGBA&&n?.premultiply!==!1;if(_)this.size=[d,m],hx(e)?(x.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,S,d,m,b)):(x.pixelStoreUnpackPremultiplyAlpha.set(S),this._uploadDomImage(e,b));else{let{x:w,y:A}=s||{x:0,y:0};hx(e)?(x.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,S,w,A,d,m,b)):(x.pixelStoreUnpackPremultiplyAlpha.set(S),this._updateDomImage(e,w,A,b))}this.useMipmap&&this.isSizePowerOfTwo()&&b.generateMipmap(b.TEXTURE_2D),x.pixelStoreUnpackFlipY.setDefault(),x.pixelStoreUnpack.setDefault(),x.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,n){n.texImage2D(n.TEXTURE_2D,0,this.format,this.format,n.UNSIGNED_BYTE,e)}_uploadRawData(e,n,s,c,d){let{data:m}=e;n&&m&&(m=sx(m)),d.texImage2D(d.TEXTURE_2D,0,this.format,s,c,0,this.format,d.UNSIGNED_BYTE,m)}_updateDomImage(e,n,s,c){c.texSubImage2D(c.TEXTURE_2D,0,n,s,c.RGBA,c.UNSIGNED_BYTE,e)}_updateRawData(e,n,s,c,d,m,_){let{data:x}=e;n&&x&&(x=sx(x)),_.texSubImage2D(_.TEXTURE_2D,0,s,c,d,m,_.RGBA,_.UNSIGNED_BYTE,x)}bind(e,n,s){let{context:c}=this,{gl:d}=c;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),d.bindTexture(d.TEXTURE_2D,this.texture),s!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=d.LINEAR),e!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,e),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,s||e),this.filter=e),n!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,n),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class dx{constructor(e,n,s,c=1,d=1,m=1,_=0){if(this.uid=e,n.height!==n.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void Gt(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=n.height;let x=this.dim=n.height-2;switch(this.data=new Uint32Array(n.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=c,this.greenFactor=d,this.blueFactor=m,this.baseShift=_;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let b=0;b<x;b++)this.data[this._idx(-1,b)]=this.data[this._idx(0,b)],this.data[this._idx(x,b)]=this.data[this._idx(x-1,b)],this.data[this._idx(b,-1)]=this.data[this._idx(b,0)],this.data[this._idx(b,x)]=this.data[this._idx(b,x-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(x,-1)]=this.data[this._idx(x-1,0)],this.data[this._idx(-1,x)]=this.data[this._idx(0,x-1)],this.data[this._idx(x,x)]=this.data[this._idx(x-1,x-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let b=0;b<x;b++)for(let S=0;S<x;S++){let w=this.get(b,S);w>this.max&&(this.max=w),w<this.min&&(this.min=w)}}get(e,n){let s=new Uint8Array(this.data.buffer),c=4*this._idx(e,n);return this.unpack(s[c],s[c+1],s[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,n){if(e<-1||e>=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${n}, dim: ${this.dim}`);return(n+1)*this.stride+(e+1)}unpack(e,n,s){return e*this.redFactor+n*this.greenFactor+s*this.blueFactor-this.baseShift}pack(e){return px(e,this.getUnpackVector())}getPixels(){return new xr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,n,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let c=n*this.dim,d=n*this.dim+this.dim,m=s*this.dim,_=s*this.dim+this.dim;switch(n){case-1:c=d-1;break;case 1:d=c+1}switch(s){case-1:m=_-1;break;case 1:_=m+1}let x=-n*this.dim,b=-s*this.dim;for(let S=m;S<_;S++)for(let w=c;w<d;w++)this.data[this._idx(w,S)]=e.data[this._idx(w+x,S+b)]}}function px(r,e){let n=e[0],s=e[1],c=e[2],d=e[3],m=Math.min(n,s,c),_=Math.round((r+d)/m);return{r:Math.floor(_*m/n)%256,g:Math.floor(_*m/s)%256,b:Math.floor(_*m/c)%256}}Ye("DEMData",dx);class n6 extends Rr{constructor(e,n){super(e,i6,n)}_createColorRamp(e){let n={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof vu&&s._styleExpression.expression instanceof Vi){this.colorRampExpression=s;let m=s._styleExpression.expression;n.elevationStops=m.labels,n.colorStops=[];for(let _ of n.elevationStops)n.colorStops.push(m.evaluate({globals:{elevation:_}}))}if(n.elevationStops.length<1&&(n.elevationStops=[0],n.colorStops=[pt.transparent]),n.elevationStops.length<2&&(n.elevationStops.push(n.elevationStops[0]+1),n.colorStops.push(n.colorStops[0])),n.elevationStops.length<=e)return n;let c={elevationStops:[],colorStops:[]},d=(n.elevationStops.length-1)/(e-1);for(let m=0;m<n.elevationStops.length-.5;m+=d)c.elevationStops.push(n.elevationStops[Math.round(m)]),c.colorStops.push(n.colorStops[Math.round(m)]);return Gt(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${n.elevationStops.length}`),c}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,n,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let c=this._createColorRamp(n),d=new xr({width:c.colorStops.length,height:1}),m=new xr({width:c.colorStops.length,height:1});for(let _=0;_<c.elevationStops.length;_++){let x=px(c.elevationStops[_],s);m.setPixel(0,_,new pt(x.r/255,x.g/255,x.b/255,1)),d.setPixel(0,_,c.colorStops[_])}return this.colorRampTextures={elevationTexture:new V1(e,m,e.gl.RGBA),colorTexture:new V1(e,d,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let r6=ii([{name:"a_pos",components:2,type:"Int16"}],4),{members:a6}=r6;function Zm(r,e,n){let s=n.patternDependencies,c=!1;for(let d of e){let m=d.paint.get(`${r}-pattern`);m.isConstant()||(c=!0);let _=m.constantOr(null);_&&(c=!0,s[_.to]=!0,s[_.from]=!0)}return c}function j1(r,e,n,s,c){let{zoom:d}=s,m=c.patternDependencies;for(let _ of e){let x=_.paint.get(`${r}-pattern`).value;if(x.kind!=="constant"){let b=x.evaluate({zoom:d-1},n,{},c.availableImages),S=x.evaluate({zoom:d},n,{},c.availableImages),w=x.evaluate({zoom:d+1},n,{},c.availableImages);b=b?.name?b.name:b,S=S?.name?S.name:S,w=w?.name?w.name:w,m[b]=!0,m[S]=!0,m[w]=!0,n.patterns[_.id]={min:b,mid:S,max:w}}}return n}function fx(r,e,n,s,c){let d;if(c===(function(m,_,x,b){let S=0;for(let w=_,A=x-b;w<x;w+=b)S+=(m[A]-m[w])*(m[w+1]+m[A+1]),A=w;return S})(r,e,n,s)>0)for(let m=e;m<n;m+=s)d=yx(m/s|0,r[m],r[m+1],d);else for(let m=n-s;m>=e;m-=s)d=yx(m/s|0,r[m],r[m+1],d);return d&&ju(d,d.next)&&(pp(d),d=d.next),d}function yc(r,e){if(!r)return r;e||(e=r);let n,s=r;do if(n=!1,s.steiner||!ju(s,s.next)&&qi(s.prev,s,s.next)!==0)s=s.next;else{if(pp(s),s=e=s.prev,s===s.next)break;n=!0}while(n||s!==e);return e}function up(r,e,n,s,c,d,m){if(!r)return;!m&&d&&(function(x,b,S,w){let A=x;do A.z===0&&(A.z=q1(A.x,A.y,b,S,w)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==x);A.prevZ.nextZ=null,A.prevZ=null,(function(E){let R,I=1;do{let O,F=E;E=null;let V=null;for(R=0;F;){R++;let U=F,j=0;for(let X=0;X<I&&(j++,U=U.nextZ,U);X++);let H=I;for(;j>0||H>0&&U;)j!==0&&(H===0||!U||F.z<=U.z)?(O=F,F=F.nextZ,j--):(O=U,U=U.nextZ,H--),V?V.nextZ=O:E=O,O.prevZ=V,V=O;F=U}V.nextZ=null,I*=2}while(R>1)})(A)})(r,s,c,d);let _=r;for(;r.prev!==r.next;){let x=r.prev,b=r.next;if(d?s6(r,s,c,d):o6(r))e.push(x.i,r.i,b.i),pp(r),r=b.next,_=b.next;else if((r=b)===_){m?m===1?up(r=l6(yc(r),e),e,n,s,c,d,2):m===2&&c6(r,e,n,s,c,d):up(yc(r),e,n,s,c,d,1);break}}}function o6(r){let e=r.prev,n=r,s=r.next;if(qi(e,n,s)>=0)return!1;let c=e.x,d=n.x,m=s.x,_=e.y,x=n.y,b=s.y,S=Math.min(c,d,m),w=Math.min(_,x,b),A=Math.max(c,d,m),E=Math.max(_,x,b),R=s.next;for(;R!==e;){if(R.x>=S&&R.x<=A&&R.y>=w&&R.y<=E&&hp(c,_,d,x,m,b,R.x,R.y)&&qi(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function s6(r,e,n,s){let c=r.prev,d=r,m=r.next;if(qi(c,d,m)>=0)return!1;let _=c.x,x=d.x,b=m.x,S=c.y,w=d.y,A=m.y,E=Math.min(_,x,b),R=Math.min(S,w,A),I=Math.max(_,x,b),O=Math.max(S,w,A),F=q1(E,R,e,n,s),V=q1(I,O,e,n,s),U=r.prevZ,j=r.nextZ;for(;U&&U.z>=F&&j&&j.z<=V;){if(U.x>=E&&U.x<=I&&U.y>=R&&U.y<=O&&U!==c&&U!==m&&hp(_,S,x,w,b,A,U.x,U.y)&&qi(U.prev,U,U.next)>=0||(U=U.prevZ,j.x>=E&&j.x<=I&&j.y>=R&&j.y<=O&&j!==c&&j!==m&&hp(_,S,x,w,b,A,j.x,j.y)&&qi(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;U&&U.z>=F;){if(U.x>=E&&U.x<=I&&U.y>=R&&U.y<=O&&U!==c&&U!==m&&hp(_,S,x,w,b,A,U.x,U.y)&&qi(U.prev,U,U.next)>=0)return!1;U=U.prevZ}for(;j&&j.z<=V;){if(j.x>=E&&j.x<=I&&j.y>=R&&j.y<=O&&j!==c&&j!==m&&hp(_,S,x,w,b,A,j.x,j.y)&&qi(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function l6(r,e){let n=r;do{let s=n.prev,c=n.next.next;!ju(s,c)&&gx(s,n,n.next,c)&&dp(s,c)&&dp(c,s)&&(e.push(s.i,n.i,c.i),pp(n),pp(n.next),n=r=c),n=n.next}while(n!==r);return yc(n)}function c6(r,e,n,s,c,d){let m=r;do{let _=m.next.next;for(;_!==m.prev;){if(m.i!==_.i&&f6(m,_)){let x=_x(m,_);return m=yc(m,m.next),x=yc(x,x.next),up(m,e,n,s,c,d,0),void up(x,e,n,s,c,d,0)}_=_.next}m=m.next}while(m!==r)}function u6(r,e){let n=r.x-e.x;return n===0&&(n=r.y-e.y,n===0)&&(n=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),n}function h6(r,e){let n=(function(c,d){let m=d,_=c.x,x=c.y,b,S=-1/0;if(ju(c,m))return m;do{if(ju(c,m.next))return m.next;if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){let I=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(I<=_&&I>S&&(S=I,b=m.x<m.next.x?m:m.next,I===_))return b}m=m.next}while(m!==d);if(!b)return null;let w=b,A=b.x,E=b.y,R=1/0;m=b;do{if(_>=m.x&&m.x>=A&&_!==m.x&&mx(x<E?_:S,x,A,E,x<E?S:_,x,m.x,m.y)){let I=Math.abs(x-m.y)/(_-m.x);dp(m,c)&&(I<R||I===R&&(m.x>b.x||m.x===b.x&&d6(b,m)))&&(b=m,R=I)}m=m.next}while(m!==w);return b})(r,e);if(!n)return e;let s=_x(n,r);return yc(s,s.next),yc(n,n.next)}function d6(r,e){return qi(r.prev,r,e.prev)<0&&qi(e.next,r,r.next)<0}function q1(r,e,n,s,c){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-n)*c|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*c|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function p6(r){let e=r,n=r;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==r);return n}function mx(r,e,n,s,c,d,m,_){return(c-m)*(e-_)>=(r-m)*(d-_)&&(r-m)*(s-_)>=(n-m)*(e-_)&&(n-m)*(d-_)>=(c-m)*(s-_)}function hp(r,e,n,s,c,d,m,_){return!(r===m&&e===_)&&mx(r,e,n,s,c,d,m,_)}function f6(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(n,s){let c=n;do{if(c.i!==n.i&&c.next.i!==n.i&&c.i!==s.i&&c.next.i!==s.i&&gx(c,c.next,n,s))return!0;c=c.next}while(c!==n);return!1})(r,e)&&(dp(r,e)&&dp(e,r)&&(function(n,s){let c=n,d=!1,m=(n.x+s.x)/2,_=(n.y+s.y)/2;do c.y>_!=c.next.y>_&&c.next.y!==c.y&&m<(c.next.x-c.x)*(_-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==n);return d})(r,e)&&(qi(r.prev,r,e.prev)||qi(r,e.prev,e))||ju(r,e)&&qi(r.prev,r,r.next)>0&&qi(e.prev,e,e.next)>0)}function qi(r,e,n){return(e.y-r.y)*(n.x-e.x)-(e.x-r.x)*(n.y-e.y)}function ju(r,e){return r.x===e.x&&r.y===e.y}function gx(r,e,n,s){let c=$m(qi(r,e,n)),d=$m(qi(r,e,s)),m=$m(qi(n,s,r)),_=$m(qi(n,s,e));return c!==d&&m!==_||!(c!==0||!Hm(r,n,e))||!(d!==0||!Hm(r,s,e))||!(m!==0||!Hm(n,r,s))||!(_!==0||!Hm(n,e,s))}function Hm(r,e,n){return e.x<=Math.max(r.x,n.x)&&e.x>=Math.min(r.x,n.x)&&e.y<=Math.max(r.y,n.y)&&e.y>=Math.min(r.y,n.y)}function $m(r){return r>0?1:r<0?-1:0}function dp(r,e){return qi(r.prev,r,r.next)<0?qi(r,e,r.next)>=0&&qi(r,r.prev,e)>=0:qi(r,e,r.prev)<0||qi(r,r.next,e)<0}function _x(r,e){let n=G1(r.i,r.x,r.y),s=G1(e.i,e.x,e.y),c=r.next,d=e.prev;return r.next=e,e.prev=r,n.next=c,c.prev=n,s.next=n,n.prev=s,d.next=s,s.prev=d,s}function yx(r,e,n,s){let c=G1(r,e,n);return s?(c.next=s.next,c.prev=s,s.next.prev=c,s.next=c):(c.prev=c,c.next=c),c}function pp(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function G1(r,e,n){return{i:r,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class qu{constructor(e,n){if(n>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=n}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class Xm{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}Xm.noSubdivision=new Xm({fill:new qu(0,0),line:new qu(0,0),tile:new qu(0,0),stencil:new qu(0,0),circle:1}),Ye("SubdivisionGranularityExpression",qu),Ye("SubdivisionGranularitySetting",Xm);let Gu=-32768,fp=32767;class m6{constructor(e,n){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Ke/e,this._canonical=n}_getKey(e,n){return(e+=32768)<<16|n+32768}_vertexToIndex(e,n){if(e<-32768||n<-32768||e>32767||n>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let s=0|Math.round(e),c=0|Math.round(n),d=this._getKey(s,c);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);let m=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,m),this._vertexBuffer.push(s,c),m}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(c,d){let m=[];for(let _=0;_<d.length;_+=3){let x=d[_],b=d[_+1],S=d[_+2],w=c[2*x],A=c[2*x+1];(c[2*b]-w)*(c[2*S+1]-A)-(c[2*b+1]-A)*(c[2*S]-w)>0?(m.push(x),m.push(S),m.push(b)):(m.push(x),m.push(b),m.push(S))}return m})(this._vertexBuffer,e);let n=[],s=e.length;for(let c=0;c<s;c+=3){let d=[e[c+0],e[c+1],e[c+2]],m=[this._vertexBuffer[2*e[c+0]+0],this._vertexBuffer[2*e[c+0]+1],this._vertexBuffer[2*e[c+1]+0],this._vertexBuffer[2*e[c+1]+1],this._vertexBuffer[2*e[c+2]+0],this._vertexBuffer[2*e[c+2]+1]],_=1/0,x=1/0,b=-1/0,S=-1/0;for(let I=0;I<3;I++){let O=m[2*I],F=m[2*I+1];_=Math.min(_,O),b=Math.max(b,O),x=Math.min(x,F),S=Math.max(S,F)}if(_===b||x===S)continue;let w=Math.floor(_/this._granularityCellSize),A=Math.ceil(b/this._granularityCellSize),E=Math.floor(x/this._granularityCellSize),R=Math.ceil(S/this._granularityCellSize);if(w!==A||E!==R)for(let I=E;I<R;I++){let O=this._scanlineGenerateVertexRingForCellRow(I,m,d);g6(this._vertexBuffer,O,n)}else n.push(...d)}return n}_scanlineGenerateVertexRingForCellRow(e,n,s){let c=e*this._granularityCellSize,d=c+this._granularityCellSize,m=[];for(let _=0;_<3;_++){let x=n[2*_],b=n[2*_+1],S=n[2*(_+1)%6],w=n[(2*(_+1)+1)%6],A=n[2*(_+2)%6],E=n[(2*(_+2)+1)%6],R=S-x,I=w-b,O=R===0,F=I===0,V=(c-b)/I,U=(d-b)/I,j=Math.min(V,U),H=Math.max(V,U);if(!F&&(j>=1||H<=0)||F&&(b<c||b>d)){w>=c&&w<=d&&m.push(s[(_+1)%3]);continue}!F&&j>0&&m.push(this._vertexToIndex(x+R*j,b+I*j));let X=x+R*Math.max(j,0),ue=x+R*Math.min(H,1);O||this._generateIntraEdgeVertices(m,x,b,S,w,X,ue),!F&&H<1&&m.push(this._vertexToIndex(x+R*H,b+I*H)),(F||w>=c&&w<=d)&&m.push(s[(_+1)%3]),!F&&(w<=c||w>=d)&&this._generateInterEdgeVertices(m,x,b,S,w,A,E,ue,c,d)}return m}_generateIntraEdgeVertices(e,n,s,c,d,m,_){let x=c-n,b=d-s,S=b===0,w=S?Math.min(n,c):Math.min(m,_),A=S?Math.max(n,c):Math.max(m,_),E=Math.floor(w/this._granularityCellSize)+1,R=Math.ceil(A/this._granularityCellSize)-1;if(S?n<c:m<_)for(let I=E;I<=R;I++){let O=I*this._granularityCellSize;e.push(this._vertexToIndex(O,s+b*(O-n)/x))}else for(let I=R;I>=E;I--){let O=I*this._granularityCellSize;e.push(this._vertexToIndex(O,s+b*(O-n)/x))}}_generateInterEdgeVertices(e,n,s,c,d,m,_,x,b,S){let w=d-s,A=m-c,E=_-d,R=(b-d)/E,I=(S-d)/E,O=Math.min(R,I),F=Math.max(R,I),V=c+A*O,U=Math.floor(Math.min(V,x)/this._granularityCellSize)+1,j=Math.ceil(Math.max(V,x)/this._granularityCellSize)-1,H=x<V,X=E===0;if(X&&(_===b||_===S))return;if(X||O>=1||F<=0){let he=s-_,be=m+(n-m)*Math.min((b-_)/he,(S-_)/he);U=Math.floor(Math.min(be,x)/this._granularityCellSize)+1,j=Math.ceil(Math.max(be,x)/this._granularityCellSize)-1,H=x<be}let ue=w>0?S:b;if(H)for(let he=U;he<=j;he++)e.push(this._vertexToIndex(he*this._granularityCellSize,ue));else for(let he=j;he>=U;he--)e.push(this._vertexToIndex(he*this._granularityCellSize,ue))}_generateOutline(e){let n=[];for(let s of e){let c=vc(s,this._granularity,!0),d=this._pointArrayToIndices(c),m=[];for(let _=1;_<d.length;_++)m.push(d[_-1]),m.push(d[_]);n.push(m)}return n}_handlePoles(e){let n=!1,s=!1;this._canonical&&(this._canonical.y===0&&(n=!0),this._canonical.y===(1<<this._canonical.z)-1&&(s=!0)),(n||s)&&this._fillPoles(e,n,s)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let n=0;n<e.length;n+=2){let s=e[n+1];s===Gu&&(e[n+1]=-32767),s===fp&&(e[n+1]=32766)}}_generatePoleQuad(e,n,s,c,d,m){c>d!=(m===Gu)?(e.push(n),e.push(s),e.push(this._vertexToIndex(c,m)),e.push(s),e.push(this._vertexToIndex(d,m)),e.push(this._vertexToIndex(c,m))):(e.push(s),e.push(n),e.push(this._vertexToIndex(c,m)),e.push(this._vertexToIndex(d,m)),e.push(s),e.push(this._vertexToIndex(c,m)))}_fillPoles(e,n,s){let c=this._vertexBuffer,d=Ke,m=e.length;for(let _=2;_<m;_+=3){let x=e[_-2],b=e[_-1],S=e[_],w=c[2*x],A=c[2*x+1],E=c[2*b],R=c[2*b+1],I=c[2*S],O=c[2*S+1];n&&(A===0&&R===0&&this._generatePoleQuad(e,x,b,w,E,Gu),R===0&&O===0&&this._generatePoleQuad(e,b,S,E,I,Gu),O===0&&A===0&&this._generatePoleQuad(e,S,x,I,w,Gu)),s&&(A===d&&R===d&&this._generatePoleQuad(e,x,b,w,E,fp),R===d&&O===d&&this._generatePoleQuad(e,b,S,E,I,fp),O===d&&A===d&&this._generatePoleQuad(e,S,x,I,w,fp))}}_initializeVertices(e){for(let n=0;n<e.length;n+=2)this._vertexToIndex(e[n],e[n+1])}subdividePolygonInternal(e,n){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:s,holeIndices:c}=(function(_){let x=[],b=[];for(let S of _)if(S.length!==0){S!==_[0]&&x.push(b.length/2);for(let w of S)b.push(w.x),b.push(w.y)}return{flattened:b,holeIndices:x}})(e),d;this._initializeVertices(s);try{let _=(function(b,S,w=2){let A=S&&S.length,E=A?S[0]*w:b.length,R=fx(b,0,E,w,!0),I=[];if(!R||R.next===R.prev)return I;let O,F,V;if(A&&(R=(function(U,j,H,X){let ue=[];for(let he=0,be=j.length;he<be;he++){let ge=fx(U,j[he]*X,he<be-1?j[he+1]*X:U.length,X,!1);ge===ge.next&&(ge.steiner=!0),ue.push(p6(ge))}ue.sort(u6);for(let he=0;he<ue.length;he++)H=h6(ue[he],H);return H})(b,S,R,w)),b.length>80*w){O=b[0],F=b[1];let U=O,j=F;for(let H=w;H<E;H+=w){let X=b[H],ue=b[H+1];X<O&&(O=X),ue<F&&(F=ue),X>U&&(U=X),ue>j&&(j=ue)}V=Math.max(U-O,j-F),V=V!==0?32767/V:0}return up(R,I,w,O,F,V,0),I})(s,c),x=this._convertIndices(s,_);d=this._subdivideTrianglesScanline(x)}catch(_){console.error(_)}let m=[];return n&&(m=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:m}}_convertIndices(e,n){let s=[];for(let c of n)s.push(this._vertexToIndex(e[2*c],e[2*c+1]));return s}_pointArrayToIndices(e){let n=[];for(let s of e)n.push(this._vertexToIndex(s.x,s.y));return n}}function vx(r,e,n,s=!0){return new m6(n,e).subdividePolygonInternal(r,s)}function vc(r,e,n=!1){if(!r||r.length<1)return[];if(r.length<2)return[];let s=r[0],c=r[r.length-1],d=n&&(s.x!==c.x||s.y!==c.y);if(e<2)return d?[...r,r[0]]:[...r];let m=Math.floor(Ke/e),_=[];_.push(new D(r[0].x,r[0].y));let x=r.length,b=d?x:x-1;for(let S=0;S<b;S++){let w=r[S],A=S<x-1?r[S+1]:r[0],E=w.x,R=w.y,I=A.x,O=A.y,F=E!==I,V=R!==O;if(!F&&!V)continue;let U=I-E,j=O-R,H=Math.abs(U),X=Math.abs(j),ue=E,he=R;for(;;){let ge=U>0?(Math.floor(ue/m)+1)*m:(Math.ceil(ue/m)-1)*m,Me=j>0?(Math.floor(he/m)+1)*m:(Math.ceil(he/m)-1)*m,Ee=Math.abs(ue-ge),we=Math.abs(he-Me),_e=Math.abs(ue-I),Fe=Math.abs(he-O),Ge=F?Ee/H:Number.POSITIVE_INFINITY,je=V?we/X:Number.POSITIVE_INFINITY;if((_e<=Ee||!F)&&(Fe<=we||!V))break;if(Ge<je&&F||!V){ue=ge,he+=j*Ge;let Ne=new D(ue,Math.round(he));_[_.length-1].x===Ne.x&&_[_.length-1].y===Ne.y||_.push(Ne)}else{ue+=U*je,he=Me;let Ne=new D(Math.round(ue),he);_[_.length-1].x===Ne.x&&_[_.length-1].y===Ne.y||_.push(Ne)}}let be=new D(I,O);_[_.length-1].x===be.x&&_[_.length-1].y===be.y||_.push(be)}return _}function g6(r,e,n){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,c=r[2*e[0]];for(let x=1;x<e.length;x++){let b=r[2*e[x]];b<c&&(c=b,s=x)}let d=e.length,m=s,_=(m+1)%d;for(;;){let x=m-1>=0?m-1:d-1,b=(_+1)%d,S=r[2*e[x]],w=r[2*e[b]],A=r[2*e[m]],E=r[2*e[m]+1],R=r[2*e[_]+1],I=!1;if(S<w)I=!0;else if(S>w)I=!1;else{let O=R-E,F=-(r[2*e[_]]-A),V=E<R?1:-1;((S-A)*O+(r[2*e[x]+1]-E)*F)*V>((w-A)*O+(r[2*e[b]+1]-E)*F)*V&&(I=!0)}if(I){let O=e[x],F=e[m],V=e[_];O!==F&&O!==V&&F!==V&&n.push(V,F,O),m--,m<0&&(m=d-1)}else{let O=e[b],F=e[m],V=e[_];O!==F&&O!==V&&F!==V&&n.push(V,F,O),_++,_>=d&&(_=0)}if(x===b)break}}function bx(r,e,n,s,c,d,m,_,x){let b=c.length/2,S=m&&_&&x;if(b<$e.MAX_VERTEX_ARRAY_LENGTH){let w=e.prepareSegment(b,n,s),A=w.vertexLength;for(let I=0;I<d.length;I+=3)s.emplaceBack(A+d[I],A+d[I+1],A+d[I+2]);let E,R;w.vertexLength+=b,w.primitiveLength+=d.length/3,S&&(R=m.prepareSegment(b,n,_),E=R.vertexLength,R.vertexLength+=b);for(let I=0;I<c.length;I+=2)r(c[I],c[I+1]);if(S)for(let I of x){for(let O=1;O<I.length;O+=2)_.emplaceBack(E+I[O-1],E+I[O]);R.primitiveLength+=I.length/2}}else(function(w,A,E,R,I,O){let F=[];for(let X=0;X<R.length/2;X++)F.push(-1);let V={count:0},U=0,j=w.getOrCreateLatestSegment(A,E),H=j.vertexLength;for(let X=2;X<I.length;X+=3){let ue=I[X-2],he=I[X-1],be=I[X],ge=F[ue]<U,Me=F[he]<U,Ee=F[be]<U;j.vertexLength+((ge?1:0)+(Me?1:0)+(Ee?1:0))>$e.MAX_VERTEX_ARRAY_LENGTH&&(j=w.createNewSegment(A,E),U=V.count,ge=!0,Me=!0,Ee=!0,H=0);let we=mp(F,R,O,V,ue,ge,j),_e=mp(F,R,O,V,he,Me,j),Fe=mp(F,R,O,V,be,Ee,j);E.emplaceBack(H+we-U,H+_e-U,H+Fe-U),j.primitiveLength++}})(e,n,s,c,d,r),S&&(function(w,A,E,R,I,O){let F=[];for(let X=0;X<R.length/2;X++)F.push(-1);let V={count:0},U=0,j=w.getOrCreateLatestSegment(A,E),H=j.vertexLength;for(let X of I)for(let ue=1;ue<X.length;ue+=2){let he=X[ue-1],be=X[ue],ge=F[he]<U,Me=F[be]<U;j.vertexLength+((ge?1:0)+(Me?1:0))>$e.MAX_VERTEX_ARRAY_LENGTH&&(j=w.createNewSegment(A,E),U=V.count,ge=!0,Me=!0,H=0);let Ee=mp(F,R,O,V,he,ge,j),we=mp(F,R,O,V,be,Me,j);E.emplaceBack(H+Ee-U,H+we-U),j.primitiveLength++}})(m,n,_,c,x,r),e.forceNewSegmentOnNextPrepare(),m?.forceNewSegmentOnNextPrepare()}function mp(r,e,n,s,c,d,m){if(d){let _=s.count;return n(e[2*c],e[2*c+1]),r[c]=s.count,s.count++,m.vertexLength++,_}return r[c]}class Z1{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((n=>n.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new W,this.indexArray=new Pe,this.indexArray2=new Qe,this.programConfigurations=new Ua(e.layers,e.zoom),this.segments=new $e,this.segments2=new $e,this.stateDependentLayerIds=this.layers.filter((n=>n.isStateDependent())).map((n=>n.id))}populate(e,n,s){this.hasDependencies=Zm("fill",this.layers,n);let c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),m=[];for(let{feature:_,id:x,index:b,sourceLayerIndex:S}of e){let w=this.layers[0]._featureFilter.needGeometry,A=mo(_,w);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),A,s))continue;let E=d?c.evaluate(A,{},s,n.availableImages):void 0,R={id:x,properties:_.properties,type:_.type,sourceLayerIndex:S,index:b,geometry:w?A.geometry:fo(_),patterns:{},sortKey:E};m.push(R)}d&&m.sort(((_,x)=>_.sortKey-x.sortKey));for(let _ of m){let{geometry:x,index:b,sourceLayerIndex:S}=_;if(this.hasDependencies){let w=j1("fill",this.layers,_,{zoom:this.zoom},n);this.patternFeatures.push(w)}else this.addFeature(_,x,b,s,{},n.subdivisionGranularity);n.featureIndex.insert(e[b].feature,x,b,S,this.index)}}update(e,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,{imagePositions:s})}addFeatures(e,n,s){for(let c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,s,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,a6),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,n,s,c,d,m){for(let _ of cu(n,500)){let x=vx(_,c,m.fill.getGranularityForZoomLevel(c.z)),b=this.layoutVertexArray;bx(((S,w)=>{b.emplaceBack(S,w)}),this.segments,this.layoutVertexArray,this.indexArray,x.verticesFlattened,x.indicesTriangles,this.segments2,this.indexArray2,x.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:d,canonical:c})}}let xx,wx;Ye("FillBucket",Z1,{omit:["layers","patternFeatures"]});var _6={get paint(){return wx=wx||new Yn({"fill-antialias":new Je(Ce.paint_fill["fill-antialias"]),"fill-opacity":new it(Ce.paint_fill["fill-opacity"]),"fill-color":new it(Ce.paint_fill["fill-color"]),"fill-outline-color":new it(Ce.paint_fill["fill-outline-color"]),"fill-translate":new Je(Ce.paint_fill["fill-translate"]),"fill-translate-anchor":new Je(Ce.paint_fill["fill-translate-anchor"]),"fill-pattern":new so(Ce.paint_fill["fill-pattern"])})},get layout(){return xx=xx||new Yn({"fill-sort-key":new it(Ce.layout_fill["fill-sort-key"])})}};class y6 extends Rr{constructor(e,n){super(e,_6,n)}recalculate(e,n){super.recalculate(e,n);let s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Z1(e)}queryRadius(){return qm(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:n,transform:s,pixelsToTileUnits:c}){return Qb(Gm(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,c),n)}isTileClipped(){return!0}}let v6=ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),b6=ii([{name:"a_centroid",components:2,type:"Int16"}],4),{members:x6}=v6;class gp{constructor(e,n,s,c,d){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=c,this._values=d,e.readFields(w6,this,n)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let n=e.readVarint()+e.pos,s=[],c,d=1,m=0,_=0,x=0;for(;e.pos<n;){if(m<=0){let b=e.readVarint();d=7&b,m=b>>3}if(m--,d===1||d===2)_+=e.readSVarint(),x+=e.readSVarint(),d===1&&(c&&s.push(c),c=[]),c&&c.push(new D(_,x));else{if(d!==7)throw new Error(`unknown command ${d}`);c&&c.push(c[0].clone())}}return c&&s.push(c),s}bbox(){let e=this._pbf;e.pos=this._geometry;let n=e.readVarint()+e.pos,s=1,c=0,d=0,m=0,_=1/0,x=-1/0,b=1/0,S=-1/0;for(;e.pos<n;){if(c<=0){let w=e.readVarint();s=7&w,c=w>>3}if(c--,s===1||s===2)d+=e.readSVarint(),m+=e.readSVarint(),d<_&&(_=d),d>x&&(x=d),m<b&&(b=m),m>S&&(S=m);else if(s!==7)throw new Error(`unknown command ${s}`)}return[_,b,x,S]}toGeoJSON(e,n,s){let c=this.extent*Math.pow(2,s),d=this.extent*e,m=this.extent*n,_=this.loadGeometry();function x(A){return[360*(A.x+d)/c-180,360/Math.PI*Math.atan(Math.exp((1-2*(A.y+m)/c)*Math.PI))-90]}function b(A){return A.map(x)}let S;if(this.type===1){let A=[];for(let R of _)A.push(R[0]);let E=b(A);S=A.length===1?{type:"Point",coordinates:E[0]}:{type:"MultiPoint",coordinates:E}}else if(this.type===2){let A=_.map(b);S=A.length===1?{type:"LineString",coordinates:A[0]}:{type:"MultiLineString",coordinates:A}}else{if(this.type!==3)throw new Error("unknown feature type");{let A=Tx(_),E=[];for(let R of A)E.push(R.map(b));S=E.length===1?{type:"Polygon",coordinates:E[0]}:{type:"MultiPolygon",coordinates:E}}}let w={type:"Feature",geometry:S,properties:this.properties};return this.id!=null&&(w.id=this.id),w}}function w6(r,e,n){r===1?e.id=n.readVarint():r===2?(function(s,c){let d=s.readVarint()+s.pos;for(;s.pos<d;){let m=c._keys[s.readVarint()],_=c._values[s.readVarint()];c.properties[m]=_}})(n,e):r===3?e.type=n.readVarint():r===4&&(e._geometry=n.pos)}function Tx(r){let e=r.length;if(e<=1)return[r];let n=[],s,c;for(let d=0;d<e;d++){let m=T6(r[d]);m!==0&&(c===void 0&&(c=m<0),c===m<0?(s&&n.push(s),s=[r[d]]):s&&s.push(r[d]))}return s&&n.push(s),n}function T6(r){let e=0;for(let n,s,c=0,d=r.length,m=d-1;c<d;m=c++)n=r[c],s=r[m],e+=(s.x-n.x)*(n.y+s.y);return e}gp.types=["Unknown","Point","LineString","Polygon"];class S6{constructor(e,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(M6,this,n),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let n=this._pbf.readVarint()+this._pbf.pos;return new gp(this._pbf,n,this.extent,this._keys,this._values)}}function M6(r,e,n){r===15?e.version=n.readVarint():r===1?e.name=n.readString():r===5?e.extent=n.readVarint():r===2?e._features.push(n.pos):r===3?e._keys.push(n.readString()):r===4&&e._values.push((function(s){let c=null,d=s.readVarint()+s.pos;for(;s.pos<d;){let m=s.readVarint()>>3;c=m===1?s.readString():m===2?s.readFloat():m===3?s.readDouble():m===4?s.readVarint64():m===5?s.readVarint():m===6?s.readSVarint():m===7?s.readBoolean():null}if(c==null)throw new Error("unknown feature value");return c})(n))}class Sx{constructor(e,n){this.layers=e.readFields(E6,{},n)}}function E6(r,e,n){if(r===3){let s=new S6(n,n.readVarint()+n.pos);s.length&&(e[s.name]=s)}}let H1=Math.pow(2,13);function _p(r,e,n,s,c,d,m,_){r.emplaceBack(e,n,2*Math.floor(s*H1)+m,c*H1*2,d*H1*2,Math.round(_))}class $1{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((n=>n.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new ee,this.centroidVertexArray=new $,this.indexArray=new Pe,this.programConfigurations=new Ua(e.layers,e.zoom),this.segments=new $e,this.stateDependentLayerIds=this.layers.filter((n=>n.isStateDependent())).map((n=>n.id))}populate(e,n,s){this.features=[],this.hasDependencies=Zm("fill-extrusion",this.layers,n);for(let{feature:c,id:d,index:m,sourceLayerIndex:_}of e){let x=this.layers[0]._featureFilter.needGeometry,b=mo(c,x);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),b,s))continue;let S={id:d,sourceLayerIndex:_,index:m,geometry:x?b.geometry:fo(c),properties:c.properties,type:c.type,patterns:{}};this.hasDependencies?this.features.push(j1("fill-extrusion",this.layers,S,{zoom:this.zoom},n)):this.addFeature(S,S.geometry,m,s,{},n.subdivisionGranularity),n.featureIndex.insert(c,S.geometry,m,_,this.index,!0)}}addFeatures(e,n,s){for(let c of this.features){let{geometry:d}=c;this.addFeature(c,d,c.index,n,s,e.subdivisionGranularity)}}update(e,n,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,x6),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,b6.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,n,s,c,d,m){for(let _ of cu(n,500)){let x={x:0,y:0,sampleCount:0},b=this.layoutVertexArray.length;this.processPolygon(x,c,e,_,m);let S=this.layoutVertexArray.length-b,w=Math.floor(x.x/x.sampleCount),A=Math.floor(x.y/x.sampleCount);for(let E=0;E<S;E++)this.centroidVertexArray.emplaceBack(w,A)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:d,canonical:c})}processPolygon(e,n,s,c,d){if(c.length<1||Mx(c[0]))return;for(let w of c)w.length!==0&&C6(e,w);let m={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},_=d.fill.getGranularityForZoomLevel(n.z),x=gp.types[s.type]==="Polygon";for(let w of c){if(w.length===0||Mx(w))continue;let A=vc(w,_,x);this._generateSideFaces(A,m)}if(!x)return;let b=vx(c,n,_,!1),S=this.layoutVertexArray;bx(((w,A)=>{_p(S,w,A,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,b.verticesFlattened,b.indicesTriangles)}_generateSideFaces(e,n){let s=0;for(let c=1;c<e.length;c++){let d=e[c],m=e[c-1];if(A6(d,m))continue;n.segment.vertexLength+4>$e.MAX_VERTEX_ARRAY_LENGTH&&(n.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let _=d.sub(m)._perp()._unit(),x=m.dist(d);s+x>32768&&(s=0),_p(this.layoutVertexArray,d.x,d.y,_.x,_.y,0,0,s),_p(this.layoutVertexArray,d.x,d.y,_.x,_.y,0,1,s),s+=x,_p(this.layoutVertexArray,m.x,m.y,_.x,_.y,0,0,s),_p(this.layoutVertexArray,m.x,m.y,_.x,_.y,0,1,s);let b=n.segment.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),n.segment.vertexLength+=4,n.segment.primitiveLength+=2}}}function C6(r,e){for(let n=0;n<e.length;n++){let s=e[n];n===e.length-1&&e[0].x===s.x&&e[0].y===s.y||(r.x+=s.x,r.y+=s.y,r.sampleCount++)}}function A6(r,e){return r.x===e.x&&(r.x<0||r.x>Ke)||r.y===e.y&&(r.y<0||r.y>Ke)}function Mx(r){return r.every((e=>e.x<0))||r.every((e=>e.x>Ke))||r.every((e=>e.y<0))||r.every((e=>e.y>Ke))}let Ex;Ye("FillExtrusionBucket",$1,{omit:["layers","features"]});var z6={get paint(){return Ex=Ex||new Yn({"fill-extrusion-opacity":new Je(Ce["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new it(Ce["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Je(Ce["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Je(Ce["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new so(Ce["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new it(Ce["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new it(Ce["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Je(Ce["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class D6 extends Rr{constructor(e,n){super(e,z6,n)}createBucket(e){return new $1(e)}queryRadius(){return qm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:n,featureState:s,geometry:c,transform:d,pixelsToTileUnits:m,pixelPosMatrix:_}){let x=Gm(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,m),b=this.paint.get("fill-extrusion-height").evaluate(n,s),S=this.paint.get("fill-extrusion-base").evaluate(n,s),w=(function(E,R){let I=[];for(let O of E){let F=[O.x,O.y,0,1];nt(F,F,R),I.push(new D(F[0]/F[3],F[1]/F[3]))}return I})(x,_),A=(function(E,R,I,O){let F=[],V=[],U=O[8]*R,j=O[9]*R,H=O[10]*R,X=O[11]*R,ue=O[8]*I,he=O[9]*I,be=O[10]*I,ge=O[11]*I;for(let Me of E){let Ee=[],we=[];for(let _e of Me){let Fe=_e.x,Ge=_e.y,je=O[0]*Fe+O[4]*Ge+O[12],Ne=O[1]*Fe+O[5]*Ge+O[13],at=O[2]*Fe+O[6]*Ge+O[14],Mt=O[3]*Fe+O[7]*Ge+O[15],Pt=at+H,Ht=Mt+X,Bn=je+ue,Ci=Ne+he,Ji=at+be,dn=Mt+ge,mi=new D((je+U)/Ht,(Ne+j)/Ht);mi.z=Pt/Ht,Ee.push(mi);let En=new D(Bn/dn,Ci/dn);En.z=Ji/dn,we.push(En)}F.push(Ee),V.push(we)}return[F,V]})(c,S,b,_);return(function(E,R,I){let O=1/0;Qb(I,R)&&(O=Cx(I,R[0]));for(let F=0;F<R.length;F++){let V=R[F],U=E[F];for(let j=0;j<V.length-1;j++){let H=V[j],X=[H,V[j+1],U[j+1],U[j],H];Nu(I,X)&&(O=Math.min(O,Cx(I,X)))}}return O!==1/0&&O})(A[0],A[1],w)}}function yp(r,e){return r.x*e.x+r.y*e.y}function Cx(r,e){if(r.length===1){let n=0,s=e[n++],c;for(;!c||s.equals(c);)if(c=e[n++],!c)return 1/0;for(;n<e.length;n++){let d=e[n],m=r[0],_=c.sub(s),x=d.sub(s),b=m.sub(s),S=yp(_,_),w=yp(_,x),A=yp(x,x),E=yp(b,_),R=yp(b,x),I=S*A-w*w,O=(A*E-w*R)/I,F=(S*R-w*E)/I,V=s.z*(1-O-F)+c.z*O+d.z*F;if(isFinite(V))return V}return 1/0}{let n=1/0;for(let s of e)n=Math.min(n,s.z);return n}}let Ax=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Ym{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[n,s]=new Uint8Array(e,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");let c=s>>4;if(c!==1)throw new Error(`Got v${c} data when expected v1.`);let d=Ax[15&s];if(!d)throw new Error("Unrecognized array type.");let[m]=new Uint16Array(e,2,1),[_]=new Uint32Array(e,4,1);return new Ym(_,m,d,e)}constructor(e,n=64,s=Float64Array,c){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let d=Ax.indexOf(this.ArrayType),m=2*e*this.ArrayType.BYTES_PER_ELEMENT,_=e*this.IndexArrayType.BYTES_PER_ELEMENT,x=(8-_%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${s}.`);c&&c instanceof ArrayBuffer?(this.data=c,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+_+x,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+m+_+x),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+_+x,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=e)}add(e,n){let s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=n,s}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return X1(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,n,s,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:d,coords:m,nodeSize:_}=this,x=[0,d.length-1,0],b=[];for(;x.length;){let S=x.pop()||0,w=x.pop()||0,A=x.pop()||0;if(w-A<=_){for(let O=A;O<=w;O++){let F=m[2*O],V=m[2*O+1];F>=e&&F<=s&&V>=n&&V<=c&&b.push(d[O])}continue}let E=A+w>>1,R=m[2*E],I=m[2*E+1];R>=e&&R<=s&&I>=n&&I<=c&&b.push(d[E]),(S===0?e<=R:n<=I)&&(x.push(A),x.push(E-1),x.push(1-S)),(S===0?s>=R:c>=I)&&(x.push(E+1),x.push(w),x.push(1-S))}return b}within(e,n,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:c,coords:d,nodeSize:m}=this,_=[0,c.length-1,0],x=[],b=s*s;for(;_.length;){let S=_.pop()||0,w=_.pop()||0,A=_.pop()||0;if(w-A<=m){for(let O=A;O<=w;O++)Dx(d[2*O],d[2*O+1],e,n)<=b&&x.push(c[O]);continue}let E=A+w>>1,R=d[2*E],I=d[2*E+1];Dx(R,I,e,n)<=b&&x.push(c[E]),(S===0?e-s<=R:n-s<=I)&&(_.push(A),_.push(E-1),_.push(1-S)),(S===0?e+s>=R:n+s>=I)&&(_.push(E+1),_.push(w),_.push(1-S))}return x}}function X1(r,e,n,s,c,d){if(c-s<=n)return;let m=s+c>>1;zx(r,e,m,s,c,d),X1(r,e,n,s,m-1,1-d),X1(r,e,n,m+1,c,1-d)}function zx(r,e,n,s,c,d){for(;c>s;){if(c-s>600){let b=c-s+1,S=n-s+1,w=Math.log(b),A=.5*Math.exp(2*w/3),E=.5*Math.sqrt(w*A*(b-A)/b)*(S-b/2<0?-1:1);zx(r,e,n,Math.max(s,Math.floor(n-S*A/b+E)),Math.min(c,Math.floor(n+(b-S)*A/b+E)),d)}let m=e[2*n+d],_=s,x=c;for(vp(r,e,s,n),e[2*c+d]>m&&vp(r,e,s,c);_<x;){for(vp(r,e,_,x),_++,x--;e[2*_+d]<m;)_++;for(;e[2*x+d]>m;)x--}e[2*s+d]===m?vp(r,e,s,x):(x++,vp(r,e,x,c)),x<=n&&(s=x+1),n<=x&&(c=x-1)}}function vp(r,e,n,s){Y1(r,n,s),Y1(e,2*n,2*s),Y1(e,2*n+1,2*s+1)}function Y1(r,e,n){let s=r[e];r[e]=r[n],r[n]=s}function Dx(r,e,n,s){let c=r-n,d=e-s;return c*c+d*d}function W1(r,e,n,s){let c=s,d=e+(n-e>>1),m,_=n-e,x=r[e],b=r[e+1],S=r[n],w=r[n+1];for(let A=e+3;A<n;A+=3){let E=P6(r[A],r[A+1],x,b,S,w);if(E>c)m=A,c=E;else if(E===c){let R=Math.abs(A-d);R<_&&(m=A,_=R)}}c>s&&(m-e>3&&W1(r,e,m,s),r[m+2]=c,n-m>3&&W1(r,m,n,s))}function P6(r,e,n,s,c,d){let m=c-n,_=d-s;if(m!==0||_!==0){let x=((r-n)*m+(e-s)*_)/(m*m+_*_);x>1?(n=c,s=d):x>0&&(n+=m*x,s+=_*x)}return m=r-n,_=e-s,m*m+_*_}function Mn(r,e,n,s){let c={type:e,geom:n},d={id:r??null,type:c.type,geometry:c.geom,tags:s,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(c.type){case"Point":case"MultiPoint":bp(d,c.geom);break;case"LineString":bp(d,c.geom.points);break;case"Polygon":bp(d,c.geom[0].points);break;case"MultiLineString":for(let m of c.geom)bp(d,m.points);break;case"MultiPolygon":for(let m of c.geom)bp(d,m[0].points)}return d}function K1(r){r.points.length>64&&(r.points=new Float64Array(r.points))}function bp(r,e){for(let n=0;n<e.length;n+=3)r.minX=Math.min(r.minX,e[n]),r.minY=Math.min(r.minY,e[n+1]),r.maxX=Math.max(r.maxX,e[n]),r.maxY=Math.max(r.maxY,e[n+1])}function Q1(r,e){let n=[];switch(r.type){case"FeatureCollection":for(let s=0;s<r.features.length;s++)Wm(n,r.features[s],e,s);break;case"Feature":Wm(n,r,e);break;default:Wm(n,{geometry:r,properties:void 0},e)}return n}function Wm(r,e,n,s){if(!e.geometry)return;if(e.geometry.type==="GeometryCollection")return void(function(_,x,b,S,w){for(let A of b.geometries)Wm(_,{id:x.id,geometry:A,properties:x.properties},S,w)})(r,e,e.geometry,n,s);if(!e.geometry.coordinates?.length)return;let d=(function(_,x,b){return x.promoteId?_.properties?.[x.promoteId]:x.generateId?b||0:_.id})(e,n,s),m=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2);switch(e.geometry.type){case"Point":return void(function(_,x,b,S){let w=[];w.push(Zu(b.coordinates[0]),Hu(b.coordinates[1]),0),_.push(Mn(x,"Point",w,S))})(r,d,e.geometry,e.properties);case"MultiPoint":return void(function(_,x,b,S){let w=[];for(let A of b.coordinates)w.push(Zu(A[0]),Hu(A[1]),0);_.push(Mn(x,"MultiPoint",w,S))})(r,d,e.geometry,e.properties);case"LineString":return void(function(_,x,b,S,w){let A={points:[]};J1(b.coordinates,A,S,!1),_.push(Mn(x,"LineString",A,w))})(r,d,e.geometry,m,e.properties);case"MultiLineString":return void(function(_,x,b,S,w,A){if(w.lineMetrics)for(let E of b.coordinates){let R={points:[]};J1(E,R,S,!1),_.push(Mn(x,"LineString",R,A))}else{let E=[];e_(b.coordinates,E,S,!1),_.push(Mn(x,"MultiLineString",E,A))}})(r,d,e.geometry,m,n,e.properties);case"Polygon":return void(function(_,x,b,S,w){let A=[];e_(b.coordinates,A,S,!0),_.push(Mn(x,"Polygon",A,w))})(r,d,e.geometry,m,e.properties);case"MultiPolygon":return void(function(_,x,b,S,w){let A=[];for(let E of b.coordinates){let R=[];e_(E,R,S,!0),A.push(R)}_.push(Mn(x,"MultiPolygon",A,w))})(r,d,e.geometry,m,e.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function J1(r,e,n,s){let c,d,m=0;for(let x=0;x<r.length;x++){let b=Zu(r[x][0]),S=Hu(r[x][1]);e.points.push(b,S,0),x>0&&(m+=s?(c*S-b*d)/2:Math.sqrt(Math.pow(b-c,2)+Math.pow(S-d,2))),c=b,d=S}let _=e.points.length-3;e.points[2]=1,n>0&&W1(e.points,0,_,n),e.points[_+2]=1,K1(e),e.size=Math.abs(m),e.start=0,e.end=e.size}function e_(r,e,n,s){for(let c=0;c<r.length;c++){let d={points:[]};J1(r[c],d,n,s),e.push(d)}}function Zu(r){return r/360+.5}function Hu(r){let e=Math.sin(r*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function Km(r){let e={type:"Feature",geometry:R6(r),properties:r.tags};return r.id!=null&&(e.id=r.id),e}function R6(r){let{type:e,geometry:n}=r;switch(e){case"Point":return{type:e,coordinates:Px(n[0],n[1])};case"MultiPoint":return{type:e,coordinates:Qm(n)};case"LineString":return{type:e,coordinates:Qm(n.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:n.map((s=>Qm(s.points)))};case"MultiPolygon":return{type:e,coordinates:n.map((s=>s.map((c=>Qm(c.points)))))}}}function Qm(r){let e=[];for(let n=0;n<r.length;n+=3)e.push(Px(r[n],r[n+1]));return e}function Px(r,e){return[Rx(r),Ix(e)]}function Rx(r){return 360*(r-.5)}function Ix(r){let e=(180-360*r)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var Kn;function es(r,e,n,s,c,d,m,_){if(s/=e,d>=(n/=e)&&m<s)return r;if(m<n||d>=s)return null;let x=[];for(let b of r){let S=c===Kn.X?b.minX:b.minY,w=c===Kn.X?b.maxX:b.maxY;if(S>=n&&w<s)x.push(b);else if(!(w<n||S>=s))switch(b.type){case"Point":case"MultiPoint":I6(b,x,n,s,c);continue;case"LineString":k6(b,x,n,s,c,_);continue;case"MultiLineString":L6(b,x,n,s,c);continue;case"Polygon":O6(b,x,n,s,c);continue;case"MultiPolygon":B6(b,x,n,s,c);continue}}return x.length?x:null}function I6(r,e,n,s,c){let d=[];(function(m,_,x,b,S){for(let w=0;w<m.length;w+=3){let A=m[w+S];A>=x&&A<=b&&$u(_,m[w],m[w+1],m[w+2])}})(r.geometry,d,n,s,c),d.length&&e.push(Mn(r.id,d.length===3?"Point":"MultiPoint",d,r.tags))}function k6(r,e,n,s,c,d){let m=[];if(kx(r.geometry,m,n,s,c,!1,d.lineMetrics),m.length)if(d.lineMetrics)for(let _ of m)e.push(Mn(r.id,"LineString",_,r.tags));else e.push(m.length>1?Mn(r.id,"MultiLineString",m,r.tags):Mn(r.id,"LineString",m[0],r.tags))}function L6(r,e,n,s,c){let d=[];t_(r.geometry,d,n,s,c,!1),d.length&&e.push(d.length!==1?Mn(r.id,"MultiLineString",d,r.tags):Mn(r.id,"LineString",d[0],r.tags))}function O6(r,e,n,s,c){let d=[];t_(r.geometry,d,n,s,c,!0),d.length&&e.push(Mn(r.id,"Polygon",d,r.tags))}function B6(r,e,n,s,c){let d=[];for(let m of r.geometry){let _=[];t_(m,_,n,s,c,!0),_.length&&d.push(_)}d.length&&e.push(Mn(r.id,"MultiPolygon",d,r.tags))}function kx(r,e,n,s,c,d,m){let _=Lx(r),x=c===Kn.X?F6:N6,b,S,w=r.start;for(let O=0;O<r.points.length-3;O+=3){let F=r.points[O],V=r.points[O+1],U=r.points[O+2],j=r.points[O+3],H=r.points[O+4],X=c===Kn.X?F:V,ue=c===Kn.X?j:H,he=!1;m&&(b=Math.sqrt(Math.pow(F-j,2)+Math.pow(V-H,2))),X<n?ue>n&&(S=x(_,F,V,j,H,n),m&&(_.start=w+b*S)):X>s?ue<s&&(S=x(_,F,V,j,H,s),m&&(_.start=w+b*S)):$u(_.points,F,V,U),ue<n&&X>=n&&(S=x(_,F,V,j,H,n),he=!0),ue>s&&X<=s&&(S=x(_,F,V,j,H,s),he=!0),!d&&he&&(m&&(_.end=w+b*S),e.push(_),_=Lx(r)),m&&(w+=b)}let A=r.points.length-3,E=r.points[A],R=r.points[A+1],I=c===Kn.X?E:R;I>=n&&I<=s&&$u(_.points,E,R,r.points[A+2]),A=_.points.length-3,d&&A>=3&&(_.points[A]!==_.points[0]||_.points[A+1]!==_.points[1])&&$u(_.points,_.points[0],_.points[1],_.points[2]),_.points.length&&(K1(_),e.push(_))}function Lx(r){return{points:[],size:r.size,start:r.start,end:r.end}}function t_(r,e,n,s,c,d){for(let m of r)kx(m,e,n,s,c,d,!1)}function $u(r,e,n,s){r.push(e,n,s)}function F6(r,e,n,s,c,d){let m=(d-e)/(s-e);return $u(r.points,d,n+(c-n)*m,1),m}function N6(r,e,n,s,c,d){let m=(d-n)/(c-n);return $u(r.points,e+(s-e)*m,d,1),m}function i_(r,e){let n=e.buffer/e.extent,s=r,c=es(r,1,-1-n,n,Kn.X,-1,2,e),d=es(r,1,1-n,2+n,Kn.X,-1,2,e);return(c||d)&&(s=es(r,1,-n,1+n,Kn.X,-1,2,e)||[],c&&(s=Ox(c,1).concat(s)),d&&(s=s.concat(Ox(d,-1)))),s}function Ox(r,e){let n=[];for(let s of r)switch(s.type){case"Point":case"MultiPoint":{let c=U6(s.geometry,e);n.push(Mn(s.id,s.type,c,s.tags));continue}case"LineString":{let c=n_(s.geometry,e);n.push(Mn(s.id,s.type,c,s.tags));continue}case"MultiLineString":case"Polygon":{let c=[];for(let d of s.geometry)c.push(n_(d,e));n.push(Mn(s.id,s.type,c,s.tags));continue}case"MultiPolygon":{let c=[];for(let d of s.geometry){let m=[];for(let _ of d)m.push(n_(_,e));c.push(m)}n.push(Mn(s.id,s.type,c,s.tags));continue}}return n}function U6(r,e){let n=[];for(let s=0;s<r.length;s+=3)n.push(r[s]+e,r[s+1],r[s+2]);return n}function n_(r,e){let n={points:[],size:r.size};r.start!==void 0&&(n.start=r.start,n.end=r.end);for(let s=0;s<r.points.length;s+=3)n.points.push(r.points[s]+e,r.points[s+1],r.points[s+2]);return K1(n),n}function V6(r,e,n){let s=!!e.newGeometry,c=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(s){let d=r[0],m=Q1({type:"FeatureCollection",features:[{type:"Feature",id:d.id,geometry:e.newGeometry,properties:c?Bx(d.tags,e):d.tags}]},n);return m=i_(m,n),m}if(c){let d=[];for(let m of r){let _={...m};_.tags=Bx(_.tags,e),d.push(_)}return d}return r}function Bx(r,e){if(e.removeAllProperties)return{};let n={...r||{}};if(e.removeProperties)for(let s of e.removeProperties)delete n[s];if(e.addOrUpdateProperties)for(let{key:s,value:c}of e.addOrUpdateProperties)n[s]=c;return n}(function(r){r[r.X=0]="X",r[r.Y=1]="Y"})(Kn||(Kn={}));let r_={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:r=>r};class j6{constructor(e){this.options=Object.assign(Object.create(r_),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){let n=[];for(let s of e){if(!s.geometry)continue;let[c,d]=s.geometry.coordinates,[m,_]=[Zu(c),Hu(d)];n.push({id:s.id,type:"Point",geometry:[m,_],tags:s.properties})}this.createIndex(n)}initialize(e){let n=[];for(let s of e)s.type==="Point"&&n.push(s);this.createIndex(n)}updateIndex(e,n,s){this.options=Object.assign(Object.create(r_),s.clusterOptions),this.initialize(e)}createIndex(e){let{log:n,minZoom:s,maxZoom:c}=this.options;n&&console.time("total time");let d=`prepare ${e.length} points`;n&&console.time(d),this.points=e;let m=[];for(let x=0;x<e.length;x++){let b=e[x];if(!b?.geometry)continue;let[S,w]=b.geometry;S=Math.fround(S),w=Math.fround(w),m.push(S,w,1/0,x,-1,1),this.options.reduce&&m.push(0)}let _=this.trees[c+1]=this.createTree(m);n&&console.timeEnd(d);for(let x=c;x>=s;x--){let b=Date.now();_=this.trees[x]=this.createTree(this.cluster(_,x)),n&&console.log("z%d: %d clusters in %dms",x,_.numItems,Date.now()-b)}n&&console.timeEnd("total time")}getClusters(e,n){return this.getClustersInternal(e,n).map((s=>Km(s)))}getClustersInternal(e,n){let s=((e[0]+180)%360+360)%360-180,c=Math.max(-90,Math.min(90,e[1])),d=e[2]===180?180:((e[2]+180)%360+360)%360-180,m=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)s=-180,d=180;else if(s>d){let w=this.getClustersInternal([s,c,180,m],n),A=this.getClustersInternal([-180,c,d,m],n);return w.concat(A)}let _=this.trees[this.limitZoom(n)],x=_.range(Zu(s),Hu(m),Zu(d),Hu(c)),b=_.flatData,S=[];for(let w of x){let A=this.stride*w;S.push(b[A+5]>1?q6(b,A,this.clusterProps):this.points[b[A+3]])}return S}getChildren(e){let n=this.getOriginId(e),s=this.getOriginZoom(e),c=new Error("No cluster with the specified id: "+e),d=this.trees[s];if(!d)throw c;let m=d.flatData;if(n*this.stride>=m.length)throw c;let _=this.options.radius/(this.options.extent*Math.pow(2,s-1)),x=d.within(m[n*this.stride],m[n*this.stride+1],_),b=[];for(let S of x){let w=S*this.stride;m[w+4]===e&&b.push(m[w+5]>1?G6(m,w,this.clusterProps):Km(this.points[m[w+3]]))}if(b.length===0)throw c;return b}getLeaves(e,n,s){let c=[];return this.appendLeaves(c,e,n=n||10,s=s||0,0),c}getTile(e,n,s){let c=this.trees[this.limitZoom(e)];if(!c)return null;let d=Math.pow(2,e),{extent:m,radius:_}=this.options,x=_/m,b=(s-x)/d,S=(s+1+x)/d,w={transformed:!0,features:[],source:null,x:n,y:s,z:e};return this.addTileFeatures(c.range((n-x)/d,b,(n+1+x)/d,S),c.flatData,n,s,d,w),n===0&&this.addTileFeatures(c.range(1-x/d,b,1,S),c.flatData,d,s,d,w),n===d-1&&this.addTileFeatures(c.range(0,b,x/d,S),c.flatData,-1,s,d,w),w}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,n,s,c,d){let m=this.getChildren(n);for(let _ of m){let x=_.properties;if(x?.cluster?d+x.point_count<=c?d+=x.point_count:d=this.appendLeaves(e,x.cluster_id,s,c,d):d<c?d++:e.push(_),e.length===s)break}return d}createTree(e){let n=new Ym(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let s=0;s<e.length;s+=this.stride)n.add(e[s],e[s+1]);return n.finish(),n.flatData=e,n.data=null,n}addTileFeatures(e,n,s,c,d,m){for(let _ of e){let x=_*this.stride,b=n[x+5]>1,S,w,A;if(b)S=a_(n,x,this.clusterProps),w=n[x],A=n[x+1];else{let I=this.points[n[x+3]];S=I.tags,[w,A]=I.geometry}let E={type:1,geometry:[[Math.round(this.options.extent*(w*d-s)),Math.round(this.options.extent*(A*d-c))]],tags:S},R;R=b||this.options.generateId?n[x+3]:this.points[n[x+3]].id,R!==void 0&&(E.id=R),m.features.push(E)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,n){let{radius:s,extent:c,reduce:d,minPoints:m}=this.options,_=s/(c*Math.pow(2,n)),x=e.flatData,b=[],S=this.stride;for(let w=0;w<x.length;w+=S){if(x[w+2]<=n)continue;x[w+2]=n;let A=x[w],E=x[w+1],R=e.within(x[w],x[w+1],_),I=x[w+5],O=I;for(let F of R){let V=F*S;x[V+2]>n&&(O+=x[V+5])}if(O>I&&O>=m){let F,V=A*I,U=E*I,j=-1,H=(w/S<<5)+(n+1)+this.points.length;for(let X of R){let ue=X*S;if(x[ue+2]<=n)continue;x[ue+2]=n;let he=x[ue+5];V+=x[ue]*he,U+=x[ue+1]*he,x[ue+4]=H,d&&(F||(F=this.map(x,w,!0),j=this.clusterProps.length,this.clusterProps.push(F)),d(F,this.map(x,ue)))}x[w+4]=H,b.push(V/O,U/O,1/0,H,-1,O),d&&b.push(j)}else{for(let F=0;F<S;F++)b.push(x[w+F]);if(O>1)for(let F of R){let V=F*S;if(!(x[V+2]<=n)){x[V+2]=n;for(let U=0;U<S;U++)b.push(x[V+U])}}}}return b}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,n,s){if(e[n+5]>1){let m=this.clusterProps[e[n+6]];return s?Object.assign({},m):m}let c=this.points[e[n+3]].tags,d=this.options.map(c);return s&&d===c?Object.assign({},d):d}}function q6(r,e,n){return{id:r[e+3],type:"Point",tags:a_(r,e,n),geometry:[r[e],r[e+1]]}}function G6(r,e,n){return{type:"Feature",id:r[e+3],properties:a_(r,e,n),geometry:{type:"Point",coordinates:[Rx(r[e]),Ix(r[e+1])]}}}function a_(r,e,n){let s=r[e+5],c=s>=1e4?`${Math.round(s/1e3)}k`:s>=1e3?Math.round(s/100)/10+"k":s,d=r[e+6],m=d===-1?{}:Object.assign({},n[d]);return Object.assign(m,{cluster:!0,cluster_id:r[e+3],point_count:s,point_count_abbreviated:c})}let o_="geojsonvt_clip_start",s_="geojsonvt_clip_end";function Fx(r,e,n,s,c){let d=e===c.maxZoom?0:c.tolerance/((1<<e)*c.extent),m={transformed:!1,features:[],source:null,x:n,y:s,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:r.length};for(let _ of r)Z6(m,_,d,c);return m}function Z6(r,e,n,s){switch(r.minX=Math.min(r.minX,e.minX),r.minY=Math.min(r.minY,e.minY),r.maxX=Math.max(r.maxX,e.maxX),r.maxY=Math.max(r.maxY,e.maxY),e.type){case"Point":case"MultiPoint":return void(function(c,d){let m=[];for(let x=0;x<d.geometry.length;x+=3)m.push(d.geometry[x],d.geometry[x+1]),c.numPoints++,c.numSimplified++;if(!m.length)return;let _={type:1,tags:d.tags||null,geometry:m};d.id!==null&&(_.id=d.id),c.features.push(_)})(r,e);case"LineString":return void(function(c,d,m,_){let x=[];if(l_(x,d.geometry,c,m,!1,!1),!x.length)return;let b=d.tags||null;if(_.lineMetrics){b={};for(let w in d.tags)b[w]=d.tags[w];b[o_]=d.geometry.start/d.geometry.size,b[s_]=d.geometry.end/d.geometry.size}let S={type:2,tags:b,geometry:x};d.id!==null&&(S.id=d.id),c.features.push(S)})(r,e,n,s);case"MultiLineString":case"Polygon":return void(function(c,d,m){let _=[];for(let b=0;b<d.geometry.length;b++)l_(_,d.geometry[b],c,m,d.type==="Polygon",b===0);if(!_.length)return;let x={type:d.type==="Polygon"?3:2,tags:d.tags||null,geometry:_};d.id!==null&&(x.id=d.id),c.features.push(x)})(r,e,n);case"MultiPolygon":return void(function(c,d,m){let _=[];for(let b=0;b<d.geometry.length;b++){let S=d.geometry[b];for(let w=0;w<S.length;w++)l_(_,S[w],c,m,!0,w===0)}if(!_.length)return;let x={type:3,tags:d.tags||null,geometry:_};d.id!==null&&(x.id=d.id),c.features.push(x)})(r,e,n)}}function l_(r,e,n,s,c,d){let m=s*s;if(s>0&&e.size<(c?m:s))return void(n.numPoints+=e.points.length/3);let _=[];for(let x=0;x<e.points.length;x+=3)(s===0||e.points[x+2]>m)&&(n.numSimplified++,_.push(e.points[x],e.points[x+1])),n.numPoints++;c&&(function(x,b){let S=0;for(let w=0,A=x.length,E=A-2;w<A;E=w,w+=2)S+=(x[w]-x[E])*(x[w+1]+x[E+1]);if(S>0===b)for(let w=0,A=x.length;w<A/2;w+=2){let E=x[w],R=x[w+1];x[w]=x[A-2-w],x[w+1]=x[A-1-w],x[A-2-w]=E,x[A-1-w]=R}})(_,d),r.push(_)}function Nx(r,e){if(r.transformed)return r;let n=1<<r.z,s=r.x,c=r.y;for(let d of r.features)d.type===1?H6(d,e,n,s,c):$6(d,e,n,s,c);return r.transformed=!0,r}function H6(r,e,n,s,c){let d=r,m=r.geometry,_=[];for(let x=0;x<m.length;x+=2)_.push(Ux(m[x],m[x+1],e,n,s,c));return d.geometry=_,d}function $6(r,e,n,s,c){let d=r,m=r.geometry,_=[];for(let x of m){let b=[];for(let S=0;S<x.length;S+=2)b.push(Ux(x[S],x[S+1],e,n,s,c));_.push(b)}return d.geometry=_,d}function Ux(r,e,n,s,c,d){return[Math.round(n*(r*s-c)),Math.round(n*(e*s-d))]}class X6{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(e,n,s){s.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(n),s.debug>1&&console.timeEnd("invalidating");let[c,d,m]=[0,0,0],_=Fx(e,c,d,m,s);_.source=e;let x=Jm(c,d,m);if(this.tiles[x]=_,this.tileCoords.push({z:c,x:d,y:m,id:x}),s.debug){let b=`z${c}`;this.stats[b]=(this.stats[b]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,n,s){return null}getTile(e,n,s){let{extent:c,debug:d}=this.options,m=1<<e,_=Jm(e,n=n+m&m-1,s);if(this.tiles[_])return Nx(this.tiles[_],c);d>1&&console.log("drilling down to z%d-%d-%d",e,n,s);let x,b=e,S=n,w=s;for(;!x&&b>0;)b--,S>>=1,w>>=1,x=this.tiles[Jm(b,S,w)];return x?.source?(d>1&&(console.log("found parent tile z%d-%d-%d",b,S,w),console.time("drilling down")),this.splitTile(x.source,b,S,w,e,n,s),d>1&&console.timeEnd("drilling down"),this.tiles[_]?Nx(this.tiles[_],c):null):null}splitTile(e,n,s,c,d,m,_){let x=[e,n,s,c],b=this.options,S=b.debug;for(;x.length;){c=x.pop(),s=x.pop(),n=x.pop(),e=x.pop();let w=1<<n,A=Jm(n,s,c),E=this.tiles[A];if(!E&&(S>1&&console.time("creation"),E=this.tiles[A]=Fx(e,n,s,c,b),this.tileCoords.push({z:n,x:s,y:c,id:A}),S)){S>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,s,c,E.numFeatures,E.numPoints,E.numSimplified),console.timeEnd("creation"));let he=`z${n}`;this.stats[he]=(this.stats[he]||0)+1,this.total++}if(E.source=e,d==null){if(n===b.indexMaxZoom||E.numPoints<=b.indexMaxPoints)continue}else{if(n===b.maxZoom||n===d)continue;if(d!=null){let he=d-n;if(s!==m>>he||c!==_>>he)continue}}if(E.source=null,!e.length)continue;S>1&&console.time("clipping");let R=.5*b.buffer/b.extent,I=.5-R,O=.5+R,F=1+R,V=null,U=null,j=null,H=null,X=es(e,w,s-R,s+O,Kn.X,E.minX,E.maxX,b),ue=es(e,w,s+I,s+F,Kn.X,E.minX,E.maxX,b);X&&(V=es(X,w,c-R,c+O,Kn.Y,E.minY,E.maxY,b),U=es(X,w,c+I,c+F,Kn.Y,E.minY,E.maxY,b)),ue&&(j=es(ue,w,c-R,c+O,Kn.Y,E.minY,E.maxY,b),H=es(ue,w,c+I,c+F,Kn.Y,E.minY,E.maxY,b)),S>1&&console.timeEnd("clipping"),x.push(V||[],n+1,2*s,2*c),x.push(U||[],n+1,2*s,2*c+1),x.push(j||[],n+1,2*s+1,2*c),x.push(H||[],n+1,2*s+1,2*c+1)}}invalidateTiles(e){if(!e.length)return;let n=this.options,{debug:s}=n,c=1/0,d=-1/0,m=1/0,_=-1/0;for(let S of e)c=Math.min(c,S.minX),d=Math.max(d,S.maxX),m=Math.min(m,S.minY),_=Math.max(_,S.maxY);let x=n.buffer/n.extent,b=new Set;for(let S in this.tiles){let w=this.tiles[S],A=1<<w.z,E=(w.x-x)/A,R=(w.x+1+x)/A,I=(w.y-x)/A,O=(w.y+1+x)/A;if(d<E||c>=R||_<I||m>=O)continue;let F=!1;for(let V of e)if(V.maxX>=E&&V.minX<R&&V.maxY>=I&&V.minY<O){F=!0;break}if(F){if(s){s>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",w.z,w.x,w.y,w.numFeatures,w.numPoints,w.numSimplified);let V=`z${w.z}`;this.stats[V]=(this.stats[V]||0)-1,this.total--}delete this.tiles[S],b.add(S)}}b.size&&(this.tileCoords=this.tileCoords.filter((S=>!b.has(S.id))))}}function Jm(r,e,n){return 32*((1<<r)*n+e)+r}let Y6={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:r_,debug:0},W6=ii([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:K6}=W6,Q6=ii([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:J6}=Q6,eM=Math.cos(Math.PI/180*37.5),Vx=Math.pow(2,14)/.5;class c_{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((n=>n.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let n of this.layers)this.gradients[n.id]={};this.layoutVertexArray=new ae,this.layoutVertexArray2=new te,this.indexArray=new Pe,this.programConfigurations=new Ua(e.layers,e.zoom),this.segments=new $e,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((n=>n.isStateDependent())).map((n=>n.id))}populate(e,n,s){this.hasDependencies=Zm("line",this.layers,n)||this.hasLineDasharray(this.layers);let c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),m=[];for(let{feature:_,id:x,index:b,sourceLayerIndex:S}of e){let w=this.layers[0]._featureFilter.needGeometry,A=mo(_,w);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),A,s))continue;let E=d?c.evaluate(A,{},s):void 0,R={id:x,properties:_.properties,type:_.type,sourceLayerIndex:S,index:b,geometry:w?A.geometry:fo(_),patterns:{},dashes:{},sortKey:E};m.push(R)}d&&m.sort(((_,x)=>_.sortKey-x.sortKey));for(let _ of m){let{geometry:x,index:b,sourceLayerIndex:S}=_;this.hasDependencies?(Zm("line",this.layers,n)?j1("line",this.layers,_,{zoom:this.zoom},n):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,_,this.zoom,n),this.patternFeatures.push(_)):this.addFeature(_,x,b,s,{},{},n.subdivisionGranularity),n.featureIndex.insert(e[b].feature,x,b,S,this.index)}}update(e,n,s,c){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,{imagePositions:s,dashPositions:c})}addFeatures(e,n,s,c){for(let d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,n,s,c,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,J6)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,K6),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,o_)&&Object.hasOwn(e.properties,s_))return{start:+e.properties[o_],end:+e.properties[s_]}}addFeature(e,n,s,c,d,m,_){let x=this.layers[0].layout,b=x.get("line-join").evaluate(e,{}),S=x.get("line-cap").evaluate(e,{}),w=x.get("line-miter-limit").evaluate(e,{}),A=x.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let E of n)this.addLine(E,e,b,S,w,A,c,_);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:d,dashPositions:m,canonical:c})}addLine(e,n,s,c,d,m,_,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=vc(e,_?x.line.getGranularityForZoomLevel(_.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let U=0;U<e.length-1;U++)this.totalDistance+=e[U].dist(e[U+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let b=gp.types[n.type]==="Polygon",S=e.length;for(;S>=2&&e[S-1].equals(e[S-2]);)S--;let w=0;for(;w<S-1&&e[w].equals(e[w+1]);)w++;if(S<(b?3:2))return;s==="bevel"&&(d=1.05);let A=this.overscaling<=16?122880/(512*this.overscaling):0,E=this.segments.prepareSegment(10*S,this.layoutVertexArray,this.indexArray),R,I,O,F,V;this.e1=this.e2=-1,b&&(R=e[S-2],V=e[w].sub(R)._unit()._perp());for(let U=w;U<S;U++){if(O=U===S-1?b?e[w+1]:void 0:e[U+1],O&&e[U].equals(O))continue;V&&(F=V),R&&(I=R),R=e[U],V=O?O.sub(R)._unit()._perp():F,F||(F=V);let j=F.add(V);j.x===0&&j.y===0||j._unit();let H=F.x*V.x+F.y*V.y,X=j.x*V.x+j.y*V.y,ue=X!==0?1/X:1/0,he=2*Math.sqrt(2-2*X),be=X<eM&&I&&O,ge=F.x*V.y-F.y*V.x>0;if(be&&U>w){let we=R.dist(I);if(we>2*A){let _e=R.sub(R.sub(I)._mult(A/we)._round());this.updateDistance(I,_e),this.addCurrentVertex(_e,F,0,0,E),I=_e}}let Me=I&&O,Ee=Me?s:b?"butt":c;if(Me&&Ee==="round"&&(ue<m?Ee="miter":ue<=2&&(Ee="fakeround")),Ee==="miter"&&ue>d&&(Ee="bevel"),Ee==="bevel"&&(ue>2&&(Ee="flipbevel"),ue<d&&(Ee="miter")),I&&this.updateDistance(I,R),Ee==="miter")j._mult(ue),this.addCurrentVertex(R,j,0,0,E);else if(Ee==="flipbevel"){if(ue>100)j=V.mult(-1);else{let we=ue*F.add(V).mag()/F.sub(V).mag();j._perp()._mult(we*(ge?-1:1))}this.addCurrentVertex(R,j,0,0,E),this.addCurrentVertex(R,j.mult(-1),0,0,E)}else if(Ee==="bevel"||Ee==="fakeround"){let we=-Math.sqrt(ue*ue-1),_e=ge?we:0,Fe=ge?0:we;if(I&&this.addCurrentVertex(R,F,_e,Fe,E),Ee==="fakeround"){let Ge=Math.round(180*he/Math.PI/20);for(let je=1;je<Ge;je++){let Ne=je/Ge;if(Ne!==.5){let Mt=Ne-.5;Ne+=Ne*Mt*(Ne-1)*((1.0904+H*(H*(3.55645-1.43519*H)-3.2452))*Mt*Mt+(.848013+H*(.215638*H-1.06021)))}let at=V.sub(F)._mult(Ne)._add(F)._unit()._mult(ge?-1:1);this.addHalfVertex(R,at.x,at.y,!1,ge,0,E)}}O&&this.addCurrentVertex(R,V,-_e,-Fe,E)}else if(Ee==="butt")this.addCurrentVertex(R,j,0,0,E);else if(Ee==="square"){let we=I?1:-1;this.addCurrentVertex(R,j,we,we,E)}else Ee==="round"&&(I&&(this.addCurrentVertex(R,F,0,0,E),this.addCurrentVertex(R,F,1,1,E,!0)),O&&(this.addCurrentVertex(R,V,-1,-1,E,!0),this.addCurrentVertex(R,V,0,0,E)));if(be&&U<S-1){let we=R.dist(O);if(we>2*A){let _e=R.add(O.sub(R)._mult(A/we)._round());this.updateDistance(R,_e),this.addCurrentVertex(_e,V,0,0,E),R=_e}}}}addCurrentVertex(e,n,s,c,d,m=!1){let _=n.y*c-n.x,x=-n.y-n.x*c;this.addHalfVertex(e,n.x+n.y*s,n.y-n.x*s,m,!1,s,d),this.addHalfVertex(e,_,x,m,!0,-c,d),this.distance>Vx/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,n,s,c,d,m))}addHalfVertex({x:e,y:n},s,c,d,m,_,x){let b=.5*(this.lineClips?this.scaledDistance*(Vx-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(d?1:0),(n<<1)+(m?1:0),Math.round(63*s)+128,Math.round(63*c)+128,1+(_===0?0:_<0?-1:1)|(63&b)<<2,b>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let S=x.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,S,this.e2),x.primitiveLength++),m?this.e2=S:this.e1=S}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,n){this.distance+=e.dist(n),this.updateScaledDistance()}hasLineDasharray(e){for(let n of e){let s=n.paint.get("line-dasharray");if(s&&!s.isConstant())return!0}return!1}addLineDashDependencies(e,n,s,c){for(let d of e){let m=d.paint.get("line-dasharray");if(!m||m.value.kind==="constant")continue;let _=d.layout.get("line-cap").evaluate(n,{})==="round",x={dasharray:m.value.evaluate({zoom:s-1},n,{}),round:_},b={dasharray:m.value.evaluate({zoom:s},n,{}),round:_},S={dasharray:m.value.evaluate({zoom:s+1},n,{}),round:_},w=`${x.dasharray.join(",")},${x.round}`,A=`${b.dasharray.join(",")},${b.round}`,E=`${S.dasharray.join(",")},${S.round}`;c.dashDependencies[w]=x,c.dashDependencies[A]=b,c.dashDependencies[E]=S,n.dashes[d.id]={min:w,mid:A,max:E}}}}let jx,qx;Ye("LineBucket",c_,{omit:["layers","patternFeatures"]});var Gx={get paint(){return qx=qx||new Yn({"line-opacity":new it(Ce.paint_line["line-opacity"]),"line-color":new it(Ce.paint_line["line-color"]),"line-translate":new Je(Ce.paint_line["line-translate"]),"line-translate-anchor":new Je(Ce.paint_line["line-translate-anchor"]),"line-width":new it(Ce.paint_line["line-width"]),"line-gap-width":new it(Ce.paint_line["line-gap-width"]),"line-offset":new it(Ce.paint_line["line-offset"]),"line-blur":new it(Ce.paint_line["line-blur"]),"line-dasharray":new so(Ce.paint_line["line-dasharray"]),"line-pattern":new so(Ce.paint_line["line-pattern"]),"line-gradient":new Ks(Ce.paint_line["line-gradient"])})},get layout(){return jx=jx||new Yn({"line-cap":new it(Ce.layout_line["line-cap"]),"line-join":new it(Ce.layout_line["line-join"]),"line-miter-limit":new it(Ce.layout_line["line-miter-limit"]),"line-round-limit":new it(Ce.layout_line["line-round-limit"]),"line-sort-key":new it(Ce.layout_line["line-sort-key"])})}};class tM extends it{possiblyEvaluate(e,n){return n=new ti(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(e,n)}evaluate(e,n,s,c){return n=pi({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(e,n,s,c)}}let e0;class iM extends Rr{constructor(e,n){super(e,Gx,n),this.gradientVersion=0,e0||(e0=new tM(Gx.paint.properties["line-width"].specification),e0.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let n=this.gradientExpression();this.stepInterpolant=!!(function(s){return s._styleExpression!==void 0})(n)&&n._styleExpression.expression instanceof Fs,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,n){super.recalculate(e,n),this.paint._values["line-floorwidth"]=e0.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new c_(e)}queryRadius(e){let n=e,s=Zx(Vu("line-width",this,n),Vu("line-gap-width",this,n)),c=Vu("line-offset",this,n);return s/2+Math.abs(c)+qm(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:n,featureState:s,geometry:c,transform:d,pixelsToTileUnits:m}){let _=Gm(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,m),x=m/2*Zx(this.paint.get("line-width").evaluate(n,s),this.paint.get("line-gap-width").evaluate(n,s)),b=this.paint.get("line-offset").evaluate(n,s);return b&&(c=(function(S,w){let A=[];for(let E of S){let R=ZS(E),I=[];for(let O=0;O<R.length;O++){let F=R[O],V=R[O-1],U=R[O+1],j=O===0?new D(0,0):F.sub(V)._unit()._perp(),H=O===R.length-1?new D(0,0):U.sub(F)._unit()._perp(),X=j._add(H)._unit(),ue=X.x*H.x+X.y*H.y;ue!==0&&X._mult(1/ue),I.push(X._mult(w)._add(F))}A.push(I)}return A})(c,b*m)),(function(S,w,A){for(let E of w){if(S.length>=3){for(let R of E)if(Uu(S,R))return!0}if(jS(S,E,A))return!0}return!1})(_,c,x)}isTileClipped(){return!0}}function Zx(r,e){return e>0?e+2*r:r}let nM=ii([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rM=ii([{name:"a_projected_pos",components:3,type:"Float32"}],4);ii([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let aM=ii([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ii([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let Hx=ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),oM=ii([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function sM(r,e,n){let s=e.layout.get("text-transform").evaluate(n,{});return s==="uppercase"?r=r.toLocaleUpperCase():s==="lowercase"&&(r=r.toLocaleLowerCase()),Ba.applyArabicShaping&&(r=Ba.applyArabicShaping(r)),r}function lM(r,e,n){for(let s of r.sections)s.text=sM(s.text,e,n);return r}ii([{name:"triangle",components:3,type:"Uint16"}]),ii([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),ii([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),ii([{type:"Float32",name:"offsetX"}]),ii([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ii([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var un=24;let xp={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u22EF":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"},cM={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},uM={40:!0};function $x(r,e,n,s,c,d){if("fontStack"in e){let m=n[e.fontStack],_=m?.[r];return _?_.metrics.advance*e.scale+c:0}{let m=s[e.imageName];return m?m.displaySize[0]*e.scale*un/d+c:0}}function Xx(r,e,n,s){let c=Math.pow(r-e,2);return s?r<e?c/2:2*c:c+Math.abs(n)*n}function hM(r,e,n){let s=0;return r===10&&(s-=1e4),n&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function Yx(r,e,n,s,c,d){let m=null,_=Xx(e,n,c,d);for(let x of s){let b=Xx(e-x.x,n,c,d)+x.badness;b<=_&&(m=x,_=b)}return{index:r,x:e,priorBreak:m,badness:_}}function Wx(r){return r?Wx(r.priorBreak).concat(r.index):[]}class Xu{constructor(e="",n=[],s=[]){this.text=e,this.sections=n,this.sectionIndex=s,this.imageSectionID=null}static fromFeature(e,n){let s=new Xu;for(let c of e.sections)c.image?s.addImageSection(c):s.addTextSection(c,n);return s}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=(function(e){let n="",s={premature:!0,value:void 0},c=e[Symbol.iterator](),d=c.next(),m=e[Symbol.iterator]();m.next();let _=m.next();for(;!d.done;)n+=!_.done&&$d(_.value.codePointAt(0))&&!xp[_.value]||!s.premature&&$d(s.value.codePointAt(0))&&!xp[s.value]||!xp[d.value]?d.value:xp[d.value],s={value:d.value,premature:!1},d=c.next(),_=m.next();return n})(this.text)}hasZeroWidthSpaces(){return this.text.includes("\u200B")}trim(){let e=this.text.match(/^\s*/),n=e?e[0].length:0,s=this.text.match(/\S\s*$/),c=s?s[0].length-1:0;this.text=this.text.substring(n,this.text.length-c),this.sectionIndex=this.sectionIndex.slice(n,this.sectionIndex.length-c)}substring(e,n){let s=[...this.text].slice(e,n).join(""),c=this.sectionIndex.slice(e,n);return new Xu(s,this.sections,c)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,n)=>Math.max(e,this.sections[n].scale)),0)}getMaxImageSize(e){let n=0,s=0;for(let c=0;c<this.length();c++){let d=this.getSection(c);if("imageName"in d){let m=e[d.imageName];if(!m)continue;let _=m.displaySize;n=Math.max(n,_[0]),s=Math.max(s,_[1])}}return{maxImageWidth:n,maxImageHeight:s}}addTextSection(e,n){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||n});let s=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>s)))}addImageSection(e){let n=e.image?e.image.name:"";if(n.length===0)return void Gt("Can't add FormattedSection with an empty image.");let s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:n}),this.sectionIndex.push(this.sections.length-1)):Gt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,n,s,c,d){let m=[],_=this.determineAverageLineWidth(e,n,s,c,d),x=this.hasZeroWidthSpaces(),b=0,S=0,w=this.text[Symbol.iterator](),A=w.next(),E=this.text[Symbol.iterator]();E.next();let R=E.next(),I=this.text[Symbol.iterator]();I.next(),I.next();let O=I.next();for(;!A.done;){let F=this.getSection(S),V=A.value.codePointAt(0);if(Rm(V)||(b+=$x(V,F,s,c,e,d)),!R.done){let U=D1(V),j=R.value.codePointAt(0);(cM[V]||U||"imageName"in F||!O.done&&uM[j])&&m.push(Yx(S+1,b,_,m,hM(V,j,U&&x),!1))}S++,A=w.next(),R=E.next(),O=I.next()}return Wx(Yx(this.length(),b,_,m,0,!0))}determineAverageLineWidth(e,n,s,c,d){let m=0,_=0;for(let x of this.text){let b=this.getSection(_);m+=$x(x.codePointAt(0),b,s,c,e,d),_++}return m/Math.max(1,Math.ceil(m/n))}}let u_=4294967296,Kx=1/u_,Qx=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class t0{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,n,s=this.length){for(;this.pos<s;){let c=this.readVarint(),d=c>>3,m=this.pos;this.type=7&c,e(d,n,this),this.pos===m&&this.skip(c)}return n}readMessage(e,n){return this.readFields(e,n,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*u_;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*u_;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let n=this.buf,s,c;return c=n[this.pos++],s=127&c,c<128?s:(c=n[this.pos++],s|=(127&c)<<7,c<128?s:(c=n[this.pos++],s|=(127&c)<<14,c<128?s:(c=n[this.pos++],s|=(127&c)<<21,c<128?s:(c=n[this.pos],s|=(15&c)<<28,(function(d,m,_){let x=_.buf,b,S;if(S=x[_.pos++],b=(112&S)>>4,S<128||(S=x[_.pos++],b|=(127&S)<<3,S<128)||(S=x[_.pos++],b|=(127&S)<<10,S<128)||(S=x[_.pos++],b|=(127&S)<<17,S<128)||(S=x[_.pos++],b|=(127&S)<<24,S<128)||(S=x[_.pos++],b|=(1&S)<<31,S<128))return Yu(d,b,m);throw new Error("Expected varint not more than 10 bytes")})(s,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,n=this.pos;return this.pos=e,e-n>=12&&Qx?Qx.decode(this.buf.subarray(n,e)):(function(s,c,d){let m="",_=c;for(;_<d;){let x=s[_],b,S,w,A=null,E=x>239?4:x>223?3:x>191?2:1;if(_+E>d)break;E===1?x<128&&(A=x):E===2?(b=s[_+1],(192&b)==128&&(A=(31&x)<<6|63&b,A<=127&&(A=null))):E===3?(b=s[_+1],S=s[_+2],(192&b)==128&&(192&S)==128&&(A=(15&x)<<12|(63&b)<<6|63&S,(A<=2047||A>=55296&&A<=57343)&&(A=null))):E===4&&(b=s[_+1],S=s[_+2],w=s[_+3],(192&b)==128&&(192&S)==128&&(192&w)==128&&(A=(15&x)<<18|(63&b)<<12|(63&S)<<6|63&w,(A<=65535||A>=1114112)&&(A=null))),A===null?(A=65533,E=1):A>65535&&(A-=65536,m+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),m+=String.fromCharCode(A),_+=E}return m})(this.buf,n,e)}readBytes(){let e=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,e);return this.pos=e,n}readPackedVarint(e=[],n){let s=this.readPackedEnd();for(;this.pos<s;)e.push(this.readVarint(n));return e}readPackedSVarint(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){let n=7&e;if(n===0)for(;this.buf[this.pos++]>127;);else if(n===2)this.pos=this.readVarint()+this.pos;else if(n===5)this.pos+=4;else{if(n!==1)throw new Error(`Unimplemented type: ${n}`);this.pos+=8}}writeTag(e,n){this.writeVarint(e<<3|n)}realloc(e){let n=this.length||16;for(;n<this.pos+e;)n*=2;if(n!==this.length){let s=new Uint8Array(n);s.set(this.buf),this.buf=s,this.dataView=new DataView(s.buffer),this.length=n}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Kx),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Kx),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(n,s){let c,d;if(n>=0?(c=n%4294967296|0,d=n/4294967296|0):(c=~(-n%4294967296),d=~(-n/4294967296),4294967295^c?c=c+1|0:(c=0,d=d+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),(function(m,_,x){x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,x.buf[x.pos]=127&(m>>>=7)})(c,0,s),(function(m,_){let x=(7&m)<<4;_.buf[_.pos++]|=x|((m>>>=3)?128:0),m&&(_.buf[_.pos++]=127&m|((m>>>=7)?128:0),m&&(_.buf[_.pos++]=127&m|((m>>>=7)?128:0),m&&(_.buf[_.pos++]=127&m|((m>>>=7)?128:0),m&&(_.buf[_.pos++]=127&m|((m>>>=7)?128:0),m&&(_.buf[_.pos++]=127&m)))))})(d,s)})(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;let n=this.pos;this.pos=(function(c,d,m){for(let _,x,b=0;b<d.length;b++){if(_=d.charCodeAt(b),_>55295&&_<57344){if(!x){_>56319||b+1===d.length?(c[m++]=239,c[m++]=191,c[m++]=189):x=_;continue}if(_<56320){c[m++]=239,c[m++]=191,c[m++]=189,x=_;continue}_=x-55296<<10|_-56320|65536,x=null}else x&&(c[m++]=239,c[m++]=191,c[m++]=189,x=null);_<128?c[m++]=_:(_<2048?c[m++]=_>>6|192:(_<65536?c[m++]=_>>12|224:(c[m++]=_>>18|240,c[m++]=_>>12&63|128),c[m++]=_>>6&63|128),c[m++]=63&_|128)}return m})(this.buf,e,this.pos);let s=this.pos-n;s>=128&&Jx(n,s,this),this.pos=n-1,this.writeVarint(s),this.pos+=s}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let n=e.length;this.writeVarint(n),this.realloc(n);for(let s=0;s<n;s++)this.buf[this.pos++]=e[s]}writeRawMessage(e,n){this.pos++;let s=this.pos;e(n,this);let c=this.pos-s;c>=128&&Jx(s,c,this),this.pos=s-1,this.writeVarint(c),this.pos+=c}writeMessage(e,n,s){this.writeTag(e,2),this.writeRawMessage(n,s)}writePackedVarint(e,n){n.length&&this.writeMessage(e,dM,n)}writePackedSVarint(e,n){n.length&&this.writeMessage(e,pM,n)}writePackedBoolean(e,n){n.length&&this.writeMessage(e,gM,n)}writePackedFloat(e,n){n.length&&this.writeMessage(e,fM,n)}writePackedDouble(e,n){n.length&&this.writeMessage(e,mM,n)}writePackedFixed32(e,n){n.length&&this.writeMessage(e,_M,n)}writePackedSFixed32(e,n){n.length&&this.writeMessage(e,yM,n)}writePackedFixed64(e,n){n.length&&this.writeMessage(e,vM,n)}writePackedSFixed64(e,n){n.length&&this.writeMessage(e,bM,n)}writeBytesField(e,n){this.writeTag(e,2),this.writeBytes(n)}writeFixed32Field(e,n){this.writeTag(e,5),this.writeFixed32(n)}writeSFixed32Field(e,n){this.writeTag(e,5),this.writeSFixed32(n)}writeFixed64Field(e,n){this.writeTag(e,1),this.writeFixed64(n)}writeSFixed64Field(e,n){this.writeTag(e,1),this.writeSFixed64(n)}writeVarintField(e,n){this.writeTag(e,0),this.writeVarint(n)}writeSVarintField(e,n){this.writeTag(e,0),this.writeSVarint(n)}writeStringField(e,n){this.writeTag(e,2),this.writeString(n)}writeFloatField(e,n){this.writeTag(e,5),this.writeFloat(n)}writeDoubleField(e,n){this.writeTag(e,1),this.writeDouble(n)}writeBooleanField(e,n){this.writeVarintField(e,+n)}}function Yu(r,e,n){return n?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function Jx(r,e,n){let s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(s);for(let c=n.pos-1;c>=r;c--)n.buf[c+s]=n.buf[c]}function dM(r,e){for(let n=0;n<r.length;n++)e.writeVarint(r[n])}function pM(r,e){for(let n=0;n<r.length;n++)e.writeSVarint(r[n])}function fM(r,e){for(let n=0;n<r.length;n++)e.writeFloat(r[n])}function mM(r,e){for(let n=0;n<r.length;n++)e.writeDouble(r[n])}function gM(r,e){for(let n=0;n<r.length;n++)e.writeBoolean(r[n])}function _M(r,e){for(let n=0;n<r.length;n++)e.writeFixed32(r[n])}function yM(r,e){for(let n=0;n<r.length;n++)e.writeSFixed32(r[n])}function vM(r,e){for(let n=0;n<r.length;n++)e.writeFixed64(r[n])}function bM(r,e){for(let n=0;n<r.length;n++)e.writeSFixed64(r[n])}function xM(r,e,n){r===1&&n.readMessage(wM,e)}function wM(r,e,n){if(r===3){let{id:s,bitmap:c,width:d,height:m,left:_,top:x,advance:b}=n.readMessage(TM,{});e.push({id:s,bitmap:new cp({width:d+6,height:m+6},c),metrics:{width:d,height:m,left:_,top:x,advance:b}})}}function TM(r,e,n){r===1?e.id=n.readVarint():r===2?e.bitmap=n.readBytes():r===3?e.width=n.readVarint():r===4?e.height=n.readVarint():r===5?e.left=n.readSVarint():r===6?e.top=n.readSVarint():r===7&&(e.advance=n.readVarint())}function e2(r){let e=0,n=0;for(let m of r)e+=m.w*m.h,n=Math.max(n,m.w);r.sort(((m,_)=>_.h-m.h));let s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}],c=0,d=0;for(let m of r)for(let _=s.length-1;_>=0;_--){let x=s[_];if(!(m.w>x.w||m.h>x.h)){if(m.x=x.x,m.y=x.y,d=Math.max(d,m.y+m.h),c=Math.max(c,m.x+m.w),m.w===x.w&&m.h===x.h){let b=s.pop();b&&_<s.length&&(s[_]=b)}else m.h===x.h?(x.x+=m.w,x.w-=m.w):m.w===x.w?(x.y+=m.h,x.h-=m.h):(s.push({x:x.x+m.w,y:x.y,w:x.w-m.w,h:m.h}),x.y+=m.h,x.h-=m.h);break}}return{w:c,h:d,fill:e/(c*d)||0}}class h_{constructor(e,{pixelRatio:n,version:s,stretchX:c,stretchY:d,content:m,textFitWidth:_,textFitHeight:x}){this.paddedRect=e,this.pixelRatio=n,this.stretchX=c,this.stretchY=d,this.content=m,this.version=s,this.textFitWidth=_,this.textFitHeight=x}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class t2{constructor(e,n){let s={},c={};this.haveRenderCallbacks=[];let d=[];this.addImages(e,s,d),this.addImages(n,c,d);let{w:m,h:_}=e2(d),x=new xr({width:m||1,height:_||1});for(let b in e){let S=e[b],w=s[b].paddedRect;xr.copy(S.data,x,{x:0,y:0},{x:w.x+1,y:w.y+1},S.data)}for(let b in n){let S=n[b],w=c[b].paddedRect,A=w.x+1,E=w.y+1,R=S.data.width,I=S.data.height;xr.copy(S.data,x,{x:0,y:0},{x:A,y:E},S.data),xr.copy(S.data,x,{x:0,y:I-1},{x:A,y:E-1},{width:R,height:1}),xr.copy(S.data,x,{x:0,y:0},{x:A,y:E+I},{width:R,height:1}),xr.copy(S.data,x,{x:R-1,y:0},{x:A-1,y:E},{width:1,height:I}),xr.copy(S.data,x,{x:0,y:0},{x:A+R,y:E},{width:1,height:I})}this.image=x,this.iconPositions=s,this.patternPositions=c}addImages(e,n,s){for(let c in e){let d=e[c],m={x:0,y:0,w:d.data.width+2,h:d.data.height+2};s.push(m),n[c]=new h_(m,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(e,n){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),n),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),n)}patchUpdatedImage(e,n,s){if(!e||!n||e.version===n.version)return;e.version=n.version;let[c,d]=e.tl;s.update(n.data,void 0,{x:c,y:d})}}var Js;function i0(r,e,n,s,c,d,m,_,x,b,S,w,A,E,R){let I=Xu.fromFeature(r,c),O;w===y.ax.vertical&&I.verticalizePunctuation();let F=I.determineLineBreaks(b,d,e,s,E),{processBidirectionalText:V,processStyledBidirectionalText:U}=Ba;if(V&&I.sections.length===1){O=[],F=F.map((ue=>I.toCodeUnitIndex(ue)));let X=V(I.toString(),F);for(let ue of X){let he=[...ue].map((()=>0));O.push(new Xu(ue,I.sections,he))}}else if(U){O=[],F=F.map((be=>I.toCodeUnitIndex(be)));let X=0,ue=[];for(let be of I.text)ue.push(...Array(be.length).fill(I.sectionIndex[X])),X++;let he=U(I.text,ue,F);for(let be of he){let ge=[],Me="";for(let Ee of be[0])ge.push(be[1][Me.length]),Me+=Ee;O.push(new Xu(be[0],I.sections,ge))}}else O=(function(X,ue){let he=[],be=0;for(let ge of ue)he.push(X.substring(be,ge)),be=ge;return be<X.length()&&he.push(X.substring(be,X.length())),he})(I,F);let j=[],H={positionedLines:j,text:I.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:w,iconsInText:!1,verticalizable:!1};return(function(X,ue,he,be,ge,Me,Ee,we,_e,Fe,Ge,je){let Ne=0,at=0,Mt=0,Pt=0,Ht=we==="right"?1:we==="left"?0:.5,Bn=un/je,Ci=0;for(let mi of ge){mi.trim();let En=mi.getMaxScale(),Jn={positionedGlyphs:[],lineOffset:0};X.positionedLines[Ci]=Jn;let er=Jn.positionedGlyphs,wr=0;if(!mi.length()){at+=Me,++Ci;continue}let Fn=SM(be,mi,Bn),Tr=0;for(let pn of mi.text){let wi=mi.getSection(Tr),$i=pn.codePointAt(0),Ai=MM(_e,Ge,$i),fn={glyph:$i,imageName:null,x:Ne,y:at+-17,vertical:Ai,scale:1,fontStack:"",sectionIndex:mi.getSectionIndex(Tr),metrics:null,rect:null},ns;if("fontStack"in wi){if(ns=EM(wi,$i,Ai,Fn,ue,he),!ns)continue;fn.fontStack=wi.fontStack}else{if(X.iconsInText=!0,wi.scale*=Bn,ns=CM(wi,Ai,En,Fn,be),!ns)continue;wr=Math.max(wr,ns.imageOffset),fn.imageName=wi.imageName}let{rect:qa,metrics:Ep,baselineOffset:ol}=ns;fn.y+=ol,fn.scale=wi.scale,fn.metrics=Ep,fn.rect=qa,er.push(fn),Ai?(X.verticalizable=!0,Ne+=("imageName"in wi?Ep.advance:un)*wi.scale+Fe):Ne+=Ep.advance*wi.scale+Fe,Tr++}er.length!==0&&(Mt=Math.max(Ne-Fe,Mt),AM(er,0,er.length-1,Ht)),Ne=0,Jn.lineOffset=Math.max(wr,(En-1)*un);let va=Me*En+wr;at+=va,Pt=Math.max(va,Pt),++Ci}let{horizontalAlign:Ji,verticalAlign:dn}=d_(Ee);(function(mi,En,Jn,er,wr,Fn,Tr,va,pn){let wi=(En-Jn)*wr,$i=0;$i=Fn!==Tr?-va*er- -17:-er*pn*Tr+.5*Tr;for(let Ai of mi)for(let fn of Ai.positionedGlyphs)fn.x+=wi,fn.y+=$i})(X.positionedLines,Ht,Ji,dn,Mt,Pt,Me,at,ge.length),X.top+=-dn*at,X.bottom=X.top+at,X.left+=-Ji*Mt,X.right=X.left+Mt})(H,e,n,s,O,m,_,x,w,b,A,R),!(function(X){for(let ue of X)if(ue.positionedGlyphs.length!==0)return!1;return!0})(j)&&H}function d_(r){let e=.5,n=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:e,verticalAlign:n}}function SM(r,e,n){let s=e.getMaxScale()*un,{maxImageWidth:c,maxImageHeight:d}=e.getMaxImageSize(r),m=Math.max(s,d*n);return{verticalLineContentWidth:Math.max(s,c*n),horizontalLineContentHeight:m}}function i2(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function MM(r,e,n){return!(r===y.ax.horizontal||!e&&!Wo(n)||e&&(Rm(n)||(s=n,/\p{sc=Arab}/u.test(String.fromCodePoint(s)))));var s}function EM(r,e,n,s,c,d){let m=d[r.fontStack],_=(function(b,S,w,A){if(b?.rect)return b;let E=S[w.fontStack],R=E?.[A];return R?{rect:null,metrics:R.metrics}:null})(m?.[e],c,r,e);if(_===null)return null;let x;if(n)x=s.verticalLineContentWidth-r.scale*un;else{let b=i2(r.verticalAlign);x=(s.horizontalLineContentHeight-r.scale*un)*b}return{rect:_.rect,metrics:_.metrics,baselineOffset:x}}function CM(r,e,n,s,c){let d=c[r.imageName];if(!d)return null;let m=d.paddedRect,_=d.displaySize,x={width:_[0],height:_[1],left:1,top:-3,advance:e?_[1]:_[0]},b;if(e)b=s.verticalLineContentWidth-_[1]*r.scale;else{let S=i2(r.verticalAlign);b=(s.horizontalLineContentHeight-_[1]*r.scale)*S}return{rect:m,metrics:x,baselineOffset:b,imageOffset:(e?_[0]:_[1])*r.scale-un*n}}function AM(r,e,n,s){if(s===0)return;let c=r[n],d=(r[n].x+c.metrics.advance*c.scale)*s;for(let m=e;m<=n;m++)r[m].x-=d}function zM(r,e,n){let{horizontalAlign:s,verticalAlign:c}=d_(n),d=e[0]-r.displaySize[0]*s,m=e[1]-r.displaySize[1]*c;return{image:r,top:m,bottom:m+r.displaySize[1],left:d,right:d+r.displaySize[0]}}function n2(r){var e,n;let s=r.left,c=r.top,d=r.right-s,m=r.bottom-c,_=(e=r.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",x=(n=r.image.textFitHeight)!==null&&n!==void 0?n:"stretchOrShrink",b=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(x==="proportional"){if(_==="stretchOnly"&&d/m<b||_==="proportional"){let S=Math.ceil(m*b);s*=S/d,d=S}}else if(_==="proportional"&&x==="stretchOnly"&&b!==0&&d/m>b){let S=Math.ceil(d/b);c*=S/m,m=S}return{x1:s,y1:c,x2:s+d,y2:c+m}}function r2(r,e,n,s,c,d){let m=r.image,_;if(m.content){let O=m.content,F=m.pixelRatio||1;_=[O[0]/F,O[1]/F,m.displaySize[0]-O[2]/F,m.displaySize[1]-O[3]/F]}let x=e.left*d,b=e.right*d,S,w,A,E;n==="width"||n==="both"?(E=c[0]+x-s[3],w=c[0]+b+s[1]):(E=c[0]+(x+b-m.displaySize[0])/2,w=E+m.displaySize[0]);let R=e.top*d,I=e.bottom*d;return n==="height"||n==="both"?(S=c[1]+R-s[0],A=c[1]+I+s[2]):(S=c[1]+(R+I-m.displaySize[1])/2,A=S+m.displaySize[1]),{image:m,top:S,right:w,bottom:A,left:E,collisionPadding:_}}Ye("ImagePosition",h_),Ye("ImageAtlas",t2),y.ax=void 0,(Js=y.ax||(y.ax={}))[Js.none=0]="none",Js[Js.horizontal=1]="horizontal",Js[Js.vertical=2]="vertical",Js[Js.horizontalOnly=3]="horizontalOnly";let ts=128,el=32640;function a2(r,e){let{expression:n}=e;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new ti(r+1))};if(n.kind==="source")return{kind:"source"};{let{zoomStops:s,interpolationType:c}=n,d=0;for(;d<s.length&&s[d]<=r;)d++;d=Math.max(0,d-1);let m=d;for(;m<s.length&&s[m]<r+1;)m++;m=Math.min(s.length-1,m);let _=s[d],x=s[m];return n.kind==="composite"?{kind:"composite",minZoom:_,maxZoom:x,interpolationType:c}:{kind:"camera",minZoom:_,maxZoom:x,minSize:n.evaluate(new ti(_)),maxSize:n.evaluate(new ti(x)),interpolationType:c}}}function p_(r,e,n){let s="never",c=r.get(e);return c?s=c:r.get(n)&&(s="always"),s}let DM=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function n0(r,e,n,s,c,d,m,_,x,b,S,w,A){let E=_?Math.min(el,Math.round(_[0])):0,R=_?Math.min(el,Math.round(_[1])):0;r.emplaceBack(e,n,Math.round(32*s),Math.round(32*c),d,m,(E<<1)+(x?1:0),R,16*b,16*S,256*w,256*A)}function f_(r,e,n){r.emplaceBack(e.x,e.y,n),r.emplaceBack(e.x,e.y,n),r.emplaceBack(e.x,e.y,n),r.emplaceBack(e.x,e.y,n)}function PM(r){for(let e of r.sections)if(Yd(e.text))return!0;return!1}class m_{constructor(e){this.layoutVertexArray=new ie,this.indexArray=new Pe,this.programConfigurations=e,this.segments=new $e,this.dynamicLayoutVertexArray=new me,this.opacityVertexArray=new Te,this.hasVisibleVertices=!1,this.placedSymbolArray=new T}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,n,s,c){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nM.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,n),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,rM.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,DM,!0),this.opacityVertexBuffer.itemSize=1),(s||c)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Ye("SymbolBuffers",m_);class g_{constructor(e,n,s){this.layoutVertexArray=new e,this.layoutAttributes=n,this.indexArray=new s,this.segments=new $e,this.collisionVertexArray=new Ie}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,aM.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ye("CollisionBuffers",g_);class Wu{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((m=>m.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=a2(this.zoom,n["text-size"]),this.iconSizeData=a2(this.zoom,n["icon-size"]);let s=this.layers[0].layout,c=s.get("symbol-sort-key"),d=s.get("symbol-z-order");this.canOverlap=p_(s,"text-overlap","text-allow-overlap")!=="never"||p_(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map((m=>y.ax[m]))),this.stateDependentLayerIds=this.layers.filter((m=>m.isStateDependent())).map((m=>m.id)),this.sourceID=e.sourceID}createArrays(){this.text=new m_(new Ua(this.layers,this.zoom,(e=>e.startsWith("text")))),this.icon=new m_(new Ua(this.layers,this.zoom,(e=>e.startsWith("icon")))),this.glyphOffsetArray=new z,this.lineVertexArray=new P,this.symbolInstances=new C,this.textAnchorOffsets=new L}calculateGlyphDependencies(e,n,s,c,d){for(let m of e)if(n[m.codePointAt(0)]=!0,(s||c)&&d){let _=xp[m];_&&(n[_.codePointAt(0)]=!0)}}populate(e,n,s){var c;let d=this.layers[0],m=d.layout,_=m.get("text-font"),x=m.get("text-field"),b=m.get("icon-image"),S=(x.value.kind!=="constant"||x.value.value instanceof lr&&!x.value.value.isEmpty()||x.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),w=b.value.kind!=="constant"||!!b.value.value||Object.keys(b.parameters).length>0,A=m.get("symbol-sort-key");if(this.features=[],!S&&!w)return;let E=n.iconDependencies,R=n.glyphDependencies,I=n.availableImages,O=new ti(this.zoom);for(let{feature:F,id:V,index:U,sourceLayerIndex:j}of e){let H=d._featureFilter.needGeometry,X=mo(F,H);if(!d._featureFilter.filter(O,X,s))continue;let ue,he;if(H||(X.geometry=fo(F)),S){let ge=d.getValueAndResolveTokens("text-field",X,s,I),Me=lr.factory(ge);this.hasRTLText||(this.hasRTLText=PM(Me)),(!this.hasRTLText||Ba.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&Ba.isParsed())&&(ue=lM(Me,d,X))}if(w){let ge=d.getValueAndResolveTokens("icon-image",X,s,I);he=ge instanceof gr?ge:gr.fromString(ge)}if(!ue&&!he)continue;let be=this.sortFeaturesByKey?A.evaluate(X,{},s):void 0;if(this.features.push({id:V,text:ue,icon:he,index:U,sourceLayerIndex:j,geometry:X.geometry,properties:F.properties,type:gp.types[F.type],sortKey:be}),he&&(E[he.name]=!0),ue){let ge=_.evaluate(X,{},s).join(","),Me=m.get("text-rotation-alignment")!=="viewport"&&m.get("symbol-placement")!=="point";this.allowVerticalPlacement=(c=this.writingModes)===null||c===void 0?void 0:c.includes(y.ax.vertical);for(let Ee of ue.sections)if(Ee.image)E[Ee.image.name]=!0;else{let we=Zd(ue.toString()),_e=Ee.fontStack||ge;R[_e]||(R[_e]={}),this.calculateGlyphDependencies(Ee.text,R[_e],Me,this.allowVerticalPlacement,we)}}}m.get("symbol-placement")==="line"&&(this.features=(function(F){let V={},U={},j=[],H=0;function X(ge){j.push(F[ge]),H++}function ue(ge,Me,Ee){let we=U[ge];return delete U[ge],U[Me]=we,j[we].geometry[0].pop(),j[we].geometry[0]=j[we].geometry[0].concat(Ee[0]),we}function he(ge,Me,Ee){let we=V[Me];return delete V[Me],V[ge]=we,j[we].geometry[0].shift(),j[we].geometry[0]=Ee[0].concat(j[we].geometry[0]),we}function be(ge,Me,Ee){let we=Ee?Me[0][Me[0].length-1]:Me[0][0];return`${ge}:${we.x}:${we.y}`}for(let ge=0;ge<F.length;ge++){let Me=F[ge],Ee=Me.geometry,we=Me.text?Me.text.toString():null;if(!we){X(ge);continue}let _e=be(we,Ee),Fe=be(we,Ee,!0);if(_e in U&&Fe in V&&U[_e]!==V[Fe]){let Ge=he(_e,Fe,Ee),je=ue(_e,Fe,j[Ge].geometry);delete V[_e],delete U[Fe],U[be(we,j[je].geometry,!0)]=je,j[Ge].geometry=null}else _e in U?ue(_e,Fe,Ee):Fe in V?he(_e,Fe,Ee):(X(ge),V[_e]=H-1,U[Fe]=H-1)}return j.filter((ge=>ge.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((F,V)=>F.sortKey-V.sortKey))}update(e,n,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,n,this.layers,{imagePositions:s}),this.icon.programConfigurations.updatePaintArrays(e,n,this.layers,{imagePositions:s}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,n){let s=this.lineVertexArray.length;if(e.segment!==void 0){let c=e.dist(n[e.segment+1]),d=e.dist(n[e.segment]),m={};for(let _=e.segment+1;_<n.length;_++)m[_]={x:n[_].x,y:n[_].y,tileUnitDistanceFromAnchor:c},_<n.length-1&&(c+=n[_+1].dist(n[_]));for(let _=e.segment||0;_>=0;_--)m[_]={x:n[_].x,y:n[_].y,tileUnitDistanceFromAnchor:d},_>0&&(d+=n[_-1].dist(n[_]));for(let _=0;_<n.length;_++){let x=m[_];this.lineVertexArray.emplaceBack(x.x,x.y,x.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,n,s,c,d,m,_,x,b,S,w,A){let E=e.indexArray,R=e.layoutVertexArray,I=e.segments.prepareSegment(4*n.length,R,E,this.canOverlap?m.sortKey:void 0),O=this.glyphOffsetArray.length,F=I.vertexLength,V=this.allowVerticalPlacement&&_===y.ax.vertical?Math.PI/2:0,U=m.text&&m.text.sections;for(let j=0;j<n.length;j++){let{tl:H,tr:X,bl:ue,br:he,tex:be,pixelOffsetTL:ge,pixelOffsetBR:Me,minFontScaleX:Ee,minFontScaleY:we,glyphOffset:_e,isSDF:Fe,sectionIndex:Ge}=n[j],je=I.vertexLength,Ne=_e[1];n0(R,x.x,x.y,H.x,Ne+H.y,be.x,be.y,s,Fe,ge.x,ge.y,Ee,we),n0(R,x.x,x.y,X.x,Ne+X.y,be.x+be.w,be.y,s,Fe,Me.x,ge.y,Ee,we),n0(R,x.x,x.y,ue.x,Ne+ue.y,be.x,be.y+be.h,s,Fe,ge.x,Me.y,Ee,we),n0(R,x.x,x.y,he.x,Ne+he.y,be.x+be.w,be.y+be.h,s,Fe,Me.x,Me.y,Ee,we),f_(e.dynamicLayoutVertexArray,x,V),E.emplaceBack(je,je+2,je+1),E.emplaceBack(je+1,je+2,je+3),I.vertexLength+=4,I.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(_e[0]),j!==n.length-1&&Ge===n[j+1].sectionIndex||e.programConfigurations.populatePaintArrays(R.length,m,m.index,{imagePositions:{},canonical:A,formattedSection:U?.[Ge]})}e.placedSymbolArray.emplaceBack(x.x,x.y,O,this.glyphOffsetArray.length-O,F,b,S,x.segment,s?s[0]:0,s?s[1]:0,c[0],c[1],_,0,!1,0,w)}_addCollisionDebugVertex(e,n,s,c,d,m){return n.emplaceBack(0,0),e.emplaceBack(s.x,s.y,c,d,Math.round(m.x),Math.round(m.y))}addCollisionDebugVertices(e,n,s,c,d,m,_){let x=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),b=x.vertexLength,S=d.layoutVertexArray,w=d.collisionVertexArray,A=_.anchorX,E=_.anchorY;this._addCollisionDebugVertex(S,w,m,A,E,new D(e,n)),this._addCollisionDebugVertex(S,w,m,A,E,new D(s,n)),this._addCollisionDebugVertex(S,w,m,A,E,new D(s,c)),this._addCollisionDebugVertex(S,w,m,A,E,new D(e,c)),x.vertexLength+=4;let R=d.indexArray;R.emplaceBack(b,b+1),R.emplaceBack(b+1,b+2),R.emplaceBack(b+2,b+3),R.emplaceBack(b+3,b),x.primitiveLength+=4}addDebugCollisionBoxes(e,n,s,c){for(let d=e;d<n;d++){let m=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(m.x1,m.y1,m.x2,m.y2,c?this.textCollisionBox:this.iconCollisionBox,m.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new g_(Se,Hx.members,Qe),this.iconCollisionBox=new g_(Se,Hx.members,Qe);for(let e=0;e<this.symbolInstances.length;e++){let n=this.symbolInstances.get(e);this.addDebugCollisionBoxes(n.textBoxStartIndex,n.textBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.iconBoxStartIndex,n.iconBoxEndIndex,n,!1),this.addDebugCollisionBoxes(n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex,n,!1)}}_deserializeCollisionBoxesForSymbol(e,n,s,c,d,m,_,x,b){let S={};for(let w=n;w<s;w++){let A=e.get(w);S.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.textFeatureIndex=A.featureIndex;break}for(let w=c;w<d;w++){let A=e.get(w);S.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalTextFeatureIndex=A.featureIndex;break}for(let w=m;w<_;w++){let A=e.get(w);S.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.iconFeatureIndex=A.featureIndex;break}for(let w=x;w<b;w++){let A=e.get(w);S.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalIconFeatureIndex=A.featureIndex;break}return S}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let n=0;n<this.symbolInstances.length;n++){let s=this.symbolInstances.get(n);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,n){let s=e.placedSymbolArray.get(n),c=s.vertexStartIndex+4*s.numGlyphs;for(let d=s.vertexStartIndex;d<c;d+=4)e.indexArray.emplaceBack(d,d+2,d+1),e.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let n=Math.sin(e),s=Math.cos(e),c=[],d=[],m=[];for(let _=0;_<this.symbolInstances.length;++_){m.push(_);let x=this.symbolInstances.get(_);c.push(0|Math.round(n*x.anchorX+s*x.anchorY)),d.push(x.featureIndex)}return m.sort(((_,x)=>c[_]-c[x]||d[x]-d[_])),m}addToSortKeyRanges(e,n){let s=this.sortKeyRanges[this.sortKeyRanges.length-1];s?.sortKey===n?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:n,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let n of this.symbolInstanceIndexes){let s=this.symbolInstances.get(n);this.featureSortOrder.push(s.featureIndex);let c=[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex];for(let d=0;d<c.length;d++){let m=c[d];m>=0&&c.indexOf(m)===d&&this.addIndicesForPlacedSymbol(this.text,m)}s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let o2,s2;Ye("SymbolBucket",Wu,{omit:["layers","collisionBoxArray","features","compareText"]}),Wu.MAX_GLYPHS=65535,Wu.addDynamicAttributes=f_;var __={get paint(){return s2=s2||new Yn({"icon-opacity":new it(Ce.paint_symbol["icon-opacity"]),"icon-color":new it(Ce.paint_symbol["icon-color"]),"icon-halo-color":new it(Ce.paint_symbol["icon-halo-color"]),"icon-halo-width":new it(Ce.paint_symbol["icon-halo-width"]),"icon-halo-blur":new it(Ce.paint_symbol["icon-halo-blur"]),"icon-translate":new Je(Ce.paint_symbol["icon-translate"]),"icon-translate-anchor":new Je(Ce.paint_symbol["icon-translate-anchor"]),"text-opacity":new it(Ce.paint_symbol["text-opacity"]),"text-color":new it(Ce.paint_symbol["text-color"],{runtimeType:mr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new it(Ce.paint_symbol["text-halo-color"]),"text-halo-width":new it(Ce.paint_symbol["text-halo-width"]),"text-halo-blur":new it(Ce.paint_symbol["text-halo-blur"]),"text-translate":new Je(Ce.paint_symbol["text-translate"]),"text-translate-anchor":new Je(Ce.paint_symbol["text-translate-anchor"])})},get layout(){return o2=o2||new Yn({"symbol-placement":new Je(Ce.layout_symbol["symbol-placement"]),"symbol-spacing":new Je(Ce.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Je(Ce.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new it(Ce.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Je(Ce.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Je(Ce.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Je(Ce.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Je(Ce.layout_symbol["icon-ignore-placement"]),"icon-optional":new Je(Ce.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Je(Ce.layout_symbol["icon-rotation-alignment"]),"icon-size":new it(Ce.layout_symbol["icon-size"]),"icon-text-fit":new Je(Ce.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Je(Ce.layout_symbol["icon-text-fit-padding"]),"icon-image":new it(Ce.layout_symbol["icon-image"]),"icon-rotate":new it(Ce.layout_symbol["icon-rotate"]),"icon-padding":new it(Ce.layout_symbol["icon-padding"]),"icon-keep-upright":new Je(Ce.layout_symbol["icon-keep-upright"]),"icon-offset":new it(Ce.layout_symbol["icon-offset"]),"icon-anchor":new it(Ce.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Je(Ce.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Je(Ce.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Je(Ce.layout_symbol["text-rotation-alignment"]),"text-field":new it(Ce.layout_symbol["text-field"]),"text-font":new it(Ce.layout_symbol["text-font"]),"text-size":new it(Ce.layout_symbol["text-size"]),"text-max-width":new it(Ce.layout_symbol["text-max-width"]),"text-line-height":new Je(Ce.layout_symbol["text-line-height"]),"text-letter-spacing":new it(Ce.layout_symbol["text-letter-spacing"]),"text-justify":new it(Ce.layout_symbol["text-justify"]),"text-radial-offset":new it(Ce.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Je(Ce.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new it(Ce.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new it(Ce.layout_symbol["text-anchor"]),"text-max-angle":new Je(Ce.layout_symbol["text-max-angle"]),"text-writing-mode":new Je(Ce.layout_symbol["text-writing-mode"]),"text-rotate":new it(Ce.layout_symbol["text-rotate"]),"text-padding":new Je(Ce.layout_symbol["text-padding"]),"text-keep-upright":new Je(Ce.layout_symbol["text-keep-upright"]),"text-transform":new it(Ce.layout_symbol["text-transform"]),"text-offset":new it(Ce.layout_symbol["text-offset"]),"text-allow-overlap":new Je(Ce.layout_symbol["text-allow-overlap"]),"text-overlap":new Je(Ce.layout_symbol["text-overlap"]),"text-ignore-placement":new Je(Ce.layout_symbol["text-ignore-placement"]),"text-optional":new Je(Ce.layout_symbol["text-optional"])})}};class l2{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:to,this.defaultValue=e}evaluate(e){if(e.formattedSection){let n=this.defaultValue.property.overrides;if(n?.hasOverride(e.formattedSection))return n.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ye("FormatSectionOverride",l2,{omit:["defaultValue"]});class r0 extends Rr{constructor(e,n){super(e,__,n)}recalculate(e,n){if(super.recalculate(e,n),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let s=this.layout.get("text-writing-mode");if(s){let c=[];for(let d of s)c.includes(d)||c.push(d);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,n,s,c){let d=this.layout.get(e).evaluate(n,{},s,c),m=this._unevaluatedLayout._values[e];return m.isDataDriven()||yu(m.value)||!d?d:(function(_,x){return x.replace(/{([^{}]+)}/g,((b,S)=>_&&S in _?String(_[S]):""))})(n.properties,d)}createBucket(e){return new Wu(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of __.paint.overridableProperties){if(!r0.hasPaintOverride(this.layout,e))continue;let n=this.paint.get(e),s=new l2(n),c=new Kl(s,n.property.specification),d=null;d=n.value.kind==="constant"||n.value.kind==="source"?new vu("source",c):new bu("composite",c,n.value.zoomStops),this.paint._values[e]=new Kr(n.property,d,n.parameters)}}_handleOverridablePaintPropertyUpdate(e,n,s){return!(!this.layout||n.isDataDriven()||s.isDataDriven())&&r0.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,n){let s=e.get("text-field"),c=__.paint.properties[n],d=!1,m=_=>{var x;for(let b of _)if(!((x=c.overrides)===null||x===void 0)&&x.hasOverride(b))return void(d=!0)};if(s.value.kind==="constant"&&s.value.value instanceof lr)m(s.value.value.sections);else if(s.value.kind==="source"||s.value.kind==="composite"){let _=b=>{d||(b instanceof pa&&Li(b.value)===Bl?m(b.value.sections):b instanceof Vo?m(b.sections):b.eachChild(_))},x=s.value;x._styleExpression&&_(x._styleExpression.expression)}return d}}let c2;var RM={get paint(){return c2=c2||new Yn({"background-color":new Je(Ce.paint_background["background-color"]),"background-pattern":new Fm(Ce.paint_background["background-pattern"]),"background-opacity":new Je(Ce.paint_background["background-opacity"])})}};class IM extends Rr{constructor(e,n){super(e,RM,n)}}class kM extends Rr{constructor(e,n){super(e,{},n),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class LM{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)===null||e===void 0||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let OM={once:!0},y_=63710088e-1;class tl{constructor(e,n){if(isNaN(e)||isNaN(n))throw new Error(`Invalid LngLat object: (${e}, ${n})`);if(this.lng=+e,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new tl(vn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let n=Math.PI/180,s=this.lat*n,c=e.lat*n,d=Math.sin(s)*Math.sin(c)+Math.cos(s)*Math.cos(c)*Math.cos((e.lng-this.lng)*n);return y_*Math.acos(Math.min(d,1))}static convert(e){if(e instanceof tl)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new tl(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new tl(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}let u2=2*Math.PI*y_;function h2(r){return u2*Math.cos(r*Math.PI/180)}function d2(r){return(180+r)/360}function p2(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function f2(r,e){return r/h2(e)}function m2(r){return 360*r-180}function a0(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function g2(r,e){return r*h2(a0(e))}class wp{constructor(e,n,s=0){this.x=+e,this.y=+n,this.z=+s}static fromLngLat(e,n=0){let s=tl.convert(e);return new wp(d2(s.lng),p2(s.lat),f2(n,s.lat))}toLngLat(){return new tl(m2(this.x),a0(this.y))}toAltitude(){return g2(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/u2*(e=a0(this.y),1/Math.cos(e*Math.PI/180));var e}}function _2(r,e,n){var s=2*Math.PI*6378137/256/Math.pow(2,n);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class v_{constructor(e,n,s){if(!(function(c,d,m){return!(c<0||c>25||m<0||m>=Math.pow(2,c)||d<0||d>=Math.pow(2,c))})(e,n,s))throw new Error(`x=${n}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=n,this.y=s,this.key=Ku(0,e,e,n,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,n,s){let c=(m=this.y,_=this.z,x=_2(256*(d=this.x),256*(m=Math.pow(2,_)-m-1),_),b=_2(256*(d+1),256*(m+1),_),x[0]+","+x[1]+","+b[0]+","+b[1]);var d,m,_,x,b;let S=(function(w,A,E){let R="";for(let I=w;I>0;I--){let O=1<<I-1;R+=(A&O?1:0)+(E&O?2:0)}return R})(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,n>1?"@2x":"").replace(/{quadkey}/g,S).replace(/{bbox-epsg-3857}/g,c)}isChildOf(e){let n=this.z-e.z;return n>0&&e.x===this.x>>n&&e.y===this.y>>n}getTilePoint(e){let n=Math.pow(2,this.z);return new D((e.x*n-this.x)*Ke,(e.y*n-this.y)*Ke)}toString(){return`${this.z}/${this.x}/${this.y}`}}class y2{constructor(e,n){this.wrap=e,this.canonical=n,this.key=Ku(e,n.z,n.z,n.x,n.y)}}class kr{constructor(e,n,s,c,d){if(this.terrainRttPosMatrix32f=null,e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=n,this.canonical=new v_(s,+c,+d),this.key=Ku(n,e,s,c,d)}clone(){return new kr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?new kr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new kr(e,this.wrap,e,this.canonical.x>>n,this.canonical.y>>n)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,n){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let s=this.canonical.z-e;return e>this.canonical.z?Ku(this.wrap*+n,e,this.canonical.z,this.canonical.x,this.canonical.y):Ku(this.wrap*+n,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let n=this.canonical.z-e.canonical.z;return!(n<0)&&e.canonical.x===this.canonical.x>>n&&e.canonical.y===this.canonical.y>>n}children(e){if(this.overscaledZ>=e)return[new kr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let n=this.canonical.z+1,s=2*this.canonical.x,c=2*this.canonical.y;return[new kr(n,this.wrap,n,s,c),new kr(n,this.wrap,n,s+1,c),new kr(n,this.wrap,n,s,c+1),new kr(n,this.wrap,n,s+1,c+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new kr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new kr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new y2(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new wp(e.x-this.wrap,e.y))}normalizeCoordinates(e,n,s=8192){if(e>=0&&e<s&&n>=0&&n<s)return{tileID:this,x:e,y:n};let c=Math.floor(e/s),d=Math.floor(n/s),m=e-c*s,_=n-d*s,x=this.canonical.z,b=1<<x,S=this.canonical.y+d;if(S<0||S>=b)return null;let w=this.canonical.x+c,A=this.wrap;return w<0?(A-=Math.ceil(-w/b),w=(w%b+b)%b):w>=b&&(A+=Math.floor(w/b),w%=b),{tileID:new kr(this.overscaledZ,A,x,w,S),x:m,y:_}}}function Ku(r,e,n,s,c){(r*=2)<0&&(r=-1*r-1);let d=1<<n;return(d*d*r+d*c+s).toString(36)+n.toString(36)+e.toString(36)}Ye("CanonicalTileID",v_),Ye("OverscaledTileID",kr,{omit:["terrainRttPosMatrix32f"]});class bc{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let n=new bc;return n.extend(e(new D(this.minX,this.minY))),n.extend(e(new D(this.maxX,this.minY))),n.extend(e(new D(this.minX,this.maxY))),n.extend(e(new D(this.maxX,this.maxY))),n}static fromPoints(e){let n=new bc;for(let s of e)n.extend(s);return n}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class v2{constructor(e){this._stringToNumber={},this._numberToString=[];for(let n=0;n<e.length;n++){let s=e[n];this._stringToNumber[s]=n,this._numberToString[n]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class b2{constructor(e,n,s,c,d){this.type="Feature",this._vectorTileFeature=e,this._x=s,this._y=c,this._z=n,this.properties=e.properties,this.id=d}projectPoint(e,n,s,c){return[360*(e.x+n)/c-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/c)*Math.PI))-90]}projectLine(e,n,s,c){return e.map((d=>this.projectPoint(d,n,s,c)))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,n=e.extent*Math.pow(2,this._z),s=e.extent*this._x,c=e.extent*this._y,d=e.loadGeometry();switch(e.type){case 1:{let m=[];for(let x of d)m.push(x[0]);let _=this.projectLine(m,s,c,n);this._geometry=m.length===1?{type:"Point",coordinates:_[0]}:{type:"MultiPoint",coordinates:_};break}case 2:{let m=d.map((_=>this.projectLine(_,s,c,n)));this._geometry=m.length===1?{type:"LineString",coordinates:m[0]}:{type:"MultiLineString",coordinates:m};break}case 3:{let m=Tx(d),_=[];for(let x of m)_.push(x.map((b=>this.projectLine(b,s,c,n))));this._geometry=_.length===1?{type:"Polygon",coordinates:_[0]}:{type:"MultiPolygon",coordinates:_};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let n in this)n!=="_geometry"&&n!=="_vectorTileFeature"&&n!=="_x"&&n!=="_y"&&n!=="_z"&&(e[n]=this[n]);return e}}class Qu{constructor(e,n,s){this._name=e,this.dataBuffer=n,typeof s=="number"?this._size=s:(this.nullabilityBuffer=s,this._size=s.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class o0 extends Qu{}class b_ extends o0{getValueFromBuffer(e){return this.dataBuffer[e]}}class x_ extends o0{getValueFromBuffer(e){return this.dataBuffer[e]}}class x2 extends Qu{constructor(e,n,s,c){super(e,n,c),this.delta=s}}class w_ extends x2{constructor(e,n,s,c){super(e,Int32Array.of(n),s,c)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class T_ extends Qu{constructor(e,n,s,c){super(e,c?Int32Array.of(n):Uint32Array.of(n),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}class BM{constructor(e,n,s,c,d=4096){this._name=e,this._geometryVector=n,this._idVector=s,this._propertyVectors=c,this._extent=d}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((n=>[n.name,n])))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],n=this.geometryVector.getGeometries();for(let s=0;s<this.numFeatures;s++){let c;if(this.idVector){let _=this.idVector.getValue(s);c=this.containsMaxSafeIntegerValues(this.idVector)&&_!==null?Number(_):_}let d={coordinates:n[s],type:this.geometryVector.geometryType(s)},m={};for(let _ of this.propertyVectors){if(!_)continue;let x=_.name,b=_.getValue(s);b!==null&&(m[x]=b)}e.push({id:c,geometry:d,properties:m})}return e}containsMaxSafeIntegerValues(e){return e instanceof b_||e instanceof T_||e instanceof w_||e instanceof x_}}class w2{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var vt,il;(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(vt||(vt={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(il||(il={}));let S_=new Uint32Array(33);S_[0]=0;for(let r=1;r<=32;r++)S_[r]=r===32?4294967295:4294967295>>>32-r;let M_=S_,is=256;function E_(r,e){return r-r%e}function FM(r){let e=r>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}let C_=(function(){if(!Number.isFinite(65536))return 65536;let r=E_(Math.floor(65536),is);return r===0?is:r})(),NM=3*C_/is+C_|0;function T2(){let r=new Uint8Array(NM);return{dataToBePacked:new Array(33),dataPointers:new Int32Array(33),byteContainer:r,byteContainerI32:new Int32Array(r.buffer,r.byteOffset,r.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function UM(r,e,n,s,c){switch(c){case 1:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0;_[b++]=A>>>0&1,_[b++]=A>>>1&1,_[b++]=A>>>2&1,_[b++]=A>>>3&1,_[b++]=A>>>4&1,_[b++]=A>>>5&1,_[b++]=A>>>6&1,_[b++]=A>>>7&1,_[b++]=A>>>8&1,_[b++]=A>>>9&1,_[b++]=A>>>10&1,_[b++]=A>>>11&1,_[b++]=A>>>12&1,_[b++]=A>>>13&1,_[b++]=A>>>14&1,_[b++]=A>>>15&1,_[b++]=A>>>16&1,_[b++]=A>>>17&1,_[b++]=A>>>18&1,_[b++]=A>>>19&1,_[b++]=A>>>20&1,_[b++]=A>>>21&1,_[b++]=A>>>22&1,_[b++]=A>>>23&1,_[b++]=A>>>24&1,_[b++]=A>>>25&1,_[b++]=A>>>26&1,_[b++]=A>>>27&1,_[b++]=A>>>28&1,_[b++]=A>>>29&1,_[b++]=A>>>30&1,_[b++]=A>>>31&1}})(r,e,n,s);break;case 2:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0;_[b++]=A>>>0&3,_[b++]=A>>>2&3,_[b++]=A>>>4&3,_[b++]=A>>>6&3,_[b++]=A>>>8&3,_[b++]=A>>>10&3,_[b++]=A>>>12&3,_[b++]=A>>>14&3,_[b++]=A>>>16&3,_[b++]=A>>>18&3,_[b++]=A>>>20&3,_[b++]=A>>>22&3,_[b++]=A>>>24&3,_[b++]=A>>>26&3,_[b++]=A>>>28&3,_[b++]=A>>>30&3,_[b++]=E>>>0&3,_[b++]=E>>>2&3,_[b++]=E>>>4&3,_[b++]=E>>>6&3,_[b++]=E>>>8&3,_[b++]=E>>>10&3,_[b++]=E>>>12&3,_[b++]=E>>>14&3,_[b++]=E>>>16&3,_[b++]=E>>>18&3,_[b++]=E>>>20&3,_[b++]=E>>>22&3,_[b++]=E>>>24&3,_[b++]=E>>>26&3,_[b++]=E>>>28&3,_[b++]=E>>>30&3}})(r,e,n,s);break;case 3:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0;_[b++]=A>>>0&7,_[b++]=A>>>3&7,_[b++]=A>>>6&7,_[b++]=A>>>9&7,_[b++]=A>>>12&7,_[b++]=A>>>15&7,_[b++]=A>>>18&7,_[b++]=A>>>21&7,_[b++]=A>>>24&7,_[b++]=A>>>27&7,_[b++]=7&(A>>>30|(1&E)<<2),_[b++]=E>>>1&7,_[b++]=E>>>4&7,_[b++]=E>>>7&7,_[b++]=E>>>10&7,_[b++]=E>>>13&7,_[b++]=E>>>16&7,_[b++]=E>>>19&7,_[b++]=E>>>22&7,_[b++]=E>>>25&7,_[b++]=E>>>28&7,_[b++]=7&(E>>>31|(3&R)<<1),_[b++]=R>>>2&7,_[b++]=R>>>5&7,_[b++]=R>>>8&7,_[b++]=R>>>11&7,_[b++]=R>>>14&7,_[b++]=R>>>17&7,_[b++]=R>>>20&7,_[b++]=R>>>23&7,_[b++]=R>>>26&7,_[b++]=R>>>29&7}})(r,e,n,s);break;case 4:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0,I=d[S++]>>>0;_[b++]=A>>>0&15,_[b++]=A>>>4&15,_[b++]=A>>>8&15,_[b++]=A>>>12&15,_[b++]=A>>>16&15,_[b++]=A>>>20&15,_[b++]=A>>>24&15,_[b++]=A>>>28&15,_[b++]=E>>>0&15,_[b++]=E>>>4&15,_[b++]=E>>>8&15,_[b++]=E>>>12&15,_[b++]=E>>>16&15,_[b++]=E>>>20&15,_[b++]=E>>>24&15,_[b++]=E>>>28&15,_[b++]=R>>>0&15,_[b++]=R>>>4&15,_[b++]=R>>>8&15,_[b++]=R>>>12&15,_[b++]=R>>>16&15,_[b++]=R>>>20&15,_[b++]=R>>>24&15,_[b++]=R>>>28&15,_[b++]=I>>>0&15,_[b++]=I>>>4&15,_[b++]=I>>>8&15,_[b++]=I>>>12&15,_[b++]=I>>>16&15,_[b++]=I>>>20&15,_[b++]=I>>>24&15,_[b++]=I>>>28&15}})(r,e,n,s);break;case 5:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0,I=d[S++]>>>0,O=d[S++]>>>0;_[b++]=A>>>0&31,_[b++]=A>>>5&31,_[b++]=A>>>10&31,_[b++]=A>>>15&31,_[b++]=A>>>20&31,_[b++]=A>>>25&31,_[b++]=31&(A>>>30|(7&E)<<2),_[b++]=E>>>3&31,_[b++]=E>>>8&31,_[b++]=E>>>13&31,_[b++]=E>>>18&31,_[b++]=E>>>23&31,_[b++]=31&(E>>>28|(1&R)<<4),_[b++]=R>>>1&31,_[b++]=R>>>6&31,_[b++]=R>>>11&31,_[b++]=R>>>16&31,_[b++]=R>>>21&31,_[b++]=R>>>26&31,_[b++]=31&(R>>>31|(15&I)<<1),_[b++]=I>>>4&31,_[b++]=I>>>9&31,_[b++]=I>>>14&31,_[b++]=I>>>19&31,_[b++]=I>>>24&31,_[b++]=31&(I>>>29|(3&O)<<3),_[b++]=O>>>2&31,_[b++]=O>>>7&31,_[b++]=O>>>12&31,_[b++]=O>>>17&31,_[b++]=O>>>22&31,_[b++]=O>>>27&31}})(r,e,n,s);break;case 6:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0,I=d[S++]>>>0,O=d[S++]>>>0,F=d[S++]>>>0;_[b++]=A>>>0&63,_[b++]=A>>>6&63,_[b++]=A>>>12&63,_[b++]=A>>>18&63,_[b++]=A>>>24&63,_[b++]=63&(A>>>30|(15&E)<<2),_[b++]=E>>>4&63,_[b++]=E>>>10&63,_[b++]=E>>>16&63,_[b++]=E>>>22&63,_[b++]=63&(E>>>28|(3&R)<<4),_[b++]=R>>>2&63,_[b++]=R>>>8&63,_[b++]=R>>>14&63,_[b++]=R>>>20&63,_[b++]=R>>>26&63,_[b++]=I>>>0&63,_[b++]=I>>>6&63,_[b++]=I>>>12&63,_[b++]=I>>>18&63,_[b++]=I>>>24&63,_[b++]=63&(I>>>30|(15&O)<<2),_[b++]=O>>>4&63,_[b++]=O>>>10&63,_[b++]=O>>>16&63,_[b++]=O>>>22&63,_[b++]=63&(O>>>28|(3&F)<<4),_[b++]=F>>>2&63,_[b++]=F>>>8&63,_[b++]=F>>>14&63,_[b++]=F>>>20&63,_[b++]=F>>>26&63}})(r,e,n,s);break;case 7:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0,I=d[S++]>>>0,O=d[S++]>>>0,F=d[S++]>>>0,V=d[S++]>>>0;_[b++]=A>>>0&127,_[b++]=A>>>7&127,_[b++]=A>>>14&127,_[b++]=A>>>21&127,_[b++]=127&(A>>>28|(7&E)<<4),_[b++]=E>>>3&127,_[b++]=E>>>10&127,_[b++]=E>>>17&127,_[b++]=E>>>24&127,_[b++]=127&(E>>>31|(63&R)<<1),_[b++]=R>>>6&127,_[b++]=R>>>13&127,_[b++]=R>>>20&127,_[b++]=127&(R>>>27|(3&I)<<5),_[b++]=I>>>2&127,_[b++]=I>>>9&127,_[b++]=I>>>16&127,_[b++]=I>>>23&127,_[b++]=127&(I>>>30|(31&O)<<2),_[b++]=O>>>5&127,_[b++]=O>>>12&127,_[b++]=O>>>19&127,_[b++]=127&(O>>>26|(1&F)<<6),_[b++]=F>>>1&127,_[b++]=F>>>8&127,_[b++]=F>>>15&127,_[b++]=F>>>22&127,_[b++]=127&(F>>>29|(15&V)<<3),_[b++]=V>>>4&127,_[b++]=V>>>11&127,_[b++]=V>>>18&127,_[b++]=V>>>25&127}})(r,e,n,s);break;case 8:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<8;w++){let A=d[S++]>>>0,E=d[S++]>>>0,R=d[S++]>>>0,I=d[S++]>>>0,O=d[S++]>>>0,F=d[S++]>>>0,V=d[S++]>>>0,U=d[S++]>>>0;_[b++]=A>>>0&255,_[b++]=A>>>8&255,_[b++]=A>>>16&255,_[b++]=A>>>24&255,_[b++]=E>>>0&255,_[b++]=E>>>8&255,_[b++]=E>>>16&255,_[b++]=E>>>24&255,_[b++]=R>>>0&255,_[b++]=R>>>8&255,_[b++]=R>>>16&255,_[b++]=R>>>24&255,_[b++]=I>>>0&255,_[b++]=I>>>8&255,_[b++]=I>>>16&255,_[b++]=I>>>24&255,_[b++]=O>>>0&255,_[b++]=O>>>8&255,_[b++]=O>>>16&255,_[b++]=O>>>24&255,_[b++]=F>>>0&255,_[b++]=F>>>8&255,_[b++]=F>>>16&255,_[b++]=F>>>24&255,_[b++]=V>>>0&255,_[b++]=V>>>8&255,_[b++]=V>>>16&255,_[b++]=V>>>24&255,_[b++]=U>>>0&255,_[b++]=U>>>8&255,_[b++]=U>>>16&255,_[b++]=U>>>24&255}})(r,e,n,s);break;case 16:(function(d,m,_,x){let b=x,S=m;for(let w=0;w<128;w++){let A=d[S++]>>>0;_[b++]=65535&A,_[b++]=A>>>16&65535}})(r,e,n,s);break;default:(function(d,m,_,x,b){let S=M_[b]>>>0,w=m,A=0,E=d[w]>>>0,R=x;for(let I=0;I<8;I++){for(let O=0;O<32;O++)if(A+b<=32)_[R+O]=E>>>A&S,A+=b,A===32&&(A=0,w++,O!==31&&(E=d[w]>>>0));else{let F=32-A,V=E>>>A;w++,E=d[w]>>>0;let U=b-F;_[R+O]=(V|(E&-1>>>32-U>>>0)<<F)&S,A=U}R+=32,A=0,I<7&&(E=d[w]>>>0)}})(r,e,n,s,c)}return e+(c<<3)|0}function VM(r,e,n,s){if(n+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${s} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${n}, byteSize=${e})`);let c=r[n++],d=r[n++];if(c>32)throw new Error(`FastPFOR decode: invalid bitWidth=${c} at block=${s} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:c,exceptionCount:d,bytePosIn:n}}function jM(r,e,n,s,c,d,m,_,x){let{maxBits:b,exceptionBitWidth:S,bytePosIn:w}=(function(O,F,V,U,j,H){if(V+1>F)throw new Error(`FastPFOR decode: exception header underflow at block=${H} (need 1 byte for maxBits, bytePos=${V}, byteSize=${F})`);let X=O[V++];if(X<U||X>32)throw new Error(`FastPFOR decode: invalid maxBits=${X} at block=${H} (bitWidth=${U}, expected ${U}..32)`);let ue=X-U|0;if(ue<1||ue>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${ue} at block=${H} (bitWidth=${U}, maxBits=${X})`);if(V+j>F)throw new Error(`FastPFOR decode: exception positions underflow at block=${H} (need=${j}, have=${F-V})`);return{maxBits:X,exceptionBitWidth:ue,bytePosIn:V}})(c,d,m,n,s,x);if(m=w,S===1){let O=1<<n;for(let F=0;F<s;F=F+1|0)r[c[m++]+e|0]|=O;return m}let A=_.dataToBePacked[S];if(!A)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${S} (bitWidth=${n}, maxBits=${b}) at block ${x}`);let E=_.dataPointers,R=0|E[S],I=0|_.exceptionSizes[S];if(R+s>I)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${S} (ptr=${R}, need ${s}, size=${I}) at block ${x}`);for(let O=0;O<s;O=O+1|0){let F=c[m++],V=0|A[R++];r[F+e|0]|=V<<n}return E[S]=R,m}function qM(r,e,n,s,c,d){let m=0|n,_=0|r[m];if(_<=0||m+_>r.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${_} at pageStart=${m} (expected > 0 and pageStart+whereMeta < encoded.length=${r.length})`);let x=m+1|0,b=m+_|0,S=r[b]>>>0,w=S+3>>>2,A=b+1,E=A+w;if(E>=r.length)throw new Error(`FastPFOR decode: invalid byteSize=${S} (metaInts=${w}, pageStart=${m}, packedEnd=${b}, byteContainerStart=${A}) causes bitmapPos=${E} out of bounds (encoded.length=${r.length})`);let R=(function(F,V,U,j){j.byteContainer.length<U&&(j.byteContainer=new Uint8Array(2*U),j.byteContainerI32=void 0);let H=j.byteContainer,X=U>>>2;if(3&H.byteOffset)for(let he=0;he<X;he=he+1|0){let be=0|F[V+he|0],ge=he<<2;H[ge]=255&be,H[ge+1|0]=be>>>8&255,H[ge+2|0]=be>>>16&255,H[ge+3|0]=be>>>24&255}else{let he=j.byteContainerI32;(!he||he.buffer!==H.buffer||he.byteOffset!==H.byteOffset||he.length<X)&&(he=j.byteContainerI32=new Int32Array(H.buffer,H.byteOffset,H.byteLength>>>2)),he.set(F.subarray(V,V+X))}let ue=3&U;if(ue>0){let he=0|F[V+X|0],be=X<<2;for(let ge=0;ge<ue;ge=ge+1|0)H[be+ge|0]=he>>>(ge<<3)&255}return H})(r,A,S,d),I=S,O=(function(F,V,U){let j=0|F[V++],H=U.dataToBePacked;for(let X=2;X<=32;X=X+1|0){if(!(j>>>X-1&1))continue;if(V>=F.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${X}, streamWordIndex=${V}, needWords=1, availableWords=${F.length-V}, encodedWords=${F.length})`);let ue=F[V++]>>>0,he=E_(ue+31,32),be=ue*X+31>>>5;if(V+be>F.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${X}, size=${ue}, streamWordIndex=${V}, needWords=${be}, availableWords=${F.length-V}, encodedWords=${F.length})`);let ge=H[X];(!ge||ge.length<he)&&(ge=H[X]=new Uint32Array(he));let Me=0;for(;Me<ue;Me=Me+32|0)GM(F,V,ge,Me,X),V=V+X|0;V=V-((Me-ue|0)*X>>>5)|0,U.exceptionSizes[X]=ue}return V})(r,E,d);return d.dataPointers.fill(0),(function(F,V,U,j,H,X,ue,he,be,ge){let Me=0|U,Ee=0;for(let we=0;we<ue;we=we+1|0){let _e=VM(he,be,Ee,we);Ee=_e.bytePosIn;let Fe=_e.bitWidth,Ge=_e.exceptionCount,je=X+we*is|0;switch(Fe){case 0:H.fill(0,je,je+is);break;case 32:for(let Ne=0;Ne<is;Ne=Ne+1|0)H[je+Ne|0]=0|F[Me+Ne|0];Me=Me+is|0;break;default:Me=UM(F,Me,H,je,Fe)}Ge>0&&(Ee=jM(H,je,Fe,Ge,he,be,Ee,ge,we))}if(Me!==j)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${V}, packedStart=${U}, consumedPackedEnd=${Me}, expectedPackedEnd=${j}, packedWords=${j-U}, encoded.length=${F.length})`)})(r,m,x,b,e,0|s,c/is|0,R,I,d),O}function GM(r,e,n,s,c){switch(c){case 2:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0;w[E++]=R>>>0&3,w[E++]=R>>>2&3,w[E++]=R>>>4&3,w[E++]=R>>>6&3,w[E++]=R>>>8&3,w[E++]=R>>>10&3,w[E++]=R>>>12&3,w[E++]=R>>>14&3,w[E++]=R>>>16&3,w[E++]=R>>>18&3,w[E++]=R>>>20&3,w[E++]=R>>>22&3,w[E++]=R>>>24&3,w[E++]=R>>>26&3,w[E++]=R>>>28&3,w[E++]=R>>>30&3,w[E++]=I>>>0&3,w[E++]=I>>>2&3,w[E++]=I>>>4&3,w[E++]=I>>>6&3,w[E++]=I>>>8&3,w[E++]=I>>>10&3,w[E++]=I>>>12&3,w[E++]=I>>>14&3,w[E++]=I>>>16&3,w[E++]=I>>>18&3,w[E++]=I>>>20&3,w[E++]=I>>>22&3,w[E++]=I>>>24&3,w[E++]=I>>>26&3,w[E++]=I>>>28&3,w[E]=I>>>30&3})(r,e,n,s);case 3:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0;w[E++]=R>>>0&7,w[E++]=R>>>3&7,w[E++]=R>>>6&7,w[E++]=R>>>9&7,w[E++]=R>>>12&7,w[E++]=R>>>15&7,w[E++]=R>>>18&7,w[E++]=R>>>21&7,w[E++]=R>>>24&7,w[E++]=R>>>27&7,w[E++]=7&(R>>>30|(1&I)<<2),w[E++]=I>>>1&7,w[E++]=I>>>4&7,w[E++]=I>>>7&7,w[E++]=I>>>10&7,w[E++]=I>>>13&7,w[E++]=I>>>16&7,w[E++]=I>>>19&7,w[E++]=I>>>22&7,w[E++]=I>>>25&7,w[E++]=I>>>28&7,w[E++]=7&(I>>>31|(3&O)<<1),w[E++]=O>>>2&7,w[E++]=O>>>5&7,w[E++]=O>>>8&7,w[E++]=O>>>11&7,w[E++]=O>>>14&7,w[E++]=O>>>17&7,w[E++]=O>>>20&7,w[E++]=O>>>23&7,w[E++]=O>>>26&7,w[E]=O>>>29&7})(r,e,n,s);case 4:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0;w[E++]=R>>>0&15,w[E++]=R>>>4&15,w[E++]=R>>>8&15,w[E++]=R>>>12&15,w[E++]=R>>>16&15,w[E++]=R>>>20&15,w[E++]=R>>>24&15,w[E++]=R>>>28&15,w[E++]=I>>>0&15,w[E++]=I>>>4&15,w[E++]=I>>>8&15,w[E++]=I>>>12&15,w[E++]=I>>>16&15,w[E++]=I>>>20&15,w[E++]=I>>>24&15,w[E++]=I>>>28&15,w[E++]=O>>>0&15,w[E++]=O>>>4&15,w[E++]=O>>>8&15,w[E++]=O>>>12&15,w[E++]=O>>>16&15,w[E++]=O>>>20&15,w[E++]=O>>>24&15,w[E++]=O>>>28&15,w[E++]=F>>>0&15,w[E++]=F>>>4&15,w[E++]=F>>>8&15,w[E++]=F>>>12&15,w[E++]=F>>>16&15,w[E++]=F>>>20&15,w[E++]=F>>>24&15,w[E]=F>>>28&15})(r,e,n,s);case 5:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0;w[E++]=R>>>0&31,w[E++]=R>>>5&31,w[E++]=R>>>10&31,w[E++]=R>>>15&31,w[E++]=R>>>20&31,w[E++]=R>>>25&31,w[E++]=31&(R>>>30|(7&I)<<2),w[E++]=I>>>3&31,w[E++]=I>>>8&31,w[E++]=I>>>13&31,w[E++]=I>>>18&31,w[E++]=I>>>23&31,w[E++]=31&(I>>>28|(1&O)<<4),w[E++]=O>>>1&31,w[E++]=O>>>6&31,w[E++]=O>>>11&31,w[E++]=O>>>16&31,w[E++]=O>>>21&31,w[E++]=O>>>26&31,w[E++]=31&(O>>>31|(15&F)<<1),w[E++]=F>>>4&31,w[E++]=F>>>9&31,w[E++]=F>>>14&31,w[E++]=F>>>19&31,w[E++]=F>>>24&31,w[E++]=31&(F>>>29|(3&V)<<3),w[E++]=V>>>2&31,w[E++]=V>>>7&31,w[E++]=V>>>12&31,w[E++]=V>>>17&31,w[E++]=V>>>22&31,w[E]=V>>>27&31})(r,e,n,s);case 6:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0;w[E++]=R>>>0&63,w[E++]=R>>>6&63,w[E++]=R>>>12&63,w[E++]=R>>>18&63,w[E++]=R>>>24&63,w[E++]=63&(R>>>30|(15&I)<<2),w[E++]=I>>>4&63,w[E++]=I>>>10&63,w[E++]=I>>>16&63,w[E++]=I>>>22&63,w[E++]=63&(I>>>28|(3&O)<<4),w[E++]=O>>>2&63,w[E++]=O>>>8&63,w[E++]=O>>>14&63,w[E++]=O>>>20&63,w[E++]=O>>>26&63,w[E++]=F>>>0&63,w[E++]=F>>>6&63,w[E++]=F>>>12&63,w[E++]=F>>>18&63,w[E++]=F>>>24&63,w[E++]=63&(F>>>30|(15&V)<<2),w[E++]=V>>>4&63,w[E++]=V>>>10&63,w[E++]=V>>>16&63,w[E++]=V>>>22&63,w[E++]=63&(V>>>28|(3&U)<<4),w[E++]=U>>>2&63,w[E++]=U>>>8&63,w[E++]=U>>>14&63,w[E++]=U>>>20&63,w[E]=U>>>26&63})(r,e,n,s);case 7:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0;w[E++]=R>>>0&127,w[E++]=R>>>7&127,w[E++]=R>>>14&127,w[E++]=R>>>21&127,w[E++]=127&(R>>>28|(7&I)<<4),w[E++]=I>>>3&127,w[E++]=I>>>10&127,w[E++]=I>>>17&127,w[E++]=I>>>24&127,w[E++]=127&(I>>>31|(63&O)<<1),w[E++]=O>>>6&127,w[E++]=O>>>13&127,w[E++]=O>>>20&127,w[E++]=127&(O>>>27|(3&F)<<5),w[E++]=F>>>2&127,w[E++]=F>>>9&127,w[E++]=F>>>16&127,w[E++]=F>>>23&127,w[E++]=127&(F>>>30|(31&V)<<2),w[E++]=V>>>5&127,w[E++]=V>>>12&127,w[E++]=V>>>19&127,w[E++]=127&(V>>>26|(1&U)<<6),w[E++]=U>>>1&127,w[E++]=U>>>8&127,w[E++]=U>>>15&127,w[E++]=U>>>22&127,w[E++]=127&(U>>>29|(15&j)<<3),w[E++]=j>>>4&127,w[E++]=j>>>11&127,w[E++]=j>>>18&127,w[E]=j>>>25&127})(r,e,n,s);case 8:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0;w[E++]=R>>>0&255,w[E++]=R>>>8&255,w[E++]=R>>>16&255,w[E++]=R>>>24&255,w[E++]=I>>>0&255,w[E++]=I>>>8&255,w[E++]=I>>>16&255,w[E++]=I>>>24&255,w[E++]=O>>>0&255,w[E++]=O>>>8&255,w[E++]=O>>>16&255,w[E++]=O>>>24&255,w[E++]=F>>>0&255,w[E++]=F>>>8&255,w[E++]=F>>>16&255,w[E++]=F>>>24&255,w[E++]=V>>>0&255,w[E++]=V>>>8&255,w[E++]=V>>>16&255,w[E++]=V>>>24&255,w[E++]=U>>>0&255,w[E++]=U>>>8&255,w[E++]=U>>>16&255,w[E++]=U>>>24&255,w[E++]=j>>>0&255,w[E++]=j>>>8&255,w[E++]=j>>>16&255,w[E++]=j>>>24&255,w[E++]=H>>>0&255,w[E++]=H>>>8&255,w[E++]=H>>>16&255,w[E]=H>>>24&255})(r,e,n,s);case 9:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0,X=b[S+8]>>>0;w[E++]=R>>>0&511,w[E++]=R>>>9&511,w[E++]=R>>>18&511,w[E++]=511&(R>>>27|(15&I)<<5),w[E++]=I>>>4&511,w[E++]=I>>>13&511,w[E++]=I>>>22&511,w[E++]=511&(I>>>31|(255&O)<<1),w[E++]=O>>>8&511,w[E++]=O>>>17&511,w[E++]=511&(O>>>26|(7&F)<<6),w[E++]=F>>>3&511,w[E++]=F>>>12&511,w[E++]=F>>>21&511,w[E++]=511&(F>>>30|(127&V)<<2),w[E++]=V>>>7&511,w[E++]=V>>>16&511,w[E++]=511&(V>>>25|(3&U)<<7),w[E++]=U>>>2&511,w[E++]=U>>>11&511,w[E++]=U>>>20&511,w[E++]=511&(U>>>29|(63&j)<<3),w[E++]=j>>>6&511,w[E++]=j>>>15&511,w[E++]=511&(j>>>24|(1&H)<<8),w[E++]=H>>>1&511,w[E++]=H>>>10&511,w[E++]=H>>>19&511,w[E++]=511&(H>>>28|(31&X)<<4),w[E++]=X>>>5&511,w[E++]=X>>>14&511,w[E]=X>>>23&511})(r,e,n,s);case 10:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0,X=b[S+8]>>>0,ue=b[S+9]>>>0;w[E++]=R>>>0&1023,w[E++]=R>>>10&1023,w[E++]=R>>>20&1023,w[E++]=1023&(R>>>30|(255&I)<<2),w[E++]=I>>>8&1023,w[E++]=I>>>18&1023,w[E++]=1023&(I>>>28|(63&O)<<4),w[E++]=O>>>6&1023,w[E++]=O>>>16&1023,w[E++]=1023&(O>>>26|(15&F)<<6),w[E++]=F>>>4&1023,w[E++]=F>>>14&1023,w[E++]=1023&(F>>>24|(3&V)<<8),w[E++]=V>>>2&1023,w[E++]=V>>>12&1023,w[E++]=V>>>22&1023,w[E++]=U>>>0&1023,w[E++]=U>>>10&1023,w[E++]=U>>>20&1023,w[E++]=1023&(U>>>30|(255&j)<<2),w[E++]=j>>>8&1023,w[E++]=j>>>18&1023,w[E++]=1023&(j>>>28|(63&H)<<4),w[E++]=H>>>6&1023,w[E++]=H>>>16&1023,w[E++]=1023&(H>>>26|(15&X)<<6),w[E++]=X>>>4&1023,w[E++]=X>>>14&1023,w[E++]=1023&(X>>>24|(3&ue)<<8),w[E++]=ue>>>2&1023,w[E++]=ue>>>12&1023,w[E]=ue>>>22&1023})(r,e,n,s);case 11:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0,X=b[S+8]>>>0,ue=b[S+9]>>>0,he=b[S+10]>>>0;w[E++]=R>>>0&2047,w[E++]=R>>>11&2047,w[E++]=2047&(R>>>22|(1&I)<<10),w[E++]=I>>>1&2047,w[E++]=I>>>12&2047,w[E++]=2047&(I>>>23|(3&O)<<9),w[E++]=O>>>2&2047,w[E++]=O>>>13&2047,w[E++]=2047&(O>>>24|(7&F)<<8),w[E++]=F>>>3&2047,w[E++]=F>>>14&2047,w[E++]=2047&(F>>>25|(15&V)<<7),w[E++]=V>>>4&2047,w[E++]=V>>>15&2047,w[E++]=2047&(V>>>26|(31&U)<<6),w[E++]=U>>>5&2047,w[E++]=U>>>16&2047,w[E++]=2047&(U>>>27|(63&j)<<5),w[E++]=j>>>6&2047,w[E++]=j>>>17&2047,w[E++]=2047&(j>>>28|(127&H)<<4),w[E++]=H>>>7&2047,w[E++]=H>>>18&2047,w[E++]=2047&(H>>>29|(255&X)<<3),w[E++]=X>>>8&2047,w[E++]=X>>>19&2047,w[E++]=2047&(X>>>30|(511&ue)<<2),w[E++]=ue>>>9&2047,w[E++]=ue>>>20&2047,w[E++]=2047&(ue>>>31|(1023&he)<<1),w[E++]=he>>>10&2047,w[E]=he>>>21&2047})(r,e,n,s);case 12:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0,X=b[S+8]>>>0,ue=b[S+9]>>>0,he=b[S+10]>>>0,be=b[S+11]>>>0;w[E++]=R>>>0&4095,w[E++]=R>>>12&4095,w[E++]=4095&(R>>>24|(15&I)<<8),w[E++]=I>>>4&4095,w[E++]=I>>>16&4095,w[E++]=4095&(I>>>28|(255&O)<<4),w[E++]=O>>>8&4095,w[E++]=O>>>20&4095,w[E++]=F>>>0&4095,w[E++]=F>>>12&4095,w[E++]=4095&(F>>>24|(15&V)<<8),w[E++]=V>>>4&4095,w[E++]=V>>>16&4095,w[E++]=4095&(V>>>28|(255&U)<<4),w[E++]=U>>>8&4095,w[E++]=U>>>20&4095,w[E++]=j>>>0&4095,w[E++]=j>>>12&4095,w[E++]=4095&(j>>>24|(15&H)<<8),w[E++]=H>>>4&4095,w[E++]=H>>>16&4095,w[E++]=4095&(H>>>28|(255&X)<<4),w[E++]=X>>>8&4095,w[E++]=X>>>20&4095,w[E++]=ue>>>0&4095,w[E++]=ue>>>12&4095,w[E++]=4095&(ue>>>24|(15&he)<<8),w[E++]=he>>>4&4095,w[E++]=he>>>16&4095,w[E++]=4095&(he>>>28|(255&be)<<4),w[E++]=be>>>8&4095,w[E]=be>>>20&4095})(r,e,n,s);case 16:return void(function(b,S,w,A){let E=A,R=b[S]>>>0,I=b[S+1]>>>0,O=b[S+2]>>>0,F=b[S+3]>>>0,V=b[S+4]>>>0,U=b[S+5]>>>0,j=b[S+6]>>>0,H=b[S+7]>>>0,X=b[S+8]>>>0,ue=b[S+9]>>>0,he=b[S+10]>>>0,be=b[S+11]>>>0,ge=b[S+12]>>>0,Me=b[S+13]>>>0,Ee=b[S+14]>>>0,we=b[S+15]>>>0;w[E++]=R>>>0&65535,w[E++]=R>>>16&65535,w[E++]=I>>>0&65535,w[E++]=I>>>16&65535,w[E++]=O>>>0&65535,w[E++]=O>>>16&65535,w[E++]=F>>>0&65535,w[E++]=F>>>16&65535,w[E++]=V>>>0&65535,w[E++]=V>>>16&65535,w[E++]=U>>>0&65535,w[E++]=U>>>16&65535,w[E++]=j>>>0&65535,w[E++]=j>>>16&65535,w[E++]=H>>>0&65535,w[E++]=H>>>16&65535,w[E++]=X>>>0&65535,w[E++]=X>>>16&65535,w[E++]=ue>>>0&65535,w[E++]=ue>>>16&65535,w[E++]=he>>>0&65535,w[E++]=he>>>16&65535,w[E++]=be>>>0&65535,w[E++]=be>>>16&65535,w[E++]=ge>>>0&65535,w[E++]=ge>>>16&65535,w[E++]=Me>>>0&65535,w[E++]=Me>>>16&65535,w[E++]=Ee>>>0&65535,w[E++]=Ee>>>16&65535,w[E++]=we>>>0&65535,w[E]=we>>>16&65535})(r,e,n,s);case 32:for(let b=0;b<32;b=b+1|0)n[s+b|0]=0|r[e+b|0];return}let d=M_[c]>>>0,m=e,_=0,x=r[m]>>>0;for(let b=0;b<32;b++)if(_+c<=32)n[s+b]=x>>>_&d,_+=c,_===32&&(_=0,m++,b!==31&&(x=r[m]>>>0));else{let S=32-_,w=x>>>_;m++,x=r[m]>>>0,n[s+b]=(w|(x&M_[c-S]>>>0)<<S)&d,_=c-S}}function Qn(r,e,n){let s=new Uint32Array(n),c=0,d=e.get();for(let m=0;m<s.length;m++){let _=r[d++],x=127&_;_<128||(_=r[d++],x|=(127&_)<<7,_<128||(_=r[d++],x|=(127&_)<<14,_<128||(_=r[d++],x|=(127&_)<<21,_<128||(_=r[d++],x|=(15&_)<<28)))),s[c++]=x}return e.set(d),s}function Ju(r,e,n){let s=new BigUint64Array(n);for(let c=0;c<s.length;c++)s[c]=ZM(r,e);return s}function ZM(r,e){let n=0n,s=0,c=e.get();for(;c<r.length;){let d=r[c++];if(n|=BigInt(127&d)<<BigInt(s),!(128&d))break;if(s+=7,s>=64)throw new Error("Varint too long")}return e.set(c),n}function HM(r,e){let n,s;return s=r[e.get()],e.increment(),n=127&s,s<128?n:(s=r[e.get()],e.increment(),n|=(127&s)<<7,s<128?n:(s=r[e.get()],e.increment(),n|=(127&s)<<14,s<128?n:(s=r[e.get()],e.increment(),n|=(127&s)<<21,s<128?n:(s=r[e.get()],n|=(15&s)<<28,(function(c,d,m){let _,x;if(x=d[m.get()],m.increment(),_=(112&x)>>4,x<128||(x=d[m.get()],m.increment(),_|=(127&x)<<3,x<128)||(x=d[m.get()],m.increment(),_|=(127&x)<<10,x<128)||(x=d[m.get()],m.increment(),_|=(127&x)<<17,x<128)||(x=d[m.get()],m.increment(),_|=(127&x)<<24,x<128)||(x=d[m.get()],m.increment(),_|=(1&x)<<31,x<128))return 4294967296*_+(c>>>0);throw new Error("Expected varint not more than 10 bytes")})(n,r,e)))))}function Xt(r){return r>>>1^-(1&r)}function hr(r){return r>>1n^-(1n&r)}function eh(r){return r%2==1?(r+1)/-2:r/2}function A_(r,e,n){if(n===void 0){n=0;for(let d=0;d<e;d++)n+=r[d]}let s=new Uint32Array(n),c=0;for(let d=0;d<e;d++){let m=r[d];s.fill(r[d+e],c,c+m),c+=m}return s}function z_(r,e,n){if(n===void 0){n=0;for(let d=0;d<e;d++)n+=Number(r[d])}let s=new BigUint64Array(n),c=0;for(let d=0;d<e;d++){let m=Number(r[d]);s.fill(r[d+e],c,c+m),c+=m}return s}function S2(r,e,n){let s=new Float64Array(n),c=0;for(let d=0;d<e;d++){let m=r[d];s.fill(r[d+e],c,c+m),c+=m}return s}function M2(r){let e=new Int32Array(r.length);e[0]=Xt(r[0]);let n=r.length/4*4,s=1;if(n>=4)for(;s<n-4;s+=4){let c=r[s+1],d=r[s+2],m=r[s+3];e[s]=Xt(r[s])+e[s-1],e[s+1]=Xt(c)+e[s],e[s+2]=Xt(d)+e[s+1],e[s+3]=Xt(m)+e[s+2]}for(;s!==r.length;++s)e[s]=Xt(r[s])+e[s-1];return e}function E2(r){let e=new BigInt64Array(r.length);e[0]=hr(r[0]);let n=r.length/4*4,s=1;if(n>=4)for(;s<n-4;s+=4){let c=r[s+1],d=r[s+2],m=r[s+3];e[s]=hr(r[s])+e[s-1],e[s+1]=hr(c)+e[s],e[s+2]=hr(d)+e[s+1],e[s+3]=hr(m)+e[s+2]}for(;s!==e.length;++s)e[s]=hr(r[s])+e[s-1];return e}function D_(r){let e=r.length/4*4,n=1;if(e>=4)for(let s=r[0];n<e-4;n+=4)s=r[n]+=s,s=r[n+1]+=s,s=r[n+2]+=s,s=r[n+3]+=s;for(;n!==r.length;)r[n]+=r[n-1],++n}var Ln,Va,xc,Lr,fi,hn,C2,nl;function dr(r,e){let n=(function(s,c){let d=s[c.get()],m=Object.values(Ln)[d>>4],_=null;switch(m){case Ln.DATA:_={dictionaryType:Object.values(Va)[15&d]};break;case Ln.OFFSET:_={offsetType:Object.values(xc)[15&d]};break;case Ln.LENGTH:_={lengthType:Object.values(Lr)[15&d]}}c.increment();let x=s[c.get()],b=Object.values(vt)[x>>5],S=Object.values(vt)[x>>2&7],w=Object.values(il)[3&x];c.increment();let A=Qn(s,c,2),E=A[0];return{physicalStreamType:m,logicalStreamType:_,logicalLevelTechnique1:b,logicalLevelTechnique2:S,physicalLevelTechnique:w,numValues:E,byteLength:A[1],decompressedCount:E}})(r,e);return n.logicalLevelTechnique1===vt.MORTON?(function(s,c,d){let m=Qn(c,d,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:s.decompressedCount,numBits:m[0],coordinateShift:m[1]}})(n,r,e):vt.RLE!==n.logicalLevelTechnique1&&vt.RLE!==n.logicalLevelTechnique2||il.NONE===n.physicalLevelTechnique?n:(function(s,c,d){let m=Qn(c,d,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:m[1],runs:m[0],numRleValues:m[1]}})(n,r,e)}(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(Ln||(Ln={})),(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(Va||(Va={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(xc||(xc={})),(function(r){r.VAR_BINARY="VAR_BINARY",r.GEOMETRIES="GEOMETRIES",r.PARTS="PARTS",r.RINGS="RINGS",r.TRIANGLES="TRIANGLES",r.SYMBOL="SYMBOL",r.DICTIONARY="DICTIONARY"})(Lr||(Lr={})),(function(r){r[r.FLAT=0]="FLAT",r[r.CONST=1]="CONST",r[r.SEQUENCE=2]="SEQUENCE",r[r.DICTIONARY=3]="DICTIONARY",r[r.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(fi||(fi={}));class ja{constructor(e,n){this.values=e,this._size=n}get(e){let n=Math.floor(e/8);return(this.values[n]>>e%8&1)==1}set(e,n){let s=Math.floor(e/8);this.values[s]=this.values[s]|(n?1:0)<<e%8}getInt(e){let n=Math.floor(e/8);return this.values[n]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function th(r,e,n){if(!e)return r;let s=e.size(),c=new r.constructor(s),d=0;for(let m=0;m<s;m++)c[m]=e.get(m)?r[d++]:n;return c}function P_(r,e,n,s,c){return(function(d,m,_,x){let b;switch(m.logicalLevelTechnique1){case vt.DELTA:if(m.logicalLevelTechnique2===vt.RLE){let S=m;if(!x)return(function(w,A,E){let R=new Int32Array(E),I=0,O=0;for(let F=0;F<A;F++){let V=w[F],U=Xt(w[F+A]);for(let j=0;j<V;j++)O+=U,R[I++]=O}return R})(d,S.runs,S.numRleValues);b=M2(d=A_(d,S.runs,S.numRleValues))}else b=M2(d);break;case vt.RLE:b=(function(S,w,A){if(A===void 0){A=0;for(let I=0;I<w;I++)A+=S[I]}let E=new Int32Array(A),R=0;for(let I=0;I<w;I++){let O=S[I],F=S[I+w];F=Xt(F),E.fill(F,R,R+O),R+=O}return E})(d,m.runs,m.numRleValues);break;case vt.MORTON:D_(d),b=new Int32Array(d);break;case vt.COMPONENTWISE_DELTA:b=(function(S){if(S.length<2)return new Int32Array(S);let w=new Int32Array(S.length);w[0]=Xt(S[0]),w[1]=Xt(S[1]);let A=S.length/4*4,E=2;if(A>=4)for(;E<A-4;E+=4){let R=S[E+1],I=S[E+2],O=S[E+3];w[E]=Xt(S[E])+w[E-2],w[E+1]=Xt(R)+w[E-1],w[E+2]=Xt(I)+w[E],w[E+3]=Xt(O)+w[E+1]}for(;E!==S.length;E+=2)w[E]=Xt(S[E])+w[E-2],w[E+1]=Xt(S[E+1])+w[E-1];return w})(d);break;case vt.NONE:b=(function(S){let w=new Int32Array(S.length);for(let A=0;A<S.length;A++)w[A]=Xt(S[A]);return w})(d);break;default:throw new Error(`The specified Logical level technique is not supported: ${m.logicalLevelTechnique1}`)}return x?th(b,x,0):b})(ih(r,e,n),n,0,c)}function Or(r,e,n,s,c){return(function(d,m,_,x){let b;switch(m.logicalLevelTechnique1){case vt.DELTA:b=(function(S){let w=new Uint32Array(S.length);w[0]=Xt(S[0])>>>0;for(let A=1;A<S.length;A++)w[A]=w[A-1]+Xt(S[A])>>>0;return w})(m.logicalLevelTechnique2===vt.RLE?A_(d,m.runs,m.numRleValues):d);break;case vt.RLE:b=A_(d,m.runs,m.numRleValues);break;case vt.MORTON:D_(d),b=d;break;case vt.COMPONENTWISE_DELTA:b=(function(S){if(S.length<2)return new Uint32Array(S);let w=new Uint32Array(S.length);w[0]=Xt(S[0])>>>0,w[1]=Xt(S[1])>>>0;for(let A=2;A<S.length;A+=2)w[A]=w[A-2]+Xt(S[A])>>>0,w[A+1]=w[A-1]+Xt(S[A+1])>>>0;return w})(d);break;case vt.NONE:b=d;break;default:throw new Error(`The specified Logical level technique is not supported: ${m.logicalLevelTechnique1}`)}return x?th(b,x,0):b})(ih(r,e,n),n,0,c)}function rl(r,e,n){return(function(s,c){if(c.logicalLevelTechnique1===vt.DELTA&&c.logicalLevelTechnique2===vt.NONE)return(function(d){let m=new Int32Array(d.length+1);m[0]=0,m[1]=Xt(d[0]);let _=m[1];for(let x=2;x!==m.length;++x)_+=Xt(d[x-1]),m[x]=m[x-1]+_;return new Uint32Array(m)})(s);if(c.logicalLevelTechnique1===vt.RLE&&c.logicalLevelTechnique2===vt.NONE)return(function(d,m,_){let x=new Uint32Array(_+1);x[0]=0;let b=1,S=x[0];for(let w=0;w<m;w++){let A=d[w],E=d[w+m];for(let R=b;R<b+A;R++)x[R]=E+S,S=x[R];b+=A}return x})(s,c.runs,c.numRleValues);if(c.logicalLevelTechnique1===vt.NONE&&c.logicalLevelTechnique2===vt.NONE){(function(m){let _=0;for(let x=0;x<m.length;x++)m[x]+=_,_=m[x]})(s);let d=new Uint32Array(c.numValues+1);return d[0]=0,d.set(s,1),d}if(c.logicalLevelTechnique1===vt.DELTA&&c.logicalLevelTechnique2===vt.RLE){let d=(function(m,_,x){let b=new Int32Array(x+1);b[0]=0;let S=1,w=b[0];for(let A=0;A<_;A++){let E=m[A],R=m[A+_];R=Xt(R);for(let I=S;I<S+E;I++)b[I]=R+w,w=b[I];S+=E}return b})(s,c.runs,c.numRleValues);return D_(d),new Uint32Array(d)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(ih(r,e,n),n)}function ih(r,e,n){let s=n.physicalLevelTechnique;switch(s){case il.FAST_PFOR:return(function(c,d,m,_){return(function(x,b,S,w,A){let E=w.get();if(3&S)throw new Error(`FastPFOR: invalid encodedByteLength=${S} at offset=${E} (encodedBytes.length=${x.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let R=S>>>2,I=(function(F,V){if(V<=F.encodedWords.length)return F.encodedWords;let U=new Uint32Array(Math.max(16,2*V));return F.encodedWords=U,U})(A,R);(function(F,V,U,j){if(V<0||U<0||V+U>F.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${V}, byteLength=${U}, bytes.length=${F.length})`);let H=Math.floor(U/4),X=U%4!=0,ue=X?H+1:H;if(j.length<ue)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${j.length} < ${ue}`);if(H>0){let he=F.byteOffset+V;if(3&he)for(let be=0;be<H;be++){let ge=V+4*be;j[be]=F[ge]<<24|F[ge+1]<<16|F[ge+2]<<8|F[ge+3]}else{let be=new Uint32Array(F.buffer,he,H);for(let ge=0;ge<H;ge++)j[ge]=0|FM(be[ge])}}if(X){let he=V+4*H,be=U-4*H,ge=0;for(let Me=0;Me<be;Me++)ge|=F[he+Me]<<24-8*Me;j[H]=0|ge}})(x,E,S,I);let O=(function(F,V,U){let j=0,H=0,X=new Uint32Array(V),ue=U??T2();if(F.length>0){let he=0|F[j];if(j=j+1|0,255&he)throw new Error(`FastPFOR decode: invalid alignedLength=${he} (expected multiple of 256)`);if(H+he>X.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${H}, alignedLength=${he}, out.length=${X.length})`);j=(function(be,ge,Me,Ee,we,_e){let Fe=Ee+E_(we,is),Ge=Ee,je=Me;for(;Ge!==Fe;){let Ne=Math.min(C_,Fe-Ge);je=qM(be,ge,je,Ge,Ne,_e),Ge=Ge+Ne|0}return je})(F,X,j,H,he,ue),H=H+he|0}return(function(he,be,ge,Me,Ee,we){if(we===0)return be;let _e=0,Fe=be,Ge=be+ge,je=Ee,Ne=Ee,at=Ee+we,Mt=0,Pt=0;for(;Fe<Ge&&Ne<at;){let Ht=he[Fe]>>>_e&255;if(_e+=8,Fe+=_e>>>5,_e&=31,Mt|=(127&Ht)<<Pt,128&Ht)Me[Ne++]=0|Mt,Mt=0,Pt=0;else if(Pt+=7,Pt>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${Pt}, partial=${Mt}, decoded=${Ne-je}/${we}, inPos=${Fe}, inEnd=${Ge})`)}if(Ne!==at)throw new Error(`FastPFOR VByte: truncated stream (decoded=${Ne-je}, expected=${we}, consumedWords=${Fe-be}/${ge}, vbyteStart=${be}, vbyteEnd=${Ge})`)})(F,j,F.length-j|0,X,H,V-H|0),X})(I.subarray(0,R),b,A.decoderWorkspace);return w.add(S),O})(c,d,m,_,(function(x=16){if(x<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${x}`);let b=Math.max(16,0|x);return{encodedWords:new Uint32Array(b),decoderWorkspace:T2()}})(m>>>2))})(r,n.numValues,n.byteLength,e);case il.VARINT:return Qn(r,e,n.numValues);case il.NONE:{let c=e.get();e.add(n.byteLength);let d=r.subarray(c,e.get());return new Uint32Array(d)}default:throw new Error(`Specified physicalLevelTechnique ${s} is not supported (yet).`)}}function R_(r,e,n){let s=ih(r,e,n);return s.length===1?s[0]:(function(c){return c[1]})(s)}function A2(r,e,n){return(function(s){if(s.length===2){let c=Xt(s[1]);return[c,c]}return[Xt(s[2]),Xt(s[3])]})(ih(r,e,n))}function z2(r,e,n){return(function(s){if(s.length===2){let c=hr(s[1]);return[c,c]}return[hr(s[2]),hr(s[3])]})(Ju(r,e,n.numValues))}function D2(r,e,n,s){return(function(c,d,m){let _;switch(d.logicalLevelTechnique1){case vt.DELTA:_=(function(x){let b=new BigUint64Array(x.length);b[0]=BigInt.asUintN(64,hr(x[0]));for(let S=1;S<x.length;S++)b[S]=BigInt.asUintN(64,b[S-1]+hr(x[S]));return b})(d.logicalLevelTechnique2===vt.RLE?z_(c,d.runs,d.numRleValues):c);break;case vt.RLE:_=z_(c,d.runs,d.numRleValues);break;case vt.NONE:_=c;break;default:throw new Error(`The specified Logical level technique is not supported: ${d.logicalLevelTechnique1}`)}return m?th(_,m,0n):_})(Ju(r,e,n.numValues),n,s)}function P2(r,e,n){let s=Ju(r,e,n.numValues);return s.length===1?s[0]:(function(c){return c[1]})(s)}function s0(r,e,n,s,c="int32"){let d=r.logicalLevelTechnique1;if(d===vt.RLE)return r.runs===1?fi.CONST:fi.FLAT;if(d!==vt.DELTA||r.logicalLevelTechnique2!==vt.RLE)return r.numValues===1?fi.CONST:fi.FLAT;let m=e instanceof ja?e.size():e;if(r.numRleValues!==m)return fi.FLAT;if(r.runs===1)return fi.SEQUENCE;if(r.runs!==2)return r.numValues===1?fi.CONST:fi.FLAT;let _=s.get();if(r.physicalLevelTechnique===il.VARINT)return(function(S,w,A){let E=new w2(w.get());if(A==="int64"){let I=Ju(S,E,4);return I[2]===2n&&I[3]===2n}let R=Qn(S,E,4);return R[2]===2&&R[3]===2})(n,s,c)?fi.SEQUENCE:r.numValues===1?fi.CONST:fi.FLAT;let x=s.get(),b=new Int32Array(n.buffer,n.byteOffset+x,4);return s.set(_),b[2]===2&&b[3]===2?fi.SEQUENCE:r.numValues===1?fi.CONST:fi.FLAT}class R2 extends o0{getValueFromBuffer(e){return this.dataBuffer[e]}}class I2 extends x2{constructor(e,n,s,c){super(e,BigInt64Array.of(n),s,c)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function I_(r,e,n){return{x:k2(r,e)-n,y:k2(r>>1,e)-n}}function k2(r,e){let n=0;for(let s=0;s<e;s++)n|=(r&1<<2*s)>>s;return n}function nh(r,e,n,s,c,d,m){return r===nl.MORTON?(function(_,x,b,S,w,A){let E=new Array(w?S+1:S);for(let R=0;R<S;R++){let I=I_(_[x[b+R]],A.numBits,A.coordinateShift);E[R]=new D(I.x,I.y)}return w&&(E[E.length-1]=E[0]),E})(e,n,s,c,d,m):(function(_,x,b,S,w){let A=new Array(w?S+1:S);for(let E=0;E<2*S;E+=2){let R=2*x[b+E/2];A[E/2]=new D(_[R],_[R+1])}return w&&(A[A.length-1]=A[0]),A})(e,n,s,c,d)}function rh(r,e,n,s){let c=new Array(s?n+1:n);for(let d=0;d<2*n;d+=2)c[d/2]=new D(r[e+d],r[e+d+1]);return s&&(c[c.length-1]=c[0]),c}(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON",r[r.MULTIPOINT=3]="MULTIPOINT",r[r.MULTILINESTRING=4]="MULTILINESTRING",r[r.MULTIPOLYGON=5]="MULTIPOLYGON"})(hn||(hn={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(C2||(C2={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(nl||(nl={}));class L2{constructor(e,n,s,c,d){this._vertexBufferType=e,this._topologyVector=n,this._vertexOffsets=s,this._vertexBuffer=c,this._mortonSettings=d}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let n=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[n],this.vertexBuffer[n+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let s=I_(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[s.x,s.y]}let n=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[n],this.vertexBuffer[n+1]]}getGeometries(){return(function(e){let n=new Array(e.numGeometries),s=1,c=1,d=1,m=0,_=0,x=0,b=e.mortonSettings,S=e.topologyVector,w=S.geometryOffsets,A=S.partOffsets,E=S.ringOffsets,R=e.vertexOffsets,I=!R||R.length===0,O=e.containsPolygonGeometry(),F=e.vertexBuffer;for(let V=0;V<e.numGeometries;V++)switch(e.geometryType(V)){case hn.POINT:{let U,j;if(I)U=F[_++],j=F[_++];else if(e.vertexBufferType===nl.MORTON){let H=I_(F[R[x++]],b.numBits,b.coordinateShift);U=H.x,j=H.y}else{let H=2*R[x++];U=F[H],j=F[H+1]}n[m++]=[[new D(U,j)]],w&&d++,A&&s++,E&&c++}break;case hn.MULTIPOINT:{let U=w[d]-w[d-1];d++;let j=new Array(U);if(I)for(let H=0;H<U;H++){let X=F[_++],ue=F[_++];j[H]=new D(X,ue)}else for(let H=0;H<U;H++){let X=2*R[x++];j[H]=new D(F[X],F[X+1])}n[m++]=j.map((H=>[H])),s+=U,c+=U}break;case hn.LINESTRING:{let U,j;O?(U=E[c]-E[c-1],c++):U=A[s]-A[s-1],s++,I?(j=rh(F,_,U,!1),_+=2*U):(j=nh(e.vertexBufferType,F,R,x,U,!1,b),x+=U),n[m++]=[j],w&&d++}break;case hn.POLYGON:{let U=A[s]-A[s-1];s++;let j=new Array(U-1),H,X=E[c]-E[c-1];if(c++,I){H=rh(F,_,X,!0),_+=2*X;for(let ue=0;ue<j.length;ue++)X=E[c]-E[c-1],c++,j[ue]=rh(F,_,X,!0),_+=2*X}else{H=nh(e.vertexBufferType,F,R,x,X,!0,b),x+=X;for(let ue=0;ue<j.length;ue++)X=E[c]-E[c-1],c++,j[ue]=nh(e.vertexBufferType,F,R,x,X,!0,b),x+=X}n[m++]=[H].concat(j),w&&d++}break;case hn.MULTILINESTRING:{let U=w[d]-w[d-1];d++;let j=new Array(U);for(let H=0;H<U;H++){let X;if(O?(X=E[c]-E[c-1],c++):X=A[s]-A[s-1],s++,I)j[H]=rh(F,_,X,!1),_+=2*X;else{let ue=nh(e.vertexBufferType,F,R,x,X,!1,b);j[H]=ue,x+=X}}n[m++]=j}break;case hn.MULTIPOLYGON:{let U=w[d]-w[d-1];d++;let j=new Array(U);for(let H=0;H<U;H++){let X=A[s]-A[s-1],ue;s++;let he=new Array(X-1),be=E[c]-E[c-1];c++,I?(ue=rh(F,_,be,!0),_+=2*be):(ue=nh(e.vertexBufferType,F,R,x,be,!0,b),x+=be);for(let ge=0;ge<he.length;ge++){let Me=E[c]-E[c-1];c++,I?(he[ge]=rh(F,_,Me,!0),_+=2*Me):(he[ge]=nh(e.vertexBufferType,F,R,x,Me,!0,b),x+=Me)}j[H]=[ue].concat(he)}n[m++]=j.flat()}break;default:throw new Error("The specified geometry type is currently not supported.")}return n})(this)}get mortonSettings(){return this._mortonSettings}}class O2 extends L2{constructor(e,n,s,c,d,m,_){super(s,c,d,m,_),this._numGeometries=e,this._geometryType=n}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===hn.POLYGON||this._geometryType===hn.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class B2 extends L2{constructor(e,n,s,c,d,m){super(e,s,c,d,m),this._geometryTypes=n}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===hn.POLYGON||this.geometryType(e)===hn.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class F2{constructor(e,n,s,c){this._triangleOffsets=e,this._indexBuffer=n,this._vertexBuffer=s,this._topologyVector=c}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");let e=new Array(this.numGeometries),n=this._topologyVector,s=n.partOffsets,c=n.ringOffsets,d=n.geometryOffsets,m=0,_=1,x=1,b=1;for(let S=0;S<this.numGeometries;S++)switch(this.geometryType(S)){case hn.POLYGON:{let w=s[_]-s[_-1];_++;let A=[];for(let E=0;E<w;E++){let R=c[x]-c[x-1];x++;let I=[];for(let O=0;O<R;O++){let F=this._vertexBuffer[m++],V=this._vertexBuffer[m++];I.push(new D(F,V))}I.length>0&&I.push(I[0]),A.push(I)}e[S]=A,d&&b++}break;case hn.MULTIPOLYGON:{let w=d[b]-d[b-1];b++;let A=[];for(let E=0;E<w;E++){let R=s[_]-s[_-1];_++;for(let I=0;I<R;I++){let O=c[x]-c[x-1];x++;let F=[];for(let V=0;V<O;V++){let U=this._vertexBuffer[m++],j=this._vertexBuffer[m++];F.push(new D(U,j))}F.length>0&&F.push(F[0]),A.push(F)}}e[S]=A}}return e}[Symbol.iterator](){return null}}function N2(r,e,n,s,c,d){return new $M(r,e,n,s,c,d)}class $M extends F2{constructor(e,n,s,c,d,m){super(s,c,d,m),this._numGeometries=e,this._geometryType=n}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function U2(r,e,n,s,c){return new XM(r,e,n,s,c)}class XM extends F2{constructor(e,n,s,c,d){super(n,s,c,d),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function YM(r,e,n,s,c){let d=dr(r,n),m,_,x,b;if(s0(d,s,r,n)===fi.CONST){let V=R_(r,n,d),U,j,H,X;for(let ue=0;ue<e-1;ue++){let he=dr(r,n);switch(he.physicalStreamType){case Ln.LENGTH:switch(he.logicalStreamType.lengthType){case Lr.GEOMETRIES:U=rl(r,n,he);break;case Lr.PARTS:j=rl(r,n,he);break;case Lr.RINGS:H=rl(r,n,he);break;case Lr.TRIANGLES:X=rl(r,n,he)}break;case Ln.OFFSET:switch(he.logicalStreamType.offsetType){case xc.VERTEX:m=Or(r,n,he);break;case xc.INDEX:b=Or(r,n,he)}break;case Ln.DATA:Va.VERTEX===he.logicalStreamType.dictionaryType?_=P_(r,n,he):(x={numBits:he.numBits,coordinateShift:he.coordinateShift},_=Or(r,n,he))}}return b?U!==void 0||j!==void 0?N2(s,V,X,b,_,{geometryOffsets:U,partOffsets:j,ringOffsets:H}):N2(s,V,X,b,_):x===void 0?(function(ue,he,be,ge,Me){return new O2(ue,he,nl.VEC_2,be,ge,Me)})(s,V,{geometryOffsets:U,partOffsets:j,ringOffsets:H},m,_):(function(ue,he,be,ge,Me,Ee){return new O2(ue,he,nl.MORTON,be,ge,Me,Ee)})(s,V,{geometryOffsets:U,partOffsets:j,ringOffsets:H},m,_,x)}let S=Or(r,n,d),w,A,E,R,I,O,F;for(let V=0;V<e-1;V++){let U=dr(r,n);switch(U.physicalStreamType){case Ln.LENGTH:switch(U.logicalStreamType.lengthType){case Lr.GEOMETRIES:w=Or(r,n,U);break;case Lr.PARTS:A=Or(r,n,U);break;case Lr.RINGS:E=Or(r,n,U);break;case Lr.TRIANGLES:R=rl(r,n,U)}break;case Ln.OFFSET:switch(U.logicalStreamType.offsetType){case xc.VERTEX:m=Or(r,n,U);break;case xc.INDEX:b=Or(r,n,U)}break;case Ln.DATA:Va.VERTEX===U.logicalStreamType.dictionaryType?_=P_(r,n,U):(x={numBits:U.numBits,coordinateShift:U.coordinateShift},_=Or(r,n,U))}}return w?(I=k_(S,w,2),A&&E?(O=V2(S,I,A,!1),F=(function(V,U,j,H){let X=new Uint32Array(j[j.length-1]+1),ue=0;X[0]=ue;let he=1,be=1,ge=0;for(let Me=0;Me<V.length;Me++){let Ee=V[Me],we=U[Me+1]-U[Me];if(Ee!==0&&Ee!==3)for(let _e=0;_e<we;_e++){let Fe=j[he]-j[he-1];he++;for(let Ge=0;Ge<Fe;Ge++)ue=X[be++]=ue+H[ge++]}else for(let _e=0;_e<we;_e++)X[be++]=++ue,he++}return X})(S,I,O,E)):A&&(O=(function(V,U,j){let H=new Uint32Array(U[U.length-1]+1),X=0;H[0]=X;let ue=1,he=0;for(let be=0;be<V.length;be++){let ge=V[be],Me=U[be+1]-U[be];if(ge===4||ge===1)for(let Ee=0;Ee<Me;Ee++)X=H[ue++]=X+j[he++];else for(let Ee=0;Ee<Me;Ee++)H[ue++]=++X}return H})(S,I,A))):A&&E?(O=k_(S,A,1),F=V2(S,O,E,!0)):A&&(O=k_(S,A,0)),b&&!O?U2(S,R,b,_):b?U2(S,R,b,_,{geometryOffsets:I,partOffsets:O,ringOffsets:F}):x===void 0?(function(V,U,j,H){return new B2(nl.VEC_2,V,U,j,H)})(S,{geometryOffsets:I,partOffsets:O,ringOffsets:F},m,_):(function(V,U,j,H,X){return new B2(nl.MORTON,V,U,j,H,X)})(S,{geometryOffsets:I,partOffsets:O,ringOffsets:F},m,_,x)}function k_(r,e,n){let s=new Uint32Array(r.length+1),c=0;s[0]=c;let d=0;for(let m=0;m<r.length;m++)c=s[m+1]=c+(r[m]>n?e[d++]:1);return s}function V2(r,e,n,s){let c=new Uint32Array(e[e.length-1]+1),d=0;c[0]=d;let m=1,_=0;for(let x=0;x<r.length;x++){let b=r[x],S=e[x+1]-e[x];if(b===5||b===2||s&&(b===4||b===1))for(let w=0;w<S;w++)d=c[m++]=d+n[_++];else for(let w=0;w<S;w++)c[m++]=++d}return c}class WM extends Qu{constructor(e,n,s){super(e,n.getBuffer(),s),this.dataVector=n}getValueFromBuffer(e){return this.dataVector.get(e)}}class KM extends o0{getValueFromBuffer(e){return this.dataBuffer[e]}}class j2 extends Qu{constructor(e,n,s,c){super(e,c?BigInt64Array.of(n):BigUint64Array.of(n),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}function Tp(r,e,n,s,c){let d=(function(m,_,x,b){let S=new Uint8Array(_),w=0,A=b.get()+x;for(;w<_&&!(b.get()>=A);){let E=m[b.increment()];if(E<=127){let R=E+3,I=m[b.increment()],O=Math.min(w+R,_);S.fill(I,w,O),w=O}else{let R=256-E;for(let I=0;I<R&&w<_;I++)S[w++]=m[b.increment()]}}return b.set(A),S})(r,Math.ceil(e/8),n,s);return c?(function(m,_,x){if(!x)return m;let b=x.size(),S=new ja(m,_),w=new ja(new Uint8Array(Math.ceil(b/8)),b),A=0;for(let E=0;E<b;E++){let R=!!x.get(E)&&S.get(A++);w.set(E,R)}return w.getBuffer()})(d,e,c):d}let QM=new TextDecoder;function L_(r,e,n){return n-e>=12?QM.decode(r.subarray(e,n)):(function(s,c,d){let m="",_=c;for(;_<d;){let x=s[_],b,S,w,A=null,E=x>239?4:x>223?3:x>191?2:1;if(_+E>d)break;E===1?x<128&&(A=x):E===2?(b=s[_+1],(192&b)==128&&(A=(31&x)<<6|63&b,A<=127&&(A=null))):E===3?(b=s[_+1],S=s[_+2],(192&b)==128&&(192&S)==128&&(A=(15&x)<<12|(63&b)<<6|63&S,(A<=2047||A>=55296&&A<=57343)&&(A=null))):E===4&&(b=s[_+1],S=s[_+2],w=s[_+3],(192&b)==128&&(192&S)==128&&(192&w)==128&&(A=(15&x)<<18|(63&b)<<12|(63&S)<<6|63&w,(A<=65535||A>=1114112)&&(A=null))),A===null?(A=65533,E=1):A>65535&&(A-=65536,m+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),m+=String.fromCharCode(A),_+=E}return m})(r,e,n)}class O_ extends Qu{constructor(e,n,s,c){super(e,s,c),this.offsetBuffer=n}}class q2 extends O_{constructor(e,n,s,c){super(e,n,s,c??n.length-1)}getValueFromBuffer(e){return L_(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class ah extends O_{constructor(e,n,s,c,d){super(e,s,c,d??n.length),this.indexBuffer=n,this.indexBuffer=n}getValueFromBuffer(e){let n=this.indexBuffer[e];return L_(this.dataBuffer,this.offsetBuffer[n],this.offsetBuffer[n+1])}}class G2 extends O_{constructor(e,n,s,c,d,m,_){super(e,s,c,_),this.indexBuffer=n,this.symbolOffsetBuffer=d,this.symbolTableBuffer=m}getValueFromBuffer(e){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=(function(s,c,d){let m=[],_=new Array(c.length).fill(0);for(let x=1;x<c.length;x++)_[x]=_[x-1]+c[x-1];for(let x=0;x<d.length;x++)if(d[x]===255)m.push(d[++x]);else{let b=c[d[x]],S=_[d[x]];for(let w=0;w<b;w++)m.push(s[S+w])}return new Uint8Array(m)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let n=this.indexBuffer[e];return L_(this.decodedDictionary,this.offsetBuffer[n],this.offsetBuffer[n+1])}offsetToLengthBuffer(e){let n=new Uint32Array(e.length-1),s=e[0];for(let c=1;c<e.length;c++){let d=e[c];n[c-1]=d-s,s=d}return n}}function JM(r,e,n,s,c,d){return n.type==="scalarType"?(function(m,_,x,b,S,w){let A=null;if(m===0)return null;if(w.nullable){let R=dr(_,x),I=R.numValues,O=x.get(),F=Tp(_,I,R.byteLength,x);x.set(O+R.byteLength),A=new ja(F,R.numValues)}let E=A??b;switch(S.physicalType){case 4:case 3:return(function(R,I,O,F,V){let U=dr(R,I),j=s0(U,V,R,I),H=F.physicalType===3;if(j===fi.FLAT){let ue=Sp(V)?V:void 0,he=H?P_(R,I,U,0,ue):Or(R,I,U,0,ue);return new b_(O.name,he,V)}if(j===fi.SEQUENCE){let ue=A2(R,I,U);return new w_(O.name,ue[0],ue[1],U.numRleValues)}let X=H?(function(ue,he,be){let ge=ih(ue,he,be);return ge.length===1?Xt(ge[0]):(function(Me){return Xt(Me[1])})(ge)})(R,I,U):R_(R,I,U);return new T_(O.name,X,V,H)})(_,x,w,S,E);case 9:return(function(R,I,O,F,V){let U=null,j=null,H=null,X=null,ue=null,he=V??null,be=null,ge=null;for(let Me=0;Me<F;Me++){let Ee=dr(I,O);switch(Ee.physicalStreamType){case Ln.PRESENT:{let we=Tp(I,Ee.numValues,Ee.byteLength,O),_e=new ja(we,Ee.numValues);he=V??_e;break}case Ln.OFFSET:j=Or(I,O,Ee,0,he);break;case Ln.LENGTH:{let we=rl(I,O,Ee);Lr.DICTIONARY===Ee.logicalStreamType.lengthType?U=we:Lr.SYMBOL===Ee.logicalStreamType.lengthType?X=we:be=we;break}case Ln.DATA:{let we=I.subarray(O.get(),O.get()+Ee.byteLength);O.add(Ee.byteLength);let _e=Ee.logicalStreamType.dictionaryType;Va.FSST===_e?ue=we:Va.SINGLE===_e||Va.SHARED===_e?H=we:Va.NONE===_e&&(ge=we);break}}}return(function(Me,Ee,we,_e,Fe,Ge,je){return Ee?new G2(Me,we,_e,Fe,Ge,Ee,je):null})(R,ue,j,U,H,X,he)??(function(Me,Ee,we,_e,Fe){return Ee?Fe?new ah(Me,we,_e,Ee,Fe):new ah(Me,we,_e,Ee):null})(R,H,j,U,he)??(function(Me,Ee,we,_e,Fe){if(!Ee||!we)return null;if(_e)return Fe?new ah(Me,_e,Ee,we,Fe):new ah(Me,_e,Ee,we);if(Fe&&Fe.size()!==Ee.length-1){let Ge=new Uint32Array(Fe.size()),je=0;for(let Ne=0;Ne<Fe.size();Ne++)Ge[Ne]=Fe.get(Ne)?je++:0;return new ah(Me,Ge,Ee,we,Fe)}return Fe?new q2(Me,Ee,we,Fe):new q2(Me,Ee,we)})(R,be,ge,j,he)})(w.name,_,x,w.nullable?m-1:m,A);case 0:return(function(R,I,O,F,V){let U=dr(R,I),j=U.numValues,H=I.get(),X=Sp(V)?V:void 0,ue=Tp(R,j,U.byteLength,I,X);I.set(H+U.byteLength);let he=new ja(ue,j);return new WM(O.name,he,V)})(_,x,w,0,E);case 6:case 5:return(function(R,I,O,F,V){let U=dr(R,I),j=s0(U,F,R,I,"int64"),H=V.physicalType===5;if(j===fi.FLAT){let ue=Sp(F)?F:void 0,he=H?(function(be,ge,Me,Ee){return(function(we,_e,Fe){let Ge;switch(_e.logicalLevelTechnique1){case vt.DELTA:if(_e.logicalLevelTechnique2===vt.RLE){let je=_e;if(!Fe)return(function(Ne,at,Mt){let Pt=new BigInt64Array(Mt),Ht=0,Bn=0n;for(let Ci=0;Ci<at;Ci++){let Ji=Number(Ne[Ci]),dn=hr(Ne[Ci+at]);for(let mi=0;mi<Ji;mi++)Bn+=dn,Pt[Ht++]=Bn}return Pt})(we,je.runs,je.numRleValues);Ge=E2(we=z_(we,je.runs,je.numRleValues))}else Ge=E2(we);break;case vt.RLE:Ge=(function(je,Ne,at){if(at===void 0){at=0;for(let Ht=0;Ht<Ne;Ht++)at+=Number(je[Ht])}let Mt=new BigInt64Array(at),Pt=0;for(let Ht=0;Ht<Ne;Ht++){let Bn=Number(je[Ht]),Ci=je[Ht+Ne];Ci=hr(Ci),Mt.fill(Ci,Pt,Pt+Bn),Pt+=Bn}return Mt})(we,_e.runs,_e.numRleValues);break;case vt.NONE:Ge=(function(je){let Ne=new BigInt64Array(je.length);for(let at=0;at<je.length;at++)Ne[at]=hr(je[at]);return Ne})(we);break;default:throw new Error(`The specified Logical level technique is not supported: ${_e.logicalLevelTechnique1}`)}return Fe?th(Ge,Fe,0n):Ge})(Ju(be,ge,Me.numValues),Me,Ee)})(R,I,U,ue):D2(R,I,U,ue);return new R2(O.name,he,F)}if(j===fi.SEQUENCE){let ue=z2(R,I,U);return new I2(O.name,ue[0],ue[1],U.numRleValues)}let X=H?(function(ue,he,be){let ge=Ju(ue,he,be.numValues);return ge.length===1?hr(ge[0]):(function(Me){return hr(Me[1])})(ge)})(R,I,U):P2(R,I,U);return new j2(O.name,X,F,H)})(_,x,w,E,S);case 7:return(function(R,I,O,F){let V=dr(R,I),U=Sp(F)?F:void 0,j=(function(H,X,ue,he){let be=X.get(),ge=be+ue*Float32Array.BYTES_PER_ELEMENT,Me=new Uint8Array(H.subarray(be,ge)).buffer,Ee=new Float32Array(Me);return X.set(ge),he?th(Ee,he,0):Ee})(R,I,V.numValues,U);return new KM(O.name,j,F)})(_,x,w,E);case 8:return(function(R,I,O,F){let V=dr(R,I),U=Sp(F)?F:void 0,j=(function(H,X,ue,he){let be=X.get(),ge=be+ue*Float64Array.BYTES_PER_ELEMENT,Me=new Uint8Array(H.subarray(be,ge)).buffer,Ee=new Float64Array(Me);return X.set(ge),he?th(Ee,he,0):Ee})(R,I,V.numValues,U);return new x_(O.name,j,F)})(_,x,w,E);default:throw new Error(`The specified data type for the field is currently not supported: ${S}`)}})(s,r,e,c,n.scalarType,n):s===0?null:(function(m,_,x,b){let S=null,w=null,A=null,E=null,R=!1;for(;!R;){let V=dr(m,_);switch(V.physicalStreamType){case Ln.LENGTH:Lr.DICTIONARY===V.logicalStreamType.lengthType?S=rl(m,_,V):A=rl(m,_,V);break;case Ln.DATA:Va.SINGLE===V.logicalStreamType.dictionaryType||Va.SHARED===V.logicalStreamType.dictionaryType?(w=m.subarray(_.get(),_.get()+V.byteLength),R=!0):E=m.subarray(_.get(),_.get()+V.byteLength),_.add(V.byteLength)}}let I=x.complexType.children,O=[],F=0;for(let V of I){let U=Qn(m,_,1)[0];if(U===0)continue;let j=V.name?`${x.name}${V.name}`:x.name;if(U!==2||V.type!=="scalarField"||V.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");let H=dr(m,_),X=Tp(m,H.numValues,H.byteLength,_),ue=dr(m,_),he=Or(m,_,ue,0,ue.decompressedCount!==b?new ja(X,H.numValues):void 0);O[F++]=E?new G2(j,he,S,w,A,E,new ja(X,H.numValues)):new ah(j,he,S,w,new ja(X,H.numValues))}return O})(r,e,n,c)}function Sp(r){return r instanceof ja}function Z2(r){switch(r){case 0:case 1:case 2:case 3:{let e={};e.nullable=!!(1&r),e.columnScope=0;let n={type:"logicalType",logicalType:0};return n.longID=!!(2&r),e.scalarType=n,e.type="scalarType",e}case 4:{let e={nullable:!1,columnScope:0},n={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=n,e}case 30:{let e={nullable:!1,columnScope:0},n={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=n,e}default:return(function(e){let n;switch(e){case 10:case 11:n=0;break;case 12:case 13:n=1;break;case 14:case 15:n=2;break;case 16:case 17:n=3;break;case 18:case 19:n=4;break;case 20:case 21:n=5;break;case 22:case 23:n=6;break;case 24:case 25:n=7;break;case 26:case 27:n=8;break;case 28:case 29:n=9;break;default:return null}let s={};s.nullable=!!(1&e),s.columnScope=0;let c={type:"physicalType"};return c.physicalType=n,s.type="scalarType",s.scalarType=c,s})(r)}}function H2(r){return r>=10}function $2(r){return r===30}function eE(r){if(r.type==="scalarType"){let e=r.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if(e.type==="logicalType")return!1}else if(r.type==="complexType"){let e=r.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",r),!1}function tE(r){return r.type==="complexType"&&r.complexType?.type==="physicalType"&&r.complexType.physicalType===0}let iE=new TextDecoder;function B_(r,e){let n=Qn(r,e,1)[0];if(n===0)return"";let s=e.get(),c=r.subarray(s,s+n);return e.add(n),iE.decode(c)}function X2(r,e){let n=Qn(r,e,1)[0]>>>0;if(n<10||n>30)throw new Error(`Unsupported field type code ${n}. Supported: 10-29(scalars), 30(STRUCT)`);let s=Z2(n);if(H2(n)&&(s.name=B_(r,e)),$2(n)){let c=Qn(r,e,1)[0]>>>0;s.complexType.children=new Array(c);for(let d=0;d<c;d++)s.complexType.children[d]=X2(r,e)}return(function(c){return{name:c.name,nullable:c.nullable,scalarField:c.scalarType,complexField:c.complexType,type:c.type==="scalarType"?"scalarField":"complexField"}})(s)}function nE(r,e){let n=Qn(r,e,1)[0]>>>0,s=Z2(n);if(!s)throw new Error(`Unsupported column type code ${n}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(H2(n)?s.name=B_(r,e):n>=0&&n<=3?s.name="id":n===4&&(s.name="geometry"),$2(n)){let c=Qn(r,e,1)[0]>>>0,d=s.complexType;d.children=new Array(c);for(let m=0;m<c;m++)d.children[m]=X2(r,e)}return s}function rE(r,e){let n={featureTables:[]},s={};s.name=B_(r,e);let c=Qn(r,e,1)[0]>>>0,d=Qn(r,e,1)[0]>>>0;s.columns=new Array(d);for(let m=0;m<d;m++)s.columns[m]=nE(r,e);return n.featureTables.push(s),[n,c]}function aE(r,e,n,s,c,d,m=!1){let _=e.scalarType;if(!_||_.type!=="logicalType"||_.logicalType!==0)throw new Error(`ID column must be a logical ID scalar type: ${s}`);let x=_.longID?6:4,b=typeof d=="number"?void 0:d,S=s0(c,d,r,n,x===6?"int64":"int32");if(x===4)switch(S){case fi.FLAT:{let w=Or(r,n,c,0,b);return new b_(s,w,d)}case fi.SEQUENCE:{let w=A2(r,n,c);return new w_(s,w[0],w[1],c.numRleValues)}case fi.CONST:{let w=R_(r,n,c);return new T_(s,w,d,!1)}}switch(S){case fi.FLAT:{if(m){let A=(function(E,R,I){let O=(function(F,V,U){let j=new Float64Array(U);for(let H=0;H<U;H++)j[H]=HM(F,V);return j})(E,R,I.numValues);return(function(F,V){switch(V.logicalLevelTechnique1){case vt.DELTA:return V.logicalLevelTechnique2===vt.RLE&&(F=S2(F,V.runs,V.numRleValues)),(function(U){U[0]=eh(U[0]);let j=U.length/4*4,H=1;if(j>=4)for(;H<j-4;H+=4){let X=U[H+1],ue=U[H+2],he=U[H+3];U[H]=eh(U[H])+U[H-1],U[H+1]=eh(X)+U[H],U[H+2]=eh(ue)+U[H+1],U[H+3]=eh(he)+U[H+2]}for(;H!==U.length;++H)U[H]=eh(U[H])+U[H-1]})(F),F;case vt.RLE:return(function(U,j){return S2(U,j.runs,j.numRleValues)})(F,V);case vt.NONE:return F;default:throw new Error(`The specified Logical level technique is not supported: ${V.logicalLevelTechnique1}`)}})(O,I)})(r,n,c);return new x_(s,A,d)}let w=D2(r,n,c,b);return new R2(s,w,d)}case fi.SEQUENCE:{let w=z2(r,n,c);return new I2(s,w[0],w[1],c.numRleValues)}case fi.CONST:{let w=P2(r,n,c);return new j2(s,w,d,!1)}}throw new Error("Vector type not supported for id column.")}class oE{constructor(e,n){var s;switch(this._featureData=e,this.properties=this._featureData.properties||{},(s=this._featureData.geometry)===null||s===void 0?void 0:s.type){case hn.POINT:case hn.MULTIPOINT:this.type=1;break;case hn.LINESTRING:case hn.MULTILINESTRING:this.type=2;break;case hn.POLYGON:case hn.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=n,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let n of this._featureData.geometry.coordinates){let s=[];for(let c of n)s.push(new D(c.x,c.y));e.push(s)}return e}}class sE{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new oE(this.features[e],this.extent)}}class Y2{constructor(e){this.layers={};let n=(function(s,c,d=!0){let m=new w2(0),_=[];for(;m.get()<s.length;){let b=Qn(s,m,1)[0]>>>0,S=m.get()+b;if(S>s.length)throw new Error(`Block overruns tile: ${S} > ${s.length}`);if(Qn(s,m,1)[0]>>>0!=1){m.set(S);continue}let[w,A]=rE(s,m),E=w.featureTables[0],R=null,I=null,O=[],F=0;for(let U of E.columns){let j=U.name;if((x=U).type==="scalarType"&&x.scalarType?.type==="logicalType"&&x.scalarType.logicalType===0){let H=null;if(U.nullable){let ue=dr(s,m),he=m.get(),be=Tp(s,ue.numValues,ue.byteLength,m);m.set(he+ue.byteLength),H=new ja(be,ue.numValues)}let X=dr(s,m);F=H?H.size():X.decompressedCount,R=aE(s,U,m,j,X,H??F,d)}else if(tE(U)){let H=Qn(s,m,1)[0];if(F===0){let X=m.get();F=dr(s,m).decompressedCount,m.set(X)}I=YM(s,H,m,F)}else{let H=eE(U)?Qn(s,m,1)[0]:1;if(H===0)continue;let X=JM(s,m,U,H,F);if(X)if(Array.isArray(X))for(let ue of X)O.push(ue);else O.push(X)}}let V=new BM(E.name,I,R,O,A);_.push(V),m.set(S)}var x;return _})(new Uint8Array(e));this.layers=n.reduce(((s,c)=>Object.assign(Object.assign({},s),{[c.name]:new sE(c)})),{})}}class lE{constructor(e,n){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=n,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){let e=[],n=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let s of n){let c=[];for(let d of s)c.push(new D(d[0],d[1]));e.push(c)}return e}}let Mp="_geojsonTileLayer";function cE(r,e,n=""){e.writeVarintField(15,r.version||1),e.writeStringField(1,r.name||""),e.writeVarintField(5,r.extent||4096);let s={jsonPrefix:n,keys:[],values:[],keycache:{},valuecache:{}};for(let m=0;m<r.length;m++)s.feature=r.feature(m),e.writeMessage(2,uE,s);let c=s.keys;for(let m of c)e.writeStringField(3,m);let d=s.values;for(let m of d)e.writeMessage(4,pE,m)}function uE(r,e){if(!r.feature)return;let n=r.feature;n.id!==void 0&&e.writeVarintField(1,n.id),e.writeMessage(2,hE,r),e.writeVarintField(3,n.type),e.writeMessage(4,dE,n)}function hE(r,e){for(let n in r.feature?.properties){let s=r.feature.properties[n],c=r.keycache[n];if(s==null)continue;c===void 0&&(r.keys.push(n),c=r.keys.length-1,r.keycache[n]=c),e.writeVarint(c),typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"&&(s=r.jsonPrefix+JSON.stringify(s));let d=typeof s+":"+s,m=r.valuecache[d];m===void 0&&(r.values.push(s),m=r.values.length-1,r.valuecache[d]=m),e.writeVarint(m)}}function F_(r,e){return(e<<3)+(7&r)}function W2(r){return r<<1^r>>31}function dE(r,e){let n=r.loadGeometry(),s=r.type,c=0,d=0;for(let m of n){let _=1;s===1&&(_=m.length),e.writeVarint(F_(1,_));let x=s===3?m.length-1:m.length;for(let b=0;b<x;b++){b===1&&s!==1&&e.writeVarint(F_(2,x-1));let S=m[b].x-c,w=m[b].y-d;e.writeVarint(W2(S)),e.writeVarint(W2(w)),c+=S,d+=w}r.type===3&&e.writeVarint(F_(7,1))}}function pE(r,e){let n=typeof r;n==="string"?e.writeStringField(1,r):n==="boolean"?e.writeBooleanField(7,r):n==="number"&&(r%1!=0?e.writeDoubleField(3,r):r<0?e.writeSVarintField(6,r):e.writeVarintField(5,r))}class K2{constructor(e,n){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new La(Ke,16,0),this.grid3D=new La(Ke,16,0),this.featureIndexArray=new G,this.promoteId=n}insert(e,n,s,c,d,m){let _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,c,d);let x=m?this.grid3D:this.grid;for(let b of n){let S=[1/0,1/0,-1/0,-1/0];for(let w of b)S[0]=Math.min(S[0],w.x),S[1]=Math.min(S[1],w.y),S[2]=Math.max(S[2],w.x),S[3]=Math.max(S[3],w.y);S[0]<Ke&&S[1]<Ke&&S[2]>=0&&S[3]>=0&&x.insert(_,S[0],S[1],S[2],S[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new Sx(new t0(this.rawTileData)).layers:new Y2(this.rawTileData).layers,this.sourceLayerCoder=new v2(this.vtLayers?Object.keys(this.vtLayers).sort():[Mp])),this.vtLayers}query(e,n,s,c){this.loadVTLayers();let d=e.params,m=Ke/e.tileSize/e.scale,_=Jl(d.filter,d.globalState),x=e.queryGeometry,b=e.queryPadding*m,S=bc.fromPoints(x),w=this.grid.query(S.minX-b,S.minY-b,S.maxX+b,S.maxY+b),A=bc.fromPoints(e.cameraQueryGeometry).expandBy(b),E=this.grid3D.query(A.minX,A.minY,A.maxX,A.maxY,((O,F,V,U)=>(function(j,H,X,ue,he){for(let ge of j)if(H<=ge.x&&X<=ge.y&&ue>=ge.x&&he>=ge.y)return!0;let be=[new D(H,X),new D(H,he),new D(ue,he),new D(ue,X)];if(j.length>2){for(let ge of be)if(Uu(j,ge))return!0}for(let ge=0;ge<j.length-1;ge++)if(GS(j[ge],j[ge+1],be))return!0;return!1})(e.cameraQueryGeometry,O-b,F-b,V+b,U+b)));for(let O of E)w.push(O);w.sort(fE);let R={},I;for(let O of w){if(O===I)continue;I=O;let F=this.featureIndexArray.get(O),V=null;this.loadMatchingFeature(R,F.bucketIndex,F.sourceLayerIndex,F.featureIndex,_,d.layers,d.availableImages,n,s,c,((U,j,H)=>(V||(V=fo(U)),j.queryIntersectsFeature({queryGeometry:x,feature:U,featureState:H,geometry:V,zoom:this.z,transform:e.transform,pixelsToTileUnits:m,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return R}loadMatchingFeature(e,n,s,c,d,m,_,x,b,S,w){let A=this.bucketLayerIDs[n];if(m&&!A.some((O=>m.has(O))))return;let E=this.sourceLayerCoder.decode(s),R=this.vtLayers[E].feature(c);if(d.needGeometry){let O=mo(R,!0);if(!d.filter(new ti(this.tileID.overscaledZ),O,this.tileID.canonical))return}else if(!d.filter(new ti(this.tileID.overscaledZ),R))return;let I=this.getId(R,E);for(let O of A){if(m&&!m.has(O))continue;let F=x[O];if(!F)continue;let V={};I&&S&&(V=S.getState(F.sourceLayer||Mp,I));let U=pi({},b[O]);U.paint=Q2(U.paint,F.paint,R,V,_),U.layout=Q2(U.layout,F.layout,R,V,_);let j=!w||w(R,F,V);if(!j)continue;let H=new b2(R,this.z,this.x,this.y,I);H.layer=U;let X=e[O];X===void 0&&(X=e[O]=[]),X.push({featureIndex:c,feature:H,intersectionZ:j})}}lookupSymbolFeatures(e,n,s,c,d,m,_,x){let b={};this.loadVTLayers();let S=Jl(d.filterSpec,d.globalState);for(let w of e)this.loadMatchingFeature(b,s,c,w,S,m,_,x,n);return b}hasLayer(e){for(let n of this.bucketLayerIDs)for(let s of n)if(e===s)return!0;return!1}getId(e,n){var s;let c=e.id;return this.promoteId&&(c=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[n]],typeof c=="boolean"&&(c=Number(c)),c===void 0&&(!((s=e.properties)===null||s===void 0)&&s.cluster)&&this.promoteId&&(c=Number(e.properties.cluster_id))),c}}function Q2(r,e,n,s,c){return li(r,((d,m)=>{let _=e instanceof hc?e.get(m):null;return _?.evaluate?_.evaluate(n,s,c):_}))}function fE(r,e){return e-r}function J2(r,e,n,s,c){let d=[];for(let m of r){let _;for(let x=0;x<m.length-1;x++){let b=m[x],S=m[x+1];b.x<e&&S.x<e||(b.x<e?b=new D(e,b.y+(e-b.x)/(S.x-b.x)*(S.y-b.y))._round():S.x<e&&(S=new D(e,b.y+(e-b.x)/(S.x-b.x)*(S.y-b.y))._round()),b.y<n&&S.y<n||(b.y<n?b=new D(b.x+(n-b.y)/(S.y-b.y)*(S.x-b.x),n)._round():S.y<n&&(S=new D(b.x+(n-b.y)/(S.y-b.y)*(S.x-b.x),n)._round()),b.x>=s&&S.x>=s||(b.x>=s?b=new D(s,b.y+(s-b.x)/(S.x-b.x)*(S.y-b.y))._round():S.x>=s&&(S=new D(s,b.y+(s-b.x)/(S.x-b.x)*(S.y-b.y))._round()),b.y>=c&&S.y>=c||(b.y>=c?b=new D(b.x+(c-b.y)/(S.y-b.y)*(S.x-b.x),c)._round():S.y>=c&&(S=new D(b.x+(c-b.y)/(S.y-b.y)*(S.x-b.x),c)._round()),_&&b.equals(_[_.length-1])||(_=[b],d.push(_)),_.push(S)))))}}return d}function ew(r,e,n,s,c){switch(e){case 1:return(function(d,m,_,x){let b=[];for(let S of d)for(let w of S){let A=x===0?w.x:w.y;A>=m&&A<=_&&b.push([w])}return b})(r,n,s,c);case 2:return tw(r,n,s,c,!1);case 3:return tw(r,n,s,c,!0)}return[]}function mE(r,e,n,s,c){let d=s===0?gE:_E,m=[],_=[];for(let S=0;S<r.length-1;S++){let w=r[S],A=r[S+1],E=s===0?w.x:w.y,R=s===0?A.x:A.y,I=!1;E<e?R>e&&m.push(d(w,A,e)):E>n?R<n&&m.push(d(w,A,n)):m.push(w),R<e&&E>=e&&(m.push(d(w,A,e)),I=!0),R>n&&E<=n&&(m.push(d(w,A,n)),I=!0),!c&&I&&(_.push(m),m=[])}let x=r.length-1,b=s===0?r[x].x:r[x].y;return b>=e&&b<=n&&m.push(r[x]),c&&m.length>0&&!m[0].equals(m[m.length-1])&&m.push(new D(m[0].x,m[0].y)),m.length>0&&_.push(m),_}function tw(r,e,n,s,c){let d=[];for(let m of r){let _=mE(m,e,n,s,c);_.length>0&&d.push(..._)}return d}function gE(r,e,n){return new D(n,r.y+(n-r.x)/(e.x-r.x)*(e.y-r.y))}function _E(r,e,n){return new D(r.x+(n-r.y)/(e.y-r.y)*(e.x-r.x),n)}Ye("FeatureIndex",K2,{omit:["rawTileData","sourceLayerCoder"]});class al extends D{constructor(e,n,s,c){super(e,n),this.angle=s,c!==void 0&&(this.segment=c)}clone(){return new al(this.x,this.y,this.angle,this.segment)}}function iw(r,e,n,s,c){if(e.segment===void 0||n===0)return!0;let d=e,m=e.segment+1,_=0;for(;_>-n/2;){if(m--,m<0)return!1;_-=r[m].dist(d),d=r[m]}_+=r[m].dist(r[m+1]),m++;let x=[],b=0;for(;_<n/2;){let S=r[m],w=r[m+1];if(!w)return!1;let A=r[m-1].angleTo(S)-S.angleTo(w);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),x.push({distance:_,angleDelta:A}),b+=A;_-x[0].distance>s;)b-=x.shift().angleDelta;if(b>c)return!1;m++,_+=S.dist(w)}return!0}function nw(r){let e=0;for(let n=0;n<r.length-1;n++)e+=r[n].dist(r[n+1]);return e}function rw(r,e,n){return r?.6*e*n:0}function aw(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function yE(r,e,n,s,c,d){let m=rw(n,c,d),_=aw(n,s)*d,x=0,b=nw(r)/2;for(let S=0;S<r.length-1;S++){let w=r[S],A=r[S+1],E=w.dist(A);if(x+E>b){let R=(b-x)/E,I=_r.number(w.x,A.x,R),O=_r.number(w.y,A.y,R),F=new al(I,O,A.angleTo(w),S);return F._round(),!m||iw(r,F,_,m,e)?F:void 0}x+=E}}function vE(r,e,n,s,c,d,m,_,x){let b=rw(s,d,m),S=aw(s,c),w=S*m,A=r[0].x===0||r[0].x===x||r[0].y===0||r[0].y===x;return e-w<e/4&&(e=w+e/4),ow(r,A?e/2*_%e:(S/2+2*d)*m*_%e,e,b,n,w,A,!1,x)}function ow(r,e,n,s,c,d,m,_,x){let b=d/2,S=nw(r),w=0,A=e-n,E=[];for(let R=0;R<r.length-1;R++){let I=r[R],O=r[R+1],F=I.dist(O),V=O.angleTo(I);for(;A+n<w+F;){A+=n;let U=(A-w)/F,j=_r.number(I.x,O.x,U),H=_r.number(I.y,O.y,U);if(j>=0&&j<x&&H>=0&&H<x&&A-b>=0&&A+b<=S){let X=new al(j,H,V,R);X._round(),s&&!iw(r,X,d,s,c)||E.push(X)}}w+=F}return _||E.length||m||(E=ow(r,w/2,n,s,c,d,m,!0,x)),E}function sw(r,e,n,s){let c=[],d=r.image,m=d.pixelRatio,_=d.paddedRect.w-2,x=d.paddedRect.h-2,b={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom},S=d.stretchX||[[0,_]],w=d.stretchY||[[0,x]],A=(_e,Fe)=>_e+Fe[1]-Fe[0],E=S.reduce(A,0),R=w.reduce(A,0),I=_-E,O=x-R,F=0,V=E,U=0,j=R,H=0,X=I,ue=0,he=O;if(d.content&&s){let _e=d.content,Fe=_e[2]-_e[0],Ge=_e[3]-_e[1];(d.textFitWidth||d.textFitHeight)&&(b=n2(r)),F=l0(S,0,_e[0]),U=l0(w,0,_e[1]),V=l0(S,_e[0],_e[2]),j=l0(w,_e[1],_e[3]),H=_e[0]-F,ue=_e[1]-U,X=Fe-V,he=Ge-j}let be=b.x1,ge=b.y1,Me=b.x2-be,Ee=b.y2-ge,we=(_e,Fe,Ge,je)=>{let Ne=c0(_e.stretch-F,V,Me,be),at=u0(_e.fixed-H,X,_e.stretch,E),Mt=c0(Fe.stretch-U,j,Ee,ge),Pt=u0(Fe.fixed-ue,he,Fe.stretch,R),Ht=c0(Ge.stretch-F,V,Me,be),Bn=u0(Ge.fixed-H,X,Ge.stretch,E),Ci=c0(je.stretch-U,j,Ee,ge),Ji=u0(je.fixed-ue,he,je.stretch,R),dn=new D(Ne,Mt),mi=new D(Ht,Mt),En=new D(Ht,Ci),Jn=new D(Ne,Ci),er=new D(at/m,Pt/m),wr=new D(Bn/m,Ji/m),Fn=e*Math.PI/180;if(Fn){let pn=Math.sin(Fn),wi=Math.cos(Fn),$i=[wi,-pn,pn,wi];dn._matMult($i),mi._matMult($i),Jn._matMult($i),En._matMult($i)}let Tr=_e.stretch+_e.fixed,va=Fe.stretch+Fe.fixed;return{tl:dn,tr:mi,bl:Jn,br:En,tex:{x:d.paddedRect.x+1+Tr,y:d.paddedRect.y+1+va,w:Ge.stretch+Ge.fixed-Tr,h:je.stretch+je.fixed-va},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:er,pixelOffsetBR:wr,minFontScaleX:X/m/Me,minFontScaleY:he/m/Ee,isSDF:n}};if(s&&(d.stretchX||d.stretchY)){let _e=lw(S,I,E),Fe=lw(w,O,R);for(let Ge=0;Ge<_e.length-1;Ge++){let je=_e[Ge],Ne=_e[Ge+1];for(let at=0;at<Fe.length-1;at++)c.push(we(je,Fe[at],Ne,Fe[at+1]))}}else c.push(we({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:x+1}));return c}function l0(r,e,n){let s=0;for(let c of r)s+=Math.max(e,Math.min(n,c[1]))-Math.max(e,Math.min(n,c[0]));return s}function lw(r,e,n){let s=[{fixed:-1,stretch:0}];for(let[c,d]of r){let m=s[s.length-1];s.push({fixed:c-m.stretch,stretch:m.stretch}),s.push({fixed:c-m.stretch,stretch:m.stretch+(d-c)})}return s.push({fixed:e+1,stretch:n}),s}function c0(r,e,n,s){return r/e*n+s}function u0(r,e,n,s){return r-e*n/s}Ye("Anchor",al);class h0{constructor(e,n,s,c,d,m,_,x,b,S){var w;if(this.boxStartIndex=e.length,b){let A=m.top,E=m.bottom,R=m.collisionPadding;R&&(A-=R[1],E+=R[3]);let I=E-A;I>0&&(I=Math.max(10,I),this.circleDiameter=I)}else{let A=!((w=m.image)===null||w===void 0)&&w.content&&(m.image.textFitWidth||m.image.textFitHeight)?n2(m):{x1:m.left,y1:m.top,x2:m.right,y2:m.bottom};A.y1=A.y1*_-x[0],A.y2=A.y2*_+x[2],A.x1=A.x1*_-x[3],A.x2=A.x2*_+x[1];let E=m.collisionPadding;if(E&&(A.x1-=E[0]*_,A.y1-=E[1]*_,A.x2+=E[2]*_,A.y2+=E[3]*_),S){let R=new D(A.x1,A.y1),I=new D(A.x2,A.y1),O=new D(A.x1,A.y2),F=new D(A.x2,A.y2),V=S*Math.PI/180;R._rotate(V),I._rotate(V),O._rotate(V),F._rotate(V),A.x1=Math.min(R.x,I.x,O.x,F.x),A.x2=Math.max(R.x,I.x,O.x,F.x),A.y1=Math.min(R.y,I.y,O.y,F.y),A.y2=Math.max(R.y,I.y,O.y,F.y)}e.emplaceBack(n.x,n.y,A.x1,A.y1,A.x2,A.y2,s,c,d)}this.boxEndIndex=e.length}}class bE{constructor(e=[],n=(s,c)=>s<c?-1:s>c?1:0){if(this.data=e,this.length=this.data.length,this.compare=n,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:n,compare:s}=this,c=n[e];for(;e>0;){let d=e-1>>1,m=n[d];if(s(c,m)>=0)break;n[e]=m,e=d}n[e]=c}_down(e){let{data:n,compare:s}=this,c=this.length>>1,d=n[e];for(;e<c;){let m=1+(e<<1),_=m+1;if(_<this.length&&s(n[_],n[m])<0&&(m=_),s(n[m],d)>=0)break;n[e]=n[m],e=m}n[e]=d}}function xE(r,e=1){let n=bc.fromPoints(r[0]),s=Math.min(n.width(),n.height()),c=s/2,d=new bE([],wE),{minX:m,minY:_,maxX:x,maxY:b}=n;if(s===0)return new D(m,_);for(let A=m;A<x;A+=s)for(let E=_;E<b;E+=s)d.push(new oh(A+c,E+c,c,r));let S=(function(A){let E=0,R=0,I=0,O=A[0];for(let F=0,V=O.length,U=V-1;F<V;U=F++){let j=O[F],H=O[U],X=j.x*H.y-H.x*j.y;R+=(j.x+H.x)*X,I+=(j.y+H.y)*X,E+=3*X}return new oh(R/E,I/E,0,A)})(r),w=S;for(;d.length;){let A=d.pop();(A.d>w.d||!w.d)&&(w=A),A.max-w.d<=e||(c=A.h/2,d.push(new oh(A.p.x-c,A.p.y-c,c,r)),d.push(new oh(A.p.x+c,A.p.y-c,c,r)),d.push(new oh(A.p.x-c,A.p.y+c,c,r)),d.push(new oh(A.p.x+c,A.p.y+c,c,r)))}return S.d>0&&w.d-S.d<=e?S.p:w.p}function wE(r,e){return e.max-r.max}class oh{constructor(e,n,s,c){this.p=new D(e,n),this.h=s,this.d=(function(d,m){let _=!1,x=1/0;for(let b of m)for(let S=0,w=b.length,A=w-1;S<w;A=S++){let E=b[S],R=b[A];E.y>d.y!=R.y>d.y&&d.x<(R.x-E.x)*(d.y-E.y)/(R.y-E.y)+E.x&&(_=!_),x=Math.min(x,Jb(d,E,R))}return(_?1:-1)*Math.sqrt(x)})(this.p,c),this.max=this.d+this.h*Math.SQRT2}}var On;y.aM=void 0,(On=y.aM||(y.aM={}))[On.center=1]="center",On[On.left=2]="left",On[On.right=3]="right",On[On.top=4]="top",On[On.bottom=5]="bottom",On[On["top-left"]=6]="top-left",On[On["top-right"]=7]="top-right",On[On["bottom-left"]=8]="bottom-left",On[On["bottom-right"]=9]="bottom-right";let N_=Number.POSITIVE_INFINITY;function cw(r,e){return e[1]!==N_?(function(n,s,c){let d=0,m=0;switch(s=Math.abs(s),c=Math.abs(c),n){case"top-right":case"top-left":case"top":m=c-7;break;case"bottom-right":case"bottom-left":case"bottom":m=7-c}switch(n){case"top-right":case"bottom-right":case"right":d=-s;break;case"top-left":case"bottom-left":case"left":d=s}return[d,m]})(r,e[0],e[1]):(function(n,s){let c=0,d=0;s<0&&(s=0);let m=s/Math.SQRT2;switch(n){case"top-right":case"top-left":d=m-7;break;case"bottom-right":case"bottom-left":d=7-m;break;case"bottom":d=7-s;break;case"top":d=s-7}switch(n){case"top-right":case"bottom-right":c=-m;break;case"top-left":case"bottom-left":c=m;break;case"left":c=s;break;case"right":c=-s}return[c,d]})(r,e[0])}function uw(r,e,n){var s;let c=r.layout,d=(s=c.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},n);if(d){let _=d.values,x=[];for(let b=0;b<_.length;b+=2){let S=x[b]=_[b],w=_[b+1].map((A=>A*un));S.startsWith("top")?w[1]-=7:S.startsWith("bottom")&&(w[1]+=7),x[b+1]=w}return new $n(x)}let m=c.get("text-variable-anchor");if(m){let _;_=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(e,{},n)*un,N_]:c.get("text-offset").evaluate(e,{},n).map((b=>b*un));let x=[];for(let b of m)x.push(b,cw(b,_));return new $n(x)}return null}function U_(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function TE(r,e,n,s,c,d,m,_,x,b,S,w){let A=d.textMaxSize.evaluate(e,{});A===void 0&&(A=m);let E=r.layers[0].layout,R=E.get("icon-offset").evaluate(e,{},S),I=dw(n.horizontal),O=m/24,F=r.tilePixelRatio*O,V=r.tilePixelRatio*A/24,U=r.tilePixelRatio*_,j=r.tilePixelRatio*E.get("symbol-spacing"),H=E.get("text-padding")*r.tilePixelRatio,X=(function(Ge,je,Ne,at=1){let Mt=Ge.get("icon-padding").evaluate(je,{},Ne),Pt=Mt?.values;return[Pt[0]*at,Pt[1]*at,Pt[2]*at,Pt[3]*at]})(E,e,S,r.tilePixelRatio),ue=E.get("text-max-angle")/180*Math.PI,he=E.get("text-rotation-alignment")!=="viewport"&&E.get("symbol-placement")!=="point",be=E.get("icon-rotation-alignment")==="map"&&E.get("symbol-placement")!=="point",ge=E.get("symbol-placement"),Me=j/2,Ee=E.get("icon-text-fit"),we;s&&Ee!=="none"&&(r.allowVerticalPlacement&&n.vertical&&(we=r2(s,n.vertical,Ee,E.get("icon-text-fit-padding"),R,O)),I&&(s=r2(s,I,Ee,E.get("icon-text-fit-padding"),R,O)));let _e=S?w.line.getGranularityForZoomLevel(S.z):1,Fe=(Ge,je)=>{je.x<0||je.x>=Ke||je.y<0||je.y>=Ke||(function(Ne,at,Mt,Pt,Ht,Bn,Ci,Ji,dn,mi,En,Jn,er,wr,Fn,Tr,va,pn,wi,$i,Ai,fn,ns,qa,Ep){let ol=Ne.addToLineVertexArray(at,Mt),wc,sh,lh,ch,pw=0,fw=0,mw=0,gw=0,V_=-1,j_=-1,rs={},_w=cn("");if(Ne.allowVerticalPlacement&&Pt.vertical){let tr=Ji.layout.get("text-rotate").evaluate(Ai,{},qa)+90;lh=new h0(dn,at,mi,En,Jn,Pt.vertical,er,wr,Fn,tr),Ci&&(ch=new h0(dn,at,mi,En,Jn,Ci,va,pn,Fn,tr))}if(Ht){let tr=Ji.layout.get("icon-rotate").evaluate(Ai,{}),Qr=Ji.layout.get("icon-text-fit")!=="none",Tc=sw(Ht,tr,ns,Qr),Za=Ci?sw(Ci,tr,ns,Qr):void 0;sh=new h0(dn,at,mi,En,Jn,Ht,va,pn,!1,tr),pw=4*Tc.length;let Sc=Ne.iconSizeData,go=null;Sc.kind==="source"?(go=[ts*Ji.layout.get("icon-size").evaluate(Ai,{})],go[0]>el&&Gt(`${Ne.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Sc.kind==="composite"&&(go=[ts*fn.compositeIconSizes[0].evaluate(Ai,{},qa),ts*fn.compositeIconSizes[1].evaluate(Ai,{},qa)],(go[0]>el||go[1]>el)&&Gt(`${Ne.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ne.addSymbols(Ne.icon,Tc,go,$i,wi,Ai,y.ax.none,at,ol.lineStartIndex,ol.lineLength,-1,qa),V_=Ne.icon.placedSymbolArray.length-1,Za&&(fw=4*Za.length,Ne.addSymbols(Ne.icon,Za,go,$i,wi,Ai,y.ax.vertical,at,ol.lineStartIndex,ol.lineLength,-1,qa),j_=Ne.icon.placedSymbolArray.length-1)}let yw=Object.keys(Pt.horizontal);for(let tr of yw){let Qr=Pt.horizontal[tr];if(!wc){_w=cn(Qr.text);let Za=Ji.layout.get("text-rotate").evaluate(Ai,{},qa);wc=new h0(dn,at,mi,En,Jn,Qr,er,wr,Fn,Za)}let Tc=Qr.positionedLines.length===1;if(mw+=hw(Ne,at,Qr,Bn,Ji,Fn,Ai,Tr,ol,Pt.vertical?y.ax.horizontal:y.ax.horizontalOnly,Tc?yw:[tr],rs,V_,fn,qa),Tc)break}Pt.vertical&&(gw+=hw(Ne,at,Pt.vertical,Bn,Ji,Fn,Ai,Tr,ol,y.ax.vertical,["vertical"],rs,j_,fn,qa));let ME=wc?wc.boxStartIndex:Ne.collisionBoxArray.length,EE=wc?wc.boxEndIndex:Ne.collisionBoxArray.length,CE=lh?lh.boxStartIndex:Ne.collisionBoxArray.length,AE=lh?lh.boxEndIndex:Ne.collisionBoxArray.length,zE=sh?sh.boxStartIndex:Ne.collisionBoxArray.length,DE=sh?sh.boxEndIndex:Ne.collisionBoxArray.length,PE=ch?ch.boxStartIndex:Ne.collisionBoxArray.length,RE=ch?ch.boxEndIndex:Ne.collisionBoxArray.length,Ga=-1,d0=(tr,Qr)=>tr?.circleDiameter?Math.max(tr.circleDiameter,Qr):Qr;Ga=d0(wc,Ga),Ga=d0(lh,Ga),Ga=d0(sh,Ga),Ga=d0(ch,Ga);let vw=Ga>-1?1:0;vw&&(Ga*=Ep/un),Ne.glyphOffsetArray.length>=Wu.MAX_GLYPHS&&Gt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ai.sortKey!==void 0&&Ne.addToSortKeyRanges(Ne.symbolInstances.length,Ai.sortKey);let IE=uw(Ji,Ai,qa),[kE,LE]=(function(tr,Qr){let Tc=tr.length,Za=Qr?.values;if(Za?.length>0)for(let Sc=0;Sc<Za.length;Sc+=2){let go=Za[Sc+1];tr.emplaceBack(y.aM[Za[Sc]],go[0],go[1])}return[Tc,tr.length]})(Ne.textAnchorOffsets,IE);Ne.symbolInstances.emplaceBack(at.x,at.y,rs.right>=0?rs.right:-1,rs.center>=0?rs.center:-1,rs.left>=0?rs.left:-1,rs.vertical||-1,V_,j_,_w,ME,EE,CE,AE,zE,DE,PE,RE,mi,mw,gw,pw,fw,vw,0,er,Ga,kE,LE)})(r,je,Ge,n,s,c,we,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,F,[H,H,H,H],he,x,U,X,be,R,e,d,b,S,m)};if(ge==="line")for(let Ge of J2(e.geometry,0,0,Ke,Ke)){let je=vc(Ge,_e),Ne=vE(je,j,ue,n.vertical||I,s,24,V,r.overscaling,Ke);for(let at of Ne)I&&SE(r,I.text,Me,at)||Fe(je,at)}else if(ge==="line-center"){for(let Ge of e.geometry)if(Ge.length>1){let je=vc(Ge,_e),Ne=yE(je,ue,n.vertical||I,s,24,V);Ne&&Fe(je,Ne)}}else if(e.type==="Polygon")for(let Ge of cu(e.geometry,0)){let je=xE(Ge,16);Fe(vc(Ge[0],_e,!0),new al(je.x,je.y,0))}else if(e.type==="LineString")for(let Ge of e.geometry){let je=vc(Ge,_e);Fe(je,new al(je[0].x,je[0].y,0))}else if(e.type==="Point")for(let Ge of e.geometry)for(let je of Ge)Fe([je],new al(je.x,je.y,0))}function hw(r,e,n,s,c,d,m,_,x,b,S,w,A,E,R){let I=(function(V,U,j,H,X,ue,he,be){let ge=H.layout.get("text-rotate").evaluate(ue,{})*Math.PI/180,Me=[];for(let Ee of U.positionedLines)for(let we of Ee.positionedGlyphs){if(!we.rect)continue;let _e=we.rect||{},Fe=4,Ge=!0,je=1,Ne=0,at=(X||be)&&we.vertical,Mt=we.metrics.advance*we.scale/2;if(be&&U.verticalizable&&(Ne=Ee.lineOffset/2-(we.imageName?-(un-we.metrics.width*we.scale)/2:(we.scale-1)*un)),we.imageName){let pn=he[we.imageName];Ge=pn.sdf,je=pn.pixelRatio,Fe=1/je}let Pt=X?[we.x+Mt,we.y]:[0,0],Ht=X?[0,0]:[we.x+Mt+j[0],we.y+j[1]-Ne],Bn=[0,0];at&&(Bn=Ht,Ht=[0,0]);let Ci=we.metrics.isDoubleResolution?2:1,Ji=(we.metrics.left-Fe)*we.scale-Mt+Ht[0],dn=(-we.metrics.top-Fe)*we.scale+Ht[1],mi=Ji+_e.w/Ci*we.scale/je,En=dn+_e.h/Ci*we.scale/je,Jn=new D(Ji,dn),er=new D(mi,dn),wr=new D(Ji,En),Fn=new D(mi,En);if(at){let pn=new D(-Mt,Mt- -17),wi=-Math.PI/2,$i=12-Mt,Ai=new D(22-$i,-(we.imageName?$i:0)),fn=new D(...Bn);Jn._rotateAround(wi,pn)._add(Ai)._add(fn),er._rotateAround(wi,pn)._add(Ai)._add(fn),wr._rotateAround(wi,pn)._add(Ai)._add(fn),Fn._rotateAround(wi,pn)._add(Ai)._add(fn)}if(ge){let pn=Math.sin(ge),wi=Math.cos(ge),$i=[wi,-pn,pn,wi];Jn._matMult($i),er._matMult($i),wr._matMult($i),Fn._matMult($i)}let Tr=new D(0,0),va=new D(0,0);Me.push({tl:Jn,tr:er,bl:wr,br:Fn,tex:_e,writingMode:U.writingMode,glyphOffset:Pt,sectionIndex:we.sectionIndex,isSDF:Ge,pixelOffsetTL:Tr,pixelOffsetBR:va,minFontScaleX:0,minFontScaleY:0})}return Me})(0,n,_,c,d,m,s,r.allowVerticalPlacement),O=r.textSizeData,F=null;O.kind==="source"?(F=[ts*c.layout.get("text-size").evaluate(m,{})],F[0]>el&&Gt(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):O.kind==="composite"&&(F=[ts*E.compositeTextSizes[0].evaluate(m,{},R),ts*E.compositeTextSizes[1].evaluate(m,{},R)],(F[0]>el||F[1]>el)&&Gt(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,I,F,_,d,m,b,e,x.lineStartIndex,x.lineLength,A,R);for(let V of S)w[V]=r.text.placedSymbolArray.length-1;return 4*I.length}function dw(r){for(let e in r)return r[e];return null}function SE(r,e,n,s){let c=r.compareText;if(e in c){let d=c[e];for(let m=d.length-1;m>=0;m--)if(s.dist(d[m])<n)return!0}else c[e]=[];return c[e].push(s),!1}y.$=$c,y.A=ce,y.B=Cu,y.C=zm,y.D=Je,y.E=Po,y.F=ma,y.G=function([r,e,n]){return e+=90,e*=Math.PI/180,n*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(n),y:r*Math.sin(e)*Math.sin(n),z:r*Math.cos(n)}},y.H=_r,y.I=h_,y.J=ti,y.K=sc,y.L=function(r){if(Nt==null){let e=r.navigator?r.navigator.userAgent:null;Nt=!!r.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Nt},y.M=bn,y.N=class{constructor(r,e){this.target=r,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new LM((()=>this.process())),this.subscription=xt(this.target,"message",(n=>this.receive(n)),!1),this.globalScope=zt(self)?r:window}registerMessageHandler(r,e){this.messageHandlers[r]=e}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,e){return new Promise(((n,s)=>{let c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=e?xt(e.signal,"abort",(()=>{d?.unsubscribe(),delete this.resolveRejects[c];let x={id:c,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(x)}),OM):null;this.resolveRejects[c]={resolve:x=>{d?.unsubscribe(),n(x)},reject:x=>{d?.unsubscribe(),s(x)}};let m=[],_=Object.assign(Object.assign({},r),{id:c,sourceMapId:this.mapId,origin:location.origin,data:Oa(r.data,m)});this.target.postMessage(_,{transfer:m})}))}receive(r){let e=r.data,n=e.id,s=["file://","resource://android","null"],c=[e.origin,location.origin],d=e.origin===location.origin,m=c.some((_=>s.includes(_)));if((d||m)&&(!e.targetMapId||this.mapId===e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[n];let _=this.abortControllers[n];return delete this.abortControllers[n],void(_&&_.abort())}if(zt(self)||e.mustQueue)return this.tasks[n]=e,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,e)}}process(){if(this.taskQueue.length===0)return;let r=this.taskQueue.shift(),e=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(r,e)}processTask(r,e){return l(this,void 0,void 0,(function*(){if(e.type==="<response>"){let c=this.resolveRejects[r];return delete this.resolveRejects[r],c?void(e.error?c.reject(lt(cc(e.error))):c.resolve(cc(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let n=cc(e.data),s=new AbortController;this.abortControllers[r]=s;try{let c=yield this.messageHandlers[e.type](e.sourceMapId,n,s);this.completeTask(r,null,c)}catch(c){this.completeTask(r,lt(c))}}))}completeTask(r,e,n){let s=[];delete this.abortControllers[r];let c={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Oa(e):null,data:Oa(n,s)};this.target.postMessage(c,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},y.O=function(){var r=new ce(16);return ce!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},y.P=D,y.Q=function(r,e,n){var s,c,d,m,_,x,b,S,w,A,E,R,I=n[0],O=n[1],F=n[2];return e===r?(r[12]=e[0]*I+e[4]*O+e[8]*F+e[12],r[13]=e[1]*I+e[5]*O+e[9]*F+e[13],r[14]=e[2]*I+e[6]*O+e[10]*F+e[14],r[15]=e[3]*I+e[7]*O+e[11]*F+e[15]):(c=e[1],d=e[2],m=e[3],_=e[4],x=e[5],b=e[6],S=e[7],w=e[8],A=e[9],E=e[10],R=e[11],r[0]=s=e[0],r[1]=c,r[2]=d,r[3]=m,r[4]=_,r[5]=x,r[6]=b,r[7]=S,r[8]=w,r[9]=A,r[10]=E,r[11]=R,r[12]=s*I+_*O+w*F+e[12],r[13]=c*I+x*O+A*F+e[13],r[14]=d*I+b*O+E*F+e[14],r[15]=m*I+S*O+R*F+e[15]),r},y.R=xr,y.S=function(r,e,n){var s=n[0],c=n[1],d=n[2];return r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r[3]=e[3]*s,r[4]=e[4]*c,r[5]=e[5]*c,r[6]=e[6]*c,r[7]=e[7]*c,r[8]=e[8]*d,r[9]=e[9]*d,r[10]=e[10]*d,r[11]=e[11]*d,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},y.T=V1,y.U=function(r,e,n){var s=e[0],c=e[1],d=e[2],m=e[3],_=e[4],x=e[5],b=e[6],S=e[7],w=e[8],A=e[9],E=e[10],R=e[11],I=e[12],O=e[13],F=e[14],V=e[15],U=n[0],j=n[1],H=n[2],X=n[3];return r[0]=U*s+j*_+H*w+X*I,r[1]=U*c+j*x+H*A+X*O,r[2]=U*d+j*b+H*E+X*F,r[3]=U*m+j*S+H*R+X*V,r[4]=(U=n[4])*s+(j=n[5])*_+(H=n[6])*w+(X=n[7])*I,r[5]=U*c+j*x+H*A+X*O,r[6]=U*d+j*b+H*E+X*F,r[7]=U*m+j*S+H*R+X*V,r[8]=(U=n[8])*s+(j=n[9])*_+(H=n[10])*w+(X=n[11])*I,r[9]=U*c+j*x+H*A+X*O,r[10]=U*d+j*b+H*E+X*F,r[11]=U*m+j*S+H*R+X*V,r[12]=(U=n[12])*s+(j=n[13])*_+(H=n[14])*w+(X=n[15])*I,r[13]=U*c+j*x+H*A+X*O,r[14]=U*d+j*b+H*E+X*F,r[15]=U*m+j*S+H*R+X*V,r},y.V=function(r,e){let n={};for(let s of e)s in r&&(n[s]=r[s]);return n},y.W=tl,y.X=vn,y.Y=p2,y.Z=d2,y._=l,y.a=zo,y.a$=function(r){var e=new ce(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e},y.a0=Oe,y.a1=Ue,y.a2=Hn,y.a3=kr,y.a4=m2,y.a5=a0,y.a6=Ke,y.a7=wp,y.a8=bc,y.a9=25,y.aA=function(r){var e=r[0],n=r[1];return Math.sqrt(e*e+n*n)},y.aB=function(r){return r[0]=0,r[1]=0,r},y.aC=function(r,e,n){return r[0]=e[0]*n,r[1]=e[1]*n,r},y.aD=f_,y.aE=nt,y.aF=function(r,e,n,s){let c=e.y-r.y,d=e.x-r.x,m=s.y-n.y,_=s.x-n.x,x=m*d-_*c;if(x===0)return null;let b=(_*(r.y-n.y)-m*(r.x-n.x))/x;return new D(r.x+b*d,r.y+b*c)},y.aG=J2,y.aH=Nu,y.aI=function(r){let e=1/0,n=1/0,s=-1/0,c=-1/0;for(let d of r)e=Math.min(e,d.x),n=Math.min(n,d.y),s=Math.max(s,d.x),c=Math.max(c,d.y);return[e,n,s,c]},y.aJ=un,y.aK=_t,y.aL=function(r,e,n,s,c=!1){if(!n[0]&&!n[1])return[0,0];let d=c?s==="map"?-r.bearingInRadians:0:s==="viewport"?r.bearingInRadians:0;if(d){let m=Math.sin(d),_=Math.cos(d);n=[n[0]*_-n[1]*m,n[0]*m+n[1]*_]}return[c?n[0]:_t(e,n[0],r.zoom),c?n[1]:_t(e,n[1],r.zoom)]},y.aN=p_,y.aO=U_,y.aP=d_,y.aQ=r=>r.type==="symbol",y.aR=Ym,y.aS=ii,y.aT=Xm,y.aU=$,y.aV=$e,y.aW=Pe,y.aX=Dn,y.aY=g2,y.aZ=Y,y.a_=Z,y.aa=v_,y.ab=r=>{let e=window.document.createElement("video");return e.muted=!0,new Promise((n=>{e.onloadstart=()=>{n(e)};for(let s of r){let c=window.document.createElement("source");Dt(s)||(e.crossOrigin="Anonymous"),c.src=s,e.appendChild(c)}}))},y.ac=Ve,y.ad=function(){return sn++},y.ae=p,y.af=Wu,y.ag=Mp,y.ah=Jl,y.ai=mo,y.aj=b2,y.ak=function(r){let e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((n,s,c,d)=>{let m=c||d;return e[s]=!m||m.toLowerCase(),""})),e["max-age"]){let n=parseInt(e["max-age"],10);isNaN(n)?delete e["max-age"]:e["max-age"]=n}return e},y.al=qt,y.am=85.051129,y.an=_i,y.ao=function(r){return Math.pow(2,r)},y.ap=de,y.aq=f2,y.ar=function(r){return Math.log(r)/Math.LN2},y.as=function(r){var e=r[0],n=r[1];return e*e+n*n},y.at=function(r){if(!r.length)return new Set;let e=Math.max(...r.map((x=>x.canonical.z))),n=1/0,s=-1/0,c=1/0,d=-1/0,m=[];for(let x of r){let{x:b,y:S,z:w}=x.canonical,A=Math.pow(2,e-w),E=b*A,R=S*A;m.push({id:x,x:E,y:R}),E<n&&(n=E),E>s&&(s=E),R<c&&(c=R),R>d&&(d=R)}let _=new Set;for(let x of m)x.x!==n&&x.x!==s&&x.y!==c&&x.y!==d||_.add(x.id);return _},y.au=function(r,e){let n=Math.abs(2*r.wrap)-+(r.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||s-n||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x},y.av=class{constructor(r,e){this.max=r,this.onRemove=e,this.reset()}reset(){for(let r in this.data)for(let e of this.data[r])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(r,e,n){let s=r.wrapped().key;this.data[s]===void 0&&(this.data[s]=[]);let c={value:e,timeout:void 0};if(n!==void 0&&(c.timeout=setTimeout((()=>{this.remove(r,c)}),n)),this.data[s].push(c),this.order.push(s),this.order.length>this.max){let d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){let e=this.data[r].shift();return e.timeout&&clearTimeout(e.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),e.value}getByKey(r){let e=this.data[r];return e?e[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,e){if(!this.has(r))return this;let n=r.wrapped().key,s=e===void 0?0:this.data[n].indexOf(e),c=this.data[n][s];return this.data[n].splice(s,1),c.timeout&&clearTimeout(c.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(c.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(r){let e=[];for(let n in this.data)for(let s of this.data[n])r(s.value)||e.push(s);for(let n of e)this.remove(n.value.tileID,n)}},y.aw=function(r,e){let n=0,s=0;if(r.kind==="constant")s=r.layoutSize;else if(r.kind!=="source"){let{interpolationType:c,minZoom:d,maxZoom:m}=r,_=c?qt(Vi.interpolationFactor(c,e,d,m),0,1):0;r.kind==="camera"?s=_r.number(r.minSize,r.maxSize,_):n=_}return{uSizeT:n,uSize:s}},y.ay=function(r,{uSize:e,uSizeT:n},{lowerSize:s,upperSize:c}){return r.kind==="source"?s/ts:r.kind==="composite"?_r.number(s/ts,c/ts,n):e},y.az=He,y.b=ki,y.b$=Ou,y.b0=function(r,e,n){return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],r},y.b1=function(r,e){var n=e[0],s=e[1],c=e[2],d=n*n+s*s+c*c;return d>0&&(d=1/Math.sqrt(d)),r[0]=e[0]*d,r[1]=e[1]*d,r[2]=e[2]*d,r},y.b2=ne,y.b3=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]},y.b4=function(r,e,n){return r[0]=e[0]*n[0],r[1]=e[1]*n[1],r[2]=e[2]*n[2],r[3]=e[3]*n[3],r},y.b5=Le,y.b6=function(r,e,n){let s=e[0]*n[0]+e[1]*n[1]+e[2]*n[2];return s===0?null:(-(r[0]*n[0]+r[1]*n[1]+r[2]*n[2])-n[3])/s},y.b7=De,y.b8=function(r,e,n){return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r},y.b9=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]},y.bA=Be,y.bB=function(r,e,n){var s=n[0],c=n[1],d=n[2],m=n[3],_=e[0],x=e[1],b=e[2],S=c*b-d*x,w=d*_-s*b,A=s*x-c*_;return r[0]=_+m*(S+=S)+c*(A+=A)-d*(w+=w),r[1]=x+m*w+d*S-s*A,r[2]=b+m*A+s*w-c*S,r},y.bC=function(r,e,n){let s=(c=[r[0],r[1],r[2],e[0],e[1],e[2],n[0],n[1],n[2]])[0]*((S=c[8])*(m=c[4])-(_=c[5])*(b=c[7]))+c[1]*(-S*(d=c[3])+_*(x=c[6]))+c[2]*(b*d-m*x);var c,d,m,_,x,b,S;if(s===0)return null;let w=ne([],[e[0],e[1],e[2]],[n[0],n[1],n[2]]),A=ne([],[n[0],n[1],n[2]],[r[0],r[1],r[2]]),E=ne([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),R=Y([],w,-r[3]);return Z(R,R,Y([],A,-e[3])),Z(R,R,Y([],E,-n[3])),Y(R,R,1/s),R},y.bD=y_,y.bE=function(){return new Float64Array(4)},y.bF=function(r,e,n,s){var c=[],d=[];return c[0]=e[0]-n[0],c[1]=e[1]-n[1],c[2]=e[2]-n[2],d[0]=c[0]*Math.cos(s)-c[1]*Math.sin(s),d[1]=c[0]*Math.sin(s)+c[1]*Math.cos(s),d[2]=c[2],r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},y.bG=function(r,e,n,s){var c=[],d=[];return c[0]=e[0]-n[0],c[1]=e[1]-n[1],c[2]=e[2]-n[2],d[0]=c[0],d[1]=c[1]*Math.cos(s)-c[2]*Math.sin(s),d[2]=c[1]*Math.sin(s)+c[2]*Math.cos(s),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},y.bH=function(r,e,n,s){var c=[],d=[];return c[0]=e[0]-n[0],c[1]=e[1]-n[1],c[2]=e[2]-n[2],d[0]=c[2]*Math.sin(s)+c[0]*Math.cos(s),d[1]=c[1],d[2]=c[2]*Math.cos(s)-c[0]*Math.sin(s),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},y.bI=function(r,e,n){var s=Math.sin(n),c=Math.cos(n),d=e[0],m=e[1],_=e[2],x=e[3],b=e[8],S=e[9],w=e[10],A=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=d*c-b*s,r[1]=m*c-S*s,r[2]=_*c-w*s,r[3]=x*c-A*s,r[8]=d*s+b*c,r[9]=m*s+S*c,r[10]=_*s+w*c,r[11]=x*s+A*c,r},y.bJ=function(r,e){let n=jt(r,360),s=jt(e,360),c=s-n,d=s>n?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},y.bK=function(r){return r[0]=0,r[1]=0,r[2]=0,r},y.bL=function(r,e,n,s){let c=Math.sqrt(r*r+e*e),d=Math.sqrt(n*n+s*s);r/=c,e/=c,n/=d,s/=d;let m=Math.acos(r*n+e*s);return-e*n+r*s>0?m:-m},y.bM=function(r,e){let n=jt(r,2*Math.PI),s=jt(e,2*Math.PI);return Math.min(Math.abs(n-s),Math.abs(n-s+2*Math.PI),Math.abs(n-s-2*Math.PI))},y.bN=function(){let r={},e=Ce.$version;for(let n in Ce.$root){let s=Ce.$root[n];if(s.required){let c=null;c=n==="version"?e:s.type==="array"?[]:{},c!=null&&(r[n]=c)}}return r},y.bO=Gi,y.bP=Gd,y.bQ=function r(e,n){if(Array.isArray(e)){if(!Array.isArray(n)||e.length!==n.length)return!1;for(let s=0;s<e.length;s++)if(!r(e[s],n[s]))return!1;return!0}if(typeof e=="object"&&e!==null&&n!==null){if(typeof n!="object"||Object.keys(e).length!==Object.keys(n).length)return!1;for(let s in e)if(!r(e[s],n[s]))return!1;return!0}return e===n},y.bR=Do,y.bS=function(r){r=r.slice();let e=Object.create(null);for(let n=0;n<r.length;n++)e[r[n].id]=r[n];for(let n=0;n<r.length;n++)"ref"in r[n]&&(r[n]=ld(r[n],e[r[n].ref]));return r},y.bT=function(r,e){if(r.type==="custom")return new kM(r,e);switch(r.type){case"background":return new IM(r,e);case"circle":return new KS(r,e);case"color-relief":return new n6(r,e);case"fill":return new y6(r,e);case"fill-extrusion":return new D6(r,e);case"heatmap":return new JS(r,e);case"hillshade":return new t6(r,e);case"line":return new iM(r,e);case"raster":return new I1(r,e);case"symbol":return new r0(r,e)}},y.bU=r=>r.type==="raster",y.bV=Xe,y.bW=function(r,e){if(!r)return[{command:"setStyle",args:[e]}];let n=[];try{if(!Vt(r.version,e.version))return[{command:"setStyle",args:[e]}];Vt(r.center,e.center)||n.push({command:"setCenter",args:[e.center]}),Vt(r.state,e.state)||n.push({command:"setGlobalState",args:[e.state]}),Vt(r.centerAltitude,e.centerAltitude)||n.push({command:"setCenterAltitude",args:[e.centerAltitude]}),Vt(r.zoom,e.zoom)||n.push({command:"setZoom",args:[e.zoom]}),Vt(r.bearing,e.bearing)||n.push({command:"setBearing",args:[e.bearing]}),Vt(r.pitch,e.pitch)||n.push({command:"setPitch",args:[e.pitch]}),Vt(r.roll,e.roll)||n.push({command:"setRoll",args:[e.roll]}),Vt(r.sprite,e.sprite)||n.push({command:"setSprite",args:[e.sprite]}),Vt(r.glyphs,e.glyphs)||n.push({command:"setGlyphs",args:[e.glyphs]}),Vt(r.transition,e.transition)||n.push({command:"setTransition",args:[e.transition]}),Vt(r.light,e.light)||n.push({command:"setLight",args:[e.light]}),Vt(r.terrain,e.terrain)||n.push({command:"setTerrain",args:[e.terrain]}),Vt(r.sky,e.sky)||n.push({command:"setSky",args:[e.sky]}),Vt(r.projection,e.projection)||n.push({command:"setProjection",args:[e.projection]});let s={},c=[];(function(m,_,x,b){let S;for(S in _=_||{},m=m||{})Object.prototype.hasOwnProperty.call(m,S)&&(Object.prototype.hasOwnProperty.call(_,S)||Ff(S,x,b));for(S in _)Object.prototype.hasOwnProperty.call(_,S)&&(Object.prototype.hasOwnProperty.call(m,S)?Vt(m[S],_[S])||(m[S].type==="geojson"&&_[S].type==="geojson"&&s1(m,_,S)?sr(x,{command:"setGeoJSONSourceData",args:[S,_[S].data]}):Nf(S,_,x,b)):Ro(S,_,x))})(r.sources,e.sources,c,s);let d=[];r.layers&&r.layers.forEach((m=>{"source"in m&&s[m.source]?n.push({command:"removeLayer",args:[m.id]}):d.push(m)})),n=n.concat(c),(function(m,_,x){_=_||[];let b=(m=m||[]).map(cd),S=_.map(cd),w=m.reduce(Uf,{}),A=_.reduce(Uf,{}),E=b.slice(),R=Object.create(null),I,O,F,V,U;for(let j=0,H=0;j<b.length;j++)I=b[j],Object.prototype.hasOwnProperty.call(A,I)?H++:(sr(x,{command:"removeLayer",args:[I]}),E.splice(E.indexOf(I,H),1));for(let j=0,H=0;j<S.length;j++)I=S[S.length-1-j],E[E.length-1-j]!==I&&(Object.prototype.hasOwnProperty.call(w,I)?(sr(x,{command:"removeLayer",args:[I]}),E.splice(E.lastIndexOf(I,E.length-H),1)):H++,V=E[E.length-j],sr(x,{command:"addLayer",args:[A[I],V]}),E.splice(E.length-j,0,I),R[I]=!0);for(let j=0;j<S.length;j++)if(I=S[j],O=w[I],F=A[I],!R[I]&&!Vt(O,F))if(Vt(O.source,F.source)&&Vt(O["source-layer"],F["source-layer"])&&Vt(O.type,F.type)){for(U in Xc(O.layout,F.layout,x,I,null,"setLayoutProperty"),Xc(O.paint,F.paint,x,I,null,"setPaintProperty"),Vt(O.filter,F.filter)||sr(x,{command:"setFilter",args:[I,F.filter]}),Vt(O.minzoom,F.minzoom)&&Vt(O.maxzoom,F.maxzoom)||sr(x,{command:"setLayerZoomRange",args:[I,F.minzoom,F.maxzoom]}),O)Object.prototype.hasOwnProperty.call(O,U)&&U!=="layout"&&U!=="paint"&&U!=="filter"&&U!=="metadata"&&U!=="minzoom"&&U!=="maxzoom"&&(U.indexOf("paint.")===0?Xc(O[U],F[U],x,I,U.slice(6),"setPaintProperty"):Vt(O[U],F[U])||sr(x,{command:"setLayerProperty",args:[I,U,F[U]]}));for(U in F)Object.prototype.hasOwnProperty.call(F,U)&&!Object.prototype.hasOwnProperty.call(O,U)&&U!=="layout"&&U!=="paint"&&U!=="filter"&&U!=="metadata"&&U!=="minzoom"&&U!=="maxzoom"&&(U.indexOf("paint.")===0?Xc(O[U],F[U],x,I,U.slice(6),"setPaintProperty"):Vt(O[U],F[U])||sr(x,{command:"setLayerProperty",args:[I,U,F[U]]}))}else sr(x,{command:"removeLayer",args:[I]}),V=E[E.lastIndexOf(I)+1],sr(x,{command:"addLayer",args:[F,V]})})(d,e.layers,n)}catch(s){console.warn("Unable to compute style diff:",s),n=[{command:"setStyle",args:[e]}]}return n},y.bX=function(r){let e=[],n=r.id;return n===void 0&&e.push({message:`layers.${n}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${n}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),e},y.bY=li,y.bZ=Ii,y.b_=class extends kn{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},y.ba=y2,y.bb=Ku,y.bc=function(r,e,n,s,c){var d=1/Math.tan(e/2);if(r[0]=d/n,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=d,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,c!=null&&c!==1/0){var m=1/(s-c);r[10]=(c+s)*m,r[14]=2*c*s*m}else r[10]=-1,r[14]=-2*s;return r},y.bd=function(r){var e=new ce(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},y.be=function(r,e,n){var s=Math.sin(n),c=Math.cos(n),d=e[0],m=e[1],_=e[2],x=e[3],b=e[4],S=e[5],w=e[6],A=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=d*c+b*s,r[1]=m*c+S*s,r[2]=_*c+w*s,r[3]=x*c+A*s,r[4]=b*c-d*s,r[5]=S*c-m*s,r[6]=w*c-_*s,r[7]=A*c-x*s,r},y.bf=function(r,e,n){var s=Math.sin(n),c=Math.cos(n),d=e[4],m=e[5],_=e[6],x=e[7],b=e[8],S=e[9],w=e[10],A=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=d*c+b*s,r[5]=m*c+S*s,r[6]=_*c+w*s,r[7]=x*c+A*s,r[8]=b*c-d*s,r[9]=S*c-m*s,r[10]=w*c-_*s,r[11]=A*c-x*s,r},y.bg=function(r,e){var n=e[0],s=e[1],c=e[2],d=e[3],m=e[4],_=e[5],x=e[6],b=e[7],S=e[8],w=e[9],A=e[10],E=e[11],R=e[12],I=e[13],O=e[14],F=e[15],V=n*_-s*m,U=n*x-c*m,j=n*b-d*m,H=s*x-c*_,X=s*b-d*_,ue=c*b-d*x,he=S*I-w*R,be=S*O-A*R,ge=S*F-E*R,Me=w*O-A*I,Ee=w*F-E*I,we=A*F-E*O,_e=V*we-U*Ee+j*Me+H*ge-X*be+ue*he;return _e?(r[0]=(_*we-x*Ee+b*Me)*(_e=1/_e),r[1]=(c*Ee-s*we-d*Me)*_e,r[2]=(I*ue-O*X+F*H)*_e,r[3]=(A*X-w*ue-E*H)*_e,r[4]=(x*ge-m*we-b*be)*_e,r[5]=(n*we-c*ge+d*be)*_e,r[6]=(O*j-R*ue-F*U)*_e,r[7]=(S*ue-A*j+E*U)*_e,r[8]=(m*Ee-_*ge+b*he)*_e,r[9]=(s*ge-n*Ee-d*he)*_e,r[10]=(R*X-I*j+F*V)*_e,r[11]=(w*j-S*X-E*V)*_e,r[12]=(_*be-m*Me-x*he)*_e,r[13]=(n*Me-s*be+c*he)*_e,r[14]=(I*U-R*H-O*V)*_e,r[15]=(S*H-w*U+A*V)*_e,r):null},y.bh=function(){let r=new Float32Array(16);return de(r),r},y.bi=function(){let r=new Float64Array(16);return de(r),r},y.bj=function(){return new Float64Array(16)},y.bk=function(r,e,n){let s=new Float64Array(4);return Be(s,r,e-90,n),s},y.bl=function(r,e,n,s){var c,d,m,_,x,b=e[0],S=e[1],w=e[2],A=e[3],E=n[0],R=n[1],I=n[2],O=n[3];return(d=b*E+S*R+w*I+A*O)<0&&(d=-d,E=-E,R=-R,I=-I,O=-O),1-d>ye?(c=Math.acos(d),m=Math.sin(c),_=Math.sin((1-s)*c)/m,x=Math.sin(s*c)/m):(_=1-s,x=s),r[0]=_*b+x*E,r[1]=_*S+x*R,r[2]=_*w+x*I,r[3]=_*A+x*O,r},y.bm=function(r){let e=new Float64Array(9);var n,s,c,d,m,_,x,b,S,w,A,E,R,I,O,F,V,U;w=(c=(s=r)[0])*(x=c+c),A=(d=s[1])*x,R=(m=s[2])*x,I=m*(b=d+d),F=(_=s[3])*x,V=_*b,U=_*(S=m+m),(n=e)[0]=1-(E=d*b)-(O=m*S),n[3]=A-U,n[6]=R+V,n[1]=A+U,n[4]=1-w-O,n[7]=I-F,n[2]=R-V,n[5]=I+F,n[8]=1-w-E;let j=Dn(-Math.asin(qt(e[2],-1,1))),H,X;return Math.hypot(e[5],e[8])<.001?(H=0,X=-Dn(Math.atan2(e[3],e[4]))):(H=Dn(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),X=Dn(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:H,pitch:j+90,bearing:X}},y.bn=function(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing},y.bo=pt,y.bp=Na,y.bq=Gu,y.br=fp,y.bs=qu,y.bt=Kt,y.bu=Qt,y.bv=Xn,y.bw=function(r,e,n,s,c){return Kt(s,c,qt((r-e)/(n-e),0,1))},y.bx=function(r,e,n,s){return r[0]=e[0]+n[0]*s,r[1]=e[1]+n[1]*s,r[2]=e[2]+n[2]*s,r},y.by=jt,y.bz=function(){return new Float64Array(3)},y.c=Gr,y.c$=Ql,y.c0=class extends kn{constructor(r,e){super(r,e),this.current=_a}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},y.c1=ho,y.c2=class extends kn{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},y.c3=class extends kn{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},y.c4=se,y.c5=function(r,e){var n=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=n,r[2]=0,r[3]=-n,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},y.c6=function(r,e,n){var s=e[0],c=e[1],d=e[2];return r[0]=s*n[0]+c*n[3]+d*n[6],r[1]=s*n[1]+c*n[4]+d*n[7],r[2]=s*n[2]+c*n[5]+d*n[8],r},y.c7=function(r,e,n,s,c,d,m){var _=1/(e-n),x=1/(s-c),b=1/(d-m);return r[0]=-2*_,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*x,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*b,r[11]=0,r[12]=(e+n)*_,r[13]=(c+s)*x,r[14]=(m+d)*b,r[15]=1,r},y.c8=class extends kn{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;let e=new Float32Array(4*r.length);for(let n=0;n<r.length;n++)e[4*n]=r[n].r,e[4*n+1]=r[n].g,e[4*n+2]=r[n].b,e[4*n+3]=r[n].a;this.gl.uniform4fv(this.location,e)}}},y.c9=class extends kn{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;let e=new Float32Array(r);this.gl.uniform1fv(this.location,e)}}},y.cA=function(r,e){return Qa[e]&&"touches"in r},y.cB=function(r){return Qa[r]||ha[r]},y.cC=function(r,e,n){var s=e[0],c=e[1];return r[0]=n[0]*s+n[4]*c+n[12],r[1]=n[1]*s+n[5]*c+n[13],r},y.cD=function(r,e){let{x:n,y:s}=wp.fromLngLat(e);return!(r<0||r>25||s<0||s>=1||n<0||n>=1)},y.cE=function(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},y.cF=class extends zu{},y.cG=Ut,y.cH=function(r,e){Gr.REGISTERED_PROTOCOLS[r]=e},y.cI=function(r){delete Gr.REGISTERED_PROTOCOLS[r]},y.cJ=function(r,e){let n={};for(let c=0;c<r.length;c++){let d=e&&e[r[c].id]||E1(r[c]);e&&(e[r[c].id]=d);let m=n[d];m||(m=n[d]=[]),m.push(r[c])}let s=[];for(let c in n)s.push(n[c]);return s},y.cK=Ye,y.cL=v2,y.cM=K2,y.cN=t2,y.cO=function(r){var e,n;r.bucket.createArrays(),r.bucket.tilePixelRatio=Ke/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;let s=r.bucket.layers[0],c=s.layout,d=s._unevaluatedLayout._values,m={layoutIconSize:d["icon-size"].possiblyEvaluate(new ti(r.bucket.zoom+1),r.canonical),layoutTextSize:d["text-size"].possiblyEvaluate(new ti(r.bucket.zoom+1),r.canonical),textMaxSize:d["text-size"].possiblyEvaluate(new ti(18))};if(r.bucket.textSizeData.kind==="composite"){let{minZoom:w,maxZoom:A}=r.bucket.textSizeData;m.compositeTextSizes=[d["text-size"].possiblyEvaluate(new ti(w),r.canonical),d["text-size"].possiblyEvaluate(new ti(A),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){let{minZoom:w,maxZoom:A}=r.bucket.iconSizeData;m.compositeIconSizes=[d["icon-size"].possiblyEvaluate(new ti(w),r.canonical),d["icon-size"].possiblyEvaluate(new ti(A),r.canonical)]}let _=c.get("text-line-height")*un,x=c.get("text-rotation-alignment")!=="viewport"&&c.get("symbol-placement")!=="point",b=c.get("text-keep-upright"),S=c.get("text-size");for(let w of r.bucket.features){let A=c.get("text-font").evaluate(w,{},r.canonical).join(","),E=S.evaluate(w,{},r.canonical),R=m.layoutTextSize.evaluate(w,{},r.canonical),I=m.layoutIconSize.evaluate(w,{},r.canonical),O={horizontal:{},vertical:void 0},F=w.text,V,U=[0,0];if(F){let X=F.toString(),ue=c.get("text-letter-spacing").evaluate(w,{},r.canonical)*un,he=Mu(X)?ue:0,be=c.get("text-anchor").evaluate(w,{},r.canonical),ge=uw(s,w,r.canonical);if(!ge){let _e=c.get("text-radial-offset").evaluate(w,{},r.canonical);U=_e?cw(be,[_e*un,N_]):c.get("text-offset").evaluate(w,{},r.canonical).map((Fe=>Fe*un))}let Me=x?"center":c.get("text-justify").evaluate(w,{},r.canonical),Ee=c.get("symbol-placement")==="point"?c.get("text-max-width").evaluate(w,{},r.canonical)*un:1/0,we=()=>{r.bucket.allowVerticalPlacement&&Zd(X)&&(O.vertical=i0(F,r.glyphMap,r.glyphPositions,r.imagePositions,A,Ee,_,be,"left",he,U,y.ax.vertical,!0,R,E))};if(!x&&ge){let _e=new Set;if(Me==="auto")for(let Ge=0;Ge<ge.values.length;Ge+=2)_e.add(U_(ge.values[Ge]));else _e.add(Me);let Fe=!1;for(let Ge of _e)if(!O.horizontal[Ge])if(Fe)O.horizontal[Ge]=O.horizontal[0];else{let je=i0(F,r.glyphMap,r.glyphPositions,r.imagePositions,A,Ee,_,"center",Ge,he,U,y.ax.horizontal,!1,R,E);je&&(O.horizontal[Ge]=je,Fe=je.positionedLines.length===1)}we()}else{Me==="auto"&&(Me=U_(be));let _e=i0(F,r.glyphMap,r.glyphPositions,r.imagePositions,A,Ee,_,be,Me,he,U,y.ax.horizontal,!1,R,E);_e&&(O.horizontal[Me]=_e),we(),Zd(X)&&x&&b&&(O.vertical=i0(F,r.glyphMap,r.glyphPositions,r.imagePositions,A,Ee,_,be,Me,he,U,y.ax.vertical,!1,R,E))}}let j=!1;if(!((e=w.icon)===null||e===void 0)&&e.name){let X=r.imageMap[w.icon.name];X&&(V=zM(r.imagePositions[w.icon.name],c.get("icon-offset").evaluate(w,{},r.canonical),c.get("icon-anchor").evaluate(w,{},r.canonical)),j=!!X.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=j:r.bucket.sdfIcons!==j&&Gt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(X.pixelRatio!==r.bucket.pixelRatio||c.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}let H=dw(O.horizontal)||O.vertical;(n=r.bucket).iconsInText||(n.iconsInText=!!H&&H.iconsInText),(H||V)&&TE(r.bucket,w,O,V,r.imageMap,m,R,I,U,j,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},y.cP=Z1,y.cQ=$1,y.cR=c_,y.cS=function(r,e=""){let n=new t0;return(function(s,c,d=""){for(let m in s.layers)c.writeMessage(3,((_,x)=>cE(_,x,d)),s.layers[m])})(r,n,e),n.finish()},y.cT=function(r,e,n,s,c,d){let m=ew(r,e,n,c,0);return m=ew(m,e,s,d,1),m},y.cU=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){let e=this.map.get(r);return e!==void 0&&(this.map.delete(r),this.map.set(r,e)),e}set(r,e){if(this.map.has(r))this.map.delete(r);else if(this.map.size>=this.maxEntries){let n=this.map.keys().next().value;this.map.delete(n)}this.map.set(r,e)}clear(){this.map.clear()}},y.cV=Sx,y.cW=t0,y.cX=Y2,y.cY=function(r,e,n,s,c){return l(this,void 0,void 0,(function*(){if(Ue())try{return yield Hn(r,e,n,s,c)}catch{}return(function(d,m,_,x,b){let S=d.width,w=d.height;Si&&Ki||(Si=new OffscreenCanvas(S,w),Ki=Si.getContext("2d",{willReadFrequently:!0})),Si.width=S,Si.height=w,Ki.drawImage(d,0,0,S,w);let A=Ki.getImageData(m,_,x,b);return Ki.clearRect(0,0,S,w),A.data})(r,e,n,s,c)}))},y.cZ=dx,y.c_=class{constructor(r,e){this.layers={[Mp]:this},this.name=Mp,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=r.length,this.features=r}feature(r){return new lE(this.features[r],this.extent)}},y.ca=class extends Ko{},y.cb=oM,y.cc=class extends _c{},y.cd=U1,y.ce=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},y.cf=lx,y.cg=function(r,e,n){var s=e[0],c=e[1],d=e[2],m=n[3]*s+n[7]*c+n[11]*d+n[15];return r[0]=(n[0]*s+n[4]*c+n[8]*d+n[12])/(m=m||1),r[1]=(n[1]*s+n[5]*c+n[9]*d+n[13])/m,r[2]=(n[2]*s+n[6]*c+n[10]*d+n[14])/m,r},y.ch=class extends Du{},y.ci=class extends t{},y.cj=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]},y.ck=function(r,e){var n=r[0],s=r[1],c=r[2],d=r[3],m=r[4],_=r[5],x=r[6],b=r[7],S=r[8],w=r[9],A=r[10],E=r[11],R=r[12],I=r[13],O=r[14],F=r[15],V=e[0],U=e[1],j=e[2],H=e[3],X=e[4],ue=e[5],he=e[6],be=e[7],ge=e[8],Me=e[9],Ee=e[10],we=e[11],_e=e[12],Fe=e[13],Ge=e[14],je=e[15];return Math.abs(n-V)<=ye*Math.max(1,Math.abs(n),Math.abs(V))&&Math.abs(s-U)<=ye*Math.max(1,Math.abs(s),Math.abs(U))&&Math.abs(c-j)<=ye*Math.max(1,Math.abs(c),Math.abs(j))&&Math.abs(d-H)<=ye*Math.max(1,Math.abs(d),Math.abs(H))&&Math.abs(m-X)<=ye*Math.max(1,Math.abs(m),Math.abs(X))&&Math.abs(_-ue)<=ye*Math.max(1,Math.abs(_),Math.abs(ue))&&Math.abs(x-he)<=ye*Math.max(1,Math.abs(x),Math.abs(he))&&Math.abs(b-be)<=ye*Math.max(1,Math.abs(b),Math.abs(be))&&Math.abs(S-ge)<=ye*Math.max(1,Math.abs(S),Math.abs(ge))&&Math.abs(w-Me)<=ye*Math.max(1,Math.abs(w),Math.abs(Me))&&Math.abs(A-Ee)<=ye*Math.max(1,Math.abs(A),Math.abs(Ee))&&Math.abs(E-we)<=ye*Math.max(1,Math.abs(E),Math.abs(we))&&Math.abs(R-_e)<=ye*Math.max(1,Math.abs(R),Math.abs(_e))&&Math.abs(I-Fe)<=ye*Math.max(1,Math.abs(I),Math.abs(Fe))&&Math.abs(O-Ge)<=ye*Math.max(1,Math.abs(O),Math.abs(Ge))&&Math.abs(F-je)<=ye*Math.max(1,Math.abs(F),Math.abs(je))},y.cl=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},y.cm=r=>r.type==="circle",y.cn=r=>r.type==="heatmap",y.co=r=>r.type==="line",y.cp=r=>r.type==="fill",y.cq=r=>r.type==="fill-extrusion",y.cr=r=>r.type==="hillshade",y.cs=r=>r.type==="color-relief",y.ct=r=>r.type==="background",y.cu=r=>r.type==="custom",y.cv=Gn,y.cw=function(r,e,n){if(e<=0)return r;let s=1/e;return n===void 0||Math.abs(n)<1e-10?Math.round(r*s)/s:(n>0?Math.ceil(r*s-1e-9):Math.floor(r*s+1e-10))/s},y.cx=function(r,e,n){let s=We(e.x-n.x,e.y-n.y),c=We(r.x-n.x,r.y-n.y);var d,m;return Dn(Math.atan2(s[0]*c[1]-s[1]*c[0],(d=s)[0]*(m=c)[0]+d[1]*m[1]))},y.cy=ot,y.cz=function(r,e){var n;if(!ha[e])return!1;let s=r?.target,c=((n=s?.ownerDocument)===null||n===void 0?void 0:n.defaultView)||window;return r instanceof c.MouseEvent||r instanceof c.WheelEvent},y.d=lt,y.d0=class{constructor(r,e){let n=(e=this.options=Object.assign({},Y6,e)).debug;if(n&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let s=Q1(r,e);n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),s=i_(s,e),e.updateable&&(this.source=s),this.initializeIndex(s,e)}initializeIndex(r,e){this.tileIndex=e.cluster?new j6(e.clusterOptions):new X6(e),r.length&&this.tileIndex.initialize(r)}getTile(r,e,n){return e=+e,n=+n,(r=+r)<0||r>24?null:this.tileIndex.getTile(r,e,n)}updateData(r,e){let n=this.options;if(!n.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:s,source:c}=(function(d,m,_){let x=(function(S,w){return S?{removeAll:S.removeAll,remove:new Set(S.remove||[]),add:new Map(S.add?.map((A=>[w.promoteId?A.properties[w.promoteId]:A.id,A]))),update:new Map(S.update?.map((A=>[A.id,A])))}:{remove:new Set,add:new Map,update:new Map}})(m,_),b=[];if(x.removeAll&&(b=d,d=[]),x.remove.size||x.add.size){let S=[];for(let w of d)(x.remove.has(w.id)||x.add.has(w.id))&&S.push(w);if(S.length){b.push(...S);let w=new Set(S.map((A=>A.id)));d=d.filter((A=>!w.has(A.id)))}if(x.add.size){let w=Q1({type:"FeatureCollection",features:Array.from(x.add.values())},_);w=i_(w,_),b.push(...w),d.push(...w)}}if(x.update.size){let S=new Map,w=[];for(let A of d)x.update.has(A.id)?S.set(A.id,[...S.get(A.id)||[],A]):w.push(A);for(let[A,E]of x.update){let R=S.get(A);if(!R||R.length===0)continue;let I=V6(R,E,_);b.push(...R,...I),w.push(...I)}d=w}return{affected:b,source:d}})(this.source,r,n);e&&({affected:s,source:c}=this.filterUpdate(c,s,e)),s.length&&(this.source=c,this.tileIndex.updateIndex(c,s,n))}filterUpdate(r,e,n){let s=new Set;for(let c of r)c.id!=null&&(n(Km(c))||(e.push(c),s.add(c.id)));return{affected:e,source:r=r.filter((c=>!s.has(c.id)))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map((r=>Km(r)))}}updateClusterOptions(r,e){let n=this.options.cluster;this.options.cluster=r,this.options.clusterOptions=e,n!=r?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(r){return this.tileIndex.getClusterExpansionZoom(r)}getClusterChildren(r){return this.tileIndex.getChildren(r)}getClusterLeaves(r,e,n){return this.tileIndex.getLeaves(r,e,n)}},y.d1=Ba,y.e=pi,y.f=Dt,y.g=Zr,y.h=r=>l(void 0,void 0,void 0,(function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));let e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(n){throw new Error(`Could not load image because of ${lt(n).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),y.i=zt,y.j=r=>new Promise(((e,n)=>{let s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>s.src=Zn))},s.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let c=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(c):Zn})),y.k=(r,e)=>xn(pi(r,{type:"json"}),e),y.l=eo,y.m=xn,y.n=Ja,y.o=(r,e)=>xn(pi(r,{type:"arrayBuffer"}),e),y.p=e2,y.q=function(r){return new t0(r).readFields(xM,[])},y.r=function(r){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))},y.s=xt,y.t=cp,y.u=Yn,y.v=oc,y.w=Gt,y.x=Ce,y.y=Kd,y.z=vr})),u("worker",["./shared"],(function(y){"use strict";class l{constructor(Z,Y){this.keyCache={},Z&&this.replace(Z,Y)}replace(Z,Y){this._layerConfigs={},this._layers={},this.update(Z,[],Y)}update(Z,Y,ne){for(let De of Z){this._layerConfigs[De.id]=De;let nt=this._layers[De.id]=y.bT(De,ne);nt._featureFilter=y.ah(nt.filter,ne),this.keyCache[De.id]&&delete this.keyCache[De.id]}for(let De of Y)delete this.keyCache[De],delete this._layerConfigs[De],delete this._layers[De];this.familiesBySource={};let xe=y.cJ(Object.values(this._layerConfigs),this.keyCache);for(let De of xe){let nt=De.map((_t=>this._layers[_t.id])),ze=nt[0];if(ze.isHidden())continue;let Be=ze.source||"",He=this.familiesBySource[Be];He||(He=this.familiesBySource[Be]={});let We=ze.sourceLayer||y.ag,Ke=He[We];Ke||(Ke=He[We]=[]),Ke.push(nt)}}}class D{constructor(Z){let Y={},ne=[];for(let ze in Z){let Be=Z[ze],He=Y[ze]={};for(let We in Be){let Ke=Be[+We];if(!Ke||Ke.bitmap.width===0||Ke.bitmap.height===0)continue;let _t={x:0,y:0,w:Ke.bitmap.width+2,h:Ke.bitmap.height+2};ne.push(_t),He[We]={rect:_t,metrics:Ke.metrics}}}let{w:xe,h:De}=y.p(ne),nt=new y.t({width:xe||1,height:De||1});for(let ze in Z){let Be=Z[ze];for(let He in Be){let We=Be[+He];if(!We||We.bitmap.width===0||We.bitmap.height===0)continue;let Ke=Y[ze][He].rect;y.t.copy(We.bitmap,nt,{x:0,y:0},{x:Ke.x+1,y:Ke.y+1},We.bitmap)}}this.image=nt,this.positions=Y}}y.cK("GlyphAtlas",D);class B{constructor(Z){this.tileID=new y.a3(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),this.uid=Z.uid,this.zoom=Z.zoom,this.pixelRatio=Z.pixelRatio,this.tileSize=Z.tileSize,this.source=Z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Z.showCollisionBoxes,this.collectResourceTiming=!!Z.collectResourceTiming,this.returnDependencies=!!Z.returnDependencies,this.promoteId=Z.promoteId,this.inFlightDependencies=[]}parse(Z,Y,ne,xe,De){return y._(this,void 0,void 0,(function*(){this.status="parsing",this.data=Z,this.collisionBoxArray=new y.ae;let nt=new y.cL(Object.keys(Z.layers).sort()),ze=new y.cM(this.tileID,this.promoteId);ze.bucketLayerIDs=[];let Be={},He={featureIndex:ze,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:ne,subdivisionGranularity:De},We=Y.familiesBySource[this.source];for(let Xe in We){let ft=Z.layers[Xe];if(!ft)continue;ft.version===1&&y.w(`Vector tile source "${this.source}" layer "${Xe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let Gt=nt.encode(Xe),ci=[];for(let zt=0;zt<ft.length;zt++){let Nt=ft.feature(zt),ki=ze.getId(Nt,Xe);ci.push({feature:Nt,id:ki,index:zt,sourceLayerIndex:Gt})}for(let zt of We[Xe]){let Nt=zt[0];Nt.source!==this.source&&y.w(`layer.source = ${Nt.source} does not equal this.source = ${this.source}`),Nt.isHidden(this.zoom,!0)||(q(zt,this.zoom,ne),(Be[Nt.id]=Nt.createBucket({index:ze.bucketLayerIDs.length,layers:zt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Gt,sourceID:this.source})).populate(ci,He,this.tileID.canonical),ze.bucketLayerIDs.push(zt.map((ki=>ki.id))))}}let Ke=y.bY(He.glyphDependencies,(Xe=>Object.keys(Xe).map(Number)));for(let Xe of this.inFlightDependencies)Xe?.abort();this.inFlightDependencies=[];let _t=Promise.resolve({});if(Object.keys(Ke).length){let Xe=new AbortController;this.inFlightDependencies.push(Xe),_t=xe.sendAsync({type:"GG",data:{stacks:Ke,source:this.source,tileID:this.tileID,type:"glyphs"}},Xe)}let lt=Object.keys(He.iconDependencies),jt=Promise.resolve({});if(lt.length){let Xe=new AbortController;this.inFlightDependencies.push(Xe),jt=xe.sendAsync({type:"GI",data:{icons:lt,source:this.source,tileID:this.tileID,type:"icons"}},Xe)}let Kt=Object.keys(He.patternDependencies),Qt=Promise.resolve({});if(Kt.length){let Xe=new AbortController;this.inFlightDependencies.push(Xe),Qt=xe.sendAsync({type:"GI",data:{icons:Kt,source:this.source,tileID:this.tileID,type:"patterns"}},Xe)}let Gn=He.dashDependencies,ot=Promise.resolve({});if(Object.keys(Gn).length){let Xe=new AbortController;this.inFlightDependencies.push(Xe),ot=xe.sendAsync({type:"GDA",data:{dashes:Gn}},Xe)}let[qt,vn,pi,sn]=yield Promise.all([_t,jt,Qt,ot]),li=new D(qt),Ii=new y.cN(vn,pi);for(let Xe in Be){let ft=Be[Xe];ft instanceof y.af?(q(ft.layers,this.zoom,ne),y.cO({bucket:ft,glyphMap:qt,glyphPositions:li.positions,imageMap:vn,imagePositions:Ii.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:He.subdivisionGranularity})):ft.hasDependencies&&(ft instanceof y.cP||ft instanceof y.cQ||ft instanceof y.cR)&&(q(ft.layers,this.zoom,ne),ft.addFeatures(He,this.tileID.canonical,Ii.patternPositions,sn))}return this.status="done",{buckets:Object.values(Be).filter((Xe=>!Xe.isEmpty())),featureIndex:ze,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:li.image,imageAtlas:Ii,dashPositions:sn,glyphMap:this.returnDependencies?qt:null,iconMap:this.returnDependencies?vn:null,glyphPositions:this.returnDependencies?li.positions:null}}))}}function q(Re,Z,Y){let ne=new y.J(Z);for(let xe of Re)xe.recalculate(ne,Y)}class K{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(Z,Y){this.loading[Z]=Y}finishLoading(Z){delete this.loading[Z]}abort(Z){let Y=this.loading[Z];Y?.abort&&(Y.abort.abort(),delete this.loading[Z])}setParsing(Z,Y){this.parsing[Z]=Y}consumeParsing(Z){let Y=this.parsing[Z];if(Y)return delete this.parsing[Z],Y}clearParsing(Z){delete this.parsing[Z]}markLoaded(Z,Y){this.loaded[Z]=Y}getLoaded(Z){let Y=this.loaded[Z];if(Y)return Y}removeLoaded(Z){delete this.loaded[Z]}clearLoaded(){this.loaded={}}}class fe{constructor(Z){this.start=`${Z}#start`,this.end=`${Z}#end`,this.measure=Z,performance.mark(this.start)}finish(){performance.mark(this.end);let Z=performance.getEntriesByName(this.measure);return Z.length===0&&(performance.measure(this.measure,this.start,this.end),Z=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),Z}}class pe{constructor(Z,Y,ne,xe,De){this.type=Z,this.properties=ne||{},this.extent=De,this.pointsArray=Y,this.id=xe}loadGeometry(){return this.pointsArray.map((Z=>Z.map((Y=>new y.P(Y.x,Y.y)))))}}class oe{constructor(Z,Y,ne){this.version=2,this._myFeatures=Z,this.name=Y,this.length=Z.length,this.extent=ne}feature(Z){return this._myFeatures[Z]}}class le{constructor(){this.layers={}}addLayer(Z){this.layers[Z.name]=Z}}function Oe(Re){let Z=y.cS(Re);return Z.byteOffset===0&&Z.byteLength===Z.buffer.byteLength||(Z=new Uint8Array(Z)),{vectorTile:Re,rawData:Z.buffer}}function Ue(Re,Z,Y){let{extent:ne}=Re,xe=Math.pow(2,Y.z-Z.z),De=(Y.x-Z.x*xe)*ne,nt=(Y.y-Z.y*xe)*ne,ze=[];for(let Be=0;Be<Re.length;Be++){let He=Re.feature(Be),We=He.loadGeometry();for(let _t of We)for(let lt of _t)lt.x=lt.x*xe-De,lt.y=lt.y*xe-nt;let Ke=128;We=y.cT(We,He.type,-Ke,-Ke,ne+Ke,ne+Ke),We.length!==0&&ze.push(new pe(He.type,We,He.properties,He.id,ne))}return new oe(ze,Re.name,ne)}class ye{constructor(Z,Y,ne){this.actor=Z,this.layerIndex=Y,this.availableImages=ne,this.tileState=new K,this.overzoomedTileResultCache=new y.cU(1e3)}loadVectorTile(Z,Y){try{return{vectorTile:Z.encoding!=="mlt"?new y.cV(new y.cW(Y)):new y.cX(Y),rawData:Y}}catch(ne){let xe=new Uint8Array(Y),De=`Unable to parse the tile at ${Z.request.url}, `;throw De+=xe[0]===31&&xe[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${y.d(ne).message}`,new Error(De)}}loadTile(Z){return y._(this,void 0,void 0,(function*(){let{uid:Y,overzoomParameters:ne}=Z;ne&&(Z.request=ne.overzoomRequest);let xe=this._startRequestTiming(Z),De=new B(Z);this.tileState.startLoading(Y,De);let nt=new AbortController;De.abort=nt;try{let ze=yield y.o(Z.request,nt);if(Z.etag&&Z.etag===ze.etag)return this.tileState.finishLoading(Y),this._getEtagUnmodifiedResult(ze,xe);let Be=this.loadVectorTile(Z,ze.data);if(this.tileState.finishLoading(Y),!Be)return null;let{vectorTile:He,rawData:We}=Be;ne&&({vectorTile:He,rawData:We}=this._getOverzoomTile(Z,He));let Ke=this._getExpiryData(ze),_t=this._finishRequestTiming(xe);De.vectorTile=He,this.tileState.markLoaded(Y,De);let lt={rawData:We,cacheControl:Ke,resourceTiming:_t};this.tileState.setParsing(Y,lt);try{return yield this._parseWorkerTile(De,Z,lt)}finally{this.tileState.clearParsing(Y)}}catch(ze){throw this.tileState.finishLoading(Y),De.status="done",this.tileState.markLoaded(Y,De),ze}}))}_getEtagUnmodifiedResult(Z,Y){let ne=this._getExpiryData(Z),xe=this._finishRequestTiming(Y);return y.e({etagUnmodified:!0},ne,xe)}_parseWorkerTile(Z,Y,ne){return y._(this,void 0,void 0,(function*(){let xe=yield Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor,Y.subdivisionGranularity);if(ne){let{rawData:De,cacheControl:nt,resourceTiming:ze}=ne;xe=y.e({rawTileData:De.slice(0),encoding:Y.encoding},xe,nt,ze)}return xe}))}_getExpiryData({expires:Z,cacheControl:Y,etag:ne}){let xe={};return Z&&(xe.expires=Z),Y&&(xe.cacheControl=Y),ne&&(xe.etag=ne),xe}_startRequestTiming(Z){var Y;if(!((Y=Z.request)===null||Y===void 0)&&Y.collectResourceTiming)return new fe(Z.request.url)}_finishRequestTiming(Z){let Y=Z?.finish();return Y?{resourceTiming:JSON.parse(JSON.stringify(Y))}:{}}_getOverzoomTile(Z,Y){var ne;let{tileID:xe,source:De,overzoomParameters:nt}=Z,{maxZoomTileID:ze}=nt,Be=`${ze.key}_${xe.key}_${(ne=Z.request)===null||ne===void 0?void 0:ne.url}`,He=this.overzoomedTileResultCache.get(Be);if(He)return He;let We=new le,Ke=this.layerIndex.familiesBySource[De];for(let lt in Ke){let jt=Y.layers[lt];if(!jt)continue;let Kt=Ue(jt,ze,xe.canonical);Kt.length>0&&We.addLayer(Kt)}let _t=Oe(We);return this.overzoomedTileResultCache.set(Be,_t),_t}reloadTile(Z){return y._(this,void 0,void 0,(function*(){let Y=Z.uid,ne=this.tileState.getLoaded(Y);if(!ne)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(ne.showCollisionBoxes=Z.showCollisionBoxes,ne.status==="parsing"){let xe=this.tileState.consumeParsing(Y);return yield this._parseWorkerTile(ne,Z,xe)}if(ne.status==="done"&&ne.vectorTile)return yield this._parseWorkerTile(ne,Z)}))}abortTile(Z){return y._(this,void 0,void 0,(function*(){this.tileState.abort(Z.uid)}))}removeTile(Z){return y._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(Z.uid)}))}}class ce{constructor(){this.loaded={}}loadTile(Z){return y._(this,void 0,void 0,(function*(){let{uid:Y,encoding:ne,rawImageData:xe,redFactor:De,greenFactor:nt,blueFactor:ze,baseShift:Be}=Z,He=xe.width+2,We=xe.height+2,Ke=y.b(xe)?new y.R({width:He,height:We},yield y.cY(xe,-1,-1,He,We)):xe,_t=new y.cZ(Y,Ke,ne,De,nt,ze,Be);return this.loaded||(this.loaded={}),this.loaded[Y]=_t,_t}))}removeTile(Z){let Y=this.loaded,ne=Z.uid;Y?.[ne]&&delete Y[ne]}}class se{constructor(Z,Y,ne,xe=de){this.actor=Z,this.layerIndex=Y,this.availableImages=ne,this.tileState=new K,this._createGeoJSONIndex=xe}loadVectorTile(Z){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let{z:Y,x:ne,y:xe}=Z.tileID.canonical,De=this._geoJSONIndex.getTile(Y,ne,xe);return De?Oe(new y.c_(De.features,{version:2,extent:y.a6})):null}loadTile(Z){return y._(this,void 0,void 0,(function*(){let{uid:Y}=Z,ne=new B(Z);ne.abort=new AbortController;try{let xe=this.loadVectorTile(Z);if(!xe)return null;let{vectorTile:De,rawData:nt}=xe;ne.vectorTile=De,this.tileState.markLoaded(Y,ne);let ze={rawData:nt};this.tileState.setParsing(Y,ze);try{return yield this._parseWorkerTile(ne,Z,ze)}finally{this.tileState.clearParsing(Y)}}catch(xe){throw ne.status="done",this.tileState.markLoaded(Y,ne),xe}}))}_reloadLoadedTile(Z){return y._(this,void 0,void 0,(function*(){let Y=Z.uid,ne=this.tileState.getLoaded(Y);if(!ne)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(ne.showCollisionBoxes=Z.showCollisionBoxes,ne.status==="parsing"){let xe=this.tileState.consumeParsing(Y);return yield this._parseWorkerTile(ne,Z,xe)}if(ne.status==="done"&&ne.vectorTile)return yield this._parseWorkerTile(ne,Z)}))}_parseWorkerTile(Z,Y,ne){return y._(this,void 0,void 0,(function*(){let xe=yield Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor,Y.subdivisionGranularity);if(ne){let{rawData:De}=ne;xe=y.e({rawTileData:De.slice(0),encoding:"mvt"},xe)}return xe}))}abortTile(Z){return y._(this,void 0,void 0,(function*(){this.tileState.abort(Z.uid)}))}removeTile(Z){return y._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(Z.uid)}))}loadData(Z){return y._(this,void 0,void 0,(function*(){var Y;(Y=this._pendingRequest)===null||Y===void 0||Y.abort();let ne=this._startRequestTiming(Z);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(Z,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let xe={};return Z.request&&(xe.data=Z.data),this._finishRequestTiming(ne,Z,xe),xe}catch(xe){if(delete this._pendingRequest,!y.$(xe))throw xe;return{abandoned:!0}}}))}_startRequestTiming(Z){var Y;if(!((Y=Z.request)===null||Y===void 0)&&Y.collectResourceTiming)return new fe(Z.request.url)}_finishRequestTiming(Z,Y,ne){let xe=Z?.finish();xe&&(ne.resourceTiming={[Y.source]:JSON.parse(JSON.stringify(xe))})}reloadTile(Z){return this.tileState.getLoaded(Z.uid)?this._reloadLoadedTile(Z):this.loadTile(Z)}loadAndProcessGeoJSON(Z,Y){return y._(this,void 0,void 0,(function*(){var ne;if(Z.request&&(Z.data=(yield y.k(Z.request,Y)).data),Z.data)return Z.data=this._filterGeoJSON(Z.data,Z.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(Z.data,Z));if(Z.dataDiff)return(ne=this._geoJSONIndex)!==null&&ne!==void 0||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},Z)),void this._geoJSONIndex.updateData(Z.dataDiff,this._getFilterPredicate(Z.filter));if(Z.updateCluster&&this._geoJSONIndex.updateClusterOptions(Z.geojsonVtOptions.cluster,ve(Z)),this._geoJSONIndex==null)throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(Z,Y){if(Z.type!=="FeatureCollection")return Z;let ne=this._getFilterPredicate(Y);return ne?{type:"FeatureCollection",features:Z.features.filter((xe=>ne(xe)))}:Z}_getFilterPredicate(Z){if(typeof Z!="boolean"&&!Z?.length)return;let Y=y.c$(Z,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Y.result==="error")throw new Error(Y.value.map((ne=>`${ne.key}: ${ne.message}`)).join(", "));return ne=>Y.value.evaluate({zoom:0},ne)}removeSource(Z){return y._(this,void 0,void 0,(function*(){var Y;(Y=this._pendingRequest)===null||Y===void 0||Y.abort()}))}getClusterExpansionZoom(Z){return this._geoJSONIndex.getClusterExpansionZoom(Z.clusterId)}getClusterChildren(Z){return this._geoJSONIndex.getClusterChildren(Z.clusterId)}getClusterLeaves(Z){return this._geoJSONIndex.getClusterLeaves(Z.clusterId,Z.limit,Z.offset)}}function de(Re,Z){let Y=y.e(Z.geojsonVtOptions||{},{updateable:!0,clusterOptions:ve(Z)});return new y.d0(Re,Y)}function ve({geojsonVtOptions:Re,clusterProperties:Z}){if(!Z||!Re.clusterOptions)return Re.clusterOptions;let Y={},ne={},xe={accumulated:null,zoom:0},De={properties:null},nt=Object.keys(Z);for(let ze of nt){let[Be,He]=Z[ze],We=y.c$(He),Ke=y.c$(typeof Be=="string"?[Be,["accumulated"],["get",ze]]:Be);Y[ze]=We.value,ne[ze]=Ke.value}return Re.clusterOptions.map=ze=>{De.properties=ze;let Be={};for(let He of nt)Be[He]=Y[He].evaluate(xe,De);return Be},Re.clusterOptions.reduce=(ze,Be)=>{De.properties=Be;for(let He of nt)xe.accumulated=ze[He],ze[He]=ne[He].evaluate(xe,De)},Re.clusterOptions}class Le{constructor(Z){this.self=Z,this.actor=new y.N(Z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(Y,ne)=>{if(this.externalWorkerSourceTypes[Y])throw new Error(`Worker source with name "${Y}" already registered.`);this.externalWorkerSourceTypes[Y]=ne},this.self.addProtocol=y.cH,this.self.removeProtocol=y.cI,this.self.registerRTLTextPlugin=Y=>{y.d1.setMethods(Y)},this.self.makeRequest=y.m,this.actor.registerMessageHandler("LDT",((Y,ne)=>this._getDEMWorkerSource(Y,ne.source).loadTile(ne))),this.actor.registerMessageHandler("RDT",((Y,ne)=>y._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(Y,ne.source).removeTile(ne)})))),this.actor.registerMessageHandler("GCEZ",((Y,ne)=>y._(this,void 0,void 0,(function*(){return this._getWorkerSource(Y,ne.type,ne.source).getClusterExpansionZoom(ne)})))),this.actor.registerMessageHandler("GCC",((Y,ne)=>y._(this,void 0,void 0,(function*(){return this._getWorkerSource(Y,ne.type,ne.source).getClusterChildren(ne)})))),this.actor.registerMessageHandler("GCL",((Y,ne)=>y._(this,void 0,void 0,(function*(){return this._getWorkerSource(Y,ne.type,ne.source).getClusterLeaves(ne)})))),this.actor.registerMessageHandler("LD",((Y,ne)=>this._getWorkerSource(Y,ne.type,ne.source).loadData(ne))),this.actor.registerMessageHandler("LT",((Y,ne)=>this._getWorkerSource(Y,ne.type,ne.source).loadTile(ne))),this.actor.registerMessageHandler("RT",((Y,ne)=>this._getWorkerSource(Y,ne.type,ne.source).reloadTile(ne))),this.actor.registerMessageHandler("AT",((Y,ne)=>this._getWorkerSource(Y,ne.type,ne.source).abortTile(ne))),this.actor.registerMessageHandler("RMT",((Y,ne)=>this._getWorkerSource(Y,ne.type,ne.source).removeTile(ne))),this.actor.registerMessageHandler("RS",((Y,ne)=>y._(this,void 0,void 0,(function*(){var xe,De;if(!(!((De=(xe=this.workerSources[Y])===null||xe===void 0?void 0:xe[ne.type])===null||De===void 0)&&De[ne.source]))return;let nt=this.workerSources[Y][ne.type][ne.source];delete this.workerSources[Y][ne.type][ne.source],nt.removeSource!==void 0&&nt.removeSource(ne)})))),this.actor.registerMessageHandler("RM",(Y=>y._(this,void 0,void 0,(function*(){delete this.layerIndexes[Y],delete this.availableImages[Y],delete this.workerSources[Y],delete this.demWorkerSources[Y],this.globalStates.delete(Y)})))),this.actor.registerMessageHandler("SR",((Y,ne)=>y._(this,void 0,void 0,(function*(){this.referrer=ne})))),this.actor.registerMessageHandler("SRPS",((Y,ne)=>this._syncRTLPluginState(Y,ne))),this.actor.registerMessageHandler("IS",((Y,ne)=>y._(this,void 0,void 0,(function*(){this.self.importScripts(ne)})))),this.actor.registerMessageHandler("SI",((Y,ne)=>this._setImages(Y,ne))),this.actor.registerMessageHandler("UL",((Y,ne)=>y._(this,void 0,void 0,(function*(){this._getLayerIndex(Y).update(ne.layers,ne.removedIds,this._getGlobalState(Y))})))),this.actor.registerMessageHandler("UGS",((Y,ne)=>y._(this,void 0,void 0,(function*(){let xe=this._getGlobalState(Y);for(let De in ne)xe[De]=ne[De]})))),this.actor.registerMessageHandler("SL",((Y,ne)=>y._(this,void 0,void 0,(function*(){this._getLayerIndex(Y).replace(ne,this._getGlobalState(Y))}))))}_getGlobalState(Z){let Y=this.globalStates.get(Z);return Y||(Y={},this.globalStates.set(Z,Y)),Y}_setImages(Z,Y){return y._(this,void 0,void 0,(function*(){this.availableImages[Z]=Y;for(let ne in this.workerSources[Z]){let xe=this.workerSources[Z][ne];for(let De in xe)xe[De].availableImages=Y}}))}_syncRTLPluginState(Z,Y){return y._(this,void 0,void 0,(function*(){return yield y.d1.syncState(Y,this.self.importScripts)}))}_getAvailableImages(Z){let Y=this.availableImages[Z];return Y||(Y=[]),Y}_getLayerIndex(Z){let Y=this.layerIndexes[Z];return Y||(Y=this.layerIndexes[Z]=new l),Y}_getWorkerSource(Z,Y,ne){var xe,De;if((xe=this.workerSources)[Z]||(xe[Z]={}),(De=this.workerSources[Z])[Y]||(De[Y]={}),!this.workerSources[Z][Y][ne]){let nt={sendAsync:(ze,Be)=>(ze.targetMapId=Z,this.actor.sendAsync(ze,Be))};switch(Y){case"vector":this.workerSources[Z][Y][ne]=new ye(nt,this._getLayerIndex(Z),this._getAvailableImages(Z));break;case"geojson":this.workerSources[Z][Y][ne]=new se(nt,this._getLayerIndex(Z),this._getAvailableImages(Z));break;default:this.workerSources[Z][Y][ne]=new this.externalWorkerSourceTypes[Y](nt,this._getLayerIndex(Z),this._getAvailableImages(Z))}}return this.workerSources[Z][Y][ne]}_getDEMWorkerSource(Z,Y){var ne,xe;return(ne=this.demWorkerSources)[Z]||(ne[Z]={}),(xe=this.demWorkerSources[Z])[Y]||(xe[Y]=new ce),this.demWorkerSources[Z][Y]}}return y.i(self)&&(self.worker=new Le(self)),Le})),u("index",["exports","./shared"],(function(y,l){"use strict";var D="5.24.0";function B(){var g=new l.A(4);return l.A!=Float32Array&&(g[1]=0,g[2]=0),g[0]=1,g[3]=1,g}let q,K,fe,pe={frame(g,t,o,h){let p=h||window,v=p.requestAnimationFrame((M=>{T(),t(M)})),{unsubscribe:T}=l.s(g.signal,"abort",(()=>{T(),p.cancelAnimationFrame(v),o(new l.a(g.signal.reason))}),!1)},frameAsync(g,t){return new Promise(((o,h)=>{this.frame(g,o,h,t)}))},getImageData(g,t=0){return this.getImageCanvasContext(g).getImageData(-t,-t,g.width+2*t,g.height+2*t)},getImageCanvasContext(g){let t=window.document.createElement("canvas"),o=t.getContext("2d",{willReadFrequently:!0});if(!o)throw new Error("failed to create canvas 2d context");return t.width=g.width,t.height=g.height,o.drawImage(g,0,0,g.width,g.height),o},resolveURL:g=>(q||(q=document.createElement("a")),q.href=g,q.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return fe!==void 0?fe:!!matchMedia&&(K!=null||(K=matchMedia("(prefers-reduced-motion: reduce)")),K.matches)},set prefersReducedMotion(g){fe=g}},oe=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:performance.now()}setNow(g){this._frozenAt=g}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function le(){return oe.getCurrentTime()}var Oe,Ue;class ye{static create(t,o,h){let p=window.document.createElement(t);return o!==void 0&&(p.className=o),h&&h.appendChild(p),p}static createNS(t,o){return window.document.createElementNS(t,o)}static disableDrag(){ye.docStyle&&ye.selectProp&&(ye.userSelect=ye.docStyle[ye.selectProp],ye.docStyle[ye.selectProp]="none")}static enableDrag(){ye.docStyle&&ye.selectProp&&(ye.docStyle[ye.selectProp]=ye.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",ye.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ye.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",ye.suppressClickInternal,!0)}),0)}static getScale(t){let o=t.getBoundingClientRect();return{x:o.width/t.offsetWidth||1,y:o.height/t.offsetHeight||1,boundingClientRect:o}}static getPoint(t,o,h){let p=o.boundingClientRect;return new l.P((h.clientX-p.left)/o.x-t.clientLeft,(h.clientY-p.top)/o.y-t.clientTop)}static mousePos(t,o){let h=ye.getScale(t);return ye.getPoint(t,h,o)}static touchPos(t,o){let h=[],p=ye.getScale(t);for(let v of o)h.push(ye.getPoint(t,p,v));return h}static sanitize(t){let o=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),h=o.querySelectorAll("script");for(let p of h)p.remove();return ye.clean(o),o.innerHTML}static isPossiblyDangerous(t,o){let h=o.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!h.includes("javascript:")&&!h.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){let o=t.children;for(let h of o)ye.removeAttributes(h),ye.clean(h)}static removeAttributes(t){for(let{name:o,value:h}of t.attributes)ye.isPossiblyDangerous(o,h)&&t.removeAttribute(o)}}ye.docStyle=typeof window<"u"&&((Oe=window.document)===null||Oe===void 0?void 0:Oe.documentElement.style),ye.selectProp=!ye.docStyle||"userSelect"in ye.docStyle?"userSelect":"webkitUserSelect",(function(g){let t,o,h,p;g.resetRequestQueue=()=>{t=[],o=0,h=0,p={}},g.addThrottleControl=C=>{let z=h++;return p[z]=C,z},g.removeThrottleControl=C=>{delete p[C],T()},g.getImage=(C,z,P=!0)=>new Promise(((k,L)=>{C.headers||(C.headers={}),C.headers.accept="image/webp,*/*",l.e(C,{type:"image"}),t.push({abortController:z,requestParameters:C,supportImageRefresh:P,state:"queued",onError:N=>{L(N)},onSuccess:N=>{k(N)}}),T()}));let v=C=>l._(this,void 0,void 0,(function*(){C.state="running";let{requestParameters:z,supportImageRefresh:P,onError:k,onSuccess:L,abortController:N}=C,G=P===!1&&!l.i(self)&&!l.g(z.url)&&(!z.headers||Object.keys(z.headers).reduce(((W,ee)=>W&&ee==="accept"),!0));o++;let $=G?M(z,N):l.m(z,N);try{let W=yield $;delete C.abortController,C.state="completed",W.data instanceof HTMLImageElement||l.b(W.data)?L(W):W.data&&L({data:yield(J=W.data,typeof createImageBitmap=="function"?l.h(J):l.j(J)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete C.abortController,k(l.d(W))}finally{o--,T()}var J})),T=()=>{let C=(()=>{for(let z of Object.keys(p))if(p[z]())return!0;return!1})()?l.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let z=o;z<C&&t.length>0;z++){let P=t.shift();P.abortController.signal.aborted?z--:v(P)}},M=(C,z)=>new Promise(((P,k)=>{let L=new Image,N=C.url,G=C.credentials;G&&G==="include"?L.crossOrigin="use-credentials":(G&&G==="same-origin"||!l.f(N))&&(L.crossOrigin="anonymous"),z.signal.addEventListener("abort",(()=>{L.src="",k(new l.a(z.signal.reason))})),L.fetchPriority="high",L.onload=()=>{L.onerror=L.onload=null,P({data:L})},L.onerror=()=>{L.onerror=L.onload=null,z.signal.aborted||k(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},L.src=N}))})(Ue||(Ue={})),Ue.resetRequestQueue();class ce{constructor(t){this._transformRequestFn=t??null}transformRequest(t,o){return this._transformRequestFn&&this._transformRequestFn(t,o)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function se(g){let t=[];if(typeof g=="string")t.push({id:"default",url:g});else if(g&&g.length>0){let o=[];for(let{id:h,url:p}of g){let v=`${h}${p}`;o.includes(v)||(o.push(v),t.push({id:h,url:p}))}}return t}function de(g,t,o){try{let h=new URL(g);return h.pathname+=`${t}${o}`,h.toString()}catch{throw new Error(`Invalid sprite URL "${g}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function ve(g){let{userImage:t}=g;return!(!t?.render||!t.render()||(g.data.replace(new Uint8Array(t.data.buffer)),0))}class Le extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(let t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(let{ids:o,promiseResolve:h}of this.requestors)h(this._getImagesForIds(o));this.requestors=[]}}getImage(t){let o=this.images[t];if(o&&!o.data&&o.spriteData){let h=o.spriteData;o.data=new l.R({width:h.width,height:h.height},h.context.getImageData(h.x,h.y,h.width,h.height).data),o.spriteData=null}return o}addImage(t,o){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,o)&&(this.images[t]=o)}_validate(t,o){let h=!0,p=o.data||o.spriteData;return this._validateStretch(o.stretchX,p?.width)||(this.fire(new l.l(new Error(`Image "${t}" has invalid "stretchX" value`))),h=!1),this._validateStretch(o.stretchY,p?.height)||(this.fire(new l.l(new Error(`Image "${t}" has invalid "stretchY" value`))),h=!1),this._validateContent(o.content,o)||(this.fire(new l.l(new Error(`Image "${t}" has invalid "content" value`))),h=!1),h}_validateStretch(t,o){if(!t)return!0;let h=0;for(let p of t){if(p[0]<h||p[1]<p[0]||o<p[1])return!1;h=p[1]}return!0}_validateContent(t,o){if(!t)return!0;if(t.length!==4)return!1;let h=o.spriteData,p=h?.width||o.data.width,v=h?.height||o.data.height;return!(t[0]<0||p<t[0]||t[1]<0||v<t[1]||t[2]<0||p<t[2]||t[3]<0||v<t[3]||t[2]<t[0]||!(t[3]>=t[1]))}updateImage(t,o,h=!0){let p=this.getImage(t);if(h&&(p.data.width!==o.data.width||p.data.height!==o.data.height))throw new Error(`size mismatch between old image (${p.data.width}x${p.data.height}) and new image (${o.data.width}x${o.data.height}).`);o.version=p.version+1,this.images[t]=o,this.updatedImages[t]=!0}removeImage(t){var o;let h=this.images[t];delete this.images[t],delete this.patterns[t],!((o=h.userImage)===null||o===void 0)&&o.onRemove&&h.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((o,h)=>{let p=!0;if(!this.isLoaded())for(let v of t)this.images[v]||(p=!1);this.isLoaded()||p?o(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:o})}))}_getImagesForIds(t){var o;let h={};for(let p of t){let v=this.getImage(p);v||(this.fire(new l.n("styleimagemissing",{id:p})),v=this.getImage(p)),v?h[p]={data:v.data.clone(),pixelRatio:v.pixelRatio,sdf:v.sdf,version:v.version,stretchX:v.stretchX,stretchY:v.stretchY,content:v.content,textFitWidth:v.textFitWidth,textFitHeight:v.textFitHeight,hasRenderCallback:!!(!((o=v.userImage)===null||o===void 0)&&o.render)}:l.w(`Image "${p}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return h}getPixelSize(){let{width:t,height:o}=this.atlasImage;return{width:t,height:o}}getPattern(t){let o=this.patterns[t],h=this.getImage(t);if(!h)return null;if(o&&o.position.version===h.version)return o.position;if(o)o.position.version=h.version;else{let p={w:h.data.width+2,h:h.data.height+2,x:0,y:0},v=new l.I(p,h);this.patterns[t]={bin:p,position:v}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){let o=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new l.T(t,this.atlasImage,o.RGBA),this.atlasTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE)}_updatePatternAtlas(){let t=[];for(let v in this.patterns)t.push(this.patterns[v].bin);let{w:o,h}=l.p(t),p=this.atlasImage;p.resize({width:o||1,height:h||1});for(let v in this.patterns){let{bin:T}=this.patterns[v],M=T.x+1,C=T.y+1,z=this.getImage(v).data,P=z.width,k=z.height;l.R.copy(z,p,{x:0,y:0},{x:M,y:C},{width:P,height:k}),l.R.copy(z,p,{x:0,y:k-1},{x:M,y:C-1},{width:P,height:1}),l.R.copy(z,p,{x:0,y:0},{x:M,y:C+k},{width:P,height:1}),l.R.copy(z,p,{x:P-1,y:0},{x:M-1,y:C},{width:1,height:k}),l.R.copy(z,p,{x:0,y:0},{x:M+P,y:C},{width:1,height:k})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let o of t){if(this.callbackDispatchedThisFrame[o])continue;this.callbackDispatchedThisFrame[o]=!0;let h=this.getImage(o);h||l.w(`Image with ID: "${o}" was not found`),ve(h)&&this.updateImage(o,h)}}cloneImages(){let t={};for(let o in this.images){let h=this.images[o];t[o]=Object.assign(Object.assign({},h),{data:h.data?h.data.clone():null})}return t}}let Re=1e20,Z=new Float64Array(256);for(let g=0;g<256;g++){let t=.5-Math.pow(g/255,.45454545454545453);Z[g]=t*Math.abs(t)}function Y(g,t,o,h,p,v,T,M,C){for(let z=t;z<t+h;z++)ne(g,o*v+z,v,p,T,M,C);for(let z=o;z<o+p;z++)ne(g,z*v+t,1,h,T,M,C)}function ne(g,t,o,h,p,v,T){v[0]=0,T[0]=-Re,T[1]=Re,p[0]=g[t];for(let M=1,C=0,z=0;M<h;M++){p[M]=g[t+M*o];let P=M*M;do{let k=v[C];z=(p[M]-p[k]+P-k*k)/(M-k)/2}while(z<=T[C]&&--C>-1);C++,v[C]=M,T[C]=z,T[C+1]=Re}for(let M=0,C=0;M<h;M++){for(;T[C+1]<M;)C++;let z=v[C],P=M-z;g[t+M*o]=p[z]+P*P}}Z[255]=-Re;let xe=l.v.layout_symbol["text-font"].default.join(",");class De{constructor(t,o,h){this.requestManager=t,this.localIdeographFontFamily=o,this.entries={},this.lang=h}setURL(t){this.url=t}getGlyphs(t){return l._(this,void 0,void 0,(function*(){let o=[];for(let v in t)for(let T of t[v])o.push(this._getAndCacheGlyphsPromise(v,T));let h=yield Promise.all(o),p={};for(let{stack:v,id:T,glyph:M}of h)p[v]||(p[v]={}),p[v][T]=M&&{id:M.id,bitmap:M.bitmap.clone(),metrics:M.metrics};return p}))}_getAndCacheGlyphsPromise(t,o){return l._(this,void 0,void 0,(function*(){var h,p;(h=(p=this.entries)[t])!==null&&h!==void 0||(p[t]={glyphs:{},requests:{},ranges:{}});let v=this.entries[t],T=v.glyphs[o];return T!==void 0?{stack:t,id:o,glyph:T}:!this.url||this._charUsesLocalIdeographFontFamily(o)?(T=v.glyphs[o]=this._drawGlyph(v,t,o),{stack:t,id:o,glyph:T}):yield this._downloadAndCacheRangePromise(t,o)}))}_downloadAndCacheRangePromise(t,o){return l._(this,void 0,void 0,(function*(){var h;let p=this.entries[t],v=Math.floor(o/256);if(p.ranges[v])return{stack:t,id:o,glyph:null};(h=p.requests)[v]||(h[v]=De.loadGlyphRange(t,v,this.url,this.requestManager));try{let T=yield p.requests[v];for(let M in T)p.glyphs[+M]=T[+M];return p.ranges[v]=!0,{stack:t,id:o,glyph:T[o]||null}}catch(T){let M=p.glyphs[o]=this._drawGlyph(p,t,o);return this._warnOnMissingGlyphRange(M,v,o,l.d(T)),{stack:t,id:o,glyph:M}}}))}_warnOnMissingGlyphRange(t,o,h,p){let v=256*o,T=v+255,M=h.toString(16).padStart(4,"0").toUpperCase();l.w(`Unable to load glyph range ${o}, ${v}-${T}. Rendering codepoint U+${M} locally instead. ${p}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&l.r(t)}_drawGlyph(t,o,h){let p=o===xe&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(h),v=p?"ideographTinySDF":"tinySDF";t[v]||(t[v]=this._createTinySDF(p?this.localIdeographFontFamily:o));let T=t[v].draw(String.fromCodePoint(h)),M=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(h));return{id:h,bitmap:new l.t({width:T.width||60,height:T.height||60},T.data),metrics:{width:M?0:T.glyphWidth/2||24,height:T.glyphHeight/2||24,left:T.glyphLeft/2+.5||0,top:T.glyphTop/2-27.5||-8,advance:M?0:T.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){let o=t?t.split(","):[];o.push("sans-serif");let h=o.map((p=>/[-\w]+/.test(p)?p:`'${CSS.escape(p)}'`)).join(",");return new De.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:h,fontWeight:this._fontWeight(o[0]),fontStyle:this._fontStyle(o[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){let o={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950},h;for(let[p,v]of Object.entries(o))new RegExp(`\\b${p}\\b`,"i").test(t)&&(h=`${v}`);return h}destroy(){for(let t in this.entries){let o=this.entries[t];o.tinySDF=null,o.ideographTinySDF=null,o.glyphs={},o.requests={},o.ranges={}}this.entries={}}}De.loadGlyphRange=function(g,t,o,h){return l._(this,void 0,void 0,(function*(){let p=256*t,v=p+255,T=yield h.transformRequest(o.replace("{fontstack}",g).replace("{range}",`${p}-${v}`),"Glyphs"),M=yield l.o(T,new AbortController);if(!M?.data)throw new Error(`Could not load glyph range. range: ${t}, ${p}-${v}`);let C={};for(let z of l.q(M.data))C[z.id]=z;return C}))},De.TinySDF=class{constructor({fontSize:g=24,buffer:t=3,radius:o=8,cutoff:h=.25,fontFamily:p="sans-serif",fontWeight:v="normal",fontStyle:T="normal",lang:M=null}={}){this.buffer=t,this.radius=o,this.cutoff=h,this.lang=M;let C=this.size=g+4*t,z=this._createCanvas(C),P=this.ctx=z.getContext("2d",{willReadFrequently:!0});P.font=`${T} ${v} ${g}px ${p}`,P.textBaseline="alphabetic",P.textAlign="left",P.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(g){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(g,g);let t=document.createElement("canvas");return t.width=t.height=g,t}draw(g){let{width:t,actualBoundingBoxAscent:o,actualBoundingBoxDescent:h,actualBoundingBoxLeft:p,actualBoundingBoxRight:v}=this.ctx.measureText(g),T=Math.ceil(o),M=Math.floor(p),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v)-M)),z=Math.max(0,Math.min(this.size-this.buffer,T+Math.ceil(h))),P=C+2*this.buffer,k=z+2*this.buffer,L=Math.max(P*k,0),N=new Uint8ClampedArray(L),G={data:N,width:P,height:k,glyphWidth:C,glyphHeight:z,glyphTop:T,glyphLeft:M,glyphAdvance:t};if(C===0||z===0)return G;let{ctx:$,buffer:J,gridInner:W,gridOuter:ee}=this;this.lang&&($.lang=this.lang),$.clearRect(J,J,C,z),$.fillText(g,J-M,J+T);let ae=$.getImageData(J,J,C,z);ee.fill(Re,0,L),W.fill(0,0,L);let te=3;for(let ie=0;ie<z;ie++){let me=(ie+J)*P+J;for(let Te=0;Te<C;Te++,te+=4,me++){let Se=ae.data[te];if(Se===0)continue;let Ie=Z[Se];ee[me]=Math.max(0,Ie),W[me]=Math.max(0,-Ie)}}Y(ee,0,0,P,k,P,this.f,this.v,this.z),Y(W,J,J,C,z,P,this.f,this.v,this.z);let Q=255/this.radius,re=255*(1-this.cutoff);for(let ie=0;ie<L;ie++){let me=Math.sqrt(ee[ie])-Math.sqrt(W[ie]);N[ie]=Math.round(re-Q*me)}return G}};class nt{constructor(){this.specification=l.x.light.position}possiblyEvaluate(t,o){return l.G(t.expression.evaluate(o))}interpolate(t,o,h){return{x:l.H.number(t.x,o.x,h),y:l.H.number(t.y,o.y,h),z:l.H.number(t.z,o.z,h)}}}let ze;class Be extends l.E{constructor(t){super(),ze||(ze=new l.u({anchor:new l.D(l.x.light.anchor),position:new nt,color:new l.D(l.x.light.color),intensity:new l.D(l.x.light.intensity)})),this._transitionable=new l.y(ze,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,o={}){if(!this._validate(l.z,t,o))for(let h in t){let p=t[h];h.endsWith(l.B)?this._transitionable.setTransition(h.slice(0,-l.B.length),p):this._transitionable.setValue(h,p)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,o,h){return h?.validate!==!1&&l.C(this,t.call(l.F,{value:o,style:{glyphs:!0,sprite:!0},styleSpec:l.x}))}}let He=new l.u({"sky-color":new l.D(l.x.sky["sky-color"]),"horizon-color":new l.D(l.x.sky["horizon-color"]),"fog-color":new l.D(l.x.sky["fog-color"]),"fog-ground-blend":new l.D(l.x.sky["fog-ground-blend"]),"horizon-fog-blend":new l.D(l.x.sky["horizon-fog-blend"]),"sky-horizon-blend":new l.D(l.x.sky["sky-horizon-blend"]),"atmosphere-blend":new l.D(l.x.sky["atmosphere-blend"])});class We extends l.E{constructor(t){super(),this._transitionable=new l.y(He,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.J(0))}setSky(t,o={}){if(!this._validate(l.K,t,o)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let h in t){let p=t[h];h.endsWith(l.B)?this._transitionable.setTransition(h.slice(0,-l.B.length),p):this._transitionable.setValue(h,p)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,o,h={}){return h?.validate!==!1&&l.C(this,t.call(l.F,l.e({value:o,style:{glyphs:!0,sprite:!0},styleSpec:l.x})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class Ke{constructor(t,o){this.width=t,this.height=o,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,o){var h;let p=t.join(",")+String(o);return(h=this.dashEntry)[p]||(h[p]=this.addDash(t,o)),this.dashEntry[p]}getDashRanges(t,o,h){let p=[],v=t.length%2==1?-t[t.length-1]*h:0,T=t[0]*h,M=!0;p.push({left:v,right:T,isDash:M,zeroLength:t[0]===0});let C=t[0];for(let z=1;z<t.length;z++){M=!M;let P=t[z];v=C*h,C+=P,T=C*h,p.push({left:v,right:T,isDash:M,zeroLength:P===0})}return p}addRoundDash(t,o,h){let p=o/2;for(let v=-h;v<=h;v++){let T=this.width*(this.nextRow+h+v),M=0,C=t[M];for(let z=0;z<this.width;z++){z/C.right>1&&(C=t[++M]);let P=Math.abs(z-C.left),k=Math.abs(z-C.right),L=Math.min(P,k),N,G=v/h*(p+1);if(C.isDash){let $=p-Math.abs(G);N=Math.sqrt(L*L+$*$)}else N=p-Math.sqrt(L*L+G*G);this.data[T+z]=Math.max(0,Math.min(255,N+128))}}}addRegularDash(t){for(let M=t.length-1;M>=0;--M){let C=t[M],z=t[M+1];C.zeroLength?t.splice(M,1):z&&z.isDash===C.isDash&&(z.left=C.left,t.splice(M,1))}let o=t[0],h=t[t.length-1];o.isDash===h.isDash&&(o.left=h.left-this.width,h.right=o.right+this.width);let p=this.width*this.nextRow,v=0,T=t[v];for(let M=0;M<this.width;M++){M/T.right>1&&(T=t[++v]);let C=Math.abs(M-T.left),z=Math.abs(M-T.right),P=Math.min(C,z);this.data[p+M]=Math.max(0,Math.min(255,(T.isDash?P:-P)+128))}}addDash(t,o){let h=o?7:0,p=2*h+1;if(this.nextRow+p>this.height)return l.w("LineAtlas out of space"),null;let v=0;for(let M of t)v+=M;if(v!==0){let M=this.width/v,C=this.getDashRanges(t,this.width,M);o?this.addRoundDash(C,M,h):this.addRegularDash(C)}let T={y:this.nextRow+h,height:2*h,width:v};return this.nextRow+=p,this.dirty=!0,T}bind(t){let o=t.gl;this.texture?(o.bindTexture(o.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,o.texSubImage2D(o.TEXTURE_2D,0,0,0,this.width,this.height,o.ALPHA,o.UNSIGNED_BYTE,this.data))):(this.texture=o.createTexture(),o.bindTexture(o.TEXTURE_2D,this.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.REPEAT),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.REPEAT),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texImage2D(o.TEXTURE_2D,0,o.ALPHA,this.width,this.height,0,o.ALPHA,o.UNSIGNED_BYTE,this.data))}}let _t="maplibre_preloaded_worker_pool";class lt{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<lt.workerCount;)this.workers.push(new Worker(l.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){if(delete this.active[t],this.numActive()===0){for(let o of this.workers)o.terminate();this.workers=null}}isPreloaded(){return!!this.active[_t]}numActive(){return Object.keys(this.active).length}}let jt=Math.floor(pe.hardwareConcurrency/2),Kt,Qt;function Gn(){return Kt||(Kt=new lt),Kt}lt.workerCount=l.L(globalThis)?Math.max(Math.min(jt,3),1):1;class ot{constructor(t,o){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=o;let h=this.workerPool.acquire(o);for(let p=0;p<h.length;p++){let v=new l.N(h[p],o);v.name=`Worker ${p}`,this.actors.push(v)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,o){let h=[];for(let p of this.actors)h.push(p.sendAsync({type:t,data:o}));return Promise.all(h)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(let o of this.actors)o.remove();this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,o){for(let h of this.actors)h.registerMessageHandler(t,o)}unregisterMessageHandler(t){for(let o of this.actors)o.unregisterMessageHandler(t)}}function qt(){return Qt||(Qt=new ot(Gn(),l.M),Qt.registerMessageHandler("GR",((g,t,o)=>l.m(t,o)))),Qt}function vn(g,t){let o=l.O();return l.Q(o,o,[1,1,0]),l.S(o,o,[.5*g.width,.5*g.height,1]),g.calculatePosMatrix?l.U(o,o,g.calculatePosMatrix(t.toUnwrapped())):o}function pi(g,t,o,h,p,v,T){var M;let C=(function(L,N,G){if(L)for(let $ of L){let J=N[$];if(J?.source===G&&J.type==="fill-extrusion")return!0}else for(let $ in N){let J=N[$];if(J.source===G&&J.type==="fill-extrusion")return!0}return!1})((M=p?.layers)!==null&&M!==void 0?M:null,t,g.id),z=v.maxPitchScaleFactor(),P=g.tilesIn(h,z,C);P.sort(sn);let k=[];for(let L of P)k.push({wrappedTileID:L.tileID.wrapped().key,queryResults:L.tile.queryRenderedFeatures(t,o,g.getState(),L.queryGeometry,L.cameraQueryGeometry,L.scale,p,v,z,vn(v,L.tileID),T?(N,G)=>T(L.tileID,N,G):void 0)});return(function(L,N){for(let G in L)for(let $ of L[G])li($,N);return L})((function(L){let N={},G={};for(let{queryResults:$,wrappedTileID:J}of L){G[J]||(G[J]={});let W=G[J];for(let ee in $){let ae=$[ee];W[ee]||(W[ee]={});let te=W[ee];N[ee]||(N[ee]=[]);for(let Q of ae)te[Q.featureIndex]||(te[Q.featureIndex]=!0,N[ee].push(Q))}}return N})(k),g)}function sn(g,t){let o=g.tileID,h=t.tileID;return o.overscaledZ-h.overscaledZ||o.canonical.y-h.canonical.y||o.wrap-h.wrap||o.canonical.x-h.canonical.x}function li(g,t){let o=g.feature,h=t.getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=h}function Ii(g,t,o,h){return l._(this,void 0,void 0,(function*(){let p=g;if(g.url?p=(yield l.k(yield t.transformRequest(g.url,"Source"),o)).data:yield pe.frameAsync(o,h),!p)return null;let v=l.V(l.e(p,g),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(v.vectorLayerIds=p.vector_layers.map((T=>T.id))),v}))}class Xe{constructor(t,o){t&&(o?this.setSouthWest(t).setNorthEast(o):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof l.W?new l.W(t.lng,t.lat):l.W.convert(t),this}setSouthWest(t){return this._sw=t instanceof l.W?new l.W(t.lng,t.lat):l.W.convert(t),this}extend(t){let o=this._sw,h=this._ne,p,v;if(t instanceof l.W)p=t,v=t;else{if(!(t instanceof Xe))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Xe.convert(t)):this.extend(l.W.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(l.W.convert(t)):this;if(p=t._sw,v=t._ne,!p||!v)return this}return o||h?(o.lng=Math.min(p.lng,o.lng),o.lat=Math.min(p.lat,o.lat),h.lng=Math.max(v.lng,h.lng),h.lat=Math.max(v.lat,h.lat)):(this._sw=new l.W(p.lng,p.lat),this._ne=new l.W(v.lng,v.lat)),this}getCenter(){return new l.W((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new l.W(this.getWest(),this.getNorth())}getSouthEast(){return new l.W(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:o,lat:h}=l.W.convert(t),p=this._sw.lng<=o&&o<=this._ne.lng;return this._sw.lng>this._ne.lng&&(p=this._sw.lng>=o&&o>=this._ne.lng),this._sw.lat<=h&&h<=this._ne.lat&&p}intersects(t){if(!((t=Xe.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let o=Math.abs(this.getEast()-this.getWest()),h=Math.abs(t.getEast()-t.getWest());if(o>=360||h>=360)return!0;let p=l.X(this.getWest(),-180,180),v=l.X(this.getEast(),-180,180),T=l.X(t.getWest(),-180,180),M=l.X(t.getEast(),-180,180),C=p>v,z=T>M;return!(!C||!z)||(C?M>=p||T<=v:z?v>=T||p<=M:T<=v&&M>=p)}static convert(t){return t instanceof Xe?t:t&&new Xe(t)}static fromLngLat(t,o=0){let h=360*o/40075017,p=h/Math.cos(Math.PI/180*t.lat);return new Xe(new l.W(t.lng-p,t.lat-h),new l.W(t.lng+p,t.lat+h))}adjustAntiMeridian(){let t=new l.W(this._sw.lng,this._sw.lat),o=new l.W(this._ne.lng,this._ne.lat);return new Xe(t,t.lng>o.lng?new l.W(o.lng+360,o.lat):o)}}class ft{constructor(t,o,h){this.bounds=Xe.convert(this.validateBounds(t)),this.minzoom=o||0,this.maxzoom=h||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){let o=Math.pow(2,t.z),h=Math.floor(l.Z(this.bounds.getWest())*o),p=Math.floor(l.Y(this.bounds.getNorth())*o),v=Math.ceil(l.Z(this.bounds.getEast())*o),T=Math.ceil(l.Y(this.bounds.getSouth())*o);return t.x>=h&&t.x<v&&t.y>=p&&t.y<T}}class Gt extends l.E{constructor(t,o,h,p){if(super(),this.id=t,this.dispatcher=h,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.V(o,["url","scheme","tileSize","promoteId","encoding"])),this._options=l.e({type:"vector"},o),this._collectResourceTiming=o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(p)}load(){return l._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new l.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let o=yield Ii(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,o&&(l.e(this,o),o.bounds&&(this.tileBounds=new ft(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(o){this._tileJSONRequest=null,this._loaded=!0,l.$(o)||this.fire(new l.l(l.d(o)))}}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(t){return l._(this,void 0,void 0,(function*(){let o=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),h={request:yield this.map._requestManager.transformRequest(o,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(t),etag:t.etag};h.request.collectResourceTiming=this._collectResourceTiming;let p="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise(((v,T)=>{t.reloadPromise={resolve:v,reject:T}}))}else t.actor=this.dispatcher.getActor(),p="LT";t.abortController=new AbortController;try{let v=yield t.actor.sendAsync({type:p,data:h},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,v);let T={};return v?.etagUnmodified&&(T.unmodified=!0),T}catch(v){if(delete t.abortController,t.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(t,null)}}))}_getOverzoomParameters(t){return l._(this,void 0,void 0,(function*(){if(t.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let o=t.tileID.scaledTo(this.maxzoom).canonical,h=o.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:o,overzoomRequest:yield this.map._requestManager.transformRequest(h,"Tile")}}))}_afterTileLoadWorkerResponse(t,o){if(o?.resourceTiming&&(t.resourceTiming=o.resourceTiming),o&&this.map._refreshExpiredTiles&&t.setExpiryData(o),t.etag=o?.etag,t.loadVectorData(o,this.map.painter),t.reloadPromise){let h=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(h.resolve).catch(h.reject)}}abortTile(t){return l._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class ci extends l.E{constructor(t,o,h,p){super(),this.id=t,this.dispatcher=h,this.setEventedParent(p),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},o),l.e(this,l.V(o,["url","scheme","tileSize"]))}load(){return l._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new l.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let o=yield Ii(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,o&&(l.e(this,o),o.bounds&&(this.tileBounds=new ft(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(o){this._tileJSONRequest=null,this._loaded=!0,l.$(o)||this.fire(new l.l(l.d(o)))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return l.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return l._(this,void 0,void 0,(function*(){let o=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{let h=yield Ue.getImage(yield this.map._requestManager.transformRequest(o,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(h?.data){this.map._refreshExpiredTiles&&(h.cacheControl||h.expires)&&t.setExpiryData({cacheControl:h.cacheControl,expires:h.expires});let p=this.map.painter.context,v=p.gl,T=h.data;t.texture=this.map.painter.getTileTexture(T.width),t.texture?t.texture.update(T,{useMipmap:!0}):(t.texture=new l.T(p,T,v.RGBA,{useMipmap:!0}),t.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(h){if(delete t.abortController,t.aborted)t.state="unloaded";else if(h)throw t.state="errored",h}}))}abortTile(t){return l._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class zt extends ci{constructor(t,o,h,p){super(t,o,h,p),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},o),this.encoding=o.encoding||"mapbox",this.redFactor=o.redFactor,this.greenFactor=o.greenFactor,this.blueFactor=o.blueFactor,this.baseShift=o.baseShift}loadTile(t){return l._(this,void 0,void 0,(function*(){let o=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),h=yield this.map._requestManager.transformRequest(o,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{let p=yield Ue.getImage(h,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(p?.data){let v=p.data;this.map._refreshExpiredTiles&&(p.cacheControl||p.expires)&&t.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});let T=l.b(v)&&l.a0()?v:yield this.readImageNow(v),M={type:this.type,uid:t.uid,source:this.id,rawImageData:T,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&t.state!=="expired"&&t.state!=="reloading")return;t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor()),t.dem=yield t.actor.sendAsync({type:"LDT",data:M}),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}catch(p){if(delete t.abortController,t.aborted)t.state="unloaded";else if(p)throw t.state="errored",p}}))}readImageNow(t){return l._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&l.a1()){let o=t.width+2,h=t.height+2;try{return new l.R({width:o,height:h},yield l.a2(t,-1,-1,o,h))}catch{}}return pe.getImageData(t,1)}))}_getNeighboringTiles(t){let o=t.canonical,h=Math.pow(2,o.z),p=(o.x-1+h)%h,v=o.x===0?t.wrap-1:t.wrap,T=(o.x+1+h)%h,M=o.x+1===h?t.wrap+1:t.wrap,C={};return C[new l.a3(t.overscaledZ,v,o.z,p,o.y).key]={backfilled:!1},C[new l.a3(t.overscaledZ,M,o.z,T,o.y).key]={backfilled:!1},o.y>0&&(C[new l.a3(t.overscaledZ,v,o.z,p,o.y-1).key]={backfilled:!1},C[new l.a3(t.overscaledZ,t.wrap,o.z,o.x,o.y-1).key]={backfilled:!1},C[new l.a3(t.overscaledZ,M,o.z,T,o.y-1).key]={backfilled:!1}),o.y+1<h&&(C[new l.a3(t.overscaledZ,v,o.z,p,o.y+1).key]={backfilled:!1},C[new l.a3(t.overscaledZ,t.wrap,o.z,o.x,o.y+1).key]={backfilled:!1},C[new l.a3(t.overscaledZ,M,o.z,T,o.y+1).key]={backfilled:!1}),C}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}function Nt(g,t){return t?g.properties[t]:g.id}function ki(g,t){let o={id:g.id};if(t.removeAllProperties&&(delete g.removeProperties,delete g.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(let h of t.removeProperties){let p=g.addOrUpdateProperties.findIndex((v=>v.key===h));p>-1&&g.addOrUpdateProperties.splice(p,1)}return(g.removeAllProperties||t.removeAllProperties)&&(o.removeAllProperties=!0),(g.removeProperties||t.removeProperties)&&(o.removeProperties=[...g.removeProperties||[],...t.removeProperties||[]]),(g.addOrUpdateProperties||t.addOrUpdateProperties)&&(o.addOrUpdateProperties=[...g.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(g.newGeometry||t.newGeometry)&&(o.newGeometry=t.newGeometry||g.newGeometry),o}function Zn(g){var t,o;if(!g)return{};let h={};return h.removeAll=g.removeAll,h.remove=new Set(g.remove||[]),h.add=new Map((t=g.add)===null||t===void 0?void 0:t.map((p=>[p.id,p]))),h.update=new Map((o=g.update)===null||o===void 0?void 0:o.map((p=>[p.id,p]))),h}function Hn(g){return g&&g.length!==0?typeof g[0]=="number"?[g]:g.flatMap((t=>Hn(t))):[]}function Si(g){return g.type==="GeometryCollection"?g.geometries.flatMap((t=>Si(t))):Hn(g.coordinates)}function Ki(g){let t=new Xe,o;switch(g.type){case"FeatureCollection":o=g.features.flatMap((h=>Si(h.geometry)));break;case"Feature":o=Si(g.geometry);break;default:o=Si(g)}if(o.length===0)return t;for(let h of o){let[p,v]=h;t.extend([p,v])}return t}class xt extends l.E{constructor(t,o,h,p){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:o.data},this.actor=h.getActor(),this.setEventedParent(p),this._data=typeof o.data=="string"?{url:o.data}:{geojson:o.data},this._options=l.e({},o),this._collectResourceTiming=o.collectResourceTiming,o.maxzoom!==void 0&&(this.maxzoom=o.maxzoom),o.type&&(this.type=o.type),o.attribution&&(this.attribution=o.attribution),this.promoteId=o.promoteId,o.clusterMaxZoom!==void 0&&this.maxzoom<=o.clusterMaxZoom&&l.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${o.clusterMaxZoom}".`),this.workerOptions=l.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(o.buffer!==void 0?o.buffer:128),tolerance:this._pixelsToTileUnits(o.tolerance!==void 0?o.tolerance:.375),extent:l.a6,maxZoom:this.maxzoom,lineMetrics:o.lineMetrics||!1,generateId:o.generateId||!1,promoteId:typeof o.promoteId=="string"?o.promoteId:void 0,cluster:o.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(o.clusterMaxZoom),minPoints:Math.max(2,o.clusterMinPoints||2),extent:l.a6,radius:this._pixelsToTileUnits(o.clusterRadius||50),log:!1,generateId:o.generateId||!1}},clusterProperties:o.clusterProperties,filter:o.filter},o.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(l.a6/this.tileSize)}_getClusterMaxZoom(t){let o=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||l.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${o}"`),o}load(){return l._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t,o){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};let h=this._updateWorkerData();return o?h:this}updateData(t,o){this._pendingWorkerUpdate.diff=(function(p,v){if(!p)return v||{};if(!v)return p||{};let T=Zn(p),M=Zn(v);(function(z,P){P.removeAll&&(z.add.clear(),z.update.clear(),z.remove.clear(),P.remove.clear());for(let k of P.remove)z.add.delete(k),z.update.delete(k);for(let[k,L]of P.update){let N=z.update.get(k);N&&(P.update.set(k,ki(N,L)),z.update.delete(k))}})(T,M);let C={};if((T.removeAll||M.removeAll)&&(C.removeAll=!0),C.remove=new Set([...T.remove,...M.remove]),C.add=new Map([...T.add,...M.add]),C.update=new Map([...T.update,...M.update]),C.remove.size&&C.add.size)for(let z of C.add.keys())C.remove.delete(z);return(function(z){let P={};return z.removeAll&&(P.removeAll=z.removeAll),z.remove&&(P.remove=Array.from(z.remove)),z.add&&(P.add=Array.from(z.add.values())),z.update&&(P.update=Array.from(z.update.values())),P})(C)})(this._pendingWorkerUpdate.diff,t);let h=this._updateWorkerData();return o?h:this}getData(){return l._(this,void 0,void 0,(function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}))}getBounds(){return l._(this,void 0,void 0,(function*(){return Ki(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,o,h){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:o,offset:h}})}_updateWorkerData(){return l._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void l.w(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:t,diff:o,updateCluster:h}=this._pendingWorkerUpdate,p=this._getLoadGeoJSONParameters(t,o,h);t!==void 0?this._pendingWorkerUpdate.data=void 0:o?this._pendingWorkerUpdate.diff=void 0:h&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(p)}))}_getLoadGeoJSONParameters(t,o,h){return l._(this,void 0,void 0,(function*(){let p=l.e({type:this.type},this.workerOptions);return typeof t=="string"?(p.request=yield this.map._requestManager.transformRequest(pe.resolveURL(t),"Source"),p.request.collectResourceTiming=this._collectResourceTiming,p):t!==void 0?(p.data=t,p):o?(p.dataDiff=o,p):h?(p.updateCluster=!0,p):void 0}))}_dispatchWorkerUpdate(t){return l._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new l.n("dataloading",{dataType:"source"}));try{let o=yield t,h=yield this.actor.sendAsync({type:"LD",data:o});if(this._isUpdatingWorker=!1,this._removed||h.abandoned)return void this.fire(new l.n("dataabort",{dataType:"source"}));h.data&&(this._data={geojson:h.data});let p=this._applyDiffToSource(o.dataDiff),v=this._getShouldReloadTileOptions(p),T={dataType:"source"};this._applyResourceTiming(T,h),this.fire(new l.n("data",Object.assign(Object.assign({},T),{sourceDataType:"metadata"}))),this.fire(new l.n("data",Object.assign(Object.assign({},T),{sourceDataType:"content",shouldReloadTileOptions:v})))}catch(o){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new l.n("dataabort",{dataType:"source"}));this.fire(new l.l(l.d(o)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(t,o){var h;if(!this._collectResourceTiming)return;let p=(h=o.resourceTiming)===null||h===void 0?void 0:h[this.id];if(!p)return;let v=p.slice(0);v?.length&&l.e(t,{resourceTiming:v})}_applyDiffToSource(t){if(!t)return;let o=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let p=(function(v,T){let M=new Map;if(v==null||v.type==null)return M;if(v.type==="Feature"){let C=Nt(v,T);return C==null?void 0:(M.set(C,v),M)}if(v.type==="FeatureCollection"){let C=new Set;for(let z of v.features){let P=Nt(z,T);if(P==null||C.has(P))return;C.add(P),M.set(P,z)}return M}})(this._data.geojson,o);if(!p)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:p}}if(!this._data.updateable)return;let h=(function(p,v,T){var M,C;let z=[];if(v.removeAll)p.clear();else if(v.remove)for(let P of v.remove){let k=p.get(P);k&&(z.push(k.geometry),p.delete(P))}if(v.add)for(let P of v.add){let k=Nt(P,T);if(k==null)continue;let L=p.get(k);L&&z.push(L.geometry),z.push(P.geometry),p.set(k,P)}if(v.update)for(let P of v.update){let k=p.get(P.id);if(!k)continue;let L=!!P.newGeometry,N=P.removeAllProperties||((M=P.removeProperties)===null||M===void 0?void 0:M.length)>0||((C=P.addOrUpdateProperties)===null||C===void 0?void 0:C.length)>0;if(!L&&!N)continue;z.push(k.geometry);let G=Object.assign({},k);if(p.set(P.id,G),L&&(z.push(P.newGeometry),G.geometry=P.newGeometry),N){if(G.properties=P.removeAllProperties?{}:Object.assign({},G.properties||{}),P.removeProperties)for(let $ of P.removeProperties)delete G.properties[$];if(P.addOrUpdateProperties)for(let{key:$,value:J}of P.addOrUpdateProperties)G.properties[$]=J}}return z})(this._data.updateable,t,o);return t.removeAll||this._options.cluster?void 0:h}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((o=>Ki(o)))}}shouldReloadTile(t,{affectedBounds:o}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;let{buffer:h,extent:p}=this.workerOptions.geojsonVtOptions,v=(function({x:T,y:M,z:C},z=0){let P=l.a4((T-z)/Math.pow(2,C)),k=l.a5((M+1+z)/Math.pow(2,C)),L=l.a4((T+1+z)/Math.pow(2,C)),N=l.a5((M-z)/Math.pow(2,C));return new Xe([P,k],[L,N])})(t.tileID.canonical,h/p);for(let T of o)if(v.intersects(T))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return l._(this,void 0,void 0,(function*(){let o=t.actor?"RT":"LT";t.actor=this.actor;let h={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;let p=yield this.actor.sendAsync({type:o,data:h},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(p,this.map.painter,o==="RT")}))}abortTile(t){return l._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class _i extends l.E{constructor(t,o,h,p){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=h,this.coordinates=o.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(p),this.options=o}load(t){return l._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new l.n("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let o=yield Ue.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,o?.data&&(this.image=o.data,t&&(this.coordinates=t),this._finishLoading())}catch(o){this._request=null,this._loaded=!0,l.$(o)||this.fire(new l.l(l.d(o)))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>this.texture=null)),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.n("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;let o=t.map(l.a7.fromLngLat);var h;return this.tileID=(function(p){let v=l.a8.fromPoints(p),T=v.width(),M=v.height(),C=Math.max(T,M),z=Math.max(0,Math.floor(-Math.log(C)/Math.LN2)),P=Math.pow(2,z);return new l.aa(z,Math.floor((v.minX+v.maxX)/2*P),Math.floor((v.minY+v.maxY)/2*P))})(o),this.terrainTileRanges=this._getOverlappingTileRanges(o),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=o.map((p=>this.tileID.getTilePoint(p)._round())),this.flippedWindingOrder=((h=this.tileCoords)[1].x-h[0].x)*(h[2].y-h[0].y)-(h[1].y-h[0].y)*(h[2].x-h[0].x)<0,this.fire(new l.n("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let t=this.map.painter.context,o=t.gl;this.texture||(this.texture=new l.T(t,this.image,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let h=!1;for(let p in this.tiles){let v=this.tiles[p];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,h=!0)}h&&this.fire(new l.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return l._(this,void 0,void 0,(function*(){var o;!((o=this.tileID)===null||o===void 0)&&o.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:o,minY:h,maxX:p,maxY:v}=l.a8.fromPoints(t),T={};for(let M=0;M<=l.a9;M++){let C=Math.pow(2,M),z=Math.floor(o*C),P=Math.floor(h*C),k=Math.floor(p*C),L=Math.floor(v*C),N=(z%C+C)%C,G=k%C,$=Math.floor(z/C),J=Math.floor(k/C);T[M]={minWrap:$,maxWrap:J,minTileXWrapped:N,maxTileXWrapped:G,minTileY:P,maxTileY:L}}return T}}class Dn extends _i{constructor(t,o,h,p){super(t,o,h,p),this._onPlayingHandler=()=>{var v;(v=this.map)===null||v===void 0||v.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=o}load(){return l._(this,void 0,void 0,(function*(){this._loaded=!1;let t=this.options;this.urls=[];for(let o of t.urls)this.urls.push((yield this.map._requestManager.transformRequest(o,"Source")).url);try{let o=yield l.ab(this.urls);if(this._loaded=!0,!o)return;this.video=o,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(o){this.fire(new l.l(l.d(o)))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let o=this.video.seekable;t<o.start(0)||t>o.end(0)?this.fire(new l.l(new l.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${o.start(0)} and ${o.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let t=this.map.painter.context,o=t.gl;this.texture?this.video.paused||(this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,this.video)):(this.texture=new l.T(t,this.video,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let h=!1;for(let p in this.tiles){let v=this.tiles[p];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,h=!0)}h&&this.fire(new l.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Qa extends _i{constructor(t,o,h,p){super(t,o,h,p),o.coordinates?Array.isArray(o.coordinates)&&o.coordinates.length===4&&!o.coordinates.some((v=>!Array.isArray(v)||v.length!==2||v.some((T=>typeof T!="number"))))||this.fire(new l.l(new l.ac(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.l(new l.ac(`sources.${t}`,null,'missing required property "coordinates"'))),o.animate&&typeof o.animate!="boolean"&&this.fire(new l.l(new l.ac(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),o.canvas?typeof o.canvas=="string"||o.canvas instanceof HTMLCanvasElement||this.fire(new l.l(new l.ac(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new l.l(new l.ac(`sources.${t}`,null,'missing required property "canvas"'))),this.options=o,this.animate=o.animate===void 0||o.animate}load(){return l._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.l(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let o=this.map.painter.context,h=o.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new l.T(o,this.canvas,h.RGBA,{premultiply:!0}),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let p=!1;for(let v in this.tiles){let T=this.tiles[v];T.state!=="loaded"&&(T.state="loaded",T.texture=this.texture,p=!0)}p&&this.fire(new l.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}let ha={},As=g=>{switch(g){case"geojson":return xt;case"image":return _i;case"raster":return ci;case"raster-dem":return zt;case"vector":return Gt;case"video":return Dn;case"canvas":return Qa}return ha[g]},zo="RTLPluginLoaded";class $c extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=qt()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((o=>{throw this.status="error",o}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return l._(this,arguments,void 0,(function*(o,h=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=pe.resolveURL(o),!this.url)throw new Error(`requested url ${o} is invalid`);if(this.status==="unavailable"){if(!h)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return l._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.n(zo))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Do=null;function Gr(){return Do||(Do=new $c),Do}var Zr,bn;(function(g){g[g.Base=0]="Base",g[g.Parent=1]="Parent"})(Zr||(Zr={})),(function(g){g[g.Departing=0]="Departing",g[g.Incoming=1]="Incoming"})(bn||(bn={}));class Ut{constructor(t,o){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=l.ad(),this.uses=0,this.tileSize=o,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:o,fadingParentID:h,fadeEndTime:p}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=o,this.fadingParentID=h,this.fadeEndTime=p}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=le(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,o,h){if(t?.etagUnmodified!==!0)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=(function(p,v){let T={};if(!v)return T;for(let M of p){let C=M.layerIds.map((z=>v.getLayer(z))).filter(Boolean);if(C.length!==0){M.layers=C,M.stateDependentLayerIds&&(M.stateDependentLayers=M.stateDependentLayerIds.map((z=>C.filter((P=>P.id===z))[0])));for(let z of C)T[z.id]=M}}return T})(t.buckets,o?.style),this.hasSymbolBuckets=!1;for(let p in this.buckets){let v=this.buckets[p];if(v instanceof l.af){if(this.hasSymbolBuckets=!0,!h)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let p in this.buckets){let v=this.buckets[p];if(v instanceof l.af&&v.hasRTLText){this.hasRTLText=!0,Gr().lazyLoad();break}}this.queryPadding=0;for(let p in this.buckets){let v=this.buckets[p];this.queryPadding=Math.max(this.queryPadding,o.style.getLayer(p).queryRadius(v))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new l.ae;else this.state="loaded"}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let h in this.buckets){let p=this.buckets[h];p.uploadPending()&&p.upload(t)}let o=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new l.T(t,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new l.T(t,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,o,h,p,v,T,M,C,z,P,k){var L;return!((L=this.latestFeatureIndex)===null||L===void 0)&&L.rawTileData?this.latestFeatureIndex.query({queryGeometry:p,cameraQueryGeometry:v,scale:T,tileSize:this.tileSize,pixelPosMatrix:P,transform:C,params:M,queryPadding:this.queryPadding*z,getElevation:k},t,o,h):{}}querySourceFeatures(t,o){let h=this.latestFeatureIndex;if(!h?.rawTileData)return;let p=h.loadVTLayers(),v=o?.sourceLayer?o.sourceLayer:"",T=p[l.ag]||p[v];if(!T)return;let M=l.ah(o?.filter,o?.globalState),{z:C,x:z,y:P}=this.tileID.canonical,k={z:C,x:z,y:P};for(let L=0;L<T.length;L++){let N=T.feature(L);if(M.needGeometry){let J=l.ai(N,!0);if(!M.filter(new l.J(this.tileID.overscaledZ),J,this.tileID.canonical))continue}else if(!M.filter(new l.J(this.tileID.overscaledZ),N))continue;let G=h.getId(N,v),$=new l.aj(N,C,z,P,G);$.tile=k,t.push($)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let o=this.expirationTime;if(t.cacheControl){let h=l.ak(t.cacheControl);h["max-age"]&&(this.expirationTime=Date.now()+1e3*h["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let h=Date.now(),p=!1;if(this.expirationTime>h)p=!1;else if(o)if(this.expirationTime<o)p=!0;else{let v=this.expirationTime-o;v?this.expirationTime=h+Math.max(v,3e4):p=!0}else p=!0;p?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,o){var h,p,v;if(!(!((h=this.latestFeatureIndex)===null||h===void 0)&&h.rawTileData)||Object.keys(t).length===0)return;let T=this.latestFeatureIndex.loadVTLayers();for(let M in this.buckets){if(!o.style.hasLayer(M))continue;let C=this.buckets[M],z=C.layers[0].sourceLayer||l.ag,P=T[z],k=t[z];if(!P||!k||Object.keys(k).length===0)continue;C.update(k,P,((p=this.imageAtlas)===null||p===void 0?void 0:p.patternPositions)||{},this.dashPositions||{});let L=(v=o?.style)===null||v===void 0?void 0:v.getLayer(M);L&&(this.queryPadding=Math.max(this.queryPadding,L.queryRadius(C)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<le()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=le()+t}setDependencies(t,o){let h={};for(let p of o)h[p]=!0;this.dependencies[t]=h}hasDependency(t,o){for(let h of t){let p=this.dependencies[h];if(p){for(let v of o)if(p[v])return!0}}return!1}}class Gi{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,o,h){var p,v,T,M,C;let z=String(o);if((M=this.stateChanges)[t]||(M[t]={}),(C=this.stateChanges[t])[z]||(C[z]={}),l.e(this.stateChanges[t][z],h),this.deletedStates[t]===null){this.deletedStates[t]={};for(let P in this.state[t])P!==z&&(this.deletedStates[t][P]=null)}else if(((p=this.deletedStates[t])===null||p===void 0?void 0:p[z])===null){this.deletedStates[t][z]={};for(let P in this.state[t][z])h[P]||(this.deletedStates[t][z][P]=null)}else for(let P in h)((T=(v=this.deletedStates[t])===null||v===void 0?void 0:v[z])===null||T===void 0?void 0:T[P])===null&&delete this.deletedStates[t][z][P]}removeFeatureState(t,o,h){var p,v,T;if(this.deletedStates[t]===null)return;let M=String(o);if((v=this.deletedStates)[t]||(v[t]={}),h&&o!==void 0)this.deletedStates[t][M]!==null&&((T=this.deletedStates[t])[M]||(T[M]={}),this.deletedStates[t][M][h]=null);else if(o!==void 0)if(!((p=this.stateChanges[t])===null||p===void 0)&&p[M])for(h in this.deletedStates[t][M]={},this.stateChanges[t][M])this.deletedStates[t][M][h]=null;else this.deletedStates[t][M]=null;else this.deletedStates[t]=null}getState(t,o){let h=String(o),p=l.e({},(this.state[t]||{})[h],(this.stateChanges[t]||{})[h]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){let v=this.deletedStates[t][o];if(v===null)return{};for(let T in v)delete p[T]}return p}initializeTileState(t,o){t.setFeatureState(this.state,o)}coalesceChanges(t,o){var h,p,v;let T={};for(let M in this.stateChanges){(h=this.state)[M]||(h[M]={});let C={};for(let z in this.stateChanges[M])(p=this.state[M])[z]||(p[z]={}),l.e(this.state[M][z],this.stateChanges[M][z]),C[z]=this.state[M][z];T[M]=C}for(let M in this.deletedStates){(v=this.state)[M]||(v[M]={});let C={};if(this.deletedStates[M]===null)for(let z in this.state[M])C[z]={},this.state[M][z]={};else for(let z in this.deletedStates[M]){if(this.deletedStates[M][z]===null)this.state[M][z]={};else for(let P of Object.keys(this.deletedStates[M][z]))delete this.state[M][z][P];C[z]=this.state[M][z]}T[M]||(T[M]={}),l.e(T[M],C)}this.stateChanges={},this.deletedStates={},Object.keys(T).length!==0&&(this.revision++,t.setFeatureState(T,o))}}let xn=89.25;function Dt(g,t){let o=l.al(t.lat,-l.am,l.am);return new l.P(l.Z(t.lng)*g,l.Y(o)*g)}function Ui(g,t){return new l.a7(t.x/g,t.y/g).toLngLat()}function da(g){return g.cameraToCenterDistance*Math.min(.85*Math.tan(l.an(90-g.pitch)),Math.tan(l.an(xn-g.pitch)))}function Ja(g,t){let o=g.canonical,h=t/l.ao(o.z),p=o.x+Math.pow(2,o.z)*g.wrap,v=l.ap(new Float64Array(16));return l.Q(v,v,[p*h,o.y*h,0]),l.S(v,v,[h/l.a6,h/l.a6,1]),v}function eo(g,t,o,h,p){let v=l.a7.fromLngLat(g,t),T=p*l.aq(1,g.lat),{x:M,y:C,z}=Po(o,h);return new l.a7(v.x+T*-M,v.y+T*-C,v.z+T*-z)}function Po(g,t){let o=l.an(g),h=l.an(t),p=Math.cos(-o),v=Math.sin(o);return{x:v*Math.sin(h),y:-v*Math.cos(h),z:p}}function Ce(g,t,o){let h=t.intersectsFrustum(g);if(!o||h===0)return h;let p=t.intersectsPlane(o);return p===0?0:h===2&&p===2?2:1}function sd(g,t,o){let h=0,p=(o-t)/10;for(let v=0;v<10;v++)h+=p*Math.pow(Math.cos(t+(v+.5)/10*(o-t)),g);return h}function ld(g,t){return function(o,h,p,v,T){let M=2*((g-1)/l.ar(Math.cos(l.an(xn-T))/Math.cos(l.an(xn)))-1),C=Math.acos(p/v),z=2*sd(M-1,0,l.an(T/2)),P=Math.min(l.an(xn),C+l.an(T/2)),k=sd(M-1,Math.min(P,C-l.an(T/2)),P),L=Math.atan(h/p),N=Math.hypot(h,p),G=o;return G+=l.ar(v/N/Math.max(.5,Math.cos(l.an(T/2)))),G+=M*l.ar(Math.cos(L))/2,G-=l.ar(Math.max(1,k/z/t))/2,G}}let Vt=ld(9.314,3);function sr(g,t){let o=(t.roundZoom?Math.round:Math.floor)(g.zoom+l.ar(g.tileSize/t.tileSize));return Math.max(0,o)}function Ro(g,t){let o=g.getCameraFrustum(),h=g.getClippingPlane(),p=g.screenPointToMercatorCoordinate(g.getCameraPoint()),v=l.a7.fromLngLat(g.center,g.elevation);p.z=v.z+Math.cos(g.pitchInRadians)*g.cameraToCenterDistance/g.worldSize;let T=g.getCoveringTilesDetailsProvider(),M=T.allowVariableZoom(g,t),C=sr(g,t),z=t.minzoom||0,P=t.maxzoom!==void 0?t.maxzoom:g.maxZoom,k=Math.min(Math.max(0,C),P),L=Math.pow(2,k),N=[L*p.x,L*p.y,0],G=[L*v.x,L*v.y,0],$=Math.hypot(v.x-p.x,v.y-p.y),J=Math.abs(v.z-p.z),W=Math.hypot($,J),ee=Q=>({zoom:0,x:0,y:0,wrap:Q,fullyVisible:!1}),ae=[],te=[];if(g.renderWorldCopies&&T.allowWorldCopies())for(let Q=1;Q<=3;Q++)ae.push(ee(-Q)),ae.push(ee(Q));for(ae.push(ee(0));ae.length>0;){let Q=ae.pop(),re=Q.x,ie=Q.y,me=Q.fullyVisible,Te={x:re,y:ie,z:Q.zoom},Se=T.getTileBoundingVolume(Te,Q.wrap,g.elevation,t);if(!me){let qe=Ce(o,Se,h);if(qe===0)continue;me=qe===2}let Ie=T.distanceToTile2d(p.x,p.y,Te,Se),Pe=C;M&&(Pe=(t.calculateTileZoom||Vt)(g.zoom+l.ar(g.tileSize/t.tileSize),Ie,J,W,g.fov)),Pe=(t.roundZoom?Math.round:Math.floor)(Pe),Pe=Math.max(0,Pe);let Qe=Math.min(Pe,P);if(Q.wrap=T.getWrap(v,Te,Q.wrap),Q.zoom>=Qe){if(Q.zoom<z)continue;let qe=k-Q.zoom,Ae=N[0]-.5-(re<<qe),$e=N[1]-.5-(ie<<qe),et=t.reparseOverscaled?Math.max(Q.zoom,Pe):Q.zoom;te.push({tileID:new l.a3(Q.zoom===P?et:Q.zoom,Q.wrap,Q.zoom,re,ie),distanceSq:l.as([G[0]-.5-re,G[1]-.5-ie]),tileDistanceToCamera:Math.sqrt(Ae*Ae+$e*$e)})}else for(let qe=0;qe<4;qe++)ae.push({zoom:Q.zoom+1,x:(re<<1)+qe%2,y:(ie<<1)+(qe>>1),wrap:Q.wrap,fullyVisible:me})}return te.sort(((Q,re)=>Q.distanceSq-re.distanceSq)).map((Q=>Q.tileID))}let Ff=l.a8.fromPoints([new l.P(0,0),new l.P(l.a6,l.a6)]);function Nf(g){return g==="raster"||g==="image"||g==="video"}function s1(g,t,o,h,p,v,T){if(!t.hasData())return!1;let{tileID:M,fadingRole:C,fadingDirection:z,fadingParentID:P}=t;if(C===Zr.Base&&z===bn.Incoming&&P)return o[P.key]=P,!0;let k=Math.max(M.overscaledZ-p,v);for(let L=M.overscaledZ-1;L>=k;L--){let N=M.scaledTo(L),G=g.getLoadedTile(N);if(G)return t.setCrossFadeLogic({fadingRole:Zr.Base,fadingDirection:bn.Incoming,fadingParentID:G.tileID,fadeEndTime:h+T}),G.setCrossFadeLogic({fadingRole:Zr.Parent,fadingDirection:bn.Departing,fadeEndTime:h+T}),o[N.key]=N,!0}return!1}function Xc(g,t,o,h,p,v){if(!t.hasData())return!1;let T=t.tileID.children(p),M=cd(g,t,T,o,h,p,v);if(M)return!0;for(let C of T)cd(g,t,C.children(p),o,h,p,v)&&(M=!0);return M}function cd(g,t,o,h,p,v,T){if(o[0].overscaledZ>=v)return!1;let M=!1;for(let C of o){let z=g.getLoadedTile(C);if(!z)continue;let{fadingRole:P,fadingDirection:k,fadingParentID:L}=z;P===Zr.Base&&k===bn.Departing&&L||(z.setCrossFadeLogic({fadingRole:Zr.Base,fadingDirection:bn.Departing,fadingParentID:t.tileID,fadeEndTime:p+T}),t.setCrossFadeLogic({fadingRole:Zr.Parent,fadingDirection:bn.Incoming,fadeEndTime:p+T})),h[C.key]=C,M=!0}return M}function Uf(g,t,o,h){let p=g.tileID;return!!g.selfFading||!g.hasData()&&!!t.has(p)&&(g.setSelfFadeLogic(o+h),!0)}function Ve(g,t){var o;g.needsHillshadePrepare=!0,g.needsTerrainPrepare=!0;let h=t.tileID.canonical.x-g.tileID.canonical.x,p=t.tileID.canonical.y-g.tileID.canonical.y,v=Math.pow(2,g.tileID.canonical.z),T=t.tileID.key;h===0&&p===0||Math.abs(p)>1||(Math.abs(h)>1&&(Math.abs(h+v)===1?h+=v:Math.abs(h-v)===1&&(h-=v)),t.dem&&g.dem&&(g.dem.backfillBorder(t.dem,h,p),!((o=g.neighboringTiles)===null||o===void 0)&&o[T]&&(g.neighboringTiles[T].backfilled=!0)))}class Io{constructor(){this._tiles={}}handleWrapJump(t){let o={};for(let h in this._tiles){let p=this._tiles[h];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+t),o[p.tileID.key]=p}this._tiles=o}setFeatureState(t,o){for(let h in this._tiles)this._tiles[h].setFeatureState(t,o)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((o=>o.tileID)).sort(l.au).map((o=>o.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,o){this._tiles[t]=o}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){let o=this.getTileById(t.key);return o?.hasData()?o:null}isIdRenderable(t,o=!1){var h;return(h=this.getTileById(t))===null||h===void 0?void 0:h.isRenderable(o)}getRenderableIds(t=0,o){let h=[];for(let p of this.getAllIds())this.isIdRenderable(p,o)&&h.push(this.getTileById(p));return o?h.sort(((p,v)=>{let T=p.tileID,M=v.tileID,C=new l.P(T.canonical.x,T.canonical.y)._rotate(-t),z=new l.P(M.canonical.x,M.canonical.y)._rotate(-t);return T.overscaledZ-M.overscaledZ||z.y-C.y||z.x-C.x})).map((p=>p.tileID.key)):h.map((p=>p.tileID)).sort(l.au).map((p=>p.key))}}class wn extends l.E{constructor(t,o,h){super(),this.id=t,this.dispatcher=h,this.on("data",(p=>{this._dataHandler(p)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((p,v,T,M)=>{let C=new(As(v.type))(p,v,T,M);if(C.id!==p)throw new Error(`Expected Source id to be ${p} instead of ${C.id}`);return C})(t,o,h,this),this._inViewTiles=new Io,this._outOfViewCache=new l.av(0,(p=>this._unloadTile(p))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Gi,this._didEmitContent=!1,this._updated=!1}onAdd(t){var o;this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,!((o=this._source)===null||o===void 0)&&o.onAdd&&this._source.onAdd(t)}onRemove(t){var o;for(let h of this._inViewTiles.getAllTiles())h.unloadVectorData();this.clearTiles(),!((o=this._source)===null||o===void 0)&&o.onRemove&&this._source.onRemove(t),this._inViewTiles=new Io}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,o,h){return l._(this,void 0,void 0,(function*(){try{let p=yield this._source.loadTile(t);this._tileLoaded(t,o,h,p)}catch(p){t.state="errored",p.status!==404?this._source.fire(new l.l(l.d(p),{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new l.n("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let o of this._inViewTiles.getAllTiles())o.upload(t),o.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var o;return this._inViewTiles.getRenderableIds((o=this.transform)===null||o===void 0?void 0:o.bearingInRadians,t)}hasRenderableParent(t){let o=t.overscaledZ-1;if(o>=this._source.minzoom){let h=this.getLoadedTile(t.scaledTo(o));if(h)return this._inViewTiles.isIdRenderable(h.tileID.key)}return!1}reload(t,o=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let h of this._inViewTiles.getAllIds()){let p=this._inViewTiles.getTileById(h);o&&!this._source.shouldReloadTile(p,o)||(t?this._reloadTile(h,"expired"):p.state!=="errored"&&this._reloadTile(h,"reloading"))}}}_reloadTile(t,o){return l._(this,void 0,void 0,(function*(){let h=this._inViewTiles.getTileById(t);h&&(h.state!=="loading"&&(h.state=o),yield this._loadTile(h,t,o))}))}_tileLoaded(t,o,h,p){t.timeAdded=le(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),h==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(o,t),p?.unmodified||(this.getSource().type==="raster-dem"&&t.dem&&(function(v,T){var M,C,z;let P=T.getRenderableIds();for(let k of P){if(!(!((M=v.neighboringTiles)===null||M===void 0)&&M[k]))continue;let L=T.getTileById(k);v.neighboringTiles[k].backfilled||Ve(v,L),!((z=(C=L.neighboringTiles)===null||C===void 0?void 0:C[v.tileID.key])===null||z===void 0)&&z.backfilled||Ve(L,v)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new l.n("data",{dataType:"source",tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,o){let h=this._getLoadedDescendents(o),p=new Set;for(let v of o){let T=h[v.key];if(!T?.length){p.add(v);continue}let M=v.overscaledZ+wn.maxOverzooming,C=T.filter((k=>k.tileID.overscaledZ<=M));if(!C.length){p.add(v);continue}let z=Math.min(...C.map((k=>k.tileID.overscaledZ))),P=C.filter((k=>k.tileID.overscaledZ===z)).map((k=>k.tileID));for(let k of P)t[k.key]=k;this._areDescendentsComplete(P,z,v.overscaledZ)||p.add(v)}return p}_getLoadedDescendents(t){var o;let h={};for(let p of this._inViewTiles.getAllTiles().filter((v=>v.hasData())))for(let v of t)p.tileID.isChildOf(v)&&(h[o=v.key]||(h[o]=[]),h[v.key].push(p));return h}_areDescendentsComplete(t,o,h){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===o:Math.pow(4,o-h)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let o=Math.ceil(t.width/this._source.tileSize)+1,h=Math.ceil(t.height/this._source.tileSize)+1,p=Math.floor(o*h*(this._maxTileCacheZoomLevels===null?l.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,p):p;this._outOfViewCache.setMaxSize(v)}handleWrapJump(t){let o=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,o&&(this._inViewTiles.handleWrapJump(o),this._resetTileReloadTimers())}update(t,o){if(!this._sourceLoaded||this._paused)return;let h;this.transform=t,this.terrain=o,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?h=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((C=>new l.a3(C.canonical.z,C.wrap,C.canonical.z,C.canonical.x,C.canonical.y))):(h=Ro(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:o,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(h=h.filter((C=>this._source.hasTile(C))))):h=[],this.usedForTerrain&&(h=this._addTerrainIdealTiles(h));let p=h.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,p&&this.fire(new l.n("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let v=sr(t,this._source),T=this._updateRetainedTiles(h,v),M=Nf(this._source.type);M&&this._rasterFadeDuration>0&&!o&&(function(C,z,P,k,L,N,G){let $=le(),J=l.at(z);for(let W of z){let ee=C.getTileById(W.key);ee.fadingDirection!==bn.Departing&&ee.fadeOpacity!==0||ee.resetFadeLogic(),s1(C,ee,P,$,k,L,G)||Xc(C,ee,P,$,N,G)||Uf(ee,J,$,G)||ee.resetFadeLogic()}})(this._inViewTiles,h,T,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),M?this._cleanUpRasterTiles(T):this._cleanUpVectorTiles(T)}_cleanUpRasterTiles(t){for(let o of this._inViewTiles.getAllIds())t[o]||this._removeTile(o)}_cleanUpVectorTiles(t){for(let o of this._inViewTiles.getAllIds()){let h=this._inViewTiles.getTileById(o);t[o]?h.clearSymbolFadeHold():h.hasSymbolBuckets?h.holdingForSymbolFade()?h.symbolFadeFinished()&&this._removeTile(o):h.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(o)}}_addTerrainIdealTiles(t){let o=[];for(let h of t)if(h.canonical.z>this._source.minzoom){let p=h.scaledTo(h.canonical.z-1);o.push(p);let v=h.scaledTo(Math.max(this._source.minzoom,Math.min(h.canonical.z,5)));o.push(v)}return t.concat(o)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,o){var h;let p=new Set;for(let z of t)this._addTile(z).hasData()||p.add(z);let v=t.reduce(((z,P)=>(z[P.key]=P,z)),{}),T=this._retainLoadedChildren(v,p),M={},C=Math.max(o-wn.maxUnderzooming,this._source.minzoom);for(let z of T){let P=this._inViewTiles.getTileById(z.key),k=P?.wasRequested();for(let L=z.overscaledZ-1;L>=C;--L){let N=z.scaledTo(L);if(M[N.key])break;if(M[N.key]=!0,P=this.getTile(N),!P&&k&&(P=this._addTile(N)),P){let G=P.hasData();if((G||!(!((h=this.map)===null||h===void 0)&&h.cancelPendingTileRequestsWhileZooming)||k)&&(v[N.key]=N),k=P.wasRequested(),G)break}}}return v}_addTile(t){let o=this._inViewTiles.getTileById(t.key);if(o)return o;o=this._outOfViewCache.getAndRemove(t),o&&(o.resetFadeLogic(),this._setTileReloadTimer(t.key,o),o.tileID=t,this._state.initializeTileState(o,this.map?this.map.painter:null));let h=o;return o||(o=new Ut(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(o,t.key,o.state)),o.uses++,this._inViewTiles.setTile(t.key,o),h||this._source.fire(new l.n("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(t,o){this._clearTileReloadTimer(t);let h=o.getExpiryTimeout();h&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),h))}_clearTileReloadTimer(t){let o=this._timers[t];o&&(clearTimeout(o),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let o=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,o)}}refreshTiles(t){for(let o of this._inViewTiles.getAllIds()){let h=this._inViewTiles.getTileById(o);(this._inViewTiles.isIdRenderable(o)||h.state=="errored")&&t.some((p=>p.equals(h.tileID.canonical)))&&this._reloadTile(o,"expired")}}_removeTile(t){let o=this._inViewTiles.getTileById(t);o&&(o.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),o.uses>0||(o.hasData()&&o.state!=="reloading"?this._outOfViewCache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,o,h){let p=[],v=this.transform;if(!v)return p;let T=v.getCoveringTilesDetailsProvider().allowWorldCopies(),M=h?v.getCameraQueryGeometry(t):t,C=N=>v.screenPointToMercatorCoordinate(N,this.terrain),z=this.transformBbox(t,C,!T),P=this.transformBbox(M,C,!T),k=this.getIds(),L=l.a8.fromPoints(P);for(let N of k){let G=this._inViewTiles.getTileById(N);if(G.holdingForSymbolFade())continue;let $=T?[G.tileID]:[G.tileID.unwrapTo(-1),G.tileID.unwrapTo(0)],J=Math.pow(2,v.zoom-G.tileID.overscaledZ),W=o*G.queryPadding*l.a6/G.tileSize/J;for(let ee of $){let ae=L.map((te=>ee.getTilePoint(new l.a7(te.x,te.y))));if(ae.expandBy(W),ae.intersects(Ff)){let te=z.map((re=>ee.getTilePoint(re))),Q=P.map((re=>ee.getTilePoint(re)));p.push({tile:G,tileID:T?ee:ee.unwrapTo(0),queryGeometry:te,cameraQueryGeometry:Q,scale:J})}}}return p}transformBbox(t,o,h){let p=t.map(o);if(h){let v=l.a8.fromPoints(t);v.shrinkBy(.001*Math.min(v.width(),v.height()));let T=v.map(o);l.a8.fromPoints(p).covers(T)||(p=p.map((M=>M.x>.5?new l.a7(M.x-1,M.y,M.z):M)))}return p}getVisibleCoordinates(t){let o=this.getRenderableIds(t).map((h=>this._inViewTiles.getTileById(h).tileID));return this.transform&&this.transform.populateCache(o),o}hasTransition(){return!!this._source.hasTransition()||Nf(this._source.type)&&(function(t,o){if(o<=0)return!1;let h=le();for(let p of t.getAllTiles())if(p.fadeEndTime>=h)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,o,h){t||(t=l.ag),this._state.updateState(t,o,h)}removeFeatureState(t,o,h){t||(t=l.ag),this._state.removeFeatureState(t,o,h)}getFeatureState(t,o){return t||(t=l.ag),this._state.getState(t,o)}setDependencies(t,o,h){let p=this._inViewTiles.getTileById(t);p&&p.setDependencies(o,h)}reloadTilesForDependencies(t,o){for(let h of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(h).hasDependency(t,o)&&this._reloadTile(h,"reloading");this._outOfViewCache.filter((h=>!h.hasDependency(t,o)))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}wn.maxUnderzooming=10,wn.maxOverzooming=3;class ud{constructor(t,o){this.reset(t,o)}reset(t,o){this.points=t||[],this._distances=[0];for(let h=1;h<this.points.length;h++)this._distances[h]=this._distances[h-1]+this.points[h].dist(this.points[h-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=l.al(t,0,1);let o=1,h=this._distances[o],p=t*this.paddedLength+this.padding;for(;h<p&&o<this._distances.length;)h=this._distances[++o];let v=o-1,T=this._distances[v],M=h-T,C=M>0?(p-T)/M:0;return this.points[v].mult(1-C).add(this.points[o].mult(C))}}function to(g,t){let o=!0;return g==="always"||g!=="never"&&t!=="never"||(o=!1),o}class Ze{constructor(t,o,h){let p=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(t/h),this.yCellCount=Math.ceil(o/h);for(let T=0;T<this.xCellCount*this.yCellCount;T++)p.push([]),v.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=o,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/o,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,o,h,p,v){this._forEachCell(o,h,p,v,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(o),this.bboxes.push(h),this.bboxes.push(p),this.bboxes.push(v)}insertCircle(t,o,h,p){this._forEachCell(o-p,h-p,o+p,h+p,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(o),this.circles.push(h),this.circles.push(p)}_insertBoxCell(t,o,h,p,v,T){this.boxCells[v].push(T)}_insertCircleCell(t,o,h,p,v,T){this.circleCells[v].push(T)}_query(t,o,h,p,v,T,M){if(h<0||t>this.width||p<0||o>this.height)return[];let C=[];if(t<=0&&o<=0&&this.width<=h&&this.height<=p){if(v)return[{key:null,x1:t,y1:o,x2:h,y2:p}];for(let z=0;z<this.boxKeys.length;z++)C.push({key:this.boxKeys[z],x1:this.bboxes[4*z],y1:this.bboxes[4*z+1],x2:this.bboxes[4*z+2],y2:this.bboxes[4*z+3]});for(let z=0;z<this.circleKeys.length;z++){let P=this.circles[3*z],k=this.circles[3*z+1],L=this.circles[3*z+2];C.push({key:this.circleKeys[z],x1:P-L,y1:k-L,x2:P+L,y2:k+L})}}else this._forEachCell(t,o,h,p,this._queryCell,C,{hitTest:v,overlapMode:T,seenUids:{box:{},circle:{}}},M);return C}query(t,o,h,p){return this._query(t,o,h,p,!1,null)}hitTest(t,o,h,p,v,T){return this._query(t,o,h,p,!0,v,T).length>0}hitTestCircle(t,o,h,p,v){let T=t-h,M=t+h,C=o-h,z=o+h;if(M<0||T>this.width||z<0||C>this.height)return!1;let P=[];return this._forEachCell(T,C,M,z,this._queryCellCircle,P,{hitTest:!0,overlapMode:p,circle:{x:t,y:o,radius:h},seenUids:{box:{},circle:{}}},v),P.length>0}_queryCell(t,o,h,p,v,T,M,C){let{seenUids:z,hitTest:P,overlapMode:k}=M,L=this.boxCells[v],N=1e-6;if(L!==null){let $=this.bboxes;for(let J of L)if(!z.box[J]){z.box[J]=!0;let W=4*J,ee=this.boxKeys[J];if(t<=$[W+2]+N&&o<=$[W+3]+N&&h>=$[W+0]-N&&p>=$[W+1]-N&&(!C||C(ee))&&(!P||!to(k,ee.overlapMode))&&(T.push({key:ee,x1:$[W],y1:$[W+1],x2:$[W+2],y2:$[W+3]}),P))return!0}}let G=this.circleCells[v];if(G!==null){let $=this.circles;for(let J of G)if(!z.circle[J]){z.circle[J]=!0;let W=3*J,ee=this.circleKeys[J];if(this._circleAndRectCollide($[W],$[W+1],$[W+2],t,o,h,p)&&(!C||C(ee))&&(!P||!to(k,ee.overlapMode))){let ae=$[W],te=$[W+1],Q=$[W+2];if(T.push({key:ee,x1:ae-Q,y1:te-Q,x2:ae+Q,y2:te+Q}),P)return!0}}}return!1}_queryCellCircle(t,o,h,p,v,T,M,C){let{circle:z,seenUids:P,overlapMode:k}=M,L=this.boxCells[v];if(L!==null){let G=this.bboxes;for(let $ of L)if(!P.box[$]){P.box[$]=!0;let J=4*$,W=this.boxKeys[$];if(this._circleAndRectCollide(z.x,z.y,z.radius,G[J+0],G[J+1],G[J+2],G[J+3])&&(!C||C(W))&&!to(k,W.overlapMode))return T.push(!0),!0}}let N=this.circleCells[v];if(N!==null){let G=this.circles;for(let $ of N)if(!P.circle[$]){P.circle[$]=!0;let J=3*$,W=this.circleKeys[$];if(this._circlesCollide(G[J],G[J+1],G[J+2],z.x,z.y,z.radius)&&(!C||C(W))&&!to(k,W.overlapMode))return T.push(!0),!0}}}_forEachCell(t,o,h,p,v,T,M,C){let z=this._convertToXCellCoord(t),P=this._convertToYCellCoord(o),k=this._convertToXCellCoord(h),L=this._convertToYCellCoord(p);for(let N=z;N<=k;N++)for(let G=P;G<=L;G++)if(v.call(this,t,o,h,p,this.xCellCount*G+N,T,M,C))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,o,h,p,v,T){let M=p-t,C=v-o,z=h+T;return z*z>M*M+C*C}_circleAndRectCollide(t,o,h,p,v,T,M){let C=(T-p)/2,z=Math.abs(t-(p+C));if(z>C+h)return!1;let P=(M-v)/2,k=Math.abs(o-(v+P));if(k>P+h)return!1;if(z<=C||k<=P)return!0;let L=z-C,N=k-P;return L*L+N*N<=h*h}}function ct(g,t){let o=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),h=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),p=t[0]*o,v=t[4]*o,T=t[8]*h,M=t[1]*o,C=t[5]*o,z=t[9]*h,P=t[2]*o,k=t[6]*o,L=t[10]*h;g[0]=p,g[1]=v,g[2]=T,g[4]=M,g[5]=C,g[6]=z,g[8]=P,g[9]=k,g[10]=L;let N=t[12],G=t[13],$=t[14];return g[12]=-p*N-M*G-P*$,g[13]=-v*N-C*G-k*$,g[14]=-T*N-z*G-L*$,g[3]=0,g[7]=0,g[11]=0,g[15]=1,g}let mt=l.O();function mr(g,t,o){let h=l.O();if(!g){let{vecSouth:k,vecEast:L}=Ra(t),N=B();N[0]=L[0],N[1]=L[1],N[2]=k[0],N[3]=k[1],p=N,(P=(T=(v=N)[0])*(z=v[3])-(C=v[2])*(M=v[1]))&&(p[0]=z*(P=1/P),p[1]=-M*P,p[2]=-C*P,p[3]=T*P),h[0]=N[0],h[1]=N[1],h[4]=N[2],h[5]=N[3]}var p,v,T,M,C,z,P;return l.S(h,h,[1/o,1/o,1]),h}function Yc(g,t,o,h){if(g){let p=l.O();if(!t){let{vecSouth:v,vecEast:T}=Ra(o);p[0]=T[0],p[1]=T[1],p[4]=v[0],p[5]=v[1]}return l.S(p,p,[h,h,1]),p}return o.pixelsToClipSpaceMatrix}function Ra(g){let t=Math.cos(g.rollInRadians),o=Math.sin(g.rollInRadians),h=Math.cos(g.pitchInRadians),p=Math.cos(g.bearingInRadians),v=Math.sin(g.bearingInRadians),T=l.az();T[0]=-p*h*o-v*t,T[1]=-v*h*o+p*t;let M=l.aA(T);M<1e-9?l.aB(T):l.aC(T,T,1/M);let C=l.az();C[0]=p*h*t-v*o,C[1]=v*h*t+p*o;let z=l.aA(C);return z<1e-9?l.aB(C):l.aC(C,C,1/z),{vecEast:C,vecSouth:T}}function ht(g,t,o,h){let p;h?(p=[g,t,h(g,t),1],l.aE(p,p,o)):(p=[g,t,0,1],Qc(p,p,o));let v=p[3];return{point:new l.P(p[0]/v,p[1]/v),signedDistanceFromCamera:v,isOccluded:!1}}function Ol(g,t){return .5+g/t*.5}function Bl(g,t){return g.x>=-t[0]&&g.x<=t[0]&&g.y>=-t[1]&&g.y<=t[1]}function Wc(g,t,o,h,p,v,T,M,C,z,P,k,L){let N=o?g.textSizeData:g.iconSizeData,G=l.aw(N,t.transform.zoom),$=[256/t.width*2+1,256/t.height*2+1],J=o?g.text.dynamicLayoutVertexArray:g.icon.dynamicLayoutVertexArray;J.clear();let W=g.lineVertexArray,ee=o?g.text.placedSymbolArray:g.icon.placedSymbolArray,ae=t.transform.width/t.transform.height,te=!1;for(let Q=0;Q<ee.length;Q++){let re=ee.get(Q);if(re.hidden||re.writingMode===l.ax.vertical&&!te){Lo(re.numGlyphs,J);continue}te=!1;let ie=new l.P(re.anchorX,re.anchorY),me={getElevation:L,pitchedLabelPlaneMatrix:h,lineVertexArray:W,pitchWithMap:v,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:ie,unwrappedTileID:C,width:z,height:P,translation:k},Te=Ps(re.anchorX,re.anchorY,me);if(!Bl(Te.point,$)){Lo(re.numGlyphs,J);continue}let Se=Ol(t.transform.cameraToCenterDistance,Te.signedDistanceFromCamera),Ie=l.ay(N,G,re),Pe=v?Ie*t.transform.getPitchedTextCorrection(re.anchorX,re.anchorY,C)/Se:Ie*Se,Qe=Ds({projectionContext:me,pitchedLabelPlaneMatrixInverse:p,symbol:re,fontSize:Pe,flip:!1,keepUpright:T,glyphOffsetArray:g.glyphOffsetArray,dynamicLayoutVertexArray:J,aspectRatio:ae,rotateToLine:M});te=Qe.useVertical,(Qe.notEnoughRoom||te||Qe.needsFlipping&&Ds({projectionContext:me,pitchedLabelPlaneMatrixInverse:p,symbol:re,fontSize:Pe,flip:!0,keepUpright:T,glyphOffsetArray:g.glyphOffsetArray,dynamicLayoutVertexArray:J,aspectRatio:ae,rotateToLine:M}).notEnoughRoom)&&Lo(re.numGlyphs,J)}o?g.text.dynamicLayoutVertexBuffer.updateData(J):g.icon.dynamicLayoutVertexBuffer.updateData(J)}function zs(g,t,o,h,p,v,T,M){let C=v.glyphStartIndex+v.numGlyphs,z=v.lineStartIndex,P=v.lineStartIndex+v.lineLength,k=t.getoffsetX(v.glyphStartIndex),L=t.getoffsetX(C-1),N=Hr(g*k,o,h,p,v.segment,z,P,M,T);if(!N)return null;let G=Hr(g*L,o,h,p,v.segment,z,P,M,T);return G?M.projectionCache.anyProjectionOccluded?null:{first:N,last:G}:null}function Fl(g,t,o,h){return g===l.ax.horizontal&&Math.abs(o.y-t.y)>Math.abs(o.x-t.x)*h?{useVertical:!0}:(g===l.ax.vertical?t.y<o.y:t.x>o.x)?{needsFlipping:!0}:null}function Ds(g){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:o,symbol:h,fontSize:p,flip:v,keepUpright:T,glyphOffsetArray:M,dynamicLayoutVertexArray:C,aspectRatio:z,rotateToLine:P}=g,k=p/24,L=h.lineOffsetX*k,N=h.lineOffsetY*k,G;if(h.numGlyphs>1){let $=h.glyphStartIndex+h.numGlyphs,J=h.lineStartIndex,W=h.lineStartIndex+h.lineLength,ee=zs(k,M,L,N,v,h,P,t);if(!ee)return{notEnoughRoom:!0};let ae=Kc(ee.first.point.x,ee.first.point.y,t,o),te=Kc(ee.last.point.x,ee.last.point.y,t,o);if(T&&!v){let Q=Fl(h.writingMode,ae,te,z);if(Q)return Q}G=[ee.first];for(let Q=h.glyphStartIndex+1;Q<$-1;Q++){let re=Hr(k*M.getoffsetX(Q),L,N,v,h.segment,J,W,t,P);if(!re)return{notEnoughRoom:!0};G.push(re)}G.push(ee.last)}else{if(T&&!v){let J=Zt(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,W=h.lineStartIndex+h.segment+1,ee=new l.P(t.lineVertexArray.getx(W),t.lineVertexArray.gety(W)),ae=Zt(ee.x,ee.y,t),te=ae.signedDistanceFromCamera>0?ae.point:Nl(t.tileAnchorPoint,ee,J,1,t),Q=Kc(J.x,J.y,t,o),re=Kc(te.x,te.y,t,o),ie=Fl(h.writingMode,Q,re,z);if(ie)return ie}let $=Hr(k*M.getoffsetX(h.glyphStartIndex),L,N,v,h.segment,h.lineStartIndex,h.lineStartIndex+h.lineLength,t,P);if(!$||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};G=[$]}for(let $ of G)l.aD(C,$.point,$.angle);return{}}function Nl(g,t,o,h,p){let v=g.add(g.sub(t)._unit()),T=Zt(v.x,v.y,p).point,M=o.sub(T);return o.add(M._mult(h/M.mag()))}function Tn(g,t,o){let h=t.projectionCache;if(h.projections[g])return h.projections[g];let p=new l.P(t.lineVertexArray.getx(g),t.lineVertexArray.gety(g)),v=Zt(p.x,p.y,t);if(v.signedDistanceFromCamera>0)return h.projections[g]=v.point,h.anyProjectionOccluded||(h.anyProjectionOccluded=v.isOccluded),v.point;let T=g-o.direction;return Nl(o.distanceFromAnchor===0?t.tileAnchorPoint:new l.P(t.lineVertexArray.getx(T),t.lineVertexArray.gety(T)),p,o.previousVertex,o.absOffsetX-o.distanceFromAnchor+1,t)}function Zt(g,t,o){let h=g+o.translation[0],p=t+o.translation[1],v;return o.pitchWithMap?(v=ht(h,p,o.pitchedLabelPlaneMatrix,o.getElevation),v.isOccluded=!1):(v=o.transform.projectTileCoordinates(h,p,o.unwrappedTileID,o.getElevation),v.point.x=(.5*v.point.x+.5)*o.width,v.point.y=(.5*-v.point.y+.5)*o.height),v}function Kc(g,t,o,h){if(o.pitchWithMap){let p=[g,t,0,1];return l.aE(p,p,h),o.transform.projectTileCoordinates(p[0]/p[3],p[1]/p[3],o.unwrappedTileID,o.getElevation).point}return{x:g/o.width*2-1,y:1-t/o.height*2}}function Ps(g,t,o){return o.transform.projectTileCoordinates(g,t,o.unwrappedTileID,o.getElevation)}function Ul(g,t,o){return g._unit()._perp()._mult(t*o)}function ko(g,t,o,h,p,v,T,M,C){if(M.projectionCache.offsets[g])return M.projectionCache.offsets[g];let z=o.add(t);if(g+C.direction<h||g+C.direction>=p)return M.projectionCache.offsets[g]=z,z;let P=Tn(g+C.direction,M,C),k=Ul(P.sub(o),T,C.direction),L=o.add(k),N=P.add(k);return M.projectionCache.offsets[g]=l.aF(v,z,L,N)||z,M.projectionCache.offsets[g]}function Hr(g,t,o,h,p,v,T,M,C){let z=h?g-t:g+t,P=z>0?1:-1,k=0;h&&(P*=-1,k=Math.PI),P<0&&(k+=Math.PI);let L,N=P>0?v+p:v+p+1;M.projectionCache.cachedAnchorPoint?L=M.projectionCache.cachedAnchorPoint:(L=Zt(M.tileAnchorPoint.x,M.tileAnchorPoint.y,M).point,M.projectionCache.cachedAnchorPoint=L);let G,$,J=L,W=L,ee=0,ae=0,te=Math.abs(z),Q=[],re;for(;ee+ae<=te;){if(N+=P,N<v||N>=T)return null;ee+=ae,W=J,$=G;let Te={absOffsetX:te,direction:P,distanceFromAnchor:ee,previousVertex:W};if(J=Tn(N,M,Te),o===0)Q.push(W),re=J.sub(W);else{let Se,Ie=J.sub(W);Se=Ie.mag()===0?Ul(Tn(N+P,M,Te).sub(J),o,P):Ul(Ie,o,P),$||($=W.add(Se)),G=ko(N,Se,J,v,T,$,o,M,Te),Q.push($),re=G.sub($)}ae=re.mag()}let ie=re._mult((te-ee)/ae)._add($||W),me=k+Math.atan2(J.y-W.y,J.x-W.x);return Q.push(ie),{point:ie,angle:C?me:0,path:Q}}let Vf=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Lo(g,t){for(let o=0;o<g;o++){let h=t.length;t.resize(h+4),t.float32.set(Vf,3*h)}}function Qc(g,t,o){let h=t[0],p=t[1];return g[0]=o[0]*h+o[4]*p+o[12],g[1]=o[1]*h+o[5]*p+o[13],g[3]=o[3]*h+o[7]*p+o[15],g}let Mi=100;class jf{constructor(t,o=new Ze(t.width+200,t.height+200,25),h=new Ze(t.width+200,t.height+200,25)){this.transform=t,this.grid=o,this.ignoredGrid=h,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Mi,this.screenBottomBoundary=t.height+Mi,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,o,h,p,v,T,M,C,z,P,k,L){let N=this.projectAndGetPerspectiveRatio(t.anchorPointX+C[0],t.anchorPointY+C[1],v,P,L),G=h*N.perspectiveRatio,$;if(T||M)$=this._projectCollisionBox(t,G,p,v,T,M,C,N,P,k,L);else{let re=N.x+(k?k.x*G:0),ie=N.y+(k?k.y*G:0);$={allPointsOccluded:!1,box:[re+t.x1*G,ie+t.y1*G,re+t.x2*G,ie+t.y2*G]}}let[J,W,ee,ae]=$.box,te=T?$.allPointsOccluded:N.isOccluded,Q=te;return Q||(Q=N.perspectiveRatio<this.perspectiveRatioCutoff),Q||(Q=!this.isInsideGrid(J,W,ee,ae)),Q||o!=="always"&&this.grid.hitTest(J,W,ee,ae,o,z)?{box:[J,W,ee,ae],placeable:!1,offscreen:!1,occluded:te}:{box:[J,W,ee,ae],placeable:!0,offscreen:this.isOffscreen(J,W,ee,ae),occluded:te}}placeCollisionCircles(t,o,h,p,v,T,M,C,z,P,k,L,N,G){let $=[],J=new l.P(o.anchorX,o.anchorY),W=this.getPerspectiveRatio(J.x,J.y,T,G),ee=(z?v*this.transform.getPitchedTextCorrection(o.anchorX,o.anchorY,T)/W:v*W)/l.aJ,ae={getElevation:G,pitchedLabelPlaneMatrix:M,lineVertexArray:h,pitchWithMap:z,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:J,unwrappedTileID:T,width:this.transform.width,height:this.transform.height,translation:N},te=zs(ee,p,o.lineOffsetX*ee,o.lineOffsetY*ee,!1,o,!1,ae),Q=!1,re=!1,ie=!0;if(te){let me=.5*k*W+L,Te=new l.P(-100,-100),Se=new l.P(this.screenRightBoundary,this.screenBottomBoundary),Ie=new ud,Pe=te.first,Qe=te.last,qe=[];for(let et=Pe.path.length-1;et>=1;et--)qe.push(Pe.path[et]);for(let et=1;et<Qe.path.length;et++)qe.push(Qe.path[et]);let Ae=2.5*me;if(z){let et=this.projectPathToScreenSpace(qe,ae);qe=et.some((Ft=>Ft.signedDistanceFromCamera<=0))?[]:et.map((Ft=>Ft.point))}let $e=[];if(qe.length>0){let et=qe[0].clone(),Ft=qe[0].clone();for(let Bi=1;Bi<qe.length;Bi++)et.x=Math.min(et.x,qe[Bi].x),et.y=Math.min(et.y,qe[Bi].y),Ft.x=Math.max(Ft.x,qe[Bi].x),Ft.y=Math.max(Ft.y,qe[Bi].y);$e=et.x>=Te.x&&Ft.x<=Se.x&&et.y>=Te.y&&Ft.y<=Se.y?[qe]:Ft.x<Te.x||et.x>Se.x||Ft.y<Te.y||et.y>Se.y?[]:l.aG([qe],Te.x,Te.y,Se.x,Se.y)}for(let et of $e){Ie.reset(et,.25*me);let Ft=0;Ft=Ie.length<=.5*me?1:Math.ceil(Ie.paddedLength/Ae)+1;for(let Bi=0;Bi<Ft;Bi++){let $t=Bi/Math.max(Ft-1,1),ji=Ie.lerp($t),Zi=ji.x+Mi,Rn=ji.y+Mi;$.push(Zi,Rn,me,0);let Ei=Zi-me,Wn=Rn-me,Sn=Zi+me,cn=Rn+me;if(ie&&(ie=this.isOffscreen(Ei,Wn,Sn,cn)),re||(re=this.isInsideGrid(Ei,Wn,Sn,cn)),t!=="always"&&this.grid.hitTestCircle(Zi,Rn,me,t,P)&&(Q=!0,!C))return{circles:[],offscreen:!1,collisionDetected:Q}}}}return{circles:!C&&Q||!re||W<this.perspectiveRatioCutoff?[]:$,offscreen:ie,collisionDetected:Q}}projectPathToScreenSpace(t,o){let h=(function(p,v){let T=mt;return(function(M,C){let z=1/(C[0]*C[5]-C[1]*C[4]);M[0]=C[5]*z,M[1]=-C[1]*z,M[2]=0,M[3]=0,M[4]=-C[4]*z,M[5]=C[0]*z,M[6]=0,M[7]=0,M[8]=0,M[9]=0,M[10]=1/C[10],M[11]=0,M[12]=0,M[13]=0,M[14]=0,M[15]=1/C[15]})(T,v.pitchedLabelPlaneMatrix),p.map((M=>{let C=ht(M.x,M.y,T,v.getElevation),z=v.transform.projectTileCoordinates(C.point.x,C.point.y,v.unwrappedTileID,v.getElevation);return z.point.x=(.5*z.point.x+.5)*v.width,z.point.y=(.5*-z.point.y+.5)*v.height,z}))})(t,o);return(function(p){let v=0,T=0,M=0,C=0;for(let z=0;z<p.length;z++)p[z].isOccluded?(M=z+1,C=0):(C++,C>T&&(T=C,v=M));return p.slice(v,v+T)})(h)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let o=[],h=new l.a8;for(let k of t){let L=new l.P(k.x+Mi,k.y+Mi);h.extend(L),o.push(L)}let{minX:p,minY:v,maxX:T,maxY:M}=h,C=this.grid.query(p,v,T,M).concat(this.ignoredGrid.query(p,v,T,M)),z={},P={};for(let k of C){let L=k.key;if(z[L.bucketInstanceId]===void 0&&(z[L.bucketInstanceId]={}),z[L.bucketInstanceId][L.featureIndex])continue;let N=[new l.P(k.x1,k.y1),new l.P(k.x2,k.y1),new l.P(k.x2,k.y2),new l.P(k.x1,k.y2)];l.aH(o,N)&&(z[L.bucketInstanceId][L.featureIndex]=!0,P[L.bucketInstanceId]===void 0&&(P[L.bucketInstanceId]=[]),P[L.bucketInstanceId].push(L.featureIndex))}return P}insertCollisionBox(t,o,h,p,v,T){(h?this.ignoredGrid:this.grid).insert({bucketInstanceId:p,featureIndex:v,collisionGroupID:T,overlapMode:o},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,o,h,p,v,T){let M=h?this.ignoredGrid:this.grid,C={bucketInstanceId:p,featureIndex:v,collisionGroupID:T,overlapMode:o};for(let z=0;z<t.length;z+=4)M.insertCircle(C,t[z],t[z+1],t[z+2])}projectAndGetPerspectiveRatio(t,o,h,p,v){if(v){let T;p?(T=[t,o,p(t,o),1],l.aE(T,T,v)):(T=[t,o,0,1],Qc(T,T,v));let M=T[3];return{x:(T[0]/M+1)/2*this.transform.width+Mi,y:(-T[1]/M+1)/2*this.transform.height+Mi,perspectiveRatio:.5+this.transform.cameraToCenterDistance/M*.5,isOccluded:!1,signedDistanceFromCamera:M}}{let T=this.transform.projectTileCoordinates(t,o,h,p);return{x:(T.point.x+1)/2*this.transform.width+Mi,y:(1-T.point.y)/2*this.transform.height+Mi,perspectiveRatio:.5+this.transform.cameraToCenterDistance/T.signedDistanceFromCamera*.5,isOccluded:T.isOccluded,signedDistanceFromCamera:T.signedDistanceFromCamera}}}getPerspectiveRatio(t,o,h,p){let v=this.transform.projectTileCoordinates(t,o,h,p);return .5+this.transform.cameraToCenterDistance/v.signedDistanceFromCamera*.5}isOffscreen(t,o,h,p){return h<Mi||t>=this.screenRightBoundary||p<Mi||o>this.screenBottomBoundary}isInsideGrid(t,o,h,p){return h>=0&&t<this.gridRightBoundary&&p>=0&&o<this.gridBottomBoundary}getViewportMatrix(){let t=l.ap([]);return l.Q(t,t,[-100,-100,0]),t}_projectCollisionBox(t,o,h,p,v,T,M,C,z,P,k){let L=1,N=0,G=0,$=1,J=t.anchorPointX+M[0],W=t.anchorPointY+M[1];if(T&&!v){let qe=this.projectAndGetPerspectiveRatio(J+1,W,p,z,k),Ae=qe.x-C.x,$e=Math.atan((qe.y-C.y)/Ae)+(Ae<0?Math.PI:0),et=Math.sin($e),Ft=Math.cos($e);L=Ft,N=et,G=-et,$=Ft}else if(!T&&v){let qe=Ra(this.transform);L=qe.vecEast[0],N=qe.vecEast[1],G=qe.vecSouth[0],$=qe.vecSouth[1]}let ee=C.x,ae=C.y,te=o;v&&(ee=J,ae=W,te=Math.pow(2,-(this.transform.zoom-h.overscaledZ)),te*=this.transform.getPitchedTextCorrection(J,W,p),P||(te*=l.al(.5+C.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(ee+=L*P.x*te+G*P.y*te,ae+=N*P.x*te+$*P.y*te);let Q=t.x1*te,re=t.x2*te,ie=(Q+re)/2,me=t.y1*te,Te=t.y2*te,Se=(me+Te)/2,Ie=[{offsetX:Q,offsetY:me},{offsetX:ie,offsetY:me},{offsetX:re,offsetY:me},{offsetX:re,offsetY:Se},{offsetX:re,offsetY:Te},{offsetX:ie,offsetY:Te},{offsetX:Q,offsetY:Te},{offsetX:Q,offsetY:Se}],Pe=[];for(let{offsetX:qe,offsetY:Ae}of Ie)Pe.push(new l.P(ee+L*qe+G*Ae,ae+N*qe+$*Ae));let Qe=!1;if(v){let qe=Pe.map((Ae=>this.projectAndGetPerspectiveRatio(Ae.x,Ae.y,p,z,k)));Qe=qe.some((Ae=>!Ae.isOccluded)),Pe=qe.map((Ae=>new l.P(Ae.x,Ae.y)))}else Qe=!0;return{box:l.aI(Pe),allPointsOccluded:!Qe}}}class qf{constructor(t,o,h,p){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?o:-o))):p&&h?1:0,this.placed=h}isHidden(){return this.opacity===0&&!this.placed}}class Vl{constructor(t,o,h,p,v){this.text=new qf(t?t.text:null,o,h,v),this.icon=new qf(t?t.icon:null,o,p,v)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Gf{constructor(t,o,h){this.text=t,this.icon=o,this.skipFade=h}}class Zf{constructor(t,o,h,p,v){this.bucketInstanceId=t,this.featureIndex=o,this.sourceLayerIndex=h,this.bucketIndex=p,this.tileID=v}}class Hf{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let o=++this.maxGroupID;this.collisionGroups[t]={ID:o,predicate:h=>h.collisionGroupID===o}}return this.collisionGroups[t]}}function Jc(g,t,o,h,p){let{horizontalAlign:v,verticalAlign:T}=l.aP(g);return new l.P(-(v-.5)*t+h[0]*p,-(T-.5)*o+h[1]*p)}class hd{constructor(t,o,h,p,v){this.transform=t.clone(),this.terrain=o,this.collisionIndex=new jf(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=h,this.retainedQueryData={},this.collisionGroups=new Hf(p),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){let o=this.terrain;return o?(h,p)=>o.getElevation(t,h,p):null}getBucketParts(t,o,h,p){let v=h.getBucket(o),T=h.latestFeatureIndex;if(!v||!T||o.id!==v.layerIds[0])return;let M=h.collisionBoxArray,C=v.layers[0].layout,z=v.layers[0].paint,P=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),k=h.tileSize/l.a6,L=h.tileID.toUnwrapped(),N=C.get("text-rotation-alignment")==="map",G=l.aK(h,1,this.transform.zoom),$=l.aL(this.collisionIndex.transform,h,z.get("text-translate"),z.get("text-translate-anchor")),J=l.aL(this.collisionIndex.transform,h,z.get("icon-translate"),z.get("icon-translate-anchor")),W=mr(N,this.transform,G);this.retainedQueryData[v.bucketInstanceId]=new Zf(v.bucketInstanceId,T,v.sourceLayerIndex,v.index,h.tileID);let ee={bucket:v,layout:C,translationText:$,translationIcon:J,unwrappedTileID:L,pitchedLabelPlaneMatrix:W,scale:P,textPixelRatio:k,holdingForFade:h.holdingForSymbolFade(),collisionBoxArray:M,partiallyEvaluatedTextSize:l.aw(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(p)for(let ae of v.sortKeyRanges){let{sortKey:te,symbolInstanceStart:Q,symbolInstanceEnd:re}=ae;t.push({sortKey:te,symbolInstanceStart:Q,symbolInstanceEnd:re,parameters:ee})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:ee})}attemptAnchorPlacement(t,o,h,p,v,T,M,C,z,P,k,L,N,G,$,J,W,ee,ae,te){var Q,re,ie;let me=l.aM[t.textAnchor],Te=[t.textOffset0,t.textOffset1],Se=Jc(me,h,p,Te,v),Ie=this.collisionIndex.placeCollisionBox(o,L,C,z,P,M,T,J,k.predicate,ae,Se,te);if((!ee||this.collisionIndex.placeCollisionBox(ee,L,C,z,P,M,T,W,k.predicate,ae,Se,te).placeable)&&Ie.placeable){let Pe;if(!((Q=this.prevPlacement)===null||Q===void 0)&&Q.variableOffsets[N.crossTileID]&&(!((ie=(re=this.prevPlacement)===null||re===void 0?void 0:re.placements[N.crossTileID])===null||ie===void 0)&&ie.text)&&(Pe=this.prevPlacement.variableOffsets[N.crossTileID].anchor),N.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[N.crossTileID]={textOffset:Te,width:h,height:p,anchor:me,textBoxScale:v,prevAnchor:Pe},this.markUsedJustification(G,me,N,$),G.allowVerticalPlacement&&(this.markUsedOrientation(G,$,N),this.placedOrientations[N.crossTileID]=$),{shift:Se,placedGlyphBoxes:Ie}}}placeLayerBucketPart(t,o,h){let{bucket:p,layout:v,translationText:T,translationIcon:M,unwrappedTileID:C,pitchedLabelPlaneMatrix:z,textPixelRatio:P,holdingForFade:k,collisionBoxArray:L,partiallyEvaluatedTextSize:N,collisionGroup:G}=t.parameters,$=v.get("text-optional"),J=v.get("icon-optional"),W=l.aN(v,"text-overlap","text-allow-overlap"),ee=W==="always",ae=l.aN(v,"icon-overlap","icon-allow-overlap"),te=ae==="always",Q=v.get("text-rotation-alignment")==="map",re=v.get("text-pitch-alignment")==="map",ie=v.get("icon-text-fit")!=="none",me=v.get("symbol-z-order")==="viewport-y",Te=ee&&(te||!p.hasIconData()||J),Se=te&&(ee||!p.hasTextData()||$);!p.collisionArrays&&L&&p.deserializeCollisionBoxes(L);let Ie=this.retainedQueryData[p.bucketInstanceId].tileID,Pe=this._getTerrainElevationFunc(Ie),Qe=this.transform.getFastPathSimpleProjectionMatrix(Ie),qe=(Ae,$e,et)=>{var Ft,Bi;if(o[Ae.crossTileID])return;if(k)return void(this.placements[Ae.crossTileID]=new Gf(!1,!1,!1));let $t=!1,ji=!1,Zi=!0,Rn=null,Ei={box:null,placeable:!1,offscreen:null,occluded:!1},Wn={placeable:!1},Sn=null,cn=null,In=null,lo=0,co=0,uo=0;$e.textFeatureIndex?lo=$e.textFeatureIndex:Ae.useRuntimeCollisionCircles&&(lo=Ae.featureIndex),$e.verticalTextFeatureIndex&&(co=$e.verticalTextFeatureIndex);let kn=$e.textBox;if(kn){let _a=bi=>{let ui=l.ax.horizontal;if(p.allowVerticalPlacement&&!bi&&this.prevPlacement){let Hi=this.prevPlacement.placedOrientations[Ae.crossTileID];Hi&&(this.placedOrientations[Ae.crossTileID]=Hi,ui=Hi,this.markUsedOrientation(p,ui,Ae))}return ui},ya=(bi,ui)=>{if(p.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&$e.verticalTextBox){for(let Hi of p.writingModes)if(Hi===l.ax.vertical?(Ei=ui(),Wn=Ei):Ei=bi(),Ei?.placeable)break}else Ei=bi()},br=Ae.textAnchorOffsetStartIndex,Ir=Ae.textAnchorOffsetEndIndex;if(Ir===br){let bi=(ui,Hi)=>{let xi=this.collisionIndex.placeCollisionBox(ui,W,P,Ie,C,re,Q,T,G.predicate,Pe,void 0,Qe);return xi?.placeable&&(this.markUsedOrientation(p,Hi,Ae),this.placedOrientations[Ae.crossTileID]=Hi),xi};ya((()=>bi(kn,l.ax.horizontal)),(()=>{let ui=$e.verticalTextBox;return p.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&ui?bi(ui,l.ax.vertical):{box:null,offscreen:null}})),_a(Ei?.placeable)}else{let bi=l.aM[(Bi=(Ft=this.prevPlacement)===null||Ft===void 0?void 0:Ft.variableOffsets[Ae.crossTileID])===null||Bi===void 0?void 0:Bi.anchor],ui=(xi,Jo,Bu)=>{let Ua=xi.x2-xi.x1,ap=xi.y2-xi.y1,Vm=Ae.textBoxScale,op=ie&&ae==="never"?Jo:null,po=null,fo=W==="never"?1:2,mo="never";bi&&fo++;for(let sp=0;sp<fo;sp++){for(let lp=br;lp<Ir;lp++){let Fu=p.textAnchorOffsets.get(lp);if(bi&&Fu.textAnchor!==bi)continue;let Nu=this.attemptAnchorPlacement(Fu,xi,Ua,ap,Vm,Q,re,P,Ie,C,G,mo,Ae,p,Bu,T,M,op,Pe);if(Nu&&(po=Nu.placedGlyphBoxes,po?.placeable))return $t=!0,Rn=Nu.shift,po}bi?bi=null:mo=W}return h&&!po&&(po={box:this.collisionIndex.placeCollisionBox(kn,"always",P,Ie,C,re,Q,T,G.predicate,Pe,void 0,Qe).box,offscreen:!1,placeable:!1,occluded:!1}),po};ya((()=>ui(kn,$e.iconBox,l.ax.horizontal)),(()=>{let xi=$e.verticalTextBox;return p.allowVerticalPlacement&&!Ei?.placeable&&Ae.numVerticalGlyphVertices>0&&xi?ui(xi,$e.verticalIconBox,l.ax.vertical):{box:null,occluded:!0,offscreen:null}})),Ei&&($t=Ei.placeable,Zi=Ei.offscreen);let Hi=_a(Ei?.placeable);if(!$t&&this.prevPlacement){let xi=this.prevPlacement.variableOffsets[Ae.crossTileID];xi&&(this.variableOffsets[Ae.crossTileID]=xi,this.markUsedJustification(p,xi.anchor,Ae,Hi))}}}if(Sn=Ei,$t=Sn?.placeable,Zi=Sn?.offscreen,Ae.useRuntimeCollisionCircles&&Ae.centerJustifiedTextSymbolIndex>=0){let _a=p.text.placedSymbolArray.get(Ae.centerJustifiedTextSymbolIndex),ya=l.ay(p.textSizeData,N,_a),br=v.get("text-padding");cn=this.collisionIndex.placeCollisionCircles(W,_a,p.lineVertexArray,p.glyphOffsetArray,ya,C,z,h,re,G.predicate,Ae.collisionCircleDiameter,br,T,Pe),cn.circles.length&&cn.collisionDetected&&!h&&l.w("Collisions detected, but collision boxes are not shown"),$t=ee||cn.circles.length>0&&!cn.collisionDetected,Zi&&(Zi=cn.offscreen)}if($e.iconFeatureIndex&&(uo=$e.iconFeatureIndex),$e.iconBox){let _a=ya=>this.collisionIndex.placeCollisionBox(ya,ae,P,Ie,C,re,Q,M,G.predicate,Pe,ie&&Rn?Rn:void 0,Qe);Wn&&Wn.placeable&&$e.verticalIconBox?(In=_a($e.verticalIconBox),ji=In.placeable):(In=_a($e.iconBox),ji=In.placeable),Zi&&(Zi=In.offscreen)}let Na=$||Ae.numHorizontalGlyphVertices===0&&Ae.numVerticalGlyphVertices===0,ho=J||Ae.numIconVertices===0;Na||ho?ho?Na||ji&&(ji=$t):$t=ji&&$t:ji=$t=ji&&$t;let Ou=ji&&In.placeable;if($t&&Sn.placeable&&this.collisionIndex.insertCollisionBox(Sn.box,W,v.get("text-ignore-placement"),p.bucketInstanceId,Wn&&Wn.placeable&&co?co:lo,G.ID),Ou&&this.collisionIndex.insertCollisionBox(In.box,ae,v.get("icon-ignore-placement"),p.bucketInstanceId,uo,G.ID),cn&&$t&&this.collisionIndex.insertCollisionCircles(cn.circles,W,v.get("text-ignore-placement"),p.bucketInstanceId,lo,G.ID),h&&this.storeCollisionData(p.bucketInstanceId,et,$e,Sn,In,cn),Ae.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(p.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ae.crossTileID]=new Gf(($t||Te)&&!Sn?.occluded,(ji||Se)&&!In?.occluded,Zi||p.justReloaded),o[Ae.crossTileID]=!0};if(me){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let Ae=p.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let $e=Ae.length-1;$e>=0;--$e){let et=Ae[$e];qe(p.symbolInstances.get(et),p.collisionArrays[et],et)}}else for(let Ae=t.symbolInstanceStart;Ae<t.symbolInstanceEnd;Ae++)qe(p.symbolInstances.get(Ae),p.collisionArrays[Ae],Ae);p.justReloaded=!1}storeCollisionData(t,o,h,p,v,T){if(h.textBox||h.iconBox){let M,C;this.collisionBoxArrays.has(t)?M=this.collisionBoxArrays.get(t):(M=new Map,this.collisionBoxArrays.set(t,M)),M.has(o)?C=M.get(o):(C={text:null,icon:null},M.set(o,C)),h.textBox&&(C.text=p.box),h.iconBox&&(C.icon=v.box)}if(T){let M=this.collisionCircleArrays[t];M===void 0&&(M=this.collisionCircleArrays[t]=[]);for(let C=0;C<T.circles.length;C+=4)M.push(T.circles[C+0]-Mi),M.push(T.circles[C+1]-Mi),M.push(T.circles[C+2]),M.push(T.collisionDetected?1:0)}}markUsedJustification(t,o,h,p){let v;v=p===l.ax.vertical?h.verticalPlacedTextSymbolIndex:{left:h.leftJustifiedTextSymbolIndex,center:h.centerJustifiedTextSymbolIndex,right:h.rightJustifiedTextSymbolIndex}[l.aO(o)];let T=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex,h.verticalPlacedTextSymbolIndex];for(let M of T)M>=0&&(t.text.placedSymbolArray.get(M).crossTileID=v>=0&&M!==v?0:h.crossTileID)}markUsedOrientation(t,o,h){let p=o===l.ax.horizontal||o===l.ax.horizontalOnly?o:0,v=o===l.ax.vertical?o:0,T=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex];for(let M of T)t.text.placedSymbolArray.get(M).placedOrientation=p;h.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(h.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let o=this.prevPlacement,h=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;let p=o?o.symbolFadeChange(t):1,v=o?o.opacities:{},T=o?o.variableOffsets:{},M=o?o.placedOrientations:{};for(let C in this.placements){let z=this.placements[C],P=v[C];P?(this.opacities[C]=new Vl(P,p,z.text,z.icon),h||(h=z.text!==P.text.placed),h||(h=z.icon!==P.icon.placed)):(this.opacities[C]=new Vl(null,p,z.text,z.icon,z.skipFade),h||(h=z.text||z.icon))}for(let C in v){let z=v[C];if(!this.opacities[C]){let P=new Vl(z,p,!1,!1);P.isHidden()||(this.opacities[C]=P,h||(h=z.text.placed),h||(h=z.icon.placed))}}for(let C in T)this.variableOffsets[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.variableOffsets[C]=T[C]);for(let C in M)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=M[C]);if(o&&o.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");h?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:t)}updateLayerOpacities(t,o){let h={};for(let p of o){let v=p.getBucket(t);v&&p.latestFeatureIndex&&t.id===v.layerIds[0]&&this.updateBucketOpacities(v,p.tileID,h,p.collisionBoxArray)}}updateBucketOpacities(t,o,h,p){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let v=t.layers[0],T=v.layout,M=new Vl(null,0,!1,!1,!0),C=T.get("text-allow-overlap"),z=T.get("icon-allow-overlap"),P=v._unevaluatedLayout.hasValue("text-variable-anchor")||v._unevaluatedLayout.hasValue("text-variable-anchor-offset"),k=T.get("text-rotation-alignment")==="map",L=T.get("text-pitch-alignment")==="map",N=T.get("icon-text-fit")!=="none",G=new Vl(null,0,C&&(z||!t.hasIconData()||T.get("icon-optional")),z&&(C||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&p&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(p);let $=(W,ee,ae)=>{for(let te=0;te<ee/4;te++)W.opacityVertexArray.emplaceBack(ae);W.hasVisibleVertices||(W.hasVisibleVertices=ae!==ql)},J=this.collisionBoxArrays.get(t.bucketInstanceId);for(let W=0;W<t.symbolInstances.length;W++){let ee=t.symbolInstances.get(W),{numHorizontalGlyphVertices:ae,numVerticalGlyphVertices:te,crossTileID:Q}=ee,re=this.opacities[Q];h[Q]?re=M:re||(re=G,this.opacities[Q]=re),h[Q]=!0;let ie=ee.numIconVertices>0,me=this.placedOrientations[ee.crossTileID],Te=me===l.ax.vertical,Se=me===l.ax.horizontal||me===l.ax.horizontalOnly;if(ae>0||te>0){let Pe=md(re.text);$(t.text,ae,Te?ql:Pe),$(t.text,te,Se?ql:Pe);let Qe=re.text.isHidden(),qe=[ee.rightJustifiedTextSymbolIndex,ee.centerJustifiedTextSymbolIndex,ee.leftJustifiedTextSymbolIndex];for(let et of qe)et>=0&&(t.text.placedSymbolArray.get(et).hidden=Qe||Te?1:0);ee.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(ee.verticalPlacedTextSymbolIndex).hidden=Qe||Se?1:0);let Ae=this.variableOffsets[ee.crossTileID];Ae&&this.markUsedJustification(t,Ae.anchor,ee,me);let $e=this.placedOrientations[ee.crossTileID];$e&&(this.markUsedJustification(t,"left",ee,$e),this.markUsedOrientation(t,$e,ee))}if(ie){let Pe=md(re.icon),Qe=!(N&&ee.verticalPlacedIconSymbolIndex&&Te);ee.placedIconSymbolIndex>=0&&($(t.icon,ee.numIconVertices,Qe?Pe:ql),t.icon.placedSymbolArray.get(ee.placedIconSymbolIndex).hidden=re.icon.isHidden()),ee.verticalPlacedIconSymbolIndex>=0&&($(t.icon,ee.numVerticalIconVertices,Qe?ql:Pe),t.icon.placedSymbolArray.get(ee.verticalPlacedIconSymbolIndex).hidden=re.icon.isHidden())}let Ie=J?.has(W)?J.get(W):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let Pe=t.collisionArrays[W];if(Pe){let Qe=new l.P(0,0);if(Pe.textBox||Pe.verticalTextBox){let qe=!0;if(P){let Ae=this.variableOffsets[Q];Ae?(Qe=Jc(Ae.anchor,Ae.width,Ae.height,Ae.textOffset,Ae.textBoxScale),k&&Qe._rotate(L?-this.transform.bearingInRadians:this.transform.bearingInRadians)):qe=!1}if(Pe.textBox||Pe.verticalTextBox){let Ae;Pe.textBox&&(Ae=Te),Pe.verticalTextBox&&(Ae=Se),dd(t.textCollisionBox.collisionVertexArray,re.text.placed,!qe||Ae,Ie.text,Qe.x,Qe.y)}}if(Pe.iconBox||Pe.verticalIconBox){let qe=!!(!Se&&Pe.verticalIconBox),Ae;Pe.iconBox&&(Ae=qe),Pe.verticalIconBox&&(Ae=!qe),dd(t.iconCollisionBox.collisionVertexArray,re.icon.placed,Ae,Ie.icon,N?Qe.x:0,N?Qe.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,o){let h=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*h>t}setStale(){this.stale=!0}}function dd(g,t,o,h,p,v){h&&h.length!==0||(h=[0,0,0,0]);let T=h[0]-Mi,M=h[1]-Mi,C=h[2]-Mi,z=h[3]-Mi;g.emplaceBack(t?1:0,o?1:0,p||0,v||0,T,M),g.emplaceBack(t?1:0,o?1:0,p||0,v||0,C,M),g.emplaceBack(t?1:0,o?1:0,p||0,v||0,C,z),g.emplaceBack(t?1:0,o?1:0,p||0,v||0,T,z)}let pd=Math.pow(2,25),fd=Math.pow(2,24),l1=Math.pow(2,17),jl=Math.pow(2,16),eu=Math.pow(2,9),$f=Math.pow(2,8),Rs=Math.pow(2,1);function md(g){if(g.opacity===0&&!g.placed)return 0;if(g.opacity===1&&g.placed)return 4294967295;let t=g.placed?1:0,o=Math.floor(127*g.opacity);return o*pd+t*fd+o*l1+t*jl+o*eu+t*$f+o*Rs+t}let ql=0;class io{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,o,h,p,v){let T=this._bucketParts;for(;this._currentTileIndex<t.length;)if(o.getBucketParts(T,p,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,v())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,T.sort(((M,C)=>M.sortKey-C.sortKey)));this._currentPartIndex<T.length;)if(o.placeLayerBucketPart(T[this._currentPartIndex],this._seenCrossTileIDs,h),this._currentPartIndex++,v())return!0;return!1}}class Is{constructor(t,o,h,p,v,T,M,C){this.placement=new hd(t,o,T,M,C),this._currentPlacementIndex=h.length-1,this._forceFullPlacement=p,this._showCollisionBoxes=v,this._done=!1}isDone(){return this._done}continuePlacement(t,o,h){let p=le(),v=()=>!this._forceFullPlacement&&le()-p>2;for(;this._currentPlacementIndex>=0;){let T=o[t[this._currentPlacementIndex]],M=this.placement.collisionIndex.transform.zoom;if(l.aQ(T)&&T.layout&&(!T.minzoom||T.minzoom<=M)&&(!T.maxzoom||T.maxzoom>M)){if(this._inProgressLayer||(this._inProgressLayer=new io(T)),this._inProgressLayer.continuePlacement(h[T.source],this.placement,this._showCollisionBoxes,T,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}let pt=512/l.a6/2;class gd{constructor(t,o,h){this.tileID=t,this.bucketInstanceId=h,this._symbolsByKey={};let p=new Map;for(let v=0;v<o.length;v++){let T=o.get(v),M=T.key,C=p.get(M);C?C.push(T):p.set(M,[T])}for(let[v,T]of p){let M={positions:T.map((C=>({x:Math.floor(C.anchorX*pt),y:Math.floor(C.anchorY*pt)}))),crossTileIDs:T.map((C=>C.crossTileID))};if(M.positions.length>128){let C=new l.aR(M.positions.length,16,Uint16Array);for(let{x:z,y:P}of M.positions)C.add(z,P);C.finish(),delete M.positions,M.index=C}this._symbolsByKey[v]=M}}getScaledCoordinates(t,o){let{x:h,y:p,z:v}=this.tileID.canonical,{x:T,y:M,z:C}=o.canonical,z=pt/Math.pow(2,C-v),P=(M*l.a6+t.anchorY)*z,k=p*l.a6*pt;return{x:Math.floor((T*l.a6+t.anchorX)*z-h*l.a6*pt),y:Math.floor(P-k)}}findMatches(t,o,h){let p=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z);for(let v=0;v<t.length;v++){let T=t.get(v);if(T.crossTileID)continue;let M=this._symbolsByKey[T.key];if(!M)continue;let C=this.getScaledCoordinates(T,o);if(M.index){let z=M.index.range(C.x-p,C.y-p,C.x+p,C.y+p).sort();for(let P of z){let k=M.crossTileIDs[P];if(!h[k]){h[k]=!0,T.crossTileID=k;break}}}else if(M.positions)for(let z=0;z<M.positions.length;z++){let P=M.positions[z],k=M.crossTileIDs[z];if(Math.abs(P.x-C.x)<=p&&Math.abs(P.y-C.y)<=p&&!h[k]){h[k]=!0,T.crossTileID=k;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class c1{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class _d{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let o=Math.round((t-this.lng)/360);if(o!==0)for(let h in this.indexes){let p=this.indexes[h],v={};for(let T in p){let M=p[T];M.tileID=M.tileID.unwrapTo(M.tileID.wrap+o),v[M.tileID.key]=M}this.indexes[h]=v}this.lng=t}addBucket(t,o,h){var p,v,T;if(!((p=this.indexes[t.overscaledZ])===null||p===void 0)&&p[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let C=0;C<o.symbolInstances.length;C++)o.symbolInstances.get(C).crossTileID=0;(v=this.usedCrossTileIDs)[T=t.overscaledZ]||(v[T]={});let M=this.usedCrossTileIDs[t.overscaledZ];for(let C in this.indexes){let z=this.indexes[C];if(Number(C)>t.overscaledZ)for(let P in z){let k=z[P];k.tileID.isChildOf(t)&&k.findMatches(o.symbolInstances,t,M)}else{let P=z[t.scaledTo(Number(C)).key];P&&P.findMatches(o.symbolInstances,t,M)}}for(let C=0;C<o.symbolInstances.length;C++){let z=o.symbolInstances.get(C);z.crossTileID||(z.crossTileID=h.generate(),M[z.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new gd(t,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(t,o){for(let h of o.getCrossTileIDsLists())for(let p of h)delete this.usedCrossTileIDs[t][p]}removeStaleBuckets(t){let o=!1;for(let h in this.indexes){let p=this.indexes[h];for(let v in p)t[p[v].bucketInstanceId]||(this.removeBucketCrossTileIDs(h,p[v]),delete p[v],o=!0)}return o}}class lr{constructor(){this.layerIndexes={},this.crossTileIDs=new c1,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,o,h){let p=this.layerIndexes[t.id];p===void 0&&(p=this.layerIndexes[t.id]=new _d);let v=!1,T={};p.handleWrapJump(h);for(let M of o){let C=M.getBucket(t);t.id===C?.layerIds[0]&&(C.bucketInstanceId||(this.maxBucketInstanceId+=1,C.bucketInstanceId=this.maxBucketInstanceId),p.addBucket(M.tileID,C,this.crossTileIDs)&&(v=!0),T[C.bucketInstanceId]=!0)}return p.removeStaleBuckets(T)&&(v=!0),v}pruneUnusedLayers(t){let o={};for(let h of t)o[h]=!0;for(let h in this.layerIndexes)o[h]||delete this.layerIndexes[h]}}var Pn="void main() {fragColor=vec4(1.0);}";let yi={prelude:st(`#ifdef GL_ES
3
+ precision mediump float;
4
+ #else
5
+ #if !defined(lowp)
6
+ #define lowp
7
+ #endif
8
+ #if !defined(mediump)
9
+ #define mediump
10
+ #endif
11
+ #if !defined(highp)
12
+ #define highp
13
+ #endif
14
+ #endif
15
+ out highp vec4 fragColor;`,`#ifdef GL_ES
16
+ precision highp float;
17
+ #else
18
+ #if !defined(lowp)
19
+ #define lowp
20
+ #endif
21
+ #if !defined(mediump)
22
+ #define mediump
23
+ #endif
24
+ #if !defined(highp)
25
+ #define highp
26
+ #endif
27
+ #endif
28
+ vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
29
+ );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
30
+ );}
31
+ #ifdef TERRAIN3D
32
+ uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
33
+ #endif
34
+ const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
35
+ #ifdef TERRAIN3D
36
+ highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
37
+ #else
38
+ return 1.0;
39
+ #endif
40
+ }float calculate_visibility(vec4 pos) {
41
+ #ifdef TERRAIN3D
42
+ vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
43
+ #else
44
+ return 1.0;
45
+ #endif
46
+ }float ele(vec2 pos) {
47
+ #ifdef TERRAIN3D
48
+ vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
49
+ #else
50
+ return 0.0;
51
+ #endif
52
+ }float get_elevation(vec2 pos) {
53
+ #ifdef TERRAIN3D
54
+ #ifdef GLOBE
55
+ if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
56
+ #endif
57
+ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
58
+ #else
59
+ return 0.0;
60
+ #endif
61
+ }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:st("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:st("",`#define GLOBE_RADIUS 6371008.8
62
+ uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
63
+ );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
64
+ if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
65
+ );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:st(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
66
+ #ifdef OVERDRAW_INSPECTOR
67
+ fragColor=vec4(1.0);
68
+ #endif
69
+ }`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:st(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
70
+ #ifdef OVERDRAW_INSPECTOR
71
+ fragColor=vec4(1.0);
72
+ #endif
73
+ }`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:st(`in vec3 v_data;in float v_visibility;
74
+ #pragma mapbox: define highp vec4 color
75
+ #pragma mapbox: define mediump float radius
76
+ #pragma mapbox: define lowp float blur
77
+ #pragma mapbox: define lowp float opacity
78
+ #pragma mapbox: define highp vec4 stroke_color
79
+ #pragma mapbox: define mediump float stroke_width
80
+ #pragma mapbox: define lowp float stroke_opacity
81
+ void main() {
82
+ #pragma mapbox: initialize highp vec4 color
83
+ #pragma mapbox: initialize mediump float radius
84
+ #pragma mapbox: initialize lowp float blur
85
+ #pragma mapbox: initialize lowp float opacity
86
+ #pragma mapbox: initialize highp vec4 stroke_color
87
+ #pragma mapbox: initialize mediump float stroke_width
88
+ #pragma mapbox: initialize lowp float stroke_opacity
89
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
90
+ #ifdef OVERDRAW_INSPECTOR
91
+ fragColor=vec4(1.0);
92
+ #endif
93
+ }`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
94
+ #pragma mapbox: define highp vec4 color
95
+ #pragma mapbox: define mediump float radius
96
+ #pragma mapbox: define lowp float blur
97
+ #pragma mapbox: define lowp float opacity
98
+ #pragma mapbox: define highp vec4 stroke_color
99
+ #pragma mapbox: define mediump float stroke_width
100
+ #pragma mapbox: define lowp float stroke_opacity
101
+ void main(void) {
102
+ #pragma mapbox: initialize highp vec4 color
103
+ #pragma mapbox: initialize mediump float radius
104
+ #pragma mapbox: initialize lowp float blur
105
+ #pragma mapbox: initialize lowp float opacity
106
+ #pragma mapbox: initialize highp vec4 stroke_color
107
+ #pragma mapbox: initialize mediump float stroke_width
108
+ #pragma mapbox: initialize lowp float stroke_opacity
109
+ vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
110
+ #ifdef GLOBE
111
+ vec3 center_vector=projectToSphere(circle_center);
112
+ #endif
113
+ float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
114
+ #ifdef GLOBE
115
+ vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
116
+ #else
117
+ vec4 projected_center=projectTileWithElevation(circle_center,ele);
118
+ #endif
119
+ corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
120
+ #ifdef GLOBE
121
+ vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
122
+ #else
123
+ gl_Position=projectTileWithElevation(corner_position,ele);
124
+ #endif
125
+ } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:st(Pn,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:st(`uniform highp float u_intensity;in vec2 v_extrude;
126
+ #pragma mapbox: define highp float weight
127
+ #define GAUSS_COEF 0.3989422804014327
128
+ void main() {
129
+ #pragma mapbox: initialize highp float weight
130
+ float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
131
+ #ifdef OVERDRAW_INSPECTOR
132
+ fragColor=vec4(1.0);
133
+ #endif
134
+ }`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
135
+ #pragma mapbox: define highp float weight
136
+ #pragma mapbox: define mediump float radius
137
+ const highp float ZERO=1.0/255.0/16.0;
138
+ #define GAUSS_COEF 0.3989422804014327
139
+ void main(void) {
140
+ #pragma mapbox: initialize highp float weight
141
+ #pragma mapbox: initialize mediump float radius
142
+ vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);
143
+ #ifdef GLOBE
144
+ vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
145
+ #else
146
+ gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
147
+ #endif
148
+ }`),heatmapTexture:st(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
149
+ #ifdef OVERDRAW_INSPECTOR
150
+ fragColor=vec4(0.0);
151
+ #endif
152
+ }`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:st("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:st("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:st(`#ifdef GL_ES
153
+ precision highp float;
154
+ #endif
155
+ uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
156
+ {l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
157
+ #ifdef OVERDRAW_INSPECTOR
158
+ fragColor=vec4(1.0);
159
+ #endif
160
+ }`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:st("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:st(Pn,`in vec2 a_pos;void main() {
161
+ #ifdef GLOBE
162
+ gl_Position=projectTileFor3D(a_pos,0.0);
163
+ #else
164
+ gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
165
+ #endif
166
+ }`),fill:st(`#pragma mapbox: define highp vec4 color
167
+ #pragma mapbox: define lowp float opacity
168
+ void main() {
169
+ #pragma mapbox: initialize highp vec4 color
170
+ #pragma mapbox: initialize lowp float opacity
171
+ fragColor=color*opacity;
172
+ #ifdef OVERDRAW_INSPECTOR
173
+ fragColor=vec4(1.0);
174
+ #endif
175
+ }`,`uniform vec2 u_fill_translate;in vec2 a_pos;
176
+ #pragma mapbox: define highp vec4 color
177
+ #pragma mapbox: define lowp float opacity
178
+ void main() {
179
+ #pragma mapbox: initialize highp vec4 color
180
+ #pragma mapbox: initialize lowp float opacity
181
+ gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:st(`in vec2 v_pos;
182
+ #ifdef GLOBE
183
+ in float v_depth;
184
+ #endif
185
+ #pragma mapbox: define highp vec4 outline_color
186
+ #pragma mapbox: define lowp float opacity
187
+ void main() {
188
+ #pragma mapbox: initialize highp vec4 outline_color
189
+ #pragma mapbox: initialize lowp float opacity
190
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
191
+ #ifdef GLOBE
192
+ if (v_depth > 1.0) {discard;}
193
+ #endif
194
+ #ifdef OVERDRAW_INSPECTOR
195
+ fragColor=vec4(1.0);
196
+ #endif
197
+ }`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
198
+ #ifdef GLOBE
199
+ out float v_depth;
200
+ #endif
201
+ #pragma mapbox: define highp vec4 outline_color
202
+ #pragma mapbox: define lowp float opacity
203
+ void main() {
204
+ #pragma mapbox: initialize highp vec4 outline_color
205
+ #pragma mapbox: initialize lowp float opacity
206
+ gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
207
+ #ifdef GLOBE
208
+ v_depth=gl_Position.z/gl_Position.w;
209
+ #endif
210
+ }`),fillOutlinePattern:st(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
211
+ #ifdef GLOBE
212
+ in float v_depth;
213
+ #endif
214
+ #pragma mapbox: define lowp float opacity
215
+ #pragma mapbox: define lowp vec4 pattern_from
216
+ #pragma mapbox: define lowp vec4 pattern_to
217
+ void main() {
218
+ #pragma mapbox: initialize lowp float opacity
219
+ #pragma mapbox: initialize mediump vec4 pattern_from
220
+ #pragma mapbox: initialize mediump vec4 pattern_to
221
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
222
+ #ifdef GLOBE
223
+ if (v_depth > 1.0) {discard;}
224
+ #endif
225
+ #ifdef OVERDRAW_INSPECTOR
226
+ fragColor=vec4(1.0);
227
+ #endif
228
+ }`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
229
+ #ifdef GLOBE
230
+ out float v_depth;
231
+ #endif
232
+ #pragma mapbox: define lowp float opacity
233
+ #pragma mapbox: define lowp vec4 pattern_from
234
+ #pragma mapbox: define lowp vec4 pattern_to
235
+ #pragma mapbox: define lowp float pixel_ratio_from
236
+ #pragma mapbox: define lowp float pixel_ratio_to
237
+ void main() {
238
+ #pragma mapbox: initialize lowp float opacity
239
+ #pragma mapbox: initialize mediump vec4 pattern_from
240
+ #pragma mapbox: initialize mediump vec4 pattern_to
241
+ #pragma mapbox: initialize lowp float pixel_ratio_from
242
+ #pragma mapbox: initialize lowp float pixel_ratio_to
243
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
244
+ #ifdef GLOBE
245
+ v_depth=gl_Position.z/gl_Position.w;
246
+ #endif
247
+ }`),fillPattern:st(`#ifdef GL_ES
248
+ precision highp float;
249
+ #endif
250
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
251
+ #pragma mapbox: define lowp float opacity
252
+ #pragma mapbox: define lowp vec4 pattern_from
253
+ #pragma mapbox: define lowp vec4 pattern_to
254
+ void main() {
255
+ #pragma mapbox: initialize lowp float opacity
256
+ #pragma mapbox: initialize mediump vec4 pattern_from
257
+ #pragma mapbox: initialize mediump vec4 pattern_to
258
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
259
+ #ifdef OVERDRAW_INSPECTOR
260
+ fragColor=vec4(1.0);
261
+ #endif
262
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
263
+ #pragma mapbox: define lowp float opacity
264
+ #pragma mapbox: define lowp vec4 pattern_from
265
+ #pragma mapbox: define lowp vec4 pattern_to
266
+ #pragma mapbox: define lowp float pixel_ratio_from
267
+ #pragma mapbox: define lowp float pixel_ratio_to
268
+ void main() {
269
+ #pragma mapbox: initialize lowp float opacity
270
+ #pragma mapbox: initialize mediump vec4 pattern_from
271
+ #pragma mapbox: initialize mediump vec4 pattern_to
272
+ #pragma mapbox: initialize lowp float pixel_ratio_from
273
+ #pragma mapbox: initialize lowp float pixel_ratio_to
274
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:st(`in vec4 v_color;void main() {fragColor=v_color;
275
+ #ifdef OVERDRAW_INSPECTOR
276
+ fragColor=vec4(1.0);
277
+ #endif
278
+ }`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
279
+ #ifdef TERRAIN3D
280
+ in vec2 a_centroid;
281
+ #endif
282
+ out vec4 v_color;
283
+ #pragma mapbox: define highp float base
284
+ #pragma mapbox: define highp float height
285
+ #pragma mapbox: define highp vec4 color
286
+ void main() {
287
+ #pragma mapbox: initialize highp float base
288
+ #pragma mapbox: initialize highp float height
289
+ #pragma mapbox: initialize highp vec4 color
290
+ vec3 normal=a_normal_ed.xyz;
291
+ #ifdef TERRAIN3D
292
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
293
+ #else
294
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
295
+ #endif
296
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
297
+ #ifdef GLOBE
298
+ vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
299
+ #else
300
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
301
+ #endif
302
+ float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
303
+ #ifdef GLOBE
304
+ mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
305
+ #endif
306
+ directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:st(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
307
+ #pragma mapbox: define lowp float base
308
+ #pragma mapbox: define lowp float height
309
+ #pragma mapbox: define lowp vec4 pattern_from
310
+ #pragma mapbox: define lowp vec4 pattern_to
311
+ #pragma mapbox: define lowp float pixel_ratio_from
312
+ #pragma mapbox: define lowp float pixel_ratio_to
313
+ void main() {
314
+ #pragma mapbox: initialize lowp float base
315
+ #pragma mapbox: initialize lowp float height
316
+ #pragma mapbox: initialize mediump vec4 pattern_from
317
+ #pragma mapbox: initialize mediump vec4 pattern_to
318
+ #pragma mapbox: initialize lowp float pixel_ratio_from
319
+ #pragma mapbox: initialize lowp float pixel_ratio_to
320
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
321
+ #ifdef OVERDRAW_INSPECTOR
322
+ fragColor=vec4(1.0);
323
+ #endif
324
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
325
+ #ifdef TERRAIN3D
326
+ in vec2 a_centroid;
327
+ #endif
328
+ #ifdef GLOBE
329
+ out vec3 v_sphere_pos;
330
+ #endif
331
+ out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
332
+ #pragma mapbox: define lowp float base
333
+ #pragma mapbox: define lowp float height
334
+ #pragma mapbox: define lowp vec4 pattern_from
335
+ #pragma mapbox: define lowp vec4 pattern_to
336
+ #pragma mapbox: define lowp float pixel_ratio_from
337
+ #pragma mapbox: define lowp float pixel_ratio_to
338
+ void main() {
339
+ #pragma mapbox: initialize lowp float base
340
+ #pragma mapbox: initialize lowp float height
341
+ #pragma mapbox: initialize mediump vec4 pattern_from
342
+ #pragma mapbox: initialize mediump vec4 pattern_to
343
+ #pragma mapbox: initialize lowp float pixel_ratio_from
344
+ #pragma mapbox: initialize lowp float pixel_ratio_to
345
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
346
+ #ifdef TERRAIN3D
347
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
348
+ #else
349
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
350
+ #endif
351
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
352
+ #ifdef GLOBE
353
+ vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
354
+ #else
355
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
356
+ #endif
357
+ vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
358
+ ? a_pos
359
+ : vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:st(`#ifdef GL_ES
360
+ precision highp float;
361
+ #endif
362
+ uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
363
+ #ifdef OVERDRAW_INSPECTOR
364
+ fragColor=vec4(1.0);
365
+ #endif
366
+ }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:st(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
367
+ #define PI 3.141592653589793
368
+ #define STANDARD 0
369
+ #define COMBINED 1
370
+ #define IGOR 2
371
+ #define MULTIDIRECTIONAL 3
372
+ #define BASIC 4
373
+ float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
374
+ {fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
375
+ {fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
376
+ #ifdef OVERDRAW_INSPECTOR
377
+ fragColor=vec4(1.0);
378
+ #endif
379
+ }`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:st(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
380
+ #ifdef GLOBE
381
+ in float v_depth;
382
+ #endif
383
+ #pragma mapbox: define highp vec4 color
384
+ #pragma mapbox: define lowp float blur
385
+ #pragma mapbox: define lowp float opacity
386
+ void main() {
387
+ #pragma mapbox: initialize highp vec4 color
388
+ #pragma mapbox: initialize lowp float blur
389
+ #pragma mapbox: initialize lowp float opacity
390
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
391
+ #ifdef GLOBE
392
+ if (v_depth > 1.0) {discard;}
393
+ #endif
394
+ #ifdef OVERDRAW_INSPECTOR
395
+ fragColor=vec4(1.0);
396
+ #endif
397
+ }`,`
398
+ #define scale 0.015873016
399
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
400
+ #ifdef GLOBE
401
+ out float v_depth;
402
+ #endif
403
+ #pragma mapbox: define highp vec4 color
404
+ #pragma mapbox: define lowp float blur
405
+ #pragma mapbox: define lowp float opacity
406
+ #pragma mapbox: define mediump float gapwidth
407
+ #pragma mapbox: define lowp float offset
408
+ #pragma mapbox: define mediump float width
409
+ void main() {
410
+ #pragma mapbox: initialize highp vec4 color
411
+ #pragma mapbox: initialize lowp float blur
412
+ #pragma mapbox: initialize lowp float opacity
413
+ #pragma mapbox: initialize mediump float gapwidth
414
+ #pragma mapbox: initialize lowp float offset
415
+ #pragma mapbox: initialize mediump float width
416
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
417
+ #ifdef GLOBE
418
+ v_depth=gl_Position.z/gl_Position.w;
419
+ #endif
420
+ #ifdef TERRAIN3D
421
+ v_gamma_scale=1.0;
422
+ #else
423
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
424
+ #endif
425
+ v_width2=vec2(outset,inset);}`),lineGradient:st(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
426
+ #ifdef GLOBE
427
+ in float v_depth;
428
+ #endif
429
+ #pragma mapbox: define lowp float blur
430
+ #pragma mapbox: define lowp float opacity
431
+ void main() {
432
+ #pragma mapbox: initialize lowp float blur
433
+ #pragma mapbox: initialize lowp float opacity
434
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
435
+ #ifdef GLOBE
436
+ if (v_depth > 1.0) {discard;}
437
+ #endif
438
+ #ifdef OVERDRAW_INSPECTOR
439
+ fragColor=vec4(1.0);
440
+ #endif
441
+ }`,`
442
+ #define scale 0.015873016
443
+ in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
444
+ #ifdef GLOBE
445
+ out float v_depth;
446
+ #endif
447
+ #pragma mapbox: define lowp float blur
448
+ #pragma mapbox: define lowp float opacity
449
+ #pragma mapbox: define mediump float gapwidth
450
+ #pragma mapbox: define lowp float offset
451
+ #pragma mapbox: define mediump float width
452
+ void main() {
453
+ #pragma mapbox: initialize lowp float blur
454
+ #pragma mapbox: initialize lowp float opacity
455
+ #pragma mapbox: initialize mediump float gapwidth
456
+ #pragma mapbox: initialize lowp float offset
457
+ #pragma mapbox: initialize mediump float width
458
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
459
+ #ifdef GLOBE
460
+ v_depth=gl_Position.z/gl_Position.w;
461
+ #endif
462
+ #ifdef TERRAIN3D
463
+ v_gamma_scale=1.0;
464
+ #else
465
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
466
+ #endif
467
+ v_width2=vec2(outset,inset);}`),linePattern:st(`#ifdef GL_ES
468
+ precision highp float;
469
+ #endif
470
+ uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
471
+ #ifdef GLOBE
472
+ in float v_depth;
473
+ #endif
474
+ #pragma mapbox: define lowp vec4 pattern_from
475
+ #pragma mapbox: define lowp vec4 pattern_to
476
+ #pragma mapbox: define lowp float pixel_ratio_from
477
+ #pragma mapbox: define lowp float pixel_ratio_to
478
+ #pragma mapbox: define lowp float blur
479
+ #pragma mapbox: define lowp float opacity
480
+ void main() {
481
+ #pragma mapbox: initialize mediump vec4 pattern_from
482
+ #pragma mapbox: initialize mediump vec4 pattern_to
483
+ #pragma mapbox: initialize lowp float pixel_ratio_from
484
+ #pragma mapbox: initialize lowp float pixel_ratio_to
485
+ #pragma mapbox: initialize lowp float blur
486
+ #pragma mapbox: initialize lowp float opacity
487
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
488
+ #ifdef GLOBE
489
+ if (v_depth > 1.0) {discard;}
490
+ #endif
491
+ #ifdef OVERDRAW_INSPECTOR
492
+ fragColor=vec4(1.0);
493
+ #endif
494
+ }`,`
495
+ #define scale 0.015873016
496
+ #define LINE_DISTANCE_SCALE 2.0
497
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
498
+ #ifdef GLOBE
499
+ out float v_depth;
500
+ #endif
501
+ #pragma mapbox: define lowp float blur
502
+ #pragma mapbox: define lowp float opacity
503
+ #pragma mapbox: define lowp float offset
504
+ #pragma mapbox: define mediump float gapwidth
505
+ #pragma mapbox: define mediump float width
506
+ #pragma mapbox: define lowp float floorwidth
507
+ #pragma mapbox: define lowp vec4 pattern_from
508
+ #pragma mapbox: define lowp vec4 pattern_to
509
+ #pragma mapbox: define lowp float pixel_ratio_from
510
+ #pragma mapbox: define lowp float pixel_ratio_to
511
+ void main() {
512
+ #pragma mapbox: initialize lowp float blur
513
+ #pragma mapbox: initialize lowp float opacity
514
+ #pragma mapbox: initialize lowp float offset
515
+ #pragma mapbox: initialize mediump float gapwidth
516
+ #pragma mapbox: initialize mediump float width
517
+ #pragma mapbox: initialize lowp float floorwidth
518
+ #pragma mapbox: initialize mediump vec4 pattern_from
519
+ #pragma mapbox: initialize mediump vec4 pattern_to
520
+ #pragma mapbox: initialize lowp float pixel_ratio_from
521
+ #pragma mapbox: initialize lowp float pixel_ratio_to
522
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
523
+ #ifdef GLOBE
524
+ v_depth=gl_Position.z/gl_Position.w;
525
+ #endif
526
+ #ifdef TERRAIN3D
527
+ v_gamma_scale=1.0;
528
+ #else
529
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
530
+ #endif
531
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:st(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
532
+ #ifdef GLOBE
533
+ in float v_depth;
534
+ #endif
535
+ #pragma mapbox: define highp vec4 color
536
+ #pragma mapbox: define lowp float blur
537
+ #pragma mapbox: define lowp float opacity
538
+ #pragma mapbox: define mediump float width
539
+ #pragma mapbox: define lowp float floorwidth
540
+ #pragma mapbox: define mediump vec4 dasharray_from
541
+ #pragma mapbox: define mediump vec4 dasharray_to
542
+ void main() {
543
+ #pragma mapbox: initialize highp vec4 color
544
+ #pragma mapbox: initialize lowp float blur
545
+ #pragma mapbox: initialize lowp float opacity
546
+ #pragma mapbox: initialize mediump float width
547
+ #pragma mapbox: initialize lowp float floorwidth
548
+ #pragma mapbox: initialize mediump vec4 dasharray_from
549
+ #pragma mapbox: initialize mediump vec4 dasharray_to
550
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
551
+ #ifdef GLOBE
552
+ if (v_depth > 1.0) {discard;}
553
+ #endif
554
+ #ifdef OVERDRAW_INSPECTOR
555
+ fragColor=vec4(1.0);
556
+ #endif
557
+ }`,`
558
+ #define scale 0.015873016
559
+ #define LINE_DISTANCE_SCALE 2.0
560
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
561
+ #ifdef GLOBE
562
+ out float v_depth;
563
+ #endif
564
+ #pragma mapbox: define highp vec4 color
565
+ #pragma mapbox: define lowp float blur
566
+ #pragma mapbox: define lowp float opacity
567
+ #pragma mapbox: define mediump float gapwidth
568
+ #pragma mapbox: define lowp float offset
569
+ #pragma mapbox: define mediump float width
570
+ #pragma mapbox: define lowp float floorwidth
571
+ #pragma mapbox: define mediump vec4 dasharray_from
572
+ #pragma mapbox: define mediump vec4 dasharray_to
573
+ void main() {
574
+ #pragma mapbox: initialize highp vec4 color
575
+ #pragma mapbox: initialize lowp float blur
576
+ #pragma mapbox: initialize lowp float opacity
577
+ #pragma mapbox: initialize mediump float gapwidth
578
+ #pragma mapbox: initialize lowp float offset
579
+ #pragma mapbox: initialize mediump float width
580
+ #pragma mapbox: initialize lowp float floorwidth
581
+ #pragma mapbox: initialize mediump vec4 dasharray_from
582
+ #pragma mapbox: initialize mediump vec4 dasharray_to
583
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
584
+ #ifdef GLOBE
585
+ v_depth=gl_Position.z/gl_Position.w;
586
+ #endif
587
+ #ifdef TERRAIN3D
588
+ v_gamma_scale=1.0;
589
+ #else
590
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
591
+ #endif
592
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:st(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
593
+ #ifdef GLOBE
594
+ in float v_depth;
595
+ #endif
596
+ #pragma mapbox: define lowp float blur
597
+ #pragma mapbox: define lowp float opacity
598
+ #pragma mapbox: define mediump float width
599
+ #pragma mapbox: define lowp float floorwidth
600
+ #pragma mapbox: define mediump vec4 dasharray_from
601
+ #pragma mapbox: define mediump vec4 dasharray_to
602
+ void main() {
603
+ #pragma mapbox: initialize lowp float blur
604
+ #pragma mapbox: initialize lowp float opacity
605
+ #pragma mapbox: initialize mediump float width
606
+ #pragma mapbox: initialize lowp float floorwidth
607
+ #pragma mapbox: initialize mediump vec4 dasharray_from
608
+ #pragma mapbox: initialize mediump vec4 dasharray_to
609
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
610
+ #ifdef GLOBE
611
+ if (v_depth > 1.0) {discard;}
612
+ #endif
613
+ #ifdef OVERDRAW_INSPECTOR
614
+ fragColor=vec4(1.0);
615
+ #endif
616
+ }`,`
617
+ #define scale 0.015873016
618
+ #define LINE_DISTANCE_SCALE 2.0
619
+ in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
620
+ #ifdef GLOBE
621
+ out float v_depth;
622
+ #endif
623
+ #pragma mapbox: define lowp float blur
624
+ #pragma mapbox: define lowp float opacity
625
+ #pragma mapbox: define mediump float gapwidth
626
+ #pragma mapbox: define lowp float offset
627
+ #pragma mapbox: define mediump float width
628
+ #pragma mapbox: define lowp float floorwidth
629
+ #pragma mapbox: define mediump vec4 dasharray_from
630
+ #pragma mapbox: define mediump vec4 dasharray_to
631
+ void main() {
632
+ #pragma mapbox: initialize lowp float blur
633
+ #pragma mapbox: initialize lowp float opacity
634
+ #pragma mapbox: initialize mediump float gapwidth
635
+ #pragma mapbox: initialize lowp float offset
636
+ #pragma mapbox: initialize mediump float width
637
+ #pragma mapbox: initialize lowp float floorwidth
638
+ #pragma mapbox: initialize mediump vec4 dasharray_from
639
+ #pragma mapbox: initialize mediump vec4 dasharray_to
640
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
641
+ #ifdef GLOBE
642
+ v_depth=gl_Position.z/gl_Position.w;
643
+ #endif
644
+ #ifdef TERRAIN3D
645
+ v_gamma_scale=1.0;
646
+ #else
647
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
648
+ #endif
649
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),raster:st(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
650
+ #ifdef OVERDRAW_INSPECTOR
651
+ fragColor=vec4(1.0);
652
+ #endif
653
+ }`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
654
+ #ifdef GLOBE
655
+ if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
656
+ #endif
657
+ v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:st(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
658
+ #ifdef OVERDRAW_INSPECTOR
659
+ fragColor=vec4(1.0);
660
+ #endif
661
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_total_opacity;
662
+ #pragma mapbox: define lowp float opacity
663
+ void main() {
664
+ #pragma mapbox: initialize lowp float opacity
665
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
666
+ camera_to_anchor_distance/u_camera_to_center_distance :
667
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
668
+ #ifdef GLOBE
669
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
670
+ #endif
671
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:st(`#define SDF_PX 8.0
672
+ uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
673
+ #pragma mapbox: define highp vec4 fill_color
674
+ #pragma mapbox: define highp vec4 halo_color
675
+ #pragma mapbox: define lowp float halo_width
676
+ #pragma mapbox: define lowp float halo_blur
677
+ void main() {
678
+ #pragma mapbox: initialize highp vec4 fill_color
679
+ #pragma mapbox: initialize highp vec4 halo_color
680
+ #pragma mapbox: initialize lowp float halo_width
681
+ #pragma mapbox: initialize lowp float halo_blur
682
+ float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}
683
+ #ifdef OVERDRAW_INSPECTOR
684
+ fragColor=vec4(1.0);
685
+ #endif
686
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
687
+ #pragma mapbox: define highp vec4 fill_color
688
+ #pragma mapbox: define highp vec4 halo_color
689
+ #pragma mapbox: define lowp float opacity
690
+ #pragma mapbox: define lowp float halo_width
691
+ #pragma mapbox: define lowp float halo_blur
692
+ void main() {
693
+ #pragma mapbox: initialize highp vec4 fill_color
694
+ #pragma mapbox: initialize highp vec4 halo_color
695
+ #pragma mapbox: initialize lowp float opacity
696
+ #pragma mapbox: initialize lowp float halo_width
697
+ #pragma mapbox: initialize lowp float halo_blur
698
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
699
+ camera_to_anchor_distance/u_camera_to_center_distance :
700
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
701
+ #ifdef GLOBE
702
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
703
+ #endif
704
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:st(`#define SDF_PX 8.0
705
+ #define SDF 1.0
706
+ #define ICON 0.0
707
+ uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
708
+ #pragma mapbox: define highp vec4 fill_color
709
+ #pragma mapbox: define highp vec4 halo_color
710
+ #pragma mapbox: define lowp float halo_width
711
+ #pragma mapbox: define lowp float halo_blur
712
+ void main() {
713
+ #pragma mapbox: initialize highp vec4 fill_color
714
+ #pragma mapbox: initialize highp vec4 halo_color
715
+ #pragma mapbox: initialize lowp float halo_width
716
+ #pragma mapbox: initialize lowp float halo_blur
717
+ float total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
718
+ #ifdef OVERDRAW_INSPECTOR
719
+ fragColor=vec4(1.0);
720
+ #endif
721
+ return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}
722
+ #ifdef OVERDRAW_INSPECTOR
723
+ fragColor=vec4(1.0);
724
+ #endif
725
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
726
+ #pragma mapbox: define highp vec4 fill_color
727
+ #pragma mapbox: define highp vec4 halo_color
728
+ #pragma mapbox: define lowp float opacity
729
+ #pragma mapbox: define lowp float halo_width
730
+ #pragma mapbox: define lowp float halo_blur
731
+ void main() {
732
+ #pragma mapbox: initialize highp vec4 fill_color
733
+ #pragma mapbox: initialize highp vec4 halo_color
734
+ #pragma mapbox: initialize lowp float opacity
735
+ #pragma mapbox: initialize lowp float halo_width
736
+ #pragma mapbox: initialize lowp float halo_blur
737
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
738
+ camera_to_anchor_distance/u_camera_to_center_distance :
739
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
740
+ #ifdef GLOBE
741
+ if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
742
+ #endif
743
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}`),terrain:st("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:st("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:st("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:st("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:st(`#ifdef GL_ES
744
+ precision highp float;
745
+ #endif
746
+ in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
747
+ );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:st("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function st(g,t){let o=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,h=t.match(/in ([\w]+) ([\w]+)/g),p=g.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),T=v?v.concat(p):p,M={};return{fragmentSource:g=g.replace(o,((C,z,P,k,L)=>(M[L]=!0,z==="define"?`
748
+ #ifndef HAS_UNIFORM_u_${L}
749
+ in ${P} ${k} ${L};
750
+ #else
751
+ uniform ${P} ${k} u_${L};
752
+ #endif
753
+ `:`
754
+ #ifdef HAS_UNIFORM_u_${L}
755
+ ${P} ${k} ${L} = u_${L};
756
+ #endif
757
+ `))),vertexSource:t=t.replace(o,((C,z,P,k,L)=>{let N=k==="float"?"vec2":"vec4",G=L.match(/color/)?"color":N;return M[L]?z==="define"?`
758
+ #ifndef HAS_UNIFORM_u_${L}
759
+ uniform lowp float u_${L}_t;
760
+ in ${P} ${N} a_${L};
761
+ out ${P} ${k} ${L};
762
+ #else
763
+ uniform ${P} ${k} u_${L};
764
+ #endif
765
+ `:G==="vec4"?`
766
+ #ifndef HAS_UNIFORM_u_${L}
767
+ ${L} = a_${L};
768
+ #else
769
+ ${P} ${k} ${L} = u_${L};
770
+ #endif
771
+ `:`
772
+ #ifndef HAS_UNIFORM_u_${L}
773
+ ${L} = unpack_mix_${G}(a_${L}, u_${L}_t);
774
+ #else
775
+ ${P} ${k} ${L} = u_${L};
776
+ #endif
777
+ `:z==="define"?`
778
+ #ifndef HAS_UNIFORM_u_${L}
779
+ uniform lowp float u_${L}_t;
780
+ in ${P} ${N} a_${L};
781
+ #else
782
+ uniform ${P} ${k} u_${L};
783
+ #endif
784
+ `:G==="vec4"?`
785
+ #ifndef HAS_UNIFORM_u_${L}
786
+ ${P} ${k} ${L} = a_${L};
787
+ #else
788
+ ${P} ${k} ${L} = u_${L};
789
+ #endif
790
+ `:`
791
+ #ifndef HAS_UNIFORM_u_${L}
792
+ ${P} ${k} ${L} = unpack_mix_${G}(a_${L}, u_${L}_t);
793
+ #else
794
+ ${P} ${k} ${L} = u_${L};
795
+ #endif
796
+ `})),staticAttributes:h,staticUniforms:T}}class Jt{constructor(t,o,h){this.vertexBuffer=t,this.indexBuffer=o,this.segments=h}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var no=l.aS([{name:"a_pos",type:"Int16",components:2}]);let $n="#define PROJECTION_MERCATOR",gr="mercator";class Xn{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return gr}get shaderDefine(){return $n}get shaderPreludeCode(){return yi.projectionMercator}get vertexShaderPreludeCode(){return yi.projectionMercator.vertexSource}get subdivisionGranularity(){return l.aT.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,o,h,p,v){if(this._cachedMesh)return this._cachedMesh;let T=new l.aU;T.emplaceBack(0,0),T.emplaceBack(l.a6,0),T.emplaceBack(0,l.a6),T.emplaceBack(l.a6,l.a6);let M=t.createVertexBuffer(T,no.members),C=l.aV.simpleSegment(0,0,4,2),z=new l.aW;z.emplaceBack(1,0,2),z.emplaceBack(1,2,3);let P=t.createIndexBuffer(z);return this._cachedMesh=new Jt(M,P,C),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class ks{constructor(t=0,o=0,h=0,p=0){if(isNaN(t)||t<0||isNaN(o)||o<0||isNaN(h)||h<0||isNaN(p)||p<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=o,this.left=h,this.right=p}interpolate(t,o,h){return o.top!=null&&t.top!=null&&(this.top=l.H.number(t.top,o.top,h)),o.bottom!=null&&t.bottom!=null&&(this.bottom=l.H.number(t.bottom,o.bottom,h)),o.left!=null&&t.left!=null&&(this.left=l.H.number(t.left,o.left,h)),o.right!=null&&t.right!=null&&(this.right=l.H.number(t.right,o.right,h)),this}getCenter(t,o){let h=l.al((this.left+t-this.right)/2,0,t),p=l.al((this.top+o-this.bottom)/2,0,o);return new l.P(h,p)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ks(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ro(g,t){if(!g.renderWorldCopies||g.lngRange)return;let o=t.lng-g.center.lng;t.lng+=o>180?-360:o<-180?360:0}function Li(g){return Math.max(0,Math.floor(g))}class Oo{constructor(t,o){var h;this.applyConstrain=(p,v)=>this._constrainOverride!==null?this._constrainOverride(p,v):this._callbacks.defaultConstrain(p,v),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=o?.renderWorldCopies===void 0||!!o?.renderWorldCopies,this._minZoom=o?.minZoom||0,this._maxZoom=o?.maxZoom||22,this._minPitch=o?.minPitch==null?0:o?.minPitch,this._maxPitch=o?.maxPitch==null?60:o?.maxPitch,this._constrainOverride=(h=o?.constrainOverride)!==null&&h!==void 0?h:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new l.W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Li(this._zoom),this._scale=l.ao(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new ks,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,o,h){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=Li(this._zoom),this._scale=l.ao(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new ks(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!h&&t.autoCalculateNearFarZ,o&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){t===void 0&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){let o=l.X(t,-180,180)*Math.PI/180;var h,p,v,T,M,C,z,P,k;this._bearingInRadians!==o&&(this._unmodified=!1,this._bearingInRadians=o,this._calcMatrices(),this._rotationMatrix=B(),h=this._rotationMatrix,v=-this._bearingInRadians,T=(p=this._rotationMatrix)[0],M=p[1],C=p[2],z=p[3],P=Math.sin(v),k=Math.cos(v),h[0]=T*k+C*P,h[1]=M*k+z*P,h[2]=T*-P+C*k,h[3]=M*-P+z*k)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){let o=l.al(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==o&&(this._unmodified=!1,this._pitchInRadians=o,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){let o=t/180*Math.PI;this._rollInRadians!==o&&(this._unmodified=!1,this._rollInRadians=o,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return l.aX(this._fovInRadians)}setFov(t){t=l.al(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=l.an(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){let o=this.applyConstrain(this._center,t).zoom;this._zoom!==o&&(this._unmodified=!1,this._zoom=o,this._tileZoom=Math.max(0,Math.floor(o)),this._scale=l.ao(o),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,o){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=o,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,o,h){this._unmodified=!1,this._edgeInsets.interpolate(t,o,h),this.constrainInternal(),this._calcMatrices()}resize(t,o,h=!0){this._width=t,this._height=o,h&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var t,o;return((t=this._latRange)===null||t===void 0?void 0:t.length)!==2||((o=this._lngRange)===null||o===void 0?void 0:o.length)!==2?null:new Xe([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-l.am,l.am])}getCameraQueryGeometry(t,o){if(o.length===1)return[o[0],t];{let{minX:h,minY:p,maxX:v,maxY:T}=l.a8.fromPoints(o).extend(t);return[new l.P(h,p),new l.P(v,p),new l.P(v,T),new l.P(h,T),new l.P(h,p)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:o,zoom:h}=this.applyConstrain(this.center,this.zoom);this.setCenter(o),this.setZoom(h),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=l.ap(new Float64Array(16));l.S(t,t,[this._width/2,-this._height/2,1]),l.Q(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=l.ap(new Float64Array(16)),l.S(t,t,[1,-1,1]),l.Q(t,t,[-1,-1,0]),l.S(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,o,h,p){let v=h!==void 0?h:this.bearing,T=p=p!==void 0?p:this.pitch,{distanceToCenter:M,clampedElevation:C}=this._distanceToCenterFromAltElevationPitch(o,this.elevation,T),{x:z,y:P}=Po(T,v),k=l.a7.fromLngLat(t,o),L,N,G=l.aY(1,k.y),$=0;do{if($+=1,$>10)break;N=M/G,L=new l.a7(k.x+z*N,k.y+P*N),G=1/L.meterInMercatorCoordinateUnits()}while(Math.abs(M-N*G)>1e-12);return{center:L.toLngLat(),elevation:C,zoom:l.ar(this.height/2/Math.tan(this.fovInRadians/2)/N/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;let o=1/this.worldSize,h=l.aq(1,this.center.lat)*this.worldSize,p=l.a7.fromLngLat(this.center,this.elevation),v=p.x/o,T=p.y/o,M=p.z/o,C=this.pitch,z=this.bearing,{x:P,y:k,z:L}=Po(C,z),N=this.cameraToCenterDistance,G=v+N*-P,$=T+N*-k,J=M+N*L,{distanceToCenter:W,clampedElevation:ee}=this._distanceToCenterFromAltElevationPitch(J/h,t,C),ae=W*h,te=new l.a7((G+P*ae)*o,($+k*ae)*o,0).toLngLat(),Q=l.aq(1,te.lat),re=l.ar(this.height/2/Math.tan(this.fovInRadians/2)/W/Q/this.tileSize);this._elevation=ee,this._center=te,this.setZoom(re)}_distanceToCenterFromAltElevationPitch(t,o,h){let p=-Math.cos(l.an(h)),v=t-o,T,M=o;return p*v>=0||Math.abs(p)<.1?(T=1e4,M=t+T*p):T=-v/p,{distanceToCenter:T,clampedElevation:M}}getCameraPoint(){let t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let t=l.aq(1,this.center.lat)*this.worldSize;return eo(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];let o=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/o,t.canonical.y/o,1/o/l.a6,1/o/l.a6]}}class pa{constructor(t,o){this.min=t,this.max=o,this.center=l.aZ([],l.a_([],this.min,this.max),.5)}quadrant(t){let o=[t%2==0,t<2],h=l.a$(this.min),p=l.a$(this.max);for(let v=0;v<o.length;v++)h[v]=o[v]?this.min[v]:this.center[v],p[v]=o[v]?this.center[v]:this.max[v];return p[2]=this.max[2],new pa(h,p)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let o=!0;for(let h of t.planes){let p=this.intersectsPlane(h);if(p===0)return 0;p===1&&(o=!1)}return o?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let o=t[3],h=t[3];for(let p=0;p<3;p++)t[p]>0?(o+=t[p]*this.min[p],h+=t[p]*this.max[p]):(h+=t[p]*this.min[p],o+=t[p]*this.max[p]);return o>=0?2:h<0?0:1}}class tu{distanceToTile2d(t,o,h,p){let v=p,T=v.distanceX([t,o]),M=v.distanceY([t,o]);return Math.hypot(T,M)}getWrap(t,o,h){return h}getTileBoundingVolume(t,o,h,p){var v,T;let M=0,C=0;if(p?.terrain){let P=new l.a3(t.z,o,t.z,t.x,t.y),k=p.terrain.getMinMaxElevation(P);M=(v=k.minElevation)!==null&&v!==void 0?v:Math.min(0,h),C=(T=k.maxElevation)!==null&&T!==void 0?T:Math.max(0,h)}let z=1<<t.z;return new pa([o+t.x/z,t.y/z,M],[o+(t.x+1)/z,(t.y+1)/z,C])}allowVariableZoom(t,o){let h=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,p=l.al(78.5-h/2,0,60);return!!o.terrain||t.pitch>p}allowWorldCopies(){return!0}prepareNextFrame(){}}class cr{constructor(t,o,h){this.points=t,this.planes=o,this.aabb=h}static fromInvProjectionMatrix(t,o=1,h=0,p,v){let T=v?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],M=Math.pow(2,h),C=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((L=>(function(N,G,$,J){let W=l.aE([],N,G),ee=1/W[3]/$*J;return l.b4(W,W,[ee,ee,1/W[3],ee])})(L,t,o,M)));p&&(function(L,N,G,$){let J=$?4:0,W=$?0:4,ee=0,ae=[],te=[];for(let ie=0;ie<4;ie++){let me=l.b0([],L[ie+W],L[ie+J]),Te=l.b5(me);l.aZ(me,me,1/Te),ae.push(Te),te.push(me)}for(let ie=0;ie<4;ie++){let me=l.b6(L[ie+J],te[ie],G);ee=me!==null&&me>=0?Math.max(ee,me):Math.max(ee,ae[ie])}let Q=(function(ie,me){let Te=l.b0([],ie[me[0]],ie[me[1]]),Se=l.b0([],ie[me[2]],ie[me[1]]),Ie=[0,0,0,0];return l.b1(Ie,l.b2([],Te,Se)),Ie[3]=-l.b3(Ie,ie[me[0]]),Ie})(L,N),re=(function(ie,me){let Te=l.b7(ie),Se=l.b8([],ie,1/Te),Ie=l.b0([],me,l.aZ([],Se,l.b3(me,Se))),Pe=l.b7(Ie);if(Pe>0){let Qe=Math.sqrt(1-Se[3]*Se[3]),qe=l.aZ([],Se,-Se[3]),Ae=l.a_([],qe,l.aZ([],Ie,Qe/Pe));return l.b9(me,Ae)}return null})(G,Q);if(re!==null){let ie=re/l.b3(te[0],Q);ee=Math.min(ee,ie)}for(let ie=0;ie<4;ie++){let me=Math.min(ee,ae[ie]);L[ie+W]=[L[ie+J][0]+te[ie][0]*me,L[ie+J][1]+te[ie][1]*me,L[ie+J][2]+te[ie][2]*me,1]}})(C,T[0],p,v);let z=T.map((L=>{let N=l.b0([],C[L[0]],C[L[1]]),G=l.b0([],C[L[2]],C[L[1]]),$=l.b1([],l.b2([],N,G)),J=-l.b3($,C[L[1]]);return $.concat(J)})),P=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],k=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let L of C)for(let N=0;N<3;N++)P[N]=Math.min(P[N],L[N]),k[N]=Math.max(k[N],L[N]);return new cr(C,z,new pa(P,k))}}class Bo{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,o,h){this._helper.interpolatePadding(t,o,h)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,o,h=!0){this._helper.resize(t,o,h)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,o){this._helper.overrideNearFarZ(t,o)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,o){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(o,h)=>{h=l.al(+h,this.minZoom,this.maxZoom);let p={center:new l.W(o.lng,o.lat),zoom:h},v=this._helper._lngRange;if(!this._helper._renderWorldCopies&&v===null){let te=179.9999999999;v=[-te,te]}let T=this.tileSize*l.ao(p.zoom),M=0,C=T,z=0,P=T,k=0,L=0,{x:N,y:G}=this.size;if(this._helper._latRange){let te=this._helper._latRange;M=l.Y(te[1])*T,C=l.Y(te[0])*T,C-M<G&&(k=G/(C-M))}v&&(z=l.X(l.Z(v[0])*T,0,T),P=l.X(l.Z(v[1])*T,0,T),P<z&&(P+=T),P-z<N&&(L=N/(P-z)));let{x:$,y:J}=Dt(T,o),W,ee,ae=Math.max(L||0,k||0);if(ae){let te=new l.P(L?(P+z)/2:$,k?(C+M)/2:J);return p.center=Ui(T,te).wrap(),p.zoom+=l.ar(ae),p}if(this._helper._latRange){let te=G/2;J-te<M&&(ee=M+te),J+te>C&&(ee=C-te)}if(v){let te=(z+P)/2,Q=$;this._helper._renderWorldCopies&&(Q=l.X($,te-T/2,te+T/2));let re=N/2;Q-re<z&&(W=z+re),Q+re>P&&(W=P-re)}if(W!==void 0||ee!==void 0){let te=new l.P(W??$,ee??J);p.center=Ui(T,te).wrap()}return p},this.applyConstrain=(o,h)=>this._helper.applyConstrain(o,h),this._helper=new Oo({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(o,h)=>this.defaultConstrain(o,h)},t),this._coveringTilesDetailsProvider=new tu}clone(){let t=new Bo;return t.apply(this,!1),t}apply(t,o,h){this._helper.apply(t,o,h)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let o=[new l.ba(0,t)];if(this._helper._renderWorldCopies){let h=this.screenPointToMercatorCoordinate(new l.P(0,0)),p=this.screenPointToMercatorCoordinate(new l.P(this._helper._width,0)),v=this.screenPointToMercatorCoordinate(new l.P(this._helper._width,this._helper._height)),T=this.screenPointToMercatorCoordinate(new l.P(0,this._helper._height)),M=Math.floor(Math.min(h.x,p.x,v.x,T.x)),C=Math.floor(Math.max(h.x,p.x,v.x,T.x)),z=1;for(let P=M-z;P<=C+z;P++)P!==0&&o.push(new l.ba(P,t))}return o}getCameraFrustum(){return cr.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let o=this.screenPointToLocation(this.centerPoint,t),h=t?t.getElevationForLngLatZoom(o,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(h)}setLocationAtPoint(t,o){let h=l.aq(this.elevation,this.center.lat),p=this.screenPointToMercatorCoordinateAtZ(o,h),v=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,h),T=l.a7.fromLngLat(t),M=new l.a7(T.x-(p.x-v.x),T.y-(p.y-v.y));this.setCenter(M?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,o){return o?this.coordinatePoint(l.a7.fromLngLat(t),o.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(l.a7.fromLngLat(t))}screenPointToLocation(t,o){var h;return(h=this.screenPointToMercatorCoordinate(t,o))===null||h===void 0?void 0:h.toLngLat()}screenPointToMercatorCoordinate(t,o){if(o){let h=o.pointCoordinate(t);if(h!=null)return h}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,o){let h=o||0,p=[t.x,t.y,0,1],v=[t.x,t.y,1,1];l.aE(p,p,this._pixelMatrixInverse),l.aE(v,v,this._pixelMatrixInverse);let T=p[3],M=v[3],C=p[1]/T,z=v[1]/M,P=p[2]/T,k=v[2]/M,L=P===k?0:(h-P)/(k-P);return new l.a7(l.H.number(p[0]/T,v[0]/M,L)/this.worldSize,l.H.number(C,z,L)/this.worldSize,h)}coordinatePoint(t,o=0,h=this._pixelMatrix){let p=[t.x*this.worldSize,t.y*this.worldSize,o,1];return l.aE(p,p,h),new l.P(p[0]/p[3],p[1]/p[3])}getBounds(){let t=Math.max(0,this._helper._height/2-da(this));return new Xe().extend(this.screenPointToLocation(new l.P(0,t))).extend(this.screenPointToLocation(new l.P(this._helper._width,t))).extend(this.screenPointToLocation(new l.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new l.P(0,this._helper._height)))}isPointOnMapSurface(t,o){return o?o.pointCoordinate(t)!=null:t.y>this.height/2-da(this)}calculatePosMatrix(t,o=!1,h){var p;let v=(p=t.key)!==null&&p!==void 0?p:l.bb(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),T=o?this._alignedPosMatrixCache:this._posMatrixCache;if(T.has(v)){let z=T.get(v);return h?z.f32:z.f64}let M=Ja(t,this.worldSize);l.U(M,o?this._alignedProjMatrix:this._viewProjMatrix,M);let C={f64:M,f32:new Float32Array(M)};return T.set(v,C),h?C.f32:C.f64}calculateFogMatrix(t){let o=t.key,h=this._fogMatrixCacheF32;if(h.has(o))return h.get(o);let p=Ja(t,this.worldSize);return l.U(p,this._fogMatrix,p),h.set(o,new Float32Array(p)),h.get(o)}calculateCenterFromCameraLngLatAlt(t,o,h,p){return this._helper.calculateCenterFromCameraLngLatAlt(t,o,h,p)}_calculateNearFarZIfNeeded(t,o,h){if(!this._helper.autoCalculateNearFarZ)return;let p=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),v=t-p*this._helper._pixelPerMeter/Math.cos(o),T=p<0?v:t,M=Math.PI/2+this.pitchInRadians,C=l.an(this.fov)*(Math.abs(Math.cos(l.an(this.roll)))*this.height+Math.abs(Math.sin(l.an(this.roll)))*this.width)/this.height*(.5+h.y/this.height),z=Math.sin(C)*T/Math.sin(l.al(Math.PI-M-C,.01,Math.PI-.01)),P=da(this),k=Math.atan(P/this._helper.cameraToCenterDistance),L=l.an(.75),N=k>L?2*k*(.5+h.y/(2*P)):L,G=Math.sin(N)*T/Math.sin(l.al(Math.PI-M-N,.01,Math.PI-.01)),$=Math.min(z,G);this._helper._farZ=1.01*(Math.cos(Math.PI/2-o)*$+T),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let t=this.centerOffset,o=Dt(this.worldSize,this.center),h=o.x,p=o.y;this._helper._pixelPerMeter=l.aq(1,this.center.lat)*this.worldSize;let v=l.an(Math.min(this.pitch,xn)),T=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(v)),M;var C,z;this._calculateNearFarZIfNeeded(T,v,t),M=new Float64Array(16),l.bc(M,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),(C=this._invProjMatrix)[0]=1/(z=M)[0],C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=1/z[5],C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[10]=0,C[11]=1/z[14],C[12]=0,C[13]=0,C[14]=-1,C[15]=z[10]/z[14],M[8]=2*-t.x/this._helper._width,M[9]=2*t.y/this._helper._height,this._projectionMatrix=l.bd(M),l.S(M,M,[1,-1,1]),l.Q(M,M,[0,0,-this._helper.cameraToCenterDistance]),l.be(M,M,-this.rollInRadians),l.bf(M,M,this.pitchInRadians),l.be(M,M,-this.bearingInRadians),l.Q(M,M,[-h,-p,0]),this._mercatorMatrix=l.S([],M,[this.worldSize,this.worldSize,this.worldSize]),l.S(M,M,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=l.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,M),l.Q(M,M,[0,0,-this.elevation]),this._viewProjMatrix=M,this._invViewProjMatrix=l.bg([],M);let P=[0,0,-1,1];l.aE(P,P,this._invViewProjMatrix),this._cameraPosition=[P[0]/P[3],P[1]/P[3],P[2]/P[3]],this._fogMatrix=new Float64Array(16),l.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,T,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,l.S(this._fogMatrix,this._fogMatrix,[1,-1,1]),l.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),l.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),l.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),l.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),l.Q(this._fogMatrix,this._fogMatrix,[-h,-p,0]),l.S(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),l.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=l.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,M);let k=this._helper._width%2/2,L=this._helper._height%2/2,N=Math.cos(this.bearingInRadians),G=Math.sin(-this.bearingInRadians),$=h-Math.round(h)+N*k+G*L,J=p-Math.round(p)+N*L+G*k,W=new Float64Array(M);if(l.Q(W,W,[$>.5?$-1:$,J>.5?J-1:J,0]),this._alignedProjMatrix=W,M=l.bg(new Float64Array(16),this._pixelMatrix),!M)throw new Error("failed to invert matrix");this._pixelMatrixInverse=M,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new l.P(0,0)),o=[t.x*this.worldSize,t.y*this.worldSize,0,1];return l.aE(o,o,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=l.aq(1,this.center.lat)*this.worldSize;return eo(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,o){let h=l.a7.fromLngLat(t),p=[h.x*this.worldSize,h.y*this.worldSize,o,1];return l.aE(p,p,this._viewProjMatrix),p[2]/p[3]}getProjectionData(t){let{overscaledTileID:o,aligned:h,applyTerrainMatrix:p}=t,v=this._helper.getMercatorTileCoordinates(o),T=o?this.calculatePosMatrix(o,h,!0):null,M;return M=o?.terrainRttPosMatrix32f&&p?o.terrainRttPosMatrix32f:T||l.bh(),{mainMatrix:M,tileMercatorCoords:v,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:M}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,o,h){return 1}transformLightDirection(t){return l.a$(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,o,h,p){let v=this.calculatePosMatrix(h),T;p?(T=[t,o,p(t,o),1],l.aE(T,T,v)):(T=[t,o,0,1],Qc(T,T,v));let M=T[3];return{point:new l.P(T[0]/M,T[1]/M),signedDistanceFromCamera:M,isOccluded:!1}}populateCache(t){for(let o of t)this.calculatePosMatrix(o)}getMatrixForModel(t,o){let h=l.a7.fromLngLat(t,o),p=h.meterInMercatorCoordinateUnits(),v=l.bi();return l.Q(v,v,[h.x,h.y,h.z]),l.be(v,v,Math.PI),l.bf(v,v,Math.PI/2),l.S(v,v,[-p,p,p]),v}getProjectionDataForCustomLayer(t=!0){let o=new l.a3(0,0,0,0,0),h=this.getProjectionData({overscaledTileID:o,applyGlobeMatrix:t}),p=Ja(o,this.worldSize);l.U(p,this._viewProjMatrix,p),h.tileMercatorCoords=[0,0,1,1];let v=[l.a6,l.a6,this.worldSize/this._helper.pixelsPerMeter],T=l.bj();return l.S(T,p,v),h.fallbackMatrix=T,h.mainMatrix=T,h}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Ia(){l.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Xf(g){if(g.useSlerp)if(g.k<1){let t=l.bk(g.startEulerAngles.roll,g.startEulerAngles.pitch,g.startEulerAngles.bearing),o=l.bk(g.endEulerAngles.roll,g.endEulerAngles.pitch,g.endEulerAngles.bearing),h=new Float64Array(4);l.bl(h,t,o,g.k);let p=l.bm(h);g.tr.setRoll(p.roll),g.tr.setPitch(p.pitch),g.tr.setBearing(p.bearing)}else g.tr.setRoll(g.endEulerAngles.roll),g.tr.setPitch(g.endEulerAngles.pitch),g.tr.setBearing(g.endEulerAngles.bearing);else g.tr.setRoll(l.H.number(g.startEulerAngles.roll,g.endEulerAngles.roll,g.k)),g.tr.setPitch(l.H.number(g.startEulerAngles.pitch,g.endEulerAngles.pitch,g.k)),g.tr.setBearing(l.H.number(g.startEulerAngles.bearing,g.endEulerAngles.bearing,g.k))}function yd(g,t,o,h,p){let v=p.padding,T=Dt(p.worldSize,o.getNorthWest()),M=Dt(p.worldSize,o.getNorthEast()),C=Dt(p.worldSize,o.getSouthEast()),z=Dt(p.worldSize,o.getSouthWest()),P=l.an(-h),k=T.rotate(P),L=M.rotate(P),N=C.rotate(P),G=z.rotate(P),$=new l.P(Math.max(k.x,L.x,G.x,N.x),Math.max(k.y,L.y,G.y,N.y)),J=new l.P(Math.min(k.x,L.x,G.x,N.x),Math.min(k.y,L.y,G.y,N.y)),W=$.sub(J),ee=(p.width-(v.left+v.right+t.left+t.right))/W.x,ae=(p.height-(v.top+v.bottom+t.top+t.bottom))/W.y;if(ae<0||ee<0)return void Ia();let te=Math.min(l.ar(p.scale*Math.min(ee,ae)),g.maxZoom),Q=l.P.convert(g.offset),re=new l.P((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(l.an(h)),ie=Q.add(re).mult(p.scale/l.ao(te));return{center:Ui(p.worldSize,T.add(C).div(2).sub(ie)),zoom:te,bearing:h}}class Fo{get useGlobeControls(){return!1}handlePanInertia(t,o){let h=t.mag(),p=Math.abs(da(o));return{easingOffset:t.mult(Math.min(.75*p/h,1)),easingCenter:o.center}}handleMapControlsRollPitchBearingZoom(t,o){t.bearingDelta&&o.setBearing(o.bearing+t.bearingDelta),t.pitchDelta&&o.setPitch(o.pitch+t.pitchDelta),t.rollDelta&&o.setRoll(o.roll+t.rollDelta),t.zoomDelta&&o.setZoom(o.zoom+t.zoomDelta)}handleMapControlsPan(t,o,h){t.around.distSqr(o.centerPoint)<.01||o.setLocationAtPoint(h,t.around)}cameraForBoxAndBearing(t,o,h,p,v){return yd(t,o,h,p,v)}handleJumpToCenterZoom(t,o){t.zoom!==(o.zoom!==void 0?+o.zoom:t.zoom)&&t.setZoom(+o.zoom),o.center!==void 0&&t.setCenter(l.W.convert(o.center))}handleEaseTo(t,o){let h=t.zoom,p=t.padding,v={roll:t.roll,pitch:t.pitch,bearing:t.bearing},T={roll:o.roll===void 0?t.roll:o.roll,pitch:o.pitch===void 0?t.pitch:o.pitch,bearing:o.bearing===void 0?t.bearing:o.bearing},M=o.zoom!==void 0,C=!t.isPaddingEqual(o.padding),z=!1,P=M?+o.zoom:t.zoom,k=t.centerPoint.add(o.offsetAsPoint),L=t.screenPointToLocation(k),{center:N,zoom:G}=t.applyConstrain(l.W.convert(o.center||L),P??h);ro(t,N);let $=Dt(t.worldSize,L),J=Dt(t.worldSize,N).sub($),W=l.ao(G-h);return z=G!==h,{easeFunc:ee=>{if(z&&t.setZoom(l.H.number(h,G,ee)),l.bn(v,T)||Xf({startEulerAngles:v,endEulerAngles:T,tr:t,k:ee,useSlerp:v.roll!=T.roll}),C&&(t.interpolatePadding(p,o.padding,ee),k=t.centerPoint.add(o.offsetAsPoint)),o.around)t.setLocationAtPoint(o.around,o.aroundPoint);else{let ae=l.ao(t.zoom-h),te=G>h?Math.min(2,W):Math.max(.5,W),Q=Math.pow(te,1-ee),re=Ui(t.worldSize,$.add(J.mult(ee*Q)).mult(ae));t.setLocationAtPoint(t.renderWorldCopies?re.wrap():re,k)}},isZooming:z,elevationCenter:N}}handleFlyTo(t,o){let h=o.zoom!==void 0,p=t.zoom,v=t.applyConstrain(l.W.convert(o.center||o.locationAtOffset),h?+o.zoom:p),T=v.center,M=v.zoom;ro(t,T);let C=Dt(t.worldSize,o.locationAtOffset),z=Dt(t.worldSize,T).sub(C),P=z.mag(),k=l.ao(M-p),L;if(o.minZoom!==void 0){let N=Math.min(+o.minZoom,p,M),G=t.applyConstrain(T,N).zoom;L=l.ao(G-p)}return{easeFunc:(N,G,$,J)=>{t.setZoom(N===1?M:p+l.ar(G));let W=N===1?T:Ui(t.worldSize,C.add(z.mult($)).mult(G));t.setLocationAtPoint(t.renderWorldCopies?W.wrap():W,J)},scaleOfZoom:k,targetCenter:T,scaleOfMinZoom:L,pixelPathLength:P}}}class ei{constructor(t,o,h){this.blendFunction=t,this.blendColor=o,this.mask=h}}ei.Replace=[1,0],ei.disabled=new ei(ei.Replace,l.bo.transparent,[!1,!1,!1,!1]),ei.unblended=new ei(ei.Replace,l.bo.transparent,[!0,!0,!0,!0]),ei.alphaBlended=new ei([1,771],l.bo.transparent,[!0,!0,!0,!0]);let Ls=2305;class wt{constructor(t,o,h){this.enable=t,this.mode=o,this.frontFace=h}}wt.disabled=new wt(!1,1029,Ls),wt.backCCW=new wt(!0,1029,Ls),wt.frontCCW=new wt(!0,1028,Ls);class dt{constructor(t,o,h){this.func=t,this.mask=o,this.range=h}}dt.ReadOnly=!1,dt.ReadWrite=!0,dt.disabled=new dt(519,dt.ReadOnly,[0,1]);let Os=7680;class Tt{constructor(t,o,h,p,v,T){this.test=t,this.ref=o,this.mask=h,this.fail=p,this.depthFail=v,this.pass=T}}function $r(g){return typeof WebGL2RenderingContext<"u"&&g instanceof WebGL2RenderingContext}Tt.disabled=new Tt({func:519,mask:0},0,0,Os,Os,Os);class Bs{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;let o=t.context,h=o.gl;this._texFormat=h.RGBA,this._texType=h.UNSIGNED_BYTE;let p=new l.aU;p.emplaceBack(-1,-1),p.emplaceBack(2,-1),p.emplaceBack(-1,2);let v=new l.aW;v.emplaceBack(0,1,2),this._fullscreenTriangle=new Jt(o.createVertexBuffer(p,no.members),o.createIndexBuffer(v),l.aV.simpleSegment(0,0,p.length,v.length)),this._resultBuffer=new Uint8Array(4),o.activeTexture.set(h.TEXTURE1);let T=h.createTexture();h.bindTexture(h.TEXTURE_2D,T),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST),h.texImage2D(h.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=o.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(T),$r(h)&&(this._pbo=h.createBuffer(),h.bindBuffer(h.PIXEL_PACK_BUFFER,this._pbo),h.bufferData(h.PIXEL_PACK_BUFFER,4,h.STREAM_READ),h.bindBuffer(h.PIXEL_PACK_BUFFER,null))}destroy(){let t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,o){let h=this._updateCount;return this._readbackQueue?h>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():h>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,o),this._updateCount++,this._measuredError}_bindFramebuffer(){let t=this._cachedRenderContext.context,o=t.gl;t.activeTexture.set(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,o){let h=this._cachedRenderContext.context,p=h.gl;if(this._bindFramebuffer(),h.viewport.set([0,0,this._texWidth,this._texHeight]),h.clear({color:l.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(h,p.TRIANGLES,dt.disabled,Tt.disabled,ei.unblended,wt.disabled,((v,T)=>({u_input:v,u_output_expected:T}))(t,o),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&$r(p)){p.bindBuffer(p.PIXEL_PACK_BUFFER,this._pbo),p.readBuffer(p.COLOR_ATTACHMENT0),p.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),p.bindBuffer(p.PIXEL_PACK_BUFFER,null);let v=p.fenceSync(p.SYNC_GPU_COMMANDS_COMPLETE,0);p.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:v}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&$r(t)){let o=t.clientWaitSync(this._readbackQueue.sync,0,0);if(o===t.WAIT_FAILED)return l.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(o===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Bs._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let o=0;return o+=t[0]/256,o+=t[1]/65536,o+=t[2]/16777216,t[3]<127&&(o=-o),o/128}}let No=l.a6/128;function Fs(g,t){let o=g.granularity!==void 0?Math.max(g.granularity,1):1,h=o+(g.generateBorders?2:0),p=o+(g.extendToNorthPole||g.generateBorders?1:0)+(g.extendToSouthPole||g.generateBorders?1:0),v=h+1,T=p+1,M=g.generateBorders?-1:0,C=g.generateBorders||g.extendToNorthPole?-1:0,z=o+(g.generateBorders?1:0),P=o+(g.generateBorders||g.extendToSouthPole?1:0),k=v*T,L=h*p*6,N=v*T>65536;if(N&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let G=N||t==="32bit",$=new Int16Array(2*k),J=0;for(let ae=C;ae<=P;ae++)for(let te=M;te<=z;te++){let Q=te/o*l.a6;te===-1&&(Q=-No),te===o+1&&(Q=l.a6+No);let re=ae/o*l.a6;ae===-1&&(re=g.extendToNorthPole?l.bq:-No),ae===o+1&&(re=g.extendToSouthPole?l.br:l.a6+No),$[J++]=Q,$[J++]=re}let W=G?new Uint32Array(L):new Uint16Array(L),ee=0;for(let ae=0;ae<p;ae++)for(let te=0;te<h;te++){let Q=te+1+ae*v,re=te+(ae+1)*v,ie=te+1+(ae+1)*v;W[ee++]=te+ae*v,W[ee++]=re,W[ee++]=Q,W[ee++]=Q,W[ee++]=re,W[ee++]=ie}return{vertices:$.buffer.slice(0),indices:W.buffer.slice(0),uses32bitIndices:G}}let vd=new l.aT({fill:new l.bs(128,2),line:new l.bs(512,0),tile:new l.bs(128,32),stencil:new l.bs(128,1),circle:3});class iu{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return yi.projectionGlobe}get vertexShaderPreludeCode(){return yi.projectionMercator.vertexSource}get subdivisionGranularity(){return vd}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new Bs(t));let o=l.Y(this._errorQueryLatitudeDegrees),h=2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-.5*Math.PI,p=this._errorMeasurement.updateErrorLoop(o,h),v=le();p!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=p,this._errorMeasurementLastChangeTime=v);let T=Math.min(Math.max((v-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=l.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,l.bu(T))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,o,h,p,v){let T=(v==="stencil"?vd.stencil:vd.tile).getGranularityForZoomLevel(o.z);return this._getMesh(t,{granularity:T,generateBorders:h,extendToNorthPole:o.y===0&&p,extendToSouthPole:o.y===(1<<o.z)-1&&p})}_getMesh(t,o){let h=this._getMeshKey(o);if(h in this._tileMeshCache)return this._tileMeshCache[h];let p=(function(v,T){let M=Fs(T,"16bit"),C=l.aU.deserialize({arrayBuffer:M.vertices,length:M.vertices.byteLength/2/2}),z=l.aW.deserialize({arrayBuffer:M.indices,length:M.indices.byteLength/2/3});return new Jt(v.createVertexBuffer(C,no.members),v.createIndexBuffer(z),l.aV.simpleSegment(0,0,C.length,z.length))})(t,o);return this._tileMeshCache[h]=p,p}recalculate(t){}hasTransition(){var t;let o=le(),h=!1;return h||(h=(o-this._errorMeasurementLastChangeTime)/1e3<.7),h||(h=(t=this._errorMeasurement)===null||t===void 0?void 0:t.awaitingQuery),h}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}let Yf=new l.u({type:new l.D(l.x.projection.type)});class Wf extends l.E{constructor(t){super(),this._transitionable=new l.y(Yf,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.J(0)),this._mercatorProjection=new Xn,this._verticalPerspectiveProjection=new iu}get transitionState(){let t=this.properties.get("type");if(typeof t=="string"&&t==="mercator")return 0;if(typeof t=="string"&&t==="vertical-perspective")return 1;if(t instanceof l.bv){if(t.from==="vertical-perspective"&&t.to==="mercator")return 1-t.transition;if(t.from==="mercator"&&t.to==="vertical-perspective")return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,o,h,p,v){return this.currentProjection.getMeshFromTileID(t,o,h,p,v)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function Kf(g){let t=_r(g.worldSize,g.center.lat);return 2*Math.PI*t}function Vi(g,t,o,h,p){let v=1/(1<<p),T=t/l.a6*v+h*v,M=l.by((g/l.a6*v+o*v)*Math.PI*2+Math.PI,2*Math.PI),C=2*Math.atan(Math.exp(Math.PI-T*Math.PI*2))-.5*Math.PI,z=Math.cos(C),P=new Float64Array(3);return P[0]=Math.sin(M)*z,P[1]=Math.sin(C),P[2]=Math.cos(M)*z,P}function ln(g){return(function(t,o){let h=Math.cos(o),p=new Float64Array(3);return p[0]=Math.sin(t)*h,p[1]=Math.sin(o),p[2]=Math.cos(t)*h,p})(g.lng*Math.PI/180,g.lat*Math.PI/180)}function _r(g,t){return g/(2*Math.PI)/Math.cos(t*Math.PI/180)}function Gl(g){let t=Math.asin(g[1])/Math.PI*180,o=Math.sqrt(g[0]*g[0]+g[2]*g[2]);if(o>1e-6){let h=g[0]/o,p=Math.acos(g[2]/o),v=(h>0?p:-p)/Math.PI*180;return new l.W(l.X(v,-180,180),t)}return new l.W(0,t)}function Zl(g){return Math.cos(g*Math.PI/180)}function Qi(g,t){let o=Zl(g),h=Zl(t);return l.ar(h/o)}function Uo(g,t){let o=g.rotate(t.bearingInRadians),h=t.zoom+Qi(t.center.lat,0),p=l.bt(1/Zl(t.center.lat),1/Zl(Math.min(Math.abs(t.center.lat),60)),l.bw(h,7,3,0,1)),v=360/Kf({worldSize:t.worldSize,center:{lat:t.center.lat}});return new l.W(t.center.lng-o.x*v*p,l.al(t.center.lat+o.y*v,-l.am,l.am))}function bd(g){let t=.5*g,o=Math.sin(t),h=Math.cos(t);return Math.log(o+h)-Math.log(h-o)}function Qf(g,t,o,h){let p=g.lat+o*h;if(Math.abs(o)>1){let v=(Math.sign(g.lat+o)!==Math.sign(g.lat)?-Math.abs(g.lat):Math.abs(g.lat))*Math.PI/180,T=Math.abs(g.lat+o)*Math.PI/180,M=bd(v+h*(T-v)),C=bd(v),z=bd(T);return new l.W(g.lng+t*((M-C)/(z-C)),p)}return new l.W(g.lng+t*h,p)}class u1{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;let t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,o,h,p){let v=`${t.z}_${t.x}_${t.y}_${p?.terrain?"t":""}`,T=this._cache.get(v);if(T)return T;let M=this._cachePrevious.get(v);if(M)return this._cache.set(v,M),M;let C=this._boundingVolumeFactory(t,o,h,p);return this._cache.set(v,C),this._hadAnyChanges=!0,C}}class Ns{constructor(t,o,h,p){this.min=h,this.max=p,this.points=t,this.planes=o}static fromAabb(t,o){let h=[];for(let p=0;p<8;p++)h.push([1&~p?t[0]:o[0],(p>>1&1)==1?o[1]:t[1],(p>>2&1)==1?o[2]:t[2]]);return new Ns(h,[[-1,0,0,o[0]],[1,0,0,-t[0]],[0,-1,0,o[1]],[0,1,0,-t[1]],[0,0,-1,o[2]],[0,0,1,-t[2]]],t,o)}static fromCenterSizeAngles(t,o,h){let p=l.bA([],h[0],h[1],h[2]),v=l.bB([],[o[0],0,0],p),T=l.bB([],[0,o[1],0],p),M=l.bB([],[0,0,o[2]],p),C=[...t],z=[...t];for(let k=0;k<8;k++)for(let L=0;L<3;L++){let N=t[L]+v[L]*(1&~k?-1:1)+T[L]*((k>>1&1)==1?1:-1)+M[L]*((k>>2&1)==1?1:-1);C[L]=Math.min(C[L],N),z[L]=Math.max(z[L],N)}let P=[];for(let k=0;k<8;k++){let L=[...t];l.a_(L,L,l.aZ([],v,1&~k?-1:1)),l.a_(L,L,l.aZ([],T,(k>>1&1)==1?1:-1)),l.a_(L,L,l.aZ([],M,(k>>2&1)==1?1:-1)),P.push(L)}return new Ns(P,[[...v,-l.b3(v,P[0])],[...T,-l.b3(T,P[0])],[...M,-l.b3(M,P[0])],[-v[0],-v[1],-v[2],-l.b3(v,P[7])],[-T[0],-T[1],-T[2],-l.b3(T,P[7])],[-M[0],-M[1],-M[2],-l.b3(M,P[7])]],C,z)}intersectsFrustum(t){let o=!0,h=this.points.length,p=this.planes.length,v=t.planes.length,T=t.points.length;for(let M=0;M<v;M++){let C=t.planes[M],z=0;for(let P=0;P<h;P++){let k=this.points[P];C[0]*k[0]+C[1]*k[1]+C[2]*k[2]+C[3]>=0&&z++}if(z===0)return 0;z<h&&(o=!1)}if(o)return 2;for(let M=0;M<p;M++){let C=this.planes[M],z=0;for(let P=0;P<T;P++){let k=t.points[P];C[0]*k[0]+C[1]*k[1]+C[2]*k[2]+C[3]>=0&&z++}if(z===0)return 0}return 1}intersectsPlane(t){let o=this.points.length,h=0;for(let p=0;p<o;p++){let v=this.points[p];t[0]*v[0]+t[1]*v[1]+t[2]*v[2]+t[3]>=0&&h++}return h===o?2:h===0?0:1}}function nu(g,t,o){let h=g-t;return h<0?-h:Math.max(0,h-o)}function xd(g,t,o,h,p){let v=g-o,T;return T=v<0?Math.min(-v,1+v-p):v>p?Math.min(Math.max(v-p,0),1-v):0,Math.max(T,nu(t,h,p))}class ru{constructor(){this._boundingVolumeCache=new u1(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,o,h,p){let v=1<<h.z,T=1/v,M=h.x/v,C=h.y/v,z=2;return z=Math.min(z,xd(t,o,M,C,T)),z=Math.min(z,xd(t,o,M+.5,-C-T,T)),z=Math.min(z,xd(t,o,M+.5,2-C-T,T)),z}getWrap(t,o,h){let p=1<<o.z,v=1/p,T=o.x/p,M=nu(t.x,T,v),C=nu(t.x,T-1,v),z=nu(t.x,T+1,v),P=Math.min(M,C,z);return P===z?1:P===C?-1:0}allowVariableZoom(t,o){return sr(t,o)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,o,h,p){return this._boundingVolumeCache.getTileBoundingVolume(t,o,h,p)}_computeTileBoundingVolume(t,o,h,p){var v,T;let M=0,C=0;if(p?.terrain){let z=new l.a3(t.z,o,t.z,t.x,t.y),P=p.terrain.getMinMaxElevation(z);M=(v=P.minElevation)!==null&&v!==void 0?v:Math.min(0,h),C=(T=P.maxElevation)!==null&&T!==void 0?T:Math.max(0,h)}if(M/=l.bD,C/=l.bD,M+=1,C+=1,t.z<=0)return Ns.fromAabb([-C,-C,-C],[C,C,C]);if(t.z===1)return Ns.fromAabb([t.x===0?-C:0,t.y===0?0:-C,-C],[t.x===0?0:C,t.y===0?C:0,C]);{let z=[Vi(0,0,t.x,t.y,t.z),Vi(l.a6,0,t.x,t.y,t.z),Vi(l.a6,l.a6,t.x,t.y,t.z),Vi(0,l.a6,t.x,t.y,t.z)],P=[];for(let Ie of z)P.push(l.aZ([],Ie,C));if(C!==M)for(let Ie of z)P.push(l.aZ([],Ie,M));t.y===0&&P.push([0,1,0]),t.y===(1<<t.z)-1&&P.push([0,-1,0]);let k=[1,1,1],L=[-1,-1,-1];for(let Ie of P)for(let Pe=0;Pe<3;Pe++)k[Pe]=Math.min(k[Pe],Ie[Pe]),L[Pe]=Math.max(L[Pe],Ie[Pe]);let N=Vi(l.a6/2,l.a6/2,t.x,t.y,t.z),G=l.b2([],[0,1,0],N);l.b1(G,G);let $=l.b2([],N,G);l.b1($,$);let J=l.b2([],z[2],z[1]);l.b1(J,J);let W=l.b2([],z[0],z[3]);l.b1(W,W),P.push(l.aZ([],N,C)),t.y>=(1<<t.z)/2&&P.push(l.aZ([],Vi(l.a6/2,0,t.x,t.y,t.z),C)),t.y<(1<<t.z)/2&&P.push(l.aZ([],Vi(l.a6/2,l.a6,t.x,t.y,t.z),C));let ee=au(N,P),ae=au($,P),te=[-N[0],-N[1],-N[2],ee.max],Q=[N[0],N[1],N[2],-ee.min],re=[-$[0],-$[1],-$[2],ae.max],ie=[$[0],$[1],$[2],-ae.min],me=[...J,0],Te=[...W,0],Se=[];return t.y===0?Se.push(l.bC(Te,me,te),l.bC(Te,me,Q)):Se.push(l.bC(re,me,te),l.bC(re,me,Q),l.bC(re,Te,te),l.bC(re,Te,Q)),t.y===(1<<t.z)-1?Se.push(l.bC(Te,me,te),l.bC(Te,me,Q)):Se.push(l.bC(ie,me,te),l.bC(ie,me,Q),l.bC(ie,Te,te),l.bC(ie,Te,Q)),new Ns(Se,[te,Q,re,ie,me,Te],k,L)}}}function au(g,t){let o=1/0,h=-1/0;for(let p of t){let v=l.b3(g,p);o=Math.min(o,v),h=Math.max(h,v)}return{min:o,max:h}}class Vo{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,o,h){this._helper.interpolatePadding(t,o,h)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,o){this._helper.resize(t,o)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,o){this._helper.overrideNearFarZ(t,o)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=l.bE(),this._projectionMatrix=l.bi(),this._globeViewProjMatrix32f=l.bh(),this._globeViewProjMatrixNoCorrection=l.bi(),this._globeViewProjMatrixNoCorrectionInverted=l.bi(),this._globeProjMatrixInverted=l.bi(),this._cameraPosition=l.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(o,h)=>{let p=l.al(o.lat,-l.am,l.am),v=l.al(+h,this.minZoom+Qi(0,p),this.maxZoom);return{center:new l.W(o.lng,p),zoom:v}},this.applyConstrain=(o,h)=>this._helper.applyConstrain(o,h),this._helper=new Oo({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(o,h)=>this.defaultConstrain(o,h)},t),this._coveringTilesDetailsProvider=new ru}clone(){let t=new Vo;return t.apply(this,!1),t}apply(t,o,h){this._globeLatitudeErrorCorrectionRadians=h||0,this._helper.apply(t,o)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=l.bz();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:o,applyGlobeMatrix:h}=t,p=this._helper.getMercatorTileCoordinates(o);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:p,clippingPlane:this._cachedClippingPlane,projectionTransition:h?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){let o=this.pitchInRadians,h=this.cameraToCenterDistance/t,p=Math.sin(o)*h,v=Math.cos(o)*h+1,T=1/Math.sqrt(p*p+v*v)*1,M=-p,C=v,z=Math.sqrt(M*M+C*C);M/=z,C/=z;let P=[0,M,C];l.bF(P,P,[0,0,0],-this.bearingInRadians),l.bG(P,P,[0,0,0],-1*this.center.lat*Math.PI/180),l.bH(P,P,[0,0,0],this.center.lng*Math.PI/180);let k=1/l.b5(P);return l.aZ(P,P,k),[...P,-T*k]}isLocationOccluded(t){return!this.isSurfacePointVisible(ln(t))}transformLightDirection(t){let o=this._helper._center.lng*Math.PI/180,h=this._helper._center.lat*Math.PI/180,p=Math.cos(h),v=[Math.sin(o)*p,Math.sin(h),Math.cos(o)*p],T=[v[2],0,-v[0]],M=[0,0,0];l.b2(M,T,v),l.b1(T,T),l.b1(M,M);let C=[0,0,0];return l.b1(C,[T[0]*t[0]+M[0]*t[1]+v[0]*t[2],T[1]*t[0]+M[1]*t[1]+v[1]*t[2],T[2]*t[0]+M[2]*t[1]+v[2]*t[2]]),C}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,o,h){let p=(function(M,C,z){let P=1/(1<<z.z);return new l.a7(M/l.a6*P+z.x*P,C/l.a6*P+z.y*P)})(t,o,h.canonical),v=(T=p.y,[l.by(p.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-T*Math.PI*2))-.5*Math.PI]);var T;return this.getCircleRadiusCorrection()/Math.cos(v[1])}projectTileCoordinates(t,o,h,p){let v=h.canonical,T=Vi(t,o,v.x,v.y,v.z),M=1+(p?p(t,o):0)/l.bD,C=[T[0]*M,T[1]*M,T[2]*M,1];l.aE(C,C,this._globeViewProjMatrixNoCorrection);let z=this._cachedClippingPlane,P=z[0]*T[0]+z[1]*T[1]+z[2]*T[2]+z[3]<0;return{point:new l.P(C[0]/C[3],C[1]/C[3]),signedDistanceFromCamera:C[3],isOccluded:P}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=_r(this.worldSize,this.center.lat),o=l.bj(),h=l.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),l.bc(o,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let p=this.centerOffset;o[8]=2*-p.x/this._helper._width,o[9]=2*p.y/this._helper._height,this._projectionMatrix=l.bd(o),this._globeProjMatrixInverted=l.bj(),l.bg(this._globeProjMatrixInverted,o),l.Q(o,o,[0,0,-this.cameraToCenterDistance]),l.be(o,o,this.rollInRadians),l.bf(o,o,-this.pitchInRadians),l.be(o,o,this.bearingInRadians),l.Q(o,o,[0,0,-t]);let v=l.bz();v[0]=t,v[1]=t,v[2]=t,l.bf(h,o,this.center.lat*Math.PI/180),l.bI(h,h,-this.center.lng*Math.PI/180),l.S(h,h,v),this._globeViewProjMatrixNoCorrection=h,l.bf(o,o,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),l.bI(o,o,-this.center.lng*Math.PI/180),l.S(o,o,v),this._globeViewProjMatrix32f=new Float32Array(o),this._globeViewProjMatrixNoCorrectionInverted=l.bj(),l.bg(this._globeViewProjMatrixNoCorrectionInverted,h);let T=l.bz();this._cameraPosition=l.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/t,l.bF(this._cameraPosition,this._cameraPosition,T,-this.rollInRadians),l.bG(this._cameraPosition,this._cameraPosition,T,this.pitchInRadians),l.bF(this._cameraPosition,this._cameraPosition,T,-this.bearingInRadians),l.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),l.bG(this._cameraPosition,this._cameraPosition,T,-this.center.lat*Math.PI/180),l.bH(this._cameraPosition,this._cameraPosition,T,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let M=l.bd(this._globeViewProjMatrixNoCorrectionInverted);l.S(M,M,[1,1,-1]),this._cachedFrustum=cr.fromInvProjectionMatrix(M,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){l.w("calculateFogMatrix is not supported on globe projection.");let o=l.bj();return l.ap(o),o}getVisibleUnwrappedCoordinates(t){return[new l.ba(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&l.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,o){if(!this._globeViewProjMatrixNoCorrection)return 1;let h=ln(t);l.aZ(h,h,1+o/l.bD);let p=l.bE();return l.aE(p,[h[0],h[1],h[2],1],this._globeViewProjMatrixNoCorrection),p[2]/p[3]}populateCache(t){}getBounds(){let t=.5*this.width,o=.5*this.height,h=[new l.P(0,0),new l.P(t,0),new l.P(this.width,0),new l.P(this.width,o),new l.P(this.width,this.height),new l.P(t,this.height),new l.P(0,this.height),new l.P(0,o)],p=[];for(let k of h)p.push(this.unprojectScreenPoint(k));let v=0,T=0,M=0,C=0,z=this.center;for(let k of p){let L=l.bJ(z.lng,k.lng),N=l.bJ(z.lat,k.lat);L<T&&(T=L),L>v&&(v=L),N<C&&(C=N),N>M&&(M=N)}let P=[z.lng+T,z.lat+C,z.lng+v,z.lat+M];return this.isSurfacePointOnScreen([0,1,0])&&(P[3]=90,P[0]=-180,P[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(P[1]=-90,P[0]=-180,P[2]=180),new Xe(P)}calculateCenterFromCameraLngLatAlt(t,o,h,p){return this._helper.calculateCenterFromCameraLngLatAlt(t,o,h,p)}setLocationAtPoint(t,o){let h=ln(this.unprojectScreenPoint(o)),p=ln(t),v=l.bz();l.bK(v);let T=l.bz();l.bH(T,h,v,-this.center.lng*Math.PI/180),l.bG(T,T,v,this.center.lat*Math.PI/180);let M=p[0]*p[0]+p[2]*p[2],C=T[0]*T[0];if(M<C)return;let z=Math.sqrt(M-C),P=-z,k=l.bL(p[0],p[2],T[0],z),L=l.bL(p[0],p[2],T[0],P),N=l.bz();l.bH(N,p,v,-k);let G=l.bL(N[1],N[2],T[1],T[2]),$=l.bz();l.bH($,p,v,-L);let J=l.bL($[1],$[2],T[1],T[2]),W=.5*Math.PI,ee=G>=-W&&G<=W,ae=J>=-W&&J<=W,te,Q;if(ee&&ae){let Te=this.center.lng*Math.PI/180,Se=this.center.lat*Math.PI/180;l.bM(k,Te)+l.bM(G,Se)<l.bM(L,Te)+l.bM(J,Se)?(te=k,Q=G):(te=L,Q=J)}else if(ee)te=k,Q=G;else{if(!ae)return;te=L,Q=J}let re=te/Math.PI*180,ie=Q/Math.PI*180,me=this.center.lat;this.setCenter(new l.W(re,l.al(ie,-90,90))),this.setZoom(this.zoom+Qi(me,this.center.lat))}locationToScreenPoint(t,o){let h=ln(t);if(o){let p=o.getElevationForLngLatZoom(t,this._helper._tileZoom);l.aZ(h,h,1+p/l.bD)}return this._projectSurfacePointToScreen(h)}_projectSurfacePointToScreen(t){let o=l.bE();return l.aE(o,[...t,1],this._globeViewProjMatrixNoCorrection),o[0]/=o[3],o[1]/=o[3],new l.P((.5*o[0]+.5)*this.width,(.5*-o[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,o){if(o){let h=o.pointCoordinate(t);if(h)return h}return l.a7.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,o){var h;return(h=this.screenPointToMercatorCoordinate(t,o))===null||h===void 0?void 0:h.toLngLat()}isPointOnMapSurface(t,o){let h=this._cameraPosition,p=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(h,p)}getRayDirectionFromPixel(t){let o=l.bE();o[0]=t.x/this.width*2-1,o[1]=-1*(t.y/this.height*2-1),o[2]=1,o[3]=1,l.aE(o,o,this._globeViewProjMatrixNoCorrectionInverted),o[0]/=o[3],o[1]/=o[3],o[2]/=o[3];let h=l.bz();h[0]=o[0]-this._cameraPosition[0],h[1]=o[1]-this._cameraPosition[1],h[2]=o[2]-this._cameraPosition[2];let p=l.bz();return l.b1(p,h),p}isSurfacePointVisible(t){let o=this._cachedClippingPlane;return o[0]*t[0]+o[1]*t[1]+o[2]*t[2]+o[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let o=l.bE();return l.aE(o,[...t,1],this._globeViewProjMatrixNoCorrection),o[0]/=o[3],o[1]/=o[3],o[2]/=o[3],o[0]>-1&&o[0]<1&&o[1]>-1&&o[1]<1&&o[2]>-1&&o[2]<1}rayPlanetIntersection(t,o){let h=l.b3(t,o),p=l.bz(),v=l.bz();l.aZ(v,o,h),l.b0(p,t,v);let T=1-l.b3(p,p);if(T<0)return null;let M=l.b3(t,t)-1,C=-h+(h<0?1:-1)*Math.sqrt(T),z=M/C,P=C;return{tMin:Math.min(z,P),tMax:Math.max(z,P)}}unprojectScreenPoint(t){let o=this._cameraPosition,h=this.getRayDirectionFromPixel(t),p=this.rayPlanetIntersection(o,h);if(p){let P=l.bz();l.a_(P,o,[h[0]*p.tMin,h[1]*p.tMin,h[2]*p.tMin]);let k=l.bz();return l.b1(k,P),Gl(k)}let v=this._cachedClippingPlane,T=v[0]*h[0]+v[1]*h[1]+v[2]*h[2],M=-l.b9(v,o)/T,C=l.bz();if(M>0)l.a_(C,o,[h[0]*M,h[1]*M,h[2]*M]);else{let P=l.bz();l.a_(P,o,[2*h[0],2*h[1],2*h[2]]);let k=l.b9(this._cachedClippingPlane,P);l.b0(C,P,[this._cachedClippingPlane[0]*k,this._cachedClippingPlane[1]*k,this._cachedClippingPlane[2]*k])}let z=(function(P){let k=l.bz();return k[0]=P[0]*-P[3],k[1]=P[1]*-P[3],k[2]=P[2]*-P[3],{center:k,radius:Math.sqrt(1-P[3]*P[3])}})(v);return Gl((function(P,k,L){let N=l.bz();l.b0(N,L,P);let G=l.bz();return l.bx(G,P,N,k/l.b7(N)),G})(z.center,z.radius,C))}getMatrixForModel(t,o){let h=l.W.convert(t),p=1/l.bD,v=l.bi();return l.bI(v,v,h.lng/180*Math.PI),l.bf(v,v,-h.lat/180*Math.PI),l.Q(v,v,[0,0,1+o/l.bD]),l.bf(v,v,.5*Math.PI),l.S(v,v,[p,p,p]),v}getProjectionDataForCustomLayer(t=!0){let o=this.getProjectionData({overscaledTileID:new l.a3(0,0,0,0,0),applyGlobeMatrix:t});return o.tileMercatorCoords=[0,0,1,1],o}getFastPathSimpleProjectionMatrix(t){}}class Us{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,o,h){this._helper.interpolatePadding(t,o,h)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,o,h=!0){this._helper.resize(t,o,h)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,o){this._helper.overrideNearFarZ(t,o)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,o){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=o,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(o,h)=>this.currentTransform.defaultConstrain(o,h),this.applyConstrain=(o,h)=>this._helper.applyConstrain(o,h),this._helper=new Oo({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(o,h)=>this.defaultConstrain(o,h)},t),this._globeness=1,this._mercatorTransform=new Bo,this._verticalPerspectiveTransform=new Vo}clone(){let t=new Us;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,o){this._helper.apply(t,o),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let o=this._mercatorTransform.getProjectionData(t),h=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?h.mainMatrix:o.mainMatrix,clippingPlane:h.clippingPlane,tileMercatorCoords:h.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:o.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return l.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return l.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,o,h){let p=this._mercatorTransform.getPitchedTextCorrection(t,o,h),v=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,o,h);return l.bt(p,v,this._globeness)}projectTileCoordinates(t,o,h,p){return this.currentTransform.projectTileCoordinates(t,o,h,p)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,o){return this.currentTransform.lngLatToCameraDepth(t,o)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,o,h,p){return this._helper.calculateCenterFromCameraLngLatAlt(t,o,h,p)}setLocationAtPoint(t,o){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,o),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,o),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,o){return this.currentTransform.locationToScreenPoint(t,o)}screenPointToMercatorCoordinate(t,o){return this.currentTransform.screenPointToMercatorCoordinate(t,o)}screenPointToLocation(t,o){return this.currentTransform.screenPointToLocation(t,o)}isPointOnMapSurface(t,o){return this.currentTransform.isPointOnMapSurface(t,o)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,o){return this.currentTransform.getMatrixForModel(t,o)}getProjectionDataForCustomLayer(t=!0){let o=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return o;let h=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return h.fallbackMatrix=o.mainMatrix,h}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class yr{get useGlobeControls(){return!0}handlePanInertia(t,o){let h=Uo(t,o);return Math.abs(h.lng-o.center.lng)>180&&(h.lng=o.center.lng+179.5*Math.sign(h.lng-o.center.lng)),{easingCenter:h,easingOffset:new l.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,o){let h=t.around,p=o.screenPointToLocation(h);t.bearingDelta&&o.setBearing(o.bearing+t.bearingDelta),t.pitchDelta&&o.setPitch(o.pitch+t.pitchDelta),t.rollDelta&&o.setRoll(o.roll+t.rollDelta);let v=o.zoom;t.zoomDelta&&o.setZoom(o.zoom+t.zoomDelta);let T=o.zoom-v;if(T===0)return;let M=l.bJ(o.center.lng,p.lng),C=M/(Math.abs(M/180)+1),z=l.bJ(o.center.lat,p.lat),P=o.getRayDirectionFromPixel(h),k=o.cameraPosition,L=-1*l.b3(k,P),N=l.bz();l.a_(N,k,[P[0]*L,P[1]*L,P[2]*L]);let G=l.b5(N)-1,$=Math.exp(.5*-Math.max(G-.3,0)),J=_r(o.worldSize,o.center.lat)/Math.min(o.width,o.height),W=l.bw(J,.9,.5,1,.25),ee=(1-l.ao(-T))*Math.min($,W),ae=o.center.lat,te=o.zoom,Q=new l.W(o.center.lng+C*ee,l.al(o.center.lat+z*ee,-l.am,l.am));o.setLocationAtPoint(p,h);let re=o.center,ie=l.bw(Math.abs(M),45,85,0,1),me=l.bw(J,.75,.35,0,1),Te=Math.pow(Math.max(ie,me),.25),Se=l.bJ(re.lng,Q.lng),Ie=l.bJ(re.lat,Q.lat);o.setCenter(new l.W(re.lng+Se*Te,re.lat+Ie*Te).wrap()),o.setZoom(te+Qi(ae,o.center.lat))}handleMapControlsPan(t,o,h){if(!t.panDelta)return;let p=o.center.lat,v=o.zoom;o.setCenter(Uo(t.panDelta,o).wrap()),o.setZoom(v+Qi(p,o.center.lat))}cameraForBoxAndBearing(t,o,h,p,v){let T=yd(t,o,h,p,v),M=o.left/v.width*2-1,C=(v.width-o.right)/v.width*2-1,z=o.top/v.height*-2+1,P=(v.height-o.bottom)/v.height*-2+1,k=l.bJ(h.getWest(),h.getEast())<0,L=k?h.getEast():h.getWest(),N=k?h.getWest():h.getEast(),G=Math.max(h.getNorth(),h.getSouth()),$=Math.min(h.getNorth(),h.getSouth()),J=L+.5*l.bJ(L,N),W=G+.5*l.bJ(G,$),ee=v.clone();ee.setCenter(T.center),ee.setBearing(T.bearing),ee.setPitch(0),ee.setRoll(0),ee.setZoom(T.zoom);let ae=ee.modelViewProjectionMatrix,te=[ln(h.getNorthWest()),ln(h.getNorthEast()),ln(h.getSouthWest()),ln(h.getSouthEast()),ln(new l.W(N,W)),ln(new l.W(L,W)),ln(new l.W(J,G)),ln(new l.W(J,$))],Q=ln(T.center),re=Number.POSITIVE_INFINITY;for(let ie of te)M<0&&(re=yr.getLesserNonNegativeNonNull(re,yr.solveVectorScale(ie,Q,ae,"x",M))),C>0&&(re=yr.getLesserNonNegativeNonNull(re,yr.solveVectorScale(ie,Q,ae,"x",C))),z>0&&(re=yr.getLesserNonNegativeNonNull(re,yr.solveVectorScale(ie,Q,ae,"y",z))),P<0&&(re=yr.getLesserNonNegativeNonNull(re,yr.solveVectorScale(ie,Q,ae,"y",P)));if(Number.isFinite(re)&&re!==0)return T.zoom=Math.min(ee.zoom+l.ar(re),t.maxZoom),T;Ia()}handleJumpToCenterZoom(t,o){let h=t.center.lat,p=t.applyConstrain(o.center?l.W.convert(o.center):t.center,t.zoom).center;t.setCenter(p.wrap());let v=o.zoom!==void 0?+o.zoom:t.zoom+Qi(h,p.lat);t.zoom!==v&&t.setZoom(v)}handleEaseTo(t,o){let h=t.zoom,p=t.center,v=t.padding,T={roll:t.roll,pitch:t.pitch,bearing:t.bearing},M={roll:o.roll===void 0?t.roll:o.roll,pitch:o.pitch===void 0?t.pitch:o.pitch,bearing:o.bearing===void 0?t.bearing:o.bearing},C=o.zoom!==void 0,z=!t.isPaddingEqual(o.padding),P=!1,k=o.center?l.W.convert(o.center):p,L=t.applyConstrain(k,h).center;ro(t,L);let N=t.clone();N.setCenter(L),N.setZoom(C?+o.zoom:h+Qi(p.lat,k.lat)),N.setBearing(o.bearing);let G=new l.P(l.al(t.centerPoint.x+o.offsetAsPoint.x,0,t.width),l.al(t.centerPoint.y+o.offsetAsPoint.y,0,t.height));N.setLocationAtPoint(L,G);let $=(o.offset&&o.offsetAsPoint.mag())>0?N.center:L,J=C?+o.zoom:h+Qi(p.lat,$.lat),W=h+Qi(p.lat,0),ee=J+Qi($.lat,0),ae=l.bJ(p.lng,$.lng),te=l.bJ(p.lat,$.lat),Q=l.ao(ee-W);return P=J!==h,{easeFunc:re=>{if(l.bn(T,M)||Xf({startEulerAngles:T,endEulerAngles:M,tr:t,k:re,useSlerp:T.roll!=M.roll}),z&&t.interpolatePadding(v,o.padding,re),o.around)l.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(o.around,o.aroundPoint);else{let ie=ee>W?Math.min(2,Q):Math.max(.5,Q),me=Math.pow(ie,1-re),Te=Qf(p,ae,te,re*me);t.setCenter(Te.wrap())}if(P){let ie=l.H.number(W,ee,re)+Qi(0,t.center.lat);t.setZoom(ie)}},isZooming:P,elevationCenter:$}}handleFlyTo(t,o){let h=o.zoom!==void 0,p=t.center,v=t.zoom,T=t.padding,M=!t.isPaddingEqual(o.padding),C=t.applyConstrain(l.W.convert(o.center||o.locationAtOffset),v).center,z=h?+o.zoom:t.zoom+Qi(t.center.lat,C.lat),P=t.clone();P.setCenter(C),P.setZoom(z),P.setBearing(o.bearing);let k=new l.P(l.al(t.centerPoint.x+o.offsetAsPoint.x,0,t.width),l.al(t.centerPoint.y+o.offsetAsPoint.y,0,t.height));P.setLocationAtPoint(C,k);let L=P.center;ro(t,L);let N=(function(te,Q,re){let ie=ln(Q),me=ln(re),Te=l.b3(ie,me),Se=Math.acos(Te),Ie=Kf(te);return Se/(2*Math.PI)*Ie})(t,p,L),G=v+Qi(p.lat,0),$=z+Qi(L.lat,0),J=l.ao($-G),W;if(typeof o.minZoom=="number"){let te=+o.minZoom+Qi(L.lat,0),Q=Math.min(te,G,$)+Qi(0,L.lat),re=t.applyConstrain(L,Q).zoom+Qi(L.lat,0);W=l.ao(re-G)}let ee=l.bJ(p.lng,L.lng),ae=l.bJ(p.lat,L.lat);return{easeFunc:(te,Q,re,ie)=>{let me=Qf(p,ee,ae,re);M&&t.interpolatePadding(T,o.padding,te);let Te=te===1?L:me;t.setCenter(Te.wrap());let Se=G+l.ar(Q);t.setZoom(te===1?z:Se+Qi(0,Te.lat))},scaleOfZoom:J,targetCenter:L,scaleOfMinZoom:W,pixelPathLength:N}}static solveVectorScale(t,o,h,p,v){let T=p==="x"?[h[0],h[4],h[8],h[12]]:[h[1],h[5],h[9],h[13]],M=[h[3],h[7],h[11],h[15]],C=t[0]*T[0]+t[1]*T[1]+t[2]*T[2],z=t[0]*M[0]+t[1]*M[1]+t[2]*M[2],P=o[0]*T[0]+o[1]*T[1]+o[2]*T[2],k=o[0]*M[0]+o[1]*M[1]+o[2]*M[2];return P+v*z===C+v*k||M[3]*(C-P)+T[3]*(k-z)+C*k==P*z?null:(P+T[3]-v*k-v*M[3])/(P-C-v*k+v*z)}static getLesserNonNegativeNonNull(t,o){return o!==null&&o>=0&&o<t?o:t}}class Xr{constructor(t){this._globe=t,this._mercatorCameraHelper=new Fo,this._verticalPerspectiveCameraHelper=new yr}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,o){return this.currentHelper.handlePanInertia(t,o)}handleMapControlsRollPitchBearingZoom(t,o){this.currentHelper.handleMapControlsRollPitchBearingZoom(t,o)}handleMapControlsPan(t,o,h){this.currentHelper.handleMapControlsPan(t,o,h)}cameraForBoxAndBearing(t,o,h,p,v){return this.currentHelper.cameraForBoxAndBearing(t,o,h,p,v)}handleJumpToCenterZoom(t,o){this.currentHelper.handleJumpToCenterZoom(t,o)}handleEaseTo(t,o){return this.currentHelper.handleEaseTo(t,o)}handleFlyTo(t,o){return this.currentHelper.handleFlyTo(t,o)}}let ou=(g,t)=>l.C(g,t?.filter((o=>o.identifier!=="source.canvas"))),wd=l.bN();class jo extends l.E{constructor(t,o={}){var h,p;super(),this._rtlPluginLoaded=()=>{for(let T in this.tileManagers){let M=this.tileManagers[T].getSource().type;M!=="vector"&&M!=="geojson"||this.tileManagers[T].reload()}},this.map=t,this.dispatcher=new ot(Gn(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((T,M)=>this.getGlyphs(T,M))),this.dispatcher.registerMessageHandler("GI",((T,M)=>this.getImages(T,M))),this.dispatcher.registerMessageHandler("GDA",((T,M)=>this.getDashes(T,M))),this.imageManager=new Le,this.imageManager.setEventedParent(this);let v=((h=t._container)===null||h===void 0?void 0:h.lang)||typeof document<"u"&&((p=document.documentElement)===null||p===void 0?void 0:p.lang)||void 0;this.glyphManager=new De(t._requestManager,o.localIdeographFontFamily,v),this.lineAtlas=new Ke(256,512),this.crossTileSymbolIndex=new lr,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",l.bO()),Gr().on(zo,this._rtlPluginLoaded),this.on("data",(T=>{if(T.dataType!=="source"||T.sourceDataType!=="metadata")return;let M=this.tileManagers[T.sourceId];if(!M)return;let C=M.getSource();if(C?.vectorLayerIds)for(let z in this._layers){let P=this._layers[z];P.source===C.id&&this._validateLayer(P)}}))}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new l.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new(((t=this.crossTileSymbolIndex)===null||t===void 0?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,o){var h,p,v;this._checkLoaded();let T=o===null?(v=(p=(h=this.stylesheet.state)===null||h===void 0?void 0:h[t])===null||p===void 0?void 0:p.default)!==null&&v!==void 0?v:null:o;if(l.bQ(T,this._globalState[t]))return this;this._globalState[t]=T,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let o=[];for(let h in t)!l.bQ(this._globalState[h],t[h].default)&&(o.push(h),this._globalState[h]=t[h].default);this._applyGlobalStateChanges(o)}_applyGlobalStateChanges(t){if(t.length===0)return;let o=new Set,h={};for(let p of t){h[p]=this._globalState[p];for(let v in this._layers){let T=this._layers[v],M=T.getLayoutAffectingGlobalStateRefs(),C=T.getPaintAffectingGlobalStateRefs(),z=T.getVisibilityAffectingGlobalStateRefs();if(M.has(p)&&o.add(T.source),C.has(p))for(let{name:P,value:k}of C.get(p))this._updatePaintProperty(T,P,k);z?.has(p)&&(T.recalculateVisibility(),this._updateLayer(T))}}this.dispatcher.broadcast("UGS",h);for(let p in this.tileManagers)o.has(p)&&(this._reloadSource(p),this._changed=!0)}loadURL(t){return l._(this,arguments,void 0,(function*(o,h={},p){this.fire(new l.n("dataloading",{dataType:"style"})),h.validate=typeof h.validate!="boolean"||h.validate,this._loadStyleRequest=new AbortController;let v=this._loadStyleRequest;try{let T=yield this.map._requestManager.transformRequest(o,"Style");l.bR(v.signal);let M=yield l.k(T,v);this._loadStyleRequest===v&&(this._loadStyleRequest=null),this._load(M.data,h,p)}catch(T){this._loadStyleRequest===v&&(this._loadStyleRequest=null),T&&!v.signal.aborted&&this.fire(new l.l(l.d(T)))}}))}loadJSON(t,o={},h){this.fire(new l.n("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,pe.frameAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,o.validate=o.validate!==!1,this._load(t,o,h)})).catch((()=>{}))}loadEmpty(){this.fire(new l.n("dataloading",{dataType:"style"})),this._load(wd,{validate:!1})}_load(t,o,h){var p,v;let T=o.transformStyle?o.transformStyle(h,t):t;if(!o.validate||!ou(this,l.F(T))){T=Object.assign({},T),this._loaded=!0,this.stylesheet=T;for(let M in T.sources)this.addSource(M,T.sources[M],{validate:!1});T.sprite?this._loadSprite(T.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(T.glyphs),this._createLayers(),this.light=new Be(this.stylesheet.light),this._setProjectionInternal(((p=this.stylesheet.projection)===null||p===void 0?void 0:p.type)||"mercator"),this.sky=new We(this.stylesheet.sky),this.map.setTerrain((v=this.stylesheet.terrain)!==null&&v!==void 0?v:null),this.fire(new l.n("data",{dataType:"style"})),this.fire(new l.n("style.load"))}}_createLayers(){var t,o,h;let p=l.bS(this.stylesheet.layers);this.setGlobalState((t=this.stylesheet.state)!==null&&t!==void 0?t:null),this.dispatcher.broadcast("SL",p),this._order=p.map((v=>v.id)),this._layers={},this._serializedLayers=null;for(let v of p){let T=l.bT(v,this._globalState);if(T.setEventedParent(this,{layer:{id:v.id}}),this._layers[v.id]=T,l.bU(T)&&this.tileManagers[T.source]){let M=(h=(o=v.paint)===null||o===void 0?void 0:o["raster-fade-duration"])!==null&&h!==void 0?h:T.paint.get("raster-fade-duration");this.tileManagers[T.source].setRasterFadeDuration(M)}}}_loadSprite(t,o=!1,h=void 0){this.imageManager.setLoaded(!1);let p=new AbortController,v;this._spriteRequest=p,(function(T,M,C,z){return l._(this,void 0,void 0,(function*(){let P=se(T),k=C>1?"@2x":"",L={},N={};for(let{id:G,url:$}of P){let J=yield M.transformRequest(de($,k,".json"),"SpriteJSON");L[G]=l.k(J,z);let W=yield M.transformRequest(de($,k,".png"),"SpriteImage");N[G]=Ue.getImage(W,z)}return yield Promise.all([...Object.values(L),...Object.values(N)]),(function(G,$){return l._(this,void 0,void 0,(function*(){let J={};for(let W in G){J[W]={};let ee=pe.getImageCanvasContext((yield $[W]).data),ae=(yield G[W]).data;for(let te in ae){let{width:Q,height:re,x:ie,y:me,sdf:Te,pixelRatio:Se,stretchX:Ie,stretchY:Pe,content:Qe,textFitWidth:qe,textFitHeight:Ae}=ae[te];J[W][te]={data:null,pixelRatio:Se,sdf:Te,stretchX:Ie,stretchY:Pe,content:Qe,textFitWidth:qe,textFitHeight:Ae,spriteData:{width:Q,height:re,x:ie,y:me,context:ee}}}}return J}))})(L,N)}))})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((T=>{if(this._spriteRequest=null,T)for(let M in T){this._spritesImagesIds[M]=[];let C=this._spritesImagesIds[M]?this._spritesImagesIds[M].filter((z=>!(z in T))):[];for(let z of C)this.imageManager.removeImage(z),this._changedImages[z]=!0;for(let z in T[M]){let P=M==="default"?z:`${M}:${z}`;this._spritesImagesIds[M].push(P),P in this.imageManager.images?this.imageManager.updateImage(P,T[M][z],!1):this.imageManager.addImage(P,T[M][z]),o&&(this._changedImages[P]=!0)}}})).catch((T=>{this._spriteRequest=null,v=T,p.signal.aborted||this.fire(new l.l(v))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),o&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.n("data",{dataType:"style"})),h&&h(v)}))}_unloadSprite(){for(let t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.n("data",{dataType:"style"}))}_validateLayer(t){let o=this.tileManagers[t.source];if(!o)return;let h=t.sourceLayer;if(!h)return;let p=o.getSource();(p.type==="geojson"||p.vectorLayerIds&&!p.vectorLayerIds.includes(h))&&this.fire(new l.l(new Error(`Source layer "${h}" does not exist on source "${p.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(t,o=!1){let h=this._serializedAllLayers();if(!t||t.length===0)return Object.values(o?l.bV(h):h);let p=[];for(let v of t)if(h[v]){let T=o?l.bV(h[v]):h[v];p.push(T)}return p}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};let o=Object.keys(this._layers);for(let h of o){let p=this._layers[h];p.type!=="custom"&&(t[h]=p.serialize())}return t}hasTransitions(){var t,o,h;if(!((t=this.light)===null||t===void 0)&&t.hasTransition()||!((o=this.sky)===null||o===void 0)&&o.hasTransition()||!((h=this.projection)===null||h===void 0)&&h.hasTransition())return!0;for(let p in this.tileManagers)if(this.tileManagers[p].hasTransition())return!0;for(let p in this._layers)if(this._layers[p].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;let o=this._changed;if(o){let p=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(p.length||v.length)&&this._updateWorkerLayers(p,v);for(let T in this._updatedSources){let M=this._updatedSources[T];if(M==="reload")this._reloadSource(T);else{if(M!=="clear")throw new Error(`Invalid action ${M}`);this._clearSource(T)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let T in this._updatedPaintProps)this._layers[T].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}let h={};for(let p in this.tileManagers){let v=this.tileManagers[p];h[p]=v.used,v.used=!1}for(let p of this._order){let v=this._layers[p];v.recalculate(t,this._availableImages),!v.isHidden(t.zoom)&&v.source&&(this.tileManagers[v.source].used=!0)}for(let p in h){let v=this.tileManagers[p];!!h[p]!=!!v.used&&v.fire(new l.n("data",{sourceDataType:"visibility",dataType:"source",sourceId:p}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,o&&this.fire(new l.n("data",{dataType:"style"}))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let o in this.tileManagers)this.tileManagers[o].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,o){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:o})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,o={}){var h;this._checkLoaded();let p=this.serialize();if(t=o.transformStyle?o.transformStyle(p,t):t,((h=o.validate)===null||h===void 0||h)&&ou(this,l.F(t)))return!1;(t=l.bV(t)).layers=l.bS(t.layers);let v=l.bW(p,t),T=this._getOperationsToPerform(v);if(T.unimplemented.length>0)throw new Error(`Unimplemented: ${T.unimplemented.join(", ")}.`);if(T.operations.length===0)return!1;for(let M of T.operations)M();return this.stylesheet=t,this._serializedLayers=null,this.fire(new l.n("style.load",{style:this})),!0}_getOperationsToPerform(t){let o=[],h=[];for(let p of t)switch(p.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":o.push((()=>this.addLayer.apply(this,p.args)));break;case"removeLayer":o.push((()=>this.removeLayer.apply(this,p.args)));break;case"setPaintProperty":o.push((()=>this.setPaintProperty.apply(this,p.args)));break;case"setLayoutProperty":o.push((()=>this.setLayoutProperty.apply(this,p.args)));break;case"setFilter":o.push((()=>this.setFilter.apply(this,p.args)));break;case"addSource":o.push((()=>this.addSource.apply(this,p.args)));break;case"removeSource":o.push((()=>this.removeSource.apply(this,p.args)));break;case"setLayerZoomRange":o.push((()=>this.setLayerZoomRange.apply(this,p.args)));break;case"setLight":o.push((()=>this.setLight.apply(this,p.args)));break;case"setGeoJSONSourceData":o.push((()=>this.setGeoJSONSourceData.apply(this,p.args)));break;case"setGlyphs":o.push((()=>this.setGlyphs.apply(this,p.args)));break;case"setSprite":o.push((()=>this.setSprite.apply(this,p.args)));break;case"setTerrain":o.push((()=>this.map.setTerrain.apply(this,p.args)));break;case"setSky":o.push((()=>this.setSky.apply(this,p.args)));break;case"setProjection":this.setProjection.apply(this,p.args);break;case"setGlobalState":o.push((()=>this.setGlobalState.apply(this,p.args)));break;case"setTransition":o.push((()=>{}));break;default:h.push(p.command)}return{operations:o,unimplemented:h}}addImage(t,o){if(this.getImage(t))return this.fire(new l.l(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,o),this._afterImageUpdated(t)}updateImage(t,o){this.imageManager.updateImage(t,o)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new l.l(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.n("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,o,h={}){var p;if(this._checkLoaded(),this.tileManagers[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(o.type)&&this._validate(l.F.source,`sources.${t}`,o,null,h))return;!((p=this.map)===null||p===void 0)&&p._collectResourceTiming&&(o.collectResourceTiming=!0);let v=this.tileManagers[t]=new wn(t,o,this.dispatcher);v.style=this,v.setEventedParent(this,(()=>({isSourceLoaded:v.loaded(),source:v.serialize(),sourceId:t}))),v.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);for(let h in this._layers)if(this._layers[h].source===t)return this.fire(new l.l(new Error(`Source "${t}" cannot be removed while layer "${h}" is using it.`)));let o=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],o.fire(new l.n("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),o.setEventedParent(null),o.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,o){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);let h=this.tileManagers[t].getSource();if(h.type!=="geojson")throw new Error(`geojsonSource.type is ${h.type}, which is !== 'geojson`);h.setData(o),this._changed=!0}getSource(t){var o;return(o=this.tileManagers[t])===null||o===void 0?void 0:o.getSource()}addLayer(t,o,h={}){this._checkLoaded();let p=t.id;if(this.getLayer(p))return void this.fire(new l.l(new Error(`Layer "${p}" already exists on this map.`)));let v;if(t.type==="custom"){if(ou(this,l.bX(t)))return;v=l.bT(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(p,t.source),t=l.bV(t),t=l.e(t,{source:p})),this._validate(l.F.layer,`layers.${p}`,t,{arrayIndex:-1},h))return;v=l.bT(t,this._globalState),this._validateLayer(v),v.setEventedParent(this,{layer:{id:p}})}let T=o?this._order.indexOf(o):this._order.length;if(o&&T===-1)this.fire(new l.l(new Error(`Cannot add layer "${p}" before non-existing layer "${o}".`)));else{if(this._order.splice(T,0,p),this._layerOrderChanged=!0,this._layers[p]=v,this._removedLayers[p]&&v.source&&v.type!=="custom"){let M=this._removedLayers[p];delete this._removedLayers[p],M.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.tileManagers[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(t,o){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new l.l(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===o)return;let h=this._order.indexOf(t);this._order.splice(h,1);let p=o?this._order.indexOf(o):this._order.length;o&&p===-1?this.fire(new l.l(new Error(`Cannot move layer "${t}" before non-existing layer "${o}".`))):(this._order.splice(p,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();let o=this._layers[t];if(!o)return void this.fire(new l.l(new Error(`Cannot remove non-existing layer "${t}".`)));o.setEventedParent(null);let h=this._order.indexOf(t);this._order.splice(h,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=o,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],o.onRemove&&o.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,o,h){this._checkLoaded();let p=this.getLayer(t);p?p.minzoom===o&&p.maxzoom===h||(o!=null&&(p.minzoom=o),h!=null&&(p.maxzoom=h),this._updateLayer(p)):this.fire(new l.l(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,o,h={}){this._checkLoaded();let p=this.getLayer(t);if(p){if(!l.bQ(p.filter,o))return o==null?(p.setFilter(void 0),void this._updateLayer(p)):void(this._validate(l.F.filter,`layers.${p.id}.filter`,o,null,h)||(p.setFilter(l.bV(o)),this._updateLayer(p)))}else this.fire(new l.l(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return l.bV(this.getLayer(t).filter)}setLayoutProperty(t,o,h,p={}){this._checkLoaded();let v=this.getLayer(t);v?l.bQ(v.getLayoutProperty(o),h)||(v.setLayoutProperty(o,h,p),this._updateLayer(v)):this.fire(new l.l(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,o){let h=this.getLayer(t);if(h)return h.getLayoutProperty(o);this.fire(new l.l(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,o,h,p={}){this._checkLoaded();let v=this.getLayer(t);v?l.bQ(v.getPaintProperty(o),h)||this._updatePaintProperty(v,o,h,p):this.fire(new l.l(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,o,h,p={}){t.setPaintProperty(o,h,p)&&this._updateLayer(t),l.bU(t)&&o==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(h),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,o){return this.getLayer(t).getPaintProperty(o)}setFeatureState(t,o){this._checkLoaded();let h=t.source,p=t.sourceLayer,v=this.tileManagers[h];if(v===void 0)return void this.fire(new l.l(new Error(`The source '${h}' does not exist in the map's style.`)));let T=v.getSource().type;T==="geojson"&&p?this.fire(new l.l(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):T!=="vector"||p?(t.id===void 0&&this.fire(new l.l(new Error("The feature id parameter must be provided."))),v.setFeatureState(p,t.id,o)):this.fire(new l.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,o){this._checkLoaded();let h=t.source,p=this.tileManagers[h];if(p===void 0)return void this.fire(new l.l(new Error(`The source '${h}' does not exist in the map's style.`)));let v=p.getSource().type,T=v==="vector"?t.sourceLayer:void 0;v!=="vector"||T?o&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new l.l(new Error("A feature id is required to remove its specific state property."))):p.removeFeatureState(T,t.id,o):this.fire(new l.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();let o=t.source,h=t.sourceLayer,p=this.tileManagers[o];if(p!==void 0)return p.getSource().type!=="vector"||h?(t.id===void 0&&this.fire(new l.l(new Error("The feature id parameter must be provided."))),p.getFeatureState(h,t.id)):void this.fire(new l.l(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.l(new Error(`The source '${o}' does not exist in the map's style.`)))}getTransition(){var t;return l.e({duration:300,delay:0},(t=this.stylesheet)===null||t===void 0?void 0:t.transition)}serialize(){if(!this._loaded)return;let t=l.bY(this.tileManagers,(v=>v.serialize())),o=this._serializeByIds(this._order,!0),h=this.map.getTerrain()||void 0,p=this.stylesheet;return l.bZ({version:p.version,name:p.name,metadata:p.metadata,light:p.light,sky:p.sky,center:p.center,zoom:p.zoom,bearing:p.bearing,pitch:p.pitch,sprite:p.sprite,glyphs:p.glyphs,transition:p.transition,projection:p.projection,sources:t,layers:o,terrain:h},(v=>v!==void 0))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.tileManagers[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let o=T=>this._layers[T].type==="fill-extrusion",h={},p=[];for(let T=this._order.length-1;T>=0;T--){let M=this._order[T];if(o(M)){h[M]=T;for(let C of t){let z=C[M];if(z)for(let P of z)p.push(P)}}}p.sort(((T,M)=>M.intersectionZ-T.intersectionZ));let v=[];for(let T=this._order.length-1;T>=0;T--){let M=this._order[T];if(o(M))for(let C=p.length-1;C>=0;C--){let z=p[C].feature;if(h[z.layer.id]<T)break;v.push(z),p.pop()}else for(let C of t){let z=C[M];if(z)for(let P of z)v.push(P.feature)}}return v}queryRenderedFeatures(t,o,h){o?.filter&&this._validate(l.F.filter,"queryRenderedFeatures.filter",o.filter,null,o);let p={};if(o?.layers){if(!(Array.isArray(o.layers)||o.layers instanceof Set))return this.fire(new l.l(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(let z of o.layers){let P=this._layers[z];if(!P)return this.fire(new l.l(new Error(`The layer '${z}' does not exist in the map's style and cannot be queried for features.`))),[];p[P.source]=!0}}let v=[];o.availableImages=this._availableImages;let T=this._serializedAllLayers(),M=o.layers instanceof Set?o.layers:Array.isArray(o.layers)?new Set(o.layers):null,C=Object.assign(Object.assign({},o),{layers:M,globalState:this._globalState});for(let z in this.tileManagers)o.layers&&!p[z]||v.push(pi(this.tileManagers[z],this._layers,T,t,C,h,this.map.terrain?(P,k,L)=>this.map.terrain.getElevation(P,k,L):void 0));return this.placement&&v.push((function(z,P,k,L,N,G,$){let J={},W=G.queryRenderedSymbols(L),ee=[];for(let ae of Object.keys(W).map(Number))ee.push($[ae]);ee.sort(sn);for(let ae of ee){let te=ae.featureIndex.lookupSymbolFeatures(W[ae.bucketInstanceId],P,ae.bucketIndex,ae.sourceLayerIndex,{filterSpec:N.filter,globalState:N.globalState},N.layers,N.availableImages,z);for(let Q in te){J[Q]||(J[Q]=[]);let re=te[Q];re.sort(((ie,me)=>{let Te=ae.featureSortOrder;if(Te){let Se=Te.indexOf(ie.featureIndex);return Te.indexOf(me.featureIndex)-Se}return me.featureIndex-ie.featureIndex}));for(let ie of re)J[Q].push(ie)}}return(function(ae,te,Q){for(let re in ae)for(let ie of ae[re])li(ie,Q[te[re].source]);return ae})(J,z,k)})(this._layers,T,this.tileManagers,t,C,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(t,o){o?.filter&&this._validate(l.F.filter,"querySourceFeatures.filter",o.filter,null,o);let h=this.tileManagers[t];return h?(function(p,v){let T=p.getRenderableIds().map((z=>p.getTileByID(z))),M=[],C={};for(let z of T){let P=z.tileID.canonical.key;C[P]||(C[P]=!0,z.querySourceFeatures(M,v))}return M})(h,o?Object.assign(Object.assign({},o),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,o={}){this._checkLoaded();let h=this.light.getLight(),p=!1;for(let T in t)if(!l.bQ(t[T],h[T])){p=!0;break}if(!p)return;let v={now:le(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,o),this.light.updateTransitions(v)}getProjection(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.projection}setProjection(t){this._checkLoaded();let o=t??{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===o.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(o.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,o={}){this._checkLoaded();let h=this.getSky(),p=!1;if(!t&&!h)return;if(t&&!h)p=!0;else if(!t&&h)p=!0;else for(let T in t)if(!l.bQ(t[T],h[T])){p=!0;break}if(!p)return;let v={now:le(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,o),this.sky.updateTransitions(v)}_setProjectionInternal(t){let o=(function(h,p){let v={constrainOverride:p};if(Array.isArray(h)){let T=new Wf({type:h});return{projection:T,transform:new Us(v),cameraHelper:new Xr(T)}}switch(h){case"mercator":return{projection:new Xn,transform:new Bo(v),cameraHelper:new Fo};case"globe":{let T=new Wf({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:T,transform:new Us(v),cameraHelper:new Xr(T)}}case"vertical-perspective":return{projection:new iu,transform:new Vo(v),cameraHelper:new yr};default:return l.w(`Unknown projection name: ${h}. Falling back to mercator projection.`),{projection:new Xn,transform:new Bo(v),cameraHelper:new Fo}}})(t,this.map.transformConstrain);this.projection=o.projection,this.map.migrateProjection(o.transform,o.cameraHelper);for(let h in this.tileManagers)this.tileManagers[h].reload()}_validate(t,o,h,p,v={}){return v?.validate!==!1&&ou(this,t.call(l.F,l.e({key:o,style:this.serialize(),value:h,styleSpec:l.x},p)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Gr().off(zo,this._rtlPluginLoaded);for(let o in this._layers)this._layers[o].setEventedParent(null);for(let o in this.tileManagers){let h=this.tileManagers[o];h.setEventedParent(null),h.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(let o in this.tileManagers)this.tileManagers[o].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,o,h,p,v=!1){let T=!1,M=!1,C={};for(let z of this._order){let P=this._layers[z];if(P.type!=="symbol")continue;if(!C[P.source]){let L=this.tileManagers[P.source];C[P.source]=L.getRenderableIds(!0).map((N=>L.getTileByID(N))).sort(((N,G)=>G.tileID.overscaledZ-N.tileID.overscaledZ||(N.tileID.isLessThan(G.tileID)?-1:1)))}let k=this.crossTileSymbolIndex.addLayer(P,C[P.source],t.center.lng);T||(T=k)}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),v||(v=this._layerOrderChanged||h===0),(v||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(le(),t.zoom))&&(this.pauseablePlacement=new Is(t,this.map.terrain,this._order,v,o,h,p,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,C),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(le()),M=!0),T&&this.pauseablePlacement.placement.setStale()),M||T)for(let z of this._order){let P=this._layers[z];P.type==="symbol"&&this.placement.updateLayerOpacities(P,C[P.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(le())}_releaseSymbolFadeTiles(){for(let t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,o){return l._(this,void 0,void 0,(function*(){let h=yield this.imageManager.getImages(o.icons);this._updateTilesForChangedImages();let p=this.tileManagers[o.source];return p&&p.setDependencies(o.tileID.key,o.type,o.icons),h}))}getGlyphs(t,o){return l._(this,void 0,void 0,(function*(){let h=yield this.glyphManager.getGlyphs(o.stacks),p=this.tileManagers[o.source];return p&&p.setDependencies(o.tileID.key,o.type,[""]),h}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,o={}){this._checkLoaded(),t&&this._validate(l.F.glyphs,"glyphs",t,null,o)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,o){return l._(this,void 0,void 0,(function*(){let h={};for(let[p,v]of Object.entries(o.dashes))h[p]=this.lineAtlas.getDash(v.dasharray,v.round);return h}))}addSprite(t,o,h={},p){this._checkLoaded();let v=[{id:t,url:o}],T=[...se(this.stylesheet.sprite),...v];this._validate(l.F.sprite,"sprite",T,null,h)||(this.stylesheet.sprite=T,this._loadSprite(v,!0,p))}removeSprite(t){this._checkLoaded();let o=se(this.stylesheet.sprite);if(o.find((h=>h.id===t))){if(this._spritesImagesIds[t])for(let h of this._spritesImagesIds[t])this.imageManager.removeImage(h),this._changedImages[h]=!0;o.splice(o.findIndex((h=>h.id===t)),1),this.stylesheet.sprite=o.length>0?o:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.n("data",{dataType:"style"}))}else this.fire(new l.l(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return se(this.stylesheet.sprite)}setSprite(t,o={},h){this._checkLoaded(),t&&this._validate(l.F.sprite,"sprite",t,null,o)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,h):(this._unloadSprite(),h&&h(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(let t in this.tileManagers){let o=this.tileManagers[t];o.setEventedParent(null),o.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(let t in this._layers){let o=this._layers[t];o.setEventedParent(null),o.onRemove&&o.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var Hl=l.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class h1{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,o,h,p,v,T,M,C,z){this.context=t;let P=this.boundPaintVertexBuffers.length!==p.length;for(let k=0;!P&&k<p.length;k++)this.boundPaintVertexBuffers[k]!==p[k]&&(P=!0);!this.vao||this.boundProgram!==o||this.boundLayoutVertexBuffer!==h||P||this.boundIndexBuffer!==v||this.boundVertexOffset!==T||this.boundDynamicVertexBuffer!==M||this.boundDynamicVertexBuffer2!==C||this.boundDynamicVertexBuffer3!==z?this.freshBind(o,h,p,v,T,M,C,z):(t.bindVertexArray.set(this.vao),M&&M.bind(),v?.dynamicDraw&&v.bind(),C&&C.bind(),z&&z.bind())}freshBind(t,o,h,p,v,T,M,C){let z=t.numAttributes,P=this.context,k=P.gl;this.vao&&this.destroy(),this.vao=P.createVertexArray(),P.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=h,this.boundIndexBuffer=p,this.boundVertexOffset=v,this.boundDynamicVertexBuffer=T,this.boundDynamicVertexBuffer2=M,this.boundDynamicVertexBuffer3=C,o.enableAttributes(k,t);for(let L of h)L.enableAttributes(k,t);T&&T.enableAttributes(k,t),M&&M.enableAttributes(k,t),C&&C.enableAttributes(k,t),o.bind(),o.setVertexAttribPointers(k,t,v);for(let L of h)L.bind(),L.setVertexAttribPointers(k,t,v);T&&(T.bind(),T.setVertexAttribPointers(k,t,v)),p&&p.bind(),M&&(M.bind(),M.setVertexAttribPointers(k,t,v)),C&&(C.bind(),C.setVertexAttribPointers(k,t,v)),P.currentNumAttributes=z}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let su=(g,t,o,h,p)=>({u_texture:0,u_ele_delta:g,u_fog_matrix:t,u_fog_color:o?o.properties.get("fog-color"):l.bo.white,u_fog_ground_blend:o?o.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:p?0:o?o.calculateFogBlendOpacity(h):0,u_horizon_color:o?o.properties.get("horizon-color"):l.bo.white,u_horizon_fog_blend:o?o.properties.get("horizon-fog-blend"):1,u_is_globe_mode:p?1:0}),d1={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function ka(g){let t=[];for(let o of g){if(o===null)continue;let h=o.split(" ");t.push(h.pop())}return t}class p1{constructor(t,o,h,p,v,T,M,C,z=[]){let P=t.gl;this.program=P.createProgram();let k=ka(o.staticAttributes),L=h?h.getBinderAttributes():[],N=k.concat(L),G=yi.prelude.staticUniforms?ka(yi.prelude.staticUniforms):[],$=M.staticUniforms?ka(M.staticUniforms):[],J=o.staticUniforms?ka(o.staticUniforms):[],W=h?h.getBinderUniforms():[],ee=G.concat($).concat(J).concat(W),ae=[];for(let Se of ee)ae.includes(Se)||ae.push(Se);let te=h?h.defines():[];$r(P)&&te.unshift("#version 300 es"),v&&te.push("#define OVERDRAW_INSPECTOR;"),T&&te.push("#define TERRAIN3D;"),C&&te.push(C),z&&te.push(...z);let Q=te.concat(yi.prelude.fragmentSource,M.fragmentSource,o.fragmentSource).join(`
797
+ `),re=te.concat(yi.prelude.vertexSource,M.vertexSource,o.vertexSource).join(`
798
+ `);$r(P)||(Q=(function(Se){return Se.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(Q),re=(function(Se){return Se.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(re));let ie=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(ie,Q),P.compileShader(ie),!P.getShaderParameter(ie,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(ie)}`);P.attachShader(this.program,ie);let me=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(me,re),P.compileShader(me),!P.getShaderParameter(me,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(me)}`);P.attachShader(this.program,me),this.attributes={};let Te={};this.numAttributes=N.length;for(let Se=0;Se<this.numAttributes;Se++)N[Se]&&(P.bindAttribLocation(this.program,Se,N[Se]),this.attributes[N[Se]]=Se);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(me),P.deleteShader(ie);for(let Se of ae)if(Se&&!Te[Se]){let Ie=P.getUniformLocation(this.program,Se);Ie&&(Te[Se]=Ie)}this.fixedUniforms=p(t,Te),this.terrainUniforms=((Se,Ie)=>({u_depth:new l.b_(Se,Ie.u_depth),u_terrain:new l.b_(Se,Ie.u_terrain),u_terrain_dim:new l.bp(Se,Ie.u_terrain_dim),u_terrain_matrix:new l.c0(Se,Ie.u_terrain_matrix),u_terrain_unpack:new l.c1(Se,Ie.u_terrain_unpack),u_terrain_exaggeration:new l.bp(Se,Ie.u_terrain_exaggeration)}))(t,Te),this.projectionUniforms=((Se,Ie)=>({u_projection_matrix:new l.c0(Se,Ie.u_projection_matrix),u_projection_tile_mercator_coords:new l.c1(Se,Ie.u_projection_tile_mercator_coords),u_projection_clipping_plane:new l.c1(Se,Ie.u_projection_clipping_plane),u_projection_transition:new l.bp(Se,Ie.u_projection_transition),u_projection_fallback_matrix:new l.c0(Se,Ie.u_projection_fallback_matrix)}))(t,Te),this.binderUniforms=h?h.getUniforms(t,Te):[]}draw(t,o,h,p,v,T,M,C,z,P,k,L,N,G,$,J,W,ee,ae){var te;let Q=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(h),t.setStencilMode(p),t.setColorMode(v),t.setCullFace(T),C){t.activeTexture.set(Q.TEXTURE2),Q.bindTexture(Q.TEXTURE_2D,C.depthTexture),t.activeTexture.set(Q.TEXTURE3),Q.bindTexture(Q.TEXTURE_2D,C.texture);for(let ie in this.terrainUniforms)this.terrainUniforms[ie].set(C[ie])}if(z)for(let ie in z)this.projectionUniforms[d1[ie]].set(z[ie]);if(M)for(let ie in this.fixedUniforms)this.fixedUniforms[ie].set(M[ie]);J&&J.setUniforms(t,this.binderUniforms,G,{zoom:$});let re=0;switch(o){case Q.LINES:re=2;break;case Q.TRIANGLES:re=3;break;case Q.LINE_STRIP:re=1}for(let ie of N.get())ie.vaos||(ie.vaos={}),(te=ie.vaos)[P]||(te[P]=new h1),ie.vaos[P].bind(t,this,k,J?J.getPaintVertexBuffers():[],L,ie.vertexOffset,W,ee,ae),Q.drawElements(o,ie.primitiveLength*re,Q.UNSIGNED_SHORT,ie.primitiveOffset*re*2)}}function Td(g,t,o){let h=1/l.aK(o,1,t.transform.tileZoom),p=Math.pow(2,o.tileID.overscaledZ),v=o.tileSize*Math.pow(2,t.transform.tileZoom)/p,T=v*(o.tileID.canonical.x+o.tileID.wrap*p),M=v*o.tileID.canonical.y;return{u_image:0,u_texsize:o.imageAtlasTexture.size,u_scale:[h,g.fromScale,g.toScale],u_fade:g.t,u_pixel_coord_upper:[T>>16,M>>16],u_pixel_coord_lower:[65535&T,65535&M]}}let Jf=(g,t,o,h)=>{let p=g.style.light,v=p.properties.get("position"),T=[v.x,v.y,v.z],M=l.c4();p.properties.get("anchor")==="viewport"&&l.c5(M,g.transform.bearingInRadians),l.c6(T,T,M);let C=g.transform.transformLightDirection(T),z=p.properties.get("color");return{u_lightpos:T,u_lightpos_globe:C,u_lightintensity:p.properties.get("intensity"),u_lightcolor:[z.r,z.g,z.b],u_vertical_gradient:+t,u_opacity:o,u_fill_translate:h}},em=(g,t,o,h,p,v,T)=>l.e(Jf(g,t,o,h),Td(v,g,T),{u_height_factor:-Math.pow(2,p.overscaledZ)/T.tileSize/8}),lu=(g,t,o,h)=>l.e(Td(t,g,o),{u_fill_translate:h}),tm=(g,t)=>({u_world:g,u_fill_translate:t}),im=(g,t,o,h,p)=>l.e(lu(g,t,o,p),{u_world:h}),nm=(g,t,o,h,p)=>{let v=g.transform,T,M,C=0;if(o.paint.get("circle-pitch-alignment")==="map"){let z=l.aK(t,1,v.zoom);T=!0,M=[z,z],C=z/(l.a6*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*p}else T=!1,M=v.pixelsToGLUnits;return{u_camera_to_center_distance:v.cameraToCenterDistance,u_scale_with_map:+(o.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+T,u_device_pixel_ratio:g.pixelRatio,u_extrude_scale:M,u_globe_extrude_scale:C,u_translate:h}},rm=g=>({u_pixel_extrude_scale:[1/g.width,1/g.height]}),qo=g=>({u_viewport_size:[g.width,g.height]}),Sd=(g,t=1)=>({u_color:g,u_overlay:0,u_overlay_scale:t}),Md=(g,t,o,h)=>{let p=l.aK(g,1,t)/(l.a6*Math.pow(2,g.tileID.overscaledZ))*2*Math.PI*h;return{u_extrude_scale:l.aK(g,1,t),u_intensity:o,u_globe_extrude_scale:p}},Vs=(g,t,o,h)=>{let p=l.O();l.c7(p,0,g.width,g.height,0,0,1);let v=g.context.gl;return{u_matrix:p,u_world:[v.drawingBufferWidth,v.drawingBufferHeight],u_image:o,u_color_ramp:h,u_opacity:t.paint.get("heatmap-opacity")}},f1=(g,t,o)=>{let h=o.paint.get("hillshade-accent-color"),p;switch(o.paint.get("hillshade-method")){case"basic":p=4;break;case"combined":p=1;break;case"igor":p=2;break;case"multidirectional":p=3;break;default:p=0}let v=o.getIlluminationProperties();for(let T=0;T<v.directionRadians.length;T++)o.paint.get("hillshade-illumination-anchor")==="viewport"&&(v.directionRadians[T]+=g.transform.bearingInRadians);return{u_image:0,u_latrange:m1(0,t.tileID),u_exaggeration:o.paint.get("hillshade-exaggeration"),u_altitudes:v.altitudeRadians,u_azimuths:v.directionRadians,u_accent:h,u_method:p,u_highlights:v.highlightColor,u_shadows:v.shadowColor}},cu=(g,t)=>{let o=t.stride,h=l.O();return l.c7(h,0,l.a6,-l.a6,0,0,1),l.Q(h,h,[0,-l.a6,0]),{u_matrix:h,u_image:1,u_dimension:[o,o],u_zoom:g.overscaledZ,u_unpack:t.getUnpackVector()}};function m1(g,t){let o=Math.pow(2,t.canonical.z),h=t.canonical.y;return[new l.a7(0,h/o).toLngLat().lat,new l.a7(0,(h+1)/o).toLngLat().lat]}let g1=(g,t,o=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:o,u_opacity:g.paint.get("color-relief-opacity")}),$l=(g,t,o,h)=>{let p=g.transform;return{u_translation:fa(g,t,o),u_ratio:h/l.aK(t,1,p.zoom),u_device_pixel_ratio:g.pixelRatio,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},am=(g,t,o,h,p)=>l.e($l(g,t,o,h),{u_image:0,u_image_height:p}),om=(g,t,o,h,p)=>{let v=g.transform,T=js(t,v);return{u_translation:fa(g,t,o),u_texsize:t.imageAtlasTexture.size,u_ratio:h/l.aK(t,1,v.zoom),u_device_pixel_ratio:g.pixelRatio,u_image:0,u_scale:[T,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},Ed=(g,t,o,h,p)=>{let v=js(t,g.transform);return l.e($l(g,t,o,h),{u_tileratio:v,u_crossfade_from:p.fromScale,u_crossfade_to:p.toScale,u_image:0,u_mix:p.t,u_lineatlas_width:g.lineAtlas.width,u_lineatlas_height:g.lineAtlas.height})},sm=(g,t,o,h,p,v)=>{let T=js(t,g.transform);return l.e($l(g,t,o,h),{u_image:0,u_image_height:v,u_tileratio:T,u_crossfade_from:p.fromScale,u_crossfade_to:p.toScale,u_image_dash:1,u_mix:p.t,u_lineatlas_width:g.lineAtlas.width,u_lineatlas_height:g.lineAtlas.height})};function js(g,t){return 1/l.aK(g,1,t.tileZoom)}function fa(g,t,o){return l.aL(g.transform,t,o.paint.get("line-translate"),o.paint.get("line-translate-anchor"))}let Cd=(g,t,o,h,p)=>{return{u_tl_parent:g,u_scale_parent:t,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*h.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:h.paint.get("raster-brightness-min"),u_brightness_high:h.paint.get("raster-brightness-max"),u_saturation_factor:(T=h.paint.get("raster-saturation"),T>0?1-1/(1.001-T):-T),u_contrast_factor:(v=h.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:Ad(h.paint.get("raster-hue-rotate")),u_coords_top:[p[0].x,p[0].y,p[1].x,p[1].y],u_coords_bottom:[p[3].x,p[3].y,p[2].x,p[2].y]};var v,T};function Ad(g){g*=Math.PI/180;let t=Math.sin(g),o=Math.cos(g);return[(2*o+1)/3,(-Math.sqrt(3)*t-o+1)/3,(Math.sqrt(3)*t-o+1)/3]}let uu=(g,t,o,h,p,v,T,M,C,z,P,k,L)=>{let N=T.transform;return{u_is_size_zoom_constant:+(g==="constant"||g==="source"),u_is_size_feature_constant:+(g==="constant"||g==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:N.cameraToCenterDistance,u_pitch:N.pitch/360*2*Math.PI,u_rotate_symbol:+o,u_aspect_ratio:N.width/N.height,u_fade_change:T.options.fadeDuration?T.symbolFadeChange:1,u_label_plane_matrix:M,u_coord_matrix:C,u_is_text:+P,u_pitch_with_map:+h,u_is_along_line:p,u_is_variable_anchor:v,u_texsize:k,u_texture:0,u_translation:z,u_pitched_scale:L}},zd=(g,t,o,h,p,v,T,M,C,z,P,k,L,N)=>{let G=T.transform;return l.e(uu(g,t,o,h,p,v,T,M,C,z,P,k,N),{u_gamma_scale:h?Math.cos(G.pitch*Math.PI/180)*G.cameraToCenterDistance:1,u_device_pixel_ratio:T.pixelRatio,u_is_halo:L?1:0,u_is_plain:1})},Dd=(g,t,o,h,p,v,T,M,C,z,P,k,L)=>l.e(zd(g,t,o,h,p,v,T,M,C,z,!0,P,!0,L),{u_texsize_icon:k,u_texture_icon:1}),Go=(g,t)=>({u_opacity:g,u_color:t}),Pd=(g,t,o,h,p)=>l.e((function(v,T,M,C){let z=M.imageManager.getPattern(v.from.toString()),P=M.imageManager.getPattern(v.to.toString()),{width:k,height:L}=M.imageManager.getPixelSize(),N=Math.pow(2,C.tileID.overscaledZ),G=C.tileSize*Math.pow(2,M.transform.tileZoom)/N,$=G*(C.tileID.canonical.x+C.tileID.wrap*N),J=G*C.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:z.tl,u_pattern_br_a:z.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[k,L],u_mix:T.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/l.aK(C,1,M.transform.tileZoom),u_pixel_coord_upper:[$>>16,J>>16],u_pixel_coord_lower:[65535&$,65535&J]}})(o,p,t,h),{u_opacity:g}),lm=(g,t)=>{},_1={fillExtrusion:(g,t)=>({u_lightpos:new l.c2(g,t.u_lightpos),u_lightpos_globe:new l.c2(g,t.u_lightpos_globe),u_lightintensity:new l.bp(g,t.u_lightintensity),u_lightcolor:new l.c2(g,t.u_lightcolor),u_vertical_gradient:new l.bp(g,t.u_vertical_gradient),u_opacity:new l.bp(g,t.u_opacity),u_fill_translate:new l.c3(g,t.u_fill_translate)}),fillExtrusionPattern:(g,t)=>({u_lightpos:new l.c2(g,t.u_lightpos),u_lightpos_globe:new l.c2(g,t.u_lightpos_globe),u_lightintensity:new l.bp(g,t.u_lightintensity),u_lightcolor:new l.c2(g,t.u_lightcolor),u_vertical_gradient:new l.bp(g,t.u_vertical_gradient),u_height_factor:new l.bp(g,t.u_height_factor),u_opacity:new l.bp(g,t.u_opacity),u_fill_translate:new l.c3(g,t.u_fill_translate),u_image:new l.b_(g,t.u_image),u_texsize:new l.c3(g,t.u_texsize),u_pixel_coord_upper:new l.c3(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(g,t.u_pixel_coord_lower),u_scale:new l.c2(g,t.u_scale),u_fade:new l.bp(g,t.u_fade)}),fill:(g,t)=>({u_fill_translate:new l.c3(g,t.u_fill_translate)}),fillPattern:(g,t)=>({u_image:new l.b_(g,t.u_image),u_texsize:new l.c3(g,t.u_texsize),u_pixel_coord_upper:new l.c3(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(g,t.u_pixel_coord_lower),u_scale:new l.c2(g,t.u_scale),u_fade:new l.bp(g,t.u_fade),u_fill_translate:new l.c3(g,t.u_fill_translate)}),fillOutline:(g,t)=>({u_world:new l.c3(g,t.u_world),u_fill_translate:new l.c3(g,t.u_fill_translate)}),fillOutlinePattern:(g,t)=>({u_world:new l.c3(g,t.u_world),u_image:new l.b_(g,t.u_image),u_texsize:new l.c3(g,t.u_texsize),u_pixel_coord_upper:new l.c3(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(g,t.u_pixel_coord_lower),u_scale:new l.c2(g,t.u_scale),u_fade:new l.bp(g,t.u_fade),u_fill_translate:new l.c3(g,t.u_fill_translate)}),circle:(g,t)=>({u_camera_to_center_distance:new l.bp(g,t.u_camera_to_center_distance),u_scale_with_map:new l.b_(g,t.u_scale_with_map),u_pitch_with_map:new l.b_(g,t.u_pitch_with_map),u_extrude_scale:new l.c3(g,t.u_extrude_scale),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_globe_extrude_scale:new l.bp(g,t.u_globe_extrude_scale),u_translate:new l.c3(g,t.u_translate)}),collisionBox:(g,t)=>({u_pixel_extrude_scale:new l.c3(g,t.u_pixel_extrude_scale)}),collisionCircle:(g,t)=>({u_viewport_size:new l.c3(g,t.u_viewport_size)}),debug:(g,t)=>({u_color:new l.b$(g,t.u_color),u_overlay:new l.b_(g,t.u_overlay),u_overlay_scale:new l.bp(g,t.u_overlay_scale)}),depth:lm,clippingMask:lm,heatmap:(g,t)=>({u_extrude_scale:new l.bp(g,t.u_extrude_scale),u_intensity:new l.bp(g,t.u_intensity),u_globe_extrude_scale:new l.bp(g,t.u_globe_extrude_scale)}),heatmapTexture:(g,t)=>({u_matrix:new l.c0(g,t.u_matrix),u_world:new l.c3(g,t.u_world),u_image:new l.b_(g,t.u_image),u_color_ramp:new l.b_(g,t.u_color_ramp),u_opacity:new l.bp(g,t.u_opacity)}),hillshade:(g,t)=>({u_image:new l.b_(g,t.u_image),u_latrange:new l.c3(g,t.u_latrange),u_exaggeration:new l.bp(g,t.u_exaggeration),u_altitudes:new l.c9(g,t.u_altitudes),u_azimuths:new l.c9(g,t.u_azimuths),u_accent:new l.b$(g,t.u_accent),u_method:new l.b_(g,t.u_method),u_shadows:new l.c8(g,t.u_shadows),u_highlights:new l.c8(g,t.u_highlights)}),hillshadePrepare:(g,t)=>({u_matrix:new l.c0(g,t.u_matrix),u_image:new l.b_(g,t.u_image),u_dimension:new l.c3(g,t.u_dimension),u_zoom:new l.bp(g,t.u_zoom),u_unpack:new l.c1(g,t.u_unpack)}),colorRelief:(g,t)=>({u_image:new l.b_(g,t.u_image),u_unpack:new l.c1(g,t.u_unpack),u_dimension:new l.c3(g,t.u_dimension),u_elevation_stops:new l.b_(g,t.u_elevation_stops),u_color_stops:new l.b_(g,t.u_color_stops),u_color_ramp_size:new l.b_(g,t.u_color_ramp_size),u_opacity:new l.bp(g,t.u_opacity)}),line:(g,t)=>({u_translation:new l.c3(g,t.u_translation),u_ratio:new l.bp(g,t.u_ratio),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(g,t.u_units_to_pixels)}),lineGradient:(g,t)=>({u_translation:new l.c3(g,t.u_translation),u_ratio:new l.bp(g,t.u_ratio),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(g,t.u_units_to_pixels),u_image:new l.b_(g,t.u_image),u_image_height:new l.bp(g,t.u_image_height)}),linePattern:(g,t)=>({u_translation:new l.c3(g,t.u_translation),u_texsize:new l.c3(g,t.u_texsize),u_ratio:new l.bp(g,t.u_ratio),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_image:new l.b_(g,t.u_image),u_units_to_pixels:new l.c3(g,t.u_units_to_pixels),u_scale:new l.c2(g,t.u_scale),u_fade:new l.bp(g,t.u_fade)}),lineSDF:(g,t)=>({u_translation:new l.c3(g,t.u_translation),u_ratio:new l.bp(g,t.u_ratio),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(g,t.u_units_to_pixels),u_image:new l.b_(g,t.u_image),u_mix:new l.bp(g,t.u_mix),u_tileratio:new l.bp(g,t.u_tileratio),u_crossfade_from:new l.bp(g,t.u_crossfade_from),u_crossfade_to:new l.bp(g,t.u_crossfade_to),u_lineatlas_width:new l.bp(g,t.u_lineatlas_width),u_lineatlas_height:new l.bp(g,t.u_lineatlas_height)}),lineGradientSDF:(g,t)=>({u_translation:new l.c3(g,t.u_translation),u_ratio:new l.bp(g,t.u_ratio),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(g,t.u_units_to_pixels),u_image:new l.b_(g,t.u_image),u_image_height:new l.bp(g,t.u_image_height),u_tileratio:new l.bp(g,t.u_tileratio),u_crossfade_from:new l.bp(g,t.u_crossfade_from),u_crossfade_to:new l.bp(g,t.u_crossfade_to),u_image_dash:new l.b_(g,t.u_image_dash),u_mix:new l.bp(g,t.u_mix),u_lineatlas_width:new l.bp(g,t.u_lineatlas_width),u_lineatlas_height:new l.bp(g,t.u_lineatlas_height)}),raster:(g,t)=>({u_tl_parent:new l.c3(g,t.u_tl_parent),u_scale_parent:new l.bp(g,t.u_scale_parent),u_buffer_scale:new l.bp(g,t.u_buffer_scale),u_fade_t:new l.bp(g,t.u_fade_t),u_opacity:new l.bp(g,t.u_opacity),u_image0:new l.b_(g,t.u_image0),u_image1:new l.b_(g,t.u_image1),u_brightness_low:new l.bp(g,t.u_brightness_low),u_brightness_high:new l.bp(g,t.u_brightness_high),u_saturation_factor:new l.bp(g,t.u_saturation_factor),u_contrast_factor:new l.bp(g,t.u_contrast_factor),u_spin_weights:new l.c2(g,t.u_spin_weights),u_coords_top:new l.c1(g,t.u_coords_top),u_coords_bottom:new l.c1(g,t.u_coords_bottom)}),symbolIcon:(g,t)=>({u_is_size_zoom_constant:new l.b_(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.b_(g,t.u_is_size_feature_constant),u_size_t:new l.bp(g,t.u_size_t),u_size:new l.bp(g,t.u_size),u_camera_to_center_distance:new l.bp(g,t.u_camera_to_center_distance),u_pitch:new l.bp(g,t.u_pitch),u_rotate_symbol:new l.b_(g,t.u_rotate_symbol),u_aspect_ratio:new l.bp(g,t.u_aspect_ratio),u_fade_change:new l.bp(g,t.u_fade_change),u_label_plane_matrix:new l.c0(g,t.u_label_plane_matrix),u_coord_matrix:new l.c0(g,t.u_coord_matrix),u_is_text:new l.b_(g,t.u_is_text),u_pitch_with_map:new l.b_(g,t.u_pitch_with_map),u_is_along_line:new l.b_(g,t.u_is_along_line),u_is_variable_anchor:new l.b_(g,t.u_is_variable_anchor),u_texsize:new l.c3(g,t.u_texsize),u_texture:new l.b_(g,t.u_texture),u_translation:new l.c3(g,t.u_translation),u_pitched_scale:new l.bp(g,t.u_pitched_scale)}),symbolSDF:(g,t)=>({u_is_size_zoom_constant:new l.b_(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.b_(g,t.u_is_size_feature_constant),u_size_t:new l.bp(g,t.u_size_t),u_size:new l.bp(g,t.u_size),u_camera_to_center_distance:new l.bp(g,t.u_camera_to_center_distance),u_pitch:new l.bp(g,t.u_pitch),u_rotate_symbol:new l.b_(g,t.u_rotate_symbol),u_aspect_ratio:new l.bp(g,t.u_aspect_ratio),u_fade_change:new l.bp(g,t.u_fade_change),u_label_plane_matrix:new l.c0(g,t.u_label_plane_matrix),u_coord_matrix:new l.c0(g,t.u_coord_matrix),u_is_text:new l.b_(g,t.u_is_text),u_pitch_with_map:new l.b_(g,t.u_pitch_with_map),u_is_along_line:new l.b_(g,t.u_is_along_line),u_is_variable_anchor:new l.b_(g,t.u_is_variable_anchor),u_texsize:new l.c3(g,t.u_texsize),u_texture:new l.b_(g,t.u_texture),u_gamma_scale:new l.bp(g,t.u_gamma_scale),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_is_halo:new l.b_(g,t.u_is_halo),u_is_plain:new l.b_(g,t.u_is_plain),u_translation:new l.c3(g,t.u_translation),u_pitched_scale:new l.bp(g,t.u_pitched_scale)}),symbolTextAndIcon:(g,t)=>({u_is_size_zoom_constant:new l.b_(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.b_(g,t.u_is_size_feature_constant),u_size_t:new l.bp(g,t.u_size_t),u_size:new l.bp(g,t.u_size),u_camera_to_center_distance:new l.bp(g,t.u_camera_to_center_distance),u_pitch:new l.bp(g,t.u_pitch),u_rotate_symbol:new l.b_(g,t.u_rotate_symbol),u_aspect_ratio:new l.bp(g,t.u_aspect_ratio),u_fade_change:new l.bp(g,t.u_fade_change),u_label_plane_matrix:new l.c0(g,t.u_label_plane_matrix),u_coord_matrix:new l.c0(g,t.u_coord_matrix),u_is_text:new l.b_(g,t.u_is_text),u_pitch_with_map:new l.b_(g,t.u_pitch_with_map),u_is_along_line:new l.b_(g,t.u_is_along_line),u_is_variable_anchor:new l.b_(g,t.u_is_variable_anchor),u_texsize:new l.c3(g,t.u_texsize),u_texsize_icon:new l.c3(g,t.u_texsize_icon),u_texture:new l.b_(g,t.u_texture),u_texture_icon:new l.b_(g,t.u_texture_icon),u_gamma_scale:new l.bp(g,t.u_gamma_scale),u_device_pixel_ratio:new l.bp(g,t.u_device_pixel_ratio),u_is_halo:new l.b_(g,t.u_is_halo),u_translation:new l.c3(g,t.u_translation),u_pitched_scale:new l.bp(g,t.u_pitched_scale)}),background:(g,t)=>({u_opacity:new l.bp(g,t.u_opacity),u_color:new l.b$(g,t.u_color)}),backgroundPattern:(g,t)=>({u_opacity:new l.bp(g,t.u_opacity),u_image:new l.b_(g,t.u_image),u_pattern_tl_a:new l.c3(g,t.u_pattern_tl_a),u_pattern_br_a:new l.c3(g,t.u_pattern_br_a),u_pattern_tl_b:new l.c3(g,t.u_pattern_tl_b),u_pattern_br_b:new l.c3(g,t.u_pattern_br_b),u_texsize:new l.c3(g,t.u_texsize),u_mix:new l.bp(g,t.u_mix),u_pattern_size_a:new l.c3(g,t.u_pattern_size_a),u_pattern_size_b:new l.c3(g,t.u_pattern_size_b),u_scale_a:new l.bp(g,t.u_scale_a),u_scale_b:new l.bp(g,t.u_scale_b),u_pixel_coord_upper:new l.c3(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(g,t.u_pixel_coord_lower),u_tile_units_to_pixels:new l.bp(g,t.u_tile_units_to_pixels)}),terrain:(g,t)=>({u_texture:new l.b_(g,t.u_texture),u_ele_delta:new l.bp(g,t.u_ele_delta),u_fog_matrix:new l.c0(g,t.u_fog_matrix),u_fog_color:new l.b$(g,t.u_fog_color),u_fog_ground_blend:new l.bp(g,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.bp(g,t.u_fog_ground_blend_opacity),u_horizon_color:new l.b$(g,t.u_horizon_color),u_horizon_fog_blend:new l.bp(g,t.u_horizon_fog_blend),u_is_globe_mode:new l.bp(g,t.u_is_globe_mode)}),terrainDepth:(g,t)=>({u_ele_delta:new l.bp(g,t.u_ele_delta)}),terrainCoords:(g,t)=>({u_texture:new l.b_(g,t.u_texture),u_terrain_coords_id:new l.bp(g,t.u_terrain_coords_id),u_ele_delta:new l.bp(g,t.u_ele_delta)}),projectionErrorMeasurement:(g,t)=>({u_input:new l.bp(g,t.u_input),u_output_expected:new l.bp(g,t.u_output_expected)}),atmosphere:(g,t)=>({u_sun_pos:new l.c2(g,t.u_sun_pos),u_atmosphere_blend:new l.bp(g,t.u_atmosphere_blend),u_globe_position:new l.c2(g,t.u_globe_position),u_globe_radius:new l.bp(g,t.u_globe_radius),u_inv_proj_matrix:new l.c0(g,t.u_inv_proj_matrix)}),sky:(g,t)=>({u_sky_color:new l.b$(g,t.u_sky_color),u_horizon_color:new l.b$(g,t.u_horizon_color),u_horizon:new l.c3(g,t.u_horizon),u_horizon_normal:new l.c3(g,t.u_horizon_normal),u_sky_horizon_blend:new l.bp(g,t.u_sky_horizon_blend),u_sky_blend:new l.bp(g,t.u_sky_blend)})};class y1{constructor(t,o,h){this.context=t;let p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!h,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||o.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let o=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let v1={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class cm{constructor(t,o,h,p){this.length=o.length,this.attributes=h,this.itemSize=o.bytesPerElement,this.dynamicDraw=p,this.context=t;let v=t.gl;this.buffer=v.createBuffer(),t.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||o.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,o){for(let h of this.attributes){let p=o.attributes[h.name];p!==void 0&&t.enableVertexAttribArray(p)}}setVertexAttribPointers(t,o,h){for(let p of this.attributes){let v=o.attributes[p.name];v!==void 0&&t.vertexAttribPointer(v,p.components,t[v1[p.type]],!1,this.itemSize,p.offset+this.itemSize*(h||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Bt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class um extends Bt{getDefault(){return l.bo.transparent}set(t){let o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class hu extends Bt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class du extends Bt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class pu extends Bt{getDefault(){return[!0,!0,!0,!0]}set(t){let o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Rd extends Bt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Zo extends Bt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Xl extends Bt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let o=this.current;(t.func!==o.func||t.ref!==o.ref||t.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class qs extends Bt{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Dr extends Bt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;t?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=t,this.dirty=!1}}class hm extends Bt{getDefault(){return[0,1]}set(t){let o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class dm extends Bt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;t?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=t,this.dirty=!1}}class Id extends Bt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Ho extends Bt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;t?o.enable(o.BLEND):o.disable(o.BLEND),this.current=t,this.dirty=!1}}class fu extends Bt{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class mu extends Bt{getDefault(){return l.bo.transparent}set(t){let o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Yl extends Bt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class gu extends Bt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;t?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=t,this.dirty=!1}}class pm extends Bt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Gs extends Bt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Zs extends Bt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class fm extends Bt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class kd extends Bt{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class gt extends Bt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class _u extends Bt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class b1 extends Bt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.bindTexture(o.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class mm extends Bt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Wl extends Bt{getDefault(){return null}set(t){let o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class x1 extends Bt{getDefault(){return null}set(t){var o;if(t===this.current&&!this.dirty)return;let h=this.gl;$r(h)?h.bindVertexArray(t):(o=h.getExtension("OES_vertex_array_object"))===null||o===void 0||o.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class w1 extends Bt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class gm extends Bt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class T1 extends Bt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Kl extends Bt{constructor(t,o){super(t),this.context=t,this.parent=o}getDefault(){return null}}class yu extends Kl{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Ql extends Kl{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class vu extends Kl{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}let bu="Framebuffer is not complete";class _m{constructor(t,o,h,p,v){this.context=t,this.width=o,this.height=h;let T=t.gl,M=this.framebuffer=T.createFramebuffer();if(this.colorAttachment=new yu(t,M),p)this.depthAttachment=v?new vu(t,M):new Ql(t,M);else if(v)throw new Error("Stencil cannot be set without depth");if(T.checkFramebufferStatus(T.FRAMEBUFFER)!==T.FRAMEBUFFER_COMPLETE)throw new Error(bu)}destroy(){let t=this.context.gl,o=this.colorAttachment.get();if(o&&t.deleteTexture(o),this.depthAttachment){let h=this.depthAttachment.get();h&&t.deleteRenderbuffer(h)}t.deleteFramebuffer(this.framebuffer)}}class xu{constructor(t){var o,h;if(this.gl=t,this.clearColor=new um(this),this.clearDepth=new hu(this),this.clearStencil=new du(this),this.colorMask=new pu(this),this.depthMask=new Rd(this),this.stencilMask=new Zo(this),this.stencilFunc=new Xl(this),this.stencilOp=new qs(this),this.stencilTest=new Dr(this),this.depthRange=new hm(this),this.depthTest=new dm(this),this.depthFunc=new Id(this),this.blend=new Ho(this),this.blendFunc=new fu(this),this.blendColor=new mu(this),this.blendEquation=new Yl(this),this.cullFace=new gu(this),this.cullFaceSide=new pm(this),this.frontFace=new Gs(this),this.program=new Zs(this),this.activeTexture=new fm(this),this.viewport=new kd(this),this.bindFramebuffer=new gt(this),this.bindRenderbuffer=new _u(this),this.bindTexture=new b1(this),this.bindVertexBuffer=new mm(this),this.bindElementBuffer=new Wl(this),this.bindVertexArray=new x1(this),this.pixelStoreUnpack=new w1(this),this.pixelStoreUnpackPremultiplyAlpha=new gm(this),this.pixelStoreUnpackFlipY=new T1(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),$r(t)){this.HALF_FLOAT=t.HALF_FLOAT;let p=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(o=t.RGBA16F)!==null&&o!==void 0?o:p?.RGBA16F_EXT,this.RGB16F=(h=t.RGB16F)!==null&&h!==void 0?h:p?.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");let p=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=p?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,o){return new y1(this,t,o)}createVertexBuffer(t,o,h){return new cm(this,t,o,h)}createRenderbuffer(t,o,h){let p=this.gl,v=p.createRenderbuffer();return this.bindRenderbuffer.set(v),p.renderbufferStorage(p.RENDERBUFFER,t,o,h),this.bindRenderbuffer.set(null),v}createFramebuffer(t,o,h,p){return new _m(this,t,o,h,p)}clear({color:t,depth:o,stencil:h}){let p=this.gl,v=0;t&&(v|=p.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),o!==void 0&&(v|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),h!==void 0&&(v|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(h),this.stencilMask.set(255)),p.clear(v)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){l.bQ(t.blendFunction,ei.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return $r(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var o;$r(this.gl)?this.gl.deleteVertexArray(t):(o=this.gl.getExtension("OES_vertex_array_object"))===null||o===void 0||o.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let $o;function Hs(g,t,o,h,p){var v,T;let M=g.context,C=g.transform,z=M.gl,P=g.useProgram("collisionBox"),k=[],L=0,N=0;for(let ae of h){let te=t.getTile(ae).getBucket(o);if(!te)continue;let Q=p?te.textCollisionBox:te.iconCollisionBox,re=te.collisionCircleArray;re.length>0&&(k.push({circleArray:re,circleOffset:N,coord:ae}),L+=re.length/4,N=L),Q&&P.draw(M,z.LINES,dt.disabled,Tt.disabled,g.colorModeForRenderPass(),wt.disabled,rm(g.transform),(v=g.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(ae),C.getProjectionData({overscaledTileID:ae,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),o.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,null,g.transform.zoom,null,null,Q.collisionVertexBuffer)}if(!p||!k.length)return;let G=g.useProgram("collisionCircle"),$=new l.ca;$.resize(4*L),$._trim();let J=0;for(let ae of k)for(let te=0;te<ae.circleArray.length/4;te++){let Q=4*te,re=ae.circleArray[Q+0],ie=ae.circleArray[Q+1],me=ae.circleArray[Q+2],Te=ae.circleArray[Q+3];$.emplace(J++,re,ie,me,Te,0),$.emplace(J++,re,ie,me,Te,1),$.emplace(J++,re,ie,me,Te,2),$.emplace(J++,re,ie,me,Te,3)}(!$o||$o.length<2*L)&&($o=(function(ae){let te=2*ae,Q=new l.cc;Q.resize(te),Q._trim();for(let re=0;re<te;re++){let ie=6*re;Q.uint16[ie+0]=4*re+0,Q.uint16[ie+1]=4*re+1,Q.uint16[ie+2]=4*re+2,Q.uint16[ie+3]=4*re+2,Q.uint16[ie+4]=4*re+3,Q.uint16[ie+5]=4*re+0}return Q})(L));let W=M.createIndexBuffer($o,!0),ee=M.createVertexBuffer($,l.cb.members,!0);for(let ae of k){let te=qo(g.transform);G.draw(M,z.TRIANGLES,dt.disabled,Tt.disabled,g.colorModeForRenderPass(),wt.disabled,te,(T=g.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(ae.coord),null,o.id,ee,W,l.aV.simpleSegment(0,2*ae.circleOffset,ae.circleArray.length,ae.circleArray.length/2),null,g.transform.zoom,null,null,null)}ee.destroy(),W.destroy()}let $s=l.ap(new Float32Array(16));function Ld(g,t,o,h,p,v){let{horizontalAlign:T,verticalAlign:M}=l.aP(g);return new l.P((-(T-.5)*t/p+h[0])*v,(-(M-.5)*o/p+h[1])*v)}function S1(g,t,o,h,p,v){let T=t.tileAnchorPoint.add(new l.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let M=h.mult(v);o||(M=M.rotate(-p));let C=T.add(M);return ht(C.x,C.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(o){let M=Zt(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(g),C=Math.atan(M.y/M.x)+(M.x<0?Math.PI:0);return g.add(h.rotate(C))}return g.add(h)}function Jl(g,t,o,h,p,v,T,M,C,z,P,k){let L=g.text.placedSymbolArray,N=g.text.dynamicLayoutVertexArray,G=g.icon.dynamicLayoutVertexArray,$={};N.clear();for(let J=0;J<L.length;J++){let W=L.get(J),ee=W.hidden||!W.crossTileID||g.allowVerticalPlacement&&!W.placedOrientation?null:h[W.crossTileID];if(ee){let ae=new l.P(W.anchorX,W.anchorY),te={getElevation:k,width:p.width,height:p.height,pitchedLabelPlaneMatrix:v,pitchWithMap:o,transform:p,tileAnchorPoint:ae,translation:z,unwrappedTileID:P},Q=o?Ps(ae.x,ae.y,te):Zt(ae.x,ae.y,te),re=Ol(p.cameraToCenterDistance,Q.signedDistanceFromCamera),ie=l.ay(g.textSizeData,M,W)*re/l.aJ;o&&(ie*=g.tilePixelRatio/T);let{width:me,height:Te,anchor:Se,textOffset:Ie,textBoxScale:Pe}=ee,Qe=Ld(Se,me,Te,Ie,Pe,ie),qe=p.getPitchedTextCorrection(ae.x+z[0],ae.y+z[1],P),Ae=S1(Q.point,te,t,Qe,-p.bearingInRadians,qe),$e=g.allowVerticalPlacement&&W.placedOrientation===l.ax.vertical?Math.PI/2:0;for(let et=0;et<W.numGlyphs;et++)l.aD(N,Ae,$e);C&&W.associatedIconIndex>=0&&($[W.associatedIconIndex]={shiftedAnchor:Ae,angle:$e})}else Lo(W.numGlyphs,N)}if(C){G.clear();let J=g.icon.placedSymbolArray;for(let W=0;W<J.length;W++){let ee=J.get(W);if(ee.hidden)Lo(ee.numGlyphs,G);else{let ae=$[W];if(ae)for(let te=0;te<ee.numGlyphs;te++)l.aD(G,ae.shiftedAnchor,ae.angle);else Lo(ee.numGlyphs,G)}}g.icon.dynamicLayoutVertexBuffer.updateData(G)}g.text.dynamicLayoutVertexBuffer.updateData(N)}function M1(g,t,o){return o.iconsInText&&t?"symbolTextAndIcon":g?"symbolSDF":"symbolIcon"}function Od(g,t,o,h,p,v,T,M,C,z,P,k,L){var N,G;let $=g.context,J=$.gl,W=g.transform,ee=M==="map",ae=C==="map",te=M!=="viewport"&&o.layout.get("symbol-placement")!=="point",Q=ee&&!ae&&!te,re=!o.layout.get("symbol-sort-key").isConstant(),ie=!1,me=g.getDepthModeForSublayer(0,dt.ReadOnly),Te=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Se=[],Ie=W.getCircleRadiusCorrection();for(let qe of h){let Ae=t.getTile(qe),$e=Ae.getBucket(o);if(!$e)continue;let et=p?$e.text:$e.icon;if(!et?.segments.get().length||!et.hasVisibleVertices)continue;let Ft=et.programConfigurations.get(o.id),Bi=p||$e.sdfIcons,$t=p?$e.textSizeData:$e.iconSizeData,ji=ae||W.pitch!==0,Zi=g.useProgram(M1(Bi,p,$e),Ft),Rn=l.aw($t,W.zoom),Ei=(N=g.style.map.terrain)===null||N===void 0?void 0:N.getTerrainData(qe),Wn,Sn,cn,In,lo=[0,0],co=null;if(p)Sn=Ae.glyphAtlasTexture,cn=J.LINEAR,Wn=Ae.glyphAtlasTexture.size,$e.iconsInText&&(lo=Ae.imageAtlasTexture.size,co=Ae.imageAtlasTexture,In=ji||g.options.rotating||g.options.zooming||$t.kind==="composite"||$t.kind==="camera"?J.LINEAR:J.NEAREST);else{let xi=o.layout.get("icon-size").constantOr(0)!==1||$e.iconsNeedLinear;Sn=Ae.imageAtlasTexture,cn=Bi||g.options.rotating||g.options.zooming||xi||ji?J.LINEAR:J.NEAREST,Wn=Ae.imageAtlasTexture.size}let uo=l.aK(Ae,1,g.transform.zoom),kn=mr(ee,g.transform,uo),Na=Yc(ae,ee,g.transform,uo),ho=l.aL(W,Ae,v,T),Ou=W.getProjectionData({overscaledTileID:qe,applyGlobeMatrix:!L,applyTerrainMatrix:!0}),_a=Te&&$e.hasTextData(),ya=o.layout.get("icon-text-fit")!=="none"&&_a&&$e.hasIconData();if(te){let xi=l.O();ct(xi,kn);let Jo=g.style.map.terrain?(Ua,ap)=>g.style.map.terrain.getElevation(qe,Ua,ap):null,Bu=o.layout.get("text-rotation-alignment")==="map";Wc($e,g,p,kn,xi,ae,z,Bu,qe.toUnwrapped(),W.width,W.height,ho,Jo)}let br=p&&Te||ya,Ir=te||br?$s:ae?kn:g.transform.clipSpaceToPixelsMatrix,bi=Bi&&o.paint.get(p?"text-halo-width":"icon-halo-width").constantOr(1)!==0,ui;ui=Bi?$e.iconsInText?Dd($t.kind,Rn,Q,ae,te,br,g,Ir,Na,ho,Wn,lo,Ie):zd($t.kind,Rn,Q,ae,te,br,g,Ir,Na,ho,p,Wn,bi,Ie):uu($t.kind,Rn,Q,ae,te,br,g,Ir,Na,ho,p,Wn,Ie);let Hi={program:Zi,buffers:et,uniformValues:ui,projectionData:Ou,atlasTexture:Sn,atlasTextureIcon:co,atlasInterpolation:cn,atlasInterpolationIcon:In,isSDF:Bi,hasHalo:bi};if(re&&$e.canOverlap){ie=!0;let xi=et.segments.get();for(let Jo of xi)Se.push({segments:new l.aV([Jo]),sortKey:Jo.sortKey,state:Hi,terrainData:Ei})}else Se.push({segments:et.segments,sortKey:0,state:Hi,terrainData:Ei})}ie&&Se.sort(((qe,Ae)=>qe.sortKey-Ae.sortKey));let Pe=(G=o.paint.get(p?"text-halo-width":"icon-halo-width").constantOr(null))!==null&&G!==void 0?G:1/0,Qe=o.layout.get("text-letter-spacing").constantOr(0)*l.aJ<0||Pe>1;for(let qe of Se){let Ae=qe.state;$.activeTexture.set(J.TEXTURE0),Ae.atlasTexture.bind(Ae.atlasInterpolation,J.CLAMP_TO_EDGE),Ae.atlasTextureIcon&&($.activeTexture.set(J.TEXTURE1),Ae.atlasTextureIcon&&Ae.atlasTextureIcon.bind(Ae.atlasInterpolationIcon,J.CLAMP_TO_EDGE));let $e=Ae.isSDF&&Ae.hasHalo;if($e){let et=Ae.uniformValues;et.u_is_halo=1,Qe&&(et.u_is_plain=0,ec(Ae.buffers,qe.segments,o,g,Ae.program,me,P,k,et,Ae.projectionData,qe.terrainData),et.u_is_halo=0,et.u_is_plain=1)}ec(Ae.buffers,qe.segments,o,g,Ae.program,me,P,k,Ae.uniformValues,Ae.projectionData,qe.terrainData),$e&&!Qe&&(Ae.uniformValues.u_is_halo=0)}}function ec(g,t,o,h,p,v,T,M,C,z,P){let k=h.context;p.draw(k,k.gl.TRIANGLES,v,T,M,wt.backCCW,C,P,z,o.id,g.layoutVertexBuffer,g.indexBuffer,t,o.paint,h.transform.zoom,g.programConfigurations.get(o.id),g.dynamicLayoutVertexBuffer,g.opacityVertexBuffer)}function Bd(g,t,o,h,p){let v=g.context,T=v.gl,M=Tt.disabled,C=new ei([T.ONE,T.ONE],l.bo.transparent,[!0,!0,!0,!0]),z=t.getBucket(o);if(!z)return;let P=h.key,k=o.heatmapFbos.get(P);k||(k=Fd(v,t.tileSize,t.tileSize),o.heatmapFbos.set(P,k)),v.bindFramebuffer.set(k.framebuffer),v.viewport.set([0,0,t.tileSize,t.tileSize]),v.clear({color:l.bo.transparent});let L=z.programConfigurations.get(o.id),N=g.useProgram("heatmap",L,!p),G=g.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),$=g.style.map.terrain.getTerrainData(h);N.draw(v,T.TRIANGLES,dt.disabled,M,C,wt.disabled,Md(t,g.transform.zoom,o.paint.get("heatmap-intensity"),1),$,G,o.id,z.layoutVertexBuffer,z.indexBuffer,z.segments,o.paint,g.transform.zoom,L)}function ym(g,t,o,h,p){let v=g.context,T=v.gl,M=g.transform;v.setColorMode(g.colorModeForRenderPass());let C=tc(v,t),z=o.key,P=t.heatmapFbos.get(z);if(!P)return;v.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,P.colorAttachment.get()),v.activeTexture.set(T.TEXTURE1),C.bind(T.LINEAR,T.CLAMP_TO_EDGE);let k=M.getProjectionData({overscaledTileID:o,applyTerrainMatrix:p,applyGlobeMatrix:!h});g.useProgram("heatmapTexture").draw(v,T.TRIANGLES,dt.disabled,Tt.disabled,g.colorModeForRenderPass(),wt.disabled,Vs(g,t,0,1),null,k,t.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments,t.paint,M.zoom),P.destroy(),t.heatmapFbos.delete(z)}function Fd(g,t,o){var h,p;let v=g.gl,T=v.createTexture();v.bindTexture(v.TEXTURE_2D,T),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,v.LINEAR),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,v.LINEAR);let M=(h=g.HALF_FLOAT)!==null&&h!==void 0?h:v.UNSIGNED_BYTE,C=(p=g.RGBA16F)!==null&&p!==void 0?p:v.RGBA;v.texImage2D(v.TEXTURE_2D,0,C,t,o,0,v.RGBA,M,null);let z=g.createFramebuffer(t,o,!1,!1);return z.colorAttachment.set(T),z}function tc(g,t){return t.colorRampTexture||(t.colorRampTexture=new l.T(g,t.colorRamp,g.gl.RGBA)),t.colorRampTexture}function wu(g,t,o,h,p,v,T,M){let C=256;if(p.stepInterpolant){let z=t.getSource().maxzoom,P=T.canonical.z===z?Math.ceil(1<<g.transform.maxZoom-T.canonical.z):1;C=l.al(l.ce(v.maxLineLength/l.a6*1024*P),256,o.maxTextureSize)}return M.gradient=l.cf({expression:p.gradientExpression(),evaluationKey:"lineProgress",resolution:C,image:M.gradient||void 0,clips:v.lineClipsArray}),M.texture?M.texture.update(M.gradient):M.texture=new l.T(o,M.gradient,h.RGBA),M.version=p.gradientVersion,M.texture}function E1(g,t,o,h,p){g.activeTexture.set(t.TEXTURE0),o.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),h.updatePaintBuffers(p)}function vm(g,t,o,h,p,v){(p||g.lineAtlas.dirty)&&(t.activeTexture.set(o.TEXTURE0),g.lineAtlas.bind(t)),h.updatePaintBuffers(v)}function Oi(g,t,o,h,p,v,T){let M=v.gradients[p.id],C=M.texture;p.gradientVersion!==M.version&&(C=wu(g,t,o,h,p,v,T,M)),o.activeTexture.set(h.TEXTURE0),C.bind(p.stepInterpolant?h.NEAREST:h.LINEAR,h.CLAMP_TO_EDGE)}function Xo(g,t,o,h,p,v,T,M,C){let z=v.gradients[p.id],P=z.texture;p.gradientVersion!==z.version&&(P=wu(g,t,o,h,p,v,T,z)),o.activeTexture.set(h.TEXTURE0),P.bind(p.stepInterpolant?h.NEAREST:h.LINEAR,h.CLAMP_TO_EDGE),o.activeTexture.set(h.TEXTURE1),g.lineAtlas.bind(o),M.updatePaintBuffers(C)}function ur(g,t,o,h,p){if(!o||!h?.imageAtlas)return;let v=h.imageAtlas.patternPositions,T=v[o.to.toString()],M=v[o.from.toString()];if(!T&&M&&(T=M),!M&&T&&(M=T),!T||!M){let C=p.getPaintProperty(t);T=v[C],M=v[C]}T&&M&&g.setConstantPatternPositions(T,M)}function Tu(g,t,o,h,p,v,T,M){var C;let z=g.context.gl,P="fill-pattern",k=o.paint.get(P),L=k?.constantOr(1),N=o.getCrossfadeParameters(),G,$,J,W,ee,ae=g.transform,te=o.paint.get("fill-translate"),Q=o.paint.get("fill-translate-anchor");T?($=L&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",G=z.LINES):($=L?"fillPattern":"fill",G=z.TRIANGLES);let re=k.constantOr(null);for(let ie of h){let me=t.getTile(ie);if(L&&!me.patternsLoaded())continue;let Te=me.getBucket(o);if(!Te)continue;let Se=Te.programConfigurations.get(o.id),Ie=g.useProgram($,Se),Pe=(C=g.style.map.terrain)===null||C===void 0?void 0:C.getTerrainData(ie);L&&(g.context.activeTexture.set(z.TEXTURE0),me.imageAtlasTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),Se.updatePaintBuffers(N)),ur(Se,P,re,me,o);let Qe=ae.getProjectionData({overscaledTileID:ie,applyGlobeMatrix:!M,applyTerrainMatrix:!0}),qe=l.aL(ae,me,te,Q);if(T){W=Te.indexBuffer2,ee=Te.segments2;let $e=[z.drawingBufferWidth,z.drawingBufferHeight];J=$==="fillOutlinePattern"&&L?im(g,N,me,$e,qe):tm($e,qe)}else W=Te.indexBuffer,ee=Te.segments,J=L?lu(g,N,me,qe):{u_fill_translate:qe};let Ae=g.stencilModeForClipping(ie);Ie.draw(g.context,G,p,Ae,v,wt.backCCW,J,Pe,Qe,o.id,Te.layoutVertexBuffer,W,ee,o.paint,g.transform.zoom,Se)}}function Xs(g,t,o,h,p,v,T,M){var C;let z=g.context,P=z.gl,k="fill-extrusion-pattern",L=o.paint.get(k),N=L.constantOr(1),G=o.getCrossfadeParameters(),$=o.paint.get("fill-extrusion-opacity"),J=L.constantOr(null),W=g.transform;for(let ee of h){let ae=t.getTile(ee),te=ae.getBucket(o);if(!te)continue;let Q=(C=g.style.map.terrain)===null||C===void 0?void 0:C.getTerrainData(ee),re=te.programConfigurations.get(o.id),ie=g.useProgram(N?"fillExtrusionPattern":"fillExtrusion",re);N&&(g.context.activeTexture.set(P.TEXTURE0),ae.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),re.updatePaintBuffers(G));let me=W.getProjectionData({overscaledTileID:ee,applyGlobeMatrix:!M,applyTerrainMatrix:!0});ur(re,k,J,ae,o);let Te=l.aL(W,ae,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),Se=o.paint.get("fill-extrusion-vertical-gradient"),Ie=N?em(g,Se,$,Te,ee,G,ae):Jf(g,Se,$,Te);ie.draw(z,z.gl.TRIANGLES,p,v,T,wt.backCCW,Ie,Q,me,o.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,o.paint,g.transform.zoom,re,g.style.map.terrain&&te.centroidVertexBuffer)}}function Su(g,t,o,h,p,v,T,M,C){var z;let P=g.style.projection,k=g.context,L=g.transform,N=k.gl,G=[`#define NUM_ILLUMINATION_SOURCES ${o.paint.get("hillshade-highlight-color").values.length}`],$=g.useProgram("hillshade",null,!1,G),J=!g.options.moving;for(let W of h){let ee=t.getTile(W),ae=ee.fbo;if(!ae)continue;let te=P.getMeshFromTileID(k,W.canonical,M,!0,"raster"),Q=(z=g.style.map.terrain)===null||z===void 0?void 0:z.getTerrainData(W);k.activeTexture.set(N.TEXTURE0),N.bindTexture(N.TEXTURE_2D,ae.colorAttachment.get());let re=L.getProjectionData({overscaledTileID:W,aligned:J,applyGlobeMatrix:!C,applyTerrainMatrix:!0});$.draw(k,N.TRIANGLES,v,p[W.overscaledZ],T,wt.backCCW,f1(g,ee,o),Q,re,o.id,te.vertexBuffer,te.indexBuffer,te.segments)}}let ao=0;function ic(g,t,o,h,p,v,T,M,C){var z;let P=g.style.projection,k=g.context,L=g.transform,N=k.gl,G=g.useProgram("colorRelief"),$=!g.options.moving,J=o.paint.get("resampling")==="nearest"?N.NEAREST:N.LINEAR,W=!0,ee=0;for(let ae of h){let te=t.getTile(ae),Q=te.dem;if(W){ao||(ao=N.getParameter(N.MAX_TEXTURE_SIZE));let Ie=ao,{elevationTexture:Pe,colorTexture:Qe}=o.getColorRampTextures(k,Ie,Q.getUnpackVector());k.activeTexture.set(N.TEXTURE1),Pe.bind(N.NEAREST,N.CLAMP_TO_EDGE),k.activeTexture.set(N.TEXTURE4),Qe.bind(N.LINEAR,N.CLAMP_TO_EDGE),W=!1,ee=Pe.size[0]}if(!Q?.data)continue;let re=Q.stride,ie=Q.getPixels();if(k.activeTexture.set(N.TEXTURE0),k.pixelStoreUnpackPremultiplyAlpha.set(!1),te.demTexture||(te.demTexture=g.getTileTexture(re)),te.demTexture){let Ie=te.demTexture;Ie.update(ie,{premultiply:!1}),Ie.bind(J,N.CLAMP_TO_EDGE)}else te.demTexture=new l.T(k,ie,N.RGBA,{premultiply:!1}),te.demTexture.bind(J,N.CLAMP_TO_EDGE);let me=P.getMeshFromTileID(k,ae.canonical,M,!0,"raster"),Te=(z=g.style.map.terrain)===null||z===void 0?void 0:z.getTerrainData(ae),Se=L.getProjectionData({overscaledTileID:ae,aligned:$,applyGlobeMatrix:!C,applyTerrainMatrix:!0});G.draw(k,N.TRIANGLES,v,p[ae.overscaledZ],T,wt.backCCW,g1(o,te.dem,ee),Te,Se,o.id,me.vertexBuffer,me.indexBuffer,me.segments)}}let Yo=[new l.P(0,0),new l.P(l.a6,0),new l.P(l.a6,l.a6),new l.P(0,l.a6)];function Ys(g,t,o,h,p,v,T,M,C=!1,z=!1){var P;let k=h[h.length-1].overscaledZ,L=g.context,N=L.gl,G=g.useProgram("raster"),$=g.transform,J=g.style.projection,W=g.colorModeForRenderPass(),ee=!g.options.moving,ae=o.paint.get("raster-opacity"),te=o.paint.get("resampling")==="nearest"||o.paint.get("raster-resampling")==="nearest"?N.NEAREST:N.LINEAR,Q=o.paint.get("raster-fade-duration"),re=!!g.style.map.terrain;for(let ie of h){let me=g.getDepthModeForSublayer(ie.overscaledZ-k,ae===1?dt.ReadWrite:dt.ReadOnly,N.LESS),Te=t.getTile(ie);L.activeTexture.set(N.TEXTURE0),Te.texture.bind(te,N.CLAMP_TO_EDGE,N.LINEAR_MIPMAP_NEAREST),L.activeTexture.set(N.TEXTURE1);let{parentTile:Se,parentScaleBy:Ie,parentTopLeft:Pe,fadeValues:Qe}=bm(Te,t,Q,re);Te.fadeOpacity=Qe.tileOpacity,Se?(Se.fadeOpacity=Qe.parentTileOpacity,Se.texture.bind(te,N.CLAMP_TO_EDGE,N.LINEAR_MIPMAP_NEAREST)):Te.texture.bind(te,N.CLAMP_TO_EDGE,N.LINEAR_MIPMAP_NEAREST),Te.texture.useMipmap&&L.extTextureFilterAnisotropic&&g.transform.pitch>g.options.anisotropicFilterPitch&&N.texParameterf(N.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);let qe=(P=g.style.map.terrain)===null||P===void 0?void 0:P.getTerrainData(ie),Ae=$.getProjectionData({overscaledTileID:ie,aligned:ee,applyGlobeMatrix:!z,applyTerrainMatrix:!0}),$e=Cd(Pe,Ie,Qe.fadeMix,o,M),et=J.getMeshFromTileID(L,ie.canonical,v,T,"raster");G.draw(L,N.TRIANGLES,me,p?p[ie.overscaledZ]:Tt.disabled,W,C?wt.frontCCW:wt.backCCW,$e,qe,Ae,o.id,et.vertexBuffer,et.indexBuffer,et.segments)}}function bm(g,t,o,h){let p={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(o===0||h)return p;if(g.fadingParentID){let v=t.getLoadedTile(g.fadingParentID);if(!v)return p;let T=Math.pow(2,v.tileID.overscaledZ-g.tileID.overscaledZ),M=[g.tileID.canonical.x*T%1,g.tileID.canonical.y*T%1],C=(function(z,P,k){let L=le(),N=(L-P.timeAdded)/k,G=z.fadingDirection===bn.Incoming,$=l.al((L-z.timeAdded)/k,0,1),J=l.al(1-N,0,1),W=G?$:J;return{tileOpacity:W,parentTileOpacity:G?J:$,fadeMix:{opacity:1,mix:1-W}}})(g,v,o);return{parentTile:v,parentScaleBy:T,parentTopLeft:M,fadeValues:C}}if(g.selfFading){let v=(function(T,M){let C=(le()-T.timeAdded)/M,z=l.al(C,0,1);return{tileOpacity:z,fadeMix:{opacity:z,mix:0}}})(g,o);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:v}}return p}let xm=new l.bo(1,0,0,1),wm=new l.bo(0,1,0,1),Tm=new l.bo(0,0,1,1),Sm=new l.bo(1,0,1,1),oo=new l.bo(0,1,1,1);function Nd(g,t,o,h){nc(g,0,t+o/2,g.transform.width,o,h)}function Ud(g,t,o,h){nc(g,t-o/2,0,o,g.transform.height,h)}function nc(g,t,o,h,p,v){let T=g.context,M=T.gl;M.enable(M.SCISSOR_TEST),M.scissor(t*g.pixelRatio,o*g.pixelRatio,h*g.pixelRatio,p*g.pixelRatio),T.clear({color:v}),M.disable(M.SCISSOR_TEST)}function Mm(g,t,o){var h;let p=g.context,v=p.gl,T=g.useProgram("debug"),M=dt.disabled,C=Tt.disabled,z=g.colorModeForRenderPass(),P="$debug",k=(h=g.style.map.terrain)===null||h===void 0?void 0:h.getTerrainData(o);p.activeTexture.set(v.TEXTURE0);let L=t.getTileByID(o.key).latestRawTileData,N=Math.floor((L?.byteLength||0)/1024),G=t.getTile(o).tileSize,$=512/Math.min(G,512)*(o.overscaledZ/g.transform.zoom)*.5,J=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(J+=` => ${o.overscaledZ}`),(function(ee,ae){ee.initDebugOverlayCanvas();let te=ee.debugOverlayCanvas,Q=ee.context.gl,re=ee.debugOverlayCanvas.getContext("2d");re.clearRect(0,0,te.width,te.height),re.shadowColor="white",re.shadowBlur=2,re.lineWidth=1.5,re.strokeStyle="white",re.textBaseline="top",re.font="bold 36px Open Sans, sans-serif",re.fillText(ae,5,5),re.strokeText(ae,5,5),ee.debugOverlayTexture.update(te),ee.debugOverlayTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE)})(g,`${J} ${N}kB`);let W=g.transform.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!0,applyTerrainMatrix:!0});T.draw(p,v.TRIANGLES,M,C,ei.alphaBlended,wt.disabled,Sd(l.bo.transparent,$),null,W,P,g.debugBuffer,g.quadTriangleIndexBuffer,g.debugSegments),T.draw(p,v.LINE_STRIP,M,C,z,wt.disabled,Sd(l.bo.red),k,W,P,g.debugBuffer,g.tileBorderIndexBuffer,g.debugSegments)}function Vd(g,t,o,h){let{isRenderingGlobe:p}=h,v=g.context,T=v.gl,M=g.transform,C=g.colorModeForRenderPass(),z=g.getDepthModeFor3D(),P=g.useProgram("terrain");v.bindFramebuffer.set(null),v.viewport.set([0,0,g.width,g.height]);for(let k of o){let L=t.getTerrainMesh(k.tileID),N=g.renderToTexture.getTexture(k),G=t.getTerrainData(k.tileID);v.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,N.texture);let $=t.getMeshFrameDelta(M.zoom),J=M.calculateFogMatrix(k.tileID.toUnwrapped()),W=su($,J,g.style.sky,M.pitch,p),ee=M.getProjectionData({overscaledTileID:k.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(v,T.TRIANGLES,z,Tt.disabled,C,wt.backCCW,W,G,ee,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}}function jd(g,t){if(!t.mesh){let o=new l.aU;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(1,1),o.emplaceBack(-1,1);let h=new l.aW;h.emplaceBack(0,1,2),h.emplaceBack(0,2,3),t.mesh=new Jt(g.createVertexBuffer(o,no.members),g.createIndexBuffer(h),l.aV.simpleSegment(0,0,o.length,h.length))}return t.mesh}let Em={symbol:function(g,t,o,h,p,v){if(g.renderPass!=="translucent")return;let{isRenderingToTexture:T}=v,M=Tt.disabled,C=g.colorModeForRenderPass();(o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(z,P,k,L,N,G,$,J,W){var ee;let ae=P.transform,te=P.style.map.terrain,Q=N==="map",re=G==="map";for(let ie of z){let me=L.getTile(ie),Te=me.getBucket(k);if(!(!((ee=Te?.text)===null||ee===void 0)&&ee.segments.get().length))continue;let Se=l.aw(Te.textSizeData,ae.zoom),Ie=l.aK(me,1,P.transform.zoom),Pe=mr(Q,P.transform,Ie),Qe=k.layout.get("icon-text-fit")!=="none"&&Te.hasIconData();if(Se){let qe=Math.pow(2,ae.zoom-me.tileID.overscaledZ),Ae=te?($e,et)=>te.getElevation(ie,$e,et):null;Jl(Te,Q,re,W,ae,Pe,qe,Se,Qe,l.aL(ae,me,$,J),ie.toUnwrapped(),Ae)}}})(h,g,o,t,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),p),o.paint.get("icon-opacity").constantOr(1)!==0&&Od(g,t,o,h,!1,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),o.layout.get("icon-rotation-alignment"),o.layout.get("icon-pitch-alignment"),o.layout.get("icon-keep-upright"),M,C,T),o.paint.get("text-opacity").constantOr(1)!==0&&Od(g,t,o,h,!0,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.layout.get("text-keep-upright"),M,C,T),t.map.showCollisionBoxes&&(Hs(g,t,o,h,!0),Hs(g,t,o,h,!1))},circle:function(g,t,o,h,p){var v;if(g.renderPass!=="translucent")return;let{isRenderingToTexture:T}=p,M=o.paint.get("circle-opacity"),C=o.paint.get("circle-stroke-width"),z=o.paint.get("circle-stroke-opacity"),P=!o.layout.get("circle-sort-key").isConstant();if(M.constantOr(1)===0&&(C.constantOr(1)===0||z.constantOr(1)===0))return;let k=g.context,L=k.gl,N=g.transform,G=g.getDepthModeForSublayer(0,dt.ReadOnly),$=Tt.disabled,J=g.colorModeForRenderPass(),W=[],ee=N.getCircleRadiusCorrection();for(let ae of h){let te=t.getTile(ae),Q=te.getBucket(o);if(!Q)continue;let re=o.paint.get("circle-translate"),ie=o.paint.get("circle-translate-anchor"),me=l.aL(N,te,re,ie),Te=Q.programConfigurations.get(o.id),Se=g.useProgram("circle",Te),Ie=Q.layoutVertexBuffer,Pe=Q.indexBuffer,Qe=(v=g.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(ae),qe={programConfiguration:Te,program:Se,layoutVertexBuffer:Ie,indexBuffer:Pe,uniformValues:nm(g,te,o,me,ee),terrainData:Qe,projectionData:N.getProjectionData({overscaledTileID:ae,applyGlobeMatrix:!T,applyTerrainMatrix:!0})};if(P){let Ae=Q.segments.get();for(let $e of Ae)W.push({segments:new l.aV([$e]),sortKey:$e.sortKey,state:qe})}else W.push({segments:Q.segments,sortKey:0,state:qe})}P&&W.sort(((ae,te)=>ae.sortKey-te.sortKey));for(let ae of W){let{programConfiguration:te,program:Q,layoutVertexBuffer:re,indexBuffer:ie,uniformValues:me,terrainData:Te,projectionData:Se}=ae.state;Q.draw(k,L.TRIANGLES,G,$,J,wt.backCCW,me,Te,Se,o.id,re,ie,ae.segments,o.paint,g.transform.zoom,te)}},heatmap:function(g,t,o,h,p){if(o.paint.get("heatmap-opacity")===0)return;let v=g.context,{isRenderingToTexture:T,isRenderingGlobe:M}=p;if(g.style.map.terrain){for(let C of h){let z=t.getTile(C);t.hasRenderableParent(C)||(g.renderPass==="offscreen"?Bd(g,z,o,C,M):g.renderPass==="translucent"&&ym(g,o,C,T,M))}v.viewport.set([0,0,g.width,g.height])}else g.renderPass==="offscreen"?(function(C,z,P,k){let L=C.context,N=L.gl,G=C.transform,$=Tt.disabled,J=new ei([N.ONE,N.ONE],l.bo.transparent,[!0,!0,!0,!0]);(function(W,ee,ae){let te=W.gl;W.activeTexture.set(te.TEXTURE1),W.viewport.set([0,0,ee.width/4,ee.height/4]);let Q=ae.heatmapFbos.get(l.cd);Q?(te.bindTexture(te.TEXTURE_2D,Q.colorAttachment.get()),W.bindFramebuffer.set(Q.framebuffer)):(Q=Fd(W,ee.width/4,ee.height/4),ae.heatmapFbos.set(l.cd,Q))})(L,C,P),L.clear({color:l.bo.transparent});for(let W of k){if(z.hasRenderableParent(W))continue;let ee=z.getTile(W),ae=ee.getBucket(P);if(!ae)continue;let te=ae.programConfigurations.get(P.id),Q=C.useProgram("heatmap",te),re=G.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),ie=G.getCircleRadiusCorrection();Q.draw(L,N.TRIANGLES,dt.disabled,$,J,wt.backCCW,Md(ee,G.zoom,P.paint.get("heatmap-intensity"),ie),null,re,P.id,ae.layoutVertexBuffer,ae.indexBuffer,ae.segments,P.paint,G.zoom,te)}L.viewport.set([0,0,C.width,C.height])})(g,t,o,h):g.renderPass==="translucent"&&(function(C,z){let P=C.context,k=P.gl;P.setColorMode(C.colorModeForRenderPass());let L=z.heatmapFbos.get(l.cd);L&&(P.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_2D,L.colorAttachment.get()),P.activeTexture.set(k.TEXTURE1),tc(P,z).bind(k.LINEAR,k.CLAMP_TO_EDGE),C.useProgram("heatmapTexture").draw(P,k.TRIANGLES,dt.disabled,Tt.disabled,C.colorModeForRenderPass(),wt.disabled,Vs(C,z,0,1),null,null,z.id,C.viewportBuffer,C.quadTriangleIndexBuffer,C.viewportSegments,z.paint,C.transform.zoom))})(g,o)},line:function(g,t,o,h,p){var v;if(g.renderPass!=="translucent")return;let{isRenderingToTexture:T}=p,M=o.paint.get("line-opacity"),C=o.paint.get("line-width");if(M.constantOr(1)===0||C.constantOr(1)===0)return;let z=g.getDepthModeForSublayer(0,dt.ReadOnly),P=g.colorModeForRenderPass(),k=o.paint.get("line-dasharray"),L=k.constantOr(1),N=o.paint.get("line-pattern"),G=N.constantOr(1),$=o.paint.get("line-gradient"),J=o.getCrossfadeParameters(),W;W=G?"linePattern":L&&$?"lineGradientSDF":L?"lineSDF":$?"lineGradient":"line";let ee=g.context,ae=ee.gl,te=g.transform,Q=!0;for(let re of h){let ie=t.getTile(re);if(G&&!ie.patternsLoaded())continue;let me=ie.getBucket(o);if(!me)continue;let Te=me.programConfigurations.get(o.id),Se=g.context.program.get(),Ie=g.useProgram(W,Te),Pe=Q||Ie.program!==Se,Qe=(v=g.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(re),qe=N.constantOr(null),Ae=k?.constantOr(null);if(qe&&ie.imageAtlas){let $t=ie.imageAtlas,ji=$t.patternPositions[qe.to.toString()],Zi=$t.patternPositions[qe.from.toString()];ji&&Zi&&Te.setConstantPatternPositions(ji,Zi)}else if(Ae){let $t=o.layout.get("line-cap").constantOr(null)==="round",ji=g.lineAtlas.getDash(Ae.to,$t),Zi=g.lineAtlas.getDash(Ae.from,$t);Te.setConstantDashPositions(ji,Zi)}let $e=te.getProjectionData({overscaledTileID:re,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),et=te.getPixelScale(),Ft;G?(Ft=om(g,ie,o,et,J),E1(ee,ae,ie,Te,J)):L&&$?(Ft=sm(g,ie,o,et,J,me.lineClipsArray.length),Xo(g,t,ee,ae,o,me,re,Te,J)):L?(Ft=Ed(g,ie,o,et,J),vm(g,ee,ae,Te,Pe,J)):$?(Ft=am(g,ie,o,et,me.lineClipsArray.length),Oi(g,t,ee,ae,o,me,re)):Ft=$l(g,ie,o,et);let Bi=g.stencilModeForClipping(re);Ie.draw(ee,ae.TRIANGLES,z,Bi,P,wt.disabled,Ft,Qe,$e,o.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,o.paint,g.transform.zoom,Te,me.layoutVertexBuffer2),Q=!1}},fill:function(g,t,o,h,p){let v=o.paint.get("fill-color"),T=o.paint.get("fill-opacity");if(T.constantOr(1)===0)return;let{isRenderingToTexture:M}=p,C=g.colorModeForRenderPass(),z=o.paint.get("fill-pattern"),P=g.opaquePassEnabledForLayer()&&!z.constantOr(1)&&v.constantOr(l.bo.transparent).a===1&&T.constantOr(0)===1?"opaque":"translucent";if(g.renderPass===P){let k=g.getDepthModeForSublayer(1,g.renderPass==="opaque"?dt.ReadWrite:dt.ReadOnly);Tu(g,t,o,h,k,C,!1,M)}if(g.renderPass==="translucent"&&o.paint.get("fill-antialias")){let k=g.getDepthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,dt.ReadOnly);Tu(g,t,o,h,k,C,!0,M)}},fillExtrusion:function(g,t,o,h,p){let v=o.paint.get("fill-extrusion-opacity");if(v===0)return;let{isRenderingToTexture:T}=p;if(g.renderPass==="translucent"){let M=new dt(g.context.gl.LEQUAL,dt.ReadWrite,g.depthRangeFor3D);if(v!==1||o.paint.get("fill-extrusion-pattern").constantOr(1))Xs(g,t,o,h,M,Tt.disabled,ei.disabled,T),Xs(g,t,o,h,M,g.stencilModeFor3D(),g.colorModeForRenderPass(),T);else{let C=g.colorModeForRenderPass();Xs(g,t,o,h,M,Tt.disabled,C,T)}}},hillshade:function(g,t,o,h,p){if(g.renderPass!=="offscreen"&&g.renderPass!=="translucent")return;let{isRenderingToTexture:v}=p,T=g.context,M=g.style.projection.useSubdivision,C=g.getDepthModeForSublayer(0,dt.ReadOnly),z=g.colorModeForRenderPass();if(g.renderPass==="offscreen")(function(P,k,L,N,G,$,J){let W=P.context,ee=W.gl,ae=N.paint.get("resampling")==="nearest"?ee.NEAREST:ee.LINEAR;for(let te of L){let Q=k.getTile(te),re=Q.dem;if(!re?.data||!Q.needsHillshadePrepare)continue;let ie=re.dim,me=re.stride,Te=re.getPixels();if(W.activeTexture.set(ee.TEXTURE1),W.pixelStoreUnpackPremultiplyAlpha.set(!1),Q.demTexture||(Q.demTexture=P.getTileTexture(me)),Q.demTexture){let Ie=Q.demTexture;Ie.update(Te,{premultiply:!1}),Ie.bind(ee.NEAREST,ee.CLAMP_TO_EDGE)}else Q.demTexture=new l.T(W,Te,ee.RGBA,{premultiply:!1}),Q.demTexture.bind(ee.NEAREST,ee.CLAMP_TO_EDGE);W.activeTexture.set(ee.TEXTURE0);let Se=Q.fbo;if(!Se){let Ie=new l.T(W,{width:ie,height:ie,data:null},ee.RGBA);Ie.bind(ae,ee.CLAMP_TO_EDGE),Se=Q.fbo=W.createFramebuffer(ie,ie,!0,!1),Se.colorAttachment.set(Ie.texture)}W.bindFramebuffer.set(Se.framebuffer),W.viewport.set([0,0,ie,ie]),P.useProgram("hillshadePrepare").draw(W,ee.TRIANGLES,G,$,J,wt.disabled,cu(Q.tileID,re),null,null,N.id,P.rasterBoundsBuffer,P.quadTriangleIndexBuffer,P.rasterBoundsSegments),Q.needsHillshadePrepare=!1}})(g,t,h,o,C,Tt.disabled,z),T.viewport.set([0,0,g.width,g.height]);else if(g.renderPass==="translucent")if(M){let[P,k,L]=g.stencilConfigForOverlapTwoPass(h);Su(g,t,o,L,P,C,z,!1,v),Su(g,t,o,L,k,C,z,!0,v)}else{let[P,k]=g.getStencilConfigForOverlapAndUpdateStencilID(h);Su(g,t,o,k,P,C,z,!1,v)}},colorRelief:function(g,t,o,h,p){if(g.renderPass!=="translucent"||!h.length)return;let{isRenderingToTexture:v}=p,T=g.style.projection.useSubdivision,M=g.getDepthModeForSublayer(0,dt.ReadOnly),C=g.colorModeForRenderPass();if(T){let[z,P,k]=g.stencilConfigForOverlapTwoPass(h);ic(g,t,o,k,z,M,C,!1,v),ic(g,t,o,k,P,M,C,!0,v)}else{let[z,P]=g.getStencilConfigForOverlapAndUpdateStencilID(h);ic(g,t,o,P,z,M,C,!1,v)}},raster:function(g,t,o,h,p){if(g.renderPass!=="translucent"||o.paint.get("raster-opacity")===0||!h.length)return;let{isRenderingToTexture:v}=p,T=t.getSource(),M=g.style.projection.useSubdivision;if(T instanceof _i)Ys(g,t,o,h,null,!1,!1,T.tileCoords,T.flippedWindingOrder,v);else if(M){let[C,z,P]=g.stencilConfigForOverlapTwoPass(h);Ys(g,t,o,P,C,!1,!0,Yo,!1,v),Ys(g,t,o,P,z,!0,!0,Yo,!1,v)}else{let[C,z]=g.getStencilConfigForOverlapAndUpdateStencilID(h);Ys(g,t,o,z,C,!1,!0,Yo,!1,v)}},background:function(g,t,o,h,p){var v;let T=o.paint.get("background-color"),M=o.paint.get("background-opacity");if(M===0)return;let{isRenderingToTexture:C}=p,z=g.context,P=z.gl,k=g.style.projection,L=g.transform,N=L.tileSize,G=o.paint.get("background-pattern");if(g.isPatternMissing(G))return;let $=!G&&T.a===1&&M===1&&g.opaquePassEnabledForLayer()?"opaque":"translucent";if(g.renderPass!==$)return;let J=Tt.disabled,W=g.getDepthModeForSublayer(0,$==="opaque"?dt.ReadWrite:dt.ReadOnly),ee=g.colorModeForRenderPass(),ae=g.useProgram(G?"backgroundPattern":"background"),te=h||Ro(L,{tileSize:N,terrain:g.style.map.terrain});G&&(z.activeTexture.set(P.TEXTURE0),g.imageManager.bind(g.context));let Q=o.getCrossfadeParameters();for(let re of te){let ie=L.getProjectionData({overscaledTileID:re,applyGlobeMatrix:!C,applyTerrainMatrix:!0}),me=G?Pd(M,g,G,{tileID:re,tileSize:N},Q):Go(M,T),Te=(v=g.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(re),Se=k.getMeshFromTileID(z,re.canonical,!1,!0,"raster");ae.draw(z,P.TRIANGLES,W,J,ee,wt.backCCW,me,Te,ie,o.id,Se.vertexBuffer,Se.indexBuffer,Se.segments)}},sky:function(g,t){let o=g.context,h=o.gl,p=((P,k,L)=>{let N=Math.cos(k.rollInRadians),G=Math.sin(k.rollInRadians),$=da(k),J=k.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:P.properties.get("sky-color"),u_horizon_color:P.properties.get("horizon-color"),u_horizon:[(k.width/2-$*G)*L,(k.height/2+$*N)*L],u_horizon_normal:[-G,N],u_sky_horizon_blend:P.properties.get("sky-horizon-blend")*k.height/2*L,u_sky_blend:J}})(t,g.style.map.transform,g.pixelRatio),v=new dt(h.LEQUAL,dt.ReadWrite,[0,1]),T=Tt.disabled,M=g.colorModeForRenderPass(),C=g.useProgram("sky"),z=jd(o,t);C.draw(o,h.TRIANGLES,v,T,M,wt.disabled,p,null,void 0,"sky",z.vertexBuffer,z.indexBuffer,z.segments)},atmosphere:function(g,t,o){let h=g.context,p=h.gl,v=g.useProgram("atmosphere"),T=new dt(p.LEQUAL,dt.ReadOnly,[0,1]),M=g.transform,C=(function(J,W){let ee=J.properties.get("position"),ae=[-ee.x,-ee.y,-ee.z],te=l.ap(new Float64Array(16));return J.properties.get("anchor")==="map"&&(l.be(te,te,W.rollInRadians),l.bf(te,te,-W.pitchInRadians),l.be(te,te,W.bearingInRadians),l.bf(te,te,W.center.lat*Math.PI/180),l.bI(te,te,-W.center.lng*Math.PI/180)),l.cg(ae,ae,te),ae})(o,g.transform),z=M.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),P=t.properties.get("atmosphere-blend")*z.projectionTransition;if(P===0)return;let k=_r(M.worldSize,M.center.lat),L=M.inverseProjectionMatrix,N=new Float64Array(4);N[3]=1,l.aE(N,N,M.modelViewProjectionMatrix),N[0]/=N[3],N[1]/=N[3],N[2]/=N[3],N[3]=1,l.aE(N,N,L),N[0]/=N[3],N[1]/=N[3],N[2]/=N[3],N[3]=1;let G=((J,W,ee,ae,te)=>({u_sun_pos:J,u_atmosphere_blend:W,u_globe_position:ee,u_globe_radius:ae,u_inv_proj_matrix:te}))(C,P,[N[0],N[1],N[2]],k,L),$=jd(h,t);v.draw(h,p.TRIANGLES,T,Tt.disabled,ei.alphaBlended,wt.disabled,G,null,null,"atmosphere",$.vertexBuffer,$.indexBuffer,$.segments)},custom:function(g,t,o,h){let{isRenderingGlobe:p}=h,v=g.context,T=o.implementation,M=g.style.projection,C=g.transform,z=C.getProjectionDataForCustomLayer(p),P={farZ:C.farZ,nearZ:C.nearZ,fov:C.fov*Math.PI/180,modelViewProjectionMatrix:C.modelViewProjectionMatrix,projectionMatrix:C.projectionMatrix,shaderData:{variantName:M.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
799
+ uniform mat4 u_projection_matrix;
800
+ ${M.shaderPreludeCode.vertexSource}`,define:M.shaderDefine},defaultProjectionData:z},k=T.renderingMode?T.renderingMode:"2d";if(g.renderPass==="offscreen"){let L=T.prerender;L&&(g.setCustomLayerDefaults(),v.setColorMode(g.colorModeForRenderPass()),L.call(T,v.gl,P),v.setDirty(),g.setBaseState())}else if(g.renderPass==="translucent"){g.setCustomLayerDefaults(),v.setColorMode(g.colorModeForRenderPass()),v.setStencilMode(Tt.disabled);let L=k==="3d"?g.getDepthModeFor3D():g.getDepthModeForSublayer(0,dt.ReadOnly);v.setDepthMode(L),T.render(v.gl,P),v.setDirty(),g.setBaseState(),v.bindFramebuffer.set(null)}},debug:function(g,t,o){for(let h of o)Mm(g,t,h)},debugPadding:function(g){let t=g.transform.padding;Nd(g,g.transform.height-(t.top||0),3,xm),Nd(g,t.bottom||0,3,wm),Ud(g,t.left||0,3,Tm),Ud(g,g.transform.width-(t.right||0),3,Sm);let o=g.transform.centerPoint;(function(h,p,v,T){nc(h,p-1,v-10,2,20,T),nc(h,p-10,v-1,20,2,T)})(g,o.x,g.transform.height-o.y,oo)},terrainDepth:function(g,t){let o=g.context,h=o.gl,p=g.transform,v=ei.unblended,T=new dt(h.LEQUAL,dt.ReadWrite,[0,1]),M=t.tileManager.getRenderableTiles(),C=g.useProgram("terrainDepth");o.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),o.viewport.set([0,0,g.width/devicePixelRatio,g.height/devicePixelRatio]),o.clear({color:l.bo.transparent,depth:1});for(let z of M){let P=t.getTerrainMesh(z.tileID),k=t.getTerrainData(z.tileID),L=p.getProjectionData({overscaledTileID:z.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),N={u_ele_delta:t.getMeshFrameDelta(p.zoom)};C.draw(o,h.TRIANGLES,T,Tt.disabled,v,wt.backCCW,N,k,L,"terrain",P.vertexBuffer,P.indexBuffer,P.segments)}o.bindFramebuffer.set(null),o.viewport.set([0,0,g.width,g.height])},terrainCoords:function(g,t){let o=g.context,h=o.gl,p=g.transform,v=ei.unblended,T=new dt(h.LEQUAL,dt.ReadWrite,[0,1]),M=t.getCoordsTexture(),C=t.tileManager.getRenderableTiles(),z=g.useProgram("terrainCoords");o.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),o.viewport.set([0,0,g.width/devicePixelRatio,g.height/devicePixelRatio]),o.clear({color:l.bo.transparent,depth:1}),t.coordsIndex=[];for(let P of C){let k=t.getTerrainMesh(P.tileID),L=t.getTerrainData(P.tileID);o.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,M.texture);let N={u_terrain_coords_id:(255-t.coordsIndex.length)/255,u_texture:0,u_ele_delta:t.getMeshFrameDelta(p.zoom)},G=p.getProjectionData({overscaledTileID:P.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});z.draw(o,h.TRIANGLES,T,Tt.disabled,v,wt.backCCW,N,L,G,"terrain",k.vertexBuffer,k.indexBuffer,k.segments),t.coordsIndex.push(P.tileID.key)}o.bindFramebuffer.set(null),o.viewport.set([0,0,g.width,g.height])}};class rc{constructor(t,o){this.drawFunctions=Em,this.context=new xu(t),this.transform=o,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:l.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=wn.maxOverzooming+wn.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new lr}resize(t,o,h){if(this.width=Math.floor(t*h),this.height=Math.floor(o*h),this.pixelRatio=h,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let p of this.style._order)this.style._layers[p].resize()}setup(){let t=this.context,o=new l.aU;o.emplaceBack(0,0),o.emplaceBack(l.a6,0),o.emplaceBack(0,l.a6),o.emplaceBack(l.a6,l.a6),this.tileExtentBuffer=t.createVertexBuffer(o,no.members),this.tileExtentSegments=l.aV.simpleSegment(0,0,4,2);let h=new l.aU;h.emplaceBack(0,0),h.emplaceBack(l.a6,0),h.emplaceBack(0,l.a6),h.emplaceBack(l.a6,l.a6),this.debugBuffer=t.createVertexBuffer(h,no.members),this.debugSegments=l.aV.simpleSegment(0,0,4,5);let p=new l.ch;p.emplaceBack(0,0,0,0),p.emplaceBack(l.a6,0,l.a6,0),p.emplaceBack(0,l.a6,0,l.a6),p.emplaceBack(l.a6,l.a6,l.a6,l.a6),this.rasterBoundsBuffer=t.createVertexBuffer(p,Hl.members),this.rasterBoundsSegments=l.aV.simpleSegment(0,0,4,2);let v=new l.aU;v.emplaceBack(0,0),v.emplaceBack(l.a6,0),v.emplaceBack(0,l.a6),v.emplaceBack(l.a6,l.a6),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(v,no.members),this.rasterBoundsSegmentsPosOnly=l.aV.simpleSegment(0,0,4,5);let T=new l.aU;T.emplaceBack(0,0),T.emplaceBack(1,0),T.emplaceBack(0,1),T.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(T,no.members),this.viewportSegments=l.aV.simpleSegment(0,0,4,2);let M=new l.ci;M.emplaceBack(0),M.emplaceBack(1),M.emplaceBack(3),M.emplaceBack(2),M.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(M);let C=new l.aW;C.emplaceBack(1,0,2),C.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(C);let z=this.context.gl;this.stencilClearMode=new Tt({func:z.ALWAYS,mask:0},0,255,z.ZERO,z.ZERO,z.ZERO),this.tileExtentMesh=new Jt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,o=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let h=l.O();l.c7(h,0,this.width,this.height,0,0,1),l.S(h,h,[o.drawingBufferWidth,o.drawingBufferHeight,0]);let p={mainMatrix:h,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:h};this.useProgram("clippingMask",null,!0).draw(t,o.TRIANGLES,dt.disabled,this.stencilClearMode,ei.disabled,wt.disabled,null,null,p,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,o,h){if(this.currentStencilSource===t.source||!t.isTileClipped()||!o?.length)return;this.currentStencilSource=t.source,this.nextStencilID+o.length>256&&this.clearStencil();let p=this.context;p.setColorMode(ei.disabled),p.setDepthMode(dt.disabled);let v={};for(let T of o)v[T.key]=this.nextStencilID++;this._renderTileMasks(v,o,h,!0),this._renderTileMasks(v,o,h,!1),this._tileClippingMaskIDs=v}_renderTileMasks(t,o,h,p){var v;let T=this.context,M=T.gl,C=this.style.projection,z=this.transform,P=this.useProgram("clippingMask");for(let k of o){let L=t[k.key],N=(v=this.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(k),G=C.getMeshFromTileID(this.context,k.canonical,p,!0,"stencil"),$=z.getProjectionData({overscaledTileID:k,applyGlobeMatrix:!h,applyTerrainMatrix:!0});P.draw(T,M.TRIANGLES,dt.disabled,new Tt({func:M.ALWAYS,mask:0},L,255,M.KEEP,M.KEEP,M.REPLACE),ei.disabled,h?wt.disabled:wt.backCCW,null,N,$,"$clipping",G.vertexBuffer,G.indexBuffer,G.segments)}}_renderTilesDepthBuffer(){var t;let o=this.context,h=o.gl,p=this.style.projection,v=this.transform,T=this.useProgram("depth"),M=this.getDepthModeFor3D(),C=Ro(v,{tileSize:v.tileSize});for(let z of C){let P=(t=this.style.map.terrain)===null||t===void 0?void 0:t.getTerrainData(z),k=p.getMeshFromTileID(this.context,z.canonical,!0,!0,"raster"),L=v.getProjectionData({overscaledTileID:z,applyGlobeMatrix:!0,applyTerrainMatrix:!0});T.draw(o,h.TRIANGLES,M,Tt.disabled,ei.disabled,wt.backCCW,null,P,L,"$clipping",k.vertexBuffer,k.indexBuffer,k.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,o=this.context.gl;return new Tt({func:o.NOTEQUAL,mask:255},t,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(t){let o=this.context.gl;return new Tt({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,o.KEEP,o.KEEP,o.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let o=this.context.gl,h=t.sort(((T,M)=>M.overscaledZ-T.overscaledZ)),p=h[h.length-1].overscaledZ,v=h[0].overscaledZ-p+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();let T={};for(let M=0;M<v;M++)T[M+p]=new Tt({func:o.GEQUAL,mask:255},M+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=v,[T,h]}return[{[p]:Tt.disabled},h]}stencilConfigForOverlapTwoPass(t){let o=this.context.gl,h=t.sort(((T,M)=>M.overscaledZ-T.overscaledZ)),p=h[h.length-1].overscaledZ,v=h[0].overscaledZ-p+1;if(this.clearStencil(),v>1){let T={},M={};for(let C=0;C<v;C++)T[C+p]=new Tt({func:o.GREATER,mask:255},v+1+C,255,o.KEEP,o.KEEP,o.REPLACE),M[C+p]=new Tt({func:o.GREATER,mask:255},1+C,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID=2*v+1,[T,M,h]}return this.nextStencilID=3,[{[p]:new Tt({func:o.GREATER,mask:255},2,255,o.KEEP,o.KEEP,o.REPLACE)},{[p]:new Tt({func:o.GREATER,mask:255},1,255,o.KEEP,o.KEEP,o.REPLACE)},h]}colorModeForRenderPass(){let t=this.context.gl;return this._showOverdrawInspector?new ei([t.CONSTANT_COLOR,t.ONE],new l.bo(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ei.unblended:ei.alphaBlended}getDepthModeForSublayer(t,o,h){if(!this.opaquePassEnabledForLayer())return dt.disabled;let p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new dt(h||this.context.gl.LEQUAL,o,[p,p])}getDepthModeFor3D(){return new dt(this.context.gl.LEQUAL,dt.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,o){var h,p,v;this.style=t,this.options=o,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(le()),this.imageManager.beginFrame();let T=this.style._order,M=this.style.tileManagers,C={},z={},P={},k={isRenderingToTexture:!1,isRenderingGlobe:((h=t.projection)===null||h===void 0?void 0:h.transitionState)>0};for(let N in M){let G=M[N];G.used&&G.prepare(this.context),C[N]=G.getVisibleCoordinates(!1),z[N]=C[N].slice().reverse(),P[N]=G.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let N=0;N<T.length;N++)if(this.style._layers[T[N]].is3D()){this.opaquePassCutoff=N;break}this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let N of T){let G=this.style._layers[N];if(!G.hasOffscreenPass()||G.isHidden(this.transform.zoom))continue;let $=z[G.source];(G.type==="custom"||$.length)&&this.renderLayer(this,M[G.source],G,$,k)}if((p=this.style.projection)===null||p===void 0||p.updateGPUdependent({context:this.context,useProgram:N=>this.useProgram(N)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:o.showOverdrawInspector?l.bo.black:l.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=o.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=T.length-1;this.currentLayer>=0;this.currentLayer--){let N=this.style._layers[T[this.currentLayer]],G=M[N.source],$=C[N.source];this._renderTileClippingMasks(N,$,!1),this.renderLayer(this,G,N,$,k)}this.renderPass="translucent";let L=!1;for(this.currentLayer=0;this.currentLayer<T.length;this.currentLayer++){let N=this.style._layers[T[this.currentLayer]],G=M[N.source];if(!((v=this.renderToTexture)===null||v===void 0)&&v.renderLayer(N,k))continue;this.opaquePassEnabledForLayer()||L||(L=!0,k.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let $=(N.type==="symbol"?P:z)[N.source];this._renderTileClippingMasks(N,C[N.source],!!this.renderToTexture),this.renderLayer(this,G,N,$,k)}if(k.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let N=(function(G,$){let J=null,W=Object.values(G._layers).flatMap((Q=>Q.source&&!Q.isHidden($)?[G.tileManagers[Q.source]]:[])),ee=W.filter((Q=>Q.getSource().type==="vector")),ae=W.filter((Q=>Q.getSource().type!=="vector")),te=Q=>{(!J||J.getSource().maxzoom<Q.getSource().maxzoom)&&(J=Q)};for(let Q of ee)te(Q);if(!J)for(let Q of ae)te(Q);return J})(this.style,this.transform.zoom);N&&this.drawFunctions.debug(this,N,N.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(t){var o,h;if(!(!((h=(o=this.style)===null||o===void 0?void 0:o.map)===null||h===void 0)&&h.terrain))return;let p=this.terrainFacilitator.matrix,v=this.transform.modelViewProjectionMatrix,T=this.terrainFacilitator.depthDirty;T||(T=t?!l.cj(p,v):!l.ck(p,v)),T||(T=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),T&&(l.cl(p,v),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var t,o;!((o=(t=this.style)===null||t===void 0?void 0:t.map)===null||o===void 0)&&o.terrain&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(t,o,h,p,v){if(h.isHidden(this.transform.zoom)||h.type!=="background"&&h.type!=="custom"&&!(p||[]).length)return;this.id=h.id;let T=this.drawFunctions;l.aQ(h)?T.symbol(t,o,h,p,this.style.placement.variableOffsets,v):l.cm(h)?T.circle(t,o,h,p,v):l.cn(h)?T.heatmap(t,o,h,p,v):l.co(h)?T.line(t,o,h,p,v):l.cp(h)?T.fill(t,o,h,p,v):l.cq(h)?T.fillExtrusion(t,o,h,p,v):l.cr(h)?T.hillshade(t,o,h,p,v):l.cs(h)?T.colorRelief(t,o,h,p,v):l.bU(h)?T.raster(t,o,h,p,v):l.ct(h)?T.background(t,o,h,p,v):l.cu(h)&&T.custom(t,o,h,v)}saveTileTexture(t){let o=this._tileTextures[t.size[0]];o?o.length<rc.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?o.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let o=this._tileTextures[t];return o&&o.length>0?o.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let o=this.imageManager.getPattern(t.from.toString()),h=this.imageManager.getPattern(t.to.toString());return!o||!h}useProgram(t,o,h=!1,p=[]){var v;this.cache||(this.cache={});let T=!!this.style.map.terrain,M=this.style.projection,C=h?yi.projectionMercator:M.shaderPreludeCode,z=h?$n:M.shaderDefine,P=t+(o?o.cacheKey:"")+`/${h?gr:M.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(T?"/terrain":"")+(p?`/${p.join("/")}`:"");return(v=this.cache)[P]||(v[P]=new p1(this.context,yi[t],o,_1[t],this._showOverdrawInspector,T,C,z,p)),this.cache[P]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new l.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,o;if(this._tileTextures){for(let h in this._tileTextures){let p=this._tileTextures[h];if(p)for(let v of p)v.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((o=this.tileExtentMesh.indexBuffer)===null||o===void 0||o.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let h in this.cache){let p=this.cache[h];p?.program&&this.context.gl.deleteProgram(p.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:o}=this.context.gl;return this.width!==t||this.height!==o}}function qd(g,t){let o,h=!1,p=null,v=()=>{p=null,h&&(g(...o),p=setTimeout(v,t),h=!1)};return(...T)=>(h=!0,o=T,p||v(),p)}rc.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class ac{constructor(t){this._getCurrentHash=()=>{let o=window.location.hash.replace("#","");if(this._hashName){let h,p=o.split("&").map((v=>v.split("=")));for(let v of p)v[0]===this._hashName&&(h=v);return(h&&h[1]||"").split("/")}return o.split("/")},this._onHashChange=()=>{let o=this._getCurrentHash();if(!this._isValidHash(o))return!1;let h=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(o[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:h,pitch:+(o[4]||0)}),!0},this._updateHashUnthrottled=()=>{let o=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,o)},this._removeHash=()=>{let o=this._getCurrentHash();if(o.length===0)return;let h=o.join("/"),p=h;p.split("&").length>0&&(p=p.split("&")[0]),this._hashName&&(p=`${this._hashName}=${h}`);let v=window.location.hash.replace(p,"");v.startsWith("#&")?v=v.slice(0,1)+v.slice(2):v==="#"&&(v="");let T=window.location.href.replace(/(#.+)?$/,v);T=T.replace("&&","&"),window.history.replaceState(window.history.state,null,T)},this._updateHash=qd(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){let o=this._map.getCenter(),h=Math.round(100*this._map.getZoom())/100,p=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,p),T=Math.round(o.lng*v)/v,M=Math.round(o.lat*v)/v,C=this._map.getBearing(),z=this._map.getPitch(),P="";if(P+=t?`/${T}/${M}/${h}`:`${h}/${M}/${T}`,(C||z)&&(P+="/"+Math.round(10*C)/10),z&&(P+=`/${Math.round(z)}`),this._hashName){let k=this._hashName,L=!1,N=window.location.hash.slice(1).split("&").map((G=>{let $=G.split("=")[0];return $===k?(L=!0,`${$}=${P}`):G})).filter((G=>G));return L||N.push(`${k}=${P}`),`#${N.join("&")}`}return`#${P}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new l.W(+t[2],+t[1])}catch{return!1}let o=+t[0],h=+(t[3]||0),p=+(t[4]||0);return o>=this._map.getMinZoom()&&o<=this._map.getMaxZoom()&&h>=-180&&h<=180&&p>=this._map.getMinPitch()&&p<=this._map.getMaxPitch()}}let Ws={linearity:.3,easing:l.cv(0,0,.3,1)},Pr=l.e({deceleration:2500,maxSpeed:1400},Ws),Yr=l.e({deceleration:20,maxSpeed:1400},Ws),Cm=l.e({deceleration:1e3,maxSpeed:360},Ws),Wr=l.e({deceleration:1e3,maxSpeed:90},Ws),C1=l.e({deceleration:1e3,maxSpeed:360},Ws);class A1{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:le(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,o=le();for(;t.length>0&&o-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let o={zoom:0,bearing:0,pitch:0,roll:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:v}of this._inertiaBuffer)o.zoom+=v.zoomDelta||0,o.bearing+=v.bearingDelta||0,o.pitch+=v.pitchDelta||0,o.roll+=v.rollDelta||0,v.panDelta&&o.pan._add(v.panDelta),v.around&&(o.around=v.around),v.pinchAround&&(o.pinchAround=v.pinchAround);let h=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(o.pan.mag()){let v=ma(o.pan.mag(),h,l.e({},Pr,t||{})),T=o.pan.mult(v.amount/o.pan.mag()),M=this._map.cameraHelper.handlePanInertia(T,this._map.transform);p.center=M.easingCenter,p.offset=M.easingOffset,oc(p,v)}if(o.zoom){let v=ma(o.zoom,h,Yr);p.zoom=l.cw(this._map.transform.zoom+v.amount,this._map.getZoomSnap(),v.amount),oc(p,v)}if(o.bearing){let v=ma(o.bearing,h,Cm);p.bearing=this._map.transform.bearing+l.al(v.amount,-179,179),oc(p,v)}if(o.pitch){let v=ma(o.pitch,h,Wr);p.pitch=this._map.transform.pitch+v.amount,oc(p,v)}if(o.roll){let v=ma(o.roll,h,C1);p.roll=this._map.transform.roll+l.al(v.amount,-179,179),oc(p,v)}if(p.zoom||p.bearing){let v=o.pinchAround===void 0?o.around:o.pinchAround;p.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),l.e(p,{noMoveStart:!0})}}function oc(g,t){(!g.duration||g.duration<t.duration)&&(g.duration=t.duration,g.easing=t.easing)}function ma(g,t,o){let{maxSpeed:h,linearity:p,deceleration:v}=o,T=l.al(g*p/(t/1e3),-h,h),M=Math.abs(T)/(v*p);return{easing:o.easing,duration:1e3*M,amount:T*(M/2)}}class vr extends l.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,h,p={}){h=h instanceof MouseEvent?h:new MouseEvent(t,h);let v=ye.mousePos(o.getCanvas(),h),T=o.unproject(v);super(t,l.e({point:v,lngLat:T,originalEvent:h},p)),this._defaultPrevented=!1,this.target=o}}class sc extends l.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,h){let p=t==="touchend"?h.changedTouches:h.touches,v=ye.touchPos(o.getCanvasContainer(),p),T=v.map((C=>o.unproject(C))),M=v.reduce(((C,z,P,k)=>C.add(z.div(k.length))),new l.P(0,0));super(t,{points:v,point:M,lngLats:T,lngLat:o.unproject(M),originalEvent:h}),this._defaultPrevented=!1}}class Am extends l.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,h){super(t,{originalEvent:h}),this._defaultPrevented=!1}}class z1{constructor(t,o){this._map=t,this._clickTolerance=o.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Am(t.type,this._map,t))}mousedown(t,o){return this._mousedownPos=o,this._firePreventable(new vr(t.type,this._map,t))}mouseup(t){this._map.fire(new vr(t.type,this._map,t))}click(t,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||this._map.fire(new vr(t.type,this._map,t))}dblclick(t){return this._firePreventable(new vr(t.type,this._map,t))}mouseover(t){this._map.fire(new vr(t.type,this._map,t))}mouseout(t){this._map.fire(new vr(t.type,this._map,t))}touchstart(t){return this._firePreventable(new sc(t.type,this._map,t))}touchmove(t){this._map.fire(new sc(t.type,this._map,t))}touchend(t){this._map.fire(new sc(t.type,this._map,t))}touchcancel(t){this._map.fire(new sc(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class zm{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new vr(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new vr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class La{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(l.P.convert(t),this._map.terrain)}}class ga{constructor(t,o){this._map=t,this._tr=new La(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=o.clickTolerance||1,o.boxZoom&&typeof o.boxZoom=="object"&&(this._boxZoomEnd=o.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,o){this.isEnabled()&&t.shiftKey&&t.button===0&&(ye.disableDrag(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(t,o){if(!this._active)return;let h=o;if(this._lastPos.equals(h)||!this._box&&h.dist(this._startPos)<this._clickTolerance)return;let p=this._startPos;this._lastPos=h,this._box||(this._box=ye.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));let v=Math.min(p.x,h.x),T=Math.max(p.x,h.x),M=Math.min(p.y,h.y),C=Math.max(p.y,h.y);this._box.style.transform=`translate(${v}px,${M}px)`,this._box.style.width=T-v+"px",this._box.style.height=C-M+"px"}mouseupWindow(t,o){if(!this._active||t.button!==0)return;let h=this._startPos,p=o;if(this.reset(),ye.suppressClick(),h.x!==p.x||h.y!==p.y)return this._map.fire(new l.n("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,h,p,t):{cameraAnimation:v=>v.fitScreenCoordinates(h,p,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),ye.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,o){return this._map.fire(new l.n(t,{originalEvent:o}))}}function Ye(g,t){if(g.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${g.length}, points ${t.length}`);let o={};for(let h=0;h<g.length;h++)o[g[h].identifier]=t[h];return o}class Dm{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,o,h){(this.centroid||h.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),h.length===this.numTouches&&(this.centroid=(function(p){let v=new l.P(0,0);for(let T of p)v._add(T);return v.div(p.length)})(o),this.touches=Ye(h,o)))}touchmove(t,o,h){if(this.aborted||!this.centroid)return;let p=Ye(h,o);for(let v in this.touches){let T=p[v];(!T||T.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(t,o,h){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),h.length===0){let p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class lc{constructor(t){this.singleTap=new Dm(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,o,h){this.singleTap.touchstart(t,o,h)}touchmove(t,o,h){this.singleTap.touchmove(t,o,h)}touchend(t,o,h){let p=this.singleTap.touchend(t,o,h);if(p){let v=t.timeStamp-this.lastTime<500,T=!this.lastTap||this.lastTap.dist(p)<30;if(v&&T||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class Pm{constructor(t){this._tr=new La(t),this._zoomIn=new lc({numTouches:1,numTaps:2}),this._zoomOut=new lc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,o,h){this._zoomIn.touchstart(t,o,h),this._zoomOut.touchstart(t,o,h)}touchmove(t,o,h){this._zoomIn.touchmove(t,o,h),this._zoomOut.touchmove(t,o,h)}touchend(t,o,h){let p=this._zoomIn.touchend(t,o,h),v=this._zoomOut.touchend(t,o,h),T=this._tr;return p?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:l.cw(T.zoom+1,M.getZoomSnap()),around:T.unproject(p)},{originalEvent:t})}):v?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:l.cw(T.zoom-1,M.getZoomSnap()),around:T.unproject(v)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Oa{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let o=this._moveFunction(...t);if(o.bearingDelta||o.pitchDelta||o.rollDelta||o.around||o.panDelta)return this._active=!0,o}dragStart(t,o){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(o)?o[0]:o,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,o){if(!this.isEnabled())return;let h=this._lastPoint;if(!h)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let p=Array.isArray(o)?o[0]:o;return!this._moved&&p.dist(h)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=p,this._move(h,p))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&ye.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let cc=0,Gd=2,D1={[cc]:1,[Gd]:2};class Wo{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(o,h){let p=D1[h];return o.buttons===void 0||(o.buttons&p)!==p})(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}}class Rm{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class Zd{constructor(t=new Wo({checkCorrectEvent:()=>!0}),o=new Rm){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=o}_executeRelevantHandler(t,o,h){return t instanceof MouseEvent?o(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?h(t):void 0}startMove(t){this._executeRelevantHandler(t,(o=>{this.mouseMoveStateManager.startMove(o)}),(o=>{this.oneFingerTouchMoveStateManager.startMove(o)}))}endMove(t){this._executeRelevantHandler(t,(o=>{this.mouseMoveStateManager.endMove(o)}),(o=>{this.oneFingerTouchMoveStateManager.endMove(o)}))}isValidStartEvent(t){return this._executeRelevantHandler(t,(o=>this.mouseMoveStateManager.isValidStartEvent(o)),(o=>this.oneFingerTouchMoveStateManager.isValidStartEvent(o)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(o=>this.mouseMoveStateManager.isValidMoveEvent(o)),(o=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(o)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(o=>this.mouseMoveStateManager.isValidEndEvent(o)),(o=>this.oneFingerTouchMoveStateManager.isValidEndEvent(o)))}}let Mu=g=>{g.mousedown=g.dragStart,g.mousemoveWindow=g.dragMove,g.mouseup=g.dragEnd,g.contextmenu=t=>{t.preventDefault()}};class Im{constructor(t,o){this._clickTolerance=t.clickTolerance||1,this._map=o,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,o,h){return this._calculateTransform(t,o,h)}touchmove(t,o,h){if(this._active){if(!this._shouldBePrevented(h.length))return t.preventDefault(),this._calculateTransform(t,o,h);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,o,h){this._calculateTransform(t,o,h),this._active&&this._shouldBePrevented(h.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,o,h){h.length>0&&(this._active=!0);let p=Ye(h,o),v=new l.P(0,0),T=new l.P(0,0),M=0;for(let z in p){let P=p[z],k=this._touches[z];k&&(v._add(P),T._add(P.sub(k)),M++,p[z]=P)}if(this._touches=p,this._shouldBePrevented(M)||!T.mag())return;let C=T.div(M);return this._sum._add(C),this._sum.mag()<this._clickTolerance?void 0:{around:v.div(M),panDelta:C}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Hd{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,o,h){this._firstTwoTouches||h.length<2||(this._firstTwoTouches=[h[0].identifier,h[1].identifier],this._start([o[0],o[1]]))}touchmove(t,o,h){if(!this._firstTwoTouches)return;t.preventDefault();let[p,v]=this._firstTwoTouches,T=Eu(h,o,p),M=Eu(h,o,v);if(!T||!M)return;let C=this._aroundCenter?null:T.add(M).div(2);return this._move([T,M],C,t)}touchend(t,o,h){if(!this._firstTwoTouches)return;let[p,v]=this._firstTwoTouches,T=Eu(h,o,p),M=Eu(h,o,v);T&&M||(this._active&&ye.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Eu(g,t,o){for(let h=0;h<g.length;h++)if(g[h].identifier===o)return t[h]}function $d(g,t){return Math.log(g/t)/Math.LN2}class km extends Hd{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=t??1}setZoomThreshold(t){this._zoomThreshold=t??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,o){let h=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs($d(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:$d(this._distance,h)*this._zoomRate,pinchAround:o}}}function Xd(g,t){return 180*g.angleWith(t)/Math.PI}class Lm extends Hd{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,o,h){let p=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Xd(this._vector,p),pinchAround:o}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());let o=25/(Math.PI*this._minDiameter)*360,h=Xd(t,this._startVector);return Math.abs(h)<o}}function Yd(g){return Math.abs(g.y)>Math.abs(g.x)}class Ba extends Hd{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,o,h){super.touchstart(t,o,h),this._currentTouchCount=h.length}_start(t){this._lastPoints=t,Yd(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,o,h){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let p=t[0].sub(this._lastPoints[0]),v=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(p,v,h.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(t,o,h){if(this._valid!==void 0)return this._valid;let p=t.mag()>=2,v=o.mag()>=2;if(!p&&!v)return;if(!p||!v)return this._firstMove===void 0&&(this._firstMove=h),h-this._firstMove<100&&void 0;let T=t.y>0==o.y>0;return Yd(t)&&Yd(o)&&T}}let ti={panStep:100,bearingStep:15,pitchStep:10};class Om{constructor(t){this._tr=new La(t);let o=ti;this._panStep=o.panStep,this._bearingStep=o.bearingStep,this._pitchStep=o.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let o=0,h=0,p=0,v=0,T=0;switch(t.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:t.shiftKey?h=-1:(t.preventDefault(),v=-1);break;case 39:t.shiftKey?h=1:(t.preventDefault(),v=1);break;case 38:t.shiftKey?p=1:(t.preventDefault(),T=-1);break;case 40:t.shiftKey?p=-1:(t.preventDefault(),T=1);break;default:return}return this._rotationDisabled&&(h=0,p=0),{cameraAnimation:M=>{let C=this._tr;M.easeTo({duration:300,easeId:"keyboardHandler",easing:Cu,zoom:o?l.cw(C.zoom+o*(t.shiftKey?2:1),M.getZoomSnap()):C.zoom,bearing:C.bearing+h*this._bearingStep,pitch:C.pitch+p*this._pitchStep,offset:[-v*this._panStep,-T*this._panStep],center:C.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Cu(g){return g*(2-g)}let uc=4.000244140625,Wd=1/450;class Kd{constructor(t,o){this._onTimeout=h=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(h)},this._map=t,this._tr=new La(t),this._triggerRenderFrame=o,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Wd}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let o=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,h=le(),p=h-(this._lastWheelEventTime||0);this._lastWheelEventTime=h,o!==0&&o%uc==0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=o,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(p*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),t.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=t,this._delta-=o,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let o=ye.mousePos(this._map.getCanvas(),t),h=this._tr;this._aroundPoint=this._aroundCenter?h.transform.locationToScreenPoint(l.W.convert(h.center)):o,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let M=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=M),typeof this._targetZoom=="number"&&(this._targetZoom+=M)}if(this._delta!==0){let M=this._type==="wheel"&&Math.abs(this._delta)>uc?this._wheelZoomRate:this._defaultZoomRate,C=2/(1+Math.exp(-Math.abs(this._delta*M)));this._delta<0&&C!==0&&(C=1/C);let z=typeof this._targetZoom!="number"?t.scale:l.ao(this._targetZoom),P=t.applyConstrain(t.getCameraLngLat(),l.ar(z*C)).zoom,k=this._map.getZoomSnap();if(this._type==="wheel"&&k>0){let L=l.cw(t.zoom,k);this._targetZoom=l.cw(P,k,P-L)}else this._targetZoom=P;this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let o=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,h=this._startZoom,p=this._easing,v,T=!1;if(this._type==="wheel"&&h&&p){let M=le()-this._lastWheelEventTime,C=Math.min((M+5)/200,1),z=p(C);v=l.H.number(h,o,z),C<1?this._needsRerender=!0:T=!0}else v=o,T=!0;return this._active=!0,T&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=v,{noInertia:!0,needsRenderFrame:!T,zoomDelta:v-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let o=l.cy;if(this._prevEase){let h=this._prevEase,p=(le()-h.start)/h.duration,v=h.easing(p+.01)-h.easing(p),T=.27/Math.sqrt(v*v+1e-4)*.01,M=Math.sqrt(.0729-T*T);o=l.cv(T,M,.25,1)}return this._prevEase={start:le(),duration:t,easing:o},o}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Qd{constructor(t,o){this._clickZoom=t,this._tapZoom=o}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Bm{constructor(t){this._tr=new La(t),this.reset()}reset(){this._active=!1}dblclick(t,o){return t.preventDefault(),{cameraAnimation:h=>{h.easeTo({duration:300,zoom:l.cw(this._tr.zoom+(t.shiftKey?-1:1),h.getZoomSnap()),around:this._tr.unproject(o)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class P1{constructor(){this._tap=new lc({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,o,h){if(!this._swipePoint)if(this._tapTime){let p=o[0],v=t.timeStamp-this._tapTime<500,T=this._tapPoint.dist(p)<30;v&&T?h.length>0&&(this._swipePoint=p,this._swipeTouch=h[0].identifier):this.reset()}else this._tap.touchstart(t,o,h)}touchmove(t,o,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;let p=o[0],v=p.y-this._swipePoint.y;return this._swipePoint=p,t.preventDefault(),this._active=!0,{zoomDelta:v/128*this._zoomRate}}}else this._tap.touchmove(t,o,h)}touchend(t,o,h){if(this._tapTime)this._swipePoint&&h.length===0&&this.reset();else{let p=this._tap.touchend(t,o,h);p&&(this._tapTime=t.timeStamp,this._tapPoint=p)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Kr{constructor(t,o,h){this._el=t,this._mousePan=o,this._touchPan=h}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class hc{constructor(t,o,h,p){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=o,this._mousePitch=h,this._mouseRoll=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Je{constructor(t,o,h,p){this._el=t,this._touchZoom=o,this._touchRotate=h,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class it{constructor(t,o){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=o,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=ye.create("div","maplibregl-cooperative-gesture-screen",t);let o=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(o=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let h=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),p=document.createElement("div");p.className="maplibregl-desktop-message",p.textContent=o,this._container.appendChild(p);let v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=h,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,o){this._enabled&&(this._map.fire(new l.n("cooperativegestureprevented",{gestureType:t,originalEvent:o})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}let so=g=>g.zoom||g.drag||g.roll||g.pitch||g.rotate;class Fm extends l.n{}function Ks(g){var t;return((t=g.panDelta)===null||t===void 0?void 0:t.mag())||g.zoomDelta||g.bearingDelta||g.pitchDelta||g.rollDelta}class Yn{get _ownerDocument(){var t;return((t=this._el)===null||t===void 0?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,o;return((o=(t=this._el)===null||t===void 0?void 0:t.ownerDocument)===null||o===void 0?void 0:o.defaultView)||window}constructor(t,o){this.handleWindowEvent=p=>{this.handleEvent(p,`${p.type}Window`)},this.handleEvent=(p,v)=>{if(p.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let T=p.type==="renderFrame"?void 0:p,M={needsRenderFrame:!1},C={},z={};for(let{handlerName:L,handler:N,allowed:G}of this._handlers){if(!N.isEnabled())continue;let $;if(this._blockedByActive(z,G,L))N.reset();else if(N[v||p.type]){if(l.cz(p,v||p.type)){let J=ye.mousePos(this._map.getCanvas(),p);$=N[v||p.type](p,J)}else if(l.cA(p,v||p.type)){let J=this._getMapTouches(p.touches),W=ye.touchPos(this._map.getCanvas(),J);$=N[v||p.type](p,W,J)}else l.cB(v||p.type)||($=N[v||p.type](p));this.mergeHandlerResult(M,C,$,L,T),$?.needsRenderFrame&&this._triggerRenderFrame()}($||N.isActive())&&(z[L]=N)}let P={};for(let L in this._previousActiveHandlers)z[L]||(P[L]=T);this._previousActiveHandlers=z,(Object.keys(P).length||Ks(M))&&(this._changes.push([M,C,P]),this._triggerRenderFrame()),(Object.keys(z).length||Ks(M))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:k}=M;k&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],k(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new A1(t),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(o);let h=this._el;this._listeners=[[h,"touchstart",{passive:!0}],[h,"touchmove",{passive:!1}],[h,"touchend",void 0],[h,"touchcancel",void 0],[h,"mousedown",void 0],[h,"mousemove",void 0],[h,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[h,"mouseover",void 0],[h,"mouseout",void 0],[h,"dblclick",void 0],[h,"click",void 0],[h,"keydown",{capture:!1}],[h,"keyup",void 0],[h,"wheel",{passive:!1}],[h,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[p,v,T]of this._listeners)p.addEventListener(v,p===this._ownerDocument?this.handleWindowEvent:this.handleEvent,T)}destroy(){for(let[t,o,h]of this._listeners)t.removeEventListener(o,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,h)}_addDefaultHandlers(t){let o=this._map,h=o.getCanvasContainer();this._add("mapEvent",new z1(o,t));let p=o.boxZoom=new ga(o,t);this._add("boxZoom",p),t.interactive&&t.boxZoom&&p.enable();let v=o.cooperativeGestures=new it(o,t.cooperativeGestures);this._add("cooperativeGestures",v),t.cooperativeGestures&&v.enable();let T=new Pm(o),M=new Bm(o);o.doubleClickZoom=new Qd(M,T),this._add("tapZoom",T),this._add("clickZoom",M),t.interactive&&t.doubleClickZoom&&o.doubleClickZoom.enable();let C=new P1;this._add("tapDragZoom",C);let z=o.touchPitch=new Ba(o);this._add("touchPitch",z),t.interactive&&t.touchPitch&&o.touchPitch.enable(t.touchPitch);let P=()=>o.project(o.getCenter()),k=(function({enable:te,clickTolerance:Q,aroundCenter:re=!0,minPixelCenterThreshold:ie=100,rotateDegreesPerPixelMoved:me=.8},Te){let Se=new Wo({checkCorrectEvent:Ie=>Ie.button===0&&Ie.ctrlKey||Ie.button===2&&!Ie.ctrlKey});return new Oa({clickTolerance:Q,move:(Ie,Pe)=>{let Qe=Te();if(re&&Math.abs(Qe.y-Ie.y)>ie)return{bearingDelta:l.cx(new l.P(Ie.x,Pe.y),Pe,Qe)};let qe=(Pe.x-Ie.x)*me;return re&&Pe.y<Qe.y&&(qe=-qe),{bearingDelta:qe}},moveStateManager:Se,enable:te,assignEvents:Mu})})(t,P),L=(function({enable:te,clickTolerance:Q,pitchDegreesPerPixelMoved:re=-.5}){let ie=new Wo({checkCorrectEvent:me=>me.button===0&&me.ctrlKey||me.button===2});return new Oa({clickTolerance:Q,move:(me,Te)=>({pitchDelta:(Te.y-me.y)*re}),moveStateManager:ie,enable:te,assignEvents:Mu})})(t),N=(function({enable:te,clickTolerance:Q,rollDegreesPerPixelMoved:re=.3},ie){let me=new Wo({checkCorrectEvent:Te=>Te.button===2&&Te.ctrlKey});return new Oa({clickTolerance:Q,move:(Te,Se)=>{let Ie=ie(),Pe=(Se.x-Te.x)*re;return Se.y<Ie.y&&(Pe=-Pe),{rollDelta:Pe}},moveStateManager:me,enable:te,assignEvents:Mu})})(t,P);o.dragRotate=new hc(t,k,L,N),this._add("mouseRotate",k,["mousePitch"]),this._add("mousePitch",L,["mouseRotate","mouseRoll"]),this._add("mouseRoll",N,["mousePitch"]),t.interactive&&t.dragRotate&&o.dragRotate.enable();let G=(function({enable:te,clickTolerance:Q}){let re=new Wo({checkCorrectEvent:ie=>ie.button===0&&!ie.ctrlKey});return new Oa({clickTolerance:Q,move:(ie,me)=>({around:me,panDelta:me.sub(ie)}),activateOnStart:!0,moveStateManager:re,enable:te,assignEvents:Mu})})(t),$=new Im(t,o);o.dragPan=new Kr(h,G,$),this._add("mousePan",G),this._add("touchPan",$,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&o.dragPan.enable(t.dragPan);let J=new Lm,W=new km;o.touchZoomRotate=new Je(h,W,J,C),this._add("touchRotate",J,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&o.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new zm(o));let ee=o.scrollZoom=new Kd(o,(()=>this._triggerRenderFrame()));this._add("scrollZoom",ee,["mousePan"]),t.interactive&&t.scrollZoom&&o.scrollZoom.enable(t.scrollZoom);let ae=o.keyboard=new Om(o);this._add("keyboard",ae),t.interactive&&t.keyboard&&o.keyboard.enable()}_add(t,o,h){this._handlers.push({handlerName:t,handler:o,allowed:h}),this._handlersById[t]=o}stop(t){if(!this._updatingCamera){for(let{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!so(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,o,h){for(let p in t)if(p!==h&&!o?.includes(p))return!0;return!1}_getMapTouches(t){let o=[];for(let h of t)this._el.contains(h.target)&&o.push(h);return o}mergeHandlerResult(t,o,h,p,v){if(!h)return;l.e(t,h);let T={handlerName:p,originalEvent:h.originalEvent||v};h.zoomDelta!==void 0&&(o.zoom=T),h.panDelta!==void 0&&(o.drag=T),h.rollDelta!==void 0&&(o.roll=T),h.pitchDelta!==void 0&&(o.pitch=T),h.bearingDelta!==void 0&&(o.rotate=T)}_applyChanges(){let t={},o={},h={};for(let[p,v,T]of this._changes)p.panDelta&&(t.panDelta=(t.panDelta||new l.P(0,0))._add(p.panDelta)),p.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+p.pitchDelta),p.rollDelta&&(t.rollDelta=(t.rollDelta||0)+p.rollDelta),p.around!==void 0&&(t.around=p.around),p.pinchAround!==void 0&&(t.pinchAround=p.pinchAround),p.noInertia&&(t.noInertia=p.noInertia),l.e(o,v),l.e(h,T);this._updateMapTransform(t,o,h),this._changes=[]}_updateMapTransform(t,o,h){let p=this._map,v=p._getTransformForUpdate(),T=p.terrain;if(!(Ks(t)||T&&this._terrainMovement))return void this._fireEvents(o,h,!0);p._stop(!0);let{panDelta:M,zoomDelta:C,bearingDelta:z,pitchDelta:P,rollDelta:k,around:L,pinchAround:N}=t;N!==void 0&&(L=N),L||(L=p.transform.centerPoint),T&&!v.isPointOnMapSurface(L)&&(L=v.centerPoint);let G={panDelta:M,zoomDelta:C,rollDelta:k,pitchDelta:P,bearingDelta:z,around:L};this._map.cameraHelper.useGlobeControls&&!v.isPointOnMapSurface(L)&&(L=v.centerPoint);let $=L.distSqr(v.centerPoint)<.01?v.center:v.screenPointToLocation(M?L.sub(M):L);this._handleMapControls({terrain:T,tr:v,deltasForHelper:G,preZoomAroundLoc:$,combinedEventsInProgress:o,panDelta:M}),p._applyUpdatedTransform(v),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(o,h,!0)}_handleMapControls({terrain:t,tr:o,deltasForHelper:h,preZoomAroundLoc:p,combinedEventsInProgress:v,panDelta:T}){let M=this._map.cameraHelper;if(M.handleMapControlsRollPitchBearingZoom(h,o),t)return M.useGlobeControls?(this._terrainMovement||!v.drag&&!v.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void M.handleMapControlsPan(h,o,p)):this._terrainMovement||!v.drag&&!v.zoom?void(v.drag&&this._terrainMovement&&T?o.setCenter(o.screenPointToLocation(o.centerPoint.sub(T))):M.handleMapControlsPan(h,o,p)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void M.handleMapControlsPan(h,o,p));M.handleMapControlsPan(h,o,p)}_fireEvents(t,o,h){let p=so(this._eventsInProgress),v=so(t),T={};for(let k in t){let{originalEvent:L}=t[k];this._eventsInProgress[k]||(T[`${k}start`]=L),this._eventsInProgress[k]=t[k]}!p&&v&&this._fireEvent("movestart",v.originalEvent);for(let k in T)this._fireEvent(k,T[k]);v&&this._fireEvent("move",v.originalEvent);for(let k in t){let{originalEvent:L}=t[k];this._fireEvent(k,L)}let M={},C;for(let k in this._eventsInProgress){let{handlerName:L,originalEvent:N}=this._eventsInProgress[k];this._handlersById[L].isActive()||(delete this._eventsInProgress[k],C=o[L]||N,M[`${k}end`]=C)}for(let k in M)this._fireEvent(k,M[k]);let z=so(this._eventsInProgress),P=(p||v)&&!z;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let k=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&k.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(k)}if(h&&P){this._updatingCamera=!0;let k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=N=>N!==0&&-this._bearingSnap<N&&N<this._bearingSnap;!k||!k.essential&&pe.prefersReducedMotion?(this._map.fire(new l.n("moveend",{originalEvent:C})),L(this._map.getBearing())&&this._map.resetNorth()):(L(k.bearing||this._map.getBearing())&&(k.bearing=0),k.freezeElevation=!0,this._map.easeTo(k,{originalEvent:C})),this._updatingCamera=!1}}_fireEvent(t,o){this._map.fire(new l.n(t,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new Fm("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Nm extends l.E{constructor(t,o,h){super(),this._renderFrameCallback=()=>{let p=Math.min((le()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=h.bearingSnap,this._zoomSnap=h.zoomSnap,this.cameraHelper=o,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,o){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=o}getCenter(){return new l.W(this.transform.center.lng,this.transform.center.lat)}setCenter(t,o){return this.jumpTo({center:t},o)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,o){return this.jumpTo({elevation:t},o),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,o,h){return t=l.P.convert(t).mult(-1),this.panTo(this.transform.center,l.e({offset:t},o),h)}panTo(t,o,h){return this.easeTo(l.e({center:t},o),h)}getZoom(){return this.transform.zoom}setZoom(t,o){return this.jumpTo({zoom:t},o),this}zoomTo(t,o,h){return this.easeTo(l.e({zoom:t},o),h)}zoomIn(t,o){return this.zoomTo(l.cw(this.getZoom()+1,this._zoomSnap),t,o),this}zoomOut(t,o){return this.zoomTo(l.cw(this.getZoom()-1,this._zoomSnap),t,o),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,o){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new l.n("movestart",o)).fire(new l.n("move",o)).fire(new l.n("moveend",o))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,o){return this.jumpTo({bearing:t},o),this}getPadding(){return this.transform.padding}setPadding(t,o){return this.jumpTo({padding:t},o),this}rotateTo(t,o,h){return this.easeTo(l.e({bearing:t},o),h)}resetNorth(t,o){return this.rotateTo(0,l.e({duration:1e3},t),o),this}resetNorthPitch(t,o){return this.easeTo(l.e({bearing:0,pitch:0,roll:0,duration:1e3},t),o),this}snapToNorth(t,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,o):this}getPitch(){return this.transform.pitch}setPitch(t,o){return this.jumpTo({pitch:t},o),this}getRoll(){return this.transform.roll}setRoll(t,o){return this.jumpTo({roll:t},o),this}cameraForBounds(t,o){t=Xe.convert(t).adjustAntiMeridian();let h=o?.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),h,o)}_cameraForBoxAndBearing(t,o,h,p){let v={top:0,bottom:0,right:0,left:0};if(typeof(p=l.e({padding:v,offset:[0,0],maxZoom:this.transform.maxZoom},p)).padding=="number"){let P=p.padding;p.padding={top:P,bottom:P,right:P,left:P}}let T=l.e(v,p.padding);p.padding=T;let M=this.transform,C=new Xe(t,o),z=this.cameraHelper.cameraForBoxAndBearing(p,T,C,h,M);return z&&this._zoomSnap&&(z.zoom=l.cw(z.zoom,this._zoomSnap,-1)),z}fitBounds(t,o,h){return this._fitInternal(this.cameraForBounds(t,o),o,h)}fitScreenCoordinates(t,o,h,p,v){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(l.P.convert(t)),this.transform.screenPointToLocation(l.P.convert(o)),h,p),p,v)}_fitInternal(t,o,h){return t?(delete(o=l.e(t,o)).padding,o.linear?this.easeTo(o,h):this.flyTo(o,h)):this}jumpTo(t,o){this.stop(),"zoom"in t&&this._zoomSnap&&(t.zoom=l.cw(t.zoom,this._zoomSnap));let h=this._getTransformForUpdate(),p=!1,v=!1,T=!1,M=h.zoom;this.terrain&&h.setElevation(this.terrain.getElevationForLngLatZoom(t.center?l.W.convert(t.center):h.center,t.zoom||h.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(h,t);let C=h.zoom!==M;return"elevation"in t&&h.elevation!==+t.elevation&&h.setElevation(+t.elevation),"bearing"in t&&h.bearing!==+t.bearing&&(p=!0,h.setBearing(+t.bearing)),"pitch"in t&&h.pitch!==+t.pitch&&(v=!0,h.setPitch(+t.pitch)),"roll"in t&&h.roll!==+t.roll&&(T=!0,h.setRoll(+t.roll)),t.padding==null||h.isPaddingEqual(t.padding)||h.setPadding(t.padding),this._applyUpdatedTransform(h),this.fire(new l.n("movestart",o)).fire(new l.n("move",o)),C&&this.fire(new l.n("zoomstart",o)).fire(new l.n("zoom",o)).fire(new l.n("zoomend",o)),p&&this.fire(new l.n("rotatestart",o)).fire(new l.n("rotate",o)).fire(new l.n("rotateend",o)),v&&this.fire(new l.n("pitchstart",o)).fire(new l.n("pitch",o)).fire(new l.n("pitchend",o)),T&&this.fire(new l.n("rollstart",o)).fire(new l.n("roll",o)).fire(new l.n("rollend",o)),this.fire(new l.n("moveend",o))}calculateCameraOptionsFromTo(t,o,h,p=0){let v=l.a7.fromLngLat(t,o),T=l.a7.fromLngLat(h,p),M=T.x-v.x,C=T.y-v.y,z=T.z-v.z,P=Math.hypot(M,C,z);if(P===0)throw new Error("Can't calculate camera options with same From and To");let k=Math.hypot(M,C),L=l.ar(this.transform.cameraToCenterDistance/P/this.transform.tileSize),N=180*Math.atan2(M,-C)/Math.PI,G=180*Math.acos(k/P)/Math.PI;return G=z<0?90-G:90+G,{center:T.toLngLat(),elevation:p,zoom:L,pitch:G,bearing:N}}calculateCameraOptionsFromCameraLngLatAltRotation(t,o,h,p,v){let T=this.transform.calculateCenterFromCameraLngLatAlt(t,o,h,p);return{center:T.center,elevation:T.elevation,zoom:T.zoom,bearing:h,pitch:p,roll:v}}easeTo(t,o){this._stop(!1,t.easeId),"zoom"in(t=l.e({offset:[0,0],duration:500,easing:l.cy},t))&&this._zoomSnap&&(t.zoom=l.cw(t.zoom,this._zoomSnap)),(t.animate===!1||!t.essential&&pe.prefersReducedMotion)&&(t.duration=0);let h=this._getTransformForUpdate(),p=this.getBearing(),v=h.pitch,T=h.roll,M="bearing"in t?this._normalizeBearing(t.bearing,p):p,C="pitch"in t?+t.pitch:v,z="roll"in t?this._normalizeBearing(t.roll,T):T,P="padding"in t?t.padding:h.padding,k=l.P.convert(t.offset),L,N;t.around&&(L=l.W.convert(t.around),N=h.locationToScreenPoint(L));let G={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},$=this.cameraHelper.handleEaseTo(h,{bearing:M,pitch:C,roll:z,padding:P,around:L,aroundPoint:N,offsetAsPoint:k,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||(this._rotating=p!==M),this._pitching||(this._pitching=C!==v),this._rolling||(this._rolling=z!==T),this._padding=!h.isPaddingEqual(P),this._zooming||(this._zooming=$.isZooming),this._easeId=t.easeId,this._prepareEase(o,t.noMoveStart,G),this.terrain&&this._prepareElevation($.elevationCenter),this._ease((J=>{$.easeFunc(J),this.terrain&&!t.freezeElevation&&this._updateElevation(J),this._applyUpdatedTransform(h),this._fireMoveEvents(o)}),(J=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(o,J)}),t),this}_prepareEase(t,o,h={}){this._moving=!0,o||h.moving||this.fire(new l.n("movestart",t)),this._zooming&&!h.zooming&&this.fire(new l.n("zoomstart",t)),this._rotating&&!h.rotating&&this.fire(new l.n("rotatestart",t)),this._pitching&&!h.pitching&&this.fire(new l.n("pitchstart",t)),this._rolling&&!h.rolling&&this.fire(new l.n("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let o=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&o!==this._elevationTarget){let h=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(h-(o-(h*t+this._elevationStart))/(1-t)),this._elevationTarget=o}this.transform.setElevation(l.H.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};let o=t.getCameraLngLat(),h=t.getCameraAltitude(),p=this.terrain?this.terrain.getElevationForLngLatZoom(o,t.zoom):0;if(h<p){let v=this.calculateCameraOptionsFromTo(o,p,t.center,t.elevation);return{pitch:v.pitch,zoom:v.zoom}}return{}}_applyUpdatedTransform(t){let o=[];if(o.push((p=>this._elevateCameraIfInsideTerrain(p))),this.transformCameraUpdate&&o.push((p=>this.transformCameraUpdate(p))),!o.length)return;let h=t.clone();for(let p of o){let v=h.clone(),{center:T,zoom:M,roll:C,pitch:z,bearing:P,elevation:k}=p(v);T&&v.setCenter(T),k!==void 0&&v.setElevation(k),M!==void 0&&v.setZoom(M),C!==void 0&&v.setRoll(C),z!==void 0&&v.setPitch(z),P!==void 0&&v.setBearing(P),h.apply(v,!1)}this.transform.apply(h,!1)}_fireMoveEvents(t){this.fire(new l.n("move",t)),this._zooming&&this.fire(new l.n("zoom",t)),this._rotating&&this.fire(new l.n("rotate",t)),this._pitching&&this.fire(new l.n("pitch",t)),this._rolling&&this.fire(new l.n("roll",t))}_afterEase(t,o){if(this._easeId&&o&&this._easeId===o)return;delete this._easeId;let h=this._zooming,p=this._rotating,v=this._pitching,T=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,h&&this.fire(new l.n("zoomend",t)),p&&this.fire(new l.n("rotateend",t)),v&&this.fire(new l.n("pitchend",t)),T&&this.fire(new l.n("rollend",t)),this.fire(new l.n("moveend",t))}flyTo(t,o){if(!t.essential&&pe.prefersReducedMotion){let Pe=l.V(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(Pe,o)}this.stop(),"zoom"in(t=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.cy},t))&&this._zoomSnap&&(t.zoom=l.cw(t.zoom,this._zoomSnap));let h=this._getTransformForUpdate(),p=h.bearing,v=h.pitch,T=h.roll,M=h.padding,C="bearing"in t?this._normalizeBearing(t.bearing,p):p,z="pitch"in t?+t.pitch:v,P="roll"in t?this._normalizeBearing(t.roll,T):T,k="padding"in t?t.padding:h.padding,L=l.P.convert(t.offset),N=h.centerPoint.add(L),G=h.screenPointToLocation(N),$=this.cameraHelper.handleFlyTo(h,{bearing:C,pitch:z,roll:P,padding:k,locationAtOffset:G,offsetAsPoint:L,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),J=t.curve,W=Math.max(h.width,h.height),ee=W/$.scaleOfZoom,ae=$.pixelPathLength;typeof $.scaleOfMinZoom=="number"&&(J=Math.sqrt(W/$.scaleOfMinZoom/ae*2));let te=J*J;function Q(Pe){let Qe=(ee*ee-W*W+(Pe?-1:1)*te*te*ae*ae)/(2*(Pe?ee:W)*te*ae);return Math.log(Math.sqrt(Qe*Qe+1)-Qe)}function re(Pe){return(Math.exp(Pe)-Math.exp(-Pe))/2}function ie(Pe){return(Math.exp(Pe)+Math.exp(-Pe))/2}let me=Q(!1),Te=function(Pe){return ie(me)/ie(me+J*Pe)},Se=function(Pe){return W*((ie(me)*(re(Qe=me+J*Pe)/ie(Qe))-re(me))/te)/ae;var Qe},Ie=(Q(!0)-me)/J;if(Math.abs(ae)<2e-6||!isFinite(Ie)){if(Math.abs(W-ee)<1e-6)return this.easeTo(t,o);let Pe=ee<W?-1:1;Ie=Math.abs(Math.log(ee/W))/J,Se=()=>0,Te=Qe=>Math.exp(Pe*J*Qe)}return t.duration="duration"in t?+t.duration:1e3*Ie/("screenSpeed"in t?+t.screenSpeed/J:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==C,this._pitching=z!==v,this._rolling=P!==T,this._padding=!h.isPaddingEqual(k),this._prepareEase(o,!1),this.terrain&&this._prepareElevation($.targetCenter),this._ease((Pe=>{let Qe=Pe*Ie,qe=1/Te(Qe),Ae=Se(Qe);this._rotating&&h.setBearing(l.H.number(p,C,Pe)),this._pitching&&h.setPitch(l.H.number(v,z,Pe)),this._rolling&&h.setRoll(l.H.number(T,P,Pe)),this._padding&&(h.interpolatePadding(M,k,Pe),N=h.centerPoint.add(L)),$.easeFunc(Pe,qe,Ae,N),this.terrain&&!t.freezeElevation&&this._updateElevation(Pe),this._applyUpdatedTransform(h),this._fireMoveEvents(o)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(o)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,o){var h;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,o)}return t||(h=this.handlers)===null||h===void 0||h.stop(!1),this}_ease(t,o,h){h.animate===!1||h.duration===0?(t(1),o()):(this._easeStart=le(),this._easeOptions=h,this._onEaseFrame=t,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,o){t=l.X(t,-180,180);let h=Math.abs(t-o);return Math.abs(t-360-o)<h&&(t-=360),Math.abs(t+360-o)<h&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(l.W.convert(t),this.transform):null}}let Au={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Rr{constructor(t=Au){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=o=>{!o||o.sourceDataType!=="metadata"&&o.sourceDataType!=="visibility"&&o.dataType!=="style"&&o.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=ye.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ye.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ye.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,o){let h=this._map._getUIString(`AttributionControl.${o}`);t.title=h,t.setAttribute("aria-label",h)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((p=>typeof p!="string"?"":p))):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}let o=this._map.style.tileManagers;for(let p in o){let v=o[p];if(v.used||v.usedForTerrain){let T=v.getSource();T.attribution&&!t.includes(T.attribution)&&t.push(T.attribution)}}t=t.filter((p=>String(p).trim())),t.sort(((p,v)=>p.length-v.length)),t=t.filter(((p,v)=>{for(let T=v+1;T<t.length;T++)if(t[T].includes(p))return!1;return!0}));let h=t.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,t.length?(this._innerContainer.innerHTML=ye.sanitize(h),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Jd{constructor(t={}){this._updateCompact=()=>{let o=this._container.children;if(o.length){let h=o[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&h.classList.add("maplibregl-compact"):h.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){var o;this._map=t,this._compact=(o=this.options)===null||o===void 0?void 0:o.compact,this._container=ye.create("div","maplibregl-ctrl");let h=ye.create("a","maplibregl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://maplibre.org/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class R1{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let o=++this._id;return this._queue.push({callback:t,id:o,cancelled:!1}),o}remove(t){let o=this._currentlyRunning,h=o?this._queue.concat(o):this._queue;for(let p of h)if(p.id===t)return void(p.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let o=this._currentlyRunning=this._queue;this._queue=[];for(let h of o)if(!h.cancelled&&(h.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var I1=l.aS([{name:"a_pos3d",type:"Int16",components:3}]);class k1 extends l.E{constructor(t){super(),this._lastTilesetChange=le(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,o){this.tileManager.update(t,o),this._renderableTilesKeys=[];let h={};for(let p of Ro(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:o,calculateTileZoom:this.tileManager._source.calculateTileZoom}))h[p.key]=!0,this._renderableTilesKeys.push(p.key),this._tiles[p.key]||(p.terrainRttPosMatrix32f=new Float64Array(16),l.c7(p.terrainRttPosMatrix32f,0,l.a6,l.a6,0,0,1),this._tiles[p.key]=new Ut(p,this.tileSize),this._lastTilesetChange=le());for(let p in this._tiles)h[p]||delete this._tiles[p]}freeRtt(t){for(let o in this._tiles){let h=this._tiles[o];(!t||h.tileID.equals(t)||h.tileID.isChildOf(t)||t.isChildOf(h.tileID))&&(h.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,o){return o?this._getTerrainCoordsForTileRanges(t,o):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let o={};for(let h of this._renderableTilesKeys){let p=this._tiles[h].tileID,v=t.clone(),T=l.bj();if(p.canonical.equals(t.canonical))l.c7(T,0,l.a6,l.a6,0,0,1);else if(p.canonical.isChildOf(t.canonical)){let M=p.canonical.z-t.canonical.z,C=p.canonical.x-(p.canonical.x>>M<<M),z=p.canonical.y-(p.canonical.y>>M<<M),P=l.a6>>M;l.c7(T,0,P,P,0,0,1),l.Q(T,T,[-C*P,-z*P,0])}else{if(!t.canonical.isChildOf(p.canonical))continue;{let M=t.canonical.z-p.canonical.z,C=t.canonical.x-(t.canonical.x>>M<<M),z=t.canonical.y-(t.canonical.y>>M<<M),P=l.a6>>M;l.c7(T,0,l.a6,l.a6,0,0,1),l.Q(T,T,[C*P,z*P,0]),l.S(T,T,[1/2**M,1/2**M,0])}}v.terrainRttPosMatrix32f=new Float32Array(T),o[h]=v}return o}_getTerrainCoordsForTileRanges(t,o){let h={};for(let p of this._renderableTilesKeys){let v=this._tiles[p].tileID;if(!this._isWithinTileRanges(v,o))continue;let T=t.clone(),M=l.bj();if(v.canonical.z===t.canonical.z){let C=t.canonical.x-v.canonical.x+t.wrap*(1<<t.canonical.z),z=t.canonical.y-v.canonical.y;l.c7(M,0,l.a6,l.a6,0,0,1),l.Q(M,M,[C*l.a6,z*l.a6,0])}else if(v.canonical.z>t.canonical.z){let C=v.canonical.z-t.canonical.z,z=v.canonical.x-(v.canonical.x>>C<<C)+t.wrap*(1<<v.canonical.z),P=v.canonical.y-(v.canonical.y>>C<<C),k=t.canonical.x-(v.canonical.x>>C),L=t.canonical.y-(v.canonical.y>>C),N=l.a6>>C;l.c7(M,0,N,N,0,0,1),l.Q(M,M,[-z*N+k*l.a6,-P*N+L*l.a6,0])}else{let C=t.canonical.z-v.canonical.z,z=t.canonical.x-(t.canonical.x>>C<<C)+t.wrap*(1<<t.canonical.z),P=t.canonical.y-(t.canonical.y>>C<<C),k=(t.canonical.x>>C)-v.canonical.x,L=(t.canonical.y>>C)-v.canonical.y,N=l.a6<<C;l.c7(M,0,N,N,0,0,1),l.Q(M,M,[z*l.a6+k*N,P*l.a6+L*N,0])}T.terrainRttPosMatrix32f=new Float32Array(M),h[p]=T}return h}getSourceTile(t,o){var h,p;let v=this.tileManager._source,T=t.overscaledZ-this.deltaZoom;if(T>v.maxzoom&&(T=v.maxzoom),T<v.minzoom)return;(h=this._sourceTileCache)[p=t.key]||(h[p]=t.scaledTo(T).key);let M=this.findTileInCaches(this._sourceTileCache[t.key]);if(!M?.dem&&o)for(;T>=v.minzoom&&!M?.dem;)M=this.findTileInCaches(t.scaledTo(T--).key);return M}findTileInCaches(t){let o=this.tileManager.getTileByID(t);return o||(o=this.tileManager._outOfViewCache.getByKey(t),o)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,o){let h=o[t.canonical.z];return!!h&&(t.wrap>h.minWrap||t.wrap<h.maxWrap||t.canonical.x>=h.minTileXWrapped&&t.canonical.x<=h.maxTileXWrapped&&t.canonical.y>=h.minTileY&&t.canonical.y<=h.maxTileY)}}class dc{constructor(t,o,h){this._meshCache={},this.painter=t,this.tileManager=new k1(o),this.options=h,this.exaggeration=typeof h.exaggeration=="number"?h.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(let t in this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,o,h,p=l.a6){var v;let T=t.normalizeCoordinates(o,h,p);if(!T)return 0;let M=this.getTerrainData(T.tileID),C=(v=M.tile)===null||v===void 0?void 0:v.dem;if(!C)return 0;let z=l.cC([],[T.x/p*l.a6,T.y/p*l.a6],M.u_terrain_matrix),P=[z[0]*C.dim,z[1]*C.dim],k=Math.floor(P[0]),L=Math.floor(P[1]),N=P[0]-k,G=P[1]-L;return C.get(k,L)*(1-N)*(1-G)+C.get(k+1,L)*N*(1-G)+C.get(k,L+1)*(1-N)*G+C.get(k+1,L+1)*N*G}getElevationForLngLatZoom(t,o){if(!l.cD(o,t.wrap()))return 0;let{tileID:h,mercatorX:p,mercatorY:v}=this._getOverscaledTileIDFromLngLatZoom(t,o);return this.getElevation(h,p%l.a6,v%l.a6,l.a6)}getElevationForLngLat(t,o){let h=Ro(o,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),p=0;for(let v of h)v.canonical.z>p&&(p=Math.min(v.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,p)}getElevation(t,o,h,p=l.a6){return this.getDEMElevation(t,o,h,p)*this.exaggeration}getTerrainData(t){var o,h;if(!this._emptyDemTexture){let T=this.painter.context,M=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new l.T(T,M,T.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new l.T(T,new l.R({width:1,height:1}),T.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(T.gl.NEAREST,T.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.ap([])}let p=this.tileManager.getSourceTile(t,!0);if(p?.dem&&(!p.demTexture||p.needsTerrainPrepare)){let T=this.painter.context;p.demTexture=this.painter.getTileTexture(p.dem.stride),p.demTexture?p.demTexture.update(p.dem.getPixels(),{premultiply:!1}):p.demTexture=new l.T(T,p.dem.getPixels(),T.gl.RGBA,{premultiply:!1}),p.demTexture.bind(T.gl.NEAREST,T.gl.CLAMP_TO_EDGE),p.needsTerrainPrepare=!1}let v=p&&p.toString()+p.tileID.key+t.key;if(v&&!this._demMatrixCache[v]){let T=this.tileManager.getSource().maxzoom,M=t.canonical.z-p.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=T?M=t.canonical.z-T:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let C=t.canonical.x-(t.canonical.x>>M<<M),z=t.canonical.y-(t.canonical.y>>M<<M),P=l.cE(new Float64Array(16),[1/(l.a6<<M),1/(l.a6<<M),0]);l.Q(P,P,[C*l.a6,z*l.a6,0]),this._demMatrixCache[v]={matrix:P,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:((o=p?.dem)===null||o===void 0?void 0:o.dim)||1,u_terrain_matrix:v?this._demMatrixCache[v].matrix:this._emptyDemMatrix,u_terrain_unpack:((h=p?.dem)===null||h===void 0?void 0:h.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(p?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:p}}getFramebuffer(t){let o=this.painter,h=o.width/devicePixelRatio,p=o.height/devicePixelRatio;return!this._fbo||this._fbo.width===h&&this._fbo.height===p||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new l.T(o.context,{width:h,height:p,data:null},o.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(o.context.gl.NEAREST,o.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new l.T(o.context,{width:h,height:p,data:null},o.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(o.context.gl.NEAREST,o.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=o.context.createFramebuffer(h,p,!0,!1),this._fbo.depthAttachment.set(o.context.createRenderbuffer(o.context.gl.DEPTH_COMPONENT16,h,p))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let o=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let v=0,T=0;v<this._coordsTextureSize;v++)for(let M=0;M<this._coordsTextureSize;M++,T+=4)o[T+0]=255&M,o[T+1]=255&v,o[T+2]=M>>8<<4|v>>8,o[T+3]=0;let h=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(o.buffer)),p=new l.T(t,h,t.gl.RGBA,{premultiply:!1});return p.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=p,p}pointCoordinate(t){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();let o=new Uint8Array(4),h=this.painter.context,p=h.gl,v=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),T=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),M=Math.round(this.painter.height/devicePixelRatio);h.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(v,M-T-1,1,1,p.RGBA,p.UNSIGNED_BYTE,o),h.bindFramebuffer.set(null);let C=o[0]+(o[2]>>4<<8),z=o[1]+((15&o[2])<<8),P=this.coordsIndex[255-o[3]],k=P&&this.tileManager.getTileByID(P);if(!k)return null;let L=this._coordsTextureSize,N=(1<<k.tileID.canonical.z)*L;return new l.a7((k.tileID.canonical.x*L+C)/N+k.tileID.wrap,(k.tileID.canonical.y*L+z)/N,this.getElevation(k.tileID,C,z,L))}depthAtPoint(t){let o=new Uint8Array(4),h=this.painter.context,p=h.gl;return h.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),p.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,o),h.bindFramebuffer.set(null),(o[0]/16777216+o[1]/65536+o[2]/256+o[3])/256}getTerrainMesh(t){var o;let h=((o=this.painter.style.projection)===null||o===void 0?void 0:o.transitionState)>0,p=h&&t.canonical.y===0,v=h&&t.canonical.y===(1<<t.canonical.z)-1,T=`m_${p?"n":""}_${v?"s":""}`;if(this._meshCache[T])return this._meshCache[T];let M=this.painter.context,C=new l.cF,z=new l.aW,P=this.meshSize,k=l.a6/P,L=P*P;for(let ie=0;ie<=P;ie++)for(let me=0;me<=P;me++)C.emplaceBack(me*k,ie*k,0);for(let ie=0;ie<L;ie+=P+1)for(let me=0;me<P;me++)z.emplaceBack(me+ie,P+me+ie+1,P+me+ie+2),z.emplaceBack(me+ie,P+me+ie+2,me+ie+1);let N=C.length,G=N+(P+1),$=(P+1)*P,J=p?l.bq:0,W=p?0:1,ee=v?l.br:l.a6,ae=v?0:1;for(let ie=0;ie<=P;ie++)C.emplaceBack(ie*k,J,W);for(let ie=0;ie<=P;ie++)C.emplaceBack(ie*k,ee,ae);for(let ie=0;ie<P;ie++)z.emplaceBack($+ie,G+ie,G+ie+1),z.emplaceBack($+ie,G+ie+1,$+ie+1),z.emplaceBack(0+ie,N+ie+1,N+ie),z.emplaceBack(0+ie,0+ie+1,N+ie+1);let te=C.length,Q=te+2*(P+1);for(let ie of[0,1])for(let me=0;me<=P;me++)for(let Te of[0,1])C.emplaceBack(ie*l.a6,me*k,Te);for(let ie=0;ie<2*P;ie+=2)z.emplaceBack(te+ie,te+ie+1,te+ie+3),z.emplaceBack(te+ie,te+ie+3,te+ie+2),z.emplaceBack(Q+ie,Q+ie+3,Q+ie+1),z.emplaceBack(Q+ie,Q+ie+2,Q+ie+3);let re=new Jt(M.createVertexBuffer(C,I1.members),M.createIndexBuffer(z),l.aV.simpleSegment(0,0,C.length,z.length));return this._meshCache[T]=re,re}getMeshFrameDelta(t){return 2*Math.PI*l.bD/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,o){var h;if(!l.cD(o,t.wrap()))return 0;let{tileID:p}=this._getOverscaledTileIDFromLngLatZoom(t,o);return(h=this.getMinMaxElevation(p).minElevation)!==null&&h!==void 0?h:0}getMinMaxElevation(t){let o=this.getTerrainData(t).tile,h={minElevation:null,maxElevation:null};return o?.dem&&(h.minElevation=o.dem.min*this.exaggeration,h.maxElevation=o.dem.max*this.exaggeration),h}_getOverscaledTileIDFromLngLatZoom(t,o){let h=l.a7.fromLngLat(t.wrap()),p=(1<<o)*l.a6,v=h.x*p,T=h.y*p,M=Math.floor(v/l.a6),C=Math.floor(T/l.a6);return{tileID:new l.a3(o,0,o,M,C),mercatorX:v,mercatorY:T}}}class vi{constructor(t,o,h){this._context=t,this._size=o,this._tileSize=h,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){let o=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),h=new l.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return h.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),o.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),o.colorAttachment.set(h.texture),{id:t,fbo:o,texture:h,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((o=>t.id!==o)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(let o of this._recentlyUsed)if(!this._objects[o].inUse)return this._objects[o];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(let t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t=>!t.inUse))===!1}}let ii={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class Um{constructor(t,o){this.painter=t,this.terrain=o,this.pool=new vi(t.context,30,o.tileManager.tileSize*o.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,o){var h,p,v;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((T=>!t._layers[T].isHidden(o))),this._coordsAscending={};for(let T in t.tileManagers){this._coordsAscending[T]={};let M=t.tileManagers[T].getVisibleCoordinates(),C=t.tileManagers[T].getSource(),z=C instanceof _i?C.terrainTileRanges:null;for(let P of M){let k=this.terrain.tileManager.getTerrainCoords(P,z);for(let L in k)(v=this._coordsAscending[T])[L]||(v[L]=[]),this._coordsAscending[T][L].push(k[L])}}this._rttFingerprints={};for(let T of t._order){let M=t._layers[T],C=M.source;if(ii[M.type]&&!this._rttFingerprints[C]){this._rttFingerprints[C]={};let z=(p=(h=t.tileManagers[C])===null||h===void 0?void 0:h.getState().revision)!==null&&p!==void 0?p:0;for(let P in this._coordsAscending[C])this._rttFingerprints[C][P]=`${this._coordsAscending[C][P].map((k=>k.key)).sort().join()}#${z}`}}for(let T of this._renderableTiles)for(let M in this._rttFingerprints){let C=this._rttFingerprints[M][T.tileID.key];C&&C!==T.rttFingerprint[M]&&(T.rtt=[])}}renderLayer(t,o){if(t.isHidden(this.painter.transform.zoom))return!1;let h=Object.assign(Object.assign({},o),{isRenderingToTexture:!0}),p=t.type,v=this.painter,T=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(ii[p]&&(this._prevType&&ii[this._prevType]||this._stacks.push([]),this._prevType=p,this._stacks[this._stacks.length-1].push(t.id),!T))return!0;if(ii[this._prevType]||ii[p]&&T){this._prevType=p;let M=this._stacks.length-1,C=this._stacks[M]||[];for(let z of this._renderableTiles){if(this.pool.isFull()&&(Vd(this.painter,this.terrain,this._rttTiles,h),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(z),z.rtt[M]){let k=this.pool.getObjectForId(z.rtt[M].id);if(k.stamp===z.rtt[M].stamp){this.pool.useObject(k);continue}}let P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),z.rtt[M]={id:P.id,stamp:P.stamp},v.context.bindFramebuffer.set(P.fbo.framebuffer),v.context.clear({color:l.bo.transparent,stencil:0}),v.currentStencilSource=void 0;for(let k of C){let L=v.style._layers[k],N=L.source?this._coordsAscending[L.source][z.tileID.key]:[z.tileID];v.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),v._renderTileClippingMasks(L,N,!0),v.renderLayer(v,v.style.tileManagers[L.source],L,N,h),L.source&&(z.rttFingerprint[L.source]=this._rttFingerprints[L.source][z.tileID.key])}}return Vd(this.painter,this.terrain,this._rttTiles,h),this._rttTiles=[],this.pool.freeAllObjects(),ii[p]}return!1}}let pc={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},zu=D,Du={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:Au,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:l.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20},Pu=class extends Nm{get _ownerWindow(){var g,t;return((t=(g=this._container)===null||g===void 0?void 0:g.ownerDocument)===null||t===void 0?void 0:t.defaultView)||window}constructor(g){var t,o,h;let p=Object.assign(Object.assign(Object.assign({},Du),g),{canvasContextAttributes:Object.assign(Object.assign({},Du.canvasContextAttributes),g.canvasContextAttributes)});if(p.minZoom!=null&&p.maxZoom!=null&&p.minZoom>p.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(p.minPitch!=null&&p.maxPitch!=null&&p.minPitch>p.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(p.minPitch!=null&&p.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(p.maxPitch!=null&&p.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");let v=new Bo,T=new Fo;p.minZoom!==void 0&&v.setMinZoom(p.minZoom),p.maxZoom!==void 0&&v.setMaxZoom(p.maxZoom),p.minPitch!==void 0&&v.setMinPitch(p.minPitch),p.maxPitch!==void 0&&v.setMaxPitch(p.maxPitch),p.renderWorldCopies!==void 0&&v.setRenderWorldCopies(p.renderWorldCopies),p.transformConstrain!==null&&v.setConstrainOverride(p.transformConstrain),super(v,T,{bearingSnap:p.bearingSnap,zoomSnap:p.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new R1,this._controls=[],this._mapId=l.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=C=>{if(C.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let z of Object.values(this.style._layers))if(z.type==="custom"&&console.warn(`Custom layer with id '${z.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),z._listeners)for(let[P]of Object.entries(z._listeners))console.warn(`Custom layer with id '${z.id}' had event listeners for event '${P}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new l.n("webglcontextlost",{originalEvent:C}))}else this.fire(new l.n("webglcontextlost",{originalEvent:C}))},this._contextRestored=C=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new l.n("webglcontextrestored",{originalEvent:C}))},this._onMapScroll=C=>{if(C.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=p.interactive,this._maxTileCacheSize=p.maxTileCacheSize,this._maxTileCacheZoomLevels=p.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},p.canvasContextAttributes),this._trackResize=p.trackResize===!0,this._bearingSnap=p.bearingSnap,this._zoomSnap=p.zoomSnap,this._centerClampedToGround=p.centerClampedToGround,this._refreshExpiredTiles=p.refreshExpiredTiles===!0,this._fadeDuration=p.fadeDuration,this._crossSourceCollisions=p.crossSourceCollisions===!0,this._collectResourceTiming=p.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},pc),p.locale),this._clickTolerance=p.clickTolerance,this._overridePixelRatio=p.pixelRatio,this._maxCanvasSize=p.maxCanvasSize,this._zoomLevelsToOverscale=p.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=p.transformCameraUpdate,this.transformConstrain=p.transformConstrain,this.cancelPendingTileRequestsWhileZooming=p.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(p.anisotropicFilterPitch),p.reduceMotion!==void 0&&(pe.prefersReducedMotion=p.reduceMotion),this._imageQueueHandle=Ue.addThrottleControl((()=>this.isMoving())),this._requestManager=new ce(p.transformRequest),this._container=this._resolveContainer(p.container),p.maxBounds&&this.setMaxBounds(p.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)})),this.once("idle",(()=>this._idleTriggered=!0)),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Yn(this,p),this._hash=p.hash?new ac(typeof p.hash=="string"&&p.hash||void 0).addTo(this):void 0,!((t=this._hash)===null||t===void 0)&&t._onHashChange()||(this.jumpTo({center:p.center,elevation:p.elevation,zoom:p.zoom,bearing:p.bearing,pitch:p.pitch,roll:p.roll}),p.bounds&&(this.resize(),this.fitBounds(p.bounds,l.e({},p.fitBoundsOptions,{duration:0}))));let M=typeof p.style=="string"||((h=(o=p.style)===null||o===void 0?void 0:o.projection)===null||h===void 0?void 0:h.type)!=="globe";this.resize(null,M),this._localIdeographFontFamily=p.localIdeographFontFamily,this._validateStyle=p.validateStyle,p.style&&this.setStyle(p.style,{localIdeographFontFamily:p.localIdeographFontFamily}),p.attributionControl&&this.addControl(new Rr(typeof p.attributionControl=="boolean"?void 0:p.attributionControl)),p.maplibreLogo&&this.addControl(new Jd,p.logoPosition),this.on("style.load",(()=>{if(M||this._resizeTransform(),this.transform.unmodified){let C=l.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(C)}})),this.on("data",(C=>{this._update(C.dataType==="style"),this.fire(new l.n(`${C.dataType}data`,C))})),this.on("dataloading",(C=>{this.fire(new l.n(`${C.dataType}dataloading`,C))})),this.on("dataabort",(C=>{this.fire(new l.n("sourcedataabort",C))}))}_getMapId(){return this._mapId}setGlobalStateProperty(g,t){return this.style.setGlobalStateProperty(g,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(g,t){if(t===void 0&&(t=g.getDefaultPosition?g.getDefaultPosition():"top-right"),!g?.onAdd)return this.fire(new l.l(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let o=g.onAdd(this);this._controls.push(g);let h=this._controlPositions[t];return t.includes("bottom")?h.insertBefore(o,h.firstChild):h.appendChild(o),this}removeControl(g){if(!g?.onRemove)return this.fire(new l.l(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(g);return t>-1&&this._controls.splice(t,1),g.onRemove(this),this}hasControl(g){return this._controls.includes(g)}coveringTiles(g){return Ro(this.transform,g)}calculateCameraOptionsFromTo(g,t,o,h){return h==null&&this.terrain&&(h=this.terrain.getElevationForLngLat(o,this.transform)),super.calculateCameraOptionsFromTo(g,t,o,h)}resize(g,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);let o=!this._moving;return o&&(this.stop(),this.fire(new l.n("movestart",g)).fire(new l.n("move",g))),this.fire(new l.n("resize",g)),o&&this.fire(new l.n("moveend",g)),this}_resizeInternal(g=!0){let[t,o]=this._containerDimensions(),h=this._getClampedPixelRatio(t,o);if(this._resizeCanvas(t,o,h),this.painter.resize(t,o,h),this.painter.overLimit()){let p=this.painter.context.gl;this._maxCanvasSize=[p.drawingBufferWidth,p.drawingBufferHeight];let v=this._getClampedPixelRatio(t,o);this._resizeCanvas(t,o,v),this.painter.resize(t,o,v)}this._resizeTransform(g)}_resizeTransform(g=!0){var t;let[o,h]=this._containerDimensions();this.transform.resize(o,h,g),(t=this._requestedCameraState)===null||t===void 0||t.resize(o,h,g)}_getClampedPixelRatio(g,t){let{0:o,1:h}=this._maxCanvasSize,p=this.getPixelRatio(),v=g*p,T=t*p;return Math.min(v>o?o/v:1,T>h?h/T:1)*p}getPixelRatio(){var g;return(g=this._overridePixelRatio)!==null&&g!==void 0?g:devicePixelRatio}setPixelRatio(g){this._overridePixelRatio=g,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(g){return this.transform.setMaxBounds(Xe.convert(g)),this._update()}setMinZoom(g){if((g=g??-2)>=-2&&g<=this.transform.maxZoom){let t=this.transform.zoom,o=this._getTransformForUpdate();return o.setMinZoom(g),this._applyUpdatedTransform(o),this._update(),t!==this.transform.zoom&&this.fire(new l.n("zoomstart")).fire(new l.n("zoom")).fire(new l.n("zoomend")).fire(new l.n("movestart")).fire(new l.n("move")).fire(new l.n("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(g){if((g=g??22)>=this.transform.minZoom){let t=this.transform.zoom,o=this._getTransformForUpdate();return o.setMaxZoom(g),this._applyUpdatedTransform(o),this._update(),t!==this.transform.zoom&&this.fire(new l.n("zoomstart")).fire(new l.n("zoom")).fire(new l.n("zoomend")).fire(new l.n("movestart")).fire(new l.n("move")).fire(new l.n("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(g){if((g=g??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(g>=0&&g<=this.transform.maxPitch){let t=this.transform.pitch,o=this._getTransformForUpdate();return o.setMinPitch(g),this._applyUpdatedTransform(o),this._update(),t!==this.transform.pitch&&this.fire(new l.n("pitchstart")).fire(new l.n("pitch")).fire(new l.n("pitchend")).fire(new l.n("movestart")).fire(new l.n("move")).fire(new l.n("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(g){if((g=g??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(g>=this.transform.minPitch){let t=this.transform.pitch,o=this._getTransformForUpdate();return o.setMaxPitch(g),this._applyUpdatedTransform(o),this._update(),t!==this.transform.pitch&&this.fire(new l.n("pitchstart")).fire(new l.n("pitch")).fire(new l.n("pitchend")).fire(new l.n("movestart")).fire(new l.n("move")).fire(new l.n("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(g){if((g=g??20)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(g<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=g,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(g){return this.transform.setRenderWorldCopies(g),this._update()}setTransformConstrain(g){return this.transform.setConstrainOverride(g),this._update()}project(g){return this.transform.locationToScreenPoint(l.W.convert(g),this.style&&this.terrain)}unproject(g){return this.transform.screenPointToLocation(l.P.convert(g),this.terrain)}isMoving(){var g;return this._moving||((g=this.handlers)===null||g===void 0?void 0:g.isMoving())}isZooming(){var g;return this._zooming||((g=this.handlers)===null||g===void 0?void 0:g.isZooming())}isRotating(){var g;return this._rotating||((g=this.handlers)===null||g===void 0?void 0:g.isRotating())}_createDelegatedListener(g,t,o){if(g==="mouseenter"||g==="mouseover"){let h=!1;return{layers:t,listener:o,delegates:{mousemove:v=>{let T=t.filter((C=>this.getLayer(C))),M=T.length!==0?this.queryRenderedFeatures(v.point,{layers:T}):[];M.length?h||(h=!0,o.call(this,new vr(g,this,v.originalEvent,{features:M}))):h=!1},mouseout:()=>{h=!1}}}}if(g==="mouseleave"||g==="mouseout"){let h=!1;return{layers:t,listener:o,delegates:{mousemove:T=>{let M=t.filter((C=>this.getLayer(C)));(M.length!==0?this.queryRenderedFeatures(T.point,{layers:M}):[]).length?h=!0:h&&(h=!1,o.call(this,new vr(g,this,T.originalEvent)))},mouseout:T=>{h&&(h=!1,o.call(this,new vr(g,this,T.originalEvent)))}}}}{let h=p=>{let v=t.filter((M=>this.getLayer(M))),T=v.length!==0?this.queryRenderedFeatures(p.point,{layers:v}):[];T.length&&(p.features=T,o.call(this,p),delete p.features)};return{layers:t,listener:o,delegates:{[g]:h}}}}_saveDelegatedListener(g,t){var o;this._delegatedListeners||(this._delegatedListeners={}),(o=this._delegatedListeners)[g]||(o[g]=[]),this._delegatedListeners[g].push(t)}_removeDelegatedListener(g,t,o){var h;if(!(!((h=this._delegatedListeners)===null||h===void 0)&&h[g]))return;let p=this._delegatedListeners[g];for(let v=0;v<p.length;v++){let T=p[v];if(T.listener===o&&T.layers.length===t.length&&T.layers.every((M=>t.includes(M)))){for(let M in T.delegates)this.off(M,T.delegates[M]);return void p.splice(v,1)}}}on(g,t,o){if(o===void 0)return super.on(g,t);let h=typeof t=="string"?[t]:t,p=this._createDelegatedListener(g,h,o);this._saveDelegatedListener(g,p);for(let v in p.delegates)this.on(v,p.delegates[v]);return{unsubscribe:()=>{this._removeDelegatedListener(g,h,o)}}}once(g,t,o){if(o===void 0)return super.once(g,t);let h=typeof t=="string"?[t]:t,p=this._createDelegatedListener(g,h,o);for(let v in p.delegates){let T=p.delegates[v];p.delegates[v]=(...M)=>{this._removeDelegatedListener(g,h,o),T(...M)}}this._saveDelegatedListener(g,p);for(let v in p.delegates)this.once(v,p.delegates[v]);return this}off(g,t,o){return o===void 0?super.off(g,t):(this._removeDelegatedListener(g,typeof t=="string"?[t]:t,o),this)}queryRenderedFeatures(g,t){if(!this.style)return[];let o,h=g instanceof l.P||Array.isArray(g),p=h?g:[[0,0],[this.transform.width,this.transform.height]];if(t||(t=(h?{}:g)||{}),p instanceof l.P||typeof p[0]=="number")o=[l.P.convert(p)];else{let v=l.P.convert(p[0]),T=l.P.convert(p[1]);o=[v,new l.P(T.x,v.y),T,new l.P(v.x,T.y),v]}return this.style.queryRenderedFeatures(o,t,this.transform)}querySourceFeatures(g,t){return this.style.querySourceFeatures(g,t)}setStyle(g,t){return(t=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&g?(this._diffStyle(g,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(g,t))}setTransformRequest(g){return this._requestManager.setTransformRequest(g),this}_getUIString(g){let t=this._locale[g];if(t==null)throw new Error(`Missing UI string '${g}'`);return t}_updateStyle(g,t){var o,h,p;if((o=this._diffStyleRequest)===null||o===void 0||o.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(g,t)));let v=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!g)),g?(this.style=new jo(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof g=="string"?this.style.loadURL(g,t,v):this.style.loadJSON(g,t,v),this):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),(p=(h=this.style)===null||h===void 0?void 0:h.projection)===null||p===void 0||p.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new jo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(g,t){return l._(this,void 0,void 0,(function*(){var o;if((o=this._diffStyleRequest)===null||o===void 0||o.abort(),typeof g=="string"){let h=g;this._diffStyleRequest=new AbortController;let p=this._diffStyleRequest;try{let v=yield this._requestManager.transformRequest(h,"Style");if(p.signal.aborted)return void(this._diffStyleRequest=null);let T=yield l.k(v,p);this._diffStyleRequest=null,this._updateDiff(T.data,t)}catch(v){this._diffStyleRequest=null,l.$(v)||this.fire(new l.l(l.d(v)))}}else typeof g=="object"&&(this._diffStyleRequest=null,this._updateDiff(g,t))}))}_updateDiff(g,t){try{this.style.setState(g,t)&&this._update(!0)}catch(o){l.w(`Unable to perform style diff: ${l.d(o).message}. Rebuilding the style from scratch.`),this._updateStyle(g,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();l.w("There is no style added to the map.")}addSource(g,t){return this._lazyInitEmptyStyle(),this.style.addSource(g,t),this._update(!0)}isSourceLoaded(g){var t;let o=(t=this.style)===null||t===void 0?void 0:t.tileManagers[g];if(o!==void 0)return o.loaded();this.fire(new l.l(new Error(`There is no tile manager with ID '${g}'`)))}setTerrain(g){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),g){let t=this.style.tileManagers[g.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${g.source}`);this.terrain===null&&t.reload();for(let o in this.style._layers){let h=this.style._layers[o];h.type==="hillshade"&&h.source===g.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),h.type==="color-relief"&&h.source===g.source&&l.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new dc(this.painter,t,g),this.painter.renderToTexture=new Um(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=o=>{var h;o.dataType==="style"?this.terrain.tileManager.freeRtt():o.dataType==="source"&&o.tile&&(o.sourceId!==g.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((h=o.source)===null||h===void 0?void 0:h.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(o.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new l.n("terrain",{terrain:g})),this}getTerrain(){var g,t;return(t=(g=this.terrain)===null||g===void 0?void 0:g.options)!==null&&t!==void 0?t:null}areTilesLoaded(){var g;let t=(g=this.style)===null||g===void 0?void 0:g.tileManagers;for(let o of Object.values(t))if(!o.areTilesLoaded())return!1;return!0}removeSource(g){return this.style.removeSource(g),this._update(!0)}getSource(g){return this.style.getSource(g)}setSourceTileLodParams(g,t,o){if(o){let h=this.getSource(o);if(!h)throw new Error(`There is no source with ID "${o}", cannot set LOD parameters`);h.calculateTileZoom=ld(Math.max(1,g),Math.max(1,t))}else for(let h in this.style.tileManagers)this.style.tileManagers[h].getSource().calculateTileZoom=ld(Math.max(1,g),Math.max(1,t));return this._update(!0),this}refreshTiles(g,t){let o=this.style.tileManagers[g];if(!o)throw new Error(`There is no tile manager with ID "${g}", cannot refresh tile`);t===void 0?o.reload(!0):o.refreshTiles(t.map((h=>new l.aa(h.z,h.x,h.y))))}addImage(g,t,o={}){let{pixelRatio:h=1,sdf:p=!1,stretchX:v,stretchY:T,content:M,textFitWidth:C,textFitHeight:z}=o;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||l.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new l.l(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:P,height:k,data:L}=t,N=t;return this.style.addImage(g,{data:new l.R({width:P,height:k},new Uint8Array(L)),pixelRatio:h,stretchX:v,stretchY:T,content:M,textFitWidth:C,textFitHeight:z,sdf:p,version:0,userImage:N}),N.onAdd&&N.onAdd(this,g),this}}{let{width:P,height:k,data:L}=pe.getImageData(t);this.style.addImage(g,{data:new l.R({width:P,height:k},L),pixelRatio:h,stretchX:v,stretchY:T,content:M,textFitWidth:C,textFitHeight:z,sdf:p,version:0})}}updateImage(g,t){let o=this.style.getImage(g);if(!o)return this.fire(new l.l(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let h=t instanceof HTMLImageElement||l.b(t)?pe.getImageData(t):t,{width:p,height:v,data:T}=h;if(p===void 0||v===void 0)return this.fire(new l.l(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(p!==o.data.width||v!==o.data.height)return this.fire(new l.l(new Error("The width and height of the updated image must be that same as the previous version of the image")));let M=!(t instanceof HTMLImageElement||l.b(t));return o.data.replace(T,M),this.style.updateImage(g,o),this}getImage(g){return this.style.getImage(g)}hasImage(g){return g?!!this.style.getImage(g):(this.fire(new l.l(new Error("Missing required image id"))),!1)}removeImage(g){this.style.removeImage(g)}loadImage(g){return l._(this,void 0,void 0,(function*(){return Ue.getImage(yield this._requestManager.transformRequest(g,"Image"),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(g,t){return this._lazyInitEmptyStyle(),this.style.addLayer(g,t),this._update(!0)}moveLayer(g,t){return this.style.moveLayer(g,t),this._update(!0)}removeLayer(g){return this.style.removeLayer(g),this._update(!0)}getLayer(g){return this.style.getLayer(g)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(g,t,o){return this.style.setLayerZoomRange(g,t,o),this._update(!0)}setFilter(g,t,o={}){return this.style.setFilter(g,t,o),this._update(!0)}getFilter(g){return this.style.getFilter(g)}setPaintProperty(g,t,o,h={}){return this.style.setPaintProperty(g,t,o,h),this._update(!0)}getPaintProperty(g,t){return this.style.getPaintProperty(g,t)}setLayoutProperty(g,t,o,h={}){return this.style.setLayoutProperty(g,t,o,h),this._update(!0)}getLayoutProperty(g,t){return this.style.getLayoutProperty(g,t)}setGlyphs(g,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(g,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(g,t,o={}){return this._lazyInitEmptyStyle(),this.style.addSprite(g,t,o,(h=>{h||this._update(!0)})),this}removeSprite(g){return this._lazyInitEmptyStyle(),this.style.removeSprite(g),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(g,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(g,t,(o=>{o||this._update(!0)})),this}setLight(g,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(g,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(g,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(g,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(g,t){return this.style.setFeatureState(g,t),this._update()}removeFeatureState(g,t){return this.style.removeFeatureState(g,t),this._update()}getFeatureState(g){return this.style.getFeatureState(g)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let g=0,t=0;return this._container&&(g=this._container.clientWidth||400,t=this._container.clientHeight||300),[g,t]}_setupResizeObserver(){var g;let t=!1,o=qd((p=>{this._trackResize&&!this._removed&&(this.resize(p),this.redraw())}),50),h=(g=this._ownerWindow.ResizeObserver)!==null&&g!==void 0?g:ResizeObserver;this._resizeObserver=new h((p=>{t?o(p):t=!0})),this._resizeObserver.observe(this._container)}_resolveContainer(g){if(typeof g=="string"){let t=document.getElementById(g);if(!t)throw new Error(`Container '${g}' not found.`);return t}if(g instanceof HTMLElement||g&&typeof g=="object"&&g.nodeType===1)return g;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let g=this._container;g.classList.add("maplibregl-map");let t=this._canvasContainer=ye.create("div","maplibregl-canvas-container",g);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ye.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let o=this._containerDimensions(),h=this._getClampedPixelRatio(o[0],o[1]);this._resizeCanvas(o[0],o[1],h);let p=this._controlContainer=ye.create("div","maplibregl-control-container",g),v=this._controlPositions={};for(let T of["top-left","top-right","bottom-left","bottom-right"])v[T]=ye.create("div",`maplibregl-ctrl-${T} `,p);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(g,t,o){this._canvas.width=Math.floor(o*g),this._canvas.height=Math.floor(o*t),this._canvas.style.width=`${g}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let g=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),t=null;this._canvas.addEventListener("webglcontextcreationerror",(h=>{t={requestedAttributes:g},h&&(t.statusMessage=h.statusMessage,t.type=h.type)}),{once:!0});let o=null;if(o=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,g):this._canvas.getContext("webgl2",g)||this._canvas.getContext("webgl",g),!o){let h="Failed to initialize WebGL";throw t?(t.message=h,new Error(JSON.stringify(t))):new Error(h)}this.painter=new rc(o,this.transform)}migrateProjection(g,t){super.migrateProjection(g,t),this.painter.transform=g,this.fire(new l.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(g){var t;return!((t=this.style)===null||t===void 0)&&t._loaded?(this._styleDirty||(this._styleDirty=g),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(g){return this._update(),this._renderTaskQueue.add(g)}_cancelRenderFrame(g){this._renderTaskQueue.remove(g)}_render(g){var t,o,h,p,v,T;let M=this._idleTriggered?this._fadeDuration:0,C=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(g),this._removed)return;let z=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let L=this.transform.zoom,N=le();this.style.zoomHistory.update(L,N);let G=new l.J(L,{now:N,fadeDuration:M,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),$=G.crossFadingFactor();$===1&&$===this._crossFadingFactor||(z=!0,this._crossFadingFactor=$),this.style.update(G)}let P=((o=this.style.projection)===null||o===void 0?void 0:o.transitionState)>0!==C;(h=this.style.projection)===null||h===void 0||h.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((p=this.style.projection)===null||p===void 0?void 0:p.transitionState,(v=this.style.projection)===null||v===void 0?void 0:v.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||P)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=(T=this.style)===null||T===void 0?void 0:T._updatePlacement(this.transform,this.showCollisionBoxes,M,this._crossSourceCollisions,P),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:M,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new l.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new l.n("load"))),this.style&&(this.style.hasTransitions()||z)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let k=this._sourcesDirty||this._styleDirty||this._placementDirty;return k||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.n("idle")),!this._loaded||this._fullyLoaded||k||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var g,t;this._hash&&this._hash.remove();for(let h of this._controls)h.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),(g=this._diffStyleRequest)===null||g===void 0||g.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Ue.removeThrottleControl(this._imageQueueHandle),(t=this._resizeObserver)===null||t===void 0||t.disconnect();let o=this.painter.context.gl.getExtension("WEBGL_lose_context");o?.loseContext&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new l.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,pe.frame(this._frameRequest,(g=>{this._frameRequest=null;try{this._render(g)}catch(t){if(!l.$(t)&&!(function(o){return o.message===bu})(t))throw t}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(g){this._showTileBoundaries!==g&&(this._showTileBoundaries=g,this._update())}get showPadding(){return!!this._showPadding}set showPadding(g){this._showPadding!==g&&(this._showPadding=g,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(g){this._showCollisionBoxes!==g&&(this._showCollisionBoxes=g,g?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(g){this._showOverdrawInspector!==g&&(this._showOverdrawInspector=g,this._update())}get repaint(){return!!this._repaint}set repaint(g){this._repaint!==g&&(this._repaint=g,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(g){this._vertices=g,this._update()}get version(){return zu}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(g){return this._lazyInitEmptyStyle(),this.style.setProjection(g),this._update(!0)}},ep={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class fc{constructor(t,o,h=!1){this.mousedown=v=>{this.startMove(v,ye.mousePos(this.element,v)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=v=>{this.move(v,ye.mousePos(this.element,v))},this.mouseup=v=>{this._rotatePitchHandler.dragEnd(v),this.offTemp()},this.touchstart=v=>{v.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ye.touchPos(this.element,v.targetTouches)[0],this.startMove(v,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=v=>{v.targetTouches.length!==1?this.reset():(this._lastPos=ye.touchPos(this.element,v.targetTouches)[0],this.move(v,this._lastPos))},this.touchend=v=>{v.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=o;let p=new Zd;this._rotatePitchHandler=new Oa({clickTolerance:3,move:(v,T)=>{let M=o.getBoundingClientRect(),C=new l.P((M.bottom-M.top)/2,(M.right-M.left)/2);return{bearingDelta:l.cx(new l.P(v.x,T.y),T,C),pitchDelta:h?-.5*(T.y-v.y):void 0}},moveStateManager:p,enable:!0,assignEvents:()=>{}}),this.map=t,o.addEventListener("mousedown",this.mousedown),o.addEventListener("touchstart",this.touchstart,{passive:!1}),o.addEventListener("touchcancel",this.reset)}startMove(t,o){this._rotatePitchHandler.dragStart(t,o),ye.disableDrag()}move(t,o){let h=this.map,{bearingDelta:p,pitchDelta:v}=this._rotatePitchHandler.dragMove(t,o)||{};p&&h.setBearing(h.getBearing()+p),v&&h.setPitch(h.getPitch()+v)}off(){let t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){ye.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}let Fa;function Ru(g,t,o,h=!1){if(h||!o.getCoveringTilesDetailsProvider().allowWorldCopies())return g?.wrap();let p=new l.W(g.lng,g.lat);if(g=new l.W(g.lng,g.lat),t){let v=new l.W(g.lng-360,g.lat),T=new l.W(g.lng+360,g.lat),M=o.locationToScreenPoint(g).distSqr(t);o.locationToScreenPoint(v).distSqr(t)<M?g=v:o.locationToScreenPoint(T).distSqr(t)<M&&(g=T)}for(;Math.abs(g.lng-o.center.lng)>180;){let v=o.locationToScreenPoint(g);if(v.x>=0&&v.y>=0&&v.x<=o.width&&v.y<=o.height)break;g.lng>o.center.lng?g.lng-=360:g.lng+=360}return g.lng!==p.lng&&o.isPointOnMapSurface(o.locationToScreenPoint(g))?g:p}let mc={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Iu(g,t,o){let h=g.classList;for(let p in mc)h.remove(`maplibregl-${o}-anchor-${p}`);h.add(`maplibregl-${o}-anchor-${t}`)}class gc extends l.E{constructor(t){if(super(),this._onClick=o=>{this.fire(new l.n("click",{originalEvent:o}))},this._onKeyPress=o=>{o.code!=="Space"&&o.code!=="Enter"||this.togglePopup()},this._onMapClick=o=>{let h=o.originalEvent.target,p=this._element;this._popup&&(h===p||p.contains(h))&&this.togglePopup()},this._update=o=>{if(!this._map)return;let h=this._map.loaded()&&!this._map.isMoving();(o?.type==="terrain"||o?.type==="render"&&!h)&&this._map.once("render",this._update),this._lngLat=Ru(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let p="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?p=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(p=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let v="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?v="rotateX(0deg)":this._pitchAlignment==="map"&&(v=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||o&&o.type!=="moveend"||(this._pos=this._pos.round()),this._element.style.transform=`${mc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${v} ${p}`,pe.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity(o?.type==="moveend")})).catch((()=>{}))},this._onMove=o=>{if(!this._isDragging){let h=this._clickTolerance||this._map._clickTolerance;this._isDragging=o.point.dist(this._pointerdownPos)>=h}this._isDragging&&(this._pos=o.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.n("dragstart"))),this.fire(new l.n("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.n("dragend")),this._state="inactive"},this._addDragHandler=o=>{this._element.contains(o.originalEvent.target)&&(o.preventDefault(),this._positionDelta=o.point.sub(this._pos).add(this._offset),this._pointerdownPos=o.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t?.anchor||"center",this._color=t?.color||"#3FB1CE",this._scale=t?.scale||1,this._draggable=t?.draggable||!1,this._clickTolerance=t?.clickTolerance||0,this._subpixelPositioning=t?.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t?.rotation||0,this._rotationAlignment=t?.rotationAlignment||"auto",this._pitchAlignment=t?.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t?.element)this._element=t.element,this._offset=l.P.convert(t?.offset||[0,0]);else{this._defaultMarker=!0,this._element=ye.create("div");let o=ye.createNS("http://www.w3.org/2000/svg","svg"),h=41,p=27;o.setAttributeNS(null,"display","block"),o.setAttributeNS(null,"height",`${h}px`),o.setAttributeNS(null,"width",`${p}px`),o.setAttributeNS(null,"viewBox",`0 0 ${p} ${h}`);let v=ye.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");let T=ye.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill-rule","nonzero");let M=ye.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"transform","translate(3.0, 29.0)"),M.setAttributeNS(null,"fill","#000000");let C=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let W of C){let ee=ye.createNS("http://www.w3.org/2000/svg","ellipse");ee.setAttributeNS(null,"opacity","0.04"),ee.setAttributeNS(null,"cx","10.5"),ee.setAttributeNS(null,"cy","5.80029008"),ee.setAttributeNS(null,"rx",W.rx),ee.setAttributeNS(null,"ry",W.ry),M.appendChild(ee)}let z=ye.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"fill",this._color);let P=ye.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),z.appendChild(P);let k=ye.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");let L=ye.createNS("http://www.w3.org/2000/svg","path");L.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),k.appendChild(L);let N=ye.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"transform","translate(6.0, 7.0)"),N.setAttributeNS(null,"fill","#FFFFFF");let G=ye.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"transform","translate(8.0, 8.0)");let $=ye.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#000000"),$.setAttributeNS(null,"opacity","0.25"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962");let J=ye.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#FFFFFF"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962"),G.appendChild($),G.appendChild(J),T.appendChild(M),T.appendChild(z),T.appendChild(k),T.appendChild(N),T.appendChild(G),o.appendChild(T),o.setAttributeNS(null,"height",h*this._scale+"px"),o.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(o),this._offset=l.P.convert(t?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(o=>{o.preventDefault()})),this._element.addEventListener("mousedown",(o=>{o.preventDefault()})),Iu(this._element,this._anchor,"marker"),t?.className)for(let o of t.className.split(" "))this._element.classList.add(o);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=l.W.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){let p=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){let t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var o,h;let p=(o=this._map)===null||o===void 0?void 0:o.terrain,v=this._map.transform.isLocationOccluded(this._lngLat);if(!p||v){let N=v?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==N&&(this._element.style.opacity=N,this._element.classList.toggle("maplibregl-marker-covered",v)))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}let T=this._map,M=T.terrain.depthAtPoint(this._pos),C=T.terrain.getElevationForLngLat(this._lngLat,T.transform);if(T.transform.lngLatToCameraDepth(this._lngLat,C)-M<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");let z=-this._offset.y/T.transform.pixelsPerMeter,P=Math.sin(T.getPitch()*Math.PI/180)*z,k=T.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),L=T.transform.lngLatToCameraDepth(this._lngLat,C+P)-k>.006;!((h=this._popup)===null||h===void 0)&&h.isOpen()&&L&&this._popup.remove(),this._element.style.opacity=L?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",L)}getOffset(){return this._offset}setOffset(t){return this._offset=l.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,o){return(this._opacity===void 0||t===void 0&&o===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=String(t)),o!==void 0&&(this._opacityWhenCovered=String(o)),this._map&&this._updateOpacity(!0),this}}let tp={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Qs=0,Ko=!1,ip={maxWidth:100,unit:"metric"};function _c(g,t,o){let h=o?.maxWidth||100,p=g._container.clientHeight/2,v=g._container.clientWidth/2,T=g.unproject([v-h/2,p]),M=g.unproject([v+h/2,p]),C=Math.round(g.project(M).x-g.project(T).x),z=Math.min(h,C,g._container.clientWidth),P=T.distanceTo(M);if(o?.unit==="imperial"){let k=3.2808*P;k>5280?Qo(t,z,k/5280,g._getUIString("ScaleControl.Miles")):Qo(t,z,k,g._getUIString("ScaleControl.Feet"))}else o?.unit==="nautical"?Qo(t,z,P/1852,g._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Qo(t,z,P/1e3,g._getUIString("ScaleControl.Kilometers")):Qo(t,z,P,g._getUIString("ScaleControl.Meters"))}function Qo(g,t,o,h){let p=(function(v){let T=Math.pow(10,`${Math.floor(v)}`.length-1),M=v/T;return M=M>=10?10:M>=5?5:M>=3?3:M>=2?2:M>=1?1:(function(C){let z=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*z)/z})(M),T*M})(o);g.style.width=t*(p/o)+"px",g.innerHTML=`${p}&nbsp;${h}`}let np={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},ku=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Lu(g){if(g){if(typeof g=="number"){let t=Math.round(Math.abs(g)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,g),"top-left":new l.P(t,t),"top-right":new l.P(-t,t),bottom:new l.P(0,-g),"bottom-left":new l.P(t,-t),"bottom-right":new l.P(-t,-t),left:new l.P(g,0),right:new l.P(-g,0)}}if(g instanceof l.P||Array.isArray(g)){let t=l.P.convert(g);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:l.P.convert(g.center||[0,0]),top:l.P.convert(g.top||[0,0]),"top-left":l.P.convert(g["top-left"]||[0,0]),"top-right":l.P.convert(g["top-right"]||[0,0]),bottom:l.P.convert(g.bottom||[0,0]),"bottom-left":l.P.convert(g["bottom-left"]||[0,0]),"bottom-right":l.P.convert(g["bottom-right"]||[0,0]),left:l.P.convert(g.left||[0,0]),right:l.P.convert(g.right||[0,0])}}return Lu(new l.P(0,0))}let rp=D;y.AJAXError=l.cG,y.EXTENT=l.a6,y.Event=l.n,y.Evented=l.E,y.LngLat=l.W,y.MercatorCoordinate=l.a7,y.Point=l.P,y.addProtocol=l.cH,y.config=l.c,y.removeProtocol=l.cI,y.AttributionControl=Rr,y.BoxZoomHandler=ga,y.CanvasSource=Qa,y.CooperativeGesturesHandler=it,y.DoubleClickZoomHandler=Qd,y.DragPanHandler=Kr,y.DragRotateHandler=hc,y.EdgeInsets=ks,y.FullscreenControl=class extends l.E{constructor(g={}){var t;super(),this._onFullscreenChange=()=>{var o;let h=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;!((o=h?.shadowRoot)===null||o===void 0)&&o.fullscreenElement;)h=h.shadowRoot.fullscreenElement;h===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(t=g.pseudo)!==null&&t!==void 0&&t,g?.container&&(g.container instanceof HTMLElement?this._container=g.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(g){return this._map=g,this._container||(this._container=this._map.getContainer()),this._controlContainer=ye.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let g=this._fullscreenButton=ye.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ye.create("span","maplibregl-ctrl-icon",g).setAttribute("aria-hidden","true"),g.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let g=this._getTitle();this._fullscreenButton.setAttribute("aria-label",g),this._fullscreenButton.title=g}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.n("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},y.GeoJSONSource=xt,y.GeolocateControl=class extends l.E{constructor(g){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new l.n("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.n("geolocate",t)),this._finish()}},this._updateCamera=t=>{let o=new l.W(t.coords.longitude,t.coords.latitude),h=t.coords.accuracy,p=this._map.getBearing(),v=l.e({bearing:p},this.options.fitBoundsOptions),T=Xe.fromLngLat(o,h);this._map.fitBounds(T,v,{geolocateSource:!0})},this._updateMarker=t=>{if(t){let o=new l.W(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(o).addTo(this._map),this._userLocationDotMarker.setLngLat(o).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Ko)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.n("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;let o=t?.[0]instanceof ResizeObserverEntry;t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||o||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.n("trackuserlocationend")),this.fire(new l.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>{t.preventDefault()})),this._geolocateButton=ye.create("button","maplibregl-ctrl-geolocate",this._container),ye.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");let o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{let o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ye.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new gc({element:this._dotElement}),this._circleElement=ye.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new gc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=l.e({},tp,g)}onAdd(g){return this._map=g,this._container=ye.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return l._(this,arguments,void 0,(function*(t=!1){if(Fa!==void 0&&!t)return Fa;if(window.navigator.permissions===void 0)return Fa=!!window.navigator.geolocation,Fa;try{Fa=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Fa=!!window.navigator.geolocation}return Fa}))})().then((t=>this._finishSetupUI(t))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,Qs=0,Ko=!1}_isOutOfMapMaxBounds(g){let t=this._map.getMaxBounds(),o=g.coords;return t&&(o.longitude<t.getWest()||o.longitude>t.getEast()||o.latitude<t.getSouth()||o.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let g=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&g))return;let t=this._map.project(g),o=this._map.unproject([t.x+100,t.y]),h=g.distanceTo(o)/100,p=2*this._accuracy/h;this._circleElement.style.width=`${p.toFixed(2)}px`,this._circleElement.style.height=`${p.toFixed(2)}px`}trigger(){if(!this._setup)return l.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.n("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Qs--,Ko=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.n("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.n("trackuserlocationstart")),this.fire(new l.n("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let g;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Qs++,Qs>1?(g={maximumAge:6e5,timeout:0},Ko=!0):(g=this.options.positionOptions,Ko=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,g)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},y.GlobeControl=class{constructor(){this._toggleProjection=()=>{var g;let t=(g=this._map.getProjection())===null||g===void 0?void 0:g.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var g;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((g=this._map.getProjection())===null||g===void 0?void 0:g.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(g){return this._map=g,this._container=ye.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ye.create("button","maplibregl-ctrl-globe",this._container),ye.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},y.Hash=ac,y.ImageSource=_i,y.KeyboardHandler=Om,y.LngLatBounds=Xe,y.LogoControl=Jd,y.Map=Pu,y.MapLibreMap=Pu,y.MapMouseEvent=vr,y.MapTouchEvent=sc,y.MapWheelEvent=Am,y.Marker=gc,y.NavigationControl=class{constructor(g){this._updateZoomButtons=()=>{let t=this._map.getZoom(),o=t===this._map.getMaxZoom(),h=t===this._map.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=h,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",h.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,o)=>{let h=this._map._getUIString(`NavigationControl.${o}`);t.title=h,t.setAttribute("aria-label",h)},this.options=l.e({},ep,g),this._container=ye.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),ye.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),ye.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=ye.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(g){return this._map=g,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new fc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(g,t){let o=ye.create("button",g,this._container);return o.type="button",o.addEventListener("click",t),o}},y.Popup=class extends l.E{constructor(g){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.n("close"))),this),this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ye.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ye.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let M of this.options.className.split(" "))this._container.classList.add(M);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}let o;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Ru(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),t&&"point"in t&&t.point&&(o=t.point),this._trackPointer&&!o)return;let h=this._flatPos=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&o?o:this._map.transform.locationToScreenPoint(this._lngLat));let p=this.options.anchor,v=Lu(this.options.offset);if(!p){let M=this._container.offsetWidth,C=this._container.offsetHeight,z=(function(k){var L,N,G,$;return k?{top:(L=k.top)!==null&&L!==void 0?L:0,right:(N=k.right)!==null&&N!==void 0?N:0,bottom:(G=k.bottom)!==null&&G!==void 0?G:0,left:($=k.left)!==null&&$!==void 0?$:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding),P;P=h.y+v.bottom.y<C+z.top?["top"]:h.y>this._map.transform.height-C-z.bottom?["bottom"]:[],h.x<M/2+z.left?P.push("left"):h.x>this._map.transform.width-M/2-z.right&&P.push("right"),p=P.length===0?"bottom":P.join("-")}let T=h.add(v[p]);this.options.subpixelPositioning||(T=T.round()),this._container.style.transform=`${mc[p]} translate(${T.x}px,${T.y}px)`,Iu(this._container,p,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(np),g)}addTo(g){return this._map&&this.remove(),this._map=g,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(g){return this._lngLat=l.W.convert(g),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(g){return this.setDOMContent(document.createTextNode(g))}setHTML(g){let t=document.createDocumentFragment(),o=document.createElement("body"),h;for(o.innerHTML=g;h=o.firstChild,h;)t.appendChild(h);return this.setDOMContent(t)}getMaxWidth(){var g;return(g=this._container)===null||g===void 0?void 0:g.style.maxWidth}setMaxWidth(g){return this.options.maxWidth=g,this._update(),this}setDOMContent(g){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ye.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(g),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(g){return this._container&&this._container.classList.add(g),this}removeClassName(g){return this._container&&this._container.classList.remove(g),this}setOffset(g){return this.options.offset=g,this._update(),this}toggleClassName(g){if(this._container)return this._container.classList.toggle(g)}setSubpixelPositioning(g){this.options.subpixelPositioning=g}setPadding(g){this.options.padding=g,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=ye.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let g=this._container.querySelector(ku);g&&g.focus()}},y.RasterDEMTileSource=zt,y.RasterTileSource=ci,y.ScaleControl=class{constructor(g){this._onMove=()=>{_c(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,_c(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ip),g)}getDefaultPosition(){return"bottom-left"}onAdd(g){return this._map=g,this._container=ye.create("div","maplibregl-ctrl maplibregl-ctrl-scale",g.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},y.ScrollZoomHandler=Kd,y.Style=jo,y.TerrainControl=class{constructor(g){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=g}onAdd(g){return this._map=g,this._container=ye.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ye.create("button","maplibregl-ctrl-terrain",this._container),ye.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},y.TwoFingersTouchPitchHandler=Ba,y.TwoFingersTouchRotateHandler=Lm,y.TwoFingersTouchZoomHandler=km,y.TwoFingersTouchZoomRotateHandler=Je,y.VectorTileSource=Gt,y.VideoSource=Dn,y.addSourceType=(g,t)=>l._(void 0,void 0,void 0,(function*(){if(As(g))throw new Error(`A source type called "${g}" already exists.`);((o,h)=>{ha[o]=h})(g,t)})),y.clearPrewarmedResources=function(){let g=Kt;g&&(g.isPreloaded()&&g.numActive()===1?(g.release(_t),Kt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},y.createTileMesh=Fs,y.getGlobalDispatcher=qt,y.getMaxParallelImageRequests=function(){return l.c.MAX_PARALLEL_IMAGE_REQUESTS},y.getRTLTextPluginStatus=function(){return Gr().getRTLTextPluginStatus()},y.getVersion=function(){return rp},y.getWorkerCount=function(){return lt.workerCount},y.getWorkerUrl=function(){return l.c.WORKER_URL},y.importScriptInWorkers=function(g){return qt().broadcast("IS",g)},y.isTimeFrozen=function(){return oe.isFrozen()},y.now=le,y.prewarm=function(){Gn().acquire(_t)},y.restoreNow=function(){oe.restoreNow()},y.setMaxParallelImageRequests=function(g){l.c.MAX_PARALLEL_IMAGE_REQUESTS=g},y.setNow=function(g){oe.setNow(g)},y.setRTLTextPlugin=function(g,t){return Gr().setRTLTextPlugin(g,t)},y.setWorkerCount=function(g){lt.workerCount=g},y.setWorkerUrl=function(g){l.c.WORKER_URL=g}}));var f=i;return f}))});var e5=Ha(Mr=>{"use strict";var _C=Rt();function Jw(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function ll(){}var Sr={d:{f:ll,r:function(){throw Error(Jw(522))},D:ll,C:ll,L:ll,m:ll,X:ll,S:ll,M:ll},p:0,findDOMNode:null},yC=Symbol.for("react.portal");function vC(i,a,u){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:yC,key:f==null?null:""+f,children:i,containerInfo:a,implementation:u}}var Pp=_C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function S0(i,a){if(i==="font")return"";if(typeof a=="string")return a==="use-credentials"?a:""}Mr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Sr;Mr.createPortal=function(i,a){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)throw Error(Jw(299));return vC(i,a,null,u)};Mr.flushSync=function(i){var a=Pp.T,u=Sr.p;try{if(Pp.T=null,Sr.p=2,i)return i()}finally{Pp.T=a,Sr.p=u,Sr.d.f()}};Mr.preconnect=function(i,a){typeof i=="string"&&(a?(a=a.crossOrigin,a=typeof a=="string"?a==="use-credentials"?a:"":void 0):a=null,Sr.d.C(i,a))};Mr.prefetchDNS=function(i){typeof i=="string"&&Sr.d.D(i)};Mr.preinit=function(i,a){if(typeof i=="string"&&a&&typeof a.as=="string"){var u=a.as,f=S0(u,a.crossOrigin),y=typeof a.integrity=="string"?a.integrity:void 0,l=typeof a.fetchPriority=="string"?a.fetchPriority:void 0;u==="style"?Sr.d.S(i,typeof a.precedence=="string"?a.precedence:void 0,{crossOrigin:f,integrity:y,fetchPriority:l}):u==="script"&&Sr.d.X(i,{crossOrigin:f,integrity:y,fetchPriority:l,nonce:typeof a.nonce=="string"?a.nonce:void 0})}};Mr.preinitModule=function(i,a){if(typeof i=="string")if(typeof a=="object"&&a!==null){if(a.as==null||a.as==="script"){var u=S0(a.as,a.crossOrigin);Sr.d.M(i,{crossOrigin:u,integrity:typeof a.integrity=="string"?a.integrity:void 0,nonce:typeof a.nonce=="string"?a.nonce:void 0})}}else a==null&&Sr.d.M(i)};Mr.preload=function(i,a){if(typeof i=="string"&&typeof a=="object"&&a!==null&&typeof a.as=="string"){var u=a.as,f=S0(u,a.crossOrigin);Sr.d.L(i,u,{crossOrigin:f,integrity:typeof a.integrity=="string"?a.integrity:void 0,nonce:typeof a.nonce=="string"?a.nonce:void 0,type:typeof a.type=="string"?a.type:void 0,fetchPriority:typeof a.fetchPriority=="string"?a.fetchPriority:void 0,referrerPolicy:typeof a.referrerPolicy=="string"?a.referrerPolicy:void 0,imageSrcSet:typeof a.imageSrcSet=="string"?a.imageSrcSet:void 0,imageSizes:typeof a.imageSizes=="string"?a.imageSizes:void 0,media:typeof a.media=="string"?a.media:void 0})}};Mr.preloadModule=function(i,a){if(typeof i=="string")if(a){var u=S0(a.as,a.crossOrigin);Sr.d.m(i,{as:typeof a.as=="string"&&a.as!=="script"?a.as:void 0,crossOrigin:u,integrity:typeof a.integrity=="string"?a.integrity:void 0})}else Sr.d.m(i)};Mr.requestFormReset=function(i){Sr.d.r(i)};Mr.unstable_batchedUpdates=function(i,a){return i(a)};Mr.useFormState=function(i,a,u){return Pp.H.useFormState(i,a,u)};Mr.useFormStatus=function(){return Pp.H.useHostTransitionStatus()};Mr.version="19.2.7"});var M0=Ha((X7,i5)=>{"use strict";function t5(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t5)}catch(i){console.error(i)}}t5(),i5.exports=e5()});var x5=Ha(Fi=>{"use strict";function yy(i,a){var u=i.length;i.push(a);e:for(;0<u;){var f=u-1>>>1,y=i[f];if(0<R0(y,a))i[f]=a,i[u]=y,u=f;else break e}}function xo(i){return i.length===0?null:i[0]}function k0(i){if(i.length===0)return null;var a=i[0],u=i.pop();if(u!==a){i[0]=u;e:for(var f=0,y=i.length,l=y>>>1;f<l;){var D=2*(f+1)-1,B=i[D],q=D+1,K=i[q];if(0>R0(B,u))q<y&&0>R0(K,B)?(i[f]=K,i[q]=u,f=q):(i[f]=B,i[D]=u,f=D);else if(q<y&&0>R0(K,u))i[f]=K,i[q]=u,f=q;else break e}}return a}function R0(i,a){var u=i.sortIndex-a.sortIndex;return u!==0?u:i.id-a.id}Fi.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(d5=performance,Fi.unstable_now=function(){return d5.now()}):(my=Date,p5=my.now(),Fi.unstable_now=function(){return my.now()-p5});var d5,my,p5,ss=[],cl=[],GC=1,xa=null,fr=3,vy=!1,Lp=!1,Op=!1,by=!1,g5=typeof setTimeout=="function"?setTimeout:null,_5=typeof clearTimeout=="function"?clearTimeout:null,f5=typeof setImmediate<"u"?setImmediate:null;function I0(i){for(var a=xo(cl);a!==null;){if(a.callback===null)k0(cl);else if(a.startTime<=i)k0(cl),a.sortIndex=a.expirationTime,yy(ss,a);else break;a=xo(cl)}}function xy(i){if(Op=!1,I0(i),!Lp)if(xo(ss)!==null)Lp=!0,_h||(_h=!0,gh());else{var a=xo(cl);a!==null&&wy(xy,a.startTime-i)}}var _h=!1,Bp=-1,y5=5,v5=-1;function b5(){return by?!0:!(Fi.unstable_now()-v5<y5)}function gy(){if(by=!1,_h){var i=Fi.unstable_now();v5=i;var a=!0;try{e:{Lp=!1,Op&&(Op=!1,_5(Bp),Bp=-1),vy=!0;var u=fr;try{t:{for(I0(i),xa=xo(ss);xa!==null&&!(xa.expirationTime>i&&b5());){var f=xa.callback;if(typeof f=="function"){xa.callback=null,fr=xa.priorityLevel;var y=f(xa.expirationTime<=i);if(i=Fi.unstable_now(),typeof y=="function"){xa.callback=y,I0(i),a=!0;break t}xa===xo(ss)&&k0(ss),I0(i)}else k0(ss);xa=xo(ss)}if(xa!==null)a=!0;else{var l=xo(cl);l!==null&&wy(xy,l.startTime-i),a=!1}}break e}finally{xa=null,fr=u,vy=!1}a=void 0}}finally{a?gh():_h=!1}}}var gh;typeof f5=="function"?gh=function(){f5(gy)}:typeof MessageChannel<"u"?(_y=new MessageChannel,m5=_y.port2,_y.port1.onmessage=gy,gh=function(){m5.postMessage(null)}):gh=function(){g5(gy,0)};var _y,m5;function wy(i,a){Bp=g5(function(){i(Fi.unstable_now())},a)}Fi.unstable_IdlePriority=5;Fi.unstable_ImmediatePriority=1;Fi.unstable_LowPriority=4;Fi.unstable_NormalPriority=3;Fi.unstable_Profiling=null;Fi.unstable_UserBlockingPriority=2;Fi.unstable_cancelCallback=function(i){i.callback=null};Fi.unstable_forceFrameRate=function(i){0>i||125<i?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):y5=0<i?Math.floor(1e3/i):5};Fi.unstable_getCurrentPriorityLevel=function(){return fr};Fi.unstable_next=function(i){switch(fr){case 1:case 2:case 3:var a=3;break;default:a=fr}var u=fr;fr=a;try{return i()}finally{fr=u}};Fi.unstable_requestPaint=function(){by=!0};Fi.unstable_runWithPriority=function(i,a){switch(i){case 1:case 2:case 3:case 4:case 5:break;default:i=3}var u=fr;fr=i;try{return a()}finally{fr=u}};Fi.unstable_scheduleCallback=function(i,a,u){var f=Fi.unstable_now();switch(typeof u=="object"&&u!==null?(u=u.delay,u=typeof u=="number"&&0<u?f+u:f):u=f,i){case 1:var y=-1;break;case 2:y=250;break;case 5:y=1073741823;break;case 4:y=1e4;break;default:y=5e3}return y=u+y,i={id:GC++,callback:a,priorityLevel:i,startTime:u,expirationTime:y,sortIndex:-1},u>f?(i.sortIndex=u,yy(cl,i),xo(ss)===null&&i===xo(cl)&&(Op?(_5(Bp),Bp=-1):Op=!0,wy(xy,u-f))):(i.sortIndex=y,yy(ss,i),Lp||vy||(Lp=!0,_h||(_h=!0,gh()))),i};Fi.unstable_shouldYield=b5;Fi.unstable_wrapCallback=function(i){var a=fr;return function(){var u=fr;fr=a;try{return i.apply(this,arguments)}finally{fr=u}}}});var T5=Ha((NP,w5)=>{"use strict";w5.exports=x5()});var LS=Ha(a1=>{"use strict";var zn=T5(),Y3=Rt(),ZC=M0();function ke(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function W3(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Sf(i){var a=i,u=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(u=a.return),i=a.return;while(i)}return a.tag===3?u:null}function K3(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function Q3(i){if(i.tag===31){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function S5(i){if(Sf(i)!==i)throw Error(ke(188))}function HC(i){var a=i.alternate;if(!a){if(a=Sf(i),a===null)throw Error(ke(188));return a!==i?null:i}for(var u=i,f=a;;){var y=u.return;if(y===null)break;var l=y.alternate;if(l===null){if(f=y.return,f!==null){u=f;continue}break}if(y.child===l.child){for(l=y.child;l;){if(l===u)return S5(y),i;if(l===f)return S5(y),a;l=l.sibling}throw Error(ke(188))}if(u.return!==f.return)u=y,f=l;else{for(var D=!1,B=y.child;B;){if(B===u){D=!0,u=y,f=l;break}if(B===f){D=!0,f=y,u=l;break}B=B.sibling}if(!D){for(B=l.child;B;){if(B===u){D=!0,u=l,f=y;break}if(B===f){D=!0,f=l,u=y;break}B=B.sibling}if(!D)throw Error(ke(189))}}if(u.alternate!==f)throw Error(ke(190))}if(u.tag!==3)throw Error(ke(188));return u.stateNode.current===u?i:a}function J3(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=J3(i),a!==null)return a;i=i.sibling}return null}var Ri=Object.assign,$C=Symbol.for("react.element"),L0=Symbol.for("react.transitional.element"),Zp=Symbol.for("react.portal"),Th=Symbol.for("react.fragment"),e4=Symbol.for("react.strict_mode"),iv=Symbol.for("react.profiler"),t4=Symbol.for("react.consumer"),ms=Symbol.for("react.context"),Kv=Symbol.for("react.forward_ref"),nv=Symbol.for("react.suspense"),rv=Symbol.for("react.suspense_list"),Qv=Symbol.for("react.memo"),ul=Symbol.for("react.lazy"),av=Symbol.for("react.activity"),XC=Symbol.for("react.memo_cache_sentinel"),M5=Symbol.iterator;function Fp(i){return i===null||typeof i!="object"?null:(i=M5&&i[M5]||i["@@iterator"],typeof i=="function"?i:null)}var YC=Symbol.for("react.client.reference");function ov(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===YC?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case Th:return"Fragment";case iv:return"Profiler";case e4:return"StrictMode";case nv:return"Suspense";case rv:return"SuspenseList";case av:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case Zp:return"Portal";case ms:return i.displayName||"Context";case t4:return(i._context.displayName||"Context")+".Consumer";case Kv:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Qv:return a=i.displayName||null,a!==null?a:ov(i.type)||"Memo";case ul:a=i._payload,i=i._init;try{return ov(i(a))}catch{}}return null}var Hp=Array.isArray,ut=Y3.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Wt=ZC.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Rc={pending:!1,data:null,method:null,action:null},sv=[],Sh=-1;function Eo(i){return{current:i}}function qn(i){0>Sh||(i.current=sv[Sh],sv[Sh]=null,Sh--)}function Ti(i,a){Sh++,sv[Sh]=i.current,i.current=a}var Mo=Eo(null),uf=Eo(null),xl=Eo(null),fg=Eo(null);function mg(i,a){switch(Ti(xl,a),Ti(uf,i),Ti(Mo,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?R3(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=R3(a),i=xS(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}qn(Mo),Ti(Mo,i)}function jh(){qn(Mo),qn(uf),qn(xl)}function lv(i){i.memoizedState!==null&&Ti(fg,i);var a=Mo.current,u=xS(a,i.type);a!==u&&(Ti(uf,i),Ti(Mo,u))}function gg(i){uf.current===i&&(qn(Mo),qn(uf)),fg.current===i&&(qn(fg),xf._currentValue=Rc)}var Ty,E5;function Ac(i){if(Ty===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);Ty=a&&a[1]||"",E5=-1<u.stack.indexOf(`
801
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
802
+ `+Ty+i+E5}var Sy=!1;function My(i,a){if(!i||Sy)return"";Sy=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(le){var oe=le}Reflect.construct(i,[],pe)}else{try{pe.call()}catch(le){oe=le}i.call(pe.prototype)}}else{try{throw Error()}catch(le){oe=le}(pe=i())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(le){if(le&&oe&&typeof le.stack=="string")return[le.stack,oe.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var l=f.DetermineComponentFrameRoot(),D=l[0],B=l[1];if(D&&B){var q=D.split(`
803
+ `),K=B.split(`
804
+ `);for(y=f=0;f<q.length&&!q[f].includes("DetermineComponentFrameRoot");)f++;for(;y<K.length&&!K[y].includes("DetermineComponentFrameRoot");)y++;if(f===q.length||y===K.length)for(f=q.length-1,y=K.length-1;1<=f&&0<=y&&q[f]!==K[y];)y--;for(;1<=f&&0<=y;f--,y--)if(q[f]!==K[y]){if(f!==1||y!==1)do if(f--,y--,0>y||q[f]!==K[y]){var fe=`
805
+ `+q[f].replace(" at new "," at ");return i.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",i.displayName)),fe}while(1<=f&&0<=y);break}}}finally{Sy=!1,Error.prepareStackTrace=u}return(u=i?i.displayName||i.name:"")?Ac(u):""}function WC(i,a){switch(i.tag){case 26:case 27:case 5:return Ac(i.type);case 16:return Ac("Lazy");case 13:return i.child!==a&&a!==null?Ac("Suspense Fallback"):Ac("Suspense");case 19:return Ac("SuspenseList");case 0:case 15:return My(i.type,!1);case 11:return My(i.type.render,!1);case 1:return My(i.type,!0);case 31:return Ac("Activity");default:return""}}function C5(i){try{var a="",u=null;do a+=WC(i,u),u=i,i=i.return;while(i);return a}catch(f){return`
806
+ Error generating stack: `+f.message+`
807
+ `+f.stack}}var cv=Object.prototype.hasOwnProperty,Jv=zn.unstable_scheduleCallback,Ey=zn.unstable_cancelCallback,KC=zn.unstable_shouldYield,QC=zn.unstable_requestPaint,aa=zn.unstable_now,JC=zn.unstable_getCurrentPriorityLevel,i4=zn.unstable_ImmediatePriority,n4=zn.unstable_UserBlockingPriority,_g=zn.unstable_NormalPriority,e8=zn.unstable_LowPriority,r4=zn.unstable_IdlePriority,t8=zn.log,i8=zn.unstable_setDisableYieldValue,Mf=null,oa=null;function gl(i){if(typeof t8=="function"&&i8(i),oa&&typeof oa.setStrictMode=="function")try{oa.setStrictMode(Mf,i)}catch{}}var sa=Math.clz32?Math.clz32:a8,n8=Math.log,r8=Math.LN2;function a8(i){return i>>>=0,i===0?32:31-(n8(i)/r8|0)|0}var O0=256,B0=262144,F0=4194304;function zc(i){var a=i&42;if(a!==0)return a;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function qg(i,a,u){var f=i.pendingLanes;if(f===0)return 0;var y=0,l=i.suspendedLanes,D=i.pingedLanes;i=i.warmLanes;var B=f&134217727;return B!==0?(f=B&~l,f!==0?y=zc(f):(D&=B,D!==0?y=zc(D):u||(u=B&~i,u!==0&&(y=zc(u))))):(B=f&~l,B!==0?y=zc(B):D!==0?y=zc(D):u||(u=f&~i,u!==0&&(y=zc(u)))),y===0?0:a!==0&&a!==y&&(a&l)===0&&(l=y&-y,u=a&-a,l>=u||l===32&&(u&4194048)!==0)?a:y}function Ef(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function o8(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function a4(){var i=F0;return F0<<=1,(F0&62914560)===0&&(F0=4194304),i}function Cy(i){for(var a=[],u=0;31>u;u++)a.push(i);return a}function Cf(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function s8(i,a,u,f,y,l){var D=i.pendingLanes;i.pendingLanes=u,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=u,i.entangledLanes&=u,i.errorRecoveryDisabledLanes&=u,i.shellSuspendCounter=0;var B=i.entanglements,q=i.expirationTimes,K=i.hiddenUpdates;for(u=D&~u;0<u;){var fe=31-sa(u),pe=1<<fe;B[fe]=0,q[fe]=-1;var oe=K[fe];if(oe!==null)for(K[fe]=null,fe=0;fe<oe.length;fe++){var le=oe[fe];le!==null&&(le.lane&=-536870913)}u&=~pe}f!==0&&o4(i,f,0),l!==0&&y===0&&i.tag!==0&&(i.suspendedLanes|=l&~(D&~a))}function o4(i,a,u){i.pendingLanes|=a,i.suspendedLanes&=~a;var f=31-sa(a);i.entangledLanes|=a,i.entanglements[f]=i.entanglements[f]|1073741824|u&261930}function s4(i,a){var u=i.entangledLanes|=a;for(i=i.entanglements;u;){var f=31-sa(u),y=1<<f;y&a|i[f]&a&&(i[f]|=a),u&=~y}}function l4(i,a){var u=a&-a;return u=(u&42)!==0?1:eb(u),(u&(i.suspendedLanes|a))!==0?0:u}function eb(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function tb(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function c4(){var i=Wt.p;return i!==0?i:(i=window.event,i===void 0?32:RS(i.type))}function A5(i,a){var u=Wt.p;try{return Wt.p=i,a()}finally{Wt.p=u}}var kl=Math.random().toString(36).slice(2),nr="__reactFiber$"+kl,jr="__reactProps$"+kl,Jh="__reactContainer$"+kl,uv="__reactEvents$"+kl,l8="__reactListeners$"+kl,c8="__reactHandles$"+kl,z5="__reactResources$"+kl,Af="__reactMarker$"+kl;function ib(i){delete i[nr],delete i[jr],delete i[uv],delete i[l8],delete i[c8]}function Mh(i){var a=i[nr];if(a)return a;for(var u=i.parentNode;u;){if(a=u[Jh]||u[nr]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(i=B3(i);i!==null;){if(u=i[nr])return u;i=B3(i)}return a}i=u,u=i.parentNode}return null}function ed(i){if(i=i[nr]||i[Jh]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function $p(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(ke(33))}function Lh(i){var a=i[z5];return a||(a=i[z5]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function jn(i){i[Af]=!0}var u4=new Set,h4={};function jc(i,a){qh(i,a),qh(i+"Capture",a)}function qh(i,a){for(h4[i]=a,i=0;i<a.length;i++)u4.add(a[i])}var u8=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),D5={},P5={};function h8(i){return cv.call(P5,i)?!0:cv.call(D5,i)?!1:u8.test(i)?P5[i]=!0:(D5[i]=!0,!1)}function J0(i,a,u){if(h8(a))if(u===null)i.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+u)}}function N0(i,a,u){if(u===null)i.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,""+u)}}function ls(i,a,u,f){if(f===null)i.removeAttribute(u);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(u);return}i.setAttributeNS(a,u,""+f)}}function Ta(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function d4(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function d8(i,a,u){var f=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var y=f.get,l=f.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return y.call(this)},set:function(D){u=""+D,l.call(this,D)}}),Object.defineProperty(i,a,{enumerable:f.enumerable}),{getValue:function(){return u},setValue:function(D){u=""+D},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function hv(i){if(!i._valueTracker){var a=d4(i)?"checked":"value";i._valueTracker=d8(i,a,""+i[a])}}function p4(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var u=a.getValue(),f="";return i&&(f=d4(i)?i.checked?"true":"false":i.value),i=f,i!==u?(a.setValue(i),!0):!1}function yg(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var p8=/[\n"\\]/g;function Ea(i){return i.replace(p8,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function dv(i,a,u,f,y,l,D,B){i.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?i.type=D:i.removeAttribute("type"),a!=null?D==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+Ta(a)):i.value!==""+Ta(a)&&(i.value=""+Ta(a)):D!=="submit"&&D!=="reset"||i.removeAttribute("value"),a!=null?pv(i,D,Ta(a)):u!=null?pv(i,D,Ta(u)):f!=null&&i.removeAttribute("value"),y==null&&l!=null&&(i.defaultChecked=!!l),y!=null&&(i.checked=y&&typeof y!="function"&&typeof y!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?i.name=""+Ta(B):i.removeAttribute("name")}function f4(i,a,u,f,y,l,D,B){if(l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(i.type=l),a!=null||u!=null){if(!(l!=="submit"&&l!=="reset"||a!=null)){hv(i);return}u=u!=null?""+Ta(u):"",a=a!=null?""+Ta(a):u,B||a===i.value||(i.value=a),i.defaultValue=a}f=f??y,f=typeof f!="function"&&typeof f!="symbol"&&!!f,i.checked=B?i.checked:!!f,i.defaultChecked=!!f,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(i.name=D),hv(i)}function pv(i,a,u){a==="number"&&yg(i.ownerDocument)===i||i.defaultValue===""+u||(i.defaultValue=""+u)}function Oh(i,a,u,f){if(i=i.options,a){a={};for(var y=0;y<u.length;y++)a["$"+u[y]]=!0;for(u=0;u<i.length;u++)y=a.hasOwnProperty("$"+i[u].value),i[u].selected!==y&&(i[u].selected=y),y&&f&&(i[u].defaultSelected=!0)}else{for(u=""+Ta(u),a=null,y=0;y<i.length;y++){if(i[y].value===u){i[y].selected=!0,f&&(i[y].defaultSelected=!0);return}a!==null||i[y].disabled||(a=i[y])}a!==null&&(a.selected=!0)}}function m4(i,a,u){if(a!=null&&(a=""+Ta(a),a!==i.value&&(i.value=a),u==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=u!=null?""+Ta(u):""}function g4(i,a,u,f){if(a==null){if(f!=null){if(u!=null)throw Error(ke(92));if(Hp(f)){if(1<f.length)throw Error(ke(93));f=f[0]}u=f}u==null&&(u=""),a=u}u=Ta(a),i.defaultValue=u,f=i.textContent,f===u&&f!==""&&f!==null&&(i.value=f),hv(i)}function Gh(i,a){if(a){var u=i.firstChild;if(u&&u===i.lastChild&&u.nodeType===3){u.nodeValue=a;return}}i.textContent=a}var f8=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function R5(i,a,u){var f=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?f?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":f?i.setProperty(a,u):typeof u!="number"||u===0||f8.has(a)?a==="float"?i.cssFloat=u:i[a]=(""+u).trim():i[a]=u+"px"}function _4(i,a,u){if(a!=null&&typeof a!="object")throw Error(ke(62));if(i=i.style,u!=null){for(var f in u)!u.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?i.setProperty(f,""):f==="float"?i.cssFloat="":i[f]="");for(var y in a)f=a[y],a.hasOwnProperty(y)&&u[y]!==f&&R5(i,y,f)}else for(var l in a)a.hasOwnProperty(l)&&R5(i,l,a[l])}function nb(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var m8=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),g8=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function eg(i){return g8.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function gs(){}var fv=null;function rb(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Eh=null,Bh=null;function I5(i){var a=ed(i);if(a&&(i=a.stateNode)){var u=i[jr]||null;e:switch(i=a.stateNode,a.type){case"input":if(dv(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=i;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Ea(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var f=u[a];if(f!==i&&f.form===i.form){var y=f[jr]||null;if(!y)throw Error(ke(90));dv(f,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<u.length;a++)f=u[a],f.form===i.form&&p4(f)}break e;case"textarea":m4(i,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&Oh(i,!!u.multiple,a,!1)}}}var Ay=!1;function y4(i,a,u){if(Ay)return i(a,u);Ay=!0;try{var f=i(a);return f}finally{if(Ay=!1,(Eh!==null||Bh!==null)&&(t1(),Eh&&(a=Eh,i=Bh,Bh=Eh=null,I5(a),i)))for(a=0;a<i.length;a++)I5(i[a])}}function hf(i,a){var u=i.stateNode;if(u===null)return null;var f=u[jr]||null;if(f===null)return null;u=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break e;default:i=!1}if(i)return null;if(u&&typeof u!="function")throw Error(ke(231,a,typeof u));return u}var xs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mv=!1;if(xs)try{yh={},Object.defineProperty(yh,"passive",{get:function(){mv=!0}}),window.addEventListener("test",yh,yh),window.removeEventListener("test",yh,yh)}catch{mv=!1}var yh,_l=null,ab=null,tg=null;function v4(){if(tg)return tg;var i,a=ab,u=a.length,f,y="value"in _l?_l.value:_l.textContent,l=y.length;for(i=0;i<u&&a[i]===y[i];i++);var D=u-i;for(f=1;f<=D&&a[u-f]===y[l-f];f++);return tg=y.slice(i,1<f?1-f:void 0)}function ig(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function U0(){return!0}function k5(){return!1}function qr(i){function a(u,f,y,l,D){this._reactName=u,this._targetInst=y,this.type=f,this.nativeEvent=l,this.target=D,this.currentTarget=null;for(var B in i)i.hasOwnProperty(B)&&(u=i[B],this[B]=u?u(l):l[B]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?U0:k5,this.isPropagationStopped=k5,this}return Ri(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=U0)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=U0)},persist:function(){},isPersistent:U0}),a}var qc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gg=qr(qc),zf=Ri({},qc,{view:0,detail:0}),_8=qr(zf),zy,Dy,Np,Zg=Ri({},zf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ob,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Np&&(Np&&i.type==="mousemove"?(zy=i.screenX-Np.screenX,Dy=i.screenY-Np.screenY):Dy=zy=0,Np=i),zy)},movementY:function(i){return"movementY"in i?i.movementY:Dy}}),L5=qr(Zg),y8=Ri({},Zg,{dataTransfer:0}),v8=qr(y8),b8=Ri({},zf,{relatedTarget:0}),Py=qr(b8),x8=Ri({},qc,{animationName:0,elapsedTime:0,pseudoElement:0}),w8=qr(x8),T8=Ri({},qc,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),S8=qr(T8),M8=Ri({},qc,{data:0}),O5=qr(M8),E8={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},C8={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},A8={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function z8(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=A8[i])?!!a[i]:!1}function ob(){return z8}var D8=Ri({},zf,{key:function(i){if(i.key){var a=E8[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=ig(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?C8[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ob,charCode:function(i){return i.type==="keypress"?ig(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?ig(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),P8=qr(D8),R8=Ri({},Zg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),B5=qr(R8),I8=Ri({},zf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ob}),k8=qr(I8),L8=Ri({},qc,{propertyName:0,elapsedTime:0,pseudoElement:0}),O8=qr(L8),B8=Ri({},Zg,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),F8=qr(B8),N8=Ri({},qc,{newState:0,oldState:0}),U8=qr(N8),V8=[9,13,27,32],sb=xs&&"CompositionEvent"in window,Wp=null;xs&&"documentMode"in document&&(Wp=document.documentMode);var j8=xs&&"TextEvent"in window&&!Wp,b4=xs&&(!sb||Wp&&8<Wp&&11>=Wp),F5=" ",N5=!1;function x4(i,a){switch(i){case"keyup":return V8.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function w4(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ch=!1;function q8(i,a){switch(i){case"compositionend":return w4(a);case"keypress":return a.which!==32?null:(N5=!0,F5);case"textInput":return i=a.data,i===F5&&N5?null:i;default:return null}}function G8(i,a){if(Ch)return i==="compositionend"||!sb&&x4(i,a)?(i=v4(),tg=ab=_l=null,Ch=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return b4&&a.locale!=="ko"?null:a.data;default:return null}}var Z8={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function U5(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!Z8[i.type]:a==="textarea"}function T4(i,a,u,f){Eh?Bh?Bh.push(f):Bh=[f]:Eh=f,a=Og(a,"onChange"),0<a.length&&(u=new Gg("onChange","change",null,u,f),i.push({event:u,listeners:a}))}var Kp=null,df=null;function H8(i){yS(i,0)}function Hg(i){var a=$p(i);if(p4(a))return i}function V5(i,a){if(i==="change")return a}var S4=!1;xs&&(xs?(j0="oninput"in document,j0||(Ry=document.createElement("div"),Ry.setAttribute("oninput","return;"),j0=typeof Ry.oninput=="function"),V0=j0):V0=!1,S4=V0&&(!document.documentMode||9<document.documentMode));var V0,j0,Ry;function j5(){Kp&&(Kp.detachEvent("onpropertychange",M4),df=Kp=null)}function M4(i){if(i.propertyName==="value"&&Hg(df)){var a=[];T4(a,df,i,rb(i)),y4(H8,a)}}function $8(i,a,u){i==="focusin"?(j5(),Kp=a,df=u,Kp.attachEvent("onpropertychange",M4)):i==="focusout"&&j5()}function X8(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Hg(df)}function Y8(i,a){if(i==="click")return Hg(a)}function W8(i,a){if(i==="input"||i==="change")return Hg(a)}function K8(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var ca=typeof Object.is=="function"?Object.is:K8;function pf(i,a){if(ca(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var u=Object.keys(i),f=Object.keys(a);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var y=u[f];if(!cv.call(a,y)||!ca(i[y],a[y]))return!1}return!0}function q5(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function G5(i,a){var u=q5(i);i=0;for(var f;u;){if(u.nodeType===3){if(f=i+u.textContent.length,i<=a&&f>=a)return{node:u,offset:a-i};i=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=q5(u)}}function E4(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?E4(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function C4(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=yg(i.document);a instanceof i.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)i=a.contentWindow;else break;a=yg(i.document)}return a}function lb(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var Q8=xs&&"documentMode"in document&&11>=document.documentMode,Ah=null,gv=null,Qp=null,_v=!1;function Z5(i,a,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;_v||Ah==null||Ah!==yg(f)||(f=Ah,"selectionStart"in f&&lb(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Qp&&pf(Qp,f)||(Qp=f,f=Og(gv,"onSelect"),0<f.length&&(a=new Gg("onSelect","select",null,a,u),i.push({event:a,listeners:f}),a.target=Ah)))}function Cc(i,a){var u={};return u[i.toLowerCase()]=a.toLowerCase(),u["Webkit"+i]="webkit"+a,u["Moz"+i]="moz"+a,u}var zh={animationend:Cc("Animation","AnimationEnd"),animationiteration:Cc("Animation","AnimationIteration"),animationstart:Cc("Animation","AnimationStart"),transitionrun:Cc("Transition","TransitionRun"),transitionstart:Cc("Transition","TransitionStart"),transitioncancel:Cc("Transition","TransitionCancel"),transitionend:Cc("Transition","TransitionEnd")},Iy={},A4={};xs&&(A4=document.createElement("div").style,"AnimationEvent"in window||(delete zh.animationend.animation,delete zh.animationiteration.animation,delete zh.animationstart.animation),"TransitionEvent"in window||delete zh.transitionend.transition);function Gc(i){if(Iy[i])return Iy[i];if(!zh[i])return i;var a=zh[i],u;for(u in a)if(a.hasOwnProperty(u)&&u in A4)return Iy[i]=a[u];return i}var z4=Gc("animationend"),D4=Gc("animationiteration"),P4=Gc("animationstart"),J8=Gc("transitionrun"),eA=Gc("transitionstart"),tA=Gc("transitioncancel"),R4=Gc("transitionend"),I4=new Map,yv="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");yv.push("scrollEnd");function Ka(i,a){I4.set(i,a),jc(a,[i])}var vg=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},wa=[],Dh=0,cb=0;function $g(){for(var i=Dh,a=cb=Dh=0;a<i;){var u=wa[a];wa[a++]=null;var f=wa[a];wa[a++]=null;var y=wa[a];wa[a++]=null;var l=wa[a];if(wa[a++]=null,f!==null&&y!==null){var D=f.pending;D===null?y.next=y:(y.next=D.next,D.next=y),f.pending=y}l!==0&&k4(u,y,l)}}function Xg(i,a,u,f){wa[Dh++]=i,wa[Dh++]=a,wa[Dh++]=u,wa[Dh++]=f,cb|=f,i.lanes|=f,i=i.alternate,i!==null&&(i.lanes|=f)}function ub(i,a,u,f){return Xg(i,a,u,f),bg(i)}function Zc(i,a){return Xg(i,null,null,a),bg(i)}function k4(i,a,u){i.lanes|=u;var f=i.alternate;f!==null&&(f.lanes|=u);for(var y=!1,l=i.return;l!==null;)l.childLanes|=u,f=l.alternate,f!==null&&(f.childLanes|=u),l.tag===22&&(i=l.stateNode,i===null||i._visibility&1||(y=!0)),i=l,l=l.return;return i.tag===3?(l=i.stateNode,y&&a!==null&&(y=31-sa(u),i=l.hiddenUpdates,f=i[y],f===null?i[y]=[a]:f.push(a),a.lane=u|536870912),l):null}function bg(i){if(50<lf)throw lf=0,Nv=null,Error(ke(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var Ph={};function iA(i,a,u,f){this.tag=i,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function na(i,a,u,f){return new iA(i,a,u,f)}function hb(i){return i=i.prototype,!(!i||!i.isReactComponent)}function ys(i,a){var u=i.alternate;return u===null?(u=na(i.tag,a,i.key,i.mode),u.elementType=i.elementType,u.type=i.type,u.stateNode=i.stateNode,u.alternate=i,i.alternate=u):(u.pendingProps=a,u.type=i.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=i.flags&65011712,u.childLanes=i.childLanes,u.lanes=i.lanes,u.child=i.child,u.memoizedProps=i.memoizedProps,u.memoizedState=i.memoizedState,u.updateQueue=i.updateQueue,a=i.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=i.sibling,u.index=i.index,u.ref=i.ref,u.refCleanup=i.refCleanup,u}function L4(i,a){i.flags&=65011714;var u=i.alternate;return u===null?(i.childLanes=0,i.lanes=a,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=u.childLanes,i.lanes=u.lanes,i.child=u.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=u.memoizedProps,i.memoizedState=u.memoizedState,i.updateQueue=u.updateQueue,i.type=u.type,a=u.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function ng(i,a,u,f,y,l){var D=0;if(f=i,typeof i=="function")hb(i)&&(D=1);else if(typeof i=="string")D=az(i,u,Mo.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case av:return i=na(31,u,a,y),i.elementType=av,i.lanes=l,i;case Th:return Ic(u.children,y,l,a);case e4:D=8,y|=24;break;case iv:return i=na(12,u,a,y|2),i.elementType=iv,i.lanes=l,i;case nv:return i=na(13,u,a,y),i.elementType=nv,i.lanes=l,i;case rv:return i=na(19,u,a,y),i.elementType=rv,i.lanes=l,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case ms:D=10;break e;case t4:D=9;break e;case Kv:D=11;break e;case Qv:D=14;break e;case ul:D=16,f=null;break e}D=29,u=Error(ke(130,i===null?"null":typeof i,"")),f=null}return a=na(D,u,a,y),a.elementType=i,a.type=f,a.lanes=l,a}function Ic(i,a,u,f){return i=na(7,i,f,a),i.lanes=u,i}function ky(i,a,u){return i=na(6,i,null,a),i.lanes=u,i}function O4(i){var a=na(18,null,null,0);return a.stateNode=i,a}function Ly(i,a,u){return a=na(4,i.children!==null?i.children:[],i.key,a),a.lanes=u,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var H5=new WeakMap;function Ca(i,a){if(typeof i=="object"&&i!==null){var u=H5.get(i);return u!==void 0?u:(a={value:i,source:a,stack:C5(a)},H5.set(i,a),a)}return{value:i,source:a,stack:C5(a)}}var Rh=[],Ih=0,xg=null,ff=0,Sa=[],Ma=0,Dl=null,wo=1,To="";function ps(i,a){Rh[Ih++]=ff,Rh[Ih++]=xg,xg=i,ff=a}function B4(i,a,u){Sa[Ma++]=wo,Sa[Ma++]=To,Sa[Ma++]=Dl,Dl=i;var f=wo;i=To;var y=32-sa(f)-1;f&=~(1<<y),u+=1;var l=32-sa(a)+y;if(30<l){var D=y-y%5;l=(f&(1<<D)-1).toString(32),f>>=D,y-=D,wo=1<<32-sa(a)+y|u<<y|f,To=l+i}else wo=1<<l|u<<y|f,To=i}function db(i){i.return!==null&&(ps(i,1),B4(i,1,0))}function pb(i){for(;i===xg;)xg=Rh[--Ih],Rh[Ih]=null,ff=Rh[--Ih],Rh[Ih]=null;for(;i===Dl;)Dl=Sa[--Ma],Sa[Ma]=null,To=Sa[--Ma],Sa[Ma]=null,wo=Sa[--Ma],Sa[Ma]=null}function F4(i,a){Sa[Ma++]=wo,Sa[Ma++]=To,Sa[Ma++]=Dl,wo=a.id,To=a.overflow,Dl=i}var rr=null,Pi=null,Ot=!1,wl=null,Aa=!1,vv=Error(ke(519));function Pl(i){var a=Error(ke(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw mf(Ca(a,i)),vv}function $5(i){var a=i.stateNode,u=i.type,f=i.memoizedProps;switch(a[nr]=i,a[jr]=f,u){case"dialog":Et("cancel",a),Et("close",a);break;case"iframe":case"object":case"embed":Et("load",a);break;case"video":case"audio":for(u=0;u<vf.length;u++)Et(vf[u],a);break;case"source":Et("error",a);break;case"img":case"image":case"link":Et("error",a),Et("load",a);break;case"details":Et("toggle",a);break;case"input":Et("invalid",a),f4(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Et("invalid",a);break;case"textarea":Et("invalid",a),g4(a,f.value,f.defaultValue,f.children)}u=f.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||f.suppressHydrationWarning===!0||bS(a.textContent,u)?(f.popover!=null&&(Et("beforetoggle",a),Et("toggle",a)),f.onScroll!=null&&Et("scroll",a),f.onScrollEnd!=null&&Et("scrollend",a),f.onClick!=null&&(a.onclick=gs),a=!0):a=!1,a||Pl(i,!0)}function X5(i){for(rr=i.return;rr;)switch(rr.tag){case 5:case 31:case 13:Aa=!1;return;case 27:case 3:Aa=!0;return;default:rr=rr.return}}function vh(i){if(i!==rr)return!1;if(!Ot)return X5(i),Ot=!0,!1;var a=i.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=i.type,u=!(u!=="form"&&u!=="button")||Gv(i.type,i.memoizedProps)),u=!u),u&&Pi&&Pl(i),X5(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ke(317));Pi=O3(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ke(317));Pi=O3(i)}else a===27?(a=Pi,Ll(i.type)?(i=Xv,Xv=null,Pi=i):Pi=a):Pi=rr?Da(i.stateNode.nextSibling):null;return!0}function Bc(){Pi=rr=null,Ot=!1}function Oy(){var i=wl;return i!==null&&(Ur===null?Ur=i:Ur.push.apply(Ur,i),wl=null),i}function mf(i){wl===null?wl=[i]:wl.push(i)}var bv=Eo(null),Hc=null,_s=null;function dl(i,a,u){Ti(bv,a._currentValue),a._currentValue=u}function vs(i){i._currentValue=bv.current,qn(bv)}function xv(i,a,u){for(;i!==null;){var f=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),i===u)break;i=i.return}}function wv(i,a,u,f){var y=i.child;for(y!==null&&(y.return=i);y!==null;){var l=y.dependencies;if(l!==null){var D=y.child;l=l.firstContext;e:for(;l!==null;){var B=l;l=y;for(var q=0;q<a.length;q++)if(B.context===a[q]){l.lanes|=u,B=l.alternate,B!==null&&(B.lanes|=u),xv(l.return,u,i),f||(D=null);break e}l=B.next}}else if(y.tag===18){if(D=y.return,D===null)throw Error(ke(341));D.lanes|=u,l=D.alternate,l!==null&&(l.lanes|=u),xv(D,u,i),D=null}else D=y.child;if(D!==null)D.return=y;else for(D=y;D!==null;){if(D===i){D=null;break}if(y=D.sibling,y!==null){y.return=D.return,D=y;break}D=D.return}y=D}}function td(i,a,u,f){i=null;for(var y=a,l=!1;y!==null;){if(!l){if((y.flags&524288)!==0)l=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var D=y.alternate;if(D===null)throw Error(ke(387));if(D=D.memoizedProps,D!==null){var B=y.type;ca(y.pendingProps.value,D.value)||(i!==null?i.push(B):i=[B])}}else if(y===fg.current){if(D=y.alternate,D===null)throw Error(ke(387));D.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(i!==null?i.push(xf):i=[xf])}y=y.return}i!==null&&wv(a,i,u,f),a.flags|=262144}function wg(i){for(i=i.firstContext;i!==null;){if(!ca(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Fc(i){Hc=i,_s=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function ar(i){return N4(Hc,i)}function q0(i,a){return Hc===null&&Fc(i),N4(i,a)}function N4(i,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},_s===null){if(i===null)throw Error(ke(308));_s=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else _s=_s.next=a;return u}var nA=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(u,f){i.push(f)}};this.abort=function(){a.aborted=!0,i.forEach(function(u){return u()})}},rA=zn.unstable_scheduleCallback,aA=zn.unstable_NormalPriority,_n={$$typeof:ms,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fb(){return{controller:new nA,data:new Map,refCount:0}}function Df(i){i.refCount--,i.refCount===0&&rA(aA,function(){i.controller.abort()})}var Jp=null,Tv=0,Zh=0,Fh=null;function oA(i,a){if(Jp===null){var u=Jp=[];Tv=0,Zh=Nb(),Fh={status:"pending",value:void 0,then:function(f){u.push(f)}}}return Tv++,a.then(Y5,Y5),a}function Y5(){if(--Tv===0&&Jp!==null){Fh!==null&&(Fh.status="fulfilled");var i=Jp;Jp=null,Zh=0,Fh=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function sA(i,a){var u=[],f={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return i.then(function(){f.status="fulfilled",f.value=a;for(var y=0;y<u.length;y++)(0,u[y])(a)},function(y){for(f.status="rejected",f.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),f}var W5=ut.S;ut.S=function(i,a){JT=aa(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&oA(i,a),W5!==null&&W5(i,a)};var kc=Eo(null);function mb(){var i=kc.current;return i!==null?i:gi.pooledCache}function rg(i,a){a===null?Ti(kc,kc.current):Ti(kc,a.pool)}function U4(){var i=mb();return i===null?null:{parent:_n._currentValue,pool:i}}var id=Error(ke(460)),gb=Error(ke(474)),Yg=Error(ke(542)),Tg={then:function(){}};function K5(i){return i=i.status,i==="fulfilled"||i==="rejected"}function V4(i,a,u){switch(u=i[u],u===void 0?i.push(a):u!==a&&(a.then(gs,gs),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,J5(i),i;default:if(typeof a.status=="string")a.then(gs,gs);else{if(i=gi,i!==null&&100<i.shellSuspendCounter)throw Error(ke(482));i=a,i.status="pending",i.then(function(f){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=f}},function(f){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,J5(i),i}throw Lc=a,id}}function Dc(i){try{var a=i._init;return a(i._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Lc=u,id):u}}var Lc=null;function Q5(){if(Lc===null)throw Error(ke(459));var i=Lc;return Lc=null,i}function J5(i){if(i===id||i===Yg)throw Error(ke(483))}var Nh=null,gf=0;function G0(i){var a=gf;return gf+=1,Nh===null&&(Nh=[]),V4(Nh,i,a)}function Up(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function Z0(i,a){throw a.$$typeof===$C?Error(ke(525)):(i=Object.prototype.toString.call(a),Error(ke(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function j4(i){function a(ce,se){if(i){var de=ce.deletions;de===null?(ce.deletions=[se],ce.flags|=16):de.push(se)}}function u(ce,se){if(!i)return null;for(;se!==null;)a(ce,se),se=se.sibling;return null}function f(ce){for(var se=new Map;ce!==null;)ce.key!==null?se.set(ce.key,ce):se.set(ce.index,ce),ce=ce.sibling;return se}function y(ce,se){return ce=ys(ce,se),ce.index=0,ce.sibling=null,ce}function l(ce,se,de){return ce.index=de,i?(de=ce.alternate,de!==null?(de=de.index,de<se?(ce.flags|=67108866,se):de):(ce.flags|=67108866,se)):(ce.flags|=1048576,se)}function D(ce){return i&&ce.alternate===null&&(ce.flags|=67108866),ce}function B(ce,se,de,ve){return se===null||se.tag!==6?(se=ky(de,ce.mode,ve),se.return=ce,se):(se=y(se,de),se.return=ce,se)}function q(ce,se,de,ve){var Le=de.type;return Le===Th?fe(ce,se,de.props.children,ve,de.key):se!==null&&(se.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===ul&&Dc(Le)===se.type)?(se=y(se,de.props),Up(se,de),se.return=ce,se):(se=ng(de.type,de.key,de.props,null,ce.mode,ve),Up(se,de),se.return=ce,se)}function K(ce,se,de,ve){return se===null||se.tag!==4||se.stateNode.containerInfo!==de.containerInfo||se.stateNode.implementation!==de.implementation?(se=Ly(de,ce.mode,ve),se.return=ce,se):(se=y(se,de.children||[]),se.return=ce,se)}function fe(ce,se,de,ve,Le){return se===null||se.tag!==7?(se=Ic(de,ce.mode,ve,Le),se.return=ce,se):(se=y(se,de),se.return=ce,se)}function pe(ce,se,de){if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return se=ky(""+se,ce.mode,de),se.return=ce,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case L0:return de=ng(se.type,se.key,se.props,null,ce.mode,de),Up(de,se),de.return=ce,de;case Zp:return se=Ly(se,ce.mode,de),se.return=ce,se;case ul:return se=Dc(se),pe(ce,se,de)}if(Hp(se)||Fp(se))return se=Ic(se,ce.mode,de,null),se.return=ce,se;if(typeof se.then=="function")return pe(ce,G0(se),de);if(se.$$typeof===ms)return pe(ce,q0(ce,se),de);Z0(ce,se)}return null}function oe(ce,se,de,ve){var Le=se!==null?se.key:null;if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return Le!==null?null:B(ce,se,""+de,ve);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case L0:return de.key===Le?q(ce,se,de,ve):null;case Zp:return de.key===Le?K(ce,se,de,ve):null;case ul:return de=Dc(de),oe(ce,se,de,ve)}if(Hp(de)||Fp(de))return Le!==null?null:fe(ce,se,de,ve,null);if(typeof de.then=="function")return oe(ce,se,G0(de),ve);if(de.$$typeof===ms)return oe(ce,se,q0(ce,de),ve);Z0(ce,de)}return null}function le(ce,se,de,ve,Le){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return ce=ce.get(de)||null,B(se,ce,""+ve,Le);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case L0:return ce=ce.get(ve.key===null?de:ve.key)||null,q(se,ce,ve,Le);case Zp:return ce=ce.get(ve.key===null?de:ve.key)||null,K(se,ce,ve,Le);case ul:return ve=Dc(ve),le(ce,se,de,ve,Le)}if(Hp(ve)||Fp(ve))return ce=ce.get(de)||null,fe(se,ce,ve,Le,null);if(typeof ve.then=="function")return le(ce,se,de,G0(ve),Le);if(ve.$$typeof===ms)return le(ce,se,de,q0(se,ve),Le);Z0(se,ve)}return null}function Oe(ce,se,de,ve){for(var Le=null,Re=null,Z=se,Y=se=0,ne=null;Z!==null&&Y<de.length;Y++){Z.index>Y?(ne=Z,Z=null):ne=Z.sibling;var xe=oe(ce,Z,de[Y],ve);if(xe===null){Z===null&&(Z=ne);break}i&&Z&&xe.alternate===null&&a(ce,Z),se=l(xe,se,Y),Re===null?Le=xe:Re.sibling=xe,Re=xe,Z=ne}if(Y===de.length)return u(ce,Z),Ot&&ps(ce,Y),Le;if(Z===null){for(;Y<de.length;Y++)Z=pe(ce,de[Y],ve),Z!==null&&(se=l(Z,se,Y),Re===null?Le=Z:Re.sibling=Z,Re=Z);return Ot&&ps(ce,Y),Le}for(Z=f(Z);Y<de.length;Y++)ne=le(Z,ce,Y,de[Y],ve),ne!==null&&(i&&ne.alternate!==null&&Z.delete(ne.key===null?Y:ne.key),se=l(ne,se,Y),Re===null?Le=ne:Re.sibling=ne,Re=ne);return i&&Z.forEach(function(De){return a(ce,De)}),Ot&&ps(ce,Y),Le}function Ue(ce,se,de,ve){if(de==null)throw Error(ke(151));for(var Le=null,Re=null,Z=se,Y=se=0,ne=null,xe=de.next();Z!==null&&!xe.done;Y++,xe=de.next()){Z.index>Y?(ne=Z,Z=null):ne=Z.sibling;var De=oe(ce,Z,xe.value,ve);if(De===null){Z===null&&(Z=ne);break}i&&Z&&De.alternate===null&&a(ce,Z),se=l(De,se,Y),Re===null?Le=De:Re.sibling=De,Re=De,Z=ne}if(xe.done)return u(ce,Z),Ot&&ps(ce,Y),Le;if(Z===null){for(;!xe.done;Y++,xe=de.next())xe=pe(ce,xe.value,ve),xe!==null&&(se=l(xe,se,Y),Re===null?Le=xe:Re.sibling=xe,Re=xe);return Ot&&ps(ce,Y),Le}for(Z=f(Z);!xe.done;Y++,xe=de.next())xe=le(Z,ce,Y,xe.value,ve),xe!==null&&(i&&xe.alternate!==null&&Z.delete(xe.key===null?Y:xe.key),se=l(xe,se,Y),Re===null?Le=xe:Re.sibling=xe,Re=xe);return i&&Z.forEach(function(nt){return a(ce,nt)}),Ot&&ps(ce,Y),Le}function ye(ce,se,de,ve){if(typeof de=="object"&&de!==null&&de.type===Th&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case L0:e:{for(var Le=de.key;se!==null;){if(se.key===Le){if(Le=de.type,Le===Th){if(se.tag===7){u(ce,se.sibling),ve=y(se,de.props.children),ve.return=ce,ce=ve;break e}}else if(se.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===ul&&Dc(Le)===se.type){u(ce,se.sibling),ve=y(se,de.props),Up(ve,de),ve.return=ce,ce=ve;break e}u(ce,se);break}else a(ce,se);se=se.sibling}de.type===Th?(ve=Ic(de.props.children,ce.mode,ve,de.key),ve.return=ce,ce=ve):(ve=ng(de.type,de.key,de.props,null,ce.mode,ve),Up(ve,de),ve.return=ce,ce=ve)}return D(ce);case Zp:e:{for(Le=de.key;se!==null;){if(se.key===Le)if(se.tag===4&&se.stateNode.containerInfo===de.containerInfo&&se.stateNode.implementation===de.implementation){u(ce,se.sibling),ve=y(se,de.children||[]),ve.return=ce,ce=ve;break e}else{u(ce,se);break}else a(ce,se);se=se.sibling}ve=Ly(de,ce.mode,ve),ve.return=ce,ce=ve}return D(ce);case ul:return de=Dc(de),ye(ce,se,de,ve)}if(Hp(de))return Oe(ce,se,de,ve);if(Fp(de)){if(Le=Fp(de),typeof Le!="function")throw Error(ke(150));return de=Le.call(de),Ue(ce,se,de,ve)}if(typeof de.then=="function")return ye(ce,se,G0(de),ve);if(de.$$typeof===ms)return ye(ce,se,q0(ce,de),ve);Z0(ce,de)}return typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint"?(de=""+de,se!==null&&se.tag===6?(u(ce,se.sibling),ve=y(se,de),ve.return=ce,ce=ve):(u(ce,se),ve=ky(de,ce.mode,ve),ve.return=ce,ce=ve),D(ce)):u(ce,se)}return function(ce,se,de,ve){try{gf=0;var Le=ye(ce,se,de,ve);return Nh=null,Le}catch(Z){if(Z===id||Z===Yg)throw Z;var Re=na(29,Z,null,ce.mode);return Re.lanes=ve,Re.return=ce,Re}}}var Nc=j4(!0),q4=j4(!1),hl=!1;function _b(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sv(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Tl(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Sl(i,a,u){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(Yt&2)!==0){var y=f.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),f.pending=a,a=bg(i),k4(i,null,u),a}return Xg(i,f,a,u),bg(i)}function ef(i,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var f=a.lanes;f&=i.pendingLanes,u|=f,a.lanes=u,s4(i,u)}}function By(i,a){var u=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var y=null,l=null;if(u=u.firstBaseUpdate,u!==null){do{var D={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};l===null?y=l=D:l=l.next=D,u=u.next}while(u!==null);l===null?y=l=a:l=l.next=a}else y=l=a;u={baseState:f.baseState,firstBaseUpdate:y,lastBaseUpdate:l,shared:f.shared,callbacks:f.callbacks},i.updateQueue=u;return}i=u.lastBaseUpdate,i===null?u.firstBaseUpdate=a:i.next=a,u.lastBaseUpdate=a}var Mv=!1;function tf(){if(Mv){var i=Fh;if(i!==null)throw i}}function nf(i,a,u,f){Mv=!1;var y=i.updateQueue;hl=!1;var l=y.firstBaseUpdate,D=y.lastBaseUpdate,B=y.shared.pending;if(B!==null){y.shared.pending=null;var q=B,K=q.next;q.next=null,D===null?l=K:D.next=K,D=q;var fe=i.alternate;fe!==null&&(fe=fe.updateQueue,B=fe.lastBaseUpdate,B!==D&&(B===null?fe.firstBaseUpdate=K:B.next=K,fe.lastBaseUpdate=q))}if(l!==null){var pe=y.baseState;D=0,fe=K=q=null,B=l;do{var oe=B.lane&-536870913,le=oe!==B.lane;if(le?(At&oe)===oe:(f&oe)===oe){oe!==0&&oe===Zh&&(Mv=!0),fe!==null&&(fe=fe.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var Oe=i,Ue=B;oe=a;var ye=u;switch(Ue.tag){case 1:if(Oe=Ue.payload,typeof Oe=="function"){pe=Oe.call(ye,pe,oe);break e}pe=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=Ue.payload,oe=typeof Oe=="function"?Oe.call(ye,pe,oe):Oe,oe==null)break e;pe=Ri({},pe,oe);break e;case 2:hl=!0}}oe=B.callback,oe!==null&&(i.flags|=64,le&&(i.flags|=8192),le=y.callbacks,le===null?y.callbacks=[oe]:le.push(oe))}else le={lane:oe,tag:B.tag,payload:B.payload,callback:B.callback,next:null},fe===null?(K=fe=le,q=pe):fe=fe.next=le,D|=oe;if(B=B.next,B===null){if(B=y.shared.pending,B===null)break;le=B,B=le.next,le.next=null,y.lastBaseUpdate=le,y.shared.pending=null}}while(!0);fe===null&&(q=pe),y.baseState=q,y.firstBaseUpdate=K,y.lastBaseUpdate=fe,l===null&&(y.shared.lanes=0),Il|=D,i.lanes=D,i.memoizedState=pe}}function G4(i,a){if(typeof i!="function")throw Error(ke(191,i));i.call(a)}function Z4(i,a){var u=i.callbacks;if(u!==null)for(i.callbacks=null,i=0;i<u.length;i++)G4(u[i],a)}var Hh=Eo(null),Sg=Eo(0);function e3(i,a){i=Ms,Ti(Sg,i),Ti(Hh,a),Ms=i|a.baseLanes}function Ev(){Ti(Sg,Ms),Ti(Hh,Hh.current)}function yb(){Ms=Sg.current,qn(Hh),qn(Sg)}var ua=Eo(null),za=null;function pl(i){var a=i.alternate;Ti(rn,rn.current&1),Ti(ua,i),za===null&&(a===null||Hh.current!==null||a.memoizedState!==null)&&(za=i)}function Cv(i){Ti(rn,rn.current),Ti(ua,i),za===null&&(za=i)}function H4(i){i.tag===22?(Ti(rn,rn.current),Ti(ua,i),za===null&&(za=i)):fl(i)}function fl(){Ti(rn,rn.current),Ti(ua,ua.current)}function ia(i){qn(ua),za===i&&(za=null),qn(rn)}var rn=Eo(0);function Mg(i){for(var a=i;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Hv(u)||$v(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var ws=0,bt=null,di=null,mn=null,Eg=!1,Uh=!1,Uc=!1,Cg=0,_f=0,Vh=null,lA=0;function Yi(){throw Error(ke(321))}function vb(i,a){if(a===null)return!1;for(var u=0;u<a.length&&u<i.length;u++)if(!ca(i[u],a[u]))return!1;return!0}function bb(i,a,u,f,y,l){return ws=l,bt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,ut.H=i===null||i.memoizedState===null?TT:Pb,Uc=!1,l=u(f,y),Uc=!1,Uh&&(l=X4(a,u,f,y)),$4(i),l}function $4(i){ut.H=yf;var a=di!==null&&di.next!==null;if(ws=0,mn=di=bt=null,Eg=!1,_f=0,Vh=null,a)throw Error(ke(300));i===null||yn||(i=i.dependencies,i!==null&&wg(i)&&(yn=!0))}function X4(i,a,u,f){bt=i;var y=0;do{if(Uh&&(Vh=null),_f=0,Uh=!1,25<=y)throw Error(ke(301));if(y+=1,mn=di=null,i.updateQueue!=null){var l=i.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,l.memoCache!=null&&(l.memoCache.index=0)}ut.H=ST,l=a(u,f)}while(Uh);return l}function cA(){var i=ut.H,a=i.useState()[0];return a=typeof a.then=="function"?Pf(a):a,i=i.useState()[0],(di!==null?di.memoizedState:null)!==i&&(bt.flags|=1024),a}function xb(){var i=Cg!==0;return Cg=0,i}function wb(i,a,u){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~u}function Tb(i){if(Eg){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Eg=!1}ws=0,mn=di=bt=null,Uh=!1,_f=Cg=0,Vh=null}function zr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?bt.memoizedState=mn=i:mn=mn.next=i,mn}function an(){if(di===null){var i=bt.alternate;i=i!==null?i.memoizedState:null}else i=di.next;var a=mn===null?bt.memoizedState:mn.next;if(a!==null)mn=a,di=i;else{if(i===null)throw bt.alternate===null?Error(ke(467)):Error(ke(310));di=i,i={memoizedState:di.memoizedState,baseState:di.baseState,baseQueue:di.baseQueue,queue:di.queue,next:null},mn===null?bt.memoizedState=mn=i:mn=mn.next=i}return mn}function Wg(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pf(i){var a=_f;return _f+=1,Vh===null&&(Vh=[]),i=V4(Vh,i,a),a=bt,(mn===null?a.memoizedState:mn.next)===null&&(a=a.alternate,ut.H=a===null||a.memoizedState===null?TT:Pb),i}function Kg(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Pf(i);if(i.$$typeof===ms)return ar(i)}throw Error(ke(438,String(i)))}function Sb(i){var a=null,u=bt.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var f=bt.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=Wg(),bt.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(i),f=0;f<i;f++)u[f]=XC;return a.index++,u}function Ts(i,a){return typeof a=="function"?a(i):a}function ag(i){var a=an();return Mb(a,di,i)}function Mb(i,a,u){var f=i.queue;if(f===null)throw Error(ke(311));f.lastRenderedReducer=u;var y=i.baseQueue,l=f.pending;if(l!==null){if(y!==null){var D=y.next;y.next=l.next,l.next=D}a.baseQueue=y=l,f.pending=null}if(l=i.baseState,y===null)i.memoizedState=l;else{a=y.next;var B=D=null,q=null,K=a,fe=!1;do{var pe=K.lane&-536870913;if(pe!==K.lane?(At&pe)===pe:(ws&pe)===pe){var oe=K.revertLane;if(oe===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),pe===Zh&&(fe=!0);else if((ws&oe)===oe){K=K.next,oe===Zh&&(fe=!0);continue}else pe={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},q===null?(B=q=pe,D=l):q=q.next=pe,bt.lanes|=oe,Il|=oe;pe=K.action,Uc&&u(l,pe),l=K.hasEagerState?K.eagerState:u(l,pe)}else oe={lane:pe,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},q===null?(B=q=oe,D=l):q=q.next=oe,bt.lanes|=pe,Il|=pe;K=K.next}while(K!==null&&K!==a);if(q===null?D=l:q.next=B,!ca(l,i.memoizedState)&&(yn=!0,fe&&(u=Fh,u!==null)))throw u;i.memoizedState=l,i.baseState=D,i.baseQueue=q,f.lastRenderedState=l}return y===null&&(f.lanes=0),[i.memoizedState,f.dispatch]}function Fy(i){var a=an(),u=a.queue;if(u===null)throw Error(ke(311));u.lastRenderedReducer=i;var f=u.dispatch,y=u.pending,l=a.memoizedState;if(y!==null){u.pending=null;var D=y=y.next;do l=i(l,D.action),D=D.next;while(D!==y);ca(l,a.memoizedState)||(yn=!0),a.memoizedState=l,a.baseQueue===null&&(a.baseState=l),u.lastRenderedState=l}return[l,f]}function Y4(i,a,u){var f=bt,y=an(),l=Ot;if(l){if(u===void 0)throw Error(ke(407));u=u()}else u=a();var D=!ca((di||y).memoizedState,u);if(D&&(y.memoizedState=u,yn=!0),y=y.queue,Eb(Q4.bind(null,f,y,i),[i]),y.getSnapshot!==a||D||mn!==null&&mn.memoizedState.tag&1){if(f.flags|=2048,$h(9,{destroy:void 0},K4.bind(null,f,y,u,a),null),gi===null)throw Error(ke(349));l||(ws&127)!==0||W4(f,a,u)}return u}function W4(i,a,u){i.flags|=16384,i={getSnapshot:a,value:u},a=bt.updateQueue,a===null?(a=Wg(),bt.updateQueue=a,a.stores=[i]):(u=a.stores,u===null?a.stores=[i]:u.push(i))}function K4(i,a,u,f){a.value=u,a.getSnapshot=f,J4(a)&&eT(i)}function Q4(i,a,u){return u(function(){J4(a)&&eT(i)})}function J4(i){var a=i.getSnapshot;i=i.value;try{var u=a();return!ca(i,u)}catch{return!0}}function eT(i){var a=Zc(i,2);a!==null&&Vr(a,i,2)}function Av(i){var a=zr();if(typeof i=="function"){var u=i;if(i=u(),Uc){gl(!0);try{u()}finally{gl(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ts,lastRenderedState:i},a}function tT(i,a,u,f){return i.baseState=u,Mb(i,di,typeof f=="function"?f:Ts)}function uA(i,a,u,f,y){if(Jg(i))throw Error(ke(485));if(i=a.action,i!==null){var l={payload:y,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){l.listeners.push(D)}};ut.T!==null?u(!0):l.isTransition=!1,f(l),u=a.pending,u===null?(l.next=a.pending=l,iT(a,l)):(l.next=u.next,a.pending=u.next=l)}}function iT(i,a){var u=a.action,f=a.payload,y=i.state;if(a.isTransition){var l=ut.T,D={};ut.T=D;try{var B=u(y,f),q=ut.S;q!==null&&q(D,B),t3(i,a,B)}catch(K){zv(i,a,K)}finally{l!==null&&D.types!==null&&(l.types=D.types),ut.T=l}}else try{l=u(y,f),t3(i,a,l)}catch(K){zv(i,a,K)}}function t3(i,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){i3(i,a,f)},function(f){return zv(i,a,f)}):i3(i,a,u)}function i3(i,a,u){a.status="fulfilled",a.value=u,nT(a),i.state=u,a=i.pending,a!==null&&(u=a.next,u===a?i.pending=null:(u=u.next,a.next=u,iT(i,u)))}function zv(i,a,u){var f=i.pending;if(i.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=u,nT(a),a=a.next;while(a!==f)}i.action=null}function nT(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function rT(i,a){return a}function n3(i,a){if(Ot){var u=gi.formState;if(u!==null){e:{var f=bt;if(Ot){if(Pi){t:{for(var y=Pi,l=Aa;y.nodeType!==8;){if(!l){y=null;break t}if(y=Da(y.nextSibling),y===null){y=null;break t}}l=y.data,y=l==="F!"||l==="F"?y:null}if(y){Pi=Da(y.nextSibling),f=y.data==="F!";break e}}Pl(f)}f=!1}f&&(a=u[0])}}return u=zr(),u.memoizedState=u.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rT,lastRenderedState:a},u.queue=f,u=bT.bind(null,bt,f),f.dispatch=u,f=Av(!1),l=Db.bind(null,bt,!1,f.queue),f=zr(),y={state:a,dispatch:null,action:i,pending:null},f.queue=y,u=uA.bind(null,bt,y,l,u),y.dispatch=u,f.memoizedState=i,[a,u,!1]}function r3(i){var a=an();return aT(a,di,i)}function aT(i,a,u){if(a=Mb(i,a,rT)[0],i=ag(Ts)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=Pf(a)}catch(D){throw D===id?Yg:D}else f=a;a=an();var y=a.queue,l=y.dispatch;return u!==a.memoizedState&&(bt.flags|=2048,$h(9,{destroy:void 0},hA.bind(null,y,u),null)),[f,l,i]}function hA(i,a){i.action=a}function a3(i){var a=an(),u=di;if(u!==null)return aT(a,u,i);an(),a=a.memoizedState,u=an();var f=u.queue.dispatch;return u.memoizedState=i,[a,f,!1]}function $h(i,a,u,f){return i={tag:i,create:u,deps:f,inst:a,next:null},a=bt.updateQueue,a===null&&(a=Wg(),bt.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=i.next=i:(f=u.next,u.next=i,i.next=f,a.lastEffect=i),i}function oT(){return an().memoizedState}function og(i,a,u,f){var y=zr();bt.flags|=i,y.memoizedState=$h(1|a,{destroy:void 0},u,f===void 0?null:f)}function Qg(i,a,u,f){var y=an();f=f===void 0?null:f;var l=y.memoizedState.inst;di!==null&&f!==null&&vb(f,di.memoizedState.deps)?y.memoizedState=$h(a,l,u,f):(bt.flags|=i,y.memoizedState=$h(1|a,l,u,f))}function o3(i,a){og(8390656,8,i,a)}function Eb(i,a){Qg(2048,8,i,a)}function dA(i){bt.flags|=4;var a=bt.updateQueue;if(a===null)a=Wg(),bt.updateQueue=a,a.events=[i];else{var u=a.events;u===null?a.events=[i]:u.push(i)}}function sT(i){var a=an().memoizedState;return dA({ref:a,nextImpl:i}),function(){if((Yt&2)!==0)throw Error(ke(440));return a.impl.apply(void 0,arguments)}}function lT(i,a){return Qg(4,2,i,a)}function cT(i,a){return Qg(4,4,i,a)}function uT(i,a){if(typeof a=="function"){i=i();var u=a(i);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function hT(i,a,u){u=u!=null?u.concat([i]):null,Qg(4,4,uT.bind(null,a,i),u)}function Cb(){}function dT(i,a){var u=an();a=a===void 0?null:a;var f=u.memoizedState;return a!==null&&vb(a,f[1])?f[0]:(u.memoizedState=[i,a],i)}function pT(i,a){var u=an();a=a===void 0?null:a;var f=u.memoizedState;if(a!==null&&vb(a,f[1]))return f[0];if(f=i(),Uc){gl(!0);try{i()}finally{gl(!1)}}return u.memoizedState=[f,a],f}function Ab(i,a,u){return u===void 0||(ws&1073741824)!==0&&(At&261930)===0?i.memoizedState=a:(i.memoizedState=u,i=tS(),bt.lanes|=i,Il|=i,u)}function fT(i,a,u,f){return ca(u,a)?u:Hh.current!==null?(i=Ab(i,u,f),ca(i,a)||(yn=!0),i):(ws&42)===0||(ws&1073741824)!==0&&(At&261930)===0?(yn=!0,i.memoizedState=u):(i=tS(),bt.lanes|=i,Il|=i,a)}function mT(i,a,u,f,y){var l=Wt.p;Wt.p=l!==0&&8>l?l:8;var D=ut.T,B={};ut.T=B,Db(i,!1,a,u);try{var q=y(),K=ut.S;if(K!==null&&K(B,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var fe=sA(q,f);rf(i,a,fe,la(i))}else rf(i,a,f,la(i))}catch(pe){rf(i,a,{then:function(){},status:"rejected",reason:pe},la())}finally{Wt.p=l,D!==null&&B.types!==null&&(D.types=B.types),ut.T=D}}function pA(){}function Dv(i,a,u,f){if(i.tag!==5)throw Error(ke(476));var y=gT(i).queue;mT(i,y,a,Rc,u===null?pA:function(){return _T(i),u(f)})}function gT(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:Rc,baseState:Rc,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ts,lastRenderedState:Rc},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ts,lastRenderedState:u},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function _T(i){var a=gT(i);a.next===null&&(a=i.alternate.memoizedState),rf(i,a.next.queue,{},la())}function zb(){return ar(xf)}function yT(){return an().memoizedState}function vT(){return an().memoizedState}function fA(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var u=la();i=Tl(u);var f=Sl(a,i,u);f!==null&&(Vr(f,a,u),ef(f,a,u)),a={cache:fb()},i.payload=a;return}a=a.return}}function mA(i,a,u){var f=la();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Jg(i)?xT(a,u):(u=ub(i,a,u,f),u!==null&&(Vr(u,i,f),wT(u,a,f)))}function bT(i,a,u){var f=la();rf(i,a,u,f)}function rf(i,a,u,f){var y={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Jg(i))xT(a,y);else{var l=i.alternate;if(i.lanes===0&&(l===null||l.lanes===0)&&(l=a.lastRenderedReducer,l!==null))try{var D=a.lastRenderedState,B=l(D,u);if(y.hasEagerState=!0,y.eagerState=B,ca(B,D))return Xg(i,a,y,0),gi===null&&$g(),!1}catch{}if(u=ub(i,a,y,f),u!==null)return Vr(u,i,f),wT(u,a,f),!0}return!1}function Db(i,a,u,f){if(f={lane:2,revertLane:Nb(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Jg(i)){if(a)throw Error(ke(479))}else a=ub(i,u,f,2),a!==null&&Vr(a,i,2)}function Jg(i){var a=i.alternate;return i===bt||a!==null&&a===bt}function xT(i,a){Uh=Eg=!0;var u=i.pending;u===null?a.next=a:(a.next=u.next,u.next=a),i.pending=a}function wT(i,a,u){if((u&4194048)!==0){var f=a.lanes;f&=i.pendingLanes,u|=f,a.lanes=u,s4(i,u)}}var yf={readContext:ar,use:Kg,useCallback:Yi,useContext:Yi,useEffect:Yi,useImperativeHandle:Yi,useLayoutEffect:Yi,useInsertionEffect:Yi,useMemo:Yi,useReducer:Yi,useRef:Yi,useState:Yi,useDebugValue:Yi,useDeferredValue:Yi,useTransition:Yi,useSyncExternalStore:Yi,useId:Yi,useHostTransitionStatus:Yi,useFormState:Yi,useActionState:Yi,useOptimistic:Yi,useMemoCache:Yi,useCacheRefresh:Yi};yf.useEffectEvent=Yi;var TT={readContext:ar,use:Kg,useCallback:function(i,a){return zr().memoizedState=[i,a===void 0?null:a],i},useContext:ar,useEffect:o3,useImperativeHandle:function(i,a,u){u=u!=null?u.concat([i]):null,og(4194308,4,uT.bind(null,a,i),u)},useLayoutEffect:function(i,a){return og(4194308,4,i,a)},useInsertionEffect:function(i,a){og(4,2,i,a)},useMemo:function(i,a){var u=zr();a=a===void 0?null:a;var f=i();if(Uc){gl(!0);try{i()}finally{gl(!1)}}return u.memoizedState=[f,a],f},useReducer:function(i,a,u){var f=zr();if(u!==void 0){var y=u(a);if(Uc){gl(!0);try{u(a)}finally{gl(!1)}}}else y=a;return f.memoizedState=f.baseState=y,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:y},f.queue=i,i=i.dispatch=mA.bind(null,bt,i),[f.memoizedState,i]},useRef:function(i){var a=zr();return i={current:i},a.memoizedState=i},useState:function(i){i=Av(i);var a=i.queue,u=bT.bind(null,bt,a);return a.dispatch=u,[i.memoizedState,u]},useDebugValue:Cb,useDeferredValue:function(i,a){var u=zr();return Ab(u,i,a)},useTransition:function(){var i=Av(!1);return i=mT.bind(null,bt,i.queue,!0,!1),zr().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,u){var f=bt,y=zr();if(Ot){if(u===void 0)throw Error(ke(407));u=u()}else{if(u=a(),gi===null)throw Error(ke(349));(At&127)!==0||W4(f,a,u)}y.memoizedState=u;var l={value:u,getSnapshot:a};return y.queue=l,o3(Q4.bind(null,f,l,i),[i]),f.flags|=2048,$h(9,{destroy:void 0},K4.bind(null,f,l,u,a),null),u},useId:function(){var i=zr(),a=gi.identifierPrefix;if(Ot){var u=To,f=wo;u=(f&~(1<<32-sa(f)-1)).toString(32)+u,a="_"+a+"R_"+u,u=Cg++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=lA++,a="_"+a+"r_"+u.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:zb,useFormState:n3,useActionState:n3,useOptimistic:function(i){var a=zr();a.memoizedState=a.baseState=i;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=Db.bind(null,bt,!0,u),u.dispatch=a,[i,a]},useMemoCache:Sb,useCacheRefresh:function(){return zr().memoizedState=fA.bind(null,bt)},useEffectEvent:function(i){var a=zr(),u={impl:i};return a.memoizedState=u,function(){if((Yt&2)!==0)throw Error(ke(440));return u.impl.apply(void 0,arguments)}}},Pb={readContext:ar,use:Kg,useCallback:dT,useContext:ar,useEffect:Eb,useImperativeHandle:hT,useInsertionEffect:lT,useLayoutEffect:cT,useMemo:pT,useReducer:ag,useRef:oT,useState:function(){return ag(Ts)},useDebugValue:Cb,useDeferredValue:function(i,a){var u=an();return fT(u,di.memoizedState,i,a)},useTransition:function(){var i=ag(Ts)[0],a=an().memoizedState;return[typeof i=="boolean"?i:Pf(i),a]},useSyncExternalStore:Y4,useId:yT,useHostTransitionStatus:zb,useFormState:r3,useActionState:r3,useOptimistic:function(i,a){var u=an();return tT(u,di,i,a)},useMemoCache:Sb,useCacheRefresh:vT};Pb.useEffectEvent=sT;var ST={readContext:ar,use:Kg,useCallback:dT,useContext:ar,useEffect:Eb,useImperativeHandle:hT,useInsertionEffect:lT,useLayoutEffect:cT,useMemo:pT,useReducer:Fy,useRef:oT,useState:function(){return Fy(Ts)},useDebugValue:Cb,useDeferredValue:function(i,a){var u=an();return di===null?Ab(u,i,a):fT(u,di.memoizedState,i,a)},useTransition:function(){var i=Fy(Ts)[0],a=an().memoizedState;return[typeof i=="boolean"?i:Pf(i),a]},useSyncExternalStore:Y4,useId:yT,useHostTransitionStatus:zb,useFormState:a3,useActionState:a3,useOptimistic:function(i,a){var u=an();return di!==null?tT(u,di,i,a):(u.baseState=i,[i,u.queue.dispatch])},useMemoCache:Sb,useCacheRefresh:vT};ST.useEffectEvent=sT;function Ny(i,a,u,f){a=i.memoizedState,u=u(f,a),u=u==null?a:Ri({},a,u),i.memoizedState=u,i.lanes===0&&(i.updateQueue.baseState=u)}var Pv={enqueueSetState:function(i,a,u){i=i._reactInternals;var f=la(),y=Tl(f);y.payload=a,u!=null&&(y.callback=u),a=Sl(i,y,f),a!==null&&(Vr(a,i,f),ef(a,i,f))},enqueueReplaceState:function(i,a,u){i=i._reactInternals;var f=la(),y=Tl(f);y.tag=1,y.payload=a,u!=null&&(y.callback=u),a=Sl(i,y,f),a!==null&&(Vr(a,i,f),ef(a,i,f))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var u=la(),f=Tl(u);f.tag=2,a!=null&&(f.callback=a),a=Sl(i,f,u),a!==null&&(Vr(a,i,u),ef(a,i,u))}};function s3(i,a,u,f,y,l,D){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,l,D):a.prototype&&a.prototype.isPureReactComponent?!pf(u,f)||!pf(y,l):!0}function l3(i,a,u,f){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,f),a.state!==i&&Pv.enqueueReplaceState(a,a.state,null)}function Vc(i,a){var u=a;if("ref"in a){u={};for(var f in a)f!=="ref"&&(u[f]=a[f])}if(i=i.defaultProps){u===a&&(u=Ri({},u));for(var y in i)u[y]===void 0&&(u[y]=i[y])}return u}function MT(i){vg(i)}function ET(i){console.error(i)}function CT(i){vg(i)}function Ag(i,a){try{var u=i.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function c3(i,a,u){try{var f=i.onCaughtError;f(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Rv(i,a,u){return u=Tl(u),u.tag=3,u.payload={element:null},u.callback=function(){Ag(i,a)},u}function AT(i){return i=Tl(i),i.tag=3,i}function zT(i,a,u,f){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var l=f.value;i.payload=function(){return y(l)},i.callback=function(){c3(a,u,f)}}var D=u.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(i.callback=function(){c3(a,u,f),typeof y!="function"&&(Ml===null?Ml=new Set([this]):Ml.add(this));var B=f.stack;this.componentDidCatch(f.value,{componentStack:B!==null?B:""})})}function gA(i,a,u,f,y){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=u.alternate,a!==null&&td(a,u,y,!0),u=ua.current,u!==null){switch(u.tag){case 31:case 13:return za===null?Ig():u.alternate===null&&Wi===0&&(Wi=3),u.flags&=-257,u.flags|=65536,u.lanes=y,f===Tg?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([f]):a.add(f),Wy(i,f,y)),!1;case 22:return u.flags|=65536,f===Tg?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([f]):u.add(f)),Wy(i,f,y)),!1}throw Error(ke(435,u.tag))}return Wy(i,f,y),Ig(),!1}if(Ot)return a=ua.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,f!==vv&&(i=Error(ke(422),{cause:f}),mf(Ca(i,u)))):(f!==vv&&(a=Error(ke(423),{cause:f}),mf(Ca(a,u))),i=i.current.alternate,i.flags|=65536,y&=-y,i.lanes|=y,f=Ca(f,u),y=Rv(i.stateNode,f,y),By(i,y),Wi!==4&&(Wi=2)),!1;var l=Error(ke(520),{cause:f});if(l=Ca(l,u),sf===null?sf=[l]:sf.push(l),Wi!==4&&(Wi=2),a===null)return!0;f=Ca(f,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,i=y&-y,u.lanes|=i,i=Rv(u.stateNode,f,i),By(u,i),!1;case 1:if(a=u.type,l=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||l!==null&&typeof l.componentDidCatch=="function"&&(Ml===null||!Ml.has(l))))return u.flags|=65536,y&=-y,u.lanes|=y,y=AT(y),zT(y,i,u,f),By(u,y),!1}u=u.return}while(u!==null);return!1}var Rb=Error(ke(461)),yn=!1;function ir(i,a,u,f){a.child=i===null?q4(a,null,u,f):Nc(a,i.child,u,f)}function u3(i,a,u,f,y){u=u.render;var l=a.ref;if("ref"in f){var D={};for(var B in f)B!=="ref"&&(D[B]=f[B])}else D=f;return Fc(a),f=bb(i,a,u,D,l,y),B=xb(),i!==null&&!yn?(wb(i,a,y),Ss(i,a,y)):(Ot&&B&&db(a),a.flags|=1,ir(i,a,f,y),a.child)}function h3(i,a,u,f,y){if(i===null){var l=u.type;return typeof l=="function"&&!hb(l)&&l.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=l,DT(i,a,l,f,y)):(i=ng(u.type,null,f,a,a.mode,y),i.ref=a.ref,i.return=a,a.child=i)}if(l=i.child,!Ib(i,y)){var D=l.memoizedProps;if(u=u.compare,u=u!==null?u:pf,u(D,f)&&i.ref===a.ref)return Ss(i,a,y)}return a.flags|=1,i=ys(l,f),i.ref=a.ref,i.return=a,a.child=i}function DT(i,a,u,f,y){if(i!==null){var l=i.memoizedProps;if(pf(l,f)&&i.ref===a.ref)if(yn=!1,a.pendingProps=f=l,Ib(i,y))(i.flags&131072)!==0&&(yn=!0);else return a.lanes=i.lanes,Ss(i,a,y)}return Iv(i,a,u,f,y)}function PT(i,a,u,f){var y=f.children,l=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(l=l!==null?l.baseLanes|u:u,i!==null){for(f=a.child=i.child,y=0;f!==null;)y=y|f.lanes|f.childLanes,f=f.sibling;f=y&~l}else f=0,a.child=null;return d3(i,a,l,u,f)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&rg(a,l!==null?l.cachePool:null),l!==null?e3(a,l):Ev(),H4(a);else return f=a.lanes=536870912,d3(i,a,l!==null?l.baseLanes|u:u,u,f)}else l!==null?(rg(a,l.cachePool),e3(a,l),fl(a),a.memoizedState=null):(i!==null&&rg(a,null),Ev(),fl(a));return ir(i,a,y,u),a.child}function Xp(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function d3(i,a,u,f,y){var l=mb();return l=l===null?null:{parent:_n._currentValue,pool:l},a.memoizedState={baseLanes:u,cachePool:l},i!==null&&rg(a,null),Ev(),H4(a),i!==null&&td(i,a,f,!0),a.childLanes=y,null}function sg(i,a){return a=zg({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function p3(i,a,u){return Nc(a,i.child,null,u),i=sg(a,a.pendingProps),i.flags|=2,ia(a),a.memoizedState=null,i}function _A(i,a,u){var f=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(Ot){if(f.mode==="hidden")return i=sg(a,f),a.lanes=536870912,Xp(null,i);if(Cv(a),(i=Pi)?(i=TS(i,Aa),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Dl!==null?{id:wo,overflow:To}:null,retryLane:536870912,hydrationErrors:null},u=O4(i),u.return=a,a.child=u,rr=a,Pi=null)):i=null,i===null)throw Pl(a);return a.lanes=536870912,null}return sg(a,f)}var l=i.memoizedState;if(l!==null){var D=l.dehydrated;if(Cv(a),y)if(a.flags&256)a.flags&=-257,a=p3(i,a,u);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(ke(558));else if(yn||td(i,a,u,!1),y=(u&i.childLanes)!==0,yn||y){if(f=gi,f!==null&&(D=l4(f,u),D!==0&&D!==l.retryLane))throw l.retryLane=D,Zc(i,D),Vr(f,i,D),Rb;Ig(),a=p3(i,a,u)}else i=l.treeContext,Pi=Da(D.nextSibling),rr=a,Ot=!0,wl=null,Aa=!1,i!==null&&F4(a,i),a=sg(a,f),a.flags|=4096;return a}return i=ys(i.child,{mode:f.mode,children:f.children}),i.ref=a.ref,a.child=i,i.return=a,i}function lg(i,a){var u=a.ref;if(u===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(ke(284));(i===null||i.ref!==u)&&(a.flags|=4194816)}}function Iv(i,a,u,f,y){return Fc(a),u=bb(i,a,u,f,void 0,y),f=xb(),i!==null&&!yn?(wb(i,a,y),Ss(i,a,y)):(Ot&&f&&db(a),a.flags|=1,ir(i,a,u,y),a.child)}function f3(i,a,u,f,y,l){return Fc(a),a.updateQueue=null,u=X4(a,f,u,y),$4(i),f=xb(),i!==null&&!yn?(wb(i,a,l),Ss(i,a,l)):(Ot&&f&&db(a),a.flags|=1,ir(i,a,u,l),a.child)}function m3(i,a,u,f,y){if(Fc(a),a.stateNode===null){var l=Ph,D=u.contextType;typeof D=="object"&&D!==null&&(l=ar(D)),l=new u(f,l),a.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Pv,a.stateNode=l,l._reactInternals=a,l=a.stateNode,l.props=f,l.state=a.memoizedState,l.refs={},_b(a),D=u.contextType,l.context=typeof D=="object"&&D!==null?ar(D):Ph,l.state=a.memoizedState,D=u.getDerivedStateFromProps,typeof D=="function"&&(Ny(a,u,D,f),l.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(D=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),D!==l.state&&Pv.enqueueReplaceState(l,l.state,null),nf(a,f,l,y),tf(),l.state=a.memoizedState),typeof l.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(i===null){l=a.stateNode;var B=a.memoizedProps,q=Vc(u,B);l.props=q;var K=l.context,fe=u.contextType;D=Ph,typeof fe=="object"&&fe!==null&&(D=ar(fe));var pe=u.getDerivedStateFromProps;fe=typeof pe=="function"||typeof l.getSnapshotBeforeUpdate=="function",B=a.pendingProps!==B,fe||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(B||K!==D)&&l3(a,l,f,D),hl=!1;var oe=a.memoizedState;l.state=oe,nf(a,f,l,y),tf(),K=a.memoizedState,B||oe!==K||hl?(typeof pe=="function"&&(Ny(a,u,pe,f),K=a.memoizedState),(q=hl||s3(a,u,q,f,oe,K,D))?(fe||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(a.flags|=4194308)):(typeof l.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=K),l.props=f,l.state=K,l.context=D,f=q):(typeof l.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{l=a.stateNode,Sv(i,a),D=a.memoizedProps,fe=Vc(u,D),l.props=fe,pe=a.pendingProps,oe=l.context,K=u.contextType,q=Ph,typeof K=="object"&&K!==null&&(q=ar(K)),B=u.getDerivedStateFromProps,(K=typeof B=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(D!==pe||oe!==q)&&l3(a,l,f,q),hl=!1,oe=a.memoizedState,l.state=oe,nf(a,f,l,y),tf();var le=a.memoizedState;D!==pe||oe!==le||hl||i!==null&&i.dependencies!==null&&wg(i.dependencies)?(typeof B=="function"&&(Ny(a,u,B,f),le=a.memoizedState),(fe=hl||s3(a,u,fe,f,oe,le,q)||i!==null&&i.dependencies!==null&&wg(i.dependencies))?(K||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(f,le,q),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(f,le,q)),typeof l.componentDidUpdate=="function"&&(a.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof l.componentDidUpdate!="function"||D===i.memoizedProps&&oe===i.memoizedState||(a.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||D===i.memoizedProps&&oe===i.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=le),l.props=f,l.state=le,l.context=q,f=fe):(typeof l.componentDidUpdate!="function"||D===i.memoizedProps&&oe===i.memoizedState||(a.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||D===i.memoizedProps&&oe===i.memoizedState||(a.flags|=1024),f=!1)}return l=f,lg(i,a),f=(a.flags&128)!==0,l||f?(l=a.stateNode,u=f&&typeof u.getDerivedStateFromError!="function"?null:l.render(),a.flags|=1,i!==null&&f?(a.child=Nc(a,i.child,null,y),a.child=Nc(a,null,u,y)):ir(i,a,u,y),a.memoizedState=l.state,i=a.child):i=Ss(i,a,y),i}function g3(i,a,u,f){return Bc(),a.flags|=256,ir(i,a,u,f),a.child}var Uy={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vy(i){return{baseLanes:i,cachePool:U4()}}function jy(i,a,u){return i=i!==null?i.childLanes&~u:0,a&&(i|=ra),i}function RT(i,a,u){var f=a.pendingProps,y=!1,l=(a.flags&128)!==0,D;if((D=l)||(D=i!==null&&i.memoizedState===null?!1:(rn.current&2)!==0),D&&(y=!0,a.flags&=-129),D=(a.flags&32)!==0,a.flags&=-33,i===null){if(Ot){if(y?pl(a):fl(a),(i=Pi)?(i=TS(i,Aa),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Dl!==null?{id:wo,overflow:To}:null,retryLane:536870912,hydrationErrors:null},u=O4(i),u.return=a,a.child=u,rr=a,Pi=null)):i=null,i===null)throw Pl(a);return $v(i)?a.lanes=32:a.lanes=536870912,null}var B=f.children;return f=f.fallback,y?(fl(a),y=a.mode,B=zg({mode:"hidden",children:B},y),f=Ic(f,y,u,null),B.return=a,f.return=a,B.sibling=f,a.child=B,f=a.child,f.memoizedState=Vy(u),f.childLanes=jy(i,D,u),a.memoizedState=Uy,Xp(null,f)):(pl(a),kv(a,B))}var q=i.memoizedState;if(q!==null&&(B=q.dehydrated,B!==null)){if(l)a.flags&256?(pl(a),a.flags&=-257,a=qy(i,a,u)):a.memoizedState!==null?(fl(a),a.child=i.child,a.flags|=128,a=null):(fl(a),B=f.fallback,y=a.mode,f=zg({mode:"visible",children:f.children},y),B=Ic(B,y,u,null),B.flags|=2,f.return=a,B.return=a,f.sibling=B,a.child=f,Nc(a,i.child,null,u),f=a.child,f.memoizedState=Vy(u),f.childLanes=jy(i,D,u),a.memoizedState=Uy,a=Xp(null,f));else if(pl(a),$v(B)){if(D=B.nextSibling&&B.nextSibling.dataset,D)var K=D.dgst;D=K,f=Error(ke(419)),f.stack="",f.digest=D,mf({value:f,source:null,stack:null}),a=qy(i,a,u)}else if(yn||td(i,a,u,!1),D=(u&i.childLanes)!==0,yn||D){if(D=gi,D!==null&&(f=l4(D,u),f!==0&&f!==q.retryLane))throw q.retryLane=f,Zc(i,f),Vr(D,i,f),Rb;Hv(B)||Ig(),a=qy(i,a,u)}else Hv(B)?(a.flags|=192,a.child=i.child,a=null):(i=q.treeContext,Pi=Da(B.nextSibling),rr=a,Ot=!0,wl=null,Aa=!1,i!==null&&F4(a,i),a=kv(a,f.children),a.flags|=4096);return a}return y?(fl(a),B=f.fallback,y=a.mode,q=i.child,K=q.sibling,f=ys(q,{mode:"hidden",children:f.children}),f.subtreeFlags=q.subtreeFlags&65011712,K!==null?B=ys(K,B):(B=Ic(B,y,u,null),B.flags|=2),B.return=a,f.return=a,f.sibling=B,a.child=f,Xp(null,f),f=a.child,B=i.child.memoizedState,B===null?B=Vy(u):(y=B.cachePool,y!==null?(q=_n._currentValue,y=y.parent!==q?{parent:q,pool:q}:y):y=U4(),B={baseLanes:B.baseLanes|u,cachePool:y}),f.memoizedState=B,f.childLanes=jy(i,D,u),a.memoizedState=Uy,Xp(i.child,f)):(pl(a),u=i.child,i=u.sibling,u=ys(u,{mode:"visible",children:f.children}),u.return=a,u.sibling=null,i!==null&&(D=a.deletions,D===null?(a.deletions=[i],a.flags|=16):D.push(i)),a.child=u,a.memoizedState=null,u)}function kv(i,a){return a=zg({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function zg(i,a){return i=na(22,i,null,a),i.lanes=0,i}function qy(i,a,u){return Nc(a,i.child,null,u),i=kv(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function _3(i,a,u){i.lanes|=a;var f=i.alternate;f!==null&&(f.lanes|=a),xv(i.return,a,u)}function Gy(i,a,u,f,y,l){var D=i.memoizedState;D===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:y,treeForkCount:l}:(D.isBackwards=a,D.rendering=null,D.renderingStartTime=0,D.last=f,D.tail=u,D.tailMode=y,D.treeForkCount=l)}function IT(i,a,u){var f=a.pendingProps,y=f.revealOrder,l=f.tail;f=f.children;var D=rn.current,B=(D&2)!==0;if(B?(D=D&1|2,a.flags|=128):D&=1,Ti(rn,D),ir(i,a,f,u),f=Ot?ff:0,!B&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&_3(i,u,a);else if(i.tag===19)_3(i,u,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(y){case"forwards":for(u=a.child,y=null;u!==null;)i=u.alternate,i!==null&&Mg(i)===null&&(y=u),u=u.sibling;u=y,u===null?(y=a.child,a.child=null):(y=u.sibling,u.sibling=null),Gy(a,!1,y,u,l,f);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=a.child,a.child=null;y!==null;){if(i=y.alternate,i!==null&&Mg(i)===null){a.child=y;break}i=y.sibling,y.sibling=u,u=y,y=i}Gy(a,!0,u,null,l,f);break;case"together":Gy(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function Ss(i,a,u){if(i!==null&&(a.dependencies=i.dependencies),Il|=a.lanes,(u&a.childLanes)===0)if(i!==null){if(td(i,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(ke(153));if(a.child!==null){for(i=a.child,u=ys(i,i.pendingProps),a.child=u,u.return=a;i.sibling!==null;)i=i.sibling,u=u.sibling=ys(i,i.pendingProps),u.return=a;u.sibling=null}return a.child}function Ib(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&wg(i)))}function yA(i,a,u){switch(a.tag){case 3:mg(a,a.stateNode.containerInfo),dl(a,_n,i.memoizedState.cache),Bc();break;case 27:case 5:lv(a);break;case 4:mg(a,a.stateNode.containerInfo);break;case 10:dl(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Cv(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(pl(a),a.flags|=128,null):(u&a.child.childLanes)!==0?RT(i,a,u):(pl(a),i=Ss(i,a,u),i!==null?i.sibling:null);pl(a);break;case 19:var y=(i.flags&128)!==0;if(f=(u&a.childLanes)!==0,f||(td(i,a,u,!1),f=(u&a.childLanes)!==0),y){if(f)return IT(i,a,u);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),Ti(rn,rn.current),f)break;return null;case 22:return a.lanes=0,PT(i,a,u,a.pendingProps);case 24:dl(a,_n,i.memoizedState.cache)}return Ss(i,a,u)}function kT(i,a,u){if(i!==null)if(i.memoizedProps!==a.pendingProps)yn=!0;else{if(!Ib(i,u)&&(a.flags&128)===0)return yn=!1,yA(i,a,u);yn=(i.flags&131072)!==0}else yn=!1,Ot&&(a.flags&1048576)!==0&&B4(a,ff,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(i=Dc(a.elementType),a.type=i,typeof i=="function")hb(i)?(f=Vc(i,f),a.tag=1,a=m3(null,a,i,f,u)):(a.tag=0,a=Iv(null,a,i,f,u));else{if(i!=null){var y=i.$$typeof;if(y===Kv){a.tag=11,a=u3(null,a,i,f,u);break e}else if(y===Qv){a.tag=14,a=h3(null,a,i,f,u);break e}}throw a=ov(i)||i,Error(ke(306,a,""))}}return a;case 0:return Iv(i,a,a.type,a.pendingProps,u);case 1:return f=a.type,y=Vc(f,a.pendingProps),m3(i,a,f,y,u);case 3:e:{if(mg(a,a.stateNode.containerInfo),i===null)throw Error(ke(387));f=a.pendingProps;var l=a.memoizedState;y=l.element,Sv(i,a),nf(a,f,null,u);var D=a.memoizedState;if(f=D.cache,dl(a,_n,f),f!==l.cache&&wv(a,[_n],u,!0),tf(),f=D.element,l.isDehydrated)if(l={element:f,isDehydrated:!1,cache:D.cache},a.updateQueue.baseState=l,a.memoizedState=l,a.flags&256){a=g3(i,a,f,u);break e}else if(f!==y){y=Ca(Error(ke(424)),a),mf(y),a=g3(i,a,f,u);break e}else for(i=a.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,Pi=Da(i.firstChild),rr=a,Ot=!0,wl=null,Aa=!0,u=q4(a,null,f,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Bc(),f===y){a=Ss(i,a,u);break e}ir(i,a,f,u)}a=a.child}return a;case 26:return lg(i,a),i===null?(u=N3(a.type,null,a.pendingProps,null))?a.memoizedState=u:Ot||(u=a.type,i=a.pendingProps,f=Bg(xl.current).createElement(u),f[nr]=a,f[jr]=i,or(f,u,i),jn(f),a.stateNode=f):a.memoizedState=N3(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return lv(a),i===null&&Ot&&(f=a.stateNode=SS(a.type,a.pendingProps,xl.current),rr=a,Aa=!0,y=Pi,Ll(a.type)?(Xv=y,Pi=Da(f.firstChild)):Pi=y),ir(i,a,a.pendingProps.children,u),lg(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&Ot&&((y=f=Pi)&&(f=HA(f,a.type,a.pendingProps,Aa),f!==null?(a.stateNode=f,rr=a,Pi=Da(f.firstChild),Aa=!1,y=!0):y=!1),y||Pl(a)),lv(a),y=a.type,l=a.pendingProps,D=i!==null?i.memoizedProps:null,f=l.children,Gv(y,l)?f=null:D!==null&&Gv(y,D)&&(a.flags|=32),a.memoizedState!==null&&(y=bb(i,a,cA,null,null,u),xf._currentValue=y),lg(i,a),ir(i,a,f,u),a.child;case 6:return i===null&&Ot&&((i=u=Pi)&&(u=$A(u,a.pendingProps,Aa),u!==null?(a.stateNode=u,rr=a,Pi=null,i=!0):i=!1),i||Pl(a)),null;case 13:return RT(i,a,u);case 4:return mg(a,a.stateNode.containerInfo),f=a.pendingProps,i===null?a.child=Nc(a,null,f,u):ir(i,a,f,u),a.child;case 11:return u3(i,a,a.type,a.pendingProps,u);case 7:return ir(i,a,a.pendingProps,u),a.child;case 8:return ir(i,a,a.pendingProps.children,u),a.child;case 12:return ir(i,a,a.pendingProps.children,u),a.child;case 10:return f=a.pendingProps,dl(a,a.type,f.value),ir(i,a,f.children,u),a.child;case 9:return y=a.type._context,f=a.pendingProps.children,Fc(a),y=ar(y),f=f(y),a.flags|=1,ir(i,a,f,u),a.child;case 14:return h3(i,a,a.type,a.pendingProps,u);case 15:return DT(i,a,a.type,a.pendingProps,u);case 19:return IT(i,a,u);case 31:return _A(i,a,u);case 22:return PT(i,a,u,a.pendingProps);case 24:return Fc(a),f=ar(_n),i===null?(y=mb(),y===null&&(y=gi,l=fb(),y.pooledCache=l,l.refCount++,l!==null&&(y.pooledCacheLanes|=u),y=l),a.memoizedState={parent:f,cache:y},_b(a),dl(a,_n,y)):((i.lanes&u)!==0&&(Sv(i,a),nf(a,null,null,u),tf()),y=i.memoizedState,l=a.memoizedState,y.parent!==f?(y={parent:f,cache:f},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),dl(a,_n,f)):(f=l.cache,dl(a,_n,f),f!==y.cache&&wv(a,[_n],u,!0))),ir(i,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(ke(156,a.tag))}function cs(i){i.flags|=4}function Zy(i,a,u,f,y){if((a=(i.mode&32)!==0)&&(a=!1),a){if(i.flags|=16777216,(y&335544128)===y)if(i.stateNode.complete)i.flags|=8192;else if(rS())i.flags|=8192;else throw Lc=Tg,gb}else i.flags&=-16777217}function y3(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!CS(a))if(rS())i.flags|=8192;else throw Lc=Tg,gb}function H0(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?a4():536870912,i.lanes|=a,Xh|=a)}function Vp(i,a){if(!Ot)switch(i.tailMode){case"hidden":a=i.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?i.tail=null:u.sibling=null;break;case"collapsed":u=i.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function Di(i){var a=i.alternate!==null&&i.alternate.child===i.child,u=0,f=0;if(a)for(var y=i.child;y!==null;)u|=y.lanes|y.childLanes,f|=y.subtreeFlags&65011712,f|=y.flags&65011712,y.return=i,y=y.sibling;else for(y=i.child;y!==null;)u|=y.lanes|y.childLanes,f|=y.subtreeFlags,f|=y.flags,y.return=i,y=y.sibling;return i.subtreeFlags|=f,i.childLanes=u,a}function vA(i,a,u){var f=a.pendingProps;switch(pb(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Di(a),null;case 1:return Di(a),null;case 3:return u=a.stateNode,f=null,i!==null&&(f=i.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),vs(_n),jh(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(i===null||i.child===null)&&(vh(a)?cs(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Oy())),Di(a),null;case 26:var y=a.type,l=a.memoizedState;return i===null?(cs(a),l!==null?(Di(a),y3(a,l)):(Di(a),Zy(a,y,null,f,u))):l?l!==i.memoizedState?(cs(a),Di(a),y3(a,l)):(Di(a),a.flags&=-16777217):(i=i.memoizedProps,i!==f&&cs(a),Di(a),Zy(a,y,i,f,u)),null;case 27:if(gg(a),u=xl.current,y=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==f&&cs(a);else{if(!f){if(a.stateNode===null)throw Error(ke(166));return Di(a),null}i=Mo.current,vh(a)?$5(a,i):(i=SS(y,f,u),a.stateNode=i,cs(a))}return Di(a),null;case 5:if(gg(a),y=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==f&&cs(a);else{if(!f){if(a.stateNode===null)throw Error(ke(166));return Di(a),null}if(l=Mo.current,vh(a))$5(a,l);else{var D=Bg(xl.current);switch(l){case 1:l=D.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:l=D.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":l=D.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":l=D.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":l=D.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild);break;case"select":l=typeof f.is=="string"?D.createElement("select",{is:f.is}):D.createElement("select"),f.multiple?l.multiple=!0:f.size&&(l.size=f.size);break;default:l=typeof f.is=="string"?D.createElement(y,{is:f.is}):D.createElement(y)}}l[nr]=a,l[jr]=f;e:for(D=a.child;D!==null;){if(D.tag===5||D.tag===6)l.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===a)break e;for(;D.sibling===null;){if(D.return===null||D.return===a)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}a.stateNode=l;e:switch(or(l,y,f),y){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&cs(a)}}return Di(a),Zy(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,u),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==f&&cs(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(ke(166));if(i=xl.current,vh(a)){if(i=a.stateNode,u=a.memoizedProps,f=null,y=rr,y!==null)switch(y.tag){case 27:case 5:f=y.memoizedProps}i[nr]=a,i=!!(i.nodeValue===u||f!==null&&f.suppressHydrationWarning===!0||bS(i.nodeValue,u)),i||Pl(a,!0)}else i=Bg(i).createTextNode(f),i[nr]=a,a.stateNode=i}return Di(a),null;case 31:if(u=a.memoizedState,i===null||i.memoizedState!==null){if(f=vh(a),u!==null){if(i===null){if(!f)throw Error(ke(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ke(557));i[nr]=a}else Bc(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Di(a),i=!1}else u=Oy(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),i=!0;if(!i)return a.flags&256?(ia(a),a):(ia(a),null);if((a.flags&128)!==0)throw Error(ke(558))}return Di(a),null;case 13:if(f=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(y=vh(a),f!==null&&f.dehydrated!==null){if(i===null){if(!y)throw Error(ke(318));if(y=a.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(ke(317));y[nr]=a}else Bc(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Di(a),y=!1}else y=Oy(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(ia(a),a):(ia(a),null)}return ia(a),(a.flags&128)!==0?(a.lanes=u,a):(u=f!==null,i=i!==null&&i.memoizedState!==null,u&&(f=a.child,y=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(y=f.alternate.memoizedState.cachePool.pool),l=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(l=f.memoizedState.cachePool.pool),l!==y&&(f.flags|=2048)),u!==i&&u&&(a.child.flags|=8192),H0(a,a.updateQueue),Di(a),null);case 4:return jh(),i===null&&Ub(a.stateNode.containerInfo),Di(a),null;case 10:return vs(a.type),Di(a),null;case 19:if(qn(rn),f=a.memoizedState,f===null)return Di(a),null;if(y=(a.flags&128)!==0,l=f.rendering,l===null)if(y)Vp(f,!1);else{if(Wi!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(l=Mg(i),l!==null){for(a.flags|=128,Vp(f,!1),i=l.updateQueue,a.updateQueue=i,H0(a,i),a.subtreeFlags=0,i=u,u=a.child;u!==null;)L4(u,i),u=u.sibling;return Ti(rn,rn.current&1|2),Ot&&ps(a,f.treeForkCount),a.child}i=i.sibling}f.tail!==null&&aa()>Pg&&(a.flags|=128,y=!0,Vp(f,!1),a.lanes=4194304)}else{if(!y)if(i=Mg(l),i!==null){if(a.flags|=128,y=!0,i=i.updateQueue,a.updateQueue=i,H0(a,i),Vp(f,!0),f.tail===null&&f.tailMode==="hidden"&&!l.alternate&&!Ot)return Di(a),null}else 2*aa()-f.renderingStartTime>Pg&&u!==536870912&&(a.flags|=128,y=!0,Vp(f,!1),a.lanes=4194304);f.isBackwards?(l.sibling=a.child,a.child=l):(i=f.last,i!==null?i.sibling=l:a.child=l,f.last=l)}return f.tail!==null?(i=f.tail,f.rendering=i,f.tail=i.sibling,f.renderingStartTime=aa(),i.sibling=null,u=rn.current,Ti(rn,y?u&1|2:u&1),Ot&&ps(a,f.treeForkCount),i):(Di(a),null);case 22:case 23:return ia(a),yb(),f=a.memoizedState!==null,i!==null?i.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(u&536870912)!==0&&(a.flags&128)===0&&(Di(a),a.subtreeFlags&6&&(a.flags|=8192)):Di(a),u=a.updateQueue,u!==null&&H0(a,u.retryQueue),u=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==u&&(a.flags|=2048),i!==null&&qn(kc),null;case 24:return u=null,i!==null&&(u=i.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),vs(_n),Di(a),null;case 25:return null;case 30:return null}throw Error(ke(156,a.tag))}function bA(i,a){switch(pb(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return vs(_n),jh(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return gg(a),null;case 31:if(a.memoizedState!==null){if(ia(a),a.alternate===null)throw Error(ke(340));Bc()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(ia(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(ke(340));Bc()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return qn(rn),null;case 4:return jh(),null;case 10:return vs(a.type),null;case 22:case 23:return ia(a),yb(),i!==null&&qn(kc),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return vs(_n),null;case 25:return null;default:return null}}function LT(i,a){switch(pb(a),a.tag){case 3:vs(_n),jh();break;case 26:case 27:case 5:gg(a);break;case 4:jh();break;case 31:a.memoizedState!==null&&ia(a);break;case 13:ia(a);break;case 19:qn(rn);break;case 10:vs(a.type);break;case 22:case 23:ia(a),yb(),i!==null&&qn(kc);break;case 24:vs(_n)}}function Rf(i,a){try{var u=a.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var y=f.next;u=y;do{if((u.tag&i)===i){f=void 0;var l=u.create,D=u.inst;f=l(),D.destroy=f}u=u.next}while(u!==y)}}catch(B){oi(a,a.return,B)}}function Rl(i,a,u){try{var f=a.updateQueue,y=f!==null?f.lastEffect:null;if(y!==null){var l=y.next;f=l;do{if((f.tag&i)===i){var D=f.inst,B=D.destroy;if(B!==void 0){D.destroy=void 0,y=a;var q=u,K=B;try{K()}catch(fe){oi(y,q,fe)}}}f=f.next}while(f!==l)}}catch(fe){oi(a,a.return,fe)}}function OT(i){var a=i.updateQueue;if(a!==null){var u=i.stateNode;try{Z4(a,u)}catch(f){oi(i,i.return,f)}}}function BT(i,a,u){u.props=Vc(i.type,i.memoizedProps),u.state=i.memoizedState;try{u.componentWillUnmount()}catch(f){oi(i,a,f)}}function af(i,a){try{var u=i.ref;if(u!==null){switch(i.tag){case 26:case 27:case 5:var f=i.stateNode;break;case 30:f=i.stateNode;break;default:f=i.stateNode}typeof u=="function"?i.refCleanup=u(f):u.current=f}}catch(y){oi(i,a,y)}}function So(i,a){var u=i.ref,f=i.refCleanup;if(u!==null)if(typeof f=="function")try{f()}catch(y){oi(i,a,y)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){oi(i,a,y)}else u.current=null}function FT(i){var a=i.type,u=i.memoizedProps,f=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&f.focus();break e;case"img":u.src?f.src=u.src:u.srcSet&&(f.srcset=u.srcSet)}}catch(y){oi(i,i.return,y)}}function Hy(i,a,u){try{var f=i.stateNode;UA(f,i.type,u,a),f[jr]=a}catch(y){oi(i,i.return,y)}}function NT(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Ll(i.type)||i.tag===4}function $y(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||NT(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Ll(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Lv(i,a,u){var f=i.tag;if(f===5||f===6)i=i.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(i,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(i),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=gs));else if(f!==4&&(f===27&&Ll(i.type)&&(u=i.stateNode,a=null),i=i.child,i!==null))for(Lv(i,a,u),i=i.sibling;i!==null;)Lv(i,a,u),i=i.sibling}function Dg(i,a,u){var f=i.tag;if(f===5||f===6)i=i.stateNode,a?u.insertBefore(i,a):u.appendChild(i);else if(f!==4&&(f===27&&Ll(i.type)&&(u=i.stateNode),i=i.child,i!==null))for(Dg(i,a,u),i=i.sibling;i!==null;)Dg(i,a,u),i=i.sibling}function UT(i){var a=i.stateNode,u=i.memoizedProps;try{for(var f=i.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);or(a,f,u),a[nr]=i,a[jr]=u}catch(l){oi(i,i.return,l)}}var fs=!1,gn=!1,Xy=!1,v3=typeof WeakSet=="function"?WeakSet:Set,Vn=null;function xA(i,a){if(i=i.containerInfo,jv=Vg,i=C4(i),lb(i)){if("selectionStart"in i)var u={start:i.selectionStart,end:i.selectionEnd};else e:{u=(u=i.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var y=f.anchorOffset,l=f.focusNode;f=f.focusOffset;try{u.nodeType,l.nodeType}catch{u=null;break e}var D=0,B=-1,q=-1,K=0,fe=0,pe=i,oe=null;t:for(;;){for(var le;pe!==u||y!==0&&pe.nodeType!==3||(B=D+y),pe!==l||f!==0&&pe.nodeType!==3||(q=D+f),pe.nodeType===3&&(D+=pe.nodeValue.length),(le=pe.firstChild)!==null;)oe=pe,pe=le;for(;;){if(pe===i)break t;if(oe===u&&++K===y&&(B=D),oe===l&&++fe===f&&(q=D),(le=pe.nextSibling)!==null)break;pe=oe,oe=pe.parentNode}pe=le}u=B===-1||q===-1?null:{start:B,end:q}}else u=null}u=u||{start:0,end:0}}else u=null;for(qv={focusedElem:i,selectionRange:u},Vg=!1,Vn=a;Vn!==null;)if(a=Vn,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,Vn=i;else for(;Vn!==null;){switch(a=Vn,l=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(u=0;u<i.length;u++)y=i[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&l!==null){i=void 0,u=a,y=l.memoizedProps,l=l.memoizedState,f=u.stateNode;try{var Oe=Vc(u.type,y);i=f.getSnapshotBeforeUpdate(Oe,l),f.__reactInternalSnapshotBeforeUpdate=i}catch(Ue){oi(u,u.return,Ue)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,u=i.nodeType,u===9)Zv(i);else if(u===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Zv(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(ke(163))}if(i=a.sibling,i!==null){i.return=a.return,Vn=i;break}Vn=a.return}}function VT(i,a,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:hs(i,u),f&4&&Rf(5,u);break;case 1:if(hs(i,u),f&4)if(i=u.stateNode,a===null)try{i.componentDidMount()}catch(D){oi(u,u.return,D)}else{var y=Vc(u.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(y,a,i.__reactInternalSnapshotBeforeUpdate)}catch(D){oi(u,u.return,D)}}f&64&&OT(u),f&512&&af(u,u.return);break;case 3:if(hs(i,u),f&64&&(i=u.updateQueue,i!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{Z4(i,a)}catch(D){oi(u,u.return,D)}}break;case 27:a===null&&f&4&&UT(u);case 26:case 5:hs(i,u),a===null&&f&4&&FT(u),f&512&&af(u,u.return);break;case 12:hs(i,u);break;case 31:hs(i,u),f&4&&GT(i,u);break;case 13:hs(i,u),f&4&&ZT(i,u),f&64&&(i=u.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(u=DA.bind(null,u),XA(i,u))));break;case 22:if(f=u.memoizedState!==null||fs,!f){a=a!==null&&a.memoizedState!==null||gn,y=fs;var l=gn;fs=f,(gn=a)&&!l?ds(i,u,(u.subtreeFlags&8772)!==0):hs(i,u),fs=y,gn=l}break;case 30:break;default:hs(i,u)}}function jT(i){var a=i.alternate;a!==null&&(i.alternate=null,jT(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&ib(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Ni=null,Nr=!1;function us(i,a,u){for(u=u.child;u!==null;)qT(i,a,u),u=u.sibling}function qT(i,a,u){if(oa&&typeof oa.onCommitFiberUnmount=="function")try{oa.onCommitFiberUnmount(Mf,u)}catch{}switch(u.tag){case 26:gn||So(u,a),us(i,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:gn||So(u,a);var f=Ni,y=Nr;Ll(u.type)&&(Ni=u.stateNode,Nr=!1),us(i,a,u),cf(u.stateNode),Ni=f,Nr=y;break;case 5:gn||So(u,a);case 6:if(f=Ni,y=Nr,Ni=null,us(i,a,u),Ni=f,Nr=y,Ni!==null)if(Nr)try{(Ni.nodeType===9?Ni.body:Ni.nodeName==="HTML"?Ni.ownerDocument.body:Ni).removeChild(u.stateNode)}catch(l){oi(u,a,l)}else try{Ni.removeChild(u.stateNode)}catch(l){oi(u,a,l)}break;case 18:Ni!==null&&(Nr?(i=Ni,k3(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,u.stateNode),Qh(i)):k3(Ni,u.stateNode));break;case 4:f=Ni,y=Nr,Ni=u.stateNode.containerInfo,Nr=!0,us(i,a,u),Ni=f,Nr=y;break;case 0:case 11:case 14:case 15:Rl(2,u,a),gn||Rl(4,u,a),us(i,a,u);break;case 1:gn||(So(u,a),f=u.stateNode,typeof f.componentWillUnmount=="function"&&BT(u,a,f)),us(i,a,u);break;case 21:us(i,a,u);break;case 22:gn=(f=gn)||u.memoizedState!==null,us(i,a,u),gn=f;break;default:us(i,a,u)}}function GT(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Qh(i)}catch(u){oi(a,a.return,u)}}}function ZT(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Qh(i)}catch(u){oi(a,a.return,u)}}function wA(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new v3),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new v3),a;default:throw Error(ke(435,i.tag))}}function $0(i,a){var u=wA(i);a.forEach(function(f){if(!u.has(f)){u.add(f);var y=PA.bind(null,i,f);f.then(y,y)}})}function Br(i,a){var u=a.deletions;if(u!==null)for(var f=0;f<u.length;f++){var y=u[f],l=i,D=a,B=D;e:for(;B!==null;){switch(B.tag){case 27:if(Ll(B.type)){Ni=B.stateNode,Nr=!1;break e}break;case 5:Ni=B.stateNode,Nr=!1;break e;case 3:case 4:Ni=B.stateNode.containerInfo,Nr=!0;break e}B=B.return}if(Ni===null)throw Error(ke(160));qT(l,D,y),Ni=null,Nr=!1,l=y.alternate,l!==null&&(l.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)HT(a,i),a=a.sibling}var Wa=null;function HT(i,a){var u=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Br(a,i),Fr(i),f&4&&(Rl(3,i,i.return),Rf(3,i),Rl(5,i,i.return));break;case 1:Br(a,i),Fr(i),f&512&&(gn||u===null||So(u,u.return)),f&64&&fs&&(i=i.updateQueue,i!==null&&(f=i.callbacks,f!==null&&(u=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=u===null?f:u.concat(f))));break;case 26:var y=Wa;if(Br(a,i),Fr(i),f&512&&(gn||u===null||So(u,u.return)),f&4){var l=u!==null?u.memoizedState:null;if(f=i.memoizedState,u===null)if(f===null)if(i.stateNode===null){e:{f=i.type,u=i.memoizedProps,y=y.ownerDocument||y;t:switch(f){case"title":l=y.getElementsByTagName("title")[0],(!l||l[Af]||l[nr]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=y.createElement(f),y.head.insertBefore(l,y.querySelector("head > title"))),or(l,f,u),l[nr]=i,jn(l),f=l;break e;case"link":var D=V3("link","href",y).get(f+(u.href||""));if(D){for(var B=0;B<D.length;B++)if(l=D[B],l.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&l.getAttribute("rel")===(u.rel==null?null:u.rel)&&l.getAttribute("title")===(u.title==null?null:u.title)&&l.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){D.splice(B,1);break t}}l=y.createElement(f),or(l,f,u),y.head.appendChild(l);break;case"meta":if(D=V3("meta","content",y).get(f+(u.content||""))){for(B=0;B<D.length;B++)if(l=D[B],l.getAttribute("content")===(u.content==null?null:""+u.content)&&l.getAttribute("name")===(u.name==null?null:u.name)&&l.getAttribute("property")===(u.property==null?null:u.property)&&l.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&l.getAttribute("charset")===(u.charSet==null?null:u.charSet)){D.splice(B,1);break t}}l=y.createElement(f),or(l,f,u),y.head.appendChild(l);break;default:throw Error(ke(468,f))}l[nr]=i,jn(l),f=l}i.stateNode=f}else j3(y,i.type,i.stateNode);else i.stateNode=U3(y,f,i.memoizedProps);else l!==f?(l===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):l.count--,f===null?j3(y,i.type,i.stateNode):U3(y,f,i.memoizedProps)):f===null&&i.stateNode!==null&&Hy(i,i.memoizedProps,u.memoizedProps)}break;case 27:Br(a,i),Fr(i),f&512&&(gn||u===null||So(u,u.return)),u!==null&&f&4&&Hy(i,i.memoizedProps,u.memoizedProps);break;case 5:if(Br(a,i),Fr(i),f&512&&(gn||u===null||So(u,u.return)),i.flags&32){y=i.stateNode;try{Gh(y,"")}catch(Oe){oi(i,i.return,Oe)}}f&4&&i.stateNode!=null&&(y=i.memoizedProps,Hy(i,y,u!==null?u.memoizedProps:y)),f&1024&&(Xy=!0);break;case 6:if(Br(a,i),Fr(i),f&4){if(i.stateNode===null)throw Error(ke(162));f=i.memoizedProps,u=i.stateNode;try{u.nodeValue=f}catch(Oe){oi(i,i.return,Oe)}}break;case 3:if(hg=null,y=Wa,Wa=Fg(a.containerInfo),Br(a,i),Wa=y,Fr(i),f&4&&u!==null&&u.memoizedState.isDehydrated)try{Qh(a.containerInfo)}catch(Oe){oi(i,i.return,Oe)}Xy&&(Xy=!1,$T(i));break;case 4:f=Wa,Wa=Fg(i.stateNode.containerInfo),Br(a,i),Fr(i),Wa=f;break;case 12:Br(a,i),Fr(i);break;case 31:Br(a,i),Fr(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,$0(i,f)));break;case 13:Br(a,i),Fr(i),i.child.flags&8192&&i.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(e1=aa()),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,$0(i,f)));break;case 22:y=i.memoizedState!==null;var q=u!==null&&u.memoizedState!==null,K=fs,fe=gn;if(fs=K||y,gn=fe||q,Br(a,i),gn=fe,fs=K,Fr(i),f&8192)e:for(a=i.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(u===null||q||fs||gn||Pc(i)),u=null,a=i;;){if(a.tag===5||a.tag===26){if(u===null){q=u=a;try{if(l=q.stateNode,y)D=l.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{B=q.stateNode;var pe=q.memoizedProps.style,oe=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;B.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Oe){oi(q,q.return,Oe)}}}else if(a.tag===6){if(u===null){q=a;try{q.stateNode.nodeValue=y?"":q.memoizedProps}catch(Oe){oi(q,q.return,Oe)}}}else if(a.tag===18){if(u===null){q=a;try{var le=q.stateNode;y?L3(le,!0):L3(q.stateNode,!1)}catch(Oe){oi(q,q.return,Oe)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=i.updateQueue,f!==null&&(u=f.retryQueue,u!==null&&(f.retryQueue=null,$0(i,u))));break;case 19:Br(a,i),Fr(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,$0(i,f)));break;case 30:break;case 21:break;default:Br(a,i),Fr(i)}}function Fr(i){var a=i.flags;if(a&2){try{for(var u,f=i.return;f!==null;){if(NT(f)){u=f;break}f=f.return}if(u==null)throw Error(ke(160));switch(u.tag){case 27:var y=u.stateNode,l=$y(i);Dg(i,l,y);break;case 5:var D=u.stateNode;u.flags&32&&(Gh(D,""),u.flags&=-33);var B=$y(i);Dg(i,B,D);break;case 3:case 4:var q=u.stateNode.containerInfo,K=$y(i);Lv(i,K,q);break;default:throw Error(ke(161))}}catch(fe){oi(i,i.return,fe)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function $T(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;$T(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function hs(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)VT(i,a.alternate,a),a=a.sibling}function Pc(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:Rl(4,a,a.return),Pc(a);break;case 1:So(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&BT(a,a.return,u),Pc(a);break;case 27:cf(a.stateNode);case 26:case 5:So(a,a.return),Pc(a);break;case 22:a.memoizedState===null&&Pc(a);break;case 30:Pc(a);break;default:Pc(a)}i=i.sibling}}function ds(i,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,y=i,l=a,D=l.flags;switch(l.tag){case 0:case 11:case 15:ds(y,l,u),Rf(4,l);break;case 1:if(ds(y,l,u),f=l,y=f.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(K){oi(f,f.return,K)}if(f=l,y=f.updateQueue,y!==null){var B=f.stateNode;try{var q=y.shared.hiddenCallbacks;if(q!==null)for(y.shared.hiddenCallbacks=null,y=0;y<q.length;y++)G4(q[y],B)}catch(K){oi(f,f.return,K)}}u&&D&64&&OT(l),af(l,l.return);break;case 27:UT(l);case 26:case 5:ds(y,l,u),u&&f===null&&D&4&&FT(l),af(l,l.return);break;case 12:ds(y,l,u);break;case 31:ds(y,l,u),u&&D&4&&GT(y,l);break;case 13:ds(y,l,u),u&&D&4&&ZT(y,l);break;case 22:l.memoizedState===null&&ds(y,l,u),af(l,l.return);break;case 30:break;default:ds(y,l,u)}a=a.sibling}}function kb(i,a){var u=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==u&&(i!=null&&i.refCount++,u!=null&&Df(u))}function Lb(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&Df(i))}function Ya(i,a,u,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)XT(i,a,u,f),a=a.sibling}function XT(i,a,u,f){var y=a.flags;switch(a.tag){case 0:case 11:case 15:Ya(i,a,u,f),y&2048&&Rf(9,a);break;case 1:Ya(i,a,u,f);break;case 3:Ya(i,a,u,f),y&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&Df(i)));break;case 12:if(y&2048){Ya(i,a,u,f),i=a.stateNode;try{var l=a.memoizedProps,D=l.id,B=l.onPostCommit;typeof B=="function"&&B(D,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(q){oi(a,a.return,q)}}else Ya(i,a,u,f);break;case 31:Ya(i,a,u,f);break;case 13:Ya(i,a,u,f);break;case 23:break;case 22:l=a.stateNode,D=a.alternate,a.memoizedState!==null?l._visibility&2?Ya(i,a,u,f):of(i,a):l._visibility&2?Ya(i,a,u,f):(l._visibility|=2,xh(i,a,u,f,(a.subtreeFlags&10256)!==0||!1)),y&2048&&kb(D,a);break;case 24:Ya(i,a,u,f),y&2048&&Lb(a.alternate,a);break;default:Ya(i,a,u,f)}}function xh(i,a,u,f,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var l=i,D=a,B=u,q=f,K=D.flags;switch(D.tag){case 0:case 11:case 15:xh(l,D,B,q,y),Rf(8,D);break;case 23:break;case 22:var fe=D.stateNode;D.memoizedState!==null?fe._visibility&2?xh(l,D,B,q,y):of(l,D):(fe._visibility|=2,xh(l,D,B,q,y)),y&&K&2048&&kb(D.alternate,D);break;case 24:xh(l,D,B,q,y),y&&K&2048&&Lb(D.alternate,D);break;default:xh(l,D,B,q,y)}a=a.sibling}}function of(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=i,f=a,y=f.flags;switch(f.tag){case 22:of(u,f),y&2048&&kb(f.alternate,f);break;case 24:of(u,f),y&2048&&Lb(f.alternate,f);break;default:of(u,f)}a=a.sibling}}var Yp=8192;function bh(i,a,u){if(i.subtreeFlags&Yp)for(i=i.child;i!==null;)YT(i,a,u),i=i.sibling}function YT(i,a,u){switch(i.tag){case 26:bh(i,a,u),i.flags&Yp&&i.memoizedState!==null&&oz(u,Wa,i.memoizedState,i.memoizedProps);break;case 5:bh(i,a,u);break;case 3:case 4:var f=Wa;Wa=Fg(i.stateNode.containerInfo),bh(i,a,u),Wa=f;break;case 22:i.memoizedState===null&&(f=i.alternate,f!==null&&f.memoizedState!==null?(f=Yp,Yp=16777216,bh(i,a,u),Yp=f):bh(i,a,u));break;default:bh(i,a,u)}}function WT(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function jp(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var f=a[u];Vn=f,QT(f,i)}WT(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)KT(i),i=i.sibling}function KT(i){switch(i.tag){case 0:case 11:case 15:jp(i),i.flags&2048&&Rl(9,i,i.return);break;case 3:jp(i);break;case 12:jp(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,cg(i)):jp(i);break;default:jp(i)}}function cg(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var f=a[u];Vn=f,QT(f,i)}WT(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:Rl(8,a,a.return),cg(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,cg(a));break;default:cg(a)}i=i.sibling}}function QT(i,a){for(;Vn!==null;){var u=Vn;switch(u.tag){case 0:case 11:case 15:Rl(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var f=u.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Df(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,Vn=f;else e:for(u=i;Vn!==null;){f=Vn;var y=f.sibling,l=f.return;if(jT(f),f===u){Vn=null;break e}if(y!==null){y.return=l,Vn=y;break e}Vn=l}}}var TA={getCacheForType:function(i){var a=ar(_n),u=a.data.get(i);return u===void 0&&(u=i(),a.data.set(i,u)),u},cacheSignal:function(){return ar(_n).controller.signal}},SA=typeof WeakMap=="function"?WeakMap:Map,Yt=0,gi=null,Ct=null,At=0,ai=0,ta=null,yl=!1,nd=!1,Ob=!1,Ms=0,Wi=0,Il=0,Oc=0,Bb=0,ra=0,Xh=0,sf=null,Ur=null,Ov=!1,e1=0,JT=0,Pg=1/0,Rg=null,Ml=null,An=0,El=null,Yh=null,bs=0,Bv=0,Fv=null,eS=null,lf=0,Nv=null;function la(){return(Yt&2)!==0&&At!==0?At&-At:ut.T!==null?Nb():c4()}function tS(){if(ra===0)if((At&536870912)===0||Ot){var i=B0;B0<<=1,(B0&3932160)===0&&(B0=262144),ra=i}else ra=536870912;return i=ua.current,i!==null&&(i.flags|=32),ra}function Vr(i,a,u){(i===gi&&(ai===2||ai===9)||i.cancelPendingCommit!==null)&&(Wh(i,0),vl(i,At,ra,!1)),Cf(i,u),((Yt&2)===0||i!==gi)&&(i===gi&&((Yt&2)===0&&(Oc|=u),Wi===4&&vl(i,At,ra,!1)),Co(i))}function iS(i,a,u){if((Yt&6)!==0)throw Error(ke(327));var f=!u&&(a&127)===0&&(a&i.expiredLanes)===0||Ef(i,a),y=f?CA(i,a):Yy(i,a,!0),l=f;do{if(y===0){nd&&!f&&vl(i,a,0,!1);break}else{if(u=i.current.alternate,l&&!MA(u)){y=Yy(i,a,!1),l=!1;continue}if(y===2){if(l=a,i.errorRecoveryDisabledLanes&l)var D=0;else D=i.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){a=D;e:{var B=i;y=sf;var q=B.current.memoizedState.isDehydrated;if(q&&(Wh(B,D).flags|=256),D=Yy(B,D,!1),D!==2){if(Ob&&!q){B.errorRecoveryDisabledLanes|=l,Oc|=l,y=4;break e}l=Ur,Ur=y,l!==null&&(Ur===null?Ur=l:Ur.push.apply(Ur,l))}y=D}if(l=!1,y!==2)continue}}if(y===1){Wh(i,0),vl(i,a,0,!0);break}e:{switch(f=i,l=y,l){case 0:case 1:throw Error(ke(345));case 4:if((a&4194048)!==a)break;case 6:vl(f,a,ra,!yl);break e;case 2:Ur=null;break;case 3:case 5:break;default:throw Error(ke(329))}if((a&62914560)===a&&(y=e1+300-aa(),10<y)){if(vl(f,a,ra,!yl),qg(f,0,!0)!==0)break e;bs=a,f.timeoutHandle=wS(b3.bind(null,f,u,Ur,Rg,Ov,a,ra,Oc,Xh,yl,l,"Throttled",-0,0),y);break e}b3(f,u,Ur,Rg,Ov,a,ra,Oc,Xh,yl,l,null,-0,0)}}break}while(!0);Co(i)}function b3(i,a,u,f,y,l,D,B,q,K,fe,pe,oe,le){if(i.timeoutHandle=-1,pe=a.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gs},YT(a,l,pe);var Oe=(l&62914560)===l?e1-aa():(l&4194048)===l?JT-aa():0;if(Oe=sz(pe,Oe),Oe!==null){bs=l,i.cancelPendingCommit=Oe(w3.bind(null,i,a,l,u,f,y,D,B,q,fe,pe,null,oe,le)),vl(i,l,D,!K);return}}w3(i,a,l,u,f,y,D,B,q)}function MA(i){for(var a=i;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var f=0;f<u.length;f++){var y=u[f],l=y.getSnapshot;y=y.value;try{if(!ca(l(),y))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function vl(i,a,u,f){a&=~Bb,a&=~Oc,i.suspendedLanes|=a,i.pingedLanes&=~a,f&&(i.warmLanes|=a),f=i.expirationTimes;for(var y=a;0<y;){var l=31-sa(y),D=1<<l;f[l]=-1,y&=~D}u!==0&&o4(i,u,a)}function t1(){return(Yt&6)===0?(If(0,!1),!1):!0}function Fb(){if(Ct!==null){if(ai===0)var i=Ct.return;else i=Ct,_s=Hc=null,Tb(i),Nh=null,gf=0,i=Ct;for(;i!==null;)LT(i.alternate,i),i=i.return;Ct=null}}function Wh(i,a){var u=i.timeoutHandle;u!==-1&&(i.timeoutHandle=-1,qA(u)),u=i.cancelPendingCommit,u!==null&&(i.cancelPendingCommit=null,u()),bs=0,Fb(),gi=i,Ct=u=ys(i.current,null),At=a,ai=0,ta=null,yl=!1,nd=Ef(i,a),Ob=!1,Xh=ra=Bb=Oc=Il=Wi=0,Ur=sf=null,Ov=!1,(a&8)!==0&&(a|=a&32);var f=i.entangledLanes;if(f!==0)for(i=i.entanglements,f&=a;0<f;){var y=31-sa(f),l=1<<y;a|=i[y],f&=~l}return Ms=a,$g(),u}function nS(i,a){bt=null,ut.H=yf,a===id||a===Yg?(a=Q5(),ai=3):a===gb?(a=Q5(),ai=4):ai=a===Rb?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ta=a,Ct===null&&(Wi=1,Ag(i,Ca(a,i.current)))}function rS(){var i=ua.current;return i===null?!0:(At&4194048)===At?za===null:(At&62914560)===At||(At&536870912)!==0?i===za:!1}function aS(){var i=ut.H;return ut.H=yf,i===null?yf:i}function oS(){var i=ut.A;return ut.A=TA,i}function Ig(){Wi=4,yl||(At&4194048)!==At&&ua.current!==null||(nd=!0),(Il&134217727)===0&&(Oc&134217727)===0||gi===null||vl(gi,At,ra,!1)}function Yy(i,a,u){var f=Yt;Yt|=2;var y=aS(),l=oS();(gi!==i||At!==a)&&(Rg=null,Wh(i,a)),a=!1;var D=Wi;e:do try{if(ai!==0&&Ct!==null){var B=Ct,q=ta;switch(ai){case 8:Fb(),D=6;break e;case 3:case 2:case 9:case 6:ua.current===null&&(a=!0);var K=ai;if(ai=0,ta=null,kh(i,B,q,K),u&&nd){D=0;break e}break;default:K=ai,ai=0,ta=null,kh(i,B,q,K)}}EA(),D=Wi;break}catch(fe){nS(i,fe)}while(!0);return a&&i.shellSuspendCounter++,_s=Hc=null,Yt=f,ut.H=y,ut.A=l,Ct===null&&(gi=null,At=0,$g()),D}function EA(){for(;Ct!==null;)sS(Ct)}function CA(i,a){var u=Yt;Yt|=2;var f=aS(),y=oS();gi!==i||At!==a?(Rg=null,Pg=aa()+500,Wh(i,a)):nd=Ef(i,a);e:do try{if(ai!==0&&Ct!==null){a=Ct;var l=ta;t:switch(ai){case 1:ai=0,ta=null,kh(i,a,l,1);break;case 2:case 9:if(K5(l)){ai=0,ta=null,x3(a);break}a=function(){ai!==2&&ai!==9||gi!==i||(ai=7),Co(i)},l.then(a,a);break e;case 3:ai=7;break e;case 4:ai=5;break e;case 7:K5(l)?(ai=0,ta=null,x3(a)):(ai=0,ta=null,kh(i,a,l,7));break;case 5:var D=null;switch(Ct.tag){case 26:D=Ct.memoizedState;case 5:case 27:var B=Ct;if(D?CS(D):B.stateNode.complete){ai=0,ta=null;var q=B.sibling;if(q!==null)Ct=q;else{var K=B.return;K!==null?(Ct=K,i1(K)):Ct=null}break t}}ai=0,ta=null,kh(i,a,l,5);break;case 6:ai=0,ta=null,kh(i,a,l,6);break;case 8:Fb(),Wi=6;break e;default:throw Error(ke(462))}}AA();break}catch(fe){nS(i,fe)}while(!0);return _s=Hc=null,ut.H=f,ut.A=y,Yt=u,Ct!==null?0:(gi=null,At=0,$g(),Wi)}function AA(){for(;Ct!==null&&!KC();)sS(Ct)}function sS(i){var a=kT(i.alternate,i,Ms);i.memoizedProps=i.pendingProps,a===null?i1(i):Ct=a}function x3(i){var a=i,u=a.alternate;switch(a.tag){case 15:case 0:a=f3(u,a,a.pendingProps,a.type,void 0,At);break;case 11:a=f3(u,a,a.pendingProps,a.type.render,a.ref,At);break;case 5:Tb(a);default:LT(u,a),a=Ct=L4(a,Ms),a=kT(u,a,Ms)}i.memoizedProps=i.pendingProps,a===null?i1(i):Ct=a}function kh(i,a,u,f){_s=Hc=null,Tb(a),Nh=null,gf=0;var y=a.return;try{if(gA(i,y,a,u,At)){Wi=1,Ag(i,Ca(u,i.current)),Ct=null;return}}catch(l){if(y!==null)throw Ct=y,l;Wi=1,Ag(i,Ca(u,i.current)),Ct=null;return}a.flags&32768?(Ot||f===1?i=!0:nd||(At&536870912)!==0?i=!1:(yl=i=!0,(f===2||f===9||f===3||f===6)&&(f=ua.current,f!==null&&f.tag===13&&(f.flags|=16384))),lS(a,i)):i1(a)}function i1(i){var a=i;do{if((a.flags&32768)!==0){lS(a,yl);return}i=a.return;var u=vA(a.alternate,a,Ms);if(u!==null){Ct=u;return}if(a=a.sibling,a!==null){Ct=a;return}Ct=a=i}while(a!==null);Wi===0&&(Wi=5)}function lS(i,a){do{var u=bA(i.alternate,i);if(u!==null){u.flags&=32767,Ct=u;return}if(u=i.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(i=i.sibling,i!==null)){Ct=i;return}Ct=i=u}while(i!==null);Wi=6,Ct=null}function w3(i,a,u,f,y,l,D,B,q){i.cancelPendingCommit=null;do n1();while(An!==0);if((Yt&6)!==0)throw Error(ke(327));if(a!==null){if(a===i.current)throw Error(ke(177));if(l=a.lanes|a.childLanes,l|=cb,s8(i,u,l,D,B,q),i===gi&&(Ct=gi=null,At=0),Yh=a,El=i,bs=u,Bv=l,Fv=y,eS=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,RA(_g,function(){return pS(),null})):(i.callbackNode=null,i.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=ut.T,ut.T=null,y=Wt.p,Wt.p=2,D=Yt,Yt|=4;try{xA(i,a,u)}finally{Yt=D,Wt.p=y,ut.T=f}}An=1,cS(),uS(),hS()}}function cS(){if(An===1){An=0;var i=El,a=Yh,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=ut.T,ut.T=null;var f=Wt.p;Wt.p=2;var y=Yt;Yt|=4;try{HT(a,i);var l=qv,D=C4(i.containerInfo),B=l.focusedElem,q=l.selectionRange;if(D!==B&&B&&B.ownerDocument&&E4(B.ownerDocument.documentElement,B)){if(q!==null&&lb(B)){var K=q.start,fe=q.end;if(fe===void 0&&(fe=K),"selectionStart"in B)B.selectionStart=K,B.selectionEnd=Math.min(fe,B.value.length);else{var pe=B.ownerDocument||document,oe=pe&&pe.defaultView||window;if(oe.getSelection){var le=oe.getSelection(),Oe=B.textContent.length,Ue=Math.min(q.start,Oe),ye=q.end===void 0?Ue:Math.min(q.end,Oe);!le.extend&&Ue>ye&&(D=ye,ye=Ue,Ue=D);var ce=G5(B,Ue),se=G5(B,ye);if(ce&&se&&(le.rangeCount!==1||le.anchorNode!==ce.node||le.anchorOffset!==ce.offset||le.focusNode!==se.node||le.focusOffset!==se.offset)){var de=pe.createRange();de.setStart(ce.node,ce.offset),le.removeAllRanges(),Ue>ye?(le.addRange(de),le.extend(se.node,se.offset)):(de.setEnd(se.node,se.offset),le.addRange(de))}}}}for(pe=[],le=B;le=le.parentNode;)le.nodeType===1&&pe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B<pe.length;B++){var ve=pe[B];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}Vg=!!jv,qv=jv=null}finally{Yt=y,Wt.p=f,ut.T=u}}i.current=a,An=2}}function uS(){if(An===2){An=0;var i=El,a=Yh,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=ut.T,ut.T=null;var f=Wt.p;Wt.p=2;var y=Yt;Yt|=4;try{VT(i,a.alternate,a)}finally{Yt=y,Wt.p=f,ut.T=u}}An=3}}function hS(){if(An===4||An===3){An=0,QC();var i=El,a=Yh,u=bs,f=eS;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?An=5:(An=0,Yh=El=null,dS(i,i.pendingLanes));var y=i.pendingLanes;if(y===0&&(Ml=null),tb(u),a=a.stateNode,oa&&typeof oa.onCommitFiberRoot=="function")try{oa.onCommitFiberRoot(Mf,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=ut.T,y=Wt.p,Wt.p=2,ut.T=null;try{for(var l=i.onRecoverableError,D=0;D<f.length;D++){var B=f[D];l(B.value,{componentStack:B.stack})}}finally{ut.T=a,Wt.p=y}}(bs&3)!==0&&n1(),Co(i),y=i.pendingLanes,(u&261930)!==0&&(y&42)!==0?i===Nv?lf++:(lf=0,Nv=i):lf=0,If(0,!1)}}function dS(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,Df(a)))}function n1(){return cS(),uS(),hS(),pS()}function pS(){if(An!==5)return!1;var i=El,a=Bv;Bv=0;var u=tb(bs),f=ut.T,y=Wt.p;try{Wt.p=32>u?32:u,ut.T=null,u=Fv,Fv=null;var l=El,D=bs;if(An=0,Yh=El=null,bs=0,(Yt&6)!==0)throw Error(ke(331));var B=Yt;if(Yt|=4,KT(l.current),XT(l,l.current,D,u),Yt=B,If(0,!1),oa&&typeof oa.onPostCommitFiberRoot=="function")try{oa.onPostCommitFiberRoot(Mf,l)}catch{}return!0}finally{Wt.p=y,ut.T=f,dS(i,a)}}function T3(i,a,u){a=Ca(u,a),a=Rv(i.stateNode,a,2),i=Sl(i,a,2),i!==null&&(Cf(i,2),Co(i))}function oi(i,a,u){if(i.tag===3)T3(i,i,u);else for(;a!==null;){if(a.tag===3){T3(a,i,u);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Ml===null||!Ml.has(f))){i=Ca(u,i),u=AT(2),f=Sl(a,u,2),f!==null&&(zT(u,f,a,i),Cf(f,2),Co(f));break}}a=a.return}}function Wy(i,a,u){var f=i.pingCache;if(f===null){f=i.pingCache=new SA;var y=new Set;f.set(a,y)}else y=f.get(a),y===void 0&&(y=new Set,f.set(a,y));y.has(u)||(Ob=!0,y.add(u),i=zA.bind(null,i,a,u),a.then(i,i))}function zA(i,a,u){var f=i.pingCache;f!==null&&f.delete(a),i.pingedLanes|=i.suspendedLanes&u,i.warmLanes&=~u,gi===i&&(At&u)===u&&(Wi===4||Wi===3&&(At&62914560)===At&&300>aa()-e1?(Yt&2)===0&&Wh(i,0):Bb|=u,Xh===At&&(Xh=0)),Co(i)}function fS(i,a){a===0&&(a=a4()),i=Zc(i,a),i!==null&&(Cf(i,a),Co(i))}function DA(i){var a=i.memoizedState,u=0;a!==null&&(u=a.retryLane),fS(i,u)}function PA(i,a){var u=0;switch(i.tag){case 31:case 13:var f=i.stateNode,y=i.memoizedState;y!==null&&(u=y.retryLane);break;case 19:f=i.stateNode;break;case 22:f=i.stateNode._retryCache;break;default:throw Error(ke(314))}f!==null&&f.delete(a),fS(i,u)}function RA(i,a){return Jv(i,a)}var kg=null,wh=null,Uv=!1,Lg=!1,Ky=!1,bl=0;function Co(i){i!==wh&&i.next===null&&(wh===null?kg=wh=i:wh=wh.next=i),Lg=!0,Uv||(Uv=!0,kA())}function If(i,a){if(!Ky&&Lg){Ky=!0;do for(var u=!1,f=kg;f!==null;){if(!a)if(i!==0){var y=f.pendingLanes;if(y===0)var l=0;else{var D=f.suspendedLanes,B=f.pingedLanes;l=(1<<31-sa(42|i)+1)-1,l&=y&~(D&~B),l=l&201326741?l&201326741|1:l?l|2:0}l!==0&&(u=!0,S3(f,l))}else l=At,l=qg(f,f===gi?l:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(l&3)===0||Ef(f,l)||(u=!0,S3(f,l));f=f.next}while(u);Ky=!1}}function IA(){mS()}function mS(){Lg=Uv=!1;var i=0;bl!==0&&jA()&&(i=bl);for(var a=aa(),u=null,f=kg;f!==null;){var y=f.next,l=gS(f,a);l===0?(f.next=null,u===null?kg=y:u.next=y,y===null&&(wh=u)):(u=f,(i!==0||(l&3)!==0)&&(Lg=!0)),f=y}An!==0&&An!==5||If(i,!1),bl!==0&&(bl=0)}function gS(i,a){for(var u=i.suspendedLanes,f=i.pingedLanes,y=i.expirationTimes,l=i.pendingLanes&-62914561;0<l;){var D=31-sa(l),B=1<<D,q=y[D];q===-1?((B&u)===0||(B&f)!==0)&&(y[D]=o8(B,a)):q<=a&&(i.expiredLanes|=B),l&=~B}if(a=gi,u=At,u=qg(i,i===a?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f=i.callbackNode,u===0||i===a&&(ai===2||ai===9)||i.cancelPendingCommit!==null)return f!==null&&f!==null&&Ey(f),i.callbackNode=null,i.callbackPriority=0;if((u&3)===0||Ef(i,u)){if(a=u&-u,a===i.callbackPriority)return a;switch(f!==null&&Ey(f),tb(u)){case 2:case 8:u=n4;break;case 32:u=_g;break;case 268435456:u=r4;break;default:u=_g}return f=_S.bind(null,i),u=Jv(u,f),i.callbackPriority=a,i.callbackNode=u,a}return f!==null&&f!==null&&Ey(f),i.callbackPriority=2,i.callbackNode=null,2}function _S(i,a){if(An!==0&&An!==5)return i.callbackNode=null,i.callbackPriority=0,null;var u=i.callbackNode;if(n1()&&i.callbackNode!==u)return null;var f=At;return f=qg(i,i===gi?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f===0?null:(iS(i,f,a),gS(i,aa()),i.callbackNode!=null&&i.callbackNode===u?_S.bind(null,i):null)}function S3(i,a){if(n1())return null;iS(i,a,!0)}function kA(){GA(function(){(Yt&6)!==0?Jv(i4,IA):mS()})}function Nb(){if(bl===0){var i=Zh;i===0&&(i=O0,O0<<=1,(O0&261888)===0&&(O0=256)),bl=i}return bl}function M3(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:eg(""+i)}function E3(i,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,i.id&&u.setAttribute("form",i.id),a.parentNode.insertBefore(u,a),i=new FormData(i),u.parentNode.removeChild(u),i}function LA(i,a,u,f,y){if(a==="submit"&&u&&u.stateNode===y){var l=M3((y[jr]||null).action),D=f.submitter;D&&(a=(a=D[jr]||null)?M3(a.formAction):D.getAttribute("formAction"),a!==null&&(l=a,D=null));var B=new Gg("action","action",null,f,y);i.push({event:B,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(bl!==0){var q=D?E3(y,D):new FormData(y);Dv(u,{pending:!0,data:q,method:y.method,action:l},null,q)}}else typeof l=="function"&&(B.preventDefault(),q=D?E3(y,D):new FormData(y),Dv(u,{pending:!0,data:q,method:y.method,action:l},l,q))},currentTarget:y}]})}}for(X0=0;X0<yv.length;X0++)Y0=yv[X0],C3=Y0.toLowerCase(),A3=Y0[0].toUpperCase()+Y0.slice(1),Ka(C3,"on"+A3);var Y0,C3,A3,X0;Ka(z4,"onAnimationEnd");Ka(D4,"onAnimationIteration");Ka(P4,"onAnimationStart");Ka("dblclick","onDoubleClick");Ka("focusin","onFocus");Ka("focusout","onBlur");Ka(J8,"onTransitionRun");Ka(eA,"onTransitionStart");Ka(tA,"onTransitionCancel");Ka(R4,"onTransitionEnd");qh("onMouseEnter",["mouseout","mouseover"]);qh("onMouseLeave",["mouseout","mouseover"]);qh("onPointerEnter",["pointerout","pointerover"]);qh("onPointerLeave",["pointerout","pointerover"]);jc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));jc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));jc("onBeforeInput",["compositionend","keypress","textInput","paste"]);jc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));jc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));jc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),OA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(vf));function yS(i,a){a=(a&4)!==0;for(var u=0;u<i.length;u++){var f=i[u],y=f.event;f=f.listeners;e:{var l=void 0;if(a)for(var D=f.length-1;0<=D;D--){var B=f[D],q=B.instance,K=B.currentTarget;if(B=B.listener,q!==l&&y.isPropagationStopped())break e;l=B,y.currentTarget=K;try{l(y)}catch(fe){vg(fe)}y.currentTarget=null,l=q}else for(D=0;D<f.length;D++){if(B=f[D],q=B.instance,K=B.currentTarget,B=B.listener,q!==l&&y.isPropagationStopped())break e;l=B,y.currentTarget=K;try{l(y)}catch(fe){vg(fe)}y.currentTarget=null,l=q}}}}function Et(i,a){var u=a[uv];u===void 0&&(u=a[uv]=new Set);var f=i+"__bubble";u.has(f)||(vS(a,i,2,!1),u.add(f))}function Qy(i,a,u){var f=0;a&&(f|=4),vS(u,i,f,a)}var W0="_reactListening"+Math.random().toString(36).slice(2);function Ub(i){if(!i[W0]){i[W0]=!0,u4.forEach(function(u){u!=="selectionchange"&&(OA.has(u)||Qy(u,!1,i),Qy(u,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[W0]||(a[W0]=!0,Qy("selectionchange",!1,a))}}function vS(i,a,u,f){switch(RS(a)){case 2:var y=uz;break;case 8:y=hz;break;default:y=Gb}u=y.bind(null,a,u,i),y=void 0,!mv||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),f?y!==void 0?i.addEventListener(a,u,{capture:!0,passive:y}):i.addEventListener(a,u,!0):y!==void 0?i.addEventListener(a,u,{passive:y}):i.addEventListener(a,u,!1)}function Jy(i,a,u,f,y){var l=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var D=f.tag;if(D===3||D===4){var B=f.stateNode.containerInfo;if(B===y)break;if(D===4)for(D=f.return;D!==null;){var q=D.tag;if((q===3||q===4)&&D.stateNode.containerInfo===y)return;D=D.return}for(;B!==null;){if(D=Mh(B),D===null)return;if(q=D.tag,q===5||q===6||q===26||q===27){f=l=D;continue e}B=B.parentNode}}f=f.return}y4(function(){var K=l,fe=rb(u),pe=[];e:{var oe=I4.get(i);if(oe!==void 0){var le=Gg,Oe=i;switch(i){case"keypress":if(ig(u)===0)break e;case"keydown":case"keyup":le=P8;break;case"focusin":Oe="focus",le=Py;break;case"focusout":Oe="blur",le=Py;break;case"beforeblur":case"afterblur":le=Py;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=L5;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=v8;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=k8;break;case z4:case D4:case P4:le=w8;break;case R4:le=O8;break;case"scroll":case"scrollend":le=_8;break;case"wheel":le=F8;break;case"copy":case"cut":case"paste":le=S8;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=B5;break;case"toggle":case"beforetoggle":le=U8}var Ue=(a&4)!==0,ye=!Ue&&(i==="scroll"||i==="scrollend"),ce=Ue?oe!==null?oe+"Capture":null:oe;Ue=[];for(var se=K,de;se!==null;){var ve=se;if(de=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||de===null||ce===null||(ve=hf(se,ce),ve!=null&&Ue.push(bf(se,ve,de))),ye)break;se=se.return}0<Ue.length&&(oe=new le(oe,Oe,null,u,fe),pe.push({event:oe,listeners:Ue}))}}if((a&7)===0){e:{if(oe=i==="mouseover"||i==="pointerover",le=i==="mouseout"||i==="pointerout",oe&&u!==fv&&(Oe=u.relatedTarget||u.fromElement)&&(Mh(Oe)||Oe[Jh]))break e;if((le||oe)&&(oe=fe.window===fe?fe:(oe=fe.ownerDocument)?oe.defaultView||oe.parentWindow:window,le?(Oe=u.relatedTarget||u.toElement,le=K,Oe=Oe?Mh(Oe):null,Oe!==null&&(ye=Sf(Oe),Ue=Oe.tag,Oe!==ye||Ue!==5&&Ue!==27&&Ue!==6)&&(Oe=null)):(le=null,Oe=K),le!==Oe)){if(Ue=L5,ve="onMouseLeave",ce="onMouseEnter",se="mouse",(i==="pointerout"||i==="pointerover")&&(Ue=B5,ve="onPointerLeave",ce="onPointerEnter",se="pointer"),ye=le==null?oe:$p(le),de=Oe==null?oe:$p(Oe),oe=new Ue(ve,se+"leave",le,u,fe),oe.target=ye,oe.relatedTarget=de,ve=null,Mh(fe)===K&&(Ue=new Ue(ce,se+"enter",Oe,u,fe),Ue.target=de,Ue.relatedTarget=ye,ve=Ue),ye=ve,le&&Oe)t:{for(Ue=BA,ce=le,se=Oe,de=0,ve=ce;ve;ve=Ue(ve))de++;ve=0;for(var Le=se;Le;Le=Ue(Le))ve++;for(;0<de-ve;)ce=Ue(ce),de--;for(;0<ve-de;)se=Ue(se),ve--;for(;de--;){if(ce===se||se!==null&&ce===se.alternate){Ue=ce;break t}ce=Ue(ce),se=Ue(se)}Ue=null}else Ue=null;le!==null&&z3(pe,oe,le,Ue,!1),Oe!==null&&ye!==null&&z3(pe,ye,Oe,Ue,!0)}}e:{if(oe=K?$p(K):window,le=oe.nodeName&&oe.nodeName.toLowerCase(),le==="select"||le==="input"&&oe.type==="file")var Re=V5;else if(U5(oe))if(S4)Re=W8;else{Re=X8;var Z=$8}else le=oe.nodeName,!le||le.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?K&&nb(K.elementType)&&(Re=V5):Re=Y8;if(Re&&(Re=Re(i,K))){T4(pe,Re,u,fe);break e}Z&&Z(i,oe,K),i==="focusout"&&K&&oe.type==="number"&&K.memoizedProps.value!=null&&pv(oe,"number",oe.value)}switch(Z=K?$p(K):window,i){case"focusin":(U5(Z)||Z.contentEditable==="true")&&(Ah=Z,gv=K,Qp=null);break;case"focusout":Qp=gv=Ah=null;break;case"mousedown":_v=!0;break;case"contextmenu":case"mouseup":case"dragend":_v=!1,Z5(pe,u,fe);break;case"selectionchange":if(Q8)break;case"keydown":case"keyup":Z5(pe,u,fe)}var Y;if(sb)e:{switch(i){case"compositionstart":var ne="onCompositionStart";break e;case"compositionend":ne="onCompositionEnd";break e;case"compositionupdate":ne="onCompositionUpdate";break e}ne=void 0}else Ch?x4(i,u)&&(ne="onCompositionEnd"):i==="keydown"&&u.keyCode===229&&(ne="onCompositionStart");ne&&(b4&&u.locale!=="ko"&&(Ch||ne!=="onCompositionStart"?ne==="onCompositionEnd"&&Ch&&(Y=v4()):(_l=fe,ab="value"in _l?_l.value:_l.textContent,Ch=!0)),Z=Og(K,ne),0<Z.length&&(ne=new O5(ne,i,null,u,fe),pe.push({event:ne,listeners:Z}),Y?ne.data=Y:(Y=w4(u),Y!==null&&(ne.data=Y)))),(Y=j8?q8(i,u):G8(i,u))&&(ne=Og(K,"onBeforeInput"),0<ne.length&&(Z=new O5("onBeforeInput","beforeinput",null,u,fe),pe.push({event:Z,listeners:ne}),Z.data=Y)),LA(pe,i,K,u,fe)}yS(pe,a)})}function bf(i,a,u){return{instance:i,listener:a,currentTarget:u}}function Og(i,a){for(var u=a+"Capture",f=[];i!==null;){var y=i,l=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||l===null||(y=hf(i,u),y!=null&&f.unshift(bf(i,y,l)),y=hf(i,a),y!=null&&f.push(bf(i,y,l))),i.tag===3)return f;i=i.return}return[]}function BA(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function z3(i,a,u,f,y){for(var l=a._reactName,D=[];u!==null&&u!==f;){var B=u,q=B.alternate,K=B.stateNode;if(B=B.tag,q!==null&&q===f)break;B!==5&&B!==26&&B!==27||K===null||(q=K,y?(K=hf(u,l),K!=null&&D.unshift(bf(u,K,q))):y||(K=hf(u,l),K!=null&&D.push(bf(u,K,q)))),u=u.return}D.length!==0&&i.push({event:a,listeners:D})}var FA=/\r\n?/g,NA=/\u0000|\uFFFD/g;function D3(i){return(typeof i=="string"?i:""+i).replace(FA,`
808
+ `).replace(NA,"")}function bS(i,a){return a=D3(a),D3(i)===a}function hi(i,a,u,f,y,l){switch(u){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||Gh(i,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&Gh(i,""+f);break;case"className":N0(i,"class",f);break;case"tabIndex":N0(i,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":N0(i,u,f);break;case"style":_4(i,f,l);break;case"data":if(a!=="object"){N0(i,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||u!=="href")){i.removeAttribute(u);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(u);break}f=eg(""+f),i.setAttribute(u,f);break;case"action":case"formAction":if(typeof f=="function"){i.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof l=="function"&&(u==="formAction"?(a!=="input"&&hi(i,a,"name",y.name,y,null),hi(i,a,"formEncType",y.formEncType,y,null),hi(i,a,"formMethod",y.formMethod,y,null),hi(i,a,"formTarget",y.formTarget,y,null)):(hi(i,a,"encType",y.encType,y,null),hi(i,a,"method",y.method,y,null),hi(i,a,"target",y.target,y,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(u);break}f=eg(""+f),i.setAttribute(u,f);break;case"onClick":f!=null&&(i.onclick=gs);break;case"onScroll":f!=null&&Et("scroll",i);break;case"onScrollEnd":f!=null&&Et("scrollend",i);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(ke(61));if(u=f.__html,u!=null){if(y.children!=null)throw Error(ke(60));i.innerHTML=u}}break;case"multiple":i.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":i.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){i.removeAttribute("xlink:href");break}u=eg(""+f),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(u,""+f):i.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(u,""):i.removeAttribute(u);break;case"capture":case"download":f===!0?i.setAttribute(u,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(u,f):i.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?i.setAttribute(u,f):i.removeAttribute(u);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?i.removeAttribute(u):i.setAttribute(u,f);break;case"popover":Et("beforetoggle",i),Et("toggle",i),J0(i,"popover",f);break;case"xlinkActuate":ls(i,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":ls(i,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":ls(i,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":ls(i,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":ls(i,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":ls(i,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":ls(i,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":ls(i,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":ls(i,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":J0(i,"is",f);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=m8.get(u)||u,J0(i,u,f))}}function Vv(i,a,u,f,y,l){switch(u){case"style":_4(i,f,l);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(ke(61));if(u=f.__html,u!=null){if(y.children!=null)throw Error(ke(60));i.innerHTML=u}}break;case"children":typeof f=="string"?Gh(i,f):(typeof f=="number"||typeof f=="bigint")&&Gh(i,""+f);break;case"onScroll":f!=null&&Et("scroll",i);break;case"onScrollEnd":f!=null&&Et("scrollend",i);break;case"onClick":f!=null&&(i.onclick=gs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!h4.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),a=u.slice(2,y?u.length-7:void 0),l=i[jr]||null,l=l!=null?l[u]:null,typeof l=="function"&&i.removeEventListener(a,l,y),typeof f=="function")){typeof l!="function"&&l!==null&&(u in i?i[u]=null:i.hasAttribute(u)&&i.removeAttribute(u)),i.addEventListener(a,f,y);break e}u in i?i[u]=f:f===!0?i.setAttribute(u,""):J0(i,u,f)}}}function or(i,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Et("error",i),Et("load",i);var f=!1,y=!1,l;for(l in u)if(u.hasOwnProperty(l)){var D=u[l];if(D!=null)switch(l){case"src":f=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(ke(137,a));default:hi(i,a,l,D,u,null)}}y&&hi(i,a,"srcSet",u.srcSet,u,null),f&&hi(i,a,"src",u.src,u,null);return;case"input":Et("invalid",i);var B=l=D=y=null,q=null,K=null;for(f in u)if(u.hasOwnProperty(f)){var fe=u[f];if(fe!=null)switch(f){case"name":y=fe;break;case"type":D=fe;break;case"checked":q=fe;break;case"defaultChecked":K=fe;break;case"value":l=fe;break;case"defaultValue":B=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(ke(137,a));break;default:hi(i,a,f,fe,u,null)}}f4(i,l,B,q,K,D,y,!1);return;case"select":Et("invalid",i),f=D=l=null;for(y in u)if(u.hasOwnProperty(y)&&(B=u[y],B!=null))switch(y){case"value":l=B;break;case"defaultValue":D=B;break;case"multiple":f=B;default:hi(i,a,y,B,u,null)}a=l,u=D,i.multiple=!!f,a!=null?Oh(i,!!f,a,!1):u!=null&&Oh(i,!!f,u,!0);return;case"textarea":Et("invalid",i),l=y=f=null;for(D in u)if(u.hasOwnProperty(D)&&(B=u[D],B!=null))switch(D){case"value":f=B;break;case"defaultValue":y=B;break;case"children":l=B;break;case"dangerouslySetInnerHTML":if(B!=null)throw Error(ke(91));break;default:hi(i,a,D,B,u,null)}g4(i,f,y,l);return;case"option":for(q in u)u.hasOwnProperty(q)&&(f=u[q],f!=null)&&(q==="selected"?i.selected=f&&typeof f!="function"&&typeof f!="symbol":hi(i,a,q,f,u,null));return;case"dialog":Et("beforetoggle",i),Et("toggle",i),Et("cancel",i),Et("close",i);break;case"iframe":case"object":Et("load",i);break;case"video":case"audio":for(f=0;f<vf.length;f++)Et(vf[f],i);break;case"image":Et("error",i),Et("load",i);break;case"details":Et("toggle",i);break;case"embed":case"source":case"link":Et("error",i),Et("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in u)if(u.hasOwnProperty(K)&&(f=u[K],f!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(ke(137,a));default:hi(i,a,K,f,u,null)}return;default:if(nb(a)){for(fe in u)u.hasOwnProperty(fe)&&(f=u[fe],f!==void 0&&Vv(i,a,fe,f,u,void 0));return}}for(B in u)u.hasOwnProperty(B)&&(f=u[B],f!=null&&hi(i,a,B,f,u,null))}function UA(i,a,u,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,l=null,D=null,B=null,q=null,K=null,fe=null;for(le in u){var pe=u[le];if(u.hasOwnProperty(le)&&pe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":q=pe;default:f.hasOwnProperty(le)||hi(i,a,le,null,f,pe)}}for(var oe in f){var le=f[oe];if(pe=u[oe],f.hasOwnProperty(oe)&&(le!=null||pe!=null))switch(oe){case"type":l=le;break;case"name":y=le;break;case"checked":K=le;break;case"defaultChecked":fe=le;break;case"value":D=le;break;case"defaultValue":B=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(ke(137,a));break;default:le!==pe&&hi(i,a,oe,le,f,pe)}}dv(i,D,B,q,K,fe,l,y);return;case"select":le=D=B=oe=null;for(l in u)if(q=u[l],u.hasOwnProperty(l)&&q!=null)switch(l){case"value":break;case"multiple":le=q;default:f.hasOwnProperty(l)||hi(i,a,l,null,f,q)}for(y in f)if(l=f[y],q=u[y],f.hasOwnProperty(y)&&(l!=null||q!=null))switch(y){case"value":oe=l;break;case"defaultValue":B=l;break;case"multiple":D=l;default:l!==q&&hi(i,a,y,l,f,q)}a=B,u=D,f=le,oe!=null?Oh(i,!!u,oe,!1):!!f!=!!u&&(a!=null?Oh(i,!!u,a,!0):Oh(i,!!u,u?[]:"",!1));return;case"textarea":le=oe=null;for(B in u)if(y=u[B],u.hasOwnProperty(B)&&y!=null&&!f.hasOwnProperty(B))switch(B){case"value":break;case"children":break;default:hi(i,a,B,null,f,y)}for(D in f)if(y=f[D],l=u[D],f.hasOwnProperty(D)&&(y!=null||l!=null))switch(D){case"value":oe=y;break;case"defaultValue":le=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(ke(91));break;default:y!==l&&hi(i,a,D,y,f,l)}m4(i,oe,le);return;case"option":for(var Oe in u)oe=u[Oe],u.hasOwnProperty(Oe)&&oe!=null&&!f.hasOwnProperty(Oe)&&(Oe==="selected"?i.selected=!1:hi(i,a,Oe,null,f,oe));for(q in f)oe=f[q],le=u[q],f.hasOwnProperty(q)&&oe!==le&&(oe!=null||le!=null)&&(q==="selected"?i.selected=oe&&typeof oe!="function"&&typeof oe!="symbol":hi(i,a,q,oe,f,le));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ue in u)oe=u[Ue],u.hasOwnProperty(Ue)&&oe!=null&&!f.hasOwnProperty(Ue)&&hi(i,a,Ue,null,f,oe);for(K in f)if(oe=f[K],le=u[K],f.hasOwnProperty(K)&&oe!==le&&(oe!=null||le!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(ke(137,a));break;default:hi(i,a,K,oe,f,le)}return;default:if(nb(a)){for(var ye in u)oe=u[ye],u.hasOwnProperty(ye)&&oe!==void 0&&!f.hasOwnProperty(ye)&&Vv(i,a,ye,void 0,f,oe);for(fe in f)oe=f[fe],le=u[fe],!f.hasOwnProperty(fe)||oe===le||oe===void 0&&le===void 0||Vv(i,a,fe,oe,f,le);return}}for(var ce in u)oe=u[ce],u.hasOwnProperty(ce)&&oe!=null&&!f.hasOwnProperty(ce)&&hi(i,a,ce,null,f,oe);for(pe in f)oe=f[pe],le=u[pe],!f.hasOwnProperty(pe)||oe===le||oe==null&&le==null||hi(i,a,pe,oe,f,le)}function P3(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function VA(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,u=performance.getEntriesByType("resource"),f=0;f<u.length;f++){var y=u[f],l=y.transferSize,D=y.initiatorType,B=y.duration;if(l&&B&&P3(D)){for(D=0,B=y.responseEnd,f+=1;f<u.length;f++){var q=u[f],K=q.startTime;if(K>B)break;var fe=q.transferSize,pe=q.initiatorType;fe&&P3(pe)&&(q=q.responseEnd,D+=fe*(q<B?1:(B-K)/(q-K)))}if(--f,a+=8*(l+D)/(y.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var jv=null,qv=null;function Bg(i){return i.nodeType===9?i:i.ownerDocument}function R3(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function xS(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function Gv(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var ev=null;function jA(){var i=window.event;return i&&i.type==="popstate"?i===ev?!1:(ev=i,!0):(ev=null,!1)}var wS=typeof setTimeout=="function"?setTimeout:void 0,qA=typeof clearTimeout=="function"?clearTimeout:void 0,I3=typeof Promise=="function"?Promise:void 0,GA=typeof queueMicrotask=="function"?queueMicrotask:typeof I3<"u"?function(i){return I3.resolve(null).then(i).catch(ZA)}:wS;function ZA(i){setTimeout(function(){throw i})}function Ll(i){return i==="head"}function k3(i,a){var u=a,f=0;do{var y=u.nextSibling;if(i.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(f===0){i.removeChild(y),Qh(a);return}f--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")f++;else if(u==="html")cf(i.ownerDocument.documentElement);else if(u==="head"){u=i.ownerDocument.head,cf(u);for(var l=u.firstChild;l;){var D=l.nextSibling,B=l.nodeName;l[Af]||B==="SCRIPT"||B==="STYLE"||B==="LINK"&&l.rel.toLowerCase()==="stylesheet"||u.removeChild(l),l=D}}else u==="body"&&cf(i.ownerDocument.body);u=y}while(u);Qh(a)}function L3(i,a){var u=i;i=0;do{var f=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),f&&f.nodeType===8)if(u=f.data,u==="/$"){if(i===0)break;i--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||i++;u=f}while(u)}function Zv(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Zv(u),ib(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}i.removeChild(u)}}function HA(i,a,u,f){for(;i.nodeType===1;){var y=u;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(f){if(!i[Af])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(l=i.getAttribute("rel"),l==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(l!==y.rel||i.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||i.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||i.getAttribute("title")!==(y.title==null?null:y.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(l=i.getAttribute("src"),(l!==(y.src==null?null:y.src)||i.getAttribute("type")!==(y.type==null?null:y.type)||i.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&l&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var l=y.name==null?null:""+y.name;if(y.type==="hidden"&&i.getAttribute("name")===l)return i}else return i;if(i=Da(i.nextSibling),i===null)break}return null}function $A(i,a,u){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!u||(i=Da(i.nextSibling),i===null))return null;return i}function TS(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Da(i.nextSibling),i===null))return null;return i}function Hv(i){return i.data==="$?"||i.data==="$~"}function $v(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function XA(i,a){var u=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||u.readyState!=="loading")a();else{var f=function(){a(),u.removeEventListener("DOMContentLoaded",f)};u.addEventListener("DOMContentLoaded",f),i._reactRetry=f}}function Da(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return i}var Xv=null;function O3(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var u=i.data;if(u==="/$"||u==="/&"){if(a===0)return Da(i.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}i=i.nextSibling}return null}function B3(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var u=i.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return i;a--}else u!=="/$"&&u!=="/&"||a++}i=i.previousSibling}return null}function SS(i,a,u){switch(a=Bg(u),i){case"html":if(i=a.documentElement,!i)throw Error(ke(452));return i;case"head":if(i=a.head,!i)throw Error(ke(453));return i;case"body":if(i=a.body,!i)throw Error(ke(454));return i;default:throw Error(ke(451))}}function cf(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);ib(i)}var Pa=new Map,F3=new Set;function Fg(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Es=Wt.d;Wt.d={f:YA,r:WA,D:KA,C:QA,L:JA,m:ez,X:iz,S:tz,M:nz};function YA(){var i=Es.f(),a=t1();return i||a}function WA(i){var a=ed(i);a!==null&&a.tag===5&&a.type==="form"?_T(a):Es.r(i)}var rd=typeof document>"u"?null:document;function MS(i,a,u){var f=rd;if(f&&typeof a=="string"&&a){var y=Ea(a);y='link[rel="'+i+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),F3.has(y)||(F3.add(y),i={rel:i,crossOrigin:u,href:a},f.querySelector(y)===null&&(a=f.createElement("link"),or(a,"link",i),jn(a),f.head.appendChild(a)))}}function KA(i){Es.D(i),MS("dns-prefetch",i,null)}function QA(i,a){Es.C(i,a),MS("preconnect",i,a)}function JA(i,a,u){Es.L(i,a,u);var f=rd;if(f&&i&&a){var y='link[rel="preload"][as="'+Ea(a)+'"]';a==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+Ea(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+Ea(u.imageSizes)+'"]')):y+='[href="'+Ea(i)+'"]';var l=y;switch(a){case"style":l=Kh(i);break;case"script":l=ad(i)}Pa.has(l)||(i=Ri({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:i,as:a},u),Pa.set(l,i),f.querySelector(y)!==null||a==="style"&&f.querySelector(kf(l))||a==="script"&&f.querySelector(Lf(l))||(a=f.createElement("link"),or(a,"link",i),jn(a),f.head.appendChild(a)))}}function ez(i,a){Es.m(i,a);var u=rd;if(u&&i){var f=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+Ea(f)+'"][href="'+Ea(i)+'"]',l=y;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=ad(i)}if(!Pa.has(l)&&(i=Ri({rel:"modulepreload",href:i},a),Pa.set(l,i),u.querySelector(y)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Lf(l)))return}f=u.createElement("link"),or(f,"link",i),jn(f),u.head.appendChild(f)}}}function tz(i,a,u){Es.S(i,a,u);var f=rd;if(f&&i){var y=Lh(f).hoistableStyles,l=Kh(i);a=a||"default";var D=y.get(l);if(!D){var B={loading:0,preload:null};if(D=f.querySelector(kf(l)))B.loading=5;else{i=Ri({rel:"stylesheet",href:i,"data-precedence":a},u),(u=Pa.get(l))&&Vb(i,u);var q=D=f.createElement("link");jn(q),or(q,"link",i),q._p=new Promise(function(K,fe){q.onload=K,q.onerror=fe}),q.addEventListener("load",function(){B.loading|=1}),q.addEventListener("error",function(){B.loading|=2}),B.loading|=4,ug(D,a,f)}D={type:"stylesheet",instance:D,count:1,state:B},y.set(l,D)}}}function iz(i,a){Es.X(i,a);var u=rd;if(u&&i){var f=Lh(u).hoistableScripts,y=ad(i),l=f.get(y);l||(l=u.querySelector(Lf(y)),l||(i=Ri({src:i,async:!0},a),(a=Pa.get(y))&&jb(i,a),l=u.createElement("script"),jn(l),or(l,"link",i),u.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},f.set(y,l))}}function nz(i,a){Es.M(i,a);var u=rd;if(u&&i){var f=Lh(u).hoistableScripts,y=ad(i),l=f.get(y);l||(l=u.querySelector(Lf(y)),l||(i=Ri({src:i,async:!0,type:"module"},a),(a=Pa.get(y))&&jb(i,a),l=u.createElement("script"),jn(l),or(l,"link",i),u.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},f.set(y,l))}}function N3(i,a,u,f){var y=(y=xl.current)?Fg(y):null;if(!y)throw Error(ke(446));switch(i){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=Kh(u.href),u=Lh(y).hoistableStyles,f=u.get(a),f||(f={type:"style",instance:null,count:0,state:null},u.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){i=Kh(u.href);var l=Lh(y).hoistableStyles,D=l.get(i);if(D||(y=y.ownerDocument||y,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},l.set(i,D),(l=y.querySelector(kf(i)))&&!l._p&&(D.instance=l,D.state.loading=5),Pa.has(i)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Pa.set(i,u),l||rz(y,i,u,D.state))),a&&f===null)throw Error(ke(528,""));return D}if(a&&f!==null)throw Error(ke(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ad(u),u=Lh(y).hoistableScripts,f=u.get(a),f||(f={type:"script",instance:null,count:0,state:null},u.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(ke(444,i))}}function Kh(i){return'href="'+Ea(i)+'"'}function kf(i){return'link[rel="stylesheet"]['+i+"]"}function ES(i){return Ri({},i,{"data-precedence":i.precedence,precedence:null})}function rz(i,a,u,f){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=i.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),or(a,"link",u),jn(a),i.head.appendChild(a))}function ad(i){return'[src="'+Ea(i)+'"]'}function Lf(i){return"script[async]"+i}function U3(i,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var f=i.querySelector('style[data-href~="'+Ea(u.href)+'"]');if(f)return a.instance=f,jn(f),f;var y=Ri({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return f=(i.ownerDocument||i).createElement("style"),jn(f),or(f,"style",y),ug(f,u.precedence,i),a.instance=f;case"stylesheet":y=Kh(u.href);var l=i.querySelector(kf(y));if(l)return a.state.loading|=4,a.instance=l,jn(l),l;f=ES(u),(y=Pa.get(y))&&Vb(f,y),l=(i.ownerDocument||i).createElement("link"),jn(l);var D=l;return D._p=new Promise(function(B,q){D.onload=B,D.onerror=q}),or(l,"link",f),a.state.loading|=4,ug(l,u.precedence,i),a.instance=l;case"script":return l=ad(u.src),(y=i.querySelector(Lf(l)))?(a.instance=y,jn(y),y):(f=u,(y=Pa.get(l))&&(f=Ri({},u),jb(f,y)),i=i.ownerDocument||i,y=i.createElement("script"),jn(y),or(y,"link",f),i.head.appendChild(y),a.instance=y);case"void":return null;default:throw Error(ke(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,ug(f,u.precedence,i));return a.instance}function ug(i,a,u){for(var f=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=f.length?f[f.length-1]:null,l=y,D=0;D<f.length;D++){var B=f[D];if(B.dataset.precedence===a)l=B;else if(l!==y)break}l?l.parentNode.insertBefore(i,l.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(i,a.firstChild))}function Vb(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function jb(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var hg=null;function V3(i,a,u){if(hg===null){var f=new Map,y=hg=new Map;y.set(u,f)}else y=hg,f=y.get(u),f||(f=new Map,y.set(u,f));if(f.has(i))return f;for(f.set(i,null),u=u.getElementsByTagName(i),y=0;y<u.length;y++){var l=u[y];if(!(l[Af]||l[nr]||i==="link"&&l.getAttribute("rel")==="stylesheet")&&l.namespaceURI!=="http://www.w3.org/2000/svg"){var D=l.getAttribute(a)||"";D=i+D;var B=f.get(D);B?B.push(l):f.set(D,[l])}}return f}function j3(i,a,u){i=i.ownerDocument||i,i.head.insertBefore(u,a==="title"?i.querySelector("head > title"):null)}function az(i,a,u){if(u===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(i=a.disabled,typeof a.precedence=="string"&&i==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function CS(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function oz(i,a,u,f){if(u.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Kh(f.href),l=a.querySelector(kf(y));if(l){a=l._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=Ng.bind(i),a.then(i,i)),u.state.loading|=4,u.instance=l,jn(l);return}l=a.ownerDocument||a,f=ES(f),(y=Pa.get(y))&&Vb(f,y),l=l.createElement("link"),jn(l);var D=l;D._p=new Promise(function(B,q){D.onload=B,D.onerror=q}),or(l,"link",f),u.instance=l}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(i.count++,u=Ng.bind(i),a.addEventListener("load",u),a.addEventListener("error",u))}}var tv=0;function sz(i,a){return i.stylesheets&&i.count===0&&dg(i,i.stylesheets),0<i.count||0<i.imgCount?function(u){var f=setTimeout(function(){if(i.stylesheets&&dg(i,i.stylesheets),i.unsuspend){var l=i.unsuspend;i.unsuspend=null,l()}},6e4+a);0<i.imgBytes&&tv===0&&(tv=62500*VA());var y=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&dg(i,i.stylesheets),i.unsuspend)){var l=i.unsuspend;i.unsuspend=null,l()}},(i.imgBytes>tv?50:800)+a);return i.unsuspend=u,function(){i.unsuspend=null,clearTimeout(f),clearTimeout(y)}}:null}function Ng(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dg(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Ug=null;function dg(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Ug=new Map,a.forEach(lz,i),Ug=null,Ng.call(i))}function lz(i,a){if(!(a.state.loading&4)){var u=Ug.get(i);if(u)var f=u.get(null);else{u=new Map,Ug.set(i,u);for(var y=i.querySelectorAll("link[data-precedence],style[data-precedence]"),l=0;l<y.length;l++){var D=y[l];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(u.set(D.dataset.precedence,D),f=D)}f&&u.set(null,f)}y=a.instance,D=y.getAttribute("data-precedence"),l=u.get(D)||f,l===f&&u.set(null,y),u.set(D,y),this.count++,f=Ng.bind(this),y.addEventListener("load",f),y.addEventListener("error",f),l?l.parentNode.insertBefore(y,l.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(y,i.firstChild)),a.state.loading|=4}}var xf={$$typeof:ms,Provider:null,Consumer:null,_currentValue:Rc,_currentValue2:Rc,_threadCount:0};function cz(i,a,u,f,y,l,D,B,q){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Cy(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cy(0),this.hiddenUpdates=Cy(null),this.identifierPrefix=f,this.onUncaughtError=y,this.onCaughtError=l,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function AS(i,a,u,f,y,l,D,B,q,K,fe,pe){return i=new cz(i,a,u,D,q,K,fe,pe,B),a=1,l===!0&&(a|=24),l=na(3,null,null,a),i.current=l,l.stateNode=i,a=fb(),a.refCount++,i.pooledCache=a,a.refCount++,l.memoizedState={element:f,isDehydrated:u,cache:a},_b(l),i}function zS(i){return i?(i=Ph,i):Ph}function DS(i,a,u,f,y,l){y=zS(y),f.context===null?f.context=y:f.pendingContext=y,f=Tl(a),f.payload={element:u},l=l===void 0?null:l,l!==null&&(f.callback=l),u=Sl(i,f,a),u!==null&&(Vr(u,i,a),ef(u,i,a))}function q3(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var u=i.retryLane;i.retryLane=u!==0&&u<a?u:a}}function qb(i,a){q3(i,a),(i=i.alternate)&&q3(i,a)}function PS(i){if(i.tag===13||i.tag===31){var a=Zc(i,67108864);a!==null&&Vr(a,i,67108864),qb(i,67108864)}}function G3(i){if(i.tag===13||i.tag===31){var a=la();a=eb(a);var u=Zc(i,a);u!==null&&Vr(u,i,a),qb(i,a)}}var Vg=!0;function uz(i,a,u,f){var y=ut.T;ut.T=null;var l=Wt.p;try{Wt.p=2,Gb(i,a,u,f)}finally{Wt.p=l,ut.T=y}}function hz(i,a,u,f){var y=ut.T;ut.T=null;var l=Wt.p;try{Wt.p=8,Gb(i,a,u,f)}finally{Wt.p=l,ut.T=y}}function Gb(i,a,u,f){if(Vg){var y=Yv(f);if(y===null)Jy(i,a,f,jg,u),Z3(i,f);else if(pz(y,i,a,u,f))f.stopPropagation();else if(Z3(i,f),a&4&&-1<dz.indexOf(i)){for(;y!==null;){var l=ed(y);if(l!==null)switch(l.tag){case 3:if(l=l.stateNode,l.current.memoizedState.isDehydrated){var D=zc(l.pendingLanes);if(D!==0){var B=l;for(B.pendingLanes|=2,B.entangledLanes|=2;D;){var q=1<<31-sa(D);B.entanglements[1]|=q,D&=~q}Co(l),(Yt&6)===0&&(Pg=aa()+500,If(0,!1))}}break;case 31:case 13:B=Zc(l,2),B!==null&&Vr(B,l,2),t1(),qb(l,2)}if(l=Yv(f),l===null&&Jy(i,a,f,jg,u),l===y)break;y=l}y!==null&&f.stopPropagation()}else Jy(i,a,f,null,u)}}function Yv(i){return i=rb(i),Zb(i)}var jg=null;function Zb(i){if(jg=null,i=Mh(i),i!==null){var a=Sf(i);if(a===null)i=null;else{var u=a.tag;if(u===13){if(i=K3(a),i!==null)return i;i=null}else if(u===31){if(i=Q3(a),i!==null)return i;i=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return jg=i,null}function RS(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(JC()){case i4:return 2;case n4:return 8;case _g:case e8:return 32;case r4:return 268435456;default:return 32}default:return 32}}var Wv=!1,Cl=null,Al=null,zl=null,wf=new Map,Tf=new Map,ml=[],dz="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Z3(i,a){switch(i){case"focusin":case"focusout":Cl=null;break;case"dragenter":case"dragleave":Al=null;break;case"mouseover":case"mouseout":zl=null;break;case"pointerover":case"pointerout":wf.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tf.delete(a.pointerId)}}function qp(i,a,u,f,y,l){return i===null||i.nativeEvent!==l?(i={blockedOn:a,domEventName:u,eventSystemFlags:f,nativeEvent:l,targetContainers:[y]},a!==null&&(a=ed(a),a!==null&&PS(a)),i):(i.eventSystemFlags|=f,a=i.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),i)}function pz(i,a,u,f,y){switch(a){case"focusin":return Cl=qp(Cl,i,a,u,f,y),!0;case"dragenter":return Al=qp(Al,i,a,u,f,y),!0;case"mouseover":return zl=qp(zl,i,a,u,f,y),!0;case"pointerover":var l=y.pointerId;return wf.set(l,qp(wf.get(l)||null,i,a,u,f,y)),!0;case"gotpointercapture":return l=y.pointerId,Tf.set(l,qp(Tf.get(l)||null,i,a,u,f,y)),!0}return!1}function IS(i){var a=Mh(i.target);if(a!==null){var u=Sf(a);if(u!==null){if(a=u.tag,a===13){if(a=K3(u),a!==null){i.blockedOn=a,A5(i.priority,function(){G3(u)});return}}else if(a===31){if(a=Q3(u),a!==null){i.blockedOn=a,A5(i.priority,function(){G3(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){i.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}i.blockedOn=null}function pg(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var u=Yv(i.nativeEvent);if(u===null){u=i.nativeEvent;var f=new u.constructor(u.type,u);fv=f,u.target.dispatchEvent(f),fv=null}else return a=ed(u),a!==null&&PS(a),i.blockedOn=u,!1;a.shift()}return!0}function H3(i,a,u){pg(i)&&u.delete(a)}function fz(){Wv=!1,Cl!==null&&pg(Cl)&&(Cl=null),Al!==null&&pg(Al)&&(Al=null),zl!==null&&pg(zl)&&(zl=null),wf.forEach(H3),Tf.forEach(H3)}function K0(i,a){i.blockedOn===a&&(i.blockedOn=null,Wv||(Wv=!0,zn.unstable_scheduleCallback(zn.unstable_NormalPriority,fz)))}var Q0=null;function $3(i){Q0!==i&&(Q0=i,zn.unstable_scheduleCallback(zn.unstable_NormalPriority,function(){Q0===i&&(Q0=null);for(var a=0;a<i.length;a+=3){var u=i[a],f=i[a+1],y=i[a+2];if(typeof f!="function"){if(Zb(f||u)===null)continue;break}var l=ed(u);l!==null&&(i.splice(a,3),a-=3,Dv(l,{pending:!0,data:y,method:u.method,action:f},f,y))}}))}function Qh(i){function a(q){return K0(q,i)}Cl!==null&&K0(Cl,i),Al!==null&&K0(Al,i),zl!==null&&K0(zl,i),wf.forEach(a),Tf.forEach(a);for(var u=0;u<ml.length;u++){var f=ml[u];f.blockedOn===i&&(f.blockedOn=null)}for(;0<ml.length&&(u=ml[0],u.blockedOn===null);)IS(u),u.blockedOn===null&&ml.shift();if(u=(i.ownerDocument||i).$$reactFormReplay,u!=null)for(f=0;f<u.length;f+=3){var y=u[f],l=u[f+1],D=y[jr]||null;if(typeof l=="function")D||$3(u);else if(D){var B=null;if(l&&l.hasAttribute("formAction")){if(y=l,D=l[jr]||null)B=D.formAction;else if(Zb(y)!==null)continue}else B=D.action;typeof B=="function"?u[f+1]=B:(u.splice(f,3),f-=3),$3(u)}}}function kS(){function i(l){l.canIntercept&&l.info==="react-transition"&&l.intercept({handler:function(){return new Promise(function(D){return y=D})},focusReset:"manual",scroll:"manual"})}function a(){y!==null&&(y(),y=null),f||setTimeout(u,20)}function u(){if(!f&&!navigation.transition){var l=navigation.currentEntry;l&&l.url!=null&&navigation.navigate(l.url,{state:l.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,y=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){f=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function Hb(i){this._internalRoot=i}r1.prototype.render=Hb.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(ke(409));var u=a.current,f=la();DS(u,f,i,a,null,null)};r1.prototype.unmount=Hb.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;DS(i.current,2,null,i,null,null),t1(),a[Jh]=null}};function r1(i){this._internalRoot=i}r1.prototype.unstable_scheduleHydration=function(i){if(i){var a=c4();i={blockedOn:null,target:i,priority:a};for(var u=0;u<ml.length&&a!==0&&a<ml[u].priority;u++);ml.splice(u,0,i),u===0&&IS(i)}};var X3=Y3.version;if(X3!=="19.2.7")throw Error(ke(527,X3,"19.2.7"));Wt.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(ke(188)):(i=Object.keys(i).join(","),Error(ke(268,i)));return i=HC(a),i=i!==null?J3(i):null,i=i===null?null:i.stateNode,i};var mz={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:ut,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Gp=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Gp.isDisabled&&Gp.supportsFiber))try{Mf=Gp.inject(mz),oa=Gp}catch{}var Gp;a1.createRoot=function(i,a){if(!W3(i))throw Error(ke(299));var u=!1,f="",y=MT,l=ET,D=CT;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(l=a.onCaughtError),a.onRecoverableError!==void 0&&(D=a.onRecoverableError)),a=AS(i,1,!1,null,null,u,f,null,y,l,D,kS),i[Jh]=a.current,Ub(i),new Hb(a)};a1.hydrateRoot=function(i,a,u){if(!W3(i))throw Error(ke(299));var f=!1,y="",l=MT,D=ET,B=CT,q=null;return u!=null&&(u.unstable_strictMode===!0&&(f=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(l=u.onUncaughtError),u.onCaughtError!==void 0&&(D=u.onCaughtError),u.onRecoverableError!==void 0&&(B=u.onRecoverableError),u.formState!==void 0&&(q=u.formState)),a=AS(i,1,!0,a,u??null,f,y,q,l,D,B,kS),a.context=zS(null),u=a.current,f=la(),f=eb(f),y=Tl(f),y.callback=null,Sl(u,y,f),u=f,a.current.lanes=u,Cf(a,u),Co(a),i[Jh]=a.current,Ub(i),new r1(a)};a1.version="19.2.7"});var FS=Ha((VP,BS)=>{"use strict";function OS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(OS)}catch(i){console.error(i)}}OS(),BS.exports=LS()});var Sz={};VE(Sz,{BridgeMocker:()=>Yb,DebugConsole:()=>Wb,GeolocationEvent:()=>zp,GlobalEvent:()=>qw,Map:()=>fy,MapControls:()=>K_,MapControlsContext:()=>_o,MapMenu:()=>Ap,MapMenuDivider:()=>y0,MapMenuFooter:()=>v0,MapMenuItem:()=>g0,MapMenuTitle:()=>_0,MiniAppSDK:()=>Bf,RouteLayer:()=>dy,SDKMapProvider:()=>W_,SDKProvider:()=>vz,UIEvent:()=>jw,default:()=>Tz,handleClearRoute:()=>wz,handleDrawRoute:()=>xz,handleRouteRequest:()=>bz,renderMap:()=>$b,sdk:()=>Xi,useIsMocked:()=>yz,useLiveRouting:()=>J_,useMapControls:()=>sC,useRoute:()=>lC,useTrimmedRoute:()=>ey,useUserLocation:()=>Dp});var Cp=class{callbacks=new Map;eventListeners=new Map;constructor(){if(typeof window<"u"){let a=Object.freeze({onNativeMessage:u=>this.handleNativeMessage(u)});typeof window.__MiniAppBridge>"u"&&Object.defineProperty(window,"__MiniAppBridge",{configurable:!0,value:a,writable:!1}),window.addEventListener("message",u=>{if(u.data)try{let f=typeof u.data=="string"?JSON.parse(u.data):u.data;f&&typeof f=="object"&&(f.callbackId||f.event||f.eventName)&&this.handleNativeMessage(f)}catch{}})}}on(a,u){let f=this.eventListeners.get(a);return f||(f=[],this.eventListeners.set(a,f)),f.push(u),()=>this.off(a,u)}off(a,u){let f=this.eventListeners.get(a);f&&this.eventListeners.set(a,f.filter(y=>y!==u))}send(a,u,f=3e4){return this.isNative()?new Promise((y,l)=>{let D=`${a}_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,B=setTimeout(()=>{this.callbacks.has(D)&&(this.callbacks.delete(D),l(new Error(`Bridge request timeout: ${a}`)))},f);this.callbacks.set(D,{reject:l,resolve:y,timeout:B});let q={callbackId:D,payload:u,type:a},K=window;K.ReactNativeWebView?.postMessage?K.ReactNativeWebView.postMessage(JSON.stringify(q)):(clearTimeout(B),this.callbacks.delete(D),l(new Error("Bridge not available")))}):this.handleMockMessage(a,u)}handleNativeMessage(a){if(!a||typeof a!="object")return;let u=a.callbackId;if(u&&typeof u=="string"){let y=this.callbacks.get(u);if(y){clearTimeout(y.timeout);let{resolve:l,reject:D}=y;a.success===!1||a.error?D(a.error||"Unknown error"):l(a.value??a.payload??a),this.callbacks.delete(u);return}}let f=a.eventName||a.event;if(f&&(a.type==="EVENT"||!a.type||a.event)){let y=this.eventListeners.get(f);if(y)for(let l of y)try{l(a.payload||a.value)}catch(D){console.error(`Error in event listener for ${f}:`,D)}}}handleMockMessage(a,u){return console.warn(`[Bridge] Mock mode active: Unhandled message type ${a}`),Promise.resolve()}isNative(){return typeof window>"u"?!1:window.__UP_REACT_NATIVE_APP__===!0||!!window.ReactNativeWebView}};var en=tt(Rt(),1),It=tt(ni(),1),dh=(i,a)=>typeof i=="number"?i:i.endsWith("%")?parseFloat(i)/100*a:parseFloat(i),Ow=(0,en.forwardRef)(({menuItems:i,state:a,onChangeState:u,side:f,etaBarHeight:y=0,etaData:l,touchStartY:D,setTouchStartY:B,currentTouchY:q,setCurrentTouchY:K,isDragging:fe,clampedDragOffset:pe,drawerPeekHeight:oe,drawerFullHeight:le,containerHeight:Oe,menuContent:Ue,enableTouchDrag:ye=!1,showScrollToTopButton:ce=!0,scrollToTopThreshold:se=300,safeAreaInsets:de={bottom:0,left:0,right:0,top:0}},ve)=>{let Le=(0,en.useRef)(null),Re=(0,en.useRef)(null);(0,en.useImperativeHandle)(ve,()=>Le.current);let Z=()=>{u(f==="left"?a==="closed"?"full":"closed":a==="closed"?"peek":a==="peek"?"full":"peek")},[Y,ne]=(0,en.useState)(!1),xe=ot=>{let qt=ot.currentTarget.scrollTop;ne(a!=="closed"&&qt>se)};(0,en.useEffect)(()=>{if(a==="closed")ne(!1);else{let ot=Le.current?.scrollTop||0;ne(ot>se)}},[a,se]);let De=(0,en.useRef)(!1),nt=(0,en.useRef)(!1),ze=(0,en.useRef)(!1),Be=(0,en.useRef)(a),He=(0,en.useRef)(D),We=(0,en.useRef)(q);(0,en.useEffect)(()=>{Be.current=a},[a]),(0,en.useEffect)(()=>{He.current=D},[D]),(0,en.useEffect)(()=>{We.current=q},[q]),(0,en.useEffect)(()=>{let ot=Re.current;if(!ot||f!=="bottom"||!ye)return;let qt=sn=>{let li=sn.targetTouches[0].clientY;B(li),K(li),De.current=!1,nt.current=!1;let Ii=sn.target;ze.current=Le.current?Le.current.contains(Ii):!1},vn=sn=>{let li=He.current;if(li===null)return;let Ii=sn.targetTouches[0].clientY,Xe=li-Ii,ft=Le.current?Le.current.scrollTop:0,Gt=Le.current?Le.current.clientHeight:0,ci=Le.current?Le.current.scrollHeight:0,zt=ft+Gt>=ci-1,Nt=Be.current;if(!nt.current)ze.current?Nt!=="full"?Xe>0&&zt||Xe<0&&ft<=0?(De.current=!0,nt.current=!0):(De.current=!1,nt.current=!0):Xe<0&&ft<=0?(De.current=!0,nt.current=!0):(De.current=!1,nt.current=!0):(De.current=!0,nt.current=!0);else if(!De.current&&ze.current){if(Xe<0&&ft<=0){De.current=!0,B(Ii);return}if(Xe>0&&zt&&Nt!=="full"){De.current=!0,B(Ii);return}}if(De.current){sn.cancelable&&sn.preventDefault();let ki=ot.parentElement;if(ki){let Zn=Oe||ki.getBoundingClientRect().height,Hn=dh(le||"85%",Zn),Si=dh(oe||"15%",Zn),Ki=32+(Nt==="closed"?de.bottom:0),xt=Ii-li,_i=xt;Nt==="full"?_i=Math.max(0,Math.min(Hn-Ki,xt)):Nt==="peek"?_i=Math.max(-(Hn-Si),Math.min(Si-Ki,xt)):Nt==="closed"&&(_i=Math.min(0,Math.max(-(Hn-Ki),xt))),ki.style.setProperty("--drag-offset",`${_i}px`)}}},pi=sn=>{let li=He.current,Ii=We.current,Xe=ot.parentElement;if(li===null||Ii===null){Xe&&Xe.style.setProperty("--drag-offset","0px");return}if(!De.current){B(null),K(null),Xe&&Xe.style.setProperty("--drag-offset","0px");return}let ft=sn.changedTouches[0].clientY;if(Math.abs(ft-li)<10){B(null),K(null),Xe&&Xe.style.setProperty("--drag-offset","0px");return}let ci=Oe||(Xe?Xe.getBoundingClientRect().height:window.innerHeight),zt=Xe?Xe.getBoundingClientRect().top:0,Nt=ft-zt,ki=ci-Nt,Zn=dh(le||"85%",ci),Hn=dh(oe||"15%",ci),Ki=32+(Be.current==="closed"?de.bottom:0),xt=Math.abs(ki-Zn),_i=Math.abs(ki-Hn),Dn=Math.abs(ki-Ki),Qa=Math.min(xt,_i,Dn),ha="closed";Qa===xt?ha="full":Qa===_i?ha="peek":ha="closed",B(null),K(null),u(ha),requestAnimationFrame(()=>{Xe&&Xe.style.setProperty("--drag-offset","0px")})};return ot.addEventListener("touchstart",qt,{passive:!0}),ot.addEventListener("touchmove",vn,{passive:!1}),ot.addEventListener("touchend",pi,{passive:!0}),()=>{ot.removeEventListener("touchstart",qt),ot.removeEventListener("touchmove",vn),ot.removeEventListener("touchend",pi)}},[f,ye,Oe,le,oe,de,u,B,K]);let _t=a==="full"?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none",lt=Oe||window.innerHeight,jt=dh(le||"85%",lt),Kt=dh(oe||"15%",lt),Qt=jt-Kt,Gn=()=>a==="full"?"translateY(var(--drag-offset, 0px))":a==="peek"?`translateY(calc(${Qt}px + var(--drag-offset, 0px)))`:`translateY(calc(${jt-32}px + var(--drag-offset, 0px)))`;return(0,It.jsxs)(It.Fragment,{children:[(0,It.jsx)("style",{children:`
809
+ .no-scrollbar {
810
+ -ms-overflow-style: none;
811
+ scrollbar-width: none;
812
+ }
813
+ .no-scrollbar::-webkit-scrollbar {
814
+ display: none;
815
+ }
816
+ `}),(0,It.jsx)("div",{className:`absolute inset-0 bg-black/45 backdrop-blur-[1px] transition-opacity duration-300 z-30 ${_t}`,onClick:()=>u("closed")}),f==="left"?(0,It.jsxs)("div",{className:`absolute top-4 left-0 w-80 bg-zinc-950/85 backdrop-blur-md border-r border-y border-white/10 rounded-r-2xl shadow-2xl flex z-40 transition-transform duration-300 ease-out select-none ${a!=="closed"?"translate-x-0":"translate-x-[calc(-100%+24px)]"}`,ref:Re,style:{bottom:`calc(1rem + ${y}px)`},children:[(0,It.jsxs)("div",{className:"flex-1 flex flex-col h-full overflow-hidden pl-4 py-4 pr-1 relative",children:[(0,It.jsx)("div",{className:"flex items-center justify-between pb-3 border-b border-white/10 mb-2",children:(0,It.jsx)("span",{className:"text-sm font-bold tracking-wider text-zinc-400 uppercase",children:"Menu"})}),(0,It.jsx)("div",{className:"flex-1 overflow-y-auto no-scrollbar pr-2",onScroll:xe,ref:Le,children:Ue||(0,It.jsx)("div",{className:"flex flex-col gap-1.5",children:i.map(ot=>(0,It.jsxs)("button",{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 ${ot.disabled?"opacity-45 cursor-not-allowed pointer-events-none":"hover:bg-white/5 active:bg-white/10 text-white"}`,disabled:ot.disabled,onClick:()=>{ot.disabled||(ot.onPress(),u("closed"))},children:[(0,It.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[ot.icon,ot.badge!==void 0&&(0,It.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:ot.badge})]}),(0,It.jsx)("span",{className:"text-sm font-medium tracking-wide flex-1",children:ot.label})]},ot.id))})}),ce&&Y&&(0,It.jsx)("button",{className:"absolute bottom-6 right-6 z-50 flex items-center justify-center w-10 h-10 rounded-full bg-cyan-500 hover:bg-cyan-400 active:scale-95 text-black shadow-lg shadow-cyan-500/25 transition-all duration-200 cursor-pointer",onClick:()=>{Le.current?.scrollTo({behavior:"smooth",top:0})},children:(0,It.jsx)("svg",{fill:"none",height:"20",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,It.jsx)("polyline",{points:"18 15 12 9 6 15"})})})]}),(0,It.jsx)("div",{className:"w-6 flex items-center justify-center cursor-pointer hover:bg-white/5 active:bg-white/10 transition-colors border-l border-white/5 rounded-r-2xl",onClick:Z,children:(0,It.jsx)("div",{className:"w-1.5 h-12 bg-white/20 rounded-full transition-colors group-hover:bg-white/40"})})]}):(0,It.jsxs)("div",{className:`absolute w-full bg-zinc-950/85 backdrop-blur-md border border-white/10 rounded-t-2xl shadow-2xl flex flex-col z-40 select-none ${fe?"transition-none":"transition-transform duration-300 ease-out"}`,ref:Re,style:{bottom:"0px",height:typeof le=="number"?`${le}px`:le||"85%",marginBottom:a==="closed"?`${de.bottom}px`:"0px",transform:Gn(),transition:fe?"none":"transform 300ms ease-out, margin-bottom 250ms ease-in-out"},children:[(0,It.jsx)("div",{className:"w-full h-8 flex flex-col items-center justify-center cursor-pointer hover:bg-white/5 rounded-t-2xl transition-colors border-b border-white/5",onClick:Z,children:(0,It.jsx)("div",{className:"w-12 h-1 bg-white/25 rounded-full"})}),(0,It.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden px-4 pb-4 pt-2 transition-[margin-top] duration-250 ease-in-out relative",style:{marginTop:a==="closed"?`${de.bottom}px`:"0px"},children:[(0,It.jsx)("div",{className:"flex-1 overflow-y-auto no-scrollbar",onScroll:xe,ref:Le,style:{paddingBottom:a==="peek"?`${Qt}px`:"0px"},children:Ue||(0,It.jsx)("div",{className:"flex flex-col gap-1",children:i.map(ot=>(0,It.jsxs)("button",{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 ${ot.disabled?"opacity-45 cursor-not-allowed pointer-events-none":"hover:bg-white/5 active:bg-white/10 text-white"}`,disabled:ot.disabled,onClick:()=>{ot.disabled||(ot.onPress(),u("closed"))},children:[(0,It.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[ot.icon,ot.badge!==void 0&&(0,It.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:ot.badge})]}),(0,It.jsx)("span",{className:"text-sm font-medium tracking-wide",children:ot.label})]},ot.id))})}),ce&&Y&&(0,It.jsx)("button",{className:"absolute right-6 z-50 flex items-center justify-center w-10 h-10 rounded-full bg-cyan-500 hover:bg-cyan-400 active:scale-95 text-black shadow-lg shadow-cyan-500/25 transition-all duration-200 cursor-pointer",onClick:()=>{Le.current?.scrollTo({behavior:"smooth",top:0})},style:{bottom:a==="peek"?`calc(${24+Qt}px + var(--drag-offset, 0px))`:"calc(24px + var(--drag-offset, 0px))"},children:(0,It.jsx)("svg",{fill:"none",height:"20",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,It.jsx)("polyline",{points:"18 15 12 9 6 15"})})})]})]})]})});var rt=tt(ni(),1),Bw=({etaData:i,layoutMode:a,onHeaderClick:u,style:f,isDragging:y=!1})=>a==="closed-banner"?(0,rt.jsxs)("div",{className:"w-full h-10 flex items-center justify-between px-4 pb-2 pt-1 border-b border-white/5 bg-zinc-950/15 relative overflow-hidden",children:[(0,rt.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer flex-1",onClick:u,children:[(0,rt.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,rt.jsxs)("span",{className:"text-xs font-bold text-emerald-400",children:[i.etaMins," min (",i.distanceRemainingKm.toFixed(1)," km)"]})]}),i.onAbort&&(0,rt.jsx)("button",{className:"px-1 py-1 text-[10px] font-black bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/25 active:scale-95 rounded-md transition-all cursor-pointer pointer-events-auto",onClick:l=>{l.stopPropagation(),i.onAbort?.()},children:(0,rt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,rt.jsx)("path",{d:"M18 6 6 18"}),(0,rt.jsx)("path",{d:"m6 6 12 12"})]})}),i.progress!==void 0&&(0,rt.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-white/5",children:(0,rt.jsx)("div",{className:"h-full bg-cyan-400",style:{width:`${i.progress}%`}})})]}):a==="open-card"?(0,rt.jsxs)("div",{className:"mx-4 mt-2 p-4 bg-white/5 border border-white/10 rounded-xl flex flex-col",children:[(0,rt.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,rt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,rt.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,rt.jsx)("span",{className:"text-[10px] font-bold text-emerald-400 uppercase tracking-wider",children:i.label||"Journey Active"})]}),i.onAbort&&(0,rt.jsx)("button",{className:"px-1 px-1 text-xs font-bold bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/30 active:scale-95 rounded-lg transition-all cursor-pointer pointer-events-auto",onClick:i.onAbort,children:(0,rt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,rt.jsx)("path",{d:"M18 6 6 18"}),(0,rt.jsx)("path",{d:"m6 6 12 12"})]})})]}),(0,rt.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-white/10 py-1.5 mb-2.5",children:[(0,rt.jsxs)("div",{className:"text-center",children:[(0,rt.jsxs)("div",{className:"text-xl font-black text-white leading-none",children:[i.etaMins,(0,rt.jsx)("span",{className:"text-xs text-zinc-400 font-normal",children:" min"})]}),(0,rt.jsx)("div",{className:"text-[8px] text-zinc-500 font-bold uppercase tracking-wider mt-1",children:"Time Remaining"})]}),(0,rt.jsxs)("div",{className:"text-center",children:[(0,rt.jsxs)("div",{className:"text-xl font-black text-white leading-none",children:[i.distanceRemainingKm.toFixed(1),(0,rt.jsx)("span",{className:"text-xs text-zinc-400 font-normal",children:" km"})]}),(0,rt.jsx)("div",{className:"text-[8px] text-zinc-500 font-bold uppercase tracking-wider mt-1",children:"Distance Remaining"})]})]}),i.progress!==void 0&&(0,rt.jsxs)("div",{className:"mb-3",children:[(0,rt.jsxs)("div",{className:"flex justify-between text-[9px] font-bold text-zinc-450 mb-1",children:[(0,rt.jsx)("span",{children:"Progress"}),(0,rt.jsxs)("span",{children:[Math.round(i.progress),"%"]})]}),(0,rt.jsx)("div",{className:"h-1 bg-white/10 rounded-full overflow-hidden",children:(0,rt.jsx)("div",{className:"h-full bg-cyan-400 rounded-full",style:{width:`${i.progress}%`}})})]}),i.mode==="preview"&&i.onStart&&(0,rt.jsx)("button",{className:"w-full py-2.5 text-xs font-bold bg-cyan-500 text-black hover:bg-cyan-400 active:scale-95 rounded-lg transition-all cursor-pointer",onClick:i.onStart,children:"Start Guidance"})]}):(0,rt.jsxs)("div",{className:`absolute left-1/2 -translate-x-1/2 z-40 w-[calc(100%-2rem)] max-w-[320px] sm:max-w-[380px] bg-zinc-950/85 backdrop-blur-md border border-white/10 rounded-2xl shadow-2xl p-3 sm:p-4 flex flex-col pointer-events-auto select-none ${y?"transition-none":"transition-all duration-300 ease-out"}`,style:f,children:[(0,rt.jsxs)("div",{className:"flex items-center justify-between mb-2 sm:mb-3",children:[(0,rt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,rt.jsx)("span",{className:"w-1.5 h-1.5 sm:w-2 sm:h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,rt.jsx)("span",{className:"text-[9px] sm:text-[10px] font-bold text-emerald-400 uppercase tracking-wider",children:i.label||"Guidance Active"})]}),i.onAbort&&(0,rt.jsx)("button",{className:"px-1 py-1 text-[10px] sm:text-xs font-bold bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/30 active:scale-95 rounded-lg transition-all cursor-pointer",onClick:i.onAbort,children:(0,rt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,rt.jsx)("path",{d:"M18 6 6 18"}),(0,rt.jsx)("path",{d:"m6 6 12 12"})]})})]}),(0,rt.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-white/10 py-0.5 sm:py-1 mb-2 sm:mb-3",children:[(0,rt.jsx)("div",{className:"text-center",children:(0,rt.jsxs)("div",{className:"text-base sm:text-lg font-black text-white leading-none",children:[i.etaMins,(0,rt.jsxs)("span",{className:"text-[10px] sm:text-xs text-zinc-400 font-normal",children:[" ","min"]})]})}),(0,rt.jsx)("div",{className:"text-center",children:(0,rt.jsxs)("div",{className:"text-base sm:text-lg font-black text-white leading-none",children:[i.distanceRemainingKm.toFixed(1),(0,rt.jsxs)("span",{className:"text-[10px] sm:text-xs text-zinc-400 font-normal",children:[" ","km"]})]})})]}),i.progress!==void 0&&(0,rt.jsxs)("div",{children:[(0,rt.jsxs)("div",{className:"flex justify-between text-[8px] sm:text-[9px] font-bold text-zinc-400 mb-1",children:[(0,rt.jsx)("span",{children:"Progress"}),(0,rt.jsxs)("span",{children:[Math.round(i.progress),"%"]})]}),(0,rt.jsx)("div",{className:"h-1 sm:h-1.5 bg-white/10 rounded-full overflow-hidden",children:(0,rt.jsx)("div",{className:"h-full bg-cyan-400 rounded-full",style:{width:`${i.progress}%`}})})]}),i.mode==="preview"&&i.onStart&&(0,rt.jsx)("button",{className:"mt-2.5 sm:mt-3 py-1.5 sm:py-2 text-[11px] sm:text-xs font-bold bg-cyan-500 text-black hover:bg-cyan-400 active:scale-95 rounded-lg transition-all cursor-pointer",onClick:i.onStart,children:"Start Guidance"})]});var kt=tt(ni(),1),Fw=({customControls:i=[],etaBarHeight:a,onRecenter:u,isMapCentered:f,mapBearing:y,mapPitch:l,onResetBearing:D,initialViewState:B,drawerState:q,side:K,etaData:fe,isDragging:pe,clampedDragOffset:oe,customRecenterButton:le,customCompassButton:Oe,drawerPeekHeight:Ue,insets:ye={bottom:0,left:0,right:0,top:0}})=>{let ce=i.filter(ne=>ne.position==="above-recenter"),se=i.filter(ne=>ne.position==="below-recenter"),de=Math.abs(y)>=.5||Math.abs(l)>=.5,ve="32px",Le=fe?a:q==="closed"?ye.bottom:0,Re=typeof Ue=="number"?`${Ue}px`:Ue||"15%",Z=K==="bottom"?q==="closed"?`calc(${ve} + 1rem + ${Le}px - var(--drag-offset, 0px))`:`calc(${Re} + 1rem + ${fe?a:0}px - var(--drag-offset, 0px))`:`calc(1rem + ${ye.bottom}px)`;return(0,kt.jsxs)("div",{className:`absolute right-4 z-30 flex flex-col items-center gap-3 select-none pointer-events-none ${pe?"transition-none":"transition-all duration-300 ease-out"} ${K!=="bottom"||q!=="full"?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-75 pointer-events-none"}`,style:{bottom:Z},children:[ce.length>0&&(0,kt.jsx)("div",{className:"flex flex-col gap-2 pointer-events-auto",children:ce.map(ne=>(0,kt.jsxs)("div",{className:"relative group flex items-center",children:[ne.tooltip&&(0,kt.jsx)("div",{className:"absolute right-14 pointer-events-none opacity-0 scale-95 origin-right group-hover:opacity-100 group-hover:scale-100 transition-all duration-150 bg-zinc-900/95 border border-white/10 text-white text-xs px-2.5 py-1.5 rounded-lg shadow-xl whitespace-nowrap",children:ne.tooltip}),(0,kt.jsx)("button",{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer ${ne.activeState?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":"hover:bg-zinc-900"}`,onClick:ne.onPress,children:ne.icon})]},ne.id))}),de&&(Oe?(0,kt.jsx)("div",{className:"pointer-events-auto",children:Oe}):(0,kt.jsx)("div",{className:"pointer-events-auto",children:(0,kt.jsx)("button",{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all duration-300 ${de?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none h-0 w-0 border-none m-0 p-0 overflow-hidden"}`,onClick:()=>D({pitch:B?.pitch??0}),style:{transform:de?"scale(1) rotate(0deg)":"scale(0.7) rotate(0deg)"},title:"Reset bearing to North",children:(0,kt.jsxs)("svg",{className:"w-7 h-7 transition-transform duration-75 ease-out",fill:"none",style:{transform:`rotate(${-y}deg)`},viewBox:"0 0 24 24",children:[(0,kt.jsx)("circle",{cx:"12",cy:"12",r:"9.5",stroke:"white",strokeOpacity:"0.2",strokeWidth:"1"}),(0,kt.jsx)("path",{d:"M12 4.5L15 12H9L12 4.5Z",fill:"#ef4444"}),(0,kt.jsx)("path",{d:"M12 19.5L9 12H15L12 19.5Z",fill:"#f4f4f5"}),(0,kt.jsx)("circle",{cx:"12",cy:"12",fill:"#18181b",r:"1.5"})]})})})),le?(0,kt.jsx)("div",{className:"pointer-events-auto",children:le}):(0,kt.jsx)("div",{className:"pointer-events-auto",children:(0,kt.jsx)("button",{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer ${f?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":"hover:bg-zinc-900"}`,onClick:()=>u(),title:"Recenter Map",children:f?(0,kt.jsxs)("svg",{className:"w-6 h-6 text-cyan-400",fill:"none",stroke:"currentColor",strokeWidth:"2.2",viewBox:"0 0 24 24",children:[(0,kt.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,kt.jsx)("circle",{cx:"12",cy:"12",fill:"currentColor",r:"3"}),(0,kt.jsx)("line",{x1:"12",x2:"12",y1:"2",y2:"4"}),(0,kt.jsx)("line",{x1:"12",x2:"12",y1:"20",y2:"22"}),(0,kt.jsx)("line",{x1:"2",x2:"4",y1:"12",y2:"12"}),(0,kt.jsx)("line",{x1:"20",x2:"22",y1:"12",y2:"12"})]}):(0,kt.jsxs)("svg",{className:"w-6 h-6 text-zinc-300",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,kt.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,kt.jsx)("line",{x1:"12",x2:"12",y1:"2",y2:"4"}),(0,kt.jsx)("line",{x1:"12",x2:"12",y1:"20",y2:"22"}),(0,kt.jsx)("line",{x1:"2",x2:"4",y1:"12",y2:"12"}),(0,kt.jsx)("line",{x1:"20",x2:"22",y1:"12",y2:"12"})]})})}),se.length>0&&(0,kt.jsx)("div",{className:"flex flex-col gap-2 pointer-events-auto",children:se.map(ne=>(0,kt.jsxs)("div",{className:"relative group flex items-center",children:[ne.tooltip&&(0,kt.jsx)("div",{className:"absolute right-14 pointer-events-none opacity-0 scale-95 origin-right group-hover:opacity-100 group-hover:scale-100 transition-all duration-150 bg-zinc-900/95 border border-white/10 text-white text-xs px-2.5 py-1.5 rounded-lg shadow-xl whitespace-nowrap",children:ne.tooltip}),(0,kt.jsx)("button",{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer ${ne.activeState?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":"hover:bg-zinc-900"}`,onClick:ne.onPress,children:ne.icon})]},ne.id))})]})};var ri=tt(Rt(),1),Nw=tt(ni(),1),_o=(0,ri.createContext)(null),W_=({children:i})=>{let[a,u]=(0,ri.useState)(!0),[f,y]=(0,ri.useState)(0),[l,D]=(0,ri.useState)(0),[B,q]=(0,ri.useState)("closed"),K=(0,ri.useRef)(null),fe=(0,ri.useCallback)(ze=>{q(ze)},[]),[pe,oe]=(0,ri.useState)(!1),le=(0,ri.useCallback)(ze=>{oe(Be=>Be===ze?Be:ze)},[]),[Oe,Ue]=(0,ri.useState)(void 0),ye=(0,ri.useCallback)(ze=>{Ue(Be=>!Be&&!ze?Be:!Be||!ze?ze:Be.etaMins===ze.etaMins&&Be.distanceRemainingKm===ze.distanceRemainingKm&&Be.label===ze.label&&Be.progress===ze.progress&&Be.mode===ze.mode&&Be.isCalculating===ze.isCalculating&&Be.error===ze.error?Be:ze)},[]),[ce,se]=(0,ri.useState)({bottom:0,left:0,right:0,top:0}),de=(0,ri.useCallback)(ze=>{se(Be=>({...Be,...ze}))},[]),ve=(0,ri.useRef)(null),Le=(0,ri.useRef)(null),Re=(0,ri.useCallback)(ze=>{ve.current&&ve.current(ze)},[]),Z=(0,ri.useCallback)(ze=>{Le.current&&Le.current(ze)},[]),Y=(0,ri.useCallback)(ze=>{ve.current=ze},[]),ne=(0,ri.useCallback)(ze=>{Le.current=ze},[]),xe=(0,ri.useCallback)(ze=>{y(ze)},[]),De=(0,ri.useCallback)(ze=>{D(ze)},[]),nt=(0,ri.useMemo)(()=>({_registerCenterCallback:Y,_registerResetBearingCallback:ne,bearing:f,centerOnUser:Re,drawerContentRef:K,drawerState:B,etaData:Oe,hasControls:pe,insets:ce,isFollowing:a,pitch:l,resetBearing:Z,setBearing:xe,setDrawerState:fe,setEtaData:ye,setHasControls:le,setInsets:de,setIsFollowing:u,setPitch:De}),[Y,ne,f,Re,B,Oe,pe,a,l,Z,xe,fe,ye,le,De,ce,de]);return(0,Nw.jsx)(_o.Provider,{value:nt,children:i})},sC=()=>{let i=(0,ri.useContext)(_o);if(!i)throw new Error("useMapControls must be used within a MapControlsProvider");return i};var Nn=tt(Rt(),1),as=tt(ni(),1),Uw=(i,a)=>typeof i=="number"?i:i.endsWith("%")?parseFloat(i)/100*a:parseFloat(i),K_=({menuItems:i=[],drawerSide:a,customControls:u=[],etaBarHeight:f=100,onRecenter:y,isMapCentered:l,mapBearing:D,onResetBearing:B,etaData:q,customRecenterButton:K,defaultState:fe,initialViewState:pe,customCompassButton:oe,drawerPeekHeight:le,drawerFullHeight:Oe,drawerContentRef:Ue,menuContent:ye,children:ce,enableTouchDrag:se=!1,showScrollToTopButton:de=!0,scrollToTopThreshold:ve=300,isInternal:Le=!1})=>{let Re=(0,Nn.useContext)(_o),Z=Re?.drawerContentRef,Y=(0,Nn.useCallback)(xt=>{Ue&&(typeof Ue=="function"?Ue(xt):Ue.current=xt),Z&&(Z.current=xt)},[Ue,Z]),[ne,xe]=(0,Nn.useState)(fe??"closed"),De=Re?Re.drawerState:ne,nt=(0,Nn.useCallback)(xt=>{Re?Re.setDrawerState(xt):xe(xt)},[Re]);(0,Nn.useEffect)(()=>{fe&&Re&&Re.setDrawerState(fe)},[]);let[ze,Be]=(0,Nn.useState)("left"),He=(0,Nn.useRef)(null),[We,Ke]=(0,Nn.useState)(600);(0,Nn.useEffect)(()=>{let xt=He.current?.parentElement;if(!xt)return;let _i=()=>{Ke(xt.getBoundingClientRect().height)};_i();let Dn=new ResizeObserver(_i);return Dn.observe(xt),()=>{Dn.disconnect()}},[]);let _t=Re?.setHasControls;(0,Nn.useEffect)(()=>{if(_t&&!Le)return _t(!0),()=>_t(!1)},[_t,Le]);let lt=l!==void 0?l:Re?Re.isFollowing:!0,jt=D!==void 0?D:Re?Re.bearing:0,Kt=xt=>{y?y(xt):Re&&Re.centerOnUser(xt)},Qt=xt=>{B?B(xt):Re&&Re.resetBearing(xt)},Gn=Re?Re.pitch:0,ot=q!==void 0?q:Re?.etaData,[qt,vn]=(0,Nn.useState)(null),[pi,sn]=(0,Nn.useState)(null);(0,Nn.useEffect)(()=>{if(typeof window>"u")return;let xt=()=>{a?Be(a):window.innerWidth<768?Be("bottom"):Be("left")};return xt(),window.addEventListener("resize",xt),()=>window.removeEventListener("resize",xt)},[a]);let li=qt!==null&&pi!==null,Ii=li?pi-qt:0,Xe=Uw(Oe||"85%",We),ft=Uw(le||"15%",We),Gt=Re?.insets.bottom||0,ci=32+(De==="closed"?Gt:0),zt=Ii;De==="full"?zt=Math.max(0,Math.min(Xe-ci,Ii)):De==="peek"?zt=Math.max(-(Xe-ft),Math.min(ft-ci,Ii)):De==="closed"&&(zt=Math.min(0,Math.max(-(Xe-ci),Ii)));let Nt=32;De==="peek"?Nt=ft:De==="full"&&(Nt=Xe);let ki=Nt-zt,Zn=ft+20,Hn=ft+(Xe-ft)*.35,Si=1,Ki="1rem";return ze==="bottom"?(ki<=Zn?Si=1:ki>=Hn?Si=0:Si=1-(ki-Zn)/(Hn-Zn),Ki=`calc(${Nt+(De==="closed"?Gt:0)+16}px - var(--drag-offset, 0px))`):(Si=De==="full"?0:1,Ki=`calc(1rem + ${Gt}px)`),(0,as.jsxs)(as.Fragment,{children:[(0,as.jsx)("div",{ref:He,style:{display:"none"}}),(0,as.jsx)(Ow,{clampedDragOffset:zt,containerHeight:We,currentTouchY:pi,drawerFullHeight:Oe,drawerPeekHeight:le,enableTouchDrag:se,etaBarHeight:f,etaData:ot,isDragging:li,menuContent:ce||ye,menuItems:i,onChangeState:nt,ref:Y,safeAreaInsets:Re?.insets,scrollToTopThreshold:ve,setCurrentTouchY:sn,setTouchStartY:vn,showScrollToTopButton:de,side:ze,state:De,touchStartY:qt}),(0,as.jsx)(Fw,{clampedDragOffset:zt,customCompassButton:oe,customControls:u,customRecenterButton:K,drawerPeekHeight:le,drawerState:De,etaBarHeight:f+(De==="closed"?Gt:0),etaData:ot,initialViewState:pe,insets:Re?.insets,isDragging:li,isMapCentered:lt,mapBearing:jt,mapPitch:Gn,onRecenter:()=>Kt(),onResetBearing:Qt,side:ze}),ot&&(0,as.jsx)(Bw,{etaData:ot,isDragging:li,layoutMode:"floating-card",style:{bottom:Ki,opacity:Si,pointerEvents:Si>.1?"auto":"none",transition:li?"none":"bottom 250ms ease-in-out, opacity 300ms ease-out"}})]})};var Vw=tt(Rt(),1),$a=tt(ni(),1),Ap=({children:i})=>(0,$a.jsx)("div",{className:"flex flex-col gap-1.5",children:i}),g0=({id:i,label:a,icon:u,onPress:f,badge:y,disabled:l=!1,children:D})=>{let B=(0,Vw.useContext)(_o);return(0,$a.jsxs)("button",{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 ${l?"opacity-45 cursor-not-allowed pointer-events-none":"hover:bg-white/5 active:bg-white/10 text-white"}`,disabled:l,onClick:K=>{l||(f&&f(),B&&B.setDrawerState&&B.setDrawerState("closed"))},type:"button",children:[u&&(0,$a.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[u,y!==void 0&&(0,$a.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:y})]}),(0,$a.jsxs)("div",{className:"flex-1 flex flex-col justify-center",children:[(0,$a.jsx)("span",{className:"text-sm font-medium tracking-wide flex-1",children:a}),D]})]})};Ap.displayName="MapMenu";g0.displayName="MapMenuItem";var _0=({children:i,showDivider:a=!0,className:u=""})=>(0,$a.jsx)("div",{className:`flex items-center justify-between pb-3 first:mt-0 px-3.5 ${u} ${a?"border-b border-white/10 mb-2 mt-4":""}`,children:i});_0.displayName="MapMenuTitle";var y0=({className:i=""})=>(0,$a.jsx)("div",{className:`h-[1px] bg-white/10 my-3 mx-3.5 ${i}`});y0.displayName="MapMenuDivider";var v0=({children:i,className:a=""})=>(0,$a.jsx)("div",{className:`mt-auto pt-4 border-t border-white/10 px-3.5 text-xs text-zinc-500 font-medium ${a}`,children:i});v0.displayName="MapMenuFooter";var jw=(f=>(f.TOP_SCROLL_MORE="TOP_SCROLL_MORE",f.BOTTOM_SCROLL_MORE="BOTTOM_SCROLL_MORE",f.BACK_GESTURE="BACK_GESTURE",f))(jw||{}),zp=(u=>(u.LOCATION_UPDATE="LOCATION_UPDATE",u.LOCATION_STREAM_UPDATE="LOCATION_STREAM_UPDATE",u))(zp||{}),qw=(a=>(a.UPDATE_CONTEXT="UPDATE_CONTEXT",a))(qw||{});var os=tt(Rt(),1),Q_=.12,Dp=()=>{let[i,a]=(0,os.useState)({accuracy:null,coords:null,heading:null}),u=(0,os.useRef)({accuracy:null,coords:null,heading:null}),f=(0,os.useRef)({accuracy:null,coords:null,heading:null}),y=(0,os.useCallback)(l=>{let D=l.location?.coords||l.coords,B=l.heading||l.coords,q=D?[D.longitude,D.latitude]:null,K=null;return B?.trueHeading!==void 0&&B.trueHeading>=0?K=B.trueHeading:B?.magneticHeading!==void 0&&B.magneticHeading>=0?K=B.magneticHeading:B?.heading!==null&&B.heading>=0&&(K=B.heading),{accuracy:D?.accuracy||null,coords:q,heading:K}},[]);return(0,os.useEffect)(()=>{let l,D=()=>{let K=!1;if(u.current.coords)if(!f.current.coords)f.current.coords=[...u.current.coords],K=!0;else{let[fe,pe]=u.current.coords,[oe,le]=f.current.coords,Oe=oe+(fe-oe)*Q_,Ue=le+(pe-le)*Q_;(Math.abs(Oe-oe)>1e-7||Math.abs(Ue-le)>1e-7)&&(f.current.coords=[Oe,Ue],K=!0)}if(u.current.heading!==null)if(f.current.heading===null)f.current.heading=u.current.heading,K=!0;else{let fe=u.current.heading,pe=f.current.heading,oe=fe-pe;oe>180&&(oe-=360),oe<-180&&(oe+=360);let Oe=((pe+oe*Q_)%360+360)%360;Math.abs(oe)>.1&&(f.current.heading=Oe,K=!0)}K&&a({accuracy:u.current.accuracy,coords:f.current.coords?[...f.current.coords]:null,heading:f.current.heading}),l=requestAnimationFrame(D)};l=requestAnimationFrame(D),Xi.location.getCurrentPosition().then(K=>{let fe=y(K);u.current=fe}).catch(K=>console.warn("Initial location fetch failed",K));let B=Xi.on("LOCATION_STREAM_UPDATE",K=>{u.current=y(K)}),q=Xi.on("LOCATION_UPDATE",K=>{u.current=y(K)});return Xi.location.startStream({distanceFilter:1,headingThreshold:2}).catch(K=>console.warn("Failed to start location stream",K)),()=>{cancelAnimationFrame(l),B(),q(),Xi.location.stopStream().catch(()=>{})}},[y]),i};var tn=tt(Rt(),1),J_=({origin:i,destination:a,profile:u="driving",recalculateThreshold:f=50,enabled:y=!0,initialMode:l="preview"})=>{let[D,B]=(0,tn.useState)(null),[q,K]=(0,tn.useState)(null),[fe,pe]=(0,tn.useState)(!1),[oe,le]=(0,tn.useState)(null),[Oe,Ue]=(0,tn.useState)(l),ye=Dp(),ce=i||ye.coords,se=(0,tn.useRef)(null),de=(0,tn.useRef)(null),ve=(0,tn.useRef)(!1),Le=(0,tn.useCallback)((Y,ne)=>{let De=Y[1]*Math.PI/180,nt=ne[1]*Math.PI/180,ze=(ne[1]-Y[1])*Math.PI/180,Be=(ne[0]-Y[0])*Math.PI/180,He=Math.sin(ze/2)*Math.sin(ze/2)+Math.cos(De)*Math.cos(nt)*Math.sin(Be/2)*Math.sin(Be/2);return 6371e3*(2*Math.atan2(Math.sqrt(He),Math.sqrt(1-He)))},[]),Re=(0,tn.useMemo)(()=>!ce||!a?null:Le(ce,a),[ce,a,Le]),Z=(0,tn.useCallback)(async(Y,ne,xe)=>{if(!ve.current){ve.current=!0,pe(!0);try{let De=await Xi.routing.getRoute({destination:ne,origin:Y,profile:u});B(De),le(null),xe&&K(De.distanceMeters),se.current=Y,de.current=ne}catch(De){le(De.message||"Failed to fetch route")}finally{pe(!1),ve.current=!1}}},[u]);return(0,tn.useEffect)(()=>{if(!y||!a||!ce){(!y||!a)&&(B(null),K(null),se.current=null,de.current=null);return}!de.current||de.current[0]!==a[0]||de.current[1]!==a[1]?Z(ce,a,!0):se.current?Le(ce,se.current)>f&&Z(ce,a,!1):Z(ce,a,!0)},[ce,a,y,f,Z,Le]),{currentDistanceMeters:Re,error:oe,isCalculating:fe,mode:Oe,recalculate:()=>ce&&a&&Z(ce,a,!1),route:D,start:()=>Ue("navigation"),totalDistance:q}},lC=(i,a,u="driving")=>{let[f,y]=(0,tn.useState)(null),[l,D]=(0,tn.useState)(!1),[B,q]=(0,tn.useState)(null);return(0,tn.useEffect)(()=>{if(!i||!a){y(null);return}(async()=>{D(!0);try{let fe=await Xi.routing.getRoute({destination:a,origin:i,profile:u});y(fe),q(null)}catch(fe){q(fe.message||"Failed to fetch route")}finally{D(!1)}})()},[i,a,u]),{error:B,isCalculating:l,route:f}};var Gw=tt(Rt(),1),ey=(i,a)=>(0,Gw.useMemo)(()=>{if(!i||!a||i.coordinates.length<2)return i;let u=i.coordinates,f=1/0,y=0,l=(B,q)=>(B[0]-q[0])**2+(B[1]-q[1])**2;for(let B=0;B<u.length;B++){let q=l(a,u[B]);q<f&&(f=q,y=B)}let D=u.slice(y+1);return{coordinates:[a,...D],type:"LineString"}},[i,a]);var sl=tt(Rt(),1),ea=tt(Rt(),1);var b0=tt(Rt(),1),yo=tt(Rt(),1);var x0=b0.createContext(null),ty=i=>{let[a,u]=(0,yo.useState)({}),f=(0,yo.useCallback)((l,D="default")=>{u(B=>{if(D==="current")throw new Error("'current' cannot be used as map id");if(B[D])throw new Error(`Multiple maps with the same id: ${D}`);return{...B,[D]:l}})},[]),y=(0,yo.useCallback)((l="default")=>{u(D=>{if(D[l]){let B={...D};return delete B[l],B}return D})},[]);return b0.createElement(x0.Provider,{value:{maps:a,onMapMount:f,onMapUnmount:y}},i.children)};function iy(){let i=(0,yo.useContext)(x0)?.maps,a=(0,yo.useContext)(Jr);return(0,yo.useMemo)(()=>({...i,current:a?.map}),[i,a])}function Zw(i,a){let u=Array.isArray(i)?i[0]:i?i.x:0,f=Array.isArray(i)?i[1]:i?i.y:0,y=Array.isArray(a)?a[0]:a?a.x:0,l=Array.isArray(a)?a[1]:a?a.y:0;return u===y&&f===l}function Cn(i,a){if(i===a)return!0;if(!i||!a)return!1;if(Array.isArray(i)){if(!Array.isArray(a)||i.length!==a.length)return!1;for(let u=0;u<i.length;u++)if(!Cn(i[u],a[u]))return!1;return!0}else if(Array.isArray(a))return!1;if(typeof i=="object"&&typeof a=="object"){let u=Object.keys(i),f=Object.keys(a);if(u.length!==f.length)return!1;for(let y of u)if(!a.hasOwnProperty(y)||!Cn(i[y],a[y]))return!1;return!0}return!1}function ny(i){return{longitude:i.center.lng,latitude:i.center.lat,zoom:i.zoom,pitch:i.pitch,bearing:i.bearing,padding:i.padding}}function ry(i,a){let u=a.viewState||a,f={};if("longitude"in u&&"latitude"in u&&(u.longitude!==i.center.lng||u.latitude!==i.center.lat)){let y=i.center.constructor;f.center=new y(u.longitude,u.latitude)}return"zoom"in u&&u.zoom!==i.zoom&&(f.zoom=u.zoom),"bearing"in u&&u.bearing!==i.bearing&&(f.bearing=u.bearing),"pitch"in u&&u.pitch!==i.pitch&&(f.pitch=u.pitch),u.padding&&i.padding&&!Cn(u.padding,i.padding)&&(f.padding=u.padding),f}var cC=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ay(i){if(!i)return null;if(typeof i=="string"||("toJS"in i&&(i=i.toJS()),!i.layers))return i;let a={};for(let f of i.layers)a[f.id]=f;let u=i.layers.map(f=>{let y=null;"interactive"in f&&(y=Object.assign({},f),delete y.interactive);let l=a[f.ref];if(l){y=y||Object.assign({},f),delete y.ref;for(let D of cC)D in l&&(y[D]=l[D])}return y||f});return{...i,layers:u}}var Hw={version:8,sources:{},layers:[]},uC={minZoom:0,maxZoom:22,minPitch:0,maxPitch:85,maxBounds:[-180,-85.051129,180,85.051129],projection:"mercator",renderWorldCopies:!0},$w={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Xw={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},Yw={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},hC=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],dC=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"],w0=class i{constructor(a,u,f){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=y=>{let l=this.props[Yw[y.type]];l?l(y):y.type==="error"&&console.error(y.error)},this._onCameraEvent=y=>{if(this._internalUpdate)return;y.viewState=this._propsedCameraUpdate||ny(this._map.transform);let l=this.props[Xw[y.type]];l&&l(y)},this._onCameraUpdate=y=>this._internalUpdate?y:(this._propsedCameraUpdate=ny(y),ry(y,this.props)),this._onPointerEvent=y=>{(y.type==="mousemove"||y.type==="mouseout")&&this._updateHover(y);let l=this.props[$w[y.type]];l&&(this.props.interactiveLayerIds&&y.type!=="mouseover"&&y.type!=="mouseout"&&(y.features=this._hoveredFeatures||this._queryRenderedFeatures(y.point)),l(y),delete y.features)},this._MapClass=a,this.props=u,this._initialize(f)}get map(){return this._map}setProps(a){let u=this.props;this.props=a;let f=this._updateSettings(a,u),y=this._updateSize(a),l=this._updateViewState(a);this._updateStyle(a,u),this._updateStyleComponents(a),this._updateHandlers(a,u),(f||y||l&&!this._map.isMoving())&&this.redraw()}static reuse(a,u){let f=i.savedMaps.pop();if(!f)return null;let y=f.map,l=y.getContainer();for(u.className=l.className;l.childNodes.length>0;)u.appendChild(l.childNodes[0]);y._container=u;let D=y._resizeObserver;D&&(D.disconnect(),D.observe(u)),f.setProps({...a,styleDiffing:!1}),y.resize();let{initialViewState:B}=a;return B&&(B.bounds?y.fitBounds(B.bounds,{...B.fitBoundsOptions,duration:0}):f._updateViewState(B)),y.isStyleLoaded()?y.fire("load"):y.once("style.load",()=>y.fire("load")),y._update(),f}_initialize(a){let{props:u}=this,{mapStyle:f=Hw}=u,y={...u,...u.initialViewState,container:a,style:ay(f)},l=y.initialViewState||y.viewState||y;if(Object.assign(y,{center:[l.longitude||0,l.latitude||0],zoom:l.zoom||0,pitch:l.pitch||0,bearing:l.bearing||0}),u.gl){let B=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=B,u.gl)}let D=new this._MapClass(y);l.padding&&D.setPadding(l.padding),u.cursor&&(D.getCanvas().style.cursor=u.cursor),D.transformCameraUpdate=this._onCameraUpdate,D.on("style.load",()=>{this._styleComponents={light:D.getLight(),sky:D.getSky(),projection:D.getProjection?.(),terrain:D.getTerrain()},this._updateStyleComponents(this.props)}),D.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(let B in $w)D.on(B,this._onPointerEvent);for(let B in Xw)D.on(B,this._onCameraEvent);for(let B in Yw)D.on(B,this._onEvent);this._map=D}recycle(){this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(),i.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let a=this._map;a.style&&(a._frame&&(a._frame.cancel(),a._frame=null),a._render())}_updateSize(a){let{viewState:u}=a;if(u){let f=this._map;if(u.width!==f.transform.width||u.height!==f.transform.height)return f.resize(),!0}return!1}_updateViewState(a){let u=this._map,f=u.transform;if(!u.isMoving()){let l=ry(f,a);if(Object.keys(l).length>0)return this._internalUpdate=!0,u.jumpTo(l),this._internalUpdate=!1,!0}return!1}_updateSettings(a,u){let f=this._map,y=!1;for(let l of hC)if((l in a||l in u)&&!Cn(a[l],u[l])){y=!0;let B=l in a?a[l]:uC[l];f[`set${l[0].toUpperCase()}${l.slice(1)}`]?.call(f,B)}return y}_updateStyle(a,u){if(a.cursor!==u.cursor&&(this._map.getCanvas().style.cursor=a.cursor||""),a.mapStyle!==u.mapStyle){let{mapStyle:f=Hw,styleDiffing:y=!0}=a,l={diff:y};"localIdeographFontFamily"in a&&(l.localIdeographFontFamily=a.localIdeographFontFamily),this._map.setStyle(ay(f),l)}}_updateStyleComponents({light:a,projection:u,sky:f,terrain:y}){let l=this._map,D=this._styleComponents;l.style?._loaded&&(a&&!Cn(a,D.light)&&(D.light=a,l.setLight(a)),u&&!Cn(u,D.projection)&&u!==D.projection?.type&&(D.projection=typeof u=="string"?{type:u}:u,l.setProjection?.(D.projection)),f&&!Cn(f,D.sky)&&(D.sky=f,l.setSky(f)),y!==void 0&&!Cn(y,D.terrain)&&(!y||l.getSource(y.source))&&(D.terrain=y,l.setTerrain(y)))}_updateHandlers(a,u){let f=this._map;for(let y of dC){let l=a[y]??!0,D=u[y]??!0;Cn(l,D)||(l?f[y].enable(l):f[y].disable())}}_queryRenderedFeatures(a){let u=this._map,{interactiveLayerIds:f=[]}=this.props;try{return u.queryRenderedFeatures(a,{layers:f.filter(u.getLayer.bind(u))})}catch{return[]}}_updateHover(a){let{props:u}=this;if(u.interactiveLayerIds&&(u.onMouseMove||u.onMouseEnter||u.onMouseLeave)){let y=a.type,l=this._hoveredFeatures?.length>0,D=this._queryRenderedFeatures(a.point),B=D.length>0;!B&&l&&(a.type="mouseleave",this._onPointerEvent(a)),this._hoveredFeatures=D,B&&!l&&(a.type="mouseenter",this._onPointerEvent(a)),a.type=y}else this._hoveredFeatures=null}};w0.savedMaps=[];var oy=w0;var pC=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function sy(i){if(!i)return null;let a=i.map,u={getMap:()=>a};for(let f of fC(a))!(f in u)&&!pC.includes(f)&&(u[f]=a[f].bind(a));return u}function fC(i){let a=new Set,u=i;for(;u;){for(let f of Object.getOwnPropertyNames(u))f[0]!=="_"&&typeof i[f]=="function"&&f!=="fire"&&f!=="setEventedParent"&&a.add(f);u=Object.getPrototypeOf(u)}return Array.from(a)}var T0=tt(Rt(),1),mC=typeof document<"u"?T0.useLayoutEffect:T0.useEffect,Ww=mC;function ly(i,a){let{RTLTextPlugin:u,maxParallelImageRequests:f,workerCount:y,workerUrl:l}=a;if(u&&i.getRTLTextPluginStatus&&i.getRTLTextPluginStatus()==="unavailable"){let{pluginUrl:D,lazy:B=!0}=typeof u=="string"?{pluginUrl:u}:u;i.setRTLTextPlugin(D,q=>{q&&console.error(q)},B)}f!==void 0&&i.setMaxParallelImageRequests(f),y!==void 0&&i.setWorkerCount(y),l!==void 0&&i.setWorkerUrl(l)}var Jr=sl.createContext(null);function gC(i,a){let u=(0,ea.useContext)(x0),[f,y]=(0,ea.useState)(null),l=(0,ea.useRef)(),{current:D}=(0,ea.useRef)({mapLib:null,map:null});(0,ea.useEffect)(()=>{let K=i.mapLib,fe=!0,pe;return Promise.resolve(K||Promise.resolve().then(()=>tt(Qw(),1))).then(oe=>{if(!fe)return;if(!oe)throw new Error("Invalid mapLib");let le="Map"in oe?oe:oe.default;if(!le.Map)throw new Error("Invalid mapLib");ly(le,i),i.reuseMaps&&(pe=oy.reuse(i,l.current)),pe||(pe=new oy(le.Map,i,l.current)),D.map=sy(pe),D.mapLib=le,y(pe),u?.onMapMount(D.map,i.id)}).catch(oe=>{let{onError:le}=i;le?le({type:"error",target:null,originalEvent:null,error:oe}):console.error(oe)}),()=>{fe=!1,pe&&(u?.onMapUnmount(i.id),i.reuseMaps?pe.recycle():pe.destroy())}},[]),Ww(()=>{f&&f.setProps(i)}),(0,ea.useImperativeHandle)(a,()=>D.map,[f]);let B=(0,ea.useMemo)(()=>({position:"relative",width:"100%",height:"100%",...i.style}),[i.style]),q={height:"100%"};return sl.createElement("div",{id:i.id,ref:l,style:B},f&&sl.createElement(Jr.Provider,{value:D},sl.createElement("div",{"mapboxgl-children":"",style:q},i.children)))}var hy=sl.forwardRef(gC);var r5=tt(Rt(),1),a5=tt(M0(),1),Er=tt(Rt(),1);var bC=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Un(i,a){if(!i||!a)return;let u=i.style;for(let f in a){let y=a[f];Number.isFinite(y)&&!bC.test(f)?u[f]=`${y}px`:u[f]=y}}function E0(i,a){if(i===a)return null;let u=n5(i),f=n5(a),y=[];for(let l of f)u.has(l)||y.push(l);for(let l of u)f.has(l)||y.push(l);return y.length===0?null:y}function n5(i){return new Set(i?i.trim().split(/\s+/):[])}var Rp=(0,Er.memo)((0,Er.forwardRef)((i,a)=>{let{map:u,mapLib:f}=(0,Er.useContext)(Jr),y=(0,Er.useRef)({props:i}),l=(0,Er.useMemo)(()=>{let ce=!1;r5.Children.forEach(i.children,ve=>{ve&&(ce=!0)});let se={...i,element:ce?document.createElement("div"):void 0},de=new f.Marker(se);return de.setLngLat([i.longitude,i.latitude]),de.getElement().addEventListener("click",ve=>{y.current.props.onClick?.({type:"click",target:de,originalEvent:ve})}),de.on("dragstart",ve=>{let Le=ve;Le.lngLat=l.getLngLat(),y.current.props.onDragStart?.(Le)}),de.on("drag",ve=>{let Le=ve;Le.lngLat=l.getLngLat(),y.current.props.onDrag?.(Le)}),de.on("dragend",ve=>{let Le=ve;Le.lngLat=l.getLngLat(),y.current.props.onDragEnd?.(Le)}),de},[]);(0,Er.useEffect)(()=>(l.addTo(u.getMap()),()=>{l.remove()}),[]);let{longitude:D,latitude:B,offset:q,style:K,draggable:fe=!1,popup:pe=null,rotation:oe=0,rotationAlignment:le="auto",pitchAlignment:Oe="auto"}=i;(0,Er.useEffect)(()=>{Un(l.getElement(),K)},[K]),(0,Er.useImperativeHandle)(a,()=>l,[]);let Ue=y.current.props;(l.getLngLat().lng!==D||l.getLngLat().lat!==B)&&l.setLngLat([D,B]),q&&!Zw(l.getOffset(),q)&&l.setOffset(q),l.isDraggable()!==fe&&l.setDraggable(fe),l.getRotation()!==oe&&l.setRotation(oe),l.getRotationAlignment()!==le&&l.setRotationAlignment(le),l.getPitchAlignment()!==Oe&&l.setPitchAlignment(Oe),l.getPopup()!==pe&&l.setPopup(pe);let ye=E0(Ue.className,i.className);if(ye)for(let ce of ye)l.toggleClassName(ce);return y.current.props=i,(0,a5.createPortal)(i.children,l.getElement())}));var o5=tt(M0(),1),pr=tt(Rt(),1);var xC=(0,pr.memo)((0,pr.forwardRef)((i,a)=>{let{map:u,mapLib:f}=(0,pr.useContext)(Jr),y=(0,pr.useMemo)(()=>document.createElement("div"),[]),l=(0,pr.useRef)({props:i}),D=(0,pr.useMemo)(()=>{let B={...i},q=new f.Popup(B);return q.setLngLat([i.longitude,i.latitude]),q.once("open",K=>{l.current.props.onOpen?.(K)}),q},[]);if((0,pr.useEffect)(()=>{let B=q=>{l.current.props.onClose?.(q)};return D.on("close",B),D.setDOMContent(y).addTo(u.getMap()),()=>{D.off("close",B),D.isOpen()&&D.remove()}},[]),(0,pr.useEffect)(()=>{Un(D.getElement(),i.style)},[i.style]),(0,pr.useImperativeHandle)(a,()=>D,[]),D.isOpen()){let B=l.current.props;(D.getLngLat().lng!==i.longitude||D.getLngLat().lat!==i.latitude)&&D.setLngLat([i.longitude,i.latitude]),i.offset&&!Cn(B.offset,i.offset)&&D.setOffset(i.offset),(B.anchor!==i.anchor||B.maxWidth!==i.maxWidth)&&(D.options.anchor=i.anchor,D.setMaxWidth(i.maxWidth));let q=E0(B.className,i.className);if(q)for(let K of q)D.toggleClassName(K);l.current.props=i}return(0,o5.createPortal)(i.children,y)}));var C0=tt(Rt(),1);var ph=tt(Rt(),1);function Cr(i,a,u,f){let y=(0,ph.useContext)(Jr),l=(0,ph.useMemo)(()=>i(y),[]);return(0,ph.useEffect)(()=>{let D=f||u||a,B=typeof a=="function"&&typeof u=="function"?a:null,q=typeof u=="function"?u:typeof a=="function"?a:null,{map:K}=y;return K.hasControl(l)||(K.addControl(l,D?.position),B&&B(y)),()=>{q&&q(y),K.hasControl(l)&&K.removeControl(l)}},[]),l}function wC(i){let a=Cr(({mapLib:u})=>new u.AttributionControl(i),{position:i.position});return(0,C0.useEffect)(()=>{Un(a._container,i.style)},[i.style]),null}var TC=(0,C0.memo)(wC);var A0=tt(Rt(),1);function SC(i){let a=Cr(({mapLib:u})=>new u.FullscreenControl({container:i.containerId&&document.getElementById(i.containerId)}),{position:i.position});return(0,A0.useEffect)(()=>{Un(a._controlContainer,i.style)},[i.style]),null}var MC=(0,A0.memo)(SC);var vo=tt(Rt(),1);function EC(i,a){let u=(0,vo.useRef)({props:i}),f=Cr(({mapLib:y})=>{let l=new y.GeolocateControl(i),D=l._setupUI;return l._setupUI=()=>{l._container.hasChildNodes()||D()},l.on("geolocate",B=>{u.current.props.onGeolocate?.(B)}),l.on("error",B=>{u.current.props.onError?.(B)}),l.on("outofmaxbounds",B=>{u.current.props.onOutOfMaxBounds?.(B)}),l.on("trackuserlocationstart",B=>{u.current.props.onTrackUserLocationStart?.(B)}),l.on("trackuserlocationend",B=>{u.current.props.onTrackUserLocationEnd?.(B)}),l},{position:i.position});return u.current.props=i,(0,vo.useImperativeHandle)(a,()=>f,[]),(0,vo.useEffect)(()=>{Un(f._container,i.style)},[i.style]),null}var CC=(0,vo.memo)((0,vo.forwardRef)(EC));var z0=tt(Rt(),1);function AC(i){let a=Cr(({mapLib:u})=>new u.NavigationControl(i),{position:i.position});return(0,z0.useEffect)(()=>{Un(a._container,i.style)},[i.style]),null}var zC=(0,z0.memo)(AC);var fh=tt(Rt(),1);function DC(i){let a=Cr(({mapLib:l})=>new l.ScaleControl(i),{position:i.position}),u=(0,fh.useRef)(i),f=u.current;u.current=i;let{style:y}=i;return i.maxWidth!==void 0&&i.maxWidth!==f.maxWidth&&(a.options.maxWidth=i.maxWidth),i.unit!==void 0&&i.unit!==f.unit&&a.setUnit(i.unit),(0,fh.useEffect)(()=>{Un(a._container,y)},[y]),null}var PC=(0,fh.memo)(DC);var D0=tt(Rt(),1);function RC(i){let a=Cr(({mapLib:u})=>new u.TerrainControl(i),{position:i.position});return(0,D0.useEffect)(()=>{Un(a._container,i.style)},[i.style]),null}var IC=(0,D0.memo)(RC);var P0=tt(Rt(),1);function kC(i){let a=Cr(({mapLib:u})=>new u.LogoControl(i),{position:i.position});return(0,P0.useEffect)(()=>{Un(a._container,i.style)},[i.style]),null}var LC=(0,P0.memo)(kC);var s5=tt(Rt(),1),ba=tt(Rt(),1);function Mc(i,a){if(!i)throw new Error(a)}var OC=0;function BC(i,a,u){if(i.style&&i.style._loaded){let f={...u};return delete f.id,delete f.children,i.addSource(a,f),i.getSource(a)}return null}function FC(i,a,u){Mc(a.id===u.id,"source id changed"),Mc(a.type===u.type,"source type changed");let f="",y=0;for(let D in a)D!=="children"&&D!=="id"&&!Cn(u[D],a[D])&&(f=D,y++);if(!y)return;let l=a.type;if(l==="geojson")i.setData(a.data);else if(l==="image")i.updateImage({url:a.url,coordinates:a.coordinates});else switch(f){case"coordinates":i.setCoordinates?.(a.coordinates);break;case"url":i.setUrl?.(a.url);break;case"tiles":i.setTiles?.(a.tiles);break;default:console.warn(`Unable to update <Source> prop: ${f}`)}}function Ip(i){let a=(0,ba.useContext)(Jr).map.getMap(),u=(0,ba.useRef)(i),[,f]=(0,ba.useState)(0),y=(0,ba.useMemo)(()=>i.id||`jsx-source-${OC++}`,[]);(0,ba.useEffect)(()=>{if(a){let D=()=>setTimeout(()=>f(B=>B+1),0);return a.on("styledata",D),D(),()=>{if(a.off("styledata",D),a.style&&a.style._loaded&&a.getSource(y)){let B=a.getStyle()?.layers;if(B)for(let q of B)q.source===y&&a.removeLayer(q.id);a.removeSource(y)}}}},[a]);let l=a&&a.style&&a.getSource(y);return l?FC(l,i,u.current):l=BC(a,y,i),u.current=i,l&&s5.Children.map(i.children,D=>D&&(0,ba.cloneElement)(D,{source:y}))||null}var bo=tt(Rt(),1);function NC(i,a,u,f){if(Mc(u.id===f.id,"layer id changed"),Mc(u.type===f.type,"layer type changed"),u.type==="custom"||f.type==="custom")return;let{layout:y={},paint:l={},filter:D,minzoom:B,maxzoom:q,beforeId:K}=u;if(K!==f.beforeId&&i.moveLayer(a,K),y!==f.layout){let fe=f.layout||{};for(let pe in y)Cn(y[pe],fe[pe])||i.setLayoutProperty(a,pe,y[pe]);for(let pe in fe)y.hasOwnProperty(pe)||i.setLayoutProperty(a,pe,void 0)}if(l!==f.paint){let fe=f.paint||{};for(let pe in l)Cn(l[pe],fe[pe])||i.setPaintProperty(a,pe,l[pe]);for(let pe in fe)l.hasOwnProperty(pe)||i.setPaintProperty(a,pe,void 0)}Cn(D,f.filter)||i.setFilter(a,D),(B!==f.minzoom||q!==f.maxzoom)&&i.setLayerZoomRange(a,B,q)}function UC(i,a,u){if(i.style&&i.style._loaded&&(!("source"in u)||i.getSource(u.source))){let f={...u,id:a};delete f.beforeId,i.addLayer(f,u.beforeId)}}var VC=0;function mh(i){let a=(0,bo.useContext)(Jr).map.getMap(),u=(0,bo.useRef)(i),[,f]=(0,bo.useState)(0),y=(0,bo.useMemo)(()=>i.id||`jsx-layer-${VC++}`,[]);if((0,bo.useEffect)(()=>{if(a){let D=()=>f(B=>B+1);return a.on("styledata",D),D(),()=>{a.off("styledata",D),a.style&&a.style._loaded&&a.getLayer(y)&&a.removeLayer(y)}}},[a]),a&&a.style&&a.getLayer(y))try{NC(a,y,i,u.current)}catch(D){console.warn(D)}else UC(a,y,i);return u.current=i,null}var kp=tt(ni(),1),dy=({geometry:i,color:a="#3b82f6",width:u=5,opacity:f=.8})=>i?(0,kp.jsxs)(Ip,{data:{geometry:i,properties:{},type:"Feature"},id:"sdk-route-source",type:"geojson",children:[(0,kp.jsx)(mh,{id:"sdk-route-layer-casing",paint:{"line-blur":1,"line-color":"#ffffff","line-opacity":f,"line-width":u+2},type:"line"}),(0,kp.jsx)(mh,{id:"sdk-route-layer",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":a,"line-opacity":f,"line-width":u},type:"line"})]}):null;var Lt=tt(Rt(),1);var Ec=tt(Rt(),1),py=tt(ni(),1);function l5(i,a=64){let u=document.createElement("canvas");u.width=a,u.height=a;let f=u.getContext("2d");return f.font=`${a*.75}px serif`,f.textAlign="center",f.textBaseline="middle",f.fillText(i,a/2,a/2),f.getImageData(0,0,a,a)}var c5=({pois:i})=>{let[a,u]=(0,Ec.useState)(0),{current:f}=iy(),y=(0,Ec.useMemo)(()=>i.filter(D=>!D.displayMode||D.displayMode==="gl"),[i]);(0,Ec.useEffect)(()=>{if(!f)return;let D=f.getMap();[{emoji:"\u{1F37A}",name:"sdk-default-bar"},{emoji:"\u{1F37D}\uFE0F",name:"sdk-default-restaurant"},{emoji:"\u{1F4CD}",name:"sdk-default-poi"}].forEach(K=>{D.hasImage(K.name)||D.addImage(K.name,l5(K.emoji),{pixelRatio:2})});let q=0;y.forEach(K=>{if(K.imageUrl){let fe=`custom-url-${K.id}`;D.hasImage(fe)||D.loadImage(K.imageUrl,(pe,oe)=>{!pe&&oe&&(D.hasImage(fe)||(D.addImage(fe,oe),u(le=>le+1)))})}if(K.emoji){let fe=`custom-emoji-${K.emoji}`;D.hasImage(fe)||(D.addImage(fe,l5(K.emoji),{pixelRatio:2}),q++)}}),q>0&&u(K=>K+q)},[f,y]);let l=(0,Ec.useMemo)(()=>({features:y.map(D=>({geometry:{coordinates:[D.longitude,D.latitude],type:"Point"},properties:{...D,"sdk-icon":D.imageUrl?`custom-url-${D.id}`:D.spriteName?D.spriteName:D.emoji?`custom-emoji-${D.emoji}`:D.type==="bar"?"sdk-default-bar":D.type==="restaurant"?"sdk-default-restaurant":"sdk-default-poi"},type:"Feature"})),type:"FeatureCollection"}),[y]);return(0,py.jsx)(Ip,{data:l,id:"sdk-pois",type:"geojson",children:(0,py.jsx)(mh,{id:"sdk-poi-layer",layout:{"icon-allow-overlap":!0,"icon-image":["get","sdk-icon"],"icon-size":1,"text-anchor":"top","text-field":["step",["zoom"],"",14,["get","name"]],"text-font":["Open Sans Bold"],"text-offset":[0,1.5],"text-optional":!0,"text-size":11},paint:{"icon-opacity":["interpolate",["linear"],["zoom"],11,0,12,1],"text-color":"#ffffff","text-halo-color":"#000000","text-halo-width":1,"text-opacity":["interpolate",["linear"],["zoom"],13.5,0,14,1]},type:"symbol"})})};var Xa=tt(ni(),1),u5=({pois:i,onClick:a})=>{let u=i.filter(f=>f.displayMode==="marker");return u.length===0?null:(0,Xa.jsx)(Xa.Fragment,{children:u.map(f=>(0,Xa.jsx)(Rp,{anchor:"bottom",latitude:f.latitude,longitude:f.longitude,onClick:y=>{y.originalEvent.stopPropagation(),a&&a(f)},children:f.markerComponent?f.markerComponent:(0,Xa.jsxs)("div",{style:{cursor:"pointer",filter:"drop-shadow(0 4px 6px rgba(0,0,0,0.1))",transform:"transition-transform duration-200 hover:scale-110"},children:[(0,Xa.jsx)("div",{style:{alignItems:"center",backgroundColor:f.type==="bar"?"#f97316":"#10b981",border:"2px solid white",borderRadius:"50%",display:"flex",height:"32px",justifyContent:"center",width:"32px"},children:f.emoji?(0,Xa.jsx)("span",{style:{fontSize:"16px"},children:f.emoji}):(0,Xa.jsx)("div",{style:{backgroundColor:"white",borderRadius:"50%",height:"8px",width:"8px"}})}),(0,Xa.jsx)("div",{style:{borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:`8px solid ${f.type==="bar"?"#f97316":"#10b981"}`,height:0,margin:"-2px auto 0",width:0}})]})},f.id))})};var Ar=tt(ni(),1),h5=({forcedLocation:i,heading:a})=>i?(0,Ar.jsx)(Rp,{anchor:"center",latitude:i[1],longitude:i[0],children:(0,Ar.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"center",position:"relative"},children:[(0,Ar.jsx)("div",{style:{animation:"pulse 2s infinite",backgroundColor:"rgba(59, 130, 246, 0.4)",borderRadius:"50%",height:"40px",position:"absolute",width:"40px"}}),a!=null&&(0,Ar.jsx)("div",{style:{height:"60px",position:"absolute",transform:`rotate(${a}deg)`,width:"60px",zIndex:0},children:(0,Ar.jsxs)("svg",{style:{height:"100%",width:"100%"},viewBox:"0 0 100 100",children:[(0,Ar.jsx)("defs",{children:(0,Ar.jsxs)("radialGradient",{cx:"50%",cy:"50%",fx:"50%",fy:"50%",id:"grad1",r:"50%",children:[(0,Ar.jsx)("stop",{offset:"0%",style:{stopColor:"rgba(37, 99, 235, 0.6)",stopOpacity:1}}),(0,Ar.jsx)("stop",{offset:"100%",style:{stopColor:"rgba(37, 99, 235, 0)",stopOpacity:0}})]})}),(0,Ar.jsx)("path",{d:"M 50 50 L 35 0 A 50 50 0 0 1 65 0 Z",fill:"url(#grad1)"})]})}),(0,Ar.jsx)("div",{style:{alignItems:"center",backgroundColor:"white",borderRadius:"50%",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(37, 99, 235, 0.2)",display:"flex",height:"20px",justifyContent:"center",width:"20px",zIndex:1},children:(0,Ar.jsx)("div",{style:{backgroundColor:"#2563eb",border:"2px solid white",borderRadius:"50%",height:"12px",width:"12px"}})}),(0,Ar.jsx)("style",{children:"@keyframes pulse { 0% { transform: scale(0.95); opacity: 0.7; } 70% { transform: scale(1.5); opacity: 0; } 100% { transform: scale(0.95); opacity: 0; } }"})]})}):null;var nn=tt(ni(),1),jC=({initialViewState:i={latitude:45.90583599233422,longitude:6.12589018919138,zoom:12},style:a={},mapStyle:u="https://tiles.cloudparse.fr/style/up_dark_matter",className:f="",maxBounds:y,children:l,onClick:D,onMapClickMiss:B,onContextMenu:q,interactiveLayerIds:K=[],onLoad:fe,showUserLocation:pe=!0,followUser:oe=!1,showUserLocationButton:le=!0,renderUserLocation:Oe,pois:Ue=[],onPoiClick:ye,route:ce,showNavigationUI:se,navigationData:de,onNavigationAbort:ve,onNavigationModeChange:Le,navigation:Re,showControls:Z=!0,menuItems:Y,menuContent:ne,drawerState:xe,drawerContentRef:De,controlProps:nt={},enableTouchDrag:ze=!1})=>{let Be=(0,Lt.useContext)(_o),He=(0,Lt.useRef)(null),We=Dp(),[Ke,_t]=(0,Lt.useState)(null);(0,Lt.useEffect)(()=>{let Ut=Xi.on("SDK_NAVIGATION_CREATE",Dt=>{_t(Dt)}),Gi=Xi.on("SDK_NAVIGATION_START",()=>{_t(Dt=>Dt?{...Dt,mode:"navigation"}:null)}),xn=Xi.on("SDK_NAVIGATION_ABORT",()=>{_t(null)});return()=>{Ut(),Gi(),xn()}},[]);let lt=Ke||Re,jt=J_({destination:lt?.destination||null,enabled:!!lt?.destination,initialMode:lt?.mode||"preview",origin:lt?.origin,profile:lt?.profile||"driving",recalculateThreshold:lt?.recalculateThreshold||50});(0,Lt.useEffect)(()=>{Le&&Re&&Le(jt.mode)},[jt.mode,Le,Re]);let Kt=lt?jt:de,Qt=lt?jt.route?.geometry:ce,Gn=lt?.showUI!==!1&&(lt?!!lt.destination:se),ot=Kt?.mode||"preview",qt=Be?Be.isFollowing:oe,vn=(0,Lt.useRef)(qt),pi=(0,Lt.useRef)(!1),[sn,li]=(0,Lt.useState)(qt),Ii=Be?Be.isFollowing:sn,Xe=Be?.setIsFollowing,ft=(0,Lt.useCallback)(Ut=>{vn.current=Ut,li(Ut),Xe&&Xe(Ut)},[Xe]);(0,Lt.useEffect)(()=>{Be&&Be.isFollowing!==vn.current&&(vn.current=Be.isFollowing)},[Be?.isFollowing,Be]);let Gt=[...K];Ue.length>0&&!Gt.includes("sdk-poi-layer")&&Gt.push("sdk-poi-layer");let ci=(0,Lt.useRef)(oe);(0,Lt.useEffect)(()=>{oe!==ci.current&&(ft(oe),ci.current=oe,oe&&We.coords&&He.current&&(pi.current=!0,He.current.flyTo({center:We.coords,duration:1e3,essential:!0,zoom:Math.max(He.current.getZoom(),16)}),setTimeout(()=>{pi.current=!1},1050)))},[oe,ft,We.coords]);let zt=(0,Lt.useRef)(null);(0,Lt.useEffect)(()=>{if(!Qt||!He.current){Qt||(zt.current=null);return}let Ut=Qt!==zt.current;if(!(!Ut&&ot==="navigation")){if(ot==="navigation")ft(!0);else if(ot==="preview"&&Ut){ft(!1);let Gi=Qt.coordinates;if(Gi.length>0){let xn=Gi.reduce((Dt,Ui)=>[[Math.min(Dt[0][0],Ui[0]),Math.min(Dt[0][1],Ui[1])],[Math.max(Dt[1][0],Ui[0]),Math.max(Dt[1][1],Ui[1])]],[[Gi[0][0],Gi[0][1]],[Gi[0][0],Gi[0][1]]]);He.current.fitBounds([xn[0][0],xn[0][1],xn[1][0],xn[1][1]],{padding:100,speed:1.2})}}zt.current=Qt}},[Qt,ot,ft]),(0,Lt.useEffect)(()=>{vn.current&&!pi.current&&We.coords&&He.current&&He.current.easeTo({center:We.coords,duration:50,easing:Ut=>Ut,essential:!0})},[We.coords]);let Nt=ey(Qt,pe?We.coords:null),ki=Kt?.currentDistanceMeters??Kt?.route?.distanceMeters??0,Zn=Kt?.route?.durationSeconds?Math.ceil(Kt.route.durationSeconds/60):0,Hn=ki/1e3,Si=Kt?.totalDistance??0,Ki=Si>0?(Si-ki)/Si*100:0,xt=(0,Lt.useMemo)(()=>{if(!(!Kt||!Qt))return{distanceRemainingKm:Hn,etaMins:Zn,label:ot==="navigation"?"Walking Guidance Active":"Route Preview",mode:ot,onAbort:ve||(()=>{_t(null)}),onStart:Kt.start,progress:Ki}},[Kt,Qt,Zn,Hn,ot,Ki,ve]),_i=Be?.setEtaData;(0,Lt.useEffect)(()=>{_i&&_i(xt)},[xt,_i]);let Dn=Be?.setDrawerState;(0,Lt.useEffect)(()=>{Dn&&xe!==void 0&&Dn(xe)},[xe,Dn]);let Qa=(0,Lt.useMemo)(()=>[{icon:(0,nn.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,nn.jsx)("path",{d:"M12 11c0 3.517-1.009 6.799-2.753 9.571m-3.44-2.04l.054-.09A13.916 13.916 0 008 11a4 4 0 118 0c0 1.017-.07 2.019-.203 3m-2.118 6.844A21.88 21.88 0 0015.171 17m3.839 1.132c.645-2.266.99-4.659.99-7.132A8 8 0 008 4.07M3 15.364c.64-1.319 1-2.8 1-4.364 0-1.457.39-2.823 1.07-4",strokeLinecap:"round",strokeLinejoin:"round"})}),id:"walking",label:"Walking Mode",onPress:()=>{}}],[]),ha=Y||Qa,{mapLibreChildren:As,menuContentFromChildren:zo}=(0,Lt.useMemo)(()=>{let Ut=[],Gi=[];Lt.default.Children.forEach(l,Dt=>{if(Lt.default.isValidElement(Dt)){let Ui=Dt.type,da=Ui?.displayName||Ui?.name,Ja=Ui===Ap||da==="MapMenu",eo=Ja||Ui===g0||Ui===_0||Ui===y0||Ui===v0||["MapMenuItem","MapMenuTitle","MapMenuDivider","MapMenuFooter"].includes(da);Ja?Lt.default.Children.forEach(Dt.props.children,Po=>{Po&&Gi.push(Po)}):eo?Gi.push(Dt):Ut.push(Dt)}else Ut.push(Dt)});let xn=Gi.length>0?(0,nn.jsx)(Ap,{children:Gi}):null;return{mapLibreChildren:Ut,menuContentFromChildren:xn}},[l]),$c=Ut=>{let Gi=Ut.features||[];if(ye){let Dt=Gi.find(Ui=>Ui.layer.id==="sdk-poi-layer");if(Dt){ye(Dt.properties);return}}Gi.some(Dt=>Gt.includes(Dt.layer.id))||B&&B(Ut),D&&D(Ut)},Do=(0,Lt.useCallback)(Ut=>{We.coords&&He.current&&(ft(!0),pi.current=!0,He.current.flyTo({center:We.coords,duration:1e3,essential:!0,pitch:Ut?.pitch||0,zoom:Math.max(He.current.getZoom(),16)}),setTimeout(()=>{pi.current=!1},1050))},[We.coords,ft]),Gr=(0,Lt.useCallback)(Ut=>{He.current&&He.current.easeTo({bearing:0,duration:500,essential:!0,pitch:Ut?.pitch??0})},[]);(0,Lt.useEffect)(()=>{Be&&(Be._registerCenterCallback(Do),Be._registerResetBearingCallback(Gr))},[Be,Do,Gr]);let Zr=(0,Lt.useCallback)(()=>{He.current&&Be&&(Be.setBearing(He.current.getBearing()),Be.setPitch(He.current.getPitch()))},[Be]),bn=()=>{vn.current&&(console.log("[SDK:Map] Manual interaction detected. Halting tracking."),ft(!1),He.current&&He.current.stop())};return(0,nn.jsxs)("div",{className:`w-full h-full overflow-hidden relative ${f}`,style:a,children:[(0,nn.jsxs)(hy,{attributionControl:!1,initialViewState:i,interactiveLayerIds:Gt,mapStyle:u,maxBounds:y,onClick:$c,onContextMenu:q,onDragStart:bn,onLoad:Ut=>{fe&&fe(Ut),oe&&We.coords&&He.current&&He.current.jumpTo({center:We.coords,zoom:16})},onMouseDown:bn,onMove:Zr,onTouchStart:bn,onWheel:bn,ref:He,children:[pe&&We.coords&&(Oe?Oe({coords:We.coords,heading:We.heading}):(0,nn.jsx)(h5,{forcedLocation:We.coords,heading:We.heading})),Nt&&(0,nn.jsx)(dy,{geometry:Nt}),Ue.length>0&&(0,nn.jsxs)(nn.Fragment,{children:[(0,nn.jsx)(c5,{pois:Ue}),(0,nn.jsx)(u5,{onClick:ye,pois:Ue})]}),As]}),Z&&Be&&!Be.hasControls&&(0,nn.jsx)(K_,{drawerContentRef:De,enableTouchDrag:ze,etaData:xt,initialViewState:i,isInternal:!0,menuContent:ne||zo,menuItems:ha,...nt})]})},qC=({children:i})=>(0,Lt.useContext)(_o)?(0,nn.jsx)(nn.Fragment,{children:i}):(0,nn.jsx)(W_,{children:i}),fy=i=>(0,nn.jsx)(qC,{children:(0,nn.jsx)(ty,{children:(0,nn.jsx)(jC,{...i})})});var NS=tt(Rt(),1),US=tt(FS(),1);function $b(i,a={}){let u=document.getElementById(i);if(!u)throw new Error(`Container with id "${i}" not found.`);let f=(0,US.createRoot)(u);return f.render(NS.default.createElement(fy,a)),f}var o1={createErrorResponse(i,a,u){return{error:{code:a,message:u},requestId:i.requestId,sdkVersion:i.sdkVersion,success:!1,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},decodePolyline(i,a){let u=0,f=0,y=0,l=[],D=10**a;for(;u<i.length;){let B,q=0,K=0;do B=i.charCodeAt(u++)-63,K|=(B&31)<<q,q+=5;while(B>=32);let fe=K&1?~(K>>1):K>>1;f+=fe,q=0,K=0;do B=i.charCodeAt(u++)-63,K|=(B&31)<<q,q+=5;while(B>=32);let pe=K&1?~(K>>1):K>>1;y+=pe,l.push([y/D,f/D])}return l},async fetchOSRMRoute(i,a,u,f){let y=a.map(pe=>`${pe[0]},${pe[1]}`).join(";"),D=`${f}/route/v1/${u==="walking"?"foot":u==="driving"?"car":"bike"}/${y}?overview=full&geometries=geojson&steps=true`,B=await fetch(D);if(!B.ok)throw new Error(`OSRM Error: ${B.statusText}`);let q=await B.json();if(q.code!=="Ok"||!q.routes||q.routes.length===0)throw new Error("NO_ROUTE");let K=q.routes[0],fe=K.legs?.flatMap(pe=>pe.steps?.map(oe=>({distance:oe.distance,duration:oe.duration,instruction:oe.maneuver?.instruction||"Continue"})))||[];return{data:{distanceMeters:K.distance,durationSeconds:K.duration,geometry:K.geometry,steps:fe},requestId:i.requestId,sdkVersion:i.sdkVersion,success:!0,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},async fetchRoute(i,a){let{origin:u,destination:f,waypoints:y,profile:l,language:D}=i.payload;if(!this.isValidCoordinate(u)||!this.isValidCoordinate(f))return this.createErrorResponse(i,"INVALID_INPUT","Origin or destination coordinates are invalid.");if(y&&!y.every(this.isValidCoordinate))return this.createErrorResponse(i,"INVALID_INPUT","One or more waypoints are invalid.");let B=[u,...y||[],f];try{return a.backend==="osrm"?await this.fetchOSRMRoute(i,B,l,a.baseUrl):await this.fetchValhallaRoute(i,B,l,D,a.baseUrl)}catch(q){return q instanceof Error&&q.message.includes("NO_ROUTE")?this.createErrorResponse(i,"NO_ROUTE","No route could be found for the given points."):q instanceof TypeError?this.createErrorResponse(i,"NETWORK_ERROR","Failed to connect to the routing backend."):this.createErrorResponse(i,"BACKEND_ERROR",`Routing backend error: ${q instanceof Error?q.message:"Unknown error"}`)}},async fetchValhallaRoute(i,a,u,f,y){let D={costing:u==="driving"?"auto":u==="walking"?"pedestrian":"bicycle",directions_options:{language:f||"en-US"},locations:a.map(oe=>({lat:oe[1],lon:oe[0]}))},B=await fetch(`${y}/route`,{body:JSON.stringify(D),headers:{"Content-Type":"application/json"},method:"POST"});if(!B.ok)throw new Error(`Valhalla Error: ${B.statusText}`);let q=await B.json();if(!q.trip||!q.trip.legs||q.trip.legs.length===0)throw new Error("NO_ROUTE");let K=q.trip,fe=this.decodePolyline(K.legs[0].shape,6),pe=K.legs.flatMap(oe=>oe.maneuvers?.map(le=>({distance:le.length*1e3,duration:le.time,instruction:le.instruction||"Continue"})))||[];return{data:{distanceMeters:K.summary.length*1e3,durationSeconds:K.summary.time,geometry:{coordinates:fe,type:"LineString"},steps:pe},requestId:i.requestId,sdkVersion:i.sdkVersion,success:!0,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},isValidCoordinate(i){let[a,u]=i;return a>=-180&&a<=180&&u>=-90&&u<=90}};var Of="0.2.1";function VS(i){let a=Object.getOwnPropertyNames(i);for(let u of a){let f=i[u];f&&typeof f=="object"&&!Object.isFrozen(f)&&!(f instanceof Cp)&&VS(f)}return Object.freeze(i)}var Xb=null,Bf=class{maps=Object.freeze({render:$b});bridge;storage=Object.freeze({get:a=>this.bridge.send("STORAGE_GET",{key:a}),getAll:()=>this.bridge.send("STORAGE_GET_ALL"),set:(a,u)=>this.bridge.send("STORAGE_SET",{key:a,value:u})});secureStore=Object.freeze({get:a=>this.bridge.send("SECURE_GET",{key:a}),set:(a,u)=>this.bridge.send("SECURE_SET",{key:a,value:u})});database=Object.freeze({getUserData:()=>this.bridge.send("DATABASE_GET_USER_DATA"),setUserData:a=>this.bridge.send("DATABASE_SET_USER_DATA",{data:a})});location=Object.freeze({getCurrentPosition:()=>this.bridge.send("GET_CURRENT_POSITION"),startStream:a=>this.bridge.send("START_LOCATION_STREAM",a),stopStream:()=>this.bridge.send("STOP_LOCATION_STREAM")});user=Object.freeze({getProfile:a=>this.bridge.send("GET_USER_PROFILE",{fields:a})});permission=Object.freeze({request:((a,u)=>this.bridge.send("REQUEST_PERMISSION",{fields:u,type:a}))});payment=Object.freeze({request:a=>this.bridge.send("PAYMENT_REQUEST",a)});activity=Object.freeze({start:(a,u,f)=>this.bridge.send("START_ACTIVITY",{id:a,status:f,title:u})});haptic=Object.freeze({trigger:a=>this.bridge.send("TRIGGER_HAPTIC",{style:a})});network=Object.freeze({request:async a=>this.bridge.send("NETWORK_REQUEST",a)});navigation=Object.freeze({abort:()=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_ABORT",type:"EVENT"})},createJourney:a=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_CREATE",payload:{...a,mode:"preview"},type:"EVENT"})},start:()=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_START",type:"EVENT"})}});fidelity=Object.freeze({getFidelityBalance:()=>this.bridge.send("GET_FIDELITY_BALANCE"),getFidelityHistory:a=>this.bridge.send("GET_FIDELITY_HISTORY",a),showHistory:()=>this.bridge.send("SHOW_FIDELITY_HISTORY"),spendFPoints:a=>this.bridge.send("SPEND_FPOINTS",{intentUuid:a})});ui=Object.freeze({exit:()=>this.bridge.send("EXIT"),setScrollConfig:a=>this.bridge.send("SET_SCROLL_CONFIG",a)});debug=Object.freeze({log:(...a)=>this.bridge.send("DEBUG_LOG",{message:a})});routing=Object.freeze({clearRoute:()=>{let a=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2);return this.bridge.send("SDK_ROUTING_CLEARROUTE",{requestId:a,sdkVersion:Of})},drawRoute:a=>{let u=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2);return this.bridge.send("SDK_ROUTING_DRAWROUTE",{payload:{routeData:a},requestId:u,sdkVersion:Of})},getRoute:async a=>{let u=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2),f={payload:a,requestId:u,sdkVersion:Of,type:"SDK_ROUTING_GETROUTE"};if(Xb){let y=await o1.fetchRoute(f,Xb);if(y.success&&y.data)return y.data;throw new Error(y.error?.message||"Routing failed")}return this.bridge.send("SDK_ROUTING_GETROUTE",{payload:a,requestId:u,sdkVersion:Of})}});constructor(){this.bridge=new Cp,this.initialize=this.initialize.bind(this),this.on=this.on.bind(this),this.off=this.off.bind(this)}config(a){a.routingBackend&&(Xb=a.routingBackend)}updateContext(a){return this.bridge.send("UPDATE_CONTEXT",a)}initialize(a){return this.bridge.send("INITIALIZE",a)}on(a,u){return this.bridge.on(a,u)}off(a,u){this.bridge.off(a,u)}},Xi=VS(new Bf);var on=tt(Rt(),1),St=tt(ni(),1),_z=(i,a)=>{let u=i[1]*Math.PI/180,f=a[1]*Math.PI/180,y=(a[0]-i[0])*Math.PI/180,l=Math.sin(y)*Math.cos(f),D=Math.cos(u)*Math.sin(f)-Math.sin(u)*Math.cos(f)*Math.cos(y);return(Math.atan2(l,D)*180/Math.PI+360)%360},Yb=({appId:i,initialLocation:a=[6.1258,45.9058],isMoving:u=!1,simulationPath:f,simulationSpeed:y=1,mockJWTToken:l,children:D})=>{let[B,q]=(0,on.useState)(u),[K,fe]=(0,on.useState)(a),[pe,oe]=(0,on.useState)(0),[le,Oe]=(0,on.useState)(y),[Ue,ye]=(0,on.useState)(!1),[ce,se]=(0,on.useState)(!0),de=(0,on.useRef)(null),ve=(0,on.useRef)(0),Le=(0,on.useRef)(null),Re=(0,on.useRef)({autoMove:B,heading:pe,location:K,mockJWTToken:l,pushLocationUpdate:()=>{},setHeading:oe,setLocation:fe,simulationPath:f,speedMultiplier:le}),Z=(0,on.useCallback)(()=>{let Y=Re.current,ne={accelerometer:null,heading:{accuracy:3,magneticHeading:Y.heading,trueHeading:Y.heading},location:{coords:{accuracy:10,altitude:0,altitudeAccuracy:null,heading:Y.heading,latitude:Y.location[1],longitude:Y.location[0],speed:Y.autoMove?1.5*Y.speedMultiplier:0},timestamp:Date.now()},timestamp:Date.now()};window.__MiniAppBridge?.onNativeMessage({eventName:"LOCATION_STREAM_UPDATE",payload:ne,type:"EVENT"})},[]);return(0,on.useEffect)(()=>{Re.current={autoMove:B,heading:pe,location:K,mockJWTToken:l,pushLocationUpdate:Z,setHeading:oe,setLocation:fe,simulationPath:f,speedMultiplier:le}},[K,pe,B,Z,f,le,l]),(0,on.useEffect)(()=>{q(u)},[u]),(0,on.useEffect)(()=>{Oe(y)},[y]),(0,on.useEffect)(()=>{f&&f.length>0&&(ve.current=0,fe(f[0]))},[f]),(0,on.useEffect)(()=>{de.current&&Le.current&&Xi.bridge.send("START_LOCATION_STREAM",Le.current)},[le]),(0,on.useEffect)(()=>{let Y=Xi.bridge,ne=Y.send.bind(Y),xe=()=>{de.current&&(clearInterval(de.current),de.current=null),Le.current=null},De=ze=>{xe(),Le.current=ze||{};let Be=ze?.interval||500,He=Math.max(10,Be/Re.current.speedMultiplier);de.current=setInterval(()=>{let We=Re.current;if(We.autoMove)if(We.simulationPath&&We.simulationPath.length>0)if(ve.current<We.simulationPath.length-1){let Ke=We.simulationPath[ve.current],_t=We.simulationPath[ve.current+1];ve.current+=1;let lt=_z(Ke,_t);We.setHeading(lt),We.setLocation(_t)}else We.setLocation(We.simulationPath[We.simulationPath.length-1]);else We.setLocation(Ke=>[Ke[0]+(Math.random()-.5)*1e-4,Ke[1]+(Math.random()-.5)*1e-4]);We.pushLocationUpdate()},He)},nt=async ze=>{let{url:Be,method:He="GET",headers:We={},body:Ke}=ze,_t=Re.current,lt=new Headers(We);_t.mockJWTToken&&lt.set("Authorization",`Bearer ${_t.mockJWTToken.replace("Bearer ","")}`),Ke&&typeof Ke=="object"&&!lt.has("Content-Type")&&lt.set("Content-Type","application/json");try{let jt=await fetch(Be,{body:Ke?typeof Ke=="string"?Ke:JSON.stringify(Ke):void 0,headers:lt,method:He}),Kt=jt.headers.get("content-type"),Qt;Kt?.includes("application/json")?Qt=await jt.json():Qt=await jt.text();let Gn={};return jt.headers.forEach((ot,qt)=>{Gn[qt]=ot}),{data:Qt,headers:Gn,status:jt.status,statusText:jt.statusText}}catch(jt){throw{error:jt.message||"Network request failed",status:0}}};return Y.send=async(ze,Be)=>{if(ze==="INITIALIZE")return Promise.resolve({appId:i,context:{theme:"dark"},description:"Mocked for Dev",env:{},insets:{bottom:0,left:0,right:0,top:0},name:"Vite Dev (Mock)",params:{},profile:{countryCode:"FR",email:"caveman@up.app",fullName:"Smart Caveman",localNumber:"0600000000",username:"smart_caveman",uuid:"mock-user-42"},success:!0,userData:{},uuid:i||"mock-app-id",version:"1.0.0"});if(ze==="GET_CURRENT_POSITION"){let He=Re.current;return Promise.resolve({coords:{accuracy:10,altitude:0,altitudeAccuracy:0,heading:He.heading,latitude:He.location[1],longitude:He.location[0],speed:He.autoMove?1.5*He.speedMultiplier:0},timestamp:Date.now()})}return ze==="START_LOCATION_STREAM"?(De(Be),Promise.resolve()):ze==="STOP_LOCATION_STREAM"?(xe(),Promise.resolve()):ze==="NETWORK_REQUEST"?nt(Be):ze==="STORAGE_GET"||ze==="SECURE_GET"?Promise.resolve(localStorage.getItem(`mock_sdk_${Be.key}`)):ze==="STORAGE_SET"||ze==="SECURE_SET"?(localStorage.setItem(`mock_sdk_${Be.key}`,Be.value),Promise.resolve()):ze==="GET_USER_PROFILE"?Promise.resolve({countryCode:"FR",email:"caveman@up.app",fullName:"Smart Caveman",localNumber:"0600000000",username:"smart_caveman",uuid:"mock-user-42"}):ze==="GET_FIDELITY_BALANCE"?Promise.resolve({balance:1337,currency:"FPoints"}):ze==="PAYMENT_REQUEST"?Promise.resolve({success:!0,transactionId:`tx_${Math.random().toString(36).slice(2)}`}):ze==="TRIGGER_HAPTIC"||ze==="EXIT"||ze==="UPDATE_CONTEXT"?Promise.resolve({success:!0}):ne(ze,Be)},ye(!0),()=>{xe(),Y.send=ne}},[i]),Ue?(0,St.jsxs)("div",{className:"relative w-full h-full",children:[(0,St.jsx)("div",{className:"w-full h-full",children:D}),ce?(0,St.jsx)("button",{className:"fixed bottom-4 right-4 w-8 h-8 rounded-full bg-slate-900/60 backdrop-blur-sm border border-slate-700/50 flex items-center justify-center text-slate-400 hover:text-blue-400 z-[9999] transition-all shadow-lg group",onClick:()=>se(!1),title:"Open Simulation Controls",type:"button",children:(0,St.jsxs)("svg",{className:"group-hover:scale-110 transition-transform",fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"14",xmlns:"http://www.w3.org/2000/svg",children:[(0,St.jsx)("path",{d:"M21 4H3"}),(0,St.jsx)("path",{d:"M10 8H3"}),(0,St.jsx)("path",{d:"M21 12H3"}),(0,St.jsx)("path",{d:"M10 16H3"}),(0,St.jsx)("path",{d:"M21 20H3"}),(0,St.jsx)("circle",{cx:"14",cy:"8",r:"2"}),(0,St.jsx)("circle",{cx:"14",cy:"16",r:"2"})]})}):(0,St.jsxs)("div",{className:"fixed bottom-4 right-4 bg-slate-900 text-slate-300 font-mono text-xs rounded-xl shadow-2xl border border-slate-700 pointer-events-auto flex flex-col w-80 overflow-hidden animate-in slide-in-from-right duration-300",style:{zIndex:9998},children:[(0,St.jsxs)("div",{className:"flex justify-between items-center p-3 border-b border-slate-800 cursor-pointer bg-slate-800/50 hover:bg-slate-800 transition-colors",onClick:()=>se(!0),children:[(0,St.jsxs)("span",{className:"font-bold text-slate-100 flex items-center gap-2",children:[(0,St.jsx)("span",{className:"text-lg",children:"\u{1F6E0}\uFE0F"})," Simulation Controls"]}),(0,St.jsx)("button",{className:"text-slate-500 hover:text-white",type:"button",children:"\u25BC"})]}),(0,St.jsxs)("div",{className:"p-4 flex flex-col gap-3",children:[(0,St.jsxs)("div",{className:"flex justify-between items-center",children:[(0,St.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,St.jsx)("input",{checked:B,className:"accent-blue-500 w-4 h-4",onChange:Y=>q(Y.target.checked),type:"checkbox"}),(0,St.jsxs)("span",{className:"text-slate-200 font-bold",children:["Auto-Move ",f?"(Path)":"(Random)"]})]}),(0,St.jsxs)("div",{className:"flex items-center gap-2",children:[(0,St.jsx)("span",{className:"text-[10px] text-slate-500",children:"Speed:"}),(0,St.jsx)("select",{className:"bg-slate-800 border border-slate-700 rounded px-1 py-0.5 text-white focus:outline-none focus:border-blue-500 text-[10px]",onChange:Y=>Oe(Number(Y.target.value)),value:le,children:[1,2,5,10,50,100,250].map(Y=>(0,St.jsxs)("option",{value:Y,children:[Y,"x"]},Y))})]})]}),(0,St.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,St.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,St.jsx)("span",{className:"text-[10px] text-slate-500 text-left",children:"Lng"}),(0,St.jsx)("input",{className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-white focus:outline-none focus:border-blue-500",onChange:Y=>{let ne=parseFloat(Y.target.value)||0;fe([ne,K[1]]),Z()},step:"0.001",type:"number",value:K[0]})]}),(0,St.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,St.jsx)("span",{className:"text-[10px] text-slate-500 text-left",children:"Lat"}),(0,St.jsx)("input",{className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-white focus:outline-none focus:border-blue-500",onChange:Y=>{let ne=parseFloat(Y.target.value)||0;fe([K[0],ne]),Z()},step:"0.001",type:"number",value:K[1]})]}),(0,St.jsxs)("div",{className:"flex flex-col gap-1 col-span-2",children:[(0,St.jsx)("span",{className:"text-[10px] text-slate-500",children:"Heading (Degrees)"}),(0,St.jsx)("input",{className:"w-full accent-blue-500",max:"360",min:"0",onChange:Y=>{oe(parseInt(Y.target.value,10)),Z()},type:"range",value:pe}),(0,St.jsxs)("div",{className:"text-right text-slate-400",children:[pe,"\xB0"]})]})]})]})]})]}):null};var Ao=tt(Rt(),1),si=tt(ni(),1),Wb=({isOpen:i=!1,onClose:a})=>{let[u,f]=(0,Ao.useState)(i),[y,l]=(0,Ao.useState)([]),D=(0,Ao.useRef)(null);(0,Ao.useEffect)(()=>{f(i)},[i]);let B=()=>l([]),q=(0,Ao.useCallback)((K,fe)=>{if(K.includes("LOCATION_STREAM_UPDATE"))return;let pe={content:typeof fe=="string"?fe:JSON.stringify(fe,null,2),id:Math.random().toString(36).slice(2),label:K,time:new Date().toLocaleTimeString()};l(oe=>[pe,...oe].slice(0,100))},[]);return(0,Ao.useEffect)(()=>{if(typeof window>"u")return;let K=Xi.bridge,fe=K.send.bind(K);K.send=async(oe,le)=>(q(`OUT: ${oe}`,le),fe(oe,le));let pe=K.handleNativeMessage.bind(K);return K.handleNativeMessage=oe=>{let le=oe.eventName||oe.event||oe.type||"MSG";typeof le=="string"&&(q(`IN: ${le}`,oe.payload||oe.value||oe),pe(oe))},()=>{K.send=fe,K.handleNativeMessage=pe}},[q]),u?(0,si.jsxs)("div",{className:"fixed inset-x-0 bottom-0 w-full bg-[#0a080f] border-t border-slate-800 z-[9998] p-4 shadow-2xl flex flex-col animate-in slide-in-from-bottom duration-300",children:[(0,si.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,si.jsxs)("span",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-400 flex items-center gap-2",children:[(0,si.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),"UP SDK Debug Console"]}),(0,si.jsxs)("div",{className:"flex gap-4",children:[(0,si.jsx)("button",{className:"text-[10px] text-slate-500 font-bold uppercase hover:text-slate-300 transition-colors",onClick:B,type:"button",children:"Clear"}),(0,si.jsx)("button",{className:"text-[10px] text-pink-500 font-bold uppercase hover:underline transition-colors",onClick:()=>{f(!1),a&&a()},type:"button",children:"Close"})]})]}),(0,si.jsx)("div",{className:"bg-black/80 rounded-xl p-3 font-mono text-[10px] text-emerald-400 min-h-[120px] max-h-[240px] overflow-y-auto border border-slate-900 custom-scrollbar",ref:D,children:y.length===0?(0,si.jsx)("div",{className:"text-slate-600 italic text-center py-8",children:"No logs yet. Interacting with the SDK will show events here."}):y.map(K=>(0,si.jsxs)("div",{className:"mb-3 pb-3 border-b border-slate-900/50 last:border-0 last:mb-0 last:pb-0",children:[(0,si.jsxs)("div",{className:"flex gap-2 text-slate-500 mb-1 items-center",children:[(0,si.jsx)("span",{className:"text-[8px]",children:K.time}),(0,si.jsx)("span",{className:"font-bold text-white uppercase text-[8px] bg-slate-800 px-1.5 py-0.5 rounded leading-none",children:K.label})]}),(0,si.jsx)("pre",{className:"whitespace-pre-wrap break-all opacity-90",children:K.content})]},K.id))})]}):(0,si.jsx)("button",{className:"fixed bottom-4 left-4 w-8 h-8 rounded-full bg-slate-900/60 backdrop-blur-sm border border-slate-700/50 flex items-center justify-center text-slate-400 hover:text-emerald-400 transition-all z-[9998] shadow-lg group",onClick:()=>f(!0),title:"Open Debug Console",type:"button",children:(0,si.jsxs)("svg",{className:"group-hover:scale-110 transition-transform",fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"14",xmlns:"http://www.w3.org/2000/svg",children:[(0,si.jsx)("path",{d:"m8 2 1.88 1.88"}),(0,si.jsx)("path",{d:"M14.12 3.88 16 2"}),(0,si.jsx)("path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"}),(0,si.jsx)("path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"}),(0,si.jsx)("path",{d:"M12 20v-9"}),(0,si.jsx)("path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5"}),(0,si.jsx)("path",{d:"M6 13H2"}),(0,si.jsx)("path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4"}),(0,si.jsx)("path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4"}),(0,si.jsx)("path",{d:"M22 13h-4"}),(0,si.jsx)("path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4"})]})})};var od=tt(Rt(),1);var Cs=tt(ni(),1),Kb=(0,od.createContext)({isMocked:!1}),yz=()=>(0,od.useContext)(Kb).isMocked,vz=({children:i,debug:a=!1,...u})=>{let f=typeof window<"u"&&!(window.__UP_REACT_NATIVE_APP__===!0||window.ReactNativeWebView),y=(0,od.useMemo)(()=>({isMocked:f}),[f]),l=(0,Cs.jsxs)(Cs.Fragment,{children:[i,a&&(0,Cs.jsx)(Wb,{})]});return f?(0,Cs.jsx)(Kb.Provider,{value:y,children:(0,Cs.jsx)(Yb,{...u,children:l})}):(0,Cs.jsx)(Kb.Provider,{value:y,children:l})};async function bz(i,a){return o1.fetchRoute(i,a)}function xz(i,a,u){let f=`sdk-route-${a}`,y=`sdk-route-casing-${a}`,l=`sdk-route-line-${a}`,D={features:[{geometry:u.payload.routeData.geometry,properties:{},type:"Feature"}],type:"FeatureCollection"},B=i.getSource(f);B?B.setData(D):(i.addSource(f,{data:D,type:"geojson"}),i.addLayer({id:y,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#111111","line-opacity":.8,"line-width":8},source:f,type:"line"}),i.addLayer({id:l,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":4},source:f,type:"line"}))}function wz(i,a){let u=`sdk-route-${a}`,f=`sdk-route-casing-${a}`,y=`sdk-route-line-${a}`;i.getLayer(y)&&i.removeLayer(y),i.getLayer(f)&&i.removeLayer(f),i.getSource(u)&&i.removeSource(u)}var Tz=Xi;return jE(Sz);})();
817
+ /*! Bundled license information:
818
+
819
+ react/cjs/react.production.js:
820
+ (**
821
+ * @license React
822
+ * react.production.js
823
+ *
824
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
825
+ *
826
+ * This source code is licensed under the MIT license found in the
827
+ * LICENSE file in the root directory of this source tree.
828
+ *)
829
+
830
+ react/cjs/react-jsx-runtime.production.js:
831
+ (**
832
+ * @license React
833
+ * react-jsx-runtime.production.js
834
+ *
835
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
836
+ *
837
+ * This source code is licensed under the MIT license found in the
838
+ * LICENSE file in the root directory of this source tree.
839
+ *)
840
+
841
+ maplibre-gl/dist/maplibre-gl.js:
842
+ (**
843
+ * MapLibre GL JS
844
+ * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.24.0/LICENSE.txt
845
+ *)
846
+
847
+ react-dom/cjs/react-dom.production.js:
848
+ (**
849
+ * @license React
850
+ * react-dom.production.js
851
+ *
852
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
853
+ *
854
+ * This source code is licensed under the MIT license found in the
855
+ * LICENSE file in the root directory of this source tree.
856
+ *)
857
+
858
+ scheduler/cjs/scheduler.production.js:
859
+ (**
860
+ * @license React
861
+ * scheduler.production.js
862
+ *
863
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
864
+ *
865
+ * This source code is licensed under the MIT license found in the
866
+ * LICENSE file in the root directory of this source tree.
867
+ *)
868
+
869
+ react-dom/cjs/react-dom-client.production.js:
870
+ (**
871
+ * @license React
872
+ * react-dom-client.production.js
873
+ *
874
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
875
+ *
876
+ * This source code is licensed under the MIT license found in the
877
+ * LICENSE file in the root directory of this source tree.
878
+ *)
879
+ */
2
880
  //# sourceMappingURL=index.browser.min.js.map