diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_config.yaml similarity index 50% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_config.yaml index b1f2e8a..a561d91 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_config.yaml @@ -1,4 +1,11 @@ # this sets the mac address source to eth0, replacing the previous code that derived a seed from the CPU s/n. # of course, eth0 also has its mac address derived from CPU s/n, but this way meshtastic uses the exact mac address, instead of a bastardized version converted to a 9 digit int with `| bc | tail -c -9`. General: - MACAddressSource: eth0 \ No newline at end of file + MACAddressSource: eth0 + +# this activates the webserver +Webserver: + Port: 443 # Port for Webserver & Webservices + RootPath: /usr/share/meshtasticd/web # Root Dir of WebServer + SSLKey: /etc/meshtasticd/ssl/private_key.pem # Path to SSL Key, generated if> + SSLCert: /etc/meshtasticd/ssl/certificate.pem # Pa diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_Black.svg b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_Black.svg deleted file mode 100644 index e0f9bb1..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_Black.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_White.svg b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_White.svg deleted file mode 100644 index b1bcd57..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/Logo_White.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/apple-touch-icon.png b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/apple-touch-icon.png deleted file mode 100644 index 31e2210..0000000 Binary files a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/apple-touch-icon.png and /dev/null differ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/favicon.ico b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/favicon.ico deleted file mode 100644 index 2a1cdfc..0000000 Binary files a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/favicon.ico and /dev/null differ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/icon.svg b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/icon.svg deleted file mode 100644 index e6863f6..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/icon.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - -Created with Fabric.js 4.6.0 - - - - - - - - - - - - \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-b9vwykds.js b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-b9vwykds.js deleted file mode 100644 index 4925735..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-b9vwykds.js +++ /dev/null @@ -1,441 +0,0 @@ -function lE(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();var _t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var D1={exports:{}},Tu={},L1={exports:{}},Me={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Zs=Symbol.for("react.element"),cE=Symbol.for("react.portal"),uE=Symbol.for("react.fragment"),dE=Symbol.for("react.strict_mode"),fE=Symbol.for("react.profiler"),pE=Symbol.for("react.provider"),mE=Symbol.for("react.context"),hE=Symbol.for("react.forward_ref"),gE=Symbol.for("react.suspense"),vE=Symbol.for("react.memo"),yE=Symbol.for("react.lazy"),Ng=Symbol.iterator;function bE(e){return e===null||typeof e!="object"?null:(e=Ng&&e[Ng]||e["@@iterator"],typeof e=="function"?e:null)}var j1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},F1=Object.assign,B1={};function Mi(e,t,n){this.props=e,this.context=t,this.refs=B1,this.updater=n||j1}Mi.prototype.isReactComponent={};Mi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Mi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function $1(){}$1.prototype=Mi.prototype;function Mp(e,t,n){this.props=e,this.context=t,this.refs=B1,this.updater=n||j1}var Ap=Mp.prototype=new $1;Ap.constructor=Mp;F1(Ap,Mi.prototype);Ap.isPureReactComponent=!0;var Pg=Array.isArray,U1=Object.prototype.hasOwnProperty,Rp={current:null},V1={key:!0,ref:!0,__self:!0,__source:!0};function z1(e,t,n){var r,o={},a=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(a=""+t.key),t)U1.call(t,r)&&!V1.hasOwnProperty(r)&&(o[r]=t[r]);var s=arguments.length-2;if(s===1)o.children=n;else if(1{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Eu(e){const t=e[De];return t?t.type_:Array.isArray(e)?1:Nu(e)?2:Pu(e)?3:0}function Uf(e,t){return Eu(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function X1(e,t,n){const r=Eu(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function AE(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Nu(e){return e instanceof Map}function Pu(e){return e instanceof Set}function ht(e){return e.copy_||e.base_}function Vf(e,t){if(Nu(e))return new Map(e);if(Pu(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=q1(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[De];let o=Reflect.ownKeys(r);for(let a=0;a1&&(e.set=e.add=e.clear=e.delete=RE),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Op(r,!0))),e}function RE(){vn(2)}function Mu(e){return Object.isFrozen(e)}var zf={};function qo(e){const t=zf[e];return t||vn(0,e),t}function IE(e,t){zf[e]||(zf[e]=t)}var ks;function Rc(){return ks}function OE(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Rg(e,t){t&&(qo("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Hf(e){Wf(e),e.drafts_.forEach(DE),e.drafts_=null}function Wf(e){e===ks&&(ks=e.parent_)}function Ig(e){return ks=OE(ks,e)}function DE(e){const t=e[De];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Og(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[De].modified_&&(Hf(t),vn(4)),_r(e)&&(e=Ic(t,e),t.parent_||Oc(t,e)),t.patches_&&qo("Patches").generateReplacementPatches_(n[De].base_,e,t.patches_,t.inversePatches_)):e=Ic(t,n,[]),Hf(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==K1?e:void 0}function Ic(e,t,n){if(Mu(t))return t;const r=t[De];if(!r)return xs(t,(o,a)=>Dg(e,r,t,o,a,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Oc(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let a=o,i=!1;r.type_===3&&(a=new Set(o),o.clear(),i=!0),xs(a,(s,l)=>Dg(e,r,o,s,l,n,i)),Oc(e,o,!1),n&&e.patches_&&qo("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Dg(e,t,n,r,o,a,i){if(gi(o)){const s=a&&t&&t.type_!==3&&!Uf(t.assigned_,r)?a.concat(r):void 0,l=Ic(e,o,s);if(X1(n,r,l),gi(l))e.canAutoFreeze_=!1;else return}else i&&n.add(o);if(_r(o)&&!Mu(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ic(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Oc(e,o)}}function Oc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Op(t,n)}function LE(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Rc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,a=Dp;n&&(o=[r],a=Cs);const{revoke:i,proxy:s}=Proxy.revocable(o,a);return r.draft_=s,r.revoke_=i,s}var Dp={get(e,t){if(t===De)return e;const n=ht(e);if(!Uf(n,t))return jE(e,n,t);const r=n[t];return e.finalized_||!_r(r)?r:r===Md(e.base_,t)?(Ad(e),e.copy_[t]=Ss(r,e)):r},has(e,t){return t in ht(e)},ownKeys(e){return Reflect.ownKeys(ht(e))},set(e,t,n){const r=Y1(ht(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Md(ht(e),t),a=o?.[De];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(AE(n,o)&&(n!==void 0||Uf(e.base_,t)))return!0;Ad(e),mr(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Md(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ad(e),mr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ht(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){vn(11)},getPrototypeOf(e){return hi(e.base_)},setPrototypeOf(){vn(12)}},Cs={};xs(Dp,(e,t)=>{Cs[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Cs.deleteProperty=function(e,t){return Cs.set.call(this,e,t,void 0)};Cs.set=function(e,t,n){return Dp.set.call(this,e[0],t,n,e[0])};function Md(e,t){const n=e[De];return(n?ht(n):e)[t]}function jE(e,t,n){const r=Y1(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function Y1(e,t){if(!(t in e))return;let n=hi(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=hi(n)}}function mr(e){e.modified_||(e.modified_=!0,e.parent_&&mr(e.parent_))}function Ad(e){e.copy_||(e.copy_=Vf(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var FE=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const i=this;return function(l=a,...c){return i.produce(l,u=>n.call(this,u,...c))}}typeof n!="function"&&vn(6),r!==void 0&&typeof r!="function"&&vn(7);let o;if(_r(t)){const a=Ig(this),i=Ss(t,void 0);let s=!0;try{o=n(i),s=!1}finally{s?Hf(a):Wf(a)}return Rg(a,r),Og(o,a)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===K1&&(o=void 0),this.autoFreeze_&&Op(o,!0),r){const a=[],i=[];qo("Patches").generateReplacementPatches_(t,o,a,i),r(a,i)}return o}else vn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(i,...s)=>this.produceWithPatches(i,l=>t(l,...s));let r,o;return[this.produce(t,n,(i,s)=>{r=i,o=s}),r,o]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){_r(e)||vn(8),gi(e)&&(e=BE(e));const t=Ig(this),n=Ss(e,void 0);return n[De].isManual_=!0,Wf(t),n}finishDraft(e,t){const n=e&&e[De];(!n||!n.isManual_)&&vn(9);const{scope_:r}=n;return Rg(r,t),Og(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=qo("Patches").applyPatches_;return gi(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Ss(e,t){const n=Nu(e)?qo("MapSet").proxyMap_(e,t):Pu(e)?qo("MapSet").proxySet_(e,t):LE(e,t);return(t?t.scope_:Rc()).drafts_.push(n),n}function BE(e){return gi(e)||vn(10,e),Q1(e)}function Q1(e){if(!_r(e)||Mu(e))return e;const t=e[De];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vf(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Vf(e,!0);return xs(n,(r,o)=>{X1(n,r,Q1(o))}),t&&(t.finalized_=!1),n}function $E(){class e extends Map{constructor(l,c){super(),this[De]={type_:2,parent_:c,scope_:c?c.scope_:Rc(),modified_:!1,finalized_:!1,copy_:void 0,assigned_:void 0,base_:l,draft_:this,isManual_:!1,revoked_:!1}}get size(){return ht(this[De]).size}has(l){return ht(this[De]).has(l)}set(l,c){const u=this[De];return i(u),(!ht(u).has(l)||ht(u).get(l)!==c)&&(n(u),mr(u),u.assigned_.set(l,!0),u.copy_.set(l,c),u.assigned_.set(l,!0)),this}delete(l){if(!this.has(l))return!1;const c=this[De];return i(c),n(c),mr(c),c.base_.has(l)?c.assigned_.set(l,!1):c.assigned_.delete(l),c.copy_.delete(l),!0}clear(){const l=this[De];i(l),ht(l).size&&(n(l),mr(l),l.assigned_=new Map,xs(l.base_,c=>{l.assigned_.set(c,!1)}),l.copy_.clear())}forEach(l,c){const u=this[De];ht(u).forEach((d,p,g)=>{l.call(c,this.get(p),p,this)})}get(l){const c=this[De];i(c);const u=ht(c).get(l);if(c.finalized_||!_r(u)||u!==c.base_.get(l))return u;const d=Ss(u,c);return n(c),c.copy_.set(l,d),d}keys(){return ht(this[De]).keys()}values(){const l=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{const c=l.next();return c.done?c:{done:!1,value:this.get(c.value)}}}}entries(){const l=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{const c=l.next();if(c.done)return c;const u=this.get(c.value);return{done:!1,value:[c.value,u]}}}}[Symbol.iterator](){return this.entries()}}function t(s,l){return new e(s,l)}function n(s){s.copy_||(s.assigned_=new Map,s.copy_=new Map(s.base_))}class r extends Set{constructor(l,c){super(),this[De]={type_:3,parent_:c,scope_:c?c.scope_:Rc(),modified_:!1,finalized_:!1,copy_:void 0,base_:l,draft_:this,drafts_:new Map,revoked_:!1,isManual_:!1}}get size(){return ht(this[De]).size}has(l){const c=this[De];return i(c),c.copy_?!!(c.copy_.has(l)||c.drafts_.has(l)&&c.copy_.has(c.drafts_.get(l))):c.base_.has(l)}add(l){const c=this[De];return i(c),this.has(l)||(a(c),mr(c),c.copy_.add(l)),this}delete(l){if(!this.has(l))return!1;const c=this[De];return i(c),a(c),mr(c),c.copy_.delete(l)||(c.drafts_.has(l)?c.copy_.delete(c.drafts_.get(l)):!1)}clear(){const l=this[De];i(l),ht(l).size&&(a(l),mr(l),l.copy_.clear())}values(){const l=this[De];return i(l),a(l),l.copy_.values()}entries(){const l=this[De];return i(l),a(l),l.copy_.entries()}keys(){return this.values()}[Symbol.iterator](){return this.values()}forEach(l,c){const u=this.values();let d=u.next();for(;!d.done;)l.call(c,d.value,d.value,this),d=u.next()}}function o(s,l){return new r(s,l)}function a(s){s.copy_||(s.copy_=new Set,s.base_.forEach(l=>{if(_r(l)){const c=Ss(l,s);s.drafts_.set(l,c),s.copy_.add(c)}else s.copy_.add(l)}))}function i(s){s.revoked_&&vn(3,JSON.stringify(ht(s)))}IE("MapSet",{proxyMap_:t,proxySet_:o})}var tn=new FE,Ie=tn.produce;tn.produceWithPatches.bind(tn);tn.setAutoFreeze.bind(tn);tn.setUseStrictShallowCopy.bind(tn);tn.applyPatches.bind(tn);tn.createDraft.bind(tn);tn.finishDraft.bind(tn);var Z1={exports:{}},rn={},J1={exports:{}},eb={};/** - * @license React - * scheduler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */(function(e){function t(K,Z){var re=K.length;K.push(Z);e:for(;0>>1,U=K[fe];if(0>>1;feo(S,re))Xo(H,S)?(K[fe]=H,K[X]=re,fe=X):(K[fe]=S,K[se]=re,fe=se);else if(Xo(H,re))K[fe]=H,K[X]=re,fe=X;else break e}}return Z}function o(K,Z){var re=K.sortIndex-Z.sortIndex;return re!==0?re:K.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,s=i.now();e.unstable_now=function(){return i.now()-s}}var l=[],c=[],u=1,d=null,p=3,g=!1,v=!1,h=!1,_=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(K){for(var Z=n(c);Z!==null;){if(Z.callback===null)r(c);else if(Z.startTime<=K)r(c),Z.sortIndex=Z.expirationTime,t(l,Z);else break;Z=n(c)}}function E(K){if(h=!1,x(K),!v)if(n(l)!==null)v=!0,G(w);else{var Z=n(c);Z!==null&&Y(E,Z.startTime-K)}}function w(K,Z){v=!1,h&&(h=!1,b(C),C=-1),g=!0;var re=p;try{for(x(Z),d=n(l);d!==null&&(!(d.expirationTime>Z)||K&&!R());){var fe=d.callback;if(typeof fe=="function"){d.callback=null,p=d.priorityLevel;var U=fe(d.expirationTime<=Z);Z=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),x(Z)}else r(l);d=n(l)}if(d!==null)var ae=!0;else{var se=n(c);se!==null&&Y(E,se.startTime-Z),ae=!1}return ae}finally{d=null,p=re,g=!1}}var T=!1,k=null,C=-1,P=5,O=-1;function R(){return!(e.unstable_now()-OK||125fe?(K.sortIndex=re,t(c,K),n(l)===null&&K===n(c)&&(h?(b(C),C=-1):h=!0,Y(E,re-fe))):(K.sortIndex=U,t(l,K),v||g||(v=!0,G(w))),K},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(K){var Z=p;return function(){var re=p;p=Z;try{return K.apply(this,arguments)}finally{p=re}}}})(eb);J1.exports=eb;var UE=J1.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var VE=m,nn=UE;function ie(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gf=Object.prototype.hasOwnProperty,zE=/^[: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]*$/,Lg={},jg={};function HE(e){return Gf.call(jg,e)?!0:Gf.call(Lg,e)?!1:zE.test(e)?jg[e]=!0:(Lg[e]=!0,!1)}function WE(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function GE(e,t,n,r){if(t===null||typeof t>"u"||WE(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function jt(e,t,n,r,o,a,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=i}var kt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){kt[e]=new jt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];kt[t]=new jt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){kt[e]=new jt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){kt[e]=new jt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){kt[e]=new jt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){kt[e]=new jt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){kt[e]=new jt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){kt[e]=new jt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){kt[e]=new jt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Lp=/[\-:]([a-z])/g;function jp(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Lp,jp);kt[t]=new jt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Lp,jp);kt[t]=new jt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Lp,jp);kt[t]=new jt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){kt[e]=new jt(e,1,!1,e.toLowerCase(),null,!1,!1)});kt.xlinkHref=new jt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){kt[e]=new jt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Fp(e,t,n,r){var o=kt.hasOwnProperty(t)?kt[t]:null;(o!==null?o.type!==0:r||!(2s||o[i]!==a[s]){var l=` -`+o[i].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=i&&0<=s);break}}}finally{Id=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ns(e):""}function KE(e){switch(e.tag){case 5:return ns(e.type);case 16:return ns("Lazy");case 13:return ns("Suspense");case 19:return ns("SuspenseList");case 0:case 2:case 15:return e=Od(e.type,!1),e;case 11:return e=Od(e.type.render,!1),e;case 1:return e=Od(e.type,!0),e;default:return""}}function Yf(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Wa:return"Fragment";case Ha:return"Portal";case Kf:return"Profiler";case Bp:return"StrictMode";case qf:return"Suspense";case Xf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case rb:return(e.displayName||"Context")+".Consumer";case nb:return(e._context.displayName||"Context")+".Provider";case $p:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Up:return t=e.displayName||null,t!==null?t:Yf(e.type)||"Memo";case Xr:t=e._payload,e=e._init;try{return Yf(e(t))}catch{}}return null}function qE(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Yf(t);case 8:return t===Bp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function po(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ab(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function XE(e){var t=ab(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(i){r=""+i,a.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ml(e){e._valueTracker||(e._valueTracker=XE(e))}function ib(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ab(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Dc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Qf(e,t){var n=t.checked;return Qe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Bg(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=po(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function sb(e,t){t=t.checked,t!=null&&Fp(e,"checked",t,!1)}function Zf(e,t){sb(e,t);var n=po(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Jf(e,t.type,n):t.hasOwnProperty("defaultValue")&&Jf(e,t.type,po(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $g(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Jf(e,t,n){(t!=="number"||Dc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var rs=Array.isArray;function ii(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=Al.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Es(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ss={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},YE=["Webkit","ms","Moz","O"];Object.keys(ss).forEach(function(e){YE.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ss[t]=ss[e]})});function db(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ss.hasOwnProperty(e)&&ss[e]?(""+t).trim():t+"px"}function fb(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=db(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var QE=Qe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function n0(e,t){if(t){if(QE[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ie(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ie(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ie(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ie(62))}}function r0(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 o0=null;function Vp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var a0=null,si=null,li=null;function zg(e){if(e=tl(e)){if(typeof a0!="function")throw Error(ie(280));var t=e.stateNode;t&&(t=Du(t),a0(e.stateNode,e.type,t))}}function pb(e){si?li?li.push(e):li=[e]:si=e}function mb(){if(si){var e=si,t=li;if(li=si=null,zg(e),t)for(e=0;e>>=0,e===0?32:31-(l9(e)/c9|0)|0}var Rl=64,Il=4194304;function os(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Bc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,a=e.pingedLanes,i=n&268435455;if(i!==0){var s=i&~o;s!==0?r=os(s):(a&=i,a!==0&&(r=os(a)))}else i=n&~o,i!==0?r=os(i):a!==0&&(r=os(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,a=t&-t,o>=a||o===16&&(a&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Js(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-On(t),e[t]=n}function p9(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=cs),Zg=" ",Jg=!1;function Ob(e,t){switch(e){case"keyup":return U9.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Db(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ga=!1;function z9(e,t){switch(e){case"compositionend":return Db(t);case"keypress":return t.which!==32?null:(Jg=!0,Zg);case"textInput":return e=t.data,e===Zg&&Jg?null:e;default:return null}}function H9(e,t){if(Ga)return e==="compositionend"||!Yp&&Ob(e,t)?(e=Rb(),dc=Kp=eo=null,Ga=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=rv(n)}}function Bb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $b(){for(var e=window,t=Dc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Dc(e.document)}return t}function Qp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function J9(e){var t=$b(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Bb(n.ownerDocument.documentElement,n)){if(r!==null&&Qp(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,a=Math.min(r.start,o);r=r.end===void 0?a:Math.min(r.end,o),!e.extend&&a>r&&(o=r,r=a,a=o),o=ov(n,a);var i=ov(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ka=null,d0=null,ds=null,f0=!1;function av(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;f0||Ka==null||Ka!==Dc(r)||(r=Ka,"selectionStart"in r&&Qp(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ds&&Is(ds,r)||(ds=r,r=Vc(d0,"onSelect"),0Ya||(e.current=y0[Ya],y0[Ya]=null,Ya--)}function Be(e,t){Ya++,y0[Ya]=e.current,e.current=t}var mo={},Pt=xo(mo),Vt=xo(!1),Xo=mo;function yi(e,t){var n=e.type.contextTypes;if(!n)return mo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},a;for(a in n)o[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function zt(e){return e=e.childContextTypes,e!=null}function Hc(){He(Vt),He(Pt)}function fv(e,t,n){if(Pt.current!==mo)throw Error(ie(168));Be(Pt,t),Be(Vt,n)}function Xb(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(ie(108,qE(e)||"Unknown",o));return Qe({},n,r)}function Wc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mo,Xo=Pt.current,Be(Pt,e),Be(Vt,Vt.current),!0}function pv(e,t,n){var r=e.stateNode;if(!r)throw Error(ie(169));n?(e=Xb(e,t,Xo),r.__reactInternalMemoizedMergedChildContext=e,He(Vt),He(Pt),Be(Pt,e)):He(Vt),Be(Vt,n)}var hr=null,Lu=!1,qd=!1;function Yb(e){hr===null?hr=[e]:hr.push(e)}function d8(e){Lu=!0,Yb(e)}function ko(){if(!qd&&hr!==null){qd=!0;var e=0,t=Le;try{var n=hr;for(Le=1;e>=i,o-=i,yr=1<<32-On(t)+o|n<C?(P=k,k=null):P=k.sibling;var O=p(b,k,x[C],E);if(O===null){k===null&&(k=P);break}e&&k&&O.alternate===null&&t(b,k),y=a(O,y,C),T===null?w=O:T.sibling=O,T=O,k=P}if(C===x.length)return n(b,k),We&&Io(b,C),w;if(k===null){for(;CC?(P=k,k=null):P=k.sibling;var R=p(b,k,O.value,E);if(R===null){k===null&&(k=P);break}e&&k&&R.alternate===null&&t(b,k),y=a(R,y,C),T===null?w=R:T.sibling=R,T=R,k=P}if(O.done)return n(b,k),We&&Io(b,C),w;if(k===null){for(;!O.done;C++,O=x.next())O=d(b,O.value,E),O!==null&&(y=a(O,y,C),T===null?w=O:T.sibling=O,T=O);return We&&Io(b,C),w}for(k=r(b,k);!O.done;C++,O=x.next())O=g(k,b,C,O.value,E),O!==null&&(e&&O.alternate!==null&&k.delete(O.key===null?C:O.key),y=a(O,y,C),T===null?w=O:T.sibling=O,T=O);return e&&k.forEach(function(N){return t(b,N)}),We&&Io(b,C),w}function _(b,y,x,E){if(typeof x=="object"&&x!==null&&x.type===Wa&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Pl:e:{for(var w=x.key,T=y;T!==null;){if(T.key===w){if(w=x.type,w===Wa){if(T.tag===7){n(b,T.sibling),y=o(T,x.props.children),y.return=b,b=y;break e}}else if(T.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Xr&&gv(w)===T.type){n(b,T.sibling),y=o(T,x.props),y.ref=qi(b,T,x),y.return=b,b=y;break e}n(b,T);break}else t(b,T);T=T.sibling}x.type===Wa?(y=Ho(x.props.children,b.mode,E,x.key),y.return=b,b=y):(E=bc(x.type,x.key,x.props,null,b.mode,E),E.ref=qi(b,y,x),E.return=b,b=E)}return i(b);case Ha:e:{for(T=x.key;y!==null;){if(y.key===T)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){n(b,y.sibling),y=o(y,x.children||[]),y.return=b,b=y;break e}else{n(b,y);break}else t(b,y);y=y.sibling}y=nf(x,b.mode,E),y.return=b,b=y}return i(b);case Xr:return T=x._init,_(b,y,T(x._payload),E)}if(rs(x))return v(b,y,x,E);if(zi(x))return h(b,y,x,E);$l(b,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(n(b,y.sibling),y=o(y,x),y.return=b,b=y):(n(b,y),y=tf(x,b.mode,E),y.return=b,b=y),i(b)):n(b,y)}return _}var wi=ew(!0),tw=ew(!1),qc=xo(null),Xc=null,Ja=null,tm=null;function nm(){tm=Ja=Xc=null}function rm(e){var t=qc.current;He(qc),e._currentValue=t}function _0(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ui(e,t){Xc=e,tm=Ja=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ut=!0),e.firstContext=null)}function kn(e){var t=e._currentValue;if(tm!==e)if(e={context:e,memoizedValue:t,next:null},Ja===null){if(Xc===null)throw Error(ie(308));Ja=e,Xc.dependencies={lanes:0,firstContext:e}}else Ja=Ja.next=e;return t}var Fo=null;function om(e){Fo===null?Fo=[e]:Fo.push(e)}function nw(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,om(t)):(n.next=o.next,o.next=n),t.interleaved=n,Cr(e,r)}function Cr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Yr=!1;function am(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rw(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function so(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Re&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Cr(e,n)}return o=r.interleaved,o===null?(t.next=t,om(r)):(t.next=o.next,o.next=t),r.interleaved=t,Cr(e,n)}function pc(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hp(e,n)}}function vv(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?o=a=i:a=a.next=i,n=n.next}while(n!==null);a===null?o=a=t:a=a.next=t}else o=a=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Yc(e,t,n,r){var o=e.updateQueue;Yr=!1;var a=o.firstBaseUpdate,i=o.lastBaseUpdate,s=o.shared.pending;if(s!==null){o.shared.pending=null;var l=s,c=l.next;l.next=null,i===null?a=c:i.next=c,i=l;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==i&&(s===null?u.firstBaseUpdate=c:s.next=c,u.lastBaseUpdate=l))}if(a!==null){var d=o.baseState;i=0,u=c=l=null,s=a;do{var p=s.lane,g=s.eventTime;if((r&p)===p){u!==null&&(u=u.next={eventTime:g,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var v=e,h=s;switch(p=t,g=n,h.tag){case 1:if(v=h.payload,typeof v=="function"){d=v.call(g,d,p);break e}d=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=h.payload,p=typeof v=="function"?v.call(g,d,p):v,p==null)break e;d=Qe({},d,p);break e;case 2:Yr=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,p=o.effects,p===null?o.effects=[s]:p.push(s))}else g={eventTime:g,lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(c=u=g,l=d):u=u.next=g,i|=p;if(s=s.next,s===null){if(s=o.shared.pending,s===null)break;p=s,s=p.next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}while(!0);if(u===null&&(l=d),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=u,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else a===null&&(o.shared.lanes=0);Zo|=i,e.lanes=i,e.memoizedState=d}}function yv(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Yd.transition;Yd.transition={};try{e(!1),t()}finally{Le=n,Yd.transition=r}}function ww(){return Cn().memoizedState}function h8(e,t,n){var r=co(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},_w(e))xw(t,n);else if(n=nw(e,t,n,r),n!==null){var o=Ot();Dn(n,e,r,o),kw(n,t,r)}}function g8(e,t,n){var r=co(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(_w(e))xw(t,o);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var i=t.lastRenderedState,s=a(i,n);if(o.hasEagerState=!0,o.eagerState=s,Ln(s,i)){var l=t.interleaved;l===null?(o.next=o,om(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=nw(e,t,o,r),n!==null&&(o=Ot(),Dn(n,e,r,o),kw(n,t,r))}}function _w(e){var t=e.alternate;return e===Ye||t!==null&&t===Ye}function xw(e,t){fs=Zc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function kw(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hp(e,n)}}var Jc={readContext:kn,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useInsertionEffect:St,useLayoutEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useMutableSource:St,useSyncExternalStore:St,useId:St,unstable_isNewReconciler:!1},v8={readContext:kn,useCallback:function(e,t){return Hn().memoizedState=[e,t===void 0?null:t],e},useContext:kn,useEffect:wv,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,hc(4194308,4,hw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return hc(4194308,4,e,t)},useInsertionEffect:function(e,t){return hc(4,2,e,t)},useMemo:function(e,t){var n=Hn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Hn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=h8.bind(null,Ye,e),[r.memoizedState,e]},useRef:function(e){var t=Hn();return e={current:e},t.memoizedState=e},useState:bv,useDebugValue:pm,useDeferredValue:function(e){return Hn().memoizedState=e},useTransition:function(){var e=bv(!1),t=e[0];return e=m8.bind(null,e[1]),Hn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ye,o=Hn();if(We){if(n===void 0)throw Error(ie(407));n=n()}else{if(n=t(),vt===null)throw Error(ie(349));Qo&30||sw(r,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,wv(cw.bind(null,r,a,e),[e]),r.flags|=2048,Us(9,lw.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Hn(),t=vt.identifierPrefix;if(We){var n=br,r=yr;n=(r&~(1<<32-On(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Bs++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Gn]=t,e[Ls]=r,Iw(e,t,!1,!1),t.stateNode=e;e:{switch(i=r0(n,r),n){case"dialog":ze("cancel",e),ze("close",e),o=r;break;case"iframe":case"object":case"embed":ze("load",e),o=r;break;case"video":case"audio":for(o=0;oki&&(t.flags|=128,r=!0,Xi(a,!1),t.lanes=4194304)}else{if(!r)if(e=Qc(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Xi(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!We)return Tt(t),null}else 2*rt()-a.renderingStartTime>ki&&n!==1073741824&&(t.flags|=128,r=!0,Xi(a,!1),t.lanes=4194304);a.isBackwards?(i.sibling=t.child,t.child=i):(n=a.last,n!==null?n.sibling=i:t.child=i,a.last=i)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=rt(),t.sibling=null,n=Xe.current,Be(Xe,r?n&1|2:n&1),t):(Tt(t),null);case 22:case 23:return bm(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Xt&1073741824&&(Tt(t),t.subtreeFlags&6&&(t.flags|=8192)):Tt(t),null;case 24:return null;case 25:return null}throw Error(ie(156,t.tag))}function S8(e,t){switch(Jp(t),t.tag){case 1:return zt(t.type)&&Hc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return _i(),He(Vt),He(Pt),lm(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return sm(t),null;case 13:if(He(Xe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ie(340));bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return He(Xe),null;case 4:return _i(),null;case 10:return rm(t.type._context),null;case 22:case 23:return bm(),null;case 24:return null;default:return null}}var Vl=!1,Et=!1,T8=typeof WeakSet=="function"?WeakSet:Set,ge=null;function ei(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Je(e,t,r)}else n.current=null}function M0(e,t,n){try{n()}catch(r){Je(e,t,r)}}var Av=!1;function E8(e,t){if(p0=$c,e=$b(),Qp(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var i=0,s=-1,l=-1,c=0,u=0,d=e,p=null;t:for(;;){for(var g;d!==n||o!==0&&d.nodeType!==3||(s=i+o),d!==a||r!==0&&d.nodeType!==3||(l=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(g=d.firstChild)!==null;)p=d,d=g;for(;;){if(d===e)break t;if(p===n&&++c===o&&(s=i),p===a&&++u===r&&(l=i),(g=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=g}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(m0={focusedElem:e,selectionRange:n},$c=!1,ge=t;ge!==null;)if(t=ge,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ge=e;else for(;ge!==null;){t=ge;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var h=v.memoizedProps,_=v.memoizedState,b=t.stateNode,y=b.getSnapshotBeforeUpdate(t.elementType===t.type?h:Mn(t.type,h),_);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ie(163))}}catch(E){Je(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,ge=e;break}ge=t.return}return v=Av,Av=!1,v}function ps(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var a=o.destroy;o.destroy=void 0,a!==void 0&&M0(t,n,a)}o=o.next}while(o!==r)}}function Bu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function A0(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Lw(e){var t=e.alternate;t!==null&&(e.alternate=null,Lw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Gn],delete t[Ls],delete t[v0],delete t[c8],delete t[u8])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function jw(e){return e.tag===5||e.tag===3||e.tag===4}function Rv(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function R0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=zc));else if(r!==4&&(e=e.child,e!==null))for(R0(e,t,n),e=e.sibling;e!==null;)R0(e,t,n),e=e.sibling}function I0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(I0(e,t,n),e=e.sibling;e!==null;)I0(e,t,n),e=e.sibling}var wt=null,An=!1;function Vr(e,t,n){for(n=n.child;n!==null;)Fw(e,t,n),n=n.sibling}function Fw(e,t,n){if(Qn&&typeof Qn.onCommitFiberUnmount=="function")try{Qn.onCommitFiberUnmount(Au,n)}catch{}switch(n.tag){case 5:Et||ei(n,t);case 6:var r=wt,o=An;wt=null,Vr(e,t,n),wt=r,An=o,wt!==null&&(An?(e=wt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wt.removeChild(n.stateNode));break;case 18:wt!==null&&(An?(e=wt,n=n.stateNode,e.nodeType===8?Kd(e.parentNode,n):e.nodeType===1&&Kd(e,n),As(e)):Kd(wt,n.stateNode));break;case 4:r=wt,o=An,wt=n.stateNode.containerInfo,An=!0,Vr(e,t,n),wt=r,An=o;break;case 0:case 11:case 14:case 15:if(!Et&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var a=o,i=a.destroy;a=a.tag,i!==void 0&&(a&2||a&4)&&M0(n,t,i),o=o.next}while(o!==r)}Vr(e,t,n);break;case 1:if(!Et&&(ei(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){Je(n,t,s)}Vr(e,t,n);break;case 21:Vr(e,t,n);break;case 22:n.mode&1?(Et=(r=Et)||n.memoizedState!==null,Vr(e,t,n),Et=r):Vr(e,t,n);break;default:Vr(e,t,n)}}function Iv(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new T8),t.forEach(function(r){var o=L8.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Nn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=i),r&=~a}if(r=o,r=rt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*P8(r/1960))-r,10e?16:e,to===null)var r=!1;else{if(e=to,to=null,nu=0,Re&6)throw Error(ie(331));var o=Re;for(Re|=4,ge=e.current;ge!==null;){var a=ge,i=a.child;if(ge.flags&16){var s=a.deletions;if(s!==null){for(var l=0;lrt()-vm?zo(e,0):gm|=n),Ht(e,t)}function Gw(e,t){t===0&&(e.mode&1?(t=Il,Il<<=1,!(Il&130023424)&&(Il=4194304)):t=1);var n=Ot();e=Cr(e,t),e!==null&&(Js(e,t,n),Ht(e,n))}function D8(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gw(e,n)}function L8(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ie(314))}r!==null&&r.delete(t),Gw(e,n)}var Kw;Kw=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Vt.current)Ut=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ut=!1,k8(e,t,n);Ut=!!(e.flags&131072)}else Ut=!1,We&&t.flags&1048576&&Qb(t,Kc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;gc(e,t),e=t.pendingProps;var o=yi(t,Pt.current);ui(t,n),o=um(null,t,r,e,o,n);var a=dm();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,zt(r)?(a=!0,Wc(t)):a=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,am(t),o.updater=Fu,t.stateNode=o,o._reactInternals=t,k0(t,r,e,n),t=T0(null,t,r,!0,a,n)):(t.tag=0,We&&a&&Zp(t),Rt(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(gc(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=F8(r),e=Mn(r,e),o){case 0:t=S0(null,t,r,e,n);break e;case 1:t=Nv(null,t,r,e,n);break e;case 11:t=Tv(null,t,r,e,n);break e;case 14:t=Ev(null,t,r,Mn(r.type,e),n);break e}throw Error(ie(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Mn(r,o),S0(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Mn(r,o),Nv(e,t,r,o,n);case 3:e:{if(Mw(t),e===null)throw Error(ie(387));r=t.pendingProps,a=t.memoizedState,o=a.element,rw(e,t),Yc(t,r,null,n);var i=t.memoizedState;if(r=i.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){o=xi(Error(ie(423)),t),t=Pv(e,t,r,n,o);break e}else if(r!==o){o=xi(Error(ie(424)),t),t=Pv(e,t,r,n,o);break e}else for(Zt=io(t.stateNode.containerInfo.firstChild),Jt=t,We=!0,Rn=null,n=tw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(bi(),r===o){t=Sr(e,t,n);break e}Rt(e,t,r,n)}t=t.child}return t;case 5:return ow(t),e===null&&w0(t),r=t.type,o=t.pendingProps,a=e!==null?e.memoizedProps:null,i=o.children,h0(r,o)?i=null:a!==null&&h0(r,a)&&(t.flags|=32),Pw(e,t),Rt(e,t,i,n),t.child;case 6:return e===null&&w0(t),null;case 13:return Aw(e,t,n);case 4:return im(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=wi(t,null,r,n):Rt(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Mn(r,o),Tv(e,t,r,o,n);case 7:return Rt(e,t,t.pendingProps,n),t.child;case 8:return Rt(e,t,t.pendingProps.children,n),t.child;case 12:return Rt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,a=t.memoizedProps,i=o.value,Be(qc,r._currentValue),r._currentValue=i,a!==null)if(Ln(a.value,i)){if(a.children===o.children&&!Vt.current){t=Sr(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var s=a.dependencies;if(s!==null){i=a.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(a.tag===1){l=wr(-1,n&-n),l.tag=2;var c=a.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),_0(a.return,n,t),s.lanes|=n;break}l=l.next}}else if(a.tag===10)i=a.type===t.type?null:a.child;else if(a.tag===18){if(i=a.return,i===null)throw Error(ie(341));i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),_0(i,n,t),i=a.sibling}else i=a.child;if(i!==null)i.return=a;else for(i=a;i!==null;){if(i===t){i=null;break}if(a=i.sibling,a!==null){a.return=i.return,i=a;break}i=i.return}a=i}Rt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,ui(t,n),o=kn(o),r=r(o),t.flags|=1,Rt(e,t,r,n),t.child;case 14:return r=t.type,o=Mn(r,t.pendingProps),o=Mn(r.type,o),Ev(e,t,r,o,n);case 15:return Ew(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Mn(r,o),gc(e,t),t.tag=1,zt(r)?(e=!0,Wc(t)):e=!1,ui(t,n),Cw(t,r,o),k0(t,r,o,n),T0(null,t,r,!0,e,n);case 19:return Rw(e,t,n);case 22:return Nw(e,t,n)}throw Error(ie(156,t.tag))};function qw(e,t){return _b(e,t)}function j8(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bn(e,t,n,r){return new j8(e,t,n,r)}function _m(e){return e=e.prototype,!(!e||!e.isReactComponent)}function F8(e){if(typeof e=="function")return _m(e)?1:0;if(e!=null){if(e=e.$$typeof,e===$p)return 11;if(e===Up)return 14}return 2}function uo(e,t){var n=e.alternate;return n===null?(n=bn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function bc(e,t,n,r,o,a){var i=2;if(r=e,typeof e=="function")_m(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Wa:return Ho(n.children,o,a,t);case Bp:i=8,o|=8;break;case Kf:return e=bn(12,n,t,o|2),e.elementType=Kf,e.lanes=a,e;case qf:return e=bn(13,n,t,o),e.elementType=qf,e.lanes=a,e;case Xf:return e=bn(19,n,t,o),e.elementType=Xf,e.lanes=a,e;case ob:return Uu(n,o,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case nb:i=10;break e;case rb:i=9;break e;case $p:i=11;break e;case Up:i=14;break e;case Xr:i=16,r=null;break e}throw Error(ie(130,e==null?e:typeof e,""))}return t=bn(i,n,t,o),t.elementType=e,t.type=r,t.lanes=a,t}function Ho(e,t,n,r){return e=bn(7,e,r,t),e.lanes=n,e}function Uu(e,t,n,r){return e=bn(22,e,r,t),e.elementType=ob,e.lanes=n,e.stateNode={isHidden:!1},e}function tf(e,t,n){return e=bn(6,e,null,t),e.lanes=n,e}function nf(e,t,n){return t=bn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function B8(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ld(0),this.expirationTimes=Ld(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ld(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function xm(e,t,n,r,o,a,i,s,l){return e=new B8(e,t,n,s,l),t===1?(t=1,a===!0&&(t|=8)):t=0,a=bn(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},am(a),e}function $8(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Zw)}catch(e){console.error(e)}}Zw(),Z1.exports=rn;var an=Z1.exports;const Jw=Pp(an);var e2,Uv=an;e2=Uv.createRoot,Uv.hydrateRoot;var W8={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Vv=e=>{let t;const n=new Set,r=(u,d)=>{const p=typeof u=="function"?u(t):u;if(!Object.is(p,t)){const g=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(v=>v(t,g))}},o=()=>t,l={setState:r,getState:o,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(W8?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,o,l);return l},G8=e=>e?Vv(e):Vv;var t2={exports:{}},n2={},r2={exports:{}},o2={};/** - * @license React - * use-sync-external-store-shim.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ci=m;function K8(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var q8=typeof Object.is=="function"?Object.is:K8,X8=Ci.useState,Y8=Ci.useEffect,Q8=Ci.useLayoutEffect,Z8=Ci.useDebugValue;function J8(e,t){var n=t(),r=X8({inst:{value:n,getSnapshot:t}}),o=r[0].inst,a=r[1];return Q8(function(){o.value=n,o.getSnapshot=t,rf(o)&&a({inst:o})},[e,n,t]),Y8(function(){return rf(o)&&a({inst:o}),e(function(){rf(o)&&a({inst:o})})},[e]),Z8(n),n}function rf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!q8(e,n)}catch{return!0}}function e3(e,t){return t()}var t3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?e3:J8;o2.useSyncExternalStore=Ci.useSyncExternalStore!==void 0?Ci.useSyncExternalStore:t3;r2.exports=o2;var n3=r2.exports;/** - * @license React - * use-sync-external-store-shim/with-selector.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Gu=m,r3=n3;function o3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var a3=typeof Object.is=="function"?Object.is:o3,i3=r3.useSyncExternalStore,s3=Gu.useRef,l3=Gu.useEffect,c3=Gu.useMemo,u3=Gu.useDebugValue;n2.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var a=s3(null);if(a.current===null){var i={hasValue:!1,value:null};a.current=i}else i=a.current;a=c3(function(){function l(g){if(!c){if(c=!0,u=g,g=r(g),o!==void 0&&i.hasValue){var v=i.value;if(o(v,g))return d=v}return d=g}if(v=d,a3(u,g))return v;var h=r(g);return o!==void 0&&o(v,h)?v:(u=g,d=h)}var c=!1,u,d,p=n===void 0?null:n;return[function(){return l(t())},p===null?void 0:function(){return l(p())}]},[t,n,r,o]);var s=i3(e,a[0],a[1]);return l3(function(){i.hasValue=!0,i.value=s},[s]),u3(s),s};t2.exports=n2;var d3=t2.exports;const f3=Pp(d3);var a2={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:p3}=Ae,{useSyncExternalStoreWithSelector:m3}=f3;let zv=!1;const h3=e=>e;function g3(e,t=h3,n){(a2?"production":void 0)!=="production"&&n&&!zv&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),zv=!0);const r=m3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return p3(r),r}const Hv=e=>{(a2?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?G8(e):e,n=(r,o)=>g3(t,r,o);return Object.assign(n,t),n},i2=e=>e?Hv(e):Hv,F0={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function B0(e,t,n,r=!1){const o=String(t),a=(l,c)=>`\x1B[${c[0]}m${l}\x1B[${c[1]}m`,i=(l,c)=>c!=null&&typeof c=="string"?a(l,F0[c]):c!=null&&Array.isArray(c)?c.reduce((u,d)=>i(u,d),l):c!=null&&c[l.trim()]!=null?i(l,c[l.trim()]):c!=null&&c["*"]!=null?i(l,c["*"]):l,s=null;return o.replace(/{{(.+?)}}/g,(l,c)=>{const u=n[c]!=null?String(n[c]):r?"":l;return e.stylePrettyLogs?i(u,e?.prettyLogStyles?.[c]??s)+a("",F0.reset):u})}function pn(e,t=2,n=0){return e!=null&&isNaN(e)?"":(e=e!=null?e+n:e,t===2?e==null?"--":e<10?"0"+e:e.toString():e==null?"---":e<10?"00"+e:e<100?"0"+e:e.toString())}function v3(e){return{href:e.href,protocol:e.protocol,username:e.username,password:e.password,host:e.host,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search,searchParams:[...e.searchParams].map(([t,n])=>({key:t,value:n})),hash:e.hash,origin:e.origin}}function s2(e){const t=new Set;return JSON.stringify(e,(n,r)=>{if(typeof r=="object"&&r!==null){if(t.has(r))return"[Circular]";t.add(r)}return typeof r=="bigint"?`${r}`:r})}function yn(e,t){const n={seen:[],stylize:l2};return t!=null&&f2(n,t),ni(n.showHidden)&&(n.showHidden=!1),ni(n.depth)&&(n.depth=2),ni(n.colors)&&(n.colors=!0),ni(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=b3),au(n,e,n.depth)}yn.colors=F0;yn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function y3(e){return typeof e=="boolean"}function ni(e){return e===void 0}function l2(e){return e}function b3(e,t){const n=yn.styles[t];return n!=null&&yn?.colors?.[n]?.[0]!=null&&yn?.colors?.[n]?.[1]!=null?"\x1B["+yn.colors[n][0]+"m"+e+"\x1B["+yn.colors[n][1]+"m":e}function Wl(e){return typeof e=="function"}function c2(e){return typeof e=="string"}function w3(e){return typeof e=="number"}function u2(e){return e===null}function d2(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function of(e){return Ku(e)&&Tm(e)==="[object RegExp]"}function Ku(e){return typeof e=="object"&&e!==null}function af(e){return Ku(e)&&(Tm(e)==="[object Error]"||e instanceof Error)}function Wv(e){return Ku(e)&&Tm(e)==="[object Date]"}function Tm(e){return Object.prototype.toString.call(e)}function _3(e){const t={};return e.forEach(n=>{t[n]=!0}),t}function x3(e,t,n,r,o){const a=[];for(let i=0,s=t.length;i{i.match(/^\d+$/)||a.push($0(e,t,n,r,i,!0))}),a}function sf(e){return"["+Error.prototype.toString.call(e)+"]"}function au(e,t,n=0){if(e.customInspect&&t!=null&&Wl(t)&&t?.inspect!==yn&&!(t?.constructor&&t?.constructor.prototype===t)){if(typeof t.inspect!="function"&&t.toString!=null)return t.toString();let u=t?.inspect(n,e);return c2(u)||(u=au(e,u,n)),u}const r=Gr(e,t);if(r)return r;let o=Object.keys(t);const a=_3(o);try{e.showHidden&&Object.getOwnPropertyNames&&(o=Object.getOwnPropertyNames(t))}catch{}if(af(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return sf(t);if(o.length===0)if(Wl(e.stylize)){if(Wl(t)){const u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(of(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Wv(t))return e.stylize(Date.prototype.toISOString.call(t),"date");if(af(t))return sf(t)}else return t;let i="",s=!1,l=[`{ -`,` -}`];if(Array.isArray(t)&&(s=!0,l=[`[ -`,` -]`]),Wl(t)&&(i=" [Function"+(t.name?": "+t.name:"")+"]"),of(t)&&(i=" "+RegExp.prototype.toString.call(t)),Wv(t)&&(i=" "+Date.prototype.toUTCString.call(t)),af(t)&&(i=" "+sf(t)),o.length===0&&(!s||t.length==0))return l[0]+i+l[1];if(n<0)return of(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);let c;return s?c=x3(e,t,n,a,o):c=o.map(u=>$0(e,t,n,a,u,s)),e.seen.pop(),k3(c,i,l)}function $0(e,t,n,r,o,a){let i,s,l={value:void 0};try{l.value=t[o]}catch{}try{Object.getOwnPropertyDescriptor&&(l=Object.getOwnPropertyDescriptor(t,o)||l)}catch{}if(l.get?l.set?s=e.stylize("[Getter/Setter]","special"):s=e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),d2(r,o)||(i="["+o+"]"),s||(e.seen.indexOf(l.value)<0?(u2(n)?s=au(e,l.value,void 0):s=au(e,l.value,n-1),s.indexOf(` -`)>-1&&(a?s=s.split(` -`).map(c=>" "+c).join(` -`).substr(2):s=` -`+s.split(` -`).map(c=>" "+c).join(` -`))):s=e.stylize("[Circular]","special")),ni(i)){if(a&&o.match(/^\d+$/))return s;i=JSON.stringify(""+o),i.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,"\\'").replace(/(^"|"$)/g,"'"),i=e.stylize(i,"string"))}return i+": "+s}function Gr(e,t){if(ni(t))return e.stylize("undefined","undefined");if(c2(t)){const n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,"\\'")+"'";return e.stylize(n,"string")}if(w3(t))return e.stylize(""+t,"number");if(y3(t))return e.stylize(""+t,"boolean");if(u2(t))return e.stylize("null","null")}function k3(e,t,n){return n[0]+(t===""?"":t+` -`)+" "+e.join(`, - `)+" "+n[1]}function f2(e,t){const n={...e};if(!t||!Ku(t))return e;const r={...t},o=Object.keys(t);let a=o.length;for(;a--;)n[o[a]]=r[o[a]];return n}function C3(e,...t){const n={seen:[],stylize:l2};e!=null&&f2(n,e);const r=t[0];let o=0,a="",i="";if(typeof r=="string"){if(t.length===1)return r;let s,l=0;for(let c=0;c!n.includes("Error: "))?.[e])}function m2(e){return(e?.stack?.split(` -`)??[])?.filter(t=>!t.includes("Error: "))?.reduce((t,n)=>(t.push(h2(n)),t),[])}function h2(e){const t=globalThis?.location?.origin,n={fullFilePath:void 0,fileName:void 0,fileNameWithLine:void 0,fileColumn:void 0,fileLine:void 0,filePath:void 0,filePathWithLine:void 0,method:void 0};if(e!=null){const r=e.match(E3);if(r){n.filePath=r[1].replace(/\?.*$/,""),n.fullFilePath=`${t}${n.filePath}`;const o=n.filePath.split("/");n.fileName=o[o.length-1],n.fileLine=r[2],n.fileColumn=r[3],n.filePathWithLine=`${n.filePath}:${n.fileLine}`,n.fileNameWithLine=`${n.fileName}:${n.fileLine}`}}return n}function g2(e){return e instanceof Error}function P3(e,t){return e.reduce((n,r)=>(g2(r)?n.errors.push(v2(r,t)):n.args.push(r),n),{args:[],errors:[]})}function v2(e,t){const n=m2(e).map(o=>B0(t,t.prettyErrorStackTemplate,{...o},!0)),r={errorName:` ${e.name} `,errorMessage:Object.getOwnPropertyNames(e).reduce((o,a)=>(a!=="stack"&&o.push(e[a]),o),[]).join(", "),errorStack:n.join(` -`)};return B0(t,t.prettyErrorTemplate,r)}function M3(e,t,n,r){const o=(n.length>0&&t.length>0?` -`:"")+n.join(` -`);r.prettyInspectOptions.colors=r.stylePrettyLogs,console.log(e+C3(r.prettyInspectOptions,...t)+o)}function A3(e){console.log(s2(e))}function R3(e){return!1}class I3{constructor(t,n,r=4){this.logObj=n,this.stackDepthLevel=r,this.runtime=S3,this.settings={type:t?.type??"pretty",name:t?.name,parentNames:t?.parentNames,minLevel:t?.minLevel??0,argumentsArrayName:t?.argumentsArrayName,hideLogPositionForProduction:t?.hideLogPositionForProduction??!1,prettyLogTemplate:t?.prettyLogTemplate??"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} {{filePathWithLine}}{{nameWithDelimiterPrefix}} ",prettyErrorTemplate:t?.prettyErrorTemplate??` -{{errorName}} {{errorMessage}} -error stack: -{{errorStack}}`,prettyErrorStackTemplate:t?.prettyErrorStackTemplate??` • {{fileName}} {{method}} - {{filePathWithLine}}`,prettyErrorParentNamesSeparator:t?.prettyErrorParentNamesSeparator??":",prettyErrorLoggerNameDelimiter:t?.prettyErrorLoggerNameDelimiter??" ",stylePrettyLogs:t?.stylePrettyLogs??!0,prettyLogTimeZone:t?.prettyLogTimeZone??"UTC",prettyLogStyles:t?.prettyLogStyles??{logLevelName:{"*":["bold","black","bgWhiteBright","dim"],SILLY:["bold","white"],TRACE:["bold","whiteBright"],DEBUG:["bold","green"],INFO:["bold","blue"],WARN:["bold","yellow"],ERROR:["bold","red"],FATAL:["bold","redBright"]},dateIsoStr:"white",filePathWithLine:"white",name:["white","bold"],nameWithDelimiterPrefix:["white","bold"],nameWithDelimiterSuffix:["white","bold"],errorName:["bold","bgRedBright","whiteBright"],fileName:["yellow"],fileNameWithLine:"white"},prettyInspectOptions:t?.prettyInspectOptions??{colors:!0,compact:!1,depth:1/0},metaProperty:t?.metaProperty??"_meta",maskPlaceholder:t?.maskPlaceholder??"[***]",maskValuesOfKeys:t?.maskValuesOfKeys??["password"],maskValuesOfKeysCaseInsensitive:t?.maskValuesOfKeysCaseInsensitive??!1,maskValuesRegEx:t?.maskValuesRegEx,prefix:[...t?.prefix??[]],attachedTransports:[...t?.attachedTransports??[]],overwrite:{mask:t?.overwrite?.mask,toLogObj:t?.overwrite?.toLogObj,addMeta:t?.overwrite?.addMeta,addPlaceholders:t?.overwrite?.addPlaceholders,formatMeta:t?.overwrite?.formatMeta,formatLogObj:t?.overwrite?.formatLogObj,transportFormatted:t?.overwrite?.transportFormatted,transportJSON:t?.overwrite?.transportJSON}}}log(t,n,...r){if(t0?this._mask(o):o,i=this.logObj!=null?this._recursiveCloneAndExecuteFunctions(this.logObj):void 0,s=this.settings.overwrite?.toLogObj!=null?this.settings.overwrite?.toLogObj(a,i):this._toLogObj(a,i),l=this.settings.overwrite?.addMeta!=null?this.settings.overwrite?.addMeta(s,t,n):this._addMetaToLogObj(s,t,n);let c,u;return this.settings.overwrite?.formatMeta!=null&&(c=this.settings.overwrite?.formatMeta(l?.[this.settings.metaProperty])),this.settings.overwrite?.formatLogObj!=null&&(u=this.settings.overwrite?.formatLogObj(a,this.settings)),this.settings.type==="pretty"&&(c=c??this._prettyFormatLogObjMeta(l?.[this.settings.metaProperty]),u=u??this.runtime.prettyFormatLogObj(a,this.settings)),c!=null&&u!=null?this.settings.overwrite?.transportFormatted!=null?this.settings.overwrite?.transportFormatted(c,u.args,u.errors,this.settings):this.runtime.transportFormatted(c,u.args,u.errors,this.settings):this.settings.overwrite?.transportJSON!=null?this.settings.overwrite?.transportJSON(l):this.settings.type!=="hidden"&&this.runtime.transportJSON(l),this.settings.attachedTransports!=null&&this.settings.attachedTransports.length>0&&this.settings.attachedTransports.forEach(d=>{d(l)}),l}attachTransport(t){this.settings.attachedTransports.push(t)}getSubLogger(t,n){const r={...this.settings,...t,parentNames:this.settings?.parentNames!=null&&this.settings?.name!=null?[...this.settings.parentNames,this.settings.name]:this.settings?.name!=null?[this.settings.name]:void 0,prefix:[...this.settings.prefix,...t?.prefix??[]]};return new this.constructor(r,n??this.logObj,this.stackDepthLevel)}_mask(t){const n=this.settings.maskValuesOfKeysCaseInsensitive!==!0?this.settings.maskValuesOfKeys:this.settings.maskValuesOfKeys.map(r=>r.toLowerCase());return t?.map(r=>this._recursiveCloneAndMaskValuesOfKeys(r,n))}_recursiveCloneAndMaskValuesOfKeys(t,n,r=[]){if(r.includes(t))return{...t};if(typeof t=="object"&&t!==null&&r.push(t),this.runtime.isError(t)||this.runtime.isBuffer(t))return t;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(Array.isArray(t))return t.map(o=>this._recursiveCloneAndMaskValuesOfKeys(o,n,r));if(t instanceof Date)return new Date(t.getTime());if(t instanceof URL)return v3(t);if(t!==null&&typeof t=="object"){const o=this.runtime.isError(t)?this._cloneError(t):Object.create(Object.getPrototypeOf(t));return Object.getOwnPropertyNames(t).reduce((a,i)=>(a[i]=n.includes(this.settings?.maskValuesOfKeysCaseInsensitive!==!0?i:i.toLowerCase())?this.settings.maskPlaceholder:(()=>{try{return this._recursiveCloneAndMaskValuesOfKeys(t[i],n,r)}catch{return null}})(),a),o)}else{if(typeof t=="string"){let o=t;for(const a of this.settings?.maskValuesRegEx||[])o=o.replace(a,this.settings?.maskPlaceholder||"");return o}return t}}_recursiveCloneAndExecuteFunctions(t,n=[]){return this.isObjectOrArray(t)&&n.includes(t)?this.shallowCopy(t):(this.isObjectOrArray(t)&&n.push(t),Array.isArray(t)?t.map(r=>this._recursiveCloneAndExecuteFunctions(r,n)):t instanceof Date?new Date(t.getTime()):this.isObject(t)?Object.getOwnPropertyNames(t).reduce((r,o)=>{const a=Object.getOwnPropertyDescriptor(t,o);if(a){Object.defineProperty(r,o,a);const i=t[o];r[o]=typeof i=="function"?i():this._recursiveCloneAndExecuteFunctions(i,n)}return r},Object.create(Object.getPrototypeOf(t))):t)}isObjectOrArray(t){return typeof t=="object"&&t!==null}isObject(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}shallowCopy(t){return Array.isArray(t)?[...t]:{...t}}_toLogObj(t,n={}){return t=t?.map(r=>this.runtime.isError(r)?this._toErrorObject(r):r),this.settings.argumentsArrayName==null?t.length===1&&!Array.isArray(t[0])&&this.runtime.isBuffer(t[0])!==!0&&!(t[0]instanceof Date)?n=typeof t[0]=="object"&&t[0]!=null?{...t[0],...n}:{0:t[0],...n}:n={...n,...t}:n={...n,[this.settings.argumentsArrayName]:t},n}_cloneError(t){const n=new t.constructor;return Object.getOwnPropertyNames(t).forEach(r=>{n[r]=t[r]}),n}_toErrorObject(t){return{nativeError:t,name:t.name??"Error",message:t.message,stack:this.runtime.getErrorTrace(t)}}_addMetaToLogObj(t,n,r){return{...t,[this.settings.metaProperty]:this.runtime.getMeta(n,r,this.stackDepthLevel,this.settings.hideLogPositionForProduction,this.settings.name,this.settings.parentNames)}}_prettyFormatLogObjMeta(t){if(t==null)return"";let n=this.settings.prettyLogTemplate;const r={};n.includes("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}")?n=n.replace("{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}","{{dateIsoStr}}"):this.settings.prettyLogTimeZone==="UTC"?(r.yyyy=t?.date?.getUTCFullYear()??"----",r.mm=pn(t?.date?.getUTCMonth(),2,1),r.dd=pn(t?.date?.getUTCDate(),2),r.hh=pn(t?.date?.getUTCHours(),2),r.MM=pn(t?.date?.getUTCMinutes(),2),r.ss=pn(t?.date?.getUTCSeconds(),2),r.ms=pn(t?.date?.getUTCMilliseconds(),3)):(r.yyyy=t?.date?.getFullYear()??"----",r.mm=pn(t?.date?.getMonth(),2,1),r.dd=pn(t?.date?.getDate(),2),r.hh=pn(t?.date?.getHours(),2),r.MM=pn(t?.date?.getMinutes(),2),r.ss=pn(t?.date?.getSeconds(),2),r.ms=pn(t?.date?.getMilliseconds(),3));const o=this.settings.prettyLogTimeZone==="UTC"?t?.date:new Date(t?.date?.getTime()-t?.date?.getTimezoneOffset()*6e4);r.rawIsoStr=o?.toISOString(),r.dateIsoStr=o?.toISOString().replace("T"," ").replace("Z",""),r.logLevelName=t?.logLevelName,r.fileNameWithLine=t?.path?.fileNameWithLine??"",r.filePathWithLine=t?.path?.filePathWithLine??"",r.fullFilePath=t?.path?.fullFilePath??"";let a=this.settings.parentNames?.join(this.settings.prettyErrorParentNamesSeparator);return a=a!=null&&t?.name!=null?a+this.settings.prettyErrorParentNamesSeparator:void 0,r.name=t?.name!=null||a!=null?(a??"")+t?.name:"",r.nameWithDelimiterPrefix=r.name.length>0?this.settings.prettyErrorLoggerNameDelimiter+r.name:"",r.nameWithDelimiterSuffix=r.name.length>0?r.name+this.settings.prettyErrorLoggerNameDelimiter:"",this.settings.overwrite?.addPlaceholders!=null&&this.settings.overwrite?.addPlaceholders(t,r),B0(this.settings,n,r)}}class O3 extends I3{constructor(t,n){const r=typeof window<"u"&&typeof document<"u",o=r?window.chrome!==void 0&&window.CSS!==void 0&&window.CSS.supports("color","green"):!1,a=r?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1;t=t||{},t.stylePrettyLogs=t.stylePrettyLogs&&r&&!o?!1:t.stylePrettyLogs,super(t,n,a?4:5)}log(t,n,...r){return super.log(t,n,...r)}silly(...t){return super.log(0,"SILLY",...t)}trace(...t){return super.log(1,"TRACE",...t)}debug(...t){return super.log(2,"DEBUG",...t)}info(...t){return super.log(3,"INFO",...t)}warn(...t){return super.log(4,"WARN",...t)}error(...t){return super.log(5,"ERROR",...t)}fatal(...t){return super.log(6,"FATAL",...t)}getSubLogger(t,n){return super.getSubLogger(t,n)}}var _e={},Ii={},qu={},ea={},rl={};Object.defineProperty(rl,"__esModule",{value:!0});rl.DispatcherWrapper=void 0;class D3{constructor(t){this._subscribe=n=>t.subscribe(n),this._unsubscribe=n=>t.unsubscribe(n),this._one=n=>t.one(n),this._has=n=>t.has(n),this._clear=()=>t.clear(),this._count=()=>t.count,this._onSubscriptionChange=()=>t.onSubscriptionChange}get onSubscriptionChange(){return this._onSubscriptionChange()}get count(){return this._count()}subscribe(t){return this._subscribe(t)}sub(t){return this.subscribe(t)}unsubscribe(t){this._unsubscribe(t)}unsub(t){this.unsubscribe(t)}one(t){return this._one(t)}has(t){return this._has(t)}clear(){this._clear()}}rl.DispatcherWrapper=D3;var ol={};Object.defineProperty(ol,"__esModule",{value:!0});ol.Subscription=void 0;class L3{constructor(t,n){this.handler=t,this.isOnce=n,this.isExecuted=!1}execute(t,n,r){if(!this.isOnce||!this.isExecuted){this.isExecuted=!0;var o=this.handler;t?setTimeout(()=>{o.apply(n,r)},1):o.apply(n,r)}}}ol.Subscription=L3;var Oi={};Object.defineProperty(Oi,"__esModule",{value:!0});Oi.EventManagement=void 0;class j3{constructor(t){this.unsub=t,this.propagationStopped=!1}stopPropagation(){this.propagationStopped=!0}}Oi.EventManagement=j3;Object.defineProperty(ea,"__esModule",{value:!0});ea.SubscriptionChangeEventDispatcher=ea.DispatcherBase=void 0;const F3=rl,B3=ol,$3=Oi;class y2{constructor(){this._subscriptions=new Array}get count(){return this._subscriptions.length}get onSubscriptionChange(){return this._onSubscriptionChange==null&&(this._onSubscriptionChange=new b2),this._onSubscriptionChange.asEvent()}subscribe(t){return t&&(this._subscriptions.push(this.createSubscription(t,!1)),this.triggerSubscriptionChange()),()=>{this.unsubscribe(t)}}sub(t){return this.subscribe(t)}one(t){return t&&(this._subscriptions.push(this.createSubscription(t,!0)),this.triggerSubscriptionChange()),()=>{this.unsubscribe(t)}}has(t){return t?this._subscriptions.some(n=>n.handler==t):!1}unsubscribe(t){if(!t)return;let n=!1;for(let r=0;rthis.unsub(o.handler)),i=Array.prototype.slice.call(r);if(i.push(a),o.execute(t,n,i),this.cleanup(o),!t&&a.propagationStopped)return{propagationStopped:!0}}return t?null:{propagationStopped:!1}}createSubscription(t,n){return new B3.Subscription(t,n)}cleanup(t){let n=!1;if(t.isOnce&&t.isExecuted){let r=this._subscriptions.indexOf(t);r>-1&&(this._subscriptions.splice(r,1),n=!0)}n&&this.triggerSubscriptionChange()}asEvent(){return this._wrap==null&&(this._wrap=new F3.DispatcherWrapper(this)),this._wrap}clear(){this._subscriptions.length!=0&&(this._subscriptions.splice(0,this._subscriptions.length),this.triggerSubscriptionChange())}triggerSubscriptionChange(){this._onSubscriptionChange!=null&&this._onSubscriptionChange.dispatch(this.count)}}ea.DispatcherBase=y2;class b2 extends y2{dispatch(t){this._dispatch(!1,this,arguments)}}ea.SubscriptionChangeEventDispatcher=b2;var al={};Object.defineProperty(al,"__esModule",{value:!0});al.DispatchError=void 0;class U3 extends Error{constructor(t){super(t)}}al.DispatchError=U3;var Xu={};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.EventListBase=void 0;class V3{constructor(){this._events={}}get(t){let n=this._events[t];return n||(n=this.createDispatcher(),this._events[t]=n,n)}remove(t){delete this._events[t]}}Xu.EventListBase=V3;var Yu={};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.HandlingBase=void 0;class z3{constructor(t){this.events=t}one(t,n){this.events.get(t).one(n)}has(t,n){return this.events.get(t).has(n)}subscribe(t,n){this.events.get(t).subscribe(n)}sub(t,n){this.subscribe(t,n)}unsubscribe(t,n){this.events.get(t).unsubscribe(n)}unsub(t,n){this.unsubscribe(t,n)}}Yu.HandlingBase=z3;var Qu={},il={};Object.defineProperty(il,"__esModule",{value:!0});il.PromiseSubscription=void 0;class H3{constructor(t,n){this.handler=t,this.isOnce=n,this.isExecuted=!1}async execute(t,n,r){if(!this.isOnce||!this.isExecuted){this.isExecuted=!0;var o=this.handler;if(t){setTimeout(()=>{o.apply(n,r)},1);return}await o.apply(n,r)}}}il.PromiseSubscription=H3;Object.defineProperty(Qu,"__esModule",{value:!0});Qu.PromiseDispatcherBase=void 0;const W3=il,G3=Oi,K3=ea,q3=al;class X3 extends K3.DispatcherBase{_dispatch(t,n,r){throw new q3.DispatchError("_dispatch not supported. Use _dispatchAsPromise.")}createSubscription(t,n){return new W3.PromiseSubscription(t,n)}async _dispatchAsPromise(t,n,r){for(let o of[...this._subscriptions]){let a=new G3.EventManagement(()=>this.unsub(o.handler)),i=Array.prototype.slice.call(r);if(i.push(a),await o.execute(t,n,i),this.cleanup(o),!t&&a.propagationStopped)return{propagationStopped:!0}}return t?null:{propagationStopped:!1}}}Qu.PromiseDispatcherBase=X3;(function(e){/*! - * Strongly Typed Events for TypeScript - Core - * https://github.com/KeesCBakker/StronlyTypedEvents/ - * http://keestalkstech.com - * - * Copyright Kees C. Bakker / KeesTalksTech - * Released under the MIT license - */Object.defineProperty(e,"__esModule",{value:!0}),e.SubscriptionChangeEventDispatcher=e.HandlingBase=e.PromiseDispatcherBase=e.PromiseSubscription=e.DispatchError=e.EventManagement=e.EventListBase=e.DispatcherWrapper=e.DispatcherBase=e.Subscription=void 0;const t=ea;Object.defineProperty(e,"DispatcherBase",{enumerable:!0,get:function(){return t.DispatcherBase}}),Object.defineProperty(e,"SubscriptionChangeEventDispatcher",{enumerable:!0,get:function(){return t.SubscriptionChangeEventDispatcher}});const n=al;Object.defineProperty(e,"DispatchError",{enumerable:!0,get:function(){return n.DispatchError}});const r=rl;Object.defineProperty(e,"DispatcherWrapper",{enumerable:!0,get:function(){return r.DispatcherWrapper}});const o=Xu;Object.defineProperty(e,"EventListBase",{enumerable:!0,get:function(){return o.EventListBase}});const a=Oi;Object.defineProperty(e,"EventManagement",{enumerable:!0,get:function(){return a.EventManagement}});const i=Yu;Object.defineProperty(e,"HandlingBase",{enumerable:!0,get:function(){return i.HandlingBase}});const s=Qu;Object.defineProperty(e,"PromiseDispatcherBase",{enumerable:!0,get:function(){return s.PromiseDispatcherBase}});const l=il;Object.defineProperty(e,"PromiseSubscription",{enumerable:!0,get:function(){return l.PromiseSubscription}});const c=ol;Object.defineProperty(e,"Subscription",{enumerable:!0,get:function(){return c.Subscription}})})(qu);Object.defineProperty(Ii,"__esModule",{value:!0});Ii.SimpleEventDispatcher=void 0;const Gv=qu;class Y3 extends Gv.DispatcherBase{constructor(){super()}dispatch(t){const n=this._dispatch(!1,this,arguments);if(n==null)throw new Gv.DispatchError("Got `null` back from dispatch.");return n}dispatchAsync(t){this._dispatch(!0,this,arguments)}asEvent(){return super.asEvent()}}Ii.SimpleEventDispatcher=Y3;var Zu={},sl={};Object.defineProperty(sl,"__esModule",{value:!0});sl.SimpleEventList=void 0;const Q3=qu,Z3=Ii;class J3 extends Q3.EventListBase{constructor(){super()}createDispatcher(){return new Z3.SimpleEventDispatcher}}sl.SimpleEventList=J3;Object.defineProperty(Zu,"__esModule",{value:!0});Zu.SimpleEventHandlingBase=void 0;const eN=qu,tN=sl;class nN extends eN.HandlingBase{constructor(){super(new tN.SimpleEventList)}}Zu.SimpleEventHandlingBase=nN;var Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.NonUniformSimpleEventList=void 0;const rN=Ii;class oN{constructor(){this._events={}}get(t){if(this._events[t])return this._events[t];const n=this.createDispatcher();return this._events[t]=n,n}remove(t){delete this._events[t]}createDispatcher(){return new rN.SimpleEventDispatcher}}Ju.NonUniformSimpleEventList=oN;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NonUniformSimpleEventList=e.SimpleEventList=e.SimpleEventHandlingBase=e.SimpleEventDispatcher=void 0;const t=Ii;Object.defineProperty(e,"SimpleEventDispatcher",{enumerable:!0,get:function(){return t.SimpleEventDispatcher}});const n=Zu;Object.defineProperty(e,"SimpleEventHandlingBase",{enumerable:!0,get:function(){return n.SimpleEventHandlingBase}});const r=Ju;Object.defineProperty(e,"NonUniformSimpleEventList",{enumerable:!0,get:function(){return r.NonUniformSimpleEventList}});const o=sl;Object.defineProperty(e,"SimpleEventList",{enumerable:!0,get:function(){return o.SimpleEventList}})})(_e);let U0=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];typeof Int32Array<"u"&&(U0=new Int32Array(U0));const lf=(e,t)=>{let n=typeof t<"u"?~~t:65535;for(let r=0;r>8^e[r])&255]^n<<8)&65535;return n};var Kv={},aN=Object.defineProperty,nt=(e,t)=>{for(var n in t)aN(e,n,{get:t[n],enumerable:!0})},V0="f75c76d2-129e-4dad-a1dd-7866124401e7",z0="2c55e69e-4993-11ed-b878-0242ac120002",H0="ed9da18c-a800-4f66-a670-aa7547e34453",W0="6ba1b218-15a8-461f-9fa8-5dcae273eafd",G0=4294967295,K0=2.2,iN={ToRadioUuid:V0,FromRadioUuid:z0,FromNumUuid:H0,ServiceUuid:W0,broadcastNum:G0,minFwVer:K0},pe={};nt(pe,{Admin:()=>qe,AppOnly:()=>I_,CannedMessages:()=>O_,Channel:()=>lu,ClientOnly:()=>D_,Config:()=>U2,ConnectionStatus:()=>k_,DeviceOnly:()=>j_,LocalOnly:()=>L_,Mesh:()=>it,ModuleConfig:()=>r_,Mqtt:()=>V_,PaxCount:()=>dh,Portnums:()=>be,RemoteHardware:()=>fh,Rtttl:()=>H_,StoreForward:()=>W_,Telemetry:()=>Bm,Xmodem:()=>bt});var qe={};nt(qe,{AdminMessage:()=>uP,AdminMessage_ConfigType:()=>P_,AdminMessage_ModuleConfigType:()=>M_,HamParameters:()=>A_,NodeRemoteHardwarePinsResponse:()=>R_});function tt(e,t){if(!e)throw new Error(t)}var sN=34028234663852886e22,lN=-34028234663852886e22,cN=4294967295,uN=2147483647,dN=-2147483648;function wc(e){if(typeof e!="number")throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>uN||ecN||e<0)throw new Error("invalid uint 32: "+e)}function w2(e){if(typeof e!="number")throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>sN||e({no:o.no,name:o.name,localName:e[o.no]})))}function k2(e,t,n){const r=Object.create(null),o=Object.create(null),a=[];for(const i of t){const s=C2(i);a.push(s),r[i.name]=s,o[i.no]=s}return{typeName:e,values:a,findName(i){return r[i]},findNumber(i){return o[i]}}}function pN(e,t,n){const r={};for(const o of t){const a=C2(o);r[a.localName]=a.no,r[a.no]=a.localName}return x2(r,e,t),r}function C2(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}var S2=class{equals(t){return this.getType().runtime.util.equals(this.getType(),this,t)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(t,n){const r=this.getType(),o=r.runtime.bin,a=o.makeReadOptions(n);return o.readMessage(this,a.readerFactory(t),t.byteLength,a),this}fromJson(t,n){const r=this.getType(),o=r.runtime.json,a=o.makeReadOptions(n);return o.readMessage(r,t,a,this),this}fromJsonString(t,n){let r;try{r=JSON.parse(t)}catch(o){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${o instanceof Error?o.message:String(o)}`)}return this.fromJson(r,n)}toBinary(t){const n=this.getType(),r=n.runtime.bin,o=r.makeWriteOptions(t),a=o.writerFactory();return r.writeMessage(this,a,o),a.finish()}toJson(t){const n=this.getType(),r=n.runtime.json,o=r.makeWriteOptions(t);return r.writeMessage(this,o)}toJsonString(t){var n;const r=this.toJson(t);return JSON.stringify(r,null,(n=t?.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function mN(e,t,n,r){var o;const a=(o=r?.localName)!==null&&o!==void 0?o:t.substring(t.lastIndexOf(".")+1),i={[a]:function(s){e.util.initFields(this),e.util.initPartial(s,this)}}[a];return Object.setPrototypeOf(i.prototype,new S2),Object.assign(i,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(s,l){return new i().fromBinary(s,l)},fromJson(s,l){return new i().fromJson(s,l)},fromJsonString(s,l){return new i().fromJsonString(s,l)},equals(s,l){return e.util.equals(i,s,l)}}),i}function hN(){let e=0,t=0;for(let r=0;r<28;r+=7){let o=this.buf[this.pos++];if(e|=(o&127)<>4,!(n&128))return this.assertBounds(),[e,t];for(let r=3;r<=31;r+=7){let o=this.buf[this.pos++];if(t|=(o&127)<>>a,s=!(!(i>>>7)&&t==0),l=(s?i|128:i)&255;if(n.push(l),!s)return}const r=e>>>28&15|(t&7)<<4,o=!!(t>>3);if(n.push((o?r|128:r)&255),!!o){for(let a=3;a<31;a=a+7){const i=t>>>a,s=!!(i>>>7),l=(s?i|128:i)&255;if(n.push(l),!s)return}n.push(t>>>31&1)}}var _c=4294967296;function qv(e){const t=e[0]==="-";t&&(e=e.slice(1));const n=1e6;let r=0,o=0;function a(i,s){const l=Number(e.slice(i,s));o*=n,r=r*n+l,r>=_c&&(o=o+(r/_c|0),r=r%_c)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?E2(r,o):Em(r,o)}function gN(e,t){let n=Em(e,t);const r=n.hi&2147483648;r&&(n=E2(n.lo,n.hi));const o=T2(n.lo,n.hi);return r?"-"+o:o}function T2(e,t){if({lo:e,hi:t}=vN(e,t),t<=2097151)return String(_c*t+e);const n=e&16777215,r=(e>>>24|t<<8)&16777215,o=t>>16&65535;let a=n+r*6777216+o*6710656,i=r+o*8147497,s=o*2;const l=1e7;return a>=l&&(i+=Math.floor(a/l),a%=l),i>=l&&(s+=Math.floor(i/l),i%=l),s.toString()+Xv(i)+Xv(a)}function vN(e,t){return{lo:e>>>0,hi:t>>>0}}function Em(e,t){return{lo:e|0,hi:t|0}}function E2(e,t){return t=~t,e?e=~e+1:t+=1,Em(e,t)}var Xv=e=>{const t=String(e);return"0000000".slice(t.length)+t};function Yv(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e=e>>7;t.push(1)}}function yN(){let e=this.buf[this.pos++],t=e&127;if(!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let n=5;e&128&&n<10;n++)e=this.buf[this.pos++];if(e&128)throw new Error("invalid varint");return this.assertBounds(),t>>>0}function bN(){const e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(typeof process!="object"||typeof Kv!="object"||Kv.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),a=BigInt("9223372036854775807"),i=BigInt("0"),s=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(l){const c=typeof l=="bigint"?l:BigInt(l);if(c>a||cs||ctt(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),r=o=>tt(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse(o){return typeof o!="string"&&(o=o.toString()),n(o),o},uParse(o){return typeof o!="string"&&(o=o.toString()),r(o),o},enc(o){return typeof o!="string"&&(o=o.toString()),n(o),qv(o)},uEnc(o){return typeof o!="string"&&(o=o.toString()),r(o),qv(o)},dec(o,a){return gN(o,a)},uDec(o,a){return T2(o,a)}}}var Qt=bN(),te;(function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"})(te||(te={}));var ho;(function(e){e[e.BIGINT=0]="BIGINT",e[e.STRING=1]="STRING"})(ho||(ho={}));function zr(e,t,n){if(t===n)return!0;if(e==te.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let r=0;r>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(q0(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return wc(e),Yv(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){w2(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){q0(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){wc(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return wc(e),e=(e<<1^e>>31)>>>0,Yv(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=Qt.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=Qt.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=Qt.enc(e);return cf(t.lo,t.hi,this.buf),this}sint64(e){let t=Qt.enc(e),n=t.hi>>31,r=t.lo<<1^n,o=(t.hi<<1|t.lo>>>31)^n;return cf(r,o,this.buf),this}uint64(e){let t=Qt.uEnc(e);return cf(t.lo,t.hi,this.buf),this}},_N=class{constructor(e,t){this.varint64=hN,this.uint32=yN,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case ot.Varint:for(;this.buf[this.pos++]&128;);break;case ot.Bit64:this.pos+=4;case ot.Bit32:this.pos+=4;break;case ot.LengthDelimited:let r=this.uint32();this.pos+=r;break;case ot.StartGroup:for(;;){const[o,a]=this.tag();if(a===ot.EndGroup){if(t!==void 0&&o!==t)throw new Error("invalid end group tag");break}this.skip(a,o)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return Qt.dec(...this.varint64())}uint64(){return Qt.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,Qt.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Qt.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Qt.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function xN(e,t,n,r){let o;return{typeName:t,extendee:n,get field(){if(!o){const a=typeof r=="function"?r():r;a.name=t.split(".").pop(),a.jsonName=`[${t}]`,o=e.util.newFieldList([a]).list()[0]}return o},runtime:e}}function P2(e){const t=e.field.localName,n=Object.create(null);return n[t]=kN(e),[n,()=>n[t]]}function kN(e){const t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return Si(t.T,t.L);case"message":const n=t.T,r=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(r):r;case"map":throw"map fields are not allowed to be extensions"}}function CN(e,t){if(!t.repeated&&(t.kind=="enum"||t.kind=="scalar")){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(n=>n.no===t.no)}var gr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ed=[];for(let e=0;e>4,i=a,o=2;break;case 2:n[r++]=(i&15)<<4|(a&60)>>2,i=a,o=3;break;case 3:n[r++]=(i&3)<<6|a,o=0;break}}if(o==1)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(e){let t="",n=0,r,o=0;for(let a=0;a>2],o=(r&3)<<4,n=1;break;case 1:t+=gr[o|r>>4],o=(r&15)<<2,n=2;break;case 2:t+=gr[o|r>>6],t+=gr[r&63],n=0;break}return n&&(t+=gr[o],t+="=",n==1&&(t+="=")),t}};function SN(e,t,n){R2(t,e);const r=t.runtime.bin.makeReadOptions(n),o=CN(e.getType().runtime.bin.listUnknownFields(e),t.field),[a,i]=P2(t);for(const s of o)t.runtime.bin.readField(a,r.readerFactory(s.data),t.field,s.wireType,r);return i()}function TN(e,t,n,r){R2(t,e);const o=t.runtime.bin.makeReadOptions(r),a=t.runtime.bin.makeWriteOptions(r);if(A2(e,t)){const c=e.getType().runtime.bin.listUnknownFields(e).filter(u=>u.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(const u of c)e.getType().runtime.bin.onUnknownField(e,u.no,u.wireType,u.data)}const i=a.writerFactory();let s=t.field;!s.opt&&!s.repeated&&(s.kind=="enum"||s.kind=="scalar")&&(s=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(s,n,i,a);const l=o.readerFactory(i.finish());for(;l.posr.no==t.field.no)}function R2(e,t){tt(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}function I2(e,t){const n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?t[n]!==void 0:e.kind=="enum"?t[n]!==e.T.values[0].no:!N2(e.T,t[n]);case"message":return t[n]!==void 0;case"map":return Object.keys(t[n]).length>0}}function Qv(e,t){const n=e.localName,r=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=r?e.T.values[0].no:void 0;break;case"scalar":t[n]=r?Si(e.T,e.L):void 0;break;case"message":t[n]=void 0;break}}function Wo(e,t){if(e===null||typeof e!="object"||!Object.getOwnPropertyNames(S2.prototype).every(r=>r in e&&typeof e[r]=="function"))return!1;const n=e.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:t===void 0?!0:n.typeName==t.typeName}function O2(e,t){return Wo(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}te.DOUBLE,te.FLOAT,te.INT64,te.UINT64,te.INT32,te.UINT32,te.BOOL,te.STRING,te.BYTES;var Zv={ignoreUnknownFields:!1},Jv={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function EN(e){return e?Object.assign(Object.assign({},Zv),e):Zv}function NN(e){return e?Object.assign(Object.assign({},Jv),e):Jv}var iu=Symbol(),xc=Symbol();function PN(){return{makeReadOptions:EN,makeWriteOptions:NN,readMessage(e,t,n,r){if(t==null||Array.isArray(t)||typeof t!="object")throw new Error(`cannot decode message ${e.typeName} from JSON: ${Wn(t)}`);r=r??new e;const o=new Map,a=n.typeRegistry;for(const[i,s]of Object.entries(t)){const l=e.fields.findJsonName(i);if(l){if(l.oneof){if(s===null&&l.kind=="scalar")continue;const c=o.get(l.oneof);if(c!==void 0)throw new Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${c}", "${i}"`);o.set(l.oneof,i)}ey(r,s,l,n,e)}else{let c=!1;if(a?.findExtension&&i.startsWith("[")&&i.endsWith("]")){const u=a.findExtension(i.substring(1,i.length-1));if(u&&u.extendee.typeName==e.typeName){c=!0;const[d,p]=P2(u);ey(d,s,u.field,n,u),TN(r,u,p(),n)}}if(!c&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${e.typeName} from JSON: key "${i}" is unknown`)}}return r},writeMessage(e,t){const n=e.getType(),r={};let o;try{for(o of n.fields.byNumber()){if(!I2(o,e)){if(o.req)throw"required field not set";if(!t.emitDefaultValues||!AN(o))continue}const i=o.oneof?e[o.oneof.localName].value:e[o.localName],s=ty(o,i,t);s!==void 0&&(r[t.useProtoFieldName?o.name:o.jsonName]=s)}const a=t.typeRegistry;if(a?.findExtensionFor)for(const i of n.runtime.bin.listUnknownFields(e)){const s=a.findExtensionFor(n.typeName,i.no);if(s&&A2(e,s)){const l=SN(e,s,t),c=ty(s.field,l,t);c!==void 0&&(r[s.field.jsonName]=c)}}}catch(a){const i=o?`cannot encode field ${n.typeName}.${o.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,s=a instanceof Error?a.message:String(a);throw new Error(i+(s.length>0?`: ${s}`:""))}return r},readScalar(e,t,n){return gs(e,t,n??ho.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||N2(e,t)))return kc(e,t)},debug:Wn}}function Wn(e){if(e===null)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":`"${e.split('"').join('\\"')}"`;default:return String(e)}}function ey(e,t,n,r,o){let a=n.localName;if(n.repeated){if(tt(n.kind!="map"),t===null)return;if(!Array.isArray(t))throw new Error(`cannot decode field ${o.typeName}.${n.name} from JSON: ${Wn(t)}`);const i=e[a];for(const s of t){if(s===null)throw new Error(`cannot decode field ${o.typeName}.${n.name} from JSON: ${Wn(s)}`);switch(n.kind){case"message":i.push(n.T.fromJson(s,r));break;case"enum":const l=uf(n.T,s,r.ignoreUnknownFields,!0);l!==xc&&i.push(l);break;case"scalar":try{i.push(gs(n.T,s,n.L,!0))}catch(c){let u=`cannot decode field ${o.typeName}.${n.name} from JSON: ${Wn(s)}`;throw c instanceof Error&&c.message.length>0&&(u+=`: ${c.message}`),new Error(u)}break}}}else if(n.kind=="map"){if(t===null)return;if(typeof t!="object"||Array.isArray(t))throw new Error(`cannot decode field ${o.typeName}.${n.name} from JSON: ${Wn(t)}`);const i=e[a];for(const[s,l]of Object.entries(t)){if(l===null)throw new Error(`cannot decode field ${o.typeName}.${n.name} from JSON: map value null`);let c;try{c=MN(n.K,s)}catch(u){let d=`cannot decode map key for field ${o.typeName}.${n.name} from JSON: ${Wn(t)}`;throw u instanceof Error&&u.message.length>0&&(d+=`: ${u.message}`),new Error(d)}switch(n.V.kind){case"message":i[c]=n.V.T.fromJson(l,r);break;case"enum":const u=uf(n.V.T,l,r.ignoreUnknownFields,!0);u!==xc&&(i[c]=u);break;case"scalar":try{i[c]=gs(n.V.T,l,ho.BIGINT,!0)}catch(d){let p=`cannot decode map value for field ${o.typeName}.${n.name} from JSON: ${Wn(t)}`;throw d instanceof Error&&d.message.length>0&&(p+=`: ${d.message}`),new Error(p)}break}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a="value"),n.kind){case"message":const i=n.T;if(t===null&&i.typeName!="google.protobuf.Value")return;let s=e[a];Wo(s)?s.fromJson(t,r):(e[a]=s=i.fromJson(t,r),i.fieldWrapper&&!n.oneof&&(e[a]=i.fieldWrapper.unwrapField(s)));break;case"enum":const l=uf(n.T,t,r.ignoreUnknownFields,!1);switch(l){case iu:Qv(n,e);break;case xc:break;default:e[a]=l;break}break;case"scalar":try{const c=gs(n.T,t,n.L,!1);switch(c){case iu:Qv(n,e);break;default:e[a]=c;break}}catch(c){let u=`cannot decode field ${o.typeName}.${n.name} from JSON: ${Wn(t)}`;throw c instanceof Error&&c.message.length>0&&(u+=`: ${c.message}`),new Error(u)}break}}function MN(e,t){if(e===te.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1;break}return gs(e,t,ho.BIGINT,!0).toString()}function gs(e,t,n,r){if(t===null)return r?Si(e,n):iu;switch(e){case te.DOUBLE:case te.FLOAT:if(t==="NaN")return Number.NaN;if(t==="Infinity")return Number.POSITIVE_INFINITY;if(t==="-Infinity")return Number.NEGATIVE_INFINITY;if(t===""||typeof t=="string"&&t.trim().length!==t.length||typeof t!="string"&&typeof t!="number")break;const o=Number(t);if(Number.isNaN(o)||!Number.isFinite(o))break;return e==te.FLOAT&&w2(o),o;case te.INT32:case te.FIXED32:case te.SFIXED32:case te.SINT32:case te.UINT32:let a;if(typeof t=="number"?a=t:typeof t=="string"&&t.length>0&&t.trim().length===t.length&&(a=Number(t)),a===void 0)break;return e==te.UINT32||e==te.FIXED32?q0(a):wc(a),a;case te.INT64:case te.SFIXED64:case te.SINT64:if(typeof t!="number"&&typeof t!="string")break;const i=Qt.parse(t);return n?i.toString():i;case te.FIXED64:case te.UINT64:if(typeof t!="number"&&typeof t!="string")break;const s=Qt.uParse(t);return n?s.toString():s;case te.BOOL:if(typeof t!="boolean")break;return t;case te.STRING:if(typeof t!="string")break;try{encodeURIComponent(t)}catch{throw new Error("invalid UTF8")}return t;case te.BYTES:if(t==="")return new Uint8Array(0);if(typeof t!="string")break;return M2.dec(t)}throw new Error}function uf(e,t,n,r){if(t===null)return e.typeName=="google.protobuf.NullValue"?0:r?e.values[0].no:iu;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const o=e.findName(t);if(o!==void 0)return o.no;if(n)return xc;break}throw new Error(`cannot decode enum ${e.typeName} from JSON: ${Wn(t)}`)}function AN(e){return e.repeated||e.kind=="map"?!0:!(e.oneof||e.kind=="message"||e.opt||e.req)}function ty(e,t,n){if(e.kind=="map"){tt(typeof t=="object"&&t!=null);const r={},o=Object.entries(t);switch(e.V.kind){case"scalar":for(const[i,s]of o)r[i.toString()]=kc(e.V.T,s);break;case"message":for(const[i,s]of o)r[i.toString()]=s.toJson(n);break;case"enum":const a=e.V.T;for(const[i,s]of o)r[i.toString()]=df(a,s,n.enumAsInteger);break}return n.emitDefaultValues||o.length>0?r:void 0}if(e.repeated){tt(Array.isArray(t));const r=[];switch(e.kind){case"scalar":for(let o=0;o0?r:void 0}switch(e.kind){case"scalar":return kc(e.T,t);case"enum":return df(e.T,t,n.enumAsInteger);case"message":return O2(e.T,t).toJson(n)}}function df(e,t,n){var r;if(tt(typeof t=="number"),e.typeName=="google.protobuf.NullValue")return null;if(n)return t;const o=e.findNumber(t);return(r=o?.name)!==null&&r!==void 0?r:t}function kc(e,t){switch(e){case te.INT32:case te.SFIXED32:case te.SINT32:case te.FIXED32:case te.UINT32:return tt(typeof t=="number"),t;case te.FLOAT:case te.DOUBLE:return tt(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case te.STRING:return tt(typeof t=="string"),t;case te.BOOL:return tt(typeof t=="boolean"),t;case te.UINT64:case te.FIXED64:case te.INT64:case te.SFIXED64:case te.SINT64:return tt(typeof t=="bigint"||typeof t=="string"||typeof t=="number"),t.toString();case te.BYTES:return tt(t instanceof Uint8Array),M2.enc(t)}}var Oa=Symbol("@bufbuild/protobuf/unknown-fields"),ny={readUnknownFields:!0,readerFactory:e=>new _N(e)},ry={writeUnknownFields:!0,writerFactory:()=>new wN};function RN(e){return e?Object.assign(Object.assign({},ny),e):ny}function IN(e){return e?Object.assign(Object.assign({},ry),e):ry}function ON(){return{makeReadOptions:RN,makeWriteOptions:IN,listUnknownFields(e){var t;return(t=e[Oa])!==null&&t!==void 0?t:[]},discardUnknownFields(e){delete e[Oa]},writeUnknownFields(e,t){const r=e[Oa];if(r)for(const o of r)t.tag(o.no,o.wireType).raw(o.data)},onUnknownField(e,t,n,r){const o=e;Array.isArray(o[Oa])||(o[Oa]=[]),o[Oa].push({no:t,wireType:n,data:r})},readMessage(e,t,n,r,o){const a=e.getType(),i=o?t.len:t.pos+n;let s,l;for(;t.pos0&&(l=LN),a){let p=e[i];if(r==ot.LengthDelimited&&s!=te.STRING&&s!=te.BYTES){let v=t.uint32()+t.pos;for(;t.posWo(p,d)?p:new d(p));else{const p=i[o];d.fieldWrapper?d.typeName==="google.protobuf.BytesValue"?a[o]=Qi(p):a[o]=p:a[o]=Wo(p,d)?p:new d(p)}break}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(r=>{const o=t[r.localName],a=n[r.localName];if(r.repeated){if(o.length!==a.length)return!1;switch(r.kind){case"message":return o.every((i,s)=>r.T.equals(i,a[s]));case"scalar":return o.every((i,s)=>zr(r.T,i,a[s]));case"enum":return o.every((i,s)=>zr(te.INT32,i,a[s]))}throw new Error(`repeated cannot contain ${r.kind}`)}switch(r.kind){case"message":return r.T.equals(o,a);case"enum":return zr(te.INT32,o,a);case"scalar":return zr(r.T,o,a);case"oneof":if(o.case!==a.case)return!1;const i=r.findField(o.case);if(i===void 0)return!0;switch(i.kind){case"message":return i.T.equals(o.value,a.value);case"enum":return zr(te.INT32,o.value,a.value);case"scalar":return zr(i.T,o.value,a.value)}throw new Error(`oneof cannot contain ${i.kind}`);case"map":const s=Object.keys(o).concat(Object.keys(a));switch(r.V.kind){case"message":const l=r.V.T;return s.every(u=>l.equals(o[u],a[u]));case"enum":return s.every(u=>zr(te.INT32,o[u],a[u]));case"scalar":const c=r.V.T;return s.every(u=>zr(c,o[u],a[u]))}break}})},clone(e){const t=e.getType(),n=new t,r=n;for(const o of t.fields.byMember()){const a=e[o.localName];let i;if(o.repeated)i=a.map(Gl);else if(o.kind=="map"){i=r[o.localName];for(const[s,l]of Object.entries(a))i[s]=Gl(l)}else o.kind=="oneof"?i=o.findField(a.case)?{case:a.case,value:Gl(a.value)}:{case:void 0}:i=Gl(a);r[o.localName]=i}for(const o of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(r,o.no,o.wireType,o.data);return n}}}function Gl(e){if(e===void 0)return e;if(Wo(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function Qi(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function $N(e,t,n){return{syntax:e,json:PN(),bin:ON(),util:Object.assign(Object.assign({},BN()),{newFieldList:t,initFields:n}),makeMessageType(r,o,a){return mN(this,r,o,a)},makeEnum:pN,makeEnumType:k2,getEnumType:fN,makeExtension(r,o,a){return xN(this,r,o,a)}}}var UN=class{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const t={};for(const n of this.list())t[n.jsonName]=t[n.name]=n;this.jsonNames=t}return this.jsonNames[e]}find(e){if(!this.numbers){const t={};for(const n of this.list())t[n.no]=n;this.numbers=t}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,t)=>e.no-t.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}};function L2(e,t){const n=j2(e);return t?n:KN(GN(n))}function VN(e){return L2(e,!1)}var zN=j2;function j2(e){let t=!1;const n=[];for(let r=0;r`${e}$`,GN=e=>WN.has(e)?F2(e):e,KN=e=>HN.has(e)?F2(e):e,qN=class{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=VN(e)}addField(e){tt(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let t=0;tnew UN(e,t=>XN(t)),e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const n=t.localName,r=e;if(t.repeated){r[n]=[];continue}switch(t.kind){case"oneof":r[n]={case:void 0};break;case"enum":r[n]=0;break;case"map":r[n]={};break;case"scalar":r[n]=Si(t.T,t.L);break}}}),lu={};nt(lu,{Channel:()=>zs,ChannelSettings:()=>Nm,Channel_Role:()=>$2,ModuleSettings:()=>B2});var Nm=W.makeMessageType("meshtastic.ChannelSettings",()=>[{no:1,name:"channel_num",kind:"scalar",T:13},{no:2,name:"psk",kind:"scalar",T:12},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"id",kind:"scalar",T:7},{no:5,name:"uplink_enabled",kind:"scalar",T:8},{no:6,name:"downlink_enabled",kind:"scalar",T:8},{no:7,name:"module_settings",kind:"message",T:B2}]),B2=W.makeMessageType("meshtastic.ModuleSettings",()=>[{no:1,name:"position_precision",kind:"scalar",T:13},{no:2,name:"is_client_muted",kind:"scalar",T:8}]),zs=W.makeMessageType("meshtastic.Channel",()=>[{no:1,name:"index",kind:"scalar",T:5},{no:2,name:"settings",kind:"message",T:Nm},{no:3,name:"role",kind:"enum",T:W.getEnumType($2)}]),$2=W.makeEnum("meshtastic.Channel.Role",[{no:0,name:"DISABLED"},{no:1,name:"PRIMARY"},{no:2,name:"SECONDARY"}]),it={};nt(it,{ChunkedPayload:()=>lP,ChunkedPayloadResponse:()=>cP,ClientNotification:()=>y_,Compressed:()=>iP,Constants:()=>eP,CriticalErrorCode:()=>tP,Data:()=>f_,DeviceMetadata:()=>ih,FileInfo:()=>b_,FromRadio:()=>oP,HardwareModel:()=>ll,Heartbeat:()=>__,LogRecord:()=>g_,LogRecord_Level:()=>ah,MeshPacket:()=>Go,MeshPacket_Delayed:()=>m_,MeshPacket_Priority:()=>p_,MqttClientProxyMessage:()=>rh,MyNodeInfo:()=>oh,Neighbor:()=>w_,NeighborInfo:()=>sP,NodeInfo:()=>h_,NodeRemoteHardwarePin:()=>sh,Position:()=>th,Position_AltSource:()=>u_,Position_LocSource:()=>nh,QueueStatus:()=>v_,RouteDiscovery:()=>X0,Routing:()=>nP,Routing_Error:()=>d_,ToRadio:()=>aP,User:()=>Hs,Waypoint:()=>rP,resend_chunks:()=>x_});var U2={};nt(U2,{Config:()=>cu,Config_BluetoothConfig:()=>Lm,Config_BluetoothConfig_PairingMode:()=>Q2,Config_DeviceConfig:()=>Pm,Config_DeviceConfig_RebroadcastMode:()=>V2,Config_DeviceConfig_Role:()=>Di,Config_DisplayConfig:()=>Im,Config_DisplayConfig_CompassOrientation:()=>Y2,Config_DisplayConfig_DisplayMode:()=>X2,Config_DisplayConfig_DisplayUnits:()=>K2,Config_DisplayConfig_GpsCoordinateFormat:()=>G2,Config_DisplayConfig_OledType:()=>q2,Config_LoRaConfig:()=>td,Config_LoRaConfig_ModemPreset:()=>Dm,Config_LoRaConfig_RegionCode:()=>Om,Config_NetworkConfig:()=>Rm,Config_NetworkConfig_AddressMode:()=>H2,Config_NetworkConfig_IpV4Config:()=>W2,Config_PositionConfig:()=>Mm,Config_PositionConfig_GpsMode:()=>z2,Config_PositionConfig_PositionFlags:()=>YN,Config_PowerConfig:()=>Am,Config_SecurityConfig:()=>jm,Config_SessionkeyConfig:()=>Z2});var cu=W.makeMessageType("meshtastic.Config",()=>[{no:1,name:"device",kind:"message",T:Pm,oneof:"payload_variant"},{no:2,name:"position",kind:"message",T:Mm,oneof:"payload_variant"},{no:3,name:"power",kind:"message",T:Am,oneof:"payload_variant"},{no:4,name:"network",kind:"message",T:Rm,oneof:"payload_variant"},{no:5,name:"display",kind:"message",T:Im,oneof:"payload_variant"},{no:6,name:"lora",kind:"message",T:td,oneof:"payload_variant"},{no:7,name:"bluetooth",kind:"message",T:Lm,oneof:"payload_variant"},{no:8,name:"security",kind:"message",T:jm,oneof:"payload_variant"},{no:9,name:"sessionkey",kind:"message",T:Z2,oneof:"payload_variant"}]),Pm=W.makeMessageType("meshtastic.Config.DeviceConfig",()=>[{no:1,name:"role",kind:"enum",T:W.getEnumType(Di)},{no:2,name:"serial_enabled",kind:"scalar",T:8},{no:4,name:"button_gpio",kind:"scalar",T:13},{no:5,name:"buzzer_gpio",kind:"scalar",T:13},{no:6,name:"rebroadcast_mode",kind:"enum",T:W.getEnumType(V2)},{no:7,name:"node_info_broadcast_secs",kind:"scalar",T:13},{no:8,name:"double_tap_as_button_press",kind:"scalar",T:8},{no:9,name:"is_managed",kind:"scalar",T:8},{no:10,name:"disable_triple_click",kind:"scalar",T:8},{no:11,name:"tzdef",kind:"scalar",T:9},{no:12,name:"led_heartbeat_disabled",kind:"scalar",T:8}],{localName:"Config_DeviceConfig"}),Di=W.makeEnum("meshtastic.Config.DeviceConfig.Role",[{no:0,name:"CLIENT"},{no:1,name:"CLIENT_MUTE"},{no:2,name:"ROUTER"},{no:3,name:"ROUTER_CLIENT"},{no:4,name:"REPEATER"},{no:5,name:"TRACKER"},{no:6,name:"SENSOR"},{no:7,name:"TAK"},{no:8,name:"CLIENT_HIDDEN"},{no:9,name:"LOST_AND_FOUND"},{no:10,name:"TAK_TRACKER"}]),V2=W.makeEnum("meshtastic.Config.DeviceConfig.RebroadcastMode",[{no:0,name:"ALL"},{no:1,name:"ALL_SKIP_DECODING"},{no:2,name:"LOCAL_ONLY"},{no:3,name:"KNOWN_ONLY"}]),Mm=W.makeMessageType("meshtastic.Config.PositionConfig",()=>[{no:1,name:"position_broadcast_secs",kind:"scalar",T:13},{no:2,name:"position_broadcast_smart_enabled",kind:"scalar",T:8},{no:3,name:"fixed_position",kind:"scalar",T:8},{no:4,name:"gps_enabled",kind:"scalar",T:8},{no:5,name:"gps_update_interval",kind:"scalar",T:13},{no:6,name:"gps_attempt_time",kind:"scalar",T:13},{no:7,name:"position_flags",kind:"scalar",T:13},{no:8,name:"rx_gpio",kind:"scalar",T:13},{no:9,name:"tx_gpio",kind:"scalar",T:13},{no:10,name:"broadcast_smart_minimum_distance",kind:"scalar",T:13},{no:11,name:"broadcast_smart_minimum_interval_secs",kind:"scalar",T:13},{no:12,name:"gps_en_gpio",kind:"scalar",T:13},{no:13,name:"gps_mode",kind:"enum",T:W.getEnumType(z2)}],{localName:"Config_PositionConfig"}),YN=W.makeEnum("meshtastic.Config.PositionConfig.PositionFlags",[{no:0,name:"UNSET"},{no:1,name:"ALTITUDE"},{no:2,name:"ALTITUDE_MSL"},{no:4,name:"GEOIDAL_SEPARATION"},{no:8,name:"DOP"},{no:16,name:"HVDOP"},{no:32,name:"SATINVIEW"},{no:64,name:"SEQ_NO"},{no:128,name:"TIMESTAMP"},{no:256,name:"HEADING"},{no:512,name:"SPEED"}]),z2=W.makeEnum("meshtastic.Config.PositionConfig.GpsMode",[{no:0,name:"DISABLED"},{no:1,name:"ENABLED"},{no:2,name:"NOT_PRESENT"}]),Am=W.makeMessageType("meshtastic.Config.PowerConfig",()=>[{no:1,name:"is_power_saving",kind:"scalar",T:8},{no:2,name:"on_battery_shutdown_after_secs",kind:"scalar",T:13},{no:3,name:"adc_multiplier_override",kind:"scalar",T:2},{no:4,name:"wait_bluetooth_secs",kind:"scalar",T:13},{no:6,name:"sds_secs",kind:"scalar",T:13},{no:7,name:"ls_secs",kind:"scalar",T:13},{no:8,name:"min_wake_secs",kind:"scalar",T:13},{no:9,name:"device_battery_ina_address",kind:"scalar",T:13},{no:32,name:"powermon_enables",kind:"scalar",T:4}],{localName:"Config_PowerConfig"}),Rm=W.makeMessageType("meshtastic.Config.NetworkConfig",()=>[{no:1,name:"wifi_enabled",kind:"scalar",T:8},{no:3,name:"wifi_ssid",kind:"scalar",T:9},{no:4,name:"wifi_psk",kind:"scalar",T:9},{no:5,name:"ntp_server",kind:"scalar",T:9},{no:6,name:"eth_enabled",kind:"scalar",T:8},{no:7,name:"address_mode",kind:"enum",T:W.getEnumType(H2)},{no:8,name:"ipv4_config",kind:"message",T:W2},{no:9,name:"rsyslog_server",kind:"scalar",T:9}],{localName:"Config_NetworkConfig"}),H2=W.makeEnum("meshtastic.Config.NetworkConfig.AddressMode",[{no:0,name:"DHCP"},{no:1,name:"STATIC"}]),W2=W.makeMessageType("meshtastic.Config.NetworkConfig.IpV4Config",()=>[{no:1,name:"ip",kind:"scalar",T:7},{no:2,name:"gateway",kind:"scalar",T:7},{no:3,name:"subnet",kind:"scalar",T:7},{no:4,name:"dns",kind:"scalar",T:7}],{localName:"Config_NetworkConfig_IpV4Config"}),Im=W.makeMessageType("meshtastic.Config.DisplayConfig",()=>[{no:1,name:"screen_on_secs",kind:"scalar",T:13},{no:2,name:"gps_format",kind:"enum",T:W.getEnumType(G2)},{no:3,name:"auto_screen_carousel_secs",kind:"scalar",T:13},{no:4,name:"compass_north_top",kind:"scalar",T:8},{no:5,name:"flip_screen",kind:"scalar",T:8},{no:6,name:"units",kind:"enum",T:W.getEnumType(K2)},{no:7,name:"oled",kind:"enum",T:W.getEnumType(q2)},{no:8,name:"displaymode",kind:"enum",T:W.getEnumType(X2)},{no:9,name:"heading_bold",kind:"scalar",T:8},{no:10,name:"wake_on_tap_or_motion",kind:"scalar",T:8},{no:11,name:"compass_orientation",kind:"enum",T:W.getEnumType(Y2)}],{localName:"Config_DisplayConfig"}),G2=W.makeEnum("meshtastic.Config.DisplayConfig.GpsCoordinateFormat",[{no:0,name:"DEC"},{no:1,name:"DMS"},{no:2,name:"UTM"},{no:3,name:"MGRS"},{no:4,name:"OLC"},{no:5,name:"OSGR"}]),K2=W.makeEnum("meshtastic.Config.DisplayConfig.DisplayUnits",[{no:0,name:"METRIC"},{no:1,name:"IMPERIAL"}]),q2=W.makeEnum("meshtastic.Config.DisplayConfig.OledType",[{no:0,name:"OLED_AUTO"},{no:1,name:"OLED_SSD1306"},{no:2,name:"OLED_SH1106"},{no:3,name:"OLED_SH1107"}]),X2=W.makeEnum("meshtastic.Config.DisplayConfig.DisplayMode",[{no:0,name:"DEFAULT"},{no:1,name:"TWOCOLOR"},{no:2,name:"INVERTED"},{no:3,name:"COLOR"}]),Y2=W.makeEnum("meshtastic.Config.DisplayConfig.CompassOrientation",[{no:0,name:"DEGREES_0"},{no:1,name:"DEGREES_90"},{no:2,name:"DEGREES_180"},{no:3,name:"DEGREES_270"},{no:4,name:"DEGREES_0_INVERTED"},{no:5,name:"DEGREES_90_INVERTED"},{no:6,name:"DEGREES_180_INVERTED"},{no:7,name:"DEGREES_270_INVERTED"}]),td=W.makeMessageType("meshtastic.Config.LoRaConfig",()=>[{no:1,name:"use_preset",kind:"scalar",T:8},{no:2,name:"modem_preset",kind:"enum",T:W.getEnumType(Dm)},{no:3,name:"bandwidth",kind:"scalar",T:13},{no:4,name:"spread_factor",kind:"scalar",T:13},{no:5,name:"coding_rate",kind:"scalar",T:13},{no:6,name:"frequency_offset",kind:"scalar",T:2},{no:7,name:"region",kind:"enum",T:W.getEnumType(Om)},{no:8,name:"hop_limit",kind:"scalar",T:13},{no:9,name:"tx_enabled",kind:"scalar",T:8},{no:10,name:"tx_power",kind:"scalar",T:5},{no:11,name:"channel_num",kind:"scalar",T:13},{no:12,name:"override_duty_cycle",kind:"scalar",T:8},{no:13,name:"sx126x_rx_boosted_gain",kind:"scalar",T:8},{no:14,name:"override_frequency",kind:"scalar",T:2},{no:15,name:"pa_fan_disabled",kind:"scalar",T:8},{no:103,name:"ignore_incoming",kind:"scalar",T:13,repeated:!0},{no:104,name:"ignore_mqtt",kind:"scalar",T:8},{no:105,name:"config_ok_to_mqtt",kind:"scalar",T:8}],{localName:"Config_LoRaConfig"}),Om=W.makeEnum("meshtastic.Config.LoRaConfig.RegionCode",[{no:0,name:"UNSET"},{no:1,name:"US"},{no:2,name:"EU_433"},{no:3,name:"EU_868"},{no:4,name:"CN"},{no:5,name:"JP"},{no:6,name:"ANZ"},{no:7,name:"KR"},{no:8,name:"TW"},{no:9,name:"RU"},{no:10,name:"IN"},{no:11,name:"NZ_865"},{no:12,name:"TH"},{no:13,name:"LORA_24"},{no:14,name:"UA_433"},{no:15,name:"UA_868"},{no:16,name:"MY_433"},{no:17,name:"MY_919"},{no:18,name:"SG_923"}]),Dm=W.makeEnum("meshtastic.Config.LoRaConfig.ModemPreset",[{no:0,name:"LONG_FAST"},{no:1,name:"LONG_SLOW"},{no:2,name:"VERY_LONG_SLOW"},{no:3,name:"MEDIUM_SLOW"},{no:4,name:"MEDIUM_FAST"},{no:5,name:"SHORT_SLOW"},{no:6,name:"SHORT_FAST"},{no:7,name:"LONG_MODERATE"},{no:8,name:"SHORT_TURBO"}]),Lm=W.makeMessageType("meshtastic.Config.BluetoothConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"mode",kind:"enum",T:W.getEnumType(Q2)},{no:3,name:"fixed_pin",kind:"scalar",T:13}],{localName:"Config_BluetoothConfig"}),Q2=W.makeEnum("meshtastic.Config.BluetoothConfig.PairingMode",[{no:0,name:"RANDOM_PIN"},{no:1,name:"FIXED_PIN"},{no:2,name:"NO_PIN"}]),jm=W.makeMessageType("meshtastic.Config.SecurityConfig",()=>[{no:1,name:"public_key",kind:"scalar",T:12},{no:2,name:"private_key",kind:"scalar",T:12},{no:3,name:"admin_key",kind:"scalar",T:12,repeated:!0},{no:4,name:"is_managed",kind:"scalar",T:8},{no:5,name:"serial_enabled",kind:"scalar",T:8},{no:6,name:"debug_log_api_enabled",kind:"scalar",T:8},{no:8,name:"admin_channel_enabled",kind:"scalar",T:8}],{localName:"Config_SecurityConfig"}),Z2=W.makeMessageType("meshtastic.Config.SessionkeyConfig",[],{localName:"Config_SessionkeyConfig"}),be={};nt(be,{PortNum:()=>Fm});var Fm=W.makeEnum("meshtastic.PortNum",[{no:0,name:"UNKNOWN_APP"},{no:1,name:"TEXT_MESSAGE_APP"},{no:2,name:"REMOTE_HARDWARE_APP"},{no:3,name:"POSITION_APP"},{no:4,name:"NODEINFO_APP"},{no:5,name:"ROUTING_APP"},{no:6,name:"ADMIN_APP"},{no:7,name:"TEXT_MESSAGE_COMPRESSED_APP"},{no:8,name:"WAYPOINT_APP"},{no:9,name:"AUDIO_APP"},{no:10,name:"DETECTION_SENSOR_APP"},{no:32,name:"REPLY_APP"},{no:33,name:"IP_TUNNEL_APP"},{no:34,name:"PAXCOUNTER_APP"},{no:64,name:"SERIAL_APP"},{no:65,name:"STORE_FORWARD_APP"},{no:66,name:"RANGE_TEST_APP"},{no:67,name:"TELEMETRY_APP"},{no:68,name:"ZPS_APP"},{no:69,name:"SIMULATOR_APP"},{no:70,name:"TRACEROUTE_APP"},{no:71,name:"NEIGHBORINFO_APP"},{no:72,name:"ATAK_PLUGIN"},{no:73,name:"MAP_REPORT_APP"},{no:74,name:"POWERSTRESS_APP"},{no:256,name:"PRIVATE_APP"},{no:257,name:"ATAK_FORWARDER"},{no:511,name:"MAX"}]),Bm={};nt(Bm,{AirQualityMetrics:()=>t_,DeviceMetrics:()=>nd,EnvironmentMetrics:()=>J2,LocalStats:()=>n_,Nau7802Config:()=>JN,PowerMetrics:()=>e_,Telemetry:()=>ZN,TelemetrySensorType:()=>QN});var QN=W.makeEnum("meshtastic.TelemetrySensorType",[{no:0,name:"SENSOR_UNSET"},{no:1,name:"BME280"},{no:2,name:"BME680"},{no:3,name:"MCP9808"},{no:4,name:"INA260"},{no:5,name:"INA219"},{no:6,name:"BMP280"},{no:7,name:"SHTC3"},{no:8,name:"LPS22"},{no:9,name:"QMC6310"},{no:10,name:"QMI8658"},{no:11,name:"QMC5883L"},{no:12,name:"SHT31"},{no:13,name:"PMSA003I"},{no:14,name:"INA3221"},{no:15,name:"BMP085"},{no:16,name:"RCWL9620"},{no:17,name:"SHT4X"},{no:18,name:"VEML7700"},{no:19,name:"MLX90632"},{no:20,name:"OPT3001"},{no:21,name:"LTR390UV"},{no:22,name:"TSL25911FN"},{no:23,name:"AHT10"},{no:24,name:"DFROBOT_LARK"},{no:25,name:"NAU7802"},{no:26,name:"BMP3XX"},{no:27,name:"ICM20948"},{no:28,name:"MAX17048"},{no:29,name:"CUSTOM_SENSOR"}]),nd=W.makeMessageType("meshtastic.DeviceMetrics",()=>[{no:1,name:"battery_level",kind:"scalar",T:13,opt:!0},{no:2,name:"voltage",kind:"scalar",T:2,opt:!0},{no:3,name:"channel_utilization",kind:"scalar",T:2,opt:!0},{no:4,name:"air_util_tx",kind:"scalar",T:2,opt:!0},{no:5,name:"uptime_seconds",kind:"scalar",T:13,opt:!0}]),J2=W.makeMessageType("meshtastic.EnvironmentMetrics",()=>[{no:1,name:"temperature",kind:"scalar",T:2,opt:!0},{no:2,name:"relative_humidity",kind:"scalar",T:2,opt:!0},{no:3,name:"barometric_pressure",kind:"scalar",T:2,opt:!0},{no:4,name:"gas_resistance",kind:"scalar",T:2,opt:!0},{no:5,name:"voltage",kind:"scalar",T:2,opt:!0},{no:6,name:"current",kind:"scalar",T:2,opt:!0},{no:7,name:"iaq",kind:"scalar",T:13,opt:!0},{no:8,name:"distance",kind:"scalar",T:2,opt:!0},{no:9,name:"lux",kind:"scalar",T:2,opt:!0},{no:10,name:"white_lux",kind:"scalar",T:2,opt:!0},{no:11,name:"ir_lux",kind:"scalar",T:2,opt:!0},{no:12,name:"uv_lux",kind:"scalar",T:2,opt:!0},{no:13,name:"wind_direction",kind:"scalar",T:13,opt:!0},{no:14,name:"wind_speed",kind:"scalar",T:2,opt:!0},{no:15,name:"weight",kind:"scalar",T:2,opt:!0},{no:16,name:"wind_gust",kind:"scalar",T:2,opt:!0},{no:17,name:"wind_lull",kind:"scalar",T:2,opt:!0}]),e_=W.makeMessageType("meshtastic.PowerMetrics",()=>[{no:1,name:"ch1_voltage",kind:"scalar",T:2,opt:!0},{no:2,name:"ch1_current",kind:"scalar",T:2,opt:!0},{no:3,name:"ch2_voltage",kind:"scalar",T:2,opt:!0},{no:4,name:"ch2_current",kind:"scalar",T:2,opt:!0},{no:5,name:"ch3_voltage",kind:"scalar",T:2,opt:!0},{no:6,name:"ch3_current",kind:"scalar",T:2,opt:!0}]),t_=W.makeMessageType("meshtastic.AirQualityMetrics",()=>[{no:1,name:"pm10_standard",kind:"scalar",T:13,opt:!0},{no:2,name:"pm25_standard",kind:"scalar",T:13,opt:!0},{no:3,name:"pm100_standard",kind:"scalar",T:13,opt:!0},{no:4,name:"pm10_environmental",kind:"scalar",T:13,opt:!0},{no:5,name:"pm25_environmental",kind:"scalar",T:13,opt:!0},{no:6,name:"pm100_environmental",kind:"scalar",T:13,opt:!0},{no:7,name:"particles_03um",kind:"scalar",T:13,opt:!0},{no:8,name:"particles_05um",kind:"scalar",T:13,opt:!0},{no:9,name:"particles_10um",kind:"scalar",T:13,opt:!0},{no:10,name:"particles_25um",kind:"scalar",T:13,opt:!0},{no:11,name:"particles_50um",kind:"scalar",T:13,opt:!0},{no:12,name:"particles_100um",kind:"scalar",T:13,opt:!0}]),n_=W.makeMessageType("meshtastic.LocalStats",()=>[{no:1,name:"uptime_seconds",kind:"scalar",T:13},{no:2,name:"channel_utilization",kind:"scalar",T:2},{no:3,name:"air_util_tx",kind:"scalar",T:2},{no:4,name:"num_packets_tx",kind:"scalar",T:13},{no:5,name:"num_packets_rx",kind:"scalar",T:13},{no:6,name:"num_packets_rx_bad",kind:"scalar",T:13},{no:7,name:"num_online_nodes",kind:"scalar",T:13},{no:8,name:"num_total_nodes",kind:"scalar",T:13}]),ZN=W.makeMessageType("meshtastic.Telemetry",()=>[{no:1,name:"time",kind:"scalar",T:7},{no:2,name:"device_metrics",kind:"message",T:nd,oneof:"variant"},{no:3,name:"environment_metrics",kind:"message",T:J2,oneof:"variant"},{no:4,name:"air_quality_metrics",kind:"message",T:t_,oneof:"variant"},{no:5,name:"power_metrics",kind:"message",T:e_,oneof:"variant"},{no:6,name:"local_stats",kind:"message",T:n_,oneof:"variant"}]),JN=W.makeMessageType("meshtastic.Nau7802Config",()=>[{no:1,name:"zeroOffset",kind:"scalar",T:5},{no:2,name:"calibrationFactor",kind:"scalar",T:2}]),r_={};nt(r_,{ModuleConfig:()=>uu,ModuleConfig_AmbientLightingConfig:()=>Zm,ModuleConfig_AudioConfig:()=>Hm,ModuleConfig_AudioConfig_Audio_Baud:()=>i_,ModuleConfig_CannedMessageConfig:()=>Qm,ModuleConfig_CannedMessageConfig_InputEventChar:()=>Sc,ModuleConfig_DetectionSensorConfig:()=>zm,ModuleConfig_ExternalNotificationConfig:()=>Km,ModuleConfig_MQTTConfig:()=>$m,ModuleConfig_MapReportSettings:()=>a_,ModuleConfig_NeighborInfoConfig:()=>Vm,ModuleConfig_PaxcounterConfig:()=>Wm,ModuleConfig_RangeTestConfig:()=>Xm,ModuleConfig_RemoteHardwareConfig:()=>Um,ModuleConfig_SerialConfig:()=>Gm,ModuleConfig_SerialConfig_Serial_Baud:()=>s_,ModuleConfig_SerialConfig_Serial_Mode:()=>l_,ModuleConfig_StoreForwardConfig:()=>qm,ModuleConfig_TelemetryConfig:()=>Ym,RemoteHardwarePin:()=>Jm,RemoteHardwarePinType:()=>o_});var o_=W.makeEnum("meshtastic.RemoteHardwarePinType",[{no:0,name:"UNKNOWN"},{no:1,name:"DIGITAL_READ"},{no:2,name:"DIGITAL_WRITE"}]),uu=W.makeMessageType("meshtastic.ModuleConfig",()=>[{no:1,name:"mqtt",kind:"message",T:$m,oneof:"payload_variant"},{no:2,name:"serial",kind:"message",T:Gm,oneof:"payload_variant"},{no:3,name:"external_notification",kind:"message",T:Km,oneof:"payload_variant"},{no:4,name:"store_forward",kind:"message",T:qm,oneof:"payload_variant"},{no:5,name:"range_test",kind:"message",T:Xm,oneof:"payload_variant"},{no:6,name:"telemetry",kind:"message",T:Ym,oneof:"payload_variant"},{no:7,name:"canned_message",kind:"message",T:Qm,oneof:"payload_variant"},{no:8,name:"audio",kind:"message",T:Hm,oneof:"payload_variant"},{no:9,name:"remote_hardware",kind:"message",T:Um,oneof:"payload_variant"},{no:10,name:"neighbor_info",kind:"message",T:Vm,oneof:"payload_variant"},{no:11,name:"ambient_lighting",kind:"message",T:Zm,oneof:"payload_variant"},{no:12,name:"detection_sensor",kind:"message",T:zm,oneof:"payload_variant"},{no:13,name:"paxcounter",kind:"message",T:Wm,oneof:"payload_variant"}]),$m=W.makeMessageType("meshtastic.ModuleConfig.MQTTConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"address",kind:"scalar",T:9},{no:3,name:"username",kind:"scalar",T:9},{no:4,name:"password",kind:"scalar",T:9},{no:5,name:"encryption_enabled",kind:"scalar",T:8},{no:6,name:"json_enabled",kind:"scalar",T:8},{no:7,name:"tls_enabled",kind:"scalar",T:8},{no:8,name:"root",kind:"scalar",T:9},{no:9,name:"proxy_to_client_enabled",kind:"scalar",T:8},{no:10,name:"map_reporting_enabled",kind:"scalar",T:8},{no:11,name:"map_report_settings",kind:"message",T:a_}],{localName:"ModuleConfig_MQTTConfig"}),a_=W.makeMessageType("meshtastic.ModuleConfig.MapReportSettings",()=>[{no:1,name:"publish_interval_secs",kind:"scalar",T:13},{no:2,name:"position_precision",kind:"scalar",T:13}],{localName:"ModuleConfig_MapReportSettings"}),Um=W.makeMessageType("meshtastic.ModuleConfig.RemoteHardwareConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"allow_undefined_pin_access",kind:"scalar",T:8},{no:3,name:"available_pins",kind:"message",T:Jm,repeated:!0}],{localName:"ModuleConfig_RemoteHardwareConfig"}),Vm=W.makeMessageType("meshtastic.ModuleConfig.NeighborInfoConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"update_interval",kind:"scalar",T:13}],{localName:"ModuleConfig_NeighborInfoConfig"}),zm=W.makeMessageType("meshtastic.ModuleConfig.DetectionSensorConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"minimum_broadcast_secs",kind:"scalar",T:13},{no:3,name:"state_broadcast_secs",kind:"scalar",T:13},{no:4,name:"send_bell",kind:"scalar",T:8},{no:5,name:"name",kind:"scalar",T:9},{no:6,name:"monitor_pin",kind:"scalar",T:13},{no:7,name:"detection_triggered_high",kind:"scalar",T:8},{no:8,name:"use_pullup",kind:"scalar",T:8}],{localName:"ModuleConfig_DetectionSensorConfig"}),Hm=W.makeMessageType("meshtastic.ModuleConfig.AudioConfig",()=>[{no:1,name:"codec2_enabled",kind:"scalar",T:8},{no:2,name:"ptt_pin",kind:"scalar",T:13},{no:3,name:"bitrate",kind:"enum",T:W.getEnumType(i_)},{no:4,name:"i2s_ws",kind:"scalar",T:13},{no:5,name:"i2s_sd",kind:"scalar",T:13},{no:6,name:"i2s_din",kind:"scalar",T:13},{no:7,name:"i2s_sck",kind:"scalar",T:13}],{localName:"ModuleConfig_AudioConfig"}),i_=W.makeEnum("meshtastic.ModuleConfig.AudioConfig.Audio_Baud",[{no:0,name:"CODEC2_DEFAULT"},{no:1,name:"CODEC2_3200"},{no:2,name:"CODEC2_2400"},{no:3,name:"CODEC2_1600"},{no:4,name:"CODEC2_1400"},{no:5,name:"CODEC2_1300"},{no:6,name:"CODEC2_1200"},{no:7,name:"CODEC2_700"},{no:8,name:"CODEC2_700B"}]),Wm=W.makeMessageType("meshtastic.ModuleConfig.PaxcounterConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"paxcounter_update_interval",kind:"scalar",T:13},{no:3,name:"wifi_threshold",kind:"scalar",T:5},{no:4,name:"ble_threshold",kind:"scalar",T:5}],{localName:"ModuleConfig_PaxcounterConfig"}),Gm=W.makeMessageType("meshtastic.ModuleConfig.SerialConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"echo",kind:"scalar",T:8},{no:3,name:"rxd",kind:"scalar",T:13},{no:4,name:"txd",kind:"scalar",T:13},{no:5,name:"baud",kind:"enum",T:W.getEnumType(s_)},{no:6,name:"timeout",kind:"scalar",T:13},{no:7,name:"mode",kind:"enum",T:W.getEnumType(l_)},{no:8,name:"override_console_serial_port",kind:"scalar",T:8}],{localName:"ModuleConfig_SerialConfig"}),s_=W.makeEnum("meshtastic.ModuleConfig.SerialConfig.Serial_Baud",[{no:0,name:"BAUD_DEFAULT"},{no:1,name:"BAUD_110"},{no:2,name:"BAUD_300"},{no:3,name:"BAUD_600"},{no:4,name:"BAUD_1200"},{no:5,name:"BAUD_2400"},{no:6,name:"BAUD_4800"},{no:7,name:"BAUD_9600"},{no:8,name:"BAUD_19200"},{no:9,name:"BAUD_38400"},{no:10,name:"BAUD_57600"},{no:11,name:"BAUD_115200"},{no:12,name:"BAUD_230400"},{no:13,name:"BAUD_460800"},{no:14,name:"BAUD_576000"},{no:15,name:"BAUD_921600"}]),l_=W.makeEnum("meshtastic.ModuleConfig.SerialConfig.Serial_Mode",[{no:0,name:"DEFAULT"},{no:1,name:"SIMPLE"},{no:2,name:"PROTO"},{no:3,name:"TEXTMSG"},{no:4,name:"NMEA"},{no:5,name:"CALTOPO"},{no:6,name:"WS85"}]),Km=W.makeMessageType("meshtastic.ModuleConfig.ExternalNotificationConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"output_ms",kind:"scalar",T:13},{no:3,name:"output",kind:"scalar",T:13},{no:8,name:"output_vibra",kind:"scalar",T:13},{no:9,name:"output_buzzer",kind:"scalar",T:13},{no:4,name:"active",kind:"scalar",T:8},{no:5,name:"alert_message",kind:"scalar",T:8},{no:10,name:"alert_message_vibra",kind:"scalar",T:8},{no:11,name:"alert_message_buzzer",kind:"scalar",T:8},{no:6,name:"alert_bell",kind:"scalar",T:8},{no:12,name:"alert_bell_vibra",kind:"scalar",T:8},{no:13,name:"alert_bell_buzzer",kind:"scalar",T:8},{no:7,name:"use_pwm",kind:"scalar",T:8},{no:14,name:"nag_timeout",kind:"scalar",T:13},{no:15,name:"use_i2s_as_buzzer",kind:"scalar",T:8}],{localName:"ModuleConfig_ExternalNotificationConfig"}),qm=W.makeMessageType("meshtastic.ModuleConfig.StoreForwardConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"heartbeat",kind:"scalar",T:8},{no:3,name:"records",kind:"scalar",T:13},{no:4,name:"history_return_max",kind:"scalar",T:13},{no:5,name:"history_return_window",kind:"scalar",T:13},{no:6,name:"is_server",kind:"scalar",T:8}],{localName:"ModuleConfig_StoreForwardConfig"}),Xm=W.makeMessageType("meshtastic.ModuleConfig.RangeTestConfig",()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"sender",kind:"scalar",T:13},{no:3,name:"save",kind:"scalar",T:8}],{localName:"ModuleConfig_RangeTestConfig"}),Ym=W.makeMessageType("meshtastic.ModuleConfig.TelemetryConfig",()=>[{no:1,name:"device_update_interval",kind:"scalar",T:13},{no:2,name:"environment_update_interval",kind:"scalar",T:13},{no:3,name:"environment_measurement_enabled",kind:"scalar",T:8},{no:4,name:"environment_screen_enabled",kind:"scalar",T:8},{no:5,name:"environment_display_fahrenheit",kind:"scalar",T:8},{no:6,name:"air_quality_enabled",kind:"scalar",T:8},{no:7,name:"air_quality_interval",kind:"scalar",T:13},{no:8,name:"power_measurement_enabled",kind:"scalar",T:8},{no:9,name:"power_update_interval",kind:"scalar",T:13},{no:10,name:"power_screen_enabled",kind:"scalar",T:8}],{localName:"ModuleConfig_TelemetryConfig"}),Qm=W.makeMessageType("meshtastic.ModuleConfig.CannedMessageConfig",()=>[{no:1,name:"rotary1_enabled",kind:"scalar",T:8},{no:2,name:"inputbroker_pin_a",kind:"scalar",T:13},{no:3,name:"inputbroker_pin_b",kind:"scalar",T:13},{no:4,name:"inputbroker_pin_press",kind:"scalar",T:13},{no:5,name:"inputbroker_event_cw",kind:"enum",T:W.getEnumType(Sc)},{no:6,name:"inputbroker_event_ccw",kind:"enum",T:W.getEnumType(Sc)},{no:7,name:"inputbroker_event_press",kind:"enum",T:W.getEnumType(Sc)},{no:8,name:"updown1_enabled",kind:"scalar",T:8},{no:9,name:"enabled",kind:"scalar",T:8},{no:10,name:"allow_input_source",kind:"scalar",T:9},{no:11,name:"send_bell",kind:"scalar",T:8}],{localName:"ModuleConfig_CannedMessageConfig"}),Sc=W.makeEnum("meshtastic.ModuleConfig.CannedMessageConfig.InputEventChar",[{no:0,name:"NONE"},{no:17,name:"UP"},{no:18,name:"DOWN"},{no:19,name:"LEFT"},{no:20,name:"RIGHT"},{no:10,name:"SELECT"},{no:27,name:"BACK"},{no:24,name:"CANCEL"}]),Zm=W.makeMessageType("meshtastic.ModuleConfig.AmbientLightingConfig",()=>[{no:1,name:"led_state",kind:"scalar",T:8},{no:2,name:"current",kind:"scalar",T:13},{no:3,name:"red",kind:"scalar",T:13},{no:4,name:"green",kind:"scalar",T:13},{no:5,name:"blue",kind:"scalar",T:13}],{localName:"ModuleConfig_AmbientLightingConfig"}),Jm=W.makeMessageType("meshtastic.RemoteHardwarePin",()=>[{no:1,name:"gpio_pin",kind:"scalar",T:13},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:W.getEnumType(o_)}]),bt={};nt(bt,{XModem:()=>eh,XModem_Control:()=>c_});var eh=W.makeMessageType("meshtastic.XModem",()=>[{no:1,name:"control",kind:"enum",T:W.getEnumType(c_)},{no:2,name:"seq",kind:"scalar",T:13},{no:3,name:"crc16",kind:"scalar",T:13},{no:4,name:"buffer",kind:"scalar",T:12}]),c_=W.makeEnum("meshtastic.XModem.Control",[{no:0,name:"NUL"},{no:1,name:"SOH"},{no:2,name:"STX"},{no:4,name:"EOT"},{no:6,name:"ACK"},{no:21,name:"NAK"},{no:24,name:"CAN"},{no:26,name:"CTRLZ"}]),ll=W.makeEnum("meshtastic.HardwareModel",[{no:0,name:"UNSET"},{no:1,name:"TLORA_V2"},{no:2,name:"TLORA_V1"},{no:3,name:"TLORA_V2_1_1P6"},{no:4,name:"TBEAM"},{no:5,name:"HELTEC_V2_0"},{no:6,name:"TBEAM_V0P7"},{no:7,name:"T_ECHO"},{no:8,name:"TLORA_V1_1P3"},{no:9,name:"RAK4631"},{no:10,name:"HELTEC_V2_1"},{no:11,name:"HELTEC_V1"},{no:12,name:"LILYGO_TBEAM_S3_CORE"},{no:13,name:"RAK11200"},{no:14,name:"NANO_G1"},{no:15,name:"TLORA_V2_1_1P8"},{no:16,name:"TLORA_T3_S3"},{no:17,name:"NANO_G1_EXPLORER"},{no:18,name:"NANO_G2_ULTRA"},{no:19,name:"LORA_TYPE"},{no:20,name:"WIPHONE"},{no:21,name:"WIO_WM1110"},{no:22,name:"RAK2560"},{no:23,name:"HELTEC_HRU_3601"},{no:25,name:"STATION_G1"},{no:26,name:"RAK11310"},{no:27,name:"SENSELORA_RP2040"},{no:28,name:"SENSELORA_S3"},{no:29,name:"CANARYONE"},{no:30,name:"RP2040_LORA"},{no:31,name:"STATION_G2"},{no:32,name:"LORA_RELAY_V1"},{no:33,name:"NRF52840DK"},{no:34,name:"PPR"},{no:35,name:"GENIEBLOCKS"},{no:36,name:"NRF52_UNKNOWN"},{no:37,name:"PORTDUINO"},{no:38,name:"ANDROID_SIM"},{no:39,name:"DIY_V1"},{no:40,name:"NRF52840_PCA10059"},{no:41,name:"DR_DEV"},{no:42,name:"M5STACK"},{no:43,name:"HELTEC_V3"},{no:44,name:"HELTEC_WSL_V3"},{no:45,name:"BETAFPV_2400_TX"},{no:46,name:"BETAFPV_900_NANO_TX"},{no:47,name:"RPI_PICO"},{no:48,name:"HELTEC_WIRELESS_TRACKER"},{no:49,name:"HELTEC_WIRELESS_PAPER"},{no:50,name:"T_DECK"},{no:51,name:"T_WATCH_S3"},{no:52,name:"PICOMPUTER_S3"},{no:53,name:"HELTEC_HT62"},{no:54,name:"EBYTE_ESP32_S3"},{no:55,name:"ESP32_S3_PICO"},{no:56,name:"CHATTER_2"},{no:57,name:"HELTEC_WIRELESS_PAPER_V1_0"},{no:58,name:"HELTEC_WIRELESS_TRACKER_V1_0"},{no:59,name:"UNPHONE"},{no:60,name:"TD_LORAC"},{no:61,name:"CDEBYTE_EORA_S3"},{no:62,name:"TWC_MESH_V4"},{no:63,name:"NRF52_PROMICRO_DIY"},{no:64,name:"RADIOMASTER_900_BANDIT_NANO"},{no:65,name:"HELTEC_CAPSULE_SENSOR_V3"},{no:66,name:"HELTEC_VISION_MASTER_T190"},{no:67,name:"HELTEC_VISION_MASTER_E213"},{no:68,name:"HELTEC_VISION_MASTER_E290"},{no:69,name:"HELTEC_MESH_NODE_T114"},{no:70,name:"SENSECAP_INDICATOR"},{no:71,name:"TRACKER_T1000_E"},{no:72,name:"RAK3172"},{no:73,name:"WIO_E5"},{no:74,name:"RADIOMASTER_900_BANDIT"},{no:75,name:"ME25LS01_4Y10TD"},{no:76,name:"RP2040_FEATHER_RFM95"},{no:77,name:"M5STACK_COREBASIC"},{no:78,name:"M5STACK_CORE2"},{no:255,name:"PRIVATE_HW"}]),eP=W.makeEnum("meshtastic.Constants",[{no:0,name:"ZERO"},{no:237,name:"DATA_PAYLOAD_LEN"}]),tP=W.makeEnum("meshtastic.CriticalErrorCode",[{no:0,name:"NONE"},{no:1,name:"TX_WATCHDOG"},{no:2,name:"SLEEP_ENTER_WAIT"},{no:3,name:"NO_RADIO"},{no:4,name:"UNSPECIFIED"},{no:5,name:"UBLOX_UNIT_FAILED"},{no:6,name:"NO_AXP192"},{no:7,name:"INVALID_RADIO_SETTING"},{no:8,name:"TRANSMIT_FAILED"},{no:9,name:"BROWNOUT"},{no:10,name:"SX1262_FAILURE"},{no:11,name:"RADIO_SPI_BUG"},{no:12,name:"FLASH_CORRUPTION_RECOVERABLE"},{no:13,name:"FLASH_CORRUPTION_UNRECOVERABLE"}]),th=W.makeMessageType("meshtastic.Position",()=>[{no:1,name:"latitude_i",kind:"scalar",T:15,opt:!0},{no:2,name:"longitude_i",kind:"scalar",T:15,opt:!0},{no:3,name:"altitude",kind:"scalar",T:5,opt:!0},{no:4,name:"time",kind:"scalar",T:7},{no:5,name:"location_source",kind:"enum",T:W.getEnumType(nh)},{no:6,name:"altitude_source",kind:"enum",T:W.getEnumType(u_)},{no:7,name:"timestamp",kind:"scalar",T:7},{no:8,name:"timestamp_millis_adjust",kind:"scalar",T:5},{no:9,name:"altitude_hae",kind:"scalar",T:17,opt:!0},{no:10,name:"altitude_geoidal_separation",kind:"scalar",T:17,opt:!0},{no:11,name:"PDOP",kind:"scalar",T:13},{no:12,name:"HDOP",kind:"scalar",T:13},{no:13,name:"VDOP",kind:"scalar",T:13},{no:14,name:"gps_accuracy",kind:"scalar",T:13},{no:15,name:"ground_speed",kind:"scalar",T:13,opt:!0},{no:16,name:"ground_track",kind:"scalar",T:13,opt:!0},{no:17,name:"fix_quality",kind:"scalar",T:13},{no:18,name:"fix_type",kind:"scalar",T:13},{no:19,name:"sats_in_view",kind:"scalar",T:13},{no:20,name:"sensor_id",kind:"scalar",T:13},{no:21,name:"next_update",kind:"scalar",T:13},{no:22,name:"seq_number",kind:"scalar",T:13},{no:23,name:"precision_bits",kind:"scalar",T:13}]),nh=W.makeEnum("meshtastic.Position.LocSource",[{no:0,name:"LOC_UNSET"},{no:1,name:"LOC_MANUAL"},{no:2,name:"LOC_INTERNAL"},{no:3,name:"LOC_EXTERNAL"}]),u_=W.makeEnum("meshtastic.Position.AltSource",[{no:0,name:"ALT_UNSET"},{no:1,name:"ALT_MANUAL"},{no:2,name:"ALT_INTERNAL"},{no:3,name:"ALT_EXTERNAL"},{no:4,name:"ALT_BAROMETRIC"}]),Hs=W.makeMessageType("meshtastic.User",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"long_name",kind:"scalar",T:9},{no:3,name:"short_name",kind:"scalar",T:9},{no:4,name:"macaddr",kind:"scalar",T:12},{no:5,name:"hw_model",kind:"enum",T:W.getEnumType(ll)},{no:6,name:"is_licensed",kind:"scalar",T:8},{no:7,name:"role",kind:"enum",T:W.getEnumType(Di)},{no:8,name:"public_key",kind:"scalar",T:12}]),X0=W.makeMessageType("meshtastic.RouteDiscovery",()=>[{no:1,name:"route",kind:"scalar",T:7,repeated:!0},{no:2,name:"snr_towards",kind:"scalar",T:5,repeated:!0},{no:3,name:"route_back",kind:"scalar",T:7,repeated:!0},{no:4,name:"snr_back",kind:"scalar",T:5,repeated:!0}]),nP=W.makeMessageType("meshtastic.Routing",()=>[{no:1,name:"route_request",kind:"message",T:X0,oneof:"variant"},{no:2,name:"route_reply",kind:"message",T:X0,oneof:"variant"},{no:3,name:"error_reason",kind:"enum",T:W.getEnumType(d_),oneof:"variant"}]),d_=W.makeEnum("meshtastic.Routing.Error",[{no:0,name:"NONE"},{no:1,name:"NO_ROUTE"},{no:2,name:"GOT_NAK"},{no:3,name:"TIMEOUT"},{no:4,name:"NO_INTERFACE"},{no:5,name:"MAX_RETRANSMIT"},{no:6,name:"NO_CHANNEL"},{no:7,name:"TOO_LARGE"},{no:8,name:"NO_RESPONSE"},{no:9,name:"DUTY_CYCLE_LIMIT"},{no:32,name:"BAD_REQUEST"},{no:33,name:"NOT_AUTHORIZED"},{no:34,name:"PKI_FAILED"},{no:35,name:"PKI_UNKNOWN_PUBKEY"}]),f_=W.makeMessageType("meshtastic.Data",()=>[{no:1,name:"portnum",kind:"enum",T:W.getEnumType(Fm)},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"want_response",kind:"scalar",T:8},{no:4,name:"dest",kind:"scalar",T:7},{no:5,name:"source",kind:"scalar",T:7},{no:6,name:"request_id",kind:"scalar",T:7},{no:7,name:"reply_id",kind:"scalar",T:7},{no:8,name:"emoji",kind:"scalar",T:7},{no:9,name:"bitfield",kind:"scalar",T:13,opt:!0}]),rP=W.makeMessageType("meshtastic.Waypoint",()=>[{no:1,name:"id",kind:"scalar",T:13},{no:2,name:"latitude_i",kind:"scalar",T:15,opt:!0},{no:3,name:"longitude_i",kind:"scalar",T:15,opt:!0},{no:4,name:"expire",kind:"scalar",T:13},{no:5,name:"locked_to",kind:"scalar",T:13},{no:6,name:"name",kind:"scalar",T:9},{no:7,name:"description",kind:"scalar",T:9},{no:8,name:"icon",kind:"scalar",T:7}]),rh=W.makeMessageType("meshtastic.MqttClientProxyMessage",()=>[{no:1,name:"topic",kind:"scalar",T:9},{no:2,name:"data",kind:"scalar",T:12,oneof:"payload_variant"},{no:3,name:"text",kind:"scalar",T:9,oneof:"payload_variant"},{no:4,name:"retained",kind:"scalar",T:8}]),Go=W.makeMessageType("meshtastic.MeshPacket",()=>[{no:1,name:"from",kind:"scalar",T:7},{no:2,name:"to",kind:"scalar",T:7},{no:3,name:"channel",kind:"scalar",T:13},{no:4,name:"decoded",kind:"message",T:f_,oneof:"payload_variant"},{no:5,name:"encrypted",kind:"scalar",T:12,oneof:"payload_variant"},{no:6,name:"id",kind:"scalar",T:7},{no:7,name:"rx_time",kind:"scalar",T:7},{no:8,name:"rx_snr",kind:"scalar",T:2},{no:9,name:"hop_limit",kind:"scalar",T:13},{no:10,name:"want_ack",kind:"scalar",T:8},{no:11,name:"priority",kind:"enum",T:W.getEnumType(p_)},{no:12,name:"rx_rssi",kind:"scalar",T:5},{no:13,name:"delayed",kind:"enum",T:W.getEnumType(m_)},{no:14,name:"via_mqtt",kind:"scalar",T:8},{no:15,name:"hop_start",kind:"scalar",T:13},{no:16,name:"public_key",kind:"scalar",T:12},{no:17,name:"pki_encrypted",kind:"scalar",T:8}]),p_=W.makeEnum("meshtastic.MeshPacket.Priority",[{no:0,name:"UNSET"},{no:1,name:"MIN"},{no:10,name:"BACKGROUND"},{no:64,name:"DEFAULT"},{no:70,name:"RELIABLE"},{no:80,name:"RESPONSE"},{no:100,name:"HIGH"},{no:120,name:"ACK"},{no:127,name:"MAX"}]),m_=W.makeEnum("meshtastic.MeshPacket.Delayed",[{no:0,name:"NO_DELAY"},{no:1,name:"DELAYED_BROADCAST"},{no:2,name:"DELAYED_DIRECT"}]),h_=W.makeMessageType("meshtastic.NodeInfo",()=>[{no:1,name:"num",kind:"scalar",T:13},{no:2,name:"user",kind:"message",T:Hs},{no:3,name:"position",kind:"message",T:th},{no:4,name:"snr",kind:"scalar",T:2},{no:5,name:"last_heard",kind:"scalar",T:7},{no:6,name:"device_metrics",kind:"message",T:nd},{no:7,name:"channel",kind:"scalar",T:13},{no:8,name:"via_mqtt",kind:"scalar",T:8},{no:9,name:"hops_away",kind:"scalar",T:13},{no:10,name:"is_favorite",kind:"scalar",T:8}]),oh=W.makeMessageType("meshtastic.MyNodeInfo",()=>[{no:1,name:"my_node_num",kind:"scalar",T:13},{no:8,name:"reboot_count",kind:"scalar",T:13},{no:11,name:"min_app_version",kind:"scalar",T:13}]),g_=W.makeMessageType("meshtastic.LogRecord",()=>[{no:1,name:"message",kind:"scalar",T:9},{no:2,name:"time",kind:"scalar",T:7},{no:3,name:"source",kind:"scalar",T:9},{no:4,name:"level",kind:"enum",T:W.getEnumType(ah)}]),ah=W.makeEnum("meshtastic.LogRecord.Level",[{no:0,name:"UNSET"},{no:50,name:"CRITICAL"},{no:40,name:"ERROR"},{no:30,name:"WARNING"},{no:20,name:"INFO"},{no:10,name:"DEBUG"},{no:5,name:"TRACE"}]),v_=W.makeMessageType("meshtastic.QueueStatus",()=>[{no:1,name:"res",kind:"scalar",T:5},{no:2,name:"free",kind:"scalar",T:13},{no:3,name:"maxlen",kind:"scalar",T:13},{no:4,name:"mesh_packet_id",kind:"scalar",T:13}]),oP=W.makeMessageType("meshtastic.FromRadio",()=>[{no:1,name:"id",kind:"scalar",T:13},{no:2,name:"packet",kind:"message",T:Go,oneof:"payload_variant"},{no:3,name:"my_info",kind:"message",T:oh,oneof:"payload_variant"},{no:4,name:"node_info",kind:"message",T:h_,oneof:"payload_variant"},{no:5,name:"config",kind:"message",T:cu,oneof:"payload_variant"},{no:6,name:"log_record",kind:"message",T:g_,oneof:"payload_variant"},{no:7,name:"config_complete_id",kind:"scalar",T:13,oneof:"payload_variant"},{no:8,name:"rebooted",kind:"scalar",T:8,oneof:"payload_variant"},{no:9,name:"moduleConfig",kind:"message",T:uu,oneof:"payload_variant"},{no:10,name:"channel",kind:"message",T:zs,oneof:"payload_variant"},{no:11,name:"queueStatus",kind:"message",T:v_,oneof:"payload_variant"},{no:12,name:"xmodemPacket",kind:"message",T:eh,oneof:"payload_variant"},{no:13,name:"metadata",kind:"message",T:ih,oneof:"payload_variant"},{no:14,name:"mqttClientProxyMessage",kind:"message",T:rh,oneof:"payload_variant"},{no:15,name:"fileInfo",kind:"message",T:b_,oneof:"payload_variant"},{no:16,name:"clientNotification",kind:"message",T:y_,oneof:"payload_variant"}]),y_=W.makeMessageType("meshtastic.ClientNotification",()=>[{no:1,name:"reply_id",kind:"scalar",T:13,opt:!0},{no:2,name:"time",kind:"scalar",T:7},{no:3,name:"level",kind:"enum",T:W.getEnumType(ah)},{no:4,name:"message",kind:"scalar",T:9}]),b_=W.makeMessageType("meshtastic.FileInfo",()=>[{no:1,name:"file_name",kind:"scalar",T:9},{no:2,name:"size_bytes",kind:"scalar",T:13}]),aP=W.makeMessageType("meshtastic.ToRadio",()=>[{no:1,name:"packet",kind:"message",T:Go,oneof:"payload_variant"},{no:3,name:"want_config_id",kind:"scalar",T:13,oneof:"payload_variant"},{no:4,name:"disconnect",kind:"scalar",T:8,oneof:"payload_variant"},{no:5,name:"xmodemPacket",kind:"message",T:eh,oneof:"payload_variant"},{no:6,name:"mqttClientProxyMessage",kind:"message",T:rh,oneof:"payload_variant"},{no:7,name:"heartbeat",kind:"message",T:__,oneof:"payload_variant"}]),iP=W.makeMessageType("meshtastic.Compressed",()=>[{no:1,name:"portnum",kind:"enum",T:W.getEnumType(Fm)},{no:2,name:"data",kind:"scalar",T:12}]),sP=W.makeMessageType("meshtastic.NeighborInfo",()=>[{no:1,name:"node_id",kind:"scalar",T:13},{no:2,name:"last_sent_by_id",kind:"scalar",T:13},{no:3,name:"node_broadcast_interval_secs",kind:"scalar",T:13},{no:4,name:"neighbors",kind:"message",T:w_,repeated:!0}]),w_=W.makeMessageType("meshtastic.Neighbor",()=>[{no:1,name:"node_id",kind:"scalar",T:13},{no:2,name:"snr",kind:"scalar",T:2},{no:3,name:"last_rx_time",kind:"scalar",T:7},{no:4,name:"node_broadcast_interval_secs",kind:"scalar",T:13}]),ih=W.makeMessageType("meshtastic.DeviceMetadata",()=>[{no:1,name:"firmware_version",kind:"scalar",T:9},{no:2,name:"device_state_version",kind:"scalar",T:13},{no:3,name:"canShutdown",kind:"scalar",T:8},{no:4,name:"hasWifi",kind:"scalar",T:8},{no:5,name:"hasBluetooth",kind:"scalar",T:8},{no:6,name:"hasEthernet",kind:"scalar",T:8},{no:7,name:"role",kind:"enum",T:W.getEnumType(Di)},{no:8,name:"position_flags",kind:"scalar",T:13},{no:9,name:"hw_model",kind:"enum",T:W.getEnumType(ll)},{no:10,name:"hasRemoteHardware",kind:"scalar",T:8}]),__=W.makeMessageType("meshtastic.Heartbeat",[]),sh=W.makeMessageType("meshtastic.NodeRemoteHardwarePin",()=>[{no:1,name:"node_num",kind:"scalar",T:13},{no:2,name:"pin",kind:"message",T:Jm}]),lP=W.makeMessageType("meshtastic.ChunkedPayload",()=>[{no:1,name:"payload_id",kind:"scalar",T:13},{no:2,name:"chunk_count",kind:"scalar",T:13},{no:3,name:"chunk_index",kind:"scalar",T:13},{no:4,name:"payload_chunk",kind:"scalar",T:12}]),x_=W.makeMessageType("meshtastic.resend_chunks",()=>[{no:1,name:"chunks",kind:"scalar",T:13,repeated:!0}]),cP=W.makeMessageType("meshtastic.ChunkedPayloadResponse",()=>[{no:1,name:"payload_id",kind:"scalar",T:13},{no:2,name:"request_transfer",kind:"scalar",T:8,oneof:"payload_variant"},{no:3,name:"accept_transfer",kind:"scalar",T:8,oneof:"payload_variant"},{no:4,name:"resend_chunks",kind:"message",T:x_,oneof:"payload_variant"}]),k_={};nt(k_,{BluetoothConnectionStatus:()=>E_,DeviceConnectionStatus:()=>C_,EthernetConnectionStatus:()=>T_,NetworkConnectionStatus:()=>lh,SerialConnectionStatus:()=>N_,WifiConnectionStatus:()=>S_});var C_=W.makeMessageType("meshtastic.DeviceConnectionStatus",()=>[{no:1,name:"wifi",kind:"message",T:S_,opt:!0},{no:2,name:"ethernet",kind:"message",T:T_,opt:!0},{no:3,name:"bluetooth",kind:"message",T:E_,opt:!0},{no:4,name:"serial",kind:"message",T:N_,opt:!0}]),S_=W.makeMessageType("meshtastic.WifiConnectionStatus",()=>[{no:1,name:"status",kind:"message",T:lh},{no:2,name:"ssid",kind:"scalar",T:9},{no:3,name:"rssi",kind:"scalar",T:5}]),T_=W.makeMessageType("meshtastic.EthernetConnectionStatus",()=>[{no:1,name:"status",kind:"message",T:lh}]),lh=W.makeMessageType("meshtastic.NetworkConnectionStatus",()=>[{no:1,name:"ip_address",kind:"scalar",T:7},{no:2,name:"is_connected",kind:"scalar",T:8},{no:3,name:"is_mqtt_connected",kind:"scalar",T:8},{no:4,name:"is_syslog_connected",kind:"scalar",T:8}]),E_=W.makeMessageType("meshtastic.BluetoothConnectionStatus",()=>[{no:1,name:"pin",kind:"scalar",T:13},{no:2,name:"rssi",kind:"scalar",T:5},{no:3,name:"is_connected",kind:"scalar",T:8}]),N_=W.makeMessageType("meshtastic.SerialConnectionStatus",()=>[{no:1,name:"baud",kind:"scalar",T:13},{no:2,name:"is_connected",kind:"scalar",T:8}]),uP=W.makeMessageType("meshtastic.AdminMessage",()=>[{no:101,name:"session_passkey",kind:"scalar",T:12},{no:1,name:"get_channel_request",kind:"scalar",T:13,oneof:"payload_variant"},{no:2,name:"get_channel_response",kind:"message",T:zs,oneof:"payload_variant"},{no:3,name:"get_owner_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:4,name:"get_owner_response",kind:"message",T:Hs,oneof:"payload_variant"},{no:5,name:"get_config_request",kind:"enum",T:W.getEnumType(P_),oneof:"payload_variant"},{no:6,name:"get_config_response",kind:"message",T:cu,oneof:"payload_variant"},{no:7,name:"get_module_config_request",kind:"enum",T:W.getEnumType(M_),oneof:"payload_variant"},{no:8,name:"get_module_config_response",kind:"message",T:uu,oneof:"payload_variant"},{no:10,name:"get_canned_message_module_messages_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:11,name:"get_canned_message_module_messages_response",kind:"scalar",T:9,oneof:"payload_variant"},{no:12,name:"get_device_metadata_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:13,name:"get_device_metadata_response",kind:"message",T:ih,oneof:"payload_variant"},{no:14,name:"get_ringtone_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:15,name:"get_ringtone_response",kind:"scalar",T:9,oneof:"payload_variant"},{no:16,name:"get_device_connection_status_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:17,name:"get_device_connection_status_response",kind:"message",T:C_,oneof:"payload_variant"},{no:18,name:"set_ham_mode",kind:"message",T:A_,oneof:"payload_variant"},{no:19,name:"get_node_remote_hardware_pins_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:20,name:"get_node_remote_hardware_pins_response",kind:"message",T:R_,oneof:"payload_variant"},{no:21,name:"enter_dfu_mode_request",kind:"scalar",T:8,oneof:"payload_variant"},{no:22,name:"delete_file_request",kind:"scalar",T:9,oneof:"payload_variant"},{no:23,name:"set_scale",kind:"scalar",T:13,oneof:"payload_variant"},{no:32,name:"set_owner",kind:"message",T:Hs,oneof:"payload_variant"},{no:33,name:"set_channel",kind:"message",T:zs,oneof:"payload_variant"},{no:34,name:"set_config",kind:"message",T:cu,oneof:"payload_variant"},{no:35,name:"set_module_config",kind:"message",T:uu,oneof:"payload_variant"},{no:36,name:"set_canned_message_module_messages",kind:"scalar",T:9,oneof:"payload_variant"},{no:37,name:"set_ringtone_message",kind:"scalar",T:9,oneof:"payload_variant"},{no:38,name:"remove_by_nodenum",kind:"scalar",T:13,oneof:"payload_variant"},{no:39,name:"set_favorite_node",kind:"scalar",T:13,oneof:"payload_variant"},{no:40,name:"remove_favorite_node",kind:"scalar",T:13,oneof:"payload_variant"},{no:41,name:"set_fixed_position",kind:"message",T:th,oneof:"payload_variant"},{no:42,name:"remove_fixed_position",kind:"scalar",T:8,oneof:"payload_variant"},{no:43,name:"set_time_only",kind:"scalar",T:7,oneof:"payload_variant"},{no:64,name:"begin_edit_settings",kind:"scalar",T:8,oneof:"payload_variant"},{no:65,name:"commit_edit_settings",kind:"scalar",T:8,oneof:"payload_variant"},{no:94,name:"factory_reset_device",kind:"scalar",T:5,oneof:"payload_variant"},{no:95,name:"reboot_ota_seconds",kind:"scalar",T:5,oneof:"payload_variant"},{no:96,name:"exit_simulator",kind:"scalar",T:8,oneof:"payload_variant"},{no:97,name:"reboot_seconds",kind:"scalar",T:5,oneof:"payload_variant"},{no:98,name:"shutdown_seconds",kind:"scalar",T:5,oneof:"payload_variant"},{no:99,name:"factory_reset_config",kind:"scalar",T:5,oneof:"payload_variant"},{no:100,name:"nodedb_reset",kind:"scalar",T:5,oneof:"payload_variant"}]),P_=W.makeEnum("meshtastic.AdminMessage.ConfigType",[{no:0,name:"DEVICE_CONFIG"},{no:1,name:"POSITION_CONFIG"},{no:2,name:"POWER_CONFIG"},{no:3,name:"NETWORK_CONFIG"},{no:4,name:"DISPLAY_CONFIG"},{no:5,name:"LORA_CONFIG"},{no:6,name:"BLUETOOTH_CONFIG"},{no:7,name:"SECURITY_CONFIG"},{no:8,name:"SESSIONKEY_CONFIG"}]),M_=W.makeEnum("meshtastic.AdminMessage.ModuleConfigType",[{no:0,name:"MQTT_CONFIG"},{no:1,name:"SERIAL_CONFIG"},{no:2,name:"EXTNOTIF_CONFIG"},{no:3,name:"STOREFORWARD_CONFIG"},{no:4,name:"RANGETEST_CONFIG"},{no:5,name:"TELEMETRY_CONFIG"},{no:6,name:"CANNEDMSG_CONFIG"},{no:7,name:"AUDIO_CONFIG"},{no:8,name:"REMOTEHARDWARE_CONFIG"},{no:9,name:"NEIGHBORINFO_CONFIG"},{no:10,name:"AMBIENTLIGHTING_CONFIG"},{no:11,name:"DETECTIONSENSOR_CONFIG"},{no:12,name:"PAXCOUNTER_CONFIG"}]),A_=W.makeMessageType("meshtastic.HamParameters",()=>[{no:1,name:"call_sign",kind:"scalar",T:9},{no:2,name:"tx_power",kind:"scalar",T:5},{no:3,name:"frequency",kind:"scalar",T:2},{no:4,name:"short_name",kind:"scalar",T:9}]),R_=W.makeMessageType("meshtastic.NodeRemoteHardwarePinsResponse",()=>[{no:1,name:"node_remote_hardware_pins",kind:"message",T:sh,repeated:!0}]),I_={};nt(I_,{ChannelSet:()=>dP});var dP=W.makeMessageType("meshtastic.ChannelSet",()=>[{no:1,name:"settings",kind:"message",T:Nm,repeated:!0},{no:2,name:"lora_config",kind:"message",T:td}]),O_={};nt(O_,{CannedMessageModuleConfig:()=>fP});var fP=W.makeMessageType("meshtastic.CannedMessageModuleConfig",()=>[{no:1,name:"messages",kind:"scalar",T:9}]),D_={};nt(D_,{DeviceProfile:()=>pP});var L_={};nt(L_,{LocalConfig:()=>ch,LocalModuleConfig:()=>uh});var ch=W.makeMessageType("meshtastic.LocalConfig",()=>[{no:1,name:"device",kind:"message",T:Pm},{no:2,name:"position",kind:"message",T:Mm},{no:3,name:"power",kind:"message",T:Am},{no:4,name:"network",kind:"message",T:Rm},{no:5,name:"display",kind:"message",T:Im},{no:6,name:"lora",kind:"message",T:td},{no:7,name:"bluetooth",kind:"message",T:Lm},{no:8,name:"version",kind:"scalar",T:13},{no:9,name:"security",kind:"message",T:jm}]),uh=W.makeMessageType("meshtastic.LocalModuleConfig",()=>[{no:1,name:"mqtt",kind:"message",T:$m},{no:2,name:"serial",kind:"message",T:Gm},{no:3,name:"external_notification",kind:"message",T:Km},{no:4,name:"store_forward",kind:"message",T:qm},{no:5,name:"range_test",kind:"message",T:Xm},{no:6,name:"telemetry",kind:"message",T:Ym},{no:7,name:"canned_message",kind:"message",T:Qm},{no:9,name:"audio",kind:"message",T:Hm},{no:10,name:"remote_hardware",kind:"message",T:Um},{no:11,name:"neighbor_info",kind:"message",T:Vm},{no:12,name:"ambient_lighting",kind:"message",T:Zm},{no:13,name:"detection_sensor",kind:"message",T:zm},{no:14,name:"paxcounter",kind:"message",T:Wm},{no:8,name:"version",kind:"scalar",T:13}]),pP=W.makeMessageType("meshtastic.DeviceProfile",()=>[{no:1,name:"long_name",kind:"scalar",T:9,opt:!0},{no:2,name:"short_name",kind:"scalar",T:9,opt:!0},{no:3,name:"channel_url",kind:"scalar",T:9,opt:!0},{no:4,name:"config",kind:"message",T:ch,opt:!0},{no:5,name:"module_config",kind:"message",T:uh,opt:!0}]),j_={};nt(j_,{ChannelFile:()=>hP,DeviceState:()=>mP,NodeInfoLite:()=>U_,OEMStore:()=>gP,PositionLite:()=>B_,ScreenFonts:()=>F_,UserLite:()=>$_});var F_=W.makeEnum("meshtastic.ScreenFonts",[{no:0,name:"FONT_SMALL"},{no:1,name:"FONT_MEDIUM"},{no:2,name:"FONT_LARGE"}]),B_=W.makeMessageType("meshtastic.PositionLite",()=>[{no:1,name:"latitude_i",kind:"scalar",T:15},{no:2,name:"longitude_i",kind:"scalar",T:15},{no:3,name:"altitude",kind:"scalar",T:5},{no:4,name:"time",kind:"scalar",T:7},{no:5,name:"location_source",kind:"enum",T:W.getEnumType(nh)}]),$_=W.makeMessageType("meshtastic.UserLite",()=>[{no:1,name:"macaddr",kind:"scalar",T:12},{no:2,name:"long_name",kind:"scalar",T:9},{no:3,name:"short_name",kind:"scalar",T:9},{no:4,name:"hw_model",kind:"enum",T:W.getEnumType(ll)},{no:5,name:"is_licensed",kind:"scalar",T:8},{no:6,name:"role",kind:"enum",T:W.getEnumType(Di)},{no:7,name:"public_key",kind:"scalar",T:12}]),U_=W.makeMessageType("meshtastic.NodeInfoLite",()=>[{no:1,name:"num",kind:"scalar",T:13},{no:2,name:"user",kind:"message",T:$_},{no:3,name:"position",kind:"message",T:B_},{no:4,name:"snr",kind:"scalar",T:2},{no:5,name:"last_heard",kind:"scalar",T:7},{no:6,name:"device_metrics",kind:"message",T:nd},{no:7,name:"channel",kind:"scalar",T:13},{no:8,name:"via_mqtt",kind:"scalar",T:8},{no:9,name:"hops_away",kind:"scalar",T:13},{no:10,name:"is_favorite",kind:"scalar",T:8}]),mP=W.makeMessageType("meshtastic.DeviceState",()=>[{no:2,name:"my_node",kind:"message",T:oh},{no:3,name:"owner",kind:"message",T:Hs},{no:5,name:"receive_queue",kind:"message",T:Go,repeated:!0},{no:8,name:"version",kind:"scalar",T:13},{no:7,name:"rx_text_message",kind:"message",T:Go},{no:9,name:"no_save",kind:"scalar",T:8},{no:11,name:"did_gps_reset",kind:"scalar",T:8},{no:12,name:"rx_waypoint",kind:"message",T:Go},{no:13,name:"node_remote_hardware_pins",kind:"message",T:sh,repeated:!0},{no:14,name:"node_db_lite",kind:"message",T:U_,repeated:!0}]),hP=W.makeMessageType("meshtastic.ChannelFile",()=>[{no:1,name:"channels",kind:"message",T:zs,repeated:!0},{no:2,name:"version",kind:"scalar",T:13}]),gP=W.makeMessageType("meshtastic.OEMStore",()=>[{no:1,name:"oem_icon_width",kind:"scalar",T:13},{no:2,name:"oem_icon_height",kind:"scalar",T:13},{no:3,name:"oem_icon_bits",kind:"scalar",T:12},{no:4,name:"oem_font",kind:"enum",T:W.getEnumType(F_)},{no:5,name:"oem_text",kind:"scalar",T:9},{no:6,name:"oem_aes_key",kind:"scalar",T:12},{no:7,name:"oem_local_config",kind:"message",T:ch},{no:8,name:"oem_local_module_config",kind:"message",T:uh}]),V_={};nt(V_,{MapReport:()=>yP,ServiceEnvelope:()=>vP});var vP=W.makeMessageType("meshtastic.ServiceEnvelope",()=>[{no:1,name:"packet",kind:"message",T:Go},{no:2,name:"channel_id",kind:"scalar",T:9},{no:3,name:"gateway_id",kind:"scalar",T:9}]),yP=W.makeMessageType("meshtastic.MapReport",()=>[{no:1,name:"long_name",kind:"scalar",T:9},{no:2,name:"short_name",kind:"scalar",T:9},{no:3,name:"role",kind:"enum",T:W.getEnumType(Di)},{no:4,name:"hw_model",kind:"enum",T:W.getEnumType(ll)},{no:5,name:"firmware_version",kind:"scalar",T:9},{no:6,name:"region",kind:"enum",T:W.getEnumType(Om)},{no:7,name:"modem_preset",kind:"enum",T:W.getEnumType(Dm)},{no:8,name:"has_default_channel",kind:"scalar",T:8},{no:9,name:"latitude_i",kind:"scalar",T:15},{no:10,name:"longitude_i",kind:"scalar",T:15},{no:11,name:"altitude",kind:"scalar",T:5},{no:12,name:"position_precision",kind:"scalar",T:13},{no:13,name:"num_online_local_nodes",kind:"scalar",T:13}]),dh={};nt(dh,{Paxcount:()=>bP});var bP=W.makeMessageType("meshtastic.Paxcount",()=>[{no:1,name:"wifi",kind:"scalar",T:13},{no:2,name:"ble",kind:"scalar",T:13},{no:3,name:"uptime",kind:"scalar",T:13}]),fh={};nt(fh,{HardwareMessage:()=>wP,HardwareMessage_Type:()=>z_});var wP=W.makeMessageType("meshtastic.HardwareMessage",()=>[{no:1,name:"type",kind:"enum",T:W.getEnumType(z_)},{no:2,name:"gpio_mask",kind:"scalar",T:4},{no:3,name:"gpio_value",kind:"scalar",T:4}]),z_=W.makeEnum("meshtastic.HardwareMessage.Type",[{no:0,name:"UNSET"},{no:1,name:"WRITE_GPIOS"},{no:2,name:"WATCH_GPIOS"},{no:3,name:"GPIOS_CHANGED"},{no:4,name:"READ_GPIOS"},{no:5,name:"READ_GPIOS_REPLY"}]),H_={};nt(H_,{RTTTLConfig:()=>_P});var _P=W.makeMessageType("meshtastic.RTTTLConfig",()=>[{no:1,name:"ringtone",kind:"scalar",T:9}]),W_={};nt(W_,{StoreAndForward:()=>xP,StoreAndForward_Heartbeat:()=>X_,StoreAndForward_History:()=>q_,StoreAndForward_RequestResponse:()=>G_,StoreAndForward_Statistics:()=>K_});var xP=W.makeMessageType("meshtastic.StoreAndForward",()=>[{no:1,name:"rr",kind:"enum",T:W.getEnumType(G_)},{no:2,name:"stats",kind:"message",T:K_,oneof:"variant"},{no:3,name:"history",kind:"message",T:q_,oneof:"variant"},{no:4,name:"heartbeat",kind:"message",T:X_,oneof:"variant"},{no:5,name:"text",kind:"scalar",T:12,oneof:"variant"}]),G_=W.makeEnum("meshtastic.StoreAndForward.RequestResponse",[{no:0,name:"UNSET"},{no:1,name:"ROUTER_ERROR"},{no:2,name:"ROUTER_HEARTBEAT"},{no:3,name:"ROUTER_PING"},{no:4,name:"ROUTER_PONG"},{no:5,name:"ROUTER_BUSY"},{no:6,name:"ROUTER_HISTORY"},{no:7,name:"ROUTER_STATS"},{no:8,name:"ROUTER_TEXT_DIRECT"},{no:9,name:"ROUTER_TEXT_BROADCAST"},{no:64,name:"CLIENT_ERROR"},{no:65,name:"CLIENT_HISTORY"},{no:66,name:"CLIENT_STATS"},{no:67,name:"CLIENT_PING"},{no:68,name:"CLIENT_PONG"},{no:106,name:"CLIENT_ABORT"}]),K_=W.makeMessageType("meshtastic.StoreAndForward.Statistics",()=>[{no:1,name:"messages_total",kind:"scalar",T:13},{no:2,name:"messages_saved",kind:"scalar",T:13},{no:3,name:"messages_max",kind:"scalar",T:13},{no:4,name:"up_time",kind:"scalar",T:13},{no:5,name:"requests",kind:"scalar",T:13},{no:6,name:"requests_history",kind:"scalar",T:13},{no:7,name:"heartbeat",kind:"scalar",T:8},{no:8,name:"return_max",kind:"scalar",T:13},{no:9,name:"return_window",kind:"scalar",T:13}],{localName:"StoreAndForward_Statistics"}),q_=W.makeMessageType("meshtastic.StoreAndForward.History",()=>[{no:1,name:"history_messages",kind:"scalar",T:13},{no:2,name:"window",kind:"scalar",T:13},{no:3,name:"last_request",kind:"scalar",T:13}],{localName:"StoreAndForward_History"}),X_=W.makeMessageType("meshtastic.StoreAndForward.Heartbeat",()=>[{no:1,name:"period",kind:"scalar",T:13},{no:2,name:"secondary",kind:"scalar",T:13}],{localName:"StoreAndForward_Heartbeat"}),Ws={};nt(Ws,{ChannelNumber:()=>Z_,DeviceStatusEnum:()=>Y_,Emitter:()=>ve,EmitterScope:()=>Q_});var Y_=(e=>(e[e.DeviceRestarting=1]="DeviceRestarting",e[e.DeviceDisconnected=2]="DeviceDisconnected",e[e.DeviceConnecting=3]="DeviceConnecting",e[e.DeviceReconnecting=4]="DeviceReconnecting",e[e.DeviceConnected=5]="DeviceConnected",e[e.DeviceConfiguring=6]="DeviceConfiguring",e[e.DeviceConfigured=7]="DeviceConfigured",e))(Y_||{}),Q_=(e=>(e[e.MeshDevice=1]="MeshDevice",e[e.SerialConnection=2]="SerialConnection",e[e.NodeSerialConnection=3]="NodeSerialConnection",e[e.BleConnection=4]="BleConnection",e[e.HttpConnection=5]="HttpConnection",e))(Q_||{}),ve=(e=>(e[e.Constructor=0]="Constructor",e[e.SendText=1]="SendText",e[e.SendWaypoint=2]="SendWaypoint",e[e.SendPacket=3]="SendPacket",e[e.SendRaw=4]="SendRaw",e[e.SetConfig=5]="SetConfig",e[e.SetModuleConfig=6]="SetModuleConfig",e[e.ConfirmSetConfig=7]="ConfirmSetConfig",e[e.SetOwner=8]="SetOwner",e[e.SetChannel=9]="SetChannel",e[e.ConfirmSetChannel=10]="ConfirmSetChannel",e[e.ClearChannel=11]="ClearChannel",e[e.GetChannel=12]="GetChannel",e[e.GetAllChannels=13]="GetAllChannels",e[e.GetConfig=14]="GetConfig",e[e.GetModuleConfig=15]="GetModuleConfig",e[e.GetOwner=16]="GetOwner",e[e.Configure=17]="Configure",e[e.HandleFromRadio=18]="HandleFromRadio",e[e.HandleMeshPacket=19]="HandleMeshPacket",e[e.Connect=20]="Connect",e[e.Ping=21]="Ping",e[e.ReadFromRadio=22]="ReadFromRadio",e[e.WriteToRadio=23]="WriteToRadio",e[e.SetDebugMode=24]="SetDebugMode",e[e.GetMetadata=25]="GetMetadata",e[e.ResetNodes=26]="ResetNodes",e[e.Shutdown=27]="Shutdown",e[e.Reboot=28]="Reboot",e[e.RebootOta=29]="RebootOta",e[e.FactoryReset=30]="FactoryReset",e[e.EnterDfuMode=31]="EnterDfuMode",e[e.RemoveNodeByNum=32]="RemoveNodeByNum",e[e.SetCannedMessages=33]="SetCannedMessages",e))(ve||{}),Z_=(e=>(e[e.Primary=0]="Primary",e[e.Channel1=1]="Channel1",e[e.Channel2=2]="Channel2",e[e.Channel3=3]="Channel3",e[e.Channel4=4]="Channel4",e[e.Channel5=5]="Channel5",e[e.Channel6=6]="Channel6",e[e.Admin=7]="Admin",e))(Z_||{}),kP={};nt(kP,{EventSystem:()=>J_,Queue:()=>ex,Xmodem:()=>nx,transformHandler:()=>tx,typedArrayToBuffer:()=>ph});var J_=class{onLogEvent=new _e.SimpleEventDispatcher;onFromRadio=new _e.SimpleEventDispatcher;onMeshPacket=new _e.SimpleEventDispatcher;onMyNodeInfo=new _e.SimpleEventDispatcher;onNodeInfoPacket=new _e.SimpleEventDispatcher;onChannelPacket=new _e.SimpleEventDispatcher;onConfigPacket=new _e.SimpleEventDispatcher;onModuleConfigPacket=new _e.SimpleEventDispatcher;onAtakPacket=new _e.SimpleEventDispatcher;onMessagePacket=new _e.SimpleEventDispatcher;onRemoteHardwarePacket=new _e.SimpleEventDispatcher;onPositionPacket=new _e.SimpleEventDispatcher;onUserPacket=new _e.SimpleEventDispatcher;onRoutingPacket=new _e.SimpleEventDispatcher;onDeviceMetadataPacket=new _e.SimpleEventDispatcher;onWaypointPacket=new _e.SimpleEventDispatcher;onAudioPacket=new _e.SimpleEventDispatcher;onDetectionSensorPacket=new _e.SimpleEventDispatcher;onPingPacket=new _e.SimpleEventDispatcher;onIpTunnelPacket=new _e.SimpleEventDispatcher;onPaxcounterPacket=new _e.SimpleEventDispatcher;onSerialPacket=new _e.SimpleEventDispatcher;onStoreForwardPacket=new _e.SimpleEventDispatcher;onRangeTestPacket=new _e.SimpleEventDispatcher;onTelemetryPacket=new _e.SimpleEventDispatcher;onZpsPacket=new _e.SimpleEventDispatcher;onSimulatorPacket=new _e.SimpleEventDispatcher;onTraceRoutePacket=new _e.SimpleEventDispatcher;onNeighborInfoPacket=new _e.SimpleEventDispatcher;onAtakPluginPacket=new _e.SimpleEventDispatcher;onMapReportPacket=new _e.SimpleEventDispatcher;onPrivatePacket=new _e.SimpleEventDispatcher;onAtakForwarderPacket=new _e.SimpleEventDispatcher;onDeviceStatus=new _e.SimpleEventDispatcher;onLogRecord=new _e.SimpleEventDispatcher;onMeshHeartbeat=new _e.SimpleEventDispatcher;onDeviceDebugLog=new _e.SimpleEventDispatcher;onPendingSettingsChange=new _e.SimpleEventDispatcher;onQueueStatus=new _e.SimpleEventDispatcher},ph=e=>e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset),ex=class{queue=[];lock=!1;ackNotifier=new _e.SimpleEventDispatcher;errorNotifier=new _e.SimpleEventDispatcher;timeout;constructor(){this.timeout=6e4}getState(){return this.queue}clear(){this.queue=[]}push(e){const t={...e,sent:!1,added:new Date,promise:new Promise((n,r)=>{this.ackNotifier.subscribe(o=>{e.id===o&&(this.remove(e.id),n(o))}),this.errorNotifier.subscribe(o=>{e.id===o.id&&(this.remove(e.id),r(o))}),setTimeout(()=>{if(this.queue.findIndex(o=>o.id===e.id)!==-1){this.remove(e.id);const o=it.ToRadio.fromBinary(e.data);console.warn(`Packet ${e.id} of type ${o.payloadVariant.case} timed out`),r({id:e.id,error:it.Routing_Error.TIMEOUT})}},this.timeout)})};this.queue.push(t)}remove(e){if(this.lock){setTimeout(()=>this.remove(e),100);return}this.queue=this.queue.filter(t=>t.id!==e)}processAck(e){this.ackNotifier.dispatch(e)}processError(e){console.error(`Error received for packet ${e.id}: ${it.Routing_Error[e.error]}`),this.errorNotifier.dispatch(e)}async wait(e){const t=this.queue.find(n=>n.id===e);if(!t)throw new Error("Packet does not exist");return t.promise}async processQueue(e){if(!this.lock){for(this.lock=!0;this.queue.filter(t=>!t.sent).length>0;){const t=this.queue.filter(n=>!n.sent)[0];if(t){await new Promise(n=>setTimeout(n,200));try{await e(t.data),t.sent=!0}catch(n){console.error(`Error sending packet ${t.id}`,n)}}}this.lock=!1}}},tx=(e,t,n,r)=>{let o=new Uint8Array([]);return new TransformStream({transform(a,i){e=e.getSubLogger({name:"streamTransformer"}),t.subscribe(()=>{i.terminate()}),o=new Uint8Array([...o,...a]);let s=!1;for(;o.length!==0&&!s;){const l=o.findIndex(u=>u===148);if(o[l+1]===195){o.subarray(0,l).length&&(r?n.dispatch(o.subarray(0,l)):e.warn(2,20,`⚠️ Found unneccesary message padding, removing: ${o.subarray(0,l).toString()}`),o=o.subarray(l));const u=o[2],d=o[3];if(u!==void 0&&d!==void 0&&o.length>=4+(u<<8)+d){const p=o.subarray(4,4+(u<<8)+d),g=p.findIndex(v=>v===148);g!==-1&&p[g+1]===195?(e.warn(2,20,`⚠️ Malformed packet found, discarding: ${o.subarray(0,g-1).toString()}`,it.LogRecord_Level.WARNING),o=o.subarray(g)):(o=o.subarray(3+(u<<8)+d+1),i.enqueue(p))}else s=!0}else s=!0}}})},nx=class{sendRaw;rxBuffer;txBuffer;textEncoder;counter;constructor(e){this.sendRaw=e,this.rxBuffer=[],this.txBuffer=[],this.textEncoder=new TextEncoder,this.counter=0}async downloadFile(e){return await this.sendCommand(bt.XModem_Control.STX,this.textEncoder.encode(e),0)}async uploadFile(e,t){for(let n=0;nsetTimeout(t,100)),e.control){case bt.XModem_Control.NUL:break;case bt.XModem_Control.SOH:return this.counter=e.seq,this.validateCrc16(e)?(this.rxBuffer[this.counter]=e.buffer,this.sendCommand(bt.XModem_Control.ACK)):await this.sendCommand(bt.XModem_Control.NAK,void 0,e.seq);case bt.XModem_Control.STX:break;case bt.XModem_Control.EOT:break;case bt.XModem_Control.ACK:{if(this.counter++,this.txBuffer[this.counter-1])return this.sendCommand(bt.XModem_Control.SOH,this.txBuffer[this.counter-1],this.counter,lf(this.txBuffer[this.counter-1]??new Uint8Array));if(this.counter===this.txBuffer.length+1)return this.sendCommand(bt.XModem_Control.EOT);this.clear();break}case bt.XModem_Control.NAK:return this.sendCommand(bt.XModem_Control.SOH,this.txBuffer[this.counter],this.counter,lf(this.txBuffer[this.counter-1]??new Uint8Array));case bt.XModem_Control.CAN:{this.clear();break}case bt.XModem_Control.CTRLZ:break}return Promise.resolve(0)}validateCrc16(e){return lf(e.buffer)===e.crc16}clear(){this.counter=0,this.rxBuffer=[],this.txBuffer=[]}},mh=class{log;deviceStatus;isConfigured;pendingSettingsChanges;myNodeInfo;configId;queue;events;xModem;constructor(e){this.log=new O3({name:"iMeshDevice",prettyLogTemplate:"{{hh}}:{{MM}}:{{ss}}:{{ms}} {{logLevelName}} [{{name}}] "}),this.deviceStatus=2,this.isConfigured=!1,this.pendingSettingsChanges=!1,this.myNodeInfo=new it.MyNodeInfo,this.configId=e??this.generateRandId(),this.queue=new ex,this.events=new J_,this.xModem=new nx(this.sendRaw.bind(this)),this.events.onDeviceStatus.subscribe(t=>{this.deviceStatus=t,t===7?this.isConfigured=!0:t===6&&(this.isConfigured=!1)}),this.events.onMyNodeInfo.subscribe(t=>{this.myNodeInfo=t}),this.events.onPendingSettingsChange.subscribe(t=>{this.pendingSettingsChanges=t})}async sendText(e,t,n,r){this.log.debug(ve[1],`📤 Sending message to ${t??"broadcast"} on channel ${r?.toString()??0}`);const o=new TextEncoder;return await this.sendPacket(o.encode(e),be.PortNum.TEXT_MESSAGE_APP,t??"broadcast",r,n,!1,!0)}sendWaypoint(e,t,n){return this.log.debug(ve[2],`📤 Sending waypoint to ${t} on channel ${n?.toString()??0}`),e.id=this.generateRandId(),this.sendPacket(e.toBinary(),be.PortNum.WAYPOINT_APP,t,n,!0,!1)}async sendPacket(e,t,n,r=0,o=!0,a=!0,i=!1,s,l){this.log.trace(ve[3],`📤 Sending ${be.PortNum[t]} to ${n}`);const c=new it.MeshPacket({payloadVariant:{case:"decoded",value:{payload:e,portnum:t,wantResponse:a,emoji:l,replyId:s,dest:0,requestId:0,source:0}},from:this.myNodeInfo.myNodeNum,to:n==="broadcast"?G0:n==="self"?this.myNodeInfo.myNodeNum:n,id:this.generateRandId(),wantAck:o,channel:r}),u=new it.ToRadio({payloadVariant:{case:"packet",value:c}});return i&&(c.rxTime=Math.trunc(new Date().getTime()/1e3),this.handleMeshPacket(c)),await this.sendRaw(u.toBinary(),c.id)}async sendRaw(e,t=this.generateRandId()){if(e.length>512)throw new Error("Message longer than 512 bytes, it will not be sent!");return this.queue.push({id:t,data:e}),await this.queue.processQueue(async n=>{await this.writeToRadio(n)}),this.queue.wait(t)}async setConfig(e){this.log.debug(ve[5],`⚙️ Setting config, Variant: ${e.payloadVariant.case??"Unknown"}`),this.pendingSettingsChanges||await this.beginEditSettings();const t=new qe.AdminMessage({payloadVariant:{case:"setConfig",value:e}});return this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async setModuleConfig(e){this.log.debug(ve[6],"⚙️ Setting module config");const t=new qe.AdminMessage({payloadVariant:{case:"setModuleConfig",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async setCannedMessages(e){this.log.debug(ve[33],"⚙️ Setting CannedMessages");const t=new qe.AdminMessage({payloadVariant:{case:"setCannedMessageModuleMessages",value:e.messages}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async setOwner(e){this.log.debug(ve[8],"👤 Setting owner");const t=new qe.AdminMessage({payloadVariant:{case:"setOwner",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async setChannel(e){this.log.debug(ve[9],`📻 Setting Channel: ${e.index}`);const t=new qe.AdminMessage({payloadVariant:{case:"setChannel",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async setPosition(e){return await this.sendPacket(e.toBinary(),be.PortNum.POSITION_APP,"self")}async getChannel(e){this.log.debug(ve[12],`📻 Requesting Channel: ${e}`);const t=new qe.AdminMessage({payloadVariant:{case:"getChannelRequest",value:e+1}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async getConfig(e){this.log.debug(ve[14],"⚙️ Requesting config");const t=new qe.AdminMessage({payloadVariant:{case:"getConfigRequest",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async getModuleConfig(e){this.log.debug(ve[15],"⚙️ Requesting module config");const t=new qe.AdminMessage({payloadVariant:{case:"getModuleConfigRequest",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async getOwner(){this.log.debug(ve[16],"👤 Requesting owner");const e=new qe.AdminMessage({payloadVariant:{case:"getOwnerRequest",value:!0}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}async getMetadata(e){this.log.debug(ve[25],`🏷️ Requesting metadata from ${e}`);const t=new qe.AdminMessage({payloadVariant:{case:"getDeviceMetadataRequest",value:!0}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,e,7)}async clearChannel(e){this.log.debug(ve[11],`📻 Clearing Channel ${e}`);const t=new lu.Channel({index:e,role:lu.Channel_Role.DISABLED}),n=new qe.AdminMessage({payloadVariant:{case:"setChannel",value:t}});return await this.sendPacket(n.toBinary(),be.PortNum.ADMIN_APP,"self")}async beginEditSettings(){this.events.onPendingSettingsChange.dispatch(!0);const e=new qe.AdminMessage({payloadVariant:{case:"beginEditSettings",value:!0}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}async commitEditSettings(){this.events.onPendingSettingsChange.dispatch(!1);const e=new qe.AdminMessage({payloadVariant:{case:"commitEditSettings",value:!0}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}async resetNodes(){this.log.debug(ve[26],"📻 Resetting NodeDB");const e=new qe.AdminMessage({payloadVariant:{case:"nodedbReset",value:1}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}async removeNodeByNum(e){this.log.debug(ve[32],`📻 Removing Node ${e} from NodeDB`);const t=new qe.AdminMessage({payloadVariant:{case:"removeByNodenum",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async shutdown(e){this.log.debug(ve[27],`🔌 Shutting down ${e>2?"now":`in ${e} seconds`}`);const t=new qe.AdminMessage({payloadVariant:{case:"shutdownSeconds",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async reboot(e){this.log.debug(ve[28],`🔌 Rebooting node ${e>0?"now":`in ${e} seconds`}`);const t=new qe.AdminMessage({payloadVariant:{case:"rebootSeconds",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async rebootOta(e){this.log.debug(ve[29],`🔌 Rebooting into OTA mode ${e>0?"now":`in ${e} seconds`}`);const t=new qe.AdminMessage({payloadVariant:{case:"rebootOtaSeconds",value:e}});return await this.sendPacket(t.toBinary(),be.PortNum.ADMIN_APP,"self")}async factoryResetDevice(){this.log.debug(ve[30],"♻️ Factory resetting device");const e=new qe.AdminMessage({payloadVariant:{case:"factoryResetDevice",value:1}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}async factoryResetConfig(){this.log.debug(ve[30],"♻️ Factory resetting config");const e=new qe.AdminMessage({payloadVariant:{case:"factoryResetConfig",value:1}});return await this.sendPacket(e.toBinary(),be.PortNum.ADMIN_APP,"self")}configure(){this.log.debug(ve[17],"⚙️ Requesting device configuration"),this.updateDeviceStatus(6);const e=new it.ToRadio({payloadVariant:{case:"wantConfigId",value:this.configId}});return this.sendRaw(e.toBinary())}async traceRoute(e){const t=new it.RouteDiscovery({route:[]});return await this.sendPacket(t.toBinary(),be.PortNum.TRACEROUTE_APP,e)}async requestPosition(e){return await this.sendPacket(new Uint8Array,be.PortNum.POSITION_APP,e)}updateDeviceStatus(e){e!==this.deviceStatus&&this.events.onDeviceStatus.dispatch(e)}generateRandId(){const e=crypto.getRandomValues(new Uint32Array(1));if(!e[0])throw new Error("Cannot generate CSPRN");return Math.floor(e[0]*2**-32*1e9)}handleFromRadio(e){const t=it.FromRadio.fromBinary(e);switch(this.events.onFromRadio.dispatch(t),t.payloadVariant.case){case"packet":{this.handleMeshPacket(t.payloadVariant.value);break}case"myInfo":{this.events.onMyNodeInfo.dispatch(t.payloadVariant.value),this.log.info(ve[18],"📱 Received Node info for this device");break}case"nodeInfo":{this.log.info(ve[18],`📱 Received Node Info packet for node: ${t.payloadVariant.value.num}`),this.events.onNodeInfoPacket.dispatch(t.payloadVariant.value),t.payloadVariant.value.position&&this.events.onPositionPacket.dispatch({id:t.id,rxTime:new Date,from:t.payloadVariant.value.num,to:t.payloadVariant.value.num,type:"direct",channel:0,data:t.payloadVariant.value.position}),t.payloadVariant.value.user&&this.events.onUserPacket.dispatch({id:t.id,rxTime:new Date,from:t.payloadVariant.value.num,to:t.payloadVariant.value.num,type:"direct",channel:0,data:t.payloadVariant.value.user});break}case"config":{t.payloadVariant.value.payloadVariant.case?this.log.trace(ve[18],`💾 Received Config packet of variant: ${t.payloadVariant.value.payloadVariant.case}`):this.log.warn(ve[18],"⚠️ Received Config packet of variant: UNK"),this.events.onConfigPacket.dispatch(t.payloadVariant.value);break}case"logRecord":{this.log.trace(ve[18],"Received onLogRecord"),this.events.onLogRecord.dispatch(t.payloadVariant.value);break}case"configCompleteId":{t.payloadVariant.value!==this.configId&&this.log.error(ve[18],`❌ Invalid config id received from device, expected ${this.configId} but received ${t.payloadVariant.value}`),this.log.info(ve[18],`⚙️ Valid config id received from device: ${this.configId}`),this.updateDeviceStatus(7);break}case"rebooted":{this.configure().catch(()=>{});break}case"moduleConfig":{t.payloadVariant.value.payloadVariant.case?this.log.trace(ve[18],`💾 Received Module Config packet of variant: ${t.payloadVariant.value.payloadVariant.case}`):this.log.warn(ve[18],"⚠️ Received Module Config packet of variant: UNK"),this.events.onModuleConfigPacket.dispatch(t.payloadVariant.value);break}case"channel":{this.log.trace(ve[18],`🔐 Received Channel: ${t.payloadVariant.value.index}`),this.events.onChannelPacket.dispatch(t.payloadVariant.value);break}case"queueStatus":{this.log.trace(ve[18],`🚧 Received Queue Status: ${t.payloadVariant.value}`),this.events.onQueueStatus.dispatch(t.payloadVariant.value);break}case"xmodemPacket":{this.xModem.handlePacket(t.payloadVariant.value);break}case"metadata":{Number.parseFloat(t.payloadVariant.value.firmwareVersion){this.log.info(ve[20],"Device disconnected"),this.updateDeviceStatus(2),this.complete()}),await this.device.gatt?.connect().then(n=>{this.log.info(ve[20],`✅ Got GATT Server for device: ${n.device.id}`),this.gattServer=n}).catch(n=>{this.log.error(ve[20],`❌ Failed to connect: ${n.message}`)}),await this.gattServer?.getPrimaryService(W0).then(n=>{this.log.info(ve[20],`✅ Got GATT Service for device: ${n.device.id}`),this.service=n}).catch(n=>{this.log.error(ve[20],`❌ Failed to get primary service: q${n.message}`)}),[V0,z0,H0].map(async n=>{await this.service?.getCharacteristic(n).then(r=>{switch(this.log.info(ve[20],`✅ Got Characteristic ${r.uuid} for device: ${r.uuid}`),n){case V0:{this.toRadioCharacteristic=r;break}case z0:{this.fromRadioCharacteristic=r;break}case H0:{this.fromNumCharacteristic=r;break}}}).catch(r=>{this.log.error(ve[20],`❌ Failed to get toRadio characteristic: q${r.message}`)})}),await this.fromNumCharacteristic?.startNotifications(),this.fromNumCharacteristic?.addEventListener("characteristicvaluechanged",()=>{this.readFromRadio()}),this.updateDeviceStatus(5),this.configure().catch(()=>{}),this.timerUpdateFromRadio=setInterval(()=>this.readFromRadio(),1e3)}disconnect(){this.device?.gatt?.disconnect(),this.updateDeviceStatus(2),this.complete(),this.timerUpdateFromRadio&&clearInterval(this.timerUpdateFromRadio),this.timerUpdateFromRadio=null}async ping(){return await Promise.resolve(!0)}async readFromRadio(){let e=new ArrayBuffer(1);for(;e.byteLength>0&&this.fromRadioCharacteristic;)await this.fromRadioCharacteristic.readValue().then(t=>{e=t.buffer,t.byteLength>0&&this.handleFromRadio(new Uint8Array(e)),this.updateDeviceStatus(5)}).catch(t=>{e=new ArrayBuffer(0),this.log.error(ve[22],`❌ ${t.message}`)})}async writeToRadio(e){await this.toRadioCharacteristic?.writeValue(ph(e)),await this.readFromRadio()}},SP=class extends mh{connType;portId;receiveBatchRequests;readLoop;pendingRequest;abortController;constructor(e){super(e),this.log=this.log.getSubLogger({name:"HttpConnection"}),this.connType="http",this.portId="",this.receiveBatchRequests=!1,this.readLoop=null,this.pendingRequest=!1,this.abortController=new AbortController,this.log.debug(ve[0],"🔷 HttpConnection instantiated")}async connect({address:e,fetchInterval:t=3e3,receiveBatchRequests:n=!1,tls:r=!1}){this.updateDeviceStatus(3),this.receiveBatchRequests=n,this.portId=`${r?"https://":"http://"}${e}`,this.deviceStatus===3&&await this.ping()?(this.log.debug(ve[20],"Ping succeeded, starting configuration and request timer."),this.configure().catch(()=>{}),this.readLoop=setInterval(()=>{this.readFromRadio().catch(o=>{this.log.error(ve[20],`❌ ${o.message}`)})},t)):this.deviceStatus!==2&&setTimeout(()=>{this.connect({address:e,fetchInterval:t,receiveBatchRequests:n,tls:r})},1e4)}disconnect(){this.abortController.abort(),this.updateDeviceStatus(2),this.readLoop&&(clearInterval(this.readLoop),this.complete())}async ping(){this.log.debug(ve[21],"Attempting device ping.");const{signal:e}=this.abortController;let t=!1;return await fetch(`${this.portId}/hotspot-detect.html`,{signal:e,mode:"no-cors"}).then(()=>{t=!0,this.updateDeviceStatus(5)}).catch(n=>{t=!1,this.log.error(ve[21],`❌ ${n.message}`),this.updateDeviceStatus(4)}),t}async readFromRadio(){if(this.pendingRequest)return;let e=new ArrayBuffer(1);const{signal:t}=this.abortController;for(;e.byteLength>0;)this.pendingRequest=!0,await fetch(`${this.portId}/api/v1/fromradio?all=${this.receiveBatchRequests?"true":"false"}`,{signal:t,method:"GET",headers:{Accept:"application/x-protobuf"}}).then(async n=>{this.pendingRequest=!1,this.updateDeviceStatus(5),e=await n.arrayBuffer(),e.byteLength>0&&this.handleFromRadio(new Uint8Array(e))}).catch(n=>{this.pendingRequest=!1,this.log.error(ve[22],`❌ ${n.message}`),this.updateDeviceStatus(4)})}async writeToRadio(e){const{signal:t}=this.abortController;await fetch(`${this.portId}/api/v1/toradio`,{signal:t,method:"PUT",headers:{"Content-Type":"application/x-protobuf"},body:ph(e)}).then(async()=>{this.updateDeviceStatus(5),await this.readFromRadio().catch(n=>{this.log.error(ve[23],`❌ ${n.message}`)})}).catch(n=>{this.log.error(ve[23],`❌ ${n.message}`),this.updateDeviceStatus(4)})}},TP=class extends mh{connType;portId;port;readerHack;transformer;preventLock;pipePromise;onReleaseEvent;constructor(e){super(e),this.log=this.log.getSubLogger({name:"SerialConnection"}),this.connType="serial",this.portId="",this.port=void 0,this.transformer=void 0,this.onReleaseEvent=new _e.SimpleEventDispatcher,this.preventLock=!1,this.log.debug(ve[0],"🔷 SerialConnection instantiated")}async readFromRadio(e){for(this.onReleaseEvent.subscribe(async()=>{this.preventLock=!0,await e.cancel(),await this.pipePromise?.catch(()=>{}),e.releaseLock(),await this.port?.close()});this.port?.readable&&!this.preventLock;)await e.read().then(({value:t})=>{t&&this.handleFromRadio(t)}).catch(()=>{this.log.debug(ve[22],"Releasing reader")})}async getPorts(){return await navigator.serial.getPorts()}async getPort(e){return await navigator.serial.requestPort(e)}getCurrentPort(){return this.port}async connect({port:e,baudRate:t=115200,concurrentLogOutput:n=!1}){this.updateDeviceStatus(3),this.port=e??await this.getPort(),this.port.addEventListener("disconnect",()=>{this.log.info(ve[20],"Device disconnected"),this.updateDeviceStatus(2),this.complete()}),this.preventLock=!1,await this.port.open({baudRate:t}).then(()=>{if(this.port?.readable&&this.port.writable){this.transformer=tx(this.log,this.onReleaseEvent,this.events.onDeviceDebugLog,n),this.pipePromise=this.port.readable.pipeTo(this.transformer.writable);const r=this.readerHack=this.transformer.readable.getReader();this.readFromRadio(r),this.updateDeviceStatus(5),this.configure().catch(()=>{})}else console.log("not readable or writable")}).catch(r=>{this.log.error(ve[20],`❌ ${r.message}`)})}async reconnect(){await this.connect({port:this.port,concurrentLogOutput:!1})}async disconnect(){return this.preventLock=!0,await this.readerHack?.cancel(),await this.pipePromise?.catch(()=>{}),this.readerHack?.releaseLock(),this.port?.readable&&await this.port?.close(),this.updateDeviceStatus(2),this.complete(),this.port}async ping(){return await Promise.resolve(!0)}async writeToRadio(e){for(;this.port?.writable?.locked;)await new Promise(n=>setTimeout(n,100));const t=this.port?.writable?.getWriter();await t?.write(new Uint8Array([148,195,0,e.length,...e])),t?.releaseLock()}};const ca=i2((e,t)=>({devices:new Map,remoteDevices:new Map,addDevice:n=>{e(Ie(o=>{o.devices.set(n,{id:n,status:Ws.DeviceStatusEnum.DeviceDisconnected,channels:new Map,config:new pe.LocalOnly.LocalConfig,moduleConfig:new pe.LocalOnly.LocalModuleConfig,workingConfig:[],workingModuleConfig:[],hardware:new pe.Mesh.MyNodeInfo,nodes:new Map,metadata:new Map,messages:{direct:new Map,broadcast:new Map},traceroutes:new Map,connection:void 0,activePage:"messages",activeNode:0,waypoints:[],dialog:{import:!1,QR:!1,shutdown:!1,reboot:!1,deviceName:!1,nodeRemoval:!1},pendingSettingsChanges:!1,messageDraft:"",setStatus:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.status=a)}))},setConfig:a=>{e(Ie(i=>{const s=i.devices.get(n);if(s)switch(a.payloadVariant.case){case"device":{s.config.device=a.payloadVariant.value;break}case"position":{s.config.position=a.payloadVariant.value;break}case"power":{s.config.power=a.payloadVariant.value;break}case"network":{s.config.network=a.payloadVariant.value;break}case"display":{s.config.display=a.payloadVariant.value;break}case"lora":{s.config.lora=a.payloadVariant.value;break}case"bluetooth":{s.config.bluetooth=a.payloadVariant.value;break}case"security":s.config.security=a.payloadVariant.value}}))},setModuleConfig:a=>{e(Ie(i=>{const s=i.devices.get(n);if(s)switch(a.payloadVariant.case){case"mqtt":{s.moduleConfig.mqtt=a.payloadVariant.value;break}case"serial":{s.moduleConfig.serial=a.payloadVariant.value;break}case"externalNotification":{s.moduleConfig.externalNotification=a.payloadVariant.value;break}case"storeForward":{s.moduleConfig.storeForward=a.payloadVariant.value;break}case"rangeTest":{s.moduleConfig.rangeTest=a.payloadVariant.value;break}case"telemetry":{s.moduleConfig.telemetry=a.payloadVariant.value;break}case"cannedMessage":{s.moduleConfig.cannedMessage=a.payloadVariant.value;break}case"audio":{s.moduleConfig.audio=a.payloadVariant.value;break}case"neighborInfo":{s.moduleConfig.neighborInfo=a.payloadVariant.value;break}case"ambientLighting":{s.moduleConfig.ambientLighting=a.payloadVariant.value;break}case"detectionSensor":{s.moduleConfig.detectionSensor=a.payloadVariant.value;break}case"paxcounter":{s.moduleConfig.paxcounter=a.payloadVariant.value;break}}}))},setWorkingConfig:a=>{e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s?.workingConfig.findIndex(c=>c.payloadVariant.case===a.payloadVariant.case);l!==-1?s.workingConfig[l]=a:s?.workingConfig.push(a)}))},setWorkingModuleConfig:a=>{e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s?.workingModuleConfig.findIndex(c=>c.payloadVariant.case===a.payloadVariant.case);l!==-1?s.workingModuleConfig[l]=a:s?.workingModuleConfig.push(a)}))},setHardware:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.hardware=a)}))},setActivePage:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.activePage=a)}))},setPendingSettingsChanges:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.pendingSettingsChanges=a)}))},addChannel:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&s.channels.set(a.index,a)}))},addWaypoint:a=>{e(Ie(i=>{const s=i.devices.get(n);if(s){const l=s.waypoints.findIndex(c=>c.id===a.id);l!==-1?s.waypoints[l]=a:s.waypoints.push(a)}}))},addNodeInfo:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&s.nodes.set(a.num,a)}))},setActiveNode:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.activeNode=a)}))},addUser:a=>{e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s.nodes.get(a.from)??new pe.Mesh.NodeInfo;l.user=a.data,s.nodes.set(a.from,l)}))},addPosition:a=>{e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s.nodes.get(a.from)??new pe.Mesh.NodeInfo;l.position=a.data,s.nodes.set(a.from,l)}))},addConnection:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.connection=a)}))},addMessage:a=>{e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s.messages[a.type],c=a.type==="direct"?a.from===s.hardware.myNodeNum?a.to:a.from:a.channel,u=l.get(c);u?(u.push(a),l.set(c,u)):l.set(c,[a])}))},addMetadata:(a,i)=>{e(Ie(s=>{const l=s.devices.get(n);l&&l.metadata.set(a,i)}))},addTraceRoute:a=>{e(Ie(i=>{console.log("addTraceRoute called"),console.log(a);const s=i.devices.get(n);if(!s)return;const l=s.traceroutes.get(a.from);l?(l.push(a),s.traceroutes.set(a.from,l)):s.traceroutes.set(a.from,[a])}))},removeNode:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&s.nodes.delete(a)}))},setMessageState:(a,i,s,l,c,u)=>{e(Ie(d=>{console.log("setMessageState called");const p=d.devices.get(n);if(!p){console.log("no device found for id");return}const g=p.messages[a],v=a==="direct"?l===p.hardware.myNodeNum?s:l:i,h=g.get(v);if(!h){console.log("no messages found for id");return}g.set(v,h.map(_=>(_.id===c&&(_.state=u),_)))}))},setDialogOpen:(a,i)=>{e(Ie(s=>{const l=s.devices.get(n);l&&(l.dialog[a]=i)}))},processPacket(a){e(Ie(i=>{const s=i.devices.get(n);if(!s)return;const l=s.nodes.get(a.from);l?s.nodes.set(a.from,{...l,lastHeard:a.time,snr:a.snr}):s.nodes.set(a.from,new pe.Mesh.NodeInfo({num:a.from,lastHeard:a.time,snr:a.snr}))}))},setMessageDraft:a=>{e(Ie(i=>{const s=i.devices.get(n);s&&(s.messageDraft=a)}))}})}));const r=t().devices.get(n);if(!r)throw new Error("Device not found");return r},removeDevice:n=>{e(Ie(r=>{r.devices.delete(n)}))},getDevices:()=>Array.from(t().devices.values()),getDevice:n=>t().devices.get(n)})),rx=m.createContext(void 0),Te=()=>{const e=m.useContext(rx);if(e===void 0)throw new Error("useDevice must be used within a DeviceProvider");return e},EP=({children:e,device:t})=>f.jsx(rx.Provider,{value:t,children:e});function we(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}function NP(e,t){const n=m.createContext(t);function r(a){const{children:i,...s}=a,l=m.useMemo(()=>s,Object.values(s));return f.jsx(n.Provider,{value:l,children:i})}function o(a){const i=m.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return r.displayName=e+"Provider",[r,o]}function Pr(e,t=[]){let n=[];function r(a,i){const s=m.createContext(i),l=n.length;n=[...n,i];function c(d){const{scope:p,children:g,...v}=d,h=p?.[e][l]||s,_=m.useMemo(()=>v,Object.values(v));return f.jsx(h.Provider,{value:_,children:g})}function u(d,p){const g=p?.[e][l]||s,v=m.useContext(g);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return c.displayName=a+"Provider",[c,u]}const o=()=>{const a=n.map(i=>m.createContext(i));return function(s){const l=s?.[e]||a;return m.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return o.scopeName=e,[r,PP(o,...t)]}function PP(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=r.reduce((s,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...s,...d}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function MP(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ox(...e){return t=>e.forEach(n=>MP(n,t))}function $e(...e){return m.useCallback(ox(...e),e)}var Ti=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),a=o.find(RP);if(a){const i=a.props.children,s=o.map(l=>l===a?m.Children.count(i)>1?m.Children.only(null):m.isValidElement(i)?i.props.children:null:l);return f.jsx(Y0,{...r,ref:t,children:m.isValidElement(i)?m.cloneElement(i,void 0,s):null})}return f.jsx(Y0,{...r,ref:t,children:n})});Ti.displayName="Slot";var Y0=m.forwardRef((e,t)=>{const{children:n,...r}=e;if(m.isValidElement(n)){const o=OP(n);return m.cloneElement(n,{...IP(r,n.props),ref:t?ox(t,o):o})}return m.Children.count(n)>1?m.Children.only(null):null});Y0.displayName="SlotClone";var AP=({children:e})=>f.jsx(f.Fragment,{children:e});function RP(e){return m.isValidElement(e)&&e.type===AP}function IP(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...s)=>{a(...s),o(...s)}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function OP(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function hh(e){const t=e+"CollectionProvider",[n,r]=Pr(t),[o,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:v,children:h}=g,_=Ae.useRef(null),b=Ae.useRef(new Map).current;return f.jsx(o,{scope:v,itemMap:b,collectionRef:_,children:h})};i.displayName=t;const s=e+"CollectionSlot",l=Ae.forwardRef((g,v)=>{const{scope:h,children:_}=g,b=a(s,h),y=$e(v,b.collectionRef);return f.jsx(Ti,{ref:y,children:_})});l.displayName=s;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=Ae.forwardRef((g,v)=>{const{scope:h,children:_,...b}=g,y=Ae.useRef(null),x=$e(v,y),E=a(c,h);return Ae.useEffect(()=>(E.itemMap.set(y,{ref:y,...b}),()=>void E.itemMap.delete(y))),f.jsx(Ti,{[u]:"",ref:x,children:_})});d.displayName=c;function p(g){const v=a(e+"CollectionConsumer",g);return Ae.useCallback(()=>{const _=v.collectionRef.current;if(!_)return[];const b=Array.from(_.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((E,w)=>b.indexOf(E.ref.current)-b.indexOf(w.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:l,ItemSlot:d},p,r]}var Mt=globalThis?.document?m.useLayoutEffect:()=>{},DP=W1.useId||(()=>{}),LP=0;function fo(e){const[t,n]=m.useState(DP());return Mt(()=>{e||n(r=>r??String(LP++))},[e]),e||(t?`radix-${t}`:"")}var jP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],xe=jP.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:a,...i}=r,s=a?Ti:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(s,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ax(e,t){e&&an.flushSync(()=>e.dispatchEvent(t))}function Wt(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>t.current?.(...n),[])}function go({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=FP({defaultProp:t,onChange:n}),a=e!==void 0,i=a?e:r,s=Wt(n),l=m.useCallback(c=>{if(a){const d=typeof c=="function"?c(e):c;d!==e&&s(d)}else o(c)},[a,e,o,s]);return[i,l]}function FP({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),a=Wt(t);return m.useEffect(()=>{o.current!==r&&(a(r),o.current=r)},[r,o,a]),n}var BP=m.createContext(void 0);function gh(e){const t=m.useContext(BP);return e||t||"ltr"}var ff="rovingFocusGroup.onEntryFocus",$P={bubbles:!1,cancelable:!0},rd="RovingFocusGroup",[Q0,ix,UP]=hh(rd),[VP,sx]=Pr(rd,[UP]),[zP,HP]=VP(rd),lx=m.forwardRef((e,t)=>f.jsx(Q0.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Q0.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(WP,{...e,ref:t})})}));lx.displayName=rd;var WP=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,p=m.useRef(null),g=$e(t,p),v=gh(a),[h=null,_]=go({prop:i,defaultProp:s,onChange:l}),[b,y]=m.useState(!1),x=Wt(c),E=ix(n),w=m.useRef(!1),[T,k]=m.useState(0);return m.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(ff,x),()=>C.removeEventListener(ff,x)},[x]),f.jsx(zP,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:h,onItemFocus:m.useCallback(C=>_(C),[_]),onItemShiftTab:m.useCallback(()=>y(!0),[]),onFocusableItemAdd:m.useCallback(()=>k(C=>C+1),[]),onFocusableItemRemove:m.useCallback(()=>k(C=>C-1),[]),children:f.jsx(xe.div,{tabIndex:b||T===0?-1:0,"data-orientation":r,...d,ref:g,style:{outline:"none",...e.style},onMouseDown:we(e.onMouseDown,()=>{w.current=!0}),onFocus:we(e.onFocus,C=>{const P=!w.current;if(C.target===C.currentTarget&&P&&!b){const O=new CustomEvent(ff,$P);if(C.currentTarget.dispatchEvent(O),!O.defaultPrevented){const R=E().filter(G=>G.focusable),N=R.find(G=>G.active),B=R.find(G=>G.id===h),L=[N,B,...R].filter(Boolean).map(G=>G.ref.current);dx(L,u)}}w.current=!1}),onBlur:we(e.onBlur,()=>y(!1))})})}),cx="RovingFocusGroupItem",ux=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:a,...i}=e,s=fo(),l=a||s,c=HP(cx,n),u=c.currentTabStopId===l,d=ix(n),{onFocusableItemAdd:p,onFocusableItemRemove:g}=c;return m.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),f.jsx(Q0.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(xe.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...i,ref:t,onMouseDown:we(e.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:we(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:we(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const h=qP(v,c.orientation,c.dir);if(h!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let b=d().filter(y=>y.focusable).map(y=>y.ref.current);if(h==="last")b.reverse();else if(h==="prev"||h==="next"){h==="prev"&&b.reverse();const y=b.indexOf(v.currentTarget);b=c.loop?XP(b,y+1):b.slice(y+1)}setTimeout(()=>dx(b))}})})})});ux.displayName=cx;var GP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function KP(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qP(e,t,n){const r=KP(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GP[r]}function dx(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function XP(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var YP=lx,QP=ux;function ZP(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var ua=e=>{const{present:t,children:n}=e,r=JP(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),a=$e(r.ref,e4(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:a}):null};ua.displayName="Presence";function JP(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),a=m.useRef("none"),i=e?"mounted":"unmounted",[s,l]=ZP(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=Kl(r.current);a.current=s==="mounted"?c:"none"},[s]),Mt(()=>{const c=r.current,u=o.current;if(u!==e){const p=a.current,g=Kl(c);e?l("MOUNT"):g==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&p!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Mt(()=>{if(t){const c=d=>{const g=Kl(r.current).includes(d.animationName);d.target===t&&g&&an.flushSync(()=>l("ANIMATION_END"))},u=d=>{d.target===t&&(a.current=Kl(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:m.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Kl(e){return e?.animationName||"none"}function e4(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vh="Tabs",[t4,T7]=Pr(vh,[sx]),fx=sx(),[n4,yh]=t4(vh),px=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:a,orientation:i="horizontal",dir:s,activationMode:l="automatic",...c}=e,u=gh(s),[d,p]=go({prop:r,onChange:o,defaultProp:a});return f.jsx(n4,{scope:n,baseId:fo(),value:d,onValueChange:p,orientation:i,dir:u,activationMode:l,children:f.jsx(xe.div,{dir:u,"data-orientation":i,...c,ref:t})})});px.displayName=vh;var mx="TabsList",hx=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,a=yh(mx,n),i=fx(n);return f.jsx(YP,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:f.jsx(xe.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:t})})});hx.displayName=mx;var gx="TabsTrigger",vx=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...a}=e,i=yh(gx,n),s=fx(n),l=wx(i.baseId,r),c=_x(i.baseId,r),u=r===i.value;return f.jsx(QP,{asChild:!0,...s,focusable:!o,active:u,children:f.jsx(xe.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...a,ref:t,onMouseDown:we(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?i.onValueChange(r):d.preventDefault()}),onKeyDown:we(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(r)}),onFocus:we(e.onFocus,()=>{const d=i.activationMode!=="manual";!u&&!o&&d&&i.onValueChange(r)})})})});vx.displayName=gx;var yx="TabsContent",bx=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:a,...i}=e,s=yh(yx,n),l=wx(s.baseId,r),c=_x(s.baseId,r),u=r===s.value,d=m.useRef(u);return m.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),f.jsx(ua,{present:o||u,children:({present:p})=>f.jsx(xe.div,{"data-state":u?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&a})})});bx.displayName=yx;function wx(e,t){return`${e}-trigger-${t}`}function _x(e,t){return`${e}-content-${t}`}var r4=px,xx=hx,kx=vx,Cx=bx;function Sx(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;ti(a))?.classGroupId}const sy=/^\[(.+)\]$/;function i4(e){if(sy.test(e)){const t=sy.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function s4(e){const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return c4(Object.entries(e.classGroups),n).forEach(([a,i])=>{Z0(i,r,a,t)}),r}function Z0(e,t,n,r){e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:ly(t,o);a.classGroupId=n;return}if(typeof o=="function"){if(l4(o)){Z0(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([a,i])=>{Z0(i,ly(t,a),n,r)})})}function ly(e,t){let n=e;return t.split(bh).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function l4(e){return e.isThemeGetter}function c4(e,t){return t?e.map(([n,r])=>{const o=r.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([i,s])=>[t+i,s])):a);return[n,o]}):e}function u4(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;function o(a,i){n.set(a,i),t++,t>e&&(t=0,r=n,n=new Map)}return{get(a){let i=n.get(a);if(i!==void 0)return i;if((i=r.get(a))!==void 0)return o(a,i),i},set(a,i){n.has(a)?n.set(a,i):o(a,i)}}}const Ex="!";function d4(e){const t=e.separator,n=t.length===1,r=t[0],o=t.length;return function(i){const s=[];let l=0,c=0,u;for(let h=0;hc?u-c:void 0;return{modifiers:s,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:v}}}function f4(e){if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t}function p4(e){return{cache:u4(e.cacheSize),splitModifiers:d4(e),...a4(e)}}const m4=/\s+/;function h4(e,t){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,a=new Set;return e.trim().split(m4).map(i=>{const{modifiers:s,hasImportantModifier:l,baseClassName:c,maybePostfixModifierPosition:u}=n(i);let d=r(u?c.substring(0,u):c),p=!!u;if(!d){if(!u)return{isTailwindClass:!1,originalClassName:i};if(d=r(c),!d)return{isTailwindClass:!1,originalClassName:i};p=!1}const g=f4(s).join(":");return{isTailwindClass:!0,modifierId:l?g+Ex:g,classGroupId:d,originalClassName:i,hasPostfixModifier:p}}).reverse().filter(i=>{if(!i.isTailwindClass)return!0;const{modifierId:s,classGroupId:l,hasPostfixModifier:c}=i,u=s+l;return a.has(u)?!1:(a.add(u),o(l,c).forEach(d=>a.add(s+d)),!0)}).reverse().map(i=>i.originalClassName).join(" ")}function g4(){let e=0,t,n,r="";for(;ed(u),e());return n=p4(c),r=n.cache.get,o=n.cache.set,a=s,s(l)}function s(l){const c=r(l);if(c)return c;const u=h4(l,n);return o(l,u),u}return function(){return a(g4.apply(null,arguments))}}function Ve(e){const t=n=>n[e]||[];return t.isThemeGetter=!0,t}const Px=/^\[(?:([a-z-]+):)?(.+)\]$/i,y4=/^\d+\/\d+$/,b4=new Set(["px","full","screen"]),w4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,x4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,k4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,C4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function sr(e){return $o(e)||b4.has(e)||y4.test(e)}function Hr(e){return Li(e,"length",R4)}function $o(e){return!!e&&!Number.isNaN(Number(e))}function ql(e){return Li(e,"number",$o)}function Zi(e){return!!e&&Number.isInteger(Number(e))}function S4(e){return e.endsWith("%")&&$o(e.slice(0,-1))}function Se(e){return Px.test(e)}function Wr(e){return w4.test(e)}const T4=new Set(["length","size","percentage"]);function E4(e){return Li(e,T4,Mx)}function N4(e){return Li(e,"position",Mx)}const P4=new Set(["image","url"]);function M4(e){return Li(e,P4,O4)}function A4(e){return Li(e,"",I4)}function Ji(){return!0}function Li(e,t,n){const r=Px.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1}function R4(e){return _4.test(e)&&!x4.test(e)}function Mx(){return!1}function I4(e){return k4.test(e)}function O4(e){return C4.test(e)}function D4(){const e=Ve("colors"),t=Ve("spacing"),n=Ve("blur"),r=Ve("brightness"),o=Ve("borderColor"),a=Ve("borderRadius"),i=Ve("borderSpacing"),s=Ve("borderWidth"),l=Ve("contrast"),c=Ve("grayscale"),u=Ve("hueRotate"),d=Ve("invert"),p=Ve("gap"),g=Ve("gradientColorStops"),v=Ve("gradientColorStopPositions"),h=Ve("inset"),_=Ve("margin"),b=Ve("opacity"),y=Ve("padding"),x=Ve("saturate"),E=Ve("scale"),w=Ve("sepia"),T=Ve("skew"),k=Ve("space"),C=Ve("translate"),P=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto",Se,t],N=()=>[Se,t],B=()=>["",sr,Hr],D=()=>["auto",$o,Se],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],G=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],Z=()=>["","0",Se],re=()=>["auto","avoid","all","avoid-page","page","left","right","column"],fe=()=>[$o,ql],U=()=>[$o,Se];return{cacheSize:500,separator:":",theme:{colors:[Ji],spacing:[sr,Hr],blur:["none","",Wr,Se],brightness:fe(),borderColor:[e],borderRadius:["none","","full",Wr,Se],borderSpacing:N(),borderWidth:B(),contrast:fe(),grayscale:Z(),hueRotate:U(),invert:Z(),gap:N(),gradientColorStops:[e],gradientColorStopPositions:[S4,Hr],inset:R(),margin:R(),opacity:fe(),padding:N(),saturate:fe(),scale:fe(),sepia:Z(),skew:U(),space:N(),translate:N()},classGroups:{aspect:[{aspect:["auto","square","video",Se]}],container:["container"],columns:[{columns:[Wr]}],"break-after":[{"break-after":re()}],"break-before":[{"break-before":re()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...L(),Se]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Zi,Se]}],basis:[{basis:R()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Se]}],grow:[{grow:Z()}],shrink:[{shrink:Z()}],order:[{order:["first","last","none",Zi,Se]}],"grid-cols":[{"grid-cols":[Ji]}],"col-start-end":[{col:["auto",{span:["full",Zi,Se]},Se]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Ji]}],"row-start-end":[{row:["auto",{span:[Zi,Se]},Se]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Se]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Se]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[_]}],mx:[{mx:[_]}],my:[{my:[_]}],ms:[{ms:[_]}],me:[{me:[_]}],mt:[{mt:[_]}],mr:[{mr:[_]}],mb:[{mb:[_]}],ml:[{ml:[_]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Se,t]}],"min-w":[{"min-w":[Se,t,"min","max","fit"]}],"max-w":[{"max-w":[Se,t,"none","full","min","max","fit","prose",{screen:[Wr]},Wr]}],h:[{h:[Se,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Se,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Se,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Se,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Wr,Hr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ql]}],"font-family":[{font:[Ji]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Se]}],"line-clamp":[{"line-clamp":["none",$o,ql]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",sr,Se]}],"list-image":[{"list-image":["none",Se]}],"list-style-type":[{list:["none","disc","decimal",Se]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",sr,Hr]}],"underline-offset":[{"underline-offset":["auto",sr,Se]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),N4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",E4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},M4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...G(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:G()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...G()]}],"outline-offset":[{"outline-offset":[sr,Se]}],"outline-w":[{outline:[sr,Hr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[sr,Hr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Wr,A4]}],"shadow-color":[{shadow:[Ji]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wr,Se]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[x]}],sepia:[{sepia:[w]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[w]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Se]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",Se]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",Se]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Zi,Se]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Se]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Se]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Se]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[sr,Hr,ql]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const L4=v4(D4);function Ee(...e){return L4(o4(e))}const od=r4,cl=m.forwardRef(({className:e,...t},n)=>f.jsx(xx,{ref:n,className:Ee("inline-flex flex-wrap items-center rounded-md bg-slate-100 p-1 mt-2 dark:bg-slate-800",e),...t}));cl.displayName=xx.displayName;const ul=m.forwardRef(({className:e,...t},n)=>f.jsx(kx,{className:Ee("inline-flex min-w-[100px] items-center justify-center rounded-[0.185rem] px-3 py-1.5 text-sm font-medium text-slate-700 transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:text-slate-900 data-[state=active]:shadow-sm dark:text-slate-200 dark:data-[state=active]:bg-slate-900 dark:data-[state=active]:text-slate-100",e),...t,ref:n}));ul.displayName=kx.displayName;const dl=m.forwardRef(({className:e,...t},n)=>f.jsx(Cx,{className:Ee("mt-2 rounded-md border border-slate-200 p-6 dark:border-slate-700",e),...t,ref:n}));dl.displayName=Cx.displayName;function Ax(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;ttypeof e=="boolean"?"".concat(e):e===0?"0":e,uy=j4,wh=(e,t)=>n=>{var r;if(t?.variants==null)return uy(e,n?.class,n?.className);const{variants:o,defaultVariants:a}=t,i=Object.keys(o).map(c=>{const u=n?.[c],d=a?.[c];if(u===null)return null;const p=cy(u)||cy(d);return o[c][p]}),s=n&&Object.entries(n).reduce((c,u)=>{let[d,p]=u;return p===void 0||(c[d]=p),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:p,...g}=u;return Object.entries(g).every(v=>{let[h,_]=v;return Array.isArray(_)?_.includes({...a,...s}[h]):{...a,...s}[h]===_})?[...c,d,p]:c},[]);return uy(e,i,l,n?.class,n?.className)},F4=wh("flex h-10 w-full rounded-md border bg-transparent py-2 px-3 text-sm placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:text-slate-50 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900",{variants:{variant:{default:"border-slate-300 dark:border-slate-700",invalid:"border-red-500 dark:border-red-500"}},defaultVariants:{variant:"default"}}),jn=m.forwardRef(({className:e,value:t,variant:n,prefix:r,suffix:o,action:a,...i},s)=>f.jsxs("div",{className:"relative w-full",children:[r&&f.jsx("span",{className:"inline-flex items-center rounded-l-md bg-backgroundPrimary px-3 font-mono text-sm text-textSecondary brightness-hover",children:r}),f.jsx("input",{className:Ee(a&&"pr-8",e,F4({variant:n})),value:t,ref:s,...i}),o&&f.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-9 font-mono text-textSecondary",children:f.jsx("span",{className:"text-gray-500 sm:text-sm",children:o})}),a&&f.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-500 hover:text-gray-400 focus:outline-none ",onClick:a.onClick,children:f.jsx(a.icon,{size:20})})]}));jn.displayName="Input";var fl=e=>e.type==="checkbox",ri=e=>e instanceof Date,It=e=>e==null;const Rx=e=>typeof e=="object";var ft=e=>!It(e)&&!Array.isArray(e)&&Rx(e)&&!ri(e),Ix=e=>ft(e)&&e.target?fl(e.target)?e.target.checked:e.target.value:e,B4=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ox=(e,t)=>e.has(B4(t)),$4=e=>{const t=e.constructor&&e.constructor.prototype;return ft(t)&&t.hasOwnProperty("isPrototypeOf")},_h=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Bt(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(_h&&(e instanceof Blob||e instanceof FileList))&&(n||ft(e)))if(t=n?[]:{},!n&&!$4(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Bt(e[r]));else return e;return t}var pl=e=>Array.isArray(e)?e.filter(Boolean):[],et=e=>e===void 0,de=(e,t,n)=>{if(!t||!ft(e))return n;const r=pl(t.split(/[,[\].]+?/)).reduce((o,a)=>It(o)?o:o[a],e);return et(r)||r===e?et(e[t])?n:e[t]:r},Kn=e=>typeof e=="boolean",xh=e=>/^\w*$/.test(e),Dx=e=>pl(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Fe=(e,t,n)=>{let r=-1;const o=xh(t)?[t]:Dx(t),a=o.length,i=a-1;for(;++rAe.useContext(U4);var Lx=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(o,a,{get:()=>{const i=a;return t._proxyFormState[i]!==In.all&&(t._proxyFormState[i]=!r||In.all),n&&(n[i]=!0),e[i]}});return o},qt=e=>ft(e)&&!Object.keys(e).length,jx=(e,t,n,r)=>{n(e);const{name:o,...a}=e;return qt(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(i=>t[i]===(!r||In.all))},Tc=e=>Array.isArray(e)?e:[e],Fx=(e,t,n)=>!e||!t||e===t||Tc(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function Ch(e){const t=Ae.useRef(e);t.current=e,Ae.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function V4(e){const t=kh(),{control:n=t.control,disabled:r,name:o,exact:a}=e||{},[i,s]=Ae.useState(n._formState),l=Ae.useRef(!0),c=Ae.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=Ae.useRef(o);return u.current=o,Ch({disabled:r,next:d=>l.current&&Fx(u.current,d.name,a)&&jx(d,c.current,n._updateFormState)&&s({...n._formState,...d}),subject:n._subjects.state}),Ae.useEffect(()=>(l.current=!0,c.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),Lx(i,n,c.current,!1)}var Xn=e=>typeof e=="string",Bx=(e,t,n,r,o)=>Xn(e)?(r&&t.watch.add(e),de(n,e,o)):Array.isArray(e)?e.map(a=>(r&&t.watch.add(a),de(n,a))):(r&&(t.watchAll=!0),n);function $x(e){const t=kh(),{control:n=t.control,name:r,defaultValue:o,disabled:a,exact:i}=e||{},s=Ae.useRef(r);s.current=r,Ch({disabled:a,subject:n._subjects.values,next:u=>{Fx(s.current,u.name,i)&&c(Bt(Bx(s.current,n._names,u.values||n._formValues,!1,o)))}});const[l,c]=Ae.useState(n._getWatch(r,o));return Ae.useEffect(()=>n._removeUnmounted()),l}function z4(e){const t=kh(),{name:n,disabled:r,control:o=t.control,shouldUnregister:a}=e,i=Ox(o._names.array,n),s=$x({control:o,name:n,defaultValue:de(o._formValues,n,de(o._defaultValues,n,e.defaultValue)),exact:!0}),l=V4({control:o,name:n}),c=Ae.useRef(o.register(n,{...e.rules,value:s,...Kn(e.disabled)?{disabled:e.disabled}:{}}));return Ae.useEffect(()=>{const u=o._options.shouldUnregister||a,d=(p,g)=>{const v=de(o._fields,p);v&&v._f&&(v._f.mount=g)};if(d(n,!0),u){const p=Bt(de(o._options.defaultValues,n));Fe(o._defaultValues,n,p),et(de(o._formValues,n))&&Fe(o._formValues,n,p)}return()=>{(i?u&&!o._state.action:u)?o.unregister(n):d(n,!1)}},[n,o,i,a]),Ae.useEffect(()=>{de(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:de(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:s,...Kn(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:Ae.useCallback(u=>c.current.onChange({target:{value:Ix(u),name:n},type:du.CHANGE}),[n]),onBlur:Ae.useCallback(()=>c.current.onBlur({target:{value:de(o._formValues,n),name:n},type:du.BLUR}),[n,o]),ref:u=>{const d=de(o._fields,n);d&&u&&(d._f.ref={focus:()=>u.focus(),select:()=>u.select(),setCustomValidity:p=>u.setCustomValidity(p),reportValidity:()=>u.reportValidity()})}},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!de(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!de(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!de(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!de(l.validatingFields,n)},error:{enumerable:!0,get:()=>de(l.errors,n)}})}}const ml=e=>e.render(z4(e));var H4=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},dy=e=>({isOnSubmit:!e||e===In.onSubmit,isOnBlur:e===In.onBlur,isOnChange:e===In.onChange,isOnAll:e===In.all,isOnTouch:e===In.onTouched}),fy=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const ys=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const a=de(e,o);if(a){const{_f:i,...s}=a;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!r)break;if(i.ref&&t(i.ref,i.name)&&!r)break;ys(s,t)}else ft(s)&&ys(s,t)}}};var W4=(e,t,n)=>{const r=pl(de(e,n));return Fe(r,"root",t[n]),Fe(e,n,r),e},Sh=e=>e.type==="file",no=e=>typeof e=="function",fu=e=>{if(!_h)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ec=e=>Xn(e),Th=e=>e.type==="radio",pu=e=>e instanceof RegExp;const py={value:!1,isValid:!1},my={value:!0,isValid:!0};var Ux=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!et(e[0].attributes.value)?et(e[0].value)||e[0].value===""?my:{value:e[0].value,isValid:!0}:my:py}return py};const hy={isValid:!1,value:null};var Vx=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,hy):hy;function gy(e,t,n="validate"){if(Ec(e)||Array.isArray(e)&&e.every(Ec)||Kn(e)&&!e)return{type:n,message:Ec(e)?e:"",ref:t}}var Da=e=>ft(e)&&!pu(e)?e:{value:e,message:""},vy=async(e,t,n,r,o)=>{const{ref:a,refs:i,required:s,maxLength:l,minLength:c,min:u,max:d,pattern:p,validate:g,name:v,valueAsNumber:h,mount:_,disabled:b}=e._f,y=de(t,v);if(!_||b)return{};const x=i?i[0]:a,E=N=>{r&&x.reportValidity&&(x.setCustomValidity(Kn(N)?"":N||""),x.reportValidity())},w={},T=Th(a),k=fl(a),C=T||k,P=(h||Sh(a))&&et(a.value)&&et(y)||fu(a)&&a.value===""||y===""||Array.isArray(y)&&!y.length,O=H4.bind(null,v,n,w),R=(N,B,D,L=lr.maxLength,G=lr.minLength)=>{const Y=N?B:D;w[v]={type:N?L:G,message:Y,ref:a,...O(N?L:G,Y)}};if(o?!Array.isArray(y)||!y.length:s&&(!C&&(P||It(y))||Kn(y)&&!y||k&&!Ux(i).isValid||T&&!Vx(i).isValid)){const{value:N,message:B}=Ec(s)?{value:!!s,message:s}:Da(s);if(N&&(w[v]={type:lr.required,message:B,ref:x,...O(lr.required,B)},!n))return E(B),w}if(!P&&(!It(u)||!It(d))){let N,B;const D=Da(d),L=Da(u);if(!It(y)&&!isNaN(y)){const G=a.valueAsNumber||y&&+y;It(D.value)||(N=G>D.value),It(L.value)||(B=Gnew Date(new Date().toDateString()+" "+re),K=a.type=="time",Z=a.type=="week";Xn(D.value)&&y&&(N=K?Y(y)>Y(D.value):Z?y>D.value:G>new Date(D.value)),Xn(L.value)&&y&&(B=K?Y(y)+N.value,L=!It(B.value)&&y.length<+B.value;if((D||L)&&(R(D,N.message,B.message),!n))return E(w[v].message),w}if(p&&!P&&Xn(y)){const{value:N,message:B}=Da(p);if(pu(N)&&!y.match(N)&&(w[v]={type:lr.pattern,message:B,ref:a,...O(lr.pattern,B)},!n))return E(B),w}if(g){if(no(g)){const N=await g(y,t),B=gy(N,x);if(B&&(w[v]={...B,...O(lr.validate,B.message)},!n))return E(B.message),w}else if(ft(g)){let N={};for(const B in g){if(!qt(N)&&!n)break;const D=gy(await g[B](y,t),x,B);D&&(N={...D,...O(B,D.message)},E(D.message),n&&(w[v]=N))}if(!qt(N)&&(w[v]={ref:x,...N},!n))return w}}return E(!0),w};function G4(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:o=>{for(const a of e)a.next&&a.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(a=>a!==o)}}),unsubscribe:()=>{e=[]}}},mu=e=>It(e)||!Rx(e);function Uo(e,t){if(mu(e)||mu(t))return e===t;if(ri(e)&&ri(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const a=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const i=t[o];if(ri(a)&&ri(i)||ft(a)&&ft(i)||Array.isArray(a)&&Array.isArray(i)?!Uo(a,i):a!==i)return!1}}return!0}var zx=e=>e.type==="select-multiple",q4=e=>Th(e)||fl(e),mf=e=>fu(e)&&e.isConnected,Hx=e=>{for(const t in e)if(no(e[t]))return!0;return!1};function hu(e,t={}){const n=Array.isArray(e);if(ft(e)||n)for(const r in e)Array.isArray(e[r])||ft(e[r])&&!Hx(e[r])?(t[r]=Array.isArray(e[r])?[]:{},hu(e[r],t[r])):It(e[r])||(t[r]=!0);return t}function Wx(e,t,n){const r=Array.isArray(e);if(ft(e)||r)for(const o in e)Array.isArray(e[o])||ft(e[o])&&!Hx(e[o])?et(t)||mu(n[o])?n[o]=Array.isArray(e[o])?hu(e[o],[]):{...hu(e[o])}:Wx(e[o],It(t)?{}:t[o],n[o]):n[o]=!Uo(e[o],t[o]);return n}var Xl=(e,t)=>Wx(e,t,hu(t)),Gx=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>et(e)?e:t?e===""?NaN:e&&+e:n&&Xn(e)?new Date(e):r?r(e):e;function hf(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return Sh(t)?t.files:Th(t)?Vx(e.refs).value:zx(t)?[...t.selectedOptions].map(({value:n})=>n):fl(t)?Ux(e.refs).value:Gx(et(t.value)?e.ref.value:t.value,e)}var X4=(e,t,n,r)=>{const o={};for(const a of e){const i=de(t,a);i&&Fe(o,a,i._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},es=e=>et(e)?e:pu(e)?e.source:ft(e)?pu(e.value)?e.value.source:e.value:e,Y4=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function yy(e,t,n){const r=de(e,n);if(r||xh(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const a=o.join("."),i=de(t,a),s=de(e,a);if(i&&!Array.isArray(i)&&n!==a)return{name:n};if(s&&s.type)return{name:a,error:s};o.pop()}return{name:n}}var Q4=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,Z4=(e,t)=>!pl(de(e,t)).length&&ct(e,t);const J4={mode:In.onSubmit,reValidateMode:In.onChange,shouldFocusError:!0};function eM(e={}){let t={...J4,...e},n={submitCount:0,isDirty:!1,isLoading:no(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=ft(t.defaultValues)||ft(t.values)?Bt(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:Bt(o),i={action:!1,mount:!1,watch:!1},s={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:pf(),array:pf(),state:pf()},p=dy(t.mode),g=dy(t.reValidateMode),v=t.criteriaMode===In.all,h=A=>q=>{clearTimeout(c),c=setTimeout(A,q)},_=async A=>{if(u.isValid||A){const q=t.resolver?qt((await C()).errors):await O(r,!0);q!==n.isValid&&d.state.next({isValid:q})}},b=(A,q)=>{(u.isValidating||u.validatingFields)&&((A||Array.from(s.mount)).forEach(Q=>{Q&&(q?Fe(n.validatingFields,Q,q):ct(n.validatingFields,Q))}),d.state.next({validatingFields:n.validatingFields,isValidating:!qt(n.validatingFields)}))},y=(A,q=[],Q,ue,le=!0,oe=!0)=>{if(ue&&Q){if(i.action=!0,oe&&Array.isArray(de(r,A))){const me=Q(de(r,A),ue.argA,ue.argB);le&&Fe(r,A,me)}if(oe&&Array.isArray(de(n.errors,A))){const me=Q(de(n.errors,A),ue.argA,ue.argB);le&&Fe(n.errors,A,me),Z4(n.errors,A)}if(u.touchedFields&&oe&&Array.isArray(de(n.touchedFields,A))){const me=Q(de(n.touchedFields,A),ue.argA,ue.argB);le&&Fe(n.touchedFields,A,me)}u.dirtyFields&&(n.dirtyFields=Xl(o,a)),d.state.next({name:A,isDirty:N(A,q),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Fe(a,A,q)},x=(A,q)=>{Fe(n.errors,A,q),d.state.next({errors:n.errors})},E=A=>{n.errors=A,d.state.next({errors:n.errors,isValid:!1})},w=(A,q,Q,ue)=>{const le=de(r,A);if(le){const oe=de(a,A,et(Q)?de(o,A):Q);et(oe)||ue&&ue.defaultChecked||q?Fe(a,A,q?oe:hf(le._f)):L(A,oe),i.mount&&_()}},T=(A,q,Q,ue,le)=>{let oe=!1,me=!1;const ke={name:A},je=!!(de(r,A)&&de(r,A)._f&&de(r,A)._f.disabled);if(!Q||ue){u.isDirty&&(me=n.isDirty,n.isDirty=ke.isDirty=N(),oe=me!==ke.isDirty);const Ge=je||Uo(de(o,A),q);me=!!(!je&&de(n.dirtyFields,A)),Ge||je?ct(n.dirtyFields,A):Fe(n.dirtyFields,A,!0),ke.dirtyFields=n.dirtyFields,oe=oe||u.dirtyFields&&me!==!Ge}if(Q){const Ge=de(n.touchedFields,A);Ge||(Fe(n.touchedFields,A,Q),ke.touchedFields=n.touchedFields,oe=oe||u.touchedFields&&Ge!==Q)}return oe&&le&&d.state.next(ke),oe?ke:{}},k=(A,q,Q,ue)=>{const le=de(n.errors,A),oe=u.isValid&&Kn(q)&&n.isValid!==q;if(e.delayError&&Q?(l=h(()=>x(A,Q)),l(e.delayError)):(clearTimeout(c),l=null,Q?Fe(n.errors,A,Q):ct(n.errors,A)),(Q?!Uo(le,Q):le)||!qt(ue)||oe){const me={...ue,...oe&&Kn(q)?{isValid:q}:{},errors:n.errors,name:A};n={...n,...me},d.state.next(me)}},C=async A=>{b(A,!0);const q=await t.resolver(a,t.context,X4(A||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return b(A),q},P=async A=>{const{errors:q}=await C(A);if(A)for(const Q of A){const ue=de(q,Q);ue?Fe(n.errors,Q,ue):ct(n.errors,Q)}else n.errors=q;return q},O=async(A,q,Q={valid:!0})=>{for(const ue in A){const le=A[ue];if(le){const{_f:oe,...me}=le;if(oe){const ke=s.array.has(oe.name);b([ue],!0);const je=await vy(le,a,v,t.shouldUseNativeValidation&&!q,ke);if(b([ue]),je[oe.name]&&(Q.valid=!1,q))break;!q&&(de(je,oe.name)?ke?W4(n.errors,je,oe.name):Fe(n.errors,oe.name,je[oe.name]):ct(n.errors,oe.name))}me&&await O(me,q,Q)}}return Q.valid},R=()=>{for(const A of s.unMount){const q=de(r,A);q&&(q._f.refs?q._f.refs.every(Q=>!mf(Q)):!mf(q._f.ref))&&X(A)}s.unMount=new Set},N=(A,q)=>(A&&q&&Fe(a,A,q),!Uo(fe(),o)),B=(A,q,Q)=>Bx(A,s,{...i.mount?a:et(q)?o:Xn(A)?{[A]:q}:q},Q,q),D=A=>pl(de(i.mount?a:o,A,e.shouldUnregister?de(o,A,[]):[])),L=(A,q,Q={})=>{const ue=de(r,A);let le=q;if(ue){const oe=ue._f;oe&&(!oe.disabled&&Fe(a,A,Gx(q,oe)),le=fu(oe.ref)&&It(q)?"":q,zx(oe.ref)?[...oe.ref.options].forEach(me=>me.selected=le.includes(me.value)):oe.refs?fl(oe.ref)?oe.refs.length>1?oe.refs.forEach(me=>(!me.defaultChecked||!me.disabled)&&(me.checked=Array.isArray(le)?!!le.find(ke=>ke===me.value):le===me.value)):oe.refs[0]&&(oe.refs[0].checked=!!le):oe.refs.forEach(me=>me.checked=me.value===le):Sh(oe.ref)?oe.ref.value="":(oe.ref.value=le,oe.ref.type||d.values.next({name:A,values:{...a}})))}(Q.shouldDirty||Q.shouldTouch)&&T(A,le,Q.shouldTouch,Q.shouldDirty,!0),Q.shouldValidate&&re(A)},G=(A,q,Q)=>{for(const ue in q){const le=q[ue],oe=`${A}.${ue}`,me=de(r,oe);(s.array.has(A)||!mu(le)||me&&!me._f)&&!ri(le)?G(oe,le,Q):L(oe,le,Q)}},Y=(A,q,Q={})=>{const ue=de(r,A),le=s.array.has(A),oe=Bt(q);Fe(a,A,oe),le?(d.array.next({name:A,values:{...a}}),(u.isDirty||u.dirtyFields)&&Q.shouldDirty&&d.state.next({name:A,dirtyFields:Xl(o,a),isDirty:N(A,oe)})):ue&&!ue._f&&!It(oe)?G(A,oe,Q):L(A,oe,Q),fy(A,s)&&d.state.next({...n}),d.values.next({name:i.mount?A:void 0,values:{...a}})},K=async A=>{i.mount=!0;const q=A.target;let Q=q.name,ue=!0;const le=de(r,Q),oe=()=>q.type?hf(le._f):Ix(A),me=ke=>{ue=Number.isNaN(ke)||ke===de(a,Q,ke)};if(le){let ke,je;const Ge=oe(),At=A.type===du.BLUR||A.type===du.FOCUS_OUT,nr=!Y4(le._f)&&!t.resolver&&!de(n.errors,Q)&&!le._f.deps||Q4(At,de(n.touchedFields,Q),n.isSubmitted,g,p),lt=fy(Q,s,At);Fe(a,Q,Ge),At?(le._f.onBlur&&le._f.onBlur(A),l&&l(0)):le._f.onChange&&le._f.onChange(A);const Tn=T(Q,Ge,At,!1),rr=!qt(Tn)||lt;if(!At&&d.values.next({name:Q,type:A.type,values:{...a}}),nr)return u.isValid&&_(),rr&&d.state.next({name:Q,...lt?{}:Tn});if(!At&<&&d.state.next({...n}),t.resolver){const{errors:or}=await C([Q]);if(me(Ge),ue){const ar=yy(n.errors,r,Q),sn=yy(or,r,ar.name||Q);ke=sn.error,Q=sn.name,je=qt(or)}}else b([Q],!0),ke=(await vy(le,a,v,t.shouldUseNativeValidation))[Q],b([Q]),me(Ge),ue&&(ke?je=!1:u.isValid&&(je=await O(r,!0)));ue&&(le._f.deps&&re(le._f.deps),k(Q,je,ke,Tn))}},Z=(A,q)=>{if(de(n.errors,q)&&A.focus)return A.focus(),1},re=async(A,q={})=>{let Q,ue;const le=Tc(A);if(t.resolver){const oe=await P(et(A)?A:le);Q=qt(oe),ue=A?!le.some(me=>de(oe,me)):Q}else A?(ue=(await Promise.all(le.map(async oe=>{const me=de(r,oe);return await O(me&&me._f?{[oe]:me}:me)}))).every(Boolean),!(!ue&&!n.isValid)&&_()):ue=Q=await O(r);return d.state.next({...!Xn(A)||u.isValid&&Q!==n.isValid?{}:{name:A},...t.resolver||!A?{isValid:Q}:{},errors:n.errors}),q.shouldFocus&&!ue&&ys(r,Z,A?le:s.mount),ue},fe=A=>{const q={...i.mount?a:o};return et(A)?q:Xn(A)?de(q,A):A.map(Q=>de(q,Q))},U=(A,q)=>({invalid:!!de((q||n).errors,A),isDirty:!!de((q||n).dirtyFields,A),error:de((q||n).errors,A),isValidating:!!de(n.validatingFields,A),isTouched:!!de((q||n).touchedFields,A)}),ae=A=>{A&&Tc(A).forEach(q=>ct(n.errors,q)),d.state.next({errors:A?n.errors:{}})},se=(A,q,Q)=>{const ue=(de(r,A,{_f:{}})._f||{}).ref,le=de(n.errors,A)||{},{ref:oe,message:me,type:ke,...je}=le;Fe(n.errors,A,{...je,...q,ref:ue}),d.state.next({name:A,errors:n.errors,isValid:!1}),Q&&Q.shouldFocus&&ue&&ue.focus&&ue.focus()},S=(A,q)=>no(A)?d.values.subscribe({next:Q=>A(B(void 0,q),Q)}):B(A,q,!0),X=(A,q={})=>{for(const Q of A?Tc(A):s.mount)s.mount.delete(Q),s.array.delete(Q),q.keepValue||(ct(r,Q),ct(a,Q)),!q.keepError&&ct(n.errors,Q),!q.keepDirty&&ct(n.dirtyFields,Q),!q.keepTouched&&ct(n.touchedFields,Q),!q.keepIsValidating&&ct(n.validatingFields,Q),!t.shouldUnregister&&!q.keepDefaultValue&&ct(o,Q);d.values.next({values:{...a}}),d.state.next({...n,...q.keepDirty?{isDirty:N()}:{}}),!q.keepIsValid&&_()},H=({disabled:A,name:q,field:Q,fields:ue,value:le})=>{if(Kn(A)&&i.mount||A){const oe=A?void 0:et(le)?hf(Q?Q._f:de(ue,q)._f):le;Fe(a,q,oe),T(q,oe,!1,!1,!0)}},I=(A,q={})=>{let Q=de(r,A);const ue=Kn(q.disabled);return Fe(r,A,{...Q||{},_f:{...Q&&Q._f?Q._f:{ref:{name:A}},name:A,mount:!0,...q}}),s.mount.add(A),Q?H({field:Q,disabled:q.disabled,name:A,value:q.value}):w(A,!0,q.value),{...ue?{disabled:q.disabled}:{},...t.progressive?{required:!!q.required,min:es(q.min),max:es(q.max),minLength:es(q.minLength),maxLength:es(q.maxLength),pattern:es(q.pattern)}:{},name:A,onChange:K,onBlur:K,ref:le=>{if(le){I(A,q),Q=de(r,A);const oe=et(le.value)&&le.querySelectorAll&&le.querySelectorAll("input,select,textarea")[0]||le,me=q4(oe),ke=Q._f.refs||[];if(me?ke.find(je=>je===oe):oe===Q._f.ref)return;Fe(r,A,{_f:{...Q._f,...me?{refs:[...ke.filter(mf),oe,...Array.isArray(de(o,A))?[{}]:[]],ref:{type:oe.type,name:A}}:{ref:oe}}}),w(A,!1,void 0,oe)}else Q=de(r,A,{}),Q._f&&(Q._f.mount=!1),(t.shouldUnregister||q.shouldUnregister)&&!(Ox(s.array,A)&&i.action)&&s.unMount.add(A)}}},F=()=>t.shouldFocusError&&ys(r,Z,s.mount),j=A=>{Kn(A)&&(d.state.next({disabled:A}),ys(r,(q,Q)=>{const ue=de(r,Q);ue&&(q.disabled=ue._f.disabled||A,Array.isArray(ue._f.refs)&&ue._f.refs.forEach(le=>{le.disabled=ue._f.disabled||A}))},0,!1))},$=(A,q)=>async Q=>{let ue;Q&&(Q.preventDefault&&Q.preventDefault(),Q.persist&&Q.persist());let le=Bt(a);if(d.state.next({isSubmitting:!0}),t.resolver){const{errors:oe,values:me}=await C();n.errors=oe,le=me}else await O(r);if(ct(n.errors,"root"),qt(n.errors)){d.state.next({errors:{}});try{await A(le,Q)}catch(oe){ue=oe}}else q&&await q({...n.errors},Q),F(),setTimeout(F);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:qt(n.errors)&&!ue,submitCount:n.submitCount+1,errors:n.errors}),ue)throw ue},V=(A,q={})=>{de(r,A)&&(et(q.defaultValue)?Y(A,Bt(de(o,A))):(Y(A,q.defaultValue),Fe(o,A,Bt(q.defaultValue))),q.keepTouched||ct(n.touchedFields,A),q.keepDirty||(ct(n.dirtyFields,A),n.isDirty=q.defaultValue?N(A,Bt(de(o,A))):N()),q.keepError||(ct(n.errors,A),u.isValid&&_()),d.state.next({...n}))},J=(A,q={})=>{const Q=A?Bt(A):o,ue=Bt(Q),le=qt(A),oe=le?o:ue;if(q.keepDefaultValues||(o=Q),!q.keepValues){if(q.keepDirtyValues)for(const me of s.mount)de(n.dirtyFields,me)?Fe(oe,me,de(a,me)):Y(me,de(oe,me));else{if(_h&&et(A))for(const me of s.mount){const ke=de(r,me);if(ke&&ke._f){const je=Array.isArray(ke._f.refs)?ke._f.refs[0]:ke._f.ref;if(fu(je)){const Ge=je.closest("form");if(Ge){Ge.reset();break}}}}r={}}a=e.shouldUnregister?q.keepDefaultValues?Bt(o):{}:Bt(oe),d.array.next({values:{...oe}}),d.values.next({values:{...oe}})}s={mount:q.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!q.keepIsValid||!!q.keepDirtyValues,i.watch=!!e.shouldUnregister,d.state.next({submitCount:q.keepSubmitCount?n.submitCount:0,isDirty:le?!1:q.keepDirty?n.isDirty:!!(q.keepDefaultValues&&!Uo(A,o)),isSubmitted:q.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:le?[]:q.keepDirtyValues?q.keepDefaultValues&&a?Xl(o,a):n.dirtyFields:q.keepDefaultValues&&A?Xl(o,A):q.keepDirty?n.dirtyFields:{},touchedFields:q.keepTouched?n.touchedFields:{},errors:q.keepErrors?n.errors:{},isSubmitSuccessful:q.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},ee=(A,q)=>J(no(A)?A(a):A,q);return{control:{register:I,unregister:X,getFieldState:U,handleSubmit:$,setError:se,_executeSchema:C,_getWatch:B,_getDirty:N,_updateValid:_,_removeUnmounted:R,_updateFieldArray:y,_updateDisabledField:H,_getFieldArray:D,_reset:J,_resetDefaultValues:()=>no(t.defaultValues)&&t.defaultValues().then(A=>{ee(A,t.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:A=>{n={...n,...A}},_disableForm:j,_subjects:d,_proxyFormState:u,_setErrors:E,get _fields(){return r},get _formValues(){return a},get _state(){return i},set _state(A){i=A},get _defaultValues(){return o},get _names(){return s},set _names(A){s=A},get _formState(){return n},set _formState(A){n=A},get _options(){return t},set _options(A){t={...t,...A}}},trigger:re,register:I,handleSubmit:$,watch:S,setValue:Y,getValues:fe,reset:ee,resetField:V,clearErrors:ae,unregister:X,setError:se,setFocus:(A,q={})=>{const Q=de(r,A),ue=Q&&Q._f;if(ue){const le=ue.refs?ue.refs[0]:ue.ref;le.focus&&(le.focus(),q.shouldSelect&&le.select())}},getFieldState:U}}function Eh(e={}){const t=Ae.useRef(),n=Ae.useRef(),[r,o]=Ae.useState({isDirty:!1,isValidating:!1,isLoading:no(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:no(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...eM(e),formState:r});const a=t.current.control;return a._options=e,Ch({subject:a._subjects.state,next:i=>{jx(i,a._proxyFormState,a._updateFormState,!0)&&o({...a._formState})}}),Ae.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),Ae.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==r.isDirty&&a._subjects.state.next({isDirty:i})}},[a,r.isDirty]),Ae.useEffect(()=>{e.values&&!Uo(e.values,n.current)?(a._reset(e.values,a._options.resetOptions),n.current=e.values,o(i=>({...i}))):a._resetDefaultValues()},[e.values,a]),Ae.useEffect(()=>{e.errors&&a._setErrors(e.errors)},[e.errors,a]),Ae.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),Ae.useEffect(()=>{e.shouldUnregister&&a._subjects.values.next({values:a._getWatch()})},[e.shouldUnregister,a]),t.current.formState=Lx(r,a),t.current}function tM({control:e,disabled:t,field:n}){return f.jsx(ml,{name:n.name,control:e,render:({field:{value:r,onChange:o,...a}})=>f.jsx(jn,{type:n.type,step:n.properties?.step,value:n.type==="number"?Number.parseFloat(r):r,onChange:i=>{n.inputChange&&n.inputChange(i),o(n.type==="number"?Number.parseFloat(i.target.value):i.target.value)},...n.properties,...a,disabled:t})})}const nM=wh("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 dark:hover:bg-slate-800 dark:hover:text-slate-100 disabled:opacity-50 dark:focus:ring-slate-400 disabled:pointer-events-none dark:focus:ring-offset-slate-900 data-[state=open]:bg-slate-100 dark:data-[state=open]:bg-slate-800",{variants:{variant:{default:"bg-slate-900 text-white hover:bg-slate-700 dark:bg-slate-50 dark:text-slate-900",destructive:"bg-red-500 text-white hover:bg-red-600 dark:hover:bg-red-600",success:"bg-green-500 text-white hover:bg-green-600 dark:hover:bg-green-600",outline:"bg-transparent border border-slate-200 hover:bg-slate-100 dark:border-slate-700 dark:text-slate-100",subtle:"bg-slate-100 text-slate-900 hover:bg-slate-200 dark:bg-slate-700 dark:text-slate-100",ghost:"bg-transparent hover:bg-slate-100 dark:hover:bg-slate-800 dark:text-slate-100 dark:hover:text-slate-100 data-[state=open]:bg-transparent dark:data-[state=open]:bg-transparent",link:"bg-transparent underline-offset-4 hover:underline text-slate-900 dark:text-slate-100 hover:bg-transparent dark:hover:bg-transparent"},size:{default:"h-10 py-2 px-4",sm:"h-9 px-2 rounded-md",lg:"h-11 px-8 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),pt=m.forwardRef(({className:e,variant:t,size:n,...r},o)=>f.jsx("button",{type:"button",className:Ee(nM({variant:t,size:n,className:e})),ref:o,...r}));pt.displayName="Button";function by(e,[t,n]){return Math.min(n,Math.max(t,e))}function rM(e,t=globalThis?.document){const n=Wt(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var oM="DismissableLayer",J0="dismissableLayer.update",aM="dismissableLayer.pointerDownOutside",iM="dismissableLayer.focusOutside",wy,Kx=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ad=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:s,...l}=e,c=m.useContext(Kx),[u,d]=m.useState(null),p=u?.ownerDocument??globalThis?.document,[,g]=m.useState({}),v=$e(t,k=>d(k)),h=Array.from(c.layers),[_]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(_),y=u?h.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,E=y>=b,w=lM(k=>{const C=k.target,P=[...c.branches].some(O=>O.contains(C));!E||P||(o?.(k),i?.(k),k.defaultPrevented||s?.())},p),T=cM(k=>{const C=k.target;[...c.branches].some(O=>O.contains(C))||(a?.(k),i?.(k),k.defaultPrevented||s?.())},p);return rM(k=>{y===c.layers.size-1&&(r?.(k),!k.defaultPrevented&&s&&(k.preventDefault(),s()))},p),m.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(wy=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),_y(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=wy)}},[u,p,n,c]),m.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),_y())},[u,c]),m.useEffect(()=>{const k=()=>g({});return document.addEventListener(J0,k),()=>document.removeEventListener(J0,k)},[]),f.jsx(xe.div,{...l,ref:v,style:{pointerEvents:x?E?"auto":"none":void 0,...e.style},onFocusCapture:we(e.onFocusCapture,T.onFocusCapture),onBlurCapture:we(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:we(e.onPointerDownCapture,w.onPointerDownCapture)})});ad.displayName=oM;var sM="DismissableLayerBranch",qx=m.forwardRef((e,t)=>{const n=m.useContext(Kx),r=m.useRef(null),o=$e(t,r);return m.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),f.jsx(xe.div,{...e,ref:o})});qx.displayName=sM;function lM(e,t=globalThis?.document){const n=Wt(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let l=function(){Xx(aM,n,c,{discrete:!0})};const c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function cM(e,t=globalThis?.document){const n=Wt(e),r=m.useRef(!1);return m.useEffect(()=>{const o=a=>{a.target&&!r.current&&Xx(iM,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function _y(){const e=new CustomEvent(J0);document.dispatchEvent(e)}function Xx(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ax(o,a):o.dispatchEvent(a)}var uM=ad,dM=qx,gf=0;function Yx(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??xy()),document.body.insertAdjacentElement("beforeend",e[1]??xy()),gf++,()=>{gf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),gf--}},[])}function xy(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var vf="focusScope.autoFocusOnMount",yf="focusScope.autoFocusOnUnmount",ky={bubbles:!1,cancelable:!0},fM="FocusScope",Nh=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[s,l]=m.useState(null),c=Wt(o),u=Wt(a),d=m.useRef(null),p=$e(t,h=>l(h)),g=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let h=function(x){if(g.paused||!s)return;const E=x.target;s.contains(E)?d.current=E:Kr(d.current,{select:!0})},_=function(x){if(g.paused||!s)return;const E=x.relatedTarget;E!==null&&(s.contains(E)||Kr(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const w of x)w.removedNodes.length>0&&Kr(s)};document.addEventListener("focusin",h),document.addEventListener("focusout",_);const y=new MutationObserver(b);return s&&y.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",_),y.disconnect()}}},[r,s,g.paused]),m.useEffect(()=>{if(s){Sy.add(g);const h=document.activeElement;if(!s.contains(h)){const b=new CustomEvent(vf,ky);s.addEventListener(vf,c),s.dispatchEvent(b),b.defaultPrevented||(pM(yM(Qx(s)),{select:!0}),document.activeElement===h&&Kr(s))}return()=>{s.removeEventListener(vf,c),setTimeout(()=>{const b=new CustomEvent(yf,ky);s.addEventListener(yf,u),s.dispatchEvent(b),b.defaultPrevented||Kr(h??document.body,{select:!0}),s.removeEventListener(yf,u),Sy.remove(g)},0)}}},[s,c,u,g]);const v=m.useCallback(h=>{if(!n&&!r||g.paused)return;const _=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(_&&b){const y=h.currentTarget,[x,E]=mM(y);x&&E?!h.shiftKey&&b===E?(h.preventDefault(),n&&Kr(x,{select:!0})):h.shiftKey&&b===x&&(h.preventDefault(),n&&Kr(E,{select:!0})):b===y&&h.preventDefault()}},[n,r,g.paused]);return f.jsx(xe.div,{tabIndex:-1,...i,ref:p,onKeyDown:v})});Nh.displayName=fM;function pM(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kr(r,{select:t}),document.activeElement!==n)return}function mM(e){const t=Qx(e),n=Cy(t,e),r=Cy(t.reverse(),e);return[n,r]}function Qx(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Cy(e,t){for(const n of e)if(!hM(n,{upTo:t}))return n}function hM(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function gM(e){return e instanceof HTMLInputElement&&"select"in e}function Kr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&gM(e)&&t&&e.select()}}var Sy=vM();function vM(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ty(e,t),e.unshift(t)},remove(t){e=Ty(e,t),e[0]?.resume()}}}function Ty(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yM(e){return e.filter(t=>t.tagName!=="A")}const bM=["top","right","bottom","left"],Yn=Math.min,Yt=Math.max,gu=Math.round,Yl=Math.floor,vo=e=>({x:e,y:e}),wM={left:"right",right:"left",bottom:"top",top:"bottom"},_M={start:"end",end:"start"};function ep(e,t,n){return Yt(e,Yn(t,n))}function Tr(e,t){return typeof e=="function"?e(t):e}function Er(e){return e.split("-")[0]}function ji(e){return e.split("-")[1]}function Ph(e){return e==="x"?"y":"x"}function Mh(e){return e==="y"?"height":"width"}function yo(e){return["top","bottom"].includes(Er(e))?"y":"x"}function Ah(e){return Ph(yo(e))}function xM(e,t,n){n===void 0&&(n=!1);const r=ji(e),o=Ah(e),a=Mh(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=vu(i)),[i,vu(i)]}function kM(e){const t=vu(e);return[tp(e),t,tp(t)]}function tp(e){return e.replace(/start|end/g,t=>_M[t])}function CM(e,t,n){const r=["left","right"],o=["right","left"],a=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?a:i;default:return[]}}function SM(e,t,n,r){const o=ji(e);let a=CM(Er(e),n==="start",r);return o&&(a=a.map(i=>i+"-"+o),t&&(a=a.concat(a.map(tp)))),a}function vu(e){return e.replace(/left|right|bottom|top/g,t=>wM[t])}function TM(e){return{top:0,right:0,bottom:0,left:0,...e}}function Zx(e){return typeof e!="number"?TM(e):{top:e,right:e,bottom:e,left:e}}function yu(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ey(e,t,n){let{reference:r,floating:o}=e;const a=yo(t),i=Ah(t),s=Mh(i),l=Er(t),c=a==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[s]/2-o[s]/2;let g;switch(l){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:d};break;case"left":g={x:r.x-o.width,y:d};break;default:g={x:r.x,y:r.y}}switch(ji(t)){case"start":g[i]-=p*(n&&c?-1:1);break;case"end":g[i]+=p*(n&&c?-1:1);break}return g}const EM=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:i}=n,s=a.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Ey(c,r,l),p=r,g={},v=0;for(let h=0;h({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:i,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=Tr(e,t)||{};if(c==null)return{};const d=Zx(u),p={x:n,y:r},g=Ah(o),v=Mh(g),h=await i.getDimensions(c),_=g==="y",b=_?"top":"left",y=_?"bottom":"right",x=_?"clientHeight":"clientWidth",E=a.reference[v]+a.reference[g]-p[g]-a.floating[v],w=p[g]-a.reference[g],T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let k=T?T[x]:0;(!k||!await(i.isElement==null?void 0:i.isElement(T)))&&(k=s.floating[x]||a.floating[v]);const C=E/2-w/2,P=k/2-h[v]/2-1,O=Yn(d[b],P),R=Yn(d[y],P),N=O,B=k-h[v]-R,D=k/2-h[v]/2+C,L=ep(N,D,B),G=!l.arrow&&ji(o)!=null&&D!==L&&a.reference[v]/2-(DD<=0)){var R,N;const D=(((R=a.flip)==null?void 0:R.index)||0)+1,L=k[D];if(L)return{data:{index:D,overflows:O},reset:{placement:L}};let G=(N=O.filter(Y=>Y.overflows[0]<=0).sort((Y,K)=>Y.overflows[1]-K.overflows[1])[0])==null?void 0:N.placement;if(!G)switch(g){case"bestFit":{var B;const Y=(B=O.filter(K=>{if(T){const Z=yo(K.placement);return Z===y||Z==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(Z=>Z>0).reduce((Z,re)=>Z+re,0)]).sort((K,Z)=>K[1]-Z[1])[0])==null?void 0:B[0];Y&&(G=Y);break}case"initialPlacement":G=s;break}if(o!==G)return{reset:{placement:G}}}return{}}}};function Ny(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Py(e){return bM.some(t=>e[t]>=0)}const MM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Tr(e,t);switch(r){case"referenceHidden":{const a=await Gs(t,{...o,elementContext:"reference"}),i=Ny(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Py(i)}}}case"escaped":{const a=await Gs(t,{...o,altBoundary:!0}),i=Ny(a,n.floating);return{data:{escapedOffsets:i,escaped:Py(i)}}}default:return{}}}}};async function AM(e,t){const{placement:n,platform:r,elements:o}=e,a=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Er(n),s=ji(n),l=yo(n)==="y",c=["left","top"].includes(i)?-1:1,u=a&&l?-1:1,d=Tr(t,e);let{mainAxis:p,crossAxis:g,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&typeof v=="number"&&(g=s==="end"?v*-1:v),l?{x:g*u,y:p*c}:{x:p*c,y:g*u}}const RM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:i,middlewareData:s}=t,l=await AM(t,e);return i===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:a+l.y,data:{...l,placement:i}}}}},IM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:s={fn:_=>{let{x:b,y}=_;return{x:b,y}}},...l}=Tr(e,t),c={x:n,y:r},u=await Gs(t,l),d=yo(Er(o)),p=Ph(d);let g=c[p],v=c[d];if(a){const _=p==="y"?"top":"left",b=p==="y"?"bottom":"right",y=g+u[_],x=g-u[b];g=ep(y,g,x)}if(i){const _=d==="y"?"top":"left",b=d==="y"?"bottom":"right",y=v+u[_],x=v-u[b];v=ep(y,v,x)}const h=s.fn({...t,[p]:g,[d]:v});return{...h,data:{x:h.x-n,y:h.y-r}}}}},OM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:i}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=Tr(e,t),u={x:n,y:r},d=yo(o),p=Ph(d);let g=u[p],v=u[d];const h=Tr(s,t),_=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const x=p==="y"?"height":"width",E=a.reference[p]-a.floating[x]+_.mainAxis,w=a.reference[p]+a.reference[x]-_.mainAxis;gw&&(g=w)}if(c){var b,y;const x=p==="y"?"width":"height",E=["top","left"].includes(Er(o)),w=a.reference[d]-a.floating[x]+(E&&((b=i.offset)==null?void 0:b[d])||0)+(E?0:_.crossAxis),T=a.reference[d]+a.reference[x]+(E?0:((y=i.offset)==null?void 0:y[d])||0)-(E?_.crossAxis:0);vT&&(v=T)}return{[p]:g,[d]:v}}}},DM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:a}=t,{apply:i=()=>{},...s}=Tr(e,t),l=await Gs(t,s),c=Er(n),u=ji(n),d=yo(n)==="y",{width:p,height:g}=r.floating;let v,h;c==="top"||c==="bottom"?(v=c,h=u===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(h=c,v=u==="end"?"top":"bottom");const _=g-l.top-l.bottom,b=p-l.left-l.right,y=Yn(g-l[v],_),x=Yn(p-l[h],b),E=!t.middlewareData.shift;let w=y,T=x;if(d?T=u||E?Yn(x,b):b:w=u||E?Yn(y,_):_,E&&!u){const C=Yt(l.left,0),P=Yt(l.right,0),O=Yt(l.top,0),R=Yt(l.bottom,0);d?T=p-2*(C!==0||P!==0?C+P:Yt(l.left,l.right)):w=g-2*(O!==0||R!==0?O+R:Yt(l.top,l.bottom))}await i({...t,availableWidth:T,availableHeight:w});const k=await o.getDimensions(a.floating);return p!==k.width||g!==k.height?{reset:{rects:!0}}:{}}}};function Fi(e){return Jx(e)?(e.nodeName||"").toLowerCase():"#document"}function en(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mr(e){var t;return(t=(Jx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Jx(e){return e instanceof Node||e instanceof en(e).Node}function Jn(e){return e instanceof Element||e instanceof en(e).Element}function er(e){return e instanceof HTMLElement||e instanceof en(e).HTMLElement}function My(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof en(e).ShadowRoot}function hl(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Fn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function LM(e){return["table","td","th"].includes(Fi(e))}function id(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Rh(e){const t=Ih(),n=Fn(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function jM(e){let t=bo(e);for(;er(t)&&!Ei(t);){if(id(t))return null;if(Rh(t))return t;t=bo(t)}return null}function Ih(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ei(e){return["html","body","#document"].includes(Fi(e))}function Fn(e){return en(e).getComputedStyle(e)}function sd(e){return Jn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function bo(e){if(Fi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||My(e)&&e.host||Mr(e);return My(t)?t.host:t}function ek(e){const t=bo(e);return Ei(t)?e.ownerDocument?e.ownerDocument.body:e.body:er(t)&&hl(t)?t:ek(t)}function Ks(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ek(e),a=o===((r=e.ownerDocument)==null?void 0:r.body),i=en(o);return a?t.concat(i,i.visualViewport||[],hl(o)?o:[],i.frameElement&&n?Ks(i.frameElement):[]):t.concat(o,Ks(o,[],n))}function tk(e){const t=Fn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=er(e),a=o?e.offsetWidth:n,i=o?e.offsetHeight:r,s=gu(n)!==a||gu(r)!==i;return s&&(n=a,r=i),{width:n,height:r,$:s}}function Oh(e){return Jn(e)?e:e.contextElement}function fi(e){const t=Oh(e);if(!er(t))return vo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=tk(t);let i=(a?gu(n.width):n.width)/r,s=(a?gu(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const FM=vo(0);function nk(e){const t=en(e);return!Ih()||!t.visualViewport?FM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function BM(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==en(e)?!1:t}function ta(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=Oh(e);let i=vo(1);t&&(r?Jn(r)&&(i=fi(r)):i=fi(e));const s=BM(a,n,r)?nk(a):vo(0);let l=(o.left+s.x)/i.x,c=(o.top+s.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(a){const p=en(a),g=r&&Jn(r)?en(r):r;let v=p,h=v.frameElement;for(;h&&r&&g!==v;){const _=fi(h),b=h.getBoundingClientRect(),y=Fn(h),x=b.left+(h.clientLeft+parseFloat(y.paddingLeft))*_.x,E=b.top+(h.clientTop+parseFloat(y.paddingTop))*_.y;l*=_.x,c*=_.y,u*=_.x,d*=_.y,l+=x,c+=E,v=en(h),h=v.frameElement}}return yu({width:u,height:d,x:l,y:c})}function $M(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a=o==="fixed",i=Mr(r),s=t?id(t.floating):!1;if(r===i||s&&a)return n;let l={scrollLeft:0,scrollTop:0},c=vo(1);const u=vo(0),d=er(r);if((d||!d&&!a)&&((Fi(r)!=="body"||hl(i))&&(l=sd(r)),er(r))){const p=ta(r);c=fi(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function UM(e){return Array.from(e.getClientRects())}function rk(e){return ta(Mr(e)).left+sd(e).scrollLeft}function VM(e){const t=Mr(e),n=sd(e),r=e.ownerDocument.body,o=Yt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Yt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+rk(e);const s=-n.scrollTop;return Fn(r).direction==="rtl"&&(i+=Yt(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:i,y:s}}function zM(e,t){const n=en(e),r=Mr(e),o=n.visualViewport;let a=r.clientWidth,i=r.clientHeight,s=0,l=0;if(o){a=o.width,i=o.height;const c=Ih();(!c||c&&t==="fixed")&&(s=o.offsetLeft,l=o.offsetTop)}return{width:a,height:i,x:s,y:l}}function HM(e,t){const n=ta(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=er(e)?fi(e):vo(1),i=e.clientWidth*a.x,s=e.clientHeight*a.y,l=o*a.x,c=r*a.y;return{width:i,height:s,x:l,y:c}}function Ay(e,t,n){let r;if(t==="viewport")r=zM(e,n);else if(t==="document")r=VM(Mr(e));else if(Jn(t))r=HM(t,n);else{const o=nk(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return yu(r)}function ok(e,t){const n=bo(e);return n===t||!Jn(n)||Ei(n)?!1:Fn(n).position==="fixed"||ok(n,t)}function WM(e,t){const n=t.get(e);if(n)return n;let r=Ks(e,[],!1).filter(s=>Jn(s)&&Fi(s)!=="body"),o=null;const a=Fn(e).position==="fixed";let i=a?bo(e):e;for(;Jn(i)&&!Ei(i);){const s=Fn(i),l=Rh(i);!l&&s.position==="fixed"&&(o=null),(a?!l&&!o:!l&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||hl(i)&&!l&&ok(e,i))?r=r.filter(u=>u!==i):o=s,i=bo(i)}return t.set(e,r),r}function GM(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?id(t)?[]:WM(t,this._c):[].concat(n),r],s=i[0],l=i.reduce((c,u)=>{const d=Ay(t,u,o);return c.top=Yt(d.top,c.top),c.right=Yn(d.right,c.right),c.bottom=Yn(d.bottom,c.bottom),c.left=Yt(d.left,c.left),c},Ay(t,s,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function KM(e){const{width:t,height:n}=tk(e);return{width:t,height:n}}function qM(e,t,n){const r=er(t),o=Mr(t),a=n==="fixed",i=ta(e,!0,a,t);let s={scrollLeft:0,scrollTop:0};const l=vo(0);if(r||!r&&!a)if((Fi(t)!=="body"||hl(o))&&(s=sd(t)),r){const d=ta(t,!0,a,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else o&&(l.x=rk(o));const c=i.left+s.scrollLeft-l.x,u=i.top+s.scrollTop-l.y;return{x:c,y:u,width:i.width,height:i.height}}function bf(e){return Fn(e).position==="static"}function Ry(e,t){return!er(e)||Fn(e).position==="fixed"?null:t?t(e):e.offsetParent}function ak(e,t){const n=en(e);if(id(e))return n;if(!er(e)){let o=bo(e);for(;o&&!Ei(o);){if(Jn(o)&&!bf(o))return o;o=bo(o)}return n}let r=Ry(e,t);for(;r&&LM(r)&&bf(r);)r=Ry(r,t);return r&&Ei(r)&&bf(r)&&!Rh(r)?n:r||jM(e)||n}const XM=async function(e){const t=this.getOffsetParent||ak,n=this.getDimensions,r=await n(e.floating);return{reference:qM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function YM(e){return Fn(e).direction==="rtl"}const QM={convertOffsetParentRelativeRectToViewportRelativeRect:$M,getDocumentElement:Mr,getClippingRect:GM,getOffsetParent:ak,getElementRects:XM,getClientRects:UM,getDimensions:KM,getScale:fi,isElement:Jn,isRTL:YM};function ZM(e,t){let n=null,r;const o=Mr(e);function a(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function i(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),a();const{left:c,top:u,width:d,height:p}=e.getBoundingClientRect();if(s||t(),!d||!p)return;const g=Yl(u),v=Yl(o.clientWidth-(c+d)),h=Yl(o.clientHeight-(u+p)),_=Yl(c),y={rootMargin:-g+"px "+-v+"px "+-h+"px "+-_+"px",threshold:Yt(0,Yn(1,l))||1};let x=!0;function E(w){const T=w[0].intersectionRatio;if(T!==l){if(!x)return i();T?i(!1,T):r=setTimeout(()=>{i(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(E,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,y)}n.observe(e)}return i(!0),a}function JM(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Oh(e),u=o||a?[...c?Ks(c):[],...Ks(t)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),a&&b.addEventListener("resize",n)});const d=c&&s?ZM(c,n):null;let p=-1,g=null;i&&(g=new ResizeObserver(b=>{let[y]=b;y&&y.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=g)==null||x.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let v,h=l?ta(e):null;l&&_();function _(){const b=ta(e);h&&(b.x!==h.x||b.y!==h.y||b.width!==h.width||b.height!==h.height)&&n(),h=b,v=requestAnimationFrame(_)}return n(),()=>{var b;u.forEach(y=>{o&&y.removeEventListener("scroll",n),a&&y.removeEventListener("resize",n)}),d?.(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const eA=RM,tA=IM,nA=PM,rA=DM,oA=MM,Iy=NM,aA=OM,iA=(e,t,n)=>{const r=new Map,o={platform:QM,...n},a={...o.platform,_c:r};return EM(e,t,{...o,platform:a})};var Nc=typeof document<"u"?m.useLayoutEffect:m.useEffect;function bu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bu(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const a=o[r];if(!(a==="_owner"&&e.$$typeof)&&!bu(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function ik(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Oy(e,t){const n=ik(e);return Math.round(t*n)/n}function Dy(e){const t=m.useRef(e);return Nc(()=>{t.current=e}),t}function sA(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:a,floating:i}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,g]=m.useState(r);bu(p,r)||g(r);const[v,h]=m.useState(null),[_,b]=m.useState(null),y=m.useCallback(Y=>{Y!==T.current&&(T.current=Y,h(Y))},[]),x=m.useCallback(Y=>{Y!==k.current&&(k.current=Y,b(Y))},[]),E=a||v,w=i||_,T=m.useRef(null),k=m.useRef(null),C=m.useRef(u),P=l!=null,O=Dy(l),R=Dy(o),N=m.useCallback(()=>{if(!T.current||!k.current)return;const Y={placement:t,strategy:n,middleware:p};R.current&&(Y.platform=R.current),iA(T.current,k.current,Y).then(K=>{const Z={...K,isPositioned:!0};B.current&&!bu(C.current,Z)&&(C.current=Z,an.flushSync(()=>{d(Z)}))})},[p,t,n,R]);Nc(()=>{c===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(Y=>({...Y,isPositioned:!1})))},[c]);const B=m.useRef(!1);Nc(()=>(B.current=!0,()=>{B.current=!1}),[]),Nc(()=>{if(E&&(T.current=E),w&&(k.current=w),E&&w){if(O.current)return O.current(E,w,N);N()}},[E,w,N,O,P]);const D=m.useMemo(()=>({reference:T,floating:k,setReference:y,setFloating:x}),[y,x]),L=m.useMemo(()=>({reference:E,floating:w}),[E,w]),G=m.useMemo(()=>{const Y={position:n,left:0,top:0};if(!L.floating)return Y;const K=Oy(L.floating,u.x),Z=Oy(L.floating,u.y);return s?{...Y,transform:"translate("+K+"px, "+Z+"px)",...ik(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:Z}},[n,s,L.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:N,refs:D,elements:L,floatingStyles:G}),[u,N,D,L,G])}const lA=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Iy({element:r.current,padding:o}).fn(n):{}:r?Iy({element:r,padding:o}).fn(n):{}}}},cA=(e,t)=>({...eA(e),options:[e,t]}),uA=(e,t)=>({...tA(e),options:[e,t]}),dA=(e,t)=>({...aA(e),options:[e,t]}),fA=(e,t)=>({...nA(e),options:[e,t]}),pA=(e,t)=>({...rA(e),options:[e,t]}),mA=(e,t)=>({...oA(e),options:[e,t]}),hA=(e,t)=>({...lA(e),options:[e,t]});var gA="Arrow",sk=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...a}=e;return f.jsx(xe.svg,{...a,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});sk.displayName=gA;var vA=sk;function Dh(e){const[t,n]=m.useState(void 0);return Mt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let i,s;if("borderBoxSize"in a){const l=a.borderBoxSize,c=Array.isArray(l)?l[0]:l;i=c.inlineSize,s=c.blockSize}else i=e.offsetWidth,s=e.offsetHeight;n({width:i,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Lh="Popper",[lk,ck]=Pr(Lh),[yA,uk]=lk(Lh),dk=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return f.jsx(yA,{scope:t,anchor:r,onAnchorChange:o,children:n})};dk.displayName=Lh;var fk="PopperAnchor",pk=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,a=uk(fk,n),i=m.useRef(null),s=$e(t,i);return m.useEffect(()=>{a.onAnchorChange(r?.current||i.current)}),r?null:f.jsx(xe.div,{...o,ref:s})});pk.displayName=fk;var jh="PopperContent",[bA,wA]=lk(jh),mk=m.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:i=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:v,...h}=e,_=uk(jh,n),[b,y]=m.useState(null),x=$e(t,H=>y(H)),[E,w]=m.useState(null),T=Dh(E),k=T?.width??0,C=T?.height??0,P=r+(a!=="center"?"-"+a:""),O=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},R=Array.isArray(c)?c:[c],N=R.length>0,B={padding:O,boundary:R.filter(xA),altBoundary:N},{refs:D,floatingStyles:L,placement:G,isPositioned:Y,middlewareData:K}=sA({strategy:"fixed",placement:P,whileElementsMounted:(...H)=>JM(...H,{animationFrame:g==="always"}),elements:{reference:_.anchor},middleware:[cA({mainAxis:o+C,alignmentAxis:i}),l&&uA({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?dA():void 0,...B}),l&&fA({...B}),pA({...B,apply:({elements:H,rects:I,availableWidth:F,availableHeight:j})=>{const{width:$,height:V}=I.reference,J=H.floating.style;J.setProperty("--radix-popper-available-width",`${F}px`),J.setProperty("--radix-popper-available-height",`${j}px`),J.setProperty("--radix-popper-anchor-width",`${$}px`),J.setProperty("--radix-popper-anchor-height",`${V}px`)}}),E&&hA({element:E,padding:s}),kA({arrowWidth:k,arrowHeight:C}),p&&mA({strategy:"referenceHidden",...B})]}),[Z,re]=vk(G),fe=Wt(v);Mt(()=>{Y&&fe?.()},[Y,fe]);const U=K.arrow?.x,ae=K.arrow?.y,se=K.arrow?.centerOffset!==0,[S,X]=m.useState();return Mt(()=>{b&&X(window.getComputedStyle(b).zIndex)},[b]),f.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:Y?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:S,"--radix-popper-transform-origin":[K.transformOrigin?.x,K.transformOrigin?.y].join(" "),...K.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(bA,{scope:n,placedSide:Z,onArrowChange:w,arrowX:U,arrowY:ae,shouldHideArrow:se,children:f.jsx(xe.div,{"data-side":Z,"data-align":re,...h,ref:x,style:{...h.style,animation:Y?void 0:"none"}})})})});mk.displayName=jh;var hk="PopperArrow",_A={top:"bottom",right:"left",bottom:"top",left:"right"},gk=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,a=wA(hk,r),i=_A[a.placedSide];return f.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:f.jsx(vA,{...o,ref:n,style:{...o.style,display:"block"}})})});gk.displayName=hk;function xA(e){return e!==null}var kA=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,s=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[c,u]=vk(n),d={start:"0%",center:"50%",end:"100%"}[u],p=(o.arrow?.x??0)+s/2,g=(o.arrow?.y??0)+l/2;let v="",h="";return c==="bottom"?(v=i?d:`${p}px`,h=`${-l}px`):c==="top"?(v=i?d:`${p}px`,h=`${r.floating.height+l}px`):c==="right"?(v=`${-l}px`,h=i?d:`${g}px`):c==="left"&&(v=`${r.floating.width+l}px`,h=i?d:`${g}px`),{data:{x:v,y:h}}}});function vk(e){const[t,n="center"]=e.split("-");return[t,n]}var CA=dk,SA=pk,TA=mk,EA=gk,NA="Portal",ld=m.forwardRef((e,t)=>{const{container:n,...r}=e,[o,a]=m.useState(!1);Mt(()=>a(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Jw.createPortal(f.jsx(xe.div,{...r,ref:t}),i):null});ld.displayName=NA;function Fh(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var PA="VisuallyHidden",cd=m.forwardRef((e,t)=>f.jsx(xe.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));cd.displayName=PA;var MA=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},La=new WeakMap,Ql=new WeakMap,Zl={},wf=0,yk=function(e){return e&&(e.host||yk(e.parentNode))},AA=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=yk(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},RA=function(e,t,n,r){var o=AA(t,Array.isArray(e)?e:[e]);Zl[n]||(Zl[n]=new WeakMap);var a=Zl[n],i=[],s=new Set,l=new Set(o),c=function(d){!d||s.has(d)||(s.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(s.has(p))u(p);else try{var g=p.getAttribute(r),v=g!==null&&g!=="false",h=(La.get(p)||0)+1,_=(a.get(p)||0)+1;La.set(p,h),a.set(p,_),i.push(p),h===1&&v&&Ql.set(p,!0),_===1&&p.setAttribute(n,"true"),v||p.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return u(t),s.clear(),wf++,function(){i.forEach(function(d){var p=La.get(d)-1,g=a.get(d)-1;La.set(d,p),a.set(d,g),p||(Ql.has(d)||d.removeAttribute(r),Ql.delete(d)),g||d.removeAttribute(n)}),wf--,wf||(La=new WeakMap,La=new WeakMap,Ql=new WeakMap,Zl={})}},Bh=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=MA(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),RA(r,o,n,"aria-hidden")):function(){return null}},Nt=function(){return Nt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return WA;var t=GA(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},qA=Uh(),pi="data-scroll-locked",XA=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,s=e.gap;return n===void 0&&(n="margin"),` - .`.concat(IA,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(s,"px ").concat(r,`; - } - body[`).concat(pi,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(o,`px; - padding-top: `).concat(a,`px; - padding-right: `).concat(i,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(s,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(bs,` { - right: `).concat(s,"px ").concat(r,`; - } - - .`).concat(ws,` { - margin-right: `).concat(s,"px ").concat(r,`; - } - - .`).concat(bs," .").concat(bs,` { - right: 0 `).concat(r,`; - } - - .`).concat(ws," .").concat(ws,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(pi,`] { - `).concat(OA,": ").concat(s,`px; - } -`)},jy=function(){var e=parseInt(document.body.getAttribute(pi)||"0",10);return isFinite(e)?e:0},YA=function(){m.useEffect(function(){return document.body.setAttribute(pi,(jy()+1).toString()),function(){var e=jy()-1;e<=0?document.body.removeAttribute(pi):document.body.setAttribute(pi,e.toString())}},[])},Sk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;YA();var a=m.useMemo(function(){return KA(o)},[o]);return m.createElement(qA,{styles:XA(a,!t,o,n?"":"!important")})},np=!1;if(typeof window<"u")try{var Jl=Object.defineProperty({},"passive",{get:function(){return np=!0,!0}});window.addEventListener("test",Jl,Jl),window.removeEventListener("test",Jl,Jl)}catch{np=!1}var ja=np?{passive:!1}:!1,QA=function(e){return e.tagName==="TEXTAREA"},Tk=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!QA(e)&&n[t]==="visible")},ZA=function(e){return Tk(e,"overflowY")},JA=function(e){return Tk(e,"overflowX")},Fy=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Ek(e,r);if(o){var a=Nk(e,r),i=a[1],s=a[2];if(i>s)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},eR=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},tR=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Ek=function(e,t){return e==="v"?ZA(t):JA(t)},Nk=function(e,t){return e==="v"?eR(t):tR(t)},nR=function(e,t){return e==="h"&&t==="rtl"?-1:1},rR=function(e,t,n,r,o){var a=nR(e,window.getComputedStyle(t).direction),i=a*r,s=n.target,l=t.contains(s),c=!1,u=i>0,d=0,p=0;do{var g=Nk(e,s),v=g[0],h=g[1],_=g[2],b=h-_-a*v;(v||b)&&Ek(e,s)&&(d+=b,p+=v),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(Math.abs(d)<1||!o)||!u&&(Math.abs(p)<1||!o))&&(c=!0),c},ec=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},By=function(e){return[e.deltaX,e.deltaY]},$y=function(e){return e&&"current"in e?e.current:e},oR=function(e,t){return e[0]===t[0]&&e[1]===t[1]},aR=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},iR=0,Fa=[];function sR(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(iR++)[0],a=m.useState(Uh)[0],i=m.useRef(e);m.useEffect(function(){i.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var h=bk([e.lockRef.current],(e.shards||[]).map($y),!0).filter(Boolean);return h.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(h,_){if("touches"in h&&h.touches.length===2)return!i.current.allowPinchZoom;var b=ec(h),y=n.current,x="deltaX"in h?h.deltaX:y[0]-b[0],E="deltaY"in h?h.deltaY:y[1]-b[1],w,T=h.target,k=Math.abs(x)>Math.abs(E)?"h":"v";if("touches"in h&&k==="h"&&T.type==="range")return!1;var C=Fy(k,T);if(!C)return!0;if(C?w=k:(w=k==="v"?"h":"v",C=Fy(k,T)),!C)return!1;if(!r.current&&"changedTouches"in h&&(x||E)&&(r.current=w),!w)return!0;var P=r.current||w;return rR(P,_,h,P==="h"?x:E,!0)},[]),l=m.useCallback(function(h){var _=h;if(!(!Fa.length||Fa[Fa.length-1]!==a)){var b="deltaY"in _?By(_):ec(_),y=t.current.filter(function(w){return w.name===_.type&&(w.target===_.target||_.target===w.shadowParent)&&oR(w.delta,b)})[0];if(y&&y.should){_.cancelable&&_.preventDefault();return}if(!y){var x=(i.current.shards||[]).map($y).filter(Boolean).filter(function(w){return w.contains(_.target)}),E=x.length>0?s(_,x[0]):!i.current.noIsolation;E&&_.cancelable&&_.preventDefault()}}},[]),c=m.useCallback(function(h,_,b,y){var x={name:h,delta:_,target:b,should:y,shadowParent:lR(b)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(E){return E!==x})},1)},[]),u=m.useCallback(function(h){n.current=ec(h),r.current=void 0},[]),d=m.useCallback(function(h){c(h.type,By(h),h.target,s(h,e.lockRef.current))},[]),p=m.useCallback(function(h){c(h.type,ec(h),h.target,s(h,e.lockRef.current))},[]);m.useEffect(function(){return Fa.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,ja),document.addEventListener("touchmove",l,ja),document.addEventListener("touchstart",u,ja),function(){Fa=Fa.filter(function(h){return h!==a}),document.removeEventListener("wheel",l,ja),document.removeEventListener("touchmove",l,ja),document.removeEventListener("touchstart",u,ja)}},[]);var g=e.removeScrollBar,v=e.inert;return m.createElement(m.Fragment,null,v?m.createElement(a,{styles:aR(o)}):null,g?m.createElement(Sk,{gapMode:e.gapMode}):null)}function lR(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const cR=kk(Ck,sR);var Vh=m.forwardRef(function(e,t){return m.createElement(ud,Nt({},e,{ref:t,sideCar:cR}))});Vh.classNames=ud.classNames;var uR=[" ","Enter","ArrowUp","ArrowDown"],dR=[" ","Enter"],gl="Select",[dd,fd,fR]=hh(gl),[Bi,E7]=Pr(gl,[fR,ck]),pd=ck(),[pR,Co]=Bi(gl),[mR,hR]=Bi(gl),Pk=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:a,value:i,defaultValue:s,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:p,required:g}=e,v=pd(t),[h,_]=m.useState(null),[b,y]=m.useState(null),[x,E]=m.useState(!1),w=gh(c),[T=!1,k]=go({prop:r,defaultProp:o,onChange:a}),[C,P]=go({prop:i,defaultProp:s,onChange:l}),O=m.useRef(null),R=h?!!h.closest("form"):!0,[N,B]=m.useState(new Set),D=Array.from(N).map(L=>L.props.value).join(";");return f.jsx(CA,{...v,children:f.jsxs(pR,{required:g,scope:t,trigger:h,onTriggerChange:_,valueNode:b,onValueNodeChange:y,valueNodeHasChildren:x,onValueNodeHasChildrenChange:E,contentId:fo(),value:C,onValueChange:P,open:T,onOpenChange:k,dir:w,triggerPointerDownPosRef:O,disabled:p,children:[f.jsx(dd.Provider,{scope:t,children:f.jsx(mR,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(L=>{B(G=>new Set(G).add(L))},[]),onNativeOptionRemove:m.useCallback(L=>{B(G=>{const Y=new Set(G);return Y.delete(L),Y})},[]),children:n})}),R?f.jsxs(Qk,{"aria-hidden":!0,required:g,tabIndex:-1,name:u,autoComplete:d,value:C,onChange:L=>P(L.target.value),disabled:p,children:[C===void 0?f.jsx("option",{value:""}):null,Array.from(N)]},D):null]})})};Pk.displayName=gl;var Mk="SelectTrigger",Ak=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,a=pd(n),i=Co(Mk,n),s=i.disabled||r,l=$e(t,i.onTriggerChange),c=fd(n),[u,d,p]=Zk(v=>{const h=c().filter(y=>!y.disabled),_=h.find(y=>y.value===i.value),b=Jk(h,v,_);b!==void 0&&i.onValueChange(b.value)}),g=()=>{s||(i.onOpenChange(!0),p())};return f.jsx(SA,{asChild:!0,...a,children:f.jsx(xe.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":Yk(i.value)?"":void 0,...o,ref:l,onClick:we(o.onClick,v=>{v.currentTarget.focus()}),onPointerDown:we(o.onPointerDown,v=>{const h=v.target;h.hasPointerCapture(v.pointerId)&&h.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&(g(),i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)},v.preventDefault())}),onKeyDown:we(o.onKeyDown,v=>{const h=u.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&d(v.key),!(h&&v.key===" ")&&uR.includes(v.key)&&(g(),v.preventDefault())})})})});Ak.displayName=Mk;var Rk="SelectValue",Ik=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:a,placeholder:i="",...s}=e,l=Co(Rk,n),{onValueNodeHasChildrenChange:c}=l,u=a!==void 0,d=$e(t,l.onValueNodeChange);return Mt(()=>{c(u)},[c,u]),f.jsx(xe.span,{...s,ref:d,style:{pointerEvents:"none"},children:Yk(l.value)?f.jsx(f.Fragment,{children:i}):a})});Ik.displayName=Rk;var gR="SelectIcon",vR=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return f.jsx(xe.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});vR.displayName=gR;var yR="SelectPortal",Ok=e=>f.jsx(ld,{asChild:!0,...e});Ok.displayName=yR;var na="SelectContent",Dk=m.forwardRef((e,t)=>{const n=Co(na,e.__scopeSelect),[r,o]=m.useState();if(Mt(()=>{o(new DocumentFragment)},[]),!n.open){const a=r;return a?an.createPortal(f.jsx(Lk,{scope:e.__scopeSelect,children:f.jsx(dd.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),a):null}return f.jsx(jk,{...e,ref:t})});Dk.displayName=na;var dr=10,[Lk,So]=Bi(na),bR="SelectContentImpl",jk=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:i,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:h,avoidCollisions:_,...b}=e,y=Co(na,n),[x,E]=m.useState(null),[w,T]=m.useState(null),k=$e(t,H=>E(H)),[C,P]=m.useState(null),[O,R]=m.useState(null),N=fd(n),[B,D]=m.useState(!1),L=m.useRef(!1);m.useEffect(()=>{if(x)return Bh(x)},[x]),Yx();const G=m.useCallback(H=>{const[I,...F]=N().map(V=>V.ref.current),[j]=F.slice(-1),$=document.activeElement;for(const V of H)if(V===$||(V?.scrollIntoView({block:"nearest"}),V===I&&w&&(w.scrollTop=0),V===j&&w&&(w.scrollTop=w.scrollHeight),V?.focus(),document.activeElement!==$))return},[N,w]),Y=m.useCallback(()=>G([C,x]),[G,C,x]);m.useEffect(()=>{B&&Y()},[B,Y]);const{onOpenChange:K,triggerPointerDownPosRef:Z}=y;m.useEffect(()=>{if(x){let H={x:0,y:0};const I=j=>{H={x:Math.abs(Math.round(j.pageX)-(Z.current?.x??0)),y:Math.abs(Math.round(j.pageY)-(Z.current?.y??0))}},F=j=>{H.x<=10&&H.y<=10?j.preventDefault():x.contains(j.target)||K(!1),document.removeEventListener("pointermove",I),Z.current=null};return Z.current!==null&&(document.addEventListener("pointermove",I),document.addEventListener("pointerup",F,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",F,{capture:!0})}}},[x,K,Z]),m.useEffect(()=>{const H=()=>K(!1);return window.addEventListener("blur",H),window.addEventListener("resize",H),()=>{window.removeEventListener("blur",H),window.removeEventListener("resize",H)}},[K]);const[re,fe]=Zk(H=>{const I=N().filter($=>!$.disabled),F=I.find($=>$.ref.current===document.activeElement),j=Jk(I,H,F);j&&setTimeout(()=>j.ref.current.focus())}),U=m.useCallback((H,I,F)=>{const j=!L.current&&!F;(y.value!==void 0&&y.value===I||j)&&(P(H),j&&(L.current=!0))},[y.value]),ae=m.useCallback(()=>x?.focus(),[x]),se=m.useCallback((H,I,F)=>{const j=!L.current&&!F;(y.value!==void 0&&y.value===I||j)&&R(H)},[y.value]),S=r==="popper"?rp:Fk,X=S===rp?{side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:h,avoidCollisions:_}:{};return f.jsx(Lk,{scope:n,content:x,viewport:w,onViewportChange:T,itemRefCallback:U,selectedItem:C,onItemLeave:ae,itemTextRefCallback:se,focusSelectedItem:Y,selectedItemText:O,position:r,isPositioned:B,searchRef:re,children:f.jsx(Vh,{as:Ti,allowPinchZoom:!0,children:f.jsx(Nh,{asChild:!0,trapped:y.open,onMountAutoFocus:H=>{H.preventDefault()},onUnmountAutoFocus:we(o,H=>{y.trigger?.focus({preventScroll:!0}),H.preventDefault()}),children:f.jsx(ad,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:H=>H.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:f.jsx(S,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:H=>H.preventDefault(),...b,...X,onPlaced:()=>D(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:we(b.onKeyDown,H=>{const I=H.ctrlKey||H.altKey||H.metaKey;if(H.key==="Tab"&&H.preventDefault(),!I&&H.key.length===1&&fe(H.key),["ArrowUp","ArrowDown","Home","End"].includes(H.key)){let j=N().filter($=>!$.disabled).map($=>$.ref.current);if(["ArrowUp","End"].includes(H.key)&&(j=j.slice().reverse()),["ArrowUp","ArrowDown"].includes(H.key)){const $=H.target,V=j.indexOf($);j=j.slice(V+1)}setTimeout(()=>G(j)),H.preventDefault()}})})})})})})});jk.displayName=bR;var wR="SelectItemAlignedPosition",Fk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,a=Co(na,n),i=So(na,n),[s,l]=m.useState(null),[c,u]=m.useState(null),d=$e(t,k=>u(k)),p=fd(n),g=m.useRef(!1),v=m.useRef(!0),{viewport:h,selectedItem:_,selectedItemText:b,focusSelectedItem:y}=i,x=m.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&c&&h&&_&&b){const k=a.trigger.getBoundingClientRect(),C=c.getBoundingClientRect(),P=a.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(a.dir!=="rtl"){const $=O.left-C.left,V=P.left-$,J=k.left-V,ee=k.width+J,ce=Math.max(ee,C.width),Pe=window.innerWidth-dr,Oe=by(V,[dr,Pe-ce]);s.style.minWidth=ee+"px",s.style.left=Oe+"px"}else{const $=C.right-O.right,V=window.innerWidth-P.right-$,J=window.innerWidth-k.right-V,ee=k.width+J,ce=Math.max(ee,C.width),Pe=window.innerWidth-dr,Oe=by(V,[dr,Pe-ce]);s.style.minWidth=ee+"px",s.style.right=Oe+"px"}const R=p(),N=window.innerHeight-dr*2,B=h.scrollHeight,D=window.getComputedStyle(c),L=parseInt(D.borderTopWidth,10),G=parseInt(D.paddingTop,10),Y=parseInt(D.borderBottomWidth,10),K=parseInt(D.paddingBottom,10),Z=L+G+B+K+Y,re=Math.min(_.offsetHeight*5,Z),fe=window.getComputedStyle(h),U=parseInt(fe.paddingTop,10),ae=parseInt(fe.paddingBottom,10),se=k.top+k.height/2-dr,S=N-se,X=_.offsetHeight/2,H=_.offsetTop+X,I=L+G+H,F=Z-I;if(I<=se){const $=_===R[R.length-1].ref.current;s.style.bottom="0px";const V=c.clientHeight-h.offsetTop-h.offsetHeight,J=Math.max(S,X+($?ae:0)+V+Y),ee=I+J;s.style.height=ee+"px"}else{const $=_===R[0].ref.current;s.style.top="0px";const J=Math.max(se,L+h.offsetTop+($?U:0)+X)+F;s.style.height=J+"px",h.scrollTop=I-se+h.offsetTop}s.style.margin=`${dr}px 0`,s.style.minHeight=re+"px",s.style.maxHeight=N+"px",r?.(),requestAnimationFrame(()=>g.current=!0)}},[p,a.trigger,a.valueNode,s,c,h,_,b,a.dir,r]);Mt(()=>x(),[x]);const[E,w]=m.useState();Mt(()=>{c&&w(window.getComputedStyle(c).zIndex)},[c]);const T=m.useCallback(k=>{k&&v.current===!0&&(x(),y?.(),v.current=!1)},[x,y]);return f.jsx(xR,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:f.jsx(xe.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Fk.displayName=wR;var _R="SelectPopperPosition",rp=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=dr,...a}=e,i=pd(n);return f.jsx(TA,{...i,...a,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});rp.displayName=_R;var[xR,zh]=Bi(na,{}),op="SelectViewport",Bk=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,a=So(op,n),i=zh(op,n),s=$e(t,a.onViewportChange),l=m.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx(dd.Slot,{scope:n,children:f.jsx(xe.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"auto",...o.style},onScroll:we(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=i;if(p?.current&&d){const g=Math.abs(l.current-u.scrollTop);if(g>0){const v=window.innerHeight-dr*2,h=parseFloat(d.style.minHeight),_=parseFloat(d.style.height),b=Math.max(h,_);if(b0?E:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Bk.displayName=op;var $k="SelectGroup",[kR,CR]=Bi($k),SR=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=fo();return f.jsx(kR,{scope:n,id:o,children:f.jsx(xe.div,{role:"group","aria-labelledby":o,...r,ref:t})})});SR.displayName=$k;var Uk="SelectLabel",Vk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=CR(Uk,n);return f.jsx(xe.div,{id:o.id,...r,ref:t})});Vk.displayName=Uk;var wu="SelectItem",[TR,zk]=Bi(wu),Hk=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:a,...i}=e,s=Co(wu,n),l=So(wu,n),c=s.value===r,[u,d]=m.useState(a??""),[p,g]=m.useState(!1),v=$e(t,b=>l.itemRefCallback?.(b,r,o)),h=fo(),_=()=>{o||(s.onValueChange(r),s.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(TR,{scope:n,value:r,disabled:o,textId:h,isSelected:c,onItemTextChange:m.useCallback(b=>{d(y=>y||(b?.textContent??"").trim())},[]),children:f.jsx(dd.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:f.jsx(xe.div,{role:"option","aria-labelledby":h,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:v,onFocus:we(i.onFocus,()=>g(!0)),onBlur:we(i.onBlur,()=>g(!1)),onPointerUp:we(i.onPointerUp,_),onPointerMove:we(i.onPointerMove,b=>{o?l.onItemLeave?.():b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(i.onPointerLeave,b=>{b.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:we(i.onKeyDown,b=>{l.searchRef?.current!==""&&b.key===" "||(dR.includes(b.key)&&_(),b.key===" "&&b.preventDefault())})})})})});Hk.displayName=wu;var is="SelectItemText",Wk=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...a}=e,i=Co(is,n),s=So(is,n),l=zk(is,n),c=hR(is,n),[u,d]=m.useState(null),p=$e(t,b=>d(b),l.onItemTextChange,b=>s.itemTextRefCallback?.(b,l.value,l.disabled)),g=u?.textContent,v=m.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:h,onNativeOptionRemove:_}=c;return Mt(()=>(h(v),()=>_(v)),[h,_,v]),f.jsxs(f.Fragment,{children:[f.jsx(xe.span,{id:l.textId,...a,ref:p}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?an.createPortal(a.children,i.valueNode):null]})});Wk.displayName=is;var Gk="SelectItemIndicator",Kk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return zk(Gk,n).isSelected?f.jsx(xe.span,{"aria-hidden":!0,...r,ref:t}):null});Kk.displayName=Gk;var ap="SelectScrollUpButton",ER=m.forwardRef((e,t)=>{const n=So(ap,e.__scopeSelect),r=zh(ap,e.__scopeSelect),[o,a]=m.useState(!1),i=$e(t,r.onScrollButtonChange);return Mt(()=>{if(n.viewport&&n.isPositioned){let s=function(){const c=l.scrollTop>0;a(c)};const l=n.viewport;return s(),l.addEventListener("scroll",s),()=>l.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),o?f.jsx(qk,{...e,ref:i,onAutoScroll:()=>{const{viewport:s,selectedItem:l}=n;s&&l&&(s.scrollTop=s.scrollTop-l.offsetHeight)}}):null});ER.displayName=ap;var ip="SelectScrollDownButton",NR=m.forwardRef((e,t)=>{const n=So(ip,e.__scopeSelect),r=zh(ip,e.__scopeSelect),[o,a]=m.useState(!1),i=$e(t,r.onScrollButtonChange);return Mt(()=>{if(n.viewport&&n.isPositioned){let s=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)l.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),o?f.jsx(qk,{...e,ref:i,onAutoScroll:()=>{const{viewport:s,selectedItem:l}=n;s&&l&&(s.scrollTop=s.scrollTop+l.offsetHeight)}}):null});NR.displayName=ip;var qk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,a=So("SelectScrollButton",n),i=m.useRef(null),s=fd(n),l=m.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return m.useEffect(()=>()=>l(),[l]),Mt(()=>{s().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),f.jsx(xe.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:we(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:we(o.onPointerMove,()=>{a.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:we(o.onPointerLeave,()=>{l()})})}),PR="SelectSeparator",Xk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(xe.div,{"aria-hidden":!0,...r,ref:t})});Xk.displayName=PR;var sp="SelectArrow",MR=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=pd(n),a=Co(sp,n),i=So(sp,n);return a.open&&i.position==="popper"?f.jsx(EA,{...o,...r,ref:t}):null});MR.displayName=sp;function Yk(e){return e===""||e===void 0}var Qk=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=m.useRef(null),a=$e(t,o),i=Fh(n);return m.useEffect(()=>{const s=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==n&&u){const d=new Event("change",{bubbles:!0});u.call(s,n),s.dispatchEvent(d)}},[i,n]),f.jsx(cd,{asChild:!0,children:f.jsx("select",{...r,ref:a,defaultValue:n})})});Qk.displayName="BubbleSelect";function Zk(e){const t=Wt(e),n=m.useRef(""),r=m.useRef(0),o=m.useCallback(i=>{const s=n.current+i;t(s),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(s)},[t]),a=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,a]}function Jk(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let i=AR(e,Math.max(a,0));o.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function AR(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var RR=Pk,eC=Ak,IR=Ik,OR=Ok,tC=Dk,DR=Bk,nC=Vk,rC=Hk,LR=Wk,jR=Kk,oC=Xk;/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var FR={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ye=(e,t)=>{const n=m.forwardRef(({color:r="currentColor",size:o=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:s="",children:l,...c},u)=>m.createElement("svg",{ref:u,...FR,width:o,height:o,stroke:r,strokeWidth:i?Number(a)*24/Number(o):a,className:["lucide",`lucide-${BR(e)}`,s].join(" "),...c},[...t.map(([d,p])=>m.createElement(d,p)),...Array.isArray(l)?l:[l]]));return n.displayName=`${e}`,n};/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $R=ye("AlignLeft",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}],["line",{x1:"17",x2:"3",y1:"18",y2:"18",key:"1awlsn"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const UR=ye("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VR=ye("BatteryMedium",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zR=ye("Bluetooth",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aC=ye("BoxSelect",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HR=ye("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WR=ye("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["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",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iC=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sC=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const GR=ye("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Uy=ye("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vy=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zy=ye("CircleEllipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KR=ye("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qR=ye("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lC=ye("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XR=ye("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YR=ye("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QR=ye("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZR=ye("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hy=ye("Factory",[["path",{d:"M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"159hny"}],["path",{d:"M17 18h1",key:"uldtlt"}],["path",{d:"M12 18h1",key:"s9uhes"}],["path",{d:"M7 18h1",key:"1neino"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JR=ye("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const e6=ye("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const t6=ye("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wy=ye("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const n6=ye("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cC=ye("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const r6=ye("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const o6=ye("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uC=ye("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dC=ye("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const a6=ye("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fC=ye("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pC=ye("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mC=ye("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const i6=ye("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const s6=ye("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const l6=ye("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hh=ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hC=ye("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pc=ye("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lp=ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const c6=ye("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gC=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u6=ye("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wh=ye("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const d6=ye("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const f6=ye("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const p6=ye("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vC=ye("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const m6=ye("Usb",[["circle",{cx:"10",cy:"7",r:"1",key:"dypaad"}],["circle",{cx:"4",cy:"20",r:"1",key:"22iqad"}],["path",{d:"M4.7 19.3 19 5",key:"1enqfc"}],["path",{d:"m21 3-3 1 2 2Z",key:"d3ov82"}],["path",{d:"M9.26 7.68 5 12l2 5",key:"1esawj"}],["path",{d:"m10 14 5 2 3.5-3.5",key:"v8oal5"}],["path",{d:"m18 12 1-1 1 1-1 1Z",key:"1bh22v"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gh=ye("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h6=ye("Waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yC=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const g6=ye("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const v6=ye("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** - * @license lucide-react v0.363.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const y6=ye("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),bC=RR,wC=IR,Kh=m.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(eC,{ref:r,className:Ee("flex h-10 w-full items-center justify-between rounded-md border border-slate-300 bg-transparent py-2 px-3 text-sm placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-700 dark:text-slate-50 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900",e),...n,children:[t,f.jsx(sC,{className:"h-4 w-4 opacity-50"})]}));Kh.displayName=eC.displayName;const qh=m.forwardRef(({className:e,children:t,...n},r)=>f.jsx(OR,{children:f.jsx(tC,{ref:r,className:Ee("relative z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-100 bg-white text-slate-700 shadow-md animate-in fade-in-80 dark:border-slate-800 dark:bg-slate-800 dark:text-slate-400",e),...n,children:f.jsx(DR,{className:"p-1",children:t})})}));qh.displayName=tC.displayName;const b6=m.forwardRef(({className:e,...t},n)=>f.jsx(nC,{ref:n,className:Ee("py-1.5 pr-2 pl-8 text-sm font-semibold text-slate-900 dark:text-slate-300",e),...t}));b6.displayName=nC.displayName;const Xh=m.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(rC,{ref:r,className:Ee("relative flex cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm font-medium outline-none focus:bg-slate-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-700",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(jR,{children:f.jsx(iC,{className:"h-4 w-4"})})}),f.jsx(LR,{children:t})]}));Xh.displayName=rC.displayName;const w6=m.forwardRef(({className:e,...t},n)=>f.jsx(oC,{ref:n,className:Ee("-mx-1 my-1 h-px bg-slate-100 dark:bg-slate-700",e),...t}));w6.displayName=oC.displayName;const _C=m.forwardRef(({hide:e=!0,devicePSKBitCount:t,variant:n,value:r,buttonText:o,bits:a=[{text:"256 bit",value:"32",key:"bit256"},{text:"128 bit",value:"16",key:"bit128"},{text:"8 bit",value:"1",key:"bit8"}],selectChange:i,inputChange:s,buttonClick:l,action:c,disabled:u,...d},p)=>{const g=m.useRef(null);return m.useEffect(()=>{if(!g.current)return;const v=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set;v&&(g.current.value="",v.call(g.current,r),g.current.dispatchEvent(new Event("input",{bubbles:!0})))},[r]),f.jsxs(f.Fragment,{children:[f.jsx(jn,{type:e?"password":"text",id:"pskInput",variant:n,value:r,onChange:s,action:c,disabled:u,ref:g}),f.jsxs(bC,{value:t?.toString(),onValueChange:v=>i(v),disabled:u,children:[f.jsx(Kh,{className:"!max-w-max",children:f.jsx(wC,{})}),f.jsx(qh,{children:a.map(({text:v,value:h,key:_})=>f.jsx(Xh,{value:h,children:v},_))})]}),f.jsx(pt,{type:"button",variant:"success",onClick:l,disabled:u,...d,children:o})]})});_C.displayName="Button";function _6({control:e,field:t,disabled:n}){return f.jsx(ml,{name:t.name,control:e,render:({field:{value:r,...o}})=>f.jsx(_C,{hide:t.hide,devicePSKBitCount:t.devicePSKBitCount,bits:t.bits,inputChange:t.inputChange,selectChange:t.selectChange,buttonClick:t.buttonClick,value:r,variant:t.validationText?"invalid":"default",buttonText:"Generate",...t.properties,...o,disabled:n})})}function x6({control:e,disabled:t,field:n}){return f.jsx(ml,{name:n.name,control:e,render:({field:{value:r,onChange:o,...a}})=>{const{enumValue:i,formatEnumName:s,...l}=n.properties,c=i?Object.entries(i).filter(u=>typeof u[1]=="number"):[];return f.jsxs(bC,{onValueChange:u=>o(Number.parseInt(u)),disabled:t,value:r?.toString(),...l,...a,children:[f.jsx(Kh,{children:f.jsx(wC,{})}),f.jsx(qh,{children:c.map(([u,d])=>f.jsx(Xh,{value:d.toString(),children:s?u.replace(/_/g," ").toLowerCase().split(" ").map(p=>p.charAt(0).toUpperCase()+p.substring(1)).join(" "):u},u))})]})}})}var Yh="Switch",[k6,N7]=Pr(Yh),[C6,S6]=k6(Yh),xC=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:a,required:i,disabled:s,value:l="on",onCheckedChange:c,...u}=e,[d,p]=m.useState(null),g=$e(t,y=>p(y)),v=m.useRef(!1),h=d?!!d.closest("form"):!0,[_=!1,b]=go({prop:o,defaultProp:a,onChange:c});return f.jsxs(C6,{scope:n,checked:_,disabled:s,children:[f.jsx(xe.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":SC(_),"data-disabled":s?"":void 0,disabled:s,value:l,...u,ref:g,onClick:we(e.onClick,y=>{b(x=>!x),h&&(v.current=y.isPropagationStopped(),v.current||y.stopPropagation())})}),h&&f.jsx(T6,{control:d,bubbles:!v.current,name:r,value:l,checked:_,required:i,disabled:s,style:{transform:"translateX(-100%)"}})]})});xC.displayName=Yh;var kC="SwitchThumb",CC=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=S6(kC,n);return f.jsx(xe.span,{"data-state":SC(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});CC.displayName=kC;var T6=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,a=m.useRef(null),i=Fh(n),s=Dh(t);return m.useEffect(()=>{const l=a.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==n&&d){const p=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(p)}},[i,n,r]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:a,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function SC(e){return e?"checked":"unchecked"}var TC=xC,E6=CC;const md=m.forwardRef(({className:e,...t},n)=>f.jsx(TC,{className:Ee("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=checked]:bg-slate-400 dark:data-[state=unchecked]:bg-slate-700",e),...t,ref:n,children:f.jsx(E6,{className:Ee("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));md.displayName=TC.displayName;function N6({control:e,disabled:t,field:n}){const r=o=>a=>{o({target:{value:a}})};return f.jsx(ml,{name:n.name,control:e,render:({field:{value:o,onChange:a,...i}})=>f.jsx(md,{checked:o,onCheckedChange:r(a),disabled:t,...n.properties,...i})})}function P6({field:e,control:t,disabled:n}){switch(e.type){case"text":case"password":case"number":return f.jsx(tM,{field:e,control:t,disabled:n});case"toggle":return f.jsx(N6,{field:e,control:t,disabled:n});case"select":return f.jsx(x6,{field:e,control:t,disabled:n});case"passwordGenerator":return f.jsx(_6,{field:e,control:t,disabled:n});case"multiSelect":return f.jsx("div",{children:"tmp"})}}var M6="Label",EC=m.forwardRef((e,t)=>f.jsx(xe.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));EC.displayName=M6;var NC=EC;const xn=m.forwardRef(({className:e,...t},n)=>f.jsx(NC,{ref:n,className:Ee("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));xn.displayName=NC.displayName;const A6=({label:e,description:t,children:n,valid:r,validationText:o})=>f.jsx("div",{className:"pt-6 sm:pt-5",children:f.jsx("div",{role:"group","aria-labelledby":"label-notifications",children:f.jsxs("div",{className:"sm:grid sm:grid-cols-3 sm:items-baseline sm:gap-4",children:[f.jsx(xn,{children:e}),f.jsx("div",{className:"sm:col-span-2",children:f.jsxs("div",{className:"max-w-lg",children:[f.jsx("p",{className:"text-sm text-gray-500",children:t}),f.jsx("p",{hidden:r??!0,className:"text-sm text-red-500",children:o}),f.jsx("div",{className:"mt-4 space-y-4",children:f.jsx("div",{className:"flex items-center",children:n})})]})})]})})}),PC=({className:e,children:t})=>f.jsx("h4",{className:Ee("scroll-m-20 text-xl font-semibold tracking-tight",e),children:t}),wn=({className:e,children:t})=>f.jsx("p",{className:Ee("text-sm text-slate-500 dark:text-slate-400",e),children:t});function at({onSubmit:e,submitType:t="onChange",hasSubmitButton:n,defaultValues:r,fieldGroups:o}){const{handleSubmit:a,control:i,getValues:s}=Eh({mode:t,defaultValues:r}),l=(c,u)=>u?!0:c?c.some(d=>{const p=s(d.fieldName);return p==="always"?!0:typeof p=="boolean"?d.invert?p:!p:typeof p=="number"?d.invert?d.selector!==p:d.selector===p:!1}):!1;return f.jsxs("form",{className:"space-y-8 divide-y divide-gray-200",...t==="onSubmit"?{onSubmit:a(e)}:{onChange:a(e)},children:[o.map(c=>f.jsxs("div",{className:"space-y-8 divide-y divide-gray-200 sm:space-y-5",children:[f.jsxs("div",{children:[f.jsx(PC,{className:"font-medium",children:c.label}),f.jsx(wn,{children:c.description})]}),c.fields.map(u=>f.jsx(A6,{label:u.label,description:u.description,valid:u.validationText===void 0||u.validationText==="",validationText:u.validationText,children:f.jsx(P6,{field:u,control:i,disabled:l(u.disabledBy,u.disabled)})},u.label))]},c.label)),n&&f.jsx(pt,{type:"submit",children:"Submit"})]})}const R6=1,I6=1e6;let Cf=0;function O6(){return Cf=(Cf+1)%Number.MAX_VALUE,Cf.toString()}const Sf=new Map,Gy=e=>{if(Sf.has(e))return;const t=setTimeout(()=>{Sf.delete(e),_s({type:"REMOVE_TOAST",toastId:e})},I6);Sf.set(e,t)},D6=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,R6)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;if(n)Gy(n);else for(const r of e.toasts)Gy(r.id);return{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Mc=[];let Ac={toasts:[]};function _s(e){Ac=D6(Ac,e);for(const t of Mc)t(Ac)}function L6({...e}){const t=O6(),n=o=>_s({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>_s({type:"DISMISS_TOAST",toastId:t});return _s({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}const j6=e=>(Mc.push(e),function(){const n=Mc.indexOf(e);n>-1&&Mc.splice(n,1)}),F6=()=>Ac;function hd(){return{...m.useSyncExternalStore(j6,F6),toast:L6,dismiss:t=>_s({type:"DISMISS_TOAST",toastId:t})}}var Jr=z6,fr=G6,qn=[],mn=[],B6=typeof Uint8Array<"u"?Uint8Array:Array,Tf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Ba=0,$6=Tf.length;Ba<$6;++Ba)qn[Ba]=Tf[Ba],mn[Tf.charCodeAt(Ba)]=Ba;mn[45]=62;mn[95]=63;function U6(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function V6(e,t,n){return(t+n)*3/4-n}function z6(e){var t,n=U6(e),r=n[0],o=n[1],a=new B6(V6(e,r,o)),i=0,s=o>0?r-4:r,l;for(l=0;l>16&255,a[i++]=t>>8&255,a[i++]=t&255;return o===2&&(t=mn[e.charCodeAt(l)]<<2|mn[e.charCodeAt(l+1)]>>4,a[i++]=t&255),o===1&&(t=mn[e.charCodeAt(l)]<<10|mn[e.charCodeAt(l+1)]<<4|mn[e.charCodeAt(l+2)]>>2,a[i++]=t>>8&255,a[i++]=t&255),a}function H6(e){return qn[e>>18&63]+qn[e>>12&63]+qn[e>>6&63]+qn[e&63]}function W6(e,t,n){for(var r,o=[],a=t;as?s:i+a));return r===1?(t=e[n-1],o.push(qn[t>>2]+qn[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],o.push(qn[t>>10]+qn[t>>4&63]+qn[t<<2&63]+"=")),o.join("")}const K6=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"],q6=[..."0123456789"],X6=[..."CDEHKMPRTUWXY012458"],Y6=[..."!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],Q6=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],Z6=(e,t)=>e[t]+(e[t+1]<<8),J6=(e,t,n)=>{const r=t.length,o=Math.floor(65536/r)*r-1,a=2*Math.ceil(1.1*e);let i="",s=0;for(;so)&&(i+=t[u%r],s++)}}return i},eI=new Set([void 0,"hex","base64","url-safe","numeric","distinguishable","ascii-printable","alphanumeric"]),tI=(e,t,n)=>({length:r,type:o,characters:a})=>{if(!(r>=0&&Number.isFinite(r)))throw new TypeError("Expected a `length` to be a non-negative finite number");if(o!==void 0&&a!==void 0)throw new TypeError("Expected either `type` or `characters`");if(a!==void 0&&typeof a!="string")throw new TypeError("Expected `characters` to be string");if(!eI.has(o))throw new TypeError(`Unknown type: ${o}`);if(o===void 0&&a===void 0&&(o="hex"),o==="hex"||o===void 0&&a===void 0)return t(Math.ceil(r*.5),"hex",r);if(o==="base64")return t(Math.ceil(r*.75),"base64",r);if(o==="url-safe")return e(r,K6,n);if(o==="numeric")return e(r,q6,n);if(o==="distinguishable")return e(r,X6,n);if(o==="ascii-printable")return e(r,Y6,n);if(o==="alphanumeric")return e(r,Q6,n);if(a.length===0)throw new TypeError("Expected `characters` string length to be greater than or equal to 1");if(a.length>65536)throw new TypeError("Expected `characters` string length to be less or equal to 65536");return e(r,a,n)};function nI(e,t){return tI(J6,e,t)}const rI=e=>[...e].map(t=>t.toString(16).padStart(2,"0")).join(""),oI=e=>btoa(String.fromCodePoint(...e)),Ky=65536;function MC(e){const t=new Uint8Array(e);for(let n=0;n{const{config:t,connection:n,addChannel:r}=Te(),{toast:o}=hd(),[a,i]=m.useState(fr(e?.settings?.psk??new Uint8Array(0))),[s,l]=m.useState(e?.settings?.psk.length??16),[c,u]=m.useState(),d=_=>{const b=new pe.Channel.Channel({..._,settings:{..._.settings,psk:Jr(a),moduleSettings:{positionPrecision:_.settings.positionEnabled?_.settings.preciseLocation?32:_.settings.positionPrecision:0}}});n?.setChannel(b).then(()=>{o({title:`Saved Channel: ${b.settings?.name}`}),r(b)})},p=()=>{i(btoa(iI({length:s??0,type:"alphanumeric"}))),u(void 0)},g=(_,b)=>{_.length%4!==0||Jr(_).length!==b?u(`Please enter a valid ${b*8} bit PSK.`):u(void 0)},v=_=>{const b=_.currentTarget?.value;i(b),g(b,s)},h=_=>{const b=Number.parseInt(_);l(b),g(a,b)};return f.jsx(at,{onSubmit:d,submitType:"onSubmit",hasSubmitButton:!0,defaultValues:{...e,settings:{...e?.settings,psk:a,positionEnabled:e?.settings?.moduleSettings?.positionPrecision!==void 0&&e?.settings?.moduleSettings?.positionPrecision>0,preciseLocation:e?.settings?.moduleSettings?.positionPrecision===32,positionPrecision:e?.settings?.moduleSettings?.positionPrecision===void 0?10:e?.settings?.moduleSettings?.positionPrecision}},fieldGroups:[{label:"Channel Settings",description:"Crypto, MQTT & misc settings",fields:[{type:"select",name:"role",label:"Role",disabled:e.index===0,description:"Device telemetry is sent over PRIMARY. Only one PRIMARY allowed",properties:{enumValue:e.index===0?{PRIMARY:1}:{DISABLED:0,SECONDARY:2}}},{type:"passwordGenerator",name:"settings.psk",label:"pre-Shared Key",description:"256, 128, or 8 bit PSKs allowed",validationText:c,devicePSKBitCount:s??0,inputChange:v,selectChange:h,buttonClick:p,properties:{value:a}},{type:"text",name:"settings.name",label:"Name",description:"A unique name for the channel <12 bytes, leave blank for default"},{type:"toggle",name:"settings.uplinkEnabled",label:"Uplink Enabled",description:"Send messages from the local mesh to MQTT"},{type:"toggle",name:"settings.downlinkEnabled",label:"Downlink Enabled",description:"Send messages from MQTT to the local mesh"},{type:"toggle",name:"settings.positionEnabled",label:"Allow Position Requests",description:"Send position to channel"},{type:"toggle",name:"settings.preciseLocation",label:"Precise Location",description:"Send precise location to channel"},{type:"select",name:"settings.positionPrecision",label:"Approximate Location",description:"If not sharing precise location, position shared on channel will be accurate within this distance",properties:{enumValue:t.display?.units===0?{"Within 23 km":10,"Within 12 km":11,"Within 5.8 km":12,"Within 2.9 km":13,"Within 1.5 km":14,"Within 700 m":15,"Within 350 m":16,"Within 200 m":17,"Within 90 m":18,"Within 50 m":19}:{"Within 15 miles":10,"Within 7.3 miles":11,"Within 3.6 miles":12,"Within 1.8 miles":13,"Within 0.9 miles":14,"Within 0.5 miles":15,"Within 0.2 miles":16,"Within 600 feet":17,"Within 300 feet":18,"Within 150 feet":19}}}]}]})},Qh=Ae.forwardRef(({className:e,...t},n)=>f.jsx("footer",{className:`flex flex- justify-center p-2 ${e}`,style:{backgroundColor:"var(--backgroundPrimary)",color:"var(--textPrimary)"},children:f.jsxs("p",{children:[f.jsx("a",{href:"https://vercel.com/?utm_source=meshtastic&utm_campaign=oss",className:"hover:underline",style:{color:"var(--link)"},children:"Powered by ▲ Vercel"})," ","| Meshtastic® is a registered trademark of Meshtastic LLC. |"," ",f.jsx("a",{href:"https://meshtastic.org/docs/legal",className:"hover:underline",style:{color:"var(--link)"},children:"Legal Information"})]})})),gd=({label:e,noPadding:t,actions:n,children:r})=>f.jsx(f.Fragment,{children:f.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[f.jsxs("div",{className:"flex h-14 shrink-0 border-b-[0.5px] border-slate-300 dark:border-slate-700 md:h-16 md:px-4",children:[f.jsx("button",{type:"button",className:"pl-4 transition-all hover:text-accent md:hidden",children:f.jsx($R,{})}),f.jsx("div",{className:"flex flex-1 items-center justify-between px-4 md:px-0",children:f.jsxs("div",{className:"flex w-full items-center",children:[f.jsx("span",{className:"w-full text-lg font-medium",children:e}),f.jsx("div",{className:"flex justify-end space-x-4",children:n?.map((o,a)=>f.jsx("button",{type:"button",className:"transition-all hover:text-accent",onClick:o.onClick,children:f.jsx(o.icon,{className:o.iconClasses})},o.icon.name))})]})})]}),f.jsxs("div",{className:Ee("flex h-full w-full flex-col overflow-y-auto",!t&&"pl-3 pr-3 "),children:[r,f.jsx(Qh,{})]})]})}),qs=({label:e,children:t})=>f.jsxs("div",{className:"px-4 py-2",children:[f.jsx(PC,{className:"mb-2 ml-2",children:e}),f.jsx("div",{className:"space-y-1",children:t})]}),Ni=({label:e,active:t,Icon:n,element:r,onClick:o})=>f.jsxs(pt,{onClick:o,variant:t?"subtle":"ghost",size:"sm",className:"w-full justify-start gap-2",children:[n&&f.jsx(n,{size:16}),r&&r,e]}),vl=({children:e})=>{const{hardware:t,nodes:n,metadata:r}=Te(),o=n.get(t.myNodeNum),a=r.get(0),{activePage:i,setActivePage:s,setDialogOpen:l}=Te(),c=[{name:"Messages",icon:pC,page:"messages"},{name:"Map",icon:fC,page:"map"},{name:"Config",icon:Wh,page:"config"},{name:"Channels",icon:cC,page:"channels"},{name:"Nodes",icon:Gh,page:"nodes"}];return f.jsxs("div",{className:"min-w-[280px] max-w-min flex-col overflow-y-auto border-r-[0.5px] border-slate-300 bg-transparent dark:border-slate-700",children:[f.jsxs("div",{className:"flex justify-between px-8 pt-6",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-lg font-medium",children:o?.user?.shortName??"UNK"}),f.jsx(wn,{children:o?.user?.longName??"UNK"})]}),f.jsx("button",{type:"button",className:"transition-all hover:text-accent",onClick:()=>l("deviceName",!0),children:f.jsx(f6,{size:16})})]}),f.jsxs("div",{className:"px-8 pb-6",children:[f.jsxs("div",{className:"flex items-center",children:[f.jsx(VR,{size:24,viewBox:"0 0 28 24"}),f.jsxs(wn,{children:[o?.deviceMetrics?.batteryLevel??"UNK","%"]})]}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(g6,{size:24,viewBox:"0 0 36 24"}),f.jsxs(wn,{children:[o?.deviceMetrics?.voltage?.toPrecision(3)??"UNK"," volts"]})]}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(XR,{size:24,viewBox:"0 0 36 24"}),f.jsxs(wn,{children:["v",a?.firmwareVersion??"UNK"]})]})]}),f.jsx(qs,{label:"Navigation",children:c.map(u=>f.jsx(Ni,{label:u.name,Icon:u.icon,onClick:()=>{s(u.page)},active:u.page===i},u.name))}),e]})},cp=e=>e.settings?.name.length?e.settings?.name:e.index===0?"Primary":`Ch ${e.index}`,lI=()=>{const{channels:e,setDialogOpen:t}=Te(),[n,r]=m.useState(Ws.ChannelNumber.Primary),o=e.get(n),a=Array.from(e.values());return f.jsxs(f.Fragment,{children:[f.jsx(vl,{}),f.jsx(gd,{label:`Channel: ${o?cp(o):"Loading..."}`,actions:[{icon:t6,onClick(){t("import",!0)}},{icon:Pc,onClick(){t("QR",!0)}}],children:f.jsxs(od,{defaultValue:"0",children:[f.jsx(cl,{children:a.map(i=>f.jsx(ul,{value:i.index.toString(),children:cp(i)},i.index))}),a.map(i=>f.jsx(dl,{value:i.index.toString(),children:f.jsx(sI,{channel:i},i.index)},i.index))]})})]})},cI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"bluetooth",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.bluetooth,fieldGroups:[{label:"Bluetooth Settings",description:"Settings for the Bluetooth module",fields:[{type:"toggle",name:"enabled",label:"Enabled",description:"Enable or disable Bluetooth"},{type:"select",name:"mode",label:"Pairing mode",description:"Pin selection behaviour.",disabledBy:[{fieldName:"enabled"}],properties:{enumValue:pe.Config.Config_BluetoothConfig_PairingMode,formatEnumName:!0}},{type:"number",name:"fixedPin",label:"Pin",description:"Pin to use when pairing",disabledBy:[{fieldName:"mode",selector:pe.Config.Config_BluetoothConfig_PairingMode.FIXED_PIN,invert:!0},{fieldName:"enabled"}],properties:{}}]}]})},uI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"device",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.device,fieldGroups:[{label:"Device Settings",description:"Settings for the device",fields:[{type:"select",name:"role",label:"Role",description:"What role the device performs on the mesh",properties:{enumValue:{Client:pe.Config.Config_DeviceConfig_Role.CLIENT,"Client Mute":pe.Config.Config_DeviceConfig_Role.CLIENT_MUTE,Router:pe.Config.Config_DeviceConfig_Role.ROUTER,Repeater:pe.Config.Config_DeviceConfig_Role.REPEATER,Tracker:pe.Config.Config_DeviceConfig_Role.TRACKER,Sensor:pe.Config.Config_DeviceConfig_Role.SENSOR,TAK:pe.Config.Config_DeviceConfig_Role.TAK,"Client Hidden":pe.Config.Config_DeviceConfig_Role.CLIENT_HIDDEN,"Lost and Found":pe.Config.Config_DeviceConfig_Role.LOST_AND_FOUND,"TAK Tracker":pe.Config.Config_DeviceConfig_Role.SENSOR},formatEnumName:!0}},{type:"number",name:"buttonGpio",label:"Button Pin",description:"Button pin override"},{type:"number",name:"buzzerGpio",label:"Buzzer Pin",description:"Buzzer pin override"},{type:"select",name:"rebroadcastMode",label:"Rebroadcast Mode",description:"How to handle rebroadcasting",properties:{enumValue:pe.Config.Config_DeviceConfig_RebroadcastMode,formatEnumName:!0}},{type:"number",name:"nodeInfoBroadcastSecs",label:"Node Info Broadcast Interval",description:"How often to broadcast node info",properties:{suffix:"Seconds"}},{type:"toggle",name:"doubleTapAsButtonPress",label:"Double Tap as Button Press",description:"Treat double tap as button press"},{type:"toggle",name:"disableTripleClick",label:"Disable Triple Click",description:"Disable triple click"}]}]})},dI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"display",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.display,fieldGroups:[{label:"Display Settings",description:"Settings for the device display",fields:[{type:"number",name:"screenOnSecs",label:"Screen Timeout",description:"Turn off the display after this long",properties:{suffix:"Seconds"}},{type:"select",name:"gpsFormat",label:"GPS Display Units",description:"Coordinate display format",properties:{enumValue:pe.Config.Config_DisplayConfig_GpsCoordinateFormat}},{type:"number",name:"autoScreenCarouselSecs",label:"Carousel Delay",description:"How fast to cycle through windows",properties:{suffix:"Seconds"}},{type:"toggle",name:"compassNorthTop",label:"Compass North Top",description:"Fix north to the top of compass"},{type:"toggle",name:"flipScreen",label:"Flip Screen",description:"Flip display 180 degrees"},{type:"select",name:"units",label:"Display Units",description:"Display metric or imperial units",properties:{enumValue:pe.Config.Config_DisplayConfig_DisplayUnits,formatEnumName:!0}},{type:"select",name:"oled",label:"OLED Type",description:"Type of OLED screen attached to the device",properties:{enumValue:pe.Config.Config_DisplayConfig_OledType}},{type:"select",name:"displaymode",label:"Display Mode",description:"Screen layout variant",properties:{enumValue:pe.Config.Config_DisplayConfig_DisplayMode,formatEnumName:!0}},{type:"toggle",name:"headingBold",label:"Bold Heading",description:"Bolden the heading text"},{type:"toggle",name:"wakeOnTapOrMotion",label:"Wake on Tap or Motion",description:"Wake the device on tap or motion"}]}]})},fI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"lora",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.lora,fieldGroups:[{label:"Mesh Settings",description:"Settings for the LoRa mesh",fields:[{type:"select",name:"region",label:"Region",description:"Sets the region for your node",properties:{enumValue:pe.Config.Config_LoRaConfig_RegionCode}},{type:"select",name:"hopLimit",label:"Hop Limit",description:"Maximum number of hops",properties:{enumValue:{1:1,2:2,3:3,4:4,5:5,6:6,7:7}}},{type:"number",name:"channelNum",label:"Frequency Slot",description:"LoRa frequency channel number"},{type:"toggle",name:"ignoreMqtt",label:"Ignore MQTT",description:"Don't forward MQTT messages over the mesh"},{type:"toggle",name:"configOkToMqtt",label:"OK to MQTT",description:"When set to true, this configuration indicates that the user approves the packet to be uploaded to MQTT. If set to false, remote nodes are requested not to forward packets to MQTT"}]},{label:"Waveform Settings",description:"Settings for the LoRa waveform",fields:[{type:"toggle",name:"usePreset",label:"Use Preset",description:"Use one of the predefined modem presets"},{type:"select",name:"modemPreset",label:"Modem Preset",description:"Modem preset to use",disabledBy:[{fieldName:"usePreset"}],properties:{enumValue:pe.Config.Config_LoRaConfig_ModemPreset,formatEnumName:!0}},{type:"number",name:"bandwidth",label:"Bandwidth",description:"Channel bandwidth in MHz",disabledBy:[{fieldName:"usePreset",invert:!0}],properties:{suffix:"MHz"}},{type:"number",name:"spreadFactor",label:"Spreading Factor",description:"Indicates the number of chirps per symbol",disabledBy:[{fieldName:"usePreset",invert:!0}],properties:{suffix:"CPS"}},{type:"number",name:"codingRate",label:"Coding Rate",description:"The denominator of the coding rate",disabledBy:[{fieldName:"usePreset",invert:!0}]}]},{label:"Radio Settings",description:"Settings for the LoRa radio",fields:[{type:"toggle",name:"txEnabled",label:"Transmit Enabled",description:"Enable/Disable transmit (TX) from the LoRa radio"},{type:"number",name:"txPower",label:"Transmit Power",description:"Max transmit power",properties:{suffix:"dBm"}},{type:"toggle",name:"overrideDutyCycle",label:"Override Duty Cycle",description:"Override Duty Cycle"},{type:"number",name:"frequencyOffset",label:"Frequency Offset",description:"Frequency offset to correct for crystal calibration errors",properties:{suffix:"Hz"}},{type:"toggle",name:"sx126xRxBoostedGain",label:"Boosted RX Gain",description:"Boosted RX gain"},{type:"number",name:"overrideFrequency",label:"Override Frequency",description:"Override frequency",properties:{suffix:"MHz",step:.001}}]}]})};function tc(e){return`${e&255}.${e>>8&255}.${e>>16&255}.${e>>24&255}`}function nc(e){return e.split(".").reverse().reduce((t,n)=>(t<<8)+Number.parseInt(n),0)>>>0}const pI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"network",value:{...r,ipv4Config:new pe.Config.Config_NetworkConfig_IpV4Config({ip:nc(r.ipv4Config.ip)??0,gateway:nc(r.ipv4Config.gateway)??0,subnet:nc(r.ipv4Config.subnet)??0,dns:nc(r.ipv4Config.dns)??0})}}}))};return f.jsx(at,{onSubmit:n,defaultValues:{...e.network,ipv4Config:{ip:tc(e.network?.ipv4Config?.ip??0),gateway:tc(e.network?.ipv4Config?.gateway??0),subnet:tc(e.network?.ipv4Config?.subnet??0),dns:tc(e.network?.ipv4Config?.dns??0)}},fieldGroups:[{label:"WiFi Config",description:"WiFi radio configuration",fields:[{type:"toggle",name:"wifiEnabled",label:"Enabled",description:"Enable or disable the WiFi radio"},{type:"text",name:"wifiSsid",label:"SSID",description:"Network name",disabledBy:[{fieldName:"wifiEnabled"}]},{type:"password",name:"wifiPsk",label:"PSK",description:"Network password",disabledBy:[{fieldName:"wifiEnabled"}]}]},{label:"Ethernet Config",description:"Ethernet port configuration",fields:[{type:"toggle",name:"ethEnabled",label:"Enabled",description:"Enable or disable the Ethernet port"}]},{label:"IP Config",description:"IP configuration",fields:[{type:"select",name:"addressMode",label:"Address Mode",description:"Address assignment selection",properties:{enumValue:pe.Config.Config_NetworkConfig_AddressMode}},{type:"text",name:"ipv4Config.ip",label:"IP",description:"IP Address",disabledBy:[{fieldName:"addressMode",selector:pe.Config.Config_NetworkConfig_AddressMode.DHCP}]},{type:"text",name:"ipv4Config.gateway",label:"Gateway",description:"Default Gateway",disabledBy:[{fieldName:"addressMode",selector:pe.Config.Config_NetworkConfig_AddressMode.DHCP}]},{type:"text",name:"ipv4Config.subnet",label:"Subnet",description:"Subnet Mask",disabledBy:[{fieldName:"addressMode",selector:pe.Config.Config_NetworkConfig_AddressMode.DHCP}]},{type:"text",name:"ipv4Config.dns",label:"DNS",description:"DNS Server",disabledBy:[{fieldName:"addressMode",selector:pe.Config.Config_NetworkConfig_AddressMode.DHCP}]}]},{label:"NTP Config",description:"NTP configuration",fields:[{type:"text",name:"ntpServer",label:"NTP Server"}]},{label:"Rsyslog Config",description:"Rsyslog configuration",fields:[{type:"text",name:"rsyslogServer",label:"Rsyslog Server"}]}]})},mI=()=>{const{config:e,nodes:t,hardware:n,setWorkingConfig:r}=Te(),o=a=>{r(new pe.Config.Config({payloadVariant:{case:"position",value:a}}))};return f.jsx(at,{onSubmit:o,defaultValues:e.position,fieldGroups:[{label:"Position Settings",description:"Settings for the position module",fields:[{type:"toggle",name:"positionBroadcastSmartEnabled",label:"Enable Smart Position",description:"Only send position when there has been a meaningful change in location"},{type:"select",name:"gpsMode",label:"GPS Mode",description:"Configure whether device GPS is Enabled, Disabled, or Not Present",properties:{enumValue:pe.Config.Config_PositionConfig_GpsMode}},{type:"toggle",name:"fixedPosition",label:"Fixed Position",description:"Don't report GPS position, but a manually-specified one"},{type:"multiSelect",name:"positionFlags",label:"Position Flags",description:"Configuration options for Position messages",properties:{enumValue:pe.Config.Config_PositionConfig_PositionFlags}},{type:"number",name:"rxGpio",label:"Receive Pin",description:"GPS module RX pin override"},{type:"number",name:"txGpio",label:"Transmit Pin",description:"GPS module TX pin override"},{type:"number",name:"gpsEnGpio",label:"Enable Pin",description:"GPS module enable pin override"}]},{label:"Intervals",description:"How often to send position updates",fields:[{type:"number",name:"positionBroadcastSecs",label:"Broadcast Interval",description:"How often your position is sent out over the mesh",properties:{suffix:"Seconds"}},{type:"number",name:"gpsUpdateInterval",label:"GPS Update Interval",description:"How often a GPS fix should be acquired",properties:{suffix:"Seconds"}},{type:"number",name:"broadcastSmartMinimumDistance",label:"Smart Position Minimum Distance",description:"Minimum distance (in meters) that must be traveled before a position update is sent",disabledBy:[{fieldName:"positionBroadcastSmartEnabled"}]},{type:"number",name:"broadcastSmartMinimumIntervalSecs",label:"Smart Position Minimum Interval",description:"Minimum interval (in seconds) that must pass before a position update is sent",disabledBy:[{fieldName:"positionBroadcastSmartEnabled"}]}]}]})},hI=()=>{const{config:e,setWorkingConfig:t}=Te(),n=r=>{t(new pe.Config.Config({payloadVariant:{case:"power",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.power,fieldGroups:[{label:"Power Config",description:"Settings for the power module",fields:[{type:"toggle",name:"isPowerSaving",label:"Enable power saving mode",description:"Select if powered from a low-current source (i.e. solar), to minimize power consumption as much as possible."},{type:"number",name:"onBatteryShutdownAfterSecs",label:"Shutdown on battery delay",description:"Automatically shutdown node after this long when on battery, 0 for indefinite",properties:{suffix:"Seconds"}},{type:"number",name:"adcMultiplierOverride",label:"ADC Multiplier Override ratio",description:"Used for tweaking battery voltage reading",properties:{step:1e-4}},{type:"number",name:"waitBluetoothSecs",label:"No Connection Bluetooth Disabled",description:"If the device does not receive a Bluetooth connection, the BLE radio will be disabled after this long",properties:{suffix:"Seconds"}},{type:"number",name:"deviceBatteryInaAddress",label:"INA219 Address",description:"Address of the INA219 battery monitor"}]},{label:"Sleep Settings",description:"Sleep settings for the power module",fields:[{type:"number",name:"sdsSecs",label:"Super Deep Sleep Duration",description:"How long the device will be in super deep sleep for",properties:{suffix:"Seconds"}},{type:"number",name:"lsSecs",label:"Light Sleep Duration",description:"How long the device will be in light sleep for",properties:{suffix:"Seconds"}},{type:"number",name:"minWakeSecs",label:"Minimum Wake Time",description:"Minimum amount of time the device will stay awake for after receiving a packet",properties:{suffix:"Seconds"}}]}]})};var Zh="Dialog",[AC,P7]=Pr(Zh),[gI,Bn]=AC(Zh),RC=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,s=m.useRef(null),l=m.useRef(null),[c=!1,u]=go({prop:r,defaultProp:o,onChange:a});return f.jsx(gI,{scope:t,triggerRef:s,contentRef:l,contentId:fo(),titleId:fo(),descriptionId:fo(),open:c,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(d=>!d),[u]),modal:i,children:n})};RC.displayName=Zh;var IC="DialogTrigger",vI=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bn(IC,n),a=$e(t,o.triggerRef);return f.jsx(xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":tg(o.open),...r,ref:a,onClick:we(e.onClick,o.onOpenToggle)})});vI.displayName=IC;var Jh="DialogPortal",[yI,OC]=AC(Jh,{forceMount:void 0}),DC=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=Bn(Jh,t);return f.jsx(yI,{scope:t,forceMount:n,children:m.Children.map(r,i=>f.jsx(ua,{present:n||a.open,children:f.jsx(ld,{asChild:!0,container:o,children:i})}))})};DC.displayName=Jh;var _u="DialogOverlay",LC=m.forwardRef((e,t)=>{const n=OC(_u,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=Bn(_u,e.__scopeDialog);return a.modal?f.jsx(ua,{present:r||a.open,children:f.jsx(bI,{...o,ref:t})}):null});LC.displayName=_u;var bI=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bn(_u,n);return f.jsx(Vh,{as:Ti,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(xe.div,{"data-state":tg(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ra="DialogContent",jC=m.forwardRef((e,t)=>{const n=OC(ra,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=Bn(ra,e.__scopeDialog);return f.jsx(ua,{present:r||a.open,children:a.modal?f.jsx(wI,{...o,ref:t}):f.jsx(_I,{...o,ref:t})})});jC.displayName=ra;var wI=m.forwardRef((e,t)=>{const n=Bn(ra,e.__scopeDialog),r=m.useRef(null),o=$e(t,n.contentRef,r);return m.useEffect(()=>{const a=r.current;if(a)return Bh(a)},[]),f.jsx(FC,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:we(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,s=i.button===0&&i.ctrlKey===!0;(i.button===2||s)&&a.preventDefault()}),onFocusOutside:we(e.onFocusOutside,a=>a.preventDefault())})}),_I=m.forwardRef((e,t)=>{const n=Bn(ra,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return f.jsx(FC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=a.target;n.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),FC=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,s=Bn(ra,n),l=m.useRef(null),c=$e(t,l);return Yx(),f.jsxs(f.Fragment,{children:[f.jsx(Nh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:f.jsx(ad,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":tg(s.open),...i,ref:c,onDismiss:()=>s.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(xI,{titleId:s.titleId}),f.jsx(CI,{contentRef:l,descriptionId:s.descriptionId})]})]})}),eg="DialogTitle",BC=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bn(eg,n);return f.jsx(xe.h2,{id:o.titleId,...r,ref:t})});BC.displayName=eg;var $C="DialogDescription",UC=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bn($C,n);return f.jsx(xe.p,{id:o.descriptionId,...r,ref:t})});UC.displayName=$C;var VC="DialogClose",zC=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bn(VC,n);return f.jsx(xe.button,{type:"button",...r,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});zC.displayName=VC;function tg(e){return e?"open":"closed"}var HC="DialogTitleWarning",[M7,WC]=NP(HC,{contentName:ra,titleName:eg,docsSlug:"dialog"}),xI=({titleId:e})=>{const t=WC(HC),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},kI="DialogDescriptionWarning",CI=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${WC(kI).contentName}}.`;return m.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},SI=RC,GC=DC,KC=LC,qC=jC,XC=BC,YC=UC,TI=zC;const Ar=SI,QC=({children:e,...t})=>f.jsx(GC,{...t,children:f.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center sm:items-center",children:e})});QC.displayName=GC.displayName;const ZC=m.forwardRef(({className:e,children:t,...n},r)=>f.jsx(KC,{className:Ee("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm transition-opacity animate-in fade-in",e),...n,ref:r}));ZC.displayName=KC.displayName;const tr=m.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(QC,{children:[f.jsx(ZC,{}),f.jsxs(qC,{ref:r,className:Ee("fixed z-50 grid w-full scale-100 gap-4 bg-white p-6 opacity-100 animate-in fade-in-90 slide-in-from-bottom-10 sm:max-w-lg sm:rounded-lg sm:zoom-in-90 sm:slide-in-from-bottom-0","dark:bg-slate-900",e),...n,children:[t,f.jsxs(TI,{className:"absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-slate-100 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=open]:bg-slate-800",children:[f.jsx(yC,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));tr.displayName=qC.displayName;const Rr=({className:e,...t})=>f.jsx("div",{className:Ee("flex flex-col space-y-2 text-center sm:text-left",e),...t});Rr.displayName="DialogHeader";const $i=({className:e,...t})=>f.jsx("div",{className:Ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});$i.displayName="DialogFooter";const Ir=m.forwardRef(({className:e,...t},n)=>f.jsx(XC,{ref:n,className:Ee("text-lg font-semibold text-slate-900","dark:text-slate-50",e),...t}));Ir.displayName=XC.displayName;const To=m.forwardRef(({className:e,...t},n)=>f.jsx(YC,{ref:n,className:Ee("text-sm text-slate-500","dark:text-slate-400",e),...t}));To.displayName=YC.displayName;const EI=({open:e,onOpenChange:t,onSubmit:n})=>f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Regenerate Key pair?"}),f.jsx(To,{children:"Are you sure you want to regenerate key pair?"})]}),f.jsx($i,{children:f.jsx(pt,{variant:"destructive",onClick:()=>n(),children:"Regenerate"})})]})}),Ef=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */new Uint8Array(new Uint32Array([287454020]).buffer)[0];function NI(e=32){if(Ef&&typeof Ef.getRandomValues=="function")return Ef.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const PI=BigInt(0);function ng(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function JC(e){if(!ng(e))throw new Error("Uint8Array expected")}const MI=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function AI(e){JC(e);let t="";for(let n=0;n=cr._0&&e<=cr._9)return e-cr._0;if(e>=cr._A&&e<=cr._F)return e-(cr._A-10);if(e>=cr._a&&e<=cr._f)return e-(cr._a-10)}function eS(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,a=0;otypeof e=="bigint"&&PI<=e;function DI(e,t,n){return Nf(e)&&Nf(t)&&Nf(n)&&t<=e&&etypeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||ng(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function jI(e,t,n={}){const r=(o,a,i)=>{const s=LI[a];if(typeof s!="function")throw new Error(`Invalid validator "${a}", expected function`);const l=e[o];if(!(i&&l===void 0)&&!s(l,e))throw new Error(`Invalid param ${String(o)}=${l} (${typeof l}), expected ${a}`)};for(const[o,a]of Object.entries(t))r(o,a,!1);for(const[o,a]of Object.entries(n))r(o,a,!0);return e}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const oi=BigInt(0),rc=BigInt(1);BigInt(2);BigInt(3);BigInt(4);BigInt(5);BigInt(8);BigInt(9);BigInt(16);function tS(e,t){const n=e%t;return n>=oi?n:t+n}function FI(e,t,n){if(n<=oi||t 0");if(n===rc)return oi;let r=rc;for(;t>oi;)t&rc&&(r=r*e%n),e=e*e%n,t>>=rc;return r}function Pn(e,t,n){let r=e;for(;t-- >oi;)r*=r,r%=n;return r}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const $a=BigInt(0),Pf=BigInt(1);function BI(e){return jI(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})}function $I(e){const t=BI(e),{P:n}=t,r=y=>tS(y,n),o=t.montgomeryBits,a=Math.ceil(o/8),i=t.nByteLength,s=t.adjustScalarBytes||(y=>y),l=t.powPminus2||(y=>FI(y,n-BigInt(2),n));function c(y,x,E){const w=r(y*(x-E));return x=r(x-w),E=r(E+w),[x,E]}const u=(t.a-BigInt(2))/BigInt(4);function d(y,x){Qy("u",y,$a,n),Qy("scalar",x,$a,n);const E=x,w=y;let T=Pf,k=$a,C=y,P=Pf,O=$a,R;for(let B=BigInt(o-1);B>=$a;B--){const D=E>>B&Pf;O^=D,R=c(O,T,C),T=R[0],C=R[1],R=c(O,k,P),k=R[0],P=R[1],O=D;const L=T+k,G=r(L*L),Y=T-k,K=r(Y*Y),Z=G-K,re=C+P,fe=C-P,U=r(fe*L),ae=r(re*Y),se=U+ae,S=U-ae;C=r(se*se),P=r(w*r(S*S)),T=r(G*K),k=r(Z*(G+r(u*Z)))}R=c(O,T,C),T=R[0],C=R[1],R=c(O,k,P),k=R[0],P=R[1];const N=l(k);return r(T*N)}function p(y){return OI(r(y),a)}function g(y){const x=Yy("u coordinate",y,a);return i===32&&(x[31]&=127),Xy(x)}function v(y){const x=Yy("scalar",y),E=x.length;if(E!==a&&E!==i)throw new Error(`Expected ${a} or ${i} bytes, got ${E}`);return Xy(s(x))}function h(y,x){const E=g(x),w=v(y),T=d(E,w);if(T===$a)throw new Error("Invalid private or public key received");return p(T)}const _=p(t.Gu);function b(y){return h(y,_)}return{scalarMult:h,scalarMultBase:b,getSharedSecret:(y,x)=>h(y,x),getPublicKey:y=>b(y),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:_}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const up=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);const UI=BigInt(1),Zy=BigInt(2),VI=BigInt(3),zI=BigInt(5);BigInt(8);function HI(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),o=BigInt(80),a=up,s=e*e%a*e%a,l=Pn(s,Zy,a)*s%a,c=Pn(l,UI,a)*e%a,u=Pn(c,zI,a)*c%a,d=Pn(u,t,a)*u%a,p=Pn(d,n,a)*d%a,g=Pn(p,r,a)*p%a,v=Pn(g,o,a)*g%a,h=Pn(v,o,a)*g%a,_=Pn(h,t,a)*u%a;return{pow_p_5_8:Pn(_,Zy,a)*e%a,b2:s}}function WI(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const nS=$I({P:up,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=up,{pow_p_5_8:n,b2:r}=HI(e);return tS(Pn(n,VI,t)*r,t)},adjustScalarBytes:WI,randomBytes:NI});function GI(){const e=nS.utils.randomPrivateKey();return e[0]&=248,e[31]&=127,e[31]|=64,e}function Jy(e){return nS.getPublicKey(e)}const KI=()=>{const{config:e,nodes:t,hardware:n,setWorkingConfig:r}=Te(),[o,a]=m.useState(fr(e.security?.privateKey??new Uint8Array(0))),[i,s]=m.useState(!1),[l,c]=m.useState(e.security?.privateKey.length??32),[u,d]=m.useState(),[p,g]=m.useState(fr(e.security?.publicKey??new Uint8Array(0))),[v,h]=m.useState(fr(e.security?.adminKey[0]??new Uint8Array(0))),[_,b]=m.useState(),[y,x]=m.useState(!1),E=R=>{u||_||r(new pe.Config.Config({payloadVariant:{case:"security",value:{...R,adminKey:[Jr(v)],privateKey:Jr(o),publicKey:Jr(p)}}}))},w=(R,N,B)=>{try{R.length%4!==0||Jr(R).length!==N?B(`Please enter a valid ${N*8} bit PSK.`):B(void 0)}catch(D){console.error(D),B(`Please enter a valid ${N*8} bit PSK.`)}},T=()=>{x(!0)},k=()=>{const R=GI(),N=Jy(R);a(fr(R)),g(fr(N)),w(fr(R),l,d),x(!1)},C=R=>{const N=R.target.value;a(N),w(N,l,d);const B=Jy(Jr(N));g(fr(B))},P=R=>{const N=R.currentTarget?.value;h(N),w(N,l,b)},O=R=>{const N=Number.parseInt(R);c(N),w(o,N,d)};return f.jsxs(f.Fragment,{children:[f.jsx(at,{onSubmit:E,submitType:"onChange",defaultValues:{...e.security,adminKey:v,privateKey:o,publicKey:p,adminChannelEnabled:e.security?.adminChannelEnabled??!1,isManaged:e.security?.isManaged??!1,debugLogApiEnabled:e.security?.debugLogApiEnabled??!1,serialEnabled:e.security?.serialEnabled??!1},fieldGroups:[{label:"Security Settings",description:"Settings for the Security configuration",fields:[{type:"passwordGenerator",name:"privateKey",label:"Private Key",description:"Used to create a shared key with a remote device",bits:[{text:"256 bit",value:"32",key:"bit256"}],validationText:u,devicePSKBitCount:l,inputChange:C,selectChange:O,hide:!i,buttonClick:T,properties:{value:o,action:{icon:i?QR:ZR,onClick:()=>s(!i)}}},{type:"text",name:"publicKey",label:"Public Key",disabled:!0,description:"Sent out to other nodes on the mesh to allow them to compute a shared secret key",properties:{value:p}}]},{label:"Admin Settings",description:"Settings for Admin",fields:[{type:"toggle",name:"adminChannelEnabled",label:"Allow Legacy Admin",description:"Allow incoming device control over the insecure legacy admin channel"},{type:"toggle",name:"isManaged",label:"Managed",description:'If true, device is considered to be "managed" by a mesh administrator via admin messages'},{type:"text",name:"adminKey",label:"Admin Key",description:"The public key authorized to send admin messages to this node",validationText:_,inputChange:P,disabledBy:[{fieldName:"adminChannelEnabled",invert:!0}],properties:{value:v}}]},{label:"Logging Settings",description:"Settings for Logging",fields:[{type:"toggle",name:"debugLogApiEnabled",label:"Enable Debug Log API",description:"Output live debug logging over serial, view and export position-redacted device logs over Bluetooth"},{type:"toggle",name:"serialEnabled",label:"Serial Output Enabled",description:"Serial Console over the Stream API"}]}]}),f.jsx(EI,{open:y,onOpenChange:()=>x(!1),onSubmit:()=>k()})]})},qI=()=>{Te();const e=[{label:"Device",element:uI,count:0},{label:"Position",element:mI},{label:"Power",element:hI},{label:"Network",element:pI},{label:"Display",element:dI},{label:"LoRa",element:fI},{label:"Bluetooth",element:cI},{label:"Security",element:KI}];return f.jsxs(od,{defaultValue:"Device",children:[f.jsx(cl,{children:e.map(t=>f.jsx(ul,{value:t.label,children:t.label},t.label))}),e.map(t=>f.jsx(dl,{value:t.label,children:f.jsx(t.element,{})},t.label))]})},XI=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"ambientLighting",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.ambientLighting,fieldGroups:[{label:"Ambient Lighting Settings",description:"Settings for the Ambient Lighting module",fields:[{type:"toggle",name:"ledState",label:"LED State",description:"Sets LED to on or off"},{type:"number",name:"current",label:"Current",description:"Sets the current for the LED output. Default is 10"},{type:"number",name:"red",label:"Red",description:"Sets the red LED level. Values are 0-255"},{type:"number",name:"green",label:"Green",description:"Sets the green LED level. Values are 0-255"},{type:"number",name:"blue",label:"Blue",description:"Sets the blue LED level. Values are 0-255"}]}]})},YI=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"detectionSensor",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.detectionSensor,fieldGroups:[{label:"Detection Sensor Settings",description:"Settings for the Detection Sensor module",fields:[{type:"toggle",name:"enabled",label:"Enabled",description:"Enable or disable Detection Sensor Module"},{type:"number",name:"minimumBroadcastSecs",label:"Minimum Broadcast Seconds",description:"The interval in seconds of how often we can send a message to the mesh when a state change is detected",properties:{suffix:"Seconds"},disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"stateBroadcastSecs",label:"State Broadcast Seconds",description:"The interval in seconds of how often we should send a message to the mesh with the current state regardless of changes",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"sendBell",label:"Send Bell",description:"Send ASCII bell with alert message",disabledBy:[{fieldName:"enabled"}]},{type:"text",name:"name",label:"Friendly Name",description:"Used to format the message sent to mesh, max 20 Characters",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"monitorPin",label:"Monitor Pin",description:"The GPIO pin to monitor for state changes",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"detectionTriggeredHigh",label:"Detection Triggered High",description:"Whether or not the GPIO pin state detection is triggered on HIGH (1), otherwise LOW (0)",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"usePullup",label:"Use Pullup",description:"Whether or not use INPUT_PULLUP mode for GPIO pin",disabledBy:[{fieldName:"enabled"}]}]}]})},QI=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"neighborInfo",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.neighborInfo,fieldGroups:[{label:"Neighbor Info Settings",description:"Settings for the Neighbor Info module",fields:[{type:"toggle",name:"enabled",label:"Enabled",description:"Enable or disable Neighbor Info Module"},{type:"number",name:"updateInterval",label:"Update Interval",description:"Interval in seconds of how often we should try to send our Neighbor Info to the mesh",properties:{suffix:"Seconds"},disabledBy:[{fieldName:"enabled"}]}]}]})},ZI=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"audio",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.audio,fieldGroups:[{label:"Audio Settings",description:"Settings for the Audio module",fields:[{type:"toggle",name:"codec2Enabled",label:"Codec 2 Enabled",description:"Enable Codec 2 audio encoding"},{type:"number",name:"pttPin",label:"PTT Pin",description:"GPIO pin to use for PTT"},{type:"select",name:"bitrate",label:"Bitrate",description:"Bitrate to use for audio encoding",properties:{enumValue:pe.ModuleConfig.ModuleConfig_AudioConfig_Audio_Baud}},{type:"number",name:"i2sWs",label:"i2S WS",description:"GPIO pin to use for i2S WS"},{type:"number",name:"i2sSd",label:"i2S SD",description:"GPIO pin to use for i2S SD"},{type:"number",name:"i2sDin",label:"i2S DIN",description:"GPIO pin to use for i2S DIN"},{type:"number",name:"i2sSck",label:"i2S SCK",description:"GPIO pin to use for i2S SCK"}]}]})},JI=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"cannedMessage",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.cannedMessage,fieldGroups:[{label:"Canned Message Settings",description:"Settings for the Canned Message module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable Canned Message"},{type:"toggle",name:"rotary1Enabled",label:"Rotary Encoder #1 Enabled",description:"Enable the rotary encoder"},{type:"number",name:"inputbrokerPinA",label:"Encoder Pin A",description:"GPIO Pin Value (1-39) For encoder port A"},{type:"number",name:"inputbrokerPinB",label:"Encoder Pin B",description:"GPIO Pin Value (1-39) For encoder port B"},{type:"number",name:"inputbrokerPinPress",label:"Encoder Pin Press",description:"GPIO Pin Value (1-39) For encoder Press"},{type:"select",name:"inputbrokerEventCw",label:"Clockwise event",description:"Select input event.",properties:{enumValue:pe.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar}},{type:"select",name:"inputbrokerEventCcw",label:"Counter Clockwise event",description:"Select input event.",properties:{enumValue:pe.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar}},{type:"select",name:"inputbrokerEventPress",label:"Press event",description:"Select input event",properties:{enumValue:pe.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar}},{type:"toggle",name:"updown1Enabled",label:"Up Down enabled",description:"Enable the up / down encoder"},{type:"text",name:"allowInputSource",label:"Allow Input Source",description:"Select from: '_any', 'rotEnc1', 'upDownEnc1', 'cardkb'"},{type:"toggle",name:"sendBell",label:"Send Bell",description:"Sends a bell character with each message"}]}]})},eO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"externalNotification",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.externalNotification,fieldGroups:[{label:"External Notification Settings",description:"Configure the external notification module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable External Notification"},{type:"number",name:"outputMs",label:"Output MS",description:"Output MS",disabledBy:[{fieldName:"enabled"}],properties:{suffix:"ms"}},{type:"number",name:"output",label:"Output",description:"Output",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"outputVibra",label:"Output Vibrate",description:"Output Vibrate",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"outputBuzzer",label:"Output Buzzer",description:"Output Buzzer",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"active",label:"Active",description:"Active",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertMessage",label:"Alert Message",description:"Alert Message",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertMessageVibra",label:"Alert Message Vibrate",description:"Alert Message Vibrate",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertMessageBuzzer",label:"Alert Message Buzzer",description:"Alert Message Buzzer",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertBell",label:"Alert Bell",description:"Should an alert be triggered when receiving an incoming bell?",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertBellVibra",label:"Alert Bell Vibrate",description:"Alert Bell Vibrate",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"alertBellBuzzer",label:"Alert Bell Buzzer",description:"Alert Bell Buzzer",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"usePwm",label:"Use PWM",description:"Use PWM",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"nagTimeout",label:"Nag Timeout",description:"Nag Timeout",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"useI2sAsBuzzer",label:"Use I²S Pin as Buzzer",description:"Designate I²S Pin as Buzzer Output",disabledBy:[{fieldName:"enabled"}]}]}]})},tO=()=>{const{config:e,moduleConfig:t,setWorkingModuleConfig:n}=Te(),r=o=>{n(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"mqtt",value:{...o,mapReportSettings:new pe.ModuleConfig.ModuleConfig_MapReportSettings(o.mapReportSettings)}}}))};return f.jsx(at,{onSubmit:r,defaultValues:t.mqtt,fieldGroups:[{label:"MQTT Settings",description:"Settings for the MQTT module",fields:[{type:"toggle",name:"enabled",label:"Enabled",description:"Enable or disable MQTT"},{type:"text",name:"address",label:"MQTT Server Address",description:"MQTT server address to use for default/custom servers",disabledBy:[{fieldName:"enabled"}]},{type:"text",name:"username",label:"MQTT Username",description:"MQTT username to use for default/custom servers",disabledBy:[{fieldName:"enabled"}]},{type:"password",name:"password",label:"MQTT Password",description:"MQTT password to use for default/custom servers",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"encryptionEnabled",label:"Encryption Enabled",description:"Enable or disable MQTT encryption. Note: All messages are sent to the MQTT broker unencrypted if this option is not enabled, even when your uplink channels have encryption keys set. This includes position data.",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"jsonEnabled",label:"JSON Enabled",description:"Whether to send/consume JSON packets on MQTT",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"tlsEnabled",label:"TLS Enabled",description:"Enable or disable TLS",disabledBy:[{fieldName:"enabled"}]},{type:"text",name:"root",label:"Root topic",description:"MQTT root topic to use for default/custom servers",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"proxyToClientEnabled",label:"Proxy to Client Enabled",description:"Use the client's internet connection for MQTT (feature only active in mobile apps)",disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"mapReportingEnabled",label:"Map Reporting Enabled",description:"Enable or disable map reporting",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"mapReportSettings.publishIntervalSecs",label:"Map Report Publish Interval (s)",description:"Interval in seconds to publish map reports",properties:{suffix:"Seconds"},disabledBy:[{fieldName:"enabled"},{fieldName:"mapReportingEnabled"}]},{type:"select",name:"mapReportSettings.positionPrecision",label:"Approximate Location",description:"Position shared will be accurate within this distance",properties:{enumValue:e.display?.units===0?{"Within 23 km":10,"Within 12 km":11,"Within 5.8 km":12,"Within 2.9 km":13,"Within 1.5 km":14,"Within 700 m":15,"Within 350 m":16,"Within 200 m":17,"Within 90 m":18,"Within 50 m":19}:{"Within 15 miles":10,"Within 7.3 miles":11,"Within 3.6 miles":12,"Within 1.8 miles":13,"Within 0.9 miles":14,"Within 0.5 miles":15,"Within 0.2 miles":16,"Within 600 feet":17,"Within 300 feet":18,"Within 150 feet":19}},disabledBy:[{fieldName:"enabled"},{fieldName:"mapReportingEnabled"}]}]}]})},nO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"paxcounter",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.paxcounter,fieldGroups:[{label:"Paxcounter Settings",description:"Settings for the Paxcounter module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable Paxcounter"},{type:"number",name:"paxcounterUpdateInterval",label:"Update Interval (seconds)",description:"How long to wait between sending paxcounter packets",properties:{suffix:"Seconds"},disabledBy:[{fieldName:"enabled"}]}]}]})},rO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"rangeTest",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.rangeTest,fieldGroups:[{label:"Range Test Settings",description:"Settings for the Range Test module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable Range Test"},{type:"number",name:"sender",label:"Message Interval",description:"How long to wait between sending test packets",properties:{suffix:"Seconds"},disabledBy:[{fieldName:"enabled"}]},{type:"toggle",name:"save",label:"Save CSV to storage",description:"ESP32 Only",disabledBy:[{fieldName:"enabled"}]}]}]})},oO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"serial",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.serial,fieldGroups:[{label:"Serial Settings",description:"Settings for the Serial module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable Serial output"},{type:"toggle",name:"echo",label:"Echo",description:"Any packets you send will be echoed back to your device",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"rxd",label:"Receive Pin",description:"Set the GPIO pin to the RXD pin you have set up.",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"txd",label:"Transmit Pin",description:"Set the GPIO pin to the TXD pin you have set up.",disabledBy:[{fieldName:"enabled"}]},{type:"select",name:"baud",label:"Baud Rate",description:"The serial baud rate",disabledBy:[{fieldName:"enabled"}],properties:{enumValue:pe.ModuleConfig.ModuleConfig_SerialConfig_Serial_Baud}},{type:"number",name:"timeout",label:"Timeout",description:"Seconds to wait before we consider your packet as 'done'",disabledBy:[{fieldName:"enabled"}],properties:{suffix:"Seconds"}},{type:"select",name:"mode",label:"Mode",description:"Select Mode",disabledBy:[{fieldName:"enabled"}],properties:{enumValue:pe.ModuleConfig.ModuleConfig_SerialConfig_Serial_Mode,formatEnumName:!0}},{type:"toggle",name:"overrideConsoleSerialPort",label:"Override Console Serial Port",description:"If you have a serial port connected to the console, this will override it."}]}]})},aO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"storeForward",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.storeForward,fieldGroups:[{label:"Store & Forward Settings",description:"Settings for the Store & Forward module",fields:[{type:"toggle",name:"enabled",label:"Module Enabled",description:"Enable Store & Forward"},{type:"toggle",name:"heartbeat",label:"Heartbeat Enabled",description:"Enable Store & Forward heartbeat",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"records",label:"Number of records",description:"Number of records to store",disabledBy:[{fieldName:"enabled"}],properties:{suffix:"Records"}},{type:"number",name:"historyReturnMax",label:"History return max",description:"Max number of records to return",disabledBy:[{fieldName:"enabled"}]},{type:"number",name:"historyReturnWindow",label:"History return window",description:"Max number of records to return",disabledBy:[{fieldName:"enabled"}]}]}]})},iO=()=>{const{moduleConfig:e,setWorkingModuleConfig:t}=Te(),n=r=>{t(new pe.ModuleConfig.ModuleConfig({payloadVariant:{case:"telemetry",value:r}}))};return f.jsx(at,{onSubmit:n,defaultValues:e.telemetry,fieldGroups:[{label:"Telemetry Settings",description:"Settings for the Telemetry module",fields:[{type:"number",name:"deviceUpdateInterval",label:"Query Interval",description:"Interval to get telemetry data",properties:{suffix:"Seconds"}},{type:"number",name:"environmentUpdateInterval",label:"Update Interval",description:"How often to send Metrics over the mesh",properties:{suffix:"Seconds"}},{type:"toggle",name:"environmentMeasurementEnabled",label:"Module Enabled",description:"Enable the Environment Telemetry"},{type:"toggle",name:"environmentScreenEnabled",label:"Displayed on Screen",description:"Show the Telemetry Module on the OLED"},{type:"toggle",name:"environmentDisplayFahrenheit",label:"Display Fahrenheit",description:"Display temp in Fahrenheit"},{type:"toggle",name:"airQualityEnabled",label:"Air Quality Enabled",description:"Enable the Air Quality Telemetry"},{type:"number",name:"airQualityInterval",label:"Air Quality Update Interval",description:"How often to send Air Quality data over the mesh"},{type:"toggle",name:"powerMeasurementEnabled",label:"Power Measurement Enabled",description:"Enable the Power Measurement Telemetry"},{type:"number",name:"powerUpdateInterval",label:"Power Update Interval",description:"How often to send Power data over the mesh"},{type:"toggle",name:"powerScreenEnabled",label:"Power Screen Enabled",description:"Enable the Power Telemetry Screen"}]}]})},sO=()=>{const e=[{label:"MQTT",element:tO},{label:"Serial",element:oO},{label:"Ext Notif",element:eO},{label:"S&F",element:aO},{label:"Range Test",element:rO},{label:"Telemetry",element:iO},{label:"Canned",element:JI},{label:"Audio",element:ZI},{label:"Neighbor Info",element:QI},{label:"Ambient Lighting",element:XI},{label:"Detection Sensor",element:YI},{label:"Paxcounter",element:nO}];return f.jsxs(od,{defaultValue:"MQTT",children:[f.jsx(cl,{children:e.map(t=>f.jsx(ul,{value:t.label,children:t.label},t.label))}),e.map(t=>f.jsx(dl,{value:t.label,children:f.jsx(t.element,{})},t.label))]})},lO=()=>{const{workingConfig:e,workingModuleConfig:t,connection:n}=Te(),[r,o]=m.useState("device"),{toast:a}=hd();return f.jsxs(f.Fragment,{children:[f.jsx(vl,{children:f.jsxs(qs,{label:"Config Sections",children:[f.jsx(Ni,{label:"Radio Config",active:r==="device",onClick:()=>o("device"),Icon:Wh}),f.jsx(Ni,{label:"Module Config",active:r==="module",onClick:()=>o("module"),Icon:HR})]})}),f.jsx(gd,{label:r==="device"?"Radio Config":"Module Config",actions:[{icon:c6,async onClick(){r==="device"?e.map(async i=>await n?.setConfig(i).then(()=>a({title:`Config ${i.payloadVariant.case} saved`}))):t.map(async i=>await n?.setModuleConfig(i).then(()=>a({title:`Config ${i.payloadVariant.case} saved`}))),await n?.commitEditSettings()}}],children:r==="device"?f.jsx(qI,{}):f.jsx(sO,{})})]})},$n=i2()(e=>({selectedDevice:0,devices:[],currentPage:"messages",rasterSources:[],commandPaletteOpen:!1,darkMode:localStorage.getItem("theme-dark")!==null?localStorage.getItem("theme-dark")==="true":window.matchMedia("(prefers-color-scheme: dark)").matches,accent:"orange",connectDialogOpen:!1,nodeNumToBeRemoved:0,setRasterSources:t=>{e(Ie(n=>{n.rasterSources=t}))},addRasterSource:t=>{e(Ie(n=>{n.rasterSources.push(t)}))},removeRasterSource:t=>{e(Ie(n=>{n.rasterSources.splice(t,1)}))},setSelectedDevice:t=>e(()=>({selectedDevice:t})),addDevice:t=>e(n=>({devices:[...n.devices,t]})),removeDevice:t=>e(n=>({devices:n.devices.filter(r=>r.id!==t)})),setCommandPaletteOpen:t=>{e(Ie(n=>{n.commandPaletteOpen=t}))},setDarkMode:t=>{localStorage.setItem("theme-dark",t.toString()),e(Ie(n=>{n.darkMode=t}))},setNodeNumToBeRemoved:t=>e(n=>({nodeNumToBeRemoved:t})),setAccent(t){e(Ie(n=>{n.accent=t}))},setConnectDialogOpen:t=>{e(Ie(n=>{n.connectDialogOpen=t}))}}));var da={},vd={},yd={},rS={},bd={};bd.__esModule=!0;bd.StandardFigures=void 0;bd.StandardFigures=[[0,8,9,9,9,9,0,8,8,0,0,0,9,9,8,8,0,0,0,9,9,0,8,9,9,9,9,0],[0,0,0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,9,8,0,8,9,0,0,0,0,8,0,0,0,0,0,0,9,0,0,0],[0,0,0,9,0,0,0,0,0,0,8,0,0,0,0,9,8,0,8,9,0,0,0,0,0,0,0,0],[0,0,0,9,0,0,0,0,0,0,8,0,0,0,0,0,0,8,0,0,0,0,0,0,9,0,0,0],[0,0,0,0,0,9,0,0,0,0,0,0,8,0,0,0,0,0,0,8,0,0,0,0,0,0,9,0],[0,9,0,0,0,0,0,0,8,0,0,0,0,0,0,8,0,0,0,0,0,0,9,0,0,0,0,0],[0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0],[0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0],[0,0,0,0,0,0,0,8,9,9,0,0,9,8,8,9,9,0,0,9,8,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,9,8,0,0,0,0,0,9,8,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,9,8,0,0,0,0,0,9,8,0,0,0,0,0,0,0,0,0],[0,9,9,9,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,9,9,9,9,9,0,9,0,0,0,0,0,9,9,9,0,0,0,9,9,0,9,9,0,9,9,0],[0,9,9,0,9,9,0,9,9,0,0,0,9,9,9,0,0,0,0,0,9,0,9,9,9,9,9,0],[0,9,0,0,0,9,0,0,0,0,9,0,0,0,0,0,0,9,0,0,0,0,9,0,0,0,9,0],[0,8,8,0,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,0,8,8,0],[0,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,9,0,0],[0,9,8,0,9,8,0,8,0,0,0,0,0,9,9,0,0,0,0,0,8,0,8,9,0,8,9,0],[0,9,9,0,9,9,0,9,0,8,9,9,0,9,9,0,8,9,9,0,9,0,9,9,0,9,9,0],[0,9,0,0,9,0,0,0,0,8,9,9,0,9,9,0,8,9,9,0,0,0,0,9,0,0,9,0],[0,0,0,0,0,0,0,0,9,8,0,0,0,0,0,9,8,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,9,0,0,0,8,0,0,9,0,0,0,8,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,9,9,9,9,9,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,9,0,9,0,0,0,9,9,9,9,0,0,0,9,9,9,0,0,0,0,0,9,0],[0,9,0,0,0,0,0,9,9,9,0,0,0,9,9,9,9,0,0,0,9,0,9,0,0,0,0,0],[0,9,0,0,9,9,0,9,9,9,0,0,9,9,9,9,9,0,0,9,9,0,9,0,0,9,9,0],[0,9,9,0,9,9,0,9,0,0,0,0,0,9,0,9,8,8,8,9,0,0,9,0,9,0,9,0],[0,9,0,9,0,9,0,0,9,8,8,8,9,0,9,0,0,0,0,0,9,0,9,9,0,9,9,0],[0,8,0,0,9,0,0,0,0,0,0,0,0,8,9,0,0,0,0,0,0,0,0,8,0,0,9,0],[0,0,9,0,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,9,0,9,0,0,8,0,0],[0,0,9,0,0,9,0,9,0,8,9,9,0,0,0,0,8,9,9,0,9,0,9,0,0,9,0,0],[0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,8,8,0,0,0,0,0,0,0],[0,0,0,9,0,0,0,9,0,9,9,9,0,9,9,0,9,9,9,0,9,0,0,0,9,0,0,0],[0,0,0,9,0,0,0,9,0,0,9,0,0,9,9,0,0,9,0,0,9,0,0,0,9,0,0,0],[0,9,9,9,9,9,0,9,9,9,9,9,9,9,9,9,9,0,9,9,9,0,9,0,0,0,9,0],[0,9,0,0,0,9,0,9,9,9,0,9,9,9,9,9,9,9,9,9,9,0,9,9,9,9,9,0],[0,0,0,0,0,0,0,0,0,9,9,9,0,0,0,0,9,0,9,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,9,9,9,0,0,0,0,9,9,9,0,0,0,0,0,0,0,0,0],[0,0,9,8,0,0,0,0,0,0,0,0,9,8,9,8,0,0,0,0,0,0,0,0,9,8,0,0],[0,0,0,0,0,0,0,0,9,8,0,0,0,0,0,0,0,0,9,8,0,0,0,0,0,0,0,0],[0,0,9,8,0,0,0,0,9,8,0,0,9,8,9,8,0,0,9,8,0,0,0,0,9,8,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,8,8,0],[0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0],[0,0,9,9,9,9,0,0,0,0,9,9,9,9,9,9,9,9,0,0,0,0,9,9,9,9,0,0],[0,9,0,0,9,0,0,9,9,9,0,0,0,0,0,0,0,0,9,9,9,0,0,0,0,0,9,0],[0,9,0,0,0,9,0,0,9,9,0,9,9,0,0,9,9,0,9,9,0,0,9,0,0,0,9,0],[0,0,9,9,0,0,0,0,9,9,9,9,9,9,9,9,9,9,9,9,0,0,0,0,9,9,0,0],[0,0,0,9,9,0,0,9,9,9,9,9,9,0,0,9,9,9,9,9,9,0,0,9,9,0,0,0],[0,9,0,9,0,9,0,0,9,9,9,9,9,0,0,9,9,9,9,9,0,0,9,0,9,0,9,0],[0,0,0,9,8,0,0,9,8,0,0,0,0,0,0,0,0,0,0,9,8,0,0,9,8,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,9,8,0,0,9,8,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,9,8,0,0,9,8,0,0,9,8,0,0,9,8,0,0,9,8,0,0,9,8,0,0,0],[0,8,8,0,0,9,0,8,8,0,0,9,9,0,8,0,0,9,9,0,0,0,0,9,9,0,0,0],[0,0,0,0,0,0,0,8,8,0,0,9,9,0,0,0,0,9,9,0,0,0,0,9,9,0,0,0],[0,8,8,9,9,0,0,8,8,9,9,0,0,0,0,0,0,8,8,9,9,0,0,8,8,9,9,0],[0,0,0,0,0,9,0,0,0,0,0,8,9,9,9,9,8,0,0,0,0,0,9,0,0,0,0,0],[0,9,9,0,9,9,0,9,9,0,8,0,9,9,9,0,8,0,8,0,9,0,9,9,9,9,9,0],[0,0,9,0,9,0,0,0,9,0,8,0,9,0,9,0,8,0,8,0,9,0,9,0,9,0,9,0],[0,9,0,9,0,9,0,9,0,8,0,8,0,9,0,9,0,8,0,9,0,0,0,9,0,9,0,0],[0,0,9,0,9,9,0,8,9,0,8,0,0,9,8,9,0,8,0,0,9,0,0,9,0,9,9,0],[0,9,9,0,9,9,0,8,9,0,8,0,0,9,8,9,0,8,0,0,9,0,9,9,0,9,9,0],[0,0,0,9,9,0,0,0,0,8,9,0,9,9,0,0,8,9,0,9,9,0,0,0,9,9,0,0],[0,0,0,0,0,0,0,9,9,9,8,8,8,0,0,0,0,9,8,0,0,0,0,9,9,0,0,0],[0,0,0,9,9,0,0,0,0,9,9,0,0,8,0,9,9,0,0,8,8,0,9,0,0,8,8,0],[0,0,0,0,0,0,0,9,9,9,9,9,8,8,0,0,0,0,0,9,8,0,0,0,0,9,9,0],[0,8,0,0,9,9,0,0,8,0,0,0,9,9,0,8,0,0,0,9,9,0,8,0,0,9,9,0],[0,8,0,0,0,9,0,0,0,0,0,0,9,9,0,0,0,0,0,9,9,0,8,0,0,0,9,0],[0,0,0,9,9,0,0,8,8,8,8,0,0,0,0,0,0,9,9,9,9,0,0,8,8,0,0,0],[0,0,0,9,0,0,0,0,0,0,8,8,8,8,9,9,9,9,0,0,0,0,0,0,8,0,0,0],[0,0,0,9,9,0,0,0,8,8,8,0,0,0,0,0,0,9,9,9,9,0,0,8,8,0,0,0],[0,9,9,9,9,0,0,0,0,8,8,0,0,0,0,0,0,9,9,0,0,0,0,8,8,8,8,0],[0,9,9,9,9,0,0,0,0,0,0,8,8,8,9,9,9,0,0,0,0,0,0,8,8,8,8,0],[0,0,9,9,0,0,0,8,9,0,9,8,0,0,8,9,0,9,8,0,0,0,0,9,9,0,0,0],[0,0,9,9,0,0,0,0,0,0,9,8,0,0,9,9,9,8,8,0,0,0,0,0,0,0,0,0],[0,8,8,0,0,0,0,8,8,0,0,0,0,9,8,0,0,0,0,9,9,0,0,0,0,9,9,0],[0,0,0,0,9,9,0,0,0,0,0,0,9,8,9,9,9,9,9,8,8,0,0,0,0,0,0,0],[0,0,8,0,9,0,0,0,0,8,0,9,0,0,0,0,8,0,9,0,0,0,0,8,0,9,0,0],[0,0,9,0,9,9,0,0,9,9,0,8,9,9,0,9,9,0,8,9,9,0,0,9,0,9,9,0],[0,8,9,0,9,9,0,0,8,9,0,9,9,0,0,8,9,0,9,9,0,0,8,9,0,9,9,0],[0,0,0,0,0,0,0,0,9,0,9,0,9,0,0,8,8,0,8,8,0,0,0,0,0,0,0,0],[0,0,0,9,0,9,0,8,9,0,9,0,9,8,8,9,0,9,0,9,8,0,0,0,9,0,9,0],[0,0,9,9,8,0,0,0,0,0,9,9,8,0,0,8,9,9,0,0,0,0,0,8,9,9,0,0],[0,8,9,9,9,9,0,8,8,8,0,0,0,0,0,0,0,0,8,8,8,0,9,9,9,9,8,0],[0,9,9,9,9,8,0,0,0,0,0,0,8,0,0,8,0,0,0,0,0,0,8,9,9,9,9,0],[0,0,0,0,0,0,0,9,9,0,0,0,0,0,0,0,0,0,0,8,8,0,0,0,0,0,0,0],[0,8,9,9,0,0,0,0,8,8,9,9,0,0,0,0,8,8,9,9,0,0,0,0,8,9,9,0],[0,0,0,0,0,0,0,0,9,9,9,0,0,0,0,0,0,8,8,8,0,0,0,0,0,0,0,0],[0,0,9,9,8,8,0,0,9,0,0,0,8,8,8,8,0,0,0,9,0,0,8,8,9,9,0,0],[0,0,0,8,9,9,0,0,0,0,8,0,9,9,9,9,0,8,0,0,0,0,9,9,8,0,0,0],[0,9,8,0,0,0,0,0,0,0,0,0,9,8,8,9,0,0,0,0,0,0,0,0,0,8,9,0],[0,0,0,0,9,8,0,9,8,0,0,0,0,0,0,0,0,0,0,9,8,0,9,8,0,0,0,0],[0,9,0,9,9,0,0,0,9,9,9,0,0,8,0,0,9,0,0,8,8,0,0,0,0,8,8,0],[0,0,8,9,9,0,0,0,8,9,9,0,0,0,0,0,0,9,9,8,0,0,0,9,9,8,0,0],[0,9,9,9,9,9,0,0,0,0,0,8,8,8,8,8,8,0,0,0,0,0,9,9,9,9,9,0],[0,8,9,9,9,9,0,0,8,0,0,0,0,0,0,0,0,0,0,8,0,0,9,9,9,9,8,0],[0,0,0,0,0,0,0,0,0,8,9,0,0,0,0,0,0,9,8,0,0,0,0,0,0,0,0,0],[0,8,9,0,9,8,0,9,8,0,0,0,8,9,9,8,0,0,0,8,9,0,8,9,0,9,8,0],[0,0,0,8,9,0,0,0,0,0,8,9,0,0,0,0,0,8,9,0,0,0,0,0,8,9,0,0],[0,0,8,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,9,0,0],[0,0,8,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,9,0,0],[0,9,0,8,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,8,0,9,0],[0,9,0,8,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,9,0,0,9,0,8,0,0,0],[0,8,0,9,9,0,0,0,8,9,9,0,9,9,9,9,0,9,8,8,0,0,0,9,9,0,9,0],[0,0,9,9,9,0,0,8,9,9,0,8,0,9,8,9,9,0,8,0,9,0,0,9,9,9,0,0],[0,0,9,9,0,9,0,8,0,9,0,8,9,0,8,0,9,0,8,9,0,0,0,9,9,0,9,0],[0,0,0,9,9,0,0,9,0,8,9,0,9,8,9,0,8,9,0,9,8,0,0,0,9,9,0,0],[0,0,0,9,9,0,0,9,0,8,9,8,9,0,9,0,8,9,8,9,0,0,0,0,9,9,0,0],[0,9,9,9,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8,0],[0,0,0,9,0,0,0,0,0,8,9,8,0,0,0,0,8,9,8,0,0,0,0,0,9,0,0,0],[0,0,9,8,9,0,0,0,0,8,0,9,0,0,0,0,8,0,9,0,0,0,0,9,8,9,0,0],[0,8,8,9,9,9,0,8,8,0,0,0,0,0,8,9,0,0,0,0,0,0,9,9,0,0,0,0],[0,9,9,0,0,0,0,8,9,0,0,0,0,0,8,8,0,0,0,0,0,0,8,8,9,9,9,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,0,0,8,8,0,9,0,0,8,8,0],[0,9,0,0,8,8,0,9,9,9,0,0,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,9,0,0,8,0,0,9,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,9,0,8,9,9,0,0,0,0,8,9,9,0,9,0,0,0,0,0,0,0],[0,8,8,0,9,9,0,8,0,0,9,0,0,9,9,0,0,9,0,0,8,0,9,9,0,8,8,0],[0,0,9,0,9,0,0,0,8,0,0,0,8,0,0,8,0,0,0,8,0,0,0,9,0,9,0,0],[0,9,0,0,0,8,0,8,9,0,0,0,8,8,8,8,0,0,0,9,8,0,8,0,0,0,9,0],[0,9,9,0,0,0,0,8,9,0,0,0,0,0,8,9,0,0,0,0,0,0,9,9,0,0,0,0],[0,8,8,0,9,9,0,0,8,0,0,0,9,0,0,9,0,0,0,8,0,0,9,9,0,8,8,0],[0,0,9,9,0,0,0,0,0,0,9,9,0,0,0,0,0,0,9,9,0,0,8,8,8,8,8,0],[0,8,8,8,8,8,0,0,0,0,0,9,9,0,0,0,0,9,9,0,0,0,0,9,9,0,0,0],[0,0,0,0,9,9,0,0,0,0,0,0,9,9,8,8,9,0,0,0,9,0,8,0,0,0,0,0],[0,8,0,0,9,9,0,9,8,8,0,0,9,9,0,0,0,0,0,0,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,9,0,0,0,0,0,9,0,0,9,0,0],[0,0,0,0,0,0,0,0,0,8,9,9,0,9,9,0,8,9,9,0,0,0,0,0,0,0,0,0],[0,0,9,0,9,0,0,9,0,0,0,0,0,9,8,0,0,0,0,0,8,0,0,8,0,8,0,0],[0,9,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,9,0],[0,0,9,0,9,0,0,8,0,0,0,0,0,9,8,0,0,0,0,0,9,0,0,9,0,9,0,0],[0,0,0,9,9,0,0,0,0,8,9,0,0,0,0,0,8,9,0,0,0,0,0,0,9,9,0,0],[0,0,9,0,9,0,0,0,0,0,0,0,8,0,0,0,0,0,0,8,0,0,0,9,0,9,0,0],[0,0,0,0,0,8,0,8,9,9,9,9,8,8,8,8,9,9,9,9,8,0,8,0,0,0,0,0],[0,0,0,0,0,9,0,0,0,8,8,8,8,8,9,8,8,9,9,0,0,0,8,0,0,0,0,0],[0,0,0,0,0,9,0,0,0,0,0,8,0,9,9,0,8,0,0,0,0,0,9,0,0,0,0,0],[0,0,0,8,8,8,0,0,0,0,0,0,9,9,9,9,0,0,0,0,0,0,8,8,8,0,0,0],[0,0,9,9,8,8,0,9,8,8,0,0,0,0,0,0,0,0,9,9,8,0,9,9,8,8,0,0],[0,0,9,9,9,9,0,8,8,0,0,0,0,0,0,0,0,0,0,8,8,0,9,9,9,9,0,0],[0,0,0,8,8,0,0,0,9,9,9,9,0,0,0,0,9,9,9,9,0,0,0,8,8,0,0,0],[0,0,0,8,9,9,0,0,9,9,8,0,0,0,0,0,0,8,9,9,0,0,9,9,8,0,0,0],[0,0,0,0,8,8,0,0,0,9,9,9,9,0,0,9,9,9,9,0,0,0,8,8,0,0,0,0],[0,0,0,0,0,9,0,0,0,0,0,8,9,0,0,0,0,0,8,9,0,0,0,0,0,0,9,0],[0,9,9,9,8,8,0,0,0,9,0,0,8,8,8,8,0,0,9,0,0,0,8,8,9,9,9,0],[0,8,0,0,0,0,0,8,8,9,9,9,9,9,8,9,9,9,9,9,9,0,0,0,0,0,8,0],[0,8,0,0,0,0,0,9,8,8,9,9,0,0,0,0,8,8,9,9,8,0,0,0,0,0,9,0],[0,9,0,0,0,0,0,9,0,8,0,0,0,0,0,0,0,0,8,0,9,0,0,0,0,0,9,0],[0,8,8,9,9,0,0,8,8,0,0,0,0,0,0,0,0,0,0,8,8,0,9,9,9,8,8,0],[0,9,9,9,9,0,0,0,0,0,0,8,9,9,9,8,8,0,0,0,0,0,0,9,9,9,9,0],[0,9,9,9,9,0,0,0,0,0,0,0,8,8,8,8,0,0,0,0,0,0,0,9,9,9,9,0],[0,0,8,8,0,0,0,0,0,9,9,9,9,0,0,9,9,9,9,0,0,0,0,0,8,8,0,0],[0,9,9,8,0,0,0,0,0,0,8,9,9,0,0,9,9,8,0,0,0,0,0,0,8,9,9,0],[0,9,9,0,0,0,0,0,9,8,9,9,0,0,0,0,8,9,9,8,0,0,0,0,0,8,8,0],[0,9,9,0,0,8,0,9,9,0,0,8,8,0,9,9,0,0,8,8,0,0,9,9,0,0,8,0],[0,8,9,9,9,9,0,8,8,0,0,9,0,0,0,0,9,0,0,8,8,0,9,9,9,8,8,0],[0,0,0,9,0,0,0,0,9,9,0,8,9,0,0,9,9,0,8,9,0,0,0,0,9,0,0,0],[0,0,0,0,0,0,0,8,8,0,9,0,9,0,0,9,0,9,0,8,8,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,9,0,9,0,8,8,8,8,0,9,0,9,0,0,0,0,0,0,0,0],[0,0,0,0,0,9,0,0,0,9,9,0,0,8,9,0,0,8,8,0,0,0,8,0,0,0,0,0],[0,8,0,0,0,0,0,9,0,0,8,8,0,0,0,0,9,9,0,0,8,0,0,0,0,0,9,0],[0,0,0,8,8,0,0,0,9,9,0,0,0,0,0,0,0,0,8,8,0,0,0,9,9,0,0,0],[0,0,8,8,0,0,0,0,0,0,0,9,9,0,0,8,8,0,0,0,0,0,0,0,9,9,0,0],[0,0,9,0,9,0,0,0,0,0,0,0,0,0,9,8,8,0,9,8,8,0,8,0,0,0,8,0],[0,8,0,0,0,8,0,9,8,8,0,9,8,8,0,0,0,0,0,0,0,0,0,9,0,9,0,0],[0,0,8,9,9,0,0,8,9,0,9,0,9,9,8,9,0,9,0,9,9,0,0,8,9,9,0,0],[0,0,0,0,0,9,0,0,9,8,0,0,9,8,0,9,8,0,0,9,8,0,0,0,0,0,9,0],[0,9,0,8,0,9,0,8,0,0,0,0,0,8,0,9,0,0,0,9,0,0,0,8,0,9,0,0],[0,0,9,0,9,0,0,0,8,0,0,0,8,0,9,0,0,0,0,0,9,0,9,0,8,0,9,0],[0,0,0,9,0,8,0,0,0,0,0,0,0,9,9,0,0,0,0,0,0,0,8,0,9,0,0,0],[0,0,0,0,0,0,0,9,0,0,0,0,0,9,0,8,0,0,0,8,0,0,0,9,0,9,0,0],[0,0,9,0,9,0,0,0,8,0,0,0,8,0,9,0,0,0,0,0,9,0,0,0,0,0,0,0],[0,0,8,9,9,0,0,8,9,9,0,8,9,9,8,9,9,0,8,9,9,0,0,8,9,9,0,0],[0,0,8,9,9,0,0,8,9,0,0,0,9,9,8,9,0,0,0,9,9,0,0,8,9,9,0,0],[0,0,9,0,9,0,0,8,9,9,0,8,9,9,8,9,9,0,8,9,9,0,0,9,0,9,0,0],[0,0,8,8,8,0,0,0,0,0,8,0,0,0,0,0,0,9,0,0,0,0,0,9,9,9,0,0],[0,0,0,0,0,0,0,8,9,9,0,8,9,9,8,9,9,0,8,9,9,0,0,0,0,0,0,0],[0,0,8,8,8,0,0,0,0,0,8,0,0,0,9,9,9,9,9,9,9,0,0,0,0,0,0,0],[0,0,0,0,9,9,0,0,0,0,0,0,9,8,0,0,0,0,0,9,8,0,0,0,0,9,9,0],[0,0,9,9,0,0,0,0,0,0,9,8,0,0,0,0,0,9,8,0,0,0,0,9,9,0,0,0],[0,9,0,0,0,0,0,0,9,8,0,0,0,0,0,9,8,0,0,0,0,0,9,0,0,0,0,0],[0,8,0,0,9,9,0,0,8,8,0,0,9,9,0,8,8,0,0,9,9,0,8,0,0,9,9,0],[0,0,0,0,9,9,0,0,9,9,0,8,9,9,0,9,9,0,8,9,9,0,0,0,0,9,9,0],[0,0,9,9,9,0,0,8,0,0,9,0,0,8,8,0,0,9,0,0,8,0,0,9,9,9,0,0],[0,0,9,0,9,0,0,0,9,9,0,8,9,0,0,9,9,0,8,9,0,0,0,9,0,9,0,0],[0,0,9,0,9,0,0,8,9,0,0,0,9,9,8,9,0,0,0,9,9,0,0,9,0,9,0,0],[0,0,9,9,9,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,9,8,9,9,9,8,9,0,0,0,0,0,0,0,0,8,8,8,8,8,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,9,9,9,0,0],[0,0,0,0,0,0,0,9,0,0,0,0,0,0,9,9,0,0,0,0,0,0,8,8,9,9,9,0],[0,9,0,0,0,0,0,0,9,9,0,0,0,0,0,0,8,8,9,9,9,0,0,0,0,0,0,0],[0,0,9,9,0,0,0,0,0,0,8,8,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,9,9,0,0,0,9,0,0,8,8,9,9,9,9,0,0,0,0,0,0,9,9,9,9,9,0],[0,0,9,9,9,0,0,0,8,8,9,8,8,0,0,8,8,9,8,8,0,0,0,9,9,9,0,0],[0,0,9,9,9,0,0,8,9,9,9,8,9,9,8,9,9,9,8,9,9,0,0,9,9,9,0,0],[0,8,9,0,9,9,0,0,8,9,0,0,9,8,0,0,9,9,0,9,8,0,0,0,9,9,9,0],[0,0,0,9,9,9,0,0,0,9,9,0,9,8,0,8,9,0,0,9,8,0,8,9,0,9,9,0],[0,0,9,9,9,0,0,0,0,0,9,0,0,0,8,8,8,0,9,9,9,0,8,0,0,0,9,0],[0,8,8,8,8,8,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,9,9,9,9,9,9,9,0,0,0,8,0,0,0,0,0,8,8,8,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,9,9,0,9,9,9,9,9,0],[0,0,0,0,0,9,0,0,0,0,0,9,9,0,9,9,9,8,8,0,0,0,0,0,0,0,0,0],[0,0,0,9,9,0,0,9,9,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,9,9,0,0,9,9,8,8,0,0,9,0,0,0,0,0,9,9,0,9,9,9,8,8,0],[0,0,0,0,0,0,0,9,8,9,0,0,0,0,0,0,9,9,0,0,0,0,0,0,8,9,9,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,8,0,9,9,0,0,0,8,9,9,0],[0,0,0,8,9,9,0,0,0,9,8,0,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,9,9,9,0,0,0,9,9,0,9,8,0,9,9,0,0,9,8,0,9,0,0,9,9,0],[0,9,0,0,0,8,0,9,9,9,0,8,8,8,0,0,0,9,0,0,0,0,0,9,9,9,0,0],[0,8,0,0,0,9,0,8,8,0,0,9,9,0,8,0,0,9,9,0,0,0,0,0,9,0,0,0],[0,0,8,8,8,0,0,9,0,0,8,0,0,9,9,9,0,0,0,9,9,0,9,9,0,9,9,0],[0,9,9,9,9,9,0,0,0,0,0,0,9,9,0,0,0,0,0,0,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,9,9,9,8,8,0,0,0,0,0,0,9,9,0,0,0,0,0,0,9,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,8,8,0,0,0,0,0,0,9,9,0,0],[0,9,9,9,8,8,0,0,0,0,0,0,9,9,9,9,8,8,0,0,9,0,0,0,9,9,0,0],[0,9,0,8,0,9,0,0,9,0,8,0,9,0,0,8,0,9,0,8,0,0,8,0,9,0,8,0],[0,9,8,9,8,9,0,0,9,0,9,0,9,0,0,9,0,9,0,9,0,0,9,8,9,8,9,0],[0,8,0,8,0,8,0,9,0,9,0,9,0,9,9,0,9,0,9,0,9,0,8,0,8,0,8,0],[0,9,9,0,9,9,0,9,9,0,8,0,9,9,9,9,0,8,0,9,9,0,9,9,0,9,9,0],[0,8,8,9,9,0,0,9,9,0,0,9,0,0,9,9,0,0,9,0,0,0,8,8,9,9,0,0],[0,0,0,9,0,0,0,0,0,9,9,0,0,8,0,9,9,0,0,8,8,0,9,0,0,0,8,0],[0,9,9,0,9,9,0,9,9,0,0,0,9,9,9,0,0,8,0,0,9,0,0,8,8,8,0,0],[0,8,8,9,9,9,0,9,9,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,8,8,9,9,9,0,9,9,0,0,0,0,0,9,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,9,9,0,0,9,9,0,0,0],[0,8,8,9,9,9,0,9,9,0,0,0,0,0,9,0,0,8,8,9,9,0,0,9,9,0,0,0],[0,9,9,8,9,9,0,0,9,0,0,0,9,0,0,9,0,0,0,9,0,0,9,9,8,9,9,0],[0,8,9,9,0,0,0,0,8,8,9,9,0,0,0,8,8,9,9,0,0,0,8,9,9,0,0,0],[0,0,0,8,9,9,0,0,0,0,8,8,9,9,0,0,0,8,8,9,9,0,0,0,8,9,9,0],[0,9,9,8,9,9,0,0,0,0,8,0,0,0,0,0,0,8,0,0,0,0,9,9,8,9,9,0],[0,9,9,9,9,8,0,0,0,0,0,0,8,8,0,0,0,0,0,8,8,0,9,9,9,9,8,0],[0,0,0,8,9,9,0,0,0,8,8,9,9,0,0,8,8,9,9,0,0,0,8,9,9,0,0,0],[0,8,9,9,9,9,0,8,8,0,0,0,0,0,8,8,0,0,0,0,0,0,8,9,9,9,9,0],[0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,9,9,9,9,0,0,8,9,9,9,9,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,8,9,9,9,9,0,0,8,9,9,9,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,9,9,0,8,9,9,8,9,9,0,8,9,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,9,0,9,8,0,0,8,9,0,9,8,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,8,9,0,9,8,0,0,8,9,0,9,8,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,9,9,9,9,9,8,0,9,9,9,9,9,8,0,0,0,0,0,0,0],[0,9,8,8,8,9,0,9,9,0,0,0,9,9,9,9,0,0,0,9,9,0,9,8,8,8,9,0],[0,0,0,0,0,0,0,8,9,9,9,9,9,0,8,9,9,9,9,9,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0],[0,0,0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,8,9,9,0,0,0,0,8,9,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,9,0,9,0,9,8,8,9,0,9,0,9,8,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,0,9,0,8,0,9,8,0,9,0,8,0,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,9,0,0,0,9,8,8,9,0,0,0,9,8,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,8,9,0,0,8,9,9,8,9,0,0,8,9,9,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,9,9,9,8,0,0,0,9,9,9,8,0,0,0,0,0,0,0]];var wd={};wd.__esModule=!0;wd.Sprites=void 0;wd.Sprites=[{x:0,y:0,shape:1,hidden:!0},{x:0,y:0,shape:0,light:"top"},{x:0,y:.25,shape:1,light:"left"},{x:0,y:.25,shape:0,light:"left"},{x:0,y:.5,shape:1,light:"left"},{x:0,y:.5,shape:0,light:"left"},{x:0,y:.75,shape:1,hidden:!0},{x:.25,y:-.125,shape:0,light:"top"},{x:.25,y:.125,shape:1,light:"top"},{x:.25,y:.125,shape:0,light:"top"},{x:.25,y:.375,shape:1,light:"left"},{x:.25,y:.375,shape:0,light:"left"},{x:.25,y:.625,shape:1,light:"left"},{x:.25,y:.625,shape:0,light:"left"},{x:.5,y:0,shape:1,light:"top"},{x:.5,y:0,shape:0,light:"top"},{x:.5,y:.25,shape:1,light:"top"},{x:.5,y:.25,shape:0,light:"right"},{x:.5,y:.5,shape:1,light:"right"},{x:.5,y:.5,shape:0,light:"right"},{x:.5,y:.75,shape:1,light:"right"},{x:.75,y:-.125,shape:0,hidden:!0},{x:.75,y:.125,shape:1,light:"top"},{x:.75,y:.125,shape:0,light:"right"},{x:.75,y:.375,shape:1,light:"right"},{x:.75,y:.375,shape:0,light:"right"},{x:.75,y:.625,shape:1,light:"right"},{x:.75,y:.625,shape:0,hidden:!0}];var _d={};_d.__esModule=!0;_d.Shapes=void 0;_d.Shapes=[{x1:0,y1:.25,x2:.25,y2:.125,x3:.25,y3:.375},{x1:0,y1:0,x2:.25,y2:.125,x3:0,y3:.25}];(function(e){e.__esModule=!0;var t=bd,n=wd,r=_d;function o(i,s){return i.min+s%(i.max-i.min)}function a(i,s){var l=o(s.hue,i[0]),c=o(s.saturation,i[1]),u=o(s.lightness,i[2]),d=o(s.shift,i[3]),p=o(s.figureAlpha,i[4]),g=i[5]%t.StandardFigures.length,v=s.createCanvas,h=s.size||100,_=v(h,h),b=_.getContext("2d");return n.Sprites.forEach(function(y,x){var E=s.light.enabled?s.light[y.light]:1,w=Math.round(i[6]/(x+1)),T=s.variation.enabled?o(s.variation,w):0;if(b.beginPath(),!y.hidden){var k=r.Shapes[y.shape];b.moveTo(h*(k.x1+y.x),h*(k.y1+y.y)),b.lineTo(h*(k.x2+y.x),h*(k.y2+y.y)),b.lineTo(h*(k.x3+y.x),h*(k.y3+y.y))}b.fillStyle="hsla("+(l+T)+", "+c+"%, "+(u+E)+"%, 1)",b.fill();var C=t.StandardFigures[g];if(C[x]>0){var P=C[x]*p/10;b.fillStyle="hsla("+(l+d+T)+", "+c+"%, "+(u+E)+"%, "+P+")",b.fill()}}),_}e.default=a})(rS);var xd={},oa={};oa.__esModule=!0;oa.createCanvas=oa.deepMerge=void 0;var oS=function(){for(var e=[],t=0;t>5,this.byteCount=this.blockCount<<2,this.outputBlocks=H>>5,this.extraBytes=(H&31)>>3;for(var I=0;I<50;++I)this.s[I]=0}U.prototype.update=function(S){if(this.finalized)throw new Error(n);var X,H=typeof S;if(H!=="string"){if(H==="object"){if(S===null)throw new Error(t);if(l&&S.constructor===ArrayBuffer)S=new Uint8Array(S);else if(!Array.isArray(S)&&(!l||!ArrayBuffer.isView(S)))throw new Error(t)}else throw new Error(t);X=!0}for(var I=this.blocks,F=this.byteCount,j=S.length,$=this.blockCount,V=0,J=this.s,ee,ce;V>2]|=S[V]<>2]|=ce<>2]|=(192|ce>>6)<>2]|=(128|ce&63)<=57344?(I[ee>>2]|=(224|ce>>12)<>2]|=(128|ce>>6&63)<>2]|=(128|ce&63)<>2]|=(240|ce>>18)<>2]|=(128|ce>>12&63)<>2]|=(128|ce>>6&63)<>2]|=(128|ce&63)<=F){for(this.start=ee-F,this.block=I[$],ee=0;ee<$;++ee)J[ee]^=I[ee];se(J),this.reset=!0}else this.start=ee}return this},U.prototype.encode=function(S,X){var H=S&255,I=1,F=[H];for(S=S>>8,H=S&255;H>0;)F.unshift(H),S=S>>8,H=S&255,++I;return X?F.push(I):F.unshift(I),this.update(F),F.length},U.prototype.encodeString=function(S){var X,H=typeof S;if(H!=="string"){if(H==="object"){if(S===null)throw new Error(t);if(l&&S.constructor===ArrayBuffer)S=new Uint8Array(S);else if(!Array.isArray(S)&&(!l||!ArrayBuffer.isView(S)))throw new Error(t)}else throw new Error(t);X=!0}var I=0,F=S.length;if(X)I=F;else for(var j=0;j=57344?I+=3:($=65536+(($&1023)<<10|S.charCodeAt(++j)&1023),I+=4)}return I+=this.encode(I*8),this.update(S),I},U.prototype.bytepad=function(S,X){for(var H=this.encode(X),I=0;I>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(S[0]=S[H],X=1;X>4&15]+c[V&15]+c[V>>12&15]+c[V>>8&15]+c[V>>20&15]+c[V>>16&15]+c[V>>28&15]+c[V>>24&15];j%S===0&&(se(X),F=0)}return I&&(V=X[F],$+=c[V>>4&15]+c[V&15],I>1&&($+=c[V>>12&15]+c[V>>8&15]),I>2&&($+=c[V>>20&15]+c[V>>16&15])),$},U.prototype.arrayBuffer=function(){this.finalize();var S=this.blockCount,X=this.s,H=this.outputBlocks,I=this.extraBytes,F=0,j=0,$=this.outputBits>>3,V;I?V=new ArrayBuffer(H+1<<2):V=new ArrayBuffer($);for(var J=new Uint32Array(V);j>8&255,$[V+2]=J>>16&255,$[V+3]=J>>24&255;j%S===0&&se(X)}return I&&(V=j<<2,J=X[F],$[V]=J&255,I>1&&($[V+1]=J>>8&255),I>2&&($[V+2]=J>>16&255)),$};function ae(S,X,H){U.call(this,S,X,H)}ae.prototype=new U,ae.prototype.finalize=function(){return this.encode(this.outputBits,!0),U.prototype.finalize.call(this)};var se=function(S){var X,H,I,F,j,$,V,J,ee,ce,Pe,Oe,A,q,Q,ue,le,oe,me,ke,je,Ge,At,nr,lt,Tn,rr,or,ar,sn,Eo,No,ma,ln,Po,ha,ga,Or,Un,Dr,Lr,jr,Vn,va,ya,ba,wa,_a,Mo,Fr,cn,xa,ka,Ca,Sa,Ta,Ft,Ea,Na,Pa,Ma,Aa,un;for(I=0;I<48;I+=2)F=S[0]^S[10]^S[20]^S[30]^S[40],j=S[1]^S[11]^S[21]^S[31]^S[41],$=S[2]^S[12]^S[22]^S[32]^S[42],V=S[3]^S[13]^S[23]^S[33]^S[43],J=S[4]^S[14]^S[24]^S[34]^S[44],ee=S[5]^S[15]^S[25]^S[35]^S[45],ce=S[6]^S[16]^S[26]^S[36]^S[46],Pe=S[7]^S[17]^S[27]^S[37]^S[47],Oe=S[8]^S[18]^S[28]^S[38]^S[48],A=S[9]^S[19]^S[29]^S[39]^S[49],X=Oe^($<<1|V>>>31),H=A^(V<<1|$>>>31),S[0]^=X,S[1]^=H,S[10]^=X,S[11]^=H,S[20]^=X,S[21]^=H,S[30]^=X,S[31]^=H,S[40]^=X,S[41]^=H,X=F^(J<<1|ee>>>31),H=j^(ee<<1|J>>>31),S[2]^=X,S[3]^=H,S[12]^=X,S[13]^=H,S[22]^=X,S[23]^=H,S[32]^=X,S[33]^=H,S[42]^=X,S[43]^=H,X=$^(ce<<1|Pe>>>31),H=V^(Pe<<1|ce>>>31),S[4]^=X,S[5]^=H,S[14]^=X,S[15]^=H,S[24]^=X,S[25]^=H,S[34]^=X,S[35]^=H,S[44]^=X,S[45]^=H,X=J^(Oe<<1|A>>>31),H=ee^(A<<1|Oe>>>31),S[6]^=X,S[7]^=H,S[16]^=X,S[17]^=H,S[26]^=X,S[27]^=H,S[36]^=X,S[37]^=H,S[46]^=X,S[47]^=H,X=ce^(F<<1|j>>>31),H=Pe^(j<<1|F>>>31),S[8]^=X,S[9]^=H,S[18]^=X,S[19]^=H,S[28]^=X,S[29]^=H,S[38]^=X,S[39]^=H,S[48]^=X,S[49]^=H,q=S[0],Q=S[1],ba=S[11]<<4|S[10]>>>28,wa=S[10]<<4|S[11]>>>28,or=S[20]<<3|S[21]>>>29,ar=S[21]<<3|S[20]>>>29,Pa=S[31]<<9|S[30]>>>23,Ma=S[30]<<9|S[31]>>>23,jr=S[40]<<18|S[41]>>>14,Vn=S[41]<<18|S[40]>>>14,ln=S[2]<<1|S[3]>>>31,Po=S[3]<<1|S[2]>>>31,ue=S[13]<<12|S[12]>>>20,le=S[12]<<12|S[13]>>>20,_a=S[22]<<10|S[23]>>>22,Mo=S[23]<<10|S[22]>>>22,sn=S[33]<<13|S[32]>>>19,Eo=S[32]<<13|S[33]>>>19,Aa=S[42]<<2|S[43]>>>30,un=S[43]<<2|S[42]>>>30,Ca=S[5]<<30|S[4]>>>2,Sa=S[4]<<30|S[5]>>>2,ha=S[14]<<6|S[15]>>>26,ga=S[15]<<6|S[14]>>>26,oe=S[25]<<11|S[24]>>>21,me=S[24]<<11|S[25]>>>21,Fr=S[34]<<15|S[35]>>>17,cn=S[35]<<15|S[34]>>>17,No=S[45]<<29|S[44]>>>3,ma=S[44]<<29|S[45]>>>3,nr=S[6]<<28|S[7]>>>4,lt=S[7]<<28|S[6]>>>4,Ta=S[17]<<23|S[16]>>>9,Ft=S[16]<<23|S[17]>>>9,Or=S[26]<<25|S[27]>>>7,Un=S[27]<<25|S[26]>>>7,ke=S[36]<<21|S[37]>>>11,je=S[37]<<21|S[36]>>>11,xa=S[47]<<24|S[46]>>>8,ka=S[46]<<24|S[47]>>>8,va=S[8]<<27|S[9]>>>5,ya=S[9]<<27|S[8]>>>5,Tn=S[18]<<20|S[19]>>>12,rr=S[19]<<20|S[18]>>>12,Ea=S[29]<<7|S[28]>>>25,Na=S[28]<<7|S[29]>>>25,Dr=S[38]<<8|S[39]>>>24,Lr=S[39]<<8|S[38]>>>24,Ge=S[48]<<14|S[49]>>>18,At=S[49]<<14|S[48]>>>18,S[0]=q^~ue&oe,S[1]=Q^~le&me,S[10]=nr^~Tn&or,S[11]=lt^~rr&ar,S[20]=ln^~ha&Or,S[21]=Po^~ga&Un,S[30]=va^~ba&_a,S[31]=ya^~wa&Mo,S[40]=Ca^~Ta&Ea,S[41]=Sa^~Ft&Na,S[2]=ue^~oe&ke,S[3]=le^~me&je,S[12]=Tn^~or&sn,S[13]=rr^~ar&Eo,S[22]=ha^~Or&Dr,S[23]=ga^~Un&Lr,S[32]=ba^~_a&Fr,S[33]=wa^~Mo&cn,S[42]=Ta^~Ea&Pa,S[43]=Ft^~Na&Ma,S[4]=oe^~ke&Ge,S[5]=me^~je&At,S[14]=or^~sn&No,S[15]=ar^~Eo&ma,S[24]=Or^~Dr&jr,S[25]=Un^~Lr&Vn,S[34]=_a^~Fr&xa,S[35]=Mo^~cn&ka,S[44]=Ea^~Pa&Aa,S[45]=Na^~Ma&un,S[6]=ke^~Ge&q,S[7]=je^~At&Q,S[16]=sn^~No&nr,S[17]=Eo^~ma<,S[26]=Dr^~jr&ln,S[27]=Lr^~Vn&Po,S[36]=Fr^~xa&va,S[37]=cn^~ka&ya,S[46]=Pa^~Aa&Ca,S[47]=Ma^~un&Sa,S[8]=Ge^~q&ue,S[9]=At^~Q&le,S[18]=No^~nr&Tn,S[19]=ma^~lt&rr,S[28]=jr^~ln&ha,S[29]=Vn^~Po&ga,S[38]=xa^~va&ba,S[39]=ka^~ya&wa,S[48]=Aa^~Ca&Ta,S[49]=un^~Sa&Ft,S[0]^=h[I],S[1]^=h[I+1]};if(s)e.exports=D;else for(G=0;G>>16&65535,u=s&65535,d=l>>>16&65535,p=l&65535;return u*p+(c*p+u*d<<16>>>0)|0}e.mul=Math.imul||t;function n(s,l){return s+l|0}e.add=n;function r(s,l){return s-l|0}e.sub=r;function o(s,l){return s<>>32-l}e.rotl=o;function a(s,l){return s<<32-l|s>>>l}e.rotr=a;function i(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s}e.isInteger=Number.isInteger||i,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(s){return e.isInteger(s)&&s>=-e.MAX_SAFE_INTEGER&&s<=e.MAX_SAFE_INTEGER}})(sS);Object.defineProperty(Ne,"__esModule",{value:!0});var lS=sS;function fO(e,t){return t===void 0&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16}Ne.readInt16BE=fO;function pO(e,t){return t===void 0&&(t=0),(e[t+0]<<8|e[t+1])>>>0}Ne.readUint16BE=pO;function mO(e,t){return t===void 0&&(t=0),(e[t+1]<<8|e[t])<<16>>16}Ne.readInt16LE=mO;function hO(e,t){return t===void 0&&(t=0),(e[t+1]<<8|e[t])>>>0}Ne.readUint16LE=hO;function cS(e,t,n){return t===void 0&&(t=new Uint8Array(2)),n===void 0&&(n=0),t[n+0]=e>>>8,t[n+1]=e>>>0,t}Ne.writeUint16BE=cS;Ne.writeInt16BE=cS;function uS(e,t,n){return t===void 0&&(t=new Uint8Array(2)),n===void 0&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t}Ne.writeUint16LE=uS;Ne.writeInt16LE=uS;function dp(e,t){return t===void 0&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}Ne.readInt32BE=dp;function fp(e,t){return t===void 0&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}Ne.readUint32BE=fp;function pp(e,t){return t===void 0&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}Ne.readInt32LE=pp;function mp(e,t){return t===void 0&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}Ne.readUint32LE=mp;function xu(e,t,n){return t===void 0&&(t=new Uint8Array(4)),n===void 0&&(n=0),t[n+0]=e>>>24,t[n+1]=e>>>16,t[n+2]=e>>>8,t[n+3]=e>>>0,t}Ne.writeUint32BE=xu;Ne.writeInt32BE=xu;function ku(e,t,n){return t===void 0&&(t=new Uint8Array(4)),n===void 0&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24,t}Ne.writeUint32LE=ku;Ne.writeInt32LE=ku;function gO(e,t){t===void 0&&(t=0);var n=dp(e,t),r=dp(e,t+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64BE=gO;function vO(e,t){t===void 0&&(t=0);var n=fp(e,t),r=fp(e,t+4);return n*4294967296+r}Ne.readUint64BE=vO;function yO(e,t){t===void 0&&(t=0);var n=pp(e,t),r=pp(e,t+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64LE=yO;function bO(e,t){t===void 0&&(t=0);var n=mp(e,t),r=mp(e,t+4);return r*4294967296+n}Ne.readUint64LE=bO;function dS(e,t,n){return t===void 0&&(t=new Uint8Array(8)),n===void 0&&(n=0),xu(e/4294967296>>>0,t,n),xu(e>>>0,t,n+4),t}Ne.writeUint64BE=dS;Ne.writeInt64BE=dS;function fS(e,t,n){return t===void 0&&(t=new Uint8Array(8)),n===void 0&&(n=0),ku(e>>>0,t,n),ku(e/4294967296>>>0,t,n+4),t}Ne.writeUint64LE=fS;Ne.writeInt64LE=fS;function wO(e,t,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var r=0,o=1,a=e/8+n-1;a>=n;a--)r+=t[a]*o,o*=256;return r}Ne.readUintBE=wO;function _O(e,t,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var r=0,o=1,a=n;a=r;a--)n[a]=t/o&255,o*=256;return n}Ne.writeUintBE=xO;function kO(e,t,n,r){if(n===void 0&&(n=new Uint8Array(e/8)),r===void 0&&(r=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!lS.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,a=r;ae.DIGEST_LENGTH)throw new Error("blake2s: wrong digest length");l&&this.validateConfig(l);var c=0;l&&l.key&&(c=l.key.length);var u=1,d=1;if(l&&l.tree&&(u=l.tree.fanout,d=l.tree.maxDepth),this._state[0]^=s|c<<8|u<<16|d<<24,l&&l.tree){this._state[1]^=l.tree.leafSize;var p=l.tree.nodeOffset/4294967296>>>0,g=l.tree.nodeOffset>>>0;this._state[2]^=g,this._state[3]^=p|l.tree.nodeDepth<<16|l.tree.innerDigestLength<<24,this._lastNode=l.tree.lastNode}l&&l.salt&&(this._state[4]^=t.readUint32LE(l.salt,0),this._state[5]^=t.readUint32LE(l.salt,4)),l&&l.personalization&&(this._state[6]^=t.readUint32LE(l.personalization,0),this._state[7]^=t.readUint32LE(l.personalization,4)),this._initialState=new Uint32Array(this._state),l&&l.key&&c>0&&(this._paddedKey=new Uint8Array(e.BLOCK_SIZE),this._paddedKey.set(l.key),this._buffer.set(this._paddedKey),this._bufferLength=e.BLOCK_SIZE)}return i.prototype.reset=function(){return this._state.set(this._initialState),this._paddedKey?(this._buffer.set(this._paddedKey),this._bufferLength=e.BLOCK_SIZE):this._bufferLength=0,this._ctr0=0,this._ctr1=0,this._flag0=0,this._flag1=0,this._finished=!1,this},i.prototype.validateConfig=function(s){if(s.key&&s.key.length>e.KEY_LENGTH)throw new Error("blake2s: wrong key length");if(s.salt&&s.salt.length!==e.SALT_LENGTH)throw new Error("blake2s: wrong salt length");if(s.personalization&&s.personalization.length!==e.PERSONALIZATION_LENGTH)throw new Error("blake2s: wrong personalization length");if(s.tree){if(s.tree.fanout<0||s.tree.fanout>e.MAX_FANOUT)throw new Error("blake2s: wrong tree fanout");if(s.tree.maxDepth<0||s.tree.maxDepth>e.MAX_MAX_DEPTH)throw new Error("blake2s: wrong tree depth");if(s.tree.leafSize<0||s.tree.leafSize>e.MAX_LEAF_SIZE)throw new Error("blake2s: wrong leaf size");if(s.tree.innerDigestLength<0||s.tree.innerDigestLength>e.DIGEST_LENGTH)throw new Error("blake2s: wrong tree inner digest length");if(s.tree.nodeOffset<0||s.tree.nodeOffset>e.MAX_NODE_OFFSET)throw new Error("blake2s: tree node offset is too large")}},i.prototype.update=function(s,l){if(l===void 0&&(l=s.length),this._finished)throw new Error("blake2s: can't update because hash was finished.");var c=e.BLOCK_SIZE-this._bufferLength,u=0;if(l===0)return this;if(l>c){for(var d=0;de.BLOCK_SIZE;){for(var d=0;d>>0,l!==this._ctr0&&this._ctr1++;var c=this._state[0],u=this._state[1],d=this._state[2],p=this._state[3],g=this._state[4],v=this._state[5],h=this._state[6],_=this._state[7],b=r[0],y=r[1],x=r[2],E=r[3],w=r[4]^this._ctr0,T=r[5]^this._ctr1,k=r[6]^this._flag0,C=r[7]^this._flag1,P=this._buffer,O=P[3]<<24|P[2]<<16|P[1]<<8|P[0],R=P[7]<<24|P[6]<<16|P[5]<<8|P[4],N=P[11]<<24|P[10]<<16|P[9]<<8|P[8],B=P[15]<<24|P[14]<<16|P[13]<<8|P[12],D=P[19]<<24|P[18]<<16|P[17]<<8|P[16],L=P[23]<<24|P[22]<<16|P[21]<<8|P[20],G=P[27]<<24|P[26]<<16|P[25]<<8|P[24],Y=P[31]<<24|P[30]<<16|P[29]<<8|P[28],K=P[35]<<24|P[34]<<16|P[33]<<8|P[32],Z=P[39]<<24|P[38]<<16|P[37]<<8|P[36],re=P[43]<<24|P[42]<<16|P[41]<<8|P[40],fe=P[47]<<24|P[46]<<16|P[45]<<8|P[44],U=P[51]<<24|P[50]<<16|P[49]<<8|P[48],ae=P[55]<<24|P[54]<<16|P[53]<<8|P[52],se=P[59]<<24|P[58]<<16|P[57]<<8|P[56],S=P[63]<<24|P[62]<<16|P[61]<<8|P[60];c=c+O|0,c=c+g|0,w^=c,w=w<<16|w>>>16,b=b+w|0,g^=b,g=g<<20|g>>>12,u=u+N|0,u=u+v|0,T^=u,T=T<<16|T>>>16,y=y+T|0,v^=y,v=v<<20|v>>>12,d=d+D|0,d=d+h|0,k^=d,k=k<<16|k>>>16,x=x+k|0,h^=x,h=h<<20|h>>>12,p=p+G|0,p=p+_|0,C^=p,C=C<<16|C>>>16,E=E+C|0,_^=E,_=_<<20|_>>>12,d=d+L|0,d=d+h|0,k^=d,k=k<<24|k>>>8,x=x+k|0,h^=x,h=h<<25|h>>>7,p=p+Y|0,p=p+_|0,C^=p,C=C<<24|C>>>8,E=E+C|0,_^=E,_=_<<25|_>>>7,u=u+B|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+R|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+K|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+re|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+U|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+se|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+ae|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+S|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+fe|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+Z|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,c=c+se|0,c=c+g|0,w^=c,w=w<<16|w>>>16,b=b+w|0,g^=b,g=g<<20|g>>>12,u=u+D|0,u=u+v|0,T^=u,T=T<<16|T>>>16,y=y+T|0,v^=y,v=v<<20|v>>>12,d=d+Z|0,d=d+h|0,k^=d,k=k<<16|k>>>16,x=x+k|0,h^=x,h=h<<20|h>>>12,p=p+ae|0,p=p+_|0,C^=p,C=C<<16|C>>>16,E=E+C|0,_^=E,_=_<<20|_>>>12,d=d+S|0,d=d+h|0,k^=d,k=k<<24|k>>>8,x=x+k|0,h^=x,h=h<<25|h>>>7,p=p+G|0,p=p+_|0,C^=p,C=C<<24|C>>>8,E=E+C|0,_^=E,_=_<<25|_>>>7,u=u+K|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+re|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+R|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+O|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+fe|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+L|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+Y|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+B|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+N|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+U|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,c=c+fe|0,c=c+g|0,w^=c,w=w<<16|w>>>16,b=b+w|0,g^=b,g=g<<20|g>>>12,u=u+U|0,u=u+v|0,T^=u,T=T<<16|T>>>16,y=y+T|0,v^=y,v=v<<20|v>>>12,d=d+L|0,d=d+h|0,k^=d,k=k<<16|k>>>16,x=x+k|0,h^=x,h=h<<20|h>>>12,p=p+S|0,p=p+_|0,C^=p,C=C<<16|C>>>16,E=E+C|0,_^=E,_=_<<20|_>>>12,d=d+N|0,d=d+h|0,k^=d,k=k<<24|k>>>8,x=x+k|0,h^=x,h=h<<25|h>>>7,p=p+ae|0,p=p+_|0,C^=p,C=C<<24|C>>>8,E=E+C|0,_^=E,_=_<<25|_>>>7,u=u+O|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+K|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+re|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+B|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+Y|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+Z|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+R|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+D|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+G|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+se|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,c=c+Y|0,c=c+g|0,w^=c,w=w<<16|w>>>16,b=b+w|0,g^=b,g=g<<20|g>>>12,u=u+B|0,u=u+v|0,T^=u,T=T<<16|T>>>16,y=y+T|0,v^=y,v=v<<20|v>>>12,d=d+ae|0,d=d+h|0,k^=d,k=k<<16|k>>>16,x=x+k|0,h^=x,h=h<<20|h>>>12,p=p+fe|0,p=p+_|0,C^=p,C=C<<16|C>>>16,E=E+C|0,_^=E,_=_<<20|_>>>12,d=d+U|0,d=d+h|0,k^=d,k=k<<24|k>>>8,x=x+k|0,h^=x,h=h<<25|h>>>7,p=p+se|0,p=p+_|0,C^=p,C=C<<24|C>>>8,E=E+C|0,_^=E,_=_<<25|_>>>7,u=u+R|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+Z|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+N|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+L|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+D|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+S|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+O|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+K|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+re|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+G|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,c=c+Z|0,c=c+g|0,w^=c,w=w<<16|w>>>16,b=b+w|0,g^=b,g=g<<20|g>>>12,u=u+L|0,u=u+v|0,T^=u,T=T<<16|T>>>16,y=y+T|0,v^=y,v=v<<20|v>>>12,d=d+N|0,d=d+h|0,k^=d,k=k<<16|k>>>16,x=x+k|0,h^=x,h=h<<20|h>>>12,p=p+re|0,p=p+_|0,C^=p,C=C<<16|C>>>16,E=E+C|0,_^=E,_=_<<20|_>>>12,d=d+D|0,d=d+h|0,k^=d,k=k<<24|k>>>8,x=x+k|0,h^=x,h=h<<25|h>>>7,p=p+S|0,p=p+_|0,C^=p,C=C<<24|C>>>8,E=E+C|0,_^=E,_=_<<25|_>>>7,u=u+Y|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+O|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+se|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+fe|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+G|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+B|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+K|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+ae|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+U|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+R|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,c=c+N|0,c=c+g|0,w^=c,w=w<<16|w>>>16,b=b+w|0,g^=b,g=g<<20|g>>>12,u=u+G|0,u=u+v|0,T^=u,T=T<<16|T>>>16,y=y+T|0,v^=y,v=v<<20|v>>>12,d=d+O|0,d=d+h|0,k^=d,k=k<<16|k>>>16,x=x+k|0,h^=x,h=h<<20|h>>>12,p=p+K|0,p=p+_|0,C^=p,C=C<<16|C>>>16,E=E+C|0,_^=E,_=_<<20|_>>>12,d=d+fe|0,d=d+h|0,k^=d,k=k<<24|k>>>8,x=x+k|0,h^=x,h=h<<25|h>>>7,p=p+B|0,p=p+_|0,C^=p,C=C<<24|C>>>8,E=E+C|0,_^=E,_=_<<25|_>>>7,u=u+re|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+U|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+D|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+Y|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+S|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+R|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+se|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+Z|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+L|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+ae|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,c=c+U|0,c=c+g|0,w^=c,w=w<<16|w>>>16,b=b+w|0,g^=b,g=g<<20|g>>>12,u=u+R|0,u=u+v|0,T^=u,T=T<<16|T>>>16,y=y+T|0,v^=y,v=v<<20|v>>>12,d=d+se|0,d=d+h|0,k^=d,k=k<<16|k>>>16,x=x+k|0,h^=x,h=h<<20|h>>>12,p=p+D|0,p=p+_|0,C^=p,C=C<<16|C>>>16,E=E+C|0,_^=E,_=_<<20|_>>>12,d=d+ae|0,d=d+h|0,k^=d,k=k<<24|k>>>8,x=x+k|0,h^=x,h=h<<25|h>>>7,p=p+re|0,p=p+_|0,C^=p,C=C<<24|C>>>8,E=E+C|0,_^=E,_=_<<25|_>>>7,u=u+S|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+L|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+O|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+G|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+Z|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+K|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+N|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+fe|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+B|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+Y|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,c=c+ae|0,c=c+g|0,w^=c,w=w<<16|w>>>16,b=b+w|0,g^=b,g=g<<20|g>>>12,u=u+Y|0,u=u+v|0,T^=u,T=T<<16|T>>>16,y=y+T|0,v^=y,v=v<<20|v>>>12,d=d+U|0,d=d+h|0,k^=d,k=k<<16|k>>>16,x=x+k|0,h^=x,h=h<<20|h>>>12,p=p+B|0,p=p+_|0,C^=p,C=C<<16|C>>>16,E=E+C|0,_^=E,_=_<<20|_>>>12,d=d+R|0,d=d+h|0,k^=d,k=k<<24|k>>>8,x=x+k|0,h^=x,h=h<<25|h>>>7,p=p+Z|0,p=p+_|0,C^=p,C=C<<24|C>>>8,E=E+C|0,_^=E,_=_<<25|_>>>7,u=u+se|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+fe|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+L|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+S|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+K|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+N|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+G|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+re|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+D|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+O|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,c=c+G|0,c=c+g|0,w^=c,w=w<<16|w>>>16,b=b+w|0,g^=b,g=g<<20|g>>>12,u=u+se|0,u=u+v|0,T^=u,T=T<<16|T>>>16,y=y+T|0,v^=y,v=v<<20|v>>>12,d=d+fe|0,d=d+h|0,k^=d,k=k<<16|k>>>16,x=x+k|0,h^=x,h=h<<20|h>>>12,p=p+O|0,p=p+_|0,C^=p,C=C<<16|C>>>16,E=E+C|0,_^=E,_=_<<20|_>>>12,d=d+B|0,d=d+h|0,k^=d,k=k<<24|k>>>8,x=x+k|0,h^=x,h=h<<25|h>>>7,p=p+K|0,p=p+_|0,C^=p,C=C<<24|C>>>8,E=E+C|0,_^=E,_=_<<25|_>>>7,u=u+Z|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+S|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+U|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+ae|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+R|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+re|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+D|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+L|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+Y|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+N|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,c=c+re|0,c=c+g|0,w^=c,w=w<<16|w>>>16,b=b+w|0,g^=b,g=g<<20|g>>>12,u=u+K|0,u=u+v|0,T^=u,T=T<<16|T>>>16,y=y+T|0,v^=y,v=v<<20|v>>>12,d=d+Y|0,d=d+h|0,k^=d,k=k<<16|k>>>16,x=x+k|0,h^=x,h=h<<20|h>>>12,p=p+R|0,p=p+_|0,C^=p,C=C<<16|C>>>16,E=E+C|0,_^=E,_=_<<20|_>>>12,d=d+G|0,d=d+h|0,k^=d,k=k<<24|k>>>8,x=x+k|0,h^=x,h=h<<25|h>>>7,p=p+L|0,p=p+_|0,C^=p,C=C<<24|C>>>8,E=E+C|0,_^=E,_=_<<25|_>>>7,u=u+D|0,u=u+v|0,T^=u,T=T<<24|T>>>8,y=y+T|0,v^=y,v=v<<25|v>>>7,c=c+N|0,c=c+g|0,w^=c,w=w<<24|w>>>8,b=b+w|0,g^=b,g=g<<25|g>>>7,c=c+S|0,c=c+v|0,C^=c,C=C<<16|C>>>16,x=x+C|0,v^=x,v=v<<20|v>>>12,u=u+Z|0,u=u+h|0,w^=u,w=w<<16|w>>>16,E=E+w|0,h^=E,h=h<<20|h>>>12,d=d+B|0,d=d+_|0,T^=d,T=T<<16|T>>>16,b=b+T|0,_^=b,_=_<<20|_>>>12,p=p+ae|0,p=p+g|0,k^=p,k=k<<16|k>>>16,y=y+k|0,g^=y,g=g<<20|g>>>12,d=d+U|0,d=d+_|0,T^=d,T=T<<24|T>>>8,b=b+T|0,_^=b,_=_<<25|_>>>7,p=p+O|0,p=p+g|0,k^=p,k=k<<24|k>>>8,y=y+k|0,g^=y,g=g<<25|g>>>7,u=u+se|0,u=u+h|0,w^=u,w=w<<24|w>>>8,E=E+w|0,h^=E,h=h<<25|h>>>7,c=c+fe|0,c=c+v|0,C^=c,C=C<<24|C>>>8,x=x+C|0,v^=x,v=v<<25|v>>>7,this._state[0]^=c^b,this._state[1]^=u^y,this._state[2]^=d^x,this._state[3]^=p^E,this._state[4]^=g^w,this._state[5]^=v^T,this._state[6]^=h^k,this._state[7]^=_^C},i}();e.BLAKE2s=o;function a(i,s,l){s===void 0&&(s=e.DIGEST_LENGTH);var c=new o(s,l);c.update(i);var u=c.digest();return c.clean(),u}e.hash=a})(iS);var ai=_t&&_t.__assign||function(){return ai=Object.assign||function(e){for(var t,n=1,r=arguments.length;nn[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),i=a?.nonce||a?.getAttribute("nonce");o=Promise.all(n.map(s=>{if(s=QO(s),s in e1)return;e1[s]=!0;const l=s.endsWith(".css"),c=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${c}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":YO,l||(u.as="script",u.crossOrigin=""),u.href=s,i&&u.setAttribute("nonce",i),document.head.appendChild(u),l)return new Promise((d,p)=>{u.addEventListener("load",d),u.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${s}`)))})}))}return o.then(()=>t()).catch(a=>{const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=a,window.dispatchEvent(i),!i.defaultPrevented)throw a})},og=m.createContext(null),ZO=e=>{const[t,n]=m.useState({}),r=m.useCallback((a,i="default")=>{n(s=>{if(i==="current")throw new Error("'current' cannot be used as map id");if(s[i])throw new Error(`Multiple maps with the same id: ${i}`);return{...s,[i]:a}})},[]),o=m.useCallback((a="default")=>{n(i=>{if(i[a]){const s={...i};return delete s[a],s}return i})},[]);return m.createElement(og.Provider,{value:{maps:t,onMapMount:r,onMapUnmount:o}},e.children)};function JO(){var e;const t=(e=m.useContext(og))===null||e===void 0?void 0:e.maps,n=m.useContext(yl);return m.useMemo(()=>({...t,current:n?.map}),[t,n])}function eD(e,t){const n=Array.isArray(e)?e[0]:e?e.x:0,r=Array.isArray(e)?e[1]:e?e.y:0,o=Array.isArray(t)?t[0]:t?t.x:0,a=Array.isArray(t)?t[1]:t?t.y:0;return n===o&&r===a}function vr(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n{let o=null;"interactive"in r&&(o=Object.assign({},r),delete o.interactive);const a=t[r.ref];if(a){o=o||Object.assign({},r),delete o.ref;for(const i of nD)i in a&&(o[i]=a[i])}return o||r});return{...e,layers:n}}var a1={};const i1={version:8,sources:{},layers:[]},s1={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"},Mf={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"},l1={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"},rD=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],oD=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Pi{constructor(t,n,r){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=o=>{const a=this.props[l1[o.type]];a?a(o):o.type==="error"&&console.error(o.error)},this._onPointerEvent=o=>{(o.type==="mousemove"||o.type==="mouseout")&&this._updateHover(o);const a=this.props[s1[o.type]];a&&(this.props.interactiveLayerIds&&o.type!=="mouseover"&&o.type!=="mouseout"&&(o.features=this._hoveredFeatures||this._queryRenderedFeatures(o.point)),a(o),delete o.features)},this._onCameraEvent=o=>{if(!this._internalUpdate){const a=this.props[Mf[o.type]];a&&a(o)}o.type in this._deferredEvents&&(this._deferredEvents[o.type]=!1)},this._MapClass=t,this.props=n,this._initialize(r)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){const n=this.props;this.props=t;const r=this._updateSettings(t,n);r&&this._createShadowTransform(this._map);const o=this._updateSize(t),a=this._updateViewState(t,!0);this._updateStyle(t,n),this._updateStyleComponents(t,n),this._updateHandlers(t,n),(r||o||a&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){const r=Pi.savedMaps.pop();if(!r)return null;const o=r.map,a=o.getContainer();for(n.className=a.className;a.childNodes.length>0;)n.appendChild(a.childNodes[0]);o._container=n;const i=o._resizeObserver;i&&(i.disconnect(),i.observe(n)),r.setProps({...t,styleDiffing:!1}),o.resize();const{initialViewState:s}=t;return s&&(s.bounds?o.fitBounds(s.bounds,{...s.fitBoundsOptions,duration:0}):r._updateViewState(s,!1)),o.isStyleLoaded()?o.fire("load"):o.once("styledata",()=>o.fire("load")),o._update(),r}_initialize(t){const{props:n}=this,{mapStyle:r=i1}=n,o={...n,...n.initialViewState,accessToken:n.mapboxAccessToken||aD()||null,container:t,style:o1(r)},a=o.initialViewState||o.viewState||o;if(Object.assign(o,{center:[a.longitude||0,a.latitude||0],zoom:a.zoom||0,pitch:a.pitch||0,bearing:a.bearing||0}),n.gl){const u=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=u,n.gl)}const i=new this._MapClass(o);a.padding&&i.setPadding(a.padding),n.cursor&&(i.getCanvas().style.cursor=n.cursor),this._createShadowTransform(i);const s=i._render;i._render=u=>{this._inRender=!0,s.call(i,u),this._inRender=!1};const l=i._renderTaskQueue.run;i._renderTaskQueue.run=u=>{l.call(i._renderTaskQueue,u),this._onBeforeRepaint()},i.on("render",()=>this._onAfterRepaint());const c=i.fire;i.fire=this._fireEvent.bind(this,c),i.on("resize",()=>{this._renderTransform.resize(i.transform.width,i.transform.height)}),i.on("styledata",()=>{this._updateStyleComponents(this.props,{}),t1(i.transform,this._renderTransform)}),i.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const u in s1)i.on(u,this._onPointerEvent);for(const u in Mf)i.on(u,this._onCameraEvent);for(const u in l1)i.on(u,this._onEvent);this._map=i}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n?.remove(),Pi.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){const n=tD(t.transform);t.painter.transform=n,this._renderTransform=n}_updateSize(t){const{viewState:n}=t;if(n){const r=this._map;if(n.width!==r.transform.width||n.height!==r.transform.height)return r.resize(),!0}return!1}_updateViewState(t,n){if(this._internalUpdate)return!1;const r=this._map,o=this._renderTransform,{zoom:a,pitch:i,bearing:s}=o,l=r.isMoving();l&&(o.cameraElevationReference="sea");const c=r1(o,{...n1(r.transform),...t});if(l&&(o.cameraElevationReference="ground"),c&&n){const u=this._deferredEvents;u.move=!0,u.zoom||(u.zoom=a!==o.zoom),u.rotate||(u.rotate=s!==o.bearing),u.pitch||(u.pitch=i!==o.pitch)}return l||r1(r.transform,t),c}_updateSettings(t,n){const r=this._map;let o=!1;for(const a of rD)if(a in t&&!vr(t[a],n[a])){o=!0;const i=r[`set${a[0].toUpperCase()}${a.slice(1)}`];i?.call(r,t[a])}return o}_updateStyle(t,n){if(t.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==n.mapStyle){const{mapStyle:r=i1,styleDiffing:o=!0}=t,a={diff:o};return"localIdeographFontFamily"in t&&(a.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(o1(r),a),!0}return!1}_updateStyleComponents(t,n){const r=this._map;let o=!1;return r.isStyleLoaded()&&("light"in t&&r.setLight&&!vr(t.light,n.light)&&(o=!0,r.setLight(t.light)),"fog"in t&&r.setFog&&!vr(t.fog,n.fog)&&(o=!0,r.setFog(t.fog)),"terrain"in t&&r.setTerrain&&!vr(t.terrain,n.terrain)&&(!t.terrain||r.getSource(t.terrain.source))&&(o=!0,r.setTerrain(t.terrain))),o}_updateHandlers(t,n){var r,o;const a=this._map;let i=!1;for(const s of oD){const l=(r=t[s])!==null&&r!==void 0?r:!0,c=(o=n[s])!==null&&o!==void 0?o:!0;vr(l,c)||(i=!0,l?a[s].enable(l):a[s].disable())}return i}_queryRenderedFeatures(t){const n=this._map,r=n.transform,{interactiveLayerIds:o=[]}=this.props;try{return n.transform=this._renderTransform,n.queryRenderedFeatures(t,{layers:o.filter(n.getLayer.bind(n))})}catch{return[]}finally{n.transform=r}}_updateHover(t){var n;const{props:r}=this;if(r.interactiveLayerIds&&(r.onMouseMove||r.onMouseEnter||r.onMouseLeave)){const a=t.type,i=((n=this._hoveredFeatures)===null||n===void 0?void 0:n.length)>0,s=this._queryRenderedFeatures(t.point),l=s.length>0;!l&&i&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=s,l&&!i&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=a}else this._hoveredFeatures=null}_fireEvent(t,n,r){const o=this._map,a=o.transform,i=typeof n=="string"?n:n.type;return i==="move"&&this._updateViewState(this.props,!1),i in Mf&&(typeof n=="object"&&(n.viewState=n1(a)),this._map.isMoving())?(o.transform=this._renderTransform,t.call(o,n,r),o.transform=a,o):(t.call(o,n,r),o)}_onBeforeRepaint(){const t=this._map;this._internalUpdate=!0;for(const r in this._deferredEvents)this._deferredEvents[r]&&t.fire(r);this._internalUpdate=!1;const n=this._map.transform;t.transform=this._renderTransform,this._onAfterRepaint=()=>{t1(this._renderTransform,n),t.transform=n}}}Pi.savedMaps=[];function aD(){let e=null;if(typeof location<"u"){const t=/access_token=([^&\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||a1.MapboxAccessToken}catch{}try{e=e||a1.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}const iD=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function sD(e){if(!e)return null;const t=e.map,n={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:r=>{const o=t.transform;t.transform=e.transform;const a=t.project(r);return t.transform=o,a},unproject:r=>{const o=t.transform;t.transform=e.transform;const a=t.unproject(r);return t.transform=o,a},queryTerrainElevation:(r,o)=>{const a=t.transform;t.transform=e.transform;const i=t.queryTerrainElevation(r,o);return t.transform=a,i},queryRenderedFeatures:(r,o)=>{const a=t.transform;t.transform=e.transform;const i=t.queryRenderedFeatures(r,o);return t.transform=a,i}};for(const r of lD(t))!(r in n)&&!iD.includes(r)&&(n[r]=t[r].bind(t));return n}function lD(e){const t=new Set;let n=e;for(;n;){for(const r of Object.getOwnPropertyNames(n))r[0]!=="_"&&typeof e[r]=="function"&&r!=="fire"&&r!=="setEventedParent"&&t.add(r);n=Object.getPrototypeOf(n)}return Array.from(t)}const cD=typeof document<"u"?m.useLayoutEffect:m.useEffect,uD=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function dD(e,t){for(const r of uD)r in t&&(e[r]=t[r]);const{RTLTextPlugin:n="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=t;n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"&&e.setRTLTextPlugin(n,r=>{r&&console.error(r)},!0)}const yl=m.createContext(null);function gS(e,t,n){const r=m.useContext(og),[o,a]=m.useState(null),i=m.useRef(),{current:s}=m.useRef({mapLib:null,map:null});m.useEffect(()=>{const u=e.mapLib;let d=!0,p;return Promise.resolve(u||n).then(g=>{if(!d)return;if(!g)throw new Error("Invalid mapLib");const v="Map"in g?g:g.default;if(!v.Map)throw new Error("Invalid mapLib");if(dD(v,e),!v.supported||v.supported(e))e.reuseMaps&&(p=Pi.reuse(e,i.current)),p||(p=new Pi(v.Map,e,i.current)),s.map=sD(p),s.mapLib=v,a(p),r?.onMapMount(s.map,e.id);else throw new Error("Map is not supported by this browser")}).catch(g=>{const{onError:v}=e;v?v({type:"error",target:null,originalEvent:null,error:g}):console.error(g)}),()=>{d=!1,p&&(r?.onMapUnmount(e.id),e.reuseMaps?p.recycle():p.destroy())}},[]),cD(()=>{o&&o.setProps(e)}),m.useImperativeHandle(t,()=>s.map,[o]);const l=m.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),c={height:"100%"};return m.createElement("div",{id:e.id,ref:i,style:l},o&&m.createElement(yl.Provider,{value:s},m.createElement("div",{"mapboxgl-children":"",style:c},e.children)))}const fD=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function fa(e,t){if(!e||!t)return;const n=e.style;for(const r in t){const o=t[r];Number.isFinite(o)&&!fD.test(r)?n[r]=`${o}px`:n[r]=o}}function pD(e,t){const{map:n,mapLib:r}=m.useContext(yl),o=m.useRef({props:e});o.current.props=e;const a=m.useMemo(()=>{let h=!1;m.Children.forEach(e.children,y=>{y&&(h=!0)});const _={...e,element:h?document.createElement("div"):null},b=new r.Marker(_);return b.setLngLat([e.longitude,e.latitude]),b.getElement().addEventListener("click",y=>{var x,E;(E=(x=o.current.props).onClick)===null||E===void 0||E.call(x,{type:"click",target:b,originalEvent:y})}),b.on("dragstart",y=>{var x,E;const w=y;w.lngLat=a.getLngLat(),(E=(x=o.current.props).onDragStart)===null||E===void 0||E.call(x,w)}),b.on("drag",y=>{var x,E;const w=y;w.lngLat=a.getLngLat(),(E=(x=o.current.props).onDrag)===null||E===void 0||E.call(x,w)}),b.on("dragend",y=>{var x,E;const w=y;w.lngLat=a.getLngLat(),(E=(x=o.current.props).onDragEnd)===null||E===void 0||E.call(x,w)}),b},[]);m.useEffect(()=>(a.addTo(n.getMap()),()=>{a.remove()}),[]);const{longitude:i,latitude:s,offset:l,style:c,draggable:u=!1,popup:d=null,rotation:p=0,rotationAlignment:g="auto",pitchAlignment:v="auto"}=e;return m.useEffect(()=>{fa(a.getElement(),c)},[c]),m.useImperativeHandle(t,()=>a,[]),(a.getLngLat().lng!==i||a.getLngLat().lat!==s)&&a.setLngLat([i,s]),l&&!eD(a.getOffset(),l)&&a.setOffset(l),a.isDraggable()!==u&&a.setDraggable(u),a.getRotation()!==p&&a.setRotation(p),a.getRotationAlignment()!==g&&a.setRotationAlignment(g),a.getPitchAlignment()!==v&&a.setPitchAlignment(v),a.getPopup()!==d&&a.setPopup(d),an.createPortal(e.children,a.getElement())}const mD=m.memo(m.forwardRef(pD));function c1(e){return new Set(e?e.trim().split(/\s+/):[])}function hD(e,t){const{map:n,mapLib:r}=m.useContext(yl),o=m.useMemo(()=>document.createElement("div"),[]),a=m.useRef({props:e});a.current.props=e;const i=m.useMemo(()=>{const s={...e},l=new r.Popup(s);return l.setLngLat([e.longitude,e.latitude]),l.once("open",c=>{var u,d;(d=(u=a.current.props).onOpen)===null||d===void 0||d.call(u,c)}),l},[]);if(m.useEffect(()=>{const s=l=>{var c,u;(u=(c=a.current.props).onClose)===null||u===void 0||u.call(c,l)};return i.on("close",s),i.setDOMContent(o).addTo(n.getMap()),()=>{i.off("close",s),i.isOpen()&&i.remove()}},[]),m.useEffect(()=>{fa(i.getElement(),e.style)},[e.style]),m.useImperativeHandle(t,()=>i,[]),i.isOpen()&&((i.getLngLat().lng!==e.longitude||i.getLngLat().lat!==e.latitude)&&i.setLngLat([e.longitude,e.latitude]),e.offset&&!vr(i.options.offset,e.offset)&&i.setOffset(e.offset),(i.options.anchor!==e.anchor||i.options.maxWidth!==e.maxWidth)&&(i.options.anchor=e.anchor,i.setMaxWidth(e.maxWidth)),i.options.className!==e.className)){const s=c1(i.options.className),l=c1(e.className);for(const c of s)l.has(c)||i.removeClassName(c);for(const c of l)s.has(c)||i.addClassName(c);i.options.className=e.className}return an.createPortal(e.children,o)}m.memo(m.forwardRef(hD));function bl(e,t,n,r){const o=m.useContext(yl),a=m.useMemo(()=>e(o),[]);return m.useEffect(()=>{const i=t,s=typeof t=="function"&&typeof n=="function"?t:null,l=typeof t=="function"?t:null,{map:c}=o;return c.hasControl(a)||(c.addControl(a,i?.position),s&&s(o)),()=>{l&&l(o),c.hasControl(a)&&c.removeControl(a)}},[]),a}function gD(e){const t=bl(({mapLib:n})=>new n.AttributionControl(e),{position:e.position});return m.useEffect(()=>{fa(t._container,e.style)},[e.style]),null}m.memo(gD);function vD(e){const t=bl(({mapLib:n})=>new n.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return m.useEffect(()=>{fa(t._controlContainer,e.style)},[e.style]),null}m.memo(vD);function yD(e,t){const n=m.useRef({props:e}),r=bl(({mapLib:o})=>{const a=new o.GeolocateControl(e),i=a._setupUI;return a._setupUI=s=>{a._container.hasChildNodes()||i(s)},a.on("geolocate",s=>{var l,c;(c=(l=n.current.props).onGeolocate)===null||c===void 0||c.call(l,s)}),a.on("error",s=>{var l,c;(c=(l=n.current.props).onError)===null||c===void 0||c.call(l,s)}),a.on("outofmaxbounds",s=>{var l,c;(c=(l=n.current.props).onOutOfMaxBounds)===null||c===void 0||c.call(l,s)}),a.on("trackuserlocationstart",s=>{var l,c;(c=(l=n.current.props).onTrackUserLocationStart)===null||c===void 0||c.call(l,s)}),a.on("trackuserlocationend",s=>{var l,c;(c=(l=n.current.props).onTrackUserLocationEnd)===null||c===void 0||c.call(l,s)}),a},{position:e.position});return n.current.props=e,m.useImperativeHandle(t,()=>r,[]),m.useEffect(()=>{fa(r._container,e.style)},[e.style]),null}m.memo(m.forwardRef(yD));function bD(e){const t=bl(({mapLib:n})=>new n.NavigationControl(e),{position:e.position});return m.useEffect(()=>{fa(t._container,e.style)},[e.style]),null}m.memo(bD);function wD(e){const t=bl(({mapLib:a})=>new a.ScaleControl(e),{position:e.position}),n=m.useRef(e),r=n.current;n.current=e;const{style:o}=e;return e.maxWidth!==void 0&&e.maxWidth!==r.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==r.unit&&t.setUnit(e.unit),m.useEffect(()=>{fa(t._container,o)},[o]),null}m.memo(wD);function _D(){return JO()}const xD=hS(()=>import("./mapbox-gl-DY02hNYD.js").then(e=>e.m),[]);m.forwardRef(function(t,n){return gS(t,n,xD)});const u1=mD,kD=hS(()=>import("./maplibre-gl-H6mDd47p.js").then(e=>e.m),[]),CD=m.forwardRef(function(t,n){return gS(t,n,kD)}),SD=()=>{const{nodes:e,waypoints:t}=Te(),{rasterSources:n,darkMode:r}=$n(),{default:o}=_D(),[a,i]=m.useState(0),s=Array.from(e.values()),l=m.useCallback(()=>{if(!o)return;const c=s.filter(g=>g.position?.latitudeI);if(!c.length)return;if(c.length===1){o.easeTo({zoom:12,center:[(c[0].position?.longitudeI??0)/1e7,(c[0].position?.latitudeI??0)/1e7]});return}const u=XO(c.map(g=>[(g.position?.latitudeI??0)/1e7,(g.position?.longitudeI??0)/1e7])),d=hp(u),p=o.cameraForBounds([[d[1],d[0]],[d[3],d[2]]],{padding:{top:10,bottom:10,left:10,right:10}});p&&o.easeTo(p)},[s,o]);return m.useEffect(()=>{o?.on("zoom",()=>{i(o?.getZoom()??0)})},[o]),m.useEffect(()=>{o?.on("load",()=>{l()})},[o,l]),f.jsxs(f.Fragment,{children:[f.jsx(vl,{children:f.jsx(qs,{label:"Sources",children:n.map(c=>f.jsx(Ni,{label:c.title},c.title))})}),f.jsx(gd,{label:"Map",noPadding:!0,actions:[{icon:v6,onClick(){o?.zoomIn()}},{icon:y6,onClick(){o?.zoomOut()}},{icon:aC,onClick(){l()}}],children:f.jsxs(CD,{mapStyle:"https://raw.githubusercontent.com/hc-oss/maplibre-gl-styles/master/styles/osm-mapnik/v8/default.json",attributionControl:!1,renderWorldCopies:!1,maxPitch:0,style:{filter:r?"brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7)":""},dragRotate:!1,touchZoomRotate:!1,initialViewState:{zoom:1.6,latitude:35,longitude:0},children:[t.map(c=>f.jsx(u1,{longitude:(c.longitudeI??0)/1e7,latitude:(c.latitudeI??0)/1e7,anchor:"bottom",children:f.jsx("div",{children:f.jsx(a6,{size:16})})},c.id)),s.map(c=>{if(c.position?.latitudeI)return f.jsx(u1,{longitude:(c.position.longitudeI??0)/1e7,latitude:(c.position.latitudeI??0)/1e7,style:{filter:r?"invert(1)":""},anchor:"bottom",onClick:()=>{o?.easeTo({zoom:12,center:[(c.position?.longitudeI??0)/1e7,(c.position?.latitudeI??0)/1e7]})},children:f.jsxs("div",{className:"flex cursor-pointer gap-2 rounded-md border bg-backgroundPrimary p-1.5",children:[f.jsx(da.Hashicon,{value:c.num.toString(),size:22}),f.jsx(wn,{className:Ee(a<12&&"hidden"),children:c.user?.longName||`!${Xs(c.num)}`})]})},c.num)})]})})]})},TD=({lastMsgSameUser:e,message:t,sender:n})=>e?f.jsxs("div",{className:"ml-5 flex",children:[t.state==="ack"?f.jsx(Vy,{size:16,className:"my-auto text-textSecondary"}):t.state==="waiting"?f.jsx(zy,{size:16,className:"my-auto text-textSecondary"}):f.jsx(Uy,{size:16,className:"my-auto text-textSecondary"}),f.jsx("span",{className:`ml-4 border-l-2 border-l-backgroundPrimary pl-2 ${t.state==="ack"?"text-textPrimary":"text-textSecondary"}`,children:t.data})]}):f.jsxs("div",{className:"mx-4 mt-2 gap-2",children:[f.jsxs("div",{className:"flex gap-2",children:[f.jsx("div",{className:"w-6 cursor-pointer",children:f.jsx(da.Hashicon,{value:(n?.num??0).toString(),size:32})}),f.jsx("span",{className:"cursor-pointer font-medium text-textPrimary",children:n?.user?.longName??"UNK"}),f.jsx("span",{className:"mt-1 font-mono text-xs text-textSecondary",children:t.rxTime.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]}),f.jsxs("div",{className:"ml-1 flex",children:[t.state==="ack"?f.jsx(Vy,{size:16,className:"my-auto text-textSecondary"}):t.state==="waiting"?f.jsx(zy,{size:16,className:"my-auto text-textSecondary"}):f.jsx(Uy,{size:16,className:"my-auto text-textSecondary"}),f.jsx("span",{className:`ml-4 border-l-2 border-l-backgroundPrimary pl-2 ${t.state==="ack"?"text-textPrimary":"text-textSecondary"}`,children:t.data})]})]}),ED=({to:e,channel:t})=>{const{connection:n,setMessageState:r,messageDraft:o,setMessageDraft:a,hardware:i}=Te(),s=i.myNodeNum,l=async c=>{await n?.sendText(c,e,!0,t).then(u=>r(e==="broadcast"?"broadcast":"direct",t,e,s,u,"ack")).catch(u=>r(e==="broadcast"?"broadcast":"direct",t,e,s,u.id,u.error))};return f.jsx("div",{className:"flex gap-2",children:f.jsx("form",{className:"w-full",onSubmit:c=>{c.preventDefault(),l(o),a("")},children:f.jsxs("div",{className:"flex flex-grow gap-2",children:[f.jsx("span",{className:"w-full",children:f.jsx(jn,{autoFocus:!0,minLength:1,placeholder:"Enter Message",value:o,onChange:c=>a(c.target.value)})}),f.jsx(pt,{type:"submit",children:f.jsx(u6,{size:16})})]})})})},ND=({from:e,to:t,route:n})=>{const{nodes:r}=Te();return n.length===0?f.jsx("div",{className:"ml-5 flex",children:f.jsxs("span",{className:"ml-4 border-l-2 border-l-backgroundPrimary pl-2 text-textPrimary",children:[t?.user?.longName,"↔",e?.user?.longName]})}):f.jsx("div",{className:"ml-5 flex",children:f.jsxs("span",{className:"ml-4 border-l-2 border-l-backgroundPrimary pl-2 text-textPrimary",children:[t?.user?.longName,"↔",n.map(o=>{const a=r.get(o);return`${a?.user?.longName??(a?.num?Xs(a.num):"Unknown")}↔`}),e?.user?.longName]})})},d1=({messages:e,channel:t,to:n,traceroutes:r})=>{const{nodes:o}=Te();return f.jsxs("div",{className:"flex flex-grow flex-col",children:[f.jsxs("div",{className:"flex flex-grow",children:[f.jsx("div",{className:"flex flex-grow flex-col",children:e?e.map((a,i)=>f.jsx(TD,{message:a,lastMsgSameUser:i===0?!1:e[i-1].from===a.from,sender:o.get(a.from)},a.id)):f.jsxs("div",{className:"m-auto",children:[f.jsx(Wy,{className:"m-auto"}),f.jsx(wn,{children:"No Messages"})]})}),f.jsx("div",{className:`flex flex-grow flex-col border-slate-400 border-l ${r===void 0?"hidden":""}`,children:n==="broadcast"?null:r?r.map((a,i)=>f.jsx(ND,{from:o.get(a.from),to:o.get(a.to),route:a.data.route},a.id)):f.jsxs("div",{className:"m-auto",children:[f.jsx(Wy,{className:"m-auto"}),f.jsx(wn,{children:"No Traceroutes"})]})})]}),f.jsx("div",{className:"pl-3 pr-3 pt-3 pb-1",children:f.jsx(ED,{to:n,channel:t})})]})},PD=()=>{const{channels:e,nodes:t,hardware:n,messages:r,traceroutes:o,connection:a}=Te(),[i,s]=m.useState("broadcast"),[l,c]=m.useState(Ws.ChannelNumber.Primary),u=Array.from(t.values()).filter(b=>b.num!==n.myNodeNum),d=Array.from(e.values()),p=d.filter(b=>b.role!==pe.Channel.Channel_Role.DISABLED),g=e.get(l),{toast:v}=hd(),h=t.get(l),_=h?.num?Xs(h.num):"Unknown";return f.jsxs(f.Fragment,{children:[f.jsxs(vl,{children:[f.jsx(qs,{label:"Channels",children:p.map(b=>f.jsx(Ni,{label:b.settings?.name.length?b.settings?.name:b.index===0?"Primary":`Ch ${b.index}`,active:l===b.index,onClick:()=>{s("broadcast"),c(b.index)},element:f.jsx(JR,{size:16,className:"mr-2"})},b.index))}),f.jsx(qs,{label:"Nodes",children:u.map(b=>f.jsx(Ni,{label:b.user?.longName??`!${Xs(b.num)}`,active:l===b.num,onClick:()=>{s("direct"),c(b.num)},element:f.jsx(da.Hashicon,{size:20,value:b.num.toString()})},b.num))})]}),f.jsx("div",{className:"flex flex-col flex-grow",children:f.jsxs(gd,{label:`Messages: ${i==="broadcast"&&g?cp(g):i==="direct"&&t.get(l)?t.get(l)?.user?.longName??_:"Loading..."}`,actions:i==="direct"?[{icon:t.get(l)?.user?.publicKey.length?dC:uC,iconClasses:t.get(l)?.user?.publicKey.length?"text-green-600":"text-yellow-300",async onClick(){t.get(l)?.num!==void 0&&v({title:t.get(l)?.user?.publicKey.length?"Chat is using PKI encryption.":"Chat is using PSK encryption."})}},{icon:h6,async onClick(){const b=t.get(l)?.num;b!==void 0&&(v({title:"Sending Traceroute, please wait..."}),await a?.traceRoute(b).then(()=>v({title:"Traceroute sent."})))}}]:[],children:[d.map(b=>l===b.index&&f.jsx(d1,{to:"broadcast",messages:r.broadcast.get(b.index),channel:b.index},b.index)),u.map(b=>l===b.num&&f.jsx(d1,{to:l,messages:r.direct.get(b.num),channel:Ws.ChannelNumber.Primary,traceroutes:o.get(b.num)},b.num))]})})]})},Do=({children:e,className:t,...n})=>f.jsx("span",{className:`font-mono text-sm text-textSecondary ${t??""}`,...n,children:e}),MD=({headings:e,rows:t})=>{const[n,r]=m.useState("Last Heard"),[o,a]=m.useState("desc"),i=l=>{n===l?a(o==="asc"?"desc":"asc"):(r(l),a("asc"))},s=t.slice().sort((l,c)=>{if(!n)return 0;const u=e.findIndex(g=>g.title===n),d=l[u].props.children,p=c[u].props.children;if(n==="Last Heard"){const g=d.props.timestamp??0,v=p.props.timestamp??0;return gv?o==="asc"?1:-1:0}return dp?o==="asc"?1:-1:0});return f.jsxs("table",{className:"min-w-full",children:[f.jsx("thead",{className:"bg-backgroundPrimary text-sm font-semibold text-textPrimary",children:f.jsx("tr",{children:e.map(l=>f.jsx("th",{scope:"col",className:`py-2 pr-3 pl-6 text-left ${l.sortable?"cursor-pointer hover:brightness-hover active:brightness-press":""}`,onClick:()=>l.sortable&&i(l.title),onKeyUp:()=>l.sortable&&i(l.title),children:f.jsxs("div",{className:"flex gap-2",children:[l.title,n===l.title&&f.jsx(f.Fragment,{children:o==="asc"?f.jsx(GR,{size:16}):f.jsx(sC,{size:16})})]})},l.title))})}),f.jsx("tbody",{children:s.map((l,c)=>f.jsx("tr",{children:l.map((u,d)=>f.jsx("td",{className:"whitespace-nowrap py-2 text-sm text-textSecondary first:pl-2",children:u},d))},c))})]})};var AD=["second","minute","hour","day","week","month","year"];function RD(e,t){if(t===0)return["just now","right now"];var n=AD[Math.floor(t/2)];return e>1&&(n+="s"),[e+" "+n+" ago","in "+e+" "+n]}var ID=["秒","分钟","小时","天","周","个月","年"];function OD(e,t){if(t===0)return["刚刚","片刻后"];var n=ID[~~(t/2)];return[e+" "+n+"前",e+" "+n+"后"]}var gp={},vS=function(e,t){gp[e]=t},yS=function(e){return gp[e]||gp.en_US},Vo=[60,60,24,7,365/7/12,12];function f1(e){return e instanceof Date?e:!isNaN(e)||/^\d+$/.test(e)?new Date(parseInt(e)):(e=(e||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([+-]\d\d):?(\d\d)/," $1$2"),new Date(e))}function bS(e,t){var n=e<0?1:0;e=Math.abs(e);for(var r=e,o=0;e>=Vo[o]&&o(o===0?9:1)&&(o+=1),t(e,o,r)[n].replace("%s",e.toString())}function wS(e,t){var n=t?f1(t):new Date;return(+n-+f1(e))/1e3}function DD(e){for(var t=1,n=0,r=Math.abs(e);e>=Vo[n]&&nf.jsx(zD,{datetime:e,opts:{minInterval:10}});function WD(e,t,n){var r;if(n===void 0&&(n={}),!t.codes){t.codes={};for(var o=0;o=8&&(s-=8,i[c++]=255&l>>s)}if(s>=t.bits||255&l<<8-s)throw new SyntaxError("Unexpected end of data");return i}function GD(e,t,n){n===void 0&&(n={});for(var r=n,o=r.pad,a=o===void 0?!0:o,i=(1<t.bits;)l-=t.bits,s+=t.chars[i&c>>l];if(l&&(s+=t.chars[i&c<{const{nodes:e,hardware:t,setDialogOpen:n}=Te(),{setNodeNumToBeRemoved:r}=$n(),o=Array.from(e.values()).filter(a=>a.num!==t.myNodeNum);return f.jsxs(f.Fragment,{children:[f.jsx(vl,{}),f.jsxs("div",{className:"flex flex-col w-full",children:[f.jsx("div",{className:"overflow-y-auto h-full",children:f.jsx(MD,{headings:[{title:"",type:"blank",sortable:!1},{title:"Name",type:"normal",sortable:!0},{title:"Model",type:"normal",sortable:!0},{title:"MAC Address",type:"normal",sortable:!0},{title:"Last Heard",type:"normal",sortable:!0},{title:"SNR",type:"normal",sortable:!0},{title:"Encryption",type:"normal",sortable:!1},{title:"Connection",type:"normal",sortable:!0},{title:"Remove",type:"normal",sortable:!1}],rows:o.map(a=>[f.jsx(da.Hashicon,{size:24,value:a.num.toString()},"icon"),f.jsx("h1",{children:a.user?.longName??(a.user?.macaddr?`Meshtastic ${h1.stringify(a.user?.macaddr.subarray(4,6)??[]).toLowerCase()}`:`!${Xs(a.num)}`)},"header"),f.jsx(Do,{children:pe.Mesh.HardwareModel[a.user?.hwModel??0]},"model"),f.jsx(Do,{children:h1.stringify(a.user?.macaddr??[]).match(/.{1,2}/g)?.join(":")??"UNK"},"addr"),f.jsx(m.Fragment,{children:a.lastHeard===0?f.jsx("p",{children:"Never"}):f.jsx(HD,{timestamp:a.lastHeard*1e3})},"lastHeard"),f.jsxs(Do,{children:[a.snr,"db/",Math.min(Math.max((a.snr+10)*5,0),100),"%/",(a.snr+10)*5,"raw"]},"snr"),f.jsx(Do,{children:a.user?.publicKey&&a.user?.publicKey.length>0?f.jsx(dC,{className:"text-green-600"}):f.jsx(uC,{className:"text-yellow-300"})},"pki"),f.jsxs(Do,{children:[a.lastHeard!==0?a.viaMqtt===!1&&a.hopsAway===0?"Direct":`${a.hopsAway.toString()} ${a.hopsAway>1?"hops":"hop"} away`:"-",a.viaMqtt===!0?", via MQTT":""]},"hops"),f.jsxs(pt,{variant:"destructive",onClick:()=>{r(a.num),n("nodeRemoval",!0)},children:[f.jsx(vC,{}),"Remove"]},"remove")])})}),f.jsx(Qh,{})]})]})},qD=()=>{const{activePage:e}=Te();return f.jsxs(f.Fragment,{children:[e==="messages"&&f.jsx(PD,{}),e==="map"&&f.jsx(SD,{}),e==="config"&&f.jsx(lO,{}),e==="channels"&&f.jsx(lI,{}),e==="nodes"&&f.jsx(KD,{})]})};var g1=1,XD=.9,YD=.8,QD=.17,Af=.1,Rf=.999,ZD=.9999,JD=.99,e5=/[\\\/_+.#"@\[\(\{&]/,t5=/[\\\/_+.#"@\[\(\{&]/g,n5=/[\s-]/,CS=/[\s-]/g;function bp(e,t,n,r,o,a,i){if(a===t.length)return o===e.length?g1:JD;var s=`${o},${a}`;if(i[s]!==void 0)return i[s];for(var l=r.charAt(a),c=n.indexOf(l,o),u=0,d,p,g,v;c>=0;)d=bp(e,t,n,r,c+1,a+1,i),d>u&&(c===o?d*=g1:e5.test(e.charAt(c-1))?(d*=YD,g=e.slice(o,c-1).match(t5),g&&o>0&&(d*=Math.pow(Rf,g.length))):n5.test(e.charAt(c-1))?(d*=XD,v=e.slice(o,c-1).match(CS),v&&o>0&&(d*=Math.pow(Rf,v.length))):(d*=QD,o>0&&(d*=Math.pow(Rf,c-o))),e.charAt(c)!==t.charAt(a)&&(d*=ZD)),(dd&&(d=p*Af)),d>u&&(u=d),c=n.indexOf(l,c+1);return i[s]=u,u}function v1(e){return e.toLowerCase().replace(CS," ")}function r5(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,bp(e,t,v1(e),v1(t),0,0,{})}function Dt(){return Dt=Object.assign?Object.assign.bind():function(e){for(var t=1;te.forEach(n=>o5(n,t))}function wl(...e){return m.useCallback(SS(...e),e)}function a5(e,t=[]){let n=[];function r(a,i){const s=m.createContext(i),l=n.length;n=[...n,i];function c(d){const{scope:p,children:g,...v}=d,h=p?.[e][l]||s,_=m.useMemo(()=>v,Object.values(v));return m.createElement(h.Provider,{value:_},g)}function u(d,p){const g=p?.[e][l]||s,v=m.useContext(g);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return c.displayName=a+"Provider",[c,u]}const o=()=>{const a=n.map(i=>m.createContext(i));return function(s){const l=s?.[e]||a;return m.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return o.scopeName=e,[r,i5(o,...t)]}function i5(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=r.reduce((s,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...s,...d}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}const wp=globalThis?.document?m.useLayoutEffect:()=>{},s5=W1.useId||(()=>{});let l5=0;function If(e){const[t,n]=m.useState(s5());return wp(()=>{e||n(r=>r??String(l5++))},[e]),e||(t?`radix-${t}`:"")}function aa(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function c5({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=u5({defaultProp:t,onChange:n}),a=e!==void 0,i=a?e:r,s=aa(n),l=m.useCallback(c=>{if(a){const d=typeof c=="function"?c(e):c;d!==e&&s(d)}else o(c)},[a,e,o,s]);return[i,l]}function u5({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),a=aa(t);return m.useEffect(()=>{o.current!==r&&(a(r),o.current=r)},[r,o,a]),n}const ig=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),a=o.find(f5);if(a){const i=a.props.children,s=o.map(l=>l===a?m.Children.count(i)>1?m.Children.only(null):m.isValidElement(i)?i.props.children:null:l);return m.createElement(_p,Dt({},r,{ref:t}),m.isValidElement(i)?m.cloneElement(i,void 0,s):null)}return m.createElement(_p,Dt({},r,{ref:t}),n)});ig.displayName="Slot";const _p=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...p5(r,n.props),ref:t?SS(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});_p.displayName="SlotClone";const d5=({children:e})=>m.createElement(m.Fragment,null,e);function f5(e){return m.isValidElement(e)&&e.type===d5}function p5(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...s)=>{a(...s),o(...s)}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}const m5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Sn=m5.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:a,...i}=r,s=a?ig:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(s,Dt({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function h5(e,t){e&&an.flushSync(()=>e.dispatchEvent(t))}function g5(e,t=globalThis?.document){const n=aa(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const xp="dismissableLayer.update",v5="dismissableLayer.pointerDownOutside",y5="dismissableLayer.focusOutside";let y1;const b5=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),w5=m.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...c}=e,u=m.useContext(b5),[d,p]=m.useState(null),g=(n=d?.ownerDocument)!==null&&n!==void 0?n:globalThis?.document,[,v]=m.useState({}),h=wl(t,C=>p(C)),_=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=_.indexOf(b),x=d?_.indexOf(d):-1,E=u.layersWithOutsidePointerEventsDisabled.size>0,w=x>=y,T=_5(C=>{const P=C.target,O=[...u.branches].some(R=>R.contains(P));!w||O||(a?.(C),s?.(C),C.defaultPrevented||l?.())},g),k=x5(C=>{const P=C.target;[...u.branches].some(R=>R.contains(P))||(i?.(C),s?.(C),C.defaultPrevented||l?.())},g);return g5(C=>{x===u.layers.size-1&&(o?.(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},g),m.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(y1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),b1(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=y1)}},[d,g,r,u]),m.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),b1())},[d,u]),m.useEffect(()=>{const C=()=>v({});return document.addEventListener(xp,C),()=>document.removeEventListener(xp,C)},[]),m.createElement(Sn.div,Dt({},c,{ref:h,style:{pointerEvents:E?w?"auto":"none":void 0,...e.style},onFocusCapture:mi(e.onFocusCapture,k.onFocusCapture),onBlurCapture:mi(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:mi(e.onPointerDownCapture,T.onPointerDownCapture)}))});function _5(e,t=globalThis?.document){const n=aa(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let c=function(){TS(v5,n,l,{discrete:!0})};const l={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function x5(e,t=globalThis?.document){const n=aa(e),r=m.useRef(!1);return m.useEffect(()=>{const o=a=>{a.target&&!r.current&&TS(y5,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function b1(){const e=new CustomEvent(xp);document.dispatchEvent(e)}function TS(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?h5(o,a):o.dispatchEvent(a)}const Of="focusScope.autoFocusOnMount",Df="focusScope.autoFocusOnUnmount",w1={bubbles:!1,cancelable:!0},k5=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[s,l]=m.useState(null),c=aa(o),u=aa(a),d=m.useRef(null),p=wl(t,h=>l(h)),g=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let h=function(x){if(g.paused||!s)return;const E=x.target;s.contains(E)?d.current=E:qr(d.current,{select:!0})},_=function(x){if(g.paused||!s)return;const E=x.relatedTarget;E!==null&&(s.contains(E)||qr(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const w of x)w.removedNodes.length>0&&qr(s)};document.addEventListener("focusin",h),document.addEventListener("focusout",_);const y=new MutationObserver(b);return s&&y.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",_),y.disconnect()}}},[r,s,g.paused]),m.useEffect(()=>{if(s){x1.add(g);const h=document.activeElement;if(!s.contains(h)){const b=new CustomEvent(Of,w1);s.addEventListener(Of,c),s.dispatchEvent(b),b.defaultPrevented||(C5(P5(ES(s)),{select:!0}),document.activeElement===h&&qr(s))}return()=>{s.removeEventListener(Of,c),setTimeout(()=>{const b=new CustomEvent(Df,w1);s.addEventListener(Df,u),s.dispatchEvent(b),b.defaultPrevented||qr(h??document.body,{select:!0}),s.removeEventListener(Df,u),x1.remove(g)},0)}}},[s,c,u,g]);const v=m.useCallback(h=>{if(!n&&!r||g.paused)return;const _=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(_&&b){const y=h.currentTarget,[x,E]=S5(y);x&&E?!h.shiftKey&&b===E?(h.preventDefault(),n&&qr(x,{select:!0})):h.shiftKey&&b===x&&(h.preventDefault(),n&&qr(E,{select:!0})):b===y&&h.preventDefault()}},[n,r,g.paused]);return m.createElement(Sn.div,Dt({tabIndex:-1},i,{ref:p,onKeyDown:v}))});function C5(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(qr(r,{select:t}),document.activeElement!==n)return}function S5(e){const t=ES(e),n=_1(t,e),r=_1(t.reverse(),e);return[n,r]}function ES(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function _1(e,t){for(const n of e)if(!T5(n,{upTo:t}))return n}function T5(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function E5(e){return e instanceof HTMLInputElement&&"select"in e}function qr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&E5(e)&&t&&e.select()}}const x1=N5();function N5(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=k1(e,t),e.unshift(t)},remove(t){var n;e=k1(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function k1(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function P5(e){return e.filter(t=>t.tagName!=="A")}const M5=m.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?Jw.createPortal(m.createElement(Sn.div,Dt({},o,{ref:t})),r):null});function A5(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const kd=e=>{const{present:t,children:n}=e,r=R5(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),a=wl(r.ref,o.ref);return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:a}):null};kd.displayName="Presence";function R5(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),a=m.useRef("none"),i=e?"mounted":"unmounted",[s,l]=A5(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=oc(r.current);a.current=s==="mounted"?c:"none"},[s]),wp(()=>{const c=r.current,u=o.current;if(u!==e){const p=a.current,g=oc(c);e?l("MOUNT"):g==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&p!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),wp(()=>{if(t){const c=d=>{const g=oc(r.current).includes(d.animationName);d.target===t&&g&&an.flushSync(()=>l("ANIMATION_END"))},u=d=>{d.target===t&&(a.current=oc(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:m.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function oc(e){return e?.animationName||"none"}let Lf=0;function I5(){m.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:C1()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:C1()),Lf++,()=>{Lf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Lf--}},[])}function C1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var NS=_k(),jf=function(){},Cd=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:jf,onWheelCapture:jf,onTouchMoveCapture:jf}),o=r[0],a=r[1],i=e.forwardProps,s=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,g=e.noIsolation,v=e.inert,h=e.allowPinchZoom,_=e.as,b=_===void 0?"div":_,y=$h(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),x=p,E=wk([n,t]),w=Nt(Nt({},y),o);return m.createElement(m.Fragment,null,u&&m.createElement(x,{sideCar:NS,removeScrollBar:c,shards:d,noIsolation:g,inert:v,setCallbacks:a,allowPinchZoom:!!h,lockRef:n}),i?m.cloneElement(m.Children.only(s),Nt(Nt({},w),{ref:E})):m.createElement(b,Nt({},w,{className:l,ref:E}),s))});Cd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Cd.classNames={fullWidth:ws,zeroRight:bs};var kp=!1;if(typeof window<"u")try{var ac=Object.defineProperty({},"passive",{get:function(){return kp=!0,!0}});window.addEventListener("test",ac,ac),window.removeEventListener("test",ac,ac)}catch{kp=!1}var Ua=kp?{passive:!1}:!1,O5=function(e){return e.tagName==="TEXTAREA"},PS=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!O5(e)&&n[t]==="visible")},D5=function(e){return PS(e,"overflowY")},L5=function(e){return PS(e,"overflowX")},S1=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=MS(e,n);if(r){var o=AS(e,n),a=o[1],i=o[2];if(a>i)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},j5=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},F5=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},MS=function(e,t){return e==="v"?D5(t):L5(t)},AS=function(e,t){return e==="v"?j5(t):F5(t)},B5=function(e,t){return e==="h"&&t==="rtl"?-1:1},$5=function(e,t,n,r,o){var a=B5(e,window.getComputedStyle(t).direction),i=a*r,s=n.target,l=t.contains(s),c=!1,u=i>0,d=0,p=0;do{var g=AS(e,s),v=g[0],h=g[1],_=g[2],b=h-_-a*v;(v||b)&&MS(e,s)&&(d+=b,p+=v),s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(d===0||!o)||!u&&(p===0||!o))&&(c=!0),c},ic=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},T1=function(e){return[e.deltaX,e.deltaY]},E1=function(e){return e&&"current"in e?e.current:e},U5=function(e,t){return e[0]===t[0]&&e[1]===t[1]},V5=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},z5=0,Va=[];function H5(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(z5++)[0],a=m.useState(function(){return Uh()})[0],i=m.useRef(e);m.useEffect(function(){i.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var h=bk([e.lockRef.current],(e.shards||[]).map(E1),!0).filter(Boolean);return h.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=m.useCallback(function(h,_){if("touches"in h&&h.touches.length===2)return!i.current.allowPinchZoom;var b=ic(h),y=n.current,x="deltaX"in h?h.deltaX:y[0]-b[0],E="deltaY"in h?h.deltaY:y[1]-b[1],w,T=h.target,k=Math.abs(x)>Math.abs(E)?"h":"v";if("touches"in h&&k==="h"&&T.type==="range")return!1;var C=S1(k,T);if(!C)return!0;if(C?w=k:(w=k==="v"?"h":"v",C=S1(k,T)),!C)return!1;if(!r.current&&"changedTouches"in h&&(x||E)&&(r.current=w),!w)return!0;var P=r.current||w;return $5(P,_,h,P==="h"?x:E,!0)},[]),l=m.useCallback(function(h){var _=h;if(!(!Va.length||Va[Va.length-1]!==a)){var b="deltaY"in _?T1(_):ic(_),y=t.current.filter(function(w){return w.name===_.type&&w.target===_.target&&U5(w.delta,b)})[0];if(y&&y.should){_.cancelable&&_.preventDefault();return}if(!y){var x=(i.current.shards||[]).map(E1).filter(Boolean).filter(function(w){return w.contains(_.target)}),E=x.length>0?s(_,x[0]):!i.current.noIsolation;E&&_.cancelable&&_.preventDefault()}}},[]),c=m.useCallback(function(h,_,b,y){var x={name:h,delta:_,target:b,should:y};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(E){return E!==x})},1)},[]),u=m.useCallback(function(h){n.current=ic(h),r.current=void 0},[]),d=m.useCallback(function(h){c(h.type,T1(h),h.target,s(h,e.lockRef.current))},[]),p=m.useCallback(function(h){c(h.type,ic(h),h.target,s(h,e.lockRef.current))},[]);m.useEffect(function(){return Va.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Ua),document.addEventListener("touchmove",l,Ua),document.addEventListener("touchstart",u,Ua),function(){Va=Va.filter(function(h){return h!==a}),document.removeEventListener("wheel",l,Ua),document.removeEventListener("touchmove",l,Ua),document.removeEventListener("touchstart",u,Ua)}},[]);var g=e.removeScrollBar,v=e.inert;return m.createElement(m.Fragment,null,v?m.createElement(a,{styles:V5(o)}):null,g?m.createElement(Sk,{gapMode:"margin"}):null)}const W5=kk(NS,H5);var RS=m.forwardRef(function(e,t){return m.createElement(Cd,Nt({},e,{ref:t,sideCar:W5}))});RS.classNames=Cd.classNames;const IS="Dialog",[OS,A7]=a5(IS),[G5,pa]=OS(IS),K5=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,s=m.useRef(null),l=m.useRef(null),[c=!1,u]=c5({prop:r,defaultProp:o,onChange:a});return m.createElement(G5,{scope:t,triggerRef:s,contentRef:l,contentId:If(),titleId:If(),descriptionId:If(),open:c,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(d=>!d),[u]),modal:i},n)},DS="DialogPortal",[q5,LS]=OS(DS,{forceMount:void 0}),X5=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=pa(DS,t);return m.createElement(q5,{scope:t,forceMount:n},m.Children.map(r,i=>m.createElement(kd,{present:n||a.open},m.createElement(M5,{asChild:!0,container:o},i))))},Cp="DialogOverlay",Y5=m.forwardRef((e,t)=>{const n=LS(Cp,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=pa(Cp,e.__scopeDialog);return a.modal?m.createElement(kd,{present:r||a.open},m.createElement(Q5,Dt({},o,{ref:t}))):null}),Q5=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=pa(Cp,n);return m.createElement(RS,{as:ig,allowPinchZoom:!0,shards:[o.contentRef]},m.createElement(Sn.div,Dt({"data-state":FS(o.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))}),Ys="DialogContent",Z5=m.forwardRef((e,t)=>{const n=LS(Ys,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=pa(Ys,e.__scopeDialog);return m.createElement(kd,{present:r||a.open},a.modal?m.createElement(J5,Dt({},o,{ref:t})):m.createElement(eL,Dt({},o,{ref:t})))}),J5=m.forwardRef((e,t)=>{const n=pa(Ys,e.__scopeDialog),r=m.useRef(null),o=wl(t,n.contentRef,r);return m.useEffect(()=>{const a=r.current;if(a)return Bh(a)},[]),m.createElement(jS,Dt({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mi(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),(i=n.triggerRef.current)===null||i===void 0||i.focus()}),onPointerDownOutside:mi(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,s=i.button===0&&i.ctrlKey===!0;(i.button===2||s)&&a.preventDefault()}),onFocusOutside:mi(e.onFocusOutside,a=>a.preventDefault())}))}),eL=m.forwardRef((e,t)=>{const n=pa(Ys,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return m.createElement(jS,Dt({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i;if((i=e.onCloseAutoFocus)===null||i===void 0||i.call(e,a),!a.defaultPrevented){var s;r.current||(s=n.triggerRef.current)===null||s===void 0||s.focus(),a.preventDefault()}r.current=!1,o.current=!1},onInteractOutside:a=>{var i,s;(i=e.onInteractOutside)===null||i===void 0||i.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=a.target;((s=n.triggerRef.current)===null||s===void 0?void 0:s.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}}))}),jS=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,s=pa(Ys,n),l=m.useRef(null),c=wl(t,l);return I5(),m.createElement(m.Fragment,null,m.createElement(k5,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a},m.createElement(w5,Dt({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":FS(s.open)},i,{ref:c,onDismiss:()=>s.onOpenChange(!1)}))),!1)});function FS(e){return e?"open":"closed"}const tL=K5,nL=X5,rL=Y5,oL=Z5;var ts='[cmdk-group=""]',Ff='[cmdk-group-items=""]',aL='[cmdk-group-heading=""]',sg='[cmdk-item=""]',N1=`${sg}:not([aria-disabled="true"])`,Sp="cmdk-item-select",Lo="data-value",iL=(e,t,n)=>r5(e,t,n),BS=m.createContext(void 0),_l=()=>m.useContext(BS),$S=m.createContext(void 0),lg=()=>m.useContext($S),US=m.createContext(void 0),VS=m.forwardRef((e,t)=>{let n=za(()=>{var U,ae;return{search:"",value:(ae=(U=e.value)!=null?U:e.defaultValue)!=null?ae:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=za(()=>new Set),o=za(()=>new Map),a=za(()=>new Map),i=za(()=>new Set),s=zS(e),{label:l,children:c,value:u,onValueChange:d,filter:p,shouldFilter:g,loop:v,disablePointerSelection:h=!1,vimBindings:_=!0,...b}=e,y=m.useId(),x=m.useId(),E=m.useId(),w=m.useRef(null),T=vL();ia(()=>{if(u!==void 0){let U=u.trim();n.current.value=U,k.emit()}},[u]),ia(()=>{T(6,B)},[]);let k=m.useMemo(()=>({subscribe:U=>(i.current.add(U),()=>i.current.delete(U)),snapshot:()=>n.current,setState:(U,ae,se)=>{var S,X,H;if(!Object.is(n.current[U],ae)){if(n.current[U]=ae,U==="search")N(),O(),T(1,R);else if(U==="value"&&(se||T(5,B),((S=s.current)==null?void 0:S.value)!==void 0)){let I=ae??"";(H=(X=s.current).onValueChange)==null||H.call(X,I);return}k.emit()}},emit:()=>{i.current.forEach(U=>U())}}),[]),C=m.useMemo(()=>({value:(U,ae,se)=>{var S;ae!==((S=a.current.get(U))==null?void 0:S.value)&&(a.current.set(U,{value:ae,keywords:se}),n.current.filtered.items.set(U,P(ae,se)),T(2,()=>{O(),k.emit()}))},item:(U,ae)=>(r.current.add(U),ae&&(o.current.has(ae)?o.current.get(ae).add(U):o.current.set(ae,new Set([U]))),T(3,()=>{N(),O(),n.current.value||R(),k.emit()}),()=>{a.current.delete(U),r.current.delete(U),n.current.filtered.items.delete(U);let se=D();T(4,()=>{N(),se?.getAttribute("id")===U&&R(),k.emit()})}),group:U=>(o.current.has(U)||o.current.set(U,new Set),()=>{a.current.delete(U),o.current.delete(U)}),filter:()=>s.current.shouldFilter,label:l||e["aria-label"],disablePointerSelection:h,listId:y,inputId:E,labelId:x,listInnerRef:w}),[]);function P(U,ae){var se,S;let X=(S=(se=s.current)==null?void 0:se.filter)!=null?S:iL;return U?X(U,n.current.search,ae):0}function O(){if(!n.current.search||s.current.shouldFilter===!1)return;let U=n.current.filtered.items,ae=[];n.current.filtered.groups.forEach(S=>{let X=o.current.get(S),H=0;X.forEach(I=>{let F=U.get(I);H=Math.max(F,H)}),ae.push([S,H])});let se=w.current;L().sort((S,X)=>{var H,I;let F=S.getAttribute("id"),j=X.getAttribute("id");return((H=U.get(j))!=null?H:0)-((I=U.get(F))!=null?I:0)}).forEach(S=>{let X=S.closest(Ff);X?X.appendChild(S.parentElement===X?S:S.closest(`${Ff} > *`)):se.appendChild(S.parentElement===se?S:S.closest(`${Ff} > *`))}),ae.sort((S,X)=>X[1]-S[1]).forEach(S=>{let X=w.current.querySelector(`${ts}[${Lo}="${encodeURIComponent(S[0])}"]`);X?.parentElement.appendChild(X)})}function R(){let U=L().find(se=>se.getAttribute("aria-disabled")!=="true"),ae=U?.getAttribute(Lo);k.setState("value",ae||void 0)}function N(){var U,ae,se,S;if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let X=0;for(let H of r.current){let I=(ae=(U=a.current.get(H))==null?void 0:U.value)!=null?ae:"",F=(S=(se=a.current.get(H))==null?void 0:se.keywords)!=null?S:[],j=P(I,F);n.current.filtered.items.set(H,j),j>0&&X++}for(let[H,I]of o.current)for(let F of I)if(n.current.filtered.items.get(F)>0){n.current.filtered.groups.add(H);break}n.current.filtered.count=X}function B(){var U,ae,se;let S=D();S&&(((U=S.parentElement)==null?void 0:U.firstChild)===S&&((se=(ae=S.closest(ts))==null?void 0:ae.querySelector(aL))==null||se.scrollIntoView({block:"nearest"})),S.scrollIntoView({block:"nearest"}))}function D(){var U;return(U=w.current)==null?void 0:U.querySelector(`${sg}[aria-selected="true"]`)}function L(){var U;return Array.from((U=w.current)==null?void 0:U.querySelectorAll(N1))}function G(U){let ae=L()[U];ae&&k.setState("value",ae.getAttribute(Lo))}function Y(U){var ae;let se=D(),S=L(),X=S.findIndex(I=>I===se),H=S[X+U];(ae=s.current)!=null&&ae.loop&&(H=X+U<0?S[S.length-1]:X+U===S.length?S[0]:S[X+U]),H&&k.setState("value",H.getAttribute(Lo))}function K(U){let ae=D(),se=ae?.closest(ts),S;for(;se&&!S;)se=U>0?hL(se,ts):gL(se,ts),S=se?.querySelector(N1);S?k.setState("value",S.getAttribute(Lo)):Y(U)}let Z=()=>G(L().length-1),re=U=>{U.preventDefault(),U.metaKey?Z():U.altKey?K(1):Y(1)},fe=U=>{U.preventDefault(),U.metaKey?G(0):U.altKey?K(-1):Y(-1)};return m.createElement(Sn.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:U=>{var ae;if((ae=b.onKeyDown)==null||ae.call(b,U),!U.defaultPrevented)switch(U.key){case"n":case"j":{_&&U.ctrlKey&&re(U);break}case"ArrowDown":{re(U);break}case"p":case"k":{_&&U.ctrlKey&&fe(U);break}case"ArrowUp":{fe(U);break}case"Home":{U.preventDefault(),G(0);break}case"End":{U.preventDefault(),Z();break}case"Enter":if(!U.nativeEvent.isComposing&&U.keyCode!==229){U.preventDefault();let se=D();if(se){let S=new Event(Sp);se.dispatchEvent(S)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:C.inputId,id:C.labelId,style:bL},l),Sd(e,U=>m.createElement($S.Provider,{value:k},m.createElement(BS.Provider,{value:C},U))))}),sL=m.forwardRef((e,t)=>{var n,r;let o=m.useId(),a=m.useRef(null),i=m.useContext(US),s=_l(),l=zS(e),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;ia(()=>{if(!c)return s.item(o,i?.id)},[c]);let u=HS(o,a,[e.value,e.children,a],e.keywords),d=lg(),p=wo(T=>T.value&&T.value===u.current),g=wo(T=>c||s.filter()===!1?!0:T.search?T.filtered.items.get(o)>0:!0);m.useEffect(()=>{let T=a.current;if(!(!T||e.disabled))return T.addEventListener(Sp,v),()=>T.removeEventListener(Sp,v)},[g,e.onSelect,e.disabled]);function v(){var T,k;h(),(k=(T=l.current).onSelect)==null||k.call(T,u.current)}function h(){d.setState("value",u.current,!0)}if(!g)return null;let{disabled:_,value:b,onSelect:y,forceMount:x,keywords:E,...w}=e;return m.createElement(Sn.div,{ref:Qs([a,t]),...w,id:o,"cmdk-item":"",role:"option","aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||s.disablePointerSelection?void 0:h,onClick:_?void 0:v},e.children)}),lL=m.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,i=m.useId(),s=m.useRef(null),l=m.useRef(null),c=m.useId(),u=_l(),d=wo(g=>o||u.filter()===!1?!0:g.search?g.filtered.groups.has(i):!0);ia(()=>u.group(i),[]),HS(i,s,[e.value,e.heading,l]);let p=m.useMemo(()=>({id:i,forceMount:o}),[o]);return m.createElement(Sn.div,{ref:Qs([s,t]),...a,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&m.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),Sd(e,g=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},m.createElement(US.Provider,{value:p},g))))}),cL=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=m.useRef(null),a=wo(i=>!i.search);return!n&&!a?null:m.createElement(Sn.div,{ref:Qs([o,t]),...r,"cmdk-separator":"",role:"separator"})}),uL=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,a=lg(),i=wo(u=>u.search),s=wo(u=>u.value),l=_l(),c=m.useMemo(()=>{var u;let d=(u=l.listInnerRef.current)==null?void 0:u.querySelector(`${sg}[${Lo}="${encodeURIComponent(s)}"]`);return d?.getAttribute("id")},[]);return m.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),m.createElement(Sn.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:o?e.value:i,onChange:u=>{o||a.setState("search",u.target.value),n?.(u.target.value)}})}),dL=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=m.useRef(null),i=m.useRef(null),s=_l();return m.useEffect(()=>{if(i.current&&a.current){let l=i.current,c=a.current,u,d=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let p=l.offsetHeight;c.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return d.observe(l),()=>{cancelAnimationFrame(u),d.unobserve(l)}}},[]),m.createElement(Sn.div,{ref:Qs([a,t]),...o,"cmdk-list":"",role:"listbox","aria-label":r,id:s.listId},Sd(e,l=>m.createElement("div",{ref:Qs([i,s.listInnerRef]),"cmdk-list-sizer":""},l)))}),fL=m.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:i,...s}=e;return m.createElement(tL,{open:n,onOpenChange:r},m.createElement(nL,{container:i},m.createElement(rL,{"cmdk-overlay":"",className:o}),m.createElement(oL,{"aria-label":e.label,"cmdk-dialog":"",className:a},m.createElement(VS,{ref:t,...s}))))}),pL=m.forwardRef((e,t)=>wo(n=>n.filtered.count===0)?m.createElement(Sn.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),mL=m.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return m.createElement(Sn.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Sd(e,i=>m.createElement("div",{"aria-hidden":!0},i)))}),Gt=Object.assign(VS,{List:dL,Item:sL,Input:uL,Group:lL,Separator:cL,Dialog:fL,Empty:pL,Loading:mL});function hL(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function gL(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function zS(e){let t=m.useRef(e);return ia(()=>{t.current=e}),t}var ia=typeof window>"u"?m.useEffect:m.useLayoutEffect;function za(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function Qs(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}function wo(e){let t=lg(),n=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,n,n)}function HS(e,t,n,r=[]){let o=m.useRef(),a=_l();return ia(()=>{var i;let s=(()=>{var c;for(let u of n){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(c=u.current.textContent)==null?void 0:c.trim():o.current}})(),l=r.map(c=>c.trim());a.value(e,s,l),(i=t.current)==null||i.setAttribute(Lo,s),o.current=s}),o}var vL=()=>{let[e,t]=m.useState(),n=za(()=>new Map);return ia(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function yL(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Sd({asChild:e,children:t},n){return e&&m.isValidElement(t)?m.cloneElement(yL(t),{ref:t.ref},n(t.props.children)):n(t)}var bL={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const WS=m.forwardRef(({className:e,...t},n)=>f.jsx(Gt,{ref:n,className:Ee("flex h-full w-full flex-col overflow-hidden rounded-lg bg-white dark:bg-slate-800",e),...t}));WS.displayName=Gt.displayName;const wL=({children:e,...t})=>f.jsx(Ar,{...t,children:f.jsx(tr,{className:"overflow-hidden p-0 shadow-2xl [&_[dialog-overlay]]:bg-red-100",children:f.jsx(WS,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-slate-500 [&_[cmdk-group]]:px-2 [&_[cmdk-group]_+[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),GS=m.forwardRef(({className:e,...t},n)=>f.jsxs("div",{className:"flex items-center border-b border-b-slate-100 px-4 dark:border-b-slate-700","cmdk-input-wrapper":"",children:[f.jsx(gC,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),f.jsx(Gt.Input,{ref:n,className:Ee("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-slate-400 disabled:cursor-not-allowed disabled:opacity-50 dark:text-slate-50",e),...t})]}));GS.displayName=Gt.Input.displayName;const KS=m.forwardRef(({className:e,...t},n)=>f.jsx(Gt.List,{ref:n,className:Ee("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));KS.displayName=Gt.List.displayName;const qS=m.forwardRef((e,t)=>f.jsx(Gt.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));qS.displayName=Gt.Empty.displayName;const XS=m.forwardRef(({className:e,...t},n)=>f.jsx(Gt.Group,{ref:n,className:Ee("overflow-hidden py-3 px-2 text-slate-700 dark:text-slate-400 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pb-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-slate-900 [&_[cmdk-group-heading]]:dark:text-slate-300",e),...t}));XS.displayName=Gt.Group.displayName;const _L=m.forwardRef(({className:e,...t},n)=>f.jsx(Gt.Separator,{ref:n,className:Ee("-mx-1 h-px bg-slate-100 dark:bg-slate-700",e),...t}));_L.displayName=Gt.Separator.displayName;const cg=m.forwardRef(({className:e,...t},n)=>f.jsx(Gt.Item,{ref:n,className:Ee("relative flex cursor-default select-none items-center rounded-md py-1.5 px-2 text-sm font-medium outline-none aria-selected:bg-slate-100 data-[disabled='true']:pointer-events-none data-[disabled='true']:opacity-50 dark:aria-selected:bg-slate-700",e),...t}));cg.displayName=Gt.Item.displayName;const xL=()=>{const{commandPaletteOpen:e,setCommandPaletteOpen:t,setSelectedDevice:n,removeDevice:r,selectedDevice:o,darkMode:a,setDarkMode:i,setAccent:s}=$n(),{getDevices:l}=ca(),{setDialogOpen:c,setActivePage:u,connection:d}=Te(),p=[{label:"Goto",icon:r6,commands:[{label:"Messages",icon:pC,action(){u("messages")}},{label:"Map",icon:fC,action(){u("map")}},{label:"Config",icon:Wh,action(){u("config")},tags:["settings"]},{label:"Channels",icon:cC,action(){u("channels")}},{label:"Nodes",icon:Gh,action(){u("nodes")}}]},{label:"Manage",icon:d6,commands:[{label:"Switch Node",icon:UR,subItems:l().map(g=>({label:g.nodes.get(g.hardware.myNodeNum)?.user?.longName??g.hardware.myNodeNum.toString(),icon:f.jsx(da.Hashicon,{size:16,value:g.hardware.myNodeNum.toString()}),action(){n(g.id)}}))},{label:"Connect New Node",icon:Hh,action(){n(0)}}]},{label:"Contextual",icon:aC,commands:[{label:"QR Code",icon:Pc,subItems:[{label:"Generator",icon:f.jsx(Pc,{size:16}),action(){c("QR",!0)}},{label:"Import",icon:f.jsx(Pc,{size:16}),action(){c("import",!0)}}]},{label:"Disconnect",icon:KR,action(){d?.disconnect(),n(0),r(o??0)}},{label:"Schedule Shutdown",icon:hC,action(){c("shutdown",!0)}},{label:"Schedule Reboot",icon:lp,action(){c("reboot",!0)}},{label:"Reset Nodes",icon:vC,action(){d?.resetNodes()}},{label:"Factory Reset Device",icon:Hy,action(){d?.factoryResetDevice()}},{label:"Factory Reset Config",icon:Hy,action(){d?.factoryResetConfig()}}]},{label:"Debug",icon:WR,commands:[{label:"Reconfigure",icon:lp,action(){d?.configure()}},{label:"[WIP] Clear Messages",icon:YR,action(){alert("This feature is not implemented")}}]},{label:"Application",icon:l6,commands:[{label:"Toggle Dark Mode",icon:mC,action(){i(!a)}},{label:"Accent Color",icon:s6,subItems:[{label:"Red",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#f25555]":"bg-[#f28585]"}`}),action(){s("red")}},{label:"Orange",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#e1720b]":"bg-[#edb17a]"}`}),action(){s("orange")}},{label:"Yellow",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#ac8c1a]":"bg-[#e0cc87]"}`}),action(){s("yellow")}},{label:"Green",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#27a341]":"bg-[#8bc9c5]"}`}),action(){s("green")}},{label:"Blue",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#2093fe]":"bg-[#70afea]"}`}),action(){s("blue")}},{label:"Purple",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#926bff]":"bg-[#a09eef]"}`}),action(){s("purple")}},{label:"Pink",icon:f.jsx("span",{className:`h-3 w-3 rounded-full ${a?"bg-[#e454c4]":"bg-[#dba0c7]"}`}),action(){s("pink")}}]}]}];return m.useEffect(()=>{const g=v=>{v.key==="k"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),t(!0))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[t]),f.jsxs(wL,{open:e,onOpenChange:t,children:[f.jsx(GS,{placeholder:"Type a command or search..."}),f.jsxs(KS,{children:[f.jsx(qS,{children:"No results found."}),p.map(g=>f.jsx(XS,{heading:g.label,children:g.commands.map(v=>f.jsxs("div",{children:[f.jsxs(cg,{onSelect:()=>{v.action?.(),t(!1)},children:[f.jsx(v.icon,{size:16,className:"mr-2"}),v.label]}),v.subItems?.map(h=>f.jsx(kL,{label:h.label,icon:h.icon,action:h.action},h.label))]},v.label))},g.label))]})]})},kL=({label:e,icon:t,action:n})=>wo(o=>o.search)?f.jsxs(cg,{onSelect:n,children:[t,e]}):null,P1=({active:e,onClick:t,children:n})=>f.jsxs("li",{className:"aspect-w-1 aspect-h-1 relative w-full",onClick:t,onKeyDown:t,children:[e&&f.jsx("div",{className:"absolute -left-2 h-10 w-1.5 rounded-full bg-accent"}),f.jsx("div",{className:"flex aspect-square cursor-pointer flex-col items-center justify-center",children:n})]});var CL="Separator",M1="horizontal",SL=["horizontal","vertical"],YS=m.forwardRef((e,t)=>{const{decorative:n,orientation:r=M1,...o}=e,a=TL(r)?r:M1,s=n?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return f.jsx(xe.div,{"data-orientation":a,...s,...o,ref:t})});YS.displayName=CL;function TL(e){return SL.includes(e)}var QS=YS;const Cu=m.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>f.jsx(QS,{ref:o,decorative:n,orientation:t,className:Ee("bg-slate-200 dark:bg-slate-700",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Cu.displayName=QS.displayName;const EL=({children:e})=>f.jsx("code",{className:"relative rounded bg-slate-100 px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold text-slate-900 dark:bg-slate-800 dark:text-slate-400",children:e}),NL=()=>{const{getDevices:e}=ca(),{selectedDevice:t,setSelectedDevice:n,darkMode:r,setDarkMode:o,setCommandPaletteOpen:a,setConnectDialogOpen:i}=$n();return f.jsxs("nav",{className:"flex flex-col justify-between border-r-[0.5px] border-slate-300 bg-transparent pt-2 dark:border-slate-700",children:[f.jsx("div",{className:"flex flex-col overflow-y-hidden",children:f.jsxs("ul",{className:"flex w-20 grow flex-col items-center space-y-4 bg-transparent py-4 px-5",children:[f.jsx(P1,{active:t===0,onClick:()=>{n(0)},children:f.jsx(e6,{})}),e().map(s=>f.jsx(P1,{onClick:()=>{n(s.id)},active:t===s.id,children:f.jsx(da.Hashicon,{size:24,value:s.hardware.myNodeNum.toString()})},s.id)),f.jsx(Cu,{}),f.jsx("button",{type:"button",onClick:()=>i(!0),className:"transition-all duration-300 hover:text-accent",children:f.jsx(Hh,{})})]})}),f.jsxs("div",{className:"flex w-20 flex-col items-center space-y-5 bg-transparent px-5 pb-5",children:[f.jsx("button",{type:"button",className:"transition-all hover:text-accent",onClick:()=>o(!r),children:r?f.jsx(p6,{}):f.jsx(mC,{})}),f.jsx("button",{type:"button",className:"transition-all hover:text-accent",onClick:()=>a(!0),children:f.jsx(gC,{})}),f.jsx("button",{type:"button",className:"transition-all hover:text-accent",children:f.jsx(n6,{})}),f.jsx(Cu,{}),f.jsx(EL,{children:"06d2c39"})]})]})},PL=({open:e,onOpenChange:t})=>{const{connection:n,nodes:r,removeNode:o}=Te(),{nodeNumToBeRemoved:a}=$n(),i=()=>{n?.removeNodeByNum(a),o(a),t(!1)};return f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Remove Node?"}),f.jsx(To,{children:"Are you sure you want to remove this Node?"})]}),f.jsx("div",{className:"gap-4",children:f.jsx("form",{onSubmit:i,children:f.jsx(xn,{children:r.get(a)?.user?.longName})})}),f.jsx($i,{children:f.jsx(pt,{variant:"destructive",onClick:()=>i(),children:"Remove"})})]})})},ML=({open:e,onOpenChange:t})=>{const{hardware:n,nodes:r,connection:o}=Te(),a=r.get(n.myNodeNum),{register:i,handleSubmit:s}=Eh({values:{longName:a?.user?.longName??"Unknown",shortName:a?.user?.shortName??"Unknown"}}),l=s(c=>{o?.setOwner(new pe.Mesh.User({...a?.user,...c})),t(!1)});return f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Change Device Name"}),f.jsx(To,{children:"The Device will restart once the config is saved."})]}),f.jsx("div",{className:"gap-4",children:f.jsxs("form",{onSubmit:l,children:[f.jsx(xn,{children:"Long Name"}),f.jsx(jn,{...i("longName")}),f.jsx(xn,{children:"Short Name"}),f.jsx(jn,{maxLength:4,...i("shortName")})]})}),f.jsx($i,{children:f.jsx(pt,{onClick:()=>l(),children:"Save"})})]})})};var ug="Checkbox",[AL,R7]=Pr(ug),[RL,IL]=AL(ug),ZS=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:a,required:i,disabled:s,value:l="on",onCheckedChange:c,...u}=e,[d,p]=m.useState(null),g=$e(t,x=>p(x)),v=m.useRef(!1),h=d?!!d.closest("form"):!0,[_=!1,b]=go({prop:o,defaultProp:a,onChange:c}),y=m.useRef(_);return m.useEffect(()=>{const x=d?.form;if(x){const E=()=>b(y.current);return x.addEventListener("reset",E),()=>x.removeEventListener("reset",E)}},[d,b]),f.jsxs(RL,{scope:n,state:_,disabled:s,children:[f.jsx(xe.button,{type:"button",role:"checkbox","aria-checked":Ko(_)?"mixed":_,"aria-required":i,"data-state":tT(_),"data-disabled":s?"":void 0,disabled:s,value:l,...u,ref:g,onKeyDown:we(e.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:we(e.onClick,x=>{b(E=>Ko(E)?!0:!E),h&&(v.current=x.isPropagationStopped(),v.current||x.stopPropagation())})}),h&&f.jsx(OL,{control:d,bubbles:!v.current,name:r,value:l,checked:_,required:i,disabled:s,style:{transform:"translateX(-100%)"}})]})});ZS.displayName=ug;var JS="CheckboxIndicator",eT=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,a=IL(JS,n);return f.jsx(ua,{present:r||Ko(a.state)||a.state===!0,children:f.jsx(xe.span,{"data-state":tT(a.state),"data-disabled":a.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});eT.displayName=JS;var OL=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,a=m.useRef(null),i=Fh(n),s=Dh(t);return m.useEffect(()=>{const l=a.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==n&&d){const p=new Event("click",{bubbles:r});l.indeterminate=Ko(n),d.call(l,Ko(n)?!1:n),l.dispatchEvent(p)}},[i,n,r]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:Ko(n)?!1:n,...o,tabIndex:-1,ref:a,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ko(e){return e==="indeterminate"}function tT(e){return Ko(e)?"indeterminate":e?"checked":"unchecked"}var nT=ZS,DL=eT;const dg=m.forwardRef(({className:e,...t},n)=>f.jsx(nT,{ref:n,className:Ee("peer h-4 w-4 shrink-0 rounded-sm border border-slate-300 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-700 dark:text-slate-50 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900",e),...t,children:f.jsx(DL,{className:Ee("flex items-center justify-center"),children:f.jsx(iC,{className:"h-4 w-4"})})}));dg.displayName=nT.displayName;const LL=({open:e,onOpenChange:t})=>{const[n,r]=m.useState(""),[o,a]=m.useState(),[i,s]=m.useState(!1),{connection:l}=Te();m.useEffect(()=>{try{const u=new URL(n);if(u.hostname!=="meshtastic.org"&&u.pathname!=="/e/"||!u.hash)throw"Invalid Meshtastic URL";const d=u.hash.substring(1),p=d.padEnd(d.length+(4-d.length%4)%4,"=").replace(/-/g,"+").replace(/_/g,"/");a(pe.AppOnly.ChannelSet.fromBinary(Jr(p))),s(!0)}catch{s(!1),a(void 0)}},[n]);const c=()=>{o?.settings.map((u,d)=>{l?.setChannel(new pe.Channel.Channel({index:d,role:d===0?pe.Channel.Channel_Role.PRIMARY:pe.Channel.Channel_Role.SECONDARY,settings:u}))}),o?.loraConfig&&l?.setConfig(new pe.Config.Config({payloadVariant:{case:"lora",value:o.loraConfig}}))};return f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Import Channel Set"}),f.jsx(To,{children:"The current LoRa configuration will be overridden."})]}),f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsx(xn,{children:"Channel Set/QR Code URL"}),f.jsx(jn,{value:n,suffix:i?"✅":"❌",onChange:u=>{r(u.target.value)}}),i&&f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsx("div",{className:"flex w-full gap-2",children:f.jsxs("div",{className:"w-36",children:[f.jsx(xn,{children:"Use Preset?"}),f.jsx(md,{disabled:!0,checked:o?.loraConfig?.usePreset??!0})]})}),f.jsx("span",{className:"text-md block font-medium text-textPrimary",children:"Channels:"}),f.jsx("div",{className:"flex w-40 flex-col gap-1",children:o?.settings.map(u=>f.jsxs("div",{className:"flex justify-between",children:[f.jsx(xn,{children:u.name.length?u.name:`Channel: ${u.id}`}),f.jsx(dg,{},u.id)]},u.id))})]})]}),f.jsx($i,{children:f.jsx(pt,{onClick:c,disabled:!i,children:"Apply"})})]})})};var fg={},Su={exports:{}};Su.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,a=2,i=9007199254740991,s="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",d="[object Date]",p="[object Error]",g="[object Function]",v="[object GeneratorFunction]",h="[object Map]",_="[object Number]",b="[object Null]",y="[object Object]",x="[object Promise]",E="[object Proxy]",w="[object RegExp]",T="[object Set]",k="[object String]",C="[object Symbol]",P="[object Undefined]",O="[object WeakMap]",R="[object ArrayBuffer]",N="[object DataView]",B="[object Float32Array]",D="[object Float64Array]",L="[object Int8Array]",G="[object Int16Array]",Y="[object Int32Array]",K="[object Uint8Array]",Z="[object Uint8ClampedArray]",re="[object Uint16Array]",fe="[object Uint32Array]",U=/[\\^$.*+?()[\]{}|]/g,ae=/^\[object .+?Constructor\]$/,se=/^(?:0|[1-9]\d*)$/,S={};S[B]=S[D]=S[L]=S[G]=S[Y]=S[K]=S[Z]=S[re]=S[fe]=!0,S[s]=S[l]=S[R]=S[u]=S[N]=S[d]=S[p]=S[g]=S[h]=S[_]=S[y]=S[w]=S[T]=S[k]=S[O]=!1;var X=typeof _t=="object"&&_t&&_t.Object===Object&&_t,H=typeof self=="object"&&self&&self.Object===Object&&self,I=X||H||Function("return this")(),F=t&&!t.nodeType&&t,j=F&&!0&&e&&!e.nodeType&&e,$=j&&j.exports===F,V=$&&X.process,J=function(){try{return V&&V.binding&&V.binding("util")}catch{}}(),ee=J&&J.isTypedArray;function ce(M,z){for(var ne=-1,he=M==null?0:M.length,Ue=0,Ce=[];++ne-1}function Aa(M,z){var ne=this.__data__,he=kl(ne,M);return he<0?(++this.size,ne.push([M,z])):ne[he][1]=z,this}Ft.prototype.clear=Ea,Ft.prototype.delete=Na,Ft.prototype.get=Pa,Ft.prototype.has=Ma,Ft.prototype.set=Aa;function un(M){var z=-1,ne=M==null?0:M.length;for(this.clear();++zmt))return!1;var Ke=Ce.get(M);if(Ke&&Ce.get(z))return Ke==z;var Kt=-1,En=!0,Ct=ne&a?new xl:void 0;for(Ce.set(M,z),Ce.set(z,M);++Kt-1&&M%1==0&&M-1&&M%1==0&&M<=i}function Sg(M){var z=typeof M;return M!=null&&(z=="object"||z=="function")}function Vi(M){return M!=null&&typeof M=="object"}var Tg=ee?q(ee):WT;function aE(M){return rE(M)?UT(M):GT(M)}function iE(){return[]}function sE(){return!1}e.exports=oE})(Su,Su.exports);var jL=Su.exports,rT={exports:{}};(function(e,t){var n=function(){var r=function(w,T){var k=236,C=17,P=w,O=a[T],R=null,N=0,B=null,D=[],L={},G=function(I,F){N=P*4+17,R=function(j){for(var $=new Array(j),V=0;V=7&&fe(I),B==null&&(B=S(P,O,D)),ae(B,F)},Y=function(I,F){for(var j=-1;j<=7;j+=1)if(!(I+j<=-1||N<=I+j))for(var $=-1;$<=7;$+=1)F+$<=-1||N<=F+$||(0<=j&&j<=6&&($==0||$==6)||0<=$&&$<=6&&(j==0||j==6)||2<=j&&j<=4&&2<=$&&$<=4?R[I+j][F+$]=!0:R[I+j][F+$]=!1)},K=function(){for(var I=0,F=0,j=0;j<8;j+=1){G(!0,j);var $=s.getLostPoint(L);(j==0||I>$)&&(I=$,F=j)}return F},Z=function(){for(var I=8;I>j&1)==1;R[Math.floor(j/3)][j%3+N-8-3]=$}for(var j=0;j<18;j+=1){var $=!I&&(F>>j&1)==1;R[j%3+N-8-3][Math.floor(j/3)]=$}},U=function(I,F){for(var j=O<<3|F,$=s.getBCHTypeInfo(j),V=0;V<15;V+=1){var J=!I&&($>>V&1)==1;V<6?R[V][8]=J:V<8?R[V+1][8]=J:R[N-15+V][8]=J}for(var V=0;V<15;V+=1){var J=!I&&($>>V&1)==1;V<8?R[8][N-V-1]=J:V<9?R[8][15-V-1+1]=J:R[8][15-V-1]=J}R[N-8][8]=!I},ae=function(I,F){for(var j=-1,$=N-1,V=7,J=0,ee=s.getMaskFunction(F),ce=N-1;ce>0;ce-=2)for(ce==6&&(ce-=1);;){for(var Pe=0;Pe<2;Pe+=1)if(R[$][ce-Pe]==null){var Oe=!1;J>>V&1)==1);var A=ee($,ce-Pe);A&&(Oe=!Oe),R[$][ce-Pe]=Oe,V-=1,V==-1&&(J+=1,V=7)}if($+=j,$<0||N<=$){$-=j,j=-j;break}}},se=function(I,F){for(var j=0,$=0,V=0,J=new Array(F.length),ee=new Array(F.length),ce=0;ce=0?ue.getAt(le):0}}for(var oe=0,A=0;Ace*8)throw"code length overflow. ("+V.getLengthInBits()+">"+ce*8+")";for(V.getLengthInBits()+4<=ce*8&&V.put(0,4);V.getLengthInBits()%8!=0;)V.putBit(!1);for(;!(V.getLengthInBits()>=ce*8||(V.put(k,8),V.getLengthInBits()>=ce*8));)V.put(C,8);return se(V,$)};L.addData=function(I,F){F=F||"Byte";var j=null;switch(F){case"Numeric":j=p(I);break;case"Alphanumeric":j=g(I);break;case"Byte":j=v(I);break;case"Kanji":j=h(I);break;default:throw"mode:"+F}D.push(j),B=null},L.isDark=function(I,F){if(I<0||N<=I||F<0||N<=F)throw I+","+F;return R[I][F]},L.getModuleCount=function(){return N},L.make=function(){if(P<1){for(var I=1;I<40;I++){for(var F=u.getRSBlocks(I,O),j=d(),$=0;$"u"?I*4:F;var j="";j+='";for(var V=0;V';j+=""}return j+="",j+="
",j},L.createSvgTag=function(I,F,j,$){var V={};typeof arguments[0]=="object"&&(V=arguments[0],I=V.cellSize,F=V.margin,j=V.alt,$=V.title),I=I||2,F=typeof F>"u"?I*4:F,j=typeof j=="string"?{text:j}:j||{},j.text=j.text||null,j.id=j.text?j.id||"qrcode-description":null,$=typeof $=="string"?{text:$}:$||{},$.text=$.text||null,$.id=$.text?$.id||"qrcode-title":null;var J=L.getModuleCount()*I+F*2,ee,ce,Pe,Oe,A="",q;for(q="l"+I+",0 0,"+I+" -"+I+",0 0,-"+I+"z ",A+=''+X($.text)+"":"",A+=j.text?''+X(j.text)+"":"",A+='',A+='"u"?I*4:F;var j=L.getModuleCount()*I+F*2,$=F,V=j-F;return E(j,j,function(J,ee){if($<=J&&J"u"?I*4:F;var $=L.getModuleCount()*I+F*2,V="";return V+="",V};var X=function(I){for(var F="",j=0;j":F+=">";break;case"&":F+="&";break;case'"':F+=""";break;default:F+=$;break}}return F},H=function(I){var F=1;I=typeof I>"u"?F*2:I;var j=L.getModuleCount()*F+I*2,$=I,V=j-I,J,ee,ce,Pe,Oe,A={"██":"█","█ ":"▀"," █":"▄"," ":" "},q={"██":"▀","█ ":"▀"," █":" "," ":" "},Q="";for(J=0;J=V?q[Oe]:A[Oe];Q+=` -`}return j%2&&I>0?Q.substring(0,Q.length-j-1)+Array(j+1).join("▀"):Q.substring(0,Q.length-1)};return L.createASCII=function(I,F){if(I=I||1,I<2)return H(F);I-=1,F=typeof F>"u"?I*2:F;var j=L.getModuleCount()*I+F*2,$=F,V=j-F,J,ee,ce,Pe,Oe=Array(I+1).join("██"),A=Array(I+1).join(" "),q="",Q="";for(J=0;J>>8),O.push(B&255)):O.push(C)}}return O}};var o={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},a={L:1,M:0,Q:3,H:2},i={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s=function(){var w=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],T=1335,k=7973,C=21522,P={},O=function(R){for(var N=0;R!=0;)N+=1,R>>>=1;return N};return P.getBCHTypeInfo=function(R){for(var N=R<<10;O(N)-O(T)>=0;)N^=T<=0;)N^=k<5&&(B+=3+G-5)}for(var D=0;D=256;)P-=255;return w[P]},C}();function c(w,T){if(typeof w.length>"u")throw w.length+"/"+T;var k=function(){for(var P=0;P"u")throw"bad rs block @ typeNumber:"+P+"/errorCorrectionLevel:"+O;for(var N=R.length/3,B=[],D=0;D>>7-C%8&1)==1},k.put=function(C,P){for(var O=0;O>>P-O-1&1)==1)},k.getLengthInBits=function(){return T},k.putBit=function(C){var P=Math.floor(T/8);w.length<=P&&w.push(0),C&&(w[P]|=128>>>T%8),T+=1},k},p=function(w){var T=o.MODE_NUMBER,k=w,C={};C.getMode=function(){return T},C.getLength=function(R){return k.length},C.write=function(R){for(var N=k,B=0;B+2>>8&255)*192+(B&255),O.put(B,13),N+=2}if(N>>8)},T.writeBytes=function(k,C,P){C=C||0,P=P||k.length;for(var O=0;O0&&(k+=","),k+=w[C];return k+="]",k},T},b=function(){var w=0,T=0,k=0,C="",P={},O=function(N){C+=String.fromCharCode(R(N&63))},R=function(N){if(!(N<0)){if(N<26)return 65+N;if(N<52)return 97+(N-26);if(N<62)return 48+(N-52);if(N==62)return 43;if(N==63)return 47}throw"n:"+N};return P.writeByte=function(N){for(w=w<<8|N&255,T+=8,k+=1;T>=6;)O(w>>>T-6),T-=6},P.flush=function(){if(T>0&&(O(w<<6-T),w=0,T=0),k%3!=0)for(var N=3-k%3,B=0;B=T.length){if(P==0)return-1;throw"unexpected end of file./"+P}var N=T.charAt(k);if(k+=1,N=="=")return P=0,-1;if(N.match(/^\s$/))continue;C=C<<6|R(N.charCodeAt(0)),P+=6}var B=C>>>P-8&255;return P-=8,B};var R=function(N){if(65<=N&&N<=90)return N-65;if(97<=N&&N<=122)return N-97+26;if(48<=N&&N<=57)return N-48+52;if(N==43)return 62;if(N==47)return 63;throw"c:"+N};return O},x=function(w,T){var k=w,C=T,P=new Array(w*T),O={};O.setPixel=function(D,L,G){P[L*k+D]=G},O.write=function(D){D.writeString("GIF87a"),D.writeShort(k),D.writeShort(C),D.writeByte(128),D.writeByte(0),D.writeByte(0),D.writeByte(0),D.writeByte(0),D.writeByte(0),D.writeByte(255),D.writeByte(255),D.writeByte(255),D.writeString(","),D.writeShort(0),D.writeShort(0),D.writeShort(k),D.writeShort(C),D.writeByte(0);var L=2,G=N(L);D.writeByte(L);for(var Y=0;G.length-Y>255;)D.writeByte(255),D.writeBytes(G,Y,255),Y+=255;D.writeByte(G.length-Y),D.writeBytes(G,Y,G.length-Y),D.writeByte(0),D.writeString(";")};var R=function(D){var L=D,G=0,Y=0,K={};return K.write=function(Z,re){if(Z>>>re)throw"length over";for(;G+re>=8;)L.writeByte(255&(Z<>>=8-G,Y=0,G=0;Y=Z<0&&L.writeByte(Y)},K},N=function(D){for(var L=1<>6,128|l&63):l<55296||l>=57344?i.push(224|l>>12,128|l>>6&63,128|l&63):(s++,l=65536+((l&1023)<<10|a.charCodeAt(s)&1023),i.push(240|l>>18,128|l>>12&63,128|l>>6&63,128|l&63))}return i}return o(r)}})(),function(r){e.exports=r()}(function(){return n})})(rT);var FL=rT.exports,BL=_t&&_t.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var a in o)o.hasOwnProperty(a)&&(r[a]=o[a])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(fg,"__esModule",{value:!0});var oT=fg.QRCode=void 0,$L=jL,UL=FL,Bf=m,VL=an,zL=function(e){BL(t,e);function t(n){var r=e.call(this,n)||this;return r.canvas=Bf.createRef(),r}return t.utf16to8=function(n){var r="",o,a,i=n.length;for(o=0;o=1&&a<=127?r+=n.charAt(o):a>2047?(r+=String.fromCharCode(224|a>>12&15),r+=String.fromCharCode(128|a>>6&63),r+=String.fromCharCode(128|a>>0&63)):(r+=String.fromCharCode(192|a>>6&31),r+=String.fromCharCode(128|a>>0&63));return r},t.prototype.drawRoundedSquare=function(n,r,o,a,i,s,l,c){c.lineWidth=n,c.fillStyle=i,c.strokeStyle=i,o+=n/2,r+=n/2,a-=n,Array.isArray(s)||(s=[s,s,s,s]),s=s.map(function(v){return v=Math.min(v,a/2),v<0?0:v});var u=s[0]||0,d=s[1]||0,p=s[2]||0,g=s[3]||0;c.beginPath(),c.moveTo(r+u,o),c.lineTo(r+a-d,o),d&&c.quadraticCurveTo(r+a,o,r+a,o+d),c.lineTo(r+a,o+a-p),p&&c.quadraticCurveTo(r+a,o+a,r+a-p,o+a),c.lineTo(r+g,o+a),g&&c.quadraticCurveTo(r,o+a,r,o+a-g),c.lineTo(r,o+u),u&&c.quadraticCurveTo(r,o,r+u,o),c.closePath(),c.stroke(),l&&c.fill()},t.prototype.drawPositioningPattern=function(n,r,o,a,i,s,l){l===void 0&&(l=[0,0,0,0]);var c=Math.ceil(r),u,d;typeof l!="number"&&!Array.isArray(l)?(u=l.outer||0,d=l.inner||0):(u=l,d=u);var p,g;typeof s!="string"?(p=s.outer,g=s.inner):(p=s,g=s);var v=a*r+o,h=i*r+o,_=r*7;this.drawRoundedSquare(c,h,v,_,p,u,!1,n),_=r*3,v+=r*2,h+=r*2,this.drawRoundedSquare(c,h,v,_,g,d,!0,n)},t.prototype.isInPositioninZone=function(n,r,o){return o.some(function(a){return r>=a.row&&r<=a.row+7&&n>=a.col&&n<=a.col+7})},t.prototype.transformPixelLengthIntoNumberOfCells=function(n,r){return n/r},t.prototype.isCoordinateInImage=function(n,r,o,a,i,s,l,c){if(c){var u=2,d=this.transformPixelLengthIntoNumberOfCells(i,l),p=this.transformPixelLengthIntoNumberOfCells(s,l),g=this.transformPixelLengthIntoNumberOfCells(o,l)-1,v=this.transformPixelLengthIntoNumberOfCells(a,l)-1;return r>=d-u&&r<=d+g+u&&n>=p-u&&n<=p+v+u}else return!1},t.prototype.shouldComponentUpdate=function(n){return!$L(this.props,n)},t.prototype.componentDidMount=function(){this.update()},t.prototype.componentDidUpdate=function(){this.update()},t.prototype.update=function(){var n=this.props,r=n.value,o=n.ecLevel,a=n.enableCORS,i=n.bgColor,s=n.fgColor,l=n.logoImage,c=n.logoOpacity,u=n.logoOnLoad,d=n.removeQrCodeBehindLogo,p=n.qrStyle,g=n.eyeRadius,v=n.eyeColor,h=n.logoPaddingStyle,_=+this.props.size,b=+this.props.quietZone,y=this.props.logoWidth?+this.props.logoWidth:0,x=this.props.logoHeight?+this.props.logoHeight:0,E=this.props.logoPadding?+this.props.logoPadding:0,w=UL(0,o);w.addData(t.utf16to8(r)),w.make();var T=VL.findDOMNode(this.canvas.current),k=T.getContext("2d"),C=_+2*b,P=w.getModuleCount(),O=_/P,R=window.devicePixelRatio||1;T.height=T.width=C*R,k.scale(R,R),k.fillStyle=i,k.fillRect(0,0,C,C);var N=b,B=[{row:0,col:0},{row:0,col:P-7},{row:P-7,col:0}];if(k.strokeStyle=s,p==="dots"){k.fillStyle=s;for(var D=O/2,L=0;L0&&!w.isDark(L-1,G)&&G>0&&!w.isDark(L,G-1)&&(Y[0]=!0),L>0&&!w.isDark(L-1,G)&&G0&&!w.isDark(L,G-1)&&(Y[3]=!0);var K=Math.ceil((G+1)*O)-Math.floor(G*O),Z=Math.ceil((L+1)*O)-Math.floor(L*O);k.fillStyle=s,k.beginPath(),k.arc(Math.round(G*O)+D+N,Math.round(L*O)+D+N,D,0,2*Math.PI,!1),k.closePath(),k.fill(),Y[0]||k.fillRect(Math.round(G*O)+N,Math.round(L*O)+N,K/2,Z/2),Y[1]||k.fillRect(Math.round(G*O)+N+Math.floor(K/2),Math.round(L*O)+N,K/2,Z/2),Y[2]||k.fillRect(Math.round(G*O)+N+Math.floor(K/2),Math.round(L*O)+N+Math.floor(Z/2),K/2,Z/2),Y[3]||k.fillRect(Math.round(G*O)+N,Math.round(L*O)+N+Math.floor(Z/2),K/2,Z/2)}}else for(var L=0;L{const[o,a]=m.useState([0]),[i,s]=m.useState(""),[l,c]=m.useState(),u=m.useMemo(()=>Array.from(r.values()),[r]);return m.useEffect(()=>{const d=u.filter(v=>o.includes(v.index)).map(v=>v.settings).filter(v=>!!v),p=new pe.AppOnly.ChannelSet(new pe.AppOnly.ChannelSet({loraConfig:n,settings:d})),g=fr(p.toBinary()).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");s(`https://meshtastic.org/e/${l?"?add=true":""}#${g}`)},[u,o,l,n]),f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Generate QR Code"}),f.jsx(To,{children:"The current LoRa configuration will also be shared."})]}),f.jsxs("div",{className:"grid gap-4 py-4",children:[f.jsxs("div",{className:"flex gap-3 px-4 py-5 sm:p-6",children:[f.jsx("div",{className:"flex w-40 flex-col gap-2",children:u.map(d=>f.jsxs("div",{className:"flex justify-between",children:[f.jsx(xn,{children:d.settings?.name.length?d.settings.name:d.role===pe.Channel.Channel_Role.PRIMARY?"Primary":`Channel: ${d.index}`}),f.jsx(dg,{checked:o.includes(d.index),onCheckedChange:()=>{o.includes(d.index)?a(o.filter(p=>p!==d.index)):a([...o,d.index])}},d.index)]},d.index))}),f.jsx(oT,{value:i,size:200,qrStyle:"dots"})]}),f.jsxs("div",{className:"flex justify-center",children:[f.jsx("button",{type:"button",className:`border-black border-t border-l border-b rounded-l h-10 px-7 py-2 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 ${l?"focus:ring-green-800 bg-green-800 text-white":"focus:ring-slate-400 bg-slate-400 hover:bg-green-600"}`,onClick:()=>c(!0),children:"Add Channels"}),f.jsx("button",{type:"button",className:`border-black border-t border-r border-b rounded-r h-10 px-4 py-2 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 ${l?"focus:ring-slate-400 bg-slate-400 hover:bg-green-600":"focus:ring-green-800 bg-green-800 text-white"}`,onClick:()=>c(!1),children:"Replace Channels"})]})]}),f.jsxs($i,{children:[f.jsx(xn,{children:"Sharable URL"}),f.jsx(jn,{value:i,disabled:!0,action:{icon:qR,onClick(){navigator.clipboard.writeText(i)}}})]})]})})},WL=({open:e,onOpenChange:t})=>{const{connection:n}=Te(),[r,o]=m.useState(5);return f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Schedule Reboot"}),f.jsx(To,{children:"Reboot the connected node after x minutes."})]}),f.jsxs("div",{className:"flex gap-2 p-4",children:[f.jsx(jn,{type:"number",value:r,onChange:a=>o(Number.parseInt(a.target.value)),action:{icon:lC,onClick(){n?.reboot(r*60).then(()=>t(!1))}}}),f.jsxs(pt,{className:"w-24",onClick:()=>{n?.reboot(2).then(()=>t(!1))},children:[f.jsx(lp,{className:"mr-2",size:16}),"Now"]})]})]})})},GL=({open:e,onOpenChange:t})=>{const{connection:n}=Te(),[r,o]=m.useState(5);return f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsxs(Rr,{children:[f.jsx(Ir,{children:"Schedule Shutdown"}),f.jsx(To,{children:"Turn off the connected node after x minutes."})]}),f.jsxs("div",{className:"flex gap-2 p-4",children:[f.jsx(jn,{type:"number",value:r,onChange:a=>o(Number.parseInt(a.target.value)),suffix:"Minutes"}),f.jsx(pt,{className:"w-24",onClick:()=>{n?.shutdown(r*60).then(()=>t(!1))},children:f.jsx(lC,{size:16})}),f.jsxs(pt,{className:"w-24",onClick:()=>{n?.shutdown(2).then(()=>()=>t(!1))},children:[f.jsx(hC,{className:"mr-2",size:16}),"Now"]})]})]})})},KL=()=>{const{channels:e,config:t,dialog:n,setDialogOpen:r}=Te();return f.jsxs(f.Fragment,{children:[f.jsx(HL,{open:n.QR,onOpenChange:o=>{r("QR",o)},channels:e,loraConfig:t.lora}),f.jsx(LL,{open:n.import,onOpenChange:o=>{r("import",o)},loraConfig:t.lora}),f.jsx(GL,{open:n.shutdown,onOpenChange:()=>{r("shutdown",!1)}}),f.jsx(WL,{open:n.reboot,onOpenChange:()=>{r("reboot",!1)}}),f.jsx(ML,{open:n.deviceName,onOpenChange:o=>{r("deviceName",o)}}),f.jsx(PL,{open:n.nodeRemoval,onOpenChange:o=>{r("nodeRemoval",o)}})]})},pg=(e,t)=>{let n=0;t.events.onDeviceMetadataPacket.subscribe(r=>{e.addMetadata(r.from,r.data)}),t.events.onRoutingPacket.subscribe(r=>{switch(r.data.variant.case){case"errorReason":{if(r.data.variant.value===pe.Mesh.Routing_Error.NONE)return;console.log(`Routing Error: ${r.data.variant.value}`);break}case"routeReply":{console.log(`Route Reply: ${r.data.variant.value}`);break}case"routeRequest":{console.log(`Route Request: ${r.data.variant.value}`);break}}}),t.events.onTelemetryPacket.subscribe(r=>{}),t.events.onDeviceStatus.subscribe(r=>{e.setStatus(r)}),t.events.onWaypointPacket.subscribe(r=>{const{data:o,...a}=r;e.addWaypoint(o)}),t.events.onMyNodeInfo.subscribe(r=>{e.setHardware(r),n=r.myNodeNum}),t.events.onUserPacket.subscribe(r=>{e.addUser(r)}),t.events.onPositionPacket.subscribe(r=>{e.addPosition(r)}),t.events.onNodeInfoPacket.subscribe(r=>{e.addNodeInfo(r)}),t.events.onChannelPacket.subscribe(r=>{e.addChannel(r)}),t.events.onConfigPacket.subscribe(r=>{e.setConfig(r)}),t.events.onModuleConfigPacket.subscribe(r=>{e.setModuleConfig(r)}),t.events.onMessagePacket.subscribe(r=>{e.addMessage({...r,state:r.from!==n?"ack":"waiting"})}),t.events.onTraceRoutePacket.subscribe(r=>{e.addTraceRoute({...r})}),t.events.onPendingSettingsChange.subscribe(r=>{e.setPendingSettingsChanges(r)}),t.events.onMeshPacket.subscribe(r=>{e.processPacket({from:r.from,snr:r.rxSnr,time:r.rxTime})})},mg=()=>Math.floor(Math.random()*1e9),qL=({closeDialog:e})=>{const[t,n]=m.useState([]),{addDevice:r}=ca(),{setSelectedDevice:o}=$n(),a=m.useCallback(async()=>{n(await navigator.bluetooth.getDevices())},[]);m.useEffect(()=>{a()},[a]);const i=async s=>{const l=mg(),c=r(l);o(l);const u=new CP(l);await u.connect({device:s}),c.addConnection(u),pg(c,u),e()};return f.jsxs("div",{className:"flex w-full flex-col gap-2 p-4",children:[f.jsxs("div",{className:"flex h-48 flex-col gap-2 overflow-y-auto",children:[t.map(s=>f.jsx(pt,{onClick:()=>{i(s)},children:s.name},s.id)),t.length===0&&f.jsx(Do,{className:"m-auto select-none",children:"No devices paired yet."})]}),f.jsx(pt,{onClick:async()=>{await navigator.bluetooth.requestDevice({filters:[{services:[iN.ServiceUuid]}]}).then(s=>{t.findIndex(c=>c.id===s.id)===-1&&n(t.concat(s))})},children:f.jsx("span",{children:"New device"})})]})},XL=({closeDialog:e})=>{const{addDevice:t}=ca(),{setSelectedDevice:n}=$n(),{register:r,handleSubmit:o,control:a}=Eh({defaultValues:{ip:["client.meshtastic.org","localhost"].includes(window.location.hostname)?"meshtastic.local":window.location.hostname,tls:location.protocol==="https:"}}),i=$x({control:a,name:"tls",defaultValue:location.protocol==="https:"}),[s,l]=m.useState(!1),c=o(async u=>{l(!0);const d=mg(),p=t(d),g=new SP(d);await g.connect({address:u.ip,fetchInterval:2e3,tls:u.tls}),n(d),p.addConnection(g),pg(p,g),e()});return f.jsxs("form",{className:"flex w-full flex-col gap-2 p-4",onSubmit:c,children:[f.jsxs("div",{className:"flex h-48 flex-col gap-2",children:[f.jsx(xn,{children:"IP Address/Hostname"}),f.jsx(jn,{prefix:i?"https://":"http://",placeholder:"000.000.000.000 / meshtastic.local",disabled:s,...r("ip")}),f.jsx(ml,{name:"tls",control:a,render:({field:{value:u,...d}})=>f.jsxs(f.Fragment,{children:[f.jsx(xn,{children:"Use TLS"}),f.jsx(md,{disabled:location.protocol==="https:"||s,checked:u,...d})]})})]}),f.jsx(pt,{type:"submit",disabled:s,children:f.jsx("span",{children:s?"Connecting...":"Connect"})})]})},YL=({closeDialog:e})=>{const[t,n]=m.useState([]),{addDevice:r}=ca(),{setSelectedDevice:o}=$n(),a=m.useCallback(async()=>{n(await navigator.serial.getPorts())},[]);navigator.serial.addEventListener("connect",()=>{a()}),navigator.serial.addEventListener("disconnect",()=>{a()}),m.useEffect(()=>{a()},[a]);const i=async s=>{const l=mg(),c=r(l);o(l);const u=new TP(l);await u.connect({port:s,baudRate:void 0,concurrentLogOutput:!0}).catch(d=>console.log(`Unable to Connect: ${d.message}`)),c.addConnection(u),pg(c,u),e()};return f.jsxs("div",{className:"flex w-full flex-col gap-2 p-4",children:[f.jsxs("div",{className:"flex h-48 flex-col gap-2 overflow-y-auto",children:[t.map((s,l)=>{const{usbProductId:c,usbVendorId:u}=s.getInfo();return f.jsx(pt,{disabled:s.readable!==null,onClick:async()=>{await i(s)},children:`# ${l} - ${u??"UNK"} - ${c??"UNK"}`},`${u??"UNK"}-${c??"UNK"}-${l}`)}),t.length===0&&f.jsx(Do,{className:"m-auto select-none",children:"No devices paired yet."})]}),f.jsx(pt,{onClick:async()=>{await navigator.serial.requestPort().then(s=>{n(t.concat(s))})},children:f.jsx("span",{children:"New device"})})]})},A1=({href:e,children:t})=>f.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-slate-900 underline underline-offset-4 dark:text-slate-50",children:t}),R1=[{label:"HTTP",element:XL,disabled:!1,disabledMessage:"Unsuported connection method"},{label:"Bluetooth",element:qL,disabled:!navigator.bluetooth,disabledMessage:"Web Bluetooth is currently only supported by Chromium-based browsers",disabledLink:"https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API#browser_compatibility"},{label:"Serial",element:YL,disabled:!navigator.serial,disabledMessage:"WebSerial is currently only supported by Chromium based browsers: https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API#browser_compatibility"}],QL=({open:e,onOpenChange:t})=>f.jsx(Ar,{open:e,onOpenChange:t,children:f.jsxs(tr,{children:[f.jsx(Rr,{children:f.jsx(Ir,{children:"Connect New Device"})}),f.jsxs(od,{defaultValue:"HTTP",children:[f.jsx(cl,{children:R1.map(n=>f.jsx(ul,{value:n.label,disabled:n.disabled,children:n.label},n.label))}),R1.map(n=>f.jsx(dl,{value:n.label,children:n.disabled?f.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:n.disabledMessage}):f.jsx(n.element,{closeDialog:()=>t(!1)})},n.label))]}),(!navigator.bluetooth||!navigator.serial)&&f.jsxs(f.Fragment,{children:[f.jsx(wn,{children:"Web Bluetooth and Web Serial are currently only supported by Chromium-based browsers."}),f.jsxs(wn,{children:["Read more: ",f.jsx(A1,{href:"https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API#browser_compatibility",children:"Web Bluetooth"})," ",f.jsx(A1,{href:"https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API#browser_compatibility",children:"Web Serial"})]})]})]})});var hg="ToastProvider",[gg,ZL,JL]=hh("Toast"),[aT,I7]=Pr("Toast",[JL]),[e7,Td]=aT(hg),iT=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:a=50,children:i}=e,[s,l]=m.useState(null),[c,u]=m.useState(0),d=m.useRef(!1),p=m.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${hg}\`. Expected non-empty \`string\`.`),f.jsx(gg.Provider,{scope:t,children:f.jsx(e7,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:a,toastCount:c,viewport:s,onViewportChange:l,onToastAdd:m.useCallback(()=>u(g=>g+1),[]),onToastRemove:m.useCallback(()=>u(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:p,children:i})})};iT.displayName=hg;var sT="ToastViewport",t7=["F8"],Tp="toast.viewportPause",Ep="toast.viewportResume",lT=m.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=t7,label:o="Notifications ({hotkey})",...a}=e,i=Td(sT,n),s=ZL(n),l=m.useRef(null),c=m.useRef(null),u=m.useRef(null),d=m.useRef(null),p=$e(t,d,i.onViewportChange),g=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=i.toastCount>0;m.useEffect(()=>{const _=b=>{r.every(x=>b[x]||b.code===x)&&d.current?.focus()};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[r]),m.useEffect(()=>{const _=l.current,b=d.current;if(v&&_&&b){const y=()=>{if(!i.isClosePausedRef.current){const T=new CustomEvent(Tp);b.dispatchEvent(T),i.isClosePausedRef.current=!0}},x=()=>{if(i.isClosePausedRef.current){const T=new CustomEvent(Ep);b.dispatchEvent(T),i.isClosePausedRef.current=!1}},E=T=>{!_.contains(T.relatedTarget)&&x()},w=()=>{_.contains(document.activeElement)||x()};return _.addEventListener("focusin",y),_.addEventListener("focusout",E),_.addEventListener("pointermove",y),_.addEventListener("pointerleave",w),window.addEventListener("blur",y),window.addEventListener("focus",x),()=>{_.removeEventListener("focusin",y),_.removeEventListener("focusout",E),_.removeEventListener("pointermove",y),_.removeEventListener("pointerleave",w),window.removeEventListener("blur",y),window.removeEventListener("focus",x)}}},[v,i.isClosePausedRef]);const h=m.useCallback(({tabbingDirection:_})=>{const y=s().map(x=>{const E=x.ref.current,w=[E,...m7(E)];return _==="forwards"?w:w.reverse()});return(_==="forwards"?y.reverse():y).flat()},[s]);return m.useEffect(()=>{const _=d.current;if(_){const b=y=>{const x=y.altKey||y.ctrlKey||y.metaKey;if(y.key==="Tab"&&!x){const w=document.activeElement,T=y.shiftKey;if(y.target===_&&T){c.current?.focus();return}const P=h({tabbingDirection:T?"backwards":"forwards"}),O=P.findIndex(R=>R===w);$f(P.slice(O+1))?y.preventDefault():T?c.current?.focus():u.current?.focus()}};return _.addEventListener("keydown",b),()=>_.removeEventListener("keydown",b)}},[s,h]),f.jsxs(dM,{ref:l,role:"region","aria-label":o.replace("{hotkey}",g),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&f.jsx(Np,{ref:c,onFocusFromOutsideViewport:()=>{const _=h({tabbingDirection:"forwards"});$f(_)}}),f.jsx(gg.Slot,{scope:n,children:f.jsx(xe.ol,{tabIndex:-1,...a,ref:p})}),v&&f.jsx(Np,{ref:u,onFocusFromOutsideViewport:()=>{const _=h({tabbingDirection:"backwards"});$f(_)}})]})});lT.displayName=sT;var cT="ToastFocusProxy",Np=m.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,a=Td(cT,n);return f.jsx(cd,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{const s=i.relatedTarget;!a.viewport?.contains(s)&&r()}})});Np.displayName=cT;var Ed="Toast",n7="toast.swipeStart",r7="toast.swipeMove",o7="toast.swipeCancel",a7="toast.swipeEnd",uT=m.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:a,...i}=e,[s=!0,l]=go({prop:r,defaultProp:o,onChange:a});return f.jsx(ua,{present:n||s,children:f.jsx(l7,{open:s,...i,ref:t,onClose:()=>l(!1),onPause:Wt(e.onPause),onResume:Wt(e.onResume),onSwipeStart:we(e.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:we(e.onSwipeMove,c=>{const{x:u,y:d}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${d}px`)}),onSwipeCancel:we(e.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:we(e.onSwipeEnd,c=>{const{x:u,y:d}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${d}px`),l(!1)})})})});uT.displayName=Ed;var[i7,s7]=aT(Ed,{onClose(){}}),l7=m.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:a,onClose:i,onEscapeKeyDown:s,onPause:l,onResume:c,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:p,onSwipeEnd:g,...v}=e,h=Td(Ed,n),[_,b]=m.useState(null),y=$e(t,D=>b(D)),x=m.useRef(null),E=m.useRef(null),w=o||h.duration,T=m.useRef(0),k=m.useRef(w),C=m.useRef(0),{onToastAdd:P,onToastRemove:O}=h,R=Wt(()=>{_?.contains(document.activeElement)&&h.viewport?.focus(),i()}),N=m.useCallback(D=>{!D||D===1/0||(window.clearTimeout(C.current),T.current=new Date().getTime(),C.current=window.setTimeout(R,D))},[R]);m.useEffect(()=>{const D=h.viewport;if(D){const L=()=>{N(k.current),c?.()},G=()=>{const Y=new Date().getTime()-T.current;k.current=k.current-Y,window.clearTimeout(C.current),l?.()};return D.addEventListener(Tp,G),D.addEventListener(Ep,L),()=>{D.removeEventListener(Tp,G),D.removeEventListener(Ep,L)}}},[h.viewport,w,l,c,N]),m.useEffect(()=>{a&&!h.isClosePausedRef.current&&N(w)},[a,w,h.isClosePausedRef,N]),m.useEffect(()=>(P(),()=>O()),[P,O]);const B=m.useMemo(()=>_?vT(_):null,[_]);return h.viewport?f.jsxs(f.Fragment,{children:[B&&f.jsx(c7,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:B}),f.jsx(i7,{scope:n,onClose:R,children:an.createPortal(f.jsx(gg.ItemSlot,{scope:n,children:f.jsx(uM,{asChild:!0,onEscapeKeyDown:we(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||R(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:f.jsx(xe.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":h.swipeDirection,...v,ref:y,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:we(e.onKeyDown,D=>{D.key==="Escape"&&(s?.(D.nativeEvent),D.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,R()))}),onPointerDown:we(e.onPointerDown,D=>{D.button===0&&(x.current={x:D.clientX,y:D.clientY})}),onPointerMove:we(e.onPointerMove,D=>{if(!x.current)return;const L=D.clientX-x.current.x,G=D.clientY-x.current.y,Y=!!E.current,K=["left","right"].includes(h.swipeDirection),Z=["left","up"].includes(h.swipeDirection)?Math.min:Math.max,re=K?Z(0,L):0,fe=K?0:Z(0,G),U=D.pointerType==="touch"?10:2,ae={x:re,y:fe},se={originalEvent:D,delta:ae};Y?(E.current=ae,sc(r7,d,se,{discrete:!1})):I1(ae,h.swipeDirection,U)?(E.current=ae,sc(n7,u,se,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(L)>U||Math.abs(G)>U)&&(x.current=null)}),onPointerUp:we(e.onPointerUp,D=>{const L=E.current,G=D.target;if(G.hasPointerCapture(D.pointerId)&&G.releasePointerCapture(D.pointerId),E.current=null,x.current=null,L){const Y=D.currentTarget,K={originalEvent:D,delta:L};I1(L,h.swipeDirection,h.swipeThreshold)?sc(a7,g,K,{discrete:!0}):sc(o7,p,K,{discrete:!0}),Y.addEventListener("click",Z=>Z.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),c7=e=>{const{__scopeToast:t,children:n,...r}=e,o=Td(Ed,t),[a,i]=m.useState(!1),[s,l]=m.useState(!1);return f7(()=>i(!0)),m.useEffect(()=>{const c=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(c)},[]),s?null:f.jsx(ld,{asChild:!0,children:f.jsx(cd,{...r,children:a&&f.jsxs(f.Fragment,{children:[o.label," ",n]})})})},u7="ToastTitle",dT=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return f.jsx(xe.div,{...r,ref:t})});dT.displayName=u7;var d7="ToastDescription",fT=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return f.jsx(xe.div,{...r,ref:t})});fT.displayName=d7;var pT="ToastAction",mT=m.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?f.jsx(gT,{altText:n,asChild:!0,children:f.jsx(vg,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${pT}\`. Expected non-empty \`string\`.`),null)});mT.displayName=pT;var hT="ToastClose",vg=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=s7(hT,n);return f.jsx(gT,{asChild:!0,children:f.jsx(xe.button,{type:"button",...r,ref:t,onClick:we(e.onClick,o.onClose)})})});vg.displayName=hT;var gT=m.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return f.jsx(xe.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function vT(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),p7(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",a=r.dataset.radixToastAnnounceExclude==="";if(!o)if(a){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...vT(r))}}),t}function sc(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ax(o,a):o.dispatchEvent(a)}var I1=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),a=r>o;return t==="left"||t==="right"?a&&r>n:!a&&o>n};function f7(e=()=>{}){const t=Wt(e);Mt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function p7(e){return e.nodeType===e.ELEMENT_NODE}function m7(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $f(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var h7=iT,yT=lT,bT=uT,wT=dT,_T=fT,xT=mT,kT=vg;const g7=h7,CT=m.forwardRef(({className:e,...t},n)=>f.jsx(yT,{ref:n,className:Ee("fixed top-0 z-50 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));CT.displayName=yT.displayName;const v7=wh("data-[swipe=move]:transition-none grow-1 group relative pointer-events-auto flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full mt-4 data-[state=closed]:slide-out-to-right-full dark:border-slate-700 last:mt-0 sm:last:mt-4",{variants:{variant:{default:"bg-white border-slate-200 dark:bg-slate-800 dark:border-slate-700",destructive:"group destructive bg-red-600 text-white border-red-600 dark:border-red-600"}},defaultVariants:{variant:"default"}}),ST=m.forwardRef(({className:e,variant:t,...n},r)=>f.jsx(bT,{ref:r,className:Ee(v7({variant:t}),e),...n}));ST.displayName=bT.displayName;const y7=m.forwardRef(({className:e,...t},n)=>f.jsx(xT,{ref:n,className:Ee("inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-slate-200 bg-transparent px-3 text-sm font-medium transition-colors hover:bg-slate-100 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-red-100 group-[.destructive]:hover:border-slate-50 group-[.destructive]:hover:bg-red-100 group-[.destructive]:hover:text-red-600 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 dark:border-slate-700 dark:text-slate-100 dark:hover:bg-slate-700 dark:hover:text-slate-100 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=open]:bg-slate-800",e),...t}));y7.displayName=xT.displayName;const TT=m.forwardRef(({className:e,...t},n)=>f.jsx(kT,{ref:n,className:Ee("absolute right-2 top-2 rounded-md p-1 text-slate-500 opacity-0 transition-opacity hover:text-slate-900 focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 dark:hover:text-slate-50",e),"toast-close":"",...t,children:f.jsx(yC,{className:"h-4 w-4"})}));TT.displayName=kT.displayName;const ET=m.forwardRef(({className:e,...t},n)=>f.jsx(wT,{ref:n,className:Ee("text-sm font-semibold",e),...t}));ET.displayName=wT.displayName;const NT=m.forwardRef(({className:e,...t},n)=>f.jsx(_T,{ref:n,className:Ee("text-sm opacity-90",e),...t}));NT.displayName=_T.displayName;function b7(){const{toasts:e}=hd();return f.jsxs(g7,{children:[e.map(({id:t,title:n,description:r,action:o,...a})=>f.jsxs(ST,{...a,children:[f.jsxs("div",{className:"grid gap-1",children:[n&&f.jsx(ET,{className:"dark:text-white",children:n}),r&&f.jsx(NT,{className:"dark:text-white-400",children:r})]}),o,f.jsx(TT,{})]},t)),f.jsx(CT,{})]})}const w7=({children:e})=>{const{darkMode:t,accent:n}=$n();return f.jsx("div",{"data-theme":t?"dark":"light","data-accent":n,children:e})},O1=({children:e})=>f.jsx("h3",{className:"scroll-m-20 text-2xl font-semibold tracking-tight",children:e}),_7=()=>{const{setConnectDialogOpen:e}=$n(),{getDevices:t}=ca(),n=m.useMemo(()=>t(),[t]);return f.jsx(f.Fragment,{children:f.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs("div",{className:"space-y-1",children:[f.jsx(O1,{children:"Connected Devices"}),f.jsx(wn,{children:"Manage, connect and disconnect devices"})]})}),f.jsx(Cu,{}),f.jsx("div",{className:"flex h-[450px] rounded-md border border-dashed border-slate-200 p-3 dark:border-slate-700",children:n.length?f.jsx("ul",{className:"grow divide-y divide-gray-200",children:n.map(r=>f.jsx("li",{children:f.jsxs("div",{className:"px-4 py-4 sm:px-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("p",{className:"truncate text-sm font-medium text-accent",children:r.nodes.get(r.hardware.myNodeNum)?.user?.longName??"UNK"}),f.jsxs("div",{className:"inline-flex w-24 justify-center gap-2 rounded-full bg-slate-100 py-1 text-xs font-semibold text-slate-900 transition-colors hover:bg-slate-700 hover:text-slate-50",children:[r.connection?.connType==="ble"&&f.jsxs(f.Fragment,{children:[f.jsx(zR,{size:16}),"BLE"]}),r.connection?.connType==="serial"&&f.jsxs(f.Fragment,{children:[f.jsx(m6,{size:16}),"Serial"]}),r.connection?.connType==="http"&&f.jsxs(f.Fragment,{children:[f.jsx(i6,{size:16}),"Network"]})]})]}),f.jsx("div",{className:"mt-2 sm:flex sm:justify-between",children:f.jsxs("div",{className:"flex gap-2 text-sm text-gray-500",children:[f.jsx(Gh,{size:20,className:"text-gray-400","aria-hidden":"true"}),r.nodes.size===0?0:r.nodes.size-1]})})]})},r.id))}):f.jsxs("div",{className:"m-auto flex flex-col gap-3 text-center",children:[f.jsx(o6,{size:48,className:"mx-auto text-textSecondary"}),f.jsx(O1,{children:"No Devices"}),f.jsx(wn,{children:"Connect at least one device to get started"}),f.jsxs(pt,{className:"gap-2",onClick:()=>e(!0),children:[f.jsx(Hh,{size:16}),"New Connection"]})]})})]})})},x7=()=>{const{getDevice:e}=ca(),{selectedDevice:t,setConnectDialogOpen:n,connectDialogOpen:r}=$n(),o=e(t);return f.jsxs(w7,{children:[f.jsx(QL,{open:r,onOpenChange:a=>{n(a)}}),f.jsx(b7,{}),f.jsx(ZO,{children:f.jsx(EP,{device:o,children:f.jsx("div",{className:"flex h-screen flex-col overflow-hidden bg-backgroundPrimary text-textPrimary",children:f.jsxs("div",{className:"flex flex-grow",children:[f.jsx(NL,{}),f.jsx("div",{className:"flex flex-grow flex-col",children:o?f.jsxs("div",{className:"flex h-screen",children:[f.jsx(KL,{}),f.jsx(xL,{}),f.jsx(qD,{})]}):f.jsxs(f.Fragment,{children:[f.jsx(_7,{}),f.jsx("div",{className:"flex flex-grow"}),f.jsx(Qh,{})]})})]})})})})]})},k7=document.getElementById("root"),C7=e2(k7);$E();C7.render(f.jsx(m.StrictMode,{children:f.jsx(x7,{})}));export{_t as c,Pp as g}; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-wV0rbIjU.css b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-wV0rbIjU.css deleted file mode 100644 index fe87e3c..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index-wV0rbIjU.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter var,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:Cascadia Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-y-0{top:0;bottom:0}.-left-2{left:-.5rem}.left-2{left:.5rem}.right-0{right:0}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-2{top:.5rem}.top-4{top:1rem}.z-50{z-index:50}.m-auto{margin:auto}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-auto{margin-top:auto;margin-bottom:auto}.mb-2{margin-bottom:.5rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-5{margin-left:1.25rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[24px\]{height:24px}.h-\[450px\]{height:450px}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\[300px\]{max-height:300px}.max-h-screen{max-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-72{width:18rem}.w-\[1px\]{width:1px}.w-\[44px\]{width:44px}.w-full{width:100%}.min-w-\[100px\]{min-width:100px}.min-w-\[12rem\]{min-width:12rem}.min-w-\[280px\]{min-width:280px}.min-w-\[8rem\]{min-width:8rem}.min-w-full{min-width:100%}.\!max-w-max{max-width:-moz-max-content!important;max-width:max-content!important}.max-w-lg{max-width:32rem}.max-w-min{max-width:-moz-min-content;max-width:min-content}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.scroll-m-20{scroll-margin:5rem}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-hidden{overflow-y:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-\[0\.185rem\]{border-radius:.185rem}.rounded-\[0\.2rem\]{border-radius:.2rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-l-md{border-top-left-radius:.375rem;border-bottom-left-radius:.375rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-\[0\.5px\]{border-bottom-width:.5px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-r-\[0\.5px\]{border-right-width:.5px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-black{--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.border-red-600{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity))}.border-slate-100{--tw-border-opacity: 1;border-color:rgb(241 245 249 / var(--tw-border-opacity))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}.border-slate-400{--tw-border-opacity: 1;border-color:rgb(148 163 184 / var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-b-slate-100{--tw-border-opacity: 1;border-bottom-color:rgb(241 245 249 / var(--tw-border-opacity))}.border-b-slate-200{--tw-border-opacity: 1;border-bottom-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-l-backgroundPrimary{border-left-color:var(--backgroundPrimary)}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[\#2093fe\]{--tw-bg-opacity: 1;background-color:rgb(32 147 254 / var(--tw-bg-opacity))}.bg-\[\#27a341\]{--tw-bg-opacity: 1;background-color:rgb(39 163 65 / var(--tw-bg-opacity))}.bg-\[\#70afea\]{--tw-bg-opacity: 1;background-color:rgb(112 175 234 / var(--tw-bg-opacity))}.bg-\[\#8bc9c5\]{--tw-bg-opacity: 1;background-color:rgb(139 201 197 / var(--tw-bg-opacity))}.bg-\[\#926bff\]{--tw-bg-opacity: 1;background-color:rgb(146 107 255 / var(--tw-bg-opacity))}.bg-\[\#a09eef\]{--tw-bg-opacity: 1;background-color:rgb(160 158 239 / var(--tw-bg-opacity))}.bg-\[\#ac8c1a\]{--tw-bg-opacity: 1;background-color:rgb(172 140 26 / var(--tw-bg-opacity))}.bg-\[\#dba0c7\]{--tw-bg-opacity: 1;background-color:rgb(219 160 199 / var(--tw-bg-opacity))}.bg-\[\#e0cc87\]{--tw-bg-opacity: 1;background-color:rgb(224 204 135 / var(--tw-bg-opacity))}.bg-\[\#e1720b\]{--tw-bg-opacity: 1;background-color:rgb(225 114 11 / var(--tw-bg-opacity))}.bg-\[\#e454c4\]{--tw-bg-opacity: 1;background-color:rgb(228 84 196 / var(--tw-bg-opacity))}.bg-\[\#edb17a\]{--tw-bg-opacity: 1;background-color:rgb(237 177 122 / var(--tw-bg-opacity))}.bg-\[\#f25555\]{--tw-bg-opacity: 1;background-color:rgb(242 85 85 / var(--tw-bg-opacity))}.bg-\[\#f28585\]{--tw-bg-opacity: 1;background-color:rgb(242 133 133 / var(--tw-bg-opacity))}.bg-accent{background-color:var(--accent)}.bg-backgroundPrimary{background-color:var(--backgroundPrimary)}.bg-black\/50{background-color:#00000080}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity))}.bg-green-800{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.fill-current{fill:currentColor}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[0\.3rem\]{padding-left:.3rem;padding-right:.3rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-\[0\.2rem\]{padding-top:.2rem;padding-bottom:.2rem}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-8{padding-right:2rem}.pr-9{padding-right:2.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:Cascadia Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-7{line-height:1.75rem}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-accent{color:var(--accent)}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.text-textPrimary{color:var(--textPrimary)}.text-textSecondary{color:var(--textSecondary)}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.brightness-hover{--tw-brightness: brightness(var(--brighnessHover));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-brightness-press{--tw-backdrop-brightness: brightness(var(--brightnessPress));-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in{--tw-enter-opacity: 0}.fade-in-50{--tw-enter-opacity: .5}.fade-in-80{--tw-enter-opacity: .8}.fade-in-90{--tw-enter-opacity: .9}.slide-in-from-bottom-10{--tw-enter-translate-y: 2.5rem}.slide-in-from-left-1{--tw-enter-translate-x: -.25rem}.slide-in-from-top-1{--tw-enter-translate-y: -.25rem}.duration-300{animation-duration:.3s}:root{--backgroundPrimary: #ffffff;--backgroundSecondary: #e6e9ed;--textPrimary: #111132;--textSecondary: #64748b;--link: #0b69bf;--brighnessHover: .95;--brightnessPress: 1.05;--brightnessDisabled: .75}[data-theme=dark]{--backgroundPrimary: #0f172a;--backgroundSecondary: #363638;--textPrimary: #ebebeb;--textSecondary: #bdbdbd;--link: #8ec9ff;--brighnessHover: 1.1;--brightnessPress: .9;--brightnessDisabled: .75}[data-accent=red]{--accent: #f28585;--accentMuted: #f4abab}[data-accent=red][data-theme=dark]{--accent: #f25555;--accentMuted: #b04749}[data-accent=orange]{--accent: #edb17a;--accentMuted: #efc7a4}[data-accent=orange][data-theme=dark]{--accent: #e1720b;--accentMuted: #a55c17}[data-accent=yellow]{--accent: #e0cc87;--accentMuted: #e8daad}[data-accent=yellow][data-theme=dark]{--accent: #ac8c1a;--accentMuted: #826c22}[data-accent=green]{--accent: #8bc9c5;--accentMuted: #afd7d5}[data-accent=green][data-theme=dark]{--accent: #27a341;--accentMuted: #297b3b}[data-accent=blue]{--accent: #70afea;--accentMuted: #9cc7ee}[data-accent=blue][data-theme=dark]{--accent: #2093fe;--accentMuted: #2471ba}[data-accent=purple]{--accent: #a09eef;--accentMuted: #bcbcf1}[data-accent=purple][data-theme=dark]{--accent: #926bff;--accentMuted: #7057bb}[data-accent=pink]{--accent: #dba0c7;--accentMuted: #e3bcd7}[data-accent=pink][data-theme=dark]{--accent: #e454c4;--accentMuted: #a84892}img{-drag:none;-webkit-user-drag:none}.placeholder\:text-slate-400::-moz-placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.placeholder\:text-slate-400::placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.first\:mt-0:first-child{margin-top:0}.first\:pl-2:first-child{padding-left:.5rem}.last\:mt-0:last-child{margin-top:0}.hover\:bg-green-600:hover{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\:bg-slate-100:hover{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.hover\:bg-slate-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.hover\:bg-transparent:hover{background-color:transparent}.hover\:text-accent:hover{color:var(--accent)}.hover\:text-gray-400:hover{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.hover\:text-slate-50:hover{--tw-text-opacity: 1;color:rgb(248 250 252 / var(--tw-text-opacity))}.hover\:text-slate-900:hover{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:brightness-hover:hover{--tw-brightness: brightness(var(--brighnessHover));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:bg-slate-100:focus{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-green-800:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(22 101 52 / var(--tw-ring-opacity))}.focus\:ring-slate-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(148 163 184 / var(--tw-ring-opacity))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.active\:brightness-press:active{--tw-brightness: brightness(var(--brightnessPress));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-red-100{--tw-border-opacity: 1;border-color:rgb(254 226 226 / var(--tw-border-opacity))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:border-slate-50:hover{--tw-border-opacity: 1;border-color:rgb(248 250 252 / var(--tw-border-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-selected\:bg-slate-100[aria-selected=true]{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.data-\[disabled\=\'true\'\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=active\]\:bg-white[data-state=active]{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.data-\[state\=checked\]\:bg-slate-900[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.data-\[state\=open\]\:bg-slate-100[data-state=open]{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.data-\[state\=open\]\:bg-transparent[data-state=open]{background-color:transparent}.data-\[state\=unchecked\]\:bg-slate-200[data-state=unchecked]{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.data-\[state\=active\]\:text-slate-900[data-state=active]{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.data-\[disabled\=\'true\'\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\[side\=bottom\]\:slide-in-from-top-1[data-side=bottom]{--tw-enter-translate-y: -.25rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-1[data-side=left]{--tw-enter-translate-x: .25rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-1[data-side=right]{--tw-enter-translate-x: -.25rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-1[data-side=top]{--tw-enter-translate-y: .25rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}.dark\:border-red-500:is([data-theme=dark] *){--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.dark\:border-red-600:is([data-theme=dark] *){--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity))}.dark\:border-slate-600:is([data-theme=dark] *){--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity))}.dark\:border-slate-700:is([data-theme=dark] *){--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity))}.dark\:border-slate-800:is([data-theme=dark] *){--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity))}.dark\:border-b-slate-700:is([data-theme=dark] *){--tw-border-opacity: 1;border-bottom-color:rgb(51 65 85 / var(--tw-border-opacity))}.dark\:bg-slate-50:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}.dark\:bg-slate-700:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:bg-slate-800:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.dark\:bg-slate-900:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.dark\:text-slate-100:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}.dark\:text-slate-200:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity))}.dark\:text-slate-300:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.dark\:text-slate-400:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.dark\:text-slate-50:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(248 250 252 / var(--tw-text-opacity))}.dark\:text-slate-900:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.dark\:text-white:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:hover\:bg-green-600:hover:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.dark\:hover\:bg-red-600:hover:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.dark\:hover\:bg-slate-700:hover:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:hover\:bg-slate-800:hover:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.dark\:hover\:bg-transparent:hover:is([data-theme=dark] *){background-color:transparent}.dark\:hover\:text-slate-100:hover:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}.dark\:hover\:text-slate-50:hover:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(248 250 252 / var(--tw-text-opacity))}.dark\:focus\:bg-slate-700:focus:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:focus\:ring-slate-400:focus:is([data-theme=dark] *){--tw-ring-opacity: 1;--tw-ring-color: rgb(148 163 184 / var(--tw-ring-opacity))}.dark\:focus\:ring-offset-slate-900:focus:is([data-theme=dark] *){--tw-ring-offset-color: #0f172a}.dark\:aria-selected\:bg-slate-700[aria-selected=true]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:data-\[state\=active\]\:bg-slate-900[data-state=active]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.dark\:data-\[state\=checked\]\:bg-slate-400[data-state=checked]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity))}.dark\:data-\[state\=open\]\:bg-slate-700[data-state=open]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:data-\[state\=open\]\:bg-slate-800[data-state=open]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.dark\:data-\[state\=open\]\:bg-transparent[data-state=open]:is([data-theme=dark] *){background-color:transparent}.dark\:data-\[state\=unchecked\]\:bg-slate-700[data-state=unchecked]:is([data-theme=dark] *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:data-\[state\=active\]\:text-slate-100[data-state=active]:is([data-theme=dark] *){--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:max-w-lg{max-width:32rem}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:items-center{align-items:center}.sm\:items-baseline{align-items:baseline}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:.5rem}.sm\:p-6{padding:1.5rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:pt-5{padding-top:1.25rem}.sm\:text-left{text-align:left}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:zoom-in-90{--tw-enter-scale: .9}.sm\:slide-in-from-bottom-0{--tw-enter-translate-y: 0px}.sm\:last\:mt-4:last-child{margin-top:1rem}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:max-w-\[420px\]{max-width:420px}.md\:px-0{padding-left:0;padding-right:0}.md\:px-4{padding-left:1rem;padding-right:1rem}}@media (min-width: 1024px){.lg\:text-5xl{font-size:3rem;line-height:1}}.\[\&\:not\(\:first-child\)\]\:mt-6:not(:first-child){margin-top:1.5rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:pb-1\.5 [cmdk-group-heading]{padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-sm [cmdk-group-heading]{font-size:.875rem;line-height:1.25rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:font-semibold [cmdk-group-heading]{font-weight:600}.\[\&_\[cmdk-group-heading\]\]\:text-slate-500 [cmdk-group-heading]{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.\[\&_\[cmdk-group-heading\]\]\:text-slate-900 [cmdk-group-heading]{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.\[\&_\[cmdk-group-heading\]\]\:dark\:text-slate-300:is([data-theme=dark] *) [cmdk-group-heading]{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group\]_\+\[cmdk-group\]\]\:pt-0 [cmdk-group]+[cmdk-group]{padding-top:0}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_\[dialog-overlay\]\]\:bg-red-100 [dialog-overlay]{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity))}.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-moz-user-select:none;-webkit-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23999' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index.html b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index.html deleted file mode 100644 index eb93d2f..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - Meshtastic Web - - - - -
- - - diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/mapbox-gl-DY02hNYD.js b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/mapbox-gl-DY02hNYD.js deleted file mode 100644 index 62f9248..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/mapbox-gl-DY02hNYD.js +++ /dev/null @@ -1,2258 +0,0 @@ -import{g as Eb,c as Sb}from"./index-b9vwykds.js";function Mb(Ic,yp){for(var Qa=0;Qahn[dn]})}}}return Object.freeze(Object.defineProperty(Ic,Symbol.toStringTag,{value:"Module"}))}var Y0={exports:{}};(function(Ic,yp){var Qa={};(function(hn,dn){Ic.exports=dn()})(Sb,function(){var hn,dn,ks;function xp(s,pr){if(!hn)hn=pr;else if(!dn)dn=pr;else{var Mr="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+hn+")(sharedChunk); ("+dn+")(sharedChunk); self.onerror = null;",bt={};hn(bt),ks=pr(bt),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(ks.workerUrl=window.URL.createObjectURL(new Blob([Mr],{type:"text/javascript"})))}}xp(["exports"],function(s){var pr="3.6.0";let Mr;const bt={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(Mr==null){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{Mr=Qa.API_URL_REGEX!=null?new RegExp(Qa.API_URL_REGEX):t}catch{Mr=t}}return Mr},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!bt.API_URL)return null;try{const t=new URL(bt.API_URL);return t.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":t.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Zt(t){return bt.API_URL_REGEX.test(t)}function Di(t){return t.indexOf("mapbox:")===0}function Nr(t){return bt.API_CDN_URL_REGEX.test(t)}function zn(t){return bt.API_SPRITE_REGEX.test(t)}function to(t){return bt.API_STYLE_REGEX.test(t)&&!zn(t)}const Dn={create:"create",load:"load",fullLoad:"fullLoad"},el={mark(t){performance.mark(t)},measure(t,e,i){performance.measure(t,e,i)}};function Os(t){const e=t.name.split("?")[0];return Nr(e)&&e.includes("mapbox-gl.js")?"javascript":Nr(e)&&e.includes("mapbox-gl.css")?"css":function(i){return bt.API_FONTS_REGEX.test(i)}(e)?"fontRange":zn(e)?"sprite":to(e)?"style":function(i){return bt.API_TILEJSON_REGEX.test(i)}(e)?"tilejson":"other"}function Jr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var di={},fi={};Object.defineProperty(fi,"__esModule",{value:!0}),fi.setMatrixArrayType=function(t){fi.ARRAY_TYPE=Do=t},fi.toRadian=function(t){return t*tl},fi.equals=function(t,e){return Math.abs(t-e)<=Rn*Math.max(1,Math.abs(t),Math.abs(e))},fi.RANDOM=fi.ARRAY_TYPE=fi.EPSILON=void 0;var Rn=1e-6;fi.EPSILON=Rn;var Do=typeof Float32Array<"u"?Float32Array:Array;fi.ARRAY_TYPE=Do;var Ac=Math.random;fi.RANDOM=Ac;var tl=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var ni={};function Yt(t){return Yt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yt(t)}Object.defineProperty(ni,"__esModule",{value:!0}),ni.create=function(){var t=new Vr.ARRAY_TYPE(4);return Vr.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},ni.clone=function(t){var e=new Vr.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},ni.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},ni.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},ni.fromValues=function(t,e,i,n){var o=new Vr.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o},ni.set=function(t,e,i,n,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t},ni.transpose=function(t,e){if(t===e){var i=e[1];t[1]=e[2],t[2]=i}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},ni.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i*l-o*n;return c?(t[0]=l*(c=1/c),t[1]=-n*c,t[2]=-o*c,t[3]=i*c,t):null},ni.adjoint=function(t,e){var i=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=i,t},ni.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},ni.multiply=il,ni.rotate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),f=Math.cos(i);return t[0]=n*f+l*d,t[1]=o*f+c*d,t[2]=n*-d+l*f,t[3]=o*-d+c*f,t},ni.scale=function(t,e,i){var n=e[1],o=e[2],l=e[3],c=i[0],d=i[1];return t[0]=e[0]*c,t[1]=n*c,t[2]=o*d,t[3]=l*d,t},ni.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t},ni.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},ni.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},ni.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},ni.LDU=function(t,e,i,n){return t[2]=n[2]/n[0],i[0]=n[0],i[1]=n[1],i[3]=n[3]-t[2]*i[1],[t,e,i]},ni.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t},ni.subtract=rl,ni.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},ni.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=e[0],d=e[1],f=e[2],_=e[3];return Math.abs(i-c)<=Vr.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(n-d)<=Vr.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(o-f)<=Vr.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(l-_)<=Vr.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))},ni.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},ni.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t},ni.sub=ni.mul=void 0;var Vr=function(t,e){if(t&&t.__esModule)return t;if(t===null||Yt(t)!=="object"&&typeof t!="function")return{default:t};var i=Ro(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function Ro(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Ro=function(n){return n?i:e})(t)}function il(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[0],f=i[1],_=i[2],y=i[3];return t[0]=n*d+l*f,t[1]=o*d+c*f,t[2]=n*_+l*y,t[3]=o*_+c*y,t}function rl(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}ni.mul=il,ni.sub=rl;var Qt={};function Bs(t){return Bs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bs(t)}Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.create=function(){var t=new Ir.ARRAY_TYPE(6);return Ir.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},Qt.clone=function(t){var e=new Ir.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},Qt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},Qt.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},Qt.fromValues=function(t,e,i,n,o,l){var c=new Ir.ARRAY_TYPE(6);return c[0]=t,c[1]=e,c[2]=i,c[3]=n,c[4]=o,c[5]=l,c},Qt.set=function(t,e,i,n,o,l,c){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t},Qt.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=i*l-n*o;return f?(t[0]=l*(f=1/f),t[1]=-n*f,t[2]=-o*f,t[3]=i*f,t[4]=(o*d-l*c)*f,t[5]=(n*c-i*d)*f,t):null},Qt.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},Qt.multiply=Fs,Qt.rotate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=Math.sin(i),y=Math.cos(i);return t[0]=n*y+l*_,t[1]=o*y+c*_,t[2]=n*-_+l*y,t[3]=o*-_+c*y,t[4]=d,t[5]=f,t},Qt.scale=function(t,e,i){var n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=i[0],_=i[1];return t[0]=e[0]*f,t[1]=n*f,t[2]=o*_,t[3]=l*_,t[4]=c,t[5]=d,t},Qt.translate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=i[0],y=i[1];return t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=n*_+l*y+d,t[5]=o*_+c*y+f,t},Qt.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t[4]=0,t[5]=0,t},Qt.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},Qt.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},Qt.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},Qt.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)},Qt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t},Qt.subtract=io,Qt.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t},Qt.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t},Qt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},Qt.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],f=e[0],_=e[1],y=e[2],v=e[3],b=e[4],E=e[5];return Math.abs(i-f)<=Ir.EPSILON*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(n-_)<=Ir.EPSILON*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(o-y)<=Ir.EPSILON*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(l-v)<=Ir.EPSILON*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-b)<=Ir.EPSILON*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(d-E)<=Ir.EPSILON*Math.max(1,Math.abs(d),Math.abs(E))},Qt.sub=Qt.mul=void 0;var Ir=function(t,e){if(t&&t.__esModule)return t;if(t===null||Bs(t)!=="object"&&typeof t!="function")return{default:t};var i=nl(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function nl(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(nl=function(n){return n?i:e})(t)}function Fs(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=i[0],y=i[1],v=i[2],b=i[3],E=i[4],M=i[5];return t[0]=n*_+l*y,t[1]=o*_+c*y,t[2]=n*v+l*b,t[3]=o*v+c*b,t[4]=n*E+l*M+d,t[5]=o*E+c*M+f,t}function io(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t}Qt.mul=Fs,Qt.sub=io;var Ht={};function Lo(t){return Lo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lo(t)}Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.create=function(){var t=new Ui.ARRAY_TYPE(9);return Ui.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},Ht.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},Ht.clone=function(t){var e=new Ui.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},Ht.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},Ht.fromValues=function(t,e,i,n,o,l,c,d,f){var _=new Ui.ARRAY_TYPE(9);return _[0]=t,_[1]=e,_[2]=i,_[3]=n,_[4]=o,_[5]=l,_[6]=c,_[7]=d,_[8]=f,_},Ht.set=function(t,e,i,n,o,l,c,d,f,_){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t[6]=d,t[7]=f,t[8]=_,t},Ht.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},Ht.transpose=function(t,e){if(t===e){var i=e[1],n=e[2],o=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=n,t[7]=o}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},Ht.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=e[6],_=e[7],y=e[8],v=y*c-d*_,b=-y*l+d*f,E=_*l-c*f,M=i*v+n*b+o*E;return M?(t[0]=v*(M=1/M),t[1]=(-y*n+o*_)*M,t[2]=(d*n-o*c)*M,t[3]=b*M,t[4]=(y*i-o*f)*M,t[5]=(-d*i+o*l)*M,t[6]=E*M,t[7]=(-_*i+n*f)*M,t[8]=(c*i-n*l)*M,t):null},Ht.adjoint=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=e[6],_=e[7],y=e[8];return t[0]=c*y-d*_,t[1]=o*_-n*y,t[2]=n*d-o*c,t[3]=d*f-l*y,t[4]=i*y-o*f,t[5]=o*l-i*d,t[6]=l*_-c*f,t[7]=n*f-i*_,t[8]=i*c-n*l,t},Ht.determinant=function(t){var e=t[3],i=t[4],n=t[5],o=t[6],l=t[7],c=t[8];return t[0]*(c*i-n*l)+t[1]*(-c*e+n*o)+t[2]*(l*e-i*o)},Ht.multiply=sl,Ht.translate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=i[0],E=i[1];return t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=d,t[5]=f,t[6]=b*n+E*c+_,t[7]=b*o+E*d+y,t[8]=b*l+E*f+v,t},Ht.rotate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=Math.sin(i),E=Math.cos(i);return t[0]=E*n+b*c,t[1]=E*o+b*d,t[2]=E*l+b*f,t[3]=E*c-b*n,t[4]=E*d-b*o,t[5]=E*f-b*l,t[6]=_,t[7]=y,t[8]=v,t},Ht.scale=function(t,e,i){var n=i[0],o=i[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=o*e[3],t[4]=o*e[4],t[5]=o*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},Ht.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},Ht.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},Ht.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},Ht.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},Ht.fromQuat=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i+i,d=n+n,f=o+o,_=i*c,y=n*c,v=n*d,b=o*c,E=o*d,M=o*f,A=l*c,C=l*d,D=l*f;return t[0]=1-v-M,t[3]=y-D,t[6]=b+C,t[1]=y+D,t[4]=1-_-M,t[7]=E-A,t[2]=b-C,t[5]=E+A,t[8]=1-_-v,t},Ht.normalFromMat4=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=e[6],_=e[7],y=e[8],v=e[9],b=e[10],E=e[11],M=e[12],A=e[13],C=e[14],D=e[15],V=i*d-n*c,N=i*f-o*c,U=i*_-l*c,H=n*f-o*d,X=n*_-l*d,Q=o*_-l*f,ae=y*A-v*M,de=y*C-b*M,ye=y*D-E*M,pe=v*C-b*A,we=v*D-E*A,De=b*D-E*C,Te=V*De-N*we+U*pe+H*ye-X*de+Q*ae;return Te?(t[0]=(d*De-f*we+_*pe)*(Te=1/Te),t[1]=(f*ye-c*De-_*de)*Te,t[2]=(c*we-d*ye+_*ae)*Te,t[3]=(o*we-n*De-l*pe)*Te,t[4]=(i*De-o*ye+l*de)*Te,t[5]=(n*ye-i*we-l*ae)*Te,t[6]=(A*Q-C*X+D*H)*Te,t[7]=(C*U-M*Q-D*N)*Te,t[8]=(M*X-A*U+D*V)*Te,t):null},Ht.projection=function(t,e,i){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/i,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},Ht.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},Ht.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},Ht.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t},Ht.subtract=al,Ht.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t},Ht.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t[6]=e[6]+i[6]*n,t[7]=e[7]+i[7]*n,t[8]=e[8]+i[8]*n,t},Ht.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},Ht.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],f=t[6],_=t[7],y=t[8],v=e[0],b=e[1],E=e[2],M=e[3],A=e[4],C=e[5],D=e[6],V=e[7],N=e[8];return Math.abs(i-v)<=Ui.EPSILON*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(n-b)<=Ui.EPSILON*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-E)<=Ui.EPSILON*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(l-M)<=Ui.EPSILON*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(c-A)<=Ui.EPSILON*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-C)<=Ui.EPSILON*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(f-D)<=Ui.EPSILON*Math.max(1,Math.abs(f),Math.abs(D))&&Math.abs(_-V)<=Ui.EPSILON*Math.max(1,Math.abs(_),Math.abs(V))&&Math.abs(y-N)<=Ui.EPSILON*Math.max(1,Math.abs(y),Math.abs(N))},Ht.sub=Ht.mul=void 0;var Ui=function(t,e){if(t&&t.__esModule)return t;if(t===null||Lo(t)!=="object"&&typeof t!="function")return{default:t};var i=ol(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function ol(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(ol=function(n){return n?i:e})(t)}function sl(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=i[0],E=i[1],M=i[2],A=i[3],C=i[4],D=i[5],V=i[6],N=i[7],U=i[8];return t[0]=b*n+E*c+M*_,t[1]=b*o+E*d+M*y,t[2]=b*l+E*f+M*v,t[3]=A*n+C*c+D*_,t[4]=A*o+C*d+D*y,t[5]=A*l+C*f+D*v,t[6]=V*n+N*c+U*_,t[7]=V*o+N*d+U*y,t[8]=V*l+N*f+U*v,t}function al(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t}Ht.mul=sl,Ht.sub=al;var dt={};function ko(t){return ko=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ko(t)}Object.defineProperty(dt,"__esModule",{value:!0}),dt.create=function(){var t=new ai.ARRAY_TYPE(16);return ai.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},dt.clone=function(t){var e=new ai.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},dt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},dt.fromValues=function(t,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A){var C=new ai.ARRAY_TYPE(16);return C[0]=t,C[1]=e,C[2]=i,C[3]=n,C[4]=o,C[5]=l,C[6]=c,C[7]=d,C[8]=f,C[9]=_,C[10]=y,C[11]=v,C[12]=b,C[13]=E,C[14]=M,C[15]=A,C},dt.set=function(t,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t[6]=d,t[7]=f,t[8]=_,t[9]=y,t[10]=v,t[11]=b,t[12]=E,t[13]=M,t[14]=A,t[15]=C,t},dt.identity=cl,dt.transpose=function(t,e){if(t===e){var i=e[1],n=e[2],o=e[3],l=e[6],c=e[7],d=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=l,t[11]=e[14],t[12]=o,t[13]=c,t[14]=d}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},dt.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=e[6],_=e[7],y=e[8],v=e[9],b=e[10],E=e[11],M=e[12],A=e[13],C=e[14],D=e[15],V=i*d-n*c,N=i*f-o*c,U=i*_-l*c,H=n*f-o*d,X=n*_-l*d,Q=o*_-l*f,ae=y*A-v*M,de=y*C-b*M,ye=y*D-E*M,pe=v*C-b*A,we=v*D-E*A,De=b*D-E*C,Te=V*De-N*we+U*pe+H*ye-X*de+Q*ae;return Te?(t[0]=(d*De-f*we+_*pe)*(Te=1/Te),t[1]=(o*we-n*De-l*pe)*Te,t[2]=(A*Q-C*X+D*H)*Te,t[3]=(b*X-v*Q-E*H)*Te,t[4]=(f*ye-c*De-_*de)*Te,t[5]=(i*De-o*ye+l*de)*Te,t[6]=(C*U-M*Q-D*N)*Te,t[7]=(y*Q-b*U+E*N)*Te,t[8]=(c*we-d*ye+_*ae)*Te,t[9]=(n*ye-i*we-l*ae)*Te,t[10]=(M*X-A*U+D*V)*Te,t[11]=(v*U-y*X-E*V)*Te,t[12]=(d*de-c*pe-f*ae)*Te,t[13]=(i*pe-n*de+o*ae)*Te,t[14]=(A*N-M*H-C*V)*Te,t[15]=(y*H-v*N+b*V)*Te,t):null},dt.adjoint=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],f=e[6],_=e[7],y=e[8],v=e[9],b=e[10],E=e[11],M=e[12],A=e[13],C=e[14],D=e[15];return t[0]=d*(b*D-E*C)-v*(f*D-_*C)+A*(f*E-_*b),t[1]=-(n*(b*D-E*C)-v*(o*D-l*C)+A*(o*E-l*b)),t[2]=n*(f*D-_*C)-d*(o*D-l*C)+A*(o*_-l*f),t[3]=-(n*(f*E-_*b)-d*(o*E-l*b)+v*(o*_-l*f)),t[4]=-(c*(b*D-E*C)-y*(f*D-_*C)+M*(f*E-_*b)),t[5]=i*(b*D-E*C)-y*(o*D-l*C)+M*(o*E-l*b),t[6]=-(i*(f*D-_*C)-c*(o*D-l*C)+M*(o*_-l*f)),t[7]=i*(f*E-_*b)-c*(o*E-l*b)+y*(o*_-l*f),t[8]=c*(v*D-E*A)-y*(d*D-_*A)+M*(d*E-_*v),t[9]=-(i*(v*D-E*A)-y*(n*D-l*A)+M*(n*E-l*v)),t[10]=i*(d*D-_*A)-c*(n*D-l*A)+M*(n*_-l*d),t[11]=-(i*(d*E-_*v)-c*(n*E-l*v)+y*(n*_-l*d)),t[12]=-(c*(v*C-b*A)-y*(d*C-f*A)+M*(d*b-f*v)),t[13]=i*(v*C-b*A)-y*(n*C-o*A)+M*(n*b-o*v),t[14]=-(i*(d*C-f*A)-c*(n*C-o*A)+M*(n*f-o*d)),t[15]=i*(d*b-f*v)-c*(n*b-o*v)+y*(n*f-o*d),t},dt.determinant=function(t){var e=t[0],i=t[1],n=t[2],o=t[3],l=t[4],c=t[5],d=t[6],f=t[7],_=t[8],y=t[9],v=t[10],b=t[11],E=t[12],M=t[13],A=t[14],C=t[15];return(e*c-i*l)*(v*C-b*A)-(e*d-n*l)*(y*C-b*M)+(e*f-o*l)*(y*A-v*M)+(i*d-n*c)*(_*C-b*E)-(i*f-o*c)*(_*A-v*E)+(n*f-o*d)*(_*M-y*E)},dt.multiply=ul,dt.translate=function(t,e,i){var n,o,l,c,d,f,_,y,v,b,E,M,A=i[0],C=i[1],D=i[2];return e===t?(t[12]=e[0]*A+e[4]*C+e[8]*D+e[12],t[13]=e[1]*A+e[5]*C+e[9]*D+e[13],t[14]=e[2]*A+e[6]*C+e[10]*D+e[14],t[15]=e[3]*A+e[7]*C+e[11]*D+e[15]):(o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=e[9],E=e[10],M=e[11],t[0]=n=e[0],t[1]=o,t[2]=l,t[3]=c,t[4]=d,t[5]=f,t[6]=_,t[7]=y,t[8]=v,t[9]=b,t[10]=E,t[11]=M,t[12]=n*A+d*C+v*D+e[12],t[13]=o*A+f*C+b*D+e[13],t[14]=l*A+_*C+E*D+e[14],t[15]=c*A+y*C+M*D+e[15]),t},dt.scale=function(t,e,i){var n=i[0],o=i[1],l=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*l,t[9]=e[9]*l,t[10]=e[10]*l,t[11]=e[11]*l,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},dt.rotate=function(t,e,i,n){var o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H,X,Q,ae,de,ye,pe,we=n[0],De=n[1],Te=n[2],ke=Math.hypot(we,De,Te);return ke0?(i[0]=2*(d*c+y*n+f*l-_*o)/v,i[1]=2*(f*c+y*o+_*n-d*l)/v,i[2]=2*(_*c+y*l+d*o-f*n)/v):(i[0]=2*(d*c+y*n+f*l-_*o),i[1]=2*(f*c+y*o+_*n-d*l),i[2]=2*(_*c+y*l+d*o-f*n)),Ns(t,e,i),t},dt.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},dt.getScaling=Oo,dt.getRotation=function(t,e){var i=new ai.ARRAY_TYPE(3);Oo(i,e);var n=1/i[0],o=1/i[1],l=1/i[2],c=e[0]*n,d=e[1]*o,f=e[2]*l,_=e[4]*n,y=e[5]*o,v=e[6]*l,b=e[8]*n,E=e[9]*o,M=e[10]*l,A=c+y+M,C=0;return A>0?(C=2*Math.sqrt(A+1),t[3]=.25*C,t[0]=(v-E)/C,t[1]=(b-f)/C,t[2]=(d-_)/C):c>y&&c>M?(C=2*Math.sqrt(1+c-y-M),t[3]=(v-E)/C,t[0]=.25*C,t[1]=(d+_)/C,t[2]=(b+f)/C):y>M?(C=2*Math.sqrt(1+y-c-M),t[3]=(b-f)/C,t[0]=(d+_)/C,t[1]=.25*C,t[2]=(v+E)/C):(C=2*Math.sqrt(1+M-c-y),t[3]=(d-_)/C,t[0]=(b+f)/C,t[1]=(v+E)/C,t[2]=.25*C),t},dt.fromRotationTranslationScale=function(t,e,i,n){var o=e[0],l=e[1],c=e[2],d=e[3],f=o+o,_=l+l,y=c+c,v=o*f,b=o*_,E=o*y,M=l*_,A=l*y,C=c*y,D=d*f,V=d*_,N=d*y,U=n[0],H=n[1],X=n[2];return t[0]=(1-(M+C))*U,t[1]=(b+N)*U,t[2]=(E-V)*U,t[3]=0,t[4]=(b-N)*H,t[5]=(1-(v+C))*H,t[6]=(A+D)*H,t[7]=0,t[8]=(E+V)*X,t[9]=(A-D)*X,t[10]=(1-(v+M))*X,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t},dt.fromRotationTranslationScaleOrigin=function(t,e,i,n,o){var l=e[0],c=e[1],d=e[2],f=e[3],_=l+l,y=c+c,v=d+d,b=l*_,E=l*y,M=l*v,A=c*y,C=c*v,D=d*v,V=f*_,N=f*y,U=f*v,H=n[0],X=n[1],Q=n[2],ae=o[0],de=o[1],ye=o[2],pe=(1-(A+D))*H,we=(E+U)*H,De=(M-N)*H,Te=(E-U)*X,ke=(1-(b+D))*X,be=(C+V)*X,Ie=(M+N)*Q,Be=(C-V)*Q,Ee=(1-(b+A))*Q;return t[0]=pe,t[1]=we,t[2]=De,t[3]=0,t[4]=Te,t[5]=ke,t[6]=be,t[7]=0,t[8]=Ie,t[9]=Be,t[10]=Ee,t[11]=0,t[12]=i[0]+ae-(pe*ae+Te*de+Ie*ye),t[13]=i[1]+de-(we*ae+ke*de+Be*ye),t[14]=i[2]+ye-(De*ae+be*de+Ee*ye),t[15]=1,t},dt.fromQuat=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i+i,d=n+n,f=o+o,_=i*c,y=n*c,v=n*d,b=o*c,E=o*d,M=o*f,A=l*c,C=l*d,D=l*f;return t[0]=1-v-M,t[1]=y+D,t[2]=b-C,t[3]=0,t[4]=y-D,t[5]=1-_-M,t[6]=E+A,t[7]=0,t[8]=b+C,t[9]=E-A,t[10]=1-_-v,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},dt.frustum=function(t,e,i,n,o,l,c){var d=1/(i-e),f=1/(o-n),_=1/(l-c);return t[0]=2*l*d,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*l*f,t[6]=0,t[7]=0,t[8]=(i+e)*d,t[9]=(o+n)*f,t[10]=(c+l)*_,t[11]=-1,t[12]=0,t[13]=0,t[14]=c*l*2*_,t[15]=0,t},dt.perspectiveNO=Ur,dt.perspectiveZO=function(t,e,i,n,o){var l,c=1/Math.tan(e/2);return t[0]=c/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,o!=null&&o!==1/0?(t[10]=o*(l=1/(n-o)),t[14]=o*n*l):(t[10]=-1,t[14]=-n),t},dt.perspectiveFromFieldOfView=function(t,e,i,n){var o=Math.tan(e.upDegrees*Math.PI/180),l=Math.tan(e.downDegrees*Math.PI/180),c=Math.tan(e.leftDegrees*Math.PI/180),d=Math.tan(e.rightDegrees*Math.PI/180),f=2/(c+d),_=2/(o+l);return t[0]=f,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=_,t[6]=0,t[7]=0,t[8]=-(c-d)*f*.5,t[9]=(o-l)*_*.5,t[10]=n/(i-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*i/(i-n),t[15]=0,t},dt.orthoNO=jr,dt.orthoZO=function(t,e,i,n,o,l,c){var d=1/(e-i),f=1/(n-o),_=1/(l-c);return t[0]=-2*d,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*f,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=_,t[11]=0,t[12]=(e+i)*d,t[13]=(o+n)*f,t[14]=l*_,t[15]=1,t},dt.lookAt=function(t,e,i,n){var o,l,c,d,f,_,y,v,b,E,M=e[0],A=e[1],C=e[2],D=n[0],V=n[1],N=n[2],U=i[0],H=i[1],X=i[2];return Math.abs(M-U)0&&(y*=E=1/Math.sqrt(E),v*=E,b*=E);var M=f*b-_*v,A=_*y-d*b,C=d*v-f*y;return(E=M*M+A*A+C*C)>0&&(M*=E=1/Math.sqrt(E),A*=E,C*=E),t[0]=M,t[1]=A,t[2]=C,t[3]=0,t[4]=v*C-b*A,t[5]=b*M-y*C,t[6]=y*A-v*M,t[7]=0,t[8]=y,t[9]=v,t[10]=b,t[11]=0,t[12]=o,t[13]=l,t[14]=c,t[15]=1,t},dt.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},dt.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},dt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t[9]=e[9]+i[9],t[10]=e[10]+i[10],t[11]=e[11]+i[11],t[12]=e[12]+i[12],t[13]=e[13]+i[13],t[14]=e[14]+i[14],t[15]=e[15]+i[15],t},dt.subtract=Vs,dt.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12]*i,t[13]=e[13]*i,t[14]=e[14]*i,t[15]=e[15]*i,t},dt.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t[6]=e[6]+i[6]*n,t[7]=e[7]+i[7]*n,t[8]=e[8]+i[8]*n,t[9]=e[9]+i[9]*n,t[10]=e[10]+i[10]*n,t[11]=e[11]+i[11]*n,t[12]=e[12]+i[12]*n,t[13]=e[13]+i[13]*n,t[14]=e[14]+i[14]*n,t[15]=e[15]+i[15]*n,t},dt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},dt.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],f=t[6],_=t[7],y=t[8],v=t[9],b=t[10],E=t[11],M=t[12],A=t[13],C=t[14],D=t[15],V=e[0],N=e[1],U=e[2],H=e[3],X=e[4],Q=e[5],ae=e[6],de=e[7],ye=e[8],pe=e[9],we=e[10],De=e[11],Te=e[12],ke=e[13],be=e[14],Ie=e[15];return Math.abs(i-V)<=ai.EPSILON*Math.max(1,Math.abs(i),Math.abs(V))&&Math.abs(n-N)<=ai.EPSILON*Math.max(1,Math.abs(n),Math.abs(N))&&Math.abs(o-U)<=ai.EPSILON*Math.max(1,Math.abs(o),Math.abs(U))&&Math.abs(l-H)<=ai.EPSILON*Math.max(1,Math.abs(l),Math.abs(H))&&Math.abs(c-X)<=ai.EPSILON*Math.max(1,Math.abs(c),Math.abs(X))&&Math.abs(d-Q)<=ai.EPSILON*Math.max(1,Math.abs(d),Math.abs(Q))&&Math.abs(f-ae)<=ai.EPSILON*Math.max(1,Math.abs(f),Math.abs(ae))&&Math.abs(_-de)<=ai.EPSILON*Math.max(1,Math.abs(_),Math.abs(de))&&Math.abs(y-ye)<=ai.EPSILON*Math.max(1,Math.abs(y),Math.abs(ye))&&Math.abs(v-pe)<=ai.EPSILON*Math.max(1,Math.abs(v),Math.abs(pe))&&Math.abs(b-we)<=ai.EPSILON*Math.max(1,Math.abs(b),Math.abs(we))&&Math.abs(E-De)<=ai.EPSILON*Math.max(1,Math.abs(E),Math.abs(De))&&Math.abs(M-Te)<=ai.EPSILON*Math.max(1,Math.abs(M),Math.abs(Te))&&Math.abs(A-ke)<=ai.EPSILON*Math.max(1,Math.abs(A),Math.abs(ke))&&Math.abs(C-be)<=ai.EPSILON*Math.max(1,Math.abs(C),Math.abs(be))&&Math.abs(D-Ie)<=ai.EPSILON*Math.max(1,Math.abs(D),Math.abs(Ie))},dt.sub=dt.mul=dt.ortho=dt.perspective=void 0;var ai=function(t,e){if(t&&t.__esModule)return t;if(t===null||ko(t)!=="object"&&typeof t!="function")return{default:t};var i=ll(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function ll(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(ll=function(n){return n?i:e})(t)}function cl(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ul(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=e[9],E=e[10],M=e[11],A=e[12],C=e[13],D=e[14],V=e[15],N=i[0],U=i[1],H=i[2],X=i[3];return t[0]=N*n+U*d+H*v+X*A,t[1]=N*o+U*f+H*b+X*C,t[2]=N*l+U*_+H*E+X*D,t[3]=N*c+U*y+H*M+X*V,t[4]=(N=i[4])*n+(U=i[5])*d+(H=i[6])*v+(X=i[7])*A,t[5]=N*o+U*f+H*b+X*C,t[6]=N*l+U*_+H*E+X*D,t[7]=N*c+U*y+H*M+X*V,t[8]=(N=i[8])*n+(U=i[9])*d+(H=i[10])*v+(X=i[11])*A,t[9]=N*o+U*f+H*b+X*C,t[10]=N*l+U*_+H*E+X*D,t[11]=N*c+U*y+H*M+X*V,t[12]=(N=i[12])*n+(U=i[13])*d+(H=i[14])*v+(X=i[15])*A,t[13]=N*o+U*f+H*b+X*C,t[14]=N*l+U*_+H*E+X*D,t[15]=N*c+U*y+H*M+X*V,t}function Ns(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=n+n,f=o+o,_=l+l,y=n*d,v=n*f,b=n*_,E=o*f,M=o*_,A=l*_,C=c*d,D=c*f,V=c*_;return t[0]=1-(E+A),t[1]=v+V,t[2]=b-D,t[3]=0,t[4]=v-V,t[5]=1-(y+A),t[6]=M+C,t[7]=0,t[8]=b+D,t[9]=M-C,t[10]=1-(y+E),t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}function Oo(t,e){var i=e[4],n=e[5],o=e[6],l=e[8],c=e[9],d=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(i,n,o),t[2]=Math.hypot(l,c,d),t}function Ur(t,e,i,n,o){var l,c=1/Math.tan(e/2);return t[0]=c/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,o!=null&&o!==1/0?(t[10]=(o+n)*(l=1/(n-o)),t[14]=2*o*n*l):(t[10]=-1,t[14]=-2*n),t}function jr(t,e,i,n,o,l,c){var d=1/(e-i),f=1/(n-o),_=1/(l-c);return t[0]=-2*d,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*f,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*_,t[11]=0,t[12]=(e+i)*d,t[13]=(o+n)*f,t[14]=(c+l)*_,t[15]=1,t}function Vs(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t[9]=e[9]-i[9],t[10]=e[10]-i[10],t[11]=e[11]-i[11],t[12]=e[12]-i[12],t[13]=e[13]-i[13],t[14]=e[14]-i[14],t[15]=e[15]-i[15],t}dt.perspective=Ur,dt.ortho=jr,dt.mul=ul,dt.sub=Vs;var lt={},pt={};function Bo(t){return Bo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bo(t)}Object.defineProperty(pt,"__esModule",{value:!0}),pt.create=hl,pt.clone=function(t){var e=new lr.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},pt.length=ro,pt.fromValues=function(t,e,i){var n=new lr.ARRAY_TYPE(3);return n[0]=t,n[1]=e,n[2]=i,n},pt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},pt.set=function(t,e,i,n){return t[0]=e,t[1]=i,t[2]=n,t},pt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t},pt.subtract=dl,pt.multiply=Ln,pt.divide=kn,pt.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},pt.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},pt.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t},pt.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t},pt.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},pt.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t},pt.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t},pt.distance=Fo,pt.squaredDistance=Us,pt.squaredLength=No,pt.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},pt.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},pt.normalize=function(t,e){var i=e[0],n=e[1],o=e[2],l=i*i+n*n+o*o;return l>0&&(l=1/Math.sqrt(l)),t[0]=e[0]*l,t[1]=e[1]*l,t[2]=e[2]*l,t},pt.dot=Vo,pt.cross=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=i[0],d=i[1],f=i[2];return t[0]=o*f-l*d,t[1]=l*c-n*f,t[2]=n*d-o*c,t},pt.lerp=function(t,e,i,n){var o=e[0],l=e[1],c=e[2];return t[0]=o+n*(i[0]-o),t[1]=l+n*(i[1]-l),t[2]=c+n*(i[2]-c),t},pt.hermite=function(t,e,i,n,o,l){var c=l*l,d=c*(2*l-3)+1,f=c*(l-2)+l,_=c*(l-1),y=c*(3-2*l);return t[0]=e[0]*d+i[0]*f+n[0]*_+o[0]*y,t[1]=e[1]*d+i[1]*f+n[1]*_+o[1]*y,t[2]=e[2]*d+i[2]*f+n[2]*_+o[2]*y,t},pt.bezier=function(t,e,i,n,o,l){var c=1-l,d=c*c,f=l*l,_=d*c,y=3*l*d,v=3*f*c,b=f*l;return t[0]=e[0]*_+i[0]*y+n[0]*v+o[0]*b,t[1]=e[1]*_+i[1]*y+n[1]*v+o[1]*b,t[2]=e[2]*_+i[2]*y+n[2]*v+o[2]*b,t},pt.random=function(t,e){e=e||1;var i=2*lr.RANDOM()*Math.PI,n=2*lr.RANDOM()-1,o=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(i)*o,t[1]=Math.sin(i)*o,t[2]=n*e,t},pt.transformMat4=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=i[3]*n+i[7]*o+i[11]*l+i[15];return t[0]=(i[0]*n+i[4]*o+i[8]*l+i[12])/(c=c||1),t[1]=(i[1]*n+i[5]*o+i[9]*l+i[13])/c,t[2]=(i[2]*n+i[6]*o+i[10]*l+i[14])/c,t},pt.transformMat3=function(t,e,i){var n=e[0],o=e[1],l=e[2];return t[0]=n*i[0]+o*i[3]+l*i[6],t[1]=n*i[1]+o*i[4]+l*i[7],t[2]=n*i[2]+o*i[5]+l*i[8],t},pt.transformQuat=function(t,e,i){var n=i[0],o=i[1],l=i[2],c=e[0],d=e[1],f=e[2],_=o*f-l*d,y=l*c-n*f,v=n*d-o*c,b=o*v-l*y,E=l*_-n*v,M=n*y-o*_,A=2*i[3];return y*=A,v*=A,E*=2,M*=2,t[0]=c+(_*=A)+(b*=2),t[1]=d+y+E,t[2]=f+v+M,t},pt.rotateX=function(t,e,i,n){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0],l[1]=o[1]*Math.cos(n)-o[2]*Math.sin(n),l[2]=o[1]*Math.sin(n)+o[2]*Math.cos(n),t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},pt.rotateY=function(t,e,i,n){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[2]*Math.sin(n)+o[0]*Math.cos(n),l[1]=o[1],l[2]=o[2]*Math.cos(n)-o[0]*Math.sin(n),t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},pt.rotateZ=function(t,e,i,n){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0]*Math.cos(n)-o[1]*Math.sin(n),l[1]=o[0]*Math.sin(n)+o[1]*Math.cos(n),l[2]=o[2],t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},pt.angle=function(t,e){var i=t[0],n=t[1],o=t[2],l=e[0],c=e[1],d=e[2],f=Math.sqrt(i*i+n*n+o*o)*Math.sqrt(l*l+c*c+d*d),_=f&&Vo(t,e)/f;return Math.acos(Math.min(Math.max(_,-1),1))},pt.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t},pt.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},pt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},pt.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=e[0],c=e[1],d=e[2];return Math.abs(i-l)<=lr.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(n-c)<=lr.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(o-d)<=lr.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))},pt.forEach=pt.sqrLen=pt.len=pt.sqrDist=pt.dist=pt.div=pt.mul=pt.sub=void 0;var lr=function(t,e){if(t&&t.__esModule)return t;if(t===null||Bo(t)!=="object"&&typeof t!="function")return{default:t};var i=pn(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function pn(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(pn=function(n){return n?i:e})(t)}function hl(){var t=new lr.ARRAY_TYPE(3);return lr.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ro(t){return Math.hypot(t[0],t[1],t[2])}function dl(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function Ln(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function kn(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t}function Fo(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])}function Us(t,e){var i=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2];return i*i+n*n+o*o}function No(t){var e=t[0],i=t[1],n=t[2];return e*e+i*i+n*n}function Vo(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}pt.sub=dl,pt.mul=Ln,pt.div=kn,pt.dist=Fo,pt.sqrDist=Us,pt.len=ro,pt.sqrLen=No;var Ar,or=(Ar=hl(),function(t,e,i,n,o,l){var c,d;for(e||(e=3),i||(i=0),d=n?Math.min(n*e+i,t.length):t.length,c=i;c0&&(c=1/Math.sqrt(c)),t[0]=i*c,t[1]=n*c,t[2]=o*c,t[3]=l*c,t},ct.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},ct.cross=function(t,e,i,n){var o=i[0]*n[1]-i[1]*n[0],l=i[0]*n[2]-i[2]*n[0],c=i[0]*n[3]-i[3]*n[0],d=i[1]*n[2]-i[2]*n[1],f=i[1]*n[3]-i[3]*n[1],_=i[2]*n[3]-i[3]*n[2],y=e[0],v=e[1],b=e[2],E=e[3];return t[0]=v*_-b*f+E*d,t[1]=-y*_+b*c-E*l,t[2]=y*f-v*c+E*o,t[3]=-y*d+v*l-b*o,t},ct.lerp=function(t,e,i,n){var o=e[0],l=e[1],c=e[2],d=e[3];return t[0]=o+n*(i[0]-o),t[1]=l+n*(i[1]-l),t[2]=c+n*(i[2]-c),t[3]=d+n*(i[3]-d),t},ct.random=function(t,e){var i,n,o,l,c,d;e=e||1;do c=(i=2*er.RANDOM()-1)*i+(n=2*er.RANDOM()-1)*n;while(c>=1);do d=(o=2*er.RANDOM()-1)*o+(l=2*er.RANDOM()-1)*l;while(d>=1);var f=Math.sqrt((1-c)/d);return t[0]=e*i,t[1]=e*n,t[2]=e*o*f,t[3]=e*l*f,t},ct.transformMat4=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3];return t[0]=i[0]*n+i[4]*o+i[8]*l+i[12]*c,t[1]=i[1]*n+i[5]*o+i[9]*l+i[13]*c,t[2]=i[2]*n+i[6]*o+i[10]*l+i[14]*c,t[3]=i[3]*n+i[7]*o+i[11]*l+i[15]*c,t},ct.transformQuat=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=i[0],d=i[1],f=i[2],_=i[3],y=_*n+d*l-f*o,v=_*o+f*n-c*l,b=_*l+c*o-d*n,E=-c*n-d*o-f*l;return t[0]=y*_+E*-c+v*-f-b*-d,t[1]=v*_+E*-d+b*-c-y*-f,t[2]=b*_+E*-f+y*-d-v*-c,t[3]=e[3],t},ct.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},ct.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},ct.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},ct.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=e[0],d=e[1],f=e[2],_=e[3];return Math.abs(i-c)<=er.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(n-d)<=er.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(o-f)<=er.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(l-_)<=er.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))},ct.forEach=ct.sqrLen=ct.len=ct.sqrDist=ct.dist=ct.div=ct.mul=ct.sub=void 0;var er=function(t,e){if(t&&t.__esModule)return t;if(t===null||Uo(t)!=="object"&&typeof t!="function")return{default:t};var i=Gr(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function Gr(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Gr=function(n){return n?i:e})(t)}function no(){var t=new er.ARRAY_TYPE(4);return er.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Cr(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}function jo(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}function js(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t[3]=e[3]/i[3],t}function Go(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3])}function oo(t,e){var i=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2],l=e[3]-t[3];return i*i+n*n+o*o+l*l}function $o(t){return Math.hypot(t[0],t[1],t[2],t[3])}function qo(t){var e=t[0],i=t[1],n=t[2],o=t[3];return e*e+i*i+n*n+o*o}ct.sub=Cr,ct.mul=jo,ct.div=js,ct.dist=Go,ct.sqrDist=oo,ct.len=$o,ct.sqrLen=qo;var On=function(){var t=no();return function(e,i,n,o,l,c){var d,f;for(i||(i=4),n||(n=0),f=o?Math.min(o*i+n,e.length):e.length,d=n;dPr.EPSILON?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),i},lt.getAngle=function(t,e){var i=K(t,e);return Math.acos(2*i*i-1)},lt.multiply=$s,lt.rotateX=function(t,e,i){i*=.5;var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),f=Math.cos(i);return t[0]=n*f+c*d,t[1]=o*f+l*d,t[2]=l*f-o*d,t[3]=c*f-n*d,t},lt.rotateY=function(t,e,i){i*=.5;var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),f=Math.cos(i);return t[0]=n*f-l*d,t[1]=o*f+c*d,t[2]=l*f+n*d,t[3]=c*f-o*d,t},lt.rotateZ=function(t,e,i){i*=.5;var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),f=Math.cos(i);return t[0]=n*f+o*d,t[1]=o*f-n*d,t[2]=l*f+c*d,t[3]=c*f-l*d,t},lt.calculateW=function(t,e){var i=e[0],n=e[1],o=e[2];return t[0]=i,t[1]=n,t[2]=o,t[3]=Math.sqrt(Math.abs(1-i*i-n*n-o*o)),t},lt.exp=oe,lt.ln=R,lt.pow=function(t,e,i){return R(t,e),te(t,t,i),oe(t,t),t},lt.slerp=F,lt.random=function(t){var e=Pr.RANDOM(),i=Pr.RANDOM(),n=Pr.RANDOM(),o=Math.sqrt(1-e),l=Math.sqrt(e);return t[0]=o*Math.sin(2*Math.PI*i),t[1]=o*Math.cos(2*Math.PI*i),t[2]=l*Math.sin(2*Math.PI*n),t[3]=l*Math.cos(2*Math.PI*n),t},lt.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i*i+n*n+o*o+l*l,d=c?1/c:0;return t[0]=-i*d,t[1]=-n*d,t[2]=-o*d,t[3]=l*d,t},lt.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},lt.fromMat3=q,lt.fromEuler=function(t,e,i,n){var o=.5*Math.PI/180;e*=o,i*=o,n*=o;var l=Math.sin(e),c=Math.cos(e),d=Math.sin(i),f=Math.cos(i),_=Math.sin(n),y=Math.cos(n);return t[0]=l*f*y-c*d*_,t[1]=c*d*y+l*f*_,t[2]=c*f*_-l*d*y,t[3]=c*f*y+l*d*_,t},lt.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},lt.setAxes=lt.sqlerp=lt.rotationTo=lt.equals=lt.exactEquals=lt.normalize=lt.sqrLen=lt.squaredLength=lt.len=lt.length=lt.lerp=lt.dot=lt.scale=lt.mul=lt.add=lt.set=lt.copy=lt.fromValues=lt.clone=void 0;var Pr=so(fi),Cc=so(Ht),zr=so(pt),Bi=so(ct);function Gs(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Gs=function(n){return n?i:e})(t)}function so(t,e){if(t&&t.__esModule)return t;if(t===null||Zo(t)!=="object"&&typeof t!="function")return{default:t};var i=Gs(e);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}function Wo(){var t=new Pr.ARRAY_TYPE(4);return Pr.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Mi(t,e,i){i*=.5;var n=Math.sin(i);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(i),t}function $s(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[0],f=i[1],_=i[2],y=i[3];return t[0]=n*y+c*d+o*_-l*f,t[1]=o*y+c*f+l*d-n*_,t[2]=l*y+c*_+n*f-o*d,t[3]=c*y-n*d-o*f-l*_,t}function oe(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=Math.sqrt(i*i+n*n+o*o),d=Math.exp(l),f=c>0?d*Math.sin(c)/c:0;return t[0]=i*f,t[1]=n*f,t[2]=o*f,t[3]=d*Math.cos(c),t}function R(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=Math.sqrt(i*i+n*n+o*o),d=c>0?Math.atan2(c,l)/c:0;return t[0]=i*d,t[1]=n*d,t[2]=o*d,t[3]=.5*Math.log(i*i+n*n+o*o+l*l),t}function F(t,e,i,n){var o,l,c,d,f,_=e[0],y=e[1],v=e[2],b=e[3],E=i[0],M=i[1],A=i[2],C=i[3];return(l=_*E+y*M+v*A+b*C)<0&&(l=-l,E=-E,M=-M,A=-A,C=-C),1-l>Pr.EPSILON?(o=Math.acos(l),c=Math.sin(o),d=Math.sin((1-n)*o)/c,f=Math.sin(n*o)/c):(d=1-n,f=n),t[0]=d*_+f*E,t[1]=d*y+f*M,t[2]=d*v+f*A,t[3]=d*b+f*C,t}function q(t,e){var i,n=e[0]+e[4]+e[8];if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,t[0]=(e[5]-e[7])*(i=.5/i),t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var o=0;e[4]>e[0]&&(o=1),e[8]>e[3*o+o]&&(o=2);var l=(o+1)%3,c=(o+2)%3;i=Math.sqrt(e[3*o+o]-e[3*l+l]-e[3*c+c]+1),t[o]=.5*i,t[3]=(e[3*l+c]-e[3*c+l])*(i=.5/i),t[l]=(e[3*l+o]+e[3*o+l])*i,t[c]=(e[3*c+o]+e[3*o+c])*i}return t}lt.clone=Bi.clone,lt.fromValues=Bi.fromValues,lt.copy=Bi.copy,lt.set=Bi.set,lt.add=Bi.add,lt.mul=$s;var te=Bi.scale;lt.scale=te;var K=Bi.dot;lt.dot=K,lt.lerp=Bi.lerp;var ce=Bi.length;lt.length=ce,lt.len=ce;var xe=Bi.squaredLength;lt.squaredLength=xe,lt.sqrLen=xe;var le=Bi.normalize;lt.normalize=le,lt.exactEquals=Bi.exactEquals,lt.equals=Bi.equals;var ge,ze,Pe,qe=(ge=zr.create(),ze=zr.fromValues(1,0,0),Pe=zr.fromValues(0,1,0),function(t,e,i){var n=zr.dot(e,i);return n<-.999999?(zr.cross(ge,ze,e),zr.len(ge)<1e-6&&zr.cross(ge,Pe,e),zr.normalize(ge,ge),Mi(t,ge,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(zr.cross(ge,e,i),t[0]=ge[0],t[1]=ge[1],t[2]=ge[2],t[3]=1+n,le(t,t))});lt.rotationTo=qe;var tt,ot,Bt=(tt=Wo(),ot=Wo(),function(t,e,i,n,o,l){return F(tt,e,o,l),F(ot,i,n,l),F(t,tt,ot,2*l*(1-l)),t});lt.sqlerp=Bt;var yt,kt=(yt=Cc.create(),function(t,e,i,n){return yt[0]=i[0],yt[3]=i[1],yt[6]=i[2],yt[1]=n[0],yt[4]=n[1],yt[7]=n[2],yt[2]=-e[0],yt[5]=-e[1],yt[8]=-e[2],le(t,q(t,yt))});lt.setAxes=kt;var Je={};function si(t){return si=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},si(t)}Object.defineProperty(Je,"__esModule",{value:!0}),Je.create=function(){var t=new Ft.ARRAY_TYPE(8);return Ft.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t},Je.clone=function(t){var e=new Ft.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e},Je.fromValues=function(t,e,i,n,o,l,c,d){var f=new Ft.ARRAY_TYPE(8);return f[0]=t,f[1]=e,f[2]=i,f[3]=n,f[4]=o,f[5]=l,f[6]=c,f[7]=d,f},Je.fromRotationTranslationValues=function(t,e,i,n,o,l,c){var d=new Ft.ARRAY_TYPE(8);d[0]=t,d[1]=e,d[2]=i,d[3]=n;var f=.5*o,_=.5*l,y=.5*c;return d[4]=f*n+_*i-y*e,d[5]=_*n+y*t-f*i,d[6]=y*n+f*e-_*t,d[7]=-f*t-_*e-y*i,d},Je.fromRotationTranslation=ji,Je.fromTranslation=function(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t},Je.fromRotation=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},Je.fromMat4=function(t,e){var i=Dt.create();yi.getRotation(i,e);var n=new Ft.ARRAY_TYPE(3);return yi.getTranslation(n,e),ji(t,i,n),t},Je.copy=tr,Je.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},Je.set=function(t,e,i,n,o,l,c,d,f){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t[6]=d,t[7]=f,t},Je.getDual=function(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t},Je.setDual=function(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t},Je.getTranslation=function(t,e){var i=e[4],n=e[5],o=e[6],l=e[7],c=-e[0],d=-e[1],f=-e[2],_=e[3];return t[0]=2*(i*_+l*c+n*f-o*d),t[1]=2*(n*_+l*d+o*c-i*f),t[2]=2*(o*_+l*f+i*d-n*c),t},Je.translate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=.5*i[0],f=.5*i[1],_=.5*i[2],y=e[4],v=e[5],b=e[6],E=e[7];return t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=c*d+o*_-l*f+y,t[5]=c*f+l*d-n*_+v,t[6]=c*_+n*f-o*d+b,t[7]=-n*d-o*f-l*_+E,t},Je.rotateX=function(t,e,i){var n=-e[0],o=-e[1],l=-e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=d*c+y*n+f*l-_*o,b=f*c+y*o+_*n-d*l,E=_*c+y*l+d*o-f*n,M=y*c-d*n-f*o-_*l;return Dt.rotateX(t,e,i),t[4]=v*(c=t[3])+M*(n=t[0])+b*(l=t[2])-E*(o=t[1]),t[5]=b*c+M*o+E*n-v*l,t[6]=E*c+M*l+v*o-b*n,t[7]=M*c-v*n-b*o-E*l,t},Je.rotateY=function(t,e,i){var n=-e[0],o=-e[1],l=-e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=d*c+y*n+f*l-_*o,b=f*c+y*o+_*n-d*l,E=_*c+y*l+d*o-f*n,M=y*c-d*n-f*o-_*l;return Dt.rotateY(t,e,i),t[4]=v*(c=t[3])+M*(n=t[0])+b*(l=t[2])-E*(o=t[1]),t[5]=b*c+M*o+E*n-v*l,t[6]=E*c+M*l+v*o-b*n,t[7]=M*c-v*n-b*o-E*l,t},Je.rotateZ=function(t,e,i){var n=-e[0],o=-e[1],l=-e[2],c=e[3],d=e[4],f=e[5],_=e[6],y=e[7],v=d*c+y*n+f*l-_*o,b=f*c+y*o+_*n-d*l,E=_*c+y*l+d*o-f*n,M=y*c-d*n-f*o-_*l;return Dt.rotateZ(t,e,i),t[4]=v*(c=t[3])+M*(n=t[0])+b*(l=t[2])-E*(o=t[1]),t[5]=b*c+M*o+E*n-v*l,t[6]=E*c+M*l+v*o-b*n,t[7]=M*c-v*n-b*o-E*l,t},Je.rotateByQuatAppend=function(t,e,i){var n=i[0],o=i[1],l=i[2],c=i[3],d=e[0],f=e[1],_=e[2],y=e[3];return t[0]=d*c+y*n+f*l-_*o,t[1]=f*c+y*o+_*n-d*l,t[2]=_*c+y*l+d*o-f*n,t[3]=y*c-d*n-f*o-_*l,t[4]=(d=e[4])*c+(y=e[7])*n+(f=e[5])*l-(_=e[6])*o,t[5]=f*c+y*o+_*n-d*l,t[6]=_*c+y*l+d*o-f*n,t[7]=y*c-d*n-f*o-_*l,t},Je.rotateByQuatPrepend=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[0],f=i[1],_=i[2],y=i[3];return t[0]=n*y+c*d+o*_-l*f,t[1]=o*y+c*f+l*d-n*_,t[2]=l*y+c*_+n*f-o*d,t[3]=c*y-n*d-o*f-l*_,t[4]=n*(y=i[7])+c*(d=i[4])+o*(_=i[6])-l*(f=i[5]),t[5]=o*y+c*f+l*d-n*_,t[6]=l*y+c*_+n*f-o*d,t[7]=c*y-n*d-o*f-l*_,t},Je.rotateAroundAxis=function(t,e,i,n){if(Math.abs(n)0){i=Math.sqrt(i);var n=e[0]/i,o=e[1]/i,l=e[2]/i,c=e[3]/i,d=e[4],f=e[5],_=e[6],y=e[7],v=n*d+o*f+l*_+c*y;t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=(d-n*v)/i,t[5]=(f-o*v)/i,t[6]=(_-l*v)/i,t[7]=(y-c*v)/i}return t},Je.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},Je.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},Je.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],f=t[6],_=t[7],y=e[0],v=e[1],b=e[2],E=e[3],M=e[4],A=e[5],C=e[6],D=e[7];return Math.abs(i-y)<=Ft.EPSILON*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(n-v)<=Ft.EPSILON*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(o-b)<=Ft.EPSILON*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(l-E)<=Ft.EPSILON*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(c-M)<=Ft.EPSILON*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(d-A)<=Ft.EPSILON*Math.max(1,Math.abs(d),Math.abs(A))&&Math.abs(f-C)<=Ft.EPSILON*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(_-D)<=Ft.EPSILON*Math.max(1,Math.abs(_),Math.abs(D))},Je.sqrLen=Je.squaredLength=Je.len=Je.length=Je.dot=Je.mul=Je.setReal=Je.getReal=void 0;var Ft=Ri(fi),Dt=Ri(lt),yi=Ri(dt);function xi(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(xi=function(n){return n?i:e})(t)}function Ri(t,e){if(t&&t.__esModule)return t;if(t===null||si(t)!=="object"&&typeof t!="function")return{default:t};var i=xi(e);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}function ji(t,e,i){var n=.5*i[0],o=.5*i[1],l=.5*i[2],c=e[0],d=e[1],f=e[2],_=e[3];return t[0]=c,t[1]=d,t[2]=f,t[3]=_,t[4]=n*_+o*f-l*d,t[5]=o*_+l*c-n*f,t[6]=l*_+n*d-o*c,t[7]=-n*c-o*d-l*f,t}function tr(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function ao(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[4],f=i[5],_=i[6],y=i[7],v=e[4],b=e[5],E=e[6],M=e[7],A=i[0],C=i[1],D=i[2],V=i[3];return t[0]=n*V+c*A+o*D-l*C,t[1]=o*V+c*C+l*A-n*D,t[2]=l*V+c*D+n*C-o*A,t[3]=c*V-n*A-o*C-l*D,t[4]=n*y+c*d+o*_-l*f+v*V+M*A+b*D-E*C,t[5]=o*y+c*f+l*d-n*_+b*V+M*C+E*A-v*D,t[6]=l*y+c*_+n*f-o*d+E*V+M*D+v*C-b*A,t[7]=c*y-n*d-o*f-l*_+M*V-v*A-b*C-E*D,t}Je.getReal=Dt.copy,Je.setReal=Dt.copy,Je.mul=ao;var Pc=Dt.dot;Je.dot=Pc;var zc=Dt.length;Je.length=zc,Je.len=zc;var qs=Dt.squaredLength;Je.squaredLength=qs,Je.sqrLen=qs;var wt={};function pl(t){return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pl(t)}Object.defineProperty(wt,"__esModule",{value:!0}),wt.create=Rc,wt.clone=function(t){var e=new Bn.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},wt.fromValues=function(t,e){var i=new Bn.ARRAY_TYPE(2);return i[0]=t,i[1]=e,i},wt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},wt.set=function(t,e,i){return t[0]=e,t[1]=i,t},wt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},wt.subtract=Lc,wt.multiply=kc,wt.divide=Oc,wt.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},wt.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},wt.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t},wt.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t},wt.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},wt.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},wt.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t},wt.distance=Bc,wt.squaredDistance=Fc,wt.length=Zs,wt.squaredLength=Ws,wt.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},wt.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},wt.normalize=function(t,e){var i=e[0],n=e[1],o=i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t},wt.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},wt.cross=function(t,e,i){var n=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=n,t},wt.lerp=function(t,e,i,n){var o=e[0],l=e[1];return t[0]=o+n*(i[0]-o),t[1]=l+n*(i[1]-l),t},wt.random=function(t,e){e=e||1;var i=2*Bn.RANDOM()*Math.PI;return t[0]=Math.cos(i)*e,t[1]=Math.sin(i)*e,t},wt.transformMat2=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[2]*o,t[1]=i[1]*n+i[3]*o,t},wt.transformMat2d=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[2]*o+i[4],t[1]=i[1]*n+i[3]*o+i[5],t},wt.transformMat3=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[3]*o+i[6],t[1]=i[1]*n+i[4]*o+i[7],t},wt.transformMat4=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[4]*o+i[12],t[1]=i[1]*n+i[5]*o+i[13],t},wt.rotate=function(t,e,i,n){var o=e[0]-i[0],l=e[1]-i[1],c=Math.sin(n),d=Math.cos(n);return t[0]=o*d-l*c+i[0],t[1]=o*c+l*d+i[1],t},wt.angle=function(t,e){var i=t[0],n=t[1],o=e[0],l=e[1],c=Math.sqrt(i*i+n*n)*Math.sqrt(o*o+l*l);return Math.acos(Math.min(Math.max(c&&(i*o+n*l)/c,-1),1))},wt.zero=function(t){return t[0]=0,t[1]=0,t},wt.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},wt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},wt.equals=function(t,e){var i=t[0],n=t[1],o=e[0],l=e[1];return Math.abs(i-o)<=Bn.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-l)<=Bn.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))},wt.forEach=wt.sqrLen=wt.sqrDist=wt.dist=wt.div=wt.mul=wt.sub=wt.len=void 0;var Bn=function(t,e){if(t&&t.__esModule)return t;if(t===null||pl(t)!=="object"&&typeof t!="function")return{default:t};var i=Dc(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(fi);function Dc(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Dc=function(n){return n?i:e})(t)}function Rc(){var t=new Bn.ARRAY_TYPE(2);return Bn.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function Lc(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t}function kc(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t}function Oc(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t}function Bc(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1])}function Fc(t,e){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n}function Zs(t){return Math.hypot(t[0],t[1])}function Ws(t){var e=t[0],i=t[1];return e*e+i*i}wt.len=Zs,wt.sub=Lc,wt.mul=kc,wt.div=Oc,wt.dist=Bc,wt.sqrDist=Fc,wt.sqrLen=Ws;var fl=function(){var t=Rc();return function(e,i,n,o,l,c){var d,f;for(i||(i=2),n||(n=0),f=o?Math.min(o*i+n,e.length):e.length,d=n;d1)return 1;for(var i=t,n=0;n<8;n++){var o=this.sampleCurveX(i)-t;if(Math.abs(o)o?c=i:d=i,i=.5*(d-c)+c;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var Vc=Jr(xh),Xs=lo;function lo(t,e){this.x=t,this.y=e}lo.prototype={clone:function(){return new lo(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),o=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},lo.convert=function(t){return t instanceof lo?t:Array.isArray(t)?new lo(t[0],t[1]):t};var je=Jr(Xs);function Xo(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}function gl(t,e,i,n){const o=new Vc(t,e,i,n);return function(l){return o.solve(l)}}const $r=gl(.25,.1,.25,1);function Et(t,e,i){return Math.min(i,Math.max(e,t))}function Uc(t,e,i){return(i=Et((i-t)/(e-t),0,1))*i*(3-2*i)}function Jo(t,e,i){const n=i-e,o=((t-e)%n+n)%n+e;return o===e?i:o}function Js(t,e,i){if(!t.length)return i(null,[]);let n=t.length;const o=new Array(t.length);let l=null;t.forEach((c,d)=>{e(c,(f,_)=>{f&&(l=f),o[d]=_,--n==0&&i(l,o)})})}function jc(t){const e=[];for(const i in t)e.push(t[i]);return e}function Gi(t,...e){for(const i of e)for(const n in i)t[n]=i[n];return t}let wh=1;function yl(){return wh++}function Ko(){return function t(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function co(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Gc(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function xl(t,e){t.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function Ks(t,e){return t.indexOf(e,t.length-e.length)!==-1}function Qs(t,e,i){const n={};for(const o in t)n[o]=e.call(this,t[o],o,t);return n}function $i(t,e,i){const n={};for(const o in t)e.call(this,t[o],o,t)&&(n[o]=t[o]);return n}function ar(t){return Array.isArray(t)?t.map(ar):typeof t=="object"&&t?Qs(t,ar):t}const qi={};function vi(t){qi[t]||(typeof console<"u"&&console.warn(t),qi[t]=!0)}function Fn(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function Ep(t){let e=0;for(let i,n,o=0,l=t.length,c=l-1;o@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,o,l)=>{const c=o||l;return e[n]=!c||c.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let $c,ta,Nn,ia,Vn,ra,na=null;function vl(t){try{const e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}}function Un(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function bl(t,e,i,n){for(;e>1;t[o]>1;t[o]<=n?e=o+1:i=o}return e}function Th(t){return t>0?1/(1.001-t):1+t}function Eh(t){return t>0?1-1/(1.001-t):-t}function qc(){return $c==null&&($c=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),$c}const Zi={now:()=>ia!==void 0?ia:performance.now(),setNow(t){ia=t},restoreNow(){ia=void 0},frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const{width:i,height:n}=t;Vn||(Vn=document.createElement("canvas"));const o=Vn.getContext("2d",{willReadFrequently:!0});if(!o)throw new Error("failed to create canvas 2d context");return(i>Vn.width||n>Vn.height)&&(Vn.width=i,Vn.height=n),o.clearRect(-e,-e,i+2*e,n+2*e),o.drawImage(t,0,0,i,n),o.getImageData(-e,-e,i+2*e,n+2*e)},resolveURL:t=>(ta||(ta=document.createElement("a")),ta.href=t,ta.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Nn==null&&(Nn=window.matchMedia("(prefers-reduced-motion: reduce)")),Nn.matches)},hasCanvasFingerprintNoise(){if(ra!==void 0)return ra;if(!qc())return ra=!1,!1;const t=new OffscreenCanvas(85,1),e=t.getContext("2d",{willReadFrequently:!0});let i=0;for(let o=0;o0?`?${l}`:""}`}const Mh="mapbox-tiles";let Wc=500,Hc=50;const Ih=["language","worldview","jobid"];let Kr,Tl;function Ah(){try{return caches}catch{}}function oa(){const t=Ah();t&&!Kr&&(Kr=t.open(Mh))}let El=1/0;const Sl={supported:!1,testSupport:function(t){!Ml&&ts&&(Ch?Xc(t):sa=t)}};let sa,ts,Ml=!1,Ch=!1;const Ph=typeof self<"u"?self:{};function Xc(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,ts),t.isContextLost())return;Sl.supported=!0}catch{}t.deleteTexture(e),Ml=!0}Ph.document&&(ts=Ph.document.createElement("img"),ts.onload=function(){sa&&Xc(sa),sa=null,Ch=!0},ts.onerror=function(){Ml=!0,sa=null},ts.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const aa={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(aa);class Il extends Error{constructor(e,i,n){i===401&&Zt(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Yc=es()?()=>self.worker&&self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Qr=function(t,e){if(!(/^file:/.test(i=t.url)||/^file:/.test(Yc())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(n,o){const l=new AbortController,c=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:Yc(),referrerPolicy:n.referrerPolicy,signal:l.signal});let d=!1,f=!1;const _=(y=c.url).indexOf("sku=")>0&&Zt(y);var y;n.type==="json"&&c.headers.set("Accept","application/json");const v=(E,M,A)=>{if(f)return;if(E&&E.message!=="SecurityError"&&vi(E.toString()),M&&A)return b(M);const C=Date.now();fetch(c).then(D=>{if(D.ok){const V=_?D.clone():null;return b(D,V,C)}return o(new Il(D.statusText,D.status,n.url))}).catch(D=>{D.name!=="AbortError"&&o(new Error(`${D.message} ${n.url}`))})},b=(E,M,A)=>{(n.type==="arrayBuffer"?E.arrayBuffer():n.type==="json"?E.json():E.text()).then(C=>{f||(M&&A&&function(D,V,N){if(oa(),!Kr)return;const U=ea(V.headers.get("Cache-Control")||"");if(U["no-store"])return;const H={status:V.status,statusText:V.statusText,headers:new Headers};V.headers.forEach((ae,de)=>H.headers.set(de,ae)),U["max-age"]&&H.headers.set("Expires",new Date(N+1e3*U["max-age"]).toUTCString());const X=H.headers.get("Expires");if(!X||new Date(X).getTime()-N<42e4)return;let Q=Zc(D.url,{persistentParams:Ih});if(V.status===206){const ae=D.headers.get("Range");if(!ae)return;H.status=200,Q=Sh(Q,{range:ae})}(function(ae,de){if(Tl===void 0)try{new Response(new ReadableStream),Tl=!0}catch{Tl=!1}Tl?de(ae.body):ae.blob().then(de)})(V,ae=>{const de=new Response((ye=V.status)!==200&&ye!==404&&[101,103,204,205,304].includes(ye)?null:ae,H);var ye;oa(),Kr&&Kr.then(pe=>pe.put(Q,de)).catch(pe=>vi(pe.message))})}(c,M,A),d=!0,o(null,C,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(C=>{f||o(new Error(C.message))})};return _?function(E,M){if(oa(),!Kr)return M(null);Kr.then(A=>{let C=Zc(E.url,{persistentParams:Ih});const D=E.headers.get("Range");D&&(C=Sh(C,{range:D})),A.match(C).then(V=>{const N=function(U){if(!U)return!1;const H=new Date(U.headers.get("Expires")||0),X=ea(U.headers.get("Cache-Control")||"");return H>Date.now()&&!X["no-cache"]}(V);A.delete(C),N&&A.put(C,V.clone()),M(null,V,N)}).catch(M)}).catch(M)}(c,v):v(null,null),{cancel:()=>{f=!0,d||l.abort()}}}(t,e);if(es()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(n,o){const l=new XMLHttpRequest;l.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(l.responseType="arraybuffer");for(const c in n.headers)l.setRequestHeader(c,n.headers[c]);return n.type==="json"&&(l.responseType="text",l.setRequestHeader("Accept","application/json")),l.withCredentials=n.credentials==="include",l.onerror=()=>{o(new Error(l.statusText))},l.onload=()=>{if((l.status>=200&&l.status<300||l.status===0)&&l.response!==null){let c=l.response;if(n.type==="json")try{c=JSON.parse(l.response)}catch(d){return o(d)}o(null,c,l.getResponseHeader("Cache-Control"),l.getResponseHeader("Expires"))}else o(new Il(l.statusText,l.status,n.url))},l.send(n.body),{cancel:()=>l.abort()}}(t,e)},uo=function(t,e){return Qr(Gi(t,{type:"arrayBuffer"}),e)};function Sp(t){const e=document.createElement("a");return e.href=t,e.protocol===location.protocol&&e.host===location.host}const zh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let la,is;la=[],is=0;const ca=function(t,e){if(Sl.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),is>=bt.MAX_PARALLEL_IMAGE_REQUESTS){const l={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return la.push(l),l}is++;let i=!1;const n=()=>{if(!i)for(i=!0,is--;la.length&&is{n(),l?e(l):c&&(self.createImageBitmap?function(_,y){const v=new Blob([new Uint8Array(_)],{type:"image/png"});createImageBitmap(v).then(b=>{y(null,b)}).catch(b=>{y(new Error(`Could not load image because of ${b.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(c,(_,y)=>e(_,y,d,f)):function(_,y){const v=new Image;v.onload=()=>{y(null,v),URL.revokeObjectURL(v.src),v.onload=null,requestAnimationFrame(()=>{v.src=zh})},v.onerror=()=>y(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."));const b=new Blob([new Uint8Array(_)],{type:"image/png"});v.src=_.byteLength?URL.createObjectURL(b):zh}(c,(_,y)=>e(_,y,d,f)))});return{cancel:()=>{o.cancel(),n()}}},Jc="01",Kc="NO_ACCESS_TOKEN",Mp=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Dr(t){const e=t.match(Mp);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function ho(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}const Qc="mapbox.eventData";function Dh(t){if(!t)return null;const e=t.split(".");if(!e||e.length!==3)return null;try{return JSON.parse(decodeURIComponent(atob(e[1]).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class po{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const i=Dh(bt.ACCESS_TOKEN);let n="";return n=i&&i.u?btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,(o,l)=>String.fromCharCode(+("0x"+l)))):bt.ACCESS_TOKEN||"",e?`${Qc}.${e}:${n}`:`${Qc}:${n}`}fetchEventData(){const e=vl("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{const o=localStorage.getItem(i);o&&(this.eventData=JSON.parse(o));const l=localStorage.getItem(n);l&&(this.anonId=l)}catch{vi("Unable to read from LocalStorage")}}saveEventData(){const e=vl("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid"),o=this.anonId;if(e&&o)try{localStorage.setItem(n,o),Object.keys(this.eventData).length>=1&&localStorage.setItem(i,JSON.stringify(this.eventData))}catch{vi("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,i,n,o){if(!bt.EVENTS_URL)return;const l=Dr(bt.EVENTS_URL);l.params.push(`access_token=${o||bt.ACCESS_TOKEN||""}`);const c={event:this.type,created:new Date(e).toISOString()},d=i?Gi(c,i):c,f={url:ho(l),headers:{"Content-Type":"text/plain"},body:JSON.stringify([d])};this.pendingRequest=function(_,y){return Qr(Gi(_,{method:"POST"}),y)}(f,_=>{this.pendingRequest=null,n(_),this.saveEventData(),this.processRequests(o)})}queueRequest(e,i){this.queue.push(e),this.processRequests(i)}}const Rh=new class extends po{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){bt.EVENTS_URL&&bt.ACCESS_TOKEN&&Array.isArray(t)&&t.some(i=>Di(i)||Zt(i))&&this.queueRequest(Date.now(),e)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=Dh(bt.ACCESS_TOKEN),i=e?e.u:bt.ACCESS_TOKEN;let n=i!==this.eventData.tokenU;Gc(this.anonId)||(this.anonId=Ko(),n=!0);const o=this.queue.shift();if(this.eventData.lastSuccess){const l=new Date(this.eventData.lastSuccess),c=new Date(o),d=(o-this.eventData.lastSuccess)/864e5;n=n||d>=1||d<-1||l.getDate()!==c.getDate()}else n=!0;n?this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:pr,skuId:Jc,"enabled.telemetry":!1,userId:this.anonId},l=>{l||(this.eventData.lastSuccess=o,this.eventData.tokenU=i)},t):this.processRequests()}},eu=Rh.postTurnstileEvent.bind(Rh),rs=new class extends po{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,i,n){this.skuToken=e,this.errorCb=n,bt.EVENTS_URL&&(i||bt.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(Kc)))}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),Gc(this.anonId)||(this.anonId=Ko()),this.postEvent(i,{sdkIdentifier:"mapbox-gl-js",sdkVersion:pr,skuId:Jc,skuToken:this.skuToken,userId:this.anonId},n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},t))}remove(){this.errorCb=null}},Lh=rs.postMapLoadEvent.bind(rs),ua=new class extends po{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(t){let e=this.mapInstanceIdMap.get(t);return e||(e=Ko(),this.mapInstanceIdMap.set(t,e)),e}getEventId(t){const e=this.eventIdPerMapInstanceMap.get(t)||0;return this.eventIdPerMapInstanceMap.set(t,e+1),e}postStyleLoadEvent(t,e){const{map:i,style:n,importedStyles:o}=e;if(!bt.EVENTS_URL||!t&&!bt.ACCESS_TOKEN)return;const l=this.getMapInstanceId(i),c={mapInstanceId:l,eventId:this.getEventId(l),style:n};o.length&&(c.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:c},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:e,payload:i}=this.queue.shift();this.postEvent(e,i,()=>{},t)}},kh=ua.postStyleLoadEvent.bind(ua),Oh=new class extends po{constructor(){super("gljs.performance")}postPerformanceEvent(t,e){bt.EVENTS_URL&&(t||bt.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:e},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:e,performanceData:i}=this.queue.shift(),n=function(o){const l=performance.getEntriesByType("resource"),c=performance.getEntriesByType("mark"),d=function(E){const M={};if(E){for(const A in E)if(A!=="other")for(const C of E[A]){const D=`${A}ResolveRangeMin`,V=`${A}ResolveRangeMax`,N=`${A}RequestCount`,U=`${A}RequestCachedCount`;M[D]=Math.min(M[D]||1/0,C.startTime),M[V]=Math.max(M[V]||-1/0,C.responseEnd);const H=X=>{M[X]===void 0&&(M[X]=0),++M[X]};C.transferSize!==void 0&&C.transferSize===0&&H(U),H(N)}}return M}(function(E,M){const A={};if(E)for(const C of E){const D=M(C);A[D]===void 0&&(A[D]=[]),A[D].push(C)}return A}(l,Os)),f=window.devicePixelRatio,_=navigator.connection||navigator.mozConnection||navigator.webkitConnection,y=_?_.effectiveType:void 0,v={counters:[],metadata:[],attributes:[]},b=(E,M,A)=>{A!=null&&E.push({name:M,value:A.toString()})};for(const E in d)b(v.counters,E,d[E]);if(o.interactionRange[0]!==1/0&&o.interactionRange[1]!==-1/0&&(b(v.counters,"interactionRangeMin",o.interactionRange[0]),b(v.counters,"interactionRangeMax",o.interactionRange[1])),c)for(const E of Object.keys(Dn)){const M=Dn[E],A=c.find(C=>C.name===M);A&&b(v.counters,M,A.startTime)}return b(v.counters,"visibilityHidden",o.visibilityHidden),b(v.attributes,"style",function(E){if(E)for(const M of E){const A=M.name.split("?")[0];if(to(A)){const C=A.split("/").slice(-2);if(C.length===2)return`mapbox://styles/${C[0]}/${C[1]}`}}}(l)),b(v.attributes,"terrainEnabled",o.terrainEnabled?"true":"false"),b(v.attributes,"fogEnabled",o.fogEnabled?"true":"false"),b(v.attributes,"projection",o.projection),b(v.attributes,"zoom",o.zoom),b(v.metadata,"devicePixelRatio",f),b(v.metadata,"connectionEffectiveType",y),b(v.metadata,"navigatorUserAgent",navigator.userAgent),b(v.metadata,"screenWidth",window.screen.width),b(v.metadata,"screenHeight",window.screen.height),b(v.metadata,"windowWidth",window.innerWidth),b(v.metadata,"windowHeight",window.innerHeight),b(v.metadata,"mapWidth",o.width/f),b(v.metadata,"mapHeight",o.height/f),b(v.metadata,"webglRenderer",o.renderer),b(v.metadata,"webglVendor",o.vendor),b(v.metadata,"sdkVersion",pr),b(v.metadata,"sdkIdentifier","mapbox-gl-js"),v}(i);for(const o of n.metadata);for(const o of n.counters);for(const o of n.attributes);this.postEvent(e,n,()=>{},t)}},Ip=Oh.postPerformanceEvent.bind(Oh),ha=new class extends po{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,i,n){if(!bt.API_URL||!bt.SESSION_PATH)return;const o=Dr(bt.API_URL+bt.SESSION_PATH);o.params.push(`sku=${e||""}`),o.params.push(`access_token=${n||bt.ACCESS_TOKEN||""}`);const l={url:ho(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(c,d){return Qr(Gi(c,{method:"GET"}),d)}(l,c=>{this.pendingRequest=null,i(c),this.saveEventData(),this.processRequests(n)})}getSessionAPI(t,e,i,n){this.skuToken=e,this.errorCb=n,bt.SESSION_PATH&&bt.API_URL&&(i||bt.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(Kc)))}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||this.getSession(i,this.skuToken,n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},t)}remove(){this.errorCb=null}},tu=ha.getSessionAPI.bind(ha),da=new Set;var fo={exports:{}},ns={exports:function(t,e){var i,n,o,l,c,d,f,_;for(n=t.length-(i=3&t.length),o=e,c=3432918353,d=461845907,_=0;_>>16)*c&65535)<<16)&4294967295)<<15|f>>>17))*d+(((f>>>16)*d&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(l>>>16)&65535)<<16);switch(f=0,i){case 3:f^=(255&t.charCodeAt(_+2))<<16;case 2:f^=(255&t.charCodeAt(_+1))<<8;case 1:o^=f=(65535&(f=(f=(65535&(f^=255&t.charCodeAt(_)))*c+(((f>>>16)*c&65535)<<16)&4294967295)<<15|f>>>17))*d+(((f>>>16)*d&65535)<<16)&4294967295}return o^=t.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0}},Ap={exports:function(t,e){for(var i,n=t.length,o=e^n,l=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(l)|(255&t.charCodeAt(++l))<<8|(255&t.charCodeAt(++l))<<16|(255&t.charCodeAt(++l))<<24))+((1540483477*(i>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++l;switch(n){case 3:o^=(255&t.charCodeAt(l+2))<<16;case 2:o^=(255&t.charCodeAt(l+1))<<8;case 1:o=1540483477*(65535&(o^=255&t.charCodeAt(l)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0}},Bh=ns.exports,Cp=Ap.exports;fo.exports=Bh,fo.exports.murmur3=Bh,fo.exports.murmur2=Cp;var Al=Jr(fo.exports);class en{constructor(e,...i){Gi(this,i[0]||{}),this.type=e}}class pa extends en{constructor(e,i={}){super("error",Gi({error:e},i))}}function Cl(t,e,i){i[t]&&i[t].indexOf(e)!==-1||(i[t]=i[t]||[],i[t].push(e))}function iu(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);n!==-1&&i[t].splice(n,1)}}class mo{on(e,i){return this._listeners=this._listeners||{},Cl(e,i,this._listeners),this}off(e,i){return iu(e,i,this._listeners),iu(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Cl(e,i,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,i){const n=typeof e=="string"?new en(e,i):e,o=n.type;if(this.listens(o)){n.target=this;const l=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const f of l)f.call(this,n);const c=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const f of c)iu(o,f,this._oneTimeListeners),f.call(this,n);const d=this._eventedParent;d&&(Gi(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(n))}else n instanceof pa&&console.error(n.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}s.G=void 0;var Fh={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Pl(t){return(t=Math.round(t))<0?0:t>255?255:t}function ru(t){return Pl(t[t.length-1]==="%"?parseFloat(t)/100*255:parseInt(t))}function zl(t){return(e=t[t.length-1]==="%"?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function nu(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{s.G={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in Fh)return Fh[i].slice();if(i[0]==="#")return i.length===4?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:i.length===7&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),o=i.indexOf(")");if(n!==-1&&o+1===i.length){var l=i.substr(0,n),c=i.substr(n+1,o-(n+1)).split(","),d=1;switch(l){case"rgba":if(c.length!==4)return null;d=zl(c.pop());case"rgb":return c.length!==3?null:[ru(c[0]),ru(c[1]),ru(c[2]),d];case"hsla":if(c.length!==4)return null;d=zl(c.pop());case"hsl":if(c.length!==3)return null;var f=(parseFloat(c[0])%360+360)%360/360,_=zl(c[1]),y=zl(c[2]),v=y<=.5?y*(_+1):y+_-y*_,b=2*y-v;return[Pl(255*nu(b,v,f+1/3)),Pl(255*nu(b,v,f)),Pl(255*nu(b,v,f-1/3)),d];default:return null}}return null}}catch{}class Ut{constructor(e,i,n,o=1){this.r=e,this.g=i,this.b=n,this.a=o}static parse(e){if(!e)return;if(e instanceof Ut)return e;if(typeof e!="string")return;const i=s.G(e);return i?new Ut(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toString(){const[e,i,n,o]=this.a===0?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(n)},${o})`}toRenderColor(e){const{r:i,g:n,b:o,a:l}=this;return new Pp(e,i,n,o,l)}}class Pp{constructor(e,i,n,o,l){if(e){const c=e.image.height,d=c*c;i=l===0?0:i/l*(c-1),n=l===0?0:n/l*(c-1),o=l===0?0:o/l*(c-1);const f=Math.floor(i),_=Math.floor(n),y=Math.floor(o),v=Math.ceil(i),b=Math.ceil(n),E=Math.ceil(o),M=i-f,A=n-_,C=o-y,D=e.image.data,V=4*(f+_*d+y*c),N=4*(f+_*d+E*c),U=4*(f+b*d+y*c),H=4*(f+b*d+E*c),X=4*(v+_*d+y*c),Q=4*(v+_*d+E*c),ae=4*(v+b*d+y*c),de=4*(v+b*d+E*c);if(V<0||de>=D.length)throw new Error("out of range");this.r=rt(rt(rt(D[V],D[N],C),rt(D[U],D[H],C),A),rt(rt(D[X],D[Q],C),rt(D[ae],D[de],C),A),M)/255*l,this.g=rt(rt(rt(D[V+1],D[N+1],C),rt(D[U+1],D[H+1],C),A),rt(rt(D[X+1],D[Q+1],C),rt(D[ae+1],D[de+1],C),A),M)/255*l,this.b=rt(rt(rt(D[V+2],D[N+2],C),rt(D[U+2],D[H+2],C),A),rt(rt(D[X+2],D[Q+2],C),rt(D[ae+2],D[de+2],C),A),M)/255*l,this.a=l}else this.r=i,this.g=n,this.b=o,this.a=l}toArray(){const{r:e,g:i,b:n,a:o}=this;return o===0?[0,0,0,0]:[255*e/o,255*i/o,255*n/o,o]}toArray01(){const{r:e,g:i,b:n,a:o}=this;return o===0?[0,0,0,0]:[e/o,i/o,n/o,o]}toArray01Scaled(e){const{r:i,g:n,b:o,a:l}=this;return l===0?[0,0,0]:[i/l*e,n/l*e,o/l*e]}toArray01PremultipliedAlpha(){const{r:e,g:i,b:n,a:o}=this;return[e,i,n,o]}toArray01Linear(){const{r:e,g:i,b:n,a:o}=this;return o===0?[0,0,0,0]:[Math.pow(e/o,2.2),Math.pow(i/o,2.2),Math.pow(n/o,2.2),o]}}function rt(t,e,i){return t*(1-i)+e*i}function ou(t,e,i){return t.map((n,o)=>rt(n,e[o],i))}Ut.black=new Ut(0,0,0,1),Ut.white=new Ut(1,1,1,1),Ut.transparent=new Ut(0,0,0,0),Ut.red=new Ut(1,0,0,1),Ut.blue=new Ut(0,0,1,1);var fa=Object.freeze({__proto__:null,array:ou,color:function(t,e,i){return new Ut(rt(t.r,e.r,i),rt(t.g,e.g,i),rt(t.b,e.b,i),rt(t.a,e.a,i))},number:rt});function os(t,...e){for(const i of e)for(const n in i)t[n]=i[n];return t}class tn extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class su{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[n,o]of i)this.bindings[n]=o}concat(e){return new su(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)}}const mr={kind:"null"},We={kind:"number"},Lt={kind:"string"},Gt={kind:"boolean"},Rr={kind:"color"},ss={kind:"object"},Nt={kind:"value"},Dl={kind:"collator"},as={kind:"formatted"},_o={kind:"resolvedImage"};function Wi(t,e){return{kind:"array",itemType:t,N:e}}function mi(t){if(t.kind==="array"){const e=mi(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}const au=[mr,We,Lt,Gt,Rr,as,ss,Wi(Nt),_o];function ma(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ma(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(const i of au)if(!ma(i,e))return null}}return`Expected ${mi(t)} but found ${mi(e)} instead.`}function Lr(t,e){return e.some(i=>i.kind===t.kind)}function _a(t,e){return e.some(i=>i==="null"?t===null:i==="array"?Array.isArray(t):i==="object"?t&&!Array.isArray(t)&&typeof t=="object":i===typeof t)}class Rl{constructor(e,i,n){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Ll{constructor(e,i,n,o,l){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=n,this.fontStack=o,this.textColor=l}}class ir{constructor(e){this.sections=e}static fromString(e){return new ir([new Ll(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.namePrimary.length!==0)}static factory(e){return e instanceof ir?e:ir.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){e.push(["image",i.image.namePrimary]);continue}e.push(i.text);const n={};i.fontStack&&(n["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(n["font-scale"]=i.scale),i.textColor&&(n["text-color"]=["rgba"].concat(i.textColor.toRenderColor(null).toArray())),e.push(n)}return e}}class _r{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),this.available=e.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(e,i){return e?new _r({namePrimary:e,nameSecondary:i,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function Nh(t,e,i,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ls(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Ut||t instanceof Rl||t instanceof ir||t instanceof _r)return!0;if(Array.isArray(t)){for(const e of t)if(!ls(e))return!1;return!0}if(typeof t=="object"){for(const e in t)if(!ls(t[e]))return!1;return!0}return!1}function Ii(t){if(t===null)return mr;if(typeof t=="string")return Lt;if(typeof t=="boolean")return Gt;if(typeof t=="number")return We;if(t instanceof Ut)return Rr;if(t instanceof Rl)return Dl;if(t instanceof ir)return as;if(t instanceof _r)return _o;if(Array.isArray(t)){const e=t.length;let i;for(const n of t){const o=Ii(n);if(i){if(i===o)continue;i=Nt;break}i=o}return Wi(i||Nt,e)}return ss}function qr(t){const e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof Ut||t instanceof ir||t instanceof _r?t.toString():JSON.stringify(t)}class Zr{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ls(e[1]))return i.error("invalid value");const n=e[1];let o=Ii(n);const l=i.expectedType;return o.kind!=="array"||o.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(o=l),new Zr(o,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Ut?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof ir?this.value.serialize():this.value}}class Ci{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const lu={string:Lt,number:We,boolean:Gt,object:ss};class gr{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let n,o=1;const l=e[0];if(l==="array"){let d,f;if(e.length>2){const _=e[1];if(typeof _!="string"||!(_ in lu)||_==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);d=lu[_],o++}else d=Nt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);f=e[2],o++}n=Wi(d,f)}else n=lu[l];const c=[];for(;oe.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const n=e.itemType;if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){i.push(n.kind);const o=e.N;(typeof o=="number"||this.args.length>1)&&i.push(o)}}return i.concat(this.args.map(n=>n.serialize()))}}class go{constructor(e){this.type=as,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return i.error("First argument must be an image or text section.");const o=[];let l=!1;for(let c=1;c<=e.length-1;++c){const d=e[c];if(l&&typeof d=="object"&&!Array.isArray(d)){l=!1;let f=null;if(d["font-scale"]&&(f=i.parse(d["font-scale"],1,We),!f))return null;let _=null;if(d["text-font"]&&(_=i.parse(d["text-font"],1,Wi(Lt)),!_))return null;let y=null;if(d["text-color"]&&(y=i.parse(d["text-color"],1,Rr),!y))return null;const v=o[o.length-1];v.scale=f,v.font=_,v.textColor=y}else{const f=i.parse(e[c],1,Nt);if(!f)return null;const _=f.type.kind;if(_!=="string"&&_!=="value"&&_!=="null"&&_!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,o.push({content:f,scale:null,font:null,textColor:null})}}return new go(o)}evaluate(e){return new ir(this.sections.map(i=>{const n=i.content.evaluate(e);return Ii(n)===_o?new Ll("",n,null,null,null):new Ll(qr(n),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const n={};i.scale&&(n["font-scale"]=i.scale.serialize()),i.font&&(n["text-font"]=i.font.serialize()),i.textColor&&(n["text-color"]=i.textColor.serialize()),e.push(n)}return e}}class fn{constructor(e,i){this.type=_o,this.inputPrimary=e,this.inputSecondary=i}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");const n=i.parse(e[1],1,Lt);if(!n)return i.error("No image name provided.");if(e.length===2)return new fn(n);const o=i.parse(e[2],1,Lt);return o?new fn(n,o):i.error("Secondary image variant is not a string.")}evaluate(e){const i=_r.fromString(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(i.namePrimary)>-1,i.nameSecondary&&i.available&&e.availableImages&&(i.available=e.availableImages.indexOf(i.nameSecondary)>-1)),i}eachChild(e){e(this.inputPrimary),this.inputSecondary&&e(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function jn(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}const zp={"to-boolean":Gt,"to-color":Rr,"to-number":We,"to-string":Lt};class mn{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[0],o=[];let l=mr;if(n==="to-array"){if(!Array.isArray(e[1]))return null;const c=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);l=Wi(i.expectedType.itemType,c)}else{if(!(c>0&&ls(e[1][0])))return null;l=Wi(Ii(e[1][0]),c)}for(let d=0;d4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Nh(i[0],i[1],i[2],i[3]),!n))return new Ut(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Ci(n||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const n of this.args){if(i=n.evaluate(e),i===null)return 0;const o=Number(i);if(!isNaN(o))return o}throw new Ci(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?ir.fromString(qr(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?_r.fromString(qr(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):qr(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new go([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new fn(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const Dp=["Unknown","Point","LineString","Polygon"];class cu{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Dp[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||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:n,y:o}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*i-e[0])+this.featureDistanceData.bearing[1]*(o*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=Ut.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class cr{constructor(e,i,n,o,l){this.name=e,this.type=i,this._evaluate=n,this.args=o,this._overloadIndex=l}evaluate(e){if(!this._evaluate){const i=cr.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const n=e[0],o=cr.definitions[n];if(!o)return i.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(o)?o[0]:o.type,c=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,d=[];let f=null,_=-1;for(const[y,v]of c){if(Array.isArray(y)&&y.length!==e.length-1)continue;d.push(y),_++,f=new id(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const b=[];let E=!1;for(let M=1;Mb)).map(Rp).join(" | "),v=[];for(let b=1;bi;){if(n-i>600){const f=n-i+1,_=e-i+1,y=Math.log(f),v=.5*Math.exp(2*y/3),b=.5*Math.sqrt(y*v*(f-v)/f)*(_-f/2<0?-1:1);jt(t,e,Math.max(i,Math.floor(e-_*v/f+b)),Math.min(n,Math.floor(e+(f-_)*v/f+b)),o)}const l=t[e];let c=i,d=n;for(cs(t,i,e),o(t[n],l)>0&&cs(t,i,n);c0;)d--}o(t[i],l)===0?cs(t,i,d):(d++,cs(t,d,n)),d<=e&&(i=d+1),e<=d&&(n=d-1)}}function cs(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Vh(t,e){return te?1:0}function Lp(t){let e=0;for(let i,n,o=0,l=t.length,c=l-1;o=e[2]||t[1]<=e[1]||t[3]>=e[3])}function kl(t,e,i){const n=t[0]-e[0],o=t[1]-e[1],l=t[0]-i[0],c=t[1]-i[1];return n*c-l*o==0&&n*l<=0&&o*c<=0}function _n(t,e,i=!1){let n=!1;for(let d=0,f=e.length;d(o=t)[1]!=(c=M)[1]>o[1]&&o[0]<(c[0]-l[0])*(o[1]-l[1])/(c[1]-l[1])+l[0]&&(n=!n)}}var o,l,c;return n}function Uh(t,e,i,n){const o=n[0]-i[0],l=n[1]-i[1],c=(t[0]-i[0])*l-o*(t[1]-i[1]),d=(e[0]-i[0])*l-o*(e[1]-i[1]);return c>0&&d<0||c<0&&d>0}function xa(t,e,i,n){return(o=[n[0]-i[0],n[1]-i[1]])[0]*(l=[e[0]-t[0],e[1]-t[1]])[1]-o[1]*l[0]!=0&&!(!Uh(t,e,i,n)||!Uh(i,n,t,e));var o,l}const Hi=8192;function kp(t,e){const i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(i*o*Hi),Math.round(n*o*Hi)]}function jh(t,e){for(let i=0;ii[2]){const o=.5*n;let l=t[0]-i[0]>o?-n:i[0]-t[0]>o?n:0;l===0&&(l=t[0]-i[2]>o?-n:i[2]-t[0]>o?n:0),t[0]+=l}ya(e,t)}function Bl(t,e,i,n){const o=Math.pow(2,n.z)*Hi,l=[n.x*Hi,n.y*Hi],c=[];if(!t)return c;for(const d of t)for(const f of d){const _=[f.x+l[0],f.y+l[1]];hu(_,e,i,o),c.push(_)}return c}function $h(t,e,i,n){const o=Math.pow(2,n.z)*Hi,l=[n.x*Hi,n.y*Hi],c=[];if(!t)return c;for(const f of t){const _=[];for(const y of f){const v=[y.x+l[0],y.y+l[1]];ya(e,v),_.push(v)}c.push(_)}if(e[2]-e[0]<=o/2){(d=e)[0]=d[1]=1/0,d[2]=d[3]=-1/0;for(const f of c)for(const _ of f)hu(_,e,i,o)}var d;return c}class rn{constructor(e,i){this.type=Gt,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ls(e[1])){const n=e[1];if(n.type==="FeatureCollection")for(let o=0;oi)return du(l,c,(i-(n-d))/d)}return e[e.length-1]}pointToSegmentDistance(e,i,n){let[o,l]=i,c=yr(n[0]-o)*this.kx,d=(n[1]-l)*this.ky;if(c!==0||d!==0){const f=(yr(e[0]-o)*this.kx*c+(e[1]-l)*this.ky*d)/(c*c+d*d);f>1?(o=n[0],l=n[1]):f>0&&(o+=c/this.kx*f,l+=d/this.ky*f)}return c=yr(e[0]-o)*this.kx,d=(e[1]-l)*this.ky,Math.sqrt(c*c+d*d)}pointOnLine(e,i){let n=1/0,o=e[0][0],l=e[0][1],c=0,d=0;for(let f=0;f1?(_=e[f+1][0],y=e[f+1][1]):E>0&&(_+=v/this.kx*E,y+=b/this.ky*E)),v=yr(i[0]-_)*this.kx,b=(i[1]-y)*this.ky;const M=v*v+b*b;Ml.index||o.index===l.index&&o.t>l.t){const _=o;o=l,l=_}const c=[o.point],d=o.index+1,f=l.index;!Wh(n[d],c[0])&&d<=f&&c.push(n[d]);for(let _=d+1;_<=f;_++)c.push(n[_]);return Wh(n[f],l.point)||c.push(l.point),c}lineSliceAlong(e,i,n){let o=0;const l=[];for(let c=0;ce&&l.length===0&&l.push(du(d,f,(e-(o-_))/_)),o>=i)return l.push(du(d,f,(i-(o-_))/_)),l;o>e&&l.push(f)}return l}bufferPoint(e,i){const n=i/this.ky,o=i/this.kx;return[e[0]-o,e[1]-n,e[0]+o,e[1]+n]}bufferBBox(e,i){const n=i/this.ky,o=i/this.kx;return[e[0]-o,e[1]-n,e[2]+o,e[3]+n]}insideBBox(e,i){return yr(e[0]-i[0])>=0&&yr(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function Wh(t,e){return t[0]===e[0]&&t[1]===e[1]}function du(t,e,i){const n=yr(e[0]-t[0]);return[t[0]+n*i,t[1]+(e[1]-t[1])*i]}function yr(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}class $n{constructor(e=[],i=(n,o)=>no?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:n}=this,o=i[e];for(;e>0;){const l=e-1>>1,c=i[l];if(n(o,c)>=0)break;i[e]=c,e=l}i[e]=o}_down(e){const{data:i,compare:n}=this,o=this.length>>1,l=i[e];for(;e=0)break;i[e]=i[c],e=c}i[e]=l}}var Fe=8192;function Hh(t,e){return e.dist-t.dist}const Ta=100,pu=50;function Xh(t){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==t.length)return!1;for(let i=0;i=t[0]&&t[1]t[1])return[null,null];const i=Nl(t);if(e){if(i===2)return[t,null];const n=Math.floor(i/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}{if(i===1)return[t,null];const n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}}function xr(t,e){const i=[1/0,1/0,-1/0,-1/0];if(!gn(e,t.length))return i;for(let n=e[0];n<=e[1];++n)ya(i,t[n]);return i}function Vl(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;ie[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(o=t[1]-e[3]),t[3]=n)return n;if(Gn(o,l)){if(ed(t,e))return 0}else if(ed(e,t))return 0;let c=n;for(const d of t)for(let f=0,_=d.length,y=_-1;f<_;y=f++)for(const v of e)for(let b=0,E=v.length,M=E-1;b=l)continue;const y=_.range1;if(Nl(y)<=d){if(!gn(y,t.length))return NaN;if(e){const v=Vp(t,y,i,n);if((l=Math.min(l,v))===0)return l}else for(let v=y[0];v<=y[1];++v){const b=Np(t[v],i,n);if((l=Math.min(l,b))===0)return l}}else{const v=fu(y,e);if(v[0]!==null){const b=us(xr(t,v[0]),f,n);b=c)continue;const v=y.range1,b=y.range2;if(Nl(v)<=f&&Nl(b)<=_){if(!gn(v,t.length)||!gn(b,i.length))return NaN;if(e&&n?c=Math.min(c,Bp(t,v,i,b,o)):e||n?e&&!n?c=Math.min(c,mu(i,b,t,v,o)):!e&&n&&(c=Math.min(c,mu(t,v,i,b,o))):c=Math.min(c,Fp(t,v,i,b,o)),c===0)return c}else{const E=fu(v,e),M=fu(b,n);yo(d,c,o,t,i,E[0],M[0]),yo(d,c,o,t,i,E[0],M[1]),yo(d,c,o,t,i,E[1],M[0]),yo(d,c,o,t,i,E[1],M[1])}}return c}function _u(t,e,i,n,o=1/0){let l=o;const c=xr(t,[0,t.length-1]);for(const d of i)if(!(l!==1/0&&us(c,xr(d,[0,d.length-1]),n)>=l)&&(l=Math.min(l,Ea(t,e,d,!0,n,l)),l===0))return l;return l}function jl(t,e,i,n,o=1/0){let l=o;const c=xr(t,[0,t.length-1]);for(const d of i){if(l!==1/0&&us(c,Vl(d),n)>=l)continue;const f=br(t,e,d,n,l);if(isNaN(f))return f;if((l=Math.min(l,f))===0)return l}return l}function gu(t){return t==="Point"||t==="MultiPoint"||t==="LineString"||t==="MultiLineString"||t==="Polygon"||t==="MultiPolygon"}class xo{constructor(e,i){this.type=We,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(ls(e[1])){const n=e[1];if(n.type==="FeatureCollection"){for(let o=0;oi&&(t=i),t}class qn{constructor(e,i,n){this.type=e,this.key=i,this.scope=n}static parse(e,i){let n=i.expectedType;if(n==null&&(n=Nt),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const o=i.parse(e[1],1);if(!(o instanceof Zr))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){const l=i.parse(e[2],2);return l instanceof Zr?new qn(n,qr(o.value),qr(l.value)):i.error("Scope of 'config' expression must be a string literal.")}return new qn(n,qr(o.value))}evaluate(e){const i=[this.key,this.scope,e.scope].filter(Boolean).join(""),n=e.getConfig(i);if(!n)return null;const{type:o,value:l,values:c,minValue:d,maxValue:f,stepValue:_}=n,y=n.default.evaluate(e);let v=y;if(l){const b=e.scope;e.scope=(b||"").split("").slice(1).join(""),v=l.evaluate(e),e.scope=b}return o&&(v=Sa(o,v)),v===void 0||d===void 0&&f===void 0&&_===void 0||(typeof v=="number"?v=td(v,d,f,_):Array.isArray(v)&&(v=v.map(b=>typeof b=="number"?td(b,d,f,_):b))),l!==void 0&&v!==void 0&&c&&!c.includes(v)&&(v=y,o&&(v=Sa(o,v))),(o&&o!==this.type||v!==void 0&&Ii(v)!==this.type)&&(v=Sa(this.type.kind,v)),v}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.key),e}}function Ma(t){if(t instanceof cr&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof rn||t instanceof xo)return!1;let e=!0;return t.eachChild(i=>{e&&!Ma(i)&&(e=!1)}),e}function Gl(t){if(t instanceof cr&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(i=>{e&&!Gl(i)&&(e=!1)}),e}function Ia(t){if(t instanceof qn)return new Set([t.key]);let e=new Set;return t.eachChild(i=>{e=new Set([...e,...Ia(i)])}),e}function Aa(t,e){if(t instanceof cr&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(n=>{i&&!Aa(n,e)&&(i=!1)}),i}class Ca{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const n=e[1];return i.scope.has(n)?new Ca(n,i.scope.get(n)):i.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class $l{constructor(e,i=[],n,o=new su,l=[],c,d){this.registry=e,this.path=i,this.key=i.map(f=>`[${f}]`).join(""),this.scope=o,this.errors=l,this.expectedType=n,this._scope=c,this.options=d}parse(e,i,n,o,l={}){return i||n?this.concat(i,n,o)._parse(e,l):this._parse(e,l)}_parse(e,i){function n(o,l,c){return c==="assert"?new gr(l,[o]):c==="coerce"?new mn(l,[o]):o}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", []].');const o=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(o){let l=o.parse(e,this);if(!l)return null;if(this.expectedType){const c=this.expectedType,d=l.type;if(c.kind!=="string"&&c.kind!=="number"&&c.kind!=="boolean"&&c.kind!=="object"&&c.kind!=="array"||d.kind!=="value")if(c.kind!=="color"&&c.kind!=="formatted"&&c.kind!=="resolvedImage"||d.kind!=="value"&&d.kind!=="string"){if(this.checkSubtype(c,d))return null}else l=n(l,c,i.typeAnnotation||"coerce");else l=n(l,c,i.typeAnnotation||"assert")}if(!(l instanceof Zr)&&l.type.kind!=="resolvedImage"&&Pa(l)){const c=new cu(this._scope,this.options);try{l=new Zr(l.type,l.evaluate(c))}catch(d){return this.error(d.message),null}}return l}return mn.parse(["to-array",e],this)}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,i,n){const o=typeof e=="number"?this.path.concat(e):this.path,l=n?this.scope.concat(n):this.scope;return new $l(this.registry,o,i||null,l,this.errors,this._scope,this.options)}error(e,...i){const n=`${this.key}${i.map(o=>`[${o}]`).join("")}`;this.errors.push(new tn(n,e))}checkSubtype(e,i){const n=ma(e,i);return n&&this.error(n),n}}var id=$l;function Pa(t){if(t instanceof Ca)return Pa(t.boundExpression);if(t instanceof cr&&t.name==="error"||t instanceof ga||t instanceof rn||t instanceof xo||t instanceof qn)return!1;const e=t instanceof mn||t instanceof gr;let i=!0;return t.eachChild(n=>{i=e?i&&Pa(n):i&&n instanceof Zr}),!!i&&Ma(t)&&Aa(t,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function vo(t,e){const i=t.length-1;let n,o,l=0,c=i,d=0;for(;l<=c;)if(d=Math.floor((l+c)/2),n=t[d],o=t[d+1],n<=e){if(d===i||ee))throw new Ci("Input is not a number.");c=d-1}return 0}class ds{constructor(e,i,n){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[o,l]of n)this.labels.push(o),this.outputs.push(l)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const n=i.parse(e[1],1,We);if(!n)return null;const o=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let c=1;c=d)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',_);const v=i.parse(f,y,l);if(!v)return null;l=l||v.type,o.push([d,v])}return new ds(l,n,o)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return n[0].evaluate(e);const l=i.length;return o>=i[l-1]?n[l-1].evaluate(e):n[vo(i,o)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const rd=.95047,yu=1.08883,nd=4/29,Zn=6/29,od=3*Zn*Zn,Up=Zn*Zn*Zn,jp=Math.PI/180,Gp=180/Math.PI;function ql(t){return t>Up?Math.pow(t,1/3):t/od+nd}function xu(t){return t>Zn?t*t*t:od*(t-nd)}function vu(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function bu(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function sd(t){const e=bu(t.r),i=bu(t.g),n=bu(t.b),o=ql((.4124564*e+.3575761*i+.1804375*n)/rd),l=ql((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*l-16,a:500*(o-l),b:200*(l-ql((.0193339*e+.119192*i+.9503041*n)/yu)),alpha:t.a}}function ad(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*xu(e),i=rd*xu(i),n=yu*xu(n),new Ut(vu(3.2404542*i-1.5371385*e-.4985314*n),vu(-.969266*i+1.8760108*e+.041556*n),vu(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function $p(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const za={forward:sd,reverse:ad,interpolate:function(t,e,i){return{l:rt(t.l,e.l,i),a:rt(t.a,e.a,i),b:rt(t.b,e.b,i),alpha:rt(t.alpha,e.alpha,i)}}},Da={forward:function(t){const{l:e,a:i,b:n}=sd(t),o=Math.atan2(n,i)*Gp;return{h:o<0?o+360:o,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*jp,i=t.c;return ad({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:$p(t.h,e.h,i),c:rt(t.c,e.c,i),l:rt(t.l,e.l,i),alpha:rt(t.alpha,e.alpha,i)}}};var Ra=Object.freeze({__proto__:null,hcl:Da,lab:za});class wr{constructor(e,i,n,o,l){this.type=e,this.operator=i,this.interpolation=n,this.input=o,this.labels=[],this.outputs=[];for(const[c,d]of l)this.labels.push(c),this.outputs.push(d)}static interpolationFactor(e,i,n,o){let l=0;if(e.name==="exponential")l=wu(i,e.base,n,o);else if(e.name==="linear")l=wu(i,1,n,o);else if(e.name==="cubic-bezier"){const c=e.controlPoints;l=new Vc(c[0],c[1],c[2],c[3]).solve(wu(i,1,n,o))}return l}static parse(e,i){let[n,o,l,...c]=e;if(!Array.isArray(o)||o.length===0)return i.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const _=o[1];if(typeof _!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:_}}else{if(o[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const _=o.slice(1);if(_.length!==4||_.some(y=>typeof y!="number"||y<0||y>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:_}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,We),!l)return null;const d=[];let f=null;n==="interpolate-hcl"||n==="interpolate-lab"?f=Rr:i.expectedType&&i.expectedType.kind!=="value"&&(f=i.expectedType);for(let _=0;_=y)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',b);const M=i.parse(v,E,f);if(!M)return null;f=f||M.type,d.push([y,M])}return f.kind==="number"||f.kind==="color"||f.kind==="array"&&f.itemType.kind==="number"&&typeof f.N=="number"?new wr(f,n,o,l,d):i.error(`Type ${mi(f)} is not interpolatable.`)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return n[0].evaluate(e);const l=i.length;if(o>=i[l-1])return n[l-1].evaluate(e);const c=vo(i,o),d=wr.interpolationFactor(this.interpolation,o,i[c],i[c+1]),f=n[c].evaluate(e),_=n[c+1].evaluate(e);return this.operator==="interpolate"?fa[this.type.kind.toLowerCase()](f,_,d):this.operator==="interpolate-hcl"?Da.reverse(Da.interpolate(Da.forward(f),Da.forward(_),d)):za.reverse(za.interpolate(za.forward(f),za.forward(_),d))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const i=[this.operator,e,this.input.serialize()];for(let n=0;nma(o,d.type));return new bo(c?Nt:n,l)}evaluate(e){let i,n=null,o=0;for(const l of this.args){if(o++,n=l.evaluate(e),n&&n instanceof _r&&!n.available&&(i||(i=n),n=null,o===this.args.length))return i;if(n!==null)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Zl{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let l=1;l=n.length)throw new Ci(`Array index out of bounds: ${i} > ${n.length-1}.`);if(i!==Math.floor(i))throw new Ci(`Array index must be an integer, but found ${i} instead.`);return n[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Tu{constructor(e,i){this.type=Gt,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Nt),o=i.parse(e[2],2,Nt);return n&&o?Lr(n.type,[Gt,Lt,We,mr,Nt])?new Tu(n,o):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${mi(n.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(n==null)return!1;if(!_a(i,["boolean","string","number","null"]))throw new Ci(`Expected first argument to be of type boolean, string, number or null, but found ${mi(Ii(i))} instead.`);if(!_a(n,["string","array"]))throw new Ci(`Expected second argument to be of type array or string, but found ${mi(Ii(n))} instead.`);return n.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class La{constructor(e,i,n){this.type=We,this.needle=e,this.haystack=i,this.fromIndex=n}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Nt),o=i.parse(e[2],2,Nt);if(!n||!o)return null;if(!Lr(n.type,[Gt,Lt,We,mr,Nt]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${mi(n.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,We);return l?new La(n,o,l):null}return new La(n,o)}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!_a(i,["boolean","string","number","null"]))throw new Ci(`Expected first argument to be of type boolean, string, number or null, but found ${mi(Ii(i))} instead.`);if(!_a(n,["string","array"]))throw new Ci(`Expected second argument to be of type array or string, but found ${mi(Ii(n))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(e);return n.indexOf(i,o)}return n.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Hl{constructor(e,i,n,o,l,c){this.inputType=e,this.type=i,this.input=n,this.cases=o,this.outputs=l,this.otherwise=c}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let n,o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const l={},c=[];for(let _=2;_Number.MAX_SAFE_INTEGER)return b.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof M=="number"&&Math.floor(M)!==M)return b.error("Numeric branch labels must be integer values.");if(n){if(b.checkSubtype(n,Ii(M)))return null}else n=Ii(M);if(l[String(M)]!==void 0)return b.error("Branch labels must be unique.");l[String(M)]=c.length}const E=i.parse(v,_,o);if(!E)return null;o=o||E.type,c.push(E)}const d=i.parse(e[1],1,Nt);if(!d)return null;const f=i.parse(e[e.length-1],e.length-1,o);return f?d.type.kind!=="value"&&i.concat(1).checkSubtype(n,d.type)?null:new Hl(n,o,d,l,c,f):null}evaluate(e){const i=this.input.evaluate(e);return(Ii(i)===this.inputType&&this.outputs[this.cases[i]]||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()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),n=[],o={};for(const c of i){const d=o[this.cases[c]];d===void 0?(o[this.cases[c]]=n.length,n.push([this.cases[c],[c]])):n[d][1].push(c)}const l=c=>this.inputType.kind==="number"?Number(c):c;for(const[c,d]of n)e.push(d.length===1?l(d[0]):d.map(l)),e.push(this.outputs[c].serialize());return e.push(this.otherwise.serialize()),e}}class Xl{constructor(e,i,n){this.type=e,this.branches=i,this.otherwise=n}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);const o=[];for(let c=1;ci.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class ka{constructor(e,i,n,o){this.type=e,this.input=i,this.beginIndex=n,this.endIndex=o}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Nt),o=i.parse(e[2],2,We);if(!n||!o)return null;if(!Lr(n.type,[Wi(Nt),Lt,Nt]))return i.error(`Expected first argument to be of type array or string, but found ${mi(n.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,We);return l?new ka(n.type,n,o,l):null}return new ka(n.type,n,o)}evaluate(e){const i=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!_a(i,["string","array"]))throw new Ci(`Expected first argument to be of type array or string, but found ${mi(Ii(i))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(e);return i.slice(n,o)}return i.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Yl(t,e){return t==="=="||t==="!="?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 Jl(t,e,i,n){return n.compare(e,i)===0}function ps(t,e,i){const n=t!=="=="&&t!=="!=";return class J0{constructor(l,c,d){this.type=Gt,this.lhs=l,this.rhs=c,this.collator=d,this.hasUntypedArgument=l.type.kind==="value"||c.type.kind==="value"}static parse(l,c){if(l.length!==3&&l.length!==4)return c.error("Expected two or three arguments.");const d=l[0];let f=c.parse(l[1],1,Nt);if(!f)return null;if(!Yl(d,f.type))return c.concat(1).error(`"${d}" comparisons are not supported for type '${mi(f.type)}'.`);let _=c.parse(l[2],2,Nt);if(!_)return null;if(!Yl(d,_.type))return c.concat(2).error(`"${d}" comparisons are not supported for type '${mi(_.type)}'.`);if(f.type.kind!==_.type.kind&&f.type.kind!=="value"&&_.type.kind!=="value")return c.error(`Cannot compare types '${mi(f.type)}' and '${mi(_.type)}'.`);n&&(f.type.kind==="value"&&_.type.kind!=="value"?f=new gr(_.type,[f]):f.type.kind!=="value"&&_.type.kind==="value"&&(_=new gr(f.type,[_])));let y=null;if(l.length===4){if(f.type.kind!=="string"&&_.type.kind!=="string"&&f.type.kind!=="value"&&_.type.kind!=="value")return c.error("Cannot use collator to compare non-string types.");if(y=c.parse(l[3],3,Dl),!y)return null}return new J0(f,_,y)}evaluate(l){const c=this.lhs.evaluate(l),d=this.rhs.evaluate(l);if(n&&this.hasUntypedArgument){const f=Ii(c),_=Ii(d);if(f.kind!==_.kind||f.kind!=="string"&&f.kind!=="number")throw new Ci(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${f.kind}, ${_.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const f=Ii(c),_=Ii(d);if(f.kind!=="string"||_.kind!=="string")return e(l,c,d)}return this.collator?i(l,c,d,this.collator.evaluate(l)):e(l,c,d)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}serialize(){const l=[t];return this.eachChild(c=>{l.push(c.serialize())}),l}}}const qp=ps("==",function(t,e,i){return e===i},Jl),ld=ps("!=",function(t,e,i){return e!==i},function(t,e,i,n){return!Jl(0,e,i,n)}),Zp=ps("<",function(t,e,i){return e",function(t,e,i){return e>i},function(t,e,i,n){return n.compare(e,i)>0}),Hp=ps("<=",function(t,e,i){return e<=i},function(t,e,i,n){return n.compare(e,i)<=0}),Xp=ps(">=",function(t,e,i){return e>=i},function(t,e,i,n){return n.compare(e,i)>=0});class Eu{constructor(e,i,n,o,l,c){this.type=Lt,this.number=e,this.locale=i,this.currency=n,this.unit=o,this.minFractionDigits=l,this.maxFractionDigits=c}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const n=i.parse(e[1],1,We);if(!n)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return i.error("NumberFormat options argument must be an object.");let l=null;if(o.locale&&(l=i.parse(o.locale,1,Lt),!l))return null;let c=null;if(o.currency&&(c=i.parse(o.currency,1,Lt),!c))return null;let d=null;if(o.unit&&(d=i.parse(o.unit,1,Lt),!d))return null;let f=null;if(o["min-fraction-digits"]&&(f=i.parse(o["min-fraction-digits"],1,We),!f))return null;let _=null;return o["max-fraction-digits"]&&(_=i.parse(o["max-fraction-digits"],1,We),!_)?null:new Eu(n,l,c,d,f,_)}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}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Su{constructor(e){this.type=We,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=i.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${mi(n.type)} instead.`):new Su(n):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new Ci(`Expected value to be of type string or array, but found ${mi(Ii(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function cd(t){return function(){t=1831565813+(t|=0)|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const fs={"==":qp,"!=":ld,">":Wp,"<":Zp,">=":Xp,"<=":Hp,array:gr,at:Wl,boolean:gr,case:Xl,coalesce:bo,collator:ga,format:go,image:fn,in:Tu,"index-of":La,interpolate:wr,"interpolate-hcl":wr,"interpolate-lab":wr,length:Su,let:Zl,literal:Zr,match:Hl,number:gr,"number-format":Eu,object:gr,slice:ka,step:ds,string:gr,"to-boolean":mn,"to-color":mn,"to-number":mn,"to-string":mn,var:Ca,within:rn,distance:xo,config:qn};function ud(t,[e,i,n,o]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const l=o?o.evaluate(t):1,c=Nh(e,i,n,l);if(c)throw new Ci(c);return new Ut(e/255*l,i/255*l,n/255*l,l)}function Yp(t,[e,i,n,o]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const l=o?o.evaluate(t):1,c=function(_,y,v,b){return typeof _=="number"&&_>=0&&_<=360?typeof y=="number"&&y>=0&&y<=100&&typeof v=="number"&&v>=0&&v<=100?b===void 0||typeof b=="number"&&b>=0&&b<=1?null:`Invalid hsla value [${[_,y,v,b].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof b=="number"?[_,y,v,b]:[_,y,v]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof b=="number"?[_,y,v,b]:[_,y,v]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,n,l);if(c)throw new Ci(c);const d=`hsla(${e}, ${i}%, ${n}%, ${l})`,f=Ut.parse(d);if(!f)throw new Ci(`Failed to parse HSLA color: ${d}`);return f}function u(t,e){return t in e}function r(t,e){const i=e[t];return i===void 0?null:i}function a(t){return{type:t}}function h(t){return{result:"success",value:t}}function p(t){return{result:"error",value:t}}function m(t,e){return!!t&&!!t.parameters&&t.parameters.indexOf(e)>-1}function g(t){return t["property-type"]==="data-driven"}function x(t){return m(t.expression,"measure-light")}function w(t){return m(t.expression,"zoom")}function T(t){return!!t.expression&&t.expression.interpolated}function S(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function I(t){return t}function P(t,e){const i=e.type==="color",n=t.stops&&typeof t.stops[0][0]=="object",o=n||!(n||t.property!==void 0),l=t.type||(T(e)?"exponential":"interval");if(i&&((t=os({},t)).stops&&(t.stops=t.stops.map(_=>[_[0],Ut.parse(_[1])])),t.default=Ut.parse(t.default?t.default:e.default)),t.colorSpace&&t.colorSpace!=="rgb"&&!Ra[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let c,d,f;if(l==="exponential")c=O;else if(l==="interval")c=k;else if(l==="categorical"){c=L,d=Object.create(null);for(const _ of t.stops)d[_[0]]=_[1];f=typeof t.stops[0][0]}else{if(l!=="identity")throw new Error(`Unknown function type "${l}"`);c=B}if(n){const _={},y=[];for(let E=0;EE[0]),evaluate:({zoom:E},M)=>O({stops:v,base:t.base},e,E).evaluate(E,M)}}if(o){const _=l==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:_,interpolationFactor:wr.interpolationFactor.bind(void 0,_),zoomStops:t.stops.map(y=>y[0]),evaluate:({zoom:y})=>c(t,e,y,d,f)}}return{kind:"source",evaluate(_,y){const v=y&&y.properties?y.properties[t.property]:void 0;return v===void 0?z(t.default,e.default):c(t,e,v,d,f)}}}function z(t,e,i){return t!==void 0?t:e!==void 0?e:i!==void 0?i:void 0}function L(t,e,i,n,o){return z(typeof i===o?n[i]:void 0,t.default,e.default)}function k(t,e,i){if(jn(i)!=="number")return z(t.default,e.default);const n=t.stops.length;if(n===1||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const o=vo(t.stops.map(l=>l[0]),i);return t.stops[o][1]}function O(t,e,i){const n=t.base!==void 0?t.base:1;if(jn(i)!=="number")return z(t.default,e.default);const o=t.stops.length;if(o===1||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[o-1][0])return t.stops[o-1][1];const l=vo(t.stops.map(y=>y[0]),i),c=function(y,v,b,E){const M=E-b,A=y-b;return M===0?0:v===1?A/M:(Math.pow(v,A)-1)/(Math.pow(v,M)-1)}(i,n,t.stops[l][0],t.stops[l+1][0]),d=t.stops[l][1],f=t.stops[l+1][1];let _=fa[e.type]||I;if(t.colorSpace&&t.colorSpace!=="rgb"){const y=Ra[t.colorSpace];_=(v,b)=>y.reverse(y.interpolate(y.forward(v),y.forward(b),c))}return typeof d.evaluate=="function"?{evaluate(...y){const v=d.evaluate.apply(void 0,y),b=f.evaluate.apply(void 0,y);if(v!==void 0&&b!==void 0)return _(v,b,c)}}:_(d,f,c)}function B(t,e,i){return e.type==="color"?i=Ut.parse(i):e.type==="formatted"?i=ir.fromString(i.toString()):e.type==="resolvedImage"?i=_r.fromString(i.toString()):jn(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),z(i,t.default,e.default)}cr.register(fs,{error:[{kind:"error"},[Lt],(t,[e])=>{throw new Ci(e.evaluate(t))}],typeof:[Lt,[Nt],(t,[e])=>mi(Ii(e.evaluate(t)))],"to-rgba":[Wi(We,4),[Rr],(t,[e])=>e.evaluate(t).toRenderColor(null).toArray()],rgb:[Rr,[We,We,We],ud],rgba:[Rr,[We,We,We,We],ud],hsl:[Rr,[We,We,We],Yp],hsla:[Rr,[We,We,We,We],Yp],has:{type:Gt,overloads:[[[Lt],(t,[e])=>u(e.evaluate(t),t.properties())],[[Lt,ss],(t,[e,i])=>u(e.evaluate(t),i.evaluate(t))]]},get:{type:Nt,overloads:[[[Lt],(t,[e])=>r(e.evaluate(t),t.properties())],[[Lt,ss],(t,[e,i])=>r(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Nt,[Lt],(t,[e])=>r(e.evaluate(t),t.featureState||{})],properties:[ss,[],t=>t.properties()],"geometry-type":[Lt,[],t=>t.geometryType()],id:[Nt,[],t=>t.id()],zoom:[We,[],t=>t.globals.zoom],pitch:[We,[],t=>t.globals.pitch||0],"distance-from-center":[We,[],t=>t.distanceFromCenter()],"measure-light":[We,[Lt],(t,[e])=>t.measureLight(e.evaluate(t))],"heatmap-density":[We,[],t=>t.globals.heatmapDensity||0],"line-progress":[We,[],t=>t.globals.lineProgress||0],"raster-value":[We,[],t=>t.globals.rasterValue||0],"raster-particle-speed":[We,[],t=>t.globals.rasterParticleSpeed||0],"sky-radial-progress":[We,[],t=>t.globals.skyRadialProgress||0],accumulated:[Nt,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[We,a(We),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[We,a(We),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:We,overloads:[[[We,We],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[We],(t,[e])=>-e.evaluate(t)]]},"/":[We,[We,We],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[We,[We,We],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[We,[],()=>Math.LN2],pi:[We,[],()=>Math.PI],e:[We,[],()=>Math.E],"^":[We,[We,We],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[We,[We],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[We,[We],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[We,[We],(t,[e])=>Math.log(e.evaluate(t))],log2:[We,[We],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[We,[We],(t,[e])=>Math.sin(e.evaluate(t))],cos:[We,[We],(t,[e])=>Math.cos(e.evaluate(t))],tan:[We,[We],(t,[e])=>Math.tan(e.evaluate(t))],asin:[We,[We],(t,[e])=>Math.asin(e.evaluate(t))],acos:[We,[We],(t,[e])=>Math.acos(e.evaluate(t))],atan:[We,[We],(t,[e])=>Math.atan(e.evaluate(t))],min:[We,a(We),(t,e)=>Math.min(...e.map(i=>i.evaluate(t)))],max:[We,a(We),(t,e)=>Math.max(...e.map(i=>i.evaluate(t)))],abs:[We,[We],(t,[e])=>Math.abs(e.evaluate(t))],round:[We,[We],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[We,[We],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[We,[We],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Gt,[Lt,Nt],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[Gt,[Nt],(t,[e])=>t.id()===e.value],"filter-type-==":[Gt,[Lt],(t,[e])=>t.geometryType()===e.value],"filter-<":[Gt,[Lt,Nt],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n{const i=t.id(),n=e.value;return typeof i==typeof n&&i":[Gt,[Lt,Nt],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n>o}],"filter-id->":[Gt,[Nt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[Gt,[Lt,Nt],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[Gt,[Nt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[Gt,[Lt,Nt],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[Gt,[Nt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[Gt,[Nt],(t,[e])=>e.value in t.properties()],"filter-has-id":[Gt,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[Gt,[Wi(Lt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Gt,[Wi(Nt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Gt,[Lt,Wi(Nt)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Gt,[Lt,Wi(Nt)],(t,[e,i])=>function(n,o,l,c){for(;l<=c;){const d=l+c>>1;if(o[d]===n)return!0;o[d]>n?c=d-1:l=d+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Gt,overloads:[[[Gt,Gt],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[a(Gt),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:Gt,overloads:[[[Gt,Gt],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[a(Gt),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[Gt,[Gt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Gt,[Lt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[Lt,[Lt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Lt,[Lt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Lt,a(Nt),(t,e)=>e.map(i=>qr(i.evaluate(t))).join("")],"resolved-locale":[Lt,[Dl],(t,[e])=>e.evaluate(t).resolvedLocale()],random:[We,[We,We,Nt],(t,e)=>{const[i,n,o]=e.map(c=>c.evaluate(t));if(i>n||i===n)return i;let l;if(typeof o=="string")l=function(c){let d=0;if(c.length===0)return d;for(let f=0;fJSON.stringify(y)).join(", ")}, but found ${JSON.stringify(_)} instead.`);return _}catch(_){return this._warningHistory[_.message]||(this._warningHistory[_.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${_.message}`)),this._defaultValue}}}function $(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in fs}function j(t,e,i,n){const o=new id(fs,[],e?function(c){const d={color:Rr,string:Lt,number:We,enum:Lt,boolean:Gt,formatted:as,resolvedImage:_o};return c.type==="array"?Wi(d[c.value]||Nt,c.length):d[c.type]}(e):void 0,void 0,void 0,i,n),l=o.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return l?h(new G(l,e,i,n)):p(o.errors)}class J{constructor(e,i,n){this.kind=e,this._styleExpression=i,this.isLightConstant=n,this.isStateDependent=e!=="constant"&&!Gl(i.expression),this.configDependencies=Ia(i.expression)}evaluateWithoutErrorHandling(e,i,n,o,l,c){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,o,l,c)}evaluate(e,i,n,o,l,c){return this._styleExpression.evaluate(e,i,n,o,l,c)}}class Z{constructor(e,i,n,o,l){this.kind=e,this.zoomStops=n,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Gl(i.expression),this.isLightConstant=l,this.configDependencies=Ia(i.expression),this.interpolationType=o}evaluateWithoutErrorHandling(e,i,n,o,l,c){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,o,l,c)}evaluate(e,i,n,o,l,c){return this._styleExpression.evaluate(e,i,n,o,l,c)}interpolationFactor(e,i,n){return this.interpolationType?wr.interpolationFactor(this.interpolationType,e,i,n):0}}function W(t,e,i,n){if((t=j(t,e,i,n)).result==="error")return t;const o=t.value.expression,l=Ma(o);if(!l&&!g(e))return p([new tn("","data expressions not supported")]);const c=Aa(o,["zoom","pitch","distance-from-center"]);if(!c&&!w(e))return p([new tn("","zoom expressions not supported")]);const d=Aa(o,["measure-light"]);if(!d&&!x(e))return p([new tn("","measure-light expression not supported")]);const f=e.expression&&e.expression.relaxZoomRestriction,_=ie(o);return _||c||f?_ instanceof tn?p([_]):_ instanceof wr&&!T(e)?p([new tn("",'"interpolate" expressions cannot be used with this property')]):h(_?new Z(l?"camera":"composite",t.value,_.labels,_ instanceof wr?_.interpolation:void 0,d):new J(l?"constant":"source",t.value,d)):p([new tn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ee{constructor(e,i){this._parameters=e,this._specification=i,os(this,P(this._parameters,this._specification))}static deserialize(e){return new ee(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ie(t){let e=null;if(t instanceof Zl)e=ie(t.result);else if(t instanceof bo){for(const i of t.args)if(e=ie(i),e)break}else(t instanceof ds||t instanceof wr)&&t.input instanceof cr&&t.input.name==="zoom"&&(e=t);return e instanceof tn||t.eachChild(i=>{const n=ie(i);n instanceof tn?e=n:e&&n&&e!==n&&(e=new tn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var ue=Y,re=3;function Y(t,e,i){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],this.d=(e=o[1])+2*(i=o[2]);for(var l=0;l=y[E+0]&&n>=y[E+1])?(c[b]=!0,l.push(_[b])):c[b]=!1}}},Y.prototype._forEachCell=function(t,e,i,n,o,l,c,d){for(var f=this._convertToCellCoord(t),_=this._convertToCellCoord(e),y=this._convertToCellCoord(i),v=this._convertToCellCoord(n),b=f;b<=y;b++)for(var E=_;E<=v;E++){var M=this.d*E+b;if((!d||d(this._convertFromCellCoord(b),this._convertFromCellCoord(E),this._convertFromCellCoord(b+1),this._convertFromCellCoord(E+1)))&&o.call(this,t,e,i,n,M,l,c,d))return}},Y.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Y.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Y.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=re+this.cells.length+1+1,i=0,n=0;n=0||(o[l]=he(t[l],e)));t instanceof Error&&(o.message=t.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(o.$name=n),o}throw new Error("can't serialize object of type "+typeof t)}function ve(t){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Ce(t)||Se(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(ve);if(typeof t=="object"){const e=t.$name||"Object";if(e==="Map"){const o=new Map;for(const l of Object.keys(t))l!=="$name"&&o.set(l,ve(t[l]));return o}if(e==="Set"){const o=new Set;for(const l of Object.keys(t))l!=="$name"&&o.add(ve(t[l]));return o}const{klass:i}=fe[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const n=Object.create(i.prototype);for(const o of Object.keys(t))o!=="$name"&&(n[o]=ve(t[o]));return n}throw new Error("can't deserialize object of type "+typeof t)}const ne={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519,"CJK Unified Ideographs Extension B":t=>t>=131072&&t<=173791};function Me(t){for(const e of t)if(Ge(e.charCodeAt(0)))return!0;return!1}function Ae(t){for(const e of t)if(!Ue(e.charCodeAt(0)))return!1;return!0}function Ue(t){return!(ne.Arabic(t)||ne["Arabic Supplement"](t)||ne["Arabic Extended-A"](t)||ne["Arabic Presentation Forms-A"](t)||ne["Arabic Presentation Forms-B"](t))}function Ge(t){return!(t!==746&&t!==747&&(t<4352||!(ne["Bopomofo Extended"](t)||ne.Bopomofo(t)||ne["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||ne["CJK Compatibility Ideographs"](t)||ne["CJK Compatibility"](t)||ne["CJK Radicals Supplement"](t)||ne["CJK Strokes"](t)||!(!ne["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||t===12336)||ne["CJK Unified Ideographs Extension A"](t)||ne["CJK Unified Ideographs"](t)||ne["Enclosed CJK Letters and Months"](t)||ne["Hangul Compatibility Jamo"](t)||ne["Hangul Jamo Extended-A"](t)||ne["Hangul Jamo Extended-B"](t)||ne["Hangul Jamo"](t)||ne["Hangul Syllables"](t)||ne.Hiragana(t)||ne["Ideographic Description Characters"](t)||ne.Kanbun(t)||ne["Kangxi Radicals"](t)||ne["Katakana Phonetic Extensions"](t)||ne.Katakana(t)&&t!==12540||!(!ne["Halfwidth and Fullwidth Forms"](t)||t===65288||t===65289||t===65293||t>=65306&&t<=65310||t===65339||t===65341||t===65343||t>=65371&&t<=65503||t===65507||t>=65512&&t<=65519)||!(!ne["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||ne["Unified Canadian Aboriginal Syllabics"](t)||ne["Unified Canadian Aboriginal Syllabics Extended"](t)||ne["Vertical Forms"](t)||ne["Yijing Hexagram Symbols"](t)||ne["Yi Syllables"](t)||ne["Yi Radicals"](t))))}function He(t){return!(Ge(t)||function(e){return!!(ne["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ne["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||ne["Letterlike Symbols"](e)||ne["Number Forms"](e)||ne["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||ne["Control Pictures"](e)&&e!==9251||ne["Optical Character Recognition"](e)||ne["Enclosed Alphanumerics"](e)||ne["Geometric Shapes"](e)||ne["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ne["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ne["CJK Symbols and Punctuation"](e)||ne.Katakana(e)||ne["Private Use Area"](e)||ne["CJK Compatibility Forms"](e)||ne["Small Form Variants"](e)||ne["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(t))}function $e(t){return t>=1424&&t<=2303||ne["Arabic Presentation Forms-A"](t)||ne["Arabic Presentation Forms-B"](t)}function it(t,e){return!(!e&&$e(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||ne.Khmer(t))}function _t(t){for(const e of t)if($e(e.charCodeAt(0)))return!0;return!1}const nt="deferred",xt="loading",Ct="loaded";let ii=null,Jt="unavailable",Pt=null;const Xt=function(t){t&&typeof t=="string"&&t.indexOf("NetworkError")>-1&&(Jt="error"),ii&&ii(t)};function Tt(){St.fire(new en("pluginStateChange",{pluginStatus:Jt,pluginURL:Pt}))}const St=new mo,gt=function(){return Jt},Ot=function(){if(Jt!==nt||!Pt)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Jt=xt,Tt(),Pt&&uo({url:Pt},t=>{t?Xt(t):(Jt=Ct,Tt())})},Mt={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Jt===Ct||Mt.applyArabicShaping!=null,isLoading:()=>Jt===xt,setState(t){Jt=t.pluginStatus,Pt=t.pluginURL},isParsed:()=>Mt.applyArabicShaping!=null&&Mt.processBidirectionalText!=null&&Mt.processStyledBidirectionalText!=null,getPluginURL:()=>Pt};class at{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,n){for(const o of i)if(!it(o.charCodeAt(0),n))return!1;return!0}(e,Mt.isLoaded())}}class bi{constructor(e,i,n,o){this.property=e,this.value=i,this.expression=function(l,c,d,f){if(S(l))return new ee(l,c);if($(l)||Array.isArray(l)&&l.length>0){const _=W(l,c,d,f);if(_.result==="error")throw new Error(_.value.map(y=>`${y.key}: ${y.message}`).join(", "));return _.value}{let _=l;return typeof l=="string"&&c.type==="color"&&(_=Ut.parse(l)),{kind:"constant",configDependencies:new Set,evaluate:()=>_}}}(i===void 0?e.specification.default:i,e.specification,n,o)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,n){return this.property.possiblyEvaluate(this,e,i,n)}}class wi{constructor(e,i,n){this.property=e,this.value=new bi(e,void 0,i,n)}transitioned(e,i){return new Yi(this.property,this.value,i,Gi({},e.transition,this.transition),e.now)}untransitioned(){return new Yi(this.property,this.value,null,{},0)}}class Xi{constructor(e,i,n){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=n,this.configDependencies=new Set}getValue(e){return ar(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new wi(this._values[e].property,this._scope,this._options)),this._values[e].value=new bi(this._values[e].property,i===null?void 0:ar(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);const n=this._properties.properties;if(e)for(const o in e){const l=e[o];if(Ks(o,"-transition")){const c=o.slice(0,-11);n[c]&&this.setTransition(c,l)}else n.hasOwnProperty(o)&&this.setValue(o,l)}}getTransition(e){return ar(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new wi(this._values[e].property)),this._values[e].transition=ar(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n);const o=this.getTransition(i);o!==void 0&&(e[`${i}-transition`]=o)}return e}transitioned(e,i){const n=new Fi(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].transitioned(e,i._values[o]);return n}untransitioned(){const e=new Fi(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class Yi{constructor(e,i,n,o,l){const c=o.delay||0,d=o.duration||0;l=l||0,this.property=e,this.value=i,this.begin=l+c,this.end=this.begin+d,e.specification.transition&&(o.delay||o.duration)&&(this.prior=n)}possiblyEvaluate(e,i,n){const o=e.now||0,l=this.value.possiblyEvaluate(e,i,n),c=this.prior;if(c){if(o>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(o":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-line-alignment":{"type":"enum","values":{"inside":1,"outside":1,"center":1},"default":"center","property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function yn(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Wr(t){if(Array.isArray(t))return t.map(Wr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Wr(t[i]);return e}return yn(t)}function xn(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!xn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function vn(t,e="fill"){if(t==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};xn(t)||(t=ms(t));const i=t;let n=!0;try{n=function(_){if(!Wn(_))return _;let y=Wr(_);return Ql(y),y=Kl(y),y}(i)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. -This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md -and paste the contents of this message in the report. -Thank you! -Filter Expression: -${JSON.stringify(i,null,2)} - `)}const o=me[`filter_${e}`],l=j(n,o);let c=null;if(l.result==="error")throw new Error(l.value.map(_=>`${_.key}: ${_.message}`).join(", "));c=(_,y,v)=>l.value.evaluate(_,y,{},v);let d=null,f=null;if(n!==i){const _=j(i,o);if(_.result==="error")throw new Error(_.value.map(y=>`${y.key}: ${y.message}`).join(", "));d=(y,v,b,E,M)=>_.value.evaluate(y,v,{},b,void 0,void 0,E,M),f=!Ma(_.value.expression)}return{filter:c,dynamicFilter:d||void 0,needGeometry:ec(n),needFeature:!!f}}function Kl(t){if(!Array.isArray(t))return t;const e=function(i){if(Mu.has(i[0])){for(let n=1;nKl(i))}function Ql(t){let e=!1;const i=[];if(t[0]==="case"){for(let n=1;n",">=","<","<=","to-boolean"]);function wo(t,e){return te?1:0}function ec(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e"||e==="<="||e===">="?Jp(t[1],t[2],e):e==="any"?(i=t.slice(1),["any"].concat(i.map(ms))):e==="all"?["all"].concat(t.slice(1).map(ms)):e==="none"?["all"].concat(t.slice(1).map(ms).map(hd)):e==="in"?Nm(t[1],t.slice(2)):e==="!in"?hd(Nm(t[1],t.slice(2))):e==="has"?Vm(t[1]):e!=="!has"||hd(Vm(t[1]));var i}function Jp(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Nm(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",t,["literal",e.sort(wo)]]:["filter-in-small",t,["literal",e]]}}function Vm(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function hd(t){return["!",t]}const dd="";function Um(t,e){return e?`${t}${dd}${e}`:t}const jm="-transition",ex=new Set(["fill","line","background","hillshade","raster"]);class Tr extends mo{constructor(e,i,n,o,l){if(super(),this.id=e.id,this.fqid=Um(this.id,n),this.type=e.type,this.scope=n,this.lut=o,this.options=l,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new Ji(i.layout,this.scope,l),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint)){this._transitionablePaint=new Xi(i.paint,this.scope,l);for(const c in e.paint)this.setPaintProperty(c,e.paint[c]);for(const c in e.layout)this.setLayoutProperty(c,e.layout[c]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ni(i.paint)}}onAdd(e){}onRemove(e){}isDraped(e){return ex.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const n=this._unevaluatedLayout;n._properties.properties[e]&&(n.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...n.configDependencies]),e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0})}getPaintProperty(e){return Ks(e,jm)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const n=this._transitionablePaint,o=n._properties.properties;if(Ks(e,jm)){const v=e.slice(0,-11);return o[v]&&n.setTransition(v,i||void 0),!1}if(!o[e])return!1;const l=n._values[e],c=l.value.isDataDriven(),d=l.value;n.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...n.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const f=n._values[e].value,_=f.isDataDriven(),y=Ks(e,"pattern")||e==="line-dasharray";return _||c||y||this._handleOverridablePaintPropertyUpdate(e,d,f)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,n){return null}_handleOverridablePaintPropertyUpdate(e,i,n){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return $i({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Li&&g(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=vn(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,n,o,l,c,d,f,_){}queryIntersectsMatchingFeature(e,i,n,o){}}const tx={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Iu{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class li{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_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);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function $t(t,e=1){let i=0,n=0;return{members:t.map(o=>{const l=tx[o.type].BYTES_PER_ELEMENT,c=i=Gm(i,Math.max(e,l)),d=o.components||1;return n=Math.max(n,l),i+=l*d,{name:o.name,type:o.type,components:d,offset:c}}),size:Gm(i,Math.max(n,e)),alignment:e}}function Gm(t,e){return Math.ceil(t/e)*e}class bn extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const o=2*e;return this.int16[o+0]=i,this.int16[o+1]=n,e}}bn.prototype.bytesPerElement=4,se(bn,"StructArrayLayout2i4");class pd extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,n)}emplace(e,i,n,o){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=n,this.int16[l+2]=o,e}}pd.prototype.bytesPerElement=6,se(pd,"StructArrayLayout3i6");class To extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=4*e;return this.int16[c+0]=i,this.int16[c+1]=n,this.int16[c+2]=o,this.int16[c+3]=l,e}}To.prototype.bytesPerElement=8,se(To,"StructArrayLayout4i8");class Kp extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=5*e;return this.int16[d+0]=i,this.int16[d+1]=n,this.int16[d+2]=o,this.int16[d+3]=l,this.int16[d+4]=c,e}}Kp.prototype.bytesPerElement=10,se(Kp,"StructArrayLayout5i10");class Qp extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,f){const _=6*e,y=12*e,v=3*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.uint8[y+4]=o,this.uint8[y+5]=l,this.uint8[y+6]=c,this.uint8[y+7]=d,this.float32[v+2]=f,e}}Qp.prototype.bytesPerElement=12,se(Qp,"StructArrayLayout2i4ub1f12");class _s extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=4*e;return this.float32[c+0]=i,this.float32[c+1]=n,this.float32[c+2]=o,this.float32[c+3]=l,e}}_s.prototype.bytesPerElement=16,se(_s,"StructArrayLayout4f16");class gs extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,n)}emplace(e,i,n,o){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=n,this.float32[l+2]=o,e}}gs.prototype.bytesPerElement=12,se(gs,"StructArrayLayout3f12");class ys extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=6*e,f=3*e;return this.uint16[d+0]=i,this.uint16[d+1]=n,this.uint16[d+2]=o,this.uint16[d+3]=l,this.float32[f+2]=c,e}}ys.prototype.bytesPerElement=12,se(ys,"StructArrayLayout4ui1f12");class fd extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=4*e;return this.uint16[c+0]=i,this.uint16[c+1]=n,this.uint16[c+2]=o,this.uint16[c+3]=l,e}}fd.prototype.bytesPerElement=8,se(fd,"StructArrayLayout4ui8");class md extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,n,o,l,c)}emplace(e,i,n,o,l,c,d){const f=6*e;return this.int16[f+0]=i,this.int16[f+1]=n,this.int16[f+2]=o,this.int16[f+3]=l,this.int16[f+4]=c,this.int16[f+5]=d,e}}md.prototype.bytesPerElement=12,se(md,"StructArrayLayout6i12");class ef extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,f,_,y,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,n,o,l,c,d,f,_,y,v,b)}emplace(e,i,n,o,l,c,d,f,_,y,v,b,E){const M=12*e;return this.int16[M+0]=i,this.int16[M+1]=n,this.int16[M+2]=o,this.int16[M+3]=l,this.uint16[M+4]=c,this.uint16[M+5]=d,this.uint16[M+6]=f,this.uint16[M+7]=_,this.int16[M+8]=y,this.int16[M+9]=v,this.int16[M+10]=b,this.int16[M+11]=E,e}}ef.prototype.bytesPerElement=24,se(ef,"StructArrayLayout4i4ui4i24");class tf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,n,o,l,c)}emplace(e,i,n,o,l,c,d){const f=10*e,_=5*e;return this.int16[f+0]=i,this.int16[f+1]=n,this.int16[f+2]=o,this.float32[_+2]=l,this.float32[_+3]=c,this.float32[_+4]=d,e}}tf.prototype.bytesPerElement=20,se(tf,"StructArrayLayout3i3f20");class rf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}rf.prototype.bytesPerElement=4,se(rf,"StructArrayLayout1ul4");class xs extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const o=2*e;return this.uint16[o+0]=i,this.uint16[o+1]=n,e}}xs.prototype.bytesPerElement=4,se(xs,"StructArrayLayout2ui4");class nf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,f,_,y,v,b,E){const M=this.length;return this.resize(M+1),this.emplace(M,e,i,n,o,l,c,d,f,_,y,v,b,E)}emplace(e,i,n,o,l,c,d,f,_,y,v,b,E,M){const A=20*e,C=10*e;return this.int16[A+0]=i,this.int16[A+1]=n,this.int16[A+2]=o,this.int16[A+3]=l,this.int16[A+4]=c,this.float32[C+3]=d,this.float32[C+4]=f,this.float32[C+5]=_,this.float32[C+6]=y,this.int16[A+14]=v,this.uint32[C+8]=b,this.uint16[A+18]=E,this.uint16[A+19]=M,e}}nf.prototype.bytesPerElement=40,se(nf,"StructArrayLayout5i4f1i1ul2ui40");class _d extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,f){const _=8*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.int16[_+2]=o,this.int16[_+4]=l,this.int16[_+5]=c,this.int16[_+6]=d,this.int16[_+7]=f,e}}_d.prototype.bytesPerElement=16,se(_d,"StructArrayLayout3i2i2i16");class of extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=4*e,f=8*e;return this.float32[d+0]=i,this.float32[d+1]=n,this.float32[d+2]=o,this.int16[f+6]=l,this.int16[f+7]=c,e}}of.prototype.bytesPerElement=16,se(of,"StructArrayLayout2f1f2i16");class sf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=12*e,d=3*e;return this.uint8[c+0]=i,this.uint8[c+1]=n,this.float32[d+1]=o,this.float32[d+2]=l,e}}sf.prototype.bytesPerElement=12,se(sf,"StructArrayLayout2ub2f12");class ki extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,n)}emplace(e,i,n,o){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=n,this.uint16[l+2]=o,e}}ki.prototype.bytesPerElement=6,se(ki,"StructArrayLayout3ui6");class af extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H){const X=this.length;return this.resize(X+1),this.emplace(X,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H)}emplace(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H,X){const Q=30*e,ae=15*e,de=60*e;return this.int16[Q+0]=i,this.int16[Q+1]=n,this.int16[Q+2]=o,this.float32[ae+2]=l,this.float32[ae+3]=c,this.uint16[Q+8]=d,this.uint16[Q+9]=f,this.uint32[ae+5]=_,this.uint32[ae+6]=y,this.uint32[ae+7]=v,this.uint16[Q+16]=b,this.uint16[Q+17]=E,this.uint16[Q+18]=M,this.float32[ae+10]=A,this.float32[ae+11]=C,this.uint8[de+48]=D,this.uint8[de+49]=V,this.uint8[de+50]=N,this.uint32[ae+13]=U,this.int16[Q+28]=H,this.uint8[de+58]=X,e}}af.prototype.bytesPerElement=60,se(af,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class lf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H,X,Q,ae,de,ye,pe,we,De,Te,ke,be){const Ie=this.length;return this.resize(Ie+1),this.emplace(Ie,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H,X,Q,ae,de,ye,pe,we,De,Te,ke,be)}emplace(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D,V,N,U,H,X,Q,ae,de,ye,pe,we,De,Te,ke,be,Ie){const Be=20*e,Ee=40*e,Ve=80*e;return this.float32[Be+0]=i,this.float32[Be+1]=n,this.int16[Ee+4]=o,this.int16[Ee+5]=l,this.int16[Ee+6]=c,this.int16[Ee+7]=d,this.int16[Ee+8]=f,this.int16[Ee+9]=_,this.int16[Ee+10]=y,this.int16[Ee+11]=v,this.int16[Ee+12]=b,this.uint16[Ee+13]=E,this.uint16[Ee+14]=M,this.uint16[Ee+15]=A,this.uint16[Ee+16]=C,this.uint16[Ee+17]=D,this.uint16[Ee+18]=V,this.uint16[Ee+19]=N,this.uint16[Ee+20]=U,this.uint16[Ee+21]=H,this.uint16[Ee+22]=X,this.uint16[Ee+23]=Q,this.uint16[Ee+24]=ae,this.uint16[Ee+25]=de,this.uint16[Ee+26]=ye,this.uint16[Ee+27]=pe,this.uint32[Be+14]=we,this.float32[Be+15]=De,this.float32[Be+16]=Te,this.float32[Be+17]=ke,this.float32[Be+18]=be,this.uint8[Ve+76]=Ie,e}}lf.prototype.bytesPerElement=80,se(lf,"StructArrayLayout2f9i15ui1ul4f1ub80");class tc extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}tc.prototype.bytesPerElement=4,se(tc,"StructArrayLayout1f4");class Oa extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=5*e;return this.float32[d+0]=i,this.float32[d+1]=n,this.float32[d+2]=o,this.float32[d+3]=l,this.float32[d+4]=c,e}}Oa.prototype.bytesPerElement=20,se(Oa,"StructArrayLayout5f20");class cf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,f){const _=7*e;return this.float32[_+0]=i,this.float32[_+1]=n,this.float32[_+2]=o,this.float32[_+3]=l,this.float32[_+4]=c,this.float32[_+5]=d,this.float32[_+6]=f,e}}cf.prototype.bytesPerElement=28,se(cf,"StructArrayLayout7f28");class uf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=6*e;return this.uint32[3*e+0]=i,this.uint16[c+2]=n,this.uint16[c+3]=o,this.uint16[c+4]=l,e}}uf.prototype.bytesPerElement=12,se(uf,"StructArrayLayout1ul3ui12");class Au extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}Au.prototype.bytesPerElement=2,se(Au,"StructArrayLayout1ui2");class Cu extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const o=2*e;return this.float32[o+0]=i,this.float32[o+1]=n,e}}Cu.prototype.bytesPerElement=8,se(Cu,"StructArrayLayout2f8");class hf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C){const D=this.length;return this.resize(D+1),this.emplace(D,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C)}emplace(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D){const V=16*e;return this.float32[V+0]=i,this.float32[V+1]=n,this.float32[V+2]=o,this.float32[V+3]=l,this.float32[V+4]=c,this.float32[V+5]=d,this.float32[V+6]=f,this.float32[V+7]=_,this.float32[V+8]=y,this.float32[V+9]=v,this.float32[V+10]=b,this.float32[V+11]=E,this.float32[V+12]=M,this.float32[V+13]=A,this.float32[V+14]=C,this.float32[V+15]=D,e}}hf.prototype.bytesPerElement=64,se(hf,"StructArrayLayout16f64");class gd extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,f){const _=10*e,y=5*e;return this.uint16[_+0]=i,this.uint16[_+1]=n,this.uint16[_+2]=o,this.uint16[_+3]=l,this.float32[y+2]=c,this.float32[y+3]=d,this.float32[y+4]=f,e}}gd.prototype.bytesPerElement=20,se(gd,"StructArrayLayout4ui3f20");class df extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}df.prototype.bytesPerElement=2,se(df,"StructArrayLayout1i2");class pf extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}pf.prototype.bytesPerElement=1,se(pf,"StructArrayLayout1ub1");class $m extends Iu{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}$m.prototype.size=40;class ff extends nf{get(e){return new $m(this,e)}}se(ff,"CollisionBoxArray");class qm extends Iu{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}qm.prototype.size=60;class Zm extends af{get(e){return new qm(this,e)}}se(Zm,"PlacedSymbolArray");class Wm extends Iu{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}Wm.prototype.size=80;class Hm extends lf{get(e){return new Wm(this,e)}}se(Hm,"SymbolInstanceArray");class Xm extends tc{getoffsetX(e){return this.float32[1*e+0]}}se(Xm,"GlyphOffsetArray");class Ym extends bn{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}se(Ym,"SymbolLineVertexArray");class Jm extends Iu{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Jm.prototype.size=12;class Km extends uf{get(e){return new Jm(this,e)}}se(Km,"FeatureIndexArray");class Qm extends xs{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}se(Qm,"FillExtrusionCentroidArray");class e_ extends Iu{get a_join_normal_inside_polygon0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside_polygon1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside_polygon2(){return this._structArray.int16[this._pos2+2]}get a_join_normal_inside_polygon3(){return this._structArray.int16[this._pos2+3]}}e_.prototype.size=8;class t_ extends To{get(e){return new e_(this,e)}}se(t_,"FillExtrusionWallArray");const ix=$t([{name:"a_pos",components:2,type:"Int16"}],4),rx=$t([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class hi{constructor(e=[]){this.segments=e}_prepareSegment(e,i,n,o){let l=this.segments[this.segments.length-1];return e>hi.MAX_VERTEX_ARRAY_LENGTH&&vi(`Max vertices per segment is ${hi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!l||l.vertexLength+e>hi.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==o)&&(l={vertexOffset:i,primitiveOffset:n,vertexLength:0,primitiveLength:0},o!==void 0&&(l.sortKey=o),this.segments.push(l)),l}prepareSegment(e,i,n,o){return this._prepareSegment(e,i.length,n.length,o)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,n,o){return new hi([{vertexOffset:e,primitiveOffset:i,vertexLength:n,primitiveLength:o,vaos:{},sortKey:0}])}}function i_(t,e){return 256*(t=Et(Math.floor(t),0,255))+Et(Math.floor(e),0,255)}hi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,se(hi,"SegmentVector");const nx=$t([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),ox=$t([{name:"a_dash",components:4,type:"Uint16"}]);class Pu{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,n,o){this.ids.push(r_(e)),this.positions.push(i,n,o)}eachPosition(e,i){const n=r_(e);let o=0,l=this.ids.length-1;for(;o>1;this.ids[c]>=n?l=c:o=c+1}for(;this.ids[o]===n;)i(this.positions[3*o],this.positions[3*o+1],this.positions[3*o+2]),o++}static serialize(e,i){const n=new Float64Array(e.ids),o=new Uint32Array(e.positions);return mf(n,o,0,n.length-1),i&&(i.add(n.buffer),i.add(o.buffer)),{ids:n,positions:o}}static deserialize(e){const i=new Pu;let n;i.ids=e.ids,i.positions=e.positions;for(const o of i.ids)o!==n&&i.uniqueIds.push(o),n=o;return i.indexed=!0,i}}function r_(t){const e=+t;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:Al(String(t))}function mf(t,e,i,n){for(;i>1];let l=i-1,c=n+1;for(;;){do l++;while(t[l]o);if(l>=c)break;yd(t,l,c),yd(e,3*l,3*c),yd(e,3*l+1,3*c+1),yd(e,3*l+2,3*c+2)}c-i`u_${l}`),this.type=n,this.context=o}setUniform(e,i,n,o,l){const c=o.constantOr(this.value);i.set(e,l,c instanceof Ut?c.toRenderColor(this.context.lut):c)}getBinding(e,i){return this.type==="color"?new n_(e):new ur(e)}}class ic{constructor(e,i){this.uniformNames=i.map(n=>`u_${n}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,i,n,o,l){const c=l==="u_pattern"||l==="u_dash"?this.pattern:l==="u_pixel_ratio"?this.pixelRatio:null;c&&i.set(e,l,c)}getBinding(e,i){return i==="u_pattern"||i==="u_dash"?new gf(e):new ur(e)}}class Mo{constructor(e,i,n,o){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=i.map(l=>({name:`a_${l}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,i,n,o,l,c,d){const f=this.paintVertexArray.length,_=this.expression.evaluate(new at(0,{brightness:c}),i,{},l,o,d);this.paintVertexArray.resize(e),this._setPaintValue(f,e,_,this.context)}updatePaintArray(e,i,n,o,l,c,d){const f=this.expression.evaluate({zoom:0,brightness:d},n,o,void 0,l);this._setPaintValue(e,i,f,this.context)}_setPaintValue(e,i,n,o){if(this.type==="color"){const l=xf(n.toRenderColor(o.lut));for(let c=e;c`u_${d}_t`),this.type=n,this.useIntegerZoom=o,this.context=l,this.maxValue=0,this.paintVertexAttributes=i.map(d=>({name:`a_${d}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,i,n,o,l,c,d){const f=this.expression.evaluate(new at(this.context.zoom,{brightness:c}),i,{},l,o,d),_=this.expression.evaluate(new at(this.context.zoom+1,{brightness:c}),i,{},l,o,d),y=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(y,e,f,_,this.context)}updatePaintArray(e,i,n,o,l,c,d){const f=this.expression.evaluate({zoom:this.context.zoom,brightness:d},n,o,void 0,l),_=this.expression.evaluate({zoom:this.context.zoom+1,brightness:d},n,o,void 0,l);this._setPaintValue(e,i,f,_,this.context)}_setPaintValue(e,i,n,o,l){if(this.type==="color"){const c=xf(n.toRenderColor(l.lut)),d=xf(n.toRenderColor(l.lut));for(let f=e;f!0){this.binders={},this._buffers=[],this.context=i;const o=[];for(const l in e.paint._values){const c=e.paint.get(l);if(!n(l)||!(c instanceof Li&&g(c.property.specification)))continue;const d=ux(l,e.type),f=c.value,_=c.property.specification.type,y=!!c.property.useIntegerZoom,v=l==="line-dasharray"||l.endsWith("pattern"),b=l==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant";if(f.kind!=="constant"||b)if(f.kind==="source"||b||v){const E=o_(l,_,"source");this.binders[l]=v?new vs(f,d,_,E,e.id):new Mo(f,d,_,E),o.push(`/a_${l}`)}else{const E=o_(l,_,"composite");this.binders[l]=new wn(f,d,_,y,i,E),o.push(`/z_${l}`)}else this.binders[l]=v?new ic(f.value,d):new Du(f.value,d,_,i),o.push(`/u_${l}`)}this.cacheKey=o.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof Mo||i instanceof wn?i.maxValue:0}populatePaintArrays(e,i,n,o,l,c,d){for(const f in this.binders){const _=this.binders[f];_.context=this.context,(_ instanceof Mo||_ instanceof wn||_ instanceof vs)&&_.populatePaintArray(e,i,n,o,l,c,d)}}setConstantPatternPositions(e){for(const i in this.binders){const n=this.binders[i];n instanceof ic&&n.setConstantPatternPositions(e)}}updatePaintArrays(e,i,n,o,l,c,d,f){let _=!1;const y=Object.keys(e),v=y.length!==0,b=v?y:i.uniqueIds;this.context.lut=l.lut;for(const E in this.binders){const M=this.binders[E];if(M.context=this.context,(M instanceof Mo||M instanceof wn||M instanceof vs)&&(M.expression.isStateDependent===!0||M.expression.isLightConstant===!1)){const A=l.paint.get(E);M.expression=A.value;for(const C of b){const D=e[C.toString()];i.eachPosition(C,(V,N,U)=>{const H=o.feature(V);M.updatePaintArray(N,U,H,D,c,d,f)})}if(!v)for(const C of n.uniqueIds){const D=e[C.toString()];n.eachPosition(C,(V,N,U)=>{const H=o.feature(V);M.updatePaintArray(N,U,H,D,c,d,f)})}_=!0}}return _}defines(){const e=[];for(const i in this.binders){const n=this.binders[i];(n instanceof Du||n instanceof ic)&&e.push(...n.uniformNames.map(o=>`#define HAS_UNIFORM_${o}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof Mo||n instanceof wn||n instanceof vs)for(let o=0;o!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new Ba(o,i,n);this.needsUpload=!1,this._featureMap=new Pu,this._featureMapWithoutIds=new Pu,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,n,o,l,c,d,f){for(const _ in this.programConfigurations)this.programConfigurations[_].populatePaintArrays(e,i,o,l,c,d,f);i.id!==void 0?this._featureMap.add(i.id,n,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,n,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,n,o,l,c){for(const d of n)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,d,o,l,c||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const cx={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function ux(t,e){return cx[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const hx={"line-pattern":{source:ys,composite:ys},"fill-pattern":{source:ys,composite:ys},"fill-extrusion-pattern":{source:ys,composite:ys},"line-dasharray":{source:fd,composite:fd}},dx={color:{source:Cu,composite:_s},number:{source:tc,composite:Cu}};function o_(t,e,i){const n=hx[t];return n&&n[i]||dx[e][i]}se(Du,"ConstantBinder"),se(ic,"PatternConstantBinder"),se(Mo,"SourceExpressionBinder"),se(vs,"PatternCompositeBinder"),se(wn,"CompositeExpressionBinder"),se(Ba,"ProgramConfiguration",{omit:["_buffers"]}),se(bs,"ProgramConfigurationSet");const hr=Fe/Math.PI/2,vf=5,s_=6,px=16383,rc=64,bf=[rc,32,16],nn=-hr,on=hr;function nc(t,e,i,n=hr){return i=At(i),[t*Math.sin(i)*n,-e*n,t*Math.cos(i)*n]}function Fa(t,e,i){return nc(Math.cos(At(t)),Math.sin(At(t)),e,i)}const oc=63710088e-1,wf=2*Math.PI*oc;class Vt{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Vt(Jo(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,n=this.lat*i,o=e.lat*i,l=Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos((e.lng-this.lng)*i);return oc*Math.acos(Math.min(l,1))}toBounds(e=0){const i=360*e/40075017,n=i/Math.cos(Math.PI/180*this.lat);return new ws({lng:this.lng-n,lat:this.lat-i},{lng:this.lng+n,lat:this.lat+i})}toEcef(e){return Fa(this.lat,this.lng,hr+e*hr/oc)}static convert(e){if(e instanceof Vt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Vt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Vt(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: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class ws{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const n=e;this.setSouthWest([n[0],n[1]]).setNorthEast([n[2],n[3]])}else{const n=e;this.setSouthWest(n[0]).setNorthEast(n[1])}}setNorthEast(e){return this._ne=e instanceof Vt?new Vt(e.lng,e.lat):Vt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Vt?new Vt(e.lng,e.lat):Vt.convert(e),this}extend(e){const i=this._sw,n=this._ne;let o,l;if(e instanceof Vt)o=e,l=e;else{if(!(e instanceof ws))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ws.convert(e)):this.extend(Vt.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(Vt.convert(e)):this;if(o=e._sw,l=e._ne,!o||!l)return this}return i||n?(i.lng=Math.min(o.lng,i.lng),i.lat=Math.min(o.lat,i.lat),n.lng=Math.max(l.lng,n.lng),n.lat=Math.max(l.lat,n.lat)):(this._sw=new Vt(o.lng,o.lat),this._ne=new Vt(l.lng,l.lat)),this}getCenter(){return new Vt((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 Vt(this.getWest(),this.getNorth())}getSouthEast(){return new Vt(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(e){const{lng:i,lat:n}=Vt.convert(e);let o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&o}static convert(e){return!e||e instanceof ws?e:new ws(e)}}var a_={};(function(t,e){(function(i){function n(l,c,d){var f=o(256*l,256*(c=Math.pow(2,d)-c-1),d),_=o(256*(l+1),256*(c+1),d);return f[0]+","+f[1]+","+_[0]+","+_[1]}function o(l,c,d){var f=2*Math.PI*6378137/256/Math.pow(2,d);return[l*f-2*Math.PI*6378137/2,c*f-2*Math.PI*6378137/2]}i.getURL=function(l,c,d,f,_,y){return y=y||{},l+"?"+["bbox="+n(d,f,_),"format="+(y.format||"image/png"),"service="+(y.service||"WMS"),"version="+(y.version||"1.1.1"),"request="+(y.request||"GetMap"),"srs="+(y.srs||"EPSG:3857"),"width="+(y.width||256),"height="+(y.height||256),"layers="+c].join("&")},i.getTileBBox=n,i.getMercCoords=o,Object.defineProperty(i,"__esModule",{value:!0})})(e)})(0,a_);var fx=a_;class Na{constructor(e,i,n){this.z=e,this.x=i,this.y=n,this.key=sc(0,e,e,i,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){const n=fx.getTileBBox(this.x,this.y,this.z),o=function(l,c,d){let f,_="";for(let y=l;y>0;y--)f=1<this.canonical.z?new Pi(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Pi(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return sc(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return sc(this.wrap*+i,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Pi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,n=2*this.canonical.x,o=2*this.canonical.y;return[new Pi(i,this.wrap,i,n,o),new Pi(i,this.wrap,i,n+1,o),new Pi(i,this.wrap,i,n,o+1),new Pi(i,this.wrap,i,n+1,o+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.y{let e=t.canonical.x-1,i=t.wrap;return e<0&&(e=(1<{let e=t.canonical.x+1,i=t.wrap;return e===1<new Pi(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(t.canonical.y===0?1<new Pi(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<=f?(Ef(t,e,i,_,y,l,v,d,f),Ef(t,_,y,n,o,v,c,d,f)):t.push(c)}function d_(t,e,i){let n=t[0],o=n.x,l=n.y;e(n);const c=[n];for(let d=1;dt.x+1||nt.y+1)&&vi("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function Tn(t,e,i){const n=t.loadGeometry(),o=t.extent,l=Fe/o;if(e&&i&&i.projection.isReprojectedInTileSpace){const c=1<{const E=Er((e.x+b.x/o)/c),M=Vi((e.y+b.y/o)/c),A=y.project(E,M);b.x=(A.x*d-f)*o,b.y=(A.y*d-_)*o};for(let b=0;b=o||M.y<0||M.y>=o||(v(M),E.push(M));n[b]=E}}for(const c of n)for(const d of c)xx(d,l);return n}function Io(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Tn(t):[]}}function bd(t,e,i,n,o){t.emplaceBack(2*e+(n+1)/2,2*i+(o+1)/2)}function wd(t,e,i){t.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class If{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new bn,this.indexArray=new ki,this.segments=new hi,this.programConfigurations=new bs(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}updateFootprints(e,i){}populate(e,i,n,o){const l=this.layers[0],c=[];let d=null;l.type==="circle"&&(d=l.layout.get("circle-sort-key"));for(const{feature:_,id:y,index:v,sourceLayerIndex:b}of e){const E=this.layers[0]._featureFilter.needGeometry,M=Io(_,E);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),M,n))continue;const A=d?d.evaluate(M,{},n):void 0,C={id:y,properties:_.properties,type:_.type,sourceLayerIndex:b,index:v,geometry:E?M.geometry:Tn(_,n,o),patterns:{},sortKey:A};c.push(C)}d&&c.sort((_,y)=>_.sortKey-y.sortKey);let f=null;o.projection.name==="globe"&&(this.globeExtVertexArray=new md,f=o.projection);for(const _ of c){const{geometry:y,index:v,sourceLayerIndex:b}=_,E=e[v].feature;this.addFeature(_,y,v,i.availableImages,n,f,i.brightness),i.featureIndex.insert(E,y,v,b,this.index)}}update(e,i,n,o,l){const c=Object.keys(e).length!==0;c&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,c?this.stateDependentLayers:this.layers,n,o,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ix.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,rx.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,n,o,l,c,d){for(const f of i)for(const _ of f){const y=_.x,v=_.y;if(y<0||y>=Fe||v<0||v>=Fe)continue;if(c){const M=c.projectTilePoint(y,v,l),A=c.upVector(l,y,v),C=this.globeExtVertexArray;wd(C,M,A),wd(C,M,A),wd(C,M,A),wd(C,M,A)}const b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),E=b.vertexLength;bd(this.layoutVertexArray,y,v,-1,-1),bd(this.layoutVertexArray,y,v,1,-1),bd(this.layoutVertexArray,y,v,1,1),bd(this.layoutVertexArray,y,v,-1,1),this.indexArray.emplaceBack(E,E+1,E+2),this.indexArray.emplaceBack(E,E+2,E+3),b.vertexLength+=4,b.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},o,l,d)}}function Af(t,e){for(let i=0;i1){if(Cf(t,e))return!0;for(let n=0;n1?i:i.sub(e)._mult(o)._add(e))}function __(t,e){let i,n,o,l=!1;for(let c=0;ce.y!=o.y>e.y&&e.x<(o.x-n.x)*(e.y-n.y)/(o.y-n.y)+n.x&&(l=!l)}return l}function Ts(t,e){let i=!1;for(let n=0,o=t.length-1;ne.y!=c.y>e.y&&e.x<(c.x-l.x)*(e.y-l.y)/(c.y-l.y)+l.x&&(i=!i)}return i}function g_(t,e,i,n,o){for(const c of t)if(e<=c.x&&i<=c.y&&n>=c.x&&o>=c.y)return!0;const l=[new je(e,i),new je(e,o),new je(n,o),new je(n,i)];if(t.length>2){for(const c of l)if(Ts(t,c))return!0}for(let c=0;co.x&&e.x>o.x||t.yo.y&&e.y>o.y)return!1;const l=Fn(t,e,i[0]);return l!==Fn(t,e,i[1])||l!==Fn(t,e,i[2])||l!==Fn(t,e,i[3])}function ac(t,e,i,n,o,l){let c=e.y-t.y,d=t.x-e.x;if(l=l||0){const f=c*c+d*d;if(f===0)return!0;const _=Math.sqrt(f);c/=_,d/=_}return!((i.x-t.x)*c+(i.y-t.y)*d-l<0||(n.x-t.x)*c+(n.y-t.y)*d-l<0||(o.x-t.x)*c+(o.y-t.y)*d-l<0)}function zf(t,e,i,n,o,l,c){return!(ac(t,e,n,o,l,c)||ac(e,i,n,o,l,c)||ac(i,t,n,o,l,c)||ac(n,o,t,e,i,c)||ac(o,l,t,e,i,c)||ac(l,n,t,e,i,c))}function lc(t,e,i){const n=e.paint.get(t).value;return n.kind==="constant"?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function Td(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function y_(t,e,i,n,o){if(!e[0]&&!e[1])return t;const l=je.convert(e)._mult(o);i==="viewport"&&l._rotate(-n);const c=[];for(let d=0;d=0;if(l===0)return 0;l!==e.length&&(i=!1)}return i?2:1}function T_(t,e){for(const i of t.projections){const n=Ru(e,t.points[0],i.axis);if(i.projection[1]n[1])return 0}return 1}function E_(t,e){let i=0;const n=[0,0,0,0];for(let o=0;o=0&&i++;return i}class Lf{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=ci.fromPoints(this.points),this.projections=[],this.frustumEdges=[s.$.sub([],this.points[2],this.points[3]),s.$.sub([],this.points[0],this.points[3]),s.$.sub([],this.points[4],this.points[0]),s.$.sub([],this.points[5],this.points[1]),s.$.sub([],this.points[6],this.points[2]),s.$.sub([],this.points[7],this.points[3])];for(const n of this.frustumEdges){const o=[0,-n[2],n[1]],l=[n[2],0,-n[0]];this.projections.push({axis:o,projection:Ru(this.points,this.points[0],o)}),this.projections.push({axis:l,projection:Ru(this.points,this.points[0],l)})}}static fromInvProjectionMatrix(e,i,n,o){const l=Math.pow(2,n),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(_=>{const y=s.aB.transformMat4([],_,e),v=1/y[3]/i*l;return s.aB.mul(y,y,[v,v,o?1/y[3]:v,v])}),d=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=s.$.sub([],c[_[0]],c[_[1]]),v=s.$.sub([],c[_[2]],c[_[1]]),b=s.$.normalize([],s.$.cross([],y,v)),E=-s.$.dot(b,c[_[1]]);return b.concat(E)}),f=[];for(let _=0;__[1]||_[0]>f[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const n=i[3];if(s.$.dot([i[0],i[1],i[2]],e)+n<0)return!1}return!0}}class ci{static fromPoints(e){const i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const o of e)s.$.min(i,i,o),s.$.max(n,n,o);return new ci(i,n)}static fromTileIdAndHeight(e,i,n){const o=1<e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}se(ci,"Aabb");const Ex=$t([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Ed}=Ex,S_=$t([{name:"a_pos_3",components:3,type:"Int16"}]);var Lu=$t([{name:"a_pos",type:"Int16",components:2}]);function Sd(t){return t*hr/oc}const Sx=[new ci([nn,nn,nn],[on,on,on]),new ci([nn,nn,nn],[0,0,on]),new ci([0,nn,nn],[on,0,on]),new ci([nn,0,nn],[0,on,on]),new ci([0,0,nn],[on,on,on])];function M_(t,e,i,n=!0){const o=s.$.scale([],t._camera.position,t.worldSize),l=[e,i,1,1];s.aB.transformMat4(l,l,t.pixelMatrixInverse),s.aB.scale(l,l,1/l[3]);const c=s.$.sub([],l,o),d=s.$.normalize([],c),f=t.globeMatrix,_=[f[12],f[13],f[14]],y=s.$.sub([],_,o),v=s.$.length(y),b=s.$.normalize([],y),E=t.worldSize/(2*Math.PI),M=s.$.dot(b,d),A=Math.asin(E/v);if(A1?null:function(n,o,l,c){const d=Math.sin(l);return n*(Math.sin((1-c)*l)/d)+o*(Math.sin(c*l)/d)}(t.a[e],t.b[e],t.angle,Et(i,0,1))+t.center[e]}function Yn(t){if(t.z<=1)return Sx[t.z+2*t.y+t.x];const e=Of(Md(t));return ci.fromPoints(e)}function Ao(t,e,i){return s.$.scale(t,t,1-i),s.$.scaleAndAdd(t,t,e,i)}function I_(t,e){const i=Co(e.zoom);if(i===0)return Yn(t);const n=Md(t),o=Of(n),l=Hn(n.getWest())*e.worldSize,c=Hn(n.getEast())*e.worldSize,d=Xn(n.getNorth())*e.worldSize,f=Xn(n.getSouth())*e.worldSize,_=[l,d,0],y=[c,d,0],v=[l,f,0],b=[c,f,0],E=s.ae.invert([],e.globeMatrix);return s.$.transformMat4(_,_,E),s.$.transformMat4(y,y,E),s.$.transformMat4(v,v,E),s.$.transformMat4(b,b,E),o[0]=Ao(o[0],v,i),o[1]=Ao(o[1],b,i),o[2]=Ao(o[2],y,i),o[3]=Ao(o[3],_,i),ci.fromPoints(o)}function A_(t,e,i){for(const n of t)s.$.transformMat4(n,n,e),s.$.scale(n,n,i)}function C_(t,e,i,n){const o=e/t.worldSize,l=t.globeMatrix;if(i.z<=1){const de=Yn(i).getCorners();return A_(de,l,o),ci.fromPoints(de)}const c=Md(i,n),d=Of(c,hr+Sd(t._tileCoverLift));A_(d,l,o);const f=Number.MAX_VALUE,_=[-f,-f,-f],y=[f,f,f];if(c.contains(t.center)){for(const pe of d)s.$.min(y,y,pe),s.$.max(_,_,pe);_[2]=0;const de=t.point,ye=[de.x*o,de.y*o,0];return s.$.min(y,y,ye),s.$.max(_,_,ye),new ci(y,_)}if(t._tileCoverLift>0){for(const de of d)s.$.min(y,y,de),s.$.max(_,_,de);return new ci(y,_)}const v=[l[12]*o,l[13]*o,l[14]*o],b=c.getCenter(),E=Et(t.center.lat,-Ti,Ti),M=Et(b.lat,-Ti,Ti),A=Hn(t.center.lng),C=Xn(E);let D=A-Hn(b.lng);const V=C-Xn(M);D>.5?D-=1:D<-.5&&(D+=1);let N=0;if(Math.abs(D)>Math.abs(V))N=D>=0?1:3;else{N=V>=0?0:2;const de=[l[4]*o,l[5]*o,l[6]*o],ye=-Math.sin(At(V>=0?c.getSouth():c.getNorth()))*hr;s.$.scaleAndAdd(v,v,de,ye)}const U=d[N],H=d[(N+1)%4],X=new Mx(U,H,v),Q=[kf(X,0)||U[0],kf(X,1)||U[1],kf(X,2)||U[2]],ae=Co(t.zoom);if(ae>0){const de=function({x:pe,y:we,z:De},Te,ke,be,Ie){const Be=1/(1<.5?et=-1:Ke<-.5&&(et=1),Ee=((Ee+et)*Te-(be*=Te))*ke+be,Ve=((Ve+et)*Te-be)*ke+be,Oe=(Oe*Te-(Ie*=Te))*ke+Ie,Re=(Re*Te-Ie)*ke+Ie,[[Ee,Re,0],[Ve,Re,0],[Ve,Oe,0],[Ee,Oe,0]]}(i,e,t._pixelsPerMercatorPixel,A,C);for(let pe=0;peMath.PI/2*1.01}const L_=At(85),Ix=Math.cos(L_),Ax=Math.sin(L_),Cx=s.ae.create(),k_=t=>{const e=[];return t.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),t.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function O_(t,e,i,n,o,l,c,d,f){if(l&&t.queryGeometry.isAboveHorizon)return!1;l&&(f*=t.pixelToTileUnitsFactor);const _=t.tileID.canonical,y=i.projection.upVectorScale(_,i.center.lat,i.worldSize).metersToTile;for(const v of e)for(const b of v){const E=b.add(d),M=o&&i.elevation?i.elevation.exaggeration()*o.getElevationAt(E.x,E.y,!0):0,A=i.projection.projectTilePoint(E.x,E.y,_);if(M>0){const N=i.projection.upVector(_,E.x,E.y);A.x+=N[0]*y*M,A.y+=N[1]*y*M,A.z+=N[2]*y*M}const C=l?E:Px(A.x,A.y,A.z,n),D=l?t.tilespaceRays.map(N=>Dx(N,M)):t.queryGeometry.screenGeometry,V=s.aB.transformMat4([],[A.x,A.y,A.z,1],n);if(!c&&l?f*=V[3]/i.cameraToCenterDistance:c&&!l&&(f*=i.cameraToCenterDistance/V[3]),l){const N=Vi((b.y/Fe+_.y)/(1<<_.z));f/=i.projection.pixelsPerMeter(N,1)/dr(1,N)}if(vx(D,C,f))return!0}return!1}function Px(t,e,i,n){const o=s.aB.transformMat4([],[t,e,i,1],n);return new je(o[0]/o[3],o[1]/o[3])}const B_=s.$.fromValues(0,0,0),zx=s.$.fromValues(0,0,1);function Dx(t,e){const i=s.$.create();return B_[2]=e,t.intersectsPlane(B_,zx,i),new je(i[0],i[1])}class F_ extends If{}function N_(t,{width:e,height:i},n,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*i*n)throw new RangeError("mismatched image size")}else o=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=o,t}function V_(t,e,i){const{width:n,height:o}=e;n===t.width&&o===t.height||(Vf(t,e,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,o)},i,null),t.width=n,t.height=o,t.data=e.data)}function Vf(t,e,i,n,o,l,c,d){if(o.width===0||o.height===0)return e;if(o.width>t.width||o.height>t.height||i.x>t.width-o.width||i.y>t.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||n.x>e.width-o.width||n.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const f=t.data,_=e.data,y=l===4&&d;for(let v=0;v{e[t.evaluationKey]=f;const _=t.expression.evaluate(e);_&&(o.data[c+d+0]=Math.floor(255*_.r/_.a),o.data[c+d+1]=Math.floor(255*_.g/_.a),o.data[c+d+2]=Math.floor(255*_.b/_.a),o.data[c+d+3]=Math.floor(255*_.a))};if(t.clips)for(let c=0,d=0;c80*i){d=1/0,f=1/0;let y=-1/0,v=-1/0;for(let b=i;by&&(y=E),M>v&&(v=M)}_=Math.max(y-d,v-f),_=_!==0?32767/_:0}return Nu(l,c,i,d,f,_,0),c}function Z_(t,e,i,n,o){let l;if(o===function(c,d,f,_){let y=0;for(let v=d,b=f-_;v0)for(let c=e;c=e;c-=n)l=X_(c/n|0,t[c],t[c+1],l);return l&&Ad(l,l.next)&&(Uu(l),l=l.next),l}function Ua(t,e){if(!t)return t;e||(e=t);let i,n=t;do if(i=!1,n.steiner||!Ad(n,n.next)&&zi(n.prev,n,n.next)!==0)n=n.next;else{if(Uu(n),n=e=n.prev,n===n.next)break;i=!0}while(i||n!==e);return e}function Nu(t,e,i,n,o,l,c){if(!t)return;!c&&l&&function(f,_,y,v){let b=f;do b.z===0&&(b.z=Uf(b.x,b.y,_,y,v)),b.prevZ=b.prev,b.nextZ=b.next,b=b.next;while(b!==f);b.prevZ.nextZ=null,b.prevZ=null,function(E){let M,A=1;do{let C,D=E;E=null;let V=null;for(M=0;D;){M++;let N=D,U=0;for(let X=0;X0||H>0&&N;)U!==0&&(H===0||!N||D.z<=N.z)?(C=D,D=D.nextZ,U--):(C=N,N=N.nextZ,H--),V?V.nextZ=C:E=C,C.prevZ=V,V=C;D=N}V.nextZ=null,A*=2}while(M>1)}(b)}(t,n,o,l);let d=t;for(;t.prev!==t.next;){const f=t.prev,_=t.next;if(l?Ox(t,n,o,l):kx(t))e.push(f.i,t.i,_.i),Uu(t),t=_.next,d=_.next;else if((t=_)===d){c?c===1?Nu(t=Bx(Ua(t),e),e,i,n,o,l,2):c===2&&Fx(t,e,i,n,o,l):Nu(Ua(t),e,i,n,o,l,1);break}}}function kx(t){const e=t.prev,i=t,n=t.next;if(zi(e,i,n)>=0)return!1;const o=e.x,l=i.x,c=n.x,d=e.y,f=i.y,_=n.y,y=ol?o>c?o:c:l>c?l:c,E=d>f?d>_?d:_:f>_?f:_;let M=n.next;for(;M!==e;){if(M.x>=y&&M.x<=b&&M.y>=v&&M.y<=E&&cc(o,d,l,f,c,_,M.x,M.y)&&zi(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function Ox(t,e,i,n){const o=t.prev,l=t,c=t.next;if(zi(o,l,c)>=0)return!1;const d=o.x,f=l.x,_=c.x,y=o.y,v=l.y,b=c.y,E=df?d>_?d:_:f>_?f:_,C=y>v?y>b?y:b:v>b?v:b,D=Uf(E,M,e,i,n),V=Uf(A,C,e,i,n);let N=t.prevZ,U=t.nextZ;for(;N&&N.z>=D&&U&&U.z<=V;){if(N.x>=E&&N.x<=A&&N.y>=M&&N.y<=C&&N!==o&&N!==c&&cc(d,y,f,v,_,b,N.x,N.y)&&zi(N.prev,N,N.next)>=0||(N=N.prevZ,U.x>=E&&U.x<=A&&U.y>=M&&U.y<=C&&U!==o&&U!==c&&cc(d,y,f,v,_,b,U.x,U.y)&&zi(U.prev,U,U.next)>=0))return!1;U=U.nextZ}for(;N&&N.z>=D;){if(N.x>=E&&N.x<=A&&N.y>=M&&N.y<=C&&N!==o&&N!==c&&cc(d,y,f,v,_,b,N.x,N.y)&&zi(N.prev,N,N.next)>=0)return!1;N=N.prevZ}for(;U&&U.z<=V;){if(U.x>=E&&U.x<=A&&U.y>=M&&U.y<=C&&U!==o&&U!==c&&cc(d,y,f,v,_,b,U.x,U.y)&&zi(U.prev,U,U.next)>=0)return!1;U=U.nextZ}return!0}function Bx(t,e){let i=t;do{const n=i.prev,o=i.next.next;!Ad(n,o)&&W_(n,i,i.next,o)&&Vu(n,o)&&Vu(o,n)&&(e.push(n.i,i.i,o.i),Uu(i),Uu(i.next),i=t=o),i=i.next}while(i!==t);return Ua(i)}function Fx(t,e,i,n,o,l){let c=t;do{let d=c.next.next;for(;d!==c.prev;){if(c.i!==d.i&&Gx(c,d)){let f=H_(c,d);return c=Ua(c,c.next),f=Ua(f,f.next),Nu(c,e,i,n,o,l,0),void Nu(f,e,i,n,o,l,0)}d=d.next}c=c.next}while(c!==t)}function Nx(t,e){return t.x-e.x}function Vx(t,e){const i=function(o,l){let c=l;const d=o.x,f=o.y;let _,y=-1/0;do{if(f<=c.y&&f>=c.next.y&&c.next.y!==c.y){const A=c.x+(f-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(A<=d&&A>y&&(y=A,_=c.x=c.x&&c.x>=b&&d!==c.x&&cc(f_.x||c.x===_.x&&Ux(_,c)))&&(_=c,M=A)}c=c.next}while(c!==v);return _}(t,e);if(!i)return e;const n=H_(i,t);return Ua(n,n.next),Ua(i,i.next)}function Ux(t,e){return zi(t.prev,t,e.prev)<0&&zi(e.next,t,t.next)<0}function Uf(t,e,i,n,o){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function jx(t){let e=t,i=t;do(e.x=(t-c)*(l-d)&&(t-c)*(n-d)>=(i-c)*(e-d)&&(i-c)*(l-d)>=(o-c)*(n-d)}function Gx(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(i,n){let o=i;do{if(o.i!==i.i&&o.next.i!==i.i&&o.i!==n.i&&o.next.i!==n.i&&W_(o,o.next,i,n))return!0;o=o.next}while(o!==i);return!1}(t,e)&&(Vu(t,e)&&Vu(e,t)&&function(i,n){let o=i,l=!1;const c=(i.x+n.x)/2,d=(i.y+n.y)/2;do o.y>d!=o.next.y>d&&o.next.y!==o.y&&c<(o.next.x-o.x)*(d-o.y)/(o.next.y-o.y)+o.x&&(l=!l),o=o.next;while(o!==i);return l}(t,e)&&(zi(t.prev,t,e.prev)||zi(t,e.prev,e))||Ad(t,e)&&zi(t.prev,t,t.next)>0&&zi(e.prev,e,e.next)>0)}function zi(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Ad(t,e){return t.x===e.x&&t.y===e.y}function W_(t,e,i,n){const o=Pd(zi(t,e,i)),l=Pd(zi(t,e,n)),c=Pd(zi(i,n,t)),d=Pd(zi(i,n,e));return o!==l&&c!==d||!(o!==0||!Cd(t,i,e))||!(l!==0||!Cd(t,n,e))||!(c!==0||!Cd(i,t,n))||!(d!==0||!Cd(i,e,n))}function Cd(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Pd(t){return t>0?1:t<0?-1:0}function Vu(t,e){return zi(t.prev,t,t.next)<0?zi(t,e,t.next)>=0&&zi(t,t.prev,e)>=0:zi(t,e,t.prev)<0||zi(t,t.next,e)<0}function H_(t,e){const i=jf(t.i,t.x,t.y),n=jf(e.i,e.x,e.y),o=t.next,l=e.prev;return t.next=e,e.prev=t,i.next=o,o.prev=i,n.next=i,i.prev=n,l.next=n,n.prev=l,n}function X_(t,e,i,n){const o=jf(t,e,i);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function Uu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function jf(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function zd(t,e){const i=t.length;if(i<=1)return[t];const n=[];let o,l;for(let c=0;c1)for(let c=0;ci.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new bn,this.indexArray=new ki,this.indexArray2=new xs,this.programConfigurations=new bs(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new hi,this.segments2=new hi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection}updateFootprints(e,i){}populate(e,i,n,o){this.hasPattern=Gf("fill",this.layers,i);const l=this.layers[0].layout.get("fill-sort-key"),c=[];for(const{feature:d,id:f,index:_,sourceLayerIndex:y}of e){const v=this.layers[0]._featureFilter.needGeometry,b=Io(d,v);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),b,n))continue;const E=l?l.evaluate(b,{},n,i.availableImages):void 0,M={id:f,properties:d.properties,type:d.type,sourceLayerIndex:y,index:_,geometry:v?b.geometry:Tn(d,n,o),patterns:{},sortKey:E};c.push(M)}l&&c.sort((d,f)=>d.sortKey-f.sortKey);for(const d of c){const{geometry:f,index:_,sourceLayerIndex:y}=d;if(this.hasPattern){const v=$f("fill",this.layers,d,this.zoom,i);this.patternFeatures.push(v)}else this.addFeature(d,f,_,n,{},i.availableImages,i.brightness);i.featureIndex.insert(e[_].feature,f,_,y,this.index)}}update(e,i,n,o,l){const c=Object.keys(e).length!==0;c&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,c?this.stateDependentLayers:this.layers,n,o,l)}addFeatures(e,i,n,o,l,c){for(const d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,i,n,o,c)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Lx),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,i,n,o,l,c=[],d){for(const f of zd(i,500)){let _=0;for(const A of f)_+=A.length;const y=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray),v=y.vertexLength,b=[],E=[];for(const A of f){if(A.length===0)continue;A!==f[0]&&E.push(b.length/2);const C=this.segments2.prepareSegment(A.length,this.layoutVertexArray,this.indexArray2),D=C.vertexLength;this.layoutVertexArray.emplaceBack(A[0].x,A[0].y),this.indexArray2.emplaceBack(D+A.length-1,D),b.push(A[0].x),b.push(A[0].y);for(let V=1;Vv.cellIdx-b.cellIdx||v.triIdx-b.triIdx);let y=0;for(;y<_.length;){const v=_[y].cellIdx,b={start:this.payload.length,len:0};for(;y<_.length&&_[y].cellIdx===v;)++b.len,this.payload.push(_[y++].triIdx);this.cells[v]=b}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const n=Jn(e.x-this.min.x,this.xScale,this.cellsX),o=Jn(e.y-this.min.y,this.yScale,this.cellsY),l=this.cells[o*this.cellsX+n];if(l){this._lazyInitLookup();for(let c=0;cthis.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const o=Jn(e.x-this.min.x,this.xScale,this.cellsX),l=Jn(i.x-this.min.x,this.xScale,this.cellsX),c=Jn(e.y-this.min.y,this.yScale,this.cellsY),d=Jn(i.y-this.min.y,this.yScale,this.cellsY);for(let f=c;f<=d;f++)for(let _=o;_<=l;_++){const y=this.cells[f*this.cellsX+_];if(y)for(let v=0;vi.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[]}updateFootprints(e,i){for(const n of this.footprints)i.push({footprint:n,id:e})}populate(e,i,n,o){const l=[];for(const{feature:c,id:d,index:f,sourceLayerIndex:_}of e){const y=this.layers[0]._featureFilter.needGeometry,v=Io(c,y);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),v,n))continue;const b={id:d,properties:c.properties,type:c.type,sourceLayerIndex:_,index:f,geometry:y?v.geometry:Tn(c,n,o),patterns:{}};l.push(b)}for(const c of l){const{geometry:d,index:f,sourceLayerIndex:_}=c;this.addFeature(c,d,f,n,{},i.availableImages,i.brightness),i.featureIndex.insert(e[f].feature,d,f,_,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,n,o,l){}destroy(){}addFeature(e,i,n,o,l,c=[],d){for(const f of zd(i,2)){const _=[],y=[],v=[],b=new je(1/0,1/0),E=new je(-1/0,-1/0);for(const C of f)if(C.length!==0){C!==f[0]&&v.push(y.length/2);for(let D=0;D>3}if(o--,n===1||n===2)l+=t.readSVarint(),c+=t.readSVarint(),n===1&&(e&&d.push(e),e=[]),e.push(new Kx(l,c));else{if(n!==7)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&d.push(e),d},uc.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,o=0,l=0,c=1/0,d=-1/0,f=1/0,_=-1/0;t.pos>3}if(n--,i===1||i===2)(o+=t.readSVarint())d&&(d=o),(l+=t.readSVarint())_&&(_=l);else if(i!==7)throw new Error("unknown command "+i)}return[c,f,d,_]},uc.prototype.toGeoJSON=function(t,e,i){var n,o,l=this.extent*Math.pow(2,i),c=this.extent*t,d=this.extent*e,f=this.loadGeometry(),_=uc.types[this.type];function y(E){for(var M=0;M>3;o=c===1?n.readString():c===2?n.readFloat():c===3?n.readDouble():c===4?n.readVarint64():c===5?n.readVarint():c===6?n.readSVarint():c===7?n.readBoolean():null}return o}(i))}rg.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new tv(this._pbf,e,this.extent,this._keys,this._values)};var rv=ig;function nv(t,e,i){if(t===3){var n=new rv(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}var Zf=Rd.VectorTile=function(t,e){this.layers=t.readFields(nv,{},e)},Ld=Rd.VectorTileFeature=tg;Rd.VectorTileLayer=ig;class ja extends je{constructor(e,i,n){super(e,i),this.z=n}}class ng extends ja{constructor(e,i,n,o){super(e,i,n),this.w=o}}function kd(t,e,i,n){const o=[],l=n===0?(c,d,f,_,y,v)=>{c.push(new je(v,f+(v-d)/(_-d)*(y-f)))}:(c,d,f,_,y,v)=>{c.push(new je(d+(v-f)/(y-f)*(_-d),v))};for(const c of t){const d=[];for(const f of c){if(f.length<=2)continue;const _=[];for(let b=0;be&&l(_,E,M,A,C,e):D>i?V=e&&l(_,E,M,A,C,e),V>i&&D<=i&&l(_,E,M,A,C,i)}let y=f[f.length-1];const v=n===0?y.x:y.y;v>=e&&v<=i&&_.push(y),_.length&&(y=_[_.length-1],_[0].x===y.x&&_[0].y===y.y||_.push(_[0]),d.push(_))}d.length&&o.push(d)}return o}function og(t,e,i,n){const o=i==="x"?"y":"x",l=(n-t[i])/(e[i]-t[i]);t[o]=t[o]+(e[o]-t[o])*l,t[i]=n,t.hasOwnProperty("z")&&(t.z=rt(t.z,e.z,l)),t.hasOwnProperty("w")&&(t.w=rt(t.w,e.w,l))}function sg(t,e,i,n){const o=i,l=n;for(const c of["x","y"]){let d=t,f=e;d[c]>=f[c]&&(d=e,f=t),d[c]o&&og(d,f,c,o),d[c]l&&og(f,d,c,l)}}const Od=Number.MAX_SAFE_INTEGER;function ag(t,e,i,n){return t.orderc===o)===void 0}(n,t.clipScope)}function Bd(t,e){return t.x-e.x||t.y-e.y}function lg(t,e){return Bd(t.min,e.min)===0&&Bd(t.max,e.max)===0}function Wf(t,e){return!(t.min.x>e.max.x||t.max.xe.max.y||t.max.ynew je((f.x+l.x*Fe)*d-c.x*Fe,(f.y+l.y*Fe)*d-c.y*Fe))}return ug(i,o,t.indices,0,t.indices.length,0,0)}function dg(t,e,i,n){const o=Math.pow(2,n.z-i.z);return new je((t+i.x*Fe)*o-n.x*Fe,(e+i.y*Fe)*o-n.y*Fe)}function pg(t,e){const i=[];e.footprint.grid.queryPoint(t,i);const n=e.footprint.indices,o=e.footprint.vertices;for(let l=0;le[c])return null}else{const d=1/n[c];let f=(t[c]-i[c])*d,_=(e[c]-i[c])*d;if(f>_){const y=f;f=_,_=y}if(f>o&&(o=f),_l)return null}return o}function _g(t,e,i,n,o,l,c,d,f,_,y){const v=n-t,b=o-e,E=l-i,M=c-t,A=d-e,C=f-i,D=y[1]*C-y[2]*A,V=y[2]*M-y[0]*C,N=y[0]*A-y[1]*M,U=v*D+b*V+E*N;if(Math.abs(U)<1e-15)return null;const H=1/U,X=_[0]-t,Q=_[1]-e,ae=_[2]-i,de=(X*D+Q*V+ae*N)*H;if(de<0||de>1)return null;const ye=Q*E-ae*b,pe=ae*v-X*E,we=X*b-Q*v,De=(y[0]*ye+y[1]*pe+y[2]*we)*H;return De<0||de+De>1?null:(M*ye+A*pe+C*we)*H}function gg(t,e,i){return(t-e)/(i-e)}function yg(t,e,i,n,o,l,c,d,f){const _=1<{const V=C?1:0,N=(E+1)*A-V,U=M*A,H=(M+1)*A-V;D[0]=E*A,D[1]=U,D[2]=N,D[3]=H};let v=new fg(f);const b=[];for(let E=0;E=1;f/=2){const E=d[d.length-1];v=new fg(f);for(let M=0;M0;){const{idx:M,t:A,nodex:C,nodey:D,depth:V}=E.pop();if(this.leaves[M]){yg(C,D,V,e,i,n,o,v,b);const U=1<=be[2])return A}continue}let N=0;for(let U=0;U=_[y[ae]]&&(y.splice(ae,0,U),Q=!0);Q||(y[N]=U),N++}}for(let U=0;U=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const n=[0,0,0,0],o=Fd.getUnpackVector(i);let l=Math.floor((e+o[3])/o[2]);return n[2]=l%256,l=Math.floor(l/256),n[1]=l%256,l=Math.floor(l/256),n[0]=l,n}getPixels(){return new U_({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=i*this.dim,l=i*this.dim+this.dim,c=n*this.dim,d=n*this.dim+this.dim;switch(i){case-1:o=l-1;break;case 1:l=o+1}switch(n){case-1:c=d-1;break;case 1:d=c+1}const f=-i*this.dim,_=-n*this.dim;for(let y=c;ye.max.x&&(e.max.x=i.x,o=!0),i.ye.max.y&&(e.max.y=i.y,o=!0),((i.x===0||i.x===Fe)&&i.x===n.x)!=((i.y===0||i.y===Fe)&&i.y===n.y)&&this.processBorderOverlap(i,n),o&&this.checkBorderIntersection(i,n)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,rt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>Fe!=e.x>Fe&&this.addBorderIntersection(1,rt(i.y,e.y,(Fe-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,rt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>Fe!=e.y>Fe&&this.addBorderIntersection(3,rt(i.x,e.x,(Fe-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[e];in[1]&&(n[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,i.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,i.x),this.addBorderIntersection(n,e.x)}}centroid(){return this.accCount===0?new je(0,0):new je(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function Mg(t,e){const i=t.add(e)._unit(),n=Et(t.x*i.x+t.y*i.y,-1,1);var o,l,c;return o=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(o)))/4*pv*((l=t).x*(c=e).y-l.y*c.x<0?-1:1)}const fv=[t=>t.x<0,t=>t.x>Fe,t=>t.y<0,t=>t.y>Fe];function mv(t,e,i,n){const o=[4];if(n===0)return o;i._mult(n);const l=t.sub(i),c=e.sub(i),d=[t,e,l,c];for(let f=0;f<4;f++)for(const _ of d)if(fv[f](_)){o.push(f);break}return o}class Ig{constructor(e){this.vertexArray=new Kp,this.indexArray=new ki,this.programConfigurations=new bs(e.layers,{zoom:e.zoom,lut:e.lut},i=>hv.includes(i)),this._segments=new hi,this.hiddenByLandmarkVertexArray=new pf,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new hi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,n,o=!1){const l=e.length;if(l>2){let c=Math.max(0,this._segments.get().length-1);const d=this._segments._prepareSegment(4*l,this.vertexArray.length,2*this._segmentToGroundQuads[c].length);let f;c!==this._segments.get().length-1&&(c++,this._segmentToGroundQuads[c]=[],this._segmentToRegionTriCounts[c]=[0,0,0,0,0]);{const _=e[0],y=e[1];f=Mg(_.sub(e[l-1])._perp()._unit(),y.sub(_)._perp()._unit())}for(let _=0;_o.region-l.region);for(let n=0;nf+_,0);let d=0;for(let f=0;f<=4;f++){const _=c[f];if(_!==0){let y=this.regionSegments[f];y||(y=this.regionSegments[f]=new hi);const v={vertexOffset:l.vertexOffset,primitiveOffset:l.primitiveOffset+d,vertexLength:l.vertexLength,primitiveLength:_};y.get().push(v)}d+=_}for(let f=0;f0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Xx.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class Vd{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new ki,this.footprintVertices=new bn,this.footprintSegments=[],this.layoutVertexArray=new To,this.centroidVertexArray=new Qm,this.wallVertexArray=new t_,this.indexArray=new ki,this.programConfigurations=new bs(e.layers,{zoom:e.zoom,lut:e.lut},i=>uv.includes(i)),this.segments=new hi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new Ig(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,i){}populate(e,i,n,o){this.features=[],this.hasPattern=Gf("fill-extrusion",this.layers,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=vd(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:l,id:c,index:d,sourceLayerIndex:f}of e){const _=this.layers[0]._featureFilter.needGeometry,y=Io(l,_);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),y,n))continue;const v={id:c,sourceLayerIndex:f,index:d,geometry:_?y.geometry:Tn(l,n,o),properties:l.properties,type:l.type,patterns:{}},b=this.layoutVertexArray.length;if(this.hasPattern)this.features.push($f("fill-extrusion",this.layers,v,this.zoom,i));else if(this.wallMode)for(const E of v.geometry)this.addFeature(v,[E],d,n,{},i.availableImages,o,i.brightness);else this.addFeature(v,v.geometry,d,n,{},i.availableImages,o,i.brightness);i.featureIndex.insert(l,v.geometry,d,f,this.index,b)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,n,o,l,c){for(const d of this.features){const{geometry:f}=d;if(this.wallMode)for(const _ of f)this.addFeature(d,[_],d.index,i,n,o,l,c);else this.addFeature(d,f,d.index,i,n,o,l,c)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,n,o,l){const c=Object.keys(e).length!==0;if(c&&!this.stateDependentLayers.length)return;const d=c?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(e,i,d,n,o,l),this.groundEffect.update(e,i,d,n,o,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Jx),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,Hx.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Yx.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Wx.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,n,o,l,c,d,f){const _=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,y=[new je(0,0),new je(Fe,Fe)],v=d.projection,b=v.name==="globe",E=this.wallMode||cv[e.type]==="Polygon",M=new Sg;M.centroidDataIndex=this.centroidData.length;const A=new Eg,C=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},o)<=0,D=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},o);let V;if(A.height=D,A.vertexArrayOffset=this.layoutVertexArray.length,A.groundVertexArrayOffset=this.groundEffect.vertexArray.length,b&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new md),this.wallMode){if(b)return void vi("Non zero fill-extrusion-line-width is not yet supported on globe.");if(i.length!==1)return;V=function(ye){const pe=ye[0].x===ye[ye.length-1].x&&ye[0].y===ye[ye.length-1].y;(function(Ke){let Ze=0;const Ne=Ke.length;for(let st=0;st=0})(ye)||(ye=ye.reverse());const De={isPolygon:pe,geometry:[],joinNormals:[]},Te=[],ke=[],be=[];let Ie=ye.length;if(Ie<(pe?3:2))return De;for(;Ie>=2&&ye[Ie-1].equals(ye[Ie-2]);)Ie--;let Be,Ee,Ve,Oe,Re,et=0;for(;et0;let Xe="miter";Xe==="miter"&&st>2&&(Xe="bevel");const ut=(ft,ht,vt,zt)=>{const It=new je(ft.x,ft.y),Kt=new je(ft.x,ft.y);It.x-=ht.x*zt,It.y-=ht.y*zt,Kt.x-=ht.x*Math.max(vt,1),Kt.y-=ht.y*Math.max(vt,1),be.push(ht),Te.push(It),ke.push(Kt)};if(Xe==="miter")Ze._mult(st),ut(Be,Ze,1,0);else{const ft=-Math.sqrt(st*st-1),ht=Qe?ft:0,vt=Qe?0:ft;Ee&&ut(Be,Oe,ht,vt),Ve&&ut(Be,Re,ht,vt)}}return De.geometry=[...Te,...ke.reverse(),Te[0]],De.joinNormals=[...be,...be.reverse(),be[be.length-1]],De}(i[0]),i=[V.geometry]}const N=(ye,pe)=>ye<(pe.length-1)/2||ye===pe.length-1,U=this.wallMode?[i]:zd(i,500);for(let ye=U.length-1;ye>=0;ye--){const pe=U[ye];(pe.length===0||(H=pe[0]).every(we=>we.x<=0)||H.every(we=>we.x>=Fe)||H.every(we=>we.y<=0)||H.every(we=>we.y>=Fe))&&U.splice(ye,1)}var H;let X;if(b)X=Lg(U,y,o);else{X=[];for(const ye of U)X.push({polygon:ye,bounds:y})}const Q=E?this.edgeRadius:0,ae=Q>0&&this.zoom<17,de=(ye,pe)=>{if(ye.length===0)return!1;const we=ye[ye.length-1];return pe.x===we.x&&pe.y===we.y};for(const{polygon:ye,bounds:pe}of X){let we=0,De=0;for(const Ie of ye)E&&!Ie[0].equals(Ie[Ie.length-1])&&Ie.push(Ie[0]),De+=E?Ie.length-1:Ie.length;const Te=this.segments.prepareSegment((E?5:4)*De,this.layoutVertexArray,this.indexArray);A.footprintSegIdx<0&&(A.footprintSegIdx=this.footprintSegments.length),A.polygonSegIdx<0&&(A.polygonSegIdx=this.polygonSegments.length);const ke={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},be=new Tg;if(be.vertexOffset=this.footprintVertices.length,be.indexOffset=3*this.footprintIndices.length,be.ringIndices=[],E){const Ie=[],Be=[];we=Te.vertexLength;for(let Ve=0;Ve4&&zg(Be[Be.length-2],Be[0],Be[1]),Ve=Q?_v(Be[Be.length-2],Be[0],Be[1],Q):0;const Oe=[];let Re,et,Ke;et=Be[1].sub(Be[0])._perp()._unit();let Ze=!0;for(let Ne=1,st=0;Ne0?1:0,zt=Qe.dist(Xe);if(st+zt>32768&&(st=0),Q){Ke=ut.sub(Xe)._perp()._unit();let mt=Cg(Qe,Xe,ut,Ag(et,Ke),Q);isNaN(mt)&&(mt=0);const qt=Xe.sub(Qe)._unit();Qe=Qe.add(qt.mult(Ve))._round(),Xe=Xe.add(qt.mult(-mt))._round(),Ve=mt,et=Ke,C&&this.zoom>=17&&(de(Oe,Qe)||Oe.push(Qe),de(Oe,Xe)||Oe.push(Xe))}const It=Te.vertexLength,Kt=Be.length>4&&zg(Qe,Xe,ut);let ti=Dg(st,Ee,Ze);if(ju(this.layoutVertexArray,Qe.x,Qe.y,ht,vt,0,0,ti),ju(this.layoutVertexArray,Qe.x,Qe.y,ht,vt,0,1,ti),this.wallMode){const mt=N(Ne-1,Be),qt=V.joinNormals[Ne-1];Gu(this.wallVertexArray,qt,!mt,V.isPolygon),Gu(this.wallVertexArray,qt,!mt,V.isPolygon)}if(st+=zt,ti=Dg(st,Kt,!Ze),Ee=Kt,ju(this.layoutVertexArray,Xe.x,Xe.y,ht,vt,0,0,ti),ju(this.layoutVertexArray,Xe.x,Xe.y,ht,vt,0,1,ti),this.wallMode){const mt=N(Ne,Be),qt=V.joinNormals[Ne];Gu(this.wallVertexArray,qt,!mt,V.isPolygon),Gu(this.wallVertexArray,qt,!mt,V.isPolygon)}if(Te.vertexLength+=4,this.indexArray.emplaceBack(It+0,It+1,It+2),this.indexArray.emplaceBack(It+1,It+3,It+2),Te.primitiveLength+=2,Q){const mt=we+(Ne===1?Be.length-2:Ne-2),qt=Ne===1?we:mt+1;if(this.indexArray.emplaceBack(It+1,mt,It+3),this.indexArray.emplaceBack(mt,qt,It+3),Te.primitiveLength+=2,Re===void 0&&(Re=It),!Xf(ut,Be[Ne],pe)){const Wt=Ne===Be.length-1?Re:Te.vertexLength;this.indexArray.emplaceBack(It+2,It+3,Wt),this.indexArray.emplaceBack(It+3,Wt+1,Wt),this.indexArray.emplaceBack(It+3,qt,Wt+1),Te.primitiveLength+=3}Ze=!Ze}if(b){const mt=this.layoutVertexExtArray,qt=v.projectTilePoint(Qe.x,Qe.y,o),Wt=v.projectTilePoint(Xe.x,Xe.y,o),oi=v.upVector(o,Qe.x,Qe.y),_i=v.upVector(o,Xe.x,Xe.y);$u(mt,qt,oi),$u(mt,qt,oi),$u(mt,Wt,_i),$u(mt,Wt,_i)}}E&&(we+=Be.length-1),C&&Q&&this.zoom>=17&&(Oe.length!==0&&de(Oe,Oe[0])&&Oe.pop(),this.groundEffect.addData(Oe,pe,_,Q>0))}this.footprintSegments.push(be),ke.triangleCount=this.indexArray.length-ke.triangleArrayOffset,this.polygonSegments.push(ke),++A.footprintSegLen,++A.polygonSegLen}if(A.vertexCount=this.layoutVertexArray.length-A.vertexArrayOffset,A.groundVertexCount=this.groundEffect.vertexArray.length-A.groundVertexArrayOffset,A.vertexCount!==0){if(A.centroidXY=M.borders?wg:this.encodeCentroid(M,A),this.centroidData.push(A),M.borders){this.featuresOnBorder.push(M);const ye=this.featuresOnBorder.length-1;for(let pe=0;pethis.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}splitToSubtiles(){const e=[];for(let d=0;dFe),y=2*_+(+(f.min.x+f.max.x>Fe)^_);for(let v=0;vd.triangleSegmentIdx===f.triangleSegmentIdx?d.subtile-f.subtile:d.triangleSegmentIdx-f.triangleSegmentIdx);let n=0,o=0,l=0;for(const d of e){if(d.triangleSegmentIdx!==n)break;l++}const c=e.length;for(;o!==e.length;){n=e[o].triangleSegmentIdx;let d=0,f=o,_=o;for(let y=f;y0&&this.triangleSubSegments.push({segment:E,min:v,max:b}),f=_;for(let M=f;M[A[0]*(1-D[0])+C[0]*D[0],A[1]*(1-D[1])+C[1]*D[1]],E=[],M=[];for(const A of this.triangleSubSegments){E[0]=A.min.x/Fe,E[1]=A.min.y/Fe,M[0]=A.max.x/Fe,M[1]=A.max.y/Fe;const C=b(y,v,E),D=b(y,v,M);if(new ci([C[0],C[1],l],[D[0],D[1],c]).intersectsPrecise(n)===0){_&&(o.segments.push(_),_=void 0);continue}const V=A.segment;_&&_.vertexOffset!==V.vertexOffset&&(o.segments.push(_),_=void 0),_?(_.vertexLength+=V.vertexLength,_.primitiveLength+=V.primitiveLength):_={vertexOffset:V.vertexOffset,primitiveLength:V.primitiveLength,vertexLength:V.vertexLength,primitiveOffset:V.primitiveOffset,sortKey:void 0,vaos:{}}}return _&&o.segments.push(_),o}encodeCentroid(e,i){const n=e.centroid(),o=i.span(),l=Math.min(7,Math.round(o.x*this.tileToMeter/10)),c=Math.min(7,Math.round(o.y*this.tileToMeter/10));return new je(Et(n.x,1,Fe-1)<<3|l,Et(n.y,1,Fe-1)<<3|c)}encodeBorderCentroid(e){if(!e.borders)return new je(0,0);const i=e.borders,n=Number.MAX_VALUE;if(i[0][0]!==n||i[1][0]!==n){const o=i[0][0]!==n?0:1;return new je(6|(i[0][0]!==n?0:65528),(i[o][0]+i[o][1])/2<<3|6)}{const o=i[2][0]!==n?2:3;return new je((i[o][0]+i[o][1])/2<<3|6,6|(i[2][0]!==n?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=Ms,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,n=e.vertexCount+e.vertexArrayOffset,o=e.flags&Ms?wg:e.centroidXY,l=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==o.y||l!==o.x){for(let c=i;cf.max.x||f.min.x>c.max.x||c.min.y>f.max.y||f.min.y>c.max.y))for(let _=0;_i!=E>i&&e<(this.footprintVertices.int16[2*(y+c.vertexOffset)+0]-v)*(i-b)/(E-b)+v&&(o=!o)}d=f}}return o}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,o=!0;const l=4*(e+Fe)*Fe+(i+Fe);if(this.partLookup.hasOwnProperty(l)){const c=this.partLookup[l];return c?{height:c.height,hidden:!!(c.flags&Ms)}:void 0}for(const c of this.centroidData)e>c.max.x||c.min.x>e||i>c.max.y||c.min.y>i||this.footprintContainsPoint(e,i,c)&&c&&c.height>n&&(n=c.height,this.partLookup[l]=c,o=!!(c.flags&Ms));if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:o};this.partLookup[l]=void 0}}function Ag(t,e){const i=t.add(e)._unit();return t.x*i.x+t.y*i.y}function _v(t,e,i,n){const o=e.sub(t)._perp()._unit(),l=i.sub(e)._perp()._unit();return Cg(t,e,i,Ag(o,l),n)}function Cg(t,e,i,n,o){const l=Math.sqrt(1-n*n);return Math.min(t.dist(e)/3,e.dist(i)/3,o*l/n)}function Xf(t,e,i){return t.xi[1].x&&e.x>i[1].x||t.yi[1].y&&e.y>i[1].y}function Pg(t,e){return t.xe[1].x||t.ye[1].y}function zg(t,e,i){if(t.x<0||t.x>=Fe||e.x<0||e.x>=Fe||i.x<0||i.x>=Fe)return!1;const n=i.sub(e),o=n.perp(),l=t.sub(e);return(n.x*l.x+n.y*l.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(l.x*l.x+l.y*l.y))>-.866&&o.x*l.x+o.y*l.y<0}function Dg(t,e,i){const n=e?2|t:-3&t;return i?1|n:-2&n}function Rg(){const t=Math.PI/32,e=Math.tan(t),i=oc;return i*Math.sqrt(1+2*e*e)-i}function Lg(t,e,i){const n=1<{for(const ae of X)M.push({polygon:ae,bounds:Q})},C=Math.ceil(Math.log2(y)),D=Math.ceil(Math.log2(v)),V=C-D,N=[];for(let X=0;X0?0:1);for(let X=0;XQ+1?H.push({polygons:Te,bounds:be,depth:Q+1}):A(Te,be)}if(ke.length){const be=[new je(ae===0?De:de.x,ae===1?De:de.y),ye];N.length>Q+1?H.push({polygons:ke,bounds:be,depth:Q+1}):A(ke,be)}}return M}(t,e,Math.ceil((l-o)/11.25),Math.ceil((c-d)/11.25),1,(f,_,y)=>{if(f===0)return .5*(_+y);{const v=Vi((i.y+_/Fe)/n);return(Xn(.5*(Vi((i.y+y/Fe)/n)+v))*n-i.y)*Fe}})}function gv(t,e,i,n,o,l){const c=Math.pow(2,n.z-o.z);for(let d=0;d1&&(f=e[++d]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),b=Math.min(y,v);let E;const M=l/n*(o+1);if(f.isDash){const A=o-Math.abs(M);E=Math.sqrt(b*b+A*A)}else E=o-Math.sqrt(b*b+M*M);this.image.data[c+_]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e,i){for(let f=e.length-1;f>=0;--f){const _=e[f],y=e[f+1];_.zeroLength?e.splice(f,1):y&&y.isDash===_.isDash&&(y.left=_.left,e.splice(f,1))}const n=e[0],o=e[e.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const l=this.width*this.nextRow;let c=0,d=e[c];for(let f=0;f1&&(d=e[++c]);const _=Math.abs(f-d.left),y=Math.abs(f-d.right),v=Math.min(_,y);this.image.data[l+f]=Math.max(0,Math.min(255,(d.isDash?v:-v)+i+128))}}addDash(e,i){const n=this.getKey(e,i);if(this.positions[n])return this.positions[n];const o=i==="round",l=o?7:0,c=2*l+1;if(this.nextRow+c>this.height)return vi("LineAtlas out of space"),null;e.length===0&&e.push(1);let d=0;for(let y=0;yi.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new Qp,this.layoutVertexArray2=new _s,this.patternVertexArray=new gs,this.indexArray=new ki,this.programConfigurations=new bs(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new hi,this.maxLineLength=0,this.zOffsetVertexArray=new tc,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:Fe/64}updateFootprints(e,i){}populate(e,i,n,o){this.hasPattern=Gf("line",this.layers,i);const l=this.layers[0].layout.get("line-sort-key"),c=this.layers[0].layout.get("line-z-offset");this.hasZOffset=!c.isConstant()||!!c.constantOr(0);const d=[];for(const{feature:v,id:b,index:E,sourceLayerIndex:M}of e){const A=this.layers[0]._featureFilter.needGeometry,C=Io(v,A);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),C,n))continue;const D=l?l.evaluate(C,{},n):void 0,V={id:b,properties:v.properties,type:v.type,sourceLayerIndex:M,index:E,geometry:A?C.geometry:Tn(v,n,o),patterns:{},sortKey:D};d.push(V)}l&&d.sort((v,b)=>v.sortKey-b.sortKey);const{lineAtlas:f,featureIndex:_}=i,y=this.addConstantDashes(f);for(const v of d){const{geometry:b,index:E,sourceLayerIndex:M}=v;if(y&&this.addFeatureDashes(v,f),this.hasPattern){const A=$f("line",this.layers,v,this.zoom,i);this.patternFeatures.push(A)}else this.addFeature(v,b,E,n,f.positions,i.availableImages,i.brightness);_.insert(e[E].feature,b,E,M,this.index)}}addConstantDashes(e){let i=!1;for(const n of this.layers){const o=n.paint.get("line-dasharray").value,l=n.layout.get("line-cap").value;if(o.kind!=="constant"||l.kind!=="constant")i=!0;else{const c=l.value,d=o.value;if(!d)continue;e.addDash(d,c)}}return i}addFeatureDashes(e,i){const n=this.zoom;for(const o of this.layers){const l=o.paint.get("line-dasharray").value,c=o.layout.get("line-cap").value;if(l.kind==="constant"&&c.kind==="constant")continue;let d,f;if(l.kind==="constant"){if(d=l.value,!d)continue}else d=l.evaluate({zoom:n},e);f=c.kind==="constant"?c.value:c.evaluate({zoom:n},e),i.addDash(d,f),e.patterns[o.id]=i.getKey(d,f)}}update(e,i,n,o,l){const c=Object.keys(e).length!==0;c&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,c?this.stateDependentLayers:this.layers,n,o,l)}addFeatures(e,i,n,o,l,c){for(const d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,i,n,o,c)}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,bv)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,Tv)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Ng.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,xv),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,n,o,l,c,d){const f=this.layers[0].layout,_=f.get("line-join").evaluate(e,{}),y=f.get("line-cap").evaluate(e,{}),v=f.get("line-miter-limit"),b=f.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of i)this.addLine(E,e,o,_,y,v,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,c,o,d)}addLine(e,i,n,o,l,c,d){this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.currentVertex=void 0;const f={zoom:this.zoom,lineProgress:void 0},_=this.layers[0].layout,y=o==="none";if(this.patternJoinNone=this.hasPattern&&y,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let X=0;X=2&&e[b-1].equals(e[b-2]);)b--;let E=0;for(;E0;if(Te&&X>E){const be=C.dist(D);if(be>2*M){const Ie=C.sub(C.sub(D)._mult(M/be)._round());this.updateDistance(D,Ie),this.addCurrentVertex(Ie,N,0,0,A,H),D=Ie}}if(Q&&ae==="round"&&(wec&&(ae="bevel"),ae==="bevel"&&(we>2&&(ae="flipbevel"),we100)ye=U.mult(-1);else{const be=we*N.add(U).mag()/N.sub(U).mag();ye._perp()._mult(be*(ke?-1:1))}this.addCurrentVertex(C,ye,0,0,A,H),this.addCurrentVertex(C,ye.mult(-1),0,0,A,H)}else if(ae==="bevel"||ae==="fakeround"){const be=-Math.sqrt(we*we-1),Ie=ke?be:0,Be=ke?0:be;if(D&&this.addCurrentVertex(C,N,Ie,Be,A,H),ae==="fakeround"){const Ee=Math.round(180*De/Math.PI/20);for(let Ve=1;Ve2*M){const Ie=C.add(V.sub(C)._mult(M/be)._round());this.updateDistance(C,Ie),this.addCurrentVertex(Ie,U,0,0,A,H),C=Ie}}}}addVerticesTo(e,i,n,o,l,c,d,f,_,y){const v=(i.w-e.w)/this.tessellationStep|0;if(v>1){this.lineSoFar=e.w;const b=(i.x-e.x)/v,E=(i.y-e.y)/v,M=(i.z-e.z)/v,A=(i.w-e.w)/v;for(let C=1;C=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,y),f.primitiveLength++),c?this.e2=y:this.e1=y,_!=null&&this.zOffsetVertexArray.emplaceBack(_)}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}}function jg(t,e,i){return t.xi||t.yi}let Gg,$g;function qg(t,e,i){return e*(Fe/(t.tileSize*Math.pow(2,i-t.tileID.overscaledZ)))}function Zg(t,e){return 1/qg(t,1,e.tileZoom)}function Wg(t,e,i,n){return t.translatePosMatrix(n||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}se(Ud,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Hg=t=>{const e=[];Xg(t)&&e.push("RENDER_LINE_DASH"),t.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=t.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),t.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const n=t.layout.get("line-join").constantOr("miter")==="none",o=!!t.paint.get("line-pattern").constantOr(1);return n&&o&&e.push("LINE_JOIN_NONE"),e};function Xg(t){const e=t.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}class Yg{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i>1,y=-7,v=i?o-1:0,b=i?-1:1,E=t[e+v];for(v+=b,l=E&(1<<-y)-1,E>>=-y,y+=d;y>0;l=256*l+t[e+v],v+=b,y-=8);for(c=l&(1<<-y)-1,l>>=-y,y+=n;y>0;c=256*c+t[e+v],v+=b,y-=8);if(l===0)l=1-_;else{if(l===f)return c?NaN:1/0*(E?-1:1);c+=Math.pow(2,n),l-=_}return(E?-1:1)*c*Math.pow(2,l-n)},write:function(t,e,i,n,o,l){var c,d,f,_=8*l-o-1,y=(1<<_)-1,v=y>>1,b=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:l-1,M=n?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(d=isNaN(e)?1:0,c=y):(c=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-c))<1&&(c--,f*=2),(e+=c+v>=1?b/f:b*Math.pow(2,1-v))*f>=2&&(c++,f/=2),c+v>=y?(d=0,c=y):c+v>=1?(d=(e*f-1)*Math.pow(2,o),c+=v):(d=e*Math.pow(2,v-1)*Math.pow(2,o),c=0));o>=8;t[i+E]=255&d,E+=M,d/=256,o-=8);for(c=c<0;t[i+E]=255&c,E+=M,c/=256,_-=8);t[i+E-M]|=128*A}},Jg=ui,jd=Lv;function ui(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}ui.Varint=0,ui.Fixed64=1,ui.Bytes=2,ui.Fixed32=5;var Yf=4294967296,Kg=1/Yf,Qg=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Po(t){return t.type===ui.Bytes?t.readVarint()+t.pos:t.pos+1}function dc(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function ey(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var o=i.pos-1;o>=t;o--)i.buf[o+n]=i.buf[o]}function kv(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function ty(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}ui.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,l=this.pos;this.type=7&n,t(o,e,this),this.pos===l&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Gd(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=ty(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Gd(this.buf,this.pos)+Gd(this.buf,this.pos+4)*Yf;return this.pos+=8,t},readSFixed64:function(){var t=Gd(this.buf,this.pos)+ty(this.buf,this.pos+4)*Yf;return this.pos+=8,t},readFloat:function(){var t=jd.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=jd.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(o,l,c){var d,f,_=c.buf;if(d=(112&(f=_[c.pos++]))>>4,f<128||(d|=(127&(f=_[c.pos++]))<<3,f<128)||(d|=(127&(f=_[c.pos++]))<<10,f<128)||(d|=(127&(f=_[c.pos++]))<<17,f<128)||(d|=(127&(f=_[c.pos++]))<<24,f<128)||(d|=(1&(f=_[c.pos++]))<<31,f<128))return dc(o,d,l);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Qg?function(i,n,o){return Qg.decode(i.subarray(n,o))}(this.buf,e,t):function(i,n,o){for(var l="",c=n;c239?4:y>223?3:y>191?2:1;if(c+b>o)break;b===1?y<128&&(v=y):b===2?(192&(d=i[c+1]))==128&&(v=(31&y)<<6|63&d)<=127&&(v=null):b===3?(f=i[c+2],(192&(d=i[c+1]))==128&&(192&f)==128&&((v=(15&y)<<12|(63&d)<<6|63&f)<=2047||v>=55296&&v<=57343)&&(v=null)):b===4&&(f=i[c+2],_=i[c+3],(192&(d=i[c+1]))==128&&(192&f)==128&&(192&_)==128&&((v=(15&y)<<18|(63&d)<<12|(63&f)<<6|63&_)<=65535||v>=1114112)&&(v=null)),v===null?(v=65533,b=1):v>65535&&(v-=65536,l+=String.fromCharCode(v>>>10&1023|55296),v=56320|1023&v),l+=String.fromCharCode(v),c+=b}return l}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==ui.Bytes)return t.push(this.readVarint(e));var i=Po(this);for(t=t||[];this.pos127;);else if(e===ui.Bytes)this.pos=this.readVarint()+this.pos;else if(e===ui.Fixed32)this.pos+=4;else{if(e!==ui.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(e,i){var n,o;if(e>=0?(n=e%4294967296|0,o=e/4294967296|0):(o=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,o=o+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(l,c,d){d.buf[d.pos++]=127&l|128,l>>>=7,d.buf[d.pos++]=127&l|128,l>>>=7,d.buf[d.pos++]=127&l|128,l>>>=7,d.buf[d.pos++]=127&l|128,d.buf[d.pos]=127&(l>>>=7)}(n,0,i),function(l,c){var d=(7&l)<<4;c.buf[c.pos++]|=d|((l>>>=3)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l)))))}(o,i)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(n,o,l){for(var c,d,f=0;f55295&&c<57344){if(!d){c>56319||f+1===o.length?(n[l++]=239,n[l++]=191,n[l++]=189):d=c;continue}if(c<56320){n[l++]=239,n[l++]=191,n[l++]=189,d=c;continue}c=d-55296<<10|c-56320|65536,d=null}else d&&(n[l++]=239,n[l++]=191,n[l++]=189,d=null);c<128?n[l++]=c:(c<2048?n[l++]=c>>6|192:(c<65536?n[l++]=c>>12|224:(n[l++]=c>>18|240,n[l++]=c>>12&63|128),n[l++]=c>>6&63|128),n[l++]=63&c|128)}return l}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&ey(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),jd.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),jd.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&ey(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,ui.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,kv,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Ov,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Nv,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Bv,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Fv,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Vv,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Uv,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,jv,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Gv,e)},writeBytesField:function(t,e){this.writeTag(t,ui.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,ui.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,ui.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,ui.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,ui.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,ui.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,ui.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,ui.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,ui.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,ui.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};var Zu=Jr(Jg);const $v=["id","tile","layer","source","sourceLayer","state"];class iy{constructor(e,i,n,o,l){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=n,this._y=o,this.properties=e.properties,this.id=l}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of $v)this[i]!==void 0&&(e[i]=this[i]);return e}}class qv{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,n){const o=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},Gi(this.stateChanges[e][o],n),this.deletedStates[e]===null){this.deletedStates[e]={};for(const l in this.state[e])l!==o&&(this.deletedStates[e][l]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(const l in this.state[e][o])n[l]||(this.deletedStates[e][o][l]=null)}else for(const l in n)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][l]===null&&delete this.deletedStates[e][o][l]}removeFeatureState(e,i,n){if(this.deletedStates[e]===null)return;const o=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&i!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][n]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(n in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][n]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,i){const n=String(i),o=Gi({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const l=this.deletedStates[e][i];if(l===null)return{};for(const c in l)delete o[c]}return o}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const n={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const l={};for(const c in this.stateChanges[o])this.state[o][c]||(this.state[o][c]={}),Gi(this.state[o][c],this.stateChanges[o][c]),l[c]=this.state[o][c];n[o]=l}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const l={};if(this.deletedStates[o]===null)for(const c in this.state[o])l[c]={},this.state[o][c]={};else for(const c in this.deletedStates[o]){if(this.deletedStates[o][c]===null)this.state[o][c]={};else if(this.state[o][c])for(const d of Object.keys(this.deletedStates[o][c]))delete this.state[o][c][d];l[c]=this.state[o][c]}n[o]=n[o]||{},Gi(n[o],l)}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length!==0)for(const o in e)e[o].setFeatureState(n,i)}}class ry{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new _e(Fe,16,0),this.featureIndexArray=new Km,this.promoteId=i,this.is3DTile=!1}insert(e,i,n,o,l,c=0,d=0){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,o,l,c);const _=this.grid;for(let y=0;y=0&&b[3]>=0&&_.insert(f,b[0],b[1],b[2],b[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Zf(new Zu(this.rawTileData)).layers,this.sourceLayerCoder=new Yg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i,n,o){this.loadVTLayers();const l=e.params||{},c=vn(l.filter),d=e.tileResult,f=e.transform,_=d.bufferedTilespaceBounds,y=this.grid.query(_.min.x,_.min.y,_.max.x,_.max.y,(M,A,C,D)=>g_(d.bufferedTilespaceGeometry,M,A,C,D));y.sort(Zv);let v=null;f.elevation&&y.length>0&&(v=hc.create(f.elevation,this.tileID));const b={};let E;for(let M=0;M(D||(D=Tn(V,this.tileID.canonical,e.tileTransform)),N.queryIntersectsFeature(d,V,U,D,this.z,e.transform,e.pixelPosMatrix,v,H)))}return b}loadMatchingFeature(e,i,n,o,l,c,d,f,_){const{featureIndex:y,bucketIndex:v,sourceLayerIndex:b,layoutVertexArrayOffset:E}=i,M=this.bucketLayerIDs[v];if(o&&!function(V,N){for(let U=0;U=0)return!0;return!1}(o,M))return;const A=this.sourceLayerCoder.decode(b),C=this.vtLayers[A].feature(y);if(n.needGeometry){const V=Io(C,!0);if(!n.filter(new at(this.tileID.overscaledZ),V,this.tileID.canonical))return}else if(!n.filter(new at(this.tileID.overscaledZ),C))return;const D=this.getId(C,A);for(let V=0;V{const d=e instanceof Ni?e.get(c):null;return d&&d.evaluate?d.evaluate(i,n,o):d})}function Zv(t,e){return e-t}se(ry,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});var Ki=24;const En=128;function Jf(t,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new at(t+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:n,interpolationType:o}=i;let l=0;for(;l{n.text=function(o,l,c){const d=l.layout.get("text-transform").evaluate(c,{});return d==="uppercase"?o=o.toLocaleUpperCase():d==="lowercase"&&(o=o.toLocaleLowerCase()),Mt.applyArabicShaping&&(o=Mt.applyArabicShaping(o)),o}(n.text,e,i)}),t}const Wu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Xv(t){return t==="︶"||t==="﹈"||t==="︸"||t==="﹄"||t==="﹂"||t==="︾"||t==="︼"||t==="︺"||t==="︘"||t==="﹀"||t==="︐"||t==="︓"||t==="︔"||t==="`"||t===" ̄"||t==="︑"||t==="︒"}function Yv(t){return t==="︵"||t==="﹇"||t==="︷"||t==="﹃"||t==="﹁"||t==="︽"||t==="︻"||t==="︹"||t==="︗"||t==="︿"}const Kf=3;function Jv(t,e,i){e.glyphs=[],t===1&&i.readMessage(Kv,e)}function Kv(t,e,i){if(t===3){const{id:n,bitmap:o,width:l,height:c,left:d,top:f,advance:_}=i.readMessage(Qv,{});e.glyphs.push({id:n,bitmap:new Es({width:l+2*Kf,height:c+2*Kf},o),metrics:{width:l,height:c,left:d,top:f,advance:_}})}else t===4?e.ascender=i.readSVarint():t===5&&(e.descender=i.readSVarint())}function Qv(t,e,i){t===1?e.id=i.readVarint():t===2?e.bitmap=i.readBytes():t===3?e.width=i.readVarint():t===4?e.height=i.readVarint():t===5?e.left=i.readSVarint():t===6?e.top=i.readSVarint():t===7&&(e.advance=i.readVarint())}const oy=Kf,Xr={horizontal:1,vertical:2,horizontalOnly:3};class Hu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,i){const n=new Hu;return n.scale=e||1,n.fontStack=i,n}static forImage(e){const i=new Hu;return i.imageName=e,i}}class mc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i){const n=new mc;for(let o=0;o=0&&n>=e&&qd[this.text.charCodeAt(n)];n--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const n=new mc;return n.text=this.text.substring(e,i),n.sectionIndex=this.sectionIndex.slice(e,i),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(Hu.forText(e.scale,e.fontStack||i));const n=this.sections.length-1;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Qf(t,e,i,n,o,l,c,d,f,_,y,v,b,E,M){const A=mc.fromFeature(t,o);v===Xr.vertical&&A.verticalizePunctuation(b);let C=[];const D=function(X,Q,ae,de,ye,pe){if(!X)return[];const we=[],De=function(Ie,Be,Ee,Ve,Oe,Re){let et=0;for(let Ke=0;Ke=0;let ke=0;for(let Ie=0;Ie0&&Sr>vt&&(vt=Sr)}else{const Qi=ae[mt.fontStack];if(!Qi)continue;Qi[Wt]&&(Si=Qi[Wt]);const ri=Q[mt.fontStack];if(!ri)continue;const Sr=ri.glyphs[Wt];if(!Sr)continue;if(_i=Sr.metrics,pi=Wt!==8203?Ki:0,Re){const Pn=ri.ascender!==void 0?Math.abs(ri.ascender):0,cn=ri.descender!==void 0?Math.abs(ri.descender):0,un=(Pn+cn)*oi;zt-i/2;){if(c--,c<0)return!1;d-=t[c].dist(l),l=t[c]}d+=t[c].dist(t[c+1]),c++;const f=[];let _=0;for(;dn;)_-=f.shift().angleDelta;if(_>o)return!1;c++,d+=y.dist(v)}return!0}function py(t){let e=0;for(let i=0;i_){const M=(_-f)/E,A=rt(v.x,b.x,M),C=rt(v.y,b.y,M),D=new zo(A,C,0,b.angleTo(v),y);return!c||dy(t,D,d,c,e)?D:void 0}f+=E}}function n1(t,e,i,n,o,l,c,d,f){const _=fy(n,l,c),y=my(n,o),v=y*c,b=t[0].x===0||t[0].x===f||t[0].y===0||t[0].y===f;return e-v=0&&U=0&&H=0&&b+_<=y){const X=new zo(U,H,0,V,M);n&&!dy(t,X,l,n,o)||E.push(X)}}v+=D}return d||E.length||c||(E=_y(t,v/2,i,n,o,l,c,!0,f)),E}function gy(t,e,i,n,o){const l=[];for(let c=0;c=n&&v.x>=n||(y.x>=n?y=new je(n,y.y+(n-y.x)/(v.x-y.x)*(v.y-y.y))._round():v.x>=n&&(v=new je(n,y.y+(n-y.x)/(v.x-y.x)*(v.y-y.y))._round()),y.y>=o&&v.y>=o||(y.y>=o?y=new je(y.x+(o-y.y)/(v.y-y.y)*(v.x-y.x),o)._round():v.y>=o&&(v=new je(y.x+(o-y.y)/(v.y-y.y)*(v.x-y.x),o)._round()),f&&y.equals(f[f.length-1])||(f=[y],l.push(f)),f.push(v)))))}}return l}function yy(t){let e=0,i=0;for(const c of t)e+=c.w*c.h,i=Math.max(i,c.w);t.sort((c,d)=>d.h-c.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let o=0,l=0;for(const c of t)for(let d=n.length-1;d>=0;d--){const f=n[d];if(!(c.w>f.w||c.h>f.h)){if(c.x=f.x,c.y=f.y,l=Math.max(l,c.y+c.h),o=Math.max(o,c.x+c.w),c.w===f.w&&c.h===f.h){const _=n.pop();de.hasImage(o,n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,n);for(const o in e.getUpdatedImages(n))this.patchUpdatedImage(this.iconPositions[o],e.getImage(o,n),i),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o,n),i)}patchUpdatedImage(e,i,n){if(!e||!i||e.version===i.version)return;e.version=i.version;const[o,l]=e.tl,c=!!Object.keys(this.patternPositions).length;n.update(i.data,{useMipmap:c},{x:o,y:l})}}se(tm,"ImagePosition"),se(xy,"ImageAtlas");const Xu=1e20;function vy(t,e,i,n,o,l,c,d,f){for(let _=e;_-1);f++,l[f]=d,c[f]=_,c[f+1]=Xu}for(let d=0,f=0;d{let _=this.entries[c];_||(_=this.entries[c]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let y=_.glyphs[d];if(y!==void 0)return void f(null,{stack:c,id:d,glyph:y});if(y=this._tinySDF(_,c,d),y)return _.glyphs[d]=y,void f(null,{stack:c,id:d,glyph:y});const v=Math.floor(d/256);if(256*v>65535)return void f(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void f(null,{stack:c,id:d,glyph:y});let b=_.requests[v];b||(b=_.requests[v]=[],_c.loadGlyphRange(c,v,l,this.requestManager,(E,M)=>{if(M){_.ascender=M.ascender,_.descender=M.descender;for(const A in M.glyphs)this._doesCharSupportLocalGlyph(+A)||(_.glyphs[+A]=M.glyphs[+A]);_.ranges[v]=!0}for(const A of b)A(E,M);delete _.requests[v]})),b.push((E,M)=>{E?f(E):M&&f(null,{stack:c,id:d,glyph:M.glyphs[d]||null})})},(c,d)=>{if(c)n(c);else if(d){const f={};for(const{stack:_,id:y,glyph:v}of d)f[_]===void 0&&(f[_]={}),f[_].glyphs===void 0&&(f[_].glyphs={}),f[_].glyphs[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},f[_].ascender=this.entries[_].ascender,f[_].descender=this.entries[_].descender;n(null,f)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==im.none&&(this.localGlyphMode===im.all?!!this.localFontFamily:!!this.localFontFamily&&(ne["CJK Unified Ideographs"](e)||ne["Hangul Syllables"](e)||ne.Hiragana(e)||ne.Katakana(e)||ne["CJK Symbols and Punctuation"](e)||ne["CJK Unified Ideographs Extension A"](e)||ne["CJK Unified Ideographs Extension B"](e)))}_tinySDF(e,i,n){const o=this.localFontFamily;if(!o||!this._doesCharSupportLocalGlyph(n))return;let l=e.tinySDF;if(!l){let A="400";/bold/i.test(i)?A="900":/medium/i.test(i)?A="500":/light/i.test(i)&&(A="200"),l=e.tinySDF=new _c.TinySDF({fontFamily:o,fontWeight:A,fontSize:24*Sn,buffer:3*Sn,radius:8*Sn}),l.fontWeight=A}if(this.localGlyphs[l.fontWeight][n])return this.localGlyphs[l.fontWeight][n];const c=String.fromCodePoint(n),{data:d,width:f,height:_,glyphWidth:y,glyphHeight:v,glyphLeft:b,glyphTop:E,glyphAdvance:M}=l.draw(c);return this.localGlyphs[l.fontWeight][n]={id:n,bitmap:new Es({width:f,height:_},d),metrics:{width:y/Sn,height:v/Sn,left:b/Sn,top:E/Sn-27,advance:M/Sn,localGlyph:!0}}}}_c.loadGlyphRange=function(t,e,i,n,o){const l=256*e,c=l+255,d=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",t).replace("{range}",`${l}-${c}`),aa.Glyphs);uo(d,(f,_)=>{if(f)o(f);else if(_){const y={},v=function(b){return new Zu(b).readFields(Jv,{})}(_);for(const b of v.glyphs)y[b.id]=b;o(null,{glyphs:y,ascender:v.ascender,descender:v.descender})}})},_c.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:l="normal",fontStyle:c="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const d=this.size=t+4*e,f=this._createCanvas(d),_=this.ctx=f.getContext("2d",{willReadFrequently:!0});_.font=`${c} ${l} ${t}px ${o}`,_.textBaseline="alphabetic",_.textAlign="left",_.fillStyle="black",this.gridOuter=new Float64Array(d*d),this.gridInner=new Float64Array(d*d),this.f=new Float64Array(d),this.z=new Float64Array(d+1),this.v=new Uint16Array(d)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:l}=this.ctx.measureText(t),c=Math.ceil(i),d=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(l-o))),f=Math.min(this.size-this.buffer,c+Math.ceil(n)),_=d+2*this.buffer,y=f+2*this.buffer,v=Math.max(_*y,0),b=new Uint8ClampedArray(v),E={data:b,width:_,height:y,glyphWidth:d,glyphHeight:f,glyphTop:c,glyphLeft:0,glyphAdvance:e};if(d===0||f===0)return E;const{ctx:M,buffer:A,gridInner:C,gridOuter:D}=this;M.clearRect(A,A,d,f),M.fillText(t,A,A+c);const V=M.getImageData(A,A,d,f);D.fill(Xu,0,v),C.fill(0,0,v);for(let N=0;N0?Q*Q:0,C[X]=Q<0?Q*Q:0}}vy(D,0,0,_,y,_,this.f,this.v,this.z),vy(C,A,A,d,f,_,this.f,this.v,this.z);for(let N=0;Npe+we[1]-we[0],M=v.reduce(E,0),A=b.reduce(E,0),C=d-M,D=f-A;let V=0,N=M,U=0,H=A,X=0,Q=C,ae=0,de=D;if(l.content&&n){const pe=l.content;V=Zd(v,0,pe[0]),U=Zd(b,0,pe[1]),N=Zd(v,pe[0],pe[2]),H=Zd(b,pe[1],pe[3]),X=pe[0]-V,ae=pe[1]-U,Q=pe[2]-pe[0]-N,de=pe[3]-pe[1]-H}const ye=(pe,we,De,Te)=>{const ke=Wd(pe.stretch-V,N,_,t.left),be=Hd(pe.fixed-X,Q,pe.stretch,M),Ie=Wd(we.stretch-U,H,y,t.top),Be=Hd(we.fixed-ae,de,we.stretch,A),Ee=Wd(De.stretch-V,N,_,t.left),Ve=Hd(De.fixed-X,Q,De.stretch,M),Oe=Wd(Te.stretch-U,H,y,t.top),Re=Hd(Te.fixed-ae,de,Te.stretch,A),et=new je(ke,Ie),Ke=new je(Ee,Ie),Ze=new je(Ee,Oe),Ne=new je(ke,Oe),st=new je(be/c,Be/c),Qe=new je(Ve/c,Re/c),Xe=e*Math.PI/180;if(Xe){const It=Math.sin(Xe),Kt=Math.cos(Xe),ti=[Kt,-It,It,Kt];et._matMult(ti),Ke._matMult(ti),Ne._matMult(ti),Ze._matMult(ti)}const ut=pe.stretch+pe.fixed,ft=De.stretch+De.fixed,ht=we.stretch+we.fixed,vt=Te.stretch+Te.fixed,zt=t.imageSecondary;return{tl:et,tr:Ke,bl:Ne,br:Ze,texPrimary:{x:l.paddedRect.x+Is+ut,y:l.paddedRect.y+Is+ht,w:ft-ut,h:vt-ht},texSecondary:zt?{x:zt.paddedRect.x+Is+ut,y:zt.paddedRect.y+Is+ht,w:ft-ut,h:vt-ht}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:st,pixelOffsetBR:Qe,minFontScaleX:Q/c/_,minFontScaleY:de/c/y,isSDF:i}};if(n&&(l.stretchX||l.stretchY)){const pe=Ty(v,C,M),we=Ty(b,D,A);for(let De=0;Del)&&(l=M.x),(!E||M.y>c)&&(c=M.y)}const f=Math.min(l-n,c-o);let _=f/2;const y=new $n([],a1);if(f===0)return new je(n,o);for(let E=n;Ev.d||!v.d)&&(v=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,b)),E.max-v.d<=e||(_=E.h/2,y.push(new gc(E.p.x-_,E.p.y-_,_,t)),y.push(new gc(E.p.x+_,E.p.y-_,_,t)),y.push(new gc(E.p.x-_,E.p.y+_,_,t)),y.push(new gc(E.p.x+_,E.p.y+_,_,t)),b+=4)}return i&&(console.log(`num probes: ${b}`),console.log(`best distance: ${v.d}`)),v.p}function a1(t,e){return e.max-t.max}class gc{constructor(e,i,n,o){this.p=new je(e,i),this.h=n,this.d=function(l,c){let d=!1,f=1/0;for(let _=0;_l.y!=A.y>l.y&&l.x<(A.x-M.x)*(l.y-M.y)/(A.y-M.y)+M.x&&(d=!d),f=Math.min(f,m_(l,M,A))}}return(d?1:-1)*Math.sqrt(f)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}}const rm=Number.POSITIVE_INFINITY,l1=Math.sqrt(2);function Ey(t,[e,i]){let n=0,o=0;if(i===rm){e<0&&(e=0);const l=e/l1;switch(t){case"top-right":case"top-left":o=l-7;break;case"bottom-right":case"bottom-left":o=7-l;break;case"bottom":o=7-e;break;case"top":o=e-7}switch(t){case"top-right":case"bottom-right":n=-l;break;case"top-left":case"bottom-left":n=l;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":o=i-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-i}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,o]}function nm(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function c1(t,e,i,n,o,l,c,d,f,_,y,v,b,E,M){let A=l.textMaxSize.evaluate(e,{},v);A===void 0&&(A=c);const C=t.layers[0].layout,D=C.get("icon-offset").evaluate(e,{},v),V=My(i.horizontal)||i.vertical,N=b.name==="globe",U=Ki,H=c/U,X=t.tilePixelRatio*A/U,Q=(ke=t.overscaling,t.zoom>18&&ke>2&&(ke>>=1),Math.max(Fe/(512*ke),1)*C.get("symbol-spacing")),ae=C.get("text-padding")*t.tilePixelRatio,de=C.get("icon-padding")*t.tilePixelRatio,ye=At(C.get("text-max-angle")),pe=C.get("text-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",we=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",De=C.get("symbol-placement"),Te=Q/2;var ke;const be=C.get("icon-text-fit").evaluate(e,{},v),Ie=C.get("icon-text-fit-padding").evaluate(e,{},v),Be=be!=="none";let Ee;t.hasAnyIconTextFit===!1&&Be&&(t.hasAnyIconTextFit=!0),n&&Be&&(t.allowVerticalPlacement&&i.vertical&&(Ee=hy(n,i.vertical,be,Ie,D,H)),V&&(n=hy(n,V,be,Ie,D,H)));const Ve=(Oe,Re,et)=>{if(Re.x<0||Re.x>=Fe||Re.y<0||Re.y>=Fe)return;let Ke=null;if(N){const{x:Ze,y:Ne,z:st}=b.projectTilePoint(Re.x,Re.y,et);Ke={anchor:new zo(Ze,Ne,st,0,void 0),up:b.upVector(et,Re.x,Re.y)}}(function(Ze,Ne,st,Qe,Xe,ut,ft,ht,vt,zt,It,Kt,ti,mt,qt,Wt,oi,_i,Si,gi,pi,Oi,Ai,Qi,ri,Sr,Pn){const cn=Ze.addToLineVertexArray(Ne,Qe);let un,Xa,Rs,Ya,mh,j0,G0,$0=0,q0=0,Z0=0,W0=0,Rm=-1,Lm=-1;const eo={};let H0=Al("");const Ja=st?st.anchor:Ne,km=vt.layout.get("icon-text-fit").evaluate(pi,{},ri)!=="none";let Om=0,Bm=0;if(vt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Om,Bm]=vt.layout.get("text-offset").evaluate(pi,{},ri).map(Br=>Br*Ki):(Om=vt.layout.get("text-radial-offset").evaluate(pi,{},ri)*Ki,Bm=rm),Ze.allowVerticalPlacement&&Xe.vertical){const Br=Xe.vertical;if(qt)j0=om(Br),ht&&(G0=om(ht));else{const Fr=vt.layout.get("text-rotate").evaluate(pi,{},ri)+90;Rs=Xd(zt,Ja,Ne,It,Kt,ti,Br,mt,Fr,Wt),ht&&(Ya=Xd(zt,Ja,Ne,It,Kt,ti,ht,_i,Fr))}}if(ut){const Br=vt.layout.get("icon-rotate").evaluate(pi,{},ri),Fr=wy(ut,Br,Ai,km),Mc=ht?wy(ht,Br,Ai,km):void 0;Xa=Xd(zt,Ja,Ne,It,Kt,ti,ut,_i,Br),$0=4*Fr.length;const X0=Ze.iconSizeData;let Ka=null;X0.kind==="source"?(Ka=[En*vt.layout.get("icon-size").evaluate(pi,{},ri)],Ka[0]>As&&vi(`${Ze.layerIds[0]}: Value for "icon-size" is >= ${Yu}. Reduce your "icon-size".`)):X0.kind==="composite"&&(Ka=[En*Oi.compositeIconSizes[0].evaluate(pi,{},ri),En*Oi.compositeIconSizes[1].evaluate(pi,{},ri)],(Ka[0]>As||Ka[1]>As)&&vi(`${Ze.layerIds[0]}: Value for "icon-size" is >= ${Yu}. Reduce your "icon-size".`)),Ze.addSymbols(Ze.icon,Fr,Ka,gi,Si,pi,!1,st,Ne,cn.lineStartIndex,cn.lineLength,-1,Qi,ri,Sr,Pn),Rm=Ze.icon.placedSymbolArray.length-1,Mc&&(q0=4*Mc.length,Ze.addSymbols(Ze.icon,Mc,Ka,gi,Si,pi,Xr.vertical,st,Ne,cn.lineStartIndex,cn.lineLength,-1,Qi,ri,Sr,Pn),Lm=Ze.icon.placedSymbolArray.length-1)}for(const Br in Xe.horizontal){const Fr=Xe.horizontal[Br];un||(H0=Al(Fr.text),qt?mh=om(Fr):un=Xd(zt,Ja,Ne,It,Kt,ti,Fr,mt,vt.layout.get("text-rotate").evaluate(pi,{},ri),Wt));const Mc=Fr.positionedLines.length===1;if(Z0+=Sy(Ze,st,Ne,Fr,ft,vt,qt,pi,Wt,cn,Xe.vertical?Xr.horizontal:Xr.horizontalOnly,Mc?Object.keys(Xe.horizontal):[Br],eo,Rm,Oi,Qi,ri,Sr),Mc)break}Xe.vertical&&(W0+=Sy(Ze,st,Ne,Xe.vertical,ft,vt,qt,pi,Wt,cn,Xr.vertical,["vertical"],eo,Lm,Oi,Qi,ri,Sr));let Ls=-1;const Fm=(Br,Fr)=>Br?Math.max(Br,Fr):Fr;Ls=Fm(mh,Ls),Ls=Fm(j0,Ls),Ls=Fm(G0,Ls);const Tb=Ls>-1?1:0;Ze.glyphOffsetArray.length>=65535&&vi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),pi.sortKey!==void 0&&Ze.addToSortKeyRanges(Ze.symbolInstances.length,pi.sortKey),Ze.symbolInstances.emplaceBack(Ne.x,Ne.y,Ja.x,Ja.y,Ja.z,eo.right>=0?eo.right:-1,eo.center>=0?eo.center:-1,eo.left>=0?eo.left:-1,eo.vertical>=0?eo.vertical:-1,Rm,Lm,H0,un!==void 0?un:Ze.collisionBoxArray.length,un!==void 0?un+1:Ze.collisionBoxArray.length,Rs!==void 0?Rs:Ze.collisionBoxArray.length,Rs!==void 0?Rs+1:Ze.collisionBoxArray.length,Xa!==void 0?Xa:Ze.collisionBoxArray.length,Xa!==void 0?Xa+1:Ze.collisionBoxArray.length,Ya||Ze.collisionBoxArray.length,Ya?Ya+1:Ze.collisionBoxArray.length,It,Z0,W0,$0,q0,Tb,0,Om,Bm,Ls,0,km?1:0)})(t,Re,Ke,Oe,i,n,o,Ee,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,ae,pe,f,0,de,we,D,e,l,_,y,v,E,M)};if(De==="line")for(const Oe of gy(e.geometry,0,0,Fe,Fe)){const Re=n1(Oe,Q,ye,i.vertical||V,n,U,X,t.overscaling,Fe);for(const et of Re)V&&u1(t,V.text,Te,et)||Ve(Oe,et,v)}else if(De==="line-center"){for(const Oe of e.geometry)if(Oe.length>1){const Re=r1(Oe,ye,i.vertical||V,n,U,X);Re&&Ve(Oe,Re,v)}}else if(e.type==="Polygon")for(const Oe of zd(e.geometry,0)){const Re=s1(Oe,16);Ve(Oe[0],new zo(Re.x,Re.y,0,0,void 0),v)}else if(e.type==="LineString")for(const Oe of e.geometry)Ve(Oe,new zo(Oe[0].x,Oe[0].y,0,0,void 0),v);else if(e.type==="Point")for(const Oe of e.geometry)for(const Re of Oe)Ve([Re],new zo(Re.x,Re.y,0,0,void 0),v)}const Yu=255,As=Yu*En;function Sy(t,e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C,D){const V=function(H,X,Q,ae,de,ye,pe,we){const De=[];if(X.positionedLines.length===0)return De;const Te=ae.layout.get("text-rotate").evaluate(ye,{})*Math.PI/180,ke=function(Ve){const Oe=Ve[0],Re=Ve[1],et=Oe*Re;return et>0?[Oe,-Re]:et<0?[-Oe,Re]:Oe===0?[Re,Oe]:[Re,-Oe]}(Q);let be=Math.abs(X.top-X.bottom);for(const Ve of X.positionedLines)be-=Ve.lineOffset;const Ie=X.positionedLines.length,Be=be/Ie;let Ee=X.top-Q[1];for(let Ve=0;VeAs&&vi(`${t.layerIds[0]}: Value for "text-size" is >= ${Yu}. Reduce your "text-size".`)):N.kind==="composite"&&(U=[En*M.compositeTextSizes[0].evaluate(d,{},C),En*M.compositeTextSizes[1].evaluate(d,{},C)],(U[0]>As||U[1]>As)&&vi(`${t.layerIds[0]}: Value for "text-size" is >= ${Yu}. Reduce your "text-size".`)),t.addSymbols(t.text,V,U,f,c,d,y,e,i,_.lineStartIndex,_.lineLength,E,A,C,D,!1);for(const H of v)b[H]=t.text.placedSymbolArray.length-1;return 4*V.length}function My(t){for(const e in t)return t[e];return null}function Xd(t,e,i,n,o,l,c,d,f,_){let y=c.top,v=c.bottom,b=c.left,E=c.right;const M=c.collisionPadding;if(M&&(b-=M[0],y-=M[1],E+=M[2],v+=M[3]),f){const A=new je(b,y),C=new je(E,y),D=new je(b,v),V=new je(E,v),N=At(f);let U=new je(0,0);_&&(U=new je(_[0],_[1])),A._rotateAround(N,U),C._rotateAround(N,U),D._rotateAround(N,U),V._rotateAround(N,U),b=Math.min(A.x,C.x,D.x,V.x),E=Math.max(A.x,C.x,D.x,V.x),y=Math.min(A.y,C.y,D.y,V.y),v=Math.max(A.y,C.y,D.y,V.y)}return t.emplaceBack(e.x,e.y,e.z,i.x,i.y,b,y,E,v,d,n,o,l),t.length-1}function om(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function u1(t,e,i,n){const o=t.compareText;if(e in o){const l=o[e];for(let c=l.length-1;c>=0;c--)if(n.dist(l[c])N&&(U(X,Te,ae,de,we,De),U(Te,Q,we,De,ye,pe))}U(v,b,n,l,o,l),U(b,E,o,l,o,c),U(E,M,o,c,n,c),U(M,v,n,c,n,l),A-=N,C-=N,D+=N,V+=N;const H=1/Math.max(D-A,V-C);return{scale:H,x:A*H,y:C*H,x2:D*H,y2:V*H,projection:e}}function Ay(t,{x:e,y:i},n=0){return new je(((e-n)*t.scale-t.x)*Fe,(i*t.scale-t.y)*Fe)}const h1=s.ae.identity(new Float32Array(16));class Cs{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new Vt(0,0)}projectTilePoint(e,i,n){return{x:e,y:i,z:0}}locationPoint(e,i,n=!0){return e._coordinatePoint(e.locationCoordinate(i),n)}pixelsPerMeter(e,i){return dr(1,e)*i}pixelSpaceConversion(e,i,n){return 1}farthestPixelDistance(e){return Iy(e,e.pixelsPerMeter)}pointCoordinate(e,i,n,o){const l=e.horizonLineFromTop(!1),c=new je(i,Math.max(l,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(c,o))}pointCoordinate3D(e,i,n){const o=new je(i,n);if(e.elevation)return e.elevation.pointCoordinate(o);{const l=this.pointCoordinate(e,o.x,o.y,0);return[l.x,l.y,l.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const n=e.horizonLineFromTop();return i.y0?i<-yc+n&&(i=-yc+n):i>yc-n&&(i=yc-n);const c=l/Math.pow(Jd(i),o);let d=c*Math.sin(o*e),f=l-c*Math.cos(o*e);return d=.5*(d/Math.PI+.5),f=.5*(f/Math.PI+.5),{x:d,y:this.southernCenter?f:1-f,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n,f:o}=this,l=o-i,c=Math.sign(l),d=Math.sign(n)*Math.sqrt(e*e+l*l);let f=Math.atan2(e,Math.abs(l))*c;l*n<0&&(f-=Math.PI*Math.sign(e)*c);const _=Et(sr(f/n)+this.center[0],-180,180),y=Et(sr(2*Math.atan(Math.pow(o/d,1/n))-yc),-Ti,Ti);return new Vt(_,this.southernCenter?-y:y)}}class Cy extends Cs{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:Hn(e),y:Xn(i),z:0}}unproject(e,i){const n=Er(e),o=Vi(i);return new Vt(n,o)}}const Py=At(Ti);class _1 extends Cs{project(e,i){const n=(i=At(i))*i,o=n*n;return{x:.5*((e=At(e))*(.8707-.131979*n+o*(o*(.003971*n-.001529*o)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+n*(.015085+o*(.028874*n-.044475-.005916*o)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,o=25,l=0,c=n*n;do{c=n*n;const _=c*c;l=(n*(1.007226+c*(.015085+_*(.028874*c-.044475-.005916*_)))-i)/(1.007226+c*(.045255+_*(.259866*c-.311325-.005916*11*_))),n=Et(n-l,-Py,Py)}while(Math.abs(l)>1e-6&&--o>0);c=n*n;const d=Et(sr(e/(.8707+c*(c*(c*c*c*(.003971-.001529*c)-.013791)-.131979))),-180,180),f=sr(n);return new Vt(d,f)}}const zy=At(Ti);class g1 extends Cs{project(e,i){i=At(i),e=At(e);const n=Math.cos(i),o=2/Math.PI,l=Math.acos(n*Math.cos(e/2)),c=Math.sin(l)/l,d=.5*(e*o+2*n*Math.sin(e/2)/c)||0,f=.5*(i+Math.sin(i)/c)||0;return{x:.5*(d/Math.PI+.5),y:1-.5*(f/Math.PI+1),z:0}}unproject(e,i){let n=e=(2*e-.5)*Math.PI,o=i=(2*(1-i)-1)*Math.PI,l=25;const c=1e-6;let d=0,f=0;do{const _=Math.cos(o),y=Math.sin(o),v=2*y*_,b=y*y,E=_*_,M=Math.cos(n/2),A=Math.sin(n/2),C=2*M*A,D=A*A,V=1-E*M*M,N=V?1/V:0,U=V?Math.acos(_*M)*Math.sqrt(1/V):0,H=.5*(2*U*_*A+2*n/Math.PI)-e,X=.5*(U*y+o)-i,Q=.5*N*(E*D+U*_*M*b)+1/Math.PI,ae=N*(C*v/4-U*y*A),de=.125*N*(v*A-U*y*E*C),ye=.5*N*(b*M+U*D*_)+.5,pe=ae*de-ye*Q;d=(X*ae-H*ye)/pe,f=(H*de-X*Q)/pe,n=Et(n-d,-Math.PI,Math.PI),o=Et(o-f,-zy,zy)}while((Math.abs(d)>c||Math.abs(f)>c)&&--l>0);return new Vt(sr(n),sr(o))}}class Dy extends Cs{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(At(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:n,cosPhi:o}=this;return{x:At(e)*o*n+.5,y:-Math.sin(At(i))/o*n+.5,z:0}}unproject(e,i){const{scale:n,cosPhi:o}=this,l=-(i-.5)/n,c=Et(sr((e-.5)/n)/o,-180,180),d=Math.asin(Et(l*o,-1,1)),f=Et(sr(d),-Ti,Ti);return new Vt(c,f)}}class y1 extends Cy{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,n){const o=ku(e,i,n),l=Ou(Yn(n));return s.$.transformMat4(o,o,l),{x:o[0],y:o[1],z:o[2]}}locationPoint(e,i){const n=Fa(i.lat,i.lng),o=s.$.normalize([],n),l=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude,c=dr(1,0)*Fe*l;s.$.scaleAndAdd(n,n,o,c);const d=s.ae.identity(new Float64Array(16));return s.ae.multiply(d,e.pixelMatrix,e.globeMatrix),s.$.transformMat4(n,n,d),new je(n[0],n[1])}pixelsPerMeter(e,i){return dr(1,0)*i}pixelSpaceConversion(e,i,n){const o=dr(1,e)*i,l=rt(dr(1,45)*i,o,n);return this.pixelsPerMeter(e,i)/l}createTileMatrix(e,i,n){const o=Bf(Yn(n.canonical));return s.ae.multiply(new Float64Array(16),e.globeMatrix,o)}createInversionMatrix(e,i){const{center:n}=e,o=Ou(Yn(i));return s.ae.rotateY(o,o,At(n.lng)),s.ae.rotateX(o,o,At(n.lat)),s.ae.scale(o,o,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(o)}pointCoordinate(e,i,n,o){return M_(e,i,n,!0)||new nr(0,0)}pointCoordinate3D(e,i,n){const o=this.pointCoordinate(e,i,n,0);return[o.x,o.y,o.z]}isPointAboveHorizon(e,i){return!M_(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(o,l){const c=o.cameraToCenterDistance,d=o._centerAltitude*l,f=o._camera,_=o._camera.forward(),y=s.$.add([],s.$.scale([],_,-c),[0,0,d]),v=o.worldSize/(2*Math.PI),b=[0,0,-v],E=o.width/o.height,M=Math.tan(o.fovAboveCenter),A=s.$.scale([],f.up(),M),C=s.$.scale([],f.right(),M*E),D=s.$.normalize([],s.$.add([],s.$.add([],_,A),C)),V=[];let N;if(new Df(y,D).closestPointOnSphere(b,v,V)){const U=s.$.add([],V,b),H=s.$.sub([],U,y);N=Math.cos(o.fovAboveCenter)*s.$.length(H)}else{const U=s.$.sub([],y,b),H=s.$.sub([],b,y);s.$.normalize(H,H);const X=s.$.length(U)-v;N=Math.sqrt(X*(X+2*v));const Q=Math.acos(N/(v+X))-Math.acos(s.$.dot(_,H));N*=Math.cos(Q)}return 1.01*N}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=Co(e.zoom);if(n>0){const o=Iy(e,dr(1,e.center.lat)*e.worldSize),l=e.worldSize/(2*Math.PI),c=Math.max(e.width,e.height)/e.worldSize*Math.PI;return rt(i,o+l*(1-Math.cos(c)),Math.pow(n,10))}return i}upVector(e,i,n){return ku(i,n,e,1)}upVectorScale(e){return{metersToTile:Sd(Id(Yn(e)))}}}function Ry(t){const e=t.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case"mercator":return new Cy(t);case"equirectangular":return new f1(t);case"naturalEarth":return new _1(t);case"equalEarth":return new p1(t);case"winkelTripel":return new g1(t);case"albers":return i?new Dy(t):new d1(t);case"lambertConformalConic":return i?new Dy(t):new m1(t);case"globe":return new y1(t)}throw new Error(`Invalid projection name: ${t.name}`)}const x1=Ld.types,v1=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Kd(t,e,i,n,o,l,c,d,f,_,y,v,b){const E=d?Math.min(As,Math.round(d[0])):0,M=d?Math.min(As,Math.round(d[1])):0;t.emplaceBack(e,i,Math.round(32*n),Math.round(32*o),l,c,(E<<1)+(f?1:0),M,16*_,16*y,256*v,256*b)}function Qd(t,e,i){t.emplaceBack(e,i)}function ep(t,e,i,n,o,l,c){t.emplaceBack(e,i,n,o,l,c)}function tp(t,e,i,n,o){t.emplaceBack(e,i,n,o),t.emplaceBack(e,i,n,o),t.emplaceBack(e,i,n,o),t.emplaceBack(e,i,n,o)}function b1(t){for(const e of t.sections)if(_t(e.text))return!0;return!1}class sm{constructor(e){this.layoutVertexArray=new ef,this.indexArray=new ki,this.programConfigurations=e,this.segments=new hi,this.dynamicLayoutVertexArray=new _s,this.opacityVertexArray=new rf,this.placedSymbolArray=new Zm,this.iconTransitioningVertexArray=new xs,this.globeExtVertexArray=new tf,this.zOffsetVertexArray=new tc}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,n,o,l){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ev.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Mv.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,v1,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,Iv.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Sv.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||l)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Ng.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||o)&&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(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}se(sm,"SymbolBuffers");class am{constructor(e,i,n){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new n,this.segments=new hi,this.collisionVertexArray=new sf,this.collisionVertexArrayExt=new _s}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Av.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Cv.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}se(am,"CollisionBuffers");class xc{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(c=>c.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=s.ae.identity([]),this.placementViewportMatrix=s.ae.identity([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Jf(this.zoom,i["text-size"]),this.iconSizeData=Jf(this.zoom,i["icon-size"]);const n=this.layers[0].layout,o=n.get("symbol-sort-key"),l=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&o.constantOr(1)!==void 0,this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(c=>Xr[c]),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=n.get("symbol-z-elevate"),this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new sm(new bs(this.layers,{zoom:this.zoom,lut:this.lut},e=>/^text/.test(e))),this.icon=new sm(new bs(this.layers,{zoom:this.zoom,lut:this.lut},e=>/^icon/.test(e))),this.glyphOffsetArray=new Xm,this.lineVertexArray=new Ym,this.symbolInstances=new Hm}calculateGlyphDependencies(e,i,n,o,l){for(let c=0;c0)&&(f.value.kind!=="constant"||f.value.value.length>0),b=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,E=c.get("symbol-sort-key");if(this.features=[],!v&&!b)return;const M=i.iconDependencies,A=i.glyphDependencies,C=i.availableImages,D=new at(this.zoom);for(const{feature:V,id:N,index:U,sourceLayerIndex:H}of e){const X=l._featureFilter.needGeometry,Q=Io(V,X);if(!l._featureFilter.filter(D,Q,n))continue;if(X||(Q.geometry=Tn(V,n,o)),d&&V.type!==1&&n.z<=5){const pe=Q.geometry,we=.98078528056,De=(Te,ke)=>{const be=ku(Te.x,Te.y,n,1),Ie=ku(ke.x,ke.y,n,1);return s.$.dot(be,Ie)=0;for(const De of ae.sections)if(De.image)M[De.image.namePrimary]=!0;else{const Te=Me(ae.toString()),ke=De.fontStack||pe,be=A[ke]=A[ke]||{};this.calculateGlyphDependencies(De.text,be,we,this.allowVerticalPlacement,Te)}}}c.get("symbol-placement")==="line"&&(this.features=function(V){const N={},U={},H=[];let X=0;function Q(pe){H.push(V[pe]),X++}function ae(pe,we,De){const Te=U[pe];return delete U[pe],U[we]=Te,H[Te].geometry[0].pop(),H[Te].geometry[0]=H[Te].geometry[0].concat(De[0]),Te}function de(pe,we,De){const Te=N[we];return delete N[we],N[pe]=Te,H[Te].geometry[0].shift(),H[Te].geometry[0]=De[0].concat(H[Te].geometry[0]),Te}function ye(pe,we,De){const Te=De?we[0][we[0].length-1]:we[0][0];return`${pe}:${Te.x}:${Te.y}`}for(let pe=0;pepe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((V,N)=>V.sortKey-N.sortKey)}update(e,i,n,o,l){const c=Object.keys(e).length!==0;if(c&&!this.stateDependentLayers.length)return;const d=c?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(e,i,d,n,o,l),this.icon.programConfigurations.updatePaintArrays(e,i,d,n,o,l)}updateZOffset(){const e=(l,c,d)=>{n+=c,n>l.length&&l.resize(n);for(let f=-c;f<0;f++)l.emplace(f+n,d)},i=(l,c,d)=>{o+=c,o>l.length&&l.resize(o);for(let f=-c;f<0;f++)l.emplace(f+o,d)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let n=0,o=0;for(let l=0;l0;if((d>0||f>0)&&(e(this.text.zOffsetVertexArray,d,y),e(this.text.zOffsetVertexArray,f,y)),v){const{placedIconSymbolIndex:b,verticalPlacedIconSymbolIndex:E}=c;b>=0&&i(this.icon.zOffsetVertexArray,_,y),E>=0&&i(this.icon.zOffsetVertexArray,c.numVerticalIconVertices,y)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}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.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Ry(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const n=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:o,y:l}of i)this.lineVertexArray.emplaceBack(o,l);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,i,n,o,l,c,d,f,_,y,v,b,E,M,A,C){const D=e.indexArray,V=e.layoutVertexArray,N=e.globeExtVertexArray,U=e.segments.prepareSegment(4*i.length,V,D,this.canOverlap?c.sortKey:void 0),H=this.glyphOffsetArray.length,X=U.vertexLength,Q=this.allowVerticalPlacement&&d===Xr.vertical?Math.PI/2:0,ae=c.text&&c.text.sections;for(let ye=0;ye=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:o),c=$d(this.textSizeData,e,l)/Ki;return this.tilePixelRatio*c}getSymbolInstanceIconSize(e,i,n){const o=this.icon.placedSymbolArray.get(n),l=$d(this.iconSizeData,e,o);return this.tilePixelRatio*l}_commitDebugCollisionVertexUpdate(e,i,n,o){e.emplaceBack(i,-n,-n,o),e.emplaceBack(i,n,-n,o),e.emplaceBack(i,n,n,o),e.emplaceBack(i,-n,n,o)}_updateTextDebugCollisionBoxes(e,i,n,o,l,c){for(let d=o;d0}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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const n=e.placedSymbolArray.get(i),o=n.vertexStartIndex+4*n.numGlyphs;for(let l=n.vertexStartIndex;lo[d]-o[f]||l[f]-l[d]),c}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;ethis.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===i?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,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(const i of this.symbolInstanceIndexes){const n=this.symbolInstances.get(i);this.featureSortOrder.push(n.featureIndex);const{rightJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:l,leftJustifiedTextSymbolIndex:c,verticalPlacedTextSymbolIndex:d,placedIconSymbolIndex:f,verticalPlacedIconSymbolIndex:_}=n;o>=0&&this.addIndicesForPlacedSymbol(this.text,o),l>=0&&l!==o&&this.addIndicesForPlacedSymbol(this.text,l),c>=0&&c!==l&&c!==o&&this.addIndicesForPlacedSymbol(this.text,c),d>=0&&this.addIndicesForPlacedSymbol(this.text,d),f>=0&&this.addIndicesForPlacedSymbol(this.icon,f),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}se(xc,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),xc.addDynamicAttributes=tp;class sn{constructor(e,i,n,o){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(i,o)}update(e,i,n){const{width:o,height:l}=e,{context:c}=this,{gl:d}=c;if(d.bindTexture(d.TEXTURE_2D,this.texture),c.pixelStoreUnpackFlipY.set(!1),c.pixelStoreUnpack.set(1),c.pixelStoreUnpackPremultiplyAlpha.set(this.format===d.RGBA&&(!i||i.premultiply!==!1)),this.useMipmap=!!(i&&i.useMipmap),n||this.size&&this.size[0]===o&&this.size[1]===l){const{x:f,y:_}=n||{x:0,y:0};if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap)d.texSubImage2D(d.TEXTURE_2D,0,f,_,d.RGBA,d.UNSIGNED_BYTE,e);else{let y=this.format,v=d.UNSIGNED_BYTE;this.format===d.R32F&&(y=d.RED,v=d.FLOAT),d.texSubImage2D(d.TEXTURE_2D,0,f,_,o,l,y,v,e.data)}}else if(this.size=[o,l],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap){let f=this.format;this.format===d.R8&&(f=d.RED),d.texImage2D(d.TEXTURE_2D,0,this.format,f,d.UNSIGNED_BYTE,e)}else{let f=this.format,_=this.format,y=d.UNSIGNED_BYTE,v=!1;this.format===d.DEPTH_COMPONENT&&(f=d.DEPTH_COMPONENT16,y=d.UNSIGNED_SHORT),this.format===d.DEPTH_STENCIL&&(f=d.DEPTH24_STENCIL8,y=d.UNSIGNED_INT_24_8,v=!0),this.format===d.R8&&(_=d.RED),this.format===d.R32F&&(y=d.FLOAT,_=d.RED),!this.useMipmap&&v?d.texStorage2D(d.TEXTURE_2D,1,f,o,l):d.texImage2D(d.TEXTURE_2D,0,f,o,l,0,_,y,e.data)}this.useMipmap&&d.generateMipmap(d.TEXTURE_2D)}bind(e,i,n=!1){const{context:o}=this,{gl:l}=o;l.bindTexture(l.TEXTURE_2D,this.texture),e!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,this.useMipmap&&!n?e===l.NEAREST?l.NEAREST_MIPMAP_NEAREST:l.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,n,o){const{context:l}=this,{gl:c}=l;c.bindTexture(c.TEXTURE_2D,this.texture),i!==this.magFilter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,this.useMipmap?e===c.NEAREST?c.NEAREST_MIPMAP_NEAREST:c.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),n!==this.wrapS&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,n),this.wrapS=n),o!==this.wrapT&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,o),this.wrapT=o)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class ip{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,i),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,i),this.wrapS=i)}}const an=32,Kn=33,Ps=new Uint16Array(8184);for(let t=0;t<2046;t++){let e=t+2,i=0,n=0,o=0,l=0,c=0,d=0;for(1&e?o=l=c=an:i=n=d=an;(e>>=1)>1;){const _=i+o>>1,y=n+l>>1;1&e?(o=i,l=n,i=c,n=d):(i=o,n=l,o=c,l=d),c=_,d=y}const f=4*t;Ps[f+0]=i,Ps[f+1]=n,Ps[f+2]=o,Ps[f+3]=l}const Qn=new Uint16Array(2178),zs=new Uint8Array(1089),rp=new Uint16Array(1089);function Ly(t){return t===0?-.03125:t===32?.03125:0}var np=$t([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class $a{constructor(e,i,n,o){this.id=$a.uniqueIdxCounter,$a.uniqueIdxCounter++,this.context=e;const l=e.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||o||i.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=$a.uniqueIdxCounter,$a.uniqueIdxCounter++;const i=this.context.gl;this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}$a.uniqueIdxCounter=0;class vc{constructor(e,i,n){this.func=e,this.mask=i,this.range=n}}vc.ReadOnly=!1,vc.ReadWrite=!0,vc.disabled=new vc(519,vc.ReadOnly,[0,1]);const lm=7680;class cm{constructor(e,i,n,o,l,c){this.test=e,this.ref=i,this.mask=n,this.fail=o,this.depthFail=l,this.pass=c}}cm.disabled=new cm({func:519,mask:0},0,0,lm,lm,lm);const th=771;class Or{constructor(e,i,n,o){this.blendFunction=e,this.blendColor=i,this.mask=n,this.blendEquation=o}}Or.Replace=[1,0,1,0],Or.disabled=new Or(Or.Replace,Ut.transparent,[!1,!1,!1,!1]),Or.unblended=new Or(Or.Replace,Ut.transparent,[!0,!0,!0,!0]),Or.alphaBlended=new Or([1,th,1,th],Ut.transparent,[!0,!0,!0,!0]),Or.alphaBlendedNonPremultiplied=new Or([770,th,770,th],Ut.transparent,[!0,!0,!0,!0]),Or.multiply=new Or([774,0,774,0],Ut.transparent,[!0,!0,!0,!0]);const um=1029,hm=2305;class Mn{constructor(e,i,n){this.enable=e,this.mode=i,this.frontFace=n}}Mn.disabled=new Mn(!1,um,hm),Mn.backCCW=new Mn(!0,um,hm),Mn.backCW=new Mn(!0,um,2304),Mn.frontCW=new Mn(!0,1028,2304),Mn.frontCCW=new Mn(!0,1028,hm);var w1=$t([{name:"a_index",type:"Int16",components:1}]);const ky={type:2,extent:Fe,loadGeometry:()=>[[new je(0,0),new je(Fe+1,0),new je(Fe+1,Fe+1),new je(0,Fe+1),new je(0,0)]]};class op{constructor(e,i,n,o,l){this.tileID=e,this.uid=yl(),this.uses=0,this.tileSize=i,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=l,o&&o.style&&(this._lastUpdatedBrightness=o.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",o&&o.transform&&(this.projection=o.transform.projection)}registerFadeDuration(e){const i=e+this.timeAdded;il.getLayer(_)).filter(Boolean);if(f.length!==0){d.layers=f,d.stateDependentLayerIds&&(d.stateDependentLayers=d.stateDependentLayerIds.map(_=>f.filter(y=>y.id===_)[0]));for(const _ of f)c[_.fqid]=d}}return c}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const l=this.buckets[o];if(l instanceof xc){if(this.hasSymbolBuckets=!0,!n)break;l.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const l=this.buckets[o];if(l instanceof xc&&l.hasRTLText){this.hasRTLText=!0,Mt.isLoading()||Mt.isLoaded()||gt()!=="deferred"||Ot();break}}this.queryPadding=0;for(const o in this.buckets){const l=this.buckets[o],c=i.style.getOwnLayer(o);if(!c)continue;const d=c.queryRadius(l);this.queryPadding=Math.max(this.queryPadding,d)}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas),this._lastUpdatedBrightness=e.brightness}else this.collisionBoxArray=new ff}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(e){return this.buckets[e.fqid]}upload(e){for(const o in this.buckets){const l=this.buckets[o];l.uploadPending()&&l.upload(e)}const i=e.gl,n=this.imageAtlas;if(n&&!n.uploaded){const o=!!Object.keys(n.patternPositions).length;this.imageAtlasTexture=new sn(e,n.image,i.RGBA,{useMipmap:o}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new sn(e,this.glyphAtlasImage,i.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new sn(e,this.lineAtlas.image,i.R8),this.lineAtlas.uploaded=!0)}prepare(e,i,n){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,n),!i||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const o=i.style.getBrightness();(this._lastUpdatedBrightness||o)&&(this._lastUpdatedBrightness&&o&&Math.abs(this._lastUpdatedBrightness-o)<.001||(this._lastUpdatedBrightness=o,this.updateBuckets(void 0,i)))}queryRenderedFeatures(e,i,n,o,l,c,d,f){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:o,pixelPosMatrix:d,transform:c,params:l,tileTransform:this.tileTransform},e,i,n):{}}querySourceFeatures(e,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const o=n.loadVTLayers(),l=i?i.sourceLayer:"",c=o._geojsonTileLayer||o[l];if(!c)return;const d=vn(i&&i.filter),{z:f,x:_,y}=this.tileID.canonical,v={z:f,x:_,y};for(let b=0;bn)o=!1;else if(i)if(this.expirationTime=0;C--){const D=4*C,V=Ps[D+0],N=Ps[D+1],U=Ps[D+2],H=Ps[D+3],X=V+U>>1,Q=N+H>>1,ae=X+Q-N,de=Q+V-X,ye=N*Kn+V,pe=H*Kn+U,we=Q*Kn+X,De=Math.hypot((Qn[2*ye+0]+Qn[2*pe+0])/2-Qn[2*we+0],(Qn[2*ye+1]+Qn[2*pe+1])/2-Qn[2*we+1])>=16;zs[we]=zs[we]||(De?1:0),C<1022&&(zs[we]=zs[we]||zs[(N+de>>1)*Kn+(V+ae>>1)]||zs[(H+de>>1)*Kn+(U+ae>>1)])}const v=new To,b=new ki;let E=0;function M(C,D){const V=D*Kn+C;return rp[V]===0&&(v.emplaceBack(Qn[2*V+0],Qn[2*V+1],C*Fe/an,D*Fe/an),rp[V]=++E),rp[V]-1}function A(C,D,V,N,U,H){const X=C+V>>1,Q=D+N>>1;if(Math.abs(C-U)+Math.abs(D-H)>1&&zs[Q*Kn+X])A(U,H,C,D,X,Q),A(V,N,U,H,X,Q);else{const ae=M(C,D),de=M(V,N),ye=M(U,H);b.emplaceBack(ae,de,ye)}}return A(0,0,an,an,an,0),A(an,an,0,0,0,an),{vertices:v,indices:b}}(this.tileID.canonical,i);o=c.vertices,l=c.indices}else{o=new To,l=new ki;for(const{x:d,y:f}of n)o.emplaceBack(d,f,0,0);const c=Fu(o.int16,void 0,4);for(let d=0;d0&&(d=s.ae.invert(new Float64Array(16),i.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,o,i,l,d,c),this._makeGlobeTileDebugTextBuffer(e,o,i,l,d,c)}_globePoint(e,i,n,o,l,c,d){let f=ku(e,i,n);if(c){const _=1<.5?E=-1:b<-.5&&(E=1);let M=(e/Fe+n.x)/_+E,A=(i/Fe+n.y)/_;M=(M-y)*o._pixelsPerMercatorPixel+y,A=(A-v)*o._pixelsPerMercatorPixel+v;const C=[M*o.worldSize,A*o.worldSize,0];s.$.transformMat4(C,C,c),f=Ao(f,C,d)}return s.$.transformMat4(f,f,l)}_makeGlobeTileDebugBorderBuffer(e,i,n,o,l,c){const d=new bn,f=new Au,_=new pd,y=(b,E,M,A,C)=>{const D=(M-b)/(C-1),V=(A-E)/(C-1),N=d.length;for(let U=0;Uv*E+M;for(let E=0;E=1;n--){const o=n===1?1:0,l=n===2?1:0;for(let c=0;c>>1^-(1&t[e]);return t}function L1(t,e){switch(e){case"uint32":return t;case"uint16":for(let i=0;i>4|(61440&n)>>8|(240&o)<<4|61440&o,t[i+1]=15&n|(3840&n)>>4|(15&o)<<8|(3840&o)<<4}return t;case"uint8":for(let i=0;i>6|(192&o)>>4|(192&l)>>2|192&c,t[i+1]=(48&n)>>4|(48&o)>>2|48&l|(48&c)<<2,t[i+2]=(12&n)>>2|12&o|(12&l)<<2|(12&c)<<4,t[i+3]=3&n|(3&o)<<2|(3&l)<<4|(3&c)<<6}return t;default:throw new Error(`Invalid pixel format, "${e}"`)}}var Yr=Uint8Array,ih=Uint16Array,k1=Int32Array,Oy=new Yr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),By=new Yr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),O1=new Yr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fy=function(t,e){for(var i=new ih(31),n=0;n<31;++n)i[n]=e+=1<>1|(21845&Ei)<<1;Uy[Ei]=((65280&(bc=(61680&(bc=(52428&bc)>>2|(13107&bc)<<2))>>4|(3855&bc)<<4))>>8|(255&bc)<<8)>>1}var rh=function(t,e,i){for(var n=t.length,o=0,l=new ih(e);o>f]=_;return c},nh=new Yr(288);for(Ei=0;Ei<144;++Ei)nh[Ei]=8;for(Ei=144;Ei<256;++Ei)nh[Ei]=9;for(Ei=256;Ei<280;++Ei)nh[Ei]=7;for(Ei=280;Ei<288;++Ei)nh[Ei]=8;var jy=new Yr(32);for(Ei=0;Ei<32;++Ei)jy[Ei]=5;var N1=rh(nh,9),V1=rh(jy,5),dm=function(t){for(var e=t[0],i=1;ie&&(e=t[i]);return e},In=function(t,e,i){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&i},pm=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)},U1=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],An=function(t,e,i){var n=new Error(e||U1[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,An),!i)throw n;return n},j1=new Yr(0),G1=typeof TextDecoder<"u"&&new TextDecoder;try{G1.decode(j1,{stream:!0})}catch{}const $1={gzip_data:"gzip"};class ln extends Error{constructor(e){super(e),this.name="MRTError"}}const q1={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Gy={uint32:1,uint16:2,uint8:4},Z1={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let fm,mm;class oh{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new ln(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),n=new DataView(e);if(i[0]!==13)throw new ln("File is not a valid MRT.");return n.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),n=this.getHeaderLength(e);if(i.length= ${n} but got buffer of length ${i.length}`);const o=function(l,c){return l.readFields(T1,{header_length:0,x:0,y:0,z:0,layers:[]},void 0)}(new fm(i.subarray(0,n)));if(!isNaN(this.x)&&(this.x!==o.x||this.y!==o.y||this.z!==o.z))throw new ln(`Invalid attempt to parse header ${o.z}/${o.x}/${o.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=o.x,this.y=o.y,this.z=o.z;for(const l of o.layers)this.layers[l.name]=new W1(l,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],n=this.getLayer(e.layerName);for(let o of e.blockIndices){const l=n.dataIndex[o],c=l.first_byte-e.firstByte,d=l.last_byte-e.firstByte;if(n._blocksInProgress.has(o))continue;const f={layerName:n.name,firstByte:c,lastByte:d,pixelFormat:n.pixelFormat,blockIndex:o,blockShape:[l.bands.length].concat(n.bandShape),buffer:n.buffer,codec:l.codec.codec,filters:l.filters.map(_=>_.filter)};n._blocksInProgress.add(o),i.push(f)}return new $y(i,()=>{i.forEach(o=>n._blocksInProgress.delete(o.blockIndex))},(o,l)=>{if(i.forEach(c=>n._blocksInProgress.delete(c.blockIndex)),o)throw o;l.forEach(c=>{this.getLayer(c.layerName).processDecodedData(c)})})}}class W1{constructor({version:e,name:i,units:n,tilesize:o,pixel_format:l,buffer:c,data_index:d},f){if(this.version=e,this.version!==1)throw new ln(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=n,this.tileSize=o,this.buffer=c,this.pixelFormat=q1[l],this.dataIndex=d,this.bandShape=[o+2*c,o+2*c,Gy[this.pixelFormat]],this._decodedBlocks=new z1(f?f.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return Gy[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[n,o]of this.dataIndex.entries()){for(const[l,c]of o.bands.entries())if(c===e)return{bandIndex:i+l,blockIndex:n,blockBandIndex:l};i+=o.bands.length}break;case"number":for(const[n,o]of this.dataIndex.entries()){if(e>=i&&ethis.cacheSize)throw new ln(`Number of blocks to decode (${l.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:n,blockIndices:o}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:n}=this.getBlockForBand(e),o=this._decodedBlocks.get(i.toString());if(!o)throw new ln(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const l=this.dataIndex[i],c=this.bandShape.reduce((_,y)=>_*y,1),d=n*c,f=o.subarray(d,d+c);return{data:f,bytes:new Uint8Array(f.buffer).subarray(f.byteOffset,f.byteOffset+f.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:l.offset!==0?l.offset:l.deprecated_offset,scale:l.scale!==0?l.scale:l.deprecated_scale}}}oh.setPbf=function(t){fm=t};class $y{constructor(e,i,n){this.tasks=e,this._onCancel=i,this._onComplete=n,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}oh.performDecoding=function(t,e){const i=new Uint8Array(t);return Promise.all(e.tasks.map(n=>{const{layerName:o,firstByte:l,lastByte:c,pixelFormat:d,blockShape:f,blockIndex:_,filters:y,codec:v}=n,b=i.subarray(l,c+1),E=new Uint32Array(f[0]*f[1]*f[2]);let M;if(v!=="gzip_data")throw new ln(`Unhandled codec: ${v}`);return M=function(A,C){if(!globalThis.DecompressionStream&&C==="gzip_data")return Promise.resolve(((U=function(Q){Q[0]==31&&Q[1]==139&&Q[2]==8||An(6,"invalid gzip data");var ae=Q[3],de=10;4&ae&&(de+=2+(Q[10]|Q[11]<<8));for(var ye=(ae>>3&1)+(ae>>4&1);ye>0;ye-=!Q[de++]);return de+(2&ae)}(N=A))+8>N.length&&An(6,"invalid gzip data"),function(Q,ae,de,ye){var pe=Q.length;if(!pe||ae.f&&!ae.l)return de||new Yr(0);var we=!de,De=we||ae.i!=2,Te=ae.i;we&&(de=new Yr(3*pe));var ke,be,Ie=function(Rs){var Ya=de.length;if(Rs>Ya){var mh=new Yr(Math.max(2*Ya,Rs));mh.set(de),de=mh}},Be=ae.f||0,Ee=ae.p||0,Ve=ae.b||0,Oe=ae.l,Re=ae.d,et=ae.m,Ke=ae.n,Ze=8*pe;do{if(!Oe){Be=In(Q,Ee,1);var Ne=In(Q,Ee+1,3);if(Ee+=3,!Ne){var st=Q[(mt=4+((Ee+7)/8|0))-4]|Q[mt-3]<<8,Qe=mt+st;if(Qe>pe){Te&&An(0);break}De&&Ie(Ve+st),de.set(Q.subarray(mt,Qe),Ve),ae.b=Ve+=st,ae.p=Ee=8*Qe,ae.f=Be;continue}if(Ne==1)Oe=N1,Re=V1,et=9,Ke=5;else if(Ne==2){var Xe=In(Q,Ee,31)+257,ut=In(Q,Ee+10,15)+4,ft=Xe+In(Q,Ee+5,31)+1;Ee+=14;for(var ht=new Yr(ft),vt=new Yr(19),zt=0;zt>4)<16)ht[zt++]=mt;else{var Wt=0,oi=0;for(mt==16?(oi=3+In(Q,Ee,3),Ee+=2,Wt=ht[zt-1]):mt==17?(oi=3+In(Q,Ee,7),Ee+=3):mt==18&&(oi=11+In(Q,Ee,127),Ee+=7);oi--;)ht[zt++]=Wt}}var _i=ht.subarray(0,Xe),Si=ht.subarray(Xe);et=dm(_i),Ke=dm(Si),Oe=rh(_i,et),Re=rh(Si,Ke)}else An(1);if(Ee>Ze){Te&&An(0);break}}De&&Ie(Ve+131072);for(var gi=(1<>4;if((Ee+=15&Wt)>Ze){Te&&An(0);break}if(Wt||An(2),Ai<256)de[Ve++]=Ai;else{if(Ai==256){Oi=Ee,Oe=null;break}var Qi=Ai-254;Ai>264&&(Qi=In(Q,Ee,(1<<(Pn=Oy[zt=Ai-257]))-1)+Vy[zt],Ee+=Pn);var ri=Re[pm(Q,Ee)&pi],Sr=ri>>4;if(ri||An(3),Ee+=15&ri,Si=F1[Sr],Sr>3){var Pn=By[Sr];Si+=pm(Q,Ee)&(1<Ze){Te&&An(0);break}De&&Ie(Ve+131072);var cn=Ve+Qi;if(Veke.length)&&(be=ke.length),new Yr(ke.subarray(0,be))):de.subarray(0,Ve)}(N.subarray(U,-8),{i:2},new Yr(((D=N)[(V=D.length)-4]|D[V-3]<<8|D[V-2]<<16|D[V-1]<<24)>>>0))));var D,V,N,U;const H=$1[C];if(!H)throw new Error(`Unhandled codec: ${C}`);const X=new globalThis.DecompressionStream(H);return new Response(new Blob([A]).stream().pipeThrough(X)).arrayBuffer().then(Q=>new Uint8Array(Q))}(b,v).then(A=>(function(C,D){C.readFields(C1,D)}(new fm(A),E),new Z1[d](E.buffer))),M.then(A=>{for(let C=y.length-1;C>=0;C--)switch(y[C]){case"delta_filter":D1(A,f);break;case"zigzag_filter":R1(A);break;case"bitshuffle_filter":L1(A,d);break;default:throw new ln(`Unhandled filter "${y[C]}"`)}return{layerName:o,blockIndex:_,data:A}}).catch(A=>{throw A})}))},oh.setPbf(Zu);class qy extends op{constructor(e,i,n,o,l){super(e,i,n,o,l),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(e,i){const n=i.context,o=n.gl;this.texture=this.texture||i.getTileTexture(e.width),this.texture&&this.texture instanceof sn?this.texture.update(e,{useMipmap:!1,premultiply:!1}):this.texture=new sn(n,e,o.RGBA,{useMipmap:!1,premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(e=16384,i){const n=this._mrt=new oh(30),o=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(e-1)}});return this.entireBuffer=null,this.request=uo(o,(l,c,d,f)=>{if(l)i(l);else try{const _=n.getHeaderLength(c);if(_>e)return void(this.request=this.fetchHeader(_,i));n.parseHeader(c),this._isHeaderLoaded=!0;let y=0;for(const v of Object.values(n.layers))y=Math.max(y,v.dataIndex[v.dataIndex.length-1].last_byte);c.byteLength>=y&&(this.entireBuffer=c),i(null,this.entireBuffer||c,d,f)}catch(_){i(_)}}),this.request}fetchBand(e,i,n){const o=this._mrt;if(!this._isHeaderLoaded||!o)return void n(new Error("Tile header is not ready"));const l=this.actor;if(!l)return void n(new Error("Can't fetch tile band without an actor"));let c;const d=(v,b)=>{c.complete(v,b),v?n(v):(this.updateTextureDescriptor(e,i),n(null,this.textureDescriptor&&this.textureDescriptor.img))},f=(v,b)=>{if(v)return n(v);const E=l.send("decodeRasterArray",{buffer:b,task:c},d,void 0,!0);this._workQueue.push(()=>{E&&E.cancel(),c.cancel()})},_=o.getLayer(e);if(!_)return void n(new Error(`Unknown sourceLayer "${e}"`));if(_.hasDataForBand(i))return this.updateTextureDescriptor(e,i),void n(null,this.textureDescriptor?this.textureDescriptor.img:null);const y=_.getDataRange([i]);if(c=o.createDecodingTask(y),!c||c.tasks.length)if(this.flushQueues(),this.entireBuffer)f(null,this.entireBuffer.slice(y.firstByte,y.lastByte+1));else{const v=Object.assign({},this.requestParams,{headers:{Range:`bytes=${y.firstByte}-${y.lastByte}`}}),b=uo(v,f);this._fetchQueue.push(()=>{b.cancel(),c.cancel()})}else n(null)}updateNeeded(e,i){return(!this.textureDescriptor||this.textureDescriptor.band!==i||this.textureDescriptor.layer!==e)&&this.state!=="errored"}updateTextureDescriptor(e,i){if(!this._mrt)return;const n=this._mrt.getLayer(e);if(!n||!n.hasBand(i)||!n.hasDataForBand(i))return;const{bytes:o,tileSize:l,buffer:c,offset:d,scale:f}=n.getBandView(i),_=l+2*c,y={data:o,width:_,height:_},v=this.texture;v&&v instanceof sn&&v.update(y,{useMipmap:!1,premultiply:!1}),this.textureDescriptor={layer:e,band:i,img:y,buffer:c,offset:d,tileSize:l,format:n.pixelFormat,mix:[f,256*f,65536*f,16777216*f]}}}class H1{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,n){const o=e.wrapped().key;this.data[o]===void 0&&(this.data[o]=[]);const l={value:i,timeout:void 0};if(n!==void 0&&(l.timeout=setTimeout(()=>{this.remove(e,l)},n)),this.data[o].push(l),this.order.push(o),this.order.length>this.max){const c=this._getAndRemoveByKey(this.order[0]);c&&this.onRemove(c)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const n=e.wrapped().key,o=i===void 0?0:this.data[n].indexOf(i),l=this.data[n][o];return this.data[n].splice(o,1),l.timeout&&clearTimeout(l.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(l.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const n in this.data)for(const o of this.data[n])e(o.value)||i.push(o);for(const n of i)this.remove(n.value.tileID,n)}}class qa extends mo{constructor(e,i,n){super(),this.id=e,this._onlySymbols=n,i.on("data",o=>{o.dataType==="source"&&o.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&o.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),i.on("error",()=>{this._sourceErrored=!0}),this._source=i,this._tiles={},this._cache=new H1(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=i.minTileCacheSize,this._maxTileCacheSize=i.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new qv,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(e){this.map=e,this._minTileCacheSize=this._minTileCacheSize===void 0&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,i){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,i)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const n=this._tiles[i];n.upload(e),n.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return jc(this._tiles).map(e=>e.tileID).sort(Zy).map(e=>e.key)}getRenderableIds(e,i){const n=[];for(const o in this._tiles)this._isIdRenderable(+o,e,i)&&n.push(this._tiles[o]);return e?n.sort((o,l)=>{const c=o.tileID,d=l.tileID,f=new je(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),_=new je(d.canonical.x,d.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-d.overscaledZ||_.y-f.y||_.x-f.x}).map(o=>o.tileID.key):n.map(o=>o.tileID).sort(Zy).map(o=>o.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())&&(n||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(+e,"reloading")}}_reloadTile(e,i){const n=this._tiles[e];n&&(n.state!=="loading"&&(n.state=i),this._loadTile(n,this._tileLoaded.bind(this,n,e,i)))}_tileLoaded(e,i,n,o){if(o)if(e.state="errored",o.status!==404)this._source.fire(new pa(o,{tile:e}));else{if(this._source.fire(new en("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:e})),!(e.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const l=this.map.painter.terrain;this.update(this.transform,l.getScaledDemTileSize(),!0),l.resetTileLookupCache(this.id)}else this.update(this.transform)}else e.timeAdded=Zi.now(),n==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this._source.type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new en("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const i=this.getRenderableIds();for(let o=0;o1||(Math.abs(c)>1&&(Math.abs(c+f)===1?c+=f:Math.abs(c-f)===1&&(c-=f)),l.dem&&o.dem&&(o.dem.backfillBorder(l.dem,c,d),o.neighboringTiles&&o.neighboringTiles[_]&&(o.neighboringTiles[_].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,n,o){for(const l in this._tiles){let c=this._tiles[l];if(o[l]||!c.hasData()||c.tileID.overscaledZ<=i||c.tileID.overscaledZ>n)continue;let d=c.tileID;for(;c&&c.tileID.overscaledZ>i+1;){const _=c.tileID.scaledTo(c.tileID.overscaledZ-1);c=this._tiles[_.key],c&&c.hasData()&&(d=_)}let f=d;for(;f.overscaledZ>i;)if(f=f.scaledTo(f.overscaledZ-1),e[f.key]){o[d.key]=d;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=i?n:null}for(let n=e.overscaledZ-1;n>=i;n--){const o=e.scaledTo(n),l=this._getLoadedTile(o);if(l)return l}}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,i){i=i||this._source.tileSize;const n=Math.ceil(e.width/i)+1,o=Math.ceil(e.height/i)+1,l=Math.floor(n*o*5),c=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,l):l,d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(d)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const n={};for(const o in this._tiles){const l=this._tiles[o];l.tileID=l.tileID.unwrapTo(l.tileID.wrap+i),n[l.tileID.key]=l}this._tiles=n;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(+o,this._tiles[o])}}update(e,i,n,o){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;this.updateCacheSize(e,i),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const l=this._source.type==="batched-model";let c;if(this.used||this.usedForTerrain){if(this._source.tileID)c=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(_=>new Pi(_.canonical.z,_.wrap,_.canonical.z,_.canonical.x,_.canonical.y));else if(this.tileCoverLift!==0){const _=e.clone();_.tileCoverLift=this.tileCoverLift,c=_.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:l}),this._source.minzoom<=1&&e.projection.name==="globe"&&(c.push(new Pi(1,0,1,0,0)),c.push(new Pi(1,0,1,1,0)),c.push(new Pi(1,0,1,0,1)),c.push(new Pi(1,0,1,1,1)))}else if(c=e.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:l}),this._source.hasTile){const _=this._source.hasTile.bind(this._source);c=c.filter(y=>_(y))}}else c=[];if(c.length>0&&this.castsShadows&&o&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!_m(this._source.type)){const _=e.coveringZoomLevel({tileSize:i||this._source.tileSize,roundZoom:this._source.roundZoom&&!n}),y=Math.min(_,this._source.maxzoom);if(l){const v=e.extendTileCover(c,y);for(const b of v)c.push(b)}else{const v=e.extendTileCover(c,y,o);for(const b of v)this._shadowCasterTiles[b.key]=!0,c.push(b)}}const d=this._updateRetainedTiles(c);if(_m(this._source.type)&&c.length!==0){const _={},y={},v=Object.keys(d);for(const E of v){const M=d[E],A=this._tiles[E];if(!A||A.fadeEndTime&&A.fadeEndTime<=Zi.now())continue;const C=this.findLoadedParent(M,Math.max(M.overscaledZ-qa.maxOverzooming,this._source.minzoom));C&&(this._addTile(C.tileID),_[C.tileID.key]=C.tileID),y[E]=M}const b=c[c.length-1].overscaledZ;for(const E in this._tiles){const M=this._tiles[E];if(d[E]||!M.hasData())continue;let A=M.tileID;for(;A.overscaledZ>b;){A=A.scaledTo(A.overscaledZ-1);const C=this._tiles[A.key];if(C&&C.hasData()&&y[A.key]){d[E]=M.tileID;break}}}for(const E in _)d[E]||(this._coveredTiles[E]=!0,d[E]=_[E])}for(const _ in d)this._tiles[_].clearFadeHold();const f=function(_,y){const v=[];for(const b in _)b in y||v.push(b);return v}(this._tiles,d);for(const _ of f){const y=this._tiles[_];y.hasSymbolBuckets&&!y.holdingForFade()?y.setHoldDuration(this.map._fadeDuration):y.hasSymbolBuckets&&!y.symbolFadeFinished()||this._removeTile(+_)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const i={};if(e.length===0)return i;const n={},o=e.reduce((_,y)=>Math.min(_,y.overscaledZ),1/0),l=e[0].overscaledZ,c=Math.max(l-qa.maxOverzooming,this._source.minzoom),d=Math.max(l+qa.maxUnderzooming,this._source.minzoom),f={};for(const _ of e){const y=this._addTile(_);i[_.key]=_,y.hasData()||o=this._source.maxzoom){const b=_.children(this._source.maxzoom)[0],E=this.getTile(b);if(E&&E.hasData()){i[b.key]=b;continue}}else{const b=_.children(this._source.maxzoom);if(i[b[0].key]&&i[b[1].key]&&i[b[2].key]&&i[b[3].key])continue}let v=y.wasRequested();for(let b=_.overscaledZ-1;b>=c;--b){const E=_.scaledTo(b);if(n[E.key]||(n[E.key]=!0,y=this.getTile(E),!y&&v&&(y=this._addTile(E)),y&&(i[E.key]=E,v=y.wasRequested(),y.hasData())))break}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let n,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){n=this._loadedParentTiles[o.key];break}i.push(o.key);const l=o.scaledTo(o.overscaledZ-1);if(n=this._getLoadedTile(l),n)break;o=l}for(const l of i)this._loadedParentTiles[l]=n}}_addTile(e){let i=this._tiles[e.key];if(i)return i.isExtraShadowCaster!==!0||this._shadowCasterTiles[e.key]||this._reloadTile(e.key,"reloading"),i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const n=!!i;if(!n){const o=this.map?this.map.painter:null,l=this._source.tileSize*e.overscaleFactor();i=this._source.type==="raster-array"?new qy(e,l,this.transform.tileZoom,o,this._isRaster):new op(e,l,this.transform.tileZoom,o,this._isRaster),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))}return i?(i.uses++,this._tiles[e.key]=i,n||this._source.fire(new en("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i):null}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const n=i.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},n))}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"||i.state==="empty"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(e,i,n){const o=[],l=this.transform;if(!l)return o;const c=l.projection.name==="globe",d=Hn(l.center.lng);for(const f in this._tiles){const _=this._tiles[f];if(n&&_.clearQueryDebugViz(),_.holdingForFade())continue;let y;if(c){const v=_.tileID.canonical;if(v.z===0){const b=[Math.abs(Et(d,...sh(v,-1))-d),Math.abs(Et(d,...sh(v,1))-d)];y=[0,2*b.indexOf(Math.min(...b))-1]}else{const b=[Math.abs(Et(d,...sh(v,-1))-d),Math.abs(Et(d,...sh(v,0))-d),Math.abs(Et(d,...sh(v,1))-d)];y=[b.indexOf(Math.min(...b))-1]}}else y=[0];for(const v of y){const b=e.containsTile(_,l,i,v);b&&o.push(b)}}return o}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,i){const n=this.getRenderableIds(e,i).map(l=>this._tiles[l].tileID),o=this.transform.projection.name==="globe";for(const l of n)l.projMatrix=this.transform.calculateProjMatrix(l.toUnwrapped()),l.expandedProjMatrix=o?this.transform.calculateProjMatrix(l.toUnwrapped(),!1,!0):l.projMatrix;return n}sortCoordinatesByDistance(e){const i=e.slice(),n=this.transform._camera.position,o=this.transform._camera.forward(),l={};for(const c of i){const d=1/(1<l[c.key]-l[d.key]),i}hasTransition(){if(this._source.hasTransition())return!0;if(_m(this._source.type))for(const e in this._tiles){const i=this._tiles[e];if(i.fadeEndTime!==void 0&&i.fadeEndTime>=Zi.now())return!0}return!1}setFeatureState(e,i,n){this._state.updateState(e=e||"_geojsonTileLayer",i,n)}removeFeatureState(e,i,n){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,n)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,n){const o=this._tiles[e];o&&o.setDependencies(i,n)}reloadTilesForDependencies(e,i){for(const n in this._tiles)this._tiles[n].hasDependency(e,i)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(e,i))}_preloadTiles(e,i){if(!this._sourceLoaded){const d=()=>{this._sourceLoaded&&(this._source.off("data",d),this._preloadTiles(e,i))};return void this._source.on("data",d)}const n=new Map,o=Array.isArray(e)?e:[e],l=this.map.painter.terrain,c=this.usedForTerrain&&l?l.getScaledDemTileSize():this._source.tileSize;for(const d of o){const f=d.coveringTiles({tileSize:c,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const _ of f)n.set(_.key,_);this.usedForTerrain&&d.updateElevation(!1)}Js(Array.from(n.values()),(d,f)=>{const _=new op(d,this._source.tileSize*d.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(_,y=>{this._source.type==="raster-dem"&&_.dem&&this._backfillDEM(_),f(y,_)})},i)}}function Zy(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function _m(t){return t==="raster"||t==="image"||t==="video"||t==="custom"}function sh(t,e){const i=1<mm||(mm={layout:Gg||(Gg=new ei({"line-cap":new Ye(me.layout_line["line-cap"]),"line-join":new Ye(me.layout_line["line-join"]),"line-miter-limit":new Le(me.layout_line["line-miter-limit"]),"line-round-limit":new Le(me.layout_line["line-round-limit"]),"line-sort-key":new Ye(me.layout_line["line-sort-key"]),"line-z-offset":new Ye(me.layout_line["line-z-offset"]),visibility:new Le(me.layout_line.visibility)})),paint:$g||($g=new ei({"line-opacity":new Ye(me.paint_line["line-opacity"]),"line-color":new Ye(me.paint_line["line-color"]),"line-translate":new Le(me.paint_line["line-translate"]),"line-translate-anchor":new Le(me.paint_line["line-translate-anchor"]),"line-width":new Ye(me.paint_line["line-width"]),"line-gap-width":new Ye(me.paint_line["line-gap-width"]),"line-offset":new Ye(me.paint_line["line-offset"]),"line-blur":new Ye(me.paint_line["line-blur"]),"line-dasharray":new Ye(me.paint_line["line-dasharray"]),"line-pattern":new Ye(me.paint_line["line-pattern"]),"line-gradient":new rr(me.paint_line["line-gradient"]),"line-trim-offset":new Le(me.paint_line["line-trim-offset"]),"line-trim-fade-range":new Le(me.paint_line["line-trim-fade-range"]),"line-trim-color":new Le(me.paint_line["line-trim-color"]),"line-emissive-strength":new Le(me.paint_line["line-emissive-strength"]),"line-border-width":new Ye(me.paint_line["line-border-width"]),"line-border-color":new Ye(me.paint_line["line-border-color"]),"line-occlusion-opacity":new Le(me.paint_line["line-occlusion-opacity"])}))},mm);class X1 extends Ye{possiblyEvaluate(e,i){return i=new at(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,n,o){return i=Gi({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,n,o)}}let ah,Hy,Xy,gm;function Yy(t,e){return e>0?e+2*t:t}class Jy{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:mr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.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}}se(Jy,"FormatSectionOverride",{omit:["defaultValue"]});const ym=()=>gm||(gm={layout:Hy||(Hy=new ei({"symbol-placement":new Le(me.layout_symbol["symbol-placement"]),"symbol-spacing":new Le(me.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Le(me.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ye(me.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Le(me.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Le(me.layout_symbol["symbol-z-elevate"]),"icon-allow-overlap":new Le(me.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Le(me.layout_symbol["icon-ignore-placement"]),"icon-optional":new Le(me.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Le(me.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ye(me.layout_symbol["icon-size"]),"icon-text-fit":new Ye(me.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ye(me.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ye(me.layout_symbol["icon-image"]),"icon-rotate":new Ye(me.layout_symbol["icon-rotate"]),"icon-padding":new Le(me.layout_symbol["icon-padding"]),"icon-keep-upright":new Le(me.layout_symbol["icon-keep-upright"]),"icon-offset":new Ye(me.layout_symbol["icon-offset"]),"icon-anchor":new Ye(me.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Le(me.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Le(me.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Le(me.layout_symbol["text-rotation-alignment"]),"text-field":new Ye(me.layout_symbol["text-field"]),"text-font":new Ye(me.layout_symbol["text-font"]),"text-size":new Ye(me.layout_symbol["text-size"]),"text-max-width":new Ye(me.layout_symbol["text-max-width"]),"text-line-height":new Ye(me.layout_symbol["text-line-height"]),"text-letter-spacing":new Ye(me.layout_symbol["text-letter-spacing"]),"text-justify":new Ye(me.layout_symbol["text-justify"]),"text-radial-offset":new Ye(me.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Le(me.layout_symbol["text-variable-anchor"]),"text-anchor":new Ye(me.layout_symbol["text-anchor"]),"text-max-angle":new Le(me.layout_symbol["text-max-angle"]),"text-writing-mode":new Le(me.layout_symbol["text-writing-mode"]),"text-rotate":new Ye(me.layout_symbol["text-rotate"]),"text-padding":new Le(me.layout_symbol["text-padding"]),"text-keep-upright":new Le(me.layout_symbol["text-keep-upright"]),"text-transform":new Ye(me.layout_symbol["text-transform"]),"text-offset":new Ye(me.layout_symbol["text-offset"]),"text-allow-overlap":new Le(me.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Le(me.layout_symbol["text-ignore-placement"]),"text-optional":new Le(me.layout_symbol["text-optional"]),visibility:new Le(me.layout_symbol.visibility)})),paint:Xy||(Xy=new ei({"icon-opacity":new Ye(me.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ye(me.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ye(me.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ye(me.paint_symbol["text-emissive-strength"]),"icon-color":new Ye(me.paint_symbol["icon-color"]),"icon-halo-color":new Ye(me.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ye(me.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ye(me.paint_symbol["icon-halo-blur"]),"icon-translate":new Le(me.paint_symbol["icon-translate"]),"icon-translate-anchor":new Le(me.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Ye(me.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ye(me.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ye(me.paint_symbol["text-occlusion-opacity"]),"text-color":new Ye(me.paint_symbol["text-color"],{runtimeType:Rr,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Ye(me.paint_symbol["text-halo-color"]),"text-halo-width":new Ye(me.paint_symbol["text-halo-width"]),"text-halo-blur":new Ye(me.paint_symbol["text-halo-blur"]),"text-translate":new Le(me.paint_symbol["text-translate"]),"text-translate-anchor":new Le(me.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Le(me.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Le(me.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Le(me.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Le(me.paint_symbol["icon-color-brightness-max"])}))},gm);class sp extends Tr{constructor(e,i,n,o){super(e,ym(),i,n,o),this._colorAdjustmentMatrix=s.ae.identity([]),this.hasInitialOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),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")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const o=[];for(const l of n)o.indexOf(l)<0&&o.push(l);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,n,o){return this._saturation===e&&this._contrast===i&&this._brightnessMin===n&&this._brightnessMax===o||(this._colorAdjustmentMatrix=function(l,c,d,f){l=Eh(l),c=Th(c);const _=s.ae.create(),y=l/3,v=1-2*y,b=[v,y,y,0,y,v,y,0,y,y,v,0,0,0,0,1],E=.5-.5*c,M=f-d;return s.ae.multiply(_,[M,0,0,0,0,M,0,0,0,0,M,0,d,d,d,1],[c,0,0,0,0,c,0,0,0,0,c,0,E,E,E,1]),s.ae.multiply(_,_,b),_}(e,i,n,o),this._saturation=e,this._contrast=i,this._brightnessMin=n,this._brightnessMax=o),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,n,o){const l=this.layout.get(e).evaluate(i,{},n,o),c=this._unevaluatedLayout._values[e];return c.isDataDriven()||$(c.value)||!l?l:function(d,f){return f.replace(/{([^{}]+)}/g,(_,y)=>y in d?String(d[y]):"")}(i.properties,l)}createBucket(e){return new xc(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of ym().paint.overridableProperties){if(!sp.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),n=new Jy(i),o=new G(n,i.property.specification,this.scope,this.options);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new J("source",o):new Z("composite",o,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new Li(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,n){return!(!this.layout||i.isDataDriven()||n.isDataDriven())&&sp.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const n=e.get("text-field"),o=ym().paint.properties[i];let l=!1;const c=d=>{for(const f of d)if(o.overrides&&o.overrides.hasOverride(f))return void(l=!0)};if(n.value.kind==="constant"&&n.value.value instanceof ir)c(n.value.value.sections);else if(n.value.kind==="source"){const d=_=>{l||(_ instanceof Zr&&Ii(_.value)===as?c(_.value.sections):_ instanceof go?c(_.sections):_.eachChild(d))},f=n.value;f._styleExpression&&d(f._styleExpression.expression)}return l}getProgramIds(){const e=this.paint.get("icon-opacity").constantOr(1)!==0,i=this.paint.get("text-opacity").constantOr(1)!==0,n=[];return e&&n.push("symbolIcon"),i&&n.push("symbolSDF"),n}getDefaultProgramParams(e,i,n){return{config:new Ba(this,{zoom:i,lut:n}),overrideFog:!1}}}let Ky,Qy,e0,t0;function ap(t,e,i,n,o,l,c,d){const f=[t,e,1,i,n,1,o,l,1],_=[c,d,1],y=s.bE.adjoint([],f),[v,b,E]=s.$.transformMat3(_,_,y);return s.bE.multiply(f,f,[v,0,0,0,b,0,0,0,E])}function i0(t,e,i,n,o,l,c,d){const f=function(_,y,v,b,E,M,A,C){const D=ap(0,0,1,0,1,1,0,1),V=ap(_,y,v,b,E,M,A,C),N=s.bE.adjoint([],D);return s.bE.multiply(V,V,N)}(t,e,i,n,o,l,c,d);return[f[2]/f[8]/Fe,f[5]/f[8]/Fe]}function lp(t){return[t[0],Math.min(Math.max(t[1],-Ti),Ti)]}class r0 extends mo{constructor(e,i,n,o){super(),this.id=e,this.dispatcher=n,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(o),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new en("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=ca(this.map._requestManager.transformRequest(this.url,aa.Image),(n,o)=>{this._imageRequest=null,this._loaded=!0,n?this.fire(new pa(n)):o&&(this.image=o instanceof HTMLImageElement?Zi.getImageData(o):o,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new ip(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new en("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof ip||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],n=e[0][1];for(const l of e)l[1]>n&&(n=l[1]),l[1]Ti?this.onNorthPole=!0:o<-Ti&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const l=e.map(nr.fromLngLat);this.tileID=function(c){let d=1/0,f=1/0,_=-1/0,y=-1/0;for(const A of c)d=Math.min(d,A.x),f=Math.min(f,A.y),_=Math.max(_,A.x),y=Math.max(y,A.y);const v=Math.max(_-d,y-f),b=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),E=Math.pow(2,b);let M=Math.floor((d+_)/2*E);return M>1&&(M-=1),new Na(b,M,Math.floor((f+y)/2*E))}(l),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new en("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const C in this.tiles){const D=this.tiles[C];D.state!=="loaded"&&(D.state="loaded",D.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Ga(new Na(0,0,0),this.map.transform.projection),n=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(C){const D=C[1].x-C[0].x,V=C[1].y-C[0].y,N=C[2].x-C[1].x,U=C[2].y-C[1].y,H=C[3].x-C[2].x,X=C[3].y-C[2].y,Q=C[0].x-C[3].x,ae=C[0].y-C[3].y,de=D*U-N*V,ye=N*X-H*U,pe=H*ae-Q*X,we=Q*V-D*ae;return de>0&&ye>0&&pe>0&&we>0||de<0&&ye<0&&pe<0&&we<0}(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const o=Ga(this.tileID,this.map.transform.projection),[l,c,d,f]=this.coordinates.map(C=>{const D=o.projection.project(C[0],C[1]);return Ay(o,D)._round()});this.perspectiveTransform=i0(l.x,l.y,c.x,c.y,d.x,d.y,f.x,f.y);const _=this._boundsArray=new To;_.emplaceBack(l.x,l.y,0,0),_.emplaceBack(c.x,c.y,Fe,0),_.emplaceBack(f.x,f.y,0,Fe),_.emplaceBack(d.x,d.y,Fe,Fe),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(_,np.members),this.boundsSegments=hi.simpleSegment(0,0,4,2);const y=[],v=function(C){return[lp(C[0]),lp(C[1]),lp(C[2]),lp(C[3])]}(this.coordinates),[b,E,M,A]=function(C){let D=C[0][0],V=D,N=C[0][1],U=N;for(let H=1;HV&&(V=C[H][0]),C[H][1]U&&(U=C[H][1]);return[D,N,V-D,U-N]}(v);{const C=new To,[D,V,N,U]=function(be){let Ie=be[0].x,Be=Ie,Ee=be[0].y,Ve=Ee;for(let Oe=1;OeBe&&(Be=be[Oe].x),be[Oe].yVe&&(Ve=be[Oe].y);return[Ie,Ee,Be-Ie,Ve-Ee]}(n),H=be=>[(be.x-D)/N,(be.y-V)/U],[X,Q,ae,de]=n.map(H),ye=function(be,Ie,Be,Ee,Ve,Oe,Re,et){const Ke=ap(0,0,1,0,1,1,0,1),Ze=ap(be,Ie,Be,Ee,Ve,Oe,Re,et),Ne=s.bE.adjoint([],Ze);return s.bE.multiply(Ke,Ke,Ne)}(X[0],X[1],Q[0],Q[1],ae[0],ae[1],de[0],de[1]);this.elevatedGlobePerspectiveTransform=i0(X[0],X[1],Q[0],Q[1],ae[0],ae[1],de[0],de[1]);const pe=(be,Ie)=>{y.push(be.lng);const Be=Math.round((be.lng-b)/M*Fe),Ee=Math.round((be.lat-E)/A*Fe),Ve=H(Ie),Oe=s.$.transformMat3([],[Ve[0],Ve[1],1],ye),Re=Math.round(Oe[0]/Oe[2]*Fe),et=Math.round(Oe[1]/Oe[2]*Fe);C.emplaceBack(Be,Ee,Re,et)},we=n[3].x-n[0].x,De=n[3].y-n[0].y,Te=n[2].x-n[1].x,ke=n[2].y-n[1].y;for(let be=0;be<65;be++){const Ie=be/64,Be=[n[0].x+Ie*we,n[0].y+Ie*De],Ee=[n[1].x+Ie*Te,n[1].y+Ie*ke],Ve=Ee[0]-Be[0],Oe=Ee[1]-Be[1];for(let Re=0;Re<65;Re++){const et=Re/64,Ke={x:Be[0]+Ve*et,y:Be[1]+Oe*et,z:0};pe(i.projection.unproject(Ke.x,Ke.y),Ke)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(C,np.members)}{this.maxLongitudeTriangleSize=0;let C=[],D=new ki;const V=(N,U,H)=>{D.emplaceBack(N,U,H);const X=y[N],Q=y[U],ae=y[H],de=Math.min(Math.min(X,Q),ae),ye=Math.max(Math.max(X,Q),ae)-de;ye>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=ye),C.push(de+ye/2)};for(let N=0;N<64;N++)for(let U=0;U<64;U++){const H=65*N+U,X=H+1,Q=H+65,ae=Q+1;V(H,Q,X),V(X,Q,ae)}[C,D]=function(N,U){const H=Array.from({length:N.length},(ae,de)=>de);H.sort((ae,de)=>N[ae]-N[de]);const X=[],Q=new ki;for(let ae=0;ae{c.segments.push({vertexOffset:0,primitiveOffset:v,vertexLength:i.segments[0].vertexLength,primitiveLength:b,sortKey:void 0,vaos:{}})},f=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-o)<=f){const v=wl(n,0,n.length,o+f);return v===n.length||d(v,bl(n,v+1,n.length,o+360-f)-v),c}o0){const l=function(c,d){const f=d.worldSize,_=dr(1,0)*f*Va(d.center.lat,d.zoom)/Ff(f),y=dr(1,d.center.lat)*f,v=s.ae.identity([]);return s.ae.rotateY(v,v,At(d.center.lng)),s.ae.rotateX(v,v,At(d.center.lat)),s.ae.translate(v,v,[0,0,hr]),s.ae.scale(v,v,[_,_,_*y]),s.ae.translate(v,v,[d.point.x-.5*f,d.point.y-.5*f,0]),s.ae.multiply(v,v,c),s.ae.multiply(v,d.globeMatrix,v)}(t,e);return function(c,d,f){const _=(M,A,C)=>{const D=s.$.length(M),V=s.$.length(A),N=Ao(M,A,C);return s.$.scale(N,N,1/s.$.length(N)*rt(D,V,C))},y=_([c[0],c[1],c[2]],[d[0],d[1],d[2]],f),v=_([c[4],c[5],c[6]],[d[4],d[5],d[6]],f),b=_([c[8],c[9],c[10]],[d[8],d[9],d[10]],f),E=Ao([c[12],c[13],c[14]],[d[12],d[13],d[14]],f);return[y[0],y[1],y[2],0,v[0],v[1],v[2],0,b[0],b[1],b[2],0,E[0],E[1],E[2],1]}(o,l,n)}return o}function _0(t,e,i,n){const o=ci.projectAabbCorners(n,i);let l=Number.MAX_VALUE,c=-1;for(let _=0;_new je(o[_][0],o[_][1]);let f;switch(c){case 0:case 6:f=[d(1),d(5),d(4),d(7),d(3),d(2),d(1)];break;case 1:case 7:f=[d(0),d(4),d(5),d(6),d(2),d(3),d(0)];break;case 3:case 5:f=[d(1),d(0),d(4),d(7),d(6),d(2),d(1)];break;default:f=[d(1),d(5),d(6),d(7),d(3),d(0),d(1)]}if(Af(t,f))return l}const K1=$t([{name:"a_pos_3f",components:3,type:"Float32"}]),Q1=$t([{name:"a_color_3f",components:3,type:"Float32"}]),eb=$t([{name:"a_color_4f",components:4,type:"Float32"}]),tb=$t([{name:"a_uv_2f",components:2,type:"Float32"}]),ib=$t([{name:"a_normal_3f",components:3,type:"Float32"}]),rb=$t([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),nb=$t([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);class hp{constructor(e,i,n,o){this.message=(e?`${e}: `:"")+n,o&&(this.identifier=o),i!=null&&i.__line__&&(this.line=i.__line__)}}function g0(t,e){const i=t.indexOf("://")===-1;try{return new URL(t,i&&e?"http://example.com":void 0),!0}catch{return!1}}class y0{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class x0{constructor(){this.instancedDataArray=new hf,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class bm{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0}updateFootprints(e,i){}populate(e,i,n,o){this.tileToMeter=vd(n);const l=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:c,id:d,index:f,sourceLayerIndex:_}of e){const y=d??(c.properties&&c.properties.hasOwnProperty("id")?c.properties.id:void 0),v=Io(c,l);if(!this.layers[0]._featureFilter.filter(new at(this.zoom),v,n))continue;const b={id:y,sourceLayerIndex:_,index:f,geometry:l?v.geometry:Tn(c,n,o),properties:c.properties,type:c.type,patterns:{}},E=this.addFeature(b,b.geometry,v);E&&i.featureIndex.insert(c,b.geometry,f,_,this.index,this.instancesPerModel[E].instancedDataArray.length,Fe/32)}this.lookup=null}update(e,i,n,o){for(const l in this.instancesPerModel){const c=this.instancesPerModel[l];for(const d in e)c.idToFeaturesIndex.hasOwnProperty(d)&&(this.evaluate(c.features[c.idToFeaturesIndex[d]],e[d],c,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];for(const o of n.features){const l=this.layers[0],c=o.feature,d=this.canonical,f=l.paint.get("model-rotation").evaluate(c,{},d),_=l.paint.get("model-scale").evaluate(c,{},d),y=l.paint.get("model-translation").evaluate(c,{},d);s.$.exactEquals(o.rotation,f)&&s.$.exactEquals(o.scale,_)&&s.$.exactEquals(o.translation,y)||(this.evaluate(o,o.featureStates,n,!0),e=!0)}}return e}updateReplacement(e,i,n,o){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const l=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Hf(this.activeReplacements,l))return!1;this.activeReplacements=l;let c=!1;for(const d in this.instancesPerModel){const f=this.instancesPerModel[d],_=f.instancedDataArray;for(const y of f.features){const v=y.instancedDataOffset,b=y.instancedDataCount;for(let E=0;EFe?A-Fe:A;const C=Math.floor(A),D=_.float32[M+1];let V=!1;for(const N of this.activeReplacements)if(!ag(N,n,bg.Model,o)&&!(N.min.x>C||C>N.max.x||N.min.y>D||D>N.max.y)&&(V=pg(dg(C,D,e.canonical,N.footprintTileId.canonical),N),V))break;_.float32[M]=V?A+Fe:A,c=c||V}}}return c}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length<0||n.instancedDataArray.length===0||(n.instancedDataBuffer?n.instancedDataBuffer.updateData(n.instancedDataArray):n.instancedDataBuffer=e.createVertexBuffer(n.instancedDataArray,rb.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length!==0&&n.instancedDataBuffer&&n.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris)for(const i of this.modelUris)e.removeModel(i,"")}addFeature(e,i,n){const o=this.layers[0],l=o.layout.get("model-id").evaluate(n,{},this.canonical);if(!l)return vi(`modelId is not evaluated for layer ${o.id} and it is not going to get rendered.`),l;g0(l,!1)&&(this.modelUris.includes(l)||this.modelUris.push(l)),this.instancesPerModel[l]||(this.instancesPerModel[l]=new x0);const c=this.instancesPerModel[l],d=c.instancedDataArray,f=new y0(n,d.length);for(const _ of i)for(const y of _){if(y.x<0||y.x>=Fe||y.y<0||y.y>=Fe)continue;const v=(this.lookupDim-1)/Fe,b=this.lookupDim*(y.y*v|0)+y.x*v|0;if(this.lookup){if(this.lookup[b]!==0)continue;this.lookup[b]=1}this.instanceCount++;const E=d.length;d.resize(E+1),c.instancesEvaluatedElevation.push(0),d.float32[16*E]=y.x,d.float32[16*E+1]=y.y}return f.instancedDataCount=c.instancedDataArray.length-f.instancedDataOffset,f.instancedDataCount>0&&(e.id&&(c.idToFeaturesIndex[e.id]=c.features.length),c.features.push(f),this.evaluate(f,{},c,!1)),l}getModelUris(){return this.modelUris}evaluate(e,i,n,o){const l=this.layers[0],c=e.feature,d=this.canonical,f=e.rotation=l.paint.get("model-rotation").evaluate(c,i,d),_=e.scale=l.paint.get("model-scale").evaluate(c,i,d),y=e.translation=l.paint.get("model-translation").evaluate(c,i,d),v=l.paint.get("model-color").evaluate(c,i,d);v.a=l.paint.get("model-color-mix-intensity").evaluate(c,i,d);const b=[];this.maxVerticalOffset10?this.tileToMeter:vd(d,N)),D[C+4]=y[0],D[C+5]=y[1],D[C+6]=y[2]+V,D[C+7]=b[0],D[C+8]=b[1],D[C+9]=b[2],D[C+10]=b[4],D[C+11]=b[5],D[C+12]=b[6],D[C+13]=b[8],D[C+14]=b[9],D[C+15]=b[10],n.instancesEvaluatedElevation[A]=y[2]}}}let v0,b0;se(bm,"ModelBucket",{omit:["layers"]}),se(x0,"PerModelAttributes"),se(y0,"ModelFeature");const Za=64,wc={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function w0(t,e,i,n,o,l,c,d,f,_=!1){const y=i.zoom,v=i.project(n),b=Va(n.lat,y),E=1/b;s.ae.identity(t),s.ae.translate(t,t,[v.x+c[0]*E,v.y+c[1]*E,c[2]]);let M=1,A=1;const C=i.worldSize;if(_){if(i.projection.name==="mercator"){let U=0;i.elevation&&(U=i.elevation.getAtPointOrZero(new nr(v.x/C,v.y/C),0));const H=s.aB.transformMat4([],[v.x,v.y,U,1],i.projMatrix)[3]/i.cameraToCenterDistance;M=H,A=H*Va(i.center.lat,y)}else if(i.projection.name==="globe"){const U=vm(t,i),H=s.ae.multiply([],i.projMatrix,U),X=[0,0,0,1];s.aB.transformMat4(X,X,H);const Q=X[3]/i.cameraToCenterDistance,ae=Co(y),de=i.projection.pixelsPerMeter(n.lat,C)*Va(n.lat,y),ye=i.projection.pixelsPerMeter(i.center.lat,C)*Va(i.center.lat,y);M=Q/rt(de,u_(i.center.lat),ae),A=Q*b/de,M*=ye,A*=ye}}else M=E;s.ae.scale(t,t,[M,M,A]);const D=[...t],V=e.orientation,N=[];if(m0(N,[V[0]+o[0],V[1]+o[1],V[2]+o[2]],l),s.ae.multiply(t,D,N),d&&i.elevation){let U=0;const H=[];if(f&&i.elevation){U=function(ae,de,ye,pe,we){const De=de.elevation;if(!De)return 0;const Te=ci.projectAabbCorners(ye,pe),ke=dr(1,we.lat)*de.worldSize,be=function(st,Qe){const Xe=[0,0,1],ut=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const ft of ut){const ht=st[ft.corners[0]],vt=st[ft.corners[1]],zt=st[ft.corners[2]],It=[vt[0]-ht[0],vt[1]-ht[1],Qe*(vt[2]-ht[2])],Kt=s.$.cross(It,It,[zt[0]-ht[0],zt[1]-ht[1],Qe*(zt[2]-ht[2])]);s.$.normalize(Kt,Kt),ft.dotProductWithUp=s.$.dot(Kt,Xe)}return ut.sort((ft,ht)=>ft.dotProductWithUp-ht.dotProductWithUp),ut[0].corners}(Te,ke),Ie=Te[be[0]],Be=Te[be[1]],Ee=Te[be[2]],Ve=Te[be[3]],Oe=De.getAtPointOrZero(new nr(Ie[0]/de.worldSize,Ie[1]/de.worldSize),0),Re=De.getAtPointOrZero(new nr(Be[0]/de.worldSize,Be[1]/de.worldSize),0),et=De.getAtPointOrZero(new nr(Ee[0]/de.worldSize,Ee[1]/de.worldSize),0),Ke=De.getAtPointOrZero(new nr(Ve[0]/de.worldSize,Ve[1]/de.worldSize),0),Ze=(Oe+Ke)/2,Ne=(Re+et)/2;return Ze>Ne?Re=e.gl.NEAREST_MIPMAP_NEAREST}),t.uploaded=!0,t.image=null)}function ob(t,e,i){t.indexBuffer=e.createIndexBuffer(t.indexArray,!1,!0),t.vertexBuffer=e.createVertexBuffer(t.vertexArray,K1.members,!1,!0),t.normalArray&&(t.normalBuffer=e.createVertexBuffer(t.normalArray,ib.members,!1,!0)),t.texcoordArray&&(t.texcoordBuffer=e.createVertexBuffer(t.texcoordArray,tb.members,!1,!0)),t.colorArray&&(t.colorBuffer=e.createVertexBuffer(t.colorArray,(t.colorArray.bytesPerElement===12?Q1:eb).members,!1,!0)),t.featureArray&&(t.pbrBuffer=e.createVertexBuffer(t.featureArray,nb.members,!0)),t.segments=hi.simpleSegment(0,0,t.vertexArray.length,t.indexArray.length);const n=t.material;n.pbrMetallicRoughness.baseColorTexture&&lh(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&lh(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&lh(n.normalTexture,e),n.occlusionTexture&&lh(n.occlusionTexture,e,i),n.emissionTexture&&lh(n.emissionTexture,e)}function wm(t,e,i){if(t.meshes)for(const n of t.meshes)ob(n,e,i);if(t.children)for(const n of t.children)wm(n,e,i)}function dp(t){if(t.meshes)for(const e of t.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(t.children)for(const e of t.children)dp(e)}function Tm(t){if(t.meshes)for(const i of t.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(t.children)for(const i of t.children)Tm(i)}class sb{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class ab{constructor(){this.tasks={},this.taskQueue=[],xl(["process"],this),this.invoker=new sb(this.process),this.nextId=0}add(e,i){const n=this.nextId++,o=function({type:l,isSymbolTile:c,zoom:d}){return d=d||0,l==="message"?0:l!=="maybePrepare"||c?l!=="parseTile"||c?l==="parseTile"&&c?300-d:l==="maybePrepare"&&c?400-d:500:200-d:100-d}(i);if(o===0){try{e()}finally{}return null}return this.tasks[n]={fn:e,metadata:i,priority:o,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(n=>!!this.tasks[n]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let o=0;o{n&&delete this.callbacks[d],this.target.postMessage({id:d,type:"",targetMapId:o,sourceMapId:this.mapId})}}}receive(e){const i=e.data,n=i.id;if(n&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type===""){const o=this.cancelCallbacks[n];delete this.cancelCallbacks[n],o&&o.cancel()}else if(i.mustQueue||es()){const o=this.callbacks[n],l=this.scheduler.add(()=>this.processTask(n,i),o&&o.metadata||{type:"message"});l&&(this.cancelCallbacks[n]=l)}else this.processTask(n,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type===""){const n=this.callbacks[e];delete this.callbacks[e],n&&(i.error?n(ve(i.error)):n(null,ve(i.data)))}else{const n=new Set,o=i.hasCallback?(c,d)=>{this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:c?he(c):null,data:he(d,n)},n)}:c=>{},l=ve(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,l,o);else if(this.parent.getWorkerSource){const c=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,c[0],l.source,l.scope)[c[1]](l,o)}else o(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class Tc{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=yl();const n=this.workerPool.acquire(this.id);for(let o=0;o{this.ready=!0})}broadcast(e,i,n){Js(this.actors,(o,l)=>{o.send(e,i,l)},n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}Tc.Actor=T0;var ch={workerUrl:"",workerClass:null,workerParams:void 0};function lb(){return ch.workerClass!=null?new ch.workerClass:new self.Worker(ch.workerUrl,ch.workerParams)}const Em="mapboxgl_preloaded_worker_pool";class uh{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Em]}numActive(){return Object.keys(this.active).length}}let hh;function pp(){return hh||(hh=new uh),hh}uh.workerCount=2;let fp,Sm,Cn,Ec,Mm,Sc=null;function E0(){return es()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:Sm||bt.DRACO_URL}function S0(){if(es()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Ec)return Ec;const t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Ec=WebAssembly.validate(t)?bt.MESHOPT_SIMD_URL:bt.MESHOPT_URL,Ec}const mp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},cb={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},dh={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function M0(t,e,i){const n=i.json.bufferViews.length,o=i.buffers.length;e.bufferView=n,i.json.bufferViews[n]={buffer:o,byteLength:t.byteLength},i.buffers[o]=t}const Im="KHR_draco_mesh_compression";function ub(t,e){const i=t.extensions&&t.extensions[Im];if(!i)return;const n=new Cn.Decoder,o=P0(e,i.bufferView),l=new Cn.Mesh;if(!n.DecodeArrayToMesh(o,o.byteLength,l))throw new Error("Failed to decode Draco mesh");const c=e.json.accessors[t.indices],d=mp[c.componentType],f=c.count*d.BYTES_PER_ELEMENT,_=Cn._malloc(f);d===Uint16Array?n.GetTrianglesUInt16Array(l,f,_):n.GetTrianglesUInt32Array(l,f,_),M0(Cn.memory.buffer.slice(_,_+f),c,e),Cn._free(_);for(const y of Object.keys(i.attributes)){const v=n.GetAttributeByUniqueId(l,i.attributes[y]),b=e.json.accessors[t.attributes[y]],E=cb[b.componentType],M=b.count*dh[b.type]*mp[b.componentType].BYTES_PER_ELEMENT,A=Cn._malloc(M);n.GetAttributeDataArrayForAllPoints(l,v,Cn[E],M,A),M0(Cn.memory.buffer.slice(A,A+M),b,e),Cn._free(A)}n.destroy(),l.destroy(),delete t.extensions[Im]}const _p="EXT_meshopt_compression";function hb(t,e){if(!t.extensions||!t.extensions[_p])return;const i=t.extensions[_p],n=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),o=new Uint8Array(i.count*i.byteStride);Mm.decodeGltfBuffer(o,i.count,i.byteStride,n,i.mode,i.filter),t.buffer=e.buffers.length,t.byteOffset=0,e.buffers[t.buffer]=o.buffer,delete t.extensions[_p]}const I0=1179937895,A0=new TextDecoder("utf8");function C0(t,e){return new URL(t,e).href}function db(t,e,i,n){return fetch(C0(t.uri,n)).then(o=>o.arrayBuffer()).then(o=>{e.buffers[i]=o})}function P0(t,e){const i=t.json.bufferViews[e];return new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function pb(t,e,i,n){if(t.uri){const o=C0(t.uri,n);return fetch(o).then(l=>l.blob()).then(l=>createImageBitmap(l)).then(l=>{e.images[i]=l})}if(t.bufferView!==void 0){const o=P0(e,t.bufferView),l=new Blob([o],{type:t.mimeType});return createImageBitmap(l).then(c=>{e.images[i]=c})}}function z0(t,e=0,i){const n={json:null,images:[],buffers:[]};if(new Uint32Array(t,e,1)[0]===I0){const y=new Uint32Array(t,e);let v=2;const b=(y[v++]>>2)-3,E=y[v++]>>2;if(v++,n.json=JSON.parse(A0.decode(y.subarray(v,v+E))),v+=E,v{const y=[],v=d&&d.includes(Im),b=d&&d.includes(_p);if(v&&y.push(function(){if(!Cn)return fp||(fp=function(E){let M,A=null;function C(){M=new Uint8Array(A.buffer)}function D(){throw new Error("Unexpected Draco error.")}const V={a:{a:D,d:function(N,U,H){return M.copyWithin(N,U,U+H)},c:function(N){const U=M.length,H=Math.max(N>>>0,Math.ceil(1.2*U)),X=Math.ceil((H-U)/65536);try{return A.grow(X),C(),!0}catch{return!1}},b:D}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(E,V):E.then(N=>N.arrayBuffer()).then(N=>WebAssembly.instantiate(N,V))).then(N=>{const{Rb:U,Qb:H,P:X,T:Q,X:ae,Ja:de,La:ye,Qa:pe,Va:we,Wa:De,eb:Te,jb:ke,f:be,e:Ie,yb:Be,zb:Ee,Ab:Ve,Bb:Oe,Db:Re,Gb:et}=N.instance.exports;A=Ie;const Ke=(()=>{let Ze=0,Ne=0,st=0,Qe=0;return Xe=>{st&&(U(Qe),U(Ze),Ne+=st,st=Ze=0),Ze||(Ne+=128,Ze=H(Ne));const ut=Xe.length+7&-8;let ft=Ze;ut>=Ne&&(st=ut,ft=Qe=H(ut));for(let ht=0;ht{Cn=E,fp=void 0}))}()),b&&y.push(function(){if(Mm)return;const E=function(M){let A;const C=WebAssembly.instantiateStreaming(M,{}).then(N=>{A=N.instance,A.exports.__wasm_call_ctors()}),D={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},V={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:C,supported:!0,decodeGltfBuffer(N,U,H,X,Q,ae){(function(de,ye,pe,we,De,Te,ke){const be=de.exports.sbrk,Ie=we+3&-4,Be=be(Ie*De),Ee=be(Te.length),Ve=new Uint8Array(de.exports.memory.buffer);Ve.set(Te,Ee);const Oe=ye(Be,we,De,Ee,Te.length);if(Oe===0&&ke&&ke(Be,Ie,De),pe.set(Ve.subarray(Be,Be+we*De)),be(Be-be(0)),Oe!==0)throw new Error(`Malformed buffer data: ${Oe}`)})(A,A.exports[V[Q]],N,U,H,X,A.exports[D[ae]])}}}(fetch(S0()));return E.ready.then(()=>{Mm=E})}()),l)for(let E=0;E{if(v&&c)for(const{primitives:E}of c)for(const M of E)ub(M,n);if(b&&c&&f)for(const E of f)hb(E,n);return n})})}function Wa(t,e){const i=t.json.bufferViews[e.bufferView],n=mp[e.componentType];return new n(t.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==dh[e.type]*n.BYTES_PER_ELEMENT?i.byteStride/n.BYTES_PER_ELEMENT:dh[e.type]))}function Am(t,e,i,n){const o=mp[e.componentType],l=function(y){switch(y){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(o),c=t.json.bufferViews[e.bufferView],d=c.byteStride?c.byteStride/o.BYTES_PER_ELEMENT:dh[e.type],f=i.float32,_=f.length/i.capacity;for(let y=0,v=0;y0){for(let C=0;C0){l.texcoordArray=new Cu;const b=e.json.accessors[o.TEXCOORD_0];l.texcoordArray.resize(b.count);const E=Wa(e,b);Am(e,b,l.texcoordArray,E)}if(o._FEATURE_ID_RGBA4444!==void 0){const b=e.json.accessors[o._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(l.featureData=Wa(e,b))}o._FEATURE_RGBA4444!==void 0&&(l.featureData=new Uint32Array(Wa(e,e.json.accessors[o._FEATURE_RGBA4444]).buffer));const v=t.material;return l.material=function(b,E){const{emissiveFactor:M=[0,0,0],alphaMode:A="OPAQUE",alphaCutoff:C=.5,normalTexture:D,occlusionTexture:V,emissiveTexture:N,doubleSided:U}=b,{baseColorFactor:H=[1,1,1,1],metallicFactor:X=1,roughnessFactor:Q=1,baseColorTexture:ae,metallicRoughnessTexture:de}=b.pbrMetallicRoughness||{},ye=V?E[V.index]:void 0;if(V&&V.extensions&&V.extensions.KHR_texture_transform&&ye){const pe=V.extensions.KHR_texture_transform;ye.offsetScale=[pe.offset[0],pe.offset[1],pe.scale[0],pe.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Ut(...H),metallicFactor:X,roughnessFactor:Q,baseColorTexture:ae?E[ae.index]:void 0,metallicRoughnessTexture:de?E[de.index]:void 0},doubleSided:U,emissiveFactor:M,alphaMode:A,alphaCutoff:C,normalTexture:D?E[D.index]:void 0,occlusionTexture:ye,emissionTexture:N?E[N.index]:void 0,defined:b.defined===void 0}}(v!==void 0?e.json.materials[v]:{defined:!1},i),l}function D0(t,e,i){const{matrix:n,rotation:o,translation:l,scale:c,mesh:d,extras:f,children:_}=t,y={};if(y.matrix=n||s.ae.fromRotationTranslationScale([],o||[0,0,0,1],l||[0,0,0],c||[1,1,1]),d!==void 0){y.meshes=i[d];const v=y.anchor=[0,0];for(const b of y.meshes){const{min:E,max:M}=b.aabb;v[0]+=E[0]+M[0],v[1]+=E[1]+M[1]}v[0]=Math.floor(v[0]/y.meshes.length/2),v[1]=Math.floor(v[1]/y.meshes.length/2)}if(f&&(f.id&&(y.id=f.id),f.lights&&(y.lights=function(v){if(!v.length)return[];const b=function(D){const V=atob(D),N=new Uint8Array(V.length);for(let U=0;U1&&n[n.length-1].equals(n[0])&&n.pop();let o=0;for(let c=0;c0&&n.reverse();const l=Fu(n.flatMap(c=>[c.x,c.y]),[]);return l.length===0?null:{vertices:n,indices:l}}function gb(t,e){const i=[],n=[];let o=0;const l=[];for(const c of t){o=i.length;const d=c.vertexArray.float32,f=c.indexArray.uint16;for(let _=0;_0&&([n[c+1],n[c+2]]=[n[c+2],n[c+1]])}return{vertices:i,indices:n}}function R0(t){const e=function(f,_){const y=[],v=WebGL2RenderingContext;if(f.json.textures)for(const b of f.json.textures){const E={magFilter:v.LINEAR,minFilter:v.NEAREST,wrapS:v.REPEAT,wrapT:v.REPEAT};b.sampler!==void 0&&Object.assign(E,f.json.samplers[b.sampler]),y.push({image:_[b.source],sampler:E,uploaded:!1})}return y}(t,t.images),i=function(f,_){const y=[];for(const v of f.json.meshes){const b=[];for(const E of v.primitives)b.push(fb(E,f,_));y.push(b)}return y}(t,e),{scenes:n,scene:o,nodes:l}=t.json,c=n?n[o||0].nodes:l,d=[];for(const f of c)d.push(D0(l[f],t,i));return function(f,_,y){const v={},b=new Set;for(let E=0;E0){const E=Array.from(b.values()).sort((M,A)=>M-A);for(let M=E.length-1;M>=0;M--)f.splice(E[M],1)}}(d,c,t.json.nodes),d}function yb(t){t.heightmap=new Float32Array(4096),t.heightmap.fill(-1);const e=t.vertexArray.float32,i=t.aabb.min[0]-1,n=t.aabb.min[1]-1,o=Za/(t.aabb.max[0]-i+2),l=Za/(t.aabb.max[1]-n+2);for(let c=0;ct.heightmap[_*Za+f]&&(t.heightmap[_*Za+f]=d)}}function xb(t,e){const i={};i.indexArray=new ki,i.indexArray.reserve(4*t.length),i.vertexArray=new gs,i.vertexArray.reserve(10*t.length),i.colorArray=new _s,i.vertexArray.reserve(10*t.length);let n=0;for(const c of t){const d=Math.min(10,Math.max(4,1.3*c.height))*e,f=[-c.normal[1],c.normal[0],0],_=Math.min(.29,.1*c.width/c.depth),y=c.width-2*c.depth*e*(_+.01),v=s.$.scaleAndAdd([],c.pos,f,y/2),b=s.$.scaleAndAdd([],c.pos,f,-y/2),E=[v[0],v[1],v[2]+c.height],M=[b[0],b[1],b[2]+c.height],A=s.$.scaleAndAdd([],c.normal,f,_);s.$.scale(A,A,d);const C=s.$.scaleAndAdd([],c.normal,f,-_);s.$.scale(C,C,d),s.$.add(A,v,A),s.$.add(C,b,C),v[2]+=.1,b[2]+=.1,i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(C[0],C[1],C[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(E[0],E[1],E[2]),i.vertexArray.emplaceBack(M[0],M[1],M[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(A[0],A[1],A[2]),i.vertexArray.emplaceBack(C[0],C[1],C[2]);const D=y/d/2;i.colorArray.emplaceBack(-D-_,-1,D,.8),i.colorArray.emplaceBack(D+_,-1,D,.8),i.colorArray.emplaceBack(-D,0,D,1.3),i.colorArray.emplaceBack(D,0,D,1.3),i.colorArray.emplaceBack(D+_,-.8,D,.7),i.colorArray.emplaceBack(D+_,-.8,D,.7),i.colorArray.emplaceBack(0,0,D,1.3),i.colorArray.emplaceBack(0,0,D,1.3),i.colorArray.emplaceBack(D+_,-1.2,D,.8),i.colorArray.emplaceBack(D+_,-1.2,D,.8),i.indexArray.emplaceBack(6+n,4+n,8+n),i.indexArray.emplaceBack(7+n,9+n,5+n),i.indexArray.emplaceBack(0+n,1+n,2+n),i.indexArray.emplaceBack(1+n,3+n,2+n),n+=10}const o={defined:!0,emissiveFactor:[0,0,0]},l={};return l.baseColorFactor=Ut.white,o.pbrMetallicRoughness=l,i.material=o,i.aabb=new ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const Cm=new Float32Array(262144),Ha=new Uint8Array(262144);function L0(t){let e=0;if(t.meshes)for(const i of t.meshes)e=Math.max(e,i.aabb.max[2]);if(t.children)for(const i of t.children)e=Math.max(e,L0(i));return e}function k0(t,e,i){if(t.meshes)for(const n of t.meshes)n.aabb.min[0]!==1/0&&i.insert(e,n.aabb.min[0],n.aabb.min[1],n.aabb.max[0],n.aabb.max[1]);if(t.children)for(const n of t.children)k0(n,e,i)}const O0=["","wall","door","roof","window","lamp","logo"];class B0{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.feature={type:"Point",id:e.id,geometry:[],properties:{height:L0(e)}},this.aabb=this._getLocalBounds()}_getLocalBounds(){if(!this.node.meshes)return new ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const n of this.node.meshes)this.node.lightMeshIndex!==e&&(n.transformedAabb=ci.applyTransformFast(n.aabb,this.node.matrix),i.encapsulate(n.transformedAabb)),e++;this.aabb=i}return this.aabb}}class gp{constructor(e,i,n,o,l,c){this.id=i,this.modelTraits|=wc.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=wc.HasMapboxMeshFeatures),o&&(this.modelTraits|=wc.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=l,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[];for(const d of e)this.nodesInfo.push(new B0(d)),k0(d,c.featureIndexArray.length,c.grid),c.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,c.bucketLayerIDs.length-1,0)}updateFootprints(e,i){for(const n of this.getNodesInfo()){const o=n.node;o.footprint&&i.push({footprint:o.footprint,id:e})}}update(){console.log("Update 3D model bucket")}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const n of i){const o=n.node;this.uploaded?this.updatePbrBuffer(o):wm(o,e,!0)}for(const n of i)dp(n.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const n of e.meshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),i=!0);return i}needsReEvaluation(e,i,n){const o=e.transform.projectionOptions,l=e.style.getBrightness(),c=this.brightness!==l;return!!(!this.uploaded||this.dirty||o.name!==this.projection.name||ph(n.paint.get("model-color").value,c)||ph(n.paint.get("model-color-mix-intensity").value,c)||ph(n.paint.get("model-roughness").value,c)||ph(n.paint.get("model-emissive-strength").value,c)||ph(n.paint.get("model-height-based-emissive-strength-multiplier").value,c))&&(this.projection=o,this.brightness=l,!0)}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const n=this.getNodesInfo(),o=this.id.canonical;for(const l of n){const c=l.feature;l.evaluatedScale=i.paint.get("model-scale").evaluate(c,{},o)}}evaluate(e){const i=this.getNodesInfo();for(const n of i){if(!n.node.meshes)continue;const o=n.feature,l=n.node.meshes&&n.node.meshes[0].featureData,c=n.evaluatedColor[2],d=n.evaluatedRMEA[2],f=this.id.canonical;if(n.hasTranslucentParts=!1,l){for(let _=0;_=X)continue;const Ie=Cm[be],Be=Math.abs(Ie);Be>pe&&(ye=Ie,pe=Be,we=ke,De=Te)}if(pe>.1){const Te=1-(X+.5*Math.abs(we*De))/M;let ke=i._dem.get(ae,Q)+ye*Te;const be=i._dem.get(ae+we,Q+De),Ie=i._dem.get(ae-we,Q-De,!0);(ke-be)*(ke-Ie)>0&&(ke=(be+Ie)/2),Cm[de]=i._dem.set(ae,Q,ke),Ha[de]=X}}}}}d&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Zi.now())}getNodesInfo(){return this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)dp(i.node),Tm(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped()),o=this.getNodesInfo();for(let l=0;ld.footprint===c.footprint)}}getHeightAtTileCoord(e,i){const n=this.getNodesInfo(),o=[],l=[0,0,0],c=s.ae.identity([]);for(let d=0;dy.max[0]||i>y.max[1])continue;if(f.node.hidden===!0)return{height:0,maxHeight:f.feature.properties.height,hidden:!1,verticalScale:f.evaluatedScale[2]};s.ae.invert(c,f.node.matrix),l[0]=e,l[1]=i,s.$.transformMat4(l,l,c);const v=(l[0]-_.aabb.min[0])/(_.aabb.max[0]-_.aabb.min[0])*Za|0,b=Math.min(63,(l[1]-_.aabb.min[1])/(_.aabb.max[1]-_.aabb.min[1])*Za|0)*Za+Math.min(63,v),E=_.heightmap[b];if(!(E<0&&f.node.footprint))return f.hiddenByReplacement?void 0:{height:E,maxHeight:f.feature.properties.height,hidden:!1,verticalScale:f.evaluatedScale[2]};if(f.node.footprint.grid.query(new je(e,i),new je(e,i),o),o.length>0)return{height:void 0,maxHeight:f.feature.properties.height,hidden:f.hiddenByReplacement,verticalScale:f.evaluatedScale[2]}}}}function ph(t,e){return!t.isLightConstant&&e}function vb(t,e,i,n,o,l,c,d){let f=(61440&e|(61440&e)>>4)>>8,_=(3840&e|(3840&e)>>4)>>4,y=240&e|(240&e)>>4;i[3]>0&&(f=rt(f,255*i[0],i[3]),_=rt(_,255*i[1],i[3]),y=rt(y,255*i[2],i[3]));const v=f<<8|_,b=y<<8|Math.floor(255*n[3]),E=function(X){const Q=Et(X,0,2);return Math.min(Math.round(.5*Q*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],M=Et(o[0],0,1),A=Et(o[1],0,1),C=Et(o[2],0,1),D=Et(o[3],0,1);let V,N,U,H;if(M!==A&&c!==l&&A!==M){const X=c-l;N=1/(X*(A-M)),U=-(l+X*M)/(X*(A-M));const Q=Et(o[4],-1,1);H=Math.pow(10,Q),V=255*C<<8|255*D}else V=65535,N=0,U=1,H=1;if(t.emplaceBack(v,b,E,V,N,U,H),d){const X=d.length;d.clear();for(let Q=0;Q>16&65535,y=l?f>>16&65535:65535&f,v=(15&y)<8?15&y:0,b=t.evaluatedRMEA[v],E=t.evaluatedColor[v],M=t.emissionHeightBasedParams[v];let A;if(d&&v===2&&n.lights&&(A=new gd,A.resize(10*n.lights.length)),vb(c.featureArray,_,E,b,M,c.aabb.min[2],c.aabb.max[2],A),A&&d){d=!1;const C=n.meshes[n.lightMeshIndex];C.featureArray=A,C.featureArray._trim()}}c.featureArray._trim(),o++}}function F0(t,e,i,n){const o=1<U.polygon).flat());const C=E?d:null,[D,V]=function(U,H,X,Q,ae,de,ye,pe,we,De,Te){return U.projection.name==="globe"?function(ke,be,Ie,Be,Ee,Ve,Oe,Re,et,Ke,Ze){const Ne=[],st=[],Qe=ke.projection.upVectorScale(Ze,ke.center.lat,ke.worldSize).metersToTile,Xe=[0,0,0,1],ut=[0,0,0,1],ft=(vt,zt,It,Kt)=>{vt[0]=zt,vt[1]=It,vt[2]=Kt,vt[3]=1},ht=Rg();Ie>0&&(Ie+=ht),Be+=ht;for(const vt of be){const zt=[],It=[];for(const Kt of vt){const ti=Kt.x+Ee.x,mt=Kt.y+Ee.y,qt=ke.projection.projectTilePoint(ti,mt,Ze),Wt=ke.projection.upVector(Ze,Kt.x,Kt.y);let oi=Ie,_i=Be;if(Oe){const Si=Fg(ti,mt,Ie,Be,Oe,Re,et,Ke);oi+=Si.base,_i+=Si.top}Ie!==0?ft(Xe,qt.x+Wt[0]*Qe*oi,qt.y+Wt[1]*Qe*oi,qt.z+Wt[2]*Qe*oi):ft(Xe,qt.x,qt.y,qt.z),ft(ut,qt.x+Wt[0]*Qe*_i,qt.y+Wt[1]*Qe*_i,qt.z+Wt[2]*Qe*_i),s.$.transformMat4(Xe,Xe,Ve),s.$.transformMat4(ut,ut,Ve),zt.push(new ja(Xe[0],Xe[1],Xe[2])),It.push(new ja(ut[0],ut[1],ut[2]))}Ne.push(zt),st.push(It)}return[Ne,st]}(U,H,X,Q,ae,de,ye,pe,we,De,Te):ye?function(ke,be,Ie,Be,Ee,Ve,Oe,Re,et){const Ke=[],Ze=[],Ne=[0,0,0,1];for(const st of ke){const Qe=[],Xe=[];for(const ut of st){const ft=ut.x+Be.x,ht=ut.y+Be.y,vt=Fg(ft,ht,be,Ie,Ve,Oe,Re,et);Ne[0]=ft,Ne[1]=ht,Ne[2]=vt.base,Ne[3]=1,s.aB.transformMat4(Ne,Ne,Ee),Ne[3]=Math.max(Ne[3],1e-5);const zt=new ja(Ne[0]/Ne[3],Ne[1]/Ne[3],Ne[2]/Ne[3]);Ne[0]=ft,Ne[1]=ht,Ne[2]=vt.top,Ne[3]=1,s.aB.transformMat4(Ne,Ne,Ee),Ne[3]=Math.max(Ne[3],1e-5);const It=new ja(Ne[0]/Ne[3],Ne[1]/Ne[3],Ne[2]/Ne[3]);Qe.push(zt),Xe.push(It)}Ke.push(Qe),Ze.push(Xe)}return[Ke,Ze]}(H,X,Q,ae,de,ye,pe,we,De):function(ke,be,Ie,Be,Ee){const Ve=[],Oe=[],Re=Ee[8]*be,et=Ee[9]*be,Ke=Ee[10]*be,Ze=Ee[11]*be,Ne=Ee[8]*Ie,st=Ee[9]*Ie,Qe=Ee[10]*Ie,Xe=Ee[11]*Ie;for(const ut of ke){const ft=[],ht=[];for(const vt of ut){const zt=vt.x+Be.x,It=vt.y+Be.y,Kt=Ee[0]*zt+Ee[4]*It+Ee[12],ti=Ee[1]*zt+Ee[5]*It+Ee[13],mt=Ee[2]*zt+Ee[6]*It+Ee[14],qt=Ee[3]*zt+Ee[7]*It+Ee[15],Wt=Kt+Re,oi=ti+et,_i=mt+Ke,Si=Math.max(qt+Ze,1e-5),gi=Kt+Ne,pi=ti+st,Oi=mt+Qe,Ai=Math.max(qt+Xe,1e-5);ft.push(new ja(Wt/Si,oi/Si,_i/Si)),ht.push(new ja(gi/Ai,pi/Ai,Oi/Ai))}Ve.push(ft),Oe.push(ht)}return[Ve,Oe]}(H,X,Q,ae,de)}(l,n,v,y,_,c,C,b,M,l.center.lat,t.tileID.canonical),N=t.queryGeometry;return function(U,H,X){let Q=1/0;f_(X,H)&&(Q=Bg(X,H[0]));for(let ae=0;ae{if(ah)return ah;const i=Wy();return ah=new X1(i.paint.properties["line-width"].specification),ah.useIntegerZoom=!0,ah})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Ud(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(t,e,i){const n=Hg(this);return{config:new Ba(this,{zoom:e,lut:i}),defines:n,overrideFog:!1}}queryRadius(t){const e=t,i=Yy(lc("line-width",this,e),lc("line-gap-width",this,e)),n=lc("line-offset",this,e);return i/2+Math.abs(n)+Td(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,o,l){if(t.queryGeometry.isAboveHorizon)return!1;const c=y_(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),d=t.pixelToTileUnitsFactor/2*Yy(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),f=this.paint.get("line-offset").evaluate(e,i);return f&&(n=function(_,y){const v=[],b=new je(0,0);for(let E=0;E<_.length;E++){const M=_[E],A=[];for(let C=0;C=3){for(let M=0;M>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const l=N0[15&n];if(!l)throw new Error("Unrecognized array type.");const[c]=new Uint16Array(e,2,1),[d]=new Uint32Array(e,4,1);return new Pm(d,c,l,e)}constructor(e,i=64,n=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const l=N0.indexOf(this.ArrayType),c=2*e*this.ArrayType.BYTES_PER_ELEMENT,d=e*this.IndexArrayType.BYTES_PER_ELEMENT,f=(8-d%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${n}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+f,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+c+d+f),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+f,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=i,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return zm(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,n,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:c,nodeSize:d}=this,f=[0,l.length-1,0],_=[];for(;f.length;){const y=f.pop()||0,v=f.pop()||0,b=f.pop()||0;if(v-b<=d){for(let C=b;C<=v;C++){const D=c[2*C],V=c[2*C+1];D>=e&&D<=n&&V>=i&&V<=o&&_.push(l[C])}continue}const E=b+v>>1,M=c[2*E],A=c[2*E+1];M>=e&&M<=n&&A>=i&&A<=o&&_.push(l[E]),(y===0?e<=M:i<=A)&&(f.push(b),f.push(E-1),f.push(1-y)),(y===0?n>=M:o>=A)&&(f.push(E+1),f.push(v),f.push(1-y))}return _}within(e,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:l,nodeSize:c}=this,d=[0,o.length-1,0],f=[],_=n*n;for(;d.length;){const y=d.pop()||0,v=d.pop()||0,b=d.pop()||0;if(v-b<=c){for(let C=b;C<=v;C++)U0(l[2*C],l[2*C+1],e,i)<=_&&f.push(o[C]);continue}const E=b+v>>1,M=l[2*E],A=l[2*E+1];U0(M,A,e,i)<=_&&f.push(o[E]),(y===0?e-n<=M:i-n<=A)&&(d.push(b),d.push(E-1),d.push(1-y)),(y===0?e+n>=M:i+n>=A)&&(d.push(E+1),d.push(v),d.push(1-y))}return f}}function zm(t,e,i,n,o,l){if(o-n<=i)return;const c=n+o>>1;V0(t,e,c,n,o,l),zm(t,e,i,n,c-1,1-l),zm(t,e,i,c+1,o,1-l)}function V0(t,e,i,n,o,l){for(;o>n;){if(o-n>600){const _=o-n+1,y=i-n+1,v=Math.log(_),b=.5*Math.exp(2*v/3),E=.5*Math.sqrt(v*b*(_-b)/_)*(y-_/2<0?-1:1);V0(t,e,i,Math.max(n,Math.floor(i-y*b/_+E)),Math.min(o,Math.floor(i+(_-y)*b/_+E)),l)}const c=e[2*i+l];let d=n,f=o;for(fh(t,e,n,i),e[2*o+l]>c&&fh(t,e,n,o);dc;)f--}e[2*n+l]===c?fh(t,e,n,f):(f++,fh(t,e,f,o)),f<=i&&(n=f+1),i<=f&&(o=f-1)}}function fh(t,e,i,n){Dm(t,i,n),Dm(e,2*i,2*n),Dm(e,2*i+1,2*n+1)}function Dm(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function U0(t,e,i,n){const o=t-i,l=e-n;return o*o+l*l}s.A=Gl,s.B=Aa,s.C=Ut,s.D=Ma,s.E=mo,s.F=cr,s.H=xn,s.I=$a,s.J=S,s.K=x,s.L=function(t){const e=t.value;let i=[];if(!e)return i;const n=jn(e);return n!=="string"?(i=i.concat([new hp(t.key,e,`string expected, "${n}" found`)]),i):(g0(e,!0)||(i=i.concat([new hp(t.key,e,`invalid url "${e}"`)])),i)},s.M=class{constructor(t,e,i,n){this.id=t,this.position=e!=null?new Vt(e[0],e[1]):new Vt(0,0),this.orientation=i??[0,0,0],this.nodes=n,this.uploaded=!1,this.aabb=new ci([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(t,e){if(s.ae.multiply(t.matrix,e,t.matrix),t.meshes)for(const i of t.meshes){const n=ci.applyTransformFast(i.aabb,t.matrix);this.aabb.encapsulate(n)}if(t.children)for(const i of t.children)this._applyTransformations(i,t.matrix)}computeBoundsAndApplyParent(){const t=s.ae.identity([]);for(const e of this.nodes)this._applyTransformations(e,t)}computeModelMatrix(t,e,i,n,o,l,c=!1){w0(this.matrix,this,t.transform,this.position,e,i,n,o,l,c)}upload(t){if(!this.uploaded){for(const e of this.nodes)wm(e,t);for(const e of this.nodes)dp(e);this.uploaded=!0}}destroy(){for(const t of this.nodes)Tm(t)}},s.N=me,s.O=Xi,s.P=je,s.Q=Gi,s.R=aa,s.S=df,s.T=sn,s.U=ei,s.V=hp,s.W=Le,s.X=class{constructor(t){this.specification=t}possiblyEvaluate(t,e){return Qo(t.expression.evaluate(e))}interpolate(t,e,i){return{x:rt(t.x,e.x,i),y:rt(t.y,e.y,i),z:rt(t.z,e.z,i),azimuthal:rt(t.azimuthal,e.azimuthal,i),polar:rt(t.polar,e.polar,i)}}},s.Y=at,s.Z=Z,s._=nr,s.a=Or,s.a$=Rf,s.a0=Uc,s.a1=Ni,s.a2=Co,s.a3=rt,s.a4=Fe,s.a5=ou,s.a6=class{constructor(t){this.specification=t}possiblyEvaluate(t,e){return function([i,n]){const o=Qo([1,i,n]);return{x:o.x,y:o.y,z:o.z}}(t.expression.evaluate(e))}interpolate(t,e,i){return{x:rt(t.x,e.x,i),y:rt(t.y,e.y,i),z:rt(t.z,e.z,i)}}},s.a7=zu,s.a8=xd,s.a9=So,s.aA=function(t,e,i){t[4*e+0]=i[0],t[4*e+1]=i[1],t[4*e+2]=i[2],t[4*e+3]=i[3]},s.aC=function(t,e){const{x:i,y:n}=t.point,o=D_(i,n,t.worldSize/t._pixelsPerMercatorPixel,0,0);return s.ae.multiply(o,o,Bf(Yn(e)))},s.aE=fc,s.aF=Xr,s.aG=$d,s.aH=function(t,e,i,n,o){const l=5*e+2;t.float32[l+0]=i,t.float32[l+1]=n,t.float32[l+2]=o},s.aI=tp,s.aJ=Vt,s.aK=Ry,s.aL=l_,s.aM=Lf,s.aN=d0,s.aO=Na,s.aP=C_,s.aQ=Pi,s.aR=function(t,e,i,n,o,l,c,d,f){if(f.name==="globe")return C_(t,e,new Na(i,n,o),!1);const _=Ga({z:i,x:n,y:o},f);return new ci([(l+_.x/_.scale)*e,e*(_.y/_.scale),c],[(l+_.x2/_.scale)*e,e*(_.y2/_.scale),d])},s.aS=function(t,e,i){let n=0;for(let o=0;o<2;++o)t[o]>0&&(n+=(t[o]-0)*(t[o]-0)),e[o]<0&&(n+=(0-e[o])*(0-e[o]));return n},s.aT=Ti,s.aU=Df,s.aV=s_,s.aW=function(t){const e=s.ae.identity(new Float64Array(16));s.ae.multiply(e,t.pixelMatrix,t.globeMatrix);const i=[0,nn,0],n=[0,on,0];return s.$.transformMat4(i,i,e),s.$.transformMat4(n,n,e),[i[0]>0&&i[0]<=t.width&&i[1]>0&&i[1]<=t.height&&!Nf(t,new Vt(t.center.lat,90)),n[0]>0&&n[0]<=t.width&&n[1]>0&&n[1]<=t.height&&!Nf(t,new Vt(t.center.lat,-90))]},s.aX=function(t,e){const{scale:i}=t.tileTransform,n=i*Fe/(t.tileSize*Math.pow(2,e.zoom-t.tileID.overscaledZ+t.tileID.canonical.z));return s.aD.scale(new Float32Array(4),e.inverseAdjustmentMatrix,[n,n])},s.aY=cp,s.aZ=h0,s.a_=function(t){const e=h0(t,!0);return s.aD.invert([],[e[0],e[1],e[4],e[5]])},s.aa=n_,s.ab=ur,s.ac=At,s.ad=function(t,e,i){const n=Math.sqrt(t*t+e*e+i*i),o=n>0?Math.acos(i/n)*Yo:0;let l=t!==0||e!==0?Math.atan2(-e,-t)*Yo+90:0;return l<0&&(l+=360),[n,l,o]},s.af=vc,s.ag=Mn,s.ah=cm,s.ai=function(t,e){const i={};for(let n=0;nHc&&(t.getActor().send("enforceCacheSizeLimit",Wc),El=0)},s.ao=eu,s.ap=class{constructor(t){this.entries={},this.scheduler=t}request(t,e,i,n){const o=this.entries[t]=this.entries[t]||{callbacks:[]};if(o.result){const[l,c]=o.result;return this.scheduler?this.scheduler.add(()=>{n(l,c)},e):n(l,c),()=>{}}return o.callbacks.push(n),o.cancel||(o.cancel=i((l,c)=>{o.result=[l,c];for(const d of o.callbacks)this.scheduler?this.scheduler.add(()=>{d(l,c)},e):d(l,c);setTimeout(()=>delete this.entries[t],3e3)})),()=>{o.result||(o.callbacks=o.callbacks.filter(l=>l!==n),o.callbacks.length||(o.cancel(),delete this.entries[t]))}}},s.aq=function(t,e,i){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},o=>{const l=uo(t.request,(c,d,f,_)=>{c?o(c):d&&o(null,{vectorTile:i?void 0:new Zf(new Zu(d)),rawData:d,cacheControl:f,expires:_})});return()=>{l.cancel(),o()}},e)},s.ar=_f,s.as=class extends Eo{constructor(t){super(t),this.current=ax}set(t,e,i){if(this.fetchUniformLocation(t,e)){for(let n=0;n<9;n++)if(i[n]!==this.current[n]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},s.at=gf,s.au=Et,s.av=Jo,s.ax=Un,s.ay=dr,s.az=Vi,s.b=hi,s.b$=mx,s.b0=function(t){const{x:e,y:i}=t.point,{lng:n,lat:o}=t._center;return D_(e,i,t.worldSize,n,o)},s.b1=sr,s.b2=sc,s.b3=vf,s.b4=function(t){const e=Math.round((t+45+360)%360/90)%4;return Ys[e]},s.b5=45,s.b6=Tf,s.b7=vd,s.b8=ci,s.b9=Qo,s.bA=op,s.bB=U_,s.bC=function(t,e){return[Math.pow(t[0],2.2)*e,Math.pow(t[1],2.2)*e,Math.pow(t[2],2.2)*e]},s.bD=qg,s.bF=z_,s.bG=Eh,s.bH=Th,s.bI=256,s.bJ=function(t,e){const i=[0,0,0],n=Ou(Yn(e.canonical));return s.$.transformMat4(i,i,n),s.$.transformMat4(i,i,t),i},s.bK=t=>({u_camera_to_center_distance:new ur(t),u_extrude_scale:new yf(t),u_device_pixel_ratio:new ur(t),u_matrix:new zu(t),u_inv_rot_matrix:new zu(t),u_merc_center:new So(t),u_tile_id:new _f(t),u_zoom_transition:new ur(t),u_up_dir:new _f(t),u_emissive_strength:new ur(t)}),s.bL=t=>({u_matrix:new zu(t),u_pixels_to_tile_units:new yf(t),u_device_pixel_ratio:new ur(t),u_units_to_pixels:new So(t),u_dash_image:new xd(t),u_gradient_image:new xd(t),u_image_height:new ur(t),u_texsize:new So(t),u_tile_units_to_pixels:new ur(t),u_alpha_discard_threshold:new ur(t),u_trim_offset:new So(t),u_trim_fade_range:new So(t),u_trim_color:new gf(t),u_emissive_strength:new ur(t)}),s.bM=t=>({u_matrix:new zu(t),u_texsize:new So(t),u_pixels_to_tile_units:new yf(t),u_device_pixel_ratio:new ur(t),u_image:new xd(t),u_units_to_pixels:new So(t),u_tile_units_to_pixels:new ur(t),u_alpha_discard_threshold:new ur(t),u_trim_offset:new So(t)}),s.bN=of,s.bO=Pv,s.bP=Ki,s.bQ=Wv,s.bR=Ey,s.bS=em,s.bT=k_,s.bU=(t,e,i,n,o,l)=>{const c=t.transform,d=c.projection.name==="globe";let f;if(l.paint.get("circle-pitch-alignment")==="map")if(d){const y=z_(c.zoom,e.canonical)*c._pixelsPerMercatorPixel;f=Float32Array.from([y,0,0,y])}else f=c.calculatePixelsToTileUnitsMatrix(i);else f=new Float32Array([c.pixelsToGLUnits[0],0,0,c.pixelsToGLUnits[1]]);const _={u_camera_to_center_distance:t.transform.getCameraToCenterDistance(c.projection),u_matrix:t.translatePosMatrix(e.projMatrix,i,l.paint.get("circle-translate"),l.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Zi.devicePixelRatio,u_extrude_scale:f,u_inv_rot_matrix:Cx,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:l.paint.get("circle-emissive-strength")};if(d){_.u_inv_rot_matrix=n,_.u_merc_center=o,_.u_tile_id=[e.canonical.x,e.canonical.y,1<{const c=t.transform;return{u_matrix:Wg(t,e,i,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:c.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:o,u_image:0,u_tile_units_to_pixels:Zg(e,c),u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:l}},s.bX=(t,e,i,n,o,l,c)=>{const d=t.transform,f=d.calculatePixelsToTileUnitsMatrix(e);return{u_matrix:Wg(t,e,i,n),u_pixels_to_tile_units:f,u_device_pixel_ratio:l,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:o,u_texsize:Xg(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Zg(e,t.transform),u_alpha_discard_threshold:0,u_trim_offset:c,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength")}},s.bY=co,s.bZ=Bu,s.b_=Rg,s.ba=function(t){return[Math.pow(t[0],1/2.2),Math.pow(t[1],1/2.2),Math.pow(t[2],1/2.2)]},s.bb=_l,s.bc=function(t,e,i){const n=Co(i.zoom),o=t.style.map._antialias,l=e.options.extStandardDerivativesForceOff||t.terrain&&t.terrain.exaggeration()>0;return n===0&&!o&&!l},s.bd=function(t){const e=t.pixelsPerMeter,i=e/dr(1,t.center.lat),n=s.ae.identity(new Float64Array(16));return s.ae.translate(n,n,[t.point.x,t.point.y,0]),s.ae.scale(n,n,[i,i,e]),Float32Array.from(n)},s.be=Md,s.bf=function(t){const e=Ti-5;t=Et(t,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(At(t))),3);return Math.round(i*(bf.length-1))},s.bg=function(t,e,i,n){const o=e.getNorth(),l=e.getSouth(),c=e.getWest(),d=e.getEast(),f=1<0){const M=180/n;s.bE.multiply(E,E,[M/_+1,0,0,0,M/y+1,0,-.5*M/v,.5*M/b,1])}return E[2]=f,E[5]=t.x,E[8]=t.y,E},s.bh=Ou,s.bi=Yn,s.bj=function(t,e,i){const n=s.ae.identity(new Float64Array(16)),o=(e/(1<{}}},s.bq=ip,s.br=xl,s.bs=class{isDataAvailableAtPoint(t){const e=this._source();if(this.isUsingMockSource()||!e||t.y<0||t.y>1)return!1;const i=e.getSource().maxzoom,n=1<1)return e;const o=n.getSource().maxzoom,l=1<{const l=this.getAtTileOffset(t,o.x,o.y),c=n.upVector(t.canonical,o.x,o.y),d=n.upVectorScale(t.canonical,e,i).metersToTile;return s.$.scale(c,c,l*d),c}}getForTilePoints(t,e,i,n){if(this.isUsingMockSource())return!1;const o=hc.create(this,t,n);return!!o&&(e.forEach(l=>{l[2]=this.exaggeration()*o.getElevationAt(l[0],l[1],i)}),!0)}getMinMaxForTile(t){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const i=e.dem.tree,n=e.tileID,o=1<=0?t.slice(0,e):t},s.cY=function(t){return t.indexOf(dd)>=0},s.cZ=function(t){const e=t.indexOf(dd);return e>=0?t.slice(e+1):""},s.c_=function(t){const e=[],i=t.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),t.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&t.renderingMode!=="2d"&&t.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},s.ca=gs,s.cb=Oa,s.cc=1,s.cd=th,s.ce=0,s.cf=cf,s.cg=function(t,e,i,n,o){return Et((t-e)/(i-e)*(o-n)+n,n,o)},s.ch=cd,s.ci=Va,s.cj=class{constructor(t,e,i,n){this.context=t,this.format=n,this.size=i,this.texture=t.gl.createTexture();const[o,l,c]=this.size,{gl:d}=t;d.bindTexture(d.TEXTURE_3D,this.texture),t.pixelStoreUnpackFlipY.set(!1),t.pixelStoreUnpack.set(1),t.pixelStoreUnpackPremultiplyAlpha.set(!1);let f=this.format,_=d.UNSIGNED_BYTE;this.format===d.DEPTH_COMPONENT&&(f=d.DEPTH_COMPONENT16,_=d.UNSIGNED_SHORT),this.format===d.R8&&(n=d.RED),this.format===d.R32F&&(_=d.FLOAT,n=d.RED),d.texImage3D(d.TEXTURE_3D,0,f,o,l,c,0,n,_,e.data)}bind(t,e){const{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_3D,this.texture),t!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,t),this.minFilter=t),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}},s.ck=vm,s.cl=[1,1,1],s.cm=hc,s.cn=wc,s.co=xs,s.cp=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new je(1/0,1/0),max:new je(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(t,e=!1){const i=cg(new je(0,0),new je(Fe,Fe),t),n=[];if(e&&!Wf(i,this._globalClipBounds))return n;for(const o of this._activeRegions){if(o.hiddenByOverlap||!Wf(i,o))continue;const l=ov(o.min,o.max,t);n.push({min:l.min,max:l.max,sourceId:this._sourceIds[o.priority],footprint:o.footprint,footprintTileId:o.tileId,order:o.order,clipMask:o.clipMask,clipScope:o.clipScope})}return n}setSources(t){this._setSources(t.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const n of e.cache.getVisibleCoordinates()){const o=e.cache.getTile(n).buckets[e.layer];o&&o.updateFootprints(n.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(t){const e=t.getFootprints();if(e.length===0)return;const i=t.getOrder(),n=t.getClipMask(),o=t.getClipScope();for(const l of e){if(!l.footprint)continue;const c=cg(l.footprint.min,l.footprint.max,l.id);this._activeRegions.push({min:c.min,max:c.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:l.id,footprint:l.footprint,order:i,clipMask:n,clipScope:o})}this._sourceIds.push(t.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||Bd(e.min,i.min)||Bd(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(n,o){const l=(c,d)=>c+d;return n.length-o.length||n.reduce(l,"").localeCompare(o.reduce(l,""))}(e.clipScope,i.clipScope));let t=this._activeRegions.length!==this._prevRegions.length;if(!t){let e=0;for(;!t&&e!==this._activeRegions.length;){const i=this._activeRegions[e],n=this._prevRegions[e];t=i.priority!==n.priority||!lg(i,n)||i.order!==n.order||i.clipMask!==n.clipMask||!Xo(i.clipScope,n.clipScope),++e}}if(t){++this._updateTime;for(const i of this._activeRegions)i.order!==Od&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const n=this._activeRegions;if(i>=n.length)return i;const o=n[i].priority;for(;i1){let i=0,n=e(i);for(;i!==n;){let o=i;const l=i;for(;o!==n;){const c=this._activeRegions[o];c.hiddenByOverlap=!1;for(let d=0;d=0;e--)this._addSource(t[e]);this._computeReplacement()}},s.cq=To,s.cr=np,s.cs=Au,s.ct=class{constructor(t){this._createGrid(t),this._createPoles(t)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const t of this._poleSegments)t.destroy();for(const t of this._gridSegments)t.withSkirts.destroy(),t.withoutSkirts.destroy()}_fillGridMeshWithLods(t,e){const i=new bn,n=new ki,o=[],l=t+1+2,c=e[0]+1,d=e[0]+1+(1+e.length),f=(_,y,v)=>{let b=_===l-1?_-2:_===0?_:_-1;return b+=v?24575:0,[b,y]};for(let _=0;_t())},s.dE=ch,s.dF=E0,s.dG=function(t){Sm=Zi.resolveURL(t),Sc||(Sc=new Tc(pp(),new mo)),Sc.broadcast("setDracoUrl",Sm)},s.dH=S0,s.dI=function(t){Ec=Zi.resolveURL(t),Sc||(Sc=new Tc(pp(),new mo)),Sc.broadcast("setMeshoptUrl",Ec)},s.dJ=jc,s.dK=se,s.dL=Es,s.dM=Sn,s.dN=Ga,s.dO=ff,s.dP=Yg,s.dQ=ry,s.dR=Ug,s.dS=Qs,s.dT=xy,s.dU=xc,s.dV=function(t,e,i,n,o,l,c,d,f,_,y){t.createArrays(),t.tilePixelRatio=Fe/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const v=t.layers[0].layout,b=t.layers[0]._unevaluatedLayout._values,E={};if(t.textSizeData.kind==="composite"){const{minZoom:D,maxZoom:V}=t.textSizeData;E.compositeTextSizes=[b["text-size"].possiblyEvaluate(new at(D),d),b["text-size"].possiblyEvaluate(new at(V),d)]}if(t.iconSizeData.kind==="composite"){const{minZoom:D,maxZoom:V}=t.iconSizeData;E.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new at(D),d),b["icon-size"].possiblyEvaluate(new at(V),d)]}E.layoutTextSize=b["text-size"].possiblyEvaluate(new at(f+1),d),E.layoutIconSize=b["icon-size"].possiblyEvaluate(new at(f+1),d),E.textMaxSize=b["text-size"].possiblyEvaluate(new at(18),d);const M=v.get("text-rotation-alignment")==="map"&&v.get("symbol-placement")!=="point",A=v.get("text-size");let C=!1;for(const D of t.features)if(D.icon&&D.icon.nameSecondary){C=!0;break}for(const D of t.features){const V=v.get("text-font").evaluate(D,{},d).join(","),N=A.evaluate(D,{},d),U=E.layoutTextSize.evaluate(D,{},d),H=(E.layoutIconSize.evaluate(D,{},d),{horizontal:{},vertical:void 0}),X=D.text;let Q,ae=[0,0];if(X){const pe=X.toString(),we=v.get("text-letter-spacing").evaluate(D,{},d)*Ki,De=v.get("text-line-height").evaluate(D,{},d)*Ki,Te=Ae(pe)?we:0,ke=v.get("text-anchor").evaluate(D,{},d),be=v.get("text-variable-anchor");if(!be){const Oe=v.get("text-radial-offset").evaluate(D,{},d);ae=Oe?Ey(ke,[Oe*Ki,rm]):v.get("text-offset").evaluate(D,{},d).map(Re=>Re*Ki)}let Ie=M?"center":v.get("text-justify").evaluate(D,{},d);const Be=v.get("symbol-placement")==="point",Ee=Be?v.get("text-max-width").evaluate(D,{},d)*Ki:1/0,Ve=Oe=>{t.allowVerticalPlacement&&Me(pe)&&(H.vertical=Qf(X,e,i,o,V,Ee,De,ke,Oe,Te,ae,Xr.vertical,!0,U,N))};if(!M&&be){const Oe=Ie==="auto"?be.map(et=>nm(et)):[Ie];let Re=!1;for(let et=0;et=0||!Me(pe)){const Oe=Qf(X,e,i,o,V,Ee,De,ke,Ie,Te,ae,Xr.horizontal,!1,U,N);Oe&&(H.horizontal[Ie]=Oe)}Ve(Be?"left":Ie)}}let de=!1;if(D.icon&&D.icon.namePrimary){const pe=n[D.icon.namePrimary];pe&&(Q=i1(o[D.icon.namePrimary],D.icon.nameSecondary?o[D.icon.nameSecondary]:void 0,v.get("icon-offset").evaluate(D,{},d),v.get("icon-anchor").evaluate(D,{},d)),de=pe.sdf,t.sdfIcons===void 0?t.sdfIcons=pe.sdf:t.sdfIcons!==pe.sdf&&vi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(pe.pixelRatio!==t.pixelRatio||v.get("icon-rotate").constantOr(1)!==0)&&(t.iconsNeedLinear=!0))}const ye=My(H.horizontal)||H.vertical;t.iconsInText||(t.iconsInText=!!ye&&ye.iconsInText),(ye||Q)&&c1(t,D,H,Q,n,E,U,0,ae,de,c,d,_,y,C)}l&&t.generateCollisionDebugBuffers(f,t.collisionBoxArray)},s.dW=Ud,s.dX=Dd,s.dY=Zf,s.dZ=Zu,s.d_=Fd,s.da=oc,s.db=bt,s.dc=Nf,s.dd=R_,s.de=function(t){const e=[0,0,0],i=s.ae.identity(new Float64Array(16));return s.ae.multiply(i,t.pixelMatrix,t.globeMatrix),s.$.transformMat4(e,e,i),new je(e[0],e[1])},s.df=el,s.dg=Dn,s.dh=function(t){const e=t.navigator?t.navigator.userAgent:null;return!!function(i){if(na==null){const n=i.navigator?i.navigator.userAgent:null;na=!!i.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return na}(t)&&e&&(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},s.di=yl,s.dj=class{constructor(t,e,i){this._transformRequestFn=t,this._customAccessToken=e,this._silenceAuthErrors=!!i,this._createSkuToken()}_createSkuToken(){const t=function(){let e="";for(let i=0;i<10;i++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Jc,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeStyleURL(t,e){if(!Di(t))return t;const i=Dr(t);return i.params.push(`sdk=js-${pr}`),i.path=`/styles/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeGlyphsURL(t,e){if(!Di(t))return t;const i=Dr(t);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeModelURL(t,e){if(!Di(t))return t;const i=Dr(t);return i.path=`/models/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeSourceURL(t,e,i,n){if(!Di(t))return t;const o=Dr(t);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),i&&o.params.push(`language=${i}`),n&&o.params.push(`worldview=${n}`),this._makeAPIURL(o,this._customAccessToken||e)}normalizeSpriteURL(t,e,i,n){const o=Dr(t);return Di(t)?(o.path=`/styles/v1${o.path}/sprite${e}${i}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${e}${i}`,ho(o))}normalizeTileURL(t,e,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!Di(t))return t;const n=Dr(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${e||i&&n.authority!=="raster"&&i===512?"@2x":""}${Sl.supported?".webp":"$1"}`),n.authority==="raster"?n.path=`/${bt.RASTER_URL_PREFIX}${n.path}`:n.authority==="rasterarrays"?n.path=`/${bt.RASTERARRAYS_URL_PREFIX}${n.path}`:n.authority==="3dtiles"?n.path=`/${bt.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${bt.TILE_URL_VERSION}${n.path}`);const o=this._customAccessToken||function(l){for(const c of l){const d=c.match(/^access_token=(.*)$/);if(d)return d[1]}return null}(n.params)||bt.ACCESS_TOKEN;return bt.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,o)}canonicalizeTileURL(t,e){const i=Dr(t);if(!i.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!i.path.match(/\.[\w]+$/))return t;let n="mapbox://";i.path.match(/^\/raster\/v1\//)?n+=`raster/${i.path.replace(`/${bt.RASTER_URL_PREFIX}/`,"")}`:i.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${i.path.replace(`/${bt.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${i.path.replace(`/${bt.TILE_URL_VERSION}/`,"")}`;let o=i.params;return e&&(o=o.filter(l=>!l.match(/^access_token=/))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(t,e){const i=!!e&&Di(e),n=[];for(const o of t.tiles||[])Zt(o)?n.push(this.canonicalizeTileURL(o,i)):n.push(o);return n}_makeAPIURL(t,e){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=Dr(bt.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,t.protocol==="http"){const o=t.params.indexOf("secure");o>=0&&t.params.splice(o,1)}if(n.path!=="/"&&(t.path=`${n.path}${t.path}`),!bt.REQUIRE_ACCESS_TOKEN)return ho(t);if(e=e||bt.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if(e[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return t.params=t.params.filter(o=>o.indexOf("access_token")===-1),t.params.push(`access_token=${e||""}`),ho(t)}},s.dk=function(t,e){e?da.add(t):da.delete(t)},s.dl=Sl,s.dm=Ip,s.dn=tu,s.dp=Kc,s.dq=Lh,s.dr=kh,s.ds=function(t){da.delete(t)},s.dt=ha,s.du=rs,s.dv=Js,s.dw=pr,s.dx=function(t,e){Wc=t,Hc=e},s.dy=function(t,e,i=!1){if(Jt===nt||Jt===xt||Jt===Ct)throw new Error("setRTLTextPlugin cannot be called multiple times.");Pt=Zi.resolveURL(t),Jt=nt,ii=e,Tt(),i||Ot()},s.dz=gt,s.e=Zi,s.e0=Ld,s.e1=Rd,s.e2=Xs,s.e3=Jg,s.e4=Jr,s.e5=uo,s.e6=function(t){let e=0;if(new Uint32Array(t,0,1)[0]!==I0){const i=new Uint32Array(t,0,7),[,,n,o,l,c]=i;e=i.byteLength+o+l+c+l,(n!==t.byteLength||e>=t.byteLength)&&vi("Invalid b3dm header information.")}return z0(t,e)},s.e7=function(t,e){const i=R0(t);for(const n of i){for(const o of n.meshes)yb(o);n.lights&&(n.lightMeshIndex=n.meshes.length,n.meshes.push(xb(n.lights,e)))}return i},s.e8=gp,s.e9=T0,s.ea=Mt,s.eb=function(t){oa(),Kr&&Kr.then(e=>{e.keys().then(i=>{for(let n=0;ne.arrayBuffer()).then(e=>z0(e,0,t))},s.m=tm,s.n=class extends hp{},s.o=jn,s.p=w1,s.q=os,s.r=g,s.s=T,s.t=w,s.u=yn,s.v=$,s.w=vi,s.x=Wr,s.y=W,s.z=j}),xp(["./shared"],function(s){function pr(oe){const R=oe?oe.url.toString():void 0;return R?performance.getEntriesByName(R):[]}function Mr(oe){if(typeof oe=="number"||typeof oe=="boolean"||typeof oe=="string"||oe==null)return JSON.stringify(oe);if(Array.isArray(oe)){let F="[";for(const q of oe)F+=`${Mr(q)},`;return`${F}]`}let R="{";for(const F of Object.keys(oe).sort())R+=`${F}:${Mr(oe[F])},`;return`${R}}`}function bt(oe){let R="";for(const F of s.cG)R+=`/${Mr(oe[F])}`;return R}class Zt{constructor(R){this.keyCache={},this._layers={},this._layerConfigs={},R&&this.replace(R)}replace(R,F){this._layerConfigs={},this._layers={},this.update(R,[],F)}update(R,F,q){this._options=q;for(const K of R)this._layerConfigs[K.id]=K,(this._layers[K.id]=s.c$(K,this.scope,null,this._options)).compileFilter(),this.keyCache[K.id]&&delete this.keyCache[K.id];for(const K of F)delete this.keyCache[K],delete this._layerConfigs[K],delete this._layers[K];this.familiesBySource={};const te=function(K,ce){const xe={};for(let ge=0;gethis._layers[qe.id]),xe=ce[0];if(xe.visibility==="none")continue;const le=xe.source||"";let ge=this.familiesBySource[le];ge||(ge=this.familiesBySource[le]={});const ze=xe.sourceLayer||"_geojsonTileLayer";let Pe=ge[ze];Pe||(Pe=ge[ze]=[]),Pe.push(ce)}}}const Di=1*s.dM;class Nr{constructor(R){const F={},q=[];for(const xe in R){const le=R[xe],ge=F[xe]={};for(const ze in le.glyphs){const Pe=le.glyphs[+ze];if(!Pe||Pe.bitmap.width===0||Pe.bitmap.height===0)continue;const qe=Pe.metrics.localGlyph?Di:1,tt={x:0,y:0,w:Pe.bitmap.width+2*qe,h:Pe.bitmap.height+2*qe};q.push(tt),ge[ze]=tt}}const{w:te,h:K}=s.k(q),ce=new s.dL({width:te||1,height:K||1});for(const xe in R){const le=R[xe];for(const ge in le.glyphs){const ze=le.glyphs[+ge];if(!ze||ze.bitmap.width===0||ze.bitmap.height===0)continue;const Pe=F[xe][ge],qe=ze.metrics.localGlyph?Di:1;s.dL.copy(ze.bitmap,ce,{x:0,y:0},{x:Pe.x+qe,y:Pe.y+qe},ze.bitmap)}}this.image=ce,this.positions=F}}s.dK(Nr,"GlyphAtlas");class zn{constructor(R){this.tileID=new s.aQ(R.tileID.overscaledZ,R.tileID.wrap,R.tileID.canonical.z,R.tileID.canonical.x,R.tileID.canonical.y),this.tileZoom=R.tileZoom,this.uid=R.uid,this.zoom=R.zoom,this.lut=R.lut,this.canonical=R.tileID.canonical,this.pixelRatio=R.pixelRatio,this.tileSize=R.tileSize,this.source=R.source,this.scope=R.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=R.showCollisionBoxes,this.collectResourceTiming=!!R.collectResourceTiming,this.promoteId=R.promoteId,this.isSymbolTile=R.isSymbolTile,this.tileTransform=s.dN(R.tileID.canonical,R.projection),this.projection=R.projection,this.brightness=R.brightness,this.extraShadowCaster=!!R.extraShadowCaster,this.tessellationStep=R.tessellationStep}parse(R,F,q,te,K){this.status="parsing",this.data=R,this.collisionBoxArray=new s.dO;const ce=new s.dP(Object.keys(R.layers).sort()),xe=new s.dQ(this.tileID,this.promoteId);xe.bucketLayerIDs=[];const le={},ge=new s.dR(256,256),ze={featureIndex:xe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:ge,availableImages:q,brightness:this.brightness},Pe=F.familiesBySource[this.source];for(const Je in Pe){const si=R.layers[Je];if(!si)continue;let Ft=!1,Dt=!1,yi=!1;for(const ji of Pe[Je])ji[0].type==="symbol"?Ft=!0:Dt=!0,ji[0].is3D()&&ji[0].type!=="model"&&(yi=!0);if(this.extraShadowCaster&&!yi||this.isSymbolTile===!0&&!Ft||this.isSymbolTile===!1&&!Dt)continue;si.version===1&&s.w(`Vector tile source "${this.source}" layer "${Je}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const xi=ce.encode(Je),Ri=[];for(let ji=0;ji=tr.maxzoom||tr.visibility!=="none"&&(to(ji,this.zoom,ze.brightness,q),(le[tr.id]=tr.createBucket({index:xe.bucketLayerIDs.length,layers:ji,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:xi,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(Ri,ze,this.tileID.canonical,this.tileTransform),xe.bucketLayerIDs.push(ji.map(ao=>ao.id))))}}let qe,tt,ot,Bt;ge.trim();const yt={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},kt=()=>{if(qe)return this.status="done",K(qe);if(this.extraShadowCaster)this.status="done",K(null,{buckets:s.dJ(le).filter(Je=>!Je.isEmpty()),featureIndex:xe,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ze.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(tt&&ot&&Bt){const Je=new Nr(tt),si=new s.dT(ot,Bt,this.lut);for(const Ft in le){const Dt=le[Ft];Dt instanceof s.dU?(to(Dt.layers,this.zoom,ze.brightness,q),s.dV(Dt,tt,Je.positions,ot,si.iconPositions,this.showCollisionBoxes,q,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):Dt.hasPattern&&(Dt instanceof s.dW||Dt instanceof s.dX||Dt instanceof s.c0)&&(to(Dt.layers,this.zoom,ze.brightness,q),Dt.addFeatures(ze,this.tileID.canonical,si.patternPositions,q,this.tileTransform,this.brightness))}this.status="done",K(null,{buckets:s.dJ(le).filter(Ft=>!Ft.isEmpty()),featureIndex:xe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Je.image,lineAtlas:ge,imageAtlas:si,brightness:ze.brightness})}};if(!this.extraShadowCaster){const Je=s.dS(ze.glyphDependencies,Dt=>Object.keys(Dt).map(Number));Object.keys(Je).length?te.send("getGlyphs",{uid:this.uid,stacks:Je,scope:this.scope},(Dt,yi)=>{qe||(qe=Dt,tt=yi,kt())},void 0,!1,yt):tt={};const si=Object.keys(ze.iconDependencies);si.length?te.send("getImages",{icons:si,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Dt,yi)=>{qe||(qe=Dt,ot=yi,kt())},void 0,!1,yt):ot={};const Ft=Object.keys(ze.patternDependencies);Ft.length?te.send("getImages",{icons:Ft,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Dt,yi)=>{qe||(qe=Dt,Bt=yi,kt())},void 0,!1,yt):Bt={}}kt()}}function to(oe,R,F,q){const te=new s.Y(R,{brightness:F});for(const K of oe)K.recalculate(te,q)}class Dn extends s.E{constructor(R,F,q,te,K,ce){super(),this.actor=R,this.layerIndex=F,this.availableImages=q,this.loadVectorData=K||s.aq,this.loading={},this.loaded={},this.deduped=new s.ap(R.scheduler),this.isSpriteLoaded=te,this.scheduler=R.scheduler,this.brightness=ce}loadTile(R,F){const q=R.uid,te=R&&R.request,K=te&&te.collectResourceTiming,ce=this.loading[q]=new zn(R);ce.abort=this.loadVectorData(R,(xe,le)=>{const ge=!this.loading[q];if(delete this.loading[q],ge||xe||!le)return ce.status="done",ge||(this.loaded[q]=ce),F(xe);const ze=le.rawData,Pe={};le.expires&&(Pe.expires=le.expires),le.cacheControl&&(Pe.cacheControl=le.cacheControl),ce.vectorTile=le.vectorTile||new s.dY(new s.dZ(ze));const qe=()=>{ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.actor,(tt,ot)=>{if(tt||!ot)return F(tt);const Bt={};if(K){const yt=pr(te);yt.length>0&&(Bt.resourceTiming=JSON.parse(JSON.stringify(yt)))}F(null,s.Q({rawTileData:ze.slice(0)},ot,Pe,Bt))})};this.isSpriteLoaded?qe():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(qe,{type:"parseTile",isSymbolTile:R.isSymbolTile,zoom:R.tileZoom}):qe()}),this.loaded=this.loaded||{},this.loaded[q]=ce})}reloadTile(R,F){const q=this.loaded,te=R.uid;if(q&&q[te]){const K=q[te];K.showCollisionBoxes=R.showCollisionBoxes,K.projection=R.projection,K.brightness=R.brightness,K.tileTransform=s.dN(R.tileID.canonical,R.projection),K.extraShadowCaster=R.extraShadowCaster,K.lut=R.lut;const ce=(xe,le)=>{const ge=K.reloadCallback;ge&&(delete K.reloadCallback,K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,ge)),F(xe,le)};K.status==="parsing"?K.reloadCallback=ce:K.status==="done"&&(K.vectorTile?K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,ce):ce())}else F(null,void 0)}abortTile(R,F){const q=R.uid,te=this.loading[q];te&&(te.abort&&te.abort(),delete this.loading[q]),F()}removeTile(R,F){const q=this.loaded,te=R.uid;q&&q[te]&&delete q[te],F()}}class el{loadTile(R,F){const{uid:q,encoding:te,rawImageData:K,padding:ce}=R,xe=ImageBitmap&&K instanceof ImageBitmap?this.getImageData(K,ce):K;F(null,new s.d_(q,xe,te,ce<1))}getImageData(R,F){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(R.width,R.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=R.width,this.offscreenCanvas.height=R.height,this.offscreenCanvasContext.drawImage(R,0,0,R.width,R.height);const q=this.offscreenCanvasContext.getImageData(-F,-F,R.width+2*F,R.height+2*F);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),q}}s.d$.setPbf(s.dZ);class Os{decodeRasterArray({task:R,buffer:F},q){s.d$.performDecoding(F,R).then(te=>{q(null,te)},te=>{q(te)})}}const Jr=s.e0.prototype.toGeoJSON;let di=class{constructor(oe){this._feature=oe,this.extent=s.a4,this.type=oe.type,this.properties=oe.tags,"id"in oe&&!isNaN(oe.id)&&(this.id=parseInt(oe.id,10))}loadGeometry(){if(this._feature.type===1){const oe=[];for(const R of this._feature.geometry)oe.push([new s.P(R[0],R[1])]);return oe}{const oe=[];for(const R of this._feature.geometry){const F=[];for(const q of R)F.push(new s.P(q[0],q[1]));oe.push(F)}return oe}}toGeoJSON(oe,R,F){return Jr.call(this,oe,R,F)}},fi=class{constructor(oe){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=s.a4,this.length=oe.length,this._features=oe}feature(oe){return new di(this._features[oe])}};const Rn=64/4096,Do=128;class Ac{constructor(){this.features=new Map}clear(){this.features.clear()}load(R=[],F){for(const q of R){const te=q.id;if(te==null)continue;let K=this.features.get(te);K&&this.updateCache(K,F),q.geometry?(K=ni(q),this.updateCache(K,F),this.features.set(te,K)):this.features.delete(te),this.updateCache(K,F)}}updateCache(R,F){for(const{canonical:q,uid:te}of Object.values(F)){const{z:K,x:ce,y:xe}=q;tl(R,Math.pow(2,K),ce,xe)&&delete F[te]}}getTile(R,F,q){const te=Math.pow(2,R),K=[];for(const ce of this.features.values())tl(ce,te,F,q)&&K.push(il(ce,te,F,q));return{features:K}}getFeatures(){return[...this.features.values()]}}function tl({minX:oe,minY:R,maxX:F,maxY:q},te,K,ce){return oe<(K+1+Rn)/te&&R<(ce+1+Rn)/te&&F>(K-Rn)/te&&q>(ce-Rn)/te}function ni(oe){const{id:R,geometry:F,properties:q}=oe;if(!F)return;if(F.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:te,coordinates:K}=F,ce={id:R,type:1,geometry:[],tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},xe=ce.geometry;if(te==="Point")Yt(K,xe,ce);else if(te==="MultiPoint")for(const le of K)Yt(le,xe,ce);else if(te==="LineString")ce.type=2,Vr(K,xe,ce);else if(te==="MultiLineString")ce.type=2,Ro(K,xe,ce);else if(te==="Polygon")ce.type=3,Ro(K,xe,ce,!0);else{if(te!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ce.type=3;for(const le of K)Ro(le,xe,ce,!0)}return ce}function Yt([oe,R],F,q){const te=s.ak(oe);let K=s.al(R);K=K<0?0:K>1?1:K,F.push(te,K),q.minX=Math.min(q.minX,te),q.minY=Math.min(q.minY,K),q.maxX=Math.max(q.maxX,te),q.maxY=Math.max(q.maxY,K)}function Vr(oe,R,F,q=!1,te=!1){const K=[];for(const ce of oe)Yt(ce,K,F);R.push(K),q&&function(ce,xe){let le=0;for(let ge=0,ze=ce.length,Pe=ze-2;ge0===xe)for(let ge=0,ze=ce.length;ge=ce&&Pe>=ce||(ge>=ce?(ze+=Math.round(ot*((ce-ge)/tt)),ge=ce):Pe>=ce&&(qe=ze+Math.round(ot*((ce-ge)/tt)),Pe=ce),ze>=ce&&qe>=ce||(ze>=ce?(ge+=Math.round(tt*((ce-ze)/ot)),ze=ce):qe>=ce&&(Pe=ge+Math.round(tt*((ce-ze)/ot)),qe=ce),xe&&ge===xe[xe.length-1][0]&&ze===xe[xe.length-1][1]||(xe=[[ge,ze]],te.push(xe)),xe.push([Pe,qe])))))}}var Qt={exports:{}},Bs=s.e2,Ir=s.e1.VectorTileFeature,nl=Fs;function Fs(oe,R){this.options=R||{},this.features=oe,this.length=oe.length}function io(oe,R){this.id=typeof oe.id=="number"?oe.id:void 0,this.type=oe.type,this.rawGeometry=oe.type===1?[oe.geometry]:oe.geometry,this.properties=oe.tags,this.extent=R||4096}Fs.prototype.feature=function(oe){return new io(this.features[oe],this.options.extent)},io.prototype.loadGeometry=function(){var oe=this.rawGeometry;this.geometry=[];for(var R=0;R>31}function ai(oe,R){for(var F=oe.loadGeometry(),q=oe.type,te=0,K=0,ce=F.length,xe=0;xeoe},Ns=Math.fround||(Oo=new Float32Array(1),oe=>(Oo[0]=+oe,Oo[0]));var Oo;const Ur=3,jr=5,Vs=6;class lt{constructor(R){this.options=Object.assign(Object.create(ul),R),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(R){const{log:F,minZoom:q,maxZoom:te}=this.options;F&&console.time("total time");const K=`prepare ${R.length} points`;F&&console.time(K),this.points=R;const ce=[];for(let le=0;le=q;le--){const ge=+Date.now();xe=this.trees[le]=this._createTree(this._cluster(xe,le)),F&&console.log("z%d: %d clusters in %dms",le,xe.numItems,+Date.now()-ge)}return F&&console.timeEnd("total time"),this}getClusters(R,F){let q=((R[0]+180)%360+360)%360-180;const te=Math.max(-90,Math.min(90,R[1]));let K=R[2]===180?180:((R[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,R[3]));if(R[2]-R[0]>=360)q=-180,K=180;else if(q>K){const Pe=this.getClusters([q,te,180,ce],F),qe=this.getClusters([-180,te,K,ce],F);return Pe.concat(qe)}const xe=this.trees[this._limitZoom(F)],le=xe.range(lr(q),pn(ce),lr(K),pn(te)),ge=xe.data,ze=[];for(const Pe of le){const qe=this.stride*Pe;ze.push(ge[qe+jr]>1?pt(ge,qe,this.clusterProps):this.points[ge[qe+Ur]])}return ze}getChildren(R){const F=this._getOriginId(R),q=this._getOriginZoom(R),te="No cluster with the specified id.",K=this.trees[q];if(!K)throw new Error(te);const ce=K.data;if(F*this.stride>=ce.length)throw new Error(te);const xe=this.options.radius/(this.options.extent*Math.pow(2,q-1)),le=K.within(ce[F*this.stride],ce[F*this.stride+1],xe),ge=[];for(const ze of le){const Pe=ze*this.stride;ce[Pe+4]===R&&ge.push(ce[Pe+jr]>1?pt(ce,Pe,this.clusterProps):this.points[ce[Pe+Ur]])}if(ge.length===0)throw new Error(te);return ge}getLeaves(R,F,q){const te=[];return this._appendLeaves(te,R,F=F||10,q=q||0,0),te}getTile(R,F,q){const te=this.trees[this._limitZoom(R)],K=Math.pow(2,R),{extent:ce,radius:xe}=this.options,le=xe/ce,ge=(q-le)/K,ze=(q+1+le)/K,Pe={features:[]};return this._addTileFeatures(te.range((F-le)/K,ge,(F+1+le)/K,ze),te.data,F,q,K,Pe),F===0&&this._addTileFeatures(te.range(1-le/K,ge,1,ze),te.data,K,q,K,Pe),F===K-1&&this._addTileFeatures(te.range(0,ge,le/K,ze),te.data,-1,q,K,Pe),Pe.features.length?Pe:null}getClusterExpansionZoom(R){let F=this._getOriginZoom(R)-1;for(;F<=this.options.maxZoom;){const q=this.getChildren(R);if(F++,q.length!==1)break;R=q[0].properties.cluster_id}return F}_appendLeaves(R,F,q,te,K){const ce=this.getChildren(F);for(const xe of ce){const le=xe.properties;if(le&&le.cluster?K+le.point_count<=te?K+=le.point_count:K=this._appendLeaves(R,le.cluster_id,q,te,K):K1;let ze,Pe,qe;if(ge)ze=Bo(F,le,this.clusterProps),Pe=F[le],qe=F[le+1];else{const Bt=this.points[F[le+Ur]];ze=Bt.properties;const[yt,kt]=Bt.geometry.coordinates;Pe=lr(yt),qe=pn(kt)}const tt={type:1,geometry:[[Math.round(this.options.extent*(Pe*K-q)),Math.round(this.options.extent*(qe*K-te))]],tags:ze};let ot;ot=ge||this.options.generateId?F[le+Ur]:this.points[F[le+Ur]].id,ot!==void 0&&(tt.id=ot),ce.features.push(tt)}}_limitZoom(R){return Math.max(this.options.minZoom,Math.min(Math.floor(+R),this.options.maxZoom+1))}_cluster(R,F){const{radius:q,extent:te,reduce:K,minPoints:ce}=this.options,xe=q/(te*Math.pow(2,F)),le=R.data,ge=[],ze=this.stride;for(let Pe=0;PeF&&(yt+=le[Je+jr])}if(yt>Bt&&yt>=ce){let kt,Je=qe*Bt,si=tt*Bt,Ft=-1;const Dt=(Pe/ze<<5)+(F+1)+this.points.length;for(const yi of ot){const xi=yi*ze;if(le[xi+2]<=F)continue;le[xi+2]=F;const Ri=le[xi+jr];Je+=le[xi]*Ri,si+=le[xi+1]*Ri,le[xi+4]=Dt,K&&(kt||(kt=this._map(le,Pe,!0),Ft=this.clusterProps.length,this.clusterProps.push(kt)),K(kt,this._map(le,xi)))}le[Pe+4]=Dt,ge.push(Je/yt,si/yt,1/0,Dt,-1,yt),K&&ge.push(Ft)}else{for(let kt=0;kt1)for(const kt of ot){const Je=kt*ze;if(!(le[Je+2]<=F)){le[Je+2]=F;for(let si=0;si>5}_getOriginZoom(R){return(R-this.points.length)%32}_map(R,F,q){if(R[F+jr]>1){const ce=this.clusterProps[R[F+Vs]];return q?Object.assign({},ce):ce}const te=this.points[R[F+Ur]].properties,K=this.options.map(te);return q&&K===te?Object.assign({},K):K}}function pt(oe,R,F){return{type:"Feature",id:oe[R+Ur],properties:Bo(oe,R,F),geometry:{type:"Point",coordinates:[(q=oe[R],360*(q-.5)),hl(oe[R+1])]}};var q}function Bo(oe,R,F){const q=oe[R+jr],te=q>=1e4?`${Math.round(q/1e3)}k`:q>=1e3?Math.round(q/100)/10+"k":q,K=oe[R+Vs],ce=K===-1?{}:Object.assign({},F[K]);return Object.assign(ce,{cluster:!0,cluster_id:oe[R+Ur],point_count:q,point_count_abbreviated:te})}function lr(oe){return oe/360+.5}function pn(oe){const R=Math.sin(oe*Math.PI/180),F=.5-.25*Math.log((1+R)/(1-R))/Math.PI;return F<0?0:F>1?1:F}function hl(oe){const R=(180-360*oe)*Math.PI/180;return 360*Math.atan(Math.exp(R))/Math.PI-90}function ro(oe,R,F,q){let te=q;const K=R+(F-R>>1);let ce,xe=F-R;const le=oe[R],ge=oe[R+1],ze=oe[F],Pe=oe[F+1];for(let qe=R+3;qete)ce=qe,te=tt;else if(tt===te){const ot=Math.abs(qe-K);otq&&(ce-R>3&&ro(oe,R,ce,q),oe[ce+2]=te,F-ce>3&&ro(oe,ce,F,q))}function dl(oe,R,F,q,te,K){let ce=te-F,xe=K-q;if(ce!==0||xe!==0){const le=((oe-F)*ce+(R-q)*xe)/(ce*ce+xe*xe);le>1?(F=te,q=K):le>0&&(F+=ce*le,q+=xe*le)}return ce=oe-F,xe=R-q,ce*ce+xe*xe}function Ln(oe,R,F,q){const te={id:oe??null,type:R,geometry:F,tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(R==="Point"||R==="MultiPoint"||R==="LineString")kn(te,F);else if(R==="Polygon")kn(te,F[0]);else if(R==="MultiLineString")for(const K of F)kn(te,K);else if(R==="MultiPolygon")for(const K of F)kn(te,K[0]);return te}function kn(oe,R){for(let F=0;F0&&(ce+=q?(te*ze-ge*K)/2:Math.sqrt(Math.pow(ge-te,2)+Math.pow(ze-K,2))),te=ge,K=ze}const xe=R.length-3;R[2]=1,ro(R,0,xe,F),R[xe+2]=1,R.size=Math.abs(ce),R.start=0,R.end=R.size}function Vo(oe,R,F,q){for(let te=0;te1?1:F}function ct(oe,R,F,q,te,K,ce,xe){if(q/=R,K>=(F/=R)&&ce=q)return null;const le=[];for(const ge of oe){const ze=ge.geometry;let Pe=ge.type;const qe=te===0?ge.minX:ge.minY,tt=te===0?ge.maxX:ge.maxY;if(qe>=F&&tt=q)continue;let ot=[];if(Pe==="Point"||Pe==="MultiPoint")Uo(ze,ot,F,q,te);else if(Pe==="LineString")er(ze,ot,F,q,te,!1,xe.lineMetrics);else if(Pe==="MultiLineString")no(ze,ot,F,q,te,!1);else if(Pe==="Polygon")no(ze,ot,F,q,te,!0);else if(Pe==="MultiPolygon")for(const Bt of ze){const yt=[];no(Bt,yt,F,q,te,!0),yt.length&&ot.push(yt)}if(ot.length){if(xe.lineMetrics&&Pe==="LineString"){for(const Bt of ot)le.push(Ln(ge.id,Pe,Bt,ge.tags));continue}Pe!=="LineString"&&Pe!=="MultiLineString"||(ot.length===1?(Pe="LineString",ot=ot[0]):Pe="MultiLineString"),Pe!=="Point"&&Pe!=="MultiPoint"||(Pe=ot.length===3?"Point":"MultiPoint"),le.push(Ln(ge.id,Pe,ot,ge.tags))}}return le.length?le:null}function Uo(oe,R,F,q,te){for(let K=0;K=F&&ce<=q&&Cr(R,oe[K],oe[K+1],oe[K+2])}}function er(oe,R,F,q,te,K,ce){let xe=Gr(oe);const le=te===0?jo:js;let ge,ze,Pe=oe.start;for(let yt=0;ytF&&(ze=le(xe,kt,Je,Ft,Dt,F),ce&&(xe.start=Pe+ge*ze)):yi>q?xi=F&&(ze=le(xe,kt,Je,Ft,Dt,F),Ri=!0),xi>q&&yi<=q&&(ze=le(xe,kt,Je,Ft,Dt,q),Ri=!0),!K&&Ri&&(ce&&(xe.end=Pe+ge*ze),R.push(xe),xe=Gr(oe)),ce&&(Pe+=ge)}let qe=oe.length-3;const tt=oe[qe],ot=oe[qe+1],Bt=te===0?tt:ot;Bt>=F&&Bt<=q&&Cr(xe,tt,ot,oe[qe+2]),qe=xe.length-3,K&&qe>=3&&(xe[qe]!==xe[0]||xe[qe+1]!==xe[1])&&Cr(xe,xe[0],xe[1],xe[2]),xe.length&&R.push(xe)}function Gr(oe){const R=[];return R.size=oe.size,R.start=oe.start,R.end=oe.end,R}function no(oe,R,F,q,te,K){for(const ce of oe)er(ce,R,F,q,te,K,!1)}function Cr(oe,R,F,q){oe.push(R,F,q)}function jo(oe,R,F,q,te,K){const ce=(K-R)/(q-R);return Cr(oe,K,F+(te-F)*ce,1),ce}function js(oe,R,F,q,te,K){const ce=(K-F)/(te-F);return Cr(oe,R+(q-R)*ce,K,1),ce}function Go(oe,R){const F=[];for(let q=0;q0&&R.size<(te?ce:q))return void(F.numPoints+=R.length/3);const xe=[];for(let le=0;lece)&&(F.numSimplified++,xe.push(R[le],R[le+1])),F.numPoints++;te&&function(le,ge){let ze=0;for(let Pe=0,qe=le.length,tt=qe-2;Pe0===ge)for(let Pe=0,qe=le.length;Pe24)throw new Error("maxZoom should be in the 0-24 range");if(F.promoteId&&F.generateId)throw new Error("promoteId and generateId cannot be used together.");let te=function(K,ce){const xe=[];if(K.type==="FeatureCollection")for(let le=0;le1&&console.time("creation"),tt=this.tiles[qe]=On(R,F,q,te,ge),this.tileCoords.push({z:F,x:q,y:te}),ze)){ze>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",F,q,te,tt.numFeatures,tt.numPoints,tt.numSimplified),console.timeEnd("creation"));const Ri=`z${F}`;this.stats[Ri]=(this.stats[Ri]||0)+1,this.total++}if(tt.source=R,K==null){if(F===ge.indexMaxZoom||tt.numPoints<=ge.indexMaxPoints)continue}else{if(F===ge.maxZoom||F===K)continue;if(K!=null){const Ri=K-F;if(q!==ce>>Ri||te!==xe>>Ri)continue}}if(tt.source=null,R.length===0)continue;ze>1&&console.time("clipping");const ot=.5*ge.buffer/ge.extent,Bt=.5-ot,yt=.5+ot,kt=1+ot;let Je=null,si=null,Ft=null,Dt=null,yi=ct(R,Pe,q-ot,q+yt,0,tt.minX,tt.maxX,ge),xi=ct(R,Pe,q+Bt,q+kt,0,tt.minX,tt.maxX,ge);R=null,yi&&(Je=ct(yi,Pe,te-ot,te+yt,1,tt.minY,tt.maxY,ge),si=ct(yi,Pe,te+Bt,te+kt,1,tt.minY,tt.maxY,ge),yi=null),xi&&(Ft=ct(xi,Pe,te-ot,te+yt,1,tt.minY,tt.maxY,ge),Dt=ct(xi,Pe,te+Bt,te+kt,1,tt.minY,tt.maxY,ge),xi=null),ze>1&&console.timeEnd("clipping"),le.push(Je||[],F+1,2*q,2*te),le.push(si||[],F+1,2*q,2*te+1),le.push(Ft||[],F+1,2*q+1,2*te),le.push(Dt||[],F+1,2*q+1,2*te+1)}}getTile(R,F,q){R=+R,F=+F,q=+q;const te=this.options,{extent:K,debug:ce}=te;if(R<0||R>24)return null;const xe=1<1&&console.log("drilling down to z%d-%d-%d",R,F,q);let ge,ze=R,Pe=F,qe=q;for(;!ge&&ze>0;)ze--,Pe>>=1,qe>>=1,ge=this.tiles[Bi(ze,Pe,qe)];return ge&&ge.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",ze,Pe,qe),console.time("drilling down")),this.splitTile(ge.source,ze,Pe,qe,R,F,q),ce>1&&console.timeEnd("drilling down"),this.tiles[le]?$o(this.tiles[le],K):null):null}}function Bi(oe,R,F){return 32*((1<{if(K||!ce)return F(K);if(typeof ce!="object")return F(new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`));{try{if(R.filter){const le=s.z(R.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(le.result==="error")throw new Error(le.value.map(ge=>`${ge.key}: ${ge.message}`).join(", "));ce.features=ce.features.filter(ge=>le.value.evaluate({zoom:0},ge))}R.dynamic?(ce.type==="Feature"&&(ce={type:"FeatureCollection",features:[ce]}),R.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ce.features,this.loaded),R.cluster&&(ce.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=R.cluster?new lt(function({superclusterOptions:le,clusterProperties:ge}){if(!ge||!le)return le;const ze={},Pe={},qe={accumulated:null,zoom:0},tt={properties:null},ot=Object.keys(ge);for(const Bt of ot){const[yt,kt]=ge[Bt],Je=s.z(kt),si=s.z(typeof yt=="string"?[yt,["accumulated"],["get",Bt]]:yt);ze[Bt]=Je.value,Pe[Bt]=si.value}return le.map=Bt=>{tt.properties=Bt;const yt={};for(const kt of ot)yt[kt]=ze[kt].evaluate(qe,tt);return yt},le.reduce=(Bt,yt)=>{tt.properties=yt;for(const kt of ot)qe.accumulated=Bt[kt],Bt[kt]=Pe[kt].evaluate(qe,tt)},le}(R)).load(ce.features):R.dynamic?this._dynamicIndex:function(le,ge){return new zr(le,ge)}(ce,R.geojsonVtOptions)}catch(le){return F(le)}const xe={};if(te){const le=pr(q);le&&(xe.resourceTiming={},xe.resourceTiming[R.source]=JSON.parse(JSON.stringify(le)))}F(null,xe)}})}reloadTile(R,F){const q=this.loaded;return q&&q[R.uid]?R.partial?F(null,void 0):super.reloadTile(R,F):this.loadTile(R,F)}loadGeoJSON(R,F){if(R.request)s.h(R.request,F);else{if(typeof R.data!="string")return F(new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`));try{return F(null,JSON.parse(R.data))}catch{return F(new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(R,F){try{F(null,this._geoJSONIndex.getClusterExpansionZoom(R.clusterId))}catch(q){F(q)}}getClusterChildren(R,F){try{F(null,this._geoJSONIndex.getChildren(R.clusterId))}catch(q){F(q)}}getClusterLeaves(R,F){try{F(null,this._geoJSONIndex.getLeaves(R.clusterId,R.limit,R.offset))}catch(q){F(q)}}}class Wo{constructor(R,F){this.tileID=new s.aQ(R.tileID.overscaledZ,R.tileID.wrap,R.tileID.canonical.z,R.tileID.canonical.x,R.tileID.canonical.y),this.tileZoom=R.tileZoom,this.uid=R.uid,this.zoom=R.zoom,this.canonical=R.tileID.canonical,this.pixelRatio=R.pixelRatio,this.tileSize=R.tileSize,this.source=R.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=R.projection,this.brightness=F}parse(R,F,q,te){this.status="parsing";const K=new s.aQ(q.tileID.overscaledZ,q.tileID.wrap,q.tileID.canonical.z,q.tileID.canonical.x,q.tileID.canonical.y),ce={},xe=F.familiesBySource[q.source],le=new s.dQ(K,q.promoteId);return le.bucketLayerIDs=[],le.is3DTile=!0,s.e6(R).then(ge=>{if(!ge)return te(new Error("Could not parse tile"));const ze=s.e7(ge,1/s.b7(q.tileID.canonical)),Pe=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("MAPBOX_mesh_features")||ge.json.asset.extras&&ge.json.asset.extras.MAPBOX_mesh_features,qe=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("EXT_meshopt_compression"),tt=new s.Y(this.zoom,{brightness:this.brightness});for(const ot in xe)for(const Bt of xe[ot]){const yt=Bt[0];le.bucketLayerIDs.push(Bt.map(Je=>Je.id)),yt.recalculate(tt,[]);const kt=new s.e8(ze,K,Pe,qe,this.brightness,le);Pe||(kt.needsUpload=!0),ce[yt.fqid]=kt,kt.evaluate(yt)}this.status="done",te(null,{buckets:ce,featureIndex:le})}).catch(ge=>te(new Error(ge.message)))}}class Mi{constructor(R,F,q,te,K,ce){this.actor=R,this.layerIndex=F,this.brightness=ce,this.loading={},this.loaded={}}loadTile(R,F){const q=R.uid,te=this.loading[q]=new Wo(R,this.brightness);s.e5(R.request,(K,ce)=>{const xe=!this.loading[q];return delete this.loading[q],xe||K?(te.status="done",xe||(this.loaded[q]=te),F(K)):ce&&ce.byteLength!==0?void te.parse(ce,this.layerIndex,R,(le,ge)=>{te.status="done",this.loaded=this.loaded||{},this.loaded[q]=te,le||!ge?F(le):F(null,ge)}):(te.status="done",this.loaded[q]=te,F())})}reloadTile(R,F){const q=this.loaded,te=R.uid;if(q&&q[te]){const K=q[te];K.projection=R.projection,K.brightness=R.brightness;const ce=(xe,le)=>{K.reloadCallback&&(delete K.reloadCallback,this.loadTile(R,F)),F(xe,le)};K.status==="parsing"?K.reloadCallback=ce:K.status==="done"&&this.loadTile(R,F)}}abortTile(R,F){const q=R.uid;this.loading[q]&&delete this.loading[q],F()}removeTile(R,F){const q=this.loaded,te=R.uid;q&&q[te]&&delete q[te],F()}}class $s{constructor(R){this.self=R,this.actor=new s.e9(R,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=s.aK({name:"mercator"}),this.workerSourceTypes={vector:Dn,geojson:so,"batched-model":Mi},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(F,q)=>{if(this.workerSourceTypes[F])throw new Error(`Worker source with name "${F}" already registered.`);this.workerSourceTypes[F]=q},this.self.registerRTLTextPlugin=F=>{if(s.ea.isParsed())throw new Error("RTL text plugin already registered.");s.ea.applyArabicShaping=F.applyArabicShaping,s.ea.processBidirectionalText=F.processBidirectionalText,s.ea.processStyledBidirectionalText=F.processStyledBidirectionalText}}clearCaches(R,F,q){delete this.layerIndexes[R],delete this.availableImages[R],delete this.workerSources[R],delete this.demWorkerSources[R],delete this.rasterArrayWorkerSource,q()}checkIfReady(R,F,q){q()}setReferrer(R,F){this.referrer=F}spriteLoaded(R,{scope:F,isLoaded:q}){if(this.isSpriteLoaded[R]||(this.isSpriteLoaded[R]={}),this.isSpriteLoaded[R][F]=q,this.workerSources[R]&&this.workerSources[R][F])for(const te in this.workerSources[R][F]){const K=this.workerSources[R][F][te];for(const ce in K){const xe=K[ce];xe instanceof Dn&&(xe.isSpriteLoaded=q,xe.fire(new s.g("isSpriteLoaded")))}}}setImages(R,{scope:F,images:q},te){if(this.availableImages[R]||(this.availableImages[R]={}),this.availableImages[R][F]=q,this.workerSources[R]&&this.workerSources[R][F]){for(const K in this.workerSources[R][F]){const ce=this.workerSources[R][F][K];for(const xe in ce)ce[xe].availableImages=q}te()}else te()}setProjection(R,F){this.projections[R]=s.aK(F)}setBrightness(R,F,q){this.brightness=F,q()}setLayers(R,F,q){this.getLayerIndex(R,F.scope).replace(F.layers,F.options),q()}updateLayers(R,F,q){this.getLayerIndex(R,F.scope).update(F.layers,F.removedIds,F.options),q()}loadTile(R,F,q){F.projection=this.projections[R]||this.defaultProjection,this.getWorkerSource(R,F.type,F.source,F.scope).loadTile(F,q)}loadDEMTile(R,F,q){this.getDEMWorkerSource(R,F.source,F.scope).loadTile(F,q)}decodeRasterArray(R,F,q){this.getRasterArrayWorkerSource().decodeRasterArray(F,q)}reloadTile(R,F,q){F.projection=this.projections[R]||this.defaultProjection,this.getWorkerSource(R,F.type,F.source,F.scope).reloadTile(F,q)}abortTile(R,F,q){this.getWorkerSource(R,F.type,F.source,F.scope).abortTile(F,q)}removeTile(R,F,q){this.getWorkerSource(R,F.type,F.source,F.scope).removeTile(F,q)}removeSource(R,F,q){if(!(this.workerSources[R]&&this.workerSources[R][F.scope]&&this.workerSources[R][F.scope][F.type]&&this.workerSources[R][F.scope][F.type][F.source]))return;const te=this.workerSources[R][F.scope][F.type][F.source];delete this.workerSources[R][F.scope][F.type][F.source],te.removeSource!==void 0?te.removeSource(F,q):q()}loadWorkerSource(R,F,q){try{this.self.importScripts(F.url),q()}catch(te){q(te.toString())}}syncRTLPluginState(R,F,q){try{s.ea.setState(F);const te=s.ea.getPluginURL();if(s.ea.isLoaded()&&!s.ea.isParsed()&&te!=null){this.self.importScripts(te);const K=s.ea.isParsed();q(K?void 0:new Error(`RTL Text Plugin failed to import scripts from ${te}`),K)}}catch(te){q(te.toString())}}setDracoUrl(R,F){this.dracoUrl=F}getAvailableImages(R,F){this.availableImages[R]||(this.availableImages[R]={});let q=this.availableImages[R][F];return q||(q=[]),q}getLayerIndex(R,F){this.layerIndexes[R]||(this.layerIndexes[R]={});let q=this.layerIndexes[R][F];return q||(q=this.layerIndexes[R][F]=new Zt,q.scope=F),q}getWorkerSource(R,F,q,te){return this.workerSources[R]||(this.workerSources[R]={}),this.workerSources[R][te]||(this.workerSources[R][te]={}),this.workerSources[R][te][F]||(this.workerSources[R][te][F]={}),this.isSpriteLoaded[R]||(this.isSpriteLoaded[R]={}),this.workerSources[R][te][F][q]||(this.workerSources[R][te][F][q]=new this.workerSourceTypes[F]({send:(K,ce,xe,le,ge,ze)=>{this.actor.send(K,ce,xe,R,ge,ze)},scheduler:this.actor.scheduler},this.getLayerIndex(R,te),this.getAvailableImages(R,te),this.isSpriteLoaded[R][te],void 0,this.brightness)),this.workerSources[R][te][F][q]}getDEMWorkerSource(R,F,q){return this.demWorkerSources[R]||(this.demWorkerSources[R]={}),this.demWorkerSources[R][q]||(this.demWorkerSources[R][q]={}),this.demWorkerSources[R][q][F]||(this.demWorkerSources[R][q][F]=new el),this.demWorkerSources[R][q][F]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new Os),this.rasterArrayWorkerSource}enforceCacheSizeLimit(R,F){s.eb(F)}getWorkerPerformanceMetrics(R,F,q){q(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new $s(self)),$s}),xp(["./shared"],function(s){var pr=Mr;function Mr(u){return!function(r){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var h,p,m=new Blob([""],{type:"text/javascript"}),g=URL.createObjectURL(m);try{p=new Worker(g),h=!0}catch{h=!1}return p&&p.terminate(),URL.revokeObjectURL(g),h}()?function(){var h=document.createElement("canvas");h.width=h.height=1;var p=h.getContext("2d");if(!p)return!1;var m=p.getImageData(0,0,1,1);return m&&m.width===h.width}()?(bt[a=r&&r.failIfMajorPerformanceCaveat]===void 0&&(bt[a]=function(h){var p,m=function(g){var x=document.createElement("canvas"),w=Object.create(Mr.webGLContextAttributes);return w.failIfMajorPerformanceCaveat=g,x.getContext("webgl2",w)}(h);if(!m)return!1;try{p=m.createShader(m.VERTEX_SHADER)}catch{return!1}return!(!p||m.isContextLost())&&(m.shaderSource(p,"void main() {}"),m.compileShader(p),m.getShaderParameter(p,m.COMPILE_STATUS)===!0)}(a)),bt[a]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var a}(u)}var bt={};function Zt(u,r,a){const h=document.createElement(u);return r!=null&&(h.className=r),a&&a.appendChild(h),h}function Di(u,r,a){const h=document.createElementNS("http://www.w3.org/2000/svg",u);for(const p of Object.keys(r))h.setAttributeNS(null,p,String(r[p]));return a&&a.appendChild(h),h}Mr.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const Nr=typeof document<"u"?document.documentElement&&document.documentElement.style:null,zn=Nr&&Nr.userSelect!==void 0?"userSelect":"WebkitUserSelect";let to;function Dn(){Nr&&zn&&(to=Nr[zn],Nr[zn]="none")}function el(){Nr&&zn&&(Nr[zn]=to)}function Os(u){u.preventDefault(),u.stopPropagation(),window.removeEventListener("click",Os,!0)}function Jr(){window.addEventListener("click",Os,!0),window.setTimeout(()=>{window.removeEventListener("click",Os,!0)},0)}function di(u,r){const a=u.getBoundingClientRect();return Do(u,a,r)}function fi(u,r){const a=u.getBoundingClientRect(),h=[];for(let p=0;p=0?0:u.button}function Do(u,r,a){const h=u.offsetWidth===r.width?1:u.offsetWidth/r.width;return new s.P((a.clientX-r.left)*h,(a.clientY-r.top)*h)}class Ac{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(r,a){this._updatedSourceCaches[r]=a,this.setDirty()}discardSourceCacheUpdate(r){delete this._updatedSourceCaches[r]}updateLayer(r){const a=r.scope;this._updatedLayers[a]=this._updatedLayers[a]||new Set,this._updatedLayers[a].add(r.id),this.setDirty()}removeLayer(r){const a=r.scope;this._removedLayers[a]=this._removedLayers[a]||{},this._updatedLayers[a]=this._updatedLayers[a]||new Set,this._removedLayers[a][r.id]=r,this._updatedLayers[a].delete(r.id),this._updatedPaintProps.delete(r.fqid),this.setDirty()}getRemovedLayer(r){return this._removedLayers[r.scope]?this._removedLayers[r.scope][r.id]:null}discardLayerRemoval(r){this._removedLayers[r.scope]&&delete this._removedLayers[r.scope][r.id]}getLayerUpdatesByScope(){const r={};for(const a in this._updatedLayers)r[a]=r[a]||{},r[a].updatedIds=Array.from(this._updatedLayers[a].values());for(const a in this._removedLayers)r[a]=r[a]||{},r[a].removedIds=Object.keys(this._removedLayers[a]);return r}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(r){this._updatedPaintProps.add(r.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(r){this._updatedImages.add(r),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}const tl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ni{constructor(r,a,h,p,m,g){this.length=a.length,this.attributes=h,this.itemSize=a.bytesPerElement,this.dynamicDraw=p,this.instanceCount=g,this.context=r;const x=r.gl;this.buffer=x.createBuffer(),r.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||m||a.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){const a=this.context.gl;this.bind(),a.bufferSubData(a.ARRAY_BUFFER,0,r.arrayBuffer)}enableAttributes(r,a){for(let h=0;h0&&r.vertexAttribDivisor(m,h)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Yt{constructor(r){this.gl=r.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(r){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Vr extends Yt{getDefault(){return s.C.transparent}set(r){const a=this.current;(r.r!==a.r||r.g!==a.g||r.b!==a.b||r.a!==a.a||this.dirty)&&(this.gl.clearColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class Ro extends Yt{getDefault(){return 1}set(r){(r!==this.current||this.dirty)&&(this.gl.clearDepth(r),this.current=r,this.dirty=!1)}}class il extends Yt{getDefault(){return 0}set(r){(r!==this.current||this.dirty)&&(this.gl.clearStencil(r),this.current=r,this.dirty=!1)}}class rl extends Yt{getDefault(){return[!0,!0,!0,!0]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.colorMask(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Qt extends Yt{getDefault(){return!0}set(r){(r!==this.current||this.dirty)&&(this.gl.depthMask(r),this.current=r,this.dirty=!1)}}class Bs extends Yt{getDefault(){return 255}set(r){(r!==this.current||this.dirty)&&(this.gl.stencilMask(r),this.current=r,this.dirty=!1)}}class Ir extends Yt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(r){const a=this.current;(r.func!==a.func||r.ref!==a.ref||r.mask!==a.mask||this.dirty)&&(this.gl.stencilFunc(r.func,r.ref,r.mask),this.current=r,this.dirty=!1)}}class nl extends Yt{getDefault(){const r=this.gl;return[r.KEEP,r.KEEP,r.KEEP]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||this.dirty)&&(this.gl.stencilOp(r[0],r[1],r[2]),this.current=r,this.dirty=!1)}}class Fs extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.STENCIL_TEST):a.disable(a.STENCIL_TEST),this.current=r,this.dirty=!1}}class io extends Yt{getDefault(){return[0,1]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||this.dirty)&&(this.gl.depthRange(r[0],r[1]),this.current=r,this.dirty=!1)}}class Ht extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),this.current=r,this.dirty=!1}}class Lo extends Yt{getDefault(){return this.gl.LESS}set(r){(r!==this.current||this.dirty)&&(this.gl.depthFunc(r),this.current=r,this.dirty=!1)}}class Ui extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.BLEND):a.disable(a.BLEND),this.current=r,this.dirty=!1}}class ol extends Yt{getDefault(){const r=this.gl;return[r.ONE,r.ZERO,r.ONE,r.ZERO]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.blendFuncSeparate(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class sl extends Yt{getDefault(){return s.C.transparent}set(r){const a=this.current;(r.r!==a.r||r.g!==a.g||r.b!==a.b||r.a!==a.a||this.dirty)&&(this.gl.blendColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class al extends Yt{getDefault(){return this.gl.FUNC_ADD}set(r){(r!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(r,r),this.current=r,this.dirty=!1)}}class dt extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.CULL_FACE):a.disable(a.CULL_FACE),this.current=r,this.dirty=!1}}class ko extends Yt{getDefault(){return this.gl.BACK}set(r){(r!==this.current||this.dirty)&&(this.gl.cullFace(r),this.current=r,this.dirty=!1)}}class ai extends Yt{getDefault(){return this.gl.CCW}set(r){(r!==this.current||this.dirty)&&(this.gl.frontFace(r),this.current=r,this.dirty=!1)}}let ll=class extends Yt{getDefault(){return null}set(u){(u!==this.current||this.dirty)&&(this.gl.useProgram(u),this.current=u,this.dirty=!1)}};class cl extends Yt{getDefault(){return this.gl.TEXTURE0}set(r){(r!==this.current||this.dirty)&&(this.gl.activeTexture(r),this.current=r,this.dirty=!1)}}class ul extends Yt{getDefault(){const r=this.gl;return[0,0,r.drawingBufferWidth,r.drawingBufferHeight]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.viewport(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Ns extends Yt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,r),this.current=r,this.dirty=!1}}class Oo extends Yt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class Ur extends Yt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindTexture(a.TEXTURE_2D,r),this.current=r,this.dirty=!1}}class jr extends Yt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindBuffer(a.ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class Vs extends Yt{getDefault(){return null}set(r){const a=this.gl;a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class lt extends Yt{getDefault(){return null}set(r){this.gl&&(r!==this.current||this.dirty)&&(this.gl.bindVertexArray(r),this.current=r,this.dirty=!1)}}class pt extends Yt{getDefault(){return 4}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_ALIGNMENT,r),this.current=r,this.dirty=!1}}class Bo extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this.current=r,this.dirty=!1}}class lr extends Yt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,r),this.current=r,this.dirty=!1}}class pn extends Yt{constructor(r,a){super(r),this.context=r,this.parent=a}getDefault(){return null}}class hl extends pn{setDirty(){this.dirty=!0}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class ro extends pn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferRenderbuffer(a.FRAMEBUFFER,this.attachment(),a.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class dl extends pn{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,this.attachment(),a.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class Ln extends ro{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class kn{constructor(r,a,h,p,m){this.context=r,this.width=a,this.height=h;const g=this.framebuffer=r.gl.createFramebuffer();p&&(this.colorAttachment=new hl(r,g)),m&&(this.depthAttachmentType=m,this.depthAttachment=m==="renderbuffer"?new ro(r,g):new dl(r,g))}destroy(){const r=this.context.gl;if(this.colorAttachment){const a=this.colorAttachment.get();a&&r.deleteTexture(a)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const a=this.depthAttachment.get();a&&r.deleteRenderbuffer(a)}else{const a=this.depthAttachment.get();a&&r.deleteTexture(a)}r.deleteFramebuffer(this.framebuffer)}}class Fo{constructor(r,a){this.gl=r,this.clearColor=new Vr(this),this.clearDepth=new Ro(this),this.clearStencil=new il(this),this.colorMask=new rl(this),this.depthMask=new Qt(this),this.stencilMask=new Bs(this),this.stencilFunc=new Ir(this),this.stencilOp=new nl(this),this.stencilTest=new Fs(this),this.depthRange=new io(this),this.depthTest=new Ht(this),this.depthFunc=new Lo(this),this.blend=new Ui(this),this.blendFunc=new ol(this),this.blendColor=new sl(this),this.blendEquation=new al(this),this.cullFace=new dt(this),this.cullFaceSide=new ko(this),this.frontFace=new ai(this),this.program=new ll(this),this.activeTexture=new cl(this),this.viewport=new ul(this),this.bindFramebuffer=new Ns(this),this.bindRenderbuffer=new Oo(this),this.bindTexture=new Ur(this),this.bindVertexBuffer=new jr(this),this.bindElementBuffer=new Vs(this),this.bindVertexArrayOES=new lt(this),this.pixelStoreUnpack=new pt(this),this.pixelStoreUnpackPremultiplyAlpha=new Bo(this),this.pixelStoreUnpackFlipY=new lr(this),this.options=a?{...a}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=r.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=r.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=r.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=r.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=r.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=r.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=r.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),this.maxPointSize=r.getParameter(r.ALIASED_POINT_SIZE_RANGE)[1]}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.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(r,a,h){return new s.I(this,r,a,h)}createVertexBuffer(r,a,h,p,m){return new ni(this,r,a,h,p,m)}createRenderbuffer(r,a,h){const p=this.gl,m=p.createRenderbuffer();return this.bindRenderbuffer.set(m),p.renderbufferStorage(p.RENDERBUFFER,r,a,h),this.bindRenderbuffer.set(null),m}createFramebuffer(r,a,h,p){return new kn(this,r,a,h,p)}clear({color:r,depth:a,stencil:h,colorMask:p}){const m=this.gl;let g=0;r&&(g|=m.COLOR_BUFFER_BIT,this.clearColor.set(r),this.colorMask.set(p||[!0,!0,!0,!0])),a!==void 0&&(g|=m.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(a),this.depthMask.set(!0)),h!==void 0&&(g|=m.STENCIL_BUFFER_BIT,this.clearStencil.set(h),this.stencilMask.set(255)),m.clear(g)}setCullFace(r){r.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(r.mode),this.frontFace.set(r.frontFace))}setDepthMode(r){r.func!==this.gl.ALWAYS||r.mask?(this.depthTest.set(!0),this.depthFunc.set(r.func),this.depthMask.set(r.mask),this.depthRange.set(r.range)):this.depthTest.set(!1)}setStencilMode(r){r.test.func!==this.gl.ALWAYS||r.mask?(this.stencilTest.set(!0),this.stencilMask.set(r.mask),this.stencilOp.set([r.fail,r.depthFail,r.pass]),this.stencilFunc.set({func:r.test.func,ref:r.ref,mask:r.test.mask})):this.stencilTest.set(!1)}setColorMode(r){s.d(r.blendFunction,s.a.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor),r.blendEquation?this.blendEquation.set(r.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(r.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}class Us{constructor(r,a,h,p){const m={width:h[0],height:h[1],data:null},g=r.gl;this.targetColorTexture=new s.T(r,m,g.RGBA,{useMipmap:!1}),this.backgroundColorTexture=new s.T(r,m,g.RGBA,{useMipmap:!1}),this.context=r,this.updateParticleTexture(a,p),this.lastInvalidatedAt=0}updateParticleTexture(r,a){if(this.particleTextureDimension===a.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const h=this.context.gl,p=a.width*a.height;this.particleTexture0=new s.T(this.context,a,h.RGBA,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new s.T(this.context,a,h.RGBA,{premultiply:!1,useMipmap:!1});const m=new s.S;m.reserve(p);for(let g=0;g{if(!h)return;const p=s.c(h),m=new s.M(r,void 0,void 0,p);return m.computeBoundsAndApplyParent(),m}).catch(h=>{if(h&&h.status===404)return null;this.fire(new s.f(new Error(`Could not load model ${r} from ${a}: ${h.message}`)))})}load(r,a){this.models[a]||(this.models[a]={});const h=Object.keys(r);this.numModelsLoading[a]=(this.numModelsLoading[a]||0)+h.length;const p=[];for(const m of h)p.push(this.loadModel(m,r[m]));Promise.allSettled(p).then(m=>{for(let g=0;g{this.fire(new s.f(new Error(`Could not load models: ${m.message}`)))})}isLoaded(){for(const r in this.numModelsLoading)if(this.numModelsLoading[r]>0)return!1;return!0}hasModel(r,a){return!!this.getModel(r,a)}getModel(r,a){return this.models[a]||(this.models[a]={}),this.models[a][r]?this.models[a][r].model:void 0}addModel(r,a,h){this.models[h]||(this.models[h]={}),this.hasModel(r,h)&&this.models[h][r].numReferences++,this.load({[r]:this.requestManager.normalizeModelURL(a)},h)}addModels(r,a){this.models[a]||(this.models[a]={});const h={};for(const p in r)this.models[a][p]={},h[p]=this.requestManager.normalizeModelURL(r[p]);this.load(h,a)}addModelsFromBucket(r,a){this.models[a]||(this.models[a]={});const h={};for(const p of r)this.hasModel(p,a)?this.models[a][p].numReferences++:h[p]=this.requestManager.normalizeModelURL(p);this.load(h,a)}removeModel(r,a){if(this.models[a]&&this.models[a][r]&&(this.models[a][r].numReferences--,this.models[a][r].numReferences===0)){const h=this.models[a][r].model;delete this.models[a][r],h.destroy()}}listModels(r){return this.models[r]||(this.models[r]={}),Object.keys(this.models[r])}upload(r,a){this.models[a]||(this.models[a]={});for(const h in this.models[a])this.models[a][h].model&&this.models[a][h].model.upload(r.context)}}function Vo(u){const{userImage:r}=u;return!!(r&&r.render&&r.render())&&(u.data.replace(new Uint8Array(r.data.buffer)),!0)}class Ar extends s.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(r){this.images[r]={},this.loaded[r]=!1,this.updatedImages[r]={},this.patterns[r]={},this.callbackDispatchedThisFrame[r]={},this.atlasImage[r]=new s.j({width:1,height:1})}isLoaded(){for(const r in this.loaded)if(!this.loaded[r])return!1;return!0}setLoaded(r,a){if(this.loaded[a]!==r&&(this.loaded[a]=r,r)){for(const{ids:h,callback:p}of this.requestors)this._notify(h,a,p);this.requestors=[]}}hasImage(r,a){return!!this.getImage(r,a)}getImage(r,a){return this.images[a][r]}addImage(r,a,h){this._validate(r,h)&&(this.images[a][r]=h)}_validate(r,a){let h=!0;return this._validateStretch(a.stretchX,a.data&&a.data.width)||(this.fire(new s.f(new Error(`Image "${r}" has invalid "stretchX" value`))),h=!1),this._validateStretch(a.stretchY,a.data&&a.data.height)||(this.fire(new s.f(new Error(`Image "${r}" has invalid "stretchY" value`))),h=!1),this._validateContent(a.content,a)||(this.fire(new s.f(new Error(`Image "${r}" has invalid "content" value`))),h=!1),h}_validateStretch(r,a){if(!r)return!0;let h=0;for(const p of r){if(p[0]m)return[new s.V(r,a,`${a} is greater than the maximum value ${m}`)]}return[]}function er(u){const r=u.valueSpec,a=s.u(u.value.type);let h,p,m,g={};const x=a!=="categorical"&&u.value.property===void 0,w=!x,T=s.o(u.value.stops)==="array"&&s.o(u.value.stops[0])==="array"&&s.o(u.value.stops[0][0])==="object",S=or({key:u.key,value:u.value,valueSpec:u.styleSpec.function,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(z){if(a==="identity")return[new s.V(z.key,z.value,'identity function may not have a "stops" property')];let L=[];const k=z.value;return L=L.concat(ct({key:z.key,value:k,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:I})),s.o(k)==="array"&&k.length===0&&L.push(new s.V(z.key,k,"array must have at least one stop")),L},default:function(z){return Mi({key:z.key,value:z.value,valueSpec:r,style:z.style,styleSpec:z.styleSpec})}}});return a==="identity"&&x&&S.push(new s.V(u.key,u.value,'missing required property "property"')),a==="identity"||u.value.stops||S.push(new s.V(u.key,u.value,'missing required property "stops"')),a==="exponential"&&u.valueSpec.expression&&!s.s(u.valueSpec)&&S.push(new s.V(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(w&&!s.r(u.valueSpec)?S.push(new s.V(u.key,u.value,"property functions not supported")):x&&!s.t(u.valueSpec)&&S.push(new s.V(u.key,u.value,"zoom functions not supported"))),a!=="categorical"&&!T||u.value.property!==void 0||S.push(new s.V(u.key,u.value,'"property" property is required')),S;function I(z){let L=[];const k=z.value,O=z.key;if(s.o(k)!=="array")return[new s.V(O,k,`array expected, ${s.o(k)} found`)];if(k.length!==2)return[new s.V(O,k,`array length 2 expected, length ${k.length} found`)];if(T){if(s.o(k[0])!=="object")return[new s.V(O,k,`object expected, ${s.o(k[0])} found`)];if(k[0].zoom===void 0)return[new s.V(O,k,"object stop key must have zoom")];if(k[0].value===void 0)return[new s.V(O,k,"object stop key must have value")];const B=s.u(k[0].zoom);if(typeof B!="number")return[new s.V(O,k[0].zoom,"stop zoom values must be numbers")];if(m&&m>B)return[new s.V(O,k[0].zoom,"stop zoom values must appear in ascending order")];B!==m&&(m=B,p=void 0,g={}),L=L.concat(or({key:`${O}[0]`,value:k[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:Uo,value:P}}))}else L=L.concat(P({key:`${O}[0]`,value:k[0],valueSpec:{},style:z.style,styleSpec:z.styleSpec},k));return s.v(s.x(k[1]))?L.concat([new s.V(`${O}[1]`,k[1],"expressions are not allowed in function stops.")]):L.concat(Mi({key:`${O}[1]`,value:k[1],valueSpec:r,style:z.style,styleSpec:z.styleSpec}))}function P(z,L){const k=s.o(z.value),O=s.u(z.value),B=z.value!==null?z.value:L;if(h){if(k!==h)return[new s.V(z.key,B,`${k} stop domain type must match previous stop domain type ${h}`)]}else h=k;if(k!=="number"&&k!=="string"&&k!=="boolean"&&typeof O!="number"&&typeof O!="string"&&typeof O!="boolean")return[new s.V(z.key,B,"stop domain value must be a number, string, or boolean")];if(k!=="number"&&a!=="categorical"){let G=`number expected, ${k} found`;return s.r(r)&&a===void 0&&(G+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new s.V(z.key,B,G)]}return a!=="categorical"||k!=="number"||typeof O=="number"&&isFinite(O)&&Math.floor(O)===O?a!=="categorical"&&k==="number"&&typeof O=="number"&&typeof p=="number"&&p!==void 0&&Onew s.V(`${u.key}${h.key}`,u.value,h.message));const a=r.value.expression||r.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!a.outputDefined())return[new s.V(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!s.A(a))return[new s.V(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter")return no(a,u);if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!s.B(a,["zoom","feature-state"]))return[new s.V(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!s.D(a))return[new s.V(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function no(u,r){const a=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(r.valueSpec&&r.valueSpec.expression)for(const p of r.valueSpec.expression.parameters)a.delete(p);if(a.size===0)return[];const h=[];return u instanceof s.F&&a.has(u.name)?[new s.V(r.key,r.value,`["${u.name}"] expression is not supported in a filter for a ${r.object.type} layer with id: ${r.object.id}`)]:(u.eachChild(p=>{h.push(...no(p,r))}),h)}function Cr(u){const r=u.key,a=u.value,h=u.valueSpec,p=[];return Array.isArray(h.values)?h.values.indexOf(s.u(a))===-1&&p.push(new s.V(r,a,`expected one of [${h.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(h.values).indexOf(s.u(a))===-1&&p.push(new s.V(r,a,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(a)} found`)),p}function jo(u){return s.H(s.x(u.value))?Gr(s.q({},u,{expressionContext:"filter",valueSpec:u.styleSpec[`filter_${u.layerType||"fill"}`]})):js(u)}function js(u){const r=u.value,a=u.key;if(s.o(r)!=="array")return[new s.V(a,r,`array expected, ${s.o(r)} found`)];const h=u.styleSpec;let p,m=[];if(r.length<1)return[new s.V(a,r,"filter array must have at least 1 element")];switch(m=m.concat(Cr({key:`${a}[0]`,value:r[0],valueSpec:h.filter_operator,style:u.style,styleSpec:u.styleSpec})),s.u(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&s.u(r[1])==="$type"&&m.push(new s.V(a,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":r.length!==3&&m.push(new s.V(a,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&(p=s.o(r[1]),p!=="string"&&m.push(new s.V(`${a}[1]`,r[1],`string expected, ${p} found`)));for(let g=2;g{T in a&&r.push(new s.V(h,a[T],`"${T}" is prohibited for ref layers`))}),p.layers.forEach(T=>{s.u(T.id)===x&&(w=T)}),w?w.ref?r.push(new s.V(h,a.ref,"ref cannot reference another ref layer")):g=s.u(w.type):typeof x=="string"&&r.push(new s.V(h,a.ref,`ref layer "${x}" not found`))}else if(g!=="background"&&g!=="sky"&&g!=="slot")if(a.source){const w=p.sources&&p.sources[a.source],T=w&&s.u(w.type);w?T==="vector"&&g==="raster"?r.push(new s.V(h,a.source,`layer "${a.id}" requires a raster source`)):T==="raster"&&g!=="raster"?r.push(new s.V(h,a.source,`layer "${a.id}" requires a vector source`)):T!=="vector"||a["source-layer"]?T==="raster-dem"&&g!=="hillshade"?r.push(new s.V(h,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(g)?g!=="line"||!a.paint||!a.paint["line-gradient"]&&!a.paint["line-trim-offset"]||T==="geojson"&&w.lineMetrics?g==="raster-particle"&&T!=="raster-array"&&r.push(new s.V(h,a.source,`layer "${a.id}" requires a 'raster-array' source.`)):r.push(new s.V(h,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new s.V(h,a.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new s.V(h,a,`layer "${a.id}" must specify a "source-layer"`)):r.push(new s.V(h,a.source,`source "${a.source}" not found`))}else r.push(new s.V(h,a,'missing required property "source"'));return r=r.concat(or({key:h,value:a,valueSpec:m.layer,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Mi({key:`${h}.type`,value:a.type,valueSpec:m.layer.type,style:u.style,styleSpec:u.styleSpec,object:a,objectKey:"type"}),filter:w=>jo(s.q({layerType:g},w)),layout:w=>or({layer:a,key:w.key,value:w.value,valueSpec:{},style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":T=>$o(s.q({layerType:g},T))}}),paint:w=>or({layer:a,key:w.key,value:w.value,valueSpec:{},style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":T=>oo(s.q({layerType:g,layer:a},T))}})}})),r}function On(u){const r=u.value,a=u.key,h=s.o(r);return h!=="string"?[new s.V(a,r,`string expected, ${h} found`)]:[]}const Zo={promoteId:function({key:u,value:r}){if(s.o(r)==="string")return On({key:u,value:r});{const a=[];for(const h in r)a.push(...On({key:`${u}.${h}`,value:r[h]}));return a}}};function Pr(u){const r=u.value,a=u.key,h=u.styleSpec,p=u.style;if(!r.type)return[new s.V(a,r,'"type" is required')];const m=s.u(r.type);let g=[];switch(["vector","raster","raster-dem","raster-array"].includes(m)&&(r.url||r.tiles||g.push(new s.n(a,r,'Either "url" or "tiles" is required.'))),m){case"vector":case"raster":case"raster-dem":case"raster-array":return g=g.concat(or({key:a,value:r,valueSpec:h[`source_${m.replace("-","_")}`],style:u.style,styleSpec:h,objectElementValidators:Zo})),g;case"geojson":if(g=or({key:a,value:r,valueSpec:h.source_geojson,style:p,styleSpec:h,objectElementValidators:Zo}),r.cluster)for(const x in r.clusterProperties){const[w,T]=r.clusterProperties[x],S=typeof w=="string"?[w,["accumulated"],["get",x]]:w;g.push(...Gr({key:`${a}.${x}.map`,value:T,expressionContext:"cluster-map"})),g.push(...Gr({key:`${a}.${x}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return g;case"video":return or({key:a,value:r,valueSpec:h.source_video,style:p,styleSpec:h});case"image":return or({key:a,value:r,valueSpec:h.source_image,style:p,styleSpec:h});case"canvas":return[new s.V(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Cr({key:`${a}.type`,value:r.type,valueSpec:{values:Cc(h)},style:p,styleSpec:h})}}function Cc(u){return u.source.reduce((r,a)=>{const h=u[a];return h.type.type==="enum"&&(r=r.concat(Object.keys(h.type.values))),r},[])}function zr(u){const r=u.value,a=u.styleSpec,h=a.light,p=u.style;let m=[];const g=s.o(r);if(r===void 0)return m;if(g!=="object")return m=m.concat([new s.V("light",r,`object expected, ${g} found`)]),m;for(const x in r){const w=x.match(/^(.*)-transition$/);m=m.concat(w&&h[w[1]]&&h[w[1]].transition?Mi({key:x,value:r[x],valueSpec:a.transition,style:p,styleSpec:a}):h[x]?Mi({key:x,value:r[x],valueSpec:h[x],style:p,styleSpec:a}):[new s.V(x,r[x],`unknown property "${x}"`)])}return m}function Bi(u){const r=u.value;let a=[];if(!r)return a;const h=s.o(r);if(h!=="object")return a=a.concat([new s.V("light-3d",r,`object expected, ${h} found`)]),a;const p=u.styleSpec,m=p["light-3d"],g=u.key,x=u.style,w=u.style.lights;for(const I of["type","id"])if(!(I in r))return a=a.concat([new s.V("light-3d",r,`missing property ${I} on light`)]),a;if(r.type&&w)for(let I=0;I[],array:ct,boolean:function(u){const r=u.value,a=u.key,h=s.o(r);return h!=="boolean"?[new s.V(a,r,`boolean expected, ${h} found`)]:[]},number:Uo,color:function(u){const r=u.key,a=u.value,h=s.o(a);return h!=="string"?[new s.V(r,a,`color expected, ${h} found`)]:s.G(a)===null?[new s.V(r,a,`color expected, "${a}" found`)]:[]},enum:Cr,filter:jo,function:er,layer:qo,object:or,source:Pr,model:s.L,light:zr,"light-3d":Bi,terrain:Gs,fog:so,string:On,formatted:function(u){return On(u).length===0?[]:Gr(u)},resolvedImage:function(u){return On(u).length===0?[]:Gr(u)},projection:function(u){const r=u.value,a=u.styleSpec,h=a.projection,p=u.style;let m=[];const g=s.o(r);if(g==="object")for(const x in r)m=m.concat(Mi({key:x,value:r[x],valueSpec:h[x],style:p,styleSpec:a}));else g!=="string"&&(m=m.concat([new s.V("projection",r,`object or string expected, ${g} found`)]));return m},import:function(u){const{value:r,styleSpec:a}=u,{data:h,...p}=r;Object.defineProperty(p,"__line__",{value:r.__line__,enumerable:!1});let m=or(s.q({},u,{value:p,valueSpec:a.import}));return s.u(p.id)===""&&m.push(new s.V(`${u.key}.id`,p,"import id can't be an empty string")),h&&(m=m.concat(oe(h,a,{key:`${u.key}.data`}))),m}};function Mi(u,r=!1){const a=u.value,h=u.valueSpec,p=u.styleSpec;if(h.expression&&s.J(s.u(a)))return er(u);if(h.expression&&s.v(s.x(a)))return Gr(u);if(h.type&&Wo[h.type]){const m=Wo[h.type](u);return r===!0&&m.length>0&&s.o(u.value)==="array"?Gr(u):m}return or(s.q({},u,{valueSpec:h.type?p[h.type]:h}))}function $s(u){const r=u.value,a=u.key,h=On(u);return h.length||(r.indexOf("{fontstack}")===-1&&h.push(new s.V(a,r,'"glyphs" url must include a "{fontstack}" token')),r.indexOf("{range}")===-1&&h.push(new s.V(a,r,'"glyphs" url must include a "{range}" token'))),h}function oe(u,r=s.N,a={}){return Mi({key:a.key||"",value:u,valueSpec:r.$root,styleSpec:r,style:u,objectElementValidators:{glyphs:$s,"*":()=>[]}})}function R(u,r=s.N){return qe(oe(u,r))}const F=u=>qe(Pr(u)),q=u=>qe(zr(u)),te=u=>qe(Bi(u)),K=u=>qe(Gs(u)),ce=u=>qe(so(u)),xe=u=>qe(qo(u)),le=u=>qe(jo(u)),ge=u=>qe(oo(u)),ze=u=>qe($o(u)),Pe=u=>qe(s.L(u));function qe(u){return u.slice().sort((r,a)=>r.line&&a.line?r.line-a.line:0)}function tt(u,r){let a=!1;if(r&&r.length)for(const h of r)h instanceof s.n?s.w(h.message):(u.fire(new s.f(new Error(h.message))),a=!0);return a}let ot;class Bt extends s.E{constructor(r,a="flat"){super(),this._transitionable=new s.O(ot||(ot=new s.U({anchor:new s.W(s.N.light.anchor),position:new s.X(s.N.light.position),color:new s.W(s.N.light.color),intensity:new s.W(s.N.light.intensity)}))),this.setLight(r,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(r,a,h={}){this._validate(q,r,h)||(this._transitionable.setTransitionOrValue(r),this.id=a)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,a,h){return(!h||h.validate!==!1)&&tt(this,r.call(R,s.Q({value:a,style:{glyphs:!0,sprite:!0},styleSpec:s.N})))}}const yt=new s.U({source:new s.W(s.N.terrain.source),exaggeration:new s.W(s.N.terrain.exaggeration)});let kt=class extends s.E{constructor(u,r,a,h){super(),this.scope=a,this._transitionable=new s.O(yt,a,h),this._transitionable.setTransitionOrValue(u,h),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r}get(){return this._transitionable.serialize()}set(u,r){this._transitionable.setTransitionOrValue(u,r)}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}getExaggeration(u){return this._transitioning.possiblyEvaluate(new s.Y(u)).get("exaggeration")}isZoomDependent(){const u=this._transitionable._values.exaggeration;return u!=null&&u.value!=null&&u.value.expression!=null&&u.value.expression instanceof s.Z}};const Je=45,si=65,Ft=.05;function Dt(u,r,a,h){const p=s.a0(Je,si,a),[m,g]=yi(u,h);let x=1-Math.min(1,Math.exp((r-m)/(g-m)*-6));return x*=x*x,x=Math.min(1,1.00747*x),x*p*u.alpha}function yi(u,r){const a=.5/Math.tan(.5*r);return[u.range[0]+a,u.range[1]+a]}function xi(u,r,a,h,p){const m=s.$.transformMat4([],[r,a,h],p.mercatorFogMatrix);return Dt(u,s.$.length(m),p.pitch,p._fov)}function Ri(u,r,a,h,p,m,g){const x=[[a,h,0],[p,h,0],[p,m,0],[a,m,0]];let w=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const S of x){const I=s.$.transformMat4([],S,r),P=s.$.length(I);w=Math.min(w,P),T=Math.max(T,P)}return[Dt(u,w,g.pitch,g._fov),Dt(u,T,g.pitch,g._fov)]}const ji=new s.U({range:new s.W(s.N.fog.range),color:new s.W(s.N.fog.color),"high-color":new s.W(s.N.fog["high-color"]),"space-color":new s.W(s.N.fog["space-color"]),"horizon-blend":new s.W(s.N.fog["horizon-blend"]),"star-intensity":new s.W(s.N.fog["star-intensity"]),"vertical-range":new s.W(s.N.fog["vertical-range"])});class tr extends s.E{constructor(r,a,h,p){super(),this._transitionable=new s.O(ji,h,new Map(p)),this.set(r,p),this._transitioning=this._transitionable.untransitioned(),this._transform=a,this.properties=new s.a1(ji),this.scope=h}get state(){const r=this._transform,a=r.projection.name==="globe",h=s.a2(r.zoom),p=this.properties.get("range"),m=[.5,3];return{range:a?[s.a3(m[0],p[0],h),s.a3(m[1],p[1],h)]:p,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(r,a,h={}){if(this._validate(ce,r,h))return;const p=s.Q({},r);for(const m of Object.keys(s.N.fog))p[m]===void 0&&(p[m]=s.N.fog[m].default);this._options=p,this._transitionable.setTransitionOrValue(this._options,a)}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;const a=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:s.a0(Je,si,r))*a.a}getOpacityAtLatLng(r,a){return this._transform.projection.supportsFog?function(h,p,m){const g=s._.fromLngLat(p),x=m.elevation?m.elevation.getAtPointOrZero(g):0;return xi(h,g.x,g.y,x,m)}(this.state,r,a):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];const a=this._transform.calculateFogTileMatrix(r.toUnwrapped());return Ri(this.state,a,0,0,s.a4,s.a4,this._transform)}getOpacityForBounds(r,a,h,p,m){return this._transform.projection.supportsFog?Ri(this.state,r,a,h,p,m,this._transform):[1,1]}getFovAdjustedRange(r){return this._transform.projection.supportsFog?yi(this.state,r):[0,1]}isVisibleOnFrustum(r){if(!this._transform.projection.supportsFog)return!1;const a=[4,5,6,7];for(const h of a){const p=r.points[h];let m;if(p[2]>=0)m=p;else{const g=r.points[h-4];m=s.a5(g,p,g[2]/(g[2]-p[2]))}if(xi(this.state,m[0],m[1],0,this._transform)>=Ft)return!0}return!1}updateConfig(r){this._transitionable.setTransitionOrValue(this._options,new Map(r))}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,a,h){return(!h||h.validate!==!1)&&tt(this,r.call(R,s.Q({value:a,style:{glyphs:!0,sprite:!0},styleSpec:s.N})))}}class ao extends s.E{constructor(r,a,h,p){super(),this.scope=h,this._options=r,this.properties=new s.a1(a),this._transitionable=new s.O(a,h,new Map(p)),this._transitionable.setTransitionOrValue(r.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(r){this._transitionable.setTransitionOrValue(this._options.properties,new Map(r))}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(r,a){this._options=r,this._transitionable.setTransitionOrValue(r.properties,a)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}let Pc,zc;var qs=` -#define EPSILON 0.0000001 -#define PI 3.141592653589793 -#ifdef RENDER_CUTOFF -float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} -#endif`,wt=` -out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth) -{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} -#ifdef INDICATOR_CUTOUT -uniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; -#endif -vec4 applyCutout(vec4 color) { -#ifdef INDICATOR_CUTOUT -float holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); -#else -return color; -#endif -} -#ifdef DEBUG_WIREFRAME -#define HANDLE_WIREFRAME_DEBUG \\ -glFragColor=vec4(0.7,0.0,0.0,0.7); \\ -gl_FragDepth=gl_FragCoord.z-0.0001; -#else -#define HANDLE_WIREFRAME_DEBUG -#endif -#ifdef RENDER_CUTOFF -uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; -#endif -vec4 textureLodCustom(sampler2D image,vec2 pos,vec2 lod_coord) {vec2 size=vec2(textureSize(image,0));vec2 dx=dFdx(lod_coord.xy*size);vec2 dy=dFdy(lod_coord.xy*size);float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,pl=` -#define EXTENT 8192.0 -#define RAD_TO_DEG 180.0/PI -#define DEG_TO_RAD PI/180.0 -#define GLOBE_RADIUS EXTENT/PI/2.0 -float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} -#ifdef PROJECTION_GLOBE_VIEW -vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { -#ifndef PROJECTED_POS_ON_VIEWPORT -float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; -#else -return vec3(0.0); -#endif -}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} -#endif -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 -);}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;}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} -#ifdef RENDER_CUTOFF -uniform vec4 u_cutoff_params;out float v_cutoff_opacity; -#endif -const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) -{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,Bn="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Dc=` -#define ELEVATION_SCALE 7.0 -#define ELEVATION_OFFSET 450.0 -#ifdef PROJECTION_GLOBE_VIEW -uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( -mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} -#else -vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } -#endif -#ifdef TERRAIN -uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { -#ifdef TERRAIN_DEM_FLOAT_FORMAT -vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; -#else -float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); -#endif -}float prevElevation(vec2 apos) { -#ifdef TERRAIN_DEM_FLOAT_FORMAT -vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; -#else -float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); -#endif -} -#ifdef TERRAIN_VERTEX_MORPHING -float elevation(vec2 apos) { -#ifdef ZERO_EXAGGERATION -return 0.0; -#endif -float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} -#else -float elevation(vec2 apos) { -#ifdef ZERO_EXAGGERATION -return 0.0; -#endif -return currentElevation(apos);} -#endif -vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} -#else -float elevation(vec2 pos) { return 0.0; } -#endif -#ifdef DEPTH_OCCLUSION -uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; -#ifdef DEPTH_D24 -float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} -#else -highp float unpack_depth_rgba(vec4 rgba_depth) -{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} -#endif -bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; -#ifdef DEPTH_D24 -float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); -#else -float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); -#endif -return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; -#ifdef DEPTH_D24 -highp vec4 depth=vec4( -texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r -);depth=unpack_depth4(depth); -#else -highp vec4 depth=vec4( -unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) -); -#endif -return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { -#ifdef DEPTH_D24 -highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); -#else -highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); -#endif -res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} -#else -bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } -#endif//DEPTH_OCCLUSION`,Rc=`#ifdef FOG -uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} -#endif`,Lc=`highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;} -#ifdef FOG -uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( -mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) { -#ifdef FOG_DITHERING -vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed); -#else -return color; -#endif -}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} -#endif`,kc=`#ifdef RASTER_ARRAY -uniform sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) -);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) -);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} -#endif`,Oc=`#ifdef RASTER_ARRAY -uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;} -#endif -uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,Bc=`#ifdef RENDER_SHADOWS -uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];} -#endif//RENDER_SHADOWS`,Fc=`#ifdef RENDER_SHADOWS -#ifdef DEPTH_TEXTURE -uniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1; -#else -uniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1; -#endif -uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth; -#ifdef DEPTH_TEXTURE -shadow_depth=texture(u_shadowmap_1,uv).r; -#else -shadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5; -#endif -return step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth; -#ifdef DEPTH_TEXTURE -shadow_depth=texture(u_shadowmap_0,uv).r; -#else -shadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5; -#endif -return step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias; -#ifdef NATIVE -highp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0)); -#else -highp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4( -shadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0) -); -#endif -vec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) { -#ifdef SHADOWS_SINGLE_CASCADE -light_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias); -#else -light_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)); -#endif -}highp float calculate_shadow_bias(float NDotL) { -#ifdef NORMAL_OFFSET -return 0.5*u_shadow_bias.x; -#else -return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); -#endif -}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} -#endif`;const Zs=[];Ho(qs,Zs),Ho(pl,Zs),Ho(wt,Zs);const Ws={"_prelude_fog.vertex.glsl":Rc,"_prelude_terrain.vertex.glsl":Dc,"_prelude_shadow.vertex.glsl":Bc,"_prelude_fog.fragment.glsl":Lc,"_prelude_shadow.fragment.glsl":Fc,"_prelude_lighting.glsl":` -#ifdef LIGHTING_3D_MODE -uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);} -#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":kc,"_prelude_raster_particle.glsl":Oc},fl={};Rt("",Dc),Rt(Lc,Rc),Rt(Fc,Bc),Rt(kc,""),Rt(Oc,"");const ml=Rt(wt,pl),_h=qs;var gh={background:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform vec4 u_color;uniform float u_opacity; -#ifdef LIGHTING_3D_MODE -in vec4 v_color; -#endif -void main() {vec4 out_color; -#ifdef LIGHTING_3D_MODE -out_color=v_color; -#else -out_color=u_color; -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_lighting.glsl" -in vec2 a_pos;uniform mat4 u_matrix; -#ifdef LIGHTING_3D_MODE -uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength; -#endif -void main() {gl_Position=u_matrix*vec4(a_pos,0,1); -#ifdef LIGHTING_3D_MODE -v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); -#endif -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),backgroundPattern:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos); -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),circle:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -in vec3 v_data;in float v_visibility; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define mediump float radius -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -uniform float u_emissive_strength;void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float opacity_t=smoothstep((1.0-blur_positive)*antialiased_blur,blur_positive*antialiased_blur,extrude_length-1.0)-smoothstep(0.0,antialiasblur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( -antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) -);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_apply_premultiplied(out_color,v_fog_pos); -#endif -glFragColor=out_color*(v_visibility*opacity_t); -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -#define NUM_VISIBILITY_RINGS 2 -#define INV_SQRT2 0.70710678 -#define ELEVATION_BIAS 0.0001 -#define NUM_SAMPLES_PER_RING 16 -uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos; -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; -#endif -out vec3 v_data;out float v_visibility; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define mediump float radius -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { -#if defined(TERRAIN) -return elevation(pos)+ELEVATION_BIAS; -#else -return 0.0; -#endif -}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); -#ifdef PITCH_WITH_MAP -#ifdef PROJECTION_GLOBE_VIEW -return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); -#else -return u_matrix*( world_center+vec4(sample_offset,0,0) ); -#endif -#else -return projected_center+vec4(sample_offset,0,0); -#endif -}float get_sample_step() { -#ifdef PITCH_WITH_MAP -return 2.0*PI/float(NUM_SAMPLES_PER_RING); -#else -return PI/float(NUM_SAMPLES_PER_RING); -#endif -}void main(void) { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors; -#ifdef PROJECTION_GLOBE_VIEW -vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); -#else -surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); -#endif -vec4 projected_center=u_matrix*world_center;float view_scale=0.0; -#ifdef PITCH_WITH_MAP -#ifdef SCALE_WITH_MAP -view_scale=1.0; -#else -view_scale=projected_center.w/u_camera_to_center_distance; -#endif -#else -#ifdef SCALE_WITH_MAP -view_scale=u_camera_to_center_distance; -#else -view_scale=projected_center.w; -#endif -#endif -gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; -#ifdef TERRAIN -float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; -#ifdef PITCH_WITH_MAP -float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; -#else -occlusion_world_center=world_center;occlusion_projected_center=projected_center; -#endif -for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); -#else -visibility=1.0; -#endif -#ifdef PROJECTION_GLOBE_VIEW -visibility=1.0; -#endif -v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); -#ifdef FOG -v_fog_pos=fog_position(world_center.xyz); -#endif -}`),clippingMask:Rt("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Rt(`#include "_prelude_fog.fragment.glsl" -uniform highp float u_intensity;in vec2 v_extrude; -#pragma mapbox: define highp float weight -#define GAUSS_COEF 0.3989422804014327 -void main() { -#pragma mapbox: initialize highp float weight -float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); -#ifdef FOG -if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} -#endif -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" -#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; -#endif -out vec2 v_extrude; -#pragma mapbox: define highp float weight -#pragma mapbox: define mediump float radius -const highp float ZERO=1.0/255.0/16.0; -#define GAUSS_COEF 0.3989422804014327 -void main(void) { -#pragma mapbox: initialize highp float weight -#pragma mapbox: initialize mediump float radius -vec2 unscaled_extrude=vec2(mod(a_pos,2.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 tilePos=floor(a_pos*0.5);vec3 pos; -#ifdef PROJECTION_GLOBE_VIEW -vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); -#else -pos=vec3(tilePos+extrude,elevation(tilePos)); -#endif -gl_Position=u_matrix*vec4(pos,1); -#ifdef FOG -v_fog_pos=fog_position(pos); -#endif -}`),heatmapTexture:Rt(`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));glFragColor=color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(0.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Rt("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" -in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in float a_size_scale;in vec2 a_padding;in float a_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(a_z_offset+elevation(a_anchor_pos)),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( -0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Rt("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;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;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( -0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Rt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" -in vec2 a_pos; -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_pos_3; -#endif -out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; -#ifdef PROJECTION_GLOBE_VIEW -gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); -#else -gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); -#endif -}`),fill:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -uniform float u_emissive_strength;void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -vec4 out_color=color; -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*opacity; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -in vec2 a_pos;uniform mat4 u_matrix; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1); -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),fillOutline:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -in highp vec2 v_pos;uniform float u_emissive_strength; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -in vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),fillOutlinePattern:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in highp vec2 v_pos;in highp vec2 v_pos_world; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;out highp vec2 v_pos_world; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern -#pragma mapbox: define lowp float pixel_ratio -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize lowp float pixel_ratio -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),fillPattern:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform vec2 u_texsize;uniform sampler2D u_image;in vec2 v_pos;uniform float u_emissive_strength; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -glFragColor=out_color*opacity; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern -#pragma mapbox: define lowp float pixel_ratio -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize lowp float pixel_ratio -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),fillExtrusion:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_shadow.fragment.glsl" -#include "_prelude_lighting.glsl" -in vec4 v_color;in vec4 v_flat; -#ifdef RENDER_SHADOWS -in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; -#endif -uniform lowp float u_opacity; -#ifdef FAUX_AO -uniform lowp vec2 u_ao;in vec2 v_ao; -#endif -#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) -in vec4 v_roof_color; -#endif -#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) -in highp vec3 v_normal; -#endif -uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; -#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) -in float v_flood_radius;in float v_has_floodlight; -#endif -uniform float u_emissive_strength;in float v_height;void main() { -#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) -vec3 normal=normalize(v_normal); -#endif -float z;vec4 color=v_color; -#ifdef ZERO_ROOF_RADIUS -z=float(normal.z > 0.00001); -#ifdef LIGHTING_3D_MODE -normal=mix(normal,vec3(0.0,0.0,1.0),z); -#else -color=mix(v_color,v_roof_color,z); -#endif -#endif -float h=max(0.0,v_height);float ao_shade=1.0; -#ifdef FAUX_AO -float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; -#ifdef ZERO_ROOF_RADIUS -concave*=(1.0-z); -#endif -float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); -#ifdef LIGHTING_3D_MODE -#ifdef FLOOD_LIGHT -color.rgb*=mix(ao_shade,1.0,v_has_floodlight); -#else -color.rgb*=ao_shade; -#endif -#else -color.rgb*=ao_shade; -#endif -#endif -#ifdef LIGHTING_3D_MODE -float flood_radiance=0.0; -#ifdef FLOOD_LIGHT -flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; -#endif -#ifdef RENDER_SHADOWS -#ifdef FLOOD_LIGHT -float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); -#else -float shadowed_lighting_factor; -#ifdef RENDER_CUTOFF -shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} -#else -shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); -#endif -color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); -#endif -#else -color.rgb=apply_lighting(color.rgb,normal); -#ifdef FLOOD_LIGHT -color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); -#endif -#endif -color.rgb=mix(color.rgb,v_flat.rgb,u_emissive_strength);color*=u_opacity; -#endif -#ifdef FOG -color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); -#endif -#ifdef INDICATOR_CUTOUT -color=applyCutout(color); -#endif -glFragColor=color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -#include "_prelude_shadow.vertex.glsl" -#include "_prelude_lighting.glsl" -uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_alignment;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; -#ifdef RENDER_WALL_MODE -in vec4 a_join_normal_inside_polygon; -#endif -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; -#endif -uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; -#ifdef RENDER_SHADOWS -uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; -#endif -#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) -out vec4 v_roof_color; -#endif -#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) -out highp vec3 v_normal; -#endif -#ifdef FAUX_AO -uniform lowp vec2 u_ao;out vec2 v_ao; -#endif -#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) -out float v_flood_radius;out float v_has_floodlight; -#endif -out float v_height; -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define highp vec4 color -#pragma mapbox: define highp float flood_light_wall_radius -#pragma mapbox: define highp float line_width -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize highp float flood_light_wall_radius -#pragma mapbox: initialize highp float line_width -base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); -#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) -v_normal=normal; -#endif -base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); -#if defined(HAS_CENTROID) || defined(TERRAIN) -centroid_pos=a_centroid_pos; -#endif -float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; -#ifdef TERRAIN -bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h); -#else -h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); -#endif -#ifdef PROJECTION_GLOBE_VIEW -float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); -#endif -float cutoff=1.0;vec3 scaled_pos=pos; -#ifdef RENDER_CUTOFF -vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); -#endif -float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0)); -#ifdef RENDER_WALL_MODE -vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside_polygon.xy/EXTENT);float isPolygon=a_join_normal_inside_polygon.w;float sideAlignment=abs(isPolygon*u_alignment);scaled_pos.xy+=(1.0-a_join_normal_inside_polygon.z)*mix(wall_offset*0.5,wall_offset*mix(1.0,0.0,max(u_alignment,0.0)),sideAlignment);scaled_pos.xy-=a_join_normal_inside_polygon.z*mix(wall_offset*0.5,wall_offset*mix(0.0,1.0,max(u_alignment,0.0)),sideAlignment); -#endif -gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; -#ifdef RENDER_SHADOWS -vec3 shd_pos0=pos;vec3 shd_pos1=pos; -#ifdef NORMAL_OFFSET -vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); -#endif -v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); -#endif -float NdotL=0.0;float colorvalue=0.0; -#ifndef LIGHTING_3D_MODE -colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( -(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} -#endif -#ifdef FAUX_AO -float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; -#ifdef TERRAIN -top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); -#endif -v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); -#ifdef PROJECTION_GLOBE_VIEW -top_height+=u_height_lift; -#endif -gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; -#endif -#ifdef LIGHTING_3D_MODE -#ifdef FLOOD_LIGHT -float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; -#endif -v_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0); -#else -v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; -#endif -#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) -float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; -#endif -#ifdef FOG -v_fog_pos=fog_position(pos); -#endif -}`),fillExtrusionDepth:Rt(`in highp float v_depth;void main() { -#ifndef DEPTH_TEXTURE -glFragColor=pack_depth(v_depth); -#endif -}`,`#include "_prelude_terrain.vertex.glsl" -uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_alignment;uniform float u_width_scale;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; -#ifdef RENDER_WALL_MODE -in vec4 a_join_normal_inside_polygon; -#endif -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define highp float line_width -out highp float v_depth;void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize highp float line_width -base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); -#if defined(HAS_CENTROID) || defined(TERRAIN) -centroid_pos=a_centroid_pos; -#endif -vec3 pos; -#ifdef TERRAIN -bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base);pos=vec3(pos_nx.xy,h); -#else -pos=vec3(pos_nx.xy,t > 0.0 ? height : base); -#endif -#ifdef RENDER_WALL_MODE -vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside_polygon.xy/EXTENT);float isPolygon=a_join_normal_inside_polygon.w;float sideAlignment=abs(isPolygon*u_alignment);pos.xy+=(1.0-a_join_normal_inside_polygon.z)*mix(wall_offset*0.5,wall_offset*mix(1.0,0.0,max(u_alignment,0.0)),sideAlignment);pos.xy-=a_join_normal_inside_polygon.z*mix(wall_offset*0.5,wall_offset*mix(0.0,1.0,max(u_alignment,0.0)),sideAlignment); -#endif -float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform vec2 u_texsize;uniform sampler2D u_image; -#ifdef FAUX_AO -uniform lowp vec2 u_ao;in vec3 v_ao; -#endif -#ifdef LIGHTING_3D_MODE -in vec3 v_normal; -#endif -in vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define mediump vec4 pattern -#pragma mapbox: define highp float pixel_ratio -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize highp float pixel_ratio -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; -#else -out_color=out_color*v_lighting; -#endif -#ifdef FAUX_AO -float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -#ifdef INDICATOR_CUTOUT -out_color=applyCutout(out_color); -#endif -glFragColor=out_color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -#include "_prelude_lighting.glsl" -uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_alignment;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; -#ifdef RENDER_WALL_MODE -in vec4 a_join_normal_inside_polygon; -#endif -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; -#endif -out vec2 v_pos;out vec4 v_lighting; -#ifdef FAUX_AO -uniform lowp vec2 u_ao;out vec3 v_ao; -#endif -#ifdef LIGHTING_3D_MODE -out vec3 v_normal; -#endif -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define mediump vec4 pattern -#pragma mapbox: define highp float pixel_ratio -#pragma mapbox: define highp float line_width -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize highp float pixel_ratio -#pragma mapbox: initialize highp float line_width -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); -#if defined(HAS_CENTROID) || defined(TERRAIN) -centroid_pos=a_centroid_pos; -#endif -float ele=0.0;float h=z;vec3 p;float c_ele; -#ifdef TERRAIN -bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h); -#else -p=vec3(pos_nx.xy,z); -#endif -#ifdef PROJECTION_GLOBE_VIEW -float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); -#endif -#ifdef RENDER_WALL_MODE -vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside_polygon.xy/EXTENT);float isPolygon=a_join_normal_inside_polygon.w;float sideAlignment=abs(isPolygon*u_alignment);p.xy+=(1.0-a_join_normal_inside_polygon.z)*mix(wall_offset*0.5,wall_offset*mix(1.0,0.0,max(u_alignment,0.0)),sideAlignment);p.xy-=a_join_normal_inside_polygon.z*mix(wall_offset*0.5,wall_offset*mix(0.0,1.0,max(u_alignment,0.0)),sideAlignment); -#endif -float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 -? pos_nx.xy -: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; -#ifdef LIGHTING_3D_MODE -NdotL=calculate_NdotL(normal); -#else -NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); -#endif -if (normal.y !=0.0) {float r=0.84; -#ifndef LIGHTING_3D_MODE -r=mix(0.7,0.98,1.0-u_lightintensity); -#endif -NdotL*=( -(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} -#ifdef FAUX_AO -float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; -#ifdef TERRAIN -top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); -#endif -v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); -#ifdef PROJECTION_GLOBE_VIEW -top_height+=u_height_lift; -#endif -gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; -#endif -#ifdef LIGHTING_3D_MODE -v_normal=normal; -#else -v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; -#endif -#ifdef FOG -v_fog_pos=fog_position(p); -#endif -}`),groundShadow:Rt(`#include "_prelude_shadow.fragment.glsl" -precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; -#ifdef FOG -in float v_fog_opacity; -#endif -void main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); -#ifdef RENDER_CUTOFF -shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); -#endif -#ifdef FOG -shadow=mix(shadow,vec3(1.0),v_fog_opacity); -#endif -#ifdef INDICATOR_CUTOUT -shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r); -#endif -glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; -#ifdef FOG -out float v_fog_opacity; -#endif -void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); -#ifdef FOG -v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); -#endif -}`),fillExtrusionGroundEffect:Rt(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; -#ifdef SDF_SUBPASS -in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} -#ifdef FOG -in highp float v_fog; -#endif -#endif -void main() { -#ifdef CLEAR_SUBPASS -vec4 color=vec4(1.0); -#ifdef CLEAR_FROM_TEXTURE -color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); -#endif -glFragColor=color; -#else -#ifdef SDF_SUBPASS -highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; -#ifdef FOG -fog=v_fog; -#endif -#ifdef RENDER_CUTOFF -fog*=v_cutoff_opacity; -#endif -glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); -#else -vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); -#ifdef OVERDRAW_INSPECTOR -color=vec4(1.0); -#endif -glFragColor=color; -#endif -HANDLE_WIREFRAME_DEBUG; -#endif -}`,`#include "_prelude_fog.vertex.glsl" -in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; -#ifdef SDF_SUBPASS -out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; -#ifdef FOG -out highp float v_fog; -#endif -#endif -uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp vec2 u_ao; -#pragma mapbox: define highp float flood_light_ground_radius -const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { -#pragma mapbox: initialize highp float flood_light_ground_radius -vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(1.0,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; -#ifdef SDF_SUBPASS -v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); -#ifdef FOG -v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); -#endif -#endif -float hidden_by_landmark=0.0; -#ifdef HAS_CENTROID -hidden_by_landmark=a_hidden_by_landmark; -#endif -float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); -#ifdef RENDER_CUTOFF -v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); -#endif -}`),hillshadePrepare:Rt(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) -)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( -deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"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:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; -#ifdef LIGHTING_3D_MODE -glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); -#endif -#ifdef FOG -glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); -#endif -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0; -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -}`),line:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv; -#ifdef RENDER_LINE_DASH -uniform sampler2D u_dash_image;in vec2 v_tex; -#endif -#ifdef RENDER_LINE_GRADIENT -uniform sampler2D u_gradient_image; -#endif -float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float floorwidth -#pragma mapbox: define lowp vec4 dash -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float border_width -#pragma mapbox: define lowp vec4 border_color -float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float floorwidth -#pragma mapbox: initialize lowp vec4 dash -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float border_width -#pragma mapbox: initialize lowp vec4 border_color -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); -#ifdef RENDER_LINE_DASH -float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist); -#endif -highp vec4 out_color; -#ifdef RENDER_LINE_GRADIENT -out_color=texture(u_gradient_image,v_uv.xy); -#else -out_color=color; -#endif -float trim_alpha=1.0; -#ifdef RENDER_LINE_TRIM_OFFSET -highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=out_color.a;} -#endif -if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} -#ifdef RENDER_LINE_BORDER -float edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trim_alpha,out_color.rgb,smoothAlpha);}} -#endif -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); -#endif -#ifdef FOG -out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); -#endif -out_color*=(alpha*opacity); -#ifdef INDICATOR_CUTOUT -out_color=applyCutout(out_color); -#endif -glFragColor=out_color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -#define EXTRUDE_SCALE 0.015873016 -in vec2 a_pos_normal;in vec4 a_data; -#if defined(ELEVATED) -in float a_z_offset; -#endif -#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) -in highp vec4 a_packed; -#endif -#ifdef RENDER_LINE_DASH -in float a_linesofar; -#endif -uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;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 vec4 v_uv; -#ifdef RENDER_LINE_DASH -uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; -#endif -#ifdef RENDER_LINE_GRADIENT -uniform float u_image_height; -#endif -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float floorwidth -#pragma mapbox: define lowp vec4 dash -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float border_width -#pragma mapbox: define lowp vec4 border_color -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float floorwidth -#pragma mapbox: initialize lowp vec4 dash -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float border_width -#pragma mapbox: initialize lowp vec4 border_color -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;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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0); -#if defined(ELEVATED) -vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*0.1*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias); -#else -gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; -#endif -#ifndef RENDER_TO_TEXTURE -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#else -v_gamma_scale=1.0; -#endif -#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) -float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3]; -#ifdef RENDER_LINE_GRADIENT -highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end); -#else -v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end); -#endif -#endif -#ifdef RENDER_LINE_DASH -float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y); -#endif -v_width2=vec2(outset,inset); -#ifdef FOG -v_fog_pos=fog_position(pos); -#endif -}`),linePattern:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform highp float u_device_pixel_ratio;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; -#ifdef RENDER_LINE_TRIM_OFFSET -in highp vec4 v_uv; -#endif -#ifdef LINE_JOIN_NONE -in vec2 v_pattern_data; -#endif -#pragma mapbox: define mediump vec4 pattern -#pragma mapbox: define mediump float pixel_ratio -#pragma mapbox: define mediump float blur -#pragma mapbox: define mediump float opacity -void main() { -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize mediump float pixel_ratio -#pragma mapbox: initialize mediump float blur -#pragma mapbox: initialize mediump float opacity -vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.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);highp float pattern_x=v_linesofar/pattern_size*aspect;float x=mod(pattern_x,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); -#ifdef RENDER_LINE_TRIM_OFFSET -highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}} -#endif -#ifdef LINE_JOIN_NONE -float pattern_len=pattern_size/aspect;float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);} -#endif -#ifdef LIGHTING_3D_MODE -color=apply_lighting_ground(color); -#endif -#ifdef FOG -color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); -#endif -color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} -#ifdef INDICATOR_CUTOUT -color=applyCutout(color); -#endif -glFragColor=color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -#define scale 0.015873016 -in vec2 a_pos_normal;in vec4 a_data; -#if defined(ELEVATED) -in float a_z_offset; -#endif -#ifdef RENDER_LINE_TRIM_OFFSET -in highp vec4 a_packed; -#endif -in highp float a_linesofar; -#ifdef LINE_JOIN_NONE -in highp vec3 a_pattern_data;out vec2 v_pattern_data; -#endif -uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; -#ifdef RENDER_LINE_TRIM_OFFSET -out highp vec4 v_uv; -#endif -#pragma mapbox: define mediump float blur -#pragma mapbox: define mediump float opacity -#pragma mapbox: define mediump float offset -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define mediump float width -#pragma mapbox: define mediump float floorwidth -#pragma mapbox: define mediump vec4 pattern -#pragma mapbox: define mediump float pixel_ratio -void main() { -#pragma mapbox: initialize mediump float blur -#pragma mapbox: initialize mediump float opacity -#pragma mapbox: initialize mediump float offset -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize mediump float floorwidth -#pragma mapbox: initialize mediump vec4 pattern -#pragma mapbox: initialize mediump float pixel_ratio -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;vec2 pos=floor(a_pos_normal*0.5);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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0); -#if defined(ELEVATED) -vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*0.1*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias); -#else -gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; -#endif -#ifndef RENDER_TO_TEXTURE -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#else -v_gamma_scale=1.0; -#endif -#ifdef RENDER_LINE_TRIM_OFFSET -float a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end); -#endif -v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth; -#ifdef LINE_JOIN_NONE -v_width=floorwidth+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y); -#endif -#ifdef FOG -v_fog_pos=fog_position(pos); -#endif -}`),raster:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -#include "_prelude_raster_array.glsl" -uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth; -#ifdef PROJECTION_GLOBE_VIEW -in float v_split_fade; -#endif -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;uniform float u_emissive_strength; -#ifndef RASTER_ARRAY -uniform sampler2D u_image0;uniform sampler2D u_image1; -#endif -#ifdef RASTER_COLOR -uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; -#endif -void main() {vec4 color0,color1,color;vec2 value; -#ifdef RASTER_COLOR -#ifdef RASTER_ARRAY -#ifdef RASTER_ARRAY_LINEAR -value=mix( -raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t -); -#else -value=mix( -raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t -); -#endif -if (value.y > 0.0) value.x/=value.y; -#else -color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a); -#endif -color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; -#else -color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t); -#endif -color.a*=u_opacity; -#ifdef GLOBE_POLES -color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); -#endif -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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; -#endif -#ifdef FOG -highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); -#endif -glFragColor=vec4(out_color*color.a,color.a); -#ifdef PROJECTION_GLOBE_VIEW -glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); -#endif -#ifdef RENDER_CUTOFF -glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); -#endif -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; -#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 -#ifdef GLOBE_POLES -in vec3 a_globe_pos;in vec2 a_uv; -#else -in vec2 a_pos;in vec2 a_texture_pos; -#endif -out vec2 v_pos0;out vec2 v_pos1;out float v_depth; -#ifdef PROJECTION_GLOBE_VIEW -out float v_split_fade; -#endif -void main() {vec2 uv; -#ifdef GLOBE_POLES -vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv; -#ifdef FOG -v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); -#endif -#else -float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; -#ifdef PROJECTION_GLOBE_VIEW -vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); -v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; -#ifdef FOG -v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); -#endif -#else -gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -#endif -#endif -v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1; -#ifdef RENDER_CUTOFF -v_depth=gl_Position.z; -#endif -}`),rasterParticle:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb; -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb; -#endif -#ifdef FOG -highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); -#endif -glFragColor=vec4(out_color*color.a,color.a); -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; -#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 -in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; -#ifdef PROJECTION_GLOBE_VIEW -vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; -#ifdef FOG -v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); -#endif -#else -uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); -#ifdef FOG -v_fog_pos=fog_position(a_pos); -#endif -#endif -v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Rt("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl" -in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2( -mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Rt("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Rt(`#include "_prelude_raster_particle.glsl" -uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow( -linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) -);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbolIcon:Rt(`#include "_prelude_lighting.glsl" -uniform sampler2D u_texture; -#ifdef ICON_TRANSITION -uniform float u_icon_transition; -#endif -in float v_fade_opacity;in vec2 v_tex_a; -#ifdef ICON_TRANSITION -in vec2 v_tex_b; -#endif -#ifdef COLOR_ADJUSTMENT -uniform mat4 u_color_adj_mat; -#endif -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float emissive_strength -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float emissive_strength -lowp float alpha=opacity*v_fade_opacity;vec4 out_color; -#ifdef ICON_TRANSITION -vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b); -#else -out_color=texture(u_texture,v_tex_a); -#endif -#ifdef COLOR_ADJUSTMENT -out_color=u_color_adj_mat*out_color; -#endif -out_color*=alpha; -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); -#endif -glFragColor=out_color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" -in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; -#ifdef OCCLUSION_QUERIES -in float a_occlusion_query_opacity; -#endif -#ifdef Z_OFFSET -in float a_z_offset; -#endif -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_globe_anchor;in vec3 a_globe_normal; -#endif -#ifdef ICON_TRANSITION -in vec2 a_texb; -#endif -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 bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;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 vec3 u_up_vector; -#ifdef PROJECTION_GLOBE_VIEW -uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; -#endif -out vec2 v_tex_a; -#ifdef ICON_TRANSITION -out vec2 v_tex_b; -#endif -out float v_fade_opacity; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float emissive_strength -#pragma mapbox: define lowp float occlusion_opacity -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float emissive_strength -#pragma mapbox: initialize lowp float occlusion_opacity -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];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 tile_anchor=a_pos;float e=elevation(tile_anchor); -#ifdef Z_OFFSET -e+=a_z_offset; -#endif -vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; -#ifdef PROJECTION_GLOBE_VIEW -mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; -#else -world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; -#endif -vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( -0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;vec2 a; -#ifdef PROJECTION_GLOBE_VIEW -vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; -#else -offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; -#endif -vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; -#ifdef PROJECTION_GLOBE_VIEW -vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); -#else -projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); -#endif -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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); -#ifdef TERRAIN -#ifdef PITCH_WITH_MAP_TERRAIN -vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); -#endif -#endif -float occlusion_fade=globe_occlusion_fade;float projection_transition_fade=1.0; -#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) -projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); -#endif -vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0); -#ifdef PROJECTION_GLOBE_VIEW -vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden); -#else -gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden); -#endif -v_tex_a=a_tex/u_texsize; -#ifdef ICON_TRANSITION -v_tex_b=a_texb/u_texsize; -#endif -v_fade_opacity=out_fade_opacity; -#ifdef DEPTH_OCCLUSION -float depthOcclusion=occlusionFadeMultiSample(projected_point);float depthOcclusionMultplier=mix(occlusion_opacity,1.0,depthOcclusion);v_fade_opacity*=depthOcclusionMultplier; -#endif -#ifdef OCCLUSION_QUERIES -float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);v_fade_opacity*=occludedFadeMultiplier; -#endif -}`),symbolSDF:Rt(`#include "_prelude_lighting.glsl" -#define SDF_PX 8.0 -uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;in float v_draw_halo;in vec2 v_data0;in vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -#pragma mapbox: define lowp float emissive_strength -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -#pragma mapbox: initialize lowp float emissive_strength -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 fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); -#endif -glFragColor=out_color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" -in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; -#ifdef Z_OFFSET -in float a_z_offset; -#endif -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_globe_anchor;in vec3 a_globe_normal; -#endif -#ifdef OCCLUSION_QUERIES -in float a_occlusion_query_opacity; -#endif -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_matrix;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_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 vec3 u_up_vector;uniform bool u_is_halo; -#ifdef PROJECTION_GLOBE_VIEW -uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; -#endif -out float v_draw_halo;out vec2 v_data0;out vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -#pragma mapbox: define lowp float emissive_strength -#pragma mapbox: define lowp float occlusion_opacity -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -#pragma mapbox: initialize lowp float emissive_strength -#pragma mapbox: initialize lowp float occlusion_opacity -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];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 tile_anchor=a_pos;float e=elevation(tile_anchor); -#ifdef Z_OFFSET -e+=a_z_offset; -#endif -vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; -#ifdef PROJECTION_GLOBE_VIEW -mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; -#else -world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; -#endif -vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( -0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a; -#ifdef PROJECTION_GLOBE_VIEW -vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; -#else -offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; -#endif -vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; -#ifdef PROJECTION_GLOBE_VIEW -vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); -#else -projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); -#endif -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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset); -#ifdef TERRAIN -#ifdef PITCH_WITH_MAP_TERRAIN -vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); -#endif -#endif -float occlusion_fade=globe_occlusion_fade;float projection_transition_fade=1.0; -#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) -projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); -#endif -vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade; -#ifdef DEPTH_OCCLUSION -float depthOcclusion=occlusionFadeMultiSample(projected_point);float depthOcclusionMultplier=mix(occlusion_opacity,1.0,depthOcclusion);out_fade_opacity*=depthOcclusionMultplier; -#endif -#ifdef OCCLUSION_QUERIES -float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; -#endif -float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0); -#ifdef PROJECTION_GLOBE_VIEW -vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden); -#else -gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden); -#endif -float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,out_fade_opacity);}`),symbolTextAndIcon:Rt(`#include "_prelude_lighting.glsl" -#define SDF_PX 8.0 -#define SDF 1.0 -#define ICON 0.0 -uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_halo;in float v_draw_halo;in vec4 v_data0;in vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -#pragma mapbox: define lowp float emissive_strength -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -#pragma mapbox: initialize lowp float emissive_strength -float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -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;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity); -#ifdef LIGHTING_3D_MODE -out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); -#endif -glFragColor=out_color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" -in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_projected_pos;in float a_fade_opacity; -#ifdef OCCLUSION_QUERIES -in float a_occlusion_query_opacity; -#endif -#ifdef Z_OFFSET -in float a_z_offset; -#endif -#ifdef PROJECTION_GLOBE_VIEW -in vec3 a_globe_anchor;in vec3 a_globe_normal; -#endif -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_matrix;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_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 vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; -#ifdef PROJECTION_GLOBE_VIEW -uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; -#endif -out float v_draw_halo;out vec4 v_data0;out vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -#pragma mapbox: define lowp float emissive_strength -#pragma mapbox: define lowp float occlusion_opacity -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -#pragma mapbox: initialize lowp float emissive_strength -#pragma mapbox: initialize lowp float occlusion_opacity -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];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 tile_anchor=a_pos;float e=elevation(tile_anchor); -#ifdef Z_OFFSET -e+=a_z_offset; -#endif -vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; -#ifdef PROJECTION_GLOBE_VIEW -mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; -#else -world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; -#endif -vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( -0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; -#ifdef PROJECTION_GLOBE_VIEW -vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); -#else -projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); -#endif -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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale); -#ifdef TERRAIN -#ifdef PITCH_WITH_MAP_TERRAIN -vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); -#endif -#endif -float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0; -#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) -projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); -#endif -float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade; -#ifdef DEPTH_OCCLUSION -float depthOcclusion=occlusionFadeMultiSample(projected_point);float depthOcclusionMultplier=mix(occlusion_opacity,1.0,depthOcclusion);out_fade_opacity*=depthOcclusionMultplier; -#endif -#ifdef OCCLUSION_QUERIES -float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; -#endif -float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0); -#ifdef PROJECTION_GLOBE_VIEW -vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+ xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden); -#else -gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden); -#endif -float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,out_fade_opacity,is_sdf);}`),terrainRaster:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_shadow.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform sampler2D u_image0;in vec2 v_pos0; -#ifdef FOG -in float v_fog_opacity; -#endif -#ifdef RENDER_SHADOWS -in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; -#endif -uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; -#ifdef LIGHTING_3D_MODE -const vec3 normal=vec3(0.0,0.0,1.0); -#ifdef RENDER_SHADOWS -float cutoffOpacity=1.0; -#ifdef RENDER_CUTOFF -cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); -#endif -#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS -vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; -#else -float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity)); -#endif -#else -float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); -#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS -color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0; -#endif -#endif -#else -color=image_color; -#endif -#ifdef FOG -#ifdef ZERO_EXAGGERATION -color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); -#else -color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); -#endif -#endif -glFragColor=color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; -#ifdef FOG -out float v_fog_opacity; -#endif -#ifdef RENDER_SHADOWS -uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth; -#endif -void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); -#ifdef FOG -#ifdef ZERO_EXAGGERATION -v_fog_pos=fog_position(decodedPos); -#else -v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); -#endif -#endif -#ifdef RENDER_SHADOWS -vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.); -#endif -}`),terrainDepth:Rt("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" -uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Rt(`#include "_prelude_fog.fragment.glsl" -in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( -cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; -#ifdef FOG -sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); -#endif -sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -}`,Bn),skyboxGradient:Rt(`#include "_prelude_fog.fragment.glsl" -in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5)); -#ifdef FOG -color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; -#endif -color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -}`,Bn),skyboxCapture:Rt(` -in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float; -#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) -#define BETA_M vec3(21e-6,21e-6,21e-6) -#define MIE_G 0.76 -#define DENSITY_HEIGHT_SCALE_R 8000.0 -#define DENSITY_HEIGHT_SCALE_M 1200.0 -#define PLANET_RADIUS 6360e3 -#define ATMOSPHERE_RADIUS 6420e3 -#define SAMPLE_STEPS 10 -#define DENSITY_STEPS 4 -float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0; -#ifndef FOG -uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; -#endif -void main() {vec4 color; -#ifdef CUSTOM_ANTIALIASING -vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( -mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); -#ifdef LIGHTING_3D_MODE -#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS -raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias); -#else -raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); -#endif -#else -color=vec4(raster.rgb*antialias,raster.a*antialias); -#endif -#else -color=texture(u_image0,v_pos0); -#ifdef LIGHTING_3D_MODE -#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS -color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0; -#else -color=apply_lighting_ground(color); -#endif -#endif -#endif -#ifdef FOG -color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); -#endif -color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_terrain.vertex.glsl" -uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; -#ifdef GLOBE_POLES -in vec3 a_globe_pos;in vec2 a_uv; -#else -in vec2 a_pos; -#endif -out vec2 v_pos0;void main() { -#ifdef GLOBE_POLES -vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; -#else -float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); -#endif -v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; -#ifdef GLOBE_POLES -vec3 up_vector=globe_derived_up_vector; -#else -vec3 up_vector=elevationVector(tile_pos); -#endif -float height=elevation(tile_pos);globe_pos+=up_vector*height; -#ifndef GLOBE_POLES -globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; -#endif -#ifdef GLOBE_POLES -vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); -#else -vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); -#endif -gl_Position=u_proj_matrix*interpolated_pos; -#ifdef FOG -v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); -#endif -}`),globeAtmosphere:Rt(`#include "_prelude_fog.fragment.glsl" -uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; -#ifdef PROJECTION_GLOBE_VIEW -globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) { -#ifdef ALPHA_PASS -glFragColor=vec4(0,0,0,0);return; -#else -#ifdef NATIVE -glFragColor=vec4(1,1,1,1); -#else -glFragColor=vec4(0,0,0,1); -#endif -return; -#endif -} -#endif -highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? -0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; -#ifdef PROJECTION_GLOBE_VIEW -highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? -PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); -#else -horizon_angle=horizon_angle_mercator; -#endif -horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb; -#ifdef ALPHA_PASS -float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a); -#else -vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2; -#ifndef NATIVE -c=dither(c,gl_FragCoord.xy+u_temporal_offset); -#endif -glFragColor=vec4(c*t,t); -#endif -}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( -mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( -mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Rt(`#include "_prelude_fog.fragment.glsl" -#include "_prelude_shadow.fragment.glsl" -#include "_prelude_lighting.glsl" -uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; -#ifdef RENDER_SHADOWS -in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; -#endif -#ifdef OCCLUSION_TEXTURE_TRANSFORM -uniform vec4 u_occlusionTextureTransform; -#endif -#pragma mapbox: define-attribute highp vec3 normal_3f -#pragma mapbox: define-attribute highp vec3 color_3f -#pragma mapbox: define-attribute highp vec4 color_4f -#pragma mapbox: define-attribute highp vec2 uv_2f -#pragma mapbox: initialize-attribute highp vec3 normal_3f -#pragma mapbox: initialize-attribute highp vec3 color_3f -#pragma mapbox: initialize-attribute highp vec4 color_4f -#pragma mapbox: initialize-attribute highp vec2 uv_2f -#ifdef HAS_ATTRIBUTE_a_pbr -in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; -#endif -#ifdef HAS_TEXTURE_u_baseColorTexture -uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; -#endif -#ifdef HAS_TEXTURE_u_metallicRoughnessTexture -uniform sampler2D u_metallicRoughnessTexture; -#endif -#ifdef HAS_TEXTURE_u_occlusionTexture -uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; -#endif -#ifdef HAS_TEXTURE_u_normalTexture -uniform sampler2D u_normalTexture; -#endif -#ifdef HAS_TEXTURE_u_emissionTexture -uniform sampler2D u_emissionTexture; -#endif -#ifdef APPLY_LUT_ON_GPU -uniform highp sampler3D u_lutTexture; -#endif -#ifdef TERRAIN_FRAGMENT_OCCLUSION -in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform vec2 u_inv_depth_size;uniform vec2 u_depth_range_unpack; -#ifdef DEPTH_D24 -float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} -#else -highp float unpack_depth_rgba(highp vec4 rgba_depth) -{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} -#endif -bool isOccluded() {vec2 coord=gl_FragCoord.xy*u_inv_depth_size; -#ifdef DEPTH_D24 -highp float depth=unpack_depth(texture(u_depthTexture,coord).r); -#else -highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); -#endif -return v_depth > depth+0.0005;} -#endif -#define saturate(_x) clamp(_x,0.,1.) -vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor) -{ -#ifdef LIGHTING_3D_MODE -vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; -#ifdef RENDER_SHADOWS -lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); -#else -lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); -#endif -return apply_lighting(albedo,transformed_normal,lighting_factor); -#else -vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3; -#endif -}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; -#ifdef HAS_ATTRIBUTE_a_color_3f -albedo*=vec4(color_3f,1.0); -#endif -#ifdef HAS_ATTRIBUTE_a_pbr -#else -#ifdef HAS_ATTRIBUTE_a_color_4f -albedo*=color_4f; -#endif -#endif -#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) -vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} -#ifdef UNPREMULT_TEXTURE_IN_SHADER -if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; -#endif -if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} -#endif -vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); -#ifdef APPLY_LUT_ON_GPU -color=applyLUT(u_lutTexture,color); -#endif -return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { -#ifdef HAS_TEXTURE_u_normalTexture -highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; -#else -return mat3(1.0); -#endif -}highp vec3 getNormal(){highp vec3 n; -#ifdef HAS_ATTRIBUTE_a_normal_3f -n=normalize(normal_3f); -#else -highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0; -#endif -#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) -vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap); -#endif -return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor; -#ifdef HAS_ATTRIBUTE_a_pbr -mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; -#endif -#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) -vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; -#endif -const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness) -{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH) -{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) -{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness) -{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV) -{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat) -{ -#ifdef LIGHTING_3D_MODE -return mat.diffuseColor; -#else -return mat.diffuseColor/PI; -#endif -}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) -{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal) -{vec3 env_light=vec3(0.65,0.65,0.65); -#ifdef LIGHTING_3D_MODE -float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; -#endif -vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor) -{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor; -#ifdef RENDER_SHADOWS -lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); -#else -lighting_factor=NdotL; -#endif -vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; -#if !defined(LIGHTING_3D_MODE) -const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL); -#endif -color*=intensityFactor;return color;}void main() { -#ifdef TERRAIN_FRAGMENT_OCCLUSION -if (isOccluded()) {discard;} -#endif -vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; -#ifdef LIGHTING_3D_MODE -lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; -#endif -vec4 finalColor; -#ifdef DIFFUSE_SHADED -vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); -#ifdef HAS_TEXTURE_u_occlusionTexture -float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; -#endif -finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; -#else -Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; -#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) -#ifdef OCCLUSION_TEXTURE_TRANSFORM -vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; -#else -vec2 uv=uv_2f; -#endif -ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; -#endif -vec4 emissive=u_emissiveFactor; -#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) -emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); -#endif -#ifdef APPLY_LUT_ON_GPU -float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; -#endif -color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; -#ifdef HAS_ATTRIBUTE_a_pbr -float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb; -#ifdef APPLY_LUT_ON_GPU -color_mix=applyLUT(u_lutTexture,color_mix); -#endif -color=mix(color,color_mix,min(1.0,resEmission)); -#ifdef HAS_ATTRIBUTE_a_color_4f -float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance); -#endif -#endif -vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); -#endif -#ifdef FOG -finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); -#endif -#ifdef RENDER_CUTOFF -finalColor*=v_cutoff_opacity; -#endif -#ifdef INDICATOR_CUTOUT -finalColor=applyCutout(finalColor); -#endif -glFragColor=finalColor; -#ifdef OVERDRAW_INSPECTOR -glFragColor=vec4(1.0); -#endif -HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" -#include "_prelude_shadow.vertex.glsl" -in vec3 a_pos_3f; -#pragma mapbox: define-attribute highp vec3 normal_3f -#pragma mapbox: define-attribute highp vec2 uv_2f -#pragma mapbox: define-attribute highp vec3 color_3f -#pragma mapbox: define-attribute highp vec4 color_4f -#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr -#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength -uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; -#ifdef INSTANCED_ARRAYS -in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; -#else -uniform highp mat4 u_normal_matrix; -#endif -#ifdef RENDER_SHADOWS -uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows; -#endif -out vec4 v_position_height;out lowp vec4 v_color_mix; -#ifdef TERRAIN_FRAGMENT_OCCLUSION -out highp float v_depth; -#endif -#ifdef HAS_ATTRIBUTE_a_pbr -out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; -#endif -vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { -#pragma mapbox: initialize-attribute highp vec3 normal_3f -#pragma mapbox: initialize-attribute highp vec2 uv_2f -#pragma mapbox: initialize-attribute highp vec3 color_3f -#pragma mapbox: initialize-attribute highp vec4 color_4f -#pragma mapbox: initialize-attribute-custom highp vec4 pbr -#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength -highp mat4 normal_matrix; -#ifdef INSTANCED_ARRAYS -normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); -#else -normal_matrix=u_normal_matrix; -#endif -vec3 local_pos;mat3 rs; -#ifdef MODEL_POSITION_ON_GPU -vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos; -#else -local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a); -#endif -v_position_height.w=a_pos_3f.z; -#ifdef HAS_ATTRIBUTE_a_pbr -vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x; -#endif -#ifdef FOG -v_fog_pos=fog_position(local_pos); -#endif -#ifdef RENDER_CUTOFF -v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); -#endif -#ifdef TERRAIN_FRAGMENT_OCCLUSION -v_depth=gl_Position.z/gl_Position.w; -#endif -#ifdef HAS_ATTRIBUTE_a_normal_3f -#ifdef MODEL_POSITION_ON_GPU -float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f); -#else -normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); -#endif -#endif -#ifdef HAS_ATTRIBUTE_a_pbr -#ifdef HAS_ATTRIBUTE_a_color_4f -v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0); -#endif -#endif -#ifdef RENDER_SHADOWS -vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); -#ifdef NORMAL_OFFSET -#ifdef HAS_ATTRIBUTE_a_normal_3f -#ifdef MODEL_POSITION_ON_GPU -vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); -#else -vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); -#endif -#endif -#endif -v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w; -#endif -}`),modelDepth:Rt(`in highp float v_depth;void main() { -#ifndef DEPTH_TEXTURE -glFragColor=pack_depth(v_depth); -#endif -}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; -#ifdef MODEL_POSITION_ON_GPU -#ifdef INSTANCED_ARRAYS -in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; -#else -uniform highp mat4 u_instance; -#endif -uniform highp mat4 u_node_matrix; -#endif -void main() { -#ifdef MODEL_POSITION_ON_GPU -highp mat4 instance; -#ifdef INSTANCED_ARRAYS -instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); -#else -instance=u_instance; -#endif -vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden); -#else -gl_Position=u_matrix*vec4(a_pos_3f,1); -#endif -v_depth=gl_Position.z/gl_Position.w;}`),stars:Rt(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) -{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,` -in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),occlusion:Rt("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" -in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos; -#ifdef TERRAIN -float e=elevation(world_pos.xy);world_pos.z+=e; -#endif -vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function Ho(u,r){const a=u.replace(/\s*\/\/[^\n]*\n/g,` -`).split(` -`);for(let h of a)if(h=h.trim(),h[0]==="#"&&h.includes("if")&&!h.includes("endif")){h=h.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const p=h.split(" ");for(const m of p)r.includes(m)||r.push(m)}}function Rt(u,r){const a=/#include\s+"([^"]+)"/g,h=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let p=r.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);p&&(p=p.map(T=>{const S=T.split(" ");return S[S.length-1]}),p=[...new Set(p)]);const m={},g=[],x=[];if(u=u.replace(a,(T,S)=>(x.push(S),"")),(r=r.replace(a,(T,S)=>(g.push(S),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let w=[...Zs];Ho(u,w),Ho(r,w);for(const T of[...g,...x])Ws[T]||console.error(`Undefined include: ${T}`),fl[T]||(fl[T]=[],Ho(Ws[T],fl[T])),w=[...w,...fl[T]];return{fragmentSource:u=u.replace(h,(T,S,I,P,z)=>(m[z]=!0,S==="define"?` -#ifndef HAS_UNIFORM_u_${z} -in ${I} ${P} ${z}; -#else -uniform ${I} ${P} u_${z}; -#endif -`:S==="initialize"?` -#ifdef HAS_UNIFORM_u_${z} - ${I} ${P} ${z} = u_${z}; -#endif -`:S==="define-attribute"?` -#ifdef HAS_ATTRIBUTE_a_${z} - in ${I} ${P} ${z}; -#endif -`:S==="initialize-attribute"?"":void 0)),vertexSource:r=r.replace(h,(T,S,I,P,z)=>{const L=P==="float"?"vec2":P,k=z.match(/color/)?"color":L;return S==="define-attribute-vertex-shader-only"?` -#ifdef HAS_ATTRIBUTE_a_${z} -in ${I} ${P} a_${z}; -#endif -`:m[z]?S==="define"?` -#ifndef HAS_UNIFORM_u_${z} -uniform lowp float u_${z}_t; -in ${I} ${L} a_${z}; -out ${I} ${P} ${z}; -#else -uniform ${I} ${P} u_${z}; -#endif -`:S==="initialize"?k==="vec4"?` -#ifndef HAS_UNIFORM_u_${z} - ${z} = a_${z}; -#else - ${I} ${P} ${z} = u_${z}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${z} - ${z} = unpack_mix_${k}(a_${z}, u_${z}_t); -#else - ${I} ${P} ${z} = u_${z}; -#endif -`:S==="define-attribute"?` -#ifdef HAS_ATTRIBUTE_a_${z} - in ${I} ${P} a_${z}; - out ${I} ${P} ${z}; -#endif -`:S==="initialize-attribute"?` -#ifdef HAS_ATTRIBUTE_a_${z} - ${z} = a_${z}; -#endif -`:void 0:S==="define"?` -#ifndef HAS_UNIFORM_u_${z} -uniform lowp float u_${z}_t; -in ${I} ${L} a_${z}; -#else -uniform ${I} ${P} u_${z}; -#endif -`:S==="define-instanced"?k==="mat4"?` -#ifdef INSTANCED_ARRAYS -in vec4 a_${z}0; -in vec4 a_${z}1; -in vec4 a_${z}2; -in vec4 a_${z}3; -#else -uniform ${I} ${P} u_${z}; -#endif -`:` -#ifdef INSTANCED_ARRAYS -in ${I} ${L} a_${z}; -#else -uniform ${I} ${P} u_${z}; -#endif -`:S==="initialize-attribute-custom"?` -#ifdef HAS_ATTRIBUTE_a_${z} - ${I} ${P} ${z} = a_${z}; -#endif -`:k==="vec4"?` -#ifndef HAS_UNIFORM_u_${z} - ${I} ${P} ${z} = a_${z}; -#else - ${I} ${P} ${z} = u_${z}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${z} - ${I} ${P} ${z} = unpack_mix_${k}(a_${z}, u_${z}_t); -#else - ${I} ${P} ${z} = u_${z}; -#endif -`}),staticAttributes:p,usedDefines:w,vertexIncludes:g,fragmentIncludes:x}}class vp{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(r,a,h,p,m,g,x,w){this.context=r;let T=this.boundPaintVertexBuffers.length!==p.length;for(let I=0;!T&&I{const j=G.paint.get("hillshade-shadow-color"),J=G.paint.get("hillshade-highlight-color"),Z=G.paint.get("hillshade-accent-color"),W=G.paint.get("hillshade-emissive-strength");let ee=s.ac(G.paint.get("hillshade-illumination-direction"));if(G.paint.get("hillshade-illumination-anchor")==="viewport")ee-=O.transform.angle;else if(O.style&&O.style.enable3dLights()&&O.style.directionalLight){const ue=O.style.directionalLight.properties.get("direction"),re=s.ad(ue.x,ue.y,ue.z);ee=s.ac(re[1])}const ie=!O.options.moving;return{u_matrix:$||O.transform.calculateProjMatrix(B.tileID.toUnwrapped(),ie),u_image:0,u_latrange:bp(0,B.tileID),u_light:[G.paint.get("hillshade-exaggeration"),ee],u_shadow:j.toRenderColor(G.lut),u_highlight:J.toRenderColor(G.lut),u_emissive_strength:W,u_accent:Z.toRenderColor(G.lut)}})(u,a,h,u.terrain?r.projMatrix:null);u.uploadCommonUniforms(x,I,r.toUnwrapped());const{tileBoundsBuffer:z,tileBoundsIndexBuffer:L,tileBoundsSegments:k}=u.getTileBoundsBuffers(a);I.draw(u,w.TRIANGLES,p,m,g,s.ag.disabled,P,h.id,z,L,k)}function yh(u,r,a){if(!r.needsDEMTextureUpload)return;const h=u.context,p=h.gl;h.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||u.getTileTexture(a.stride);const m=a.getPixels();r.demTexture?r.demTexture.update(m,{premultiply:!1}):r.demTexture=new s.T(h,m,p.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}function Tp(u,r,a){const h=u.context,p=h.gl;if(!r.dem)return;const m=r.dem;if(h.activeTexture.set(p.TEXTURE1),yh(u,r,m),!r.demTexture)return;r.demTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE);const g=m.dim;h.activeTexture.set(p.TEXTURE0);let x=r.hillshadeFBO;if(!x){const P=new s.T(h,{width:g,height:g,data:null},p.RGBA);P.bind(p.LINEAR,p.CLAMP_TO_EDGE),x=r.hillshadeFBO=h.createFramebuffer(g,g,!0,"renderbuffer"),x.colorAttachment.set(P.texture)}h.bindFramebuffer.set(x.framebuffer),h.viewport.set([0,0,g,g]);const{tileBoundsBuffer:w,tileBoundsIndexBuffer:T,tileBoundsSegments:S}=u.getMercatorTileBoundsBuffers(),I=[];u.linearFloatFilteringSupported()&&I.push("TERRAIN_DEM_FLOAT_FORMAT"),u.getOrCreateProgram("hillshadePrepare",{defines:I}).draw(u,p.TRIANGLES,s.af.disabled,s.ah.disabled,s.a.unblended,s.ag.disabled,((P,z)=>{const L=z.stride,k=s.ae.create();return s.ae.ortho(k,0,s.a4,-s.a4,0,0,1),s.ae.translate(k,k,[0,-s.a4,0]),{u_matrix:k,u_image:1,u_dimension:[L,L],u_zoom:P.overscaledZ}})(r.tileID,m),a.id,w,T,S),r.needsHillshadePrepare=!1}function Nc(u,r,a,h,p){const m=function(x,w){if(x)return p(x);if(w){if(u.url&&w.tiles&&u.tiles&&delete u.tiles,w.variants){if(!Array.isArray(w.variants))return p(new Error("variants must be an array"));for(const S of w.variants){if(S==null||typeof S!="object"||S.constructor!==Object)return p(new Error("variant must be an object"));if(!Array.isArray(S.capabilities))return p(new Error("capabilities must be an array"));if(S.capabilities.length===1&&S.capabilities[0]==="meshopt"){w=s.Q(w,S);break}}}const T=s.ai(s.Q(w,u),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);w.vector_layers&&(T.vectorLayers=w.vector_layers,T.vectorLayerIds=T.vectorLayers.map(S=>S.id)),w.raster_layers&&(T.rasterLayers=w.raster_layers,T.rasterLayerIds=T.rasterLayers.map(S=>S.id)),T.tiles=r.canonicalizeTileset(T,u.url),p(null,T)}},g=function(x,w,T){if(!x)return null;if(!w&&!T)return x;T=T||x.worldview_default;const S=Object.values(x.language||{});if(S.length===0)return null;const I=Object.values(x.worldview||{});if(I.length===0)return null;const P=S.every(L=>L===w),z=I.every(L=>L===T);return P&&z?x:w in(x.language_options||{})||T in(x.worldview_options||{})?null:x.language_options&&x.worldview_options?x:null}(u.data,a,h);return g?s.e.frame(()=>m(null,g)):u.url?s.h(r.transformRequest(r.normalizeSourceURL(u.url,null,a,h),s.R.Source),m):s.e.frame(()=>{const{data:x,...w}=u;m(null,w)})}class Hs{constructor(r,a,h){this.bounds=s.aj.convert(this.validateBounds(r)),this.minzoom=a||0,this.maxzoom=h||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const a=Math.pow(2,r.z),h=Math.floor(s.ak(this.bounds.getWest())*a),p=Math.floor(s.al(this.bounds.getNorth())*a),m=Math.ceil(s.ak(this.bounds.getEast())*a),g=Math.ceil(s.al(this.bounds.getSouth())*a);return r.x>=h&&r.x=p&&r.y{this._tileJSONRequest=null,this._loaded=!0,a?this.fire(new s.f(a)):h&&(s.Q(this,h),h.bounds&&(this.tileBounds=new Hs(h.bounds,this.minzoom,this.maxzoom)),s.ao(h.tiles),this.fire(new s.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.g("data",{dataType:"source",sourceDataType:"content"}))),r&&r(a)})}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=s.am(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(r){this.cancelTileJSONRequest()}serialize(){return s.Q({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r,a){const h=s.e.devicePixelRatio>=2,p=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),h,this.tileSize);r.request=s.i(this.map._requestManager.transformRequest(p,s.R.Tile),(m,g,x,w)=>(delete r.request,r.aborted?(r.state="unloaded",a(null)):m?(r.state="errored",a(m)):g?(this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:x,expires:w}),r.setTexture(g,this.map.painter),r.state="loaded",s.an(this.dispatcher),void a(null)):a(null)))}abortTile(r,a){r.request&&(r.request.cancel(),delete r.request),a&&a()}unloadTile(r,a){r.texture&&r.texture instanceof s.T?(r.destroy(!0),r.texture&&r.texture instanceof s.T&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),a&&a()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class xh extends s.E{constructor(r,a,h,p){if(super(),this.id=r,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,s.Q(this,s.ai(a,["url","scheme","tileSize","promoteId"])),this._options=s.Q({type:"vector"},a),this._collectResourceTiming=!!a.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(p),this._tileWorkers={},this._deduped=new s.ap}load(r){this._loaded=!1,this.fire(new s.g("dataloading",{dataType:"source"}));const a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,h=this.map._worldview;this._tileJSONRequest=Nc(this._options,this.map._requestManager,a,h,(p,m)=>{this._tileJSONRequest=null,this._loaded=!0,p?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),h&&h.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${h}`),this.fire(new s.f(p))):m&&(s.Q(this,m),m.bounds&&(this.tileBounds=new Hs(m.bounds,this.minzoom,this.maxzoom)),s.ao(m.tiles,this.map._requestManager._customAccessToken),this.fire(new s.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.g("data",{dataType:"source",sourceDataType:"content"}))),r&&r(p)})}loaded(){return this._loaded}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=s.am(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(r){this.cancelTileJSONRequest()}serialize(){return s.Q({},this._options)}loadTile(r,a){const h=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),p=this.map._requestManager.transformRequest(h,s.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,g={request:p,data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,lut:m?{image:m.image.clone()}:null,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:s.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.isExtraShadowCaster,tessellationStep:this.map._tessellationStep};if(g.request.collectResourceTiming=this._collectResourceTiming,r.actor&&r.state!=="expired")r.state==="loading"?r.reloadCallback=a:r.request=r.actor.send("reloadTile",g,x.bind(this));else if(r.actor=this._tileWorkers[h]=this._tileWorkers[h]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",g,x.bind(this),void 0,!0);else{const w=s.aq.call({deduped:this._deduped},g,(T,S)=>{T||!S?x.call(this,T):(g.data={cacheControl:S.cacheControl,expires:S.expires,rawData:S.rawData.slice(0)},r.actor&&r.actor.send("loadTile",g,x.bind(this),void 0,!0))},!0);r.request={cancel:w}}function x(w,T){return delete r.request,r.aborted?a(null):w&&w.status!==404?a(w):(T&&T.resourceTiming&&(r.resourceTiming=T.resourceTiming),this.map._refreshExpiredTiles&&T&&r.setExpiryData(T),r.loadVectorData(T,this.map.painter),s.an(this.dispatcher),a(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(r){r.request&&(r.request.cancel(),delete r.request),r.actor&&r.actor.send("abortTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(r,a){r.actor&&r.actor.send("removeTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope}),r.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}const vh=(u,r,a)=>({u_matrix:u,u_image0:0,u_skirt_height:r,u_ground_shadow_factor:a}),Vc=(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k)=>({u_proj_matrix:Float32Array.from(u),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(h),u_merc_matrix:a,u_zoom_transition:p,u_merc_center:m,u_image0:0,u_frustum_tl:g,u_frustum_tr:x,u_frustum_br:w,u_frustum_bl:T,u_globe_pos:S,u_globe_radius:I,u_viewport:P,u_grid_matrix:k?Float32Array.from(k):new Float32Array(9),u_skirt_height:z,u_far_z_cutoff:L});class Xs{constructor(r=0,a=0,h=0,p=0){if(isNaN(r)||r<0||isNaN(a)||a<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=r,this.bottom=a,this.left=h,this.right=p}interpolate(r,a,h){return a.top!=null&&r.top!=null&&(this.top=s.a3(r.top,a.top,h)),a.bottom!=null&&r.bottom!=null&&(this.bottom=s.a3(r.bottom,a.bottom,h)),a.left!=null&&r.left!=null&&(this.left=s.a3(r.left,a.left,h)),a.right!=null&&r.right!=null&&(this.right=s.a3(r.right,a.right,h)),this}getCenter(r,a){const h=s.au((this.left+r-this.right)/2,0,r),p=s.au((this.top+a-this.bottom)/2,0,a);return new s.P(h,p)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new Xs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function lo(u,r){const a=s.ax(u,3);s.ae.fromQuat(u,r),s.aA(u,3,a)}function je(u,r){const a=s.aw.identity([]);return s.aw.rotateZ(a,a,-r),s.aw.rotateX(a,a,-u),a}function Xo(u,r){const a=[u[0],u[1],0],h=[r[0],r[1],0];if(s.$.length(a)>=1e-15){const g=s.$.normalize([],a);s.$.scale(h,g,s.$.dot(h,g)),r[0]=h[0],r[1]=h[1]}const p=s.$.cross([],r,u);if(s.$.len(p)<1e-15)return null;const m=Math.atan2(-p[1],p[0]);return je(Math.atan2(Math.sqrt(u[0]*u[0]+u[1]*u[1]),-u[2]),m)}class bh{constructor(r,a){this.position=r,this.orientation=a}get position(){return this._position}set position(r){if(r){const a=r instanceof s._?r:new s._(r[0],r[1],r[2]);this._renderWorldCopies&&(a.x=s.av(a.x,0,1)),this._position=a}else this._position=null}lookAtPoint(r,a){if(this.orientation=null,!this.position)return;const h=this.position,p=this._elevation?this._elevation.getAtPointOrZero(s._.fromLngLat(r)):0,m=s._.fromLngLat(r,p),g=[m.x-h.x,m.y-h.y,m.z-h.z];a||(a=[0,0,1]),a[2]=Math.abs(a[2]),this.orientation=Xo(g,a)}setPitchBearing(r,a){this.orientation=je(s.ac(r),s.ac(-a))}}class Yo{constructor(r,a){this._transform=s.ae.identity([]),this.orientation=a,this.position=r}get mercatorPosition(){const r=this.position;return new s._(r[0],r[1],r[2])}get position(){const r=s.ax(this._transform,3);return[r[0],r[1],r[2]]}set position(r){var a;r&&s.aA(this._transform,3,[(a=r)[0],a[1],a[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||s.aw.identity([]),r&&lo(this._transform,this._orientation)}getPitchBearing(){const r=this.forward(),a=this.right();return{bearing:Math.atan2(-a[1],a[0]),pitch:Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2])}}setPitchBearing(r,a){this._orientation=je(r,a),lo(this._transform,this._orientation)}forward(){const r=s.ax(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){const r=s.ax(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){const r=s.ax(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,a){const h=new Float64Array(16);return s.ae.invert(h,this.getWorldToCamera(r,a)),h}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(r,a,h){const p=this.position;s.$.scale(p,p,-r);const m=new Float64Array(16);return s.ae.fromScaling(m,[h,h,h]),s.ae.translate(m,m,p),m[10]*=a,m}getWorldToCamera(r,a){const h=new Float64Array(16),p=new Float64Array(4),m=this.position;return s.aw.conjugate(p,this._orientation),s.$.scale(m,m,-r),s.ae.fromQuat(h,p),s.ae.translate(h,h,m),h[1]*=-1,h[5]*=-1,h[9]*=-1,h[13]*=-1,h[8]*=a,h[9]*=a,h[10]*=a,h[11]*=a,h}getCameraToClipPerspective(r,a,h,p){const m=new Float64Array(16);return s.ae.perspective(m,r,a,h,p),m}getCameraToClipOrthographic(r,a,h,p,m,g){const x=new Float64Array(16);return s.ae.ortho(x,r,a,h,p,m,g),x}getDistanceToElevation(r,a=!1){const h=r===0?0:s.ay(r,a?s.az(this.position[1]):this.position[1]),p=this.forward();return(h-this.position[2])/p[2]}clone(){return new Yo([...this.position],[...this.orientation])}}const At={unknown:0,flipRequired:1,flipNotRequired:2},sr=Math.tan(85*Math.PI/180);function Ys(u,r,a,h,p,m,g){const x=s.ae.create();if(a)if(m.name==="globe"){const w=s.aC(p,r);s.ae.multiply(x,x,w)}else{const w=s.aD.invert([],g);x[0]=w[0],x[1]=w[1],x[4]=w[2],x[5]=w[3],h||s.ae.rotateZ(x,x,p.angle)}else s.ae.multiply(x,p.labelPlaneMatrix,u);return x}function _l(u,r,a,h,p,m,g){const x=Ys(u,r,a,h,p,m,g);return m.name==="globe"&&a||(x[2]=x[6]=x[10]=x[14]=0),x}function gl(u,r,a,h,p,m,g){if(a){if(m.name==="globe"){const x=Ys(u,r,a,h,p,m,g);return s.ae.invert(x,x),s.ae.multiply(x,u,x),x}{const x=s.ae.clone(u),w=s.ae.identity([]);return w[0]=g[0],w[1]=g[1],w[4]=g[2],w[5]=g[3],s.ae.multiply(x,x,w),h||s.ae.rotateZ(x,x,-p.angle),x}}return p.glCoordMatrix}function $r(u,r,a,h){const p=[u,r,a,1];a?s.aB.transformMat4(p,p,h):Gc(p,p,h);const m=p[3];return p[0]/=m,p[1]/=m,p[2]/=m,p}function Et(u,r){return Math.min(.5+u/r*.5,1.5)}function Uc(u,r){const a=u[0]/u[3],h=u[1]/u[3];return a>=-r[0]&&a<=r[0]&&h>=-r[1]&&h<=r[1]}function Jo(u,r,a,h,p,m,g,x,w,T){const S=a.transform,I=h?u.textSizeData:u.iconSizeData,P=s.aE(I,a.transform.zoom),z=S.projection.name==="globe",L=[256/a.width*2+1,256/a.height*2+1],k=h?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;k.clear();let O=null;z&&(O=h?u.text.globeExtVertexArray:u.icon.globeExtVertexArray);const B=u.lineVertexArray,G=h?u.text.placedSymbolArray:u.icon.placedSymbolArray,$=a.transform.width/a.transform.height;let j,J=!1;for(let Z=0;ZMath.abs(a)?{useVertical:!0}:u===s.aF.vertical?h>0?{needsFlipping:!0}:null:r!==At.unknown&&function(p,m){return p===0||Math.abs(m/p)>sr}(a,h)?r===At.flipRequired?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function Gi(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B,G){const $=r/24,j=u.lineOffsetX*$,J=u.lineOffsetY*$,{lineStartIndex:Z,glyphStartIndex:W,numGlyphs:ee,segment:ie,writingMode:ue,flipState:re}=u,Y=Z+u.lineLength,_e=fe=>{if(S){const[he,ve,ne]=fe.up,Me=T.length;s.aH(S,Me+0,he,ve,ne),s.aH(S,Me+1,he,ve,ne),s.aH(S,Me+2,he,ve,ne),s.aH(S,Me+3,he,ve,ne)}const[se,Ce,Se]=fe.point;s.aI(T,se,Ce,Se,fe.angle)};if(ee>1){const fe=Js($,x,j,J,a,I,P,u,w,m,z,k,!1,O,B,G);if(!fe)return{notEnoughRoom:!0};if(h&&!a){let[se,Ce,Se]=fe.first.point,[he,ve,ne]=fe.last.point;[se,Ce]=$r(se,Ce,Se,g),[he,ve]=$r(he,ve,ne,g);const Me=jc(ue,re,(he-se)*L,ve-Ce);if(u.flipState=Me&&Me.needsFlipping?At.flipRequired:At.flipNotRequired,Me)return Me}_e(fe.first);for(let se=W+1;se0?he:yl(P,Se,se,1,p,void 0,O,B.canonical),ne=jc(ue,re,(ve[0]-se[0])*L,ve[1]-se[1]);if(u.flipState=ne&&ne.needsFlipping?At.flipRequired:At.flipNotRequired,ne)return ne}const fe=Ko($*x.getoffsetX(W),j,J,a,I,P,ie,Z,Y,w,m,z,k,!1,!1,O,B,G);if(!fe)return{notEnoughRoom:!0};_e(fe)}return{}}function wh(u,r,a,h,p){const{x:m,y:g,z:x}=h.projectTilePoint(u.x,u.y,r);if(!p)return $r(m,g,x,a);const[w,T,S]=p(u);return $r(m+w,g+T,x+S,a)}function yl(u,r,a,h,p,m,g,x){const w=wh(u.sub(r)._unit()._add(u),x,p,g,m);return s.$.sub(w,a,w),s.$.normalize(w,w),s.$.scaleAndAdd(w,a,w,h)}function Ko(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B){const G=h?u-r:u+r;let $=G>0?1:-1,j=0;h&&($*=-1,j=Math.PI),$<0&&(j+=Math.PI);let J=x+g+($>0?0:1)|0,Z=p,W=p,ee=0,ie=0;const ue=Math.abs(G),re=[],Y=[];let _e=m,fe=_e;const se=()=>yl(fe,_e,W,ue-ee+1,S,P,k,O.canonical);for(;ee+ie<=ue;){if(J+=$,J=w)return null;if(W=Z,fe=_e,re.push(W),z&&Y.push(fe),_e=new s.P(T.getx(J),T.gety(J)),Z=I[J],!Z){const Ge=wh(_e,O.canonical,S,k,P);Z=Ge[3]>0?I[J]=Ge:se()}ee+=ie,ie=s.$.distance(W,Z)}L&&P&&(I[J]&&(Z=se(),ie=s.$.distance(W,Z)),I[J]=Z);const Ce=(ue-ee)/ie,Se=_e.sub(fe)._mult(Ce)._add(fe),he=s.$.sub([],Z,W),ve=s.$.scaleAndAdd([],W,he,Ce);let ne=[0,0,1],Me=he[0],Ae=he[1];if(B&&(ne=k.upVector(O.canonical,Se.x,Se.y),ne[0]!==0||ne[1]!==0||ne[2]!==1)){const Ge=[ne[2],0,-ne[0]],He=s.$.cross([],ne,Ge);s.$.normalize(Ge,Ge),s.$.normalize(He,He),Me=s.$.dot(he,Ge),Ae=s.$.dot(he,He)}if(a){const Ge=s.$.cross([],ne,he);s.$.normalize(Ge,Ge),s.$.scaleAndAdd(ve,ve,Ge,a*$)}const Ue=j+Math.atan2(Ae,Me);return re.push(ve),z&&Y.push(Se),{point:ve,angle:Ue,path:re,tilePath:Y,up:ne}}function co(u,r){const a=r.length,h=a+4*u;r.resize(h),r.float32.fill(-1/0,4*a,4*h)}function Gc(u,r,a){const h=r[0],p=r[1];return u[0]=a[0]*h+a[4]*p+a[12],u[1]=a[1]*h+a[5]*p+a[13],u[3]=a[3]*h+a[7]*p+a[15],u}const xl=(u,r,a)=>(1-a)*u+a*r,Ks=u=>u*u*u*u*u;class Qs{constructor(r,a,h,p,m,g,x){this.tileSize=512,this._renderWorldCopies=m===void 0||m,this._minZoom=r||0,this._maxZoom=a||22,this._minPitch=h??0,this._maxPitch=p??60,this.setProjection(g),this.setMaxBounds(x),this.width=0,this.height=0,this._center=new s.aJ(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Xs,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Yo,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){const r=new Qs(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return r._elevation=this._elevation,r._centerAltitude=this._centerAltitude,r._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,r.tileSize=this.tileSize,r.mercatorFromTransition=this.mercatorFromTransition,r.width=this.width,r.height=this.height,r.cameraElevationReference=this.cameraElevationReference,r._center=this._center,r._setZoom(this.zoom),r._seaLevelZoom=this._seaLevelZoom,r.angle=this.angle,r._fov=this._fov,r._pitch=this._pitch,r._nearZ=this._nearZ,r._farZ=this._farZ,r._averageElevation=this._averageElevation,r._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,r._unmodified=this._unmodified,r._edgeInsets=this._edgeInsets.clone(),r._camera=this._camera.clone(),r._calcMatrices(),r.freezeTileCoverage=this.freezeTileCoverage,r.frustumCorners=this.frustumCorners,r}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(r){this._elevation!==r&&(this._elevation=r,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(r,a=!1){const h=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||h)&&this._updateCameraOnTerrain(),(r||h)&&this._constrainCamera(a),this._calcMatrices()}getProjection(){return s.ai(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};const a=this.projection?this.getProjection():void 0;this.projection=s.aK(this.projectionOptions);const h=this.getProjection(),p=!s.d(a,h);return p&&this._calcMatrices(),this.mercatorFromTransition=!1,p}setOrthographicProjectionAtLowPitch(r){return this._orthographicProjectionAtLowPitch!==r&&(this._orthographicProjectionAtLowPitch=r,this._calcMatrices(),!0)}setMercatorFromTransition(){const r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=s.aK({name:"mercator"});const a=r!==this.projection.name;return a&&this._calcMatrices(),a}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get cameraWorldSize(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return s.ay(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this.width,this.height)}get bearing(){return s.av(this.rotation,-180,180)}set bearing(r){this.rotation=r}get rotation(){return-this.angle/Math.PI*180}set rotation(r){const a=-r*Math.PI/180;this.angle!==a&&(this._unmodified=!1,this.angle=a,this._calcMatrices(),this.rotationMatrix=s.aD.create(),s.aD.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const a=s.au(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==a&&(this._unmodified=!1,this._pitch=a,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const r=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/r)}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=s.ac(r),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(r){this._averageElevation=r,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(r){const a=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==a&&(this._unmodified=!1,this._setZoom(a),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(r){this._zoom=r,this.scale=this.zoomScale(r),this.tileZoom=Math.floor(r),this.zoomFraction=r-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(r){this._tileCoverLift!==r&&(this._tileCoverLift=r)}_updateCameraOnTerrain(){const r=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,a=this.elevation&&r===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||r===Number.NEGATIVE_INFINITY&&(!a||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const h=this._elevation;a||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&h.exaggeration()&&this._centerAltitudeValidForExaggeration!==h.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*h.exaggeration(),this._centerAltitudeValidForExaggeration=h.exaggeration()):(this._centerAltitude=r||0,this._centerAltitudeValidForExaggeration=h.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const r=this._elevation,a=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],h=this.horizonLineFromTop();let p=0,m=0;for(let g=0;g{const k=s.b2(I,S,P,z,L);x.has(k)||(p.push(new s.aQ(S,I,P,z,L)),x.add(k))};for(let S=0;S0,G=P.y+10,j=I.wrap-(B?0:1),J=I.wrap+(O?0:1),Z=B?P.x-1:k-1,W=O?P.x+1:0;if(m)h[0]<0?(w(z,J,P.z,W,P.y),h[1]<0&&G&&(w(z,L,P.z,P.x,P.y+1),w(z,J,P.z,W,P.y+1)),h[1]>0&&$&&(w(z,L,P.z,P.x,P.y-1),w(z,J,P.z,W,P.y-1))):h[0]>0?(w(z,j,P.z,Z,P.y),h[1]<0&&G&&(w(z,L,P.z,P.x,P.y+1),w(z,j,P.z,Z,P.y+1)),h[1]>0&&$&&(w(z,L,P.z,P.x,P.y-1),w(z,j,P.z,Z,P.y-1))):h[1]<0&&G?w(z,L,P.z,P.x,P.y+1):$&&w(z,L,P.z,P.x,P.y-1);else{const ee=I.visibleQuadrants;1&ee&&(w(z,j,P.z,Z,P.y),$&&(w(z,L,P.z,P.x,P.y-1),w(z,j,P.z,Z,P.y-1))),2&ee&&(w(z,J,P.z,W,P.y),$&&(w(z,L,P.z,P.x,P.y-1),w(z,J,P.z,W,P.y-1))),4&ee&&(w(z,j,P.z,Z,P.y),G&&(w(z,L,P.z,P.x,P.y+1),w(z,j,P.z,Z,P.y+1))),8&ee&&(w(z,J,P.z,W,P.y),G&&(w(z,L,P.z,P.x,P.y+1),w(z,J,P.z,W,P.y+1)))}}const T=[];for(const S of p)p.some(I=>S.isChildOf(I))||T.push(S);if(p=T.filter(S=>!r.some(I=>!!(S.overscaledZ{const O=k.canonical.x+.5-P[0],B=k.canonical.y+.5-P[1];return O*O+B*Br.maxzoom&&(a=r.maxzoom);const x=this.locationCoordinate(this.center),w=this.center.lat,T=1<{const ne=new s._(he.x+25e-6,he.y,he.z),Me=new s._(he.x,he.y+25e-6,he.z),Ae=he.toLngLat(),Ue=ne.toLngLat(),Ge=Me.toLngLat(),He=this.locationCoordinate(Ae),$e=this.locationCoordinate(Ue),it=this.locationCoordinate(Ge),_t=Math.hypot($e.x-He.x,$e.y-He.y),nt=Math.hypot(it.x-He.x,it.y-He.y);return Math.sqrt(_t*nt)*W/25e-6},ie=he=>{const ve=J,ne=Z;return{aabb:s.aR(this,T,0,0,0,he,ne,ve,this.projection),zoom:0,x:0,y:0,minZ:ne,maxZ:ve,wrap:he,fullyVisible:!1}},ue=[];let re=[];const Y=a,_e=r.reparseOverscaled?h:a,fe=(O-this._centerAltitude)*k,se=he=>{if(!this._elevation||!he.tileID||!g)return;const ve=this._elevation.getMinMaxForTile(he.tileID),ne=he.aabb;ve?(ne.min[2]=ve.min,ne.max[2]=ve.max,ne.center[2]=(ne.min[2]+ne.max[2])/2):(he.shouldSplit=Se(he),he.shouldSplit||(ne.min[2]=ne.max[2]=ne.center[2]=this._centerAltitude))},Ce=(he,ve)=>{if(.707*ve{if(he.zoom=.9)return!0}else if(m&&(Me=he.aabb.distanceZ(B)*k),this.projection.isReprojectedInTileSpace&&h<=5){const nt=Math.pow(2,he.zoom),xt=ee(new s._((he.x+.5)/nt,(he.y+.5)/nt));Ae=xt>.85?1:xt}if(!g){const nt=Math.sqrt(ve*ve+ne*ne+Me*Me);let xt=(1<0;){const he=ue.pop(),ve=he.x,ne=he.y;let Me=he.fullyVisible;const Ae=()=>this.projection.name==="globe"&&(he.y===0||he.y===(1<>1),$e={aabb:g?he.aabb.quadrant(Ue):s.aR(this,T,he.zoom+1,Ge,He,he.wrap,he.minZ,he.maxZ,this.projection),zoom:he.zoom+1,x:Ge,y:He,wrap:he.wrap,fullyVisible:Me,tileID:void 0,shouldSplit:void 0,minZ:he.minZ,maxZ:he.maxZ};m&&!I&&($e.tileID=new s.aQ(he.zoom+1===Y?_e:he.zoom+1,he.wrap,he.zoom+1,Ge,He),se($e)),ue.push($e)}else{const Ue=he.zoom===Y?_e:he.zoom;if(r.minzoom&&r.minzoom>Ue)continue;let Ge=0;if(!Me){let _t=G?he.aabb.intersectsPrecise(z):he.aabb.intersectsPreciseFlat(z);if(_t===0&&Ae()){const nt=new s.aO(he.zoom,ve,ne);_t=s.aP(this,T,nt,!0).intersectsPrecise(z)}if(_t===0)continue;if(r.calculateQuadrantVisibility)if(z.containsPoint(he.aabb.center))Ge=15;else for(let nt=0;nt<4;nt++)he.aabb.quadrant(nt).intersects(z)!==0&&(Ge|=1<{const Me=[0,0,0,1],Ae=[s.a4,s.a4,0,1],Ue=this.calculateFogTileMatrix(ne.tileID.toUnwrapped());s.aB.transformMat4(Me,Me,Ue),s.aB.transformMat4(Ae,Ae,Ue);const Ge=s.aB.min([],Me,Ae),He=s.aB.max([],Me,Ae),$e=s.aS(Ge,He);if($e===0)return!0;let it=!1;const _t=this._elevation;if(_t&&$e>he&&ve!==0){const nt=this.calculateProjMatrix(ne.tileID.toUnwrapped());let xt;r.isTerrainDEM||(xt=_t.getMinMaxForTile(ne.tileID)),xt||(xt={min:Z,max:J});const Ct=s.b4(this.rotation),ii=[Ct[0]*s.a4,Ct[1]*s.a4,xt.max];s.$.transformMat4(ii,ii,nt),it=(1-ii[1])*this.height*.5he.distanceSq-ve.distanceSq).map(he=>he.tileID)}resize(r,a){this.width=r,this.height=a,this.pixelsToGLUnits=[2/r,-2/a],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log(r)/Math.LN2}project(r){const a=s.au(r.lat,-s.aT,s.aT),h=this.projection.project(r.lng,a);return new s.P(h.x*this.worldSize,h.y*this.worldSize)}unproject(r){return this.projection.unproject(r.x/this.worldSize,r.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/s.ay(1,this.center.lat)/this.worldSize}setLocationAtPoint(r,a){let h,p;const m=this.centerPoint;if(this.projection.name==="globe"){const x=this.worldSize;h=(a.x-m.x)/x,p=(a.y-m.y)/x}else{const x=this.pointCoordinate(a),w=this.pointCoordinate(m);h=x.x-w.x,p=x.y-w.y}const g=this.locationCoordinate(r);this.setLocation(new s._(g.x-h,g.y-p))}setLocation(r){this.center=this.coordinateLocation(r),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(r){return this.projection.locationPoint(this,r)}locationPoint3D(r){return this.projection.locationPoint(this,r,!0)}pointLocation(r){return this.coordinateLocation(this.pointCoordinate(r))}pointLocation3D(r){return this.coordinateLocation(this.pointCoordinate3D(r))}locationCoordinate(r,a){const h=a?s.ay(a,r.lat):void 0,p=this.projection.project(r.lng,r.lat);return new s._(p.x,p.y,h)}coordinateLocation(r){return this.projection.unproject(r.x,r.y)}pointRayIntersection(r,a){const h=a??this._centerAltitude,p=[r.x,r.y,0,1],m=[r.x,r.y,1,1];s.aB.transformMat4(p,p,this.pixelMatrixInverse),s.aB.transformMat4(m,m,this.pixelMatrixInverse);const g=m[3];s.aB.scale(p,p,1/p[3]),s.aB.scale(m,m,1/g);const x=p[2],w=m[2];return{p0:p,p1:m,t:x===w?0:(h-x)/(w-x)}}screenPointToMercatorRay(r){const a=[r.x,r.y,0,1],h=[r.x,r.y,1,1];return s.aB.transformMat4(a,a,this.pixelMatrixInverse),s.aB.transformMat4(h,h,this.pixelMatrixInverse),s.aB.scale(a,a,1/a[3]),s.aB.scale(h,h,1/h[3]),a[2]=s.ay(a[2],this._center.lat)*this.worldSize,h[2]=s.ay(h[2],this._center.lat)*this.worldSize,s.aB.scale(a,a,1/this.worldSize),s.aB.scale(h,h,1/this.worldSize),new s.aU([a[0],a[1],a[2]],s.$.normalize([],s.$.sub([],h,a)))}rayIntersectionCoordinate(r){const{p0:a,p1:h,t:p}=r,m=s.ay(a[2],this._center.lat),g=s.ay(h[2],this._center.lat);return new s._(s.a3(a[0],h[0],p)/this.worldSize,s.a3(a[1],h[1],p)/this.worldSize,s.a3(m,g,p))}pointCoordinate(r,a=this._centerAltitude){return this.projection.pointCoordinate(this,r.x,r.y,a)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);let a=this.projection.pointCoordinate3D(this,r.x,r.y);if(a)return new s._(a[0],a[1],a[2]);let h=0,p=this.horizonLineFromTop();if(r.y>p)return this.pointCoordinate(r);const m=.02*p,g=r.clone();for(let x=0;x<10&&p-h>m;x++){g.y=s.a3(h,p,.66);const w=this.projection.pointCoordinate3D(this,g.x,g.y);w?(p=g.y,a=w):h=g.y}return a?new s._(a[0],a[1],a[2]):this.pointCoordinate(r)}isPointAboveHorizon(r){return this.projection.isPointAboveHorizon(this,r)}isPointOnSurface(r){if(r.y<0||r.y>this.height||r.x<0||r.x>this.width)return!1;if(this.elevation||this.zoom>=s.aV)return!this.isPointAboveHorizon(r);const a=this.pointCoordinate(r);return a.y>=0&&a.y<=1}_coordinatePoint(r,a){const h=a&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,p=[r.x*this.worldSize,r.y*this.worldSize,h+r.toAltitude(),1];return s.aB.transformMat4(p,p,this.pixelMatrix),p[3]>0?new s.P(p[0]/p[3],p[1]/p[3]):new s.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:r,left:a}=this._edgeInsets,h=this.height-this._edgeInsets.bottom,p=this.width-this._edgeInsets.right,m=this.pointLocation3D(new s.P(a,r)),g=this.pointLocation3D(new s.P(p,r)),x=this.pointLocation3D(new s.P(p,h)),w=this.pointLocation3D(new s.P(a,h));let T=Math.min(m.lng,g.lng,x.lng,w.lng),S=Math.max(m.lng,g.lng,x.lng,w.lng),I=Math.min(m.lat,g.lat,x.lat,w.lat),P=Math.max(m.lat,g.lat,x.lat,w.lat);const z=Math.pow(2,-this.zoom)/16*270,L=this.projection.name==="globe"?1:4,k=(O,B,G,$,j)=>{const J=(O+G)/2,Z=(B+$)/2,W=new s.P(J,Z),{lng:ee,lat:ie}=this.pointLocation3D(W),ue=Math.max(0,T-ee,I-ie,ee-S,ie-P);T=Math.min(T,ee),S=Math.max(S,ee),I=Math.min(I,ie),P=Math.max(P,ie),(jz)&&(k(O,B,J,Z,j+1),k(J,Z,G,$,j+1))};if(k(a,r,p,r,1),k(p,r,p,h,1),k(p,h,a,h,1),k(a,h,a,r,1),this.projection.name==="globe"){const[O,B]=s.aW(this);O?(P=90,S=180,T=-180):B&&(I=-90,S=180,T=-180)}return new s.aj(new s.aJ(T,I),new s.aJ(S,P))}_getBoundsRectangular(r,a){const{top:h,left:p}=this._edgeInsets,m=this.height-this._edgeInsets.bottom,g=this.width-this._edgeInsets.right,x=new s.P(p,h),w=new s.P(g,h),T=new s.P(g,m),S=new s.P(p,m);let I=this.pointCoordinate(x,r),P=this.pointCoordinate(w,r);const z=this.pointCoordinate(T,a),L=this.pointCoordinate(S,a),k=(O,B)=>(B.y-O.y)/(B.x-O.x);return I.y>1&&P.y>=0?I=new s._((1-L.y)/k(L,I)+L.x,1):I.y<0&&P.y<=1&&(I=new s._(-L.y/k(L,I)+L.x,0)),P.y>1&&I.y>=0?P=new s._((1-z.y)/k(z,P)+z.x,1):P.y<0&&I.y<=1&&(P=new s._(-z.y/k(z,P)+z.x,0)),new s.aj().extend(this.coordinateLocation(I)).extend(this.coordinateLocation(P)).extend(this.coordinateLocation(L)).extend(this.coordinateLocation(z))}_getBoundsRectangularTerrain(){const r=this.elevation;if(!r.visibleDemTiles.length||r.isUsingMockSource())return this._getBoundsRectangular(0,0);const a=r.visibleDemTiles.reduce((h,p)=>{if(p.dem){const m=p.dem.tree;h.min=Math.min(h.min,m.minimums[0]),h.max=Math.max(h.max,m.maximums[0])}return h},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(a.min*r.exaggeration(),a.max*r.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(r=!0){const a=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,h=this.height/2-a*(1-this._horizonShift);return r?Math.max(0,h):h}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-s.aT,this.maxLat=s.aT,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLngI&&(x=I-T),I-Sz&&(g=z-w),z-P{for(let Se=0;Se<16;Se++)_e[Se]=xl(fe[Se],se[Se],Ce)})(x,x,w,Ks(this.pitch>=15?1:this.pitch/15))}else x=w;const T=s.ae.mul([],w,g);let S=s.ae.mul([],x,g);if(this.projection.isReprojectedInTileSpace){const ie=this.locationCoordinate(this.center),ue=s.ae.identity([]);s.ae.translate(ue,ue,[ie.x*this.worldSize,ie.y*this.worldSize,0]),s.ae.multiply(ue,ue,s.aZ(this)),s.ae.translate(ue,ue,[-ie.x*this.worldSize,-ie.y*this.worldSize,0]),s.ae.multiply(S,S,ue),s.ae.multiply(T,T,ue),this.inverseAdjustmentMatrix=s.a_(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=s.ae.scale([],S,[this.worldSize,this.worldSize,this.worldSize/m,1]),this.projMatrix=S,this.invProjMatrix=s.ae.invert(new Float64Array(16),this.projMatrix),a){const ie=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ie[8]=2*-r.x/this.width,ie[9]=2*r.y/this.height,this.expandedFarZProjMatrix=s.ae.mul([],ie,g)}else this.expandedFarZProjMatrix=this.projMatrix;const I=s.ae.invert([],x);this.frustumCorners=s.a$.fromInvProjectionMatrix(I,this.horizonLineFromTop(),this.height),this.cameraFrustum=s.aM.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!a);const P=new Float32Array(16);s.ae.identity(P),s.ae.scale(P,P,[1,-1,1]),s.ae.rotateX(P,P,this._pitch),s.ae.rotateZ(P,P,this.angle);const z=s.ae.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=s.ae.clone(z);const L=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;z[8]=2*-r.x/this.width,z[9]=2*(r.y+L)/this.height,this.skyboxMatrix=s.ae.multiply(P,z,P);const k=this.point,O=k.x,B=k.y,G=this.width%2/2,$=this.height%2/2,j=Math.cos(this.angle),J=Math.sin(this.angle),Z=O-Math.round(O)+j*G+J*$,W=B-Math.round(B)+j*$+J*G,ee=new Float64Array(S);if(s.ae.translate(ee,ee,[Z>.5?Z-1:Z,W>.5?W-1:W,0]),this.alignedProjMatrix=ee,S=s.ae.create(),s.ae.scale(S,S,[this.width/2,-this.height/2,1]),s.ae.translate(S,S,[1,-1,0]),this.labelPlaneMatrix=S,S=s.ae.create(),s.ae.scale(S,S,[1,-1,1]),s.ae.translate(S,S,[-1,-1,0]),s.ae.scale(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S,this.pixelMatrix=s.ae.multiply(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},S=s.ae.invert(new Float64Array(16),this.pixelMatrix),!S)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=S,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=s.b0(this);const ie=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=s.$.transformMat4(ie,ie,g),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=S;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const r=this.cameraWorldSizeForFog,a=this.cameraPixelsPerMeter,h=this._camera.position,p=1/this.height/this._pixelsPerMercatorPixel,m=[r,r,a];s.$.scale(m,m,p),s.$.scale(h,h,-1),s.$.multiply(h,h,m);const g=s.ae.create();s.ae.translate(g,g,h),s.ae.scale(g,g,m),this.mercatorFogMatrix=g,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,a,p)}_computeCameraPosition(r){const a=(r=r||this.pixelsPerMeter)/this.pixelsPerMeter,h=this._camera.forward(),p=this.point,m=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*a-r/this.worldSize*this._centerAltitude;return[p.x/this.worldSize-h[0]*m,p.y/this.worldSize-h[1]*m,r/this.worldSize*this._centerAltitude-h[2]*m]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){const a=this._maxCameraBoundsDistance()*Math.cos(this._pitch),h=this._camera.position[2],p=r[2];let m=1;this.projection.wrap&&(this.center=this.center.wrap()),p>0&&(m=Math.min((a-h)/p,1)),this._camera.position=s.$.scaleAndAdd([],this._camera.position,r,m),this._updateStateFromCamera()}_updateStateFromCamera(){const r=this._camera.position,a=this._camera.forward(),{pitch:h,bearing:p}=this._camera.getPitchBearing(),m=s.ay(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,g=this._mercatorZfromZoom(this._maxZoom)*Math.cos(s.ac(this._maxPitch)),x=Math.max((r[2]-m)/Math.cos(h),g),w=this._zoomFromMercatorZ(x);s.$.scaleAndAdd(r,r,a,x),this._pitch=s.au(h,s.ac(this.minPitch),s.ac(this.maxPitch)),this.angle=s.av(p,-Math.PI,Math.PI),this._setZoom(s.au(w,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new s._(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(r){return Math.pow(2,r)*this.tileSize}_mercatorZfromZoom(r){return this.cameraToCenterDistance/this._worldSizeFromZoom(r)}_minimumHeightOverTerrain(){const r=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(r)}_zoomFromMercatorZ(r){return this.scaleZoom(this.cameraToCenterDistance/(r*this.tileSize))}zoomFromMercatorZAdjusted(r){let a=0,h=s.aV,p=0,m=1/0;for(;h-a>1e-6&&h>a;){const g=a+.5*(h-a),x=this.tileSize*Math.pow(2,g),w=this.getCameraToCenterDistance(this.projection,g,x),T=this.scaleZoom(w/(r*this.tileSize)),S=Math.abs(g-T);ST||P.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+s.b1(this.fovAboveCenter)>88||this.anyCornerOffEdge(new s.P(0,0),new s.P(this.width,this.height))}zoomDeltaToMovement(r,a){const h=s.$.length(s.$.sub([],this._camera.position,r)),p=this._zoomFromMercatorZ(h)+a;return h-this._mercatorZfromZoom(p)}getCameraPoint(){if(this.projection.name==="globe"){const r=function([a,h,p],m){const g=[a,h,p,1];s.aB.transformMat4(g,g,m);const x=g[3]=Math.max(g[3],1e-6);return g[0]/=x,g[1]/=x,g[2]/=x,g}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new s.P(r[0],r[1])}{const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,r))}}getCameraToCenterDistance(r,a=this.zoom,h=this.worldSize){const p=s.aY(r,a,this.width,this.height,1024),m=r.pixelSpaceConversion(this.center.lat,h,p);let g=.5/Math.tan(.5*this._fov)*this.height*m;return this.isOrthographic&&(g=xl(1,g,Ks(this.pitch>=15?1:this.pitch/15))),g}getWorldToCameraMatrix(){const r=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&s.ae.multiply(r,r,this.globeMatrix),r}getFrustum(r){return s.aM.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,this.projection.zAxisUnit==="meters")}}const $i={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11},ar=(u,r)=>{if(r>0&&u.terrain&&s.w("Cutoff is currently disabled on terrain"),r<=0||u.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const a=u.transform,h=Math.max(Math.abs(a._zoom-(u.minCutoffZoom-1)),1),p=a.isLODDisabled(!1)?s.a0(60,45,a.pitch):s.a0(30,15,a.pitch),m=a._farZ-a._nearZ,g=r*a.height,x=((1-(w=p))*a.cameraToCenterDistance+w*(a._farZ+g))*h;var w;return{shouldRenderCutoff:p<1,uniformValues:{u_cutoff_params:[a._nearZ,a._farZ,(x-a._nearZ)/m,(x-g-a._nearZ)/m]}}},qi={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class vi{constructor(r,a){this.aabb=r,this.lastCascade=a}}class Fn{add(r,a){const h=this.receivers[r.key];h!==void 0?(h.aabb.min[0]=Math.min(h.aabb.min[0],a.min[0]),h.aabb.min[1]=Math.min(h.aabb.min[1],a.min[1]),h.aabb.min[2]=Math.min(h.aabb.min[2],a.min[2]),h.aabb.max[0]=Math.max(h.aabb.max[0],a.max[0]),h.aabb.max[1]=Math.max(h.aabb.max[1],a.max[1]),h.aabb.max[2]=Math.max(h.aabb.max[2],a.max[2])):this.receivers[r.key]=new vi(a,null)}clear(){this.receivers={}}get(r){return this.receivers[r.key]}computeRequiredCascades(r,a,h){const p=s.b8.fromPoints(r.points);let m=0;for(const g in this.receivers){const x=this.receivers[g];if(!x||!p.intersectsAabb(x.aabb))continue;x.aabb.min=p.closestPoint(x.aabb.min),x.aabb.max=p.closestPoint(x.aabb.max);const w=x.aabb.getCorners();for(let T=0;T1||P[1]<-1||P[1]>1){S=!1;break}}if(x.lastCascade=T,m=Math.max(m,T),S)break}}return m+1}}class Ep{constructor(r){this.painter=r,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Fn,this._depthMode=new s.af(r.context.gl.LEQUAL,s.af.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,r.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),r.tp.registerParameter(qi,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),r.tp.registerParameter(qi,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),r.tp.registerParameter(qi,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),r.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const r of this._cascades)r.texture.destroy(),r.framebuffer.destroy();this._cascades=[]}updateShadowParameters(r,a){const h=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!a||!a.properties)return;const p=a.properties.get("shadow-intensity");if(!a.shadowsEnabled()||p<=0||(this._shadowLayerCount=h.style.order.reduce((L,k)=>{const O=h.style._mergedLayers[k];return L+(O.hasShadowPass()&&!O.isHidden(r.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const m=h.context,g=qi.shadowMapResolution,x=qi.shadowMapResolution;if(this._cascades.length===0||qi.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let L=0;LO.dem).forEach(O=>{const B=O.dem.tree;k[0]=Math.min(k[0],B.minimums[0]),k[1]=Math.max(k[1],B.maximums[0])}),k[0]!==1e4&&(w=(k[1]-k[0])*L.exaggeration())}const T=1.5*r.cameraToCenterDistance,S=3*T,I=new Float64Array(16);for(let L=0;L=0)return{};const m=function(w,T,S){const I=S/(1<0&&(s.$.add(m[1],m[1],[p[0]*g,0,0]),s.$.add(m[2],m[2],[p[0]*g,0,0])),p[1]<0?(s.$.add(m[0],m[0],[0,p[1]*g,0]),s.$.add(m[1],m[1],[0,p[1]*g,0])):p[1]>0&&(s.$.add(m[2],m[2],[0,p[1]*g,0]),s.$.add(m[3],m[3],[0,p[1]*g,0]));const x={};return x.vertices=m,x.planes=[Qo(m[1],m[0],m[4]),Qo(m[2],m[1],m[5]),Qo(m[3],m[2],m[6]),Qo(m[0],m[3],m[7])],x}addShadowReceiver(r,a,h){this._receivers.add(r,s.b8.fromTileIdAndHeight(r,a,h))}getMaxCascadeForTile(r){const a=this._receivers.get(r);return a&&a.lastCascade?a.lastCascade:0}}function Qo(u,r,a){const h=s.$.sub([],a,r),p=s.$.sub([],u,r),m=s.$.cross([],h,p),g=s.$.length(m);return g===0?[0,0,1,0]:(s.$.scale(m,m,1/g),[m[0],m[1],m[2],-s.$.dot(m,r)])}function es(u){const r=u.properties.get("direction"),a=s.ad(r.x,r.y,r.z);a[2]=s.au(a[2],0,75);const h=s.b9([a[0],a[1],a[2]]);return s.$.fromValues(h.x,h.y,h.z)}function ea(u,r,a){const h=r.properties.get("color"),p=r.properties.get("intensity"),m=r.properties.get("direction"),g=[m.x,m.y,m.z],x=a.properties.get("color"),w=a.properties.get("intensity"),T=Math.max(s.$.dot([0,0,1],g),0),S=[0,0,0];s.$.scale(S,x.toRenderColor(u.getLut(r.scope)).toArray01Linear().slice(0,3),w);const I=[0,0,0];return s.$.scale(I,h.toRenderColor(u.getLut(a.scope)).toArray01Linear().slice(0,3),T*p),s.ba([S[0]>0?S[0]/(S[0]+I[0]):0,S[1]>0?S[1]/(S[1]+I[1]):0,S[2]>0?S[2]/(S[2]+I[2]):0])}function $c(u,r,a,h,p,m){const g=u.zoom,x=u.scale,w=u.worldSize,T=1/w,S=u.aspect,I=Math.sqrt(1+S*S)*Math.tan(.5*u.fovX),P=I*I,z=h-a,L=h+a;let k,O;P>z/L?(k=h,O=h*I):(k=.5*L*(1+P),O=.5*Math.sqrt(z*z+2*(h*h+a*a)*P+L*L*P*P));const B=u.projection.pixelsPerMeter(u.center.lat,w),G=u._camera.getCameraToWorldMercator(),$=[0,0,-k*T];s.$.transformMat4($,$,G);let j=O*T;const J=u._edgeInsets;if(!(J.left===0&&J.top===0&&J.right===0&&J.bottom===0||J.left===J.right&&J.top===J.bottom)){const Me=u._camera.getWorldToCamera(u.worldSize,u.projection.zAxisUnit==="meters"?B:1),Ae=u._camera.getCameraToClipPerspective(u._fov,u.width/u.height,a,h);Ae[8]=2*-u.centerOffset.x/u.width,Ae[9]=2*u.centerOffset.y/u.height;const Ue=new Float64Array(16);s.ae.mul(Ue,Ae,Me);const Ge=new Float64Array(16);s.ae.invert(Ge,Ue);const He=s.aM.fromInvProjectionMatrix(Ge,w,g,!0);for(const $e of He.points){const it=((Z=$e)[0]/=x,Z[1]/=x,Z[2]=s.ay(Z[2],u._center.lat),Z);j=Math.max(j,s.$.len(s.$.subtract([],$,it)))}}var Z;j*=p/(p-1);const W=Math.acos(r[2]),ee=Math.atan2(-r[0],-r[1]),ie=new Yo;ie.position=$,ie.setPitchBearing(W,ee);const ue=ie.getWorldToCamera(w,B),re=j*w,Y=Math.min(u._mercatorZfromZoom(17)*w*-2,-2*re),_e=ie.getCameraToClipOrthographic(-re,re,-re,re,Y,(re+m*B)/r[2]),fe=new Float64Array(16);s.ae.multiply(fe,_e,ue);const se=s.$.fromValues(Math.floor(1e6*$[0])/1e6*w,Math.floor(1e6*$[1])/1e6*w,0),Ce=.5*p,Se=[0,0,0];s.$.transformMat4(Se,se,fe),s.$.scale(Se,Se,Ce);const he=[Math.floor(Se[0]),Math.floor(Se[1]),Math.floor(Se[2])],ve=[0,0,0];s.$.sub(ve,Se,he),s.$.scale(ve,ve,-1/Ce);const ne=new Float64Array(16);return s.ae.identity(ne),s.ae.translate(ne,ne,ve),s.ae.multiply(fe,ne,fe),[fe,re]}function ta(u,r){return u!=null&&r!=null&&!(!u.hasData()||!r.hasData())&&u.demTexture!=null&&r.demTexture!=null&&u.tileID.key!==r.tileID.key}const Nn=new class{constructor(){this.operations={}}newMorphing(u,r,a,h,p){if(u in this.operations){const m=this.operations[u];m.to.tileID.key!==a.tileID.key&&(m.queued=a)}else this.operations[u]={startTime:h,phase:0,duration:p,from:r,to:a,queued:null}}getMorphValuesForProxy(u){if(!(u in this.operations))return null;const r=this.operations[u];return{from:r.from,to:r.to,phase:r.phase}}update(u){for(const r in this.operations){const a=this.operations[r];for(a.phase=(u-a.startTime)/a.duration;a.phase>=1||!this._validOp(a);)if(!this._nextOp(a,u)){delete this.operations[r];break}}}_nextOp(u,r){return!!u.queued&&(u.from=u.to,u.to=u.queued,u.queued=null,u.phase=0,u.startTime=r,!0)}_validOp(u){return u.from.hasData()&&u.to.hasData()}},ia={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Vn(u,r,a){if(r===0)return 0;const h=r<1&&a===514?.25/r:1;return 6*Math.pow(1.5,22-u)*Math.max(r,1)*h}function ra(u,r){const a=1<({u_matrix:u});function vl(u,r,a,h,p){if(p>0){const m=s.e.now(),g=(m-u.timeAdded)/p,x=r?(m-r.timeAdded)/p:-1,w=a.getSource(),T=h.coveringZoomLevel({tileSize:w.tileSize,roundZoom:w.roundZoom}),S=!r||Math.abs(r.tileID.overscaledZ-T)>Math.abs(u.tileID.overscaledZ-T),I=S&&u.refreshedUponExpiration?1:s.au(S?g:1-x,0,1);return u.refreshedUponExpiration&&g>=1&&(u.refreshedUponExpiration=!1),r?{opacity:1,mix:1-I}:{opacity:I,mix:0}}return{opacity:1,mix:0}}class Un extends fr{constructor(r,a,h,p){super(r,a,h,p),this.type="raster-array",this.maxzoom=22,this._options=s.Q({type:"raster-array"},a)}triggerRepaint(r){const a=this.map.painter._terrain,h=this.map.style.getSourceCache(this.id);a&&a.enabled&&h&&a._clearRenderCacheForTile(h.id,r.tileID),this.map.triggerRepaint()}loadTile(r,a){const h=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),p=this.map._requestManager.transformRequest(h,s.R.Tile);r.requestParams=p,r.actor||(r.actor=this.dispatcher.getActor()),r.request=r.fetchHeader(void 0,(m,g,x,w)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(m)return m.code===20?void 0:(r.state="errored",a(m));this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:x,expires:w}),r.state="empty",a(null)})}unloadTile(r,a){const h=r.texture;h&&h instanceof s.T?(r.destroy(!0),this.map.painter.saveTileTexture(h)):(r.destroy(),r.flushQueues(),r._isHeaderLoaded=!1,delete r._mrt,delete r.textureDescriptor),r.fbo&&(r.fbo.destroy(),delete r.fbo),delete r.request,delete r.requestParams,delete r.neighboringTiles,r.state="unloaded"}prepareTile(r,a,h){r._isHeaderLoaded&&(r.state!=="empty"&&(r.state="reloading"),r.fetchBand(a,h,(p,m)=>{if(p)return r.state="errored",this.fire(new s.f(p)),void this.triggerRepaint(r);m&&(r.setTexture(m,this.map.painter),r.state="loaded",this.triggerRepaint(r))}))}getInitialBand(r){if(!this.rasterLayers)return 0;const a=this.rasterLayers.find(({id:m})=>m===r),h=a&&a.fields,p=h&&h.bands&&h.bands;return p?p[0]:0}getTextureDescriptor(r,a,h){if(!r)return;const p=a.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!p)return;let m=null;a instanceof s.bm?m=a.paint.get("raster-array-band"):a instanceof s.bn&&(m=a.paint.get("raster-particle-array-band"));const g=m||this.getInitialBand(p);if(g!=null)if(r.textureDescriptor){if(!r.updateNeeded(p,g)||h)return Object.assign({},r.textureDescriptor,{texture:r.texture})}else this.prepareTile(r,p,g)}}const bl={vector:xh,raster:fr,"raster-dem":class extends fr{constructor(u,r,a,h){super(u,r,a,h),this.type="raster-dem",this.maxzoom=22,this._options=s.Q({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(u,r){const a=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function h(p,m){p&&(u.state="errored",r(p)),m&&(u.dem=m,u.dem.onDeserialize(),u.needsHillshadePrepare=!0,u.needsDEMTextureUpload=!0,u.state="loaded",r(null))}u.request=s.i(this.map._requestManager.transformRequest(a,s.R.Tile),function(p,m,g,x){if(delete u.request,u.aborted)u.state="unloaded",r(null);else if(p)u.state="errored",r(p);else if(m){this.map._refreshExpiredTiles&&u.setExpiryData({cacheControl:g,expires:x});const w=ImageBitmap&&m instanceof ImageBitmap&&s.bk(),T=1-(m.width-s.bl(m.width))/2;T<1||u.neighboringTiles||(u.neighboringTiles=this._getNeighboringTiles(u.tileID));const S=w?m:s.e.getImageData(m,T),I={uid:u.uid,coord:u.tileID,source:this.id,scope:this.scope,rawImageData:S,encoding:this.encoding,padding:T};u.actor&&u.state!=="expired"||(u.actor=this.dispatcher.getActor(),u.actor.send("loadDEMTile",I,h.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(u){const r=u.canonical,a=Math.pow(2,r.z),h=(r.x-1+a)%a,p=r.x===0?u.wrap-1:u.wrap,m=(r.x+1+a)%a,g=r.x+1===a?u.wrap+1:u.wrap,x={};return x[new s.aQ(u.overscaledZ,p,r.z,h,r.y).key]={backfilled:!1},x[new s.aQ(u.overscaledZ,g,r.z,m,r.y).key]={backfilled:!1},r.y>0&&(x[new s.aQ(u.overscaledZ,p,r.z,h,r.y-1).key]={backfilled:!1},x[new s.aQ(u.overscaledZ,u.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},x[new s.aQ(u.overscaledZ,g,r.z,m,r.y-1).key]={backfilled:!1}),r.y+1{if(this._loaded=!0,this._pendingLoad=null,h)this.fire(new s.f(h));else{const m={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&p&&p.resourceTiming&&p.resourceTiming[this.id]&&(m.resourceTiming=p.resourceTiming[this.id]),u&&(this._partialReload=!0),this.fire(new s.g("data",m)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(u),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(u,r){const a=u.actor?"reloadTile":"loadTile";u.actor=this.actor;const h=this.map.style?this.map.style.getLut(this.scope):null,p=this._partialReload,m={type:this.type,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:h?{image:h.image.clone()}:null,scope:this.scope,pixelRatio:s.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,partial:p};u.request=this.actor.send(a,m,(g,x)=>p&&!x?(u.state="loaded",r(null)):(delete u.request,u.destroy(),u.aborted?r(null):g?r(g):(u.loadVectorData(x,this.map.painter,a==="reloadTile"),r(null))),void 0,a==="loadTile")}abortTile(u){u.request&&(u.request.cancel(),delete u.request),u.aborted=!0}unloadTile(u,r){this.actor.send("removeTile",{uid:u.uid,type:this.type,source:this.id,scope:this.scope}),u.destroy()}onRemove(u){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return s.Q({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s.bo{constructor(u,r,a,h){super(u,r,a,h),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;const u=this.options;this.urls=[];for(const r of u.urls)this.urls.push(this.map._requestManager.transformRequest(r,s.R.Source).url);s.bp(this.urls,(r,a)=>{this._loaded=!0,r?this.fire(new s.f(r)):a&&(this.video=a,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(u){if(this.video){const r=this.video.seekable;ur.end(0)?this.fire(new s.f(new s.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=u}}getVideo(){return this.video}onAdd(u){this.map||(this.map=u,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const u=this.map.painter.context,r=u.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new s.T(u,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(u)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s.bo,model:class extends s.E{constructor(u,r,a,h){super(),this.id=u,this.type="model",this.models=[],this._loaded=!1,this._options=r}load(){const u=[];for(const r in this._options.models){const a=this._options.models[r],h=s.l(this.map._requestManager.transformRequest(a.uri,s.R.Model).url).then(p=>{if(!p)return;const m=s.c(p),g=new s.M(r,a.position,a.orientation,m);g.computeBoundsAndApplyParent(),this.models.push(g)}).catch(p=>{this.fire(new s.f(new Error(`Could not load model ${r} from ${a.uri}: ${p.message}`)))});u.push(h)}return Promise.allSettled(u).then(()=>{this._loaded=!0,this.fire(new s.g("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(r=>{this.fire(new s.f(new Error(`Could not load models: ${r.message}`)))})}onAdd(u){this.map=u,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(u,r){}serialize(){return{type:"model"}}},"batched-model":class extends s.E{constructor(u,r,a,h){super(),this.type="batched-model",this.id=u,this.tileSize=512,this._options=r,this.tiles=this._options.tiles,this.maxzoom=r.maxzoom||19,this.minzoom=r.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=a,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(h)}onAdd(u){this.map=u,this.load()}load(u){this._loaded=!1,this.fire(new s.g("dataloading",{dataType:"source"}));const r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map._worldview;this._tileJSONRequest=Nc(this._options,this.map._requestManager,r,a,(h,p)=>{this._tileJSONRequest=null,this._loaded=!0,h?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&a.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new s.f(h))):p&&(s.Q(this,p),p.bounds&&(this.tileBounds=new Hs(p.bounds,this.minzoom,this.maxzoom)),s.ao(p.tiles,this.map._requestManager._customAccessToken),this.fire(new s.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.g("data",{dataType:"source",sourceDataType:"content"}))),u&&u(h)})}hasTransition(){return!1}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}loaded(){return this._loaded}loadTile(u,r){const a=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme)),h={request:this.map._requestManager.transformRequest(a,s.R.Tile),data:void 0,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,tileSize:this.tileSize*u.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:u.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0};if(u.actor&&u.state!=="expired")if(u.state==="loading")u.reloadCallback=r;else{if(u.buckets){const m=Object.values(u.buckets);for(const g of m)g.dirty=!0;return void(u.state="loaded")}u.request=u.actor.send("reloadTile",h,p.bind(this))}else u.actor=this.dispatcher.getActor(),u.request=u.actor.send("loadTile",h,p.bind(this),void 0,!0);function p(m,g){return u.aborted?r(null):m&&m.status!==404?r(m):(g&&(g.resourceTiming&&(u.resourceTiming=g.resourceTiming),this.map._refreshExpiredTiles&&u.setExpiryData(g),u.buckets={...u.buckets,...g.buckets},g.featureIndex&&(u.latestFeatureIndex=g.featureIndex)),u.state="loaded",void r(null))}}serialize(){return s.Q({},this._options)}},canvas:class extends s.bo{constructor(u,r,a,h){super(u,r,a,h),r.coordinates?Array.isArray(r.coordinates)&&r.coordinates.length===4&&!r.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(m=>typeof m!="number"))||this.fire(new s.f(new s.V(`sources.${u}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.f(new s.V(`sources.${u}`,null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new s.f(new s.V(`sources.${u}`,null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas=="string"||r.canvas instanceof HTMLCanvasElement||this.fire(new s.f(new s.V(`sources.${u}`,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 s.f(new s.V(`sources.${u}`,null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate===void 0||r.animate}load(){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 s.f(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(u){this.map=u,this.load(),this.canvas&&this.animate&&this.play()}onRemove(u){this.pause()}prepare(){let u=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,u=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,u=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const r=this.map.painter.context;this.texture?!u&&!this._playing||this.texture instanceof s.bq||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new s.T(r,this.canvas,r.gl.RGBA,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const u of[this.canvas.width,this.canvas.height])if(isNaN(u)||u<=0)return!0;return!1}},custom:class extends s.E{constructor(u,r,a,h){super(),this.id=u,this.type="custom",this._dataType="raster",this._dispatcher=a,this._implementation=r,this.setEventedParent(h),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new s.f(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new s.f(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Hs(this._implementation.bounds,this.minzoom,this.maxzoom)),r.update=this._update.bind(this),r.clearTiles=this._clearTiles.bind(this),r.coveringTiles=this._coveringTiles.bind(this),s.Q(this,s.ai(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return s.ai(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new s.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.g("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(u){this.map=u,this._loaded=!1,this.fire(new s.g("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(u),this.load()}onRemove(u){this._implementation.onRemove&&this._implementation.onRemove(u)}hasTile(u){if(this._implementation.hasTile){const{x:r,y:a,z:h}=u.canonical;return this._implementation.hasTile({x:r,y:a,z:h})}return!this.tileBounds||this.tileBounds.contains(u.canonical)}loadTile(u,r){const{x:a,y:h,z:p}=u.tileID.canonical,m=new AbortController;u.request=Promise.resolve(this._implementation.loadTile({x:a,y:h,z:p},{signal:m.signal})).then(function(g){return delete u.request,u.aborted?(u.state="unloaded",r(null)):g===void 0?(u.state="errored",r(null)):g===null?(this.loadTileData(u,{width:this.tileSize,height:this.tileSize,data:null}),u.state="loaded",r(null)):function(x){return x instanceof ImageData||x instanceof HTMLCanvasElement||x instanceof ImageBitmap||x instanceof HTMLImageElement}(g)?(this.loadTileData(u,g),u.state="loaded",void r(null)):(u.state="errored",r(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch(g=>{g.code!==20&&(u.state="errored",r(g))}),u.request.cancel=()=>m.abort()}loadTileData(u,r){u.setTexture(r,this.map.painter)}unloadTile(u,r){if(u.texture&&u.texture instanceof s.T?(u.destroy(!0),u.texture&&u.texture instanceof s.T&&this.map.painter.saveTileTexture(u.texture)):u.destroy(),this._implementation.unloadTile){const{x:a,y:h,z:p}=u.tileID.canonical;this._implementation.unloadTile({x:a,y:h,z:p})}r&&r()}abortTile(u,r){u.request&&u.request.cancel&&(u.request.cancel(),delete u.request),r&&r()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(u=>({x:u.canonical.x,y:u.canonical.y,z:u.canonical.z}))}_clearTiles(){const u=s.am(this.id,this.scope);this.map.style.clearSource(u)}_update(){this.fire(new s.g("data",{dataType:"source",sourceDataType:"content"}))}}},wl=function(u,r,a,h){const p=new bl[r.type](u,r,a,h);if(p.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${p.id}`);return s.br(["load","abort","unload","serialize","prepare"],p),p};class Th extends s.bx{constructor(r){const a={type:"raster-dem",maxzoom:r.transform.maxZoom},h=new s.by(s.bz(),null),p=wl("mock-dem",a,h,r.style);super("mock-dem",p,!1),p.setEventedParent(this),this._sourceLoaded=!0}_loadTile(r,a){r.state="loaded",a(null)}}class Eh extends s.bx{constructor(r){const a=wl("proxy",{type:"geojson",maxzoom:r.transform.maxZoom},new s.by(s.bz(),null),r.style);super("proxy",a,!1),a.setEventedParent(this),this.map=this.getSource().map=r,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,a,h){if(r.freezeTileCoverage)return;this.transform=r;const p=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((m,g)=>{if(m[g.key]="",!this._tiles[g.key]){const x=new s.bA(g,this._source.tileSize*g.overscaleFactor(),r.tileZoom);x.state="loaded",this._tiles[g.key]=x}return m},{});for(const m in this._tiles)m in p||(this.freeFBO(m),this._tiles[m].unloadVectorData(),delete this._tiles[m])}freeFBO(r){const a=this.proxyCachedFBO[r];if(a!==void 0){const h=Object.values(a);this.renderCachePool.push(...h),delete this.proxyCachedFBO[r]}}deallocRenderCache(){this.renderCache.forEach(r=>r.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class qc extends s.aQ{constructor(r,a,h){super(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y),this.proxyTileKey=a,this.projMatrix=h}}class Zi extends s.bs{constructor(r,a){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},r.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),r.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),r.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[h,p,m]=function(w){const T=new s.bv,S=new s.bw,I=131;T.reserve(17161),S.reserve(33800);const P=s.a4/128,z=s.a4+P/2,L=z+P;for(let O=-P;Oz||O<0||O>z?24575:0,$=s.au(Math.round(B),0,s.a4),j=s.au(Math.round(O),0,s.a4);T.emplaceBack($+G,j)}const k=(O,B)=>{const G=B*I+O;S.emplaceBack(G+1,G,G+I),S.emplaceBack(G+I,G+I+1,G+1)};for(let O=1;O<129;O++)for(let B=1;B<129;B++)k(B,O);return[0,129].forEach(O=>{for(let B=0;B<130;B++)k(B,O),k(O,B)}),[T,S,32768]}(),g=r.context;this.gridBuffer=g.createVertexBuffer(h,s.bt.members),this.gridIndexBuffer=g.createIndexBuffer(p),this.gridSegments=s.b.simpleSegment(0,0,h.length,p.length),this.gridNoSkirtSegments=s.b.simpleSegment(0,0,h.length,m),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Eh(a.map),this.orthoMatrix=s.ae.create(),s.ae.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,s.a4,0,s.a4,0,1);const x=g.gl;this._overlapStencilMode=new s.ah({func:x.GEQUAL,mask:255},0,255,x.KEEP,x.KEEP,x.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=a,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Th(a.map),this._pendingGroundEffectLayers=[]}set style(r){r.on("data",this._onStyleDataEvent.bind(this)),this._style=r,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,a,h){if(r&&r.terrain){this._style!==r&&(this.style=r,this._evaluationZoom=void 0);const p=r.terrain.properties,m=r.terrain.drapeRenderMode===0,g=r.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=s.e.now();const x=r.terrain&&r.terrain.scope,w=p.get("source"),T=m?this._mockSourceCache:r.getSourceCache(w,x);if(!T)return void s.w(`Couldn't find terrain source "${w}".`);if(this.sourceCache=T,this._exaggeration=g?this.calculateExaggeration(a):p.get("exaggeration"),!a.projection.requiresDraping&&g&&this._exaggeration===0)return void this._disable();this.enabled=!0;const S=()=>{this.sourceCache.used&&s.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. -This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const I=this.getScaledDemTileSize();this.sourceCache.update(a,I,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,S(),this._initializing=!0),S(),a.updateElevation(!0,h),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(a),this._emptyDEMTextureDirty=!0,this._previousZoom=a.zoom}else this._disable()}calculateExaggeration(r){const a=this._previousCameraAltitude,h=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=h;const p=a!=null?h-a:Number.MAX_VALUE;if(Math.abs(p)<2)return this._exaggeration;const m=r.zoom,g=this._style.terrain;if(!this._previousUpdateTimestamp)return g.getExaggeration(m);let x=m-this._previousZoom;const w=this._previousUpdateTimestamp;let T=m;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(m-T)>.5&&(x=.5*(m-T+x)),x*p<0&&(T+=x)),this._evaluationZoom=T;const S=g.getExaggeration(T),I=S===g.getExaggeration(Math.max(0,T-.1));if(I&&Math.abs(S-this._exaggeration)<.01)return S;let P=Math.min(.1,.00375*(this._updateTimestamp-w));return(I||S<.1||Math.abs(x)<1e-4)&&(P=Math.min(.2,4*P)),s.a3(this._exaggeration,S,P)}resetTileLookupCache(r){this._findCoveringTileCache[r]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(r){r.coord&&r.dataType==="source"?this._clearRenderCacheForTile(r.sourceCacheId,r.coord):r.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const r in this._style._mergedSourceCaches)this._style._mergedSourceCaches[r].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(r=>r.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const r=2*this.proxySourceCache.getSource().tileSize;return[r,r]}set useVertexMorphing(r){this._useVertexMorphing=r}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const a=this.proxySourceCache,h=this.painter.transform;this._initializing&&(this._initializing=h._centerAltitude===0&&this.getAtPointOrZero(s._.fromLngLat(h.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const p=this.proxyCoords=a.getIds().map(w=>{const T=a.getTileByID(w).tileID;return T.projMatrix=h.calculateProjMatrix(T.toUnwrapped()),T});(function(w,T){const S=T.transform.pointCoordinate(T.transform.getCameraPoint()),I=new s.P(S.x,S.y);w.sort((P,z)=>{if(z.overscaledZ-P.overscaledZ)return z.overscaledZ-P.overscaledZ;const L=new s.P(P.canonical.x+(1<{this.proxyToSource[w.key]={}}),this.terrainTileForTile={};const g=this._style._mergedSourceCaches;for(const w in g){const T=g[w];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,r[w],m),T.usedForTerrain))continue;const S=r[w];T.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[a.id]=p.map(w=>new qc(w,w.key,this.orthoMatrix)),this._assignTerrainTiles(p),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(m),this.renderingToTexture=!1;const x={};this._visibleDemTiles=[];for(const w of this.proxyCoords){const T=this.terrainTileForTile[w.key];if(!T)continue;const S=T.tileID.key;S in x||(this._visibleDemTiles.push(T),x[S]=S)}}_assignTerrainTiles(r){this._initializing||r.forEach(a=>{if(this.terrainTileForTile[a.key])return;const h=this._findTileCoveringTileID(a,this.sourceCache);h&&(this.terrainTileForTile[a.key]=h)})}_prepareDEMTextures(){const r=this.painter.context,a=r.gl;for(const h in this.terrainTileForTile){const p=this.terrainTileForTile[h],m=p.dem;!m||p.demTexture&&!p.needsDEMTextureUpload||(r.activeTexture.set(a.TEXTURE1),yh(this.painter,p,m))}}_prepareDemTileUniforms(r,a,h,p){if(!a||a.demTexture==null)return!1;const m=r.tileID.canonical,g=Math.pow(2,a.tileID.canonical.z-m.z),x=p||"";return h[`u_dem_tl${x}`]=[m.x*g%1,m.y*g%1],h[`u_dem_scale${x}`]=g,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let r=0;const a=this._visibleDemTiles.reduce((h,p)=>{if(!p.dem)return h;const m=p.dem.tree.minimums[0];return m>0&&r++,h+m},0);return r?a/r:0}_updateEmptyDEMTexture(){const r=this.painter.context,a=r.gl;r.activeTexture.set(a.TEXTURE2);const h=this._getLoadedAreaMinimum(),[p,m]=(()=>{const x=new s.bB({width:1,height:1},new Float32Array([h]));return[a.R32F,x]})();this._emptyDEMTextureDirty=!1;let g=this._emptyDEMTexture;return g?g.update(m,{premultiply:!1}):g=this._emptyDEMTexture=new s.T(r,m,p,{premultiply:!1}),g}setupElevationDraw(r,a,h){const p=this.painter.context,m=p.gl,g={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};g.u_exaggeration=this.exaggeration();let x=null,w=null,T=1;if(h&&h.morphing&&this._useVertexMorphing){const z=h.morphing.srcDemTile,L=h.morphing.dstDemTile;T=h.morphing.phase,z&&L&&(this._prepareDemTileUniforms(r,z,g,"_prev")&&(w=z),this._prepareDemTileUniforms(r,L,g)&&(x=L))}const S=z=>z&&z.demTexture&&this.painter.linearFloatFilteringSupported()?m.LINEAR:m.NEAREST;let I=null;var P;if(this.enabled?w&&x?(I=x.demTexture,p.activeTexture.set(m.TEXTURE4),w.demTexture.bind(S(w),m.CLAMP_TO_EDGE),g.u_dem_lerp=T):(x=this.terrainTileForTile[r.tileID.key],I=this._prepareDemTileUniforms(r,x,g)?x.demTexture:this.emptyDEMTexture):I=this.emptyDEMTexture,p.activeTexture.set(m.TEXTURE2),I&&(g.u_dem_size=(P=I).size[0]===1?1:P.size[0]-2,I.bind(S(x),m.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(h&&h.useDepthForOcclusion,a,g),h&&h.useMeterToDem&&x){const z=(1<{if(B===fe)return;const se=[ia[fe],"PROJECTION_GLOBE_VIEW"];$&&se.push("CUSTOM_ANTIALIASING");const Ce=T.isTileAffectedByFog(_e);O=T.getOrCreateProgram("globeRaster",{defines:se,overrideFog:Ce}),B=fe},J=T.colorModeForRenderPass(),Z=new s.af(k.LEQUAL,s.af.ReadWrite,T.depthRangeFor3D);Nn.update(z);const W=s.bd(G),ee=[s.ak(G.center.lng),s.al(G.center.lat)],ie=T.globeSharedBuffers,ue=[G.width*s.e.devicePixelRatio,G.height*s.e.devicePixelRatio],re=Float32Array.from(G.globeMatrix),Y={useDenormalizedUpVectorScale:!0};{const _e=T.transform,fe=Vn(_e.zoom,S.exaggeration(),S.sourceCache._source.tileSize);B=-1;const se=k.TRIANGLES;for(const Ce of P){const Se=I.getTile(Ce),he=s.ah.disabled,ve=S.prevTerrainTileForTile[Ce.key],ne=S.terrainTileForTile[Ce.key];ta(ve,ne)&&Nn.newMorphing(Ce.key,ve,ne,z,250),L.activeTexture.set(k.TEXTURE0),Se.texture&&Se.texture.bind(k.LINEAR,k.CLAMP_TO_EDGE);const Me=Nn.getMorphValuesForProxy(Ce.key),Ae=Me?1:0;Me&&s.q(Y,{morphing:{srcDemTile:Me.from,dstDemTile:Me.to,phase:s.bb(Me.phase)}});const Ue=s.be(Ce.canonical),Ge=s.bf(Ue.getCenter().lat),He=s.bg(Ce.canonical,Ue,Ge,_e.worldSize/_e._pixelsPerMercatorPixel),$e=s.bh(s.bi(Ce.canonical)),it=Vc(_e.expandedFarZProjMatrix,re,W,$e,s.a2(_e.zoom),ee,_e.frustumCorners.TL,_e.frustumCorners.TR,_e.frustumCorners.BR,_e.frustumCorners.BL,_e.globeCenterInViewSpace,_e.globeRadius,ue,fe,_e._farZ,He);if(j(Ce,Ae),O&&(S.setupElevationDraw(Se,O,Y),T.uploadCommonUniforms(L,O,Ce.toUnwrapped()),ie)){const[_t,nt,xt]=ie.getGridBuffers(Ge,fe!==0);O.draw(T,se,Z,he,J,s.ag.backCCW,it,"globe_raster",_t,nt,xt)}}}if(ie&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const _e=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];$&&_e.push("CUSTOM_ANTIALIASING"),O=T.getOrCreateProgram("globeRaster",{defines:_e});for(const fe of P){const{x:se,y:Ce,z:Se}=fe.canonical,he=Ce===0,ve=Ce===(1<_t.draw(T,k.TRIANGLES,Z,s.ah.disabled,J,s.ag.disabled,Vc(G.expandedFarZProjMatrix,He,He,$e,0,ee,G.frustumCorners.TL,G.frustumCorners.TR,G.frustumCorners.BR,G.frustumCorners.BL,G.globeCenterInViewSpace,G.globeRadius,ue,0,G._farZ),"globe_pole_raster",nt,Ae,Ue);S.setupElevationDraw(Ge,O,Y),T.uploadCommonUniforms(L,O,fe.toUnwrapped()),he&&T.renderDefaultNorthPole&&it(O,ne),ve&&T.renderDefaultSouthPole&&(He=s.ae.scale(s.ae.create(),He,[1,-1,1]),it(O,Me))}}}})(p,m,g,x,w);else{const T=p.context,S=T.gl;let I,P;const z=p.shadowRenderer,L=ar(p,p.longestCutoffRange),k=J=>{if(P===J)return;const Z=[];Z.push(ia[J]),L.shouldRenderCutoff&&Z.push("RENDER_CUTOFF"),I=p.getOrCreateProgram("terrainRaster",{defines:Z}),P=J},O=p.colorModeForRenderPass(),B=new s.af(S.LEQUAL,s.af.ReadWrite,p.depthRangeFor3D);Nn.update(w);const G=p.transform,$=Vn(G.zoom,m.exaggeration(),m.sourceCache._source.tileSize);let j=[0,0,0];if(z){const J=p.style.directionalLight,Z=p.style.ambientLight;J&&Z&&(j=ea(p.style,J,Z))}{P=-1;const J=S.TRIANGLES,[Z,W]=[m.gridIndexBuffer,m.gridSegments];for(const ee of x){const ie=g.getTile(ee),ue=s.ah.disabled,re=m.prevTerrainTileForTile[ee.key],Y=m.terrainTileForTile[ee.key];ta(re,Y)&&Nn.newMorphing(ee.key,re,Y,w,250),T.activeTexture.set(S.TEXTURE0),ie.texture&&ie.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const _e=Nn.getMorphValuesForProxy(ee.key),fe=_e?1:0;let se;_e&&(se={morphing:{srcDemTile:_e.from,dstDemTile:_e.to,phase:s.bb(_e.phase)}});const Ce=vh(ee.projMatrix,ra(ee.canonical,G.renderWorldCopies)?$/10:$,j);if(k(fe),!I)continue;m.setupElevationDraw(ie,I,se);const Se=ee.toUnwrapped();z&&z.setupShadows(Se,I),p.uploadCommonUniforms(T,I,Se,null,L),I.draw(p,J,B,ue,O,s.ag.backCCW,Ce,"terrain_raster",m.gridBuffer,Z,W)}}}}(a,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,a.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(this._drapedRenderBatches.length===0)return r+1;this.renderingToTexture=!0;const a=this.painter,h=this.painter.context,p=this.proxySourceCache,m=this.proxiedCoords[p.id],g=this._drapedRenderBatches.shift(),x=a.style.order,w=[];let T=0;for(const S of m){const I=p.getTileByID(S.proxyTileKey),P=p.proxyCachedFBO[S.key]?p.proxyCachedFBO[S.key][r]:void 0,z=P!==void 0?p.renderCache[P]:this.pool[T++],L=P!==void 0;if(I.texture=z.tex,L&&!z.dirty){w.push(I.tileID);continue}let k;h.bindFramebuffer.set(z.fb.framebuffer),this.renderedToTile=!1,z.dirty&&(h.clear({color:s.C.transparent,stencil:0}),z.dirty=!1);for(let O=g.start;O<=g.end;++O){const B=a.style._mergedLayers[x[O]];if(B.isHidden(a.transform.zoom))continue;const G=a.style.getLayerSourceCache(B),$=G?this.proxyToSource[S.key][G.id]:[S];if(!$)continue;const j=$;h.viewport.set([0,0,z.fb.width,z.fb.height]),k!==(G?G.id:null)&&(this._setupStencil(z,$,B,G),k=G?G.id:null),a.renderLayer(a,G,B,j)}if(this._drapedRenderBatches.length===0)for(const O of this._pendingGroundEffectLayers){const B=a.style._mergedLayers[x[O]];if(B.isHidden(a.transform.zoom))continue;const G=a.style.getLayerSourceCache(B),$=G?this.proxyToSource[S.key][G.id]:[S];if(!$)continue;const j=$;h.viewport.set([0,0,z.fb.width,z.fb.height]),k!==(G?G.id:null)&&(this._setupStencil(z,$,B,G),k=G?G.id:null),a.renderLayer(a,G,B,j)}this.renderedToTile?(z.dirty=!0,w.push(I.tileID)):L||--T,T===5&&(T=0,this.renderToBackBuffer(w))}return this.renderToBackBuffer(w),this.renderingToTexture=!1,h.bindFramebuffer.set(null),h.viewport.set([0,0,a.width,a.height]),g.end+1}postRender(){}isLayerOrderingCorrect(r){const a=r.order.length;let h=-1,p=a;for(let m=0;mh}getMinElevationBelowMSL(){let r=0;return this._visibleDemTiles.filter(a=>a.dem).forEach(a=>{r=Math.min(r,a.dem.tree.minimums[0])}),r===0?r:(r-30)*this._exaggeration}raycast(r,a,h){if(!this._visibleDemTiles)return null;const p=this._visibleDemTiles.filter(m=>m.dem).map(m=>{const g=m.tileID,x=1<(m.t!==null?m.t:Number.MAX_VALUE)-(g.t!==null?g.t:Number.MAX_VALUE));for(const m of p){if(m.t==null)return null;const g=m.tile.dem.tree.raycast(m.minx,m.miny,m.maxx,m.maxy,r,a,h);if(g!=null)return g}return null}_createFBO(){const r=this.painter.context,a=r.gl,h=this.drapeBufferSize;r.activeTexture.set(a.TEXTURE0);const p=new s.T(r,{width:h[0],height:h[1],data:null},a.RGBA);p.bind(a.LINEAR,a.CLAMP_TO_EDGE);const m=r.createFramebuffer(h[0],h[1],!0,null);return m.colorAttachment.set(p.texture),m.depthAttachment=new Ln(r,m.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,h[0],h[1]),this._stencilRef=0,m.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):m.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:m,tex:p,dirty:!1}}_initFBOPool(){for(;this.pool.length{const a=this._style._mergedLayers[r],h=a.isHidden(this.painter.transform.zoom);return a.type==="custom"?!h&&a.shouldRedrape():!h&&a.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(const h of this._style.getSources())if(h instanceof xh){r=!0;break}if(!r)return;const a={};for(let h=0;hw>x.end)||s.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=h}_setupRenderCache(r){const a=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,a.renderCache.length>a.renderCachePool.length){const g=Object.values(a.proxyCachedFBO);a.proxyCachedFBO={};for(let x=0;x=0;g--){const x=h[g];if(a.getTileByID(x.key),a.proxyCachedFBO[x.key]!==void 0){const w=r[x.key],T=this.proxyToSource[x.key];let S=0;for(const I in T){const P=T[I],z=w[I];if(!z||z.length!==P.length||P.some((L,k)=>L!==z[k]||p[I]&&p[I].hasOwnProperty(L.key))){S=-1;break}++S}for(const I in a.proxyCachedFBO[x.key])a.renderCache[a.proxyCachedFBO[x.key][I]].dirty=S<0||S!==Object.values(w).length}}const m=[...this._drapedRenderBatches];m.sort((g,x)=>x.end-x.start-(g.end-g.start));for(const g of m)for(const x of h){if(a.proxyCachedFBO[x.key])continue;let w=a.renderCachePool.pop();w===void 0&&a.renderCache.length<50&&(w=a.renderCache.length,a.renderCache.push(this._createFBO())),w!==void 0&&(a.proxyCachedFBO[x.key]={},a.proxyCachedFBO[x.key][g.start]=w,a.renderCache[w].dirty=!0)}this._tilesDirty={}}_setupStencil(r,a,h,p){if(!p||!this._sourceTilesOverlap[p.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const m=this.painter.context,g=m.gl;if(a.length<=1)return void(this._overlapStencilType=!1);let x;if(h.isTileClipped())x=a.length,this._overlapStencilMode.test={func:g.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(a[0].overscaledZ>a[a.length-1].overscaledZ))return void(this._overlapStencilType=!1);x=1,this._overlapStencilMode.test={func:g.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+x>255&&(m.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=x,this._overlapStencilMode.ref=this._stencilRef,h.isTileClipped()&&this._renderTileClippingMasks(a,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):s.ah.disabled}_renderTileClippingMasks(r,a){const h=this.painter,p=this.painter.context,m=p.gl;h._tileClippingMaskIDs={},p.setColorMode(s.a.disabled),p.setDepthMode(s.af.disabled);const g=h.getOrCreateProgram("clippingMask");for(const x of r){const w=h._tileClippingMaskIDs[x.key]=--a;g.draw(h,m.TRIANGLES,s.af.disabled,new s.ah({func:m.ALWAYS,mask:0},w,255,m.KEEP,m.KEEP,m.REPLACE),s.a.disabled,s.ag.disabled,na(x.projMatrix),"$clipping",h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}}pointCoordinate(r){const a=this.painter.transform;if(r.x<0||r.x>a.width||r.y<0||r.y>a.height)return null;const h=[r.x,r.y,1,1];s.aB.transformMat4(h,h,a.pixelMatrixInverse),s.aB.scale(h,h,1/h[3]),h[0]/=a.worldSize,h[1]/=a.worldSize;const p=a._camera.position,m=s.ay(1,a.center.lat),g=[p[0],p[1],p[2]/m,0],x=s.$.subtract([],h.slice(0,3),g);s.$.normalize(x,x);const w=this.raycast(g,x,this._exaggeration);return w!==null&&w?(s.$.scaleAndAdd(g,g,x,w),g[3]=g[2],g[2]*=m,g):null}_setupProxiedCoordsForOrtho(r,a,h){if(r.getSource()instanceof s.bo)return this._setupProxiedCoordsForImageSource(r,a,h);this._findCoveringTileCache[r.id]=this._findCoveringTileCache[r.id]||{};const p=this.proxiedCoords[r.id]=[],m=this.proxyCoords;for(let w=0;wS.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(r,a,h){if(!r.getSource().loaded())return;const p=this.proxiedCoords[r.id]=[],m=this.proxyCoords,g=r.getSource(),x=g.tileID;if(!x)return;const w=new s.P(x.x,x.y)._div(1<(I.min.x=Math.min(I.min.x,P.x-w.x),I.min.y=Math.min(I.min.y,P.y-w.y),I.max.x=Math.max(I.max.x,P.x-w.x),I.max.y=Math.max(I.max.y,P.y-w.y),I),{min:new s.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),S=(I,P)=>{const z=I.wrap+I.canonical.x/(1<O+T.max.x||L+kB+T.max.y};for(let I=0;Ig.key===a.tileID.key);if(m)return m}if(a.tileID.key!==r.key){const m=r.canonical.z-a.tileID.canonical.z;let g,x,w;p=s.ae.create();const T=a.tileID.wrap-r.wrap<0?(g=s.a4>>m,x=g*((a.tileID.canonical.x<=I){const P=r.canonical.z-I;a.getSource().reparseOverscaled?(x=Math.max(r.canonical.z+2,a.transform.tileZoom),g=new s.aQ(x,r.wrap,I,r.canonical.x>>P,r.canonical.y>>P)):P!==0&&(x=I,g=new s.aQ(x,r.wrap,I,r.canonical.x>>P,r.canonical.y>>P))}g.key!==r.key&&(T.push(g.key),h=a.getTile(g))}const S=I=>{T.forEach(P=>{p[P]=I}),T.length=0};for(x-=1;x>=w&&(!h||!h.hasData());x--){h&&S(h.tileID.key);const I=g.calculateScaledKey(x);if(h=a.getTileByID(I),h&&h.hasData())break;const P=p[I];if(P===null)break;P===void 0?T.push(I):h=a.getTileByID(P)}return S(h?h.tileID.key:null),h&&h.hasData()?h:null}findDEMTileFor(r){return this.enabled?this._findTileCoveringTileID(r,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(r,a){let h=this._tilesDirty[r];h||(h=this._tilesDirty[r]={}),h[a.key]=!0}}function Sh(u,r,a){const h=function(x,w,T){const S=s.$.dot(w,x),I=s.$.dot(T,[.2126,.7152,.0722]),P=(L,k,O)=>(1-O)*L+O*k,z=P(1-.3*Math.min(I,1),1,Math.min(S+1,1));return P(.92,1,Math.asin(s.au(w[2],-1,1))/Math.PI+.5)*z}(u,[0,0,1],r),p=[0,0,0];s.$.scale(p,a.slice(0,3),h);const m=[0,0,0];s.$.scale(m,r.slice(0,3),u[2]);const g=[0,0,0];return s.$.add(g,p,m),s.ba(g)}const Zc=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Mh=["stars","fillExtrusion","fillExtrusionGroundEffect","model","symbolSDF","symbolIcon","symbolTextAndIcon"];class Wc{static cacheKey(r,a,h,p){let m=`${a}${p?p.cacheKey:""}`;for(const g of h)r.usedDefines.includes(g)&&(m+=`/${g}`);return m}constructor(r,a,h,p,m,g){const x=r.gl;this.program=x.createProgram(),this.configuration=p,this.name=a,this.fixedDefines=[...g];const w=p?p.getBinderAttributes():[],T=(h.staticAttributes||[]).concat(w);let S=p?p.defines():[];S=S.concat(g.map(O=>`#define ${O}`));const I=`#version 300 es -`;let P=I+S.concat("precision mediump float;",_h,ml.fragmentSource).join(` -`);for(const O of h.fragmentIncludes)P+=` -${Ws[O]}`;P+=` -${h.fragmentSource}`;let z=I+S.concat("precision highp float;",_h,ml.vertexSource).join(` -`);for(const O of h.vertexIncludes)z+=` -${Ws[O]}`;z+=` -${h.vertexSource}`;const L=x.createShader(x.FRAGMENT_SHADER);if(x.isContextLost())return void(this.failedToCreate=!0);x.shaderSource(L,P),x.compileShader(L),x.attachShader(this.program,L);const k=x.createShader(x.VERTEX_SHADER);if(x.isContextLost())this.failedToCreate=!0;else{x.shaderSource(k,z),x.compileShader(k),x.attachShader(this.program,k),this.attributes={},this.numAttributes=T.length;for(let O=0;O({u_dem:new s.a8(O),u_dem_prev:new s.a8(O),u_dem_tl:new s.a9(O),u_dem_scale:new s.ab(O),u_dem_tl_prev:new s.a9(O),u_dem_scale_prev:new s.ab(O),u_dem_size:new s.ab(O),u_dem_lerp:new s.ab(O),u_exaggeration:new s.ab(O),u_depth:new s.a8(O),u_depth_size_inv:new s.a9(O),u_depth_range_unpack:new s.a9(O),u_occluder_half_size:new s.ab(O),u_occlusion_depth_offset:new s.ab(O),u_meter_to_dem:new s.ab(O),u_label_plane_matrix_inv:new s.a7(O)}))(r)),g.includes("GLOBE")&&(this.globeUniforms=(O=>({u_tile_tl_up:new s.ar(O),u_tile_tr_up:new s.ar(O),u_tile_br_up:new s.ar(O),u_tile_bl_up:new s.ar(O),u_tile_up_scale:new s.ab(O)}))(r)),g.includes("FOG")&&(this.fogUniforms=(O=>({u_fog_matrix:new s.a7(O),u_fog_range:new s.a9(O),u_fog_color:new s.at(O),u_fog_horizon_blend:new s.ab(O),u_fog_vertical_limit:new s.a9(O),u_fog_temporal_offset:new s.ab(O),u_frustum_tl:new s.ar(O),u_frustum_tr:new s.ar(O),u_frustum_br:new s.ar(O),u_frustum_bl:new s.ar(O),u_globe_pos:new s.ar(O),u_globe_radius:new s.ab(O),u_globe_transition:new s.ab(O),u_is_globe:new s.a8(O),u_viewport:new s.a9(O)}))(r)),g.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(O=>({u_cutoff_params:new s.at(O)}))(r)),g.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(O=>({u_lighting_ambient_color:new s.ar(O),u_lighting_directional_dir:new s.ar(O),u_lighting_directional_color:new s.ar(O),u_ground_radiance:new s.ar(O)}))(r)),g.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(O=>({u_light_matrix_0:new s.a7(O),u_light_matrix_1:new s.a7(O),u_fade_range:new s.a9(O),u_shadow_normal_offset:new s.ar(O),u_shadow_intensity:new s.ab(O),u_shadow_texel_size:new s.ab(O),u_shadow_map_resolution:new s.ab(O),u_shadow_direction:new s.ar(O),u_shadow_bias:new s.ar(O),u_shadowmap_0:new s.a8(O),u_shadowmap_1:new s.a8(O)}))(r))}}setTerrainUniformValues(r,a){if(!this.terrainUniforms)return;const h=this.terrainUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const p in a)h[p]&&h[p].set(this.program,p,a[p])}}setGlobeUniformValues(r,a){if(!this.globeUniforms)return;const h=this.globeUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const p in a)h[p]&&h[p].set(this.program,p,a[p])}}setFogUniformValues(r,a){if(!this.fogUniforms)return;const h=this.fogUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const p in a)h[p].set(this.program,p,a[p])}}setCutoffUniformValues(r,a){if(!this.cutoffUniforms)return;const h=this.cutoffUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const p in a)h[p].set(this.program,p,a[p])}}setLightsUniformValues(r,a){if(!this.lightsUniforms)return;const h=this.lightsUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const p in a)h[p].set(this.program,p,a[p])}}setShadowUniformValues(r,a){if(this.failedToCreate||!this.shadowUniforms)return;const h=this.shadowUniforms;r.program.set(this.program);for(const p in a)h[p].set(this.program,p,a[p])}_drawDebugWireframe(r,a,h,p,m,g,x,w,T,S){const I=r.options.wireframe;if(I.terrain===!1&&I.layers2D===!1&&I.layers3D===!1)return;const P=r.context;if(!(!(!I.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!I.layers2D||r._terrain&&r._terrain.renderingToTexture||!Zc.includes(this.name))||!(!I.layers3D||!Mh.includes(this.name))))return;const z=P.gl,L=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,m,P);if(!L)return;const k=[...this.fixedDefines];k.push("DEBUG_WIREFRAME");const O=r.getOrCreateProgram(this.name,{config:this.configuration,defines:k});P.program.set(O.program);const B=(j,J,Z)=>{if(J[j]&&Z[j])for(const W in J[j])Z[j][W]&&Z[j][W].set(Z.program,W,J[j][W].current)};T&&T.setUniforms(O.program,P,O.binderUniforms,x,{zoom:w}),B("fixedUniforms",this,O),B("terrainUniforms",this,O),B("globeUniforms",this,O),B("fogUniforms",this,O),B("lightsUniforms",this,O),B("shadowUniforms",this,O),L.bind(),P.setColorMode(new s.a([z.ONE,z.ONE_MINUS_SRC_ALPHA,z.ZERO,z.ONE],s.C.transparent,[!0,!0,!0,!1])),P.setDepthMode(new s.af(a.func===z.LESS?z.LEQUAL:a.func,s.af.ReadOnly,a.range)),P.setStencilMode(s.ah.disabled);const G=3*g.primitiveLength*2,$=3*g.primitiveOffset*2*2;S&&S>1?z.drawElementsInstanced(z.LINES,G,z.UNSIGNED_SHORT,$,S):z.drawElements(z.LINES,G,z.UNSIGNED_SHORT,$),m.bind(),P.program.set(this.program),P.setDepthMode(a),P.setStencilMode(h),P.setColorMode(p)}draw(r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O){const B=r.context,G=B.gl;if(this.failedToCreate)return;B.program.set(this.program),B.setDepthMode(h),B.setStencilMode(p),B.setColorMode(m),B.setCullFace(g);for(const J of Object.keys(this.fixedUniforms))this.fixedUniforms[J].set(this.program,J,x[J]);L&&L.setUniforms(this.program,B,this.binderUniforms,P,{zoom:z});const $={[G.POINTS]:1,[G.LINES]:2,[G.TRIANGLES]:3,[G.LINE_STRIP]:1}[a],j=O&&O>0?1:void 0;for(const J of I.get()){const Z=J.vaos||(J.vaos={});(Z[w]||(Z[w]=new vp)).bind(B,this,T,L?L.getPaintVertexBuffers():[],S,J.vertexOffset,k||[],j),O&&O>1?G.drawElementsInstanced(a,J.primitiveLength*$,G.UNSIGNED_SHORT,J.primitiveOffset*$*2,O):S?G.drawElements(a,J.primitiveLength*$,G.UNSIGNED_SHORT,J.primitiveOffset*$*2):G.drawArrays(a,J.vertexOffset,J.vertexLength),a===G.TRIANGLES&&S&&this._drawDebugWireframe(r,h,p,m,S,J,P,z,L,O)}}}function Hc(u,r){const a=Math.pow(2,r.tileID.overscaledZ),h=r.tileSize*Math.pow(2,u.transform.tileZoom)/a,p=h*(r.tileID.canonical.x+r.tileID.wrap*a),m=h*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/s.bD(r,1,u.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[65535&p,65535&m]}}const Ih=s.ae.create(),Kr=(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B)=>{const G=r.style.light,$=G.properties.get("position"),j=[$.x,$.y,$.z],J=s.bE.create();G.properties.get("anchor")==="viewport"&&(s.bE.fromRotation(J,-r.transform.angle),s.$.transformMat3(j,j,J));const Z=G.properties.get("color"),W=r.transform,ee={u_matrix:u,u_lightpos:j,u_lightintensity:G.properties.get("intensity"),u_lightcolor:[Z.r,Z.g,Z.b],u_vertical_gradient:+a,u_opacity:h,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Ih,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:p,u_edge_radius:m,u_alignment:g,u_width_scale:x,u_flood_light_color:z,u_vertical_scale:L,u_flood_light_intensity:k,u_ground_shadow_factor:O,u_emissive_strength:B};return W.projection.name==="globe"&&(ee.u_tile_id=[w.canonical.x,w.canonical.y,1<({u_matrix:u,u_edge_radius:r,u_alignment:a,u_width_scale:h,u_vertical_scale:p}),Ah=(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k)=>{const O=Kr(u,r,a,h,p,m,g,x,w,S,I,P,z,L,k,1,[0,0,0],0),B={u_height_factor:-Math.pow(2,w.overscaledZ)/T.tileSize/8};return s.Q(O,Hc(r,T),B)},oa=(u,r)=>({u_matrix:u,u_emissive_strength:r}),El=(u,r,a,h)=>s.Q(oa(u,r),Hc(a,h)),Sl=(u,r,a)=>({u_matrix:u,u_world:a,u_emissive_strength:r}),sa=(u,r,a,h,p)=>s.Q(El(u,r,a,h),{u_world:p}),ts=(u,r,a,h)=>{const p=s.a4/a.tileSize;return{u_matrix:u,u_camera_to_center_distance:r.getCameraToCenterDistance(h),u_extrude_scale:[r.pixelsToGLUnits[0]/p,r.pixelsToGLUnits[1]/p]}},Ml=(u,r,a=1)=>({u_matrix:u,u_color:r.toRenderColor(null),u_overlay:0,u_overlay_scale:a}),Ch=s.ae.create(),Ph=(u,r,a,h,p,m,g)=>{const x=u.transform,w=x.projection.name==="globe",T=w?s.bF(x.zoom,r.canonical)*x._pixelsPerMercatorPixel:s.bD(a,1,m),S={u_matrix:r.projMatrix,u_extrude_scale:T,u_intensity:g,u_inv_rot_matrix:Ch,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(w){S.u_inv_rot_matrix=h,S.u_merc_center=p,S.u_tile_id=[r.canonical.x,r.canonical.y,1<({u_matrix:u,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:h,u_grid_matrix:p,u_tl_parent:m,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity*I.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:I.paint.get("raster-brightness-min"),u_brightness_high:I.paint.get("raster-brightness-max"),u_saturation_factor:s.bG(I.paint.get("raster-saturation")),u_contrast_factor:s.bH(I.paint.get("raster-contrast")),u_spin_weights:Yc(I.paint.get("raster-hue-rotate")),u_perspective_transform:P,u_raster_elevation:z,u_zoom_transition:g,u_merc_center:x,u_cutoff_params:w,u_colorization_mix:Xc(s.bI,k,B),u_colorization_offset:aa(s.bI,O,B),u_color_ramp:L,u_texture_offset:[$/(G+2*$),G/(G+2*$)],u_texture_res:[G+2*$,G+2*$],u_emissive_strength:j});function Yc(u){u*=Math.PI/180;const r=Math.sin(u),a=Math.cos(u);return[(2*a+1)/3,(-Math.sqrt(3)*r-a+1)/3,(Math.sqrt(3)*r-a+1)/3]}const Qr=.05,uo=(u,r,a,h,p,m,g,x,w,T,S,I)=>({u_matrix:u,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:h,u_grid_matrix:p,u_tl_parent:m,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity,u_image0:0,u_image1:1,u_raster_elevation:I,u_zoom_transition:g,u_merc_center:x,u_cutoff_params:w}),Sp=(u,r,a,h,p,m,g,x,w,T)=>({u_particle_texture:u,u_particle_texture_side_len:r,u_tile_offset:a,u_velocity:h,u_color_ramp:m,u_velocity_res:p,u_max_speed:g,u_uv_offset:x,u_data_scale:[255*w[0],255*w[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Qr,Qr]}),zh=(u,r,a,h,p,m,g,x,w,T)=>({u_particle_texture:u,u_particle_texture_side_len:r,u_velocity:a,u_velocity_res:h,u_max_speed:p,u_speed_factor:m,u_reset_rate:g,u_rand_seed:Math.random(),u_uv_offset:x,u_data_scale:[255*w[0],255*w[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Qr,Qr]}),la=s.ae.create(),is=(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B)=>{const G=p.transform,$={u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:G.getCameraToCenterDistance(k),u_rotate_symbol:+a,u_aspect_ratio:G.width/G.height,u_fade_change:p.options.fadeDuration?p.symbolFadeChange:1,u_matrix:m,u_label_plane_matrix:g,u_coord_matrix:x,u_is_text:+w,u_pitch_with_map:+h,u_texsize:T,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:la,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:la,u_up_vector:[0,-1,0],u_color_adj_mat:O,u_icon_transition:B||0};return k.name==="globe"&&($.u_tile_id=[S.canonical.x,S.canonical.y,1<s.Q(is(u,r,a,h,p,m,g,x,w,T,I,P,z,L,k,O),{u_gamma_scale:h?p.transform.getCameraToCenterDistance(O)*Math.cos(p.terrain?0:p.transform._pitch):1,u_device_pixel_ratio:s.e.devicePixelRatio,u_is_halo:+S,undefined:void 0}),Jc=(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k)=>s.Q(ca(u,r,a,h,p,m,g,x,!0,w,!0,S,I,P,z,L,k),{u_texsize_icon:T,u_texture_icon:1}),Kc=(u,r,a,h)=>({u_matrix:u,u_emissive_strength:r,u_opacity:a,u_color:h}),Mp=(u,r,a,h,p,m,g,x)=>s.Q(function(w,T,S,I,P){const{width:z,height:L}=I.imageManager.getPixelSize(T),k=Math.pow(2,P.tileID.overscaledZ),O=P.tileSize*Math.pow(2,I.transform.tileZoom)/k,B=O*(P.tileID.canonical.x+P.tileID.wrap*k),G=O*P.tileID.canonical.y;return{u_image:0,u_pattern_tl:S.tl,u_pattern_br:S.br,u_texsize:[z,L],u_pattern_size:S.displaySize,u_tile_units_to_pixels:1/s.bD(P,1,I.transform.tileZoom),u_pixel_coord_upper:[B>>16,G>>16],u_pixel_coord_lower:[65535&B,65535&G]}}(0,m,g,h,x),{u_matrix:u,u_emissive_strength:r,u_opacity:a}),Dr=new Float32Array(s.ae.identity([])),ho=(u,r,a,h,p,m,g,x,w,T,S,I,P,z=[0,0,0],L)=>{const k=p.style.light,O=k.properties.get("position"),B=[-O.x,-O.y,O.z],G=s.bE.create();k.properties.get("anchor")==="viewport"&&(s.bE.fromRotation(G,-p.transform.angle),s.$.transformMat3(B,B,G));const $=S.alphaMode==="MASK",j=k.properties.get("color").toRenderColor(null),J=P.paint.get("model-ambient-occlusion-intensity"),Z=P.paint.get("model-color").constantOr(s.C.white).toRenderColor(null),W=P.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:u,u_lighting_matrix:r,u_normal_matrix:a,u_node_matrix:h||Dr,u_lightpos:B,u_lightintensity:k.properties.get("intensity"),u_lightcolor:[j.r,j.g,j.b],u_camera_pos:z,u_opacity:m,u_baseTextureIsAlpha:0,u_alphaMask:+$,u_alphaCutoff:S.alphaCutoff,u_baseColorFactor:[g.r,g.g,g.b,g.a],u_emissiveFactor:[x[0],x[1],x[2],1],u_metallicFactor:w,u_roughnessFactor:T,u_baseColorTexture:$i.BaseColor,u_metallicRoughnessTexture:$i.MetallicRoughness,u_normalTexture:$i.Normal,u_occlusionTexture:$i.Occlusion,u_emissionTexture:$i.Emission,u_lutTexture:$i.LUT,u_color_mix:[Z.r,Z.g,Z.b,W],u_aoIntensity:J,u_emissive_strength:I,u_occlusionTextureTransform:L||[0,0,0,0]}},Qc=(u,r=Dr,a=Dr)=>({u_matrix:u,u_instance:r,u_node_matrix:a}),Dh={fillExtrusion:u=>({u_matrix:new s.a7(u),u_lightpos:new s.ar(u),u_lightintensity:new s.ab(u),u_lightcolor:new s.ar(u),u_vertical_gradient:new s.ab(u),u_opacity:new s.ab(u),u_edge_radius:new s.ab(u),u_alignment:new s.ab(u),u_width_scale:new s.ab(u),u_ao:new s.a9(u),u_tile_id:new s.ar(u),u_zoom_transition:new s.ab(u),u_inv_rot_matrix:new s.a7(u),u_merc_center:new s.a9(u),u_up_dir:new s.ar(u),u_height_lift:new s.ab(u),u_flood_light_color:new s.ar(u),u_vertical_scale:new s.ab(u),u_flood_light_intensity:new s.ab(u),u_ground_shadow_factor:new s.ar(u),u_emissive_strength:new s.ab(u)}),fillExtrusionDepth:u=>({u_matrix:new s.a7(u),u_edge_radius:new s.ab(u),u_alignment:new s.ab(u),u_width_scale:new s.ab(u),u_vertical_scale:new s.ab(u)}),fillExtrusionPattern:u=>({u_matrix:new s.a7(u),u_lightpos:new s.ar(u),u_lightintensity:new s.ab(u),u_lightcolor:new s.ar(u),u_vertical_gradient:new s.ab(u),u_height_factor:new s.ab(u),u_edge_radius:new s.ab(u),u_alignment:new s.ab(u),u_width_scale:new s.ab(u),u_ao:new s.a9(u),u_tile_id:new s.ar(u),u_zoom_transition:new s.ab(u),u_inv_rot_matrix:new s.a7(u),u_merc_center:new s.a9(u),u_up_dir:new s.ar(u),u_height_lift:new s.ab(u),u_image:new s.a8(u),u_texsize:new s.a9(u),u_pixel_coord_upper:new s.a9(u),u_pixel_coord_lower:new s.a9(u),u_tile_units_to_pixels:new s.ab(u),u_opacity:new s.ab(u)}),fillExtrusionGroundEffect:u=>({u_matrix:new s.a7(u),u_opacity:new s.ab(u),u_ao_pass:new s.ab(u),u_meter_to_tile:new s.ab(u),u_ao:new s.a9(u),u_flood_light_intensity:new s.ab(u),u_flood_light_color:new s.ar(u),u_attenuation:new s.ab(u),u_edge_radius:new s.ab(u),u_fb:new s.a8(u),u_fb_size:new s.ab(u)}),fill:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u)}),fillPattern:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u),u_image:new s.a8(u),u_texsize:new s.a9(u),u_pixel_coord_upper:new s.a9(u),u_pixel_coord_lower:new s.a9(u),u_tile_units_to_pixels:new s.ab(u)}),fillOutline:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u),u_world:new s.a9(u)}),fillOutlinePattern:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u),u_world:new s.a9(u),u_image:new s.a8(u),u_texsize:new s.a9(u),u_pixel_coord_upper:new s.a9(u),u_pixel_coord_lower:new s.a9(u),u_tile_units_to_pixels:new s.ab(u)}),circle:s.bK,collisionBox:u=>({u_matrix:new s.a7(u),u_camera_to_center_distance:new s.ab(u),u_extrude_scale:new s.a9(u)}),collisionCircle:u=>({u_matrix:new s.a7(u),u_inv_matrix:new s.a7(u),u_camera_to_center_distance:new s.ab(u),u_viewport_size:new s.a9(u)}),debug:u=>({u_color:new s.aa(u),u_matrix:new s.a7(u),u_overlay:new s.a8(u),u_overlay_scale:new s.ab(u)}),clippingMask:u=>({u_matrix:new s.a7(u)}),heatmap:u=>({u_extrude_scale:new s.ab(u),u_intensity:new s.ab(u),u_matrix:new s.a7(u),u_inv_rot_matrix:new s.a7(u),u_merc_center:new s.a9(u),u_tile_id:new s.ar(u),u_zoom_transition:new s.ab(u),u_up_dir:new s.ar(u)}),heatmapTexture:u=>({u_image:new s.a8(u),u_color_ramp:new s.a8(u),u_opacity:new s.ab(u)}),hillshade:u=>({u_matrix:new s.a7(u),u_image:new s.a8(u),u_latrange:new s.a9(u),u_light:new s.a9(u),u_shadow:new s.aa(u),u_highlight:new s.aa(u),u_emissive_strength:new s.ab(u),u_accent:new s.aa(u)}),hillshadePrepare:u=>({u_matrix:new s.a7(u),u_image:new s.a8(u),u_dimension:new s.a9(u),u_zoom:new s.ab(u)}),line:s.bL,linePattern:s.bM,raster:u=>({u_matrix:new s.a7(u),u_normalize_matrix:new s.a7(u),u_globe_matrix:new s.a7(u),u_merc_matrix:new s.a7(u),u_grid_matrix:new s.as(u),u_tl_parent:new s.a9(u),u_scale_parent:new s.ab(u),u_fade_t:new s.ab(u),u_opacity:new s.ab(u),u_image0:new s.a8(u),u_image1:new s.a8(u),u_brightness_low:new s.ab(u),u_brightness_high:new s.ab(u),u_saturation_factor:new s.ab(u),u_contrast_factor:new s.ab(u),u_spin_weights:new s.ar(u),u_perspective_transform:new s.a9(u),u_raster_elevation:new s.ab(u),u_zoom_transition:new s.ab(u),u_merc_center:new s.a9(u),u_cutoff_params:new s.at(u),u_colorization_mix:new s.at(u),u_colorization_offset:new s.ab(u),u_color_ramp:new s.a8(u),u_texture_offset:new s.a9(u),u_texture_res:new s.a9(u),u_emissive_strength:new s.ab(u)}),rasterParticle:u=>({u_matrix:new s.a7(u),u_normalize_matrix:new s.a7(u),u_globe_matrix:new s.a7(u),u_merc_matrix:new s.a7(u),u_grid_matrix:new s.as(u),u_tl_parent:new s.a9(u),u_scale_parent:new s.ab(u),u_fade_t:new s.ab(u),u_opacity:new s.ab(u),u_image0:new s.a8(u),u_image1:new s.a8(u),u_raster_elevation:new s.ab(u),u_zoom_transition:new s.ab(u),u_merc_center:new s.a9(u),u_cutoff_params:new s.at(u)}),rasterParticleTexture:u=>({u_texture:new s.a8(u),u_opacity:new s.ab(u)}),rasterParticleDraw:u=>({u_particle_texture:new s.a8(u),u_particle_texture_side_len:new s.ab(u),u_tile_offset:new s.a9(u),u_velocity:new s.a8(u),u_color_ramp:new s.a8(u),u_velocity_res:new s.a9(u),u_max_speed:new s.ab(u),u_uv_offset:new s.a9(u),u_data_scale:new s.a9(u),u_data_offset:new s.ab(u),u_particle_pos_scale:new s.ab(u),u_particle_pos_offset:new s.a9(u)}),rasterParticleUpdate:u=>({u_particle_texture:new s.a8(u),u_particle_texture_side_len:new s.ab(u),u_velocity:new s.a8(u),u_velocity_res:new s.a9(u),u_max_speed:new s.ab(u),u_speed_factor:new s.ab(u),u_reset_rate:new s.ab(u),u_rand_seed:new s.ab(u),u_uv_offset:new s.a9(u),u_data_scale:new s.a9(u),u_data_offset:new s.ab(u),u_particle_pos_scale:new s.ab(u),u_particle_pos_offset:new s.a9(u)}),symbolIcon:u=>({u_is_size_zoom_constant:new s.a8(u),u_is_size_feature_constant:new s.a8(u),u_size_t:new s.ab(u),u_size:new s.ab(u),u_camera_to_center_distance:new s.ab(u),u_rotate_symbol:new s.a8(u),u_aspect_ratio:new s.ab(u),u_fade_change:new s.ab(u),u_matrix:new s.a7(u),u_label_plane_matrix:new s.a7(u),u_coord_matrix:new s.a7(u),u_is_text:new s.a8(u),u_pitch_with_map:new s.a8(u),u_texsize:new s.a9(u),u_tile_id:new s.ar(u),u_zoom_transition:new s.ab(u),u_inv_rot_matrix:new s.a7(u),u_merc_center:new s.a9(u),u_camera_forward:new s.ar(u),u_tile_matrix:new s.a7(u),u_up_vector:new s.ar(u),u_ecef_origin:new s.ar(u),u_texture:new s.a8(u),u_icon_transition:new s.ab(u),u_color_adj_mat:new s.a7(u)}),symbolSDF:u=>({u_is_size_zoom_constant:new s.a8(u),u_is_size_feature_constant:new s.a8(u),u_size_t:new s.ab(u),u_size:new s.ab(u),u_camera_to_center_distance:new s.ab(u),u_rotate_symbol:new s.a8(u),u_aspect_ratio:new s.ab(u),u_fade_change:new s.ab(u),u_matrix:new s.a7(u),u_label_plane_matrix:new s.a7(u),u_coord_matrix:new s.a7(u),u_is_text:new s.a8(u),u_pitch_with_map:new s.a8(u),u_texsize:new s.a9(u),u_texture:new s.a8(u),u_gamma_scale:new s.ab(u),u_device_pixel_ratio:new s.ab(u),u_tile_id:new s.ar(u),u_zoom_transition:new s.ab(u),u_inv_rot_matrix:new s.a7(u),u_merc_center:new s.a9(u),u_camera_forward:new s.ar(u),u_tile_matrix:new s.a7(u),u_up_vector:new s.ar(u),u_ecef_origin:new s.ar(u),u_is_halo:new s.a8(u)}),symbolTextAndIcon:u=>({u_is_size_zoom_constant:new s.a8(u),u_is_size_feature_constant:new s.a8(u),u_size_t:new s.ab(u),u_size:new s.ab(u),u_camera_to_center_distance:new s.ab(u),u_rotate_symbol:new s.a8(u),u_aspect_ratio:new s.ab(u),u_fade_change:new s.ab(u),u_matrix:new s.a7(u),u_label_plane_matrix:new s.a7(u),u_coord_matrix:new s.a7(u),u_is_text:new s.a8(u),u_pitch_with_map:new s.a8(u),u_texsize:new s.a9(u),u_texsize_icon:new s.a9(u),u_texture:new s.a8(u),u_texture_icon:new s.a8(u),u_gamma_scale:new s.ab(u),u_device_pixel_ratio:new s.ab(u),u_is_halo:new s.a8(u)}),background:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u),u_opacity:new s.ab(u),u_color:new s.aa(u)}),backgroundPattern:u=>({u_matrix:new s.a7(u),u_emissive_strength:new s.ab(u),u_opacity:new s.ab(u),u_image:new s.a8(u),u_pattern_tl:new s.a9(u),u_pattern_br:new s.a9(u),u_texsize:new s.a9(u),u_pattern_size:new s.a9(u),u_pixel_coord_upper:new s.a9(u),u_pixel_coord_lower:new s.a9(u),u_tile_units_to_pixels:new s.ab(u)}),terrainRaster:u=>({u_matrix:new s.a7(u),u_image0:new s.a8(u),u_skirt_height:new s.ab(u),u_ground_shadow_factor:new s.ar(u)}),skybox:u=>({u_matrix:new s.a7(u),u_sun_direction:new s.ar(u),u_cubemap:new s.a8(u),u_opacity:new s.ab(u),u_temporal_offset:new s.ab(u)}),skyboxGradient:u=>({u_matrix:new s.a7(u),u_color_ramp:new s.a8(u),u_center_direction:new s.ar(u),u_radius:new s.ab(u),u_opacity:new s.ab(u),u_temporal_offset:new s.ab(u)}),skyboxCapture:u=>({u_matrix_3f:new s.as(u),u_sun_direction:new s.ar(u),u_sun_intensity:new s.ab(u),u_color_tint_r:new s.at(u),u_color_tint_m:new s.at(u),u_luminance:new s.ab(u)}),globeRaster:u=>({u_proj_matrix:new s.a7(u),u_globe_matrix:new s.a7(u),u_normalize_matrix:new s.a7(u),u_merc_matrix:new s.a7(u),u_zoom_transition:new s.ab(u),u_merc_center:new s.a9(u),u_image0:new s.a8(u),u_grid_matrix:new s.as(u),u_skirt_height:new s.ab(u),u_far_z_cutoff:new s.ab(u),u_frustum_tl:new s.ar(u),u_frustum_tr:new s.ar(u),u_frustum_br:new s.ar(u),u_frustum_bl:new s.ar(u),u_globe_pos:new s.ar(u),u_globe_radius:new s.ab(u),u_viewport:new s.a9(u)}),globeAtmosphere:u=>({u_frustum_tl:new s.ar(u),u_frustum_tr:new s.ar(u),u_frustum_br:new s.ar(u),u_frustum_bl:new s.ar(u),u_horizon:new s.ab(u),u_transition:new s.ab(u),u_fadeout_range:new s.ab(u),u_color:new s.at(u),u_high_color:new s.at(u),u_space_color:new s.at(u),u_temporal_offset:new s.ab(u),u_horizon_angle:new s.ab(u)}),model:u=>({u_matrix:new s.a7(u),u_lighting_matrix:new s.a7(u),u_normal_matrix:new s.a7(u),u_node_matrix:new s.a7(u),u_lightpos:new s.ar(u),u_lightintensity:new s.ab(u),u_lightcolor:new s.ar(u),u_camera_pos:new s.ar(u),u_opacity:new s.ab(u),u_baseColorFactor:new s.at(u),u_emissiveFactor:new s.at(u),u_metallicFactor:new s.ab(u),u_roughnessFactor:new s.ab(u),u_baseTextureIsAlpha:new s.a8(u),u_alphaMask:new s.a8(u),u_alphaCutoff:new s.ab(u),u_baseColorTexture:new s.a8(u),u_metallicRoughnessTexture:new s.a8(u),u_normalTexture:new s.a8(u),u_occlusionTexture:new s.a8(u),u_emissionTexture:new s.a8(u),u_lutTexture:new s.a8(u),u_color_mix:new s.at(u),u_aoIntensity:new s.ab(u),u_emissive_strength:new s.ab(u),u_occlusionTextureTransform:new s.at(u)}),modelDepth:u=>({u_matrix:new s.a7(u),u_instance:new s.a7(u),u_node_matrix:new s.a7(u)}),groundShadow:u=>({u_matrix:new s.a7(u),u_ground_shadow_factor:new s.ar(u)}),stars:u=>({u_matrix:new s.a7(u),u_up:new s.ar(u),u_right:new s.ar(u),u_intensity_multiplier:new s.ab(u)}),occlusion:u=>({u_matrix:new s.a7(u),u_anchorPos:new s.ar(u),u_screenSizePx:new s.a9(u),u_occluderSizePx:new s.a9(u),u_color:new s.at(u)})};function po(u,r,a){const h=r.createTileMatrix(u,u.worldSize,a.toUnwrapped());return s.ae.multiply(new Float32Array(16),u.projMatrix,h)}function Rh(u,r,a){if(r.projection.name===a.projection.name)return u.projMatrix;const h=a.clone();return h.setProjection(r.projection),po(h,r.getProjection(),u)}function eu(u,r,a){return r.name===a.projection.name?u.projMatrix:po(a,r,u)}let rs;function Lh(u,r,a,h,p,m,g){const x=u.context,w=x.gl,T=u.transform,S=u.getOrCreateProgram("collisionBox"),I=[];let P=0,z=0;for(let j=0;j0){const Y=s.ae.create(),_e=ie;s.ae.mul(Y,W.placementInvProjMatrix,T.glCoordMatrix),s.ae.mul(Y,Y,W.placementViewportMatrix),I.push({circleArray:re,circleOffset:z,transform:_e,invTransform:Y,projection:W.getProjection()}),P+=re.length/4,z=P}ue&&(u.terrain&&u.terrain.setupElevationDraw(Z,S),S.draw(u,w.LINES,s.af.disabled,s.ah.disabled,u.colorModeForRenderPass(),s.ag.disabled,ts(ie,T,Z,W.getProjection()),a.id,ue.layoutVertexBuffer,ue.indexBuffer,ue.segments,null,T.zoom,null,[ue.collisionVertexBuffer,ue.collisionVertexBufferExt]))}if(!g||!I.length)return;const L=u.getOrCreateProgram("collisionCircle"),k=new s.bN;k.resize(4*P),k._trim();let O=0;for(const j of I)for(let J=0;J=0&&(L[j.associatedIconIndex]={x:Y,y:_e,z:fe,angle:ve})}else co(W,P)}if(S){z.clear();const $=u.icon.placedSymbolArray;for(let j=0;j<$.length;j++){const J=$.get(j),{numGlyphs:Z}=J,W=L[j];if(J.hidden||!W)co(Z,z);else{const{x:ee,y:ie,z:ue,angle:re}=W;for(let Y=0;Y{W.depthOcclusionForSymbolsAndCircles&&(a.hasInitialOcclusionOpacityProperties||u.terrain)&&(Ot.push("DEPTH_D24"),Ot.push("DEPTH_OCCLUSION"))},Ct=()=>{const Ot=ee&&a.layout.get("symbol-placement")!=="point",Mt=[];xt(Mt);const at=Ot||_t,bi=a.paint.get("icon-image-cross-fade").constantOr(0);u.terrainRenderModeElevated()&&ue&&Mt.push("PITCH_WITH_MAP_TERRAIN"),Ue&&(Mt.push("PROJECTION_GLOBE_VIEW"),at&&Mt.push("PROJECTED_POS_ON_VIEWPORT")),bi>0&&Mt.push("ICON_TRANSITION"),Ae.icon.zOffsetVertexBuffer&&Mt.push("Z_OFFSET"),B===0&&G===0&&$===0&&j===1||Mt.push("COLOR_ADJUSTMENT");const wi=Ae.icon.programConfigurations.get(a.id),Xi=u.getOrCreateProgram(Ae.sdfIcons?"symbolSDF":"symbolIcon",{config:wi,defines:Mt});let Yi;const Fi=Me.imageAtlasTexture?Me.imageAtlasTexture.size:[0,0],Ji=Ae.iconSizeData,Li=s.aE(Ji,W.zoom),Ni=ue||W.pitch!==0,Le=Ys(He,Me.tileID.canonical,ue,ee,W,Ae.getProjection(),$e),Ye=gl(He,Me.tileID.canonical,ue,ee,W,Ae.getProjection(),$e),rr=u.translatePosMatrix(Ye,Me,x,T,!0),ei=u.translatePosMatrix(He,Me,x,T),me=at?ua:Le,yn=ee&&!ue&&!Ot;let Wr=ve;!Se&&!W.mercatorFromTransition||ee||(Wr=kh(W));const xn=Ue?Wr:ve;if(Ae.sdfIcons&&!Ae.iconsInText)Yi=ca(Ji.kind,Li,yn,ue,u,ei,me,rr,!1,Fi,!0,ne,Ge,se,nt,xn,Ae.getProjection());else{const wo=a.getColorAdjustmentMatrix(B,G,$,j);Yi=is(Ji.kind,Li,yn,ue,u,ei,me,rr,!1,Fi,ne,Ge,se,nt,xn,Ae.getProjection(),wo,bi)}const vn=Me.imageAtlasTexture?Me.imageAtlasTexture:null,Kl=a.layout.get("icon-size").constantOr(0)!==1||Ae.iconsNeedLinear,Ql=Ae.sdfIcons||u.options.rotating||u.options.zooming||Kl||Ni?Z.LINEAR:Z.NEAREST,Wn=Ae.sdfIcons&&a.paint.get("icon-halo-width").constantOr(1)!==0,Mu=u.terrain&&ue&&Ot?s.ae.invert(s.ae.create(),Le):ua;if(Ot&&Ae.icon){const wo=W.elevation,ec=wo?wo.getAtTileOffsetFunc(ne,W.center.lat,W.worldSize,Ae.getProjection()):null,ms=_l(He,Me.tileID.canonical,ue,ee,W,Ae.getProjection(),$e);Jo(Ae,He,u,!1,ms,Ye,ue,k,ec,ne)}return{program:Xi,buffers:Ae.icon,uniformValues:Yi,atlasTexture:vn,atlasTextureIcon:null,atlasInterpolation:Ql,atlasInterpolationIcon:null,isSDF:Ae.sdfIcons,hasHalo:Wn,tile:Me,labelPlaneMatrixInv:Mu}},ii=()=>{const Ot=ie&&a.layout.get("symbol-placement")!=="point",Mt=[],at=Ot||Ce||_t;u.terrainRenderModeElevated()&&re&&Mt.push("PITCH_WITH_MAP_TERRAIN"),Ue&&(Mt.push("PROJECTION_GLOBE_VIEW"),at&&Mt.push("PROJECTED_POS_ON_VIEWPORT")),Ae.text.zOffsetVertexBuffer&&Mt.push("Z_OFFSET"),xt(Mt);const bi=Ae.text.programConfigurations.get(a.id),wi=u.getOrCreateProgram(Ae.iconsInText?"symbolTextAndIcon":"symbolSDF",{config:bi,defines:Mt});let Xi,Yi=[0,0],Fi=null;const Ji=Ae.textSizeData;Ae.iconsInText&&(Yi=Me.imageAtlasTexture?Me.imageAtlasTexture.size:[0,0],Fi=Me.imageAtlasTexture?Me.imageAtlasTexture:null,Xi=re||W.pitch!==0||u.options.rotating||u.options.zooming||Ji.kind==="composite"||Ji.kind==="camera"?Z.LINEAR:Z.NEAREST);const Li=Me.glyphAtlasTexture?Me.glyphAtlasTexture.size:[0,0],Ni=s.aE(Ji,W.zoom),Le=Ys(He,Me.tileID.canonical,re,ie,W,Ae.getProjection(),$e),Ye=gl(He,Me.tileID.canonical,re,ie,W,Ae.getProjection(),$e),rr=u.translatePosMatrix(Ye,Me,w,S,!0),ei=u.translatePosMatrix(He,Me,w,S),me=at?ua:Le,yn=ie&&!re&&!Ot;let Wr=ve;!Se&&!W.mercatorFromTransition||ie||(Wr=kh(W));const xn=Ue?Wr:ve;let vn;vn=Ae.iconsInText?Jc(Ji.kind,Ni,yn,re,u,ei,me,rr,Li,Yi,ne,Ge,se,nt,xn,Ae.getProjection()):ca(Ji.kind,Ni,yn,re,u,ei,me,rr,!0,Li,!0,ne,Ge,se,nt,xn,Ae.getProjection());const Kl=Me.glyphAtlasTexture?Me.glyphAtlasTexture:null,Ql=Z.LINEAR,Wn=a.paint.get("text-halo-width").constantOr(1)!==0,Mu=u.terrain&&re&&Ot?s.ae.invert(s.ae.create(),Le):ua;if(Ot&&Ae.text){const wo=W.elevation,ec=wo?wo.getAtTileOffsetFunc(ne,W.center.lat,W.worldSize,Ae.getProjection()):null,ms=_l(He,Me.tileID.canonical,re,ie,W,Ae.getProjection(),$e);Jo(Ae,He,u,!0,ms,Ye,re,O,ec,ne)}return{program:wi,buffers:Ae.text,uniformValues:vn,atlasTexture:Kl,atlasTextureIcon:Fi,atlasInterpolation:Ql,atlasInterpolationIcon:Xi,isSDF:!0,hasHalo:Wn,tile:Me,labelPlaneMatrixInv:Mu}},Jt=Ae.icon.segments.get().length,Pt=Ae.text.segments.get().length,Xt=Jt&&!g.onlyText?Ct():null,Tt=Pt&&!g.onlyIcons?ii():null,St=a.paint.get("icon-opacity").constantOr(1),gt=a.paint.get("text-opacity").constantOr(1);if(Y&&Ae.canOverlap){_e=!0;const Ot=St&&!g.onlyText?Ae.icon.segments.get():[],Mt=gt&&!g.onlyIcons?Ae.text.segments.get():[];for(const at of Ot)he.push({segments:new s.b([at]),sortKey:at.sortKey,state:Xt});for(const at of Mt)he.push({segments:new s.b([at]),sortKey:at.sortKey,state:Tt})}else g.onlyText||he.push({segments:St?Ae.icon.segments:new s.b([]),sortKey:0,state:Xt}),g.onlyIcons||he.push({segments:gt?Ae.text.segments:new s.b([]),sortKey:0,state:Tt})}_e&&he.sort((ne,Me)=>ne.sortKey-Me.sortKey);for(const ne of he){const Me=ne.state;if(Me)if(u.terrain?u.terrain.setupElevationDraw(Me.tile,Me.program,{useDepthForOcclusion:W.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Me.labelPlaneMatrixInv}):u.setupDepthForOcclusion(W.depthOcclusionForSymbolsAndCircles,Me.program),J.activeTexture.set(Z.TEXTURE0),Me.atlasTexture&&Me.atlasTexture.bind(Me.atlasInterpolation,Z.CLAMP_TO_EDGE,!0),Me.atlasTextureIcon&&(J.activeTexture.set(Z.TEXTURE1),Me.atlasTextureIcon&&Me.atlasTextureIcon.bind(Me.atlasInterpolationIcon,Z.CLAMP_TO_EDGE,!0)),u.uploadCommonLightUniforms(u.context,Me.program),Me.hasHalo){const Ae=Me.uniformValues;Ae.u_is_halo=1,tu(Me.buffers,ne.segments,a,u,Me.program,fe,p,m,Ae,2),Ae.u_is_halo=0}else{if(Me.isSDF){const Ae=Me.uniformValues;Me.hasHalo&&(Ae.u_is_halo=1,tu(Me.buffers,ne.segments,a,u,Me.program,fe,p,m,Ae,1)),Ae.u_is_halo=0}tu(Me.buffers,ne.segments,a,u,Me.program,fe,p,m,Me.uniformValues,1)}}}function tu(u,r,a,h,p,m,g,x,w,T){const S=[u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer,u.iconTransitioningVertexBuffer,u.globeExtVertexBuffer,u.zOffsetVertexBuffer];p.draw(h,h.context.gl.TRIANGLES,m,g,x,s.ag.disabled,w,a.id,u.layoutVertexBuffer,u.indexBuffer,r,a.paint,h.transform.zoom,u.programConfigurations.get(a.id),S,T)}function da(u,r,a,h,p,m,g){const x=u.context.gl,w=a.paint.get("fill-pattern"),T=w&&w.constantOr(1);let S,I,P,z,L;g?(I=T&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",S=x.LINES):(I=T?"fillPattern":"fill",S=x.TRIANGLES);for(const k of h){const O=r.getTile(k);if(T&&!O.patternsLoaded())continue;const B=O.getBucket(a);if(!B)continue;u.prepareDrawTile();const G=B.programConfigurations.get(a.id),$=u.isTileAffectedByFog(k),j=u.getOrCreateProgram(I,{config:G,overrideFog:$});T&&(u.context.activeTexture.set(x.TEXTURE0),O.imageAtlasTexture&&O.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),G.updatePaintBuffers());const J=w.constantOr(null);if(J&&O.imageAtlas){const ee=O.imageAtlas.patternPositions[J.toString()];ee&&G.setConstantPatternPositions(ee)}const Z=u.translatePosMatrix(k.projMatrix,O,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor")),W=a.paint.get("fill-emissive-strength");if(g){z=B.indexBuffer2,L=B.segments2;const ee=u.terrain&&u.terrain.renderingToTexture?u.terrain.drapeBufferSize:[x.drawingBufferWidth,x.drawingBufferHeight];P=I==="fillOutlinePattern"&&T?sa(Z,W,u,O,ee):Sl(Z,W,ee)}else z=B.indexBuffer,L=B.segments,P=T?El(Z,W,u,O):oa(Z,W);u.uploadCommonUniforms(u.context,j,k.toUnwrapped()),j.draw(u,S,p,u.stencilModeForClipping(k),m,s.ag.disabled,P,a.id,B.layoutVertexBuffer,z,L,a.paint,u.transform.zoom,G,void 0)}}function fo(u,r,a,h,p,m,g,x){a.resetLayerRenderingStats(u);const w=u.context,T=w.gl,S=u.transform,I=a.paint.get("fill-extrusion-pattern"),P=I.constantOr(1),z=a.paint.get("fill-extrusion-opacity"),L=u.style.enable3dLights(),k=a.paint.get(L&&!P?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),O=[a.paint.get("fill-extrusion-ambient-occlusion-intensity"),k],B=a.layout.get("fill-extrusion-edge-radius"),G=B>0&&!a.paint.get("fill-extrusion-rounded-roof"),$=G?0:B,j=S.projection.name==="globe"?s.b_():0,J=S.projection.name==="globe",Z=J?s.a2(S.zoom):0,W=[s.ak(S.center.lng),s.al(S.center.lat)],ee=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(a.lut).toArray01().slice(0,3),ie=a.paint.get("fill-extrusion-flood-light-intensity"),ue=a.paint.get("fill-extrusion-vertical-scale"),re=a.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Y=ar(u,a.paint.get("fill-extrusion-cutoff-fade-range")),_e=a.paint.get("fill-extrusion-emissive-strength"),fe=[];J&&fe.push("PROJECTION_GLOBE_VIEW"),O[0]>0&&fe.push("FAUX_AO"),G&&fe.push("ZERO_ROOF_RADIUS"),x&&fe.push("HAS_CENTROID"),ie>0&&fe.push("FLOOD_LIGHT"),Y.shouldRenderCutoff&&fe.push("RENDER_CUTOFF"),re&&fe.push("RENDER_WALL_MODE");const se=(()=>{const Ue=a.paint.get("fill-extrusion-line-alignment");switch(Ue){case"inside":return 1;case"outside":return-1;case"center":return 0;default:return s.w(`Unsupported value for fill-extrusion-line-alignment: ${Ue}`),0}})();let Ce;const Se=u.renderPass==="shadow",he=u.shadowRenderer,ve=Se&&!!he;u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!0);let ne=[0,0,0];if(he){const Ue=u.style.directionalLight,Ge=u.style.ambientLight;Ue&&Ge&&(ne=ea(u.style,Ue,Ge)),Ce=fe.concat(["SHADOWS_SINGLE_CASCADE"])}const Me=ve?"fillExtrusionDepth":P?"fillExtrusionPattern":"fillExtrusion",Ae=a.getLayerRenderingStats();for(const Ue of h){const Ge=r.getTile(Ue),He=Ge.getBucket(a);if(!He||He.projection.name!==S.projection.name)continue;let $e=!1;he&&($e=he.getMaxCascadeForTile(Ue.toUnwrapped())===0);const it=u.isTileAffectedByFog(Ue),_t=He.programConfigurations.get(a.id),nt=u.getOrCreateProgram(Me,{config:_t,defines:$e?Ce:fe,overrideFog:it});if(u.terrain&&u.terrain.setupElevationDraw(Ge,nt,{useMeterToDem:!0}),!He.centroidVertexBuffer){const Tt=nt.attributes.a_centroid_pos;Tt!==void 0&&T.vertexAttrib2f(Tt,0,0)}!Se&&he&&he.setupShadows(Ge.tileID.toUnwrapped(),nt,"vector-tile",Ge.tileID.overscaledZ),P&&(u.context.activeTexture.set(T.TEXTURE0),Ge.imageAtlasTexture&&Ge.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),_t.updatePaintBuffers());const xt=I.constantOr(null);if(xt&&Ge.imageAtlas){const Tt=Ge.imageAtlas.patternPositions[xt.toString()];Tt&&_t.setConstantPatternPositions(Tt)}const Ct=a.paint.get("fill-extrusion-vertical-gradient"),ii=1/He.tileToMeter;let Jt;if(Se&&he){if(en(Ge.tileID,He,u))continue;const Tt=he.calculateShadowPassMatrixFromTile(Ge.tileID.toUnwrapped());Jt=Tl(Tt,$,se,ii,ue)}else{const Tt=u.translatePosMatrix(Ue.expandedProjMatrix,Ge,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),St=S.projection.createInversionMatrix(S,Ue.canonical);Jt=P?Ah(Tt,u,Ct,z,O,$,se,ii,Ue,Ge,j,Z,W,St,ee,ue):Kr(Tt,u,Ct,z,O,$,se,ii,Ue,j,Z,W,St,ee,ue,ie,ne,_e)}u.uploadCommonUniforms(w,nt,Ue.toUnwrapped(),null,Y);let Pt=He.segments;if(S.projection.name==="mercator"&&!Se&&(Pt=He.getVisibleSegments(Ge.tileID,u.terrain,u.transform.getFrustum(0)),!Pt.get().length))continue;if(Ae)if(Se)for(const Tt of Pt.get())Ae.numRenderedVerticesInShadowPass+=Tt.primitiveLength;else for(const Tt of Pt.get())Ae.numRenderedVerticesInTransparentPass+=Tt.primitiveLength;const Xt=[];(u.terrain||x)&&Xt.push(He.centroidVertexBuffer),J&&Xt.push(He.layoutVertexExtBuffer),re&&Xt.push(He.wallVertexBuffer),nt.draw(u,w.gl.TRIANGLES,p,m,g,s.ag.backCCW,Jt,a.id,He.layoutVertexBuffer,He.indexBuffer,Pt,a.paint,u.transform.zoom,_t,Xt)}u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!1)}function ns(u,r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B,G){const $=u.context,j=$.gl,J=u.transform,Z=u.transform.zoom,W=[],ee=ar(u,a.paint.get("fill-extrusion-cutoff-fade-range"));T==="clear"?(W.push("CLEAR_SUBPASS"),G&&(W.push("CLEAR_FROM_TEXTURE"),$.activeTexture.set(j.TEXTURE0),G.bind(j.LINEAR,j.CLAMP_TO_EDGE))):T==="sdf"&&W.push("SDF_SUBPASS"),O&&W.push("HAS_CENTROID"),ee.shouldRenderCutoff&&W.push("RENDER_CUTOFF");const ie=a.layout.get("fill-extrusion-edge-radius"),ue=(re,Y,_e,fe,se)=>{const Ce=Y.programConfigurations.get(a.id),Se=u.isTileAffectedByFog(re),he=u.getOrCreateProgram("fillExtrusionGroundEffect",{config:Ce,defines:W,overrideFog:Se}),ve=((Me,Ae,Ue,Ge,He,$e,it,_t,nt,xt,Ct)=>({u_matrix:Ae,u_opacity:Ue,u_ao_pass:Ge?1:0,u_meter_to_tile:He,u_ao:$e,u_flood_light_intensity:it,u_flood_light_color:_t,u_attenuation:nt,u_edge_radius:xt,u_fb:0,u_fb_size:Ct}))(0,fe,S,w,se,[I,P*se],z,L,k,Z>=17?0:ie*se,G?G.size[0]:0),ne=[];O&&ne.push(Y.hiddenByLandmarkVertexBuffer),u.uploadCommonUniforms($,he,re.toUnwrapped(),null,ee),he.draw(u,$.gl.TRIANGLES,p,m,g,x,ve,a.id,Y.vertexBuffer,Y.indexBuffer,_e,a.paint,Z,Ce,ne)};for(const re of h){const Y=r.getTile(re),_e=Y.getBucket(a);if(!_e||_e.projection.name!==J.projection.name||!_e.groundEffect||_e.groundEffect&&!_e.groundEffect.hasData())continue;const fe=_e.groundEffect,se=1/_e.tileToMeter;{const Ce=u.translatePosMatrix(re.projMatrix,Y,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),Se=fe.getDefaultSegment();ue(re,fe,Se,Ce,se)}if(B)for(let Ce=0;Ce<4;Ce++){const Se=s.b$[Ce](re),he=r.getTile(Se);if(!he)continue;const ve=he.getBucket(a);if(!ve||ve.projection.name!==J.projection.name||!ve.groundEffect||ve.groundEffect&&!ve.groundEffect.hasData())continue;const ne=ve.groundEffect;let Me,Ae;Ce===0?(Me=[-s.a4,0,0],Ae=1):Ce===1?(Me=[s.a4,0,0],Ae=0):Ce===2?(Me=[0,-s.a4,0],Ae=3):(Me=[0,s.a4,0],Ae=2);const Ue=ne.regionSegments[Ae];if(!Ue)continue;const Ge=new Float32Array(16);s.ae.translate(Ge,re.projMatrix,Me),ue(re,ne,Ue,u.translatePosMatrix(Ge,Y,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),se)}}}function Ap(u,r,a,h,p,m,g){h.centroidVertexArray.length===0&&h.createCentroidsBuffer();const x=m?m.findDEMTileFor(a):null;if(!(x&&x.dem||g))return;const w=B=>new s.P(Math.ceil((B+s.c2)*s.c3),0),T=B=>{const G=r.getSource().minzoom,$=J=>{const Z=r.getTileByID(J);if(Z&&Z.hasData())return Z.getBucket(p)},j=[0,-1,1];for(const J of j){if(B.overscaledZ+J(S[0]=Math.min(B.min.y,G.min.y),S[1]=Math.max(B.max.y,G.max.y),S[2]=s.a4-G.min.x>B.max.x?G.min.x-s.a4:B.max.x,S),P=(B,G)=>(S[0]=Math.min(B.min.x,G.min.x),S[1]=Math.max(B.max.x,G.max.x),S[2]=s.a4-G.min.y>B.max.y?G.min.y-s.a4:B.max.y,S),z=[(B,G)=>I(B,G),(B,G)=>I(G,B),(B,G)=>P(B,G),(B,G)=>P(G,B)],L=(B,G,$,j,J,Z,W)=>{if(!m)return 0;const ee=[[Z?$:B,Z?B:$,0],[Z?$:G,Z?G:$,0]],ie=W<0?s.a4+W:W,ue=[Z?ie:(B+G)/2,Z?(B+G)/2:ie,0];return $===0&&W<0||$!==0&&W>0?m.getForTilePoints(J,[ue],!0,j):ee.push(ue),m.getForTilePoints(a,ee,!0,x),Math.max(ee[0][2],ee[1][2],ue[2])/m.exaggeration()};for(let B=0;B<4;B++){const G=h.borderFeatureIndices[B];if(G.length===0)continue;const $=s.b$[B](a),j=T($);if(!(j&&j instanceof s.c0)||h.borderDoneWithNeighborZ[B]===j.canonical.z)continue;j.centroidVertexArray.length===0&&j.createCentroidsBuffer();const J=m?m.findDEMTileFor($):null;if(!(J&&J.dem||g))continue;const Z=(B<2?1:5)-B,W=j.borderDoneWithNeighborZ[Z]!==h.canonical.z,ee=j.borderFeatureIndices[Z];let ie=0;if(h.canonical.z!==j.canonical.z){for(const ue of G)h.showCentroid(h.featuresOnBorder[ue]);if(W)for(const ue of ee)j.showCentroid(j.featuresOnBorder[ue]);h.borderDoneWithNeighborZ[B]=j.canonical.z,j.borderDoneWithNeighborZ[Z]=h.canonical.z}for(const ue of G){const re=h.featuresOnBorder[ue],Y=h.centroidData[re.centroidDataIndex],_e=re.borders[B];let fe;for(;ie_e[0]+3||se[0]>_e[0]-3)break;j.showCentroid(fe),ie++}if(fe&&ie_e[1]-3)&&(Ce++,++ie!==ee.length);)fe=j.featuresOnBorder[ee[ie]];if(fe=j.featuresOnBorder[ee[se]],Ce>1){const ve=fe.borders[Z];Math.abs(_e[0]-ve[0])<3&&Math.abs(_e[1]-ve[1])<3&&(Ce=1,ie=se+1)}else if(Ce===0){h.showCentroid(re);continue}const Se=j.centroidData[fe.centroidDataIndex];g&&Ce===1&&(((k=Y).flags|(O=Se).flags)&s.c1?(k.flags|=s.c1,O.flags|=s.c1):(k.flags&=~s.c1,O.flags&=~s.c1));const he=re.intersectsCount()>1||fe.intersectsCount()>1;if(Ce>1)ie=se,Y.centroidXY=Se.centroidXY=new s.P(0,0);else if(J&&J.dem&&!he){const ve=z[B](Y,Se),ne=B%2?s.a4-1:0,Me=L(ve[0],Math.min(s.a4-1,ve[1]),ne,J,$,B<2,ve[2]);Y.centroidXY=Se.centroidXY=w(Me)}else he?Y.centroidXY=Se.centroidXY=new s.P(0,0):(Y.centroidXY=h.encodeBorderCentroid(re),Se.centroidXY=j.encodeBorderCentroid(fe));h.writeCentroidToBuffer(Y),j.writeCentroidToBuffer(Se)}else h.showCentroid(re)}h.borderDoneWithNeighborZ[B]=j.canonical.z,j.borderDoneWithNeighborZ[Z]=h.canonical.z}var k,O;(h.needsCentroidUpdate||!h.centroidVertexBuffer&&h.centroidVertexArray.length!==0)&&h.uploadCentroid(u)}const Bh=[1,0,0],Cp=[0,1,0],Al=[0,0,1];function en(u,r,a){const h=a.transform,p=a.shadowRenderer;if(!p)return!0;const m=u.toUnwrapped(),g=h.tileSize*p._cascades[a.currentShadowCascade].scale;let x=r.maxHeight;if(h.elevation){const k=h.elevation.getMinMaxForTile(u);k&&(x+=k.max)}const w=[...p.shadowDirection];w[2]=-w[2];const T=p.computeSimplifiedTileShadowVolume(m,x,g,w);if(!T)return!1;const S=[Bh,Cp,Al,w,[w[0],0,w[2]],[0,w[1],w[2]]],I=h.projection.name==="globe",P=h.scaleZoom(g),z=s.aM.fromInvProjectionMatrix(h.invProjMatrix,h.worldSize,P,!I),L=p.getCurrentCascadeFrustum();return z.intersectsPrecise(T.vertices,T.planes,S)===0||L.intersectsPrecise(T.vertices,T.planes,S)===0}function pa(u){return[u[0]*s.c4,u[1]*s.c4,u[2]*s.c4,0]}function Cl(u,r,a,h,p,m,g,x,w){const T=h.getSource(),S=a.globeSharedBuffers;if(!S)return;let I,P,z;if(r&&(I=h.getTile(r)),T instanceof s.bo?(P=T.texture,z=s.bj(0,0,a.transform)):I&&r&&(P=I.texture,z=s.bj(r.canonical.z,r.canonical.x,a.transform)),!P||!z)return;u||(z=s.ae.scale(s.ae.create(),z,[1,-1,1]));const L=a.context,k=L.gl,O=p.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR,B=a.colorModeForDrapableLayerRenderPass(m),G=g.defines;G.push("GLOBE_POLES");const $=new s.af(k.LEQUAL,s.af.ReadWrite,a.depthRangeFor3D),j=Float32Array.from(a.transform.expandedFarZProjMatrix),J=Float32Array.from(s.bh(s.bi(new s.aO(0,0,0))));a.terrain&&a.terrain.prepareDrawTile(),L.activeTexture.set(k.TEXTURE0),P.bind(O,k.CLAMP_TO_EDGE),L.activeTexture.set(k.TEXTURE1),P.bind(O,k.CLAMP_TO_EDGE),P.useMipmap&&L.extTextureFilterAnisotropic&&a.transform.pitch>20&&k.texParameterf(k.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const[Z,W,ee,ie]=r?S.getPoleBuffers(r.canonical.z,!1):S.getPoleBuffers(0,!0),ue=p.paint.get("raster-elevation");let re;u?(re=Z,a.renderDefaultNorthPole=ue!==0):(re=W,a.renderDefaultSouthPole=ue!==0);const Y=pa(g.mix),_e=((se,Ce,Se,he,ve,ne,Me,Ae,Ue,Ge,He,$e,it)=>Il(se,Ce,Se,new Float32Array(16),new Float32Array(9),[0,0],he,[0,0],[0,0,0,0],1,{opacity:1,mix:0},ne,[0,0],Ae,2,Ge,He,$e,1,0,it))(j,J,z,s.a2(a.transform.zoom),0,p,0,ue,0,Y,g.offset,g.range,m),fe=a.getOrCreateProgram("raster",{defines:G});a.uploadCommonUniforms(L,fe,null),fe.draw(a,k.TRIANGLES,$,w,B,x,_e,p.id,re,ee,ie)}function iu(u){const r=u._nearZ,a=u.projection.farthestPixelDistance(u),h=a-r,p=.2*u.height,m=r+p;return[r,a,(m-p-r)/h,(m-r)/h]}function mo(u,r,a,h){if(u)return r instanceof Un&&u instanceof s.c5?r.getTextureDescriptor(u,a,!0):{texture:u.texture,mix:pa(h.mix),offset:h.offset,buffer:0,tileSize:1}}function Fh(u,r,a){if(!u)return null;const h=r.getTextureDescriptor(u,a,!0);if(!h)return null;let{texture:p,mix:m,offset:g,tileSize:x,buffer:w,format:T}=h;if(!p||!T)return null;let S=!1;return T==="uint32"&&(S=!0,m[3]=0,m=Xc(s.c6,m,[0,a.paint.get("raster-particle-max-speed")]),g=aa(s.c6,g,[0,a.paint.get("raster-particle-max-speed")])),{texture:p,textureOffset:[w/(x+2*w),x/(x+2*w)],tileSize:x,scalarData:S,scale:m,offset:g,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function Pl(u){const r=u._nearZ,a=u.projection.farthestPixelDistance(u),h=a-r,p=.2*u.height,m=r+p;return[r,a,(m-p-r)/h,(m-r)/h]}const ru=new s.C(1,0,0,1),zl=new s.C(0,1,0,1),nu=new s.C(0,0,1,1),Ut=new s.C(1,0,1,1),Pp=new s.C(0,1,1,1);function rt(u,r,a,h,p,m,g){const x=u.context,w=u.transform,T=x.gl,S=w.projection.name==="globe",I=S?["PROJECTION_GLOBE_VIEW"]:[];let P=s.ae.clone(a.projMatrix);if(S&&s.a2(w.zoom)>0){const Y=s.c7(a.canonical,w),_e=s.c8(Y);P=s.ae.multiply(new Float32Array(16),w.globeMatrix,_e),s.ae.multiply(P,w.projMatrix,P)}const z=s.ae.create();z[12]+=2*p/(s.e.devicePixelRatio*w.width),z[13]+=2*m/(s.e.devicePixelRatio*w.height),s.ae.multiply(P,z,P);const L=u.getOrCreateProgram("debug",{defines:I}),k=r.getTileByID(a.key);u.terrain&&u.terrain.setupElevationDraw(k,L);const O=s.af.disabled,B=s.ah.disabled,G=u.colorModeForRenderPass(),$="$debug";x.activeTexture.set(T.TEXTURE0),u.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),S?k._makeGlobeTileDebugBuffers(u.context,w):k._makeDebugTileBoundsBuffers(u.context,w.projection);const j=k._tileDebugBuffer||u.debugBuffer,J=k._tileDebugIndexBuffer||u.debugIndexBuffer,Z=k._tileDebugSegments||u.debugSegments;if(L.draw(u,T.LINE_STRIP,O,B,G,s.ag.disabled,Ml(P,h),$,j,J,Z,null,null,null,[k._globeTileDebugBorderBuffer]),g){const Y=k.latestRawTileData,_e=Math.floor((Y&&Y.byteLength||0)/1024);let fe=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(fe+=` => ${a.overscaledZ}`),fe+=` ${k.state}`,fe+=` ${_e}kb`,function(se,Ce){se.initDebugOverlayCanvas();const Se=se.debugOverlayCanvas,he=se.context.gl,ve=se.debugOverlayCanvas.getContext("2d");ve.clearRect(0,0,Se.width,Se.height),ve.shadowColor="white",ve.shadowBlur=2,ve.lineWidth=1.5,ve.strokeStyle="white",ve.textBaseline="top",ve.font="bold 36px Open Sans, sans-serif",ve.fillText(Ce,5,5),ve.strokeText(Ce,5,5),se.debugOverlayTexture.update(Se),se.debugOverlayTexture.bind(he.LINEAR,he.CLAMP_TO_EDGE)}(u,fe)}const W=r.getTile(a).tileSize,ee=512/Math.min(W,512)*(a.overscaledZ/w.zoom)*.5,ie=k._tileDebugTextBuffer||u.debugBuffer,ue=k._tileDebugTextIndexBuffer||u.quadTriangleIndexBuffer,re=k._tileDebugTextSegments||u.debugSegments;L.draw(u,T.TRIANGLES,O,B,s.a.alphaBlended,s.ag.disabled,Ml(P,s.C.transparent,ee),$,ie,ue,re,null,null,null,[k._globeTileDebugTextBuffer])}function ou(u,r,a,h){os(u,0,r+a/2,u.transform.width,a,h)}function fa(u,r,a,h){os(u,r-a/2,0,a,u.transform.height,h)}function os(u,r,a,h,p,m){const g=u.context,x=g.gl;x.enable(x.SCISSOR_TEST),x.scissor(r*s.e.devicePixelRatio,a*s.e.devicePixelRatio,h*s.e.devicePixelRatio,p*s.e.devicePixelRatio),g.clear({color:m}),x.disable(x.SCISSOR_TEST)}const tn=s.c9([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:su}=tn;function mr(u,r,a,h){u.emplaceBack(r,a,h)}class We{constructor(r){this.vertexArray=new s.ca,this.indices=new s.bw,mr(this.vertexArray,-1,-1,1),mr(this.vertexArray,1,-1,1),mr(this.vertexArray,-1,1,1),mr(this.vertexArray,1,1,1),mr(this.vertexArray,-1,-1,-1),mr(this.vertexArray,1,-1,-1),mr(this.vertexArray,-1,1,-1),mr(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=r.createVertexBuffer(this.vertexArray,su),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=s.b.simpleSegment(0,0,36,12)}}function Lt(u,r,a,h,p,m){const g=u.context.gl,x=r.paint.get("sky-atmosphere-color"),w=r.paint.get("sky-atmosphere-halo-color"),T=r.paint.get("sky-atmosphere-sun-intensity"),S=((I,P,z,L,k)=>({u_matrix_3f:I,u_sun_direction:P,u_sun_intensity:z,u_color_tint_r:[L.r,L.g,L.b,L.a],u_color_tint_m:[k.r,k.g,k.b,k.a],u_luminance:5e-5}))(s.bE.fromMat4(s.bE.create(),h),p,T,x,w);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_CUBE_MAP_POSITIVE_X+m,r.skyboxTexture,0),a.draw(u,g.TRIANGLES,s.af.disabled,s.ah.disabled,s.a.unblended,s.ag.frontCW,S,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}const Gt=s.c9([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Rr{constructor(r){const a=new s.cb;a.emplaceBack(-1,1,1,0,0),a.emplaceBack(1,1,1,1,0),a.emplaceBack(1,-1,1,1,1),a.emplaceBack(-1,-1,1,0,1);const h=new s.bw;h.emplaceBack(0,1,2),h.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(a,Gt.members),this.indexBuffer=r.createIndexBuffer(h),this.segments=s.b.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const ss=s.c9([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class Nt{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Dl{constructor(r){this.colorModeAlphaBlendedWriteRGB=new s.a([s.cc,s.cd,s.cc,s.cd],s.C.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new s.a([s.cc,s.ce,s.cc,s.ce],s.C.transparent,[!1,!1,!1,!0]),this.params=new Nt,this.updateNeeded=!0,r.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),r.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),r.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),r.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(r){const a=r.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Rr(a);const h=this.params.sizeRange,p=this.params.intensityRange,m=function(S){const I=s.ch(30),P=[];for(let z=0;z{const J=m.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];j&&J.push("ALPHA_PASS");const Z=r.getOrCreateProgram("globeAtmosphere",{defines:J}),W=((ie,ue,re,Y,_e,fe,se,Ce,Se,he,ve,ne)=>({u_frustum_tl:ie,u_frustum_tr:ue,u_frustum_br:re,u_frustum_bl:Y,u_horizon:_e,u_transition:fe,u_fadeout_range:se,u_color:Ce,u_high_color:Se,u_space_color:he,u_temporal_offset:ve,u_horizon_angle:ne}))(m.frustumCorners.TL,m.frustumCorners.TR,m.frustumCorners.BR,m.frustumCorners.BL,m.frustumCorners.horizon,x,z,T,S,I,k,G);r.uploadCommonUniforms(h,Z);const ee=this.atmosphereBuffer;ee&&Z.draw(r,p.TRIANGLES,g,s.ah.disabled,j?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,s.ag.backCW,W,j?"atmosphere_glow_alpha":"atmosphere_glow",ee.vertexBuffer,ee.indexBuffer,ee.segments)};$(!1),$(!0)}drawStars(r,a){const h=s.au(a.properties.get("star-intensity"),0,1);if(h===0)return;const p=r.context,m=p.gl,g=r.transform,x=r.getOrCreateProgram("stars"),w=s.aw.identity([]);s.aw.rotateX(w,w,-g._pitch),s.aw.rotateZ(w,w,-g.angle),s.aw.rotateX(w,w,s.ac(g._center.lat)),s.aw.rotateY(w,w,-s.ac(g._center.lng));const T=s.ae.fromQuat(new Float32Array(16),w),S=s.ae.multiply([],g.starsProjMatrix,T),I=s.bE.fromMat4([],T),P=s.bE.invert([],I),z=[0,1,0];s.$.transformMat3(z,z,P),s.$.scale(z,z,this.params.sizeMultiplier);const L=[1,0,0];s.$.transformMat3(L,L,P),s.$.scale(L,L,this.params.sizeMultiplier);const k=(O=z,B=L,G=h,{u_matrix:Float32Array.from(S),u_up:O,u_right:B,u_intensity_multiplier:G});var O,B,G;r.uploadCommonUniforms(p,x),this.starsVx&&this.starsIdx&&x.draw(r,m.TRIANGLES,s.af.disabled,s.ah.disabled,this.colorModeAlphaBlendedWriteRGB,s.ag.disabled,k,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function as(u,r){const a=[...u],h=r.cameraWorldSizeForFog/r.worldSize,p=s.ae.identity([]);return s.ae.scale(p,p,[h,h,1]),s.ae.multiply(a,p,a),s.ae.multiply(a,r.worldToFogMatrix,a),a}function _o(u,r,a,h,p){const m=a.material,g=h.context,{baseColorTexture:x,metallicRoughnessTexture:w}=m.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:S,emissionTexture:I}=m;function P(z,L,k){if(z&&(u.push(L),g.activeTexture.set(g.gl.TEXTURE0+k),z.gfxTexture)){const{minFilter:O,magFilter:B,wrapS:G,wrapT:$}=z.sampler;z.gfxTexture.bindExtraParam(O,B,G,$)}}P(x,"HAS_TEXTURE_u_baseColorTexture",$i.BaseColor),P(w,"HAS_TEXTURE_u_metallicRoughnessTexture",$i.MetallicRoughness),P(T,"HAS_TEXTURE_u_normalTexture",$i.Normal),P(S,"HAS_TEXTURE_u_occlusionTexture",$i.Occlusion),P(I,"HAS_TEXTURE_u_emissionTexture",$i.Emission),p&&(p.texture||(p.texture=new s.cj(h.context,p.image,[p.image.height,p.image.height,p.image.height],g.gl.RGBA)),g.activeTexture.set(g.gl.TEXTURE0+$i.LUT),p.texture&&p.texture.bind(g.gl.LINEAR,g.gl.CLAMP_TO_EDGE),u.push("APPLY_LUT_ON_GPU")),a.texcoordBuffer&&(u.push("HAS_ATTRIBUTE_a_uv_2f"),r.push(a.texcoordBuffer)),a.colorBuffer&&(u.push(a.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),r.push(a.colorBuffer)),a.normalBuffer&&(u.push("HAS_ATTRIBUTE_a_normal_3f"),r.push(a.normalBuffer)),a.pbrBuffer&&(u.push("HAS_ATTRIBUTE_a_pbr"),u.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),r.push(a.pbrBuffer)),m.alphaMode!=="OPAQUE"&&m.alphaMode!=="MASK"||u.push("UNPREMULT_TEXTURE_IN_SHADER"),m.defined||u.push("DIFFUSE_SHADED"),u.push("USE_STANDARD_DERIVATIVES")}function Wi(u,r,a,h,p,m){const g=a.paint.get("model-opacity"),x=r.context,w=new s.af(r.context.gl.LEQUAL,s.af.ReadWrite,r.depthRangeFor3D),T=r.transform,S=u.mesh,I=S.material,P=I.pbrMetallicRoughness,z=r.style.fog;let L;L=r.transform.projection.zAxisUnit==="pixels"?[...u.nodeModelMatrix]:s.ae.multiply([],h.zScaleMatrix,u.nodeModelMatrix),s.ae.multiply(L,h.negCameraPosMatrix,L);const k=s.ae.invert([],L);s.ae.transpose(k,k);const O=a.paint.get("model-emissive-strength").constantOr(0),B=ho(new Float32Array(u.worldViewProjection),new Float32Array(L),new Float32Array(k),null,r,g,P.baseColorFactor.toRenderColor(null),I.emissiveFactor,P.metallicFactor,P.roughnessFactor,I,O,a),G={defines:[]},$=[];_o(G.defines,$,S,r,a.lut);const j=r.shadowRenderer;j&&(j.useNormalOffset=!1);let J=null;if(z){const ee=as(u.nodeModelMatrix,r.transform);if(J=new Float32Array(ee),T.projection.name!=="globe"){const ie=S.aabb.min,ue=S.aabb.max,[re,Y]=z.getOpacityForBounds(ee,ie[0],ie[1],ue[0],ue[1]);G.overrideFog=re>=Ft||Y>=Ft}}const Z=ar(r,a.paint.get("model-cutoff-fade-range"));Z.shouldRenderCutoff&&G.defines.push("RENDER_CUTOFF");const W=r.getOrCreateProgram("model",G);r.uploadCommonUniforms(x,W,null,J,Z),r.renderPass!=="shadow"&&j&&j.setupShadowsFromMatrix(u.nodeModelMatrix,W),W.draw(r,x.gl.TRIANGLES,w,p,m,S.material.doubleSided?s.ag.disabled:s.ag.backCCW,B,a.id,S.vertexBuffer,S.indexBuffer,S.segments,a.paint,r.transform.zoom,void 0,$)}function mi(u,r,a,h,p,m,g){let x;x=u.projection.name==="globe"?s.ck(a,u):[...a],s.ae.multiply(x,x,r.matrix);const w=s.ae.multiply([],h,x);if(r.meshes)for(const T of r.meshes){if(T.material.alphaMode!=="BLEND"){g.push({mesh:T,depth:0,modelIndex:p,worldViewProjection:w,nodeModelMatrix:x});continue}const S=s.$.transformMat4([],T.centroid,w);S[2]>0&&m.push({mesh:T,depth:S[2],modelIndex:p,worldViewProjection:w,nodeModelMatrix:x})}if(r.children)for(const T of r.children)mi(u,T,a,h,p,m,g)}function au(u,r,a,h){const p=a.shadowRenderer;if(!p)return;const m=p.getShadowPassDepthMode(),g=p.getShadowPassColorMode(),x=p.calculateShadowPassMatrixFromMatrix(r),w=Qc(x);a.getOrCreateProgram("modelDepth",{defines:a._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(a,a.context.gl.TRIANGLES,m,s.ah.disabled,g,s.ag.backCCW,w,h.id,u.vertexBuffer,u.indexBuffer,u.segments,h.paint,a.transform.zoom,void 0,void 0)}function ma(u,r,a){const h=r.updateZoomBasedPaintProperties(),p=function(m,g,x){let w,T,S,I=m.terrain?m.terrain.exaggeration():0;if(m.terrain&&I>0){const P=m.terrain,z=P.findDEMTileFor(x);z&&z.dem?w=s.cm.create(P,x,z):I=0}if(I===0&&(g.terrainElevationMin=0,g.terrainElevationMax=0),I===g.validForExaggeration&&(I===0||w&&w._demTile&&w._demTile.tileID===g.validForDEMTile.id&&w._dem._timestamp===g.validForDEMTile.timestamp))return!1;for(const P in g.instancesPerModel){const z=g.instancesPerModel[P];for(let L=0;LT&&(T=z.max)}const S=s.au(h.x,m,g)-h.x,I=s.au(h.y,x,w)-h.y,P=s.ay(T,r.center.lat)-h.z;return r._zoomFromMercatorZ(Math.sqrt(S*S+I*I+P*P))}function Rl(u,r,a,h,p,m,g){const x=u.context,w=u.renderPass==="shadow",T=u.shadowRenderer,S=w&&T?T.getShadowPassDepthMode():new s.af(x.gl.LEQUAL,s.af.ReadWrite,u.depthRangeFor3D),I=u.isTileAffectedByFog(m);if(a.meshes)for(const P of a.meshes){const z=["MODEL_POSITION_ON_GPU"],L=[];let k,O,B;h.instancedDataArray.length>20&&z.push("INSTANCED_ARRAYS");const G=ar(u,r.paint.get("model-cutoff-fade-range"));if(G.shouldRenderCutoff&&z.push("RENDER_CUTOFF"),w&&T)k=u.getOrCreateProgram("modelDepth",{defines:z}),O=Qc(g.shadowTileMatrix,g.shadowTileMatrix,Float32Array.from(a.matrix)),B=T.getShadowPassColorMode();else{_o(z,L,P,u,r.lut),k=u.getOrCreateProgram("model",{defines:z,overrideFog:I});const j=P.material,J=j.pbrMetallicRoughness,Z=r.paint.get("model-opacity"),W=r.paint.get("model-emissive-strength").constantOr(0);O=ho(m.expandedProjMatrix,Float32Array.from(a.matrix),new Float32Array(16),null,u,Z,J.baseColorFactor.toRenderColor(null),j.emissiveFactor,J.metallicFactor,J.roughnessFactor,j,W,r,p),T&&(g.shadowUniformsInitialized?k.setShadowUniformValues(x,T.getShadowUniformValues()):(T.setupShadows(m.toUnwrapped(),k,"model-tile",m.overscaledZ),g.shadowUniformsInitialized=!0)),B=G.shouldRenderCutoff||Z<1||j.alphaMode!=="OPAQUE"?s.a.alphaBlended:s.a.unblended}u.uploadCommonUniforms(x,k,m.toUnwrapped(),null,G);const $=P.material.doubleSided?s.ag.disabled:s.ag.backCCW;if(h.instancedDataArray.length>20)L.push(h.instancedDataBuffer),k.draw(u,x.gl.TRIANGLES,S,s.ah.disabled,B,$,O,r.id,P.vertexBuffer,P.indexBuffer,P.segments,r.paint,u.transform.zoom,void 0,L,h.instancedDataArray.length);else{const j=w?"u_instance":"u_normal_matrix";for(let J=0;JT[1]?x:T,g[0]=a.max[0],x=s.aB.transformMat4([],g,m),w=x[1]T[1]?x:T,g[1]=a.min[1],x=s.aB.transformMat4([],g,m),w=x[1]T[1]?x:T;const S=s.au(h[0],0,1),I=100*r.pixelsPerMeter*s.au(h[1],0,1),P=s.au(h[2],0,1),z=s.$.lerp([],w,T,S),L=Math.tan(.5*r.fovX),k=-z[2]*L;if(I===0)return z[1]<-Math.abs(k)?P:1;const O=(-Math.abs(k)-z[1])/I,B=($,j,J)=>(1-J)*$+J*j,G=s.au(B(1,P,O),P,1);return B(1,G,s.au((r.pitch-20)/20,0,1))}class ls{}class Ii{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(r,a,h){{const I=this._storage.get(a.id);if(I)return I.lastUsedFrameIdx=r,I.buf}const p=h.gl,m=p.getBufferParameter(p.ELEMENT_ARRAY_BUFFER,p.BUFFER_SIZE),g=new ArrayBuffer(m),x=new Int16Array(g);p.getBufferSubData(p.ELEMENT_ARRAY_BUFFER,0,new Int16Array(g));const w=new s.co;for(let I=0;I30&&(h.buf.destroy(),this._storage.delete(a))}destroy(){for(const[r,a]of this._storage)a.buf.destroy(),this._storage.delete(r)}}class qr{constructor(r){this.occluderSize=30,this.depthOffset=-1e-4,r.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),r.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const Zr={symbol:function(u,r,a,h,p){if(u.renderPass!=="translucent")return;const m=s.ah.disabled,g=u.colorModeForRenderPass();a.layout.get("text-variable-anchor")&&function(T,S,I,P,z,L,k){const O=S.transform,B=z==="map",G=L==="map";for(const $ of T){const j=P.getTile($),J=j.getBucket(I);if(!J||!J.text||!J.text.segments.get().length)continue;const Z=s.aE(J.textSizeData,O.zoom),W=eu($,J.getProjection(),O),ee=O.calculatePixelsToTileUnitsMatrix(j),ie=Ys(W,j.tileID.canonical,G,B,O,J.getProjection(),ee),ue=J.hasIconTextFit()&&J.hasIconData();if(Z){const re=Math.pow(2,O.zoom-j.tileID.overscaledZ);Ip(J,B,G,k,s.bQ,O,ie,$,re,Z,ue)}}}(h,u,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),p);const x=a.paint.get("icon-opacity").constantOr(1)!==0,w=a.paint.get("text-opacity").constantOr(1)!==0;a.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(x||w)?ha(u,r,a,h,m,g):(x&&ha(u,r,a,h,m,g,{onlyIcons:!0}),w&&ha(u,r,a,h,m,g,{onlyText:!0})),r.map.showCollisionBoxes&&(Lh(u,r,a,h,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),Lh(u,r,a,h,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(u,r,a,h){if(u.renderPass!=="translucent")return;const p=a.paint.get("circle-opacity"),m=a.paint.get("circle-stroke-width"),g=a.paint.get("circle-stroke-opacity"),x=a.layout.get("circle-sort-key").constantOr(1)!==void 0,w=a.paint.get("circle-emissive-strength");if(p.constantOr(1)===0&&(m.constantOr(1)===0||g.constantOr(1)===0))return;const T=u.context,S=T.gl,I=u.transform,P=u.depthModeForSublayer(0,s.af.ReadOnly),z=s.ah.disabled,L=u.colorModeForDrapableLayerRenderPass(w),k=I.projection.name==="globe",O=[s.ak(I.center.lng),s.al(I.center.lat)],B=[];for(let $=0;$$.sortKey-j.sortKey);const G={useDepthForOcclusion:I.depthOcclusionForSymbolsAndCircles};for(const $ of B){const{programConfiguration:j,program:J,layoutVertexBuffer:Z,globeExtVertexBuffer:W,indexBuffer:ee,uniformValues:ie,tile:ue}=$.state,re=$.segments;u.terrain&&u.terrain.setupElevationDraw(ue,J,G),u.uploadCommonUniforms(T,J,ue.tileID.toUnwrapped()),J.draw(u,S.TRIANGLES,P,z,L,s.ag.disabled,ie,a.id,Z,ee,re,a.paint,I.zoom,j,[W])}},heatmap:function(u,r,a,h){if(a.paint.get("heatmap-opacity")!==0)if(u.renderPass==="offscreen"){const p=u.context,m=p.gl,g=s.ah.disabled,x=new s.a([m.ONE,m.ONE,m.ONE,m.ONE],s.C.transparent,[!0,!0,!0,!0]);(function(z,L,k,O){const B=z.gl,G=L.width*O,$=L.height*O;z.activeTexture.set(B.TEXTURE1),z.viewport.set([0,0,G,$]);let j=k.heatmapFbo;if(!j||j&&(j.width!==G||j.height!==$)){j&&j.destroy();const J=B.createTexture();B.bindTexture(B.TEXTURE_2D,J),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_S,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_T,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MIN_FILTER,B.LINEAR),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MAG_FILTER,B.LINEAR),j=k.heatmapFbo=z.createFramebuffer(G,$,!0,null),function(Z,W,ee,ie,ue,re){const Y=Z.gl;Y.texImage2D(Y.TEXTURE_2D,0,Z.extRenderToTextureHalfFloat?Y.RGBA16F:Y.RGBA,ue,re,0,Y.RGBA,Z.extRenderToTextureHalfFloat?Y.HALF_FLOAT:Y.UNSIGNED_BYTE,null),ie.colorAttachment.set(ee)}(z,0,J,j,G,$)}else B.bindTexture(B.TEXTURE_2D,j.colorAttachment.get()),z.bindFramebuffer.set(j.framebuffer)})(p,u,a,u.transform.projection.name==="globe"?.5:.25),p.clear({color:s.C.transparent});const w=u.transform,T=w.projection.name==="globe",S=T?["PROJECTION_GLOBE_VIEW"]:[],I=T?s.ag.frontCCW:s.ag.disabled,P=[s.ak(w.center.lng),s.al(w.center.lat)];for(let z=0;z({u_image:0,u_color_ramp:1,u_opacity:I.paint.get("heatmap-opacity")}))(0,m),m.id,p.viewportBuffer,p.quadTriangleIndexBuffer,p.viewportSegments,m.paint,p.transform.zoom)}(u,a))},line:function(u,r,a,h){if(u.renderPass!=="translucent")return;const p=a.paint.get("line-opacity"),m=a.paint.get("line-width");if(p.constantOr(1)===0||m.constantOr(1)===0)return;const g=a.paint.get("line-emissive-strength"),x=a.paint.get("line-occlusion-opacity"),w=u.context,T=w.gl,S=a.layout.get("line-z-offset"),I=!S.isConstant()||!!S.constantOr(0),P=I?new s.af(u.depthOcclusion?T.GREATER:T.LEQUAL,s.af.ReadOnly,u.depthRangeFor3D):u.depthModeForSublayer(0,s.af.ReadOnly),z=u.colorModeForDrapableLayerRenderPass(g),L=u.terrain&&u.terrain.renderingToTexture,k=L?1:s.e.devicePixelRatio,O=a.paint.get("line-dasharray"),B=O.constantOr(1),G=a.layout.get("line-cap"),$=O.constantOr(null),j=G.constantOr(null),J=a.paint.get("line-pattern"),Z=J.constantOr(1),W=J.constantOr(null),ee=a.paint.get("line-opacity").constantOr(1);let ie=!Z&&ee!==1||u.depthOcclusion&&x>0&&x<1;const ue=a.paint.get("line-gradient"),re=Z?"linePattern":"line",Y=s.bV(a);let _e;if(L&&u.terrain&&u.terrain.clipOrMaskOverlapStencilType()&&(ie=!1),x!==0&&u.depthOcclusion){const se=a.paint._values["line-opacity"];se&&se.value&&se.value.kind==="constant"?_e=se.value:s.w(`Occlusion opacity for layer ${a.id} is supported only when line-opacity isn't data-driven.`)}if(I&&(u.forceTerrainMode=!0),!I&&x!==0&&u.terrain&&!L)return void s.w(`Occlusion opacity for layer ${a.id} is supported on terrain only if the layer has non-zero line-z-offset.`);const fe=ie&&I?u.stencilModeFor3D():s.ah.disabled;for(const se of h){const Ce=r.getTile(se);if(Z&&!Ce.patternsLoaded())continue;const Se=Ce.getBucket(a);if(!Se)continue;u.prepareDrawTile();const he=Se.programConfigurations.get(a.id),ve=u.isTileAffectedByFog(se),ne=u.getOrCreateProgram(re,{config:he,defines:I?[...Y,"ELEVATED"]:Y,overrideFog:ve});if(W&&Ce.imageAtlas){const $e=Ce.imageAtlas.patternPositions[W.toString()];$e&&he.setConstantPatternPositions($e)}if(!Z&&$&&j&&Ce.lineAtlas){const $e=Ce.lineAtlas.getDash($,j);$e&&he.setConstantPatternPositions($e)}let[Me,Ae]=a.paint.get("line-trim-offset");(j==="round"||j==="square")&&Me!==Ae&&(Me===0&&(Me-=1),Ae===1&&(Ae+=1));const Ue=L?se.projMatrix:null,Ge=Z?s.bW(u,Ce,a,Ue,k,[Me,Ae]):s.bX(u,Ce,a,Ue,Se.lineClipsArray.length,k,[Me,Ae]);if(ue){const $e=Se.gradients[a.id];let it=$e.texture;if(a.gradientVersion!==$e.version){let _t=256;if(a.stepInterpolant){const nt=r.getSource().maxzoom,xt=se.canonical.z===nt?Math.ceil(1<{_e!=null&&(_e.value=ee*x),ne.draw(u,T.TRIANGLES,P,$e,z,s.ag.disabled,Ge,a.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,a.paint,u.transform.zoom,he,[Se.layoutVertexBuffer2,Se.patternVertexBuffer,Se.zOffsetVertexBuffer]),_e!=null&&(_e.value=ee)};if(ie&&!I){const $e=u.stencilModeForClipping(se).ref;$e===0&&L&&w.clear({stencil:0});const it={func:T.EQUAL,mask:255};Ge.u_alpha_discard_threshold=.8,He(new s.ah(it,$e,255,T.KEEP,T.KEEP,T.INVERT)),Ge.u_alpha_discard_threshold=0,He(new s.ah(it,$e,255,T.KEEP,T.KEEP,T.KEEP))}else ie&&I&&(Ge.u_alpha_discard_threshold=.001),He(I?fe:u.stencilModeForClipping(se))}ie&&(u.resetStencilClippingMasks(),L&&w.clear({stencil:0})),x===0||u.depthOcclusion||L||u.layersWithOcclusionOpacity.push(u.currentLayer),I&&(u.forceTerrainMode=!1)},fill:function(u,r,a,h){const p=a.paint.get("fill-color"),m=a.paint.get("fill-opacity");if(m.constantOr(1)===0)return;const g=a.paint.get("fill-emissive-strength"),x=u.colorModeForDrapableLayerRenderPass(g),w=a.paint.get("fill-pattern"),T=u.opaquePassEnabledForLayer()&&!w.constantOr(1)&&p.constantOr(s.C.transparent).a===1&&m.constantOr(0)===1?"opaque":"translucent";if(u.renderPass===T){const S=u.depthModeForSublayer(1,u.renderPass==="opaque"?s.af.ReadWrite:s.af.ReadOnly);da(u,r,a,h,S,x,!1)}if(u.renderPass==="translucent"&&a.paint.get("fill-antialias")){const S=u.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,s.af.ReadOnly);da(u,r,a,h,S,x,!0)}},"fill-extrusion":function(u,r,a,h){const p=a.paint.get("fill-extrusion-opacity"),m=u.context,g=m.gl,x=u.terrain,w=x&&x.renderingToTexture;if(p===0)return;const T=u.conflationActive&&u.style.isLayerClipped(a,r.getSource()),S=u.style.order.indexOf(a.fqid);if(T&&function(I,P,z,L,k){for(const O of L){const B=P.getTile(O).getBucket(z);B&&(B.updateReplacement(O,I.replacementSource,k),B.uploadCentroid(I.context))}}(u,r,a,h,S),x||T)for(const I of h){const P=r.getTile(I).getBucket(a);P&&Ap(u.context,r,I,P,a,x,T)}if(u.renderPass==="shadow"&&u.shadowRenderer){const I=u.shadowRenderer;if(x&&p<.65&&a._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof s.Z)return;const P=I.getShadowPassDepthMode(),z=I.getShadowPassColorMode();fo(u,r,a,h,P,s.ah.disabled,z,T)}else if(u.renderPass==="translucent"){const I=!a.paint.get("fill-extrusion-pattern").constantOr(1),P=a.paint.get("fill-extrusion-color").constantOr(s.C.white);if(!w&&P.a!==0){const z=new s.af(u.context.gl.LEQUAL,s.af.ReadWrite,u.depthRangeFor3D);p===1&&I?fo(u,r,a,h,z,s.ah.disabled,s.a.unblended,T):(fo(u,r,a,h,z,s.ah.disabled,s.a.disabled,T),fo(u,r,a,h,z,u.stencilModeFor3D(),u.colorModeForRenderPass(),T),u.resetStencilClippingMasks())}if(u.style.enable3dLights()&&I&&(!x&&u.transform.projection.name!=="globe"||w)){const z=a.paint.get("fill-extrusion-opacity"),L=a.paint.get("fill-extrusion-ambient-occlusion-intensity"),k=a.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),O=a.paint.get("fill-extrusion-flood-light-intensity"),B=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(a.lut).toArray01().slice(0,3),G=L>0&&k>0,$=O>0,j=(Z,W,ee)=>(1-ee)*Z+ee*W,J=Z=>{const W=u.depthModeForSublayer(1,s.af.ReadOnly,g.LEQUAL,!0),ee=a.paint.get(Z?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ie=j(.1,3,ee),ue=u._showOverdrawInspector;if(!ue){const re=new s.ah({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),Y=new s.a([g.ONE,g.ONE,g.ONE,g.ONE],s.C.transparent,[!1,!1,!1,!0],g.MIN);ns(u,r,a,h,W,re,Y,s.ag.disabled,Z,"sdf",z,L,k,O,B,ie,T,!1)}{const re=ue?s.ah.disabled:new s.ah({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),Y=ue?u.colorModeForRenderPass():new s.a([g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA,g.ONE,g.ONE],s.C.transparent,[!0,!0,!0,!0]);ns(u,r,a,h,W,re,Y,s.ag.disabled,Z,"color",z,L,k,O,B,ie,T,!1)}};if(w){const Z=(W,ee,ie)=>{const ue=u.depthModeForSublayer(1,s.af.ReadOnly,g.LEQUAL,!1),re=a.paint.get(W?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Y=j(.1,3,re);{const _e=new s.a([g.ONE,g.ONE,g.ONE,g.ONE],s.C.transparent,[!1,!1,!1,!0]);ns(u,r,a,h,ue,s.ah.disabled,_e,s.ag.disabled,W,"clear",z,L,k,O,B,Y,T,ee)}{const _e=new s.ah({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),fe=new s.a([g.ONE,g.ONE,g.ONE,g.ONE],s.C.transparent,[!1,!1,!1,!0],g.MIN);ns(u,r,a,h,ue,_e,fe,s.ag.disabled,W,"sdf",z,L,k,O,B,Y,T,ee)}{const _e=W?g.ZERO:g.ONE_MINUS_DST_ALPHA,fe=new s.ah({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),se=new s.a([_e,g.DST_ALPHA,g.ONE_MINUS_DST_ALPHA,g.ZERO],s.C.transparent,[!0,!0,!0,!0]);ns(u,r,a,h,ue,fe,se,s.ag.disabled,W,"color",z,L,k,O,B,Y,T,ee)}{const _e=new s.a([g.ONE,g.ONE,g.ONE,W?g.ZERO:g.ONE],s.C.transparent,[!1,!1,!1,!0],W?g.FUNC_ADD:g.MAX);ns(u,r,a,h,ue,s.ah.disabled,_e,s.ag.disabled,W,"clear",z,L,k,O,B,Y,T,ee,ie)}};if(G||$){let W;if(u.prepareDrawTile(),x){const ee=x.drapeBufferSize[0],ie=x.drapeBufferSize[1];W=x.framebufferCopyTexture,W&&(!W||W.size[0]===ee&&W.size[1]===ie)||(W&&W.destroy(),W=x.framebufferCopyTexture=new s.T(m,new s.j({width:ee,height:ie}),g.RGBA)),W.bind(g.LINEAR,g.CLAMP_TO_EDGE),g.copyTexImage2D(g.TEXTURE_2D,0,g.RGBA,0,0,ee,ie,0)}G&&Z(!0,!1,W),$&&Z(!1,!0,W)}}else G&&J(!0),$&&J(!1),(G||$)&&u.resetStencilClippingMasks()}}},hillshade:function(u,r,a,h){if(u.renderPass!=="offscreen"&&u.renderPass!=="translucent"||u.style.disableElevatedTerrain)return;const p=u.context,m=u.terrain&&u.terrain.renderingToTexture,[g,x]=u.renderPass!=="translucent"||m?[{},h]:u.stencilConfigForOverlap(h);for(const w of x){const T=r.getTile(w);if(T.needsHillshadePrepare&&u.renderPass==="offscreen")Tp(u,T,a);else if(u.renderPass==="translucent"){const S=u.depthModeForSublayer(0,s.af.ReadOnly),I=a.paint.get("hillshade-emissive-strength"),P=u.colorModeForDrapableLayerRenderPass(I),z=m&&u.terrain?u.terrain.stencilModeForRTTOverlap(w):g[w.overscaledZ];wp(u,w,T,a,S,z,P)}}p.viewport.set([0,0,u.width,u.height]),u.resetStencilClippingMasks()},raster:function(u,r,a,h,p,m){if(u.renderPass!=="translucent"||a.paint.get("raster-opacity")===0)return;const g=u.transform.projection.name==="globe",x=a.paint.get("raster-elevation")!==0,w=x&&g;if(u.renderElevatedRasterBackface&&!w)return;const T=u.context,S=T.gl,I=r.getSource(),P=function(Z,W,ee,ie){const ue=W.paint.get("raster-color"),re=Z.type==="raster-array",Y=[],_e=W.paint.get("raster-resampling"),fe=W.paint.get("raster-color-mix");let se=W.paint.get("raster-color-range");const Ce=[fe[0],fe[1],fe[2],0],Se=fe[3];let he=_e==="nearest"?ie.NEAREST:ie.LINEAR;if(re&&(Y.push("RASTER_ARRAY"),ue||Y.push("RASTER_COLOR"),_e==="linear"&&Y.push("RASTER_ARRAY_LINEAR"),he=ie.NEAREST,!se&&Z.rasterLayers)){const ve=Z.rasterLayers.find(({id:ne})=>ne===W.sourceLayer);ve&&ve.fields&&ve.fields.range&&(se=ve.fields.range)}if(se=se||[0,1],ue){Y.push("RASTER_COLOR"),ee.activeTexture.set(ie.TEXTURE2),W.updateColorRamp(se);let ve=W.colorRampTexture;ve||(ve=W.colorRampTexture=new s.T(ee,W.colorRamp,ie.RGBA)),ve.bind(ie.LINEAR,ie.CLAMP_TO_EDGE)}return{mix:Ce,range:se,offset:Se,defines:Y,resampling:he}}(I,a,T,S);if(I instanceof s.bo&&!h.length&&!g)return;const z=a.paint.get("raster-emissive-strength"),L=u.colorModeForDrapableLayerRenderPass(z),k=u.terrain&&u.terrain.renderingToTexture,O=!u.options.moving,B=a.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;if(I instanceof s.bo&&!h.length&&(I.onNorthPole||I.onSouthPole)){const Z=x?u.stencilModeFor3D():s.ah.disabled;return void Cl(!!I.onNorthPole,null,u,r,a,z,P,s.ag.disabled,Z)}if(!h.length)return;const[G,$]=I instanceof s.bo||k?[{},h]:u.stencilConfigForOverlap(h),j=$[$.length-1].overscaledZ;w&&P.defines.push("PROJECTION_GLOBE_VIEW"),x&&P.defines.push("RENDER_CUTOFF");const J=(Z,W,ee)=>{for(const ie of Z){const ue=ie.toUnwrapped(),re=r.getTile(ie);if(k&&(!re||!re.hasData()))continue;T.activeTexture.set(S.TEXTURE0);const Y=mo(re,I,a,P);if(!Y||!Y.texture)continue;const{texture:_e,mix:fe,offset:se,tileSize:Ce,buffer:Se}=Y;let he,ve;k?(he=s.af.disabled,ve=ie.projMatrix):x?(he=new s.af(S.LEQUAL,s.af.ReadWrite,u.depthRangeFor3D),ve=g?Float32Array.from(u.transform.expandedFarZProjMatrix):u.transform.calculateProjMatrix(ue,O)):(he=u.depthModeForSublayer(ie.overscaledZ-j,a.paint.get("raster-opacity")===1?s.af.ReadWrite:s.af.ReadOnly,S.LESS),ve=u.transform.calculateProjMatrix(ue,O));const ne=u.terrain&&k?u.terrain.stencilModeForRTTOverlap(ie):G[ie.overscaledZ],Me=m?0:a.paint.get("raster-fade-duration");re.registerFadeDuration(Me);const Ae=r.findLoadedParent(ie,0),Ue=vl(re,Ae,r,u.transform,Me);let Ge,He;u.terrain&&u.terrain.prepareDrawTile(),T.activeTexture.set(S.TEXTURE0),_e.bind(B,S.CLAMP_TO_EDGE),T.activeTexture.set(S.TEXTURE1),Ae?(Ae.texture&&Ae.texture.bind(B,S.CLAMP_TO_EDGE),Ge=Math.pow(2,Ae.tileID.overscaledZ-re.tileID.overscaledZ),He=[re.tileID.canonical.x*Ge%1,re.tileID.canonical.y*Ge%1]):_e.bind(B,S.CLAMP_TO_EDGE),_e.useMipmap&&T.extTextureFilterAnisotropic&&u.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const $e=u.transform;let it;const _t=x?iu($e):[0,0,0,0];let nt,xt,Ct,ii,Jt,Pt=0;if(w&&I instanceof s.bo&&I.coordinates.length>3)nt=Float32Array.from(s.bh(s.bi(new s.aO(0,0,0)))),xt=Float32Array.from($e.globeMatrix),Ct=Float32Array.from(s.bd($e)),ii=[s.ak($e.center.lng),s.al($e.center.lat)],it=I.elevatedGlobePerspectiveTransform,Jt=I.elevatedGlobeGridMatrix||new Float32Array(9);else if(w){const gt=s.be(ie.canonical);Pt=s.bf(gt.getCenter().lat),nt=Float32Array.from(s.bh(s.bi(ie.canonical))),xt=Float32Array.from($e.globeMatrix),Ct=Float32Array.from(s.bd($e)),ii=[s.ak($e.center.lng),s.al($e.center.lat)],it=[0,0],Jt=Float32Array.from(s.bg(ie.canonical,gt,Pt,$e.worldSize/$e._pixelsPerMercatorPixel))}else it=I instanceof s.bo?I.perspectiveTransform:[0,0],nt=new Float32Array(16),xt=new Float32Array(9),Ct=new Float32Array(16),ii=[0,0],Jt=new Float32Array(9);const Xt=Il(ve,nt,xt,Ct,Jt,He||[0,0],s.a2(u.transform.zoom),ii,_t,Ge||1,Ue,a,it,x?a.paint.get("raster-elevation"):0,2,fe,se,P.range,Ce,Se,z),Tt=u.isTileAffectedByFog(ie),St=u.getOrCreateProgram("raster",{defines:P.defines,overrideFog:Tt});if(u.uploadCommonUniforms(T,St,ue),I instanceof s.bo){const gt=I.elevatedGlobeVertexBuffer,Ot=I.elevatedGlobeIndexBuffer;if(k||!g)I.boundsBuffer&&I.boundsSegments&&St.draw(u,S.TRIANGLES,he,s.ah.disabled,L,s.ag.disabled,Xt,a.id,I.boundsBuffer,u.quadTriangleIndexBuffer,I.boundsSegments);else if(gt&&Ot){const Mt=$e.zoom<=s.b3?I.elevatedGlobeSegments:I.getSegmentsForLongitude($e.center.lng);Mt&&St.draw(u,S.TRIANGLES,he,s.ah.disabled,L,W,Xt,a.id,gt,Ot,Mt)}}else if(w){he=new s.af(S.LEQUAL,s.af.ReadOnly,u.depthRangeFor3D);const gt=u.globeSharedBuffers;if(gt){const[Ot,Mt,at]=gt.getGridBuffers(Pt,!1);St.draw(u,S.TRIANGLES,he,ee||ne,u.colorModeForRenderPass(),W,Xt,a.id,Ot,Mt,at)}}else{const{tileBoundsBuffer:gt,tileBoundsIndexBuffer:Ot,tileBoundsSegments:Mt}=u.getTileBoundsBuffers(re);St.draw(u,S.TRIANGLES,he,ne,L,s.ag.disabled,Xt,a.id,gt,Ot,Mt)}}if(!(I instanceof s.bo)&&w)for(const ie of Z){const ue=ie.canonical.y===(1<>>16,2654435769),((ie=Math.imul(ie^ie>>>16,2654435769))>>>0)/4294967296},ee=1/1.1;for(let ie=0;ies.b$[ne](_e));Se.push(_e);const he=_e.canonical.x,ve=_e.canonical.y;for(const ne of Se){const Me=j.getTile(ue?ne.wrapped():ne);if(!Me)continue;const Ae=Me.rasterParticleState;if(!Ae)continue;const Ue=ne.canonical.x+(1<j.tileID)),I&&(x.activeTexture.set(w.TEXTURE0),u.imageManager.bind(u.context,a.scope));for(const j of $){const J=u.isTileAffectedByFog(j),Z=u.getOrCreateProgram(B,{overrideFog:J}),W=j.toUnwrapped(),ee=h?j.projMatrix:u.transform.calculateProjMatrix(W);u.prepareDrawTile();const ie=r?r.getTile(j):G?G[j.key]:new s.bA(j,S,T.zoom,u),ue=I?Mp(ee,g,m,u,0,a.scope,P,{tileID:j,tileSize:S}):Kc(ee,g,m,p.toRenderColor(a.lut));u.uploadCommonUniforms(x,Z,W);const{tileBoundsBuffer:re,tileBoundsIndexBuffer:Y,tileBoundsSegments:_e}=u.getTileBoundsBuffers(ie);Z.draw(u,w.TRIANGLES,k,L,O,s.ag.disabled,ue,a.id,re,Y,_e)}},sky:function(u,r,a){const h=u._atmosphere?s.a2(u.transform.zoom):1,p=a.paint.get("sky-opacity")*h;if(p===0)return;const m=u.context,g=a.paint.get("sky-type"),x=new s.af(m.gl.LEQUAL,s.af.ReadOnly,[0,1]),w=u.frameCounter/1e3%1;g==="atmosphere"?u.renderPass==="offscreen"?a.needsSkyboxCapture(u)&&(function(T,S,I,P){const z=T.context,L=z.gl;let k=S.skyboxFbo;if(!k){k=S.skyboxFbo=z.createFramebuffer(32,32,!0,null),S.skyboxGeometry=new We(z),S.skyboxTexture=z.gl.createTexture(),L.bindTexture(L.TEXTURE_CUBE_MAP,S.skyboxTexture),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MIN_FILTER,L.LINEAR),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MAG_FILTER,L.LINEAR);for(let $=0;$<6;++$)L.texImage2D(L.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,L.RGBA,32,32,0,L.RGBA,L.UNSIGNED_BYTE,null)}z.bindFramebuffer.set(k.framebuffer),z.viewport.set([0,0,32,32]);const O=S.getCenter(T,!0),B=T.getOrCreateProgram("skyboxCapture"),G=new Float64Array(16);s.ae.identity(G),s.ae.rotateY(G,G,.5*-Math.PI),Lt(T,S,B,G,O,0),s.ae.identity(G),s.ae.rotateY(G,G,.5*Math.PI),Lt(T,S,B,G,O,1),s.ae.identity(G),s.ae.rotateX(G,G,.5*-Math.PI),Lt(T,S,B,G,O,2),s.ae.identity(G),s.ae.rotateX(G,G,.5*Math.PI),Lt(T,S,B,G,O,3),s.ae.identity(G),Lt(T,S,B,G,O,4),s.ae.identity(G),s.ae.rotateY(G,G,Math.PI),Lt(T,S,B,G,O,5),z.viewport.set([0,0,T.width,T.height])}(u,a),a.markSkyboxValid(u)):u.renderPass==="sky"&&function(T,S,I,P,z){const L=T.context,k=L.gl,O=T.transform,B=T.getOrCreateProgram("skybox");L.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_CUBE_MAP,S.skyboxTexture);const G=(($,j,J,Z,W)=>({u_matrix:$,u_sun_direction:j,u_cubemap:0,u_opacity:Z,u_temporal_offset:W}))(O.skyboxMatrix,S.getCenter(T,!1),0,P,z);T.uploadCommonUniforms(L,B),B.draw(T,k.TRIANGLES,I,s.ah.disabled,T.colorModeForRenderPass(),s.ag.backCW,G,"skybox",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(u,a,x,p,w):g==="gradient"&&u.renderPass==="sky"&&function(T,S,I,P,z){const L=T.context,k=L.gl,O=T.transform,B=T.getOrCreateProgram("skyboxGradient");S.skyboxGeometry||(S.skyboxGeometry=new We(L)),L.activeTexture.set(k.TEXTURE0);let G=S.colorRampTexture;G||(G=S.colorRampTexture=new s.T(L,S.colorRamp,k.RGBA)),G.bind(k.LINEAR,k.CLAMP_TO_EDGE);const $=((j,J,Z,W,ee)=>({u_matrix:j,u_color_ramp:0,u_center_direction:J,u_radius:s.ac(Z),u_opacity:W,u_temporal_offset:ee}))(O.skyboxMatrix,S.getCenter(T,!1),S.paint.get("sky-gradient-radius"),P,z);T.uploadCommonUniforms(L,B),B.draw(T,k.TRIANGLES,I,s.ah.disabled,T.colorModeForRenderPass(),s.ag.backCW,$,"skyboxGradient",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(u,a,x,p,w)},debug:function(u,r,a,h,p,m){for(let g=0;g{g&&(g.useNormalOffset=!0,x||(g.enabled=!0))},T=r.getSource();if(u.renderPass==="light-beam"&&T.type!=="batched-model")return;if(T.type==="vector"||T.type==="geojson")return function(B,G,$,j,J){const Z=B.transform;if(Z.projection.name!=="mercator")return void s.w(`Drawing 3D models for ${Z.projection.name} projection is not yet implemented`);const W=Z.getFreeCameraOptions().position;if(!B.modelManager)return;const ee=B.modelManager;$.modelManager=ee;const ie=B.shadowRenderer;if(!$._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const ue=$._unevaluatedLayout._values["model-id"],re={...$.layout.get("model-id").parameters},Y=B.style.order.indexOf($.fqid);for(const _e of j){const fe=G.getTile(_e).getBucket($);if(!fe||fe.projection.name!==Z.projection.name)continue;const se=fe.getModelUris();se&&!fe.modelsRequested&&(ee.addModelsFromBucket(se,J),fe.modelsRequested=!0);const Ce=_a(_e,Z);re.zoom=Ce;const Se=ue.possiblyEvaluate(re);if(ma(B,fe,_e),Lr.shadowUniformsInitialized=!1,Lr.useSingleShadowCascade=!!ie&&ie.getMaxCascadeForTile(_e.toUnwrapped())===0,B.renderPass==="shadow"&&ie){if(B.currentShadowCascade===1&&fe.isInsideFirstShadowMapFrustum)continue;const ne=Z.calculatePosMatrix(_e.toUnwrapped(),Z.worldSize);if(Lr.tileMatrix.set(ne),Lr.shadowTileMatrix=Float32Array.from(ie.calculateShadowPassMatrixFromMatrix(ne)),Lr.aabb.min.fill(0),Lr.aabb.max[0]=Lr.aabb.max[1]=s.a4,Lr.aabb.max[2]=0,ir(fe,Lr,B,$.scope))continue}const he=1<<_e.canonical.z,ve=[((W.x-_e.wrap)*he-_e.canonical.x)*s.a4,(W.y*he-_e.canonical.y)*s.a4,W.z*he*s.a4];B.conflationActive&&Object.keys(fe.instancesPerModel).length>0&&B.style.isLayerClipped($,G.getSource())&&fe.updateReplacement(_e,B.replacementSource,Y,J)&&(fe.uploaded=!1,fe.upload(B.context));for(let ne in fe.instancesPerModel){const Me=fe.instancesPerModel[ne];Me.features.length>0&&(ne=Se.evaluate(Me.features[0].feature,{}));const Ae=ee.getModel(ne,J);if(Ae&&Ae.uploaded)for(const Ue of Ae.nodes)Rl(B,$,Ue,Me,ve,_e,Lr)}}}(u,r,a,h,T.type==="vector"?a.scope:""),void w();if(!T.loaded())return;if(T.type==="batched-model")return function(B,G,$,j){$.resetLayerRenderingStats(B);const J=B.context,Z=B.transform,W=B.style.fog,ee=B.shadowRenderer;if(Z.projection.name!=="mercator")return void s.w(`Drawing 3D landmark models for ${Z.projection.name} projection is not yet implemented`);const ie=B.transform.getFreeCameraOptions().position,ue=s.$.scale([],[ie.x,ie.y,ie.z],B.transform.worldSize);s.$.negate(ue,ue);const re=s.ae.identity([]),Y=s.ci(Z.center.lat,Z.zoom),_e=s.ae.fromScaling([],[1,1,1/Y]);s.ae.translate(re,re,ue);const fe=$.paint.get("model-opacity"),se=new s.af(J.gl.LEQUAL,s.af.ReadWrite,B.depthRangeFor3D),Ce=new s.af(J.gl.LEQUAL,s.af.ReadOnly,B.depthRangeFor3D),Se=new s.b8([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),he=B.renderPass==="shadow",ve=he&&ee?ee.getCurrentCascadeFrustum():Z.getFrustum(Z.scaleZoom(Z.worldSize)),ne=$.paint.get("model-front-cutoff"),Me=ne[2]<1,Ae=ar(B,$.paint.get("model-cutoff-fade-range")),Ue=$.getLayerRenderingStats();(function(Ge,He,$e,it){const _t=Ge.terrain?Ge.terrain.exaggeration():0,nt=Ge.transform.zoom;for(const xt of it){const Ct=He.getTile(xt).getBucket($e);Ct&&(Ge.conflationActive&&Ct.updateReplacement(xt,Ge.replacementSource),Ct.evaluateScale(Ge,$e),Ge.terrain&&_t>0&&Ct.elevationUpdate(Ge.terrain,_t,xt,$e.source),Ct.needsReEvaluation(Ge,nt,$e)&&Ct.evaluate($e))}})(B,G,$,j),function(){let Ge,He,$e;Me?(Ge=j.length-1,He=-1,$e=-1):(Ge=0,He=j.length,$e=1);for(let it=Ge;it!==He;it+=$e){const _t=j[it],nt=G.getTile(_t).getBucket($);if(!nt||!nt.uploaded)continue;let xt=!1;ee&&(xt=ee.getMaxCascadeForTile(_t.toUnwrapped())===0);const Ct=Z.calculatePosMatrix(_t.toUnwrapped(),Z.worldSize),ii=nt.modelTraits,Jt=[];for(const Pt of nt.getNodesInfo()){if(Pt.hiddenByReplacement||!Pt.node.meshes)continue;const Xt=Pt.node;let Tt=0;B.terrain&&Xt.elevation&&(Tt=Xt.elevation*B.terrain.exaggeration());const St=Pt.evaluatedScale;if(St[0]<=1&&St[1]<=1&&St[2]<=1&&(()=>{const Fi=Pt.aabb;return Se.min=[...Fi.min],Se.max=[...Fi.max],Se.min[2]+=Tt,Se.max[2]+=Tt,s.$.transformMat4(Se.min,Se.min,Ct),s.$.transformMat4(Se.max,Se.max,Ct),Se})().intersects(ve)===0)continue;const gt=[...Ct],Ot=Xt.anchor?Xt.anchor[0]:0,Mt=Xt.anchor?Xt.anchor[1]:0;s.ae.translate(gt,gt,[Ot*(St[0]-1),Mt*(St[1]-1),Tt]),s.$.exactEquals(St,s.cl)||s.ae.scale(gt,gt,St);const at=s.ae.multiply([],gt,Xt.matrix),bi=s.ae.multiply([],Z.expandedFarZProjMatrix,at),wi=s.ae.multiply([],Z.expandedFarZProjMatrix,gt),Xi=s.aB.transformMat4([],[Ot,Mt,Tt,1],bi)[2];Xt.hidden=!1;let Yi=fe;he||(Me&&(Yi*=Nh(gt,Z,Pt.aabb,ne)),Yi*=_r(Ae,Xi)),Yi!==0?Jt.push({nodeInfo:Pt,depth:Xi,opacity:Yi,wvpForNode:bi,wvpForTile:wi,nodeModelMatrix:at,tileModelMatrix:gt}):Xt.hidden=!0}he||Jt.sort((Pt,Xt)=>!Me||Pt.opacity===1&&Xt.opacity===1?Pt.depthXt.depth?-1:1);for(const Pt of Jt){const Xt=Pt.nodeInfo,Tt=Xt.node;let St=s.ae.multiply([],_e,Pt.tileModelMatrix);s.ae.multiply(St,re,St);const gt=s.ae.invert([],St);s.ae.transpose(gt,gt),s.ae.scale(gt,gt,Ll),St=s.ae.multiply(St,St,Tt.matrix);const Ot=B.renderPass==="light-beam",Mt=ii&s.cn.HasMapboxMeshFeatures,at=Mt?0:Xt.evaluatedRMEA[0][2];for(let bi=0;bi=Ft||vn>=Ft}}const Ni=wi.material;let Le;Ni.occlusionTexture&&Ni.occlusionTexture.offsetScale&&(Le=Ni.occlusionTexture.offsetScale,Fi.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),!he&&ee&&(ee.useNormalOffset=!!wi.normalBuffer);const Ye=B.getOrCreateProgram("model",Fi);!he&&ee&&ee.setupShadowsFromMatrix(Pt.tileModelMatrix,Ye,ee.useNormalOffset),B.uploadCommonUniforms(J,Ye,null,Li);const rr=Ni.pbrMetallicRoughness;rr.metallicFactor=.9,rr.roughnessFactor=.5;const ei=ho(new Float32Array(Yi),new Float32Array(St),new Float32Array(gt),new Float32Array(Tt.matrix),B,Pt.opacity,rr.baseColorFactor.toRenderColor(null),Ni.emissiveFactor,rr.metallicFactor,rr.roughnessFactor,Ni,at,$,[0,0,0],Le);!Xi&&(Xt.hasTranslucentParts||Pt.opacity<1)&&Ye.draw(B,J.gl.TRIANGLES,se,s.ah.disabled,s.a.disabled,s.ag.backCCW,ei,$.id,wi.vertexBuffer,wi.indexBuffer,wi.segments,$.paint,B.transform.zoom,void 0,Ji),Ye.draw(B,J.gl.TRIANGLES,Xi?Ce:se,s.ah.disabled,Xi||Pt.opacity<1||Xt.hasTranslucentParts?s.a.alphaBlended:s.a.unblended,s.ag.backCCW,ei,$.id,wi.vertexBuffer,wi.indexBuffer,wi.segments,$.paint,B.transform.zoom,void 0,Ji)}}}}()}(u,r,a,h),void w();if(T.type!=="model")return;const S=T.getModels(),I=[],P=u.transform.getFreeCameraOptions().position,z=s.$.scale([],[P.x,P.y,P.z],u.transform.worldSize);s.$.negate(z,z);const L=[],k=[];let O=0;for(const B of S){const G=a.paint.get("model-rotation").constantOr(null),$=a.paint.get("model-scale").constantOr(null),j=a.paint.get("model-translation").constantOr(null);B.computeModelMatrix(u,G,$,j,!0,!0,!1);const J=s.ae.identity([]),Z=s.ci(B.position.lat,u.transform.zoom),W=s.ae.fromScaling([],[1,1,1/Z]);s.ae.translate(J,J,z),I.push({zScaleMatrix:W,negCameraPosMatrix:J});for(const ee of B.nodes)mi(u.transform,ee,B.matrix,u.transform.expandedFarZProjMatrix,O,L,k);O++}if(L.sort((B,G)=>G.depth-B.depth),u.renderPass!=="shadow"){if(p===1)for(const B of k)Wi(B,u,a,I[B.modelIndex],s.ah.disabled,u.colorModeForRenderPass());else{for(const B of k)Wi(B,u,a,I[B.modelIndex],s.ah.disabled,s.a.disabled);for(const B of k)Wi(B,u,a,I[B.modelIndex],u.stencilModeFor3D(),u.colorModeForRenderPass());u.resetStencilClippingMasks()}for(const B of L)Wi(B,u,a,I[B.modelIndex],s.ah.disabled,u.colorModeForRenderPass());w()}else{for(const B of k)au(B.mesh,B.nodeModelMatrix,u,a);for(const B of L)au(B.mesh,B.nodeModelMatrix,u,a);w()}}},Ci={model:function(u,r,a){const h=r.getSource();if(!h.loaded())return;if(h.type==="vector"||h.type==="geojson")return void(a.modelManager&&a.modelManager.upload(a,h.type==="vector"?u.scope:""));if(h.type==="batched-model"||h.type!=="model")return;const p=h.getModels();for(const m of p)m.upload(a.context)},raster:function(u,r,a){const h=r.getSource();if(!(h instanceof Un&&h.loaded()))return;const p=u.sourceLayer||h.rasterLayerIds&&h.rasterLayerIds[0];if(!p)return;const m=u.paint.get("raster-array-band")||h.getInitialBand(p);if(m==null)return;const g=r.getIds().map(x=>r.getTileByID(x));for(const x of g)x.updateNeeded(p,m)&&h.prepareTile(x,p,m)},"raster-particle":function(u,r,a){const h=r.getSource();if(!(h instanceof Un&&h.loaded()))return;const p=u.sourceLayer||h.rasterLayerIds&&h.rasterLayerIds[0];if(!p)return;const m=u.paint.get("raster-particle-array-band")||h.getInitialBand(p);if(m==null)return;const g=r.getIds().map(x=>r.getTileByID(x));for(const x of g)x.updateNeeded(p,m)&&h.prepareTile(x,p,m)}};class lu{constructor(r,a,h,p){this.context=new Fo(r,a),this.transform=h,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=p,this._timeStamp=s.e.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const m=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const x of m)this._debugParams.enabledLayers[x]=!0;p.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),p.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),p.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const x of m)p.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],x);this.occlusionParams=new qr(p),this.setup(),this.numSublayers=s.bx.maxUnderzooming+s.bx.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new s.cp,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Ep(this),this._wireframeDebugCache=new Ii,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const g=new s.j({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new s.T(this.context,g,r.RGBA)}updateTerrain(r,a){const h=!!r&&!!r.terrain&&this.transform.projection.supportsTerrain;if(!(h||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Zi(this,r));const p=this._terrain;this.transform.elevation=h?p:null,p.update(r,this.transform,a),this.transform.elevation&&!p.enabled&&(this.transform.elevation=null)}_updateFog(r){const a=r.fog;if(!a||this.transform.projection.name==="globe"||a.getOpacity(this.transform.pitch)<1||a.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[h,p]=a.getFovAdjustedRange(this.transform._fov);if(h>p)return void(this.transform.fogCullDistSq=null);const m=h+.78*(p-h);this.transform.fogCullDistSq=m*m}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(r){r&&!this._terrain&&(this._terrain=new Zi(this,this.style)),this._forceTerrainMode=r}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(r,a){if(this.width=r*s.e.devicePixelRatio,this.height=a*s.e.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const h of this.style.order)this.style._mergedLayers[h].resize()}setup(){const r=this.context,a=new s.bv;a.emplaceBack(0,0),a.emplaceBack(s.a4,0),a.emplaceBack(0,s.a4),a.emplaceBack(s.a4,s.a4),this.tileExtentBuffer=r.createVertexBuffer(a,s.bt.members),this.tileExtentSegments=s.b.simpleSegment(0,0,4,2);const h=new s.bv;h.emplaceBack(0,0),h.emplaceBack(s.a4,0),h.emplaceBack(0,s.a4),h.emplaceBack(s.a4,s.a4),this.debugBuffer=r.createVertexBuffer(h,s.bt.members),this.debugSegments=s.b.simpleSegment(0,0,4,5);const p=new s.bv;p.emplaceBack(-1,-1),p.emplaceBack(1,-1),p.emplaceBack(-1,1),p.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(p,s.bt.members),this.viewportSegments=s.b.simpleSegment(0,0,4,2);const m=new s.cq;m.emplaceBack(0,0,0,0),m.emplaceBack(s.a4,0,s.a4,0),m.emplaceBack(0,s.a4,0,s.a4),m.emplaceBack(s.a4,s.a4,s.a4,s.a4),this.mercatorBoundsBuffer=r.createVertexBuffer(m,s.cr.members),this.mercatorBoundsSegments=s.b.simpleSegment(0,0,4,2);const g=new s.bw;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(g);const x=new s.cs;for(const T of[0,1,3,2,0])x.emplaceBack(T);this.debugIndexBuffer=r.createIndexBuffer(x),this.emptyTexture=new s.T(r,new s.j({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA),this.identityMat=s.ae.create();const w=this.context.gl;this.stencilClearMode=new s.ah({func:w.ALWAYS,mask:0},0,255,w.ZERO,w.ZERO,w.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(r){return r._makeTileBoundsBuffers(this.context,this.transform.projection),r._tileBoundsBuffer?{tileBoundsBuffer:r._tileBoundsBuffer,tileBoundsIndexBuffer:r._tileBoundsIndexBuffer,tileBoundsSegments:r._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,r.TRIANGLES,s.af.disabled,this.stencilClearMode,s.a.disabled,s.ag.disabled,na(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,a,h){if(!a||this.currentStencilSource===a.id||!r.isTileClipped()||!h||h.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let x=!1;for(const w of h)if(this._tileClippingMaskIDs[w.key]===void 0){x=!0;break}if(!x)return}this.currentStencilSource=a.id;const p=this.context,m=p.gl;this.nextStencilID+h.length>256&&this.clearStencil(),p.setColorMode(s.a.disabled),p.setDepthMode(s.af.disabled);const g=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const x of h){const w=a.getTile(x),T=this._tileClippingMaskIDs[x.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:I,tileBoundsSegments:P}=this.getTileBoundsBuffers(w);g.draw(this,m.TRIANGLES,s.af.disabled,new s.ah({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),s.a.disabled,s.ag.disabled,na(x.projMatrix),"$clipping",S,I,P)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,a=this.context.gl;return new s.ah({func:a.NOTEQUAL,mask:255},r,255,a.KEEP,a.KEEP,a.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const a=this.context.gl;return new s.ah({func:a.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,a.KEEP,a.KEEP,a.REPLACE)}stencilConfigForOverlap(r){const a=this.context.gl,h=r.sort((g,x)=>x.overscaledZ-g.overscaledZ),p=h[h.length-1].overscaledZ,m=h[0].overscaledZ-p+1;if(m>1){this.currentStencilSource=void 0,this.nextStencilID+m>256&&this.clearStencil();const g={};for(let x=0;xthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((r,a)=>r+a/this._fpsHistory.length,0))}render(r,a){const h=s.e.now();this._dt=h-this._timeStamp,this._timeStamp=h,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=r.map.repaint,this.style=r,this.options=a;const p=this.style._mergedLayers,m=this.style.order.filter(re=>{const Y=p[re];return!(Y.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Y.type]});let g=!1,x=!1;for(const re of m){const Y=p[re];Y.type==="circle"&&(g=!0),Y.type==="symbol"&&(Y.hasInitialOcclusionOpacityProperties?x=!0:g=!0)}const w=m.map(re=>p[re]),T=this.style._mergedSourceCaches;this.imageManager=r.imageManager,this.modelManager=r.modelManager,this.symbolFadeChange=r.placement.symbolFadeChange(s.e.now()),this.imageManager.beginFrame();let S=0,I=!1;for(const re in T){const Y=T[re];Y.used&&(Y.prepare(this.context),Y.getSource().usedInConflation&&++S)}let P=!1;for(const re of w)re.isHidden(this.transform.zoom)||(re.type==="clip"&&(P=!0),this.prepareLayer(re));const z={},L={},k={},O={},B={};for(const re in T){const Y=T[re];z[re]=Y.getVisibleCoordinates(),L[re]=z[re].slice().reverse(),k[re]=Y.getVisibleCoordinates(!0).reverse(),O[re]=Y.getShadowCasterCoordinates(),B[re]=Y.sortCoordinatesByDistance(z[re])}const G=re=>{const Y=this.style.getLayerSourceCache(re);return Y&&Y.used?Y.getSource():null};if(S||P){const re=[],Y=[];let _e=0;for(const fe of w)this.isSourceForClippingOrConflation(fe,G(fe))&&(re.push(fe),Y.push(_e)),_e++;if(re&&(P||re.length>1)){const fe=[];for(let se=0;se0){const fe=G(Y);fe&&(this.minCutoffZoom=Math.max(fe.minzoom,this.minCutoffZoom)),Y.minzoom&&(this.minCutoffZoom=Math.max(Y.minzoom,this.minCutoffZoom))}Y.is3D()&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=re),this._lastOcclusionLayer=re)}const $=this.style&&this.style.fog;$?(this._fogVisible=$.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=$.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(k),this.opaquePassCutoff=0);const j=this._shadowRenderer;if(j){j.updateShadowParameters(this.transform,this.style.directionalLight);for(const re in T)for(const Y of z[re]){let _e={min:0,max:0};this.terrain&&(_e=this.terrain.getMinMaxForTile(Y)||_e),j.addShadowReceiver(Y.toUnwrapped(),_e.min,_e.max)}}if(this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new s.ct(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Dl(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!s.cu(this.context.gl))return;this.renderPass="offscreen";for(const re of w){const Y=r.getLayerSourceCache(re);if(!re.hasOffscreenPass()||re.isHidden(this.transform.zoom))continue;const _e=Y?L[Y.id]:void 0;(re.type==="custom"||re.type==="raster"||re.type==="raster-particle"||re.isSky()||_e&&_e.length)&&this.renderLayer(this,Y,re,_e)}this.depthRangeFor3D=[0,1-(w.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,O)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const J=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Z=(()=>{if(a.showOverdrawInspector)return s.C.black;const re=this.style.fog;if(re&&this.transform.projection.supportsFog){const Y=this.style.getLut(re.scope);if(!J){const _e=re.properties.get("color").toRenderColor(Y).toArray01();return new s.C(..._e)}if(J){const _e=re.properties.get("space-color").toRenderColor(Y).toArray01();return new s.C(..._e)}}return s.C.transparent})();if(this.context.clear({color:Z,depth:1}),this.clearStencil(),this._showOverdrawInspector=a.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&J&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const re=w[this.currentLayer],Y=r.getLayerSourceCache(re);if(re.isSky())continue;const _e=Y?(re.is3D()?B:L)[Y.id]:void 0;this._renderTileClippingMasks(re,Y,_e),this.renderLayer(this,Y,re,_e)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&J&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||s.a2(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer0&&re.hasShadowPass()&&--ee==0&&(j.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const _e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=_e;this.currentLayer++){const fe=w[this.currentLayer];if(!fe.hasLightBeamPass())continue;const se=r.getLayerSourceCache(fe);this.renderLayer(this,se,fe,se?L[se.id]:void 0)}this.currentLayer=_e,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const _e=this.currentLayer;this.depthOcclusion=!0;for(const fe of this.layersWithOcclusionOpacity){this.currentLayer=fe;const se=w[this.currentLayer],Ce=r.getLayerSourceCache(se),Se=Ce?L[Ce.id]:void 0;se.is3D()||this.terrain||this._renderTileClippingMasks(se,Ce,Ce?z[Ce.id]:void 0),this.renderLayer(this,Ce,se,Se)}this.depthOcclusion=!1,this.currentLayer=_e,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let re=null;w.forEach(Y=>{const _e=r.getLayerSourceCache(Y);_e&&!Y.isHidden(this.transform.zoom)&&_e.getVisibleCoordinates().length&&(!re||re.getSource().maxzoom<_e.getSource().maxzoom)&&(re=_e)}),re&&this.options.showTileBoundaries&&Zr.debug(this,re,re.getVisibleCoordinates(),s.C.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&Zr.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new s.C(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(re){const Y=re.transform.padding;ou(re,re.transform.height-(Y.top||0),3,ru),ou(re,Y.bottom||0,3,zl),fa(re,Y.left||0,3,nu),fa(re,re.transform.width-(Y.right||0),3,Ut);const _e=re.transform.centerPoint;(function(fe,se,Ce,Se){os(fe,se-1,Ce-10,2,20,Se),os(fe,se-10,Ce-1,20,2,Se)})(re,_e.x,re.transform.height-_e.y,Pp)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),I||(this.conflationActive=!1)}prepareLayer(r){this.gpuTimingStart(r);const{unsupportedLayers:a}=this.transform.projection,h=!a||!a.includes(r.type);if(Ci[r.type]&&(h||this.terrain&&r.type==="custom")){const p=this.style.getLayerSourceCache(r);Ci[r.type](r,p,this)}this.gpuTimingEnd()}renderLayer(r,a,h,p){h.isHidden(this.transform.zoom)||(h.type==="background"||h.type==="sky"||h.type==="custom"||h.type==="model"||h.type==="raster"||h.type==="raster-particle"||p&&p.length)&&(this.id=h.id,this.gpuTimingStart(h),r.transform.projection.unsupportedLayers&&r.transform.projection.unsupportedLayers.includes(h.type)&&(!r.terrain||h.type!=="custom")||h.type==="clip"||Zr[h.type](r,a,h,p,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(r){if(!this.options.gpuTiming)return;const a=this.context.extTimerQuery,h=this.context.gl;let p=this.gpuTimers[r.id];p||(p=this.gpuTimers[r.id]={calls:0,cpuTime:0,query:h.createQuery()}),p.calls++,h.beginQuery(a.TIME_ELAPSED_EXT,p.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const r=this.context.extTimerQuery,a=this.context.gl,h=a.createQuery();this.deferredRenderGpuTimeQueries.push(h),a.beginQuery(r.TIME_ELAPSED_EXT,h)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const r=this.gpuTimers;return this.gpuTimers={},r}collectDeferredRenderGpuQueries(){const r=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],r}queryGpuTimers(r){const a={};for(const h in r){const p=r[h],m=this.context.extTimerQuery,g=m.getQueryParameter(p.query,this.context.gl.QUERY_RESULT)/1e6;m.deleteQueryEXT(p.query),a[h]=g}return a}queryGpuTimeDeferredRender(r){if(!this.options.gpuTimingDeferredRender)return 0;const a=this.context.extTimerQuery,h=this.context.gl;let p=0;for(const m of r)p+=a.getQueryParameter(m,h.QUERY_RESULT)/1e6,a.deleteQueryEXT(m);return p}translatePosMatrix(r,a,h,p,m){if(!h[0]&&!h[1])return r;const g=m?p==="map"?this.transform.angle:0:p==="viewport"?-this.transform.angle:0;if(g){const T=Math.sin(g),S=Math.cos(g);h=[h[0]*S-h[1]*T,h[0]*T+h[1]*S]}const x=[m?h[0]:s.bD(a,h[0],this.transform.zoom),m?h[1]:s.bD(a,h[1],this.transform.zoom),0],w=new Float32Array(16);return s.ae.translate(w,r,x),w}saveTileTexture(r){const a=r.size[0],h=this._tileTextures[a];h?h.push(r):this._tileTextures[a]=[r]}getTileTexture(r){const a=this._tileTextures[r];return a&&a.length>0?a.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(r,a,h){const p=h===void 0?this.terrain&&this.terrain.renderingToTexture:h,m=[];return this.style&&this.style.enable3dLights()&&(r==="globeRaster"||r==="terrainRaster"?(m.push("LIGHTING_3D_MODE"),m.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):p||m.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"?this._shadowMapDebug||m.push("DEPTH_TEXTURE"):this.shadowRenderer&&(this.shadowRenderer.useNormalOffset?m.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"):m.push("RENDER_SHADOWS","DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(m.push("TERRAIN"),this.linearFloatFilteringSupported()&&m.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&m.push("GLOBE"),!this._fogVisible||p||a!==void 0&&!a||m.push("FOG","FOG_DITHERING"),p&&m.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&m.push("OVERDRAW_INSPECTOR"),m}getOrCreateProgram(r,a){this.cache=this.cache||{};const h=a&&a.defines||[],p=a&&a.config,m=this.currentGlobalDefines(r,a&&a.overrideFog,a&&a.overrideRtt).concat(h),g=Wc.cacheKey(gh[r],r,m,p);return this.cache[g]||(this.cache[g]=new Wc(this.context,r,gh[r],p,Dh[r],m)),this.cache[g]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new s.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(r,a){if(this.style.enable3dLights()){const h=this.style.directionalLight,p=this.style.ambientLight;if(h&&p){const m=((g,x,w)=>{const T=g.properties.get("direction"),S=g.properties.get("color").toRenderColor(w.getLut(g.scope)).toArray01(),I=g.properties.get("intensity"),P=x.properties.get("color").toRenderColor(w.getLut(x.scope)).toArray01(),z=x.properties.get("intensity"),L=[T.x,T.y,T.z],k=s.bC(P,z),O=s.bC(S,I);return{u_lighting_ambient_color:k,u_lighting_directional_dir:L,u_lighting_directional_color:O,u_ground_radiance:Sh(L,O,k)}})(h,p,this.style);a.setLightsUniformValues(r,m)}}}uploadCommonUniforms(r,a,h,p,m){if(this.uploadCommonLightUniforms(r,a),this.terrain&&this.terrain.renderingToTexture)return;const g=this.style.fog;if(g){const x=g.getOpacity(this.transform.pitch),w=((T,S,I,P,z,L,k,O,B,G,$,j)=>{const J=T.transform,Z=S.properties.get("color").toRenderColor(T.style.getLut(S.scope)).toArray01();Z[3]=P;const W=T.frameCounter/1e3%1,[ee,ie]=S.properties.get("vertical-range");return{u_fog_matrix:I?J.calculateFogTileMatrix(I):j||T.identityMat,u_fog_range:S.getFovAdjustedRange(J._fov),u_fog_color:Z,u_fog_horizon_blend:S.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ee,ie),ie],u_fog_temporal_offset:W,u_frustum_tl:z,u_frustum_tr:L,u_frustum_br:k,u_frustum_bl:O,u_globe_pos:B,u_globe_radius:G,u_viewport:$,u_globe_transition:s.a2(J.zoom),u_is_globe:+(J.projection.name==="globe")}})(this,g,h,x,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*s.e.devicePixelRatio,this.transform.height*s.e.devicePixelRatio],p);a.setFogUniformValues(r,w)}m&&a.setCutoffUniformValues(r,m.uniformValues)}setTileLoadedFlag(r){this.tileLoaded=r}saveCanvasCopy(){const r=this.canvasCopy();r&&(this.frameCopies.push(r),this.tileLoaded=!1)}canvasCopy(){const r=this.context.gl,a=r.createTexture();return r.bindTexture(r.TEXTURE_2D,a),r.copyTexImage2D(r.TEXTURE_2D,0,r.RGBA,0,0,r.drawingBufferWidth,r.drawingBufferHeight,0),a}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const r=this.style&&this.style.fog;return!!r&&r.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const r=this._backgroundTiles,a=this._backgroundTiles={},h=this.transform.coveringTiles({tileSize:512});for(const p of h)a[p.key]=r[p.key]||new s.bA(p,512,this.transform.tileZoom,this);return a}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(r,a){return!(!r.is3D()||r.minzoom&&r.minzoom>this.transform.zoom||(this.style._clipLayerIndices.length||r.sourceLayer!=="building")&&r.type!=="clip"&&(!a||a.type!=="batched-model"))}isTileAffectedByFog(r){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let a=this._cachedTileFogOpacities[r.key];return a||(this._cachedTileFogOpacities[r.key]=a=this.style.fog.getOpacityForTile(r)),a[0]>=Ft||a[1]>=Ft}setupDepthForOcclusion(r,a,h){const p=this.context,m=p.gl,g=!!h;var x;h||(h={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),p.activeTexture.set(m.TEXTURE3),r&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),h.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],h.u_depth_range_unpack=[2/((x=this.depthRangeFor3D)[1]-x[0]),-1-2*x[0]/(x[1]-x[0])],h.u_occluder_half_size=.5*this.occlusionParams.occluderSize,h.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),p.activeTexture.set(m.TEXTURE0),g||a.setTerrainUniformValues(p,h)}}class gr{constructor(r,a,h,p){this.screenBounds=r,this.cameraPoint=a,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=h,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,p)}static createFromScreenPoints(r,a){let h,p;if(r instanceof s.P||typeof r[0]=="number"){const m=s.P.convert(r);h=[m],p=a.isPointAboveHorizon(m)}else{const m=s.P.convert(r[0]),g=s.P.convert(r[1]);h=[m,g],p=s.cx(m,g).every(x=>a.isPointAboveHorizon(x))}return new gr(h,a.getCameraPoint(),p,a)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(r){return s.cx(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const a=this.screenBounds[0],h=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],p=s.cx(a,h,0,!1);return this.cameraPoint.y>h.y&&(this.cameraPoint.x>a.x&&this.cameraPoint.x=h.x?p[2]=this.cameraPoint:this.cameraPoint.x<=a.x&&(p[3]=this.cameraPoint)),s.cy(p,r)}bufferedCameraGeometryGlobe(r){const a=this.screenBounds[0],h=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],p=s.cx(a,h,r),m=this.cameraPoint.clone();switch(3*((m.y>a.y)+(m.y>h.y))+((m.x>a.x)+(m.x>h.x))){case 0:p[0]=m,p[4]=m.clone();break;case 1:p.splice(1,0,m);break;case 2:p[1]=m;break;case 3:p.splice(4,0,m);break;case 5:p.splice(2,0,m);break;case 6:p[3]=m;break;case 7:p.splice(3,0,m);break;case 8:p[2]=m}return p}containsTile(r,a,h,p=0){const m=r.queryPadding/a._pixelsPerMercatorPixel+1,g=h?this._bufferedCameraMercator(m,a):this._bufferedScreenMercator(m,a);let x=r.tileID.wrap+(g.unwrapped?p:0);const w=g.polygon.map(O=>s.cz(r.tileTransform,O,x));if(!s.cA(w,0,0,s.a4,s.a4))return;x=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?p:0);const T=this.screenGeometryMercator.polygon.map(O=>s.cB(r.tileTransform,O,x)),S=T.map(O=>new s.P(O[0],O[1])),I=a.getFreeCameraOptions().position||new s._(0,0,0),P=s.cB(r.tileTransform,I,x),z=T.map(O=>{const B=s.$.sub(O,O,P);return s.$.normalize(B,B),new s.aU(P,B)}),L=s.bD(r,1,a.zoom)*a._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:z,bufferedTilespaceGeometry:w,bufferedTilespaceBounds:(k=s.cC(w),k.min.x=s.au(k.min.x,0,s.a4),k.min.y=s.au(k.min.y,0,s.a4),k.max.x=s.au(k.max.x,0,s.a4),k.max.y=s.au(k.max.y,0,s.a4),k),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:L};var k}_bufferedScreenMercator(r,a){const h=jn(r);if(this._screenRaycastCache[h])return this._screenRaycastCache[h];{let p;return p=a.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(r),a):{polygon:this.bufferedScreenGeometry(r).map(m=>a.pointCoordinate3D(m)),unwrapped:!0},this._screenRaycastCache[h]=p,p}}_bufferedCameraMercator(r,a){const h=jn(r);if(this._cameraRaycastCache[h])return this._cameraRaycastCache[h];{let p;return p=a.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(r),a):{polygon:this.bufferedCameraGeometry(r).map(m=>a.pointCoordinate3D(m)),unwrapped:!0},this._cameraRaycastCache[h]=p,p}}_projectAndResample(r,a){const h=function(m,g){const x=s.ae.multiply([],g.pixelMatrix,g.globeMatrix),w=[0,-s.cF,0,1],T=[0,s.cF,0,1],S=[0,0,0,1];s.aB.transformMat4(w,w,x),s.aB.transformMat4(T,T,x),s.aB.transformMat4(S,S,x);const I=new s.P(w[0]/w[3],w[1]/w[3]),P=new s.P(T[0]/T[3],T[1]/T[3]),z=s.cD(m,I)&&w[3]1?go(m.slice(0,O),g):[],$=Onew s.P(fn(W.x),W.y)),$=$.map(W=>new s.P(fn(W.x),W.y));const j=[...G];j.length===0&&j.push($[$.length-1]);const J=s.a3(j[j.length-1].y,($.length===0?G[0]:$[0]).y,B);let Z;return Z=z?[new s.P(0,J),new s.P(0,0),new s.P(1,0),new s.P(1,J)]:[new s.P(1,J),new s.P(1,1),new s.P(0,1),new s.P(0,J)],j.push(...Z),$.length===0?j.push(G[0]):j.push(...$),{polygon:j.map(W=>new s._(W.x,W.y)),unwrapped:!1}}(r,a);if(h)return h;const p=function(m,g){let x=!1,w=-1/0,T=0;for(let I=0;Iw&&(w=m[I].x,T=I);for(let I=0;I.5&&(z.x{I.x-=1}),{polygon:m,unwrapped:x}}(go(r,a).map(m=>new s.P(fn(m.x),m.y)),a);return{polygon:p.polygon.map(m=>new s._(m.x,m.y)),unwrapped:p.unwrapped}}}function go(u,r){return s.cE(u,a=>{const h=r.pointCoordinate3D(a);a.x=h.x,a.y=h.y},1/256)}function fn(u){return u<0?1+u%1:u%1}function jn(u){return 100*u|0}function zp(u,r){const a=s.ae.identity([]);return s.ae.scale(a,a,[.5*u.width,.5*-u.height,1]),s.ae.translate(a,a,[1,-1,0]),s.ae.multiply(a,a,u.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(a)}function mn(u,r,a,h,p,m,g,x=!1){const w=u.tilesIn(h,g,x);w.sort(cu);const T=[];for(const I of w)T.push({wrappedTileID:I.tile.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(r,a,u._state,I,p,m,zp(u.transform,I.tile.tileID),x)});const S=function(I){const P={},z={};for(const L of I){const k=L.queryResults,O=L.wrappedTileID,B=z[O]=z[O]||{};for(const G in k){const $=k[G],j=B[G]=B[G]||{},J=P[G]=P[G]||[];for(const Z of $)j[Z.featureIndex]||(j[Z.featureIndex]=!0,J.push(Z))}}return P}(T);for(const I in S)S[I].forEach(P=>{const z=P.feature,L=z.layer;L&&L.type!=="background"&&L.type!=="sky"&&L.type!=="slot"&&(z.source=L.source,L["source-layer"]&&(z.sourceLayer=L["source-layer"]),z.state=z.id!==void 0?u.getFeatureState(L["source-layer"],z.id):{})});return S}function Dp(u,r){const a=u.getRenderableIds().map(m=>u.getTileByID(m)),h=[],p={};for(let m=0;m0:h.type==="model"&&(p=!h.isHidden(r)&&h.paint.get("model-opacity")>0),this.layersGotHidden=this.layersGotHidden||!p&&a.visible,a.visible=p}}updateZOffset(r,a){this.currentBuildingBuckets=[];for(const p of this.layers){const m=p.layer,g=this.style.getLayerSourceCache(m);let x=1;m.type==="fill-extrusion"&&(x=p.visible?m.paint.get("fill-extrusion-vertical-scale"):0);let w=g?g.getTile(a):null;if(!w&&g&&a.canonical.z>g.getSource().minzoom){let T=a.scaledTo(Math.min(g.getSource().maxzoom,a.overscaledZ-1));for(;T.overscaledZ>=g.getSource().minzoom&&(w=g.getTile(T),!w&&T.overscaledZ!==0);)T=T.scaledTo(T.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:w?w.getBucket(m):null,tileID:w?w.tileID:a,verticalScale:x})}r.hasAnyZOffset=!1;let h=!1;for(let p=0;p{h in r&&(a[h]=r[h])}),a}function ga(u){u=u.slice();const r=Object.create(null);for(let a=0;a0?(p-g)/x:0;return this.points[m].mult(1-w).add(this.points[a].mult(w))}}class xa{constructor(r,a,h){const p=this.boxCells=[],m=this.circleCells=[];this.xCellCount=Math.ceil(r/h),this.yCellCount=Math.ceil(a/h);for(let g=0;gthis.width||p<0||a>this.height)return!m&&[];const x=[];if(r<=0&&a<=0&&this.width<=h&&this.height<=p){if(m)return!0;for(let w=0;w0:x}_queryCircle(r,a,h,p,m){const g=r-h,x=r+h,w=a-h,T=a+h;if(x<0||g>this.width||T<0||w>this.height)return!p&&[];const S=[];return this._forEachCell(g,w,x,T,this._queryCellCircle,S,{hitTest:p,circle:{x:r,y:a,radius:h},seenUids:{box:{},circle:{}}},m),p?S.length>0:S}query(r,a,h,p,m){return this._query(r,a,h,p,!1,m)}hitTest(r,a,h,p,m){return this._query(r,a,h,p,!0,m)}hitTestCircle(r,a,h,p){return this._queryCircle(r,a,h,!0,p)}_queryCell(r,a,h,p,m,g,x,w){const T=x.seenUids,S=this.boxCells[m];if(S!==null){const P=this.bboxes;for(const z of S)if(!T.box[z]){T.box[z]=!0;const L=4*z;if(r<=P[L+2]&&a<=P[L+3]&&h>=P[L+0]&&p>=P[L+1]&&(!w||w(this.boxKeys[z]))){if(x.hitTest)return g.push(!0),!0;g.push({key:this.boxKeys[z],x1:P[L],y1:P[L+1],x2:P[L+2],y2:P[L+3]})}}}const I=this.circleCells[m];if(I!==null){const P=this.circles;for(const z of I)if(!T.circle[z]){T.circle[z]=!0;const L=3*z;if(this._circleAndRectCollide(P[L],P[L+1],P[L+2],r,a,h,p)&&(!w||w(this.circleKeys[z]))){if(x.hitTest)return g.push(!0),!0;{const k=P[L],O=P[L+1],B=P[L+2];g.push({key:this.circleKeys[z],x1:k-B,y1:O-B,x2:k+B,y2:O+B})}}}}}_queryCellCircle(r,a,h,p,m,g,x,w){const T=x.circle,S=x.seenUids,I=this.boxCells[m];if(I!==null){const z=this.bboxes;for(const L of I)if(!S.box[L]){S.box[L]=!0;const k=4*L;if(this._circleAndRectCollide(T.x,T.y,T.radius,z[k+0],z[k+1],z[k+2],z[k+3])&&(!w||w(this.boxKeys[L])))return g.push(!0),!0}}const P=this.circleCells[m];if(P!==null){const z=this.circles;for(const L of P)if(!S.circle[L]){S.circle[L]=!0;const k=3*L;if(this._circlesCollide(z[k],z[k+1],z[k+2],T.x,T.y,T.radius)&&(!w||w(this.circleKeys[L])))return g.push(!0),!0}}}_forEachCell(r,a,h,p,m,g,x,w){const T=this._convertToXCellCoord(r),S=this._convertToYCellCoord(a),I=this._convertToXCellCoord(h),P=this._convertToYCellCoord(p);for(let z=T;z<=I;z++)for(let L=S;L<=P;L++)if(m.call(this,r,a,h,p,this.xCellCount*L+z,g,x,w))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,a,h,p,m,g){const x=p-r,w=m-a,T=h+g;return T*T>x*x+w*w}_circleAndRectCollide(r,a,h,p,m,g,x){const w=(g-p)/2,T=Math.abs(r-(p+w));if(T>w+h)return!1;const S=(x-m)/2,I=Math.abs(a-(m+S));if(I>S+h)return!1;if(T<=w||I<=S)return!0;const P=T-w,z=I-S;return P*P+z*z<=h*h}}const Hi=100;class kp{constructor(r,a,h=new xa(r.width+200,r.height+200,25),p=new xa(r.width+200,r.height+200,25)){this.transform=r,this.grid=h,this.ignoredGrid=p,this.pitchfactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+Hi,this.screenBottomBoundary=r.height+Hi,this.gridRightBoundary=r.width+200,this.gridBottomBoundary=r.height+200,this.fogState=a}placeCollisionBox(r,a,h,p,m,g,x,w){let T=h.projectedAnchorX,S=h.projectedAnchorY,I=h.projectedAnchorZ;const P=h.elevation,z=h.tileID,L=r.getProjection();if(P&&z){const[Z,W,ee]=L.upVector(z.canonical,h.tileAnchorX,h.tileAnchorY),ie=L.upVectorScale(z.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;T+=Z*P*ie,S+=W*P*ie,I+=ee*P*ie}const k=this.projectAndGetPerspectiveRatio(x,T,S,I,h.tileID,L.name==="globe"||!!P||this.transform.pitch>0,L),O=g*k.perspectiveRatio,B=(h.x1*a+p.x-h.padding)*O+k.point.x,G=(h.y1*a+p.y-h.padding)*O+k.point.y,$=(h.x2*a+p.x+h.padding)*O+k.point.x,j=(h.y2*a+p.y+h.padding)*O+k.point.y,J=k.perspectiveRatio<=.55||k.occluded;return!this.isInsideGrid(B,G,$,j)||!m&&this.grid.hitTest(B,G,$,j,w)||J?{box:[],offscreen:!1,occluded:k.occluded}:{box:[B,G,$,j],offscreen:this.isOffscreen(B,G,$,j),occluded:!1}}placeCollisionCircles(r,a,h,p,m,g,x,w,T,S,I,P,z,L,k){const O=[],B=this.transform.elevation,G=r.getProjection(),$=B?B.getAtTileOffsetFunc(k,this.transform.center.lat,this.transform.worldSize,G):null,j=new s.P(h.tileAnchorX,h.tileAnchorY);let{x:J,y:Z,z:W}=G.projectTilePoint(j.x,j.y,k.canonical);if($){const[Se,he,ve]=$(j);J+=Se,Z+=he,W+=ve}const ee=G.name==="globe",ie=this.projectAndGetPerspectiveRatio(x,J,Z,W,k,ee||!!B||this.transform.pitch>0,G),{perspectiveRatio:ue}=ie,re=(I?g/ue:g*ue)/s.bP,Y=$r(J,Z,W,w),_e=ie.signedDistanceFromCamera>0?Js(re,m,h.lineOffsetX*re,h.lineOffsetY*re,!1,Y,j,h,p,w,{},B&&!I?$:null,I&&!!B,G,k,I):null;let fe=!1,se=!1,Ce=!0;if(_e&&!ie.occluded){const Se=.5*z*ue+L,he=new s.P(-100,-100),ve=new s.P(this.screenRightBoundary,this.screenBottomBoundary),ne=new Uh,{first:Me,last:Ae}=_e,Ue=Me.path.length;let Ge=[];for(let it=Ue-1;it>=1;it--)Ge.push(Me.path[it]);for(let it=1;it($&&!ee&&(nt=$(xtit[3]<=0)&&(Ge=[]));let $e=[];if(Ge.length>0){let it=1/0,_t=-1/0,nt=1/0,xt=-1/0;for(const Ct of Ge)it=Math.min(it,Ct[0]),nt=Math.min(nt,Ct[1]),_t=Math.max(_t,Ct[0]),xt=Math.max(xt,Ct[1]);_t>=he.x&&it<=ve.x&&xt>=he.y&&nt<=ve.y&&($e=[Ge.map(Ct=>new s.P(Ct[0],Ct[1]))],(itve.x||ntve.y)&&($e=s.cH($e,he.x,he.y,ve.x,ve.y)))}for(const it of $e){ne.reset(it,.25*Se);let _t=0;_t=ne.length<=.5*Se?1:Math.ceil(ne.paddedLength/He)+1;for(let nt=0;nt<_t;nt++){const xt=nt/Math.max(_t-1,1),Ct=ne.lerp(xt),ii=Ct.x+Hi,Jt=Ct.y+Hi;O.push(ii,Jt,Se,0);const Pt=ii-Se,Xt=Jt-Se,Tt=ii+Se,St=Jt+Se;if(Ce=Ce&&this.isOffscreen(Pt,Xt,Tt,St),se=se||this.isInsideGrid(Pt,Xt,Tt,St),!a&&this.grid.hitTestCircle(ii,Jt,Se,P)&&(fe=!0,!S))return{circles:[],offscreen:!1,collisionDetected:fe,occluded:!1}}}}return{circles:!S&&fe||!se?[]:O,offscreen:Ce,collisionDetected:fe,occluded:ie.occluded}}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const a=[];let h=1/0,p=1/0,m=-1/0,g=-1/0;for(const S of r){const I=new s.P(S.x+Hi,S.y+Hi);h=Math.min(h,I.x),p=Math.min(p,I.y),m=Math.max(m,I.x),g=Math.max(g,I.y),a.push(I)}const x=this.grid.query(h,p,m,g).concat(this.ignoredGrid.query(h,p,m,g)),w={},T={};for(const S of x){const I=S.key;if(w[I.bucketInstanceId]===void 0&&(w[I.bucketInstanceId]={}),w[I.bucketInstanceId][I.featureIndex])continue;const P=[new s.P(S.x1,S.y1),new s.P(S.x2,S.y1),new s.P(S.x2,S.y2),new s.P(S.x1,S.y2)];s.cI(a,P)&&(w[I.bucketInstanceId][I.featureIndex]=!0,T[I.bucketInstanceId]===void 0&&(T[I.bucketInstanceId]=[]),T[I.bucketInstanceId].push(I.featureIndex))}return T}insertCollisionBox(r,a,h,p,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:h,featureIndex:p,collisionGroupID:m},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,a,h,p,m){const g=a?this.ignoredGrid:this.grid,x={bucketInstanceId:h,featureIndex:p,collisionGroupID:m};for(let w=0;w0?(s.aB.transformMat4(w,w,r),this.fogState&&m&&x.name!=="globe"&&(T=function(P,z,L,k,O,B){const G=B.calculateFogTileMatrix(O),$=[z,L,k];return s.$.transformMat4($,$,G),Dt(P,s.$.length($),B.pitch,B._fov)}(this.fogState,a,h,p,m.toUnwrapped(),this.transform)>.9)):Gc(w,w,r);const S=w[3];return{point:new s.P((w[0]/S+1)/2*this.transform.width+Hi,(-w[1]/S+1)/2*this.transform.height+Hi),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(x)/S*.5,1.5),signedDistanceFromCamera:S,occluded:g&&w[2]>S||T}}isOffscreen(r,a,h,p){return h=this.screenRightBoundary||pthis.screenBottomBoundary}isInsideGrid(r,a,h,p){return h>=0&&r=0&&ah.collisionGroupID===a}}return this.collisionGroups[r]}}function hu(u,r,a,h,p){const{horizontalAlign:m,verticalAlign:g}=s.bS(u),x=-(m-.5)*r,w=-(g-.5)*a,T=s.bR(u,h);return new s.P(x+T[0]*p,w+T[1]*p)}function Bl(u,r,a,h,p){const m=new s.P(u,r);return a&&m._rotate(h?p:-p),m}class $h{constructor(r,a,h,p,m,g){this.transform=r.clone(),this.projection=r.projection.name,this.collisionIndex=new kp(this.transform,m),this.buildingIndex=g,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Gh(h),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,a,h,p){const m=h.getBucket(a),g=h.latestFeatureIndex;if(!m||!g||a.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,w=h.collisionBoxArray,T=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),S=h.tileSize/s.a4,I=h.tileID.toUnwrapped();this.transform.setProjection(m.projection);const P=(z=h.tileID,L=m.getProjection(),k=this.transform,L.name===this.projection?k.calculateProjMatrix(z.toUnwrapped()):po(k,L,z));var z,L,k;const O=x.get("text-pitch-alignment")==="map",B=x.get("text-rotation-alignment")==="map";a.compileFilter();const G=a.dynamicFilter(),$=a.dynamicFilterNeedsFeature(),j=this.transform.calculatePixelsToTileUnitsMatrix(h),J=_l(P,h.tileID.canonical,O,B,this.transform,m.getProjection(),j);let Z=null;if(O){const ie=gl(P,h.tileID.canonical,O,B,this.transform,m.getProjection(),j);Z=s.ae.multiply([],this.transform.labelPlaneMatrix,ie)}let W=null;G&&h.latestFeatureIndex&&(W={unwrappedTileID:I,dynamicFilter:G,dynamicFilterNeedsFeature:$,featureIndex:h.latestFeatureIndex}),this.retainedQueryData[m.bucketInstanceId]=new uu(m.bucketInstanceId,g,m.sourceLayerIndex,m.index,h.tileID);const ee={bucket:m,layout:x,posMatrix:P,textLabelPlaneMatrix:J,labelToScreenMatrix:Z,clippingData:W,scale:T,textPixelRatio:S,holdingForFade:h.holdingForFade(),collisionBoxArray:w,partiallyEvaluatedTextSize:s.aE(m.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:s.aE(m.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(m.sourceID)};if(p)for(const ie of m.sortKeyRanges){const{sortKey:ue,symbolInstanceStart:re,symbolInstanceEnd:Y}=ie;r.push({sortKey:ue,symbolInstanceStart:re,symbolInstanceEnd:Y,parameters:ee})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:ee})}attemptAnchorPlacement(r,a,h,p,m,g,x,w,T,S,I,P,z,L,k,O,B,G){const{textOffset0:$,textOffset1:j,crossTileID:J}=P,Z=[$,j],W=hu(r,h,p,Z,m),ee=this.collisionIndex.placeCollisionBox(L,m,a,Bl(W.x,W.y,g,x,this.transform.angle),I,w,T,S.predicate);if(O){const ie=L.getSymbolInstanceIconSize(G,this.transform.zoom,P.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(L,ie,O,Bl(W.x,W.y,g,x,this.transform.angle),I,w,T,S.predicate).box.length===0)return}if(ee.box.length>0){let ie;return this.prevPlacement&&this.prevPlacement.variableOffsets[J]&&this.prevPlacement.placements[J]&&this.prevPlacement.placements[J].text&&(ie=this.prevPlacement.variableOffsets[J].anchor),this.variableOffsets[J]={textOffset:Z,width:h,height:p,anchor:r,textScale:m,prevAnchor:ie},this.markUsedJustification(L,r,P,k),L.allowVerticalPlacement&&(this.markUsedOrientation(L,k,P),this.placedOrientations[J]=k),{shift:W,placedGlyphBoxes:ee}}}placeLayerBucketPart(r,a,h,p){const{bucket:m,layout:g,posMatrix:x,textLabelPlaneMatrix:w,labelToScreenMatrix:T,clippingData:S,textPixelRatio:I,holdingForFade:P,collisionBoxArray:z,partiallyEvaluatedTextSize:L,partiallyEvaluatedIconSize:k,collisionGroup:O}=r.parameters,B=g.get("text-optional"),G=g.get("icon-optional"),$=g.get("text-allow-overlap"),j=g.get("icon-allow-overlap"),J=g.get("text-rotation-alignment")==="map",Z=g.get("text-pitch-alignment")==="map",W=g.get("symbol-z-order")==="viewport-y",ee=g.get("symbol-z-elevate");this.transform.setProjection(m.projection);let ie=$&&(j||!m.hasIconData()||G),ue=j&&($||!m.hasTextData()||B);!m.collisionArrays&&z&&m.deserializeCollisionBoxes(z),h&&p&&m.updateCollisionDebugBuffers(this.transform.zoom,z);const re=(Y,_e,fe)=>{const{crossTileID:se,numVerticalGlyphVertices:Ce}=Y;if(S){const Tt={zoom:this.transform.zoom,pitch:this.transform.pitch};let St=null;if(S.dynamicFilterNeedsFeature){const gt=this.retainedQueryData[m.bucketInstanceId];St=S.featureIndex.loadFeature({featureIndex:Y.featureIndex,bucketIndex:gt.bucketIndex,sourceLayerIndex:gt.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,S.dynamicFilter)(Tt,St,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new s.P(Y.tileAnchorX,Y.tileAnchorY),this.transform.calculateDistanceTileData(S.unwrappedTileID)))return this.placements[se]=new Ol(!1,!1,!1,!0),void a.add(se)}if(a.has(se))return;if(P)return void(this.placements[se]=new Ol(!1,!1,!1));let Se=!1,he=!1,ve=!0,ne=!1,Me=!1,Ae=null,Ue={box:null,offscreen:null,occluded:null},Ge={box:null,offscreen:null,occluded:null},He=null,$e=null,it=null,_t=0,nt=0,xt=0;fe.textFeatureIndex?_t=fe.textFeatureIndex:Y.useRuntimeCollisionCircles&&(_t=Y.featureIndex),fe.verticalTextFeatureIndex&&(nt=fe.verticalTextFeatureIndex);const Ct=Tt=>{Tt.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const St=this.transform.elevation;Tt.elevation=Y.zOffset+(St?St.getAtTileOffset(Tt.tileID,Tt.tileAnchorX,Tt.tileAnchorY):0)},ii=fe.textBox;if(ii){Ct(ii);const Tt=gt=>{let Ot=s.aF.horizontal;if(m.allowVerticalPlacement&&!gt&&this.prevPlacement){const Mt=this.prevPlacement.placedOrientations[se];Mt&&(this.placedOrientations[se]=Mt,Ot=Mt,this.markUsedOrientation(m,Ot,Y))}return Ot},St=(gt,Ot)=>{if(m.allowVerticalPlacement&&Ce>0&&fe.verticalTextBox){for(const Mt of m.writingModes)if(Mt===s.aF.vertical?(Ue=Ot(),Ge=Ue):Ue=gt(),Ue&&Ue.box&&Ue.box.length)break}else Ue=gt()};if(g.get("text-variable-anchor")){let gt=g.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[se]){const at=this.prevPlacement.variableOffsets[se];gt.indexOf(at.anchor)>0&&(gt=gt.filter(bi=>bi!==at.anchor),gt.unshift(at.anchor))}const Ot=(at,bi,wi)=>{const Xi=m.getSymbolInstanceTextSize(L,Y,this.transform.zoom,_e),Yi=(at.x2-at.x1)*Xi+2*at.padding,Fi=(at.y2-at.y1)*Xi+2*at.padding,Ji=Y.hasIconTextFit&&!j?bi:null;Ji&&Ct(Ji);let Li={box:[],offscreen:!1,occluded:!1};const Ni=$?2*gt.length:gt.length;for(let Le=0;Le=gt.length,Y,_e,m,wi,Ji,L,k);if(Ye&&(Li=Ye.placedGlyphBoxes,Li&&Li.box&&Li.box.length)){Se=!0,Ae=Ye.shift;break}}return Li};St(()=>Ot(ii,fe.iconBox,s.aF.horizontal),()=>{const at=fe.verticalTextBox;return at&&Ct(at),m.allowVerticalPlacement&&!(Ue&&Ue.box&&Ue.box.length)&&Ce>0&&at?Ot(at,fe.verticalIconBox,s.aF.vertical):{box:null,offscreen:null,occluded:null}}),Ue&&(Se=Ue.box,ve=Ue.offscreen,ne=Ue.occluded);const Mt=Tt(!(!Ue||!Ue.box));if(!Se&&this.prevPlacement){const at=this.prevPlacement.variableOffsets[se];at&&(this.variableOffsets[se]=at,this.markUsedJustification(m,at.anchor,Y,Mt))}}else{const gt=(Ot,Mt)=>{const at=m.getSymbolInstanceTextSize(L,Y,this.transform.zoom,_e),bi=this.collisionIndex.placeCollisionBox(m,at,Ot,new s.P(0,0),$,I,x,O.predicate);return bi&&bi.box&&bi.box.length&&(this.markUsedOrientation(m,Mt,Y),this.placedOrientations[se]=Mt),bi};St(()=>gt(ii,s.aF.horizontal),()=>{const Ot=fe.verticalTextBox;return m.allowVerticalPlacement&&Ce>0&&Ot?(Ct(Ot),gt(Ot,s.aF.vertical)):{box:null,offscreen:null,occluded:null}}),Tt(!!(Ue&&Ue.box&&Ue.box.length))}}if(He=Ue,Se=He&&He.box&&He.box.length>0,ve=He&&He.offscreen,ne=He&&He.occluded,Y.useRuntimeCollisionCircles){const Tt=m.text.placedSymbolArray.get(Y.centerJustifiedTextSymbolIndex>=0?Y.centerJustifiedTextSymbolIndex:Y.verticalPlacedTextSymbolIndex),St=s.aG(m.textSizeData,L,Tt),gt=g.get("text-padding");$e=this.collisionIndex.placeCollisionCircles(m,$,Tt,m.lineVertexArray,m.glyphOffsetArray,St,x,w,T,h,Z,O.predicate,Y.collisionCircleDiameter*St/s.bP,gt,this.retainedQueryData[m.bucketInstanceId].tileID),Se=$||$e.circles.length>0&&!$e.collisionDetected,ve=ve&&$e.offscreen,ne=$e.occluded}if(fe.iconFeatureIndex&&(xt=fe.iconFeatureIndex),fe.iconBox){const Tt=St=>{Ct(St);const gt=Y.hasIconTextFit&&Ae?Bl(Ae.x,Ae.y,J,Z,this.transform.angle):new s.P(0,0),Ot=m.getSymbolInstanceIconSize(k,this.transform.zoom,Y.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,Ot,St,gt,j,I,x,O.predicate)};Ge&&Ge.box&&Ge.box.length&&fe.verticalIconBox?(it=Tt(fe.verticalIconBox),he=it.box.length>0):(it=Tt(fe.iconBox),he=it.box.length>0),ve=ve&&it.offscreen,Me=it.occluded}const Jt=B||Y.numHorizontalGlyphVertices===0&&Ce===0,Pt=G||Y.numIconVertices===0;if(Jt||Pt?Pt?Jt||(he=he&&Se):Se=he&&Se:he=Se=he&&Se,Se&&He&&He.box&&this.collisionIndex.insertCollisionBox(He.box,g.get("text-ignore-placement"),m.bucketInstanceId,Ge&&Ge.box&&nt?nt:_t,O.ID),he&&it&&this.collisionIndex.insertCollisionBox(it.box,g.get("icon-ignore-placement"),m.bucketInstanceId,xt,O.ID),$e&&(Se&&this.collisionIndex.insertCollisionCircles($e.circles,g.get("text-ignore-placement"),m.bucketInstanceId,_t,O.ID),h)){const Tt=m.bucketInstanceId;let St=this.collisionCircleArrays[Tt];St===void 0&&(St=this.collisionCircleArrays[Tt]=new Op);for(let gt=0;gt<$e.circles.length;gt+=4)St.circles.push($e.circles[gt+0]),St.circles.push($e.circles[gt+1]),St.circles.push($e.circles[gt+2]),St.circles.push($e.collisionDetected?1:0)}const Xt=m.projection.name!=="globe";ie=ie&&(Xt||!ne),ue=ue&&(Xt||!Me),this.placements[se]=new Ol(Se||ie,he||ue,ve||m.justReloaded),a.add(se)};if(ee&&this.buildingIndex&&(this.buildingIndex.updateZOffset(m,this.retainedQueryData[m.bucketInstanceId].tileID),m.updateZOffset()),W){const Y=m.getSortedSymbolIndexes(this.transform.angle);for(let _e=Y.length-1;_e>=0;--_e){const fe=Y[_e];re(m.symbolInstances.get(fe),fe,m.collisionArrays[fe])}m.hasAnyZOffset&&s.w(`${m.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(m.hasAnyZOffset){const Y=m.getSortedIndexesByZOffset();for(let _e=0;_e=0&&(r.text.placedSymbolArray.get(m).crossTileID=I>=0&&m!==I?0:T),g>=0&&(r.text.placedSymbolArray.get(g).crossTileID=I>=0&&g!==I?0:T),x>=0&&(r.text.placedSymbolArray.get(x).crossTileID=I>=0&&x!==I?0:T),w>=0&&(r.text.placedSymbolArray.get(w).crossTileID=I>=0&&w!==I?0:T)}markUsedOrientation(r,a,h){const p=a===s.aF.horizontal||a===s.aF.horizontalOnly?a:0,m=a===s.aF.vertical?a:0,{leftJustifiedTextSymbolIndex:g,centerJustifiedTextSymbolIndex:x,rightJustifiedTextSymbolIndex:w,verticalPlacedTextSymbolIndex:T}=h,S=r.text.placedSymbolArray;g>=0&&(S.get(g).placedOrientation=p),x>=0&&(S.get(x).placedOrientation=p),w>=0&&(S.get(w).placedOrientation=p),T>=0&&(S.get(T).placedOrientation=m)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const a=this.prevPlacement;let h=!1;this.prevZoomAdjustment=a?a.zoomAdjustment(this.transform.zoom):0;const p=a?a.symbolFadeChange(r):1,m=a?a.opacities:{},g=a?a.variableOffsets:{},x=a?a.placedOrientations:{};for(const w in this.placements){const T=this.placements[w],S=m[w];S?(this.opacities[w]=new va(S,p,T.text,T.icon,null,T.clipped),h=h||T.text!==S.text.placed||T.icon!==S.icon.placed):(this.opacities[w]=new va(null,p,T.text,T.icon,T.skipFade,T.clipped),h=h||T.text||T.icon)}for(const w in m){const T=m[w];if(!this.opacities[w]){const S=new va(T,p,!1,!1);S.isHidden()||(this.opacities[w]=S,h=h||T.text.placed||T.icon.placed)}}for(const w in g)this.variableOffsets[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.variableOffsets[w]=g[w]);for(const w in x)this.placedOrientations[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.placedOrientations[w]=x[w]);h?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=a?a.lastPlacementChangeTime:r)}updateLayerOpacities(r,a,h,p){const m=new Set;for(const g of a){const x=g.getBucket(r);x&&g.latestFeatureIndex&&r.fqid===x.layerIds[0]&&(this.updateBucketOpacities(x,m,g.collisionBoxArray,h,p,g.tileID,r.scope),x.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(x,g.tileID),x.updateZOffset()))}}updateBucketOpacities(r,a,h,p,m,g,x){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const w=r.layers[0].layout,T=!!r.layers[0].dynamicFilter(),S=new va(null,0,!1,!1,!0),I=w.get("text-allow-overlap"),P=w.get("icon-allow-overlap"),z=w.get("text-variable-anchor"),L=w.get("text-rotation-alignment")==="map",k=w.get("text-pitch-alignment")==="map",O=new va(null,0,I&&(P||!r.hasIconData()||w.get("icon-optional")),P&&(I||!r.hasTextData()||w.get("text-optional")),!0);!r.collisionArrays&&h&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(h);const B=($,j,J)=>{for(let Z=0;Z0||Z>0,fe=ee>0,se=this.placedOrientations[W],Ce=se===s.aF.vertical,Se=se===s.aF.horizontal||se===s.aF.horizontalOnly;!_e&&!fe||Y.isHidden()||G++;let he=!1;if((_e||fe)&&m)for(const ve of r.activeReplacements){if(s.cJ(ve,p,s.cw.Symbol,x)||ve.min.x>ie||ie>ve.max.x||ve.min.y>ue||ue>ve.max.y)continue;const ne=s.cK(ie,ue,g.canonical,ve.footprintTileId.canonical);if(he=s.cL(ne,ve),he)break}if(_e){const ve=he?$n:yr(Y.text);B(r.text,J,Ce?$n:ve),B(r.text,Z,Se?$n:ve);const ne=Y.text.isHidden(),{leftJustifiedTextSymbolIndex:Me,centerJustifiedTextSymbolIndex:Ae,rightJustifiedTextSymbolIndex:Ue,verticalPlacedTextSymbolIndex:Ge}=j,He=r.text.placedSymbolArray,$e=ne||Ce?1:0;Me>=0&&(He.get(Me).hidden=$e),Ae>=0&&(He.get(Ae).hidden=$e),Ue>=0&&(He.get(Ue).hidden=$e),Ge>=0&&(He.get(Ge).hidden=ne||Se?1:0);const it=this.variableOffsets[W];it&&this.markUsedJustification(r,it.anchor,j,se);const _t=this.placedOrientations[W];_t&&(this.markUsedJustification(r,"left",j,_t),this.markUsedOrientation(r,_t,j))}if(fe){const ve=he?$n:yr(Y.icon),{placedIconSymbolIndex:ne,verticalPlacedIconSymbolIndex:Me}=j,Ae=r.icon.placedSymbolArray,Ue=Y.icon.isHidden()?1:0;ne>=0&&(B(r.icon,ee,Ce?$n:ve),Ae.get(ne).hidden=Ue),Me>=0&&(B(r.icon,j.numVerticalIconVertices,Se?$n:ve),Ae.get(Me).hidden=Ue)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const ve=r.collisionArrays[$];if(ve){let ne=new s.P(0,0),Me=!0;if(ve.textBox||ve.verticalTextBox){if(z){const Ue=this.variableOffsets[W];Ue?(ne=hu(Ue.anchor,Ue.width,Ue.height,Ue.textOffset,Ue.textScale),L&&ne._rotate(k?this.transform.angle:-this.transform.angle)):Me=!1}T&&(Me=!Y.clipped),ve.textBox&&rn(r.textCollisionBox.collisionVertexArray,Y.text.placed,!Me||Ce,ne.x,ne.y),ve.verticalTextBox&&rn(r.textCollisionBox.collisionVertexArray,Y.text.placed,!Me||Se,ne.x,ne.y)}const Ae=Me&&!!(!Se&&ve.verticalIconBox);ve.iconBox&&rn(r.iconCollisionBox.collisionVertexArray,Y.icon.placed,Ae,j.hasIconTextFit?ne.x:0,j.hasIconTextFit?ne.y:0),ve.verticalIconBox&&rn(r.iconCollisionBox.collisionVertexArray,Y.icon.placed,!Ae,j.hasIconTextFit?ne.x:0,j.hasIconTextFit?ne.y:0)}}}if(r.fullyClipped=G===0,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){const $=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=$.invProjMatrix,r.placementViewportMatrix=$.viewportMatrix,r.collisionCircleArray=$.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTimer}setStale(){this.stale=!0}}function rn(u,r,a,h,p){u.emplaceBack(r?1:0,a?1:0,h||0,p||0),u.emplaceBack(r?1:0,a?1:0,h||0,p||0),u.emplaceBack(r?1:0,a?1:0,h||0,p||0),u.emplaceBack(r?1:0,a?1:0,h||0,p||0)}const Fl=Math.pow(2,25),qh=Math.pow(2,24),Zh=Math.pow(2,17),ba=Math.pow(2,16),wa=Math.pow(2,9),Wh=Math.pow(2,8),du=Math.pow(2,1);function yr(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const r=u.placed?1:0,a=Math.floor(127*u.opacity);return a*Fl+r*qh+a*Zh+r*ba+a*wa+r*Wh+a*du+r}const $n=0;class Fe{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&r.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(r,a,h,p,m){const g=this._bucketParts;for(;this._currentTileIndexx.sortKey-w.sortKey));this._currentPartIndex{const x=s.e.now()-m;return!this._forceFullPlacement&&x>2};for(;this._currentPlacementIndex>=0;){const x=a[r[this._currentPlacementIndex]],w=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&(!x.minzoom||x.minzoom<=w)&&(!x.maxzoom||x.maxzoom>w)){const T=x,S=T.layout.get("symbol-z-elevate"),I=this._inProgressLayer=this._inProgressLayer||new Fe(T),P=s.am(x.source,x.scope);if(I.continuePlacement(S?p[P]:h[P],this.placement,this._showCollisionBoxes,x,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const Ta=512/s.a4/2;class pu{constructor(r,a,h){this.tileID=r,this.bucketInstanceId=h,this.index=new s.cN(a.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const p=r.canonical.x*s.a4,m=r.canonical.y*s.a4;for(let g=0;gr.overscaledZ)for(const x in g){const w=g[x];w.tileID.isChildOf(r)&&w.findMatches(a.symbolInstances,r,p)}else{const x=g[r.scaledTo(Number(m)).key];x&&x.findMatches(a.symbolInstances,r,p)}}for(let m=0;m{a[h]=!0});for(const h in this.layerIndexes)a[h]||delete this.layerIndexes[h]}}const fu=new s.U({data:new s.W(s.N.colorTheme.data)}),xr=(u,r)=>tt(u,r&&r.filter(a=>a.identifier!=="source.canvas")),Vl=s.ai(jt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),us=s.ai(jt,["setCenter","setZoom","setBearing","setPitch"]),Yh={version:8,layers:[],sources:{}},Jh={duration:300,delay:0};class vr extends s.E{constructor(r,a={}){super(),this.map=r,this.scope=a.scope||"",this.globalId=null,this.fragments=[],this.importDepth=a.importDepth||0,this.importsCache=a.importsCache||new Map,this.resolvedImports=a.resolvedImports||new Set,this.transition=s.Q({},Jh),this._buildingIndex=new cr(this),this.crossTileSymbolIndex=new gn,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerIndices=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=a.styleChanges||new Ac,this.dispatcher=a.dispatcher?a.dispatcher:new s.by(s.bz(),this),a.imageManager?this.imageManager=a.imageManager:(this.imageManager=new Ar,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=a.glyphManager?a.glyphManager:new s.cP(r._requestManager,a.localFontFamily?s.cQ.all:a.localIdeographFontFamily?s.cQ.ideographs:s.cQ.none,a.localFontFamily||a.localIdeographFontFamily),a.modelManager?this.modelManager=a.modelManager:(this.modelManager=new No(r._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null},this._styleColorThemeForScope={},this.options=a.configOptions?a.configOptions:new Map,this._configDependentLayers=a.configDependentLayers?a.configDependentLayers:new Set,this._config=a.config,this._initialConfig=a.initialConfig,this.dispatcher.broadcast("setReferrer",s.cR());const h=this;this._rtlTextPluginCallback=vr.registerForPluginStateChange(p=>{h.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:p.pluginStatus,pluginURL:p.pluginURL},(m,g)=>{if(s.cS(m),g&&g.every(x=>x))for(const x in h._sourceCaches){const w=h._sourceCaches[x],T=w.getSource().type;T!=="vector"&&T!=="geojson"||w.reload()}})}),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.getOwnSource(p.sourceId);if(m&&m.vectorLayerIds)for(const g in this._layers){const x=this._layers[g];x.source===m.id&&this._validateLayer(x)}})}load(r){return r?(typeof r=="string"?this.loadURL(r):this.loadJSON(r),this):this}_getGlobalId(r){if(!r)return null;if(typeof r=="string"){if(s.cT(r))return r;const a=s.cU(r);if(!a.startsWith("http"))try{return new URL(a,location.href).toString()}catch{return a}return a}return`json://${s.cV(JSON.stringify(r))}`}_diffStyle(r,a,h){this.globalId=this._getGlobalId(r);const p=(m,g)=>{try{g(null,this.setState(m,h))}catch(x){g(x,!1)}};if(typeof r=="string"){const m=this.map._requestManager.normalizeStyleURL(r),g=this.map._requestManager.transformRequest(m,s.R.Style);s.h(g,(x,w)=>{x?this.fire(new s.f(x)):w&&p(w,a)})}else typeof r=="object"&&p(r,a)}loadURL(r,a={}){this.fire(new s.g("dataloading",{dataType:"style"}));const h=typeof a.validate=="boolean"?a.validate:!s.cT(r);this.globalId=this._getGlobalId(r),r=this.map._requestManager.normalizeStyleURL(r,a.accessToken),this.resolvedImports.add(r);const p=this.importsCache.get(r);if(p)return this._load(p,h);const m=this.map._requestManager.transformRequest(r,s.R.Style);this._request=s.h(m,(g,x)=>{if(this._request=null,g)this.fire(new s.f(g));else if(x)return this.importsCache.set(r,x),this._load(x,h)})}loadJSON(r,a={}){this.fire(new s.g("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(r),this._request=s.e.frame(()=>{this._request=null,this._load(r,a.validate!==!1)})}loadEmpty(){this.fire(new s.g("dataloading",{dataType:"style"})),this._load(Yh,!1)}_loadImports(r,a,h){if(this.importDepth>=4)return s.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const p=[];for(const m of r){const g=this._createFragmentStyle(m),x=new Promise(S=>{g.once("style.import.load",S),g.once("error",S)}).then(()=>this.mergeAll());if(p.push(x),this.resolvedImports.has(m.url)){g.loadEmpty();continue}const w=m.data||this.importsCache.get(m.url);w?(g.loadJSON(w,{validate:a}),this._isInternalStyle(w)&&(g.globalId=null)):m.url?g.loadURL(m.url,{validate:a}):g.loadEmpty();const T={style:g,id:m.id,config:m.config};if(h){const S=this.fragments.findIndex(({id:I})=>I===h);this.fragments=this.fragments.slice(0,S).concat(T).concat(this.fragments.slice(S))}else this.fragments.push(T)}return Promise.allSettled(p)}getImportGlobalIds(r=this,a=new Set){for(const h of r.fragments)h.style.globalId&&a.add(h.style.globalId),this.getImportGlobalIds(h.style,a);return[...a.values()]}_createFragmentStyle(r){const a=this.scope?s.am(r.id,this.scope):r.id;let h;const p=this._initialConfig&&this._initialConfig[a];(r.config||p)&&(h=s.Q({},r.config,p));const m=new vr(this.map,{scope:a,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:h,configOptions:this.options,configDependentLayers:this._configDependentLayers});return m.setEventedParent(this.map,{style:m}),m}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(r){return this.isRootStyle()&&(r.fragment||!!r.schema&&r.fragment!==!1)}_load(r,a){const h=r.schema;if(this._isInternalStyle(r)){const g=s.Q({},Yh,{imports:[{id:"basemap",data:r,url:""}]});return void this._load(g,a)}if(this.updateConfig(this._config,h),a&&xr(this,R(r)))return;this._loaded=!0,this.stylesheet=s.cW(r);const p=()=>{for(const T in r.sources)this.addSource(T,r.sources[T],{validate:!1,isInitialLoad:!0});r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(r.glyphs,this.scope);const g=ga(this.stylesheet.layers);if(this._order=g.map(T=>T.id),this.stylesheet.light&&s.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const T=this.stylesheet.lights[0];this.light=new Bt(T.properties,T.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Bt(this.stylesheet.light)),this._layers={},this._serializedLayers={};for(const T of g){const S=s.c$(T,this.scope,this._styleColorTheme.lut,this.options);S.configDependencies.size!==0&&this._configDependentLayers.add(S.fqid),S.setEventedParent(this,{layer:{id:S.id}}),this._layers[S.id]=S,this._serializedLayers[S.id]=S.serialize();const I=this.getOwnLayerSourceCache(S),P=!!this.directionalLight&&this.directionalLight.shadowsEnabled();I&&S.canCastShadows()&&P&&(I.castsShadows=!0)}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const x=this.stylesheet.terrain;x&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(x,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new s.g("data",{dataType:"style"}));const w=this.isRootStyle();r.imports?this._loadImports(r.imports,a).then(()=>{this._reloadImports(),this.fire(new s.g(w?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new s.g(w?"style.load":"style.import.load")))},m=this.stylesheet["color-theme"];if(this._styleColorTheme.colorTheme=m,m){const g=this._evaluateColorThemeData(m);this._loadColorTheme(g).then(()=>{p()}).catch(x=>{s.w(`Couldn't load color theme from the stylesheet: ${x}`),p()})}else this._styleColorTheme.lut=null,p()}isRootStyle(){return this.importDepth===0}mergeAll(){let r,a,h,p,m,g,x,w;const T={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(S=>{if(S.stylesheet){if(S.light!=null&&(r=S.light),S.stylesheet.lights)for(const I of S.stylesheet.lights)I.type==="ambient"&&S.ambientLight!=null&&(a=S.ambientLight),I.type==="directional"&&S.directionalLight!=null&&(h=S.directionalLight);p=this._prioritizeTerrain(p,S.terrain,S.stylesheet.terrain),S.stylesheet.fog&&S.fog!=null&&(m=S.fog),S.stylesheet.camera!=null&&(w=S.stylesheet.camera),S.stylesheet.projection!=null&&(g=S.stylesheet.projection),S.stylesheet.transition!=null&&(x=S.stylesheet.transition),T[S.scope]=S._styleColorTheme}}),this.light=r,this.ambientLight=a,this.directionalLight=h,this.fog=m,this._styleColorThemeForScope=T,p===null?delete this.terrain:this.terrain=p,this.camera=w||{"camera-projection":"perspective"},this.projection=g||{name:"mercator"},this.transition=s.Q({},Jh,x),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(r){const a=h=>{for(const p of h.fragments)a(p.style);r(h)};a(this)}_prioritizeTerrain(r,a,h){const p=r&&r.drapeRenderMode===0;return h===null?a&&a.drapeRenderMode===0?a:p?r:null:a!=null&&(!r||p||a&&a.drapeRenderMode===1)?a:r}mergeTerrain(){let r;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(a=>{r=this._prioritizeTerrain(r,a.terrain,a.stylesheet.terrain)}),r===null?delete this.terrain:this.terrain=r}mergeProjection(){let r;this.forEachFragmentStyle(a=>{a.stylesheet.projection!=null&&(r=a.stylesheet.projection)}),this.projection=r||{name:"mercator"}}mergeSources(){const r={},a={},h={};this.forEachFragmentStyle(p=>{for(const m in p._sourceCaches){const g=s.am(m,p.scope);r[g]=p._sourceCaches[m]}for(const m in p._otherSourceCaches){const g=s.am(m,p.scope);a[g]=p._otherSourceCaches[m]}for(const m in p._symbolSourceCaches){const g=s.am(m,p.scope);h[g]=p._symbolSourceCaches[m]}}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=a,this._mergedSymbolSourceCaches=h}mergeLayers(){const r={},a=[],h={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(g=>{for(const x of g._order){const w=g._layers[x];if(w.type==="slot"){const T=s.cX(x);if(r[T])continue;r[T]=[]}w.slot&&r[w.slot]?r[w.slot].push(w):a.push(w)}}),this._mergedOrder=[],this._clipLayerIndices=[];let p=0;const m=(g=[])=>{for(const x of g)if(x.type==="slot"){const w=s.cX(x.id);r[w]&&m(r[w]),this._mergedSlots.push(w)}else{const w=s.am(x.id,x.scope);this._mergedOrder.push(w),h[w]=x,x.is3D()&&(this._has3DLayers=!0),x.type==="circle"&&(this._hasCircleLayers=!0),x.type==="symbol"&&(this._hasSymbolLayers=!0),x.type==="clip"&&this._clipLayerIndices.push(p),p++}};m(a),this._mergedOrder.sort((g,x)=>{const w=h[g],T=h[x];return w.hasInitialOcclusionOpacityProperties?T.is3D()?1:0:w.is3D()&&T.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=h,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(r){return this.stylesheet.camera=s.Q({},this.stylesheet.camera,r),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(r){return r.data?function(a,h,p){const m=s.Q({},h);for(const x of Object.keys(s.N.colorTheme))m[x]===void 0&&(m[x]=s.N.colorTheme[x].default);const g=new s.O(fu,a,new Map(p));return g.setTransitionOrValue(m,p),g.untransitioned().possiblyEvaluate(new s.Y(0))}(this.scope,r,this.options).get("data"):null}_loadColorTheme(r){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const a=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((h,p)=>{const m="data:image/png;base64,";if(!r||r.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void h();let g=r;g.startsWith(m)||(g=m+g);const x="mapbox-reserved-lut",w=new Image;w.src=g,w.onerror=()=>{this._styleColorTheme.lutLoading=!1,p(new Error("Failed to load image data"))},w.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==a)return void h();this._styleColorTheme.lutLoading=!1;const{width:T,height:S,data:I}=s.e.getImageData(w);if(S>32)return void p(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==S*S)return void p(new Error("The width of the image must be equal to the height squared."));this.getImage(x)&&this.removeImage(x),this.addImage(x,{data:new s.j({width:T,height:S},I),pixelRatio:1,sdf:!1,version:0});const P=this.imageManager.getImage(x,this.scope);P?(this._styleColorTheme.lut={image:P.data,data:r},h()):p(new Error("Missing LUT image."))}})}getLut(r){const a=this._styleColorThemeForScope[r];return a?a.lut:null}setProjection(r){r?this.stylesheet.projection=r:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(r){this._spriteRequest=function(a,h,p){let m,g,x;const w=s.e.devicePixelRatio>1?"@2x":"";let T=s.h(h.transformRequest(h.normalizeSpriteURL(a,w,".json"),s.R.SpriteJSON),(P,z)=>{T=null,x||(x=P,m=z,I())}),S=s.i(h.transformRequest(h.normalizeSpriteURL(a,w,".png"),s.R.SpriteImage),(P,z)=>{S=null,x||(x=P,g=z,I())});function I(){if(x)p(x);else if(m&&g){const P=s.e.getImageData(g),z={};for(const L in m){const{width:k,height:O,x:B,y:G,sdf:$,pixelRatio:j,stretchX:J,stretchY:Z,content:W}=m[L],ee=new s.j({width:k,height:O});s.j.copy(P,ee,{x:B,y:G},{x:0,y:0},{width:k,height:O},null),z[L]={data:ee,pixelRatio:j,sdf:$,stretchX:J,stretchY:Z,content:W}}p(null,z)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}}(r,this.map._requestManager,(a,h)=>{if(this._spriteRequest=null,a)this.fire(new s.f(a));else if(h)for(const p in h)this.imageManager.addImage(p,this.scope,h[p]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.g("data",{dataType:"style"}))})}_validateLayer(r){const a=this.getOwnSource(r.source);if(!a)return;const h=r.sourceLayer;h&&(a.type==="geojson"||a.vectorLayerIds&&a.vectorLayerIds.indexOf(h)===-1)&&this.fire(new s.f(new Error(`Source layer "${h}" does not exist on source "${a.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const r in this._sourceCaches)if(!this._sourceCaches[r].loaded())return!1;if(!this.imageManager.isLoaded()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:r}of this.fragments)if(!r.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((r,a)=>{const h=this.fragments[a];return h&&h.style&&(r.data=h.style.serialize()),r})}_serializeSources(){const r={};for(const a in this._sourceCaches){const h=this._sourceCaches[a].getSource();r[h.id]||(r[h.id]=h.serialize())}return r}_serializeLayers(r){const a=[];for(const h of r){const p=this._layers[h];p&&p.type!=="custom"&&a.push(p.serialize())}return a}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition())return!0;for(const r in this._sourceCaches)if(this._sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}isLayerDraped(r){return!!this.terrain&&r.isDraped(this.getLayerSourceCache(r))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(r){const a=this.getOwnLayer(r);if(a)return a;this.fire(new s.f(new Error(`The layer '${r}' does not exist in the map's style.`)))}_checkSource(r){const a=this.getOwnSource(r);if(a)return a;this.fire(new s.f(new Error(`The source '${r}' does not exist in the map's style.`)))}precompilePrograms(r,a){const h=this.map.painter;if(h)for(let p=r.minzoom||0;p<(r.maxzoom||25.5);p++){const m=r.getProgramIds();if(m)for(const g of m){const x=r.getDefaultProgramParams(g,a.zoom,this._styleColorTheme.lut);x&&(h.style=this,this.fog&&(h._fogVisible=!0,x.overrideFog=!0,h.getOrCreateProgram(g,x)),h._fogVisible=!1,x.overrideFog=!1,h.getOrCreateProgram(g,x),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(x.overrideRtt=!0,h.getOrCreateProgram(g,x)))}}}update(r){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r);const a=this.calculateLightsBrightness();r.brightness=a||0,a!==this._brightness&&(this._brightness=a,this.dispatcher.broadcast("setBrightness",a));const h=this._changes.isDirty();let p=!1;if(this._changes.isDirty()){const g=this._changes.getLayerUpdatesByScope();for(const x in g){const{updatedIds:w,removedIds:T}=g[x];(w||T)&&(this._updateWorkerLayers(x,w,T),p=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(r),this.light&&this.light.updateTransitions(r),this.ambientLight&&this.ambientLight.updateTransitions(r),this.directionalLight&&this.directionalLight.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._changes.reset()}const m={};for(const g in this._mergedSourceCaches){const x=this._mergedSourceCaches[g];m[g]=x.used,x.used=!1,x.tileCoverLift=0}for(const g of this._mergedOrder){const x=this._mergedLayers[g];if(x.recalculate(r,this._availableImages),!x.isHidden(r.zoom)){const w=this.getLayerSourceCache(x);w&&(w.used=!0,w.tileCoverLift=Math.max(w.tileCoverLift,x.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(x,r)}):this.precompilePrograms(x,r))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&p&&this.mergeLayers();for(const g in m){const x=this._mergedSourceCaches[g];m[g]!==x.used&&x.getSource().fire(new s.g("data",{sourceDataType:"visibility",dataType:"source",sourceId:x.getSource().id}))}this.light&&this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),h&&this.fire(new s.g("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=this._changes.getUpdatedImages();if(r.length){for(const a in this._sourceCaches)this._sourceCaches[a].reloadTilesForDependencies(["icons","patterns"],r);this._changes.resetUpdatedImages()}}_updateWorkerLayers(r,a,h){const p=this.getFragmentStyle(r);p&&this.dispatcher.broadcast("updateLayers",{layers:a?p._serializeLayers(a):[],scope:r,removedIds:h||[],options:p.options})}setState(r,a){if(this._checkLoaded(),xr(this,R(r)))return!1;(r=s.cW(r)).layers=ga(r.layers);const h=function(g,x){if(!g)return[{command:jt.setStyle,args:[x]}];let w=[];try{if(!s.d(g.version,x.version))return[{command:jt.setStyle,args:[x]}];if(s.d(g.center,x.center)||w.push({command:jt.setCenter,args:[x.center]}),s.d(g.zoom,x.zoom)||w.push({command:jt.setZoom,args:[x.zoom]}),s.d(g.bearing,x.bearing)||w.push({command:jt.setBearing,args:[x.bearing]}),s.d(g.pitch,x.pitch)||w.push({command:jt.setPitch,args:[x.pitch]}),s.d(g.sprite,x.sprite)||w.push({command:jt.setSprite,args:[x.sprite]}),s.d(g.glyphs,x.glyphs)||w.push({command:jt.setGlyphs,args:[x.glyphs]}),s.d(g.imports,x.imports)||function(z=[],L=[],k){L=L||[];const O=(z=z||[]).map(kl),B=L.map(kl),G=z.reduce(_n,{}),$=L.reduce(_n,{}),j=O.slice();let J,Z,W,ee;for(J=0,Z=0;J{z.source&&T[z.source]?w.push({command:jt.removeLayer,args:[z.id]}):I.push(z)});let P=g.terrain;P&&T[P.source]&&(w.push({command:jt.setTerrain,args:[void 0]}),P=void 0),w=w.concat(S),s.d(P,x.terrain)||w.push({command:jt.setTerrain,args:[x.terrain]}),function(z,L,k){L=L||[];const O=(z=z||[]).map(kl),B=L.map(kl),G=z.reduce(_n,{}),$=L.reduce(_n,{}),j=O.slice(),J=Object.create(null);let Z,W,ee,ie,ue,re,Y;for(Z=0,W=0;Z!(g.command in us));if(h.length===0)return!1;const p=h.filter(g=>!(g.command in Vl));if(p.length>0)throw new Error(`Unimplemented: ${p.map(g=>g.command).join(", ")}.`);const m=[];return h.forEach(g=>{m.push(this[g.command].apply(this,g.args))}),a&&Promise.all(m).then(a),this.stylesheet=r,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(r,a){return this.getImage(r)?this.fire(new s.f(new Error("An image with this name already exists."))):(this.imageManager.addImage(r,this.scope,a),this._afterImageUpdated(r),this)}updateImage(r,a){this.imageManager.updateImage(r,this.scope,a)}getImage(r){return this.imageManager.getImage(r,this.scope)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r,this.scope),this._afterImageUpdated(r),this):this.fire(new s.f(new Error("No image with this name exists.")))}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(r),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new s.g("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(r,a,h={}){return this._checkLoaded(),this._validate(Pe,`models.${r}`,a,null,h)||(this.modelManager.addModel(r,a,this.scope),this._changes.setDirty()),this}hasModel(r){return this.modelManager.hasModel(r,this.scope)}removeModel(r){return this.hasModel(r)?(this.modelManager.removeModel(r,this.scope),this):this.fire(new s.f(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(r,a,h={}){if(this._checkLoaded(),this.getOwnSource(r)!==void 0)throw new Error(`There is already a source with ID "${r}".`);if(!a.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(a.type)>=0&&this._validate(F,`sources.${r}`,a,null,h))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);const p=wl(r,a,this.dispatcher,this);p.scope=this.scope,p.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(p.id),source:p.serialize(),sourceId:p.id}));const m=g=>{const x=(g?"symbol:":"other:")+p.id,w=s.am(x,this.scope),T=this._sourceCaches[x]=new s.bx(w,p,g);(g?this._symbolSourceCaches:this._otherSourceCaches)[p.id]=T,T.onAdd(this.map)};m(!1),a.type!=="vector"&&a.type!=="geojson"||m(!0),p.onAdd&&p.onAdd(this.map),h.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(r){this._checkLoaded();const a=this.getOwnSource(r);if(!a)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===r)return this.fire(new s.f(new Error(`Source "${r}" cannot be removed while layer "${p}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===r)return this.fire(new s.f(new Error(`Source "${r}" cannot be removed while terrain is using it.`)));const h=this.getOwnSourceCaches(r);for(const p of h){const m=s.cX(p.id);delete this._sourceCaches[m],this._changes.discardSourceCacheUpdate(p.id),p.fire(new s.g("data",{sourceDataType:"metadata",dataType:"source",sourceId:p.getSource().id})),p.setEventedParent(null),p.clearTiles()}return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],this.mergeSources(),a.setEventedParent(null),a.onRemove&&a.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(r,a){this._checkLoaded(),this.getOwnSource(r).setData(a),this._changes.setDirty()}getOwnSource(r){const a=this.getOwnSourceCache(r);return a&&a.getSource()}getOwnSources(){const r=[];for(const a in this._otherSourceCaches){const h=this.getOwnSourceCache(a);h&&r.push(h.getSource())}return r}areTilesLoaded(){const r=this._mergedSourceCaches;for(const a in r){const h=r[a]._tiles;for(const p in h){const m=h[p];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}setLights(r){if(this._checkLoaded(),!r)return delete this.ambientLight,void delete this.directionalLight;const a=this._getTransitionParameters();for(const p of r){if(this._validate(te,"lights",p))return;switch(p.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(p),m.updateTransitions(a)}else this.ambientLight=new ao(p,Pc||(Pc=new s.U({color:new s.W(s.N.properties_light_ambient.color),intensity:new s.W(s.N.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(p),m.updateTransitions(a)}else this.directionalLight=new ao(p,zc||(zc=new s.U({direction:new s.a6(s.N.properties_light_directional.direction),color:new s.W(s.N.properties_light_directional.color),intensity:new s.W(s.N.properties_light_directional.intensity),"cast-shadows":new s.W(s.N.properties_light_directional["cast-shadows"]),"shadow-intensity":new s.W(s.N.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const h=new s.Y(this.z||0,a);this.ambientLight&&this.ambientLight.recalculate(h),this.directionalLight&&this.directionalLight.recalculate(h),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const r=this.directionalLight,a=this.ambientLight;if(!r||!a)return;const h=I=>.2126*(I[0]<=.03928?I[0]/12.92:Math.pow((I[0]+.055)/1.055,2.4))+.7152*(I[1]<=.03928?I[1]/12.92:Math.pow((I[1]+.055)/1.055,2.4))+.0722*(I[2]<=.03928?I[2]/12.92:Math.pow((I[2]+.055)/1.055,2.4)),p=r.properties.get("color").toRenderColor(null).toArray01(),m=r.properties.get("intensity"),g=r.properties.get("direction"),x=1-s.ad(g.x,g.y,g.z)[2]/90,w=h(p)*m*x,T=a.properties.get("color").toRenderColor(null).toArray01(),S=a.properties.get("intensity");return(w+h(T)*S)/2}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const r=[];return this.directionalLight&&r.push(this.directionalLight.get()),this.ambientLight&&r.push(this.ambientLight.get()),r}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(r){if(!r)return this;if(s.cY(r)){const a=s.cZ(r),h=this.fragments.find(({id:m})=>m===a);if(!h)throw new Error(`Style import not found: ${r}`);const p=s.cX(r);return h.style.getFragmentStyle(p)}{const a=this.fragments.find(({id:h})=>h===r);if(!a)throw new Error(`Style import not found: ${r}`);return a.style}}getConfigProperty(r,a){const h=this.getFragmentStyle(r);if(!h)return null;const p=s.am(a,h.scope),m=h.options.get(p),g=m?m.value||m.default:null;return g?g.serialize():null}setConfigProperty(r,a,h){const p=this.getFragmentStyle(r);if(!p)return;const m=p.stylesheet.schema;if(!m||!m[a])return;const g=s.z(h);if(g.result!=="success")return void xr(this,g.value);const x=g.value.expression,w=s.am(a,p.scope),T=p.options.get(w);if(!T)return;let S;const{minValue:I,maxValue:P,stepValue:z,type:L,values:k}=m[a],O=s.z(m[a].default);O.result==="success"&&(S=O.value.expression),S?(this.options.set(w,{...T,value:x,default:S,minValue:I,maxValue:P,stepValue:z,type:L,values:k}),this.updateConfigDependencies(a)):this.fire(new s.f(new Error(`No schema defined for the config option "${a}" in the "${r}" fragment.`)))}getConfig(r){const a=this.getFragmentStyle(r);if(!a)return null;const h=a.stylesheet.schema;if(!h)return null;const p={};for(const m in h){const g=s.am(m,a.scope),x=a.options.get(g),w=x?x.value||x.default:null;p[m]=w?w.serialize():null}return p}setConfig(r,a){const h=this.getFragmentStyle(r);h&&(h.updateConfig(a,h.stylesheet.schema),this.updateConfigDependencies())}getSchema(r){const a=this.getFragmentStyle(r);return a?a.stylesheet.schema:null}setSchema(r,a){const h=this.getFragmentStyle(r);h&&(h.stylesheet.schema=a,h.updateConfig(h._config,a),this.updateConfigDependencies())}updateConfig(r,a){if(this._config=r,r||a)if(a)for(const h in a){let p,m;const g=s.z(a[h].default);if(g.result==="success"&&(p=g.value.expression),r&&r[h]!==void 0){const P=s.z(r[h]);P.result==="success"&&(m=P.value.expression)}const{minValue:x,maxValue:w,stepValue:T,type:S,values:I}=a[h];if(p){const P=s.am(h,this.scope);this.options.set(P,{default:p,value:m,minValue:x,maxValue:w,stepValue:T,type:S,values:I})}else this.fire(new s.f(new Error(`No schema defined for config option "${h}".`)))}else this.fire(new s.f(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(r){for(const a of this._configDependentLayers){const h=this.getLayer(a);if(h){if(r&&!h.configDependencies.has(r))continue;h.possiblyEvaluateVisibility(),this._updateLayer(h)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.forEachFragmentStyle(a=>{if(a._styleColorTheme.colorTheme){const h=a._evaluateColorThemeData(a._styleColorTheme.colorTheme);(!a._styleColorTheme.lut&&h!==""||a._styleColorTheme.lut&&h!==a._styleColorTheme.lut.data)&&a.setColorTheme(a._styleColorTheme.colorTheme)}}),this._changes.setDirty()}addLayer(r,a,h={}){this._checkLoaded();const p=r.id;if(this._layers[p])return void this.fire(new s.f(new Error(`Layer with id "${p}" already exists on this map`)));let m;if(r.type==="custom"){if(xr(this,s.c_(r)))return;m=s.c$(r,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof r.source=="object"&&(this.addSource(p,r.source),r=s.cW(r),r=s.Q(r,{source:p})),this._validate(xe,`layers.${p}`,r,{arrayIndex:-1},h))return;m=s.c$(r,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(m),m.setEventedParent(this,{layer:{id:p}}),this._serializedLayers[m.id]=m.serialize()}m.configDependencies.size!==0&&this._configDependentLayers.add(m.fqid);let g=this._order.length;if(a){const S=this._order.indexOf(a);if(S===-1)return void this.fire(new s.f(new Error(`Layer with id "${a}" does not exist on this map.`)));m.slot===this._layers[a].slot?g=S:s.w(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(g,0,p),this._layerOrderChanged=!0,this._layers[p]=m;const x=this.getOwnLayerSourceCache(m),w=!!this.directionalLight&&this.directionalLight.shadowsEnabled();x&&m.canCastShadows()&&w&&(x.castsShadows=!0);const T=this._changes.getRemovedLayer(m);if(T&&m.source&&x&&m.type!=="custom"){this._changes.discardLayerRemoval(m);const S=s.am(m.source,m.scope);T.type!==m.type?this._changes.updateSourceCache(S,"clear"):(this._changes.updateSourceCache(S,"reload"),x.pause())}this._updateLayer(m),m.onAdd&&m.onAdd(this.map),m.scope=this.scope,this.mergeLayers()}moveLayer(r,a){this._checkLoaded();const h=this._checkLayer(r);if(!h||r===a)return;const p=this._order.indexOf(r);this._order.splice(p,1);let m=this._order.length;if(a){const g=this._order.indexOf(a);if(g===-1)return void this.fire(new s.f(new Error(`Layer with id "${a}" does not exist on this map.`)));h.slot===this._layers[a].slot?m=g:s.w(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(m,0,r),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(r){this._checkLoaded();const a=this._checkLayer(r);if(!a)return;a.setEventedParent(null);const h=this._order.indexOf(r);this._order.splice(h,1),delete this._layers[r],delete this._serializedLayers[r],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(a.fqid),this._changes.removeLayer(a);const p=this.getOwnLayerSourceCache(a);if(p&&p.castsShadows){let m=!1;for(const g in this._layers)if(this._layers[g].source===a.source&&this._layers[g].canCastShadows()){m=!0;break}p.castsShadows=m}a.onRemove&&a.onRemove(this.map),this.mergeLayers()}getOwnLayer(r){return this._layers[r]}hasLayer(r){return r in this._mergedLayers}hasLayerType(r){for(const a in this._layers)if(this._layers[a].type===r)return!0;return!1}setLayerZoomRange(r,a,h){this._checkLoaded();const p=this._checkLayer(r);p&&(p.minzoom===a&&p.maxzoom===h||(a!=null&&(p.minzoom=a),h!=null&&(p.maxzoom=h),this._updateLayer(p)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(r,a){this._checkLoaded();const h=this._checkLayer(r);h&&h.slot!==a&&(h.slot=a,this._updateLayer(h))}setFilter(r,a,h={}){this._checkLoaded();const p=this._checkLayer(r);if(p&&!s.d(p.filter,a))return a==null?(p.filter=void 0,void this._updateLayer(p)):void(this._validate(le,`layers.${p.id}.filter`,a,{layerType:p.type},h)||(p.filter=s.cW(a),this._updateLayer(p)))}getFilter(r){const a=this._checkLayer(r);if(a)return s.cW(a.filter)}setLayoutProperty(r,a,h,p={}){this._checkLoaded();const m=this._checkLayer(r);if(m&&!s.d(m.getLayoutProperty(a),h)){if(h!=null&&(!p||p.validate!==!1)&&xr(m,ze.call(R,{key:`layers.${r}.layout.${a}`,layerType:m.type,objectKey:a,value:h,styleSpec:s.N,style:{glyphs:!0,sprite:!0}})))return;m.setLayoutProperty(a,h),m.configDependencies.size!==0&&this._configDependentLayers.add(m.fqid),this._updateLayer(m)}}getLayoutProperty(r,a){const h=this._checkLayer(r);if(h)return h.getLayoutProperty(a)}setPaintProperty(r,a,h,p={}){this._checkLoaded();const m=this._checkLayer(r);if(!m||s.d(m.getPaintProperty(a),h)||h!=null&&(!p||p.validate!==!1)&&xr(m,ge.call(R,{key:`layers.${r}.paint.${a}`,layerType:m.type,objectKey:a,value:h,styleSpec:s.N})))return;const g=m.setPaintProperty(a,h);m.configDependencies.size!==0&&this._configDependentLayers.add(m.fqid),g&&this._updateLayer(m),this._changes.updatePaintProperties(m)}getPaintProperty(r,a){const h=this._checkLayer(r);if(h)return h.getPaintProperty(a)}setFeatureState(r,a){this._checkLoaded();const h=r.source,p=r.sourceLayer,m=this._checkSource(h);if(!m)return;const g=m.type;if(g==="geojson"&&p)return void this.fire(new s.f(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(g==="vector"&&!p)return void this.fire(new s.f(new Error("The sourceLayer parameter must be provided for vector source types.")));r.id===void 0&&this.fire(new s.f(new Error("The feature id parameter must be provided.")));const x=this.getOwnSourceCaches(h);for(const w of x)w.setFeatureState(p,r.id,a)}removeFeatureState(r,a){this._checkLoaded();const h=r.source,p=this._checkSource(h);if(!p)return;const m=p.type,g=m==="vector"?r.sourceLayer:void 0;if(m==="vector"&&!g)return void this.fire(new s.f(new Error("The sourceLayer parameter must be provided for vector source types.")));if(a&&typeof r.id!="string"&&typeof r.id!="number")return void this.fire(new s.f(new Error("A feature id is required to remove its specific state property.")));const x=this.getOwnSourceCaches(h);for(const w of x)w.removeFeatureState(g,r.id,a)}getFeatureState(r){this._checkLoaded();const a=r.source,h=r.sourceLayer,p=this._checkSource(a);if(p){if(p.type!=="vector"||h)return r.id===void 0&&this.fire(new s.f(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)[0].getFeatureState(h,r.id);this.fire(new s.f(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(r){return this.stylesheet.transition=s.Q({},this.stylesheet.transition,r),this.transition=this.stylesheet.transition,this}getTransition(){return s.Q({},this.stylesheet.transition)}serialize(){this._checkLoaded();const r=this.getTerrain(),a=r&&this.terrain&&this.terrain.scope===this.scope?r:this.stylesheet.terrain;return s.d0({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:a,fog:this.stylesheet.fog,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},h=>h!==void 0)}_updateLayer(r){this._changes.updateLayer(r);const a=this.getLayerSourceCache(r),h=s.am(r.source,r.scope),p=this._changes.getUpdatedSourceCaches();r.source&&!p[h]&&a&&a.getSource().type!=="raster"&&(this._changes.updateSourceCache(h,"reload"),a.pause()),r.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(r){const a=x=>this._mergedLayers[x].type==="fill-extrusion"||this._mergedLayers[x].type==="model",h=this.order,p={},m=[];for(let x=h.length-1;x>=0;x--){const w=h[x];if(a(w)){p[w]=x;for(const T of r){const S=T[w];if(S)for(const I of S)m.push(I)}}}m.sort((x,w)=>w.intersectionZ-x.intersectionZ);const g=[];for(let x=h.length-1;x>=0;x--){const w=h[x];if(a(w))for(let T=m.length-1;T>=0;T--){const S=m[T].feature;if(S.layer&&p[S.layer.id]{const S=this.getLayer(T);return S&&S.is3D()}):this.has3DLayers(),w=gr.createFromScreenPoints(r,h);for(const T in this._mergedSourceCaches){const S=this._mergedSourceCaches[T].getSource();if(!S||S.scope!==a.scope)continue;const I=this._mergedSourceCaches[T].getSource().id;a.layers&&!p[I]||m.push(mn(this._mergedSourceCaches[T],this._mergedLayers,g,w,a,h,x,!!this.map._showQueryGeometry))}return this.placement&&m.push(function(T,S,I,P,z,L,k){const O={},B=L.queryRenderedSymbols(P),G=[];for(const $ of Object.keys(B).map(Number))G.push(k[$]);G.sort(cu);for(const $ of G){const j=$.featureIndex.lookupSymbolFeatures(B[$.bucketInstanceId],S,$.bucketIndex,$.sourceLayerIndex,z.filter,z.layers,z.availableImages,T);for(const J in j){const Z=O[J]=O[J]||[],W=j[J];W.sort((ee,ie)=>{const ue=$.featureSortOrder;if(ue){const re=ue.indexOf(ee.featureIndex);return ue.indexOf(ie.featureIndex)-re}return ie.featureIndex-ee.featureIndex});for(const ee of W)Z.push(ee)}}for(const $ in O)O[$].forEach(j=>{const J=j.feature,Z=I(T[$]);if(!Z)return;const W=Z.getFeatureState(J.layer["source-layer"],J.id);J.source=J.layer.source,J.layer["source-layer"]&&(J.sourceLayer=J.layer["source-layer"]),J.state=W});return O}(this._mergedLayers,g,this.getLayerSourceCache.bind(this),w.screenGeometry,a,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(m)}querySourceFeatures(r,a){a&&a.filter&&this._validate(le,"querySourceFeatures.filter",a.filter,null,a);const h=this.getOwnSourceCaches(r);let p=[];for(const m of h)p=p.concat(Dp(m,a));return p}addSourceType(r,a,h){return vr.getSourceType(r)?h(new Error(`A source type called "${r}" already exists.`)):(vr.setSourceType(r,a),a.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:r,url:a.workerSourceURL},h):h(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(r,a,h={}){this._checkLoaded();const p=this.light.getLight();let m=!1;for(const x in r)if(!s.d(r[x],p[x])){m=!0;break}if(!m)return;const g=this._getTransitionParameters();this.light.setLight(r,a,h),this.light.updateTransitions(g)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=s.e.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&s.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(r,a=1){if(this._checkLoaded(),!r)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),a===0&&delete this.terrain,r===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let h=r;const p=r.source==null;if(a===1){if(this.disableElevatedTerrain)return;if(typeof h.source=="object"){const x="terrain-dem-src";this.addSource(x,h.source),h=s.cW(h),h=s.Q(h,{source:x})}const m=s.Q({},h),g={};if(this.terrain&&p){m.source=this.terrain.get().source;const x=this.terrain?this.getFragmentStyle(this.terrain.scope):null;x&&(g.style=x.serialize())}if(this._validate(K,"terrain",m,g))return}if(!this.terrain||this.terrain.scope!==this.scope&&!p||this.terrain&&a!==this.terrain.drapeRenderMode){if(!h)return;this._createTerrain(h,a),this.fire(new s.g("data",{dataType:"style"}))}else{const m=this.terrain,g=m.get();for(const x of Object.keys(s.N.terrain))!h.hasOwnProperty(x)&&s.N.terrain[x].default&&(h[x]=s.N.terrain[x].default);for(const x in r)if(!s.d(r[x],g[x])){m.set(r,this.options),this.stylesheet.terrain=r;const w=this._getTransitionParameters({duration:0});m.updateTransitions(w),this.fire(new s.g("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(r){const a=this.fog=new tr(r,this.map.transform,this.scope,this.options);this.stylesheet.fog=a.get();const h=this._getTransitionParameters({duration:0});a.updateTransitions(h)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const r of this.map._markers)r._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),!r)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const a=this.fog;if(!s.d(a.get(),r)){a.set(r,this.options),this.stylesheet.fog=a.get();const h=this._getTransitionParameters({duration:0});a.updateTransitions(h)}}else this._createFog(r);this._markersNeedUpdate=!0}setColorTheme(r){this._checkLoaded();const a=()=>{for(const p in this._layers)this._layers[p].lut=this._styleColorTheme.lut;for(const p in this._sourceCaches)this._sourceCaches[p].clearTiles()};if(this._styleColorTheme.colorTheme=r,!r)return this._styleColorTheme.lut=null,void a();const h=this._evaluateColorThemeData(r);this._loadColorTheme(h).then(()=>{this.fire(new s.g("colorthemeset")),a()}).catch(p=>{s.w(`Couldn't set color theme: ${p}`)})}_getTransitionParameters(r){return{now:s.e.now(),transition:s.Q(this.transition,r)}}updateDrapeFirstLayers(){if(!this.terrain)return;const r=[],a=[];for(const h of this._mergedOrder)this.isLayerDraped(this._mergedLayers[h])?r.push(h):a.push(h);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...r),this._drapedFirstOrder.push(...a)}_createTerrain(r,a){const h=this.terrain=new kt(r,a,this.scope,this.options);a===1&&(this.stylesheet.terrain=r),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const p=this._getTransitionParameters({duration:0});h.updateTransitions(p)}_force3DLayerUpdate(){for(const r in this._layers){const a=this._layers[r];a.type==="fill-extrusion"&&this._updateLayer(a)}}_forceSymbolLayerUpdate(){for(const r in this._layers){const a=this._layers[r];a.type==="symbol"&&this._updateLayer(a)}}_validate(r,a,h,p,m={}){if(m&&m.validate===!1)return!1;const g=s.Q({},this.serialize());return xr(this,r.call(R,s.Q({key:a,style:g,value:h,styleSpec:s.N},p)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.d1.off("pluginStateChange",this._rtlTextPluginCallback);for(const r in this._mergedLayers)this._mergedLayers[r].setEventedParent(null);for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles(),this._mergedSourceCaches[r].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(r){const a=this.getSourceCaches(r);for(const h of a)h.clearTiles()}clearSources(){for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles()}reloadSource(r){const a=this.getSourceCaches(r);for(const h of a)h.resume(),h.reload()}reloadSources(){for(const r of this.getSources())r.reload&&r.reload()}updateSources(r){let a;this.directionalLight&&(a=es(this.directionalLight));for(const h in this._mergedSourceCaches)this._mergedSourceCaches[h].update(r,void 0,void 0,a)}_generateCollisionBoxes(){for(const r in this._sourceCaches){const a=this._sourceCaches[r];a.resume(),a.reload()}}_updatePlacement(r,a,h,p,m,g,x=!1){let w=!1,T=!1;const S={},I={};for(const P of this._mergedOrder){const z=this._mergedLayers[P];if(z.type!=="symbol")continue;const L=s.am(z.source,z.scope);let k=S[L];if(!k){const B=this.getLayerSourceCache(z);if(!B)continue;const G=B.getRenderableIds(!0).map($=>B.getTileByID($));I[L]=G.slice(),k=S[L]=G.sort(($,j)=>j.tileID.overscaledZ-$.tileID.overscaledZ||($.tileID.isLessThan(j.tileID)?-1:1))}const O=this.crossTileSymbolIndex.addLayer(z,k,a.center.lng,a.projection);w=w||O}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),x=x||this._layerOrderChanged||p===0,this._layerOrderChanged&&this.fire(new s.g("neworder")),(x||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.e.now(),a.zoom))&&(this.pauseablePlacement=new Hh(a,this._mergedOrder,x,h,p,m,this.placement,this.fog&&a.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,S,I),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(s.e.now()),T=!0),w&&this.pauseablePlacement.placement.setStale()),T||w){this._buildingIndex.onNewFrame(a.zoom);for(let P=0;PPm===r.id)!==-1)return void this.fire(new s.f(new Error(`Import with id '${r.id}' already exists in the map's style.`)));if(!a)return h.push(r),this._loadImports([r],!0);const p=h.findIndex(({id:m})=>m===a);return p===-1&&this.fire(new s.f(new Error(`Import with id "${a}" does not exist on this map.`))),this.stylesheet.imports=h.slice(0,p).concat(r).concat(h.slice(p)),this._loadImports([r],!0,a)}updateImport(r,a){this._checkLoaded();const h=this.stylesheet.imports||[],p=this.getImportIndex(r);return p===-1?this:typeof a=="string"?(this.setImportUrl(r,a),this):(a.url&&a.url!==h[p].url&&this.setImportUrl(r,a.url),s.d(a.config,h[p].config)||this.setImportConfig(r,a.config),s.d(a.data,h[p].data)||this.setImportData(r,a.data),this)}moveImport(r,a){this._checkLoaded();let h=this.stylesheet.imports||[];const p=this.getImportIndex(r);if(p===-1)return this;const m=this.getImportIndex(a);if(m===-1)return this;const g=h[p],x=this.fragments[p];return h=h.filter(({id:w})=>w!==r),this.fragments=this.fragments.filter(({id:w})=>w!==r),this.stylesheet.imports=h.slice(0,m).concat(g).concat(h.slice(m)),this.fragments=this.fragments.slice(0,m).concat(x).concat(this.fragments.slice(m)),this.mergeLayers(),this}setImportUrl(r,a){this._checkLoaded();const h=this.stylesheet.imports||[],p=this.getImportIndex(r);if(p===-1)return this;h[p].url=a;const m=this.fragments[p];return m.style=this._createFragmentStyle(h[p]),m.style.on("style.import.load",()=>this.mergeAll()),m.style.loadURL(a),this}setImportData(r,a){this._checkLoaded();const h=this.getImportIndex(r),p=this.stylesheet.imports||[];return h===-1?this:a?(this.fragments[h].style.setState(a),this._reloadImports(),this):(delete p[h].data,this.setImportUrl(r,p[h].url))}setImportConfig(r,a){this._checkLoaded();const h=this.getImportIndex(r),p=this.stylesheet.imports||[];if(h===-1)return this;a?p[h].config=a:delete p[h].config;const m=this.fragments[h],g=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=a,m.style.updateConfig(a,g),this.updateConfigDependencies(),this}removeImport(r){this._checkLoaded();const a=this.stylesheet.imports||[],h=this.getImportIndex(r);h!==-1&&(a.splice(h,1),this.fragments[h].style._remove(),this.fragments.splice(h,1),this._reloadImports())}getImportIndex(r){const a=(this.stylesheet.imports||[]).findIndex(h=>h.id===r);return a===-1&&this.fire(new s.f(new Error(`Import '${r}' does not exist in the map's style and cannot be updated.`))),a}getLayer(r){return this._mergedLayers[r]}getSources(){const r=[];for(const a in this._mergedOtherSourceCaches){const h=this._mergedOtherSourceCaches[a];h&&r.push(h.getSource())}return r}getSource(r,a){const h=this.getSourceCache(r,a);return h&&h.getSource()}getLayerSource(r){const a=this.getLayerSourceCache(r);return a&&a.getSource()}getSourceCache(r,a){const h=s.am(r,a);return this._mergedOtherSourceCaches[h]}getLayerSourceCache(r){const a=s.am(r.source,r.scope);return r.type==="symbol"?this._mergedSymbolSourceCaches[a]:this._mergedOtherSourceCaches[a]}getSourceCaches(r){if(r==null)return Object.values(this._mergedSourceCaches);const a=[];return this._mergedOtherSourceCaches[r]&&a.push(this._mergedOtherSourceCaches[r]),this._mergedSymbolSourceCaches[r]&&a.push(this._mergedSymbolSourceCaches[r]),a}updateSourceCaches(){const r=this._changes.getUpdatedSourceCaches();for(const a in r){const h=r[a];h==="reload"?this.reloadSource(a):h==="clear"&&this.clearSource(a)}}updateLayers(r){const a=this._changes.getUpdatedPaintProperties();for(const h of a){const p=this.getLayer(h);p&&p.updateTransitions(r)}}getImages(r,a,h){this.imageManager.getImages(a.icons,a.scope,h),this._updateTilesForChangedImages();const p=m=>{m&&m.setDependencies(a.tileID.key,a.type,a.icons)};p(this._otherSourceCaches[a.source]),p(this._symbolSourceCaches[a.source])}getGlyphs(r,a,h){this.glyphManager.getGlyphs(a.stacks,a.scope,h)}getResource(r,a,h){return s.d2(a,h)}getOwnSourceCache(r){return this._otherSourceCaches[r]}getOwnLayerSourceCache(r){return r.type==="symbol"?this._symbolSourceCaches[r.source]:this._otherSourceCaches[r.source]}getOwnSourceCaches(r){const a=[];return this._otherSourceCaches[r]&&a.push(this._otherSourceCaches[r]),this._symbolSourceCaches[r]&&a.push(this._symbolSourceCaches[r]),a}_isSourceCacheLoaded(r){const a=this.getOwnSourceCaches(r);return a.length===0?(this.fire(new s.f(new Error(`There is no source with ID '${r}'`))),!1):a.every(h=>h.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(r,a){if(this._clipLayerIndices.length===0&&r.type!=="fill-extrusion")return!1;const h=r.type==="fill-extrusion"&&r.sourceLayer==="building";let p=0;if(r.is3D()){if(h||a&&a.type==="batched-model")return!0;r.type==="model"&&(p=s.cw.Model)}else r.type==="symbol"&&(p=s.cw.Symbol);for(const m of this._clipLayerIndices){const g=this._mergedLayers[this._mergedOrder[m]];if(!g)continue;const x=[];for(const w of g.layout.get("clip-layer-types"))x.push(w==="model"?s.cw.Model:w==="symbol"?s.cw.Symbol:s.cw.FillExtrusion);for(const w of x)if(p&w)return!0}return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(r=>{r.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}function Kh(u,r){let a=!1,h=null;const p=()=>{h=null,a&&(u(),h=setTimeout(p,r),a=!1)};return()=>(a=!0,h||p(),h)}vr.getSourceType=function(u){return bl[u]},vr.setSourceType=function(u,r){bl[u]=r},vr.registerForPluginStateChange=s.cO;class Qh{constructor(r){this._hashName=r&&encodeURIComponent(r),s.br(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Kh(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,window.addEventListener("hashchange",this._onHashChange,!1),r.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const r=this._map;if(!r)return"";const a=mu(r);if(this._hashName){const h=this._hashName;let p=!1;const m=location.hash.slice(1).split("&").map(g=>{const x=g.split("=")[0];return x===h?(p=!0,`${x}=${a}`):g}).filter(g=>g);return p||m.push(`${h}=${a}`),`#${m.join("&")}`}return`#${a}`}_getCurrentHash(){const r=location.hash.replace("#","");if(this._hashName){let a;return r.split("&").map(h=>h.split("=")).forEach(h=>{h[0]===this._hashName&&(a=h)}),(a&&a[1]||"").split("/")}return r.split("/")}_onHashChange(){const r=this._map;if(!r)return!1;const a=this._getCurrentHash();if(a.length>=3&&!a.some(h=>isNaN(h))){const h=r.dragRotate.isEnabled()&&r.touchZoomRotate.isEnabled()?+(a[3]||0):r.getBearing();return r.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:h,pitch:+(a[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function mu(u,r){const a=u.getCenter(),h=Math.round(100*u.getZoom())/100,p=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),m=Math.pow(10,p),g=Math.round(a.lng*m)/m,x=Math.round(a.lat*m)/m,w=u.getBearing(),T=u.getPitch();let S=r?`/${g}/${x}/${h}`:`${h}/${x}/${g}`;return(w||T)&&(S+="/"+Math.round(10*w)/10),T&&(S+=`/${Math.round(T)}`),S}const hs={linearity:.3,easing:s.d3(0,0,.3,1)},Bp=s.Q({deceleration:2500,maxSpeed:1400},hs),Fp=s.Q({deceleration:20,maxSpeed:1400},hs),Np=s.Q({deceleration:1e3,maxSpeed:360},hs),Vp=s.Q({deceleration:1e3,maxSpeed:90},hs);class ed{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.e.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,a=s.e.now();for(;r.length>0&&a-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const a={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:m}of this._inertiaBuffer)a.zoom+=m.zoomDelta||0,a.bearing+=m.bearingDelta||0,a.pitch+=m.pitchDelta||0,m.panDelta&&a.pan._add(m.panDelta),m.around&&(a.around=m.around),m.pinchAround&&(a.pinchAround=m.pinchAround);const h=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(a.pan.mag()){const m=yo(a.pan.mag(),h,s.Q({},Bp,r||{}));p.offset=a.pan.mult(m.amount/a.pan.mag()),p.center=this._map.transform.center,Ul(p,m)}if(a.zoom){const m=yo(a.zoom,h,Fp);p.zoom=this._map.transform.zoom+m.amount,Ul(p,m)}if(a.bearing){const m=yo(a.bearing,h,Np);p.bearing=this._map.transform.bearing+s.au(m.amount,-179,179),Ul(p,m)}if(a.pitch){const m=yo(a.pitch,h,Vp);p.pitch=this._map.transform.pitch+m.amount,Ul(p,m)}if(p.zoom||p.bearing){const m=a.pinchAround===void 0?a.around:a.pinchAround;p.around=m?this._map.unproject(m):this._map.getCenter()}return this.clear(),p.noMoveStart=!0,p}}function Ul(u,r){(!u.duration||u.durationa.unproject(w)),x=m.reduce((w,T,S,I)=>w.add(T.div(I.length)),new s.P(0,0));super(r,{points:m,point:x,lngLats:g,lngLat:a.unproject(x),originalEvent:h}),this._defaultPrevented=!1}}class _u extends s.g{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a){super("wheel",{originalEvent:a}),this._defaultPrevented=!1}}class jl{constructor(r,a){this._map=r,this._clickTolerance=a.clickTolerance}reset(){this._mousedownPos=void 0}wheel(r){return this._firePreventable(new _u(this._map,r))}mousedown(r,a){return this._mousedownPos=a,this._firePreventable(new br(r.type,this._map,r))}mouseup(r){this._map.fire(new br(r.type,this._map,r))}preclick(r){const a=s.Q({},r);a.type="preclick",this._map.fire(new br(a.type,this._map,a))}click(r,a){this._mousedownPos&&this._mousedownPos.dist(a)>=this._clickTolerance||(this.preclick(r),this._map.fire(new br(r.type,this._map,r)))}dblclick(r){return this._firePreventable(new br(r.type,this._map,r))}mouseover(r){this._map.fire(new br(r.type,this._map,r))}mouseout(r){this._map.fire(new br(r.type,this._map,r))}touchstart(r){return this._firePreventable(new Ea(r.type,this._map,r))}touchmove(r){this._map.fire(new Ea(r.type,this._map,r))}touchend(r){this._map.fire(new Ea(r.type,this._map,r))}touchcancel(r){this._map.fire(new Ea(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gu{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(r){this._map.fire(new br(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new br("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._map.fire(new br(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class xo{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=a.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,a){this.isEnabled()&&r.shiftKey&&r.button===0&&(Dn(),this._startPos=this._lastPos=a,this._active=!0)}mousemoveWindow(r,a){if(!this._active)return;const h=a,p=this._startPos,m=this._lastPos;if(!p||!m||m.equals(h)||!this._box&&h.dist(p){this._box&&(this._box.style.transform=`translate(${g}px,${w}px)`,this._box.style.width=x-g+"px",this._box.style.height=T-w+"px")})}mouseupWindow(r,a){if(!this._active)return;const h=this._startPos,p=a;if(h&&r.button===0){if(this.reset(),Jr(),h.x!==p.x||h.y!==p.y)return this._map.fire(new s.g("boxzoomend",{originalEvent:r})),{cameraAnimation:m=>m.fitScreenCoordinates(h,p,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),el(),delete this._startPos,delete this._lastPos}_fireEvent(r,a){return this._map.fire(new s.g(r,{originalEvent:a}))}}function Sa(u,r){const a={};for(let h=0;hthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=r.timeStamp),h.length===this.numTouches&&(this.centroid=function(p){const m=new s.P(0,0);for(const g of p)m._add(g);return m.div(p.length)}(a),this.touches=Sa(h,a)))}touchmove(r,a,h){if(this.aborted||!this.centroid)return;const p=Sa(h,a);for(const m in this.touches){const g=p[m];(!g||g.dist(this.touches[m])>30)&&(this.aborted=!0)}}touchend(r,a,h){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),h.length===0){const p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class qn{constructor(r){this.singleTap=new td(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(r,a,h){this.singleTap.touchstart(r,a,h)}touchmove(r,a,h){this.singleTap.touchmove(r,a,h)}touchend(r,a,h){const p=this.singleTap.touchend(r,a,h);if(p){const m=r.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(p)<30;if(m&&g||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class Ma{constructor(){this._zoomIn=new qn({numTouches:1,numTaps:2}),this._zoomOut=new qn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,a,h){this._zoomIn.touchstart(r,a,h),this._zoomOut.touchstart(r,a,h)}touchmove(r,a,h){this._zoomIn.touchmove(r,a,h),this._zoomOut.touchmove(r,a,h)}touchend(r,a,h){const p=this._zoomIn.touchend(r,a,h),m=this._zoomOut.touchend(r,a,h);return p?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()+1,around:g.unproject(p)},{originalEvent:r})}):m?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()-1,around:g.unproject(m)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Gl={0:1,2:2};class Ia{constructor(r){this.reset(),this._clickTolerance=r.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(r,a){return!1}_move(r,a){return{}}mousedown(r,a){if(this._lastPoint)return;const h=Rn(r);this._correctButton(r,h)&&(this._lastPoint=a,this._eventButton=h)}mousemoveWindow(r,a){const h=this._lastPoint;if(h){if(r.preventDefault(),this._eventButton!=null&&function(p,m){const g=Gl[m];return p.buttons===void 0||(p.buttons&g)!==g}(r,this._eventButton))this.reset();else if(this._moved||!(a.dist(h)0&&(this._active=!0);const p=Sa(h,a),m=new s.P(0,0),g=new s.P(0,0);let x=0;for(const T in p){const S=p[T],I=this._touches[T];I&&(m._add(S),g._add(S.sub(I)),x++,p[T]=S)}if(this._touches=p,x{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class Pa{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(r){}_move(r,a,h){return{}}touchstart(r,a,h){this._firstTwoTouches||h.length<2||(this._firstTwoTouches=[h[0].identifier,h[1].identifier],this._start([a[0],a[1]]))}touchmove(r,a,h){const p=this._firstTwoTouches;if(!p)return;r.preventDefault();const[m,g]=p,x=vo(h,a,m),w=vo(h,a,g);if(!x||!w)return;const T=this._aroundCenter?null:x.add(w).div(2);return this._move([x,w],T,r)}touchend(r,a,h){if(!this._firstTwoTouches)return;const[p,m]=this._firstTwoTouches,g=vo(h,a,p),x=vo(h,a,m);g&&x||(this._active&&Jr(),this.reset())}touchcancel(){this.reset()}enable(r){this._enabled=!0,this._aroundCenter=!!r&&r.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function vo(u,r,a){for(let h=0;hMath.abs(u.x)}class od extends Pa{constructor(r){super(),this._map=r}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(r){this._lastPoints=r,Zn(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,a,h){const p=this._lastPoints;if(!p)return;const m=r[0].sub(p[0]),g=r[1].sub(p[1]);return this._map._cooperativeGestures&&!s.d4()&&h.touches.length<3||(this._valid=this.gestureBeginsVertically(m,g,h.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:(m.y+g.y)/2*-.5})}gestureBeginsVertically(r,a,h){if(this._valid!==void 0)return this._valid;const p=r.mag()>=2,m=a.mag()>=2;if(!p&&!m)return;if(!p||!m)return this._firstMove==null&&(this._firstMove=h),h-this._firstMove<100&&void 0;const g=r.y>0==a.y>0;return Zn(r)&&Zn(a)&&g}}const Up={panStep:100,bearingStep:15,pitchStep:10};class jp{constructor(){const r=Up;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let a=0,h=0,p=0,m=0,g=0;switch(r.keyCode){case 61:case 107:case 171:case 187:a=1;break;case 189:case 109:case 173:a=-1;break;case 37:r.shiftKey?h=-1:(r.preventDefault(),m=-1);break;case 39:r.shiftKey?h=1:(r.preventDefault(),m=1);break;case 38:r.shiftKey?p=1:(r.preventDefault(),g=-1);break;case 40:r.shiftKey?p=-1:(r.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(h=0,p=0),{cameraAnimation:x=>{const w=x.getZoom();x.easeTo({duration:300,easeId:"keyboardHandler",easing:Gp,zoom:a?Math.round(w)+a*(r.shiftKey?2:1):w,bearing:x.getBearing()+h*this._bearingStep,pitch:x.getPitch()+p*this._pitchStep,offset:[-m*this._panStep,-g*this._panStep],center:x.getCenter()},{originalEvent:r})}}}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 Gp(u){return u*(2-u)}const ql=4.000244140625,xu=1/450;class vu{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._handler=a,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=xu,s.br(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||s.d4()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let a=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const h=s.e.now(),p=h-(this._lastWheelEventTime||0);this._lastWheelEventTime=h,a!==0&&a%ql==0?this._type="wheel":a!==0&&Math.abs(a)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=a,this._timeout=window.setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(p*a)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),r.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=r,this._delta-=a,this._active||this._start(r)),r.preventDefault()}_onTimeout(r){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)}_start(r){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const a=di(this._el,r);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:a,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const r=this._map.transform;this._type==="wheel"&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const a=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>ql?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&S!==0&&(S=1/S);const I=a(),P=Math.pow(2,I),z=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):P;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(z*S))),this._type==="wheel"&&(this._startZoom=I,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:a(),p=this._startZoom,m=this._easing;let g,x=!1;if(this._type==="wheel"&&p&&m){const T=Math.min((s.e.now()-this._lastWheelEventTime)/200,1),S=m(T);g=s.a3(p,h,S),T<1?this._frameId||(this._frameId=!0):x=!0}else g=h,x=!0;this._active=!0,x&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let w=g-a();return w*this._lastDelta<0&&(w=0),{noInertia:!0,needsRenderFrame:!x,zoomDelta:w,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let a=s.d5;if(this._prevEase){const h=this._prevEase,p=(s.e.now()-h.start)/h.duration,m=h.easing(p+.01)-h.easing(p),g=.27/Math.sqrt(m*m+1e-4)*.01,x=Math.sqrt(.0729-g*g);a=s.d3(g,x,.25,1)}return this._prevEase={start:s.e.now(),duration:r,easing:a},a}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Zt("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class bu{constructor(r,a){this._clickZoom=r,this._tapZoom=a}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 sd{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(r,a){return r.preventDefault(),{cameraAnimation:h=>{h.easeTo({duration:300,zoom:h.getZoom()+(r.shiftKey?-1:1),around:h.unproject(a)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ad{constructor(){this._tap=new qn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(r,a,h){this._swipePoint||(this._tapTime&&r.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?h.length>0&&(this._swipePoint=a[0],this._swipeTouch=h[0].identifier):this._tap.touchstart(r,a,h))}touchmove(r,a,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;const p=a[0],m=p.y-this._swipePoint.y;return this._swipePoint=p,r.preventDefault(),this._active=!0,{zoomDelta:m/128}}}else this._tap.touchmove(r,a,h)}touchend(r,a,h){this._tapTime?this._swipePoint&&h.length===0&&this.reset():this._tap.touchend(r,a,h)&&(this._tapTime=r.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $p{constructor(r,a,h){this._el=r,this._mousePan=a,this._touchPan=h}enable(r){this._inertiaOptions=r||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class za{constructor(r,a,h){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=a,this._mousePitch=h}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Da{constructor(r,a,h,p){this._el=r,this._touchZoom=a,this._touchRotate=h,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-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()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Ra=u=>u.zoom||u.drag||u.pitch||u.rotate;class wr extends s.g{}class wu{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,a){const h=s.$.sub([],a,r);this.radius=s.$.length(h[2]<0?s.$.div([],h,this.constants):[h[0],h[1],0])}projectRay(r){s.$.div(r,r,this.constants),s.$.normalize(r,r),s.$.mul(r,r,this.constants);const a=s.$.scale([],r,this.radius);if(a[2]>0){const h=s.$.scale([],[0,0,1],s.$.dot(a,[0,0,1])),p=s.$.scale([],s.$.normalize([],[a[0],a[1],0]),this.radius),m=s.$.add([],a,s.$.scale([],s.$.sub([],s.$.add([],p,h),a),2));a[0]=m[0],a[1]=m[1]}return a}}function bo(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class Zl{constructor(r,a){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ed(r),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new wu,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(a),s.br(["handleEvent","handleWindowEvent"],this);const 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],[document,"mousemove",{capture:!0}],[document,"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],[window,"blur",void 0]];for(const[p,m,g]of this._listeners){const x=p===document?this.handleWindowEvent:this.handleEvent;p.addEventListener(m,x,g)}}destroy(){for(const[r,a,h]of this._listeners){const p=r===document?this.handleWindowEvent:this.handleEvent;r.removeEventListener(a,p,h)}}_addDefaultHandlers(r){const a=this._map,h=a.getCanvasContainer();this._add("mapEvent",new jl(a,r));const p=a.boxZoom=new xo(a,r);this._add("boxZoom",p);const m=new Ma,g=new sd;a.doubleClickZoom=new bu(g,m),this._add("tapZoom",m),this._add("clickZoom",g);const x=new ad;this._add("tapDragZoom",x);const w=a.touchPitch=new od(a);this._add("touchPitch",w);const T=new Ca(r),S=new $l(r);a.dragRotate=new za(r,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const I=new Aa(r),P=new id(a,r);a.dragPan=new $p(h,I,P),this._add("mousePan",I),this._add("touchPan",P,["touchZoom","touchRotate"]);const z=new nd,L=new rd;a.touchZoomRotate=new Da(h,L,z,x),this._add("touchRotate",z,["touchPan","touchZoom"]),this._add("touchZoom",L,["touchPan","touchRotate"]),this._add("blockableMapEvent",new gu(a));const k=a.scrollZoom=new vu(a,this);this._add("scrollZoom",k,["mousePan"]);const O=a.keyboard=new jp;this._add("keyboard",O);for(const B of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])r.interactive&&r[B]&&a[B].enable(r[B])}_add(r,a,h){this._handlers.push({handlerName:r,handler:a,allowed:h}),this._handlersById[r]=a}stop(r){if(!this._updatingCamera){for(const{handler:a}of this._handlers)a.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ra(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(r,a,h){for(const p in r)if(p!==h&&(!a||a.indexOf(p)<0))return!0;return!1}handleWindowEvent(r){this.handleEvent(r,`${r.type}Window`)}_getMapTouches(r){const a=[];for(const h of r)this._el.contains(h.target)&&a.push(h);return a}handleEvent(r,a){this._updatingCamera=!0;const h=r.type==="renderFrame",p=h?void 0:r,m={needsRenderFrame:!1},g={},x={},w=r.touches?this._getMapTouches(r.touches):void 0,T=w?fi(this._el,w):h?void 0:di(this._el,r);for(const{handlerName:P,handler:z,allowed:L}of this._handlers){if(!z.isEnabled())continue;let k;this._blockedByActive(x,L,P)?z.reset():z[a||r.type]&&(k=z[a||r.type](r,T,w),this.mergeHandlerResult(m,g,k,P,p),k&&k.needsRenderFrame&&this._triggerRenderFrame()),(k||z.isActive())&&(x[P]=z)}const S={};for(const P in this._previousActiveHandlers)x[P]||(S[P]=p);this._previousActiveHandlers=x,(Object.keys(S).length||bo(m))&&(this._changes.push([m,g,S]),this._triggerRenderFrame()),(Object.keys(x).length||bo(m))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:I}=m;I&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],I(this._map))}mergeHandlerResult(r,a,h,p,m){if(!h)return;s.Q(r,h);const g={handlerName:p,originalEvent:h.originalEvent||m};h.zoomDelta!==void 0&&(a.zoom=g),h.panDelta!==void 0&&(a.drag=g),h.pitchDelta!==void 0&&(a.pitch=g),h.bearingDelta!==void 0&&(a.rotate=g)}_applyChanges(){const r={},a={},h={};for(const[p,m,g]of this._changes)p.panDelta&&(r.panDelta=(r.panDelta||new s.P(0,0))._add(p.panDelta)),p.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+p.pitchDelta),p.around!==void 0&&(r.around=p.around),p.aroundCoord!==void 0&&(r.aroundCoord=p.aroundCoord),p.pinchAround!==void 0&&(r.pinchAround=p.pinchAround),p.noInertia&&(r.noInertia=p.noInertia),s.Q(a,m),s.Q(h,g);this._updateMapTransform(r,a,h),this._changes=[]}_updateMapTransform(r,a,h){const p=this._map,m=p.transform,g=G=>[G.x,G.y,G.z];if((G=>{const $=this._eventsInProgress.drag;return $&&!this._handlersById[$.handlerName].isActive()})()&&!bo(r)){const G=m.zoom;m.cameraElevationReference="sea",this._originalZoom!=null&&m._orthographicProjectionAtLowPitch&&m.projection.name!=="globe"&&m.pitch===0?(m.cameraElevationReference="ground",m.zoom=this._originalZoom):(m.recenterOnTerrain(),m.cameraElevationReference="ground"),G!==m.zoom&&this._map._update(!0)}if(m._isCameraConstrained&&p._stop(!0),!bo(r))return void this._fireEvents(a,h,!0);let{panDelta:x,zoomDelta:w,bearingDelta:T,pitchDelta:S,around:I,aroundCoord:P,pinchAround:z}=r;m._isCameraConstrained&&(w>0&&(w=0),m._isCameraConstrained=!1),z!==void 0&&(I=z),(w||(G=>a[G]&&!this._eventsInProgress[G])("drag"))&&I&&(this._dragOrigin=g(m.pointCoordinate3D(I)),this._originalZoom=m.zoom,this._trackingEllipsoid.setup(m._camera.position,this._dragOrigin)),m.cameraElevationReference="sea",p._stop(!0),I=I||p.transform.centerPoint,T&&(m.bearing+=T),S&&(m.pitch+=S),m._updateCameraState();const L=[0,0,0];if(x)if(m.projection.name==="mercator"){const G=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(I).dir),$=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(I.sub(x)).dir);L[0]=$[0]-G[0],L[1]=$[1]-G[1]}else{const G=m.pointCoordinate(I);if(m.projection.name==="globe"){x=x.rotate(-m.angle);const $=m._pixelsPerMercatorPixel/m.worldSize;L[0]=-x.x*s.d6(s.az(G.y))*$,L[1]=-x.y*s.d6(m.center.lat)*$}else{const $=m.pointCoordinate(I.sub(x));G&&$&&(L[0]=$.x-G.x,L[1]=$.y-G.y)}}const k=m.zoom,O=[0,0,0];if(w){const G=g(P||m.pointCoordinate3D(I)),$={dir:s.$.normalize([],s.$.sub([],G,m._camera.position))};if($.dir[2]<0){const j=m.zoomDeltaToMovement(G,w);s.$.scale(O,$.dir,j)}}const B=s.$.add(L,L,O);m._translateCameraConstrained(B),w&&Math.abs(m.zoom-k)>1e-4&&m.recenterOnTerrain(),m.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(a,h,!0)}_fireEvents(r,a,h){const p=Ra(this._eventsInProgress),m=Ra(r),g={};for(const S in r){const{originalEvent:I}=r[S];this._eventsInProgress[S]||(g[`${S}start`]=I),this._eventsInProgress[S]=r[S]}!p&&m&&this._fireEvent("movestart",m.originalEvent);for(const S in g)this._fireEvent(S,g[S]);m&&this._fireEvent("move",m.originalEvent);for(const S in r){const{originalEvent:I}=r[S];this._fireEvent(S,I)}const x={};let w;for(const S in this._eventsInProgress){const{handlerName:I,originalEvent:P}=this._eventsInProgress[S];this._handlersById[I].isActive()||(delete this._eventsInProgress[S],w=a[I]||P,x[`${S}end`]=w)}for(const S in x)this._fireEvent(S,x[S]);const T=Ra(this._eventsInProgress);if(h&&(p||m)&&!T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),I=P=>P!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new wr("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Wl="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Tu extends s.E{constructor(r,a){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=a.bearingSnap,this._respectPrefersReducedMotion=a.respectPrefersReducedMotion!==!1,s.br(["_renderFrameCallback"],this)}getCenter(){return new s.aJ(this.transform.center.lng,this.transform.center.lat)}setCenter(r,a){return this.jumpTo({center:r},a)}panBy(r,a,h){return r=s.P.convert(r).mult(-1),this.panTo(this.transform.center,s.Q({offset:r},a),h)}panTo(r,a,h){return this.easeTo(s.Q({center:r},a),h)}getZoom(){return this.transform.zoom}setZoom(r,a){return this.jumpTo({zoom:r},a),this}zoomTo(r,a,h){return this.easeTo(s.Q({zoom:r},a),h)}zoomIn(r,a){return this.zoomTo(this.getZoom()+1,r,a),this}zoomOut(r,a){return this.zoomTo(this.getZoom()-1,r,a),this}getBearing(){return this.transform.bearing}setBearing(r,a){return this.jumpTo({bearing:r},a),this}getPadding(){return this.transform.padding}setPadding(r,a){return this.jumpTo({padding:r},a),this}rotateTo(r,a,h){return this.easeTo(s.Q({bearing:r},a),h)}resetNorth(r,a){return this.rotateTo(0,s.Q({duration:1e3},r),a),this}resetNorthPitch(r,a){return this.easeTo(s.Q({bearing:0,pitch:0,duration:1e3},r),a),this}snapToNorth(r,a){return Math.abs(this.getBearing())r.aspect?h/(2*Math.tan(.5*r.fovX)*r.aspect):p/(2*Math.tan(.5*r.fovY)*r.aspect)}_cameraForBoundsOnGlobe(r,a,h,p,m,g){const x=r.clone(),w=this._extendCameraOptions(g);x.bearing=p,x.pitch=m;const T=s.aJ.convert(a),S=s.aJ.convert(h),I=.5*(T.lat+S.lat),P=.5*(T.lng+S.lng),z=s.d7(I,P),L=s.$.normalize([],z),k=s.$.normalize([],s.$.cross([],L,[0,1,0])),O=s.$.cross([],k,L),B=[k[0],k[1],k[2],0,O[0],O[1],O[2],0,L[0],L[1],L[2],0,0,0,0,1],G=[z,s.d7(T.lat,T.lng),s.d7(S.lat,T.lng),s.d7(S.lat,S.lng),s.d7(T.lat,S.lng),s.d7(I,T.lng),s.d7(I,S.lng),s.d7(T.lat,P),s.d7(S.lat,P)];let $=s.b8.fromPoints(G.map(ne=>[s.$.dot(k,ne),s.$.dot(O,ne),s.$.dot(L,ne)]));const j=s.$.transformMat4([],$.center,B);s.$.squaredLength(j)===0&&s.$.set(j,0,0,1),s.$.normalize(j,j),s.$.scale(j,j,s.cF),x.center=s.d8(j);const J=x.getWorldToCameraMatrix(),Z=s.ae.invert(new Float64Array(16),J);$=s.b8.applyTransform($,s.ae.multiply([],J,B));const W=this._extendAABB($,x,w,p);if(!W)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");$=W,s.$.transformMat4(j,j,J);const ee=.5*($.max[2]-$.min[2]),ie=this._minimumAABBFrustumDistance(x,$),ue=s.$.scale([],[0,0,1],ee),re=s.$.add(ue,j,ue),Y=ie+(x.pitch===0?0:s.$.distance(j,re)),_e=x.globeCenterInViewSpace,fe=s.$.sub([],j,[_e[0],_e[1],_e[2]]);s.$.normalize(fe,fe),s.$.scale(fe,fe,Y);const se=s.$.add([],j,fe);s.$.transformMat4(se,se,Z);const Ce=s.da/s.cF,Se=s.$.length(se),he=s.ay(Math.max(Se*Ce-s.da,Number.EPSILON),0),ve=Math.min(x.zoomFromMercatorZAdjusted(he),w.maxZoom);return ve>.5*(s.b3+s.aV)?(x.setProjection({name:"mercator"}),x.zoom=ve,this._cameraForBounds(x,a,h,p,m,g)):{center:x.center,zoom:ve,bearing:p,pitch:m}}_extendAABB(r,a,h,p){const m=.5*((h.padding.left||0)+(h.padding.right||0)),g=.5*((h.padding.top||0)+(h.padding.bottom||0)),x=g,w=m,T=m,S=g,I=a.width-(w+T),P=a.height-(x+S),z=s.$.sub([],r.max,r.min),L=Math.min(I/z[0],P/z[1]),k=Math.min(a.scaleZoom(a.scale*L),h.maxZoom);if(isNaN(k))return null;const O=a.scale/a.zoomScale(k),B=new s.b8([r.min[0]-w*O,r.min[1]-S*O,r.min[2]],[r.max[0]+T*O,r.max[1]+x*O,r.max[2]]),G=(typeof h.offset.x=="number"&&typeof h.offset.y=="number"?new s.P(h.offset.x,h.offset.y):s.P.convert(h.offset)).rotate(-s.ac(p));return B.center[0]-=G.x*O,B.center[1]+=G.y*O,B}queryTerrainElevation(r,a){const h=this.transform.elevation;return h?(a=s.Q({},{exaggerated:!0},a),h.getAtPoint(s._.fromLngLat(r),null,a.exaggerated)):null}_cameraForBounds(r,a,h,p,m,g){if(r.projection.name==="globe")return this._cameraForBoundsOnGlobe(r,a,h,p,m,g);const x=r.clone(),w=this._extendCameraOptions(g);x.bearing=p,x.pitch=m;const T=s.aJ.convert(a),S=s.aJ.convert(h),I=new s.aJ(T.lng,S.lat),P=new s.aJ(S.lng,T.lat),z=x.project(T),L=x.project(S),k=this.queryTerrainElevation(T),O=this.queryTerrainElevation(S),B=this.queryTerrainElevation(I),G=this.queryTerrainElevation(P),$=[[z.x,z.y,Math.min(k||0,O||0,B||0,G||0)],[L.x,L.y,Math.max(k||0,O||0,B||0,G||0)]];let j=s.b8.fromPoints($);const J=x.getWorldToCameraMatrix(),Z=s.ae.invert(new Float64Array(16),J);j=s.b8.applyTransform(j,J);const W=this._extendAABB(j,x,w,p);if(!W)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");j=W;const ee=.5*s.$.sub([],j.max,j.min)[2],ie=this._minimumAABBFrustumDistance(x,j),ue=[0,0,1,0];s.aB.transformMat4(ue,ue,J),s.aB.normalize(ue,ue);const re=s.$.scale([],ue,ie+ee),Y=s.$.add([],j.center,re);s.$.transformMat4(j.center,j.center,Z),s.$.transformMat4(Y,Y,Z);const _e=[j.center[0],j.center[1],Y[2]*x.pixelsPerMeter];s.$.scale(_e,_e,1/x.worldSize);const fe=s.d9(_e[0]),se=s.az(_e[1]),Ce=Math.min(x._zoomFromMercatorZ(_e[2]),w.maxZoom),Se=new s.aJ(fe,se);return x.mercatorFromTransition&&Ce<.5*(s.b3+s.aV)?(x.setProjection({name:"globe"}),x.zoom=Ce,this._cameraForBounds(x,a,h,p,m,g)):{center:Se,zoom:Ce,bearing:p,pitch:m}}fitBounds(r,a,h){const p=this.cameraForBounds(r,a);return this._fitInternal(p,a,h)}fitScreenCoordinates(r,a,h,p,m){const g=s.P.convert(r),x=s.P.convert(a),w=new s.P(Math.min(g.x,x.x),Math.min(g.y,x.y)),T=new s.P(Math.max(g.x,x.x),Math.max(g.y,x.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(g,x))return this;const S=this.transform.pointLocation3D(w),I=this.transform.pointLocation3D(T),P=this.transform.pointLocation3D(new s.P(w.x,T.y)),z=this.transform.pointLocation3D(new s.P(T.x,w.y)),L=[Math.min(S.lng,I.lng,P.lng,z.lng),Math.min(S.lat,I.lat,P.lat,z.lat)],k=[Math.max(S.lng,I.lng,P.lng,z.lng),Math.max(S.lat,I.lat,P.lat,z.lat)],O=p&&p.pitch?p.pitch:this.getPitch(),B=this._cameraForBounds(this.transform,L,k,h,O,p);return this._fitInternal(B,p,m)}_fitInternal(r,a,h){return r?(a=s.Q(r,a)).linear?this.easeTo(a,h):this.flyTo(a,h):this}jumpTo(r,a){this.stop();const h=r.preloadOnly?this.transform.clone():this.transform;let p=!1,m=!1,g=!1;if("zoom"in r&&h.zoom!==+r.zoom&&(p=!0,h.zoom=+r.zoom),r.center!==void 0&&(h.center=s.aJ.convert(r.center)),"bearing"in r&&h.bearing!==+r.bearing&&(m=!0,h.bearing=+r.bearing),"pitch"in r&&h.pitch!==+r.pitch&&(g=!0,h.pitch=+r.pitch),r.padding!=null){const x=typeof r.padding=="number"?this._extendPadding(r.padding):r.padding;h.isPaddingEqual(x)||(h.padding=x)}return r.preloadOnly?(this._preloadTiles(h),this):(this.fire(new s.g("movestart",a)).fire(new s.g("move",a)),p&&this.fire(new s.g("zoomstart",a)).fire(new s.g("zoom",a)).fire(new s.g("zoomend",a)),m&&this.fire(new s.g("rotatestart",a)).fire(new s.g("rotate",a)).fire(new s.g("rotateend",a)),g&&this.fire(new s.g("pitchstart",a)).fire(new s.g("pitch",a)).fire(new s.g("pitchend",a)),this.fire(new s.g("moveend",a)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||s.w(Wl),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,a){const h=this.transform;if(!h.projection.supportsFreeCamera)return s.w(Wl),this;this.stop();const p=h.zoom,m=h.pitch,g=h.bearing;h.setFreeCameraOptions(r);const x=p!==h.zoom,w=m!==h.pitch,T=g!==h.bearing;return this.fire(new s.g("movestart",a)).fire(new s.g("move",a)),x&&this.fire(new s.g("zoomstart",a)).fire(new s.g("zoom",a)).fire(new s.g("zoomend",a)),T&&this.fire(new s.g("rotatestart",a)).fire(new s.g("rotate",a)).fire(new s.g("rotateend",a)),w&&this.fire(new s.g("pitchstart",a)).fire(new s.g("pitch",a)).fire(new s.g("pitchend",a)),this.fire(new s.g("moveend",a)),this}easeTo(r,a){this._stop(!1,r.easeId),((r=s.Q({offset:[0,0],duration:500,easing:s.d5},r)).animate===!1||this._prefersReducedMotion(r))&&(r.duration=0);const h=this.transform,p=this.getZoom(),m=this.getBearing(),g=this.getPitch(),x=this.getPadding(),w="zoom"in r?+r.zoom:p,T="bearing"in r?this._normalizeBearing(r.bearing,m):m,S="pitch"in r?+r.pitch:g,I=this._extendPadding(r.padding),P=s.P.convert(r.offset);let z,L,k;if(h.projection.name==="globe"){const ie=s._.fromLngLat(h.center),ue=P.rotate(-h.angle);ie.x+=ue.x/h.worldSize,ie.y+=ue.y/h.worldSize;const re=ie.toLngLat(),Y=s.aJ.convert(r.center||re);this._normalizeCenter(Y),z=h.centerPoint.add(ue),L=new s.P(ie.x,ie.y).mult(h.worldSize),k=new s.P(s.ak(Y.lng),s.al(Y.lat)).mult(h.worldSize).sub(L)}else{z=h.centerPoint.add(P);const ie=h.pointLocation(z),ue=s.aJ.convert(r.center||ie);this._normalizeCenter(ue),L=h.project(ie),k=h.project(ue).sub(L)}const O=h.zoomScale(w-p);let B,G;r.around&&(B=s.aJ.convert(r.around),G=h.locationPoint(B));const $=this._zooming||w!==p,j=this._rotating||m!==T,J=this._pitching||S!==g,Z=!h.isPaddingEqual(I),W=ie=>ue=>{if($&&(ie.zoom=s.a3(p,w,ue)),j&&(ie.bearing=s.a3(m,T,ue)),J&&(ie.pitch=s.a3(g,S,ue)),Z&&(ie.interpolatePadding(x,I,ue),z=ie.centerPoint.add(P)),B)ie.setLocationAtPoint(B,G);else{const re=ie.zoomScale(ie.zoom-p),Y=w>p?Math.min(2,O):Math.max(.5,O),_e=Math.pow(Y,1-ue),fe=ie.unproject(L.add(k.mult(ue*_e)).mult(re));ie.setLocationAtPoint(ie.renderWorldCopies?fe.wrap():fe,z)}return r.preloadOnly||this._fireMoveEvents(a),ie};if(r.preloadOnly){const ie=this._emulate(W,r.duration,h);return this._preloadTiles(ie),this}const ee={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=$,this._rotating=j,this._pitching=J,this._padding=Z,this._easeId=r.easeId,this._prepareEase(a,r.noMoveStart,ee),this._ease(W(h),ie=>{h.cameraElevationReference==="sea"&&h.recenterOnTerrain(),this._afterEase(a,ie)},r),this}_prepareEase(r,a,h={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),a||h.moving||this.fire(new s.g("movestart",r)),this._zooming&&!h.zooming&&this.fire(new s.g("zoomstart",r)),this._rotating&&!h.rotating&&this.fire(new s.g("rotatestart",r)),this._pitching&&!h.pitching&&this.fire(new s.g("pitchstart",r))}_fireMoveEvents(r){this.fire(new s.g("move",r)),this._zooming&&this.fire(new s.g("zoom",r)),this._rotating&&this.fire(new s.g("rotate",r)),this._pitching&&this.fire(new s.g("pitch",r))}_afterEase(r,a){if(this._easeId&&a&&this._easeId===a)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const h=this._zooming,p=this._rotating,m=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,h&&this.fire(new s.g("zoomend",r)),p&&this.fire(new s.g("rotateend",r)),m&&this.fire(new s.g("pitchend",r)),this.fire(new s.g("moveend",r))}flyTo(r,a){if(this._prefersReducedMotion(r)){const ve=s.ai(r,["center","zoom","bearing","pitch","around","padding"]);return this.jumpTo(ve,a)}this.stop(),r=s.Q({offset:[0,0],speed:1.2,curve:1.42,easing:s.d5},r);const h=this.transform,p=this.getZoom(),m=this.getBearing(),g=this.getPitch(),x=this.getPadding(),w="zoom"in r?s.au(+r.zoom,h.minZoom,h.maxZoom):p,T="bearing"in r?this._normalizeBearing(r.bearing,m):m,S="pitch"in r?+r.pitch:g,I=this._extendPadding(r.padding),P=h.zoomScale(w-p),z=s.P.convert(r.offset);let L=h.centerPoint.add(z);const k=h.pointLocation(L),O=s.aJ.convert(r.center||k);this._normalizeCenter(O);const B=h.project(k),G=h.project(O).sub(B);let $=r.curve;const j=Math.max(h.width,h.height),J=j/P,Z=G.mag();if("minZoom"in r){const ve=s.au(Math.min(r.minZoom,p,w),h.minZoom,h.maxZoom),ne=j/h.zoomScale(ve-p);$=Math.sqrt(ne/Z*2)}const W=$*$;function ee(ve){const ne=(J*J-j*j+(ve?-1:1)*W*W*Z*Z)/(2*(ve?J:j)*W*Z);return Math.log(Math.sqrt(ne*ne+1)-ne)}function ie(ve){return(Math.exp(ve)-Math.exp(-ve))/2}function ue(ve){return(Math.exp(ve)+Math.exp(-ve))/2}const re=ee(0);let Y=function(ve){return ue(re)/ue(re+$*ve)},_e=function(ve){return j*((ue(re)*(ie(ne=re+$*ve)/ue(ne))-ie(re))/W)/Z;var ne},fe=(ee(1)-re)/$;if(Math.abs(Z)<1e-6||!isFinite(fe)){if(Math.abs(j-J)<1e-6)return this.easeTo(r,a);const ve=Jr.maxDuration&&(r.duration=0);const se=m!==T,Ce=S!==g,Se=!h.isPaddingEqual(I),he=ve=>ne=>{const Me=ne*fe,Ae=1/Y(Me);ve.zoom=ne===1?w:p+ve.scaleZoom(Ae),se&&(ve.bearing=s.a3(m,T,ne)),Ce&&(ve.pitch=s.a3(g,S,ne)),Se&&(ve.interpolatePadding(x,I,ne),L=ve.centerPoint.add(z));const Ue=ne===1?O:ve.unproject(B.add(G.mult(_e(Me))).mult(Ae));return ve.setLocationAtPoint(ve.renderWorldCopies?Ue.wrap():Ue,L),ve._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(a),ve};if(r.preloadOnly){const ve=this._emulate(he,r.duration,h);return this._preloadTiles(ve),this}return this._zooming=!0,this._rotating=se,this._pitching=Ce,this._padding=Se,this._prepareEase(a,!1),this._ease(he(h),()=>this._afterEase(a),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(r){}_cancelRenderFrame(r){}_stop(r,a){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const h=this._onEaseEnd;this._onEaseEnd=void 0,h.call(this,a)}if(!r){const h=this.handlers;h&&h.stop(!1)}return this}_ease(r,a,h){h.animate===!1||h.duration===0?(r(1),a()):(this._easeStart=s.e.now(),this._easeOptions=h,this._onEaseFrame=r,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((s.e.now()-this._easeStart)/this._easeOptions.duration,1),a=this._onEaseFrame;a&&a(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,a){r=s.av(r,-180,180);const h=Math.abs(r-a);return Math.abs(r-360-a)180?-360:h<-180?360:0}_prefersReducedMotion(r){return this._respectPrefersReducedMotion&&s.e.prefersReducedMotion&&!(r&&r.essential)}_emulate(r,a,h){const p=Math.ceil(15*a/1e3),m=[],g=r(h.clone());for(let x=0;x<=p;x++){const w=g(x/p);m.push(w.clone())}return m}_preloadTiles(r,a){}}class La{constructor(r={}){this.options=r,s.br(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(r){const a=this.options&&this.options.compact,h=r._getUIString("AttributionControl.ToggleAttribution");this._map=r,this._container=Zt("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Zt("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",h);const p=Zt("span","mapboxgl-ctrl-icon",this._compactButton);return p.setAttribute("aria-hidden","true"),p.setAttribute("title",h),this._innerContainer=Zt("div","mapboxgl-ctrl-attrib-inner",this._container),a&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),a===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));const a=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||s.db.ACCESS_TOKEN}];if(r){const h=a.reduce((p,m,g)=>(m.value&&(p+=`${m.key}=${m.value}${gp.length-m.length),r=r.filter((p,m)=>{for(let g=m+1;g=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=[...this.options.customAttribution,...r]:r.unshift(this.options.customAttribution));const h=r.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,r.length?(this._innerContainer.innerHTML=h,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Hl{constructor(){s.br(["_updateLogo","_updateCompact"],this)}onAdd(r){this._map=r,this._container=Zt("div","mapboxgl-ctrl");const a=Zt("a","mapboxgl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://www.mapbox.com/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(r){r&&r.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const r=this._map.style._sourceCaches;if(Object.entries(r).length===0)return!0;for(const a in r){const h=r[a].getSource();if(h.hasOwnProperty("mapbox_logo")&&!h.mapbox_logo)return!1}return!0}_updateCompact(){const r=this._container.children;if(r.length){const a=r[0];this._map.getCanvasContainer().offsetWidth<250?a.classList.add("mapboxgl-compact"):a.classList.remove("mapboxgl-compact")}}}class Xl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const a=++this._id;return this._queue.push({callback:r,id:a,cancelled:!1}),a}remove(r){const a=this._currentlyRunning,h=a?this._queue.concat(a):this._queue;for(const p of h)if(p.id===r)return void(p.cancelled=!0)}run(r=0){const a=this._currentlyRunning=this._queue;this._queue=[];for(const h of a)if(!h.cancelled&&(h.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function ka(u,r,a){if(u=new s.aJ(u.lng,u.lat),r){const h=new s.aJ(u.lng-360,u.lat),p=new s.aJ(u.lng+360,u.lat),m=360*Math.ceil(Math.abs(u.lng-a.center.lng)/360),g=a.locationPoint(u).distSqr(r),x=r.x<0||r.y<0||r.x>a.width||r.y>a.height;a.locationPoint(h).distSqr(r)180;){const h=a.locationPoint(u);if(h.x>=0&&h.y>=0&&h.x<=a.width&&h.y<=a.height)break;u.lng>a.center.lng?u.lng-=360:u.lng+=360}return u}const Yl={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%)"};class Jl extends s.E{constructor(r,a){if(super(),(r instanceof HTMLElement||a)&&(r=s.Q({element:r},a)),s.br(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=r&&r.occludedOpacity||.2,r&&r.element)this._element=r.element,this._offset=s.P.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=Zt("div");const m=41,g=27,x=Di("svg",{display:"block",height:m*this._scale+"px",width:g*this._scale+"px",viewBox:`0 0 ${g} ${m}`},this._element),w=Di("radialGradient",{id:"shadowGradient"},Di("defs",{},x));Di("stop",{offset:"10%","stop-opacity":.4},w),Di("stop",{offset:"100%","stop-opacity":.05},w),Di("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},x),Di("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},x),Di("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},x),Di("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},x),this._offset=s.P.convert(r&&r.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",m=>{m.preventDefault()}),this._element.addEventListener("mousedown",m=>{m.preventDefault()});const h=this._element.classList;for(const m in Yl)h.remove(`mapboxgl-marker-anchor-${m}`);h.add(`mapboxgl-marker-anchor-${this._anchor}`);const p=r&&r.className?r.className.trim().split(/\s+/):[];h.add(...p),this._popup=null}addTo(r){return r===this._map||(this.remove(),this._map=r,r.getCanvasContainer().appendChild(this._element),r.on("move",this._updateMoving),r.on("moveend",this._update),r.on("remove",this._clearFadeTimer),r._addMarker(this),this.setDraggable(this._draggable),this._update(),r.on("click",this._onMapClick)),this}remove(){const r=this._map;return r&&(r.off("click",this._onMapClick),r.off("move",this._updateMoving),r.off("moveend",this._update),r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler),r.off("mouseup",this._onUp),r.off("touchend",this._onUp),r.off("mousemove",this._onMove),r.off("touchmove",this._onMove),r.off("remove",this._clearFadeTimer),r._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=s.aJ.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(r){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),r){if(!("offset"in r.options)){const p=Math.sqrt(Math.pow(13.5,2)/2);r.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=r,r._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(r){const a=r.code,h=r.charCode||r.keyCode;a!=="Space"&&a!=="Enter"&&h!==32&&h!==13||this.togglePopup()}_onMapClick(r){const a=r.originalEvent.target,h=this._element;this._popup&&(a===h||h.contains(a))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const r=this._popup;return r?(r.isOpen()?(r.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(r.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const r=this._map,a=this._pos;if(!r||!a)return!1;const h=r.unproject(a),p=r.getFreeCameraOptions();if(!p.position)return!1;const m=p.position.toLngLat();return m.distanceTo(h)<.9*m.distanceTo(this._lngLat)}_evaluateOpacity(){const r=this._map;if(!r)return;const a=this._pos;if(!a||a.x<0||a.x>r.transform.width||a.y<0||a.y>r.transform.height)return void this._clearFadeTimer();const h=r.unproject(a);let p;r._showingGlobe()&&s.dc(r.transform,this._lngLat)?p=0:(p=1-r._queryFogOpacity(h),r.transform._terrainEnabled()&&r.getTerrain()&&this._behindTerrain()&&(p*=this._occludedOpacity)),this._element.style.opacity=`${p}`,this._element.style.pointerEvents=p>0?"auto":"none",this._popup&&this._popup._setOpacity(p),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const r=this._pos;if(!r||!this._map)return;const a=this._offset.mult(this._scale);this._element.style.transform=` - translate(${r.x}px,${r.y}px) - ${Yl[this._anchor]} - ${this._calculateXYTransform()} ${this._calculateZTransform()} - translate(${a.x}px,${a.y}px) - `}_calculateXYTransform(){const r=this._pos,a=this._map,h=this.getPitchAlignment();if(!a||!r||h!=="map")return"";if(!a._showingGlobe()){const w=a.getPitch();return w?`rotateX(${w}deg)`:""}const p=s.b1(s.dd(a.transform,this._lngLat)),m=r.sub(s.de(a.transform)),g=Math.abs(m.x)+Math.abs(m.y);if(g===0)return"";const x=p/g;return`rotateX(${-m.y*x}deg) rotateY(${m.x*x}deg)`}_calculateZTransform(){const r=this._pos,a=this._map;if(!a||!r)return"";let h=0;const p=this.getRotationAlignment();if(p==="map")if(a._showingGlobe()){const m=a.project(new s.aJ(this._lngLat.lng,this._lngLat.lat+.001)),g=a.project(new s.aJ(this._lngLat.lng,this._lngLat.lat-.001)).sub(m);h=s.b1(Math.atan2(g.y,g.x))-90}else h=-a.getBearing();else if(p==="horizon"){const m=s.a0(4,6,a.getZoom()),g=s.de(a.transform);g.y+=m*a.transform.height;const x=r.sub(g),w=s.b1(Math.atan2(x.y,x.x));h=(w>90?w-270:w+90)*(1-m)}return h+=this._rotation,h?`rotateZ(${h}deg)`:""}_update(r){cancelAnimationFrame(this._updateFrameId);const a=this._map;a&&(a.transform.renderWorldCopies&&(this._lngLat=ka(this._lngLat,this._pos,a.transform)),this._pos=a.project(this._lngLat),r===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),a._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(a._showingGlobe()||a.getTerrain()||a.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=s.P.convert(r),this._update(),this}addClassName(r){return this._element.classList.add(r),this}removeClassName(r){return this._element.classList.remove(r),this}toggleClassName(r){return this._element.classList.toggle(r)}_onMove(r){const a=this._map;if(!a)return;const h=this._pointerdownPos,p=this._positionDelta;if(h&&p){if(!this._isDragging){const m=this._clickTolerance||a._clickTolerance;if(r.point.dist(h)=this._endTime)return this._end;const a=s.bb((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-a)+this._end*a}isEasing(r){return r>=this._startTime&&r<=this._endTime}jumpTo(r){this._startTime=-1/0,this._endTime=-1/0,this._start=r,this._end=r}easeTo(r,a,h){this._start=this.getValue(a),this._end=r,this._startTime=a,this._endTime=a+h}}const Wp={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class Hp{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}const Xp={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0},Eu={showCompass:!0,showZoom:!0,visualizePitch:!1};class Su{constructor(r,a,h=!1){this._clickTolerance=10,this.element=a,this.mouseRotate=new Ca({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,h&&(this.mousePitch=new $l({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),s.br(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),a.addEventListener("mousedown",this.mousedown),a.addEventListener("touchstart",this.touchstart,{passive:!1}),a.addEventListener("touchmove",this.touchmove),a.addEventListener("touchend",this.touchend),a.addEventListener("touchcancel",this.reset)}down(r,a){this.mouseRotate.mousedown(r,a),this.mousePitch&&this.mousePitch.mousedown(r,a),Dn()}move(r,a){const h=this.map,p=this.mouseRotate.mousemoveWindow(r,a),m=p&&p.bearingDelta;if(m&&h.setBearing(h.getBearing()+m),this.mousePitch){const g=this.mousePitch.mousemoveWindow(r,a),x=g&&g.pitchDelta;x&&h.setPitch(h.getPitch()+x)}}off(){const r=this.element;r.removeEventListener("mousedown",this.mousedown),r.removeEventListener("touchstart",this.touchstart,{passive:!1}),r.removeEventListener("touchmove",this.touchmove),r.removeEventListener("touchend",this.touchend),r.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){el(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(s.Q({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),di(this.element,r)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(r){this.move(r,di(this.element,r))}mouseup(r){this.mouseRotate.mouseupWindow(r),this.mousePitch&&this.mousePitch.mouseupWindow(r),this.offTemp()}touchstart(r){r.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=fi(this.element,r.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>r.preventDefault()},this._startPos))}touchmove(r){r.targetTouches.length!==1?this.reset():(this._lastPos=fi(this.element,r.targetTouches)[0],this.move({preventDefault:()=>r.preventDefault()},this._lastPos))}touchend(r){r.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)u.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(u.minPitch!=null&&u.maxPitch!=null&&u.minPitch>u.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(u.minPitch!=null&&u.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(u.maxPitch!=null&&u.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(u.antialias&&s.dh(window)&&(u.antialias=!1,s.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Qs(u.minZoom,u.maxZoom,u.minPitch,u.maxPitch,u.renderWorldCopies),u),this._repaint=!!u.repaint,this._interactive=u.interactive,this._minTileCacheSize=u.minTileCacheSize,this._maxTileCacheSize=u.maxTileCacheSize,this._failIfMajorPerformanceCaveat=u.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=u.preserveDrawingBuffer,this._antialias=u.antialias,this._trackResize=u.trackResize,this._bearingSnap=u.bearingSnap,this._refreshExpiredTiles=u.refreshExpiredTiles,this._fadeDuration=u.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=u.crossSourceCollisions,this._collectResourceTiming=u.collectResourceTiming,this._language=this._parseLanguage(u.language),this._worldview=u.worldview,this._renderTaskQueue=new Xl,this._domRenderTaskQueue=new Xl,this._controls=[],this._markers=[],this._popups=[],this._mapId=s.di(),this._locale=s.Q({},Wp,u.locale),this._clickTolerance=u.clickTolerance,this._cooperativeGestures=u.cooperativeGestures,this._performanceMetricsCollection=u.performanceMetricsCollection,this._tessellationStep=u.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=u.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Zp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._requestManager=new s.dj(u.transformRequest,u.accessToken,u.testMode),this._silenceAuthErrors=!!u.testMode,this._contextCreateOptions=u.contextCreateOptions?{...u.contextCreateOptions}:{},typeof u.container=="string"){const a=document.getElementById(u.container);if(!a)throw new Error(`Container '${u.container.toString()}' not found.`);this._container=a}else{if(!(u.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=u.container}if(this._container.childNodes.length>0&&s.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),u.maxBounds&&this.setMaxBounds(u.maxBounds),s.br(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new Hp),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Zl(this,u),this._localFontFamily=u.localFontFamily,this._localIdeographFontFamily=u.localIdeographFontFamily,(u.style||!u.testMode)&&this.setStyle(u.style||s.db.DEFAULT_STYLE,{config:u.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),u.projection&&this.setProjection(u.projection),u.hash&&(this._hash=new Qh(typeof u.hash=="string"&&u.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){r.center==null&&r.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:u.center,zoom:u.zoom,bearing:u.bearing,pitch:u.pitch});const a=u.bounds;a&&(this.resize(),this.fitBounds(a,s.Q({},u.fitBoundsOptions,{duration:0})))}this.resize(),u.attributionControl&&this.addControl(new La({customAttribution:u.customAttribution})),this._logoControl=new Hl,this.addControl(this._logoControl,u.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",a=>{this._update(a.dataType==="style"),this.fire(new s.g(`${a.dataType}data`,a))}),this.on("dataloading",a=>{this.fire(new s.g(`${a.dataType}dataloading`,a))})}_getMapId(){return this._mapId}addControl(u,r){if(r===void 0&&(r=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new s.f(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const a=u.onAdd(this);this._controls.push(u);const h=this._controlPositions[r];return r.indexOf("bottom")!==-1?h.insertBefore(a,h.firstChild):h.appendChild(a),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new s.f(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(u);return r>-1&&this._controls.splice(r,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(u){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const r=!this._moving;return r&&this.fire(new s.g("movestart",u)).fire(new s.g("move",u)),this.fire(new s.g("resize",u)),r&&this.fire(new s.g("moveend",u)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(u){return this.transform.setMaxBounds(s.aj.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=u,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=u,this._update(),this.getZoom()>u?this.setZoom(u):this.fire(new s.g("zoomstart")).fire(new s.g("zoom")).fire(new s.g("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.minPitch=u,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=u,this._update(),this.getPitch()>u?this.setPitch(u):this.fire(new s.g("pitchstart")).fire(new s.g("pitch")).fire(new s.g("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.renderWorldCopies=u,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(u){return u==="auto"?navigator.language:Array.isArray(u)?u.length===0?void 0:u.map(r=>r==="auto"?navigator.language:r):u}setLanguage(u){const r=this._parseLanguage(u);if(!this.style||r===this._language)return this;this._language=r,this.style.reloadSources();for(const a of this._controls)a._setLanguage&&a._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(u){return this.style&&u!==this._worldview?(this._worldview=u,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(u){return this._lazyInitEmptyStyle(),u?typeof u=="string"&&(u={name:u}):u=null,this._useExplicitProjection=!!u,this._prioritizeAndUpdateProjection(u,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const u=this.transform,r=u.projection.name;let a;r==="globe"&&u.zoom>=s.aV?(u.setMercatorFromTransition(),a=!0):r==="mercator"&&u.zoom=s.aV?this.transform.setMercatorFromTransition():this.transform.setProjection(u),this.style.applyProjectionUpdate(),r&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(u){return this.transform.locationPoint3D(s.aJ.convert(u))}unproject(u){return this.transform.pointLocation3D(s.P.convert(u))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(u,r,a){if(u==="mouseenter"||u==="mouseover"){let h=!1;const p=g=>{const x=r.filter(T=>this.getLayer(T)),w=x.length?this.queryRenderedFeatures(g.point,{layers:x}):[];w.length?h||(h=!0,a.call(this,new br(u,this,g.originalEvent,{features:w}))):h=!1},m=()=>{h=!1};return{layers:new Set(r),listener:a,delegates:{mousemove:p,mouseout:m}}}if(u==="mouseleave"||u==="mouseout"){let h=!1;const p=g=>{const x=r.filter(w=>this.getLayer(w));(x.length?this.queryRenderedFeatures(g.point,{layers:x}):[]).length?h=!0:h&&(h=!1,a.call(this,new br(u,this,g.originalEvent)))},m=g=>{h&&(h=!1,a.call(this,new br(u,this,g.originalEvent)))};return{layers:new Set(r),listener:a,delegates:{mousemove:p,mouseout:m}}}{const h=p=>{const m=r.filter(x=>this.getLayer(x)),g=m.length?this.queryRenderedFeatures(p.point,{layers:m}):[];g.length&&(p.features=g,a.call(this,p),delete p.features)};return{layers:new Set(r),listener:a,delegates:{[u]:h}}}}on(u,r,a){if(typeof r=="function"||a===void 0)return super.on(u,r);if(Array.isArray(r)||(r=[r]),r){for(const p of r)if(!this._isValidId(p))return this}const h=this._createDelegatedListener(u,r,a);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(h);for(const p in h.delegates)this.on(p,h.delegates[p]);return this}once(u,r,a){if(typeof r=="function"||a===void 0)return super.once(u,r);if(Array.isArray(r)||(r=[r]),r){for(const p of r)if(!this._isValidId(p))return this}const h=this._createDelegatedListener(u,r,a);for(const p in h.delegates)this.once(p,h.delegates[p]);return this}off(u,r,a){if(typeof r=="function"||a===void 0)return super.off(u,r);const h=new Set(Array.isArray(r)?r:[r]);for(const g of h)if(!this._isValidId(g))return this;const p=(g,x)=>{if(g.size!==x.size)return!1;for(const w of g)if(!x.has(w))return!1;return!0},m=this._delegatedListeners?this._delegatedListeners[u]:void 0;return m&&(g=>{for(let x=0;x{a?(s.w(`Unable to perform style diff: ${String(a.message||a.error||a)}. Rebuilding the style from scratch.`),this._updateStyle(u,r)):h&&this._update(!0)},()=>{this._postStyleLoadEvent()}),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._updateStyle(u,r))}_getUIString(u){const r=this._locale[u];if(r==null)throw new Error(`Missing UI string '${u}'`);return r}_updateStyle(u,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),u){const a=s.Q({},r);r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new vr(this,a).load(u),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new vr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(s.w("There is no style added to the map."),!1)}_isValidId(u){return u==null?(this.fire(new s.f(new Error("IDs can't be empty."))),!1):!s.cY(u)||(this.fire(new s.f(new Error(`IDs can't contain special symbols: "${u}".`))),!1)}addSource(u,r){return this._isValidId(u)?(this._lazyInitEmptyStyle(),this.style.addSource(u,r),this._update(!0)):this}isSourceLoaded(u){return!!this._isValidId(u)&&!!this.style&&this.style._isSourceCacheLoaded(u)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(u,r,a){this._lazyInitEmptyStyle(),this.style.addSourceType(u,r,a)}removeSource(u){return this._isValidId(u)?(this.style.removeSource(u),this._updateTerrain(),this._update(!0)):this}getSource(u){return this._isValidId(u)?this.style.getOwnSource(u):null}addImage(u,r,{pixelRatio:a=1,sdf:h=!1,stretchX:p,stretchY:m,content:g}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){const{width:x,height:w,data:T}=s.e.getImageData(r);this.style.addImage(u,{data:new s.j({width:x,height:w},T),pixelRatio:a,stretchX:p,stretchY:m,content:g,sdf:h,version:0})}else if(r.width===void 0||r.height===void 0)this.fire(new s.f(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`")));else{const{width:x,height:w}=r,T=r;this.style.addImage(u,{data:new s.j({width:x,height:w},new Uint8Array(T.data)),pixelRatio:a,stretchX:p,stretchY:m,content:g,sdf:h,version:0,userImage:T}),T.onAdd&&T.onAdd(this,u)}}updateImage(u,r){this._lazyInitEmptyStyle();const a=this.style.getImage(u);if(!a)return void this.fire(new s.f(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const h=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?s.e.getImageData(r):r,{width:p,height:m,data:g}=h;if(p===void 0||m===void 0)return void this.fire(new s.f(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!==a.data.width||m!==a.data.height)return void this.fire(new s.f(new Error(`The width and height of the updated image (${p}, ${m}) - must be that same as the previous version of the image - (${a.data.width}, ${a.data.height})`)));const x=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);a.data.replace(g,x),this.style.updateImage(u,a)}hasImage(u){return u?!!this.style&&!!this.style.getImage(u):(this.fire(new s.f(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u,r){s.i(this._requestManager.transformRequest(u,s.R.Image),(a,h)=>{r(a,h instanceof HTMLImageElement?s.e.getImageData(h):h)})}listImages(){return this.style.listImages()}addModel(u,r){this._lazyInitEmptyStyle(),this.style.addModel(u,r)}hasModel(u){return u?this.style.hasModel(u):(this.fire(new s.f(new Error("Missing required model id"))),!1)}removeModel(u){this.style.removeModel(u)}listModels(){return this.style.listModels()}addLayer(u,r){return this._isValidId(u.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(u,r),this._update(!0)):this}getSlot(u){const r=this.getLayer(u);return r&&r.slot||null}setSlot(u,r){return this.style.setSlot(u,r),this.style.mergeLayers(),this._update(!0)}addImport(u,r){return this.style.addImport(u,r),this}updateImport(u,r){return typeof r!="string"&&r.id!==u?(this.removeImport(u),this.addImport(r)):(this.style.updateImport(u,r),this._update(!0))}removeImport(u){return this.style.removeImport(u),this}moveImport(u,r){return this.style.moveImport(u,r),this._update(!0)}moveLayer(u,r){return this._isValidId(u)?(this.style.moveLayer(u,r),this._update(!0)):this}removeLayer(u){return this._isValidId(u)?(this.style.removeLayer(u),this._update(!0)):this}getLayer(u){if(!this._isValidId(u))return null;const r=this.style.getOwnLayer(u);return r?r.type==="custom"?r.implementation:r.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(u,r,a){return this._isValidId(u)?(this.style.setLayerZoomRange(u,r,a),this._update(!0)):this}setFilter(u,r,a={}){return this._isValidId(u)?(this.style.setFilter(u,r,a),this._update(!0)):this}getFilter(u){return this._isValidId(u)?this.style.getFilter(u):null}setPaintProperty(u,r,a,h={}){return this._isValidId(u)?(this.style.setPaintProperty(u,r,a,h),this._update(!0)):this}getPaintProperty(u,r){return this._isValidId(u)?this.style.getPaintProperty(u,r):null}setLayoutProperty(u,r,a,h={}){return this._isValidId(u)?(this.style.setLayoutProperty(u,r,a,h),this._update(!0)):this}getLayoutProperty(u,r){return this._isValidId(u)?this.style.getLayoutProperty(u,r):null}getSchema(u){return this.style.getSchema(u)}setSchema(u,r){return this.style.setSchema(u,r),this._update(!0)}getConfig(u){return this.style.getConfig(u)}setConfig(u,r){return this.style.setConfig(u,r),this._update(!0)}getConfigProperty(u,r){return this.style.getConfigProperty(u,r)}setConfigProperty(u,r,a){return this.style.setConfigProperty(u,r,a),this._update(!0)}setLights(u){if(this._lazyInitEmptyStyle(),u&&u.length===1&&u[0].type==="flat"){const r=u[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(u),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const u=this.style.getLights()||[];return u.length===0&&u.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),u}setLight(u,r={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:u}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(u){return this._lazyInitEmptyStyle(),!u&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(u),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(u){return this._lazyInitEmptyStyle(),this.style.setFog(u),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setColorTheme(u){return this._lazyInitEmptyStyle(),this.style.setColorTheme(u),this._update(!0)}setCamera(u){return this.style.setCamera(u),this._triggerCameraUpdate(u)}_triggerCameraUpdate(u){return this._update(this.transform.setOrthographicProjectionAtLowPitch(u["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(u){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(s.aJ.convert(u),this.transform):0}setFeatureState(u,r){return this._isValidId(u.source)?(this.style.setFeatureState(u,r),this._update()):this}removeFeatureState(u,r){return this._isValidId(u.source)?(this.style.removeFeatureState(u,r),this._update()):this}getFeatureState(u){return this._isValidId(u.source)?this.style.getFeatureState(u):null}_updateContainerDimensions(){if(!this._container)return;const u=this._container.getBoundingClientRect().width||400,r=this._container.getBoundingClientRect().height||300;let a,h,p,m=this._container;for(;m&&(!h||!p);){const g=window.getComputedStyle(m).transform;g&&g!=="none"&&(a=g.match(/matrix.*\((.+)\)/)[1].split(", "),a[0]&&a[0]!=="0"&&a[0]!=="1"&&(h=a[0]),a[3]&&a[3]!=="0"&&a[3]!=="1"&&(p=a[3])),m=m.parentElement}this._containerWidth=h?Math.abs(u/h):u,this._containerHeight=p?Math.abs(r/p):r}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&s.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const u=this._container;u.classList.add("mapboxgl-map"),(this._missingCSSCanary=Zt("div","mapboxgl-canary",u)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=Zt("div","mapboxgl-canvas-container",u);this._canvas=Zt("canvas","mapboxgl-canvas",r),this._interactive&&(r.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const a=this._controlContainer=Zt("div","mapboxgl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{h[p]=Zt("div",`mapboxgl-ctrl-${p}`,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,r){const a=s.e.devicePixelRatio||1;this._canvas.width=a*Math.ceil(u),this._canvas.height=a*Math.ceil(r),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${r}px`}_addMarker(u){this._markers.push(u)}_removeMarker(u){const r=this._markers.indexOf(u);r!==-1&&this._markers.splice(r,1)}_addPopup(u){this._popups.push(u)}_removePopup(u){const r=this._popups.indexOf(u);r!==-1&&this._popups.splice(r,1)}_setupPainter(){const u=s.Q({},pr.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",u);r?(s.dk(r,!0),this.painter=new lu(r,this._contextCreateOptions,this.transform,this._tp),this.on("data",a=>{a.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),s.dl.testSupport(r)):this.fire(new s.f(new Error("Failed to initialize WebGL")))}_contextLost(u){u.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.g("webglcontextlost",{originalEvent:u}))}_contextRestored(u){this._setupPainter(),this.resize(),this._update(),this.fire(new s.g("webglcontextrestored",{originalEvent:u}))}_onMapScroll(u){if(u.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(u){return this.style?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_requestDomTask(u){!this.loaded()||this.loaded()&&!this.isMoving()?u():this._domRenderTaskQueue.add(u)}_render(u){let r;this.fire(new s.g("renderstart")),++this._frameId;const a=this.painter.context.extTimerQuery,h=s.e.now(),p=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=p.createQuery(),p.beginQuery(a.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(u),this._domRenderTaskQueue.run(u),this._removed)return;this._updateProjectionTransition();const m=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const T=this.transform.zoom,S=this.transform.pitch,I=s.e.now(),P=new s.Y(T,{now:I,fadeDuration:m,pitch:S,transition:this.style.transition});this.style.update(P)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let g=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),g=this._updateAverageElevation(h),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):g=this._updateAverageElevation(h);const x=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,m,this._crossSourceCollisions,this.painter.replacementSource);if(x&&(this._placementDirty=x.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:m,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new s.g("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.df.mark(s.dg.load),this.fire(new s.g("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),r){const T=s.e.now()-h;p.endQuery(a.TIME_ELAPSED_EXT),setTimeout(()=>{const S=p.getQueryParameter(r,p.QUERY_RESULT)/1e6;p.deleteQuery(r),this.fire(new s.g("gpu-timing-frame",{cpuTime:T,gpuTime:S}))},50)}if(this.listens("gpu-timing-layer")){const T=this.painter.collectGpuTimers();setTimeout(()=>{const S=this.painter.queryGpuTimers(T);this.fire(new s.g("gpu-timing-layer",{layerTimes:S}))},50)}if(this.listens("gpu-timing-deferred-render")){const T=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const S=this.painter.queryGpuTimeDeferredRender(T);this.fire(new s.g("gpu-timing-deferred-render",{gpuTime:S}))},50)}const w=this._sourcesDirty||this._styleDirty||this._placementDirty||g;if(w||this._repaint)this.triggerRepaint();else{const T=this.idle();if(T&&(g=this._updateAverageElevation(h,!0)),g)this.triggerRepaint();else if(this._triggerFrame(!1),T&&(this.fire(new s.g("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const S=this._calculateSpeedIndex();this.fire(new s.g("speedindexcompleted",{speedIndex:S})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||w||(this._fullyLoaded=!0,s.df.mark(s.dg.fullLoad),this._performanceMetricsCollection&&s.dm(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(u){for(const r of this._markers)u&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(const r of this._popups)!u||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(u,r=!1){const a=p=>(this.transform.averageElevation=p,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&a(0);const h=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(h||(r||u-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(u)){const p=this.transform.averageElevation;let m=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(m)?m=0:this._averageElevationLastSampledAt=u;const g=Math.abs(p-m);if(g>1){if(this._isInitialLoad||h)return this._averageElevation.jumpTo(m),a(m);this._averageElevation.easeTo(m,u,300)}else if(g>1e-4)return this._averageElevation.jumpTo(m),a(m)}return!!this._averageElevation.isEasing(u)&&a(this._averageElevation.getValue(u))}_authenticate(){s.dn(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,u=>{if(u&&(u.message===s.dp||u.status===401)){const r=this.painter.context.gl;s.dk(r,!1),this._logoControl instanceof Hl&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new s.f(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),s.dq(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&s.dr(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const u=this._isDragging();this.painter.updateTerrain(this.style,u)}_calculateSpeedIndex(){const u=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const a=this.painter.context.gl,h=a.createFramebuffer();function p(m){a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,m,0);const g=new Uint8Array(a.drawingBufferWidth*a.drawingBufferHeight*4);return a.readPixels(0,0,a.drawingBufferWidth,a.drawingBufferHeight,a.RGBA,a.UNSIGNED_BYTE,g),g}return a.bindFramebuffer(a.FRAMEBUFFER,h),this._canvasPixelComparison(p(u),r.canvasCopies.map(p),r.timeStamps)}_canvasPixelComparison(u,r,a){let h=a[1]-a[0];const p=u.length/4;for(let m=0;m{const a=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,a&&this._render(r)}))}_preloadTiles(u){const r=this.style?this.style.getSourceCaches():[];return s.dv(r,(a,h)=>a._preloadTiles(u,h),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(u){this._trackResize&&this.resize({originalEvent:u})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(u){this._showParseStatus!==u&&(this._showParseStatus=u,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(u){this._showTerrainWireframe!==u&&(this._showTerrainWireframe=u,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(u){this._showLayers2DWireframe!==u&&(this._showLayers2DWireframe=u,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(u){this._showLayers3DWireframe!==u&&(this._showLayers3DWireframe=u,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(u){this._speedIndexTiming!==u&&(this._speedIndexTiming=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,this._tp.refreshUI(),u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(u){this._showTileAABBs!==u&&(this._showTileAABBs=u,this._tp.refreshUI(),u&&this._update())}_setCacheLimits(u,r){s.dx(u,r)}get version(){return s.dw}},NavigationControl:class{constructor(u={}){this.options=s.Q({},Eu,u),this._container=Zt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(s.br(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",r=>{this._map&&this._map.zoomIn({},{originalEvent:r})}),Zt("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",r=>{this._map&&this._map.zoomOut({},{originalEvent:r})}),Zt("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.br(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",r=>{const a=this._map;a&&(this.options.visualizePitch?a.resetNorthPitch({},{originalEvent:r}):a.resetNorth({},{originalEvent:r}))}),this._compassIcon=Zt("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const u=this._map;if(!u)return;const r=u.getZoom(),a=r===u.getMaxZoom(),h=r===u.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=h,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",h.toString())}_rotateCompassArrow(){const u=this._map;if(!u)return;const r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(u.transform.pitch*(Math.PI/180)),.5)}) rotateX(${u.transform.pitch}deg) rotateZ(${u.transform.angle*(180/Math.PI)}deg)`:`rotate(${u.transform.angle*(180/Math.PI)}deg)`;u._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),u.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&u.on("pitch",this._rotateCompassArrow),u.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Su(u,this._compass,this.options.visualizePitch)),this._container}onRemove(){const u=this._map;u&&(this._container.remove(),this.options.showZoom&&u.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&u.off("pitch",this._rotateCompassArrow),u.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(u,r){const a=Zt("button",u,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(u,r){if(!this._map)return;const a=this._map._getUIString(`NavigationControl.${r}`);u.setAttribute("aria-label",a),u.firstElementChild&&u.firstElementChild.setAttribute("title",a)}},GeolocateControl:class extends s.E{constructor(u={}){super();const r=navigator.geolocation;this.options=s.Q({geolocation:r},cd,u),s.br(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Kh(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(u){return this._map=u,this._container=Zt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.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("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(u){const r=(a=!!this.options.geolocation)=>{this._supportsGeolocation=a,u(a)};this._supportsGeolocation!==void 0?u(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(a=>r(a.state!=="denied")).catch(()=>r()):r()}_isOutOfMapMaxBounds(u){const r=this._map.getMaxBounds(),a=u.coords;return!!r&&(a.longituder.getEast()||a.latituder.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(u){if(this._map){if(this._isOutOfMapMaxBounds(u))return this._setErrorState(),this.fire(new s.g("outofmaxbounds",u)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=u,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(u),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(u),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.g("geolocate",u)),this._finish()}}_updateCamera(u){const r=new s.aJ(u.coords.longitude,u.coords.latitude),a=u.coords.accuracy,h=this._map.getBearing(),p=s.Q({bearing:h},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(a),p,{geolocateSource:!0})}_updateMarker(u){if(u){const r=new s.aJ(u.coords.longitude,u.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=u.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const u=this._map.transform,r=s.ay(1,u._center.lat)*u.worldSize,a=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(u){if(this._map){if(this.options.trackUserLocation)if(u.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(u.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.g("error",u)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(u){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=Zt("button","mapboxgl-ctrl-geolocate",this._container),Zt("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",u===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{const r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Zt("div","mapboxgl-user-location"),this._dotElement.appendChild(Zt("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Zt("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Jl({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Zt("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Jl({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||this._watchState!=="ACTIVE_LOCK"||r.originalEvent&&r.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new s.g("trackuserlocationend")))})}}_onDeviceOrientation(u){this._userLocationDotMarker&&(u.webkitCompassHeading?this._heading=u.webkitCompassHeading:u.absolute===!0&&(this._heading=-1*u.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return s.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 s.g("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new s.g("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.g("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(u={maximumAge:6e5,timeout:0},this._noTimeout=!0):(u=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,u),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const u=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(r=>{r==="granted"&&u()}).catch(console.error):u()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:La,ScaleControl:class{constructor(u={}){this.options=s.Q({},fs,u),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),s.br(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const u=this.options.maxWidth||100,r=this._map,a=r._containerHeight/2,h=r._containerWidth/2-u/2,p=r.unproject([h,a]),m=r.unproject([h+u,a]),g=p.distanceTo(m);if(this.options.unit==="imperial"){const x=3.2808*g;x>5280?this._setScale(u,x/5280,"mile"):this._setScale(u,x,"foot")}else this.options.unit==="nautical"?this._setScale(u,g/1852,"nautical-mile"):g>=1e3?this._setScale(u,g/1e3,"kilometer"):this._setScale(u,g,"meter")}_setScale(u,r,a){this._map._requestDomTask(()=>{const h=function(m){const g=Math.pow(10,`${Math.floor(m)}`.length-1);let x=m/g;return x=x>=10?10:x>=5?5:x>=3?3:x>=2?2:x>=1?1:function(w){const T=Math.pow(10,Math.ceil(-Math.log(w)/Math.LN10));return Math.round(w*T)/T}(x),g*x}(r),p=h/r;this._container.innerHTML=this._isNumberFormatSupported&&a!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:a}).format(h):`${h} ${ud[a]}`,this._container.style.width=u*p+"px"})}onAdd(u){return this._map=u,this._language=u.getLanguage(),this._container=Zt("div","mapboxgl-ctrl mapboxgl-ctrl-scale",u.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(u){this._language=u,this._update()}setUnit(u){this.options.unit=u,this._update()}},FullscreenControl:class{constructor(u={}){this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:s.w("Full screen control 'container' must be a DOM element.")),s.br(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=Zt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const u=this._fullscreenButton=Zt("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Zt("span","mapboxgl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",u)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends s.E{constructor(u){super(),this.options=s.Q(Object.create(ps),u),s.br(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(u&&u.className?u.className.trim().split(/\s+/):[])}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&u.on("preclick",this._onClose),this.options.closeOnMove&&u.on("move",this._onClose),u.on("remove",this.remove),this._update(),u._addPopup(this),this._focusFirstElement(),this._trackPointer?(u.on("mousemove",this._onMouseEvent),u.on("mouseup",this._onMouseEvent),u._canvasContainer.classList.add("mapboxgl-track-pointer")):u.on("move",this._update),this.fire(new s.g("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const u=this._map;return u&&(u.off("move",this._update),u.off("move",this._onClose),u.off("preclick",this._onClose),u.off("click",this._onClose),u.off("remove",this.remove),u.off("mousemove",this._onMouseEvent),u.off("mouseup",this._onMouseEvent),u.off("drag",this._onMouseEvent),u._canvasContainer&&u._canvasContainer.classList.remove("mapboxgl-track-pointer"),u._removePopup(this),this._map=void 0),this.fire(new s.g("close")),this}getLngLat(){return this._lngLat}setLngLat(u){this._lngLat=s.aJ.convert(u),this._pos=null,this._trackPointer=!1,this._update();const r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const u=this._map;return u&&(u.off("move",this._update),u.on("mousemove",this._onMouseEvent),u.on("drag",this._onMouseEvent),u._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const r=document.createDocumentFragment(),a=document.createElement("body");let h;for(a.innerHTML=u;h=a.firstChild,h;)r.appendChild(h);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=Zt("div","mapboxgl-popup-content",this._container||void 0);if(r.appendChild(u),this.options.closeButton){const a=this._closeButton=Zt("button","mapboxgl-popup-close-button",r);a.type="button",a.setAttribute("aria-label","Close popup"),a.setAttribute("aria-hidden","true"),a.innerHTML="×",a.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(u){return this._classList.add(u),this._updateClassList(),this}removeClassName(u){return this._classList.delete(u),this._updateClassList(),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){let r;return this._classList.delete(u)?r=!1:(this._classList.add(u),r=!0),this._updateClassList(),r}_onMouseEvent(u){this._update(u.point)}_getAnchor(u){if(this.options.anchor)return this.options.anchor;const r=this._map,a=this._container,h=this._pos;if(!r||!a||!h)return"bottom";const p=a.offsetWidth,m=a.offsetHeight,g=h.x

r.transform.width-p/2;if(h.y+ur.transform.height-m){if(g)return"bottom-left";if(x)return"bottom-right"}return g?"left":x?"right":"bottom"}_updateClassList(){const u=this._container;if(!u)return;const r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),u.className=r.join(" ")}_update(u){const r=this._map,a=this._content;if(!r||!this._lngLat&&!this._trackPointer||!a)return;let h=this._container;if(h||(h=this._container=Zt("div","mapboxgl-popup",r.getContainer()),this._tip=Zt("div","mapboxgl-popup-tip",h),h.appendChild(a)),this.options.maxWidth&&h.style.maxWidth!==this.options.maxWidth&&(h.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ka(this._lngLat,this._pos,r.transform)),!this._trackPointer||u){const p=this._pos=this._trackPointer&&u instanceof s.P?u:r.project(this._lngLat),m=ld(this.options.offset),g=this._anchor=this._getAnchor(m.y),x=ld(this.options.offset,g),w=p.add(x).round();r._requestDomTask(()=>{this._container&&g&&(this._container.style.transform=`${Yl[g]} translate(${w.x}px,${w.y}px)`)})}if(!this._marker&&r._showingGlobe()){const p=s.dc(r.transform,this._lngLat)?0:1;this._setOpacity(p)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(qp);u&&u.focus()}_onClose(){this.remove()}_setOpacity(u){this._container&&(this._container.style.opacity=`${u}`),this._content&&(this._content.style.pointerEvents=u?"auto":"none")}},Marker:Jl,Style:vr,LngLat:s.aJ,LngLatBounds:s.aj,Point:s.P,MercatorCoordinate:s._,FreeCameraOptions:bh,Evented:s.E,config:s.db,prewarm:s.dA,clearPrewarmedResources:s.dB,get accessToken(){return s.db.ACCESS_TOKEN},set accessToken(u){s.db.ACCESS_TOKEN=u},get baseApiUrl(){return s.db.API_URL},set baseApiUrl(u){s.db.API_URL=u},get workerCount(){return s.dC.workerCount},set workerCount(u){s.dC.workerCount=u},get maxParallelImageRequests(){return s.db.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(u){s.db.MAX_PARALLEL_IMAGE_REQUESTS=u},clearStorage(u){s.dD(u)},get workerUrl(){return s.dE.workerUrl},set workerUrl(u){s.dE.workerUrl=u},get workerClass(){return s.dE.workerClass},set workerClass(u){s.dE.workerClass=u},get workerParams(){return s.dE.workerParams},set workerParams(u){s.dE.workerParams=u},get dracoUrl(){return s.dF()},set dracoUrl(u){s.dG(u)},get meshoptUrl(){return s.dH()},set meshoptUrl(u){s.dI(u)},setNow:s.e.setNow,restoreNow:s.e.restoreNow}});var Q0=ks;return Q0})})(Y0);var K0=Y0.exports;const Ib=Eb(K0),Cb=Mb({__proto__:null,default:Ib},[K0]);export{Cb as m}; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/maplibre-gl-H6mDd47p.js b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/maplibre-gl-H6mDd47p.js deleted file mode 100644 index 905baa3..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/maplibre-gl-H6mDd47p.js +++ /dev/null @@ -1,580 +0,0 @@ -import{g as Kd,c as Yd}from"./index-b9vwykds.js";function Jd(sa,Sl){for(var Rr=0;RrBi[Br]})}}}return Object.freeze(Object.defineProperty(sa,Symbol.toStringTag,{value:"Module"}))}var ru={exports:{}};/** - * MapLibre GL JS - * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.1.2/LICENSE.txt - */(function(sa,Sl){(function(Rr,Bi){sa.exports=Bi()})(Yd,function(){var Rr={},Bi={};function Br(k,p,Ei){if(Bi[k]=Ei,k==="index"){var Xi="var sharedModule = {}; ("+Bi.shared+")(sharedModule); ("+Bi.worker+")(sharedModule);",Yt={};return Bi.shared(Yt),Bi.index(Rr,Yt),typeof window<"u"&&Rr.setWorkerUrl(window.URL.createObjectURL(new Blob([Xi],{type:"text/javascript"}))),Rr}}Br("shared",["exports"],function(k){function p(i,e,r,n){return new(r||(r=Promise))(function(l,u){function d(x){try{_(n.next(x))}catch(b){u(b)}}function f(x){try{_(n.throw(x))}catch(b){u(b)}}function _(x){var b;x.done?l(x.value):(b=x.value,b instanceof r?b:new r(function(w){w(b)})).then(d,f)}_((n=n.apply(i,e||[])).next())})}function Ei(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var Xi=Yt;function Yt(i,e){this.x=i,this.y=e}Yt.prototype={clone:function(){return new Yt(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(i,e){var r=Math.cos(i),n=Math.sin(i),l=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Yt.convert=function(i){return i instanceof Yt?i:Array.isArray(i)?new Yt(i[0],i[1]):i};var xe=Ei(Xi),re=Fr;function Fr(i,e,r,n){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=n}Fr.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,n=0;n<8;n++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var xr=Ei(re);let Ki,vr;function cr(){return Ki==null&&(Ki=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ki}function qs(){if(vr==null&&(vr=!1,cr())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let n=0;n<5*5;n++){const l=4*n;e.fillStyle=`rgb(${l},${l+1},${l+2})`,e.fillRect(n%5,Math.floor(n/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let n=0;n<5*5*4;n++)if(n%4!=3&&r[n]!==n){vr=!0;break}}}return vr||!1}function _i(i,e,r,n){const l=new xr(i,e,r,n);return function(u){return l.solve(u)}}const Ut=_i(.25,.1,.25,1);function Yi(i,e,r){return Math.min(r,Math.max(e,i))}function Or(i,e,r){const n=r-e,l=((i-e)%n+n)%n+e;return l===e?r:l}function Mi(i,...e){for(const r of e)for(const n in r)i[n]=r[n];return i}let Vr=1;function br(i,e,r){const n={};for(const l in i)n[l]=e.call(r||this,i[l],l,i);return n}function yn(i,e,r){const n={};for(const l in i)e.call(r||this,i[l],l,i)&&(n[l]=i[l]);return n}function si(i){return Array.isArray(i)?i.map(si):typeof i=="object"&&i?br(i,si):i}const xt={};function qt(i){xt[i]||(typeof console<"u"&&console.warn(i),xt[i]=!0)}function Fi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Ur(i){let e=0;for(let r,n,l=0,u=i.length,d=u-1;l"u")throw new Error("VideoFrame not supported");const u=new VideoFrame(i,{timestamp:0});try{const d=u?.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);const f=d.startsWith("BGR"),_=new Uint8ClampedArray(n*l*4);if(yield u.copyTo(_,function(x,b,w,A,P){const M=4*Math.max(-b,0),L=(Math.max(0,w)-w)*A*4+M,V=4*A,$=Math.max(0,b),Y=Math.max(0,w);return{rect:{x:$,y:Y,width:Math.min(x.width,b+A)-$,height:Math.min(x.height,w+P)-Y},layout:[{offset:L,stride:V}]}}(i,e,r,n,l)),f)for(let x=0;x<_.length;x+=4){const b=_[x];_[x]=_[x+2],_[x+2]=b}return _}finally{u.close()}})}let ni,ai;const Nr="AbortError";function Qi(){return new Error(Nr)}const $r={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ur(i){return $r.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}const Oi="global-dispatcher";class Vi extends Error{constructor(e,r,n,l){super(`AJAXError: ${r} (${e}): ${n}`),this.status=e,this.statusText=r,this.url=n,this.body=l}}const ps=()=>hr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Tr=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const n=ur(i.url);if(n)return n(i,e);if(hr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"getResource",data:i,targetMapId:Oi},e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(ps())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(n,l){return p(this,void 0,void 0,function*(){const u=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,cache:n.cache,referrer:ps(),signal:l.signal});n.type==="json"&&u.headers.set("Accept","application/json");const d=yield fetch(u);if(!d.ok){const x=yield d.blob();throw new Vi(d.status,d.statusText,n.url,x)}let f;f=n.type==="arrayBuffer"||n.type==="image"?d.arrayBuffer():n.type==="json"?d.json():d.text();const _=yield f;if(l.signal.aborted)throw Qi();return{data:_,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}})}(i,e);if(hr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"getResource",data:i,mustQueue:!0,targetMapId:Oi},e)}var r;return function(n,l){return new Promise((u,d)=>{const f=new XMLHttpRequest;f.open(n.method||"GET",n.url,!0),n.type!=="arrayBuffer"&&n.type!=="image"||(f.responseType="arraybuffer");for(const _ in n.headers)f.setRequestHeader(_,n.headers[_]);n.type==="json"&&(f.responseType="text",f.setRequestHeader("Accept","application/json")),f.withCredentials=n.credentials==="include",f.onerror=()=>{d(new Error(f.statusText))},f.onload=()=>{if(!l.signal.aborted)if((f.status>=200&&f.status<300||f.status===0)&&f.response!==null){let _=f.response;if(n.type==="json")try{_=JSON.parse(f.response)}catch(x){return void d(x)}u({data:_,cacheControl:f.getResponseHeader("Cache-Control"),expires:f.getResponseHeader("Expires")})}else{const _=new Blob([f.response],{type:f.getResponseHeader("Content-Type")});d(new Vi(f.status,f.statusText,n.url,_))}},l.signal.addEventListener("abort",()=>{f.abort(),d(Qi())}),f.send(n.body)})}(i,e)};function xn(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Sr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Ir(i,e,r){if(r&&r[i]){const n=r[i].indexOf(e);n!==-1&&r[i].splice(n,1)}}class Ar{constructor(e,r={}){Mi(this,r),this.type=e}}class Mt extends Ar{constructor(e,r={}){super("error",Mi({error:e},r))}}class jr{on(e,r){return this._listeners=this._listeners||{},Sr(e,r,this._listeners),this}off(e,r){return Ir(e,r,this._listeners),Ir(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Sr(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new Ar(e,r||{}));const n=e.type;if(this.listens(n)){e.target=this;const l=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const f of l)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const f of u)Ir(n,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(Mi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof Mt&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var se={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},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},"*":{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:"*"},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:{},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"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","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"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"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},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:"*",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},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-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}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"]},"property-type":"cross-faded"},"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"},"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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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"}}};const qr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Gs(i,e){const r={};for(const n in i)n!=="ref"&&(r[n]=i[n]);return qr.forEach(n=>{n in e&&(r[n]=e[n])}),r}function Ke(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const G=[Gr,fe,je,Ve,$t,dr,zi,z(Ue),F,I,C];function H(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!H(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of G)if(!H(r,e))return null}}return`Expected ${R(i)} but found ${R(e)} instead.`}function K(i,e){return e.some(r=>r.kind===i.kind)}function q(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function J(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const he=.96422,ne=.82521,oe=4/29,Pe=6/29,Re=3*Pe*Pe,De=Pe*Pe*Pe,Ye=Math.PI/180,Fe=180/Math.PI;function ct(i){return(i%=360)<0&&(i+=360),i}function st([i,e,r,n]){let l,u;const d=Ne((.2225045*(i=Tt(i))+.7168786*(e=Tt(e))+.0606169*(r=Tt(r)))/1);i===e&&e===r?l=u=d:(l=Ne((.4360747*i+.3850649*e+.1430804*r)/he),u=Ne((.0139322*i+.0971045*e+.7141733*r)/ne));const f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-u),n]}function Tt(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ne(i){return i>De?Math.pow(i,1/3):i/Re+oe}function gt([i,e,r,n]){let l=(i+16)/116,u=isNaN(e)?l:l+e/500,d=isNaN(r)?l:l-r/200;return l=1*li(l),u=he*li(u),d=ne*li(d),[Ft(3.1338561*u-1.6168667*l-.4906146*d),Ft(-.9787684*u+1.9161415*l+.033454*d),Ft(.0719453*u-.2289914*l+1.4052427*d),n]}function Ft(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function li(i){return i>Pe?i*i*i:Re*(i-oe)}function Zt(i){return parseInt(i.padEnd(2,i),16)/255}function Jt(i,e){return xi(e?i/100:i,0,1)}function xi(i,e,r){return Math.min(Math.max(e,i),r)}function go(i){return!i.some(Number.isNaN)}const Il={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]};class it{constructor(e,r,n,l=1,u=!0){this.r=e,this.g=r,this.b=n,this.a=l,u||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,n,l]))}static parse(e){if(e instanceof it)return e;if(typeof e!="string")return;const r=function(n){if((n=n.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=Il[n];if(l){const[d,f,_]=l;return[d/255,f/255,_/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const d=n.length<6?1:2;let f=1;return[Zt(n.slice(f,f+=d)),Zt(n.slice(f,f+=d)),Zt(n.slice(f,f+=d)),Zt(n.slice(f,f+d)||"ff")]}if(n.startsWith("rgb")){const d=n.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,_,x,b,w,A,P,M,L,V,$,Y]=d,j=[b||" ",P||" ",V].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const W=[x,A,L].join(""),ae=W==="%%%"?100:W===""?255:0;if(ae){const le=[xi(+_/ae,0,1),xi(+w/ae,0,1),xi(+M/ae,0,1),$?Jt(+$,Y):1];if(go(le))return le}}return}}const u=n.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,f,_,x,b,w,A,P,M]=u,L=[_||" ",b||" ",A].join("");if(L===" "||L===" /"||L===",,"||L===",,,"){const V=[+f,xi(+x,0,100),xi(+w,0,100),P?Jt(+P,M):1];if(go(V))return function([$,Y,j,W]){function ae(le){const we=(le+$/30)%12,Ce=Y*Math.min(j,1-j);return j-Ce*Math.max(-1,Math.min(we-3,9-we,1))}return $=ct($),Y/=100,j/=100,[ae(0),ae(8),ae(4),W]}(V)}}}(e);return r?new it(...r,!1):void 0}get rgb(){const{r:e,g:r,b:n,a:l}=this,u=l||1/0;return this.overwriteGetter("rgb",[e/u,r/u,n/u,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,n,l,u]=st(e),d=Math.sqrt(n*n+l*l);return[Math.round(1e4*d)?ct(Math.atan2(l,n)*Fe):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",st(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,n,l]=this.rgb;return`rgba(${[e,r,n].map(u=>Math.round(255*u)).join(",")},${l})`}}it.black=new it(0,0,0,1),it.white=new it(1,1,1,1),it.transparent=new it(0,0,0,0),it.red=new it(1,0,0,1);class aa{constructor(e,r,n){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class oa{constructor(e,r,n,l,u){this.text=e,this.image=r,this.scale=n,this.fontStack=l,this.textColor=u}}class vi{constructor(e){this.sections=e}static fromString(e){return new vi([new oa(e,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 vi?e:vi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class bi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof bi)return e;if(typeof e=="number")return new bi([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="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 bi(e)}}toString(){return JSON.stringify(this.values)}}const _o=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Gt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Gt)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,r,n]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Pr(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof it||i instanceof aa||i instanceof vi||i instanceof bi||i instanceof Gt||i instanceof ki)return!0;if(Array.isArray(i)){for(const e of i)if(!Pr(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Pr(i[e]))return!1;return!0}return!1}function Ct(i){if(i===null)return Gr;if(typeof i=="string")return je;if(typeof i=="boolean")return Ve;if(typeof i=="number")return fe;if(i instanceof it)return $t;if(i instanceof aa)return Cr;if(i instanceof vi)return dr;if(i instanceof bi)return F;if(i instanceof Gt)return C;if(i instanceof ki)return I;if(Array.isArray(i)){const e=i.length;let r;for(const n of i){const l=Ct(n);if(r){if(r===l)continue;r=Ue;break}r=l}return z(r||Ue,e)}return zi}function Xs(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof it||i instanceof vi||i instanceof bi||i instanceof Gt||i instanceof ki?i.toString():JSON.stringify(i)}class Hr{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Pr(e[1]))return r.error("invalid value");const n=e[1];let l=Ct(n);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new Hr(l,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class vt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Wr={string:je,number:fe,boolean:Ve,object:zi};class Ui{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n,l=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Wr)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Wr[x],l++}else f=Ue;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=e[2],l++}n=z(f,_)}else{if(!Wr[u])throw new Error(`Types doesn't contain name = ${u}`);n=Wr[u]}const d=[];for(;le.outputDefined())}}const vn={"to-boolean":Ve,"to-color":$t,"to-number":fe,"to-string":je};class tr{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const n=e[0];if(!vn[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=vn[n],u=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:yo(r[0],r[1],r[2],r[3]),!n))return new it(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new vt(n||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const n of this.args){r=n.evaluate(e);const l=bi.parse(r);if(l)return l}throw new vt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const n of this.args){r=n.evaluate(e);const l=Gt.parse(r);if(l)return l}throw new vt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const n of this.args){if(r=n.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new vt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return vi.fromString(Xs(this.args[0].evaluate(e)));case"resolvedImage":return ki.fromString(Xs(this.args[0].evaluate(e)));default:return Xs(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const la=["Unknown","Point","LineString","Polygon"];class ys{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?la[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 r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=it.parse(e)),r}}class tt{constructor(e,r,n=[],l,u=new Ws,d=[]){this.registry=e,this.path=n,this.key=n.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=d,this.expectedType=l,this._isConstant=r}parse(e,r,n,l,u={}){return r?this.concat(r,n,l)._parse(e,u):this._parse(e,u)}_parse(e,r){function n(l,u,d){return d==="assert"?new Ui(u,[l]):d==="coerce"?new tr(u,[l]):l}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", []].');const l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[l];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,_=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Hr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new ys;try{d=new Hr(d.type,d.evaluate(f))}catch(_){return this.error(_.message),null}}return d}return this.error(`Unknown expression "${l}". 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,r,n){const l=typeof e=="number"?this.path.concat(e):this.path,u=n?this.scope.concat(n):this.scope;return new tt(this.registry,this._isConstant,l,r||null,u,this.errors)}error(e,...r){const n=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new oi(n,e))}checkSubtype(e,r){const n=H(e,r);return n&&this.error(n),n}}class bn{constructor(e,r,n){this.type=Cr,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");const l=r.parse(n["case-sensitive"]!==void 0&&n["case-sensitive"],1,Ve);if(!l)return null;const u=r.parse(n["diacritic-sensitive"]!==void 0&&n["diacritic-sensitive"],1,Ve);if(!u)return null;let d=null;return n.locale&&(d=r.parse(n.locale,1,je),!d)?null:new bn(l,u,d)}evaluate(e){return new aa(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}}const ir=8192;function ca(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Ks(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function xo(i,e){const r=(180+i[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*ir),Math.round(n*l*ir)]}function Al(i,e,r){const n=i[0]-e[0],l=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return n*d-u*l==0&&n*u<=0&&l*d<=0}function wn(i,e){let r=!1;for(let d=0,f=e.length;d(n=i)[1]!=(u=_[x+1])[1]>n[1]&&n[0]<(u[0]-l[0])*(n[1]-l[1])/(u[1]-l[1])+l[0]&&(r=!r)}}var n,l,u;return r}function vo(i,e){for(let r=0;r0&&f<0||d<0&&f>0}function Cl(i,e,r){for(const x of r)for(let b=0;br[2]){const l=.5*n;let u=i[0]-r[0]>l?-n:r[0]-i[0]>l?n:0;u===0&&(u=i[0]-r[2]>l?-n:r[2]-i[0]>l?n:0),i[0]+=u}ca(e,i)}function So(i,e,r,n){const l=Math.pow(2,n.z)*ir,u=[n.x*ir,n.y*ir],d=[];for(const f of i)for(const _ of f){const x=[_.x+u[0],_.y+u[1]];To(x,e,r,l),d.push(x)}return d}function Sn(i,e,r,n){const l=Math.pow(2,n.z)*ir,u=[n.x*ir,n.y*ir],d=[];for(const _ of i){const x=[];for(const b of _){const w=[b.x+u[0],b.y+u[1]];ca(e,w),x.push(w)}d.push(x)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of d)for(const x of _)To(x,e,r,l)}var f;return d}class Xr{constructor(e,r){this.type=Ve,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Pr(e[1])){const n=e[1];if(n.type==="FeatureCollection"){const l=[];for(const u of n.features){const{type:d,coordinates:f}=u.geometry;d==="Polygon"&&l.push(f),d==="MultiPolygon"&&l.push(...f)}if(l.length)return new Xr(n,{type:"MultiPolygon",coordinates:l})}else if(n.type==="Feature"){const l=n.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Xr(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Xr(n,n)}return r.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(r,n){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(n.type==="Polygon"){const f=Tn(n.coordinates,u,d),_=So(r.geometry(),l,u,d);if(!Ks(l,u))return!1;for(const x of _)if(!wn(x,f))return!1}if(n.type==="MultiPolygon"){const f=ha(n.coordinates,u,d),_=So(r.geometry(),l,u,d);if(!Ks(l,u))return!1;for(const x of _)if(!vo(x,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,n){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(n.type==="Polygon"){const f=Tn(n.coordinates,u,d),_=Sn(r.geometry(),l,u,d);if(!Ks(l,u))return!1;for(const x of _)if(!wo(x,f))return!1}if(n.type==="MultiPolygon"){const f=ha(n.coordinates,u,d),_=Sn(r.geometry(),l,u,d);if(!Ks(l,u))return!1;for(const x of _)if(!Pl(x,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class In{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const n=e[1];return r.scope.has(n)?new In(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Di{constructor(e,r,n,l){this.name=e,this.type=r,this._evaluate=n,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const n=e[0],l=Di.definitions[n];if(!l)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let _=null;for(const[x,b]of f){_=new tt(r.registry,Ys,r.path,null,r.scope);const w=[];let A=!1;for(let P=1;P{return A=w,Array.isArray(A)?`(${A.map(R).join(", ")})`:`(${R(A.type)}...)`;var A}).join(" | "),b=[];for(let w=1;w{r=e?r&&Ys(n):r&&n instanceof Hr}),!!r&&Js(i)&&An(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Js(i){if(i instanceof Di&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Xr)return!1;let e=!0;return i.eachChild(r=>{e&&!Js(r)&&(e=!1)}),e}function Qs(i){if(i instanceof Di&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Qs(r)&&(e=!1)}),e}function An(i,e){if(i instanceof Di&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(n=>{r&&!An(n,e)&&(r=!1)}),r}function en(i,e){const r=i.length-1;let n,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),n=i[f],l=i[f+1],n<=e){if(f===r||ee))throw new vt("Input is not a number.");d=f-1}return 0}class xs{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of n)this.labels.push(l),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const n=r.parse(e[1],1,fe);if(!n)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const w=r.parse(_,b,u);if(!w)return null;u=u||w.type,l.push([f,w])}return new xs(u,n,l)}evaluate(e){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return n[0].evaluate(e);const u=r.length;return l>=r[u-1]?n[u-1].evaluate(e):n[en(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function El(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ml=Io;function Io(i,e,r,n){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=n}Io.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,n=0;n<8;n++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var zl=El(Ml);function Kr(i,e,r){return i+r*(e-i)}function Cn(i,e,r){return i.map((n,l)=>Kr(n,e[l],r))}const wi={number:Kr,color:function(i,e,r,n="rgb"){switch(n){case"rgb":{const[l,u,d,f]=Cn(i.rgb,e.rgb,r);return new it(l,u,d,f,!1)}case"hcl":{const[l,u,d,f]=i.hcl,[_,x,b,w]=e.hcl;let A,P;if(isNaN(l)||isNaN(_))isNaN(l)?isNaN(_)?A=NaN:(A=_,d!==1&&d!==0||(P=x)):(A=l,b!==1&&b!==0||(P=u));else{let Y=_-l;_>l&&Y>180?Y-=360:_180&&(Y+=360),A=l+r*Y}const[M,L,V,$]=function([Y,j,W,ae]){return Y=isNaN(Y)?0:Y*Ye,gt([W,Math.cos(Y)*j,Math.sin(Y)*j,ae])}([A,P??Kr(u,x,r),Kr(d,b,r),Kr(f,w,r)]);return new it(M,L,V,$,!1)}case"lab":{const[l,u,d,f]=gt(Cn(i.lab,e.lab,r));return new it(l,u,d,f,!1)}}},array:Cn,padding:function(i,e,r){return new bi(Cn(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const n=i.values,l=e.values;if(n.length!==l.length)throw new vt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const u=[];for(let d=0;dtypeof b!="number"||b<0||b>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,fe),!u)return null;const f=[];let _=null;n==="interpolate-hcl"||n==="interpolate-lab"?_=$t:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x=b)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const M=r.parse(w,P,_);if(!M)return null;_=_||M.type,f.push([b,M])}return J(_,fe)||J(_,$t)||J(_,F)||J(_,C)||J(_,z(fe))?new Qt(_,n,l,u,f):r.error(`Type ${R(_)} is not interpolatable.`)}evaluate(e){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return n[0].evaluate(e);const u=r.length;if(l>=r[u-1])return n[u-1].evaluate(e);const d=en(r,l),f=Qt.interpolationFactor(this.interpolation,l,r[d],r[d+1]),_=n[d].evaluate(e),x=n[d+1].evaluate(e);switch(this.operator){case"interpolate":return wi[this.type.kind](_,x,f);case"interpolate-hcl":return wi.color(_,x,f,"hcl");case"interpolate-lab":return wi.color(_,x,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function vs(i,e,r,n){const l=n-r,u=i-r;return l===0?0:e===1?u/l:(Math.pow(e,u)-1)/(Math.pow(e,l)-1)}class Qe{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let n=null;const l=r.expectedType;l&&l.kind!=="value"&&(n=l);const u=[];for(const f of e.slice(1)){const _=r.parse(f,1+u.length,n,void 0,{typeAnnotation:"omit"});if(!_)return null;n=n||_.type,u.push(_)}if(!n)throw new Error("No output type");const d=l&&u.some(f=>H(l,f.type));return new Qe(d?Ue:n,u)}evaluate(e){let r,n=null,l=0;for(const u of this.args)if(l++,n=u.evaluate(e),n&&n instanceof ki&&!n.available&&(r||(r=n.name),n=null,l===this.args.length&&(n=r)),n!==null)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Pn{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let u=1;u=n.length)throw new vt(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new vt(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class da{constructor(e,r){this.type=Ve,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=r.parse(e[1],1,Ue),l=r.parse(e[2],2,Ue);return n&&l?K(n.type,[Ve,je,fe,Gr,Ue])?new da(n,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${R(n.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!q(r,["boolean","string","number","null"]))throw new vt(`Expected first argument to be of type boolean, string, number or null, but found ${R(Ct(r))} instead.`);if(!q(n,["string","array"]))throw new vt(`Expected second argument to be of type array or string, but found ${R(Ct(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class En{constructor(e,r,n){this.type=fe,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=r.parse(e[1],1,Ue),l=r.parse(e[2],2,Ue);if(!n||!l)return null;if(!K(n.type,[Ve,je,fe,Gr,Ue]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${R(n.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,fe);return u?new En(n,l,u):null}return new En(n,l)}evaluate(e){const r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!q(r,["boolean","string","number","null"]))throw new vt(`Expected first argument to be of type boolean, string, number or null, but found ${R(Ct(r))} instead.`);if(!q(n,["string","array"]))throw new vt(`Expected second argument to be of type array or string, but found ${R(Ct(n))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return n.indexOf(r,l)}return n.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class pa{constructor(e,r,n,l,u,d){this.inputType=e,this.type=r,this.input=n,this.cases=l,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let n,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},d=[];for(let x=2;xNumber.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof M=="number"&&Math.floor(M)!==M)return A.error("Numeric branch labels must be integer values.");if(n){if(A.checkSubtype(n,Ct(M)))return null}else n=Ct(M);if(u[String(M)]!==void 0)return A.error("Branch labels must be unique.");u[String(M)]=d.length}const P=r.parse(w,x,l);if(!P)return null;l=l||P.type,d.push(P)}const f=r.parse(e[1],1,Ue);if(!f)return null;const _=r.parse(e[e.length-1],e.length-1,l);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(n,f.type)?null:new pa(n,l,f,u,d,_):null}evaluate(e){const r=this.input.evaluate(e);return(Ct(r)===this.inputType&&this.outputs[this.cases[r]]||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 fa{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);const l=[];for(let d=1;dr.outputDefined())&&this.otherwise.outputDefined()}}class Mn{constructor(e,r,n,l){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=r.parse(e[1],1,Ue),l=r.parse(e[2],2,fe);if(!n||!l)return null;if(!K(n.type,[z(Ue),je,Ue]))return r.error(`Expected first argument to be of type array or string, but found ${R(n.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,fe);return u?new Mn(n.type,n,l,u):null}return new Mn(n.type,n,l)}evaluate(e){const r=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!q(r,["string","array"]))throw new vt(`Expected first argument to be of type array or string, but found ${R(Ct(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(n,l)}return r.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ao(i,e){return i==="=="||i==="!="?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 Co(i,e,r,n){return n.compare(e,r)===0}function bs(i,e,r){const n=i!=="=="&&i!=="!=";return class su{constructor(u,d,f){this.type=Ve,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let _=d.parse(u[1],1,Ue);if(!_)return null;if(!Ao(f,_.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${R(_.type)}'.`);let x=d.parse(u[2],2,Ue);if(!x)return null;if(!Ao(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${R(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${R(_.type)}' and '${R(x.type)}'.`);n&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new Ui(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new Ui(_.type,[x])));let b=null;if(u.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(b=d.parse(u[3],3,Cr),!b)return null}return new su(_,x,b)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(n&&this.hasUntypedArgument){const _=Ct(d),x=Ct(f);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new vt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const _=Ct(d),x=Ct(f);if(_.kind!=="string"||x.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const kl=bs("==",function(i,e,r){return e===r},Co),Dl=bs("!=",function(i,e,r){return e!==r},function(i,e,r,n){return!Co(0,e,r,n)}),Ll=bs("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,n){return n.compare(e,r)>0}),Bl=bs("<=",function(i,e,r){return e<=r},function(i,e,r,n){return n.compare(e,r)<=0}),Fl=bs(">=",function(i,e,r){return e>=r},function(i,e,r,n){return n.compare(e,r)>=0});class ma{constructor(e,r,n,l,u){this.type=je,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const n=r.parse(e[1],1,fe);if(!n)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,je),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,je),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,fe),!f))return null;let _=null;return l["max-fraction-digits"]&&(_=r.parse(l["max-fraction-digits"],1,fe),!_)?null:new ma(n,u,d,f,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.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.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class zn{constructor(e){this.type=dr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,fe),!_))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,z(je)),!x))return null;let b=null;if(f["text-color"]&&(b=r.parse(f["text-color"],1,$t),!b))return null;const w=l[l.length-1];w.scale=_,w.font=x,w.textColor=b}else{const _=r.parse(e[d],1,Ue);if(!_)return null;const x=_.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,l.push({content:_,scale:null,font:null,textColor:null})}}return new zn(l)}evaluate(e){return new vi(this.sections.map(r=>{const n=r.content.evaluate(e);return Ct(n)===I?new oa("",n,null,null,null):new oa(Xs(n),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class ga{constructor(e){this.type=I,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const n=r.parse(e[1],1,je);return n?new ga(n):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),n=ki.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class _a{constructor(e){this.type=fe,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${R(n.type)} instead.`):new _a(n):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new vt(`Expected value to be of type string or array, but found ${R(Ct(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const ws={"==":kl,"!=":Dl,">":Rl,"<":Ll,">=":Fl,"<=":Bl,array:Ui,at:ua,boolean:Ui,case:fa,coalesce:Qe,collator:bn,format:zn,image:ga,in:da,"index-of":En,interpolate:Qt,"interpolate-hcl":Qt,"interpolate-lab":Qt,length:_a,let:Pn,literal:Hr,match:pa,number:Ui,"number-format":ma,object:Ui,slice:Mn,step:xs,string:Ui,"to-boolean":tr,"to-color":tr,"to-number":tr,"to-string":tr,var:In,within:Xr};function Po(i,[e,r,n,l]){e=e.evaluate(i),r=r.evaluate(i),n=n.evaluate(i);const u=l?l.evaluate(i):1,d=yo(e,r,n,u);if(d)throw new vt(d);return new it(e/255,r/255,n/255,u,!1)}function Eo(i,e){return i in e}function ya(i,e){const r=e[i];return r===void 0?null:r}function Yr(i){return{type:i}}function Mo(i){return{result:"success",value:i}}function Ts(i){return{result:"error",value:i}}function Ss(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function zo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function xa(i){return!!i.expression&&i.expression.interpolated}function et(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Is(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ol(i){return i}function ko(i,e){const r=e.type==="color",n=i.stops&&typeof i.stops[0][0]=="object",l=n||!(n||i.property!==void 0),u=i.type||(xa(e)?"exponential":"interval");if(r||e.type==="padding"){const b=r?it.parse:bi.parse;(i=yi({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],b(w[1])])),i.default=b(i.default?i.default:e.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,_,x;if(u==="exponential")f=Do;else if(u==="interval")f=St;else if(u==="categorical"){f=Vl,_=Object.create(null);for(const b of i.stops)_[b[0]]=b[1];x=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=Je}if(n){const b={},w=[];for(let M=0;MM[0]),evaluate:({zoom:M},L)=>Do({stops:A,base:i.base},e,M).evaluate(M,L)}}if(l){const b=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:Qt.interpolationFactor.bind(void 0,b),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>f(i,e,w,_,x)}}return{kind:"source",evaluate(b,w){const A=w&&w.properties?w.properties[i.property]:void 0;return A===void 0?tn(i.default,e.default):f(i,e,A,_,x)}}}function tn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Vl(i,e,r,n,l){return tn(typeof r===l?n[r]:void 0,i.default,e.default)}function St(i,e,r){if(et(r)!=="number")return tn(i.default,e.default);const n=i.stops.length;if(n===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[n-1][0])return i.stops[n-1][1];const l=en(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function Do(i,e,r){const n=i.base!==void 0?i.base:1;if(et(r)!=="number")return tn(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const u=en(i.stops.map(b=>b[0]),r),d=function(b,w,A,P){const M=P-A,L=b-A;return M===0?0:w===1?L/M:(Math.pow(w,L)-1)/(Math.pow(w,M)-1)}(r,n,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],_=i.stops[u+1][1],x=wi[e.type]||Ol;return typeof f.evaluate=="function"?{evaluate(...b){const w=f.evaluate.apply(void 0,b),A=_.evaluate.apply(void 0,b);if(w!==void 0&&A!==void 0)return x(w,A,d,i.colorSpace)}}:x(f,_,d,i.colorSpace)}function Je(i,e,r){switch(e.type){case"color":r=it.parse(r);break;case"formatted":r=vi.fromString(r.toString());break;case"resolvedImage":r=ki.fromString(r.toString());break;case"padding":r=bi.parse(r);break;default:et(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return tn(r,i.default,e.default)}Di.register(ws,{error:[{kind:"error"},[je],(i,[e])=>{throw new vt(e.evaluate(i))}],typeof:[je,[Ue],(i,[e])=>R(Ct(e.evaluate(i)))],"to-rgba":[z(fe,4),[$t],(i,[e])=>{const[r,n,l,u]=e.evaluate(i).rgb;return[255*r,255*n,255*l,u]}],rgb:[$t,[fe,fe,fe],Po],rgba:[$t,[fe,fe,fe,fe],Po],has:{type:Ve,overloads:[[[je],(i,[e])=>Eo(e.evaluate(i),i.properties())],[[je,zi],(i,[e,r])=>Eo(e.evaluate(i),r.evaluate(i))]]},get:{type:Ue,overloads:[[[je],(i,[e])=>ya(e.evaluate(i),i.properties())],[[je,zi],(i,[e,r])=>ya(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Ue,[je],(i,[e])=>ya(e.evaluate(i),i.featureState||{})],properties:[zi,[],i=>i.properties()],"geometry-type":[je,[],i=>i.geometryType()],id:[Ue,[],i=>i.id()],zoom:[fe,[],i=>i.globals.zoom],"heatmap-density":[fe,[],i=>i.globals.heatmapDensity||0],"line-progress":[fe,[],i=>i.globals.lineProgress||0],accumulated:[Ue,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[fe,Yr(fe),(i,e)=>{let r=0;for(const n of e)r+=n.evaluate(i);return r}],"*":[fe,Yr(fe),(i,e)=>{let r=1;for(const n of e)r*=n.evaluate(i);return r}],"-":{type:fe,overloads:[[[fe,fe],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[fe],(i,[e])=>-e.evaluate(i)]]},"/":[fe,[fe,fe],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[fe,[fe,fe],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[fe,[],()=>Math.LN2],pi:[fe,[],()=>Math.PI],e:[fe,[],()=>Math.E],"^":[fe,[fe,fe],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[fe,[fe],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[fe,[fe],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[fe,[fe],(i,[e])=>Math.log(e.evaluate(i))],log2:[fe,[fe],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[fe,[fe],(i,[e])=>Math.sin(e.evaluate(i))],cos:[fe,[fe],(i,[e])=>Math.cos(e.evaluate(i))],tan:[fe,[fe],(i,[e])=>Math.tan(e.evaluate(i))],asin:[fe,[fe],(i,[e])=>Math.asin(e.evaluate(i))],acos:[fe,[fe],(i,[e])=>Math.acos(e.evaluate(i))],atan:[fe,[fe],(i,[e])=>Math.atan(e.evaluate(i))],min:[fe,Yr(fe),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[fe,Yr(fe),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[fe,[fe],(i,[e])=>Math.abs(e.evaluate(i))],round:[fe,[fe],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[fe,[fe],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[fe,[fe],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ve,[je,Ue],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ve,[Ue],(i,[e])=>i.id()===e.value],"filter-type-==":[Ve,[je],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ve,[je,Ue],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n{const r=i.id(),n=e.value;return typeof r==typeof n&&r":[Ve,[je,Ue],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n>l}],"filter-id->":[Ve,[Ue],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[Ve,[je,Ue],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n<=l}],"filter-id-<=":[Ve,[Ue],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[Ve,[je,Ue],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n>=l}],"filter-id->=":[Ve,[Ue],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[Ve,[Ue],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ve,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ve,[z(je)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ve,[z(Ue)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ve,[je,z(Ue)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ve,[je,z(Ue)],(i,[e,r])=>function(n,l,u,d){for(;u<=d;){const f=u+d>>1;if(l[f]===n)return!0;l[f]>n?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ve,overloads:[[[Ve,Ve],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Yr(Ve),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ve,overloads:[[[Ve,Ve],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Yr(Ve),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ve,[Ve],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ve,[je],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[je,[je],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[je,[je],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[je,Yr(Ue),(i,e)=>e.map(r=>Xs(r.evaluate(i))).join("")],"resolved-locale":[je,[Cr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class rn{constructor(e,r){var n;this.expression=e,this._warningHistory={},this._evaluator=new ys,this._defaultValue=r?(n=r).type==="color"&&Is(n.default)?new it(0,0,0,0):n.type==="color"?it.parse(n.default)||null:n.type==="padding"?bi.parse(n.default)||null:n.type==="variableAnchorOffsetCollection"?Gt.parse(n.default)||null:n.default===void 0?null:n.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,l,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,l,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new vt(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function ot(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in ws}function nt(i,e){const r=new tt(ws,Ys,[],e?function(l){const u={color:$t,string:je,number:fe,enum:je,boolean:Ve,formatted:dr,padding:F,resolvedImage:I,variableAnchorOffsetCollection:C};return l.type==="array"?z(u[l.value]||Ue,l.length):u[l.type]}(e):void 0),n=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Mo(new rn(n,e)):Ts(r.errors)}class As{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Qs(r.expression)}evaluateWithoutErrorHandling(e,r,n,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,l,u,d)}evaluate(e,r,n,l,u,d){return this._styleExpression.evaluate(e,r,n,l,u,d)}}class kn{constructor(e,r,n,l){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Qs(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,n,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,l,u,d)}evaluate(e,r,n,l,u,d){return this._styleExpression.evaluate(e,r,n,l,u,d)}interpolationFactor(e,r,n){return this.interpolationType?Qt.interpolationFactor(this.interpolationType,e,r,n):0}}function Lo(i,e){const r=nt(i,e);if(r.result==="error")return r;const n=r.value.expression,l=Js(n);if(!l&&!Ss(e))return Ts([new oi("","data expressions not supported")]);const u=An(n,["zoom"]);if(!u&&!zo(e))return Ts([new oi("","zoom expressions not supported")]);const d=Ln(n);return d||u?d instanceof oi?Ts([d]):d instanceof Qt&&!xa(e)?Ts([new oi("",'"interpolate" expressions cannot be used with this property')]):Mo(d?new kn(l?"camera":"composite",r.value,d.labels,d instanceof Qt?d.interpolation:void 0):new As(l?"constant":"source",r.value)):Ts([new oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Dn{constructor(e,r){this._parameters=e,this._specification=r,yi(this,ko(this._parameters,this._specification))}static deserialize(e){return new Dn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ln(i){let e=null;if(i instanceof Pn)e=Ln(i.result);else if(i instanceof Qe){for(const r of i.args)if(e=Ln(r),e)break}else(i instanceof xs||i instanceof Qt)&&i.input instanceof Di&&i.input.name==="zoom"&&(e=i);return e instanceof oi||i.eachChild(r=>{const n=Ln(r);n instanceof oi?e=n:!e&&n?e=new oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new oi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function va(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!va(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Ro={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Rn(i){if(i==null)return{filter:()=>!0,needGeometry:!1};va(i)||(i=Cs(i));const e=nt(i,Ro);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,n,l)=>e.value.evaluate(r,n,{},l),needGeometry:ba(i)}}function Bo(i,e){return ie?1:0}function ba(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?wa(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Cs))):e==="all"?["all"].concat(i.slice(1).map(Cs)):e==="none"?["all"].concat(i.slice(1).map(Cs).map(Bn)):e==="in"?Fo(i[1],i.slice(2)):e==="!in"?Bn(Fo(i[1],i.slice(2))):e==="has"?Oo(i[1]):e==="!has"?Bn(Oo(i[1])):e!=="within"||i;var r}function wa(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Fo(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Bo)]]:["filter-in-small",i,["literal",e]]}}function Oo(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Bn(i){return["!",i]}function Ta(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const u of i)l+=`${Ta(u)},`;return`${l}]`}const r=Object.keys(i).sort();let n="{";for(let l=0;ln.maximum?[new ge(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Ia(i){const e=i.valueSpec,r=bt(i.value.type);let n,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,_=!f,x=et(i.value.stops)==="array"&&et(i.value.stops[0])==="array"&&et(i.value.stops[0][0])==="object",b=Ti({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(P){if(r==="identity")return[new ge(P.key,P.value,'identity function may not have a "stops" property')];let M=[];const L=P.value;return M=M.concat(Ps({key:P.key,value:L,valueSpec:P.valueSpec,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec,arrayElementValidator:w})),et(L)==="array"&&L.length===0&&M.push(new ge(P.key,L,"array must have at least one stop")),M},default:function(P){return P.validateSpec({key:P.key,value:P.value,valueSpec:e,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec})}}});return r==="identity"&&f&&b.push(new ge(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||b.push(new ge(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!xa(i.valueSpec)&&b.push(new ge(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!Ss(i.valueSpec)?b.push(new ge(i.key,i.value,"property functions not supported")):f&&!zo(i.valueSpec)&&b.push(new ge(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||b.push(new ge(i.key,i.value,'"property" property is required')),b;function w(P){let M=[];const L=P.value,V=P.key;if(et(L)!=="array")return[new ge(V,L,`array expected, ${et(L)} found`)];if(L.length!==2)return[new ge(V,L,`array length 2 expected, length ${L.length} found`)];if(x){if(et(L[0])!=="object")return[new ge(V,L,`object expected, ${et(L[0])} found`)];if(L[0].zoom===void 0)return[new ge(V,L,"object stop key must have zoom")];if(L[0].value===void 0)return[new ge(V,L,"object stop key must have value")];if(u&&u>bt(L[0].zoom))return[new ge(V,L[0].zoom,"stop zoom values must appear in ascending order")];bt(L[0].zoom)!==u&&(u=bt(L[0].zoom),l=void 0,d={}),M=M.concat(Ti({key:`${V}[0]`,value:L[0],valueSpec:{zoom:{}},validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec,objectElementValidators:{zoom:Sa,value:A}}))}else M=M.concat(A({key:`${V}[0]`,value:L[0],valueSpec:{},validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec},L));return ot(Er(L[1]))?M.concat([new ge(`${V}[1]`,L[1],"expressions are not allowed in function stops.")]):M.concat(P.validateSpec({key:`${V}[1]`,value:L[1],valueSpec:e,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec}))}function A(P,M){const L=et(P.value),V=bt(P.value),$=P.value!==null?P.value:M;if(n){if(L!==n)return[new ge(P.key,$,`${L} stop domain type must match previous stop domain type ${n}`)]}else n=L;if(L!=="number"&&L!=="string"&&L!=="boolean")return[new ge(P.key,$,"stop domain value must be a number, string, or boolean")];if(L!=="number"&&r!=="categorical"){let Y=`number expected, ${L} found`;return Ss(e)&&r===void 0&&(Y+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ge(P.key,$,Y)]}return r!=="categorical"||L!=="number"||isFinite(V)&&Math.floor(V)===V?r!=="categorical"&&L==="number"&&l!==void 0&&Vnew ge(`${i.key}${n.key}`,i.value,n.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new ge(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Qs(r))return[new ge(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Qs(r))return[new ge(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!An(r,["zoom","feature-state"]))return[new ge(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Js(r))return[new ge(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Jr(i){const e=i.key,r=i.value,n=i.valueSpec,l=[];return Array.isArray(n.values)?n.values.indexOf(bt(r))===-1&&l.push(new ge(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(bt(r))===-1&&l.push(new ge(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Ms(i){return va(Er(i.value))?Es(yi({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):sn(i)}function sn(i){const e=i.value,r=i.key;if(et(e)!=="array")return[new ge(r,e,`array expected, ${et(e)} found`)];const n=i.styleSpec;let l,u=[];if(e.length<1)return[new ge(r,e,"filter array must have at least 1 element")];switch(u=u.concat(Jr({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:i.style,styleSpec:i.styleSpec})),bt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&bt(e[1])==="$type"&&u.push(new ge(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new ge(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=et(e[1]),l!=="string"&&u.push(new ge(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d{x in r&&e.push(new ge(n,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{bt(x.id)===f&&(_=x)}),_?_.ref?e.push(new ge(n,r.ref,"ref cannot reference another ref layer")):d=bt(_.type):e.push(new ge(n,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const _=l.sources&&l.sources[r.source],x=_&&bt(_.type);_?x==="vector"&&d==="raster"?e.push(new ge(n,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&d==="hillshade"?e.push(new ge(n,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&d!=="raster"?e.push(new ge(n,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new ge(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&_.lineMetrics||e.push(new ge(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new ge(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new ge(n,r.source,`source "${r.source}" not found`))}else e.push(new ge(n,r,'missing required property "source"'));return e=e.concat(Ti({key:n,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${n}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Ms,layout:_=>Ti({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Ca(yi({layerType:d},x))}}),paint:_=>Ti({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Fn(yi({layerType:d},x))}})}})),e}function rr(i){const e=i.value,r=i.key,n=et(e);return n!=="string"?[new ge(r,e,`string expected, ${n} found`)]:[]}const Uo={promoteId:function({key:i,value:e}){if(et(e)==="string")return rr({key:i,value:e});{const r=[];for(const n in e)r.push(...rr({key:`${i}.${n}`,value:e[n]}));return r}}};function No(i){const e=i.value,r=i.key,n=i.styleSpec,l=i.style,u=i.validateSpec;if(!e.type)return[new ge(r,e,'"type" is required')];const d=bt(e.type);let f;switch(d){case"vector":case"raster":return f=Ti({key:r,value:e,valueSpec:n[`source_${d.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:Uo,validateSpec:u}),f;case"raster-dem":return f=function(_){var x;const b=(x=_.sourceName)!==null&&x!==void 0?x:"",w=_.value,A=_.styleSpec,P=A.source_raster_dem,M=_.style;let L=[];const V=et(w);if(w===void 0)return L;if(V!=="object")return L.push(new ge("source_raster_dem",w,`object expected, ${V} found`)),L;const $=bt(w.encoding)==="custom",Y=["redFactor","greenFactor","blueFactor","baseShift"],j=_.value.encoding?`"${_.value.encoding}"`:"Default";for(const W in w)!$&&Y.includes(W)?L.push(new ge(W,w[W],`In "${b}": "${W}" is only valid when "encoding" is set to "custom". ${j} encoding found`)):P[W]?L=L.concat(_.validateSpec({key:W,value:w[W],valueSpec:P[W],validateSpec:_.validateSpec,style:M,styleSpec:A})):L.push(new ge(W,w[W],`unknown property "${W}"`));return L}({sourceName:r,value:e,style:i.style,styleSpec:n,validateSpec:u}),f;case"geojson":if(f=Ti({key:r,value:e,valueSpec:n.source_geojson,style:l,styleSpec:n,validateSpec:u,objectElementValidators:Uo}),e.cluster)for(const _ in e.clusterProperties){const[x,b]=e.clusterProperties[_],w=typeof x=="string"?[x,["accumulated"],["get",_]]:x;f.push(...Es({key:`${r}.${_}.map`,value:b,validateSpec:u,expressionContext:"cluster-map"})),f.push(...Es({key:`${r}.${_}.reduce`,value:w,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Ti({key:r,value:e,valueSpec:n.source_video,style:l,validateSpec:u,styleSpec:n});case"image":return Ti({key:r,value:e,valueSpec:n.source_image,style:l,validateSpec:u,styleSpec:n});case"canvas":return[new ge(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Jr({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:n})}}function $o(i){const e=i.value,r=i.styleSpec,n=r.light,l=i.style;let u=[];const d=et(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new ge("light",e,`object expected, ${d} found`)]),u;for(const f in e){const _=f.match(/^(.*)-transition$/);u=u.concat(_&&n[_[1]]&&n[_[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):n[f]?i.validateSpec({key:f,value:e[f],valueSpec:n[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ge(f,e[f],`unknown property "${f}"`)])}return u}function jo(i){const e=i.value,r=i.styleSpec,n=r.sky,l=i.style,u=et(e);if(e===void 0)return[];if(u!=="object")return[new ge("sky",e,`object expected, ${u} found`)];let d=[];for(const f in e)d=d.concat(n[f]?Ot({key:f,value:e[f],valueSpec:n[f],style:l,styleSpec:r}):[new ge(f,e[f],`unknown property "${f}"`)]);return d}function qo(i){const e=i.value,r=i.styleSpec,n=r.terrain,l=i.style;let u=[];const d=et(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new ge("terrain",e,`object expected, ${d} found`)]),u;for(const f in e)u=u.concat(n[f]?i.validateSpec({key:f,value:e[f],valueSpec:n[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ge(f,e[f],`unknown property "${f}"`)]);return u}function nn(i){let e=[];const r=i.value,n=i.key;if(Array.isArray(r)){const l=[],u=[];for(const d in r)r[d].id&&l.includes(r[d].id)&&e.push(new ge(n,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&u.includes(r[d].url)&&e.push(new ge(n,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(Ti({key:`${n}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return rr({key:n,value:r})}const an={"*":()=>[],array:Ps,boolean:function(i){const e=i.value,r=i.key,n=et(e);return n!=="boolean"?[new ge(r,e,`boolean expected, ${n} found`)]:[]},number:Sa,color:function(i){const e=i.key,r=i.value,n=et(r);return n!=="string"?[new ge(e,r,`color expected, ${n} found`)]:it.parse(String(r))?[]:[new ge(e,r,`color expected, "${r}" found`)]},constants:Vo,enum:Jr,filter:Ms,function:Ia,layer:Pa,object:Ti,source:No,light:$o,sky:jo,terrain:qo,string:rr,formatted:function(i){return rr(i).length===0?[]:Es(i)},resolvedImage:function(i){return rr(i).length===0?[]:Es(i)},padding:function(i){const e=i.key,r=i.value;if(et(r)==="array"){if(r.length<1||r.length>4)return[new ge(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const n={type:"number"};let l=[];for(let u=0;u[]}})),i.constants&&(r=r.concat(Vo({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:Ot}))),Zo(r)}function sr(i){return function(e){return i({...e,validateSpec:Ot})}}function Zo(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function ci(i){return function(...e){return Zo(i.apply(this,e))}}Li.source=ci(sr(No)),Li.sprite=ci(sr(nn)),Li.glyphs=ci(sr(zs)),Li.light=ci(sr($o)),Li.sky=ci(sr(jo)),Li.terrain=ci(sr(qo)),Li.layer=ci(sr(Pa)),Li.filter=ci(sr(Ms)),Li.paintProperty=ci(sr(Fn)),Li.layoutProperty=ci(sr(Ca));const ks=Li,Ea=ks.light,Nl=ks.paintProperty,Ma=ks.layoutProperty;function Go(i,e){let r=!1;if(e&&e.length)for(const n of e)i.fire(new Mt(new Error(n.message))),r=!0;return r}class pr{constructor(e,r,n){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(n=d[2]);for(let _=0;_=w[M+0]&&l>=w[M+1])?(f[P]=!0,d.push(b[P])):f[P]=!1}}}}_forEachCell(e,r,n,l,u,d,f,_){const x=this._convertToCellCoord(e),b=this._convertToCellCoord(r),w=this._convertToCellCoord(n),A=this._convertToCellCoord(l);for(let P=x;P<=w;P++)for(let M=b;M<=A;M++){const L=this.d*M+P;if((!_||_(this._convertFromCellCoord(P),this._convertFromCellCoord(M),this._convertFromCellCoord(P+1),this._convertFromCellCoord(M+1)))&&u.call(this,e,r,n,l,L,d,f,_))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;const e=this.cells,r=3+this.cells.length+1+1;let n=0;for(let d=0;d=0)continue;const d=i[u];l[u]=Mr[n].shallow.indexOf(u)>=0?d:Qr(d,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(l.$name=n),l}throw new Error("can't serialize object of type "+typeof i)}function Ds(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||i instanceof Error||za(i)||Ji(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Ds);if(typeof i=="object"){const e=i.$name||"Object";if(!Mr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Mr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const n=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const u=i[l];n[l]=Mr[e].shallow.indexOf(l)>=0?u:Ds(u)}return n}throw new Error("can't deserialize object of type "+typeof i)}class ka{constructor(){this.first=!0}update(e,r){const n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function on(i){for(const e of i)if(Vn(e.charCodeAt(0)))return!0;return!1}function On(i){for(const e of i)if(!Ho(e.charCodeAt(0)))return!1;return!0}function Ho(i){return!(Te.Arabic(i)||Te["Arabic Supplement"](i)||Te["Arabic Extended-A"](i)||Te["Arabic Presentation Forms-A"](i)||Te["Arabic Presentation Forms-B"](i))}function Vn(i){return!(i!==746&&i!==747&&(i<4352||!(Te["Bopomofo Extended"](i)||Te.Bopomofo(i)||Te["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Te["CJK Compatibility Ideographs"](i)||Te["CJK Compatibility"](i)||Te["CJK Radicals Supplement"](i)||Te["CJK Strokes"](i)||!(!Te["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Te["CJK Unified Ideographs Extension A"](i)||Te["CJK Unified Ideographs"](i)||Te["Enclosed CJK Letters and Months"](i)||Te["Hangul Compatibility Jamo"](i)||Te["Hangul Jamo Extended-A"](i)||Te["Hangul Jamo Extended-B"](i)||Te["Hangul Jamo"](i)||Te["Hangul Syllables"](i)||Te.Hiragana(i)||Te["Ideographic Description Characters"](i)||Te.Kanbun(i)||Te["Kangxi Radicals"](i)||Te["Katakana Phonetic Extensions"](i)||Te.Katakana(i)&&i!==12540||!(!Te["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Te["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Te["Unified Canadian Aboriginal Syllabics"](i)||Te["Unified Canadian Aboriginal Syllabics Extended"](i)||Te["Vertical Forms"](i)||Te["Yijing Hexagram Symbols"](i)||Te["Yi Syllables"](i)||Te["Yi Radicals"](i))))}function Da(i){return!(Vn(i)||function(e){return!!(Te["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Te["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Te["Letterlike Symbols"](e)||Te["Number Forms"](e)||Te["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Te["Control Pictures"](e)&&e!==9251||Te["Optical Character Recognition"](e)||Te["Enclosed Alphanumerics"](e)||Te["Geometric Shapes"](e)||Te["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Te["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Te["CJK Symbols and Punctuation"](e)||Te.Katakana(e)||Te["Private Use Area"](e)||Te["CJK Compatibility Forms"](e)||Te["Small Form Variants"](e)||Te["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function La(i){return i>=1424&&i<=2303||Te["Arabic Presentation Forms-A"](i)||Te["Arabic Presentation Forms-B"](i)}function Ra(i,e){return!(!e&&La(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Te.Khmer(i))}function Wo(i){for(const e of i)if(La(e.charCodeAt(0)))return!0;return!1}const es=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class ht{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ka,this.transition={})}isSupportedScript(e){return function(r,n){for(const l of r)if(!Ra(l.charCodeAt(0),n))return!1;return!0}(e,es.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class Un{constructor(e,r){this.property=e,this.value=r,this.expression=function(n,l){if(Is(n))return new Dn(n,l);if(ot(n)){const u=Lo(n,l);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=n;return l.type==="color"&&typeof n=="string"?u=it.parse(n):l.type!=="padding"||typeof n!="number"&&!Array.isArray(n)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(n)&&(u=Gt.parse(n)):u=bi.parse(n),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}}class Nn{constructor(e){this.property=e,this.value=new Un(e,void 0)}transitioned(e,r){return new Fa(this.property,this.value,r,Mi({},e.transition,this.transition),e.now)}untransitioned(){return new Fa(this.property,this.value,null,{},0)}}class Ba{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return si(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Nn(this._values[e].property)),this._values[e].value=new Un(this._values[e].property,r===null?void 0:si(r))}getTransition(e){return si(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Nn(this._values[e].property)),this._values[e].transition=si(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(e[r]=n);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const n=new Xo(this._properties);for(const l of Object.keys(this._values))n._values[l]=this._values[l].transitioned(e,r._values[l]);return n}untransitioned(){const e=new Xo(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Fa{constructor(e,r,n,l,u){this.property=e,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=n)}possiblyEvaluate(e,r,n){const l=e.now||0,u=this.value.possiblyEvaluate(e,r,n),d=this.prior;if(d){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l=1)return 1;const x=_*_,b=x*_;return 4*(_<.5?b:3*(_-x)+b-.75)}(f))}}return u}}class Xo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){const l=new ln(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,n);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class $l{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return si(this._values[e].value)}setValue(e,r){this._values[e]=new Un(this._values[e].property,r===null?void 0:si(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){const l=new ln(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,n);return l}}class Ni{constructor(e,r,n){this.property=e,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,n,l){return this.property.evaluate(this.value,this.parameters,e,r,n,l)}}class ln{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Me{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,n){const l=wi[this.specification.type];return l?l(e,r,n):e}}class ke{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,n,l){return new Ni(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},n,l)}:e.expression,r)}interpolate(e,r,n){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Ni(this,{kind:"constant",value:void 0},e.parameters);const l=wi[this.specification.type];if(l){const u=l(e.value.value,r.value.value,n);return new Ni(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,n,l,u,d){return e.kind==="constant"?e.value:e.evaluate(r,n,l,u,d)}}class ts extends ke{possiblyEvaluate(e,r,n,l){if(e.value===void 0)return new Ni(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},n,l),d=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new Ni(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Ni(this,{kind:"constant",value:u},r)}return new Ni(this,e.expression,r)}evaluate(e,r,n,l,u,d){if(e.kind==="source"){const f=e.evaluate(r,n,l,u,d);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},n,l),e.evaluate({zoom:Math.floor(r.zoom)},n,l),e.evaluate({zoom:Math.floor(r.zoom)+1},n,l),r):e.value}_calculate(e,r,n,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}}class Oa{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},n,l);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new ht(Math.floor(r.zoom-1),r)),e.expression.evaluate(new ht(Math.floor(r.zoom),r)),e.expression.evaluate(new ht(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,n,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}}class cn{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,l){return!!e.expression.evaluate(r,null,{},n,l)}interpolate(){return!1}}class hi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const n=e[r];n.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Un(n,void 0),u=this.defaultTransitionablePropertyValues[r]=new Nn(n);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ie("DataDrivenProperty",ke),Ie("DataConstantProperty",Me),Ie("CrossFadedDataDrivenProperty",ts),Ie("CrossFadedProperty",Oa),Ie("ColorRampProperty",cn);const Ko="-transition";class $i extends jr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},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),r.layout&&(this._unevaluatedLayout=new $l(r.layout)),r.paint)){this._transitionablePaint=new Ba(r.paint);for(const n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(const n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ln(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,n={}){r!=null&&this._validate(Ma,`layers.${this.id}.layout.${e}`,e,r,n)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Ko)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null&&this._validate(Nl,`layers.${this.id}.paint.${e}`,e,r,n))return!1;if(e.endsWith(Ko))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const _=this._transitionablePaint._values[e].value;return _.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,f,_)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,n){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={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:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),yn(e,(r,n)=>!(r===void 0||n==="layout"&&!Object.keys(r).length||n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,l,u={}){return(!u||u.validate!==!1)&&Go(this,e.call(ks,{key:r,layerType:this.type,objectKey:n,value:l,styleSpec:se,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof Ni&&Ss(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Yo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ls{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class _t{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function It(i,e=1){let r=0,n=0;return{members:i.map(l=>{const u=Yo[l.type].BYTES_PER_ELEMENT,d=r=Jo(r,Math.max(e,u)),f=l.components||1;return n=Math.max(n,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:d}}),size:Jo(r,Math.max(n,e)),alignment:e}}function Jo(i,e){return Math.ceil(i/e)*e}class hn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=n,e}}hn.prototype.bytesPerElement=4,Ie("StructArrayLayout2i4",hn);class $n extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=n,this.int16[u+2]=l,e}}$n.prototype.bytesPerElement=6,Ie("StructArrayLayout3i6",$n);class zr extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,n,l)}emplace(e,r,n,l,u){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=n,this.int16[d+2]=l,this.int16[d+3]=u,e}}zr.prototype.bytesPerElement=8,Ie("StructArrayLayout4i8",zr);class Va extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,l,u,d)}emplace(e,r,n,l,u,d,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=l,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,e}}Va.prototype.bytesPerElement=12,Ie("StructArrayLayout2i4i12",Va);class Ua extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,l,u,d)}emplace(e,r,n,l,u,d,f){const _=4*e,x=8*e;return this.int16[_+0]=r,this.int16[_+1]=n,this.uint8[x+4]=l,this.uint8[x+5]=u,this.uint8[x+6]=d,this.uint8[x+7]=f,e}}Ua.prototype.bytesPerElement=8,Ie("StructArrayLayout2i4ub8",Ua);class un extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=n,e}}un.prototype.bytesPerElement=8,Ie("StructArrayLayout2f8",un);class Na extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d,f,_,x,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,n,l,u,d,f,_,x,b)}emplace(e,r,n,l,u,d,f,_,x,b,w){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=n,this.uint16[A+2]=l,this.uint16[A+3]=u,this.uint16[A+4]=d,this.uint16[A+5]=f,this.uint16[A+6]=_,this.uint16[A+7]=x,this.uint16[A+8]=b,this.uint16[A+9]=w,e}}Na.prototype.bytesPerElement=20,Ie("StructArrayLayout10ui20",Na);class jn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d,f,_,x,b,w,A){const P=this.length;return this.resize(P+1),this.emplace(P,e,r,n,l,u,d,f,_,x,b,w,A)}emplace(e,r,n,l,u,d,f,_,x,b,w,A,P){const M=12*e;return this.int16[M+0]=r,this.int16[M+1]=n,this.int16[M+2]=l,this.int16[M+3]=u,this.uint16[M+4]=d,this.uint16[M+5]=f,this.uint16[M+6]=_,this.uint16[M+7]=x,this.int16[M+8]=b,this.int16[M+9]=w,this.int16[M+10]=A,this.int16[M+11]=P,e}}jn.prototype.bytesPerElement=24,Ie("StructArrayLayout4i4ui4i24",jn);class $a extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=n,this.float32[u+2]=l,e}}$a.prototype.bytesPerElement=12,Ie("StructArrayLayout3f12",$a);class ja extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}ja.prototype.bytesPerElement=4,Ie("StructArrayLayout1ul4",ja);class fr extends _t{_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,r,n,l,u,d,f,_,x){const b=this.length;return this.resize(b+1),this.emplace(b,e,r,n,l,u,d,f,_,x)}emplace(e,r,n,l,u,d,f,_,x,b){const w=10*e,A=5*e;return this.int16[w+0]=r,this.int16[w+1]=n,this.int16[w+2]=l,this.int16[w+3]=u,this.int16[w+4]=d,this.int16[w+5]=f,this.uint32[A+3]=_,this.uint16[w+8]=x,this.uint16[w+9]=b,e}}fr.prototype.bytesPerElement=20,Ie("StructArrayLayout6i1ul2ui20",fr);class qn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,l,u,d)}emplace(e,r,n,l,u,d,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=l,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,e}}qn.prototype.bytesPerElement=12,Ie("StructArrayLayout2i2i2i12",qn);class dn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,n,l,u)}emplace(e,r,n,l,u,d){const f=4*e,_=8*e;return this.float32[f+0]=r,this.float32[f+1]=n,this.float32[f+2]=l,this.int16[_+6]=u,this.int16[_+7]=d,e}}dn.prototype.bytesPerElement=16,Ie("StructArrayLayout2f1f2i16",dn);class Zn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,n,l)}emplace(e,r,n,l,u){const d=12*e,f=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=n,this.float32[f+1]=l,this.float32[f+2]=u,e}}Zn.prototype.bytesPerElement=12,Ie("StructArrayLayout2ub2f12",Zn);class Rs extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=n,this.uint16[u+2]=l,e}}Rs.prototype.bytesPerElement=6,Ie("StructArrayLayout3ui6",Rs);class qa extends _t{_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,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$){const Y=this.length;return this.resize(Y+1),this.emplace(Y,e,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$)}emplace(e,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$,Y){const j=24*e,W=12*e,ae=48*e;return this.int16[j+0]=r,this.int16[j+1]=n,this.uint16[j+2]=l,this.uint16[j+3]=u,this.uint32[W+2]=d,this.uint32[W+3]=f,this.uint32[W+4]=_,this.uint16[j+10]=x,this.uint16[j+11]=b,this.uint16[j+12]=w,this.float32[W+7]=A,this.float32[W+8]=P,this.uint8[ae+36]=M,this.uint8[ae+37]=L,this.uint8[ae+38]=V,this.uint32[W+10]=$,this.int16[j+22]=Y,e}}qa.prototype.bytesPerElement=48,Ie("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",qa);class Bs extends _t{_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,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$,Y,j,W,ae,le,we,Ce,be,ve,me,Ae){const ye=this.length;return this.resize(ye+1),this.emplace(ye,e,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$,Y,j,W,ae,le,we,Ce,be,ve,me,Ae)}emplace(e,r,n,l,u,d,f,_,x,b,w,A,P,M,L,V,$,Y,j,W,ae,le,we,Ce,be,ve,me,Ae,ye){const pe=32*e,ze=16*e;return this.int16[pe+0]=r,this.int16[pe+1]=n,this.int16[pe+2]=l,this.int16[pe+3]=u,this.int16[pe+4]=d,this.int16[pe+5]=f,this.int16[pe+6]=_,this.int16[pe+7]=x,this.uint16[pe+8]=b,this.uint16[pe+9]=w,this.uint16[pe+10]=A,this.uint16[pe+11]=P,this.uint16[pe+12]=M,this.uint16[pe+13]=L,this.uint16[pe+14]=V,this.uint16[pe+15]=$,this.uint16[pe+16]=Y,this.uint16[pe+17]=j,this.uint16[pe+18]=W,this.uint16[pe+19]=ae,this.uint16[pe+20]=le,this.uint16[pe+21]=we,this.uint16[pe+22]=Ce,this.uint32[ze+12]=be,this.float32[ze+13]=ve,this.float32[ze+14]=me,this.uint16[pe+30]=Ae,this.uint16[pe+31]=ye,e}}Bs.prototype.bytesPerElement=64,Ie("StructArrayLayout8i15ui1ul2f2ui64",Bs);class kr extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}kr.prototype.bytesPerElement=4,Ie("StructArrayLayout1f4",kr);class Za extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const u=3*e;return this.uint16[6*e+0]=r,this.float32[u+1]=n,this.float32[u+2]=l,e}}Za.prototype.bytesPerElement=12,Ie("StructArrayLayout1ui2f12",Za);class Gn extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=n,this.uint16[u+3]=l,e}}Gn.prototype.bytesPerElement=8,Ie("StructArrayLayout1ul2ui8",Gn);class is extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=n,e}}is.prototype.bytesPerElement=4,Ie("StructArrayLayout2ui4",is);class Ga extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}Ga.prototype.bytesPerElement=2,Ie("StructArrayLayout1ui2",Ga);class Ha extends _t{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,n,l)}emplace(e,r,n,l,u){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=n,this.float32[d+2]=l,this.float32[d+3]=u,e}}Ha.prototype.bytesPerElement=16,Ie("StructArrayLayout4f16",Ha);class Wa extends Ls{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 xe(this.anchorPointX,this.anchorPointY)}}Wa.prototype.size=20;class Qo extends fr{get(e){return new Wa(this,e)}}Ie("CollisionBoxArray",Qo);class c extends Ls{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]}}c.prototype.size=48;class t extends qa{get(e){return new c(this,e)}}Ie("PlacedSymbolArray",t);class s extends Ls{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]}}s.prototype.size=64;class a extends Bs{get(e){return new s(this,e)}}Ie("SymbolInstanceArray",a);class o extends kr{getoffsetX(e){return this.float32[1*e+0]}}Ie("GlyphOffsetArray",o);class h extends $n{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Ie("SymbolLineVertexArray",h);class m extends Ls{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]}}m.prototype.size=12;class g extends Za{get(e){return new m(this,e)}}Ie("TextAnchorOffsetArray",g);class y extends Ls{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]}}y.prototype.size=8;class v extends Gn{get(e){return new y(this,e)}}Ie("FeatureIndexArray",v);class T extends hn{}class S extends hn{}class E extends hn{}class O extends Va{}class B extends Ua{}class U extends un{}class D extends Na{}class Z extends jn{}class Q extends $a{}class N extends ja{}class X extends qn{}class ee extends Zn{}class te extends Rs{}class ie extends is{}const de=It([{name:"a_pos",components:2,type:"Int16"}],4),{members:ce}=de;class ue{constructor(e=[]){this.segments=e}prepareSegment(e,r,n,l){let u=this.segments[this.segments.length-1];return e>ue.MAX_VERTEX_ARRAY_LENGTH&&qt(`Max vertices per segment is ${ue.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>ue.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,n,l){return new ue([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:l,vaos:{},sortKey:0}])}}function Se(i,e){return 256*(i=Yi(Math.floor(i),0,255))+Yi(Math.floor(e),0,255)}ue.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ie("SegmentVector",ue);const Oe=It([{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"}]);var _e={exports:{}},Le={exports:{}};Le.exports=function(i,e){var r,n,l,u,d,f,_,x;for(n=i.length-(r=3&i.length),l=e,d=3432918353,f=461845907,x=0;x>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:l^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var $e=Le.exports,We={exports:{}};We.exports=function(i,e){for(var r,n=i.length,l=e^n,u=0;n>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++u;switch(n){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Be=$e,qe=We.exports;_e.exports=Be,_e.exports.murmur3=Be,_e.exports.murmur2=qe;var Ze=Ei(_e.exports);class mt{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,l){this.ids.push(at(e)),this.positions.push(r,n,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=at(e);let n=0,l=this.ids.length-1;for(;n>1;this.ids[d]>=r?l=d:n=d+1}const u=[];for(;this.ids[n]===r;)u.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return u}static serialize(e,r){const n=new Float64Array(e.ids),l=new Uint32Array(e.positions);return ui(n,l,0,n.length-1),r&&r.push(n.buffer,l.buffer),{ids:n,positions:l}}static deserialize(e){const r=new mt;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function at(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ze(String(i))}function ui(i,e,r,n){for(;r>1];let u=r-1,d=n+1;for(;;){do u++;while(i[u]l);if(u>=d)break;Pt(i,u,d),Pt(e,3*u,3*d),Pt(e,3*u+1,3*d+1),Pt(e,3*u+2,3*d+2)}d-r`u_${l}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new nr(e,r):new Ht(e,r)}}class qi{constructor(e,r){this.uniformNames=r.map(n=>`u_${n}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,n,l){const u=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&e.set(u)}getBinding(e,r,n){return n.substr(0,9)==="u_pattern"?new ji(e,r):new Ht(e,r)}}class yt{constructor(e,r,n,l){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,n,l,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new ht(0),r,{},l,[],u);this.paintVertexArray.resize(e),this._setPaintValue(d,e,f)}updatePaintArray(e,r,n,l){const u=this.expression.evaluate({zoom:0},n,l);this._setPaintValue(e,r,u)}_setPaintValue(e,r,n){if(this.type==="color"){const l=ss(n);for(let u=e;u`u_${f}_t`),this.type=n,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,n,l,u){const d=this.expression.evaluate(new ht(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new ht(this.zoom+1),r,{},l,[],u),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,d,f)}updatePaintArray(e,r,n,l){const u=this.expression.evaluate({zoom:this.zoom},n,l),d=this.expression.evaluate({zoom:this.zoom+1},n,l);this._setPaintValue(e,r,u,d)}_setPaintValue(e,r,n,l){if(this.type==="color"){const u=ss(n),d=ss(l);for(let f=e;f`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof yt||n instanceof ut)for(let l=0;l!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Fs(l,r,n);this.needsUpload=!1,this._featureMap=new mt,this._bufferOffset=0}populatePaintArrays(e,r,n,l,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,n,l){for(const u of n)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Vt(i,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-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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Si(i,e,r){const n={color:{source:un,composite:Ha},number:{source:kr,composite:un}},l=function(u){return{"line-pattern":{source:D,composite:D},"fill-pattern":{source:D,composite:D},"fill-extrusion-pattern":{source:D,composite:D}}[u]}(i);return l&&l[r]||n[e][r]}Ie("ConstantBinder",ar),Ie("CrossFadedConstantBinder",qi),Ie("SourceExpressionBinder",yt),Ie("CrossFadedCompositeBinder",wt),Ie("CompositeExpressionBinder",ut),Ie("ProgramConfiguration",Fs,{omit:["_buffers"]}),Ie("ProgramConfigurationSet",pt);const He=8192,Xa=Math.pow(2,14)-1,el=-Xa-1;function ns(i){const e=He/i.extent,r=i.loadGeometry();for(let n=0;nd.x+1||_d.y+1)&&qt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function as(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?ns(i):[]}}function Hn(i,e,r,n,l){i.emplaceBack(2*e+(n+1)/2,2*r+(l+1)/2)}class Ka{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new S,this.indexArray=new te,this.segments=new ue,this.programConfigurations=new pt(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){const l=this.layers[0],u=[];let d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:_,id:x,index:b,sourceLayerIndex:w}of e){const A=this.layers[0]._featureFilter.needGeometry,P=as(_,A);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),P,n))continue;const M=f?d.evaluate(P,{},n):void 0,L={id:x,properties:_.properties,type:_.type,sourceLayerIndex:w,index:b,geometry:A?P.geometry:ns(_),patterns:{},sortKey:M};u.push(L)}f&&u.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of u){const{geometry:x,index:b,sourceLayerIndex:w}=_,A=e[b].feature;this.addFeature(_,x,b,n),r.featureIndex.insert(A,x,b,w,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ce),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,r,n,l){for(const u of r)for(const d of u){const f=d.x,_=d.y;if(f<0||f>=He||_<0||_>=He)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),b=x.vertexLength;Hn(this.layoutVertexArray,f,_,-1,-1),Hn(this.layoutVertexArray,f,_,1,-1),Hn(this.layoutVertexArray,f,_,1,1),Hn(this.layoutVertexArray,f,_,-1,1),this.indexArray.emplaceBack(b,b+1,b+2),this.indexArray.emplaceBack(b,b+3,b+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},l)}}function os(i,e){for(let r=0;r1){if(pn(i,e))return!0;for(let n=0;n1?r:r.sub(e)._mult(l)._add(e))}function Ec(i,e){let r,n,l,u=!1;for(let d=0;de.y!=l.y>e.y&&e.x<(l.x-n.x)*(e.y-n.y)/(l.y-n.y)+n.x&&(u=!u)}return u}function Wn(i,e){let r=!1;for(let n=0,l=i.length-1;ne.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function au(i,e,r){const n=r[0],l=r[2];if(i.xl.x&&e.x>l.x||i.yl.y&&e.y>l.y)return!1;const u=Fi(i,e,r[0]);return u!==Fi(i,e,r[1])||u!==Fi(i,e,r[2])||u!==Fi(i,e,r[3])}function Ja(i,e,r){const n=e.paint.get(i).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(i)}function sl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function nl(i,e,r,n,l){if(!e[0]&&!e[1])return i;const u=xe.convert(e)._mult(l);r==="viewport"&&u._rotate(-n);const d=[];for(let f=0;fDc(V,L))}(x,_),P=w?b*f:b;for(const M of l)for(const L of M){const V=w?L:Dc(L,_);let $=P;const Y=al([],[L.x,L.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=Y[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=d.cameraToCenterDistance/Y[3]),tl(A,V,$))return!0}return!1}}function Dc(i,e){const r=al([],[i.x,i.y,0,1],e);return new xe(r[0]/r[3],r[1]/r[3])}class Lc extends Ka{}let Rc;Ie("HeatmapBucket",Lc,{omit:["layers"]});var hu={get paint(){return Rc=Rc||new hi({"heatmap-radius":new ke(se.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ke(se.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Me(se.paint_heatmap["heatmap-intensity"]),"heatmap-color":new cn(se.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Me(se.paint_heatmap["heatmap-opacity"])})}};function ql(i,{width:e,height:r},n,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*n}`)}else l=new Uint8Array(e*r*n);return i.width=e,i.height=r,i.data=l,i}function Bc(i,{width:e,height:r},n){if(e===i.width&&r===i.height)return;const l=ql({},{width:e,height:r},n);Zl(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},n),i.width=e,i.height=r,i.data=l.data}function Zl(i,e,r,n,l,u){if(l.width===0||l.height===0)return e;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||n.x>e.width-l.width||n.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=e.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_{e[i.evaluationKey]=_;const x=i.expression.evaluate(e);l.data[d+f+0]=Math.floor(255*x.r/x.a),l.data[d+f+1]=Math.floor(255*x.g/x.a),l.data[d+f+2]=Math.floor(255*x.b/x.a),l.data[d+f+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,f=0;d80*r){n=u=i[0],l=d=i[1];for(var M=r;Mu&&(u=f),_>d&&(d=_);x=(x=Math.max(u-n,d-l))!==0?32767/x:0}return to(A,P,r,n,l,x,0),P}function Vc(i,e,r,n,l){var u,d;if(l===Xl(i,e,r,n)>0)for(u=e;u=e;u-=n)d=$c(u,i[u],i[u+1],d);return d&&ll(d,d.next)&&(ro(d),d=d.next),d}function mn(i,e){if(!i)return i;e||(e=i);var r,n=i;do if(r=!1,n.steiner||!ll(n,n.next)&&At(n.prev,n,n.next)!==0)n=n.next;else{if(ro(n),(n=e=n.prev)===n.next)break;r=!0}while(r||n!==e);return e}function to(i,e,r,n,l,u,d){if(i){!d&&u&&function(b,w,A,P){var M=b;do M.z===0&&(M.z=Hl(M.x,M.y,w,A,P)),M.prevZ=M.prev,M.nextZ=M.next,M=M.next;while(M!==b);M.prevZ.nextZ=null,M.prevZ=null,function(L){var V,$,Y,j,W,ae,le,we,Ce=1;do{for($=L,L=null,W=null,ae=0;$;){for(ae++,Y=$,le=0,V=0;V0||we>0&&Y;)le!==0&&(we===0||!Y||$.z<=Y.z)?(j=$,$=$.nextZ,le--):(j=Y,Y=Y.nextZ,we--),W?W.nextZ=j:L=j,j.prevZ=W,W=j;$=Y}W.nextZ=null,Ce*=2}while(ae>1)}(M)}(i,n,l,u);for(var f,_,x=i;i.prev!==i.next;)if(f=i.prev,_=i.next,u?_u(i,n,l,u):gu(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(_.i/r|0),ro(i),i=_.next,x=_.next;else if((i=_)===x){d?d===1?to(i=yu(mn(i),e,r),e,r,n,l,u,2):d===2&&xu(i,e,r,n,l,u):to(mn(i),e,r,n,l,u,1);break}}}function gu(i){var e=i.prev,r=i,n=i.next;if(At(e,r,n)>=0)return!1;for(var l=e.x,u=r.x,d=n.x,f=e.y,_=r.y,x=n.y,b=lu?l>d?l:d:u>d?u:d,P=f>_?f>x?f:x:_>x?_:x,M=n.next;M!==e;){if(M.x>=b&&M.x<=A&&M.y>=w&&M.y<=P&&Kn(l,f,u,_,d,x,M.x,M.y)&&At(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function _u(i,e,r,n){var l=i.prev,u=i,d=i.next;if(At(l,u,d)>=0)return!1;for(var f=l.x,_=u.x,x=d.x,b=l.y,w=u.y,A=d.y,P=f<_?f_?f>x?f:x:_>x?_:x,V=b>w?b>A?b:A:w>A?w:A,$=Hl(P,M,e,r,n),Y=Hl(L,V,e,r,n),j=i.prevZ,W=i.nextZ;j&&j.z>=$&&W&&W.z<=Y;){if(j.x>=P&&j.x<=L&&j.y>=M&&j.y<=V&&j!==l&&j!==d&&Kn(f,b,_,w,x,A,j.x,j.y)&&At(j.prev,j,j.next)>=0||(j=j.prevZ,W.x>=P&&W.x<=L&&W.y>=M&&W.y<=V&&W!==l&&W!==d&&Kn(f,b,_,w,x,A,W.x,W.y)&&At(W.prev,W,W.next)>=0))return!1;W=W.nextZ}for(;j&&j.z>=$;){if(j.x>=P&&j.x<=L&&j.y>=M&&j.y<=V&&j!==l&&j!==d&&Kn(f,b,_,w,x,A,j.x,j.y)&&At(j.prev,j,j.next)>=0)return!1;j=j.prevZ}for(;W&&W.z<=Y;){if(W.x>=P&&W.x<=L&&W.y>=M&&W.y<=V&&W!==l&&W!==d&&Kn(f,b,_,w,x,A,W.x,W.y)&&At(W.prev,W,W.next)>=0)return!1;W=W.nextZ}return!0}function yu(i,e,r){var n=i;do{var l=n.prev,u=n.next.next;!ll(l,u)&&Uc(l,n,n.next,u)&&io(l,u)&&io(u,l)&&(e.push(l.i/r|0),e.push(n.i/r|0),e.push(u.i/r|0),ro(n),ro(n.next),n=i=u),n=n.next}while(n!==i);return mn(n)}function xu(i,e,r,n,l,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&Su(d,f)){var _=Nc(d,f);return d=mn(d,d.next),_=mn(_,_.next),to(d,e,r,n,l,u,0),void to(_,e,r,n,l,u,0)}f=f.next}d=d.next}while(d!==i)}function vu(i,e){return i.x-e.x}function bu(i,e){var r=function(l,u){var d,f=u,_=l.x,x=l.y,b=-1/0;do{if(x<=f.y&&x>=f.next.y&&f.next.y!==f.y){var w=f.x+(x-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(w<=_&&w>b&&(b=w,d=f.x=f.x&&f.x>=M&&_!==f.x&&Kn(xd.x||f.x===d.x&&wu(d,f)))&&(d=f,V=A)),f=f.next;while(f!==P);return d}(i,e);if(!r)return e;var n=Nc(r,i);return mn(n,n.next),mn(r,r.next)}function wu(i,e){return At(i.prev,i,e.prev)<0&&At(e.next,i,i.next)<0}function Hl(i,e,r,n,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Tu(i){var e=i,r=i;do(e.x=(i-d)*(u-f)&&(i-d)*(n-f)>=(r-d)*(e-f)&&(r-d)*(u-f)>=(l-d)*(n-f)}function Su(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,n){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==n.i&&l.next.i!==n.i&&Uc(l,l.next,r,n))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(io(i,e)&&io(e,i)&&function(r,n){var l=r,u=!1,d=(r.x+n.x)/2,f=(r.y+n.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(u=!u),l=l.next;while(l!==r);return u}(i,e)&&(At(i.prev,i,e.prev)||At(i,e.prev,e))||ll(i,e)&&At(i.prev,i,i.next)>0&&At(e.prev,e,e.next)>0)}function At(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function ll(i,e){return i.x===e.x&&i.y===e.y}function Uc(i,e,r,n){var l=hl(At(i,e,r)),u=hl(At(i,e,n)),d=hl(At(r,n,i)),f=hl(At(r,n,e));return l!==u&&d!==f||!(l!==0||!cl(i,r,e))||!(u!==0||!cl(i,n,e))||!(d!==0||!cl(r,i,n))||!(f!==0||!cl(r,e,n))}function cl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function hl(i){return i>0?1:i<0?-1:0}function io(i,e){return At(i.prev,i,i.next)<0?At(i,e,i.next)>=0&&At(i,i.prev,e)>=0:At(i,e,i.prev)<0||At(i,i.next,e)<0}function Nc(i,e){var r=new Wl(i.i,i.x,i.y),n=new Wl(e.i,e.x,e.y),l=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,n.next=r,r.prev=n,u.next=n,n.prev=u,n}function $c(i,e,r,n){var l=new Wl(i,e,r);return n?(l.next=n.next,l.prev=n,n.next.prev=l,n.next=l):(l.prev=l,l.next=l),l}function ro(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Wl(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Xl(i,e,r,n){for(var l=0,u=e,d=r-n;u0&&r.holes.push(n+=i[l-1].length)}return r};var jc=Ei(Gl.exports);function Iu(i,e,r,n,l){qc(i,e,r,n||i.length-1,l||Au)}function qc(i,e,r,n,l){for(;n>r;){if(n-r>600){var u=n-r+1,d=e-r+1,f=Math.log(u),_=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*_*(u-_)/u)*(d-u/2<0?-1:1);qc(i,e,Math.max(r,Math.floor(e-d*_/u+x)),Math.min(n,Math.floor(e+(u-d)*_/u+x)),l)}var b=i[e],w=r,A=n;for(so(i,r,e),l(i[n],b)>0&&so(i,r,n);w0;)A--}l(i[r],b)===0?so(i,r,A):so(i,++A,n),A<=e&&(r=A+1),e<=A&&(n=A-1)}}function so(i,e,r){var n=i[e];i[e]=i[r],i[r]=n}function Au(i,e){return ie?1:0}function Kl(i,e){const r=i.length;if(r<=1)return[i];const n=[];let l,u;for(let d=0;d1)for(let d=0;dr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new E,this.indexArray=new te,this.indexArray2=new ie,this.programConfigurations=new pt(e.layers,e.zoom),this.segments=new ue,this.segments2=new ue,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Yl("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:b}of e){const w=this.layers[0]._featureFilter.needGeometry,A=as(f,w);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),A,n))continue;const P=u?l.evaluate(A,{},n,r.availableImages):void 0,M={id:_,properties:f.properties,type:f.type,sourceLayerIndex:b,index:x,geometry:w?A.geometry:ns(f),patterns:{},sortKey:P};d.push(M)}u&&d.sort((f,_)=>f.sortKey-_.sortKey);for(const f of d){const{geometry:_,index:x,sourceLayerIndex:b}=f;if(this.hasPattern){const w=Jl("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,_,x,n,{});r.featureIndex.insert(e[x].feature,_,x,b,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,mu),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,r,n,l,u){for(const d of Kl(r,500)){let f=0;for(const P of d)f+=P.length;const _=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=_.vertexLength,b=[],w=[];for(const P of d){if(P.length===0)continue;P!==d[0]&&w.push(b.length/2);const M=this.segments2.prepareSegment(P.length,this.layoutVertexArray,this.indexArray2),L=M.vertexLength;this.layoutVertexArray.emplaceBack(P[0].x,P[0].y),this.indexArray2.emplaceBack(L+P.length-1,L),b.push(P[0].x),b.push(P[0].y);for(let V=1;V>3}if(l--,n===1||n===2)u+=i.readSVarint(),d+=i.readSVarint(),n===1&&(e&&f.push(e),e=[]),e.push(new Du(u,d));else{if(n!==7)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&f.push(e),f},Yn.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,n=0,l=0,u=0,d=1/0,f=-1/0,_=1/0,x=-1/0;i.pos>3}if(n--,r===1||r===2)(l+=i.readSVarint())f&&(f=l),(u+=i.readSVarint())<_&&(_=u),u>x&&(x=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,_,f,x]},Yn.prototype.toGeoJSON=function(i,e,r){var n,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*e,_=this.loadGeometry(),x=Yn.types[this.type];function b(P){for(var M=0;M>3;l=d===1?n.readString():d===2?n.readFloat():d===3?n.readDouble():d===4?n.readVarint64():d===5?n.readVarint():d===6?n.readSVarint():d===7?n.readBoolean():null}return l}(r))}Xc.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new Bu(this._pbf,e,this.extent,this._keys,this._values)};var Ou=Wc;function Vu(i,e,r){if(i===3){var n=new Ou(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}Os.VectorTile=function(i,e){this.layers=i.readFields(Vu,{},e)},Os.VectorTileFeature=Hc,Os.VectorTileLayer=Wc;const Uu=Os.VectorTileFeature.types,ec=Math.pow(2,13);function no(i,e,r,n,l,u,d,f){i.emplaceBack(e,r,2*Math.floor(n*ec)+d,l*ec*2,u*ec*2,Math.round(f))}class tc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new O,this.centroidVertexArray=new T,this.indexArray=new te,this.programConfigurations=new pt(e.layers,e.zoom),this.segments=new ue,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=Yl("fill-extrusion",this.layers,r);for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of e){const _=this.layers[0]._featureFilter.needGeometry,x=as(l,_);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),x,n))continue;const b={id:u,sourceLayerIndex:f,index:d,geometry:_?x.geometry:ns(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Jl("fill-extrusion",this.layers,b,this.zoom,r)):this.addFeature(b,b.geometry,d,n,{}),r.featureIndex.insert(l,b.geometry,d,f,this.index,!0)}}addFeatures(e,r,n){for(const l of this.features){const{geometry:u}=l;this.addFeature(l,u,l.index,r,n)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}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,ku),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,zu.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,r,n,l,u){const d={x:0,y:0,vertexCount:0};for(const f of Kl(r,500)){let _=0;for(const M of f)_+=M.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const M of f){if(M.length===0||$u(M))continue;let L=0;for(let V=0;V=1){const Y=M[V-1];if(!Nu($,Y)){x.vertexLength+4>ue.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const j=$.sub(Y)._perp()._unit(),W=Y.dist($);L+W>32768&&(L=0),no(this.layoutVertexArray,$.x,$.y,j.x,j.y,0,0,L),no(this.layoutVertexArray,$.x,$.y,j.x,j.y,0,1,L),d.x+=2*$.x,d.y+=2*$.y,d.vertexCount+=2,L+=W,no(this.layoutVertexArray,Y.x,Y.y,j.x,j.y,0,0,L),no(this.layoutVertexArray,Y.x,Y.y,j.x,j.y,0,1,L),d.x+=2*Y.x,d.y+=2*Y.y,d.vertexCount+=2;const ae=x.vertexLength;this.indexArray.emplaceBack(ae,ae+2,ae+1),this.indexArray.emplaceBack(ae+1,ae+2,ae+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+_>ue.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),Uu[e.type]!=="Polygon")continue;const b=[],w=[],A=x.vertexLength;for(const M of f)if(M.length!==0){M!==f[0]&&w.push(b.length/2);for(let L=0;LHe)||i.y===e.y&&(i.y<0||i.y>He)}function $u(i){return i.every(e=>e.x<0)||i.every(e=>e.x>He)||i.every(e=>e.y<0)||i.every(e=>e.y>He)}let Kc;Ie("FillExtrusionBucket",tc,{omit:["layers","features"]});var ju={get paint(){return Kc=Kc||new hi({"fill-extrusion-opacity":new Me(se["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ke(se["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Me(se["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Me(se["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ts(se["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ke(se["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ke(se["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Me(se["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class qu extends $i{constructor(e){super(e,ju)}createBucket(e){return new tc(e)}queryRadius(){return sl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,n,l,u,d,f,_){const x=nl(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),b=this.paint.get("fill-extrusion-height").evaluate(r,n),w=this.paint.get("fill-extrusion-base").evaluate(r,n),A=function(M,L,V,$){const Y=[];for(const j of M){const W=[j.x,j.y,0,1];al(W,W,L),Y.push(new xe(W[0]/W[3],W[1]/W[3]))}return Y}(x,_),P=function(M,L,V,$){const Y=[],j=[],W=$[8]*L,ae=$[9]*L,le=$[10]*L,we=$[11]*L,Ce=$[8]*V,be=$[9]*V,ve=$[10]*V,me=$[11]*V;for(const Ae of M){const ye=[],pe=[];for(const ze of Ae){const Ee=ze.x,Ge=ze.y,dt=$[0]*Ee+$[4]*Ge+$[12],ft=$[1]*Ee+$[5]*Ge+$[13],kt=$[2]*Ee+$[6]*Ge+$[14],Ri=$[3]*Ee+$[7]*Ge+$[15],pi=kt+le,Et=Ri+we,jt=dt+Ce,Xt=ft+be,fi=kt+ve,mi=Ri+me,Dt=new xe((dt+W)/Et,(ft+ae)/Et);Dt.z=pi/Et,ye.push(Dt);const Lt=new xe(jt/mi,Xt/mi);Lt.z=fi/mi,pe.push(Lt)}Y.push(ye),j.push(pe)}return[Y,j]}(l,w,b,_);return function(M,L,V){let $=1/0;Ya(V,L)&&($=Yc(V,L[0]));for(let Y=0;Yr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new B,this.layoutVertexArray2=new U,this.indexArray=new te,this.programConfigurations=new pt(e.layers,e.zoom),this.segments=new ue,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Yl("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:b}of e){const w=this.layers[0]._featureFilter.needGeometry,A=as(f,w);if(!this.layers[0]._featureFilter.filter(new ht(this.zoom),A,n))continue;const P=u?l.evaluate(A,{},n):void 0,M={id:_,properties:f.properties,type:f.type,sourceLayerIndex:b,index:x,geometry:w?A.geometry:ns(f),patterns:{},sortKey:P};d.push(M)}u&&d.sort((f,_)=>f.sortKey-_.sortKey);for(const f of d){const{geometry:_,index:x,sourceLayerIndex:b}=f;if(this.hasPattern){const w=Jl("line",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,_,x,n,{});r.featureIndex.insert(e[x].feature,_,x,b,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,n)}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,Wu)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Gu),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.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,n,l,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(e,{}),_=d.get("line-cap"),x=d.get("line-miter-limit"),b=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const w of r)this.addLine(w,e,f,_,x,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,u,l)}addLine(e,r,n,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $=0;$=2&&e[_-1].equals(e[_-2]);)_--;let x=0;for(;x<_-1&&e[x].equals(e[x+1]);)x++;if(_<(f?3:2))return;n==="bevel"&&(u=1.05);const b=this.overscaling<=16?15*He/(512*this.overscaling):0,w=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let A,P,M,L,V;this.e1=this.e2=-1,f&&(A=e[_-2],V=e[x].sub(A)._unit()._perp());for(let $=x;$<_;$++){if(M=$===_-1?f?e[x+1]:void 0:e[$+1],M&&e[$].equals(M))continue;V&&(L=V),A&&(P=A),A=e[$],V=M?M.sub(A)._unit()._perp():L,L=L||V;let Y=L.add(V);Y.x===0&&Y.y===0||Y._unit();const j=L.x*V.x+L.y*V.y,W=Y.x*V.x+Y.y*V.y,ae=W!==0?1/W:1/0,le=2*Math.sqrt(2-2*W),we=W0;if(we&&$>x){const me=A.dist(P);if(me>2*b){const Ae=A.sub(A.sub(P)._mult(b/me)._round());this.updateDistance(P,Ae),this.addCurrentVertex(Ae,L,0,0,w),P=Ae}}const be=P&&M;let ve=be?n:f?"butt":l;if(be&&ve==="round"&&(aeu&&(ve="bevel"),ve==="bevel"&&(ae>2&&(ve="flipbevel"),ae100)Y=V.mult(-1);else{const me=ae*L.add(V).mag()/L.sub(V).mag();Y._perp()._mult(me*(Ce?-1:1))}this.addCurrentVertex(A,Y,0,0,w),this.addCurrentVertex(A,Y.mult(-1),0,0,w)}else if(ve==="bevel"||ve==="fakeround"){const me=-Math.sqrt(ae*ae-1),Ae=Ce?me:0,ye=Ce?0:me;if(P&&this.addCurrentVertex(A,L,Ae,ye,w),ve==="fakeround"){const pe=Math.round(180*le/Math.PI/20);for(let ze=1;ze2*b){const Ae=A.add(M.sub(A)._mult(b/me)._round());this.updateDistance(A,Ae),this.addCurrentVertex(Ae,V,0,0,w),A=Ae}}}}addCurrentVertex(e,r,n,l,u,d=!1){const f=r.y*l-r.x,_=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*n,r.y-r.x*n,d,!1,n,u),this.addHalfVertex(e,f,_,d,!0,-l,u),this.distance>Jc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,n,l,u,d))}addHalfVertex({x:e,y:r},n,l,u,d,f,_){const x=.5*(this.lineClips?this.scaledDistance*(Jc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*n)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const b=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,b),_.primitiveLength++),d?this.e2=b:this.e1=b}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let Qc,eh;Ie("LineBucket",ic,{omit:["layers","patternFeatures"]});var th={get paint(){return eh=eh||new hi({"line-opacity":new ke(se.paint_line["line-opacity"]),"line-color":new ke(se.paint_line["line-color"]),"line-translate":new Me(se.paint_line["line-translate"]),"line-translate-anchor":new Me(se.paint_line["line-translate-anchor"]),"line-width":new ke(se.paint_line["line-width"]),"line-gap-width":new ke(se.paint_line["line-gap-width"]),"line-offset":new ke(se.paint_line["line-offset"]),"line-blur":new ke(se.paint_line["line-blur"]),"line-dasharray":new Oa(se.paint_line["line-dasharray"]),"line-pattern":new ts(se.paint_line["line-pattern"]),"line-gradient":new cn(se.paint_line["line-gradient"])})},get layout(){return Qc=Qc||new hi({"line-cap":new Me(se.layout_line["line-cap"]),"line-join":new ke(se.layout_line["line-join"]),"line-miter-limit":new Me(se.layout_line["line-miter-limit"]),"line-round-limit":new Me(se.layout_line["line-round-limit"]),"line-sort-key":new ke(se.layout_line["line-sort-key"])})}};class Yu extends ke{possiblyEvaluate(e,r){return r=new ht(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,n,l){return r=Mi({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,l)}}let ul;class Ju extends $i{constructor(e){super(e,th),this.gradientVersion=0,ul||(ul=new Yu(th.paint.properties["line-width"].specification),ul.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(n){return n._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof xs,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=ul.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new ic(e)}queryRadius(e){const r=e,n=ih(Ja("line-width",this,r),Ja("line-gap-width",this,r)),l=Ja("line-offset",this,r);return n/2+Math.abs(l)+sl(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,n,l,u,d,f){const _=nl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),x=f/2*ih(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),b=this.paint.get("line-offset").evaluate(r,n);return b&&(l=function(w,A){const P=[];for(let M=0;M=3){for(let V=0;V0?e+2*i:i}const Qu=It([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),ed=It([{name:"a_projected_pos",components:3,type:"Float32"}],4);It([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const td=It([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);It([{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"}]);const rh=It([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),id=It([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function rd(i,e,r){return i.sections.forEach(n=>{n.text=function(l,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),es.applyArabicShaping&&(l=es.applyArabicShaping(l)),l}(n.text,e,r)}),i}It([{name:"triangle",components:3,type:"Uint16"}]),It([{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"}]),It([{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"}]),It([{type:"Float32",name:"offsetX"}]),It([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),It([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const oo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var zt=24,sh=rt,nh=function(i,e,r,n,l){var u,d,f=8*l-n-1,_=(1<>1,b=-7,w=l-1,A=-1,P=i[e+w];for(w+=A,u=P&(1<<-b)-1,P>>=-b,b+=f;b>0;u=256*u+i[e+w],w+=A,b-=8);for(d=u&(1<<-b)-1,u>>=-b,b+=n;b>0;d=256*d+i[e+w],w+=A,b-=8);if(u===0)u=1-x;else{if(u===_)return d?NaN:1/0*(P?-1:1);d+=Math.pow(2,n),u-=x}return(P?-1:1)*d*Math.pow(2,u-n)},ah=function(i,e,r,n,l,u){var d,f,_,x=8*u-l-1,b=(1<>1,A=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=0,M=1,L=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,d=b):(d=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-d))<1&&(d--,_*=2),(e+=d+w>=1?A/_:A*Math.pow(2,1-w))*_>=2&&(d++,_/=2),d+w>=b?(f=0,d=b):d+w>=1?(f=(e*_-1)*Math.pow(2,l),d+=w):(f=e*Math.pow(2,w-1)*Math.pow(2,l),d=0));l>=8;i[r+P]=255&f,P+=M,f/=256,l-=8);for(d=d<0;i[r+P]=255&d,P+=M,d/=256,x-=8);i[r+P-M]|=128*L};function rt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}rt.Varint=0,rt.Fixed64=1,rt.Bytes=2,rt.Fixed32=5;var rc=4294967296,oh=1/rc,lh=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function ls(i){return i.type===rt.Bytes?i.readVarint()+i.pos:i.pos+1}function Jn(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function ch(i,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var l=r.pos-1;l>=i;l--)r.buf[l+n]=r.buf[l]}function sd(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function hh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}rt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos>3,u=this.pos;this.type=7&n,i(l,e,this),this.pos===u&&this.skip(n)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=dl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=hh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=dl(this.buf,this.pos)+dl(this.buf,this.pos+4)*rc;return this.pos+=8,i},readSFixed64:function(){var i=dl(this.buf,this.pos)+hh(this.buf,this.pos+4)*rc;return this.pos+=8,i},readFloat:function(){var i=nh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=nh(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(l,u,d){var f,_,x=d.buf;if(f=(112&(_=x[d.pos++]))>>4,_<128||(f|=(127&(_=x[d.pos++]))<<3,_<128)||(f|=(127&(_=x[d.pos++]))<<10,_<128)||(f|=(127&(_=x[d.pos++]))<<17,_<128)||(f|=(127&(_=x[d.pos++]))<<24,_<128)||(f|=(1&(_=x[d.pos++]))<<31,_<128))return Jn(l,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&lh?function(r,n,l){return lh.decode(r.subarray(n,l))}(this.buf,e,i):function(r,n,l){for(var u="",d=n;d239?4:b>223?3:b>191?2:1;if(d+A>l)break;A===1?b<128&&(w=b):A===2?(192&(f=r[d+1]))==128&&(w=(31&b)<<6|63&f)<=127&&(w=null):A===3?(_=r[d+2],(192&(f=r[d+1]))==128&&(192&_)==128&&((w=(15&b)<<12|(63&f)<<6|63&_)<=2047||w>=55296&&w<=57343)&&(w=null)):A===4&&(_=r[d+2],x=r[d+3],(192&(f=r[d+1]))==128&&(192&_)==128&&(192&x)==128&&((w=(15&b)<<18|(63&f)<<12|(63&_)<<6|63&x)<=65535||w>=1114112)&&(w=null)),w===null?(w=65533,A=1):w>65535&&(w-=65536,u+=String.fromCharCode(w>>>10&1023|55296),w=56320|1023&w),u+=String.fromCharCode(w),d+=A}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==rt.Bytes)return i.push(this.readVarint(e));var r=ls(this);for(i=i||[];this.pos127;);else if(e===rt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===rt.Fixed32)this.pos+=4;else{if(e!==rt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,r){var n,l;if(e>=0?(n=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(n,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(n,l,u){for(var d,f,_=0;_55295&&d<57344){if(!f){d>56319||_+1===l.length?(n[u++]=239,n[u++]=191,n[u++]=189):f=d;continue}if(d<56320){n[u++]=239,n[u++]=191,n[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(n[u++]=239,n[u++]=191,n[u++]=189,f=null);d<128?n[u++]=d:(d<2048?n[u++]=d>>6|192:(d<65536?n[u++]=d>>12|224:(n[u++]=d>>18|240,n[u++]=d>>12&63|128),n[u++]=d>>6&63|128),n[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&ch(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),ah(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),ah(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&ch(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(i,e,r){this.writeTag(i,rt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,sd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,nd,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,ld,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,ad,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,od,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,cd,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,hd,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,ud,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,dd,e)},writeBytesField:function(i,e){this.writeTag(i,rt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,rt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,rt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,rt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,rt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,rt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,rt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,rt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,rt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,rt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var sc=Ei(sh);const nc=3;function pd(i,e,r){i===1&&r.readMessage(fd,e)}function fd(i,e,r){if(i===3){const{id:n,bitmap:l,width:u,height:d,left:f,top:_,advance:x}=r.readMessage(md,{});e.push({id:n,bitmap:new eo({width:u+2*nc,height:d+2*nc},l),metrics:{width:u,height:d,left:f,top:_,advance:x}})}}function md(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const uh=nc;function dh(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,u=0;for(const d of i)for(let f=n.length-1;f>=0;f--){const _=n[f];if(!(d.w>_.w||d.h>_.h)){if(d.x=_.x,d.y=_.y,u=Math.max(u,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===_.w&&d.h===_.h){const x=n.pop();f=0&&n>=e&&fl[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const n=new ea;return n.text=this.text.substring(e,r),n.sectionIndex=this.sectionIndex.slice(e,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(co.forText(e.scale,e.fontStack||r));const n=this.sections.length-1;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function pl(i,e,r,n,l,u,d,f,_,x,b,w,A,P,M,L){const V=ea.fromFeature(i,l);let $;w===k.ah.vertical&&V.verticalizePunctuation();const{processBidirectionalText:Y,processStyledBidirectionalText:j}=es;if(Y&&V.sections.length===1){$=[];const le=Y(V.toString(),oc(V,x,u,e,n,P,M));for(const we of le){const Ce=new ea;Ce.text=we,Ce.sections=V.sections;for(let be=0;be0&&hs>Ai&&(Ai=hs)}else{const Hi=Ce[Xe.fontStack],Pi=Hi&&Hi[Kt];if(Pi&&Pi.rect)mr=Pi.rect,or=Pi.metrics;else{const hs=we[Xe.fontStack],mo=hs&&hs[Kt];if(!mo)continue;or=mo.metrics}Bt=(Lt-Xe.scale)*zt}lr?(le.verticalizable=!0,ti.push({glyph:Kt,imageName:gr,x:dt,y:ft+Bt,vertical:lr,scale:Xe.scale,fontStack:Xe.fontStack,sectionIndex:ii,metrics:or,rect:mr}),dt+=cs*Xe.scale+ze):(ti.push({glyph:Kt,imageName:gr,x:dt,y:ft+Bt,vertical:lr,scale:Xe.scale,fontStack:Xe.fontStack,sectionIndex:ii,metrics:or,rect:mr}),dt+=or.advance*Xe.scale+ze)}ti.length!==0&&(kt=Math.max(dt-ze,kt),yd(ti,0,ti.length-1,pi,Ai)),dt=0;const Ci=me*Lt+Ai;gi.lineOffset=Math.max(Ai,ei),ft+=Ci,Ri=Math.max(Ci,Ri),++Et}var jt;const Xt=ft-lo,{horizontalAlign:fi,verticalAlign:mi}=lc(Ae);(function(Dt,Lt,ei,gi,ti,Ai,Ci,Rt,Xe){const ii=(Lt-ei)*ti;let Kt=0;Kt=Ai!==Ci?-Rt*gi-lo:(-gi*Xe+.5)*Ci;for(const Bt of Dt)for(const or of Bt.positionedGlyphs)or.x+=ii,or.y+=Kt})(le.positionedLines,pi,fi,mi,kt,Ri,me,Xt,ve.length),le.top+=-mi*Xt,le.bottom=le.top+Xt,le.left+=-fi*kt,le.right=le.left+kt}(ae,e,r,n,$,d,f,_,w,x,A,L),!function(le){for(const we of le)if(we.positionedGlyphs.length!==0)return!1;return!0}(W)&&ae}const fl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},gd={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function fh(i,e,r,n,l,u){if(e.imageName){const d=n[e.imageName];return d?d.displaySize[0]*e.scale*zt/u+l:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+l:0}}function mh(i,e,r,n){const l=Math.pow(i-e,2);return n?i=0;let b=0;for(let A=0;Ad.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=jl([]),this.placementViewportMatrix=jl([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=xh(this.zoom,r["text-size"]),this.iconSizeData=xh(this.zoom,r["icon-size"]);const n=this.layers[0].layout,l=n.get("symbol-sort-key"),u=n.get("symbol-z-order");this.canOverlap=cc(n,"text-overlap","text-allow-overlap")!=="never"||cc(n,"icon-overlap","icon-allow-overlap")!=="never"||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,n.get("symbol-placement")==="point"&&(this.writingModes=n.get("text-writing-mode").map(d=>k.ah[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new uc(new pt(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new uc(new pt(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new o,this.lineVertexArray=new h,this.symbolInstances=new a,this.textAnchorOffsets=new g}calculateGlyphDependencies(e,r,n,l,u){for(let d=0;d0)&&(d.value.kind!=="constant"||d.value.value.length>0),b=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,w=u.get("symbol-sort-key");if(this.features=[],!x&&!b)return;const A=r.iconDependencies,P=r.glyphDependencies,M=r.availableImages,L=new ht(this.zoom);for(const{feature:V,id:$,index:Y,sourceLayerIndex:j}of e){const W=l._featureFilter.needGeometry,ae=as(V,W);if(!l._featureFilter.filter(L,ae,n))continue;let le,we;if(W||(ae.geometry=ns(V)),x){const be=l.getValueAndResolveTokens("text-field",ae,n,M),ve=vi.factory(be),me=this.hasRTLText=this.hasRTLText||wd(ve);(!me||es.getRTLTextPluginStatus()==="unavailable"||me&&es.isParsed())&&(le=rd(ve,l,ae))}if(b){const be=l.getValueAndResolveTokens("icon-image",ae,n,M);we=be instanceof ki?be:ki.fromString(be)}if(!le&&!we)continue;const Ce=this.sortFeaturesByKey?w.evaluate(ae,{},n):void 0;if(this.features.push({id:$,text:le,icon:we,index:Y,sourceLayerIndex:j,geometry:ae.geometry,properties:V.properties,type:vd[V.type],sortKey:Ce}),we&&(A[we.name]=!0),le){const be=d.evaluate(ae,{},n).join(","),ve=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(k.ah.vertical)>=0;for(const me of le.sections)if(me.image)A[me.image.name]=!0;else{const Ae=on(le.toString()),ye=me.fontStack||be,pe=P[ye]=P[ye]||{};this.calculateGlyphDependencies(me.text,pe,ve,this.allowVerticalPlacement,Ae)}}}u.get("symbol-placement")==="line"&&(this.features=function(V){const $={},Y={},j=[];let W=0;function ae(be){j.push(V[be]),W++}function le(be,ve,me){const Ae=Y[be];return delete Y[be],Y[ve]=Ae,j[Ae].geometry[0].pop(),j[Ae].geometry[0]=j[Ae].geometry[0].concat(me[0]),Ae}function we(be,ve,me){const Ae=$[ve];return delete $[ve],$[be]=Ae,j[Ae].geometry[0].shift(),j[Ae].geometry[0]=me[0].concat(j[Ae].geometry[0]),Ae}function Ce(be,ve,me){const Ae=me?ve[0][ve[0].length-1]:ve[0][0];return`${be}:${Ae.x}:${Ae.y}`}for(let be=0;bebe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((V,$)=>V.sortKey-$.sortKey)}update(e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,n))}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,r){const n=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const d={};for(let f=e.segment+1;f=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f0}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,r){const n=e.placedSymbolArray.get(r),l=n.vertexStartIndex+4*n.numGlyphs;for(let u=n.vertexStartIndex;ul[f]-l[_]||u[_]-u[f]),d}addToSortKeyRanges(e,r){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,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(const r of this.symbolInstanceIndexes){const n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((l,u,d)=>{l>=0&&d.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let vh,bh;Ie("SymbolBucket",ta,{omit:["layers","collisionBoxArray","features","compareText"]}),ta.MAX_GLYPHS=65535,ta.addDynamicAttributes=hc;var pc={get paint(){return bh=bh||new hi({"icon-opacity":new ke(se.paint_symbol["icon-opacity"]),"icon-color":new ke(se.paint_symbol["icon-color"]),"icon-halo-color":new ke(se.paint_symbol["icon-halo-color"]),"icon-halo-width":new ke(se.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ke(se.paint_symbol["icon-halo-blur"]),"icon-translate":new Me(se.paint_symbol["icon-translate"]),"icon-translate-anchor":new Me(se.paint_symbol["icon-translate-anchor"]),"text-opacity":new ke(se.paint_symbol["text-opacity"]),"text-color":new ke(se.paint_symbol["text-color"],{runtimeType:$t,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new ke(se.paint_symbol["text-halo-color"]),"text-halo-width":new ke(se.paint_symbol["text-halo-width"]),"text-halo-blur":new ke(se.paint_symbol["text-halo-blur"]),"text-translate":new Me(se.paint_symbol["text-translate"]),"text-translate-anchor":new Me(se.paint_symbol["text-translate-anchor"])})},get layout(){return vh=vh||new hi({"symbol-placement":new Me(se.layout_symbol["symbol-placement"]),"symbol-spacing":new Me(se.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Me(se.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ke(se.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Me(se.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Me(se.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Me(se.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Me(se.layout_symbol["icon-ignore-placement"]),"icon-optional":new Me(se.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Me(se.layout_symbol["icon-rotation-alignment"]),"icon-size":new ke(se.layout_symbol["icon-size"]),"icon-text-fit":new Me(se.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Me(se.layout_symbol["icon-text-fit-padding"]),"icon-image":new ke(se.layout_symbol["icon-image"]),"icon-rotate":new ke(se.layout_symbol["icon-rotate"]),"icon-padding":new ke(se.layout_symbol["icon-padding"]),"icon-keep-upright":new Me(se.layout_symbol["icon-keep-upright"]),"icon-offset":new ke(se.layout_symbol["icon-offset"]),"icon-anchor":new ke(se.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Me(se.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Me(se.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Me(se.layout_symbol["text-rotation-alignment"]),"text-field":new ke(se.layout_symbol["text-field"]),"text-font":new ke(se.layout_symbol["text-font"]),"text-size":new ke(se.layout_symbol["text-size"]),"text-max-width":new ke(se.layout_symbol["text-max-width"]),"text-line-height":new Me(se.layout_symbol["text-line-height"]),"text-letter-spacing":new ke(se.layout_symbol["text-letter-spacing"]),"text-justify":new ke(se.layout_symbol["text-justify"]),"text-radial-offset":new ke(se.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Me(se.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ke(se.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ke(se.layout_symbol["text-anchor"]),"text-max-angle":new Me(se.layout_symbol["text-max-angle"]),"text-writing-mode":new Me(se.layout_symbol["text-writing-mode"]),"text-rotate":new ke(se.layout_symbol["text-rotate"]),"text-padding":new Me(se.layout_symbol["text-padding"]),"text-keep-upright":new Me(se.layout_symbol["text-keep-upright"]),"text-transform":new ke(se.layout_symbol["text-transform"]),"text-offset":new ke(se.layout_symbol["text-offset"]),"text-allow-overlap":new Me(se.layout_symbol["text-allow-overlap"]),"text-overlap":new Me(se.layout_symbol["text-overlap"]),"text-ignore-placement":new Me(se.layout_symbol["text-ignore-placement"]),"text-optional":new Me(se.layout_symbol["text-optional"])})}};class wh{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:Gr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.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}}Ie("FormatSectionOverride",wh,{omit:["defaultValue"]});class gl extends $i{constructor(e){super(e,pc)}recalculate(e,r){if(super.recalculate(e,r),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"){const n=this.layout.get("text-writing-mode");if(n){const l=[];for(const u of n)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,n,l){const u=this.layout.get(e).evaluate(r,{},n,l),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||ot(d.value)||!u?u:function(f,_){return _.replace(/{([^{}]+)}/g,(x,b)=>f&&b in f?String(f[b]):"")}(r.properties,u)}createBucket(e){return new ta(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of pc.paint.overridableProperties){if(!gl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),n=new wh(r),l=new rn(n,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new As("source",l):new kn("composite",l,r.value.zoomStops),this.paint._values[e]=new Ni(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&gl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const n=e.get("text-field"),l=pc.paint.properties[r];let u=!1;const d=f=>{for(const _ of f)if(l.overrides&&l.overrides.hasOverride(_))return void(u=!0)};if(n.value.kind==="constant"&&n.value.value instanceof vi)d(n.value.value.sections);else if(n.value.kind==="source"){const f=x=>{u||(x instanceof Hr&&Ct(x.value)===dr?d(x.value.sections):x instanceof zn?d(x.sections):x.eachChild(f))},_=n.value;_._styleExpression&&f(_._styleExpression.expression)}return u}}let Th;var Td={get paint(){return Th=Th||new hi({"background-color":new Me(se.paint_background["background-color"]),"background-pattern":new Oa(se.paint_background["background-pattern"]),"background-opacity":new Me(se.paint_background["background-opacity"])})}};class Sd extends $i{constructor(e){super(e,Td)}}let Sh;var Id={get paint(){return Sh=Sh||new hi({"raster-opacity":new Me(se.paint_raster["raster-opacity"]),"raster-hue-rotate":new Me(se.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Me(se.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Me(se.paint_raster["raster-brightness-max"]),"raster-saturation":new Me(se.paint_raster["raster-saturation"]),"raster-contrast":new Me(se.paint_raster["raster-contrast"]),"raster-resampling":new Me(se.paint_raster["raster-resampling"]),"raster-fade-duration":new Me(se.paint_raster["raster-fade-duration"])})}};class Ad extends $i{constructor(e){super(e,Id)}}class Cd extends $i{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.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 Pd{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const fc=63710088e-1;class Ns{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ns(Or(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,n=this.lat*r,l=e.lat*r,u=Math.sin(n)*Math.sin(l)+Math.cos(n)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return fc*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof Ns)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ns(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Ns(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: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Ih=2*Math.PI*fc;function Ah(i){return Ih*Math.cos(i*Math.PI/180)}function Ch(i){return(180+i)/360}function Ph(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Eh(i,e){return i/Ah(e)}function mc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class _l{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){const n=Ns.convert(e);return new _l(Ch(n.lng),Ph(n.lat),Eh(r,n.lat))}toLngLat(){return new Ns(360*this.x-180,mc(this.y))}toAltitude(){return this.z*Ah(mc(this.y))}meterInMercatorCoordinateUnits(){return 1/Ih*(e=mc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Mh(i,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[i*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class gc{constructor(e,r,n){if(e<0||e>25||n<0||n>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${n}, 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=r,this.y=n,this.key=uo(0,e,e,r,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,n){const l=(d=this.y,f=this.z,_=Mh(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),x=Mh(256*(u+1),256*(d+1),f),_[0]+","+_[1]+","+x[0]+","+x[1]);var u,d,f,_,x;const b=function(w,A,P){let M,L="";for(let V=w;V>0;V--)M=1<1?"@2x":"").replace(/{quadkey}/g,b).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new xe((e.x*r-this.x)*He,(e.y*r-this.y)*He)}toString(){return`${this.z}/${this.x}/${this.y}`}}class zh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=uo(e,r.z,r.z,r.x,r.y)}}class Gi{constructor(e,r,n,l,u){if(e= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new gc(n,+l,+u),this.key=uo(r,e,n,l,u)}clone(){return new Gi(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}`);const r=this.canonical.z-e;return e>this.canonical.z?new Gi(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Gi(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-e;return e>this.canonical.z?uo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):uo(this.wrap*+r,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Gi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,n=2*this.canonical.x,l=2*this.canonical.y;return[new Gi(r,this.wrap,r,n,l),new Gi(r,this.wrap,r,n+1,l),new Gi(r,this.wrap,r,n,l+1),new Gi(r,this.wrap,r,n+1,l+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=w),w=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,n){return e*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}getPixels(){return new Zi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,d=n*this.dim,f=n*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(n){case-1:d=f-1;break;case 1:f=d+1}const _=-r*this.dim,x=-n*this.dim;for(let b=d;b=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 Lh{constructor(e,r,n,l,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=n,e._y=l,this.properties=e.properties,this.id=u}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class Rh{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new pr(He,16,0),this.grid3D=new pr(He,16,0),this.featureIndexArray=new v,this.promoteId=r}insert(e,r,n,l,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,l,u);const _=d?this.grid3D:this.grid;for(let x=0;x=0&&w[3]>=0&&_.insert(f,w[0],w[1],w[2],w[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Os.VectorTile(new sc(this.rawTileData)).layers,this.sourceLayerCoder=new Dh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,n,l){this.loadVTLayers();const u=e.params||{},d=He/e.tileSize/e.scale,f=Rn(u.filter),_=e.queryGeometry,x=e.queryPadding*d,b=Fh(_),w=this.grid.query(b.minX-x,b.minY-x,b.maxX+x,b.maxY+x),A=Fh(e.cameraQueryGeometry),P=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(V,$,Y,j)=>function(W,ae,le,we,Ce){for(const ve of W)if(ae<=ve.x&&le<=ve.y&&we>=ve.x&&Ce>=ve.y)return!0;const be=[new xe(ae,le),new xe(ae,Ce),new xe(we,Ce),new xe(we,le)];if(W.length>2){for(const ve of be)if(Wn(W,ve))return!0}for(let ve=0;ve(j||(j=ns(W)),ae.queryIntersectsFeature(_,W,le,j,this.z,e.transform,d,e.pixelPosMatrix)))}return M}loadMatchingFeature(e,r,n,l,u,d,f,_,x,b,w){const A=this.bucketLayerIDs[r];if(d&&!function(V,$){for(let Y=0;Y=0)return!0;return!1}(d,A))return;const P=this.sourceLayerCoder.decode(n),M=this.vtLayers[P].feature(l);if(u.needGeometry){const V=as(M,!0);if(!u.filter(new ht(this.tileID.overscaledZ),V,this.tileID.canonical))return}else if(!u.filter(new ht(this.tileID.overscaledZ),M))return;const L=this.getId(M,P);for(let V=0;V{const f=e instanceof ln?e.get(d):null;return f&&f.evaluate?f.evaluate(r,n,l):f})}function Fh(i){let e=1/0,r=1/0,n=-1/0,l=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),n=Math.max(n,u.x),l=Math.max(l,u.y);return{minX:e,minY:r,maxX:n,maxY:l}}function Ed(i,e){return e-i}function Oh(i,e,r,n,l){const u=[];for(let d=0;d=n&&w.x>=n||(b.x>=n?b=new xe(n,b.y+(n-b.x)/(w.x-b.x)*(w.y-b.y))._round():w.x>=n&&(w=new xe(n,b.y+(n-b.x)/(w.x-b.x)*(w.y-b.y))._round()),b.y>=l&&w.y>=l||(b.y>=l?b=new xe(b.x+(l-b.y)/(w.y-b.y)*(w.x-b.x),l)._round():w.y>=l&&(w=new xe(b.x+(l-b.y)/(w.y-b.y)*(w.x-b.x),l)._round()),_&&b.equals(_[_.length-1])||(_=[b],u.push(_)),_.push(w)))))}}return u}Ie("FeatureIndex",Rh,{omit:["rawTileData","sourceLayerCoder"]});class $s extends xe{constructor(e,r,n,l){super(e,r),this.angle=n,l!==void 0&&(this.segment=l)}clone(){return new $s(this.x,this.y,this.angle,this.segment)}}function Vh(i,e,r,n,l){if(e.segment===void 0||r===0)return!0;let u=e,d=e.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const _=[];let x=0;for(;fn;)x-=_.shift().angleDelta;if(x>l)return!1;d++,f+=b.dist(w)}return!0}function Uh(i){let e=0;for(let r=0;rx){const M=(x-_)/P,L=wi.number(w.x,A.x,M),V=wi.number(w.y,A.y,M),$=new $s(L,V,A.angleTo(w),b);return $._round(),!d||Vh(i,$,f,d,e)?$:void 0}_+=P}}function zd(i,e,r,n,l,u,d,f,_){const x=Nh(n,u,d),b=$h(n,l),w=b*d,A=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-w=0&&W<_&&ae>=0&&ae<_&&A-x>=0&&A+x<=b){const le=new $s(W,ae,Y,M);le._round(),n&&!Vh(i,le,u,n,l)||P.push(le)}}w+=$}return f||P.length||d||(P=jh(i,w/2,r,n,l,u,d,!0,_)),P}Ie("Anchor",$s);const ia=Ii;function qh(i,e,r,n){const l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*ia,_=u.paddedRect.h-2*ia,x=i.right-i.left,b=i.bottom-i.top,w=u.stretchX||[[0,f]],A=u.stretchY||[[0,_]],P=(me,Ae)=>me+Ae[1]-Ae[0],M=w.reduce(P,0),L=A.reduce(P,0),V=f-M,$=_-L;let Y=0,j=M,W=0,ae=L,le=0,we=V,Ce=0,be=$;if(u.content&&n){const me=u.content;Y=yl(w,0,me[0]),W=yl(A,0,me[1]),j=yl(w,me[0],me[2]),ae=yl(A,me[1],me[3]),le=me[0]-Y,Ce=me[1]-W,we=me[2]-me[0]-j,be=me[3]-me[1]-ae}const ve=(me,Ae,ye,pe)=>{const ze=xl(me.stretch-Y,j,x,i.left),Ee=vl(me.fixed-le,we,me.stretch,M),Ge=xl(Ae.stretch-W,ae,b,i.top),dt=vl(Ae.fixed-Ce,be,Ae.stretch,L),ft=xl(ye.stretch-Y,j,x,i.left),kt=vl(ye.fixed-le,we,ye.stretch,M),Ri=xl(pe.stretch-W,ae,b,i.top),pi=vl(pe.fixed-Ce,be,pe.stretch,L),Et=new xe(ze,Ge),jt=new xe(ft,Ge),Xt=new xe(ft,Ri),fi=new xe(ze,Ri),mi=new xe(Ee/d,dt/d),Dt=new xe(kt/d,pi/d),Lt=e*Math.PI/180;if(Lt){const ti=Math.sin(Lt),Ai=Math.cos(Lt),Ci=[Ai,-ti,ti,Ai];Et._matMult(Ci),jt._matMult(Ci),fi._matMult(Ci),Xt._matMult(Ci)}const ei=me.stretch+me.fixed,gi=Ae.stretch+Ae.fixed;return{tl:Et,tr:jt,bl:fi,br:Xt,tex:{x:u.paddedRect.x+ia+ei,y:u.paddedRect.y+ia+gi,w:ye.stretch+ye.fixed-ei,h:pe.stretch+pe.fixed-gi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:mi,pixelOffsetBR:Dt,minFontScaleX:we/d/x,minFontScaleY:be/d/b,isSDF:r}};if(n&&(u.stretchX||u.stretchY)){const me=Zh(w,V,M),Ae=Zh(A,$,L);for(let ye=0;ye0&&(M=Math.max(10,M),this.circleDiameter=M)}else{let w=d.top*f-_[0],A=d.bottom*f+_[2],P=d.left*f-_[3],M=d.right*f+_[1];const L=d.collisionPadding;if(L&&(P-=L[0]*f,w-=L[1]*f,M+=L[2]*f,A+=L[3]*f),b){const V=new xe(P,w),$=new xe(M,w),Y=new xe(P,A),j=new xe(M,A),W=b*Math.PI/180;V._rotate(W),$._rotate(W),Y._rotate(W),j._rotate(W),P=Math.min(V.x,$.x,Y.x,j.x),M=Math.max(V.x,$.x,Y.x,j.x),w=Math.min(V.y,$.y,Y.y,j.y),A=Math.max(V.y,$.y,Y.y,j.y)}e.emplaceBack(r.x,r.y,P,w,M,A,n,l,u)}this.boxEndIndex=e.length}}class kd{constructor(e=[],r=Dd){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:n}=this,l=r[e];for(;e>0;){const u=e-1>>1,d=r[u];if(n(l,d)>=0)break;r[e]=d,e=u}r[e]=l}_down(e){const{data:r,compare:n}=this,l=this.length>>1,u=r[e];for(;e=0)break;r[e]=f,e=d}r[e]=u}}function Dd(i,e){return ie?1:0}function Ld(i,e=1,r=!1){let n=1/0,l=1/0,u=-1/0,d=-1/0;const f=i[0];for(let P=0;Pu)&&(u=M.x),(!P||M.y>d)&&(d=M.y)}const _=Math.min(u-n,d-l);let x=_/2;const b=new kd([],Rd);if(_===0)return new xe(n,l);for(let P=n;Pw.d||!w.d)&&(w=P,r&&console.log("found best %d after %d probes",Math.round(1e4*P.d)/1e4,A)),P.max-w.d<=e||(x=P.h/2,b.push(new ra(P.p.x-x,P.p.y-x,x,i)),b.push(new ra(P.p.x+x,P.p.y-x,x,i)),b.push(new ra(P.p.x-x,P.p.y+x,x,i)),b.push(new ra(P.p.x+x,P.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${w.d}`)),w.p}function Rd(i,e){return e.max-i.max}function ra(i,e,r,n){this.p=new xe(i,e),this.h=r,this.d=function(l,u){let d=!1,f=1/0;for(let _=0;_l.y!=M.y>l.y&&l.x<(M.x-P.x)*(l.y-P.y)/(M.y-P.y)+P.x&&(d=!d),f=Math.min(f,Pc(l,P,M))}}return(d?1:-1)*Math.sqrt(f)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var Wt;k.ap=void 0,(Wt=k.ap||(k.ap={}))[Wt.center=1]="center",Wt[Wt.left=2]="left",Wt[Wt.right=3]="right",Wt[Wt.top=4]="top",Wt[Wt.bottom=5]="bottom",Wt[Wt["top-left"]=6]="top-left",Wt[Wt["top-right"]=7]="top-right",Wt[Wt["bottom-left"]=8]="bottom-left",Wt[Wt["bottom-right"]=9]="bottom-right";const js=7,_c=Number.POSITIVE_INFINITY;function Gh(i,e){return e[1]!==_c?function(r,n,l){let u=0,d=0;switch(n=Math.abs(n),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-js;break;case"bottom-right":case"bottom-left":case"bottom":d=-l+js}switch(r){case"top-right":case"bottom-right":case"right":u=-n;break;case"top-left":case"bottom-left":case"left":u=n}return[u,d]}(i,e[0],e[1]):function(r,n){let l=0,u=0;n<0&&(n=0);const d=n/Math.SQRT2;switch(r){case"top-right":case"top-left":u=d-js;break;case"bottom-right":case"bottom-left":u=-d+js;break;case"bottom":u=-n+js;break;case"top":u=n-js}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=n;break;case"right":l=-n}return[l,u]}(i,e[0])}function Hh(i,e,r){var n;const l=i.layout,u=(n=l.get("text-variable-anchor-offset"))===null||n===void 0?void 0:n.evaluate(e,{},r);if(u){const f=u.values,_=[];for(let x=0;xA*zt);b.startsWith("top")?w[1]-=js:b.startsWith("bottom")&&(w[1]+=js),_[x+1]=w}return new Gt(_)}const d=l.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(e,{},r)*zt,_c]:l.get("text-offset").evaluate(e,{},r).map(x=>x*zt);const _=[];for(const x of d)_.push(x,Gh(x,f));return new Gt(_)}return null}function yc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Bd(i,e,r,n,l,u,d,f,_,x,b){let w=u.textMaxSize.evaluate(e,{});w===void 0&&(w=d);const A=i.layers[0].layout,P=A.get("icon-offset").evaluate(e,{},b),M=Xh(r.horizontal),L=d/24,V=i.tilePixelRatio*L,$=i.tilePixelRatio*w/24,Y=i.tilePixelRatio*f,j=i.tilePixelRatio*A.get("symbol-spacing"),W=A.get("text-padding")*i.tilePixelRatio,ae=function(pe,ze,Ee,Ge=1){const dt=pe.get("icon-padding").evaluate(ze,{},Ee),ft=dt&&dt.values;return[ft[0]*Ge,ft[1]*Ge,ft[2]*Ge,ft[3]*Ge]}(A,e,b,i.tilePixelRatio),le=A.get("text-max-angle")/180*Math.PI,we=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",Ce=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",be=A.get("symbol-placement"),ve=j/2,me=A.get("icon-text-fit");let Ae;n&&me!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ae=yh(n,r.vertical,me,A.get("icon-text-fit-padding"),P,L)),M&&(n=yh(n,M,me,A.get("icon-text-fit-padding"),P,L)));const ye=(pe,ze)=>{ze.x<0||ze.x>=He||ze.y<0||ze.y>=He||function(Ee,Ge,dt,ft,kt,Ri,pi,Et,jt,Xt,fi,mi,Dt,Lt,ei,gi,ti,Ai,Ci,Rt,Xe,ii,Kt,Bt,or){const mr=Ee.addToLineVertexArray(Ge,dt);let gr,cs,lr,Hi,Pi=0,hs=0,mo=0,Qh=0,Ac=-1,Cc=-1;const us={};let eu=Ze("");if(Ee.allowVerticalPlacement&&ft.vertical){const ri=Et.layout.get("text-rotate").evaluate(Xe,{},Bt)+90;lr=new bl(jt,Ge,Xt,fi,mi,ft.vertical,Dt,Lt,ei,ri),pi&&(Hi=new bl(jt,Ge,Xt,fi,mi,pi,ti,Ai,ei,ri))}if(kt){const ri=Et.layout.get("icon-rotate").evaluate(Xe,{}),Wi=Et.layout.get("icon-text-fit")!=="none",gn=qh(kt,ri,Kt,Wi),yr=pi?qh(pi,ri,Kt,Wi):void 0;cs=new bl(jt,Ge,Xt,fi,mi,kt,ti,Ai,!1,ri),Pi=4*gn.length;const _n=Ee.iconSizeData;let Lr=null;_n.kind==="source"?(Lr=[Dr*Et.layout.get("icon-size").evaluate(Xe,{})],Lr[0]>Us&&qt(`${Ee.layerIds[0]}: Value for "icon-size" is >= ${ho}. Reduce your "icon-size".`)):_n.kind==="composite"&&(Lr=[Dr*ii.compositeIconSizes[0].evaluate(Xe,{},Bt),Dr*ii.compositeIconSizes[1].evaluate(Xe,{},Bt)],(Lr[0]>Us||Lr[1]>Us)&&qt(`${Ee.layerIds[0]}: Value for "icon-size" is >= ${ho}. Reduce your "icon-size".`)),Ee.addSymbols(Ee.icon,gn,Lr,Rt,Ci,Xe,k.ah.none,Ge,mr.lineStartIndex,mr.lineLength,-1,Bt),Ac=Ee.icon.placedSymbolArray.length-1,yr&&(hs=4*yr.length,Ee.addSymbols(Ee.icon,yr,Lr,Rt,Ci,Xe,k.ah.vertical,Ge,mr.lineStartIndex,mr.lineLength,-1,Bt),Cc=Ee.icon.placedSymbolArray.length-1)}const tu=Object.keys(ft.horizontal);for(const ri of tu){const Wi=ft.horizontal[ri];if(!gr){eu=Ze(Wi.text);const yr=Et.layout.get("text-rotate").evaluate(Xe,{},Bt);gr=new bl(jt,Ge,Xt,fi,mi,Wi,Dt,Lt,ei,yr)}const gn=Wi.positionedLines.length===1;if(mo+=Wh(Ee,Ge,Wi,Ri,Et,ei,Xe,gi,mr,ft.vertical?k.ah.horizontal:k.ah.horizontalOnly,gn?tu:[ri],us,Ac,ii,Bt),gn)break}ft.vertical&&(Qh+=Wh(Ee,Ge,ft.vertical,Ri,Et,ei,Xe,gi,mr,k.ah.vertical,["vertical"],us,Cc,ii,Bt));const Vd=gr?gr.boxStartIndex:Ee.collisionBoxArray.length,Ud=gr?gr.boxEndIndex:Ee.collisionBoxArray.length,Nd=lr?lr.boxStartIndex:Ee.collisionBoxArray.length,$d=lr?lr.boxEndIndex:Ee.collisionBoxArray.length,jd=cs?cs.boxStartIndex:Ee.collisionBoxArray.length,qd=cs?cs.boxEndIndex:Ee.collisionBoxArray.length,Zd=Hi?Hi.boxStartIndex:Ee.collisionBoxArray.length,Gd=Hi?Hi.boxEndIndex:Ee.collisionBoxArray.length;let _r=-1;const Tl=(ri,Wi)=>ri&&ri.circleDiameter?Math.max(ri.circleDiameter,Wi):Wi;_r=Tl(gr,_r),_r=Tl(lr,_r),_r=Tl(cs,_r),_r=Tl(Hi,_r);const iu=_r>-1?1:0;iu&&(_r*=or/zt),Ee.glyphOffsetArray.length>=ta.MAX_GLYPHS&&qt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Xe.sortKey!==void 0&&Ee.addToSortKeyRanges(Ee.symbolInstances.length,Xe.sortKey);const Hd=Hh(Et,Xe,Bt),[Wd,Xd]=function(ri,Wi){const gn=ri.length,yr=Wi?.values;if(yr?.length>0)for(let _n=0;_n=0?us.right:-1,us.center>=0?us.center:-1,us.left>=0?us.left:-1,us.vertical||-1,Ac,Cc,eu,Vd,Ud,Nd,$d,jd,qd,Zd,Gd,Xt,mo,Qh,Pi,hs,iu,0,Dt,_r,Wd,Xd)}(i,ze,pe,r,n,l,Ae,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,V,[W,W,W,W],we,_,Y,ae,Ce,P,e,u,x,b,d)};if(be==="line")for(const pe of Oh(e.geometry,0,0,He,He)){const ze=zd(pe,j,le,r.vertical||M,n,24,$,i.overscaling,He);for(const Ee of ze)M&&Fd(i,M.text,ve,Ee)||ye(pe,Ee)}else if(be==="line-center"){for(const pe of e.geometry)if(pe.length>1){const ze=Md(pe,le,r.vertical||M,n,24,$);ze&&ye(pe,ze)}}else if(e.type==="Polygon")for(const pe of Kl(e.geometry,0)){const ze=Ld(pe,16);ye(pe[0],new $s(ze.x,ze.y,0))}else if(e.type==="LineString")for(const pe of e.geometry)ye(pe,new $s(pe[0].x,pe[0].y,0));else if(e.type==="Point")for(const pe of e.geometry)for(const ze of pe)ye([ze],new $s(ze.x,ze.y,0))}function Wh(i,e,r,n,l,u,d,f,_,x,b,w,A,P,M){const L=function(Y,j,W,ae,le,we,Ce,be){const ve=ae.layout.get("text-rotate").evaluate(we,{})*Math.PI/180,me=[];for(const Ae of j.positionedLines)for(const ye of Ae.positionedGlyphs){if(!ye.rect)continue;const pe=ye.rect||{};let ze=uh+1,Ee=!0,Ge=1,dt=0;const ft=(le||be)&&ye.vertical,kt=ye.metrics.advance*ye.scale/2;if(be&&j.verticalizable&&(dt=Ae.lineOffset/2-(ye.imageName?-(zt-ye.metrics.width*ye.scale)/2:(ye.scale-1)*zt)),ye.imageName){const Rt=Ce[ye.imageName];Ee=Rt.sdf,Ge=Rt.pixelRatio,ze=Ii/Ge}const Ri=le?[ye.x+kt,ye.y]:[0,0];let pi=le?[0,0]:[ye.x+kt+W[0],ye.y+W[1]-dt],Et=[0,0];ft&&(Et=pi,pi=[0,0]);const jt=ye.metrics.isDoubleResolution?2:1,Xt=(ye.metrics.left-ze)*ye.scale-kt+pi[0],fi=(-ye.metrics.top-ze)*ye.scale+pi[1],mi=Xt+pe.w/jt*ye.scale/Ge,Dt=fi+pe.h/jt*ye.scale/Ge,Lt=new xe(Xt,fi),ei=new xe(mi,fi),gi=new xe(Xt,Dt),ti=new xe(mi,Dt);if(ft){const Rt=new xe(-kt,kt-lo),Xe=-Math.PI/2,ii=zt/2-kt,Kt=new xe(5-lo-ii,-(ye.imageName?ii:0)),Bt=new xe(...Et);Lt._rotateAround(Xe,Rt)._add(Kt)._add(Bt),ei._rotateAround(Xe,Rt)._add(Kt)._add(Bt),gi._rotateAround(Xe,Rt)._add(Kt)._add(Bt),ti._rotateAround(Xe,Rt)._add(Kt)._add(Bt)}if(ve){const Rt=Math.sin(ve),Xe=Math.cos(ve),ii=[Xe,-Rt,Rt,Xe];Lt._matMult(ii),ei._matMult(ii),gi._matMult(ii),ti._matMult(ii)}const Ai=new xe(0,0),Ci=new xe(0,0);me.push({tl:Lt,tr:ei,bl:gi,br:ti,tex:pe,writingMode:j.writingMode,glyphOffset:Ri,sectionIndex:ye.sectionIndex,isSDF:Ee,pixelOffsetTL:Ai,pixelOffsetBR:Ci,minFontScaleX:0,minFontScaleY:0})}return me}(0,r,f,l,u,d,n,i.allowVerticalPlacement),V=i.textSizeData;let $=null;V.kind==="source"?($=[Dr*l.layout.get("text-size").evaluate(d,{})],$[0]>Us&&qt(`${i.layerIds[0]}: Value for "text-size" is >= ${ho}. Reduce your "text-size".`)):V.kind==="composite"&&($=[Dr*P.compositeTextSizes[0].evaluate(d,{},M),Dr*P.compositeTextSizes[1].evaluate(d,{},M)],($[0]>Us||$[1]>Us)&&qt(`${i.layerIds[0]}: Value for "text-size" is >= ${ho}. Reduce your "text-size".`)),i.addSymbols(i.text,L,$,f,u,d,x,e,_.lineStartIndex,_.lineLength,A,M);for(const Y of b)w[Y]=i.text.placedSymbolArray.length-1;return 4*L.length}function Xh(i){for(const e in i)return i[e];return null}function Fd(i,e,r,n){const l=i.compareText;if(e in l){const u=l[e];for(let d=u.length-1;d>=0;d--)if(n.dist(u[d])>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const u=Kh[15&n];if(!u)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new xc(f,d,u,e)}constructor(e,r=64,n=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=Kh.indexOf(this.ArrayType),d=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${n}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return vc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,n,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:f}=this,_=[0,u.length-1,0],x=[];for(;_.length;){const b=_.pop()||0,w=_.pop()||0,A=_.pop()||0;if(w-A<=f){for(let V=A;V<=w;V++){const $=d[2*V],Y=d[2*V+1];$>=e&&$<=n&&Y>=r&&Y<=l&&x.push(u[V])}continue}const P=A+w>>1,M=d[2*P],L=d[2*P+1];M>=e&&M<=n&&L>=r&&L<=l&&x.push(u[P]),(b===0?e<=M:r<=L)&&(_.push(A),_.push(P-1),_.push(1-b)),(b===0?n>=M:l>=L)&&(_.push(P+1),_.push(w),_.push(1-b))}return x}within(e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:d}=this,f=[0,l.length-1,0],_=[],x=n*n;for(;f.length;){const b=f.pop()||0,w=f.pop()||0,A=f.pop()||0;if(w-A<=d){for(let V=A;V<=w;V++)Jh(u[2*V],u[2*V+1],e,r)<=x&&_.push(l[V]);continue}const P=A+w>>1,M=u[2*P],L=u[2*P+1];Jh(M,L,e,r)<=x&&_.push(l[P]),(b===0?e-n<=M:r-n<=L)&&(f.push(A),f.push(P-1),f.push(1-b)),(b===0?e+n>=M:r+n>=L)&&(f.push(P+1),f.push(w),f.push(1-b))}return _}}function vc(i,e,r,n,l,u){if(l-n<=r)return;const d=n+l>>1;Yh(i,e,d,n,l,u),vc(i,e,r,n,d-1,1-u),vc(i,e,r,d+1,l,1-u)}function Yh(i,e,r,n,l,u){for(;l>n;){if(l-n>600){const x=l-n+1,b=r-n+1,w=Math.log(x),A=.5*Math.exp(2*w/3),P=.5*Math.sqrt(w*A*(x-A)/x)*(b-x/2<0?-1:1);Yh(i,e,r,Math.max(n,Math.floor(r-b*A/x+P)),Math.min(l,Math.floor(r+(x-b)*A/x+P)),u)}const d=e[2*r+u];let f=n,_=l;for(po(i,e,n,r),e[2*l+u]>d&&po(i,e,n,l);f<_;){for(po(i,e,f,_),f++,_--;e[2*f+u]d;)_--}e[2*n+u]===d?po(i,e,n,_):(_++,po(i,e,_,l)),_<=r&&(n=_+1),r<=_&&(l=_-1)}}function po(i,e,r,n){bc(i,r,n),bc(e,2*r,2*n),bc(e,2*r+1,2*n+1)}function bc(i,e,r){const n=i[e];i[e]=i[r],i[r]=n}function Jh(i,e,r,n){const l=i-r,u=e-n;return l*l+u*u}var wc;k.bd=void 0,(wc=k.bd||(k.bd={})).create="create",wc.load="load",wc.fullLoad="fullLoad";let wl=null,fo=[];const Tc=1e3/60,Sc="loadTime",Ic="fullLoadTime",Od={mark(i){performance.mark(i)},frame(i){const e=i;wl!=null&&fo.push(e-wl),wl=e},clearMetrics(){wl=null,fo=[],performance.clearMeasures(Sc),performance.clearMeasures(Ic);for(const i in k.bd)performance.clearMarks(k.bd[i])},getPerformanceMetrics(){performance.measure(Sc,k.bd.create,k.bd.load),performance.measure(Ic,k.bd.create,k.bd.fullLoad);const i=performance.getEntriesByName(Sc)[0].duration,e=performance.getEntriesByName(Ic)[0].duration,r=fo.length,n=1/(fo.reduce((u,d)=>u+d,0)/r/1e3),l=fo.filter(u=>u>Tc).reduce((u,d)=>u+(d-Tc)/Tc,0);return{loadTime:i,fullLoadTime:e,fps:n,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};k.$=ue,k.A=Xn,k.B=function(i){if(ds==null){const e=i.navigator?i.navigator.userAgent:null;ds=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return ds},k.C=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Pd(()=>this.process()),this.subscription=function(r,n,l,u){return r.addEventListener(n,l,!1),{unsubscribe:()=>{r.removeEventListener(n,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=hr(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((r,n)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:n},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];const f={id:l,type:"",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)},{once:!0});const u=[],d=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:Qr(i.data,u)});this.target.postMessage(d,{transfer:u})})}receive(i){const e=i.data,r=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===""){delete this.tasks[r];const n=this.abortControllers[r];return delete this.abortControllers[r],void(n&&n.abort())}if(hr(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){return p(this,void 0,void 0,function*(){if(e.type===""){const l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(e.error?l.reject(Ds(e.error)):l.resolve(Ds(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Ds(e.data),n=new AbortController;this.abortControllers[i]=n;try{const l=yield this.messageHandlers[e.type](e.sourceMapId,r,n);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,e,r){const n=[];delete this.abortControllers[i];const l={id:i,type:"",sourceMapId:this.mapId,origin:location.origin,error:e?Qr(e):null,data:Qr(r,n)};this.target.postMessage(l,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},k.D=Me,k.E=jr,k.F=function(){var i=new Xn(16);return Xn!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},k.G=Oi,k.H=function(i,e,r){var n,l,u,d,f,_,x,b,w,A,P,M,L=r[0],V=r[1],$=r[2];return e===i?(i[12]=e[0]*L+e[4]*V+e[8]*$+e[12],i[13]=e[1]*L+e[5]*V+e[9]*$+e[13],i[14]=e[2]*L+e[6]*V+e[10]*$+e[14],i[15]=e[3]*L+e[7]*V+e[11]*$+e[15]):(l=e[1],u=e[2],d=e[3],f=e[4],_=e[5],x=e[6],b=e[7],w=e[8],A=e[9],P=e[10],M=e[11],i[0]=n=e[0],i[1]=l,i[2]=u,i[3]=d,i[4]=f,i[5]=_,i[6]=x,i[7]=b,i[8]=w,i[9]=A,i[10]=P,i[11]=M,i[12]=n*L+f*V+w*$+e[12],i[13]=l*L+_*V+A*$+e[13],i[14]=u*L+x*V+P*$+e[14],i[15]=d*L+b*V+M*$+e[15]),i},k.I=ac,k.J=function(i,e,r){var n=r[0],l=r[1],u=r[2];return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=e[3]*n,i[4]=e[4]*l,i[5]=e[5]*l,i[6]=e[6]*l,i[7]=e[7]*l,i[8]=e[8]*u,i[9]=e[9]*u,i[10]=e[10]*u,i[11]=e[11]*u,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},k.K=kc,k.L=function(i,e){const r={};for(let n=0;n{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const n of i){const l=window.document.createElement("source");xn(n)||(e.crossOrigin="Anonymous"),l.src=n,e.appendChild(l)}})},k.a3=function(){return Vr++},k.a4=Qo,k.a5=ta,k.a6=Rn,k.a7=as,k.a8=ht,k.a9=Lh,k.aA=si,k.aB=function(i,e){if(!i)return[{command:"setStyle",args:[e]}];let r=[];try{if(!Ke(i.version,e.version))return[{command:"setStyle",args:[e]}];Ke(i.center,e.center)||r.push({command:"setCenter",args:[e.center]}),Ke(i.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),Ke(i.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),Ke(i.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),Ke(i.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),Ke(i.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),Ke(i.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),Ke(i.light,e.light)||r.push({command:"setLight",args:[e.light]}),Ke(i.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),Ke(i.sky,e.sky)||r.push({command:"setSky",args:[e.sky]});const n={},l=[];(function(d,f,_,x){let b;for(b in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,b)&&(Object.prototype.hasOwnProperty.call(f,b)||fs(b,_,x));for(b in f)Object.prototype.hasOwnProperty.call(f,b)&&(Object.prototype.hasOwnProperty.call(d,b)?Ke(d[b],f[b])||(d[b].type==="geojson"&&f[b].type==="geojson"&&gs(d,f,b)?Nt(_,{command:"setGeoJSONSourceData",args:[b,f[b].data]}):ms(b,f,_,x)):er(b,f,_))})(i.sources,e.sources,l,n);const u=[];i.layers&&i.layers.forEach(d=>{"source"in d&&n[d.source]?r.push({command:"removeLayer",args:[d.id]}):u.push(d)}),r=r.concat(l),function(d,f,_){f=f||[];const x=(d=d||[]).map(_s),b=f.map(_s),w=d.reduce(Hs,{}),A=f.reduce(Hs,{}),P=x.slice(),M=Object.create(null);let L,V,$,Y,j;for(let W=0,ae=0;W@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,n,l,u)=>{const d=l||u;return e[n]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},k.ab=function(i,e){const r=[];for(const n in i)n in e||r.push(n);return r},k.ac=Yi,k.ad=function(i,e,r){var n=Math.sin(r),l=Math.cos(r),u=e[0],d=e[1],f=e[2],_=e[3],x=e[4],b=e[5],w=e[6],A=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=u*l+x*n,i[1]=d*l+b*n,i[2]=f*l+w*n,i[3]=_*l+A*n,i[4]=x*l-u*n,i[5]=b*l-d*n,i[6]=w*l-f*n,i[7]=A*l-_*n,i},k.ae=function(i){var e=new Xn(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},k.af=al,k.ag=function(i,e){let r=0,n=0;if(i.kind==="constant")n=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:u,maxZoom:d}=i,f=l?Yi(Qt.interpolationFactor(l,e,u,d),0,1):0;i.kind==="camera"?n=wi.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:n}},k.ai=function(i,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:l}){return i.kind==="source"?n/Dr:i.kind==="composite"?wi.number(n/Dr,l/Dr,r):e},k.aj=hc,k.ak=function(i,e,r,n){const l=e.y-i.y,u=e.x-i.x,d=n.y-r.y,f=n.x-r.x,_=d*u-f*l;if(_===0)return null;const x=(f*(i.y-r.y)-d*(i.x-r.x))/_;return new xe(i.x+x*u,i.y+x*l)},k.al=Oh,k.am=os,k.an=jl,k.ao=zt,k.aq=cc,k.ar=function(i,e){var r=e[0],n=e[1],l=e[2],u=e[3],d=e[4],f=e[5],_=e[6],x=e[7],b=e[8],w=e[9],A=e[10],P=e[11],M=e[12],L=e[13],V=e[14],$=e[15],Y=r*f-n*d,j=r*_-l*d,W=r*x-u*d,ae=n*_-l*f,le=n*x-u*f,we=l*x-u*_,Ce=b*L-w*M,be=b*V-A*M,ve=b*$-P*M,me=w*V-A*L,Ae=w*$-P*L,ye=A*$-P*V,pe=Y*ye-j*Ae+W*me+ae*ve-le*be+we*Ce;return pe?(i[0]=(f*ye-_*Ae+x*me)*(pe=1/pe),i[1]=(l*Ae-n*ye-u*me)*pe,i[2]=(L*we-V*le+$*ae)*pe,i[3]=(A*le-w*we-P*ae)*pe,i[4]=(_*ve-d*ye-x*be)*pe,i[5]=(r*ye-l*ve+u*be)*pe,i[6]=(V*W-M*we-$*j)*pe,i[7]=(b*we-A*W+P*j)*pe,i[8]=(d*Ae-f*ve+x*Ce)*pe,i[9]=(n*ve-r*Ae-u*Ce)*pe,i[10]=(M*le-L*W+$*Y)*pe,i[11]=(w*W-b*le-P*Y)*pe,i[12]=(f*be-d*me-_*Ce)*pe,i[13]=(r*me-n*be+l*Ce)*pe,i[14]=(L*j-M*ae-V*Y)*pe,i[15]=(b*ae-w*j+A*Y)*pe,i):null},k.as=yc,k.at=lc,k.au=xc,k.av=function(){const i={},e=se.$version;for(const r in se.$root){const n=se.$root[r];if(n.required){let l=null;l=r==="version"?e:n.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},k.aw=ka,k.ax=ps,k.ay=function(i){i=i.slice();const e=Object.create(null);for(let r=0;rpe*zt)}let be=d?"center":r.get("text-justify").evaluate(x,{},i.canonical);const ve=r.get("symbol-placement"),me=ve==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*zt:0,Ae=()=>{i.bucket.allowVerticalPlacement&&on(W)&&(M.vertical=pl(L,i.glyphMap,i.glyphPositions,i.imagePositions,b,me,u,we,"left",le,$,k.ah.vertical,!0,ve,A,w))};if(!d&&Ce){const ye=new Set;if(be==="auto")for(let ze=0;zep(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(e)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),k.e=Mi,k.f=i=>new Promise((e,r)=>{const n=new Image;n.onload=()=>{e(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=Zs})},n.onerror=()=>r(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."));const l=new Blob([new Uint8Array(i)],{type:"image/png"});n.src=i.byteLength?URL.createObjectURL(l):Zs}),k.g=ur,k.h=(i,e)=>Tr(Mi(i,{type:"json"}),e),k.i=hr,k.j=Mt,k.k=Ar,k.l=(i,e)=>Tr(Mi(i,{type:"arrayBuffer"}),e),k.m=Tr,k.n=function(i){return new sc(i).readFields(pd,[])},k.o=eo,k.p=dh,k.q=hi,k.r=Ea,k.s=xn,k.t=Go,k.u=Te,k.v=se,k.w=qt,k.x=ks,k.y=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},k.z=wi}),Br("worker",["./shared"],function(k){class p{constructor(I){this.keyCache={},I&&this.replace(I)}replace(I){this._layerConfigs={},this._layers={},this.update(I,[])}update(I,C){for(const R of I){this._layerConfigs[R.id]=R;const G=this._layers[R.id]=k.az(R);G._featureFilter=k.a6(G.filter),this.keyCache[R.id]&&delete this.keyCache[R.id]}for(const R of C)delete this.keyCache[R],delete this._layerConfigs[R],delete this._layers[R];this.familiesBySource={};const z=k.bh(Object.values(this._layerConfigs),this.keyCache);for(const R of z){const G=R.map(ne=>this._layers[ne.id]),H=G[0];if(H.visibility==="none")continue;const K=H.source||"";let q=this.familiesBySource[K];q||(q=this.familiesBySource[K]={});const J=H.sourceLayer||"_geojsonTileLayer";let he=q[J];he||(he=q[J]=[]),he.push(G)}}}class Ei{constructor(I){const C={},z=[];for(const K in I){const q=I[K],J=C[K]={};for(const he in q){const ne=q[+he];if(!ne||ne.bitmap.width===0||ne.bitmap.height===0)continue;const oe={x:0,y:0,w:ne.bitmap.width+2,h:ne.bitmap.height+2};z.push(oe),J[he]={rect:oe,metrics:ne.metrics}}}const{w:R,h:G}=k.p(z),H=new k.o({width:R||1,height:G||1});for(const K in I){const q=I[K];for(const J in q){const he=q[+J];if(!he||he.bitmap.width===0||he.bitmap.height===0)continue;const ne=C[K][J].rect;k.o.copy(he.bitmap,H,{x:0,y:0},{x:ne.x+1,y:ne.y+1},he.bitmap)}}this.image=H,this.positions=C}}k.bi("GlyphAtlas",Ei);class Xi{constructor(I){this.tileID=new k.Q(I.tileID.overscaledZ,I.tileID.wrap,I.tileID.canonical.z,I.tileID.canonical.x,I.tileID.canonical.y),this.uid=I.uid,this.zoom=I.zoom,this.pixelRatio=I.pixelRatio,this.tileSize=I.tileSize,this.source=I.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=I.showCollisionBoxes,this.collectResourceTiming=!!I.collectResourceTiming,this.returnDependencies=!!I.returnDependencies,this.promoteId=I.promoteId,this.inFlightDependencies=[]}parse(I,C,z,R){return k._(this,void 0,void 0,function*(){this.status="parsing",this.data=I,this.collisionBoxArray=new k.a4;const G=new k.bj(Object.keys(I.layers).sort()),H=new k.bk(this.tileID,this.promoteId);H.bucketLayerIDs=[];const K={},q={featureIndex:H,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:z},J=C.familiesBySource[this.source];for(const Ne in J){const gt=I.layers[Ne];if(!gt)continue;gt.version===1&&k.w(`Vector tile source "${this.source}" layer "${Ne}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ft=G.encode(Ne),li=[];for(let Zt=0;Zt=Jt.maxzoom||Jt.visibility!=="none"&&(Yt(Zt,this.zoom,z),(K[Jt.id]=Jt.createBucket({index:H.bucketLayerIDs.length,layers:Zt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ft,sourceID:this.source})).populate(li,q,this.tileID.canonical),H.bucketLayerIDs.push(Zt.map(xi=>xi.id)))}}const he=k.aE(q.glyphDependencies,Ne=>Object.keys(Ne).map(Number));this.inFlightDependencies.forEach(Ne=>Ne?.abort()),this.inFlightDependencies=[];let ne=Promise.resolve({});if(Object.keys(he).length){const Ne=new AbortController;this.inFlightDependencies.push(Ne),ne=R.sendAsync({type:"getGlyphs",data:{stacks:he,source:this.source,tileID:this.tileID,type:"glyphs"}},Ne)}const oe=Object.keys(q.iconDependencies);let Pe=Promise.resolve({});if(oe.length){const Ne=new AbortController;this.inFlightDependencies.push(Ne),Pe=R.sendAsync({type:"getImages",data:{icons:oe,source:this.source,tileID:this.tileID,type:"icons"}},Ne)}const Re=Object.keys(q.patternDependencies);let De=Promise.resolve({});if(Re.length){const Ne=new AbortController;this.inFlightDependencies.push(Ne),De=R.sendAsync({type:"getImages",data:{icons:Re,source:this.source,tileID:this.tileID,type:"patterns"}},Ne)}const[Ye,Fe,ct]=yield Promise.all([ne,Pe,De]),st=new Ei(Ye),Tt=new k.bl(Fe,ct);for(const Ne in K){const gt=K[Ne];gt instanceof k.a5?(Yt(gt.layers,this.zoom,z),k.bm({bucket:gt,glyphMap:Ye,glyphPositions:st.positions,imageMap:Fe,imagePositions:Tt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):gt.hasPattern&&(gt instanceof k.bn||gt instanceof k.bo||gt instanceof k.bp)&&(Yt(gt.layers,this.zoom,z),gt.addFeatures(q,this.tileID.canonical,Tt.patternPositions))}return this.status="done",{buckets:Object.values(K).filter(Ne=>!Ne.isEmpty()),featureIndex:H,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:st.image,imageAtlas:Tt,glyphMap:this.returnDependencies?Ye:null,iconMap:this.returnDependencies?Fe:null,glyphPositions:this.returnDependencies?st.positions:null}})}}function Yt(F,I,C){const z=new k.a8(I);for(const R of F)R.recalculate(z,C)}class xe{constructor(I,C,z){this.actor=I,this.layerIndex=C,this.availableImages=z,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(I,C){return k._(this,void 0,void 0,function*(){const z=yield k.l(I.request,C);try{return{vectorTile:new k.bq.VectorTile(new k.br(z.data)),rawData:z.data,cacheControl:z.cacheControl,expires:z.expires}}catch(R){const G=new Uint8Array(z.data);let H=`Unable to parse the tile at ${I.request.url}, `;throw H+=G[0]===31&&G[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${R.messge}`,new Error(H)}})}loadTile(I){return k._(this,void 0,void 0,function*(){const C=I.uid,z=!!(I&&I.request&&I.request.collectResourceTiming)&&new k.bs(I.request),R=new Xi(I);this.loading[C]=R;const G=new AbortController;R.abort=G;try{const H=yield this.loadVectorTile(I,G);if(delete this.loading[C],!H)return null;const K=H.rawData,q={};H.expires&&(q.expires=H.expires),H.cacheControl&&(q.cacheControl=H.cacheControl);const J={};if(z){const ne=z.finish();ne&&(J.resourceTiming=JSON.parse(JSON.stringify(ne)))}R.vectorTile=H.vectorTile;const he=R.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[C]=R,this.fetching[C]={rawTileData:K,cacheControl:q,resourceTiming:J};try{const ne=yield he;return k.e({rawTileData:K.slice(0)},ne,q,J)}finally{delete this.fetching[C]}}catch(H){throw delete this.loading[C],R.status="done",this.loaded[C]=R,H}})}reloadTile(I){return k._(this,void 0,void 0,function*(){const C=I.uid;if(!this.loaded||!this.loaded[C])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const z=this.loaded[C];if(z.showCollisionBoxes=I.showCollisionBoxes,z.status==="parsing"){const R=yield z.parse(z.vectorTile,this.layerIndex,this.availableImages,this.actor);let G;if(this.fetching[C]){const{rawTileData:H,cacheControl:K,resourceTiming:q}=this.fetching[C];delete this.fetching[C],G=k.e({rawTileData:H.slice(0)},R,K,q)}else G=R;return G}if(z.status==="done"&&z.vectorTile)return z.parse(z.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(I){return k._(this,void 0,void 0,function*(){const C=this.loading,z=I.uid;C&&C[z]&&C[z].abort&&(C[z].abort.abort(),delete C[z])})}removeTile(I){return k._(this,void 0,void 0,function*(){this.loaded&&this.loaded[I.uid]&&delete this.loaded[I.uid]})}}class re{constructor(){this.loaded={}}loadTile(I){return k._(this,void 0,void 0,function*(){const{uid:C,encoding:z,rawImageData:R,redFactor:G,greenFactor:H,blueFactor:K,baseShift:q}=I,J=R.width+2,he=R.height+2,ne=k.b(R)?new k.R({width:J,height:he},yield k.bt(R,-1,-1,J,he)):R,oe=new k.bu(C,ne,z,G,H,K,q);return this.loaded=this.loaded||{},this.loaded[C]=oe,oe})}removeTile(I){const C=this.loaded,z=I.uid;C&&C[z]&&delete C[z]}}function Fr(F,I){if(F.length!==0){xr(F[0],I);for(var C=1;C=Math.abs(K)?C-q+K:K-q+C,C=q}C+z>=0!=!!I&&F.reverse()}var Ki=k.bv(function F(I,C){var z,R=I&&I.type;if(R==="FeatureCollection")for(z=0;z>31}function Ur(F,I){for(var C=F.loadGeometry(),z=F.type,R=0,G=0,H=C.length,K=0;KF},Zs=Math.fround||(wr=new Float32Array(1),F=>(wr[0]=+F,wr[0]));var wr;const ni=3,ai=5,Nr=6;class Qi{constructor(I){this.options=Object.assign(Object.create(Ji),I),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(I){const{log:C,minZoom:z,maxZoom:R}=this.options;C&&console.time("total time");const G=`prepare ${I.length} points`;C&&console.time(G),this.points=I;const H=[];for(let q=0;q=z;q--){const J=+Date.now();K=this.trees[q]=this._createTree(this._cluster(K,q)),C&&console.log("z%d: %d clusters in %dms",q,K.numItems,+Date.now()-J)}return C&&console.timeEnd("total time"),this}getClusters(I,C){let z=((I[0]+180)%360+360)%360-180;const R=Math.max(-90,Math.min(90,I[1]));let G=I[2]===180?180:((I[2]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)z=-180,G=180;else if(z>G){const ne=this.getClusters([z,R,180,H],C),oe=this.getClusters([-180,R,G,H],C);return ne.concat(oe)}const K=this.trees[this._limitZoom(C)],q=K.range(Oi(z),Vi(H),Oi(G),Vi(R)),J=K.data,he=[];for(const ne of q){const oe=this.stride*ne;he.push(J[oe+ai]>1?$r(J,oe,this.clusterProps):this.points[J[oe+ni]])}return he}getChildren(I){const C=this._getOriginId(I),z=this._getOriginZoom(I),R="No cluster with the specified id.",G=this.trees[z];if(!G)throw new Error(R);const H=G.data;if(C*this.stride>=H.length)throw new Error(R);const K=this.options.radius/(this.options.extent*Math.pow(2,z-1)),q=G.within(H[C*this.stride],H[C*this.stride+1],K),J=[];for(const he of q){const ne=he*this.stride;H[ne+4]===I&&J.push(H[ne+ai]>1?$r(H,ne,this.clusterProps):this.points[H[ne+ni]])}if(J.length===0)throw new Error(R);return J}getLeaves(I,C,z){const R=[];return this._appendLeaves(R,I,C=C||10,z=z||0,0),R}getTile(I,C,z){const R=this.trees[this._limitZoom(I)],G=Math.pow(2,I),{extent:H,radius:K}=this.options,q=K/H,J=(z-q)/G,he=(z+1+q)/G,ne={features:[]};return this._addTileFeatures(R.range((C-q)/G,J,(C+1+q)/G,he),R.data,C,z,G,ne),C===0&&this._addTileFeatures(R.range(1-q/G,J,1,he),R.data,G,z,G,ne),C===G-1&&this._addTileFeatures(R.range(0,J,q/G,he),R.data,-1,z,G,ne),ne.features.length?ne:null}getClusterExpansionZoom(I){let C=this._getOriginZoom(I)-1;for(;C<=this.options.maxZoom;){const z=this.getChildren(I);if(C++,z.length!==1)break;I=z[0].properties.cluster_id}return C}_appendLeaves(I,C,z,R,G){const H=this.getChildren(C);for(const K of H){const q=K.properties;if(q&&q.cluster?G+q.point_count<=R?G+=q.point_count:G=this._appendLeaves(I,q.cluster_id,z,R,G):G1;let he,ne,oe;if(J)he=ur(C,q,this.clusterProps),ne=C[q],oe=C[q+1];else{const De=this.points[C[q+ni]];he=De.properties;const[Ye,Fe]=De.geometry.coordinates;ne=Oi(Ye),oe=Vi(Fe)}const Pe={type:1,geometry:[[Math.round(this.options.extent*(ne*G-z)),Math.round(this.options.extent*(oe*G-R))]],tags:he};let Re;Re=J||this.options.generateId?C[q+ni]:this.points[C[q+ni]].id,Re!==void 0&&(Pe.id=Re),H.features.push(Pe)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(Math.floor(+I),this.options.maxZoom+1))}_cluster(I,C){const{radius:z,extent:R,reduce:G,minPoints:H}=this.options,K=z/(R*Math.pow(2,C)),q=I.data,J=[],he=this.stride;for(let ne=0;neC&&(Ye+=q[ct+ai])}if(Ye>De&&Ye>=H){let Fe,ct=oe*De,st=Pe*De,Tt=-1;const Ne=((ne/he|0)<<5)+(C+1)+this.points.length;for(const gt of Re){const Ft=gt*he;if(q[Ft+2]<=C)continue;q[Ft+2]=C;const li=q[Ft+ai];ct+=q[Ft]*li,st+=q[Ft+1]*li,q[Ft+4]=Ne,G&&(Fe||(Fe=this._map(q,ne,!0),Tt=this.clusterProps.length,this.clusterProps.push(Fe)),G(Fe,this._map(q,Ft)))}q[ne+4]=Ne,J.push(ct/Ye,st/Ye,1/0,Ne,-1,Ye),G&&J.push(Tt)}else{for(let Fe=0;Fe1)for(const Fe of Re){const ct=Fe*he;if(!(q[ct+2]<=C)){q[ct+2]=C;for(let st=0;st>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,C,z){if(I[C+ai]>1){const H=this.clusterProps[I[C+Nr]];return z?Object.assign({},H):H}const R=this.points[I[C+ni]].properties,G=this.options.map(R);return z&&G===R?Object.assign({},G):G}}function $r(F,I,C){return{type:"Feature",id:F[I+ni],properties:ur(F,I,C),geometry:{type:"Point",coordinates:[(z=F[I],360*(z-.5)),ps(F[I+1])]}};var z}function ur(F,I,C){const z=F[I+ai],R=z>=1e4?`${Math.round(z/1e3)}k`:z>=1e3?Math.round(z/100)/10+"k":z,G=F[I+Nr],H=G===-1?{}:Object.assign({},C[G]);return Object.assign(H,{cluster:!0,cluster_id:F[I+ni],point_count:z,point_count_abbreviated:R})}function Oi(F){return F/360+.5}function Vi(F){const I=Math.sin(F*Math.PI/180),C=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return C<0?0:C>1?1:C}function ps(F){const I=(180-360*F)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function Tr(F,I,C,z){for(var R,G=z,H=C-I>>1,K=C-I,q=F[I],J=F[I+1],he=F[C],ne=F[C+1],oe=I+3;oeG)R=oe,G=Pe;else if(Pe===G){var Re=Math.abs(oe-H);Rez&&(R-I>3&&Tr(F,I,R,z),F[R+2]=G,C-R>3&&Tr(F,R,C,z))}function xn(F,I,C,z,R,G){var H=R-C,K=G-z;if(H!==0||K!==0){var q=((F-C)*H+(I-z)*K)/(H*H+K*K);q>1?(C=R,z=G):q>0&&(C+=H*q,z+=K*q)}return(H=F-C)*H+(K=I-z)*K}function Sr(F,I,C,z){var R={id:F===void 0?null:F,type:I,geometry:C,tags:z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(G){var H=G.geometry,K=G.type;if(K==="Point"||K==="MultiPoint"||K==="LineString")Ir(G,H);else if(K==="Polygon"||K==="MultiLineString")for(var q=0;q0&&(H+=z?(R*J-q*G)/2:Math.sqrt(Math.pow(q-R,2)+Math.pow(J-G,2))),R=q,G=J}var he=I.length-3;I[2]=1,Tr(I,0,he,C),I[he+2]=1,I.size=Math.abs(H),I.start=0,I.end=I.size}function se(F,I,C,z){for(var R=0;R1?1:C}function Ke(F,I,C,z,R,G,H,K){if(z/=I,G>=(C/=I)&&H=z)return null;for(var q=[],J=0;J=C&&Re=z)){var De=[];if(oe==="Point"||oe==="MultiPoint")Nt(ne,De,C,z,R);else if(oe==="LineString")er(ne,De,C,z,R,!1,K.lineMetrics);else if(oe==="MultiLineString")ms(ne,De,C,z,R,!1);else if(oe==="Polygon")ms(ne,De,C,z,R,!0);else if(oe==="MultiPolygon")for(var Ye=0;Ye=C&&H<=z&&(I.push(F[G]),I.push(F[G+1]),I.push(F[G+2]))}}function er(F,I,C,z,R,G,H){for(var K,q,J=fs(F),he=R===0?Zr:_s,ne=F.start,oe=0;oeC&&(q=he(J,Pe,Re,Ye,Fe,C),H&&(J.start=ne+K*q)):ct>z?st=C&&(q=he(J,Pe,Re,Ye,Fe,C),Tt=!0),st>z&&ct<=z&&(q=he(J,Pe,Re,Ye,Fe,z),Tt=!0),!G&&Tt&&(H&&(J.end=ne+K*q),I.push(J),J=fs(F)),H&&(ne+=K)}var Ne=F.length-3;Pe=F[Ne],Re=F[Ne+1],De=F[Ne+2],(ct=R===0?Pe:Re)>=C&&ct<=z&&gs(J,Pe,Re,De),Ne=J.length-3,G&&Ne>=3&&(J[Ne]!==J[0]||J[Ne+1]!==J[1])&&gs(J,J[0],J[1],J[2]),J.length&&I.push(J)}function fs(F){var I=[];return I.size=F.size,I.start=F.start,I.end=F.end,I}function ms(F,I,C,z,R,G){for(var H=0;HH.maxX&&(H.maxX=he),ne>H.maxY&&(H.maxY=ne)}return H}function Gr(F,I,C,z){var R=I.geometry,G=I.type,H=[];if(G==="Point"||G==="MultiPoint")for(var K=0;K0&&I.size<(R?H:z))C.numPoints+=I.length/3;else{for(var K=[],q=0;qH)&&(C.numSimplified++,K.push(I[q]),K.push(I[q+1])),C.numPoints++;R&&function(J,he){for(var ne=0,oe=0,Pe=J.length,Re=Pe-2;oe0===he)for(oe=0,Pe=J.length;oe24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");var z=function(R,G){var H=[];if(R.type==="FeatureCollection")for(var K=0;K1&&console.time("creation"),oe=this.tiles[ne]=Ws(F,I,C,z,q),this.tileCoords.push({z:I,x:C,y:z}),J)){J>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,C,z,oe.numFeatures,oe.numPoints,oe.numSimplified),console.timeEnd("creation"));var Pe="z"+I;this.stats[Pe]=(this.stats[Pe]||0)+1,this.total++}if(oe.source=F,R){if(I===q.maxZoom||I===R)continue;var Re=1<1&&console.time("clipping");var De,Ye,Fe,ct,st,Tt,Ne=.5*q.buffer/q.extent,gt=.5-Ne,Ft=.5+Ne,li=1+Ne;De=Ye=Fe=ct=null,st=Ke(F,he,C-Ne,C+Ft,0,oe.minX,oe.maxX,q),Tt=Ke(F,he,C+gt,C+li,0,oe.minX,oe.maxX,q),F=null,st&&(De=Ke(st,he,z-Ne,z+Ft,1,oe.minY,oe.maxY,q),Ye=Ke(st,he,z+gt,z+li,1,oe.minY,oe.maxY,q),st=null),Tt&&(Fe=Ke(Tt,he,z-Ne,z+Ft,1,oe.minY,oe.maxY,q),ct=Ke(Tt,he,z+gt,z+li,1,oe.minY,oe.maxY,q),Tt=null),J>1&&console.timeEnd("clipping"),K.push(De||[],I+1,2*C,2*z),K.push(Ye||[],I+1,2*C,2*z+1),K.push(Fe||[],I+1,2*C+1,2*z),K.push(ct||[],I+1,2*C+1,2*z+1)}}},je.prototype.getTile=function(F,I,C){var z=this.options,R=z.extent,G=z.debug;if(F<0||F>24)return null;var H=1<1&&console.log("drilling down to z%d-%d-%d",F,I,C);for(var q,J=F,he=I,ne=C;!q&&J>0;)J--,he=Math.floor(he/2),ne=Math.floor(ne/2),q=this.tiles[Ve(J,he,ne)];return q&&q.source?(G>1&&console.log("found parent tile z%d-%d-%d",J,he,ne),G>1&&console.time("drilling down"),this.splitTile(q.source,J,he,ne,F,I,C),G>1&&console.timeEnd("drilling down"),this.tiles[K]?yi(this.tiles[K],R):null):null};class Cr extends xe{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(I,C){return k._(this,void 0,void 0,function*(){const z=I.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const R=this._geoJSONIndex.getTile(z.z,z.x,z.y);if(!R)return null;const G=new class{constructor(K){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=k.W,this.length=K.length,this._features=K}feature(K){return new class{constructor(q){this._feature=q,this.extent=k.W,this.type=q.type,this.properties=q.tags,"id"in q&&!isNaN(q.id)&&(this.id=parseInt(q.id,10))}loadGeometry(){if(this._feature.type===1){const q=[];for(const J of this._feature.geometry)q.push([new k.P(J[0],J[1])]);return q}{const q=[];for(const J of this._feature.geometry){const he=[];for(const ne of J)he.push(new k.P(ne[0],ne[1]));q.push(he)}return q}}toGeoJSON(q,J,he){return vr.call(this,q,J,he)}}(this._features[K])}}(R.features);let H=ds(G);return H.byteOffset===0&&H.byteLength===H.buffer.byteLength||(H=new Uint8Array(H)),{vectorTile:G,rawData:H.buffer}})}loadData(I){return k._(this,void 0,void 0,function*(){var C;(C=this._pendingRequest)===null||C===void 0||C.abort();const z=!!(I&&I.request&&I.request.collectResourceTiming)&&new k.bs(I.request);this._pendingRequest=new AbortController;try{let R=yield this.loadGeoJSON(I,this._pendingRequest);if(delete this._pendingRequest,typeof R!="object")throw new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`);if(Ki(R,!0),I.filter){const H=k.by(I.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(H.result==="error")throw new Error(H.value.map(q=>`${q.key}: ${q.message}`).join(", "));R={type:"FeatureCollection",features:R.features.filter(q=>H.value.evaluate({zoom:0},q))}}this._geoJSONIndex=I.cluster?new Qi(function({superclusterOptions:H,clusterProperties:K}){if(!K||!H)return H;const q={},J={},he={accumulated:null,zoom:0},ne={properties:null},oe=Object.keys(K);for(const Pe of oe){const[Re,De]=K[Pe],Ye=k.by(De),Fe=k.by(typeof Re=="string"?[Re,["accumulated"],["get",Pe]]:Re);q[Pe]=Ye.value,J[Pe]=Fe.value}return H.map=Pe=>{ne.properties=Pe;const Re={};for(const De of oe)Re[De]=q[De].evaluate(he,ne);return Re},H.reduce=(Pe,Re)=>{ne.properties=Re;for(const De of oe)he.accumulated=Pe[De],Pe[De]=J[De].evaluate(he,ne)},H}(I)).load(R.features):function(H,K){return new je(H,K)}(R,I.geojsonVtOptions),this.loaded={};const G={};if(z){const H=z.finish();H&&(G.resourceTiming={},G.resourceTiming[I.source]=JSON.parse(JSON.stringify(H)))}return G}catch(R){if(delete this._pendingRequest,k.bz(R))return{abandoned:!0};throw R}})}reloadTile(I){const C=this.loaded;return C&&C[I.uid]?super.reloadTile(I):this.loadTile(I)}loadGeoJSON(I,C){return k._(this,void 0,void 0,function*(){const{promoteId:z}=I;if(I.request){const R=yield k.h(I.request,C);return this._dataUpdateable=zi(R.data,z)?Ue(R.data,z):void 0,R.data}if(typeof I.data=="string")try{const R=JSON.parse(I.data);return this._dataUpdateable=zi(R,z)?Ue(R,z):void 0,R}catch{throw new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`)}if(!I.dataDiff)throw new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${I.source}`);return function(R,G,H){var K,q,J,he;if(G.removeAll&&R.clear(),G.remove)for(const ne of G.remove)R.delete(ne);if(G.add)for(const ne of G.add){const oe=$t(ne,H);oe!=null&&R.set(oe,ne)}if(G.update)for(const ne of G.update){let oe=R.get(ne.id);if(oe==null)continue;const Pe=!ne.removeAllProperties&&(((K=ne.removeProperties)===null||K===void 0?void 0:K.length)>0||((q=ne.addOrUpdateProperties)===null||q===void 0?void 0:q.length)>0);if((ne.newGeometry||ne.removeAllProperties||Pe)&&(oe=Object.assign({},oe),R.set(ne.id,oe),Pe&&(oe.properties=Object.assign({},oe.properties))),ne.newGeometry&&(oe.geometry=ne.newGeometry),ne.removeAllProperties)oe.properties={};else if(((J=ne.removeProperties)===null||J===void 0?void 0:J.length)>0)for(const Re of ne.removeProperties)Object.prototype.hasOwnProperty.call(oe.properties,Re)&&delete oe.properties[Re];if(((he=ne.addOrUpdateProperties)===null||he===void 0?void 0:he.length)>0)for(const{key:Re,value:De}of ne.addOrUpdateProperties)oe.properties[Re]=De}}(this._dataUpdateable,I.dataDiff,z),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(I){return k._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(I){return this._geoJSONIndex.getClusterExpansionZoom(I.clusterId)}getClusterChildren(I){return this._geoJSONIndex.getChildren(I.clusterId)}getClusterLeaves(I){return this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset)}}class dr{constructor(I){this.self=I,this.actor=new k.C(I),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(C,z)=>{if(this.externalWorkerSourceTypes[C])throw new Error(`Worker source with name "${C}" already registered.`);this.externalWorkerSourceTypes[C]=z},this.self.addProtocol=k.bf,this.self.removeProtocol=k.bg,this.self.registerRTLTextPlugin=C=>{if(k.bA.isParsed())throw new Error("RTL text plugin already registered.");k.bA.setMethods(C)},this.actor.registerMessageHandler("loadDEMTile",(C,z)=>this._getDEMWorkerSource(C,z.source).loadTile(z)),this.actor.registerMessageHandler("removeDEMTile",(C,z)=>k._(this,void 0,void 0,function*(){this._getDEMWorkerSource(C,z.source).removeTile(z)})),this.actor.registerMessageHandler("getClusterExpansionZoom",(C,z)=>k._(this,void 0,void 0,function*(){return this._getWorkerSource(C,z.type,z.source).getClusterExpansionZoom(z)})),this.actor.registerMessageHandler("getClusterChildren",(C,z)=>k._(this,void 0,void 0,function*(){return this._getWorkerSource(C,z.type,z.source).getClusterChildren(z)})),this.actor.registerMessageHandler("getClusterLeaves",(C,z)=>k._(this,void 0,void 0,function*(){return this._getWorkerSource(C,z.type,z.source).getClusterLeaves(z)})),this.actor.registerMessageHandler("loadData",(C,z)=>this._getWorkerSource(C,z.type,z.source).loadData(z)),this.actor.registerMessageHandler("loadTile",(C,z)=>this._getWorkerSource(C,z.type,z.source).loadTile(z)),this.actor.registerMessageHandler("reloadTile",(C,z)=>this._getWorkerSource(C,z.type,z.source).reloadTile(z)),this.actor.registerMessageHandler("abortTile",(C,z)=>this._getWorkerSource(C,z.type,z.source).abortTile(z)),this.actor.registerMessageHandler("removeTile",(C,z)=>this._getWorkerSource(C,z.type,z.source).removeTile(z)),this.actor.registerMessageHandler("removeSource",(C,z)=>k._(this,void 0,void 0,function*(){if(!this.workerSources[C]||!this.workerSources[C][z.type]||!this.workerSources[C][z.type][z.source])return;const R=this.workerSources[C][z.type][z.source];delete this.workerSources[C][z.type][z.source],R.removeSource!==void 0&&R.removeSource(z)})),this.actor.registerMessageHandler("removeMap",C=>k._(this,void 0,void 0,function*(){delete this.layerIndexes[C],delete this.availableImages[C],delete this.workerSources[C],delete this.demWorkerSources[C]})),this.actor.registerMessageHandler("setReferrer",(C,z)=>k._(this,void 0,void 0,function*(){this.referrer=z})),this.actor.registerMessageHandler("syncRTLPluginState",(C,z)=>this._syncRTLPluginState(C,z)),this.actor.registerMessageHandler("importScript",(C,z)=>k._(this,void 0,void 0,function*(){this.self.importScripts(z)})),this.actor.registerMessageHandler("setImages",(C,z)=>this._setImages(C,z)),this.actor.registerMessageHandler("updateLayers",(C,z)=>k._(this,void 0,void 0,function*(){this._getLayerIndex(C).update(z.layers,z.removedIds)})),this.actor.registerMessageHandler("setLayers",(C,z)=>k._(this,void 0,void 0,function*(){this._getLayerIndex(C).replace(z)}))}_setImages(I,C){return k._(this,void 0,void 0,function*(){this.availableImages[I]=C;for(const z in this.workerSources[I]){const R=this.workerSources[I][z];for(const G in R)R[G].availableImages=C}})}_syncRTLPluginState(I,C){return k._(this,void 0,void 0,function*(){if(k.bA.isParsed())return k.bA.getState();if(C.pluginStatus!=="loading")return k.bA.setState(C),C;const z=C.pluginURL;if(this.self.importScripts(z),k.bA.isParsed()){const R={pluginStatus:"loaded",pluginURL:z};return k.bA.setState(R),R}throw k.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${z}`)})}_getAvailableImages(I){let C=this.availableImages[I];return C||(C=[]),C}_getLayerIndex(I){let C=this.layerIndexes[I];return C||(C=this.layerIndexes[I]=new p),C}_getWorkerSource(I,C,z){if(this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][C]||(this.workerSources[I][C]={}),!this.workerSources[I][C][z]){const R={sendAsync:(G,H)=>(G.targetMapId=I,this.actor.sendAsync(G,H))};switch(C){case"vector":this.workerSources[I][C][z]=new xe(R,this._getLayerIndex(I),this._getAvailableImages(I));break;case"geojson":this.workerSources[I][C][z]=new Cr(R,this._getLayerIndex(I),this._getAvailableImages(I));break;default:this.workerSources[I][C][z]=new this.externalWorkerSourceTypes[C](R,this._getLayerIndex(I),this._getAvailableImages(I))}}return this.workerSources[I][C][z]}_getDEMWorkerSource(I,C){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][C]||(this.demWorkerSources[I][C]=new re),this.demWorkerSources[I][C]}}return k.i(self)&&(self.worker=new dr(self)),dr}),Br("index",["exports","./shared"],function(k,p){var Ei="4.1.2";let Xi,Yt;const xe={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:c=>new Promise((t,s)=>{const a=requestAnimationFrame(t);c.signal.addEventListener("abort",()=>{cancelAnimationFrame(a),s(p.c())})}),getImageData(c,t=0){return this.getImageCanvasContext(c).getImageData(-t,-t,c.width+2*t,c.height+2*t)},getImageCanvasContext(c){const t=window.document.createElement("canvas"),s=t.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return t.width=c.width,t.height=c.height,s.drawImage(c,0,0,c.width,c.height),s},resolveURL:c=>(Xi||(Xi=document.createElement("a")),Xi.href=c,Xi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Yt==null&&(Yt=matchMedia("(prefers-reduced-motion: reduce)")),Yt.matches)}};class re{static testProp(t){if(!re.docStyle)return t[0];for(let s=0;s{window.removeEventListener("click",re.suppressClickInternal,!0)},0)}static getScale(t){const s=t.getBoundingClientRect();return{x:s.width/t.offsetWidth||1,y:s.height/t.offsetHeight||1,boundingClientRect:s}}static getPoint(t,s,a){const o=s.boundingClientRect;return new p.P((a.clientX-o.left)/s.x-t.clientLeft,(a.clientY-o.top)/s.y-t.clientTop)}static mousePos(t,s){const a=re.getScale(t);return re.getPoint(t,a,s)}static touchPos(t,s){const a=[],o=re.getScale(t);for(let h=0;h{t=[],s=0,a=0,o={}},c.addThrottleControl=y=>{const v=a++;return o[v]=y,v},c.removeThrottleControl=y=>{delete o[y],m()},c.getImage=(y,v,T=!0)=>new Promise((S,E)=>{Fr.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),p.e(y,{type:"image"}),t.push({abortController:v,requestParameters:y,supportImageRefresh:T,state:"queued",onError:O=>{E(O)},onSuccess:O=>{S(O)}}),m()});const h=y=>p._(this,void 0,void 0,function*(){y.state="running";const{requestParameters:v,supportImageRefresh:T,onError:S,onSuccess:E,abortController:O}=y,B=T===!1&&!p.i(self)&&!p.g(v.url)&&(!v.headers||Object.keys(v.headers).reduce((Z,Q)=>Z&&Q==="accept",!0));s++;const U=B?g(v,O):p.m(v,O);try{const Z=yield U;delete y.abortController,y.state="completed",Z.data instanceof HTMLImageElement||p.b(Z.data)?E(Z):Z.data&&E({data:yield(D=Z.data,typeof createImageBitmap=="function"?p.d(D):p.f(D)),cacheControl:Z.cacheControl,expires:Z.expires})}catch(Z){delete y.abortController,S(Z)}finally{s--,m()}var D}),m=()=>{const y=(()=>{for(const v of Object.keys(o))if(o[v]())return!0;return!1})()?p.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let v=s;v0;v++){const T=t.shift();T.abortController.signal.aborted?v--:h(T)}},g=(y,v)=>new Promise((T,S)=>{const E=new Image,O=y.url,B=y.credentials;B&&B==="include"?E.crossOrigin="use-credentials":(B&&B==="same-origin"||!p.s(O))&&(E.crossOrigin="anonymous"),v.signal.addEventListener("abort",()=>{E.src="",S(p.c())}),E.fetchPriority="high",E.onload=()=>{E.onerror=E.onload=null,T({data:E})},E.onerror=()=>{E.onerror=E.onload=null,v.signal.aborted||S(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."))},E.src=O})}(_i||(_i={})),_i.resetRequestQueue(),function(c){c.Glyphs="Glyphs",c.Image="Image",c.Source="Source",c.SpriteImage="SpriteImage",c.SpriteJSON="SpriteJSON",c.Style="Style",c.Tile="Tile",c.Unknown="Unknown"}(Ut||(Ut={}));class Yi{constructor(t){this._transformRequestFn=t}transformRequest(t,s){return this._transformRequestFn&&this._transformRequestFn(t,s)||{url:t}}normalizeSpriteURL(t,s,a){const o=function(h){const m=h.match(Or);if(!m)throw new Error(`Unable to parse URL "${h}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return o.path+=`${s}${a}`,function(h){const m=h.params.length?`?${h.params.join("&")}`:"";return`${h.protocol}://${h.authority}${h.path}${m}`}(o)}setTransformRequest(t){this._transformRequestFn=t}}const Or=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Mi(c){var t=new p.A(3);return t[0]=c[0],t[1]=c[1],t[2]=c[2],t}var Vr,br=function(c,t,s){return c[0]=t[0]-s[0],c[1]=t[1]-s[1],c[2]=t[2]-s[2],c};Vr=new p.A(3),p.A!=Float32Array&&(Vr[0]=0,Vr[1]=0,Vr[2]=0);var yn=function(c){var t=c[0],s=c[1];return t*t+s*s};function si(c){const t=[];if(typeof c=="string")t.push({id:"default",url:c});else if(c&&c.length>0){const s=[];for(const{id:a,url:o}of c){const h=`${a}${o}`;s.indexOf(h)===-1&&(s.push(h),t.push({id:a,url:o}))}}return t}(function(){var c=new p.A(2);p.A!=Float32Array&&(c[0]=0,c[1]=0)})();class xt{constructor(t,s,a,o){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(s,o)}update(t,s,a){const{width:o,height:h}=t,m=!(this.size&&this.size[0]===o&&this.size[1]===h||a),{context:g}=this,{gl:y}=g;if(this.useMipmap=!!(s&&s.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1),g.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!s||s.premultiply!==!1)),m)this.size=[o,h],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||p.b(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,o,h,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:T}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||p.b(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,T,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,T,o,h,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,s,a){const{context:o}=this,{gl:h}=o;h.bindTexture(h.TEXTURE_2D,this.texture),a!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=h.LINEAR),t!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,t),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,a||t),this.filter=t),s!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,s),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,s),this.wrap=s)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function qt(c){const{userImage:t}=c;return!!(t&&t.render&&t.render())&&(c.data.replace(new Uint8Array(t.data.buffer)),!0)}class Fi extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:s,promiseResolve:a}of this.requestors)a(this._getImagesForIds(s));this.requestors=[]}}getImage(t){const s=this.images[t];if(s&&!s.data&&s.spriteData){const a=s.spriteData;s.data=new p.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),s.spriteData=null}return s}addImage(t,s){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,s)&&(this.images[t]=s)}_validate(t,s){let a=!0;const o=s.data||s.spriteData;return this._validateStretch(s.stretchX,o&&o.width)||(this.fire(new p.j(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(s.stretchY,o&&o.height)||(this.fire(new p.j(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(s.content,s)||(this.fire(new p.j(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,s){if(!t)return!0;let a=0;for(const o of t){if(o[0]{let o=!0;if(!this.isLoaded())for(const h of t)this.images[h]||(o=!1);this.isLoaded()||o?s(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:s})})}_getImagesForIds(t){const s={};for(const a of t){let o=this.getImage(a);o||(this.fire(new p.k("styleimagemissing",{id:a})),o=this.getImage(a)),o?s[a]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:p.w(`Image "${a}" 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 s}getPixelSize(){const{width:t,height:s}=this.atlasImage;return{width:t,height:s}}getPattern(t){const s=this.patterns[t],a=this.getImage(t);if(!a)return null;if(s&&s.position.version===a.version)return s.position;if(s)s.position.version=a.version;else{const o={w:a.data.width+2,h:a.data.height+2,x:0,y:0},h=new p.I(o,a);this.patterns[t]={bin:o,position:h}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const s=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new xt(t,this.atlasImage,s.RGBA),this.atlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const h in this.patterns)t.push(this.patterns[h].bin);const{w:s,h:a}=p.p(t),o=this.atlasImage;o.resize({width:s||1,height:a||1});for(const h in this.patterns){const{bin:m}=this.patterns[h],g=m.x+1,y=m.y+1,v=this.getImage(h).data,T=v.width,S=v.height;p.R.copy(v,o,{x:0,y:0},{x:g,y},{width:T,height:S}),p.R.copy(v,o,{x:0,y:S-1},{x:g,y:y-1},{width:T,height:1}),p.R.copy(v,o,{x:0,y:0},{x:g,y:y+S},{width:T,height:1}),p.R.copy(v,o,{x:T-1,y:0},{x:g-1,y},{width:1,height:S}),p.R.copy(v,o,{x:0,y:0},{x:g+T,y},{width:1,height:S})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const s of t){if(this.callbackDispatchedThisFrame[s])continue;this.callbackDispatchedThisFrame[s]=!0;const a=this.getImage(s);a||p.w(`Image with ID: "${s}" was not found`),qt(a)&&this.updateImage(s,a)}}}const Ur=1e20;function hr(c,t,s,a,o,h,m,g,y){for(let v=t;v-1);y++,h[y]=g,m[y]=v,m[y+1]=Ur}for(let g=0,y=0;g65535)throw new Error("glyphs > 65535 not supported");if(a.ranges[h])return{stack:t,id:s,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!a.requests[h]){const g=Ji.loadGlyphRange(t,h,this.url,this.requestManager);a.requests[h]=g}const m=yield a.requests[h];for(const g in m)this._doesCharSupportLocalGlyph(+g)||(a.glyphs[+g]=m[+g]);return a.ranges[h]=!0,{stack:t,id:s,glyph:m[s]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(p.u["CJK Unified Ideographs"](t)||p.u["Hangul Syllables"](t)||p.u.Hiragana(t)||p.u.Katakana(t))}_tinySDF(t,s,a){const o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(a))return;let h=t.tinySDF;if(!h){let g="400";/bold/i.test(s)?g="900":/medium/i.test(s)?g="500":/light/i.test(s)&&(g="200"),h=t.tinySDF=new Ji.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:g})}const m=h.draw(String.fromCharCode(a));return{id:a,bitmap:new p.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ji.loadGlyphRange=function(c,t,s,a){return p._(this,void 0,void 0,function*(){const o=256*t,h=o+255,m=a.transformRequest(s.replace("{fontstack}",c).replace("{range}",`${o}-${h}`),Ut.Glyphs),g=yield p.l(m,new AbortController);if(!g||!g.data)throw new Error(`Could not load glyph range. range: ${t}, ${o}-${h}`);const y={};for(const v of p.n(g.data))y[v.id]=v;return y})},Ji.TinySDF=class{constructor({fontSize:c=24,buffer:t=3,radius:s=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:h="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=s;const g=this.size=c+4*t,y=this._createCanvas(g),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${m} ${h} ${c}px ${o}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(g*g),this.gridInner=new Float64Array(g*g),this.f=new Float64Array(g),this.z=new Float64Array(g+1),this.v=new Uint16Array(g)}_createCanvas(c){const t=document.createElement("canvas");return t.width=t.height=c,t}draw(c){const{width:t,actualBoundingBoxAscent:s,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:h}=this.ctx.measureText(c),m=Math.ceil(s),g=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-o))),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),v=g+2*this.buffer,T=y+2*this.buffer,S=Math.max(v*T,0),E=new Uint8ClampedArray(S),O={data:E,width:v,height:T,glyphWidth:g,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(g===0||y===0)return O;const{ctx:B,buffer:U,gridInner:D,gridOuter:Z}=this;B.clearRect(U,U,g,y),B.fillText(c,U,U+m);const Q=B.getImageData(U,U,g,y);Z.fill(Ur,0,S),D.fill(0,0,S);for(let N=0;N0?ie*ie:0,D[te]=ie<0?ie*ie:0}}hr(Z,0,0,v,T,v,this.f,this.v,this.z),hr(D,U,U,g,y,v,this.f,this.v,this.z);for(let N=0;N1&&(y=t[++g]);const T=Math.abs(v-y.left),S=Math.abs(v-y.right),E=Math.min(T,S);let O;const B=h/a*(o+1);if(y.isDash){const U=o-Math.abs(B);O=Math.sqrt(E*E+U*U)}else O=o-Math.sqrt(E*E+B*B);this.data[m+v]=Math.max(0,Math.min(255,O+128))}}}addRegularDash(t){for(let g=t.length-1;g>=0;--g){const y=t[g],v=t[g+1];y.zeroLength?t.splice(g,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(g,1))}const s=t[0],a=t[t.length-1];s.isDash===a.isDash&&(s.left=a.left-this.width,a.right=s.right+this.width);const o=this.width*this.nextRow;let h=0,m=t[h];for(let g=0;g1&&(m=t[++h]);const y=Math.abs(g-m.left),v=Math.abs(g-m.right),T=Math.min(y,v);this.data[o+g]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(t,s){const a=s?7:0,o=2*a+1;if(this.nextRow+o>this.height)return p.w("LineAtlas out of space"),null;let h=0;for(let g=0;g{s.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Nr]}numActive(){return Object.keys(this.active).length}}const $r=Math.floor(xe.hardwareConcurrency/2);let ur,Oi;function Vi(){return ur||(ur=new Qi),ur}Qi.workerCount=p.B(globalThis)?Math.max(Math.min($r,3),1):1;class ps{constructor(t,s){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=s;const a=this.workerPool.acquire(s);for(let o=0;o{s.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,s){for(const a of this.actors)a.registerMessageHandler(t,s)}}function Tr(){return Oi||(Oi=new ps(Vi(),p.G),Oi.registerMessageHandler("getResource",(c,t,s)=>p.m(t,s))),Oi}function xn(c,t){const s=p.F();return p.H(s,s,[1,1,0]),p.J(s,s,[.5*c.width,.5*c.height,1]),p.K(s,s,c.calculatePosMatrix(t.toUnwrapped()))}function Sr(c,t,s,a,o,h){const m=function(S,E,O){if(S)for(const B of S){const U=E[B];if(U&&U.source===O&&U.type==="fill-extrusion")return!0}else for(const B in E){const U=E[B];if(U.source===O&&U.type==="fill-extrusion")return!0}return!1}(o&&o.layers,t,c.id),g=h.maxPitchScaleFactor(),y=c.tilesIn(a,g,m);y.sort(Ir);const v=[];for(const S of y)v.push({wrappedTileID:S.tileID.wrapped().key,queryResults:S.tile.queryRenderedFeatures(t,s,c._state,S.queryGeometry,S.cameraQueryGeometry,S.scale,o,h,g,xn(c.transform,S.tileID))});const T=function(S){const E={},O={};for(const B of S){const U=B.queryResults,D=B.wrappedTileID,Z=O[D]=O[D]||{};for(const Q in U){const N=U[Q],X=Z[Q]=Z[Q]||{},ee=E[Q]=E[Q]||[];for(const te of N)X[te.featureIndex]||(X[te.featureIndex]=!0,ee.push(te))}}return E}(v);for(const S in T)T[S].forEach(E=>{const O=E.feature,B=c.getFeatureState(O.layer["source-layer"],O.id);O.source=O.layer.source,O.layer["source-layer"]&&(O.sourceLayer=O.layer["source-layer"]),O.state=B});return T}function Ir(c,t){const s=c.tileID,a=t.tileID;return s.overscaledZ-a.overscaledZ||s.canonical.y-a.canonical.y||s.wrap-a.wrap||s.canonical.x-a.canonical.x}function Ar(c,t,s){return p._(this,void 0,void 0,function*(){let a=c;if(c.url?a=(yield p.h(t.transformRequest(c.url,Ut.Source),s)).data:yield xe.frameAsync(s),!a)return null;const o=p.L(p.e(a,c),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map(h=>h.id)),o})}class Mt{constructor(t,s){t&&(s?this.setSouthWest(t).setNorthEast(s):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 p.M?new p.M(t.lng,t.lat):p.M.convert(t),this}setSouthWest(t){return this._sw=t instanceof p.M?new p.M(t.lng,t.lat):p.M.convert(t),this}extend(t){const s=this._sw,a=this._ne;let o,h;if(t instanceof p.M)o=t,h=t;else{if(!(t instanceof Mt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Mt.convert(t)):this.extend(p.M.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(p.M.convert(t)):this;if(o=t._sw,h=t._ne,!o||!h)return this}return s||a?(s.lng=Math.min(o.lng,s.lng),s.lat=Math.min(o.lat,s.lat),a.lng=Math.max(h.lng,a.lng),a.lat=Math.max(h.lat,a.lat)):(this._sw=new p.M(o.lng,o.lat),this._ne=new p.M(h.lng,h.lat)),this}getCenter(){return new p.M((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 p.M(this.getWest(),this.getNorth())}getSouthEast(){return new p.M(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){const{lng:s,lat:a}=p.M.convert(t);let o=this._sw.lng<=s&&s<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=s&&s>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&o}static convert(t){return t instanceof Mt?t:t&&new Mt(t)}static fromLngLat(t,s=0){const a=360*s/40075017,o=a/Math.cos(Math.PI/180*t.lat);return new Mt(new p.M(t.lng-o,t.lat-a),new p.M(t.lng+o,t.lat+a))}}class jr{constructor(t,s,a){this.bounds=Mt.convert(this.validateBounds(t)),this.minzoom=s||0,this.maxzoom=a||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){const s=Math.pow(2,t.z),a=Math.floor(p.N(this.bounds.getWest())*s),o=Math.floor(p.O(this.bounds.getNorth())*s),h=Math.ceil(p.N(this.bounds.getEast())*s),m=Math.ceil(p.O(this.bounds.getSouth())*s);return t.x>=a&&t.x=o&&t.y{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 p.e({},this._options)}loadTile(t){return p._(this,void 0,void 0,function*(){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(s,Ut.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};a.request.collectResourceTiming=this._collectResourceTiming;let o="reloadTile";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((h,m)=>{t.reloadPromise={resolve:h,reject:m}})}else t.actor=this.dispatcher.getActor(),o="loadTile";t.abortController=new AbortController;try{const h=yield t.actor.sendAsync({type:o,data:a},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,h)}catch(h){if(delete t.abortController,t.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,s){if(s&&s.resourceTiming&&(t.resourceTiming=s.resourceTiming),s&&this.map._refreshExpiredTiles&&t.setExpiryData(s),t.loadVectorData(s,this.map.painter),t.reloadPromise){const a=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(a.resolve).catch(a.reject)}}abortTile(t){return p._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"abortTile",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return p._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"removeTile",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class qr extends p.E{constructor(t,s,a,o){super(),this.id=t,this.dispatcher=a,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},s),p.e(this,p.L(s,["url","scheme","tileSize"]))}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Ar(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(p.e(this,t),t.bounds&&(this.tileBounds=new jr(t.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new p.j(t))}})}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()}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 p.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return p._(this,void 0,void 0,function*(){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const a=yield _i.getImage(this.map._requestManager.transformRequest(s,Ut.Tile),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(a&&a.data){this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const o=this.map.painter.context,h=o.gl,m=a.data;t.texture=this.map.painter.getTileTexture(m.width),t.texture?t.texture.update(m,{useMipmap:!0}):(t.texture=new xt(o,m,h.RGBA,{useMipmap:!0}),t.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST),o.extTextureFilterAnisotropic&&h.texParameterf(h.TEXTURE_2D,o.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,o.extTextureFilterAnisotropicMax)),t.state="loaded"}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}})}abortTile(t){return p._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return p._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class Gs extends qr{constructor(t,s,a,o){super(t,s,a,o),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox",this.redFactor=s.redFactor,this.greenFactor=s.greenFactor,this.blueFactor=s.blueFactor,this.baseShift=s.baseShift}loadTile(t){return p._(this,void 0,void 0,function*(){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(s,Ut.Tile);t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const o=yield _i.getImage(a,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(o&&o.data){const h=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const m=p.b(h)&&p.S()?h:yield this.readImageNow(h),g={type:this.type,uid:t.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const y=yield t.actor.sendAsync({type:"loadDEMTile",data:g});t.dem=y,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(o){if(delete t.abortController,t.aborted)t.state="unloaded";else if(o)throw t.state="errored",o}})}readImageNow(t){return p._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&p.U()){const s=t.width+2,a=t.height+2;try{return new p.R({width:s,height:a},yield p.V(t,-1,-1,s,a))}catch{}}return xe.getImageData(t,1)})}_getNeighboringTiles(t){const s=t.canonical,a=Math.pow(2,s.z),o=(s.x-1+a)%a,h=s.x===0?t.wrap-1:t.wrap,m=(s.x+1+a)%a,g=s.x+1===a?t.wrap+1:t.wrap,y={};return y[new p.Q(t.overscaledZ,h,s.z,o,s.y).key]={backfilled:!1},y[new p.Q(t.overscaledZ,g,s.z,m,s.y).key]={backfilled:!1},s.y>0&&(y[new p.Q(t.overscaledZ,h,s.z,o,s.y-1).key]={backfilled:!1},y[new p.Q(t.overscaledZ,t.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},y[new p.Q(t.overscaledZ,g,s.z,m,s.y-1).key]={backfilled:!1}),s.y+10&&p.e(h,{resourceTiming:o}),this.fire(new p.k("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new p.k("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(a){if(this._pendingLoads--,this._removed)return void this.fire(new p.k("dataabort",{dataType:"source"}));this.fire(new p.j(a))}})}loaded(){return this._pendingLoads===0}loadTile(t){return p._(this,void 0,void 0,function*(){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const a={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};t.abortController=new AbortController;const o=yield this.actor.sendAsync({type:s,data:a},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(o,this.map.painter,s==="reloadTile")})}abortTile(t){return p._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return p._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"removeTile",data:{uid:t.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"removeSource",data:{type:this.type,source:this.id}})}serialize(){return p.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Nt=p.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class er extends p.E{constructor(t,s,a,o){super(),this.id=t,this.dispatcher=a,this.coordinates=s.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=s}load(t){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const s=yield _i.getImage(this.map._requestManager.transformRequest(this.url,Ut.Image),this._request);this._request=null,this._loaded=!0,s&&s.data&&(this.image=s.data,t&&(this.coordinates=t),this._finishLoading())}catch(s){this._request=null,this.fire(new p.j(s))}})}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 p.k("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;const s=t.map(p.Y.fromLngLat);this.tileID=function(o){let h=1/0,m=1/0,g=-1/0,y=-1/0;for(const E of o)h=Math.min(h,E.x),m=Math.min(m,E.y),g=Math.max(g,E.x),y=Math.max(y,E.y);const v=Math.max(g-h,y-m),T=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),S=Math.pow(2,T);return new p.a0(T,Math.floor((h+g)/2*S),Math.floor((m+y)/2*S))}(s),this.minzoom=this.maxzoom=this.tileID.z;const a=s.map(o=>this.tileID.getTilePoint(o)._round());return this._boundsArray=new p.Z,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,p.W,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,p.W),this._boundsArray.emplaceBack(a[2].x,a[2].y,p.W,p.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,s=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=p.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new xt(t,this.image,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const h=this.tiles[o];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,a=!0)}a&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return p._(this,void 0,void 0,function*(){this.tileID&&this.tileID.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}}class fs extends er{constructor(t,s,a,o){super(t,s,a,o),this.roundZoom=!0,this.type="video",this.options=s}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const s of t.urls)this.urls.push(this.map._requestManager.transformRequest(s,Ut.Source).url);try{const s=yield p.a2(this.urls);if(this._loaded=!0,!s)return;this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(s){this.fire(new p.j(s))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const s=this.video.seekable;ts.end(0)?this.fire(new p.j(new p.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.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)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,s=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=p.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.video)):(this.texture=new xt(t,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const h=this.tiles[o];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,a=!0)}a&&this.fire(new p.k("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 ms extends er{constructor(t,s,a,o){super(t,s,a,o),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(m=>typeof m!="number"))||this.fire(new p.j(new p.a1(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.j(new p.a1(`sources.${t}`,null,'missing required property "coordinates"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new p.j(new p.a1(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.canvas instanceof HTMLCanvasElement||this.fire(new p.j(new p.a1(`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 p.j(new p.a1(`sources.${t}`,null,'missing required property "canvas"'))),this.options=s,this.animate=s.animate===void 0||s.animate}load(){return p._(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 p.j(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;const s=this.map.painter.context,a=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=p.$.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new xt(s,this.canvas,a.RGBA,{premultiply:!0});let o=!1;for(const h in this.tiles){const m=this.tiles[h];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,o=!0)}o&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const gs={},Zr=c=>{switch(c){case"geojson":return Ke;case"image":return er;case"raster":return qr;case"raster-dem":return Gs;case"vector":return se;case"video":return fs;case"canvas":return ms}return gs[c]},_s="RTLPluginLoaded";class Hs extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Tr()}_syncState(t){return this.status=t,this.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t,pluginURL:this.url}).catch(s=>{throw this.status="error",s})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return p._(this,arguments,void 0,function*(s,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=xe.resolveURL(s),!this.url)throw new Error(`requested url ${s} is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return p._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.k(_s))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ge=null;function yi(){return ge||(ge=new Hs),ge}class oi{constructor(t,s){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=p.a3(),this.uses=0,this.tileSize=s,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const s=t+this.timeAdded;sh.getLayer(v)).filter(Boolean);if(y.length!==0){g.layers=y,g.stateDependentLayerIds&&(g.stateDependentLayers=g.stateDependentLayerIds.map(v=>y.filter(T=>T.id===v)[0]));for(const v of y)m[v.id]=g}}return m}(t.buckets,s.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const h=this.buckets[o];if(h instanceof p.a5){if(this.hasSymbolBuckets=!0,!a)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const h=this.buckets[o];if(h instanceof p.a5&&h.hasRTLText){this.hasRTLText=!0,yi().lazyLoad();break}}this.queryPadding=0;for(const o in this.buckets){const h=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,s.style.getLayer(o).queryRadius(h))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new p.a4}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const o=this.buckets[a];o.uploadPending()&&o.upload(t)}const s=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new xt(t,this.imageAtlas.image,s.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new xt(t,this.glyphAtlasImage,s.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,s,a,o,h,m,g,y,v,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:h,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:g,queryPadding:this.queryPadding*v},t,s,a):{}}querySourceFeatures(t,s){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const o=a.loadVTLayers(),h=s&&s.sourceLayer?s.sourceLayer:"",m=o._geojsonTileLayer||o[h];if(!m)return;const g=p.a6(s&&s.filter),{z:y,x:v,y:T}=this.tileID.canonical,S={z:y,x:v,y:T};for(let E=0;Ea)o=!1;else if(s)if(this.expirationTime{this.remove(t,h)},a)),this.data[o].push(h),this.order.push(o),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const s=this.data[t].shift();return s.timeout&&clearTimeout(s.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),s.value}getByKey(t){const s=this.data[t];return s?s[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,s){if(!this.has(t))return this;const a=t.wrapped().key,o=s===void 0?0:this.data[a].indexOf(s),h=this.data[a][o];return this.data[a].splice(o,1),h.timeout&&clearTimeout(h.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(h.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}filter(t){const s=[];for(const a in this.data)for(const o of this.data[a])t(o.value)||s.push(o);for(const a of s)this.remove(a.value.tileID,a)}}class Gr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,s,a){const o=String(s);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][o]=this.stateChanges[t][o]||{},p.e(this.stateChanges[t][o],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const h in this.state[t])h!==o&&(this.deletedStates[t][h]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][o]===null){this.deletedStates[t][o]={};for(const h in this.state[t][o])a[h]||(this.deletedStates[t][o][h]=null)}else for(const h in a)this.deletedStates[t]&&this.deletedStates[t][o]&&this.deletedStates[t][o][h]===null&&delete this.deletedStates[t][o][h]}removeFeatureState(t,s,a){if(this.deletedStates[t]===null)return;const o=String(s);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&s!==void 0)this.deletedStates[t][o]!==null&&(this.deletedStates[t][o]=this.deletedStates[t][o]||{},this.deletedStates[t][o][a]=null);else if(s!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][o])for(a in this.deletedStates[t][o]={},this.stateChanges[t][o])this.deletedStates[t][o][a]=null;else this.deletedStates[t][o]=null;else this.deletedStates[t]=null}getState(t,s){const a=String(s),o=p.e({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const h=this.deletedStates[t][s];if(h===null)return{};for(const m in h)delete o[m]}return o}initializeTileState(t,s){t.setFeatureState(this.state,s)}coalesceChanges(t,s){const a={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const h={};for(const m in this.stateChanges[o])this.state[o][m]||(this.state[o][m]={}),p.e(this.state[o][m],this.stateChanges[o][m]),h[m]=this.state[o][m];a[o]=h}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const h={};if(this.deletedStates[o]===null)for(const m in this.state[o])h[m]={},this.state[o][m]={};else for(const m in this.deletedStates[o]){if(this.deletedStates[o][m]===null)this.state[o][m]={};else for(const g of Object.keys(this.deletedStates[o][m]))delete this.state[o][m][g];h[m]=this.state[o][m]}a[o]=a[o]||{},p.e(a[o],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const o in t)t[o].setFeatureState(a,s)}}class fe extends p.E{constructor(t,s,a){super(),this.id=t,this.dispatcher=a,this.on("data",o=>{o.dataType==="source"&&o.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&o.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((o,h,m,g)=>{const y=new(Zr(h.type))(o,h,m,g);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(t,s,a,this),this._tiles={},this._cache=new Ws(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Gr,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}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(const t in this._tiles){const s=this._tiles[t];if(s.state!=="loaded"&&s.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,s,a){return p._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,s,a)}catch(o){t.state="errored",o.status!==404?this._source.fire(new p.j(o,{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 p.k("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._tiles,this.map?this.map.painter:null);for(const s in this._tiles){const a=this._tiles[s];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(je).map(t=>t.key)}getRenderableIds(t){const s=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&s.push(this._tiles[a]);return t?s.sort((a,o)=>{const h=a.tileID,m=o.tileID,g=new p.P(h.canonical.x,h.canonical.y)._rotate(this.transform.angle),y=new p.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return h.overscaledZ-m.overscaledZ||y.y-g.y||y.x-g.x}).map(a=>a.tileID.key):s.map(a=>a.tileID).sort(je).map(a=>a.key)}hasRenderableParent(t){const s=this.findLoadedParent(t,0);return!!s&&this._isIdRenderable(s.tileID.key)}_isIdRenderable(t,s){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(s||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,s){return p._(this,void 0,void 0,function*(){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=s),yield this._loadTile(a,t,s))})}_tileLoaded(t,s,a){t.timeAdded=xe.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(s,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new p.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const s=this.getRenderableIds();for(let o=0;o1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),h.dem&&o.dem&&(o.dem.backfillBorder(h.dem,m,g),o.neighboringTiles&&o.neighboringTiles[v]&&(o.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,s,a,o){for(const h in this._tiles){let m=this._tiles[h];if(o[h]||!m.hasData()||m.tileID.overscaledZ<=s||m.tileID.overscaledZ>a)continue;let g=m.tileID;for(;m&&m.tileID.overscaledZ>s+1;){const v=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[v.key],m&&m.hasData()&&(g=v)}let y=g;for(;y.overscaledZ>s;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){o[g.key]=g;break}}}findLoadedParent(t,s){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=s?a:null}for(let a=t.overscaledZ-1;a>=s;a--){const o=t.scaledTo(a),h=this._getLoadedTile(o);if(h)return h}}_getLoadedTile(t){const s=this._tiles[t.key];return s&&s.hasData()?s:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const s=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,o=Math.floor(s*a*(this._maxTileCacheZoomLevels===null?p.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(h)}handleWrapJump(t){const s=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,s){const a={};for(const o in this._tiles){const h=this._tiles[o];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+s),a[h.tileID.key]=h}this._tiles=a;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}update(t,s){if(this.transform=t,this.terrain=s,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new p.Q(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:s}),this._source.hasTile&&(a=a.filter(T=>this._source.hasTile(T)))):a=[];const o=t.coveringZoomLevel(this._source),h=Math.max(o-fe.maxOverzooming,this._source.minzoom),m=Math.max(o+fe.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const T={};for(const S of a)if(S.canonical.z>this._source.minzoom){const E=S.scaledTo(S.canonical.z-1);T[E.key]=E;const O=S.scaledTo(Math.max(this._source.minzoom,Math.min(S.canonical.z,5)));T[O.key]=O}a=a.concat(Object.values(T))}const g=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,g&&this.fire(new p.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(a,o);if(Ve(this._source.type)){const T={},S={},E=Object.keys(y),O=xe.now();for(const B of E){const U=y[B],D=this._tiles[B];if(!D||D.fadeEndTime!==0&&D.fadeEndTime<=O)continue;const Z=this.findLoadedParent(U,h);Z&&(this._addTile(Z.tileID),T[Z.tileID.key]=Z.tileID),S[B]=U}this._retainLoadedChildren(S,o,m,y);for(const B in T)y[B]||(this._coveredTiles[B]=!0,y[B]=T[B]);if(s){const B={},U={};for(const D of a)this._tiles[D.key].hasData()?B[D.key]=D:U[D.key]=D;for(const D in U){const Z=U[D].children(this._source.maxzoom);this._tiles[Z[0].key]&&this._tiles[Z[1].key]&&this._tiles[Z[2].key]&&this._tiles[Z[3].key]&&(B[Z[0].key]=y[Z[0].key]=Z[0],B[Z[1].key]=y[Z[1].key]=Z[1],B[Z[2].key]=y[Z[2].key]=Z[2],B[Z[3].key]=y[Z[3].key]=Z[3],delete U[D])}for(const D in U){const Z=this.findLoadedParent(U[D],this._source.minzoom);if(Z){B[Z.tileID.key]=y[Z.tileID.key]=Z.tileID;for(const Q in B)B[Q].isChildOf(Z.tileID)&&delete B[Q]}}for(const D in this._tiles)B[D]||(this._coveredTiles[D]=!0)}}for(const T in y)this._tiles[T].clearFadeHold();const v=p.ab(this._tiles,y);for(const T of v){const S=this._tiles[T];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,s){const a={},o={},h=Math.max(s-fe.maxOverzooming,this._source.minzoom),m=Math.max(s+fe.maxUnderzooming,this._source.minzoom),g={};for(const y of t){const v=this._addTile(y);a[y.key]=y,v.hasData()||sthis._source.maxzoom){const S=y.children(this._source.maxzoom)[0],E=this.getTile(S);if(E&&E.hasData()){a[S.key]=S;continue}}else{const S=y.children(this._source.maxzoom);if(a[S[0].key]&&a[S[1].key]&&a[S[2].key]&&a[S[3].key])continue}let T=v.wasRequested();for(let S=y.overscaledZ-1;S>=h;--S){const E=y.scaledTo(S);if(o[E.key])break;if(o[E.key]=!0,v=this.getTile(E),!v&&T&&(v=this._addTile(E)),v){const O=v.hasData();if((T||O)&&(a[E.key]=E),T=v.wasRequested(),O)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const s=[];let a,o=this._tiles[t].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){a=this._loadedParentTiles[o.key];break}s.push(o.key);const h=o.scaledTo(o.overscaledZ-1);if(a=this._getLoadedTile(h),a)break;o=h}for(const h of s)this._loadedParentTiles[h]=a}}_addTile(t){let s=this._tiles[t.key];if(s)return s;s=this._cache.getAndRemove(t),s&&(this._setTileReloadTimer(t.key,s),s.tileID=t,this._state.initializeTileState(s,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,s)));const a=s;return s||(s=new oi(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(s,t.key,s.state)),s.uses++,this._tiles[t.key]=s,a||this._source.fire(new p.k("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s}_setTileReloadTimer(t,s){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=s.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const s=this._tiles[t];s&&(s.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),s.uses>0||(s.hasData()&&s.state!=="reloading"?this._cache.add(s.tileID,s,s.getExpiryTimeout()):(s.aborted=!0,this._abortTile(s),this._unloadTile(s))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,s,a){const o=[],h=this.transform;if(!h)return o;const m=a?h.getCameraQueryGeometry(t):t,g=t.map(B=>h.pointCoordinate(B,this.terrain)),y=m.map(B=>h.pointCoordinate(B,this.terrain)),v=this.getIds();let T=1/0,S=1/0,E=-1/0,O=-1/0;for(const B of y)T=Math.min(T,B.x),S=Math.min(S,B.y),E=Math.max(E,B.x),O=Math.max(O,B.y);for(let B=0;B=0&&N[1].y+Q>=0){const X=g.map(te=>D.getTilePoint(te)),ee=y.map(te=>D.getTilePoint(te));o.push({tile:U,tileID:D,queryGeometry:X,cameraQueryGeometry:ee,scale:Z})}}return o}getVisibleCoordinates(t){const s=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of s)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return s}hasTransition(){if(this._source.hasTransition())return!0;if(Ve(this._source.type)){const t=xe.now();for(const s in this._tiles)if(this._tiles[s].fadeEndTime>=t)return!0}return!1}setFeatureState(t,s,a){this._state.updateState(t=t||"_geojsonTileLayer",s,a)}removeFeatureState(t,s,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",s,a)}getFeatureState(t,s){return this._state.getState(t=t||"_geojsonTileLayer",s)}setDependencies(t,s,a){const o=this._tiles[t];o&&o.setDependencies(s,a)}reloadTilesForDependencies(t,s){for(const a in this._tiles)this._tiles[a].hasDependency(t,s)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,s))}}function je(c,t){const s=Math.abs(2*c.wrap)-+(c.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return c.overscaledZ-t.overscaledZ||a-s||t.canonical.y-c.canonical.y||t.canonical.x-c.canonical.x}function Ve(c){return c==="raster"||c==="image"||c==="video"}fe.maxOverzooming=10,fe.maxUnderzooming=3;class $t{constructor(t,s){this.reset(t,s)}reset(t,s){this.points=t||[],this._distances=[0];for(let a=1;a0?(o-m)/g:0;return this.points[h].mult(1-y).add(this.points[s].mult(y))}}function zi(c,t){let s=!0;return c==="always"||c!=="never"&&t!=="never"||(s=!1),s}class Ue{constructor(t,s,a){const o=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(s/a);for(let m=0;mthis.width||o<0||s>this.height)return[];const y=[];if(t<=0&&s<=0&&this.width<=a&&this.height<=o){if(h)return[{key:null,x1:t,y1:s,x2:a,y2:o}];for(let v=0;v0}hitTestCircle(t,s,a,o,h){const m=t-a,g=t+a,y=s-a,v=s+a;if(g<0||m>this.width||v<0||y>this.height)return!1;const T=[];return this._forEachCell(m,y,g,v,this._queryCellCircle,T,{hitTest:!0,overlapMode:o,circle:{x:t,y:s,radius:a},seenUids:{box:{},circle:{}}},h),T.length>0}_queryCell(t,s,a,o,h,m,g,y){const{seenUids:v,hitTest:T,overlapMode:S}=g,E=this.boxCells[h];if(E!==null){const B=this.bboxes;for(const U of E)if(!v.box[U]){v.box[U]=!0;const D=4*U,Z=this.boxKeys[U];if(t<=B[D+2]&&s<=B[D+3]&&a>=B[D+0]&&o>=B[D+1]&&(!y||y(Z))&&(!T||!zi(S,Z.overlapMode))&&(m.push({key:Z,x1:B[D],y1:B[D+1],x2:B[D+2],y2:B[D+3]}),T))return!0}}const O=this.circleCells[h];if(O!==null){const B=this.circles;for(const U of O)if(!v.circle[U]){v.circle[U]=!0;const D=3*U,Z=this.circleKeys[U];if(this._circleAndRectCollide(B[D],B[D+1],B[D+2],t,s,a,o)&&(!y||y(Z))&&(!T||!zi(S,Z.overlapMode))){const Q=B[D],N=B[D+1],X=B[D+2];if(m.push({key:Z,x1:Q-X,y1:N-X,x2:Q+X,y2:N+X}),T)return!0}}}return!1}_queryCellCircle(t,s,a,o,h,m,g,y){const{circle:v,seenUids:T,overlapMode:S}=g,E=this.boxCells[h];if(E!==null){const B=this.bboxes;for(const U of E)if(!T.box[U]){T.box[U]=!0;const D=4*U,Z=this.boxKeys[U];if(this._circleAndRectCollide(v.x,v.y,v.radius,B[D+0],B[D+1],B[D+2],B[D+3])&&(!y||y(Z))&&!zi(S,Z.overlapMode))return m.push(!0),!0}}const O=this.circleCells[h];if(O!==null){const B=this.circles;for(const U of O)if(!T.circle[U]){T.circle[U]=!0;const D=3*U,Z=this.circleKeys[U];if(this._circlesCollide(B[D],B[D+1],B[D+2],v.x,v.y,v.radius)&&(!y||y(Z))&&!zi(S,Z.overlapMode))return m.push(!0),!0}}}_forEachCell(t,s,a,o,h,m,g,y){const v=this._convertToXCellCoord(t),T=this._convertToYCellCoord(s),S=this._convertToXCellCoord(a),E=this._convertToYCellCoord(o);for(let O=v;O<=S;O++)for(let B=T;B<=E;B++)if(h.call(this,t,s,a,o,this.xCellCount*B+O,m,g,y))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,s,a,o,h,m){const g=o-t,y=h-s,v=a+m;return v*v>g*g+y*y}_circleAndRectCollide(t,s,a,o,h,m,g){const y=(m-o)/2,v=Math.abs(t-(o+y));if(v>y+a)return!1;const T=(g-h)/2,S=Math.abs(s-(h+T));if(S>T+a)return!1;if(v<=y||S<=T)return!0;const E=v-y,O=S-T;return E*E+O*O<=a*a}}function Cr(c,t,s,a,o){const h=p.F();return t?(p.J(h,h,[1/o,1/o,1]),s||p.ad(h,h,a.angle)):p.K(h,a.labelPlaneMatrix,c),h}function dr(c,t,s,a,o){if(t){const h=p.ae(c);return p.J(h,h,[o,o,1]),s||p.ad(h,h,-a.angle),h}return a.glCoordMatrix}function F(c,t,s){let a;s?(a=[c.x,c.y,s(c.x,c.y),1],p.af(a,a,t)):(a=[c.x,c.y,0,1],Re(a,a,t));const o=a[3];return{point:new p.P(a[0]/o,a[1]/o),signedDistanceFromCamera:o}}function I(c,t){return .5+c/t*.5}function C(c,t){const s=c[0]/c[3],a=c[1]/c[3];return s>=-t[0]&&s<=t[0]&&a>=-t[1]&&a<=t[1]}function z(c,t,s,a,o,h,m,g,y,v){const T=a?c.textSizeData:c.iconSizeData,S=p.ag(T,s.transform.zoom),E=[256/s.width*2+1,256/s.height*2+1],O=a?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;O.clear();const B=c.lineVertexArray,U=a?c.text.placedSymbolArray:c.icon.placedSymbolArray,D=s.transform.width/s.transform.height;let Z=!1;for(let Q=0;QMath.abs(s.x-t.x)*a?{useVertical:!0}:(c===p.ah.vertical?t.ys.x)?{needsFlipping:!0}:null}function H(c,t,s,a,o,h,m,g,y,v,T,S,E,O,B,U){const D=t/24,Z=c.lineOffsetX*D,Q=c.lineOffsetY*D;let N;if(c.numGlyphs>1){const X=c.glyphStartIndex+c.numGlyphs,ee=c.lineStartIndex,te=c.lineStartIndex+c.lineLength,ie=R(D,g,Z,Q,s,T,S,c,y,h,E,B,U);if(!ie)return{notEnoughRoom:!0};const de=F(ie.first.point,m,U).point,ce=F(ie.last.point,m,U).point;if(a&&!s){const ue=G(c.writingMode,de,ce,O);if(ue)return ue}N=[ie.first];for(let ue=c.glyphStartIndex+1;ue0?de.point:K(S,ie,ee,1,o,U),ue=G(c.writingMode,ee,ce,O);if(ue)return ue}const X=ne(D*g.getoffsetX(c.glyphStartIndex),Z,Q,s,T,S,c.segment,c.lineStartIndex,c.lineStartIndex+c.lineLength,y,h,E,B,U);if(!X)return{notEnoughRoom:!0};N=[X]}for(const X of N)p.aj(v,X.point,X.angle);return{}}function K(c,t,s,a,o,h){const m=F(c.add(c.sub(t)._unit()),o,h).point,g=s.sub(m);return s.add(g._mult(a/g.mag()))}function q(c,t){const{projectionCache:s,lineVertexArray:a,labelPlaneMatrix:o,tileAnchorPoint:h,distanceFromAnchor:m,getElevation:g,previousVertex:y,direction:v,absOffsetX:T}=t;if(s.projections[c])return s.projections[c];const S=new p.P(a.getx(c),a.gety(c)),E=F(S,o,g);if(E.signedDistanceFromCamera>0)return s.projections[c]=E.point,E.point;const O=c-v;return K(m===0?h:new p.P(a.getx(O),a.gety(O)),S,y,T-m+1,o,g)}function J(c,t,s){return c._unit()._perp()._mult(t*s)}function he(c,t,s,a,o,h,m,g){const{projectionCache:y,direction:v}=g;if(y.offsets[c])return y.offsets[c];const T=s.add(t);if(c+v=o)return y.offsets[c]=T,T;const S=q(c+v,g),E=J(S.sub(s),m,v),O=s.add(E),B=S.add(E);return y.offsets[c]=p.ak(h,T,O,B)||T,y.offsets[c]}function ne(c,t,s,a,o,h,m,g,y,v,T,S,E,O){const B=a?c-t:c+t;let U=B>0?1:-1,D=0;a&&(U*=-1,D=Math.PI),U<0&&(D+=Math.PI);let Z,Q,N=U>0?g+m:g+m+1,X=o,ee=o,te=0,ie=0;const de=Math.abs(B),ce=[];let ue;for(;te+ie<=de;){if(N+=U,N=y)return null;te+=ie,ee=X,Q=Z;const _e={projectionCache:S,lineVertexArray:v,labelPlaneMatrix:T,tileAnchorPoint:h,distanceFromAnchor:te,getElevation:O,previousVertex:ee,direction:U,absOffsetX:de};if(X=q(N,_e),s===0)ce.push(ee),ue=X.sub(ee);else{let Le;const $e=X.sub(ee);Le=$e.mag()===0?J(q(N+U,_e).sub(X),s,U):J($e,s,U),Q||(Q=ee.add(Le)),Z=he(N,Le,X,g,y,Q,s,_e),ce.push(Q),ue=Z.sub(Q)}ie=ue.mag()}const Se=ue._mult((de-te)/ie)._add(Q||ee),Oe=D+Math.atan2(X.y-ee.y,X.x-ee.x);return ce.push(Se),{point:Se,angle:E?Oe:0,path:ce}}const oe=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Pe(c,t){for(let s=0;s=1;qe--)$e.push(_e.path[qe]);for(let qe=1;qeF(Ze,y,B));$e=qe.some(Ze=>Ze.signedDistanceFromCamera<=0)?[]:qe.map(Ze=>Ze.point)}let Be=[];if($e.length>0){const qe=$e[0].clone(),Ze=$e[0].clone();for(let mt=1;mt<$e.length;mt++)qe.x=Math.min(qe.x,$e[mt].x),qe.y=Math.min(qe.y,$e[mt].y),Ze.x=Math.max(Ze.x,$e[mt].x),Ze.y=Math.max(Ze.y,$e[mt].y);Be=qe.x>=ue.x&&Ze.x<=Se.x&&qe.y>=ue.y&&Ze.y<=Se.y?[$e]:Ze.xSe.x||Ze.ySe.y?[]:p.al([$e],ue.x,ue.y,Se.x,Se.y)}for(const qe of Be){Oe.reset(qe,.25*ce);let Ze=0;Ze=Oe.length<=.5*ce?1:Math.ceil(Oe.paddedLength/We)+1;for(let mt=0;mt=this.screenRightBoundary||othis.screenBottomBoundary}isInsideGrid(t,s,a,o){return a>=0&&t=0&&sa.collisionGroupID===s}}return this.collisionGroups[t]}}function li(c,t,s,a,o){const{horizontalAlign:h,verticalAlign:m}=p.at(c);return new p.P(-(h-.5)*t+a[0]*o,-(m-.5)*s+a[1]*o)}function Zt(c,t,s,a,o,h){const{x1:m,x2:g,y1:y,y2:v,anchorPointX:T,anchorPointY:S}=c,E=new p.P(t,s);return a&&E._rotate(o?h:-h),{x1:m+E.x,y1:y+E.y,x2:g+E.x,y2:v+E.y,anchorPointX:T,anchorPointY:S}}class Jt{constructor(t,s,a,o,h){this.transform=t.clone(),this.terrain=s,this.collisionIndex=new Ye(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Ft(o),this.collisionCircleArrays={},this.prevPlacement=h,h&&(h.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,s,a,o){const h=a.getBucket(s),m=a.latestFeatureIndex;if(!h||!m||s.id!==h.layerIds[0])return;const g=a.collisionBoxArray,y=h.layers[0].layout,v=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),T=a.tileSize/p.W,S=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),E=y.get("text-pitch-alignment")==="map",O=y.get("text-rotation-alignment")==="map",B=Fe(a,1,this.transform.zoom),U=Cr(S,E,O,this.transform,B);let D=null;if(E){const Q=dr(S,E,O,this.transform,B);D=p.K([],this.transform.labelPlaneMatrix,Q)}this.retainedQueryData[h.bucketInstanceId]=new gt(h.bucketInstanceId,m,h.sourceLayerIndex,h.index,a.tileID);const Z={bucket:h,layout:y,posMatrix:S,textLabelPlaneMatrix:U,labelToScreenMatrix:D,scale:v,textPixelRatio:T,holdingForFade:a.holdingForFade(),collisionBoxArray:g,partiallyEvaluatedTextSize:p.ag(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(o)for(const Q of h.sortKeyRanges){const{sortKey:N,symbolInstanceStart:X,symbolInstanceEnd:ee}=Q;t.push({sortKey:N,symbolInstanceStart:X,symbolInstanceEnd:ee,parameters:Z})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:Z})}attemptAnchorPlacement(t,s,a,o,h,m,g,y,v,T,S,E,O,B,U,D){const Z=p.ap[t.textAnchor],Q=[t.textOffset0,t.textOffset1],N=li(Z,a,o,Q,h),X=this.collisionIndex.placeCollisionBox(Zt(s,N.x,N.y,m,g,this.transform.angle),S,y,v,T.predicate,D);if((!U||this.collisionIndex.placeCollisionBox(Zt(U,N.x,N.y,m,g,this.transform.angle),S,y,v,T.predicate,D).box.length!==0)&&X.box.length>0){let ee;if(this.prevPlacement&&this.prevPlacement.variableOffsets[E.crossTileID]&&this.prevPlacement.placements[E.crossTileID]&&this.prevPlacement.placements[E.crossTileID].text&&(ee=this.prevPlacement.variableOffsets[E.crossTileID].anchor),E.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[E.crossTileID]={textOffset:Q,width:a,height:o,anchor:Z,textBoxScale:h,prevAnchor:ee},this.markUsedJustification(O,Z,E,B),O.allowVerticalPlacement&&(this.markUsedOrientation(O,B,E),this.placedOrientations[E.crossTileID]=B),{shift:N,placedGlyphBoxes:X}}}placeLayerBucketPart(t,s,a){const{bucket:o,layout:h,posMatrix:m,textLabelPlaneMatrix:g,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:T,collisionBoxArray:S,partiallyEvaluatedTextSize:E,collisionGroup:O}=t.parameters,B=h.get("text-optional"),U=h.get("icon-optional"),D=p.aq(h,"text-overlap","text-allow-overlap"),Z=D==="always",Q=p.aq(h,"icon-overlap","icon-allow-overlap"),N=Q==="always",X=h.get("text-rotation-alignment")==="map",ee=h.get("text-pitch-alignment")==="map",te=h.get("icon-text-fit")!=="none",ie=h.get("symbol-z-order")==="viewport-y",de=Z&&(N||!o.hasIconData()||U),ce=N&&(Z||!o.hasTextData()||B);!o.collisionArrays&&S&&o.deserializeCollisionBoxes(S);const ue=this.retainedQueryData[o.bucketInstanceId].tileID,Se=this.terrain?(_e,Le)=>this.terrain.getElevation(ue,_e,Le):null,Oe=(_e,Le)=>{var $e,We;if(s[_e.crossTileID])return;if(T)return void(this.placements[_e.crossTileID]=new Tt(!1,!1,!1));let Be=!1,qe=!1,Ze=!0,mt=null,at={box:null,offscreen:null},ui={box:null,offscreen:null},Pt=null,lt=null,Ht=null,ji=0,nr=0,rs=0;Le.textFeatureIndex?ji=Le.textFeatureIndex:_e.useRuntimeCollisionCircles&&(ji=_e.featureIndex),Le.verticalTextFeatureIndex&&(nr=Le.verticalTextFeatureIndex);const ss=Le.textBox;if(ss){const yt=pt=>{let Vt=p.ah.horizontal;if(o.allowVerticalPlacement&&!pt&&this.prevPlacement){const Si=this.prevPlacement.placedOrientations[_e.crossTileID];Si&&(this.placedOrientations[_e.crossTileID]=Si,Vt=Si,this.markUsedOrientation(o,Vt,_e))}return Vt},ut=(pt,Vt)=>{if(o.allowVerticalPlacement&&_e.numVerticalGlyphVertices>0&&Le.verticalTextBox){for(const Si of o.writingModes)if(Si===p.ah.vertical?(at=Vt(),ui=at):at=pt(),at&&at.box&&at.box.length)break}else at=pt()},wt=_e.textAnchorOffsetStartIndex,Fs=_e.textAnchorOffsetEndIndex;if(Fs===wt){const pt=(Vt,Si)=>{const He=this.collisionIndex.placeCollisionBox(Vt,D,v,m,O.predicate,Se);return He&&He.box&&He.box.length&&(this.markUsedOrientation(o,Si,_e),this.placedOrientations[_e.crossTileID]=Si),He};ut(()=>pt(ss,p.ah.horizontal),()=>{const Vt=Le.verticalTextBox;return o.allowVerticalPlacement&&_e.numVerticalGlyphVertices>0&&Vt?pt(Vt,p.ah.vertical):{box:null,offscreen:null}}),yt(at&&at.box&&at.box.length)}else{let pt=p.ap[(We=($e=this.prevPlacement)===null||$e===void 0?void 0:$e.variableOffsets[_e.crossTileID])===null||We===void 0?void 0:We.anchor];const Vt=(He,Xa,el)=>{const ns=He.x2-He.x1,as=He.y2-He.y1,Hn=_e.textBoxScale,Ka=te&&Q==="never"?Xa:null;let os={box:[],offscreen:!1},tl=D==="never"?1:2,Ya="never";pt&&tl++;for(let il=0;ilVt(ss,Le.iconBox,p.ah.horizontal),()=>{const He=Le.verticalTextBox;return o.allowVerticalPlacement&&!(at&&at.box&&at.box.length)&&_e.numVerticalGlyphVertices>0&&He?Vt(He,Le.verticalIconBox,p.ah.vertical):{box:null,offscreen:null}}),at&&(Be=at.box,Ze=at.offscreen);const Si=yt(at&&at.box);if(!Be&&this.prevPlacement){const He=this.prevPlacement.variableOffsets[_e.crossTileID];He&&(this.variableOffsets[_e.crossTileID]=He,this.markUsedJustification(o,He.anchor,_e,Si))}}}if(Pt=at,Be=Pt&&Pt.box&&Pt.box.length>0,Ze=Pt&&Pt.offscreen,_e.useRuntimeCollisionCircles){const yt=o.text.placedSymbolArray.get(_e.centerJustifiedTextSymbolIndex),ut=p.ai(o.textSizeData,E,yt),wt=h.get("text-padding");lt=this.collisionIndex.placeCollisionCircles(D,yt,o.lineVertexArray,o.glyphOffsetArray,ut,m,g,y,a,ee,O.predicate,_e.collisionCircleDiameter,wt,Se),lt.circles.length&<.collisionDetected&&!a&&p.w("Collisions detected, but collision boxes are not shown"),Be=Z||lt.circles.length>0&&!lt.collisionDetected,Ze=Ze&<.offscreen}if(Le.iconFeatureIndex&&(rs=Le.iconFeatureIndex),Le.iconBox){const yt=ut=>{const wt=te&&mt?Zt(ut,mt.x,mt.y,X,ee,this.transform.angle):ut;return this.collisionIndex.placeCollisionBox(wt,Q,v,m,O.predicate,Se)};ui&&ui.box&&ui.box.length&&Le.verticalIconBox?(Ht=yt(Le.verticalIconBox),qe=Ht.box.length>0):(Ht=yt(Le.iconBox),qe=Ht.box.length>0),Ze=Ze&&Ht.offscreen}const ar=B||_e.numHorizontalGlyphVertices===0&&_e.numVerticalGlyphVertices===0,qi=U||_e.numIconVertices===0;if(ar||qi?qi?ar||(qe=qe&&Be):Be=qe&&Be:qe=Be=qe&&Be,Be&&Pt&&Pt.box&&this.collisionIndex.insertCollisionBox(Pt.box,D,h.get("text-ignore-placement"),o.bucketInstanceId,ui&&ui.box&&nr?nr:ji,O.ID),qe&&Ht&&this.collisionIndex.insertCollisionBox(Ht.box,Q,h.get("icon-ignore-placement"),o.bucketInstanceId,rs,O.ID),lt&&(Be&&this.collisionIndex.insertCollisionCircles(lt.circles,D,h.get("text-ignore-placement"),o.bucketInstanceId,ji,O.ID),a)){const yt=o.bucketInstanceId;let ut=this.collisionCircleArrays[yt];ut===void 0&&(ut=this.collisionCircleArrays[yt]=new Ne);for(let wt=0;wt=0;--Le){const $e=_e[Le];Oe(o.symbolInstances.get($e),o.collisionArrays[$e])}}else for(let _e=t.symbolInstanceStart;_e=0&&(t.text.placedSymbolArray.get(g).crossTileID=h>=0&&g!==h?0:a.crossTileID)}markUsedOrientation(t,s,a){const o=s===p.ah.horizontal||s===p.ah.horizontalOnly?s:0,h=s===p.ah.vertical?s:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const g of m)t.text.placedSymbolArray.get(g).placedOrientation=o;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const s=this.prevPlacement;let a=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;const o=s?s.symbolFadeChange(t):1,h=s?s.opacities:{},m=s?s.variableOffsets:{},g=s?s.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],T=h[y];T?(this.opacities[y]=new st(T,o,v.text,v.icon),a=a||v.text!==T.text.placed||v.icon!==T.icon.placed):(this.opacities[y]=new st(null,o,v.text,v.icon,v.skipFade),a=a||v.text||v.icon)}for(const y in h){const v=h[y];if(!this.opacities[y]){const T=new st(v,o,!1,!1);T.isHidden()||(this.opacities[y]=T,a=a||v.text.placed||v.icon.placed)}}for(const y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(const y in g)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=g[y]);if(s&&s.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=s?s.lastPlacementChangeTime:t)}updateLayerOpacities(t,s){const a={};for(const o of s){const h=o.getBucket(t);h&&o.latestFeatureIndex&&t.id===h.layerIds[0]&&this.updateBucketOpacities(h,a,o.collisionBoxArray)}}updateBucketOpacities(t,s,a){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();const o=t.layers[0],h=o.layout,m=new st(null,0,!1,!1,!0),g=h.get("text-allow-overlap"),y=h.get("icon-allow-overlap"),v=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),T=h.get("text-rotation-alignment")==="map",S=h.get("text-pitch-alignment")==="map",E=h.get("icon-text-fit")!=="none",O=new st(null,0,g&&(y||!t.hasIconData()||h.get("icon-optional")),y&&(g||!t.hasTextData()||h.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const B=(U,D,Z)=>{for(let Q=0;Q0,te=this.placedOrientations[D.crossTileID],ie=te===p.ah.vertical,de=te===p.ah.horizontal||te===p.ah.horizontalOnly;if(Z>0||Q>0){const ce=_o(X.text);B(t.text,Z,ie?Gt:ce),B(t.text,Q,de?Gt:ce);const ue=X.text.isHidden();[D.rightJustifiedTextSymbolIndex,D.centerJustifiedTextSymbolIndex,D.leftJustifiedTextSymbolIndex].forEach(_e=>{_e>=0&&(t.text.placedSymbolArray.get(_e).hidden=ue||ie?1:0)}),D.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(D.verticalPlacedTextSymbolIndex).hidden=ue||de?1:0);const Se=this.variableOffsets[D.crossTileID];Se&&this.markUsedJustification(t,Se.anchor,D,te);const Oe=this.placedOrientations[D.crossTileID];Oe&&(this.markUsedJustification(t,"left",D,Oe),this.markUsedOrientation(t,Oe,D))}if(ee){const ce=_o(X.icon),ue=!(E&&D.verticalPlacedIconSymbolIndex&&ie);D.placedIconSymbolIndex>=0&&(B(t.icon,D.numIconVertices,ue?ce:Gt),t.icon.placedSymbolArray.get(D.placedIconSymbolIndex).hidden=X.icon.isHidden()),D.verticalPlacedIconSymbolIndex>=0&&(B(t.icon,D.numVerticalIconVertices,ue?Gt:ce),t.icon.placedSymbolArray.get(D.verticalPlacedIconSymbolIndex).hidden=X.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ce=t.collisionArrays[U];if(ce){let ue=new p.P(0,0);if(ce.textBox||ce.verticalTextBox){let Oe=!0;if(v){const _e=this.variableOffsets[N];_e?(ue=li(_e.anchor,_e.width,_e.height,_e.textOffset,_e.textBoxScale),T&&ue._rotate(S?this.transform.angle:-this.transform.angle)):Oe=!1}ce.textBox&&xi(t.textCollisionBox.collisionVertexArray,X.text.placed,!Oe||ie,ue.x,ue.y),ce.verticalTextBox&&xi(t.textCollisionBox.collisionVertexArray,X.text.placed,!Oe||de,ue.x,ue.y)}const Se=!!(!de&&ce.verticalIconBox);ce.iconBox&&xi(t.iconCollisionBox.collisionVertexArray,X.icon.placed,Se,E?ue.x:0,E?ue.y:0),ce.verticalIconBox&&xi(t.iconCollisionBox.collisionVertexArray,X.icon.placed,!Se,E?ue.x:0,E?ue.y:0)}}}if(t.sortFeatures(this.transform.angle),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`);if(t.bucketInstanceId in this.collisionCircleArrays){const U=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=U.invProjMatrix,t.placementViewportMatrix=U.viewportMatrix,t.collisionCircleArray=U.circles,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.lastPlacementChangeTimet}setStale(){this.stale=!0}}function xi(c,t,s,a,o){c.emplaceBack(t?1:0,s?1:0,a||0,o||0),c.emplaceBack(t?1:0,s?1:0,a||0,o||0),c.emplaceBack(t?1:0,s?1:0,a||0,o||0),c.emplaceBack(t?1:0,s?1:0,a||0,o||0)}const go=Math.pow(2,25),Il=Math.pow(2,24),it=Math.pow(2,17),aa=Math.pow(2,16),oa=Math.pow(2,9),vi=Math.pow(2,8),bi=Math.pow(2,1);function _o(c){if(c.opacity===0&&!c.placed)return 0;if(c.opacity===1&&c.placed)return 4294967295;const t=c.placed?1:0,s=Math.floor(127*c.opacity);return s*go+t*Il+s*it+t*aa+s*oa+t*vi+s*bi+t}const Gt=0;class ki{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,s,a,o,h){const m=this._bucketParts;for(;this._currentTileIndexg.sortKey-y.sortKey));this._currentPartIndex!this._forceFullPlacement&&xe.now()-o>2;for(;this._currentPlacementIndex>=0;){const m=s[t[this._currentPlacementIndex]],g=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=g)&&(!m.maxzoom||m.maxzoom>g)){if(this._inProgressLayer||(this._inProgressLayer=new ki(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Pr=512/p.W/2;class Ct{constructor(t,s,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const o=new Map;for(let h=0;h({x:Math.floor(y.anchorX*Pr),y:Math.floor(y.anchorY*Pr)})),crossTileIDs:m.map(y=>y.crossTileID)};if(g.positions.length>128){const y=new p.au(g.positions.length,16,Uint16Array);for(const{x:v,y:T}of g.positions)y.add(v,T);y.finish(),delete g.positions,g.index=y}this._symbolsByKey[h]=g}}getScaledCoordinates(t,s){const{x:a,y:o,z:h}=this.tileID.canonical,{x:m,y:g,z:y}=s.canonical,v=Pr/Math.pow(2,y-h),T=(g*p.W+t.anchorY)*v,S=o*p.W*Pr;return{x:Math.floor((m*p.W+t.anchorX)*v-a*p.W*Pr),y:Math.floor(T-S)}}findMatches(t,s,a){const o=this.tileID.canonical.zt)}}class Xs{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Hr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const s=Math.round((t-this.lng)/360);if(s!==0)for(const a in this.indexes){const o=this.indexes[a],h={};for(const m in o){const g=o[m];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+s),h[g.tileID.key]=g}this.indexes[a]=h}this.lng=t}addBucket(t,s,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let h=0;ht.overscaledZ)for(const g in m){const y=m[g];y.tileID.isChildOf(t)&&y.findMatches(s.symbolInstances,t,o)}else{const g=m[t.scaledTo(Number(h)).key];g&&g.findMatches(s.symbolInstances,t,o)}}for(let h=0;h{s[a]=!0});for(const a in this.layerIndexes)s[a]||delete this.layerIndexes[a]}}const Wr=(c,t)=>p.t(c,t&&t.filter(s=>s.identifier!=="source.canvas")),Ui=p.av();class vn extends p.E{constructor(t,s={}){super(),this._rtlPluginLoaded=()=>{for(const a in this.sourceCaches){const o=this.sourceCaches[a].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[a].reload()}},this.map=t,this.dispatcher=new ps(Vi(),t._getMapId()),this.dispatcher.registerMessageHandler("getGlyphs",(a,o)=>this.getGlyphs(a,o)),this.dispatcher.registerMessageHandler("getImages",(a,o)=>this.getImages(a,o)),this.imageManager=new Fi,this.imageManager.setEventedParent(this),this.glyphManager=new Ji(t._requestManager,s.localIdeographFontFamily),this.lineAtlas=new ai(256,512),this.crossTileSymbolIndex=new vt,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new p.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",p.ax()),yi().on(_s,this._rtlPluginLoaded),this.on("data",a=>{if(a.dataType!=="source"||a.sourceDataType!=="metadata")return;const o=this.sourceCaches[a.sourceId];if(!o)return;const h=o.getSource();if(h&&h.vectorLayerIds)for(const m in this._layers){const g=this._layers[m];g.source===h.id&&this._validateLayer(g)}})}loadURL(t,s={},a){this.fire(new p.k("dataloading",{dataType:"style"})),s.validate=typeof s.validate!="boolean"||s.validate;const o=this.map._requestManager.transformRequest(t,Ut.Style);this._loadStyleRequest=new AbortController,p.h(o,this._loadStyleRequest).then(h=>{this._loadStyleRequest=null,this._load(h.data,s,a)}).catch(h=>{this._loadStyleRequest=null,h&&this.fire(new p.j(h))})}loadJSON(t,s={},a){this.fire(new p.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,xe.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,s.validate=s.validate!==!1,this._load(t,s,a)}).catch(()=>{})}loadEmpty(){this.fire(new p.k("dataloading",{dataType:"style"})),this._load(Ui,{validate:!1})}_load(t,s,a){var o;const h=s.transformStyle?s.transformStyle(a,t):t;if(!s.validate||!Wr(this,p.x(h))){this._loaded=!0,this.stylesheet=h;for(const m in h.sources)this.addSource(m,h.sources[m],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs),this._createLayers(),this.light=new ni(this.stylesheet.light),this.map.setTerrain((o=this.stylesheet.terrain)!==null&&o!==void 0?o:null),this.fire(new p.k("data",{dataType:"style"})),this.fire(new p.k("style.load"))}}_createLayers(){const t=p.ay(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(s=>s.id),this._layers={},this._serializedLayers=null;for(const s of t){const a=p.az(s);a.setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=a}}_loadSprite(t,s=!1,a=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,m,g,y){return p._(this,void 0,void 0,function*(){const v=si(h),T=g>1?"@2x":"",S={},E={};for(const{id:O,url:B}of v){const U=m.transformRequest(m.normalizeSpriteURL(B,T,".json"),Ut.SpriteJSON);S[O]=p.h(U,y);const D=m.transformRequest(m.normalizeSpriteURL(B,T,".png"),Ut.SpriteImage);E[O]=_i.getImage(D,y)}return yield Promise.all([...Object.values(S),...Object.values(E)]),function(O,B){return p._(this,void 0,void 0,function*(){const U={};for(const D in O){U[D]={};const Z=xe.getImageCanvasContext((yield B[D]).data),Q=(yield O[D]).data;for(const N in Q){const{width:X,height:ee,x:te,y:ie,sdf:de,pixelRatio:ce,stretchX:ue,stretchY:Se,content:Oe}=Q[N];U[D][N]={data:null,pixelRatio:ce,sdf:de,stretchX:ue,stretchY:Se,content:Oe,spriteData:{width:X,height:ee,x:te,y:ie,context:Z}}}}return U})}(S,E)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const m in h){this._spritesImagesIds[m]=[];const g=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in h)):[];for(const y of g)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in h[m]){const v=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(v),v in this.imageManager.images?this.imageManager.updateImage(v,h[m][y],!1):this.imageManager.addImage(v,h[m][y]),s&&(this._changedImages[v]=!0)}}}).catch(h=>{this._spriteRequest=null,o=h,this.fire(new p.j(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),s&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new p.k("data",{dataType:"style"})),a&&a(o)})}_unloadSprite(){for(const 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("setImages",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}_validateLayer(t){const s=this.sourceCaches[t.source];if(!s)return;const a=t.sourceLayer;if(!a)return;const o=s.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(a)===-1)&&this.fire(new p.j(new Error(`Source layer "${a}" does not exist on source "${o.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const s=this._serializedAllLayers();if(!t||t.length===0)return Object.values(s);const a=[];for(const o of t)s[o]&&a.push(s[o]);return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const s=Object.keys(this._layers);for(const a of s){const o=this._layers[a];o.type!=="custom"&&(t[a]=o.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const s=this._changed;if(this._changed){const o=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(o.length||h.length)&&this._updateWorkerLayers(o,h);for(const m in this._updatedSources){const g=this._updatedSources[m];if(g==="reload")this._reloadSource(m);else{if(g!=="clear")throw new Error(`Invalid action ${g}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const o in this.sourceCaches){const h=this.sourceCaches[o];a[o]=h.used,h.used=!1}for(const o of this._order){const h=this._layers[o];h.recalculate(t,this._availableImages),!h.isHidden(t.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}for(const o in a){const h=this.sourceCaches[o];a[o]!==h.used&&h.fire(new p.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(t),this.z=t.zoom,s&&this.fire(new p.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,s){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:s})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,s={}){var a;this._checkLoaded();const o=this.serialize();if(t=s.transformStyle?s.transformStyle(o,t):t,((a=s.validate)===null||a===void 0||a)&&Wr(this,p.x(t)))return!1;(t=p.aA(t)).layers=p.ay(t.layers);const h=p.aB(o,t),m=this._getOperationsToPerform(h);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(const g of m.operations)g();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const s=[],a=[];for(const o of t)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":s.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":s.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":s.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":s.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":s.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":s.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":s.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":s.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":s.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":s.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":s.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":s.push(()=>this.setSprite.apply(this,o.args));break;case"setTerrain":s.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setTransition":s.push(()=>{});break;default:a.push(o.command)}return{operations:s,unimplemented:a}}addImage(t,s){if(this.getImage(t))return this.fire(new p.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,s),this._afterImageUpdated(t)}updateImage(t,s){this.imageManager.updateImage(t,s)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new p.j(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("setImages",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,s,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!s.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(s).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(s.type)>=0&&this._validate(p.x.source,`sources.${t}`,s,null,a))return;this.map&&this.map._collectResourceTiming&&(s.collectResourceTiming=!0);const o=this.sourceCaches[t]=new fe(t,s,this.dispatcher);o.style=this,o.setEventedParent(this,()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:t})),o.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new p.j(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const s=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],s.fire(new p.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),s.setEventedParent(null),s.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,s){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(s),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,s,a={}){this._checkLoaded();const o=t.id;if(this.getLayer(o))return void this.fire(new p.j(new Error(`Layer "${o}" already exists on this map.`)));let h;if(t.type==="custom"){if(Wr(this,p.aC(t)))return;h=p.az(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(o,t.source),t=p.aA(t),t=p.e(t,{source:o})),this._validate(p.x.layer,`layers.${o}`,t,{arrayIndex:-1},a))return;h=p.az(t),this._validateLayer(h),h.setEventedParent(this,{layer:{id:o}})}const m=s?this._order.indexOf(s):this._order.length;if(s&&m===-1)this.fire(new p.j(new Error(`Cannot add layer "${o}" before non-existing layer "${s}".`)));else{if(this._order.splice(m,0,o),this._layerOrderChanged=!0,this._layers[o]=h,this._removedLayers[o]&&h.source&&h.type!=="custom"){const g=this._removedLayers[o];delete this._removedLayers[o],g.type!==h.type?this._updatedSources[h.source]="clear":(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause())}this._updateLayer(h),h.onAdd&&h.onAdd(this.map)}}moveLayer(t,s){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new p.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===s)return;const a=this._order.indexOf(t);this._order.splice(a,1);const o=s?this._order.indexOf(s):this._order.length;s&&o===-1?this.fire(new p.j(new Error(`Cannot move layer "${t}" before non-existing layer "${s}".`))):(this._order.splice(o,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const s=this._layers[t];if(!s)return void this.fire(new p.j(new Error(`Cannot remove non-existing layer "${t}".`)));s.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=s,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],s.onRemove&&s.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,s,a){this._checkLoaded();const o=this.getLayer(t);o?o.minzoom===s&&o.maxzoom===a||(s!=null&&(o.minzoom=s),a!=null&&(o.maxzoom=a),this._updateLayer(o)):this.fire(new p.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,s,a={}){this._checkLoaded();const o=this.getLayer(t);if(o){if(!p.aD(o.filter,s))return s==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(p.x.filter,`layers.${o.id}.filter`,s,null,a)||(o.filter=p.aA(s),this._updateLayer(o)))}else this.fire(new p.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return p.aA(this.getLayer(t).filter)}setLayoutProperty(t,s,a,o={}){this._checkLoaded();const h=this.getLayer(t);h?p.aD(h.getLayoutProperty(s),a)||(h.setLayoutProperty(s,a,o),this._updateLayer(h)):this.fire(new p.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,s){const a=this.getLayer(t);if(a)return a.getLayoutProperty(s);this.fire(new p.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,s,a,o={}){this._checkLoaded();const h=this.getLayer(t);h?p.aD(h.getPaintProperty(s),a)||(h.setPaintProperty(s,a,o)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new p.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,s){return this.getLayer(t).getPaintProperty(s)}setFeatureState(t,s){this._checkLoaded();const a=t.source,o=t.sourceLayer,h=this.sourceCaches[a];if(h===void 0)return void this.fire(new p.j(new Error(`The source '${a}' does not exist in the map's style.`)));const m=h.getSource().type;m==="geojson"&&o?this.fire(new p.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||o?(t.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),h.setFeatureState(o,t.id,s)):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,s){this._checkLoaded();const a=t.source,o=this.sourceCaches[a];if(o===void 0)return void this.fire(new p.j(new Error(`The source '${a}' does not exist in the map's style.`)));const h=o.getSource().type,m=h==="vector"?t.sourceLayer:void 0;h!=="vector"||m?s&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new p.j(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(m,t.id,s):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const s=t.source,a=t.sourceLayer,o=this.sourceCaches[s];if(o!==void 0)return o.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),o.getFeatureState(a,t.id)):void this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.j(new Error(`The source '${s}' does not exist in the map's style.`)))}getTransition(){return p.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=p.aE(this.sourceCaches,h=>h.serialize()),s=this._serializeByIds(this._order),a=this.map.getTerrain()||void 0,o=this.stylesheet;return p.aF({version:o.version,name:o.name,metadata:o.metadata,light:o.light,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:t,layers:s,terrain:a},h=>h!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const s=m=>this._layers[m].type==="fill-extrusion",a={},o=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(s(g)){a[g]=m;for(const y of t){const v=y[g];if(v)for(const T of v)o.push(T)}}}o.sort((m,g)=>g.intersectionZ-m.intersectionZ);const h=[];for(let m=this._order.length-1;m>=0;m--){const g=this._order[m];if(s(g))for(let y=o.length-1;y>=0;y--){const v=o[y].feature;if(a[v.layer.id]{const de=Z.featureSortOrder;if(de){const ce=de.indexOf(te.featureIndex);return de.indexOf(ie.featureIndex)-ce}return ie.featureIndex-te.featureIndex});for(const te of ee)X.push(te)}}for(const Z in B)B[Z].forEach(Q=>{const N=Q.feature,X=v[g[Z].source].getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=X});return B}(this._layers,m,this.sourceCaches,t,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(t,s){s&&s.filter&&this._validate(p.x.filter,"querySourceFeatures.filter",s.filter,null,s);const a=this.sourceCaches[t];return a?function(o,h){const m=o.getRenderableIds().map(v=>o.getTileByID(v)),g=[],y={};for(let v=0;vE.getTileByID(O)).sort((O,B)=>B.tileID.overscaledZ-O.tileID.overscaledZ||(O.tileID.isLessThan(B.tileID)?-1:1))}const S=this.crossTileSymbolIndex.addLayer(T,y[T.source],t.center.lng);m=m||S}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(xe.now(),t.zoom))&&(this.pauseablePlacement=new yo(t,this.map.terrain,this._order,h,s,a,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(xe.now()),g=!0),m&&this.pauseablePlacement.placement.setStale()),g||m)for(const v of this._order){const T=this._layers[v];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(xe.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,s){return p._(this,void 0,void 0,function*(){const a=yield this.imageManager.getImages(s.icons);this._updateTilesForChangedImages();const o=this.sourceCaches[s.source];return o&&o.setDependencies(s.tileID.key,s.type,s.icons),a})}getGlyphs(t,s){return p._(this,void 0,void 0,function*(){const a=yield this.glyphManager.getGlyphs(s.stacks),o=this.sourceCaches[s.source];return o&&o.setDependencies(s.tileID.key,s.type,[""]),a})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,s={}){this._checkLoaded(),t&&this._validate(p.x.glyphs,"glyphs",t,null,s)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,s,a={},o){this._checkLoaded();const h=[{id:t,url:s}],m=[...si(this.stylesheet.sprite),...h];this._validate(p.x.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(h,!0,o))}removeSprite(t){this._checkLoaded();const s=si(this.stylesheet.sprite);if(s.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;s.splice(s.findIndex(a=>a.id===t),1),this.stylesheet.sprite=s.length>0?s:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}else this.fire(new p.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return si(this.stylesheet.sprite)}setSprite(t,s={},a){this._checkLoaded(),t&&this._validate(p.x.sprite,"sprite",t,null,s)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}}var tr=p.X([{name:"a_pos",type:"Int16",components:2}]),la="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const ys={prelude:tt(`#ifdef GL_ES -precision mediump float; -#else -#if !defined(lowp) -#define lowp -#endif -#if !defined(mediump) -#define mediump -#endif -#if !defined(highp) -#define highp -#endif -#endif -`,`#ifdef GL_ES -precision highp float; -#else -#if !defined(lowp) -#define lowp -#endif -#if !defined(mediump) -#define mediump -#endif -#if !defined(highp) -#define highp -#endif -#endif -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 -);}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;} -#ifdef TERRAIN3D -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; -#endif -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) { -#ifdef TERRAIN3D -highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); -#else -return 1.0; -#endif -}float calculate_visibility(vec4 pos) { -#ifdef TERRAIN3D -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; -#else -return 1.0; -#endif -}float ele(vec2 pos) { -#ifdef TERRAIN3D -vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; -#else -return 0.0; -#endif -}float get_elevation(vec2 pos) { -#ifdef TERRAIN3D -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; -#else -return 0.0; -#endif -}`),background:tt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:tt(`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;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;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;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);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:tt(`varying vec3 v_data;varying float v_visibility; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define mediump float radius -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);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));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define mediump float radius -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -void main(void) { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);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;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:tt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:tt(`uniform highp float u_intensity;varying vec2 v_extrude; -#pragma mapbox: define highp float weight -#define GAUSS_COEF 0.3989422804014327 -void main() { -#pragma mapbox: initialize highp float weight -float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude; -#pragma mapbox: define highp float weight -#pragma mapbox: define mediump float radius -const highp float ZERO=1.0/255.0/16.0; -#define GAUSS_COEF 0.3989422804014327 -void main(void) { -#pragma mapbox: initialize highp float weight -#pragma mapbox: initialize mediump float radius -vec2 unscaled_extrude=vec2(mod(a_pos,2.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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:tt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(0.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying 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:tt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:tt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;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;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:tt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:tt(`#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_FragColor=color*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`attribute vec2 a_pos;uniform mat4 u_matrix; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:tt(`varying vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:tt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -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=texture2D(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=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -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=u_matrix*vec4(a_pos,0,1);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;}`),fillPattern:tt(`#ifdef GL_ES -precision highp float; -#endif -uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -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=u_matrix*vec4(a_pos,0,1);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:tt(`varying vec4 v_color;void main() {gl_FragColor=v_color; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed; -#ifdef TERRAIN3D -attribute vec2 a_centroid; -#endif -varying vec4 v_color; -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define highp vec4 color -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize highp vec4 color -vec3 normal=a_normal_ed.xyz; -#ifdef TERRAIN3D -float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); -#else -float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; -#endif -base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);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;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);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:tt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; -#pragma mapbox: define lowp float base -#pragma mapbox: define lowp float height -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float base -#pragma mapbox: initialize lowp float height -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -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=texture2D(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=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;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 vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed; -#ifdef TERRAIN3D -attribute vec2 a_centroid; -#endif -varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; -#pragma mapbox: define lowp float base -#pragma mapbox: define lowp float height -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float base -#pragma mapbox: initialize lowp float height -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -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; -#ifdef TERRAIN3D -float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); -#else -float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; -#endif -base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 -? a_pos -: vec2(edgedistance,z*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:tt(`#ifdef GL_ES -precision highp float; -#endif -uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;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))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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:tt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; -#define PI 3.141592653589793 -void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:tt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -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);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_width2=vec2(outset,inset);}`),lineGradient:tt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -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=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_width2=vec2(outset,inset);}`),linePattern:tt(`#ifdef GL_ES -precision highp float; -#endif -uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -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(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -#define LINE_DISTANCE_SCALE 2.0 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:tt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -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=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -#define LINE_DISTANCE_SCALE 2.0 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:tt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying 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=texture2D(u_image0,v_pos0);vec4 color1=texture2D(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:tt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float opacity -lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec2 v_tex;varying float v_fade_opacity; -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float opacity -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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;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_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:tt(`#define SDF_PX 8.0 -uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -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 fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec2 v_data0;varying vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -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;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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;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));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:tt(`#define SDF_PX 8.0 -#define SDF 1.0 -#define ICON 0.0 -uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -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;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec4 v_data0;varying vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;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));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:tt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",la),terrainDepth:tt("varying 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() {gl_FragColor=pack(v_depth);}",la),terrainCoords:tt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",la)};function tt(c,t){const s=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/attribute ([\w]+) ([\w]+)/g),o=c.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),h=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=h?h.concat(o):o,g={};return{fragmentSource:c=c.replace(s,(y,v,T,S,E)=>(g[E]=!0,v==="define"?` -#ifndef HAS_UNIFORM_u_${E} -varying ${T} ${S} ${E}; -#else -uniform ${T} ${S} u_${E}; -#endif -`:` -#ifdef HAS_UNIFORM_u_${E} - ${T} ${S} ${E} = u_${E}; -#endif -`)),vertexSource:t=t.replace(s,(y,v,T,S,E)=>{const O=S==="float"?"vec2":"vec4",B=E.match(/color/)?"color":O;return g[E]?v==="define"?` -#ifndef HAS_UNIFORM_u_${E} -uniform lowp float u_${E}_t; -attribute ${T} ${O} a_${E}; -varying ${T} ${S} ${E}; -#else -uniform ${T} ${S} u_${E}; -#endif -`:B==="vec4"?` -#ifndef HAS_UNIFORM_u_${E} - ${E} = a_${E}; -#else - ${T} ${S} ${E} = u_${E}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${E} - ${E} = unpack_mix_${B}(a_${E}, u_${E}_t); -#else - ${T} ${S} ${E} = u_${E}; -#endif -`:v==="define"?` -#ifndef HAS_UNIFORM_u_${E} -uniform lowp float u_${E}_t; -attribute ${T} ${O} a_${E}; -#else -uniform ${T} ${S} u_${E}; -#endif -`:B==="vec4"?` -#ifndef HAS_UNIFORM_u_${E} - ${T} ${S} ${E} = a_${E}; -#else - ${T} ${S} ${E} = u_${E}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${E} - ${T} ${S} ${E} = unpack_mix_${B}(a_${E}, u_${E}_t); -#else - ${T} ${S} ${E} = u_${E}; -#endif -`}),staticAttributes:a,staticUniforms:m}}class bn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,s,a,o,h,m,g,y,v){this.context=t;let T=this.boundPaintVertexBuffers.length!==o.length;for(let S=0;!T&&S({u_depth:new p.aG(te,ie.u_depth),u_terrain:new p.aG(te,ie.u_terrain),u_terrain_dim:new p.aH(te,ie.u_terrain_dim),u_terrain_matrix:new p.aI(te,ie.u_terrain_matrix),u_terrain_unpack:new p.aJ(te,ie.u_terrain_unpack),u_terrain_exaggeration:new p.aH(te,ie.u_terrain_exaggeration)}))(t,ee),this.binderUniforms=a?a.getUniforms(t,ee):[]}draw(t,s,a,o,h,m,g,y,v,T,S,E,O,B,U,D,Z,Q){const N=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(o),t.setColorMode(h),t.setCullFace(m),y){t.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,y.depthTexture),t.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,y.texture);for(const ee in this.terrainUniforms)this.terrainUniforms[ee].set(y[ee])}for(const ee in this.fixedUniforms)this.fixedUniforms[ee].set(g[ee]);U&&U.setUniforms(t,this.binderUniforms,O,{zoom:B});let X=0;switch(s){case N.LINES:X=2;break;case N.TRIANGLES:X=3;break;case N.LINE_STRIP:X=1}for(const ee of E.get()){const te=ee.vaos||(ee.vaos={});(te[v]||(te[v]=new bn)).bind(t,this,T,U?U.getPaintVertexBuffers():[],S,ee.vertexOffset,D,Z,Q),N.drawElements(s,ee.primitiveLength*X,N.UNSIGNED_SHORT,ee.primitiveOffset*X*2)}}}function Ks(c,t,s){const a=1/Fe(s,1,t.transform.tileZoom),o=Math.pow(2,s.tileID.overscaledZ),h=s.tileSize*Math.pow(2,t.transform.tileZoom)/o,m=h*(s.tileID.canonical.x+s.tileID.wrap*o),g=h*s.tileID.canonical.y;return{u_image:0,u_texsize:s.imageAtlasTexture.size,u_scale:[a,c.fromScale,c.toScale],u_fade:c.t,u_pixel_coord_upper:[m>>16,g>>16],u_pixel_coord_lower:[65535&m,65535&g]}}const xo=(c,t,s,a)=>{const o=t.style.light,h=o.properties.get("position"),m=[h.x,h.y,h.z],g=function(){var v=new p.A(9);return p.A!=Float32Array&&(v[1]=0,v[2]=0,v[3]=0,v[5]=0,v[6]=0,v[7]=0),v[0]=1,v[4]=1,v[8]=1,v}();o.properties.get("anchor")==="viewport"&&function(v,T){var S=Math.sin(T),E=Math.cos(T);v[0]=E,v[1]=S,v[2]=0,v[3]=-S,v[4]=E,v[5]=0,v[6]=0,v[7]=0,v[8]=1}(g,-t.transform.angle),function(v,T,S){var E=T[0],O=T[1],B=T[2];v[0]=E*S[0]+O*S[3]+B*S[6],v[1]=E*S[1]+O*S[4]+B*S[7],v[2]=E*S[2]+O*S[5]+B*S[8]}(m,m,g);const y=o.properties.get("color");return{u_matrix:c,u_lightpos:m,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+s,u_opacity:a}},Al=(c,t,s,a,o,h,m)=>p.e(xo(c,t,s,a),Ks(h,t,m),{u_height_factor:-Math.pow(2,o.overscaledZ)/m.tileSize/8}),wn=c=>({u_matrix:c}),vo=(c,t,s,a)=>p.e(wn(c),Ks(s,t,a)),bo=(c,t)=>({u_matrix:c,u_world:t}),Cl=(c,t,s,a,o)=>p.e(vo(c,t,s,a),{u_world:o}),wo=(c,t,s,a)=>{const o=c.transform;let h,m;if(a.paint.get("circle-pitch-alignment")==="map"){const g=Fe(s,1,o.zoom);h=!0,m=[g,g]}else h=!1,m=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:c.translatePosMatrix(t.posMatrix,s,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+h,u_device_pixel_ratio:c.pixelRatio,u_extrude_scale:m}},Pl=(c,t,s)=>{const a=Fe(s,1,t.zoom),o=Math.pow(2,t.zoom-s.tileID.overscaledZ),h=s.tileID.overscaleFactor();return{u_matrix:c,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*o),t.pixelsToGLUnits[1]/(a*o)],u_overscale_factor:h}},Tn=(c,t,s=1)=>({u_matrix:c,u_color:t,u_overlay:0,u_overlay_scale:s}),ha=c=>({u_matrix:c}),To=(c,t,s,a)=>({u_matrix:c,u_extrude_scale:Fe(t,1,s),u_intensity:a});function So(c,t){const s=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new p.Y(0,a/s).toLngLat().lat,new p.Y(0,(a+1)/s).toLngLat().lat]}const Sn=(c,t,s,a)=>{const o=c.transform;return{u_matrix:Js(c,t,s,a),u_ratio:1/Fe(t,1,o.zoom),u_device_pixel_ratio:c.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Xr=(c,t,s,a,o)=>p.e(Sn(c,t,s,o),{u_image:0,u_image_height:a}),In=(c,t,s,a,o)=>{const h=c.transform,m=Ys(t,h);return{u_matrix:Js(c,t,s,o),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Fe(t,1,h.zoom),u_device_pixel_ratio:c.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Di=(c,t,s,a,o,h)=>{const m=c.lineAtlas,g=Ys(t,c.transform),y=s.layout.get("line-cap")==="round",v=m.getDash(a.from,y),T=m.getDash(a.to,y),S=v.width*o.fromScale,E=T.width*o.toScale;return p.e(Sn(c,t,s,h),{u_patternscale_a:[g/S,-v.height/2],u_patternscale_b:[g/E,-T.height/2],u_sdfgamma:m.width/(256*Math.min(S,E)*c.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:T.y,u_mix:o.t})};function Ys(c,t){return 1/Fe(c,1,t.tileZoom)}function Js(c,t,s,a){return c.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,s.paint.get("line-translate"),s.paint.get("line-translate-anchor"))}const Qs=(c,t,s,a,o)=>{return{u_matrix:c,u_tl_parent:t,u_scale_parent:s,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(h=o.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:An(o.paint.get("raster-hue-rotate"))};var h,m};function An(c){c*=Math.PI/180;const t=Math.sin(c),s=Math.cos(c);return[(2*s+1)/3,(-Math.sqrt(3)*t-s+1)/3,(Math.sqrt(3)*t-s+1)/3]}const en=(c,t,s,a,o,h,m,g,y,v)=>{const T=o.transform;return{u_is_size_zoom_constant:+(c==="constant"||c==="source"),u_is_size_feature_constant:+(c==="constant"||c==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:T.cameraToCenterDistance,u_pitch:T.pitch/360*2*Math.PI,u_rotate_symbol:+s,u_aspect_ratio:T.width/T.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:h,u_label_plane_matrix:m,u_coord_matrix:g,u_is_text:+y,u_pitch_with_map:+a,u_texsize:v,u_texture:0}},xs=(c,t,s,a,o,h,m,g,y,v,T)=>{const S=o.transform;return p.e(en(c,t,s,a,o,h,m,g,y,v),{u_gamma_scale:a?Math.cos(S._pitch)*S.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+T})},El=(c,t,s,a,o,h,m,g,y,v)=>p.e(xs(c,t,s,a,o,h,m,g,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),Ml=(c,t,s)=>({u_matrix:c,u_opacity:t,u_color:s}),Io=(c,t,s,a,o,h)=>p.e(function(m,g,y,v){const T=y.imageManager.getPattern(m.from.toString()),S=y.imageManager.getPattern(m.to.toString()),{width:E,height:O}=y.imageManager.getPixelSize(),B=Math.pow(2,v.tileID.overscaledZ),U=v.tileSize*Math.pow(2,y.transform.tileZoom)/B,D=U*(v.tileID.canonical.x+v.tileID.wrap*B),Z=U*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:S.tl,u_pattern_br_b:S.br,u_texsize:[E,O],u_mix:g.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:S.displaySize,u_scale_a:g.fromScale,u_scale_b:g.toScale,u_tile_units_to_pixels:1/Fe(v,1,y.transform.tileZoom),u_pixel_coord_upper:[D>>16,Z>>16],u_pixel_coord_lower:[65535&D,65535&Z]}}(a,h,s,o),{u_matrix:c,u_opacity:t}),zl={fillExtrusion:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_lightpos:new p.aK(c,t.u_lightpos),u_lightintensity:new p.aH(c,t.u_lightintensity),u_lightcolor:new p.aK(c,t.u_lightcolor),u_vertical_gradient:new p.aH(c,t.u_vertical_gradient),u_opacity:new p.aH(c,t.u_opacity)}),fillExtrusionPattern:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_lightpos:new p.aK(c,t.u_lightpos),u_lightintensity:new p.aH(c,t.u_lightintensity),u_lightcolor:new p.aK(c,t.u_lightcolor),u_vertical_gradient:new p.aH(c,t.u_vertical_gradient),u_height_factor:new p.aH(c,t.u_height_factor),u_image:new p.aG(c,t.u_image),u_texsize:new p.aL(c,t.u_texsize),u_pixel_coord_upper:new p.aL(c,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.aL(c,t.u_pixel_coord_lower),u_scale:new p.aK(c,t.u_scale),u_fade:new p.aH(c,t.u_fade),u_opacity:new p.aH(c,t.u_opacity)}),fill:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix)}),fillPattern:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_image:new p.aG(c,t.u_image),u_texsize:new p.aL(c,t.u_texsize),u_pixel_coord_upper:new p.aL(c,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.aL(c,t.u_pixel_coord_lower),u_scale:new p.aK(c,t.u_scale),u_fade:new p.aH(c,t.u_fade)}),fillOutline:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_world:new p.aL(c,t.u_world)}),fillOutlinePattern:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_world:new p.aL(c,t.u_world),u_image:new p.aG(c,t.u_image),u_texsize:new p.aL(c,t.u_texsize),u_pixel_coord_upper:new p.aL(c,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.aL(c,t.u_pixel_coord_lower),u_scale:new p.aK(c,t.u_scale),u_fade:new p.aH(c,t.u_fade)}),circle:(c,t)=>({u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_scale_with_map:new p.aG(c,t.u_scale_with_map),u_pitch_with_map:new p.aG(c,t.u_pitch_with_map),u_extrude_scale:new p.aL(c,t.u_extrude_scale),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_matrix:new p.aI(c,t.u_matrix)}),collisionBox:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_pixels_to_tile_units:new p.aH(c,t.u_pixels_to_tile_units),u_extrude_scale:new p.aL(c,t.u_extrude_scale),u_overscale_factor:new p.aH(c,t.u_overscale_factor)}),collisionCircle:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_inv_matrix:new p.aI(c,t.u_inv_matrix),u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_viewport_size:new p.aL(c,t.u_viewport_size)}),debug:(c,t)=>({u_color:new p.aM(c,t.u_color),u_matrix:new p.aI(c,t.u_matrix),u_overlay:new p.aG(c,t.u_overlay),u_overlay_scale:new p.aH(c,t.u_overlay_scale)}),clippingMask:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix)}),heatmap:(c,t)=>({u_extrude_scale:new p.aH(c,t.u_extrude_scale),u_intensity:new p.aH(c,t.u_intensity),u_matrix:new p.aI(c,t.u_matrix)}),heatmapTexture:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_world:new p.aL(c,t.u_world),u_image:new p.aG(c,t.u_image),u_color_ramp:new p.aG(c,t.u_color_ramp),u_opacity:new p.aH(c,t.u_opacity)}),hillshade:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_image:new p.aG(c,t.u_image),u_latrange:new p.aL(c,t.u_latrange),u_light:new p.aL(c,t.u_light),u_shadow:new p.aM(c,t.u_shadow),u_highlight:new p.aM(c,t.u_highlight),u_accent:new p.aM(c,t.u_accent)}),hillshadePrepare:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_image:new p.aG(c,t.u_image),u_dimension:new p.aL(c,t.u_dimension),u_zoom:new p.aH(c,t.u_zoom),u_unpack:new p.aJ(c,t.u_unpack)}),line:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_ratio:new p.aH(c,t.u_ratio),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_units_to_pixels:new p.aL(c,t.u_units_to_pixels)}),lineGradient:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_ratio:new p.aH(c,t.u_ratio),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_units_to_pixels:new p.aL(c,t.u_units_to_pixels),u_image:new p.aG(c,t.u_image),u_image_height:new p.aH(c,t.u_image_height)}),linePattern:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_texsize:new p.aL(c,t.u_texsize),u_ratio:new p.aH(c,t.u_ratio),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_image:new p.aG(c,t.u_image),u_units_to_pixels:new p.aL(c,t.u_units_to_pixels),u_scale:new p.aK(c,t.u_scale),u_fade:new p.aH(c,t.u_fade)}),lineSDF:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_ratio:new p.aH(c,t.u_ratio),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_units_to_pixels:new p.aL(c,t.u_units_to_pixels),u_patternscale_a:new p.aL(c,t.u_patternscale_a),u_patternscale_b:new p.aL(c,t.u_patternscale_b),u_sdfgamma:new p.aH(c,t.u_sdfgamma),u_image:new p.aG(c,t.u_image),u_tex_y_a:new p.aH(c,t.u_tex_y_a),u_tex_y_b:new p.aH(c,t.u_tex_y_b),u_mix:new p.aH(c,t.u_mix)}),raster:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_tl_parent:new p.aL(c,t.u_tl_parent),u_scale_parent:new p.aH(c,t.u_scale_parent),u_buffer_scale:new p.aH(c,t.u_buffer_scale),u_fade_t:new p.aH(c,t.u_fade_t),u_opacity:new p.aH(c,t.u_opacity),u_image0:new p.aG(c,t.u_image0),u_image1:new p.aG(c,t.u_image1),u_brightness_low:new p.aH(c,t.u_brightness_low),u_brightness_high:new p.aH(c,t.u_brightness_high),u_saturation_factor:new p.aH(c,t.u_saturation_factor),u_contrast_factor:new p.aH(c,t.u_contrast_factor),u_spin_weights:new p.aK(c,t.u_spin_weights)}),symbolIcon:(c,t)=>({u_is_size_zoom_constant:new p.aG(c,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aG(c,t.u_is_size_feature_constant),u_size_t:new p.aH(c,t.u_size_t),u_size:new p.aH(c,t.u_size),u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_pitch:new p.aH(c,t.u_pitch),u_rotate_symbol:new p.aG(c,t.u_rotate_symbol),u_aspect_ratio:new p.aH(c,t.u_aspect_ratio),u_fade_change:new p.aH(c,t.u_fade_change),u_matrix:new p.aI(c,t.u_matrix),u_label_plane_matrix:new p.aI(c,t.u_label_plane_matrix),u_coord_matrix:new p.aI(c,t.u_coord_matrix),u_is_text:new p.aG(c,t.u_is_text),u_pitch_with_map:new p.aG(c,t.u_pitch_with_map),u_texsize:new p.aL(c,t.u_texsize),u_texture:new p.aG(c,t.u_texture)}),symbolSDF:(c,t)=>({u_is_size_zoom_constant:new p.aG(c,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aG(c,t.u_is_size_feature_constant),u_size_t:new p.aH(c,t.u_size_t),u_size:new p.aH(c,t.u_size),u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_pitch:new p.aH(c,t.u_pitch),u_rotate_symbol:new p.aG(c,t.u_rotate_symbol),u_aspect_ratio:new p.aH(c,t.u_aspect_ratio),u_fade_change:new p.aH(c,t.u_fade_change),u_matrix:new p.aI(c,t.u_matrix),u_label_plane_matrix:new p.aI(c,t.u_label_plane_matrix),u_coord_matrix:new p.aI(c,t.u_coord_matrix),u_is_text:new p.aG(c,t.u_is_text),u_pitch_with_map:new p.aG(c,t.u_pitch_with_map),u_texsize:new p.aL(c,t.u_texsize),u_texture:new p.aG(c,t.u_texture),u_gamma_scale:new p.aH(c,t.u_gamma_scale),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_is_halo:new p.aG(c,t.u_is_halo)}),symbolTextAndIcon:(c,t)=>({u_is_size_zoom_constant:new p.aG(c,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aG(c,t.u_is_size_feature_constant),u_size_t:new p.aH(c,t.u_size_t),u_size:new p.aH(c,t.u_size),u_camera_to_center_distance:new p.aH(c,t.u_camera_to_center_distance),u_pitch:new p.aH(c,t.u_pitch),u_rotate_symbol:new p.aG(c,t.u_rotate_symbol),u_aspect_ratio:new p.aH(c,t.u_aspect_ratio),u_fade_change:new p.aH(c,t.u_fade_change),u_matrix:new p.aI(c,t.u_matrix),u_label_plane_matrix:new p.aI(c,t.u_label_plane_matrix),u_coord_matrix:new p.aI(c,t.u_coord_matrix),u_is_text:new p.aG(c,t.u_is_text),u_pitch_with_map:new p.aG(c,t.u_pitch_with_map),u_texsize:new p.aL(c,t.u_texsize),u_texsize_icon:new p.aL(c,t.u_texsize_icon),u_texture:new p.aG(c,t.u_texture),u_texture_icon:new p.aG(c,t.u_texture_icon),u_gamma_scale:new p.aH(c,t.u_gamma_scale),u_device_pixel_ratio:new p.aH(c,t.u_device_pixel_ratio),u_is_halo:new p.aG(c,t.u_is_halo)}),background:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_opacity:new p.aH(c,t.u_opacity),u_color:new p.aM(c,t.u_color)}),backgroundPattern:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_opacity:new p.aH(c,t.u_opacity),u_image:new p.aG(c,t.u_image),u_pattern_tl_a:new p.aL(c,t.u_pattern_tl_a),u_pattern_br_a:new p.aL(c,t.u_pattern_br_a),u_pattern_tl_b:new p.aL(c,t.u_pattern_tl_b),u_pattern_br_b:new p.aL(c,t.u_pattern_br_b),u_texsize:new p.aL(c,t.u_texsize),u_mix:new p.aH(c,t.u_mix),u_pattern_size_a:new p.aL(c,t.u_pattern_size_a),u_pattern_size_b:new p.aL(c,t.u_pattern_size_b),u_scale_a:new p.aH(c,t.u_scale_a),u_scale_b:new p.aH(c,t.u_scale_b),u_pixel_coord_upper:new p.aL(c,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.aL(c,t.u_pixel_coord_lower),u_tile_units_to_pixels:new p.aH(c,t.u_tile_units_to_pixels)}),terrain:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_texture:new p.aG(c,t.u_texture),u_ele_delta:new p.aH(c,t.u_ele_delta)}),terrainDepth:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_ele_delta:new p.aH(c,t.u_ele_delta)}),terrainCoords:(c,t)=>({u_matrix:new p.aI(c,t.u_matrix),u_texture:new p.aG(c,t.u_texture),u_terrain_coords_id:new p.aH(c,t.u_terrain_coords_id),u_ele_delta:new p.aH(c,t.u_ele_delta)})};class Kr{constructor(t,s,a){this.context=t;const o=t.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const s=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Cn={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class wi{constructor(t,s,a,o){this.length=s.length,this.attributes=a,this.itemSize=s.bytesPerElement,this.dynamicDraw=o,this.context=t;const h=t.gl;this.buffer=h.createBuffer(),t.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}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}`);const s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,s){for(let a=0;a0){const ue=p.F(),Se=ie;p.aP(ue,te.placementInvProjMatrix,c.transform.glCoordMatrix),p.aP(ue,ue,te.placementViewportMatrix),T.push({circleArray:ce,circleOffset:E,transform:Se,invTransform:ue,coord:X}),S+=ce.length/4,E=S}de&&v.draw(g,y.LINES,Je.disabled,ot.disabled,c.colorModeForRenderPass(),nt.disabled,Pl(ie,c.transform,ee),c.style.map.terrain&&c.style.map.terrain.getTerrainData(X),s.id,de.layoutVertexBuffer,de.indexBuffer,de.segments,null,c.transform.zoom,null,null,de.collisionVertexBuffer)}if(!m||!T.length)return;const O=c.useProgram("collisionCircle"),B=new p.aQ;B.resize(4*S),B._trim();let U=0;for(const N of T)for(let X=0;X=0&&(B[D.associatedIconIndex]={shiftedAnchor:Oe,angle:_e})}else Pe(D.numGlyphs,E)}if(v){O.clear();const U=c.icon.placedSymbolArray;for(let D=0;Dc.style.map.terrain.getElevation(de,Si,He):null,Vt=s.layout.get("text-rotation-alignment")==="map";z(ue,de.posMatrix,c,o,ji,nr,D,v,Vt,pt)}const ar=c.translatePosMatrix(de.posMatrix,ce,h,m),qi=Z||o&&te||ss?Lo:ji,yt=c.translatePosMatrix(nr,ce,h,m,!0),ut=_e&&s.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let wt;wt=_e?ue.iconsInText?El(Le.kind,Be,Q,D,c,ar,qi,yt,Ze,Pt):xs(Le.kind,Be,Q,D,c,ar,qi,yt,o,Ze,!0):en(Le.kind,Be,Q,D,c,ar,qi,yt,o,Ze);const Fs={program:We,buffers:Se,uniformValues:wt,atlasTexture:mt,atlasTextureIcon:lt,atlasInterpolation:at,atlasInterpolationIcon:ui,isSDF:_e,hasHalo:ut};if(N&&ue.canOverlap){X=!0;const pt=Se.segments.get();for(const Vt of pt)ie.push({segments:new p.$([Vt]),sortKey:Vt.sortKey,state:Fs,terrainData:qe})}else ie.push({segments:Se.segments,sortKey:0,state:Fs,terrainData:qe})}X&&ie.sort((de,ce)=>de.sortKey-ce.sortKey);for(const de of ie){const ce=de.state;if(E.activeTexture.set(O.TEXTURE0),ce.atlasTexture.bind(ce.atlasInterpolation,O.CLAMP_TO_EDGE),ce.atlasTextureIcon&&(E.activeTexture.set(O.TEXTURE1),ce.atlasTextureIcon&&ce.atlasTextureIcon.bind(ce.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),ce.isSDF){const ue=ce.uniformValues;ce.hasHalo&&(ue.u_is_halo=1,Rn(ce.buffers,de.segments,s,c,ce.program,ee,T,S,ue,de.terrainData)),ue.u_is_halo=0}Rn(ce.buffers,de.segments,s,c,ce.program,ee,T,S,ce.uniformValues,de.terrainData)}}function Rn(c,t,s,a,o,h,m,g,y,v){const T=a.context;o.draw(T,T.gl.TRIANGLES,h,m,g,nt.disabled,y,v,s.id,c.layoutVertexBuffer,c.indexBuffer,t,s.paint,a.transform.zoom,c.programConfigurations.get(s.id),c.dynamicLayoutVertexBuffer,c.opacityVertexBuffer)}function Bo(c,t,s,a,o){if(!s||!a||!a.imageAtlas)return;const h=a.imageAtlas.patternPositions;let m=h[s.to.toString()],g=h[s.from.toString()];if(!m&&g&&(m=g),!g&&m&&(g=m),!m||!g){const y=o.getPaintProperty(t);m=h[y],g=h[y]}m&&g&&c.setConstantPatternPositions(m,g)}function ba(c,t,s,a,o,h,m){const g=c.context.gl,y="fill-pattern",v=s.paint.get(y),T=v&&v.constantOr(1),S=s.getCrossfadeParameters();let E,O,B,U,D;m?(O=T&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",E=g.LINES):(O=T?"fillPattern":"fill",E=g.TRIANGLES);const Z=v.constantOr(null);for(const Q of a){const N=t.getTile(Q);if(T&&!N.patternsLoaded())continue;const X=N.getBucket(s);if(!X)continue;const ee=X.programConfigurations.get(s.id),te=c.useProgram(O,ee),ie=c.style.map.terrain&&c.style.map.terrain.getTerrainData(Q);T&&(c.context.activeTexture.set(g.TEXTURE0),N.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),ee.updatePaintBuffers(S)),Bo(ee,y,Z,N,s);const de=ie?Q:null,ce=c.translatePosMatrix(de?de.posMatrix:Q.posMatrix,N,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor"));if(m){U=X.indexBuffer2,D=X.segments2;const ue=[g.drawingBufferWidth,g.drawingBufferHeight];B=O==="fillOutlinePattern"&&T?Cl(ce,c,S,N,ue):bo(ce,ue)}else U=X.indexBuffer,D=X.segments,B=T?vo(ce,c,S,N):wn(ce);te.draw(c.context,E,o,c.stencilModeForClipping(Q),h,nt.disabled,B,ie,s.id,X.layoutVertexBuffer,U,D,s.paint,c.transform.zoom,ee)}}function Cs(c,t,s,a,o,h,m){const g=c.context,y=g.gl,v="fill-extrusion-pattern",T=s.paint.get(v),S=T.constantOr(1),E=s.getCrossfadeParameters(),O=s.paint.get("fill-extrusion-opacity"),B=T.constantOr(null);for(const U of a){const D=t.getTile(U),Z=D.getBucket(s);if(!Z)continue;const Q=c.style.map.terrain&&c.style.map.terrain.getTerrainData(U),N=Z.programConfigurations.get(s.id),X=c.useProgram(S?"fillExtrusionPattern":"fillExtrusion",N);S&&(c.context.activeTexture.set(y.TEXTURE0),D.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),N.updatePaintBuffers(E)),Bo(N,v,B,D,s);const ee=c.translatePosMatrix(U.posMatrix,D,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),te=s.paint.get("fill-extrusion-vertical-gradient"),ie=S?Al(ee,c,te,O,U,E,D):xo(ee,c,te,O);X.draw(g,g.gl.TRIANGLES,o,h,m,nt.backCCW,ie,Q,s.id,Z.layoutVertexBuffer,Z.indexBuffer,Z.segments,s.paint,c.transform.zoom,N,c.style.map.terrain&&Z.centroidVertexBuffer)}}function wa(c,t,s,a,o,h,m){const g=c.context,y=g.gl,v=s.fbo;if(!v)return;const T=c.useProgram("hillshade"),S=c.style.map.terrain&&c.style.map.terrain.getTerrainData(t);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),T.draw(g,y.TRIANGLES,o,h,m,nt.disabled,((E,O,B,U)=>{const D=B.paint.get("hillshade-shadow-color"),Z=B.paint.get("hillshade-highlight-color"),Q=B.paint.get("hillshade-accent-color");let N=B.paint.get("hillshade-illumination-direction")*(Math.PI/180);B.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=E.transform.angle);const X=!E.options.moving;return{u_matrix:U?U.posMatrix:E.transform.calculatePosMatrix(O.tileID.toUnwrapped(),X),u_image:0,u_latrange:So(0,O.tileID),u_light:[B.paint.get("hillshade-exaggeration"),N],u_shadow:D,u_highlight:Z,u_accent:Q}})(c,s,a,S?t:null),S,a.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}function Fo(c,t,s,a,o,h){const m=c.context,g=m.gl,y=t.dem;if(y&&y.data){const v=y.dim,T=y.stride,S=y.getPixels();if(m.activeTexture.set(g.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||c.getTileTexture(T),t.demTexture){const O=t.demTexture;O.update(S,{premultiply:!1}),O.bind(g.NEAREST,g.CLAMP_TO_EDGE)}else t.demTexture=new xt(m,S,g.RGBA,{premultiply:!1}),t.demTexture.bind(g.NEAREST,g.CLAMP_TO_EDGE);m.activeTexture.set(g.TEXTURE0);let E=t.fbo;if(!E){const O=new xt(m,{width:v,height:v,data:null},g.RGBA);O.bind(g.LINEAR,g.CLAMP_TO_EDGE),E=t.fbo=m.createFramebuffer(v,v,!0,!1),E.colorAttachment.set(O.texture)}m.bindFramebuffer.set(E.framebuffer),m.viewport.set([0,0,v,v]),c.useProgram("hillshadePrepare").draw(m,g.TRIANGLES,a,o,h,nt.disabled,((O,B)=>{const U=B.stride,D=p.F();return p.aN(D,0,p.W,-p.W,0,0,1),p.H(D,D,[0,-p.W,0]),{u_matrix:D,u_image:1,u_dimension:[U,U],u_zoom:O.overscaledZ,u_unpack:B.getUnpackVector()}})(t.tileID,y),null,s.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Oo(c,t,s,a,o,h){const m=a.paint.get("raster-fade-duration");if(!h&&m>0){const g=xe.now(),y=(g-c.timeAdded)/m,v=t?(g-t.timeAdded)/m:-1,T=s.getSource(),S=o.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),E=!t||Math.abs(t.tileID.overscaledZ-S)>Math.abs(c.tileID.overscaledZ-S),O=E&&c.refreshedUponExpiration?1:p.ac(E?y:1-v,0,1);return c.refreshedUponExpiration&&y>=1&&(c.refreshedUponExpiration=!1),t?{opacity:1,mix:1-O}:{opacity:O,mix:0}}return{opacity:1,mix:0}}const Bn=new p.aO(1,0,0,1),Ta=new p.aO(0,1,0,1),Ul=new p.aO(0,0,1,1),Vo=new p.aO(1,0,1,1),bt=new p.aO(0,1,1,1);function Er(c,t,s,a){Ps(c,0,t+s/2,c.transform.width,s,a)}function Ti(c,t,s,a){Ps(c,t-s/2,0,s,c.transform.height,a)}function Ps(c,t,s,a,o,h){const m=c.context,g=m.gl;g.enable(g.SCISSOR_TEST),g.scissor(t*c.pixelRatio,s*c.pixelRatio,a*c.pixelRatio,o*c.pixelRatio),m.clear({color:h}),g.disable(g.SCISSOR_TEST)}function Sa(c,t,s){const a=c.context,o=a.gl,h=s.posMatrix,m=c.useProgram("debug"),g=Je.disabled,y=ot.disabled,v=c.colorModeForRenderPass(),T="$debug",S=c.style.map.terrain&&c.style.map.terrain.getTerrainData(s);a.activeTexture.set(o.TEXTURE0);const E=t.getTileByID(s.key).latestRawTileData,O=Math.floor((E&&E.byteLength||0)/1024),B=t.getTile(s).tileSize,U=512/Math.min(B,512)*(s.overscaledZ/c.transform.zoom)*.5;let D=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(D+=` => ${s.overscaledZ}`),function(Z,Q){Z.initDebugOverlayCanvas();const N=Z.debugOverlayCanvas,X=Z.context.gl,ee=Z.debugOverlayCanvas.getContext("2d");ee.clearRect(0,0,N.width,N.height),ee.shadowColor="white",ee.shadowBlur=2,ee.lineWidth=1.5,ee.strokeStyle="white",ee.textBaseline="top",ee.font="bold 36px Open Sans, sans-serif",ee.fillText(Q,5,5),ee.strokeText(Q,5,5),Z.debugOverlayTexture.update(N),Z.debugOverlayTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE)}(c,`${D} ${O}kB`),m.draw(a,o.TRIANGLES,g,y,St.alphaBlended,nt.disabled,Tn(h,p.aO.transparent,U),null,T,c.debugBuffer,c.quadTriangleIndexBuffer,c.debugSegments),m.draw(a,o.LINE_STRIP,g,y,v,nt.disabled,Tn(h,p.aO.red),S,T,c.debugBuffer,c.tileBorderIndexBuffer,c.debugSegments)}function Ia(c,t,s){const a=c.context,o=a.gl,h=c.colorModeForRenderPass(),m=new Je(o.LEQUAL,Je.ReadWrite,c.depthRangeFor3D),g=c.useProgram("terrain"),y=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,c.width,c.height]);for(const v of s){const T=c.renderToTexture.getTexture(v),S=t.getTerrainData(v.tileID);a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,T.texture);const E={u_matrix:c.transform.calculatePosMatrix(v.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(c.transform.zoom)};g.draw(a,o.TRIANGLES,m,ot.disabled,h,nt.backCCW,E,S,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class Es{constructor(t,s){this.context=new Do(t),this.transform=s,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:p.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=fe.maxUnderzooming+fe.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new vt}resize(t,s,a){if(this.width=Math.floor(t*a),this.height=Math.floor(s*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const o of this.style._order)this.style._layers[o].resize()}setup(){const t=this.context,s=new p.aV;s.emplaceBack(0,0),s.emplaceBack(p.W,0),s.emplaceBack(0,p.W),s.emplaceBack(p.W,p.W),this.tileExtentBuffer=t.createVertexBuffer(s,tr.members),this.tileExtentSegments=p.$.simpleSegment(0,0,4,2);const a=new p.aV;a.emplaceBack(0,0),a.emplaceBack(p.W,0),a.emplaceBack(0,p.W),a.emplaceBack(p.W,p.W),this.debugBuffer=t.createVertexBuffer(a,tr.members),this.debugSegments=p.$.simpleSegment(0,0,4,5);const o=new p.Z;o.emplaceBack(0,0,0,0),o.emplaceBack(p.W,0,p.W,0),o.emplaceBack(0,p.W,0,p.W),o.emplaceBack(p.W,p.W,p.W,p.W),this.rasterBoundsBuffer=t.createVertexBuffer(o,Nt.members),this.rasterBoundsSegments=p.$.simpleSegment(0,0,4,2);const h=new p.aV;h.emplaceBack(0,0),h.emplaceBack(1,0),h.emplaceBack(0,1),h.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(h,tr.members),this.viewportSegments=p.$.simpleSegment(0,0,4,2);const m=new p.aW;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const g=new p.aX;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(g);const y=this.context.gl;this.stencilClearMode=new ot({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,s=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=p.F();p.aN(a,0,this.width,this.height,0,0,1),p.J(a,a,[s.drawingBufferWidth,s.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,s.TRIANGLES,Je.disabled,this.stencilClearMode,St.disabled,nt.disabled,ha(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,s){if(this.currentStencilSource===t.source||!t.isTileClipped()||!s||!s.length)return;this.currentStencilSource=t.source;const a=this.context,o=a.gl;this.nextStencilID+s.length>256&&this.clearStencil(),a.setColorMode(St.disabled),a.setDepthMode(Je.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of s){const g=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);h.draw(a,o.TRIANGLES,Je.disabled,new ot({func:o.ALWAYS,mask:0},g,255,o.KEEP,o.KEEP,o.REPLACE),St.disabled,nt.disabled,ha(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,s=this.context.gl;return new ot({func:s.NOTEQUAL,mask:255},t,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(t){const s=this.context.gl;return new ot({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,s.KEEP,s.KEEP,s.REPLACE)}stencilConfigForOverlap(t){const s=this.context.gl,a=t.sort((m,g)=>g.overscaledZ-m.overscaledZ),o=a[a.length-1].overscaledZ,h=a[0].overscaledZ-o+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const m={};for(let g=0;g=0;this.currentLayer--){const y=this.style._layers[a[this.currentLayer]],v=o[y.source],T=h[y.source];this._renderTileClippingMasks(y,T),this.renderLayer(this,v,y,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerD.source&&!D.isHidden(T)?[v.sourceCaches[D.source]]:[]),O=E.filter(D=>D.getSource().type==="vector"),B=E.filter(D=>D.getSource().type!=="vector"),U=D=>{(!S||S.getSource().maxzoomU(D)),S||B.forEach(D=>U(D)),S}(this.style,this.transform.zoom);y&&function(v,T,S){for(let E=0;E0),o&&(p.a_(s,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,m){const g=h.context,y=g.gl,v=St.unblended,T=new Je(y.LEQUAL,Je.ReadWrite,[0,1]),S=m.getTerrainMesh(),E=m.sourceCache.getRenderableTiles(),O=h.useProgram("terrainDepth");g.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),g.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),g.clear({color:p.aO.transparent,depth:1});for(const B of E){const U=m.getTerrainData(B.tileID),D={u_matrix:h.transform.calculatePosMatrix(B.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};O.draw(g,y.TRIANGLES,T,ot.disabled,v,nt.backCCW,D,U,"terrain",S.vertexBuffer,S.indexBuffer,S.segments)}g.bindFramebuffer.set(null),g.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,m){const g=h.context,y=g.gl,v=St.unblended,T=new Je(y.LEQUAL,Je.ReadWrite,[0,1]),S=m.getTerrainMesh(),E=m.getCoordsTexture(),O=m.sourceCache.getRenderableTiles(),B=h.useProgram("terrainCoords");g.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),g.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),g.clear({color:p.aO.transparent,depth:1}),m.coordsIndex=[];for(const U of O){const D=m.getTerrainData(U.tileID);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,E.texture);const Z={u_matrix:h.transform.calculatePosMatrix(U.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};B.draw(g,y.TRIANGLES,T,ot.disabled,v,nt.backCCW,Z,D,"terrain",S.vertexBuffer,S.indexBuffer,S.segments),m.coordsIndex.push(U.tileID.key)}g.bindFramebuffer.set(null),g.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,s,a,o){if(!a.isHidden(this.transform.zoom)&&(a.type==="background"||a.type==="custom"||(o||[]).length))switch(this.id=a.id,a.type){case"symbol":(function(h,m,g,y,v){if(h.renderPass!=="translucent")return;const T=ot.disabled,S=h.colorModeForRenderPass();(g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(E,O,B,U,D,Z,Q){const N=O.transform,X=D==="map",ee=Z==="map";for(const te of E){const ie=U.getTile(te),de=ie.getBucket(B);if(!de||!de.text||!de.text.segments.get().length)continue;const ce=p.ag(de.textSizeData,N.zoom),ue=Fe(ie,1,O.transform.zoom),Se=Cr(te.posMatrix,ee,X,O.transform,ue),Oe=B.layout.get("icon-text-fit")!=="none"&&de.hasIconData();if(ce){const _e=Math.pow(2,N.zoom-ie.tileID.overscaledZ);Ln(de,X,ee,Q,N,Se,te.posMatrix,_e,ce,Oe,O.style.map.terrain?(Le,$e)=>O.style.map.terrain.getElevation(te,Le,$e):null)}}}(y,h,g,m,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),v),g.paint.get("icon-opacity").constantOr(1)!==0&&Ro(h,m,g,y,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),T,S),g.paint.get("text-opacity").constantOr(1)!==0&&Ro(h,m,g,y,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),T,S),m.map.showCollisionBoxes&&(kn(h,m,g,y,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),!0),kn(h,m,g,y,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),!1))})(t,s,a,o,this.style.placement.variableOffsets);break;case"circle":(function(h,m,g,y){if(h.renderPass!=="translucent")return;const v=g.paint.get("circle-opacity"),T=g.paint.get("circle-stroke-width"),S=g.paint.get("circle-stroke-opacity"),E=!g.layout.get("circle-sort-key").isConstant();if(v.constantOr(1)===0&&(T.constantOr(1)===0||S.constantOr(1)===0))return;const O=h.context,B=O.gl,U=h.depthModeForSublayer(0,Je.ReadOnly),D=ot.disabled,Z=h.colorModeForRenderPass(),Q=[];for(let N=0;NN.sortKey-X.sortKey);for(const N of Q){const{programConfiguration:X,program:ee,layoutVertexBuffer:te,indexBuffer:ie,uniformValues:de,terrainData:ce}=N.state;ee.draw(O,B.TRIANGLES,U,D,Z,nt.disabled,de,ce,g.id,te,ie,N.segments,g.paint,h.transform.zoom,X)}})(t,s,a,o);break;case"heatmap":(function(h,m,g,y){if(g.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const v=h.context,T=v.gl,S=ot.disabled,E=new St([T.ONE,T.ONE],p.aO.transparent,[!0,!0,!0,!0]);(function(O,B,U){const D=O.gl;O.activeTexture.set(D.TEXTURE1),O.viewport.set([0,0,B.width/4,B.height/4]);let Z=U.heatmapFbo;if(Z)D.bindTexture(D.TEXTURE_2D,Z.colorAttachment.get()),O.bindFramebuffer.set(Z.framebuffer);else{const Q=D.createTexture();D.bindTexture(D.TEXTURE_2D,Q),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MIN_FILTER,D.LINEAR),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MAG_FILTER,D.LINEAR),Z=U.heatmapFbo=O.createFramebuffer(B.width/4,B.height/4,!1,!1),function(N,X,ee,te){var ie,de;const ce=N.gl,ue=(ie=N.HALF_FLOAT)!==null&&ie!==void 0?ie:ce.UNSIGNED_BYTE,Se=(de=N.RGBA16F)!==null&&de!==void 0?de:ce.RGBA;ce.texImage2D(ce.TEXTURE_2D,0,Se,X.width/4,X.height/4,0,ce.RGBA,ue,null),te.colorAttachment.set(ee)}(O,B,Q,Z)}})(v,h,g),v.clear({color:p.aO.transparent});for(let O=0;O{const N=p.F();p.aN(N,0,U.width,U.height,0,0,1);const X=U.context.gl;return{u_matrix:N,u_world:[X.drawingBufferWidth,X.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:D.paint.get("heatmap-opacity")}})(v,T),null,T.id,v.viewportBuffer,v.quadTriangleIndexBuffer,v.viewportSegments,T.paint,v.transform.zoom)}(h,g))})(t,s,a,o);break;case"line":(function(h,m,g,y){if(h.renderPass!=="translucent")return;const v=g.paint.get("line-opacity"),T=g.paint.get("line-width");if(v.constantOr(1)===0||T.constantOr(1)===0)return;const S=h.depthModeForSublayer(0,Je.ReadOnly),E=h.colorModeForRenderPass(),O=g.paint.get("line-dasharray"),B=g.paint.get("line-pattern"),U=B.constantOr(1),D=g.paint.get("line-gradient"),Z=g.getCrossfadeParameters(),Q=U?"linePattern":O?"lineSDF":D?"lineGradient":"line",N=h.context,X=N.gl;let ee=!0;for(const te of y){const ie=m.getTile(te);if(U&&!ie.patternsLoaded())continue;const de=ie.getBucket(g);if(!de)continue;const ce=de.programConfigurations.get(g.id),ue=h.context.program.get(),Se=h.useProgram(Q,ce),Oe=ee||Se.program!==ue,_e=h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),Le=B.constantOr(null);if(Le&&ie.imageAtlas){const Be=ie.imageAtlas,qe=Be.patternPositions[Le.to.toString()],Ze=Be.patternPositions[Le.from.toString()];qe&&Ze&&ce.setConstantPatternPositions(qe,Ze)}const $e=_e?te:null,We=U?In(h,ie,g,Z,$e):O?Di(h,ie,g,O,Z,$e):D?Xr(h,ie,g,de.lineClipsArray.length,$e):Sn(h,ie,g,$e);if(U)N.activeTexture.set(X.TEXTURE0),ie.imageAtlasTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE),ce.updatePaintBuffers(Z);else if(O&&(Oe||h.lineAtlas.dirty))N.activeTexture.set(X.TEXTURE0),h.lineAtlas.bind(N);else if(D){const Be=de.gradients[g.id];let qe=Be.texture;if(g.gradientVersion!==Be.version){let Ze=256;if(g.stepInterpolant){const mt=m.getSource().maxzoom,at=te.canonical.z===mt?Math.ceil(1<0?s.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const s=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!s||!a}useProgram(t,s){this.cache=this.cache||{};const a=t+(s?s.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new ca(this.context,ys[t],s,zl[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}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(){const 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 xt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:s}=this.context.gl;return this.width!==t||this.height!==s}}class Jr{constructor(t,s){this.points=t,this.planes=s}static fromInvProjectionMatrix(t,s,a){const o=Math.pow(2,a),h=[[-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(g=>{const y=1/(g=p.af([],g,t))[3]/s*o;return p.a$(g,g,[y,y,1/g[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const y=function(E,O){var B=O[0],U=O[1],D=O[2],Z=B*B+U*U+D*D;return Z>0&&(Z=1/Math.sqrt(Z)),E[0]=O[0]*Z,E[1]=O[1]*Z,E[2]=O[2]*Z,E}([],function(E,O,B){var U=O[0],D=O[1],Z=O[2],Q=B[0],N=B[1],X=B[2];return E[0]=D*X-Z*N,E[1]=Z*Q-U*X,E[2]=U*N-D*Q,E}([],br([],h[g[0]],h[g[1]]),br([],h[g[2]],h[g[1]]))),v=-((T=y)[0]*(S=h[g[1]])[0]+T[1]*S[1]+T[2]*S[2]);var T,S;return y.concat(v)});return new Jr(h,m)}}class Ms{constructor(t,s){this.min=t,this.max=s,this.center=function(a,o,h){return a[0]=.5*o[0],a[1]=.5*o[1],a[2]=.5*o[2],a}([],function(a,o,h){return a[0]=o[0]+h[0],a[1]=o[1]+h[1],a[2]=o[2]+h[2],a}([],this.min,this.max))}quadrant(t){const s=[t%2==0,t<2],a=Mi(this.min),o=Mi(this.max);for(let h=0;h=0&&m++;if(m===0)return 0;m!==s.length&&(a=!1)}if(a)return 2;for(let o=0;o<3;o++){let h=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let g=0;gthis.max[o]-this.min[o])return 0}return 1}}class sn{constructor(t=0,s=0,a=0,o=0){if(isNaN(t)||t<0||isNaN(s)||s<0||isNaN(a)||a<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=s,this.left=a,this.right=o}interpolate(t,s,a){return s.top!=null&&t.top!=null&&(this.top=p.z.number(t.top,s.top,a)),s.bottom!=null&&t.bottom!=null&&(this.bottom=p.z.number(t.bottom,s.bottom,a)),s.left!=null&&t.left!=null&&(this.left=p.z.number(t.left,s.left,a)),s.right!=null&&t.right!=null&&(this.right=p.z.number(t.right,s.right,a)),this}getCenter(t,s){const a=p.ac((this.left+t-this.right)/2,0,t),o=p.ac((this.top+s-this.bottom)/2,0,s);return new p.P(a,o)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new sn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Aa=85.051129;class Fn{constructor(t,s,a,o,h){this.tileSize=512,this._renderWorldCopies=h===void 0||!!h,this._minZoom=t||0,this._maxZoom=s||22,this._minPitch=a??0,this._maxPitch=o??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new p.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new sn,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new Fn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,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.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const s=-p.b1(t,-180,180)*Math.PI/180;this.angle!==s&&(this._unmodified=!1,this.angle=s,this._calcMatrices(),this.rotationMatrix=function(){var a=new p.A(4);return p.A!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,o,h){var m=o[0],g=o[1],y=o[2],v=o[3],T=Math.sin(h),S=Math.cos(h);a[0]=m*S+y*T,a[1]=g*S+v*T,a[2]=m*-T+y*S,a[3]=g*-T+v*S}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const s=p.ac(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==s&&(this._unmodified=!1,this._pitch=s,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const s=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==s&&(this._unmodified=!1,this._zoom=s,this.tileZoom=Math.max(0,Math.floor(s)),this.scale=this.zoomScale(s),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(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)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,s,a){this._unmodified=!1,this._edgeInsets.interpolate(t,s,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const s=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,s)}getVisibleUnwrappedCoordinates(t){const s=[new p.b2(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new p.P(0,0)),o=this.pointCoordinate(new p.P(this.width,0)),h=this.pointCoordinate(new p.P(this.width,this.height)),m=this.pointCoordinate(new p.P(0,this.height)),g=Math.floor(Math.min(a.x,o.x,h.x,m.x)),y=Math.floor(Math.max(a.x,o.x,h.x,m.x)),v=1;for(let T=g-v;T<=y+v;T++)T!==0&&s.push(new p.b2(T,t))}return s}coveringTiles(t){var s,a;let o=this.coveringZoomLevel(t);const h=o;if(t.minzoom!==void 0&&ot.maxzoom&&(o=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),g=p.Y.fromLngLat(this.center),y=Math.pow(2,o),v=[y*m.x,y*m.y,0],T=[y*g.x,y*g.y,0],S=Jr.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o);let E=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(E=o);const O=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,B=N=>({aabb:new Ms([N*y,0,0],[(N+1)*y,y,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),U=[],D=[],Z=o,Q=t.reparseOverscaled?h:o;if(this._renderWorldCopies)for(let N=1;N<=3;N++)U.push(B(-N)),U.push(B(N));for(U.push(B(0));U.length>0;){const N=U.pop(),X=N.x,ee=N.y;let te=N.fullyVisible;if(!te){const Se=N.aabb.intersects(S);if(Se===0)continue;te=Se===2}const ie=t.terrain?v:T,de=N.aabb.distanceX(ie),ce=N.aabb.distanceY(ie),ue=Math.max(Math.abs(de),Math.abs(ce));if(N.zoom===Z||ue>O+(1<=E){const Se=Z-N.zoom,Oe=v[0]-.5-(X<>1),Le=N.zoom+1;let $e=N.aabb.quadrant(Se);if(t.terrain){const We=new p.Q(Le,N.wrap,Le,Oe,_e),Be=t.terrain.getMinMaxElevation(We),qe=(s=Be.minElevation)!==null&&s!==void 0?s:this.elevation,Ze=(a=Be.maxElevation)!==null&&a!==void 0?a:this.elevation;$e=new Ms([$e.min[0],$e.min[1],qe],[$e.max[0],$e.max[1],Ze])}U.push({aabb:$e,zoom:Le,x:Oe,y:_e,wrap:N.wrap,fullyVisible:te})}}return D.sort((N,X)=>N.distanceSq-X.distanceSq).map(N=>N.tileID)}resize(t,s){this.width=t,this.height=s,this.pixelsToGLUnits=[2/t,-2/s],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const s=p.ac(t.lat,-85.051129,Aa);return new p.P(p.N(t.lng)*this.worldSize,p.O(s)*this.worldSize)}unproject(t){return new p.Y(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const s=this.elevation,a=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,o=this.pointLocation(this.centerPoint,t),h=t.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-h))return;const m=a+s-h,g=Math.cos(this._pitch)*this.cameraToCenterDistance/m/p.b3(1,o.lat),y=this.scaleZoom(g/this.tileSize);this._elevation=h,this._center=o,this.zoom=y}setLocationAtPoint(t,s){const a=this.pointCoordinate(s),o=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),m=new p.Y(h.x-(a.x-o.x),h.y-(a.y-o.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,s){return s?this.coordinatePoint(this.locationCoordinate(t),s.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,s){return this.coordinateLocation(this.pointCoordinate(t,s))}locationCoordinate(t){return p.Y.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,s){if(s){const E=s.pointCoordinate(t);if(E!=null)return E}const a=[t.x,t.y,0,1],o=[t.x,t.y,1,1];p.af(a,a,this.pixelMatrixInverse),p.af(o,o,this.pixelMatrixInverse);const h=a[3],m=o[3],g=a[1]/h,y=o[1]/m,v=a[2]/h,T=o[2]/m,S=v===T?0:(0-v)/(T-v);return new p.Y(p.z.number(a[0]/h,o[0]/m,S)/this.worldSize,p.z.number(g,y,S)/this.worldSize)}coordinatePoint(t,s=0,a=this.pixelMatrix){const o=[t.x*this.worldSize,t.y*this.worldSize,s,1];return p.af(o,o,a),new p.P(o[0]/o[3],o[1]/o[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new Mt().extend(this.pointLocation(new p.P(0,t))).extend(this.pointLocation(new p.P(this.width,t))).extend(this.pointLocation(new p.P(this.width,this.height))).extend(this.pointLocation(new p.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Mt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Aa])}calculatePosMatrix(t,s=!1){const a=t.key,o=s?this._alignedPosMatrixCache:this._posMatrixCache;if(o[a])return o[a];const h=t.canonical,m=this.worldSize/this.zoomScale(h.z),g=h.x+Math.pow(2,h.z)*t.wrap,y=p.an(new Float64Array(16));return p.H(y,y,[g*m,h.y*m,0]),p.J(y,y,[m/p.W,m/p.W,1]),p.K(y,s?this.alignedProjMatrix:this.projMatrix,y),o[a]=new Float32Array(y),o[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,s){s=p.ac(+s,this.minZoom,this.maxZoom);const a={center:new p.M(t.lng,t.lat),zoom:s};let o=this.lngRange;if(!this._renderWorldCopies&&o===null){const N=179.9999999999;o=[-N,N]}const h=this.tileSize*this.zoomScale(a.zoom);let m=0,g=h,y=0,v=h,T=0,S=0;const{x:E,y:O}=this.size;if(this.latRange){const N=this.latRange;m=p.O(N[1])*h,g=p.O(N[0])*h,g-mg&&(Z=g-N)}if(o){const N=(y+v)/2;let X=B;this._renderWorldCopies&&(X=p.b1(B,N-h/2,N+h/2));const ee=E/2;X-eev&&(D=v-ee)}if(D!==void 0||Z!==void 0){const N=new p.P(D??B,Z??U);a.center=this.unproject.call({worldSize:h},N).wrap()}return a}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:s,zoom:a}=this.getConstrained(this.center,this.zoom);this.center=s,this.zoom=a,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,s=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=p.b3(1,this.center.lat)*this.worldSize;let o=p.an(new Float64Array(16));p.J(o,o,[this.width/2,-this.height/2,1]),p.H(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=p.an(new Float64Array(16)),p.J(o,o,[1,-1,1]),p.H(o,o,[-1,-1,0]),p.J(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;const h=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),g=h-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?g:h,v=Math.PI/2+this._pitch,T=this._fov*(.5+t.y/this.height),S=Math.sin(T)*y/Math.sin(p.ac(Math.PI-v-T,.01,Math.PI-.01)),E=this.getHorizon(),O=2*Math.atan(E/this.cameraToCenterDistance)*(.5+t.y/(2*E)),B=Math.sin(O)*y/Math.sin(p.ac(Math.PI-v-O,.01,Math.PI-.01)),U=Math.min(S,B),D=1.01*(Math.cos(Math.PI/2-this._pitch)*U+y),Z=this.height/50;o=new Float64Array(16),p.b4(o,this._fov,this.width/this.height,Z,D),o[8]=2*-t.x/this.width,o[9]=2*t.y/this.height,p.J(o,o,[1,-1,1]),p.H(o,o,[0,0,-this.cameraToCenterDistance]),p.b5(o,o,this._pitch),p.ad(o,o,this.angle),p.H(o,o,[-s,-a,0]),this.mercatorMatrix=p.J([],o,[this.worldSize,this.worldSize,this.worldSize]),p.J(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=p.K(new Float64Array(16),this.labelPlaneMatrix,o),p.H(o,o,[0,0,-this.elevation]),this.projMatrix=o,this.invProjMatrix=p.ar([],o),this.pixelMatrix3D=p.K(new Float64Array(16),this.labelPlaneMatrix,o);const Q=this.width%2/2,N=this.height%2/2,X=Math.cos(this.angle),ee=Math.sin(this.angle),te=s-Math.round(s)+X*Q+ee*N,ie=a-Math.round(a)+X*N+ee*Q,de=new Float64Array(o);if(p.H(de,de,[te>.5?te-1:te,ie>.5?ie-1:ie,0]),this.alignedProjMatrix=de,o=p.ar(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new p.P(0,0)),s=[t.x*this.worldSize,t.y*this.worldSize,0,1];return p.af(s,s,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(0,t))}getCameraQueryGeometry(t){const s=this.getCameraPoint();if(t.length===1)return[t[0],s];{let a=s.x,o=s.y,h=s.x,m=s.y;for(const g of t)a=Math.min(a,g.x),o=Math.min(o,g.y),h=Math.max(h,g.x),m=Math.max(m,g.y);return[new p.P(a,o),new p.P(h,o),new p.P(h,m),new p.P(a,m),new p.P(a,o)]}}lngLatToCameraDepth(t,s){const a=this.locationCoordinate(t),o=[a.x*this.worldSize,a.y*this.worldSize,s,1];return p.af(o,o,this.projMatrix),o[2]/o[3]}}function Ca(c,t){let s,a=!1,o=null,h=null;const m=()=>{o=null,a&&(c.apply(h,s),o=setTimeout(m,t),a=!1)};return(...g)=>(a=!0,h=this,s=g,o||m(),o)}class Pa{constructor(t){this._getCurrentHash=()=>{const s=window.location.hash.replace("#","");if(this._hashName){let a;return s.split("&").map(o=>o.split("=")).forEach(o=>{o[0]===this._hashName&&(a=o)}),(a&&a[1]||"").split("/")}return s.split("/")},this._onHashChange=()=>{const s=this._getCurrentHash();if(s.length>=3&&!s.some(a=>isNaN(a))){const a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(s[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+s[2],+s[1]],zoom:+s[0],bearing:a,pitch:+(s[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const s=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,s)}catch{}},this._updateHash=Ca(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()),delete this._map,this}getHashString(t){const s=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,o=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,o),m=Math.round(s.lng*h)/h,g=Math.round(s.lat*h)/h,y=this._map.getBearing(),v=this._map.getPitch();let T="";if(T+=t?`/${m}/${g}/${a}`:`${a}/${g}/${m}`,(y||v)&&(T+="/"+Math.round(10*y)/10),v&&(T+=`/${Math.round(v)}`),this._hashName){const S=this._hashName;let E=!1;const O=window.location.hash.slice(1).split("&").map(B=>{const U=B.split("=")[0];return U===S?(E=!0,`${U}=${T}`):B}).filter(B=>B);return E||O.push(`${S}=${T}`),`#${O.join("&")}`}return`#${T}`}}const rr={linearity:.3,easing:p.b6(0,0,.3,1)},Uo=p.e({deceleration:2500,maxSpeed:1400},rr),No=p.e({deceleration:20,maxSpeed:1400},rr),$o=p.e({deceleration:1e3,maxSpeed:360},rr),jo=p.e({deceleration:1e3,maxSpeed:90},rr);class qo{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:xe.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,s=xe.now();for(;t.length>0&&s-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const s={zoom:0,bearing:0,pitch:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)s.zoom+=h.zoomDelta||0,s.bearing+=h.bearingDelta||0,s.pitch+=h.pitchDelta||0,h.panDelta&&s.pan._add(h.panDelta),h.around&&(s.around=h.around),h.pinchAround&&(s.pinchAround=h.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(s.pan.mag()){const h=an(s.pan.mag(),a,p.e({},Uo,t||{}));o.offset=s.pan.mult(h.amount/s.pan.mag()),o.center=this._map.transform.center,nn(o,h)}if(s.zoom){const h=an(s.zoom,a,No);o.zoom=this._map.transform.zoom+h.amount,nn(o,h)}if(s.bearing){const h=an(s.bearing,a,$o);o.bearing=this._map.transform.bearing+p.ac(h.amount,-179,179),nn(o,h)}if(s.pitch){const h=an(s.pitch,a,jo);o.pitch=this._map.transform.pitch+h.amount,nn(o,h)}if(o.zoom||o.bearing){const h=s.pinchAround===void 0?s.around:s.pinchAround;o.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),p.e(o,{noMoveStart:!0})}}function nn(c,t){(!c.duration||c.durations.unproject(y)),g=h.reduce((y,v,T,S)=>y.add(v.div(S.length)),new p.P(0,0));super(t,{points:h,point:g,lngLats:m,lngLat:s.unproject(g),originalEvent:a}),this._defaultPrevented=!1}}class Li extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,s,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class sr{constructor(t,s){this._map=t,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Li(t.type,this._map,t))}mousedown(t,s){return this._mousedownPos=s,this._firePreventable(new Ot(t.type,this._map,t))}mouseup(t){this._map.fire(new Ot(t.type,this._map,t))}click(t,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new Ot(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ot(t.type,this._map,t))}mouseover(t){this._map.fire(new Ot(t.type,this._map,t))}mouseout(t){this._map.fire(new Ot(t.type,this._map,t))}touchstart(t){return this._firePreventable(new zs(t.type,this._map,t))}touchmove(t){this._map.fire(new zs(t.type,this._map,t))}touchend(t){this._map.fire(new zs(t.type,this._map,t))}touchcancel(t){this._map.fire(new zs(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Zo{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ot(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ot("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ot(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ci{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.pointLocation(p.P.convert(t),this._map.terrain)}}class ks{constructor(t,s){this._map=t,this._tr=new ci(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,s){this.isEnabled()&&t.shiftKey&&t.button===0&&(re.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(t,s){if(!this._active)return;const a=s;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)h.fitScreenCoordinates(a,o,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&&(re.remove(this._box),this._box=null),re.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,s){return this._map.fire(new p.k(t,{originalEvent:s}))}}function Ea(c,t){if(c.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${c.length}, points ${t.length}`);const s={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(o){const h=new p.P(0,0);for(const m of o)h._add(m);return h.div(o.length)}(s),this.touches=Ea(a,s)))}touchmove(t,s,a){if(this.aborted||!this.centroid)return;const o=Ea(a,s);for(const h in this.touches){const m=o[h];(!m||m.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(t,s,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class Ma{constructor(t){this.singleTap=new Nl(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,s,a){this.singleTap.touchstart(t,s,a)}touchmove(t,s,a){this.singleTap.touchmove(t,s,a)}touchend(t,s,a){const o=this.singleTap.touchend(t,s,a);if(o){const h=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(o)<30;if(h&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class Go{constructor(t){this._tr=new ci(t),this._zoomIn=new Ma({numTouches:1,numTaps:2}),this._zoomOut=new Ma({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,s,a){this._zoomIn.touchstart(t,s,a),this._zoomOut.touchstart(t,s,a)}touchmove(t,s,a){this._zoomIn.touchmove(t,s,a),this._zoomOut.touchmove(t,s,a)}touchend(t,s,a){const o=this._zoomIn.touchend(t,s,a),h=this._zoomOut.touchend(t,s,a),m=this._tr;return o?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(o)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(h)},{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 pr{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){const s=this._moveFunction(...t);if(s.bearingDelta||s.pitchDelta||s.around||s.panDelta)return this._active=!0,s}dragStart(t,s){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=s.length?s[0]:s,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,s){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const o=s.length?s[0]:s;return!this._moved&&o.dist(a){c.mousedown=c.dragStart,c.mousemoveWindow=c.dragMove,c.mouseup=c.dragEnd,c.contextmenu=function(t){t.preventDefault()}},Ds=({enable:c,clickTolerance:t,bearingDegreesPerPixelMoved:s=.8})=>{const a=new Ie({checkCorrectEvent:o=>re.mouseButton(o)===0&&o.ctrlKey||re.mouseButton(o)===2});return new pr({clickTolerance:t,move:(o,h)=>({bearingDelta:(h.x-o.x)*s}),moveStateManager:a,enable:c,assignEvents:Qr})},ka=({enable:c,clickTolerance:t,pitchDegreesPerPixelMoved:s=-.5})=>{const a=new Ie({checkCorrectEvent:o=>re.mouseButton(o)===0&&o.ctrlKey||re.mouseButton(o)===2});return new pr({clickTolerance:t,move:(o,h)=>({pitchDelta:(h.y-o.y)*s}),moveStateManager:a,enable:c,assignEvents:Qr})};class Te{constructor(t,s){this._clickTolerance=t.clickTolerance||1,this._map=s,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(t,s,a){return this._calculateTransform(t,s,a)}touchmove(t,s,a){if(this._active&&!(a.length0&&(this._active=!0);const o=Ea(a,s),h=new p.P(0,0),m=new p.P(0,0);let g=0;for(const v in o){const T=o[v],S=this._touches[v];S&&(h._add(T),m._add(T.sub(S)),g++,o[v]=T)}if(this._touches=o,gMath.abs(c.x)}class Wo extends on{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,s,a){super.touchstart(t,s,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,Ra(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,s,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const o=t[0].sub(this._lastPoints[0]),h=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,h,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(t,s,a){if(this._valid!==void 0)return this._valid;const o=t.mag()>=2,h=s.mag()>=2;if(!o&&!h)return;if(!o||!h)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==s.y>0;return Ra(t)&&Ra(s)&&m}}const es={panStep:100,bearingStep:15,pitchStep:10};class ht{constructor(t){this._tr=new ci(t);const s=es;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let s=0,a=0,o=0,h=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),h=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),h=1);break;case 38:t.shiftKey?o=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?o=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,o=0),{cameraAnimation:g=>{const y=this._tr;g.easeTo({duration:300,easeId:"keyboardHandler",easing:Un,zoom:s?Math.round(y.zoom)+s*(t.shiftKey?2:1):y.zoom,bearing:y.bearing+a*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-h*this._panStep,-m*this._panStep],center:y.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 Un(c){return c*(2-c)}const Nn=4.000244140625;class Ba{constructor(t,s){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=t,this._tr=new ci(t),this._triggerRenderFrame=s,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}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)}wheel(t){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!t[this._map.cooperativeGestures._bypassKey])return;let s=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=xe.now(),o=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,s!==0&&s%Nn==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(o*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),t.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=t,this._delta-=s,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const s=re.mousePos(this._map.getCanvas(),t),a=this._tr;this._around=s.y>a.transform.height/2-a.transform.getHorizon()?p.M.convert(this._aroundCenter?a.center:a.unproject(s)):p.M.convert(a.center),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const g=this._type==="wheel"&&Math.abs(this._delta)>Nn?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*g)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const s=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,o=this._easing;let h,m=!1;if(this._type==="wheel"&&a&&o){const g=Math.min((xe.now()-this._lastWheelEventTime)/200,1),y=o(g);h=p.z.number(a,s,y),g<1?this._frameId||(this._frameId=!0):m=!0}else h=s,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let s=p.b7;if(this._prevEase){const a=this._prevEase,o=(xe.now()-a.start)/a.duration,h=a.easing(o+.01)-a.easing(o),m=.27/Math.sqrt(h*h+1e-4)*.01,g=Math.sqrt(.0729-m*m);s=p.b6(m,g,.25,1)}return this._prevEase={start:xe.now(),duration:t,easing:s},s}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Fa{constructor(t,s){this._clickZoom=t,this._tapZoom=s}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 Xo{constructor(t){this._tr=new ci(t),this.reset()}reset(){this._active=!1}dblclick(t,s){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(s)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $l{constructor(){this._tap=new Ma({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,s,a){if(!this._swipePoint)if(this._tapTime){const o=s[0],h=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(o)<30;h&&m?a.length>0&&(this._swipePoint=o,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(t,s,a)}touchmove(t,s,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const o=s[0],h=o.y-this._swipePoint.y;return this._swipePoint=o,t.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(t,s,a)}touchend(t,s,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const o=this._tap.touchend(t,s,a);o&&(this._tapTime=t.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ni{constructor(t,s,a){this._el=t,this._mousePan=s,this._touchPan=a}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 ln{constructor(t,s,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=s,this._mousePitch=a}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Me{constructor(t,s,a,o){this._el=t,this._touchZoom=s,this._touchRotate=a,this._tapDragZoom=o,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()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ke{constructor(t,s){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=s,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=re.create("div","maplibregl-cooperative-gesture-screen",t);let s=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(s=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=s,this._container.appendChild(o);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=a,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(re.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(t){this._onCooperativeGesture(t.touches.length===1)}wheel(t){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!t[this._bypassKey])}_onCooperativeGesture(t){this._enabled&&t&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const ts=c=>c.zoom||c.drag||c.pitch||c.rotate;class Oa extends p.k{}function cn(c){return c.panDelta&&c.panDelta.mag()||c.zoomDelta||c.bearingDelta||c.pitchDelta}class hi{constructor(t,s){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,h)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=o.type==="renderFrame"?void 0:o,g={needsRenderFrame:!1},y={},v={},T=o.touches,S=T?this._getMapTouches(T):void 0,E=S?re.touchPos(this._map.getCanvas(),S):re.mousePos(this._map.getCanvas(),o);for(const{handlerName:U,handler:D,allowed:Z}of this._handlers){if(!D.isEnabled())continue;let Q;this._blockedByActive(v,Z,U)?D.reset():D[h||o.type]&&(Q=D[h||o.type](o,E,S),this.mergeHandlerResult(g,y,Q,U,m),Q&&Q.needsRenderFrame&&this._triggerRenderFrame()),(Q||D.isActive())&&(v[U]=D)}const O={};for(const U in this._previousActiveHandlers)v[U]||(O[U]=m);this._previousActiveHandlers=v,(Object.keys(O).length||cn(g))&&(this._changes.push([g,y,O]),this._triggerRenderFrame()),(Object.keys(v).length||cn(g))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:B}=g;B&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],B(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new qo(t),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[o,h,m]of this._listeners)re.addEventListener(o,h,o===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,s,a]of this._listeners)re.removeEventListener(t,s,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const s=this._map,a=s.getCanvasContainer();this._add("mapEvent",new sr(s,t));const o=s.boxZoom=new ks(s,t);this._add("boxZoom",o),t.interactive&&t.boxZoom&&o.enable();const h=s.cooperativeGestures=new ke(s,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const m=new Go(s),g=new Xo(s);s.doubleClickZoom=new Fa(g,m),this._add("tapZoom",m),this._add("clickZoom",g),t.interactive&&t.doubleClickZoom&&s.doubleClickZoom.enable();const y=new $l;this._add("tapDragZoom",y);const v=s.touchPitch=new Wo(s);this._add("touchPitch",v),t.interactive&&t.touchPitch&&s.touchPitch.enable(t.touchPitch);const T=Ds(t),S=ka(t);s.dragRotate=new ln(t,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]),t.interactive&&t.dragRotate&&s.dragRotate.enable();const E=(({enable:Q,clickTolerance:N})=>{const X=new Ie({checkCorrectEvent:ee=>re.mouseButton(ee)===0&&!ee.ctrlKey});return new pr({clickTolerance:N,move:(ee,te)=>({around:te,panDelta:te.sub(ee)}),activateOnStart:!0,moveStateManager:X,enable:Q,assignEvents:Qr})})(t),O=new Te(t,s);s.dragPan=new Ni(a,E,O),this._add("mousePan",E),this._add("touchPan",O,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&s.dragPan.enable(t.dragPan);const B=new La,U=new Vn;s.touchZoomRotate=new Me(a,U,B,y),this._add("touchRotate",B,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&s.touchZoomRotate.enable(t.touchZoomRotate);const D=s.scrollZoom=new Ba(s,()=>this._triggerRenderFrame());this._add("scrollZoom",D,["mousePan"]),t.interactive&&t.scrollZoom&&s.scrollZoom.enable(t.scrollZoom);const Z=s.keyboard=new ht(s);this._add("keyboard",Z),t.interactive&&t.keyboard&&s.keyboard.enable(),this._add("blockableMapEvent",new Zo(s))}_add(t,s,a){this._handlers.push({handlerName:t,handler:s,allowed:a}),this._handlersById[t]=s}stop(t){if(!this._updatingCamera){for(const{handler:s}of this._handlers)s.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{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!!ts(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,s,a){for(const o in t)if(o!==a&&(!s||s.indexOf(o)<0))return!0;return!1}_getMapTouches(t){const s=[];for(const a of t)this._el.contains(a.target)&&s.push(a);return s}mergeHandlerResult(t,s,a,o,h){if(!a)return;p.e(t,a);const m={handlerName:o,originalEvent:a.originalEvent||h};a.zoomDelta!==void 0&&(s.zoom=m),a.panDelta!==void 0&&(s.drag=m),a.pitchDelta!==void 0&&(s.pitch=m),a.bearingDelta!==void 0&&(s.rotate=m)}_applyChanges(){const t={},s={},a={};for(const[o,h,m]of this._changes)o.panDelta&&(t.panDelta=(t.panDelta||new p.P(0,0))._add(o.panDelta)),o.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+o.pitchDelta),o.around!==void 0&&(t.around=o.around),o.pinchAround!==void 0&&(t.pinchAround=o.pinchAround),o.noInertia&&(t.noInertia=o.noInertia),p.e(s,h),p.e(a,m);this._updateMapTransform(t,s,a),this._changes=[]}_updateMapTransform(t,s,a){const o=this._map,h=o._getTransformForUpdate(),m=o.terrain;if(!(cn(t)||m&&this._terrainMovement))return this._fireEvents(s,a,!0);let{panDelta:g,zoomDelta:y,bearingDelta:v,pitchDelta:T,around:S,pinchAround:E}=t;E!==void 0&&(S=E),o._stop(!0),S=S||o.transform.centerPoint;const O=h.pointLocation(g?S.sub(g):S);v&&(h.bearing+=v),T&&(h.pitch+=T),y&&(h.zoom+=y),m?this._terrainMovement||!s.drag&&!s.zoom?s.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(g)):h.setLocationAtPoint(O,S):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(O,S),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,h.recalculateZoom(o.terrain)})):h.setLocationAtPoint(O,S),o._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(s,a,!0)}_fireEvents(t,s,a){const o=ts(this._eventsInProgress),h=ts(t),m={};for(const T in t){const{originalEvent:S}=t[T];this._eventsInProgress[T]||(m[`${T}start`]=S),this._eventsInProgress[T]=t[T]}!o&&h&&this._fireEvent("movestart",h.originalEvent);for(const T in m)this._fireEvent(T,m[T]);h&&this._fireEvent("move",h.originalEvent);for(const T in t){const{originalEvent:S}=t[T];this._fireEvent(T,S)}const g={};let y;for(const T in this._eventsInProgress){const{handlerName:S,originalEvent:E}=this._eventsInProgress[T];this._handlersById[S].isActive()||(delete this._eventsInProgress[T],y=s[S]||E,g[`${T}end`]=y)}for(const T in g)this._fireEvent(T,g[T]);const v=ts(this._eventsInProgress);if(a&&(o||h)&&!v){this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),S=E=>E!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Oa("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Ko extends p.E{constructor(t,s){super(),this._renderFrameCallback=()=>{const a=Math.min((xe.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=s.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new p.M(this.transform.center.lng,this.transform.center.lat)}setCenter(t,s){return this.jumpTo({center:t},s)}panBy(t,s,a){return t=p.P.convert(t).mult(-1),this.panTo(this.transform.center,p.e({offset:t},s),a)}panTo(t,s,a){return this.easeTo(p.e({center:t},s),a)}getZoom(){return this.transform.zoom}setZoom(t,s){return this.jumpTo({zoom:t},s),this}zoomTo(t,s,a){return this.easeTo(p.e({zoom:t},s),a)}zoomIn(t,s){return this.zoomTo(this.getZoom()+1,t,s),this}zoomOut(t,s){return this.zoomTo(this.getZoom()-1,t,s),this}getBearing(){return this.transform.bearing}setBearing(t,s){return this.jumpTo({bearing:t},s),this}getPadding(){return this.transform.padding}setPadding(t,s){return this.jumpTo({padding:t},s),this}rotateTo(t,s,a){return this.easeTo(p.e({bearing:t},s),a)}resetNorth(t,s){return this.rotateTo(0,p.e({duration:1e3},t),s),this}resetNorthPitch(t,s){return this.easeTo(p.e({bearing:0,pitch:0,duration:1e3},t),s),this}snapToNorth(t,s){return Math.abs(this.getBearing()){if(this._zooming&&(o.zoom=p.z.number(h,D,ie)),this._rotating&&(o.bearing=p.z.number(m,v,ie)),this._pitching&&(o.pitch=p.z.number(g,T,ie)),this._padding&&(o.interpolatePadding(y,S,ie),O=o.centerPoint.add(E)),this.terrain&&!t.freezeElevation&&this._updateElevation(ie),X)o.setLocationAtPoint(X,ee);else{const de=o.zoomScale(o.zoom-h),ce=D>h?Math.min(2,N):Math.max(.5,N),ue=Math.pow(ce,1-ie),Se=o.unproject(Z.add(Q.mult(ie*ue)).mult(de));o.setLocationAtPoint(o.renderWorldCopies?Se.wrap():Se,O)}this._applyUpdatedTransform(o),this._fireMoveEvents(s)},ie=>{this.terrain&&this._finalizeElevation(),this._afterEase(s,ie)},t),this}_prepareEase(t,s,a={}){this._moving=!0,s||a.moving||this.fire(new p.k("movestart",t)),this._zooming&&!a.zooming&&this.fire(new p.k("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new p.k("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new p.k("pitchstart",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.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const s=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&s!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(s-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=s}this.transform.elevation=p.z.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const s=t.clone(),{center:a,zoom:o,pitch:h,bearing:m,elevation:g}=this.transformCameraUpdate(s);a&&(s.center=a),o!==void 0&&(s.zoom=o),h!==void 0&&(s.pitch=h),m!==void 0&&(s.bearing=m),g!==void 0&&(s.elevation=g),this.transform.apply(s)}_fireMoveEvents(t){this.fire(new p.k("move",t)),this._zooming&&this.fire(new p.k("zoom",t)),this._rotating&&this.fire(new p.k("rotate",t)),this._pitching&&this.fire(new p.k("pitch",t))}_afterEase(t,s){if(this._easeId&&s&&this._easeId===s)return;delete this._easeId;const a=this._zooming,o=this._rotating,h=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new p.k("zoomend",t)),o&&this.fire(new p.k("rotateend",t)),h&&this.fire(new p.k("pitchend",t)),this.fire(new p.k("moveend",t))}flyTo(t,s){var a;if(!t.essential&&xe.prefersReducedMotion){const We=p.L(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(We,s)}this.stop(),t=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.b7},t);const o=this._getTransformForUpdate(),h=this.getZoom(),m=this.getBearing(),g=this.getPitch(),y=this.getPadding(),v="bearing"in t?this._normalizeBearing(t.bearing,m):m,T="pitch"in t?+t.pitch:g,S="padding"in t?t.padding:o.padding,E=p.P.convert(t.offset);let O=o.centerPoint.add(E);const B=o.pointLocation(O),{center:U,zoom:D}=o.getConstrained(p.M.convert(t.center||B),(a=t.zoom)!==null&&a!==void 0?a:h);this._normalizeCenter(U);const Z=o.zoomScale(D-h),Q=o.project(B),N=o.project(U).sub(Q);let X=t.curve;const ee=Math.max(o.width,o.height),te=ee/Z,ie=N.mag();if("minZoom"in t){const We=p.ac(Math.min(t.minZoom,h,D),o.minZoom,o.maxZoom),Be=ee/o.zoomScale(We-h);X=Math.sqrt(Be/ie*2)}const de=X*X;function ce(We){const Be=(te*te-ee*ee+(We?-1:1)*de*de*ie*ie)/(2*(We?te:ee)*de*ie);return Math.log(Math.sqrt(Be*Be+1)-Be)}function ue(We){return(Math.exp(We)-Math.exp(-We))/2}function Se(We){return(Math.exp(We)+Math.exp(-We))/2}const Oe=ce(!1);let _e=function(We){return Se(Oe)/Se(Oe+X*We)},Le=function(We){return ee*((Se(Oe)*(ue(Be=Oe+X*We)/Se(Be))-ue(Oe))/de)/ie;var Be},$e=(ce(!0)-Oe)/X;if(Math.abs(ie)<1e-6||!isFinite($e)){if(Math.abs(ee-te)<1e-6)return this.easeTo(t,s);const We=tet.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=m!==v,this._pitching=T!==g,this._padding=!o.isPaddingEqual(S),this._prepareEase(s,!1),this.terrain&&this._prepareElevation(U),this._ease(We=>{const Be=We*$e,qe=1/_e(Be);o.zoom=We===1?D:h+o.scaleZoom(qe),this._rotating&&(o.bearing=p.z.number(m,v,We)),this._pitching&&(o.pitch=p.z.number(g,T,We)),this._padding&&(o.interpolatePadding(y,S,We),O=o.centerPoint.add(E)),this.terrain&&!t.freezeElevation&&this._updateElevation(We);const Ze=We===1?U:o.unproject(Q.add(N.mult(Le(Be))).mult(qe));o.setLocationAtPoint(o.renderWorldCopies?Ze.wrap():Ze,O),this._applyUpdatedTransform(o),this._fireMoveEvents(s)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(s)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,s){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,s)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,s,a){a.animate===!1||a.duration===0?(t(1),s()):(this._easeStart=xe.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,s){t=p.b1(t,-180,180);const a=Math.abs(t-s);return Math.abs(t-360-s)180?-360:a<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(p.M.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const $i={compact:!0,customAttribution:'MapLibre'};class Yo{constructor(t=$i){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=s=>{!s||s.sourceDataType!=="metadata"&&s.sourceDataType!=="visibility"&&s.dataType!=="style"&&s.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=re.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=re.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=re.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(){re.remove(this._container),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,s){const a=this._map._getUIString(`AttributionControl.${s}`);t.title=a,t.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(o=>typeof o!="string"?"":o)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}const s=this._map.style.sourceCaches;for(const o in s){const h=s[o];if(h.used||h.usedForTerrain){const m=h.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(o=>String(o).trim()),t.sort((o,h)=>o.length-h.length),t=t.filter((o,h)=>{for(let m=h+1;m=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ls{constructor(t={}){this._updateCompact=()=>{const s=this._container.children;if(s.length){const a=s[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=re.create("div","maplibregl-ctrl");const s=re.create("a","maplibregl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://maplibre.org/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){re.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class _t{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const s=++this._id;return this._queue.push({callback:t,id:s,cancelled:!1}),s}remove(t){const s=this._currentlyRunning,a=s?this._queue.concat(s):this._queue;for(const o of a)if(o.id===t)return void(o.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const s=this._currentlyRunning=this._queue;this._queue=[];for(const a of s)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var It=p.X([{name:"a_pos3d",type:"Int16",components:3}]);class Jo extends p.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,s){this.sourceCache.update(t,s),this._renderableTilesKeys=[];const a={};for(const o of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:s}))a[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),p.aN(o.posMatrix,0,p.W,0,p.W,0,1),this._tiles[o.key]=new oi(o,this.tileSize));for(const o in this._tiles)a[o]||delete this._tiles[o]}freeRtt(t){for(const s in this._tiles){const a=this._tiles[s];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const s={};for(const a of this._renderableTilesKeys){const o=this._tiles[a].tileID;if(o.canonical.equals(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16),p.aN(h.posMatrix,0,p.W,0,p.W,0,1),s[a]=h}else if(o.canonical.isChildOf(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const m=o.canonical.z-t.canonical.z,g=o.canonical.x-(o.canonical.x>>m<>m<>m;p.aN(h.posMatrix,0,v,0,v,0,1),p.H(h.posMatrix,h.posMatrix,[-g*v,-y*v,0]),s[a]=h}else if(t.canonical.isChildOf(o.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const m=t.canonical.z-o.canonical.z,g=t.canonical.x-(t.canonical.x>>m<>m<>m;p.aN(h.posMatrix,0,p.W,0,p.W,0,1),p.H(h.posMatrix,h.posMatrix,[g*v,y*v,0]),p.J(h.posMatrix,h.posMatrix,[1/2**m,1/2**m,0]),s[a]=h}}return s}getSourceTile(t,s){const a=this.sourceCache._source;let o=t.overscaledZ-this.deltaZoom;if(o>a.maxzoom&&(o=a.maxzoom),o=a.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(t.scaledTo(o--).key);return h}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(s=>s.timeAdded>=t)}}class hn{constructor(t,s,a){this.painter=t,this.sourceCache=new Jo(s),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,s,a,o=p.W){var h;if(!(s>=0&&s=0&&at.canonical.z&&(t.canonical.z>=o?h=t.canonical.z-o:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>h<>h<>8<<4|h>>8,s[m+3]=0;const a=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(s.buffer)),o=new xt(t,a,t.gl.RGBA,{premultiply:!1});return o.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const s=new Uint8Array(4),a=this.painter.context,o=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,o.RGBA,o.UNSIGNED_BYTE,s),a.bindFramebuffer.set(null);const h=s[0]+(s[2]>>4<<8),m=s[1]+((15&s[2])<<8),g=this.coordsIndex[255-s[3]],y=g&&this.sourceCache.getTileByID(g);if(!y)return null;const v=this._coordsTextureSize,T=(1<t.id!==s),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const s of this._recentlyUsed)if(!this._objects[s].inUse)return this._objects[s];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse)===!1}}const zr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Va{constructor(t,s){this.painter=t,this.terrain=s,this.pool=new $n(t.context,30,s.sourceCache.tileSize*s.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,s){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(s)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const o=t.sourceCaches[a].getVisibleCoordinates();for(const h of o){const m=this.terrain.sourceCache.getTerrainCoords(h);for(const g in m)this._coordsDescendingInv[a][g]||(this._coordsDescendingInv[a][g]=[]),this._coordsDescendingInv[a][g].push(m[g])}}this._coordsDescendingInvStr={};for(const a of t._order){const o=t._layers[a],h=o.source;if(zr[o.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const m in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][m]=this._coordsDescendingInv[h][m].map(g=>g.key).sort().join()}}for(const a of this._renderableTiles)for(const o in this._coordsDescendingInvStr){const h=this._coordsDescendingInvStr[o][a.tileID.key];h&&h!==a.rttCoords[o]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const s=t.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(zr[s]&&(this._prevType&&zr[this._prevType]||this._stacks.push([]),this._prevType=s,this._stacks[this._stacks.length-1].push(t.id),!o))return!0;if(zr[this._prevType]||zr[s]&&o){this._prevType=s;const h=this._stacks.length-1,m=this._stacks[h]||[];for(const g of this._renderableTiles){if(this.pool.isFull()&&(Ia(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(g),g.rtt[h]){const v=this.pool.getObjectForId(g.rtt[h].id);if(v.stamp===g.rtt[h].stamp){this.pool.useObject(v);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),g.rtt[h]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:p.aO.transparent,stencil:0}),a.currentStencilSource=void 0;for(let v=0;v{c.touchstart=c.dragStart,c.touchmoveWindow=c.dragMove,c.touchend=c.dragEnd},$a={showCompass:!0,showZoom:!0,visualizePitch:!1};class ja{constructor(t,s,a=!1){this.mousedown=m=>{this.startMouse(p.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),re.mousePos(this.element,m)),re.addEventListener(window,"mousemove",this.mousemove),re.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,re.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=re.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),re.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=re.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const o=t.dragRotate._mouseRotate.getClickTolerance(),h=t.dragRotate._mousePitch.getClickTolerance();this.element=s,this.mouseRotate=Ds({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:g,bearingDegreesPerPixelMoved:y=.8})=>{const v=new za;return new pr({clickTolerance:g,move:(T,S)=>({bearingDelta:(S.x-T.x)*y}),moveStateManager:v,enable:m,assignEvents:jn})})({clickTolerance:o,enable:!0}),this.map=t,a&&(this.mousePitch=ka({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:g,pitchDegreesPerPixelMoved:y=-.5})=>{const v=new za;return new pr({clickTolerance:g,move:(T,S)=>({pitchDelta:(S.y-T.y)*y}),moveStateManager:v,enable:m,assignEvents:jn})})({clickTolerance:h,enable:!0})),re.addEventListener(s,"mousedown",this.mousedown),re.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),re.addEventListener(s,"touchcancel",this.reset)}startMouse(t,s){this.mouseRotate.dragStart(t,s),this.mousePitch&&this.mousePitch.dragStart(t,s),re.disableDrag()}startTouch(t,s){this.touchRotate.dragStart(t,s),this.touchPitch&&this.touchPitch.dragStart(t,s),re.disableDrag()}moveMouse(t,s){const a=this.map,{bearingDelta:o}=this.mouseRotate.dragMove(t,s)||{};if(o&&a.setBearing(a.getBearing()+o),this.mousePitch){const{pitchDelta:h}=this.mousePitch.dragMove(t,s)||{};h&&a.setPitch(a.getPitch()+h)}}moveTouch(t,s){const a=this.map,{bearingDelta:o}=this.touchRotate.dragMove(t,s)||{};if(o&&a.setBearing(a.getBearing()+o),this.touchPitch){const{pitchDelta:h}=this.touchPitch.dragMove(t,s)||{};h&&a.setPitch(a.getPitch()+h)}}off(){const t=this.element;re.removeEventListener(t,"mousedown",this.mousedown),re.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),re.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.removeEventListener(window,"touchend",this.touchend),re.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){re.enableDrag(),re.removeEventListener(window,"mousemove",this.mousemove),re.removeEventListener(window,"mouseup",this.mouseup),re.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),re.removeEventListener(window,"touchend",this.touchend)}}let fr;function qn(c,t,s){const a=new p.M(c.lng,c.lat);if(c=new p.M(c.lng,c.lat),t){const o=new p.M(c.lng-360,c.lat),h=new p.M(c.lng+360,c.lat),m=s.locationPoint(c).distSqr(t);s.locationPoint(o).distSqr(t)180;){const o=s.locationPoint(c);if(o.x>=0&&o.y>=0&&o.x<=s.width&&o.y<=s.height)break;c.lng>s.center.lng?c.lng-=360:c.lng+=360}return c.lng!==a.lng&&s.locationPoint(c).y>s.height/2-s.getHorizon()?c:a}const dn={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 Zn(c,t,s){const a=c.classList;for(const o in dn)a.remove(`maplibregl-${s}-anchor-${o}`);a.add(`maplibregl-${s}-anchor-${t}`)}class Rs extends p.E{constructor(t){if(super(),this._onKeyPress=s=>{const a=s.code,o=s.charCode||s.keyCode;a!=="Space"&&a!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=s=>{const a=s.originalEvent.target,o=this._element;this._popup&&(a===o||o.contains(a))&&this.togglePopup()},this._update=s=>{var a;if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();(s?.type==="terrain"||s?.type==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?qn(this._lngLat,this._flatPos,this._map.transform):(a=this._lngLat)===null||a===void 0?void 0:a.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),s&&s.type!=="moveend"||(this._pos=this._pos.round()),re.setTransform(this._element,`${dn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${h}`),xe.frameAsync(new AbortController).then(()=>{this._updateOpacity(s&&s.type==="moveend")}).catch(()=>{})},this._onMove=s=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=s.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=s.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 p.k("dragstart"))),this.fire(new p.k("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 p.k("dragend")),this._state="inactive"},this._addDragHandler=s=>{this._element.contains(s.originalEvent.target)&&(s.preventDefault(),this._positionDelta=s.point.sub(this._pos).add(this._offset),this._pointerdownPos=s.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&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t?.opacity,t?.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=p.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=re.create("div"),this._element.setAttribute("aria-label","Map marker");const s=re.createNS("http://www.w3.org/2000/svg","svg"),a=41,o=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${a}px`),s.setAttributeNS(null,"width",`${o}px`),s.setAttributeNS(null,"viewBox",`0 0 ${o} ${a}`);const h=re.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const m=re.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const g=re.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(3.0, 29.0)"),g.setAttributeNS(null,"fill","#000000");const y=[{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(const Z of y){const Q=re.createNS("http://www.w3.org/2000/svg","ellipse");Q.setAttributeNS(null,"opacity","0.04"),Q.setAttributeNS(null,"cx","10.5"),Q.setAttributeNS(null,"cy","5.80029008"),Q.setAttributeNS(null,"rx",Z.rx),Q.setAttributeNS(null,"ry",Z.ry),g.appendChild(Q)}const v=re.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"fill",this._color);const T=re.createNS("http://www.w3.org/2000/svg","path");T.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"),v.appendChild(T);const S=re.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"opacity","0.25"),S.setAttributeNS(null,"fill","#000000");const E=re.createNS("http://www.w3.org/2000/svg","path");E.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"),S.appendChild(E);const O=re.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(6.0, 7.0)"),O.setAttributeNS(null,"fill","#FFFFFF");const B=re.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(8.0, 8.0)");const U=re.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#000000"),U.setAttributeNS(null,"opacity","0.25"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962");const D=re.createNS("http://www.w3.org/2000/svg","circle");D.setAttributeNS(null,"fill","#FFFFFF"),D.setAttributeNS(null,"cx","5.5"),D.setAttributeNS(null,"cy","5.5"),D.setAttributeNS(null,"r","5.4999962"),B.appendChild(U),B.appendChild(D),m.appendChild(g),m.appendChild(v),m.appendChild(S),m.appendChild(O),m.appendChild(B),s.appendChild(m),s.setAttributeNS(null,"height",a*this._scale+"px"),s.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(s),this._offset=p.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),Zn(this._element,this._anchor,"marker"),t&&t.className)for(const s of t.className.split(" "))this._element.classList.add(s);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),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("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),re.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=p.M.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)){const o=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":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],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}getPopup(){return this._popup}togglePopup(){const 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 s,a;if(!(!((s=this._map)===null||s===void 0)&&s.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const o=this._map,h=o.terrain.depthAtPoint(this._pos),m=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,m)-h<.006)return void(this._element.style.opacity=this._opacity);const g=-this._offset.y/o.transform._pixelPerMeter,y=Math.sin(o.getPitch()*Math.PI/180)*g,v=o.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),T=o.transform.lngLatToCameraDepth(this._lngLat,m+y)-v>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&T&&this._popup.remove(),this._element.style.opacity=T?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=p.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,s){return t===void 0&&s===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),s!==void 0&&(this._opacityWhenCovered=s),this._map&&this._updateOpacity(!0),this}}const qa={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Bs=0,kr=!1;const Za={maxWidth:100,unit:"metric"};function Gn(c,t,s){const a=s&&s.maxWidth||100,o=c._container.clientHeight/2,h=c.unproject([0,o]),m=c.unproject([a,o]),g=h.distanceTo(m);if(s&&s.unit==="imperial"){const y=3.2808*g;y>5280?is(t,a,y/5280,c._getUIString("ScaleControl.Miles")):is(t,a,y,c._getUIString("ScaleControl.Feet"))}else s&&s.unit==="nautical"?is(t,a,g/1852,c._getUIString("ScaleControl.NauticalMiles")):g>=1e3?is(t,a,g/1e3,c._getUIString("ScaleControl.Kilometers")):is(t,a,g,c._getUIString("ScaleControl.Meters"))}function is(c,t,s,a){const o=function(h){const m=Math.pow(10,`${Math.floor(h)}`.length-1);let g=h/m;return g=g>=10?10:g>=5?5:g>=3?3:g>=2?2:g>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(g),m*g}(s);c.style.width=t*(o/s)+"px",c.innerHTML=`${o} ${a}`}const Ga={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Ha=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Wa(c){if(c){if(typeof c=="number"){const t=Math.round(Math.abs(c)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,c),"top-left":new p.P(t,t),"top-right":new p.P(-t,t),bottom:new p.P(0,-c),"bottom-left":new p.P(t,-t),"bottom-right":new p.P(-t,-t),left:new p.P(c,0),right:new p.P(-c,0)}}if(c instanceof p.P||Array.isArray(c)){const t=p.P.convert(c);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:p.P.convert(c.center||[0,0]),top:p.P.convert(c.top||[0,0]),"top-left":p.P.convert(c["top-left"]||[0,0]),"top-right":p.P.convert(c["top-right"]||[0,0]),bottom:p.P.convert(c.bottom||[0,0]),"bottom-left":p.P.convert(c["bottom-left"]||[0,0]),"bottom-right":p.P.convert(c["bottom-right"]||[0,0]),left:p.P.convert(c.left||[0,0]),right:p.P.convert(c.right||[0,0])}}return Wa(new p.P(0,0))}const Qo=Ei;k.AJAXError=p.be,k.Evented=p.E,k.LngLat=p.M,k.MercatorCoordinate=p.Y,k.Point=p.P,k.addProtocol=p.bf,k.config=p.a,k.removeProtocol=p.bg,k.AttributionControl=Yo,k.BoxZoomHandler=ks,k.CanvasSource=ms,k.CooperativeGesturesHandler=ke,k.DoubleClickZoomHandler=Fa,k.DragPanHandler=Ni,k.DragRotateHandler=ln,k.EdgeInsets=sn,k.FullscreenControl=class extends p.E{constructor(c={}){super(),this._onFullscreenChange=()=>{var t;let s=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=s?.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)s=s.shadowRoot.fullscreenElement;s===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,c&&c.container&&(c.container instanceof HTMLElement?this._container=c.container:p.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(c){return this._map=c,this._container||(this._container=this._map.getContainer()),this._controlContainer=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){re.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const c=this._fullscreenButton=re.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);re.create("span","maplibregl-ctrl-icon",c).setAttribute("aria-hidden","true"),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const c=this._getTitle();this._fullscreenButton.setAttribute("aria-label",c),this._fullscreenButton.title=c}_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 p.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},k.GeoJSONSource=Ke,k.GeolocateControl=class extends p.E{constructor(c){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new p.k("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 p.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const s=new p.M(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,o=this._map.getBearing(),h=p.e({bearing:o},this.options.fitBoundsOptions),m=Mt.fromLngLat(s,a);this._map.fitBounds(m,h,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const s=new p.M(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)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;const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&kr)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=re.create("button","maplibregl-ctrl-geolocate",this._container),re.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){p.w("Geolocation support is not available so the GeolocateControl will be disabled.");const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}else{const s=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=re.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Rs({element:this._dotElement}),this._circleElement=re.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Rs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",s=>{s.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s.originalEvent&&s.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new p.k("trackuserlocationend")))})}},this.options=p.e({},qa,c)}onAdd(c){return this._map=c,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return p._(this,arguments,void 0,function*(t=!1){if(fr!==void 0&&!t)return fr;if(window.navigator.permissions===void 0)return fr=!!window.navigator.geolocation,fr;try{fr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{fr=!!window.navigator.geolocation}return fr})}().then(t=>this._setupUI(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(),re.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Bs=0,kr=!1}_isOutOfMapMaxBounds(c){const t=this._map.getMaxBounds(),s=c.coords;return t&&(s.longitudet.getEast()||s.latitudet.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":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const c=this._map.getBounds(),t=c.getSouthEast(),s=c.getNorthEast(),a=t.distanceTo(s),o=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return p.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 p.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Bs--,kr=!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 p.k("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 p.k("trackuserlocationstart"));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 c;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Bs++,Bs>1?(c={maximumAge:6e5,timeout:0},kr=!0):(c=this.options.positionOptions,kr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,c)}}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)}},k.Hash=Pa,k.ImageSource=er,k.KeyboardHandler=ht,k.LngLatBounds=Mt,k.LogoControl=Ls,k.Map=class extends Ko{constructor(c){if(p.bc.mark(p.bd.create),(c=p.e({},Na,c)).minZoom!=null&&c.maxZoom!=null&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(c.minPitch!=null&&c.maxPitch!=null&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(c.minPitch!=null&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(c.maxPitch!=null&&c.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Fn(c.minZoom,c.maxZoom,c.minPitch,c.maxPitch,c.renderWorldCopies),{bearingSnap:c.bearingSnap}),this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new p.k("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new p.k("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=c.interactive,this._maxTileCacheSize=c.maxTileCacheSize,this._maxTileCacheZoomLevels=c.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=c.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=c.preserveDrawingBuffer,this._antialias=c.antialias,this._trackResize=c.trackResize,this._bearingSnap=c.bearingSnap,this._refreshExpiredTiles=c.refreshExpiredTiles,this._fadeDuration=c.fadeDuration,this._crossSourceCollisions=c.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=c.collectResourceTiming,this._renderTaskQueue=new _t,this._controls=[],this._mapId=p.a3(),this._locale=p.e({},Ua,c.locale),this._clickTolerance=c.clickTolerance,this._overridePixelRatio=c.pixelRatio,this._maxCanvasSize=c.maxCanvasSize,this.transformCameraUpdate=c.transformCameraUpdate,this._imageQueueHandle=_i.addThrottleControl(()=>this.isMoving()),this._requestManager=new Yi(c.transformRequest),typeof c.container=="string"){if(this._container=document.getElementById(c.container),!this._container)throw new Error(`Container '${c.container}' not found.`)}else{if(!(c.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=c.container}if(c.maxBounds&&this.setMaxBounds(c.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.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let t=!1;const s=Ca(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{t?s(a):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new hi(this,c),this._hash=c.hash&&new Pa(typeof c.hash=="string"&&c.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch}),c.bounds&&(this.resize(),this.fitBounds(c.bounds,p.e({},c.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=c.localIdeographFontFamily,this._validateStyle=c.validateStyle,c.style&&this.setStyle(c.style,{localIdeographFontFamily:c.localIdeographFontFamily}),c.attributionControl&&this.addControl(new Yo(typeof c.attributionControl=="boolean"?void 0:c.attributionControl)),c.maplibreLogo&&this.addControl(new Ls,c.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new p.k(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new p.k(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new p.k("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(c,t){if(t===void 0&&(t=c.getDefaultPosition?c.getDefaultPosition():"top-right"),!c||!c.onAdd)return this.fire(new p.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const s=c.onAdd(this);this._controls.push(c);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(s,a.firstChild):a.appendChild(s),this}removeControl(c){if(!c||!c.onRemove)return this.fire(new p.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(c);return t>-1&&this._controls.splice(t,1),c.onRemove(this),this}hasControl(c){return this._controls.indexOf(c)>-1}calculateCameraOptionsFromTo(c,t,s,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(c,t,s,a)}resize(c){var t;const s=this._containerDimensions(),a=s[0],o=s[1],h=this._getClampedPixelRatio(a,o);if(this._resizeCanvas(a,o,h),this.painter.resize(a,o,h),this.painter.overLimit()){const g=this.painter.context.gl;this._maxCanvasSize=[g.drawingBufferWidth,g.drawingBufferHeight];const y=this._getClampedPixelRatio(a,o);this._resizeCanvas(a,o,y),this.painter.resize(a,o,y)}this.transform.resize(a,o),(t=this._requestedCameraState)===null||t===void 0||t.resize(a,o);const m=!this._moving;return m&&(this.stop(),this.fire(new p.k("movestart",c)).fire(new p.k("move",c))),this.fire(new p.k("resize",c)),m&&this.fire(new p.k("moveend",c)),this}_getClampedPixelRatio(c,t){const{0:s,1:a}=this._maxCanvasSize,o=this.getPixelRatio(),h=c*o,m=t*o;return Math.min(h>s?s/h:1,m>a?a/m:1)*o}getPixelRatio(){var c;return(c=this._overridePixelRatio)!==null&&c!==void 0?c:devicePixelRatio}setPixelRatio(c){this._overridePixelRatio=c,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(c){return this.transform.setMaxBounds(Mt.convert(c)),this._update()}setMinZoom(c){if((c=c??-2)>=-2&&c<=this.transform.maxZoom)return this.transform.minZoom=c,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=c,this._update(),this.getZoom()>c&&this.setZoom(c),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(c){if((c=c??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(c>=0&&c<=this.transform.maxPitch)return this.transform.minPitch=c,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(c>=this.transform.minPitch)return this.transform.maxPitch=c,this._update(),this.getPitch()>c&&this.setPitch(c),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(c){return this.transform.renderWorldCopies=c,this._update()}project(c){return this.transform.locationPoint(p.M.convert(c),this.style&&this.terrain)}unproject(c){return this.transform.pointLocation(p.P.convert(c),this.terrain)}isMoving(){var c;return this._moving||((c=this.handlers)===null||c===void 0?void 0:c.isMoving())}isZooming(){var c;return this._zooming||((c=this.handlers)===null||c===void 0?void 0:c.isZooming())}isRotating(){var c;return this._rotating||((c=this.handlers)===null||c===void 0?void 0:c.isRotating())}_createDelegatedListener(c,t,s){if(c==="mouseenter"||c==="mouseover"){let a=!1;return{layer:t,listener:s,delegates:{mousemove:h=>{const m=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];m.length?a||(a=!0,s.call(this,new Ot(c,this,h.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(c==="mouseleave"||c==="mouseout"){let a=!1;return{layer:t,listener:s,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,s.call(this,new Ot(c,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,s.call(this,new Ot(c,this,m.originalEvent)))}}}}{const a=o=>{const h=this.getLayer(t)?this.queryRenderedFeatures(o.point,{layers:[t]}):[];h.length&&(o.features=h,s.call(this,o),delete o.features)};return{layer:t,listener:s,delegates:{[c]:a}}}}on(c,t,s){if(s===void 0)return super.on(c,t);const a=this._createDelegatedListener(c,t,s);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[c]=this._delegatedListeners[c]||[],this._delegatedListeners[c].push(a);for(const o in a.delegates)this.on(o,a.delegates[o]);return this}once(c,t,s){if(s===void 0)return super.once(c,t);const a=this._createDelegatedListener(c,t,s);for(const o in a.delegates)this.once(o,a.delegates[o]);return this}off(c,t,s){return s===void 0?super.off(c,t):(this._delegatedListeners&&this._delegatedListeners[c]&&(a=>{const o=this._delegatedListeners[c];for(let h=0;hthis._updateStyle(c,t));const s=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!c)),c?(this.style=new vn(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof c=="string"?this.style.loadURL(c,t,s):this.style.loadJSON(c,t,s),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new vn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(c,t){if(typeof c=="string"){const s=this._requestManager.transformRequest(c,Ut.Style);p.h(s,new AbortController).then(a=>{this._updateDiff(a.data,t)}).catch(a=>{a&&this.fire(new p.j(a))})}else typeof c=="object"&&this._updateDiff(c,t)}_updateDiff(c,t){try{this.style.setState(c,t)&&this._update(!0)}catch(s){p.w(`Unable to perform style diff: ${s.message||s.error||s}. Rebuilding the style from scratch.`),this._updateStyle(c,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():p.w("There is no style added to the map.")}addSource(c,t){return this._lazyInitEmptyStyle(),this.style.addSource(c,t),this._update(!0)}isSourceLoaded(c){const t=this.style&&this.style.sourceCaches[c];if(t!==void 0)return t.loaded();this.fire(new p.j(new Error(`There is no source with ID '${c}'`)))}setTerrain(c){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),c){const t=this.style.sourceCaches[c.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${c.source}`);this.terrain===null&&t.reload();for(const s in this.style._layers){const a=this.style._layers[s];a.type==="hillshade"&&a.source===c.source&&p.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.")}this.terrain=new hn(this.painter,t,c),this.painter.renderToTexture=new Va(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=s=>{s.dataType==="style"?this.terrain.sourceCache.freeRtt():s.dataType==="source"&&s.tile&&(s.sourceId!==c.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(s.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new p.k("terrain",{terrain:c})),this}getTerrain(){var c,t;return(t=(c=this.terrain)===null||c===void 0?void 0:c.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const c=this.style&&this.style.sourceCaches;for(const t in c){const s=c[t]._tiles;for(const a in s){const o=s[a];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(c){return this.style.removeSource(c),this._update(!0)}getSource(c){return this.style.getSource(c)}addImage(c,t,s={}){const{pixelRatio:a=1,sdf:o=!1,stretchX:h,stretchY:m,content:g}=s;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||p.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new p.j(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`")));{const{width:y,height:v,data:T}=t,S=t;return this.style.addImage(c,{data:new p.R({width:y,height:v},new Uint8Array(T)),pixelRatio:a,stretchX:h,stretchY:m,content:g,sdf:o,version:0,userImage:S}),S.onAdd&&S.onAdd(this,c),this}}{const{width:y,height:v,data:T}=xe.getImageData(t);this.style.addImage(c,{data:new p.R({width:y,height:v},T),pixelRatio:a,stretchX:h,stretchY:m,content:g,sdf:o,version:0})}}updateImage(c,t){const s=this.style.getImage(c);if(!s)return this.fire(new p.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||p.b(t)?xe.getImageData(t):t,{width:o,height:h,data:m}=a;if(o===void 0||h===void 0)return this.fire(new p.j(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(o!==s.data.width||h!==s.data.height)return this.fire(new p.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const g=!(t instanceof HTMLImageElement||p.b(t));return s.data.replace(m,g),this.style.updateImage(c,s),this}getImage(c){return this.style.getImage(c)}hasImage(c){return c?!!this.style.getImage(c):(this.fire(new p.j(new Error("Missing required image id"))),!1)}removeImage(c){this.style.removeImage(c)}loadImage(c){return _i.getImage(this._requestManager.transformRequest(c,Ut.Image),new AbortController)}listImages(){return this.style.listImages()}addLayer(c,t){return this._lazyInitEmptyStyle(),this.style.addLayer(c,t),this._update(!0)}moveLayer(c,t){return this.style.moveLayer(c,t),this._update(!0)}removeLayer(c){return this.style.removeLayer(c),this._update(!0)}getLayer(c){return this.style.getLayer(c)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(c,t,s){return this.style.setLayerZoomRange(c,t,s),this._update(!0)}setFilter(c,t,s={}){return this.style.setFilter(c,t,s),this._update(!0)}getFilter(c){return this.style.getFilter(c)}setPaintProperty(c,t,s,a={}){return this.style.setPaintProperty(c,t,s,a),this._update(!0)}getPaintProperty(c,t){return this.style.getPaintProperty(c,t)}setLayoutProperty(c,t,s,a={}){return this.style.setLayoutProperty(c,t,s,a),this._update(!0)}getLayoutProperty(c,t){return this.style.getLayoutProperty(c,t)}setGlyphs(c,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(c,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(c,t,s={}){return this._lazyInitEmptyStyle(),this.style.addSprite(c,t,s,a=>{a||this._update(!0)}),this}removeSprite(c){return this._lazyInitEmptyStyle(),this.style.removeSprite(c),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(c,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(c,t,s=>{s||this._update(!0)}),this}setLight(c,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(c,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(c,t){return this.style.setFeatureState(c,t),this._update()}removeFeatureState(c,t){return this.style.removeFeatureState(c,t),this._update()}getFeatureState(c){return this.style.getFeatureState(c)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let c=0,t=0;return this._container&&(c=this._container.clientWidth||400,t=this._container.clientHeight||300),[c,t]}_setupContainer(){const c=this._container;c.classList.add("maplibregl-map");const t=this._canvasContainer=re.create("div","maplibregl-canvas-container",c);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=re.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const s=this._containerDimensions(),a=this._getClampedPixelRatio(s[0],s[1]);this._resizeCanvas(s[0],s[1],a);const o=this._controlContainer=re.create("div","maplibregl-control-container",c),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{h[m]=re.create("div",`maplibregl-ctrl-${m} `,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(c,t,s){this._canvas.width=Math.floor(s*c),this._canvas.height=Math.floor(s*t),this._canvas.style.width=`${c}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const c={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:c},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const s=this._canvas.getContext("webgl2",c)||this._canvas.getContext("webgl",c);if(!s){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Es(s,this.transform),Fr.testSupport(s)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(c){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||c,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(c){return this._update(),this._renderTaskQueue.add(c)}_cancelRenderFrame(c){this._renderTaskQueue.remove(c)}_render(c){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(c),this._removed)return;let s=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const o=this.transform.zoom,h=xe.now();this.style.zoomHistory.update(o,h);const m=new p.a8(o,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),g=m.crossFadingFactor();g===1&&g===this._crossFadingFactor||(s=!0,this._crossFadingFactor=g),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new p.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.bc.mark(p.bd.load),this.fire(new p.k("load"))),this.style&&(this.style.hasTransitions()||s)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.k("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,p.bc.mark(p.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var c;this._hash&&this._hash.remove();for(const s of this._controls)s.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),_i.removeThrottleControl(this._imageQueueHandle),(c=this._resizeObserver)===null||c===void 0||c.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),re.remove(this._canvasContainer),re.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),p.bc.clearMetrics(),this._removed=!0,this.fire(new p.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,xe.frameAsync(this._frameRequest).then(c=>{p.bc.frame(c),this._frameRequest=null,this._render(c)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(c){this._showTileBoundaries!==c&&(this._showTileBoundaries=c,this._update())}get showPadding(){return!!this._showPadding}set showPadding(c){this._showPadding!==c&&(this._showPadding=c,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(c){this._showCollisionBoxes!==c&&(this._showCollisionBoxes=c,c?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(c){this._showOverdrawInspector!==c&&(this._showOverdrawInspector=c,this._update())}get repaint(){return!!this._repaint}set repaint(c){this._repaint!==c&&(this._repaint=c,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(c){this._vertices=c,this._update()}get version(){return un}getCameraTargetElevation(){return this.transform.elevation}},k.MapMouseEvent=Ot,k.MapTouchEvent=zs,k.MapWheelEvent=Li,k.Marker=Rs,k.NavigationControl=class{constructor(c){this._updateZoomButtons=()=>{const t=this._map.getZoom(),s=t===this._map.getMaxZoom(),a=t===this._map.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",s.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,s)=>{const a=this._map._getUIString(`NavigationControl.${s}`);t.title=a,t.setAttribute("aria-label",a)},this.options=p.e({},$a,c),this._container=re.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})),re.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})),re.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=re.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(c){return this._map=c,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ja(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){re.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(c,t){const s=re.create("button",c,this._container);return s.type="button",s.addEventListener("click",t),s}},k.Popup=class extends p.E{constructor(c){super(),this.remove=()=>(this._content&&re.remove(this._content),this._container&&(re.remove(this._container),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("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new p.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var s;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=re.create("div","maplibregl-popup",this._map.getContainer()),this._tip=re.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const g of this.options.className.split(" "))this._container.classList.add(g);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?qn(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),this._trackPointer&&!t)return;const a=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor;const h=Wa(this.options.offset);if(!o){const g=this._container.offsetWidth,y=this._container.offsetHeight;let v;v=a.y+h.bottom.ythis._map.transform.height-y?["bottom"]:[],a.xthis._map.transform.width-g/2&&v.push("right"),o=v.length===0?"bottom":v.join("-")}let m=a.add(h[o]);this.options.subpixelPositioning||(m=m.round()),re.setTransform(this._container,`${dn[o]} translate(${m.x}px,${m.y}px)`),Zn(this._container,o,"popup")},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(Ga),c)}addTo(c){return this._map&&this.remove(),this._map=c,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._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),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 p.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(c){return this._lngLat=p.M.convert(c),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),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._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(c){return this.setDOMContent(document.createTextNode(c))}setHTML(c){const t=document.createDocumentFragment(),s=document.createElement("body");let a;for(s.innerHTML=c;a=s.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){var c;return(c=this._container)===null||c===void 0?void 0:c.style.maxWidth}setMaxWidth(c){return this.options.maxWidth=c,this._update(),this}setDOMContent(c){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=re.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(c),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(c){this._container&&this._container.classList.add(c)}removeClassName(c){this._container&&this._container.classList.remove(c)}setOffset(c){return this.options.offset=c,this._update(),this}toggleClassName(c){if(this._container)return this._container.classList.toggle(c)}setSubpixelPositioning(c){this.options.subpixelPositioning=c}_createCloseButton(){this.options.closeButton&&(this._closeButton=re.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const c=this._container.querySelector(Ha);c&&c.focus()}},k.RasterDEMTileSource=Gs,k.RasterTileSource=qr,k.ScaleControl=class{constructor(c){this._onMove=()=>{Gn(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Gn(this._map,this._container,this.options)},this.options=p.e({},Za,c)}getDefaultPosition(){return"bottom-left"}onAdd(c){return this._map=c,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-scale",c.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){re.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},k.ScrollZoomHandler=Ba,k.Style=vn,k.TerrainControl=class{constructor(c){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=c}onAdd(c){return this._map=c,this._container=re.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=re.create("button","maplibregl-ctrl-terrain",this._container),re.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(){re.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},k.TwoFingersTouchPitchHandler=Wo,k.TwoFingersTouchRotateHandler=La,k.TwoFingersTouchZoomHandler=Vn,k.TwoFingersTouchZoomRotateHandler=Me,k.VectorTileSource=se,k.VideoSource=fs,k.addSourceType=(c,t)=>p._(void 0,void 0,void 0,function*(){if(Zr(c))throw new Error(`A source type called "${c}" already exists.`);((s,a)=>{gs[s]=a})(c,t)}),k.clearPrewarmedResources=function(){const c=ur;c&&(c.isPreloaded()&&c.numActive()===1?(c.release(Nr),ur=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()"))},k.getMaxParallelImageRequests=function(){return p.a.MAX_PARALLEL_IMAGE_REQUESTS},k.getRTLTextPluginStatus=function(){return yi().getRTLTextPluginStatus()},k.getVersion=function(){return Qo},k.getWorkerCount=function(){return Qi.workerCount},k.getWorkerUrl=function(){return p.a.WORKER_URL},k.importScriptInWorkers=function(c){return Tr().broadcast("importScript",c)},k.prewarm=function(){Vi().acquire(Nr)},k.setMaxParallelImageRequests=function(c){p.a.MAX_PARALLEL_IMAGE_REQUESTS=c},k.setRTLTextPlugin=function(c,t){return yi().setRTLTextPlugin(c,t)},k.setWorkerCount=function(c){Qi.workerCount=c},k.setWorkerUrl=function(c){p.a.WORKER_URL=c}});var na=Rr;return na})})(ru);var nu=ru.exports;const Qd=Kd(nu),tp=Jd({__proto__:null,default:Qd},[nu]);export{tp as m}; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/robots.txt b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/robots.txt deleted file mode 100644 index 14267e9..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Allow: / \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/site.webmanifest b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/site.webmanifest deleted file mode 100644 index 6135ea5..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/share/doc/meshtasticd/web/site.webmanifest +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "Meshtastic", - "short_name": "Meshtastic", - "start_url": ".", - "description": "Meshtastic web app", - "icons": [ - { - "src": "/icon.svg", - "sizes": "any", - "type": "image/svg+xml" - } - ], - "theme_color": "#67ea94", - "background_color": "#67ea94", - "display": "standalone" -}