team-10/venv/share/jupyter/nbextensions/pydeck/index.js
2025-08-02 02:00:33 +02:00

3702 lines
2.5 MiB

(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if (typeof define === 'function' && define.amd) define([], factory);
else {
var a = factory();
for (var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}})(globalThis, function () {
"use strict";var __exports__=(()=>{var sre=Object.create;var Nv=Object.defineProperty;var are=Object.getOwnPropertyDescriptor;var lre=Object.getOwnPropertyNames;var cre=Object.getPrototypeOf,ure=Object.prototype.hasOwnProperty;var fre=(t,e,r)=>e in t?Nv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var P6=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var It=(t,e)=>()=>(t&&(e=t(t=0)),e);var Qt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),As=(t,e)=>{for(var r in e)Nv(t,r,{get:e[r],enumerable:!0})},R6=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of lre(e))!ure.call(t,n)&&n!==r&&Nv(t,n,{get:()=>e[n],enumerable:!(i=are(e,n))||i.enumerable});return t};var ga=(t,e,r)=>(r=t!=null?sre(cre(t)):{},R6(e||!t||!t.__esModule?Nv(r,"default",{value:t,enumerable:!0}):r,t)),B6=t=>R6(Nv({},"__esModule",{value:!0}),t);var Yr=(t,e,r)=>(fre(t,typeof e!="symbol"?e+"":e,r),r);var c5=Qt((Y3,K3)=>{(function(t,e){typeof Y3=="object"&&typeof K3<"u"?K3.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self,t.mapboxgl=e())})(Y3,function(){"use strict";var t,e,r;function i(n,o){if(!t)t=o;else if(!e)e=o;else{var s="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",l={};t(l),r=o(l),typeof window<"u"&&(r.workerUrl=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"})))}}return i(["exports"],function(n){"use strict";function o(a,c){return a(c={exports:{}},c.exports),c.exports}var s=l;function l(a,c,f,x){this.cx=3*a,this.bx=3*(f-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*c,this.by=3*(x-c)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=x,this.p2x=f,this.p2y=x}l.prototype.sampleCurveX=function(a){return((this.ax*a+this.bx)*a+this.cx)*a},l.prototype.sampleCurveY=function(a){return((this.ay*a+this.by)*a+this.cy)*a},l.prototype.sampleCurveDerivativeX=function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},l.prototype.solveCurveX=function(a,c){var f,x,S,I,D;for(c===void 0&&(c=1e-6),S=a,D=0;D<8;D++){if(I=this.sampleCurveX(S)-a,Math.abs(I)<c)return S;var H=this.sampleCurveDerivativeX(S);if(Math.abs(H)<1e-6)break;S-=I/H}if((S=a)<(f=0))return f;if(S>(x=1))return x;for(;f<x;){if(I=this.sampleCurveX(S),Math.abs(I-a)<c)return S;a>I?f=S:x=S,S=.5*(x-f)+f}return S},l.prototype.solve=function(a,c){return this.sampleCurveY(this.solveCurveX(a,c))};var u=h;function h(a,c){this.x=a,this.y=c}h.prototype={clone:function(){return new h(this.x,this.y)},add:function(a){return this.clone()._add(a)},sub:function(a){return this.clone()._sub(a)},multByPoint:function(a){return this.clone()._multByPoint(a)},divByPoint:function(a){return this.clone()._divByPoint(a)},mult:function(a){return this.clone()._mult(a)},div:function(a){return this.clone()._div(a)},rotate:function(a){return this.clone()._rotate(a)},rotateAround:function(a,c){return this.clone()._rotateAround(a,c)},matMult:function(a){return this.clone()._matMult(a)},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(a){return this.x===a.x&&this.y===a.y},dist:function(a){return Math.sqrt(this.distSqr(a))},distSqr:function(a){var c=a.x-this.x,f=a.y-this.y;return c*c+f*f},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith:function(a){return this.angleWithSep(a.x,a.y)},angleWithSep:function(a,c){return Math.atan2(this.x*c-this.y*a,this.x*a+this.y*c)},_matMult:function(a){var c=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=c,this},_add:function(a){return this.x+=a.x,this.y+=a.y,this},_sub:function(a){return this.x-=a.x,this.y-=a.y,this},_mult:function(a){return this.x*=a,this.y*=a,this},_div:function(a){return this.x/=a,this.y/=a,this},_multByPoint:function(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint:function(a){return this.x/=a.x,this.y/=a.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var a=this.y;return this.y=this.x,this.x=-a,this},_rotate:function(a){var c=Math.cos(a),f=Math.sin(a),x=f*this.x+c*this.y;return this.x=c*this.x-f*this.y,this.y=x,this},_rotateAround:function(a,c){var f=Math.cos(a),x=Math.sin(a),S=c.y+x*(this.x-c.x)+f*(this.y-c.y);return this.x=c.x+f*(this.x-c.x)-x*(this.y-c.y),this.y=S,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},h.convert=function(a){return a instanceof h?a:Array.isArray(a)?new h(a[0],a[1]):a};var v=typeof self<"u"?self:{},T=Math.pow(2,53)-1;function E(a,c,f,x){var S=new s(a,c,f,x);return function(I){return S.solve(I)}}var M=E(.25,.1,.25,1);function O(a,c,f){return Math.min(f,Math.max(c,a))}function F(a,c,f){var x=f-c,S=((a-c)%x+x)%x+c;return S===c?f:S}function z(a){for(var c=[],f=arguments.length-1;f-- >0;)c[f]=arguments[f+1];for(var x=0,S=c;x<S.length;x+=1){var I=S[x];for(var D in I)a[D]=I[D]}return a}var W=1;function J(){return W++}function K(){return function a(c){return c?(c^16*Math.random()>>c/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,a)}()}function ne(a){return!!a&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(a)}function ge(a,c){a.forEach(function(f){c[f]&&(c[f]=c[f].bind(c))})}function j(a,c){return a.indexOf(c,a.length-c.length)!==-1}function me(a,c,f){var x={};for(var S in a)x[S]=c.call(f||this,a[S],S,a);return x}function fe(a,c,f){var x={};for(var S in a)c.call(f||this,a[S],S,a)&&(x[S]=a[S]);return x}function $(a){return Array.isArray(a)?a.map($):typeof a=="object"&&a?me(a,$):a}var Z={};function we(a){Z[a]||(typeof console<"u"&&console.warn(a),Z[a]=!0)}function Oe(a,c,f){return(f.y-a.y)*(c.x-a.x)>(c.y-a.y)*(f.x-a.x)}function he(a){for(var c=0,f=0,x=a.length,S=x-1,I=void 0,D=void 0;f<x;S=f++)c+=((D=a[S]).x-(I=a[f]).x)*(I.y+D.y);return c}function Le(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function ft(a){var c={};if(a.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(x,S,I,D){var H=I||D;return c[S]=!H||H.toLowerCase(),""}),c["max-age"]){var f=parseInt(c["max-age"],10);isNaN(f)?delete c["max-age"]:c["max-age"]=f}return c}var Vt=null;function Yt(a){if(Vt==null){var c=a.navigator?a.navigator.userAgent:null;Vt=!!a.safari||!(!c||!(/\b(iPad|iPhone|iPod)\b/.test(c)||c.match("Safari")&&!c.match("Chrome")))}return Vt}function mr(a){try{var c=v[a];return c.setItem("_mapbox_test_",1),c.removeItem("_mapbox_test_"),!0}catch{return!1}}var Er,Jr,or,ai,Jt=v.performance&&v.performance.now?v.performance.now.bind(v.performance):Date.now.bind(Date),qt=v.requestAnimationFrame||v.mozRequestAnimationFrame||v.webkitRequestAnimationFrame||v.msRequestAnimationFrame,wi=v.cancelAnimationFrame||v.mozCancelAnimationFrame||v.webkitCancelAnimationFrame||v.msCancelAnimationFrame,ae={now:Jt,frame:function(a){var c=qt(a);return{cancel:function(){return wi(c)}}},getImageData:function(a,c){c===void 0&&(c=0);var f=v.document.createElement("canvas"),x=f.getContext("2d");if(!x)throw new Error("failed to create canvas 2d context");return f.width=a.width,f.height=a.height,x.drawImage(a,0,0,a.width,a.height),x.getImageData(-c,-c,a.width+2*c,a.height+2*c)},resolveURL:function(a){return Er||(Er=v.document.createElement("a")),Er.href=a,Er.href},hardwareConcurrency:v.navigator&&v.navigator.hardwareConcurrency||4,get devicePixelRatio(){return v.devicePixelRatio},get prefersReducedMotion(){return!!v.matchMedia&&(Jr==null&&(Jr=v.matchMedia("(prefers-reduced-motion: reduce)")),Jr.matches)}},be={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?this.API_URL.indexOf("https://api.mapbox.cn")===0?"https://events.mapbox.cn/events/v2":this.API_URL.indexOf("https://api.mapbox.com")===0?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},je={supported:!1,testSupport:function(a){!lt&&ai&&(Ft?wt(a):or=a)}},lt=!1,Ft=!1;function wt(a){var c=a.createTexture();a.bindTexture(a.TEXTURE_2D,c);try{if(a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,ai),a.isContextLost())return;je.supported=!0}catch{}a.deleteTexture(c),lt=!0}v.document&&((ai=v.document.createElement("img")).onload=function(){or&&wt(or),or=null,Ft=!0},ai.onerror=function(){lt=!0,or=null},ai.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var $r="01",xi=function(a,c){this._transformRequestFn=a,this._customAccessToken=c,this._createSkuToken()};function Ki(a){return a.indexOf("mapbox:")===0}xi.prototype._createSkuToken=function(){var a=function(){for(var c="",f=0;f<10;f++)c+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",$r,c].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=a.token,this._skuTokenExpiresAt=a.tokenExpiresAt},xi.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},xi.prototype.transformRequest=function(a,c){return this._transformRequestFn&&this._transformRequestFn(a,c)||{url:a}},xi.prototype.normalizeStyleURL=function(a,c){if(!Ki(a))return a;var f=Un(a);return f.path="/styles/v1"+f.path,this._makeAPIURL(f,this._customAccessToken||c)},xi.prototype.normalizeGlyphsURL=function(a,c){if(!Ki(a))return a;var f=Un(a);return f.path="/fonts/v1"+f.path,this._makeAPIURL(f,this._customAccessToken||c)},xi.prototype.normalizeSourceURL=function(a,c){if(!Ki(a))return a;var f=Un(a);return f.path="/v4/"+f.authority+".json",f.params.push("secure"),this._makeAPIURL(f,this._customAccessToken||c)},xi.prototype.normalizeSpriteURL=function(a,c,f,x){var S=Un(a);return Ki(a)?(S.path="/styles/v1"+S.path+"/sprite"+c+f,this._makeAPIURL(S,this._customAccessToken||x)):(S.path+=""+c+f,No(S))},xi.prototype.normalizeTileURL=function(a,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),a&&!Ki(a))return a;var f=Un(a);f.path=f.path.replace(/(\.(png|jpg)\d*)(?=$)/,(ae.devicePixelRatio>=2||c===512?"@2x":"")+(je.supported?".webp":"$1")),f.path=f.path.replace(/^.+\/v4\//,"/"),f.path="/v4"+f.path;var x=this._customAccessToken||function(S){for(var I=0,D=S;I<D.length;I+=1){var H=D[I].match(/^access_token=(.*)$/);if(H)return H[1]}return null}(f.params)||be.ACCESS_TOKEN;return be.REQUIRE_ACCESS_TOKEN&&x&&this._skuToken&&f.params.push("sku="+this._skuToken),this._makeAPIURL(f,x)},xi.prototype.canonicalizeTileURL=function(a,c){var f=Un(a);if(!f.path.match(/(^\/v4\/)/)||!f.path.match(/\.[\w]+$/))return a;var x="mapbox://tiles/";x+=f.path.replace("/v4/","");var S=f.params;return c&&(S=S.filter(function(I){return!I.match(/^access_token=/)})),S.length&&(x+="?"+S.join("&")),x},xi.prototype.canonicalizeTileset=function(a,c){for(var f=!!c&&Ki(c),x=[],S=0,I=a.tiles||[];S<I.length;S+=1){var D=I[S];Zi(D)?x.push(this.canonicalizeTileURL(D,f)):x.push(D)}return x},xi.prototype._makeAPIURL=function(a,c){var f="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",x=Un(be.API_URL);if(a.protocol=x.protocol,a.authority=x.authority,a.protocol==="http"){var S=a.params.indexOf("secure");S>=0&&a.params.splice(S,1)}if(x.path!=="/"&&(a.path=""+x.path+a.path),!be.REQUIRE_ACCESS_TOKEN)return No(a);if(!(c=c||be.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+f);if(c[0]==="s")throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+f);return a.params=a.params.filter(function(I){return I.indexOf("access_token")===-1}),a.params.push("access_token="+c),No(a)};var kn=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function Zi(a){return kn.test(a)}var Hi=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Un(a){var c=a.match(Hi);if(!c)throw new Error("Unable to parse URL object");return{protocol:c[1],authority:c[2],path:c[3]||"/",params:c[4]?c[4].split("&"):[]}}function No(a){var c=a.params.length?"?"+a.params.join("&"):"";return a.protocol+"://"+a.authority+a.path+c}function Ji(a){if(!a)return null;var c=a.split(".");if(!c||c.length!==3)return null;try{return JSON.parse(decodeURIComponent(v.atob(c[1]).split("").map(function(f){return"%"+("00"+f.charCodeAt(0).toString(16)).slice(-2)}).join("")))}catch{return null}}var Bi=function(a){this.type=a,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};Bi.prototype.getStorageKey=function(a){var c,f=Ji(be.ACCESS_TOKEN);return c=f&&f.u?v.btoa(encodeURIComponent(f.u).replace(/%([0-9A-F]{2})/g,function(x,S){return String.fromCharCode(Number("0x"+S))})):be.ACCESS_TOKEN||"",a?"mapbox.eventData."+a+":"+c:"mapbox.eventData:"+c},Bi.prototype.fetchEventData=function(){var a=mr("localStorage"),c=this.getStorageKey(),f=this.getStorageKey("uuid");if(a)try{var x=v.localStorage.getItem(c);x&&(this.eventData=JSON.parse(x));var S=v.localStorage.getItem(f);S&&(this.anonId=S)}catch{we("Unable to read from LocalStorage")}},Bi.prototype.saveEventData=function(){var a=mr("localStorage"),c=this.getStorageKey(),f=this.getStorageKey("uuid");if(a)try{v.localStorage.setItem(f,this.anonId),Object.keys(this.eventData).length>=1&&v.localStorage.setItem(c,JSON.stringify(this.eventData))}catch{we("Unable to write to LocalStorage")}},Bi.prototype.processRequests=function(a){},Bi.prototype.postEvent=function(a,c,f,x){var S=this;if(be.EVENTS_URL){var I=Un(be.EVENTS_URL);I.params.push("access_token="+(x||be.ACCESS_TOKEN||""));var D={event:this.type,created:new Date(a).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.13.3",skuId:$r,userId:this.anonId},H=c?z(D,c):D,Y={url:No(I),headers:{"Content-Type":"text/plain"},body:JSON.stringify([H])};this.pendingRequest=ao(Y,function(ee){S.pendingRequest=null,f(ee),S.saveEventData(),S.processRequests(x)})}},Bi.prototype.queueRequest=function(a,c){this.queue.push(a),this.processRequests(c)};var yn,po,kr=function(a){function c(){a.call(this,"map.load"),this.success={},this.skuToken=""}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.postMapLoadEvent=function(f,x,S,I){this.skuToken=S;var D=!(!I&&!be.ACCESS_TOKEN),H=Array.isArray(f)&&f.some(function(Y){return Ki(Y)||Zi(Y)});be.EVENTS_URL&&D&&H&&this.queueRequest({id:x,timestamp:Date.now()},I)},c.prototype.processRequests=function(f){var x=this;if(!this.pendingRequest&&this.queue.length!==0){var S=this.queue.shift(),I=S.id,D=S.timestamp;I&&this.success[I]||(this.anonId||this.fetchEventData(),ne(this.anonId)||(this.anonId=K()),this.postEvent(D,{skuToken:this.skuToken},function(H){H||I&&(x.success[I]=!0)},f))}},c}(Bi),dr=new(function(a){function c(f){a.call(this,"appUserTurnstile"),this._customAccessToken=f}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.postTurnstileEvent=function(f,x){be.EVENTS_URL&&be.ACCESS_TOKEN&&Array.isArray(f)&&f.some(function(S){return Ki(S)||Zi(S)})&&this.queueRequest(Date.now(),x)},c.prototype.processRequests=function(f){var x=this;if(!this.pendingRequest&&this.queue.length!==0){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var S=Ji(be.ACCESS_TOKEN),I=S?S.u:be.ACCESS_TOKEN,D=I!==this.eventData.tokenU;ne(this.anonId)||(this.anonId=K(),D=!0);var H=this.queue.shift();if(this.eventData.lastSuccess){var Y=new Date(this.eventData.lastSuccess),ee=new Date(H),ie=(H-this.eventData.lastSuccess)/864e5;D=D||ie>=1||ie<-1||Y.getDate()!==ee.getDate()}else D=!0;if(!D)return this.processRequests();this.postEvent(H,{"enabled.telemetry":!1},function(se){se||(x.eventData.lastSuccess=H,x.eventData.tokenU=I)},f)}},c}(Bi)),Ur=dr.postTurnstileEvent.bind(dr),ci=new kr,to=ci.postMapLoadEvent.bind(ci),Dn=500,To=50;function Eo(){v.caches&&!yn&&(yn=v.caches.open("mapbox-tiles"))}function Xo(a){var c=a.indexOf("?");return c<0?a:a.slice(0,c)}var So,Us=1/0;function Fc(){return So==null&&(So=v.OffscreenCanvas&&new v.OffscreenCanvas(1,1).getContext("2d")&&typeof v.createImageBitmap=="function"),So}var ql={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(ql);var sl=function(a){function c(f,x,S){x===401&&Zi(S)&&(f+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),a.call(this,f),this.status=x,this.url=S,this.name=this.constructor.name,this.message=f}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},c}(Error),Cl=Le()?function(){return self.worker&&self.worker.referrer}:function(){return(v.location.protocol==="blob:"?v.parent:v).location.href},al,Ms,ca=function(a,c){if(!(/^file:/.test(f=a.url)||/^file:/.test(Cl())&&!/^\w+:/.test(f))){if(v.fetch&&v.Request&&v.AbortController&&v.Request.prototype.hasOwnProperty("signal"))return function(x,S){var I,D=new v.AbortController,H=new v.Request(x.url,{method:x.method||"GET",body:x.body,credentials:x.credentials,headers:x.headers,referrer:Cl(),signal:D.signal}),Y=!1,ee=!1,ie=(I=H.url).indexOf("sku=")>0&&Zi(I);x.type==="json"&&H.headers.set("Accept","application/json");var se=function(Te,ke,Ve){if(!ee){if(Te&&Te.message!=="SecurityError"&&we(Te),ke&&Ve)return Ae(ke);var et=Date.now();v.fetch(H).then(function(Xe){if(Xe.ok){var at=ie?Xe.clone():null;return Ae(Xe,at,et)}return S(new sl(Xe.statusText,Xe.status,x.url))}).catch(function(Xe){Xe.code!==20&&S(new Error(Xe.message))})}},Ae=function(Te,ke,Ve){(x.type==="arrayBuffer"?Te.arrayBuffer():x.type==="json"?Te.json():Te.text()).then(function(et){ee||(ke&&Ve&&function(Xe,at,_t){if(Eo(),yn){var bt={status:at.status,statusText:at.statusText,headers:new v.Headers};at.headers.forEach(function(Ut,$t){return bt.headers.set($t,Ut)});var Mt=ft(at.headers.get("Cache-Control")||"");Mt["no-store"]||(Mt["max-age"]&&bt.headers.set("Expires",new Date(_t+1e3*Mt["max-age"]).toUTCString()),new Date(bt.headers.get("Expires")).getTime()-_t<42e4||function(Ut,$t){if(po===void 0)try{new Response(new ReadableStream),po=!0}catch{po=!1}po?$t(Ut.body):Ut.blob().then($t)}(at,function(Ut){var $t=new v.Response(Ut,bt);Eo(),yn&&yn.then(function(Ar){return Ar.put(Xo(Xe.url),$t)}).catch(function(Ar){return we(Ar.message)})}))}}(H,ke,Ve),Y=!0,S(null,et,Te.headers.get("Cache-Control"),Te.headers.get("Expires")))}).catch(function(et){ee||S(new Error(et.message))})};return ie?function(Te,ke){if(Eo(),!yn)return ke(null);var Ve=Xo(Te.url);yn.then(function(et){et.match(Ve).then(function(Xe){var at=function(_t){if(!_t)return!1;var bt=new Date(_t.headers.get("Expires")||0),Mt=ft(_t.headers.get("Cache-Control")||"");return bt>Date.now()&&!Mt["no-cache"]}(Xe);et.delete(Ve),at&&et.put(Ve,Xe.clone()),ke(null,Xe,at)}).catch(ke)}).catch(ke)}(H,se):se(null,null),{cancel:function(){ee=!0,Y||D.abort()}}}(a,c);if(Le()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",a,c,void 0,!0)}var f;return function(x,S){var I=new v.XMLHttpRequest;for(var D in I.open(x.method||"GET",x.url,!0),x.type==="arrayBuffer"&&(I.responseType="arraybuffer"),x.headers)I.setRequestHeader(D,x.headers[D]);return x.type==="json"&&(I.responseType="text",I.setRequestHeader("Accept","application/json")),I.withCredentials=x.credentials==="include",I.onerror=function(){S(new Error(I.statusText))},I.onload=function(){if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){var H=I.response;if(x.type==="json")try{H=JSON.parse(I.response)}catch(Y){return S(Y)}S(null,H,I.getResponseHeader("Cache-Control"),I.getResponseHeader("Expires"))}else S(new sl(I.statusText,I.status,x.url))},I.send(x.body),{cancel:function(){return I.abort()}}}(a,c)},Ml=function(a,c){return ca(z(a,{type:"arrayBuffer"}),c)},ao=function(a,c){return ca(z(a,{method:"POST"}),c)},oe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";al=[],Ms=0;var de=function(a,c){if(je.supported&&(a.headers||(a.headers={}),a.headers.accept="image/webp,*/*"),Ms>=be.MAX_PARALLEL_IMAGE_REQUESTS){var f={requestParameters:a,callback:c,cancelled:!1,cancel:function(){this.cancelled=!0}};return al.push(f),f}Ms++;var x=!1,S=function(){if(!x)for(x=!0,Ms--;al.length&&Ms<be.MAX_PARALLEL_IMAGE_REQUESTS;){var D=al.shift();D.cancelled||(D.cancel=de(D.requestParameters,D.callback).cancel)}},I=Ml(a,function(D,H,Y,ee){S(),D?c(D):H&&(Fc()?function(ie,se){var Ae=new v.Blob([new Uint8Array(ie)],{type:"image/png"});v.createImageBitmap(Ae).then(function(Te){se(null,Te)}).catch(function(Te){se(new Error("Could not load image because of "+Te.message+". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))})}(H,c):function(ie,se,Ae,Te){var ke=new v.Image,Ve=v.URL;ke.onload=function(){se(null,ke),Ve.revokeObjectURL(ke.src),ke.onload=null,v.requestAnimationFrame(function(){ke.src=oe})},ke.onerror=function(){return se(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."))};var et=new v.Blob([new Uint8Array(ie)],{type:"image/png"});ke.cacheControl=Ae,ke.expires=Te,ke.src=ie.byteLength?Ve.createObjectURL(et):oe}(H,c,Y,ee))});return{cancel:function(){I.cancel(),S()}}};function ve(a,c,f){f[a]&&f[a].indexOf(c)!==-1||(f[a]=f[a]||[],f[a].push(c))}function Pe(a,c,f){if(f&&f[a]){var x=f[a].indexOf(c);x!==-1&&f[a].splice(x,1)}}var ye=function(a,c){c===void 0&&(c={}),z(this,c),this.type=a},tt=function(a){function c(f,x){x===void 0&&(x={}),a.call(this,"error",z({error:f},x))}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c}(ye),rt=function(){};rt.prototype.on=function(a,c){return this._listeners=this._listeners||{},ve(a,c,this._listeners),this},rt.prototype.off=function(a,c){return Pe(a,c,this._listeners),Pe(a,c,this._oneTimeListeners),this},rt.prototype.once=function(a,c){return this._oneTimeListeners=this._oneTimeListeners||{},ve(a,c,this._oneTimeListeners),this},rt.prototype.fire=function(a,c){typeof a=="string"&&(a=new ye(a,c||{}));var f=a.type;if(this.listens(f)){a.target=this;for(var x=0,S=this._listeners&&this._listeners[f]?this._listeners[f].slice():[];x<S.length;x+=1)S[x].call(this,a);for(var I=0,D=this._oneTimeListeners&&this._oneTimeListeners[f]?this._oneTimeListeners[f].slice():[];I<D.length;I+=1){var H=D[I];Pe(f,H,this._oneTimeListeners),H.call(this,a)}var Y=this._eventedParent;Y&&(z(a,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),Y.fire(a))}else a instanceof tt&&console.error(a.error);return this},rt.prototype.listens=function(a){return this._listeners&&this._listeners[a]&&this._listeners[a].length>0||this._oneTimeListeners&&this._oneTimeListeners[a]&&this._oneTimeListeners[a].length>0||this._eventedParent&&this._eventedParent.listens(a)},rt.prototype.setEventedParent=function(a,c){return this._eventedParent=a,this._eventedParentData=c,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"},sources:{required:!0,type:"sources"},sprite:{type:"string"},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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{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"],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:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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:{},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-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"],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}},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"}}},Ge=function(a,c,f,x){this.message=(a?a+": ":"")+f,x&&(this.identifier=x),c!=null&&c.__line__&&(this.line=c.__line__)};function ht(a){var c=a.value;return c?[new Ge(a.key,c,"constants have been deprecated as of v8")]:[]}function Ht(a){for(var c=[],f=arguments.length-1;f-- >0;)c[f]=arguments[f+1];for(var x=0,S=c;x<S.length;x+=1){var I=S[x];for(var D in I)a[D]=I[D]}return a}function Zt(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function Pt(a){if(Array.isArray(a))return a.map(Pt);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){var c={};for(var f in a)c[f]=Pt(a[f]);return c}return Zt(a)}var Xt=function(a){function c(f,x){a.call(this,x),this.message=x,this.key=f}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c}(Error),Dr=function(a,c){c===void 0&&(c=[]),this.parent=a,this.bindings={};for(var f=0,x=c;f<x.length;f+=1){var S=x[f];this.bindings[S[0]]=S[1]}};Dr.prototype.concat=function(a){return new Dr(this,a)},Dr.prototype.get=function(a){if(this.bindings[a])return this.bindings[a];if(this.parent)return this.parent.get(a);throw new Error(a+" not found in scope.")},Dr.prototype.has=function(a){return!!this.bindings[a]||!!this.parent&&this.parent.has(a)};var Mr={kind:"null"},Ot={kind:"number"},br={kind:"string"},sr={kind:"boolean"},lr={kind:"color"},bi={kind:"object"},pr={kind:"value"},Ii={kind:"collator"},vn={kind:"formatted"},Di={kind:"resolvedImage"};function Qi(a,c){return{kind:"array",itemType:a,N:c}}function Li(a){if(a.kind==="array"){var c=Li(a.itemType);return typeof a.N=="number"?"array<"+c+", "+a.N+">":a.itemType.kind==="value"?"array":"array<"+c+">"}return a.kind}var Xn=[Mr,Ot,br,sr,lr,vn,bi,Qi(pr),Di];function $i(a,c){if(c.kind==="error")return null;if(a.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!$i(a.itemType,c.itemType))&&(typeof a.N!="number"||a.N===c.N))return null}else{if(a.kind===c.kind)return null;if(a.kind==="value"){for(var f=0,x=Xn;f<x.length;f+=1)if(!$i(x[f],c))return null}}return"Expected "+Li(a)+" but found "+Li(c)+" instead."}function Ln(a,c){return c.some(function(f){return f.kind===a.kind})}function en(a,c){return c.some(function(f){return f==="null"?a===null:f==="array"?Array.isArray(a):f==="object"?a&&!Array.isArray(a)&&typeof a=="object":f===typeof a})}var Si=o(function(a,c){var f={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 x(H){return(H=Math.round(H))<0?0:H>255?255:H}function S(H){return x(H[H.length-1]==="%"?parseFloat(H)/100*255:parseInt(H))}function I(H){return(Y=H[H.length-1]==="%"?parseFloat(H)/100:parseFloat(H))<0?0:Y>1?1:Y;var Y}function D(H,Y,ee){return ee<0?ee+=1:ee>1&&(ee-=1),6*ee<1?H+(Y-H)*ee*6:2*ee<1?Y:3*ee<2?H+(Y-H)*(2/3-ee)*6:H}try{c.parseCSSColor=function(H){var Y,ee=H.replace(/ /g,"").toLowerCase();if(ee in f)return f[ee].slice();if(ee[0]==="#")return ee.length===4?(Y=parseInt(ee.substr(1),16))>=0&&Y<=4095?[(3840&Y)>>4|(3840&Y)>>8,240&Y|(240&Y)>>4,15&Y|(15&Y)<<4,1]:null:ee.length===7&&(Y=parseInt(ee.substr(1),16))>=0&&Y<=16777215?[(16711680&Y)>>16,(65280&Y)>>8,255&Y,1]:null;var ie=ee.indexOf("("),se=ee.indexOf(")");if(ie!==-1&&se+1===ee.length){var Ae=ee.substr(0,ie),Te=ee.substr(ie+1,se-(ie+1)).split(","),ke=1;switch(Ae){case"rgba":if(Te.length!==4)return null;ke=I(Te.pop());case"rgb":return Te.length!==3?null:[S(Te[0]),S(Te[1]),S(Te[2]),ke];case"hsla":if(Te.length!==4)return null;ke=I(Te.pop());case"hsl":if(Te.length!==3)return null;var Ve=(parseFloat(Te[0])%360+360)%360/360,et=I(Te[1]),Xe=I(Te[2]),at=Xe<=.5?Xe*(et+1):Xe+et-Xe*et,_t=2*Xe-at;return[x(255*D(_t,at,Ve+1/3)),x(255*D(_t,at,Ve)),x(255*D(_t,at,Ve-1/3)),ke];default:return null}}return null}}catch{}}).parseCSSColor,Oi=function(a,c,f,x){x===void 0&&(x=1),this.r=a,this.g=c,this.b=f,this.a=x};Oi.parse=function(a){if(a){if(a instanceof Oi)return a;if(typeof a=="string"){var c=Si(a);if(c)return new Oi(c[0]/255*c[3],c[1]/255*c[3],c[2]/255*c[3],c[3])}}},Oi.prototype.toString=function(){var a=this.toArray(),c=a[1],f=a[2],x=a[3];return"rgba("+Math.round(a[0])+","+Math.round(c)+","+Math.round(f)+","+x+")"},Oi.prototype.toArray=function(){var a=this.a;return a===0?[0,0,0,0]:[255*this.r/a,255*this.g/a,255*this.b/a,a]},Oi.black=new Oi(0,0,0,1),Oi.white=new Oi(1,1,1,1),Oi.transparent=new Oi(0,0,0,0),Oi.red=new Oi(1,0,0,1);var yo=function(a,c,f){this.sensitivity=a?c?"variant":"case":c?"accent":"base",this.locale=f,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};yo.prototype.compare=function(a,c){return this.collator.compare(a,c)},yo.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var fc=function(a,c,f,x,S){this.text=a,this.image=c,this.scale=f,this.fontStack=x,this.textColor=S},ko=function(a){this.sections=a};ko.fromString=function(a){return new ko([new fc(a,null,null,null,null)])},ko.prototype.isEmpty=function(){return this.sections.length===0||!this.sections.some(function(a){return a.text.length!==0||a.image&&a.image.name.length!==0})},ko.factory=function(a){return a instanceof ko?a:ko.fromString(a)},ko.prototype.toString=function(){return this.sections.length===0?"":this.sections.map(function(a){return a.text}).join("")},ko.prototype.serialize=function(){for(var a=["format"],c=0,f=this.sections;c<f.length;c+=1){var x=f[c];if(x.image)a.push(["image",x.image.name]);else{a.push(x.text);var S={};x.fontStack&&(S["text-font"]=["literal",x.fontStack.split(",")]),x.scale&&(S["font-scale"]=x.scale),x.textColor&&(S["text-color"]=["rgba"].concat(x.textColor.toArray())),a.push(S)}}return a};var Yo=function(a){this.name=a.name,this.available=a.available};function zs(a,c,f,x){return typeof a=="number"&&a>=0&&a<=255&&typeof c=="number"&&c>=0&&c<=255&&typeof f=="number"&&f>=0&&f<=255?x===void 0||typeof x=="number"&&x>=0&&x<=1?null:"Invalid rgba value ["+[a,c,f,x].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+(typeof x=="number"?[a,c,f,x]:[a,c,f]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function Uo(a){if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"||a instanceof Oi||a instanceof yo||a instanceof ko||a instanceof Yo)return!0;if(Array.isArray(a)){for(var c=0,f=a;c<f.length;c+=1)if(!Uo(f[c]))return!1;return!0}if(typeof a=="object"){for(var x in a)if(!Uo(a[x]))return!1;return!0}return!1}function zn(a){if(a===null)return Mr;if(typeof a=="string")return br;if(typeof a=="boolean")return sr;if(typeof a=="number")return Ot;if(a instanceof Oi)return lr;if(a instanceof yo)return Ii;if(a instanceof ko)return vn;if(a instanceof Yo)return Di;if(Array.isArray(a)){for(var c,f=a.length,x=0,S=a;x<S.length;x+=1){var I=zn(S[x]);if(c){if(c===I)continue;c=pr;break}c=I}return Qi(c||pr,f)}return bi}function ll(a){var c=typeof a;return a===null?"":c==="string"||c==="number"||c==="boolean"?String(a):a instanceof Oi||a instanceof ko||a instanceof Yo?a.toString():JSON.stringify(a)}Yo.prototype.toString=function(){return this.name},Yo.fromString=function(a){return a?new Yo({name:a,available:!1}):null},Yo.prototype.serialize=function(){return["image",this.name]};var cs=function(a,c){this.type=a,this.value=c};cs.parse=function(a,c){if(a.length!==2)return c.error("'literal' expression requires exactly one argument, but found "+(a.length-1)+" instead.");if(!Uo(a[1]))return c.error("invalid value");var f=a[1],x=zn(f),S=c.expectedType;return x.kind!=="array"||x.N!==0||!S||S.kind!=="array"||typeof S.N=="number"&&S.N!==0||(x=S),new cs(x,f)},cs.prototype.evaluate=function(){return this.value},cs.prototype.eachChild=function(){},cs.prototype.outputDefined=function(){return!0},cs.prototype.serialize=function(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Oi?["rgba"].concat(this.value.toArray()):this.value instanceof ko?this.value.serialize():this.value};var zo=function(a){this.name="ExpressionEvaluationError",this.message=a};zo.prototype.toJSON=function(){return this.message};var ys={string:br,number:Ot,boolean:sr,object:bi},pn=function(a,c){this.type=a,this.args=c};pn.parse=function(a,c){if(a.length<2)return c.error("Expected at least one argument.");var f,x=1,S=a[0];if(S==="array"){var I,D;if(a.length>2){var H=a[1];if(typeof H!="string"||!(H in ys)||H==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);I=ys[H],x++}else I=pr;if(a.length>3){if(a[2]!==null&&(typeof a[2]!="number"||a[2]<0||a[2]!==Math.floor(a[2])))return c.error('The length argument to "array" must be a positive integer literal',2);D=a[2],x++}f=Qi(I,D)}else f=ys[S];for(var Y=[];x<a.length;x++){var ee=c.parse(a[x],x,pr);if(!ee)return null;Y.push(ee)}return new pn(f,Y)},pn.prototype.evaluate=function(a){for(var c=0;c<this.args.length;c++){var f=this.args[c].evaluate(a);if(!$i(this.type,zn(f)))return f;if(c===this.args.length-1)throw new zo("Expected value to be of type "+Li(this.type)+", but found "+Li(zn(f))+" instead.")}return null},pn.prototype.eachChild=function(a){this.args.forEach(a)},pn.prototype.outputDefined=function(){return this.args.every(function(a){return a.outputDefined()})},pn.prototype.serialize=function(){var a=this.type,c=[a.kind];if(a.kind==="array"){var f=a.itemType;if(f.kind==="string"||f.kind==="number"||f.kind==="boolean"){c.push(f.kind);var x=a.N;(typeof x=="number"||this.args.length>1)&&c.push(x)}}return c.concat(this.args.map(function(S){return S.serialize()}))};var $s=function(a){this.type=vn,this.sections=a};$s.parse=function(a,c){if(a.length<2)return c.error("Expected at least one argument.");var f=a[1];if(!Array.isArray(f)&&typeof f=="object")return c.error("First argument must be an image or text section.");for(var x=[],S=!1,I=1;I<=a.length-1;++I){var D=a[I];if(S&&typeof D=="object"&&!Array.isArray(D)){S=!1;var H=null;if(D["font-scale"]&&!(H=c.parse(D["font-scale"],1,Ot)))return null;var Y=null;if(D["text-font"]&&!(Y=c.parse(D["text-font"],1,Qi(br))))return null;var ee=null;if(D["text-color"]&&!(ee=c.parse(D["text-color"],1,lr)))return null;var ie=x[x.length-1];ie.scale=H,ie.font=Y,ie.textColor=ee}else{var se=c.parse(a[I],1,pr);if(!se)return null;var Ae=se.type.kind;if(Ae!=="string"&&Ae!=="value"&&Ae!=="null"&&Ae!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");S=!0,x.push({content:se,scale:null,font:null,textColor:null})}}return new $s(x)},$s.prototype.evaluate=function(a){return new ko(this.sections.map(function(c){var f=c.content.evaluate(a);return zn(f)===Di?new fc("",f,null,null,null):new fc(ll(f),null,c.scale?c.scale.evaluate(a):null,c.font?c.font.evaluate(a).join(","):null,c.textColor?c.textColor.evaluate(a):null)}))},$s.prototype.eachChild=function(a){for(var c=0,f=this.sections;c<f.length;c+=1){var x=f[c];a(x.content),x.scale&&a(x.scale),x.font&&a(x.font),x.textColor&&a(x.textColor)}},$s.prototype.outputDefined=function(){return!1},$s.prototype.serialize=function(){for(var a=["format"],c=0,f=this.sections;c<f.length;c+=1){var x=f[c];a.push(x.content.serialize());var S={};x.scale&&(S["font-scale"]=x.scale.serialize()),x.font&&(S["text-font"]=x.font.serialize()),x.textColor&&(S["text-color"]=x.textColor.serialize()),a.push(S)}return a};var Vs=function(a){this.type=Di,this.input=a};Vs.parse=function(a,c){if(a.length!==2)return c.error("Expected two arguments.");var f=c.parse(a[1],1,br);return f?new Vs(f):c.error("No image name provided.")},Vs.prototype.evaluate=function(a){var c=this.input.evaluate(a),f=Yo.fromString(c);return f&&a.availableImages&&(f.available=a.availableImages.indexOf(c)>-1),f},Vs.prototype.eachChild=function(a){a(this.input)},Vs.prototype.outputDefined=function(){return!1},Vs.prototype.serialize=function(){return["image",this.input.serialize()]};var Qu={"to-boolean":sr,"to-color":lr,"to-number":Ot,"to-string":br},ua=function(a,c){this.type=a,this.args=c};ua.parse=function(a,c){if(a.length<2)return c.error("Expected at least one argument.");var f=a[0];if((f==="to-boolean"||f==="to-string")&&a.length!==2)return c.error("Expected one argument.");for(var x=Qu[f],S=[],I=1;I<a.length;I++){var D=c.parse(a[I],I,pr);if(!D)return null;S.push(D)}return new ua(x,S)},ua.prototype.evaluate=function(a){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(a));if(this.type.kind==="color"){for(var c,f,x=0,S=this.args;x<S.length;x+=1){if(f=null,(c=S[x].evaluate(a))instanceof Oi)return c;if(typeof c=="string"){var I=a.parseColor(c);if(I)return I}else if(Array.isArray(c)&&!(f=c.length<3||c.length>4?"Invalid rbga value "+JSON.stringify(c)+": expected an array containing either three or four numeric values.":zs(c[0],c[1],c[2],c[3])))return new Oi(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new zo(f||"Could not parse color from value '"+(typeof c=="string"?c:String(JSON.stringify(c)))+"'")}if(this.type.kind==="number"){for(var D=null,H=0,Y=this.args;H<Y.length;H+=1){if((D=Y[H].evaluate(a))===null)return 0;var ee=Number(D);if(!isNaN(ee))return ee}throw new zo("Could not convert "+JSON.stringify(D)+" to number.")}return this.type.kind==="formatted"?ko.fromString(ll(this.args[0].evaluate(a))):this.type.kind==="resolvedImage"?Yo.fromString(ll(this.args[0].evaluate(a))):ll(this.args[0].evaluate(a))},ua.prototype.eachChild=function(a){this.args.forEach(a)},ua.prototype.outputDefined=function(){return this.args.every(function(a){return a.outputDefined()})},ua.prototype.serialize=function(){if(this.type.kind==="formatted")return new $s([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Vs(this.args[0]).serialize();var a=["to-"+this.type.kind];return this.eachChild(function(c){a.push(c.serialize())}),a};var Ua=["Unknown","Point","LineString","Polygon"],cl=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null};cl.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},cl.prototype.geometryType=function(){return this.feature?typeof this.feature.type=="number"?Ua[this.feature.type]:this.feature.type:null},cl.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},cl.prototype.canonicalID=function(){return this.canonical},cl.prototype.properties=function(){return this.feature&&this.feature.properties||{}},cl.prototype.parseColor=function(a){var c=this._parseColorCache[a];return c||(c=this._parseColorCache[a]=Oi.parse(a)),c};var xe=function(a,c,f,x){this.name=a,this.type=c,this._evaluate=f,this.args=x};xe.prototype.evaluate=function(a){return this._evaluate(a,this.args)},xe.prototype.eachChild=function(a){this.args.forEach(a)},xe.prototype.outputDefined=function(){return!1},xe.prototype.serialize=function(){return[this.name].concat(this.args.map(function(a){return a.serialize()}))},xe.parse=function(a,c){var f,x=a[0],S=xe.definitions[x];if(!S)return c.error('Unknown expression "'+x+'". If you wanted a literal array, use ["literal", [...]].',0);for(var I=Array.isArray(S)?S[0]:S.type,D=Array.isArray(S)?[[S[1],S[2]]]:S.overloads,H=D.filter(function(ni){var Pr=ni[0];return!Array.isArray(Pr)||Pr.length===a.length-1}),Y=null,ee=0,ie=H;ee<ie.length;ee+=1){var se=ie[ee],Ae=se[0],Te=se[1];Y=new zc(c.registry,c.path,null,c.scope);for(var ke=[],Ve=!1,et=1;et<a.length;et++){var Xe=a[et],at=Array.isArray(Ae)?Ae[et-1]:Ae.type,_t=Y.parse(Xe,1+ke.length,at);if(!_t){Ve=!0;break}ke.push(_t)}if(!Ve)if(Array.isArray(Ae)&&Ae.length!==ke.length)Y.error("Expected "+Ae.length+" arguments, but found "+ke.length+" instead.");else{for(var bt=0;bt<ke.length;bt++){var Mt=Array.isArray(Ae)?Ae[bt]:Ae.type,Ut=ke[bt];Y.concat(bt+1).checkSubtype(Mt,Ut.type)}if(Y.errors.length===0)return new xe(x,I,Te,ke)}}if(H.length===1)(f=c.errors).push.apply(f,Y.errors);else{for(var $t=(H.length?H:D).map(function(ni){var Pr;return Pr=ni[0],Array.isArray(Pr)?"("+Pr.map(Li).join(", ")+")":"("+Li(Pr.type)+"...)"}).join(" | "),Ar=[],Qr=1;Qr<a.length;Qr++){var Cr=c.parse(a[Qr],1+Ar.length);if(!Cr)return null;Ar.push(Li(Cr.type))}c.error("Expected arguments of type "+$t+", but found ("+Ar.join(", ")+") instead.")}return null},xe.register=function(a,c){for(var f in xe.definitions=c,c)a[f]=xe};var Be=function(a,c,f){this.type=Ii,this.locale=f,this.caseSensitive=a,this.diacriticSensitive=c};function Je(a,c){a[0]=Math.min(a[0],c[0]),a[1]=Math.min(a[1],c[1]),a[2]=Math.max(a[2],c[0]),a[3]=Math.max(a[3],c[1])}function vt(a,c){return!(a[0]<=c[0]||a[2]>=c[2]||a[1]<=c[1]||a[3]>=c[3])}function tr(a,c){var f=(180+a[0])/360,x=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,S=Math.pow(2,c.z);return[Math.round(f*S*8192),Math.round(x*S*8192)]}function qr(a,c,f){return c[1]>a[1]!=f[1]>a[1]&&a[0]<(f[0]-c[0])*(a[1]-c[1])/(f[1]-c[1])+c[0]}function sn(a,c){for(var f,x,S,I,D,H,Y,ee=!1,ie=0,se=c.length;ie<se;ie++)for(var Ae=c[ie],Te=0,ke=Ae.length;Te<ke-1;Te++){if((I=(f=a)[0]-(x=Ae[Te])[0])*(Y=f[1]-(S=Ae[Te+1])[1])-(H=f[0]-S[0])*(D=f[1]-x[1])==0&&I*H<=0&&D*Y<=0)return!1;qr(a,Ae[Te],Ae[Te+1])&&(ee=!ee)}return ee}function Co(a,c){for(var f=0;f<c.length;f++)if(sn(a,c[f]))return!0;return!1}function ts(a,c,f,x){var S=x[0]-f[0],I=x[1]-f[1],D=(a[0]-f[0])*I-S*(a[1]-f[1]),H=(c[0]-f[0])*I-S*(c[1]-f[1]);return D>0&&H<0||D<0&&H>0}function vs(a,c,f){for(var x=0,S=f;x<S.length;x+=1)for(var I=S[x],D=0;D<I.length-1;++D)if((se=[(ie=I[D+1])[0]-(ee=I[D])[0],ie[1]-ee[1]])[0]*(Ae=[(Y=c)[0]-(H=a)[0],Y[1]-H[1]])[1]-se[1]*Ae[0]!=0&&ts(H,Y,ee,ie)&&ts(ee,ie,H,Y))return!0;var H,Y,ee,ie,se,Ae;return!1}function Sa(a,c){for(var f=0;f<a.length;++f)if(!sn(a[f],c))return!1;for(var x=0;x<a.length-1;++x)if(vs(a[x],a[x+1],c))return!1;return!0}function np(a,c){for(var f=0;f<c.length;f++)if(Sa(a,c[f]))return!0;return!1}function $u(a,c,f){for(var x=[],S=0;S<a.length;S++){for(var I=[],D=0;D<a[S].length;D++){var H=tr(a[S][D],f);Je(c,H),I.push(H)}x.push(I)}return x}function Wh(a,c,f){for(var x=[],S=0;S<a.length;S++){var I=$u(a[S],c,f);x.push(I)}return x}function Wf(a,c,f,x){if(a[0]<f[0]||a[0]>f[2]){var S=.5*x,I=a[0]-f[0]>S?-x:f[0]-a[0]>S?x:0;I===0&&(I=a[0]-f[2]>S?-x:f[2]-a[0]>S?x:0),a[0]+=I}Je(c,a)}function RA(a,c,f,x){for(var S=8192*Math.pow(2,x.z),I=[8192*x.x,8192*x.y],D=[],H=0,Y=a;H<Y.length;H+=1)for(var ee=0,ie=Y[H];ee<ie.length;ee+=1){var se=ie[ee],Ae=[se.x+I[0],se.y+I[1]];Wf(Ae,c,f,S),D.push(Ae)}return D}function ef(a,c,f,x){for(var S,I=8192*Math.pow(2,x.z),D=[8192*x.x,8192*x.y],H=[],Y=0,ee=a;Y<ee.length;Y+=1){for(var ie=[],se=0,Ae=ee[Y];se<Ae.length;se+=1){var Te=Ae[se],ke=[Te.x+D[0],Te.y+D[1]];Je(c,ke),ie.push(ke)}H.push(ie)}if(c[2]-c[0]<=I/2){(S=c)[0]=S[1]=1/0,S[2]=S[3]=-1/0;for(var Ve=0,et=H;Ve<et.length;Ve+=1)for(var Xe=0,at=et[Ve];Xe<at.length;Xe+=1)Wf(at[Xe],c,f,I)}return H}Be.parse=function(a,c){if(a.length!==2)return c.error("Expected one argument.");var f=a[1];if(typeof f!="object"||Array.isArray(f))return c.error("Collator options argument must be an object.");var x=c.parse(f["case-sensitive"]!==void 0&&f["case-sensitive"],1,sr);if(!x)return null;var S=c.parse(f["diacritic-sensitive"]!==void 0&&f["diacritic-sensitive"],1,sr);if(!S)return null;var I=null;return f.locale&&!(I=c.parse(f.locale,1,br))?null:new Be(x,S,I)},Be.prototype.evaluate=function(a){return new yo(this.caseSensitive.evaluate(a),this.diacriticSensitive.evaluate(a),this.locale?this.locale.evaluate(a):null)},Be.prototype.eachChild=function(a){a(this.caseSensitive),a(this.diacriticSensitive),this.locale&&a(this.locale)},Be.prototype.outputDefined=function(){return!1},Be.prototype.serialize=function(){var a={};return a["case-sensitive"]=this.caseSensitive.serialize(),a["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(a.locale=this.locale.serialize()),["collator",a]};var ul=function(a,c){this.type=sr,this.geojson=a,this.geometries=c};function Nc(a){if(a instanceof xe&&(a.name==="get"&&a.args.length===1||a.name==="feature-state"||a.name==="has"&&a.args.length===1||a.name==="properties"||a.name==="geometry-type"||a.name==="id"||/^filter-/.test(a.name))||a instanceof ul)return!1;var c=!0;return a.eachChild(function(f){c&&!Nc(f)&&(c=!1)}),c}function kc(a){if(a instanceof xe&&a.name==="feature-state")return!1;var c=!0;return a.eachChild(function(f){c&&!kc(f)&&(c=!1)}),c}function cu(a,c){if(a instanceof xe&&c.indexOf(a.name)>=0)return!1;var f=!0;return a.eachChild(function(x){f&&!cu(x,c)&&(f=!1)}),f}ul.parse=function(a,c){if(a.length!==2)return c.error("'within' expression requires exactly one argument, but found "+(a.length-1)+" instead.");if(Uo(a[1])){var f=a[1];if(f.type==="FeatureCollection")for(var x=0;x<f.features.length;++x){var S=f.features[x].geometry.type;if(S==="Polygon"||S==="MultiPolygon")return new ul(f,f.features[x].geometry)}else if(f.type==="Feature"){var I=f.geometry.type;if(I==="Polygon"||I==="MultiPolygon")return new ul(f,f.geometry)}else if(f.type==="Polygon"||f.type==="MultiPolygon")return new ul(f,f)}return c.error("'within' expression requires valid geojson object that contains polygon geometry type.")},ul.prototype.evaluate=function(a){if(a.geometry()!=null&&a.canonicalID()!=null){if(a.geometryType()==="Point")return function(c,f){var x=[1/0,1/0,-1/0,-1/0],S=[1/0,1/0,-1/0,-1/0],I=c.canonicalID();if(f.type==="Polygon"){var D=$u(f.coordinates,S,I),H=RA(c.geometry(),x,S,I);if(!vt(x,S))return!1;for(var Y=0,ee=H;Y<ee.length;Y+=1)if(!sn(ee[Y],D))return!1}if(f.type==="MultiPolygon"){var ie=Wh(f.coordinates,S,I),se=RA(c.geometry(),x,S,I);if(!vt(x,S))return!1;for(var Ae=0,Te=se;Ae<Te.length;Ae+=1)if(!Co(Te[Ae],ie))return!1}return!0}(a,this.geometries);if(a.geometryType()==="LineString")return function(c,f){var x=[1/0,1/0,-1/0,-1/0],S=[1/0,1/0,-1/0,-1/0],I=c.canonicalID();if(f.type==="Polygon"){var D=$u(f.coordinates,S,I),H=ef(c.geometry(),x,S,I);if(!vt(x,S))return!1;for(var Y=0,ee=H;Y<ee.length;Y+=1)if(!Sa(ee[Y],D))return!1}if(f.type==="MultiPolygon"){var ie=Wh(f.coordinates,S,I),se=ef(c.geometry(),x,S,I);if(!vt(x,S))return!1;for(var Ae=0,Te=se;Ae<Te.length;Ae+=1)if(!np(Te[Ae],ie))return!1}return!0}(a,this.geometries)}return!1},ul.prototype.eachChild=function(){},ul.prototype.outputDefined=function(){return!0},ul.prototype.serialize=function(){return["within",this.geojson]};var Uc=function(a,c){this.type=c.type,this.name=a,this.boundExpression=c};Uc.parse=function(a,c){if(a.length!==2||typeof a[1]!="string")return c.error("'var' expression requires exactly one string literal argument.");var f=a[1];return c.scope.has(f)?new Uc(f,c.scope.get(f)):c.error('Unknown variable "'+f+'". Make sure "'+f+'" has been bound in an enclosing "let" expression before using it.',1)},Uc.prototype.evaluate=function(a){return this.boundExpression.evaluate(a)},Uc.prototype.eachChild=function(){},Uc.prototype.outputDefined=function(){return!1},Uc.prototype.serialize=function(){return["var",this.name]};var zc=function(a,c,f,x,S){c===void 0&&(c=[]),x===void 0&&(x=new Dr),S===void 0&&(S=[]),this.registry=a,this.path=c,this.key=c.map(function(I){return"["+I+"]"}).join(""),this.scope=x,this.errors=S,this.expectedType=f};function qh(a,c){for(var f,x=a.length-1,S=0,I=x,D=0;S<=I;)if((f=a[D=Math.floor((S+I)/2)])<=c){if(D===x||c<a[D+1])return D;S=D+1}else{if(!(f>c))throw new zo("Input is not a number.");I=D-1}return 0}zc.prototype.parse=function(a,c,f,x,S){return S===void 0&&(S={}),c?this.concat(c,f,x)._parse(a,S):this._parse(a,S)},zc.prototype._parse=function(a,c){function f(ee,ie,se){return se==="assert"?new pn(ie,[ee]):se==="coerce"?new ua(ie,[ee]):ee}if(a!==null&&typeof a!="string"&&typeof a!="boolean"&&typeof a!="number"||(a=["literal",a]),Array.isArray(a)){if(a.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var x=a[0];if(typeof x!="string")return this.error("Expression name must be a string, but found "+typeof x+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var S=this.registry[x];if(S){var I=S.parse(a,this);if(!I)return null;if(this.expectedType){var D=this.expectedType,H=I.type;if(D.kind!=="string"&&D.kind!=="number"&&D.kind!=="boolean"&&D.kind!=="object"&&D.kind!=="array"||H.kind!=="value")if(D.kind!=="color"&&D.kind!=="formatted"&&D.kind!=="resolvedImage"||H.kind!=="value"&&H.kind!=="string"){if(this.checkSubtype(D,H))return null}else I=f(I,D,c.typeAnnotation||"coerce");else I=f(I,D,c.typeAnnotation||"assert")}if(!(I instanceof cs)&&I.type.kind!=="resolvedImage"&&function ee(ie){if(ie instanceof Uc)return ee(ie.boundExpression);if(ie instanceof xe&&ie.name==="error"||ie instanceof Be||ie instanceof ul)return!1;var se=ie instanceof ua||ie instanceof pn,Ae=!0;return ie.eachChild(function(Te){Ae=se?Ae&&ee(Te):Ae&&Te instanceof cs}),!!Ae&&Nc(ie)&&cu(ie,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(I)){var Y=new cl;try{I=new cs(I.type,I.evaluate(Y))}catch(ee){return this.error(ee.message),null}}return I}return this.error('Unknown expression "'+x+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(a===void 0?"'undefined' value invalid. Use null instead.":typeof a=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof a+" instead.")},zc.prototype.concat=function(a,c,f){var x=typeof a=="number"?this.path.concat(a):this.path,S=f?this.scope.concat(f):this.scope;return new zc(this.registry,x,c||null,S,this.errors)},zc.prototype.error=function(a){for(var c=[],f=arguments.length-1;f-- >0;)c[f]=arguments[f+1];var x=""+this.key+c.map(function(S){return"["+S+"]"}).join("");this.errors.push(new Xt(x,a))},zc.prototype.checkSubtype=function(a,c){var f=$i(a,c);return f&&this.error(f),f};var fa=function(a,c,f){this.type=a,this.input=c,this.labels=[],this.outputs=[];for(var x=0,S=f;x<S.length;x+=1){var I=S[x],D=I[1];this.labels.push(I[0]),this.outputs.push(D)}};function Mo(a,c,f){return a*(1-f)+c*f}fa.parse=function(a,c){if(a.length-1<4)return c.error("Expected at least 4 arguments, but found only "+(a.length-1)+".");if((a.length-1)%2!=0)return c.error("Expected an even number of arguments.");var f=c.parse(a[1],1,Ot);if(!f)return null;var x=[],S=null;c.expectedType&&c.expectedType.kind!=="value"&&(S=c.expectedType);for(var I=1;I<a.length;I+=2){var D=I===1?-1/0:a[I],H=a[I+1],Y=I,ee=I+1;if(typeof D!="number")return c.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',Y);if(x.length&&x[x.length-1][0]>=D)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',Y);var ie=c.parse(H,ee,S);if(!ie)return null;S=S||ie.type,x.push([D,ie])}return new fa(S,f,x)},fa.prototype.evaluate=function(a){var c=this.labels,f=this.outputs;if(c.length===1)return f[0].evaluate(a);var x=this.input.evaluate(a);if(x<=c[0])return f[0].evaluate(a);var S=c.length;return x>=c[S-1]?f[S-1].evaluate(a):f[qh(c,x)].evaluate(a)},fa.prototype.eachChild=function(a){a(this.input);for(var c=0,f=this.outputs;c<f.length;c+=1)a(f[c])},fa.prototype.outputDefined=function(){return this.outputs.every(function(a){return a.outputDefined()})},fa.prototype.serialize=function(){for(var a=["step",this.input.serialize()],c=0;c<this.labels.length;c++)c>0&&a.push(this.labels[c]),a.push(this.outputs[c].serialize());return a};var uu=Object.freeze({__proto__:null,number:Mo,color:function(a,c,f){return new Oi(Mo(a.r,c.r,f),Mo(a.g,c.g,f),Mo(a.b,c.b,f),Mo(a.a,c.a,f))},array:function(a,c,f){return a.map(function(x,S){return Mo(x,c[S],f)})}}),Xh=6/29*3*(6/29),BA=Math.PI/180,OA=180/Math.PI;function qf(a){return a>.008856451679035631?Math.pow(a,1/3):a/Xh+4/29}function op(a){return a>6/29?a*a*a:Xh*(a-4/29)}function sp(a){return 255*(a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055)}function ap(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function tf(a){var c=ap(a.r),f=ap(a.g),x=ap(a.b),S=qf((.4124564*c+.3575761*f+.1804375*x)/.95047),I=qf((.2126729*c+.7151522*f+.072175*x)/1);return{l:116*I-16,a:500*(S-I),b:200*(I-qf((.0193339*c+.119192*f+.9503041*x)/1.08883)),alpha:a.a}}function lp(a){var c=(a.l+16)/116,f=isNaN(a.a)?c:c+a.a/500,x=isNaN(a.b)?c:c-a.b/200;return c=1*op(c),f=.95047*op(f),x=1.08883*op(x),new Oi(sp(3.2404542*f-1.5371385*c-.4985314*x),sp(-.969266*f+1.8760108*c+.041556*x),sp(.0556434*f-.2040259*c+1.0572252*x),a.alpha)}function cp(a,c,f){var x=c-a;return a+f*(x>180||x<-180?x-360*Math.round(x/360):x)}var Xf={forward:tf,reverse:lp,interpolate:function(a,c,f){return{l:Mo(a.l,c.l,f),a:Mo(a.a,c.a,f),b:Mo(a.b,c.b,f),alpha:Mo(a.alpha,c.alpha,f)}}},Yf={forward:function(a){var c=tf(a),f=c.l,x=c.a,S=c.b,I=Math.atan2(S,x)*OA;return{h:I<0?I+360:I,c:Math.sqrt(x*x+S*S),l:f,alpha:a.a}},reverse:function(a){var c=a.h*BA,f=a.c;return lp({l:a.l,a:Math.cos(c)*f,b:Math.sin(c)*f,alpha:a.alpha})},interpolate:function(a,c,f){return{h:cp(a.h,c.h,f),c:Mo(a.c,c.c,f),l:Mo(a.l,c.l,f),alpha:Mo(a.alpha,c.alpha,f)}}},DA=Object.freeze({__proto__:null,lab:Xf,hcl:Yf}),P=function(a,c,f,x,S){this.type=a,this.operator=c,this.interpolation=f,this.input=x,this.labels=[],this.outputs=[];for(var I=0,D=S;I<D.length;I+=1){var H=D[I],Y=H[1];this.labels.push(H[0]),this.outputs.push(Y)}};function U(a,c,f,x){var S=x-f,I=a-f;return S===0?0:c===1?I/S:(Math.pow(c,I)-1)/(Math.pow(c,S)-1)}P.interpolationFactor=function(a,c,f,x){var S=0;if(a.name==="exponential")S=U(c,a.base,f,x);else if(a.name==="linear")S=U(c,1,f,x);else if(a.name==="cubic-bezier"){var I=a.controlPoints;S=new s(I[0],I[1],I[2],I[3]).solve(U(c,1,f,x))}return S},P.parse=function(a,c){var f=a[0],x=a[1],S=a[2],I=a.slice(3);if(!Array.isArray(x)||x.length===0)return c.error("Expected an interpolation type expression.",1);if(x[0]==="linear")x={name:"linear"};else if(x[0]==="exponential"){var D=x[1];if(typeof D!="number")return c.error("Exponential interpolation requires a numeric base.",1,1);x={name:"exponential",base:D}}else{if(x[0]!=="cubic-bezier")return c.error("Unknown interpolation type "+String(x[0]),1,0);var H=x.slice(1);if(H.length!==4||H.some(function(et){return typeof et!="number"||et<0||et>1}))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);x={name:"cubic-bezier",controlPoints:H}}if(a.length-1<4)return c.error("Expected at least 4 arguments, but found only "+(a.length-1)+".");if((a.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(!(S=c.parse(S,2,Ot)))return null;var Y=[],ee=null;f==="interpolate-hcl"||f==="interpolate-lab"?ee=lr:c.expectedType&&c.expectedType.kind!=="value"&&(ee=c.expectedType);for(var ie=0;ie<I.length;ie+=2){var se=I[ie],Ae=I[ie+1],Te=ie+3,ke=ie+4;if(typeof se!="number")return c.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',Te);if(Y.length&&Y[Y.length-1][0]>=se)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',Te);var Ve=c.parse(Ae,ke,ee);if(!Ve)return null;ee=ee||Ve.type,Y.push([se,Ve])}return ee.kind==="number"||ee.kind==="color"||ee.kind==="array"&&ee.itemType.kind==="number"&&typeof ee.N=="number"?new P(ee,f,x,S,Y):c.error("Type "+Li(ee)+" is not interpolatable.")},P.prototype.evaluate=function(a){var c=this.labels,f=this.outputs;if(c.length===1)return f[0].evaluate(a);var x=this.input.evaluate(a);if(x<=c[0])return f[0].evaluate(a);var S=c.length;if(x>=c[S-1])return f[S-1].evaluate(a);var I=qh(c,x),D=P.interpolationFactor(this.interpolation,x,c[I],c[I+1]),H=f[I].evaluate(a),Y=f[I+1].evaluate(a);return this.operator==="interpolate"?uu[this.type.kind.toLowerCase()](H,Y,D):this.operator==="interpolate-hcl"?Yf.reverse(Yf.interpolate(Yf.forward(H),Yf.forward(Y),D)):Xf.reverse(Xf.interpolate(Xf.forward(H),Xf.forward(Y),D))},P.prototype.eachChild=function(a){a(this.input);for(var c=0,f=this.outputs;c<f.length;c+=1)a(f[c])},P.prototype.outputDefined=function(){return this.outputs.every(function(a){return a.outputDefined()})},P.prototype.serialize=function(){var a;a=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);for(var c=[this.operator,a,this.input.serialize()],f=0;f<this.labels.length;f++)c.push(this.labels[f],this.outputs[f].serialize());return c};var G=function(a,c){this.type=a,this.args=c};G.parse=function(a,c){if(a.length<2)return c.error("Expectected at least one argument.");var f=null,x=c.expectedType;x&&x.kind!=="value"&&(f=x);for(var S=[],I=0,D=a.slice(1);I<D.length;I+=1){var H=c.parse(D[I],1+S.length,f,void 0,{typeAnnotation:"omit"});if(!H)return null;f=f||H.type,S.push(H)}var Y=x&&S.some(function(ee){return $i(x,ee.type)});return new G(Y?pr:f,S)},G.prototype.evaluate=function(a){for(var c,f=null,x=0,S=0,I=this.args;S<I.length&&(x++,(f=I[S].evaluate(a))&&f instanceof Yo&&!f.available&&(c||(c=f.name),f=null,x===this.args.length&&(f=c)),f===null);S+=1);return f},G.prototype.eachChild=function(a){this.args.forEach(a)},G.prototype.outputDefined=function(){return this.args.every(function(a){return a.outputDefined()})},G.prototype.serialize=function(){var a=["coalesce"];return this.eachChild(function(c){a.push(c.serialize())}),a};var Q=function(a,c){this.type=c.type,this.bindings=[].concat(a),this.result=c};Q.prototype.evaluate=function(a){return this.result.evaluate(a)},Q.prototype.eachChild=function(a){for(var c=0,f=this.bindings;c<f.length;c+=1)a(f[c][1]);a(this.result)},Q.parse=function(a,c){if(a.length<4)return c.error("Expected at least 3 arguments, but found "+(a.length-1)+" instead.");for(var f=[],x=1;x<a.length-1;x+=2){var S=a[x];if(typeof S!="string")return c.error("Expected string, but found "+typeof S+" instead.",x);if(/[^a-zA-Z0-9_]/.test(S))return c.error("Variable names must contain only alphanumeric characters or '_'.",x);var I=c.parse(a[x+1],x+1);if(!I)return null;f.push([S,I])}var D=c.parse(a[a.length-1],a.length-1,c.expectedType,f);return D?new Q(f,D):null},Q.prototype.outputDefined=function(){return this.result.outputDefined()},Q.prototype.serialize=function(){for(var a=["let"],c=0,f=this.bindings;c<f.length;c+=1){var x=f[c];a.push(x[0],x[1].serialize())}return a.push(this.result.serialize()),a};var le=function(a,c,f){this.type=a,this.index=c,this.input=f};le.parse=function(a,c){if(a.length!==3)return c.error("Expected 2 arguments, but found "+(a.length-1)+" instead.");var f=c.parse(a[1],1,Ot),x=c.parse(a[2],2,Qi(c.expectedType||pr));return f&&x?new le(x.type.itemType,f,x):null},le.prototype.evaluate=function(a){var c=this.index.evaluate(a),f=this.input.evaluate(a);if(c<0)throw new zo("Array index out of bounds: "+c+" < 0.");if(c>=f.length)throw new zo("Array index out of bounds: "+c+" > "+(f.length-1)+".");if(c!==Math.floor(c))throw new zo("Array index must be an integer, but found "+c+" instead.");return f[c]},le.prototype.eachChild=function(a){a(this.index),a(this.input)},le.prototype.outputDefined=function(){return!1},le.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var ce=function(a,c){this.type=sr,this.needle=a,this.haystack=c};ce.parse=function(a,c){if(a.length!==3)return c.error("Expected 2 arguments, but found "+(a.length-1)+" instead.");var f=c.parse(a[1],1,pr),x=c.parse(a[2],2,pr);return f&&x?Ln(f.type,[sr,br,Ot,Mr,pr])?new ce(f,x):c.error("Expected first argument to be of type boolean, string, number or null, but found "+Li(f.type)+" instead"):null},ce.prototype.evaluate=function(a){var c=this.needle.evaluate(a),f=this.haystack.evaluate(a);if(!f)return!1;if(!en(c,["boolean","string","number","null"]))throw new zo("Expected first argument to be of type boolean, string, number or null, but found "+Li(zn(c))+" instead.");if(!en(f,["string","array"]))throw new zo("Expected second argument to be of type array or string, but found "+Li(zn(f))+" instead.");return f.indexOf(c)>=0},ce.prototype.eachChild=function(a){a(this.needle),a(this.haystack)},ce.prototype.outputDefined=function(){return!0},ce.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var _e=function(a,c,f){this.type=Ot,this.needle=a,this.haystack=c,this.fromIndex=f};_e.parse=function(a,c){if(a.length<=2||a.length>=5)return c.error("Expected 3 or 4 arguments, but found "+(a.length-1)+" instead.");var f=c.parse(a[1],1,pr),x=c.parse(a[2],2,pr);if(!f||!x)return null;if(!Ln(f.type,[sr,br,Ot,Mr,pr]))return c.error("Expected first argument to be of type boolean, string, number or null, but found "+Li(f.type)+" instead");if(a.length===4){var S=c.parse(a[3],3,Ot);return S?new _e(f,x,S):null}return new _e(f,x)},_e.prototype.evaluate=function(a){var c=this.needle.evaluate(a),f=this.haystack.evaluate(a);if(!en(c,["boolean","string","number","null"]))throw new zo("Expected first argument to be of type boolean, string, number or null, but found "+Li(zn(c))+" instead.");if(!en(f,["string","array"]))throw new zo("Expected second argument to be of type array or string, but found "+Li(zn(f))+" instead.");if(this.fromIndex){var x=this.fromIndex.evaluate(a);return f.indexOf(c,x)}return f.indexOf(c)},_e.prototype.eachChild=function(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)},_e.prototype.outputDefined=function(){return!1},_e.prototype.serialize=function(){if(this.fromIndex!=null&&this.fromIndex!==void 0){var a=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),a]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var Qe=function(a,c,f,x,S,I){this.inputType=a,this.type=c,this.input=f,this.cases=x,this.outputs=S,this.otherwise=I};Qe.parse=function(a,c){if(a.length<5)return c.error("Expected at least 4 arguments, but found only "+(a.length-1)+".");if(a.length%2!=1)return c.error("Expected an even number of arguments.");var f,x;c.expectedType&&c.expectedType.kind!=="value"&&(x=c.expectedType);for(var S={},I=[],D=2;D<a.length-1;D+=2){var H=a[D],Y=a[D+1];Array.isArray(H)||(H=[H]);var ee=c.concat(D);if(H.length===0)return ee.error("Expected at least one branch label.");for(var ie=0,se=H;ie<se.length;ie+=1){var Ae=se[ie];if(typeof Ae!="number"&&typeof Ae!="string")return ee.error("Branch labels must be numbers or strings.");if(typeof Ae=="number"&&Math.abs(Ae)>Number.MAX_SAFE_INTEGER)return ee.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if(typeof Ae=="number"&&Math.floor(Ae)!==Ae)return ee.error("Numeric branch labels must be integer values.");if(f){if(ee.checkSubtype(f,zn(Ae)))return null}else f=zn(Ae);if(S[String(Ae)]!==void 0)return ee.error("Branch labels must be unique.");S[String(Ae)]=I.length}var Te=c.parse(Y,D,x);if(!Te)return null;x=x||Te.type,I.push(Te)}var ke=c.parse(a[1],1,pr);if(!ke)return null;var Ve=c.parse(a[a.length-1],a.length-1,x);return Ve?ke.type.kind!=="value"&&c.concat(1).checkSubtype(f,ke.type)?null:new Qe(f,x,ke,S,I,Ve):null},Qe.prototype.evaluate=function(a){var c=this.input.evaluate(a);return(zn(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(a)},Qe.prototype.eachChild=function(a){a(this.input),this.outputs.forEach(a),a(this.otherwise)},Qe.prototype.outputDefined=function(){return this.outputs.every(function(a){return a.outputDefined()})&&this.otherwise.outputDefined()},Qe.prototype.serialize=function(){for(var a=this,c=["match",this.input.serialize()],f=[],x={},S=0,I=Object.keys(this.cases).sort();S<I.length;S+=1){var D=I[S];(se=x[this.cases[D]])===void 0?(x[this.cases[D]]=f.length,f.push([this.cases[D],[D]])):f[se][1].push(D)}for(var H=function(Te){return a.inputType.kind==="number"?Number(Te):Te},Y=0,ee=f;Y<ee.length;Y+=1){var ie=ee[Y],se=ie[0],Ae=ie[1];c.push(Ae.length===1?H(Ae[0]):Ae.map(H)),c.push(this.outputs[outputIndex$1].serialize())}return c.push(this.otherwise.serialize()),c};var qe=function(a,c,f){this.type=a,this.branches=c,this.otherwise=f};qe.parse=function(a,c){if(a.length<4)return c.error("Expected at least 3 arguments, but found only "+(a.length-1)+".");if(a.length%2!=0)return c.error("Expected an odd number of arguments.");var f;c.expectedType&&c.expectedType.kind!=="value"&&(f=c.expectedType);for(var x=[],S=1;S<a.length-1;S+=2){var I=c.parse(a[S],S,sr);if(!I)return null;var D=c.parse(a[S+1],S+1,f);if(!D)return null;x.push([I,D]),f=f||D.type}var H=c.parse(a[a.length-1],a.length-1,f);return H?new qe(f,x,H):null},qe.prototype.evaluate=function(a){for(var c=0,f=this.branches;c<f.length;c+=1){var x=f[c],S=x[1];if(x[0].evaluate(a))return S.evaluate(a)}return this.otherwise.evaluate(a)},qe.prototype.eachChild=function(a){for(var c=0,f=this.branches;c<f.length;c+=1){var x=f[c],S=x[1];a(x[0]),a(S)}a(this.otherwise)},qe.prototype.outputDefined=function(){return this.branches.every(function(a){return a[1].outputDefined()})&&this.otherwise.outputDefined()},qe.prototype.serialize=function(){var a=["case"];return this.eachChild(function(c){a.push(c.serialize())}),a};var ct=function(a,c,f,x){this.type=a,this.input=c,this.beginIndex=f,this.endIndex=x};function Nt(a,c){return a==="=="||a==="!="?c.kind==="boolean"||c.kind==="string"||c.kind==="number"||c.kind==="null"||c.kind==="value":c.kind==="string"||c.kind==="number"||c.kind==="value"}function jt(a,c,f,x){return x.compare(c,f)===0}function dt(a,c,f){var x=a!=="=="&&a!=="!=";return function(){function S(I,D,H){this.type=sr,this.lhs=I,this.rhs=D,this.collator=H,this.hasUntypedArgument=I.type.kind==="value"||D.type.kind==="value"}return S.parse=function(I,D){if(I.length!==3&&I.length!==4)return D.error("Expected two or three arguments.");var H=I[0],Y=D.parse(I[1],1,pr);if(!Y)return null;if(!Nt(H,Y.type))return D.concat(1).error('"'+H+`" comparisons are not supported for type '`+Li(Y.type)+"'.");var ee=D.parse(I[2],2,pr);if(!ee)return null;if(!Nt(H,ee.type))return D.concat(2).error('"'+H+`" comparisons are not supported for type '`+Li(ee.type)+"'.");if(Y.type.kind!==ee.type.kind&&Y.type.kind!=="value"&&ee.type.kind!=="value")return D.error("Cannot compare types '"+Li(Y.type)+"' and '"+Li(ee.type)+"'.");x&&(Y.type.kind==="value"&&ee.type.kind!=="value"?Y=new pn(ee.type,[Y]):Y.type.kind!=="value"&&ee.type.kind==="value"&&(ee=new pn(Y.type,[ee])));var ie=null;if(I.length===4){if(Y.type.kind!=="string"&&ee.type.kind!=="string"&&Y.type.kind!=="value"&&ee.type.kind!=="value")return D.error("Cannot use collator to compare non-string types.");if(!(ie=D.parse(I[3],3,Ii)))return null}return new S(Y,ee,ie)},S.prototype.evaluate=function(I){var D=this.lhs.evaluate(I),H=this.rhs.evaluate(I);if(x&&this.hasUntypedArgument){var Y=zn(D),ee=zn(H);if(Y.kind!==ee.kind||Y.kind!=="string"&&Y.kind!=="number")throw new zo('Expected arguments for "'+a+'" to be (string, string) or (number, number), but found ('+Y.kind+", "+ee.kind+") instead.")}if(this.collator&&!x&&this.hasUntypedArgument){var ie=zn(D),se=zn(H);if(ie.kind!=="string"||se.kind!=="string")return c(I,D,H)}return this.collator?f(I,D,H,this.collator.evaluate(I)):c(I,D,H)},S.prototype.eachChild=function(I){I(this.lhs),I(this.rhs),this.collator&&I(this.collator)},S.prototype.outputDefined=function(){return!0},S.prototype.serialize=function(){var I=[a];return this.eachChild(function(D){I.push(D.serialize())}),I},S}()}ct.parse=function(a,c){if(a.length<=2||a.length>=5)return c.error("Expected 3 or 4 arguments, but found "+(a.length-1)+" instead.");var f=c.parse(a[1],1,pr),x=c.parse(a[2],2,Ot);if(!f||!x)return null;if(!Ln(f.type,[Qi(pr),br,pr]))return c.error("Expected first argument to be of type array or string, but found "+Li(f.type)+" instead");if(a.length===4){var S=c.parse(a[3],3,Ot);return S?new ct(f.type,f,x,S):null}return new ct(f.type,f,x)},ct.prototype.evaluate=function(a){var c=this.input.evaluate(a),f=this.beginIndex.evaluate(a);if(!en(c,["string","array"]))throw new zo("Expected first argument to be of type array or string, but found "+Li(zn(c))+" instead.");if(this.endIndex){var x=this.endIndex.evaluate(a);return c.slice(f,x)}return c.slice(f)},ct.prototype.eachChild=function(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)},ct.prototype.outputDefined=function(){return!1},ct.prototype.serialize=function(){if(this.endIndex!=null&&this.endIndex!==void 0){var a=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),a]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var fr=dt("==",function(a,c,f){return c===f},jt),mi=dt("!=",function(a,c,f){return c!==f},function(a,c,f,x){return!jt(0,c,f,x)}),ut=dt("<",function(a,c,f){return c<f},function(a,c,f,x){return x.compare(c,f)<0}),St=dt(">",function(a,c,f){return c>f},function(a,c,f,x){return x.compare(c,f)>0}),cr=dt("<=",function(a,c,f){return c<=f},function(a,c,f,x){return x.compare(c,f)<=0}),Xr=dt(">=",function(a,c,f){return c>=f},function(a,c,f,x){return x.compare(c,f)>=0}),g=function(a,c,f,x,S){this.type=br,this.number=a,this.locale=c,this.currency=f,this.minFractionDigits=x,this.maxFractionDigits=S};g.parse=function(a,c){if(a.length!==3)return c.error("Expected two arguments.");var f=c.parse(a[1],1,Ot);if(!f)return null;var x=a[2];if(typeof x!="object"||Array.isArray(x))return c.error("NumberFormat options argument must be an object.");var S=null;if(x.locale&&!(S=c.parse(x.locale,1,br)))return null;var I=null;if(x.currency&&!(I=c.parse(x.currency,1,br)))return null;var D=null;if(x["min-fraction-digits"]&&!(D=c.parse(x["min-fraction-digits"],1,Ot)))return null;var H=null;return x["max-fraction-digits"]&&!(H=c.parse(x["max-fraction-digits"],1,Ot))?null:new g(f,S,I,D,H)},g.prototype.evaluate=function(a){return new Intl.NumberFormat(this.locale?this.locale.evaluate(a):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(a):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(a):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(a):void 0}).format(this.number.evaluate(a))},g.prototype.eachChild=function(a){a(this.number),this.locale&&a(this.locale),this.currency&&a(this.currency),this.minFractionDigits&&a(this.minFractionDigits),this.maxFractionDigits&&a(this.maxFractionDigits)},g.prototype.outputDefined=function(){return!1},g.prototype.serialize=function(){var a={};return this.locale&&(a.locale=this.locale.serialize()),this.currency&&(a.currency=this.currency.serialize()),this.minFractionDigits&&(a["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(a["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),a]};var ki=function(a){this.type=Ot,this.input=a};ki.parse=function(a,c){if(a.length!==2)return c.error("Expected 1 argument, but found "+(a.length-1)+" instead.");var f=c.parse(a[1],1);return f?f.type.kind!=="array"&&f.type.kind!=="string"&&f.type.kind!=="value"?c.error("Expected argument of type string or array, but found "+Li(f.type)+" instead."):new ki(f):null},ki.prototype.evaluate=function(a){var c=this.input.evaluate(a);if(typeof c=="string"||Array.isArray(c))return c.length;throw new zo("Expected value to be of type string or array, but found "+Li(zn(c))+" instead.")},ki.prototype.eachChild=function(a){a(this.input)},ki.prototype.outputDefined=function(){return!1},ki.prototype.serialize=function(){var a=["length"];return this.eachChild(function(c){a.push(c.serialize())}),a};var Wr={"==":fr,"!=":mi,">":St,"<":ut,">=":Xr,"<=":cr,array:pn,at:le,boolean:pn,case:qe,coalesce:G,collator:Be,format:$s,image:Vs,in:ce,"index-of":_e,interpolate:P,"interpolate-hcl":P,"interpolate-lab":P,length:ki,let:Q,literal:cs,match:Qe,number:pn,"number-format":g,object:pn,slice:ct,step:fa,string:pn,"to-boolean":ua,"to-color":ua,"to-number":ua,"to-string":ua,var:Uc,within:ul};function Re(a,c){var f=c[0],x=c[1],S=c[2],I=c[3];f=f.evaluate(a),x=x.evaluate(a),S=S.evaluate(a);var D=I?I.evaluate(a):1,H=zs(f,x,S,D);if(H)throw new zo(H);return new Oi(f/255*D,x/255*D,S/255*D,D)}function Ti(a,c){return a in c}function An(a,c){var f=c[a];return f===void 0?null:f}function Qn(a){return{type:a}}function En(a){return{result:"success",value:a}}function ln(a){return{result:"error",value:a}}function $n(a){return a["property-type"]==="data-driven"||a["property-type"]==="cross-faded-data-driven"}function ji(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")>-1}function Gi(a){return!!a.expression&&a.expression.interpolated}function an(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":a===null?"null":typeof a}function ea(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function Yh(a){return a}function Hs(a,c,f){return a!==void 0?a:c!==void 0?c:f!==void 0?f:void 0}function Ko(a,c,f,x,S){return Hs(typeof f===S?x[f]:void 0,a.default,c.default)}function fu(a,c,f){if(an(f)!=="number")return Hs(a.default,c.default);var x=a.stops.length;if(x===1||f<=a.stops[0][0])return a.stops[0][1];if(f>=a.stops[x-1][0])return a.stops[x-1][1];var S=qh(a.stops.map(function(I){return I[0]}),f);return a.stops[S][1]}function fl(a,c,f){var x=a.base!==void 0?a.base:1;if(an(f)!=="number")return Hs(a.default,c.default);var S=a.stops.length;if(S===1||f<=a.stops[0][0])return a.stops[0][1];if(f>=a.stops[S-1][0])return a.stops[S-1][1];var I=qh(a.stops.map(function(se){return se[0]}),f),D=function(se,Ae,Te,ke){var Ve=ke-Te,et=se-Te;return Ve===0?0:Ae===1?et/Ve:(Math.pow(Ae,et)-1)/(Math.pow(Ae,Ve)-1)}(f,x,a.stops[I][0],a.stops[I+1][0]),H=a.stops[I][1],Y=a.stops[I+1][1],ee=uu[c.type]||Yh;if(a.colorSpace&&a.colorSpace!=="rgb"){var ie=DA[a.colorSpace];ee=function(se,Ae){return ie.reverse(ie.interpolate(ie.forward(se),ie.forward(Ae),D))}}return typeof H.evaluate=="function"?{evaluate:function(){for(var se=[],Ae=arguments.length;Ae--;)se[Ae]=arguments[Ae];var Te=H.evaluate.apply(void 0,se),ke=Y.evaluate.apply(void 0,se);if(Te!==void 0&&ke!==void 0)return ee(Te,ke,D)}}:ee(H,Y,D)}function hu(a,c,f){return c.type==="color"?f=Oi.parse(f):c.type==="formatted"?f=ko.fromString(f.toString()):c.type==="resolvedImage"?f=Yo.fromString(f.toString()):an(f)===c.type||c.type==="enum"&&c.values[f]||(f=void 0),Hs(f,a.default,c.default)}xe.register(Wr,{error:[{kind:"error"},[br],function(a,c){throw new zo(c[0].evaluate(a))}],typeof:[br,[pr],function(a,c){return Li(zn(c[0].evaluate(a)))}],"to-rgba":[Qi(Ot,4),[lr],function(a,c){return c[0].evaluate(a).toArray()}],rgb:[lr,[Ot,Ot,Ot],Re],rgba:[lr,[Ot,Ot,Ot,Ot],Re],has:{type:sr,overloads:[[[br],function(a,c){return Ti(c[0].evaluate(a),a.properties())}],[[br,bi],function(a,c){var f=c[1];return Ti(c[0].evaluate(a),f.evaluate(a))}]]},get:{type:pr,overloads:[[[br],function(a,c){return An(c[0].evaluate(a),a.properties())}],[[br,bi],function(a,c){var f=c[1];return An(c[0].evaluate(a),f.evaluate(a))}]]},"feature-state":[pr,[br],function(a,c){return An(c[0].evaluate(a),a.featureState||{})}],properties:[bi,[],function(a){return a.properties()}],"geometry-type":[br,[],function(a){return a.geometryType()}],id:[pr,[],function(a){return a.id()}],zoom:[Ot,[],function(a){return a.globals.zoom}],"heatmap-density":[Ot,[],function(a){return a.globals.heatmapDensity||0}],"line-progress":[Ot,[],function(a){return a.globals.lineProgress||0}],accumulated:[pr,[],function(a){return a.globals.accumulated===void 0?null:a.globals.accumulated}],"+":[Ot,Qn(Ot),function(a,c){for(var f=0,x=0,S=c;x<S.length;x+=1)f+=S[x].evaluate(a);return f}],"*":[Ot,Qn(Ot),function(a,c){for(var f=1,x=0,S=c;x<S.length;x+=1)f*=S[x].evaluate(a);return f}],"-":{type:Ot,overloads:[[[Ot,Ot],function(a,c){var f=c[1];return c[0].evaluate(a)-f.evaluate(a)}],[[Ot],function(a,c){return-c[0].evaluate(a)}]]},"/":[Ot,[Ot,Ot],function(a,c){var f=c[1];return c[0].evaluate(a)/f.evaluate(a)}],"%":[Ot,[Ot,Ot],function(a,c){var f=c[1];return c[0].evaluate(a)%f.evaluate(a)}],ln2:[Ot,[],function(){return Math.LN2}],pi:[Ot,[],function(){return Math.PI}],e:[Ot,[],function(){return Math.E}],"^":[Ot,[Ot,Ot],function(a,c){var f=c[1];return Math.pow(c[0].evaluate(a),f.evaluate(a))}],sqrt:[Ot,[Ot],function(a,c){return Math.sqrt(c[0].evaluate(a))}],log10:[Ot,[Ot],function(a,c){return Math.log(c[0].evaluate(a))/Math.LN10}],ln:[Ot,[Ot],function(a,c){return Math.log(c[0].evaluate(a))}],log2:[Ot,[Ot],function(a,c){return Math.log(c[0].evaluate(a))/Math.LN2}],sin:[Ot,[Ot],function(a,c){return Math.sin(c[0].evaluate(a))}],cos:[Ot,[Ot],function(a,c){return Math.cos(c[0].evaluate(a))}],tan:[Ot,[Ot],function(a,c){return Math.tan(c[0].evaluate(a))}],asin:[Ot,[Ot],function(a,c){return Math.asin(c[0].evaluate(a))}],acos:[Ot,[Ot],function(a,c){return Math.acos(c[0].evaluate(a))}],atan:[Ot,[Ot],function(a,c){return Math.atan(c[0].evaluate(a))}],min:[Ot,Qn(Ot),function(a,c){return Math.min.apply(Math,c.map(function(f){return f.evaluate(a)}))}],max:[Ot,Qn(Ot),function(a,c){return Math.max.apply(Math,c.map(function(f){return f.evaluate(a)}))}],abs:[Ot,[Ot],function(a,c){return Math.abs(c[0].evaluate(a))}],round:[Ot,[Ot],function(a,c){var f=c[0].evaluate(a);return f<0?-Math.round(-f):Math.round(f)}],floor:[Ot,[Ot],function(a,c){return Math.floor(c[0].evaluate(a))}],ceil:[Ot,[Ot],function(a,c){return Math.ceil(c[0].evaluate(a))}],"filter-==":[sr,[br,pr],function(a,c){var f=c[0],x=c[1];return a.properties()[f.value]===x.value}],"filter-id-==":[sr,[pr],function(a,c){var f=c[0];return a.id()===f.value}],"filter-type-==":[sr,[br],function(a,c){var f=c[0];return a.geometryType()===f.value}],"filter-<":[sr,[br,pr],function(a,c){var f=c[0],x=c[1],S=a.properties()[f.value],I=x.value;return typeof S==typeof I&&S<I}],"filter-id-<":[sr,[pr],function(a,c){var f=c[0],x=a.id(),S=f.value;return typeof x==typeof S&&x<S}],"filter->":[sr,[br,pr],function(a,c){var f=c[0],x=c[1],S=a.properties()[f.value],I=x.value;return typeof S==typeof I&&S>I}],"filter-id->":[sr,[pr],function(a,c){var f=c[0],x=a.id(),S=f.value;return typeof x==typeof S&&x>S}],"filter-<=":[sr,[br,pr],function(a,c){var f=c[0],x=c[1],S=a.properties()[f.value],I=x.value;return typeof S==typeof I&&S<=I}],"filter-id-<=":[sr,[pr],function(a,c){var f=c[0],x=a.id(),S=f.value;return typeof x==typeof S&&x<=S}],"filter->=":[sr,[br,pr],function(a,c){var f=c[0],x=c[1],S=a.properties()[f.value],I=x.value;return typeof S==typeof I&&S>=I}],"filter-id->=":[sr,[pr],function(a,c){var f=c[0],x=a.id(),S=f.value;return typeof x==typeof S&&x>=S}],"filter-has":[sr,[pr],function(a,c){return c[0].value in a.properties()}],"filter-has-id":[sr,[],function(a){return a.id()!==null&&a.id()!==void 0}],"filter-type-in":[sr,[Qi(br)],function(a,c){return c[0].value.indexOf(a.geometryType())>=0}],"filter-id-in":[sr,[Qi(pr)],function(a,c){return c[0].value.indexOf(a.id())>=0}],"filter-in-small":[sr,[br,Qi(pr)],function(a,c){var f=c[0];return c[1].value.indexOf(a.properties()[f.value])>=0}],"filter-in-large":[sr,[br,Qi(pr)],function(a,c){var f=c[0],x=c[1];return function(S,I,D,H){for(;D<=H;){var Y=D+H>>1;if(I[Y]===S)return!0;I[Y]>S?H=Y-1:D=Y+1}return!1}(a.properties()[f.value],x.value,0,x.value.length-1)}],all:{type:sr,overloads:[[[sr,sr],function(a,c){var f=c[1];return c[0].evaluate(a)&&f.evaluate(a)}],[Qn(sr),function(a,c){for(var f=0,x=c;f<x.length;f+=1)if(!x[f].evaluate(a))return!1;return!0}]]},any:{type:sr,overloads:[[[sr,sr],function(a,c){var f=c[1];return c[0].evaluate(a)||f.evaluate(a)}],[Qn(sr),function(a,c){for(var f=0,x=c;f<x.length;f+=1)if(x[f].evaluate(a))return!0;return!1}]]},"!":[sr,[sr],function(a,c){return!c[0].evaluate(a)}],"is-supported-script":[sr,[br],function(a,c){var f=a.globals&&a.globals.isSupportedScript;return!f||f(c[0].evaluate(a))}],upcase:[br,[br],function(a,c){return c[0].evaluate(a).toUpperCase()}],downcase:[br,[br],function(a,c){return c[0].evaluate(a).toLowerCase()}],concat:[br,Qn(pr),function(a,c){return c.map(function(f){return ll(f.evaluate(a))}).join("")}],"resolved-locale":[br,[Ii],function(a,c){return c[0].evaluate(a).resolvedLocale()}]});var Sn=function(a,c){this.expression=a,this._warningHistory={},this._evaluator=new cl,this._defaultValue=c?function(f){return f.type==="color"&&ea(f.default)?new Oi(0,0,0,0):f.type==="color"?Oi.parse(f.default)||null:f.default===void 0?null:f.default}(c):null,this._enumValues=c&&c.type==="enum"?c.values:null};function ha(a){return Array.isArray(a)&&a.length>0&&typeof a[0]=="string"&&a[0]in Wr}function gi(a,c){var f=new zc(Wr,[],c?function(S){var I={color:lr,string:br,number:Ot,enum:br,boolean:sr,formatted:vn,resolvedImage:Di};return S.type==="array"?Qi(I[S.value]||pr,S.length):I[S.type]}(c):void 0),x=f.parse(a,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return x?En(new Sn(x,c)):ln(f.errors)}Sn.prototype.evaluateWithoutErrorHandling=function(a,c,f,x,S,I){return this._evaluator.globals=a,this._evaluator.feature=c,this._evaluator.featureState=f,this._evaluator.canonical=x,this._evaluator.availableImages=S||null,this._evaluator.formattedSection=I,this.expression.evaluate(this._evaluator)},Sn.prototype.evaluate=function(a,c,f,x,S,I){this._evaluator.globals=a,this._evaluator.feature=c||null,this._evaluator.featureState=f||null,this._evaluator.canonical=x,this._evaluator.availableImages=S||null,this._evaluator.formattedSection=I||null;try{var D=this.expression.evaluate(this._evaluator);if(D==null||typeof D=="number"&&D!=D)return this._defaultValue;if(this._enumValues&&!(D in this._enumValues))throw new zo("Expected value to be one of "+Object.keys(this._enumValues).map(function(H){return JSON.stringify(H)}).join(", ")+", but found "+JSON.stringify(D)+" instead.");return D}catch(H){return this._warningHistory[H.message]||(this._warningHistory[H.message]=!0,typeof console<"u"&&console.warn(H.message)),this._defaultValue}};var Fe=function(a,c){this.kind=a,this._styleExpression=c,this.isStateDependent=a!=="constant"&&!kc(c.expression)};Fe.prototype.evaluateWithoutErrorHandling=function(a,c,f,x,S,I){return this._styleExpression.evaluateWithoutErrorHandling(a,c,f,x,S,I)},Fe.prototype.evaluate=function(a,c,f,x,S,I){return this._styleExpression.evaluate(a,c,f,x,S,I)};var _i=function(a,c,f,x){this.kind=a,this.zoomStops=f,this._styleExpression=c,this.isStateDependent=a!=="camera"&&!kc(c.expression),this.interpolationType=x};function Kh(a,c){if((a=gi(a,c)).result==="error")return a;var f=a.value.expression,x=Nc(f);if(!x&&!$n(c))return ln([new Xt("","data expressions not supported")]);var S=cu(f,["zoom"]);if(!S&&!ji(c))return ln([new Xt("","zoom expressions not supported")]);var I=function D(H){var Y=null;if(H instanceof Q)Y=D(H.result);else if(H instanceof G)for(var ee=0,ie=H.args;ee<ie.length&&!(Y=D(ie[ee]));ee+=1);else(H instanceof fa||H instanceof P)&&H.input instanceof xe&&H.input.name==="zoom"&&(Y=H);return Y instanceof Xt||H.eachChild(function(se){var Ae=D(se);Ae instanceof Xt?Y=Ae:!Y&&Ae?Y=new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):Y&&Ae&&Y!==Ae&&(Y=new Xt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),Y}(f);return I||S?I instanceof Xt?ln([I]):I instanceof P&&!Gi(c)?ln([new Xt("",'"interpolate" expressions cannot be used with this property')]):En(I?new _i(x?"camera":"composite",a.value,I.labels,I instanceof P?I.interpolation:void 0):new Fe(x?"constant":"source",a.value)):ln([new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}_i.prototype.evaluateWithoutErrorHandling=function(a,c,f,x,S,I){return this._styleExpression.evaluateWithoutErrorHandling(a,c,f,x,S,I)},_i.prototype.evaluate=function(a,c,f,x,S,I){return this._styleExpression.evaluate(a,c,f,x,S,I)},_i.prototype.interpolationFactor=function(a,c,f){return this.interpolationType?P.interpolationFactor(this.interpolationType,a,c,f):0};var Vc=function(a,c){this._parameters=a,this._specification=c,Ht(this,function f(x,S){var I,D,H,Y=S.type==="color",ee=x.stops&&typeof x.stops[0][0]=="object",ie=ee||!(ee||x.property!==void 0),se=x.type||(Gi(S)?"exponential":"interval");if(Y&&((x=Ht({},x)).stops&&(x.stops=x.stops.map(function(Cr){return[Cr[0],Oi.parse(Cr[1])]})),x.default=Oi.parse(x.default?x.default:S.default)),x.colorSpace&&x.colorSpace!=="rgb"&&!DA[x.colorSpace])throw new Error("Unknown color space: "+x.colorSpace);if(se==="exponential")I=fl;else if(se==="interval")I=fu;else if(se==="categorical"){I=Ko,D=Object.create(null);for(var Ae=0,Te=x.stops;Ae<Te.length;Ae+=1){var ke=Te[Ae];D[ke[0]]=ke[1]}H=typeof x.stops[0][0]}else{if(se!=="identity")throw new Error('Unknown function type "'+se+'"');I=hu}if(ee){for(var Ve={},et=[],Xe=0;Xe<x.stops.length;Xe++){var at=x.stops[Xe],_t=at[0].zoom;Ve[_t]===void 0&&(Ve[_t]={zoom:_t,type:x.type,property:x.property,default:x.default,stops:[]},et.push(_t)),Ve[_t].stops.push([at[0].value,at[1]])}for(var bt=[],Mt=0,Ut=et;Mt<Ut.length;Mt+=1){var $t=Ut[Mt];bt.push([Ve[$t].zoom,f(Ve[$t],S)])}var Ar={name:"linear"};return{kind:"composite",interpolationType:Ar,interpolationFactor:P.interpolationFactor.bind(void 0,Ar),zoomStops:bt.map(function(Cr){return Cr[0]}),evaluate:function(Cr,ni){var Pr=Cr.zoom;return fl({stops:bt,base:x.base},S,Pr).evaluate(Pr,ni)}}}if(ie){var Qr=se==="exponential"?{name:"exponential",base:x.base!==void 0?x.base:1}:null;return{kind:"camera",interpolationType:Qr,interpolationFactor:P.interpolationFactor.bind(void 0,Qr),zoomStops:x.stops.map(function(Cr){return Cr[0]}),evaluate:function(Cr){return I(x,S,Cr.zoom,D,H)}}}return{kind:"source",evaluate:function(Cr,ni){var Pr=ni&&ni.properties?ni.properties[x.property]:void 0;return Pr===void 0?Hs(x.default,S.default):I(x,S,Pr,D,H)}}}(this._parameters,this._specification))};function Is(a){var c=a.key,f=a.value,x=a.valueSpec||{},S=a.objectElementValidators||{},I=a.style,D=a.styleSpec,H=[],Y=an(f);if(Y!=="object")return[new Ge(c,f,"object expected, "+Y+" found")];for(var ee in f){var ie=ee.split(".")[0],se=x[ie]||x["*"],Ae=void 0;if(S[ie])Ae=S[ie];else if(x[ie])Ae=vr;else if(S["*"])Ae=S["*"];else{if(!x["*"]){H.push(new Ge(c,f[ee],'unknown property "'+ee+'"'));continue}Ae=vr}H=H.concat(Ae({key:(c&&c+".")+ee,value:f[ee],valueSpec:se,style:I,styleSpec:D,object:f,objectKey:ee},f))}for(var Te in x)S[Te]||x[Te].required&&x[Te].default===void 0&&f[Te]===void 0&&H.push(new Ge(c,f,'missing required property "'+Te+'"'));return H}function Kf(a){var c=a.value,f=a.valueSpec,x=a.style,S=a.styleSpec,I=a.key,D=a.arrayElementValidator||vr;if(an(c)!=="array")return[new Ge(I,c,"array expected, "+an(c)+" found")];if(f.length&&c.length!==f.length)return[new Ge(I,c,"array length "+f.length+" expected, length "+c.length+" found")];if(f["min-length"]&&c.length<f["min-length"])return[new Ge(I,c,"array length at least "+f["min-length"]+" expected, length "+c.length+" found")];var H={type:f.value,values:f.values};S.$version<7&&(H.function=f.function),an(f.value)==="object"&&(H=f.value);for(var Y=[],ee=0;ee<c.length;ee++)Y=Y.concat(D({array:c,arrayIndex:ee,value:c[ee],valueSpec:H,style:x,styleSpec:S,key:I+"["+ee+"]"}));return Y}function Xl(a){var c=a.key,f=a.value,x=a.valueSpec,S=an(f);return S==="number"&&f!=f&&(S="NaN"),S!=="number"?[new Ge(c,f,"number expected, "+S+" found")]:"minimum"in x&&f<x.minimum?[new Ge(c,f,f+" is less than the minimum value "+x.minimum)]:"maximum"in x&&f>x.maximum?[new Ge(c,f,f+" is greater than the maximum value "+x.maximum)]:[]}function Ie(a){var c,f,x,S=a.valueSpec,I=Zt(a.value.type),D={},H=I!=="categorical"&&a.value.property===void 0,Y=!H,ee=an(a.value.stops)==="array"&&an(a.value.stops[0])==="array"&&an(a.value.stops[0][0])==="object",ie=Is({key:a.key,value:a.value,valueSpec:a.styleSpec.function,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(Te){if(I==="identity")return[new Ge(Te.key,Te.value,'identity function may not have a "stops" property')];var ke=[],Ve=Te.value;return ke=ke.concat(Kf({key:Te.key,value:Ve,valueSpec:Te.valueSpec,style:Te.style,styleSpec:Te.styleSpec,arrayElementValidator:se})),an(Ve)==="array"&&Ve.length===0&&ke.push(new Ge(Te.key,Ve,"array must have at least one stop")),ke},default:function(Te){return vr({key:Te.key,value:Te.value,valueSpec:S,style:Te.style,styleSpec:Te.styleSpec})}}});return I==="identity"&&H&&ie.push(new Ge(a.key,a.value,'missing required property "property"')),I==="identity"||a.value.stops||ie.push(new Ge(a.key,a.value,'missing required property "stops"')),I==="exponential"&&a.valueSpec.expression&&!Gi(a.valueSpec)&&ie.push(new Ge(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(Y&&!$n(a.valueSpec)?ie.push(new Ge(a.key,a.value,"property functions not supported")):H&&!ji(a.valueSpec)&&ie.push(new Ge(a.key,a.value,"zoom functions not supported"))),I!=="categorical"&&!ee||a.value.property!==void 0||ie.push(new Ge(a.key,a.value,'"property" property is required')),ie;function se(Te){var ke=[],Ve=Te.value,et=Te.key;if(an(Ve)!=="array")return[new Ge(et,Ve,"array expected, "+an(Ve)+" found")];if(Ve.length!==2)return[new Ge(et,Ve,"array length 2 expected, length "+Ve.length+" found")];if(ee){if(an(Ve[0])!=="object")return[new Ge(et,Ve,"object expected, "+an(Ve[0])+" found")];if(Ve[0].zoom===void 0)return[new Ge(et,Ve,"object stop key must have zoom")];if(Ve[0].value===void 0)return[new Ge(et,Ve,"object stop key must have value")];if(x&&x>Zt(Ve[0].zoom))return[new Ge(et,Ve[0].zoom,"stop zoom values must appear in ascending order")];Zt(Ve[0].zoom)!==x&&(x=Zt(Ve[0].zoom),f=void 0,D={}),ke=ke.concat(Is({key:et+"[0]",value:Ve[0],valueSpec:{zoom:{}},style:Te.style,styleSpec:Te.styleSpec,objectElementValidators:{zoom:Xl,value:Ae}}))}else ke=ke.concat(Ae({key:et+"[0]",value:Ve[0],valueSpec:{},style:Te.style,styleSpec:Te.styleSpec},Ve));return ha(Pt(Ve[1]))?ke.concat([new Ge(et+"[1]",Ve[1],"expressions are not allowed in function stops.")]):ke.concat(vr({key:et+"[1]",value:Ve[1],valueSpec:S,style:Te.style,styleSpec:Te.styleSpec}))}function Ae(Te,ke){var Ve=an(Te.value),et=Zt(Te.value),Xe=Te.value!==null?Te.value:ke;if(c){if(Ve!==c)return[new Ge(Te.key,Xe,Ve+" stop domain type must match previous stop domain type "+c)]}else c=Ve;if(Ve!=="number"&&Ve!=="string"&&Ve!=="boolean")return[new Ge(Te.key,Xe,"stop domain value must be a number, string, or boolean")];if(Ve!=="number"&&I!=="categorical"){var at="number expected, "+Ve+" found";return $n(S)&&I===void 0&&(at+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ge(Te.key,Xe,at)]}return I!=="categorical"||Ve!=="number"||isFinite(et)&&Math.floor(et)===et?I!=="categorical"&&Ve==="number"&&f!==void 0&&et<f?[new Ge(Te.key,Xe,"stop domain values must appear in ascending order")]:(f=et,I==="categorical"&&et in D?[new Ge(Te.key,Xe,"stop domain values must be unique")]:(D[et]=!0,[])):[new Ge(Te.key,Xe,"integer expected, found "+et)]}}function hl(a){var c=(a.expressionContext==="property"?Kh:gi)(Pt(a.value),a.valueSpec);if(c.result==="error")return c.value.map(function(x){return new Ge(""+a.key+x.key,a.value,x.message)});var f=c.value.expression||c.value._styleExpression.expression;if(a.expressionContext==="property"&&a.propertyKey==="text-font"&&!f.outputDefined())return[new Ge(a.key,a.value,'Invalid data expression for "'+a.propertyKey+'". Output values must be contained as literals within the expression.')];if(a.expressionContext==="property"&&a.propertyType==="layout"&&!kc(f))return[new Ge(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.')];if(a.expressionContext==="filter"&&!kc(f))return[new Ge(a.key,a.value,'"feature-state" data expressions are not supported with filters.')];if(a.expressionContext&&a.expressionContext.indexOf("cluster")===0){if(!cu(f,["zoom","feature-state"]))return[new Ge(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(a.expressionContext==="cluster-initial"&&!Nc(f))return[new Ge(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function hc(a){var c=a.key,f=a.value,x=a.valueSpec,S=[];return Array.isArray(x.values)?x.values.indexOf(Zt(f))===-1&&S.push(new Ge(c,f,"expected one of ["+x.values.join(", ")+"], "+JSON.stringify(f)+" found")):Object.keys(x.values).indexOf(Zt(f))===-1&&S.push(new Ge(c,f,"expected one of ["+Object.keys(x.values).join(", ")+"], "+JSON.stringify(f)+" found")),S}function Hc(a){if(a===!0||a===!1)return!0;if(!Array.isArray(a)||a.length===0)return!1;switch(a[0]){case"has":return a.length>=2&&a[1]!=="$id"&&a[1]!=="$type";case"in":return a.length>=3&&(typeof a[1]!="string"||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return a.length!==3||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(var c=0,f=a.slice(1);c<f.length;c+=1){var x=f[c];if(!Hc(x)&&typeof x!="boolean")return!1}return!0;default:return!0}}Vc.deserialize=function(a){return new Vc(a._parameters,a._specification)},Vc.serialize=function(a){return{_parameters:a._parameters,_specification:a._specification}};var rf={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Zf(a){if(a==null)return{filter:function(){return!0},needGeometry:!1};Hc(a)||(a=jc(a));var c=gi(a,rf);if(c.result==="error")throw new Error(c.value.map(function(f){return f.key+": "+f.message}).join(", "));return{filter:function(f,x,S){return c.value.evaluate(f,x,{},S)},needGeometry:function f(x){if(!Array.isArray(x))return!1;if(x[0]==="within")return!0;for(var S=1;S<x.length;S++)if(f(x[S]))return!0;return!1}(a)}}function Jf(a,c){return a<c?-1:a>c?1:0}function jc(a){if(!a)return!0;var c,f=a[0];return a.length<=1?f!=="any":f==="=="?du(a[1],a[2],"=="):f==="!="?Vo(du(a[1],a[2],"==")):f==="<"||f===">"||f==="<="||f===">="?du(a[1],a[2],f):f==="any"?(c=a.slice(1),["any"].concat(c.map(jc))):f==="all"?["all"].concat(a.slice(1).map(jc)):f==="none"?["all"].concat(a.slice(1).map(jc).map(Vo)):f==="in"?Zh(a[1],a.slice(2)):f==="!in"?Vo(Zh(a[1],a.slice(2))):f==="has"?za(a[1]):f==="!has"?Vo(za(a[1])):f!=="within"||a}function du(a,c,f){switch(a){case"$type":return["filter-type-"+f,c];case"$id":return["filter-id-"+f,c];default:return["filter-"+f,a,c]}}function Zh(a,c){if(c.length===0)return!1;switch(a){case"$type":return["filter-type-in",["literal",c]];case"$id":return["filter-id-in",["literal",c]];default:return c.length>200&&!c.some(function(f){return typeof f!=typeof c[0]})?["filter-in-large",a,["literal",c.sort(Jf)]]:["filter-in-small",a,["literal",c]]}}function za(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function Vo(a){return["!",a]}function ze(a){return Hc(Pt(a.value))?hl(Ht({},a,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function c(f){var x=f.value,S=f.key;if(an(x)!=="array")return[new Ge(S,x,"array expected, "+an(x)+" found")];var I,D=f.styleSpec,H=[];if(x.length<1)return[new Ge(S,x,"filter array must have at least 1 element")];switch(H=H.concat(hc({key:S+"[0]",value:x[0],valueSpec:D.filter_operator,style:f.style,styleSpec:f.styleSpec})),Zt(x[0])){case"<":case"<=":case">":case">=":x.length>=2&&Zt(x[1])==="$type"&&H.push(new Ge(S,x,'"$type" cannot be use with operator "'+x[0]+'"'));case"==":case"!=":x.length!==3&&H.push(new Ge(S,x,'filter array for operator "'+x[0]+'" must have 3 elements'));case"in":case"!in":x.length>=2&&(I=an(x[1]))!=="string"&&H.push(new Ge(S+"[1]",x[1],"string expected, "+I+" found"));for(var Y=2;Y<x.length;Y++)I=an(x[Y]),Zt(x[1])==="$type"?H=H.concat(hc({key:S+"["+Y+"]",value:x[Y],valueSpec:D.geometry_type,style:f.style,styleSpec:f.styleSpec})):I!=="string"&&I!=="number"&&I!=="boolean"&&H.push(new Ge(S+"["+Y+"]",x[Y],"string, number, or boolean expected, "+I+" found"));break;case"any":case"all":case"none":for(var ee=1;ee<x.length;ee++)H=H.concat(c({key:S+"["+ee+"]",value:x[ee],style:f.style,styleSpec:f.styleSpec}));break;case"has":case"!has":I=an(x[1]),x.length!==2?H.push(new Ge(S,x,'filter array for "'+x[0]+'" operator must have 2 elements')):I!=="string"&&H.push(new Ge(S+"[1]",x[1],"string expected, "+I+" found"));break;case"within":I=an(x[1]),x.length!==2?H.push(new Ge(S,x,'filter array for "'+x[0]+'" operator must have 2 elements')):I!=="object"&&H.push(new Ge(S+"[1]",x[1],"object expected, "+I+" found"))}return H}(a)}function st(a,c){var f=a.key,x=a.style,S=a.styleSpec,I=a.value,D=a.objectKey,H=S[c+"_"+a.layerType];if(!H)return[];var Y=D.match(/^(.*)-transition$/);if(c==="paint"&&Y&&H[Y[1]]&&H[Y[1]].transition)return vr({key:f,value:I,valueSpec:S.transition,style:x,styleSpec:S});var ee,ie=a.valueSpec||H[D];if(!ie)return[new Ge(f,I,'unknown property "'+D+'"')];if(an(I)==="string"&&$n(ie)&&!ie.tokens&&(ee=/^{([^}]+)}$/.exec(I)))return[new Ge(f,I,'"'+D+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(ee[1])+" }`.")];var se=[];return a.layerType==="symbol"&&(D==="text-field"&&x&&!x.glyphs&&se.push(new Ge(f,I,'use of "text-field" requires a style "glyphs" property')),D==="text-font"&&ea(Pt(I))&&Zt(I.type)==="identity"&&se.push(new Ge(f,I,'"text-font" does not support identity functions'))),se.concat(vr({key:a.key,value:I,valueSpec:ie,style:x,styleSpec:S,expressionContext:"property",propertyType:c,propertyKey:D}))}function Tt(a){return st(a,"paint")}function Lt(a){return st(a,"layout")}function Gt(a){var c=[],f=a.value,x=a.key,S=a.style,I=a.styleSpec;f.type||f.ref||c.push(new Ge(x,f,'either "type" or "ref" is required'));var D,H=Zt(f.type),Y=Zt(f.ref);if(f.id)for(var ee=Zt(f.id),ie=0;ie<a.arrayIndex;ie++){var se=S.layers[ie];Zt(se.id)===ee&&c.push(new Ge(x,f.id,'duplicate layer id "'+f.id+'", previously used at line '+se.id.__line__))}if("ref"in f)["type","source","source-layer","filter","layout"].forEach(function(ke){ke in f&&c.push(new Ge(x,f[ke],'"'+ke+'" is prohibited for ref layers'))}),S.layers.forEach(function(ke){Zt(ke.id)===Y&&(D=ke)}),D?D.ref?c.push(new Ge(x,f.ref,"ref cannot reference another ref layer")):H=Zt(D.type):c.push(new Ge(x,f.ref,'ref layer "'+Y+'" not found'));else if(H!=="background")if(f.source){var Ae=S.sources&&S.sources[f.source],Te=Ae&&Zt(Ae.type);Ae?Te==="vector"&&H==="raster"?c.push(new Ge(x,f.source,'layer "'+f.id+'" requires a raster source')):Te==="raster"&&H!=="raster"?c.push(new Ge(x,f.source,'layer "'+f.id+'" requires a vector source')):Te!=="vector"||f["source-layer"]?Te==="raster-dem"&&H!=="hillshade"?c.push(new Ge(x,f.source,"raster-dem source can only be used with layer type 'hillshade'.")):H!=="line"||!f.paint||!f.paint["line-gradient"]||Te==="geojson"&&Ae.lineMetrics||c.push(new Ge(x,f,'layer "'+f.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):c.push(new Ge(x,f,'layer "'+f.id+'" must specify a "source-layer"')):c.push(new Ge(x,f.source,'source "'+f.source+'" not found'))}else c.push(new Ge(x,f,'missing required property "source"'));return c=c.concat(Is({key:x,value:f,valueSpec:I.layer,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return vr({key:x+".type",value:f.type,valueSpec:I.layer.type,style:a.style,styleSpec:a.styleSpec,object:f,objectKey:"type"})},filter:ze,layout:function(ke){return Is({layer:f,key:ke.key,value:ke.value,style:ke.style,styleSpec:ke.styleSpec,objectElementValidators:{"*":function(Ve){return Lt(Ht({layerType:H},Ve))}}})},paint:function(ke){return Is({layer:f,key:ke.key,value:ke.value,style:ke.style,styleSpec:ke.styleSpec,objectElementValidators:{"*":function(Ve){return Tt(Ht({layerType:H},Ve))}}})}}}))}function _r(a){var c=a.value,f=a.key,x=an(c);return x!=="string"?[new Ge(f,c,"string expected, "+x+" found")]:[]}var hr={promoteId:function(a){var c=a.key,f=a.value;if(an(f)==="string")return _r({key:c,value:f});var x=[];for(var S in f)x.push.apply(x,_r({key:c+"."+S,value:f[S]}));return x}};function yr(a){var c=a.value,f=a.key,x=a.styleSpec,S=a.style;if(!c.type)return[new Ge(f,c,'"type" is required')];var I,D=Zt(c.type);switch(D){case"vector":case"raster":case"raster-dem":return Is({key:f,value:c,valueSpec:x["source_"+D.replace("-","_")],style:a.style,styleSpec:x,objectElementValidators:hr});case"geojson":if(I=Is({key:f,value:c,valueSpec:x.source_geojson,style:S,styleSpec:x,objectElementValidators:hr}),c.cluster)for(var H in c.clusterProperties){var Y=c.clusterProperties[H],ee=Y[0],ie=typeof ee=="string"?[ee,["accumulated"],["get",H]]:ee;I.push.apply(I,hl({key:f+"."+H+".map",value:Y[1],expressionContext:"cluster-map"})),I.push.apply(I,hl({key:f+"."+H+".reduce",value:ie,expressionContext:"cluster-reduce"}))}return I;case"video":return Is({key:f,value:c,valueSpec:x.source_video,style:S,styleSpec:x});case"image":return Is({key:f,value:c,valueSpec:x.source_image,style:S,styleSpec:x});case"canvas":return[new Ge(f,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return hc({key:f+".type",value:c.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:S,styleSpec:x})}}function Lr(a){var c=a.value,f=a.styleSpec,x=f.light,S=a.style,I=[],D=an(c);if(c===void 0)return I;if(D!=="object")return I.concat([new Ge("light",c,"object expected, "+D+" found")]);for(var H in c){var Y=H.match(/^(.*)-transition$/);I=I.concat(Y&&x[Y[1]]&&x[Y[1]].transition?vr({key:H,value:c[H],valueSpec:f.transition,style:S,styleSpec:f}):x[H]?vr({key:H,value:c[H],valueSpec:x[H],style:S,styleSpec:f}):[new Ge(H,c[H],'unknown property "'+H+'"')])}return I}var Fi={"*":function(){return[]},array:Kf,boolean:function(a){var c=a.value,f=a.key,x=an(c);return x!=="boolean"?[new Ge(f,c,"boolean expected, "+x+" found")]:[]},number:Xl,color:function(a){var c=a.key,f=a.value,x=an(f);return x!=="string"?[new Ge(c,f,"color expected, "+x+" found")]:Si(f)===null?[new Ge(c,f,'color expected, "'+f+'" found')]:[]},constants:ht,enum:hc,filter:ze,function:Ie,layer:Gt,object:Is,source:yr,light:Lr,string:_r,formatted:function(a){return _r(a).length===0?[]:hl(a)},resolvedImage:function(a){return _r(a).length===0?[]:hl(a)}};function vr(a){var c=a.value,f=a.valueSpec,x=a.styleSpec;return f.expression&&ea(Zt(c))?Ie(a):f.expression&&ha(Pt(c))?hl(a):f.type&&Fi[f.type]?Fi[f.type](a):Is(Ht({},a,{valueSpec:f.type?x[f.type]:f}))}function jr(a){var c=a.value,f=a.key,x=_r(a);return x.length||(c.indexOf("{fontstack}")===-1&&x.push(new Ge(f,c,'"glyphs" url must include a "{fontstack}" token')),c.indexOf("{range}")===-1&&x.push(new Ge(f,c,'"glyphs" url must include a "{range}" token'))),x}function Ci(a,c){c===void 0&&(c=Se);var f=[];return f=f.concat(vr({key:"",value:a,valueSpec:c.$root,styleSpec:c,style:a,objectElementValidators:{glyphs:jr,"*":function(){return[]}}})),a.constants&&(f=f.concat(ht({key:"constants",value:a.constants,style:a,styleSpec:c}))),fi(f)}function fi(a){return[].concat(a).sort(function(c,f){return c.line-f.line})}function Mn(a){return function(){for(var c=[],f=arguments.length;f--;)c[f]=arguments[f];return fi(a.apply(this,c))}}Ci.source=Mn(yr),Ci.light=Mn(Lr),Ci.layer=Mn(Gt),Ci.filter=Mn(ze),Ci.paintProperty=Mn(Tt),Ci.layoutProperty=Mn(Lt);var rs=Ci,js=rs.light,Va=rs.paintProperty,ta=rs.layoutProperty;function dl(a,c){var f=!1;if(c&&c.length)for(var x=0,S=c;x<S.length;x+=1)a.fire(new tt(new Error(S[x].message))),f=!0;return f}var vo=us;function us(a,c,f){var x=this.cells=[];if(a instanceof ArrayBuffer){this.arrayBuffer=a;var S=new Int32Array(this.arrayBuffer);a=S[0],this.d=(c=S[1])+2*(f=S[2]);for(var I=0;I<this.d*this.d;I++){var D=S[3+I],H=S[3+I+1];x.push(D===H?null:S.subarray(D,H))}var Y=S[3+x.length+1];this.keys=S.subarray(S[3+x.length],Y),this.bboxes=S.subarray(Y),this.insert=this._insertReadonly}else{this.d=c+2*f;for(var ee=0;ee<this.d*this.d;ee++)x.push([]);this.keys=[],this.bboxes=[]}this.n=c,this.extent=a,this.padding=f,this.scale=c/a,this.uid=0;var ie=f/c*a;this.min=-ie,this.max=a+ie}us.prototype.insert=function(a,c,f,x,S){this._forEachCell(c,f,x,S,this._insertCell,this.uid++),this.keys.push(a),this.bboxes.push(c),this.bboxes.push(f),this.bboxes.push(x),this.bboxes.push(S)},us.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},us.prototype._insertCell=function(a,c,f,x,S,I){this.cells[S].push(I)},us.prototype.query=function(a,c,f,x,S){var I=this.min,D=this.max;if(a<=I&&c<=I&&D<=f&&D<=x&&!S)return Array.prototype.slice.call(this.keys);var H=[];return this._forEachCell(a,c,f,x,this._queryCell,H,{},S),H},us.prototype._queryCell=function(a,c,f,x,S,I,D,H){var Y=this.cells[S];if(Y!==null)for(var ee=this.keys,ie=this.bboxes,se=0;se<Y.length;se++){var Ae=Y[se];if(D[Ae]===void 0){var Te=4*Ae;(H?H(ie[Te+0],ie[Te+1],ie[Te+2],ie[Te+3]):a<=ie[Te+2]&&c<=ie[Te+3]&&f>=ie[Te+0]&&x>=ie[Te+1])?(D[Ae]=!0,I.push(ee[Ae])):D[Ae]=!1}}},us.prototype._forEachCell=function(a,c,f,x,S,I,D,H){for(var Y=this._convertToCellCoord(a),ee=this._convertToCellCoord(c),ie=this._convertToCellCoord(f),se=this._convertToCellCoord(x),Ae=Y;Ae<=ie;Ae++)for(var Te=ee;Te<=se;Te++){var ke=this.d*Te+Ae;if((!H||H(this._convertFromCellCoord(Ae),this._convertFromCellCoord(Te),this._convertFromCellCoord(Ae+1),this._convertFromCellCoord(Te+1)))&&S.call(this,a,c,f,x,ke,I,D,H))return}},us.prototype._convertFromCellCoord=function(a){return(a-this.padding)/this.scale},us.prototype._convertToCellCoord=function(a){return Math.max(0,Math.min(this.d-1,Math.floor(a*this.scale)+this.padding))},us.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var a=this.cells,c=3+this.cells.length+1+1,f=0,x=0;x<this.cells.length;x++)f+=this.cells[x].length;var S=new Int32Array(c+f+this.keys.length+this.bboxes.length);S[0]=this.extent,S[1]=this.n,S[2]=this.padding;for(var I=c,D=0;D<a.length;D++){var H=a[D];S[3+D]=I,S.set(H,I),I+=H.length}return S[3+a.length]=I,S.set(this.keys,I),S[3+a.length+1]=I+=this.keys.length,S.set(this.bboxes,I),I+=this.bboxes.length,S.buffer};var Jh=v.ImageData,Yg=v.ImageBitmap,xn={};function Tr(a,c,f){f===void 0&&(f={}),Object.defineProperty(c,"_classRegistryKey",{value:a,writeable:!1}),xn[a]={klass:c,omit:f.omit||[],shallow:f.shallow||[]}}for(var lo in Tr("Object",Object),vo.serialize=function(a,c){var f=a.toArrayBuffer();return c&&c.push(f),{buffer:f}},vo.deserialize=function(a){return new vo(a.buffer)},Tr("Grid",vo),Tr("Color",Oi),Tr("Error",Error),Tr("ResolvedImage",Yo),Tr("StylePropertyFunction",Vc),Tr("StyleExpression",Sn,{omit:["_evaluator"]}),Tr("ZoomDependentExpression",_i),Tr("ZoomConstantExpression",Fe),Tr("CompoundExpression",xe,{omit:["_evaluate"]}),Wr)Wr[lo]._classRegistryKey||Tr("Expression_"+lo,Wr[lo]);function Qf(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}function nf(a){return Yg&&a instanceof Yg}function Ha(a,c){if(a==null||typeof a=="boolean"||typeof a=="number"||typeof a=="string"||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp)return a;if(Qf(a)||nf(a))return c&&c.push(a),a;if(ArrayBuffer.isView(a)){var f=a;return c&&c.push(f.buffer),f}if(a instanceof Jh)return c&&c.push(a.data.buffer),a;if(Array.isArray(a)){for(var x=[],S=0,I=a;S<I.length;S+=1)x.push(Ha(I[S],c));return x}if(typeof a=="object"){var D=a.constructor,H=D._classRegistryKey;if(!H)throw new Error("can't serialize object of unregistered class");var Y=D.serialize?D.serialize(a,c):{};if(!D.serialize){for(var ee in a)if(a.hasOwnProperty(ee)&&!(xn[H].omit.indexOf(ee)>=0)){var ie=a[ee];Y[ee]=xn[H].shallow.indexOf(ee)>=0?ie:Ha(ie,c)}a instanceof Error&&(Y.message=a.message)}if(Y.$name)throw new Error("$name property is reserved for worker serialization logic.");return H!=="Object"&&(Y.$name=H),Y}throw new Error("can't serialize object of type "+typeof a)}function ja(a){if(a==null||typeof a=="boolean"||typeof a=="number"||typeof a=="string"||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||Qf(a)||nf(a)||ArrayBuffer.isView(a)||a instanceof Jh)return a;if(Array.isArray(a))return a.map(ja);if(typeof a=="object"){var c=a.$name||"Object",f=xn[c].klass;if(!f)throw new Error("can't deserialize unregistered class "+c);if(f.deserialize)return f.deserialize(a);for(var x=Object.create(f.prototype),S=0,I=Object.keys(a);S<I.length;S+=1){var D=I[S];if(D!=="$name"){var H=a[D];x[D]=xn[c].shallow.indexOf(D)>=0?H:ja(H)}}return x}throw new Error("can't deserialize object of type "+typeof a)}var LA=function(){this.first=!0};LA.prototype.update=function(a,c){var f=Math.floor(a);return this.first?(this.first=!1,this.lastIntegerZoom=f,this.lastIntegerZoomTime=0,this.lastZoom=a,this.lastFloorZoom=f,!0):(this.lastFloorZoom>f?(this.lastIntegerZoom=f+1,this.lastIntegerZoomTime=c):this.lastFloorZoom<f&&(this.lastIntegerZoom=f,this.lastIntegerZoomTime=c),a!==this.lastZoom&&(this.lastZoom=a,this.lastFloorZoom=f,!0))};var gr={"Latin-1 Supplement":function(a){return a>=128&&a<=255},Arabic:function(a){return a>=1536&&a<=1791},"Arabic Supplement":function(a){return a>=1872&&a<=1919},"Arabic Extended-A":function(a){return a>=2208&&a<=2303},"Hangul Jamo":function(a){return a>=4352&&a<=4607},"Unified Canadian Aboriginal Syllabics":function(a){return a>=5120&&a<=5759},Khmer:function(a){return a>=6016&&a<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(a){return a>=6320&&a<=6399},"General Punctuation":function(a){return a>=8192&&a<=8303},"Letterlike Symbols":function(a){return a>=8448&&a<=8527},"Number Forms":function(a){return a>=8528&&a<=8591},"Miscellaneous Technical":function(a){return a>=8960&&a<=9215},"Control Pictures":function(a){return a>=9216&&a<=9279},"Optical Character Recognition":function(a){return a>=9280&&a<=9311},"Enclosed Alphanumerics":function(a){return a>=9312&&a<=9471},"Geometric Shapes":function(a){return a>=9632&&a<=9727},"Miscellaneous Symbols":function(a){return a>=9728&&a<=9983},"Miscellaneous Symbols and Arrows":function(a){return a>=11008&&a<=11263},"CJK Radicals Supplement":function(a){return a>=11904&&a<=12031},"Kangxi Radicals":function(a){return a>=12032&&a<=12255},"Ideographic Description Characters":function(a){return a>=12272&&a<=12287},"CJK Symbols and Punctuation":function(a){return a>=12288&&a<=12351},Hiragana:function(a){return a>=12352&&a<=12447},Katakana:function(a){return a>=12448&&a<=12543},Bopomofo:function(a){return a>=12544&&a<=12591},"Hangul Compatibility Jamo":function(a){return a>=12592&&a<=12687},Kanbun:function(a){return a>=12688&&a<=12703},"Bopomofo Extended":function(a){return a>=12704&&a<=12735},"CJK Strokes":function(a){return a>=12736&&a<=12783},"Katakana Phonetic Extensions":function(a){return a>=12784&&a<=12799},"Enclosed CJK Letters and Months":function(a){return a>=12800&&a<=13055},"CJK Compatibility":function(a){return a>=13056&&a<=13311},"CJK Unified Ideographs Extension A":function(a){return a>=13312&&a<=19903},"Yijing Hexagram Symbols":function(a){return a>=19904&&a<=19967},"CJK Unified Ideographs":function(a){return a>=19968&&a<=40959},"Yi Syllables":function(a){return a>=40960&&a<=42127},"Yi Radicals":function(a){return a>=42128&&a<=42191},"Hangul Jamo Extended-A":function(a){return a>=43360&&a<=43391},"Hangul Syllables":function(a){return a>=44032&&a<=55215},"Hangul Jamo Extended-B":function(a){return a>=55216&&a<=55295},"Private Use Area":function(a){return a>=57344&&a<=63743},"CJK Compatibility Ideographs":function(a){return a>=63744&&a<=64255},"Arabic Presentation Forms-A":function(a){return a>=64336&&a<=65023},"Vertical Forms":function(a){return a>=65040&&a<=65055},"CJK Compatibility Forms":function(a){return a>=65072&&a<=65103},"Small Form Variants":function(a){return a>=65104&&a<=65135},"Arabic Presentation Forms-B":function(a){return a>=65136&&a<=65279},"Halfwidth and Fullwidth Forms":function(a){return a>=65280&&a<=65519}};function up(a){for(var c=0,f=a;c<f.length;c+=1)if(of(f[c].charCodeAt(0)))return!0;return!1}function of(a){return!(a!==746&&a!==747&&(a<4352||!(gr["Bopomofo Extended"](a)||gr.Bopomofo(a)||gr["CJK Compatibility Forms"](a)&&!(a>=65097&&a<=65103)||gr["CJK Compatibility Ideographs"](a)||gr["CJK Compatibility"](a)||gr["CJK Radicals Supplement"](a)||gr["CJK Strokes"](a)||!(!gr["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>=12308&&a<=12319||a===12336)||gr["CJK Unified Ideographs Extension A"](a)||gr["CJK Unified Ideographs"](a)||gr["Enclosed CJK Letters and Months"](a)||gr["Hangul Compatibility Jamo"](a)||gr["Hangul Jamo Extended-A"](a)||gr["Hangul Jamo Extended-B"](a)||gr["Hangul Jamo"](a)||gr["Hangul Syllables"](a)||gr.Hiragana(a)||gr["Ideographic Description Characters"](a)||gr.Kanbun(a)||gr["Kangxi Radicals"](a)||gr["Katakana Phonetic Extensions"](a)||gr.Katakana(a)&&a!==12540||!(!gr["Halfwidth and Fullwidth Forms"](a)||a===65288||a===65289||a===65293||a>=65306&&a<=65310||a===65339||a===65341||a===65343||a>=65371&&a<=65503||a===65507||a>=65512&&a<=65519)||!(!gr["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||gr["Unified Canadian Aboriginal Syllabics"](a)||gr["Unified Canadian Aboriginal Syllabics Extended"](a)||gr["Vertical Forms"](a)||gr["Yijing Hexagram Symbols"](a)||gr["Yi Syllables"](a)||gr["Yi Radicals"](a))))}function Gc(a){return!(of(a)||function(c){return!!(gr["Latin-1 Supplement"](c)&&(c===167||c===169||c===174||c===177||c===188||c===189||c===190||c===215||c===247)||gr["General Punctuation"](c)&&(c===8214||c===8224||c===8225||c===8240||c===8241||c===8251||c===8252||c===8258||c===8263||c===8264||c===8265||c===8273)||gr["Letterlike Symbols"](c)||gr["Number Forms"](c)||gr["Miscellaneous Technical"](c)&&(c>=8960&&c<=8967||c>=8972&&c<=8991||c>=8996&&c<=9e3||c===9003||c>=9085&&c<=9114||c>=9150&&c<=9165||c===9167||c>=9169&&c<=9179||c>=9186&&c<=9215)||gr["Control Pictures"](c)&&c!==9251||gr["Optical Character Recognition"](c)||gr["Enclosed Alphanumerics"](c)||gr["Geometric Shapes"](c)||gr["Miscellaneous Symbols"](c)&&!(c>=9754&&c<=9759)||gr["Miscellaneous Symbols and Arrows"](c)&&(c>=11026&&c<=11055||c>=11088&&c<=11097||c>=11192&&c<=11243)||gr["CJK Symbols and Punctuation"](c)||gr.Katakana(c)||gr["Private Use Area"](c)||gr["CJK Compatibility Forms"](c)||gr["Small Form Variants"](c)||gr["Halfwidth and Fullwidth Forms"](c)||c===8734||c===8756||c===8757||c>=9984&&c<=10087||c>=10102&&c<=10131||c===65532||c===65533)}(a))}function pl(a){return a>=1424&&a<=2303||gr["Arabic Presentation Forms-A"](a)||gr["Arabic Presentation Forms-B"](a)}function Ca(a,c){return!(!c&&pl(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||gr.Khmer(a))}function sf(a){for(var c=0,f=a;c<f.length;c+=1)if(pl(f[c].charCodeAt(0)))return!0;return!1}var dc=null,fs="unavailable",pc=null,FA=function(a){a&&typeof a=="string"&&a.indexOf("NetworkError")>-1&&(fs="error"),dc&&dc(a)};function af(){NA.fire(new ye("pluginStateChange",{pluginStatus:fs,pluginURL:pc}))}var NA=new rt,kA=function(){return fs},Il=function(){if(fs!=="deferred"||!pc)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");fs="loading",af(),pc&&Ml({url:pc},function(a){a?FA(a):(fs="loaded",af())})},Al={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return fs==="loaded"||Al.applyArabicShaping!=null},isLoading:function(){return fs==="loading"},setState:function(a){fs=a.pluginStatus,pc=a.pluginURL},isParsed:function(){return Al.applyArabicShaping!=null&&Al.processBidirectionalText!=null&&Al.processStyledBidirectionalText!=null},getPluginURL:function(){return pc}},qi=function(a,c){this.zoom=a,c?(this.now=c.now,this.fadeDuration=c.fadeDuration,this.zoomHistory=c.zoomHistory,this.transition=c.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new LA,this.transition={})};qi.prototype.isSupportedScript=function(a){return function(c,f){for(var x=0,S=c;x<S.length;x+=1)if(!Ca(S[x].charCodeAt(0),f))return!1;return!0}(a,Al.isLoaded())},qi.prototype.crossFadingFactor=function(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},qi.prototype.getCrossfadeParameters=function(){var a=this.zoom,c=a-Math.floor(a),f=this.crossFadingFactor();return a>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*f}:{fromScale:.5,toScale:1,t:1-(1-f)*c}};var Ac=function(a,c){this.property=a,this.value=c,this.expression=function(f,x){if(ea(f))return new Vc(f,x);if(ha(f)){var S=Kh(f,x);if(S.result==="error")throw new Error(S.value.map(function(D){return D.key+": "+D.message}).join(", "));return S.value}var I=f;return typeof f=="string"&&x.type==="color"&&(I=Oi.parse(f)),{kind:"constant",evaluate:function(){return I}}}(c===void 0?a.specification.default:c,a.specification)};Ac.prototype.isDataDriven=function(){return this.expression.kind==="source"||this.expression.kind==="composite"},Ac.prototype.possiblyEvaluate=function(a,c,f){return this.property.possiblyEvaluate(this,a,c,f)};var Pl=function(a){this.property=a,this.value=new Ac(a,void 0)};Pl.prototype.transitioned=function(a,c){return new lf(this.property,this.value,c,z({},a.transition,this.transition),a.now)},Pl.prototype.untransitioned=function(){return new lf(this.property,this.value,null,{},0)};var Gs=function(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)};Gs.prototype.getValue=function(a){return $(this._values[a].value.value)},Gs.prototype.setValue=function(a,c){this._values.hasOwnProperty(a)||(this._values[a]=new Pl(this._values[a].property)),this._values[a].value=new Ac(this._values[a].property,c===null?void 0:$(c))},Gs.prototype.getTransition=function(a){return $(this._values[a].transition)},Gs.prototype.setTransition=function(a,c){this._values.hasOwnProperty(a)||(this._values[a]=new Pl(this._values[a].property)),this._values[a].transition=$(c)||void 0},Gs.prototype.serialize=function(){for(var a={},c=0,f=Object.keys(this._values);c<f.length;c+=1){var x=f[c],S=this.getValue(x);S!==void 0&&(a[x]=S);var I=this.getTransition(x);I!==void 0&&(a[x+"-transition"]=I)}return a},Gs.prototype.transitioned=function(a,c){for(var f=new pu(this._properties),x=0,S=Object.keys(this._values);x<S.length;x+=1){var I=S[x];f._values[I]=this._values[I].transitioned(a,c._values[I])}return f},Gs.prototype.untransitioned=function(){for(var a=new pu(this._properties),c=0,f=Object.keys(this._values);c<f.length;c+=1){var x=f[c];a._values[x]=this._values[x].untransitioned()}return a};var lf=function(a,c,f,x,S){this.property=a,this.value=c,this.begin=S+x.delay||0,this.end=this.begin+x.duration||0,a.specification.transition&&(x.delay||x.duration)&&(this.prior=f)};lf.prototype.possiblyEvaluate=function(a,c,f){var x=a.now||0,S=this.value.possiblyEvaluate(a,c,f),I=this.prior;if(I){if(x>this.end)return this.prior=null,S;if(this.value.isDataDriven())return this.prior=null,S;if(x<this.begin)return I.possiblyEvaluate(a,c,f);var D=(x-this.begin)/(this.end-this.begin);return this.property.interpolate(I.possiblyEvaluate(a,c,f),S,function(H){if(H<=0)return 0;if(H>=1)return 1;var Y=H*H,ee=Y*H;return 4*(H<.5?ee:3*(H-Y)+ee-.75)}(D))}return S};var pu=function(a){this._properties=a,this._values=Object.create(a.defaultTransitioningPropertyValues)};pu.prototype.possiblyEvaluate=function(a,c,f){for(var x=new Qh(this._properties),S=0,I=Object.keys(this._values);S<I.length;S+=1){var D=I[S];x._values[D]=this._values[D].possiblyEvaluate(a,c,f)}return x},pu.prototype.hasTransition=function(){for(var a=0,c=Object.keys(this._values);a<c.length;a+=1)if(this._values[c[a]].prior)return!0;return!1};var Yl=function(a){this._properties=a,this._values=Object.create(a.defaultPropertyValues)};Yl.prototype.getValue=function(a){return $(this._values[a].value)},Yl.prototype.setValue=function(a,c){this._values[a]=new Ac(this._values[a].property,c===null?void 0:$(c))},Yl.prototype.serialize=function(){for(var a={},c=0,f=Object.keys(this._values);c<f.length;c+=1){var x=f[c],S=this.getValue(x);S!==void 0&&(a[x]=S)}return a},Yl.prototype.possiblyEvaluate=function(a,c,f){for(var x=new Qh(this._properties),S=0,I=Object.keys(this._values);S<I.length;S+=1){var D=I[S];x._values[D]=this._values[D].possiblyEvaluate(a,c,f)}return x};var Ps=function(a,c,f){this.property=a,this.value=c,this.parameters=f};Ps.prototype.isConstant=function(){return this.value.kind==="constant"},Ps.prototype.constantOr=function(a){return this.value.kind==="constant"?this.value.value:a},Ps.prototype.evaluate=function(a,c,f,x){return this.property.evaluate(this.value,this.parameters,a,c,f,x)};var Qh=function(a){this._properties=a,this._values=Object.create(a.defaultPossiblyEvaluatedValues)};Qh.prototype.get=function(a){return this._values[a]};var ei=function(a){this.specification=a};ei.prototype.possiblyEvaluate=function(a,c){return a.expression.evaluate(c)},ei.prototype.interpolate=function(a,c,f){var x=uu[this.specification.type];return x?x(a,c,f):a};var zr=function(a,c){this.specification=a,this.overrides=c};zr.prototype.possiblyEvaluate=function(a,c,f,x){return new Ps(this,a.expression.kind==="constant"||a.expression.kind==="camera"?{kind:"constant",value:a.expression.evaluate(c,null,{},f,x)}:a.expression,c)},zr.prototype.interpolate=function(a,c,f){if(a.value.kind!=="constant"||c.value.kind!=="constant")return a;if(a.value.value===void 0||c.value.value===void 0)return new Ps(this,{kind:"constant",value:void 0},a.parameters);var x=uu[this.specification.type];return x?new Ps(this,{kind:"constant",value:x(a.value.value,c.value.value,f)},a.parameters):a},zr.prototype.evaluate=function(a,c,f,x,S,I){return a.kind==="constant"?a.value:a.evaluate(c,f,x,S,I)};var Au=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.possiblyEvaluate=function(f,x,S,I){if(f.value===void 0)return new Ps(this,{kind:"constant",value:void 0},x);if(f.expression.kind==="constant"){var D=f.expression.evaluate(x,null,{},S,I),H=f.property.specification.type==="resolvedImage"&&typeof D!="string"?D.name:D,Y=this._calculate(H,H,H,x);return new Ps(this,{kind:"constant",value:Y},x)}if(f.expression.kind==="camera"){var ee=this._calculate(f.expression.evaluate({zoom:x.zoom-1}),f.expression.evaluate({zoom:x.zoom}),f.expression.evaluate({zoom:x.zoom+1}),x);return new Ps(this,{kind:"constant",value:ee},x)}return new Ps(this,f.expression,x)},c.prototype.evaluate=function(f,x,S,I,D,H){if(f.kind==="source"){var Y=f.evaluate(x,S,I,D,H);return this._calculate(Y,Y,Y,x)}return f.kind==="composite"?this._calculate(f.evaluate({zoom:Math.floor(x.zoom)-1},S,I),f.evaluate({zoom:Math.floor(x.zoom)},S,I),f.evaluate({zoom:Math.floor(x.zoom)+1},S,I),x):f.value},c.prototype._calculate=function(f,x,S,I){return I.zoom>I.zoomHistory.lastIntegerZoom?{from:f,to:x}:{from:S,to:x}},c.prototype.interpolate=function(f){return f},c}(zr),da=function(a){this.specification=a};da.prototype.possiblyEvaluate=function(a,c,f,x){if(a.value!==void 0){if(a.expression.kind==="constant"){var S=a.expression.evaluate(c,null,{},f,x);return this._calculate(S,S,S,c)}return this._calculate(a.expression.evaluate(new qi(Math.floor(c.zoom-1),c)),a.expression.evaluate(new qi(Math.floor(c.zoom),c)),a.expression.evaluate(new qi(Math.floor(c.zoom+1),c)),c)}},da.prototype._calculate=function(a,c,f,x){return x.zoom>x.zoomHistory.lastIntegerZoom?{from:a,to:c}:{from:f,to:c}},da.prototype.interpolate=function(a){return a};var ml=function(a){this.specification=a};ml.prototype.possiblyEvaluate=function(a,c,f,x){return!!a.expression.evaluate(c,null,{},f,x)},ml.prototype.interpolate=function(){return!1};var Rs=function(a){for(var c in this.properties=a,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],a){var f=a[c];f.specification.overridable&&this.overridableProperties.push(c);var x=this.defaultPropertyValues[c]=new Ac(f,void 0),S=this.defaultTransitionablePropertyValues[c]=new Pl(f);this.defaultTransitioningPropertyValues[c]=S.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=x.possiblyEvaluate({})}};Tr("DataDrivenProperty",zr),Tr("DataConstantProperty",ei),Tr("CrossFadedDataDrivenProperty",Au),Tr("CrossFadedProperty",da),Tr("ColorRampProperty",ml);var Ma=function(a){function c(f,x){if(a.call(this),this.id=f.id,this.type=f.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},f.type!=="custom"&&(this.metadata=(f=f).metadata,this.minzoom=f.minzoom,this.maxzoom=f.maxzoom,f.type!=="background"&&(this.source=f.source,this.sourceLayer=f["source-layer"],this.filter=f.filter),x.layout&&(this._unevaluatedLayout=new Yl(x.layout)),x.paint)){for(var S in this._transitionablePaint=new Gs(x.paint),f.paint)this.setPaintProperty(S,f.paint[S],{validate:!1});for(var I in f.layout)this.setLayoutProperty(I,f.layout[I],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Qh(x.paint)}}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},c.prototype.getLayoutProperty=function(f){return f==="visibility"?this.visibility:this._unevaluatedLayout.getValue(f)},c.prototype.setLayoutProperty=function(f,x,S){S===void 0&&(S={}),x!=null&&this._validate(ta,"layers."+this.id+".layout."+f,f,x,S)||(f!=="visibility"?this._unevaluatedLayout.setValue(f,x):this.visibility=x)},c.prototype.getPaintProperty=function(f){return j(f,"-transition")?this._transitionablePaint.getTransition(f.slice(0,-11)):this._transitionablePaint.getValue(f)},c.prototype.setPaintProperty=function(f,x,S){if(S===void 0&&(S={}),x!=null&&this._validate(Va,"layers."+this.id+".paint."+f,f,x,S))return!1;if(j(f,"-transition"))return this._transitionablePaint.setTransition(f.slice(0,-11),x||void 0),!1;var I=this._transitionablePaint._values[f],D=I.property.specification["property-type"]==="cross-faded-data-driven",H=I.value.isDataDriven(),Y=I.value;this._transitionablePaint.setValue(f,x),this._handleSpecialPaintPropertyUpdate(f);var ee=this._transitionablePaint._values[f].value;return ee.isDataDriven()||H||D||this._handleOverridablePaintPropertyUpdate(f,Y,ee)},c.prototype._handleSpecialPaintPropertyUpdate=function(f){},c.prototype._handleOverridablePaintPropertyUpdate=function(f,x,S){return!1},c.prototype.isHidden=function(f){return!!(this.minzoom&&f<this.minzoom)||!!(this.maxzoom&&f>=this.maxzoom)||this.visibility==="none"},c.prototype.updateTransitions=function(f){this._transitioningPaint=this._transitionablePaint.transitioned(f,this._transitioningPaint)},c.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},c.prototype.recalculate=function(f,x){f.getCrossfadeParameters&&(this._crossfadeParameters=f.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(f,void 0,x)),this.paint=this._transitioningPaint.possiblyEvaluate(f,void 0,x)},c.prototype.serialize=function(){var f={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&&(f.layout=f.layout||{},f.layout.visibility=this.visibility),fe(f,function(x,S){return!(x===void 0||S==="layout"&&!Object.keys(x).length||S==="paint"&&!Object.keys(x).length)})},c.prototype._validate=function(f,x,S,I,D){return D===void 0&&(D={}),(!D||D.validate!==!1)&&dl(this,f.call(rs,{key:x,layerType:this.type,objectKey:S,value:I,styleSpec:Se,style:{glyphs:!0,sprite:!0}}))},c.prototype.is3D=function(){return!1},c.prototype.isTileClipped=function(){return!1},c.prototype.hasOffscreenPass=function(){return!1},c.prototype.resize=function(){},c.prototype.isStateDependent=function(){for(var f in this.paint._values){var x=this.paint.get(f);if(x instanceof Ps&&$n(x.property.specification)&&(x.value.kind==="source"||x.value.kind==="composite")&&x.value.isStateDependent)return!0}return!1},c}(rt),UA={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},$f=function(a,c){this._structArray=a,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},In=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Bs(a,c){c===void 0&&(c=1);var f=0,x=0;return{members:a.map(function(S){var I=UA[S.type].BYTES_PER_ELEMENT,D=f=zA(f,Math.max(c,I)),H=S.components||1;return x=Math.max(x,I),f+=I*H,{name:S.name,type:S.type,components:H,offset:D}}),size:zA(f,Math.max(x,c)),alignment:c}}function zA(a,c){return Math.ceil(a/c)*c}In.serialize=function(a,c){return a._trim(),c&&(a.isTransferred=!0,c.push(a.arrayBuffer)),{length:a.length,arrayBuffer:a.arrayBuffer}},In.deserialize=function(a){var c=Object.create(this.prototype);return c.arrayBuffer=a.arrayBuffer,c.length=a.length,c.capacity=a.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c},In.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},In.prototype.clear=function(){this.length=0},In.prototype.resize=function(a){this.reserve(a),this.length=a},In.prototype.reserve=function(a){if(a>this.capacity){this.capacity=Math.max(a,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}},In.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Wc=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x){var S=this.length;return this.resize(S+1),this.emplace(S,f,x)},c.prototype.emplace=function(f,x,S){var I=2*f;return this.int16[I+0]=x,this.int16[I+1]=S,f},c}(In);Wc.prototype.bytesPerElement=4,Tr("StructArrayLayout2i4",Wc);var $h=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S,I){var D=this.length;return this.resize(D+1),this.emplace(D,f,x,S,I)},c.prototype.emplace=function(f,x,S,I,D){var H=4*f;return this.int16[H+0]=x,this.int16[H+1]=S,this.int16[H+2]=I,this.int16[H+3]=D,f},c}(In);$h.prototype.bytesPerElement=8,Tr("StructArrayLayout4i8",$h);var Rl=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S,I,D,H){var Y=this.length;return this.resize(Y+1),this.emplace(Y,f,x,S,I,D,H)},c.prototype.emplace=function(f,x,S,I,D,H,Y){var ee=6*f;return this.int16[ee+0]=x,this.int16[ee+1]=S,this.int16[ee+2]=I,this.int16[ee+3]=D,this.int16[ee+4]=H,this.int16[ee+5]=Y,f},c}(In);Rl.prototype.bytesPerElement=12,Tr("StructArrayLayout2i4i12",Rl);var mn=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S,I,D,H){var Y=this.length;return this.resize(Y+1),this.emplace(Y,f,x,S,I,D,H)},c.prototype.emplace=function(f,x,S,I,D,H,Y){var ee=4*f,ie=8*f;return this.int16[ee+0]=x,this.int16[ee+1]=S,this.uint8[ie+4]=I,this.uint8[ie+5]=D,this.uint8[ie+6]=H,this.uint8[ie+7]=Y,f},c}(In);mn.prototype.bytesPerElement=8,Tr("StructArrayLayout2i4ub8",mn);var eh=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x){var S=this.length;return this.resize(S+1),this.emplace(S,f,x)},c.prototype.emplace=function(f,x,S){var I=2*f;return this.float32[I+0]=x,this.float32[I+1]=S,f},c}(In);eh.prototype.bytesPerElement=8,Tr("StructArrayLayout2f8",eh);var mc=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S,I,D,H,Y,ee,ie,se){var Ae=this.length;return this.resize(Ae+1),this.emplace(Ae,f,x,S,I,D,H,Y,ee,ie,se)},c.prototype.emplace=function(f,x,S,I,D,H,Y,ee,ie,se,Ae){var Te=10*f;return this.uint16[Te+0]=x,this.uint16[Te+1]=S,this.uint16[Te+2]=I,this.uint16[Te+3]=D,this.uint16[Te+4]=H,this.uint16[Te+5]=Y,this.uint16[Te+6]=ee,this.uint16[Te+7]=ie,this.uint16[Te+8]=se,this.uint16[Te+9]=Ae,f},c}(In);mc.prototype.bytesPerElement=20,Tr("StructArrayLayout10ui20",mc);var fp=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S,I,D,H,Y,ee,ie,se,Ae,Te){var ke=this.length;return this.resize(ke+1),this.emplace(ke,f,x,S,I,D,H,Y,ee,ie,se,Ae,Te)},c.prototype.emplace=function(f,x,S,I,D,H,Y,ee,ie,se,Ae,Te,ke){var Ve=12*f;return this.int16[Ve+0]=x,this.int16[Ve+1]=S,this.int16[Ve+2]=I,this.int16[Ve+3]=D,this.uint16[Ve+4]=H,this.uint16[Ve+5]=Y,this.uint16[Ve+6]=ee,this.uint16[Ve+7]=ie,this.int16[Ve+8]=se,this.int16[Ve+9]=Ae,this.int16[Ve+10]=Te,this.int16[Ve+11]=ke,f},c}(In);fp.prototype.bytesPerElement=24,Tr("StructArrayLayout4i4ui4i24",fp);var th=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S){var I=this.length;return this.resize(I+1),this.emplace(I,f,x,S)},c.prototype.emplace=function(f,x,S,I){var D=3*f;return this.float32[D+0]=x,this.float32[D+1]=S,this.float32[D+2]=I,f},c}(In);th.prototype.bytesPerElement=12,Tr("StructArrayLayout3f12",th);var ed=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f){var x=this.length;return this.resize(x+1),this.emplace(x,f)},c.prototype.emplace=function(f,x){return this.uint32[1*f+0]=x,f},c}(In);ed.prototype.bytesPerElement=4,Tr("StructArrayLayout1ul4",ed);var VA=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S,I,D,H,Y,ee,ie){var se=this.length;return this.resize(se+1),this.emplace(se,f,x,S,I,D,H,Y,ee,ie)},c.prototype.emplace=function(f,x,S,I,D,H,Y,ee,ie,se){var Ae=10*f,Te=5*f;return this.int16[Ae+0]=x,this.int16[Ae+1]=S,this.int16[Ae+2]=I,this.int16[Ae+3]=D,this.int16[Ae+4]=H,this.int16[Ae+5]=Y,this.uint32[Te+3]=ee,this.uint16[Ae+8]=ie,this.uint16[Ae+9]=se,f},c}(In);VA.prototype.bytesPerElement=20,Tr("StructArrayLayout6i1ul2ui20",VA);var rh=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S,I,D,H){var Y=this.length;return this.resize(Y+1),this.emplace(Y,f,x,S,I,D,H)},c.prototype.emplace=function(f,x,S,I,D,H,Y){var ee=6*f;return this.int16[ee+0]=x,this.int16[ee+1]=S,this.int16[ee+2]=I,this.int16[ee+3]=D,this.int16[ee+4]=H,this.int16[ee+5]=Y,f},c}(In);rh.prototype.bytesPerElement=12,Tr("StructArrayLayout2i2i2i12",rh);var xs=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S,I,D){var H=this.length;return this.resize(H+1),this.emplace(H,f,x,S,I,D)},c.prototype.emplace=function(f,x,S,I,D,H){var Y=4*f,ee=8*f;return this.float32[Y+0]=x,this.float32[Y+1]=S,this.float32[Y+2]=I,this.int16[ee+6]=D,this.int16[ee+7]=H,f},c}(In);xs.prototype.bytesPerElement=16,Tr("StructArrayLayout2f1f2i16",xs);var td=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S,I){var D=this.length;return this.resize(D+1),this.emplace(D,f,x,S,I)},c.prototype.emplace=function(f,x,S,I,D){var H=12*f,Y=3*f;return this.uint8[H+0]=x,this.uint8[H+1]=S,this.float32[Y+1]=I,this.float32[Y+2]=D,f},c}(In);td.prototype.bytesPerElement=12,Tr("StructArrayLayout2ub2f12",td);var Ga=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S){var I=this.length;return this.resize(I+1),this.emplace(I,f,x,S)},c.prototype.emplace=function(f,x,S,I){var D=3*f;return this.uint16[D+0]=x,this.uint16[D+1]=S,this.uint16[D+2]=I,f},c}(In);Ga.prototype.bytesPerElement=6,Tr("StructArrayLayout3ui6",Ga);var mu=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){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)},c.prototype.emplaceBack=function(f,x,S,I,D,H,Y,ee,ie,se,Ae,Te,ke,Ve,et,Xe,at){var _t=this.length;return this.resize(_t+1),this.emplace(_t,f,x,S,I,D,H,Y,ee,ie,se,Ae,Te,ke,Ve,et,Xe,at)},c.prototype.emplace=function(f,x,S,I,D,H,Y,ee,ie,se,Ae,Te,ke,Ve,et,Xe,at,_t){var bt=24*f,Mt=12*f,Ut=48*f;return this.int16[bt+0]=x,this.int16[bt+1]=S,this.uint16[bt+2]=I,this.uint16[bt+3]=D,this.uint32[Mt+2]=H,this.uint32[Mt+3]=Y,this.uint32[Mt+4]=ee,this.uint16[bt+10]=ie,this.uint16[bt+11]=se,this.uint16[bt+12]=Ae,this.float32[Mt+7]=Te,this.float32[Mt+8]=ke,this.uint8[Ut+36]=Ve,this.uint8[Ut+37]=et,this.uint8[Ut+38]=Xe,this.uint32[Mt+10]=at,this.int16[bt+22]=_t,f},c}(In);mu.prototype.bytesPerElement=48,Tr("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",mu);var ih=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){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)},c.prototype.emplaceBack=function(f,x,S,I,D,H,Y,ee,ie,se,Ae,Te,ke,Ve,et,Xe,at,_t,bt,Mt,Ut,$t,Ar,Qr,Cr,ni,Pr,Vi){var Ai=this.length;return this.resize(Ai+1),this.emplace(Ai,f,x,S,I,D,H,Y,ee,ie,se,Ae,Te,ke,Ve,et,Xe,at,_t,bt,Mt,Ut,$t,Ar,Qr,Cr,ni,Pr,Vi)},c.prototype.emplace=function(f,x,S,I,D,H,Y,ee,ie,se,Ae,Te,ke,Ve,et,Xe,at,_t,bt,Mt,Ut,$t,Ar,Qr,Cr,ni,Pr,Vi,Ai){var Gr=34*f,rn=17*f;return this.int16[Gr+0]=x,this.int16[Gr+1]=S,this.int16[Gr+2]=I,this.int16[Gr+3]=D,this.int16[Gr+4]=H,this.int16[Gr+5]=Y,this.int16[Gr+6]=ee,this.int16[Gr+7]=ie,this.uint16[Gr+8]=se,this.uint16[Gr+9]=Ae,this.uint16[Gr+10]=Te,this.uint16[Gr+11]=ke,this.uint16[Gr+12]=Ve,this.uint16[Gr+13]=et,this.uint16[Gr+14]=Xe,this.uint16[Gr+15]=at,this.uint16[Gr+16]=_t,this.uint16[Gr+17]=bt,this.uint16[Gr+18]=Mt,this.uint16[Gr+19]=Ut,this.uint16[Gr+20]=$t,this.uint16[Gr+21]=Ar,this.uint16[Gr+22]=Qr,this.uint32[rn+12]=Cr,this.float32[rn+13]=ni,this.float32[rn+14]=Pr,this.float32[rn+15]=Vi,this.float32[rn+16]=Ai,f},c}(In);ih.prototype.bytesPerElement=68,Tr("StructArrayLayout8i15ui1ul4f68",ih);var gu=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f){var x=this.length;return this.resize(x+1),this.emplace(x,f)},c.prototype.emplace=function(f,x){return this.float32[1*f+0]=x,f},c}(In);gu.prototype.bytesPerElement=4,Tr("StructArrayLayout1f4",gu);var Zo=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S){var I=this.length;return this.resize(I+1),this.emplace(I,f,x,S)},c.prototype.emplace=function(f,x,S,I){var D=3*f;return this.int16[D+0]=x,this.int16[D+1]=S,this.int16[D+2]=I,f},c}(In);Zo.prototype.bytesPerElement=6,Tr("StructArrayLayout3i6",Zo);var hp=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S){var I=this.length;return this.resize(I+1),this.emplace(I,f,x,S)},c.prototype.emplace=function(f,x,S,I){var D=4*f;return this.uint32[2*f+0]=x,this.uint16[D+2]=S,this.uint16[D+3]=I,f},c}(In);hp.prototype.bytesPerElement=8,Tr("StructArrayLayout1ul2ui8",hp);var cf=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x){var S=this.length;return this.resize(S+1),this.emplace(S,f,x)},c.prototype.emplace=function(f,x,S){var I=2*f;return this.uint16[I+0]=x,this.uint16[I+1]=S,f},c}(In);cf.prototype.bytesPerElement=4,Tr("StructArrayLayout2ui4",cf);var _u=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f){var x=this.length;return this.resize(x+1),this.emplace(x,f)},c.prototype.emplace=function(f,x){return this.uint16[1*f+0]=x,f},c}(In);_u.prototype.bytesPerElement=2,Tr("StructArrayLayout1ui2",_u);var yu=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},c.prototype.emplaceBack=function(f,x,S,I){var D=this.length;return this.resize(D+1),this.emplace(D,f,x,S,I)},c.prototype.emplace=function(f,x,S,I,D){var H=4*f;return this.float32[H+0]=x,this.float32[H+1]=S,this.float32[H+2]=I,this.float32[H+3]=D,f},c}(In);yu.prototype.bytesPerElement=16,Tr("StructArrayLayout4f16",yu);var d=function(a){function c(){a.apply(this,arguments)}a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c;var f={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return f.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},f.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},f.x1.get=function(){return this._structArray.int16[this._pos2+2]},f.y1.get=function(){return this._structArray.int16[this._pos2+3]},f.x2.get=function(){return this._structArray.int16[this._pos2+4]},f.y2.get=function(){return this._structArray.int16[this._pos2+5]},f.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},f.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},f.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},f.anchorPoint.get=function(){return new u(this.anchorPointX,this.anchorPointY)},Object.defineProperties(c.prototype,f),c}($f);d.prototype.size=20;var _=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.get=function(f){return new d(this,f)},c}(VA);Tr("CollisionBoxArray",_);var p=function(a){function c(){a.apply(this,arguments)}a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c;var f={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return f.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},f.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},f.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},f.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},f.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},f.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},f.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},f.segment.get=function(){return this._structArray.uint16[this._pos2+10]},f.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},f.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},f.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},f.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},f.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},f.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},f.placedOrientation.set=function(x){this._structArray.uint8[this._pos1+37]=x},f.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},f.hidden.set=function(x){this._structArray.uint8[this._pos1+38]=x},f.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},f.crossTileID.set=function(x){this._structArray.uint32[this._pos4+10]=x},f.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(c.prototype,f),c}($f);p.prototype.size=48;var b=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.get=function(f){return new p(this,f)},c}(mu);Tr("PlacedSymbolArray",b);var B=function(a){function c(){a.apply(this,arguments)}a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c;var f={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return f.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},f.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},f.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},f.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},f.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},f.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},f.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},f.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},f.key.get=function(){return this._structArray.uint16[this._pos2+8]},f.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},f.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},f.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},f.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},f.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},f.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},f.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},f.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},f.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},f.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},f.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},f.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},f.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},f.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},f.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},f.crossTileID.set=function(x){this._structArray.uint32[this._pos4+12]=x},f.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},f.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},f.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},f.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(c.prototype,f),c}($f);B.prototype.size=68;var k=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.get=function(f){return new B(this,f)},c}(ih);Tr("SymbolInstanceArray",k);var V=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.getoffsetX=function(f){return this.float32[1*f+0]},c}(gu);Tr("GlyphOffsetArray",V);var q=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.getx=function(f){return this.int16[3*f+0]},c.prototype.gety=function(f){return this.int16[3*f+1]},c.prototype.gettileUnitDistanceFromAnchor=function(f){return this.int16[3*f+2]},c}(Zo);Tr("SymbolLineVertexArray",q);var re=function(a){function c(){a.apply(this,arguments)}a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c;var f={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return f.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},f.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},f.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(c.prototype,f),c}($f);re.prototype.size=8;var ue=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.get=function(f){return new re(this,f)},c}(hp);Tr("FeatureIndexArray",ue);var Ee=Bs([{name:"a_pos",components:2,type:"Int16"}],4).members,Ce=function(a){a===void 0&&(a=[]),this.segments=a};function Me(a,c){return 256*(a=O(Math.floor(a),0,255))+O(Math.floor(c),0,255)}Ce.prototype.prepareSegment=function(a,c,f,x){var S=this.segments[this.segments.length-1];return a>Ce.MAX_VERTEX_ARRAY_LENGTH&&we("Max vertices per segment is "+Ce.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+a),(!S||S.vertexLength+a>Ce.MAX_VERTEX_ARRAY_LENGTH||S.sortKey!==x)&&(S={vertexOffset:c.length,primitiveOffset:f.length,vertexLength:0,primitiveLength:0},x!==void 0&&(S.sortKey=x),this.segments.push(S)),S},Ce.prototype.get=function(){return this.segments},Ce.prototype.destroy=function(){for(var a=0,c=this.segments;a<c.length;a+=1){var f=c[a];for(var x in f.vaos)f.vaos[x].destroy()}},Ce.simpleSegment=function(a,c,f,x){return new Ce([{vertexOffset:a,primitiveOffset:c,vertexLength:f,primitiveLength:x,vaos:{},sortKey:0}])},Ce.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Tr("SegmentVector",Ce);var He=Bs([{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"}]),Ue=o(function(a){a.exports=function(c,f){var x,S,I,D,H,Y,ee,ie;for(S=c.length-(x=3&c.length),I=f,H=3432918353,Y=461845907,ie=0;ie<S;)ee=255&c.charCodeAt(ie)|(255&c.charCodeAt(++ie))<<8|(255&c.charCodeAt(++ie))<<16|(255&c.charCodeAt(++ie))<<24,++ie,I=27492+(65535&(D=5*(65535&(I=(I^=ee=(65535&(ee=(ee=(65535&ee)*H+(((ee>>>16)*H&65535)<<16)&4294967295)<<15|ee>>>17))*Y+(((ee>>>16)*Y&65535)<<16)&4294967295)<<13|I>>>19))+((5*(I>>>16)&65535)<<16)&4294967295))+((58964+(D>>>16)&65535)<<16);switch(ee=0,x){case 3:ee^=(255&c.charCodeAt(ie+2))<<16;case 2:ee^=(255&c.charCodeAt(ie+1))<<8;case 1:I^=ee=(65535&(ee=(ee=(65535&(ee^=255&c.charCodeAt(ie)))*H+(((ee>>>16)*H&65535)<<16)&4294967295)<<15|ee>>>17))*Y+(((ee>>>16)*Y&65535)<<16)&4294967295}return I^=c.length,I=2246822507*(65535&(I^=I>>>16))+((2246822507*(I>>>16)&65535)<<16)&4294967295,I=3266489909*(65535&(I^=I>>>13))+((3266489909*(I>>>16)&65535)<<16)&4294967295,(I^=I>>>16)>>>0}}),Ze=o(function(a){a.exports=function(c,f){for(var x,S=c.length,I=f^S,D=0;S>=4;)x=1540483477*(65535&(x=255&c.charCodeAt(D)|(255&c.charCodeAt(++D))<<8|(255&c.charCodeAt(++D))<<16|(255&c.charCodeAt(++D))<<24))+((1540483477*(x>>>16)&65535)<<16),I=1540483477*(65535&I)+((1540483477*(I>>>16)&65535)<<16)^(x=1540483477*(65535&(x^=x>>>24))+((1540483477*(x>>>16)&65535)<<16)),S-=4,++D;switch(S){case 3:I^=(255&c.charCodeAt(D+2))<<16;case 2:I^=(255&c.charCodeAt(D+1))<<8;case 1:I=1540483477*(65535&(I^=255&c.charCodeAt(D)))+((1540483477*(I>>>16)&65535)<<16)}return I=1540483477*(65535&(I^=I>>>13))+((1540483477*(I>>>16)&65535)<<16),(I^=I>>>15)>>>0}}),Ne=Ue,Ke=Ze;Ne.murmur3=Ue,Ne.murmur2=Ke;var it=function(){this.ids=[],this.positions=[],this.indexed=!1};it.prototype.add=function(a,c,f,x){this.ids.push(Ct(a)),this.positions.push(c,f,x)},it.prototype.getPositions=function(a){for(var c=Ct(a),f=0,x=this.ids.length-1;f<x;){var S=f+x>>1;this.ids[S]>=c?x=S:f=S+1}for(var I=[];this.ids[f]===c;)I.push({index:this.positions[3*f],start:this.positions[3*f+1],end:this.positions[3*f+2]}),f++;return I},it.serialize=function(a,c){var f=new Float64Array(a.ids),x=new Uint32Array(a.positions);return function S(I,D,H,Y){for(;H<Y;){for(var ee=I[H+Y>>1],ie=H-1,se=Y+1;;){do ie++;while(I[ie]<ee);do se--;while(I[se]>ee);if(ie>=se)break;xt(I,ie,se),xt(D,3*ie,3*se),xt(D,3*ie+1,3*se+1),xt(D,3*ie+2,3*se+2)}se-H<Y-se?(S(I,D,H,se),H=se+1):(S(I,D,se+1,Y),Y=se)}}(f,x,0,f.length-1),c&&c.push(f.buffer,x.buffer),{ids:f,positions:x}},it.deserialize=function(a){var c=new it;return c.ids=a.ids,c.positions=a.positions,c.indexed=!0,c};var pt=Math.pow(2,53)-1;function Ct(a){var c=+a;return!isNaN(c)&&c<=pt?c:Ne(String(a))}function xt(a,c,f){var x=a[c];a[c]=a[f],a[f]=x}Tr("FeaturePositionMap",it);var Rt=function(a,c){this.gl=a.gl,this.location=c},Wt=function(a){function c(f,x){a.call(this,f,x),this.current=0}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.set=function(f){this.current!==f&&(this.current=f,this.gl.uniform1i(this.location,f))},c}(Rt),ar=function(a){function c(f,x){a.call(this,f,x),this.current=0}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.set=function(f){this.current!==f&&(this.current=f,this.gl.uniform1f(this.location,f))},c}(Rt),ir=function(a){function c(f,x){a.call(this,f,x),this.current=[0,0]}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.set=function(f){f[0]===this.current[0]&&f[1]===this.current[1]||(this.current=f,this.gl.uniform2f(this.location,f[0],f[1]))},c}(Rt),Ir=function(a){function c(f,x){a.call(this,f,x),this.current=[0,0,0]}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.set=function(f){f[0]===this.current[0]&&f[1]===this.current[1]&&f[2]===this.current[2]||(this.current=f,this.gl.uniform3f(this.location,f[0],f[1],f[2]))},c}(Rt),ti=function(a){function c(f,x){a.call(this,f,x),this.current=[0,0,0,0]}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.set=function(f){f[0]===this.current[0]&&f[1]===this.current[1]&&f[2]===this.current[2]&&f[3]===this.current[3]||(this.current=f,this.gl.uniform4f(this.location,f[0],f[1],f[2],f[3]))},c}(Rt),oi=function(a){function c(f,x){a.call(this,f,x),this.current=Oi.transparent}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.set=function(f){f.r===this.current.r&&f.g===this.current.g&&f.b===this.current.b&&f.a===this.current.a||(this.current=f,this.gl.uniform4f(this.location,f.r,f.g,f.b,f.a))},c}(Rt),ii=new Float32Array(16),hn=function(a){function c(f,x){a.call(this,f,x),this.current=ii}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.set=function(f){if(f[12]!==this.current[12]||f[0]!==this.current[0])return this.current=f,void this.gl.uniformMatrix4fv(this.location,!1,f);for(var x=1;x<16;x++)if(f[x]!==this.current[x]){this.current=f,this.gl.uniformMatrix4fv(this.location,!1,f);break}},c}(Rt);function Or(a){return[Me(255*a.r,255*a.g),Me(255*a.b,255*a.a)]}var yi=function(a,c,f){this.value=a,this.uniformNames=c.map(function(x){return"u_"+x}),this.type=f};yi.prototype.setUniform=function(a,c,f){a.set(f.constantOr(this.value))},yi.prototype.getBinding=function(a,c,f){return this.type==="color"?new oi(a,c):new ar(a,c)};var vi=function(a,c){this.uniformNames=c.map(function(f){return"u_"+f}),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1};vi.prototype.setConstantPatternPositions=function(a,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=a.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=a.tlbr},vi.prototype.setUniform=function(a,c,f,x){var S=x==="u_pattern_to"?this.patternTo:x==="u_pattern_from"?this.patternFrom:x==="u_pixel_ratio_to"?this.pixelRatioTo:x==="u_pixel_ratio_from"?this.pixelRatioFrom:null;S&&a.set(S)},vi.prototype.getBinding=function(a,c,f){return f.substr(0,9)==="u_pattern"?new ti(a,c):new ar(a,c)};var di=function(a,c,f,x){this.expression=a,this.type=f,this.maxValue=0,this.paintVertexAttributes=c.map(function(S){return{name:"a_"+S,type:"Float32",components:f==="color"?2:1,offset:0}}),this.paintVertexArray=new x};di.prototype.populatePaintArray=function(a,c,f,x,S){var I=this.paintVertexArray.length,D=this.expression.evaluate(new qi(0),c,{},x,[],S);this.paintVertexArray.resize(a),this._setPaintValue(I,a,D)},di.prototype.updatePaintArray=function(a,c,f,x){var S=this.expression.evaluate({zoom:0},f,x);this._setPaintValue(a,c,S)},di.prototype._setPaintValue=function(a,c,f){if(this.type==="color")for(var x=Or(f),S=a;S<c;S++)this.paintVertexArray.emplace(S,x[0],x[1]);else{for(var I=a;I<c;I++)this.paintVertexArray.emplace(I,f);this.maxValue=Math.max(this.maxValue,Math.abs(f))}},di.prototype.upload=function(a){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=a.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},di.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()};var pi=function(a,c,f,x,S,I){this.expression=a,this.uniformNames=c.map(function(D){return"u_"+D+"_t"}),this.type=f,this.useIntegerZoom=x,this.zoom=S,this.maxValue=0,this.paintVertexAttributes=c.map(function(D){return{name:"a_"+D,type:"Float32",components:f==="color"?4:2,offset:0}}),this.paintVertexArray=new I};pi.prototype.populatePaintArray=function(a,c,f,x,S){var I=this.expression.evaluate(new qi(this.zoom),c,{},x,[],S),D=this.expression.evaluate(new qi(this.zoom+1),c,{},x,[],S),H=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(H,a,I,D)},pi.prototype.updatePaintArray=function(a,c,f,x){var S=this.expression.evaluate({zoom:this.zoom},f,x),I=this.expression.evaluate({zoom:this.zoom+1},f,x);this._setPaintValue(a,c,S,I)},pi.prototype._setPaintValue=function(a,c,f,x){if(this.type==="color")for(var S=Or(f),I=Or(x),D=a;D<c;D++)this.paintVertexArray.emplace(D,S[0],S[1],I[0],I[1]);else{for(var H=a;H<c;H++)this.paintVertexArray.emplace(H,f,x);this.maxValue=Math.max(this.maxValue,Math.abs(f),Math.abs(x))}},pi.prototype.upload=function(a){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=a.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},pi.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},pi.prototype.setUniform=function(a,c){var f=this.useIntegerZoom?Math.floor(c.zoom):c.zoom,x=O(this.expression.interpolationFactor(f,this.zoom,this.zoom+1),0,1);a.set(x)},pi.prototype.getBinding=function(a,c,f){return new ar(a,c)};var Pi=function(a,c,f,x,S,I){this.expression=a,this.type=c,this.useIntegerZoom=f,this.zoom=x,this.layerId=I,this.zoomInPaintVertexArray=new S,this.zoomOutPaintVertexArray=new S};Pi.prototype.populatePaintArray=function(a,c,f){var x=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(a),this.zoomOutPaintVertexArray.resize(a),this._setPaintValues(x,a,c.patterns&&c.patterns[this.layerId],f)},Pi.prototype.updatePaintArray=function(a,c,f,x,S){this._setPaintValues(a,c,f.patterns&&f.patterns[this.layerId],S)},Pi.prototype._setPaintValues=function(a,c,f,x){if(x&&f){var S=x[f.min],I=x[f.mid],D=x[f.max];if(S&&I&&D)for(var H=a;H<c;H++)this.zoomInPaintVertexArray.emplace(H,I.tl[0],I.tl[1],I.br[0],I.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],I.pixelRatio,S.pixelRatio),this.zoomOutPaintVertexArray.emplace(H,I.tl[0],I.tl[1],I.br[0],I.br[1],D.tl[0],D.tl[1],D.br[0],D.br[1],I.pixelRatio,D.pixelRatio)}},Pi.prototype.upload=function(a){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=a.createVertexBuffer(this.zoomInPaintVertexArray,He.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=a.createVertexBuffer(this.zoomOutPaintVertexArray,He.members,this.expression.isStateDependent))},Pi.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()};var hi=function(a,c,f){this.binders={},this._buffers=[];var x=[];for(var S in a.paint._values)if(f(S)){var I=a.paint.get(S);if(I instanceof Ps&&$n(I.property.specification)){var D=bs(S,a.type),H=I.value,Y=I.property.specification.type,ee=I.property.useIntegerZoom,ie=I.property.specification["property-type"],se=ie==="cross-faded"||ie==="cross-faded-data-driven";if(H.kind==="constant")this.binders[S]=se?new vi(H.value,D):new yi(H.value,D,Y),x.push("/u_"+S);else if(H.kind==="source"||se){var Ae=Yn(S,Y,"source");this.binders[S]=se?new Pi(H,Y,ee,c,Ae,a.id):new di(H,D,Y,Ae),x.push("/a_"+S)}else{var Te=Yn(S,Y,"composite");this.binders[S]=new pi(H,D,Y,ee,c,Te),x.push("/z_"+S)}}}this.cacheKey=x.sort().join("")};hi.prototype.getMaxValue=function(a){var c=this.binders[a];return c instanceof di||c instanceof pi?c.maxValue:0},hi.prototype.populatePaintArrays=function(a,c,f,x,S){for(var I in this.binders){var D=this.binders[I];(D instanceof di||D instanceof pi||D instanceof Pi)&&D.populatePaintArray(a,c,f,x,S)}},hi.prototype.setConstantPatternPositions=function(a,c){for(var f in this.binders){var x=this.binders[f];x instanceof vi&&x.setConstantPatternPositions(a,c)}},hi.prototype.updatePaintArrays=function(a,c,f,x,S){var I=!1;for(var D in a)for(var H=0,Y=c.getPositions(D);H<Y.length;H+=1){var ee=Y[H],ie=f.feature(ee.index);for(var se in this.binders){var Ae=this.binders[se];if((Ae instanceof di||Ae instanceof pi||Ae instanceof Pi)&&Ae.expression.isStateDependent===!0){var Te=x.paint.get(se);Ae.expression=Te.value,Ae.updatePaintArray(ee.start,ee.end,ie,a[D],S),I=!0}}}return I},hi.prototype.defines=function(){var a=[];for(var c in this.binders){var f=this.binders[c];(f instanceof yi||f instanceof vi)&&a.push.apply(a,f.uniformNames.map(function(x){return"#define HAS_UNIFORM_"+x}))}return a},hi.prototype.getBinderAttributes=function(){var a=[];for(var c in this.binders){var f=this.binders[c];if(f instanceof di||f instanceof pi)for(var x=0;x<f.paintVertexAttributes.length;x++)a.push(f.paintVertexAttributes[x].name);else if(f instanceof Pi)for(var S=0;S<He.members.length;S++)a.push(He.members[S].name)}return a},hi.prototype.getBinderUniforms=function(){var a=[];for(var c in this.binders){var f=this.binders[c];if(f instanceof yi||f instanceof vi||f instanceof pi)for(var x=0,S=f.uniformNames;x<S.length;x+=1)a.push(S[x])}return a},hi.prototype.getPaintVertexBuffers=function(){return this._buffers},hi.prototype.getUniforms=function(a,c){var f=[];for(var x in this.binders){var S=this.binders[x];if(S instanceof yi||S instanceof vi||S instanceof pi)for(var I=0,D=S.uniformNames;I<D.length;I+=1){var H=D[I];if(c[H]){var Y=S.getBinding(a,c[H],H);f.push({name:H,property:x,binding:Y})}}}return f},hi.prototype.setUniforms=function(a,c,f,x){for(var S=0,I=c;S<I.length;S+=1){var D=I[S],H=D.name,Y=D.property;this.binders[Y].setUniform(D.binding,x,f.get(Y),H)}},hi.prototype.updatePaintBuffers=function(a){for(var c in this._buffers=[],this.binders){var f=this.binders[c];if(a&&f instanceof Pi){var x=a.fromScale===2?f.zoomInPaintVertexBuffer:f.zoomOutPaintVertexBuffer;x&&this._buffers.push(x)}else(f instanceof di||f instanceof pi)&&f.paintVertexBuffer&&this._buffers.push(f.paintVertexBuffer)}},hi.prototype.upload=function(a){for(var c in this.binders){var f=this.binders[c];(f instanceof di||f instanceof pi||f instanceof Pi)&&f.upload(a)}this.updatePaintBuffers()},hi.prototype.destroy=function(){for(var a in this.binders){var c=this.binders[a];(c instanceof di||c instanceof pi||c instanceof Pi)&&c.destroy()}};var li=function(a,c,f){f===void 0&&(f=function(){return!0}),this.programConfigurations={};for(var x=0,S=a;x<S.length;x+=1){var I=S[x];this.programConfigurations[I.id]=new hi(I,c,f)}this.needsUpload=!1,this._featureMap=new it,this._bufferOffset=0};function bs(a,c){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"]}[a]||[a.replace(c+"-","").replace(/-/g,"_")]}function Yn(a,c,f){var x={color:{source:eh,composite:yu},number:{source:gu,composite:eh}},S=function(I){return{"line-pattern":{source:mc,composite:mc},"fill-pattern":{source:mc,composite:mc},"fill-extrusion-pattern":{source:mc,composite:mc}}[I]}(a);return S&&S[f]||x[c][f]}li.prototype.populatePaintArrays=function(a,c,f,x,S,I){for(var D in this.programConfigurations)this.programConfigurations[D].populatePaintArrays(a,c,x,S,I);c.id!==void 0&&this._featureMap.add(c.id,f,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0},li.prototype.updatePaintArrays=function(a,c,f,x){for(var S=0,I=f;S<I.length;S+=1){var D=I[S];this.needsUpload=this.programConfigurations[D.id].updatePaintArrays(a,this._featureMap,c,D,x)||this.needsUpload}},li.prototype.get=function(a){return this.programConfigurations[a]},li.prototype.upload=function(a){if(this.needsUpload){for(var c in this.programConfigurations)this.programConfigurations[c].upload(a);this.needsUpload=!1}},li.prototype.destroy=function(){for(var a in this.programConfigurations)this.programConfigurations[a].destroy()},Tr("ConstantBinder",yi),Tr("CrossFadedConstantBinder",vi),Tr("SourceExpressionBinder",di),Tr("CrossFadedCompositeBinder",Pi),Tr("CompositeExpressionBinder",pi),Tr("ProgramConfiguration",hi,{omit:["_buffers"]}),Tr("ProgramConfigurationSet",li);var Ws=Math.pow(2,14)-1,ws=-Ws-1;function Io(a){for(var c=8192/a.extent,f=a.loadGeometry(),x=0;x<f.length;x++)for(var S=f[x],I=0;I<S.length;I++){var D=S[I],H=Math.round(D.x*c),Y=Math.round(D.y*c);D.x=O(H,ws,Ws),D.y=O(Y,ws,Ws),(H<D.x||H>D.x+1||Y<D.y||Y>D.y+1)&&we("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return f}function Jo(a,c){return{type:a.type,id:a.id,properties:a.properties,geometry:c?Io(a):[]}}function Wa(a,c,f,x,S){a.emplaceBack(2*c+(x+1)/2,2*f+(S+1)/2)}var pa=function(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(function(c){return c.id}),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new Wc,this.indexArray=new Ga,this.segments=new Ce,this.programConfigurations=new li(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter(function(c){return c.isStateDependent()}).map(function(c){return c.id})};function vu(a,c){for(var f=0;f<a.length;f++)if(ro(c,a[f]))return!0;for(var x=0;x<c.length;x++)if(ro(a,c[x]))return!0;return!!rd(a,c)}function Ia(a,c,f){return!!ro(a,c)||!!xu(c,a,f)}function Kl(a,c){if(a.length===1)return oh(c,a[0]);for(var f=0;f<c.length;f++)for(var x=c[f],S=0;S<x.length;S++)if(ro(a,x[S]))return!0;for(var I=0;I<a.length;I++)if(oh(c,a[I]))return!0;for(var D=0;D<c.length;D++)if(rd(a,c[D]))return!0;return!1}function Bl(a,c,f){if(a.length>1){if(rd(a,c))return!0;for(var x=0;x<c.length;x++)if(xu(c[x],a,f))return!0}for(var S=0;S<a.length;S++)if(xu(a[S],c,f))return!0;return!1}function rd(a,c){if(a.length===0||c.length===0)return!1;for(var f=0;f<a.length-1;f++)for(var x=a[f],S=a[f+1],I=0;I<c.length-1;I++)if(nh(x,S,c[I],c[I+1]))return!0;return!1}function nh(a,c,f,x){return Oe(a,f,x)!==Oe(c,f,x)&&Oe(a,c,f)!==Oe(a,c,x)}function xu(a,c,f){var x=f*f;if(c.length===1)return a.distSqr(c[0])<x;for(var S=1;S<c.length;S++)if(uf(a,c[S-1],c[S])<x)return!0;return!1}function uf(a,c,f){var x=c.distSqr(f);if(x===0)return a.distSqr(c);var S=((a.x-c.x)*(f.x-c.x)+(a.y-c.y)*(f.y-c.y))/x;return a.distSqr(S<0?c:S>1?f:f.sub(c)._mult(S)._add(c))}function oh(a,c){for(var f,x,S,I=!1,D=0;D<a.length;D++)for(var H=0,Y=(f=a[D]).length-1;H<f.length;Y=H++)(x=f[H]).y>c.y!=(S=f[Y]).y>c.y&&c.x<(S.x-x.x)*(c.y-x.y)/(S.y-x.y)+x.x&&(I=!I);return I}function ro(a,c){for(var f=!1,x=0,S=a.length-1;x<a.length;S=x++){var I=a[x],D=a[S];I.y>c.y!=D.y>c.y&&c.x<(D.x-I.x)*(c.y-I.y)/(D.y-I.y)+I.x&&(f=!f)}return f}function id(a,c,f){var x=f[0],S=f[2];if(a.x<x.x&&c.x<x.x||a.x>S.x&&c.x>S.x||a.y<x.y&&c.y<x.y||a.y>S.y&&c.y>S.y)return!1;var I=Oe(a,c,f[0]);return I!==Oe(a,c,f[1])||I!==Oe(a,c,f[2])||I!==Oe(a,c,f[3])}function gc(a,c,f){var x=c.paint.get(a).value;return x.kind==="constant"?x.value:f.programConfigurations.get(c.id).getMaxValue(a)}function Ho(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function Ts(a,c,f,x,S){if(!c[0]&&!c[1])return a;var I=u.convert(c)._mult(S);f==="viewport"&&I._rotate(-x);for(var D=[],H=0;H<a.length;H++)D.push(a[H].sub(I));return D}pa.prototype.populate=function(a,c,f){var x=this.layers[0],S=[],I=null;x.type==="circle"&&(I=x.layout.get("circle-sort-key"));for(var D=0,H=a;D<H.length;D+=1){var Y=H[D],ee=Y.feature,ie=Y.id,se=Y.index,Ae=Y.sourceLayerIndex,Te=this.layers[0]._featureFilter.needGeometry,ke=Jo(ee,Te);if(this.layers[0]._featureFilter.filter(new qi(this.zoom),ke,f)){var Ve=I?I.evaluate(ke,{},f):void 0,et={id:ie,properties:ee.properties,type:ee.type,sourceLayerIndex:Ae,index:se,geometry:Te?ke.geometry:Io(ee),patterns:{},sortKey:Ve};S.push(et)}}I&&S.sort(function(Ar,Qr){return Ar.sortKey-Qr.sortKey});for(var Xe=0,at=S;Xe<at.length;Xe+=1){var _t=at[Xe],bt=_t.geometry,Mt=_t.index,Ut=_t.sourceLayerIndex,$t=a[Mt].feature;this.addFeature(_t,bt,Mt,f),c.featureIndex.insert($t,bt,Mt,Ut,this.index)}},pa.prototype.update=function(a,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,c,this.stateDependentLayers,f)},pa.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},pa.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},pa.prototype.upload=function(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,Ee),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0},pa.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},pa.prototype.addFeature=function(a,c,f,x){for(var S=0,I=c;S<I.length;S+=1)for(var D=0,H=I[S];D<H.length;D+=1){var Y=H[D],ee=Y.x,ie=Y.y;if(!(ee<0||ee>=8192||ie<0||ie>=8192)){var se=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,a.sortKey),Ae=se.vertexLength;Wa(this.layoutVertexArray,ee,ie,-1,-1),Wa(this.layoutVertexArray,ee,ie,1,-1),Wa(this.layoutVertexArray,ee,ie,1,1),Wa(this.layoutVertexArray,ee,ie,-1,1),this.indexArray.emplaceBack(Ae,Ae+1,Ae+2),this.indexArray.emplaceBack(Ae,Ae+3,Ae+2),se.vertexLength+=4,se.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,f,{},x)},Tr("CircleBucket",pa,{omit:["layers"]});var bu=new Rs({"circle-sort-key":new zr(Se.layout_circle["circle-sort-key"])}),ff={paint:new Rs({"circle-radius":new zr(Se.paint_circle["circle-radius"]),"circle-color":new zr(Se.paint_circle["circle-color"]),"circle-blur":new zr(Se.paint_circle["circle-blur"]),"circle-opacity":new zr(Se.paint_circle["circle-opacity"]),"circle-translate":new ei(Se.paint_circle["circle-translate"]),"circle-translate-anchor":new ei(Se.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ei(Se.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ei(Se.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new zr(Se.paint_circle["circle-stroke-width"]),"circle-stroke-color":new zr(Se.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new zr(Se.paint_circle["circle-stroke-opacity"])}),layout:bu},Cn=typeof Float32Array<"u"?Float32Array:Array;function qa(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function Aa(a,c,f){var x=c[0],S=c[1],I=c[2],D=c[3],H=c[4],Y=c[5],ee=c[6],ie=c[7],se=c[8],Ae=c[9],Te=c[10],ke=c[11],Ve=c[12],et=c[13],Xe=c[14],at=c[15],_t=f[0],bt=f[1],Mt=f[2],Ut=f[3];return a[0]=_t*x+bt*H+Mt*se+Ut*Ve,a[1]=_t*S+bt*Y+Mt*Ae+Ut*et,a[2]=_t*I+bt*ee+Mt*Te+Ut*Xe,a[3]=_t*D+bt*ie+Mt*ke+Ut*at,a[4]=(_t=f[4])*x+(bt=f[5])*H+(Mt=f[6])*se+(Ut=f[7])*Ve,a[5]=_t*S+bt*Y+Mt*Ae+Ut*et,a[6]=_t*I+bt*ee+Mt*Te+Ut*Xe,a[7]=_t*D+bt*ie+Mt*ke+Ut*at,a[8]=(_t=f[8])*x+(bt=f[9])*H+(Mt=f[10])*se+(Ut=f[11])*Ve,a[9]=_t*S+bt*Y+Mt*Ae+Ut*et,a[10]=_t*I+bt*ee+Mt*Te+Ut*Xe,a[11]=_t*D+bt*ie+Mt*ke+Ut*at,a[12]=(_t=f[12])*x+(bt=f[13])*H+(Mt=f[14])*se+(Ut=f[15])*Ve,a[13]=_t*S+bt*Y+Mt*Ae+Ut*et,a[14]=_t*I+bt*ee+Mt*Te+Ut*Xe,a[15]=_t*D+bt*ie+Mt*ke+Ut*at,a}Math.hypot||(Math.hypot=function(){for(var a=arguments,c=0,f=arguments.length;f--;)c+=a[f]*a[f];return Math.sqrt(c)});var wu,Kg=Aa;function dp(a,c,f){var x=c[0],S=c[1],I=c[2],D=c[3];return a[0]=f[0]*x+f[4]*S+f[8]*I+f[12]*D,a[1]=f[1]*x+f[5]*S+f[9]*I+f[13]*D,a[2]=f[2]*x+f[6]*S+f[10]*I+f[14]*D,a[3]=f[3]*x+f[7]*S+f[11]*I+f[15]*D,a}wu=new Cn(3),Cn!=Float32Array&&(wu[0]=0,wu[1]=0,wu[2]=0),function(){var a=new Cn(4);Cn!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[3]=0)}();var hv=(function(){var a=new Cn(2);Cn!=Float32Array&&(a[0]=0,a[1]=0)}(),function(a){function c(f){a.call(this,f,ff)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.createBucket=function(f){return new pa(f)},c.prototype.queryRadius=function(f){var x=f;return gc("circle-radius",this,x)+gc("circle-stroke-width",this,x)+Ho(this.paint.get("circle-translate"))},c.prototype.queryIntersectsFeature=function(f,x,S,I,D,H,Y,ee){for(var ie=Ts(f,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),H.angle,Y),se=this.paint.get("circle-radius").evaluate(x,S)+this.paint.get("circle-stroke-width").evaluate(x,S),Ae=this.paint.get("circle-pitch-alignment")==="map",Te=Ae?ie:function($t,Ar){return $t.map(function(Qr){return nd(Qr,Ar)})}(ie,ee),ke=Ae?se*Y:se,Ve=0,et=I;Ve<et.length;Ve+=1)for(var Xe=0,at=et[Ve];Xe<at.length;Xe+=1){var _t=at[Xe],bt=Ae?_t:nd(_t,ee),Mt=ke,Ut=dp([],[_t.x,_t.y,0,1],ee);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Mt*=Ut[3]/H.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Mt*=H.cameraToCenterDistance/Ut[3]),Ia(Te,bt,Mt))return!0}return!1},c}(Ma));function nd(a,c){var f=dp([],[a.x,a.y,0,1],c);return new u(f[0]/f[3],f[1]/f[3])}var Zg=function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c}(pa);function sh(a,c,f,x){var S=c.width,I=c.height;if(x){if(x instanceof Uint8ClampedArray)x=new Uint8Array(x.buffer);else if(x.length!==S*I*f)throw new RangeError("mismatched image size")}else x=new Uint8Array(S*I*f);return a.width=S,a.height=I,a.data=x,a}function Zl(a,c,f){var x=c.width,S=c.height;if(x!==a.width||S!==a.height){var I=sh({},{width:x,height:S},f);_c(a,I,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,x),height:Math.min(a.height,S)},f),a.width=x,a.height=S,a.data=I.data}}function _c(a,c,f,x,S,I){if(S.width===0||S.height===0)return c;if(S.width>a.width||S.height>a.height||f.x>a.width-S.width||f.y>a.height-S.height)throw new RangeError("out of range source coordinates for image copy");if(S.width>c.width||S.height>c.height||x.x>c.width-S.width||x.y>c.height-S.height)throw new RangeError("out of range destination coordinates for image copy");for(var D=a.data,H=c.data,Y=0;Y<S.height;Y++)for(var ee=((f.y+Y)*a.width+f.x)*I,ie=((x.y+Y)*c.width+x.x)*I,se=0;se<S.width*I;se++)H[ie+se]=D[ee+se];return c}Tr("HeatmapBucket",Zg,{omit:["layers"]});var Mi=function(a,c){sh(this,a,1,c)};Mi.prototype.resize=function(a){Zl(this,a,1)},Mi.prototype.clone=function(){return new Mi({width:this.width,height:this.height},new Uint8Array(this.data))},Mi.copy=function(a,c,f,x,S){_c(a,c,f,x,S,1)};var Qo=function(a,c){sh(this,a,4,c)};Qo.prototype.resize=function(a){Zl(this,a,4)},Qo.prototype.replace=function(a,c){c?this.data.set(a):this.data=a instanceof Uint8ClampedArray?new Uint8Array(a.buffer):a},Qo.prototype.clone=function(){return new Qo({width:this.width,height:this.height},new Uint8Array(this.data))},Qo.copy=function(a,c,f,x,S){_c(a,c,f,x,S,4)},Tr("AlphaImage",Mi),Tr("RGBAImage",Qo);var bn={paint:new Rs({"heatmap-radius":new zr(Se.paint_heatmap["heatmap-radius"]),"heatmap-weight":new zr(Se.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ei(Se.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ml(Se.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ei(Se.paint_heatmap["heatmap-opacity"])})};function Pa(a){var c={},f=a.resolution||256,x=a.clips?a.clips.length:1,S=a.image||new Qo({width:f,height:x}),I=function(ke,Ve,et){c[a.evaluationKey]=et;var Xe=a.expression.evaluate(c);S.data[ke+Ve+0]=Math.floor(255*Xe.r/Xe.a),S.data[ke+Ve+1]=Math.floor(255*Xe.g/Xe.a),S.data[ke+Ve+2]=Math.floor(255*Xe.b/Xe.a),S.data[ke+Ve+3]=Math.floor(255*Xe.a)};if(a.clips)for(var D=0,H=0;D<x;++D,H+=4*f)for(var Y=0,ee=0;Y<f;Y++,ee+=4){var ie=Y/(f-1),se=a.clips[D];I(H,ee,se.start*(1-ie)+se.end*ie)}else for(var Ae=0,Te=0;Ae<f;Ae++,Te+=4)I(0,Te,Ae/(f-1));return S}var Xw=function(a){function c(f){a.call(this,f,bn),this._updateColorRamp()}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.createBucket=function(f){return new Zg(f)},c.prototype._handleSpecialPaintPropertyUpdate=function(f){f==="heatmap-color"&&this._updateColorRamp()},c.prototype._updateColorRamp=function(){this.colorRamp=Pa({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null},c.prototype.resize=function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)},c.prototype.queryRadius=function(){return 0},c.prototype.queryIntersectsFeature=function(){return!1},c.prototype.hasOffscreenPass=function(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"},c}(Ma),dv={paint:new Rs({"hillshade-illumination-direction":new ei(Se.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ei(Se.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ei(Se.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ei(Se.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ei(Se.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ei(Se.paint_hillshade["hillshade-accent-color"])})},od=function(a){function c(f){a.call(this,f,dv)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.hasOffscreenPass=function(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"},c}(Ma),eP=Bs([{name:"a_pos",components:2,type:"Int16"}],4).members,ma=hf,Jg=hf;function hf(a,c,f){f=f||2;var x,S,I,D,H,Y,ee,ie=c&&c.length,se=ie?c[0]*f:a.length,Ae=pv(a,0,se,f,!0),Te=[];if(!Ae||Ae.next===Ae.prev)return Te;if(ie&&(Ae=function(Ve,et,Xe,at){var _t,bt,Mt,Ut=[];for(_t=0,bt=et.length;_t<bt;_t++)(Mt=pv(Ve,et[_t]*at,_t<bt-1?et[_t+1]*at:Ve.length,at,!1))===Mt.next&&(Mt.steiner=!0),Ut.push(A(Mt));for(Ut.sort(sd),_t=0;_t<Ut.length;_t++)Kw(Ut[_t],Xe),Xe=nr(Xe,Xe.next);return Xe}(a,c,Ae,f)),a.length>80*f){x=I=a[0],S=D=a[1];for(var ke=f;ke<se;ke+=f)(H=a[ke])<x&&(x=H),(Y=a[ke+1])<S&&(S=Y),H>I&&(I=H),Y>D&&(D=Y);ee=(ee=Math.max(I-x,D-S))!==0?1/ee:0}return Sr(Ae,Te,f,x,S,ee),Te}function pv(a,c,f,x,S){var I,D;if(S===Ye(a,c,f,x)>0)for(I=c;I<f;I+=x)D=De(I,a[I],a[I+1],D);else for(I=f-x;I>=c;I-=x)D=De(I,a[I],a[I+1],D);return D&&R(D,D.next)&&($e(D),D=D.next),D}function nr(a,c){if(!a)return a;c||(c=a);var f,x=a;do if(f=!1,x.steiner||!R(x,x.next)&&C(x.prev,x,x.next)!==0)x=x.next;else{if($e(x),(x=c=x.prev)===x.next)break;f=!0}while(f||x!==c);return c}function Sr(a,c,f,x,S,I,D){if(a){!D&&I&&function(ie,se,Ae,Te){var ke=ie;do ke.z===null&&(ke.z=m(ke.x,ke.y,se,Ae,Te)),ke.prevZ=ke.prev,ke.nextZ=ke.next,ke=ke.next;while(ke!==ie);ke.prevZ.nextZ=null,ke.prevZ=null,function(Ve){var et,Xe,at,_t,bt,Mt,Ut,$t,Ar=1;do{for(Xe=Ve,Ve=null,bt=null,Mt=0;Xe;){for(Mt++,at=Xe,Ut=0,et=0;et<Ar&&(Ut++,at=at.nextZ);et++);for($t=Ar;Ut>0||$t>0&&at;)Ut!==0&&($t===0||!at||Xe.z<=at.z)?(_t=Xe,Xe=Xe.nextZ,Ut--):(_t=at,at=at.nextZ,$t--),bt?bt.nextZ=_t:Ve=_t,_t.prevZ=bt,bt=_t;Xe=at}bt.nextZ=null,Ar*=2}while(Mt>1)}(ke)}(a,x,S,I);for(var H,Y,ee=a;a.prev!==a.next;)if(H=a.prev,Y=a.next,I?Av(a,x,S,I):Yw(a))c.push(H.i/f),c.push(a.i/f),c.push(Y.i/f),$e(a),a=Y.next,ee=Y.next;else if((a=Y)===ee){D?D===1?Sr(a=Qg(nr(a),c,f),c,f,x,S,I,2):D===2&&$g(a,c,f,x,S,I):Sr(nr(a),c,f,x,S,I,1);break}}}function Yw(a){var c=a.prev,f=a,x=a.next;if(C(c,f,x)>=0)return!1;for(var S=a.next.next;S!==a.prev;){if(y(c.x,c.y,f.x,f.y,x.x,x.y,S.x,S.y)&&C(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function Av(a,c,f,x){var S=a.prev,I=a,D=a.next;if(C(S,I,D)>=0)return!1;for(var H=S.x>I.x?S.x>D.x?S.x:D.x:I.x>D.x?I.x:D.x,Y=S.y>I.y?S.y>D.y?S.y:D.y:I.y>D.y?I.y:D.y,ee=m(S.x<I.x?S.x<D.x?S.x:D.x:I.x<D.x?I.x:D.x,S.y<I.y?S.y<D.y?S.y:D.y:I.y<D.y?I.y:D.y,c,f,x),ie=m(H,Y,c,f,x),se=a.prevZ,Ae=a.nextZ;se&&se.z>=ee&&Ae&&Ae.z<=ie;){if(se!==a.prev&&se!==a.next&&y(S.x,S.y,I.x,I.y,D.x,D.y,se.x,se.y)&&C(se.prev,se,se.next)>=0||(se=se.prevZ,Ae!==a.prev&&Ae!==a.next&&y(S.x,S.y,I.x,I.y,D.x,D.y,Ae.x,Ae.y)&&C(Ae.prev,Ae,Ae.next)>=0))return!1;Ae=Ae.nextZ}for(;se&&se.z>=ee;){if(se!==a.prev&&se!==a.next&&y(S.x,S.y,I.x,I.y,D.x,D.y,se.x,se.y)&&C(se.prev,se,se.next)>=0)return!1;se=se.prevZ}for(;Ae&&Ae.z<=ie;){if(Ae!==a.prev&&Ae!==a.next&&y(S.x,S.y,I.x,I.y,D.x,D.y,Ae.x,Ae.y)&&C(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.nextZ}return!0}function Qg(a,c,f){var x=a;do{var S=x.prev,I=x.next.next;!R(S,I)&&L(S,x,x.next,I)&&te(S,I)&&te(I,S)&&(c.push(S.i/f),c.push(x.i/f),c.push(I.i/f),$e(x),$e(x.next),x=a=I),x=x.next}while(x!==a);return nr(x)}function $g(a,c,f,x,S,I){var D=a;do{for(var H=D.next.next;H!==D.prev;){if(D.i!==H.i&&w(D,H)){var Y=pe(D,H);return D=nr(D,D.next),Y=nr(Y,Y.next),Sr(D,c,f,x,S,I),void Sr(Y,c,f,x,S,I)}H=H.next}D=D.next}while(D!==a)}function sd(a,c){return a.x-c.x}function Kw(a,c){if(c=function(x,S){var I,D=S,H=x.x,Y=x.y,ee=-1/0;do{if(Y<=D.y&&Y>=D.next.y&&D.next.y!==D.y){var ie=D.x+(Y-D.y)*(D.next.x-D.x)/(D.next.y-D.y);if(ie<=H&&ie>ee){if(ee=ie,ie===H){if(Y===D.y)return D;if(Y===D.next.y)return D.next}I=D.x<D.next.x?D:D.next}}D=D.next}while(D!==S);if(!I)return null;if(H===ee)return I;var se,Ae=I,Te=I.x,ke=I.y,Ve=1/0;D=I;do H>=D.x&&D.x>=Te&&H!==D.x&&y(Y<ke?H:ee,Y,Te,ke,Y<ke?ee:H,Y,D.x,D.y)&&(se=Math.abs(Y-D.y)/(H-D.x),te(D,x)&&(se<Ve||se===Ve&&(D.x>I.x||D.x===I.x&&ah(I,D)))&&(I=D,Ve=se)),D=D.next;while(D!==Ae);return I}(a,c)){var f=pe(c,a);nr(c,c.next),nr(f,f.next)}}function ah(a,c){return C(a.prev,a,c.prev)<0&&C(c.next,a,a.next)<0}function m(a,c,f,x,S){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=32767*(a-f)*S)|a<<8))|a<<4))|a<<2))|a<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=32767*(c-x)*S)|c<<8))|c<<4))|c<<2))|c<<1))<<1}function A(a){var c=a,f=a;do(c.x<f.x||c.x===f.x&&c.y<f.y)&&(f=c),c=c.next;while(c!==a);return f}function y(a,c,f,x,S,I,D,H){return(S-D)*(c-H)-(a-D)*(I-H)>=0&&(a-D)*(x-H)-(f-D)*(c-H)>=0&&(f-D)*(I-H)-(S-D)*(x-H)>=0}function w(a,c){return a.next.i!==c.i&&a.prev.i!==c.i&&!function(f,x){var S=f;do{if(S.i!==f.i&&S.next.i!==f.i&&S.i!==x.i&&S.next.i!==x.i&&L(S,S.next,f,x))return!0;S=S.next}while(S!==f);return!1}(a,c)&&(te(a,c)&&te(c,a)&&function(f,x){var S=f,I=!1,D=(f.x+x.x)/2,H=(f.y+x.y)/2;do S.y>H!=S.next.y>H&&S.next.y!==S.y&&D<(S.next.x-S.x)*(H-S.y)/(S.next.y-S.y)+S.x&&(I=!I),S=S.next;while(S!==f);return I}(a,c)&&(C(a.prev,a,c.prev)||C(a,c.prev,c))||R(a,c)&&C(a.prev,a,a.next)>0&&C(c.prev,c,c.next)>0)}function C(a,c,f){return(c.y-a.y)*(f.x-c.x)-(c.x-a.x)*(f.y-c.y)}function R(a,c){return a.x===c.x&&a.y===c.y}function L(a,c,f,x){var S=X(C(a,c,f)),I=X(C(a,c,x)),D=X(C(f,x,a)),H=X(C(f,x,c));return S!==I&&D!==H||!(S!==0||!N(a,f,c))||!(I!==0||!N(a,x,c))||!(D!==0||!N(f,a,x))||!(H!==0||!N(f,c,x))}function N(a,c,f){return c.x<=Math.max(a.x,f.x)&&c.x>=Math.min(a.x,f.x)&&c.y<=Math.max(a.y,f.y)&&c.y>=Math.min(a.y,f.y)}function X(a){return a>0?1:a<0?-1:0}function te(a,c){return C(a.prev,a,a.next)<0?C(a,c,a.next)>=0&&C(a,a.prev,c)>=0:C(a,c,a.prev)<0||C(a,a.next,c)<0}function pe(a,c){var f=new nt(a.i,a.x,a.y),x=new nt(c.i,c.x,c.y),S=a.next,I=c.prev;return a.next=c,c.prev=a,f.next=S,S.prev=f,x.next=f,f.prev=x,I.next=x,x.prev=I,x}function De(a,c,f,x){var S=new nt(a,c,f);return x?(S.next=x.next,S.prev=x,x.next.prev=S,x.next=S):(S.prev=S,S.next=S),S}function $e(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function nt(a,c,f){this.i=a,this.x=c,this.y=f,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ye(a,c,f,x){for(var S=0,I=c,D=f-x;I<f;I+=x)S+=(a[D]-a[I])*(a[I+1]+a[D+1]),D=I;return S}function yt(a,c,f,x,S){(function I(D,H,Y,ee,ie){for(;ee>Y;){if(ee-Y>600){var se=ee-Y+1,Ae=H-Y+1,Te=Math.log(se),ke=.5*Math.exp(2*Te/3),Ve=.5*Math.sqrt(Te*ke*(se-ke)/se)*(Ae-se/2<0?-1:1);I(D,H,Math.max(Y,Math.floor(H-Ae*ke/se+Ve)),Math.min(ee,Math.floor(H+(se-Ae)*ke/se+Ve)),ie)}var et=D[H],Xe=Y,at=ee;for(zt(D,Y,H),ie(D[ee],et)>0&&zt(D,Y,ee);Xe<at;){for(zt(D,Xe,at),Xe++,at--;ie(D[Xe],et)<0;)Xe++;for(;ie(D[at],et)>0;)at--}ie(D[Y],et)===0?zt(D,Y,at):zt(D,++at,ee),at<=H&&(Y=at+1),H<=at&&(ee=at-1)}})(a,c,f||0,x||a.length-1,S||kt)}function zt(a,c,f){var x=a[c];a[c]=a[f],a[f]=x}function kt(a,c){return a<c?-1:a>c?1:0}function Et(a,c){var f=a.length;if(f<=1)return[a];for(var x,S,I=[],D=0;D<f;D++){var H=he(a[D]);H!==0&&(a[D].area=Math.abs(H),S===void 0&&(S=H<0),S===H<0?(x&&I.push(x),x=[a[D]]):x.push(a[D]))}if(x&&I.push(x),c>1)for(var Y=0;Y<I.length;Y++)I[Y].length<=c||(yt(I[Y],c,1,I[Y].length-1,Bt),I[Y]=I[Y].slice(0,c));return I}function Bt(a,c){return c.area-a.area}function gt(a,c,f){for(var x=f.patternDependencies,S=!1,I=0,D=c;I<D.length;I+=1){var H=D[I].paint.get(a+"-pattern");H.isConstant()||(S=!0);var Y=H.constantOr(null);Y&&(S=!0,x[Y.to]=!0,x[Y.from]=!0)}return S}function Fr(a,c,f,x,S){for(var I=S.patternDependencies,D=0,H=c;D<H.length;D+=1){var Y=H[D],ee=Y.paint.get(a+"-pattern").value;if(ee.kind!=="constant"){var ie=ee.evaluate({zoom:x-1},f,{},S.availableImages),se=ee.evaluate({zoom:x},f,{},S.availableImages),Ae=ee.evaluate({zoom:x+1},f,{},S.availableImages);se=se&&se.name?se.name:se,Ae=Ae&&Ae.name?Ae.name:Ae,I[ie=ie&&ie.name?ie.name:ie]=!0,I[se]=!0,I[Ae]=!0,f.patterns[Y.id]={min:ie,mid:se,max:Ae}}}return f}hf.deviation=function(a,c,f,x){var S=c&&c.length,I=Math.abs(Ye(a,0,S?c[0]*f:a.length,f));if(S)for(var D=0,H=c.length;D<H;D++)I-=Math.abs(Ye(a,c[D]*f,D<H-1?c[D+1]*f:a.length,f));var Y=0;for(D=0;D<x.length;D+=3){var ee=x[D]*f,ie=x[D+1]*f,se=x[D+2]*f;Y+=Math.abs((a[ee]-a[se])*(a[ie+1]-a[ee+1])-(a[ee]-a[ie])*(a[se+1]-a[ee+1]))}return I===0&&Y===0?0:Math.abs((Y-I)/I)},hf.flatten=function(a){for(var c=a[0][0].length,f={vertices:[],holes:[],dimensions:c},x=0,S=0;S<a.length;S++){for(var I=0;I<a[S].length;I++)for(var D=0;D<c;D++)f.vertices.push(a[S][I][D]);S>0&&f.holes.push(x+=a[S-1].length)}return f},ma.default=Jg;var Nr=function(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(function(c){return c.id}),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Wc,this.indexArray=new Ga,this.indexArray2=new cf,this.programConfigurations=new li(a.layers,a.zoom),this.segments=new Ce,this.segments2=new Ce,this.stateDependentLayerIds=this.layers.filter(function(c){return c.isStateDependent()}).map(function(c){return c.id})};Nr.prototype.populate=function(a,c,f){this.hasPattern=gt("fill",this.layers,c);for(var x=this.layers[0].layout.get("fill-sort-key"),S=[],I=0,D=a;I<D.length;I+=1){var H=D[I],Y=H.feature,ee=H.id,ie=H.index,se=H.sourceLayerIndex,Ae=this.layers[0]._featureFilter.needGeometry,Te=Jo(Y,Ae);if(this.layers[0]._featureFilter.filter(new qi(this.zoom),Te,f)){var ke=x?x.evaluate(Te,{},f,c.availableImages):void 0,Ve={id:ee,properties:Y.properties,type:Y.type,sourceLayerIndex:se,index:ie,geometry:Ae?Te.geometry:Io(Y),patterns:{},sortKey:ke};S.push(Ve)}}x&&S.sort(function($t,Ar){return $t.sortKey-Ar.sortKey});for(var et=0,Xe=S;et<Xe.length;et+=1){var at=Xe[et],_t=at.geometry,bt=at.index,Mt=at.sourceLayerIndex;if(this.hasPattern){var Ut=Fr("fill",this.layers,at,this.zoom,c);this.patternFeatures.push(Ut)}else this.addFeature(at,_t,bt,f,{});c.featureIndex.insert(a[bt].feature,_t,bt,Mt,this.index)}},Nr.prototype.update=function(a,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,c,this.stateDependentLayers,f)},Nr.prototype.addFeatures=function(a,c,f){for(var x=0,S=this.patternFeatures;x<S.length;x+=1){var I=S[x];this.addFeature(I,I.geometry,I.index,c,f)}},Nr.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},Nr.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Nr.prototype.upload=function(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,eP),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.indexBuffer2=a.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(a),this.uploaded=!0},Nr.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},Nr.prototype.addFeature=function(a,c,f,x,S){for(var I=0,D=Et(c,500);I<D.length;I+=1){for(var H=D[I],Y=0,ee=0,ie=H;ee<ie.length;ee+=1)Y+=ie[ee].length;for(var se=this.segments.prepareSegment(Y,this.layoutVertexArray,this.indexArray),Ae=se.vertexLength,Te=[],ke=[],Ve=0,et=H;Ve<et.length;Ve+=1){var Xe=et[Ve];if(Xe.length!==0){Xe!==H[0]&&ke.push(Te.length/2);var at=this.segments2.prepareSegment(Xe.length,this.layoutVertexArray,this.indexArray2),_t=at.vertexLength;this.layoutVertexArray.emplaceBack(Xe[0].x,Xe[0].y),this.indexArray2.emplaceBack(_t+Xe.length-1,_t),Te.push(Xe[0].x),Te.push(Xe[0].y);for(var bt=1;bt<Xe.length;bt++)this.layoutVertexArray.emplaceBack(Xe[bt].x,Xe[bt].y),this.indexArray2.emplaceBack(_t+bt-1,_t+bt),Te.push(Xe[bt].x),Te.push(Xe[bt].y);at.vertexLength+=Xe.length,at.primitiveLength+=Xe.length}}for(var Mt=ma(Te,ke),Ut=0;Ut<Mt.length;Ut+=3)this.indexArray.emplaceBack(Ae+Mt[Ut],Ae+Mt[Ut+1],Ae+Mt[Ut+2]);se.vertexLength+=Y,se.primitiveLength+=Mt.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,f,S,x)},Tr("FillBucket",Nr,{omit:["layers","patternFeatures"]});var Rr=new Rs({"fill-sort-key":new zr(Se.layout_fill["fill-sort-key"])}),Vr={paint:new Rs({"fill-antialias":new ei(Se.paint_fill["fill-antialias"]),"fill-opacity":new zr(Se.paint_fill["fill-opacity"]),"fill-color":new zr(Se.paint_fill["fill-color"]),"fill-outline-color":new zr(Se.paint_fill["fill-outline-color"]),"fill-translate":new ei(Se.paint_fill["fill-translate"]),"fill-translate-anchor":new ei(Se.paint_fill["fill-translate-anchor"]),"fill-pattern":new Au(Se.paint_fill["fill-pattern"])}),layout:Rr},io=function(a){function c(f){a.call(this,f,Vr)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.recalculate=function(f,x){a.prototype.recalculate.call(this,f,x);var S=this.paint._values["fill-outline-color"];S.value.kind==="constant"&&S.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},c.prototype.createBucket=function(f){return new Nr(f)},c.prototype.queryRadius=function(){return Ho(this.paint.get("fill-translate"))},c.prototype.queryIntersectsFeature=function(f,x,S,I,D,H,Y){return Kl(Ts(f,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),H.angle,Y),I)},c.prototype.isTileClipped=function(){return!0},c}(Ma),Vn=Bs([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4).members,Hn=Ui;function Ui(a,c,f,x,S){this.properties={},this.extent=f,this.type=0,this._pbf=a,this._geometry=-1,this._keys=x,this._values=S,a.readFields(tn,this,c)}function tn(a,c,f){a==1?c.id=f.readVarint():a==2?function(x,S){for(var I=x.readVarint()+x.pos;x.pos<I;){var D=S._keys[x.readVarint()],H=S._values[x.readVarint()];S.properties[D]=H}}(f,c):a==3?c.type=f.readVarint():a==4&&(c._geometry=f.pos)}function cn(a){for(var c,f,x=0,S=0,I=a.length,D=I-1;S<I;D=S++)x+=((f=a[D]).x-(c=a[S]).x)*(c.y+f.y);return x}Ui.types=["Unknown","Point","LineString","Polygon"],Ui.prototype.loadGeometry=function(){var a=this._pbf;a.pos=this._geometry;for(var c,f=a.readVarint()+a.pos,x=1,S=0,I=0,D=0,H=[];a.pos<f;){if(S<=0){var Y=a.readVarint();x=7&Y,S=Y>>3}if(S--,x===1||x===2)I+=a.readSVarint(),D+=a.readSVarint(),x===1&&(c&&H.push(c),c=[]),c.push(new u(I,D));else{if(x!==7)throw new Error("unknown command "+x);c&&c.push(c[0].clone())}}return c&&H.push(c),H},Ui.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var c=a.readVarint()+a.pos,f=1,x=0,S=0,I=0,D=1/0,H=-1/0,Y=1/0,ee=-1/0;a.pos<c;){if(x<=0){var ie=a.readVarint();f=7&ie,x=ie>>3}if(x--,f===1||f===2)(S+=a.readSVarint())<D&&(D=S),S>H&&(H=S),(I+=a.readSVarint())<Y&&(Y=I),I>ee&&(ee=I);else if(f!==7)throw new Error("unknown command "+f)}return[D,Y,H,ee]},Ui.prototype.toGeoJSON=function(a,c,f){var x,S,I=this.extent*Math.pow(2,f),D=this.extent*a,H=this.extent*c,Y=this.loadGeometry(),ee=Ui.types[this.type];function ie(Te){for(var ke=0;ke<Te.length;ke++){var Ve=Te[ke];Te[ke]=[360*(Ve.x+D)/I-180,360/Math.PI*Math.atan(Math.exp((180-360*(Ve.y+H)/I)*Math.PI/180))-90]}}switch(this.type){case 1:var se=[];for(x=0;x<Y.length;x++)se[x]=Y[x][0];ie(Y=se);break;case 2:for(x=0;x<Y.length;x++)ie(Y[x]);break;case 3:for(Y=function(Te){var ke=Te.length;if(ke<=1)return[Te];for(var Ve,et,Xe=[],at=0;at<ke;at++){var _t=cn(Te[at]);_t!==0&&(et===void 0&&(et=_t<0),et===_t<0?(Ve&&Xe.push(Ve),Ve=[Te[at]]):Ve.push(Te[at]))}return Ve&&Xe.push(Ve),Xe}(Y),x=0;x<Y.length;x++)for(S=0;S<Y[x].length;S++)ie(Y[x][S])}Y.length===1?Y=Y[0]:ee="Multi"+ee;var Ae={type:"Feature",geometry:{type:ee,coordinates:Y},properties:this.properties};return"id"in this&&(Ae.id=this.id),Ae};var co=zi;function zi(a,c){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=a,this._keys=[],this._values=[],this._features=[],a.readFields(Po,this,c),this.length=this._features.length}function Po(a,c,f){a===15?c.version=f.readVarint():a===1?c.name=f.readString():a===5?c.extent=f.readVarint():a===2?c._features.push(f.pos):a===3?c._keys.push(f.readString()):a===4&&c._values.push(function(x){for(var S=null,I=x.readVarint()+x.pos;x.pos<I;){var D=x.readVarint()>>3;S=D===1?x.readString():D===2?x.readFloat():D===3?x.readDouble():D===4?x.readVarint64():D===5?x.readVarint():D===6?x.readSVarint():D===7?x.readBoolean():null}return S}(f))}function gl(a,c,f){if(a===3){var x=new co(f,f.readVarint()+f.pos);x.length&&(c[x.name]=x)}}zi.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var c=this._pbf.readVarint()+this._pbf.pos;return new Hn(this._pbf,c,this.extent,this._keys,this._values)};var ad={VectorTile:function(a,c){this.layers=a.readFields(gl,{},c)},VectorTileFeature:Hn,VectorTileLayer:co},ete=ad.VectorTileFeature.types,tP=Math.pow(2,13);function mv(a,c,f,x,S,I,D,H){a.emplaceBack(c,f,2*Math.floor(x*tP)+D,S*tP*2,I*tP*2,Math.round(H))}var df=function(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(function(c){return c.id}),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new Rl,this.indexArray=new Ga,this.programConfigurations=new li(a.layers,a.zoom),this.segments=new Ce,this.stateDependentLayerIds=this.layers.filter(function(c){return c.isStateDependent()}).map(function(c){return c.id})};function tte(a,c){return a.x===c.x&&(a.x<0||a.x>8192)||a.y===c.y&&(a.y<0||a.y>8192)}df.prototype.populate=function(a,c,f){this.features=[],this.hasPattern=gt("fill-extrusion",this.layers,c);for(var x=0,S=a;x<S.length;x+=1){var I=S[x],D=I.feature,H=I.id,Y=I.index,ee=I.sourceLayerIndex,ie=this.layers[0]._featureFilter.needGeometry,se=Jo(D,ie);if(this.layers[0]._featureFilter.filter(new qi(this.zoom),se,f)){var Ae={id:H,sourceLayerIndex:ee,index:Y,geometry:ie?se.geometry:Io(D),properties:D.properties,type:D.type,patterns:{}};this.hasPattern?this.features.push(Fr("fill-extrusion",this.layers,Ae,this.zoom,c)):this.addFeature(Ae,Ae.geometry,Y,f,{}),c.featureIndex.insert(D,Ae.geometry,Y,ee,this.index,!0)}}},df.prototype.addFeatures=function(a,c,f){for(var x=0,S=this.features;x<S.length;x+=1){var I=S[x];this.addFeature(I,I.geometry,I.index,c,f)}},df.prototype.update=function(a,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,c,this.stateDependentLayers,f)},df.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},df.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},df.prototype.upload=function(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,Vn),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0},df.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},df.prototype.addFeature=function(a,c,f,x,S){for(var I=0,D=Et(c,500);I<D.length;I+=1){for(var H=D[I],Y=0,ee=0,ie=H;ee<ie.length;ee+=1)Y+=ie[ee].length;for(var se=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),Ae=0,Te=H;Ae<Te.length;Ae+=1){var ke=Te[Ae];if(ke.length!==0&&!((rn=ke).every(function(Ri){return Ri.x<0})||rn.every(function(Ri){return Ri.x>8192})||rn.every(function(Ri){return Ri.y<0})||rn.every(function(Ri){return Ri.y>8192})))for(var Ve=0,et=0;et<ke.length;et++){var Xe=ke[et];if(et>=1){var at=ke[et-1];if(!tte(Xe,at)){se.vertexLength+4>Ce.MAX_VERTEX_ARRAY_LENGTH&&(se=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var _t=Xe.sub(at)._perp()._unit(),bt=at.dist(Xe);Ve+bt>32768&&(Ve=0),mv(this.layoutVertexArray,Xe.x,Xe.y,_t.x,_t.y,0,0,Ve),mv(this.layoutVertexArray,Xe.x,Xe.y,_t.x,_t.y,0,1,Ve),mv(this.layoutVertexArray,at.x,at.y,_t.x,_t.y,0,0,Ve+=bt),mv(this.layoutVertexArray,at.x,at.y,_t.x,_t.y,0,1,Ve);var Mt=se.vertexLength;this.indexArray.emplaceBack(Mt,Mt+2,Mt+1),this.indexArray.emplaceBack(Mt+1,Mt+2,Mt+3),se.vertexLength+=4,se.primitiveLength+=2}}}}if(se.vertexLength+Y>Ce.MAX_VERTEX_ARRAY_LENGTH&&(se=this.segments.prepareSegment(Y,this.layoutVertexArray,this.indexArray)),ete[a.type]==="Polygon"){for(var Ut=[],$t=[],Ar=se.vertexLength,Qr=0,Cr=H;Qr<Cr.length;Qr+=1){var ni=Cr[Qr];if(ni.length!==0){ni!==H[0]&&$t.push(Ut.length/2);for(var Pr=0;Pr<ni.length;Pr++){var Vi=ni[Pr];mv(this.layoutVertexArray,Vi.x,Vi.y,0,0,1,1,0),Ut.push(Vi.x),Ut.push(Vi.y)}}}for(var Ai=ma(Ut,$t),Gr=0;Gr<Ai.length;Gr+=3)this.indexArray.emplaceBack(Ar+Ai[Gr],Ar+Ai[Gr+2],Ar+Ai[Gr+1]);se.primitiveLength+=Ai.length/3,se.vertexLength+=Y}}var rn;this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,f,S,x)},Tr("FillExtrusionBucket",df,{omit:["layers","features"]});var rte={paint:new Rs({"fill-extrusion-opacity":new ei(Se["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new zr(Se["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ei(Se["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ei(Se["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Au(Se["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new zr(Se["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new zr(Se["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ei(Se["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})},ite=function(a){function c(f){a.call(this,f,rte)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.createBucket=function(f){return new df(f)},c.prototype.queryRadius=function(){return Ho(this.paint.get("fill-extrusion-translate"))},c.prototype.is3D=function(){return!0},c.prototype.queryIntersectsFeature=function(f,x,S,I,D,H,Y,ee){var ie=Ts(f,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),H.angle,Y),se=this.paint.get("fill-extrusion-height").evaluate(x,S),Ae=this.paint.get("fill-extrusion-base").evaluate(x,S),Te=function(Ve,et,Xe,at){for(var _t=[],bt=0,Mt=Ve;bt<Mt.length;bt+=1){var Ut=Mt[bt],$t=[Ut.x,Ut.y,0,1];dp($t,$t,et),_t.push(new u($t[0]/$t[3],$t[1]/$t[3]))}return _t}(ie,ee),ke=function(Ve,et,Xe,at){for(var _t=[],bt=[],Mt=at[8]*et,Ut=at[9]*et,$t=at[10]*et,Ar=at[11]*et,Qr=at[8]*Xe,Cr=at[9]*Xe,ni=at[10]*Xe,Pr=at[11]*Xe,Vi=0,Ai=Ve;Vi<Ai.length;Vi+=1){for(var Gr=[],rn=[],Ri=0,_n=Ai[Vi];Ri<_n.length;Ri+=1){var si=_n[Ri],Pn=si.x,Bo=si.y,is=at[0]*Pn+at[4]*Bo+at[12],$o=at[1]*Pn+at[5]*Bo+at[13],Oo=at[2]*Pn+at[6]*Bo+at[14],ns=at[3]*Pn+at[7]*Bo+at[15],qs=Oo+$t,Xs=ns+Ar,Ya=is+Qr,ia=$o+Cr,Ka=Oo+ni,hs=ns+Pr,na=new u((is+Mt)/Xs,($o+Ut)/Xs);na.z=qs/Xs,Gr.push(na);var un=new u(Ya/hs,ia/hs);un.z=Ka/hs,rn.push(un)}_t.push(Gr),bt.push(rn)}return[_t,bt]}(I,Ae,se,ee);return function(Ve,et,Xe){var at=1/0;Kl(Xe,et)&&(at=_k(Xe,et[0]));for(var _t=0;_t<et.length;_t++)for(var bt=et[_t],Mt=Ve[_t],Ut=0;Ut<bt.length-1;Ut++){var $t=bt[Ut],Ar=[$t,bt[Ut+1],Mt[Ut+1],Mt[Ut],$t];vu(Xe,Ar)&&(at=Math.min(at,_k(Xe,Ar)))}return at!==1/0&&at}(ke[0],ke[1],Te)},c}(Ma);function gv(a,c){return a.x*c.x+a.y*c.y}function _k(a,c){if(a.length===1){for(var f,x=0,S=c[x++];!f||S.equals(f);)if(!(f=c[x++]))return 1/0;for(;x<c.length;x++){var I=c[x],D=a[0],H=f.sub(S),Y=I.sub(S),ee=D.sub(S),ie=gv(H,H),se=gv(H,Y),Ae=gv(Y,Y),Te=gv(ee,H),ke=gv(ee,Y),Ve=ie*Ae-se*se,et=(Ae*Te-se*ke)/Ve,Xe=(ie*ke-se*Te)/Ve,at=S.z*(1-et-Xe)+f.z*et+I.z*Xe;if(isFinite(at))return at}return 1/0}for(var _t=1/0,bt=0,Mt=c;bt<Mt.length;bt+=1)_t=Math.min(_t,Mt[bt].z);return _t}var nte=Bs([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,ote=Bs([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,ste=ad.VectorTileFeature.types,ate=Math.cos(Math.PI/180*37.5),yk=Math.pow(2,14)/.5,_l=function(a){var c=this;this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(function(f){return f.id}),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(function(f){c.gradients[f.id]={}}),this.layoutVertexArray=new mn,this.layoutVertexArray2=new eh,this.indexArray=new Ga,this.programConfigurations=new li(a.layers,a.zoom),this.segments=new Ce,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(function(f){return f.isStateDependent()}).map(function(f){return f.id})};_l.prototype.populate=function(a,c,f){this.hasPattern=gt("line",this.layers,c);for(var x=this.layers[0].layout.get("line-sort-key"),S=[],I=0,D=a;I<D.length;I+=1){var H=D[I],Y=H.feature,ee=H.id,ie=H.index,se=H.sourceLayerIndex,Ae=this.layers[0]._featureFilter.needGeometry,Te=Jo(Y,Ae);if(this.layers[0]._featureFilter.filter(new qi(this.zoom),Te,f)){var ke=x?x.evaluate(Te,{},f):void 0,Ve={id:ee,properties:Y.properties,type:Y.type,sourceLayerIndex:se,index:ie,geometry:Ae?Te.geometry:Io(Y),patterns:{},sortKey:ke};S.push(Ve)}}x&&S.sort(function($t,Ar){return $t.sortKey-Ar.sortKey});for(var et=0,Xe=S;et<Xe.length;et+=1){var at=Xe[et],_t=at.geometry,bt=at.index,Mt=at.sourceLayerIndex;if(this.hasPattern){var Ut=Fr("line",this.layers,at,this.zoom,c);this.patternFeatures.push(Ut)}else this.addFeature(at,_t,bt,f,{});c.featureIndex.insert(a[bt].feature,_t,bt,Mt,this.index)}},_l.prototype.update=function(a,c,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,c,this.stateDependentLayers,f)},_l.prototype.addFeatures=function(a,c,f){for(var x=0,S=this.patternFeatures;x<S.length;x+=1){var I=S[x];this.addFeature(I,I.geometry,I.index,c,f)}},_l.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},_l.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},_l.prototype.upload=function(a){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=a.createVertexBuffer(this.layoutVertexArray2,ote)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,nte),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0},_l.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},_l.prototype.lineFeatureClips=function(a){if(a.properties&&a.properties.hasOwnProperty("mapbox_clip_start")&&a.properties.hasOwnProperty("mapbox_clip_end"))return{start:+a.properties.mapbox_clip_start,end:+a.properties.mapbox_clip_end}},_l.prototype.addFeature=function(a,c,f,x,S){var I=this.layers[0].layout,D=I.get("line-join").evaluate(a,{}),H=I.get("line-cap"),Y=I.get("line-miter-limit"),ee=I.get("line-round-limit");this.lineClips=this.lineFeatureClips(a);for(var ie=0,se=c;ie<se.length;ie+=1)this.addLine(se[ie],a,D,H,Y,ee);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,f,S,x)},_l.prototype.addLine=function(a,c,f,x,S,I){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(var D=0;D<a.length-1;D++)this.totalDistance+=a[D].dist(a[D+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}for(var H=ste[c.type]==="Polygon",Y=a.length;Y>=2&&a[Y-1].equals(a[Y-2]);)Y--;for(var ee=0;ee<Y-1&&a[ee].equals(a[ee+1]);)ee++;if(!(Y<(H?3:2))){f==="bevel"&&(S=1.05);var ie,se=this.overscaling<=16?122880/(512*this.overscaling):0,Ae=this.segments.prepareSegment(10*Y,this.layoutVertexArray,this.indexArray),Te=void 0,ke=void 0,Ve=void 0,et=void 0;this.e1=this.e2=-1,H&&(et=a[ee].sub(ie=a[Y-2])._unit()._perp());for(var Xe=ee;Xe<Y;Xe++)if(!(ke=Xe===Y-1?H?a[ee+1]:void 0:a[Xe+1])||!a[Xe].equals(ke)){et&&(Ve=et),ie&&(Te=ie),ie=a[Xe],et=ke?ke.sub(ie)._unit()._perp():Ve;var at=(Ve=Ve||et).add(et);at.x===0&&at.y===0||at._unit();var _t=Ve.x*et.x+Ve.y*et.y,bt=at.x*et.x+at.y*et.y,Mt=bt!==0?1/bt:1/0,Ut=2*Math.sqrt(2-2*bt),$t=bt<ate&&Te&&ke,Ar=Ve.x*et.y-Ve.y*et.x>0;if($t&&Xe>ee){var Qr=ie.dist(Te);if(Qr>2*se){var Cr=ie.sub(ie.sub(Te)._mult(se/Qr)._round());this.updateDistance(Te,Cr),this.addCurrentVertex(Cr,Ve,0,0,Ae),Te=Cr}}var ni=Te&&ke,Pr=ni?f:H?"butt":x;if(ni&&Pr==="round"&&(Mt<I?Pr="miter":Mt<=2&&(Pr="fakeround")),Pr==="miter"&&Mt>S&&(Pr="bevel"),Pr==="bevel"&&(Mt>2&&(Pr="flipbevel"),Mt<S&&(Pr="miter")),Te&&this.updateDistance(Te,ie),Pr==="miter")at._mult(Mt),this.addCurrentVertex(ie,at,0,0,Ae);else if(Pr==="flipbevel"){if(Mt>100)at=et.mult(-1);else{var Vi=Mt*Ve.add(et).mag()/Ve.sub(et).mag();at._perp()._mult(Vi*(Ar?-1:1))}this.addCurrentVertex(ie,at,0,0,Ae),this.addCurrentVertex(ie,at.mult(-1),0,0,Ae)}else if(Pr==="bevel"||Pr==="fakeround"){var Ai=-Math.sqrt(Mt*Mt-1),Gr=Ar?Ai:0,rn=Ar?0:Ai;if(Te&&this.addCurrentVertex(ie,Ve,Gr,rn,Ae),Pr==="fakeround")for(var Ri=Math.round(180*Ut/Math.PI/20),_n=1;_n<Ri;_n++){var si=_n/Ri;if(si!==.5){var Pn=si-.5;si+=si*Pn*(si-1)*((1.0904+_t*(_t*(3.55645-1.43519*_t)-3.2452))*Pn*Pn+(.848013+_t*(.215638*_t-1.06021)))}var Bo=et.sub(Ve)._mult(si)._add(Ve)._unit()._mult(Ar?-1:1);this.addHalfVertex(ie,Bo.x,Bo.y,!1,Ar,0,Ae)}ke&&this.addCurrentVertex(ie,et,-Gr,-rn,Ae)}else if(Pr==="butt")this.addCurrentVertex(ie,at,0,0,Ae);else if(Pr==="square"){var is=Te?1:-1;this.addCurrentVertex(ie,at,is,is,Ae)}else Pr==="round"&&(Te&&(this.addCurrentVertex(ie,Ve,0,0,Ae),this.addCurrentVertex(ie,Ve,1,1,Ae,!0)),ke&&(this.addCurrentVertex(ie,et,-1,-1,Ae,!0),this.addCurrentVertex(ie,et,0,0,Ae)));if($t&&Xe<Y-1){var $o=ie.dist(ke);if($o>2*se){var Oo=ie.add(ke.sub(ie)._mult(se/$o)._round());this.updateDistance(ie,Oo),this.addCurrentVertex(Oo,et,0,0,Ae),ie=Oo}}}}},_l.prototype.addCurrentVertex=function(a,c,f,x,S,I){I===void 0&&(I=!1);var D=c.y*x-c.x,H=-c.y-c.x*x;this.addHalfVertex(a,c.x+c.y*f,c.y-c.x*f,I,!1,f,S),this.addHalfVertex(a,D,H,I,!0,-x,S),this.distance>yk/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(a,c,f,x,S,I))},_l.prototype.addHalfVertex=function(a,c,f,x,S,I,D){var H=.5*(this.lineClips?this.scaledDistance*(yk-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((a.x<<1)+(x?1:0),(a.y<<1)+(S?1:0),Math.round(63*c)+128,Math.round(63*f)+128,1+(I===0?0:I<0?-1:1)|(63&H)<<2,H>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);var Y=D.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,Y),D.primitiveLength++),S?this.e2=Y:this.e1=Y},_l.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},_l.prototype.updateDistance=function(a,c){this.distance+=a.dist(c),this.updateScaledDistance()},Tr("LineBucket",_l,{omit:["layers","patternFeatures"]});var lte=new Rs({"line-cap":new ei(Se.layout_line["line-cap"]),"line-join":new zr(Se.layout_line["line-join"]),"line-miter-limit":new ei(Se.layout_line["line-miter-limit"]),"line-round-limit":new ei(Se.layout_line["line-round-limit"]),"line-sort-key":new zr(Se.layout_line["line-sort-key"])}),vk={paint:new Rs({"line-opacity":new zr(Se.paint_line["line-opacity"]),"line-color":new zr(Se.paint_line["line-color"]),"line-translate":new ei(Se.paint_line["line-translate"]),"line-translate-anchor":new ei(Se.paint_line["line-translate-anchor"]),"line-width":new zr(Se.paint_line["line-width"]),"line-gap-width":new zr(Se.paint_line["line-gap-width"]),"line-offset":new zr(Se.paint_line["line-offset"]),"line-blur":new zr(Se.paint_line["line-blur"]),"line-dasharray":new da(Se.paint_line["line-dasharray"]),"line-pattern":new Au(Se.paint_line["line-pattern"]),"line-gradient":new ml(Se.paint_line["line-gradient"])}),layout:lte},xk=new(function(a){function c(){a.apply(this,arguments)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.possiblyEvaluate=function(f,x){return x=new qi(Math.floor(x.zoom),{now:x.now,fadeDuration:x.fadeDuration,zoomHistory:x.zoomHistory,transition:x.transition}),a.prototype.possiblyEvaluate.call(this,f,x)},c.prototype.evaluate=function(f,x,S,I){return x=z({},x,{zoom:Math.floor(x.zoom)}),a.prototype.evaluate.call(this,f,x,S,I)},c}(zr))(vk.paint.properties["line-width"].specification);xk.useIntegerZoom=!0;var cte=function(a){function c(f){a.call(this,f,vk),this.gradientVersion=0}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype._handleSpecialPaintPropertyUpdate=function(f){f==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof fa,this.gradientVersion=(this.gradientVersion+1)%T)},c.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},c.prototype.recalculate=function(f,x){a.prototype.recalculate.call(this,f,x),this.paint._values["line-floorwidth"]=xk.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)},c.prototype.createBucket=function(f){return new _l(f)},c.prototype.queryRadius=function(f){var x=f,S=bk(gc("line-width",this,x),gc("line-gap-width",this,x)),I=gc("line-offset",this,x);return S/2+Math.abs(I)+Ho(this.paint.get("line-translate"))},c.prototype.queryIntersectsFeature=function(f,x,S,I,D,H,Y){var ee=Ts(f,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),H.angle,Y),ie=Y/2*bk(this.paint.get("line-width").evaluate(x,S),this.paint.get("line-gap-width").evaluate(x,S)),se=this.paint.get("line-offset").evaluate(x,S);return se&&(I=function(Ae,Te){for(var ke=[],Ve=new u(0,0),et=0;et<Ae.length;et++){for(var Xe=Ae[et],at=[],_t=0;_t<Xe.length;_t++){var bt=Xe[_t],Mt=Xe[_t+1],Ut=_t===0?Ve:bt.sub(Xe[_t-1])._unit()._perp(),$t=_t===Xe.length-1?Ve:Mt.sub(bt)._unit()._perp(),Ar=Ut._add($t)._unit();Ar._mult(1/(Ar.x*$t.x+Ar.y*$t.y)),at.push(Ar._mult(Te)._add(bt))}ke.push(at)}return ke}(I,se*Y)),function(Ae,Te,ke){for(var Ve=0;Ve<Te.length;Ve++){var et=Te[Ve];if(Ae.length>=3){for(var Xe=0;Xe<et.length;Xe++)if(ro(Ae,et[Xe]))return!0}if(Bl(Ae,et,ke))return!0}return!1}(ee,I,ie)},c.prototype.isTileClipped=function(){return!0},c}(Ma);function bk(a,c){return c>0?c+2*a:a}var ute=Bs([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),fte=Bs([{name:"a_projected_pos",components:3,type:"Float32"}],4),hte=(Bs([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Bs([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),wk=(Bs([{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"}]),Bs([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),dte=Bs([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function pte(a,c,f){return a.sections.forEach(function(x){x.text=function(S,I,D){var H=I.layout.get("text-transform").evaluate(D,{});return H==="uppercase"?S=S.toLocaleUpperCase():H==="lowercase"&&(S=S.toLocaleLowerCase()),Al.applyArabicShaping&&(S=Al.applyArabicShaping(S)),S}(x.text,c,f)}),a}Bs([{name:"triangle",components:3,type:"Uint16"}]),Bs([{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"}]),Bs([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Bs([{type:"Float32",name:"offsetX"}]),Bs([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var _v={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"},Tk=function(a,c,f,x,S){var I,D,H=8*S-x-1,Y=(1<<H)-1,ee=Y>>1,ie=-7,se=f?S-1:0,Ae=f?-1:1,Te=a[c+se];for(se+=Ae,I=Te&(1<<-ie)-1,Te>>=-ie,ie+=H;ie>0;I=256*I+a[c+se],se+=Ae,ie-=8);for(D=I&(1<<-ie)-1,I>>=-ie,ie+=x;ie>0;D=256*D+a[c+se],se+=Ae,ie-=8);if(I===0)I=1-ee;else{if(I===Y)return D?NaN:1/0*(Te?-1:1);D+=Math.pow(2,x),I-=ee}return(Te?-1:1)*D*Math.pow(2,I-x)},Ek=function(a,c,f,x,S,I){var D,H,Y,ee=8*I-S-1,ie=(1<<ee)-1,se=ie>>1,Ae=S===23?Math.pow(2,-24)-Math.pow(2,-77):0,Te=x?0:I-1,ke=x?1:-1,Ve=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(H=isNaN(c)?1:0,D=ie):(D=Math.floor(Math.log(c)/Math.LN2),c*(Y=Math.pow(2,-D))<1&&(D--,Y*=2),(c+=D+se>=1?Ae/Y:Ae*Math.pow(2,1-se))*Y>=2&&(D++,Y/=2),D+se>=ie?(H=0,D=ie):D+se>=1?(H=(c*Y-1)*Math.pow(2,S),D+=se):(H=c*Math.pow(2,se-1)*Math.pow(2,S),D=0));S>=8;a[f+Te]=255&H,Te+=ke,H/=256,S-=8);for(D=D<<S|H,ee+=S;ee>0;a[f+Te]=255&D,Te+=ke,D/=256,ee-=8);a[f+Te-ke]|=128*Ve},Zw=Ao;function Ao(a){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(a)?a:new Uint8Array(a||0),this.pos=0,this.type=0,this.length=this.buf.length}Ao.Varint=0,Ao.Fixed64=1,Ao.Bytes=2,Ao.Fixed32=5;var Sk=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function ld(a){return a.type===Ao.Bytes?a.readVarint()+a.pos:a.pos+1}function e0(a,c,f){return f?4294967296*c+(a>>>0):4294967296*(c>>>0)+(a>>>0)}function Ck(a,c,f){var x=c<=16383?1:c<=2097151?2:c<=268435455?3:Math.floor(Math.log(c)/(7*Math.LN2));f.realloc(x);for(var S=f.pos-1;S>=a;S--)f.buf[S+x]=f.buf[S]}function Ate(a,c){for(var f=0;f<a.length;f++)c.writeVarint(a[f])}function mte(a,c){for(var f=0;f<a.length;f++)c.writeSVarint(a[f])}function gte(a,c){for(var f=0;f<a.length;f++)c.writeFloat(a[f])}function _te(a,c){for(var f=0;f<a.length;f++)c.writeDouble(a[f])}function yte(a,c){for(var f=0;f<a.length;f++)c.writeBoolean(a[f])}function vte(a,c){for(var f=0;f<a.length;f++)c.writeFixed32(a[f])}function xte(a,c){for(var f=0;f<a.length;f++)c.writeSFixed32(a[f])}function bte(a,c){for(var f=0;f<a.length;f++)c.writeFixed64(a[f])}function wte(a,c){for(var f=0;f<a.length;f++)c.writeSFixed64(a[f])}function Jw(a,c){return(a[c]|a[c+1]<<8|a[c+2]<<16)+16777216*a[c+3]}function t0(a,c,f){a[f]=c,a[f+1]=c>>>8,a[f+2]=c>>>16,a[f+3]=c>>>24}function Mk(a,c){return(a[c]|a[c+1]<<8|a[c+2]<<16)+(a[c+3]<<24)}function Tte(a,c,f){a===1&&f.readMessage(Ete,c)}function Ete(a,c,f){if(a===3){var x=f.readMessage(Ste,{}),S=x.width,I=x.height,D=x.left,H=x.top,Y=x.advance;c.push({id:x.id,bitmap:new Mi({width:S+6,height:I+6},x.bitmap),metrics:{width:S,height:I,left:D,top:H,advance:Y}})}}function Ste(a,c,f){a===1?c.id=f.readVarint():a===2?c.bitmap=f.readBytes():a===3?c.width=f.readVarint():a===4?c.height=f.readVarint():a===5?c.left=f.readSVarint():a===6?c.top=f.readSVarint():a===7&&(c.advance=f.readVarint())}function Ik(a){for(var c=0,f=0,x=0,S=a;x<S.length;x+=1){var I=S[x];c+=I.w*I.h,f=Math.max(f,I.w)}a.sort(function(Ve,et){return et.h-Ve.h});for(var D=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(c/.95)),f),h:1/0}],H=0,Y=0,ee=0,ie=a;ee<ie.length;ee+=1)for(var se=ie[ee],Ae=D.length-1;Ae>=0;Ae--){var Te=D[Ae];if(!(se.w>Te.w||se.h>Te.h)){if(se.x=Te.x,se.y=Te.y,Y=Math.max(Y,se.y+se.h),H=Math.max(H,se.x+se.w),se.w===Te.w&&se.h===Te.h){var ke=D.pop();Ae<D.length&&(D[Ae]=ke)}else se.h===Te.h?(Te.x+=se.w,Te.w-=se.w):se.w===Te.w?(Te.y+=se.h,Te.h-=se.h):(D.push({x:Te.x+se.w,y:Te.y,w:Te.w-se.w,h:se.h}),Te.y+=se.h,Te.h-=se.h);break}}return{w:H,h:Y,fill:c/(H*Y)||0}}Ao.prototype={destroy:function(){this.buf=null},readFields:function(a,c,f){for(f=f||this.length;this.pos<f;){var x=this.readVarint(),S=x>>3,I=this.pos;this.type=7&x,a(S,c,this),this.pos===I&&this.skip(x)}return c},readMessage:function(a,c){return this.readFields(a,c,this.readVarint()+this.pos)},readFixed32:function(){var a=Jw(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=Mk(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=Jw(this.buf,this.pos)+4294967296*Jw(this.buf,this.pos+4);return this.pos+=8,a},readSFixed64:function(){var a=Jw(this.buf,this.pos)+4294967296*Mk(this.buf,this.pos+4);return this.pos+=8,a},readFloat:function(){var a=Tk(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=Tk(this.buf,this.pos,!0,52,8);return this.pos+=8,a},readVarint:function(a){var c,f,x=this.buf;return c=127&(f=x[this.pos++]),f<128?c:(c|=(127&(f=x[this.pos++]))<<7,f<128?c:(c|=(127&(f=x[this.pos++]))<<14,f<128?c:(c|=(127&(f=x[this.pos++]))<<21,f<128?c:function(S,I,D){var H,Y,ee=D.buf;if(H=(112&(Y=ee[D.pos++]))>>4,Y<128||(H|=(127&(Y=ee[D.pos++]))<<3,Y<128)||(H|=(127&(Y=ee[D.pos++]))<<10,Y<128)||(H|=(127&(Y=ee[D.pos++]))<<17,Y<128)||(H|=(127&(Y=ee[D.pos++]))<<24,Y<128)||(H|=(1&(Y=ee[D.pos++]))<<31,Y<128))return e0(S,H,I);throw new Error("Expected varint not more than 10 bytes")}(c|=(15&(f=x[this.pos]))<<28,a,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var a=this.readVarint();return a%2==1?(a+1)/-2:a/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var a=this.readVarint()+this.pos,c=this.pos;return this.pos=a,a-c>=12&&Sk?function(f,x,S){return Sk.decode(f.subarray(x,S))}(this.buf,c,a):function(f,x,S){for(var I="",D=x;D<S;){var H,Y,ee,ie=f[D],se=null,Ae=ie>239?4:ie>223?3:ie>191?2:1;if(D+Ae>S)break;Ae===1?ie<128&&(se=ie):Ae===2?(192&(H=f[D+1]))==128&&(se=(31&ie)<<6|63&H)<=127&&(se=null):Ae===3?(Y=f[D+2],(192&(H=f[D+1]))==128&&(192&Y)==128&&((se=(15&ie)<<12|(63&H)<<6|63&Y)<=2047||se>=55296&&se<=57343)&&(se=null)):Ae===4&&(Y=f[D+2],ee=f[D+3],(192&(H=f[D+1]))==128&&(192&Y)==128&&(192&ee)==128&&((se=(15&ie)<<18|(63&H)<<12|(63&Y)<<6|63&ee)<=65535||se>=1114112)&&(se=null)),se===null?(se=65533,Ae=1):se>65535&&(se-=65536,I+=String.fromCharCode(se>>>10&1023|55296),se=56320|1023&se),I+=String.fromCharCode(se),D+=Ae}return I}(this.buf,c,a)},readBytes:function(){var a=this.readVarint()+this.pos,c=this.buf.subarray(this.pos,a);return this.pos=a,c},readPackedVarint:function(a,c){if(this.type!==Ao.Bytes)return a.push(this.readVarint(c));var f=ld(this);for(a=a||[];this.pos<f;)a.push(this.readVarint(c));return a},readPackedSVarint:function(a){if(this.type!==Ao.Bytes)return a.push(this.readSVarint());var c=ld(this);for(a=a||[];this.pos<c;)a.push(this.readSVarint());return a},readPackedBoolean:function(a){if(this.type!==Ao.Bytes)return a.push(this.readBoolean());var c=ld(this);for(a=a||[];this.pos<c;)a.push(this.readBoolean());return a},readPackedFloat:function(a){if(this.type!==Ao.Bytes)return a.push(this.readFloat());var c=ld(this);for(a=a||[];this.pos<c;)a.push(this.readFloat());return a},readPackedDouble:function(a){if(this.type!==Ao.Bytes)return a.push(this.readDouble());var c=ld(this);for(a=a||[];this.pos<c;)a.push(this.readDouble());return a},readPackedFixed32:function(a){if(this.type!==Ao.Bytes)return a.push(this.readFixed32());var c=ld(this);for(a=a||[];this.pos<c;)a.push(this.readFixed32());return a},readPackedSFixed32:function(a){if(this.type!==Ao.Bytes)return a.push(this.readSFixed32());var c=ld(this);for(a=a||[];this.pos<c;)a.push(this.readSFixed32());return a},readPackedFixed64:function(a){if(this.type!==Ao.Bytes)return a.push(this.readFixed64());var c=ld(this);for(a=a||[];this.pos<c;)a.push(this.readFixed64());return a},readPackedSFixed64:function(a){if(this.type!==Ao.Bytes)return a.push(this.readSFixed64());var c=ld(this);for(a=a||[];this.pos<c;)a.push(this.readSFixed64());return a},skip:function(a){var c=7&a;if(c===Ao.Varint)for(;this.buf[this.pos++]>127;);else if(c===Ao.Bytes)this.pos=this.readVarint()+this.pos;else if(c===Ao.Fixed32)this.pos+=4;else{if(c!==Ao.Fixed64)throw new Error("Unimplemented type: "+c);this.pos+=8}},writeTag:function(a,c){this.writeVarint(a<<3|c)},realloc:function(a){for(var c=this.length||16;c<this.pos+a;)c*=2;if(c!==this.length){var f=new Uint8Array(c);f.set(this.buf),this.buf=f,this.length=c}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(a){this.realloc(4),t0(this.buf,a,this.pos),this.pos+=4},writeSFixed32:function(a){this.realloc(4),t0(this.buf,a,this.pos),this.pos+=4},writeFixed64:function(a){this.realloc(8),t0(this.buf,-1&a,this.pos),t0(this.buf,Math.floor(a*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(a){this.realloc(8),t0(this.buf,-1&a,this.pos),t0(this.buf,Math.floor(a*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(a){(a=+a||0)>268435455||a<0?function(c,f){var x,S;if(c>=0?(x=c%4294967296|0,S=c/4294967296|0):(S=~(-c/4294967296),4294967295^(x=~(-c%4294967296))?x=x+1|0:(x=0,S=S+1|0)),c>=18446744073709552e3||c<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");f.realloc(10),function(I,D,H){H.buf[H.pos++]=127&I|128,I>>>=7,H.buf[H.pos++]=127&I|128,I>>>=7,H.buf[H.pos++]=127&I|128,I>>>=7,H.buf[H.pos++]=127&I|128,H.buf[H.pos]=127&(I>>>=7)}(x,0,f),function(I,D){var H=(7&I)<<4;D.buf[D.pos++]|=H|((I>>>=3)?128:0),I&&(D.buf[D.pos++]=127&I|((I>>>=7)?128:0),I&&(D.buf[D.pos++]=127&I|((I>>>=7)?128:0),I&&(D.buf[D.pos++]=127&I|((I>>>=7)?128:0),I&&(D.buf[D.pos++]=127&I|((I>>>=7)?128:0),I&&(D.buf[D.pos++]=127&I)))))}(S,f)}(a,this):(this.realloc(4),this.buf[this.pos++]=127&a|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=a>>>7&127))))},writeSVarint:function(a){this.writeVarint(a<0?2*-a-1:2*a)},writeBoolean:function(a){this.writeVarint(Boolean(a))},writeString:function(a){a=String(a),this.realloc(4*a.length),this.pos++;var c=this.pos;this.pos=function(x,S,I){for(var D,H,Y=0;Y<S.length;Y++){if((D=S.charCodeAt(Y))>55295&&D<57344){if(!H){D>56319||Y+1===S.length?(x[I++]=239,x[I++]=191,x[I++]=189):H=D;continue}if(D<56320){x[I++]=239,x[I++]=191,x[I++]=189,H=D;continue}D=H-55296<<10|D-56320|65536,H=null}else H&&(x[I++]=239,x[I++]=191,x[I++]=189,H=null);D<128?x[I++]=D:(D<2048?x[I++]=D>>6|192:(D<65536?x[I++]=D>>12|224:(x[I++]=D>>18|240,x[I++]=D>>12&63|128),x[I++]=D>>6&63|128),x[I++]=63&D|128)}return I}(this.buf,a,this.pos);var f=this.pos-c;f>=128&&Ck(c,f,this),this.pos=c-1,this.writeVarint(f),this.pos+=f},writeFloat:function(a){this.realloc(4),Ek(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),Ek(this.buf,a,this.pos,!0,52,8),this.pos+=8},writeBytes:function(a){var c=a.length;this.writeVarint(c),this.realloc(c);for(var f=0;f<c;f++)this.buf[this.pos++]=a[f]},writeRawMessage:function(a,c){this.pos++;var f=this.pos;a(c,this);var x=this.pos-f;x>=128&&Ck(f,x,this),this.pos=f-1,this.writeVarint(x),this.pos+=x},writeMessage:function(a,c,f){this.writeTag(a,Ao.Bytes),this.writeRawMessage(c,f)},writePackedVarint:function(a,c){c.length&&this.writeMessage(a,Ate,c)},writePackedSVarint:function(a,c){c.length&&this.writeMessage(a,mte,c)},writePackedBoolean:function(a,c){c.length&&this.writeMessage(a,yte,c)},writePackedFloat:function(a,c){c.length&&this.writeMessage(a,gte,c)},writePackedDouble:function(a,c){c.length&&this.writeMessage(a,_te,c)},writePackedFixed32:function(a,c){c.length&&this.writeMessage(a,vte,c)},writePackedSFixed32:function(a,c){c.length&&this.writeMessage(a,xte,c)},writePackedFixed64:function(a,c){c.length&&this.writeMessage(a,bte,c)},writePackedSFixed64:function(a,c){c.length&&this.writeMessage(a,wte,c)},writeBytesField:function(a,c){this.writeTag(a,Ao.Bytes),this.writeBytes(c)},writeFixed32Field:function(a,c){this.writeTag(a,Ao.Fixed32),this.writeFixed32(c)},writeSFixed32Field:function(a,c){this.writeTag(a,Ao.Fixed32),this.writeSFixed32(c)},writeFixed64Field:function(a,c){this.writeTag(a,Ao.Fixed64),this.writeFixed64(c)},writeSFixed64Field:function(a,c){this.writeTag(a,Ao.Fixed64),this.writeSFixed64(c)},writeVarintField:function(a,c){this.writeTag(a,Ao.Varint),this.writeVarint(c)},writeSVarintField:function(a,c){this.writeTag(a,Ao.Varint),this.writeSVarint(c)},writeStringField:function(a,c){this.writeTag(a,Ao.Bytes),this.writeString(c)},writeFloatField:function(a,c){this.writeTag(a,Ao.Fixed32),this.writeFloat(c)},writeDoubleField:function(a,c){this.writeTag(a,Ao.Fixed64),this.writeDouble(c)},writeBooleanField:function(a,c){this.writeVarintField(a,Boolean(c))}};var Qw=function(a,c){var f=c.pixelRatio,x=c.version,S=c.stretchX,I=c.stretchY,D=c.content;this.paddedRect=a,this.pixelRatio=f,this.stretchX=S,this.stretchY=I,this.content=D,this.version=x},yv={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};yv.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},yv.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},yv.tlbr.get=function(){return this.tl.concat(this.br)},yv.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(Qw.prototype,yv);var vv=function(a,c){var f={},x={};this.haveRenderCallbacks=[];var S=[];this.addImages(a,f,S),this.addImages(c,x,S);var I=Ik(S),D=new Qo({width:I.w||1,height:I.h||1});for(var H in a){var Y=a[H],ee=f[H].paddedRect;Qo.copy(Y.data,D,{x:0,y:0},{x:ee.x+1,y:ee.y+1},Y.data)}for(var ie in c){var se=c[ie],Ae=x[ie].paddedRect,Te=Ae.x+1,ke=Ae.y+1,Ve=se.data.width,et=se.data.height;Qo.copy(se.data,D,{x:0,y:0},{x:Te,y:ke},se.data),Qo.copy(se.data,D,{x:0,y:et-1},{x:Te,y:ke-1},{width:Ve,height:1}),Qo.copy(se.data,D,{x:0,y:0},{x:Te,y:ke+et},{width:Ve,height:1}),Qo.copy(se.data,D,{x:Ve-1,y:0},{x:Te-1,y:ke},{width:1,height:et}),Qo.copy(se.data,D,{x:0,y:0},{x:Te+Ve,y:ke},{width:1,height:et})}this.image=D,this.iconPositions=f,this.patternPositions=x};vv.prototype.addImages=function(a,c,f){for(var x in a){var S=a[x],I={x:0,y:0,w:S.data.width+2,h:S.data.height+2};f.push(I),c[x]=new Qw(I,S),S.hasRenderCallback&&this.haveRenderCallbacks.push(x)}},vv.prototype.patchUpdatedImages=function(a,c){for(var f in a.dispatchRenderCallbacks(this.haveRenderCallbacks),a.updatedImages)this.patchUpdatedImage(this.iconPositions[f],a.getImage(f),c),this.patchUpdatedImage(this.patternPositions[f],a.getImage(f),c)},vv.prototype.patchUpdatedImage=function(a,c,f){if(a&&c&&a.version!==c.version){a.version=c.version;var x=a.tl;f.update(c.data,void 0,{x:x[0],y:x[1]})}},Tr("ImagePosition",Qw),Tr("ImageAtlas",vv);var yc={horizontal:1,vertical:2,horizontalOnly:3},r0=function(){this.scale=1,this.fontStack="",this.imageName=null};r0.forText=function(a,c){var f=new r0;return f.scale=a||1,f.fontStack=c,f},r0.forImage=function(a){var c=new r0;return c.imageName=a,c};var Xa=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function $w(a,c,f,x,S,I,D,H,Y,ee,ie,se,Ae,Te,ke,Ve){var et,Xe=Xa.fromFeature(a,S);se===yc.vertical&&Xe.verticalizePunctuation();var at=Al.processBidirectionalText,_t=Al.processStyledBidirectionalText;if(at&&Xe.sections.length===1){et=[];for(var bt=0,Mt=at(Xe.toString(),rP(Xe,ee,I,c,x,Te,ke));bt<Mt.length;bt+=1){var Ut=Mt[bt],$t=new Xa;$t.text=Ut,$t.sections=Xe.sections;for(var Ar=0;Ar<Ut.length;Ar++)$t.sectionIndex.push(0);et.push($t)}}else if(_t){et=[];for(var Qr=0,Cr=_t(Xe.text,Xe.sectionIndex,rP(Xe,ee,I,c,x,Te,ke));Qr<Cr.length;Qr+=1){var ni=Cr[Qr],Pr=new Xa;Pr.text=ni[0],Pr.sectionIndex=ni[1],Pr.sections=Xe.sections,et.push(Pr)}}else et=function(Gr,rn){for(var Ri=[],_n=Gr.text,si=0,Pn=0,Bo=rn;Pn<Bo.length;Pn+=1){var is=Bo[Pn];Ri.push(Gr.substring(si,is)),si=is}return si<_n.length&&Ri.push(Gr.substring(si,_n.length)),Ri}(Xe,rP(Xe,ee,I,c,x,Te,ke));var Vi=[],Ai={positionedLines:Vi,text:Xe.toString(),top:ie[1],bottom:ie[1],left:ie[0],right:ie[0],writingMode:se,iconsInText:!1,verticalizable:!1};return function(Gr,rn,Ri,_n,si,Pn,Bo,is,$o,Oo,ns,qs){for(var Xs=0,Ya=-17,ia=0,Ka=0,hs=is==="right"?1:is==="left"?0:.5,na=0,un=0,no=si;un<no.length;un+=1){var Kn=no[un];Kn.trim();var wn=Kn.getMaxScale(),yl=24*(wn-1),Ra={positionedGlyphs:[],lineOffset:0};Gr.positionedLines[na]=Ra;var xo=Ra.positionedGlyphs,Es=0;if(Kn.length()){for(var Ba=0;Ba<Kn.length();Ba++){var Rn=Kn.getSection(Ba),lh=Kn.getSectionIndex(Ba),vc=Kn.getCharCode(Ba),ch=0,ds=null,uh=null,Tu=null,u0=24,WA=!($o===yc.horizontal||!ns&&!of(vc)||ns&&(e2[vc]||(hd=vc,gr.Arabic(hd)||gr["Arabic Supplement"](hd)||gr["Arabic Extended-A"](hd)||gr["Arabic Presentation Forms-A"](hd)||gr["Arabic Presentation Forms-B"](hd))));if(Rn.imageName){var f0=_n[Rn.imageName];if(!f0)continue;Tu=Rn.imageName,Gr.iconsInText=Gr.iconsInText||!0,uh=f0.paddedRect;var fd=f0.displaySize;Rn.scale=24*Rn.scale/qs,ch=yl+(24-fd[1]*Rn.scale),u0=(ds={width:fd[0],height:fd[1],left:1,top:-3,advance:WA?fd[1]:fd[0]}).advance;var h0=WA?fd[0]*Rn.scale-24*wn:fd[1]*Rn.scale-24*wn;h0>0&&h0>Es&&(Es=h0)}else{var c2=Ri[Rn.fontStack],d0=c2&&c2[vc];if(d0&&d0.rect)uh=d0.rect,ds=d0.metrics;else{var wv=rn[Rn.fontStack],u2=wv&&wv[vc];if(!u2)continue;ds=u2.metrics}ch=24*(wn-Rn.scale)}WA?(Gr.verticalizable=!0,xo.push({glyph:vc,imageName:Tu,x:Xs,y:Ya+ch,vertical:WA,scale:Rn.scale,fontStack:Rn.fontStack,sectionIndex:lh,metrics:ds,rect:uh}),Xs+=u0*Rn.scale+Oo):(xo.push({glyph:vc,imageName:Tu,x:Xs,y:Ya+ch,vertical:WA,scale:Rn.scale,fontStack:Rn.fontStack,sectionIndex:lh,metrics:ds,rect:uh}),Xs+=ds.advance*Rn.scale+Oo)}xo.length!==0&&(ia=Math.max(Xs-Oo,ia),Mte(xo,0,xo.length-1,hs,Es)),Xs=0;var f2=Pn*wn+Es;Ra.lineOffset=Math.max(Es,yl),Ya+=f2,Ka=Math.max(f2,Ka),++na}else Ya+=Pn,++na}var hd,Tv=Ya- -17,p0=iP(Bo),Ap=p0.horizontalAlign,A0=p0.verticalAlign;(function(h2,d2,Ev,Sv,p2,Cv,Mv,Iv,A2){var m0,m2=(d2-Ev)*p2;m0=Cv!==Mv?-Iv*Sv- -17:(-Sv*A2+.5)*Mv;for(var g0=0,Pv=h2;g0<Pv.length;g0+=1)for(var qA=0,Rv=Pv[g0].positionedGlyphs;qA<Rv.length;qA+=1){var _0=Rv[qA];_0.x+=m2,_0.y+=m0}})(Gr.positionedLines,hs,Ap,A0,ia,Ka,Pn,Tv,si.length),Gr.top+=-A0*Tv,Gr.bottom=Gr.top+Tv,Gr.left+=-Ap*ia,Gr.right=Gr.left+ia}(Ai,c,f,x,et,D,H,Y,se,ee,Ae,Ve),!function(Gr){for(var rn=0,Ri=Gr;rn<Ri.length;rn+=1)if(Ri[rn].positionedGlyphs.length!==0)return!1;return!0}(Vi)&&Ai}Xa.fromFeature=function(a,c){for(var f=new Xa,x=0;x<a.sections.length;x++){var S=a.sections[x];S.image?f.addImageSection(S):f.addTextSection(S,c)}return f},Xa.prototype.length=function(){return this.text.length},Xa.prototype.getSection=function(a){return this.sections[this.sectionIndex[a]]},Xa.prototype.getSectionIndex=function(a){return this.sectionIndex[a]},Xa.prototype.getCharCode=function(a){return this.text.charCodeAt(a)},Xa.prototype.verticalizePunctuation=function(){this.text=function(a){for(var c="",f=0;f<a.length;f++){var x=a.charCodeAt(f+1)||null,S=a.charCodeAt(f-1)||null;c+=x&&Gc(x)&&!_v[a[f+1]]||S&&Gc(S)&&!_v[a[f-1]]||!_v[a[f]]?a[f]:_v[a[f]]}return c}(this.text)},Xa.prototype.trim=function(){for(var a=0,c=0;c<this.text.length&&e2[this.text.charCodeAt(c)];c++)a++;for(var f=this.text.length,x=this.text.length-1;x>=0&&x>=a&&e2[this.text.charCodeAt(x)];x--)f--;this.text=this.text.substring(a,f),this.sectionIndex=this.sectionIndex.slice(a,f)},Xa.prototype.substring=function(a,c){var f=new Xa;return f.text=this.text.substring(a,c),f.sectionIndex=this.sectionIndex.slice(a,c),f.sections=this.sections,f},Xa.prototype.toString=function(){return this.text},Xa.prototype.getMaxScale=function(){var a=this;return this.sectionIndex.reduce(function(c,f){return Math.max(c,a.sections[f].scale)},0)},Xa.prototype.addTextSection=function(a,c){this.text+=a.text,this.sections.push(r0.forText(a.scale,a.fontStack||c));for(var f=this.sections.length-1,x=0;x<a.text.length;++x)this.sectionIndex.push(f)},Xa.prototype.addImageSection=function(a){var c=a.image?a.image.name:"";if(c.length!==0){var f=this.getNextImageSectionCharCode();f?(this.text+=String.fromCharCode(f),this.sections.push(r0.forImage(c)),this.sectionIndex.push(this.sections.length-1)):we("Reached maximum number of images 6401")}else we("Can't add FormattedSection with an empty image.")},Xa.prototype.getNextImageSectionCharCode=function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var e2={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Jl={};function Pk(a,c,f,x,S,I){if(c.imageName){var D=x[c.imageName];return D?D.displaySize[0]*c.scale*24/I+S:0}var H=f[c.fontStack],Y=H&&H[a];return Y?Y.metrics.advance*c.scale+S:0}function Rk(a,c,f,x){var S=Math.pow(a-c,2);return x?a<c?S/2:2*S:S+Math.abs(f)*f}function Cte(a,c,f){var x=0;return a===10&&(x-=1e4),f&&(x+=150),a!==40&&a!==65288||(x+=50),c!==41&&c!==65289||(x+=50),x}function Bk(a,c,f,x,S,I){for(var D=null,H=Rk(c,f,S,I),Y=0,ee=x;Y<ee.length;Y+=1){var ie=ee[Y],se=Rk(c-ie.x,f,S,I)+ie.badness;se<=H&&(D=ie,H=se)}return{index:a,x:c,priorBreak:D,badness:H}}function rP(a,c,f,x,S,I,D){if(I!=="point")return[];if(!a)return[];for(var H,Y=[],ee=function(et,Xe,at,_t,bt,Mt){for(var Ut=0,$t=0;$t<et.length();$t++){var Ar=et.getSection($t);Ut+=Pk(et.getCharCode($t),Ar,_t,bt,Xe,Mt)}return Ut/Math.max(1,Math.ceil(Ut/at))}(a,c,f,x,S,D),ie=a.text.indexOf("\u200B")>=0,se=0,Ae=0;Ae<a.length();Ae++){var Te=a.getSection(Ae),ke=a.getCharCode(Ae);if(e2[ke]||(se+=Pk(ke,Te,x,S,c,D)),Ae<a.length()-1){var Ve=!((H=ke)<11904||!(gr["Bopomofo Extended"](H)||gr.Bopomofo(H)||gr["CJK Compatibility Forms"](H)||gr["CJK Compatibility Ideographs"](H)||gr["CJK Compatibility"](H)||gr["CJK Radicals Supplement"](H)||gr["CJK Strokes"](H)||gr["CJK Symbols and Punctuation"](H)||gr["CJK Unified Ideographs Extension A"](H)||gr["CJK Unified Ideographs"](H)||gr["Enclosed CJK Letters and Months"](H)||gr["Halfwidth and Fullwidth Forms"](H)||gr.Hiragana(H)||gr["Ideographic Description Characters"](H)||gr["Kangxi Radicals"](H)||gr["Katakana Phonetic Extensions"](H)||gr.Katakana(H)||gr["Vertical Forms"](H)||gr["Yi Radicals"](H)||gr["Yi Syllables"](H)));(Jl[ke]||Ve||Te.imageName)&&Y.push(Bk(Ae+1,se,ee,Y,Cte(ke,a.getCharCode(Ae+1),Ve&&ie),!1))}}return function et(Xe){return Xe?et(Xe.priorBreak).concat(Xe.index):[]}(Bk(a.length(),se,ee,Y,0,!0))}function iP(a){var c=.5,f=.5;switch(a){case"right":case"top-right":case"bottom-right":c=1;break;case"left":case"top-left":case"bottom-left":c=0}switch(a){case"bottom":case"bottom-right":case"bottom-left":f=1;break;case"top":case"top-right":case"top-left":f=0}return{horizontalAlign:c,verticalAlign:f}}function Mte(a,c,f,x,S){if(x||S)for(var I=a[f],D=(a[f].x+I.metrics.advance*I.scale)*x,H=c;H<=f;H++)a[H].x-=D,a[H].y+=S}function Ok(a,c,f,x,S,I){var D,H=a.image;if(H.content){var Y=H.content,ee=H.pixelRatio||1;D=[Y[0]/ee,Y[1]/ee,H.displaySize[0]-Y[2]/ee,H.displaySize[1]-Y[3]/ee]}var ie,se,Ae,Te,ke=c.left*I,Ve=c.right*I;f==="width"||f==="both"?(Te=S[0]+ke-x[3],se=S[0]+Ve+x[1]):se=(Te=S[0]+(ke+Ve-H.displaySize[0])/2)+H.displaySize[0];var et=c.top*I,Xe=c.bottom*I;return f==="height"||f==="both"?(ie=S[1]+et-x[0],Ae=S[1]+Xe+x[2]):Ae=(ie=S[1]+(et+Xe-H.displaySize[1])/2)+H.displaySize[1],{image:H,top:ie,right:se,bottom:Ae,left:Te,collisionPadding:D}}Jl[10]=!0,Jl[32]=!0,Jl[38]=!0,Jl[40]=!0,Jl[41]=!0,Jl[43]=!0,Jl[45]=!0,Jl[47]=!0,Jl[173]=!0,Jl[183]=!0,Jl[8203]=!0,Jl[8208]=!0,Jl[8211]=!0,Jl[8231]=!0;var i0=function(a){function c(f,x,S,I){a.call(this,f,x),this.angle=S,I!==void 0&&(this.segment=I)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.clone=function(){return new c(this.x,this.y,this.angle,this.segment)},c}(u);function nP(a,c){var f=c.expression;if(f.kind==="constant")return{kind:"constant",layoutSize:f.evaluate(new qi(a+1))};if(f.kind==="source")return{kind:"source"};for(var x=f.zoomStops,S=f.interpolationType,I=0;I<x.length&&x[I]<=a;)I++;for(var D=I=Math.max(0,I-1);D<x.length&&x[D]<a+1;)D++;D=Math.min(x.length-1,D);var H=x[I],Y=x[D];return f.kind==="composite"?{kind:"composite",minZoom:H,maxZoom:Y,interpolationType:S}:{kind:"camera",minZoom:H,maxZoom:Y,minSize:f.evaluate(new qi(H)),maxSize:f.evaluate(new qi(Y)),interpolationType:S}}function Dk(a,c,f){var x=c.uSize,S=f.lowerSize;return a.kind==="source"?S/128:a.kind==="composite"?Mo(S/128,f.upperSize/128,c.uSizeT):x}function Lk(a,c){var f=0,x=0;if(a.kind==="constant")x=a.layoutSize;else if(a.kind!=="source"){var S=a.interpolationType,I=S?O(P.interpolationFactor(S,c,a.minZoom,a.maxZoom),0,1):0;a.kind==="camera"?x=Mo(a.minSize,a.maxSize,I):f=I}return{uSizeT:f,uSize:x}}Tr("Anchor",i0);var Ite=Object.freeze({__proto__:null,getSizeData:nP,evaluateSizeForFeature:Dk,evaluateSizeForZoom:Lk,SIZE_PACK_FACTOR:128});function Fk(a,c,f,x,S){if(c.segment===void 0)return!0;for(var I=c,D=c.segment+1,H=0;H>-f/2;){if(--D<0)return!1;H-=a[D].dist(I),I=a[D]}H+=a[D].dist(a[D+1]),D++;for(var Y=[],ee=0;H<f/2;){var ie=a[D],se=a[D+1];if(!se)return!1;var Ae=a[D-1].angleTo(ie)-ie.angleTo(se);for(Ae=Math.abs((Ae+3*Math.PI)%(2*Math.PI)-Math.PI),Y.push({distance:H,angleDelta:Ae}),ee+=Ae;H-Y[0].distance>x;)ee-=Y.shift().angleDelta;if(ee>S)return!1;D++,H+=ie.dist(se)}return!0}function Nk(a){for(var c=0,f=0;f<a.length-1;f++)c+=a[f].dist(a[f+1]);return c}function kk(a,c,f){return a?.6*c*f:0}function Uk(a,c){return Math.max(a?a.right-a.left:0,c?c.right-c.left:0)}function Pte(a,c,f,x,S,I){for(var D=kk(f,S,I),H=Uk(f,x)*I,Y=0,ee=Nk(a)/2,ie=0;ie<a.length-1;ie++){var se=a[ie],Ae=a[ie+1],Te=se.dist(Ae);if(Y+Te>ee){var ke=(ee-Y)/Te,Ve=Mo(se.x,Ae.x,ke),et=Mo(se.y,Ae.y,ke),Xe=new i0(Ve,et,Ae.angleTo(se),ie);return Xe._round(),!D||Fk(a,Xe,H,D,c)?Xe:void 0}Y+=Te}}function Rte(a,c,f,x,S,I,D,H,Y){var ee=kk(x,I,D),ie=Uk(x,S),se=ie*D,Ae=a[0].x===0||a[0].x===Y||a[0].y===0||a[0].y===Y;return c-se<c/4&&(c=se+c/4),function Te(ke,Ve,et,Xe,at,_t,bt,Mt,Ut){for(var $t=_t/2,Ar=Nk(ke),Qr=0,Cr=Ve-et,ni=[],Pr=0;Pr<ke.length-1;Pr++){for(var Vi=ke[Pr],Ai=ke[Pr+1],Gr=Vi.dist(Ai),rn=Ai.angleTo(Vi);Cr+et<Qr+Gr;){var Ri=((Cr+=et)-Qr)/Gr,_n=Mo(Vi.x,Ai.x,Ri),si=Mo(Vi.y,Ai.y,Ri);if(_n>=0&&_n<Ut&&si>=0&&si<Ut&&Cr-$t>=0&&Cr+$t<=Ar){var Pn=new i0(_n,si,rn,Pr);Pn._round(),Xe&&!Fk(ke,Pn,_t,Xe,at)||ni.push(Pn)}}Qr+=Gr}return Mt||ni.length||bt||(ni=Te(ke,Qr/2,et,Xe,at,_t,bt,!0,Ut)),ni}(a,Ae?c/2*H%c:(ie/2+2*I)*D*H%c,c,ee,f,se,Ae,!1,Y)}function zk(a,c,f,x,S){for(var I=[],D=0;D<a.length;D++)for(var H=a[D],Y=void 0,ee=0;ee<H.length-1;ee++){var ie=H[ee],se=H[ee+1];ie.x<c&&se.x<c||(ie.x<c?ie=new u(c,ie.y+(c-ie.x)/(se.x-ie.x)*(se.y-ie.y))._round():se.x<c&&(se=new u(c,ie.y+(c-ie.x)/(se.x-ie.x)*(se.y-ie.y))._round()),ie.y<f&&se.y<f||(ie.y<f?ie=new u(ie.x+(f-ie.y)/(se.y-ie.y)*(se.x-ie.x),f)._round():se.y<f&&(se=new u(ie.x+(f-ie.y)/(se.y-ie.y)*(se.x-ie.x),f)._round()),ie.x>=x&&se.x>=x||(ie.x>=x?ie=new u(x,ie.y+(x-ie.x)/(se.x-ie.x)*(se.y-ie.y))._round():se.x>=x&&(se=new u(x,ie.y+(x-ie.x)/(se.x-ie.x)*(se.y-ie.y))._round()),ie.y>=S&&se.y>=S||(ie.y>=S?ie=new u(ie.x+(S-ie.y)/(se.y-ie.y)*(se.x-ie.x),S)._round():se.y>=S&&(se=new u(ie.x+(S-ie.y)/(se.y-ie.y)*(se.x-ie.x),S)._round()),Y&&ie.equals(Y[Y.length-1])||I.push(Y=[ie]),Y.push(se)))))}return I}function Vk(a,c,f,x){var S=[],I=a.image,D=I.pixelRatio,H=I.paddedRect.w-2,Y=I.paddedRect.h-2,ee=a.right-a.left,ie=a.bottom-a.top,se=I.stretchX||[[0,H]],Ae=I.stretchY||[[0,Y]],Te=function(_n,si){return _n+si[1]-si[0]},ke=se.reduce(Te,0),Ve=Ae.reduce(Te,0),et=H-ke,Xe=Y-Ve,at=0,_t=ke,bt=0,Mt=Ve,Ut=0,$t=et,Ar=0,Qr=Xe;if(I.content&&x){var Cr=I.content;at=t2(se,0,Cr[0]),bt=t2(Ae,0,Cr[1]),_t=t2(se,Cr[0],Cr[2]),Mt=t2(Ae,Cr[1],Cr[3]),Ut=Cr[0]-at,Ar=Cr[1]-bt,$t=Cr[2]-Cr[0]-_t,Qr=Cr[3]-Cr[1]-Mt}var ni=function(_n,si,Pn,Bo){var is=r2(_n.stretch-at,_t,ee,a.left),$o=i2(_n.fixed-Ut,$t,_n.stretch,ke),Oo=r2(si.stretch-bt,Mt,ie,a.top),ns=i2(si.fixed-Ar,Qr,si.stretch,Ve),qs=r2(Pn.stretch-at,_t,ee,a.left),Xs=i2(Pn.fixed-Ut,$t,Pn.stretch,ke),Ya=r2(Bo.stretch-bt,Mt,ie,a.top),ia=i2(Bo.fixed-Ar,Qr,Bo.stretch,Ve),Ka=new u(is,Oo),hs=new u(qs,Oo),na=new u(qs,Ya),un=new u(is,Ya),no=new u($o/D,ns/D),Kn=new u(Xs/D,ia/D),wn=c*Math.PI/180;if(wn){var yl=Math.sin(wn),Ra=Math.cos(wn),xo=[Ra,-yl,yl,Ra];Ka._matMult(xo),hs._matMult(xo),un._matMult(xo),na._matMult(xo)}var Es=_n.stretch+_n.fixed,Ba=si.stretch+si.fixed;return{tl:Ka,tr:hs,bl:un,br:na,tex:{x:I.paddedRect.x+1+Es,y:I.paddedRect.y+1+Ba,w:Pn.stretch+Pn.fixed-Es,h:Bo.stretch+Bo.fixed-Ba},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:no,pixelOffsetBR:Kn,minFontScaleX:$t/D/ee,minFontScaleY:Qr/D/ie,isSDF:f}};if(x&&(I.stretchX||I.stretchY))for(var Pr=Hk(se,et,ke),Vi=Hk(Ae,Xe,Ve),Ai=0;Ai<Pr.length-1;Ai++)for(var Gr=Pr[Ai],rn=Pr[Ai+1],Ri=0;Ri<Vi.length-1;Ri++)S.push(ni(Gr,Vi[Ri],rn,Vi[Ri+1]));else S.push(ni({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:H+1},{fixed:0,stretch:Y+1}));return S}function t2(a,c,f){for(var x=0,S=0,I=a;S<I.length;S+=1){var D=I[S];x+=Math.max(c,Math.min(f,D[1]))-Math.max(c,Math.min(f,D[0]))}return x}function Hk(a,c,f){for(var x=[{fixed:-1,stretch:0}],S=0,I=a;S<I.length;S+=1){var D=I[S],H=D[0],Y=D[1],ee=x[x.length-1];x.push({fixed:H-ee.stretch,stretch:ee.stretch}),x.push({fixed:H-ee.stretch,stretch:ee.stretch+(Y-H)})}return x.push({fixed:c+1,stretch:f}),x}function r2(a,c,f,x){return a/c*f+x}function i2(a,c,f,x){return a-c*f/x}var n2=function(a,c,f,x,S,I,D,H,Y,ee){if(this.boxStartIndex=a.length,Y){var ie=I.top,se=I.bottom,Ae=I.collisionPadding;Ae&&(ie-=Ae[1],se+=Ae[3]);var Te=se-ie;Te>0&&(Te=Math.max(10,Te),this.circleDiameter=Te)}else{var ke=I.top*D-H,Ve=I.bottom*D+H,et=I.left*D-H,Xe=I.right*D+H,at=I.collisionPadding;if(at&&(et-=at[0]*D,ke-=at[1]*D,Xe+=at[2]*D,Ve+=at[3]*D),ee){var _t=new u(et,ke),bt=new u(Xe,ke),Mt=new u(et,Ve),Ut=new u(Xe,Ve),$t=ee*Math.PI/180;_t._rotate($t),bt._rotate($t),Mt._rotate($t),Ut._rotate($t),et=Math.min(_t.x,bt.x,Mt.x,Ut.x),Xe=Math.max(_t.x,bt.x,Mt.x,Ut.x),ke=Math.min(_t.y,bt.y,Mt.y,Ut.y),Ve=Math.max(_t.y,bt.y,Mt.y,Ut.y)}a.emplaceBack(c.x,c.y,et,ke,Xe,Ve,f,x,S)}this.boxEndIndex=a.length},n0=function(a,c){if(a===void 0&&(a=[]),c===void 0&&(c=Bte),this.data=a,this.length=this.data.length,this.compare=c,this.length>0)for(var f=(this.length>>1)-1;f>=0;f--)this._down(f)};function Bte(a,c){return a<c?-1:a>c?1:0}function Ote(a,c,f){c===void 0&&(c=1),f===void 0&&(f=!1);for(var x=1/0,S=1/0,I=-1/0,D=-1/0,H=a[0],Y=0;Y<H.length;Y++){var ee=H[Y];(!Y||ee.x<x)&&(x=ee.x),(!Y||ee.y<S)&&(S=ee.y),(!Y||ee.x>I)&&(I=ee.x),(!Y||ee.y>D)&&(D=ee.y)}var ie=Math.min(I-x,D-S),se=ie/2,Ae=new n0([],Dte);if(ie===0)return new u(x,S);for(var Te=x;Te<I;Te+=ie)for(var ke=S;ke<D;ke+=ie)Ae.push(new o0(Te+se,ke+se,se,a));for(var Ve=function(at){for(var _t=0,bt=0,Mt=0,Ut=at[0],$t=0,Ar=Ut.length,Qr=Ar-1;$t<Ar;Qr=$t++){var Cr=Ut[$t],ni=Ut[Qr],Pr=Cr.x*ni.y-ni.x*Cr.y;bt+=(Cr.x+ni.x)*Pr,Mt+=(Cr.y+ni.y)*Pr,_t+=3*Pr}return new o0(bt/_t,Mt/_t,0,at)}(a),et=Ae.length;Ae.length;){var Xe=Ae.pop();(Xe.d>Ve.d||!Ve.d)&&(Ve=Xe,f&&console.log("found best %d after %d probes",Math.round(1e4*Xe.d)/1e4,et)),Xe.max-Ve.d<=c||(Ae.push(new o0(Xe.p.x-(se=Xe.h/2),Xe.p.y-se,se,a)),Ae.push(new o0(Xe.p.x+se,Xe.p.y-se,se,a)),Ae.push(new o0(Xe.p.x-se,Xe.p.y+se,se,a)),Ae.push(new o0(Xe.p.x+se,Xe.p.y+se,se,a)),et+=4)}return f&&(console.log("num probes: "+et),console.log("best distance: "+Ve.d)),Ve.p}function Dte(a,c){return c.max-a.max}function o0(a,c,f,x){this.p=new u(a,c),this.h=f,this.d=function(S,I){for(var D=!1,H=1/0,Y=0;Y<I.length;Y++)for(var ee=I[Y],ie=0,se=ee.length,Ae=se-1;ie<se;Ae=ie++){var Te=ee[ie],ke=ee[Ae];Te.y>S.y!=ke.y>S.y&&S.x<(ke.x-Te.x)*(S.y-Te.y)/(ke.y-Te.y)+Te.x&&(D=!D),H=Math.min(H,uf(S,Te,ke))}return(D?1:-1)*Math.sqrt(H)}(this.p,x),this.max=this.d+this.h*Math.SQRT2}n0.prototype.push=function(a){this.data.push(a),this.length++,this._up(this.length-1)},n0.prototype.pop=function(){if(this.length!==0){var a=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),a}},n0.prototype.peek=function(){return this.data[0]},n0.prototype._up=function(a){for(var c=this.data,f=this.compare,x=c[a];a>0;){var S=a-1>>1,I=c[S];if(f(x,I)>=0)break;c[a]=I,a=S}c[a]=x},n0.prototype._down=function(a){for(var c=this.data,f=this.compare,x=this.length>>1,S=c[a];a<x;){var I=1+(a<<1),D=c[I],H=I+1;if(H<this.length&&f(c[H],D)<0&&(I=H,D=c[H]),f(D,S)>=0)break;c[a]=D,a=I}c[a]=S};var oP=Number.POSITIVE_INFINITY;function jk(a,c){return c[1]!==oP?function(f,x,S){var I=0,D=0;switch(x=Math.abs(x),S=Math.abs(S),f){case"top-right":case"top-left":case"top":D=S-7;break;case"bottom-right":case"bottom-left":case"bottom":D=7-S}switch(f){case"top-right":case"bottom-right":case"right":I=-x;break;case"top-left":case"bottom-left":case"left":I=x}return[I,D]}(a,c[0],c[1]):function(f,x){var S=0,I=0;x<0&&(x=0);var D=x/Math.sqrt(2);switch(f){case"top-right":case"top-left":I=D-7;break;case"bottom-right":case"bottom-left":I=7-D;break;case"bottom":I=7-x;break;case"top":I=x-7}switch(f){case"top-right":case"bottom-right":S=-D;break;case"top-left":case"bottom-left":S=D;break;case"left":S=x;break;case"right":S=-x}return[S,I]}(a,c[0])}function sP(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Gk(a,c,f,x,S,I,D,H,Y,ee,ie,se,Ae,Te,ke){var Ve=function(bt,Mt,Ut,$t,Ar,Qr,Cr,ni){for(var Pr=$t.layout.get("text-rotate").evaluate(Qr,{})*Math.PI/180,Vi=[],Ai=0,Gr=Mt.positionedLines;Ai<Gr.length;Ai+=1)for(var rn=Gr[Ai],Ri=0,_n=rn.positionedGlyphs;Ri<_n.length;Ri+=1){var si=_n[Ri];if(si.rect){var Pn=si.rect||{},Bo=4,is=!0,$o=1,Oo=0,ns=(Ar||ni)&&si.vertical,qs=si.metrics.advance*si.scale/2;if(ni&&Mt.verticalizable&&(Oo=rn.lineOffset/2-(si.imageName?-(24-si.metrics.width*si.scale)/2:24*(si.scale-1))),si.imageName){var Xs=Cr[si.imageName];is=Xs.sdf,Bo=1/($o=Xs.pixelRatio)}var Ya=Ar?[si.x+qs,si.y]:[0,0],ia=Ar?[0,0]:[si.x+qs+Ut[0],si.y+Ut[1]-Oo],Ka=[0,0];ns&&(Ka=ia,ia=[0,0]);var hs=(si.metrics.left-Bo)*si.scale-qs+ia[0],na=(-si.metrics.top-Bo)*si.scale+ia[1],un=hs+Pn.w*si.scale/$o,no=na+Pn.h*si.scale/$o,Kn=new u(hs,na),wn=new u(un,na),yl=new u(hs,no),Ra=new u(un,no);if(ns){var xo=new u(-qs,qs- -17),Es=-Math.PI/2,Ba=12-qs,Rn=new u(22-Ba,-(si.imageName?Ba:0)),lh=new(Function.prototype.bind.apply(u,[null].concat(Ka)));Kn._rotateAround(Es,xo)._add(Rn)._add(lh),wn._rotateAround(Es,xo)._add(Rn)._add(lh),yl._rotateAround(Es,xo)._add(Rn)._add(lh),Ra._rotateAround(Es,xo)._add(Rn)._add(lh)}if(Pr){var vc=Math.sin(Pr),ch=Math.cos(Pr),ds=[ch,-vc,vc,ch];Kn._matMult(ds),wn._matMult(ds),yl._matMult(ds),Ra._matMult(ds)}var uh=new u(0,0),Tu=new u(0,0);Vi.push({tl:Kn,tr:wn,bl:yl,br:Ra,tex:Pn,writingMode:Mt.writingMode,glyphOffset:Ya,sectionIndex:si.sectionIndex,isSDF:is,pixelOffsetTL:uh,pixelOffsetBR:Tu,minFontScaleX:0,minFontScaleY:0})}}return Vi}(0,f,H,S,I,D,x,a.allowVerticalPlacement),et=a.textSizeData,Xe=null;et.kind==="source"?(Xe=[128*S.layout.get("text-size").evaluate(D,{})])[0]>32640&&we(a.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):et.kind==="composite"&&((Xe=[128*Te.compositeTextSizes[0].evaluate(D,{},ke),128*Te.compositeTextSizes[1].evaluate(D,{},ke)])[0]>32640||Xe[1]>32640)&&we(a.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),a.addSymbols(a.text,Ve,Xe,H,I,D,ee,c,Y.lineStartIndex,Y.lineLength,Ae,ke);for(var at=0,_t=ie;at<_t.length;at+=1)se[_t[at]]=a.text.placedSymbolArray.length-1;return 4*Ve.length}function Wk(a){for(var c in a)return a[c];return null}function Lte(a,c,f,x){var S=a.compareText;if(c in S){for(var I=S[c],D=I.length-1;D>=0;D--)if(x.dist(I[D])<f)return!0}else S[c]=[];return S[c].push(x),!1}var Fte=ad.VectorTileFeature.types,Nte=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function o2(a,c,f,x,S,I,D,H,Y,ee,ie,se,Ae){var Te=H?Math.min(32640,Math.round(H[0])):0,ke=H?Math.min(32640,Math.round(H[1])):0;a.emplaceBack(c,f,Math.round(32*x),Math.round(32*S),I,D,(Te<<1)+(Y?1:0),ke,16*ee,16*ie,256*se,256*Ae)}function aP(a,c,f){a.emplaceBack(c.x,c.y,f),a.emplaceBack(c.x,c.y,f),a.emplaceBack(c.x,c.y,f),a.emplaceBack(c.x,c.y,f)}function kte(a){for(var c=0,f=a.sections;c<f.length;c+=1)if(sf(f[c].text))return!0;return!1}var s0=function(a){this.layoutVertexArray=new fp,this.indexArray=new Ga,this.programConfigurations=a,this.segments=new Ce,this.dynamicLayoutVertexArray=new th,this.opacityVertexArray=new ed,this.placedSymbolArray=new b};s0.prototype.isEmpty=function(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0},s0.prototype.upload=function(a,c,f,x){this.isEmpty()||(f&&(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,ute.members),this.indexBuffer=a.createIndexBuffer(this.indexArray,c),this.dynamicLayoutVertexBuffer=a.createVertexBuffer(this.dynamicLayoutVertexArray,fte.members,!0),this.opacityVertexBuffer=a.createVertexBuffer(this.opacityVertexArray,Nte,!0),this.opacityVertexBuffer.itemSize=1),(f||x)&&this.programConfigurations.upload(a))},s0.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},Tr("SymbolBuffers",s0);var xv=function(a,c,f){this.layoutVertexArray=new a,this.layoutAttributes=c,this.indexArray=new f,this.segments=new Ce,this.collisionVertexArray=new td};xv.prototype.upload=function(a){this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=a.createVertexBuffer(this.collisionVertexArray,hte.members,!0)},xv.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},Tr("CollisionBuffers",xv);var eo=function(a){this.collisionBoxArray=a.collisionBoxArray,this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(function(I){return I.id}),this.index=a.index,this.pixelRatio=a.pixelRatio,this.sourceLayerIndex=a.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=qa([]),this.placementViewportMatrix=qa([]);var c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=nP(this.zoom,c["text-size"]),this.iconSizeData=nP(this.zoom,c["icon-size"]);var f=this.layers[0].layout,x=f.get("symbol-sort-key"),S=f.get("symbol-z-order");this.canOverlap=f.get("text-allow-overlap")||f.get("icon-allow-overlap")||f.get("text-ignore-placement")||f.get("icon-ignore-placement"),this.sortFeaturesByKey=S!=="viewport-y"&&x.constantOr(1)!==void 0,this.sortFeaturesByY=(S==="viewport-y"||S==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,f.get("symbol-placement")==="point"&&(this.writingModes=f.get("text-writing-mode").map(function(I){return yc[I]})),this.stateDependentLayerIds=this.layers.filter(function(I){return I.isStateDependent()}).map(function(I){return I.id}),this.sourceID=a.sourceID};eo.prototype.createArrays=function(){this.text=new s0(new li(this.layers,this.zoom,function(a){return/^text/.test(a)})),this.icon=new s0(new li(this.layers,this.zoom,function(a){return/^icon/.test(a)})),this.glyphOffsetArray=new V,this.lineVertexArray=new q,this.symbolInstances=new k},eo.prototype.calculateGlyphDependencies=function(a,c,f,x,S){for(var I=0;I<a.length;I++)if(c[a.charCodeAt(I)]=!0,(f||x)&&S){var D=_v[a.charAt(I)];D&&(c[D.charCodeAt(0)]=!0)}},eo.prototype.populate=function(a,c,f){var x=this.layers[0],S=x.layout,I=S.get("text-font"),D=S.get("text-field"),H=S.get("icon-image"),Y=(D.value.kind!=="constant"||D.value.value instanceof ko&&!D.value.value.isEmpty()||D.value.value.toString().length>0)&&(I.value.kind!=="constant"||I.value.value.length>0),ee=H.value.kind!=="constant"||!!H.value.value||Object.keys(H.parameters).length>0,ie=S.get("symbol-sort-key");if(this.features=[],Y||ee){for(var se=c.iconDependencies,Ae=c.glyphDependencies,Te=c.availableImages,ke=new qi(this.zoom),Ve=0,et=a;Ve<et.length;Ve+=1){var Xe=et[Ve],at=Xe.feature,_t=Xe.id,bt=Xe.index,Mt=Xe.sourceLayerIndex,Ut=x._featureFilter.needGeometry,$t=Jo(at,Ut);if(x._featureFilter.filter(ke,$t,f)){Ut||($t.geometry=Io(at));var Ar=void 0;if(Y){var Qr=x.getValueAndResolveTokens("text-field",$t,f,Te),Cr=ko.factory(Qr);kte(Cr)&&(this.hasRTLText=!0),(!this.hasRTLText||kA()==="unavailable"||this.hasRTLText&&Al.isParsed())&&(Ar=pte(Cr,x,$t))}var ni=void 0;if(ee){var Pr=x.getValueAndResolveTokens("icon-image",$t,f,Te);ni=Pr instanceof Yo?Pr:Yo.fromString(Pr)}if(Ar||ni){var Vi=this.sortFeaturesByKey?ie.evaluate($t,{},f):void 0;if(this.features.push({id:_t,text:Ar,icon:ni,index:bt,sourceLayerIndex:Mt,geometry:$t.geometry,properties:at.properties,type:Fte[at.type],sortKey:Vi}),ni&&(se[ni.name]=!0),Ar){var Ai=I.evaluate($t,{},f).join(","),Gr=S.get("text-rotation-alignment")==="map"&&S.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(yc.vertical)>=0;for(var rn=0,Ri=Ar.sections;rn<Ri.length;rn+=1){var _n=Ri[rn];if(_n.image)se[_n.image.name]=!0;else{var si=up(Ar.toString()),Pn=_n.fontStack||Ai,Bo=Ae[Pn]=Ae[Pn]||{};this.calculateGlyphDependencies(_n.text,Bo,Gr,this.allowVerticalPlacement,si)}}}}}}S.get("symbol-placement")==="line"&&(this.features=function(is){var $o={},Oo={},ns=[],qs=0;function Xs(xo){ns.push(is[xo]),qs++}function Ya(xo,Es,Ba){var Rn=Oo[xo];return delete Oo[xo],Oo[Es]=Rn,ns[Rn].geometry[0].pop(),ns[Rn].geometry[0]=ns[Rn].geometry[0].concat(Ba[0]),Rn}function ia(xo,Es,Ba){var Rn=$o[Es];return delete $o[Es],$o[xo]=Rn,ns[Rn].geometry[0].shift(),ns[Rn].geometry[0]=Ba[0].concat(ns[Rn].geometry[0]),Rn}function Ka(xo,Es,Ba){var Rn=Ba?Es[0][Es[0].length-1]:Es[0][0];return xo+":"+Rn.x+":"+Rn.y}for(var hs=0;hs<is.length;hs++){var na=is[hs],un=na.geometry,no=na.text?na.text.toString():null;if(no){var Kn=Ka(no,un),wn=Ka(no,un,!0);if(Kn in Oo&&wn in $o&&Oo[Kn]!==$o[wn]){var yl=ia(Kn,wn,un),Ra=Ya(Kn,wn,ns[yl].geometry);delete $o[Kn],delete Oo[wn],Oo[Ka(no,ns[Ra].geometry,!0)]=Ra,ns[yl].geometry=null}else Kn in Oo?Ya(Kn,wn,un):wn in $o?ia(Kn,wn,un):(Xs(hs),$o[Kn]=qs-1,Oo[wn]=qs-1)}else Xs(hs)}return ns.filter(function(xo){return xo.geometry})}(this.features)),this.sortFeaturesByKey&&this.features.sort(function(is,$o){return is.sortKey-$o.sortKey})}},eo.prototype.update=function(a,c,f){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(a,c,this.layers,f),this.icon.programConfigurations.updatePaintArrays(a,c,this.layers,f))},eo.prototype.isEmpty=function(){return this.symbolInstances.length===0&&!this.hasRTLText},eo.prototype.uploadPending=function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload},eo.prototype.upload=function(a){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(a),this.iconCollisionBox.upload(a)),this.text.upload(a,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(a,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0},eo.prototype.destroyDebugData=function(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()},eo.prototype.destroy=function(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()},eo.prototype.addToLineVertexArray=function(a,c){var f=this.lineVertexArray.length;if(a.segment!==void 0){for(var x=a.dist(c[a.segment+1]),S=a.dist(c[a.segment]),I={},D=a.segment+1;D<c.length;D++)I[D]={x:c[D].x,y:c[D].y,tileUnitDistanceFromAnchor:x},D<c.length-1&&(x+=c[D+1].dist(c[D]));for(var H=a.segment||0;H>=0;H--)I[H]={x:c[H].x,y:c[H].y,tileUnitDistanceFromAnchor:S},H>0&&(S+=c[H-1].dist(c[H]));for(var Y=0;Y<c.length;Y++){var ee=I[Y];this.lineVertexArray.emplaceBack(ee.x,ee.y,ee.tileUnitDistanceFromAnchor)}}return{lineStartIndex:f,lineLength:this.lineVertexArray.length-f}},eo.prototype.addSymbols=function(a,c,f,x,S,I,D,H,Y,ee,ie,se){for(var Ae=a.indexArray,Te=a.layoutVertexArray,ke=a.segments.prepareSegment(4*c.length,Te,Ae,this.canOverlap?I.sortKey:void 0),Ve=this.glyphOffsetArray.length,et=ke.vertexLength,Xe=this.allowVerticalPlacement&&D===yc.vertical?Math.PI/2:0,at=I.text&&I.text.sections,_t=0;_t<c.length;_t++){var bt=c[_t],Mt=bt.tl,Ut=bt.tr,$t=bt.bl,Ar=bt.br,Qr=bt.tex,Cr=bt.pixelOffsetTL,ni=bt.pixelOffsetBR,Pr=bt.minFontScaleX,Vi=bt.minFontScaleY,Ai=bt.glyphOffset,Gr=bt.isSDF,rn=bt.sectionIndex,Ri=ke.vertexLength,_n=Ai[1];o2(Te,H.x,H.y,Mt.x,_n+Mt.y,Qr.x,Qr.y,f,Gr,Cr.x,Cr.y,Pr,Vi),o2(Te,H.x,H.y,Ut.x,_n+Ut.y,Qr.x+Qr.w,Qr.y,f,Gr,ni.x,Cr.y,Pr,Vi),o2(Te,H.x,H.y,$t.x,_n+$t.y,Qr.x,Qr.y+Qr.h,f,Gr,Cr.x,ni.y,Pr,Vi),o2(Te,H.x,H.y,Ar.x,_n+Ar.y,Qr.x+Qr.w,Qr.y+Qr.h,f,Gr,ni.x,ni.y,Pr,Vi),aP(a.dynamicLayoutVertexArray,H,Xe),Ae.emplaceBack(Ri,Ri+1,Ri+2),Ae.emplaceBack(Ri+1,Ri+2,Ri+3),ke.vertexLength+=4,ke.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ai[0]),_t!==c.length-1&&rn===c[_t+1].sectionIndex||a.programConfigurations.populatePaintArrays(Te.length,I,I.index,{},se,at&&at[rn])}a.placedSymbolArray.emplaceBack(H.x,H.y,Ve,this.glyphOffsetArray.length-Ve,et,Y,ee,H.segment,f?f[0]:0,f?f[1]:0,x[0],x[1],D,0,!1,0,ie)},eo.prototype._addCollisionDebugVertex=function(a,c,f,x,S,I){return c.emplaceBack(0,0),a.emplaceBack(f.x,f.y,x,S,Math.round(I.x),Math.round(I.y))},eo.prototype.addCollisionDebugVertices=function(a,c,f,x,S,I,D){var H=S.segments.prepareSegment(4,S.layoutVertexArray,S.indexArray),Y=H.vertexLength,ee=S.layoutVertexArray,ie=S.collisionVertexArray,se=D.anchorX,Ae=D.anchorY;this._addCollisionDebugVertex(ee,ie,I,se,Ae,new u(a,c)),this._addCollisionDebugVertex(ee,ie,I,se,Ae,new u(f,c)),this._addCollisionDebugVertex(ee,ie,I,se,Ae,new u(f,x)),this._addCollisionDebugVertex(ee,ie,I,se,Ae,new u(a,x)),H.vertexLength+=4;var Te=S.indexArray;Te.emplaceBack(Y,Y+1),Te.emplaceBack(Y+1,Y+2),Te.emplaceBack(Y+2,Y+3),Te.emplaceBack(Y+3,Y),H.primitiveLength+=4},eo.prototype.addDebugCollisionBoxes=function(a,c,f,x){for(var S=a;S<c;S++){var I=this.collisionBoxArray.get(S);this.addCollisionDebugVertices(I.x1,I.y1,I.x2,I.y2,x?this.textCollisionBox:this.iconCollisionBox,I.anchorPoint,f)}},eo.prototype.generateCollisionDebugBuffers=function(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new xv(rh,wk.members,cf),this.iconCollisionBox=new xv(rh,wk.members,cf);for(var a=0;a<this.symbolInstances.length;a++){var c=this.symbolInstances.get(a);this.addDebugCollisionBoxes(c.textBoxStartIndex,c.textBoxEndIndex,c,!0),this.addDebugCollisionBoxes(c.verticalTextBoxStartIndex,c.verticalTextBoxEndIndex,c,!0),this.addDebugCollisionBoxes(c.iconBoxStartIndex,c.iconBoxEndIndex,c,!1),this.addDebugCollisionBoxes(c.verticalIconBoxStartIndex,c.verticalIconBoxEndIndex,c,!1)}},eo.prototype._deserializeCollisionBoxesForSymbol=function(a,c,f,x,S,I,D,H,Y){for(var ee={},ie=c;ie<f;ie++){var se=a.get(ie);ee.textBox={x1:se.x1,y1:se.y1,x2:se.x2,y2:se.y2,anchorPointX:se.anchorPointX,anchorPointY:se.anchorPointY},ee.textFeatureIndex=se.featureIndex;break}for(var Ae=x;Ae<S;Ae++){var Te=a.get(Ae);ee.verticalTextBox={x1:Te.x1,y1:Te.y1,x2:Te.x2,y2:Te.y2,anchorPointX:Te.anchorPointX,anchorPointY:Te.anchorPointY},ee.verticalTextFeatureIndex=Te.featureIndex;break}for(var ke=I;ke<D;ke++){var Ve=a.get(ke);ee.iconBox={x1:Ve.x1,y1:Ve.y1,x2:Ve.x2,y2:Ve.y2,anchorPointX:Ve.anchorPointX,anchorPointY:Ve.anchorPointY},ee.iconFeatureIndex=Ve.featureIndex;break}for(var et=H;et<Y;et++){var Xe=a.get(et);ee.verticalIconBox={x1:Xe.x1,y1:Xe.y1,x2:Xe.x2,y2:Xe.y2,anchorPointX:Xe.anchorPointX,anchorPointY:Xe.anchorPointY},ee.verticalIconFeatureIndex=Xe.featureIndex;break}return ee},eo.prototype.deserializeCollisionBoxes=function(a){this.collisionArrays=[];for(var c=0;c<this.symbolInstances.length;c++){var f=this.symbolInstances.get(c);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(a,f.textBoxStartIndex,f.textBoxEndIndex,f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f.iconBoxStartIndex,f.iconBoxEndIndex,f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex))}},eo.prototype.hasTextData=function(){return this.text.segments.get().length>0},eo.prototype.hasIconData=function(){return this.icon.segments.get().length>0},eo.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},eo.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},eo.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},eo.prototype.addIndicesForPlacedSymbol=function(a,c){for(var f=a.placedSymbolArray.get(c),x=f.vertexStartIndex+4*f.numGlyphs,S=f.vertexStartIndex;S<x;S+=4)a.indexArray.emplaceBack(S,S+1,S+2),a.indexArray.emplaceBack(S+1,S+2,S+3)},eo.prototype.getSortedSymbolIndexes=function(a){if(this.sortedAngle===a&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;for(var c=Math.sin(a),f=Math.cos(a),x=[],S=[],I=[],D=0;D<this.symbolInstances.length;++D){I.push(D);var H=this.symbolInstances.get(D);x.push(0|Math.round(c*H.anchorX+f*H.anchorY)),S.push(H.featureIndex)}return I.sort(function(Y,ee){return x[Y]-x[ee]||S[ee]-S[Y]}),I},eo.prototype.addToSortKeyRanges=function(a,c){var f=this.sortKeyRanges[this.sortKeyRanges.length-1];f&&f.sortKey===c?f.symbolInstanceEnd=a+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:a,symbolInstanceEnd:a+1})},eo.prototype.sortFeatures=function(a){var c=this;if(this.sortFeaturesByY&&this.sortedAngle!==a&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(a),this.sortedAngle=a,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var f=0,x=this.symbolInstanceIndexes;f<x.length;f+=1){var S=this.symbolInstances.get(x[f]);this.featureSortOrder.push(S.featureIndex),[S.rightJustifiedTextSymbolIndex,S.centerJustifiedTextSymbolIndex,S.leftJustifiedTextSymbolIndex].forEach(function(I,D,H){I>=0&&H.indexOf(I)===D&&c.addIndicesForPlacedSymbol(c.text,I)}),S.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,S.verticalPlacedTextSymbolIndex),S.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,S.placedIconSymbolIndex),S.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,S.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},Tr("SymbolBucket",eo,{omit:["layers","collisionBoxArray","features","compareText"]}),eo.MAX_GLYPHS=65535,eo.addDynamicAttributes=aP;var Ute=new Rs({"symbol-placement":new ei(Se.layout_symbol["symbol-placement"]),"symbol-spacing":new ei(Se.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ei(Se.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new zr(Se.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ei(Se.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ei(Se.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new ei(Se.layout_symbol["icon-ignore-placement"]),"icon-optional":new ei(Se.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ei(Se.layout_symbol["icon-rotation-alignment"]),"icon-size":new zr(Se.layout_symbol["icon-size"]),"icon-text-fit":new ei(Se.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ei(Se.layout_symbol["icon-text-fit-padding"]),"icon-image":new zr(Se.layout_symbol["icon-image"]),"icon-rotate":new zr(Se.layout_symbol["icon-rotate"]),"icon-padding":new ei(Se.layout_symbol["icon-padding"]),"icon-keep-upright":new ei(Se.layout_symbol["icon-keep-upright"]),"icon-offset":new zr(Se.layout_symbol["icon-offset"]),"icon-anchor":new zr(Se.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ei(Se.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ei(Se.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ei(Se.layout_symbol["text-rotation-alignment"]),"text-field":new zr(Se.layout_symbol["text-field"]),"text-font":new zr(Se.layout_symbol["text-font"]),"text-size":new zr(Se.layout_symbol["text-size"]),"text-max-width":new zr(Se.layout_symbol["text-max-width"]),"text-line-height":new ei(Se.layout_symbol["text-line-height"]),"text-letter-spacing":new zr(Se.layout_symbol["text-letter-spacing"]),"text-justify":new zr(Se.layout_symbol["text-justify"]),"text-radial-offset":new zr(Se.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ei(Se.layout_symbol["text-variable-anchor"]),"text-anchor":new zr(Se.layout_symbol["text-anchor"]),"text-max-angle":new ei(Se.layout_symbol["text-max-angle"]),"text-writing-mode":new ei(Se.layout_symbol["text-writing-mode"]),"text-rotate":new zr(Se.layout_symbol["text-rotate"]),"text-padding":new ei(Se.layout_symbol["text-padding"]),"text-keep-upright":new ei(Se.layout_symbol["text-keep-upright"]),"text-transform":new zr(Se.layout_symbol["text-transform"]),"text-offset":new zr(Se.layout_symbol["text-offset"]),"text-allow-overlap":new ei(Se.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new ei(Se.layout_symbol["text-ignore-placement"]),"text-optional":new ei(Se.layout_symbol["text-optional"])}),lP={paint:new Rs({"icon-opacity":new zr(Se.paint_symbol["icon-opacity"]),"icon-color":new zr(Se.paint_symbol["icon-color"]),"icon-halo-color":new zr(Se.paint_symbol["icon-halo-color"]),"icon-halo-width":new zr(Se.paint_symbol["icon-halo-width"]),"icon-halo-blur":new zr(Se.paint_symbol["icon-halo-blur"]),"icon-translate":new ei(Se.paint_symbol["icon-translate"]),"icon-translate-anchor":new ei(Se.paint_symbol["icon-translate-anchor"]),"text-opacity":new zr(Se.paint_symbol["text-opacity"]),"text-color":new zr(Se.paint_symbol["text-color"],{runtimeType:lr,getOverride:function(a){return a.textColor},hasOverride:function(a){return!!a.textColor}}),"text-halo-color":new zr(Se.paint_symbol["text-halo-color"]),"text-halo-width":new zr(Se.paint_symbol["text-halo-width"]),"text-halo-blur":new zr(Se.paint_symbol["text-halo-blur"]),"text-translate":new ei(Se.paint_symbol["text-translate"]),"text-translate-anchor":new ei(Se.paint_symbol["text-translate-anchor"])}),layout:Ute},a0=function(a){this.type=a.property.overrides?a.property.overrides.runtimeType:Mr,this.defaultValue=a};a0.prototype.evaluate=function(a){if(a.formattedSection){var c=this.defaultValue.property.overrides;if(c&&c.hasOverride(a.formattedSection))return c.getOverride(a.formattedSection)}return a.feature&&a.featureState?this.defaultValue.evaluate(a.feature,a.featureState):this.defaultValue.property.specification.default},a0.prototype.eachChild=function(a){this.defaultValue.isConstant()||a(this.defaultValue.value._styleExpression.expression)},a0.prototype.outputDefined=function(){return!1},a0.prototype.serialize=function(){return null},Tr("FormatSectionOverride",a0,{omit:["defaultValue"]});var zte=function(a){function c(f){a.call(this,f,lP)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.recalculate=function(f,x){if(a.prototype.recalculate.call(this,f,x),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")),this.layout.get("symbol-placement")==="point"){var S=this.layout.get("text-writing-mode");if(S){for(var I=[],D=0,H=S;D<H.length;D+=1){var Y=H[D];I.indexOf(Y)<0&&I.push(Y)}this.layout._values["text-writing-mode"]=I}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()},c.prototype.getValueAndResolveTokens=function(f,x,S,I){var D=this.layout.get(f).evaluate(x,{},S,I),H=this._unevaluatedLayout._values[f];return H.isDataDriven()||ha(H.value)||!D?D:function(Y,ee){return ee.replace(/{([^{}]+)}/g,function(ie,se){return se in Y?String(Y[se]):""})}(x.properties,D)},c.prototype.createBucket=function(f){return new eo(f)},c.prototype.queryRadius=function(){return 0},c.prototype.queryIntersectsFeature=function(){return!1},c.prototype._setPaintOverrides=function(){for(var f=0,x=lP.paint.overridableProperties;f<x.length;f+=1){var S=x[f];if(c.hasPaintOverride(this.layout,S)){var I,D=this.paint.get(S),H=new a0(D),Y=new Sn(H,D.property.specification);I=D.value.kind==="constant"||D.value.kind==="source"?new Fe("source",Y):new _i("composite",Y,D.value.zoomStops,D.value._interpolationType),this.paint._values[S]=new Ps(D.property,I,D.parameters)}}},c.prototype._handleOverridablePaintPropertyUpdate=function(f,x,S){return!(!this.layout||x.isDataDriven()||S.isDataDriven())&&c.hasPaintOverride(this.layout,f)},c.hasPaintOverride=function(f,x){var S=f.get("text-field"),I=lP.paint.properties[x],D=!1,H=function(ie){for(var se=0,Ae=ie;se<Ae.length;se+=1)if(I.overrides&&I.overrides.hasOverride(Ae[se]))return void(D=!0)};if(S.value.kind==="constant"&&S.value.value instanceof ko)H(S.value.value.sections);else if(S.value.kind==="source"){var Y=function(ie){D||(ie instanceof cs&&zn(ie.value)===vn?H(ie.value.sections):ie instanceof $s?H(ie.sections):ie.eachChild(Y))},ee=S.value;ee._styleExpression&&Y(ee._styleExpression.expression)}return D},c}(Ma),Vte={paint:new Rs({"background-color":new ei(Se.paint_background["background-color"]),"background-pattern":new da(Se.paint_background["background-pattern"]),"background-opacity":new ei(Se.paint_background["background-opacity"])})},Hte=function(a){function c(f){a.call(this,f,Vte)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c}(Ma),jte={paint:new Rs({"raster-opacity":new ei(Se.paint_raster["raster-opacity"]),"raster-hue-rotate":new ei(Se.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ei(Se.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ei(Se.paint_raster["raster-brightness-max"]),"raster-saturation":new ei(Se.paint_raster["raster-saturation"]),"raster-contrast":new ei(Se.paint_raster["raster-contrast"]),"raster-resampling":new ei(Se.paint_raster["raster-resampling"]),"raster-fade-duration":new ei(Se.paint_raster["raster-fade-duration"])})},Gte=function(a){function c(f){a.call(this,f,jte)}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c}(Ma),Wte=function(a){function c(f){a.call(this,f,{}),this.implementation=f}return a&&(c.__proto__=a),(c.prototype=Object.create(a&&a.prototype)).constructor=c,c.prototype.is3D=function(){return this.implementation.renderingMode==="3d"},c.prototype.hasOffscreenPass=function(){return this.implementation.prerender!==void 0},c.prototype.recalculate=function(){},c.prototype.updateTransitions=function(){},c.prototype.hasTransition=function(){},c.prototype.serialize=function(){},c.prototype.onAdd=function(f){this.implementation.onAdd&&this.implementation.onAdd(f,f.painter.context.gl)},c.prototype.onRemove=function(f){this.implementation.onRemove&&this.implementation.onRemove(f,f.painter.context.gl)},c}(Ma),qte={circle:hv,heatmap:Xw,hillshade:od,fill:io,"fill-extrusion":ite,line:cte,symbol:zte,background:Hte,raster:Gte},qk=v.HTMLImageElement,Xk=v.HTMLCanvasElement,Yk=v.HTMLVideoElement,Kk=v.ImageData,s2=v.ImageBitmap,HA=function(a,c,f,x){this.context=a,this.format=f,this.texture=a.gl.createTexture(),this.update(c,x)};HA.prototype.update=function(a,c,f){var x=a.width,S=a.height,I=!(this.size&&this.size[0]===x&&this.size[1]===S||f),D=this.context,H=D.gl;if(this.useMipmap=Boolean(c&&c.useMipmap),H.bindTexture(H.TEXTURE_2D,this.texture),D.pixelStoreUnpackFlipY.set(!1),D.pixelStoreUnpack.set(1),D.pixelStoreUnpackPremultiplyAlpha.set(this.format===H.RGBA&&(!c||c.premultiply!==!1)),I)this.size=[x,S],a instanceof qk||a instanceof Xk||a instanceof Yk||a instanceof Kk||s2&&a instanceof s2?H.texImage2D(H.TEXTURE_2D,0,this.format,this.format,H.UNSIGNED_BYTE,a):H.texImage2D(H.TEXTURE_2D,0,this.format,x,S,0,this.format,H.UNSIGNED_BYTE,a.data);else{var Y=f||{x:0,y:0},ee=Y.x,ie=Y.y;a instanceof qk||a instanceof Xk||a instanceof Yk||a instanceof Kk||s2&&a instanceof s2?H.texSubImage2D(H.TEXTURE_2D,0,ee,ie,H.RGBA,H.UNSIGNED_BYTE,a):H.texSubImage2D(H.TEXTURE_2D,0,ee,ie,x,S,H.RGBA,H.UNSIGNED_BYTE,a.data)}this.useMipmap&&this.isSizePowerOfTwo()&&H.generateMipmap(H.TEXTURE_2D)},HA.prototype.bind=function(a,c,f){var x=this.context.gl;x.bindTexture(x.TEXTURE_2D,this.texture),f!==x.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(f=x.LINEAR),a!==this.filter&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,a),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,f||a),this.filter=a),c!==this.wrap&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,c),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,c),this.wrap=c)},HA.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},HA.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var cP=function(a){var c=this;this._callback=a,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){c._triggered=!1,c._callback()})};cP.prototype.trigger=function(){var a=this;this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(function(){a._triggered=!1,a._callback()},0))},cP.prototype.remove=function(){delete this._channel,this._callback=function(){}};var l0=function(a,c,f){this.target=a,this.parent=c,this.mapId=f,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},ge(["receive","process"],this),this.invoker=new cP(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Le()?a:v};function Zk(a,c,f){var x=2*Math.PI*6378137/256/Math.pow(2,f);return[a*x-2*Math.PI*6378137/2,c*x-2*Math.PI*6378137/2]}l0.prototype.send=function(a,c,f,x,S){var I=this;S===void 0&&(S=!1);var D=Math.round(1e18*Math.random()).toString(36).substring(0,10);f&&(this.callbacks[D]=f);var H=Yt(this.globalScope)?void 0:[];return this.target.postMessage({id:D,type:a,hasCallback:!!f,targetMapId:x,mustQueue:S,sourceMapId:this.mapId,data:Ha(c,H)},H),{cancel:function(){f&&delete I.callbacks[D],I.target.postMessage({id:D,type:"<cancel>",targetMapId:x,sourceMapId:I.mapId})}}},l0.prototype.receive=function(a){var c=a.data,f=c.id;if(f&&(!c.targetMapId||this.mapId===c.targetMapId))if(c.type==="<cancel>"){delete this.tasks[f];var x=this.cancelCallbacks[f];delete this.cancelCallbacks[f],x&&x()}else Le()||c.mustQueue?(this.tasks[f]=c,this.taskQueue.push(f),this.invoker.trigger()):this.processTask(f,c)},l0.prototype.process=function(){if(this.taskQueue.length){var a=this.taskQueue.shift(),c=this.tasks[a];delete this.tasks[a],this.taskQueue.length&&this.invoker.trigger(),c&&this.processTask(a,c)}},l0.prototype.processTask=function(a,c){var f=this;if(c.type==="<response>"){var x=this.callbacks[a];delete this.callbacks[a],x&&(c.error?x(ja(c.error)):x(null,ja(c.data)))}else{var S=!1,I=Yt(this.globalScope)?void 0:[],D=c.hasCallback?function(ie,se){S=!0,delete f.cancelCallbacks[a],f.target.postMessage({id:a,type:"<response>",sourceMapId:f.mapId,error:ie?Ha(ie):null,data:Ha(se,I)},I)}:function(ie){S=!0},H=null,Y=ja(c.data);if(this.parent[c.type])H=this.parent[c.type](c.sourceMapId,Y,D);else if(this.parent.getWorkerSource){var ee=c.type.split(".");H=this.parent.getWorkerSource(c.sourceMapId,ee[0],Y.source)[ee[1]](Y,D)}else D(new Error("Could not find function "+c.type));!S&&H&&H.cancel&&(this.cancelCallbacks[a]=H.cancel)}},l0.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Os=function(a,c){a&&(c?this.setSouthWest(a).setNorthEast(c):a.length===4?this.setSouthWest([a[0],a[1]]).setNorthEast([a[2],a[3]]):this.setSouthWest(a[0]).setNorthEast(a[1]))};Os.prototype.setNorthEast=function(a){return this._ne=a instanceof Ro?new Ro(a.lng,a.lat):Ro.convert(a),this},Os.prototype.setSouthWest=function(a){return this._sw=a instanceof Ro?new Ro(a.lng,a.lat):Ro.convert(a),this},Os.prototype.extend=function(a){var c,f,x=this._sw,S=this._ne;if(a instanceof Ro)c=a,f=a;else{if(!(a instanceof Os))return Array.isArray(a)?a.length===4||a.every(Array.isArray)?this.extend(Os.convert(a)):this.extend(Ro.convert(a)):this;if(f=a._ne,!(c=a._sw)||!f)return this}return x||S?(x.lng=Math.min(c.lng,x.lng),x.lat=Math.min(c.lat,x.lat),S.lng=Math.max(f.lng,S.lng),S.lat=Math.max(f.lat,S.lat)):(this._sw=new Ro(c.lng,c.lat),this._ne=new Ro(f.lng,f.lat)),this},Os.prototype.getCenter=function(){return new Ro((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Os.prototype.getSouthWest=function(){return this._sw},Os.prototype.getNorthEast=function(){return this._ne},Os.prototype.getNorthWest=function(){return new Ro(this.getWest(),this.getNorth())},Os.prototype.getSouthEast=function(){return new Ro(this.getEast(),this.getSouth())},Os.prototype.getWest=function(){return this._sw.lng},Os.prototype.getSouth=function(){return this._sw.lat},Os.prototype.getEast=function(){return this._ne.lng},Os.prototype.getNorth=function(){return this._ne.lat},Os.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Os.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Os.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Os.prototype.contains=function(a){var c=Ro.convert(a),f=c.lng,x=c.lat,S=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(S=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=x&&x<=this._ne.lat&&S},Os.convert=function(a){return!a||a instanceof Os?a:new Os(a)};var Ro=function(a,c){if(isNaN(a)||isNaN(c))throw new Error("Invalid LngLat object: ("+a+", "+c+")");if(this.lng=+a,this.lat=+c,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Ro.prototype.wrap=function(){return new Ro(F(this.lng,-180,180),this.lat)},Ro.prototype.toArray=function(){return[this.lng,this.lat]},Ro.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Ro.prototype.distanceTo=function(a){var c=Math.PI/180,f=this.lat*c,x=a.lat*c,S=Math.sin(f)*Math.sin(x)+Math.cos(f)*Math.cos(x)*Math.cos((a.lng-this.lng)*c);return 63710088e-1*Math.acos(Math.min(S,1))},Ro.prototype.toBounds=function(a){a===void 0&&(a=0);var c=360*a/40075017,f=c/Math.cos(Math.PI/180*this.lat);return new Os(new Ro(this.lng-f,this.lat-c),new Ro(this.lng+f,this.lat+c))},Ro.convert=function(a){if(a instanceof Ro)return a;if(Array.isArray(a)&&(a.length===2||a.length===3))return new Ro(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&typeof a=="object"&&a!==null)return new Ro(Number("lng"in a?a.lng:a.lon),Number(a.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")};var Jk=2*Math.PI*63710088e-1;function Qk(a){return Jk*Math.cos(a*Math.PI/180)}function $k(a){return(180+a)/360}function e6(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function t6(a,c){return a/Qk(c)}function uP(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}var jA=function(a,c,f){f===void 0&&(f=0),this.x=+a,this.y=+c,this.z=+f};jA.fromLngLat=function(a,c){c===void 0&&(c=0);var f=Ro.convert(a);return new jA($k(f.lng),e6(f.lat),t6(c,f.lat))},jA.prototype.toLngLat=function(){return new Ro(360*this.x-180,uP(this.y))},jA.prototype.toAltitude=function(){return this.z*Qk(uP(this.y))},jA.prototype.meterInMercatorCoordinateUnits=function(){return 1/Jk*(a=uP(this.y),1/Math.cos(a*Math.PI/180));var a};var GA=function(a,c,f){this.z=a,this.x=c,this.y=f,this.key=bv(0,a,a,c,f)};GA.prototype.equals=function(a){return this.z===a.z&&this.x===a.x&&this.y===a.y},GA.prototype.url=function(a,c){var f,x,S,I,D,H=(x=this.y,S=this.z,I=Zk(256*(f=this.x),256*(x=Math.pow(2,S)-x-1),S),D=Zk(256*(f+1),256*(x+1),S),I[0]+","+I[1]+","+D[0]+","+D[1]),Y=function(ee,ie,se){for(var Ae,Te="",ke=ee;ke>0;ke--)Te+=(ie&(Ae=1<<ke-1)?1:0)+(se&Ae?2:0);return Te}(this.z,this.x,this.y);return a[(this.x+this.y)%a.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String(c==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",Y).replace("{bbox-epsg-3857}",H)},GA.prototype.getTilePoint=function(a){var c=Math.pow(2,this.z);return new u(8192*(a.x*c-this.x),8192*(a.y*c-this.y))},GA.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var r6=function(a,c){this.wrap=a,this.canonical=c,this.key=bv(a,c.z,c.z,c.x,c.y)},Ds=function(a,c,f,x,S){this.overscaledZ=a,this.wrap=c,this.canonical=new GA(f,+x,+S),this.key=bv(c,a,f,x,S)};function bv(a,c,f,x,S){(a*=2)<0&&(a=-1*a-1);var I=1<<f;return(I*I*a+I*S+x).toString(36)+f.toString(36)+c.toString(36)}Ds.prototype.equals=function(a){return this.overscaledZ===a.overscaledZ&&this.wrap===a.wrap&&this.canonical.equals(a.canonical)},Ds.prototype.scaledTo=function(a){var c=this.canonical.z-a;return a>this.canonical.z?new Ds(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ds(a,this.wrap,a,this.canonical.x>>c,this.canonical.y>>c)},Ds.prototype.calculateScaledKey=function(a,c){var f=this.canonical.z-a;return a>this.canonical.z?bv(this.wrap*+c,a,this.canonical.z,this.canonical.x,this.canonical.y):bv(this.wrap*+c,a,a,this.canonical.x>>f,this.canonical.y>>f)},Ds.prototype.isChildOf=function(a){if(a.wrap!==this.wrap)return!1;var c=this.canonical.z-a.canonical.z;return a.overscaledZ===0||a.overscaledZ<this.overscaledZ&&a.canonical.x===this.canonical.x>>c&&a.canonical.y===this.canonical.y>>c},Ds.prototype.children=function(a){if(this.overscaledZ>=a)return[new Ds(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var c=this.canonical.z+1,f=2*this.canonical.x,x=2*this.canonical.y;return[new Ds(c,this.wrap,c,f,x),new Ds(c,this.wrap,c,f+1,x),new Ds(c,this.wrap,c,f,x+1),new Ds(c,this.wrap,c,f+1,x+1)]},Ds.prototype.isLessThan=function(a){return this.wrap<a.wrap||!(this.wrap>a.wrap)&&(this.overscaledZ<a.overscaledZ||!(this.overscaledZ>a.overscaledZ)&&(this.canonical.x<a.canonical.x||!(this.canonical.x>a.canonical.x)&&this.canonical.y<a.canonical.y))},Ds.prototype.wrapped=function(){return new Ds(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},Ds.prototype.unwrapTo=function(a){return new Ds(this.overscaledZ,a,this.canonical.z,this.canonical.x,this.canonical.y)},Ds.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},Ds.prototype.toUnwrapped=function(){return new r6(this.wrap,this.canonical)},Ds.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},Ds.prototype.getTilePoint=function(a){return this.canonical.getTilePoint(new jA(a.x-this.wrap,a.y))},Tr("CanonicalTileID",GA),Tr("OverscaledTileID",Ds,{omit:["posMatrix"]});var cd=function(a,c,f){if(this.uid=a,c.height!==c.width)throw new RangeError("DEM tiles must be square");if(f&&f!=="mapbox"&&f!=="terrarium")return we('"'+f+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');this.stride=c.height;var x=this.dim=c.height-2;this.data=new Uint32Array(c.data.buffer),this.encoding=f||"mapbox";for(var S=0;S<x;S++)this.data[this._idx(-1,S)]=this.data[this._idx(0,S)],this.data[this._idx(x,S)]=this.data[this._idx(x-1,S)],this.data[this._idx(S,-1)]=this.data[this._idx(S,0)],this.data[this._idx(S,x)]=this.data[this._idx(S,x-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(x,-1)]=this.data[this._idx(x-1,0)],this.data[this._idx(-1,x)]=this.data[this._idx(0,x-1)],this.data[this._idx(x,x)]=this.data[this._idx(x-1,x-1)]};cd.prototype.get=function(a,c){var f=new Uint8Array(this.data.buffer),x=4*this._idx(a,c);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(f[x],f[x+1],f[x+2])},cd.prototype.getUnpackVector=function(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]},cd.prototype._idx=function(a,c){if(a<-1||a>=this.dim+1||c<-1||c>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(c+1)*this.stride+(a+1)},cd.prototype._unpackMapbox=function(a,c,f){return(256*a*256+256*c+f)/10-1e4},cd.prototype._unpackTerrarium=function(a,c,f){return 256*a+c+f/256-32768},cd.prototype.getPixels=function(){return new Qo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},cd.prototype.backfillBorder=function(a,c,f){if(this.dim!==a.dim)throw new Error("dem dimension mismatch");var x=c*this.dim,S=c*this.dim+this.dim,I=f*this.dim,D=f*this.dim+this.dim;switch(c){case-1:x=S-1;break;case 1:S=x+1}switch(f){case-1:I=D-1;break;case 1:D=I+1}for(var H=-c*this.dim,Y=-f*this.dim,ee=I;ee<D;ee++)for(var ie=x;ie<S;ie++)this.data[this._idx(ie,ee)]=a.data[this._idx(ie+H,ee+Y)]},Tr("DEMData",cd);var a2=function(a){this._stringToNumber={},this._numberToString=[];for(var c=0;c<a.length;c++){var f=a[c];this._stringToNumber[f]=c,this._numberToString[c]=f}};a2.prototype.encode=function(a){return this._stringToNumber[a]},a2.prototype.decode=function(a){return this._numberToString[a]};var l2=function(a,c,f,x,S){this.type="Feature",this._vectorTileFeature=a,a._z=c,a._x=f,a._y=x,this.properties=a.properties,this.id=S},fP={geometry:{configurable:!0}};fP.geometry.get=function(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},fP.geometry.set=function(a){this._geometry=a},l2.prototype.toJSON=function(){var a={geometry:this.geometry};for(var c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(a[c]=this[c]);return a},Object.defineProperties(l2.prototype,fP);var c0=function(){this.state={},this.stateChanges={},this.deletedStates={}};c0.prototype.updateState=function(a,c,f){var x=String(c);if(this.stateChanges[a]=this.stateChanges[a]||{},this.stateChanges[a][x]=this.stateChanges[a][x]||{},z(this.stateChanges[a][x],f),this.deletedStates[a]===null)for(var S in this.deletedStates[a]={},this.state[a])S!==x&&(this.deletedStates[a][S]=null);else if(this.deletedStates[a]&&this.deletedStates[a][x]===null)for(var I in this.deletedStates[a][x]={},this.state[a][x])f[I]||(this.deletedStates[a][x][I]=null);else for(var D in f)this.deletedStates[a]&&this.deletedStates[a][x]&&this.deletedStates[a][x][D]===null&&delete this.deletedStates[a][x][D]},c0.prototype.removeFeatureState=function(a,c,f){if(this.deletedStates[a]!==null){var x=String(c);if(this.deletedStates[a]=this.deletedStates[a]||{},f&&c!==void 0)this.deletedStates[a][x]!==null&&(this.deletedStates[a][x]=this.deletedStates[a][x]||{},this.deletedStates[a][x][f]=null);else if(c!==void 0)if(this.stateChanges[a]&&this.stateChanges[a][x])for(f in this.deletedStates[a][x]={},this.stateChanges[a][x])this.deletedStates[a][x][f]=null;else this.deletedStates[a][x]=null;else this.deletedStates[a]=null}},c0.prototype.getState=function(a,c){var f=String(c),x=z({},(this.state[a]||{})[f],(this.stateChanges[a]||{})[f]);if(this.deletedStates[a]===null)return{};if(this.deletedStates[a]){var S=this.deletedStates[a][c];if(S===null)return{};for(var I in S)delete x[I]}return x},c0.prototype.initializeTileState=function(a,c){a.setFeatureState(this.state,c)},c0.prototype.coalesceChanges=function(a,c){var f={};for(var x in this.stateChanges){this.state[x]=this.state[x]||{};var S={};for(var I in this.stateChanges[x])this.state[x][I]||(this.state[x][I]={}),z(this.state[x][I],this.stateChanges[x][I]),S[I]=this.state[x][I];f[x]=S}for(var D in this.deletedStates){this.state[D]=this.state[D]||{};var H={};if(this.deletedStates[D]===null)for(var Y in this.state[D])H[Y]={},this.state[D][Y]={};else for(var ee in this.deletedStates[D]){if(this.deletedStates[D][ee]===null)this.state[D][ee]={};else for(var ie=0,se=Object.keys(this.deletedStates[D][ee]);ie<se.length;ie+=1)delete this.state[D][ee][se[ie]];H[ee]=this.state[D][ee]}f[D]=f[D]||{},z(f[D],H)}if(this.stateChanges={},this.deletedStates={},Object.keys(f).length!==0)for(var Ae in a)a[Ae].setFeatureState(f,c)};var ud=function(a,c){this.tileID=a,this.x=a.canonical.x,this.y=a.canonical.y,this.z=a.canonical.z,this.grid=new vo(8192,16,0),this.grid3D=new vo(8192,16,0),this.featureIndexArray=new ue,this.promoteId=c};function i6(a,c,f,x,S){return me(a,function(I,D){var H=c instanceof Qh?c.get(D):null;return H&&H.evaluate?H.evaluate(f,x,S):H})}function n6(a){for(var c=1/0,f=1/0,x=-1/0,S=-1/0,I=0,D=a;I<D.length;I+=1){var H=D[I];c=Math.min(c,H.x),f=Math.min(f,H.y),x=Math.max(x,H.x),S=Math.max(S,H.y)}return{minX:c,minY:f,maxX:x,maxY:S}}function Xte(a,c){return c-a}ud.prototype.insert=function(a,c,f,x,S,I){var D=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(f,x,S);for(var H=I?this.grid3D:this.grid,Y=0;Y<c.length;Y++){for(var ee=c[Y],ie=[1/0,1/0,-1/0,-1/0],se=0;se<ee.length;se++){var Ae=ee[se];ie[0]=Math.min(ie[0],Ae.x),ie[1]=Math.min(ie[1],Ae.y),ie[2]=Math.max(ie[2],Ae.x),ie[3]=Math.max(ie[3],Ae.y)}ie[0]<8192&&ie[1]<8192&&ie[2]>=0&&ie[3]>=0&&H.insert(D,ie[0],ie[1],ie[2],ie[3])}},ud.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new ad.VectorTile(new Zw(this.rawTileData)).layers,this.sourceLayerCoder=new a2(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},ud.prototype.query=function(a,c,f,x){var S=this;this.loadVTLayers();for(var I=a.params||{},D=8192/a.tileSize/a.scale,H=Zf(I.filter),Y=a.queryGeometry,ee=a.queryPadding*D,ie=n6(Y),se=this.grid.query(ie.minX-ee,ie.minY-ee,ie.maxX+ee,ie.maxY+ee),Ae=n6(a.cameraQueryGeometry),Te=this.grid3D.query(Ae.minX-ee,Ae.minY-ee,Ae.maxX+ee,Ae.maxY+ee,function(bt,Mt,Ut,$t){return function(Ar,Qr,Cr,ni,Pr){for(var Vi=0,Ai=Ar;Vi<Ai.length;Vi+=1){var Gr=Ai[Vi];if(Qr<=Gr.x&&Cr<=Gr.y&&ni>=Gr.x&&Pr>=Gr.y)return!0}var rn=[new u(Qr,Cr),new u(Qr,Pr),new u(ni,Pr),new u(ni,Cr)];if(Ar.length>2){for(var Ri=0,_n=rn;Ri<_n.length;Ri+=1)if(ro(Ar,_n[Ri]))return!0}for(var si=0;si<Ar.length-1;si++)if(id(Ar[si],Ar[si+1],rn))return!0;return!1}(a.cameraQueryGeometry,bt-ee,Mt-ee,Ut+ee,$t+ee)}),ke=0,Ve=Te;ke<Ve.length;ke+=1)se.push(Ve[ke]);se.sort(Xte);for(var et,Xe={},at=function(bt){var Mt=se[bt];if(Mt!==et){et=Mt;var Ut=S.featureIndexArray.get(Mt),$t=null;S.loadMatchingFeature(Xe,Ut.bucketIndex,Ut.sourceLayerIndex,Ut.featureIndex,H,I.layers,I.availableImages,c,f,x,function(Ar,Qr,Cr){return $t||($t=Io(Ar)),Qr.queryIntersectsFeature(Y,Ar,Cr,$t,S.z,a.transform,D,a.pixelPosMatrix)})}},_t=0;_t<se.length;_t++)at(_t);return Xe},ud.prototype.loadMatchingFeature=function(a,c,f,x,S,I,D,H,Y,ee,ie){var se=this.bucketLayerIDs[c];if(!I||function(Ar,Qr){for(var Cr=0;Cr<Ar.length;Cr++)if(Qr.indexOf(Ar[Cr])>=0)return!0;return!1}(I,se)){var Ae=this.sourceLayerCoder.decode(f),Te=this.vtLayers[Ae].feature(x);if(S.needGeometry){var ke=Jo(Te,!0);if(!S.filter(new qi(this.tileID.overscaledZ),ke,this.tileID.canonical))return}else if(!S.filter(new qi(this.tileID.overscaledZ),Te))return;for(var Ve=this.getId(Te,Ae),et=0;et<se.length;et++){var Xe=se[et];if(!(I&&I.indexOf(Xe)<0)){var at=H[Xe];if(at){var _t={};Ve!==void 0&&ee&&(_t=ee.getState(at.sourceLayer||"_geojsonTileLayer",Ve));var bt=z({},Y[Xe]);bt.paint=i6(bt.paint,at.paint,Te,_t,D),bt.layout=i6(bt.layout,at.layout,Te,_t,D);var Mt=!ie||ie(Te,at,_t);if(Mt){var Ut=new l2(Te,this.z,this.x,this.y,Ve);Ut.layer=bt;var $t=a[Xe];$t===void 0&&($t=a[Xe]=[]),$t.push({featureIndex:x,feature:Ut,intersectionZ:Mt})}}}}}},ud.prototype.lookupSymbolFeatures=function(a,c,f,x,S,I,D,H){var Y={};this.loadVTLayers();for(var ee=Zf(S),ie=0,se=a;ie<se.length;ie+=1)this.loadMatchingFeature(Y,f,x,se[ie],ee,I,D,H,c);return Y},ud.prototype.hasLayer=function(a){for(var c=0,f=this.bucketLayerIDs;c<f.length;c+=1)for(var x=0,S=f[c];x<S.length;x+=1)if(a===S[x])return!0;return!1},ud.prototype.getId=function(a,c){var f=a.id;return this.promoteId&&typeof(f=a.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[c]])=="boolean"&&(f=Number(f)),f},Tr("FeatureIndex",ud,{omit:["rawTileData","sourceLayerCoder"]});var ra=function(a,c){this.tileID=a,this.uid=J(),this.uses=0,this.tileSize=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"};ra.prototype.registerFadeDuration=function(a){var c=a+this.timeAdded;c<ae.now()||this.fadeEndTime&&c<this.fadeEndTime||(this.fadeEndTime=c)},ra.prototype.wasRequested=function(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"},ra.prototype.loadVectorData=function(a,c,f){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",a){for(var x in a.featureIndex&&(this.latestFeatureIndex=a.featureIndex,a.rawTileData?(this.latestRawTileData=a.rawTileData,this.latestFeatureIndex.rawTileData=a.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=a.collisionBoxArray,this.buckets=function(ee,ie){var se={};if(!ie)return se;for(var Ae=function(){var Ve=ke[Te],et=Ve.layerIds.map(function(_t){return ie.getLayer(_t)}).filter(Boolean);if(et.length!==0){Ve.layers=et,Ve.stateDependentLayerIds&&(Ve.stateDependentLayers=Ve.stateDependentLayerIds.map(function(_t){return et.filter(function(bt){return bt.id===_t})[0]}));for(var Xe=0,at=et;Xe<at.length;Xe+=1)se[at[Xe].id]=Ve}},Te=0,ke=ee;Te<ke.length;Te+=1)Ae();return se}(a.buckets,c.style),this.hasSymbolBuckets=!1,this.buckets){var S=this.buckets[x];if(S instanceof eo){if(this.hasSymbolBuckets=!0,!f)break;S.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var I in this.buckets){var D=this.buckets[I];if(D instanceof eo&&D.hasRTLText){this.hasRTLText=!0,Al.isLoading()||Al.isLoaded()||kA()!=="deferred"||Il();break}}for(var H in this.queryPadding=0,this.buckets){var Y=this.buckets[H];this.queryPadding=Math.max(this.queryPadding,c.style.getLayer(H).queryRadius(Y))}a.imageAtlas&&(this.imageAtlas=a.imageAtlas),a.glyphAtlasImage&&(this.glyphAtlasImage=a.glyphAtlasImage)}else this.collisionBoxArray=new _},ra.prototype.unloadVectorData=function(){for(var a in this.buckets)this.buckets[a].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"},ra.prototype.getBucket=function(a){return this.buckets[a.id]},ra.prototype.upload=function(a){for(var c in this.buckets){var f=this.buckets[c];f.uploadPending()&&f.upload(a)}var x=a.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new HA(a,this.imageAtlas.image,x.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new HA(a,this.glyphAtlasImage,x.ALPHA),this.glyphAtlasImage=null)},ra.prototype.prepare=function(a){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(a,this.imageAtlasTexture)},ra.prototype.queryRenderedFeatures=function(a,c,f,x,S,I,D,H,Y,ee){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:x,cameraQueryGeometry:S,scale:I,tileSize:this.tileSize,pixelPosMatrix:ee,transform:H,params:D,queryPadding:this.queryPadding*Y},a,c,f):{}},ra.prototype.querySourceFeatures=function(a,c){var f=this.latestFeatureIndex;if(f&&f.rawTileData){var x=f.loadVTLayers(),S=c?c.sourceLayer:"",I=x._geojsonTileLayer||x[S];if(I)for(var D=Zf(c&&c.filter),H=this.tileID.canonical,Y=H.z,ee=H.x,ie=H.y,se={z:Y,x:ee,y:ie},Ae=0;Ae<I.length;Ae++){var Te=I.feature(Ae);if(D.needGeometry){var ke=Jo(Te,!0);if(!D.filter(new qi(this.tileID.overscaledZ),ke,this.tileID.canonical))continue}else if(!D.filter(new qi(this.tileID.overscaledZ),Te))continue;var Ve=f.getId(Te,S),et=new l2(Te,Y,ee,ie,Ve);et.tile=se,a.push(et)}}},ra.prototype.hasData=function(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"},ra.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},ra.prototype.setExpiryData=function(a){var c=this.expirationTime;if(a.cacheControl){var f=ft(a.cacheControl);f["max-age"]&&(this.expirationTime=Date.now()+1e3*f["max-age"])}else a.expires&&(this.expirationTime=new Date(a.expires).getTime());if(this.expirationTime){var x=Date.now(),S=!1;if(this.expirationTime>x)S=!1;else if(c)if(this.expirationTime<c)S=!0;else{var I=this.expirationTime-c;I?this.expirationTime=x+Math.max(I,3e4):S=!0}else S=!0;S?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},ra.prototype.getExpiryTimeout=function(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)},ra.prototype.setFeatureState=function(a,c){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&Object.keys(a).length!==0){var f=this.latestFeatureIndex.loadVTLayers();for(var x in this.buckets)if(c.style.hasLayer(x)){var S=this.buckets[x],I=S.layers[0].sourceLayer||"_geojsonTileLayer",D=f[I],H=a[I];if(D&&H&&Object.keys(H).length!==0){S.update(H,D,this.imageAtlas&&this.imageAtlas.patternPositions||{});var Y=c&&c.style&&c.style.getLayer(x);Y&&(this.queryPadding=Math.max(this.queryPadding,Y.queryRadius(S)))}}}},ra.prototype.holdingForFade=function(){return this.symbolFadeHoldUntil!==void 0},ra.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ae.now()},ra.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},ra.prototype.setHoldDuration=function(a){this.symbolFadeHoldUntil=ae.now()+a},ra.prototype.setDependencies=function(a,c){for(var f={},x=0,S=c;x<S.length;x+=1)f[S[x]]=!0;this.dependencies[a]=f},ra.prototype.hasDependency=function(a,c){for(var f=0,x=a;f<x.length;f+=1){var S=this.dependencies[x[f]];if(S){for(var I=0,D=c;I<D.length;I+=1)if(S[D[I]])return!0}}return!1};var pp=v.performance,o6=function(a){this._marks={start:[a.url,"start"].join("#"),end:[a.url,"end"].join("#"),measure:a.url.toString()},pp.mark(this._marks.start)};o6.prototype.finish=function(){pp.mark(this._marks.end);var a=pp.getEntriesByName(this._marks.measure);return a.length===0&&(pp.measure(this._marks.measure,this._marks.start,this._marks.end),a=pp.getEntriesByName(this._marks.measure),pp.clearMarks(this._marks.start),pp.clearMarks(this._marks.end),pp.clearMeasures(this._marks.measure)),a},n.Actor=l0,n.AlphaImage=Mi,n.CanonicalTileID=GA,n.CollisionBoxArray=_,n.Color=Oi,n.DEMData=cd,n.DataConstantProperty=ei,n.DictionaryCoder=a2,n.EXTENT=8192,n.ErrorEvent=tt,n.EvaluationParameters=qi,n.Event=ye,n.Evented=rt,n.FeatureIndex=ud,n.FillBucket=Nr,n.FillExtrusionBucket=df,n.ImageAtlas=vv,n.ImagePosition=Qw,n.LineBucket=_l,n.LngLat=Ro,n.LngLatBounds=Os,n.MercatorCoordinate=jA,n.ONE_EM=24,n.OverscaledTileID=Ds,n.Point=u,n.Point$1=u,n.Properties=Rs,n.Protobuf=Zw,n.RGBAImage=Qo,n.RequestManager=xi,n.RequestPerformance=o6,n.ResourceType=ql,n.SegmentVector=Ce,n.SourceFeatureState=c0,n.StructArrayLayout1ui2=_u,n.StructArrayLayout2f1f2i16=xs,n.StructArrayLayout2i4=Wc,n.StructArrayLayout3ui6=Ga,n.StructArrayLayout4i8=$h,n.SymbolBucket=eo,n.Texture=HA,n.Tile=ra,n.Transitionable=Gs,n.Uniform1f=ar,n.Uniform1i=Wt,n.Uniform2f=ir,n.Uniform3f=Ir,n.Uniform4f=ti,n.UniformColor=oi,n.UniformMatrix4f=hn,n.UnwrappedTileID=r6,n.ValidationError=Ge,n.WritingMode=yc,n.ZoomHistory=LA,n.add=function(a,c,f){return a[0]=c[0]+f[0],a[1]=c[1]+f[1],a[2]=c[2]+f[2],a},n.addDynamicAttributes=aP,n.asyncAll=function(a,c,f){if(!a.length)return f(null,[]);var x=a.length,S=new Array(a.length),I=null;a.forEach(function(D,H){c(D,function(Y,ee){Y&&(I=Y),S[H]=ee,--x==0&&f(I,S)})})},n.bezier=E,n.bindAll=ge,n.browser=ae,n.cacheEntryPossiblyAdded=function(a){++Us>To&&(a.getActor().send("enforceCacheSizeLimit",Dn),Us=0)},n.clamp=O,n.clearTileCache=function(a){var c=v.caches.delete("mapbox-tiles");a&&c.catch(a).then(function(){return a()})},n.clipLine=zk,n.clone=function(a){var c=new Cn(16);return c[0]=a[0],c[1]=a[1],c[2]=a[2],c[3]=a[3],c[4]=a[4],c[5]=a[5],c[6]=a[6],c[7]=a[7],c[8]=a[8],c[9]=a[9],c[10]=a[10],c[11]=a[11],c[12]=a[12],c[13]=a[13],c[14]=a[14],c[15]=a[15],c},n.clone$1=$,n.clone$2=function(a){var c=new Cn(3);return c[0]=a[0],c[1]=a[1],c[2]=a[2],c},n.collisionCircleLayout=dte,n.config=be,n.create=function(){var a=new Cn(16);return Cn!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a},n.create$1=function(){var a=new Cn(9);return Cn!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a},n.create$2=function(){var a=new Cn(4);return Cn!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a},n.createCommonjsModule=o,n.createExpression=gi,n.createLayout=Bs,n.createStyleLayer=function(a){return a.type==="custom"?new Wte(a):new qte[a.type](a)},n.cross=function(a,c,f){var x=c[0],S=c[1],I=c[2],D=f[0],H=f[1],Y=f[2];return a[0]=S*Y-I*H,a[1]=I*D-x*Y,a[2]=x*H-S*D,a},n.deepEqual=function a(c,f){if(Array.isArray(c)){if(!Array.isArray(f)||c.length!==f.length)return!1;for(var x=0;x<c.length;x++)if(!a(c[x],f[x]))return!1;return!0}if(typeof c=="object"&&c!==null&&f!==null){if(typeof f!="object"||Object.keys(c).length!==Object.keys(f).length)return!1;for(var S in c)if(!a(c[S],f[S]))return!1;return!0}return c===f},n.dot=function(a,c){return a[0]*c[0]+a[1]*c[1]+a[2]*c[2]},n.dot$1=function(a,c){return a[0]*c[0]+a[1]*c[1]+a[2]*c[2]+a[3]*c[3]},n.ease=M,n.emitValidationErrors=dl,n.endsWith=j,n.enforceCacheSizeLimit=function(a){Eo(),yn&&yn.then(function(c){c.keys().then(function(f){for(var x=0;x<f.length-a;x++)c.delete(f[x])})})},n.evaluateSizeForFeature=Dk,n.evaluateSizeForZoom=Lk,n.evaluateVariableOffset=jk,n.evented=NA,n.extend=z,n.featureFilter=Zf,n.filterObject=fe,n.fromRotation=function(a,c){var f=Math.sin(c),x=Math.cos(c);return a[0]=x,a[1]=f,a[2]=0,a[3]=-f,a[4]=x,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},n.getAnchorAlignment=iP,n.getAnchorJustification=sP,n.getArrayBuffer=Ml,n.getImage=de,n.getJSON=function(a,c){return ca(z(a,{type:"json"}),c)},n.getRTLTextPluginStatus=kA,n.getReferrer=Cl,n.getVideo=function(a,c){var f,x,S=v.document.createElement("video");S.muted=!0,S.onloadstart=function(){c(null,S)};for(var I=0;I<a.length;I++){var D=v.document.createElement("source");f=a[I],x=void 0,(x=v.document.createElement("a")).href=f,(x.protocol!==v.document.location.protocol||x.host!==v.document.location.host)&&(S.crossOrigin="Anonymous"),D.src=a[I],S.appendChild(D)}return{cancel:function(){}}},n.identity=qa,n.invert=function(a,c){var f=c[0],x=c[1],S=c[2],I=c[3],D=c[4],H=c[5],Y=c[6],ee=c[7],ie=c[8],se=c[9],Ae=c[10],Te=c[11],ke=c[12],Ve=c[13],et=c[14],Xe=c[15],at=f*H-x*D,_t=f*Y-S*D,bt=f*ee-I*D,Mt=x*Y-S*H,Ut=x*ee-I*H,$t=S*ee-I*Y,Ar=ie*Ve-se*ke,Qr=ie*et-Ae*ke,Cr=ie*Xe-Te*ke,ni=se*et-Ae*Ve,Pr=se*Xe-Te*Ve,Vi=Ae*Xe-Te*et,Ai=at*Vi-_t*Pr+bt*ni+Mt*Cr-Ut*Qr+$t*Ar;return Ai?(a[0]=(H*Vi-Y*Pr+ee*ni)*(Ai=1/Ai),a[1]=(S*Pr-x*Vi-I*ni)*Ai,a[2]=(Ve*$t-et*Ut+Xe*Mt)*Ai,a[3]=(Ae*Ut-se*$t-Te*Mt)*Ai,a[4]=(Y*Cr-D*Vi-ee*Qr)*Ai,a[5]=(f*Vi-S*Cr+I*Qr)*Ai,a[6]=(et*bt-ke*$t-Xe*_t)*Ai,a[7]=(ie*$t-Ae*bt+Te*_t)*Ai,a[8]=(D*Pr-H*Cr+ee*Ar)*Ai,a[9]=(x*Cr-f*Pr-I*Ar)*Ai,a[10]=(ke*Ut-Ve*bt+Xe*at)*Ai,a[11]=(se*bt-ie*Ut-Te*at)*Ai,a[12]=(H*Qr-D*ni-Y*Ar)*Ai,a[13]=(f*ni-x*Qr+S*Ar)*Ai,a[14]=(Ve*_t-ke*Mt-et*at)*Ai,a[15]=(ie*Mt-se*_t+Ae*at)*Ai,a):null},n.isChar=gr,n.isMapboxURL=Ki,n.keysDifference=function(a,c){var f=[];for(var x in a)x in c||f.push(x);return f},n.makeRequest=ca,n.mapObject=me,n.mercatorXfromLng=$k,n.mercatorYfromLat=e6,n.mercatorZfromAltitude=t6,n.mul=Kg,n.multiply=Aa,n.mvt=ad,n.nextPowerOfTwo=function(a){return a<=1?1:Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},n.normalize=function(a,c){var f=c[0],x=c[1],S=c[2],I=f*f+x*x+S*S;return I>0&&(I=1/Math.sqrt(I)),a[0]=c[0]*I,a[1]=c[1]*I,a[2]=c[2]*I,a},n.number=Mo,n.offscreenCanvasSupported=Fc,n.ortho=function(a,c,f,x,S,I,D){var H=1/(c-f),Y=1/(x-S),ee=1/(I-D);return a[0]=-2*H,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*Y,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*ee,a[11]=0,a[12]=(c+f)*H,a[13]=(S+x)*Y,a[14]=(D+I)*ee,a[15]=1,a},n.parseGlyphPBF=function(a){return new Zw(a).readFields(Tte,[])},n.pbf=Zw,n.performSymbolLayout=function(a,c,f,x,S,I,D){a.createArrays(),a.tilePixelRatio=8192/(512*a.overscaling),a.compareText={},a.iconsNeedLinear=!1;var H=a.layers[0].layout,Y=a.layers[0]._unevaluatedLayout._values,ee={};if(a.textSizeData.kind==="composite"){var ie=a.textSizeData,se=ie.maxZoom;ee.compositeTextSizes=[Y["text-size"].possiblyEvaluate(new qi(ie.minZoom),D),Y["text-size"].possiblyEvaluate(new qi(se),D)]}if(a.iconSizeData.kind==="composite"){var Ae=a.iconSizeData,Te=Ae.maxZoom;ee.compositeIconSizes=[Y["icon-size"].possiblyEvaluate(new qi(Ae.minZoom),D),Y["icon-size"].possiblyEvaluate(new qi(Te),D)]}ee.layoutTextSize=Y["text-size"].possiblyEvaluate(new qi(a.zoom+1),D),ee.layoutIconSize=Y["icon-size"].possiblyEvaluate(new qi(a.zoom+1),D),ee.textMaxSize=Y["text-size"].possiblyEvaluate(new qi(18));for(var ke=24*H.get("text-line-height"),Ve=H.get("text-rotation-alignment")==="map"&&H.get("symbol-placement")!=="point",et=H.get("text-keep-upright"),Xe=H.get("text-size"),at=function(){var Mt=bt[_t],Ut=H.get("text-font").evaluate(Mt,{},D).join(","),$t=Xe.evaluate(Mt,{},D),Ar=ee.layoutTextSize.evaluate(Mt,{},D),Qr=ee.layoutIconSize.evaluate(Mt,{},D),Cr={horizontal:{},vertical:void 0},ni=Mt.text,Pr=[0,0];if(ni){var Vi=ni.toString(),Ai=24*H.get("text-letter-spacing").evaluate(Mt,{},D),Gr=function(un){for(var no=0,Kn=un;no<Kn.length;no+=1)if(wn=Kn[no].charCodeAt(0),gr.Arabic(wn)||gr["Arabic Supplement"](wn)||gr["Arabic Extended-A"](wn)||gr["Arabic Presentation Forms-A"](wn)||gr["Arabic Presentation Forms-B"](wn))return!1;var wn;return!0}(Vi)?Ai:0,rn=H.get("text-anchor").evaluate(Mt,{},D),Ri=H.get("text-variable-anchor");if(!Ri){var _n=H.get("text-radial-offset").evaluate(Mt,{},D);Pr=_n?jk(rn,[24*_n,oP]):H.get("text-offset").evaluate(Mt,{},D).map(function(un){return 24*un})}var si=Ve?"center":H.get("text-justify").evaluate(Mt,{},D),Pn=H.get("symbol-placement"),Bo=Pn==="point"?24*H.get("text-max-width").evaluate(Mt,{},D):0,is=function(){a.allowVerticalPlacement&&up(Vi)&&(Cr.vertical=$w(ni,c,f,S,Ut,Bo,ke,rn,"left",Gr,Pr,yc.vertical,!0,Pn,Ar,$t))};if(!Ve&&Ri){for(var $o=si==="auto"?Ri.map(function(un){return sP(un)}):[si],Oo=!1,ns=0;ns<$o.length;ns++){var qs=$o[ns];if(!Cr.horizontal[qs])if(Oo)Cr.horizontal[qs]=Cr.horizontal[0];else{var Xs=$w(ni,c,f,S,Ut,Bo,ke,"center",qs,Gr,Pr,yc.horizontal,!1,Pn,Ar,$t);Xs&&(Cr.horizontal[qs]=Xs,Oo=Xs.positionedLines.length===1)}}is()}else{si==="auto"&&(si=sP(rn));var Ya=$w(ni,c,f,S,Ut,Bo,ke,rn,si,Gr,Pr,yc.horizontal,!1,Pn,Ar,$t);Ya&&(Cr.horizontal[si]=Ya),is(),up(Vi)&&Ve&&et&&(Cr.vertical=$w(ni,c,f,S,Ut,Bo,ke,rn,si,Gr,Pr,yc.vertical,!1,Pn,Ar,$t))}}var ia=void 0,Ka=!1;if(Mt.icon&&Mt.icon.name){var hs=x[Mt.icon.name];hs&&(ia=function(un,no,Kn){var wn=iP(Kn),yl=no[0]-un.displaySize[0]*wn.horizontalAlign,Ra=no[1]-un.displaySize[1]*wn.verticalAlign;return{image:un,top:Ra,bottom:Ra+un.displaySize[1],left:yl,right:yl+un.displaySize[0]}}(S[Mt.icon.name],H.get("icon-offset").evaluate(Mt,{},D),H.get("icon-anchor").evaluate(Mt,{},D)),Ka=hs.sdf,a.sdfIcons===void 0?a.sdfIcons=hs.sdf:a.sdfIcons!==hs.sdf&&we("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(hs.pixelRatio!==a.pixelRatio||H.get("icon-rotate").constantOr(1)!==0)&&(a.iconsNeedLinear=!0))}var na=Wk(Cr.horizontal)||Cr.vertical;a.iconsInText=!!na&&na.iconsInText,(na||ia)&&function(un,no,Kn,wn,yl,Ra,xo,Es,Ba,Rn,lh){var vc=Ra.textMaxSize.evaluate(no,{});vc===void 0&&(vc=xo);var ch,ds=un.layers[0].layout,uh=ds.get("icon-offset").evaluate(no,{},lh),Tu=Wk(Kn.horizontal),u0=xo/24,WA=un.tilePixelRatio*u0,f0=un.tilePixelRatio*vc/24,fd=un.tilePixelRatio*Es,h0=un.tilePixelRatio*ds.get("symbol-spacing"),c2=ds.get("text-padding")*un.tilePixelRatio,d0=ds.get("icon-padding")*un.tilePixelRatio,wv=ds.get("text-max-angle")/180*Math.PI,u2=ds.get("text-rotation-alignment")==="map"&&ds.get("symbol-placement")!=="point",f2=ds.get("icon-rotation-alignment")==="map"&&ds.get("symbol-placement")!=="point",hd=ds.get("symbol-placement"),Tv=h0/2,p0=ds.get("icon-text-fit");wn&&p0!=="none"&&(un.allowVerticalPlacement&&Kn.vertical&&(ch=Ok(wn,Kn.vertical,p0,ds.get("icon-text-fit-padding"),uh,u0)),Tu&&(wn=Ok(wn,Tu,p0,ds.get("icon-text-fit-padding"),uh,u0)));var Ap=function(Yte,Bv){Bv.x<0||Bv.x>=8192||Bv.y<0||Bv.y>=8192||function(ps,pf,Kte,mp,AP,l6,g2,fh,_2,Ov,y2,v2,mP,c6,Dv,u6,f6,h6,d6,p6,xc,x2,A6,hh,Zte){var m6,XA,y0,v0,x0,b0=ps.addToLineVertexArray(pf,Kte),g6=0,_6=0,y6=0,v6=0,gP=-1,_P=-1,dd={},x6=Ne(""),yP=0,vP=0;if(fh._unevaluatedLayout.getValue("text-radial-offset")===void 0?(yP=(m6=fh.layout.get("text-offset").evaluate(xc,{},hh).map(function(Fv){return 24*Fv}))[0],vP=m6[1]):(yP=24*fh.layout.get("text-radial-offset").evaluate(xc,{},hh),vP=oP),ps.allowVerticalPlacement&&mp.vertical){var b6=fh.layout.get("text-rotate").evaluate(xc,{},hh)+90;v0=new n2(_2,pf,Ov,y2,v2,mp.vertical,mP,c6,Dv,b6),g2&&(x0=new n2(_2,pf,Ov,y2,v2,g2,f6,h6,Dv,b6))}if(AP){var xP=fh.layout.get("icon-rotate").evaluate(xc,{}),w6=fh.layout.get("icon-text-fit")!=="none",T6=Vk(AP,xP,A6,w6),bP=g2?Vk(g2,xP,A6,w6):void 0;y0=new n2(_2,pf,Ov,y2,v2,AP,f6,h6,!1,xP),g6=4*T6.length;var E6=ps.iconSizeData,Lv=null;E6.kind==="source"?(Lv=[128*fh.layout.get("icon-size").evaluate(xc,{})])[0]>32640&&we(ps.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):E6.kind==="composite"&&((Lv=[128*x2.compositeIconSizes[0].evaluate(xc,{},hh),128*x2.compositeIconSizes[1].evaluate(xc,{},hh)])[0]>32640||Lv[1]>32640)&&we(ps.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),ps.addSymbols(ps.icon,T6,Lv,p6,d6,xc,!1,pf,b0.lineStartIndex,b0.lineLength,-1,hh),gP=ps.icon.placedSymbolArray.length-1,bP&&(_6=4*bP.length,ps.addSymbols(ps.icon,bP,Lv,p6,d6,xc,yc.vertical,pf,b0.lineStartIndex,b0.lineLength,-1,hh),_P=ps.icon.placedSymbolArray.length-1)}for(var S6 in mp.horizontal){var b2=mp.horizontal[S6];if(!XA){x6=Ne(b2.text);var Jte=fh.layout.get("text-rotate").evaluate(xc,{},hh);XA=new n2(_2,pf,Ov,y2,v2,b2,mP,c6,Dv,Jte)}var C6=b2.positionedLines.length===1;if(y6+=Gk(ps,pf,b2,l6,fh,Dv,xc,u6,b0,mp.vertical?yc.horizontal:yc.horizontalOnly,C6?Object.keys(mp.horizontal):[S6],dd,gP,x2,hh),C6)break}mp.vertical&&(v6+=Gk(ps,pf,mp.vertical,l6,fh,Dv,xc,u6,b0,yc.vertical,["vertical"],dd,_P,x2,hh));var Qte=XA?XA.boxStartIndex:ps.collisionBoxArray.length,$te=XA?XA.boxEndIndex:ps.collisionBoxArray.length,ere=v0?v0.boxStartIndex:ps.collisionBoxArray.length,tre=v0?v0.boxEndIndex:ps.collisionBoxArray.length,rre=y0?y0.boxStartIndex:ps.collisionBoxArray.length,ire=y0?y0.boxEndIndex:ps.collisionBoxArray.length,nre=x0?x0.boxStartIndex:ps.collisionBoxArray.length,ore=x0?x0.boxEndIndex:ps.collisionBoxArray.length,dh=-1,w2=function(Fv,I6){return Fv&&Fv.circleDiameter?Math.max(Fv.circleDiameter,I6):I6};dh=w2(XA,dh),dh=w2(v0,dh),dh=w2(y0,dh);var M6=(dh=w2(x0,dh))>-1?1:0;M6&&(dh*=Zte/24),ps.glyphOffsetArray.length>=eo.MAX_GLYPHS&&we("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),xc.sortKey!==void 0&&ps.addToSortKeyRanges(ps.symbolInstances.length,xc.sortKey),ps.symbolInstances.emplaceBack(pf.x,pf.y,dd.right>=0?dd.right:-1,dd.center>=0?dd.center:-1,dd.left>=0?dd.left:-1,dd.vertical||-1,gP,_P,x6,Qte,$te,ere,tre,rre,ire,nre,ore,Ov,y6,v6,g6,_6,M6,0,mP,yP,vP,dh)}(un,Bv,Yte,Kn,wn,yl,ch,un.layers[0],un.collisionBoxArray,no.index,no.sourceLayerIndex,un.index,WA,c2,u2,Ba,fd,d0,f2,uh,no,Ra,Rn,lh,xo)};if(hd==="line")for(var A0=0,h2=zk(no.geometry,0,0,8192,8192);A0<h2.length;A0+=1)for(var d2=h2[A0],Ev=0,Sv=Rte(d2,h0,wv,Kn.vertical||Tu,wn,24,f0,un.overscaling,8192);Ev<Sv.length;Ev+=1){var p2=Sv[Ev];Tu&&Lte(un,Tu.text,Tv,p2)||Ap(d2,p2)}else if(hd==="line-center")for(var Cv=0,Mv=no.geometry;Cv<Mv.length;Cv+=1){var Iv=Mv[Cv];if(Iv.length>1){var A2=Pte(Iv,wv,Kn.vertical||Tu,wn,24,f0);A2&&Ap(Iv,A2)}}else if(no.type==="Polygon")for(var m0=0,m2=Et(no.geometry,0);m0<m2.length;m0+=1){var g0=m2[m0],Pv=Ote(g0,16);Ap(g0[0],new i0(Pv.x,Pv.y,0))}else if(no.type==="LineString")for(var qA=0,Rv=no.geometry;qA<Rv.length;qA+=1){var _0=Rv[qA];Ap(_0,new i0(_0[0].x,_0[0].y,0))}else if(no.type==="Point")for(var hP=0,s6=no.geometry;hP<s6.length;hP+=1)for(var dP=0,a6=s6[hP];dP<a6.length;dP+=1){var pP=a6[dP];Ap([pP],new i0(pP.x,pP.y,0))}}(a,Mt,Cr,ia,x,ee,Ar,Qr,Pr,Ka,D)},_t=0,bt=a.features;_t<bt.length;_t+=1)at();I&&a.generateCollisionDebugBuffers()},n.perspective=function(a,c,f,x,S){var I,D=1/Math.tan(c/2);return a[0]=D/f,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=D,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,S!=null&&S!==1/0?(a[10]=(S+x)*(I=1/(x-S)),a[14]=2*S*x*I):(a[10]=-1,a[14]=-2*x),a},n.pick=function(a,c){for(var f={},x=0;x<c.length;x++){var S=c[x];S in a&&(f[S]=a[S])}return f},n.plugin=Al,n.polygonIntersectsPolygon=vu,n.postMapLoadEvent=to,n.postTurnstileEvent=Ur,n.potpack=Ik,n.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],n.register=Tr,n.registerForPluginStateChange=function(a){return a({pluginStatus:fs,pluginURL:pc}),NA.on("pluginStateChange",a),a},n.renderColorRamp=Pa,n.rotate=function(a,c,f){var x=c[0],S=c[1],I=c[2],D=c[3],H=Math.sin(f),Y=Math.cos(f);return a[0]=x*Y+I*H,a[1]=S*Y+D*H,a[2]=x*-H+I*Y,a[3]=S*-H+D*Y,a},n.rotateX=function(a,c,f){var x=Math.sin(f),S=Math.cos(f),I=c[4],D=c[5],H=c[6],Y=c[7],ee=c[8],ie=c[9],se=c[10],Ae=c[11];return c!==a&&(a[0]=c[0],a[1]=c[1],a[2]=c[2],a[3]=c[3],a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]),a[4]=I*S+ee*x,a[5]=D*S+ie*x,a[6]=H*S+se*x,a[7]=Y*S+Ae*x,a[8]=ee*S-I*x,a[9]=ie*S-D*x,a[10]=se*S-H*x,a[11]=Ae*S-Y*x,a},n.rotateZ=function(a,c,f){var x=Math.sin(f),S=Math.cos(f),I=c[0],D=c[1],H=c[2],Y=c[3],ee=c[4],ie=c[5],se=c[6],Ae=c[7];return c!==a&&(a[8]=c[8],a[9]=c[9],a[10]=c[10],a[11]=c[11],a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15]),a[0]=I*S+ee*x,a[1]=D*S+ie*x,a[2]=H*S+se*x,a[3]=Y*S+Ae*x,a[4]=ee*S-I*x,a[5]=ie*S-D*x,a[6]=se*S-H*x,a[7]=Ae*S-Y*x,a},n.scale=function(a,c,f){var x=f[0],S=f[1],I=f[2];return a[0]=c[0]*x,a[1]=c[1]*x,a[2]=c[2]*x,a[3]=c[3]*x,a[4]=c[4]*S,a[5]=c[5]*S,a[6]=c[6]*S,a[7]=c[7]*S,a[8]=c[8]*I,a[9]=c[9]*I,a[10]=c[10]*I,a[11]=c[11]*I,a[12]=c[12],a[13]=c[13],a[14]=c[14],a[15]=c[15],a},n.scale$1=function(a,c,f){return a[0]=c[0]*f,a[1]=c[1]*f,a[2]=c[2]*f,a[3]=c[3]*f,a},n.scale$2=function(a,c,f){return a[0]=c[0]*f,a[1]=c[1]*f,a[2]=c[2]*f,a},n.setCacheLimits=function(a,c){Dn=a,To=c},n.setRTLTextPlugin=function(a,c,f){if(f===void 0&&(f=!1),fs==="deferred"||fs==="loading"||fs==="loaded")throw new Error("setRTLTextPlugin cannot be called multiple times.");pc=ae.resolveURL(a),fs="deferred",dc=c,af(),f||Il()},n.sphericalToCartesian=function(a){var c=a[0],f=a[1],x=a[2];return f+=90,f*=Math.PI/180,x*=Math.PI/180,{x:c*Math.cos(f)*Math.sin(x),y:c*Math.sin(f)*Math.sin(x),z:c*Math.cos(x)}},n.sqrLen=function(a){var c=a[0],f=a[1];return c*c+f*f},n.styleSpec=Se,n.sub=function(a,c,f){return a[0]=c[0]-f[0],a[1]=c[1]-f[1],a[2]=c[2]-f[2],a},n.symbolSize=Ite,n.transformMat3=function(a,c,f){var x=c[0],S=c[1],I=c[2];return a[0]=x*f[0]+S*f[3]+I*f[6],a[1]=x*f[1]+S*f[4]+I*f[7],a[2]=x*f[2]+S*f[5]+I*f[8],a},n.transformMat4=dp,n.translate=function(a,c,f){var x,S,I,D,H,Y,ee,ie,se,Ae,Te,ke,Ve=f[0],et=f[1],Xe=f[2];return c===a?(a[12]=c[0]*Ve+c[4]*et+c[8]*Xe+c[12],a[13]=c[1]*Ve+c[5]*et+c[9]*Xe+c[13],a[14]=c[2]*Ve+c[6]*et+c[10]*Xe+c[14],a[15]=c[3]*Ve+c[7]*et+c[11]*Xe+c[15]):(S=c[1],I=c[2],D=c[3],H=c[4],Y=c[5],ee=c[6],ie=c[7],se=c[8],Ae=c[9],Te=c[10],ke=c[11],a[0]=x=c[0],a[1]=S,a[2]=I,a[3]=D,a[4]=H,a[5]=Y,a[6]=ee,a[7]=ie,a[8]=se,a[9]=Ae,a[10]=Te,a[11]=ke,a[12]=x*Ve+H*et+se*Xe+c[12],a[13]=S*Ve+Y*et+Ae*Xe+c[13],a[14]=I*Ve+ee*et+Te*Xe+c[14],a[15]=D*Ve+ie*et+ke*Xe+c[15]),a},n.triggerPluginCompletionEvent=FA,n.uniqueId=J,n.validateCustomStyleLayer=function(a){var c=[],f=a.id;return f===void 0&&c.push({message:"layers."+f+': missing required property "id"'}),a.render===void 0&&c.push({message:"layers."+f+': missing required method "render"'}),a.renderingMode&&a.renderingMode!=="2d"&&a.renderingMode!=="3d"&&c.push({message:"layers."+f+': property "renderingMode" must be either "2d" or "3d"'}),c},n.validateLight=js,n.validateStyle=rs,n.values=function(a){var c=[];for(var f in a)c.push(a[f]);return c},n.vectorTile=ad,n.version="1.13.3",n.warnOnce=we,n.webpSupported=je,n.window=v,n.wrap=F}),i(["./shared"],function(n){"use strict";function o(oe){var de=typeof oe;if(de==="number"||de==="boolean"||de==="string"||oe==null)return JSON.stringify(oe);if(Array.isArray(oe)){for(var ve="[",Pe=0,ye=oe;Pe<ye.length;Pe+=1)ve+=o(ye[Pe])+",";return ve+"]"}for(var tt=Object.keys(oe).sort(),rt="{",Se=0;Se<tt.length;Se++)rt+=JSON.stringify(tt[Se])+":"+o(oe[tt[Se]])+",";return rt+"}"}function s(oe){for(var de="",ve=0,Pe=n.refProperties;ve<Pe.length;ve+=1)de+="/"+o(oe[Pe[ve]]);return de}var l=function(oe){this.keyCache={},oe&&this.replace(oe)};l.prototype.replace=function(oe){this._layerConfigs={},this._layers={},this.update(oe,[])},l.prototype.update=function(oe,de){for(var ve=this,Pe=0,ye=oe;Pe<ye.length;Pe+=1){var tt=ye[Pe];this._layerConfigs[tt.id]=tt;var rt=this._layers[tt.id]=n.createStyleLayer(tt);rt._featureFilter=n.featureFilter(rt.filter),this.keyCache[tt.id]&&delete this.keyCache[tt.id]}for(var Se=0,Ge=de;Se<Ge.length;Se+=1){var ht=Ge[Se];delete this.keyCache[ht],delete this._layerConfigs[ht],delete this._layers[ht]}this.familiesBySource={};for(var Ht=0,Zt=function(sr,lr){for(var bi={},pr=0;pr<sr.length;pr++){var Ii=lr&&lr[sr[pr].id]||s(sr[pr]);lr&&(lr[sr[pr].id]=Ii);var vn=bi[Ii];vn||(vn=bi[Ii]=[]),vn.push(sr[pr])}var Di=[];for(var Qi in bi)Di.push(bi[Qi]);return Di}(n.values(this._layerConfigs),this.keyCache);Ht<Zt.length;Ht+=1){var Pt=Zt[Ht].map(function(sr){return ve._layers[sr.id]}),Xt=Pt[0];if(Xt.visibility!=="none"){var Dr=Xt.source||"",Mr=this.familiesBySource[Dr];Mr||(Mr=this.familiesBySource[Dr]={});var Ot=Xt.sourceLayer||"_geojsonTileLayer",br=Mr[Ot];br||(br=Mr[Ot]=[]),br.push(Pt)}}};var u=function(oe){var de={},ve=[];for(var Pe in oe){var ye=oe[Pe],tt=de[Pe]={};for(var rt in ye){var Se=ye[+rt];if(Se&&Se.bitmap.width!==0&&Se.bitmap.height!==0){var Ge={x:0,y:0,w:Se.bitmap.width+2,h:Se.bitmap.height+2};ve.push(Ge),tt[rt]={rect:Ge,metrics:Se.metrics}}}}var ht=n.potpack(ve),Ht=new n.AlphaImage({width:ht.w||1,height:ht.h||1});for(var Zt in oe){var Pt=oe[Zt];for(var Xt in Pt){var Dr=Pt[+Xt];if(Dr&&Dr.bitmap.width!==0&&Dr.bitmap.height!==0){var Mr=de[Zt][Xt].rect;n.AlphaImage.copy(Dr.bitmap,Ht,{x:0,y:0},{x:Mr.x+1,y:Mr.y+1},Dr.bitmap)}}}this.image=Ht,this.positions=de};n.register("GlyphAtlas",u);var h=function(oe){this.tileID=new n.OverscaledTileID(oe.tileID.overscaledZ,oe.tileID.wrap,oe.tileID.canonical.z,oe.tileID.canonical.x,oe.tileID.canonical.y),this.uid=oe.uid,this.zoom=oe.zoom,this.pixelRatio=oe.pixelRatio,this.tileSize=oe.tileSize,this.source=oe.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=oe.showCollisionBoxes,this.collectResourceTiming=!!oe.collectResourceTiming,this.returnDependencies=!!oe.returnDependencies,this.promoteId=oe.promoteId};function v(oe,de,ve){for(var Pe=new n.EvaluationParameters(de),ye=0,tt=oe;ye<tt.length;ye+=1)tt[ye].recalculate(Pe,ve)}function T(oe,de){var ve=n.getArrayBuffer(oe.request,function(Pe,ye,tt,rt){Pe?de(Pe):ye&&de(null,{vectorTile:new n.vectorTile.VectorTile(new n.pbf(ye)),rawData:ye,cacheControl:tt,expires:rt})});return function(){ve.cancel(),de()}}h.prototype.parse=function(oe,de,ve,Pe,ye){var tt=this;this.status="parsing",this.data=oe,this.collisionBoxArray=new n.CollisionBoxArray;var rt=new n.DictionaryCoder(Object.keys(oe.layers).sort()),Se=new n.FeatureIndex(this.tileID,this.promoteId);Se.bucketLayerIDs=[];var Ge,ht,Ht,Zt,Pt={},Xt={featureIndex:Se,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ve},Dr=de.familiesBySource[this.source];for(var Mr in Dr){var Ot=oe.layers[Mr];if(Ot){Ot.version===1&&n.warnOnce('Vector tile source "'+this.source+'" layer "'+Mr+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var br=rt.encode(Mr),sr=[],lr=0;lr<Ot.length;lr++){var bi=Ot.feature(lr),pr=Se.getId(bi,Mr);sr.push({feature:bi,id:pr,index:lr,sourceLayerIndex:br})}for(var Ii=0,vn=Dr[Mr];Ii<vn.length;Ii+=1){var Di=vn[Ii],Qi=Di[0];Qi.minzoom&&this.zoom<Math.floor(Qi.minzoom)||Qi.maxzoom&&this.zoom>=Qi.maxzoom||Qi.visibility!=="none"&&(v(Di,this.zoom,ve),(Pt[Qi.id]=Qi.createBucket({index:Se.bucketLayerIDs.length,layers:Di,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:br,sourceID:this.source})).populate(sr,Xt,this.tileID.canonical),Se.bucketLayerIDs.push(Di.map(function(en){return en.id})))}}}var Li=n.mapObject(Xt.glyphDependencies,function(en){return Object.keys(en).map(Number)});Object.keys(Li).length?Pe.send("getGlyphs",{uid:this.uid,stacks:Li},function(en,Si){Ge||(Ge=en,ht=Si,Ln.call(tt))}):ht={};var Xn=Object.keys(Xt.iconDependencies);Xn.length?Pe.send("getImages",{icons:Xn,source:this.source,tileID:this.tileID,type:"icons"},function(en,Si){Ge||(Ge=en,Ht=Si,Ln.call(tt))}):Ht={};var $i=Object.keys(Xt.patternDependencies);function Ln(){if(Ge)return ye(Ge);if(ht&&Ht&&Zt){var en=new u(ht),Si=new n.ImageAtlas(Ht,Zt);for(var Oi in Pt){var yo=Pt[Oi];yo instanceof n.SymbolBucket?(v(yo.layers,this.zoom,ve),n.performSymbolLayout(yo,ht,en.positions,Ht,Si.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):yo.hasPattern&&(yo instanceof n.LineBucket||yo instanceof n.FillBucket||yo instanceof n.FillExtrusionBucket)&&(v(yo.layers,this.zoom,ve),yo.addFeatures(Xt,this.tileID.canonical,Si.patternPositions))}this.status="done",ye(null,{buckets:n.values(Pt).filter(function(fc){return!fc.isEmpty()}),featureIndex:Se,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:en.image,imageAtlas:Si,glyphMap:this.returnDependencies?ht:null,iconMap:this.returnDependencies?Ht:null,glyphPositions:this.returnDependencies?en.positions:null})}}$i.length?Pe.send("getImages",{icons:$i,source:this.source,tileID:this.tileID,type:"patterns"},function(en,Si){Ge||(Ge=en,Zt=Si,Ln.call(tt))}):Zt={},Ln.call(this)};var E=function(oe,de,ve,Pe){this.actor=oe,this.layerIndex=de,this.availableImages=ve,this.loadVectorData=Pe||T,this.loading={},this.loaded={}};E.prototype.loadTile=function(oe,de){var ve=this,Pe=oe.uid;this.loading||(this.loading={});var ye=!!(oe&&oe.request&&oe.request.collectResourceTiming)&&new n.RequestPerformance(oe.request),tt=this.loading[Pe]=new h(oe);tt.abort=this.loadVectorData(oe,function(rt,Se){if(delete ve.loading[Pe],rt||!Se)return tt.status="done",ve.loaded[Pe]=tt,de(rt);var Ge=Se.rawData,ht={};Se.expires&&(ht.expires=Se.expires),Se.cacheControl&&(ht.cacheControl=Se.cacheControl);var Ht={};if(ye){var Zt=ye.finish();Zt&&(Ht.resourceTiming=JSON.parse(JSON.stringify(Zt)))}tt.vectorTile=Se.vectorTile,tt.parse(Se.vectorTile,ve.layerIndex,ve.availableImages,ve.actor,function(Pt,Xt){if(Pt||!Xt)return de(Pt);de(null,n.extend({rawTileData:Ge.slice(0)},Xt,ht,Ht))}),ve.loaded=ve.loaded||{},ve.loaded[Pe]=tt})},E.prototype.reloadTile=function(oe,de){var ve=this,Pe=this.loaded,ye=oe.uid,tt=this;if(Pe&&Pe[ye]){var rt=Pe[ye];rt.showCollisionBoxes=oe.showCollisionBoxes;var Se=function(Ge,ht){var Ht=rt.reloadCallback;Ht&&(delete rt.reloadCallback,rt.parse(rt.vectorTile,tt.layerIndex,ve.availableImages,tt.actor,Ht)),de(Ge,ht)};rt.status==="parsing"?rt.reloadCallback=Se:rt.status==="done"&&(rt.vectorTile?rt.parse(rt.vectorTile,this.layerIndex,this.availableImages,this.actor,Se):Se())}},E.prototype.abortTile=function(oe,de){var ve=this.loading,Pe=oe.uid;ve&&ve[Pe]&&ve[Pe].abort&&(ve[Pe].abort(),delete ve[Pe]),de()},E.prototype.removeTile=function(oe,de){var ve=this.loaded,Pe=oe.uid;ve&&ve[Pe]&&delete ve[Pe],de()};var M=n.window.ImageBitmap,O=function(){this.loaded={}};function F(oe,de){if(oe.length!==0){z(oe[0],de);for(var ve=1;ve<oe.length;ve++)z(oe[ve],!de)}}function z(oe,de){for(var ve=0,Pe=0,ye=0,tt=oe.length,rt=tt-1;ye<tt;rt=ye++){var Se=(oe[ye][0]-oe[rt][0])*(oe[rt][1]+oe[ye][1]),Ge=ve+Se;Pe+=Math.abs(ve)>=Math.abs(Se)?ve-Ge+Se:Se-Ge+ve,ve=Ge}ve+Pe>=0!=!!de&&oe.reverse()}O.prototype.loadTile=function(oe,de){var ve=oe.uid,Pe=oe.encoding,ye=oe.rawImageData,tt=M&&ye instanceof M?this.getImageData(ye):ye,rt=new n.DEMData(ve,tt,Pe);this.loaded=this.loaded||{},this.loaded[ve]=rt,de(null,rt)},O.prototype.getImageData=function(oe){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(oe.width,oe.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=oe.width,this.offscreenCanvas.height=oe.height,this.offscreenCanvasContext.drawImage(oe,0,0,oe.width,oe.height);var de=this.offscreenCanvasContext.getImageData(-1,-1,oe.width+2,oe.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new n.RGBAImage({width:de.width,height:de.height},de.data)},O.prototype.removeTile=function(oe){var de=this.loaded,ve=oe.uid;de&&de[ve]&&delete de[ve]};var W=n.vectorTile.VectorTileFeature.prototype.toGeoJSON,J=function(oe){this._feature=oe,this.extent=n.EXTENT,this.type=oe.type,this.properties=oe.tags,"id"in oe&&!isNaN(oe.id)&&(this.id=parseInt(oe.id,10))};J.prototype.loadGeometry=function(){if(this._feature.type===1){for(var oe=[],de=0,ve=this._feature.geometry;de<ve.length;de+=1){var Pe=ve[de];oe.push([new n.Point$1(Pe[0],Pe[1])])}return oe}for(var ye=[],tt=0,rt=this._feature.geometry;tt<rt.length;tt+=1){for(var Se=[],Ge=0,ht=rt[tt];Ge<ht.length;Ge+=1){var Ht=ht[Ge];Se.push(new n.Point$1(Ht[0],Ht[1]))}ye.push(Se)}return ye},J.prototype.toGeoJSON=function(oe,de,ve){return W.call(this,oe,de,ve)};var K=function(oe){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=n.EXTENT,this.length=oe.length,this._features=oe};K.prototype.feature=function(oe){return new J(this._features[oe])};var ne=n.vectorTile.VectorTileFeature,ge=j;function j(oe,de){this.options=de||{},this.features=oe,this.length=oe.length}function me(oe,de){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=de||4096}j.prototype.feature=function(oe){return new me(this.features[oe],this.options.extent)},me.prototype.loadGeometry=function(){var oe=this.rawGeometry;this.geometry=[];for(var de=0;de<oe.length;de++){for(var ve=oe[de],Pe=[],ye=0;ye<ve.length;ye++)Pe.push(new n.Point$1(ve[ye][0],ve[ye][1]));this.geometry.push(Pe)}return this.geometry},me.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var oe=this.geometry,de=1/0,ve=-1/0,Pe=1/0,ye=-1/0,tt=0;tt<oe.length;tt++)for(var rt=oe[tt],Se=0;Se<rt.length;Se++){var Ge=rt[Se];de=Math.min(de,Ge.x),ve=Math.max(ve,Ge.x),Pe=Math.min(Pe,Ge.y),ye=Math.max(ye,Ge.y)}return[de,Pe,ve,ye]},me.prototype.toGeoJSON=ne.prototype.toGeoJSON;var fe=Z,$=ge;function Z(oe){var de=new n.pbf;return function(ve,Pe){for(var ye in ve.layers)Pe.writeMessage(3,we,ve.layers[ye])}(oe,de),de.finish()}function we(oe,de){var ve;de.writeVarintField(15,oe.version||1),de.writeStringField(1,oe.name||""),de.writeVarintField(5,oe.extent||4096);var Pe={keys:[],values:[],keycache:{},valuecache:{}};for(ve=0;ve<oe.length;ve++)Pe.feature=oe.feature(ve),de.writeMessage(2,Oe,Pe);var ye=Pe.keys;for(ve=0;ve<ye.length;ve++)de.writeStringField(3,ye[ve]);var tt=Pe.values;for(ve=0;ve<tt.length;ve++)de.writeMessage(4,Yt,tt[ve])}function Oe(oe,de){var ve=oe.feature;ve.id!==void 0&&de.writeVarintField(1,ve.id),de.writeMessage(2,he,oe),de.writeVarintField(3,ve.type),de.writeMessage(4,Vt,ve)}function he(oe,de){var ve=oe.feature,Pe=oe.keys,ye=oe.values,tt=oe.keycache,rt=oe.valuecache;for(var Se in ve.properties){var Ge=tt[Se];Ge===void 0&&(Pe.push(Se),tt[Se]=Ge=Pe.length-1),de.writeVarint(Ge);var ht=ve.properties[Se],Ht=typeof ht;Ht!=="string"&&Ht!=="boolean"&&Ht!=="number"&&(ht=JSON.stringify(ht));var Zt=Ht+":"+ht,Pt=rt[Zt];Pt===void 0&&(ye.push(ht),rt[Zt]=Pt=ye.length-1),de.writeVarint(Pt)}}function Le(oe,de){return(de<<3)+(7&oe)}function ft(oe){return oe<<1^oe>>31}function Vt(oe,de){for(var ve=oe.loadGeometry(),Pe=oe.type,ye=0,tt=0,rt=ve.length,Se=0;Se<rt;Se++){var Ge=ve[Se],ht=1;Pe===1&&(ht=Ge.length),de.writeVarint(Le(1,ht));for(var Ht=Pe===3?Ge.length-1:Ge.length,Zt=0;Zt<Ht;Zt++){Zt===1&&Pe!==1&&de.writeVarint(Le(2,Ht-1));var Pt=Ge[Zt].x-ye,Xt=Ge[Zt].y-tt;de.writeVarint(ft(Pt)),de.writeVarint(ft(Xt)),ye+=Pt,tt+=Xt}Pe===3&&de.writeVarint(Le(7,1))}}function Yt(oe,de){var ve=typeof oe;ve==="string"?de.writeStringField(1,oe):ve==="boolean"?de.writeBooleanField(7,oe):ve==="number"&&(oe%1!=0?de.writeDoubleField(3,oe):oe<0?de.writeSVarintField(6,oe):de.writeVarintField(5,oe))}function mr(oe,de,ve,Pe){Er(oe,ve,Pe),Er(de,2*ve,2*Pe),Er(de,2*ve+1,2*Pe+1)}function Er(oe,de,ve){var Pe=oe[de];oe[de]=oe[ve],oe[ve]=Pe}function Jr(oe,de,ve,Pe){var ye=oe-ve,tt=de-Pe;return ye*ye+tt*tt}fe.fromVectorTileJs=Z,fe.fromGeojsonVt=function(oe,de){de=de||{};var ve={};for(var Pe in oe)ve[Pe]=new ge(oe[Pe].features,de),ve[Pe].name=Pe,ve[Pe].version=de.version,ve[Pe].extent=de.extent;return Z({layers:ve})},fe.GeoJSONWrapper=$;var or=function(oe){return oe[0]},ai=function(oe){return oe[1]},Jt=function(oe,de,ve,Pe,ye){de===void 0&&(de=or),ve===void 0&&(ve=ai),Pe===void 0&&(Pe=64),ye===void 0&&(ye=Float64Array),this.nodeSize=Pe,this.points=oe;for(var tt=oe.length<65536?Uint16Array:Uint32Array,rt=this.ids=new tt(oe.length),Se=this.coords=new ye(2*oe.length),Ge=0;Ge<oe.length;Ge++)rt[Ge]=Ge,Se[2*Ge]=de(oe[Ge]),Se[2*Ge+1]=ve(oe[Ge]);(function ht(Ht,Zt,Pt,Xt,Dr,Mr){if(!(Dr-Xt<=Pt)){var Ot=Xt+Dr>>1;(function br(sr,lr,bi,pr,Ii,vn){for(;Ii>pr;){if(Ii-pr>600){var Di=Ii-pr+1,Qi=bi-pr+1,Li=Math.log(Di),Xn=.5*Math.exp(2*Li/3),$i=.5*Math.sqrt(Li*Xn*(Di-Xn)/Di)*(Qi-Di/2<0?-1:1);br(sr,lr,bi,Math.max(pr,Math.floor(bi-Qi*Xn/Di+$i)),Math.min(Ii,Math.floor(bi+(Di-Qi)*Xn/Di+$i)),vn)}var Ln=lr[2*bi+vn],en=pr,Si=Ii;for(mr(sr,lr,pr,bi),lr[2*Ii+vn]>Ln&&mr(sr,lr,pr,Ii);en<Si;){for(mr(sr,lr,en,Si),en++,Si--;lr[2*en+vn]<Ln;)en++;for(;lr[2*Si+vn]>Ln;)Si--}lr[2*pr+vn]===Ln?mr(sr,lr,pr,Si):mr(sr,lr,++Si,Ii),Si<=bi&&(pr=Si+1),bi<=Si&&(Ii=Si-1)}})(Ht,Zt,Ot,Xt,Dr,Mr%2),ht(Ht,Zt,Pt,Xt,Ot-1,Mr+1),ht(Ht,Zt,Pt,Ot+1,Dr,Mr+1)}})(rt,Se,Pe,0,rt.length-1,0)};Jt.prototype.range=function(oe,de,ve,Pe){return function(ye,tt,rt,Se,Ge,ht,Ht){for(var Zt,Pt,Xt=[0,ye.length-1,0],Dr=[];Xt.length;){var Mr=Xt.pop(),Ot=Xt.pop(),br=Xt.pop();if(Ot-br<=Ht)for(var sr=br;sr<=Ot;sr++)Pt=tt[2*sr+1],(Zt=tt[2*sr])>=rt&&Zt<=Ge&&Pt>=Se&&Pt<=ht&&Dr.push(ye[sr]);else{var lr=Math.floor((br+Ot)/2);Pt=tt[2*lr+1],(Zt=tt[2*lr])>=rt&&Zt<=Ge&&Pt>=Se&&Pt<=ht&&Dr.push(ye[lr]);var bi=(Mr+1)%2;(Mr===0?rt<=Zt:Se<=Pt)&&(Xt.push(br),Xt.push(lr-1),Xt.push(bi)),(Mr===0?Ge>=Zt:ht>=Pt)&&(Xt.push(lr+1),Xt.push(Ot),Xt.push(bi))}}return Dr}(this.ids,this.coords,oe,de,ve,Pe,this.nodeSize)},Jt.prototype.within=function(oe,de,ve){return function(Pe,ye,tt,rt,Se,Ge){for(var ht=[0,Pe.length-1,0],Ht=[],Zt=Se*Se;ht.length;){var Pt=ht.pop(),Xt=ht.pop(),Dr=ht.pop();if(Xt-Dr<=Ge)for(var Mr=Dr;Mr<=Xt;Mr++)Jr(ye[2*Mr],ye[2*Mr+1],tt,rt)<=Zt&&Ht.push(Pe[Mr]);else{var Ot=Math.floor((Dr+Xt)/2),br=ye[2*Ot],sr=ye[2*Ot+1];Jr(br,sr,tt,rt)<=Zt&&Ht.push(Pe[Ot]);var lr=(Pt+1)%2;(Pt===0?tt-Se<=br:rt-Se<=sr)&&(ht.push(Dr),ht.push(Ot-1),ht.push(lr)),(Pt===0?tt+Se>=br:rt+Se>=sr)&&(ht.push(Ot+1),ht.push(Xt),ht.push(lr))}}return Ht}(this.ids,this.coords,oe,de,ve,this.nodeSize)};var qt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(oe){return oe}},wi=function(oe){this.options=$r(Object.create(qt),oe),this.trees=new Array(this.options.maxZoom+1)};function ae(oe,de,ve,Pe,ye){return{x:oe,y:de,zoom:1/0,id:ve,parentId:-1,numPoints:Pe,properties:ye}}function be(oe,de){var ve=oe.geometry.coordinates,Pe=ve[1];return{x:Ft(ve[0]),y:wt(Pe),zoom:1/0,index:de,parentId:-1}}function je(oe){return{type:"Feature",id:oe.id,properties:lt(oe),geometry:{type:"Point",coordinates:[(Pe=oe.x,360*(Pe-.5)),(de=oe.y,ve=(180-360*de)*Math.PI/180,360*Math.atan(Math.exp(ve))/Math.PI-90)]}};var de,ve,Pe}function lt(oe){var de=oe.numPoints,ve=de>=1e4?Math.round(de/1e3)+"k":de>=1e3?Math.round(de/100)/10+"k":de;return $r($r({},oe.properties),{cluster:!0,cluster_id:oe.id,point_count:de,point_count_abbreviated:ve})}function Ft(oe){return oe/360+.5}function wt(oe){var de=Math.sin(oe*Math.PI/180),ve=.5-.25*Math.log((1+de)/(1-de))/Math.PI;return ve<0?0:ve>1?1:ve}function $r(oe,de){for(var ve in de)oe[ve]=de[ve];return oe}function xi(oe){return oe.x}function Ki(oe){return oe.y}function kn(oe,de,ve,Pe,ye,tt){var rt=ye-ve,Se=tt-Pe;if(rt!==0||Se!==0){var Ge=((oe-ve)*rt+(de-Pe)*Se)/(rt*rt+Se*Se);Ge>1?(ve=ye,Pe=tt):Ge>0&&(ve+=rt*Ge,Pe+=Se*Ge)}return(rt=oe-ve)*rt+(Se=de-Pe)*Se}function Zi(oe,de,ve,Pe){var ye={id:oe===void 0?null:oe,type:de,geometry:ve,tags:Pe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(tt){var rt=tt.geometry,Se=tt.type;if(Se==="Point"||Se==="MultiPoint"||Se==="LineString")Hi(tt,rt);else if(Se==="Polygon"||Se==="MultiLineString")for(var Ge=0;Ge<rt.length;Ge++)Hi(tt,rt[Ge]);else if(Se==="MultiPolygon")for(Ge=0;Ge<rt.length;Ge++)for(var ht=0;ht<rt[Ge].length;ht++)Hi(tt,rt[Ge][ht])}(ye),ye}function Hi(oe,de){for(var ve=0;ve<de.length;ve+=3)oe.minX=Math.min(oe.minX,de[ve]),oe.minY=Math.min(oe.minY,de[ve+1]),oe.maxX=Math.max(oe.maxX,de[ve]),oe.maxY=Math.max(oe.maxY,de[ve+1])}function Un(oe,de,ve,Pe){if(de.geometry){var ye=de.geometry.coordinates,tt=de.geometry.type,rt=Math.pow(ve.tolerance/((1<<ve.maxZoom)*ve.extent),2),Se=[],Ge=de.id;if(ve.promoteId?Ge=de.properties[ve.promoteId]:ve.generateId&&(Ge=Pe||0),tt==="Point")No(ye,Se);else if(tt==="MultiPoint")for(var ht=0;ht<ye.length;ht++)No(ye[ht],Se);else if(tt==="LineString")Ji(ye,Se,rt,!1);else if(tt==="MultiLineString"){if(ve.lineMetrics){for(ht=0;ht<ye.length;ht++)Ji(ye[ht],Se=[],rt,!1),oe.push(Zi(Ge,"LineString",Se,de.properties));return}Bi(ye,Se,rt,!1)}else if(tt==="Polygon")Bi(ye,Se,rt,!0);else{if(tt!=="MultiPolygon"){if(tt==="GeometryCollection"){for(ht=0;ht<de.geometry.geometries.length;ht++)Un(oe,{id:Ge,geometry:de.geometry.geometries[ht],properties:de.properties},ve,Pe);return}throw new Error("Input data is not a valid GeoJSON object.")}for(ht=0;ht<ye.length;ht++){var Ht=[];Bi(ye[ht],Ht,rt,!0),Se.push(Ht)}}oe.push(Zi(Ge,tt,Se,de.properties))}}function No(oe,de){de.push(yn(oe[0])),de.push(po(oe[1])),de.push(0)}function Ji(oe,de,ve,Pe){for(var ye,tt,rt=0,Se=0;Se<oe.length;Se++){var Ge=yn(oe[Se][0]),ht=po(oe[Se][1]);de.push(Ge),de.push(ht),de.push(0),Se>0&&(rt+=Pe?(ye*ht-Ge*tt)/2:Math.sqrt(Math.pow(Ge-ye,2)+Math.pow(ht-tt,2))),ye=Ge,tt=ht}var Ht=de.length-3;de[2]=1,function Zt(Pt,Xt,Dr,Mr){for(var Ot,br=Mr,sr=Dr-Xt>>1,lr=Dr-Xt,bi=Pt[Xt],pr=Pt[Xt+1],Ii=Pt[Dr],vn=Pt[Dr+1],Di=Xt+3;Di<Dr;Di+=3){var Qi=kn(Pt[Di],Pt[Di+1],bi,pr,Ii,vn);if(Qi>br)Ot=Di,br=Qi;else if(Qi===br){var Li=Math.abs(Di-sr);Li<lr&&(Ot=Di,lr=Li)}}br>Mr&&(Ot-Xt>3&&Zt(Pt,Xt,Ot,Mr),Pt[Ot+2]=br,Dr-Ot>3&&Zt(Pt,Ot,Dr,Mr))}(de,0,Ht,ve),de[Ht+2]=1,de.size=Math.abs(rt),de.start=0,de.end=de.size}function Bi(oe,de,ve,Pe){for(var ye=0;ye<oe.length;ye++){var tt=[];Ji(oe[ye],tt,ve,Pe),de.push(tt)}}function yn(oe){return oe/360+.5}function po(oe){var de=Math.sin(oe*Math.PI/180),ve=.5-.25*Math.log((1+de)/(1-de))/Math.PI;return ve<0?0:ve>1?1:ve}function kr(oe,de,ve,Pe,ye,tt,rt,Se){if(Pe/=de,tt>=(ve/=de)&&rt<Pe)return oe;if(rt<ve||tt>=Pe)return null;for(var Ge=[],ht=0;ht<oe.length;ht++){var Ht=oe[ht],Zt=Ht.geometry,Pt=Ht.type,Xt=ye===0?Ht.minX:Ht.minY,Dr=ye===0?Ht.maxX:Ht.maxY;if(Xt>=ve&&Dr<Pe)Ge.push(Ht);else if(!(Dr<ve||Xt>=Pe)){var Mr=[];if(Pt==="Point"||Pt==="MultiPoint")dr(Zt,Mr,ve,Pe,ye);else if(Pt==="LineString")Ur(Zt,Mr,ve,Pe,ye,!1,Se.lineMetrics);else if(Pt==="MultiLineString")to(Zt,Mr,ve,Pe,ye,!1);else if(Pt==="Polygon")to(Zt,Mr,ve,Pe,ye,!0);else if(Pt==="MultiPolygon")for(var Ot=0;Ot<Zt.length;Ot++){var br=[];to(Zt[Ot],br,ve,Pe,ye,!0),br.length&&Mr.push(br)}if(Mr.length){if(Se.lineMetrics&&Pt==="LineString"){for(Ot=0;Ot<Mr.length;Ot++)Ge.push(Zi(Ht.id,Pt,Mr[Ot],Ht.tags));continue}Pt!=="LineString"&&Pt!=="MultiLineString"||(Mr.length===1?(Pt="LineString",Mr=Mr[0]):Pt="MultiLineString"),Pt!=="Point"&&Pt!=="MultiPoint"||(Pt=Mr.length===3?"Point":"MultiPoint"),Ge.push(Zi(Ht.id,Pt,Mr,Ht.tags))}}}return Ge.length?Ge:null}function dr(oe,de,ve,Pe,ye){for(var tt=0;tt<oe.length;tt+=3){var rt=oe[tt+ye];rt>=ve&&rt<=Pe&&(de.push(oe[tt]),de.push(oe[tt+1]),de.push(oe[tt+2]))}}function Ur(oe,de,ve,Pe,ye,tt,rt){for(var Se,Ge,ht=ci(oe),Ht=ye===0?To:Eo,Zt=oe.start,Pt=0;Pt<oe.length-3;Pt+=3){var Xt=oe[Pt],Dr=oe[Pt+1],Mr=oe[Pt+2],Ot=oe[Pt+3],br=oe[Pt+4],sr=ye===0?Xt:Dr,lr=ye===0?Ot:br,bi=!1;rt&&(Se=Math.sqrt(Math.pow(Xt-Ot,2)+Math.pow(Dr-br,2))),sr<ve?lr>ve&&(Ge=Ht(ht,Xt,Dr,Ot,br,ve),rt&&(ht.start=Zt+Se*Ge)):sr>Pe?lr<Pe&&(Ge=Ht(ht,Xt,Dr,Ot,br,Pe),rt&&(ht.start=Zt+Se*Ge)):Dn(ht,Xt,Dr,Mr),lr<ve&&sr>=ve&&(Ge=Ht(ht,Xt,Dr,Ot,br,ve),bi=!0),lr>Pe&&sr<=Pe&&(Ge=Ht(ht,Xt,Dr,Ot,br,Pe),bi=!0),!tt&&bi&&(rt&&(ht.end=Zt+Se*Ge),de.push(ht),ht=ci(oe)),rt&&(Zt+=Se)}var pr=oe.length-3;Xt=oe[pr],Dr=oe[pr+1],Mr=oe[pr+2],(sr=ye===0?Xt:Dr)>=ve&&sr<=Pe&&Dn(ht,Xt,Dr,Mr),pr=ht.length-3,tt&&pr>=3&&(ht[pr]!==ht[0]||ht[pr+1]!==ht[1])&&Dn(ht,ht[0],ht[1],ht[2]),ht.length&&de.push(ht)}function ci(oe){var de=[];return de.size=oe.size,de.start=oe.start,de.end=oe.end,de}function to(oe,de,ve,Pe,ye,tt){for(var rt=0;rt<oe.length;rt++)Ur(oe[rt],de,ve,Pe,ye,tt,!1)}function Dn(oe,de,ve,Pe){oe.push(de),oe.push(ve),oe.push(Pe)}function To(oe,de,ve,Pe,ye,tt){var rt=(tt-de)/(Pe-de);return oe.push(tt),oe.push(ve+(ye-ve)*rt),oe.push(1),rt}function Eo(oe,de,ve,Pe,ye,tt){var rt=(tt-ve)/(ye-ve);return oe.push(de+(Pe-de)*rt),oe.push(tt),oe.push(1),rt}function Xo(oe,de){for(var ve=[],Pe=0;Pe<oe.length;Pe++){var ye,tt=oe[Pe],rt=tt.type;if(rt==="Point"||rt==="MultiPoint"||rt==="LineString")ye=So(tt.geometry,de);else if(rt==="MultiLineString"||rt==="Polygon"){ye=[];for(var Se=0;Se<tt.geometry.length;Se++)ye.push(So(tt.geometry[Se],de))}else if(rt==="MultiPolygon")for(ye=[],Se=0;Se<tt.geometry.length;Se++){for(var Ge=[],ht=0;ht<tt.geometry[Se].length;ht++)Ge.push(So(tt.geometry[Se][ht],de));ye.push(Ge)}ve.push(Zi(tt.id,rt,ye,tt.tags))}return ve}function So(oe,de){var ve=[];ve.size=oe.size,oe.start!==void 0&&(ve.start=oe.start,ve.end=oe.end);for(var Pe=0;Pe<oe.length;Pe+=3)ve.push(oe[Pe]+de,oe[Pe+1],oe[Pe+2]);return ve}function Us(oe,de){if(oe.transformed)return oe;var ve,Pe,ye,tt=1<<oe.z,rt=oe.x,Se=oe.y;for(ve=0;ve<oe.features.length;ve++){var Ge=oe.features[ve],ht=Ge.geometry,Ht=Ge.type;if(Ge.geometry=[],Ht===1)for(Pe=0;Pe<ht.length;Pe+=2)Ge.geometry.push(Fc(ht[Pe],ht[Pe+1],de,tt,rt,Se));else for(Pe=0;Pe<ht.length;Pe++){var Zt=[];for(ye=0;ye<ht[Pe].length;ye+=2)Zt.push(Fc(ht[Pe][ye],ht[Pe][ye+1],de,tt,rt,Se));Ge.geometry.push(Zt)}}return oe.transformed=!0,oe}function Fc(oe,de,ve,Pe,ye,tt){return[Math.round(ve*(oe*Pe-ye)),Math.round(ve*(de*Pe-tt))]}function ql(oe,de,ve,Pe,ye){for(var tt=de===ye.maxZoom?0:ye.tolerance/((1<<de)*ye.extent),rt={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:ve,y:Pe,z:de,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},Se=0;Se<oe.length;Se++){rt.numFeatures++,sl(rt,oe[Se],tt,ye);var Ge=oe[Se].minX,ht=oe[Se].minY,Ht=oe[Se].maxX,Zt=oe[Se].maxY;Ge<rt.minX&&(rt.minX=Ge),ht<rt.minY&&(rt.minY=ht),Ht>rt.maxX&&(rt.maxX=Ht),Zt>rt.maxY&&(rt.maxY=Zt)}return rt}function sl(oe,de,ve,Pe){var ye=de.geometry,tt=de.type,rt=[];if(tt==="Point"||tt==="MultiPoint")for(var Se=0;Se<ye.length;Se+=3)rt.push(ye[Se]),rt.push(ye[Se+1]),oe.numPoints++,oe.numSimplified++;else if(tt==="LineString")Cl(rt,ye,oe,ve,!1,!1);else if(tt==="MultiLineString"||tt==="Polygon")for(Se=0;Se<ye.length;Se++)Cl(rt,ye[Se],oe,ve,tt==="Polygon",Se===0);else if(tt==="MultiPolygon")for(var Ge=0;Ge<ye.length;Ge++){var ht=ye[Ge];for(Se=0;Se<ht.length;Se++)Cl(rt,ht[Se],oe,ve,!0,Se===0)}if(rt.length){var Ht=de.tags||null;if(tt==="LineString"&&Pe.lineMetrics){for(var Zt in Ht={},de.tags)Ht[Zt]=de.tags[Zt];Ht.mapbox_clip_start=ye.start/ye.size,Ht.mapbox_clip_end=ye.end/ye.size}var Pt={geometry:rt,type:tt==="Polygon"||tt==="MultiPolygon"?3:tt==="LineString"||tt==="MultiLineString"?2:1,tags:Ht};de.id!==null&&(Pt.id=de.id),oe.features.push(Pt)}}function Cl(oe,de,ve,Pe,ye,tt){var rt=Pe*Pe;if(Pe>0&&de.size<(ye?rt:Pe))ve.numPoints+=de.length/3;else{for(var Se=[],Ge=0;Ge<de.length;Ge+=3)(Pe===0||de[Ge+2]>rt)&&(ve.numSimplified++,Se.push(de[Ge]),Se.push(de[Ge+1])),ve.numPoints++;ye&&function(ht,Ht){for(var Zt=0,Pt=0,Xt=ht.length,Dr=Xt-2;Pt<Xt;Dr=Pt,Pt+=2)Zt+=(ht[Pt]-ht[Dr])*(ht[Pt+1]+ht[Dr+1]);if(Zt>0===Ht)for(Pt=0,Xt=ht.length;Pt<Xt/2;Pt+=2){var Mr=ht[Pt],Ot=ht[Pt+1];ht[Pt]=ht[Xt-2-Pt],ht[Pt+1]=ht[Xt-1-Pt],ht[Xt-2-Pt]=Mr,ht[Xt-1-Pt]=Ot}}(Se,tt),oe.push(Se)}}function al(oe,de){var ve=(de=this.options=function(ye,tt){for(var rt in tt)ye[rt]=tt[rt];return ye}(Object.create(this.options),de)).debug;if(ve&&console.time("preprocess data"),de.maxZoom<0||de.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(de.promoteId&&de.generateId)throw new Error("promoteId and generateId cannot be used together.");var Pe=function(ye,tt){var rt=[];if(ye.type==="FeatureCollection")for(var Se=0;Se<ye.features.length;Se++)Un(rt,ye.features[Se],tt,Se);else Un(rt,ye.type==="Feature"?ye:{geometry:ye},tt);return rt}(oe,de);this.tiles={},this.tileCoords=[],ve&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",de.indexMaxZoom,de.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(Pe=function(ye,tt){var rt=tt.buffer/tt.extent,Se=ye,Ge=kr(ye,1,-1-rt,rt,0,-1,2,tt),ht=kr(ye,1,1-rt,2+rt,0,-1,2,tt);return(Ge||ht)&&(Se=kr(ye,1,-rt,1+rt,0,-1,2,tt)||[],Ge&&(Se=Xo(Ge,1).concat(Se)),ht&&(Se=Se.concat(Xo(ht,-1)))),Se}(Pe,de)).length&&this.splitTile(Pe,0,0,0),ve&&(Pe.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Ms(oe,de,ve){return 32*((1<<oe)*ve+de)+oe}function ca(oe,de){var ve=oe.tileID.canonical;if(!this._geoJSONIndex)return de(null,null);var Pe=this._geoJSONIndex.getTile(ve.z,ve.x,ve.y);if(!Pe)return de(null,null);var ye=new K(Pe.features),tt=fe(ye);tt.byteOffset===0&&tt.byteLength===tt.buffer.byteLength||(tt=new Uint8Array(tt)),de(null,{vectorTile:ye,rawData:tt.buffer})}wi.prototype.load=function(oe){var de=this.options,ve=de.log,Pe=de.minZoom,ye=de.maxZoom,tt=de.nodeSize;ve&&console.time("total time");var rt="prepare "+oe.length+" points";ve&&console.time(rt),this.points=oe;for(var Se=[],Ge=0;Ge<oe.length;Ge++)oe[Ge].geometry&&Se.push(be(oe[Ge],Ge));this.trees[ye+1]=new Jt(Se,xi,Ki,tt,Float32Array),ve&&console.timeEnd(rt);for(var ht=ye;ht>=Pe;ht--){var Ht=+Date.now();Se=this._cluster(Se,ht),this.trees[ht]=new Jt(Se,xi,Ki,tt,Float32Array),ve&&console.log("z%d: %d clusters in %dms",ht,Se.length,+Date.now()-Ht)}return ve&&console.timeEnd("total time"),this},wi.prototype.getClusters=function(oe,de){var ve=((oe[0]+180)%360+360)%360-180,Pe=Math.max(-90,Math.min(90,oe[1])),ye=oe[2]===180?180:((oe[2]+180)%360+360)%360-180,tt=Math.max(-90,Math.min(90,oe[3]));if(oe[2]-oe[0]>=360)ve=-180,ye=180;else if(ve>ye){var rt=this.getClusters([ve,Pe,180,tt],de),Se=this.getClusters([-180,Pe,ye,tt],de);return rt.concat(Se)}for(var Ge=this.trees[this._limitZoom(de)],ht=[],Ht=0,Zt=Ge.range(Ft(ve),wt(tt),Ft(ye),wt(Pe));Ht<Zt.length;Ht+=1){var Pt=Ge.points[Zt[Ht]];ht.push(Pt.numPoints?je(Pt):this.points[Pt.index])}return ht},wi.prototype.getChildren=function(oe){var de=this._getOriginId(oe),ve=this._getOriginZoom(oe),Pe="No cluster with the specified id.",ye=this.trees[ve];if(!ye)throw new Error(Pe);var tt=ye.points[de];if(!tt)throw new Error(Pe);for(var rt=this.options.radius/(this.options.extent*Math.pow(2,ve-1)),Se=[],Ge=0,ht=ye.within(tt.x,tt.y,rt);Ge<ht.length;Ge+=1){var Ht=ye.points[ht[Ge]];Ht.parentId===oe&&Se.push(Ht.numPoints?je(Ht):this.points[Ht.index])}if(Se.length===0)throw new Error(Pe);return Se},wi.prototype.getLeaves=function(oe,de,ve){var Pe=[];return this._appendLeaves(Pe,oe,de=de||10,ve=ve||0,0),Pe},wi.prototype.getTile=function(oe,de,ve){var Pe=this.trees[this._limitZoom(oe)],ye=Math.pow(2,oe),tt=this.options,rt=tt.radius/tt.extent,Se=(ve-rt)/ye,Ge=(ve+1+rt)/ye,ht={features:[]};return this._addTileFeatures(Pe.range((de-rt)/ye,Se,(de+1+rt)/ye,Ge),Pe.points,de,ve,ye,ht),de===0&&this._addTileFeatures(Pe.range(1-rt/ye,Se,1,Ge),Pe.points,ye,ve,ye,ht),de===ye-1&&this._addTileFeatures(Pe.range(0,Se,rt/ye,Ge),Pe.points,-1,ve,ye,ht),ht.features.length?ht:null},wi.prototype.getClusterExpansionZoom=function(oe){for(var de=this._getOriginZoom(oe)-1;de<=this.options.maxZoom;){var ve=this.getChildren(oe);if(de++,ve.length!==1)break;oe=ve[0].properties.cluster_id}return de},wi.prototype._appendLeaves=function(oe,de,ve,Pe,ye){for(var tt=0,rt=this.getChildren(de);tt<rt.length;tt+=1){var Se=rt[tt],Ge=Se.properties;if(Ge&&Ge.cluster?ye+Ge.point_count<=Pe?ye+=Ge.point_count:ye=this._appendLeaves(oe,Ge.cluster_id,ve,Pe,ye):ye<Pe?ye++:oe.push(Se),oe.length===ve)break}return ye},wi.prototype._addTileFeatures=function(oe,de,ve,Pe,ye,tt){for(var rt=0,Se=oe;rt<Se.length;rt+=1){var Ge=de[Se[rt]],ht=Ge.numPoints,Ht={type:1,geometry:[[Math.round(this.options.extent*(Ge.x*ye-ve)),Math.round(this.options.extent*(Ge.y*ye-Pe))]],tags:ht?lt(Ge):this.points[Ge.index].properties},Zt=void 0;ht?Zt=Ge.id:this.options.generateId?Zt=Ge.index:this.points[Ge.index].id&&(Zt=this.points[Ge.index].id),Zt!==void 0&&(Ht.id=Zt),tt.features.push(Ht)}},wi.prototype._limitZoom=function(oe){return Math.max(this.options.minZoom,Math.min(+oe,this.options.maxZoom+1))},wi.prototype._cluster=function(oe,de){for(var ve=[],Pe=this.options,ye=Pe.reduce,tt=Pe.minPoints,rt=Pe.radius/(Pe.extent*Math.pow(2,de)),Se=0;Se<oe.length;Se++){var Ge=oe[Se];if(!(Ge.zoom<=de)){Ge.zoom=de;for(var ht=this.trees[de+1],Ht=ht.within(Ge.x,Ge.y,rt),Zt=Ge.numPoints||1,Pt=Zt,Xt=0,Dr=Ht;Xt<Dr.length;Xt+=1){var Mr=ht.points[Dr[Xt]];Mr.zoom>de&&(Pt+=Mr.numPoints||1)}if(Pt>=tt){for(var Ot=Ge.x*Zt,br=Ge.y*Zt,sr=ye&&Zt>1?this._map(Ge,!0):null,lr=(Se<<5)+(de+1)+this.points.length,bi=0,pr=Ht;bi<pr.length;bi+=1){var Ii=ht.points[pr[bi]];if(!(Ii.zoom<=de)){Ii.zoom=de;var vn=Ii.numPoints||1;Ot+=Ii.x*vn,br+=Ii.y*vn,Ii.parentId=lr,ye&&(sr||(sr=this._map(Ge,!0)),ye(sr,this._map(Ii)))}}Ge.parentId=lr,ve.push(ae(Ot/Pt,br/Pt,lr,Pt,sr))}else if(ve.push(Ge),Pt>1)for(var Di=0,Qi=Ht;Di<Qi.length;Di+=1){var Li=ht.points[Qi[Di]];Li.zoom<=de||(Li.zoom=de,ve.push(Li))}}}return ve},wi.prototype._getOriginId=function(oe){return oe-this.points.length>>5},wi.prototype._getOriginZoom=function(oe){return(oe-this.points.length)%32},wi.prototype._map=function(oe,de){if(oe.numPoints)return de?$r({},oe.properties):oe.properties;var ve=this.points[oe.index].properties,Pe=this.options.map(ve);return de&&Pe===ve?$r({},Pe):Pe},al.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},al.prototype.splitTile=function(oe,de,ve,Pe,ye,tt,rt){for(var Se=[oe,de,ve,Pe],Ge=this.options,ht=Ge.debug;Se.length;){Pe=Se.pop(),ve=Se.pop(),de=Se.pop(),oe=Se.pop();var Ht=1<<de,Zt=Ms(de,ve,Pe),Pt=this.tiles[Zt];if(!Pt&&(ht>1&&console.time("creation"),Pt=this.tiles[Zt]=ql(oe,de,ve,Pe,Ge),this.tileCoords.push({z:de,x:ve,y:Pe}),ht)){ht>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",de,ve,Pe,Pt.numFeatures,Pt.numPoints,Pt.numSimplified),console.timeEnd("creation"));var Xt="z"+de;this.stats[Xt]=(this.stats[Xt]||0)+1,this.total++}if(Pt.source=oe,ye){if(de===Ge.maxZoom||de===ye)continue;var Dr=1<<ye-de;if(ve!==Math.floor(tt/Dr)||Pe!==Math.floor(rt/Dr))continue}else if(de===Ge.indexMaxZoom||Pt.numPoints<=Ge.indexMaxPoints)continue;if(Pt.source=null,oe.length!==0){ht>1&&console.time("clipping");var Mr,Ot,br,sr,lr,bi,pr=.5*Ge.buffer/Ge.extent,Ii=.5-pr,vn=.5+pr,Di=1+pr;Mr=Ot=br=sr=null,lr=kr(oe,Ht,ve-pr,ve+vn,0,Pt.minX,Pt.maxX,Ge),bi=kr(oe,Ht,ve+Ii,ve+Di,0,Pt.minX,Pt.maxX,Ge),oe=null,lr&&(Mr=kr(lr,Ht,Pe-pr,Pe+vn,1,Pt.minY,Pt.maxY,Ge),Ot=kr(lr,Ht,Pe+Ii,Pe+Di,1,Pt.minY,Pt.maxY,Ge),lr=null),bi&&(br=kr(bi,Ht,Pe-pr,Pe+vn,1,Pt.minY,Pt.maxY,Ge),sr=kr(bi,Ht,Pe+Ii,Pe+Di,1,Pt.minY,Pt.maxY,Ge),bi=null),ht>1&&console.timeEnd("clipping"),Se.push(Mr||[],de+1,2*ve,2*Pe),Se.push(Ot||[],de+1,2*ve,2*Pe+1),Se.push(br||[],de+1,2*ve+1,2*Pe),Se.push(sr||[],de+1,2*ve+1,2*Pe+1)}}},al.prototype.getTile=function(oe,de,ve){var Pe=this.options,ye=Pe.extent,tt=Pe.debug;if(oe<0||oe>24)return null;var rt=1<<oe,Se=Ms(oe,de=(de%rt+rt)%rt,ve);if(this.tiles[Se])return Us(this.tiles[Se],ye);tt>1&&console.log("drilling down to z%d-%d-%d",oe,de,ve);for(var Ge,ht=oe,Ht=de,Zt=ve;!Ge&&ht>0;)ht--,Ht=Math.floor(Ht/2),Zt=Math.floor(Zt/2),Ge=this.tiles[Ms(ht,Ht,Zt)];return Ge&&Ge.source?(tt>1&&console.log("found parent tile z%d-%d-%d",ht,Ht,Zt),tt>1&&console.time("drilling down"),this.splitTile(Ge.source,ht,Ht,Zt,oe,de,ve),tt>1&&console.timeEnd("drilling down"),this.tiles[Se]?Us(this.tiles[Se],ye):null):null};var Ml=function(oe){function de(ve,Pe,ye,tt){oe.call(this,ve,Pe,ye,ca),tt&&(this.loadGeoJSON=tt)}return oe&&(de.__proto__=oe),(de.prototype=Object.create(oe&&oe.prototype)).constructor=de,de.prototype.loadData=function(ve,Pe){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=Pe,this._pendingLoadDataParams=ve,this._state&&this._state!=="Idle"?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},de.prototype._loadData=function(){var ve=this;if(this._pendingCallback&&this._pendingLoadDataParams){var Pe=this._pendingCallback,ye=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var tt=!!(ye&&ye.request&&ye.request.collectResourceTiming)&&new n.RequestPerformance(ye.request);this.loadGeoJSON(ye,function(rt,Se){if(rt||!Se)return Pe(rt);if(typeof Se!="object")return Pe(new Error("Input data given to '"+ye.source+"' is not a valid GeoJSON object."));(function Pt(Xt,Dr){var Mr,Ot=Xt&&Xt.type;if(Ot==="FeatureCollection")for(Mr=0;Mr<Xt.features.length;Mr++)Pt(Xt.features[Mr],Dr);else if(Ot==="GeometryCollection")for(Mr=0;Mr<Xt.geometries.length;Mr++)Pt(Xt.geometries[Mr],Dr);else if(Ot==="Feature")Pt(Xt.geometry,Dr);else if(Ot==="Polygon")F(Xt.coordinates,Dr);else if(Ot==="MultiPolygon")for(Mr=0;Mr<Xt.coordinates.length;Mr++)F(Xt.coordinates[Mr],Dr);return Xt})(Se,!0);try{if(ye.filter){var Ge=n.createExpression(ye.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ge.result==="error")throw new Error(Ge.value.map(function(Pt){return Pt.key+": "+Pt.message}).join(", "));var ht=Se.features.filter(function(Pt){return Ge.value.evaluate({zoom:0},Pt)});Se={type:"FeatureCollection",features:ht}}ve._geoJSONIndex=ye.cluster?new wi(function(Pt){var Xt=Pt.superclusterOptions,Dr=Pt.clusterProperties;if(!Dr||!Xt)return Xt;for(var Mr={},Ot={},br={accumulated:null,zoom:0},sr={properties:null},lr=Object.keys(Dr),bi=0,pr=lr;bi<pr.length;bi+=1){var Ii=pr[bi],vn=Dr[Ii],Di=vn[0],Qi=n.createExpression(vn[1]),Li=n.createExpression(typeof Di=="string"?[Di,["accumulated"],["get",Ii]]:Di);Mr[Ii]=Qi.value,Ot[Ii]=Li.value}return Xt.map=function(Xn){sr.properties=Xn;for(var $i={},Ln=0,en=lr;Ln<en.length;Ln+=1){var Si=en[Ln];$i[Si]=Mr[Si].evaluate(br,sr)}return $i},Xt.reduce=function(Xn,$i){sr.properties=$i;for(var Ln=0,en=lr;Ln<en.length;Ln+=1){var Si=en[Ln];br.accumulated=Xn[Si],Xn[Si]=Ot[Si].evaluate(br,sr)}},Xt}(ye)).load(Se.features):function(Pt,Xt){return new al(Pt,Xt)}(Se,ye.geojsonVtOptions)}catch(Pt){return Pe(Pt)}ve.loaded={};var Ht={};if(tt){var Zt=tt.finish();Zt&&(Ht.resourceTiming={},Ht.resourceTiming[ye.source]=JSON.parse(JSON.stringify(Zt)))}Pe(null,Ht)})}},de.prototype.coalesce=function(){this._state==="Coalescing"?this._state="Idle":this._state==="NeedsLoadData"&&(this._state="Coalescing",this._loadData())},de.prototype.reloadTile=function(ve,Pe){var ye=this.loaded;return ye&&ye[ve.uid]?oe.prototype.reloadTile.call(this,ve,Pe):this.loadTile(ve,Pe)},de.prototype.loadGeoJSON=function(ve,Pe){if(ve.request)n.getJSON(ve.request,Pe);else{if(typeof ve.data!="string")return Pe(new Error("Input data given to '"+ve.source+"' is not a valid GeoJSON object."));try{return Pe(null,JSON.parse(ve.data))}catch{return Pe(new Error("Input data given to '"+ve.source+"' is not a valid GeoJSON object."))}}},de.prototype.removeSource=function(ve,Pe){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),Pe()},de.prototype.getClusterExpansionZoom=function(ve,Pe){try{Pe(null,this._geoJSONIndex.getClusterExpansionZoom(ve.clusterId))}catch(ye){Pe(ye)}},de.prototype.getClusterChildren=function(ve,Pe){try{Pe(null,this._geoJSONIndex.getChildren(ve.clusterId))}catch(ye){Pe(ye)}},de.prototype.getClusterLeaves=function(ve,Pe){try{Pe(null,this._geoJSONIndex.getLeaves(ve.clusterId,ve.limit,ve.offset))}catch(ye){Pe(ye)}},de}(E),ao=function(oe){var de=this;this.self=oe,this.actor=new n.Actor(oe,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:E,geojson:Ml},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(ve,Pe){if(de.workerSourceTypes[ve])throw new Error('Worker source with name "'+ve+'" already registered.');de.workerSourceTypes[ve]=Pe},this.self.registerRTLTextPlugin=function(ve){if(n.plugin.isParsed())throw new Error("RTL text plugin already registered.");n.plugin.applyArabicShaping=ve.applyArabicShaping,n.plugin.processBidirectionalText=ve.processBidirectionalText,n.plugin.processStyledBidirectionalText=ve.processStyledBidirectionalText}};return ao.prototype.setReferrer=function(oe,de){this.referrer=de},ao.prototype.setImages=function(oe,de,ve){for(var Pe in this.availableImages[oe]=de,this.workerSources[oe]){var ye=this.workerSources[oe][Pe];for(var tt in ye)ye[tt].availableImages=de}ve()},ao.prototype.setLayers=function(oe,de,ve){this.getLayerIndex(oe).replace(de),ve()},ao.prototype.updateLayers=function(oe,de,ve){this.getLayerIndex(oe).update(de.layers,de.removedIds),ve()},ao.prototype.loadTile=function(oe,de,ve){this.getWorkerSource(oe,de.type,de.source).loadTile(de,ve)},ao.prototype.loadDEMTile=function(oe,de,ve){this.getDEMWorkerSource(oe,de.source).loadTile(de,ve)},ao.prototype.reloadTile=function(oe,de,ve){this.getWorkerSource(oe,de.type,de.source).reloadTile(de,ve)},ao.prototype.abortTile=function(oe,de,ve){this.getWorkerSource(oe,de.type,de.source).abortTile(de,ve)},ao.prototype.removeTile=function(oe,de,ve){this.getWorkerSource(oe,de.type,de.source).removeTile(de,ve)},ao.prototype.removeDEMTile=function(oe,de){this.getDEMWorkerSource(oe,de.source).removeTile(de)},ao.prototype.removeSource=function(oe,de,ve){if(this.workerSources[oe]&&this.workerSources[oe][de.type]&&this.workerSources[oe][de.type][de.source]){var Pe=this.workerSources[oe][de.type][de.source];delete this.workerSources[oe][de.type][de.source],Pe.removeSource!==void 0?Pe.removeSource(de,ve):ve()}},ao.prototype.loadWorkerSource=function(oe,de,ve){try{this.self.importScripts(de.url),ve()}catch(Pe){ve(Pe.toString())}},ao.prototype.syncRTLPluginState=function(oe,de,ve){try{n.plugin.setState(de);var Pe=n.plugin.getPluginURL();if(n.plugin.isLoaded()&&!n.plugin.isParsed()&&Pe!=null){this.self.importScripts(Pe);var ye=n.plugin.isParsed();ve(ye?void 0:new Error("RTL Text Plugin failed to import scripts from "+Pe),ye)}}catch(tt){ve(tt.toString())}},ao.prototype.getAvailableImages=function(oe){var de=this.availableImages[oe];return de||(de=[]),de},ao.prototype.getLayerIndex=function(oe){var de=this.layerIndexes[oe];return de||(de=this.layerIndexes[oe]=new l),de},ao.prototype.getWorkerSource=function(oe,de,ve){var Pe=this;return this.workerSources[oe]||(this.workerSources[oe]={}),this.workerSources[oe][de]||(this.workerSources[oe][de]={}),this.workerSources[oe][de][ve]||(this.workerSources[oe][de][ve]=new this.workerSourceTypes[de]({send:function(ye,tt,rt){Pe.actor.send(ye,tt,rt,oe)}},this.getLayerIndex(oe),this.getAvailableImages(oe))),this.workerSources[oe][de][ve]},ao.prototype.getDEMWorkerSource=function(oe,de){return this.demWorkerSources[oe]||(this.demWorkerSources[oe]={}),this.demWorkerSources[oe][de]||(this.demWorkerSources[oe][de]=new O),this.demWorkerSources[oe][de]},ao.prototype.enforceCacheSizeLimit=function(oe,de){n.enforceCacheSizeLimit(de)},typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new ao(self)),ao}),i(["./shared"],function(n){"use strict";var o=n.createCommonjsModule(function(d){function _(B){return!p(B)}function p(B){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var V,q,re=new Blob([""],{type:"text/javascript"}),ue=URL.createObjectURL(re);try{q=new Worker(ue),V=!0}catch{V=!1}return q&&q.terminate(),URL.revokeObjectURL(ue),V}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var V=document.createElement("canvas");V.width=V.height=1;var q=V.getContext("2d");if(!q)return!1;var re=q.getImageData(0,0,1,1);return re&&re.width===V.width}()?(b[k=B&&B.failIfMajorPerformanceCaveat]===void 0&&(b[k]=function(V){var q=function(ue){var Ee=document.createElement("canvas"),Ce=Object.create(_.webGLContextAttributes);return Ce.failIfMajorPerformanceCaveat=ue,Ee.probablySupportsContext?Ee.probablySupportsContext("webgl",Ce)||Ee.probablySupportsContext("experimental-webgl",Ce):Ee.supportsContext?Ee.supportsContext("webgl",Ce)||Ee.supportsContext("experimental-webgl",Ce):Ee.getContext("webgl",Ce)||Ee.getContext("experimental-webgl",Ce)}(V);if(!q)return!1;var re=q.createShader(q.VERTEX_SHADER);return!(!re||q.isContextLost())&&(q.shaderSource(re,"void main() {}"),q.compileShader(re),q.getShaderParameter(re,q.COMPILE_STATUS)===!0)}(k)),b[k]?void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var k}d.exports?d.exports=_:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=_,window.mapboxgl.notSupportedReason=p);var b={};_.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}}),s={create:function(d,_,p){var b=n.window.document.createElement(d);return _!==void 0&&(b.className=_),p&&p.appendChild(b),b},createNS:function(d,_){return n.window.document.createElementNS(d,_)}},l=n.window.document&&n.window.document.documentElement.style;function u(d){if(!l)return d[0];for(var _=0;_<d.length;_++)if(d[_]in l)return d[_];return d[0]}var h,v=u(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);s.disableDrag=function(){l&&v&&(h=l[v],l[v]="none")},s.enableDrag=function(){l&&v&&(l[v]=h)};var T=u(["transform","WebkitTransform"]);s.setTransform=function(d,_){d.style[T]=_};var E=!1;try{var M=Object.defineProperty({},"passive",{get:function(){E=!0}});n.window.addEventListener("test",M,M),n.window.removeEventListener("test",M,M)}catch{E=!1}s.addEventListener=function(d,_,p,b){b===void 0&&(b={}),d.addEventListener(_,p,"passive"in b&&E?b:b.capture)},s.removeEventListener=function(d,_,p,b){b===void 0&&(b={}),d.removeEventListener(_,p,"passive"in b&&E?b:b.capture)};var O=function(d){d.preventDefault(),d.stopPropagation(),n.window.removeEventListener("click",O,!0)};function F(d){var _=d.userImage;return!!(_&&_.render&&_.render())&&(d.data.replace(new Uint8Array(_.data.buffer)),!0)}s.suppressClick=function(){n.window.addEventListener("click",O,!0),n.window.setTimeout(function(){n.window.removeEventListener("click",O,!0)},0)},s.mousePos=function(d,_){var p=d.getBoundingClientRect();return new n.Point(_.clientX-p.left-d.clientLeft,_.clientY-p.top-d.clientTop)},s.touchPos=function(d,_){for(var p=d.getBoundingClientRect(),b=[],B=0;B<_.length;B++)b.push(new n.Point(_[B].clientX-p.left-d.clientLeft,_[B].clientY-p.top-d.clientTop));return b},s.mouseButton=function(d){return n.window.InstallTrigger!==void 0&&d.button===2&&d.ctrlKey&&n.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:d.button},s.remove=function(d){d.parentNode&&d.parentNode.removeChild(d)};var z=function(d){function _(){d.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new n.RGBAImage({width:1,height:1}),this.dirty=!0}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.isLoaded=function(){return this.loaded},_.prototype.setLoaded=function(p){if(this.loaded!==p&&(this.loaded=p,p)){for(var b=0,B=this.requestors;b<B.length;b+=1){var k=B[b];this._notify(k.ids,k.callback)}this.requestors=[]}},_.prototype.getImage=function(p){return this.images[p]},_.prototype.addImage=function(p,b){this._validate(p,b)&&(this.images[p]=b)},_.prototype._validate=function(p,b){var B=!0;return this._validateStretch(b.stretchX,b.data&&b.data.width)||(this.fire(new n.ErrorEvent(new Error('Image "'+p+'" has invalid "stretchX" value'))),B=!1),this._validateStretch(b.stretchY,b.data&&b.data.height)||(this.fire(new n.ErrorEvent(new Error('Image "'+p+'" has invalid "stretchY" value'))),B=!1),this._validateContent(b.content,b)||(this.fire(new n.ErrorEvent(new Error('Image "'+p+'" has invalid "content" value'))),B=!1),B},_.prototype._validateStretch=function(p,b){if(!p)return!0;for(var B=0,k=0,V=p;k<V.length;k+=1){var q=V[k];if(q[0]<B||q[1]<q[0]||b<q[1])return!1;B=q[1]}return!0},_.prototype._validateContent=function(p,b){return!(p&&(p.length!==4||p[0]<0||b.data.width<p[0]||p[1]<0||b.data.height<p[1]||p[2]<0||b.data.width<p[2]||p[3]<0||b.data.height<p[3]||p[2]<p[0]||p[3]<p[1]))},_.prototype.updateImage=function(p,b){b.version=this.images[p].version+1,this.images[p]=b,this.updatedImages[p]=!0},_.prototype.removeImage=function(p){var b=this.images[p];delete this.images[p],delete this.patterns[p],b.userImage&&b.userImage.onRemove&&b.userImage.onRemove()},_.prototype.listImages=function(){return Object.keys(this.images)},_.prototype.getImages=function(p,b){var B=!0;if(!this.isLoaded())for(var k=0,V=p;k<V.length;k+=1)this.images[V[k]]||(B=!1);this.isLoaded()||B?this._notify(p,b):this.requestors.push({ids:p,callback:b})},_.prototype._notify=function(p,b){for(var B={},k=0,V=p;k<V.length;k+=1){var q=V[k];this.images[q]||this.fire(new n.Event("styleimagemissing",{id:q}));var re=this.images[q];re?B[q]={data:re.data.clone(),pixelRatio:re.pixelRatio,sdf:re.sdf,version:re.version,stretchX:re.stretchX,stretchY:re.stretchY,content:re.content,hasRenderCallback:Boolean(re.userImage&&re.userImage.render)}:n.warnOnce('Image "'+q+'" 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.')}b(null,B)},_.prototype.getPixelSize=function(){var p=this.atlasImage;return{width:p.width,height:p.height}},_.prototype.getPattern=function(p){var b=this.patterns[p],B=this.getImage(p);if(!B)return null;if(b&&b.position.version===B.version)return b.position;if(b)b.position.version=B.version;else{var k={w:B.data.width+2,h:B.data.height+2,x:0,y:0},V=new n.ImagePosition(k,B);this.patterns[p]={bin:k,position:V}}return this._updatePatternAtlas(),this.patterns[p].position},_.prototype.bind=function(p){var b=p.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new n.Texture(p,this.atlasImage,b.RGBA),this.atlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE)},_.prototype._updatePatternAtlas=function(){var p=[];for(var b in this.patterns)p.push(this.patterns[b].bin);var B=n.potpack(p),k=B.w,V=B.h,q=this.atlasImage;for(var re in q.resize({width:k||1,height:V||1}),this.patterns){var ue=this.patterns[re].bin,Ee=ue.x+1,Ce=ue.y+1,Me=this.images[re].data,He=Me.width,Ue=Me.height;n.RGBAImage.copy(Me,q,{x:0,y:0},{x:Ee,y:Ce},{width:He,height:Ue}),n.RGBAImage.copy(Me,q,{x:0,y:Ue-1},{x:Ee,y:Ce-1},{width:He,height:1}),n.RGBAImage.copy(Me,q,{x:0,y:0},{x:Ee,y:Ce+Ue},{width:He,height:1}),n.RGBAImage.copy(Me,q,{x:He-1,y:0},{x:Ee-1,y:Ce},{width:1,height:Ue}),n.RGBAImage.copy(Me,q,{x:0,y:0},{x:Ee+He,y:Ce},{width:1,height:Ue})}this.dirty=!0},_.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},_.prototype.dispatchRenderCallbacks=function(p){for(var b=0,B=p;b<B.length;b+=1){var k=B[b];if(!this.callbackDispatchedThisFrame[k]){this.callbackDispatchedThisFrame[k]=!0;var V=this.images[k];F(V)&&this.updateImage(k,V)}}},_}(n.Evented),W=ne,J=ne,K=1e20;function ne(d,_,p,b,B,k){this.fontSize=d||24,this.buffer=_===void 0?3:_,this.cutoff=b||.25,this.fontFamily=B||"sans-serif",this.fontWeight=k||"normal",this.radius=p||8;var V=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=V,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(V*V),this.gridInner=new Float64Array(V*V),this.f=new Float64Array(V),this.d=new Float64Array(V),this.z=new Float64Array(V+1),this.v=new Int16Array(V),this.middle=Math.round(V/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function ge(d,_,p,b,B,k,V){for(var q=0;q<_;q++){for(var re=0;re<p;re++)b[re]=d[re*_+q];for(j(b,B,k,V,p),re=0;re<p;re++)d[re*_+q]=B[re]}for(re=0;re<p;re++){for(q=0;q<_;q++)b[q]=d[re*_+q];for(j(b,B,k,V,_),q=0;q<_;q++)d[re*_+q]=Math.sqrt(B[q])}}function j(d,_,p,b,B){p[0]=0,b[0]=-K,b[1]=+K;for(var k=1,V=0;k<B;k++){for(var q=(d[k]+k*k-(d[p[V]]+p[V]*p[V]))/(2*k-2*p[V]);q<=b[V];)V--,q=(d[k]+k*k-(d[p[V]]+p[V]*p[V]))/(2*k-2*p[V]);p[++V]=k,b[V]=q,b[V+1]=+K}for(k=0,V=0;k<B;k++){for(;b[V+1]<k;)V++;_[k]=(k-p[V])*(k-p[V])+d[p[V]]}}ne.prototype.draw=function(d){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(d,this.buffer,this.middle);for(var _=this.ctx.getImageData(0,0,this.size,this.size),p=new Uint8ClampedArray(this.size*this.size),b=0;b<this.size*this.size;b++){var B=_.data[4*b+3]/255;this.gridOuter[b]=B===1?0:B===0?K:Math.pow(Math.max(0,.5-B),2),this.gridInner[b]=B===1?K:B===0?0:Math.pow(Math.max(0,B-.5),2)}for(ge(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),ge(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),b=0;b<this.size*this.size;b++)p[b]=Math.max(0,Math.min(255,Math.round(255-255*((this.gridOuter[b]-this.gridInner[b])/this.radius+this.cutoff))));return p},W.default=J;var me=function(d,_){this.requestManager=d,this.localIdeographFontFamily=_,this.entries={}};me.prototype.setURL=function(d){this.url=d},me.prototype.getGlyphs=function(d,_){var p=this,b=[];for(var B in d)for(var k=0,V=d[B];k<V.length;k+=1)b.push({stack:B,id:V[k]});n.asyncAll(b,function(q,re){var ue=q.stack,Ee=q.id,Ce=p.entries[ue];Ce||(Ce=p.entries[ue]={glyphs:{},requests:{},ranges:{}});var Me=Ce.glyphs[Ee];if(Me===void 0){if(Me=p._tinySDF(Ce,ue,Ee))return Ce.glyphs[Ee]=Me,void re(null,{stack:ue,id:Ee,glyph:Me});var He=Math.floor(Ee/256);if(256*He>65535)re(new Error("glyphs > 65535 not supported"));else if(Ce.ranges[He])re(null,{stack:ue,id:Ee,glyph:Me});else{var Ue=Ce.requests[He];Ue||(Ue=Ce.requests[He]=[],me.loadGlyphRange(ue,He,p.url,p.requestManager,function(Ze,Ne){if(Ne){for(var Ke in Ne)p._doesCharSupportLocalGlyph(+Ke)||(Ce.glyphs[+Ke]=Ne[+Ke]);Ce.ranges[He]=!0}for(var it=0,pt=Ue;it<pt.length;it+=1)(0,pt[it])(Ze,Ne);delete Ce.requests[He]})),Ue.push(function(Ze,Ne){Ze?re(Ze):Ne&&re(null,{stack:ue,id:Ee,glyph:Ne[Ee]||null})})}}else re(null,{stack:ue,id:Ee,glyph:Me})},function(q,re){if(q)_(q);else if(re){for(var ue={},Ee=0,Ce=re;Ee<Ce.length;Ee+=1){var Me=Ce[Ee],He=Me.stack,Ue=Me.id,Ze=Me.glyph;(ue[He]||(ue[He]={}))[Ue]=Ze&&{id:Ze.id,bitmap:Ze.bitmap.clone(),metrics:Ze.metrics}}_(null,ue)}})},me.prototype._doesCharSupportLocalGlyph=function(d){return!!this.localIdeographFontFamily&&(n.isChar["CJK Unified Ideographs"](d)||n.isChar["Hangul Syllables"](d)||n.isChar.Hiragana(d)||n.isChar.Katakana(d))},me.prototype._tinySDF=function(d,_,p){var b=this.localIdeographFontFamily;if(b&&this._doesCharSupportLocalGlyph(p)){var B=d.tinySDF;if(!B){var k="400";/bold/i.test(_)?k="900":/medium/i.test(_)?k="500":/light/i.test(_)&&(k="200"),B=d.tinySDF=new me.TinySDF(24,3,8,.25,b,k)}return{id:p,bitmap:new n.AlphaImage({width:30,height:30},B.draw(String.fromCharCode(p))),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}},me.loadGlyphRange=function(d,_,p,b,B){var k=256*_,V=k+255,q=b.transformRequest(b.normalizeGlyphsURL(p).replace("{fontstack}",d).replace("{range}",k+"-"+V),n.ResourceType.Glyphs);n.getArrayBuffer(q,function(re,ue){if(re)B(re);else if(ue){for(var Ee={},Ce=0,Me=n.parseGlyphPBF(ue);Ce<Me.length;Ce+=1){var He=Me[Ce];Ee[He.id]=He}B(null,Ee)}})},me.TinySDF=W;var fe=function(){this.specification=n.styleSpec.light.position};fe.prototype.possiblyEvaluate=function(d,_){return n.sphericalToCartesian(d.expression.evaluate(_))},fe.prototype.interpolate=function(d,_,p){return{x:n.number(d.x,_.x,p),y:n.number(d.y,_.y,p),z:n.number(d.z,_.z,p)}};var $=new n.Properties({anchor:new n.DataConstantProperty(n.styleSpec.light.anchor),position:new fe,color:new n.DataConstantProperty(n.styleSpec.light.color),intensity:new n.DataConstantProperty(n.styleSpec.light.intensity)}),Z=function(d){function _(p){d.call(this),this._transitionable=new n.Transitionable($),this.setLight(p),this._transitioning=this._transitionable.untransitioned()}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getLight=function(){return this._transitionable.serialize()},_.prototype.setLight=function(p,b){if(b===void 0&&(b={}),!this._validate(n.validateLight,p,b))for(var B in p){var k=p[B];n.endsWith(B,"-transition")?this._transitionable.setTransition(B.slice(0,-11),k):this._transitionable.setValue(B,k)}},_.prototype.updateTransitions=function(p){this._transitioning=this._transitionable.transitioned(p,this._transitioning)},_.prototype.hasTransition=function(){return this._transitioning.hasTransition()},_.prototype.recalculate=function(p){this.properties=this._transitioning.possiblyEvaluate(p)},_.prototype._validate=function(p,b,B){return(!B||B.validate!==!1)&&n.emitValidationErrors(this,p.call(n.validateStyle,n.extend({value:b,style:{glyphs:!0,sprite:!0},styleSpec:n.styleSpec})))},_}(n.Evented),we=function(d,_){this.width=d,this.height=_,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}};we.prototype.getDash=function(d,_){var p=d.join(",")+String(_);return this.dashEntry[p]||(this.dashEntry[p]=this.addDash(d,_)),this.dashEntry[p]},we.prototype.getDashRanges=function(d,_,p){var b=[],B=d.length%2==1?-d[d.length-1]*p:0,k=d[0]*p,V=!0;b.push({left:B,right:k,isDash:V,zeroLength:d[0]===0});for(var q=d[0],re=1;re<d.length;re++){var ue=d[re];b.push({left:B=q*p,right:k=(q+=ue)*p,isDash:V=!V,zeroLength:ue===0})}return b},we.prototype.addRoundDash=function(d,_,p){for(var b=_/2,B=-p;B<=p;B++)for(var k=this.width*(this.nextRow+p+B),V=0,q=d[V],re=0;re<this.width;re++){re/q.right>1&&(q=d[++V]);var ue=Math.abs(re-q.left),Ee=Math.abs(re-q.right),Ce=Math.min(ue,Ee),Me=void 0,He=B/p*(b+1);if(q.isDash){var Ue=b-Math.abs(He);Me=Math.sqrt(Ce*Ce+Ue*Ue)}else Me=b-Math.sqrt(Ce*Ce+He*He);this.data[k+re]=Math.max(0,Math.min(255,Me+128))}},we.prototype.addRegularDash=function(d){for(var _=d.length-1;_>=0;--_){var p=d[_],b=d[_+1];p.zeroLength?d.splice(_,1):b&&b.isDash===p.isDash&&(b.left=p.left,d.splice(_,1))}var B=d[0],k=d[d.length-1];B.isDash===k.isDash&&(B.left=k.left-this.width,k.right=B.right+this.width);for(var V=this.width*this.nextRow,q=0,re=d[q],ue=0;ue<this.width;ue++){ue/re.right>1&&(re=d[++q]);var Ee=Math.abs(ue-re.left),Ce=Math.abs(ue-re.right),Me=Math.min(Ee,Ce);this.data[V+ue]=Math.max(0,Math.min(255,(re.isDash?Me:-Me)+128))}},we.prototype.addDash=function(d,_){var p=_?7:0,b=2*p+1;if(this.nextRow+b>this.height)return n.warnOnce("LineAtlas out of space"),null;for(var B=0,k=0;k<d.length;k++)B+=d[k];if(B!==0){var V=this.width/B,q=this.getDashRanges(d,this.width,V);_?this.addRoundDash(q,V,p):this.addRegularDash(q)}var re={y:(this.nextRow+p+.5)/this.height,height:2*p/this.height,width:B};return this.nextRow+=b,this.dirty=!0,re},we.prototype.bind=function(d){var _=d.gl;this.texture?(_.bindTexture(_.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,_.texSubImage2D(_.TEXTURE_2D,0,0,0,this.width,this.height,_.ALPHA,_.UNSIGNED_BYTE,this.data))):(this.texture=_.createTexture(),_.bindTexture(_.TEXTURE_2D,this.texture),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.REPEAT),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.REPEAT),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.LINEAR),_.texImage2D(_.TEXTURE_2D,0,_.ALPHA,this.width,this.height,0,_.ALPHA,_.UNSIGNED_BYTE,this.data))};var Oe=function d(_,p){this.workerPool=_,this.actors=[],this.currentActor=0,this.id=n.uniqueId();for(var b=this.workerPool.acquire(this.id),B=0;B<b.length;B++){var k=new d.Actor(b[B],p,this.id);k.name="Worker "+B,this.actors.push(k)}};function he(d,_,p){var b=function(B,k){if(B)return p(B);if(k){var V=n.pick(n.extend(k,d),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);k.vector_layers&&(V.vectorLayers=k.vector_layers,V.vectorLayerIds=V.vectorLayers.map(function(q){return q.id})),V.tiles=_.canonicalizeTileset(V,d.url),p(null,V)}};return d.url?n.getJSON(_.transformRequest(_.normalizeSourceURL(d.url),n.ResourceType.Source),b):n.browser.frame(function(){return b(null,d)})}Oe.prototype.broadcast=function(d,_,p){n.asyncAll(this.actors,function(b,B){b.send(d,_,B)},p=p||function(){})},Oe.prototype.getActor=function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]},Oe.prototype.remove=function(){this.actors.forEach(function(d){d.remove()}),this.actors=[],this.workerPool.release(this.id)},Oe.Actor=n.Actor;var Le=function(d,_,p){this.bounds=n.LngLatBounds.convert(this.validateBounds(d)),this.minzoom=_||0,this.maxzoom=p||24};Le.prototype.validateBounds=function(d){return Array.isArray(d)&&d.length===4?[Math.max(-180,d[0]),Math.max(-90,d[1]),Math.min(180,d[2]),Math.min(90,d[3])]:[-180,-90,180,90]},Le.prototype.contains=function(d){var _=Math.pow(2,d.z),p=Math.floor(n.mercatorXfromLng(this.bounds.getWest())*_),b=Math.floor(n.mercatorYfromLat(this.bounds.getNorth())*_),B=Math.ceil(n.mercatorXfromLng(this.bounds.getEast())*_),k=Math.ceil(n.mercatorYfromLat(this.bounds.getSouth())*_);return d.x>=p&&d.x<B&&d.y>=b&&d.y<k};var ft=function(d){function _(p,b,B,k){if(d.call(this),this.id=p,this.dispatcher=B,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,n.extend(this,n.pick(b,["url","scheme","tileSize","promoteId"])),this._options=n.extend({type:"vector"},b),this._collectResourceTiming=b.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(k)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.load=function(){var p=this;this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=he(this._options,this.map._requestManager,function(b,B){p._tileJSONRequest=null,p._loaded=!0,b?p.fire(new n.ErrorEvent(b)):B&&(n.extend(p,B),B.bounds&&(p.tileBounds=new Le(B.bounds,p.minzoom,p.maxzoom)),n.postTurnstileEvent(B.tiles,p.map._requestManager._customAccessToken),n.postMapLoadEvent(B.tiles,p.map._getMapId(),p.map._requestManager._skuToken,p.map._requestManager._customAccessToken),p.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})),p.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})))})},_.prototype.loaded=function(){return this._loaded},_.prototype.hasTile=function(p){return!this.tileBounds||this.tileBounds.contains(p.canonical)},_.prototype.onAdd=function(p){this.map=p,this.load()},_.prototype.setSourceProperty=function(p){this._tileJSONRequest&&this._tileJSONRequest.cancel(),p(),this.map.style.sourceCaches[this.id].clearTiles(),this.load()},_.prototype.setTiles=function(p){var b=this;return this.setSourceProperty(function(){b._options.tiles=p}),this},_.prototype.setUrl=function(p){var b=this;return this.setSourceProperty(function(){b.url=p,b._options.url=p}),this},_.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},_.prototype.serialize=function(){return n.extend({},this._options)},_.prototype.loadTile=function(p,b){var B=this.map._requestManager.normalizeTileURL(p.tileID.canonical.url(this.tiles,this.scheme)),k={request:this.map._requestManager.transformRequest(B,n.ResourceType.Tile),uid:p.uid,tileID:p.tileID,zoom:p.tileID.overscaledZ,tileSize:this.tileSize*p.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:n.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function V(q,re){return delete p.request,p.aborted?b(null):q&&q.status!==404?b(q):(re&&re.resourceTiming&&(p.resourceTiming=re.resourceTiming),this.map._refreshExpiredTiles&&re&&p.setExpiryData(re),p.loadVectorData(re,this.map.painter),n.cacheEntryPossiblyAdded(this.dispatcher),b(null),void(p.reloadCallback&&(this.loadTile(p,p.reloadCallback),p.reloadCallback=null)))}k.request.collectResourceTiming=this._collectResourceTiming,p.actor&&p.state!=="expired"?p.state==="loading"?p.reloadCallback=b:p.request=p.actor.send("reloadTile",k,V.bind(this)):(p.actor=this.dispatcher.getActor(),p.request=p.actor.send("loadTile",k,V.bind(this)))},_.prototype.abortTile=function(p){p.request&&(p.request.cancel(),delete p.request),p.actor&&p.actor.send("abortTile",{uid:p.uid,type:this.type,source:this.id},void 0)},_.prototype.unloadTile=function(p){p.unloadVectorData(),p.actor&&p.actor.send("removeTile",{uid:p.uid,type:this.type,source:this.id},void 0)},_.prototype.hasTransition=function(){return!1},_}(n.Evented),Vt=function(d){function _(p,b,B,k){d.call(this),this.id=p,this.dispatcher=B,this.setEventedParent(k),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=n.extend({type:"raster"},b),n.extend(this,n.pick(b,["url","scheme","tileSize"]))}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.load=function(){var p=this;this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=he(this._options,this.map._requestManager,function(b,B){p._tileJSONRequest=null,p._loaded=!0,b?p.fire(new n.ErrorEvent(b)):B&&(n.extend(p,B),B.bounds&&(p.tileBounds=new Le(B.bounds,p.minzoom,p.maxzoom)),n.postTurnstileEvent(B.tiles),n.postMapLoadEvent(B.tiles,p.map._getMapId(),p.map._requestManager._skuToken),p.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})),p.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})))})},_.prototype.loaded=function(){return this._loaded},_.prototype.onAdd=function(p){this.map=p,this.load()},_.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},_.prototype.serialize=function(){return n.extend({},this._options)},_.prototype.hasTile=function(p){return!this.tileBounds||this.tileBounds.contains(p.canonical)},_.prototype.loadTile=function(p,b){var B=this,k=this.map._requestManager.normalizeTileURL(p.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);p.request=n.getImage(this.map._requestManager.transformRequest(k,n.ResourceType.Tile),function(V,q){if(delete p.request,p.aborted)p.state="unloaded",b(null);else if(V)p.state="errored",b(V);else if(q){B.map._refreshExpiredTiles&&p.setExpiryData(q),delete q.cacheControl,delete q.expires;var re=B.map.painter.context,ue=re.gl;p.texture=B.map.painter.getTileTexture(q.width),p.texture?p.texture.update(q,{useMipmap:!0}):(p.texture=new n.Texture(re,q,ue.RGBA,{useMipmap:!0}),p.texture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE,ue.LINEAR_MIPMAP_NEAREST),re.extTextureFilterAnisotropic&&ue.texParameterf(ue.TEXTURE_2D,re.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,re.extTextureFilterAnisotropicMax)),p.state="loaded",n.cacheEntryPossiblyAdded(B.dispatcher),b(null)}})},_.prototype.abortTile=function(p,b){p.request&&(p.request.cancel(),delete p.request),b()},_.prototype.unloadTile=function(p,b){p.texture&&this.map.painter.saveTileTexture(p.texture),b()},_.prototype.hasTransition=function(){return!1},_}(n.Evented),Yt=function(d){function _(p,b,B,k){d.call(this,p,b,B,k),this.type="raster-dem",this.maxzoom=22,this._options=n.extend({type:"raster-dem"},b),this.encoding=b.encoding||"mapbox"}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.serialize=function(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}},_.prototype.loadTile=function(p,b){var B=this.map._requestManager.normalizeTileURL(p.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);function k(V,q){V&&(p.state="errored",b(V)),q&&(p.dem=q,p.needsHillshadePrepare=!0,p.state="loaded",b(null))}p.request=n.getImage(this.map._requestManager.transformRequest(B,n.ResourceType.Tile),function(V,q){if(delete p.request,p.aborted)p.state="unloaded",b(null);else if(V)p.state="errored",b(V);else if(q){this.map._refreshExpiredTiles&&p.setExpiryData(q),delete q.cacheControl,delete q.expires;var re=n.window.ImageBitmap&&q instanceof n.window.ImageBitmap&&n.offscreenCanvasSupported()?q:n.browser.getImageData(q,1),ue={uid:p.uid,coord:p.tileID,source:this.id,rawImageData:re,encoding:this.encoding};p.actor&&p.state!=="expired"||(p.actor=this.dispatcher.getActor(),p.actor.send("loadDEMTile",ue,k.bind(this)))}}.bind(this)),p.neighboringTiles=this._getNeighboringTiles(p.tileID)},_.prototype._getNeighboringTiles=function(p){var b=p.canonical,B=Math.pow(2,b.z),k=(b.x-1+B)%B,V=b.x===0?p.wrap-1:p.wrap,q=(b.x+1+B)%B,re=b.x+1===B?p.wrap+1:p.wrap,ue={};return ue[new n.OverscaledTileID(p.overscaledZ,V,b.z,k,b.y).key]={backfilled:!1},ue[new n.OverscaledTileID(p.overscaledZ,re,b.z,q,b.y).key]={backfilled:!1},b.y>0&&(ue[new n.OverscaledTileID(p.overscaledZ,V,b.z,k,b.y-1).key]={backfilled:!1},ue[new n.OverscaledTileID(p.overscaledZ,p.wrap,b.z,b.x,b.y-1).key]={backfilled:!1},ue[new n.OverscaledTileID(p.overscaledZ,re,b.z,q,b.y-1).key]={backfilled:!1}),b.y+1<B&&(ue[new n.OverscaledTileID(p.overscaledZ,V,b.z,k,b.y+1).key]={backfilled:!1},ue[new n.OverscaledTileID(p.overscaledZ,p.wrap,b.z,b.x,b.y+1).key]={backfilled:!1},ue[new n.OverscaledTileID(p.overscaledZ,re,b.z,q,b.y+1).key]={backfilled:!1}),ue},_.prototype.unloadTile=function(p){p.demTexture&&this.map.painter.saveTileTexture(p.demTexture),p.fbo&&(p.fbo.destroy(),delete p.fbo),p.dem&&delete p.dem,delete p.neighboringTiles,p.state="unloaded",p.actor&&p.actor.send("removeDEMTile",{uid:p.uid,source:this.id})},_}(Vt),mr=function(d){function _(p,b,B,k){d.call(this),this.id=p,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._loaded=!1,this.actor=B.getActor(),this.setEventedParent(k),this._data=b.data,this._options=n.extend({},b),this._collectResourceTiming=b.collectResourceTiming,this._resourceTiming=[],b.maxzoom!==void 0&&(this.maxzoom=b.maxzoom),b.type&&(this.type=b.type),b.attribution&&(this.attribution=b.attribution),this.promoteId=b.promoteId;var V=n.EXTENT/this.tileSize;this.workerOptions=n.extend({source:this.id,cluster:b.cluster||!1,geojsonVtOptions:{buffer:(b.buffer!==void 0?b.buffer:128)*V,tolerance:(b.tolerance!==void 0?b.tolerance:.375)*V,extent:n.EXTENT,maxZoom:this.maxzoom,lineMetrics:b.lineMetrics||!1,generateId:b.generateId||!1},superclusterOptions:{maxZoom:b.clusterMaxZoom!==void 0?Math.min(b.clusterMaxZoom,this.maxzoom-1):this.maxzoom-1,minPoints:Math.max(2,b.clusterMinPoints||2),extent:n.EXTENT,radius:(b.clusterRadius||50)*V,log:!1,generateId:b.generateId||!1},clusterProperties:b.clusterProperties,filter:b.filter},b.workerOptions)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.load=function(){var p=this;this.fire(new n.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(b){if(b)p.fire(new n.ErrorEvent(b));else{var B={dataType:"source",sourceDataType:"metadata"};p._collectResourceTiming&&p._resourceTiming&&p._resourceTiming.length>0&&(B.resourceTiming=p._resourceTiming,p._resourceTiming=[]),p.fire(new n.Event("data",B))}})},_.prototype.onAdd=function(p){this.map=p,this.load()},_.prototype.setData=function(p){var b=this;return this._data=p,this.fire(new n.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(B){if(B)b.fire(new n.ErrorEvent(B));else{var k={dataType:"source",sourceDataType:"content"};b._collectResourceTiming&&b._resourceTiming&&b._resourceTiming.length>0&&(k.resourceTiming=b._resourceTiming,b._resourceTiming=[]),b.fire(new n.Event("data",k))}}),this},_.prototype.getClusterExpansionZoom=function(p,b){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:p,source:this.id},b),this},_.prototype.getClusterChildren=function(p,b){return this.actor.send("geojson.getClusterChildren",{clusterId:p,source:this.id},b),this},_.prototype.getClusterLeaves=function(p,b,B,k){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:p,limit:b,offset:B},k),this},_.prototype._updateWorkerData=function(p){var b=this;this._loaded=!1;var B=n.extend({},this.workerOptions),k=this._data;typeof k=="string"?(B.request=this.map._requestManager.transformRequest(n.browser.resolveURL(k),n.ResourceType.Source),B.request.collectResourceTiming=this._collectResourceTiming):B.data=JSON.stringify(k),this.actor.send(this.type+".loadData",B,function(V,q){b._removed||q&&q.abandoned||(b._loaded=!0,q&&q.resourceTiming&&q.resourceTiming[b.id]&&(b._resourceTiming=q.resourceTiming[b.id].slice(0)),b.actor.send(b.type+".coalesce",{source:B.source},null),p(V))})},_.prototype.loaded=function(){return this._loaded},_.prototype.loadTile=function(p,b){var B=this,k=p.actor?"reloadTile":"loadTile";p.actor=this.actor,p.request=this.actor.send(k,{type:this.type,uid:p.uid,tileID:p.tileID,zoom:p.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:n.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},function(V,q){return delete p.request,p.unloadVectorData(),p.aborted?b(null):V?b(V):(p.loadVectorData(q,B.map.painter,k==="reloadTile"),b(null))})},_.prototype.abortTile=function(p){p.request&&(p.request.cancel(),delete p.request),p.aborted=!0},_.prototype.unloadTile=function(p){p.unloadVectorData(),this.actor.send("removeTile",{uid:p.uid,type:this.type,source:this.id})},_.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},_.prototype.serialize=function(){return n.extend({},this._options,{type:this.type,data:this._data})},_.prototype.hasTransition=function(){return!1},_}(n.Evented),Er=n.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),Jr=function(d){function _(p,b,B,k){d.call(this),this.id=p,this.dispatcher=B,this.coordinates=b.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(k),this.options=b}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.load=function(p,b){var B=this;this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this.url=this.options.url,n.getImage(this.map._requestManager.transformRequest(this.url,n.ResourceType.Image),function(k,V){B._loaded=!0,k?B.fire(new n.ErrorEvent(k)):V&&(B.image=V,p&&(B.coordinates=p),b&&b(),B._finishLoading())})},_.prototype.loaded=function(){return this._loaded},_.prototype.updateImage=function(p){var b=this;return this.image&&p.url?(this.options.url=p.url,this.load(p.coordinates,function(){b.texture=null}),this):this},_.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})))},_.prototype.onAdd=function(p){this.map=p,this.load()},_.prototype.setCoordinates=function(p){var b=this;this.coordinates=p;var B=p.map(n.MercatorCoordinate.fromLngLat);this.tileID=function(V){for(var q=1/0,re=1/0,ue=-1/0,Ee=-1/0,Ce=0,Me=V;Ce<Me.length;Ce+=1){var He=Me[Ce];q=Math.min(q,He.x),re=Math.min(re,He.y),ue=Math.max(ue,He.x),Ee=Math.max(Ee,He.y)}var Ue=Math.max(ue-q,Ee-re),Ze=Math.max(0,Math.floor(-Math.log(Ue)/Math.LN2)),Ne=Math.pow(2,Ze);return new n.CanonicalTileID(Ze,Math.floor((q+ue)/2*Ne),Math.floor((re+Ee)/2*Ne))}(B),this.minzoom=this.maxzoom=this.tileID.z;var k=B.map(function(V){return b.tileID.getTilePoint(V)._round()});return this._boundsArray=new n.StructArrayLayout4i8,this._boundsArray.emplaceBack(k[0].x,k[0].y,0,0),this._boundsArray.emplaceBack(k[1].x,k[1].y,n.EXTENT,0),this._boundsArray.emplaceBack(k[3].x,k[3].y,0,n.EXTENT),this._boundsArray.emplaceBack(k[2].x,k[2].y,n.EXTENT,n.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})),this},_.prototype.prepare=function(){if(Object.keys(this.tiles).length!==0&&this.image){var p=this.map.painter.context,b=p.gl;for(var B in this.boundsBuffer||(this.boundsBuffer=p.createVertexBuffer(this._boundsArray,Er.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new n.Texture(p,this.image,b.RGBA),this.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE)),this.tiles){var k=this.tiles[B];k.state!=="loaded"&&(k.state="loaded",k.texture=this.texture)}}},_.prototype.loadTile=function(p,b){this.tileID&&this.tileID.equals(p.tileID.canonical)?(this.tiles[String(p.tileID.wrap)]=p,p.buckets={},b(null)):(p.state="errored",b(null))},_.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},_.prototype.hasTransition=function(){return!1},_}(n.Evented),or=function(d){function _(p,b,B,k){d.call(this,p,b,B,k),this.roundZoom=!0,this.type="video",this.options=b}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.load=function(){var p=this;this._loaded=!1;var b=this.options;this.urls=[];for(var B=0,k=b.urls;B<k.length;B+=1)this.urls.push(this.map._requestManager.transformRequest(k[B],n.ResourceType.Source).url);n.getVideo(this.urls,function(V,q){p._loaded=!0,V?p.fire(new n.ErrorEvent(V)):q&&(p.video=q,p.video.loop=!0,p.video.setAttribute("playsinline",""),p.video.addEventListener("playing",function(){p.map.triggerRepaint()}),p.map&&p.video.play(),p._finishLoading())})},_.prototype.pause=function(){this.video&&this.video.pause()},_.prototype.play=function(){this.video&&this.video.play()},_.prototype.seek=function(p){if(this.video){var b=this.video.seekable;p<b.start(0)||p>b.end(0)?this.fire(new n.ErrorEvent(new n.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+b.start(0)+" and "+b.end(0)+"-second mark."))):this.video.currentTime=p}},_.prototype.getVideo=function(){return this.video},_.prototype.onAdd=function(p){this.map||(this.map=p,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},_.prototype.prepare=function(){if(!(Object.keys(this.tiles).length===0||this.video.readyState<2)){var p=this.map.painter.context,b=p.gl;for(var B in this.boundsBuffer||(this.boundsBuffer=p.createVertexBuffer(this._boundsArray,Er.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE),b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,this.video)):(this.texture=new n.Texture(p,this.video,b.RGBA),this.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE)),this.tiles){var k=this.tiles[B];k.state!=="loaded"&&(k.state="loaded",k.texture=this.texture)}}},_.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},_.prototype.hasTransition=function(){return this.video&&!this.video.paused},_}(Jr),ai=function(d){function _(p,b,B,k){d.call(this,p,b,B,k),b.coordinates?Array.isArray(b.coordinates)&&b.coordinates.length===4&&!b.coordinates.some(function(V){return!Array.isArray(V)||V.length!==2||V.some(function(q){return typeof q!="number"})})||this.fire(new n.ErrorEvent(new n.ValidationError("sources."+p,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new n.ErrorEvent(new n.ValidationError("sources."+p,null,'missing required property "coordinates"'))),b.animate&&typeof b.animate!="boolean"&&this.fire(new n.ErrorEvent(new n.ValidationError("sources."+p,null,'optional "animate" property must be a boolean value'))),b.canvas?typeof b.canvas=="string"||b.canvas instanceof n.window.HTMLCanvasElement||this.fire(new n.ErrorEvent(new n.ValidationError("sources."+p,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 n.ErrorEvent(new n.ValidationError("sources."+p,null,'missing required property "canvas"'))),this.options=b,this.animate=b.animate===void 0||b.animate}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof n.window.HTMLCanvasElement?this.options.canvas:n.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new n.ErrorEvent(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())},_.prototype.getCanvas=function(){return this.canvas},_.prototype.onAdd=function(p){this.map=p,this.load(),this.canvas&&this.animate&&this.play()},_.prototype.onRemove=function(){this.pause()},_.prototype.prepare=function(){var p=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,p=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,p=!0),!this._hasInvalidDimensions()&&Object.keys(this.tiles).length!==0){var b=this.map.painter.context,B=b.gl;for(var k in this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,Er.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(p||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new n.Texture(b,this.canvas,B.RGBA,{premultiply:!0}),this.tiles){var V=this.tiles[k];V.state!=="loaded"&&(V.state="loaded",V.texture=this.texture)}}},_.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},_.prototype.hasTransition=function(){return this._playing},_.prototype._hasInvalidDimensions=function(){for(var p=0,b=[this.canvas.width,this.canvas.height];p<b.length;p+=1){var B=b[p];if(isNaN(B)||B<=0)return!0}return!1},_}(Jr),Jt={vector:ft,raster:Vt,"raster-dem":Yt,geojson:mr,video:or,image:Jr,canvas:ai};function qt(d,_){var p=n.identity([]);return n.translate(p,p,[1,1,0]),n.scale(p,p,[.5*d.width,.5*d.height,1]),n.multiply(p,p,d.calculatePosMatrix(_.toUnwrapped()))}function wi(d,_,p,b,B,k){var V=function(Ze,Ne,Ke){if(Ze)for(var it=0,pt=Ze;it<pt.length;it+=1){var Ct=Ne[pt[it]];if(Ct&&Ct.source===Ke&&Ct.type==="fill-extrusion")return!0}else for(var xt in Ne){var Rt=Ne[xt];if(Rt.source===Ke&&Rt.type==="fill-extrusion")return!0}return!1}(B&&B.layers,_,d.id),q=k.maxPitchScaleFactor(),re=d.tilesIn(b,q,V);re.sort(ae);for(var ue=[],Ee=0,Ce=re;Ee<Ce.length;Ee+=1){var Me=Ce[Ee];ue.push({wrappedTileID:Me.tileID.wrapped().key,queryResults:Me.tile.queryRenderedFeatures(_,p,d._state,Me.queryGeometry,Me.cameraQueryGeometry,Me.scale,B,k,q,qt(d.transform,Me.tileID))})}var He=function(Ze){for(var Ne={},Ke={},it=0,pt=Ze;it<pt.length;it+=1){var Ct=pt[it],xt=Ct.queryResults,Rt=Ct.wrappedTileID,Wt=Ke[Rt]=Ke[Rt]||{};for(var ar in xt)for(var ir=xt[ar],Ir=Wt[ar]=Wt[ar]||{},ti=Ne[ar]=Ne[ar]||[],oi=0,ii=ir;oi<ii.length;oi+=1){var hn=ii[oi];Ir[hn.featureIndex]||(Ir[hn.featureIndex]=!0,ti.push(hn))}}return Ne}(ue);for(var Ue in He)He[Ue].forEach(function(Ze){var Ne=Ze.feature,Ke=d.getFeatureState(Ne.layer["source-layer"],Ne.id);Ne.source=Ne.layer.source,Ne.layer["source-layer"]&&(Ne.sourceLayer=Ne.layer["source-layer"]),Ne.state=Ke});return He}function ae(d,_){var p=d.tileID,b=_.tileID;return p.overscaledZ-b.overscaledZ||p.canonical.y-b.canonical.y||p.wrap-b.wrap||p.canonical.x-b.canonical.x}var be=function(d,_){this.max=d,this.onRemove=_,this.reset()};be.prototype.reset=function(){for(var d in this.data)for(var _=0,p=this.data[d];_<p.length;_+=1){var b=p[_];b.timeout&&clearTimeout(b.timeout),this.onRemove(b.value)}return this.data={},this.order=[],this},be.prototype.add=function(d,_,p){var b=this,B=d.wrapped().key;this.data[B]===void 0&&(this.data[B]=[]);var k={value:_,timeout:void 0};if(p!==void 0&&(k.timeout=setTimeout(function(){b.remove(d,k)},p)),this.data[B].push(k),this.order.push(B),this.order.length>this.max){var V=this._getAndRemoveByKey(this.order[0]);V&&this.onRemove(V)}return this},be.prototype.has=function(d){return d.wrapped().key in this.data},be.prototype.getAndRemove=function(d){return this.has(d)?this._getAndRemoveByKey(d.wrapped().key):null},be.prototype._getAndRemoveByKey=function(d){var _=this.data[d].shift();return _.timeout&&clearTimeout(_.timeout),this.data[d].length===0&&delete this.data[d],this.order.splice(this.order.indexOf(d),1),_.value},be.prototype.getByKey=function(d){var _=this.data[d];return _?_[0].value:null},be.prototype.get=function(d){return this.has(d)?this.data[d.wrapped().key][0].value:null},be.prototype.remove=function(d,_){if(!this.has(d))return this;var p=d.wrapped().key,b=_===void 0?0:this.data[p].indexOf(_),B=this.data[p][b];return this.data[p].splice(b,1),B.timeout&&clearTimeout(B.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(B.value),this.order.splice(this.order.indexOf(p),1),this},be.prototype.setMaxSize=function(d){for(this.max=d;this.order.length>this.max;){var _=this._getAndRemoveByKey(this.order[0]);_&&this.onRemove(_)}return this},be.prototype.filter=function(d){var _=[];for(var p in this.data)for(var b=0,B=this.data[p];b<B.length;b+=1){var k=B[b];d(k.value)||_.push(k)}for(var V=0,q=_;V<q.length;V+=1){var re=q[V];this.remove(re.value.tileID,re)}};var je=function(d,_,p){this.context=d;var b=d.gl;this.buffer=b.createBuffer(),this.dynamicDraw=Boolean(p),this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),b.bufferData(b.ELEMENT_ARRAY_BUFFER,_.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete _.arrayBuffer};je.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},je.prototype.updateData=function(d){var _=this.context.gl;this.context.unbindVAO(),this.bind(),_.bufferSubData(_.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)},je.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var lt={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Ft=function(d,_,p,b){this.length=_.length,this.attributes=p,this.itemSize=_.bytesPerElement,this.dynamicDraw=b,this.context=d;var B=d.gl;this.buffer=B.createBuffer(),d.bindVertexBuffer.set(this.buffer),B.bufferData(B.ARRAY_BUFFER,_.arrayBuffer,this.dynamicDraw?B.DYNAMIC_DRAW:B.STATIC_DRAW),this.dynamicDraw||delete _.arrayBuffer};Ft.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},Ft.prototype.updateData=function(d){var _=this.context.gl;this.bind(),_.bufferSubData(_.ARRAY_BUFFER,0,d.arrayBuffer)},Ft.prototype.enableAttributes=function(d,_){for(var p=0;p<this.attributes.length;p++){var b=_.attributes[this.attributes[p].name];b!==void 0&&d.enableVertexAttribArray(b)}},Ft.prototype.setVertexAttribPointers=function(d,_,p){for(var b=0;b<this.attributes.length;b++){var B=this.attributes[b],k=_.attributes[B.name];k!==void 0&&d.vertexAttribPointer(k,B.components,d[lt[B.type]],!1,this.itemSize,B.offset+this.itemSize*(p||0))}},Ft.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var wt=function(d){this.gl=d.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};wt.prototype.get=function(){return this.current},wt.prototype.set=function(d){},wt.prototype.getDefault=function(){return this.default},wt.prototype.setDefault=function(){this.set(this.default)};var $r=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return n.Color.transparent},_.prototype.set=function(p){var b=this.current;(p.r!==b.r||p.g!==b.g||p.b!==b.b||p.a!==b.a||this.dirty)&&(this.gl.clearColor(p.r,p.g,p.b,p.a),this.current=p,this.dirty=!1)},_}(wt),xi=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return 1},_.prototype.set=function(p){(p!==this.current||this.dirty)&&(this.gl.clearDepth(p),this.current=p,this.dirty=!1)},_}(wt),Ki=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return 0},_.prototype.set=function(p){(p!==this.current||this.dirty)&&(this.gl.clearStencil(p),this.current=p,this.dirty=!1)},_}(wt),kn=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return[!0,!0,!0,!0]},_.prototype.set=function(p){var b=this.current;(p[0]!==b[0]||p[1]!==b[1]||p[2]!==b[2]||p[3]!==b[3]||this.dirty)&&(this.gl.colorMask(p[0],p[1],p[2],p[3]),this.current=p,this.dirty=!1)},_}(wt),Zi=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return!0},_.prototype.set=function(p){(p!==this.current||this.dirty)&&(this.gl.depthMask(p),this.current=p,this.dirty=!1)},_}(wt),Hi=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return 255},_.prototype.set=function(p){(p!==this.current||this.dirty)&&(this.gl.stencilMask(p),this.current=p,this.dirty=!1)},_}(wt),Un=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return{func:this.gl.ALWAYS,ref:0,mask:255}},_.prototype.set=function(p){var b=this.current;(p.func!==b.func||p.ref!==b.ref||p.mask!==b.mask||this.dirty)&&(this.gl.stencilFunc(p.func,p.ref,p.mask),this.current=p,this.dirty=!1)},_}(wt),No=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){var p=this.gl;return[p.KEEP,p.KEEP,p.KEEP]},_.prototype.set=function(p){var b=this.current;(p[0]!==b[0]||p[1]!==b[1]||p[2]!==b[2]||this.dirty)&&(this.gl.stencilOp(p[0],p[1],p[2]),this.current=p,this.dirty=!1)},_}(wt),Ji=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return!1},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;p?b.enable(b.STENCIL_TEST):b.disable(b.STENCIL_TEST),this.current=p,this.dirty=!1}},_}(wt),Bi=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return[0,1]},_.prototype.set=function(p){var b=this.current;(p[0]!==b[0]||p[1]!==b[1]||this.dirty)&&(this.gl.depthRange(p[0],p[1]),this.current=p,this.dirty=!1)},_}(wt),yn=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return!1},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;p?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST),this.current=p,this.dirty=!1}},_}(wt),po=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return this.gl.LESS},_.prototype.set=function(p){(p!==this.current||this.dirty)&&(this.gl.depthFunc(p),this.current=p,this.dirty=!1)},_}(wt),kr=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return!1},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;p?b.enable(b.BLEND):b.disable(b.BLEND),this.current=p,this.dirty=!1}},_}(wt),dr=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){var p=this.gl;return[p.ONE,p.ZERO]},_.prototype.set=function(p){var b=this.current;(p[0]!==b[0]||p[1]!==b[1]||this.dirty)&&(this.gl.blendFunc(p[0],p[1]),this.current=p,this.dirty=!1)},_}(wt),Ur=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return n.Color.transparent},_.prototype.set=function(p){var b=this.current;(p.r!==b.r||p.g!==b.g||p.b!==b.b||p.a!==b.a||this.dirty)&&(this.gl.blendColor(p.r,p.g,p.b,p.a),this.current=p,this.dirty=!1)},_}(wt),ci=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return this.gl.FUNC_ADD},_.prototype.set=function(p){(p!==this.current||this.dirty)&&(this.gl.blendEquation(p),this.current=p,this.dirty=!1)},_}(wt),to=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return!1},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;p?b.enable(b.CULL_FACE):b.disable(b.CULL_FACE),this.current=p,this.dirty=!1}},_}(wt),Dn=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return this.gl.BACK},_.prototype.set=function(p){(p!==this.current||this.dirty)&&(this.gl.cullFace(p),this.current=p,this.dirty=!1)},_}(wt),To=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return this.gl.CCW},_.prototype.set=function(p){(p!==this.current||this.dirty)&&(this.gl.frontFace(p),this.current=p,this.dirty=!1)},_}(wt),Eo=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return null},_.prototype.set=function(p){(p!==this.current||this.dirty)&&(this.gl.useProgram(p),this.current=p,this.dirty=!1)},_}(wt),Xo=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return this.gl.TEXTURE0},_.prototype.set=function(p){(p!==this.current||this.dirty)&&(this.gl.activeTexture(p),this.current=p,this.dirty=!1)},_}(wt),So=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){var p=this.gl;return[0,0,p.drawingBufferWidth,p.drawingBufferHeight]},_.prototype.set=function(p){var b=this.current;(p[0]!==b[0]||p[1]!==b[1]||p[2]!==b[2]||p[3]!==b[3]||this.dirty)&&(this.gl.viewport(p[0],p[1],p[2],p[3]),this.current=p,this.dirty=!1)},_}(wt),Us=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return null},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;b.bindFramebuffer(b.FRAMEBUFFER,p),this.current=p,this.dirty=!1}},_}(wt),Fc=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return null},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;b.bindRenderbuffer(b.RENDERBUFFER,p),this.current=p,this.dirty=!1}},_}(wt),ql=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return null},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;b.bindTexture(b.TEXTURE_2D,p),this.current=p,this.dirty=!1}},_}(wt),sl=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return null},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;b.bindBuffer(b.ARRAY_BUFFER,p),this.current=p,this.dirty=!1}},_}(wt),Cl=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return null},_.prototype.set=function(p){var b=this.gl;b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p),this.current=p,this.dirty=!1},_}(wt),al=function(d){function _(p){d.call(this,p),this.vao=p.extVertexArrayObject}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return null},_.prototype.set=function(p){this.vao&&(p!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(p),this.current=p,this.dirty=!1)},_}(wt),Ms=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return 4},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;b.pixelStorei(b.UNPACK_ALIGNMENT,p),this.current=p,this.dirty=!1}},_}(wt),ca=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return!1},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p),this.current=p,this.dirty=!1}},_}(wt),Ml=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return!1},_.prototype.set=function(p){if(p!==this.current||this.dirty){var b=this.gl;b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,p),this.current=p,this.dirty=!1}},_}(wt),ao=function(d){function _(p,b){d.call(this,p),this.context=p,this.parent=b}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getDefault=function(){return null},_}(wt),oe=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.setDirty=function(){this.dirty=!0},_.prototype.set=function(p){if(p!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var b=this.gl;b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,p,0),this.current=p,this.dirty=!1}},_}(ao),de=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.set=function(p){if(p!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var b=this.gl;b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,p),this.current=p,this.dirty=!1}},_}(ao),ve=function(d,_,p,b){this.context=d,this.width=_,this.height=p;var B=this.framebuffer=d.gl.createFramebuffer();this.colorAttachment=new oe(d,B),b&&(this.depthAttachment=new de(d,B))};ve.prototype.destroy=function(){var d=this.context.gl,_=this.colorAttachment.get();if(_&&d.deleteTexture(_),this.depthAttachment){var p=this.depthAttachment.get();p&&d.deleteRenderbuffer(p)}d.deleteFramebuffer(this.framebuffer)};var Pe=function(d,_,p){this.func=d,this.mask=_,this.range=p};Pe.ReadOnly=!1,Pe.ReadWrite=!0,Pe.disabled=new Pe(519,Pe.ReadOnly,[0,1]);var ye=function(d,_,p,b,B,k){this.test=d,this.ref=_,this.mask=p,this.fail=b,this.depthFail=B,this.pass=k};ye.disabled=new ye({func:519,mask:0},0,0,7680,7680,7680);var tt=function(d,_,p){this.blendFunction=d,this.blendColor=_,this.mask=p};tt.disabled=new tt(tt.Replace=[1,0],n.Color.transparent,[!1,!1,!1,!1]),tt.unblended=new tt(tt.Replace,n.Color.transparent,[!0,!0,!0,!0]),tt.alphaBlended=new tt([1,771],n.Color.transparent,[!0,!0,!0,!0]);var rt=function(d,_,p){this.enable=d,this.mode=_,this.frontFace=p};rt.disabled=new rt(!1,1029,2305),rt.backCCW=new rt(!0,1029,2305);var Se=function(d){this.gl=d,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new $r(this),this.clearDepth=new xi(this),this.clearStencil=new Ki(this),this.colorMask=new kn(this),this.depthMask=new Zi(this),this.stencilMask=new Hi(this),this.stencilFunc=new Un(this),this.stencilOp=new No(this),this.stencilTest=new Ji(this),this.depthRange=new Bi(this),this.depthTest=new yn(this),this.depthFunc=new po(this),this.blend=new kr(this),this.blendFunc=new dr(this),this.blendColor=new Ur(this),this.blendEquation=new ci(this),this.cullFace=new to(this),this.cullFaceSide=new Dn(this),this.frontFace=new To(this),this.program=new Eo(this),this.activeTexture=new Xo(this),this.viewport=new So(this),this.bindFramebuffer=new Us(this),this.bindRenderbuffer=new Fc(this),this.bindTexture=new ql(this),this.bindVertexBuffer=new sl(this),this.bindElementBuffer=new Cl(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new al(this),this.pixelStoreUnpack=new Ms(this),this.pixelStoreUnpackPremultiplyAlpha=new ca(this),this.pixelStoreUnpackFlipY=new Ml(this),this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=d.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(d.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=d.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=d.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE)};Se.prototype.setDefault=function(){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()},Se.prototype.setDirty=function(){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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0},Se.prototype.createIndexBuffer=function(d,_){return new je(this,d,_)},Se.prototype.createVertexBuffer=function(d,_,p){return new Ft(this,d,_,p)},Se.prototype.createRenderbuffer=function(d,_,p){var b=this.gl,B=b.createRenderbuffer();return this.bindRenderbuffer.set(B),b.renderbufferStorage(b.RENDERBUFFER,d,_,p),this.bindRenderbuffer.set(null),B},Se.prototype.createFramebuffer=function(d,_,p){return new ve(this,d,_,p)},Se.prototype.clear=function(d){var _=d.color,p=d.depth,b=this.gl,B=0;_&&(B|=b.COLOR_BUFFER_BIT,this.clearColor.set(_),this.colorMask.set([!0,!0,!0,!0])),p!==void 0&&(B|=b.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(p),this.depthMask.set(!0)),b.clear(B)},Se.prototype.setCullFace=function(d){d.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(d.mode),this.frontFace.set(d.frontFace))},Se.prototype.setDepthMode=function(d){d.func!==this.gl.ALWAYS||d.mask?(this.depthTest.set(!0),this.depthFunc.set(d.func),this.depthMask.set(d.mask),this.depthRange.set(d.range)):this.depthTest.set(!1)},Se.prototype.setStencilMode=function(d){d.test.func!==this.gl.ALWAYS||d.mask?(this.stencilTest.set(!0),this.stencilMask.set(d.mask),this.stencilOp.set([d.fail,d.depthFail,d.pass]),this.stencilFunc.set({func:d.test.func,ref:d.ref,mask:d.test.mask})):this.stencilTest.set(!1)},Se.prototype.setColorMode=function(d){n.deepEqual(d.blendFunction,tt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(d.blendFunction),this.blendColor.set(d.blendColor)),this.colorMask.set(d.mask)},Se.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var Ge=function(d){function _(p,b,B){var k=this;d.call(this),this.id=p,this.dispatcher=B,this.on("data",function(V){V.dataType==="source"&&V.sourceDataType==="metadata"&&(k._sourceLoaded=!0),k._sourceLoaded&&!k._paused&&V.dataType==="source"&&V.sourceDataType==="content"&&(k.reload(),k.transform&&k.update(k.transform))}),this.on("error",function(){k._sourceErrored=!0}),this._source=function(V,q,re,ue){var Ee=new Jt[q.type](V,q,re,ue);if(Ee.id!==V)throw new Error("Expected Source id to be "+V+" instead of "+Ee.id);return n.bindAll(["load","abort","unload","serialize","prepare"],Ee),Ee}(p,b,B,this),this._tiles={},this._cache=new be(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new n.SourceFeatureState}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.onAdd=function(p){this.map=p,this._maxTileCacheSize=p?p._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(p)},_.prototype.onRemove=function(p){this._source&&this._source.onRemove&&this._source.onRemove(p)},_.prototype.loaded=function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(var p in this._tiles){var b=this._tiles[p];if(b.state!=="loaded"&&b.state!=="errored")return!1}return!0},_.prototype.getSource=function(){return this._source},_.prototype.pause=function(){this._paused=!0},_.prototype.resume=function(){if(this._paused){var p=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,p&&this.reload(),this.transform&&this.update(this.transform)}},_.prototype._loadTile=function(p,b){return this._source.loadTile(p,b)},_.prototype._unloadTile=function(p){if(this._source.unloadTile)return this._source.unloadTile(p,function(){})},_.prototype._abortTile=function(p){if(this._source.abortTile)return this._source.abortTile(p,function(){})},_.prototype.serialize=function(){return this._source.serialize()},_.prototype.prepare=function(p){for(var b in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){var B=this._tiles[b];B.upload(p),B.prepare(this.map.style.imageManager)}},_.prototype.getIds=function(){return n.values(this._tiles).map(function(p){return p.tileID}).sort(ht).map(function(p){return p.key})},_.prototype.getRenderableIds=function(p){var b=this,B=[];for(var k in this._tiles)this._isIdRenderable(k,p)&&B.push(this._tiles[k]);return p?B.sort(function(V,q){var re=V.tileID,ue=q.tileID,Ee=new n.Point(re.canonical.x,re.canonical.y)._rotate(b.transform.angle),Ce=new n.Point(ue.canonical.x,ue.canonical.y)._rotate(b.transform.angle);return re.overscaledZ-ue.overscaledZ||Ce.y-Ee.y||Ce.x-Ee.x}).map(function(V){return V.tileID.key}):B.map(function(V){return V.tileID}).sort(ht).map(function(V){return V.key})},_.prototype.hasRenderableParent=function(p){var b=this.findLoadedParent(p,0);return!!b&&this._isIdRenderable(b.tileID.key)},_.prototype._isIdRenderable=function(p,b){return this._tiles[p]&&this._tiles[p].hasData()&&!this._coveredTiles[p]&&(b||!this._tiles[p].holdingForFade())},_.prototype.reload=function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var p in this._cache.reset(),this._tiles)this._tiles[p].state!=="errored"&&this._reloadTile(p,"reloading")},_.prototype._reloadTile=function(p,b){var B=this._tiles[p];B&&(B.state!=="loading"&&(B.state=b),this._loadTile(B,this._tileLoaded.bind(this,B,p,b)))},_.prototype._tileLoaded=function(p,b,B,k){if(k)return p.state="errored",void(k.status!==404?this._source.fire(new n.ErrorEvent(k,{tile:p})):this.update(this.transform));p.timeAdded=n.browser.now(),B==="expired"&&(p.refreshedUponExpiration=!0),this._setTileReloadTimer(b,p),this.getSource().type==="raster-dem"&&p.dem&&this._backfillDEM(p),this._state.initializeTileState(p,this.map?this.map.painter:null),this._source.fire(new n.Event("data",{dataType:"source",tile:p,coord:p.tileID}))},_.prototype._backfillDEM=function(p){for(var b=this.getRenderableIds(),B=0;B<b.length;B++){var k=b[B];if(p.neighboringTiles&&p.neighboringTiles[k]){var V=this.getTileByID(k);q(p,V),q(V,p)}}function q(re,ue){re.needsHillshadePrepare=!0;var Ee=ue.tileID.canonical.x-re.tileID.canonical.x,Ce=ue.tileID.canonical.y-re.tileID.canonical.y,Me=Math.pow(2,re.tileID.canonical.z),He=ue.tileID.key;Ee===0&&Ce===0||Math.abs(Ce)>1||(Math.abs(Ee)>1&&(Math.abs(Ee+Me)===1?Ee+=Me:Math.abs(Ee-Me)===1&&(Ee-=Me)),ue.dem&&re.dem&&(re.dem.backfillBorder(ue.dem,Ee,Ce),re.neighboringTiles&&re.neighboringTiles[He]&&(re.neighboringTiles[He].backfilled=!0)))}},_.prototype.getTile=function(p){return this.getTileByID(p.key)},_.prototype.getTileByID=function(p){return this._tiles[p]},_.prototype._retainLoadedChildren=function(p,b,B,k){for(var V in this._tiles){var q=this._tiles[V];if(!(k[V]||!q.hasData()||q.tileID.overscaledZ<=b||q.tileID.overscaledZ>B)){for(var re=q.tileID;q&&q.tileID.overscaledZ>b+1;){var ue=q.tileID.scaledTo(q.tileID.overscaledZ-1);(q=this._tiles[ue.key])&&q.hasData()&&(re=ue)}for(var Ee=re;Ee.overscaledZ>b;)if(p[(Ee=Ee.scaledTo(Ee.overscaledZ-1)).key]){k[re.key]=re;break}}}},_.prototype.findLoadedParent=function(p,b){if(p.key in this._loadedParentTiles){var B=this._loadedParentTiles[p.key];return B&&B.tileID.overscaledZ>=b?B:null}for(var k=p.overscaledZ-1;k>=b;k--){var V=p.scaledTo(k),q=this._getLoadedTile(V);if(q)return q}},_.prototype._getLoadedTile=function(p){var b=this._tiles[p.key];return b&&b.hasData()?b:this._cache.getByKey(p.wrapped().key)},_.prototype.updateCacheSize=function(p){var b=Math.ceil(p.width/this._source.tileSize)+1,B=Math.ceil(p.height/this._source.tileSize)+1,k=Math.floor(b*B*5),V=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,k):k;this._cache.setMaxSize(V)},_.prototype.handleWrapJump=function(p){var b=Math.round((p-(this._prevLng===void 0?p:this._prevLng))/360);if(this._prevLng=p,b){var B={};for(var k in this._tiles){var V=this._tiles[k];V.tileID=V.tileID.unwrapTo(V.tileID.wrap+b),B[V.tileID.key]=V}for(var q in this._tiles=B,this._timers)clearTimeout(this._timers[q]),delete this._timers[q];for(var re in this._tiles)this._setTileReloadTimer(re,this._tiles[re])}},_.prototype.update=function(p){var b=this;if(this.transform=p,this._sourceLoaded&&!this._paused){var B;this.updateCacheSize(p),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?B=p.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(Wt){return new n.OverscaledTileID(Wt.canonical.z,Wt.wrap,Wt.canonical.z,Wt.canonical.x,Wt.canonical.y)}):(B=p.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(B=B.filter(function(Wt){return b._source.hasTile(Wt)}))):B=[];var k=p.coveringZoomLevel(this._source),V=Math.max(k-_.maxOverzooming,this._source.minzoom),q=Math.max(k+_.maxUnderzooming,this._source.minzoom),re=this._updateRetainedTiles(B,k);if(Ht(this._source.type)){for(var ue={},Ee={},Ce=0,Me=Object.keys(re);Ce<Me.length;Ce+=1){var He=Me[Ce],Ue=re[He],Ze=this._tiles[He];if(Ze&&!(Ze.fadeEndTime&&Ze.fadeEndTime<=n.browser.now())){var Ne=this.findLoadedParent(Ue,V);Ne&&(this._addTile(Ne.tileID),ue[Ne.tileID.key]=Ne.tileID),Ee[He]=Ue}}for(var Ke in this._retainLoadedChildren(Ee,k,q,re),ue)re[Ke]||(this._coveredTiles[Ke]=!0,re[Ke]=ue[Ke])}for(var it in re)this._tiles[it].clearFadeHold();for(var pt=0,Ct=n.keysDifference(this._tiles,re);pt<Ct.length;pt+=1){var xt=Ct[pt],Rt=this._tiles[xt];Rt.hasSymbolBuckets&&!Rt.holdingForFade()?Rt.setHoldDuration(this.map._fadeDuration):Rt.hasSymbolBuckets&&!Rt.symbolFadeFinished()||this._removeTile(xt)}this._updateLoadedParentTileCache()}},_.prototype.releaseSymbolFadeTiles=function(){for(var p in this._tiles)this._tiles[p].holdingForFade()&&this._removeTile(p)},_.prototype._updateRetainedTiles=function(p,b){for(var B={},k={},V=Math.max(b-_.maxOverzooming,this._source.minzoom),q=Math.max(b+_.maxUnderzooming,this._source.minzoom),re={},ue=0,Ee=p;ue<Ee.length;ue+=1){var Ce=Ee[ue],Me=this._addTile(Ce);B[Ce.key]=Ce,Me.hasData()||b<this._source.maxzoom&&(re[Ce.key]=Ce)}this._retainLoadedChildren(re,b,q,B);for(var He=0,Ue=p;He<Ue.length;He+=1){var Ze=Ue[He],Ne=this._tiles[Ze.key];if(!Ne.hasData()){if(b+1>this._source.maxzoom){var Ke=Ze.children(this._source.maxzoom)[0],it=this.getTile(Ke);if(it&&it.hasData()){B[Ke.key]=Ke;continue}}else{var pt=Ze.children(this._source.maxzoom);if(B[pt[0].key]&&B[pt[1].key]&&B[pt[2].key]&&B[pt[3].key])continue}for(var Ct=Ne.wasRequested(),xt=Ze.overscaledZ-1;xt>=V;--xt){var Rt=Ze.scaledTo(xt);if(k[Rt.key]||(k[Rt.key]=!0,!(Ne=this.getTile(Rt))&&Ct&&(Ne=this._addTile(Rt)),Ne&&(B[Rt.key]=Rt,Ct=Ne.wasRequested(),Ne.hasData())))break}}}return B},_.prototype._updateLoadedParentTileCache=function(){for(var p in this._loadedParentTiles={},this._tiles){for(var b=[],B=void 0,k=this._tiles[p].tileID;k.overscaledZ>0;){if(k.key in this._loadedParentTiles){B=this._loadedParentTiles[k.key];break}b.push(k.key);var V=k.scaledTo(k.overscaledZ-1);if(B=this._getLoadedTile(V))break;k=V}for(var q=0,re=b;q<re.length;q+=1)this._loadedParentTiles[re[q]]=B}},_.prototype._addTile=function(p){var b=this._tiles[p.key];if(b)return b;(b=this._cache.getAndRemove(p))&&(this._setTileReloadTimer(p.key,b),b.tileID=p,this._state.initializeTileState(b,this.map?this.map.painter:null),this._cacheTimers[p.key]&&(clearTimeout(this._cacheTimers[p.key]),delete this._cacheTimers[p.key],this._setTileReloadTimer(p.key,b)));var B=Boolean(b);return B||(b=new n.Tile(p,this._source.tileSize*p.overscaleFactor()),this._loadTile(b,this._tileLoaded.bind(this,b,p.key,b.state))),b?(b.uses++,this._tiles[p.key]=b,B||this._source.fire(new n.Event("dataloading",{tile:b,coord:b.tileID,dataType:"source"})),b):null},_.prototype._setTileReloadTimer=function(p,b){var B=this;p in this._timers&&(clearTimeout(this._timers[p]),delete this._timers[p]);var k=b.getExpiryTimeout();k&&(this._timers[p]=setTimeout(function(){B._reloadTile(p,"expired"),delete B._timers[p]},k))},_.prototype._removeTile=function(p){var b=this._tiles[p];b&&(b.uses--,delete this._tiles[p],this._timers[p]&&(clearTimeout(this._timers[p]),delete this._timers[p]),b.uses>0||(b.hasData()&&b.state!=="reloading"?this._cache.add(b.tileID,b,b.getExpiryTimeout()):(b.aborted=!0,this._abortTile(b),this._unloadTile(b))))},_.prototype.clearTiles=function(){for(var p in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(p);this._cache.reset()},_.prototype.tilesIn=function(p,b,B){var k=this,V=[],q=this.transform;if(!q)return V;for(var re=B?q.getCameraQueryGeometry(p):p,ue=p.map(function(xt){return q.pointCoordinate(xt)}),Ee=re.map(function(xt){return q.pointCoordinate(xt)}),Ce=this.getIds(),Me=1/0,He=1/0,Ue=-1/0,Ze=-1/0,Ne=0,Ke=Ee;Ne<Ke.length;Ne+=1){var it=Ke[Ne];Me=Math.min(Me,it.x),He=Math.min(He,it.y),Ue=Math.max(Ue,it.x),Ze=Math.max(Ze,it.y)}for(var pt=function(xt){var Rt=k._tiles[Ce[xt]];if(!Rt.holdingForFade()){var Wt=Rt.tileID,ar=Math.pow(2,q.zoom-Rt.tileID.overscaledZ),ir=b*Rt.queryPadding*n.EXTENT/Rt.tileSize/ar,Ir=[Wt.getTilePoint(new n.MercatorCoordinate(Me,He)),Wt.getTilePoint(new n.MercatorCoordinate(Ue,Ze))];if(Ir[0].x-ir<n.EXTENT&&Ir[0].y-ir<n.EXTENT&&Ir[1].x+ir>=0&&Ir[1].y+ir>=0){var ti=ue.map(function(ii){return Wt.getTilePoint(ii)}),oi=Ee.map(function(ii){return Wt.getTilePoint(ii)});V.push({tile:Rt,tileID:Wt,queryGeometry:ti,cameraQueryGeometry:oi,scale:ar})}}},Ct=0;Ct<Ce.length;Ct++)pt(Ct);return V},_.prototype.getVisibleCoordinates=function(p){for(var b=this,B=this.getRenderableIds(p).map(function(re){return b._tiles[re].tileID}),k=0,V=B;k<V.length;k+=1){var q=V[k];q.posMatrix=this.transform.calculatePosMatrix(q.toUnwrapped())}return B},_.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(Ht(this._source.type))for(var p in this._tiles){var b=this._tiles[p];if(b.fadeEndTime!==void 0&&b.fadeEndTime>=n.browser.now())return!0}return!1},_.prototype.setFeatureState=function(p,b,B){this._state.updateState(p=p||"_geojsonTileLayer",b,B)},_.prototype.removeFeatureState=function(p,b,B){this._state.removeFeatureState(p=p||"_geojsonTileLayer",b,B)},_.prototype.getFeatureState=function(p,b){return this._state.getState(p=p||"_geojsonTileLayer",b)},_.prototype.setDependencies=function(p,b,B){var k=this._tiles[p];k&&k.setDependencies(b,B)},_.prototype.reloadTilesForDependencies=function(p,b){for(var B in this._tiles)this._tiles[B].hasDependency(p,b)&&this._reloadTile(B,"reloading");this._cache.filter(function(k){return!k.hasDependency(p,b)})},_}(n.Evented);function ht(d,_){var p=Math.abs(2*d.wrap)-+(d.wrap<0),b=Math.abs(2*_.wrap)-+(_.wrap<0);return d.overscaledZ-_.overscaledZ||b-p||_.canonical.y-d.canonical.y||_.canonical.x-d.canonical.x}function Ht(d){return d==="raster"||d==="image"||d==="video"}function Zt(){return new n.window.Worker(yu.workerUrl)}Ge.maxOverzooming=10,Ge.maxUnderzooming=3;var Pt="mapboxgl_preloaded_worker_pool",Xt=function(){this.active={}};Xt.prototype.acquire=function(d){if(!this.workers)for(this.workers=[];this.workers.length<Xt.workerCount;)this.workers.push(new Zt);return this.active[d]=!0,this.workers.slice()},Xt.prototype.release=function(d){delete this.active[d],this.numActive()===0&&(this.workers.forEach(function(_){_.terminate()}),this.workers=null)},Xt.prototype.isPreloaded=function(){return!!this.active[Pt]},Xt.prototype.numActive=function(){return Object.keys(this.active).length};var Dr,Mr=Math.floor(n.browser.hardwareConcurrency/2);function Ot(){return Dr||(Dr=new Xt),Dr}function br(d,_){var p={};for(var b in d)b!=="ref"&&(p[b]=d[b]);return n.refProperties.forEach(function(B){B in _&&(p[B]=_[B])}),p}function sr(d){d=d.slice();for(var _=Object.create(null),p=0;p<d.length;p++)_[d[p].id]=d[p];for(var b=0;b<d.length;b++)"ref"in d[b]&&(d[b]=br(d[b],_[d[b].ref]));return d}Xt.workerCount=Math.max(Math.min(Mr,6),1);var lr={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function bi(d,_,p){p.push({command:lr.addSource,args:[d,_[d]]})}function pr(d,_,p){_.push({command:lr.removeSource,args:[d]}),p[d]=!0}function Ii(d,_,p,b){pr(d,p,b),bi(d,_,p)}function vn(d,_,p){var b;for(b in d[p])if(d[p].hasOwnProperty(b)&&b!=="data"&&!n.deepEqual(d[p][b],_[p][b]))return!1;for(b in _[p])if(_[p].hasOwnProperty(b)&&b!=="data"&&!n.deepEqual(d[p][b],_[p][b]))return!1;return!0}function Di(d,_,p,b,B,k){var V;for(V in _=_||{},d=d||{})d.hasOwnProperty(V)&&(n.deepEqual(d[V],_[V])||p.push({command:k,args:[b,V,_[V],B]}));for(V in _)_.hasOwnProperty(V)&&!d.hasOwnProperty(V)&&(n.deepEqual(d[V],_[V])||p.push({command:k,args:[b,V,_[V],B]}))}function Qi(d){return d.id}function Li(d,_){return d[_.id]=_,d}var Xn=function(d,_){this.reset(d,_)};Xn.prototype.reset=function(d,_){this.points=d||[],this._distances=[0];for(var p=1;p<this.points.length;p++)this._distances[p]=this._distances[p-1]+this.points[p].dist(this.points[p-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(_||0,.5*this.length),this.paddedLength=this.length-2*this.padding},Xn.prototype.lerp=function(d){if(this.points.length===1)return this.points[0];d=n.clamp(d,0,1);for(var _=1,p=this._distances[_],b=d*this.paddedLength+this.padding;p<b&&_<this._distances.length;)p=this._distances[++_];var B=_-1,k=this._distances[B],V=p-k,q=V>0?(b-k)/V:0;return this.points[B].mult(1-q).add(this.points[_].mult(q))};var $i=function(d,_,p){var b=this.boxCells=[],B=this.circleCells=[];this.xCellCount=Math.ceil(d/p),this.yCellCount=Math.ceil(_/p);for(var k=0;k<this.xCellCount*this.yCellCount;k++)b.push([]),B.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=d,this.height=_,this.xScale=this.xCellCount/d,this.yScale=this.yCellCount/_,this.boxUid=0,this.circleUid=0};function Ln(d,_,p,b,B){var k=n.create();return _?(n.scale(k,k,[1/B,1/B,1]),p||n.rotateZ(k,k,b.angle)):n.multiply(k,b.labelPlaneMatrix,d),k}function en(d,_,p,b,B){if(_){var k=n.clone(d);return n.scale(k,k,[B,B,1]),p||n.rotateZ(k,k,-b.angle),k}return b.glCoordMatrix}function Si(d,_){var p=[d.x,d.y,0,1];zo(p,p,_);var b=p[3];return{point:new n.Point(p[0]/b,p[1]/b),signedDistanceFromCamera:b}}function Oi(d,_){return .5+d/_*.5}function yo(d,_){var p=d[0]/d[3],b=d[1]/d[3];return p>=-_[0]&&p<=_[0]&&b>=-_[1]&&b<=_[1]}function fc(d,_,p,b,B,k,V,q){var re=b?d.textSizeData:d.iconSizeData,ue=n.evaluateSizeForZoom(re,p.transform.zoom),Ee=[256/p.width*2+1,256/p.height*2+1],Ce=b?d.text.dynamicLayoutVertexArray:d.icon.dynamicLayoutVertexArray;Ce.clear();for(var Me=d.lineVertexArray,He=b?d.text.placedSymbolArray:d.icon.placedSymbolArray,Ue=p.transform.width/p.transform.height,Ze=!1,Ne=0;Ne<He.length;Ne++){var Ke=He.get(Ne);if(Ke.hidden||Ke.writingMode===n.WritingMode.vertical&&!Ze)cs(Ke.numGlyphs,Ce);else{Ze=!1;var it=[Ke.anchorX,Ke.anchorY,0,1];if(n.transformMat4(it,it,_),yo(it,Ee)){var pt=Oi(p.transform.cameraToCenterDistance,it[3]),Ct=n.evaluateSizeForFeature(re,ue,Ke),xt=V?Ct/pt:Ct*pt,Rt=new n.Point(Ke.anchorX,Ke.anchorY),Wt=Si(Rt,B).point,ar={},ir=zs(Ke,xt,!1,q,_,B,k,d.glyphOffsetArray,Me,Ce,Wt,Rt,ar,Ue);Ze=ir.useVertical,(ir.notEnoughRoom||Ze||ir.needsFlipping&&zs(Ke,xt,!0,q,_,B,k,d.glyphOffsetArray,Me,Ce,Wt,Rt,ar,Ue).notEnoughRoom)&&cs(Ke.numGlyphs,Ce)}else cs(Ke.numGlyphs,Ce)}}b?d.text.dynamicLayoutVertexBuffer.updateData(Ce):d.icon.dynamicLayoutVertexBuffer.updateData(Ce)}function ko(d,_,p,b,B,k,V,q,re,ue,Ee){var Ce=q.glyphStartIndex+q.numGlyphs,Me=q.lineStartIndex,He=q.lineStartIndex+q.lineLength,Ue=_.getoffsetX(q.glyphStartIndex),Ze=_.getoffsetX(Ce-1),Ne=zn(d*Ue,p,b,B,k,V,q.segment,Me,He,re,ue,Ee);if(!Ne)return null;var Ke=zn(d*Ze,p,b,B,k,V,q.segment,Me,He,re,ue,Ee);return Ke?{first:Ne,last:Ke}:null}function Yo(d,_,p,b){return d===n.WritingMode.horizontal&&Math.abs(p.y-_.y)>Math.abs(p.x-_.x)*b?{useVertical:!0}:(d===n.WritingMode.vertical?_.y<p.y:_.x>p.x)?{needsFlipping:!0}:null}function zs(d,_,p,b,B,k,V,q,re,ue,Ee,Ce,Me,He){var Ue,Ze=_/24,Ne=d.lineOffsetX*Ze,Ke=d.lineOffsetY*Ze;if(d.numGlyphs>1){var it=d.glyphStartIndex+d.numGlyphs,pt=d.lineStartIndex,Ct=d.lineStartIndex+d.lineLength,xt=ko(Ze,q,Ne,Ke,p,Ee,Ce,d,re,k,Me);if(!xt)return{notEnoughRoom:!0};var Rt=Si(xt.first.point,V).point,Wt=Si(xt.last.point,V).point;if(b&&!p){var ar=Yo(d.writingMode,Rt,Wt,He);if(ar)return ar}Ue=[xt.first];for(var ir=d.glyphStartIndex+1;ir<it-1;ir++)Ue.push(zn(Ze*q.getoffsetX(ir),Ne,Ke,p,Ee,Ce,d.segment,pt,Ct,re,k,Me));Ue.push(xt.last)}else{if(b&&!p){var Ir=Si(Ce,B).point,ti=d.lineStartIndex+d.segment+1,oi=new n.Point(re.getx(ti),re.gety(ti)),ii=Si(oi,B),hn=ii.signedDistanceFromCamera>0?ii.point:Uo(Ce,oi,Ir,1,B),Or=Yo(d.writingMode,Ir,hn,He);if(Or)return Or}var yi=zn(Ze*q.getoffsetX(d.glyphStartIndex),Ne,Ke,p,Ee,Ce,d.segment,d.lineStartIndex,d.lineStartIndex+d.lineLength,re,k,Me);if(!yi)return{notEnoughRoom:!0};Ue=[yi]}for(var vi=0,di=Ue;vi<di.length;vi+=1){var pi=di[vi];n.addDynamicAttributes(ue,pi.point,pi.angle)}return{}}function Uo(d,_,p,b,B){var k=Si(d.add(d.sub(_)._unit()),B).point,V=p.sub(k);return p.add(V._mult(b/V.mag()))}function zn(d,_,p,b,B,k,V,q,re,ue,Ee,Ce){var Me=b?d-_:d+_,He=Me>0?1:-1,Ue=0;b&&(He*=-1,Ue=Math.PI),He<0&&(Ue+=Math.PI);for(var Ze=He>0?q+V:q+V+1,Ne=B,Ke=B,it=0,pt=0,Ct=Math.abs(Me),xt=[];it+pt<=Ct;){if((Ze+=He)<q||Ze>=re)return null;if(Ke=Ne,xt.push(Ne),(Ne=Ce[Ze])===void 0){var Rt=new n.Point(ue.getx(Ze),ue.gety(Ze)),Wt=Si(Rt,Ee);if(Wt.signedDistanceFromCamera>0)Ne=Ce[Ze]=Wt.point;else{var ar=Ze-He;Ne=Uo(it===0?k:new n.Point(ue.getx(ar),ue.gety(ar)),Rt,Ke,Ct-it+1,Ee)}}it+=pt,pt=Ke.dist(Ne)}var ir=(Ct-it)/pt,Ir=Ne.sub(Ke),ti=Ir.mult(ir)._add(Ke);ti._add(Ir._unit()._perp()._mult(p*He));var oi=Ue+Math.atan2(Ne.y-Ke.y,Ne.x-Ke.x);return xt.push(ti),{point:ti,angle:oi,path:xt}}$i.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},$i.prototype.insert=function(d,_,p,b,B){this._forEachCell(_,p,b,B,this._insertBoxCell,this.boxUid++),this.boxKeys.push(d),this.bboxes.push(_),this.bboxes.push(p),this.bboxes.push(b),this.bboxes.push(B)},$i.prototype.insertCircle=function(d,_,p,b){this._forEachCell(_-b,p-b,_+b,p+b,this._insertCircleCell,this.circleUid++),this.circleKeys.push(d),this.circles.push(_),this.circles.push(p),this.circles.push(b)},$i.prototype._insertBoxCell=function(d,_,p,b,B,k){this.boxCells[B].push(k)},$i.prototype._insertCircleCell=function(d,_,p,b,B,k){this.circleCells[B].push(k)},$i.prototype._query=function(d,_,p,b,B,k){if(p<0||d>this.width||b<0||_>this.height)return!B&&[];var V=[];if(d<=0&&_<=0&&this.width<=p&&this.height<=b){if(B)return!0;for(var q=0;q<this.boxKeys.length;q++)V.push({key:this.boxKeys[q],x1:this.bboxes[4*q],y1:this.bboxes[4*q+1],x2:this.bboxes[4*q+2],y2:this.bboxes[4*q+3]});for(var re=0;re<this.circleKeys.length;re++){var ue=this.circles[3*re],Ee=this.circles[3*re+1],Ce=this.circles[3*re+2];V.push({key:this.circleKeys[re],x1:ue-Ce,y1:Ee-Ce,x2:ue+Ce,y2:Ee+Ce})}return k?V.filter(k):V}return this._forEachCell(d,_,p,b,this._queryCell,V,{hitTest:B,seenUids:{box:{},circle:{}}},k),B?V.length>0:V},$i.prototype._queryCircle=function(d,_,p,b,B){var k=d-p,V=d+p,q=_-p,re=_+p;if(V<0||k>this.width||re<0||q>this.height)return!b&&[];var ue=[];return this._forEachCell(k,q,V,re,this._queryCellCircle,ue,{hitTest:b,circle:{x:d,y:_,radius:p},seenUids:{box:{},circle:{}}},B),b?ue.length>0:ue},$i.prototype.query=function(d,_,p,b,B){return this._query(d,_,p,b,!1,B)},$i.prototype.hitTest=function(d,_,p,b,B){return this._query(d,_,p,b,!0,B)},$i.prototype.hitTestCircle=function(d,_,p,b){return this._queryCircle(d,_,p,!0,b)},$i.prototype._queryCell=function(d,_,p,b,B,k,V,q){var re=V.seenUids,ue=this.boxCells[B];if(ue!==null)for(var Ee=this.bboxes,Ce=0,Me=ue;Ce<Me.length;Ce+=1){var He=Me[Ce];if(!re.box[He]){re.box[He]=!0;var Ue=4*He;if(d<=Ee[Ue+2]&&_<=Ee[Ue+3]&&p>=Ee[Ue+0]&&b>=Ee[Ue+1]&&(!q||q(this.boxKeys[He]))){if(V.hitTest)return k.push(!0),!0;k.push({key:this.boxKeys[He],x1:Ee[Ue],y1:Ee[Ue+1],x2:Ee[Ue+2],y2:Ee[Ue+3]})}}}var Ze=this.circleCells[B];if(Ze!==null)for(var Ne=this.circles,Ke=0,it=Ze;Ke<it.length;Ke+=1){var pt=it[Ke];if(!re.circle[pt]){re.circle[pt]=!0;var Ct=3*pt;if(this._circleAndRectCollide(Ne[Ct],Ne[Ct+1],Ne[Ct+2],d,_,p,b)&&(!q||q(this.circleKeys[pt]))){if(V.hitTest)return k.push(!0),!0;var xt=Ne[Ct],Rt=Ne[Ct+1],Wt=Ne[Ct+2];k.push({key:this.circleKeys[pt],x1:xt-Wt,y1:Rt-Wt,x2:xt+Wt,y2:Rt+Wt})}}}},$i.prototype._queryCellCircle=function(d,_,p,b,B,k,V,q){var re=V.circle,ue=V.seenUids,Ee=this.boxCells[B];if(Ee!==null)for(var Ce=this.bboxes,Me=0,He=Ee;Me<He.length;Me+=1){var Ue=He[Me];if(!ue.box[Ue]){ue.box[Ue]=!0;var Ze=4*Ue;if(this._circleAndRectCollide(re.x,re.y,re.radius,Ce[Ze+0],Ce[Ze+1],Ce[Ze+2],Ce[Ze+3])&&(!q||q(this.boxKeys[Ue])))return k.push(!0),!0}}var Ne=this.circleCells[B];if(Ne!==null)for(var Ke=this.circles,it=0,pt=Ne;it<pt.length;it+=1){var Ct=pt[it];if(!ue.circle[Ct]){ue.circle[Ct]=!0;var xt=3*Ct;if(this._circlesCollide(Ke[xt],Ke[xt+1],Ke[xt+2],re.x,re.y,re.radius)&&(!q||q(this.circleKeys[Ct])))return k.push(!0),!0}}},$i.prototype._forEachCell=function(d,_,p,b,B,k,V,q){for(var re=this._convertToXCellCoord(d),ue=this._convertToYCellCoord(_),Ee=this._convertToXCellCoord(p),Ce=this._convertToYCellCoord(b),Me=re;Me<=Ee;Me++)for(var He=ue;He<=Ce;He++)if(B.call(this,d,_,p,b,this.xCellCount*He+Me,k,V,q))return},$i.prototype._convertToXCellCoord=function(d){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(d*this.xScale)))},$i.prototype._convertToYCellCoord=function(d){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(d*this.yScale)))},$i.prototype._circlesCollide=function(d,_,p,b,B,k){var V=b-d,q=B-_,re=p+k;return re*re>V*V+q*q},$i.prototype._circleAndRectCollide=function(d,_,p,b,B,k,V){var q=(k-b)/2,re=Math.abs(d-(b+q));if(re>q+p)return!1;var ue=(V-B)/2,Ee=Math.abs(_-(B+ue));if(Ee>ue+p)return!1;if(re<=q||Ee<=ue)return!0;var Ce=re-q,Me=Ee-ue;return Ce*Ce+Me*Me<=p*p};var ll=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function cs(d,_){for(var p=0;p<d;p++){var b=_.length;_.resize(b+4),_.float32.set(ll,3*b)}}function zo(d,_,p){var b=_[0],B=_[1];return d[0]=p[0]*b+p[4]*B+p[12],d[1]=p[1]*b+p[5]*B+p[13],d[3]=p[3]*b+p[7]*B+p[15],d}var ys=function(d,_,p){_===void 0&&(_=new $i(d.width+200,d.height+200,25)),p===void 0&&(p=new $i(d.width+200,d.height+200,25)),this.transform=d,this.grid=_,this.ignoredGrid=p,this.pitchfactor=Math.cos(d._pitch)*d.cameraToCenterDistance,this.screenRightBoundary=d.width+100,this.screenBottomBoundary=d.height+100,this.gridRightBoundary=d.width+200,this.gridBottomBoundary=d.height+200};function pn(d,_,p){return _*(n.EXTENT/(d.tileSize*Math.pow(2,p-d.tileID.overscaledZ)))}ys.prototype.placeCollisionBox=function(d,_,p,b,B){var k=this.projectAndGetPerspectiveRatio(b,d.anchorPointX,d.anchorPointY),V=p*k.perspectiveRatio,q=d.x1*V+k.point.x,re=d.y1*V+k.point.y,ue=d.x2*V+k.point.x,Ee=d.y2*V+k.point.y;return!this.isInsideGrid(q,re,ue,Ee)||!_&&this.grid.hitTest(q,re,ue,Ee,B)?{box:[],offscreen:!1}:{box:[q,re,ue,Ee],offscreen:this.isOffscreen(q,re,ue,Ee)}},ys.prototype.placeCollisionCircles=function(d,_,p,b,B,k,V,q,re,ue,Ee,Ce,Me){var He=[],Ue=new n.Point(_.anchorX,_.anchorY),Ze=Si(Ue,k),Ne=Oi(this.transform.cameraToCenterDistance,Ze.signedDistanceFromCamera),Ke=(ue?B/Ne:B*Ne)/n.ONE_EM,it=Si(Ue,V).point,pt=ko(Ke,b,_.lineOffsetX*Ke,_.lineOffsetY*Ke,!1,it,Ue,_,p,V,{}),Ct=!1,xt=!1,Rt=!0;if(pt){for(var Wt=.5*Ce*Ne+Me,ar=new n.Point(-100,-100),ir=new n.Point(this.screenRightBoundary,this.screenBottomBoundary),Ir=new Xn,ti=pt.first,oi=pt.last,ii=[],hn=ti.path.length-1;hn>=1;hn--)ii.push(ti.path[hn]);for(var Or=1;Or<oi.path.length;Or++)ii.push(oi.path[Or]);var yi=2.5*Wt;if(q){var vi=ii.map(function(Bl){return Si(Bl,q)});ii=vi.some(function(Bl){return Bl.signedDistanceFromCamera<=0})?[]:vi.map(function(Bl){return Bl.point})}var di=[];if(ii.length>0){for(var pi=ii[0].clone(),Pi=ii[0].clone(),hi=1;hi<ii.length;hi++)pi.x=Math.min(pi.x,ii[hi].x),pi.y=Math.min(pi.y,ii[hi].y),Pi.x=Math.max(Pi.x,ii[hi].x),Pi.y=Math.max(Pi.y,ii[hi].y);di=pi.x>=ar.x&&Pi.x<=ir.x&&pi.y>=ar.y&&Pi.y<=ir.y?[ii]:Pi.x<ar.x||pi.x>ir.x||Pi.y<ar.y||pi.y>ir.y?[]:n.clipLine([ii],ar.x,ar.y,ir.x,ir.y)}for(var li=0,bs=di;li<bs.length;li+=1){var Yn;Ir.reset(bs[li],.25*Wt),Yn=Ir.length<=.5*Wt?1:Math.ceil(Ir.paddedLength/yi)+1;for(var Ws=0;Ws<Yn;Ws++){var ws=Ws/Math.max(Yn-1,1),Io=Ir.lerp(ws),Jo=Io.x+100,Wa=Io.y+100;He.push(Jo,Wa,Wt,0);var pa=Jo-Wt,vu=Wa-Wt,Ia=Jo+Wt,Kl=Wa+Wt;if(Rt=Rt&&this.isOffscreen(pa,vu,Ia,Kl),xt=xt||this.isInsideGrid(pa,vu,Ia,Kl),!d&&this.grid.hitTestCircle(Jo,Wa,Wt,Ee)&&(Ct=!0,!re))return{circles:[],offscreen:!1,collisionDetected:Ct}}}}return{circles:!re&&Ct||!xt?[]:He,offscreen:Rt,collisionDetected:Ct}},ys.prototype.queryRenderedSymbols=function(d){if(d.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};for(var _=[],p=1/0,b=1/0,B=-1/0,k=-1/0,V=0,q=d;V<q.length;V+=1){var re=q[V],ue=new n.Point(re.x+100,re.y+100);p=Math.min(p,ue.x),b=Math.min(b,ue.y),B=Math.max(B,ue.x),k=Math.max(k,ue.y),_.push(ue)}for(var Ee={},Ce={},Me=0,He=this.grid.query(p,b,B,k).concat(this.ignoredGrid.query(p,b,B,k));Me<He.length;Me+=1){var Ue=He[Me],Ze=Ue.key;if(Ee[Ze.bucketInstanceId]===void 0&&(Ee[Ze.bucketInstanceId]={}),!Ee[Ze.bucketInstanceId][Ze.featureIndex]){var Ne=[new n.Point(Ue.x1,Ue.y1),new n.Point(Ue.x2,Ue.y1),new n.Point(Ue.x2,Ue.y2),new n.Point(Ue.x1,Ue.y2)];n.polygonIntersectsPolygon(_,Ne)&&(Ee[Ze.bucketInstanceId][Ze.featureIndex]=!0,Ce[Ze.bucketInstanceId]===void 0&&(Ce[Ze.bucketInstanceId]=[]),Ce[Ze.bucketInstanceId].push(Ze.featureIndex))}}return Ce},ys.prototype.insertCollisionBox=function(d,_,p,b,B){(_?this.ignoredGrid:this.grid).insert({bucketInstanceId:p,featureIndex:b,collisionGroupID:B},d[0],d[1],d[2],d[3])},ys.prototype.insertCollisionCircles=function(d,_,p,b,B){for(var k=_?this.ignoredGrid:this.grid,V={bucketInstanceId:p,featureIndex:b,collisionGroupID:B},q=0;q<d.length;q+=4)k.insertCircle(V,d[q],d[q+1],d[q+2])},ys.prototype.projectAndGetPerspectiveRatio=function(d,_,p){var b=[_,p,0,1];return zo(b,b,d),{point:new n.Point((b[0]/b[3]+1)/2*this.transform.width+100,(-b[1]/b[3]+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/b[3]*.5}},ys.prototype.isOffscreen=function(d,_,p,b){return p<100||d>=this.screenRightBoundary||b<100||_>this.screenBottomBoundary},ys.prototype.isInsideGrid=function(d,_,p,b){return p>=0&&d<this.gridRightBoundary&&b>=0&&_<this.gridBottomBoundary},ys.prototype.getViewportMatrix=function(){var d=n.identity([]);return n.translate(d,d,[-100,-100,0]),d};var $s=function(d,_,p,b){this.opacity=d?Math.max(0,Math.min(1,d.opacity+(d.placed?_:-_))):b&&p?1:0,this.placed=p};$s.prototype.isHidden=function(){return this.opacity===0&&!this.placed};var Vs=function(d,_,p,b,B){this.text=new $s(d?d.text:null,_,p,B),this.icon=new $s(d?d.icon:null,_,b,B)};Vs.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var Qu=function(d,_,p){this.text=d,this.icon=_,this.skipFade=p},ua=function(){this.invProjMatrix=n.create(),this.viewportMatrix=n.create(),this.circles=[]},Ua=function(d,_,p,b,B){this.bucketInstanceId=d,this.featureIndex=_,this.sourceLayerIndex=p,this.bucketIndex=b,this.tileID=B},cl=function(d){this.crossSourceCollisions=d,this.maxGroupID=0,this.collisionGroups={}};function xe(d,_,p,b,B){var k=n.getAnchorAlignment(d),V=-(k.horizontalAlign-.5)*_,q=-(k.verticalAlign-.5)*p,re=n.evaluateVariableOffset(d,b);return new n.Point(V+re[0]*B,q+re[1]*B)}function Be(d,_,p,b,B,k){var V=d.x1,q=d.x2,re=d.y1,ue=d.y2,Ee=d.anchorPointX,Ce=d.anchorPointY,Me=new n.Point(_,p);return b&&Me._rotate(B?k:-k),{x1:V+Me.x,y1:re+Me.y,x2:q+Me.x,y2:ue+Me.y,anchorPointX:Ee,anchorPointY:Ce}}cl.prototype.get=function(d){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[d]){var _=++this.maxGroupID;this.collisionGroups[d]={ID:_,predicate:function(p){return p.collisionGroupID===_}}}return this.collisionGroups[d]};var Je=function(d,_,p,b){this.transform=d.clone(),this.collisionIndex=new ys(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=_,this.retainedQueryData={},this.collisionGroups=new cl(p),this.collisionCircleArrays={},this.prevPlacement=b,b&&(b.prevPlacement=void 0),this.placedOrientations={}};function vt(d,_,p,b,B){d.emplaceBack(_?1:0,p?1:0,b||0,B||0),d.emplaceBack(_?1:0,p?1:0,b||0,B||0),d.emplaceBack(_?1:0,p?1:0,b||0,B||0),d.emplaceBack(_?1:0,p?1:0,b||0,B||0)}Je.prototype.getBucketParts=function(d,_,p,b){var B=p.getBucket(_),k=p.latestFeatureIndex;if(B&&k&&_.id===B.layerIds[0]){var V=p.collisionBoxArray,q=B.layers[0].layout,re=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),ue=p.tileSize/n.EXTENT,Ee=this.transform.calculatePosMatrix(p.tileID.toUnwrapped()),Ce=q.get("text-pitch-alignment")==="map",Me=q.get("text-rotation-alignment")==="map",He=pn(p,1,this.transform.zoom),Ue=Ln(Ee,Ce,Me,this.transform,He),Ze=null;if(Ce){var Ne=en(Ee,Ce,Me,this.transform,He);Ze=n.multiply([],this.transform.labelPlaneMatrix,Ne)}this.retainedQueryData[B.bucketInstanceId]=new Ua(B.bucketInstanceId,k,B.sourceLayerIndex,B.index,p.tileID);var Ke={bucket:B,layout:q,posMatrix:Ee,textLabelPlaneMatrix:Ue,labelToScreenMatrix:Ze,scale:re,textPixelRatio:ue,holdingForFade:p.holdingForFade(),collisionBoxArray:V,partiallyEvaluatedTextSize:n.evaluateSizeForZoom(B.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(B.sourceID)};if(b)for(var it=0,pt=B.sortKeyRanges;it<pt.length;it+=1){var Ct=pt[it];d.push({sortKey:Ct.sortKey,symbolInstanceStart:Ct.symbolInstanceStart,symbolInstanceEnd:Ct.symbolInstanceEnd,parameters:Ke})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:B.symbolInstances.length,parameters:Ke})}},Je.prototype.attemptAnchorPlacement=function(d,_,p,b,B,k,V,q,re,ue,Ee,Ce,Me,He,Ue){var Ze,Ne=[Ce.textOffset0,Ce.textOffset1],Ke=xe(d,p,b,Ne,B),it=this.collisionIndex.placeCollisionBox(Be(_,Ke.x,Ke.y,k,V,this.transform.angle),Ee,q,re,ue.predicate);if(!Ue||this.collisionIndex.placeCollisionBox(Be(Ue,Ke.x,Ke.y,k,V,this.transform.angle),Ee,q,re,ue.predicate).box.length!==0)return it.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[Ce.crossTileID]&&this.prevPlacement.placements[Ce.crossTileID]&&this.prevPlacement.placements[Ce.crossTileID].text&&(Ze=this.prevPlacement.variableOffsets[Ce.crossTileID].anchor),this.variableOffsets[Ce.crossTileID]={textOffset:Ne,width:p,height:b,anchor:d,textBoxScale:B,prevAnchor:Ze},this.markUsedJustification(Me,d,Ce,He),Me.allowVerticalPlacement&&(this.markUsedOrientation(Me,He,Ce),this.placedOrientations[Ce.crossTileID]=He),{shift:Ke,placedGlyphBoxes:it}):void 0},Je.prototype.placeLayerBucketPart=function(d,_,p){var b=this,B=d.parameters,k=B.bucket,V=B.layout,q=B.posMatrix,re=B.textLabelPlaneMatrix,ue=B.labelToScreenMatrix,Ee=B.textPixelRatio,Ce=B.holdingForFade,Me=B.collisionBoxArray,He=B.partiallyEvaluatedTextSize,Ue=B.collisionGroup,Ze=V.get("text-optional"),Ne=V.get("icon-optional"),Ke=V.get("text-allow-overlap"),it=V.get("icon-allow-overlap"),pt=V.get("text-rotation-alignment")==="map",Ct=V.get("text-pitch-alignment")==="map",xt=V.get("icon-text-fit")!=="none",Rt=V.get("symbol-z-order")==="viewport-y",Wt=Ke&&(it||!k.hasIconData()||Ne),ar=it&&(Ke||!k.hasTextData()||Ze);!k.collisionArrays&&Me&&k.deserializeCollisionBoxes(Me);var ir=function(Or,yi){if(!_[Or.crossTileID])if(Ce)b.placements[Or.crossTileID]=new Qu(!1,!1,!1);else{var vi,di=!1,pi=!1,Pi=!0,hi=null,li={box:null,offscreen:null},bs={box:null,offscreen:null},Yn=null,Ws=null,ws=0,Io=0,Jo=0;yi.textFeatureIndex?ws=yi.textFeatureIndex:Or.useRuntimeCollisionCircles&&(ws=Or.featureIndex),yi.verticalTextFeatureIndex&&(Io=yi.verticalTextFeatureIndex);var Wa=yi.textBox;if(Wa){var pa=function(Cn){var qa=n.WritingMode.horizontal;if(k.allowVerticalPlacement&&!Cn&&b.prevPlacement){var Aa=b.prevPlacement.placedOrientations[Or.crossTileID];Aa&&(b.placedOrientations[Or.crossTileID]=Aa,b.markUsedOrientation(k,qa=Aa,Or))}return qa},vu=function(Cn,qa){if(k.allowVerticalPlacement&&Or.numVerticalGlyphVertices>0&&yi.verticalTextBox)for(var Aa=0,wu=k.writingModes;Aa<wu.length&&(wu[Aa]===n.WritingMode.vertical?(li=qa(),bs=li):li=Cn(),!(li&&li.box&&li.box.length));Aa+=1);else li=Cn()};if(V.get("text-variable-anchor")){var Ia=V.get("text-variable-anchor");if(b.prevPlacement&&b.prevPlacement.variableOffsets[Or.crossTileID]){var Kl=b.prevPlacement.variableOffsets[Or.crossTileID];Ia.indexOf(Kl.anchor)>0&&(Ia=Ia.filter(function(Cn){return Cn!==Kl.anchor})).unshift(Kl.anchor)}var Bl=function(Cn,qa,Aa){for(var wu=Cn.x2-Cn.x1,Kg=Cn.y2-Cn.y1,dp=Or.textBoxScale,hv=xt&&!it?qa:null,nd={box:[],offscreen:!1},Zg=Ke?2*Ia.length:Ia.length,sh=0;sh<Zg;++sh){var Zl=b.attemptAnchorPlacement(Ia[sh%Ia.length],Cn,wu,Kg,dp,pt,Ct,Ee,q,Ue,sh>=Ia.length,Or,k,Aa,hv);if(Zl&&(nd=Zl.placedGlyphBoxes)&&nd.box&&nd.box.length){di=!0,hi=Zl.shift;break}}return nd};vu(function(){return Bl(Wa,yi.iconBox,n.WritingMode.horizontal)},function(){var Cn=yi.verticalTextBox;return k.allowVerticalPlacement&&!(li&&li.box&&li.box.length)&&Or.numVerticalGlyphVertices>0&&Cn?Bl(Cn,yi.verticalIconBox,n.WritingMode.vertical):{box:null,offscreen:null}}),li&&(di=li.box,Pi=li.offscreen);var rd=pa(li&&li.box);if(!di&&b.prevPlacement){var nh=b.prevPlacement.variableOffsets[Or.crossTileID];nh&&(b.variableOffsets[Or.crossTileID]=nh,b.markUsedJustification(k,nh.anchor,Or,rd))}}else{var xu=function(Cn,qa){var Aa=b.collisionIndex.placeCollisionBox(Cn,Ke,Ee,q,Ue.predicate);return Aa&&Aa.box&&Aa.box.length&&(b.markUsedOrientation(k,qa,Or),b.placedOrientations[Or.crossTileID]=qa),Aa};vu(function(){return xu(Wa,n.WritingMode.horizontal)},function(){var Cn=yi.verticalTextBox;return k.allowVerticalPlacement&&Or.numVerticalGlyphVertices>0&&Cn?xu(Cn,n.WritingMode.vertical):{box:null,offscreen:null}}),pa(li&&li.box&&li.box.length)}}if(di=(vi=li)&&vi.box&&vi.box.length>0,Pi=vi&&vi.offscreen,Or.useRuntimeCollisionCircles){var uf=k.text.placedSymbolArray.get(Or.centerJustifiedTextSymbolIndex),oh=n.evaluateSizeForFeature(k.textSizeData,He,uf),ro=V.get("text-padding");Yn=b.collisionIndex.placeCollisionCircles(Ke,uf,k.lineVertexArray,k.glyphOffsetArray,oh,q,re,ue,p,Ct,Ue.predicate,Or.collisionCircleDiameter,ro),di=Ke||Yn.circles.length>0&&!Yn.collisionDetected,Pi=Pi&&Yn.offscreen}if(yi.iconFeatureIndex&&(Jo=yi.iconFeatureIndex),yi.iconBox){var id=function(Cn){var qa=xt&&hi?Be(Cn,hi.x,hi.y,pt,Ct,b.transform.angle):Cn;return b.collisionIndex.placeCollisionBox(qa,it,Ee,q,Ue.predicate)};pi=bs&&bs.box&&bs.box.length&&yi.verticalIconBox?(Ws=id(yi.verticalIconBox)).box.length>0:(Ws=id(yi.iconBox)).box.length>0,Pi=Pi&&Ws.offscreen}var gc=Ze||Or.numHorizontalGlyphVertices===0&&Or.numVerticalGlyphVertices===0,Ho=Ne||Or.numIconVertices===0;if(gc||Ho?Ho?gc||(pi=pi&&di):di=pi&&di:pi=di=pi&&di,di&&vi&&vi.box&&b.collisionIndex.insertCollisionBox(vi.box,V.get("text-ignore-placement"),k.bucketInstanceId,bs&&bs.box&&Io?Io:ws,Ue.ID),pi&&Ws&&b.collisionIndex.insertCollisionBox(Ws.box,V.get("icon-ignore-placement"),k.bucketInstanceId,Jo,Ue.ID),Yn&&(di&&b.collisionIndex.insertCollisionCircles(Yn.circles,V.get("text-ignore-placement"),k.bucketInstanceId,ws,Ue.ID),p)){var Ts=k.bucketInstanceId,bu=b.collisionCircleArrays[Ts];bu===void 0&&(bu=b.collisionCircleArrays[Ts]=new ua);for(var ff=0;ff<Yn.circles.length;ff+=4)bu.circles.push(Yn.circles[ff+0]),bu.circles.push(Yn.circles[ff+1]),bu.circles.push(Yn.circles[ff+2]),bu.circles.push(Yn.collisionDetected?1:0)}b.placements[Or.crossTileID]=new Qu(di||Wt,pi||ar,Pi||k.justReloaded),_[Or.crossTileID]=!0}};if(Rt)for(var Ir=k.getSortedSymbolIndexes(this.transform.angle),ti=Ir.length-1;ti>=0;--ti){var oi=Ir[ti];ir(k.symbolInstances.get(oi),k.collisionArrays[oi])}else for(var ii=d.symbolInstanceStart;ii<d.symbolInstanceEnd;ii++)ir(k.symbolInstances.get(ii),k.collisionArrays[ii]);if(p&&k.bucketInstanceId in this.collisionCircleArrays){var hn=this.collisionCircleArrays[k.bucketInstanceId];n.invert(hn.invProjMatrix,q),hn.viewportMatrix=this.collisionIndex.getViewportMatrix()}k.justReloaded=!1},Je.prototype.markUsedJustification=function(d,_,p,b){var B;B=b===n.WritingMode.vertical?p.verticalPlacedTextSymbolIndex:{left:p.leftJustifiedTextSymbolIndex,center:p.centerJustifiedTextSymbolIndex,right:p.rightJustifiedTextSymbolIndex}[n.getAnchorJustification(_)];for(var k=0,V=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex,p.verticalPlacedTextSymbolIndex];k<V.length;k+=1){var q=V[k];q>=0&&(d.text.placedSymbolArray.get(q).crossTileID=B>=0&&q!==B?0:p.crossTileID)}},Je.prototype.markUsedOrientation=function(d,_,p){for(var b=_===n.WritingMode.horizontal||_===n.WritingMode.horizontalOnly?_:0,B=_===n.WritingMode.vertical?_:0,k=0,V=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];k<V.length;k+=1)d.text.placedSymbolArray.get(V[k]).placedOrientation=b;p.verticalPlacedTextSymbolIndex&&(d.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=B)},Je.prototype.commit=function(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;var _=this.prevPlacement,p=!1;this.prevZoomAdjustment=_?_.zoomAdjustment(this.transform.zoom):0;var b=_?_.symbolFadeChange(d):1,B=_?_.opacities:{},k=_?_.variableOffsets:{},V=_?_.placedOrientations:{};for(var q in this.placements){var re=this.placements[q],ue=B[q];ue?(this.opacities[q]=new Vs(ue,b,re.text,re.icon),p=p||re.text!==ue.text.placed||re.icon!==ue.icon.placed):(this.opacities[q]=new Vs(null,b,re.text,re.icon,re.skipFade),p=p||re.text||re.icon)}for(var Ee in B){var Ce=B[Ee];if(!this.opacities[Ee]){var Me=new Vs(Ce,b,!1,!1);Me.isHidden()||(this.opacities[Ee]=Me,p=p||Ce.text.placed||Ce.icon.placed)}}for(var He in k)this.variableOffsets[He]||!this.opacities[He]||this.opacities[He].isHidden()||(this.variableOffsets[He]=k[He]);for(var Ue in V)this.placedOrientations[Ue]||!this.opacities[Ue]||this.opacities[Ue].isHidden()||(this.placedOrientations[Ue]=V[Ue]);p?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=_?_.lastPlacementChangeTime:d)},Je.prototype.updateLayerOpacities=function(d,_){for(var p={},b=0,B=_;b<B.length;b+=1){var k=B[b],V=k.getBucket(d);V&&k.latestFeatureIndex&&d.id===V.layerIds[0]&&this.updateBucketOpacities(V,p,k.collisionBoxArray)}},Je.prototype.updateBucketOpacities=function(d,_,p){var b=this;d.hasTextData()&&d.text.opacityVertexArray.clear(),d.hasIconData()&&d.icon.opacityVertexArray.clear(),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexArray.clear(),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexArray.clear();var B=d.layers[0].layout,k=new Vs(null,0,!1,!1,!0),V=B.get("text-allow-overlap"),q=B.get("icon-allow-overlap"),re=B.get("text-variable-anchor"),ue=B.get("text-rotation-alignment")==="map",Ee=B.get("text-pitch-alignment")==="map",Ce=B.get("icon-text-fit")!=="none",Me=new Vs(null,0,V&&(q||!d.hasIconData()||B.get("icon-optional")),q&&(V||!d.hasTextData()||B.get("text-optional")),!0);!d.collisionArrays&&p&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(p);for(var He=function(Ke,it,pt){for(var Ct=0;Ct<it/4;Ct++)Ke.opacityVertexArray.emplaceBack(pt)},Ue=function(Ke){var it=d.symbolInstances.get(Ke),pt=it.numHorizontalGlyphVertices,Ct=it.numVerticalGlyphVertices,xt=it.crossTileID,Rt=b.opacities[xt];_[xt]?Rt=k:Rt||(b.opacities[xt]=Rt=Me),_[xt]=!0;var Wt=it.numIconVertices>0,ar=b.placedOrientations[it.crossTileID],ir=ar===n.WritingMode.vertical,Ir=ar===n.WritingMode.horizontal||ar===n.WritingMode.horizontalOnly;if(pt>0||Ct>0){var ti=np(Rt.text);He(d.text,pt,ir?$u:ti),He(d.text,Ct,Ir?$u:ti);var oi=Rt.text.isHidden();[it.rightJustifiedTextSymbolIndex,it.centerJustifiedTextSymbolIndex,it.leftJustifiedTextSymbolIndex].forEach(function(li){li>=0&&(d.text.placedSymbolArray.get(li).hidden=oi||ir?1:0)}),it.verticalPlacedTextSymbolIndex>=0&&(d.text.placedSymbolArray.get(it.verticalPlacedTextSymbolIndex).hidden=oi||Ir?1:0);var ii=b.variableOffsets[it.crossTileID];ii&&b.markUsedJustification(d,ii.anchor,it,ar);var hn=b.placedOrientations[it.crossTileID];hn&&(b.markUsedJustification(d,"left",it,hn),b.markUsedOrientation(d,hn,it))}if(Wt){var Or=np(Rt.icon),yi=!(Ce&&it.verticalPlacedIconSymbolIndex&&ir);it.placedIconSymbolIndex>=0&&(He(d.icon,it.numIconVertices,yi?Or:$u),d.icon.placedSymbolArray.get(it.placedIconSymbolIndex).hidden=Rt.icon.isHidden()),it.verticalPlacedIconSymbolIndex>=0&&(He(d.icon,it.numVerticalIconVertices,yi?$u:Or),d.icon.placedSymbolArray.get(it.verticalPlacedIconSymbolIndex).hidden=Rt.icon.isHidden())}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){var vi=d.collisionArrays[Ke];if(vi){var di=new n.Point(0,0);if(vi.textBox||vi.verticalTextBox){var pi=!0;if(re){var Pi=b.variableOffsets[xt];Pi?(di=xe(Pi.anchor,Pi.width,Pi.height,Pi.textOffset,Pi.textBoxScale),ue&&di._rotate(Ee?b.transform.angle:-b.transform.angle)):pi=!1}vi.textBox&&vt(d.textCollisionBox.collisionVertexArray,Rt.text.placed,!pi||ir,di.x,di.y),vi.verticalTextBox&&vt(d.textCollisionBox.collisionVertexArray,Rt.text.placed,!pi||Ir,di.x,di.y)}var hi=Boolean(!Ir&&vi.verticalIconBox);vi.iconBox&&vt(d.iconCollisionBox.collisionVertexArray,Rt.icon.placed,hi,Ce?di.x:0,Ce?di.y:0),vi.verticalIconBox&&vt(d.iconCollisionBox.collisionVertexArray,Rt.icon.placed,!hi,Ce?di.x:0,Ce?di.y:0)}}},Ze=0;Ze<d.symbolInstances.length;Ze++)Ue(Ze);if(d.sortFeatures(this.transform.angle),this.retainedQueryData[d.bucketInstanceId]&&(this.retainedQueryData[d.bucketInstanceId].featureSortOrder=d.featureSortOrder),d.hasTextData()&&d.text.opacityVertexBuffer&&d.text.opacityVertexBuffer.updateData(d.text.opacityVertexArray),d.hasIconData()&&d.icon.opacityVertexBuffer&&d.icon.opacityVertexBuffer.updateData(d.icon.opacityVertexArray),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexBuffer&&d.iconCollisionBox.collisionVertexBuffer.updateData(d.iconCollisionBox.collisionVertexArray),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexBuffer&&d.textCollisionBox.collisionVertexBuffer.updateData(d.textCollisionBox.collisionVertexArray),d.bucketInstanceId in this.collisionCircleArrays){var Ne=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=Ne.invProjMatrix,d.placementViewportMatrix=Ne.viewportMatrix,d.collisionCircleArray=Ne.circles,delete this.collisionCircleArrays[d.bucketInstanceId]}},Je.prototype.symbolFadeChange=function(d){return this.fadeDuration===0?1:(d-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},Je.prototype.zoomAdjustment=function(d){return Math.max(0,(this.transform.zoom-d)/1.5)},Je.prototype.hasTransitions=function(d){return this.stale||d-this.lastPlacementChangeTime<this.fadeDuration},Je.prototype.stillRecent=function(d,_){var p=this.zoomAtLastRecencyCheck===_?1-this.zoomAdjustment(_):1;return this.zoomAtLastRecencyCheck=_,this.commitTime+this.fadeDuration*p>d},Je.prototype.setStale=function(){this.stale=!0};var tr=Math.pow(2,25),qr=Math.pow(2,24),sn=Math.pow(2,17),Co=Math.pow(2,16),ts=Math.pow(2,9),vs=Math.pow(2,8),Sa=Math.pow(2,1);function np(d){if(d.opacity===0&&!d.placed)return 0;if(d.opacity===1&&d.placed)return 4294967295;var _=d.placed?1:0,p=Math.floor(127*d.opacity);return p*tr+_*qr+p*sn+_*Co+p*ts+_*vs+p*Sa+_}var $u=0,Wh=function(d){this._sortAcrossTiles=d.layout.get("symbol-z-order")!=="viewport-y"&&d.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};Wh.prototype.continuePlacement=function(d,_,p,b,B){for(var k=this._bucketParts;this._currentTileIndex<d.length;)if(_.getBucketParts(k,b,d[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,B())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,k.sort(function(V,q){return V.sortKey-q.sortKey}));this._currentPartIndex<k.length;)if(_.placeLayerBucketPart(k[this._currentPartIndex],this._seenCrossTileIDs,p),this._currentPartIndex++,B())return!0;return!1};var Wf=function(d,_,p,b,B,k,V){this.placement=new Je(d,B,k,V),this._currentPlacementIndex=_.length-1,this._forceFullPlacement=p,this._showCollisionBoxes=b,this._done=!1};Wf.prototype.isDone=function(){return this._done},Wf.prototype.continuePlacement=function(d,_,p){for(var b=this,B=n.browser.now(),k=function(){var re=n.browser.now()-B;return!b._forceFullPlacement&&re>2};this._currentPlacementIndex>=0;){var V=_[d[this._currentPlacementIndex]],q=this.placement.collisionIndex.transform.zoom;if(V.type==="symbol"&&(!V.minzoom||V.minzoom<=q)&&(!V.maxzoom||V.maxzoom>q)){if(this._inProgressLayer||(this._inProgressLayer=new Wh(V)),this._inProgressLayer.continuePlacement(p[V.source],this.placement,this._showCollisionBoxes,V,k))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},Wf.prototype.commit=function(d){return this.placement.commit(d),this.placement};var RA=512/n.EXTENT/2,ef=function(d,_,p){this.tileID=d,this.indexedSymbolInstances={},this.bucketInstanceId=p;for(var b=0;b<_.length;b++){var B=_.get(b),k=B.key;this.indexedSymbolInstances[k]||(this.indexedSymbolInstances[k]=[]),this.indexedSymbolInstances[k].push({crossTileID:B.crossTileID,coord:this.getScaledCoordinates(B,d)})}};ef.prototype.getScaledCoordinates=function(d,_){var p=RA/Math.pow(2,_.canonical.z-this.tileID.canonical.z);return{x:Math.floor((_.canonical.x*n.EXTENT+d.anchorX)*p),y:Math.floor((_.canonical.y*n.EXTENT+d.anchorY)*p)}},ef.prototype.findMatches=function(d,_,p){for(var b=this.tileID.canonical.z<_.canonical.z?1:Math.pow(2,this.tileID.canonical.z-_.canonical.z),B=0;B<d.length;B++){var k=d.get(B);if(!k.crossTileID){var V=this.indexedSymbolInstances[k.key];if(V)for(var q=this.getScaledCoordinates(k,_),re=0,ue=V;re<ue.length;re+=1){var Ee=ue[re];if(Math.abs(Ee.coord.x-q.x)<=b&&Math.abs(Ee.coord.y-q.y)<=b&&!p[Ee.crossTileID]){p[Ee.crossTileID]=!0,k.crossTileID=Ee.crossTileID;break}}}}};var ul=function(){this.maxCrossTileID=0};ul.prototype.generate=function(){return++this.maxCrossTileID};var Nc=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};Nc.prototype.handleWrapJump=function(d){var _=Math.round((d-this.lng)/360);if(_!==0)for(var p in this.indexes){var b=this.indexes[p],B={};for(var k in b){var V=b[k];V.tileID=V.tileID.unwrapTo(V.tileID.wrap+_),B[V.tileID.key]=V}this.indexes[p]=B}this.lng=d},Nc.prototype.addBucket=function(d,_,p){if(this.indexes[d.overscaledZ]&&this.indexes[d.overscaledZ][d.key]){if(this.indexes[d.overscaledZ][d.key].bucketInstanceId===_.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(d.overscaledZ,this.indexes[d.overscaledZ][d.key])}for(var b=0;b<_.symbolInstances.length;b++)_.symbolInstances.get(b).crossTileID=0;this.usedCrossTileIDs[d.overscaledZ]||(this.usedCrossTileIDs[d.overscaledZ]={});var B=this.usedCrossTileIDs[d.overscaledZ];for(var k in this.indexes){var V=this.indexes[k];if(Number(k)>d.overscaledZ)for(var q in V){var re=V[q];re.tileID.isChildOf(d)&&re.findMatches(_.symbolInstances,d,B)}else{var ue=V[d.scaledTo(Number(k)).key];ue&&ue.findMatches(_.symbolInstances,d,B)}}for(var Ee=0;Ee<_.symbolInstances.length;Ee++){var Ce=_.symbolInstances.get(Ee);Ce.crossTileID||(Ce.crossTileID=p.generate(),B[Ce.crossTileID]=!0)}return this.indexes[d.overscaledZ]===void 0&&(this.indexes[d.overscaledZ]={}),this.indexes[d.overscaledZ][d.key]=new ef(d,_.symbolInstances,_.bucketInstanceId),!0},Nc.prototype.removeBucketCrossTileIDs=function(d,_){for(var p in _.indexedSymbolInstances)for(var b=0,B=_.indexedSymbolInstances[p];b<B.length;b+=1)delete this.usedCrossTileIDs[d][B[b].crossTileID]},Nc.prototype.removeStaleBuckets=function(d){var _=!1;for(var p in this.indexes){var b=this.indexes[p];for(var B in b)d[b[B].bucketInstanceId]||(this.removeBucketCrossTileIDs(p,b[B]),delete b[B],_=!0)}return _};var kc=function(){this.layerIndexes={},this.crossTileIDs=new ul,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};kc.prototype.addLayer=function(d,_,p){var b=this.layerIndexes[d.id];b===void 0&&(b=this.layerIndexes[d.id]=new Nc);var B=!1,k={};b.handleWrapJump(p);for(var V=0,q=_;V<q.length;V+=1){var re=q[V],ue=re.getBucket(d);ue&&d.id===ue.layerIds[0]&&(ue.bucketInstanceId||(ue.bucketInstanceId=++this.maxBucketInstanceId),b.addBucket(re.tileID,ue,this.crossTileIDs)&&(B=!0),k[ue.bucketInstanceId]=!0)}return b.removeStaleBuckets(k)&&(B=!0),B},kc.prototype.pruneUnusedLayers=function(d){var _={};for(var p in d.forEach(function(b){_[b]=!0}),this.layerIndexes)_[p]||delete this.layerIndexes[p]};var cu=function(d,_){return n.emitValidationErrors(d,_&&_.filter(function(p){return p.identifier!=="source.canvas"}))},Uc=n.pick(lr,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),zc=n.pick(lr,["setCenter","setZoom","setBearing","setPitch"]),qh=function(){var d={},_=n.styleSpec.$version;for(var p in n.styleSpec.$root){var b,B=n.styleSpec.$root[p];B.required&&(b=p==="version"?_:B.type==="array"?[]:{})!=null&&(d[p]=b)}return d}(),fa=function(d){function _(p,b){var B=this;b===void 0&&(b={}),d.call(this),this.map=p,this.dispatcher=new Oe(Ot(),this),this.imageManager=new z,this.imageManager.setEventedParent(this),this.glyphManager=new me(p._requestManager,b.localIdeographFontFamily),this.lineAtlas=new we(256,512),this.crossTileSymbolIndex=new kc,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new n.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",n.getReferrer());var k=this;this._rtlTextPluginCallback=_.registerForPluginStateChange(function(V){k.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:V.pluginStatus,pluginURL:V.pluginURL},function(q,re){if(n.triggerPluginCompletionEvent(q),re&&re.every(function(Ee){return Ee}))for(var ue in k.sourceCaches)k.sourceCaches[ue].reload()})}),this.on("data",function(V){if(V.dataType==="source"&&V.sourceDataType==="metadata"){var q=B.sourceCaches[V.sourceId];if(q){var re=q.getSource();if(re&&re.vectorLayerIds)for(var ue in B._layers){var Ee=B._layers[ue];Ee.source===re.id&&B._validateLayer(Ee)}}}})}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.loadURL=function(p,b){var B=this;b===void 0&&(b={}),this.fire(new n.Event("dataloading",{dataType:"style"}));var k=typeof b.validate=="boolean"?b.validate:!n.isMapboxURL(p);p=this.map._requestManager.normalizeStyleURL(p,b.accessToken);var V=this.map._requestManager.transformRequest(p,n.ResourceType.Style);this._request=n.getJSON(V,function(q,re){B._request=null,q?B.fire(new n.ErrorEvent(q)):re&&B._load(re,k)})},_.prototype.loadJSON=function(p,b){var B=this;b===void 0&&(b={}),this.fire(new n.Event("dataloading",{dataType:"style"})),this._request=n.browser.frame(function(){B._request=null,B._load(p,b.validate!==!1)})},_.prototype.loadEmpty=function(){this.fire(new n.Event("dataloading",{dataType:"style"})),this._load(qh,!1)},_.prototype._load=function(p,b){if(!b||!cu(this,n.validateStyle(p))){for(var B in this._loaded=!0,this.stylesheet=p,p.sources)this.addSource(B,p.sources[B],{validate:!1});p.sprite?this._loadSprite(p.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(p.glyphs);var k=sr(this.stylesheet.layers);this._order=k.map(function(ue){return ue.id}),this._layers={},this._serializedLayers={};for(var V=0,q=k;V<q.length;V+=1){var re=q[V];(re=n.createStyleLayer(re)).setEventedParent(this,{layer:{id:re.id}}),this._layers[re.id]=re,this._serializedLayers[re.id]=re.serialize()}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Z(this.stylesheet.light),this.fire(new n.Event("data",{dataType:"style"})),this.fire(new n.Event("style.load"))}},_.prototype._loadSprite=function(p){var b=this;this._spriteRequest=function(B,k,V){var q,re,ue,Ee=n.browser.devicePixelRatio>1?"@2x":"",Ce=n.getJSON(k.transformRequest(k.normalizeSpriteURL(B,Ee,".json"),n.ResourceType.SpriteJSON),function(Ue,Ze){Ce=null,ue||(ue=Ue,q=Ze,He())}),Me=n.getImage(k.transformRequest(k.normalizeSpriteURL(B,Ee,".png"),n.ResourceType.SpriteImage),function(Ue,Ze){Me=null,ue||(ue=Ue,re=Ze,He())});function He(){if(ue)V(ue);else if(q&&re){var Ue=n.browser.getImageData(re),Ze={};for(var Ne in q){var Ke=q[Ne],it=Ke.width,pt=Ke.height,Ct=Ke.x,xt=Ke.y,Rt=Ke.sdf,Wt=Ke.pixelRatio,ar=Ke.stretchX,ir=Ke.stretchY,Ir=Ke.content,ti=new n.RGBAImage({width:it,height:pt});n.RGBAImage.copy(Ue,ti,{x:Ct,y:xt},{x:0,y:0},{width:it,height:pt}),Ze[Ne]={data:ti,pixelRatio:Wt,sdf:Rt,stretchX:ar,stretchY:ir,content:Ir}}V(null,Ze)}}return{cancel:function(){Ce&&(Ce.cancel(),Ce=null),Me&&(Me.cancel(),Me=null)}}}(p,this.map._requestManager,function(B,k){if(b._spriteRequest=null,B)b.fire(new n.ErrorEvent(B));else if(k)for(var V in k)b.imageManager.addImage(V,k[V]);b.imageManager.setLoaded(!0),b._availableImages=b.imageManager.listImages(),b.dispatcher.broadcast("setImages",b._availableImages),b.fire(new n.Event("data",{dataType:"style"}))})},_.prototype._validateLayer=function(p){var b=this.sourceCaches[p.source];if(b){var B=p.sourceLayer;if(B){var k=b.getSource();(k.type==="geojson"||k.vectorLayerIds&&k.vectorLayerIds.indexOf(B)===-1)&&this.fire(new n.ErrorEvent(new Error('Source layer "'+B+'" does not exist on source "'+k.id+'" as specified by style layer "'+p.id+'"')))}}},_.prototype.loaded=function(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(var p in this.sourceCaches)if(!this.sourceCaches[p].loaded())return!1;return!!this.imageManager.isLoaded()},_.prototype._serializeLayers=function(p){for(var b=[],B=0,k=p;B<k.length;B+=1){var V=this._layers[k[B]];V.type!=="custom"&&b.push(V.serialize())}return b},_.prototype.hasTransitions=function(){if(this.light&&this.light.hasTransition())return!0;for(var p in this.sourceCaches)if(this.sourceCaches[p].hasTransition())return!0;for(var b in this._layers)if(this._layers[b].hasTransition())return!0;return!1},_.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},_.prototype.update=function(p){if(this._loaded){var b=this._changed;if(this._changed){var B=Object.keys(this._updatedLayers),k=Object.keys(this._removedLayers);for(var V in(B.length||k.length)&&this._updateWorkerLayers(B,k),this._updatedSources){var q=this._updatedSources[V];q==="reload"?this._reloadSource(V):q==="clear"&&this._clearSource(V)}for(var re in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[re].updateTransitions(p);this.light.updateTransitions(p),this._resetUpdates()}var ue={};for(var Ee in this.sourceCaches){var Ce=this.sourceCaches[Ee];ue[Ee]=Ce.used,Ce.used=!1}for(var Me=0,He=this._order;Me<He.length;Me+=1){var Ue=this._layers[He[Me]];Ue.recalculate(p,this._availableImages),!Ue.isHidden(p.zoom)&&Ue.source&&(this.sourceCaches[Ue.source].used=!0)}for(var Ze in ue){var Ne=this.sourceCaches[Ze];ue[Ze]!==Ne.used&&Ne.fire(new n.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:Ze}))}this.light.recalculate(p),this.z=p.zoom,b&&this.fire(new n.Event("data",{dataType:"style"}))}},_.prototype._updateTilesForChangedImages=function(){var p=Object.keys(this._changedImages);if(p.length){for(var b in this.sourceCaches)this.sourceCaches[b].reloadTilesForDependencies(["icons","patterns"],p);this._changedImages={}}},_.prototype._updateWorkerLayers=function(p,b){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(p),removedIds:b})},_.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}},_.prototype.setState=function(p){var b=this;if(this._checkLoaded(),cu(this,n.validateStyle(p)))return!1;(p=n.clone$1(p)).layers=sr(p.layers);var B=function(V,q){if(!V)return[{command:lr.setStyle,args:[q]}];var re=[];try{if(!n.deepEqual(V.version,q.version))return[{command:lr.setStyle,args:[q]}];n.deepEqual(V.center,q.center)||re.push({command:lr.setCenter,args:[q.center]}),n.deepEqual(V.zoom,q.zoom)||re.push({command:lr.setZoom,args:[q.zoom]}),n.deepEqual(V.bearing,q.bearing)||re.push({command:lr.setBearing,args:[q.bearing]}),n.deepEqual(V.pitch,q.pitch)||re.push({command:lr.setPitch,args:[q.pitch]}),n.deepEqual(V.sprite,q.sprite)||re.push({command:lr.setSprite,args:[q.sprite]}),n.deepEqual(V.glyphs,q.glyphs)||re.push({command:lr.setGlyphs,args:[q.glyphs]}),n.deepEqual(V.transition,q.transition)||re.push({command:lr.setTransition,args:[q.transition]}),n.deepEqual(V.light,q.light)||re.push({command:lr.setLight,args:[q.light]});var ue={},Ee=[];(function(Me,He,Ue,Ze){var Ne;for(Ne in He=He||{},Me=Me||{})Me.hasOwnProperty(Ne)&&(He.hasOwnProperty(Ne)||pr(Ne,Ue,Ze));for(Ne in He)He.hasOwnProperty(Ne)&&(Me.hasOwnProperty(Ne)?n.deepEqual(Me[Ne],He[Ne])||(Me[Ne].type==="geojson"&&He[Ne].type==="geojson"&&vn(Me,He,Ne)?Ue.push({command:lr.setGeoJSONSourceData,args:[Ne,He[Ne].data]}):Ii(Ne,He,Ue,Ze)):bi(Ne,He,Ue))})(V.sources,q.sources,Ee,ue);var Ce=[];V.layers&&V.layers.forEach(function(Me){ue[Me.source]?re.push({command:lr.removeLayer,args:[Me.id]}):Ce.push(Me)}),re=re.concat(Ee),function(Me,He,Ue){He=He||[];var Ze,Ne,Ke,it,pt,Ct,xt,Rt=(Me=Me||[]).map(Qi),Wt=He.map(Qi),ar=Me.reduce(Li,{}),ir=He.reduce(Li,{}),Ir=Rt.slice(),ti=Object.create(null);for(Ze=0,Ne=0;Ze<Rt.length;Ze++)ir.hasOwnProperty(Ke=Rt[Ze])?Ne++:(Ue.push({command:lr.removeLayer,args:[Ke]}),Ir.splice(Ir.indexOf(Ke,Ne),1));for(Ze=0,Ne=0;Ze<Wt.length;Ze++)Ir[Ir.length-1-Ze]!==(Ke=Wt[Wt.length-1-Ze])&&(ar.hasOwnProperty(Ke)?(Ue.push({command:lr.removeLayer,args:[Ke]}),Ir.splice(Ir.lastIndexOf(Ke,Ir.length-Ne),1)):Ne++,Ue.push({command:lr.addLayer,args:[ir[Ke],Ct=Ir[Ir.length-Ze]]}),Ir.splice(Ir.length-Ze,0,Ke),ti[Ke]=!0);for(Ze=0;Ze<Wt.length;Ze++)if(it=ar[Ke=Wt[Ze]],pt=ir[Ke],!ti[Ke]&&!n.deepEqual(it,pt))if(n.deepEqual(it.source,pt.source)&&n.deepEqual(it["source-layer"],pt["source-layer"])&&n.deepEqual(it.type,pt.type)){for(xt in Di(it.layout,pt.layout,Ue,Ke,null,lr.setLayoutProperty),Di(it.paint,pt.paint,Ue,Ke,null,lr.setPaintProperty),n.deepEqual(it.filter,pt.filter)||Ue.push({command:lr.setFilter,args:[Ke,pt.filter]}),n.deepEqual(it.minzoom,pt.minzoom)&&n.deepEqual(it.maxzoom,pt.maxzoom)||Ue.push({command:lr.setLayerZoomRange,args:[Ke,pt.minzoom,pt.maxzoom]}),it)it.hasOwnProperty(xt)&&xt!=="layout"&&xt!=="paint"&&xt!=="filter"&&xt!=="metadata"&&xt!=="minzoom"&&xt!=="maxzoom"&&(xt.indexOf("paint.")===0?Di(it[xt],pt[xt],Ue,Ke,xt.slice(6),lr.setPaintProperty):n.deepEqual(it[xt],pt[xt])||Ue.push({command:lr.setLayerProperty,args:[Ke,xt,pt[xt]]}));for(xt in pt)pt.hasOwnProperty(xt)&&!it.hasOwnProperty(xt)&&xt!=="layout"&&xt!=="paint"&&xt!=="filter"&&xt!=="metadata"&&xt!=="minzoom"&&xt!=="maxzoom"&&(xt.indexOf("paint.")===0?Di(it[xt],pt[xt],Ue,Ke,xt.slice(6),lr.setPaintProperty):n.deepEqual(it[xt],pt[xt])||Ue.push({command:lr.setLayerProperty,args:[Ke,xt,pt[xt]]}))}else Ue.push({command:lr.removeLayer,args:[Ke]}),Ct=Ir[Ir.lastIndexOf(Ke)+1],Ue.push({command:lr.addLayer,args:[pt,Ct]})}(Ce,q.layers,re)}catch(Me){console.warn("Unable to compute style diff:",Me),re=[{command:lr.setStyle,args:[q]}]}return re}(this.serialize(),p).filter(function(V){return!(V.command in zc)});if(B.length===0)return!1;var k=B.filter(function(V){return!(V.command in Uc)});if(k.length>0)throw new Error("Unimplemented: "+k.map(function(V){return V.command}).join(", ")+".");return B.forEach(function(V){V.command!=="setTransition"&&b[V.command].apply(b,V.args)}),this.stylesheet=p,!0},_.prototype.addImage=function(p,b){if(this.getImage(p))return this.fire(new n.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(p,b),this._afterImageUpdated(p)},_.prototype.updateImage=function(p,b){this.imageManager.updateImage(p,b)},_.prototype.getImage=function(p){return this.imageManager.getImage(p)},_.prototype.removeImage=function(p){if(!this.getImage(p))return this.fire(new n.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(p),this._afterImageUpdated(p)},_.prototype._afterImageUpdated=function(p){this._availableImages=this.imageManager.listImages(),this._changedImages[p]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new n.Event("data",{dataType:"style"}))},_.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},_.prototype.addSource=function(p,b,B){var k=this;if(B===void 0&&(B={}),this._checkLoaded(),this.sourceCaches[p]!==void 0)throw new Error("There is already a source with this ID");if(!b.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(b).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(b.type)>=0&&this._validate(n.validateStyle.source,"sources."+p,b,null,B))){this.map&&this.map._collectResourceTiming&&(b.collectResourceTiming=!0);var V=this.sourceCaches[p]=new Ge(p,b,this.dispatcher);V.style=this,V.setEventedParent(this,function(){return{isSourceLoaded:k.loaded(),source:V.serialize(),sourceId:p}}),V.onAdd(this.map),this._changed=!0}},_.prototype.removeSource=function(p){if(this._checkLoaded(),this.sourceCaches[p]===void 0)throw new Error("There is no source with this ID");for(var b in this._layers)if(this._layers[b].source===p)return this.fire(new n.ErrorEvent(new Error('Source "'+p+'" cannot be removed while layer "'+b+'" is using it.')));var B=this.sourceCaches[p];delete this.sourceCaches[p],delete this._updatedSources[p],B.fire(new n.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:p})),B.setEventedParent(null),B.clearTiles(),B.onRemove&&B.onRemove(this.map),this._changed=!0},_.prototype.setGeoJSONSourceData=function(p,b){this._checkLoaded(),this.sourceCaches[p].getSource().setData(b),this._changed=!0},_.prototype.getSource=function(p){return this.sourceCaches[p]&&this.sourceCaches[p].getSource()},_.prototype.addLayer=function(p,b,B){B===void 0&&(B={}),this._checkLoaded();var k=p.id;if(this.getLayer(k))this.fire(new n.ErrorEvent(new Error('Layer with id "'+k+'" already exists on this map')));else{var V;if(p.type==="custom"){if(cu(this,n.validateCustomStyleLayer(p)))return;V=n.createStyleLayer(p)}else{if(typeof p.source=="object"&&(this.addSource(k,p.source),p=n.clone$1(p),p=n.extend(p,{source:k})),this._validate(n.validateStyle.layer,"layers."+k,p,{arrayIndex:-1},B))return;V=n.createStyleLayer(p),this._validateLayer(V),V.setEventedParent(this,{layer:{id:k}}),this._serializedLayers[V.id]=V.serialize()}var q=b?this._order.indexOf(b):this._order.length;if(b&&q===-1)this.fire(new n.ErrorEvent(new Error('Layer with id "'+b+'" does not exist on this map.')));else{if(this._order.splice(q,0,k),this._layerOrderChanged=!0,this._layers[k]=V,this._removedLayers[k]&&V.source&&V.type!=="custom"){var re=this._removedLayers[k];delete this._removedLayers[k],re.type!==V.type?this._updatedSources[V.source]="clear":(this._updatedSources[V.source]="reload",this.sourceCaches[V.source].pause())}this._updateLayer(V),V.onAdd&&V.onAdd(this.map)}}},_.prototype.moveLayer=function(p,b){if(this._checkLoaded(),this._changed=!0,this._layers[p]){if(p!==b){var B=this._order.indexOf(p);this._order.splice(B,1);var k=b?this._order.indexOf(b):this._order.length;b&&k===-1?this.fire(new n.ErrorEvent(new Error('Layer with id "'+b+'" does not exist on this map.'))):(this._order.splice(k,0,p),this._layerOrderChanged=!0)}}else this.fire(new n.ErrorEvent(new Error("The layer '"+p+"' does not exist in the map's style and cannot be moved.")))},_.prototype.removeLayer=function(p){this._checkLoaded();var b=this._layers[p];if(b){b.setEventedParent(null);var B=this._order.indexOf(p);this._order.splice(B,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[p]=b,delete this._layers[p],delete this._serializedLayers[p],delete this._updatedLayers[p],delete this._updatedPaintProps[p],b.onRemove&&b.onRemove(this.map)}else this.fire(new n.ErrorEvent(new Error("The layer '"+p+"' does not exist in the map's style and cannot be removed.")))},_.prototype.getLayer=function(p){return this._layers[p]},_.prototype.hasLayer=function(p){return p in this._layers},_.prototype.setLayerZoomRange=function(p,b,B){this._checkLoaded();var k=this.getLayer(p);k?k.minzoom===b&&k.maxzoom===B||(b!=null&&(k.minzoom=b),B!=null&&(k.maxzoom=B),this._updateLayer(k)):this.fire(new n.ErrorEvent(new Error("The layer '"+p+"' does not exist in the map's style and cannot have zoom extent.")))},_.prototype.setFilter=function(p,b,B){B===void 0&&(B={}),this._checkLoaded();var k=this.getLayer(p);if(k){if(!n.deepEqual(k.filter,b))return b==null?(k.filter=void 0,void this._updateLayer(k)):void(this._validate(n.validateStyle.filter,"layers."+k.id+".filter",b,null,B)||(k.filter=n.clone$1(b),this._updateLayer(k)))}else this.fire(new n.ErrorEvent(new Error("The layer '"+p+"' does not exist in the map's style and cannot be filtered.")))},_.prototype.getFilter=function(p){return n.clone$1(this.getLayer(p).filter)},_.prototype.setLayoutProperty=function(p,b,B,k){k===void 0&&(k={}),this._checkLoaded();var V=this.getLayer(p);V?n.deepEqual(V.getLayoutProperty(b),B)||(V.setLayoutProperty(b,B,k),this._updateLayer(V)):this.fire(new n.ErrorEvent(new Error("The layer '"+p+"' does not exist in the map's style and cannot be styled.")))},_.prototype.getLayoutProperty=function(p,b){var B=this.getLayer(p);if(B)return B.getLayoutProperty(b);this.fire(new n.ErrorEvent(new Error("The layer '"+p+"' does not exist in the map's style.")))},_.prototype.setPaintProperty=function(p,b,B,k){k===void 0&&(k={}),this._checkLoaded();var V=this.getLayer(p);V?n.deepEqual(V.getPaintProperty(b),B)||(V.setPaintProperty(b,B,k)&&this._updateLayer(V),this._changed=!0,this._updatedPaintProps[p]=!0):this.fire(new n.ErrorEvent(new Error("The layer '"+p+"' does not exist in the map's style and cannot be styled.")))},_.prototype.getPaintProperty=function(p,b){return this.getLayer(p).getPaintProperty(b)},_.prototype.setFeatureState=function(p,b){this._checkLoaded();var B=p.source,k=p.sourceLayer,V=this.sourceCaches[B];if(V!==void 0){var q=V.getSource().type;q==="geojson"&&k?this.fire(new n.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):q!=="vector"||k?(p.id===void 0&&this.fire(new n.ErrorEvent(new Error("The feature id parameter must be provided."))),V.setFeatureState(k,p.id,b)):this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new n.ErrorEvent(new Error("The source '"+B+"' does not exist in the map's style.")))},_.prototype.removeFeatureState=function(p,b){this._checkLoaded();var B=p.source,k=this.sourceCaches[B];if(k!==void 0){var V=k.getSource().type,q=V==="vector"?p.sourceLayer:void 0;V!=="vector"||q?b&&typeof p.id!="string"&&typeof p.id!="number"?this.fire(new n.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):k.removeFeatureState(q,p.id,b):this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new n.ErrorEvent(new Error("The source '"+B+"' does not exist in the map's style.")))},_.prototype.getFeatureState=function(p){this._checkLoaded();var b=p.source,B=p.sourceLayer,k=this.sourceCaches[b];if(k!==void 0){if(k.getSource().type!=="vector"||B)return p.id===void 0&&this.fire(new n.ErrorEvent(new Error("The feature id parameter must be provided."))),k.getFeatureState(B,p.id);this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new n.ErrorEvent(new Error("The source '"+b+"' does not exist in the map's style.")))},_.prototype.getTransition=function(){return n.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},_.prototype.serialize=function(){return n.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:n.mapObject(this.sourceCaches,function(p){return p.serialize()}),layers:this._serializeLayers(this._order)},function(p){return p!==void 0})},_.prototype._updateLayer=function(p){this._updatedLayers[p.id]=!0,p.source&&!this._updatedSources[p.source]&&this.sourceCaches[p.source].getSource().type!=="raster"&&(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause()),this._changed=!0},_.prototype._flattenAndSortRenderedFeatures=function(p){for(var b=this,B=function(ar){return b._layers[ar].type==="fill-extrusion"},k={},V=[],q=this._order.length-1;q>=0;q--){var re=this._order[q];if(B(re)){k[re]=q;for(var ue=0,Ee=p;ue<Ee.length;ue+=1){var Ce=Ee[ue][re];if(Ce)for(var Me=0,He=Ce;Me<He.length;Me+=1)V.push(He[Me])}}}V.sort(function(ar,ir){return ir.intersectionZ-ar.intersectionZ});for(var Ue=[],Ze=this._order.length-1;Ze>=0;Ze--){var Ne=this._order[Ze];if(B(Ne))for(var Ke=V.length-1;Ke>=0;Ke--){var it=V[Ke].feature;if(k[it.layer.id]<Ze)break;Ue.push(it),V.pop()}else for(var pt=0,Ct=p;pt<Ct.length;pt+=1){var xt=Ct[pt][Ne];if(xt)for(var Rt=0,Wt=xt;Rt<Wt.length;Rt+=1)Ue.push(Wt[Rt].feature)}}return Ue},_.prototype.queryRenderedFeatures=function(p,b,B){b&&b.filter&&this._validate(n.validateStyle.filter,"queryRenderedFeatures.filter",b.filter,null,b);var k={};if(b&&b.layers){if(!Array.isArray(b.layers))return this.fire(new n.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var V=0,q=b.layers;V<q.length;V+=1){var re=q[V],ue=this._layers[re];if(!ue)return this.fire(new n.ErrorEvent(new Error("The layer '"+re+"' does not exist in the map's style and cannot be queried for features."))),[];k[ue.source]=!0}}var Ee=[];for(var Ce in b.availableImages=this._availableImages,this.sourceCaches)b.layers&&!k[Ce]||Ee.push(wi(this.sourceCaches[Ce],this._layers,this._serializedLayers,p,b,B));return this.placement&&Ee.push(function(Me,He,Ue,Ze,Ne,Ke,it){for(var pt={},Ct=Ke.queryRenderedSymbols(Ze),xt=[],Rt=0,Wt=Object.keys(Ct).map(Number);Rt<Wt.length;Rt+=1)xt.push(it[Wt[Rt]]);xt.sort(ae);for(var ar=function(){var ii=Ir[ir],hn=ii.featureIndex.lookupSymbolFeatures(Ct[ii.bucketInstanceId],He,ii.bucketIndex,ii.sourceLayerIndex,Ne.filter,Ne.layers,Ne.availableImages,Me);for(var Or in hn){var yi=pt[Or]=pt[Or]||[],vi=hn[Or];vi.sort(function(Pi,hi){var li=ii.featureSortOrder;if(li){var bs=li.indexOf(Pi.featureIndex);return li.indexOf(hi.featureIndex)-bs}return hi.featureIndex-Pi.featureIndex});for(var di=0,pi=vi;di<pi.length;di+=1)yi.push(pi[di])}},ir=0,Ir=xt;ir<Ir.length;ir+=1)ar();var ti=function(ii){pt[ii].forEach(function(hn){var Or=hn.feature,yi=Ue[Me[ii].source].getFeatureState(Or.layer["source-layer"],Or.id);Or.source=Or.layer.source,Or.layer["source-layer"]&&(Or.sourceLayer=Or.layer["source-layer"]),Or.state=yi})};for(var oi in pt)ti(oi);return pt}(this._layers,this._serializedLayers,this.sourceCaches,p,b,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(Ee)},_.prototype.querySourceFeatures=function(p,b){b&&b.filter&&this._validate(n.validateStyle.filter,"querySourceFeatures.filter",b.filter,null,b);var B=this.sourceCaches[p];return B?function(k,V){for(var q=k.getRenderableIds().map(function(He){return k.getTileByID(He)}),re=[],ue={},Ee=0;Ee<q.length;Ee++){var Ce=q[Ee],Me=Ce.tileID.canonical.key;ue[Me]||(ue[Me]=!0,Ce.querySourceFeatures(re,V))}return re}(B,b):[]},_.prototype.addSourceType=function(p,b,B){return _.getSourceType(p)?B(new Error('A source type called "'+p+'" already exists.')):(_.setSourceType(p,b),b.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:p,url:b.workerSourceURL},B):B(null,null))},_.prototype.getLight=function(){return this.light.getLight()},_.prototype.setLight=function(p,b){b===void 0&&(b={}),this._checkLoaded();var B=this.light.getLight(),k=!1;for(var V in p)if(!n.deepEqual(p[V],B[V])){k=!0;break}if(k){var q={now:n.browser.now(),transition:n.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(p,b),this.light.updateTransitions(q)}},_.prototype._validate=function(p,b,B,k,V){return V===void 0&&(V={}),(!V||V.validate!==!1)&&cu(this,p.call(n.validateStyle,n.extend({key:b,style:this.serialize(),value:B,styleSpec:n.styleSpec},k)))},_.prototype._remove=function(){for(var p in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),n.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[p].setEventedParent(null);for(var b in this.sourceCaches)this.sourceCaches[b].clearTiles(),this.sourceCaches[b].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()},_.prototype._clearSource=function(p){this.sourceCaches[p].clearTiles()},_.prototype._reloadSource=function(p){this.sourceCaches[p].resume(),this.sourceCaches[p].reload()},_.prototype._updateSources=function(p){for(var b in this.sourceCaches)this.sourceCaches[b].update(p)},_.prototype._generateCollisionBoxes=function(){for(var p in this.sourceCaches)this._reloadSource(p)},_.prototype._updatePlacement=function(p,b,B,k,V){V===void 0&&(V=!1);for(var q=!1,re=!1,ue={},Ee=0,Ce=this._order;Ee<Ce.length;Ee+=1){var Me=this._layers[Ce[Ee]];if(Me.type==="symbol"){if(!ue[Me.source]){var He=this.sourceCaches[Me.source];ue[Me.source]=He.getRenderableIds(!0).map(function(it){return He.getTileByID(it)}).sort(function(it,pt){return pt.tileID.overscaledZ-it.tileID.overscaledZ||(it.tileID.isLessThan(pt.tileID)?-1:1)})}var Ue=this.crossTileSymbolIndex.addLayer(Me,ue[Me.source],p.center.lng);q=q||Ue}}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((V=V||this._layerOrderChanged||B===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(n.browser.now(),p.zoom))&&(this.pauseablePlacement=new Wf(p,this._order,V,b,B,k,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,ue),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(n.browser.now()),re=!0),q&&this.pauseablePlacement.placement.setStale()),re||q)for(var Ze=0,Ne=this._order;Ze<Ne.length;Ze+=1){var Ke=this._layers[Ne[Ze]];Ke.type==="symbol"&&this.placement.updateLayerOpacities(Ke,ue[Ke.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(n.browser.now())},_.prototype._releaseSymbolFadeTiles=function(){for(var p in this.sourceCaches)this.sourceCaches[p].releaseSymbolFadeTiles()},_.prototype.getImages=function(p,b,B){this.imageManager.getImages(b.icons,B),this._updateTilesForChangedImages();var k=this.sourceCaches[b.source];k&&k.setDependencies(b.tileID.key,b.type,b.icons)},_.prototype.getGlyphs=function(p,b,B){this.glyphManager.getGlyphs(b.stacks,B)},_.prototype.getResource=function(p,b,B){return n.makeRequest(b,B)},_}(n.Evented);fa.getSourceType=function(d){return Jt[d]},fa.setSourceType=function(d,_){Jt[d]=_},fa.registerForPluginStateChange=n.registerForPluginStateChange;var Mo=n.createLayout([{name:"a_pos",type:"Int16",components:2}]),uu=dt(`#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;}`),Xh=dt(`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);}"),BA=dt(`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);}"),OA=dt(`varying vec3 v_data;
#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=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;
#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);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,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,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);}`),qf=dt("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);}"),op=dt(`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;}`),sp=dt(`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;}"),ap=dt("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,0.0,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;}"),tf=dt("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);}"),lp=dt("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,0,1);}"),cp=dt(`#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);}`),Xf=dt(`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;}`),Yf=dt(`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;}`),DA=dt(`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);}`),P=dt(`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;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;base=max(0.0,base);height=max(0.0,height);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;}`),U=dt(`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;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;base=max(0.0,base);height=max(0.0,height);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;}`),G=dt(`#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;}"),Q=dt(`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;}"),le=dt(`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;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;v_width2=vec2(outset,inset);}`),ce=dt(`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;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;v_width2=vec2(outset,inset);}`),_e=dt(`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;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;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),Qe=dt(`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;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;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);}`),qe=dt(`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;}"),ct=dt(`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;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,0,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),0,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,0.0,1.0);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),0.0,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;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}`),Nt=dt(`#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 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 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;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,0,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),0,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,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;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(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),jt=dt(`#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;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,0,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),0,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,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;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(1.0,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);}`);function dt(d,_){var p=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,b=_.match(/attribute ([\w]+) ([\w]+)/g),B=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),k=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),V=k?k.concat(B):B,q={};return{fragmentSource:d=d.replace(p,function(re,ue,Ee,Ce,Me){return q[Me]=!0,ue==="define"?`
#ifndef HAS_UNIFORM_u_`+Me+`
varying `+Ee+" "+Ce+" "+Me+`;
#else
uniform `+Ee+" "+Ce+" u_"+Me+`;
#endif
`:`
#ifdef HAS_UNIFORM_u_`+Me+`
`+Ee+" "+Ce+" "+Me+" = u_"+Me+`;
#endif
`}),vertexSource:_=_.replace(p,function(re,ue,Ee,Ce,Me){var He=Ce==="float"?"vec2":"vec4",Ue=Me.match(/color/)?"color":He;return q[Me]?ue==="define"?`
#ifndef HAS_UNIFORM_u_`+Me+`
uniform lowp float u_`+Me+`_t;
attribute `+Ee+" "+He+" a_"+Me+`;
varying `+Ee+" "+Ce+" "+Me+`;
#else
uniform `+Ee+" "+Ce+" u_"+Me+`;
#endif
`:Ue==="vec4"?`
#ifndef HAS_UNIFORM_u_`+Me+`
`+Me+" = a_"+Me+`;
#else
`+Ee+" "+Ce+" "+Me+" = u_"+Me+`;
#endif
`:`
#ifndef HAS_UNIFORM_u_`+Me+`
`+Me+" = unpack_mix_"+Ue+"(a_"+Me+", u_"+Me+`_t);
#else
`+Ee+" "+Ce+" "+Me+" = u_"+Me+`;
#endif
`:ue==="define"?`
#ifndef HAS_UNIFORM_u_`+Me+`
uniform lowp float u_`+Me+`_t;
attribute `+Ee+" "+He+" a_"+Me+`;
#else
uniform `+Ee+" "+Ce+" u_"+Me+`;
#endif
`:Ue==="vec4"?`
#ifndef HAS_UNIFORM_u_`+Me+`
`+Ee+" "+Ce+" "+Me+" = a_"+Me+`;
#else
`+Ee+" "+Ce+" "+Me+" = u_"+Me+`;
#endif
`:`
#ifndef HAS_UNIFORM_u_`+Me+`
`+Ee+" "+Ce+" "+Me+" = unpack_mix_"+Ue+"(a_"+Me+", u_"+Me+`_t);
#else
`+Ee+" "+Ce+" "+Me+" = u_"+Me+`;
#endif
`}),staticAttributes:b,staticUniforms:V}}var fr=Object.freeze({__proto__:null,prelude:uu,background:Xh,backgroundPattern:BA,circle:OA,clippingMask:qf,heatmap:op,heatmapTexture:sp,collisionBox:ap,collisionCircle:tf,debug:lp,fill:cp,fillOutline:Xf,fillOutlinePattern:Yf,fillPattern:DA,fillExtrusion:P,fillExtrusionPattern:U,hillshadePrepare:G,hillshade:Q,line:le,lineGradient:ce,linePattern:_e,lineSDF:Qe,raster:qe,symbolIcon:ct,symbolSDF:Nt,symbolTextAndIcon:jt}),mi=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function ut(d){for(var _=[],p=0;p<d.length;p++)if(d[p]!==null){var b=d[p].split(" ");_.push(b.pop())}return _}mi.prototype.bind=function(d,_,p,b,B,k,V,q){this.context=d;for(var re=this.boundPaintVertexBuffers.length!==b.length,ue=0;!re&&ue<b.length;ue++)this.boundPaintVertexBuffers[ue]!==b[ue]&&(re=!0);d.extVertexArrayObject&&this.vao&&this.boundProgram===_&&this.boundLayoutVertexBuffer===p&&!re&&this.boundIndexBuffer===B&&this.boundVertexOffset===k&&this.boundDynamicVertexBuffer===V&&this.boundDynamicVertexBuffer2===q?(d.bindVertexArrayOES.set(this.vao),V&&V.bind(),B&&B.dynamicDraw&&B.bind(),q&&q.bind()):this.freshBind(_,p,b,B,k,V,q)},mi.prototype.freshBind=function(d,_,p,b,B,k,V){var q,re=d.numAttributes,ue=this.context,Ee=ue.gl;if(ue.extVertexArrayObject)this.vao&&this.destroy(),this.vao=ue.extVertexArrayObject.createVertexArrayOES(),ue.bindVertexArrayOES.set(this.vao),q=0,this.boundProgram=d,this.boundLayoutVertexBuffer=_,this.boundPaintVertexBuffers=p,this.boundIndexBuffer=b,this.boundVertexOffset=B,this.boundDynamicVertexBuffer=k,this.boundDynamicVertexBuffer2=V;else{q=ue.currentNumAttributes||0;for(var Ce=re;Ce<q;Ce++)Ee.disableVertexAttribArray(Ce)}_.enableAttributes(Ee,d);for(var Me=0,He=p;Me<He.length;Me+=1)He[Me].enableAttributes(Ee,d);k&&k.enableAttributes(Ee,d),V&&V.enableAttributes(Ee,d),_.bind(),_.setVertexAttribPointers(Ee,d,B);for(var Ue=0,Ze=p;Ue<Ze.length;Ue+=1){var Ne=Ze[Ue];Ne.bind(),Ne.setVertexAttribPointers(Ee,d,B)}k&&(k.bind(),k.setVertexAttribPointers(Ee,d,B)),b&&b.bind(),V&&(V.bind(),V.setVertexAttribPointers(Ee,d,B)),ue.currentNumAttributes=re},mi.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var St=function(d,_,p,b,B,k){var V=d.gl;this.program=V.createProgram();for(var q=ut(p.staticAttributes),re=b?b.getBinderAttributes():[],ue=q.concat(re),Ee=p.staticUniforms?ut(p.staticUniforms):[],Ce=b?b.getBinderUniforms():[],Me=[],He=0,Ue=Ee.concat(Ce);He<Ue.length;He+=1){var Ze=Ue[He];Me.indexOf(Ze)<0&&Me.push(Ze)}var Ne=b?b.defines():[];k&&Ne.push("#define OVERDRAW_INSPECTOR;");var Ke=Ne.concat(uu.fragmentSource,p.fragmentSource).join(`
`),it=Ne.concat(uu.vertexSource,p.vertexSource).join(`
`),pt=V.createShader(V.FRAGMENT_SHADER);if(V.isContextLost())this.failedToCreate=!0;else{V.shaderSource(pt,Ke),V.compileShader(pt),V.attachShader(this.program,pt);var Ct=V.createShader(V.VERTEX_SHADER);if(V.isContextLost())this.failedToCreate=!0;else{V.shaderSource(Ct,it),V.compileShader(Ct),V.attachShader(this.program,Ct),this.attributes={};var xt={};this.numAttributes=ue.length;for(var Rt=0;Rt<this.numAttributes;Rt++)ue[Rt]&&(V.bindAttribLocation(this.program,Rt,ue[Rt]),this.attributes[ue[Rt]]=Rt);V.linkProgram(this.program),V.deleteShader(Ct),V.deleteShader(pt);for(var Wt=0;Wt<Me.length;Wt++){var ar=Me[Wt];if(ar&&!xt[ar]){var ir=V.getUniformLocation(this.program,ar);ir&&(xt[ar]=ir)}}this.fixedUniforms=B(d,xt),this.binderUniforms=b?b.getUniforms(d,xt):[]}}};function cr(d,_,p){var b=1/pn(p,1,_.transform.tileZoom),B=Math.pow(2,p.tileID.overscaledZ),k=p.tileSize*Math.pow(2,_.transform.tileZoom)/B,V=k*(p.tileID.canonical.x+p.tileID.wrap*B),q=k*p.tileID.canonical.y;return{u_image:0,u_texsize:p.imageAtlasTexture.size,u_scale:[b,d.fromScale,d.toScale],u_fade:d.t,u_pixel_coord_upper:[V>>16,q>>16],u_pixel_coord_lower:[65535&V,65535&q]}}St.prototype.draw=function(d,_,p,b,B,k,V,q,re,ue,Ee,Ce,Me,He,Ue,Ze){var Ne,Ke=d.gl;if(!this.failedToCreate){for(var it in d.program.set(this.program),d.setDepthMode(p),d.setStencilMode(b),d.setColorMode(B),d.setCullFace(k),this.fixedUniforms)this.fixedUniforms[it].set(V[it]);He&&He.setUniforms(d,this.binderUniforms,Ce,{zoom:Me});for(var pt=(Ne={},Ne[Ke.LINES]=2,Ne[Ke.TRIANGLES]=3,Ne[Ke.LINE_STRIP]=1,Ne)[_],Ct=0,xt=Ee.get();Ct<xt.length;Ct+=1){var Rt=xt[Ct],Wt=Rt.vaos||(Rt.vaos={});(Wt[q]||(Wt[q]=new mi)).bind(d,this,re,He?He.getPaintVertexBuffers():[],ue,Rt.vertexOffset,Ue,Ze),Ke.drawElements(_,Rt.primitiveLength*pt,Ke.UNSIGNED_SHORT,Rt.primitiveOffset*pt*2)}}};var Xr=function(d,_,p,b){var B=_.style.light,k=B.properties.get("position"),V=[k.x,k.y,k.z],q=n.create$1();B.properties.get("anchor")==="viewport"&&n.fromRotation(q,-_.transform.angle),n.transformMat3(V,V,q);var re=B.properties.get("color");return{u_matrix:d,u_lightpos:V,u_lightintensity:B.properties.get("intensity"),u_lightcolor:[re.r,re.g,re.b],u_vertical_gradient:+p,u_opacity:b}},g=function(d,_,p,b,B,k,V){return n.extend(Xr(d,_,p,b),cr(k,_,V),{u_height_factor:-Math.pow(2,B.overscaledZ)/V.tileSize/8})},ki=function(d){return{u_matrix:d}},Wr=function(d,_,p,b){return n.extend(ki(d),cr(p,_,b))},Re=function(d,_){return{u_matrix:d,u_world:_}},Ti=function(d,_,p,b,B){return n.extend(Wr(d,_,p,b),{u_world:B})},An=function(d,_,p,b){var B,k,V=d.transform;if(b.paint.get("circle-pitch-alignment")==="map"){var q=pn(p,1,V.zoom);B=!0,k=[q,q]}else B=!1,k=V.pixelsToGLUnits;return{u_camera_to_center_distance:V.cameraToCenterDistance,u_scale_with_map:+(b.paint.get("circle-pitch-scale")==="map"),u_matrix:d.translatePosMatrix(_.posMatrix,p,b.paint.get("circle-translate"),b.paint.get("circle-translate-anchor")),u_pitch_with_map:+B,u_device_pixel_ratio:n.browser.devicePixelRatio,u_extrude_scale:k}},Qn=function(d,_,p){var b=pn(p,1,_.zoom),B=Math.pow(2,_.zoom-p.tileID.overscaledZ),k=p.tileID.overscaleFactor();return{u_matrix:d,u_camera_to_center_distance:_.cameraToCenterDistance,u_pixels_to_tile_units:b,u_extrude_scale:[_.pixelsToGLUnits[0]/(b*B),_.pixelsToGLUnits[1]/(b*B)],u_overscale_factor:k}},En=function(d,_,p){return{u_matrix:d,u_inv_matrix:_,u_camera_to_center_distance:p.cameraToCenterDistance,u_viewport_size:[p.width,p.height]}},ln=function(d,_,p){return p===void 0&&(p=1),{u_matrix:d,u_color:_,u_overlay:0,u_overlay_scale:p}},$n=function(d){return{u_matrix:d}},ji=function(d,_,p,b){return{u_matrix:d,u_extrude_scale:pn(_,1,p),u_intensity:b}},Gi=function(d,_,p){var b=d.transform;return{u_matrix:Ko(d,_,p),u_ratio:1/pn(_,1,b.zoom),u_device_pixel_ratio:n.browser.devicePixelRatio,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},an=function(d,_,p,b){return n.extend(Gi(d,_,p),{u_image:0,u_image_height:b})},ea=function(d,_,p,b){var B=d.transform,k=Hs(_,B);return{u_matrix:Ko(d,_,p),u_texsize:_.imageAtlasTexture.size,u_ratio:1/pn(_,1,B.zoom),u_device_pixel_ratio:n.browser.devicePixelRatio,u_image:0,u_scale:[k,b.fromScale,b.toScale],u_fade:b.t,u_units_to_pixels:[1/B.pixelsToGLUnits[0],1/B.pixelsToGLUnits[1]]}},Yh=function(d,_,p,b,B){var k=d.lineAtlas,V=Hs(_,d.transform),q=p.layout.get("line-cap")==="round",re=k.getDash(b.from,q),ue=k.getDash(b.to,q),Ee=re.width*B.fromScale,Ce=ue.width*B.toScale;return n.extend(Gi(d,_,p),{u_patternscale_a:[V/Ee,-re.height/2],u_patternscale_b:[V/Ce,-ue.height/2],u_sdfgamma:k.width/(256*Math.min(Ee,Ce)*n.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:re.y,u_tex_y_b:ue.y,u_mix:B.t})};function Hs(d,_){return 1/pn(d,1,_.tileZoom)}function Ko(d,_,p){return d.translatePosMatrix(_.tileID.posMatrix,_,p.paint.get("line-translate"),p.paint.get("line-translate-anchor"))}var fu=function(d,_,p,b,B){return{u_matrix:d,u_tl_parent:_,u_scale_parent:p,u_buffer_scale:1,u_fade_t:b.mix,u_opacity:b.opacity*B.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:B.paint.get("raster-brightness-min"),u_brightness_high:B.paint.get("raster-brightness-max"),u_saturation_factor:(V=B.paint.get("raster-saturation"),V>0?1-1/(1.001-V):-V),u_contrast_factor:(k=B.paint.get("raster-contrast"),k>0?1/(1-k):1+k),u_spin_weights:fl(B.paint.get("raster-hue-rotate"))};var k,V};function fl(d){d*=Math.PI/180;var _=Math.sin(d),p=Math.cos(d);return[(2*p+1)/3,(-Math.sqrt(3)*_-p+1)/3,(Math.sqrt(3)*_-p+1)/3]}var hu,Sn=function(d,_,p,b,B,k,V,q,re,ue){var Ee=B.transform;return{u_is_size_zoom_constant:+(d==="constant"||d==="source"),u_is_size_feature_constant:+(d==="constant"||d==="camera"),u_size_t:_?_.uSizeT:0,u_size:_?_.uSize:0,u_camera_to_center_distance:Ee.cameraToCenterDistance,u_pitch:Ee.pitch/360*2*Math.PI,u_rotate_symbol:+p,u_aspect_ratio:Ee.width/Ee.height,u_fade_change:B.options.fadeDuration?B.symbolFadeChange:1,u_matrix:k,u_label_plane_matrix:V,u_coord_matrix:q,u_is_text:+re,u_pitch_with_map:+b,u_texsize:ue,u_texture:0}},ha=function(d,_,p,b,B,k,V,q,re,ue,Ee){var Ce=B.transform;return n.extend(Sn(d,_,p,b,B,k,V,q,re,ue),{u_gamma_scale:b?Math.cos(Ce._pitch)*Ce.cameraToCenterDistance:1,u_device_pixel_ratio:n.browser.devicePixelRatio,u_is_halo:+Ee})},gi=function(d,_,p,b,B,k,V,q,re,ue){return n.extend(ha(d,_,p,b,B,k,V,q,!0,re,!0),{u_texsize_icon:ue,u_texture_icon:1})},Fe=function(d,_,p){return{u_matrix:d,u_opacity:_,u_color:p}},_i=function(d,_,p,b,B,k){return n.extend(function(V,q,re,ue){var Ee=re.imageManager.getPattern(V.from.toString()),Ce=re.imageManager.getPattern(V.to.toString()),Me=re.imageManager.getPixelSize(),He=Me.width,Ue=Me.height,Ze=Math.pow(2,ue.tileID.overscaledZ),Ne=ue.tileSize*Math.pow(2,re.transform.tileZoom)/Ze,Ke=Ne*(ue.tileID.canonical.x+ue.tileID.wrap*Ze),it=Ne*ue.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Ee.tl,u_pattern_br_a:Ee.br,u_pattern_tl_b:Ce.tl,u_pattern_br_b:Ce.br,u_texsize:[He,Ue],u_mix:q.t,u_pattern_size_a:Ee.displaySize,u_pattern_size_b:Ce.displaySize,u_scale_a:q.fromScale,u_scale_b:q.toScale,u_tile_units_to_pixels:1/pn(ue,1,re.transform.tileZoom),u_pixel_coord_upper:[Ke>>16,it>>16],u_pixel_coord_lower:[65535&Ke,65535&it]}}(b,k,p,B),{u_matrix:d,u_opacity:_})},Kh={fillExtrusion:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_lightpos:new n.Uniform3f(d,_.u_lightpos),u_lightintensity:new n.Uniform1f(d,_.u_lightintensity),u_lightcolor:new n.Uniform3f(d,_.u_lightcolor),u_vertical_gradient:new n.Uniform1f(d,_.u_vertical_gradient),u_opacity:new n.Uniform1f(d,_.u_opacity)}},fillExtrusionPattern:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_lightpos:new n.Uniform3f(d,_.u_lightpos),u_lightintensity:new n.Uniform1f(d,_.u_lightintensity),u_lightcolor:new n.Uniform3f(d,_.u_lightcolor),u_vertical_gradient:new n.Uniform1f(d,_.u_vertical_gradient),u_height_factor:new n.Uniform1f(d,_.u_height_factor),u_image:new n.Uniform1i(d,_.u_image),u_texsize:new n.Uniform2f(d,_.u_texsize),u_pixel_coord_upper:new n.Uniform2f(d,_.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(d,_.u_pixel_coord_lower),u_scale:new n.Uniform3f(d,_.u_scale),u_fade:new n.Uniform1f(d,_.u_fade),u_opacity:new n.Uniform1f(d,_.u_opacity)}},fill:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix)}},fillPattern:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_image:new n.Uniform1i(d,_.u_image),u_texsize:new n.Uniform2f(d,_.u_texsize),u_pixel_coord_upper:new n.Uniform2f(d,_.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(d,_.u_pixel_coord_lower),u_scale:new n.Uniform3f(d,_.u_scale),u_fade:new n.Uniform1f(d,_.u_fade)}},fillOutline:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_world:new n.Uniform2f(d,_.u_world)}},fillOutlinePattern:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_world:new n.Uniform2f(d,_.u_world),u_image:new n.Uniform1i(d,_.u_image),u_texsize:new n.Uniform2f(d,_.u_texsize),u_pixel_coord_upper:new n.Uniform2f(d,_.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(d,_.u_pixel_coord_lower),u_scale:new n.Uniform3f(d,_.u_scale),u_fade:new n.Uniform1f(d,_.u_fade)}},circle:function(d,_){return{u_camera_to_center_distance:new n.Uniform1f(d,_.u_camera_to_center_distance),u_scale_with_map:new n.Uniform1i(d,_.u_scale_with_map),u_pitch_with_map:new n.Uniform1i(d,_.u_pitch_with_map),u_extrude_scale:new n.Uniform2f(d,_.u_extrude_scale),u_device_pixel_ratio:new n.Uniform1f(d,_.u_device_pixel_ratio),u_matrix:new n.UniformMatrix4f(d,_.u_matrix)}},collisionBox:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_camera_to_center_distance:new n.Uniform1f(d,_.u_camera_to_center_distance),u_pixels_to_tile_units:new n.Uniform1f(d,_.u_pixels_to_tile_units),u_extrude_scale:new n.Uniform2f(d,_.u_extrude_scale),u_overscale_factor:new n.Uniform1f(d,_.u_overscale_factor)}},collisionCircle:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_inv_matrix:new n.UniformMatrix4f(d,_.u_inv_matrix),u_camera_to_center_distance:new n.Uniform1f(d,_.u_camera_to_center_distance),u_viewport_size:new n.Uniform2f(d,_.u_viewport_size)}},debug:function(d,_){return{u_color:new n.UniformColor(d,_.u_color),u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_overlay:new n.Uniform1i(d,_.u_overlay),u_overlay_scale:new n.Uniform1f(d,_.u_overlay_scale)}},clippingMask:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix)}},heatmap:function(d,_){return{u_extrude_scale:new n.Uniform1f(d,_.u_extrude_scale),u_intensity:new n.Uniform1f(d,_.u_intensity),u_matrix:new n.UniformMatrix4f(d,_.u_matrix)}},heatmapTexture:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_world:new n.Uniform2f(d,_.u_world),u_image:new n.Uniform1i(d,_.u_image),u_color_ramp:new n.Uniform1i(d,_.u_color_ramp),u_opacity:new n.Uniform1f(d,_.u_opacity)}},hillshade:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_image:new n.Uniform1i(d,_.u_image),u_latrange:new n.Uniform2f(d,_.u_latrange),u_light:new n.Uniform2f(d,_.u_light),u_shadow:new n.UniformColor(d,_.u_shadow),u_highlight:new n.UniformColor(d,_.u_highlight),u_accent:new n.UniformColor(d,_.u_accent)}},hillshadePrepare:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_image:new n.Uniform1i(d,_.u_image),u_dimension:new n.Uniform2f(d,_.u_dimension),u_zoom:new n.Uniform1f(d,_.u_zoom),u_unpack:new n.Uniform4f(d,_.u_unpack)}},line:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_ratio:new n.Uniform1f(d,_.u_ratio),u_device_pixel_ratio:new n.Uniform1f(d,_.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(d,_.u_units_to_pixels)}},lineGradient:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_ratio:new n.Uniform1f(d,_.u_ratio),u_device_pixel_ratio:new n.Uniform1f(d,_.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(d,_.u_units_to_pixels),u_image:new n.Uniform1i(d,_.u_image),u_image_height:new n.Uniform1f(d,_.u_image_height)}},linePattern:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_texsize:new n.Uniform2f(d,_.u_texsize),u_ratio:new n.Uniform1f(d,_.u_ratio),u_device_pixel_ratio:new n.Uniform1f(d,_.u_device_pixel_ratio),u_image:new n.Uniform1i(d,_.u_image),u_units_to_pixels:new n.Uniform2f(d,_.u_units_to_pixels),u_scale:new n.Uniform3f(d,_.u_scale),u_fade:new n.Uniform1f(d,_.u_fade)}},lineSDF:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_ratio:new n.Uniform1f(d,_.u_ratio),u_device_pixel_ratio:new n.Uniform1f(d,_.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(d,_.u_units_to_pixels),u_patternscale_a:new n.Uniform2f(d,_.u_patternscale_a),u_patternscale_b:new n.Uniform2f(d,_.u_patternscale_b),u_sdfgamma:new n.Uniform1f(d,_.u_sdfgamma),u_image:new n.Uniform1i(d,_.u_image),u_tex_y_a:new n.Uniform1f(d,_.u_tex_y_a),u_tex_y_b:new n.Uniform1f(d,_.u_tex_y_b),u_mix:new n.Uniform1f(d,_.u_mix)}},raster:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_tl_parent:new n.Uniform2f(d,_.u_tl_parent),u_scale_parent:new n.Uniform1f(d,_.u_scale_parent),u_buffer_scale:new n.Uniform1f(d,_.u_buffer_scale),u_fade_t:new n.Uniform1f(d,_.u_fade_t),u_opacity:new n.Uniform1f(d,_.u_opacity),u_image0:new n.Uniform1i(d,_.u_image0),u_image1:new n.Uniform1i(d,_.u_image1),u_brightness_low:new n.Uniform1f(d,_.u_brightness_low),u_brightness_high:new n.Uniform1f(d,_.u_brightness_high),u_saturation_factor:new n.Uniform1f(d,_.u_saturation_factor),u_contrast_factor:new n.Uniform1f(d,_.u_contrast_factor),u_spin_weights:new n.Uniform3f(d,_.u_spin_weights)}},symbolIcon:function(d,_){return{u_is_size_zoom_constant:new n.Uniform1i(d,_.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(d,_.u_is_size_feature_constant),u_size_t:new n.Uniform1f(d,_.u_size_t),u_size:new n.Uniform1f(d,_.u_size),u_camera_to_center_distance:new n.Uniform1f(d,_.u_camera_to_center_distance),u_pitch:new n.Uniform1f(d,_.u_pitch),u_rotate_symbol:new n.Uniform1i(d,_.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(d,_.u_aspect_ratio),u_fade_change:new n.Uniform1f(d,_.u_fade_change),u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(d,_.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(d,_.u_coord_matrix),u_is_text:new n.Uniform1i(d,_.u_is_text),u_pitch_with_map:new n.Uniform1i(d,_.u_pitch_with_map),u_texsize:new n.Uniform2f(d,_.u_texsize),u_texture:new n.Uniform1i(d,_.u_texture)}},symbolSDF:function(d,_){return{u_is_size_zoom_constant:new n.Uniform1i(d,_.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(d,_.u_is_size_feature_constant),u_size_t:new n.Uniform1f(d,_.u_size_t),u_size:new n.Uniform1f(d,_.u_size),u_camera_to_center_distance:new n.Uniform1f(d,_.u_camera_to_center_distance),u_pitch:new n.Uniform1f(d,_.u_pitch),u_rotate_symbol:new n.Uniform1i(d,_.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(d,_.u_aspect_ratio),u_fade_change:new n.Uniform1f(d,_.u_fade_change),u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(d,_.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(d,_.u_coord_matrix),u_is_text:new n.Uniform1i(d,_.u_is_text),u_pitch_with_map:new n.Uniform1i(d,_.u_pitch_with_map),u_texsize:new n.Uniform2f(d,_.u_texsize),u_texture:new n.Uniform1i(d,_.u_texture),u_gamma_scale:new n.Uniform1f(d,_.u_gamma_scale),u_device_pixel_ratio:new n.Uniform1f(d,_.u_device_pixel_ratio),u_is_halo:new n.Uniform1i(d,_.u_is_halo)}},symbolTextAndIcon:function(d,_){return{u_is_size_zoom_constant:new n.Uniform1i(d,_.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(d,_.u_is_size_feature_constant),u_size_t:new n.Uniform1f(d,_.u_size_t),u_size:new n.Uniform1f(d,_.u_size),u_camera_to_center_distance:new n.Uniform1f(d,_.u_camera_to_center_distance),u_pitch:new n.Uniform1f(d,_.u_pitch),u_rotate_symbol:new n.Uniform1i(d,_.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(d,_.u_aspect_ratio),u_fade_change:new n.Uniform1f(d,_.u_fade_change),u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(d,_.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(d,_.u_coord_matrix),u_is_text:new n.Uniform1i(d,_.u_is_text),u_pitch_with_map:new n.Uniform1i(d,_.u_pitch_with_map),u_texsize:new n.Uniform2f(d,_.u_texsize),u_texsize_icon:new n.Uniform2f(d,_.u_texsize_icon),u_texture:new n.Uniform1i(d,_.u_texture),u_texture_icon:new n.Uniform1i(d,_.u_texture_icon),u_gamma_scale:new n.Uniform1f(d,_.u_gamma_scale),u_device_pixel_ratio:new n.Uniform1f(d,_.u_device_pixel_ratio),u_is_halo:new n.Uniform1i(d,_.u_is_halo)}},background:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_opacity:new n.Uniform1f(d,_.u_opacity),u_color:new n.UniformColor(d,_.u_color)}},backgroundPattern:function(d,_){return{u_matrix:new n.UniformMatrix4f(d,_.u_matrix),u_opacity:new n.Uniform1f(d,_.u_opacity),u_image:new n.Uniform1i(d,_.u_image),u_pattern_tl_a:new n.Uniform2f(d,_.u_pattern_tl_a),u_pattern_br_a:new n.Uniform2f(d,_.u_pattern_br_a),u_pattern_tl_b:new n.Uniform2f(d,_.u_pattern_tl_b),u_pattern_br_b:new n.Uniform2f(d,_.u_pattern_br_b),u_texsize:new n.Uniform2f(d,_.u_texsize),u_mix:new n.Uniform1f(d,_.u_mix),u_pattern_size_a:new n.Uniform2f(d,_.u_pattern_size_a),u_pattern_size_b:new n.Uniform2f(d,_.u_pattern_size_b),u_scale_a:new n.Uniform1f(d,_.u_scale_a),u_scale_b:new n.Uniform1f(d,_.u_scale_b),u_pixel_coord_upper:new n.Uniform2f(d,_.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(d,_.u_pixel_coord_lower),u_tile_units_to_pixels:new n.Uniform1f(d,_.u_tile_units_to_pixels)}}};function Vc(d,_,p,b,B,k,V){for(var q=d.context,re=q.gl,ue=d.useProgram("collisionBox"),Ee=[],Ce=0,Me=0,He=0;He<b.length;He++){var Ue=b[He],Ze=_.getTile(Ue),Ne=Ze.getBucket(p);if(Ne){var Ke=Ue.posMatrix;B[0]===0&&B[1]===0||(Ke=d.translatePosMatrix(Ue.posMatrix,Ze,B,k));var it=V?Ne.textCollisionBox:Ne.iconCollisionBox,pt=Ne.collisionCircleArray;if(pt.length>0){var Ct=n.create(),xt=Ke;n.mul(Ct,Ne.placementInvProjMatrix,d.transform.glCoordMatrix),n.mul(Ct,Ct,Ne.placementViewportMatrix),Ee.push({circleArray:pt,circleOffset:Me,transform:xt,invTransform:Ct}),Me=Ce+=pt.length/4}it&&ue.draw(q,re.LINES,Pe.disabled,ye.disabled,d.colorModeForRenderPass(),rt.disabled,Qn(Ke,d.transform,Ze),p.id,it.layoutVertexBuffer,it.indexBuffer,it.segments,null,d.transform.zoom,null,null,it.collisionVertexBuffer)}}if(V&&Ee.length){var Rt=d.useProgram("collisionCircle"),Wt=new n.StructArrayLayout2f1f2i16;Wt.resize(4*Ce),Wt._trim();for(var ar=0,ir=0,Ir=Ee;ir<Ir.length;ir+=1)for(var ti=Ir[ir],oi=0;oi<ti.circleArray.length/4;oi++){var ii=4*oi,hn=ti.circleArray[ii+0],Or=ti.circleArray[ii+1],yi=ti.circleArray[ii+2],vi=ti.circleArray[ii+3];Wt.emplace(ar++,hn,Or,yi,vi,0),Wt.emplace(ar++,hn,Or,yi,vi,1),Wt.emplace(ar++,hn,Or,yi,vi,2),Wt.emplace(ar++,hn,Or,yi,vi,3)}(!hu||hu.length<2*Ce)&&(hu=function(Yn){var Ws=2*Yn,ws=new n.StructArrayLayout3ui6;ws.resize(Ws),ws._trim();for(var Io=0;Io<Ws;Io++){var Jo=6*Io;ws.uint16[Jo+0]=4*Io+0,ws.uint16[Jo+1]=4*Io+1,ws.uint16[Jo+2]=4*Io+2,ws.uint16[Jo+3]=4*Io+2,ws.uint16[Jo+4]=4*Io+3,ws.uint16[Jo+5]=4*Io+0}return ws}(Ce));for(var di=q.createIndexBuffer(hu,!0),pi=q.createVertexBuffer(Wt,n.collisionCircleLayout.members,!0),Pi=0,hi=Ee;Pi<hi.length;Pi+=1){var li=hi[Pi],bs=En(li.transform,li.invTransform,d.transform);Rt.draw(q,re.TRIANGLES,Pe.disabled,ye.disabled,d.colorModeForRenderPass(),rt.disabled,bs,p.id,pi,di,n.SegmentVector.simpleSegment(0,2*li.circleOffset,li.circleArray.length,li.circleArray.length/2),null,d.transform.zoom,null,null,null)}pi.destroy(),di.destroy()}}var Is=n.identity(new Float32Array(16));function Kf(d,_,p,b,B,k){var V=n.getAnchorAlignment(d),q=-(V.horizontalAlign-.5)*_,re=-(V.verticalAlign-.5)*p,ue=n.evaluateVariableOffset(d,b);return new n.Point((q/B+ue[0])*k,(re/B+ue[1])*k)}function Xl(d,_,p,b,B,k,V,q,re,ue,Ee){var Ce=d.text.placedSymbolArray,Me=d.text.dynamicLayoutVertexArray,He=d.icon.dynamicLayoutVertexArray,Ue={};Me.clear();for(var Ze=0;Ze<Ce.length;Ze++){var Ne=Ce.get(Ze),Ke=Ne.hidden||!Ne.crossTileID||d.allowVerticalPlacement&&!Ne.placedOrientation?null:b[Ne.crossTileID];if(Ke){var it=new n.Point(Ne.anchorX,Ne.anchorY),pt=Si(it,p?q:V),Ct=Oi(k.cameraToCenterDistance,pt.signedDistanceFromCamera),xt=B.evaluateSizeForFeature(d.textSizeData,ue,Ne)*Ct/n.ONE_EM;p&&(xt*=d.tilePixelRatio/re);for(var Rt=Kf(Ke.anchor,Ke.width,Ke.height,Ke.textOffset,Ke.textBoxScale,xt),Wt=p?Si(it.add(Rt),V).point:pt.point.add(_?Rt.rotate(-k.angle):Rt),ar=d.allowVerticalPlacement&&Ne.placedOrientation===n.WritingMode.vertical?Math.PI/2:0,ir=0;ir<Ne.numGlyphs;ir++)n.addDynamicAttributes(Me,Wt,ar);Ee&&Ne.associatedIconIndex>=0&&(Ue[Ne.associatedIconIndex]={shiftedAnchor:Wt,angle:ar})}else cs(Ne.numGlyphs,Me)}if(Ee){He.clear();for(var Ir=d.icon.placedSymbolArray,ti=0;ti<Ir.length;ti++){var oi=Ir.get(ti);if(oi.hidden)cs(oi.numGlyphs,He);else{var ii=Ue[ti];if(ii)for(var hn=0;hn<oi.numGlyphs;hn++)n.addDynamicAttributes(He,ii.shiftedAnchor,ii.angle);else cs(oi.numGlyphs,He)}}d.icon.dynamicLayoutVertexBuffer.updateData(He)}d.text.dynamicLayoutVertexBuffer.updateData(Me)}function Ie(d,_,p){return p.iconsInText&&_?"symbolTextAndIcon":d?"symbolSDF":"symbolIcon"}function hl(d,_,p,b,B,k,V,q,re,ue,Ee,Ce){for(var Me=d.context,He=Me.gl,Ue=d.transform,Ze=q==="map",Ne=re==="map",Ke=Ze&&p.layout.get("symbol-placement")!=="point",it=Ze&&!Ne&&!Ke,pt=p.layout.get("symbol-sort-key").constantOr(1)!==void 0,Ct=!1,xt=d.depthModeForSublayer(0,Pe.ReadOnly),Rt=p.layout.get("text-variable-anchor"),Wt=[],ar=0,ir=b;ar<ir.length;ar+=1){var Ir=ir[ar],ti=_.getTile(Ir),oi=ti.getBucket(p);if(oi){var ii=B?oi.text:oi.icon;if(ii&&ii.segments.get().length){var hn=ii.programConfigurations.get(p.id),Or=B||oi.sdfIcons,yi=B?oi.textSizeData:oi.iconSizeData,vi=Ne||Ue.pitch!==0,di=d.useProgram(Ie(Or,B,oi),hn),pi=n.evaluateSizeForZoom(yi,Ue.zoom),Pi=void 0,hi=[0,0],li=void 0,bs=void 0,Yn=null,Ws=void 0;if(B)li=ti.glyphAtlasTexture,bs=He.LINEAR,Pi=ti.glyphAtlasTexture.size,oi.iconsInText&&(hi=ti.imageAtlasTexture.size,Yn=ti.imageAtlasTexture,Ws=vi||d.options.rotating||d.options.zooming||yi.kind==="composite"||yi.kind==="camera"?He.LINEAR:He.NEAREST);else{var ws=p.layout.get("icon-size").constantOr(0)!==1||oi.iconsNeedLinear;li=ti.imageAtlasTexture,bs=Or||d.options.rotating||d.options.zooming||ws||vi?He.LINEAR:He.NEAREST,Pi=ti.imageAtlasTexture.size}var Io=pn(ti,1,d.transform.zoom),Jo=Ln(Ir.posMatrix,Ne,Ze,d.transform,Io),Wa=en(Ir.posMatrix,Ne,Ze,d.transform,Io),pa=Rt&&oi.hasTextData(),vu=p.layout.get("icon-text-fit")!=="none"&&pa&&oi.hasIconData();Ke&&fc(oi,Ir.posMatrix,d,B,Jo,Wa,Ne,ue);var Ia=d.translatePosMatrix(Ir.posMatrix,ti,k,V),Kl=Ke||B&&Rt||vu?Is:Jo,Bl=d.translatePosMatrix(Wa,ti,k,V,!0),rd=Or&&p.paint.get(B?"text-halo-width":"icon-halo-width").constantOr(1)!==0,nh={program:di,buffers:ii,uniformValues:Or?oi.iconsInText?gi(yi.kind,pi,it,Ne,d,Ia,Kl,Bl,Pi,hi):ha(yi.kind,pi,it,Ne,d,Ia,Kl,Bl,B,Pi,!0):Sn(yi.kind,pi,it,Ne,d,Ia,Kl,Bl,B,Pi),atlasTexture:li,atlasTextureIcon:Yn,atlasInterpolation:bs,atlasInterpolationIcon:Ws,isSDF:Or,hasHalo:rd};if(pt&&oi.canOverlap){Ct=!0;for(var xu=0,uf=ii.segments.get();xu<uf.length;xu+=1){var oh=uf[xu];Wt.push({segments:new n.SegmentVector([oh]),sortKey:oh.sortKey,state:nh})}}else Wt.push({segments:ii.segments,sortKey:0,state:nh})}}}Ct&&Wt.sort(function(bu,ff){return bu.sortKey-ff.sortKey});for(var ro=0,id=Wt;ro<id.length;ro+=1){var gc=id[ro],Ho=gc.state;if(Me.activeTexture.set(He.TEXTURE0),Ho.atlasTexture.bind(Ho.atlasInterpolation,He.CLAMP_TO_EDGE),Ho.atlasTextureIcon&&(Me.activeTexture.set(He.TEXTURE1),Ho.atlasTextureIcon&&Ho.atlasTextureIcon.bind(Ho.atlasInterpolationIcon,He.CLAMP_TO_EDGE)),Ho.isSDF){var Ts=Ho.uniformValues;Ho.hasHalo&&(Ts.u_is_halo=1,hc(Ho.buffers,gc.segments,p,d,Ho.program,xt,Ee,Ce,Ts)),Ts.u_is_halo=0}hc(Ho.buffers,gc.segments,p,d,Ho.program,xt,Ee,Ce,Ho.uniformValues)}}function hc(d,_,p,b,B,k,V,q,re){var ue=b.context;B.draw(ue,ue.gl.TRIANGLES,k,V,q,rt.disabled,re,p.id,d.layoutVertexBuffer,d.indexBuffer,_,p.paint,b.transform.zoom,d.programConfigurations.get(p.id),d.dynamicLayoutVertexBuffer,d.opacityVertexBuffer)}function Hc(d,_,p,b,B,k,V){var q,re,ue,Ee,Ce,Me=d.context.gl,He=p.paint.get("fill-pattern"),Ue=He&&He.constantOr(1),Ze=p.getCrossfadeParameters();V?(re=Ue&&!p.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",q=Me.LINES):(re=Ue?"fillPattern":"fill",q=Me.TRIANGLES);for(var Ne=0,Ke=b;Ne<Ke.length;Ne+=1){var it=Ke[Ne],pt=_.getTile(it);if(!Ue||pt.patternsLoaded()){var Ct=pt.getBucket(p);if(Ct){var xt=Ct.programConfigurations.get(p.id),Rt=d.useProgram(re,xt);Ue&&(d.context.activeTexture.set(Me.TEXTURE0),pt.imageAtlasTexture.bind(Me.LINEAR,Me.CLAMP_TO_EDGE),xt.updatePaintBuffers(Ze));var Wt=He.constantOr(null);if(Wt&&pt.imageAtlas){var ar=pt.imageAtlas,ir=ar.patternPositions[Wt.to.toString()],Ir=ar.patternPositions[Wt.from.toString()];ir&&Ir&&xt.setConstantPatternPositions(ir,Ir)}var ti=d.translatePosMatrix(it.posMatrix,pt,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor"));if(V){Ee=Ct.indexBuffer2,Ce=Ct.segments2;var oi=[Me.drawingBufferWidth,Me.drawingBufferHeight];ue=re==="fillOutlinePattern"&&Ue?Ti(ti,d,Ze,pt,oi):Re(ti,oi)}else Ee=Ct.indexBuffer,Ce=Ct.segments,ue=Ue?Wr(ti,d,Ze,pt):ki(ti);Rt.draw(d.context,q,B,d.stencilModeForClipping(it),k,rt.disabled,ue,p.id,Ct.layoutVertexBuffer,Ee,Ce,p.paint,d.transform.zoom,xt)}}}}function rf(d,_,p,b,B,k,V){for(var q=d.context,re=q.gl,ue=p.paint.get("fill-extrusion-pattern"),Ee=ue.constantOr(1),Ce=p.getCrossfadeParameters(),Me=p.paint.get("fill-extrusion-opacity"),He=0,Ue=b;He<Ue.length;He+=1){var Ze=Ue[He],Ne=_.getTile(Ze),Ke=Ne.getBucket(p);if(Ke){var it=Ke.programConfigurations.get(p.id),pt=d.useProgram(Ee?"fillExtrusionPattern":"fillExtrusion",it);Ee&&(d.context.activeTexture.set(re.TEXTURE0),Ne.imageAtlasTexture.bind(re.LINEAR,re.CLAMP_TO_EDGE),it.updatePaintBuffers(Ce));var Ct=ue.constantOr(null);if(Ct&&Ne.imageAtlas){var xt=Ne.imageAtlas,Rt=xt.patternPositions[Ct.to.toString()],Wt=xt.patternPositions[Ct.from.toString()];Rt&&Wt&&it.setConstantPatternPositions(Rt,Wt)}var ar=d.translatePosMatrix(Ze.posMatrix,Ne,p.paint.get("fill-extrusion-translate"),p.paint.get("fill-extrusion-translate-anchor")),ir=p.paint.get("fill-extrusion-vertical-gradient"),Ir=Ee?g(ar,d,ir,Me,Ze,Ce,Ne):Xr(ar,d,ir,Me);pt.draw(q,q.gl.TRIANGLES,B,k,V,rt.backCCW,Ir,p.id,Ke.layoutVertexBuffer,Ke.indexBuffer,Ke.segments,p.paint,d.transform.zoom,it)}}}function Zf(d,_,p,b,B,k){var V=d.context,q=V.gl,re=_.fbo;if(re){var ue=d.useProgram("hillshade");V.activeTexture.set(q.TEXTURE0),q.bindTexture(q.TEXTURE_2D,re.colorAttachment.get());var Ee=function(Ce,Me,He){var Ue=He.paint.get("hillshade-shadow-color"),Ze=He.paint.get("hillshade-highlight-color"),Ne=He.paint.get("hillshade-accent-color"),Ke=He.paint.get("hillshade-illumination-direction")*(Math.PI/180);He.paint.get("hillshade-illumination-anchor")==="viewport"&&(Ke-=Ce.transform.angle);var it,pt,Ct,xt=!Ce.options.moving;return{u_matrix:Ce.transform.calculatePosMatrix(Me.tileID.toUnwrapped(),xt),u_image:0,u_latrange:(it=Me.tileID,pt=Math.pow(2,it.canonical.z),Ct=it.canonical.y,[new n.MercatorCoordinate(0,Ct/pt).toLngLat().lat,new n.MercatorCoordinate(0,(Ct+1)/pt).toLngLat().lat]),u_light:[He.paint.get("hillshade-exaggeration"),Ke],u_shadow:Ue,u_highlight:Ze,u_accent:Ne}}(d,_,p);ue.draw(V,q.TRIANGLES,b,B,k,rt.disabled,Ee,p.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments)}}function Jf(d,_,p,b,B,k){var V=d.context,q=V.gl,re=_.dem;if(re&&re.data){var ue=re.dim,Ee=re.stride,Ce=re.getPixels();if(V.activeTexture.set(q.TEXTURE1),V.pixelStoreUnpackPremultiplyAlpha.set(!1),_.demTexture=_.demTexture||d.getTileTexture(Ee),_.demTexture){var Me=_.demTexture;Me.update(Ce,{premultiply:!1}),Me.bind(q.NEAREST,q.CLAMP_TO_EDGE)}else _.demTexture=new n.Texture(V,Ce,q.RGBA,{premultiply:!1}),_.demTexture.bind(q.NEAREST,q.CLAMP_TO_EDGE);V.activeTexture.set(q.TEXTURE0);var He=_.fbo;if(!He){var Ue=new n.Texture(V,{width:ue,height:ue,data:null},q.RGBA);Ue.bind(q.LINEAR,q.CLAMP_TO_EDGE),(He=_.fbo=V.createFramebuffer(ue,ue,!0)).colorAttachment.set(Ue.texture)}V.bindFramebuffer.set(He.framebuffer),V.viewport.set([0,0,ue,ue]),d.useProgram("hillshadePrepare").draw(V,q.TRIANGLES,b,B,k,rt.disabled,function(Ze,Ne){var Ke=Ne.stride,it=n.create();return n.ortho(it,0,n.EXTENT,-n.EXTENT,0,0,1),n.translate(it,it,[0,-n.EXTENT,0]),{u_matrix:it,u_image:1,u_dimension:[Ke,Ke],u_zoom:Ze.overscaledZ,u_unpack:Ne.getUnpackVector()}}(_.tileID,re),p.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments),_.needsHillshadePrepare=!1}}function jc(d,_,p,b,B){var k=b.paint.get("raster-fade-duration");if(k>0){var V=n.browser.now(),q=(V-d.timeAdded)/k,re=_?(V-_.timeAdded)/k:-1,ue=p.getSource(),Ee=B.coveringZoomLevel({tileSize:ue.tileSize,roundZoom:ue.roundZoom}),Ce=!_||Math.abs(_.tileID.overscaledZ-Ee)>Math.abs(d.tileID.overscaledZ-Ee),Me=Ce&&d.refreshedUponExpiration?1:n.clamp(Ce?q:1-re,0,1);return d.refreshedUponExpiration&&q>=1&&(d.refreshedUponExpiration=!1),_?{opacity:1,mix:1-Me}:{opacity:Me,mix:0}}return{opacity:1,mix:0}}var du=new n.Color(1,0,0,1),Zh=new n.Color(0,1,0,1),za=new n.Color(0,0,1,1),Vo=new n.Color(1,0,1,1),ze=new n.Color(0,1,1,1);function st(d,_,p,b){Lt(d,0,_+p/2,d.transform.width,p,b)}function Tt(d,_,p,b){Lt(d,_-p/2,0,p,d.transform.height,b)}function Lt(d,_,p,b,B,k){var V=d.context,q=V.gl;q.enable(q.SCISSOR_TEST),q.scissor(_*n.browser.devicePixelRatio,p*n.browser.devicePixelRatio,b*n.browser.devicePixelRatio,B*n.browser.devicePixelRatio),V.clear({color:k}),q.disable(q.SCISSOR_TEST)}function Gt(d,_,p){var b=d.context,B=b.gl,k=p.posMatrix,V=d.useProgram("debug"),q=Pe.disabled,re=ye.disabled,ue=d.colorModeForRenderPass();b.activeTexture.set(B.TEXTURE0),d.emptyTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),V.draw(b,B.LINE_STRIP,q,re,ue,rt.disabled,ln(k,n.Color.red),"$debug",d.debugBuffer,d.tileBorderIndexBuffer,d.debugSegments);var Ee=_.getTileByID(p.key).latestRawTileData,Ce=Math.floor((Ee&&Ee.byteLength||0)/1024),Me=_.getTile(p).tileSize,He=512/Math.min(Me,512)*(p.overscaledZ/d.transform.zoom)*.5,Ue=p.canonical.toString();p.overscaledZ!==p.canonical.z&&(Ue+=" => "+p.overscaledZ),function(Ze,Ne){Ze.initDebugOverlayCanvas();var Ke=Ze.debugOverlayCanvas,it=Ze.context.gl,pt=Ze.debugOverlayCanvas.getContext("2d");pt.clearRect(0,0,Ke.width,Ke.height),pt.shadowColor="white",pt.shadowBlur=2,pt.lineWidth=1.5,pt.strokeStyle="white",pt.textBaseline="top",pt.font="bold 36px Open Sans, sans-serif",pt.fillText(Ne,5,5),pt.strokeText(Ne,5,5),Ze.debugOverlayTexture.update(Ke),Ze.debugOverlayTexture.bind(it.LINEAR,it.CLAMP_TO_EDGE)}(d,Ue+" "+Ce+"kb"),V.draw(b,B.TRIANGLES,q,re,tt.alphaBlended,rt.disabled,ln(k,n.Color.transparent,He),"$debug",d.debugBuffer,d.quadTriangleIndexBuffer,d.debugSegments)}var _r={symbol:function(d,_,p,b,B){if(d.renderPass==="translucent"){var k=ye.disabled,V=d.colorModeForRenderPass();p.layout.get("text-variable-anchor")&&function(q,re,ue,Ee,Ce,Me,He){for(var Ue=re.transform,Ze=Ce==="map",Ne=Me==="map",Ke=0,it=q;Ke<it.length;Ke+=1){var pt=it[Ke],Ct=Ee.getTile(pt),xt=Ct.getBucket(ue);if(xt&&xt.text&&xt.text.segments.get().length){var Rt=n.evaluateSizeForZoom(xt.textSizeData,Ue.zoom),Wt=pn(Ct,1,re.transform.zoom),ar=Ln(pt.posMatrix,Ne,Ze,re.transform,Wt),ir=ue.layout.get("icon-text-fit")!=="none"&&xt.hasIconData();if(Rt){var Ir=Math.pow(2,Ue.zoom-Ct.tileID.overscaledZ);Xl(xt,Ze,Ne,He,n.symbolSize,Ue,ar,pt.posMatrix,Ir,Rt,ir)}}}}(b,d,p,_,p.layout.get("text-rotation-alignment"),p.layout.get("text-pitch-alignment"),B),p.paint.get("icon-opacity").constantOr(1)!==0&&hl(d,_,p,b,!1,p.paint.get("icon-translate"),p.paint.get("icon-translate-anchor"),p.layout.get("icon-rotation-alignment"),p.layout.get("icon-pitch-alignment"),p.layout.get("icon-keep-upright"),k,V),p.paint.get("text-opacity").constantOr(1)!==0&&hl(d,_,p,b,!0,p.paint.get("text-translate"),p.paint.get("text-translate-anchor"),p.layout.get("text-rotation-alignment"),p.layout.get("text-pitch-alignment"),p.layout.get("text-keep-upright"),k,V),_.map.showCollisionBoxes&&(Vc(d,_,p,b,p.paint.get("text-translate"),p.paint.get("text-translate-anchor"),!0),Vc(d,_,p,b,p.paint.get("icon-translate"),p.paint.get("icon-translate-anchor"),!1))}},circle:function(d,_,p,b){if(d.renderPass==="translucent"){var B=p.paint.get("circle-opacity"),k=p.paint.get("circle-stroke-width"),V=p.paint.get("circle-stroke-opacity"),q=p.layout.get("circle-sort-key").constantOr(1)!==void 0;if(B.constantOr(1)!==0||k.constantOr(1)!==0&&V.constantOr(1)!==0){for(var re=d.context,ue=re.gl,Ee=d.depthModeForSublayer(0,Pe.ReadOnly),Ce=ye.disabled,Me=d.colorModeForRenderPass(),He=[],Ue=0;Ue<b.length;Ue++){var Ze=b[Ue],Ne=_.getTile(Ze),Ke=Ne.getBucket(p);if(Ke){var it=Ke.programConfigurations.get(p.id),pt={programConfiguration:it,program:d.useProgram("circle",it),layoutVertexBuffer:Ke.layoutVertexBuffer,indexBuffer:Ke.indexBuffer,uniformValues:An(d,Ze,Ne,p)};if(q)for(var Ct=0,xt=Ke.segments.get();Ct<xt.length;Ct+=1){var Rt=xt[Ct];He.push({segments:new n.SegmentVector([Rt]),sortKey:Rt.sortKey,state:pt})}else He.push({segments:Ke.segments,sortKey:0,state:pt})}}q&&He.sort(function(ti,oi){return ti.sortKey-oi.sortKey});for(var Wt=0,ar=He;Wt<ar.length;Wt+=1){var ir=ar[Wt],Ir=ir.state;Ir.program.draw(re,ue.TRIANGLES,Ee,Ce,Me,rt.disabled,Ir.uniformValues,p.id,Ir.layoutVertexBuffer,Ir.indexBuffer,ir.segments,p.paint,d.transform.zoom,Ir.programConfiguration)}}}},heatmap:function(d,_,p,b){if(p.paint.get("heatmap-opacity")!==0)if(d.renderPass==="offscreen"){var B=d.context,k=B.gl,V=ye.disabled,q=new tt([k.ONE,k.ONE],n.Color.transparent,[!0,!0,!0,!0]);(function(He,Ue,Ze){var Ne=He.gl;He.activeTexture.set(Ne.TEXTURE1),He.viewport.set([0,0,Ue.width/4,Ue.height/4]);var Ke=Ze.heatmapFbo;if(Ke)Ne.bindTexture(Ne.TEXTURE_2D,Ke.colorAttachment.get()),He.bindFramebuffer.set(Ke.framebuffer);else{var it=Ne.createTexture();Ne.bindTexture(Ne.TEXTURE_2D,it),Ne.texParameteri(Ne.TEXTURE_2D,Ne.TEXTURE_WRAP_S,Ne.CLAMP_TO_EDGE),Ne.texParameteri(Ne.TEXTURE_2D,Ne.TEXTURE_WRAP_T,Ne.CLAMP_TO_EDGE),Ne.texParameteri(Ne.TEXTURE_2D,Ne.TEXTURE_MIN_FILTER,Ne.LINEAR),Ne.texParameteri(Ne.TEXTURE_2D,Ne.TEXTURE_MAG_FILTER,Ne.LINEAR),Ke=Ze.heatmapFbo=He.createFramebuffer(Ue.width/4,Ue.height/4,!1),function(pt,Ct,xt,Rt){var Wt=pt.gl;Wt.texImage2D(Wt.TEXTURE_2D,0,Wt.RGBA,Ct.width/4,Ct.height/4,0,Wt.RGBA,pt.extRenderToTextureHalfFloat?pt.extTextureHalfFloat.HALF_FLOAT_OES:Wt.UNSIGNED_BYTE,null),Rt.colorAttachment.set(xt)}(He,Ue,it,Ke)}})(B,d,p),B.clear({color:n.Color.transparent});for(var re=0;re<b.length;re++){var ue=b[re];if(!_.hasRenderableParent(ue)){var Ee=_.getTile(ue),Ce=Ee.getBucket(p);if(Ce){var Me=Ce.programConfigurations.get(p.id);d.useProgram("heatmap",Me).draw(B,k.TRIANGLES,Pe.disabled,V,q,rt.disabled,ji(ue.posMatrix,Ee,d.transform.zoom,p.paint.get("heatmap-intensity")),p.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ce.segments,p.paint,d.transform.zoom,Me)}}}B.viewport.set([0,0,d.width,d.height])}else d.renderPass==="translucent"&&(d.context.setColorMode(d.colorModeForRenderPass()),function(He,Ue){var Ze=He.context,Ne=Ze.gl,Ke=Ue.heatmapFbo;if(Ke){Ze.activeTexture.set(Ne.TEXTURE0),Ne.bindTexture(Ne.TEXTURE_2D,Ke.colorAttachment.get()),Ze.activeTexture.set(Ne.TEXTURE1);var it=Ue.colorRampTexture;it||(it=Ue.colorRampTexture=new n.Texture(Ze,Ue.colorRamp,Ne.RGBA)),it.bind(Ne.LINEAR,Ne.CLAMP_TO_EDGE),He.useProgram("heatmapTexture").draw(Ze,Ne.TRIANGLES,Pe.disabled,ye.disabled,He.colorModeForRenderPass(),rt.disabled,function(pt,Ct,xt,Rt){var Wt=n.create();n.ortho(Wt,0,pt.width,pt.height,0,0,1);var ar=pt.context.gl;return{u_matrix:Wt,u_world:[ar.drawingBufferWidth,ar.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:Ct.paint.get("heatmap-opacity")}}(He,Ue),Ue.id,He.viewportBuffer,He.quadTriangleIndexBuffer,He.viewportSegments,Ue.paint,He.transform.zoom)}}(d,p))},line:function(d,_,p,b){if(d.renderPass==="translucent"){var B=p.paint.get("line-opacity"),k=p.paint.get("line-width");if(B.constantOr(1)!==0&&k.constantOr(1)!==0)for(var V=d.depthModeForSublayer(0,Pe.ReadOnly),q=d.colorModeForRenderPass(),re=p.paint.get("line-dasharray"),ue=p.paint.get("line-pattern"),Ee=ue.constantOr(1),Ce=p.paint.get("line-gradient"),Me=p.getCrossfadeParameters(),He=Ee?"linePattern":re?"lineSDF":Ce?"lineGradient":"line",Ue=d.context,Ze=Ue.gl,Ne=!0,Ke=0,it=b;Ke<it.length;Ke+=1){var pt=it[Ke],Ct=_.getTile(pt);if(!Ee||Ct.patternsLoaded()){var xt=Ct.getBucket(p);if(xt){var Rt=xt.programConfigurations.get(p.id),Wt=d.context.program.get(),ar=d.useProgram(He,Rt),ir=Ne||ar.program!==Wt,Ir=ue.constantOr(null);if(Ir&&Ct.imageAtlas){var ti=Ct.imageAtlas,oi=ti.patternPositions[Ir.to.toString()],ii=ti.patternPositions[Ir.from.toString()];oi&&ii&&Rt.setConstantPatternPositions(oi,ii)}var hn=Ee?ea(d,Ct,p,Me):re?Yh(d,Ct,p,re,Me):Ce?an(d,Ct,p,xt.lineClipsArray.length):Gi(d,Ct,p);if(Ee)Ue.activeTexture.set(Ze.TEXTURE0),Ct.imageAtlasTexture.bind(Ze.LINEAR,Ze.CLAMP_TO_EDGE),Rt.updatePaintBuffers(Me);else if(re&&(ir||d.lineAtlas.dirty))Ue.activeTexture.set(Ze.TEXTURE0),d.lineAtlas.bind(Ue);else if(Ce){var Or=xt.gradients[p.id],yi=Or.texture;if(p.gradientVersion!==Or.version){var vi=256;if(p.stepInterpolant){var di=_.getSource().maxzoom,pi=pt.canonical.z===di?Math.ceil(1<<d.transform.maxZoom-pt.canonical.z):1;vi=n.clamp(n.nextPowerOfTwo(xt.maxLineLength/n.EXTENT*1024*pi),256,Ue.maxTextureSize)}Or.gradient=n.renderColorRamp({expression:p.gradientExpression(),evaluationKey:"lineProgress",resolution:vi,image:Or.gradient||void 0,clips:xt.lineClipsArray}),Or.texture?Or.texture.update(Or.gradient):Or.texture=new n.Texture(Ue,Or.gradient,Ze.RGBA),Or.version=p.gradientVersion,yi=Or.texture}Ue.activeTexture.set(Ze.TEXTURE0),yi.bind(p.stepInterpolant?Ze.NEAREST:Ze.LINEAR,Ze.CLAMP_TO_EDGE)}ar.draw(Ue,Ze.TRIANGLES,V,d.stencilModeForClipping(pt),q,rt.disabled,hn,p.id,xt.layoutVertexBuffer,xt.indexBuffer,xt.segments,p.paint,d.transform.zoom,Rt,xt.layoutVertexBuffer2),Ne=!1}}}}},fill:function(d,_,p,b){var B=p.paint.get("fill-color"),k=p.paint.get("fill-opacity");if(k.constantOr(1)!==0){var V=d.colorModeForRenderPass(),q=p.paint.get("fill-pattern"),re=d.opaquePassEnabledForLayer()&&!q.constantOr(1)&&B.constantOr(n.Color.transparent).a===1&&k.constantOr(0)===1?"opaque":"translucent";if(d.renderPass===re){var ue=d.depthModeForSublayer(1,d.renderPass==="opaque"?Pe.ReadWrite:Pe.ReadOnly);Hc(d,_,p,b,ue,V,!1)}if(d.renderPass==="translucent"&&p.paint.get("fill-antialias")){var Ee=d.depthModeForSublayer(p.getPaintProperty("fill-outline-color")?2:0,Pe.ReadOnly);Hc(d,_,p,b,Ee,V,!0)}}},"fill-extrusion":function(d,_,p,b){var B=p.paint.get("fill-extrusion-opacity");if(B!==0&&d.renderPass==="translucent"){var k=new Pe(d.context.gl.LEQUAL,Pe.ReadWrite,d.depthRangeFor3D);if(B!==1||p.paint.get("fill-extrusion-pattern").constantOr(1))rf(d,_,p,b,k,ye.disabled,tt.disabled),rf(d,_,p,b,k,d.stencilModeFor3D(),d.colorModeForRenderPass());else{var V=d.colorModeForRenderPass();rf(d,_,p,b,k,ye.disabled,V)}}},hillshade:function(d,_,p,b){if(d.renderPass==="offscreen"||d.renderPass==="translucent"){for(var B=d.context,k=d.depthModeForSublayer(0,Pe.ReadOnly),V=d.colorModeForRenderPass(),q=d.renderPass==="translucent"?d.stencilConfigForOverlap(b):[{},b],re=q[0],ue=0,Ee=q[1];ue<Ee.length;ue+=1){var Ce=Ee[ue],Me=_.getTile(Ce);Me.needsHillshadePrepare&&d.renderPass==="offscreen"?Jf(d,Me,p,k,ye.disabled,V):d.renderPass==="translucent"&&Zf(d,Me,p,k,re[Ce.overscaledZ],V)}B.viewport.set([0,0,d.width,d.height])}},raster:function(d,_,p,b){if(d.renderPass==="translucent"&&p.paint.get("raster-opacity")!==0&&b.length)for(var B=d.context,k=B.gl,V=_.getSource(),q=d.useProgram("raster"),re=d.colorModeForRenderPass(),ue=V instanceof Jr?[{},b]:d.stencilConfigForOverlap(b),Ee=ue[0],Ce=ue[1],Me=Ce[Ce.length-1].overscaledZ,He=!d.options.moving,Ue=0,Ze=Ce;Ue<Ze.length;Ue+=1){var Ne=Ze[Ue],Ke=d.depthModeForSublayer(Ne.overscaledZ-Me,p.paint.get("raster-opacity")===1?Pe.ReadWrite:Pe.ReadOnly,k.LESS),it=_.getTile(Ne),pt=d.transform.calculatePosMatrix(Ne.toUnwrapped(),He);it.registerFadeDuration(p.paint.get("raster-fade-duration"));var Ct=_.findLoadedParent(Ne,0),xt=jc(it,Ct,_,p,d.transform),Rt=void 0,Wt=void 0,ar=p.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR;B.activeTexture.set(k.TEXTURE0),it.texture.bind(ar,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),B.activeTexture.set(k.TEXTURE1),Ct?(Ct.texture.bind(ar,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),Rt=Math.pow(2,Ct.tileID.overscaledZ-it.tileID.overscaledZ),Wt=[it.tileID.canonical.x*Rt%1,it.tileID.canonical.y*Rt%1]):it.texture.bind(ar,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST);var ir=fu(pt,Wt||[0,0],Rt||1,xt,p);V instanceof Jr?q.draw(B,k.TRIANGLES,Ke,ye.disabled,re,rt.disabled,ir,p.id,V.boundsBuffer,d.quadTriangleIndexBuffer,V.boundsSegments):q.draw(B,k.TRIANGLES,Ke,Ee[Ne.overscaledZ],re,rt.disabled,ir,p.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments)}},background:function(d,_,p){var b=p.paint.get("background-color"),B=p.paint.get("background-opacity");if(B!==0){var k=d.context,V=k.gl,q=d.transform,re=q.tileSize,ue=p.paint.get("background-pattern");if(!d.isPatternMissing(ue)){var Ee=!ue&&b.a===1&&B===1&&d.opaquePassEnabledForLayer()?"opaque":"translucent";if(d.renderPass===Ee){var Ce=ye.disabled,Me=d.depthModeForSublayer(0,Ee==="opaque"?Pe.ReadWrite:Pe.ReadOnly),He=d.colorModeForRenderPass(),Ue=d.useProgram(ue?"backgroundPattern":"background"),Ze=q.coveringTiles({tileSize:re});ue&&(k.activeTexture.set(V.TEXTURE0),d.imageManager.bind(d.context));for(var Ne=p.getCrossfadeParameters(),Ke=0,it=Ze;Ke<it.length;Ke+=1){var pt=it[Ke],Ct=d.transform.calculatePosMatrix(pt.toUnwrapped()),xt=ue?_i(Ct,B,d,ue,{tileID:pt,tileSize:re},Ne):Fe(Ct,B,b);Ue.draw(k,V.TRIANGLES,Me,Ce,He,rt.disabled,xt,p.id,d.tileExtentBuffer,d.quadTriangleIndexBuffer,d.tileExtentSegments)}}}}},debug:function(d,_,p){for(var b=0;b<p.length;b++)Gt(d,_,p[b])},custom:function(d,_,p){var b=d.context,B=p.implementation;if(d.renderPass==="offscreen"){var k=B.prerender;k&&(d.setCustomLayerDefaults(),b.setColorMode(d.colorModeForRenderPass()),k.call(B,b.gl,d.transform.customLayerMatrix()),b.setDirty(),d.setBaseState())}else if(d.renderPass==="translucent"){d.setCustomLayerDefaults(),b.setColorMode(d.colorModeForRenderPass()),b.setStencilMode(ye.disabled);var V=B.renderingMode==="3d"?new Pe(d.context.gl.LEQUAL,Pe.ReadWrite,d.depthRangeFor3D):d.depthModeForSublayer(0,Pe.ReadOnly);b.setDepthMode(V),B.render(b.gl,d.transform.customLayerMatrix()),b.setDirty(),d.setBaseState(),b.bindFramebuffer.set(null)}}},hr=function(d,_){this.context=new Se(d),this.transform=_,this._tileTextures={},this.setup(),this.numSublayers=Ge.maxUnderzooming+Ge.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new kc,this.gpuTimers={}};hr.prototype.resize=function(d,_){if(this.width=d*n.browser.devicePixelRatio,this.height=_*n.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var p=0,b=this.style._order;p<b.length;p+=1)this.style._layers[b[p]].resize()},hr.prototype.setup=function(){var d=this.context,_=new n.StructArrayLayout2i4;_.emplaceBack(0,0),_.emplaceBack(n.EXTENT,0),_.emplaceBack(0,n.EXTENT),_.emplaceBack(n.EXTENT,n.EXTENT),this.tileExtentBuffer=d.createVertexBuffer(_,Mo.members),this.tileExtentSegments=n.SegmentVector.simpleSegment(0,0,4,2);var p=new n.StructArrayLayout2i4;p.emplaceBack(0,0),p.emplaceBack(n.EXTENT,0),p.emplaceBack(0,n.EXTENT),p.emplaceBack(n.EXTENT,n.EXTENT),this.debugBuffer=d.createVertexBuffer(p,Mo.members),this.debugSegments=n.SegmentVector.simpleSegment(0,0,4,5);var b=new n.StructArrayLayout4i8;b.emplaceBack(0,0,0,0),b.emplaceBack(n.EXTENT,0,n.EXTENT,0),b.emplaceBack(0,n.EXTENT,0,n.EXTENT),b.emplaceBack(n.EXTENT,n.EXTENT,n.EXTENT,n.EXTENT),this.rasterBoundsBuffer=d.createVertexBuffer(b,Er.members),this.rasterBoundsSegments=n.SegmentVector.simpleSegment(0,0,4,2);var B=new n.StructArrayLayout2i4;B.emplaceBack(0,0),B.emplaceBack(1,0),B.emplaceBack(0,1),B.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(B,Mo.members),this.viewportSegments=n.SegmentVector.simpleSegment(0,0,4,2);var k=new n.StructArrayLayout1ui2;k.emplaceBack(0),k.emplaceBack(1),k.emplaceBack(3),k.emplaceBack(2),k.emplaceBack(0),this.tileBorderIndexBuffer=d.createIndexBuffer(k);var V=new n.StructArrayLayout3ui6;V.emplaceBack(0,1,2),V.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(V),this.emptyTexture=new n.Texture(d,{width:1,height:1,data:new Uint8Array([0,0,0,0])},d.gl.RGBA);var q=this.context.gl;this.stencilClearMode=new ye({func:q.ALWAYS,mask:0},0,255,q.ZERO,q.ZERO,q.ZERO)},hr.prototype.clearStencil=function(){var d=this.context,_=d.gl;this.nextStencilID=1,this.currentStencilSource=void 0;var p=n.create();n.ortho(p,0,this.width,this.height,0,0,1),n.scale(p,p,[_.drawingBufferWidth,_.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(d,_.TRIANGLES,Pe.disabled,this.stencilClearMode,tt.disabled,rt.disabled,$n(p),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},hr.prototype._renderTileClippingMasks=function(d,_){if(this.currentStencilSource!==d.source&&d.isTileClipped()&&_&&_.length){this.currentStencilSource=d.source;var p=this.context,b=p.gl;this.nextStencilID+_.length>256&&this.clearStencil(),p.setColorMode(tt.disabled),p.setDepthMode(Pe.disabled);var B=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var k=0,V=_;k<V.length;k+=1){var q=V[k],re=this._tileClippingMaskIDs[q.key]=this.nextStencilID++;B.draw(p,b.TRIANGLES,Pe.disabled,new ye({func:b.ALWAYS,mask:0},re,255,b.KEEP,b.KEEP,b.REPLACE),tt.disabled,rt.disabled,$n(q.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}},hr.prototype.stencilModeFor3D=function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var d=this.nextStencilID++,_=this.context.gl;return new ye({func:_.NOTEQUAL,mask:255},d,255,_.KEEP,_.KEEP,_.REPLACE)},hr.prototype.stencilModeForClipping=function(d){var _=this.context.gl;return new ye({func:_.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,_.KEEP,_.KEEP,_.REPLACE)},hr.prototype.stencilConfigForOverlap=function(d){var _,p=this.context.gl,b=d.sort(function(re,ue){return ue.overscaledZ-re.overscaledZ}),B=b[b.length-1].overscaledZ,k=b[0].overscaledZ-B+1;if(k>1){this.currentStencilSource=void 0,this.nextStencilID+k>256&&this.clearStencil();for(var V={},q=0;q<k;q++)V[q+B]=new ye({func:p.GEQUAL,mask:255},q+this.nextStencilID,255,p.KEEP,p.KEEP,p.REPLACE);return this.nextStencilID+=k,[V,b]}return[(_={},_[B]=ye.disabled,_),b]},hr.prototype.colorModeForRenderPass=function(){var d=this.context.gl;return this._showOverdrawInspector?new tt([d.CONSTANT_COLOR,d.ONE],new n.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?tt.unblended:tt.alphaBlended},hr.prototype.depthModeForSublayer=function(d,_,p){if(!this.opaquePassEnabledForLayer())return Pe.disabled;var b=1-((1+this.currentLayer)*this.numSublayers+d)*this.depthEpsilon;return new Pe(p||this.context.gl.LEQUAL,_,[b,b])},hr.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},hr.prototype.render=function(d,_){var p=this;this.style=d,this.options=_,this.lineAtlas=d.lineAtlas,this.imageManager=d.imageManager,this.glyphManager=d.glyphManager,this.symbolFadeChange=d.placement.symbolFadeChange(n.browser.now()),this.imageManager.beginFrame();var b=this.style._order,B=this.style.sourceCaches;for(var k in B){var V=B[k];V.used&&V.prepare(this.context)}var q,re,ue={},Ee={},Ce={};for(var Me in B){var He=B[Me];ue[Me]=He.getVisibleCoordinates(),Ee[Me]=ue[Me].slice().reverse(),Ce[Me]=He.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(var Ue=0;Ue<b.length;Ue++)if(this.style._layers[b[Ue]].is3D()){this.opaquePassCutoff=Ue;break}this.renderPass="offscreen";for(var Ze=0,Ne=b;Ze<Ne.length;Ze+=1){var Ke=this.style._layers[Ne[Ze]];if(Ke.hasOffscreenPass()&&!Ke.isHidden(this.transform.zoom)){var it=Ee[Ke.source];(Ke.type==="custom"||it.length)&&this.renderLayer(this,B[Ke.source],Ke,it)}}for(this.context.bindFramebuffer.set(null),this.context.clear({color:_.showOverdrawInspector?n.Color.black:n.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=_.showOverdrawInspector,this.depthRangeFor3D=[0,1-(d._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=b.length-1;this.currentLayer>=0;this.currentLayer--){var pt=this.style._layers[b[this.currentLayer]],Ct=B[pt.source],xt=ue[pt.source];this._renderTileClippingMasks(pt,xt),this.renderLayer(this,Ct,pt,xt)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<b.length;this.currentLayer++){var Rt=this.style._layers[b[this.currentLayer]],Wt=B[Rt.source],ar=(Rt.type==="symbol"?Ce:Ee)[Rt.source];this._renderTileClippingMasks(Rt,ue[Rt.source]),this.renderLayer(this,Wt,Rt,ar)}this.options.showTileBoundaries&&(n.values(this.style._layers).forEach(function(ir){ir.source&&!ir.isHidden(p.transform.zoom)&&(ir.source!==(re&&re.id)&&(re=p.style.sourceCaches[ir.source]),(!q||q.getSource().maxzoom<re.getSource().maxzoom)&&(q=re))}),q&&_r.debug(this,q,q.getVisibleCoordinates())),this.options.showPadding&&function(ir){var Ir=ir.transform.padding;st(ir,ir.transform.height-(Ir.top||0),3,du),st(ir,Ir.bottom||0,3,Zh),Tt(ir,Ir.left||0,3,za),Tt(ir,ir.transform.width-(Ir.right||0),3,Vo);var ti=ir.transform.centerPoint;(function(oi,ii,hn,Or){Lt(oi,ii-1,hn-10,2,20,Or),Lt(oi,ii-10,hn-1,20,2,Or)})(ir,ti.x,ir.transform.height-ti.y,ze)}(this),this.context.setDefault()},hr.prototype.renderLayer=function(d,_,p,b){p.isHidden(this.transform.zoom)||(p.type==="background"||p.type==="custom"||b.length)&&(this.id=p.id,this.gpuTimingStart(p),_r[p.type](d,_,p,b,this.style.placement.variableOffsets),this.gpuTimingEnd())},hr.prototype.gpuTimingStart=function(d){if(this.options.gpuTiming){var _=this.context.extTimerQuery,p=this.gpuTimers[d.id];p||(p=this.gpuTimers[d.id]={calls:0,cpuTime:0,query:_.createQueryEXT()}),p.calls++,_.beginQueryEXT(_.TIME_ELAPSED_EXT,p.query)}},hr.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var d=this.context.extTimerQuery;d.endQueryEXT(d.TIME_ELAPSED_EXT)}},hr.prototype.collectGpuTimers=function(){var d=this.gpuTimers;return this.gpuTimers={},d},hr.prototype.queryGpuTimers=function(d){var _={};for(var p in d){var b=d[p],B=this.context.extTimerQuery,k=B.getQueryObjectEXT(b.query,B.QUERY_RESULT_EXT)/1e6;B.deleteQueryEXT(b.query),_[p]=k}return _},hr.prototype.translatePosMatrix=function(d,_,p,b,B){if(!p[0]&&!p[1])return d;var k=B?b==="map"?this.transform.angle:0:b==="viewport"?-this.transform.angle:0;if(k){var V=Math.sin(k),q=Math.cos(k);p=[p[0]*q-p[1]*V,p[0]*V+p[1]*q]}var re=[B?p[0]:pn(_,p[0],this.transform.zoom),B?p[1]:pn(_,p[1],this.transform.zoom),0],ue=new Float32Array(16);return n.translate(ue,d,re),ue},hr.prototype.saveTileTexture=function(d){var _=this._tileTextures[d.size[0]];_?_.push(d):this._tileTextures[d.size[0]]=[d]},hr.prototype.getTileTexture=function(d){var _=this._tileTextures[d];return _&&_.length>0?_.pop():null},hr.prototype.isPatternMissing=function(d){if(!d)return!1;if(!d.from||!d.to)return!0;var _=this.imageManager.getPattern(d.from.toString()),p=this.imageManager.getPattern(d.to.toString());return!_||!p},hr.prototype.useProgram=function(d,_){this.cache=this.cache||{};var p=""+d+(_?_.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[p]||(this.cache[p]=new St(this.context,d,fr[d],_,Kh[d],this._showOverdrawInspector)),this.cache[p]},hr.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},hr.prototype.setBaseState=function(){var d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)},hr.prototype.initDebugOverlayCanvas=function(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=n.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new n.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},hr.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var yr=function(d,_){this.points=d,this.planes=_};yr.fromInvProjectionMatrix=function(d,_,p){var b=Math.pow(2,p),B=[[-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(function(V){return n.transformMat4([],V,d)}).map(function(V){return n.scale$1([],V,1/V[3]/_*b)}),k=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(function(V){var q=n.sub([],B[V[0]],B[V[1]]),re=n.sub([],B[V[2]],B[V[1]]),ue=n.normalize([],n.cross([],q,re)),Ee=-n.dot(ue,B[V[1]]);return ue.concat(Ee)});return new yr(B,k)};var Lr=function(d,_){this.min=d,this.max=_,this.center=n.scale$2([],n.add([],this.min,this.max),.5)};Lr.prototype.quadrant=function(d){for(var _=[d%2==0,d<2],p=n.clone$2(this.min),b=n.clone$2(this.max),B=0;B<_.length;B++)p[B]=_[B]?this.min[B]:this.center[B],b[B]=_[B]?this.center[B]:this.max[B];return b[2]=this.max[2],new Lr(p,b)},Lr.prototype.distanceX=function(d){return Math.max(Math.min(this.max[0],d[0]),this.min[0])-d[0]},Lr.prototype.distanceY=function(d){return Math.max(Math.min(this.max[1],d[1]),this.min[1])-d[1]},Lr.prototype.intersects=function(d){for(var _=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]],p=!0,b=0;b<d.planes.length;b++){for(var B=d.planes[b],k=0,V=0;V<_.length;V++)k+=n.dot$1(B,_[V])>=0;if(k===0)return 0;k!==_.length&&(p=!1)}if(p)return 2;for(var q=0;q<3;q++){for(var re=Number.MAX_VALUE,ue=-Number.MAX_VALUE,Ee=0;Ee<d.points.length;Ee++){var Ce=d.points[Ee][q]-this.min[q];re=Math.min(re,Ce),ue=Math.max(ue,Ce)}if(ue<0||re>this.max[q]-this.min[q])return 0}return 1};var Fi=function(d,_,p,b){if(d===void 0&&(d=0),_===void 0&&(_=0),p===void 0&&(p=0),b===void 0&&(b=0),isNaN(d)||d<0||isNaN(_)||_<0||isNaN(p)||p<0||isNaN(b)||b<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=_,this.left=p,this.right=b};Fi.prototype.interpolate=function(d,_,p){return _.top!=null&&d.top!=null&&(this.top=n.number(d.top,_.top,p)),_.bottom!=null&&d.bottom!=null&&(this.bottom=n.number(d.bottom,_.bottom,p)),_.left!=null&&d.left!=null&&(this.left=n.number(d.left,_.left,p)),_.right!=null&&d.right!=null&&(this.right=n.number(d.right,_.right,p)),this},Fi.prototype.getCenter=function(d,_){var p=n.clamp((this.left+d-this.right)/2,0,d),b=n.clamp((this.top+_-this.bottom)/2,0,_);return new n.Point(p,b)},Fi.prototype.equals=function(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right},Fi.prototype.clone=function(){return new Fi(this.top,this.bottom,this.left,this.right)},Fi.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var vr=function(d,_,p,b,B){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=B===void 0||B,this._minZoom=d||0,this._maxZoom=_||22,this._minPitch=p??0,this._maxPitch=b??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new n.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Fi,this._posMatrixCache={},this._alignedPosMatrixCache={}},jr={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};vr.prototype.clone=function(){var d=new vr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return d.tileSize=this.tileSize,d.latRange=this.latRange,d.width=this.width,d.height=this.height,d._center=this._center,d.zoom=this.zoom,d.angle=this.angle,d._fov=this._fov,d._pitch=this._pitch,d._unmodified=this._unmodified,d._edgeInsets=this._edgeInsets.clone(),d._calcMatrices(),d},jr.minZoom.get=function(){return this._minZoom},jr.minZoom.set=function(d){this._minZoom!==d&&(this._minZoom=d,this.zoom=Math.max(this.zoom,d))},jr.maxZoom.get=function(){return this._maxZoom},jr.maxZoom.set=function(d){this._maxZoom!==d&&(this._maxZoom=d,this.zoom=Math.min(this.zoom,d))},jr.minPitch.get=function(){return this._minPitch},jr.minPitch.set=function(d){this._minPitch!==d&&(this._minPitch=d,this.pitch=Math.max(this.pitch,d))},jr.maxPitch.get=function(){return this._maxPitch},jr.maxPitch.set=function(d){this._maxPitch!==d&&(this._maxPitch=d,this.pitch=Math.min(this.pitch,d))},jr.renderWorldCopies.get=function(){return this._renderWorldCopies},jr.renderWorldCopies.set=function(d){d===void 0?d=!0:d===null&&(d=!1),this._renderWorldCopies=d},jr.worldSize.get=function(){return this.tileSize*this.scale},jr.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},jr.size.get=function(){return new n.Point(this.width,this.height)},jr.bearing.get=function(){return-this.angle/Math.PI*180},jr.bearing.set=function(d){var _=-n.wrap(d,-180,180)*Math.PI/180;this.angle!==_&&(this._unmodified=!1,this.angle=_,this._calcMatrices(),this.rotationMatrix=n.create$2(),n.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},jr.pitch.get=function(){return this._pitch/Math.PI*180},jr.pitch.set=function(d){var _=n.clamp(d,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==_&&(this._unmodified=!1,this._pitch=_,this._calcMatrices())},jr.fov.get=function(){return this._fov/Math.PI*180},jr.fov.set=function(d){d=Math.max(.01,Math.min(60,d)),this._fov!==d&&(this._unmodified=!1,this._fov=d/180*Math.PI,this._calcMatrices())},jr.zoom.get=function(){return this._zoom},jr.zoom.set=function(d){var _=Math.min(Math.max(d,this.minZoom),this.maxZoom);this._zoom!==_&&(this._unmodified=!1,this._zoom=_,this.scale=this.zoomScale(_),this.tileZoom=Math.floor(_),this.zoomFraction=_-this.tileZoom,this._constrain(),this._calcMatrices())},jr.center.get=function(){return this._center},jr.center.set=function(d){d.lat===this._center.lat&&d.lng===this._center.lng||(this._unmodified=!1,this._center=d,this._constrain(),this._calcMatrices())},jr.padding.get=function(){return this._edgeInsets.toJSON()},jr.padding.set=function(d){this._edgeInsets.equals(d)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,d,1),this._calcMatrices())},jr.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},vr.prototype.isPaddingEqual=function(d){return this._edgeInsets.equals(d)},vr.prototype.interpolatePadding=function(d,_,p){this._unmodified=!1,this._edgeInsets.interpolate(d,_,p),this._constrain(),this._calcMatrices()},vr.prototype.coveringZoomLevel=function(d){var _=(d.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/d.tileSize));return Math.max(0,_)},vr.prototype.getVisibleUnwrappedCoordinates=function(d){var _=[new n.UnwrappedTileID(0,d)];if(this._renderWorldCopies)for(var p=this.pointCoordinate(new n.Point(0,0)),b=this.pointCoordinate(new n.Point(this.width,0)),B=this.pointCoordinate(new n.Point(this.width,this.height)),k=this.pointCoordinate(new n.Point(0,this.height)),V=Math.floor(Math.min(p.x,b.x,B.x,k.x)),q=Math.floor(Math.max(p.x,b.x,B.x,k.x)),re=V-1;re<=q+1;re++)re!==0&&_.push(new n.UnwrappedTileID(re,d));return _},vr.prototype.coveringTiles=function(d){var _=this.coveringZoomLevel(d),p=_;if(d.minzoom!==void 0&&_<d.minzoom)return[];d.maxzoom!==void 0&&_>d.maxzoom&&(_=d.maxzoom);var b=n.MercatorCoordinate.fromLngLat(this.center),B=Math.pow(2,_),k=[B*b.x,B*b.y,0],V=yr.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,_),q=d.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(q=_);var re=function(ir){return{aabb:new Lr([ir*B,0,0],[(ir+1)*B,B,0]),zoom:0,x:0,y:0,wrap:ir,fullyVisible:!1}},ue=[],Ee=[],Ce=_,Me=d.reparseOverscaled?p:_;if(this._renderWorldCopies)for(var He=1;He<=3;He++)ue.push(re(-He)),ue.push(re(He));for(ue.push(re(0));ue.length>0;){var Ue=ue.pop(),Ze=Ue.x,Ne=Ue.y,Ke=Ue.fullyVisible;if(!Ke){var it=Ue.aabb.intersects(V);if(it===0)continue;Ke=it===2}var pt=Ue.aabb.distanceX(k),Ct=Ue.aabb.distanceY(k),xt=Math.max(Math.abs(pt),Math.abs(Ct));if(Ue.zoom===Ce||xt>3+(1<<Ce-Ue.zoom)-2&&Ue.zoom>=q)Ee.push({tileID:new n.OverscaledTileID(Ue.zoom===Ce?Me:Ue.zoom,Ue.wrap,Ue.zoom,Ze,Ne),distanceSq:n.sqrLen([k[0]-.5-Ze,k[1]-.5-Ne])});else for(var Rt=0;Rt<4;Rt++){var Wt=(Ze<<1)+Rt%2,ar=(Ne<<1)+(Rt>>1);ue.push({aabb:Ue.aabb.quadrant(Rt),zoom:Ue.zoom+1,x:Wt,y:ar,wrap:Ue.wrap,fullyVisible:Ke})}}return Ee.sort(function(ir,Ir){return ir.distanceSq-Ir.distanceSq}).map(function(ir){return ir.tileID})},vr.prototype.resize=function(d,_){this.width=d,this.height=_,this.pixelsToGLUnits=[2/d,-2/_],this._constrain(),this._calcMatrices()},jr.unmodified.get=function(){return this._unmodified},vr.prototype.zoomScale=function(d){return Math.pow(2,d)},vr.prototype.scaleZoom=function(d){return Math.log(d)/Math.LN2},vr.prototype.project=function(d){var _=n.clamp(d.lat,-this.maxValidLatitude,this.maxValidLatitude);return new n.Point(n.mercatorXfromLng(d.lng)*this.worldSize,n.mercatorYfromLat(_)*this.worldSize)},vr.prototype.unproject=function(d){return new n.MercatorCoordinate(d.x/this.worldSize,d.y/this.worldSize).toLngLat()},jr.point.get=function(){return this.project(this.center)},vr.prototype.setLocationAtPoint=function(d,_){var p=this.pointCoordinate(_),b=this.pointCoordinate(this.centerPoint),B=this.locationCoordinate(d),k=new n.MercatorCoordinate(B.x-(p.x-b.x),B.y-(p.y-b.y));this.center=this.coordinateLocation(k),this._renderWorldCopies&&(this.center=this.center.wrap())},vr.prototype.locationPoint=function(d){return this.coordinatePoint(this.locationCoordinate(d))},vr.prototype.pointLocation=function(d){return this.coordinateLocation(this.pointCoordinate(d))},vr.prototype.locationCoordinate=function(d){return n.MercatorCoordinate.fromLngLat(d)},vr.prototype.coordinateLocation=function(d){return d.toLngLat()},vr.prototype.pointCoordinate=function(d){var _=[d.x,d.y,0,1],p=[d.x,d.y,1,1];n.transformMat4(_,_,this.pixelMatrixInverse),n.transformMat4(p,p,this.pixelMatrixInverse);var b=_[3],B=p[3],k=_[1]/b,V=p[1]/B,q=_[2]/b,re=p[2]/B,ue=q===re?0:(0-q)/(re-q);return new n.MercatorCoordinate(n.number(_[0]/b,p[0]/B,ue)/this.worldSize,n.number(k,V,ue)/this.worldSize)},vr.prototype.coordinatePoint=function(d){var _=[d.x*this.worldSize,d.y*this.worldSize,0,1];return n.transformMat4(_,_,this.pixelMatrix),new n.Point(_[0]/_[3],_[1]/_[3])},vr.prototype.getBounds=function(){return new n.LngLatBounds().extend(this.pointLocation(new n.Point(0,0))).extend(this.pointLocation(new n.Point(this.width,0))).extend(this.pointLocation(new n.Point(this.width,this.height))).extend(this.pointLocation(new n.Point(0,this.height)))},vr.prototype.getMaxBounds=function(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new n.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},vr.prototype.setMaxBounds=function(d){d?(this.lngRange=[d.getWest(),d.getEast()],this.latRange=[d.getSouth(),d.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},vr.prototype.calculatePosMatrix=function(d,_){_===void 0&&(_=!1);var p=d.key,b=_?this._alignedPosMatrixCache:this._posMatrixCache;if(b[p])return b[p];var B=d.canonical,k=this.worldSize/this.zoomScale(B.z),V=B.x+Math.pow(2,B.z)*d.wrap,q=n.identity(new Float64Array(16));return n.translate(q,q,[V*k,B.y*k,0]),n.scale(q,q,[k/n.EXTENT,k/n.EXTENT,1]),n.multiply(q,_?this.alignedProjMatrix:this.projMatrix,q),b[p]=new Float32Array(q),b[p]},vr.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},vr.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var d,_,p,b,B=-90,k=90,V=-180,q=180,re=this.size,ue=this._unmodified;if(this.latRange){var Ee=this.latRange;B=n.mercatorYfromLat(Ee[1])*this.worldSize,d=(k=n.mercatorYfromLat(Ee[0])*this.worldSize)-B<re.y?re.y/(k-B):0}if(this.lngRange){var Ce=this.lngRange;V=n.mercatorXfromLng(Ce[0])*this.worldSize,_=(q=n.mercatorXfromLng(Ce[1])*this.worldSize)-V<re.x?re.x/(q-V):0}var Me=this.point,He=Math.max(_||0,d||0);if(He)return this.center=this.unproject(new n.Point(_?(q+V)/2:Me.x,d?(k+B)/2:Me.y)),this.zoom+=this.scaleZoom(He),this._unmodified=ue,void(this._constraining=!1);if(this.latRange){var Ue=Me.y,Ze=re.y/2;Ue-Ze<B&&(b=B+Ze),Ue+Ze>k&&(b=k-Ze)}if(this.lngRange){var Ne=Me.x,Ke=re.x/2;Ne-Ke<V&&(p=V+Ke),Ne+Ke>q&&(p=q-Ke)}p===void 0&&b===void 0||(this.center=this.unproject(new n.Point(p!==void 0?p:Me.x,b!==void 0?b:Me.y))),this._unmodified=ue,this._constraining=!1}},vr.prototype._calcMatrices=function(){if(this.height){var d=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var _=Math.PI/2+this._pitch,p=this._fov*(.5+d.y/this.height),b=Math.sin(p)*this.cameraToCenterDistance/Math.sin(n.clamp(Math.PI-_-p,.01,Math.PI-.01)),B=this.point,k=B.x,V=B.y,q=1.01*(Math.cos(Math.PI/2-this._pitch)*b+this.cameraToCenterDistance),re=this.height/50,ue=new Float64Array(16);n.perspective(ue,this._fov,this.width/this.height,re,q),ue[8]=2*-d.x/this.width,ue[9]=2*d.y/this.height,n.scale(ue,ue,[1,-1,1]),n.translate(ue,ue,[0,0,-this.cameraToCenterDistance]),n.rotateX(ue,ue,this._pitch),n.rotateZ(ue,ue,this.angle),n.translate(ue,ue,[-k,-V,0]),this.mercatorMatrix=n.scale([],ue,[this.worldSize,this.worldSize,this.worldSize]),n.scale(ue,ue,[1,1,n.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=ue,this.invProjMatrix=n.invert([],this.projMatrix);var Ee=this.width%2/2,Ce=this.height%2/2,Me=Math.cos(this.angle),He=Math.sin(this.angle),Ue=k-Math.round(k)+Me*Ee+He*Ce,Ze=V-Math.round(V)+Me*Ce+He*Ee,Ne=new Float64Array(ue);if(n.translate(Ne,Ne,[Ue>.5?Ue-1:Ue,Ze>.5?Ze-1:Ze,0]),this.alignedProjMatrix=Ne,ue=n.create(),n.scale(ue,ue,[this.width/2,-this.height/2,1]),n.translate(ue,ue,[1,-1,0]),this.labelPlaneMatrix=ue,ue=n.create(),n.scale(ue,ue,[1,-1,1]),n.translate(ue,ue,[-1,-1,0]),n.scale(ue,ue,[2/this.width,2/this.height,1]),this.glCoordMatrix=ue,this.pixelMatrix=n.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(ue=n.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=ue,this._posMatrixCache={},this._alignedPosMatrixCache={}}},vr.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var d=this.pointCoordinate(new n.Point(0,0)),_=[d.x*this.worldSize,d.y*this.worldSize,0,1];return n.transformMat4(_,_,this.pixelMatrix)[3]/this.cameraToCenterDistance},vr.prototype.getCameraPoint=function(){var d=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new n.Point(0,d))},vr.prototype.getCameraQueryGeometry=function(d){var _=this.getCameraPoint();if(d.length===1)return[d[0],_];for(var p=_.x,b=_.y,B=_.x,k=_.y,V=0,q=d;V<q.length;V+=1){var re=q[V];p=Math.min(p,re.x),b=Math.min(b,re.y),B=Math.max(B,re.x),k=Math.max(k,re.y)}return[new n.Point(p,b),new n.Point(B,b),new n.Point(B,k),new n.Point(p,k),new n.Point(p,b)]},Object.defineProperties(vr.prototype,jr);var Ci=function(d){var _,p,b,B;this._hashName=d&&encodeURIComponent(d),n.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(_=this._updateHashUnthrottled.bind(this),p=!1,b=null,B=function(){b=null,p&&(_(),b=setTimeout(B,300),p=!1)},function(){return p=!0,b||B(),b})};Ci.prototype.addTo=function(d){return this._map=d,n.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Ci.prototype.remove=function(){return n.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Ci.prototype.getHashString=function(d){var _=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,b=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),B=Math.pow(10,b),k=Math.round(_.lng*B)/B,V=Math.round(_.lat*B)/B,q=this._map.getBearing(),re=this._map.getPitch(),ue="";if(ue+=d?"/"+k+"/"+V+"/"+p:p+"/"+V+"/"+k,(q||re)&&(ue+="/"+Math.round(10*q)/10),re&&(ue+="/"+Math.round(re)),this._hashName){var Ee=this._hashName,Ce=!1,Me=n.window.location.hash.slice(1).split("&").map(function(He){var Ue=He.split("=")[0];return Ue===Ee?(Ce=!0,Ue+"="+ue):He}).filter(function(He){return He});return Ce||Me.push(Ee+"="+ue),"#"+Me.join("&")}return"#"+ue},Ci.prototype._getCurrentHash=function(){var d,_=this,p=n.window.location.hash.replace("#","");return this._hashName?(p.split("&").map(function(b){return b.split("=")}).forEach(function(b){b[0]===_._hashName&&(d=b)}),(d&&d[1]||"").split("/")):p.split("/")},Ci.prototype._onHashChange=function(){var d=this._getCurrentHash();if(d.length>=3&&!d.some(function(p){return isNaN(p)})){var _=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(d[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+d[2],+d[1]],zoom:+d[0],bearing:_,pitch:+(d[4]||0)}),!0}return!1},Ci.prototype._updateHashUnthrottled=function(){var d=n.window.location.href.replace(/(#.+)?$/,this.getHashString());try{n.window.history.replaceState(n.window.history.state,null,d)}catch{}};var fi={linearity:.3,easing:n.bezier(0,0,.3,1)},Mn=n.extend({deceleration:2500,maxSpeed:1400},fi),rs=n.extend({deceleration:20,maxSpeed:1400},fi),js=n.extend({deceleration:1e3,maxSpeed:360},fi),Va=n.extend({deceleration:1e3,maxSpeed:90},fi),ta=function(d){this._map=d,this.clear()};function dl(d,_){(!d.duration||d.duration<_.duration)&&(d.duration=_.duration,d.easing=_.easing)}function vo(d,_,p){var b=p.maxSpeed,B=p.linearity,k=p.deceleration,V=n.clamp(d*B/(_/1e3),-b,b),q=Math.abs(V)/(k*B);return{easing:p.easing,duration:1e3*q,amount:V*(q/2)}}ta.prototype.clear=function(){this._inertiaBuffer=[]},ta.prototype.record=function(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:n.browser.now(),settings:d})},ta.prototype._drainInertiaBuffer=function(){for(var d=this._inertiaBuffer,_=n.browser.now();d.length>0&&_-d[0].time>160;)d.shift()},ta.prototype._onMoveEnd=function(d){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var _={zoom:0,bearing:0,pitch:0,pan:new n.Point(0,0),pinchAround:void 0,around:void 0},p=0,b=this._inertiaBuffer;p<b.length;p+=1){var B=b[p].settings;_.zoom+=B.zoomDelta||0,_.bearing+=B.bearingDelta||0,_.pitch+=B.pitchDelta||0,B.panDelta&&_.pan._add(B.panDelta),B.around&&(_.around=B.around),B.pinchAround&&(_.pinchAround=B.pinchAround)}var k=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,V={};if(_.pan.mag()){var q=vo(_.pan.mag(),k,n.extend({},Mn,d||{}));V.offset=_.pan.mult(q.amount/_.pan.mag()),V.center=this._map.transform.center,dl(V,q)}if(_.zoom){var re=vo(_.zoom,k,rs);V.zoom=this._map.transform.zoom+re.amount,dl(V,re)}if(_.bearing){var ue=vo(_.bearing,k,js);V.bearing=this._map.transform.bearing+n.clamp(ue.amount,-179,179),dl(V,ue)}if(_.pitch){var Ee=vo(_.pitch,k,Va);V.pitch=this._map.transform.pitch+Ee.amount,dl(V,Ee)}if(V.zoom||V.bearing){var Ce=_.pinchAround===void 0?_.around:_.pinchAround;V.around=Ce?this._map.unproject(Ce):this._map.getCenter()}return this.clear(),n.extend(V,{noMoveStart:!0})}};var us=function(d){function _(b,B,k,V){V===void 0&&(V={});var q=s.mousePos(B.getCanvasContainer(),k),re=B.unproject(q);d.call(this,b,n.extend({point:q,lngLat:re,originalEvent:k},V)),this._defaultPrevented=!1,this.target=B}d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_;var p={defaultPrevented:{configurable:!0}};return _.prototype.preventDefault=function(){this._defaultPrevented=!0},p.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(_.prototype,p),_}(n.Event),Jh=function(d){function _(b,B,k){var V=b==="touchend"?k.changedTouches:k.touches,q=s.touchPos(B.getCanvasContainer(),V),re=q.map(function(Ce){return B.unproject(Ce)}),ue=q.reduce(function(Ce,Me,He,Ue){return Ce.add(Me.div(Ue.length))},new n.Point(0,0)),Ee=B.unproject(ue);d.call(this,b,{points:q,point:ue,lngLats:re,lngLat:Ee,originalEvent:k}),this._defaultPrevented=!1}d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_;var p={defaultPrevented:{configurable:!0}};return _.prototype.preventDefault=function(){this._defaultPrevented=!0},p.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(_.prototype,p),_}(n.Event),Yg=function(d){function _(b,B,k){d.call(this,b,{originalEvent:k}),this._defaultPrevented=!1}d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_;var p={defaultPrevented:{configurable:!0}};return _.prototype.preventDefault=function(){this._defaultPrevented=!0},p.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(_.prototype,p),_}(n.Event),xn=function(d,_){this._map=d,this._clickTolerance=_.clickTolerance};xn.prototype.reset=function(){delete this._mousedownPos},xn.prototype.wheel=function(d){return this._firePreventable(new Yg(d.type,this._map,d))},xn.prototype.mousedown=function(d,_){return this._mousedownPos=_,this._firePreventable(new us(d.type,this._map,d))},xn.prototype.mouseup=function(d){this._map.fire(new us(d.type,this._map,d))},xn.prototype.click=function(d,_){this._mousedownPos&&this._mousedownPos.dist(_)>=this._clickTolerance||this._map.fire(new us(d.type,this._map,d))},xn.prototype.dblclick=function(d){return this._firePreventable(new us(d.type,this._map,d))},xn.prototype.mouseover=function(d){this._map.fire(new us(d.type,this._map,d))},xn.prototype.mouseout=function(d){this._map.fire(new us(d.type,this._map,d))},xn.prototype.touchstart=function(d){return this._firePreventable(new Jh(d.type,this._map,d))},xn.prototype.touchmove=function(d){this._map.fire(new Jh(d.type,this._map,d))},xn.prototype.touchend=function(d){this._map.fire(new Jh(d.type,this._map,d))},xn.prototype.touchcancel=function(d){this._map.fire(new Jh(d.type,this._map,d))},xn.prototype._firePreventable=function(d){if(this._map.fire(d),d.defaultPrevented)return{}},xn.prototype.isEnabled=function(){return!0},xn.prototype.isActive=function(){return!1},xn.prototype.enable=function(){},xn.prototype.disable=function(){};var Tr=function(d){this._map=d};Tr.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Tr.prototype.mousemove=function(d){this._map.fire(new us(d.type,this._map,d))},Tr.prototype.mousedown=function(){this._delayContextMenu=!0},Tr.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new us("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Tr.prototype.contextmenu=function(d){this._delayContextMenu?this._contextMenuEvent=d:this._map.fire(new us(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()},Tr.prototype.isEnabled=function(){return!0},Tr.prototype.isActive=function(){return!1},Tr.prototype.enable=function(){},Tr.prototype.disable=function(){};var lo=function(d,_){this._map=d,this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=_.clickTolerance||1};function Qf(d,_){for(var p={},b=0;b<d.length;b++)p[d[b].identifier]=_[b];return p}lo.prototype.isEnabled=function(){return!!this._enabled},lo.prototype.isActive=function(){return!!this._active},lo.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},lo.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},lo.prototype.mousedown=function(d,_){this.isEnabled()&&d.shiftKey&&d.button===0&&(s.disableDrag(),this._startPos=this._lastPos=_,this._active=!0)},lo.prototype.mousemoveWindow=function(d,_){if(this._active){var p=_;if(!(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)<this._clickTolerance)){var b=this._startPos;this._lastPos=p,this._box||(this._box=s.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",d));var B=Math.min(b.x,p.x),k=Math.max(b.x,p.x),V=Math.min(b.y,p.y),q=Math.max(b.y,p.y);s.setTransform(this._box,"translate("+B+"px,"+V+"px)"),this._box.style.width=k-B+"px",this._box.style.height=q-V+"px"}}},lo.prototype.mouseupWindow=function(d,_){var p=this;if(this._active&&d.button===0){var b=this._startPos,B=_;if(this.reset(),s.suppressClick(),b.x!==B.x||b.y!==B.y)return this._map.fire(new n.Event("boxzoomend",{originalEvent:d})),{cameraAnimation:function(k){return k.fitScreenCoordinates(b,B,p._map.getBearing(),{linear:!0})}};this._fireEvent("boxzoomcancel",d)}},lo.prototype.keydown=function(d){this._active&&d.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",d))},lo.prototype.blur=function(){this.reset()},lo.prototype.reset=function(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(s.remove(this._box),this._box=null),s.enableDrag(),delete this._startPos,delete this._lastPos},lo.prototype._fireEvent=function(d,_){return this._map.fire(new n.Event(d,{originalEvent:_}))};var nf=function(d){this.reset(),this.numTouches=d.numTouches};nf.prototype.reset=function(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1},nf.prototype.touchstart=function(d,_,p){(this.centroid||p.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=d.timeStamp),p.length===this.numTouches&&(this.centroid=function(b){for(var B=new n.Point(0,0),k=0,V=b;k<V.length;k+=1)B._add(V[k]);return B.div(b.length)}(_),this.touches=Qf(p,_)))},nf.prototype.touchmove=function(d,_,p){if(!this.aborted&&this.centroid){var b=Qf(p,_);for(var B in this.touches){var k=b[B];(!k||k.dist(this.touches[B])>30)&&(this.aborted=!0)}}},nf.prototype.touchend=function(d,_,p){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){var b=!this.aborted&&this.centroid;if(this.reset(),b)return b}};var Ha=function(d){this.singleTap=new nf(d),this.numTaps=d.numTaps,this.reset()};Ha.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},Ha.prototype.touchstart=function(d,_,p){this.singleTap.touchstart(d,_,p)},Ha.prototype.touchmove=function(d,_,p){this.singleTap.touchmove(d,_,p)},Ha.prototype.touchend=function(d,_,p){var b=this.singleTap.touchend(d,_,p);if(b){var B=d.timeStamp-this.lastTime<500,k=!this.lastTap||this.lastTap.dist(b)<30;if(B&&k||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=b,this.count===this.numTaps)return this.reset(),b}};var ja=function(){this._zoomIn=new Ha({numTouches:1,numTaps:2}),this._zoomOut=new Ha({numTouches:2,numTaps:1}),this.reset()};ja.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},ja.prototype.touchstart=function(d,_,p){this._zoomIn.touchstart(d,_,p),this._zoomOut.touchstart(d,_,p)},ja.prototype.touchmove=function(d,_,p){this._zoomIn.touchmove(d,_,p),this._zoomOut.touchmove(d,_,p)},ja.prototype.touchend=function(d,_,p){var b=this,B=this._zoomIn.touchend(d,_,p),k=this._zoomOut.touchend(d,_,p);return B?(this._active=!0,d.preventDefault(),setTimeout(function(){return b.reset()},0),{cameraAnimation:function(V){return V.easeTo({duration:300,zoom:V.getZoom()+1,around:V.unproject(B)},{originalEvent:d})}}):k?(this._active=!0,d.preventDefault(),setTimeout(function(){return b.reset()},0),{cameraAnimation:function(V){return V.easeTo({duration:300,zoom:V.getZoom()-1,around:V.unproject(k)},{originalEvent:d})}}):void 0},ja.prototype.touchcancel=function(){this.reset()},ja.prototype.enable=function(){this._enabled=!0},ja.prototype.disable=function(){this._enabled=!1,this.reset()},ja.prototype.isEnabled=function(){return this._enabled},ja.prototype.isActive=function(){return this._active};var LA={0:1,2:2},gr=function(d){this.reset(),this._clickTolerance=d.clickTolerance||1};gr.prototype.blur=function(){this.reset()},gr.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},gr.prototype._correctButton=function(d,_){return!1},gr.prototype._move=function(d,_){return{}},gr.prototype.mousedown=function(d,_){if(!this._lastPoint){var p=s.mouseButton(d);this._correctButton(d,p)&&(this._lastPoint=_,this._eventButton=p)}},gr.prototype.mousemoveWindow=function(d,_){var p=this._lastPoint;if(p){if(d.preventDefault(),function(b,B){var k=LA[B];return b.buttons===void 0||(b.buttons&k)!==k}(d,this._eventButton))this.reset();else if(this._moved||!(_.dist(p)<this._clickTolerance))return this._moved=!0,this._lastPoint=_,this._move(p,_)}},gr.prototype.mouseupWindow=function(d){this._lastPoint&&s.mouseButton(d)===this._eventButton&&(this._moved&&s.suppressClick(),this.reset())},gr.prototype.enable=function(){this._enabled=!0},gr.prototype.disable=function(){this._enabled=!1,this.reset()},gr.prototype.isEnabled=function(){return this._enabled},gr.prototype.isActive=function(){return this._active};var up=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.mousedown=function(p,b){d.prototype.mousedown.call(this,p,b),this._lastPoint&&(this._active=!0)},_.prototype._correctButton=function(p,b){return b===0&&!p.ctrlKey},_.prototype._move=function(p,b){return{around:b,panDelta:b.sub(p)}},_}(gr),of=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype._correctButton=function(p,b){return b===0&&p.ctrlKey||b===2},_.prototype._move=function(p,b){var B=.8*(b.x-p.x);if(B)return this._active=!0,{bearingDelta:B}},_.prototype.contextmenu=function(p){p.preventDefault()},_}(gr),Gc=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype._correctButton=function(p,b){return b===0&&p.ctrlKey||b===2},_.prototype._move=function(p,b){var B=-.5*(b.y-p.y);if(B)return this._active=!0,{pitchDelta:B}},_.prototype.contextmenu=function(p){p.preventDefault()},_}(gr),pl=function(d){this._minTouches=1,this._clickTolerance=d.clickTolerance||1,this.reset()};pl.prototype.reset=function(){this._active=!1,this._touches={},this._sum=new n.Point(0,0)},pl.prototype.touchstart=function(d,_,p){return this._calculateTransform(d,_,p)},pl.prototype.touchmove=function(d,_,p){if(this._active&&!(p.length<this._minTouches))return d.preventDefault(),this._calculateTransform(d,_,p)},pl.prototype.touchend=function(d,_,p){this._calculateTransform(d,_,p),this._active&&p.length<this._minTouches&&this.reset()},pl.prototype.touchcancel=function(){this.reset()},pl.prototype._calculateTransform=function(d,_,p){p.length>0&&(this._active=!0);var b=Qf(p,_),B=new n.Point(0,0),k=new n.Point(0,0),V=0;for(var q in b){var re=b[q],ue=this._touches[q];ue&&(B._add(re),k._add(re.sub(ue)),V++,b[q]=re)}if(this._touches=b,!(V<this._minTouches)&&k.mag()){var Ee=k.div(V);if(this._sum._add(Ee),!(this._sum.mag()<this._clickTolerance))return{around:B.div(V),panDelta:Ee}}},pl.prototype.enable=function(){this._enabled=!0},pl.prototype.disable=function(){this._enabled=!1,this.reset()},pl.prototype.isEnabled=function(){return this._enabled},pl.prototype.isActive=function(){return this._active};var Ca=function(){this.reset()};function sf(d,_,p){for(var b=0;b<d.length;b++)if(d[b].identifier===p)return _[b]}function dc(d,_){return Math.log(d/_)/Math.LN2}Ca.prototype.reset=function(){this._active=!1,delete this._firstTwoTouches},Ca.prototype._start=function(d){},Ca.prototype._move=function(d,_,p){return{}},Ca.prototype.touchstart=function(d,_,p){this._firstTwoTouches||p.length<2||(this._firstTwoTouches=[p[0].identifier,p[1].identifier],this._start([_[0],_[1]]))},Ca.prototype.touchmove=function(d,_,p){if(this._firstTwoTouches){d.preventDefault();var b=this._firstTwoTouches,B=b[1],k=sf(p,_,b[0]),V=sf(p,_,B);if(k&&V){var q=this._aroundCenter?null:k.add(V).div(2);return this._move([k,V],q,d)}}},Ca.prototype.touchend=function(d,_,p){if(this._firstTwoTouches){var b=this._firstTwoTouches,B=b[1],k=sf(p,_,b[0]),V=sf(p,_,B);k&&V||(this._active&&s.suppressClick(),this.reset())}},Ca.prototype.touchcancel=function(){this.reset()},Ca.prototype.enable=function(d){this._enabled=!0,this._aroundCenter=!!d&&d.around==="center"},Ca.prototype.disable=function(){this._enabled=!1,this.reset()},Ca.prototype.isEnabled=function(){return this._enabled},Ca.prototype.isActive=function(){return this._active};var fs=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.reset=function(){d.prototype.reset.call(this),delete this._distance,delete this._startDistance},_.prototype._start=function(p){this._startDistance=this._distance=p[0].dist(p[1])},_.prototype._move=function(p,b){var B=this._distance;if(this._distance=p[0].dist(p[1]),this._active||!(Math.abs(dc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:dc(this._distance,B),pinchAround:b}},_}(Ca);function pc(d,_){return 180*d.angleWith(_)/Math.PI}var FA=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.reset=function(){d.prototype.reset.call(this),delete this._minDiameter,delete this._startVector,delete this._vector},_.prototype._start=function(p){this._startVector=this._vector=p[0].sub(p[1]),this._minDiameter=p[0].dist(p[1])},_.prototype._move=function(p,b){var B=this._vector;if(this._vector=p[0].sub(p[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:pc(this._vector,B),pinchAround:b}},_.prototype._isBelowThreshold=function(p){this._minDiameter=Math.min(this._minDiameter,p.mag());var b=25/(Math.PI*this._minDiameter)*360,B=pc(p,this._startVector);return Math.abs(B)<b},_}(Ca);function af(d){return Math.abs(d.y)>Math.abs(d.x)}var NA=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.reset=function(){d.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},_.prototype._start=function(p){this._lastPoints=p,af(p[0].sub(p[1]))&&(this._valid=!1)},_.prototype._move=function(p,b,B){var k=p[0].sub(this._lastPoints[0]),V=p[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(k,V,B.timeStamp),this._valid)return this._lastPoints=p,this._active=!0,{pitchDelta:(k.y+V.y)/2*-.5}},_.prototype.gestureBeginsVertically=function(p,b,B){if(this._valid!==void 0)return this._valid;var k=p.mag()>=2,V=b.mag()>=2;if(k||V){if(!k||!V)return this._firstMove===void 0&&(this._firstMove=B),B-this._firstMove<100&&void 0;var q=p.y>0==b.y>0;return af(p)&&af(b)&&q}},_}(Ca),kA={panStep:100,bearingStep:15,pitchStep:10},Il=function(){var d=kA;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1};function Al(d){return d*(2-d)}Il.prototype.blur=function(){this.reset()},Il.prototype.reset=function(){this._active=!1},Il.prototype.keydown=function(d){var _=this;if(!(d.altKey||d.ctrlKey||d.metaKey)){var p=0,b=0,B=0,k=0,V=0;switch(d.keyCode){case 61:case 107:case 171:case 187:p=1;break;case 189:case 109:case 173:p=-1;break;case 37:d.shiftKey?b=-1:(d.preventDefault(),k=-1);break;case 39:d.shiftKey?b=1:(d.preventDefault(),k=1);break;case 38:d.shiftKey?B=1:(d.preventDefault(),V=-1);break;case 40:d.shiftKey?B=-1:(d.preventDefault(),V=1);break;default:return}return this._rotationDisabled&&(b=0,B=0),{cameraAnimation:function(q){var re=q.getZoom();q.easeTo({duration:300,easeId:"keyboardHandler",easing:Al,zoom:p?Math.round(re)+p*(d.shiftKey?2:1):re,bearing:q.getBearing()+b*_._bearingStep,pitch:q.getPitch()+B*_._pitchStep,offset:[-k*_._panStep,-V*_._panStep],center:q.getCenter()},{originalEvent:d})}}}},Il.prototype.enable=function(){this._enabled=!0},Il.prototype.disable=function(){this._enabled=!1,this.reset()},Il.prototype.isEnabled=function(){return this._enabled},Il.prototype.isActive=function(){return this._active},Il.prototype.disableRotation=function(){this._rotationDisabled=!0},Il.prototype.enableRotation=function(){this._rotationDisabled=!1};var qi=function(d,_){this._map=d,this._el=d.getCanvasContainer(),this._handler=_,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,n.bindAll(["_onTimeout"],this)};qi.prototype.setZoomRate=function(d){this._defaultZoomRate=d},qi.prototype.setWheelZoomRate=function(d){this._wheelZoomRate=d},qi.prototype.isEnabled=function(){return!!this._enabled},qi.prototype.isActive=function(){return!!this._active||this._finishTimeout!==void 0},qi.prototype.isZooming=function(){return!!this._zooming},qi.prototype.enable=function(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=d&&d.around==="center")},qi.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},qi.prototype.wheel=function(d){if(this.isEnabled()){var _=d.deltaMode===n.window.WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY,p=n.browser.now(),b=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,_!==0&&_%4.000244140625==0?this._type="wheel":_!==0&&Math.abs(_)<4?this._type="trackpad":b>400?(this._type=null,this._lastValue=_,this._timeout=setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(b*_)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,_+=this._lastValue)),d.shiftKey&&_&&(_/=4),this._type&&(this._lastWheelEvent=d,this._delta-=_,this._active||this._start(d)),d.preventDefault()}},qi.prototype._onTimeout=function(d){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},qi.prototype._start=function(d){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var _=s.mousePos(this._el,d);this._around=n.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(_)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},qi.prototype.renderFrame=function(){var d=this;if(this._frameId&&(this._frameId=null,this.isActive())){var _=this._map.transform;if(this._delta!==0){var p=this._type==="wheel"&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,b=2/(1+Math.exp(-Math.abs(this._delta*p)));this._delta<0&&b!==0&&(b=1/b);var B=typeof this._targetZoom=="number"?_.zoomScale(this._targetZoom):_.scale;this._targetZoom=Math.min(_.maxZoom,Math.max(_.minZoom,_.scaleZoom(B*b))),this._type==="wheel"&&(this._startZoom=_.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var k,V=typeof this._targetZoom=="number"?this._targetZoom:_.zoom,q=this._startZoom,re=this._easing,ue=!1;if(this._type==="wheel"&&q&&re){var Ee=Math.min((n.browser.now()-this._lastWheelEventTime)/200,1),Ce=re(Ee);k=n.number(q,V,Ce),Ee<1?this._frameId||(this._frameId=!0):ue=!0}else k=V,ue=!0;return this._active=!0,ue&&(this._active=!1,this._finishTimeout=setTimeout(function(){d._zooming=!1,d._handler._triggerRenderFrame(),delete d._targetZoom,delete d._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!ue,zoomDelta:k-_.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},qi.prototype._smoothOutEasing=function(d){var _=n.ease;if(this._prevEase){var p=this._prevEase,b=(n.browser.now()-p.start)/p.duration,B=p.easing(b+.01)-p.easing(b),k=.27/Math.sqrt(B*B+1e-4)*.01,V=Math.sqrt(.0729-k*k);_=n.bezier(k,V,.25,1)}return this._prevEase={start:n.browser.now(),duration:d,easing:_},_},qi.prototype.blur=function(){this.reset()},qi.prototype.reset=function(){this._active=!1};var Ac=function(d,_){this._clickZoom=d,this._tapZoom=_};Ac.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},Ac.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},Ac.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},Ac.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var Pl=function(){this.reset()};Pl.prototype.reset=function(){this._active=!1},Pl.prototype.blur=function(){this.reset()},Pl.prototype.dblclick=function(d,_){return d.preventDefault(),{cameraAnimation:function(p){p.easeTo({duration:300,zoom:p.getZoom()+(d.shiftKey?-1:1),around:p.unproject(_)},{originalEvent:d})}}},Pl.prototype.enable=function(){this._enabled=!0},Pl.prototype.disable=function(){this._enabled=!1,this.reset()},Pl.prototype.isEnabled=function(){return this._enabled},Pl.prototype.isActive=function(){return this._active};var Gs=function(){this._tap=new Ha({numTouches:1,numTaps:1}),this.reset()};Gs.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},Gs.prototype.touchstart=function(d,_,p){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?p.length>0&&(this._swipePoint=_[0],this._swipeTouch=p[0].identifier):this._tap.touchstart(d,_,p))},Gs.prototype.touchmove=function(d,_,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;var b=_[0],B=b.y-this._swipePoint.y;return this._swipePoint=b,d.preventDefault(),this._active=!0,{zoomDelta:B/128}}}else this._tap.touchmove(d,_,p)},Gs.prototype.touchend=function(d,_,p){this._tapTime?this._swipePoint&&p.length===0&&this.reset():this._tap.touchend(d,_,p)&&(this._tapTime=d.timeStamp)},Gs.prototype.touchcancel=function(){this.reset()},Gs.prototype.enable=function(){this._enabled=!0},Gs.prototype.disable=function(){this._enabled=!1,this.reset()},Gs.prototype.isEnabled=function(){return this._enabled},Gs.prototype.isActive=function(){return this._active};var lf=function(d,_,p){this._el=d,this._mousePan=_,this._touchPan=p};lf.prototype.enable=function(d){this._inertiaOptions=d||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},lf.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},lf.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},lf.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var pu=function(d,_,p){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=_,this._mousePitch=p};pu.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},pu.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},pu.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},pu.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var Yl=function(d,_,p,b){this._el=d,this._touchZoom=_,this._touchRotate=p,this._tapDragZoom=b,this._rotationDisabled=!1,this._enabled=!0};Yl.prototype.enable=function(d){this._touchZoom.enable(d),this._rotationDisabled||this._touchRotate.enable(d),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")},Yl.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},Yl.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},Yl.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},Yl.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},Yl.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var Ps=function(d){return d.zoom||d.drag||d.pitch||d.rotate},Qh=function(d){function _(){d.apply(this,arguments)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_}(n.Event);function ei(d){return d.panDelta&&d.panDelta.mag()||d.zoomDelta||d.bearingDelta||d.pitchDelta}var zr=function(d,_){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ta(d),this._bearingSnap=_.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(_),n.bindAll(["handleEvent","handleWindowEvent"],this);var p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[n.window.document,"mousemove",{capture:!0}],[n.window.document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[n.window,"blur",void 0]];for(var b=0,B=this._listeners;b<B.length;b+=1){var k=B[b],V=k[0];s.addEventListener(V,k[1],V===n.window.document?this.handleWindowEvent:this.handleEvent,k[2])}};zr.prototype.destroy=function(){for(var d=0,_=this._listeners;d<_.length;d+=1){var p=_[d],b=p[0];s.removeEventListener(b,p[1],b===n.window.document?this.handleWindowEvent:this.handleEvent,p[2])}},zr.prototype._addDefaultHandlers=function(d){var _=this._map,p=_.getCanvasContainer();this._add("mapEvent",new xn(_,d));var b=_.boxZoom=new lo(_,d);this._add("boxZoom",b);var B=new ja,k=new Pl;_.doubleClickZoom=new Ac(k,B),this._add("tapZoom",B),this._add("clickZoom",k);var V=new Gs;this._add("tapDragZoom",V);var q=_.touchPitch=new NA;this._add("touchPitch",q);var re=new of(d),ue=new Gc(d);_.dragRotate=new pu(d,re,ue),this._add("mouseRotate",re,["mousePitch"]),this._add("mousePitch",ue,["mouseRotate"]);var Ee=new up(d),Ce=new pl(d);_.dragPan=new lf(p,Ee,Ce),this._add("mousePan",Ee),this._add("touchPan",Ce,["touchZoom","touchRotate"]);var Me=new FA,He=new fs;_.touchZoomRotate=new Yl(p,He,Me,V),this._add("touchRotate",Me,["touchPan","touchZoom"]),this._add("touchZoom",He,["touchPan","touchRotate"]);var Ue=_.scrollZoom=new qi(_,this);this._add("scrollZoom",Ue,["mousePan"]);var Ze=_.keyboard=new Il;this._add("keyboard",Ze),this._add("blockableMapEvent",new Tr(_));for(var Ne=0,Ke=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];Ne<Ke.length;Ne+=1){var it=Ke[Ne];d.interactive&&d[it]&&_[it].enable(d[it])}},zr.prototype._add=function(d,_,p){this._handlers.push({handlerName:d,handler:_,allowed:p}),this._handlersById[d]=_},zr.prototype.stop=function(d){if(!this._updatingCamera){for(var _=0,p=this._handlers;_<p.length;_+=1)p[_].handler.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[]}},zr.prototype.isActive=function(){for(var d=0,_=this._handlers;d<_.length;d+=1)if(_[d].handler.isActive())return!0;return!1},zr.prototype.isZooming=function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()},zr.prototype.isRotating=function(){return!!this._eventsInProgress.rotate},zr.prototype.isMoving=function(){return Boolean(Ps(this._eventsInProgress))||this.isZooming()},zr.prototype._blockedByActive=function(d,_,p){for(var b in d)if(b!==p&&(!_||_.indexOf(b)<0))return!0;return!1},zr.prototype.handleWindowEvent=function(d){this.handleEvent(d,d.type+"Window")},zr.prototype._getMapTouches=function(d){for(var _=[],p=0,b=d;p<b.length;p+=1){var B=b[p];this._el.contains(B.target)&&_.push(B)}return _},zr.prototype.handleEvent=function(d,_){this._updatingCamera=!0;for(var p=d.type==="renderFrame"?void 0:d,b={needsRenderFrame:!1},B={},k={},V=d.touches?this._getMapTouches(d.touches):void 0,q=V?s.touchPos(this._el,V):s.mousePos(this._el,d),re=0,ue=this._handlers;re<ue.length;re+=1){var Ee=ue[re],Ce=Ee.handlerName,Me=Ee.handler,He=Ee.allowed;if(Me.isEnabled()){var Ue=void 0;this._blockedByActive(k,He,Ce)?Me.reset():Me[_||d.type]&&(Ue=Me[_||d.type](d,q,V),this.mergeHandlerResult(b,B,Ue,Ce,p),Ue&&Ue.needsRenderFrame&&this._triggerRenderFrame()),(Ue||Me.isActive())&&(k[Ce]=Me)}}var Ze={};for(var Ne in this._previousActiveHandlers)k[Ne]||(Ze[Ne]=p);this._previousActiveHandlers=k,(Object.keys(Ze).length||ei(b))&&(this._changes.push([b,B,Ze]),this._triggerRenderFrame()),(Object.keys(k).length||ei(b))&&this._map._stop(!0),this._updatingCamera=!1;var Ke=b.cameraAnimation;Ke&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Ke(this._map))},zr.prototype.mergeHandlerResult=function(d,_,p,b,B){if(p){n.extend(d,p);var k={handlerName:b,originalEvent:p.originalEvent||B};p.zoomDelta!==void 0&&(_.zoom=k),p.panDelta!==void 0&&(_.drag=k),p.pitchDelta!==void 0&&(_.pitch=k),p.bearingDelta!==void 0&&(_.rotate=k)}},zr.prototype._applyChanges=function(){for(var d={},_={},p={},b=0,B=this._changes;b<B.length;b+=1){var k=B[b],V=k[0],q=k[1],re=k[2];V.panDelta&&(d.panDelta=(d.panDelta||new n.Point(0,0))._add(V.panDelta)),V.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+V.zoomDelta),V.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+V.bearingDelta),V.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+V.pitchDelta),V.around!==void 0&&(d.around=V.around),V.pinchAround!==void 0&&(d.pinchAround=V.pinchAround),V.noInertia&&(d.noInertia=V.noInertia),n.extend(_,q),n.extend(p,re)}this._updateMapTransform(d,_,p),this._changes=[]},zr.prototype._updateMapTransform=function(d,_,p){var b=this._map,B=b.transform;if(!ei(d))return this._fireEvents(_,p,!0);var k=d.panDelta,V=d.zoomDelta,q=d.bearingDelta,re=d.pitchDelta,ue=d.around,Ee=d.pinchAround;Ee!==void 0&&(ue=Ee),b._stop(!0),ue=ue||b.transform.centerPoint;var Ce=B.pointLocation(k?ue.sub(k):ue);q&&(B.bearing+=q),re&&(B.pitch+=re),V&&(B.zoom+=V),B.setLocationAtPoint(Ce,ue),this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(_,p,!0)},zr.prototype._fireEvents=function(d,_,p){var b=this,B=Ps(this._eventsInProgress),k=Ps(d),V={};for(var q in d)this._eventsInProgress[q]||(V[q+"start"]=d[q].originalEvent),this._eventsInProgress[q]=d[q];for(var re in!B&&k&&this._fireEvent("movestart",k.originalEvent),V)this._fireEvent(re,V[re]);for(var ue in k&&this._fireEvent("move",k.originalEvent),d)this._fireEvent(ue,d[ue].originalEvent);var Ee,Ce={};for(var Me in this._eventsInProgress){var He=this._eventsInProgress[Me],Ue=He.handlerName,Ze=He.originalEvent;this._handlersById[Ue].isActive()||(delete this._eventsInProgress[Me],Ce[Me+"end"]=Ee=_[Ue]||Ze)}for(var Ne in Ce)this._fireEvent(Ne,Ce[Ne]);var Ke=Ps(this._eventsInProgress);if(p&&(B||k)&&!Ke){this._updatingCamera=!0;var it=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),pt=function(Ct){return Ct!==0&&-b._bearingSnap<Ct&&Ct<b._bearingSnap};it?(pt(it.bearing||this._map.getBearing())&&(it.bearing=0),this._map.easeTo(it,{originalEvent:Ee})):(this._map.fire(new n.Event("moveend",{originalEvent:Ee})),pt(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}},zr.prototype._fireEvent=function(d,_){this._map.fire(new n.Event(d,_?{originalEvent:_}:{}))},zr.prototype._requestFrame=function(){var d=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add(function(_){delete d._frameId,d.handleEvent(new Qh("renderFrame",{timeStamp:_})),d._applyChanges()})},zr.prototype._triggerRenderFrame=function(){this._frameId===void 0&&(this._frameId=this._requestFrame())};var Au=function(d){function _(p,b){d.call(this),this._moving=!1,this._zooming=!1,this.transform=p,this._bearingSnap=b.bearingSnap,n.bindAll(["_renderFrameCallback"],this)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.getCenter=function(){return new n.LngLat(this.transform.center.lng,this.transform.center.lat)},_.prototype.setCenter=function(p,b){return this.jumpTo({center:p},b)},_.prototype.panBy=function(p,b,B){return p=n.Point.convert(p).mult(-1),this.panTo(this.transform.center,n.extend({offset:p},b),B)},_.prototype.panTo=function(p,b,B){return this.easeTo(n.extend({center:p},b),B)},_.prototype.getZoom=function(){return this.transform.zoom},_.prototype.setZoom=function(p,b){return this.jumpTo({zoom:p},b),this},_.prototype.zoomTo=function(p,b,B){return this.easeTo(n.extend({zoom:p},b),B)},_.prototype.zoomIn=function(p,b){return this.zoomTo(this.getZoom()+1,p,b),this},_.prototype.zoomOut=function(p,b){return this.zoomTo(this.getZoom()-1,p,b),this},_.prototype.getBearing=function(){return this.transform.bearing},_.prototype.setBearing=function(p,b){return this.jumpTo({bearing:p},b),this},_.prototype.getPadding=function(){return this.transform.padding},_.prototype.setPadding=function(p,b){return this.jumpTo({padding:p},b),this},_.prototype.rotateTo=function(p,b,B){return this.easeTo(n.extend({bearing:p},b),B)},_.prototype.resetNorth=function(p,b){return this.rotateTo(0,n.extend({duration:1e3},p),b),this},_.prototype.resetNorthPitch=function(p,b){return this.easeTo(n.extend({bearing:0,pitch:0,duration:1e3},p),b),this},_.prototype.snapToNorth=function(p,b){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(p,b):this},_.prototype.getPitch=function(){return this.transform.pitch},_.prototype.setPitch=function(p,b){return this.jumpTo({pitch:p},b),this},_.prototype.cameraForBounds=function(p,b){p=n.LngLatBounds.convert(p);var B=b&&b.bearing||0;return this._cameraForBoxAndBearing(p.getNorthWest(),p.getSouthEast(),B,b)},_.prototype._cameraForBoxAndBearing=function(p,b,B,k){var V={top:0,bottom:0,right:0,left:0};if(typeof(k=n.extend({padding:V,offset:[0,0],maxZoom:this.transform.maxZoom},k)).padding=="number"){var q=k.padding;k.padding={top:q,bottom:q,right:q,left:q}}k.padding=n.extend(V,k.padding);var re=this.transform,ue=re.padding,Ee=re.project(n.LngLat.convert(p)),Ce=re.project(n.LngLat.convert(b)),Me=Ee.rotate(-B*Math.PI/180),He=Ce.rotate(-B*Math.PI/180),Ue=new n.Point(Math.max(Me.x,He.x),Math.max(Me.y,He.y)),Ze=new n.Point(Math.min(Me.x,He.x),Math.min(Me.y,He.y)),Ne=Ue.sub(Ze),Ke=(re.width-(ue.left+ue.right+k.padding.left+k.padding.right))/Ne.x,it=(re.height-(ue.top+ue.bottom+k.padding.top+k.padding.bottom))/Ne.y;if(!(it<0||Ke<0)){var pt=Math.min(re.scaleZoom(re.scale*Math.min(Ke,it)),k.maxZoom),Ct=typeof k.offset.x=="number"?new n.Point(k.offset.x,k.offset.y):n.Point.convert(k.offset),xt=new n.Point((k.padding.left-k.padding.right)/2,(k.padding.top-k.padding.bottom)/2).rotate(B*Math.PI/180),Rt=Ct.add(xt).mult(re.scale/re.zoomScale(pt));return{center:re.unproject(Ee.add(Ce).div(2).sub(Rt)),zoom:pt,bearing:B}}n.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},_.prototype.fitBounds=function(p,b,B){return this._fitInternal(this.cameraForBounds(p,b),b,B)},_.prototype.fitScreenCoordinates=function(p,b,B,k,V){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(n.Point.convert(p)),this.transform.pointLocation(n.Point.convert(b)),B,k),k,V)},_.prototype._fitInternal=function(p,b,B){return p?(delete(b=n.extend(p,b)).padding,b.linear?this.easeTo(b,B):this.flyTo(b,B)):this},_.prototype.jumpTo=function(p,b){this.stop();var B=this.transform,k=!1,V=!1,q=!1;return"zoom"in p&&B.zoom!==+p.zoom&&(k=!0,B.zoom=+p.zoom),p.center!==void 0&&(B.center=n.LngLat.convert(p.center)),"bearing"in p&&B.bearing!==+p.bearing&&(V=!0,B.bearing=+p.bearing),"pitch"in p&&B.pitch!==+p.pitch&&(q=!0,B.pitch=+p.pitch),p.padding==null||B.isPaddingEqual(p.padding)||(B.padding=p.padding),this.fire(new n.Event("movestart",b)).fire(new n.Event("move",b)),k&&this.fire(new n.Event("zoomstart",b)).fire(new n.Event("zoom",b)).fire(new n.Event("zoomend",b)),V&&this.fire(new n.Event("rotatestart",b)).fire(new n.Event("rotate",b)).fire(new n.Event("rotateend",b)),q&&this.fire(new n.Event("pitchstart",b)).fire(new n.Event("pitch",b)).fire(new n.Event("pitchend",b)),this.fire(new n.Event("moveend",b))},_.prototype.easeTo=function(p,b){var B=this;this._stop(!1,p.easeId),((p=n.extend({offset:[0,0],duration:500,easing:n.ease},p)).animate===!1||!p.essential&&n.browser.prefersReducedMotion)&&(p.duration=0);var k=this.transform,V=this.getZoom(),q=this.getBearing(),re=this.getPitch(),ue=this.getPadding(),Ee="zoom"in p?+p.zoom:V,Ce="bearing"in p?this._normalizeBearing(p.bearing,q):q,Me="pitch"in p?+p.pitch:re,He="padding"in p?p.padding:k.padding,Ue=n.Point.convert(p.offset),Ze=k.centerPoint.add(Ue),Ne=k.pointLocation(Ze),Ke=n.LngLat.convert(p.center||Ne);this._normalizeCenter(Ke);var it,pt,Ct=k.project(Ne),xt=k.project(Ke).sub(Ct),Rt=k.zoomScale(Ee-V);p.around&&(it=n.LngLat.convert(p.around),pt=k.locationPoint(it));var Wt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||Ee!==V,this._rotating=this._rotating||q!==Ce,this._pitching=this._pitching||Me!==re,this._padding=!k.isPaddingEqual(He),this._easeId=p.easeId,this._prepareEase(b,p.noMoveStart,Wt),this._ease(function(ar){if(B._zooming&&(k.zoom=n.number(V,Ee,ar)),B._rotating&&(k.bearing=n.number(q,Ce,ar)),B._pitching&&(k.pitch=n.number(re,Me,ar)),B._padding&&(k.interpolatePadding(ue,He,ar),Ze=k.centerPoint.add(Ue)),it)k.setLocationAtPoint(it,pt);else{var ir=k.zoomScale(k.zoom-V),Ir=Ee>V?Math.min(2,Rt):Math.max(.5,Rt),ti=Math.pow(Ir,1-ar),oi=k.unproject(Ct.add(xt.mult(ar*ti)).mult(ir));k.setLocationAtPoint(k.renderWorldCopies?oi.wrap():oi,Ze)}B._fireMoveEvents(b)},function(ar){B._afterEase(b,ar)},p),this},_.prototype._prepareEase=function(p,b,B){B===void 0&&(B={}),this._moving=!0,b||B.moving||this.fire(new n.Event("movestart",p)),this._zooming&&!B.zooming&&this.fire(new n.Event("zoomstart",p)),this._rotating&&!B.rotating&&this.fire(new n.Event("rotatestart",p)),this._pitching&&!B.pitching&&this.fire(new n.Event("pitchstart",p))},_.prototype._fireMoveEvents=function(p){this.fire(new n.Event("move",p)),this._zooming&&this.fire(new n.Event("zoom",p)),this._rotating&&this.fire(new n.Event("rotate",p)),this._pitching&&this.fire(new n.Event("pitch",p))},_.prototype._afterEase=function(p,b){if(!this._easeId||!b||this._easeId!==b){delete this._easeId;var B=this._zooming,k=this._rotating,V=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,B&&this.fire(new n.Event("zoomend",p)),k&&this.fire(new n.Event("rotateend",p)),V&&this.fire(new n.Event("pitchend",p)),this.fire(new n.Event("moveend",p))}},_.prototype.flyTo=function(p,b){var B=this;if(!p.essential&&n.browser.prefersReducedMotion){var k=n.pick(p,["center","zoom","bearing","pitch","around"]);return this.jumpTo(k,b)}this.stop(),p=n.extend({offset:[0,0],speed:1.2,curve:1.42,easing:n.ease},p);var V=this.transform,q=this.getZoom(),re=this.getBearing(),ue=this.getPitch(),Ee=this.getPadding(),Ce="zoom"in p?n.clamp(+p.zoom,V.minZoom,V.maxZoom):q,Me="bearing"in p?this._normalizeBearing(p.bearing,re):re,He="pitch"in p?+p.pitch:ue,Ue="padding"in p?p.padding:V.padding,Ze=V.zoomScale(Ce-q),Ne=n.Point.convert(p.offset),Ke=V.centerPoint.add(Ne),it=V.pointLocation(Ke),pt=n.LngLat.convert(p.center||it);this._normalizeCenter(pt);var Ct=V.project(it),xt=V.project(pt).sub(Ct),Rt=p.curve,Wt=Math.max(V.width,V.height),ar=Wt/Ze,ir=xt.mag();if("minZoom"in p){var Ir=n.clamp(Math.min(p.minZoom,q,Ce),V.minZoom,V.maxZoom),ti=Wt/V.zoomScale(Ir-q);Rt=Math.sqrt(ti/ir*2)}var oi=Rt*Rt;function ii(hi){var li=(ar*ar-Wt*Wt+(hi?-1:1)*oi*oi*ir*ir)/(2*(hi?ar:Wt)*oi*ir);return Math.log(Math.sqrt(li*li+1)-li)}function hn(hi){return(Math.exp(hi)-Math.exp(-hi))/2}function Or(hi){return(Math.exp(hi)+Math.exp(-hi))/2}var yi=ii(0),vi=function(hi){return Or(yi)/Or(yi+Rt*hi)},di=function(hi){return Wt*((Or(yi)*(hn(li=yi+Rt*hi)/Or(li))-hn(yi))/oi)/ir;var li},pi=(ii(1)-yi)/Rt;if(Math.abs(ir)<1e-6||!isFinite(pi)){if(Math.abs(Wt-ar)<1e-6)return this.easeTo(p,b);var Pi=ar<Wt?-1:1;pi=Math.abs(Math.log(ar/Wt))/Rt,di=function(){return 0},vi=function(hi){return Math.exp(Pi*Rt*hi)}}return p.duration="duration"in p?+p.duration:1e3*pi/("screenSpeed"in p?+p.screenSpeed/Rt:+p.speed),p.maxDuration&&p.duration>p.maxDuration&&(p.duration=0),this._zooming=!0,this._rotating=re!==Me,this._pitching=He!==ue,this._padding=!V.isPaddingEqual(Ue),this._prepareEase(b,!1),this._ease(function(hi){var li=hi*pi,bs=1/vi(li);V.zoom=hi===1?Ce:q+V.scaleZoom(bs),B._rotating&&(V.bearing=n.number(re,Me,hi)),B._pitching&&(V.pitch=n.number(ue,He,hi)),B._padding&&(V.interpolatePadding(Ee,Ue,hi),Ke=V.centerPoint.add(Ne));var Yn=hi===1?pt:V.unproject(Ct.add(xt.mult(di(li))).mult(bs));V.setLocationAtPoint(V.renderWorldCopies?Yn.wrap():Yn,Ke),B._fireMoveEvents(b)},function(){return B._afterEase(b)},p),this},_.prototype.isEasing=function(){return!!this._easeFrameId},_.prototype.stop=function(){return this._stop()},_.prototype._stop=function(p,b){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var B=this._onEaseEnd;delete this._onEaseEnd,B.call(this,b)}if(!p){var k=this.handlers;k&&k.stop(!1)}return this},_.prototype._ease=function(p,b,B){B.animate===!1||B.duration===0?(p(1),b()):(this._easeStart=n.browser.now(),this._easeOptions=B,this._onEaseFrame=p,this._onEaseEnd=b,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},_.prototype._renderFrameCallback=function(){var p=Math.min((n.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},_.prototype._normalizeBearing=function(p,b){p=n.wrap(p,-180,180);var B=Math.abs(p-b);return Math.abs(p-360-b)<B&&(p-=360),Math.abs(p+360-b)<B&&(p+=360),p},_.prototype._normalizeCenter=function(p){var b=this.transform;if(b.renderWorldCopies&&!b.lngRange){var B=p.lng-b.center.lng;p.lng+=B>180?-360:B<-180?360:0}},_}(n.Evented),da=function(d){d===void 0&&(d={}),this.options=d,n.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};da.prototype.getDefaultPosition=function(){return"bottom-right"},da.prototype.onAdd=function(d){var _=this.options&&this.options.compact;return this._map=d,this._container=s.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=s.create("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=s.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),_&&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),_===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},da.prototype.onRemove=function(){s.remove(this._container),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},da.prototype._setElementTitle=function(d,_){var p=this._map._getUIString("AttributionControl."+_);d.title=p,d.setAttribute("aria-label",p)},da.prototype._toggleAttribution=function(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))},da.prototype._updateEditLink=function(){var d=this._editLink;d||(d=this._editLink=this._container.querySelector(".mapbox-improve-map"));var _=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||n.config.ACCESS_TOKEN}];if(d){var p=_.reduce(function(b,B,k){return B.value&&(b+=B.key+"="+B.value+(k<_.length-1?"&":"")),b},"?");d.href=n.config.FEEDBACK_URL+"/"+p+(this._map._hash?this._map._hash.getHashString(!0):""),d.rel="noopener nofollow",this._setElementTitle(d,"MapFeedback")}},da.prototype._updateData=function(d){!d||d.sourceDataType!=="metadata"&&d.sourceDataType!=="visibility"&&d.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())},da.prototype._updateAttributions=function(){if(this._map.style){var d=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=d.concat(this.options.customAttribution.map(function(q){return typeof q!="string"?"":q})):typeof this.options.customAttribution=="string"&&d.push(this.options.customAttribution)),this._map.style.stylesheet){var _=this._map.style.stylesheet;this.styleOwner=_.owner,this.styleId=_.id}var p=this._map.style.sourceCaches;for(var b in p){var B=p[b];if(B.used){var k=B.getSource();k.attribution&&d.indexOf(k.attribution)<0&&d.push(k.attribution)}}d.sort(function(q,re){return q.length-re.length});var V=(d=d.filter(function(q,re){for(var ue=re+1;ue<d.length;ue++)if(d[ue].indexOf(q)>=0)return!1;return!0})).join(" | ");V!==this._attribHTML&&(this._attribHTML=V,d.length?(this._innerContainer.innerHTML=V,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},da.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")};var ml=function(){n.bindAll(["_updateLogo"],this),n.bindAll(["_updateCompact"],this)};ml.prototype.onAdd=function(d){this._map=d,this._container=s.create("div","mapboxgl-ctrl");var _=s.create("a","mapboxgl-ctrl-logo");return _.target="_blank",_.rel="noopener nofollow",_.href="https://www.mapbox.com/",_.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),_.setAttribute("rel","noopener nofollow"),this._container.appendChild(_),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},ml.prototype.onRemove=function(){s.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},ml.prototype.getDefaultPosition=function(){return"bottom-left"},ml.prototype._updateLogo=function(d){d&&d.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")},ml.prototype._logoRequired=function(){if(this._map.style){var d=this._map.style.sourceCaches;for(var _ in d)if(d[_].getSource().mapbox_logo)return!0;return!1}},ml.prototype._updateCompact=function(){var d=this._container.children;if(d.length){var _=d[0];this._map.getCanvasContainer().offsetWidth<250?_.classList.add("mapboxgl-compact"):_.classList.remove("mapboxgl-compact")}};var Rs=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};Rs.prototype.add=function(d){var _=++this._id;return this._queue.push({callback:d,id:_,cancelled:!1}),_},Rs.prototype.remove=function(d){for(var _=this._currentlyRunning,p=0,b=_?this._queue.concat(_):this._queue;p<b.length;p+=1){var B=b[p];if(B.id===d)return void(B.cancelled=!0)}},Rs.prototype.run=function(d){d===void 0&&(d=0);var _=this._currentlyRunning=this._queue;this._queue=[];for(var p=0,b=_;p<b.length;p+=1){var B=b[p];if(!B.cancelled&&(B.callback(d),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},Rs.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var Ma={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},UA=n.window.HTMLImageElement,$f=n.window.HTMLElement,In=n.window.ImageBitmap,Bs={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},zA=function(d){function _(b){var B=this;if((b=n.extend({},Bs,b)).minZoom!=null&&b.maxZoom!=null&&b.minZoom>b.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(b.minPitch!=null&&b.maxPitch!=null&&b.minPitch>b.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(b.minPitch!=null&&b.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(b.maxPitch!=null&&b.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var k=new vr(b.minZoom,b.maxZoom,b.minPitch,b.maxPitch,b.renderWorldCopies);if(d.call(this,k,b),this._interactive=b.interactive,this._maxTileCacheSize=b.maxTileCacheSize,this._failIfMajorPerformanceCaveat=b.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=b.preserveDrawingBuffer,this._antialias=b.antialias,this._trackResize=b.trackResize,this._bearingSnap=b.bearingSnap,this._refreshExpiredTiles=b.refreshExpiredTiles,this._fadeDuration=b.fadeDuration,this._crossSourceCollisions=b.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=b.collectResourceTiming,this._renderTaskQueue=new Rs,this._controls=[],this._mapId=n.uniqueId(),this._locale=n.extend({},Ma,b.locale),this._clickTolerance=b.clickTolerance,this._requestManager=new n.RequestManager(b.transformRequest,b.accessToken),typeof b.container=="string"){if(this._container=n.window.document.getElementById(b.container),!this._container)throw new Error("Container '"+b.container+"' not found.")}else{if(!(b.container instanceof $f))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=b.container}if(b.maxBounds&&this.setMaxBounds(b.maxBounds),n.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",function(){return B._update(!1)}),this.on("moveend",function(){return B._update(!1)}),this.on("zoom",function(){return B._update(!0)}),n.window!==void 0&&(n.window.addEventListener("online",this._onWindowOnline,!1),n.window.addEventListener("resize",this._onWindowResize,!1),n.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new zr(this,b),this._hash=b.hash&&new Ci(typeof b.hash=="string"&&b.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:b.center,zoom:b.zoom,bearing:b.bearing,pitch:b.pitch}),b.bounds&&(this.resize(),this.fitBounds(b.bounds,n.extend({},b.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=b.localIdeographFontFamily,b.style&&this.setStyle(b.style,{localIdeographFontFamily:b.localIdeographFontFamily}),b.attributionControl&&this.addControl(new da({customAttribution:b.customAttribution})),this.addControl(new ml,b.logoPosition),this.on("style.load",function(){B.transform.unmodified&&B.jumpTo(B.style.stylesheet)}),this.on("data",function(V){B._update(V.dataType==="style"),B.fire(new n.Event(V.dataType+"data",V))}),this.on("dataloading",function(V){B.fire(new n.Event(V.dataType+"dataloading",V))})}d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_;var p={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return _.prototype._getMapId=function(){return this._mapId},_.prototype.addControl=function(b,B){if(B===void 0&&(B=b.getDefaultPosition?b.getDefaultPosition():"top-right"),!b||!b.onAdd)return this.fire(new n.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var k=b.onAdd(this);this._controls.push(b);var V=this._controlPositions[B];return B.indexOf("bottom")!==-1?V.insertBefore(k,V.firstChild):V.appendChild(k),this},_.prototype.removeControl=function(b){if(!b||!b.onRemove)return this.fire(new n.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var B=this._controls.indexOf(b);return B>-1&&this._controls.splice(B,1),b.onRemove(this),this},_.prototype.hasControl=function(b){return this._controls.indexOf(b)>-1},_.prototype.resize=function(b){var B=this._containerDimensions(),k=B[0],V=B[1];if(k===this.transform.width&&V===this.transform.height)return this;this._resizeCanvas(k,V),this.transform.resize(k,V),this.painter.resize(k,V);var q=!this._moving;return q&&this.fire(new n.Event("movestart",b)).fire(new n.Event("move",b)),this.fire(new n.Event("resize",b)),q&&this.fire(new n.Event("moveend",b)),this},_.prototype.getBounds=function(){return this.transform.getBounds()},_.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},_.prototype.setMaxBounds=function(b){return this.transform.setMaxBounds(n.LngLatBounds.convert(b)),this._update()},_.prototype.setMinZoom=function(b){if((b=b??-2)>=-2&&b<=this.transform.maxZoom)return this.transform.minZoom=b,this._update(),this.getZoom()<b&&this.setZoom(b),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")},_.prototype.getMinZoom=function(){return this.transform.minZoom},_.prototype.setMaxZoom=function(b){if((b=b??22)>=this.transform.minZoom)return this.transform.maxZoom=b,this._update(),this.getZoom()>b&&this.setZoom(b),this;throw new Error("maxZoom must be greater than the current minZoom")},_.prototype.getMaxZoom=function(){return this.transform.maxZoom},_.prototype.setMinPitch=function(b){if((b=b??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(b>=0&&b<=this.transform.maxPitch)return this.transform.minPitch=b,this._update(),this.getPitch()<b&&this.setPitch(b),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")},_.prototype.getMinPitch=function(){return this.transform.minPitch},_.prototype.setMaxPitch=function(b){if((b=b??60)>60)throw new Error("maxPitch must be less than or equal to 60");if(b>=this.transform.minPitch)return this.transform.maxPitch=b,this._update(),this.getPitch()>b&&this.setPitch(b),this;throw new Error("maxPitch must be greater than the current minPitch")},_.prototype.getMaxPitch=function(){return this.transform.maxPitch},_.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},_.prototype.setRenderWorldCopies=function(b){return this.transform.renderWorldCopies=b,this._update()},_.prototype.project=function(b){return this.transform.locationPoint(n.LngLat.convert(b))},_.prototype.unproject=function(b){return this.transform.pointLocation(n.Point.convert(b))},_.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},_.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},_.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},_.prototype._createDelegatedListener=function(b,B,k){var V,q=this;if(b==="mouseenter"||b==="mouseover"){var re=!1;return{layer:B,listener:k,delegates:{mousemove:function(Ee){var Ce=q.getLayer(B)?q.queryRenderedFeatures(Ee.point,{layers:[B]}):[];Ce.length?re||(re=!0,k.call(q,new us(b,q,Ee.originalEvent,{features:Ce}))):re=!1},mouseout:function(){re=!1}}}}if(b==="mouseleave"||b==="mouseout"){var ue=!1;return{layer:B,listener:k,delegates:{mousemove:function(Ee){(q.getLayer(B)?q.queryRenderedFeatures(Ee.point,{layers:[B]}):[]).length?ue=!0:ue&&(ue=!1,k.call(q,new us(b,q,Ee.originalEvent)))},mouseout:function(Ee){ue&&(ue=!1,k.call(q,new us(b,q,Ee.originalEvent)))}}}}return{layer:B,listener:k,delegates:(V={},V[b]=function(Ee){var Ce=q.getLayer(B)?q.queryRenderedFeatures(Ee.point,{layers:[B]}):[];Ce.length&&(Ee.features=Ce,k.call(q,Ee),delete Ee.features)},V)}},_.prototype.on=function(b,B,k){if(k===void 0)return d.prototype.on.call(this,b,B);var V=this._createDelegatedListener(b,B,k);for(var q in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[b]=this._delegatedListeners[b]||[],this._delegatedListeners[b].push(V),V.delegates)this.on(q,V.delegates[q]);return this},_.prototype.once=function(b,B,k){if(k===void 0)return d.prototype.once.call(this,b,B);var V=this._createDelegatedListener(b,B,k);for(var q in V.delegates)this.once(q,V.delegates[q]);return this},_.prototype.off=function(b,B,k){var V=this;return k===void 0?d.prototype.off.call(this,b,B):(this._delegatedListeners&&this._delegatedListeners[b]&&function(q){for(var re=q[b],ue=0;ue<re.length;ue++){var Ee=re[ue];if(Ee.layer===B&&Ee.listener===k){for(var Ce in Ee.delegates)V.off(Ce,Ee.delegates[Ce]);return re.splice(ue,1),V}}}(this._delegatedListeners),this)},_.prototype.queryRenderedFeatures=function(b,B){if(!this.style)return[];var k;if(B!==void 0||b===void 0||b instanceof n.Point||Array.isArray(b)||(B=b,b=void 0),B=B||{},(b=b||[[0,0],[this.transform.width,this.transform.height]])instanceof n.Point||typeof b[0]=="number")k=[n.Point.convert(b)];else{var V=n.Point.convert(b[0]),q=n.Point.convert(b[1]);k=[V,new n.Point(q.x,V.y),q,new n.Point(V.x,q.y),V]}return this.style.queryRenderedFeatures(k,B,this.transform)},_.prototype.querySourceFeatures=function(b,B){return this.style.querySourceFeatures(b,B)},_.prototype.setStyle=function(b,B){return(B=n.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},B)).diff!==!1&&B.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&b?(this._diffStyle(b,B),this):(this._localIdeographFontFamily=B.localIdeographFontFamily,this._updateStyle(b,B))},_.prototype._getUIString=function(b){var B=this._locale[b];if(B==null)throw new Error("Missing UI string '"+b+"'");return B},_.prototype._updateStyle=function(b,B){return this.style&&(this.style.setEventedParent(null),this.style._remove()),b?(this.style=new fa(this,B||{}),this.style.setEventedParent(this,{style:this.style}),typeof b=="string"?this.style.loadURL(b):this.style.loadJSON(b),this):(delete this.style,this)},_.prototype._lazyInitEmptyStyle=function(){this.style||(this.style=new fa(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())},_.prototype._diffStyle=function(b,B){var k=this;if(typeof b=="string"){var V=this._requestManager.normalizeStyleURL(b),q=this._requestManager.transformRequest(V,n.ResourceType.Style);n.getJSON(q,function(re,ue){re?k.fire(new n.ErrorEvent(re)):ue&&k._updateDiff(ue,B)})}else typeof b=="object"&&this._updateDiff(b,B)},_.prototype._updateDiff=function(b,B){try{this.style.setState(b)&&this._update(!0)}catch(k){n.warnOnce("Unable to perform style diff: "+(k.message||k.error||k)+". Rebuilding the style from scratch."),this._updateStyle(b,B)}},_.prototype.getStyle=function(){if(this.style)return this.style.serialize()},_.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():n.warnOnce("There is no style added to the map.")},_.prototype.addSource=function(b,B){return this._lazyInitEmptyStyle(),this.style.addSource(b,B),this._update(!0)},_.prototype.isSourceLoaded=function(b){var B=this.style&&this.style.sourceCaches[b];if(B!==void 0)return B.loaded();this.fire(new n.ErrorEvent(new Error("There is no source with ID '"+b+"'")))},_.prototype.areTilesLoaded=function(){var b=this.style&&this.style.sourceCaches;for(var B in b){var k=b[B]._tiles;for(var V in k){var q=k[V];if(q.state!=="loaded"&&q.state!=="errored")return!1}}return!0},_.prototype.addSourceType=function(b,B,k){return this._lazyInitEmptyStyle(),this.style.addSourceType(b,B,k)},_.prototype.removeSource=function(b){return this.style.removeSource(b),this._update(!0)},_.prototype.getSource=function(b){return this.style.getSource(b)},_.prototype.addImage=function(b,B,k){k===void 0&&(k={});var V=k.pixelRatio;V===void 0&&(V=1);var q=k.sdf;q===void 0&&(q=!1);var re=k.stretchX,ue=k.stretchY,Ee=k.content;if(this._lazyInitEmptyStyle(),B instanceof UA||In&&B instanceof In){var Ce=n.browser.getImageData(B);this.style.addImage(b,{data:new n.RGBAImage({width:Ce.width,height:Ce.height},Ce.data),pixelRatio:V,stretchX:re,stretchY:ue,content:Ee,sdf:q,version:0})}else{if(B.width===void 0||B.height===void 0)return this.fire(new n.ErrorEvent(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`")));var Me=B;this.style.addImage(b,{data:new n.RGBAImage({width:B.width,height:B.height},new Uint8Array(B.data)),pixelRatio:V,stretchX:re,stretchY:ue,content:Ee,sdf:q,version:0,userImage:Me}),Me.onAdd&&Me.onAdd(this,b)}},_.prototype.updateImage=function(b,B){var k=this.style.getImage(b);if(!k)return this.fire(new n.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));var V=B instanceof UA||In&&B instanceof In?n.browser.getImageData(B):B,q=V.width,re=V.height,ue=V.data;return q===void 0||re===void 0?this.fire(new n.ErrorEvent(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`"))):q!==k.data.width||re!==k.data.height?this.fire(new n.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))):(k.data.replace(ue,!(B instanceof UA||In&&B instanceof In)),void this.style.updateImage(b,k))},_.prototype.hasImage=function(b){return b?!!this.style.getImage(b):(this.fire(new n.ErrorEvent(new Error("Missing required image id"))),!1)},_.prototype.removeImage=function(b){this.style.removeImage(b)},_.prototype.loadImage=function(b,B){n.getImage(this._requestManager.transformRequest(b,n.ResourceType.Image),B)},_.prototype.listImages=function(){return this.style.listImages()},_.prototype.addLayer=function(b,B){return this._lazyInitEmptyStyle(),this.style.addLayer(b,B),this._update(!0)},_.prototype.moveLayer=function(b,B){return this.style.moveLayer(b,B),this._update(!0)},_.prototype.removeLayer=function(b){return this.style.removeLayer(b),this._update(!0)},_.prototype.getLayer=function(b){return this.style.getLayer(b)},_.prototype.setLayerZoomRange=function(b,B,k){return this.style.setLayerZoomRange(b,B,k),this._update(!0)},_.prototype.setFilter=function(b,B,k){return k===void 0&&(k={}),this.style.setFilter(b,B,k),this._update(!0)},_.prototype.getFilter=function(b){return this.style.getFilter(b)},_.prototype.setPaintProperty=function(b,B,k,V){return V===void 0&&(V={}),this.style.setPaintProperty(b,B,k,V),this._update(!0)},_.prototype.getPaintProperty=function(b,B){return this.style.getPaintProperty(b,B)},_.prototype.setLayoutProperty=function(b,B,k,V){return V===void 0&&(V={}),this.style.setLayoutProperty(b,B,k,V),this._update(!0)},_.prototype.getLayoutProperty=function(b,B){return this.style.getLayoutProperty(b,B)},_.prototype.setLight=function(b,B){return B===void 0&&(B={}),this._lazyInitEmptyStyle(),this.style.setLight(b,B),this._update(!0)},_.prototype.getLight=function(){return this.style.getLight()},_.prototype.setFeatureState=function(b,B){return this.style.setFeatureState(b,B),this._update()},_.prototype.removeFeatureState=function(b,B){return this.style.removeFeatureState(b,B),this._update()},_.prototype.getFeatureState=function(b){return this.style.getFeatureState(b)},_.prototype.getContainer=function(){return this._container},_.prototype.getCanvasContainer=function(){return this._canvasContainer},_.prototype.getCanvas=function(){return this._canvas},_.prototype._containerDimensions=function(){var b=0,B=0;return this._container&&(b=this._container.clientWidth||400,B=this._container.clientHeight||300),[b,B]},_.prototype._detectMissingCSS=function(){n.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&n.warnOnce("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/.")},_.prototype._setupContainer=function(){var b=this._container;b.classList.add("mapboxgl-map"),(this._missingCSSCanary=s.create("div","mapboxgl-canary",b)).style.visibility="hidden",this._detectMissingCSS();var B=this._canvasContainer=s.create("div","mapboxgl-canvas-container",b);this._interactive&&B.classList.add("mapboxgl-interactive"),this._canvas=s.create("canvas","mapboxgl-canvas",B),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");var k=this._containerDimensions();this._resizeCanvas(k[0],k[1]);var V=this._controlContainer=s.create("div","mapboxgl-control-container",b),q=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(re){q[re]=s.create("div","mapboxgl-ctrl-"+re,V)}),this._container.addEventListener("scroll",this._onMapScroll,!1)},_.prototype._resizeCanvas=function(b,B){var k=n.browser.devicePixelRatio||1;this._canvas.width=k*b,this._canvas.height=k*B,this._canvas.style.width=b+"px",this._canvas.style.height=B+"px"},_.prototype._setupPainter=function(){var b=n.extend({},o.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),B=this._canvas.getContext("webgl",b)||this._canvas.getContext("experimental-webgl",b);B?(this.painter=new hr(B,this.transform),n.webpSupported.testSupport(B)):this.fire(new n.ErrorEvent(new Error("Failed to initialize WebGL")))},_.prototype._contextLost=function(b){b.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new n.Event("webglcontextlost",{originalEvent:b}))},_.prototype._contextRestored=function(b){this._setupPainter(),this.resize(),this._update(),this.fire(new n.Event("webglcontextrestored",{originalEvent:b}))},_.prototype._onMapScroll=function(b){if(b.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},_.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},_.prototype._update=function(b){return this.style?(this._styleDirty=this._styleDirty||b,this._sourcesDirty=!0,this.triggerRepaint(),this):this},_.prototype._requestRenderFrame=function(b){return this._update(),this._renderTaskQueue.add(b)},_.prototype._cancelRenderFrame=function(b){this._renderTaskQueue.remove(b)},_.prototype._render=function(b){var B,k=this,V=0,q=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(B=q.createQueryEXT(),q.beginQueryEXT(q.TIME_ELAPSED_EXT,B),V=n.browser.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(b),!this._removed){var re=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;var ue=this.transform.zoom,Ee=n.browser.now();this.style.zoomHistory.update(ue,Ee);var Ce=new n.EvaluationParameters(ue,{now:Ee,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Me=Ce.crossFadingFactor();Me===1&&Me===this._crossFadingFactor||(re=!0,this._crossFadingFactor=Me),this.style.update(Ce)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new n.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new n.Event("load"))),this.style&&(this.style.hasTransitions()||re)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){var He=n.browser.now()-V;q.endQueryEXT(q.TIME_ELAPSED_EXT,B),setTimeout(function(){var Ne=q.getQueryObjectEXT(B,q.QUERY_RESULT_EXT)/1e6;q.deleteQueryEXT(B),k.fire(new n.Event("gpu-timing-frame",{cpuTime:He,gpuTime:Ne}))},50)}if(this.listens("gpu-timing-layer")){var Ue=this.painter.collectGpuTimers();setTimeout(function(){var Ne=k.painter.queryGpuTimers(Ue);k.fire(new n.Event("gpu-timing-layer",{layerTimes:Ne}))},50)}var Ze=this._sourcesDirty||this._styleDirty||this._placementDirty;return Ze||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new n.Event("idle")),!this._loaded||this._fullyLoaded||Ze||(this._fullyLoaded=!0),this}},_.prototype.remove=function(){this._hash&&this._hash.remove();for(var b=0,B=this._controls;b<B.length;b+=1)B[b].onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),n.window!==void 0&&(n.window.removeEventListener("resize",this._onWindowResize,!1),n.window.removeEventListener("orientationchange",this._onWindowResize,!1),n.window.removeEventListener("online",this._onWindowOnline,!1));var k=this.painter.context.gl.getExtension("WEBGL_lose_context");k&&k.loseContext(),Wc(this._canvasContainer),Wc(this._controlContainer),Wc(this._missingCSSCanary),this._container.classList.remove("mapboxgl-map"),this._removed=!0,this.fire(new n.Event("remove"))},_.prototype.triggerRepaint=function(){var b=this;this.style&&!this._frame&&(this._frame=n.browser.frame(function(B){b._frame=null,b._render(B)}))},_.prototype._onWindowOnline=function(){this._update()},_.prototype._onWindowResize=function(b){this._trackResize&&this.resize({originalEvent:b})._update()},p.showTileBoundaries.get=function(){return!!this._showTileBoundaries},p.showTileBoundaries.set=function(b){this._showTileBoundaries!==b&&(this._showTileBoundaries=b,this._update())},p.showPadding.get=function(){return!!this._showPadding},p.showPadding.set=function(b){this._showPadding!==b&&(this._showPadding=b,this._update())},p.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},p.showCollisionBoxes.set=function(b){this._showCollisionBoxes!==b&&(this._showCollisionBoxes=b,b?this.style._generateCollisionBoxes():this._update())},p.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},p.showOverdrawInspector.set=function(b){this._showOverdrawInspector!==b&&(this._showOverdrawInspector=b,this._update())},p.repaint.get=function(){return!!this._repaint},p.repaint.set=function(b){this._repaint!==b&&(this._repaint=b,this.triggerRepaint())},p.vertices.get=function(){return!!this._vertices},p.vertices.set=function(b){this._vertices=b,this._update()},_.prototype._setCacheLimits=function(b,B){n.setCacheLimits(b,B)},p.version.get=function(){return n.version},Object.defineProperties(_.prototype,p),_}(Au);function Wc(d){d.parentNode&&d.parentNode.removeChild(d)}var $h={showCompass:!0,showZoom:!0,visualizePitch:!1},Rl=function(d){var _=this;this.options=n.extend({},$h,d),this._container=s.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",function(p){return p.preventDefault()}),this.options.showZoom&&(n.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",function(p){return _._map.zoomIn({},{originalEvent:p})}),s.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",function(p){return _._map.zoomOut({},{originalEvent:p})}),s.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(n.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",function(p){_.options.visualizePitch?_._map.resetNorthPitch({},{originalEvent:p}):_._map.resetNorth({},{originalEvent:p})}),this._compassIcon=s.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))};Rl.prototype._updateZoomButtons=function(){var d=this._map.getZoom(),_=d===this._map.getMaxZoom(),p=d===this._map.getMinZoom();this._zoomInButton.disabled=_,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",_.toString()),this._zoomOutButton.setAttribute("aria-disabled",p.toString())},Rl.prototype._rotateCompassArrow=function(){var d=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=d},Rl.prototype.onAdd=function(d){return this._map=d,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 mn(this._map,this._compass,this.options.visualizePitch)),this._container},Rl.prototype.onRemove=function(){s.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},Rl.prototype._createButton=function(d,_){var p=s.create("button",d,this._container);return p.type="button",p.addEventListener("click",_),p},Rl.prototype._setButtonTitle=function(d,_){var p=this._map._getUIString("NavigationControl."+_);d.title=p,d.setAttribute("aria-label",p)};var mn=function(d,_,p){p===void 0&&(p=!1),this._clickTolerance=10,this.element=_,this.mouseRotate=new of({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,p&&(this.mousePitch=new Gc({clickTolerance:d.dragRotate._mousePitch._clickTolerance})),n.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),s.addEventListener(_,"mousedown",this.mousedown),s.addEventListener(_,"touchstart",this.touchstart,{passive:!1}),s.addEventListener(_,"touchmove",this.touchmove),s.addEventListener(_,"touchend",this.touchend),s.addEventListener(_,"touchcancel",this.reset)};function eh(d,_,p){if(d=new n.LngLat(d.lng,d.lat),_){var b=new n.LngLat(d.lng-360,d.lat),B=new n.LngLat(d.lng+360,d.lat),k=p.locationPoint(d).distSqr(_);p.locationPoint(b).distSqr(_)<k?d=b:p.locationPoint(B).distSqr(_)<k&&(d=B)}for(;Math.abs(d.lng-p.center.lng)>180;){var V=p.locationPoint(d);if(V.x>=0&&V.y>=0&&V.x<=p.width&&V.y<=p.height)break;d.lng>p.center.lng?d.lng-=360:d.lng+=360}return d}mn.prototype.down=function(d,_){this.mouseRotate.mousedown(d,_),this.mousePitch&&this.mousePitch.mousedown(d,_),s.disableDrag()},mn.prototype.move=function(d,_){var p=this.map,b=this.mouseRotate.mousemoveWindow(d,_);if(b&&b.bearingDelta&&p.setBearing(p.getBearing()+b.bearingDelta),this.mousePitch){var B=this.mousePitch.mousemoveWindow(d,_);B&&B.pitchDelta&&p.setPitch(p.getPitch()+B.pitchDelta)}},mn.prototype.off=function(){var d=this.element;s.removeEventListener(d,"mousedown",this.mousedown),s.removeEventListener(d,"touchstart",this.touchstart,{passive:!1}),s.removeEventListener(d,"touchmove",this.touchmove),s.removeEventListener(d,"touchend",this.touchend),s.removeEventListener(d,"touchcancel",this.reset),this.offTemp()},mn.prototype.offTemp=function(){s.enableDrag(),s.removeEventListener(n.window,"mousemove",this.mousemove),s.removeEventListener(n.window,"mouseup",this.mouseup)},mn.prototype.mousedown=function(d){this.down(n.extend({},d,{ctrlKey:!0,preventDefault:function(){return d.preventDefault()}}),s.mousePos(this.element,d)),s.addEventListener(n.window,"mousemove",this.mousemove),s.addEventListener(n.window,"mouseup",this.mouseup)},mn.prototype.mousemove=function(d){this.move(d,s.mousePos(this.element,d))},mn.prototype.mouseup=function(d){this.mouseRotate.mouseupWindow(d),this.mousePitch&&this.mousePitch.mouseupWindow(d),this.offTemp()},mn.prototype.touchstart=function(d){d.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=s.touchPos(this.element,d.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return d.preventDefault()}},this._startPos))},mn.prototype.touchmove=function(d){d.targetTouches.length!==1?this.reset():(this._lastPos=s.touchPos(this.element,d.targetTouches)[0],this.move({preventDefault:function(){return d.preventDefault()}},this._lastPos))},mn.prototype.touchend=function(d){d.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()},mn.prototype.reset=function(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};var mc={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function fp(d,_,p){var b=d.classList;for(var B in mc)b.remove("mapboxgl-"+p+"-anchor-"+B);b.add("mapboxgl-"+p+"-anchor-"+_)}var th,ed=function(d){function _(p,b){if(d.call(this),(p instanceof n.window.HTMLElement||b)&&(p=n.extend({element:p},b)),n.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=p&&p.anchor||"center",this._color=p&&p.color||"#3FB1CE",this._scale=p&&p.scale||1,this._draggable=p&&p.draggable||!1,this._clickTolerance=p&&p.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=p&&p.rotation||0,this._rotationAlignment=p&&p.rotationAlignment||"auto",this._pitchAlignment=p&&p.pitchAlignment&&p.pitchAlignment!=="auto"?p.pitchAlignment:this._rotationAlignment,p&&p.element)this._element=p.element,this._offset=n.Point.convert(p&&p.offset||[0,0]);else{this._defaultMarker=!0,this._element=s.create("div"),this._element.setAttribute("aria-label","Map marker");var B=s.createNS("http://www.w3.org/2000/svg","svg");B.setAttributeNS(null,"display","block"),B.setAttributeNS(null,"height","41px"),B.setAttributeNS(null,"width","27px"),B.setAttributeNS(null,"viewBox","0 0 27 41");var k=s.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"stroke","none"),k.setAttributeNS(null,"stroke-width","1"),k.setAttributeNS(null,"fill","none"),k.setAttributeNS(null,"fill-rule","evenodd");var V=s.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"fill-rule","nonzero");var q=s.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"transform","translate(3.0, 29.0)"),q.setAttributeNS(null,"fill","#000000");for(var re=0,ue=[{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"}];re<ue.length;re+=1){var Ee=ue[re],Ce=s.createNS("http://www.w3.org/2000/svg","ellipse");Ce.setAttributeNS(null,"opacity","0.04"),Ce.setAttributeNS(null,"cx","10.5"),Ce.setAttributeNS(null,"cy","5.80029008"),Ce.setAttributeNS(null,"rx",Ee.rx),Ce.setAttributeNS(null,"ry",Ee.ry),q.appendChild(Ce)}var Me=s.createNS("http://www.w3.org/2000/svg","g");Me.setAttributeNS(null,"fill",this._color);var He=s.createNS("http://www.w3.org/2000/svg","path");He.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"),Me.appendChild(He);var Ue=s.createNS("http://www.w3.org/2000/svg","g");Ue.setAttributeNS(null,"opacity","0.25"),Ue.setAttributeNS(null,"fill","#000000");var Ze=s.createNS("http://www.w3.org/2000/svg","path");Ze.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"),Ue.appendChild(Ze);var Ne=s.createNS("http://www.w3.org/2000/svg","g");Ne.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Ne.setAttributeNS(null,"fill","#FFFFFF");var Ke=s.createNS("http://www.w3.org/2000/svg","g");Ke.setAttributeNS(null,"transform","translate(8.0, 8.0)");var it=s.createNS("http://www.w3.org/2000/svg","circle");it.setAttributeNS(null,"fill","#000000"),it.setAttributeNS(null,"opacity","0.25"),it.setAttributeNS(null,"cx","5.5"),it.setAttributeNS(null,"cy","5.5"),it.setAttributeNS(null,"r","5.4999962");var pt=s.createNS("http://www.w3.org/2000/svg","circle");pt.setAttributeNS(null,"fill","#FFFFFF"),pt.setAttributeNS(null,"cx","5.5"),pt.setAttributeNS(null,"cy","5.5"),pt.setAttributeNS(null,"r","5.4999962"),Ke.appendChild(it),Ke.appendChild(pt),V.appendChild(q),V.appendChild(Me),V.appendChild(Ue),V.appendChild(Ne),V.appendChild(Ke),B.appendChild(V),B.setAttributeNS(null,"height",41*this._scale+"px"),B.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(B),this._offset=n.Point.convert(p&&p.offset||[0,-14])}this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",function(Ct){Ct.preventDefault()}),this._element.addEventListener("mousedown",function(Ct){Ct.preventDefault()}),fp(this._element,this._anchor,"marker"),this._popup=null}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.addTo=function(p){return this.remove(),this._map=p,p.getCanvasContainer().appendChild(this._element),p.on("move",this._update),p.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this},_.prototype.remove=function(){return 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),s.remove(this._element),this._popup&&this._popup.remove(),this},_.prototype.getLngLat=function(){return this._lngLat},_.prototype.setLngLat=function(p){return this._lngLat=n.LngLat.convert(p),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},_.prototype.getElement=function(){return this._element},_.prototype.setPopup=function(p){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),p){if(!("offset"in p.options)){var b=Math.sqrt(Math.pow(13.5,2)/2);p.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[b,-1*(24.6+b)],"bottom-right":[-b,-1*(24.6+b)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=p,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this},_.prototype._onKeyPress=function(p){var b=p.code,B=p.charCode||p.keyCode;b!=="Space"&&b!=="Enter"&&B!==32&&B!==13||this.togglePopup()},_.prototype._onMapClick=function(p){var b=p.originalEvent.target,B=this._element;this._popup&&(b===B||B.contains(b))&&this.togglePopup()},_.prototype.getPopup=function(){return this._popup},_.prototype.togglePopup=function(){var p=this._popup;return p?(p.isOpen()?p.remove():p.addTo(this._map),this):this},_.prototype._update=function(p){if(this._map){this._map.transform.renderWorldCopies&&(this._lngLat=eh(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);var b="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?b="rotateZ("+this._rotation+"deg)":this._rotationAlignment==="map"&&(b="rotateZ("+(this._rotation-this._map.getBearing())+"deg)");var B="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?B="rotateX(0deg)":this._pitchAlignment==="map"&&(B="rotateX("+this._map.getPitch()+"deg)"),p&&p.type!=="moveend"||(this._pos=this._pos.round()),s.setTransform(this._element,mc[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+B+" "+b)}},_.prototype.getOffset=function(){return this._offset},_.prototype.setOffset=function(p){return this._offset=n.Point.convert(p),this._update(),this},_.prototype._onMove=function(p){if(!this._isDragging){var b=this._clickTolerance||this._map._clickTolerance;this._isDragging=p.point.dist(this._pointerdownPos)>=b}this._isDragging&&(this._pos=p.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 n.Event("dragstart"))),this.fire(new n.Event("drag")))},_.prototype._onUp=function(){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 n.Event("dragend")),this._state="inactive"},_.prototype._addDragHandler=function(p){this._element.contains(p.originalEvent.target)&&(p.preventDefault(),this._positionDelta=p.point.sub(this._pos).add(this._offset),this._pointerdownPos=p.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))},_.prototype.setDraggable=function(p){return this._draggable=!!p,this._map&&(p?(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},_.prototype.isDraggable=function(){return this._draggable},_.prototype.setRotation=function(p){return this._rotation=p||0,this._update(),this},_.prototype.getRotation=function(){return this._rotation},_.prototype.setRotationAlignment=function(p){return this._rotationAlignment=p||"auto",this._update(),this},_.prototype.getRotationAlignment=function(){return this._rotationAlignment},_.prototype.setPitchAlignment=function(p){return this._pitchAlignment=p&&p!=="auto"?p:this._rotationAlignment,this._update(),this},_.prototype.getPitchAlignment=function(){return this._pitchAlignment},_}(n.Evented),VA={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},rh=0,xs=!1,td=function(d){function _(p){d.call(this),this.options=n.extend({},VA,p),n.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.onAdd=function(p){var b;return this._map=p,this._container=s.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),b=this._setupUI,th!==void 0?b(th):n.window.navigator.permissions!==void 0?n.window.navigator.permissions.query({name:"geolocation"}).then(function(B){b(th=B.state!=="denied")}):b(th=!!n.window.navigator.geolocation),this._container},_.prototype.onRemove=function(){this._geolocationWatchID!==void 0&&(n.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(),s.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,rh=0,xs=!1},_.prototype._isOutOfMapMaxBounds=function(p){var b=this._map.getMaxBounds(),B=p.coords;return b&&(B.longitude<b.getWest()||B.longitude>b.getEast()||B.latitude<b.getSouth()||B.latitude>b.getNorth())},_.prototype._setErrorState=function(){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")}},_.prototype._onSuccess=function(p){if(this._map){if(this._isOutOfMapMaxBounds(p))return this._setErrorState(),this.fire(new n.Event("outofmaxbounds",p)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=p,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(p),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(p),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new n.Event("geolocate",p)),this._finish()}},_.prototype._updateCamera=function(p){var b=new n.LngLat(p.coords.longitude,p.coords.latitude),B=p.coords.accuracy,k=this._map.getBearing(),V=n.extend({bearing:k},this.options.fitBoundsOptions);this._map.fitBounds(b.toBounds(B),V,{geolocateSource:!0})},_.prototype._updateMarker=function(p){if(p){var b=new n.LngLat(p.coords.longitude,p.coords.latitude);this._accuracyCircleMarker.setLngLat(b).addTo(this._map),this._userLocationDotMarker.setLngLat(b).addTo(this._map),this._accuracy=p.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},_.prototype._updateCircleRadius=function(){var p=this._map._container.clientHeight/2,b=this._map.unproject([0,p]),B=this._map.unproject([1,p]),k=b.distanceTo(B),V=Math.ceil(2*this._accuracy/k);this._circleElement.style.width=V+"px",this._circleElement.style.height=V+"px"},_.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},_.prototype._onError=function(p){if(this._map){if(this.options.trackUserLocation)if(p.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;var b=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=b,this._geolocateButton.setAttribute("aria-label",b),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(p.code===3&&xs)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new n.Event("error",p)),this._finish()}},_.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},_.prototype._setupUI=function(p){var b=this;if(this._container.addEventListener("contextmenu",function(V){return V.preventDefault()}),this._geolocateButton=s.create("button","mapboxgl-ctrl-geolocate",this._container),s.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",p===!1){n.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var B=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=B,this._geolocateButton.setAttribute("aria-label",B)}else{var k=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=s.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new ed(this._dotElement),this._circleElement=s.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ed({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",function(V){V.geolocateSource||b._watchState!=="ACTIVE_LOCK"||V.originalEvent&&V.originalEvent.type==="resize"||(b._watchState="BACKGROUND",b._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),b._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),b.fire(new n.Event("trackuserlocationend")))})},_.prototype.trigger=function(){if(!this._setup)return n.warnOnce("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 n.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":rh--,xs=!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 n.Event("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 n.Event("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){var p;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++rh>1?(p={maximumAge:6e5,timeout:0},xs=!0):(p=this.options.positionOptions,xs=!1),this._geolocationWatchID=n.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,p)}}else n.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},_.prototype._clearWatch=function(){n.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},_}(n.Evented),Ga={maxWidth:100,unit:"metric"},mu=function(d){this.options=n.extend({},Ga,d),n.bindAll(["_onMove","setUnit"],this)};function ih(d,_,p){var b=p&&p.maxWidth||100,B=d._container.clientHeight/2,k=d.unproject([0,B]),V=d.unproject([b,B]),q=k.distanceTo(V);if(p&&p.unit==="imperial"){var re=3.2808*q;re>5280?gu(_,b,re/5280,d._getUIString("ScaleControl.Miles")):gu(_,b,re,d._getUIString("ScaleControl.Feet"))}else p&&p.unit==="nautical"?gu(_,b,q/1852,d._getUIString("ScaleControl.NauticalMiles")):q>=1e3?gu(_,b,q/1e3,d._getUIString("ScaleControl.Kilometers")):gu(_,b,q,d._getUIString("ScaleControl.Meters"))}function gu(d,_,p,b){var B,k,V,q=(B=p,(k=Math.pow(10,(""+Math.floor(B)).length-1))*(V=(V=B/k)>=10?10:V>=5?5:V>=3?3:V>=2?2:V>=1?1:function(re){var ue=Math.pow(10,Math.ceil(-Math.log(re)/Math.LN10));return Math.round(re*ue)/ue}(V)));d.style.width=_*(q/p)+"px",d.innerHTML=q+"&nbsp;"+b}mu.prototype.getDefaultPosition=function(){return"bottom-left"},mu.prototype._onMove=function(){ih(this._map,this._container,this.options)},mu.prototype.onAdd=function(d){return this._map=d,this._container=s.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",d.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},mu.prototype.onRemove=function(){s.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},mu.prototype.setUnit=function(d){this.options.unit=d,ih(this._map,this._container,this.options)};var Zo=function(d){this._fullscreen=!1,d&&d.container&&(d.container instanceof n.window.HTMLElement?this._container=d.container:n.warnOnce("Full screen control 'container' must be a DOM element.")),n.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in n.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in n.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in n.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in n.window.document&&(this._fullscreenchange="MSFullscreenChange")};Zo.prototype.onAdd=function(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=s.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",n.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},Zo.prototype.onRemove=function(){s.remove(this._controlContainer),this._map=null,n.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Zo.prototype._checkFullscreenSupport=function(){return!!(n.window.document.fullscreenEnabled||n.window.document.mozFullScreenEnabled||n.window.document.msFullscreenEnabled||n.window.document.webkitFullscreenEnabled)},Zo.prototype._setupUI=function(){var d=this._fullscreenButton=s.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);s.create("span","mapboxgl-ctrl-icon",d).setAttribute("aria-hidden",!0),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),n.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},Zo.prototype._updateTitle=function(){var d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d},Zo.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},Zo.prototype._isFullscreen=function(){return this._fullscreen},Zo.prototype._changeIcon=function(){(n.window.document.fullscreenElement||n.window.document.mozFullScreenElement||n.window.document.webkitFullscreenElement||n.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},Zo.prototype._onClickFullscreen=function(){this._isFullscreen()?n.window.document.exitFullscreen?n.window.document.exitFullscreen():n.window.document.mozCancelFullScreen?n.window.document.mozCancelFullScreen():n.window.document.msExitFullscreen?n.window.document.msExitFullscreen():n.window.document.webkitCancelFullScreen&&n.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var hp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},cf=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),_u=function(d){function _(p){d.call(this),this.options=n.extend(Object.create(hp),p),n.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return d&&(_.__proto__=d),(_.prototype=Object.create(d&&d.prototype)).constructor=_,_.prototype.addTo=function(p){return this._map&&this.remove(),this._map=p,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("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new n.Event("open")),this},_.prototype.isOpen=function(){return!!this._map},_.prototype.remove=function(){return this._content&&s.remove(this._content),this._container&&(s.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),delete this._map),this.fire(new n.Event("close")),this},_.prototype.getLngLat=function(){return this._lngLat},_.prototype.setLngLat=function(p){return this._lngLat=n.LngLat.convert(p),this._pos=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("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this},_.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=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("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this},_.prototype.getElement=function(){return this._container},_.prototype.setText=function(p){return this.setDOMContent(n.window.document.createTextNode(p))},_.prototype.setHTML=function(p){var b,B=n.window.document.createDocumentFragment(),k=n.window.document.createElement("body");for(k.innerHTML=p;b=k.firstChild;)B.appendChild(b);return this.setDOMContent(B)},_.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},_.prototype.setMaxWidth=function(p){return this.options.maxWidth=p,this._update(),this},_.prototype.setDOMContent=function(p){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=s.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(p),this._createCloseButton(),this._update(),this._focusFirstElement(),this},_.prototype.addClassName=function(p){this._container&&this._container.classList.add(p)},_.prototype.removeClassName=function(p){this._container&&this._container.classList.remove(p)},_.prototype.setOffset=function(p){return this.options.offset=p,this._update(),this},_.prototype.toggleClassName=function(p){if(this._container)return this._container.classList.toggle(p)},_.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=s.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))},_.prototype._onMouseUp=function(p){this._update(p.point)},_.prototype._onMouseMove=function(p){this._update(p.point)},_.prototype._onDrag=function(p){this._update(p.point)},_.prototype._update=function(p){var b=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=s.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=s.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(function(Ce){return b._container.classList.add(Ce)}),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=eh(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||p)){var B=this._pos=this._trackPointer&&p?p:this._map.project(this._lngLat),k=this.options.anchor,V=function Ce(Me){if(Me){if(typeof Me=="number"){var He=Math.round(Math.sqrt(.5*Math.pow(Me,2)));return{center:new n.Point(0,0),top:new n.Point(0,Me),"top-left":new n.Point(He,He),"top-right":new n.Point(-He,He),bottom:new n.Point(0,-Me),"bottom-left":new n.Point(He,-He),"bottom-right":new n.Point(-He,-He),left:new n.Point(Me,0),right:new n.Point(-Me,0)}}if(Me instanceof n.Point||Array.isArray(Me)){var Ue=n.Point.convert(Me);return{center:Ue,top:Ue,"top-left":Ue,"top-right":Ue,bottom:Ue,"bottom-left":Ue,"bottom-right":Ue,left:Ue,right:Ue}}return{center:n.Point.convert(Me.center||[0,0]),top:n.Point.convert(Me.top||[0,0]),"top-left":n.Point.convert(Me["top-left"]||[0,0]),"top-right":n.Point.convert(Me["top-right"]||[0,0]),bottom:n.Point.convert(Me.bottom||[0,0]),"bottom-left":n.Point.convert(Me["bottom-left"]||[0,0]),"bottom-right":n.Point.convert(Me["bottom-right"]||[0,0]),left:n.Point.convert(Me.left||[0,0]),right:n.Point.convert(Me.right||[0,0])}}return Ce(new n.Point(0,0))}(this.options.offset);if(!k){var q,re=this._container.offsetWidth,ue=this._container.offsetHeight;q=B.y+V.bottom.y<ue?["top"]:B.y>this._map.transform.height-ue?["bottom"]:[],B.x<re/2?q.push("left"):B.x>this._map.transform.width-re/2&&q.push("right"),k=q.length===0?"bottom":q.join("-")}var Ee=B.add(V[k]).round();s.setTransform(this._container,mc[k]+" translate("+Ee.x+"px,"+Ee.y+"px)"),fp(this._container,k,"popup")}},_.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var p=this._container.querySelector(cf);p&&p.focus()}},_.prototype._onClose=function(){this.remove()},_}(n.Evented),yu={version:n.version,supported:o,setRTLTextPlugin:n.setRTLTextPlugin,getRTLTextPluginStatus:n.getRTLTextPluginStatus,Map:zA,NavigationControl:Rl,GeolocateControl:td,AttributionControl:da,ScaleControl:mu,FullscreenControl:Zo,Popup:_u,Marker:ed,Style:fa,LngLat:n.LngLat,LngLatBounds:n.LngLatBounds,Point:n.Point,MercatorCoordinate:n.MercatorCoordinate,Evented:n.Evented,config:n.config,prewarm:function(){Ot().acquire(Pt)},clearPrewarmedResources:function(){var d=Dr;d&&(d.isPreloaded()&&d.numActive()===1?(d.release(Pt),Dr=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()"))},get accessToken(){return n.config.ACCESS_TOKEN},set accessToken(d){n.config.ACCESS_TOKEN=d},get baseApiUrl(){return n.config.API_URL},set baseApiUrl(d){n.config.API_URL=d},get workerCount(){return Xt.workerCount},set workerCount(d){Xt.workerCount=d},get maxParallelImageRequests(){return n.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(d){n.config.MAX_PARALLEL_IMAGE_REQUESTS=d},clearStorage:function(d){n.clearTileCache(d)},workerUrl:""};return yu}),r})});var jV=Qt((MHe,yE)=>{(function(t,e,r,i){"use strict";var n=["","webkit","Moz","MS","ms","o"],o=e.createElement("div"),s="function",l=Math.round,u=Math.abs,h=Date.now;function v(xe,Be,Je){return setTimeout(J(xe,Je),Be)}function T(xe,Be,Je){return Array.isArray(xe)?(E(xe,Je[Be],Je),!0):!1}function E(xe,Be,Je){var vt;if(xe)if(xe.forEach)xe.forEach(Be,Je);else if(xe.length!==i)for(vt=0;vt<xe.length;)Be.call(Je,xe[vt],vt,xe),vt++;else for(vt in xe)xe.hasOwnProperty(vt)&&Be.call(Je,xe[vt],vt,xe)}function M(xe,Be,Je){var vt="DEPRECATED METHOD: "+Be+`
`+Je+` AT
`;return function(){var tr=new Error("get-stack-trace"),qr=tr&&tr.stack?tr.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",sn=t.console&&(t.console.warn||t.console.log);return sn&&sn.call(t.console,vt,qr),xe.apply(this,arguments)}}var O;typeof Object.assign!="function"?O=function(Be){if(Be===i||Be===null)throw new TypeError("Cannot convert undefined or null to object");for(var Je=Object(Be),vt=1;vt<arguments.length;vt++){var tr=arguments[vt];if(tr!==i&&tr!==null)for(var qr in tr)tr.hasOwnProperty(qr)&&(Je[qr]=tr[qr])}return Je}:O=Object.assign;var F=M(function(Be,Je,vt){for(var tr=Object.keys(Je),qr=0;qr<tr.length;)(!vt||vt&&Be[tr[qr]]===i)&&(Be[tr[qr]]=Je[tr[qr]]),qr++;return Be},"extend","Use `assign`."),z=M(function(Be,Je){return F(Be,Je,!0)},"merge","Use `assign`.");function W(xe,Be,Je){var vt=Be.prototype,tr;tr=xe.prototype=Object.create(vt),tr.constructor=xe,tr._super=vt,Je&&O(tr,Je)}function J(xe,Be){return function(){return xe.apply(Be,arguments)}}function K(xe,Be){return typeof xe==s?xe.apply(Be&&Be[0]||i,Be):xe}function ne(xe,Be){return xe===i?Be:xe}function ge(xe,Be,Je){E($(Be),function(vt){xe.addEventListener(vt,Je,!1)})}function j(xe,Be,Je){E($(Be),function(vt){xe.removeEventListener(vt,Je,!1)})}function me(xe,Be){for(;xe;){if(xe==Be)return!0;xe=xe.parentNode}return!1}function fe(xe,Be){return xe.indexOf(Be)>-1}function $(xe){return xe.trim().split(/\s+/g)}function Z(xe,Be,Je){if(xe.indexOf&&!Je)return xe.indexOf(Be);for(var vt=0;vt<xe.length;){if(Je&&xe[vt][Je]==Be||!Je&&xe[vt]===Be)return vt;vt++}return-1}function we(xe){return Array.prototype.slice.call(xe,0)}function Oe(xe,Be,Je){for(var vt=[],tr=[],qr=0;qr<xe.length;){var sn=Be?xe[qr][Be]:xe[qr];Z(tr,sn)<0&&vt.push(xe[qr]),tr[qr]=sn,qr++}return Je&&(Be?vt=vt.sort(function(ts,vs){return ts[Be]>vs[Be]}):vt=vt.sort()),vt}function he(xe,Be){for(var Je,vt,tr=Be[0].toUpperCase()+Be.slice(1),qr=0;qr<n.length;){if(Je=n[qr],vt=Je?Je+tr:Be,vt in xe)return vt;qr++}return i}var Le=1;function ft(){return Le++}function Vt(xe){var Be=xe.ownerDocument||xe;return Be.defaultView||Be.parentWindow||t}var Yt=/mobile|tablet|ip(ad|hone|od)|android/i,mr="ontouchstart"in t,Er=he(t,"PointerEvent")!==i,Jr=mr&&Yt.test(navigator.userAgent),or="touch",ai="pen",Jt="mouse",qt="kinect",wi=25,ae=1,be=2,je=4,lt=8,Ft=1,wt=2,$r=4,xi=8,Ki=16,kn=wt|$r,Zi=xi|Ki,Hi=kn|Zi,Un=["x","y"],No=["clientX","clientY"];function Ji(xe,Be){var Je=this;this.manager=xe,this.callback=Be,this.element=xe.element,this.target=xe.options.inputTarget,this.domHandler=function(vt){K(xe.options.enable,[xe])&&Je.handler(vt)},this.init()}Ji.prototype={handler:function(){},init:function(){this.evEl&&ge(this.element,this.evEl,this.domHandler),this.evTarget&&ge(this.target,this.evTarget,this.domHandler),this.evWin&&ge(Vt(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&j(this.element,this.evEl,this.domHandler),this.evTarget&&j(this.target,this.evTarget,this.domHandler),this.evWin&&j(Vt(this.element),this.evWin,this.domHandler)}};function Bi(xe){var Be,Je=xe.options.inputClass;return Je?Be=Je:Er?Be=Ml:Jr?Be=rt:mr?Be=Ht:Be=sl,new Be(xe,yn)}function yn(xe,Be,Je){var vt=Je.pointers.length,tr=Je.changedPointers.length,qr=Be&ae&&vt-tr===0,sn=Be&(je|lt)&&vt-tr===0;Je.isFirst=!!qr,Je.isFinal=!!sn,qr&&(xe.session={}),Je.eventType=Be,po(xe,Je),xe.emit("hammer.input",Je),xe.recognize(Je),xe.session.prevInput=Je}function po(xe,Be){var Je=xe.session,vt=Be.pointers,tr=vt.length;Je.firstInput||(Je.firstInput=Ur(Be)),tr>1&&!Je.firstMultiple?Je.firstMultiple=Ur(Be):tr===1&&(Je.firstMultiple=!1);var qr=Je.firstInput,sn=Je.firstMultiple,Co=sn?sn.center:qr.center,ts=Be.center=ci(vt);Be.timeStamp=h(),Be.deltaTime=Be.timeStamp-qr.timeStamp,Be.angle=Eo(Co,ts),Be.distance=To(Co,ts),kr(Je,Be),Be.offsetDirection=Dn(Be.deltaX,Be.deltaY);var vs=to(Be.deltaTime,Be.deltaX,Be.deltaY);Be.overallVelocityX=vs.x,Be.overallVelocityY=vs.y,Be.overallVelocity=u(vs.x)>u(vs.y)?vs.x:vs.y,Be.scale=sn?So(sn.pointers,vt):1,Be.rotation=sn?Xo(sn.pointers,vt):0,Be.maxPointers=Je.prevInput?Be.pointers.length>Je.prevInput.maxPointers?Be.pointers.length:Je.prevInput.maxPointers:Be.pointers.length,dr(Je,Be);var Sa=xe.element;me(Be.srcEvent.target,Sa)&&(Sa=Be.srcEvent.target),Be.target=Sa}function kr(xe,Be){var Je=Be.center,vt=xe.offsetDelta||{},tr=xe.prevDelta||{},qr=xe.prevInput||{};(Be.eventType===ae||qr.eventType===je)&&(tr=xe.prevDelta={x:qr.deltaX||0,y:qr.deltaY||0},vt=xe.offsetDelta={x:Je.x,y:Je.y}),Be.deltaX=tr.x+(Je.x-vt.x),Be.deltaY=tr.y+(Je.y-vt.y)}function dr(xe,Be){var Je=xe.lastInterval||Be,vt=Be.timeStamp-Je.timeStamp,tr,qr,sn,Co;if(Be.eventType!=lt&&(vt>wi||Je.velocity===i)){var ts=Be.deltaX-Je.deltaX,vs=Be.deltaY-Je.deltaY,Sa=to(vt,ts,vs);qr=Sa.x,sn=Sa.y,tr=u(Sa.x)>u(Sa.y)?Sa.x:Sa.y,Co=Dn(ts,vs),xe.lastInterval=Be}else tr=Je.velocity,qr=Je.velocityX,sn=Je.velocityY,Co=Je.direction;Be.velocity=tr,Be.velocityX=qr,Be.velocityY=sn,Be.direction=Co}function Ur(xe){for(var Be=[],Je=0;Je<xe.pointers.length;)Be[Je]={clientX:l(xe.pointers[Je].clientX),clientY:l(xe.pointers[Je].clientY)},Je++;return{timeStamp:h(),pointers:Be,center:ci(Be),deltaX:xe.deltaX,deltaY:xe.deltaY}}function ci(xe){var Be=xe.length;if(Be===1)return{x:l(xe[0].clientX),y:l(xe[0].clientY)};for(var Je=0,vt=0,tr=0;tr<Be;)Je+=xe[tr].clientX,vt+=xe[tr].clientY,tr++;return{x:l(Je/Be),y:l(vt/Be)}}function to(xe,Be,Je){return{x:Be/xe||0,y:Je/xe||0}}function Dn(xe,Be){return xe===Be?Ft:u(xe)>=u(Be)?xe<0?wt:$r:Be<0?xi:Ki}function To(xe,Be,Je){Je||(Je=Un);var vt=Be[Je[0]]-xe[Je[0]],tr=Be[Je[1]]-xe[Je[1]];return Math.sqrt(vt*vt+tr*tr)}function Eo(xe,Be,Je){Je||(Je=Un);var vt=Be[Je[0]]-xe[Je[0]],tr=Be[Je[1]]-xe[Je[1]];return Math.atan2(tr,vt)*180/Math.PI}function Xo(xe,Be){return Eo(Be[1],Be[0],No)+Eo(xe[1],xe[0],No)}function So(xe,Be){return To(Be[0],Be[1],No)/To(xe[0],xe[1],No)}var Us={mousedown:ae,mousemove:be,mouseup:je},Fc="mousedown",ql="mousemove mouseup";function sl(){this.evEl=Fc,this.evWin=ql,this.pressed=!1,Ji.apply(this,arguments)}W(sl,Ji,{handler:function(Be){var Je=Us[Be.type];Je&ae&&Be.button===0&&(this.pressed=!0),Je&be&&Be.which!==1&&(Je=je),this.pressed&&(Je&je&&(this.pressed=!1),this.callback(this.manager,Je,{pointers:[Be],changedPointers:[Be],pointerType:Jt,srcEvent:Be}))}});var Cl={pointerdown:ae,pointermove:be,pointerup:je,pointercancel:lt,pointerout:lt},al={2:or,3:ai,4:Jt,5:qt},Ms="pointerdown",ca="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(Ms="MSPointerDown",ca="MSPointerMove MSPointerUp MSPointerCancel");function Ml(){this.evEl=Ms,this.evWin=ca,Ji.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}W(Ml,Ji,{handler:function(Be){var Je=this.store,vt=!1,tr=Be.type.toLowerCase().replace("ms",""),qr=Cl[tr],sn=al[Be.pointerType]||Be.pointerType,Co=sn==or,ts=Z(Je,Be.pointerId,"pointerId");qr&ae&&(Be.button===0||Co)?ts<0&&(Je.push(Be),ts=Je.length-1):qr&(je|lt)&&(vt=!0),!(ts<0)&&(Je[ts]=Be,this.callback(this.manager,qr,{pointers:Je,changedPointers:[Be],pointerType:sn,srcEvent:Be}),vt&&Je.splice(ts,1))}});var ao={touchstart:ae,touchmove:be,touchend:je,touchcancel:lt},oe="touchstart",de="touchstart touchmove touchend touchcancel";function ve(){this.evTarget=oe,this.evWin=de,this.started=!1,Ji.apply(this,arguments)}W(ve,Ji,{handler:function(Be){var Je=ao[Be.type];if(Je===ae&&(this.started=!0),!!this.started){var vt=Pe.call(this,Be,Je);Je&(je|lt)&&vt[0].length-vt[1].length===0&&(this.started=!1),this.callback(this.manager,Je,{pointers:vt[0],changedPointers:vt[1],pointerType:or,srcEvent:Be})}}});function Pe(xe,Be){var Je=we(xe.touches),vt=we(xe.changedTouches);return Be&(je|lt)&&(Je=Oe(Je.concat(vt),"identifier",!0)),[Je,vt]}var ye={touchstart:ae,touchmove:be,touchend:je,touchcancel:lt},tt="touchstart touchmove touchend touchcancel";function rt(){this.evTarget=tt,this.targetIds={},Ji.apply(this,arguments)}W(rt,Ji,{handler:function(Be){var Je=ye[Be.type],vt=Se.call(this,Be,Je);vt&&this.callback(this.manager,Je,{pointers:vt[0],changedPointers:vt[1],pointerType:or,srcEvent:Be})}});function Se(xe,Be){var Je=we(xe.touches),vt=this.targetIds;if(Be&(ae|be)&&Je.length===1)return vt[Je[0].identifier]=!0,[Je,Je];var tr,qr,sn=we(xe.changedTouches),Co=[],ts=this.target;if(qr=Je.filter(function(vs){return me(vs.target,ts)}),Be===ae)for(tr=0;tr<qr.length;)vt[qr[tr].identifier]=!0,tr++;for(tr=0;tr<sn.length;)vt[sn[tr].identifier]&&Co.push(sn[tr]),Be&(je|lt)&&delete vt[sn[tr].identifier],tr++;if(Co.length)return[Oe(qr.concat(Co),"identifier",!0),Co]}var Ge=2500,ht=25;function Ht(){Ji.apply(this,arguments);var xe=J(this.handler,this);this.touch=new rt(this.manager,xe),this.mouse=new sl(this.manager,xe),this.primaryTouch=null,this.lastTouches=[]}W(Ht,Ji,{handler:function(Be,Je,vt){var tr=vt.pointerType==or,qr=vt.pointerType==Jt;if(!(qr&&vt.sourceCapabilities&&vt.sourceCapabilities.firesTouchEvents)){if(tr)Zt.call(this,Je,vt);else if(qr&&Xt.call(this,vt))return;this.callback(Be,Je,vt)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Zt(xe,Be){xe&ae?(this.primaryTouch=Be.changedPointers[0].identifier,Pt.call(this,Be)):xe&(je|lt)&&Pt.call(this,Be)}function Pt(xe){var Be=xe.changedPointers[0];if(Be.identifier===this.primaryTouch){var Je={x:Be.clientX,y:Be.clientY};this.lastTouches.push(Je);var vt=this.lastTouches,tr=function(){var qr=vt.indexOf(Je);qr>-1&&vt.splice(qr,1)};setTimeout(tr,Ge)}}function Xt(xe){for(var Be=xe.srcEvent.clientX,Je=xe.srcEvent.clientY,vt=0;vt<this.lastTouches.length;vt++){var tr=this.lastTouches[vt],qr=Math.abs(Be-tr.x),sn=Math.abs(Je-tr.y);if(qr<=ht&&sn<=ht)return!0}return!1}var Dr=he(o.style,"touchAction"),Mr=Dr!==i,Ot="compute",br="auto",sr="manipulation",lr="none",bi="pan-x",pr="pan-y",Ii=Qi();function vn(xe,Be){this.manager=xe,this.set(Be)}vn.prototype={set:function(xe){xe==Ot&&(xe=this.compute()),Mr&&this.manager.element.style&&Ii[xe]&&(this.manager.element.style[Dr]=xe),this.actions=xe.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var xe=[];return E(this.manager.recognizers,function(Be){K(Be.options.enable,[Be])&&(xe=xe.concat(Be.getTouchAction()))}),Di(xe.join(" "))},preventDefaults:function(xe){var Be=xe.srcEvent,Je=xe.offsetDirection;if(this.manager.session.prevented){Be.preventDefault();return}var vt=this.actions,tr=fe(vt,lr)&&!Ii[lr],qr=fe(vt,pr)&&!Ii[pr],sn=fe(vt,bi)&&!Ii[bi];if(tr){var Co=xe.pointers.length===1,ts=xe.distance<2,vs=xe.deltaTime<250;if(Co&&ts&&vs)return}if(!(sn&&qr)&&(tr||qr&&Je&kn||sn&&Je&Zi))return this.preventSrc(Be)},preventSrc:function(xe){this.manager.session.prevented=!0,xe.preventDefault()}};function Di(xe){if(fe(xe,lr))return lr;var Be=fe(xe,bi),Je=fe(xe,pr);return Be&&Je?lr:Be||Je?Be?bi:pr:fe(xe,sr)?sr:br}function Qi(){if(!Mr)return!1;var xe={},Be=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(Je){xe[Je]=Be?t.CSS.supports("touch-action",Je):!0}),xe}var Li=1,Xn=2,$i=4,Ln=8,en=Ln,Si=16,Oi=32;function yo(xe){this.options=O({},this.defaults,xe||{}),this.id=ft(),this.manager=null,this.options.enable=ne(this.options.enable,!0),this.state=Li,this.simultaneous={},this.requireFail=[]}yo.prototype={defaults:{},set:function(xe){return O(this.options,xe),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(xe){if(T(xe,"recognizeWith",this))return this;var Be=this.simultaneous;return xe=Yo(xe,this),Be[xe.id]||(Be[xe.id]=xe,xe.recognizeWith(this)),this},dropRecognizeWith:function(xe){return T(xe,"dropRecognizeWith",this)?this:(xe=Yo(xe,this),delete this.simultaneous[xe.id],this)},requireFailure:function(xe){if(T(xe,"requireFailure",this))return this;var Be=this.requireFail;return xe=Yo(xe,this),Z(Be,xe)===-1&&(Be.push(xe),xe.requireFailure(this)),this},dropRequireFailure:function(xe){if(T(xe,"dropRequireFailure",this))return this;xe=Yo(xe,this);var Be=Z(this.requireFail,xe);return Be>-1&&this.requireFail.splice(Be,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(xe){return!!this.simultaneous[xe.id]},emit:function(xe){var Be=this,Je=this.state;function vt(tr){Be.manager.emit(tr,xe)}Je<Ln&&vt(Be.options.event+fc(Je)),vt(Be.options.event),xe.additionalEvent&&vt(xe.additionalEvent),Je>=Ln&&vt(Be.options.event+fc(Je))},tryEmit:function(xe){if(this.canEmit())return this.emit(xe);this.state=Oi},canEmit:function(){for(var xe=0;xe<this.requireFail.length;){if(!(this.requireFail[xe].state&(Oi|Li)))return!1;xe++}return!0},recognize:function(xe){var Be=O({},xe);if(!K(this.options.enable,[this,Be])){this.reset(),this.state=Oi;return}this.state&(en|Si|Oi)&&(this.state=Li),this.state=this.process(Be),this.state&(Xn|$i|Ln|Si)&&this.tryEmit(Be)},process:function(xe){},getTouchAction:function(){},reset:function(){}};function fc(xe){return xe&Si?"cancel":xe&Ln?"end":xe&$i?"move":xe&Xn?"start":""}function ko(xe){return xe==Ki?"down":xe==xi?"up":xe==wt?"left":xe==$r?"right":""}function Yo(xe,Be){var Je=Be.manager;return Je?Je.get(xe):xe}function zs(){yo.apply(this,arguments)}W(zs,yo,{defaults:{pointers:1},attrTest:function(xe){var Be=this.options.pointers;return Be===0||xe.pointers.length===Be},process:function(xe){var Be=this.state,Je=xe.eventType,vt=Be&(Xn|$i),tr=this.attrTest(xe);return vt&&(Je&lt||!tr)?Be|Si:vt||tr?Je&je?Be|Ln:Be&Xn?Be|$i:Xn:Oi}});function Uo(){zs.apply(this,arguments),this.pX=null,this.pY=null}W(Uo,zs,{defaults:{event:"pan",threshold:10,pointers:1,direction:Hi},getTouchAction:function(){var xe=this.options.direction,Be=[];return xe&kn&&Be.push(pr),xe&Zi&&Be.push(bi),Be},directionTest:function(xe){var Be=this.options,Je=!0,vt=xe.distance,tr=xe.direction,qr=xe.deltaX,sn=xe.deltaY;return tr&Be.direction||(Be.direction&kn?(tr=qr===0?Ft:qr<0?wt:$r,Je=qr!=this.pX,vt=Math.abs(xe.deltaX)):(tr=sn===0?Ft:sn<0?xi:Ki,Je=sn!=this.pY,vt=Math.abs(xe.deltaY))),xe.direction=tr,Je&&vt>Be.threshold&&tr&Be.direction},attrTest:function(xe){return zs.prototype.attrTest.call(this,xe)&&(this.state&Xn||!(this.state&Xn)&&this.directionTest(xe))},emit:function(xe){this.pX=xe.deltaX,this.pY=xe.deltaY;var Be=ko(xe.direction);Be&&(xe.additionalEvent=this.options.event+Be),this._super.emit.call(this,xe)}});function zn(){zs.apply(this,arguments)}W(zn,zs,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[lr]},attrTest:function(xe){return this._super.attrTest.call(this,xe)&&(Math.abs(xe.scale-1)>this.options.threshold||this.state&Xn)},emit:function(xe){if(xe.scale!==1){var Be=xe.scale<1?"in":"out";xe.additionalEvent=this.options.event+Be}this._super.emit.call(this,xe)}});function ll(){yo.apply(this,arguments),this._timer=null,this._input=null}W(ll,yo,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[br]},process:function(xe){var Be=this.options,Je=xe.pointers.length===Be.pointers,vt=xe.distance<Be.threshold,tr=xe.deltaTime>Be.time;if(this._input=xe,!vt||!Je||xe.eventType&(je|lt)&&!tr)this.reset();else if(xe.eventType&ae)this.reset(),this._timer=v(function(){this.state=en,this.tryEmit()},Be.time,this);else if(xe.eventType&je)return en;return Oi},reset:function(){clearTimeout(this._timer)},emit:function(xe){this.state===en&&(xe&&xe.eventType&je?this.manager.emit(this.options.event+"up",xe):(this._input.timeStamp=h(),this.manager.emit(this.options.event,this._input)))}});function cs(){zs.apply(this,arguments)}W(cs,zs,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[lr]},attrTest:function(xe){return this._super.attrTest.call(this,xe)&&(Math.abs(xe.rotation)>this.options.threshold||this.state&Xn)}});function zo(){zs.apply(this,arguments)}W(zo,zs,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:kn|Zi,pointers:1},getTouchAction:function(){return Uo.prototype.getTouchAction.call(this)},attrTest:function(xe){var Be=this.options.direction,Je;return Be&(kn|Zi)?Je=xe.overallVelocity:Be&kn?Je=xe.overallVelocityX:Be&Zi&&(Je=xe.overallVelocityY),this._super.attrTest.call(this,xe)&&Be&xe.offsetDirection&&xe.distance>this.options.threshold&&xe.maxPointers==this.options.pointers&&u(Je)>this.options.velocity&&xe.eventType&je},emit:function(xe){var Be=ko(xe.offsetDirection);Be&&this.manager.emit(this.options.event+Be,xe),this.manager.emit(this.options.event,xe)}});function ys(){yo.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}W(ys,yo,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[sr]},process:function(xe){var Be=this.options,Je=xe.pointers.length===Be.pointers,vt=xe.distance<Be.threshold,tr=xe.deltaTime<Be.time;if(this.reset(),xe.eventType&ae&&this.count===0)return this.failTimeout();if(vt&&tr&&Je){if(xe.eventType!=je)return this.failTimeout();var qr=this.pTime?xe.timeStamp-this.pTime<Be.interval:!0,sn=!this.pCenter||To(this.pCenter,xe.center)<Be.posThreshold;this.pTime=xe.timeStamp,this.pCenter=xe.center,!sn||!qr?this.count=1:this.count+=1,this._input=xe;var Co=this.count%Be.taps;if(Co===0)return this.hasRequireFailures()?(this._timer=v(function(){this.state=en,this.tryEmit()},Be.interval,this),Xn):en}return Oi},failTimeout:function(){return this._timer=v(function(){this.state=Oi},this.options.interval,this),Oi},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==en&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function pn(xe,Be){return Be=Be||{},Be.recognizers=ne(Be.recognizers,pn.defaults.preset),new Qu(xe,Be)}pn.VERSION="2.0.7",pn.defaults={domEvents:!1,touchAction:Ot,enable:!0,inputTarget:null,inputClass:null,preset:[[cs,{enable:!1}],[zn,{enable:!1},["rotate"]],[zo,{direction:kn}],[Uo,{direction:kn},["swipe"]],[ys],[ys,{event:"doubletap",taps:2},["tap"]],[ll]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var $s=1,Vs=2;function Qu(xe,Be){this.options=O({},pn.defaults,Be||{}),this.options.inputTarget=this.options.inputTarget||xe,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=xe,this.input=Bi(this),this.touchAction=new vn(this,this.options.touchAction),ua(this,!0),E(this.options.recognizers,function(Je){var vt=this.add(new Je[0](Je[1]));Je[2]&&vt.recognizeWith(Je[2]),Je[3]&&vt.requireFailure(Je[3])},this)}Qu.prototype={set:function(xe){return O(this.options,xe),xe.touchAction&&this.touchAction.update(),xe.inputTarget&&(this.input.destroy(),this.input.target=xe.inputTarget,this.input.init()),this},stop:function(xe){this.session.stopped=xe?Vs:$s},recognize:function(xe){var Be=this.session;if(!Be.stopped){this.touchAction.preventDefaults(xe);var Je,vt=this.recognizers,tr=Be.curRecognizer;(!tr||tr&&tr.state&en)&&(tr=Be.curRecognizer=null);for(var qr=0;qr<vt.length;)Je=vt[qr],Be.stopped!==Vs&&(!tr||Je==tr||Je.canRecognizeWith(tr))?Je.recognize(xe):Je.reset(),!tr&&Je.state&(Xn|$i|Ln)&&(tr=Be.curRecognizer=Je),qr++}},get:function(xe){if(xe instanceof yo)return xe;for(var Be=this.recognizers,Je=0;Je<Be.length;Je++)if(Be[Je].options.event==xe)return Be[Je];return null},add:function(xe){if(T(xe,"add",this))return this;var Be=this.get(xe.options.event);return Be&&this.remove(Be),this.recognizers.push(xe),xe.manager=this,this.touchAction.update(),xe},remove:function(xe){if(T(xe,"remove",this))return this;if(xe=this.get(xe),xe){var Be=this.recognizers,Je=Z(Be,xe);Je!==-1&&(Be.splice(Je,1),this.touchAction.update())}return this},on:function(xe,Be){if(xe!==i&&Be!==i){var Je=this.handlers;return E($(xe),function(vt){Je[vt]=Je[vt]||[],Je[vt].push(Be)}),this}},off:function(xe,Be){if(xe!==i){var Je=this.handlers;return E($(xe),function(vt){Be?Je[vt]&&Je[vt].splice(Z(Je[vt],Be),1):delete Je[vt]}),this}},emit:function(xe,Be){this.options.domEvents&&Ua(xe,Be);var Je=this.handlers[xe]&&this.handlers[xe].slice();if(!(!Je||!Je.length)){Be.type=xe,Be.preventDefault=function(){Be.srcEvent.preventDefault()};for(var vt=0;vt<Je.length;)Je[vt](Be),vt++}},destroy:function(){this.element&&ua(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function ua(xe,Be){var Je=xe.element;if(Je.style){var vt;E(xe.options.cssProps,function(tr,qr){vt=he(Je.style,qr),Be?(xe.oldCssProps[vt]=Je.style[vt],Je.style[vt]=tr):Je.style[vt]=xe.oldCssProps[vt]||""}),Be||(xe.oldCssProps={})}}function Ua(xe,Be){var Je=e.createEvent("Event");Je.initEvent(xe,!0,!0),Je.gesture=Be,Be.target.dispatchEvent(Je)}O(pn,{INPUT_START:ae,INPUT_MOVE:be,INPUT_END:je,INPUT_CANCEL:lt,STATE_POSSIBLE:Li,STATE_BEGAN:Xn,STATE_CHANGED:$i,STATE_ENDED:Ln,STATE_RECOGNIZED:en,STATE_CANCELLED:Si,STATE_FAILED:Oi,DIRECTION_NONE:Ft,DIRECTION_LEFT:wt,DIRECTION_RIGHT:$r,DIRECTION_UP:xi,DIRECTION_DOWN:Ki,DIRECTION_HORIZONTAL:kn,DIRECTION_VERTICAL:Zi,DIRECTION_ALL:Hi,Manager:Qu,Input:Ji,TouchAction:vn,TouchInput:rt,MouseInput:sl,PointerEventInput:Ml,TouchMouseInput:Ht,SingleTouchInput:ve,Recognizer:yo,AttrRecognizer:zs,Tap:ys,Pan:Uo,Swipe:zo,Pinch:zn,Rotate:cs,Press:ll,on:ge,off:j,each:E,merge:z,extend:F,assign:O,inherit:W,bindFn:J,prefixed:he});var cl=typeof t<"u"?t:typeof self<"u"?self:{};cl.Hammer=pn,i==="function"&&define.amd?define(function(){return pn}):typeof yE<"u"&&yE.exports?yE.exports=pn:t[r]=pn})(window,document,"Hammer")});var PH=Qt((rKe,HO)=>{"use strict";HO.exports=rS;HO.exports.default=rS;function rS(t,e,r){r=r||2;var i=e&&e.length,n=i?e[0]*r:t.length,o=CH(t,0,n,r,!0),s=[];if(!o||o.next===o.prev)return s;var l,u,h,v,T,E,M;if(i&&(o=rpe(t,e,o,r)),t.length>80*r){l=h=t[0],u=v=t[1];for(var O=r;O<n;O+=r)T=t[O],E=t[O+1],T<l&&(l=T),E<u&&(u=E),T>h&&(h=T),E>v&&(v=E);M=Math.max(h-l,v-u),M=M!==0?32767/M:0}return X1(o,s,r,l,u,M,0),s}function CH(t,e,r,i,n){var o,s;if(n===VO(t,e,r,i)>0)for(o=e;o<r;o+=i)s=SH(o,t[o],t[o+1],s);else for(o=r-i;o>=e;o-=i)s=SH(o,t[o],t[o+1],s);return s&&iS(s,s.next)&&(K1(s),s=s.next),s}function Xm(t,e){if(!t)return t;e||(e=t);var r=t,i;do if(i=!1,!r.steiner&&(iS(r,r.next)||Ns(r.prev,r,r.next)===0)){if(K1(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function X1(t,e,r,i,n,o,s){if(t){!s&&o&&ape(t,i,n,o);for(var l=t,u,h;t.prev!==t.next;){if(u=t.prev,h=t.next,o?$de(t,i,n,o):Qde(t)){e.push(u.i/r|0),e.push(t.i/r|0),e.push(h.i/r|0),K1(t),t=h.next,l=h.next;continue}if(t=h,t===l){s?s===1?(t=epe(Xm(t),e,r),X1(t,e,r,i,n,o,2)):s===2&&tpe(t,e,r,i,n,o):X1(Xm(t),e,r,i,n,o,1);break}}}}function Qde(t){var e=t.prev,r=t,i=t.next;if(Ns(e,r,i)>=0)return!1;for(var n=e.x,o=r.x,s=i.x,l=e.y,u=r.y,h=i.y,v=n<o?n<s?n:s:o<s?o:s,T=l<u?l<h?l:h:u<h?u:h,E=n>o?n>s?n:s:o>s?o:s,M=l>u?l>h?l:h:u>h?u:h,O=i.next;O!==e;){if(O.x>=v&&O.x<=E&&O.y>=T&&O.y<=M&&v_(n,l,o,u,s,h,O.x,O.y)&&Ns(O.prev,O,O.next)>=0)return!1;O=O.next}return!0}function $de(t,e,r,i){var n=t.prev,o=t,s=t.next;if(Ns(n,o,s)>=0)return!1;for(var l=n.x,u=o.x,h=s.x,v=n.y,T=o.y,E=s.y,M=l<u?l<h?l:h:u<h?u:h,O=v<T?v<E?v:E:T<E?T:E,F=l>u?l>h?l:h:u>h?u:h,z=v>T?v>E?v:E:T>E?T:E,W=UO(M,O,e,r,i),J=UO(F,z,e,r,i),K=t.prevZ,ne=t.nextZ;K&&K.z>=W&&ne&&ne.z<=J;){if(K.x>=M&&K.x<=F&&K.y>=O&&K.y<=z&&K!==n&&K!==s&&v_(l,v,u,T,h,E,K.x,K.y)&&Ns(K.prev,K,K.next)>=0||(K=K.prevZ,ne.x>=M&&ne.x<=F&&ne.y>=O&&ne.y<=z&&ne!==n&&ne!==s&&v_(l,v,u,T,h,E,ne.x,ne.y)&&Ns(ne.prev,ne,ne.next)>=0))return!1;ne=ne.nextZ}for(;K&&K.z>=W;){if(K.x>=M&&K.x<=F&&K.y>=O&&K.y<=z&&K!==n&&K!==s&&v_(l,v,u,T,h,E,K.x,K.y)&&Ns(K.prev,K,K.next)>=0)return!1;K=K.prevZ}for(;ne&&ne.z<=J;){if(ne.x>=M&&ne.x<=F&&ne.y>=O&&ne.y<=z&&ne!==n&&ne!==s&&v_(l,v,u,T,h,E,ne.x,ne.y)&&Ns(ne.prev,ne,ne.next)>=0)return!1;ne=ne.nextZ}return!0}function epe(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!iS(n,o)&&MH(n,i,i.next,o)&&Y1(n,o)&&Y1(o,n)&&(e.push(n.i/r|0),e.push(i.i/r|0),e.push(o.i/r|0),K1(i),K1(i.next),i=t=o),i=i.next}while(i!==t);return Xm(i)}function tpe(t,e,r,i,n,o){var s=t;do{for(var l=s.next.next;l!==s.prev;){if(s.i!==l.i&&upe(s,l)){var u=IH(s,l);s=Xm(s,s.next),u=Xm(u,u.next),X1(s,e,r,i,n,o,0),X1(u,e,r,i,n,o,0);return}l=l.next}s=s.next}while(s!==t)}function rpe(t,e,r,i){var n=[],o,s,l,u,h;for(o=0,s=e.length;o<s;o++)l=e[o]*i,u=o<s-1?e[o+1]*i:t.length,h=CH(t,l,u,i,!1),h===h.next&&(h.steiner=!0),n.push(cpe(h));for(n.sort(ipe),o=0;o<n.length;o++)r=npe(n[o],r);return r}function ipe(t,e){return t.x-e.x}function npe(t,e){var r=ope(t,e);if(!r)return e;var i=IH(r,t);return Xm(i,i.next),Xm(r,r.next)}function ope(t,e){var r=e,i=t.x,n=t.y,o=-1/0,s;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){var l=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(l<=i&&l>o&&(o=l,s=r.x<r.next.x?r:r.next,l===i))return s}r=r.next}while(r!==e);if(!s)return null;var u=s,h=s.x,v=s.y,T=1/0,E;r=s;do i>=r.x&&r.x>=h&&i!==r.x&&v_(n<v?i:o,n,h,v,n<v?o:i,n,r.x,r.y)&&(E=Math.abs(n-r.y)/(i-r.x),Y1(r,t)&&(E<T||E===T&&(r.x>s.x||r.x===s.x&&spe(s,r)))&&(s=r,T=E)),r=r.next;while(r!==u);return s}function spe(t,e){return Ns(t.prev,t,e.prev)<0&&Ns(e.next,t,t.next)<0}function ape(t,e,r,i){var n=t;do n.z===0&&(n.z=UO(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,lpe(n)}function lpe(t){var e,r,i,n,o,s,l,u,h=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,i=r,l=0,e=0;e<h&&(l++,i=i.nextZ,!!i);e++);for(u=h;l>0||u>0&&i;)l!==0&&(u===0||!i||r.z<=i.z)?(n=r,r=r.nextZ,l--):(n=i,i=i.nextZ,u--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,h*=2}while(s>1);return t}function UO(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function cpe(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function v_(t,e,r,i,n,o,s,l){return(n-s)*(e-l)>=(t-s)*(o-l)&&(t-s)*(i-l)>=(r-s)*(e-l)&&(r-s)*(o-l)>=(n-s)*(i-l)}function upe(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!fpe(t,e)&&(Y1(t,e)&&Y1(e,t)&&hpe(t,e)&&(Ns(t.prev,t,e.prev)||Ns(t,e.prev,e))||iS(t,e)&&Ns(t.prev,t,t.next)>0&&Ns(e.prev,e,e.next)>0)}function Ns(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function iS(t,e){return t.x===e.x&&t.y===e.y}function MH(t,e,r,i){var n=tS(Ns(t,e,r)),o=tS(Ns(t,e,i)),s=tS(Ns(r,i,t)),l=tS(Ns(r,i,e));return!!(n!==o&&s!==l||n===0&&eS(t,r,e)||o===0&&eS(t,i,e)||s===0&&eS(r,t,i)||l===0&&eS(r,e,i))}function eS(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function tS(t){return t>0?1:t<0?-1:0}function fpe(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&MH(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Y1(t,e){return Ns(t.prev,t,t.next)<0?Ns(t,e,t.next)>=0&&Ns(t,t.prev,e)>=0:Ns(t,e,t.prev)<0||Ns(t,t.next,e)<0}function hpe(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}function IH(t,e){var r=new zO(t.i,t.x,t.y),i=new zO(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function SH(t,e,r,i){var n=new zO(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function K1(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 zO(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}rS.deviation=function(t,e,r,i){var n=e&&e.length,o=n?e[0]*r:t.length,s=Math.abs(VO(t,0,o,r));if(n)for(var l=0,u=e.length;l<u;l++){var h=e[l]*r,v=l<u-1?e[l+1]*r:t.length;s-=Math.abs(VO(t,h,v,r))}var T=0;for(l=0;l<i.length;l+=3){var E=i[l]*r,M=i[l+1]*r,O=i[l+2]*r;T+=Math.abs((t[E]-t[O])*(t[M+1]-t[E+1])-(t[E]-t[M])*(t[O+1]-t[E+1]))}return s===0&&T===0?0:Math.abs((T-s)/s)};function VO(t,e,r,i){for(var n=0,o=e,s=r-i;o<r;o+=i)n+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return n}rS.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},i=0,n=0;n<t.length;n++){for(var o=0;o<t[n].length;o++)for(var s=0;s<e;s++)r.vertices.push(t[n][o][s]);n>0&&(i+=t[n-1].length,r.holes.push(i))}return r}});var kS=Qt(Nd=>{"use strict";var U7=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",ZAe=U7+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",z7="["+U7+"]["+ZAe+"]*",JAe=new RegExp("^"+z7+"$"),QAe=function(t,e){let r=[],i=e.exec(t);for(;i;){let n=[];n.startIndex=e.lastIndex-i[0].length;let o=i.length;for(let s=0;s<o;s++)n.push(i[s]);r.push(n),i=e.exec(t)}return r},$Ae=function(t){let e=JAe.exec(t);return!(e===null||typeof e>"u")};Nd.isExist=function(t){return typeof t<"u"};Nd.isEmptyObject=function(t){return Object.keys(t).length===0};Nd.merge=function(t,e,r){if(e){let i=Object.keys(e),n=i.length;for(let o=0;o<n;o++)r==="strict"?t[i[o]]=[e[i[o]]]:t[i[o]]=e[i[o]]}};Nd.getValue=function(t){return Nd.isExist(t)?t:""};Nd.isName=$Ae;Nd.getAllMatches=QAe;Nd.nameRegexp=z7});var cD=Qt(W7=>{"use strict";var lD=kS(),eme={allowBooleanAttributes:!1,unpairedTags:[]};W7.validate=function(t,e){e=Object.assign({},eme,e);let r=[],i=!1,n=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=H7(t,o),o.err)return o}else if(t[o]==="<"){let s=o;if(o++,t[o]==="!"){o=j7(t,o);continue}else{let l=!1;t[o]==="/"&&(l=!0,o++);let u="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
`&&t[o]!=="\r";o++)u+=t[o];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),o--),!lme(u)){let T;return u.trim().length===0?T="Invalid space after '<'.":T="Tag '"+u+"' is an invalid name.",ba("InvalidTag",T,Sc(t,o))}let h=ime(t,o);if(h===!1)return ba("InvalidAttr","Attributes for '"+u+"' have open quote.",Sc(t,o));let v=h.value;if(o=h.index,v[v.length-1]==="/"){let T=o-v.length;v=v.substring(0,v.length-1);let E=G7(v,e);if(E===!0)i=!0;else return ba(E.err.code,E.err.msg,Sc(t,T+E.err.line))}else if(l)if(h.tagClosed){if(v.trim().length>0)return ba("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",Sc(t,s));{let T=r.pop();if(u!==T.tagName){let E=Sc(t,T.tagStartPos);return ba("InvalidTag","Expected closing tag '"+T.tagName+"' (opened in line "+E.line+", col "+E.col+") instead of closing tag '"+u+"'.",Sc(t,s))}r.length==0&&(n=!0)}}else return ba("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",Sc(t,o));else{let T=G7(v,e);if(T!==!0)return ba(T.err.code,T.err.msg,Sc(t,o-v.length+T.err.line));if(n===!0)return ba("InvalidXml","Multiple possible root nodes found.",Sc(t,o));e.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:s}),i=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=j7(t,o);continue}else if(t[o+1]==="?"){if(o=H7(t,++o),o.err)return o}else break;else if(t[o]==="&"){let T=sme(t,o);if(T==-1)return ba("InvalidChar","char '&' is not expected.",Sc(t,o));o=T}else if(n===!0&&!V7(t[o]))return ba("InvalidXml","Extra text at the end",Sc(t,o));t[o]==="<"&&o--}}else{if(V7(t[o]))continue;return ba("InvalidChar","char '"+t[o]+"' is not expected.",Sc(t,o))}if(i){if(r.length==1)return ba("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Sc(t,r[0].tagStartPos));if(r.length>0)return ba("InvalidXml","Invalid '"+JSON.stringify(r.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ba("InvalidXml","Start tag expected.",1);return!0};function V7(t){return t===" "||t===" "||t===`
`||t==="\r"}function H7(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let i=t.substr(r,e-r);if(e>5&&i==="xml")return ba("InvalidXml","XML declaration allowed only at the start of the document.",Sc(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function j7(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var tme='"',rme="'";function ime(t,e){let r="",i="",n=!1;for(;e<t.length;e++){if(t[e]===tme||t[e]===rme)i===""?i=t[e]:i!==t[e]||(i="");else if(t[e]===">"&&i===""){n=!0;break}r+=t[e]}return i!==""?!1:{value:r,index:e,tagClosed:n}}var nme=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function G7(t,e){let r=lD.getAllMatches(t,nme),i={};for(let n=0;n<r.length;n++){if(r[n][1].length===0)return ba("InvalidAttr","Attribute '"+r[n][2]+"' has no space in starting.",fb(r[n]));if(r[n][3]!==void 0&&r[n][4]===void 0)return ba("InvalidAttr","Attribute '"+r[n][2]+"' is without value.",fb(r[n]));if(r[n][3]===void 0&&!e.allowBooleanAttributes)return ba("InvalidAttr","boolean attribute '"+r[n][2]+"' is not allowed.",fb(r[n]));let o=r[n][2];if(!ame(o))return ba("InvalidAttr","Attribute '"+o+"' is an invalid name.",fb(r[n]));if(!i.hasOwnProperty(o))i[o]=1;else return ba("InvalidAttr","Attribute '"+o+"' is repeated.",fb(r[n]))}return!0}function ome(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function sme(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,ome(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function ba(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function ame(t){return lD.isName(t)}function lme(t){return lD.isName(t)}function Sc(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function fb(t){return t.startIndex+t[1].length}});var X7=Qt(uD=>{var q7={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}},cme=function(t){return Object.assign({},q7,t)};uD.buildOptions=cme;uD.defaultOptions=q7});var K7=Qt((I$e,Y7)=>{"use strict";var fD=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,[":@"]:e[":@"]}):this.child.push({[e.tagname]:e.child})}};Y7.exports=fD});var J7=Qt((P$e,Z7)=>{var ume=kS();function fme(t,e){let r={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let i=1,n=!1,o=!1,s="";for(;e<t.length;e++)if(t[e]==="<"&&!o){if(n&&pme(t,e))e+=7,[entityName,val,e]=hme(t,e+1),val.indexOf("&")===-1&&(r[_me(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(n&&Ame(t,e))e+=8;else if(n&&mme(t,e))e+=8;else if(n&&gme(t,e))e+=9;else if(dme)o=!0;else throw new Error("Invalid DOCTYPE");i++,s=""}else if(t[e]===">"){if(o?t[e-1]==="-"&&t[e-2]==="-"&&(o=!1,i--):i--,i===0)break}else t[e]==="["?n=!0:s+=t[e];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:e}}function hme(t,e){let r="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)r+=t[e];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");let i=t[e++],n="";for(;e<t.length&&t[e]!==i;e++)n+=t[e];return[r,n,e]}function dme(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function pme(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function Ame(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function mme(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function gme(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function _me(t){if(ume.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}Z7.exports=fme});var $7=Qt((R$e,Q7)=>{var yme=/^[-+]?0x[a-fA-F0-9]+$/,vme=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var xme={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function bme(t,e={}){if(e=Object.assign({},xme,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(e.hex&&yme.test(r))return Number.parseInt(r,16);{let i=vme.exec(r);if(i){let n=i[1],o=i[2],s=wme(i[3]),l=i[4]||i[6];if(!e.leadingZeros&&o.length>0&&n&&r[2]!==".")return t;if(!e.leadingZeros&&o.length>0&&!n&&r[1]!==".")return t;{let u=Number(r),h=""+u;return h.search(/[eE]/)!==-1||l?e.eNotation?u:t:r.indexOf(".")!==-1?h==="0"&&s===""||h===s||n&&h==="-"+s?u:t:o?s===h||n+s===h?u:t:r===h||r===n+h?u:t}}else return t}}function wme(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}Q7.exports=bme});var rG=Qt((B$e,tG)=>{"use strict";var eG=kS(),hb=K7(),Tme=J7(),Eme=$7(),hD=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,i)=>String.fromCharCode(Number.parseInt(i,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,i)=>String.fromCharCode(Number.parseInt(i,16))}},this.addExternalEntities=Sme,this.parseXml=Rme,this.parseTextData=Cme,this.resolveNameSpace=Mme,this.buildAttributesMap=Pme,this.isItStopNode=Lme,this.replaceEntitiesValue=Ome,this.readStopNodeData=Nme,this.saveTextToParentTag=Dme,this.addChild=Bme}};function Sme(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=e[r];this.lastEntities[i]={regex:new RegExp("&"+i+";","g"),val:t[i]}}}function Cme(t,e,r,i,n,o,s){if(t!==void 0&&(this.options.trimValues&&!i&&(t=t.trim()),t.length>0)){s||(t=this.replaceEntitiesValue(t));let l=this.options.tagValueProcessor(e,t,r,n,o);return l==null?t:typeof l!=typeof t||l!==t?l:this.options.trimValues?pD(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?pD(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Mme(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var Ime=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Pme(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let i=eG.getAllMatches(t,Ime),n=i.length,o={};for(let s=0;s<n;s++){let l=this.resolveNameSpace(i[s][1]),u=i[s][4],h=this.options.attributeNamePrefix+l;if(l.length)if(this.options.transformAttributeName&&(h=this.options.transformAttributeName(h)),h==="__proto__"&&(h="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u);let v=this.options.attributeValueProcessor(l,u,e);v==null?o[h]=u:typeof v!=typeof u||v!==u?o[h]=v:o[h]=pD(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[h]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){let s={};return s[this.options.attributesGroupName]=o,s}return o}}var Rme=function(t){t=t.replace(/\r\n?/g,`
`);let e=new hb("!xml"),r=e,i="",n="";for(let o=0;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="/"){let l=$m(t,">",o,"Closing Tag is not closed."),u=t.substring(o+2,l).trim();if(this.options.removeNSPrefix){let T=u.indexOf(":");T!==-1&&(u=u.substr(T+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&(i=this.saveTextToParentTag(i,r,n));let h=n.substring(n.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let v=0;h&&this.options.unpairedTags.indexOf(h)!==-1?(v=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):v=n.lastIndexOf("."),n=n.substring(0,v),r=this.tagsNodeStack.pop(),i="",o=l}else if(t[o+1]==="?"){let l=dD(t,o,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,r,n),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){let u=new hb(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,n,l.tagName)),this.addChild(r,u,n)}o=l.closeIndex+1}else if(t.substr(o+1,3)==="!--"){let l=$m(t,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){let u=t.substring(o+4,l-2);i=this.saveTextToParentTag(i,r,n),r.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}o=l}else if(t.substr(o+1,2)==="!D"){let l=Tme(t,o);this.docTypeEntities=l.entities,o=l.i}else if(t.substr(o+1,2)==="!["){let l=$m(t,"]]>",o,"CDATA is not closed.")-2,u=t.substring(o+9,l);i=this.saveTextToParentTag(i,r,n);let h=this.parseTextData(u,r.tagname,n,!0,!1,!0,!0);h==null&&(h=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):r.add(this.options.textNodeName,h),o=l+2}else{let l=dD(t,o,this.options.removeNSPrefix),u=l.tagName,h=l.rawTagName,v=l.tagExp,T=l.attrExpPresent,E=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&i&&r.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,r,n,!1));let M=r;if(M&&this.options.unpairedTags.indexOf(M.tagname)!==-1&&(r=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),u!==e.tagname&&(n+=n?"."+u:u),this.isItStopNode(this.options.stopNodes,n,u)){let O="";if(v.length>0&&v.lastIndexOf("/")===v.length-1)o=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)o=l.closeIndex;else{let z=this.readStopNodeData(t,h,E+1);if(!z)throw new Error(`Unexpected end of ${h}`);o=z.i,O=z.tagContent}let F=new hb(u);u!==v&&T&&(F[":@"]=this.buildAttributesMap(v,n,u)),O&&(O=this.parseTextData(O,u,n,!0,T,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),F.add(this.options.textNodeName,O),this.addChild(r,F,n)}else{if(v.length>0&&v.lastIndexOf("/")===v.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),n=n.substr(0,n.length-1),v=u):v=v.substr(0,v.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let O=new hb(u);u!==v&&T&&(O[":@"]=this.buildAttributesMap(v,n,u)),this.addChild(r,O,n),n=n.substr(0,n.lastIndexOf("."))}else{let O=new hb(u);this.tagsNodeStack.push(r),u!==v&&T&&(O[":@"]=this.buildAttributesMap(v,n,u)),this.addChild(r,O,n),r=O}i="",o=E}}else i+=t[o];return e.child};function Bme(t,e,r){let i=this.options.updateTag(e.tagname,r,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),t.addChild(e))}var Ome=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){let r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(let e in this.lastEntities){let r=this.lastEntities[e];t=t.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let r=this.htmlEntities[e];t=t.replace(r.regex,r.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function Dme(t,e,r,i){return t&&(i===void 0&&(i=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,i),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function Lme(t,e,r){let i="*."+r;for(let n in t){let o=t[n];if(i===o||e===o)return!0}return!1}function Fme(t,e,r=">"){let i,n="";for(let o=e;o<t.length;o++){let s=t[o];if(i)s===i&&(i="");else if(s==='"'||s==="'")i=s;else if(s===r[0])if(r[1]){if(t[o+1]===r[1])return{data:n,index:o}}else return{data:n,index:o};else s===" "&&(s=" ");n+=s}}function $m(t,e,r,i){let n=t.indexOf(e,r);if(n===-1)throw new Error(i);return n+e.length-1}function dD(t,e,r,i=">"){let n=Fme(t,e+1,i);if(!n)return;let o=n.data,s=n.index,l=o.search(/\s/),u=o,h=!0;l!==-1&&(u=o.substring(0,l),o=o.substring(l+1).trimStart());let v=u;if(r){let T=u.indexOf(":");T!==-1&&(u=u.substr(T+1),h=u!==n.data.substr(T+1))}return{tagName:u,tagExp:o,closeIndex:s,attrExpPresent:h,rawTagName:v}}function Nme(t,e,r){let i=r,n=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let o=$m(t,">",r,`${e} is not closed`);if(t.substring(r+2,o).trim()===e&&(n--,n===0))return{tagContent:t.substring(i,r),i:o};r=o}else if(t[r+1]==="?")r=$m(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=$m(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=$m(t,"]]>",r,"StopNode is not closed.")-2;else{let o=dD(t,r,">");o&&((o&&o.tagName)===e&&o.tagExp[o.tagExp.length-1]!=="/"&&n++,r=o.closeIndex)}}function pD(t,e,r){if(e&&typeof t=="string"){let i=t.trim();return i==="true"?!0:i==="false"?!1:Eme(t,r)}else return eG.isExist(t)?t:""}tG.exports=hD});var oG=Qt(nG=>{"use strict";function kme(t,e){return iG(t,e)}function iG(t,e,r){let i,n={};for(let o=0;o<t.length;o++){let s=t[o],l=Ume(s),u="";if(r===void 0?u=l:u=r+"."+l,l===e.textNodeName)i===void 0?i=s[l]:i+=""+s[l];else{if(l===void 0)continue;if(s[l]){let h=iG(s[l],e,u),v=Vme(h,e);s[":@"]?zme(h,s[":@"],u,e):Object.keys(h).length===1&&h[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?h=h[e.textNodeName]:Object.keys(h).length===0&&(e.alwaysCreateTextNode?h[e.textNodeName]="":h=""),n[l]!==void 0&&n.hasOwnProperty(l)?(Array.isArray(n[l])||(n[l]=[n[l]]),n[l].push(h)):e.isArray(l,u,v)?n[l]=[h]:n[l]=h}}}return typeof i=="string"?i.length>0&&(n[e.textNodeName]=i):i!==void 0&&(n[e.textNodeName]=i),n}function Ume(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=e[r];if(i!==":@")return i}}function zme(t,e,r,i){if(e){let n=Object.keys(e),o=n.length;for(let s=0;s<o;s++){let l=n[s];i.isArray(l,r+"."+l,!0,!0)?t[l]=[e[l]]:t[l]=e[l]}}}function Vme(t,e){let{textNodeName:r}=e,i=Object.keys(t).length;return!!(i===0||i===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}nG.prettify=kme});var aG=Qt((D$e,sG)=>{var{buildOptions:Hme}=X7(),jme=rG(),{prettify:Gme}=oG(),Wme=cD(),AD=class{constructor(e){this.externalEntities={},this.options=Hme(e)}parse(e,r){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let o=Wme.validate(e,r);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let i=new jme(this.options);i.addExternalEntities(this.externalEntities);let n=i.parseXml(e);return this.options.preserveOrder||n===void 0?n:Gme(n,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};sG.exports=AD});var hG=Qt((L$e,fG)=>{var qme=`
`;function Xme(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=qme),cG(t,e,"",r)}function cG(t,e,r,i){let n="",o=!1;for(let s=0;s<t.length;s++){let l=t[s],u=Yme(l);if(u===void 0)continue;let h="";if(r.length===0?h=u:h=`${r}.${u}`,u===e.textNodeName){let O=l[u];Kme(h,e)||(O=e.tagValueProcessor(u,O),O=uG(O,e)),o&&(n+=i),n+=O,o=!1;continue}else if(u===e.cdataPropName){o&&(n+=i),n+=`<![CDATA[${l[u][0][e.textNodeName]}]]>`,o=!1;continue}else if(u===e.commentPropName){n+=i+`<!--${l[u][0][e.textNodeName]}-->`,o=!0;continue}else if(u[0]==="?"){let O=lG(l[":@"],e),F=u==="?xml"?"":i,z=l[u][0][e.textNodeName];z=z.length!==0?" "+z:"",n+=F+`<${u}${z}${O}?>`,o=!0;continue}let v=i;v!==""&&(v+=e.indentBy);let T=lG(l[":@"],e),E=i+`<${u}${T}`,M=cG(l[u],e,h,v);e.unpairedTags.indexOf(u)!==-1?e.suppressUnpairedNode?n+=E+">":n+=E+"/>":(!M||M.length===0)&&e.suppressEmptyNode?n+=E+"/>":M&&M.endsWith(">")?n+=E+`>${M}${i}</${u}>`:(n+=E+">",M&&i!==""&&(M.includes("/>")||M.includes("</"))?n+=i+e.indentBy+M+i:n+=M,n+=`</${u}>`),o=!0}return n}function Yme(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=e[r];if(t.hasOwnProperty(i)&&i!==":@")return i}}function lG(t,e){let r="";if(t&&!e.ignoreAttributes)for(let i in t){if(!t.hasOwnProperty(i))continue;let n=e.attributeValueProcessor(i,t[i]);n=uG(n,e),n===!0&&e.suppressBooleanAttributes?r+=` ${i.substr(e.attributeNamePrefix.length)}`:r+=` ${i.substr(e.attributeNamePrefix.length)}="${n}"`}return r}function Kme(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let r=t.substr(t.lastIndexOf(".")+1);for(let i in e.stopNodes)if(e.stopNodes[i]===t||e.stopNodes[i]==="*."+r)return!0;return!1}function uG(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){let i=e.entities[r];t=t.replace(i.regex,i.val)}return t}fG.exports=Xme});var pG=Qt((F$e,dG)=>{"use strict";var Zme=hG(),Jme={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function $p(t){this.options=Object.assign({},Jme,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ege),this.processTextOrObjNode=Qme,this.options.format?(this.indentate=$me,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}$p.prototype.build=function(t){return this.options.preserveOrder?Zme(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};$p.prototype.j2x=function(t,e){let r="",i="";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n))if(typeof t[n]>"u")this.isAttribute(n)&&(i+="");else if(t[n]===null)this.isAttribute(n)?i+="":n[0]==="?"?i+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+n+"/"+this.tagEndChar;else if(t[n]instanceof Date)i+=this.buildTextValNode(t[n],n,"",e);else if(typeof t[n]!="object"){let o=this.isAttribute(n);if(o)r+=this.buildAttrPairStr(o,""+t[n]);else if(n===this.options.textNodeName){let s=this.options.tagValueProcessor(n,""+t[n]);i+=this.replaceEntitiesValue(s)}else i+=this.buildTextValNode(t[n],n,"",e)}else if(Array.isArray(t[n])){let o=t[n].length,s="";for(let l=0;l<o;l++){let u=t[n][l];typeof u>"u"||(u===null?n[0]==="?"?i+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+n+"/"+this.tagEndChar:typeof u=="object"?this.options.oneListGroup?s+=this.j2x(u,e+1).val:s+=this.processTextOrObjNode(u,n,e):s+=this.buildTextValNode(u,n,"",e))}this.options.oneListGroup&&(s=this.buildObjectNode(s,n,"",e)),i+=s}else if(this.options.attributesGroupName&&n===this.options.attributesGroupName){let o=Object.keys(t[n]),s=o.length;for(let l=0;l<s;l++)r+=this.buildAttrPairStr(o[l],""+t[n][o[l]])}else i+=this.processTextOrObjNode(t[n],n,e);return{attrStr:r,val:i}};$p.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function Qme(t,e,r){let i=this.j2x(t,r+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,i.attrStr,r):this.buildObjectNode(i.val,e,i.attrStr,r)}$p.prototype.buildObjectNode=function(t,e,r,i){if(t==="")return e[0]==="?"?this.indentate(i)+"<"+e+r+"?"+this.tagEndChar:this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,o="";return e[0]==="?"&&(o="?",n=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(i)+"<"+e+r+o+">"+t+n:this.options.commentPropName!==!1&&e===this.options.commentPropName&&o.length===0?this.indentate(i)+`<!--${t}-->`+this.newLine:this.indentate(i)+"<"+e+r+o+this.tagEndChar+t+this.indentate(i)+n}};$p.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};$p.prototype.buildTextValNode=function(t,e,r,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(i)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(i)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),n===""?this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+r+">"+n+"</"+e+this.tagEndChar}};$p.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function $me(t){return this.options.indentBy.repeat(t)}function ege(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}dG.exports=$p});var mG=Qt((N$e,AG)=>{"use strict";var tge=cD(),rge=aG(),ige=pG();AG.exports={XMLParser:rge,XMLValidator:tge,XMLBuilder:ige}});var ED=Qt((CG,gb)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof P6=="function"&&typeof gb=="object"&&gb&&gb.exports?gb.exports=e():(t.dcodeIO=t.dcodeIO||{}).Long=e()})(CG,function(){"use strict";function t($,Z,we){this.low=$|0,this.high=Z|0,this.unsigned=!!we}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function e($){return($&&$.__isLong__)===!0}t.isLong=e;var r={},i={};function n($,Z){var we,Oe,he;return Z?($>>>=0,(he=0<=$&&$<256)&&(Oe=i[$],Oe)?Oe:(we=s($,($|0)<0?-1:0,!0),he&&(i[$]=we),we)):($|=0,(he=-128<=$&&$<128)&&(Oe=r[$],Oe)?Oe:(we=s($,$<0?-1:0,!1),he&&(r[$]=we),we))}t.fromInt=n;function o($,Z){if(isNaN($)||!isFinite($))return Z?W:z;if(Z){if($<0)return W;if($>=M)return j}else{if($<=-O)return me;if($+1>=O)return ge}return $<0?o(-$,Z).neg():s($%E|0,$/E|0,Z)}t.fromNumber=o;function s($,Z,we){return new t($,Z,we)}t.fromBits=s;var l=Math.pow;function u($,Z,we){if($.length===0)throw Error("empty string");if($==="NaN"||$==="Infinity"||$==="+Infinity"||$==="-Infinity")return z;if(typeof Z=="number"?(we=Z,Z=!1):Z=!!Z,we=we||10,we<2||36<we)throw RangeError("radix");var Oe;if((Oe=$.indexOf("-"))>0)throw Error("interior hyphen");if(Oe===0)return u($.substring(1),Z,we).neg();for(var he=o(l(we,8)),Le=z,ft=0;ft<$.length;ft+=8){var Vt=Math.min(8,$.length-ft),Yt=parseInt($.substring(ft,ft+Vt),we);if(Vt<8){var mr=o(l(we,Vt));Le=Le.mul(mr).add(o(Yt))}else Le=Le.mul(he),Le=Le.add(o(Yt))}return Le.unsigned=Z,Le}t.fromString=u;function h($){return $ instanceof t?$:typeof $=="number"?o($):typeof $=="string"?u($):s($.low,$.high,$.unsigned)}t.fromValue=h;var v=1<<16,T=1<<24,E=v*v,M=E*E,O=M/2,F=n(T),z=n(0);t.ZERO=z;var W=n(0,!0);t.UZERO=W;var J=n(1);t.ONE=J;var K=n(1,!0);t.UONE=K;var ne=n(-1);t.NEG_ONE=ne;var ge=s(-1,2147483647,!1);t.MAX_VALUE=ge;var j=s(-1,-1,!0);t.MAX_UNSIGNED_VALUE=j;var me=s(0,-2147483648,!1);t.MIN_VALUE=me;var fe=t.prototype;return fe.toInt=function(){return this.unsigned?this.low>>>0:this.low},fe.toNumber=function(){return this.unsigned?(this.high>>>0)*E+(this.low>>>0):this.high*E+(this.low>>>0)},fe.toString=function(Z){if(Z=Z||10,Z<2||36<Z)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(me)){var we=o(Z),Oe=this.div(we),he=Oe.mul(we).sub(this);return Oe.toString(Z)+he.toInt().toString(Z)}else return"-"+this.neg().toString(Z);for(var Le=o(l(Z,6),this.unsigned),ft=this,Vt="";;){var Yt=ft.div(Le),mr=ft.sub(Yt.mul(Le)).toInt()>>>0,Er=mr.toString(Z);if(ft=Yt,ft.isZero())return Er+Vt;for(;Er.length<6;)Er="0"+Er;Vt=""+Er+Vt}},fe.getHighBits=function(){return this.high},fe.getHighBitsUnsigned=function(){return this.high>>>0},fe.getLowBits=function(){return this.low},fe.getLowBitsUnsigned=function(){return this.low>>>0},fe.getNumBitsAbs=function(){if(this.isNegative())return this.eq(me)?64:this.neg().getNumBitsAbs();for(var Z=this.high!=0?this.high:this.low,we=31;we>0&&!(Z&1<<we);we--);return this.high!=0?we+33:we+1},fe.isZero=function(){return this.high===0&&this.low===0},fe.isNegative=function(){return!this.unsigned&&this.high<0},fe.isPositive=function(){return this.unsigned||this.high>=0},fe.isOdd=function(){return(this.low&1)===1},fe.isEven=function(){return(this.low&1)===0},fe.equals=function(Z){return e(Z)||(Z=h(Z)),this.unsigned!==Z.unsigned&&this.high>>>31===1&&Z.high>>>31===1?!1:this.high===Z.high&&this.low===Z.low},fe.eq=fe.equals,fe.notEquals=function(Z){return!this.eq(Z)},fe.neq=fe.notEquals,fe.lessThan=function(Z){return this.comp(Z)<0},fe.lt=fe.lessThan,fe.lessThanOrEqual=function(Z){return this.comp(Z)<=0},fe.lte=fe.lessThanOrEqual,fe.greaterThan=function(Z){return this.comp(Z)>0},fe.gt=fe.greaterThan,fe.greaterThanOrEqual=function(Z){return this.comp(Z)>=0},fe.gte=fe.greaterThanOrEqual,fe.compare=function(Z){if(e(Z)||(Z=h(Z)),this.eq(Z))return 0;var we=this.isNegative(),Oe=Z.isNegative();return we&&!Oe?-1:!we&&Oe?1:this.unsigned?Z.high>>>0>this.high>>>0||Z.high===this.high&&Z.low>>>0>this.low>>>0?-1:1:this.sub(Z).isNegative()?-1:1},fe.comp=fe.compare,fe.negate=function(){return!this.unsigned&&this.eq(me)?me:this.not().add(J)},fe.neg=fe.negate,fe.add=function(Z){e(Z)||(Z=h(Z));var we=this.high>>>16,Oe=this.high&65535,he=this.low>>>16,Le=this.low&65535,ft=Z.high>>>16,Vt=Z.high&65535,Yt=Z.low>>>16,mr=Z.low&65535,Er=0,Jr=0,or=0,ai=0;return ai+=Le+mr,or+=ai>>>16,ai&=65535,or+=he+Yt,Jr+=or>>>16,or&=65535,Jr+=Oe+Vt,Er+=Jr>>>16,Jr&=65535,Er+=we+ft,Er&=65535,s(or<<16|ai,Er<<16|Jr,this.unsigned)},fe.subtract=function(Z){return e(Z)||(Z=h(Z)),this.add(Z.neg())},fe.sub=fe.subtract,fe.multiply=function(Z){if(this.isZero()||(e(Z)||(Z=h(Z)),Z.isZero()))return z;if(this.eq(me))return Z.isOdd()?me:z;if(Z.eq(me))return this.isOdd()?me:z;if(this.isNegative())return Z.isNegative()?this.neg().mul(Z.neg()):this.neg().mul(Z).neg();if(Z.isNegative())return this.mul(Z.neg()).neg();if(this.lt(F)&&Z.lt(F))return o(this.toNumber()*Z.toNumber(),this.unsigned);var we=this.high>>>16,Oe=this.high&65535,he=this.low>>>16,Le=this.low&65535,ft=Z.high>>>16,Vt=Z.high&65535,Yt=Z.low>>>16,mr=Z.low&65535,Er=0,Jr=0,or=0,ai=0;return ai+=Le*mr,or+=ai>>>16,ai&=65535,or+=he*mr,Jr+=or>>>16,or&=65535,or+=Le*Yt,Jr+=or>>>16,or&=65535,Jr+=Oe*mr,Er+=Jr>>>16,Jr&=65535,Jr+=he*Yt,Er+=Jr>>>16,Jr&=65535,Jr+=Le*Vt,Er+=Jr>>>16,Jr&=65535,Er+=we*mr+Oe*Yt+he*Vt+Le*ft,Er&=65535,s(or<<16|ai,Er<<16|Jr,this.unsigned)},fe.mul=fe.multiply,fe.divide=function(Z){if(e(Z)||(Z=h(Z)),Z.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?W:z;var we,Oe,he;if(this.unsigned){if(Z.unsigned||(Z=Z.toUnsigned()),Z.gt(this))return W;if(Z.gt(this.shru(1)))return K;he=W}else{if(this.eq(me)){if(Z.eq(J)||Z.eq(ne))return me;if(Z.eq(me))return J;var Le=this.shr(1);return we=Le.div(Z).shl(1),we.eq(z)?Z.isNegative()?J:ne:(Oe=this.sub(Z.mul(we)),he=we.add(Oe.div(Z)),he)}else if(Z.eq(me))return this.unsigned?W:z;if(this.isNegative())return Z.isNegative()?this.neg().div(Z.neg()):this.neg().div(Z).neg();if(Z.isNegative())return this.div(Z.neg()).neg();he=z}for(Oe=this;Oe.gte(Z);){we=Math.max(1,Math.floor(Oe.toNumber()/Z.toNumber()));for(var ft=Math.ceil(Math.log(we)/Math.LN2),Vt=ft<=48?1:l(2,ft-48),Yt=o(we),mr=Yt.mul(Z);mr.isNegative()||mr.gt(Oe);)we-=Vt,Yt=o(we,this.unsigned),mr=Yt.mul(Z);Yt.isZero()&&(Yt=J),he=he.add(Yt),Oe=Oe.sub(mr)}return he},fe.div=fe.divide,fe.modulo=function(Z){return e(Z)||(Z=h(Z)),this.sub(this.div(Z).mul(Z))},fe.mod=fe.modulo,fe.not=function(){return s(~this.low,~this.high,this.unsigned)},fe.and=function(Z){return e(Z)||(Z=h(Z)),s(this.low&Z.low,this.high&Z.high,this.unsigned)},fe.or=function(Z){return e(Z)||(Z=h(Z)),s(this.low|Z.low,this.high|Z.high,this.unsigned)},fe.xor=function(Z){return e(Z)||(Z=h(Z)),s(this.low^Z.low,this.high^Z.high,this.unsigned)},fe.shiftLeft=function(Z){return e(Z)&&(Z=Z.toInt()),(Z&=63)===0?this:Z<32?s(this.low<<Z,this.high<<Z|this.low>>>32-Z,this.unsigned):s(0,this.low<<Z-32,this.unsigned)},fe.shl=fe.shiftLeft,fe.shiftRight=function(Z){return e(Z)&&(Z=Z.toInt()),(Z&=63)===0?this:Z<32?s(this.low>>>Z|this.high<<32-Z,this.high>>Z,this.unsigned):s(this.high>>Z-32,this.high>=0?0:-1,this.unsigned)},fe.shr=fe.shiftRight,fe.shiftRightUnsigned=function(Z){if(e(Z)&&(Z=Z.toInt()),Z&=63,Z===0)return this;var we=this.high;if(Z<32){var Oe=this.low;return s(Oe>>>Z|we<<32-Z,we>>>Z,this.unsigned)}else return Z===32?s(we,0,this.unsigned):s(we>>>Z-32,0,this.unsigned)},fe.shru=fe.shiftRightUnsigned,fe.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},fe.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},fe.toBytes=function($){return $?this.toBytesLE():this.toBytesBE()},fe.toBytesLE=function(){var $=this.high,Z=this.low;return[Z&255,Z>>>8&255,Z>>>16&255,Z>>>24&255,$&255,$>>>8&255,$>>>16&255,$>>>24&255]},fe.toBytesBE=function(){var $=this.high,Z=this.low;return[$>>>24&255,$>>>16&255,$>>>8&255,$&255,Z>>>24&255,Z>>>16&255,Z>>>8&255,Z&255]},t})});var cY=Qt(dF=>{dF.read=function(t,e,r,i,n){var o,s,l=n*8-i-1,u=(1<<l)-1,h=u>>1,v=-7,T=r?n-1:0,E=r?-1:1,M=t[e+T];for(T+=E,o=M&(1<<-v)-1,M>>=-v,v+=l;v>0;o=o*256+t[e+T],T+=E,v-=8);for(s=o&(1<<-v)-1,o>>=-v,v+=i;v>0;s=s*256+t[e+T],T+=E,v-=8);if(o===0)o=1-h;else{if(o===u)return s?NaN:(M?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-h}return(M?-1:1)*s*Math.pow(2,o-i)};dF.write=function(t,e,r,i,n,o){var s,l,u,h=o*8-n-1,v=(1<<h)-1,T=v>>1,E=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=i?0:o-1,O=i?1:-1,F=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,s=v):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+T>=1?e+=E/u:e+=E*Math.pow(2,1-T),e*u>=2&&(s++,u/=2),s+T>=v?(l=0,s=v):s+T>=1?(l=(e*u-1)*Math.pow(2,n),s=s+T):(l=e*Math.pow(2,T-1)*Math.pow(2,n),s=0));n>=8;t[r+M]=l&255,M+=O,l/=256,n-=8);for(s=s<<n|l,h+=n;h>0;t[r+M]=s&255,M+=O,s/=256,h-=8);t[r+M-O]|=F*128}});var AY=Qt((qft,pY)=>{"use strict";pY.exports=_o;var fM=cY();function _o(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}_o.Varint=0;_o.Fixed64=1;_o.Bytes=2;_o.Fixed32=5;var pF=(1<<16)*(1<<16),uY=1/pF,abe=12,dY=typeof TextDecoder>"u"?null:new TextDecoder("utf8");_o.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var i=this.readVarint(),n=i>>3,o=this.pos;this.type=i&7,t(n,e,this),this.pos===o&&this.skip(i)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=hM(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=hY(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=hM(this.buf,this.pos)+hM(this.buf,this.pos+4)*pF;return this.pos+=8,t},readSFixed64:function(){var t=hM(this.buf,this.pos)+hY(this.buf,this.pos+4)*pF;return this.pos+=8,t},readFloat:function(){var t=fM.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=fM.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,i;return i=e[this.pos++],r=i&127,i<128||(i=e[this.pos++],r|=(i&127)<<7,i<128)||(i=e[this.pos++],r|=(i&127)<<14,i<128)||(i=e[this.pos++],r|=(i&127)<<21,i<128)?r:(i=e[this.pos],r|=(i&15)<<28,lbe(r,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 Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=abe&&dY?bbe(this.buf,e,t):xbe(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!==_o.Bytes)return t.push(this.readVarint(e));var r=qd(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==_o.Bytes)return t.push(this.readSVarint());var e=qd(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==_o.Bytes)return t.push(this.readBoolean());var e=qd(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==_o.Bytes)return t.push(this.readFloat());var e=qd(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==_o.Bytes)return t.push(this.readDouble());var e=qd(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==_o.Bytes)return t.push(this.readFixed32());var e=qd(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==_o.Bytes)return t.push(this.readSFixed32());var e=qd(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==_o.Bytes)return t.push(this.readFixed64());var e=qd(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==_o.Bytes)return t.push(this.readSFixed64());var e=qd(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===_o.Varint)for(;this.buf[this.pos++]>127;);else if(e===_o.Bytes)this.pos=this.readVarint()+this.pos;else if(e===_o.Fixed32)this.pos+=4;else if(e===_o.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),cy(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),cy(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),cy(this.buf,t&-1,this.pos),cy(this.buf,Math.floor(t*uY),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),cy(this.buf,t&-1,this.pos),cy(this.buf,Math.floor(t*uY),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){cbe(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=wbe(this.buf,t,this.pos);var r=this.pos-e;r>=128&&fY(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),fM.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),fM.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 r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var i=this.pos-r;i>=128&&fY(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,e,r){this.writeTag(t,_o.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,hbe,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,dbe,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,mbe,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,pbe,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Abe,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,gbe,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,_be,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,ybe,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,vbe,e)},writeBytesField:function(t,e){this.writeTag(t,_o.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,_o.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,_o.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,_o.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,_o.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,_o.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,_o.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,_o.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,_o.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,_o.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function lbe(t,e,r){var i=r.buf,n,o;if(o=i[r.pos++],n=(o&112)>>4,o<128||(o=i[r.pos++],n|=(o&127)<<3,o<128)||(o=i[r.pos++],n|=(o&127)<<10,o<128)||(o=i[r.pos++],n|=(o&127)<<17,o<128)||(o=i[r.pos++],n|=(o&127)<<24,o<128)||(o=i[r.pos++],n|=(o&1)<<31,o<128))return ly(t,n,e);throw new Error("Expected varint not more than 10 bytes")}function qd(t){return t.type===_o.Bytes?t.readVarint()+t.pos:t.pos+1}function ly(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function cbe(t,e){var r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),ube(r,i,e),fbe(i,e)}function ube(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function fbe(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function fY(t,e,r){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i);for(var n=r.pos-1;n>=t;n--)r.buf[n+i]=r.buf[n]}function hbe(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function dbe(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function pbe(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Abe(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function mbe(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function gbe(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function _be(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function ybe(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function vbe(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function hM(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function cy(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function hY(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function xbe(t,e,r){for(var i="",n=e;n<r;){var o=t[n],s=null,l=o>239?4:o>223?3:o>191?2:1;if(n+l>r)break;var u,h,v;l===1?o<128&&(s=o):l===2?(u=t[n+1],(u&192)===128&&(s=(o&31)<<6|u&63,s<=127&&(s=null))):l===3?(u=t[n+1],h=t[n+2],(u&192)===128&&(h&192)===128&&(s=(o&15)<<12|(u&63)<<6|h&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):l===4&&(u=t[n+1],h=t[n+2],v=t[n+3],(u&192)===128&&(h&192)===128&&(v&192)===128&&(s=(o&15)<<18|(u&63)<<12|(h&63)<<6|v&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,l=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=l}return i}function bbe(t,e,r){return dY.decode(t.subarray(e,r))}function wbe(t,e,r){for(var i=0,n,o;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(o)if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,o=n;continue}else n=o-55296<<10|n-56320|65536,o=null;else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):o=n;continue}else o&&(t[r++]=239,t[r++]=191,t[r++]=189,o=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}});var EF=Qt((Xb,bM)=>{(function(t){"use strict";var e="Compound",r="Identifier",i="MemberExpression",n="Literal",o="ThisExpression",s="CallExpression",l="UnaryExpression",u="BinaryExpression",h="LogicalExpression",v="ConditionalExpression",T="ArrayExpression",E=46,M=44,O=39,F=34,z=40,W=41,J=91,K=93,ne=63,ge=59,j=58,me=function(Jt,qt){var wi=new Error(Jt+" at character "+qt);throw wi.index=qt,wi.description=Jt,wi},fe=!0,$={"-":fe,"!":fe,"~":fe,"+":fe},Z={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},we=function(Jt){var qt=0,wi;for(var ae in Jt)(wi=ae.length)>qt&&Jt.hasOwnProperty(ae)&&(qt=wi);return qt},Oe=we($),he=we(Z),Le={true:!0,false:!1,null:null},ft="this",Vt=function(Jt){return Z[Jt]||0},Yt=function(Jt,qt,wi){var ae=Jt==="||"||Jt==="&&"?h:u;return{type:ae,operator:Jt,left:qt,right:wi}},mr=function(Jt){return Jt>=48&&Jt<=57},Er=function(Jt){return Jt===36||Jt===95||Jt>=65&&Jt<=90||Jt>=97&&Jt<=122||Jt>=128&&!Z[String.fromCharCode(Jt)]},Jr=function(Jt){return Jt===36||Jt===95||Jt>=65&&Jt<=90||Jt>=97&&Jt<=122||Jt>=48&&Jt<=57||Jt>=128&&!Z[String.fromCharCode(Jt)]},or=function(Jt){for(var qt=0,wi=Jt.charAt,ae=Jt.charCodeAt,be=function(dr){return wi.call(Jt,dr)},je=function(dr){return ae.call(Jt,dr)},lt=Jt.length,Ft=function(){for(var dr=je(qt);dr===32||dr===9||dr===10||dr===13;)dr=je(++qt)},wt=function(){var dr=xi(),Ur,ci;if(Ft(),je(qt)===ne){if(qt++,Ur=wt(),Ur||me("Expected expression",qt),Ft(),je(qt)===j)return qt++,ci=wt(),ci||me("Expected expression",qt),{type:v,test:dr,consequent:Ur,alternate:ci};me("Expected :",qt)}else return dr},$r=function(){Ft();for(var dr,Ur=Jt.substr(qt,he),ci=Ur.length;ci>0;){if(Z.hasOwnProperty(Ur)&&(!Er(je(qt))||qt+Ur.length<Jt.length&&!Jr(je(qt+Ur.length))))return qt+=ci,Ur;Ur=Ur.substr(0,--ci)}return!1},xi=function(){var dr,Ur,ci,to,Dn,To,Eo,Xo,So,Us;if(Eo=Ki(),ci=$r(),!ci)return Eo;for(To={value:ci,prec:Vt(ci)},Xo=Ki(),Xo||me("Expected expression after "+ci,qt),Dn=[Eo,To,Xo];(ci=$r())&&(to=Vt(ci),to!==0);){for(To={value:ci,prec:to},Us=ci;Dn.length>2&&to<=Dn[Dn.length-2].prec;)Xo=Dn.pop(),ci=Dn.pop().value,Eo=Dn.pop(),Ur=Yt(ci,Eo,Xo),Dn.push(Ur);Ur=Ki(),Ur||me("Expected expression after "+Us,qt),Dn.push(To,Ur)}for(So=Dn.length-1,Ur=Dn[So];So>1;)Ur=Yt(Dn[So-1].value,Dn[So-2],Ur),So-=2;return Ur},Ki=function(){var dr,Ur,ci;if(Ft(),dr=je(qt),mr(dr)||dr===E)return kn();if(dr===O||dr===F)return Zi();if(dr===J)return Bi();for(Ur=Jt.substr(qt,Oe),ci=Ur.length;ci>0;){if($.hasOwnProperty(Ur)&&(!Er(je(qt))||qt+Ur.length<Jt.length&&!Jr(je(qt+Ur.length))))return qt+=ci,{type:l,operator:Ur,argument:Ki(),prefix:!0};Ur=Ur.substr(0,--ci)}return Er(dr)||dr===z?No():!1},kn=function(){for(var dr="",Ur,ci;mr(je(qt));)dr+=be(qt++);if(je(qt)===E)for(dr+=be(qt++);mr(je(qt));)dr+=be(qt++);if(Ur=be(qt),Ur==="e"||Ur==="E"){for(dr+=be(qt++),Ur=be(qt),(Ur==="+"||Ur==="-")&&(dr+=be(qt++));mr(je(qt));)dr+=be(qt++);mr(je(qt-1))||me("Expected exponent ("+dr+be(qt)+")",qt)}return ci=je(qt),Er(ci)?me("Variable names cannot start with a number ("+dr+be(qt)+")",qt):ci===E&&me("Unexpected period",qt),{type:n,value:parseFloat(dr),raw:dr}},Zi=function(){for(var dr="",Ur=be(qt++),ci=!1,to;qt<lt;)if(to=be(qt++),to===Ur){ci=!0;break}else if(to==="\\")switch(to=be(qt++),to){case"n":dr+=`
`;break;case"r":dr+="\r";break;case"t":dr+=" ";break;case"b":dr+="\b";break;case"f":dr+="\f";break;case"v":dr+="\v";break;default:dr+=to}else dr+=to;return ci||me('Unclosed quote after "'+dr+'"',qt),{type:n,value:dr,raw:Ur+dr+Ur}},Hi=function(){var dr=je(qt),Ur=qt,ci;for(Er(dr)?qt++:me("Unexpected "+be(qt),qt);qt<lt&&(dr=je(qt),Jr(dr));)qt++;return ci=Jt.slice(Ur,qt),Le.hasOwnProperty(ci)?{type:n,value:Le[ci],raw:ci}:ci===ft?{type:o}:{type:r,name:ci}},Un=function(dr){for(var Ur,ci=[],to,Dn=!1,To=0;qt<lt;)if(Ft(),Ur=je(qt),Ur===dr){Dn=!0,qt++,dr===W&&To&&To>=ci.length&&me("Unexpected token "+String.fromCharCode(dr),qt);break}else if(Ur===M){if(qt++,To++,To!==ci.length){if(dr===W)me("Unexpected token ,",qt);else if(dr===K)for(var Eo=ci.length;Eo<To;Eo++)ci.push(null)}}else to=wt(),(!to||to.type===e)&&me("Expected comma",qt),ci.push(to);return Dn||me("Expected "+String.fromCharCode(dr),qt),ci},No=function(){var dr,Ur;for(dr=je(qt),dr===z?Ur=Ji():Ur=Hi(),Ft(),dr=je(qt);dr===E||dr===J||dr===z;)qt++,dr===E?(Ft(),Ur={type:i,computed:!1,object:Ur,property:Hi()}):dr===J?(Ur={type:i,computed:!0,object:Ur,property:wt()},Ft(),dr=je(qt),dr!==K&&me("Unclosed [",qt),qt++):dr===z&&(Ur={type:s,arguments:Un(W),callee:Ur}),Ft(),dr=je(qt);return Ur},Ji=function(){qt++;var dr=wt();if(Ft(),je(qt)===W)return qt++,dr;me("Unclosed (",qt)},Bi=function(){return qt++,{type:T,elements:Un(K)}},yn=[],po,kr;qt<lt;)po=je(qt),po===ge||po===M?qt++:(kr=wt())?yn.push(kr):qt<lt&&me('Unexpected "'+be(qt)+'"',qt);return yn.length===1?yn[0]:{type:e,body:yn}};if(or.version="0.3.5",or.toString=function(){return"JavaScript Expression Parser (JSEP) v"+or.version},or.addUnaryOp=function(Jt){return Oe=Math.max(Jt.length,Oe),$[Jt]=fe,this},or.addBinaryOp=function(Jt,qt){return he=Math.max(Jt.length,he),Z[Jt]=qt,this},or.addLiteral=function(Jt,qt){return Le[Jt]=qt,this},or.removeUnaryOp=function(Jt){return delete $[Jt],Jt.length===Oe&&(Oe=we($)),this},or.removeAllUnaryOps=function(){return $={},Oe=0,this},or.removeBinaryOp=function(Jt){return delete Z[Jt],Jt.length===he&&(he=we(Z)),this},or.removeAllBinaryOps=function(){return Z={},he=0,this},or.removeLiteral=function(Jt){return delete Le[Jt],this},or.removeAllLiterals=function(){return Le={},this},typeof Xb>"u"){var ai=t.jsep;t.jsep=or,or.noConflict=function(){return t.jsep===or&&(t.jsep=ai),or}}else typeof bM<"u"&&bM.exports?Xb=bM.exports=or:Xb.parse=or})(Xb)});var QY=Qt(MM=>{"use strict";MM.byteLength=Bwe;MM.toByteArray=Dwe;MM.fromByteArray=Nwe;var Vh=[],Ku=[],Rwe=typeof Uint8Array<"u"?Uint8Array:Array,LF="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tg=0,ZY=LF.length;Tg<ZY;++Tg)Vh[Tg]=LF[Tg],Ku[LF.charCodeAt(Tg)]=Tg;var Tg,ZY;Ku["-".charCodeAt(0)]=62;Ku["_".charCodeAt(0)]=63;function JY(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function Bwe(t){var e=JY(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Owe(t,e,r){return(e+r)*3/4-r}function Dwe(t){var e,r=JY(t),i=r[0],n=r[1],o=new Rwe(Owe(t,i,n)),s=0,l=n>0?i-4:i,u;for(u=0;u<l;u+=4)e=Ku[t.charCodeAt(u)]<<18|Ku[t.charCodeAt(u+1)]<<12|Ku[t.charCodeAt(u+2)]<<6|Ku[t.charCodeAt(u+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return n===2&&(e=Ku[t.charCodeAt(u)]<<2|Ku[t.charCodeAt(u+1)]>>4,o[s++]=e&255),n===1&&(e=Ku[t.charCodeAt(u)]<<10|Ku[t.charCodeAt(u+1)]<<4|Ku[t.charCodeAt(u+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Lwe(t){return Vh[t>>18&63]+Vh[t>>12&63]+Vh[t>>6&63]+Vh[t&63]}function Fwe(t,e,r){for(var i,n=[],o=e;o<r;o+=3)i=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),n.push(Lwe(i));return n.join("")}function Nwe(t){for(var e,r=t.length,i=r%3,n=[],o=16383,s=0,l=r-i;s<l;s+=o)n.push(Fwe(t,s,s+o>l?l:s+o));return i===1?(e=t[r-1],n.push(Vh[e>>2]+Vh[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(Vh[e>>10]+Vh[e>>4&63]+Vh[e<<2&63]+"=")),n.join("")}});var gy=Qt((IM,$Y)=>{(function(t,e){typeof IM=="object"&&typeof $Y<"u"?e(IM):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.lumino_coreutils={}))})(IM,function(t){"use strict";t.JSONExt=void 0,function(s){s.emptyObject=Object.freeze({}),s.emptyArray=Object.freeze([]);function l(z){return z===null||typeof z=="boolean"||typeof z=="number"||typeof z=="string"}s.isPrimitive=l;function u(z){return Array.isArray(z)}s.isArray=u;function h(z){return!l(z)&&!u(z)}s.isObject=h;function v(z,W){if(z===W)return!0;if(l(z)||l(W))return!1;var J=u(z),K=u(W);return J!==K?!1:J&&K?E(z,W):M(z,W)}s.deepEqual=v;function T(z){return l(z)?z:u(z)?O(z):F(z)}s.deepCopy=T;function E(z,W){if(z===W)return!0;if(z.length!==W.length)return!1;for(var J=0,K=z.length;J<K;++J)if(!v(z[J],W[J]))return!1;return!0}function M(z,W){if(z===W)return!0;for(var J in z)if(z[J]!==void 0&&!(J in W))return!1;for(var J in W)if(W[J]!==void 0&&!(J in z))return!1;for(var J in z){var K=z[J],ne=W[J];if(!(K===void 0&&ne===void 0)&&(K===void 0||ne===void 0||!v(K,ne)))return!1}return!0}function O(z){for(var W=new Array(z.length),J=0,K=z.length;J<K;++J)W[J]=T(z[J]);return W}function F(z){var W={};for(var J in z){var K=z[J];K!==void 0&&(W[J]=T(K))}return W}}(t.JSONExt||(t.JSONExt={}));var e=function(){function s(){this._types=[],this._values=[]}return s.prototype.types=function(){return this._types.slice()},s.prototype.hasData=function(l){return this._types.indexOf(l)!==-1},s.prototype.getData=function(l){var u=this._types.indexOf(l);return u!==-1?this._values[u]:void 0},s.prototype.setData=function(l,u){this.clearData(l),this._types.push(l),this._values.push(u)},s.prototype.clearData=function(l){var u=this._types.indexOf(l);u!==-1&&(this._types.splice(u,1),this._values.splice(u,1))},s.prototype.clear=function(){this._types.length=0,this._values.length=0},s}(),r=function(){function s(){var l=this;this.promise=new Promise(function(u,h){l._resolve=u,l._reject=h})}return s.prototype.resolve=function(l){var u=this._resolve;u(l)},s.prototype.reject=function(l){var u=this._reject;u(l)},s}(),i=function(){function s(l){this.name=l,this._tokenStructuralPropertyT=null}return s}();function n(s){for(var l=0,u=0,h=s.length;u<h;++u)u%4===0&&(l=Math.random()*4294967295>>>0),s[u]=l&255,l>>>=8}t.Random=void 0,function(s){s.getRandomValues=function(){var l=typeof window<"u"&&(window.crypto||window.msCrypto)||null;return l&&typeof l.getRandomValues=="function"?function(h){return l.getRandomValues(h)}:n}()}(t.Random||(t.Random={}));function o(s){for(var l=new Uint8Array(16),u=new Array(256),h=0;h<16;++h)u[h]="0"+h.toString(16);for(var h=16;h<256;++h)u[h]=h.toString(16);return function(){return s(l),l[6]=64|l[6]&15,l[8]=128|l[8]&63,u[l[0]]+u[l[1]]+u[l[2]]+u[l[3]]+"-"+u[l[4]]+u[l[5]]+"-"+u[l[6]]+u[l[7]]+"-"+u[l[8]]+u[l[9]]+"-"+u[l[10]]+u[l[11]]+u[l[12]]+u[l[13]]+u[l[14]]+u[l[15]]}}t.UUID=void 0,function(s){s.uuid4=o(t.Random.getRandomValues)}(t.UUID||(t.UUID={})),t.MimeData=e,t.PromiseDelegate=r,t.Token=i,Object.defineProperty(t,"__esModule",{value:!0})})});var tK=Qt((fpt,eK)=>{function kwe(){this.__data__=[],this.size=0}eK.exports=kwe});var FF=Qt((hpt,rK)=>{function Uwe(t,e){return t===e||t!==t&&e!==e}rK.exports=Uwe});var Zb=Qt((dpt,iK)=>{var zwe=FF();function Vwe(t,e){for(var r=t.length;r--;)if(zwe(t[r][0],e))return r;return-1}iK.exports=Vwe});var oK=Qt((ppt,nK)=>{var Hwe=Zb(),jwe=Array.prototype,Gwe=jwe.splice;function Wwe(t){var e=this.__data__,r=Hwe(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():Gwe.call(e,r,1),--this.size,!0}nK.exports=Wwe});var aK=Qt((Apt,sK)=>{var qwe=Zb();function Xwe(t){var e=this.__data__,r=qwe(e,t);return r<0?void 0:e[r][1]}sK.exports=Xwe});var cK=Qt((mpt,lK)=>{var Ywe=Zb();function Kwe(t){return Ywe(this.__data__,t)>-1}lK.exports=Kwe});var fK=Qt((gpt,uK)=>{var Zwe=Zb();function Jwe(t,e){var r=this.__data__,i=Zwe(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}uK.exports=Jwe});var Jb=Qt((_pt,hK)=>{var Qwe=tK(),$we=oK(),e2e=aK(),t2e=cK(),r2e=fK();function _y(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}_y.prototype.clear=Qwe;_y.prototype.delete=$we;_y.prototype.get=e2e;_y.prototype.has=t2e;_y.prototype.set=r2e;hK.exports=_y});var pK=Qt((ypt,dK)=>{var i2e=Jb();function n2e(){this.__data__=new i2e,this.size=0}dK.exports=n2e});var mK=Qt((vpt,AK)=>{function o2e(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}AK.exports=o2e});var _K=Qt((xpt,gK)=>{function s2e(t){return this.__data__.get(t)}gK.exports=s2e});var vK=Qt((bpt,yK)=>{function a2e(t){return this.__data__.has(t)}yK.exports=a2e});var NF=Qt((wpt,xK)=>{var l2e=typeof global=="object"&&global&&global.Object===Object&&global;xK.exports=l2e});var Hh=Qt((Tpt,bK)=>{var c2e=NF(),u2e=typeof self=="object"&&self&&self.Object===Object&&self,f2e=c2e||u2e||Function("return this")();bK.exports=f2e});var PM=Qt((Ept,wK)=>{var h2e=Hh(),d2e=h2e.Symbol;wK.exports=d2e});var CK=Qt((Spt,SK)=>{var TK=PM(),EK=Object.prototype,p2e=EK.hasOwnProperty,A2e=EK.toString,Qb=TK?TK.toStringTag:void 0;function m2e(t){var e=p2e.call(t,Qb),r=t[Qb];try{t[Qb]=void 0;var i=!0}catch{}var n=A2e.call(t);return i&&(e?t[Qb]=r:delete t[Qb]),n}SK.exports=m2e});var IK=Qt((Cpt,MK)=>{var g2e=Object.prototype,_2e=g2e.toString;function y2e(t){return _2e.call(t)}MK.exports=y2e});var yy=Qt((Mpt,BK)=>{var PK=PM(),v2e=CK(),x2e=IK(),b2e="[object Null]",w2e="[object Undefined]",RK=PK?PK.toStringTag:void 0;function T2e(t){return t==null?t===void 0?w2e:b2e:RK&&RK in Object(t)?v2e(t):x2e(t)}BK.exports=T2e});var kF=Qt((Ipt,OK)=>{function E2e(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}OK.exports=E2e});var UF=Qt((Ppt,DK)=>{var S2e=yy(),C2e=kF(),M2e="[object AsyncFunction]",I2e="[object Function]",P2e="[object GeneratorFunction]",R2e="[object Proxy]";function B2e(t){if(!C2e(t))return!1;var e=S2e(t);return e==I2e||e==P2e||e==M2e||e==R2e}DK.exports=B2e});var FK=Qt((Rpt,LK)=>{var O2e=Hh(),D2e=O2e["__core-js_shared__"];LK.exports=D2e});var UK=Qt((Bpt,kK)=>{var zF=FK(),NK=function(){var t=/[^.]+$/.exec(zF&&zF.keys&&zF.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function L2e(t){return!!NK&&NK in t}kK.exports=L2e});var VF=Qt((Opt,zK)=>{var F2e=Function.prototype,N2e=F2e.toString;function k2e(t){if(t!=null){try{return N2e.call(t)}catch{}try{return t+""}catch{}}return""}zK.exports=k2e});var HK=Qt((Dpt,VK)=>{var U2e=UF(),z2e=UK(),V2e=kF(),H2e=VF(),j2e=/[\\^$.*+?()[\]{}|]/g,G2e=/^\[object .+?Constructor\]$/,W2e=Function.prototype,q2e=Object.prototype,X2e=W2e.toString,Y2e=q2e.hasOwnProperty,K2e=RegExp("^"+X2e.call(Y2e).replace(j2e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Z2e(t){if(!V2e(t)||z2e(t))return!1;var e=U2e(t)?K2e:G2e;return e.test(H2e(t))}VK.exports=Z2e});var GK=Qt((Lpt,jK)=>{function J2e(t,e){return t?.[e]}jK.exports=J2e});var Eg=Qt((Fpt,WK)=>{var Q2e=HK(),$2e=GK();function eTe(t,e){var r=$2e(t,e);return Q2e(r)?r:void 0}WK.exports=eTe});var RM=Qt((Npt,qK)=>{var tTe=Eg(),rTe=Hh(),iTe=tTe(rTe,"Map");qK.exports=iTe});var $b=Qt((kpt,XK)=>{var nTe=Eg(),oTe=nTe(Object,"create");XK.exports=oTe});var ZK=Qt((Upt,KK)=>{var YK=$b();function sTe(){this.__data__=YK?YK(null):{},this.size=0}KK.exports=sTe});var QK=Qt((zpt,JK)=>{function aTe(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}JK.exports=aTe});var eZ=Qt((Vpt,$K)=>{var lTe=$b(),cTe="__lodash_hash_undefined__",uTe=Object.prototype,fTe=uTe.hasOwnProperty;function hTe(t){var e=this.__data__;if(lTe){var r=e[t];return r===cTe?void 0:r}return fTe.call(e,t)?e[t]:void 0}$K.exports=hTe});var rZ=Qt((Hpt,tZ)=>{var dTe=$b(),pTe=Object.prototype,ATe=pTe.hasOwnProperty;function mTe(t){var e=this.__data__;return dTe?e[t]!==void 0:ATe.call(e,t)}tZ.exports=mTe});var nZ=Qt((jpt,iZ)=>{var gTe=$b(),_Te="__lodash_hash_undefined__";function yTe(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=gTe&&e===void 0?_Te:e,this}iZ.exports=yTe});var sZ=Qt((Gpt,oZ)=>{var vTe=ZK(),xTe=QK(),bTe=eZ(),wTe=rZ(),TTe=nZ();function vy(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}vy.prototype.clear=vTe;vy.prototype.delete=xTe;vy.prototype.get=bTe;vy.prototype.has=wTe;vy.prototype.set=TTe;oZ.exports=vy});var cZ=Qt((Wpt,lZ)=>{var aZ=sZ(),ETe=Jb(),STe=RM();function CTe(){this.size=0,this.__data__={hash:new aZ,map:new(STe||ETe),string:new aZ}}lZ.exports=CTe});var fZ=Qt((qpt,uZ)=>{function MTe(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}uZ.exports=MTe});var ew=Qt((Xpt,hZ)=>{var ITe=fZ();function PTe(t,e){var r=t.__data__;return ITe(e)?r[typeof e=="string"?"string":"hash"]:r.map}hZ.exports=PTe});var pZ=Qt((Ypt,dZ)=>{var RTe=ew();function BTe(t){var e=RTe(this,t).delete(t);return this.size-=e?1:0,e}dZ.exports=BTe});var mZ=Qt((Kpt,AZ)=>{var OTe=ew();function DTe(t){return OTe(this,t).get(t)}AZ.exports=DTe});var _Z=Qt((Zpt,gZ)=>{var LTe=ew();function FTe(t){return LTe(this,t).has(t)}gZ.exports=FTe});var vZ=Qt((Jpt,yZ)=>{var NTe=ew();function kTe(t,e){var r=NTe(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}yZ.exports=kTe});var HF=Qt((Qpt,xZ)=>{var UTe=cZ(),zTe=pZ(),VTe=mZ(),HTe=_Z(),jTe=vZ();function xy(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}xy.prototype.clear=UTe;xy.prototype.delete=zTe;xy.prototype.get=VTe;xy.prototype.has=HTe;xy.prototype.set=jTe;xZ.exports=xy});var wZ=Qt(($pt,bZ)=>{var GTe=Jb(),WTe=RM(),qTe=HF(),XTe=200;function YTe(t,e){var r=this.__data__;if(r instanceof GTe){var i=r.__data__;if(!WTe||i.length<XTe-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new qTe(i)}return r.set(t,e),this.size=r.size,this}bZ.exports=YTe});var EZ=Qt((eAt,TZ)=>{var KTe=Jb(),ZTe=pK(),JTe=mK(),QTe=_K(),$Te=vK(),eEe=wZ();function by(t){var e=this.__data__=new KTe(t);this.size=e.size}by.prototype.clear=ZTe;by.prototype.delete=JTe;by.prototype.get=QTe;by.prototype.has=$Te;by.prototype.set=eEe;TZ.exports=by});var CZ=Qt((tAt,SZ)=>{var tEe="__lodash_hash_undefined__";function rEe(t){return this.__data__.set(t,tEe),this}SZ.exports=rEe});var IZ=Qt((rAt,MZ)=>{function iEe(t){return this.__data__.has(t)}MZ.exports=iEe});var RZ=Qt((iAt,PZ)=>{var nEe=HF(),oEe=CZ(),sEe=IZ();function BM(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new nEe;++e<r;)this.add(t[e])}BM.prototype.add=BM.prototype.push=oEe;BM.prototype.has=sEe;PZ.exports=BM});var OZ=Qt((nAt,BZ)=>{function aEe(t,e){for(var r=-1,i=t==null?0:t.length;++r<i;)if(e(t[r],r,t))return!0;return!1}BZ.exports=aEe});var LZ=Qt((oAt,DZ)=>{function lEe(t,e){return t.has(e)}DZ.exports=lEe});var jF=Qt((sAt,FZ)=>{var cEe=RZ(),uEe=OZ(),fEe=LZ(),hEe=1,dEe=2;function pEe(t,e,r,i,n,o){var s=r&hEe,l=t.length,u=e.length;if(l!=u&&!(s&&u>l))return!1;var h=o.get(t),v=o.get(e);if(h&&v)return h==e&&v==t;var T=-1,E=!0,M=r&dEe?new cEe:void 0;for(o.set(t,e),o.set(e,t);++T<l;){var O=t[T],F=e[T];if(i)var z=s?i(F,O,T,e,t,o):i(O,F,T,t,e,o);if(z!==void 0){if(z)continue;E=!1;break}if(M){if(!uEe(e,function(W,J){if(!fEe(M,J)&&(O===W||n(O,W,r,i,o)))return M.push(J)})){E=!1;break}}else if(!(O===F||n(O,F,r,i,o))){E=!1;break}}return o.delete(t),o.delete(e),E}FZ.exports=pEe});var kZ=Qt((aAt,NZ)=>{var AEe=Hh(),mEe=AEe.Uint8Array;NZ.exports=mEe});var zZ=Qt((lAt,UZ)=>{function gEe(t){var e=-1,r=Array(t.size);return t.forEach(function(i,n){r[++e]=[n,i]}),r}UZ.exports=gEe});var HZ=Qt((cAt,VZ)=>{function _Ee(t){var e=-1,r=Array(t.size);return t.forEach(function(i){r[++e]=i}),r}VZ.exports=_Ee});var XZ=Qt((uAt,qZ)=>{var jZ=PM(),GZ=kZ(),yEe=FF(),vEe=jF(),xEe=zZ(),bEe=HZ(),wEe=1,TEe=2,EEe="[object Boolean]",SEe="[object Date]",CEe="[object Error]",MEe="[object Map]",IEe="[object Number]",PEe="[object RegExp]",REe="[object Set]",BEe="[object String]",OEe="[object Symbol]",DEe="[object ArrayBuffer]",LEe="[object DataView]",WZ=jZ?jZ.prototype:void 0,GF=WZ?WZ.valueOf:void 0;function FEe(t,e,r,i,n,o,s){switch(r){case LEe:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case DEe:return!(t.byteLength!=e.byteLength||!o(new GZ(t),new GZ(e)));case EEe:case SEe:case IEe:return yEe(+t,+e);case CEe:return t.name==e.name&&t.message==e.message;case PEe:case BEe:return t==e+"";case MEe:var l=xEe;case REe:var u=i&wEe;if(l||(l=bEe),t.size!=e.size&&!u)return!1;var h=s.get(t);if(h)return h==e;i|=TEe,s.set(t,e);var v=vEe(l(t),l(e),i,n,o,s);return s.delete(t),v;case OEe:if(GF)return GF.call(t)==GF.call(e)}return!1}qZ.exports=FEe});var KZ=Qt((fAt,YZ)=>{function NEe(t,e){for(var r=-1,i=e.length,n=t.length;++r<i;)t[n+r]=e[r];return t}YZ.exports=NEe});var OM=Qt((hAt,ZZ)=>{var kEe=Array.isArray;ZZ.exports=kEe});var QZ=Qt((dAt,JZ)=>{var UEe=KZ(),zEe=OM();function VEe(t,e,r){var i=e(t);return zEe(t)?i:UEe(i,r(t))}JZ.exports=VEe});var eJ=Qt((pAt,$Z)=>{function HEe(t,e){for(var r=-1,i=t==null?0:t.length,n=0,o=[];++r<i;){var s=t[r];e(s,r,t)&&(o[n++]=s)}return o}$Z.exports=HEe});var rJ=Qt((AAt,tJ)=>{function jEe(){return[]}tJ.exports=jEe});var oJ=Qt((mAt,nJ)=>{var GEe=eJ(),WEe=rJ(),qEe=Object.prototype,XEe=qEe.propertyIsEnumerable,iJ=Object.getOwnPropertySymbols,YEe=iJ?function(t){return t==null?[]:(t=Object(t),GEe(iJ(t),function(e){return XEe.call(t,e)}))}:WEe;nJ.exports=YEe});var aJ=Qt((gAt,sJ)=>{function KEe(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}sJ.exports=KEe});var wy=Qt((_At,lJ)=>{function ZEe(t){return t!=null&&typeof t=="object"}lJ.exports=ZEe});var uJ=Qt((yAt,cJ)=>{var JEe=yy(),QEe=wy(),$Ee="[object Arguments]";function eSe(t){return QEe(t)&&JEe(t)==$Ee}cJ.exports=eSe});var pJ=Qt((vAt,dJ)=>{var fJ=uJ(),tSe=wy(),hJ=Object.prototype,rSe=hJ.hasOwnProperty,iSe=hJ.propertyIsEnumerable,nSe=fJ(function(){return arguments}())?fJ:function(t){return tSe(t)&&rSe.call(t,"callee")&&!iSe.call(t,"callee")};dJ.exports=nSe});var mJ=Qt((xAt,AJ)=>{function oSe(){return!1}AJ.exports=oSe});var WF=Qt((tw,Ty)=>{var sSe=Hh(),aSe=mJ(),yJ=typeof tw=="object"&&tw&&!tw.nodeType&&tw,gJ=yJ&&typeof Ty=="object"&&Ty&&!Ty.nodeType&&Ty,lSe=gJ&&gJ.exports===yJ,_J=lSe?sSe.Buffer:void 0,cSe=_J?_J.isBuffer:void 0,uSe=cSe||aSe;Ty.exports=uSe});var xJ=Qt((bAt,vJ)=>{var fSe=9007199254740991,hSe=/^(?:0|[1-9]\d*)$/;function dSe(t,e){var r=typeof t;return e=e??fSe,!!e&&(r=="number"||r!="symbol"&&hSe.test(t))&&t>-1&&t%1==0&&t<e}vJ.exports=dSe});var qF=Qt((wAt,bJ)=>{var pSe=9007199254740991;function ASe(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=pSe}bJ.exports=ASe});var TJ=Qt((TAt,wJ)=>{var mSe=yy(),gSe=qF(),_Se=wy(),ySe="[object Arguments]",vSe="[object Array]",xSe="[object Boolean]",bSe="[object Date]",wSe="[object Error]",TSe="[object Function]",ESe="[object Map]",SSe="[object Number]",CSe="[object Object]",MSe="[object RegExp]",ISe="[object Set]",PSe="[object String]",RSe="[object WeakMap]",BSe="[object ArrayBuffer]",OSe="[object DataView]",DSe="[object Float32Array]",LSe="[object Float64Array]",FSe="[object Int8Array]",NSe="[object Int16Array]",kSe="[object Int32Array]",USe="[object Uint8Array]",zSe="[object Uint8ClampedArray]",VSe="[object Uint16Array]",HSe="[object Uint32Array]",gs={};gs[DSe]=gs[LSe]=gs[FSe]=gs[NSe]=gs[kSe]=gs[USe]=gs[zSe]=gs[VSe]=gs[HSe]=!0;gs[ySe]=gs[vSe]=gs[BSe]=gs[xSe]=gs[OSe]=gs[bSe]=gs[wSe]=gs[TSe]=gs[ESe]=gs[SSe]=gs[CSe]=gs[MSe]=gs[ISe]=gs[PSe]=gs[RSe]=!1;function jSe(t){return _Se(t)&&gSe(t.length)&&!!gs[mSe(t)]}wJ.exports=jSe});var SJ=Qt((EAt,EJ)=>{function GSe(t){return function(e){return t(e)}}EJ.exports=GSe});var MJ=Qt((rw,Ey)=>{var WSe=NF(),CJ=typeof rw=="object"&&rw&&!rw.nodeType&&rw,iw=CJ&&typeof Ey=="object"&&Ey&&!Ey.nodeType&&Ey,qSe=iw&&iw.exports===CJ,XF=qSe&&WSe.process,XSe=function(){try{var t=iw&&iw.require&&iw.require("util").types;return t||XF&&XF.binding&&XF.binding("util")}catch{}}();Ey.exports=XSe});var YF=Qt((SAt,RJ)=>{var YSe=TJ(),KSe=SJ(),IJ=MJ(),PJ=IJ&&IJ.isTypedArray,ZSe=PJ?KSe(PJ):YSe;RJ.exports=ZSe});var OJ=Qt((CAt,BJ)=>{var JSe=aJ(),QSe=pJ(),$Se=OM(),eCe=WF(),tCe=xJ(),rCe=YF(),iCe=Object.prototype,nCe=iCe.hasOwnProperty;function oCe(t,e){var r=$Se(t),i=!r&&QSe(t),n=!r&&!i&&eCe(t),o=!r&&!i&&!n&&rCe(t),s=r||i||n||o,l=s?JSe(t.length,String):[],u=l.length;for(var h in t)(e||nCe.call(t,h))&&!(s&&(h=="length"||n&&(h=="offset"||h=="parent")||o&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||tCe(h,u)))&&l.push(h);return l}BJ.exports=oCe});var LJ=Qt((MAt,DJ)=>{var sCe=Object.prototype;function aCe(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||sCe;return t===r}DJ.exports=aCe});var KF=Qt((IAt,FJ)=>{function lCe(t,e){return function(r){return t(e(r))}}FJ.exports=lCe});var kJ=Qt((PAt,NJ)=>{var cCe=KF(),uCe=cCe(Object.keys,Object);NJ.exports=uCe});var zJ=Qt((RAt,UJ)=>{var fCe=LJ(),hCe=kJ(),dCe=Object.prototype,pCe=dCe.hasOwnProperty;function ACe(t){if(!fCe(t))return hCe(t);var e=[];for(var r in Object(t))pCe.call(t,r)&&r!="constructor"&&e.push(r);return e}UJ.exports=ACe});var HJ=Qt((BAt,VJ)=>{var mCe=UF(),gCe=qF();function _Ce(t){return t!=null&&gCe(t.length)&&!mCe(t)}VJ.exports=_Ce});var GJ=Qt((OAt,jJ)=>{var yCe=OJ(),vCe=zJ(),xCe=HJ();function bCe(t){return xCe(t)?yCe(t):vCe(t)}jJ.exports=bCe});var qJ=Qt((DAt,WJ)=>{var wCe=QZ(),TCe=oJ(),ECe=GJ();function SCe(t){return wCe(t,ECe,TCe)}WJ.exports=SCe});var KJ=Qt((LAt,YJ)=>{var XJ=qJ(),CCe=1,MCe=Object.prototype,ICe=MCe.hasOwnProperty;function PCe(t,e,r,i,n,o){var s=r&CCe,l=XJ(t),u=l.length,h=XJ(e),v=h.length;if(u!=v&&!s)return!1;for(var T=u;T--;){var E=l[T];if(!(s?E in e:ICe.call(e,E)))return!1}var M=o.get(t),O=o.get(e);if(M&&O)return M==e&&O==t;var F=!0;o.set(t,e),o.set(e,t);for(var z=s;++T<u;){E=l[T];var W=t[E],J=e[E];if(i)var K=s?i(J,W,E,e,t,o):i(W,J,E,t,e,o);if(!(K===void 0?W===J||n(W,J,r,i,o):K)){F=!1;break}z||(z=E=="constructor")}if(F&&!z){var ne=t.constructor,ge=e.constructor;ne!=ge&&"constructor"in t&&"constructor"in e&&!(typeof ne=="function"&&ne instanceof ne&&typeof ge=="function"&&ge instanceof ge)&&(F=!1)}return o.delete(t),o.delete(e),F}YJ.exports=PCe});var JJ=Qt((FAt,ZJ)=>{var RCe=Eg(),BCe=Hh(),OCe=RCe(BCe,"DataView");ZJ.exports=OCe});var $J=Qt((NAt,QJ)=>{var DCe=Eg(),LCe=Hh(),FCe=DCe(LCe,"Promise");QJ.exports=FCe});var tQ=Qt((kAt,eQ)=>{var NCe=Eg(),kCe=Hh(),UCe=NCe(kCe,"Set");eQ.exports=UCe});var iQ=Qt((UAt,rQ)=>{var zCe=Eg(),VCe=Hh(),HCe=zCe(VCe,"WeakMap");rQ.exports=HCe});var fQ=Qt((zAt,uQ)=>{var ZF=JJ(),JF=RM(),QF=$J(),$F=tQ(),eN=iQ(),cQ=yy(),Sy=VF(),nQ="[object Map]",jCe="[object Object]",oQ="[object Promise]",sQ="[object Set]",aQ="[object WeakMap]",lQ="[object DataView]",GCe=Sy(ZF),WCe=Sy(JF),qCe=Sy(QF),XCe=Sy($F),YCe=Sy(eN),Sg=cQ;(ZF&&Sg(new ZF(new ArrayBuffer(1)))!=lQ||JF&&Sg(new JF)!=nQ||QF&&Sg(QF.resolve())!=oQ||$F&&Sg(new $F)!=sQ||eN&&Sg(new eN)!=aQ)&&(Sg=function(t){var e=cQ(t),r=e==jCe?t.constructor:void 0,i=r?Sy(r):"";if(i)switch(i){case GCe:return lQ;case WCe:return nQ;case qCe:return oQ;case XCe:return sQ;case YCe:return aQ}return e});uQ.exports=Sg});var yQ=Qt((VAt,_Q)=>{var tN=EZ(),KCe=jF(),ZCe=XZ(),JCe=KJ(),hQ=fQ(),dQ=OM(),pQ=WF(),QCe=YF(),$Ce=1,AQ="[object Arguments]",mQ="[object Array]",DM="[object Object]",eMe=Object.prototype,gQ=eMe.hasOwnProperty;function tMe(t,e,r,i,n,o){var s=dQ(t),l=dQ(e),u=s?mQ:hQ(t),h=l?mQ:hQ(e);u=u==AQ?DM:u,h=h==AQ?DM:h;var v=u==DM,T=h==DM,E=u==h;if(E&&pQ(t)){if(!pQ(e))return!1;s=!0,v=!1}if(E&&!v)return o||(o=new tN),s||QCe(t)?KCe(t,e,r,i,n,o):ZCe(t,e,u,r,i,n,o);if(!(r&$Ce)){var M=v&&gQ.call(t,"__wrapped__"),O=T&&gQ.call(e,"__wrapped__");if(M||O){var F=M?t.value():t,z=O?e.value():e;return o||(o=new tN),n(F,z,r,i,o)}}return E?(o||(o=new tN),JCe(t,e,r,i,n,o)):!1}_Q.exports=tMe});var wQ=Qt((HAt,bQ)=>{var rMe=yQ(),vQ=wy();function xQ(t,e,r,i,n){return t===e?!0:t==null||e==null||!vQ(t)&&!vQ(e)?t!==t&&e!==e:rMe(t,e,r,i,xQ,n)}bQ.exports=xQ});var EQ=Qt((jAt,TQ)=>{var iMe=wQ();function nMe(t,e){return iMe(t,e)}TQ.exports=nMe});var CQ=Qt((GAt,SQ)=>{var oMe=KF(),sMe=oMe(Object.getPrototypeOf,Object);SQ.exports=sMe});var PQ=Qt((WAt,IQ)=>{var aMe=yy(),lMe=CQ(),cMe=wy(),uMe="[object Object]",fMe=Function.prototype,hMe=Object.prototype,MQ=fMe.toString,dMe=hMe.hasOwnProperty,pMe=MQ.call(Object);function AMe(t){if(!cMe(t)||aMe(t)!=uMe)return!1;var e=lMe(t);if(e===null)return!0;var r=dMe.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&MQ.call(r)==pMe}IQ.exports=AMe});var aw,aN,lw,zM,lN,VQ,Gh,Kd,HQ,cN,jQ,GQ,uN,fN,hN,WQ,qQ,VM,dN,XQ,_s=It(()=>{aw="1.13.6",aN=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},lw=Array.prototype,zM=Object.prototype,lN=typeof Symbol<"u"?Symbol.prototype:null,VQ=lw.push,Gh=lw.slice,Kd=zM.toString,HQ=zM.hasOwnProperty,cN=typeof ArrayBuffer<"u",jQ=typeof DataView<"u",GQ=Array.isArray,uN=Object.keys,fN=Object.create,hN=cN&&ArrayBuffer.isView,WQ=isNaN,qQ=isFinite,VM=!{toString:null}.propertyIsEnumerable("toString"),dN=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],XQ=Math.pow(2,53)-1});function Lo(t,e){return e=e==null?t.length-1:+e,function(){for(var r=Math.max(arguments.length-e,0),i=Array(r),n=0;n<r;n++)i[n]=arguments[n+e];switch(e){case 0:return t.call(this,i);case 1:return t.call(this,arguments[0],i);case 2:return t.call(this,arguments[0],arguments[1],i)}var o=Array(e+1);for(n=0;n<e;n++)o[n]=arguments[n];return o[e]=i,t.apply(this,o)}}var Pc=It(()=>{});function jl(t){var e=typeof t;return e==="function"||e==="object"&&!!t}var hA=It(()=>{});function HM(t){return t===null}var YQ=It(()=>{});function Iy(t){return t===void 0}var pN=It(()=>{});function Py(t){return t===!0||t===!1||Kd.call(t)==="[object Boolean]"}var AN=It(()=>{_s()});function jM(t){return!!(t&&t.nodeType===1)}var KQ=It(()=>{});function oo(t){var e="[object "+t+"]";return function(r){return Kd.call(r)===e}}var El=It(()=>{_s()});var Cg,GM=It(()=>{El();Cg=oo("String")});var cw,mN=It(()=>{El();cw=oo("Number")});var gN,ZQ=It(()=>{El();gN=oo("Date")});var _N,JQ=It(()=>{El();_N=oo("RegExp")});var yN,QQ=It(()=>{El();yN=oo("Error")});var uw,vN=It(()=>{El();uw=oo("Symbol")});var fw,xN=It(()=>{El();fw=oo("ArrayBuffer")});var $Q,bMe,qo,ru=It(()=>{El();_s();$Q=oo("Function"),bMe=aN.document&&aN.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof bMe!="function"&&($Q=function(t){return typeof t=="function"||!1});qo=$Q});var bN,e$=It(()=>{El();bN=oo("Object")});var WM,Ry,By=It(()=>{_s();e$();WM=jQ&&bN(new DataView(new ArrayBuffer(8))),Ry=typeof Map<"u"&&bN(new Map)});function TMe(t){return t!=null&&qo(t.getInt8)&&fw(t.buffer)}var wMe,dA,qM=It(()=>{El();ru();xN();By();wMe=oo("DataView");dA=WM?TMe:wMe});var oc,pA=It(()=>{_s();El();oc=GQ||oo("Array")});function Sl(t,e){return t!=null&&HQ.call(t,e)}var Zd=It(()=>{_s()});var wN,Mg,XM=It(()=>{El();Zd();wN=oo("Arguments");(function(){wN(arguments)||(wN=function(t){return Sl(t,"callee")})})();Mg=wN});function YM(t){return!uw(t)&&qQ(t)&&!isNaN(parseFloat(t))}var t$=It(()=>{_s();vN()});function Oy(t){return cw(t)&&WQ(t)}var TN=It(()=>{_s();mN()});function Dy(t){return function(){return t}}var EN=It(()=>{});function hw(t){return function(e){var r=t(e);return typeof r=="number"&&r>=0&&r<=XQ}}var SN=It(()=>{_s()});function dw(t){return function(e){return e?.[t]}}var CN=It(()=>{});var Ig,KM=It(()=>{CN();Ig=dw("byteLength")});var r$,i$=It(()=>{SN();KM();r$=hw(Ig)});function SMe(t){return hN?hN(t)&&!dA(t):r$(t)&&EMe.test(Kd.call(t))}var EMe,pw,MN=It(()=>{_s();qM();EN();i$();EMe=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;pw=cN?SMe:Dy(!1)});var as,iu=It(()=>{CN();as=dw("length")});function CMe(t){for(var e={},r=t.length,i=0;i<r;++i)e[t[i]]=!0;return{contains:function(n){return e[n]===!0},push:function(n){return e[n]=!0,t.push(n)}}}function Aw(t,e){e=CMe(e);var r=dN.length,i=t.constructor,n=qo(i)&&i.prototype||zM,o="constructor";for(Sl(t,o)&&!e.contains(o)&&e.push(o);r--;)o=dN[r],o in t&&t[o]!==n[o]&&!e.contains(o)&&e.push(o)}var IN=It(()=>{_s();ru();Zd()});function Gn(t){if(!jl(t))return[];if(uN)return uN(t);var e=[];for(var r in t)Sl(t,r)&&e.push(r);return VM&&Aw(t,e),e}var rl=It(()=>{hA();_s();Zd();IN()});function ZM(t){if(t==null)return!0;var e=as(t);return typeof e=="number"&&(oc(t)||Cg(t)||Mg(t))?e===0:as(Gn(t))===0}var n$=It(()=>{iu();pA();GM();XM();rl()});function Ly(t,e){var r=Gn(e),i=r.length;if(t==null)return!i;for(var n=Object(t),o=0;o<i;o++){var s=r[o];if(e[s]!==n[s]||!(s in n))return!1}return!0}var PN=It(()=>{rl()});function dn(t){if(t instanceof dn)return t;if(!(this instanceof dn))return new dn(t);this._wrapped=t}var Rc=It(()=>{_s();dn.VERSION=aw;dn.prototype.value=function(){return this._wrapped};dn.prototype.valueOf=dn.prototype.toJSON=dn.prototype.value;dn.prototype.toString=function(){return String(this._wrapped)}});function JM(t){return new Uint8Array(t.buffer||t,t.byteOffset||0,Ig(t))}var o$=It(()=>{KM()});function RN(t,e,r,i){if(t===e)return t!==0||1/t===1/e;if(t==null||e==null)return!1;if(t!==t)return e!==e;var n=typeof t;return n!=="function"&&n!=="object"&&typeof e!="object"?!1:a$(t,e,r,i)}function a$(t,e,r,i){t instanceof dn&&(t=t._wrapped),e instanceof dn&&(e=e._wrapped);var n=Kd.call(t);if(n!==Kd.call(e))return!1;if(WM&&n=="[object Object]"&&dA(t)){if(!dA(e))return!1;n=s$}switch(n){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:+t==0?1/+t===1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object Symbol]":return lN.valueOf.call(t)===lN.valueOf.call(e);case"[object ArrayBuffer]":case s$:return a$(JM(t),JM(e),r,i)}var o=n==="[object Array]";if(!o&&pw(t)){var s=Ig(t);if(s!==Ig(e))return!1;if(t.buffer===e.buffer&&t.byteOffset===e.byteOffset)return!0;o=!0}if(!o){if(typeof t!="object"||typeof e!="object")return!1;var l=t.constructor,u=e.constructor;if(l!==u&&!(qo(l)&&l instanceof l&&qo(u)&&u instanceof u)&&"constructor"in t&&"constructor"in e)return!1}r=r||[],i=i||[];for(var h=r.length;h--;)if(r[h]===t)return i[h]===e;if(r.push(t),i.push(e),o){if(h=t.length,h!==e.length)return!1;for(;h--;)if(!RN(t[h],e[h],r,i))return!1}else{var v=Gn(t),T;if(h=v.length,Gn(e).length!==h)return!1;for(;h--;)if(T=v[h],!(Sl(e,T)&&RN(t[T],e[T],r,i)))return!1}return r.pop(),i.pop(),!0}function QM(t,e){return RN(t,e)}var s$,l$=It(()=>{Rc();_s();KM();MN();ru();By();qM();rl();Zd();o$();s$="[object DataView]"});function Zu(t){if(!jl(t))return[];var e=[];for(var r in t)e.push(r);return VM&&Aw(t,e),e}var Fy=It(()=>{hA();_s();IN()});function Ny(t){var e=as(t);return function(r){if(r==null)return!1;var i=Zu(r);if(as(i))return!1;for(var n=0;n<e;n++)if(!qo(r[t[n]]))return!1;return t!==DN||!qo(r[BN])}}var BN,c$,ON,u$,f$,DN,h$,$M=It(()=>{iu();ru();Fy();BN="forEach",c$="has",ON=["clear","delete"],u$=["get",c$,"set"],f$=ON.concat(BN,u$),DN=ON.concat(u$),h$=["add"].concat(ON,BN,c$)});var LN,d$=It(()=>{El();By();$M();LN=Ry?Ny(f$):oo("Map")});var FN,p$=It(()=>{El();By();$M();FN=Ry?Ny(DN):oo("WeakMap")});var NN,A$=It(()=>{El();By();$M();NN=Ry?Ny(h$):oo("Set")});var kN,m$=It(()=>{El();kN=oo("WeakSet")});function Bc(t){for(var e=Gn(t),r=e.length,i=Array(r),n=0;n<r;n++)i[n]=t[e[n]];return i}var Pg=It(()=>{rl()});function eI(t){for(var e=Gn(t),r=e.length,i=Array(r),n=0;n<r;n++)i[n]=[e[n],t[e[n]]];return i}var g$=It(()=>{rl()});function ky(t){for(var e={},r=Gn(t),i=0,n=r.length;i<n;i++)e[t[r[i]]]=r[i];return e}var UN=It(()=>{rl()});function Rg(t){var e=[];for(var r in t)qo(t[r])&&e.push(r);return e.sort()}var zN=It(()=>{ru()});function Bg(t,e){return function(r){var i=arguments.length;if(e&&(r=Object(r)),i<2||r==null)return r;for(var n=1;n<i;n++)for(var o=arguments[n],s=t(o),l=s.length,u=0;u<l;u++){var h=s[u];(!e||r[h]===void 0)&&(r[h]=o[h])}return r}}var tI=It(()=>{});var mw,VN=It(()=>{tI();Fy();mw=Bg(Zu)});var AA,rI=It(()=>{tI();rl();AA=Bg(Gn)});var gw,HN=It(()=>{tI();Fy();gw=Bg(Zu,!0)});function MMe(){return function(){}}function _w(t){if(!jl(t))return{};if(fN)return fN(t);var e=MMe();e.prototype=t;var r=new e;return e.prototype=null,r}var jN=It(()=>{hA();_s()});function iI(t,e){var r=_w(t);return e&&AA(r,e),r}var _$=It(()=>{jN();rI()});function nI(t){return jl(t)?oc(t)?t.slice():mw({},t):t}var y$=It(()=>{hA();pA();VN()});function oI(t,e){return e(t),t}var v$=It(()=>{});function yw(t){return oc(t)?t:[t]}var GN=It(()=>{Rc();pA();dn.toPath=yw});function Uf(t){return dn.toPath(t)}var Uy=It(()=>{Rc();GN()});function Og(t,e){for(var r=e.length,i=0;i<r;i++){if(t==null)return;t=t[e[i]]}return r?t:void 0}var sI=It(()=>{});function zy(t,e,r){var i=Og(t,Uf(e));return Iy(i)?r:i}var WN=It(()=>{Uy();sI();pN()});function aI(t,e){e=Uf(e);for(var r=e.length,i=0;i<r;i++){var n=e[i];if(!Sl(t,n))return!1;t=t[n]}return!!r}var x$=It(()=>{Zd();Uy()});function mA(t){return t}var lI=It(()=>{});function zf(t){return t=AA({},t),function(e){return Ly(e,t)}}var vw=It(()=>{rI();PN()});function gA(t){return t=Uf(t),function(e){return Og(e,t)}}var cI=It(()=>{sI();Uy()});function Vf(t,e,r){if(e===void 0)return t;switch(r??3){case 1:return function(i){return t.call(e,i)};case 3:return function(i,n,o){return t.call(e,i,n,o)};case 4:return function(i,n,o,s){return t.call(e,i,n,o,s)}}return function(){return t.apply(e,arguments)}}var Vy=It(()=>{});function xw(t,e,r){return t==null?mA:qo(t)?Vf(t,e,r):jl(t)&&!oc(t)?zf(t):gA(t)}var qN=It(()=>{lI();ru();hA();pA();vw();cI();Vy()});function Dg(t,e){return xw(t,e,1/0)}var XN=It(()=>{Rc();qN();dn.iteratee=Dg});function Fo(t,e,r){return dn.iteratee!==Dg?dn.iteratee(t,e):xw(t,e,r)}var sc=It(()=>{Rc();qN();XN()});function uI(t,e,r){e=Fo(e,r);for(var i=Gn(t),n=i.length,o={},s=0;s<n;s++){var l=i[s];o[l]=e(t[l],l,t)}return o}var b$=It(()=>{sc();rl()});function Hy(){}var YN=It(()=>{});function fI(t){return t==null?Hy:function(e){return zy(t,e)}}var w$=It(()=>{YN();WN()});function hI(t,e,r){var i=Array(Math.max(0,t));e=Vf(e,r,1);for(var n=0;n<t;n++)i[n]=e(n);return i}var T$=It(()=>{Vy()});function Lg(t,e){return e==null&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))}var KN=It(()=>{});var Jd,dI=It(()=>{Jd=Date.now||function(){return new Date().getTime()}});function bw(t){var e=function(o){return t[o]},r="(?:"+Gn(t).join("|")+")",i=RegExp(r),n=RegExp(r,"g");return function(o){return o=o==null?"":""+o,i.test(o)?o.replace(n,e):o}}var ZN=It(()=>{rl()});var pI,JN=It(()=>{pI={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"}});var QN,E$=It(()=>{ZN();JN();QN=bw(pI)});var S$,C$=It(()=>{UN();JN();S$=ky(pI)});var $N,M$=It(()=>{ZN();C$();$N=bw(S$)});var e4,t4=It(()=>{Rc();e4=dn.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g}});function RMe(t){return"\\"+IMe[t]}function AI(t,e,r){!e&&r&&(e=r),e=gw({},e,dn.templateSettings);var i=RegExp([(e.escape||r4).source,(e.interpolate||r4).source,(e.evaluate||r4).source].join("|")+"|$","g"),n=0,o="__p+='";t.replace(i,function(h,v,T,E,M){return o+=t.slice(n,M).replace(PMe,RMe),n=M+h.length,v?o+=`'+
((__t=(`+v+`))==null?'':_.escape(__t))+
'`:T?o+=`'+
((__t=(`+T+`))==null?'':__t)+
'`:E&&(o+=`';
`+E+`
__p+='`),h}),o+=`';
`;var s=e.variable;if(s){if(!BMe.test(s))throw new Error("variable is not a bare identifier: "+s)}else o=`with(obj||{}){
`+o+`}
`,s="obj";o=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
`+o+`return __p;
`;var l;try{l=new Function(s,"_",o)}catch(h){throw h.source=o,h}var u=function(h){return l.call(this,h,dn)};return u.source="function("+s+`){
`+o+"}",u}var r4,IMe,PMe,BMe,I$=It(()=>{HN();Rc();t4();r4=/(.)^/,IMe={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},PMe=/\\|'|\r|\n|\u2028|\u2029/g;BMe=/^\s*(\w|\$)+\s*$/});function mI(t,e,r){e=Uf(e);var i=e.length;if(!i)return qo(r)?r.call(t):r;for(var n=0;n<i;n++){var o=t?.[e[n]];o===void 0&&(o=r,n=i),t=qo(o)?o.call(t):o}return t}var P$=It(()=>{ru();Uy()});function gI(t){var e=++OMe+"";return t?t+e:e}var OMe,R$=It(()=>{OMe=0});function _I(t){var e=dn(t);return e._chain=!0,e}var B$=It(()=>{Rc()});function ww(t,e,r,i,n){if(!(i instanceof e))return t.apply(r,n);var o=_w(t.prototype),s=t.apply(o,n);return jl(s)?s:o}var i4=It(()=>{jN();hA()});var n4,Qd,Tw=It(()=>{Pc();i4();Rc();n4=Lo(function(t,e){var r=n4.placeholder,i=function(){for(var n=0,o=e.length,s=Array(o),l=0;l<o;l++)s[l]=e[l]===r?arguments[n++]:e[l];for(;n<arguments.length;)s.push(arguments[n++]);return ww(t,i,this,this,s)};return i});n4.placeholder=dn;Qd=n4});var Ew,o4=It(()=>{Pc();ru();i4();Ew=Lo(function(t,e,r){if(!qo(t))throw new TypeError("Bind must be called on a function");var i=Lo(function(n){return ww(t,i,e,this,r.concat(n))});return i})});var ls,Oc=It(()=>{SN();iu();ls=hw(as)});function Dc(t,e,r,i){if(i=i||[],!e&&e!==0)e=1/0;else if(e<=0)return i.concat(t);for(var n=i.length,o=0,s=as(t);o<s;o++){var l=t[o];if(ls(l)&&(oc(l)||Mg(l)))if(e>1)Dc(l,e-1,r,i),n=i.length;else for(var u=0,h=l.length;u<h;)i[n++]=l[u++];else r||(i[n++]=l)}return i}var Fg=It(()=>{iu();Oc();pA();XM()});var s4,O$=It(()=>{Pc();Fg();o4();s4=Lo(function(t,e){e=Dc(e,!1,!1);var r=e.length;if(r<1)throw new Error("bindAll must be passed function names");for(;r--;){var i=e[r];t[i]=Ew(t[i],t)}return t})});function yI(t,e){var r=function(i){var n=r.cache,o=""+(e?e.apply(this,arguments):i);return Sl(n,o)||(n[o]=t.apply(this,arguments)),n[o]};return r.cache={},r}var D$=It(()=>{Zd()});var Sw,a4=It(()=>{Pc();Sw=Lo(function(t,e,r){return setTimeout(function(){return t.apply(null,r)},e)})});var l4,L$=It(()=>{Tw();a4();Rc();l4=Qd(Sw,dn,1)});function vI(t,e,r){var i,n,o,s,l=0;r||(r={});var u=function(){l=r.leading===!1?0:Jd(),i=null,s=t.apply(n,o),i||(n=o=null)},h=function(){var v=Jd();!l&&r.leading===!1&&(l=v);var T=e-(v-l);return n=this,o=arguments,T<=0||T>e?(i&&(clearTimeout(i),i=null),l=v,s=t.apply(n,o),i||(n=o=null)):!i&&r.trailing!==!1&&(i=setTimeout(u,T)),s};return h.cancel=function(){clearTimeout(i),l=0,i=n=o=null},h}var F$=It(()=>{dI()});function xI(t,e,r){var i,n,o,s,l,u=function(){var v=Jd()-n;e>v?i=setTimeout(u,e-v):(i=null,r||(s=t.apply(l,o)),i||(o=l=null))},h=Lo(function(v){return l=this,o=v,n=Jd(),i||(i=setTimeout(u,e),r&&(s=t.apply(l,o))),s});return h.cancel=function(){clearTimeout(i),i=o=l=null},h}var N$=It(()=>{Pc();dI()});function bI(t,e){return Qd(e,t)}var k$=It(()=>{Tw()});function _A(t){return function(){return!t.apply(this,arguments)}}var wI=It(()=>{});function TI(){var t=arguments,e=t.length-1;return function(){for(var r=e,i=t[e].apply(this,arguments);r--;)i=t[r].call(this,i);return i}}var U$=It(()=>{});function EI(t,e){return function(){if(--t<1)return e.apply(this,arguments)}}var z$=It(()=>{});function jy(t,e){var r;return function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=null),r}}var c4=It(()=>{});var u4,V$=It(()=>{Tw();c4();u4=Qd(jy,2)});function Gy(t,e,r){e=Fo(e,r);for(var i=Gn(t),n,o=0,s=i.length;o<s;o++)if(n=i[o],e(t[n],n,t))return n}var f4=It(()=>{sc();rl()});function Cw(t){return function(e,r,i){r=Fo(r,i);for(var n=as(e),o=t>0?0:n-1;o>=0&&o<n;o+=t)if(r(e[o],o,e))return o;return-1}}var h4=It(()=>{sc();iu()});var Ng,SI=It(()=>{h4();Ng=Cw(1)});var Mw,d4=It(()=>{h4();Mw=Cw(-1)});function Wy(t,e,r,i){r=Fo(r,i,1);for(var n=r(e),o=0,s=as(t);o<s;){var l=Math.floor((o+s)/2);r(t[l])<n?o=l+1:s=l}return o}var p4=It(()=>{sc();iu()});function Iw(t,e,r){return function(i,n,o){var s=0,l=as(i);if(typeof o=="number")t>0?s=o>=0?o:Math.max(o+l,s):l=o>=0?Math.min(o+1,l):o+l+1;else if(r&&o&&l)return o=r(i,n),i[o]===n?o:-1;if(n!==n)return o=e(Gh.call(i,s,l),Oy),o>=0?o+s:-1;for(o=t>0?s:l-1;o>=0&&o<l;o+=t)if(i[o]===n)return o;return-1}}var A4=It(()=>{iu();_s();TN()});var Pw,m4=It(()=>{p4();SI();A4();Pw=Iw(1,Ng,Wy)});var g4,H$=It(()=>{d4();A4();g4=Iw(-1,Mw)});function kg(t,e,r){var i=ls(t)?Ng:Gy,n=i(t,e,r);if(n!==void 0&&n!==-1)return t[n]}var _4=It(()=>{Oc();SI();f4()});function CI(t,e){return kg(t,zf(e))}var j$=It(()=>{_4();vw()});function il(t,e,r){e=Vf(e,r);var i,n;if(ls(t))for(i=0,n=t.length;i<n;i++)e(t[i],i,t);else{var o=Gn(t);for(i=0,n=o.length;i<n;i++)e(t[o[i]],o[i],t)}return t}var yA=It(()=>{Vy();Oc();rl()});function ac(t,e,r){e=Fo(e,r);for(var i=!ls(t)&&Gn(t),n=(i||t).length,o=Array(n),s=0;s<n;s++){var l=i?i[s]:s;o[s]=e(t[l],l,t)}return o}var Ug=It(()=>{sc();Oc();rl()});function Rw(t){var e=function(r,i,n,o){var s=!ls(r)&&Gn(r),l=(s||r).length,u=t>0?0:l-1;for(o||(n=r[s?s[u]:u],u+=t);u>=0&&u<l;u+=t){var h=s?s[u]:u;n=i(n,r[h],h,r)}return n};return function(r,i,n,o){var s=arguments.length>=3;return e(r,Vf(i,o,4),n,s)}}var y4=It(()=>{Oc();rl();Vy()});var Bw,G$=It(()=>{y4();Bw=Rw(1)});var MI,W$=It(()=>{y4();MI=Rw(-1)});function nu(t,e,r){var i=[];return e=Fo(e,r),il(t,function(n,o,s){e(n,o,s)&&i.push(n)}),i}var qy=It(()=>{sc();yA()});function II(t,e,r){return nu(t,_A(Fo(e)),r)}var q$=It(()=>{qy();wI();sc()});function Ow(t,e,r){e=Fo(e,r);for(var i=!ls(t)&&Gn(t),n=(i||t).length,o=0;o<n;o++){var s=i?i[o]:o;if(!e(t[s],s,t))return!1}return!0}var X$=It(()=>{sc();Oc();rl()});function Dw(t,e,r){e=Fo(e,r);for(var i=!ls(t)&&Gn(t),n=(i||t).length,o=0;o<n;o++){var s=i?i[o]:o;if(e(t[s],s,t))return!0}return!1}var Y$=It(()=>{sc();Oc();rl()});function Gl(t,e,r,i){return ls(t)||(t=Bc(t)),(typeof r!="number"||i)&&(r=0),Pw(t,e,r)>=0}var Xy=It(()=>{Oc();Pg();m4()});var v4,K$=It(()=>{Pc();ru();Ug();sI();Uy();v4=Lo(function(t,e,r){var i,n;return qo(e)?n=e:(e=Uf(e),i=e.slice(0,-1),e=e[e.length-1]),ac(t,function(o){var s=n;if(!s){if(i&&i.length&&(o=Og(o,i)),o==null)return;s=o[e]}return s==null?s:s.apply(o,r)})})});function vA(t,e){return ac(t,gA(e))}var PI=It(()=>{Ug();cI()});function RI(t,e){return nu(t,zf(e))}var Z$=It(()=>{qy();vw()});function Yy(t,e,r){var i=-1/0,n=-1/0,o,s;if(e==null||typeof e=="number"&&typeof t[0]!="object"&&t!=null){t=ls(t)?t:Bc(t);for(var l=0,u=t.length;l<u;l++)o=t[l],o!=null&&o>i&&(i=o)}else e=Fo(e,r),il(t,function(h,v,T){s=e(h,v,T),(s>n||s===-1/0&&i===-1/0)&&(i=h,n=s)});return i}var x4=It(()=>{Oc();Pg();sc();yA()});function BI(t,e,r){var i=1/0,n=1/0,o,s;if(e==null||typeof e=="number"&&typeof t[0]!="object"&&t!=null){t=ls(t)?t:Bc(t);for(var l=0,u=t.length;l<u;l++)o=t[l],o!=null&&o<i&&(i=o)}else e=Fo(e,r),il(t,function(h,v,T){s=e(h,v,T),(s<n||s===1/0&&i===1/0)&&(i=h,n=s)});return i}var J$=It(()=>{Oc();Pg();sc();yA()});function Ky(t){return t?oc(t)?Gh.call(t):Cg(t)?t.match(DMe):ls(t)?ac(t,mA):Bc(t):[]}var DMe,b4=It(()=>{pA();_s();GM();Oc();Ug();lI();Pg();DMe=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g});function Zy(t,e,r){if(e==null||r)return ls(t)||(t=Bc(t)),t[Lg(t.length-1)];var i=Ky(t),n=as(i);e=Math.max(Math.min(e,n),0);for(var o=n-1,s=0;s<e;s++){var l=Lg(s,o),u=i[s];i[s]=i[l],i[l]=u}return i.slice(0,e)}var w4=It(()=>{Oc();Pg();iu();KN();b4()});function OI(t){return Zy(t,1/0)}var Q$=It(()=>{w4()});function DI(t,e,r){var i=0;return e=Fo(e,r),vA(ac(t,function(n,o,s){return{value:n,index:i++,criteria:e(n,o,s)}}).sort(function(n,o){var s=n.criteria,l=o.criteria;if(s!==l){if(s>l||s===void 0)return 1;if(s<l||l===void 0)return-1}return n.index-o.index}),"value")}var $$=It(()=>{sc();PI();Ug()});function $d(t,e){return function(r,i,n){var o=e?[[],[]]:{};return i=Fo(i,n),il(r,function(s,l){var u=i(s,l,r);t(o,s,u)}),o}}var Lw=It(()=>{sc();yA()});var T4,eee=It(()=>{Lw();Zd();T4=$d(function(t,e,r){Sl(t,r)?t[r].push(e):t[r]=[e]})});var E4,tee=It(()=>{Lw();E4=$d(function(t,e,r){t[r]=e})});var S4,ree=It(()=>{Lw();Zd();S4=$d(function(t,e,r){Sl(t,r)?t[r]++:t[r]=1})});var C4,iee=It(()=>{Lw();C4=$d(function(t,e,r){t[r?0:1].push(e)},!0)});function LI(t){return t==null?0:ls(t)?t.length:Gn(t).length}var nee=It(()=>{Oc();rl()});function M4(t,e,r){return e in r}var oee=It(()=>{});var Fw,I4=It(()=>{Pc();ru();Vy();Fy();oee();Fg();Fw=Lo(function(t,e){var r={},i=e[0];if(t==null)return r;qo(i)?(e.length>1&&(i=Vf(i,e[1])),e=Zu(t)):(i=M4,e=Dc(e,!1,!1),t=Object(t));for(var n=0,o=e.length;n<o;n++){var s=e[n],l=t[s];i(l,s,t)&&(r[s]=l)}return r})});var P4,see=It(()=>{Pc();ru();wI();Ug();Fg();Xy();I4();P4=Lo(function(t,e){var r=e[0],i;return qo(r)?(r=_A(r),e.length>1&&(i=e[1])):(e=ac(Dc(e,!1,!1),String),r=function(n,o){return!Gl(e,o)}),Fw(t,r,i)})});function Jy(t,e,r){return Gh.call(t,0,Math.max(0,t.length-(e==null||r?1:e)))}var R4=It(()=>{_s()});function Qy(t,e,r){return t==null||t.length<1?e==null||r?void 0:[]:e==null||r?t[0]:Jy(t,t.length-e)}var aee=It(()=>{R4()});function xA(t,e,r){return Gh.call(t,e==null||r?1:e)}var B4=It(()=>{_s()});function FI(t,e,r){return t==null||t.length<1?e==null||r?void 0:[]:e==null||r?t[t.length-1]:xA(t,Math.max(0,t.length-e))}var lee=It(()=>{B4()});function NI(t){return nu(t,Boolean)}var cee=It(()=>{qy()});function kI(t,e){return Dc(t,e,!1)}var uee=It(()=>{Fg()});var Nw,O4=It(()=>{Pc();Fg();qy();Xy();Nw=Lo(function(t,e){return e=Dc(e,!0,!0),nu(t,function(r){return!Gl(e,r)})})});var D4,fee=It(()=>{Pc();O4();D4=Lo(function(t,e){return Nw(t,e)})});function zg(t,e,r,i){Py(e)||(i=r,r=e,e=!1),r!=null&&(r=Fo(r,i));for(var n=[],o=[],s=0,l=as(t);s<l;s++){var u=t[s],h=r?r(u,s,t):u;e&&!r?((!s||o!==h)&&n.push(u),o=h):r?Gl(o,h)||(o.push(h),n.push(u)):Gl(n,u)||n.push(u)}return n}var L4=It(()=>{AN();sc();iu();Xy()});var F4,hee=It(()=>{Pc();L4();Fg();F4=Lo(function(t){return zg(Dc(t,!0,!0))})});function UI(t){for(var e=[],r=arguments.length,i=0,n=as(t);i<n;i++){var o=t[i];if(!Gl(e,o)){var s;for(s=1;s<r&&Gl(arguments[s],o);s++);s===r&&e.push(o)}}return e}var dee=It(()=>{iu();Xy()});function Vg(t){for(var e=t&&Yy(t,as).length||0,r=Array(e),i=0;i<e;i++)r[i]=vA(t,i);return r}var N4=It(()=>{x4();iu();PI()});var k4,pee=It(()=>{Pc();N4();k4=Lo(Vg)});function zI(t,e){for(var r={},i=0,n=as(t);i<n;i++)e?r[t[i]]=e[i]:r[t[i][0]]=t[i][1];return r}var Aee=It(()=>{iu()});function VI(t,e,r){e==null&&(e=t||0,t=0),r||(r=e<t?-1:1);for(var i=Math.max(Math.ceil((e-t)/r),0),n=Array(i),o=0;o<i;o++,t+=r)n[o]=t;return n}var mee=It(()=>{});function HI(t,e){if(e==null||e<1)return[];for(var r=[],i=0,n=t.length;i<n;)r.push(Gh.call(t,i,i+=e));return r}var gee=It(()=>{_s()});function $y(t,e){return t._chain?dn(e).chain():e}var U4=It(()=>{Rc()});function ev(t){return il(Rg(t),function(e){var r=dn[e]=t[e];dn.prototype[e]=function(){var i=[this._wrapped];return VQ.apply(i,arguments),$y(this,r.apply(dn,i))}}),dn}var _ee=It(()=>{Rc();yA();zN();_s();U4()});var yee,vee=It(()=>{Rc();yA();_s();U4();il(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=lw[t];dn.prototype[t]=function(){var r=this._wrapped;return r!=null&&(e.apply(r,arguments),(t==="shift"||t==="splice")&&r.length===0&&delete r[0]),$y(this,r)}});il(["concat","join","slice"],function(t){var e=lw[t];dn.prototype[t]=function(){var r=this._wrapped;return r!=null&&(r=e.apply(r,arguments)),$y(this,r)}});yee=dn});var z4={};As(z4,{VERSION:()=>aw,after:()=>EI,all:()=>Ow,allKeys:()=>Zu,any:()=>Dw,assign:()=>AA,before:()=>jy,bind:()=>Ew,bindAll:()=>s4,chain:()=>_I,chunk:()=>HI,clone:()=>nI,collect:()=>ac,compact:()=>NI,compose:()=>TI,constant:()=>Dy,contains:()=>Gl,countBy:()=>S4,create:()=>iI,debounce:()=>xI,default:()=>yee,defaults:()=>gw,defer:()=>l4,delay:()=>Sw,detect:()=>kg,difference:()=>Nw,drop:()=>xA,each:()=>il,escape:()=>QN,every:()=>Ow,extend:()=>mw,extendOwn:()=>AA,filter:()=>nu,find:()=>kg,findIndex:()=>Ng,findKey:()=>Gy,findLastIndex:()=>Mw,findWhere:()=>CI,first:()=>Qy,flatten:()=>kI,foldl:()=>Bw,foldr:()=>MI,forEach:()=>il,functions:()=>Rg,get:()=>zy,groupBy:()=>T4,has:()=>aI,head:()=>Qy,identity:()=>mA,include:()=>Gl,includes:()=>Gl,indexBy:()=>E4,indexOf:()=>Pw,initial:()=>Jy,inject:()=>Bw,intersection:()=>UI,invert:()=>ky,invoke:()=>v4,isArguments:()=>Mg,isArray:()=>oc,isArrayBuffer:()=>fw,isBoolean:()=>Py,isDataView:()=>dA,isDate:()=>gN,isElement:()=>jM,isEmpty:()=>ZM,isEqual:()=>QM,isError:()=>yN,isFinite:()=>YM,isFunction:()=>qo,isMap:()=>LN,isMatch:()=>Ly,isNaN:()=>Oy,isNull:()=>HM,isNumber:()=>cw,isObject:()=>jl,isRegExp:()=>_N,isSet:()=>NN,isString:()=>Cg,isSymbol:()=>uw,isTypedArray:()=>pw,isUndefined:()=>Iy,isWeakMap:()=>FN,isWeakSet:()=>kN,iteratee:()=>Dg,keys:()=>Gn,last:()=>FI,lastIndexOf:()=>g4,map:()=>ac,mapObject:()=>uI,matcher:()=>zf,matches:()=>zf,max:()=>Yy,memoize:()=>yI,methods:()=>Rg,min:()=>BI,mixin:()=>ev,negate:()=>_A,noop:()=>Hy,now:()=>Jd,object:()=>zI,omit:()=>P4,once:()=>u4,pairs:()=>eI,partial:()=>Qd,partition:()=>C4,pick:()=>Fw,pluck:()=>vA,property:()=>gA,propertyOf:()=>fI,random:()=>Lg,range:()=>VI,reduce:()=>Bw,reduceRight:()=>MI,reject:()=>II,rest:()=>xA,restArguments:()=>Lo,result:()=>mI,sample:()=>Zy,select:()=>nu,shuffle:()=>OI,size:()=>LI,some:()=>Dw,sortBy:()=>DI,sortedIndex:()=>Wy,tail:()=>xA,take:()=>Qy,tap:()=>oI,template:()=>AI,templateSettings:()=>e4,throttle:()=>vI,times:()=>hI,toArray:()=>Ky,toPath:()=>yw,transpose:()=>Vg,unescape:()=>$N,union:()=>F4,uniq:()=>zg,unique:()=>zg,uniqueId:()=>gI,unzip:()=>Vg,values:()=>Bc,where:()=>RI,without:()=>D4,wrap:()=>bI,zip:()=>k4});var jI=It(()=>{_s();Pc();hA();YQ();pN();AN();KQ();GM();mN();ZQ();JQ();QQ();vN();xN();qM();pA();ru();XM();t$();TN();MN();n$();PN();l$();d$();p$();A$();m$();rl();Fy();Pg();g$();UN();zN();VN();rI();HN();_$();y$();v$();WN();x$();b$();lI();EN();YN();GN();cI();w$();vw();T$();KN();dI();E$();M$();t4();I$();P$();R$();B$();XN();Tw();o4();O$();D$();a4();L$();F$();N$();k$();wI();U$();z$();c4();V$();f4();SI();d4();p4();m4();H$();_4();j$();yA();Ug();G$();W$();qy();q$();X$();Y$();Xy();K$();PI();Z$();x4();J$();Q$();w4();$$();eee();tee();ree();iee();b4();nee();I4();see();aee();R4();lee();B4();cee();uee();fee();L4();hee();dee();O4();N4();pee();Aee();mee();gee();_ee();vee()});var V4,xee,bee=It(()=>{jI();jI();V4=ev(z4);V4._=V4;xee=V4});var wee={};As(wee,{VERSION:()=>aw,after:()=>EI,all:()=>Ow,allKeys:()=>Zu,any:()=>Dw,assign:()=>AA,before:()=>jy,bind:()=>Ew,bindAll:()=>s4,chain:()=>_I,chunk:()=>HI,clone:()=>nI,collect:()=>ac,compact:()=>NI,compose:()=>TI,constant:()=>Dy,contains:()=>Gl,countBy:()=>S4,create:()=>iI,debounce:()=>xI,default:()=>xee,defaults:()=>gw,defer:()=>l4,delay:()=>Sw,detect:()=>kg,difference:()=>Nw,drop:()=>xA,each:()=>il,escape:()=>QN,every:()=>Ow,extend:()=>mw,extendOwn:()=>AA,filter:()=>nu,find:()=>kg,findIndex:()=>Ng,findKey:()=>Gy,findLastIndex:()=>Mw,findWhere:()=>CI,first:()=>Qy,flatten:()=>kI,foldl:()=>Bw,foldr:()=>MI,forEach:()=>il,functions:()=>Rg,get:()=>zy,groupBy:()=>T4,has:()=>aI,head:()=>Qy,identity:()=>mA,include:()=>Gl,includes:()=>Gl,indexBy:()=>E4,indexOf:()=>Pw,initial:()=>Jy,inject:()=>Bw,intersection:()=>UI,invert:()=>ky,invoke:()=>v4,isArguments:()=>Mg,isArray:()=>oc,isArrayBuffer:()=>fw,isBoolean:()=>Py,isDataView:()=>dA,isDate:()=>gN,isElement:()=>jM,isEmpty:()=>ZM,isEqual:()=>QM,isError:()=>yN,isFinite:()=>YM,isFunction:()=>qo,isMap:()=>LN,isMatch:()=>Ly,isNaN:()=>Oy,isNull:()=>HM,isNumber:()=>cw,isObject:()=>jl,isRegExp:()=>_N,isSet:()=>NN,isString:()=>Cg,isSymbol:()=>uw,isTypedArray:()=>pw,isUndefined:()=>Iy,isWeakMap:()=>FN,isWeakSet:()=>kN,iteratee:()=>Dg,keys:()=>Gn,last:()=>FI,lastIndexOf:()=>g4,map:()=>ac,mapObject:()=>uI,matcher:()=>zf,matches:()=>zf,max:()=>Yy,memoize:()=>yI,methods:()=>Rg,min:()=>BI,mixin:()=>ev,negate:()=>_A,noop:()=>Hy,now:()=>Jd,object:()=>zI,omit:()=>P4,once:()=>u4,pairs:()=>eI,partial:()=>Qd,partition:()=>C4,pick:()=>Fw,pluck:()=>vA,property:()=>gA,propertyOf:()=>fI,random:()=>Lg,range:()=>VI,reduce:()=>Bw,reduceRight:()=>MI,reject:()=>II,rest:()=>xA,restArguments:()=>Lo,result:()=>mI,sample:()=>Zy,select:()=>nu,shuffle:()=>OI,size:()=>LI,some:()=>Dw,sortBy:()=>DI,sortedIndex:()=>Wy,tail:()=>xA,take:()=>Qy,tap:()=>oI,template:()=>AI,templateSettings:()=>e4,throttle:()=>vI,times:()=>hI,toArray:()=>Ky,toPath:()=>yw,transpose:()=>Vg,unescape:()=>$N,union:()=>F4,uniq:()=>zg,unique:()=>zg,uniqueId:()=>gI,unzip:()=>Vg,values:()=>Bc,where:()=>RI,without:()=>D4,wrap:()=>bI,zip:()=>k4});var Tee=It(()=>{bee();jI()});var H4=Qt((Eee,GI)=>{(function(t,e){"use strict";typeof GI=="object"&&typeof GI.exports=="object"?GI.exports=t.document?e(t,!0):function(r){if(!r.document)throw new Error("jQuery requires a window with a document");return e(r)}:e(t)})(typeof window<"u"?window:Eee,function(t,e){"use strict";var r=[],i=Object.getPrototypeOf,n=r.slice,o=r.flat?function(P){return r.flat.call(P)}:function(P){return r.concat.apply([],P)},s=r.push,l=r.indexOf,u={},h=u.toString,v=u.hasOwnProperty,T=v.toString,E=T.call(Object),M={},O=function(U){return typeof U=="function"&&typeof U.nodeType!="number"&&typeof U.item!="function"},F=function(U){return U!=null&&U===U.window},z=t.document,W={type:!0,src:!0,nonce:!0,noModule:!0};function J(P,U,G){G=G||z;var Q,le,ce=G.createElement("script");if(ce.text=P,U)for(Q in W)le=U[Q]||U.getAttribute&&U.getAttribute(Q),le&&ce.setAttribute(Q,le);G.head.appendChild(ce).parentNode.removeChild(ce)}function K(P){return P==null?P+"":typeof P=="object"||typeof P=="function"?u[h.call(P)]||"object":typeof P}var ne="3.7.1",ge=/HTML$/i,j=function(P,U){return new j.fn.init(P,U)};j.fn=j.prototype={jquery:ne,constructor:j,length:0,toArray:function(){return n.call(this)},get:function(P){return P==null?n.call(this):P<0?this[P+this.length]:this[P]},pushStack:function(P){var U=j.merge(this.constructor(),P);return U.prevObject=this,U},each:function(P){return j.each(this,P)},map:function(P){return this.pushStack(j.map(this,function(U,G){return P.call(U,G,U)}))},slice:function(){return this.pushStack(n.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(j.grep(this,function(P,U){return(U+1)%2}))},odd:function(){return this.pushStack(j.grep(this,function(P,U){return U%2}))},eq:function(P){var U=this.length,G=+P+(P<0?U:0);return this.pushStack(G>=0&&G<U?[this[G]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:r.sort,splice:r.splice},j.extend=j.fn.extend=function(){var P,U,G,Q,le,ce,_e=arguments[0]||{},Qe=1,qe=arguments.length,ct=!1;for(typeof _e=="boolean"&&(ct=_e,_e=arguments[Qe]||{},Qe++),typeof _e!="object"&&!O(_e)&&(_e={}),Qe===qe&&(_e=this,Qe--);Qe<qe;Qe++)if((P=arguments[Qe])!=null)for(U in P)Q=P[U],!(U==="__proto__"||_e===Q)&&(ct&&Q&&(j.isPlainObject(Q)||(le=Array.isArray(Q)))?(G=_e[U],le&&!Array.isArray(G)?ce=[]:!le&&!j.isPlainObject(G)?ce={}:ce=G,le=!1,_e[U]=j.extend(ct,ce,Q)):Q!==void 0&&(_e[U]=Q));return _e},j.extend({expando:"jQuery"+(ne+Math.random()).replace(/\D/g,""),isReady:!0,error:function(P){throw new Error(P)},noop:function(){},isPlainObject:function(P){var U,G;return!P||h.call(P)!=="[object Object]"?!1:(U=i(P),U?(G=v.call(U,"constructor")&&U.constructor,typeof G=="function"&&T.call(G)===E):!0)},isEmptyObject:function(P){var U;for(U in P)return!1;return!0},globalEval:function(P,U,G){J(P,{nonce:U&&U.nonce},G)},each:function(P,U){var G,Q=0;if(me(P))for(G=P.length;Q<G&&U.call(P[Q],Q,P[Q])!==!1;Q++);else for(Q in P)if(U.call(P[Q],Q,P[Q])===!1)break;return P},text:function(P){var U,G="",Q=0,le=P.nodeType;if(!le)for(;U=P[Q++];)G+=j.text(U);return le===1||le===11?P.textContent:le===9?P.documentElement.textContent:le===3||le===4?P.nodeValue:G},makeArray:function(P,U){var G=U||[];return P!=null&&(me(Object(P))?j.merge(G,typeof P=="string"?[P]:P):s.call(G,P)),G},inArray:function(P,U,G){return U==null?-1:l.call(U,P,G)},isXMLDoc:function(P){var U=P&&P.namespaceURI,G=P&&(P.ownerDocument||P).documentElement;return!ge.test(U||G&&G.nodeName||"HTML")},merge:function(P,U){for(var G=+U.length,Q=0,le=P.length;Q<G;Q++)P[le++]=U[Q];return P.length=le,P},grep:function(P,U,G){for(var Q,le=[],ce=0,_e=P.length,Qe=!G;ce<_e;ce++)Q=!U(P[ce],ce),Q!==Qe&&le.push(P[ce]);return le},map:function(P,U,G){var Q,le,ce=0,_e=[];if(me(P))for(Q=P.length;ce<Q;ce++)le=U(P[ce],ce,G),le!=null&&_e.push(le);else for(ce in P)le=U(P[ce],ce,G),le!=null&&_e.push(le);return o(_e)},guid:1,support:M}),typeof Symbol=="function"&&(j.fn[Symbol.iterator]=r[Symbol.iterator]),j.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(P,U){u["[object "+U+"]"]=U.toLowerCase()});function me(P){var U=!!P&&"length"in P&&P.length,G=K(P);return O(P)||F(P)?!1:G==="array"||U===0||typeof U=="number"&&U>0&&U-1 in P}function fe(P,U){return P.nodeName&&P.nodeName.toLowerCase()===U.toLowerCase()}var $=r.pop,Z=r.sort,we=r.splice,Oe="[\\x20\\t\\r\\n\\f]",he=new RegExp("^"+Oe+"+|((?:^|[^\\\\])(?:\\\\.)*)"+Oe+"+$","g");j.contains=function(P,U){var G=U&&U.parentNode;return P===G||!!(G&&G.nodeType===1&&(P.contains?P.contains(G):P.compareDocumentPosition&&P.compareDocumentPosition(G)&16))};var Le=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function ft(P,U){return U?P==="\0"?"\uFFFD":P.slice(0,-1)+"\\"+P.charCodeAt(P.length-1).toString(16)+" ":"\\"+P}j.escapeSelector=function(P){return(P+"").replace(Le,ft)};var Vt=z,Yt=s;(function(){var P,U,G,Q,le,ce=Yt,_e,Qe,qe,ct,Nt,jt=j.expando,dt=0,fr=0,mi=ha(),ut=ha(),St=ha(),cr=ha(),Xr=function(ze,st){return ze===st&&(le=!0),0},g="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ki="(?:\\\\[\\da-fA-F]{1,6}"+Oe+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",Wr="\\["+Oe+"*("+ki+")(?:"+Oe+"*([*^$|!~]?=)"+Oe+`*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(`+ki+"))|)"+Oe+"*\\]",Re=":("+ki+`)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|`+Wr+")*)|.*)\\)|)",Ti=new RegExp(Oe+"+","g"),An=new RegExp("^"+Oe+"*,"+Oe+"*"),Qn=new RegExp("^"+Oe+"*([>+~]|"+Oe+")"+Oe+"*"),En=new RegExp(Oe+"|>"),ln=new RegExp(Re),$n=new RegExp("^"+ki+"$"),ji={ID:new RegExp("^#("+ki+")"),CLASS:new RegExp("^\\.("+ki+")"),TAG:new RegExp("^("+ki+"|[*])"),ATTR:new RegExp("^"+Wr),PSEUDO:new RegExp("^"+Re),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+Oe+"*(even|odd|(([+-]|)(\\d*)n|)"+Oe+"*(?:([+-]|)"+Oe+"*(\\d+)|))"+Oe+"*\\)|)","i"),bool:new RegExp("^(?:"+g+")$","i"),needsContext:new RegExp("^"+Oe+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+Oe+"*((?:-\\d)?\\d*)"+Oe+"*\\)|)(?=[^-]|$)","i")},Gi=/^(?:input|select|textarea|button)$/i,an=/^h\d$/i,ea=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Yh=/[+~]/,Hs=new RegExp("\\\\[\\da-fA-F]{1,6}"+Oe+"?|\\\\([^\\r\\n\\f])","g"),Ko=function(ze,st){var Tt="0x"+ze.slice(1)-65536;return st||(Tt<0?String.fromCharCode(Tt+65536):String.fromCharCode(Tt>>10|55296,Tt&1023|56320))},fu=function(){Xl()},fl=Hc(function(ze){return ze.disabled===!0&&fe(ze,"fieldset")},{dir:"parentNode",next:"legend"});function hu(){try{return _e.activeElement}catch{}}try{ce.apply(r=n.call(Vt.childNodes),Vt.childNodes),r[Vt.childNodes.length].nodeType}catch{ce={apply:function(st,Tt){Yt.apply(st,n.call(Tt))},call:function(st){Yt.apply(st,n.call(arguments,1))}}}function Sn(ze,st,Tt,Lt){var Gt,_r,hr,yr,Lr,Fi,vr,jr=st&&st.ownerDocument,Ci=st?st.nodeType:9;if(Tt=Tt||[],typeof ze!="string"||!ze||Ci!==1&&Ci!==9&&Ci!==11)return Tt;if(!Lt&&(Xl(st),st=st||_e,qe)){if(Ci!==11&&(Lr=ea.exec(ze)))if(Gt=Lr[1]){if(Ci===9)if(hr=st.getElementById(Gt)){if(hr.id===Gt)return ce.call(Tt,hr),Tt}else return Tt;else if(jr&&(hr=jr.getElementById(Gt))&&Sn.contains(st,hr)&&hr.id===Gt)return ce.call(Tt,hr),Tt}else{if(Lr[2])return ce.apply(Tt,st.getElementsByTagName(ze)),Tt;if((Gt=Lr[3])&&st.getElementsByClassName)return ce.apply(Tt,st.getElementsByClassName(Gt)),Tt}if(!cr[ze+" "]&&(!ct||!ct.test(ze))){if(vr=ze,jr=st,Ci===1&&(En.test(ze)||Qn.test(ze))){for(jr=Yh.test(ze)&&Kf(st.parentNode)||st,(jr!=st||!M.scope)&&((yr=st.getAttribute("id"))?yr=j.escapeSelector(yr):st.setAttribute("id",yr=jt)),Fi=hl(ze),_r=Fi.length;_r--;)Fi[_r]=(yr?"#"+yr:":scope")+" "+hc(Fi[_r]);vr=Fi.join(",")}try{return ce.apply(Tt,jr.querySelectorAll(vr)),Tt}catch{cr(ze,!0)}finally{yr===jt&&st.removeAttribute("id")}}}return Vo(ze.replace(he,"$1"),st,Tt,Lt)}function ha(){var ze=[];function st(Tt,Lt){return ze.push(Tt+" ")>U.cacheLength&&delete st[ze.shift()],st[Tt+" "]=Lt}return st}function gi(ze){return ze[jt]=!0,ze}function Fe(ze){var st=_e.createElement("fieldset");try{return!!ze(st)}catch{return!1}finally{st.parentNode&&st.parentNode.removeChild(st),st=null}}function _i(ze){return function(st){return fe(st,"input")&&st.type===ze}}function Kh(ze){return function(st){return(fe(st,"input")||fe(st,"button"))&&st.type===ze}}function Vc(ze){return function(st){return"form"in st?st.parentNode&&st.disabled===!1?"label"in st?"label"in st.parentNode?st.parentNode.disabled===ze:st.disabled===ze:st.isDisabled===ze||st.isDisabled!==!ze&&fl(st)===ze:st.disabled===ze:"label"in st?st.disabled===ze:!1}}function Is(ze){return gi(function(st){return st=+st,gi(function(Tt,Lt){for(var Gt,_r=ze([],Tt.length,st),hr=_r.length;hr--;)Tt[Gt=_r[hr]]&&(Tt[Gt]=!(Lt[Gt]=Tt[Gt]))})})}function Kf(ze){return ze&&typeof ze.getElementsByTagName<"u"&&ze}function Xl(ze){var st,Tt=ze?ze.ownerDocument||ze:Vt;return Tt==_e||Tt.nodeType!==9||!Tt.documentElement||(_e=Tt,Qe=_e.documentElement,qe=!j.isXMLDoc(_e),Nt=Qe.matches||Qe.webkitMatchesSelector||Qe.msMatchesSelector,Qe.msMatchesSelector&&Vt!=_e&&(st=_e.defaultView)&&st.top!==st&&st.addEventListener("unload",fu),M.getById=Fe(function(Lt){return Qe.appendChild(Lt).id=j.expando,!_e.getElementsByName||!_e.getElementsByName(j.expando).length}),M.disconnectedMatch=Fe(function(Lt){return Nt.call(Lt,"*")}),M.scope=Fe(function(){return _e.querySelectorAll(":scope")}),M.cssHas=Fe(function(){try{return _e.querySelector(":has(*,:jqfake)"),!1}catch{return!0}}),M.getById?(U.filter.ID=function(Lt){var Gt=Lt.replace(Hs,Ko);return function(_r){return _r.getAttribute("id")===Gt}},U.find.ID=function(Lt,Gt){if(typeof Gt.getElementById<"u"&&qe){var _r=Gt.getElementById(Lt);return _r?[_r]:[]}}):(U.filter.ID=function(Lt){var Gt=Lt.replace(Hs,Ko);return function(_r){var hr=typeof _r.getAttributeNode<"u"&&_r.getAttributeNode("id");return hr&&hr.value===Gt}},U.find.ID=function(Lt,Gt){if(typeof Gt.getElementById<"u"&&qe){var _r,hr,yr,Lr=Gt.getElementById(Lt);if(Lr){if(_r=Lr.getAttributeNode("id"),_r&&_r.value===Lt)return[Lr];for(yr=Gt.getElementsByName(Lt),hr=0;Lr=yr[hr++];)if(_r=Lr.getAttributeNode("id"),_r&&_r.value===Lt)return[Lr]}return[]}}),U.find.TAG=function(Lt,Gt){return typeof Gt.getElementsByTagName<"u"?Gt.getElementsByTagName(Lt):Gt.querySelectorAll(Lt)},U.find.CLASS=function(Lt,Gt){if(typeof Gt.getElementsByClassName<"u"&&qe)return Gt.getElementsByClassName(Lt)},ct=[],Fe(function(Lt){var Gt;Qe.appendChild(Lt).innerHTML="<a id='"+jt+"' href='' disabled='disabled'></a><select id='"+jt+"-\r\\' disabled='disabled'><option selected=''></option></select>",Lt.querySelectorAll("[selected]").length||ct.push("\\["+Oe+"*(?:value|"+g+")"),Lt.querySelectorAll("[id~="+jt+"-]").length||ct.push("~="),Lt.querySelectorAll("a#"+jt+"+*").length||ct.push(".#.+[+~]"),Lt.querySelectorAll(":checked").length||ct.push(":checked"),Gt=_e.createElement("input"),Gt.setAttribute("type","hidden"),Lt.appendChild(Gt).setAttribute("name","D"),Qe.appendChild(Lt).disabled=!0,Lt.querySelectorAll(":disabled").length!==2&&ct.push(":enabled",":disabled"),Gt=_e.createElement("input"),Gt.setAttribute("name",""),Lt.appendChild(Gt),Lt.querySelectorAll("[name='']").length||ct.push("\\["+Oe+"*name"+Oe+"*="+Oe+`*(?:''|"")`)}),M.cssHas||ct.push(":has"),ct=ct.length&&new RegExp(ct.join("|")),Xr=function(Lt,Gt){if(Lt===Gt)return le=!0,0;var _r=!Lt.compareDocumentPosition-!Gt.compareDocumentPosition;return _r||(_r=(Lt.ownerDocument||Lt)==(Gt.ownerDocument||Gt)?Lt.compareDocumentPosition(Gt):1,_r&1||!M.sortDetached&&Gt.compareDocumentPosition(Lt)===_r?Lt===_e||Lt.ownerDocument==Vt&&Sn.contains(Vt,Lt)?-1:Gt===_e||Gt.ownerDocument==Vt&&Sn.contains(Vt,Gt)?1:Q?l.call(Q,Lt)-l.call(Q,Gt):0:_r&4?-1:1)}),_e}Sn.matches=function(ze,st){return Sn(ze,null,null,st)},Sn.matchesSelector=function(ze,st){if(Xl(ze),qe&&!cr[st+" "]&&(!ct||!ct.test(st)))try{var Tt=Nt.call(ze,st);if(Tt||M.disconnectedMatch||ze.document&&ze.document.nodeType!==11)return Tt}catch{cr(st,!0)}return Sn(st,_e,null,[ze]).length>0},Sn.contains=function(ze,st){return(ze.ownerDocument||ze)!=_e&&Xl(ze),j.contains(ze,st)},Sn.attr=function(ze,st){(ze.ownerDocument||ze)!=_e&&Xl(ze);var Tt=U.attrHandle[st.toLowerCase()],Lt=Tt&&v.call(U.attrHandle,st.toLowerCase())?Tt(ze,st,!qe):void 0;return Lt!==void 0?Lt:ze.getAttribute(st)},Sn.error=function(ze){throw new Error("Syntax error, unrecognized expression: "+ze)},j.uniqueSort=function(ze){var st,Tt=[],Lt=0,Gt=0;if(le=!M.sortStable,Q=!M.sortStable&&n.call(ze,0),Z.call(ze,Xr),le){for(;st=ze[Gt++];)st===ze[Gt]&&(Lt=Tt.push(Gt));for(;Lt--;)we.call(ze,Tt[Lt],1)}return Q=null,ze},j.fn.uniqueSort=function(){return this.pushStack(j.uniqueSort(n.apply(this)))},U=j.expr={cacheLength:50,createPseudo:gi,match:ji,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(ze){return ze[1]=ze[1].replace(Hs,Ko),ze[3]=(ze[3]||ze[4]||ze[5]||"").replace(Hs,Ko),ze[2]==="~="&&(ze[3]=" "+ze[3]+" "),ze.slice(0,4)},CHILD:function(ze){return ze[1]=ze[1].toLowerCase(),ze[1].slice(0,3)==="nth"?(ze[3]||Sn.error(ze[0]),ze[4]=+(ze[4]?ze[5]+(ze[6]||1):2*(ze[3]==="even"||ze[3]==="odd")),ze[5]=+(ze[7]+ze[8]||ze[3]==="odd")):ze[3]&&Sn.error(ze[0]),ze},PSEUDO:function(ze){var st,Tt=!ze[6]&&ze[2];return ji.CHILD.test(ze[0])?null:(ze[3]?ze[2]=ze[4]||ze[5]||"":Tt&&ln.test(Tt)&&(st=hl(Tt,!0))&&(st=Tt.indexOf(")",Tt.length-st)-Tt.length)&&(ze[0]=ze[0].slice(0,st),ze[2]=Tt.slice(0,st)),ze.slice(0,3))}},filter:{TAG:function(ze){var st=ze.replace(Hs,Ko).toLowerCase();return ze==="*"?function(){return!0}:function(Tt){return fe(Tt,st)}},CLASS:function(ze){var st=mi[ze+" "];return st||(st=new RegExp("(^|"+Oe+")"+ze+"("+Oe+"|$)"))&&mi(ze,function(Tt){return st.test(typeof Tt.className=="string"&&Tt.className||typeof Tt.getAttribute<"u"&&Tt.getAttribute("class")||"")})},ATTR:function(ze,st,Tt){return function(Lt){var Gt=Sn.attr(Lt,ze);return Gt==null?st==="!=":st?(Gt+="",st==="="?Gt===Tt:st==="!="?Gt!==Tt:st==="^="?Tt&&Gt.indexOf(Tt)===0:st==="*="?Tt&&Gt.indexOf(Tt)>-1:st==="$="?Tt&&Gt.slice(-Tt.length)===Tt:st==="~="?(" "+Gt.replace(Ti," ")+" ").indexOf(Tt)>-1:st==="|="?Gt===Tt||Gt.slice(0,Tt.length+1)===Tt+"-":!1):!0}},CHILD:function(ze,st,Tt,Lt,Gt){var _r=ze.slice(0,3)!=="nth",hr=ze.slice(-4)!=="last",yr=st==="of-type";return Lt===1&&Gt===0?function(Lr){return!!Lr.parentNode}:function(Lr,Fi,vr){var jr,Ci,fi,Mn,rs,js=_r!==hr?"nextSibling":"previousSibling",Va=Lr.parentNode,ta=yr&&Lr.nodeName.toLowerCase(),dl=!vr&&!yr,vo=!1;if(Va){if(_r){for(;js;){for(fi=Lr;fi=fi[js];)if(yr?fe(fi,ta):fi.nodeType===1)return!1;rs=js=ze==="only"&&!rs&&"nextSibling"}return!0}if(rs=[hr?Va.firstChild:Va.lastChild],hr&&dl){for(Ci=Va[jt]||(Va[jt]={}),jr=Ci[ze]||[],Mn=jr[0]===dt&&jr[1],vo=Mn&&jr[2],fi=Mn&&Va.childNodes[Mn];fi=++Mn&&fi&&fi[js]||(vo=Mn=0)||rs.pop();)if(fi.nodeType===1&&++vo&&fi===Lr){Ci[ze]=[dt,Mn,vo];break}}else if(dl&&(Ci=Lr[jt]||(Lr[jt]={}),jr=Ci[ze]||[],Mn=jr[0]===dt&&jr[1],vo=Mn),vo===!1)for(;(fi=++Mn&&fi&&fi[js]||(vo=Mn=0)||rs.pop())&&!((yr?fe(fi,ta):fi.nodeType===1)&&++vo&&(dl&&(Ci=fi[jt]||(fi[jt]={}),Ci[ze]=[dt,vo]),fi===Lr)););return vo-=Gt,vo===Lt||vo%Lt===0&&vo/Lt>=0}}},PSEUDO:function(ze,st){var Tt,Lt=U.pseudos[ze]||U.setFilters[ze.toLowerCase()]||Sn.error("unsupported pseudo: "+ze);return Lt[jt]?Lt(st):Lt.length>1?(Tt=[ze,ze,"",st],U.setFilters.hasOwnProperty(ze.toLowerCase())?gi(function(Gt,_r){for(var hr,yr=Lt(Gt,st),Lr=yr.length;Lr--;)hr=l.call(Gt,yr[Lr]),Gt[hr]=!(_r[hr]=yr[Lr])}):function(Gt){return Lt(Gt,0,Tt)}):Lt}},pseudos:{not:gi(function(ze){var st=[],Tt=[],Lt=za(ze.replace(he,"$1"));return Lt[jt]?gi(function(Gt,_r,hr,yr){for(var Lr,Fi=Lt(Gt,null,yr,[]),vr=Gt.length;vr--;)(Lr=Fi[vr])&&(Gt[vr]=!(_r[vr]=Lr))}):function(Gt,_r,hr){return st[0]=Gt,Lt(st,null,hr,Tt),st[0]=null,!Tt.pop()}}),has:gi(function(ze){return function(st){return Sn(ze,st).length>0}}),contains:gi(function(ze){return ze=ze.replace(Hs,Ko),function(st){return(st.textContent||j.text(st)).indexOf(ze)>-1}}),lang:gi(function(ze){return $n.test(ze||"")||Sn.error("unsupported lang: "+ze),ze=ze.replace(Hs,Ko).toLowerCase(),function(st){var Tt;do if(Tt=qe?st.lang:st.getAttribute("xml:lang")||st.getAttribute("lang"))return Tt=Tt.toLowerCase(),Tt===ze||Tt.indexOf(ze+"-")===0;while((st=st.parentNode)&&st.nodeType===1);return!1}}),target:function(ze){var st=t.location&&t.location.hash;return st&&st.slice(1)===ze.id},root:function(ze){return ze===Qe},focus:function(ze){return ze===hu()&&_e.hasFocus()&&!!(ze.type||ze.href||~ze.tabIndex)},enabled:Vc(!1),disabled:Vc(!0),checked:function(ze){return fe(ze,"input")&&!!ze.checked||fe(ze,"option")&&!!ze.selected},selected:function(ze){return ze.parentNode&&ze.parentNode.selectedIndex,ze.selected===!0},empty:function(ze){for(ze=ze.firstChild;ze;ze=ze.nextSibling)if(ze.nodeType<6)return!1;return!0},parent:function(ze){return!U.pseudos.empty(ze)},header:function(ze){return an.test(ze.nodeName)},input:function(ze){return Gi.test(ze.nodeName)},button:function(ze){return fe(ze,"input")&&ze.type==="button"||fe(ze,"button")},text:function(ze){var st;return fe(ze,"input")&&ze.type==="text"&&((st=ze.getAttribute("type"))==null||st.toLowerCase()==="text")},first:Is(function(){return[0]}),last:Is(function(ze,st){return[st-1]}),eq:Is(function(ze,st,Tt){return[Tt<0?Tt+st:Tt]}),even:Is(function(ze,st){for(var Tt=0;Tt<st;Tt+=2)ze.push(Tt);return ze}),odd:Is(function(ze,st){for(var Tt=1;Tt<st;Tt+=2)ze.push(Tt);return ze}),lt:Is(function(ze,st,Tt){var Lt;for(Tt<0?Lt=Tt+st:Tt>st?Lt=st:Lt=Tt;--Lt>=0;)ze.push(Lt);return ze}),gt:Is(function(ze,st,Tt){for(var Lt=Tt<0?Tt+st:Tt;++Lt<st;)ze.push(Lt);return ze})}},U.pseudos.nth=U.pseudos.eq;for(P in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})U.pseudos[P]=_i(P);for(P in{submit:!0,reset:!0})U.pseudos[P]=Kh(P);function Ie(){}Ie.prototype=U.filters=U.pseudos,U.setFilters=new Ie;function hl(ze,st){var Tt,Lt,Gt,_r,hr,yr,Lr,Fi=ut[ze+" "];if(Fi)return st?0:Fi.slice(0);for(hr=ze,yr=[],Lr=U.preFilter;hr;){(!Tt||(Lt=An.exec(hr)))&&(Lt&&(hr=hr.slice(Lt[0].length)||hr),yr.push(Gt=[])),Tt=!1,(Lt=Qn.exec(hr))&&(Tt=Lt.shift(),Gt.push({value:Tt,type:Lt[0].replace(he," ")}),hr=hr.slice(Tt.length));for(_r in U.filter)(Lt=ji[_r].exec(hr))&&(!Lr[_r]||(Lt=Lr[_r](Lt)))&&(Tt=Lt.shift(),Gt.push({value:Tt,type:_r,matches:Lt}),hr=hr.slice(Tt.length));if(!Tt)break}return st?hr.length:hr?Sn.error(ze):ut(ze,yr).slice(0)}function hc(ze){for(var st=0,Tt=ze.length,Lt="";st<Tt;st++)Lt+=ze[st].value;return Lt}function Hc(ze,st,Tt){var Lt=st.dir,Gt=st.next,_r=Gt||Lt,hr=Tt&&_r==="parentNode",yr=fr++;return st.first?function(Lr,Fi,vr){for(;Lr=Lr[Lt];)if(Lr.nodeType===1||hr)return ze(Lr,Fi,vr);return!1}:function(Lr,Fi,vr){var jr,Ci,fi=[dt,yr];if(vr){for(;Lr=Lr[Lt];)if((Lr.nodeType===1||hr)&&ze(Lr,Fi,vr))return!0}else for(;Lr=Lr[Lt];)if(Lr.nodeType===1||hr)if(Ci=Lr[jt]||(Lr[jt]={}),Gt&&fe(Lr,Gt))Lr=Lr[Lt]||Lr;else{if((jr=Ci[_r])&&jr[0]===dt&&jr[1]===yr)return fi[2]=jr[2];if(Ci[_r]=fi,fi[2]=ze(Lr,Fi,vr))return!0}return!1}}function rf(ze){return ze.length>1?function(st,Tt,Lt){for(var Gt=ze.length;Gt--;)if(!ze[Gt](st,Tt,Lt))return!1;return!0}:ze[0]}function Zf(ze,st,Tt){for(var Lt=0,Gt=st.length;Lt<Gt;Lt++)Sn(ze,st[Lt],Tt);return Tt}function Jf(ze,st,Tt,Lt,Gt){for(var _r,hr=[],yr=0,Lr=ze.length,Fi=st!=null;yr<Lr;yr++)(_r=ze[yr])&&(!Tt||Tt(_r,Lt,Gt))&&(hr.push(_r),Fi&&st.push(yr));return hr}function jc(ze,st,Tt,Lt,Gt,_r){return Lt&&!Lt[jt]&&(Lt=jc(Lt)),Gt&&!Gt[jt]&&(Gt=jc(Gt,_r)),gi(function(hr,yr,Lr,Fi){var vr,jr,Ci,fi,Mn=[],rs=[],js=yr.length,Va=hr||Zf(st||"*",Lr.nodeType?[Lr]:Lr,[]),ta=ze&&(hr||!st)?Jf(Va,Mn,ze,Lr,Fi):Va;if(Tt?(fi=Gt||(hr?ze:js||Lt)?[]:yr,Tt(ta,fi,Lr,Fi)):fi=ta,Lt)for(vr=Jf(fi,rs),Lt(vr,[],Lr,Fi),jr=vr.length;jr--;)(Ci=vr[jr])&&(fi[rs[jr]]=!(ta[rs[jr]]=Ci));if(hr){if(Gt||ze){if(Gt){for(vr=[],jr=fi.length;jr--;)(Ci=fi[jr])&&vr.push(ta[jr]=Ci);Gt(null,fi=[],vr,Fi)}for(jr=fi.length;jr--;)(Ci=fi[jr])&&(vr=Gt?l.call(hr,Ci):Mn[jr])>-1&&(hr[vr]=!(yr[vr]=Ci))}}else fi=Jf(fi===yr?fi.splice(js,fi.length):fi),Gt?Gt(null,yr,fi,Fi):ce.apply(yr,fi)})}function du(ze){for(var st,Tt,Lt,Gt=ze.length,_r=U.relative[ze[0].type],hr=_r||U.relative[" "],yr=_r?1:0,Lr=Hc(function(jr){return jr===st},hr,!0),Fi=Hc(function(jr){return l.call(st,jr)>-1},hr,!0),vr=[function(jr,Ci,fi){var Mn=!_r&&(fi||Ci!=G)||((st=Ci).nodeType?Lr(jr,Ci,fi):Fi(jr,Ci,fi));return st=null,Mn}];yr<Gt;yr++)if(Tt=U.relative[ze[yr].type])vr=[Hc(rf(vr),Tt)];else{if(Tt=U.filter[ze[yr].type].apply(null,ze[yr].matches),Tt[jt]){for(Lt=++yr;Lt<Gt&&!U.relative[ze[Lt].type];Lt++);return jc(yr>1&&rf(vr),yr>1&&hc(ze.slice(0,yr-1).concat({value:ze[yr-2].type===" "?"*":""})).replace(he,"$1"),Tt,yr<Lt&&du(ze.slice(yr,Lt)),Lt<Gt&&du(ze=ze.slice(Lt)),Lt<Gt&&hc(ze))}vr.push(Tt)}return rf(vr)}function Zh(ze,st){var Tt=st.length>0,Lt=ze.length>0,Gt=function(_r,hr,yr,Lr,Fi){var vr,jr,Ci,fi=0,Mn="0",rs=_r&&[],js=[],Va=G,ta=_r||Lt&&U.find.TAG("*",Fi),dl=dt+=Va==null?1:Math.random()||.1,vo=ta.length;for(Fi&&(G=hr==_e||hr||Fi);Mn!==vo&&(vr=ta[Mn])!=null;Mn++){if(Lt&&vr){for(jr=0,!hr&&vr.ownerDocument!=_e&&(Xl(vr),yr=!qe);Ci=ze[jr++];)if(Ci(vr,hr||_e,yr)){ce.call(Lr,vr);break}Fi&&(dt=dl)}Tt&&((vr=!Ci&&vr)&&fi--,_r&&rs.push(vr))}if(fi+=Mn,Tt&&Mn!==fi){for(jr=0;Ci=st[jr++];)Ci(rs,js,hr,yr);if(_r){if(fi>0)for(;Mn--;)rs[Mn]||js[Mn]||(js[Mn]=$.call(Lr));js=Jf(js)}ce.apply(Lr,js),Fi&&!_r&&js.length>0&&fi+st.length>1&&j.uniqueSort(Lr)}return Fi&&(dt=dl,G=Va),rs};return Tt?gi(Gt):Gt}function za(ze,st){var Tt,Lt=[],Gt=[],_r=St[ze+" "];if(!_r){for(st||(st=hl(ze)),Tt=st.length;Tt--;)_r=du(st[Tt]),_r[jt]?Lt.push(_r):Gt.push(_r);_r=St(ze,Zh(Gt,Lt)),_r.selector=ze}return _r}function Vo(ze,st,Tt,Lt){var Gt,_r,hr,yr,Lr,Fi=typeof ze=="function"&&ze,vr=!Lt&&hl(ze=Fi.selector||ze);if(Tt=Tt||[],vr.length===1){if(_r=vr[0]=vr[0].slice(0),_r.length>2&&(hr=_r[0]).type==="ID"&&st.nodeType===9&&qe&&U.relative[_r[1].type]){if(st=(U.find.ID(hr.matches[0].replace(Hs,Ko),st)||[])[0],st)Fi&&(st=st.parentNode);else return Tt;ze=ze.slice(_r.shift().value.length)}for(Gt=ji.needsContext.test(ze)?0:_r.length;Gt--&&(hr=_r[Gt],!U.relative[yr=hr.type]);)if((Lr=U.find[yr])&&(Lt=Lr(hr.matches[0].replace(Hs,Ko),Yh.test(_r[0].type)&&Kf(st.parentNode)||st))){if(_r.splice(Gt,1),ze=Lt.length&&hc(_r),!ze)return ce.apply(Tt,Lt),Tt;break}}return(Fi||za(ze,vr))(Lt,st,!qe,Tt,!st||Yh.test(ze)&&Kf(st.parentNode)||st),Tt}M.sortStable=jt.split("").sort(Xr).join("")===jt,Xl(),M.sortDetached=Fe(function(ze){return ze.compareDocumentPosition(_e.createElement("fieldset"))&1}),j.find=Sn,j.expr[":"]=j.expr.pseudos,j.unique=j.uniqueSort,Sn.compile=za,Sn.select=Vo,Sn.setDocument=Xl,Sn.tokenize=hl,Sn.escape=j.escapeSelector,Sn.getText=j.text,Sn.isXML=j.isXMLDoc,Sn.selectors=j.expr,Sn.support=j.support,Sn.uniqueSort=j.uniqueSort})();var mr=function(P,U,G){for(var Q=[],le=G!==void 0;(P=P[U])&&P.nodeType!==9;)if(P.nodeType===1){if(le&&j(P).is(G))break;Q.push(P)}return Q},Er=function(P,U){for(var G=[];P;P=P.nextSibling)P.nodeType===1&&P!==U&&G.push(P);return G},Jr=j.expr.match.needsContext,or=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function ai(P,U,G){return O(U)?j.grep(P,function(Q,le){return!!U.call(Q,le,Q)!==G}):U.nodeType?j.grep(P,function(Q){return Q===U!==G}):typeof U!="string"?j.grep(P,function(Q){return l.call(U,Q)>-1!==G}):j.filter(U,P,G)}j.filter=function(P,U,G){var Q=U[0];return G&&(P=":not("+P+")"),U.length===1&&Q.nodeType===1?j.find.matchesSelector(Q,P)?[Q]:[]:j.find.matches(P,j.grep(U,function(le){return le.nodeType===1}))},j.fn.extend({find:function(P){var U,G,Q=this.length,le=this;if(typeof P!="string")return this.pushStack(j(P).filter(function(){for(U=0;U<Q;U++)if(j.contains(le[U],this))return!0}));for(G=this.pushStack([]),U=0;U<Q;U++)j.find(P,le[U],G);return Q>1?j.uniqueSort(G):G},filter:function(P){return this.pushStack(ai(this,P||[],!1))},not:function(P){return this.pushStack(ai(this,P||[],!0))},is:function(P){return!!ai(this,typeof P=="string"&&Jr.test(P)?j(P):P||[],!1).length}});var Jt,qt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,wi=j.fn.init=function(P,U,G){var Q,le;if(!P)return this;if(G=G||Jt,typeof P=="string")if(P[0]==="<"&&P[P.length-1]===">"&&P.length>=3?Q=[null,P,null]:Q=qt.exec(P),Q&&(Q[1]||!U))if(Q[1]){if(U=U instanceof j?U[0]:U,j.merge(this,j.parseHTML(Q[1],U&&U.nodeType?U.ownerDocument||U:z,!0)),or.test(Q[1])&&j.isPlainObject(U))for(Q in U)O(this[Q])?this[Q](U[Q]):this.attr(Q,U[Q]);return this}else return le=z.getElementById(Q[2]),le&&(this[0]=le,this.length=1),this;else return!U||U.jquery?(U||G).find(P):this.constructor(U).find(P);else{if(P.nodeType)return this[0]=P,this.length=1,this;if(O(P))return G.ready!==void 0?G.ready(P):P(j)}return j.makeArray(P,this)};wi.prototype=j.fn,Jt=j(z);var ae=/^(?:parents|prev(?:Until|All))/,be={children:!0,contents:!0,next:!0,prev:!0};j.fn.extend({has:function(P){var U=j(P,this),G=U.length;return this.filter(function(){for(var Q=0;Q<G;Q++)if(j.contains(this,U[Q]))return!0})},closest:function(P,U){var G,Q=0,le=this.length,ce=[],_e=typeof P!="string"&&j(P);if(!Jr.test(P)){for(;Q<le;Q++)for(G=this[Q];G&&G!==U;G=G.parentNode)if(G.nodeType<11&&(_e?_e.index(G)>-1:G.nodeType===1&&j.find.matchesSelector(G,P))){ce.push(G);break}}return this.pushStack(ce.length>1?j.uniqueSort(ce):ce)},index:function(P){return P?typeof P=="string"?l.call(j(P),this[0]):l.call(this,P.jquery?P[0]:P):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(P,U){return this.pushStack(j.uniqueSort(j.merge(this.get(),j(P,U))))},addBack:function(P){return this.add(P==null?this.prevObject:this.prevObject.filter(P))}});function je(P,U){for(;(P=P[U])&&P.nodeType!==1;);return P}j.each({parent:function(P){var U=P.parentNode;return U&&U.nodeType!==11?U:null},parents:function(P){return mr(P,"parentNode")},parentsUntil:function(P,U,G){return mr(P,"parentNode",G)},next:function(P){return je(P,"nextSibling")},prev:function(P){return je(P,"previousSibling")},nextAll:function(P){return mr(P,"nextSibling")},prevAll:function(P){return mr(P,"previousSibling")},nextUntil:function(P,U,G){return mr(P,"nextSibling",G)},prevUntil:function(P,U,G){return mr(P,"previousSibling",G)},siblings:function(P){return Er((P.parentNode||{}).firstChild,P)},children:function(P){return Er(P.firstChild)},contents:function(P){return P.contentDocument!=null&&i(P.contentDocument)?P.contentDocument:(fe(P,"template")&&(P=P.content||P),j.merge([],P.childNodes))}},function(P,U){j.fn[P]=function(G,Q){var le=j.map(this,U,G);return P.slice(-5)!=="Until"&&(Q=G),Q&&typeof Q=="string"&&(le=j.filter(Q,le)),this.length>1&&(be[P]||j.uniqueSort(le),ae.test(P)&&le.reverse()),this.pushStack(le)}});var lt=/[^\x20\t\r\n\f]+/g;function Ft(P){var U={};return j.each(P.match(lt)||[],function(G,Q){U[Q]=!0}),U}j.Callbacks=function(P){P=typeof P=="string"?Ft(P):j.extend({},P);var U,G,Q,le,ce=[],_e=[],Qe=-1,qe=function(){for(le=le||P.once,Q=U=!0;_e.length;Qe=-1)for(G=_e.shift();++Qe<ce.length;)ce[Qe].apply(G[0],G[1])===!1&&P.stopOnFalse&&(Qe=ce.length,G=!1);P.memory||(G=!1),U=!1,le&&(G?ce=[]:ce="")},ct={add:function(){return ce&&(G&&!U&&(Qe=ce.length-1,_e.push(G)),function Nt(jt){j.each(jt,function(dt,fr){O(fr)?(!P.unique||!ct.has(fr))&&ce.push(fr):fr&&fr.length&&K(fr)!=="string"&&Nt(fr)})}(arguments),G&&!U&&qe()),this},remove:function(){return j.each(arguments,function(Nt,jt){for(var dt;(dt=j.inArray(jt,ce,dt))>-1;)ce.splice(dt,1),dt<=Qe&&Qe--}),this},has:function(Nt){return Nt?j.inArray(Nt,ce)>-1:ce.length>0},empty:function(){return ce&&(ce=[]),this},disable:function(){return le=_e=[],ce=G="",this},disabled:function(){return!ce},lock:function(){return le=_e=[],!G&&!U&&(ce=G=""),this},locked:function(){return!!le},fireWith:function(Nt,jt){return le||(jt=jt||[],jt=[Nt,jt.slice?jt.slice():jt],_e.push(jt),U||qe()),this},fire:function(){return ct.fireWith(this,arguments),this},fired:function(){return!!Q}};return ct};function wt(P){return P}function $r(P){throw P}function xi(P,U,G,Q){var le;try{P&&O(le=P.promise)?le.call(P).done(U).fail(G):P&&O(le=P.then)?le.call(P,U,G):U.apply(void 0,[P].slice(Q))}catch(ce){G.apply(void 0,[ce])}}j.extend({Deferred:function(P){var U=[["notify","progress",j.Callbacks("memory"),j.Callbacks("memory"),2],["resolve","done",j.Callbacks("once memory"),j.Callbacks("once memory"),0,"resolved"],["reject","fail",j.Callbacks("once memory"),j.Callbacks("once memory"),1,"rejected"]],G="pending",Q={state:function(){return G},always:function(){return le.done(arguments).fail(arguments),this},catch:function(ce){return Q.then(null,ce)},pipe:function(){var ce=arguments;return j.Deferred(function(_e){j.each(U,function(Qe,qe){var ct=O(ce[qe[4]])&&ce[qe[4]];le[qe[1]](function(){var Nt=ct&&ct.apply(this,arguments);Nt&&O(Nt.promise)?Nt.promise().progress(_e.notify).done(_e.resolve).fail(_e.reject):_e[qe[0]+"With"](this,ct?[Nt]:arguments)})}),ce=null}).promise()},then:function(ce,_e,Qe){var qe=0;function ct(Nt,jt,dt,fr){return function(){var mi=this,ut=arguments,St=function(){var Xr,g;if(!(Nt<qe)){if(Xr=dt.apply(mi,ut),Xr===jt.promise())throw new TypeError("Thenable self-resolution");g=Xr&&(typeof Xr=="object"||typeof Xr=="function")&&Xr.then,O(g)?fr?g.call(Xr,ct(qe,jt,wt,fr),ct(qe,jt,$r,fr)):(qe++,g.call(Xr,ct(qe,jt,wt,fr),ct(qe,jt,$r,fr),ct(qe,jt,wt,jt.notifyWith))):(dt!==wt&&(mi=void 0,ut=[Xr]),(fr||jt.resolveWith)(mi,ut))}},cr=fr?St:function(){try{St()}catch(Xr){j.Deferred.exceptionHook&&j.Deferred.exceptionHook(Xr,cr.error),Nt+1>=qe&&(dt!==$r&&(mi=void 0,ut=[Xr]),jt.rejectWith(mi,ut))}};Nt?cr():(j.Deferred.getErrorHook?cr.error=j.Deferred.getErrorHook():j.Deferred.getStackHook&&(cr.error=j.Deferred.getStackHook()),t.setTimeout(cr))}}return j.Deferred(function(Nt){U[0][3].add(ct(0,Nt,O(Qe)?Qe:wt,Nt.notifyWith)),U[1][3].add(ct(0,Nt,O(ce)?ce:wt)),U[2][3].add(ct(0,Nt,O(_e)?_e:$r))}).promise()},promise:function(ce){return ce!=null?j.extend(ce,Q):Q}},le={};return j.each(U,function(ce,_e){var Qe=_e[2],qe=_e[5];Q[_e[1]]=Qe.add,qe&&Qe.add(function(){G=qe},U[3-ce][2].disable,U[3-ce][3].disable,U[0][2].lock,U[0][3].lock),Qe.add(_e[3].fire),le[_e[0]]=function(){return le[_e[0]+"With"](this===le?void 0:this,arguments),this},le[_e[0]+"With"]=Qe.fireWith}),Q.promise(le),P&&P.call(le,le),le},when:function(P){var U=arguments.length,G=U,Q=Array(G),le=n.call(arguments),ce=j.Deferred(),_e=function(Qe){return function(qe){Q[Qe]=this,le[Qe]=arguments.length>1?n.call(arguments):qe,--U||ce.resolveWith(Q,le)}};if(U<=1&&(xi(P,ce.done(_e(G)).resolve,ce.reject,!U),ce.state()==="pending"||O(le[G]&&le[G].then)))return ce.then();for(;G--;)xi(le[G],_e(G),ce.reject);return ce.promise()}});var Ki=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;j.Deferred.exceptionHook=function(P,U){t.console&&t.console.warn&&P&&Ki.test(P.name)&&t.console.warn("jQuery.Deferred exception: "+P.message,P.stack,U)},j.readyException=function(P){t.setTimeout(function(){throw P})};var kn=j.Deferred();j.fn.ready=function(P){return kn.then(P).catch(function(U){j.readyException(U)}),this},j.extend({isReady:!1,readyWait:1,ready:function(P){(P===!0?--j.readyWait:j.isReady)||(j.isReady=!0,!(P!==!0&&--j.readyWait>0)&&kn.resolveWith(z,[j]))}}),j.ready.then=kn.then;function Zi(){z.removeEventListener("DOMContentLoaded",Zi),t.removeEventListener("load",Zi),j.ready()}z.readyState==="complete"||z.readyState!=="loading"&&!z.documentElement.doScroll?t.setTimeout(j.ready):(z.addEventListener("DOMContentLoaded",Zi),t.addEventListener("load",Zi));var Hi=function(P,U,G,Q,le,ce,_e){var Qe=0,qe=P.length,ct=G==null;if(K(G)==="object"){le=!0;for(Qe in G)Hi(P,U,Qe,G[Qe],!0,ce,_e)}else if(Q!==void 0&&(le=!0,O(Q)||(_e=!0),ct&&(_e?(U.call(P,Q),U=null):(ct=U,U=function(Nt,jt,dt){return ct.call(j(Nt),dt)})),U))for(;Qe<qe;Qe++)U(P[Qe],G,_e?Q:Q.call(P[Qe],Qe,U(P[Qe],G)));return le?P:ct?U.call(P):qe?U(P[0],G):ce},Un=/^-ms-/,No=/-([a-z])/g;function Ji(P,U){return U.toUpperCase()}function Bi(P){return P.replace(Un,"ms-").replace(No,Ji)}var yn=function(P){return P.nodeType===1||P.nodeType===9||!+P.nodeType};function po(){this.expando=j.expando+po.uid++}po.uid=1,po.prototype={cache:function(P){var U=P[this.expando];return U||(U={},yn(P)&&(P.nodeType?P[this.expando]=U:Object.defineProperty(P,this.expando,{value:U,configurable:!0}))),U},set:function(P,U,G){var Q,le=this.cache(P);if(typeof U=="string")le[Bi(U)]=G;else for(Q in U)le[Bi(Q)]=U[Q];return le},get:function(P,U){return U===void 0?this.cache(P):P[this.expando]&&P[this.expando][Bi(U)]},access:function(P,U,G){return U===void 0||U&&typeof U=="string"&&G===void 0?this.get(P,U):(this.set(P,U,G),G!==void 0?G:U)},remove:function(P,U){var G,Q=P[this.expando];if(Q!==void 0){if(U!==void 0)for(Array.isArray(U)?U=U.map(Bi):(U=Bi(U),U=U in Q?[U]:U.match(lt)||[]),G=U.length;G--;)delete Q[U[G]];(U===void 0||j.isEmptyObject(Q))&&(P.nodeType?P[this.expando]=void 0:delete P[this.expando])}},hasData:function(P){var U=P[this.expando];return U!==void 0&&!j.isEmptyObject(U)}};var kr=new po,dr=new po,Ur=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ci=/[A-Z]/g;function to(P){return P==="true"?!0:P==="false"?!1:P==="null"?null:P===+P+""?+P:Ur.test(P)?JSON.parse(P):P}function Dn(P,U,G){var Q;if(G===void 0&&P.nodeType===1)if(Q="data-"+U.replace(ci,"-$&").toLowerCase(),G=P.getAttribute(Q),typeof G=="string"){try{G=to(G)}catch{}dr.set(P,U,G)}else G=void 0;return G}j.extend({hasData:function(P){return dr.hasData(P)||kr.hasData(P)},data:function(P,U,G){return dr.access(P,U,G)},removeData:function(P,U){dr.remove(P,U)},_data:function(P,U,G){return kr.access(P,U,G)},_removeData:function(P,U){kr.remove(P,U)}}),j.fn.extend({data:function(P,U){var G,Q,le,ce=this[0],_e=ce&&ce.attributes;if(P===void 0){if(this.length&&(le=dr.get(ce),ce.nodeType===1&&!kr.get(ce,"hasDataAttrs"))){for(G=_e.length;G--;)_e[G]&&(Q=_e[G].name,Q.indexOf("data-")===0&&(Q=Bi(Q.slice(5)),Dn(ce,Q,le[Q])));kr.set(ce,"hasDataAttrs",!0)}return le}return typeof P=="object"?this.each(function(){dr.set(this,P)}):Hi(this,function(Qe){var qe;if(ce&&Qe===void 0)return qe=dr.get(ce,P),qe!==void 0||(qe=Dn(ce,P),qe!==void 0)?qe:void 0;this.each(function(){dr.set(this,P,Qe)})},null,U,arguments.length>1,null,!0)},removeData:function(P){return this.each(function(){dr.remove(this,P)})}}),j.extend({queue:function(P,U,G){var Q;if(P)return U=(U||"fx")+"queue",Q=kr.get(P,U),G&&(!Q||Array.isArray(G)?Q=kr.access(P,U,j.makeArray(G)):Q.push(G)),Q||[]},dequeue:function(P,U){U=U||"fx";var G=j.queue(P,U),Q=G.length,le=G.shift(),ce=j._queueHooks(P,U),_e=function(){j.dequeue(P,U)};le==="inprogress"&&(le=G.shift(),Q--),le&&(U==="fx"&&G.unshift("inprogress"),delete ce.stop,le.call(P,_e,ce)),!Q&&ce&&ce.empty.fire()},_queueHooks:function(P,U){var G=U+"queueHooks";return kr.get(P,G)||kr.access(P,G,{empty:j.Callbacks("once memory").add(function(){kr.remove(P,[U+"queue",G])})})}}),j.fn.extend({queue:function(P,U){var G=2;return typeof P!="string"&&(U=P,P="fx",G--),arguments.length<G?j.queue(this[0],P):U===void 0?this:this.each(function(){var Q=j.queue(this,P,U);j._queueHooks(this,P),P==="fx"&&Q[0]!=="inprogress"&&j.dequeue(this,P)})},dequeue:function(P){return this.each(function(){j.dequeue(this,P)})},clearQueue:function(P){return this.queue(P||"fx",[])},promise:function(P,U){var G,Q=1,le=j.Deferred(),ce=this,_e=this.length,Qe=function(){--Q||le.resolveWith(ce,[ce])};for(typeof P!="string"&&(U=P,P=void 0),P=P||"fx";_e--;)G=kr.get(ce[_e],P+"queueHooks"),G&&G.empty&&(Q++,G.empty.add(Qe));return Qe(),le.promise(U)}});var To=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Eo=new RegExp("^(?:([+-])=|)("+To+")([a-z%]*)$","i"),Xo=["Top","Right","Bottom","Left"],So=z.documentElement,Us=function(P){return j.contains(P.ownerDocument,P)},Fc={composed:!0};So.getRootNode&&(Us=function(P){return j.contains(P.ownerDocument,P)||P.getRootNode(Fc)===P.ownerDocument});var ql=function(P,U){return P=U||P,P.style.display==="none"||P.style.display===""&&Us(P)&&j.css(P,"display")==="none"};function sl(P,U,G,Q){var le,ce,_e=20,Qe=Q?function(){return Q.cur()}:function(){return j.css(P,U,"")},qe=Qe(),ct=G&&G[3]||(j.cssNumber[U]?"":"px"),Nt=P.nodeType&&(j.cssNumber[U]||ct!=="px"&&+qe)&&Eo.exec(j.css(P,U));if(Nt&&Nt[3]!==ct){for(qe=qe/2,ct=ct||Nt[3],Nt=+qe||1;_e--;)j.style(P,U,Nt+ct),(1-ce)*(1-(ce=Qe()/qe||.5))<=0&&(_e=0),Nt=Nt/ce;Nt=Nt*2,j.style(P,U,Nt+ct),G=G||[]}return G&&(Nt=+Nt||+qe||0,le=G[1]?Nt+(G[1]+1)*G[2]:+G[2],Q&&(Q.unit=ct,Q.start=Nt,Q.end=le)),le}var Cl={};function al(P){var U,G=P.ownerDocument,Q=P.nodeName,le=Cl[Q];return le||(U=G.body.appendChild(G.createElement(Q)),le=j.css(U,"display"),U.parentNode.removeChild(U),le==="none"&&(le="block"),Cl[Q]=le,le)}function Ms(P,U){for(var G,Q,le=[],ce=0,_e=P.length;ce<_e;ce++)Q=P[ce],Q.style&&(G=Q.style.display,U?(G==="none"&&(le[ce]=kr.get(Q,"display")||null,le[ce]||(Q.style.display="")),Q.style.display===""&&ql(Q)&&(le[ce]=al(Q))):G!=="none"&&(le[ce]="none",kr.set(Q,"display",G)));for(ce=0;ce<_e;ce++)le[ce]!=null&&(P[ce].style.display=le[ce]);return P}j.fn.extend({show:function(){return Ms(this,!0)},hide:function(){return Ms(this)},toggle:function(P){return typeof P=="boolean"?P?this.show():this.hide():this.each(function(){ql(this)?j(this).show():j(this).hide()})}});var ca=/^(?:checkbox|radio)$/i,Ml=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,ao=/^$|^module$|\/(?:java|ecma)script/i;(function(){var P=z.createDocumentFragment(),U=P.appendChild(z.createElement("div")),G=z.createElement("input");G.setAttribute("type","radio"),G.setAttribute("checked","checked"),G.setAttribute("name","t"),U.appendChild(G),M.checkClone=U.cloneNode(!0).cloneNode(!0).lastChild.checked,U.innerHTML="<textarea>x</textarea>",M.noCloneChecked=!!U.cloneNode(!0).lastChild.defaultValue,U.innerHTML="<option></option>",M.option=!!U.lastChild})();var oe={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};oe.tbody=oe.tfoot=oe.colgroup=oe.caption=oe.thead,oe.th=oe.td,M.option||(oe.optgroup=oe.option=[1,"<select multiple='multiple'>","</select>"]);function de(P,U){var G;return typeof P.getElementsByTagName<"u"?G=P.getElementsByTagName(U||"*"):typeof P.querySelectorAll<"u"?G=P.querySelectorAll(U||"*"):G=[],U===void 0||U&&fe(P,U)?j.merge([P],G):G}function ve(P,U){for(var G=0,Q=P.length;G<Q;G++)kr.set(P[G],"globalEval",!U||kr.get(U[G],"globalEval"))}var Pe=/<|&#?\w+;/;function ye(P,U,G,Q,le){for(var ce,_e,Qe,qe,ct,Nt,jt=U.createDocumentFragment(),dt=[],fr=0,mi=P.length;fr<mi;fr++)if(ce=P[fr],ce||ce===0)if(K(ce)==="object")j.merge(dt,ce.nodeType?[ce]:ce);else if(!Pe.test(ce))dt.push(U.createTextNode(ce));else{for(_e=_e||jt.appendChild(U.createElement("div")),Qe=(Ml.exec(ce)||["",""])[1].toLowerCase(),qe=oe[Qe]||oe._default,_e.innerHTML=qe[1]+j.htmlPrefilter(ce)+qe[2],Nt=qe[0];Nt--;)_e=_e.lastChild;j.merge(dt,_e.childNodes),_e=jt.firstChild,_e.textContent=""}for(jt.textContent="",fr=0;ce=dt[fr++];){if(Q&&j.inArray(ce,Q)>-1){le&&le.push(ce);continue}if(ct=Us(ce),_e=de(jt.appendChild(ce),"script"),ct&&ve(_e),G)for(Nt=0;ce=_e[Nt++];)ao.test(ce.type||"")&&G.push(ce)}return jt}var tt=/^([^.]*)(?:\.(.+)|)/;function rt(){return!0}function Se(){return!1}function Ge(P,U,G,Q,le,ce){var _e,Qe;if(typeof U=="object"){typeof G!="string"&&(Q=Q||G,G=void 0);for(Qe in U)Ge(P,Qe,G,Q,U[Qe],ce);return P}if(Q==null&&le==null?(le=G,Q=G=void 0):le==null&&(typeof G=="string"?(le=Q,Q=void 0):(le=Q,Q=G,G=void 0)),le===!1)le=Se;else if(!le)return P;return ce===1&&(_e=le,le=function(qe){return j().off(qe),_e.apply(this,arguments)},le.guid=_e.guid||(_e.guid=j.guid++)),P.each(function(){j.event.add(this,U,le,Q,G)})}j.event={global:{},add:function(P,U,G,Q,le){var ce,_e,Qe,qe,ct,Nt,jt,dt,fr,mi,ut,St=kr.get(P);if(yn(P))for(G.handler&&(ce=G,G=ce.handler,le=ce.selector),le&&j.find.matchesSelector(So,le),G.guid||(G.guid=j.guid++),(qe=St.events)||(qe=St.events=Object.create(null)),(_e=St.handle)||(_e=St.handle=function(cr){return typeof j<"u"&&j.event.triggered!==cr.type?j.event.dispatch.apply(P,arguments):void 0}),U=(U||"").match(lt)||[""],ct=U.length;ct--;)Qe=tt.exec(U[ct])||[],fr=ut=Qe[1],mi=(Qe[2]||"").split(".").sort(),fr&&(jt=j.event.special[fr]||{},fr=(le?jt.delegateType:jt.bindType)||fr,jt=j.event.special[fr]||{},Nt=j.extend({type:fr,origType:ut,data:Q,handler:G,guid:G.guid,selector:le,needsContext:le&&j.expr.match.needsContext.test(le),namespace:mi.join(".")},ce),(dt=qe[fr])||(dt=qe[fr]=[],dt.delegateCount=0,(!jt.setup||jt.setup.call(P,Q,mi,_e)===!1)&&P.addEventListener&&P.addEventListener(fr,_e)),jt.add&&(jt.add.call(P,Nt),Nt.handler.guid||(Nt.handler.guid=G.guid)),le?dt.splice(dt.delegateCount++,0,Nt):dt.push(Nt),j.event.global[fr]=!0)},remove:function(P,U,G,Q,le){var ce,_e,Qe,qe,ct,Nt,jt,dt,fr,mi,ut,St=kr.hasData(P)&&kr.get(P);if(!(!St||!(qe=St.events))){for(U=(U||"").match(lt)||[""],ct=U.length;ct--;){if(Qe=tt.exec(U[ct])||[],fr=ut=Qe[1],mi=(Qe[2]||"").split(".").sort(),!fr){for(fr in qe)j.event.remove(P,fr+U[ct],G,Q,!0);continue}for(jt=j.event.special[fr]||{},fr=(Q?jt.delegateType:jt.bindType)||fr,dt=qe[fr]||[],Qe=Qe[2]&&new RegExp("(^|\\.)"+mi.join("\\.(?:.*\\.|)")+"(\\.|$)"),_e=ce=dt.length;ce--;)Nt=dt[ce],(le||ut===Nt.origType)&&(!G||G.guid===Nt.guid)&&(!Qe||Qe.test(Nt.namespace))&&(!Q||Q===Nt.selector||Q==="**"&&Nt.selector)&&(dt.splice(ce,1),Nt.selector&&dt.delegateCount--,jt.remove&&jt.remove.call(P,Nt));_e&&!dt.length&&((!jt.teardown||jt.teardown.call(P,mi,St.handle)===!1)&&j.removeEvent(P,fr,St.handle),delete qe[fr])}j.isEmptyObject(qe)&&kr.remove(P,"handle events")}},dispatch:function(P){var U,G,Q,le,ce,_e,Qe=new Array(arguments.length),qe=j.event.fix(P),ct=(kr.get(this,"events")||Object.create(null))[qe.type]||[],Nt=j.event.special[qe.type]||{};for(Qe[0]=qe,U=1;U<arguments.length;U++)Qe[U]=arguments[U];if(qe.delegateTarget=this,!(Nt.preDispatch&&Nt.preDispatch.call(this,qe)===!1)){for(_e=j.event.handlers.call(this,qe,ct),U=0;(le=_e[U++])&&!qe.isPropagationStopped();)for(qe.currentTarget=le.elem,G=0;(ce=le.handlers[G++])&&!qe.isImmediatePropagationStopped();)(!qe.rnamespace||ce.namespace===!1||qe.rnamespace.test(ce.namespace))&&(qe.handleObj=ce,qe.data=ce.data,Q=((j.event.special[ce.origType]||{}).handle||ce.handler).apply(le.elem,Qe),Q!==void 0&&(qe.result=Q)===!1&&(qe.preventDefault(),qe.stopPropagation()));return Nt.postDispatch&&Nt.postDispatch.call(this,qe),qe.result}},handlers:function(P,U){var G,Q,le,ce,_e,Qe=[],qe=U.delegateCount,ct=P.target;if(qe&&ct.nodeType&&!(P.type==="click"&&P.button>=1)){for(;ct!==this;ct=ct.parentNode||this)if(ct.nodeType===1&&!(P.type==="click"&&ct.disabled===!0)){for(ce=[],_e={},G=0;G<qe;G++)Q=U[G],le=Q.selector+" ",_e[le]===void 0&&(_e[le]=Q.needsContext?j(le,this).index(ct)>-1:j.find(le,this,null,[ct]).length),_e[le]&&ce.push(Q);ce.length&&Qe.push({elem:ct,handlers:ce})}}return ct=this,qe<U.length&&Qe.push({elem:ct,handlers:U.slice(qe)}),Qe},addProp:function(P,U){Object.defineProperty(j.Event.prototype,P,{enumerable:!0,configurable:!0,get:O(U)?function(){if(this.originalEvent)return U(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[P]},set:function(G){Object.defineProperty(this,P,{enumerable:!0,configurable:!0,writable:!0,value:G})}})},fix:function(P){return P[j.expando]?P:new j.Event(P)},special:{load:{noBubble:!0},click:{setup:function(P){var U=this||P;return ca.test(U.type)&&U.click&&fe(U,"input")&&ht(U,"click",!0),!1},trigger:function(P){var U=this||P;return ca.test(U.type)&&U.click&&fe(U,"input")&&ht(U,"click"),!0},_default:function(P){var U=P.target;return ca.test(U.type)&&U.click&&fe(U,"input")&&kr.get(U,"click")||fe(U,"a")}},beforeunload:{postDispatch:function(P){P.result!==void 0&&P.originalEvent&&(P.originalEvent.returnValue=P.result)}}}};function ht(P,U,G){if(!G){kr.get(P,U)===void 0&&j.event.add(P,U,rt);return}kr.set(P,U,!1),j.event.add(P,U,{namespace:!1,handler:function(Q){var le,ce=kr.get(this,U);if(Q.isTrigger&1&&this[U]){if(ce)(j.event.special[U]||{}).delegateType&&Q.stopPropagation();else if(ce=n.call(arguments),kr.set(this,U,ce),this[U](),le=kr.get(this,U),kr.set(this,U,!1),ce!==le)return Q.stopImmediatePropagation(),Q.preventDefault(),le}else ce&&(kr.set(this,U,j.event.trigger(ce[0],ce.slice(1),this)),Q.stopPropagation(),Q.isImmediatePropagationStopped=rt)}})}j.removeEvent=function(P,U,G){P.removeEventListener&&P.removeEventListener(U,G)},j.Event=function(P,U){if(!(this instanceof j.Event))return new j.Event(P,U);P&&P.type?(this.originalEvent=P,this.type=P.type,this.isDefaultPrevented=P.defaultPrevented||P.defaultPrevented===void 0&&P.returnValue===!1?rt:Se,this.target=P.target&&P.target.nodeType===3?P.target.parentNode:P.target,this.currentTarget=P.currentTarget,this.relatedTarget=P.relatedTarget):this.type=P,U&&j.extend(this,U),this.timeStamp=P&&P.timeStamp||Date.now(),this[j.expando]=!0},j.Event.prototype={constructor:j.Event,isDefaultPrevented:Se,isPropagationStopped:Se,isImmediatePropagationStopped:Se,isSimulated:!1,preventDefault:function(){var P=this.originalEvent;this.isDefaultPrevented=rt,P&&!this.isSimulated&&P.preventDefault()},stopPropagation:function(){var P=this.originalEvent;this.isPropagationStopped=rt,P&&!this.isSimulated&&P.stopPropagation()},stopImmediatePropagation:function(){var P=this.originalEvent;this.isImmediatePropagationStopped=rt,P&&!this.isSimulated&&P.stopImmediatePropagation(),this.stopPropagation()}},j.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},j.event.addProp),j.each({focus:"focusin",blur:"focusout"},function(P,U){function G(Q){if(z.documentMode){var le=kr.get(this,"handle"),ce=j.event.fix(Q);ce.type=Q.type==="focusin"?"focus":"blur",ce.isSimulated=!0,le(Q),ce.target===ce.currentTarget&&le(ce)}else j.event.simulate(U,Q.target,j.event.fix(Q))}j.event.special[P]={setup:function(){var Q;if(ht(this,P,!0),z.documentMode)Q=kr.get(this,U),Q||this.addEventListener(U,G),kr.set(this,U,(Q||0)+1);else return!1},trigger:function(){return ht(this,P),!0},teardown:function(){var Q;if(z.documentMode)Q=kr.get(this,U)-1,Q?kr.set(this,U,Q):(this.removeEventListener(U,G),kr.remove(this,U));else return!1},_default:function(Q){return kr.get(Q.target,P)},delegateType:U},j.event.special[U]={setup:function(){var Q=this.ownerDocument||this.document||this,le=z.documentMode?this:Q,ce=kr.get(le,U);ce||(z.documentMode?this.addEventListener(U,G):Q.addEventListener(P,G,!0)),kr.set(le,U,(ce||0)+1)},teardown:function(){var Q=this.ownerDocument||this.document||this,le=z.documentMode?this:Q,ce=kr.get(le,U)-1;ce?kr.set(le,U,ce):(z.documentMode?this.removeEventListener(U,G):Q.removeEventListener(P,G,!0),kr.remove(le,U))}}}),j.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(P,U){j.event.special[P]={delegateType:U,bindType:U,handle:function(G){var Q,le=this,ce=G.relatedTarget,_e=G.handleObj;return(!ce||ce!==le&&!j.contains(le,ce))&&(G.type=_e.origType,Q=_e.handler.apply(this,arguments),G.type=U),Q}}}),j.fn.extend({on:function(P,U,G,Q){return Ge(this,P,U,G,Q)},one:function(P,U,G,Q){return Ge(this,P,U,G,Q,1)},off:function(P,U,G){var Q,le;if(P&&P.preventDefault&&P.handleObj)return Q=P.handleObj,j(P.delegateTarget).off(Q.namespace?Q.origType+"."+Q.namespace:Q.origType,Q.selector,Q.handler),this;if(typeof P=="object"){for(le in P)this.off(le,U,P[le]);return this}return(U===!1||typeof U=="function")&&(G=U,U=void 0),G===!1&&(G=Se),this.each(function(){j.event.remove(this,P,G,U)})}});var Ht=/<script|<style|<link/i,Zt=/checked\s*(?:[^=]|=\s*.checked.)/i,Pt=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function Xt(P,U){return fe(P,"table")&&fe(U.nodeType!==11?U:U.firstChild,"tr")&&j(P).children("tbody")[0]||P}function Dr(P){return P.type=(P.getAttribute("type")!==null)+"/"+P.type,P}function Mr(P){return(P.type||"").slice(0,5)==="true/"?P.type=P.type.slice(5):P.removeAttribute("type"),P}function Ot(P,U){var G,Q,le,ce,_e,Qe,qe;if(U.nodeType===1){if(kr.hasData(P)&&(ce=kr.get(P),qe=ce.events,qe)){kr.remove(U,"handle events");for(le in qe)for(G=0,Q=qe[le].length;G<Q;G++)j.event.add(U,le,qe[le][G])}dr.hasData(P)&&(_e=dr.access(P),Qe=j.extend({},_e),dr.set(U,Qe))}}function br(P,U){var G=U.nodeName.toLowerCase();G==="input"&&ca.test(P.type)?U.checked=P.checked:(G==="input"||G==="textarea")&&(U.defaultValue=P.defaultValue)}function sr(P,U,G,Q){U=o(U);var le,ce,_e,Qe,qe,ct,Nt=0,jt=P.length,dt=jt-1,fr=U[0],mi=O(fr);if(mi||jt>1&&typeof fr=="string"&&!M.checkClone&&Zt.test(fr))return P.each(function(ut){var St=P.eq(ut);mi&&(U[0]=fr.call(this,ut,St.html())),sr(St,U,G,Q)});if(jt&&(le=ye(U,P[0].ownerDocument,!1,P,Q),ce=le.firstChild,le.childNodes.length===1&&(le=ce),ce||Q)){for(_e=j.map(de(le,"script"),Dr),Qe=_e.length;Nt<jt;Nt++)qe=le,Nt!==dt&&(qe=j.clone(qe,!0,!0),Qe&&j.merge(_e,de(qe,"script"))),G.call(P[Nt],qe,Nt);if(Qe)for(ct=_e[_e.length-1].ownerDocument,j.map(_e,Mr),Nt=0;Nt<Qe;Nt++)qe=_e[Nt],ao.test(qe.type||"")&&!kr.access(qe,"globalEval")&&j.contains(ct,qe)&&(qe.src&&(qe.type||"").toLowerCase()!=="module"?j._evalUrl&&!qe.noModule&&j._evalUrl(qe.src,{nonce:qe.nonce||qe.getAttribute("nonce")},ct):J(qe.textContent.replace(Pt,""),qe,ct))}return P}function lr(P,U,G){for(var Q,le=U?j.filter(U,P):P,ce=0;(Q=le[ce])!=null;ce++)!G&&Q.nodeType===1&&j.cleanData(de(Q)),Q.parentNode&&(G&&Us(Q)&&ve(de(Q,"script")),Q.parentNode.removeChild(Q));return P}j.extend({htmlPrefilter:function(P){return P},clone:function(P,U,G){var Q,le,ce,_e,Qe=P.cloneNode(!0),qe=Us(P);if(!M.noCloneChecked&&(P.nodeType===1||P.nodeType===11)&&!j.isXMLDoc(P))for(_e=de(Qe),ce=de(P),Q=0,le=ce.length;Q<le;Q++)br(ce[Q],_e[Q]);if(U)if(G)for(ce=ce||de(P),_e=_e||de(Qe),Q=0,le=ce.length;Q<le;Q++)Ot(ce[Q],_e[Q]);else Ot(P,Qe);return _e=de(Qe,"script"),_e.length>0&&ve(_e,!qe&&de(P,"script")),Qe},cleanData:function(P){for(var U,G,Q,le=j.event.special,ce=0;(G=P[ce])!==void 0;ce++)if(yn(G)){if(U=G[kr.expando]){if(U.events)for(Q in U.events)le[Q]?j.event.remove(G,Q):j.removeEvent(G,Q,U.handle);G[kr.expando]=void 0}G[dr.expando]&&(G[dr.expando]=void 0)}}}),j.fn.extend({detach:function(P){return lr(this,P,!0)},remove:function(P){return lr(this,P)},text:function(P){return Hi(this,function(U){return U===void 0?j.text(this):this.empty().each(function(){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&(this.textContent=U)})},null,P,arguments.length)},append:function(){return sr(this,arguments,function(P){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var U=Xt(this,P);U.appendChild(P)}})},prepend:function(){return sr(this,arguments,function(P){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var U=Xt(this,P);U.insertBefore(P,U.firstChild)}})},before:function(){return sr(this,arguments,function(P){this.parentNode&&this.parentNode.insertBefore(P,this)})},after:function(){return sr(this,arguments,function(P){this.parentNode&&this.parentNode.insertBefore(P,this.nextSibling)})},empty:function(){for(var P,U=0;(P=this[U])!=null;U++)P.nodeType===1&&(j.cleanData(de(P,!1)),P.textContent="");return this},clone:function(P,U){return P=P??!1,U=U??P,this.map(function(){return j.clone(this,P,U)})},html:function(P){return Hi(this,function(U){var G=this[0]||{},Q=0,le=this.length;if(U===void 0&&G.nodeType===1)return G.innerHTML;if(typeof U=="string"&&!Ht.test(U)&&!oe[(Ml.exec(U)||["",""])[1].toLowerCase()]){U=j.htmlPrefilter(U);try{for(;Q<le;Q++)G=this[Q]||{},G.nodeType===1&&(j.cleanData(de(G,!1)),G.innerHTML=U);G=0}catch{}}G&&this.empty().append(U)},null,P,arguments.length)},replaceWith:function(){var P=[];return sr(this,arguments,function(U){var G=this.parentNode;j.inArray(this,P)<0&&(j.cleanData(de(this)),G&&G.replaceChild(U,this))},P)}}),j.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(P,U){j.fn[P]=function(G){for(var Q,le=[],ce=j(G),_e=ce.length-1,Qe=0;Qe<=_e;Qe++)Q=Qe===_e?this:this.clone(!0),j(ce[Qe])[U](Q),s.apply(le,Q.get());return this.pushStack(le)}});var bi=new RegExp("^("+To+")(?!px)[a-z%]+$","i"),pr=/^--/,Ii=function(P){var U=P.ownerDocument.defaultView;return(!U||!U.opener)&&(U=t),U.getComputedStyle(P)},vn=function(P,U,G){var Q,le,ce={};for(le in U)ce[le]=P.style[le],P.style[le]=U[le];Q=G.call(P);for(le in U)P.style[le]=ce[le];return Q},Di=new RegExp(Xo.join("|"),"i");(function(){function P(){if(ct){qe.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",ct.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",So.appendChild(qe).appendChild(ct);var Nt=t.getComputedStyle(ct);G=Nt.top!=="1%",Qe=U(Nt.marginLeft)===12,ct.style.right="60%",ce=U(Nt.right)===36,Q=U(Nt.width)===36,ct.style.position="absolute",le=U(ct.offsetWidth/3)===12,So.removeChild(qe),ct=null}}function U(Nt){return Math.round(parseFloat(Nt))}var G,Q,le,ce,_e,Qe,qe=z.createElement("div"),ct=z.createElement("div");ct.style&&(ct.style.backgroundClip="content-box",ct.cloneNode(!0).style.backgroundClip="",M.clearCloneStyle=ct.style.backgroundClip==="content-box",j.extend(M,{boxSizingReliable:function(){return P(),Q},pixelBoxStyles:function(){return P(),ce},pixelPosition:function(){return P(),G},reliableMarginLeft:function(){return P(),Qe},scrollboxSize:function(){return P(),le},reliableTrDimensions:function(){var Nt,jt,dt,fr;return _e==null&&(Nt=z.createElement("table"),jt=z.createElement("tr"),dt=z.createElement("div"),Nt.style.cssText="position:absolute;left:-11111px;border-collapse:separate",jt.style.cssText="box-sizing:content-box;border:1px solid",jt.style.height="1px",dt.style.height="9px",dt.style.display="block",So.appendChild(Nt).appendChild(jt).appendChild(dt),fr=t.getComputedStyle(jt),_e=parseInt(fr.height,10)+parseInt(fr.borderTopWidth,10)+parseInt(fr.borderBottomWidth,10)===jt.offsetHeight,So.removeChild(Nt)),_e}}))})();function Qi(P,U,G){var Q,le,ce,_e,Qe=pr.test(U),qe=P.style;return G=G||Ii(P),G&&(_e=G.getPropertyValue(U)||G[U],Qe&&_e&&(_e=_e.replace(he,"$1")||void 0),_e===""&&!Us(P)&&(_e=j.style(P,U)),!M.pixelBoxStyles()&&bi.test(_e)&&Di.test(U)&&(Q=qe.width,le=qe.minWidth,ce=qe.maxWidth,qe.minWidth=qe.maxWidth=qe.width=_e,_e=G.width,qe.width=Q,qe.minWidth=le,qe.maxWidth=ce)),_e!==void 0?_e+"":_e}function Li(P,U){return{get:function(){if(P()){delete this.get;return}return(this.get=U).apply(this,arguments)}}}var Xn=["Webkit","Moz","ms"],$i=z.createElement("div").style,Ln={};function en(P){for(var U=P[0].toUpperCase()+P.slice(1),G=Xn.length;G--;)if(P=Xn[G]+U,P in $i)return P}function Si(P){var U=j.cssProps[P]||Ln[P];return U||(P in $i?P:Ln[P]=en(P)||P)}var Oi=/^(none|table(?!-c[ea]).+)/,yo={position:"absolute",visibility:"hidden",display:"block"},fc={letterSpacing:"0",fontWeight:"400"};function ko(P,U,G){var Q=Eo.exec(U);return Q?Math.max(0,Q[2]-(G||0))+(Q[3]||"px"):U}function Yo(P,U,G,Q,le,ce){var _e=U==="width"?1:0,Qe=0,qe=0,ct=0;if(G===(Q?"border":"content"))return 0;for(;_e<4;_e+=2)G==="margin"&&(ct+=j.css(P,G+Xo[_e],!0,le)),Q?(G==="content"&&(qe-=j.css(P,"padding"+Xo[_e],!0,le)),G!=="margin"&&(qe-=j.css(P,"border"+Xo[_e]+"Width",!0,le))):(qe+=j.css(P,"padding"+Xo[_e],!0,le),G!=="padding"?qe+=j.css(P,"border"+Xo[_e]+"Width",!0,le):Qe+=j.css(P,"border"+Xo[_e]+"Width",!0,le));return!Q&&ce>=0&&(qe+=Math.max(0,Math.ceil(P["offset"+U[0].toUpperCase()+U.slice(1)]-ce-qe-Qe-.5))||0),qe+ct}function zs(P,U,G){var Q=Ii(P),le=!M.boxSizingReliable()||G,ce=le&&j.css(P,"boxSizing",!1,Q)==="border-box",_e=ce,Qe=Qi(P,U,Q),qe="offset"+U[0].toUpperCase()+U.slice(1);if(bi.test(Qe)){if(!G)return Qe;Qe="auto"}return(!M.boxSizingReliable()&&ce||!M.reliableTrDimensions()&&fe(P,"tr")||Qe==="auto"||!parseFloat(Qe)&&j.css(P,"display",!1,Q)==="inline")&&P.getClientRects().length&&(ce=j.css(P,"boxSizing",!1,Q)==="border-box",_e=qe in P,_e&&(Qe=P[qe])),Qe=parseFloat(Qe)||0,Qe+Yo(P,U,G||(ce?"border":"content"),_e,Q,Qe)+"px"}j.extend({cssHooks:{opacity:{get:function(P,U){if(U){var G=Qi(P,"opacity");return G===""?"1":G}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(P,U,G,Q){if(!(!P||P.nodeType===3||P.nodeType===8||!P.style)){var le,ce,_e,Qe=Bi(U),qe=pr.test(U),ct=P.style;if(qe||(U=Si(Qe)),_e=j.cssHooks[U]||j.cssHooks[Qe],G!==void 0){if(ce=typeof G,ce==="string"&&(le=Eo.exec(G))&&le[1]&&(G=sl(P,U,le),ce="number"),G==null||G!==G)return;ce==="number"&&!qe&&(G+=le&&le[3]||(j.cssNumber[Qe]?"":"px")),!M.clearCloneStyle&&G===""&&U.indexOf("background")===0&&(ct[U]="inherit"),(!_e||!("set"in _e)||(G=_e.set(P,G,Q))!==void 0)&&(qe?ct.setProperty(U,G):ct[U]=G)}else return _e&&"get"in _e&&(le=_e.get(P,!1,Q))!==void 0?le:ct[U]}},css:function(P,U,G,Q){var le,ce,_e,Qe=Bi(U),qe=pr.test(U);return qe||(U=Si(Qe)),_e=j.cssHooks[U]||j.cssHooks[Qe],_e&&"get"in _e&&(le=_e.get(P,!0,G)),le===void 0&&(le=Qi(P,U,Q)),le==="normal"&&U in fc&&(le=fc[U]),G===""||G?(ce=parseFloat(le),G===!0||isFinite(ce)?ce||0:le):le}}),j.each(["height","width"],function(P,U){j.cssHooks[U]={get:function(G,Q,le){if(Q)return Oi.test(j.css(G,"display"))&&(!G.getClientRects().length||!G.getBoundingClientRect().width)?vn(G,yo,function(){return zs(G,U,le)}):zs(G,U,le)},set:function(G,Q,le){var ce,_e=Ii(G),Qe=!M.scrollboxSize()&&_e.position==="absolute",qe=Qe||le,ct=qe&&j.css(G,"boxSizing",!1,_e)==="border-box",Nt=le?Yo(G,U,le,ct,_e):0;return ct&&Qe&&(Nt-=Math.ceil(G["offset"+U[0].toUpperCase()+U.slice(1)]-parseFloat(_e[U])-Yo(G,U,"border",!1,_e)-.5)),Nt&&(ce=Eo.exec(Q))&&(ce[3]||"px")!=="px"&&(G.style[U]=Q,Q=j.css(G,U)),ko(G,Q,Nt)}}}),j.cssHooks.marginLeft=Li(M.reliableMarginLeft,function(P,U){if(U)return(parseFloat(Qi(P,"marginLeft"))||P.getBoundingClientRect().left-vn(P,{marginLeft:0},function(){return P.getBoundingClientRect().left}))+"px"}),j.each({margin:"",padding:"",border:"Width"},function(P,U){j.cssHooks[P+U]={expand:function(G){for(var Q=0,le={},ce=typeof G=="string"?G.split(" "):[G];Q<4;Q++)le[P+Xo[Q]+U]=ce[Q]||ce[Q-2]||ce[0];return le}},P!=="margin"&&(j.cssHooks[P+U].set=ko)}),j.fn.extend({css:function(P,U){return Hi(this,function(G,Q,le){var ce,_e,Qe={},qe=0;if(Array.isArray(Q)){for(ce=Ii(G),_e=Q.length;qe<_e;qe++)Qe[Q[qe]]=j.css(G,Q[qe],!1,ce);return Qe}return le!==void 0?j.style(G,Q,le):j.css(G,Q)},P,U,arguments.length>1)}});function Uo(P,U,G,Q,le){return new Uo.prototype.init(P,U,G,Q,le)}j.Tween=Uo,Uo.prototype={constructor:Uo,init:function(P,U,G,Q,le,ce){this.elem=P,this.prop=G,this.easing=le||j.easing._default,this.options=U,this.start=this.now=this.cur(),this.end=Q,this.unit=ce||(j.cssNumber[G]?"":"px")},cur:function(){var P=Uo.propHooks[this.prop];return P&&P.get?P.get(this):Uo.propHooks._default.get(this)},run:function(P){var U,G=Uo.propHooks[this.prop];return this.options.duration?this.pos=U=j.easing[this.easing](P,this.options.duration*P,0,1,this.options.duration):this.pos=U=P,this.now=(this.end-this.start)*U+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),G&&G.set?G.set(this):Uo.propHooks._default.set(this),this}},Uo.prototype.init.prototype=Uo.prototype,Uo.propHooks={_default:{get:function(P){var U;return P.elem.nodeType!==1||P.elem[P.prop]!=null&&P.elem.style[P.prop]==null?P.elem[P.prop]:(U=j.css(P.elem,P.prop,""),!U||U==="auto"?0:U)},set:function(P){j.fx.step[P.prop]?j.fx.step[P.prop](P):P.elem.nodeType===1&&(j.cssHooks[P.prop]||P.elem.style[Si(P.prop)]!=null)?j.style(P.elem,P.prop,P.now+P.unit):P.elem[P.prop]=P.now}}},Uo.propHooks.scrollTop=Uo.propHooks.scrollLeft={set:function(P){P.elem.nodeType&&P.elem.parentNode&&(P.elem[P.prop]=P.now)}},j.easing={linear:function(P){return P},swing:function(P){return .5-Math.cos(P*Math.PI)/2},_default:"swing"},j.fx=Uo.prototype.init,j.fx.step={};var zn,ll,cs=/^(?:toggle|show|hide)$/,zo=/queueHooks$/;function ys(){ll&&(z.hidden===!1&&t.requestAnimationFrame?t.requestAnimationFrame(ys):t.setTimeout(ys,j.fx.interval),j.fx.tick())}function pn(){return t.setTimeout(function(){zn=void 0}),zn=Date.now()}function $s(P,U){var G,Q=0,le={height:P};for(U=U?1:0;Q<4;Q+=2-U)G=Xo[Q],le["margin"+G]=le["padding"+G]=P;return U&&(le.opacity=le.width=P),le}function Vs(P,U,G){for(var Q,le=(Ua.tweeners[U]||[]).concat(Ua.tweeners["*"]),ce=0,_e=le.length;ce<_e;ce++)if(Q=le[ce].call(G,U,P))return Q}function Qu(P,U,G){var Q,le,ce,_e,Qe,qe,ct,Nt,jt="width"in U||"height"in U,dt=this,fr={},mi=P.style,ut=P.nodeType&&ql(P),St=kr.get(P,"fxshow");G.queue||(_e=j._queueHooks(P,"fx"),_e.unqueued==null&&(_e.unqueued=0,Qe=_e.empty.fire,_e.empty.fire=function(){_e.unqueued||Qe()}),_e.unqueued++,dt.always(function(){dt.always(function(){_e.unqueued--,j.queue(P,"fx").length||_e.empty.fire()})}));for(Q in U)if(le=U[Q],cs.test(le)){if(delete U[Q],ce=ce||le==="toggle",le===(ut?"hide":"show"))if(le==="show"&&St&&St[Q]!==void 0)ut=!0;else continue;fr[Q]=St&&St[Q]||j.style(P,Q)}if(qe=!j.isEmptyObject(U),!(!qe&&j.isEmptyObject(fr))){jt&&P.nodeType===1&&(G.overflow=[mi.overflow,mi.overflowX,mi.overflowY],ct=St&&St.display,ct==null&&(ct=kr.get(P,"display")),Nt=j.css(P,"display"),Nt==="none"&&(ct?Nt=ct:(Ms([P],!0),ct=P.style.display||ct,Nt=j.css(P,"display"),Ms([P]))),(Nt==="inline"||Nt==="inline-block"&&ct!=null)&&j.css(P,"float")==="none"&&(qe||(dt.done(function(){mi.display=ct}),ct==null&&(Nt=mi.display,ct=Nt==="none"?"":Nt)),mi.display="inline-block")),G.overflow&&(mi.overflow="hidden",dt.always(function(){mi.overflow=G.overflow[0],mi.overflowX=G.overflow[1],mi.overflowY=G.overflow[2]})),qe=!1;for(Q in fr)qe||(St?"hidden"in St&&(ut=St.hidden):St=kr.access(P,"fxshow",{display:ct}),ce&&(St.hidden=!ut),ut&&Ms([P],!0),dt.done(function(){ut||Ms([P]),kr.remove(P,"fxshow");for(Q in fr)j.style(P,Q,fr[Q])})),qe=Vs(ut?St[Q]:0,Q,dt),Q in St||(St[Q]=qe.start,ut&&(qe.end=qe.start,qe.start=0))}}function ua(P,U){var G,Q,le,ce,_e;for(G in P)if(Q=Bi(G),le=U[Q],ce=P[G],Array.isArray(ce)&&(le=ce[1],ce=P[G]=ce[0]),G!==Q&&(P[Q]=ce,delete P[G]),_e=j.cssHooks[Q],_e&&"expand"in _e){ce=_e.expand(ce),delete P[Q];for(G in ce)G in P||(P[G]=ce[G],U[G]=le)}else U[Q]=le}function Ua(P,U,G){var Q,le,ce=0,_e=Ua.prefilters.length,Qe=j.Deferred().always(function(){delete qe.elem}),qe=function(){if(le)return!1;for(var jt=zn||pn(),dt=Math.max(0,ct.startTime+ct.duration-jt),fr=dt/ct.duration||0,mi=1-fr,ut=0,St=ct.tweens.length;ut<St;ut++)ct.tweens[ut].run(mi);return Qe.notifyWith(P,[ct,mi,dt]),mi<1&&St?dt:(St||Qe.notifyWith(P,[ct,1,0]),Qe.resolveWith(P,[ct]),!1)},ct=Qe.promise({elem:P,props:j.extend({},U),opts:j.extend(!0,{specialEasing:{},easing:j.easing._default},G),originalProperties:U,originalOptions:G,startTime:zn||pn(),duration:G.duration,tweens:[],createTween:function(jt,dt){var fr=j.Tween(P,ct.opts,jt,dt,ct.opts.specialEasing[jt]||ct.opts.easing);return ct.tweens.push(fr),fr},stop:function(jt){var dt=0,fr=jt?ct.tweens.length:0;if(le)return this;for(le=!0;dt<fr;dt++)ct.tweens[dt].run(1);return jt?(Qe.notifyWith(P,[ct,1,0]),Qe.resolveWith(P,[ct,jt])):Qe.rejectWith(P,[ct,jt]),this}}),Nt=ct.props;for(ua(Nt,ct.opts.specialEasing);ce<_e;ce++)if(Q=Ua.prefilters[ce].call(ct,P,Nt,ct.opts),Q)return O(Q.stop)&&(j._queueHooks(ct.elem,ct.opts.queue).stop=Q.stop.bind(Q)),Q;return j.map(Nt,Vs,ct),O(ct.opts.start)&&ct.opts.start.call(P,ct),ct.progress(ct.opts.progress).done(ct.opts.done,ct.opts.complete).fail(ct.opts.fail).always(ct.opts.always),j.fx.timer(j.extend(qe,{elem:P,anim:ct,queue:ct.opts.queue})),ct}j.Animation=j.extend(Ua,{tweeners:{"*":[function(P,U){var G=this.createTween(P,U);return sl(G.elem,P,Eo.exec(U),G),G}]},tweener:function(P,U){O(P)?(U=P,P=["*"]):P=P.match(lt);for(var G,Q=0,le=P.length;Q<le;Q++)G=P[Q],Ua.tweeners[G]=Ua.tweeners[G]||[],Ua.tweeners[G].unshift(U)},prefilters:[Qu],prefilter:function(P,U){U?Ua.prefilters.unshift(P):Ua.prefilters.push(P)}}),j.speed=function(P,U,G){var Q=P&&typeof P=="object"?j.extend({},P):{complete:G||!G&&U||O(P)&&P,duration:P,easing:G&&U||U&&!O(U)&&U};return j.fx.off?Q.duration=0:typeof Q.duration!="number"&&(Q.duration in j.fx.speeds?Q.duration=j.fx.speeds[Q.duration]:Q.duration=j.fx.speeds._default),(Q.queue==null||Q.queue===!0)&&(Q.queue="fx"),Q.old=Q.complete,Q.complete=function(){O(Q.old)&&Q.old.call(this),Q.queue&&j.dequeue(this,Q.queue)},Q},j.fn.extend({fadeTo:function(P,U,G,Q){return this.filter(ql).css("opacity",0).show().end().animate({opacity:U},P,G,Q)},animate:function(P,U,G,Q){var le=j.isEmptyObject(P),ce=j.speed(U,G,Q),_e=function(){var Qe=Ua(this,j.extend({},P),ce);(le||kr.get(this,"finish"))&&Qe.stop(!0)};return _e.finish=_e,le||ce.queue===!1?this.each(_e):this.queue(ce.queue,_e)},stop:function(P,U,G){var Q=function(le){var ce=le.stop;delete le.stop,ce(G)};return typeof P!="string"&&(G=U,U=P,P=void 0),U&&this.queue(P||"fx",[]),this.each(function(){var le=!0,ce=P!=null&&P+"queueHooks",_e=j.timers,Qe=kr.get(this);if(ce)Qe[ce]&&Qe[ce].stop&&Q(Qe[ce]);else for(ce in Qe)Qe[ce]&&Qe[ce].stop&&zo.test(ce)&&Q(Qe[ce]);for(ce=_e.length;ce--;)_e[ce].elem===this&&(P==null||_e[ce].queue===P)&&(_e[ce].anim.stop(G),le=!1,_e.splice(ce,1));(le||!G)&&j.dequeue(this,P)})},finish:function(P){return P!==!1&&(P=P||"fx"),this.each(function(){var U,G=kr.get(this),Q=G[P+"queue"],le=G[P+"queueHooks"],ce=j.timers,_e=Q?Q.length:0;for(G.finish=!0,j.queue(this,P,[]),le&&le.stop&&le.stop.call(this,!0),U=ce.length;U--;)ce[U].elem===this&&ce[U].queue===P&&(ce[U].anim.stop(!0),ce.splice(U,1));for(U=0;U<_e;U++)Q[U]&&Q[U].finish&&Q[U].finish.call(this);delete G.finish})}}),j.each(["toggle","show","hide"],function(P,U){var G=j.fn[U];j.fn[U]=function(Q,le,ce){return Q==null||typeof Q=="boolean"?G.apply(this,arguments):this.animate($s(U,!0),Q,le,ce)}}),j.each({slideDown:$s("show"),slideUp:$s("hide"),slideToggle:$s("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(P,U){j.fn[P]=function(G,Q,le){return this.animate(U,G,Q,le)}}),j.timers=[],j.fx.tick=function(){var P,U=0,G=j.timers;for(zn=Date.now();U<G.length;U++)P=G[U],!P()&&G[U]===P&&G.splice(U--,1);G.length||j.fx.stop(),zn=void 0},j.fx.timer=function(P){j.timers.push(P),j.fx.start()},j.fx.interval=13,j.fx.start=function(){ll||(ll=!0,ys())},j.fx.stop=function(){ll=null},j.fx.speeds={slow:600,fast:200,_default:400},j.fn.delay=function(P,U){return P=j.fx&&j.fx.speeds[P]||P,U=U||"fx",this.queue(U,function(G,Q){var le=t.setTimeout(G,P);Q.stop=function(){t.clearTimeout(le)}})},function(){var P=z.createElement("input"),U=z.createElement("select"),G=U.appendChild(z.createElement("option"));P.type="checkbox",M.checkOn=P.value!=="",M.optSelected=G.selected,P=z.createElement("input"),P.value="t",P.type="radio",M.radioValue=P.value==="t"}();var cl,xe=j.expr.attrHandle;j.fn.extend({attr:function(P,U){return Hi(this,j.attr,P,U,arguments.length>1)},removeAttr:function(P){return this.each(function(){j.removeAttr(this,P)})}}),j.extend({attr:function(P,U,G){var Q,le,ce=P.nodeType;if(!(ce===3||ce===8||ce===2)){if(typeof P.getAttribute>"u")return j.prop(P,U,G);if((ce!==1||!j.isXMLDoc(P))&&(le=j.attrHooks[U.toLowerCase()]||(j.expr.match.bool.test(U)?cl:void 0)),G!==void 0){if(G===null){j.removeAttr(P,U);return}return le&&"set"in le&&(Q=le.set(P,G,U))!==void 0?Q:(P.setAttribute(U,G+""),G)}return le&&"get"in le&&(Q=le.get(P,U))!==null?Q:(Q=j.find.attr(P,U),Q??void 0)}},attrHooks:{type:{set:function(P,U){if(!M.radioValue&&U==="radio"&&fe(P,"input")){var G=P.value;return P.setAttribute("type",U),G&&(P.value=G),U}}}},removeAttr:function(P,U){var G,Q=0,le=U&&U.match(lt);if(le&&P.nodeType===1)for(;G=le[Q++];)P.removeAttribute(G)}}),cl={set:function(P,U,G){return U===!1?j.removeAttr(P,G):P.setAttribute(G,G),G}},j.each(j.expr.match.bool.source.match(/\w+/g),function(P,U){var G=xe[U]||j.find.attr;xe[U]=function(Q,le,ce){var _e,Qe,qe=le.toLowerCase();return ce||(Qe=xe[qe],xe[qe]=_e,_e=G(Q,le,ce)!=null?qe:null,xe[qe]=Qe),_e}});var Be=/^(?:input|select|textarea|button)$/i,Je=/^(?:a|area)$/i;j.fn.extend({prop:function(P,U){return Hi(this,j.prop,P,U,arguments.length>1)},removeProp:function(P){return this.each(function(){delete this[j.propFix[P]||P]})}}),j.extend({prop:function(P,U,G){var Q,le,ce=P.nodeType;if(!(ce===3||ce===8||ce===2))return(ce!==1||!j.isXMLDoc(P))&&(U=j.propFix[U]||U,le=j.propHooks[U]),G!==void 0?le&&"set"in le&&(Q=le.set(P,G,U))!==void 0?Q:P[U]=G:le&&"get"in le&&(Q=le.get(P,U))!==null?Q:P[U]},propHooks:{tabIndex:{get:function(P){var U=j.find.attr(P,"tabindex");return U?parseInt(U,10):Be.test(P.nodeName)||Je.test(P.nodeName)&&P.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),M.optSelected||(j.propHooks.selected={get:function(P){var U=P.parentNode;return U&&U.parentNode&&U.parentNode.selectedIndex,null},set:function(P){var U=P.parentNode;U&&(U.selectedIndex,U.parentNode&&U.parentNode.selectedIndex)}}),j.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){j.propFix[this.toLowerCase()]=this});function vt(P){var U=P.match(lt)||[];return U.join(" ")}function tr(P){return P.getAttribute&&P.getAttribute("class")||""}function qr(P){return Array.isArray(P)?P:typeof P=="string"?P.match(lt)||[]:[]}j.fn.extend({addClass:function(P){var U,G,Q,le,ce,_e;return O(P)?this.each(function(Qe){j(this).addClass(P.call(this,Qe,tr(this)))}):(U=qr(P),U.length?this.each(function(){if(Q=tr(this),G=this.nodeType===1&&" "+vt(Q)+" ",G){for(ce=0;ce<U.length;ce++)le=U[ce],G.indexOf(" "+le+" ")<0&&(G+=le+" ");_e=vt(G),Q!==_e&&this.setAttribute("class",_e)}}):this)},removeClass:function(P){var U,G,Q,le,ce,_e;return O(P)?this.each(function(Qe){j(this).removeClass(P.call(this,Qe,tr(this)))}):arguments.length?(U=qr(P),U.length?this.each(function(){if(Q=tr(this),G=this.nodeType===1&&" "+vt(Q)+" ",G){for(ce=0;ce<U.length;ce++)for(le=U[ce];G.indexOf(" "+le+" ")>-1;)G=G.replace(" "+le+" "," ");_e=vt(G),Q!==_e&&this.setAttribute("class",_e)}}):this):this.attr("class","")},toggleClass:function(P,U){var G,Q,le,ce,_e=typeof P,Qe=_e==="string"||Array.isArray(P);return O(P)?this.each(function(qe){j(this).toggleClass(P.call(this,qe,tr(this),U),U)}):typeof U=="boolean"&&Qe?U?this.addClass(P):this.removeClass(P):(G=qr(P),this.each(function(){if(Qe)for(ce=j(this),le=0;le<G.length;le++)Q=G[le],ce.hasClass(Q)?ce.removeClass(Q):ce.addClass(Q);else(P===void 0||_e==="boolean")&&(Q=tr(this),Q&&kr.set(this,"__className__",Q),this.setAttribute&&this.setAttribute("class",Q||P===!1?"":kr.get(this,"__className__")||""))}))},hasClass:function(P){var U,G,Q=0;for(U=" "+P+" ";G=this[Q++];)if(G.nodeType===1&&(" "+vt(tr(G))+" ").indexOf(U)>-1)return!0;return!1}});var sn=/\r/g;j.fn.extend({val:function(P){var U,G,Q,le=this[0];return arguments.length?(Q=O(P),this.each(function(ce){var _e;this.nodeType===1&&(Q?_e=P.call(this,ce,j(this).val()):_e=P,_e==null?_e="":typeof _e=="number"?_e+="":Array.isArray(_e)&&(_e=j.map(_e,function(Qe){return Qe==null?"":Qe+""})),U=j.valHooks[this.type]||j.valHooks[this.nodeName.toLowerCase()],(!U||!("set"in U)||U.set(this,_e,"value")===void 0)&&(this.value=_e))})):le?(U=j.valHooks[le.type]||j.valHooks[le.nodeName.toLowerCase()],U&&"get"in U&&(G=U.get(le,"value"))!==void 0?G:(G=le.value,typeof G=="string"?G.replace(sn,""):G??"")):void 0}}),j.extend({valHooks:{option:{get:function(P){var U=j.find.attr(P,"value");return U??vt(j.text(P))}},select:{get:function(P){var U,G,Q,le=P.options,ce=P.selectedIndex,_e=P.type==="select-one",Qe=_e?null:[],qe=_e?ce+1:le.length;for(ce<0?Q=qe:Q=_e?ce:0;Q<qe;Q++)if(G=le[Q],(G.selected||Q===ce)&&!G.disabled&&(!G.parentNode.disabled||!fe(G.parentNode,"optgroup"))){if(U=j(G).val(),_e)return U;Qe.push(U)}return Qe},set:function(P,U){for(var G,Q,le=P.options,ce=j.makeArray(U),_e=le.length;_e--;)Q=le[_e],(Q.selected=j.inArray(j.valHooks.option.get(Q),ce)>-1)&&(G=!0);return G||(P.selectedIndex=-1),ce}}}}),j.each(["radio","checkbox"],function(){j.valHooks[this]={set:function(P,U){if(Array.isArray(U))return P.checked=j.inArray(j(P).val(),U)>-1}},M.checkOn||(j.valHooks[this].get=function(P){return P.getAttribute("value")===null?"on":P.value})});var Co=t.location,ts={guid:Date.now()},vs=/\?/;j.parseXML=function(P){var U,G;if(!P||typeof P!="string")return null;try{U=new t.DOMParser().parseFromString(P,"text/xml")}catch{}return G=U&&U.getElementsByTagName("parsererror")[0],(!U||G)&&j.error("Invalid XML: "+(G?j.map(G.childNodes,function(Q){return Q.textContent}).join(`
`):P)),U};var Sa=/^(?:focusinfocus|focusoutblur)$/,np=function(P){P.stopPropagation()};j.extend(j.event,{trigger:function(P,U,G,Q){var le,ce,_e,Qe,qe,ct,Nt,jt,dt=[G||z],fr=v.call(P,"type")?P.type:P,mi=v.call(P,"namespace")?P.namespace.split("."):[];if(ce=jt=_e=G=G||z,!(G.nodeType===3||G.nodeType===8)&&!Sa.test(fr+j.event.triggered)&&(fr.indexOf(".")>-1&&(mi=fr.split("."),fr=mi.shift(),mi.sort()),qe=fr.indexOf(":")<0&&"on"+fr,P=P[j.expando]?P:new j.Event(fr,typeof P=="object"&&P),P.isTrigger=Q?2:3,P.namespace=mi.join("."),P.rnamespace=P.namespace?new RegExp("(^|\\.)"+mi.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,P.result=void 0,P.target||(P.target=G),U=U==null?[P]:j.makeArray(U,[P]),Nt=j.event.special[fr]||{},!(!Q&&Nt.trigger&&Nt.trigger.apply(G,U)===!1))){if(!Q&&!Nt.noBubble&&!F(G)){for(Qe=Nt.delegateType||fr,Sa.test(Qe+fr)||(ce=ce.parentNode);ce;ce=ce.parentNode)dt.push(ce),_e=ce;_e===(G.ownerDocument||z)&&dt.push(_e.defaultView||_e.parentWindow||t)}for(le=0;(ce=dt[le++])&&!P.isPropagationStopped();)jt=ce,P.type=le>1?Qe:Nt.bindType||fr,ct=(kr.get(ce,"events")||Object.create(null))[P.type]&&kr.get(ce,"handle"),ct&&ct.apply(ce,U),ct=qe&&ce[qe],ct&&ct.apply&&yn(ce)&&(P.result=ct.apply(ce,U),P.result===!1&&P.preventDefault());return P.type=fr,!Q&&!P.isDefaultPrevented()&&(!Nt._default||Nt._default.apply(dt.pop(),U)===!1)&&yn(G)&&qe&&O(G[fr])&&!F(G)&&(_e=G[qe],_e&&(G[qe]=null),j.event.triggered=fr,P.isPropagationStopped()&&jt.addEventListener(fr,np),G[fr](),P.isPropagationStopped()&&jt.removeEventListener(fr,np),j.event.triggered=void 0,_e&&(G[qe]=_e)),P.result}},simulate:function(P,U,G){var Q=j.extend(new j.Event,G,{type:P,isSimulated:!0});j.event.trigger(Q,null,U)}}),j.fn.extend({trigger:function(P,U){return this.each(function(){j.event.trigger(P,U,this)})},triggerHandler:function(P,U){var G=this[0];if(G)return j.event.trigger(P,U,G,!0)}});var $u=/\[\]$/,Wh=/\r?\n/g,Wf=/^(?:submit|button|image|reset|file)$/i,RA=/^(?:input|select|textarea|keygen)/i;function ef(P,U,G,Q){var le;if(Array.isArray(U))j.each(U,function(ce,_e){G||$u.test(P)?Q(P,_e):ef(P+"["+(typeof _e=="object"&&_e!=null?ce:"")+"]",_e,G,Q)});else if(!G&&K(U)==="object")for(le in U)ef(P+"["+le+"]",U[le],G,Q);else Q(P,U)}j.param=function(P,U){var G,Q=[],le=function(ce,_e){var Qe=O(_e)?_e():_e;Q[Q.length]=encodeURIComponent(ce)+"="+encodeURIComponent(Qe??"")};if(P==null)return"";if(Array.isArray(P)||P.jquery&&!j.isPlainObject(P))j.each(P,function(){le(this.name,this.value)});else for(G in P)ef(G,P[G],U,le);return Q.join("&")},j.fn.extend({serialize:function(){return j.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var P=j.prop(this,"elements");return P?j.makeArray(P):this}).filter(function(){var P=this.type;return this.name&&!j(this).is(":disabled")&&RA.test(this.nodeName)&&!Wf.test(P)&&(this.checked||!ca.test(P))}).map(function(P,U){var G=j(this).val();return G==null?null:Array.isArray(G)?j.map(G,function(Q){return{name:U.name,value:Q.replace(Wh,`\r
`)}}):{name:U.name,value:G.replace(Wh,`\r
`)}}).get()}});var ul=/%20/g,Nc=/#.*$/,kc=/([?&])_=[^&]*/,cu=/^(.*?):[ \t]*([^\r\n]*)$/mg,Uc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,zc=/^(?:GET|HEAD)$/,qh=/^\/\//,fa={},Mo={},uu="*/".concat("*"),Xh=z.createElement("a");Xh.href=Co.href;function BA(P){return function(U,G){typeof U!="string"&&(G=U,U="*");var Q,le=0,ce=U.toLowerCase().match(lt)||[];if(O(G))for(;Q=ce[le++];)Q[0]==="+"?(Q=Q.slice(1)||"*",(P[Q]=P[Q]||[]).unshift(G)):(P[Q]=P[Q]||[]).push(G)}}function OA(P,U,G,Q){var le={},ce=P===Mo;function _e(Qe){var qe;return le[Qe]=!0,j.each(P[Qe]||[],function(ct,Nt){var jt=Nt(U,G,Q);if(typeof jt=="string"&&!ce&&!le[jt])return U.dataTypes.unshift(jt),_e(jt),!1;if(ce)return!(qe=jt)}),qe}return _e(U.dataTypes[0])||!le["*"]&&_e("*")}function qf(P,U){var G,Q,le=j.ajaxSettings.flatOptions||{};for(G in U)U[G]!==void 0&&((le[G]?P:Q||(Q={}))[G]=U[G]);return Q&&j.extend(!0,P,Q),P}function op(P,U,G){for(var Q,le,ce,_e,Qe=P.contents,qe=P.dataTypes;qe[0]==="*";)qe.shift(),Q===void 0&&(Q=P.mimeType||U.getResponseHeader("Content-Type"));if(Q){for(le in Qe)if(Qe[le]&&Qe[le].test(Q)){qe.unshift(le);break}}if(qe[0]in G)ce=qe[0];else{for(le in G){if(!qe[0]||P.converters[le+" "+qe[0]]){ce=le;break}_e||(_e=le)}ce=ce||_e}if(ce)return ce!==qe[0]&&qe.unshift(ce),G[ce]}function sp(P,U,G,Q){var le,ce,_e,Qe,qe,ct={},Nt=P.dataTypes.slice();if(Nt[1])for(_e in P.converters)ct[_e.toLowerCase()]=P.converters[_e];for(ce=Nt.shift();ce;)if(P.responseFields[ce]&&(G[P.responseFields[ce]]=U),!qe&&Q&&P.dataFilter&&(U=P.dataFilter(U,P.dataType)),qe=ce,ce=Nt.shift(),ce){if(ce==="*")ce=qe;else if(qe!=="*"&&qe!==ce){if(_e=ct[qe+" "+ce]||ct["* "+ce],!_e){for(le in ct)if(Qe=le.split(" "),Qe[1]===ce&&(_e=ct[qe+" "+Qe[0]]||ct["* "+Qe[0]],_e)){_e===!0?_e=ct[le]:ct[le]!==!0&&(ce=Qe[0],Nt.unshift(Qe[1]));break}}if(_e!==!0)if(_e&&P.throws)U=_e(U);else try{U=_e(U)}catch(jt){return{state:"parsererror",error:_e?jt:"No conversion from "+qe+" to "+ce}}}}return{state:"success",data:U}}j.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Co.href,type:"GET",isLocal:Uc.test(Co.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":uu,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":j.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(P,U){return U?qf(qf(P,j.ajaxSettings),U):qf(j.ajaxSettings,P)},ajaxPrefilter:BA(fa),ajaxTransport:BA(Mo),ajax:function(P,U){typeof P=="object"&&(U=P,P=void 0),U=U||{};var G,Q,le,ce,_e,Qe,qe,ct,Nt,jt,dt=j.ajaxSetup({},U),fr=dt.context||dt,mi=dt.context&&(fr.nodeType||fr.jquery)?j(fr):j.event,ut=j.Deferred(),St=j.Callbacks("once memory"),cr=dt.statusCode||{},Xr={},g={},ki="canceled",Wr={readyState:0,getResponseHeader:function(Ti){var An;if(qe){if(!ce)for(ce={};An=cu.exec(le);)ce[An[1].toLowerCase()+" "]=(ce[An[1].toLowerCase()+" "]||[]).concat(An[2]);An=ce[Ti.toLowerCase()+" "]}return An==null?null:An.join(", ")},getAllResponseHeaders:function(){return qe?le:null},setRequestHeader:function(Ti,An){return qe==null&&(Ti=g[Ti.toLowerCase()]=g[Ti.toLowerCase()]||Ti,Xr[Ti]=An),this},overrideMimeType:function(Ti){return qe==null&&(dt.mimeType=Ti),this},statusCode:function(Ti){var An;if(Ti)if(qe)Wr.always(Ti[Wr.status]);else for(An in Ti)cr[An]=[cr[An],Ti[An]];return this},abort:function(Ti){var An=Ti||ki;return G&&G.abort(An),Re(0,An),this}};if(ut.promise(Wr),dt.url=((P||dt.url||Co.href)+"").replace(qh,Co.protocol+"//"),dt.type=U.method||U.type||dt.method||dt.type,dt.dataTypes=(dt.dataType||"*").toLowerCase().match(lt)||[""],dt.crossDomain==null){Qe=z.createElement("a");try{Qe.href=dt.url,Qe.href=Qe.href,dt.crossDomain=Xh.protocol+"//"+Xh.host!=Qe.protocol+"//"+Qe.host}catch{dt.crossDomain=!0}}if(dt.data&&dt.processData&&typeof dt.data!="string"&&(dt.data=j.param(dt.data,dt.traditional)),OA(fa,dt,U,Wr),qe)return Wr;ct=j.event&&dt.global,ct&&j.active++===0&&j.event.trigger("ajaxStart"),dt.type=dt.type.toUpperCase(),dt.hasContent=!zc.test(dt.type),Q=dt.url.replace(Nc,""),dt.hasContent?dt.data&&dt.processData&&(dt.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(dt.data=dt.data.replace(ul,"+")):(jt=dt.url.slice(Q.length),dt.data&&(dt.processData||typeof dt.data=="string")&&(Q+=(vs.test(Q)?"&":"?")+dt.data,delete dt.data),dt.cache===!1&&(Q=Q.replace(kc,"$1"),jt=(vs.test(Q)?"&":"?")+"_="+ts.guid+++jt),dt.url=Q+jt),dt.ifModified&&(j.lastModified[Q]&&Wr.setRequestHeader("If-Modified-Since",j.lastModified[Q]),j.etag[Q]&&Wr.setRequestHeader("If-None-Match",j.etag[Q])),(dt.data&&dt.hasContent&&dt.contentType!==!1||U.contentType)&&Wr.setRequestHeader("Content-Type",dt.contentType),Wr.setRequestHeader("Accept",dt.dataTypes[0]&&dt.accepts[dt.dataTypes[0]]?dt.accepts[dt.dataTypes[0]]+(dt.dataTypes[0]!=="*"?", "+uu+"; q=0.01":""):dt.accepts["*"]);for(Nt in dt.headers)Wr.setRequestHeader(Nt,dt.headers[Nt]);if(dt.beforeSend&&(dt.beforeSend.call(fr,Wr,dt)===!1||qe))return Wr.abort();if(ki="abort",St.add(dt.complete),Wr.done(dt.success),Wr.fail(dt.error),G=OA(Mo,dt,U,Wr),!G)Re(-1,"No Transport");else{if(Wr.readyState=1,ct&&mi.trigger("ajaxSend",[Wr,dt]),qe)return Wr;dt.async&&dt.timeout>0&&(_e=t.setTimeout(function(){Wr.abort("timeout")},dt.timeout));try{qe=!1,G.send(Xr,Re)}catch(Ti){if(qe)throw Ti;Re(-1,Ti)}}function Re(Ti,An,Qn,En){var ln,$n,ji,Gi,an,ea=An;qe||(qe=!0,_e&&t.clearTimeout(_e),G=void 0,le=En||"",Wr.readyState=Ti>0?4:0,ln=Ti>=200&&Ti<300||Ti===304,Qn&&(Gi=op(dt,Wr,Qn)),!ln&&j.inArray("script",dt.dataTypes)>-1&&j.inArray("json",dt.dataTypes)<0&&(dt.converters["text script"]=function(){}),Gi=sp(dt,Gi,Wr,ln),ln?(dt.ifModified&&(an=Wr.getResponseHeader("Last-Modified"),an&&(j.lastModified[Q]=an),an=Wr.getResponseHeader("etag"),an&&(j.etag[Q]=an)),Ti===204||dt.type==="HEAD"?ea="nocontent":Ti===304?ea="notmodified":(ea=Gi.state,$n=Gi.data,ji=Gi.error,ln=!ji)):(ji=ea,(Ti||!ea)&&(ea="error",Ti<0&&(Ti=0))),Wr.status=Ti,Wr.statusText=(An||ea)+"",ln?ut.resolveWith(fr,[$n,ea,Wr]):ut.rejectWith(fr,[Wr,ea,ji]),Wr.statusCode(cr),cr=void 0,ct&&mi.trigger(ln?"ajaxSuccess":"ajaxError",[Wr,dt,ln?$n:ji]),St.fireWith(fr,[Wr,ea]),ct&&(mi.trigger("ajaxComplete",[Wr,dt]),--j.active||j.event.trigger("ajaxStop")))}return Wr},getJSON:function(P,U,G){return j.get(P,U,G,"json")},getScript:function(P,U){return j.get(P,void 0,U,"script")}}),j.each(["get","post"],function(P,U){j[U]=function(G,Q,le,ce){return O(Q)&&(ce=ce||le,le=Q,Q=void 0),j.ajax(j.extend({url:G,type:U,dataType:ce,data:Q,success:le},j.isPlainObject(G)&&G))}}),j.ajaxPrefilter(function(P){var U;for(U in P.headers)U.toLowerCase()==="content-type"&&(P.contentType=P.headers[U]||"")}),j._evalUrl=function(P,U,G){return j.ajax({url:P,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(Q){j.globalEval(Q,U,G)}})},j.fn.extend({wrapAll:function(P){var U;return this[0]&&(O(P)&&(P=P.call(this[0])),U=j(P,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&U.insertBefore(this[0]),U.map(function(){for(var G=this;G.firstElementChild;)G=G.firstElementChild;return G}).append(this)),this},wrapInner:function(P){return O(P)?this.each(function(U){j(this).wrapInner(P.call(this,U))}):this.each(function(){var U=j(this),G=U.contents();G.length?G.wrapAll(P):U.append(P)})},wrap:function(P){var U=O(P);return this.each(function(G){j(this).wrapAll(U?P.call(this,G):P)})},unwrap:function(P){return this.parent(P).not("body").each(function(){j(this).replaceWith(this.childNodes)}),this}}),j.expr.pseudos.hidden=function(P){return!j.expr.pseudos.visible(P)},j.expr.pseudos.visible=function(P){return!!(P.offsetWidth||P.offsetHeight||P.getClientRects().length)},j.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch{}};var ap={0:200,1223:204},tf=j.ajaxSettings.xhr();M.cors=!!tf&&"withCredentials"in tf,M.ajax=tf=!!tf,j.ajaxTransport(function(P){var U,G;if(M.cors||tf&&!P.crossDomain)return{send:function(Q,le){var ce,_e=P.xhr();if(_e.open(P.type,P.url,P.async,P.username,P.password),P.xhrFields)for(ce in P.xhrFields)_e[ce]=P.xhrFields[ce];P.mimeType&&_e.overrideMimeType&&_e.overrideMimeType(P.mimeType),!P.crossDomain&&!Q["X-Requested-With"]&&(Q["X-Requested-With"]="XMLHttpRequest");for(ce in Q)_e.setRequestHeader(ce,Q[ce]);U=function(Qe){return function(){U&&(U=G=_e.onload=_e.onerror=_e.onabort=_e.ontimeout=_e.onreadystatechange=null,Qe==="abort"?_e.abort():Qe==="error"?typeof _e.status!="number"?le(0,"error"):le(_e.status,_e.statusText):le(ap[_e.status]||_e.status,_e.statusText,(_e.responseType||"text")!=="text"||typeof _e.responseText!="string"?{binary:_e.response}:{text:_e.responseText},_e.getAllResponseHeaders()))}},_e.onload=U(),G=_e.onerror=_e.ontimeout=U("error"),_e.onabort!==void 0?_e.onabort=G:_e.onreadystatechange=function(){_e.readyState===4&&t.setTimeout(function(){U&&G()})},U=U("abort");try{_e.send(P.hasContent&&P.data||null)}catch(Qe){if(U)throw Qe}},abort:function(){U&&U()}}}),j.ajaxPrefilter(function(P){P.crossDomain&&(P.contents.script=!1)}),j.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(P){return j.globalEval(P),P}}}),j.ajaxPrefilter("script",function(P){P.cache===void 0&&(P.cache=!1),P.crossDomain&&(P.type="GET")}),j.ajaxTransport("script",function(P){if(P.crossDomain||P.scriptAttrs){var U,G;return{send:function(Q,le){U=j("<script>").attr(P.scriptAttrs||{}).prop({charset:P.scriptCharset,src:P.url}).on("load error",G=function(ce){U.remove(),G=null,ce&&le(ce.type==="error"?404:200,ce.type)}),z.head.appendChild(U[0])},abort:function(){G&&G()}}}});var lp=[],cp=/(=)\?(?=&|$)|\?\?/;j.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var P=lp.pop()||j.expando+"_"+ts.guid++;return this[P]=!0,P}}),j.ajaxPrefilter("json jsonp",function(P,U,G){var Q,le,ce,_e=P.jsonp!==!1&&(cp.test(P.url)?"url":typeof P.data=="string"&&(P.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&cp.test(P.data)&&"data");if(_e||P.dataTypes[0]==="jsonp")return Q=P.jsonpCallback=O(P.jsonpCallback)?P.jsonpCallback():P.jsonpCallback,_e?P[_e]=P[_e].replace(cp,"$1"+Q):P.jsonp!==!1&&(P.url+=(vs.test(P.url)?"&":"?")+P.jsonp+"="+Q),P.converters["script json"]=function(){return ce||j.error(Q+" was not called"),ce[0]},P.dataTypes[0]="json",le=t[Q],t[Q]=function(){ce=arguments},G.always(function(){le===void 0?j(t).removeProp(Q):t[Q]=le,P[Q]&&(P.jsonpCallback=U.jsonpCallback,lp.push(Q)),ce&&O(le)&&le(ce[0]),ce=le=void 0}),"script"}),M.createHTMLDocument=function(){var P=z.implementation.createHTMLDocument("").body;return P.innerHTML="<form></form><form></form>",P.childNodes.length===2}(),j.parseHTML=function(P,U,G){if(typeof P!="string")return[];typeof U=="boolean"&&(G=U,U=!1);var Q,le,ce;return U||(M.createHTMLDocument?(U=z.implementation.createHTMLDocument(""),Q=U.createElement("base"),Q.href=z.location.href,U.head.appendChild(Q)):U=z),le=or.exec(P),ce=!G&&[],le?[U.createElement(le[1])]:(le=ye([P],U,ce),ce&&ce.length&&j(ce).remove(),j.merge([],le.childNodes))},j.fn.load=function(P,U,G){var Q,le,ce,_e=this,Qe=P.indexOf(" ");return Qe>-1&&(Q=vt(P.slice(Qe)),P=P.slice(0,Qe)),O(U)?(G=U,U=void 0):U&&typeof U=="object"&&(le="POST"),_e.length>0&&j.ajax({url:P,type:le||"GET",dataType:"html",data:U}).done(function(qe){ce=arguments,_e.html(Q?j("<div>").append(j.parseHTML(qe)).find(Q):qe)}).always(G&&function(qe,ct){_e.each(function(){G.apply(this,ce||[qe.responseText,ct,qe])})}),this},j.expr.pseudos.animated=function(P){return j.grep(j.timers,function(U){return P===U.elem}).length},j.offset={setOffset:function(P,U,G){var Q,le,ce,_e,Qe,qe,ct,Nt=j.css(P,"position"),jt=j(P),dt={};Nt==="static"&&(P.style.position="relative"),Qe=jt.offset(),ce=j.css(P,"top"),qe=j.css(P,"left"),ct=(Nt==="absolute"||Nt==="fixed")&&(ce+qe).indexOf("auto")>-1,ct?(Q=jt.position(),_e=Q.top,le=Q.left):(_e=parseFloat(ce)||0,le=parseFloat(qe)||0),O(U)&&(U=U.call(P,G,j.extend({},Qe))),U.top!=null&&(dt.top=U.top-Qe.top+_e),U.left!=null&&(dt.left=U.left-Qe.left+le),"using"in U?U.using.call(P,dt):jt.css(dt)}},j.fn.extend({offset:function(P){if(arguments.length)return P===void 0?this:this.each(function(le){j.offset.setOffset(this,P,le)});var U,G,Q=this[0];if(Q)return Q.getClientRects().length?(U=Q.getBoundingClientRect(),G=Q.ownerDocument.defaultView,{top:U.top+G.pageYOffset,left:U.left+G.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var P,U,G,Q=this[0],le={top:0,left:0};if(j.css(Q,"position")==="fixed")U=Q.getBoundingClientRect();else{for(U=this.offset(),G=Q.ownerDocument,P=Q.offsetParent||G.documentElement;P&&(P===G.body||P===G.documentElement)&&j.css(P,"position")==="static";)P=P.parentNode;P&&P!==Q&&P.nodeType===1&&(le=j(P).offset(),le.top+=j.css(P,"borderTopWidth",!0),le.left+=j.css(P,"borderLeftWidth",!0))}return{top:U.top-le.top-j.css(Q,"marginTop",!0),left:U.left-le.left-j.css(Q,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var P=this.offsetParent;P&&j.css(P,"position")==="static";)P=P.offsetParent;return P||So})}}),j.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(P,U){var G=U==="pageYOffset";j.fn[P]=function(Q){return Hi(this,function(le,ce,_e){var Qe;if(F(le)?Qe=le:le.nodeType===9&&(Qe=le.defaultView),_e===void 0)return Qe?Qe[U]:le[ce];Qe?Qe.scrollTo(G?Qe.pageXOffset:_e,G?_e:Qe.pageYOffset):le[ce]=_e},P,Q,arguments.length)}}),j.each(["top","left"],function(P,U){j.cssHooks[U]=Li(M.pixelPosition,function(G,Q){if(Q)return Q=Qi(G,U),bi.test(Q)?j(G).position()[U]+"px":Q})}),j.each({Height:"height",Width:"width"},function(P,U){j.each({padding:"inner"+P,content:U,"":"outer"+P},function(G,Q){j.fn[Q]=function(le,ce){var _e=arguments.length&&(G||typeof le!="boolean"),Qe=G||(le===!0||ce===!0?"margin":"border");return Hi(this,function(qe,ct,Nt){var jt;return F(qe)?Q.indexOf("outer")===0?qe["inner"+P]:qe.document.documentElement["client"+P]:qe.nodeType===9?(jt=qe.documentElement,Math.max(qe.body["scroll"+P],jt["scroll"+P],qe.body["offset"+P],jt["offset"+P],jt["client"+P])):Nt===void 0?j.css(qe,ct,Qe):j.style(qe,ct,Nt,Qe)},U,_e?le:void 0,_e)}})}),j.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(P,U){j.fn[U]=function(G){return this.on(U,G)}}),j.fn.extend({bind:function(P,U,G){return this.on(P,null,U,G)},unbind:function(P,U){return this.off(P,null,U)},delegate:function(P,U,G,Q){return this.on(U,P,G,Q)},undelegate:function(P,U,G){return arguments.length===1?this.off(P,"**"):this.off(U,P||"**",G)},hover:function(P,U){return this.on("mouseenter",P).on("mouseleave",U||P)}}),j.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(P,U){j.fn[U]=function(G,Q){return arguments.length>0?this.on(U,null,G,Q):this.trigger(U)}});var Xf=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;j.proxy=function(P,U){var G,Q,le;if(typeof U=="string"&&(G=P[U],U=P,P=G),!!O(P))return Q=n.call(arguments,2),le=function(){return P.apply(U||this,Q.concat(n.call(arguments)))},le.guid=P.guid=P.guid||j.guid++,le},j.holdReady=function(P){P?j.readyWait++:j.ready(!0)},j.isArray=Array.isArray,j.parseJSON=JSON.parse,j.nodeName=fe,j.isFunction=O,j.isWindow=F,j.camelCase=Bi,j.type=K,j.now=Date.now,j.isNumeric=function(P){var U=j.type(P);return(U==="number"||U==="string")&&!isNaN(P-parseFloat(P))},j.trim=function(P){return P==null?"":(P+"").replace(Xf,"$1")},typeof define=="function"&&define.amd&&define("jquery",[],function(){return j});var Yf=t.jQuery,DA=t.$;return j.noConflict=function(P){return t.$===j&&(t.$=DA),P&&t.jQuery===j&&(t.jQuery=Yf),j},typeof e>"u"&&(t.jQuery=t.$=j),j})});var G4=Qt(j4=>{(function(t){var e=typeof self=="object"&&self.self==self&&self||typeof global=="object"&&global.global==global&&global;if(typeof define=="function"&&define.amd)define(["underscore","jquery","exports"],function(n,o,s){e.Backbone=t(e,s,n,o)});else if(typeof j4<"u"){var r=(Tee(),B6(wee)),i;try{i=H4()}catch{}t(e,j4,r,i)}else e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)})(function(t,e,r,i){var n=t.Backbone,o=Array.prototype.slice;e.VERSION="1.2.3",e.$=i,e.noConflict=function(){return t.Backbone=n,this},e.emulateHTTP=!1,e.emulateJSON=!1;var s=function(ae,be,je){switch(ae){case 1:return function(){return r[be](this[je])};case 2:return function(lt){return r[be](this[je],lt)};case 3:return function(lt,Ft){return r[be](this[je],u(lt,this),Ft)};case 4:return function(lt,Ft,wt){return r[be](this[je],u(lt,this),Ft,wt)};default:return function(){var lt=o.call(arguments);return lt.unshift(this[je]),r[be].apply(r,lt)}}},l=function(ae,be,je){r.each(be,function(lt,Ft){r[Ft]&&(ae.prototype[Ft]=s(lt,Ft,je))})},u=function(ae,be){return r.isFunction(ae)?ae:r.isObject(ae)&&!be._isModel(ae)?h(ae):r.isString(ae)?function(je){return je.get(ae)}:ae},h=function(ae){var be=r.matches(ae);return function(je){return be(je.attributes)}},v=e.Events={},T=/\s+/,E=function(ae,be,je,lt,Ft){var wt=0,$r;if(je&&typeof je=="object")for(lt!==void 0&&("context"in Ft)&&Ft.context===void 0&&(Ft.context=lt),$r=r.keys(je);wt<$r.length;wt++)be=E(ae,be,$r[wt],je[$r[wt]],Ft);else if(je&&T.test(je))for($r=je.split(T);wt<$r.length;wt++)be=ae(be,$r[wt],lt,Ft);else be=ae(be,je,lt,Ft);return be};v.on=function(ae,be,je){return M(this,ae,be,je)};var M=function(ae,be,je,lt,Ft){if(ae._events=E(O,ae._events||{},be,je,{context:lt,ctx:ae,listening:Ft}),Ft){var wt=ae._listeners||(ae._listeners={});wt[Ft.id]=Ft}return ae};v.listenTo=function(ae,be,je){if(!ae)return this;var lt=ae._listenId||(ae._listenId=r.uniqueId("l")),Ft=this._listeningTo||(this._listeningTo={}),wt=Ft[lt];if(!wt){var $r=this._listenId||(this._listenId=r.uniqueId("l"));wt=Ft[lt]={obj:ae,objId:lt,id:$r,listeningTo:Ft,count:0}}return M(ae,be,je,this,wt),this};var O=function(ae,be,je,lt){if(je){var Ft=ae[be]||(ae[be]=[]),wt=lt.context,$r=lt.ctx,xi=lt.listening;xi&&xi.count++,Ft.push({callback:je,context:wt,ctx:wt||$r,listening:xi})}return ae};v.off=function(ae,be,je){return this._events?(this._events=E(F,this._events,ae,be,{context:je,listeners:this._listeners}),this):this},v.stopListening=function(ae,be,je){var lt=this._listeningTo;if(!lt)return this;for(var Ft=ae?[ae._listenId]:r.keys(lt),wt=0;wt<Ft.length;wt++){var $r=lt[Ft[wt]];if(!$r)break;$r.obj.off(be,je,this)}return r.isEmpty(lt)&&(this._listeningTo=void 0),this};var F=function(ae,be,je,lt){if(ae){var Ft=0,wt,$r=lt.context,xi=lt.listeners;if(!be&&!je&&!$r){for(var Ki=r.keys(xi);Ft<Ki.length;Ft++)wt=xi[Ki[Ft]],delete xi[wt.id],delete wt.listeningTo[wt.objId];return}for(var kn=be?[be]:r.keys(ae);Ft<kn.length;Ft++){be=kn[Ft];var Zi=ae[be];if(!Zi)break;for(var Hi=[],Un=0;Un<Zi.length;Un++){var No=Zi[Un];je&&je!==No.callback&&je!==No.callback._callback||$r&&$r!==No.context?Hi.push(No):(wt=No.listening,wt&&--wt.count===0&&(delete xi[wt.id],delete wt.listeningTo[wt.objId]))}Hi.length?ae[be]=Hi:delete ae[be]}if(r.size(ae))return ae}};v.once=function(ae,be,je){var lt=E(z,{},ae,be,r.bind(this.off,this));return this.on(lt,void 0,je)},v.listenToOnce=function(ae,be,je){var lt=E(z,{},be,je,r.bind(this.stopListening,this,ae));return this.listenTo(ae,lt)};var z=function(ae,be,je,lt){if(je){var Ft=ae[be]=r.once(function(){lt(be,Ft),je.apply(this,arguments)});Ft._callback=je}return ae};v.trigger=function(ae){if(!this._events)return this;for(var be=Math.max(0,arguments.length-1),je=Array(be),lt=0;lt<be;lt++)je[lt]=arguments[lt+1];return E(W,this._events,ae,void 0,je),this};var W=function(ae,be,je,lt){if(ae){var Ft=ae[be],wt=ae.all;Ft&&wt&&(wt=wt.slice()),Ft&&J(Ft,lt),wt&&J(wt,[be].concat(lt))}return ae},J=function(ae,be){var je,lt=-1,Ft=ae.length,wt=be[0],$r=be[1],xi=be[2];switch(be.length){case 0:for(;++lt<Ft;)(je=ae[lt]).callback.call(je.ctx);return;case 1:for(;++lt<Ft;)(je=ae[lt]).callback.call(je.ctx,wt);return;case 2:for(;++lt<Ft;)(je=ae[lt]).callback.call(je.ctx,wt,$r);return;case 3:for(;++lt<Ft;)(je=ae[lt]).callback.call(je.ctx,wt,$r,xi);return;default:for(;++lt<Ft;)(je=ae[lt]).callback.apply(je.ctx,be);return}};v.bind=v.on,v.unbind=v.off,r.extend(e,v);var K=e.Model=function(ae,be){var je=ae||{};be||(be={}),this.cid=r.uniqueId(this.cidPrefix),this.attributes={},be.collection&&(this.collection=be.collection),be.parse&&(je=this.parse(je,be)||{}),je=r.defaults({},je,r.result(this,"defaults")),this.set(je,be),this.changed={},this.initialize.apply(this,arguments)};r.extend(K.prototype,v,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(ae){return r.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(ae){return this.attributes[ae]},escape:function(ae){return r.escape(this.get(ae))},has:function(ae){return this.get(ae)!=null},matches:function(ae){return!!r.iteratee(ae,this)(this.attributes)},set:function(ae,be,je){if(ae==null)return this;var lt;if(typeof ae=="object"?(lt=ae,je=be):(lt={})[ae]=be,je||(je={}),!this._validate(lt,je))return!1;var Ft=je.unset,wt=je.silent,$r=[],xi=this._changing;this._changing=!0,xi||(this._previousAttributes=r.clone(this.attributes),this.changed={});var Ki=this.attributes,kn=this.changed,Zi=this._previousAttributes;for(var Hi in lt)be=lt[Hi],r.isEqual(Ki[Hi],be)||$r.push(Hi),r.isEqual(Zi[Hi],be)?delete kn[Hi]:kn[Hi]=be,Ft?delete Ki[Hi]:Ki[Hi]=be;if(this.id=this.get(this.idAttribute),!wt){$r.length&&(this._pending=je);for(var Un=0;Un<$r.length;Un++)this.trigger("change:"+$r[Un],this,Ki[$r[Un]],je)}if(xi)return this;if(!wt)for(;this._pending;)je=this._pending,this._pending=!1,this.trigger("change",this,je);return this._pending=!1,this._changing=!1,this},unset:function(ae,be){return this.set(ae,void 0,r.extend({},be,{unset:!0}))},clear:function(ae){var be={};for(var je in this.attributes)be[je]=void 0;return this.set(be,r.extend({},ae,{unset:!0}))},hasChanged:function(ae){return ae==null?!r.isEmpty(this.changed):r.has(this.changed,ae)},changedAttributes:function(ae){if(!ae)return this.hasChanged()?r.clone(this.changed):!1;var be=this._changing?this._previousAttributes:this.attributes,je={};for(var lt in ae){var Ft=ae[lt];r.isEqual(be[lt],Ft)||(je[lt]=Ft)}return r.size(je)?je:!1},previous:function(ae){return ae==null||!this._previousAttributes?null:this._previousAttributes[ae]},previousAttributes:function(){return r.clone(this._previousAttributes)},fetch:function(ae){ae=r.extend({parse:!0},ae);var be=this,je=ae.success;return ae.success=function(lt){var Ft=ae.parse?be.parse(lt,ae):lt;if(!be.set(Ft,ae))return!1;je&&je.call(ae.context,be,lt,ae),be.trigger("sync",be,lt,ae)},wi(this,ae),this.sync("read",this,ae)},save:function(ae,be,je){var lt;ae==null||typeof ae=="object"?(lt=ae,je=be):(lt={})[ae]=be,je=r.extend({validate:!0,parse:!0},je);var Ft=je.wait;if(lt&&!Ft){if(!this.set(lt,je))return!1}else if(!this._validate(lt,je))return!1;var wt=this,$r=je.success,xi=this.attributes;je.success=function(Zi){wt.attributes=xi;var Hi=je.parse?wt.parse(Zi,je):Zi;if(Ft&&(Hi=r.extend({},lt,Hi)),Hi&&!wt.set(Hi,je))return!1;$r&&$r.call(je.context,wt,Zi,je),wt.trigger("sync",wt,Zi,je)},wi(this,je),lt&&Ft&&(this.attributes=r.extend({},xi,lt));var Ki=this.isNew()?"create":je.patch?"patch":"update";Ki==="patch"&&!je.attrs&&(je.attrs=lt);var kn=this.sync(Ki,this,je);return this.attributes=xi,kn},destroy:function(ae){ae=ae?r.clone(ae):{};var be=this,je=ae.success,lt=ae.wait,Ft=function(){be.stopListening(),be.trigger("destroy",be,be.collection,ae)};ae.success=function($r){lt&&Ft(),je&&je.call(ae.context,be,$r,ae),be.isNew()||be.trigger("sync",be,$r,ae)};var wt=!1;return this.isNew()?r.defer(ae.success):(wi(this,ae),wt=this.sync("delete",this,ae)),lt||Ft(),wt},url:function(){var ae=r.result(this,"urlRoot")||r.result(this.collection,"url")||qt();if(this.isNew())return ae;var be=this.get(this.idAttribute);return ae.replace(/[^\/]$/,"$&/")+encodeURIComponent(be)},parse:function(ae,be){return ae},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(ae){return this._validate({},r.defaults({validate:!0},ae))},_validate:function(ae,be){if(!be.validate||!this.validate)return!0;ae=r.extend({},this.attributes,ae);var je=this.validationError=this.validate(ae,be)||null;return je?(this.trigger("invalid",this,je,r.extend(be,{validationError:je})),!1):!0}});var ne={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};l(K,ne,"attributes");var ge=e.Collection=function(ae,be){be||(be={}),be.model&&(this.model=be.model),be.comparator!==void 0&&(this.comparator=be.comparator),this._reset(),this.initialize.apply(this,arguments),ae&&this.reset(ae,r.extend({silent:!0},be))},j={add:!0,remove:!0,merge:!0},me={add:!0,remove:!1},fe=function(ae,be,je){je=Math.min(Math.max(je,0),ae.length);for(var lt=Array(ae.length-je),Ft=be.length,wt=0;wt<lt.length;wt++)lt[wt]=ae[wt+je];for(wt=0;wt<Ft;wt++)ae[wt+je]=be[wt];for(wt=0;wt<lt.length;wt++)ae[wt+Ft+je]=lt[wt]};r.extend(ge.prototype,v,{model:K,initialize:function(){},toJSON:function(ae){return this.map(function(be){return be.toJSON(ae)})},sync:function(){return e.sync.apply(this,arguments)},add:function(ae,be){return this.set(ae,r.extend({merge:!1},be,me))},remove:function(ae,be){be=r.extend({},be);var je=!r.isArray(ae);ae=je?[ae]:r.clone(ae);var lt=this._removeModels(ae,be);return!be.silent&&lt&&this.trigger("update",this,be),je?lt[0]:lt},set:function(ae,be){if(ae!=null){be=r.defaults({},be,j),be.parse&&!this._isModel(ae)&&(ae=this.parse(ae,be));var je=!r.isArray(ae);ae=je?[ae]:ae.slice();var lt=be.at;lt!=null&&(lt=+lt),lt<0&&(lt+=this.length+1);for(var Ft=[],wt=[],$r=[],xi={},Ki=be.add,kn=be.merge,Zi=be.remove,Hi=!1,Un=this.comparator&&lt==null&&be.sort!==!1,No=r.isString(this.comparator)?this.comparator:null,Ji,Bi=0;Bi<ae.length;Bi++){Ji=ae[Bi];var yn=this.get(Ji);if(yn){if(kn&&Ji!==yn){var po=this._isModel(Ji)?Ji.attributes:Ji;be.parse&&(po=yn.parse(po,be)),yn.set(po,be),Un&&!Hi&&(Hi=yn.hasChanged(No))}xi[yn.cid]||(xi[yn.cid]=!0,Ft.push(yn)),ae[Bi]=yn}else Ki&&(Ji=ae[Bi]=this._prepareModel(Ji,be),Ji&&(wt.push(Ji),this._addReference(Ji,be),xi[Ji.cid]=!0,Ft.push(Ji)))}if(Zi){for(Bi=0;Bi<this.length;Bi++)Ji=this.models[Bi],xi[Ji.cid]||$r.push(Ji);$r.length&&this._removeModels($r,be)}var kr=!1,dr=!Un&&Ki&&Zi;if(Ft.length&&dr?(kr=this.length!=Ft.length||r.some(this.models,function(Ur,ci){return Ur!==Ft[ci]}),this.models.length=0,fe(this.models,Ft,0),this.length=this.models.length):wt.length&&(Un&&(Hi=!0),fe(this.models,wt,lt??this.length),this.length=this.models.length),Hi&&this.sort({silent:!0}),!be.silent){for(Bi=0;Bi<wt.length;Bi++)lt!=null&&(be.index=lt+Bi),Ji=wt[Bi],Ji.trigger("add",Ji,this,be);(Hi||kr)&&this.trigger("sort",this,be),(wt.length||$r.length)&&this.trigger("update",this,be)}return je?ae[0]:ae}},reset:function(ae,be){be=be?r.clone(be):{};for(var je=0;je<this.models.length;je++)this._removeReference(this.models[je],be);return be.previousModels=this.models,this._reset(),ae=this.add(ae,r.extend({silent:!0},be)),be.silent||this.trigger("reset",this,be),ae},push:function(ae,be){return this.add(ae,r.extend({at:this.length},be))},pop:function(ae){var be=this.at(this.length-1);return this.remove(be,ae)},unshift:function(ae,be){return this.add(ae,r.extend({at:0},be))},shift:function(ae){var be=this.at(0);return this.remove(be,ae)},slice:function(){return o.apply(this.models,arguments)},get:function(ae){if(ae!=null){var be=this.modelId(this._isModel(ae)?ae.attributes:ae);return this._byId[ae]||this._byId[be]||this._byId[ae.cid]}},at:function(ae){return ae<0&&(ae+=this.length),this.models[ae]},where:function(ae,be){return this[be?"find":"filter"](ae)},findWhere:function(ae){return this.where(ae,!0)},sort:function(ae){var be=this.comparator;if(!be)throw new Error("Cannot sort a set without a comparator");ae||(ae={});var je=be.length;return r.isFunction(be)&&(be=r.bind(be,this)),je===1||r.isString(be)?this.models=this.sortBy(be):this.models.sort(be),ae.silent||this.trigger("sort",this,ae),this},pluck:function(ae){return r.invoke(this.models,"get",ae)},fetch:function(ae){ae=r.extend({parse:!0},ae);var be=ae.success,je=this;return ae.success=function(lt){var Ft=ae.reset?"reset":"set";je[Ft](lt,ae),be&&be.call(ae.context,je,lt,ae),je.trigger("sync",je,lt,ae)},wi(this,ae),this.sync("read",this,ae)},create:function(ae,be){be=be?r.clone(be):{};var je=be.wait;if(ae=this._prepareModel(ae,be),!ae)return!1;je||this.add(ae,be);var lt=this,Ft=be.success;return be.success=function(wt,$r,xi){je&&lt.add(wt,xi),Ft&&Ft.call(xi.context,wt,$r,xi)},ae.save(null,be),ae},parse:function(ae,be){return ae},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(ae){return ae[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(ae,be){if(this._isModel(ae))return ae.collection||(ae.collection=this),ae;be=be?r.clone(be):{},be.collection=this;var je=new this.model(ae,be);return je.validationError?(this.trigger("invalid",this,je.validationError,be),!1):je},_removeModels:function(ae,be){for(var je=[],lt=0;lt<ae.length;lt++){var Ft=this.get(ae[lt]);if(Ft){var wt=this.indexOf(Ft);this.models.splice(wt,1),this.length--,be.silent||(be.index=wt,Ft.trigger("remove",Ft,this,be)),je.push(Ft),this._removeReference(Ft,be)}}return je.length?je:!1},_isModel:function(ae){return ae instanceof K},_addReference:function(ae,be){this._byId[ae.cid]=ae;var je=this.modelId(ae.attributes);je!=null&&(this._byId[je]=ae),ae.on("all",this._onModelEvent,this)},_removeReference:function(ae,be){delete this._byId[ae.cid];var je=this.modelId(ae.attributes);je!=null&&delete this._byId[je],this===ae.collection&&delete ae.collection,ae.off("all",this._onModelEvent,this)},_onModelEvent:function(ae,be,je,lt){if(!((ae==="add"||ae==="remove")&&je!==this)){if(ae==="destroy"&&this.remove(be,lt),ae==="change"){var Ft=this.modelId(be.previousAttributes()),wt=this.modelId(be.attributes);Ft!==wt&&(Ft!=null&&delete this._byId[Ft],wt!=null&&(this._byId[wt]=be))}this.trigger.apply(this,arguments)}}});var $={forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:3,includes:3,contains:3,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3,groupBy:3,countBy:3,sortBy:3,indexBy:3};l(ge,$,"models");var Z=e.View=function(ae){this.cid=r.uniqueId("view"),r.extend(this,r.pick(ae,Oe)),this._ensureElement(),this.initialize.apply(this,arguments)},we=/^(\S+)\s*(.*)$/,Oe=["model","collection","el","id","attributes","className","tagName","events"];r.extend(Z.prototype,v,{tagName:"div",$:function(ae){return this.$el.find(ae)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(ae){return this.undelegateEvents(),this._setElement(ae),this.delegateEvents(),this},_setElement:function(ae){this.$el=ae instanceof e.$?ae:e.$(ae),this.el=this.$el[0]},delegateEvents:function(ae){if(ae||(ae=r.result(this,"events")),!ae)return this;this.undelegateEvents();for(var be in ae){var je=ae[be];if(r.isFunction(je)||(je=this[je]),!!je){var lt=be.match(we);this.delegate(lt[1],lt[2],r.bind(je,this))}}return this},delegate:function(ae,be,je){return this.$el.on(ae+".delegateEvents"+this.cid,be,je),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(ae,be,je){return this.$el.off(ae+".delegateEvents"+this.cid,be,je),this},_createElement:function(ae){return document.createElement(ae)},_ensureElement:function(){if(this.el)this.setElement(r.result(this,"el"));else{var ae=r.extend({},r.result(this,"attributes"));this.id&&(ae.id=r.result(this,"id")),this.className&&(ae.class=r.result(this,"className")),this.setElement(this._createElement(r.result(this,"tagName"))),this._setAttributes(ae)}},_setAttributes:function(ae){this.$el.attr(ae)}}),e.sync=function(ae,be,je){var lt=he[ae];r.defaults(je||(je={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var Ft={type:lt,dataType:"json"};if(je.url||(Ft.url=r.result(be,"url")||qt()),je.data==null&&be&&(ae==="create"||ae==="update"||ae==="patch")&&(Ft.contentType="application/json",Ft.data=JSON.stringify(je.attrs||be.toJSON(je))),je.emulateJSON&&(Ft.contentType="application/x-www-form-urlencoded",Ft.data=Ft.data?{model:Ft.data}:{}),je.emulateHTTP&&(lt==="PUT"||lt==="DELETE"||lt==="PATCH")){Ft.type="POST",je.emulateJSON&&(Ft.data._method=lt);var wt=je.beforeSend;je.beforeSend=function(Ki){if(Ki.setRequestHeader("X-HTTP-Method-Override",lt),wt)return wt.apply(this,arguments)}}Ft.type!=="GET"&&!je.emulateJSON&&(Ft.processData=!1);var $r=je.error;je.error=function(Ki,kn,Zi){je.textStatus=kn,je.errorThrown=Zi,$r&&$r.call(je.context,Ki,kn,Zi)};var xi=je.xhr=e.ajax(r.extend(Ft,je));return be.trigger("request",be,xi,je),xi};var he={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var Le=e.Router=function(ae){ae||(ae={}),ae.routes&&(this.routes=ae.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},ft=/\((.*?)\)/g,Vt=/(\(\?)?:\w+/g,Yt=/\*\w+/g,mr=/[\-{}\[\]+?.,\\\^$|#\s]/g;r.extend(Le.prototype,v,{initialize:function(){},route:function(ae,be,je){r.isRegExp(ae)||(ae=this._routeToRegExp(ae)),r.isFunction(be)&&(je=be,be=""),je||(je=this[be]);var lt=this;return e.history.route(ae,function(Ft){var wt=lt._extractParameters(ae,Ft);lt.execute(je,wt,be)!==!1&&(lt.trigger.apply(lt,["route:"+be].concat(wt)),lt.trigger("route",be,wt),e.history.trigger("route",lt,be,wt))}),this},execute:function(ae,be,je){ae&&ae.apply(this,be)},navigate:function(ae,be){return e.history.navigate(ae,be),this},_bindRoutes:function(){if(this.routes){this.routes=r.result(this,"routes");for(var ae,be=r.keys(this.routes);(ae=be.pop())!=null;)this.route(ae,this.routes[ae])}},_routeToRegExp:function(ae){return ae=ae.replace(mr,"\\$&").replace(ft,"(?:$1)?").replace(Vt,function(be,je){return je?be:"([^/?]+)"}).replace(Yt,"([^?]*?)"),new RegExp("^"+ae+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(ae,be){var je=ae.exec(be).slice(1);return r.map(je,function(lt,Ft){return Ft===je.length-1?lt||null:lt?decodeURIComponent(lt):null})}});var Er=e.History=function(){this.handlers=[],this.checkUrl=r.bind(this.checkUrl,this),typeof window<"u"&&(this.location=window.location,this.history=window.history)},Jr=/^[#\/]|\s+$/g,or=/^\/+|\/+$/g,ai=/#.*$/;Er.started=!1,r.extend(Er.prototype,v,{interval:50,atRoot:function(){var ae=this.location.pathname.replace(/[^\/]$/,"$&/");return ae===this.root&&!this.getSearch()},matchRoot:function(){var ae=this.decodeFragment(this.location.pathname),be=ae.slice(0,this.root.length-1)+"/";return be===this.root},decodeFragment:function(ae){return decodeURI(ae.replace(/%25/g,"%2525"))},getSearch:function(){var ae=this.location.href.replace(/#.*/,"").match(/\?.+/);return ae?ae[0]:""},getHash:function(ae){var be=(ae||this).location.href.match(/#(.*)$/);return be?be[1]:""},getPath:function(){var ae=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return ae.charAt(0)==="/"?ae.slice(1):ae},getFragment:function(ae){return ae==null&&(this._usePushState||!this._wantsHashChange?ae=this.getPath():ae=this.getHash()),ae.replace(Jr,"")},start:function(ae){if(Er.started)throw new Error("Backbone.history has already been started");if(Er.started=!0,this.options=r.extend({root:"/"},this.options,ae),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._hasHashChange="onhashchange"in window&&(document.documentMode===void 0||document.documentMode>7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.history&&this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(or,"/"),this._wantsHashChange&&this._wantsPushState)if(!this._hasPushState&&!this.atRoot()){var be=this.root.slice(0,-1)||"/";return this.location.replace(be+"#"+this.getPath()),!0}else this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0});if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var je=document.body,lt=je.insertBefore(this.iframe,je.firstChild).contentWindow;lt.document.open(),lt.document.close(),lt.location.hash="#"+this.fragment}var Ft=window.addEventListener||function(wt,$r){return attachEvent("on"+wt,$r)};if(this._usePushState?Ft("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?Ft("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var ae=window.removeEventListener||function(be,je){return detachEvent("on"+be,je)};this._usePushState?ae("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&ae("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),Er.started=!1},route:function(ae,be){this.handlers.unshift({route:ae,callback:be})},checkUrl:function(ae){var be=this.getFragment();if(be===this.fragment&&this.iframe&&(be=this.getHash(this.iframe.contentWindow)),be===this.fragment)return!1;this.iframe&&this.navigate(be),this.loadUrl()},loadUrl:function(ae){return this.matchRoot()?(ae=this.fragment=this.getFragment(ae),r.some(this.handlers,function(be){if(be.route.test(ae))return be.callback(ae),!0})):!1},navigate:function(ae,be){if(!Er.started)return!1;(!be||be===!0)&&(be={trigger:!!be}),ae=this.getFragment(ae||"");var je=this.root;(ae===""||ae.charAt(0)==="?")&&(je=je.slice(0,-1)||"/");var lt=je+ae;if(ae=this.decodeFragment(ae.replace(ai,"")),this.fragment!==ae){if(this.fragment=ae,this._usePushState)this.history[be.replace?"replaceState":"pushState"]({},document.title,lt);else if(this._wantsHashChange){if(this._updateHash(this.location,ae,be.replace),this.iframe&&ae!==this.getHash(this.iframe.contentWindow)){var Ft=this.iframe.contentWindow;be.replace||(Ft.document.open(),Ft.document.close()),this._updateHash(Ft.location,ae,be.replace)}}else return this.location.assign(lt);if(be.trigger)return this.loadUrl(ae)}},_updateHash:function(ae,be,je){if(je){var lt=ae.href.replace(/(javascript:|#).*$/,"");ae.replace(lt+"#"+be)}else ae.hash="#"+be}}),e.history=new Er;var Jt=function(ae,be){var je=this,lt;ae&&r.has(ae,"constructor")?lt=ae.constructor:lt=function(){return je.apply(this,arguments)},r.extend(lt,je,be);var Ft=function(){this.constructor=lt};return Ft.prototype=je.prototype,lt.prototype=new Ft,ae&&r.extend(lt.prototype,ae),lt.__super__=je.prototype,lt};K.extend=ge.extend=Le.extend=Z.extend=Er.extend=Jt;var qt=function(){throw new Error('A "url" property or function must be specified')},wi=function(ae,be){var je=be.error;be.error=function(lt){je&&je.call(be.context,ae,lt,be),ae.trigger("error",ae,lt,be)}};return e})});var gIe={};As(gIe,{JupyterTransportModel:()=>Kee,JupyterTransportView:()=>Qee,MODULE_NAME:()=>Uv,MODULE_VERSION:()=>kv,createDeck:()=>SM,initPlayground:()=>CM,jupyterTransport:()=>wg,updateDeck:()=>KY});var kv=typeof __VERSION__>"u"?"untranspiled source":__VERSION__,Uv="@deck.gl/jupyter-widget";var T2=class{schema;options;shape;length=0;rows=null;cursor=0;_headers=[];constructor(e,r){if(this.options=r,this.schema=e,!Array.isArray(e)){this._headers=[];for(let i in e)this._headers[e[i].index]=e[i].name}}rowCount(){return this.length}addArrayRow(e,r){Number.isFinite(r)&&(this.cursor=r),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}addObjectRow(e,r){Number.isFinite(r)&&(this.cursor=r),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}getBatch(){let e=this.rows;return e?(e=e.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}};function zv(t,e){if(!t)throw new Error("null row");let r={};if(e)for(let i=0;i<e.length;i++)r[e[i]]=t[i];else for(let i=0;i<t.length;i++){let n=`column-${i}`;r[n]=t[i]}return r}function Vv(t,e){if(!t)throw new Error("null row");if(e){let r=new Array(e.length);for(let i=0;i<e.length;i++)r[i]=t[e[i]];return r}return Object.values(t)}function O6(t){let e=[];for(let r=0;r<t.length;r++){let i=`column-${r}`;e.push(i)}return e}function D6(t){return Object.keys(t)}var L6=100,E2=class{schema;options;length=0;objectRows=null;arrayRows=null;cursor=0;_headers=null;constructor(e,r){if(this.options=r,this.schema=e,e){this._headers=[];for(let i in e)this._headers[e[i].index]=e[i].name}}rowCount(){return this.length}addArrayRow(e,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||=O6(e),this.options.shape){case"object-row-table":let i=zv(e,this._headers);this.addObjectRow(i,r);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(L6),this.arrayRows[this.length]=e,this.length++;break}}addObjectRow(e,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||=D6(e),this.options.shape){case"array-row-table":let i=Vv(e,this._headers);this.addArrayRow(i,r);break;case"object-row-table":this.objectRows=this.objectRows||new Array(L6),this.objectRows[this.length]=e,this.length++;break}}getBatch(){let e=this.arrayRows||this.objectRows;return e?(e=e.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}};var S2=class{schema;length=0;allocated=0;columns={};constructor(e,r){this.schema=e,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(e){this._reallocateColumns();let r=0;for(let i in this.columns)this.columns[i][this.length]=e[r++];this.length++}addObjectRow(e){this._reallocateColumns();for(let r in e)this.columns[r][this.length]=e[r];this.length++}getBatch(){this._pruneColumns();let e=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(let i in this.schema){let n=this.schema[i];e[n.name]=this.columns[n.index]}return this.columns={},{shape:"columnar-table",batchType:"data",data:e,schema:this.schema,length:this.length}}_reallocateColumns(){if(!(this.length<this.allocated)){this.allocated=this.allocated>0?this.allocated*=2:100,this.columns={};for(let e in this.schema){let r=this.schema[e],i=r.type||Float32Array,n=this.columns[r.index];if(n&&ArrayBuffer.isView(n)){let o=new i(this.allocated);o.set(n),this.columns[r.index]=o}else n?(n.length=this.allocated,this.columns[r.index]=n):this.columns[r.index]=new i(this.allocated)}}}_pruneColumns(){for(let[e,r]of Object.entries(this.columns))this.columns[e]=r.slice(0,this.length)}};var hre={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},dre="TableBatchBuilder",C2=class{schema;options;aggregator=null;batchCount=0;bytesUsed=0;isChunkComplete=!1;lastBatchEmittedMs=Date.now();totalLength=0;totalBytes=0;rowBytes=0;constructor(e,r){this.schema=e,this.options={...hre,...r}}limitReached(){return!!(Boolean(this.options?.limit)&&this.totalLength>=this.options.limit||Boolean(this.options?._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(e){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(e),this.totalBytes+=this.rowBytes,Array.isArray(e)?this.addArrayRow(e):this.addObjectRow(e))}addArrayRow(e){if(!this.aggregator){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addArrayRow(e)}addObjectRow(e){if(!this.aggregator){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addObjectRow(e)}chunkComplete(e){e instanceof ArrayBuffer&&(this.bytesUsed+=e.byteLength),typeof e=="string"&&(this.bytesUsed+=e.length),this.isChunkComplete=!0}getFullBatch(e){return this._isFull()?this._getBatch(e):null}getFinalBatch(e){return this._getBatch(e)}_estimateRowMB(e){return Array.isArray(e)?e.length*8:Object.keys(e).length*8}_isFull(){if(!this.aggregator||this.aggregator.rowCount()===0)return!1;if(this.options.batchSize==="auto"){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs?!1:(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(e){if(!this.aggregator)return null;e?.bytesUsed&&(this.bytesUsed=e.bytesUsed);let r=this.aggregator.getBatch();return r.count=this.batchCount,r.bytesUsed=this.bytesUsed,Object.assign(r,e),this.batchCount++,this.aggregator=null,r}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return E2;case"columnar-table":return S2;case"arrow-table":if(!C2.ArrowBatch)throw new Error(dre);return C2.ArrowBatch;default:return T2}}},w0=C2;Yr(w0,"ArrowBatch");function F6(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function pd(t){let e=1/0,r=1/0,i=1/0,n=-1/0,o=-1/0,s=-1/0,l=t.POSITION?t.POSITION.value:[],u=l&&l.length;for(let h=0;h<u;h+=3){let v=l[h],T=l[h+1],E=l[h+2];e=v<e?v:e,r=T<r?T:r,i=E<i?E:i,n=v>n?v:n,o=T>o?T:o,s=E>s?E:s}return[[e,r,i],[n,o,s]]}function wP(t,e,r){let i=F6(e.value),n=r||N6(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:i}]},nullable:!1,metadata:n}}function N6(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}var M2=class extends Array{enqueue(e){return this.push(e)}dequeue(){return this.shift()}},T0=class{_values;_settlers;_closed;constructor(){this._values=new M2,this._settlers=new M2,this._closed=!1}close(){for(;this._settlers.length>0;)this._settlers.dequeue().resolve({done:!0});this._closed=!0}[Symbol.asyncIterator](){return this}enqueue(e){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");let r=this._settlers.dequeue();e instanceof Error?r.reject(e):r.resolve({value:e})}else this._values.enqueue(e)}next(){if(this._values.length>0){let e=this._values.dequeue();return e instanceof Error?Promise.reject(e):Promise.resolve({value:e})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0})}return new Promise((e,r)=>{this._settlers.enqueue({resolve:e,reject:r})})}};var k6="\uFEFF",ph={parse:pre,unparse:Are,RECORD_SEP:String.fromCharCode(30),UNIT_SEP:String.fromCharCode(31),BYTE_ORDER_MARK:k6,BAD_DELIMITERS:["\r",`
`,'"',k6],WORKERS_SUPPORTED:!1,NODE_STREAM_INPUT:1,LocalChunkSize:10485760,RemoteChunkSize:5242880,DefaultDelimiter:",",Parser:TP,ParserHandle:z6,ChunkStreamer:U6,StringStreamer:E0},S0=ph;function pre(t,e,r){e=e||{};var i=e.dynamicTyping||!1;if(Ql(i)&&(e.dynamicTypingFunction=i,i={}),e.dynamicTyping=i,e.transform=Ql(e.transform)?e.transform:!1,e.worker&&ph.WORKERS_SUPPORTED){var n=newWorker();n.userStep=e.step,n.userChunk=e.chunk,n.userComplete=e.complete,n.userError=e.error,e.step=Ql(e.step),e.chunk=Ql(e.chunk),e.complete=Ql(e.complete),e.error=Ql(e.error),delete e.worker,n.postMessage({input:t,config:e,workerId:n.id});return}var o=null;return typeof t=="string"&&(o=new E0(e)),o||(o=new r(e)),o.stream(t)}function Are(t,e){var r=!1,i=!0,n=",",o=`\r
`,s='"',l=s+s,u=!1,h=null;T();var v=new RegExp(Hv(s),"g");if(typeof t=="string"&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return M(null,t,u);if(typeof t[0]=="object")return M(h||E(t[0]),t,u)}else if(typeof t=="object")return typeof t.data=="string"&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:E(t.data[0])),!Array.isArray(t.data[0])&&typeof t.data[0]!="object"&&(t.data=[t.data])),M(t.fields||[],t.data||[],u);throw new Error("Unable to serialize unrecognized input");function T(){if(typeof e=="object"){if(typeof e.delimiter=="string"&&!ph.BAD_DELIMITERS.filter(function(z){return e.delimiter.indexOf(z)!==-1}).length&&(n=e.delimiter),(typeof e.quotes=="boolean"||Array.isArray(e.quotes))&&(r=e.quotes),(typeof e.skipEmptyLines=="boolean"||typeof e.skipEmptyLines=="string")&&(u=e.skipEmptyLines),typeof e.newline=="string"&&(o=e.newline),typeof e.quoteChar=="string"&&(s=e.quoteChar),typeof e.header=="boolean"&&(i=e.header),Array.isArray(e.columns)){if(e.columns.length===0)throw new Error("Option columns is empty");h=e.columns}e.escapeChar!==void 0&&(l=e.escapeChar+s)}}function E(z){if(typeof z!="object")return[];var W=[];for(var J in z)W.push(J);return W}function M(z,W,J){var K="";typeof z=="string"&&(z=JSON.parse(z)),typeof W=="string"&&(W=JSON.parse(W));var ne=Array.isArray(z)&&z.length>0,ge=!Array.isArray(W[0]);if(ne&&i){for(var j=0;j<z.length;j++)j>0&&(K+=n),K+=O(z[j],j);W.length>0&&(K+=o)}for(var me=0;me<W.length;me++){var fe=ne?z.length:W[me].length,$=!1,Z=ne?Object.keys(W[me]).length===0:W[me].length===0;if(J&&!ne&&($=J==="greedy"?W[me].join("").trim()==="":W[me].length===1&&W[me][0].length===0),J==="greedy"&&ne){for(var we=[],Oe=0;Oe<fe;Oe++){var he=ge?z[Oe]:Oe;we.push(W[me][he])}$=we.join("").trim()===""}if(!$){for(var Le=0;Le<fe;Le++){Le>0&&!Z&&(K+=n);var ft=ne&&ge?z[Le]:Le;K+=O(W[me][ft],Le)}me<W.length-1&&(!J||fe>0&&!Z)&&(K+=o)}}return K}function O(z,W){if(typeof z>"u"||z===null)return"";if(z.constructor===Date)return JSON.stringify(z).slice(1,25);z=z.toString().replace(v,l);var J=typeof r=="boolean"&&r||Array.isArray(r)&&r[W]||F(z,ph.BAD_DELIMITERS)||z.indexOf(n)>-1||z.charAt(0)===" "||z.charAt(z.length-1)===" ";return J?s+z+s:z}function F(z,W){for(var J=0;J<W.length;J++)if(z.indexOf(W[J])>-1)return!0;return!1}}function U6(t){this._handle=null,this._finished=!1,this._completed=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},e.call(this,t),this.parseChunk=function(r,i){if(this.isFirstChunk&&Ql(this._config.beforeFirstChunk)){var n=this._config.beforeFirstChunk(r);n!==void 0&&(r=n)}this.isFirstChunk=!1;var o=this._partialLine+r;this._partialLine="";var s=this._handle.parse(o,this._baseIndex,!this._finished);if(!(this._handle.paused()||this._handle.aborted())){var l=s.meta.cursor;this._finished||(this._partialLine=o.substring(l-this._baseIndex),this._baseIndex=l),s&&s.data&&(this._rowCount+=s.data.length);var u=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(Ql(this._config.chunk)&&!i){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return;s=void 0,this._completeResults=void 0}return!this._config.step&&!this._config.chunk&&(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),!this._completed&&u&&Ql(this._config.complete)&&(!s||!s.meta.aborted)&&(this._config.complete(this._completeResults,this._input),this._completed=!0),!u&&(!s||!s.meta.paused)&&this._nextChunk(),s}},this._sendError=function(r){Ql(this._config.error)&&this._config.error(r)};function e(r){var i=EP(r);i.chunkSize=parseInt(i.chunkSize),!r.step&&!r.chunk&&(i.chunkSize=null),this._handle=new z6(i),this._handle.streamer=this,this._config=i}}function E0(t){t=t||{},U6.call(this,t);var e;this.stream=function(r){return e=r,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var r=this._config.chunkSize,i=r?e.substr(0,r):e;return e=r?e.substr(r):"",this._finished=!e,this.parseChunk(i)}}}E0.prototype=Object.create(E0.prototype);E0.prototype.constructor=E0;function z6(t){var e=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,r=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,i=this,n=0,o=0,s,l,u=!1,h=!1,v,T=[],E={data:[],errors:[],meta:{}};if(Ql(t.step)){var M=t.step;t.step=function(fe){if(E=fe,z())F();else{if(F(),!E.data||E.data.length===0)return;n+=fe.data.length,t.preview&&n>t.preview?l.abort():M(E,i)}}}this.parse=function(fe,$,Z){var we=t.quoteChar||'"';if(t.newline||(t.newline=j(fe,we)),v=!1,t.delimiter)Ql(t.delimiter)&&(t.delimiter=t.delimiter(fe),E.meta.delimiter=t.delimiter);else{var Oe=ge(fe,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess);Oe.successful?t.delimiter=Oe.bestDelimiter:(v=!0,t.delimiter=ph.DefaultDelimiter),E.meta.delimiter=t.delimiter}var he=EP(t);return t.preview&&t.header&&he.preview++,s=fe,l=new TP(he),E=l.parse(s,$,Z),F(),u?{meta:{paused:!0}}:E||{meta:{paused:!1}}},this.paused=function(){return u},this.pause=function(){u=!0,l.abort(),s=s.substr(l.getCharIndex())},this.resume=function(){u=!1,i.streamer.parseChunk(s,!0)},this.aborted=function(){return h},this.abort=function(){h=!0,l.abort(),E.meta.aborted=!0,Ql(t.complete)&&t.complete(E),s=""};function O(fe){return t.skipEmptyLines==="greedy"?fe.join("").trim()==="":fe.length===1&&fe[0].length===0}function F(){if(E&&v&&(me("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+ph.DefaultDelimiter+"'"),v=!1),t.skipEmptyLines)for(var fe=0;fe<E.data.length;fe++)O(E.data[fe])&&E.data.splice(fe--,1);return z()&&W(),ne()}function z(){return t.header&&T.length===0}function W(){if(!E)return;function fe(Z){Ql(t.transformHeader)&&(Z=t.transformHeader(Z)),T.push(Z)}if(Array.isArray(E.data[0])){for(var $=0;z()&&$<E.data.length;$++)E.data[$].forEach(fe);E.data.splice(0,1)}else E.data.forEach(fe)}function J(fe){return t.dynamicTypingFunction&&t.dynamicTyping[fe]===void 0&&(t.dynamicTyping[fe]=t.dynamicTypingFunction(fe)),(t.dynamicTyping[fe]||t.dynamicTyping)===!0}function K(fe,$){return J(fe)?$==="true"||$==="TRUE"?!0:$==="false"||$==="FALSE"?!1:e.test($)?parseFloat($):r.test($)?new Date($):$===""?null:$:$}function ne(){if(!E||!E.data||!t.header&&!t.dynamicTyping&&!t.transform)return E;function fe(Z,we){var Oe=t.header?{}:[],he;for(he=0;he<Z.length;he++){var Le=he,ft=Z[he];t.header&&(Le=he>=T.length?"__parsed_extra":T[he]),t.transform&&(ft=t.transform(ft,Le)),ft=K(Le,ft),Le==="__parsed_extra"?(Oe[Le]=Oe[Le]||[],Oe[Le].push(ft)):Oe[Le]=ft}return t.header&&(he>T.length?me("FieldMismatch","TooManyFields","Too many fields: expected "+T.length+" fields but parsed "+he,o+we):he<T.length&&me("FieldMismatch","TooFewFields","Too few fields: expected "+T.length+" fields but parsed "+he,o+we)),Oe}var $=1;return!E.data[0]||Array.isArray(E.data[0])?(E.data=E.data.map(fe),$=E.data.length):E.data=fe(E.data,0),t.header&&E.meta&&(E.meta.fields=T),o+=$,E}function ge(fe,$,Z,we,Oe){var he,Le,ft;Oe=Oe||[","," ","|",";",ph.RECORD_SEP,ph.UNIT_SEP];for(var Vt=0;Vt<Oe.length;Vt++){var Yt=Oe[Vt],mr=0,Er=0,Jr=0;ft=void 0;for(var or=new TP({comments:we,delimiter:Yt,newline:$,preview:10}).parse(fe),ai=0;ai<or.data.length;ai++){if(Z&&O(or.data[ai])){Jr++;continue}var Jt=or.data[ai].length;if(Er+=Jt,typeof ft>"u"){ft=0;continue}else Jt>1&&(mr+=Math.abs(Jt-ft),ft=Jt)}or.data.length>0&&(Er/=or.data.length-Jr),(typeof Le>"u"||mr>Le)&&Er>1.99&&(Le=mr,he=Yt)}return t.delimiter=he,{successful:!!he,bestDelimiter:he}}function j(fe,$){fe=fe.substr(0,1024*1024);var Z=new RegExp(Hv($)+"([^]*?)"+Hv($),"gm");fe=fe.replace(Z,"");var we=fe.split("\r"),Oe=fe.split(`
`),he=Oe.length>1&&Oe[0].length<we[0].length;if(we.length===1||he)return`
`;for(var Le=0,ft=0;ft<we.length;ft++)we[ft][0]===`
`&&Le++;return Le>=we.length/2?`\r
`:"\r"}function me(fe,$,Z,we){E.errors.push({type:fe,code:$,message:Z,row:we})}}function Hv(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function TP(t){t=t||{};var e=t.delimiter,r=t.newline,i=t.comments,n=t.step,o=t.preview,s=t.fastMode,l;t.quoteChar===void 0?l='"':l=t.quoteChar;var u=l;if(t.escapeChar!==void 0&&(u=t.escapeChar),(typeof e!="string"||ph.BAD_DELIMITERS.indexOf(e)>-1)&&(e=","),i===e)throw new Error("Comment character same as delimiter");i===!0?i="#":(typeof i!="string"||ph.BAD_DELIMITERS.indexOf(i)>-1)&&(i=!1),r!==`
`&&r!=="\r"&&r!==`\r
`&&(r=`
`);var h=0,v=!1;this.parse=function(T,E,M){if(typeof T!="string")throw new Error("Input must be a string");var O=T.length,F=e.length,z=r.length,W=i.length,J=Ql(n);h=0;var K=[],ne=[],ge=[],j=0;if(!T)return or();if(s||s!==!1&&T.indexOf(l)===-1){for(var me=T.split(r),fe=0;fe<me.length;fe++){if(ge=me[fe],h+=ge.length,fe!==me.length-1)h+=r.length;else if(M)return or();if(!(i&&ge.substr(0,W)===i)){if(J){if(K=[],Yt(ge.split(e)),ai(),v)return or()}else Yt(ge.split(e));if(o&&fe>=o)return K=K.slice(0,o),or(!0)}}return or()}for(var $=T.indexOf(e,h),Z=T.indexOf(r,h),we=new RegExp(Hv(u)+Hv(l),"g"),Oe;;){if(T[h]===l){for(Oe=h,h++;;){if(Oe=T.indexOf(l,Oe+1),Oe===-1)return M||ne.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:K.length,index:h}),Er();if(Oe===O-1){var he=T.substring(h,Oe).replace(we,l);return Er(he)}if(l===u&&T[Oe+1]===u){Oe++;continue}if(!(l!==u&&Oe!==0&&T[Oe-1]===u)){var Le=Z===-1?$:Math.min($,Z),ft=mr(Le);if(T[Oe+1+ft]===e){if(ge.push(T.substring(h,Oe).replace(we,l)),h=Oe+1+ft+F,$=T.indexOf(e,h),Z=T.indexOf(r,h),J&&(ai(),v))return or();if(o&&K.length>=o)return or(!0);break}var Vt=mr(Z);if(T.substr(Oe+1+Vt,z)===r){if(ge.push(T.substring(h,Oe).replace(we,l)),Jr(Oe+1+Vt+z),$=T.indexOf(e,h),J&&(ai(),v))return or();if(o&&K.length>=o)return or(!0);break}ne.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:K.length,index:h}),Oe++}}if(J&&(ai(),v))return or();if(o&&K.length>=o)return or(!0);continue}if(i&&ge.length===0&&T.substr(h,W)===i){if(Z===-1)return or();h=Z+z,Z=T.indexOf(r,h),$=T.indexOf(e,h);continue}if($!==-1&&($<Z||Z===-1)){ge.push(T.substring(h,$)),h=$+F,$=T.indexOf(e,h);continue}if(Z!==-1){if(ge.push(T.substring(h,Z)),Jr(Z+z),J&&(ai(),v))return or();if(o&&K.length>=o)return or(!0);continue}break}return Er();function Yt(Jt){K.push(Jt),j=h}function mr(Jt){var qt=0;if(Jt!==-1){var wi=T.substring(Oe+1,Jt);wi&&wi.trim()===""&&(qt=wi.length)}return qt}function Er(Jt){return M||(typeof Jt>"u"&&(Jt=T.substr(h)),ge.push(Jt),h=O,Yt(ge),J&&ai()),or()}function Jr(Jt){h=Jt,Yt(ge),ge=[],Z=T.indexOf(r,h)}function or(Jt,qt){var wi=qt||!1;return{data:wi?K[0]:K,errors:ne,meta:{delimiter:e,linebreak:r,aborted:v,truncated:!!Jt,cursor:j+(E||0)}}}function ai(){n(or(void 0,!0)),K=[],ne=[]}},this.abort=function(){v=!0},this.getCharIndex=function(){return h}}function EP(t){if(typeof t!="object"||t===null)return t;var e=Array.isArray(t)?[]:{};for(var r in t)e[r]=EP(t[r]);return e}function Ql(t){return typeof t=="function"}var{ChunkStreamer:V6}=S0;function C0(t){t=t||{},V6.call(this,t),this.textDecoder=new TextDecoder(this._config.encoding),this.stream=async function(e){this._input=e;try{for await(let r of e)this.parseChunk(this.getStringChunk(r));this._finished=!0,this.parseChunk("")}catch(r){this._sendError(r)}},this._nextChunk=function(){},this.getStringChunk=function(e){return typeof e=="string"?e:this.textDecoder.decode(e,{stream:!0})}}C0.prototype=Object.create(V6.prototype);C0.prototype.constructor=C0;var mre="4.2.0-beta.2",SP="object-row-table",jv={dataType:null,batchType:null,id:"csv",module:"csv",name:"CSV",version:mre,extensions:["csv","tsv","dsv"],mimeTypes:["text/csv","text/tab-separated-values","text/dsv"],category:"table",parse:async(t,e)=>H6(new TextDecoder().decode(t),e),parseText:(t,e)=>H6(t,e),parseInBatches:gre,options:{csv:{shape:SP,optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[","," ","|",";"]}}};async function H6(t,e){let r={...jv.options.csv,...e?.csv},i=_re(t),o=r.header==="auto"?j6(i):Boolean(r.header),s={...r,header:o,download:!1,transformHeader:o?G6():void 0,error:T=>{throw new Error(T)}},l=S0.parse(t,s),u=l.data,h=l.meta.fields||W6(r.columnPrefix,i.length),v=r.shape||SP;switch(v){case"object-row-table":return{shape:"object-row-table",data:u.map(T=>Array.isArray(T)?zv(T,h):T)};case"array-row-table":return{shape:"array-row-table",data:u.map(T=>Array.isArray(T)?T:Vv(T,h))};default:throw new Error(v)}}function gre(t,e){e={...e},e.batchSize==="auto"&&(e.batchSize=4e3);let r={...jv.options.csv,...e?.csv},i=new T0,n=!0,o=null,s=null,l=null,u={...r,header:!1,download:!1,chunkSize:1024*1024*5,skipEmptyLines:!1,step(h){let v=h.data;if(r.skipEmptyLines&&v.flat().join("").trim()==="")return;let T=h.meta.cursor;if(n&&!o&&(r.header==="auto"?j6(v):Boolean(r.header))){o=v.map(G6());return}n&&(n=!1,o||(o=W6(r.columnPrefix,v.length)),l=yre(v,o)),r.optimizeMemoryUsage&&(v=JSON.parse(JSON.stringify(v)));let E=r.shape||SP;s=s||new w0(l,{shape:E,...e});try{s.addRow(v);let M=s&&s.getFullBatch({bytesUsed:T});M&&i.enqueue(M)}catch(M){i.enqueue(M)}},complete(h){try{let v=h.meta.cursor,T=s&&s.getFinalBatch({bytesUsed:v});T&&i.enqueue(T)}catch(v){i.enqueue(v)}i.close()}};return S0.parse(t,u,C0),i}function j6(t){return t&&t.every(e=>typeof e=="string")}function _re(t){return S0.parse(t,{download:!1,dynamicTyping:!0,preview:1}).data[0]}function G6(){let t=new Set;return e=>{let r=e,i=1;for(;t.has(r);)r=`${e}.${i}`,i++;return t.add(r),r}}function W6(t,e=0){let r=[];for(let i=0;i<e;i++)r.push(`${t}${i+1}`);return r}function yre(t,e){let r=e?{}:[];for(let i=0;i<t.length;i++){let n=e&&e[i]||i;switch(typeof t[i]){case"number":case"boolean":r[n]={name:String(n),index:i,type:Float32Array};break;case"string":default:r[n]={name:String(n),index:i,type:Array}}}return r}async function qc(t,e,r,i){return i._parse(t,e,r,i)}function Bn(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var Ah={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},vre=Ah.self||Ah.window||Ah.global||{},xre=Ah.window||Ah.self||Ah.global||{},bre=Ah.global||Ah.self||Ah.window||{},wre=Ah.document||{};var Ad=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var q6=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Tre=q6&&parseFloat(q6[1])||0;var I2=globalThis,Ere=globalThis.document||{},P2=globalThis.process||{},Sre=globalThis.console,X6=globalThis.navigator||{};function R2(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,r=t||e;return Boolean(r&&r.indexOf("Electron")>=0)}function Ol(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||R2()}function CP(t){return!t&&!Ol()?"Node":R2(t)?"Electron":(t||X6.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var MP="4.0.7";function Mre(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var B2=class{constructor(e,r,i="sessionStorage"){this.storage=Mre(i),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function Y6(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function K6(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var O2;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(O2||(O2={}));var Ire=10;function Z6(t){return typeof t!="string"?t:(t=t.toUpperCase(),O2[t]||O2.WHITE)}function J6(t,e,r){return!Ol&&typeof t=="string"&&(e&&(t=`\x1B[${Z6(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${Z6(r)+Ire}m${t}\x1B[49m`)),t}function Q6(t,e=["constructor"]){let r=Object.getPrototypeOf(t),i=Object.getOwnPropertyNames(r),n=t;for(let o of i){let s=n[o];typeof s=="function"&&(e.find(l=>o===l)||(n[o]=s.bind(t)))}}function Gv(t,e){if(!t)throw new Error(e||"Assertion failed")}function YA(){let t;if(Ol()&&I2.performance)t=I2?.performance?.now?.();else if("hrtime"in P2){let e=P2?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var M0={debug:Ol()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Pre={enabled:!0,level:0};function I0(){}var $6={},eU={once:!0},bc=class{constructor({id:e}={id:""}){this.VERSION=MP,this._startTs=YA(),this._deltaTs=YA(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new B2(`__probe-${this.id}__`,Pre),this.timeStamp(`${this.id} started`),Q6(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((YA()-this._startTs).toPrecision(10))}getDelta(){return Number((YA()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e){return this._getLogFunction(0,e,M0.warn,arguments,eU)}error(e){return this._getLogFunction(0,e,M0.error,arguments)}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r){return this._getLogFunction(e,r,M0.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,M0.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,M0.debug||M0.info,arguments,eU)}table(e,r,i){return r?this._getLogFunction(e,r,console.table||I0,i&&[i],{tag:Bre(r)}):I0}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||I0)}group(e,r,i={collapsed:!1}){let n=tU({logLevel:e,message:r,opts:i}),{collapsed:o}=i;return n.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,r,i={}){return this.group(e,r,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||I0)}withGroup(e,r,i){this.group(e,r)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=rU(e)}_getLogFunction(e,r,i,n,o){if(this._shouldLog(e)){o=tU({logLevel:e,message:r,args:n,opts:o}),i=i||o.method,Gv(i),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=YA();let s=o.tag||o.message;if(o.once&&s)if(!$6[s])$6[s]=YA();else return I0;return r=Rre(this.id,o.message,o),i.bind(console,r,...o.args)}return I0}};bc.VERSION=MP;function rU(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return Gv(Number.isFinite(e)&&e>=0),e}function tU(t){let{logLevel:e,message:r}=t;t.logLevel=rU(e);let i=t.args?Array.from(t.args):[];for(;i.length&&i.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&i.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let n=typeof t.message;return Gv(n==="string"||n==="object"),Object.assign(t,{args:i},t.opts)}function Rre(t,e,r){if(typeof e=="string"){let i=r.time?K6(Y6(r.total)):"";e=r.time?`${t}: ${i} ${e}`:`${t}: ${e}`,e=J6(e,r.color,r.background)}return e}function Bre(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe={};var IP=new bc({id:"@probe.gl/log"});function Wv(t,e){return iU(t||{},e)}function iU(t,e,r=0){if(r>3)return e;let i={...t};for(let[n,o]of Object.entries(e))o&&typeof o=="object"&&!Array.isArray(o)?i[n]=iU(i[n]||{},e[n],r+1):i[n]=e[n];return i}function PP(t){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,t)}function RP(t){return globalThis.loaders?.modules?.[t]||null}var nU="latest";function Ore(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.0-beta.2"),globalThis._loadersgl_.version}var qv=Ore();function vl(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var mh={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},kPe=mh.self||mh.window||mh.global||{},UPe=mh.window||mh.self||mh.global||{},zPe=mh.global||mh.self||mh.window||{},VPe=mh.document||{};var Za=typeof process!="object"||String(process)!=="[object process]"||process.browser,Xv=typeof importScripts=="function",sU=typeof window<"u"&&typeof window.orientation<"u",oU=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),HPe=oU&&parseFloat(oU[1])||0;var Yv=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,r){this.name=e,this.workerThread=r,this.result=new Promise((i,n)=>{this._resolve=i,this._reject=n})}postMessage(e,r){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:r})}done(e){vl(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){vl(this.isRunning),this.isRunning=!1,this._reject(e)}};var P0=class{terminate(){}};var BP=new Map;function aU(t){vl(t.source&&!t.url||!t.source&&t.url);let e=BP.get(t.source||t.url);return e||(t.url&&(e=Dre(t.url),BP.set(t.url,e)),t.source&&(e=lU(t.source),BP.set(t.source,e))),vl(e),e}function Dre(t){if(!t.startsWith("http"))return t;let e=Lre(t);return lU(e)}function lU(t){let e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function Lre(t){return`try {
importScripts('${t}');
} catch (error) {
console.error(error);
throw error;
}`}function OP(t,e=!0,r){let i=r||new Set;if(t){if(cU(t))i.add(t);else if(cU(t.buffer))i.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let n in t)OP(t[n],e,i)}}return r===void 0?Array.from(i):[]}function cU(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}var DP=()=>{},gp=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Za||typeof P0<"u"&&!Za}constructor(e){let{name:r,source:i,url:n}=e;vl(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=DP,this.onError=o=>console.log(o),this.worker=Za?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=DP,this.onError=DP,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,r){r=r||OP(e),this.worker.postMessage(e,r)}_getErrorFromErrorEvent(e){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,e.message&&(r+=`${e.message} in `),e.lineno&&(r+=`:${e.lineno}:${e.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=aU({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},e.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},e.onmessageerror=r=>console.error(r),e}_createNodeWorker(){let e;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new P0(i,{eval:!1})}else if(this.source)e=new P0(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",r=>{this.onMessage(r)}),e.on("error",r=>{this.onError(r)}),e.on("exit",r=>{}),e}};var Kv=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return gp.isSupported()}constructor(e){this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e,r=(n,o,s)=>n.done(s),i=(n,o)=>n.error(o)){let n=new Promise(o=>(this.jobQueue.push({name:e,onMessage:r,onError:i,onStart:o}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:e,backlog:this.jobQueue.length});let i=new Yv(r.name,e);e.onMessage=n=>r.onMessage(i,n.type,n.payload),e.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}catch(n){console.error(`Worker exception: ${n}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!Za||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new gp({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return sU?this.maxMobileConcurrency:this.maxConcurrency}};var Fre={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},KA=class{props;workerPools=new Map;static isSupported(){return gp.isSupported()}static getWorkerFarm(e={}){return KA._workerFarm=KA._workerFarm||new KA({}),KA._workerFarm.setProps(e),KA._workerFarm}constructor(e){this.props={...Fre},this.setProps(e),this.workerPools=new Map}destroy(){for(let e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:r,source:i,url:n}=e,o=this.workerPools.get(r);return o||(o=new Kv({name:r,source:i,url:n}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},_p=KA;Yr(_p,"_workerFarm");function LP(t,e={}){let r=e[t.id]||{},i=Za?`${t.id}-worker.js`:`${t.id}-worker-node.js`,n=r.workerUrl;if(!n&&t.id==="compression"&&(n=e.workerUrl),e._workerType==="test"&&(Za?n=`modules/${t.module}/dist/${i}`:n=`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!n){let o=t.version;o==="latest"&&(o=nU);let s=o?`@${o}`:"";n=`https://unpkg.com/@loaders.gl/${t.module}${s}/dist/${i}`}return vl(n),n}function FP(t,e=qv){vl(t,"no worker provided");let r=t.version;return!(!e||!r)}var NP={};async function gh(t,e=null,r={},i=null){return e&&(t=uU(t,e,r,i)),NP[t]=NP[t]||Nre(t),await NP[t]}function uU(t,e,r={},i=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;i=i||t;let n=r.modules||{};return n[i]?n[i]:Za?r.CDN?(vl(r.CDN.startsWith("http")),`${r.CDN}/${e}@${qv}/dist/libs/${i}`):Xv?`../src/libs/${i}`:`modules/${e}/src/libs/${i}`:`modules/${e}/dist/libs/${i}`}async function Nre(t){if(t.endsWith("wasm"))return await Ure(t);if(!Za)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(t)}catch(r){return console.error(r),null}if(Xv)return importScripts(t);let e=await zre(t);return kre(e,t)}function kre(t,e){if(!Za){let{requireFromString:i}=globalThis.loaders||{};return i?.(t,e)}if(Xv)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function Ure(t){let{readFileAsArrayBuffer:e}=globalThis.loaders||{};return Za||!e||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await e(t)}async function zre(t){let{readFileAsText:e}=globalThis.loaders||{};return Za||!e||t.startsWith("http")?await(await fetch(t)).text():await e(t)}function kP(t,e){return!_p.isSupported()||!Za&&!e?._nodeWorkers?!1:t.worker&&e?.worker}async function UP(t,e,r,i,n){let o=t.id,s=LP(t,r),u=_p.getWorkerFarm(r).getWorkerPool({name:o,url:s});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let h=await u.startJob("process-on-worker",Vre.bind(null,n));return h.postMessage("process",{input:e,options:r,context:i}),await(await h.result).result}async function Vre(t,e,r,i){switch(r){case"done":e.done(i);break;case"error":e.error(new Error(i.error));break;case"process":let{id:n,input:o,options:s}=i;try{let l=await t(o,s);e.postMessage("done",{id:n,result:l})}catch(l){let u=l instanceof Error?l.message:"unknown error";e.postMessage("error",{id:n,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function hU(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?fU(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?fU(t,0,e):""}function fU(t,e,r){if(t.byteLength<=e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function zP(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${hU(t)}"`)}}function VP(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;let i=new Uint8Array(t),n=new Uint8Array(e);for(let o=0;o<i.length;++o)if(i[o]!==n[o])return!1;return!0}function HP(...t){return dU(t)}function dU(t){let e=t.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=e.reduce((o,s)=>o+s.byteLength,0),i=new Uint8Array(r),n=0;for(let o of e)i.set(o,n),n+=o.byteLength;return i.buffer}function Zv(...t){let e=t,r=e&&e.length>1&&e[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=e.reduce((s,l)=>s+l.length,0),n=new r(i),o=0;for(let s of e)n.set(s,o),o+=s.length;return n}function ZA(t,e,r){let i=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(i).buffer}function yp(t,e){return Bn(t>=0),Bn(e>0),t+(e-1)&~(e-1)}function jP(t,e,r){let i;if(t instanceof ArrayBuffer)i=new Uint8Array(t);else{let n=t.byteOffset,o=t.byteLength;i=new Uint8Array(t.buffer||t.arrayBuffer,n,o)}return e.set(i,r),r+yp(i.byteLength,4)}async function GP(t){let e=[];for await(let r of t)e.push(r);return HP(...e)}function Jv(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var JA=class{constructor(e,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Jv(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Jv()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Dl=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:i}=e,n=this.stats[r];return n||(e instanceof JA?n=e:n=new JA(r,i),this.stats[r]=n),n}};var Hre="Queued Requests",jre="Active Requests",Gre="Cancelled Requests",Wre="Queued Requests Ever",qre="Active Requests Ever",Xre={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},vp=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...Xre,...e},this.stats=new Dl({id:this.props.id}),this.stats.get(Hre),this.stats.get(jre),this.stats.get(Gre),this.stats.get(Wre),this.stats.get(qre)}scheduleRequest(e,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let i={handle:e,priority:0,getPriority:r},n=new Promise(o=>(i.resolve=o,i));return this.requestQueue.push(i),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){let{handle:r,resolve:i}=e,n=!1,o=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let i=this.requestQueue.shift();i&&this._issueRequest(i)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let i=e[r];this._updateRequest(i)||(e.splice(r,1),this.requestMap.delete(i.handle),r--)}e.sort((r,i)=>r.priority-i.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var Yre="",pU={};function WP(t){for(let e in pU)if(t.startsWith(e)){let r=pU[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${Yre}${t}`),t}function AU(t){return t&&typeof t=="object"&&t.isBuffer}function D2(t){if(AU(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if(typeof t=="string"){let e=t;return new TextEncoder().encode(e).buffer}if(t&&typeof t=="object"&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}var Xc={};As(Xc,{dirname:()=>Zre,filename:()=>Kre,join:()=>Jre,resolve:()=>Qre});function mU(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=window.location?.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function Kre(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function Zre(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function Jre(...t){let e="/";return t=t.map((r,i)=>(i&&(r=r.replace(new RegExp(`^${e}`),"")),i!==t.length-1&&(r=r.replace(new RegExp(`${e}$`),"")),r)),t.join(e)}function Qre(...t){let e=[];for(let o=0;o<t.length;o++)e[o]=t[o];let r="",i=!1,n;for(let o=e.length-1;o>=-1&&!i;o--){let s;o>=0?s=e[o]:(n===void 0&&(n=mU()),s=n),s.length!==0&&(r=`${s}/${r}`,i=s.charCodeAt(0)===Qv)}return r=$re(r,!i),i?`/${r}`:r.length>0?r:"."}var Qv=47,qP=46;function $re(t,e){let r="",i=-1,n=0,o,s=!1;for(let l=0;l<=t.length;++l){if(l<t.length)o=t.charCodeAt(l);else{if(o===Qv)break;o=Qv}if(o===Qv){if(!(i===l-1||n===1))if(i!==l-1&&n===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==qP||r.charCodeAt(r.length-2)!==qP){if(r.length>2){let u=r.length-1,h=u;for(;h>=0&&r.charCodeAt(h)!==Qv;--h);if(h!==u){r=h===-1?"":r.slice(0,h),i=l,n=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",i=l,n=0,s=!1;continue}}e&&(r.length>0?r+="/..":r="..",s=!0)}else{let u=t.slice(i+1,l);r.length>0?r+=`/${u}`:r=u,s=!1}i=l,n=0}else o===qP&&n!==-1?++n:n=-1}return r}var L2=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(e){this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=eie(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){let r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}};function eie(t){let e=t?.fetch;if(e&&typeof e=="function")return(i,n)=>e(i,n);let r=t?.fetch;return r&&typeof r!="function"?i=>fetch(i,r):i=>fetch(i)}var Eu=class extends L2{};Yr(Eu,"type","template"),Yr(Eu,"testURL",e=>!1);var tie=t=>typeof t=="boolean",$v=t=>typeof t=="function",QA=t=>t!==null&&typeof t=="object",XP=t=>QA(t)&&t.constructor==={}.constructor;var gU=t=>Boolean(t)&&typeof t[Symbol.iterator]=="function",_U=t=>t&&typeof t[Symbol.asyncIterator]=="function";var Su=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json;var Cu=t=>typeof Blob<"u"&&t instanceof Blob,yU=t=>t&&typeof t=="object"&&t.isBuffer;var rie=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||QA(t)&&$v(t.tee)&&$v(t.cancel)&&$v(t.getReader);var iie=t=>QA(t)&&$v(t.read)&&$v(t.pipe)&&tie(t.readable),F2=t=>rie(t)||iie(t);var N2=class extends Error{constructor(e,r){super(e),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var nie=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,oie=/^([-\w.]+\/[-\w.+]+)/;function YP(t,e){return t.toLowerCase()===e.toLowerCase()}function vU(t){let e=oie.exec(t);return e?e[1]:t}function KP(t){let e=nie.exec(t);return e?e[1]:""}var xU=/\?.*/;function bU(t){let e=t.match(xU);return e&&e[0]}function R0(t){return t.replace(xU,"")}function wU(t){if(t.length<50)return t;let e=t.slice(t.length-15);return`${t.substr(0,32)}...${e}`}function $A(t){return Su(t)?t.url:Cu(t)?t.name||"":typeof t=="string"?t:""}function ex(t){if(Su(t)){let e=t,r=e.headers.get("content-type")||"",i=R0(e.url);return vU(r)||KP(i)}return Cu(t)?t.type||"":typeof t=="string"?KP(t):""}function TU(t){return Su(t)?t.headers["content-length"]||-1:Cu(t)?t.size:typeof t=="string"?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}async function k2(t){if(Su(t))return t;let e={},r=TU(t);r>=0&&(e["content-length"]=String(r));let i=$A(t),n=ex(t);n&&(e["content-type"]=n);let o=await aie(t);o&&(e["x-first-bytes"]=o),typeof t=="string"&&(t=new TextEncoder().encode(t));let s=new Response(t,{headers:e});return Object.defineProperty(s,"url",{value:i}),s}async function EU(t){if(!t.ok)throw await sie(t)}async function sie(t){let e=wU(t.url),r=`Failed to fetch resource (${t.status}) ${t.statusText}: ${e}`;r=r.length>100?`${r.slice(0,100)}...`:r;let i={reason:t.statusText,url:t.url,response:t};try{let n=t.headers.get("Content-Type");i.reason=n?.includes("application/json")?await t.json():t.text()}catch{}return new N2(r,i)}async function aie(t){if(typeof t=="string")return`data:,${t.slice(0,5)}`;if(t instanceof Blob){let r=t.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=o=>i(o?.target?.result),n.readAsDataURL(r)})}if(t instanceof ArrayBuffer){let r=t.slice(0,5);return`data:base64,${lie(r)}`}return null}function lie(t){let e="",r=new Uint8Array(t);for(let i=0;i<r.byteLength;i++)e+=String.fromCharCode(r[i]);return btoa(e)}function cie(t){return!uie(t)&&!fie(t)}function uie(t){return t.startsWith("http:")||t.startsWith("https:")}function fie(t){return t.startsWith("data:")}async function B0(t,e){if(typeof t=="string"){let r=WP(t);return cie(r)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(r,e):await fetch(r,e)}return await k2(t)}var ZP=new bc({id:"loaders.gl"}),U2=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},z2=class{console;constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}};var JP={fetch:null,mimeType:void 0,nothrow:!1,log:new z2,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Ad,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},SU={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function QP(){globalThis.loaders=globalThis.loaders||{};let{loaders:t}=globalThis;return t._state||(t._state={}),t._state}function $P(){let t=QP();return t.globalOptions=t.globalOptions||{...JP},t.globalOptions}function IU(t,e,r,i){return r=r||[],r=Array.isArray(r)?r:[r],hie(t,r),pie(e,t,i)}function hie(t,e){CU(t,null,JP,SU,e);for(let r of e){let i=t&&t[r.id]||{},n=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};CU(i,r.id,n,o,e)}}function CU(t,e,r,i,n){let o=e||"Top level",s=e?`${e}.`:"";for(let l in t){let u=!e&&QA(t[l]),h=l==="baseUri"&&!e,v=l==="workerUrl"&&e;if(!(l in r)&&!h&&!v){if(l in i)ZP.warn(`${o} loader option '${s}${l}' no longer supported, use '${i[l]}'`)();else if(!u){let T=die(l,n);ZP.warn(`${o} loader option '${s}${l}' not recognized. ${T}`)()}}}}function die(t,e){let r=t.toLowerCase(),i="";for(let n of e)for(let o in n.options){if(t===o)return`Did you mean '${n.id}.${o}'?`;let s=o.toLowerCase();(r.startsWith(s)||s.startsWith(r))&&(i=i||`Did you mean '${n.id}.${o}'?`)}return i}function pie(t,e,r){let n={...t.options||{}};return Aie(n,r),n.log===null&&(n.log=new U2),MU(n,$P()),MU(n,e),n}function MU(t,e){for(let r in e)if(r in e){let i=e[r];XP(i)&&XP(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function Aie(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}function tx(t){return t?(Array.isArray(t)&&(t=t[0]),Array.isArray(t?.extensions)):!1}function rx(t){Bn(t,"null loader"),Bn(tx(t),"invalid loader");let e;return Array.isArray(t)&&(e=t[1],t=t[0],t={...t,options:{...t.options,...e}}),(t?.parseTextSync||t?.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}var PU=()=>{let t=QP();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function em(t){let e=PU();t=Array.isArray(t)?t:[t];for(let r of t){let i=rx(r);e.find(n=>i===n)||e.unshift(i)}}function RU(){return PU()}var BU=new bc({id:"loaders.gl"});var mie=/\.([^.]+)$/;async function LU(t,e=[],r,i){if(!FU(t))return null;let n=OU(t,e,{...r,nothrow:!0},i);if(n)return n;if(Cu(t)&&(t=await t.slice(0,10).arrayBuffer(),n=OU(t,e,r,i)),!n&&!r?.nothrow)throw new Error(NU(t));return n}function OU(t,e=[],r,i){if(!FU(t))return null;if(e&&!Array.isArray(e))return rx(e);let n=[];e&&(n=n.concat(e)),r?.ignoreRegisteredLoaders||n.push(...RU()),_ie(n);let o=gie(t,n,r,i);if(!o&&!r?.nothrow)throw new Error(NU(t));return o}function gie(t,e,r,i){let n=$A(t),o=ex(t),s=R0(n)||i?.url,l=null,u="";return r?.mimeType&&(l=e3(e,r?.mimeType),u=`match forced by supplied MIME type ${r?.mimeType}`),l=l||yie(e,s),u=u||(l?`matched url ${s}`:""),l=l||e3(e,o),u=u||(l?`matched MIME type ${o}`:""),l=l||xie(e,t),u=u||(l?`matched initial data ${kU(t)}`:""),r?.fallbackMimeType&&(l=l||e3(e,r?.fallbackMimeType),u=u||(l?`matched fallback MIME type ${o}`:"")),u&&BU.log(1,`selectLoader selected ${l?.name}: ${u}.`),l}function FU(t){return!(t instanceof Response&&t.status===204)}function NU(t){let e=$A(t),r=ex(t),i="No valid loader found (";i+=e?`${Xc.filename(e)}, `:"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=t?kU(t):"";return i+=n?` first bytes: "${n}"`:"first bytes: not available",i+=")",i}function _ie(t){for(let e of t)rx(e)}function yie(t,e){let r=e&&mie.exec(e),i=r&&r[1];return i?vie(t,i):null}function vie(t,e){e=e.toLowerCase();for(let r of t)for(let i of r.extensions)if(i.toLowerCase()===e)return r;return null}function e3(t,e){for(let r of t)if(r.mimeTypes?.some(i=>YP(e,i))||YP(e,`application/x.${r.id}`))return r;return null}function xie(t,e){if(!e)return null;for(let r of t)if(typeof e=="string"){if(bie(e,r))return r}else if(ArrayBuffer.isView(e)){if(DU(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer&&DU(e,0,r))return r;return null}function bie(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some(i=>t.startsWith(i))}function DU(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>wie(t,e,r,n))}function wie(t,e,r,i){if(i instanceof ArrayBuffer)return VP(i,t,i.byteLength);switch(typeof i){case"function":return i(t);case"string":let n=t3(t,e,i.length);return i===n;default:return!1}}function kU(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?t3(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?t3(t,0,e):""}function t3(t,e,r){if(t.byteLength<e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function*UU(t,e){let r=e?.chunkSize||262144,i=0,n=new TextEncoder;for(;i<t.length;){let o=Math.min(t.length-i,r),s=t.slice(i,i+o);i+=o,yield n.encode(s)}}function*zU(t,e={}){let{chunkSize:r=262144}=e,i=0;for(;i<t.byteLength;){let n=Math.min(t.byteLength-i,r),o=new ArrayBuffer(n),s=new Uint8Array(t,i,n);new Uint8Array(o).set(s),i+=n,yield o}}async function*VU(t,e){let r=e?.chunkSize||1048576,i=0;for(;i<t.size;){let n=i+r,o=await t.slice(i,n).arrayBuffer();i=n,yield o}}function r3(t,e){return Ad?Tie(t,e):Eie(t,e)}async function*Tie(t,e){let r=t.getReader(),i;try{for(;;){let n=i||r.read();e?._streamReadAhead&&(i=r.read());let{done:o,value:s}=await n;if(o)return;yield D2(s)}}catch{r.releaseLock()}}async function*Eie(t,e){for await(let r of t)yield D2(r)}function HU(t,e){if(typeof t=="string")return UU(t,e);if(t instanceof ArrayBuffer)return zU(t,e);if(Cu(t))return VU(t,e);if(F2(t))return r3(t,e);if(Su(t))return r3(t.body,e);throw new Error("makeIterator")}var jU="Cannot convert supplied data type";function Sie(t,e,r){if(e.text&&typeof t=="string")return t;if(yU(t)&&(t=t.buffer),t instanceof ArrayBuffer){let i=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let i=t.buffer,n=t.byteLength||t.length;return(t.byteOffset!==0||n!==i.byteLength)&&(i=i.slice(t.byteOffset,t.byteOffset+n)),i}throw new Error(jU)}async function GU(t,e,r){let i=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if(typeof t=="string"||i)return Sie(t,e,r);if(Cu(t)&&(t=await k2(t)),Su(t)){let n=t;return await EU(n),e.binary?await n.arrayBuffer():await n.text()}if(F2(t)&&(t=HU(t,r)),gU(t)||_U(t))return GP(t);throw new Error(jU)}function V2(t,e){let r=$P(),i=t||r;return typeof i.fetch=="function"?i.fetch:QA(i.fetch)?n=>B0(n,i.fetch):e?.fetch?e?.fetch:B0}function WU(t,e,r){if(r)return r;let i={fetch:V2(e,t),...t};if(i.url){let n=R0(i.url);i.baseUrl=n,i.queryString=bU(i.url),i.filename=Xc.filename(n),i.baseUrl=Xc.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function qU(t,e){if(t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){let i=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...i]:i}return r&&r.length?r:void 0}async function xp(t,e,r,i){e&&!Array.isArray(e)&&!tx(e)&&(i=void 0,r=e,e=void 0),t=await t,r=r||{};let n=$A(t),s=qU(e,i),l=await LU(t,s,r);return l?(r=IU(r,l,s,n),i=WU({url:n,_parse:xp,loaders:s},r,i||null),await Cie(l,t,r,i)):null}async function Cie(t,e,r,i){if(FP(t),r=Wv(t.options,r),Su(e)){let o=e,{ok:s,redirected:l,status:u,statusText:h,type:v,url:T}=o,E=Object.fromEntries(o.headers.entries());i.response={headers:E,ok:s,redirected:l,status:u,statusText:h,type:v,url:T}}e=await GU(e,t,r);let n=t;if(n.parseTextSync&&typeof e=="string")return n.parseTextSync(e,r,i);if(kP(t,r))return await UP(t,e,r,i,xp);if(n.parseText&&typeof e=="string")return await n.parseText(e,r,i);if(n.parse)return await n.parse(e,r,i);throw vl(!n.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}async function _a(t,e,r,i){let n,o;!Array.isArray(e)&&!tx(e)?(n=[],o=e,i=void 0):(n=e,o=r);let s=V2(o),l=t;return typeof t=="string"&&(l=await s(t)),Cu(t)&&(l=await s(t)),Array.isArray(n)?await xp(l,n,o):await xp(l,n,o)}var Kt=new bc({id:"luma.gl"});var i3=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new Dl({id:e})),this.stats.get(e)}},O0=new i3;function Mie(){let t="9.0.12",e="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==t)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${t}`);return globalThis.luma||(Ol()&&Kt.log(1,`${t} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:t,version:t,log:Kt,stats:O0}),t}var XU=Mie();function Iie(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)?t:null}function bp(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number"?t:null:Iie(t)}var n3={};function oa(t="id"){n3[t]=n3[t]||1;let e=n3[t]++;return`${t}-${e}`}function wp(t){let e=!0;for(let r in t){e=!1;break}return e}var fn=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,r,i){if(!e)throw new Error("no device");this._device=e,this.props=Pie(r,i);let n=this.props.id!=="undefined"?this.props.id:oa(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(e,r=this[Symbol.toStringTag]){let i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.get(`${r} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${r}s Created`).incrementCount(),e.get(`${r}s Active`).incrementCount()}};Yr(fn,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Pie(t,e){let r={...e};for(let i in t)t[i]!==void 0&&(r[i]=t[i]);return r}var ix=class extends fn{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,r){let i={...r};(r.usage||0)&ix.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?i.indexType="uint32":r.data instanceof Uint16Array&&(i.indexType="uint16")),super(e,i,ix.defaultProps),this.usage=r.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,r){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,r,i){let n=ArrayBuffer.isView(e)?e.buffer:e,o=Math.min(e?e.byteLength:i,ix.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(o):r===0&&i===e.byteLength?this.debugData=n.slice(0,o):this.debugData=n.slice(r,r+o)}},Xi=ix;Yr(Xi,"defaultProps",{...fn.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),Yr(Xi,"MAP_READ",1),Yr(Xi,"MAP_WRITE",2),Yr(Xi,"COPY_SRC",4),Yr(Xi,"COPY_DST",8),Yr(Xi,"INDEX",16),Yr(Xi,"VERTEX",32),Yr(Xi,"UNIFORM",64),Yr(Xi,"STORAGE",128),Yr(Xi,"INDIRECT",256),Yr(Xi,"QUERY_RESOLVE",512),Yr(Xi,"DEBUG_DATA_MAX_LENGTH",32);function H2(t){let e=YU[t],r=Rie(e),i=t.includes("norm"),n=!i&&!t.startsWith("float"),o=t.startsWith("s");return{dataType:YU[t],byteLength:r,integer:n,signed:o,normalized:i}}function Rie(t){return Bie[t]}var YU={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Bie={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Oie=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Die=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function KU(t){return Oie.some(e=>t.startsWith(e))}function j2(t){let e=Die.exec(t);if(e){let[,r,i,n,o,s]=e;if(r){let l=`${n}${i}`,u=H2(l);return{format:r,components:r.length,srgb:o==="-srgb",unsized:s==="-unsized",webgl:s==="-webgl",...u}}}return Fie(t)}var Lie={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Fie(t){let e=Lie[t];if(!e)throw new Error(`Unknown format ${t}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var nx=class{},ox=class{features;disabledFeatures;constructor(e=[],r){this.features=new Set(e),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures[e]&&this.features.has(e)}},o3=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...o3.defaultProps,...e},this.id=this.props.id||oa(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=O0;_lumaData={};isTextureFormatCompressed(e){return KU(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,r){throw new Error("not implemented")}readPixelsToBufferWebGL(e,r){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,r){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let r={...e};return(e.usage||0)&Xi.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?r.indexType="uint32":e.data instanceof Uint16Array?r.indexType="uint16":Kt.warn("indices buffer content must be of integer type")()),r}},Yc=o3;Yr(Yc,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(Kt.get("debug")),spector:Boolean(Kt.get("spector")||Kt.get("spectorjs")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>Kt.error(e.message)}),Yr(Yc,"VERSION",XU);function Yi(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}var sx=new Map,s3=class{static registerDevices(e){for(let r of e)Yi(r.type&&r.isSupported&&r.create),sx.set(r.type,r)}static getAvailableDevices(){return Array.from(sx).map(e=>e.type)}static getSupportedDevices(){return Array.from(sx).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(Yc.defaultProps,e)}static async attachDevice(e){let r=ZU(e.devices)||sx;if(e.handle instanceof WebGL2RenderingContext){let i=r.get("webgl");if(i)return await i.attach(e.handle)}if(e.handle===null){let i=r.get("unknown");if(i)return await i.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(e={}){e={...s3.defaultProps,...e},e.gl&&(e.type="webgl");let r=ZU(e.devices)||sx;switch(e.type){case"webgpu":let i=r.get("webgpu");if(i)return await i.create(e);break;case"webgl":let n=r.get("webgl");if(n)return await n.create(e);break;case"unknown":let o=r.get("unknown");if(o)return await o.create(e);break;case"best-available":if(i=r.get("webgpu"),i?.isSupported?.())return await i.create(e);if(n=r.get("webgl"),n?.isSupported?.())return await n.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(e=!0){let r=HTMLCanvasElement.prototype;if(!e&&r.originalGetContext){r.getContext=r.originalGetContext,r.originalGetContext=void 0;return}r.originalGetContext=r.getContext,r.getContext=function(i,n){return i==="webgl"||i==="experimental-webgl"?this.originalGetContext("webgl2",n):this.originalGetContext(i,n)}}},Ll=s3;Yr(Ll,"defaultProps",{...Yc.defaultProps,type:"best-available",devices:void 0}),Yr(Ll,"stats",O0),Yr(Ll,"log",Kt);function ZU(t){if(!t||t?.length===0)return null;let e=new Map;for(let r of t)e.set(r.type,r);return e}var Nie=Ol()&&typeof document<"u",G2=()=>Nie&&document.readyState==="complete",kie={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},Tp=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return G2()}constructor(e){if(this.props={...kie,...e},e=this.props,!Ol()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=Vie(e.canvas):this.canvas=e.canvas;else{let r=Hie(e),i=zie(e?.container||null);i.insertBefore(r,i.firstChild),this.canvas=r,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let i of r)i.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*e,r.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,r]=this.getPixelSize();return e/r}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:r}=this._canvasSizeInfo;return r?e/r:1}catch{return 1}}cssToDevicePixels(e,r=!0){let i=this.cssToDeviceRatio(),[n,o]=this.getDrawingBufferSize();return jie(e,i,n,o,r)}setDevicePixelRatio(e,r={}){if(!this.htmlCanvas)return;let i="width"in r?r.width:this.htmlCanvas.clientWidth,n="height"in r?r.height:this.htmlCanvas.clientHeight;(!i||!n)&&(Kt.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,i=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==i||o.clientHeight!==n||o.devicePixelRatio!==e){let s=e,l=Math.floor(i*s),u=Math.floor(n*s);this.htmlCanvas.width=l,this.htmlCanvas.height=u;let[h,v]=this.getDrawingBufferSize();(h!==l||v!==u)&&(s=Math.min(h/i,v/n),this.htmlCanvas.width=Math.floor(i*s),this.htmlCanvas.height=Math.floor(n*s),Kt.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};Yr(Tp,"pageLoaded",Uie());function Uie(){return G2()||typeof window>"u"?Promise.resolve():new Promise(t=>{window.addEventListener("load",()=>t())})}function zie(t){if(typeof t=="string"){let e=document.getElementById(t);if(!e&&!G2())throw new Error(`Accessing '${t}' before page was loaded`);if(!e)throw new Error(`${t} is not an HTML element`);return e}else if(t)return t;return document.body}function Vie(t){let e=document.getElementById(t);if(!e&&!G2())throw new Error(`Accessing '${t}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function Hie(t){let{width:e,height:r}=t,i=document.createElement("canvas");return i.id="lumagl-auto-created-canvas",i.width=e||1,i.height=r||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(r)?`${r}px`:"100%",i}function jie(t,e,r,i,n){let o=t,s=JU(o[0],e,r),l=QU(o[1],e,i,n),u=JU(o[0]+1,e,r),h=u===r-1?u:u-1;u=QU(o[1]+1,e,i,n);let v;return n?(u=u===0?u:u+1,v=l,l=u):v=u===i-1?u:u-1,{x:s,y:l,width:Math.max(h-s+1,1),height:Math.max(v-l+1,1)}}function JU(t,e,r){return Math.min(Math.round(t*e),r-1)}function QU(t,e,r,i){return i?Math.max(0,r-1-Math.round(t*e)):Math.min(Math.round(t*e),r-1)}var a3=class extends fn{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,r,i=a3.defaultProps){super(e,r,i),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=e.incrementTimestamp()}},bo=a3;Yr(bo,"defaultProps",{...fn.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),Yr(bo,"COPY_SRC",1),Yr(bo,"COPY_DST",2),Yr(bo,"TEXTURE_BINDING",4),Yr(bo,"STORAGE_BINDING",8),Yr(bo,"RENDER_ATTACHMENT",16);var l3=class extends fn{get[Symbol.toStringTag](){return"TextureView"}constructor(e,r){super(e,r,l3.defaultProps)}},Ep=l3;Yr(Ep,"defaultProps",{...fn.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});function ez(t,e,r){let i="",n=e.split(/\r?\n/),o=t.slice().sort((s,l)=>s.lineNum-l.lineNum);switch(r?.showSourceCode||"no"){case"all":let s=0;for(let l=1;l<=n.length;l++)for(i+=tz(n[l-1],l,r);o.length>s&&o[s].lineNum===l;){let u=o[s++];i+=$U(u,n,u.lineNum,{...r,inlineSource:!1})}return i;case"issues":case"no":for(let l of t)i+=$U(l,n,l.lineNum,{inlineSource:r?.showSourceCode!=="no"});return i}}function $U(t,e,r,i){if(i?.inlineSource){let n=Gie(e,r),o=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^
`:"";return`
${n}${o}${t.type.toUpperCase()}: ${t.message}
`}return i?.html?`<div class='luma-compiler-log-error' style="color:red;"><b> ${t.type.toUpperCase()}: ${t.message}</b></div>`:`${t.type.toUpperCase()}: ${t.message}`}function Gie(t,e,r){let i="";for(let n=e-2;n<=e;n++){let o=t[n-1];o!==void 0&&(i+=tz(o,e,r))}return i}function tz(t,e,r){let i=r?.html?qie(t):t;return`${Wie(String(e),4)}: ${i}${r?.html?"<br/>":`
`}`}function Wie(t,e){let r="";for(let i=t.length;i<e;++i)r+=" ";return r+t}function qie(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function c3(t,e){return{name:Xie(t,e),language:"glsl",version:Yie(t)}}function Xie(t,e="unnamed"){let i=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(t);return i?i[1]:e}function Yie(t){let e=100,r=t.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let i=parseInt(r[1],10);Number.isFinite(i)&&(e=i)}return e}var u3=class extends fn{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,r){super(e,{id:Kie(r),...r},u3.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(e=this.props.debug){switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let r=await this.getCompilationInfo();this.props.debug==="warnings"&&r?.length===0||this._displayShaderLog(r)}_displayShaderLog(e){if(typeof document>"u"||!document?.createElement)return;let r=c3(this.source).name,i=`${this.stage} ${r}`,n=ez(e,this.source,{showSourceCode:"all",html:!0}),o=this.getTranslatedSource();o&&(n+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${o}</pre></code>`);let s=document.createElement("Button");s.innerHTML=`
<h1>Shader Compilation Error in ${i}</h1><br /><br />
<code style="user-select:text;"><pre>
${n}
</pre></code>`,s.style.top="10px",s.style.left="10px",s.style.position="absolute",s.style.zIndex="9999",s.style.width="100%",s.style.textAlign="left",document.body.appendChild(s);let l=document.getElementsByClassName("luma-compiler-log-error");l[0]?.scrollIntoView&&l[0].scrollIntoView(),s.onclick=()=>{let u=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(u)}}},Sp=u3;Yr(Sp,"defaultProps",{...fn.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function Kie(t){return c3(t.source).name||t.id||oa(`unnamed ${t.stage}-shader`)}var f3=class extends fn{get[Symbol.toStringTag](){return"Sampler"}constructor(e,r){super(e,r,f3.defaultProps)}},Cp=f3;Yr(Cp,"defaultProps",{...fn.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var h3=class extends fn{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,r={}){super(e,r,h3.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let r=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];r=r||n!==this.height||i!==this.width,this.width=i,this.height=n}r&&(Kt.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(r=>{if(typeof r=="string"){let i=this.createColorTexture(r);return this.attachResource(i),i.view}return r instanceof bo?r.view:r});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let r=this.createDepthStencilTexture(e);this.attachResource(r),this.depthStencilAttachment=r.view}else e instanceof bo?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:bo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:bo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,r){for(let i=0;i<this.colorAttachments.length;++i)if(this.colorAttachments[i]){let n=this.device._createTexture({...this.colorAttachments[i].props,width:e,height:r});this.destroyAttachedResource(this.colorAttachments[i]),this.colorAttachments[i]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let i=this.device._createTexture({...this.depthStencilAttachment.props,width:e,height:r});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}}},_h=h3;Yr(_h,"defaultProps",{...fn.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var d3=class extends fn{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,r){super(e,r,d3.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},Af=d3;Yr(Af,"defaultProps",{...fn.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var p3=class extends fn{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,r){super(e,r,p3.defaultProps)}},D0=p3;Yr(D0,"defaultProps",{...fn.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var A3=class extends fn{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(e,r){super(e,r,A3.defaultProps)}},tm=A3;Yr(tm,"defaultProps",{...fn.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var m3=class extends fn{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,r){super(e,r,m3.defaultProps)}},L0=m3;Yr(L0,"defaultProps",{...fn.defaultProps,measureExecutionTime:void 0});var g3=class extends fn{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,r){super(e,r,g3.defaultProps)}},F0=g3;Yr(F0,"defaultProps",{...fn.defaultProps});function rz(t){let[e,r]=Jie[t],i=e==="i32"||e==="u32",n=e!=="u32",o=Qie[e]*r,s=Zie(e,r);return{dataType:e,components:r,defaultVertexFormat:s,byteLength:o,integer:i,signed:n}}function Zie(t,e){let r;switch(t){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?r:`${r}x${e}`}var Jie={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},Qie={f32:4,f16:2,i32:4,u32:4};function _3(t){let e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);let[r,i]=t.split("x"),n=r,o=i?parseInt(i):1,s=H2(n),l={type:n,components:o,byteLength:s.byteLength*o,integer:s.integer,signed:s.signed,normalized:s.normalized};return e&&(l.webglOnly=!0),l}function W2(t,e){let r={};for(let i of t.attributes)r[i.name]=$ie(t,e,i.name);return r}function iz(t,e,r=16){let i=W2(t,e),n=new Array(r).fill(null);for(let o of Object.values(i))n[o.location]=o;return n}function $ie(t,e,r){let i=ene(t,r),n=tne(e,r);if(!i)return null;let o=rz(i.type),s=n?.vertexFormat||o.defaultVertexFormat,l=_3(s);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:s,bufferDataType:l.type,bufferComponents:l.components,normalized:l.normalized,integer:o.integer,stepMode:n?.stepMode||i.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function ene(t,e){let r=t.attributes.find(i=>i.name===e);return r||Kt.warn(`shader layout attribute "${e}" not present in shader`),r||null}function tne(t,e){rne(t);let r=ine(t,e);return r||(r=nne(t,e),r)?r:(Kt.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function rne(t){for(let e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&Kt.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function ine(t,e){for(let r of t)if(r.format&&r.name===e)return{attributeName:r.name,bufferName:e,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}function nne(t,e){for(let r of t){let i=r.byteStride;if(typeof r.byteStride!="number")for(let o of r.attributes||[]){let s=_3(o.format);i+=s.byteLength}let n=r.attributes?.find(o=>o.attribute===e);if(n)return{attributeName:n.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:i}}return null}function y3(t,e){let r={...t,attributes:t.attributes.map(i=>({...i}))};for(let i of e?.attributes||[]){let n=r.attributes.find(o=>o.name===i.name);n?(n.type=i.type||n.type,n.stepMode=i.stepMode||n.stepMode):Kt.warn(`shader layout attribute ${i.name} not present in shader`)}return r}var v3=class extends fn{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,r){super(e,r,v3.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=iz(r.renderPipeline.shaderLayout,r.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,r){throw new Error("constant attributes not supported")}},N0=v3;Yr(N0,"defaultProps",{...fn.defaultProps,renderPipeline:null});var x3=class extends fn{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,r){super(e,r,x3.defaultProps)}},k0=x3;Yr(k0,"defaultProps",{...fn.defaultProps,layout:void 0,buffers:{}});var b3=class extends fn{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,r){super(e,r,b3.defaultProps)}},U0=b3;Yr(U0,"defaultProps",{...fn.defaultProps,type:void 0,count:void 0});var one={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function nz(t){let e=one[t];return Yi(t),e}function oz(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}var q2;function X2(t){return(!q2||q2.byteLength<t)&&(q2=new ArrayBuffer(t)),q2}function w3(t,e){let r=X2(t.BYTES_PER_ELEMENT*e);return new t(r,0,e)}function T3(t){let{target:e,source:r,start:i=0,count:n=1}=t,o=r.length,s=n*o,l=0;for(let u=i;l<o;l++)e[u++]=r[l];for(;l<s;)l<s-l?(e.copyWithin(i+l,i,i+l),l*=2):(e.copyWithin(i+l,i,i+s-l),l=s);return t.target}var sz=1024,Y2=class{layout={};byteLength;constructor(e){let r=0;for(let[n,o]of Object.entries(e)){let s=nz(o),{type:l,components:u}=s;r=oz(r,u);let h=r;r+=u,this.layout[n]={type:l,size:u,offset:h}}r+=(4-r%4)%4;let i=r*4;this.byteLength=Math.max(i,sz)}getData(e){let r=Math.max(this.byteLength,sz),i=X2(r),n={i32:new Int32Array(i),u32:new Uint32Array(i),f32:new Float32Array(i),f16:new Uint16Array(i)};for(let[o,s]of Object.entries(e)){let l=this.layout[o];if(!l){Kt.warn(`Supplied uniform value ${o} not present in uniform block layout`)();continue}let{type:u,size:h,offset:v}=l,T=n[u];if(h===1){if(typeof s!="number"&&typeof s!="boolean"){Kt.warn(`Supplied value for single component uniform ${o} is not a number: ${s}`)();continue}T[v]=Number(s)}else{let E=bp(s);if(!E){Kt.warn(`Supplied value for multi component / array uniform ${o} is not a numeric array: ${s}`)();continue}T.set(E,v)}}return new Uint8Array(i)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function az(t,e,r=16){if(t!==e)return!1;let i=bp(t);if(!i)return!1;let n=bp(e);if(n&&i.length===n.length){for(let o=0;o<i.length;++o)if(n[o]!==i[o])return!1}return!0}function lz(t){let e=bp(t);return e?e.slice():t}var K2=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name,e?.name&&e?.shaderLayout){let r=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!r)throw new Error(e?.name);let i=r;for(let n of i.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[r,i]of Object.entries(e))this._setUniform(r,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${r}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,r){az(this.uniforms[e],r)||(this.uniforms[e]=lz(r),this.modifiedUniforms[e]=!0,this.modified=!0)}};var ax=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[r,i]of Object.entries(e)){let n=r,o=new Y2(i.uniformTypes||{});this.uniformBufferLayouts.set(n,o);let s=new K2({name:r});s.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(n,s)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[r,i]of Object.entries(e))this.uniformBlocks.get(r).setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e).byteLength}getUniformBufferData(e){let r=this.uniformBlocks.get(e).getAllUniforms();return this.uniformBufferLayouts.get(e).getData(r)}createUniformBuffer(e,r,i){i&&this.setUniforms(i);let n=this.getUniformBufferByteLength(r),o=e.createBuffer({usage:Xi.UNIFORM|Xi.COPY_DST,byteLength:n}),s=this.getUniformBufferData(r);return o.write(s),o}getManagedUniformBuffer(e,r){if(!this.uniformBuffers.get(r)){let i=this.getUniformBufferByteLength(r),n=e.createBuffer({usage:Xi.UNIFORM|Xi.COPY_DST,byteLength:i});this.uniformBuffers.set(r,n)}return this.uniformBuffers.get(r)}updateUniformBuffers(){let e=!1;for(let r of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(r);e||=i}return e&&Kt.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let r=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),n=!1;if(i&&r.needsRedraw){n||=r.needsRedraw;let o=this.getUniformBufferData(e);this.uniformBuffers.get(e).write(o);let l=this.uniformBlocks.get(e).getAllUniforms();Kt.log(4,`Writing to uniform buffer ${String(e)}`,o,l)()}return n}};function Z2(t){let e=ArrayBuffer.isView(t)?t.constructor:t;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function lx(t){switch(t){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(t)}}function E3(t,e,r){if(!e||e>4)throw new Error(`size ${e}`);let i=e,n=Z2(t);if(n==="uint8"||n==="sint8"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}if(n==="uint16"||n==="sint16"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}return i===1?n:`${n}x${i}`}function cz(t){return bp(t)!==null||typeof t=="number"||typeof t=="boolean"}function cx(t){let e={bindings:{},uniforms:{}};return Object.keys(t).forEach(r=>{let i=t[r];cz(i)?e.uniforms[r]=i:e.bindings[r]=i}),e}function S3(t,e,r){let{removedProps:i={},deprecatedProps:n={},replacedProps:o={}}=r;for(let l in i)if(l in e){let h=i[l]?`${t}.${i[l]}`:"N/A";Kt.removed(`${t}.${l}`,h)()}for(let l in n)if(l in e){let u=n[l];Kt.deprecated(`${t}.${l}`,`${t}.${u}`)()}let s=null;for(let[l,u]of Object.entries(o))l in e&&(Kt.deprecated(`${t}.${l}`,`${t}.${u}`)(),s=s||Object.assign({},e),s[u]=e[l],delete s[l]);return s||e}var sne="";async function C3(t,e){return await new Promise((r,i)=>{try{let n=new Image;n.onload=()=>r(n),n.onerror=()=>i(new Error(`Could not load image ${t}.`)),n.crossOrigin=e?.crossOrigin||"anonymous",n.src=t.startsWith("http")?t:sne+t}catch(n){i(n)}})}async function ux(t,e){let r=document.getElementsByTagName("head")[0];if(!r)throw new Error("loadScript");let i=document.createElement("script");return i.setAttribute("type","text/javascript"),i.setAttribute("src",t),e&&(i.id=e),new Promise((n,o)=>{i.onload=n,i.onerror=s=>o(new Error(`Unable to load script '${t}': ${s}`)),r.appendChild(i)})}function fx(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!fx(t[i],e[i],r-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof t=="object"&&typeof e=="object"){let i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(let o of i)if(!e.hasOwnProperty(o)||!fx(t[o],e[o],r-1))return!1;return!0}return!1}function M3(t){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,1e3/60)}function I3(t){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(t):clearTimeout(t)}var yh;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t[t.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",t[t.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",t[t.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",t[t.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",t[t.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",t[t.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",t[t.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",t[t.LINE_WEBGL=6913]="LINE_WEBGL",t[t.FILL_WEBGL=6914]="FILL_WEBGL",t[t.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",t[t.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",t[t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",t[t.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",t[t.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",t[t.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",t[t.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",t[t.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",t[t.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",t[t.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",t[t.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",t[t.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",t[t.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",t[t.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",t[t.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",t[t.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",t[t.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",t[t.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",t[t.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",t[t.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",t[t.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",t[t.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",t[t.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",t[t.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(yh||(yh={}));var dx={[3042]:!1,[32773]:new Float32Array([0,0,0,0]),[32777]:32774,[34877]:32774,[32969]:1,[32968]:0,[32971]:1,[32970]:0,[3106]:new Float32Array([0,0,0,0]),[3107]:[!0,!0,!0,!0],[2884]:!1,[2885]:1029,[2929]:!1,[2931]:1,[2932]:513,[2928]:new Float32Array([0,1]),[2930]:!0,[3024]:!0,[35725]:null,[36006]:null,[36007]:null,[34229]:null,[34964]:null,[2886]:2305,[33170]:4352,[2849]:1,[32823]:!1,[32824]:0,[10752]:0,[32926]:!1,[32928]:!1,[32938]:1,[32939]:!1,[3089]:!1,[3088]:new Int32Array([0,0,1024,1024]),[2960]:!1,[2961]:0,[2968]:4294967295,[36005]:4294967295,[2962]:519,[2967]:0,[2963]:4294967295,[34816]:519,[36003]:0,[36004]:4294967295,[2964]:7680,[2965]:7680,[2966]:7680,[34817]:7680,[34818]:7680,[34819]:7680,[2978]:[0,0,1024,1024],[36389]:null,[36662]:null,[36663]:null,[35053]:null,[35055]:null,[35723]:4352,[36010]:null,[35977]:!1,[3333]:4,[3317]:4,[37440]:!1,[37441]:!1,[37443]:37444,[3330]:0,[3332]:0,[3331]:0,[3314]:0,[32878]:0,[3316]:0,[3315]:0,[32877]:0},ya=(t,e,r)=>e?t.enable(r):t.disable(r),uz=(t,e,r)=>t.hint(r,e),Kc=(t,e,r)=>t.pixelStorei(r,e),fz=(t,e,r)=>{let i=r===36006?36009:36008;return t.bindFramebuffer(i,e)},hx=(t,e,r)=>{let n={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];t.bindBuffer(n,e)};function P3(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}var hz={[3042]:ya,[32773]:(t,e)=>t.blendColor(...e),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(t,e)=>t.clearColor(...e),[3107]:(t,e)=>t.colorMask(...e),[2884]:ya,[2885]:(t,e)=>t.cullFace(e),[2929]:ya,[2931]:(t,e)=>t.clearDepth(e),[2932]:(t,e)=>t.depthFunc(e),[2928]:(t,e)=>t.depthRange(...e),[2930]:(t,e)=>t.depthMask(e),[3024]:ya,[35723]:uz,[35725]:(t,e)=>t.useProgram(e),[36007]:(t,e)=>t.bindRenderbuffer(36161,e),[36389]:(t,e)=>t.bindTransformFeedback?.(36386,e),[34229]:(t,e)=>t.bindVertexArray(e),[36006]:fz,[36010]:fz,[34964]:hx,[36662]:hx,[36663]:hx,[35053]:hx,[35055]:hx,[2886]:(t,e)=>t.frontFace(e),[33170]:uz,[2849]:(t,e)=>t.lineWidth(e),[32823]:ya,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:ya,[32926]:ya,[32928]:ya,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:ya,[3088]:(t,e)=>t.scissor(...e),[2960]:ya,[2961]:(t,e)=>t.clearStencil(e),[2968]:(t,e)=>t.stencilMaskSeparate(1028,e),[36005]:(t,e)=>t.stencilMaskSeparate(1029,e),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(t,e)=>t.viewport(...e),[34383]:ya,[10754]:ya,[12288]:ya,[12289]:ya,[12290]:ya,[12291]:ya,[12292]:ya,[12293]:ya,[12294]:ya,[12295]:ya,[3333]:Kc,[3317]:Kc,[37440]:Kc,[37441]:Kc,[37443]:Kc,[3330]:Kc,[3332]:Kc,[3331]:Kc,[3314]:Kc,[32878]:Kc,[3316]:Kc,[3315]:Kc,[32877]:Kc,framebuffer:(t,e)=>{let r=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,r)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{let r=typeof e=="number"?[e,e]:e;t.blendEquationSeparate(...r)},blendFunc:(t,e)=>{let r=e?.length===2?[...e,...e]:e;t.blendFuncSeparate(...r)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(...e),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=P3(e)?e:[e,e];let[r,i]=e;t.stencilMaskSeparate(1028,r),t.stencilMaskSeparate(1029,i)},stencilFunc:(t,e)=>{e=P3(e)&&e.length===3?[...e,...e]:e;let[r,i,n,o,s,l]=e;t.stencilFuncSeparate(1028,r,i,n),t.stencilFuncSeparate(1029,o,s,l)},stencilOp:(t,e)=>{e=P3(e)&&e.length===3?[...e,...e]:e;let[r,i,n,o,s,l]=e;t.stencilOpSeparate(1028,r,i,n),t.stencilOpSeparate(1029,o,s,l)},viewport:(t,e)=>t.viewport(...e)};function Ys(t,e,r){return e[t]!==void 0?e[t]:r[t]}var dz={blendEquation:(t,e,r)=>t.blendEquationSeparate(Ys(32777,e,r),Ys(34877,e,r)),blendFunc:(t,e,r)=>t.blendFuncSeparate(Ys(32969,e,r),Ys(32968,e,r),Ys(32971,e,r),Ys(32970,e,r)),polygonOffset:(t,e,r)=>t.polygonOffset(Ys(32824,e,r),Ys(10752,e,r)),sampleCoverage:(t,e,r)=>t.sampleCoverage(Ys(32938,e,r),Ys(32939,e,r)),stencilFuncFront:(t,e,r)=>t.stencilFuncSeparate(1028,Ys(2962,e,r),Ys(2967,e,r),Ys(2963,e,r)),stencilFuncBack:(t,e,r)=>t.stencilFuncSeparate(1029,Ys(34816,e,r),Ys(36003,e,r),Ys(36004,e,r)),stencilOpFront:(t,e,r)=>t.stencilOpSeparate(1028,Ys(2964,e,r),Ys(2965,e,r),Ys(2966,e,r)),stencilOpBack:(t,e,r)=>t.stencilOpSeparate(1029,Ys(34817,e,r),Ys(34818,e,r),Ys(34819,e,r))},R3={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,r)=>t({[e]:r}),hint:(t,e,r)=>t({[e]:r}),useProgram:(t,e)=>t({[35725]:e}),bindRenderbuffer:(t,e,r)=>t({[36007]:r}),bindTransformFeedback:(t,e,r)=>t({[36389]:r}),bindVertexArray:(t,e)=>t({[34229]:e}),bindFramebuffer:(t,e,r)=>{switch(e){case 36160:return t({[36006]:r,[36010]:r});case 36009:return t({[36006]:r});case 36008:return t({[36010]:r});default:return null}},bindBuffer:(t,e,r)=>{let i={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[e];return i?t({[i]:r}):{valueChanged:!0}},blendColor:(t,e,r,i,n)=>t({[32773]:new Float32Array([e,r,i,n])}),blendEquation:(t,e)=>t({[32777]:e,[34877]:e}),blendEquationSeparate:(t,e,r)=>t({[32777]:e,[34877]:r}),blendFunc:(t,e,r)=>t({[32969]:e,[32968]:r,[32971]:e,[32970]:r}),blendFuncSeparate:(t,e,r,i,n)=>t({[32969]:e,[32968]:r,[32971]:i,[32970]:n}),clearColor:(t,e,r,i,n)=>t({[3106]:new Float32Array([e,r,i,n])}),clearDepth:(t,e)=>t({[2931]:e}),clearStencil:(t,e)=>t({[2961]:e}),colorMask:(t,e,r,i,n)=>t({[3107]:[e,r,i,n]}),cullFace:(t,e)=>t({[2885]:e}),depthFunc:(t,e)=>t({[2932]:e}),depthRange:(t,e,r)=>t({[2928]:new Float32Array([e,r])}),depthMask:(t,e)=>t({[2930]:e}),frontFace:(t,e)=>t({[2886]:e}),lineWidth:(t,e)=>t({[2849]:e}),polygonOffset:(t,e,r)=>t({[32824]:e,[10752]:r}),sampleCoverage:(t,e,r)=>t({[32938]:e,[32939]:r}),scissor:(t,e,r,i,n)=>t({[3088]:new Int32Array([e,r,i,n])}),stencilMask:(t,e)=>t({[2968]:e,[36005]:e}),stencilMaskSeparate:(t,e,r)=>t({[e===1028?2968:36005]:r}),stencilFunc:(t,e,r,i)=>t({[2962]:e,[2967]:r,[2963]:i,[34816]:e,[36003]:r,[36004]:i}),stencilFuncSeparate:(t,e,r,i,n)=>t({[e===1028?2962:34816]:r,[e===1028?2967:36003]:i,[e===1028?2963:36004]:n}),stencilOp:(t,e,r,i)=>t({[2964]:e,[2965]:r,[2966]:i,[34817]:e,[34818]:r,[34819]:i}),stencilOpSeparate:(t,e,r,i,n)=>t({[e===1028?2964:34817]:r,[e===1028?2965:34818]:i,[e===1028?2966:34819]:n}),viewport:(t,e,r,i,n)=>t({[2978]:[e,r,i,n]})},vh=(t,e)=>t.isEnabled(e),B3={[3042]:vh,[2884]:vh,[2929]:vh,[3024]:vh,[32823]:vh,[32926]:vh,[32928]:vh,[3089]:vh,[2960]:vh,[35977]:vh},pz=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function mf(t,e){if(ane(e))return;let r={};for(let n in e){let o=Number(n),s=hz[n];s&&(typeof s=="string"?r[s]=!0:s(t,e[n],o))}let i=t.state&&t.state.cache;if(i)for(let n in r){let o=dz[n];o(t,e,i)}}function J2(t,e=dx){if(typeof e=="number"){let n=e,o=B3[n];return o?o(t,n):t.getParameter(n)}let r=Array.isArray(e)?e:Object.keys(e),i={};for(let n of r){let o=B3[n];i[n]=o?o(t,Number(n)):t.getParameter(Number(n))}return i}function Az(t){mf(t,dx)}function ane(t){for(let e in t)return!1;return!0}function mz(t,e){if(t===e)return!0;let r=Array.isArray(t)||ArrayBuffer.isView(t),i=Array.isArray(e)||ArrayBuffer.isView(e);if(r&&i&&t.length===e.length){for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}return!1}var O3=class{gl;program=null;stateStack=[];enable=!0;cache;log;constructor(e,{copyState:r=!1,log:i=()=>{}}={}){this.gl=e,this.cache=r?J2(e):Object.assign({},dx),this.log=i,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){Yi(this.stateStack.length>0);let e=this.stateStack[this.stateStack.length-1];mf(this.gl,e),this.stateStack.pop()}_updateCache(e){let r=!1,i,n=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in e){Yi(o!==void 0);let s=e[o],l=this.cache[o];mz(s,l)||(r=!0,i=l,n&&!(o in n)&&(n[o]=l),this.cache[o]=s)}return{valueChanged:r,oldValue:i}}};function rm(t){return t.state}function D3(t,e){let{enable:r=!0,copyState:i}=e;if(Yi(i!==void 0),!t.state){t.state=new O3(t,{copyState:i}),cne(t);for(let o in R3){let s=R3[o];lne(t,o,s)}gz(t,"getParameter"),gz(t,"isEnabled")}let n=rm(t);return n.enable=r,t}function Mp(t){let e=rm(t);e||(D3(t,{copyState:!1}),e=rm(t)),e.push()}function md(t){let e=rm(t);Yi(e),e.pop()}function gz(t,e){let r=t[e].bind(t);t[e]=function(n){if(n===void 0||pz.has(n))return r(n);let o=rm(t);return n in o.cache||(o.cache[n]=r(n)),o.enable?o.cache[n]:r(n)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function lne(t,e,r){if(!t[e])return;let i=t[e].bind(t);t[e]=function(...o){let s=rm(t),{valueChanged:l,oldValue:u}=r(s._updateCache,...o);return l&&i(...o),u},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}function cne(t){let e=t.useProgram.bind(t);t.useProgram=function(i){let n=rm(t);n.program!==i&&(e(i),n.program=i)}}var une={powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function _z(t,e){e={...une,...e};let r=null,i=o=>r=o.statusMessage||r;t.addEventListener("webglcontextcreationerror",i,!1);let n=null;if(n||=t.getContext("webgl2",e),t.removeEventListener("webglcontextcreationerror",i,!1),!n)throw new Error(`Failed to create WebGL context: ${r||"Unknown error"}`);if(e.onContextLost){let{onContextLost:o}=e;t.addEventListener("webglcontextlost",s=>o(s),!1)}if(e.onContextRestored){let{onContextRestored:o}=e;t.addEventListener("webglcontextrestored",s=>o(s),!1)}return n}function Mu(t,e,r){return r[e]===void 0&&(r[e]=t.getExtension(e)||null),r[e]}function yz(t,e){let r=t.getParameter(7936),i=t.getParameter(7937);Mu(t,"WEBGL_debug_renderer_info",e);let n=e.WEBGL_debug_renderer_info,o=t.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),s=t.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),l=o||r,u=s||i,h=t.getParameter(7938),v=vz(l,u),T=fne(l,u),E=hne(l,u);return{type:"webgl",gpu:v,gpuType:E,gpuBackend:T,vendor:l,renderer:u,version:h,shadingLanguage:"glsl",shadingLanguageVersion:300}}function vz(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function fne(t,e){return/Metal/i.exec(t)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(t)||/ANGLE/i.exec(e)?"opengl":"unknown"}function hne(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(vz(t,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function Q2(t){switch(t){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(t))}var Fl="texture-compression-bc",jo="texture-compression-astc",xh="texture-compression-etc2",dne="texture-compression-etc1-webgl",$2="texture-compression-pvrtc-webgl",L3="texture-compression-atc-webgl",px="float32-renderable-webgl",F3="float16-renderable-webgl",pne="rgb9e5ufloat_renderable-webgl",N3="snorm8-renderable-webgl",Ax="norm16-renderable-webgl",k3="snorm16-renderable-webgl",eT="float32-filterable",xz="float16-filterable-webgl",mx="WEBGL_compressed_texture_s3tc",gx="WEBGL_compressed_texture_s3tc_srgb",z0="EXT_texture_compression_rgtc",V0="EXT_texture_compression_bptc",Ane="WEBGL_compressed_texture_etc",mne="WEBGL_compressed_texture_astc",gne="WEBGL_compressed_texture_etc1",_ne="WEBGL_compressed_texture_pvrtc",yne="WEBGL_compressed_texture_atc",bz="EXT_texture_norm16",wz="EXT_render_snorm",vne="EXT_color_buffer_float",tT={"float32-renderable-webgl":["EXT_color_buffer_float"],"float16-renderable-webgl":["EXT_color_buffer_half_float"],"rgb9e5ufloat_renderable-webgl":["WEBGL_render_shared_exponent"],"snorm8-renderable-webgl":[wz],"norm16-renderable-webgl":[bz],"snorm16-renderable-webgl":[bz,wz],"float32-filterable":["OES_texture_float_linear"],"float16-filterable-webgl":["OES_texture_half_float_linear"],"texture-filterable-anisotropic-webgl":["EXT_texture_filter_anisotropic"],"texture-blend-float-webgl":["EXT_float_blend"],"texture-compression-bc":[mx,gx,z0,V0],"texture-compression-bc5-webgl":[z0],"texture-compression-bc7-webgl":[V0],"texture-compression-etc2":[Ane],"texture-compression-astc":[mne],"texture-compression-etc1-webgl":[gne],"texture-compression-pvrtc-webgl":[_ne],"texture-compression-atc-webgl":[yne]};function Tz(t){return t in tT}function Ez(t,e,r){return(tT[e]||[]).every(n=>Mu(t,n,r))}var rT={"rgb8unorm-unsized":{gl:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,rb:!0},r8snorm:{gl:36756,b:1,c:1,render:N3},r8uint:{gl:33330,b:1,c:1,rb:!0},r8sint:{gl:33329,b:1,c:1,rb:!0},rg8unorm:{gl:33323,b:2,c:2,rb:!0},rg8snorm:{gl:36757,b:2,c:2,render:N3},rg8uint:{gl:33336,b:2,c:2,rb:!0},rg8sint:{gl:33335,b:2,c:2,rb:!0},r16uint:{gl:33332,b:2,c:1,rb:!0},r16sint:{gl:33331,b:2,c:1,rb:!0},r16float:{gl:33325,b:2,c:1,render:F3,filter:"float16-filterable-webgl",rb:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:Ax,rb:!0},"r16snorm-webgl":{gl:36760,b:2,c:1,f:k3},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,rb:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,rb:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,rb:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,b:4,c:4,bpp:4},rgba8snorm:{gl:36759,b:4,c:4,render:N3},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:F3,filter:xz,rb:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,render:Ax},"rg16snorm-webgl":{gl:36761,b:2,c:2,render:k3},r32uint:{gl:33334,b:4,c:1,bpp:4,rb:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,rb:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:px,filter:eT},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:pne},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:px,rb:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,rb:!0},"rgb10a2uint-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,rb:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:Ax},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:Ax},rg32uint:{gl:33340,b:8,c:2,rb:!0},rg32sint:{gl:33339,b:8,c:2,rb:!0},rg32float:{gl:33328,b:8,c:2,render:px,filter:eT,rb:!0},rgba16uint:{gl:36214,b:8,c:4,rb:!0},rgba16sint:{gl:36232,b:8,c:4,rb:!0},rgba16float:{gl:34842,b:8,c:4,render:F3,filter:xz},"rgba16unorm-webgl":{gl:32859,b:2,c:4,render:Ax,rb:!0},"rgba16snorm-webgl":{gl:36763,b:2,c:4,render:k3},"rgb32float-webgl":{gl:34837,render:px,filter:eT,gl2ext:vne,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,rb:!0},rgba32sint:{gl:36226,b:16,c:4,rb:!0},rgba32float:{gl:34836,b:16,c:4,render:px,filter:eT,rb:!0},stencil8:{gl:36168,b:1,c:1,attachment:36128,rb:!0},depth16unorm:{gl:33189,b:2,c:1,attachment:36096,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096,dataFormat:6402,types:[5125]},depth32float:{gl:36012,b:4,c:1,attachment:36096,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,dataFormat:34041,types:[34042],rb:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:mx,f:Fl},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:gx,f:Fl},"bc1-rgba-unorm":{gl:33777,x:mx,f:Fl},"bc1-rgba-unorm-srgb":{gl:35916,x:gx,f:Fl},"bc2-rgba-unorm":{gl:33778,x:mx,f:Fl},"bc2-rgba-unorm-srgb":{gl:35918,x:gx,f:Fl},"bc3-rgba-unorm":{gl:33779,x:mx,f:Fl},"bc3-rgba-unorm-srgb":{gl:35919,x:gx,f:Fl},"bc4-r-unorm":{gl:36283,x:z0,f:Fl},"bc4-r-snorm":{gl:36284,x:z0,f:Fl},"bc5-rg-unorm":{gl:36285,x:z0,f:Fl},"bc5-rg-snorm":{gl:36286,x:z0,f:Fl},"bc6h-rgb-ufloat":{gl:36495,x:V0,f:Fl},"bc6h-rgb-float":{gl:36494,x:V0,f:Fl},"bc7-rgba-unorm":{gl:36492,x:V0,f:Fl},"bc7-rgba-unorm-srgb":{gl:36493,x:V0,f:Fl},"etc2-rgb8unorm":{gl:37492,f:xh},"etc2-rgb8unorm-srgb":{gl:37494,f:xh},"etc2-rgb8a1unorm":{gl:37496,f:xh},"etc2-rgb8a1unorm-srgb":{gl:37497,f:xh},"etc2-rgba8unorm":{gl:37493,f:xh},"etc2-rgba8unorm-srgb":{gl:37495,f:xh},"eac-r11unorm":{gl:37488,f:xh},"eac-r11snorm":{gl:37489,f:xh},"eac-rg11unorm":{gl:37490,f:xh},"eac-rg11snorm":{gl:37491,f:xh},"astc-4x4-unorm":{gl:37808,f:jo},"astc-4x4-unorm-srgb":{gl:37840,f:jo},"astc-5x4-unorm":{gl:37809,f:jo},"astc-5x4-unorm-srgb":{gl:37841,f:jo},"astc-5x5-unorm":{gl:37810,f:jo},"astc-5x5-unorm-srgb":{gl:37842,f:jo},"astc-6x5-unorm":{gl:37811,f:jo},"astc-6x5-unorm-srgb":{gl:37843,f:jo},"astc-6x6-unorm":{gl:37812,f:jo},"astc-6x6-unorm-srgb":{gl:37844,f:jo},"astc-8x5-unorm":{gl:37813,f:jo},"astc-8x5-unorm-srgb":{gl:37845,f:jo},"astc-8x6-unorm":{gl:37814,f:jo},"astc-8x6-unorm-srgb":{gl:37846,f:jo},"astc-8x8-unorm":{gl:37815,f:jo},"astc-8x8-unorm-srgb":{gl:37847,f:jo},"astc-10x5-unorm":{gl:37819,f:jo},"astc-10x5-unorm-srgb":{gl:37851,f:jo},"astc-10x6-unorm":{gl:37817,f:jo},"astc-10x6-unorm-srgb":{gl:37849,f:jo},"astc-10x8-unorm":{gl:37818,f:jo},"astc-10x8-unorm-srgb":{gl:37850,f:jo},"astc-10x10-unorm":{gl:37819,f:jo},"astc-10x10-unorm-srgb":{gl:37851,f:jo},"astc-12x10-unorm":{gl:37820,f:jo},"astc-12x10-unorm-srgb":{gl:37852,f:jo},"astc-12x12-unorm":{gl:37821,f:jo},"astc-12x12-unorm-srgb":{gl:37853,f:jo},"pvrtc-rgb4unorm-webgl":{gl:35840,f:$2},"pvrtc-rgba4unorm-webgl":{gl:35842,f:$2},"pvrtc-rbg2unorm-webgl":{gl:35841,f:$2},"pvrtc-rgba2unorm-webgl":{gl:35843,f:$2},"etc1-rbg-unorm-webgl":{gl:36196,f:dne},"atc-rgb-unorm-webgl":{gl:35986,f:L3},"atc-rgba-unorm-webgl":{gl:35986,f:L3},"atc-rgbai-unorm-webgl":{gl:34798,f:L3}},xne={[6403]:1,[36244]:1,[33319]:2,[33320]:2,[6407]:3,[36248]:3,[6408]:4,[36249]:4,[6402]:1,[34041]:1,[6406]:1,[6409]:1,[6410]:2},bne={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function iT(t,e,r){let i=rT[e];if(!i||i.gl===void 0)return!1;let n=i.x||i.gl2ext;return n?Boolean(Mu(t,n,r)):!0}function U3(t){let r=rT[t]?.gl;if(r===void 0)throw new Error(`Unsupported texture format ${t}`);return r}function Sz(t,e,r){if(!iT(t,e,r)||e.startsWith("depth")||e.startsWith("stencil"))return!1;try{if(j2(e).signed)return!1}catch{return!1}return e.endsWith("32float")?Boolean(Mu(t,"OES_texture_float_linear, extensions",r)):e.endsWith("16float")?Boolean(Mu(t,"OES_texture_half_float_linear, extensions",r)):!0}function Cz(t,e,r){return!(!iT(t,e,r)||typeof e=="number")}function H0(t){let e=rT[t],r=U3(t),i=j2(t);return{format:r,dataFormat:e?.dataFormat||wne(i.format,i.integer,i.normalized,r),type:i.dataType?Q2(i.dataType):e?.types?.[0]||5121,compressed:i.compressed}}function Mz(t){let e=rT[t];if(!e?.attachment)throw new Error(`${t} is not a depth stencil format`);return e.attachment}function z3(t){let e=H0(t),r=xne[e.dataFormat]||4,i=bne[e.type]||1;return r*i}function wne(t,e,r,i){if(i===6408||i===6407)return i;switch(t){case"r":return e&&!r?36244:6403;case"rg":return e&&!r?33320:33319;case"rgb":return e&&!r?36248:6407;case"rgba":return e&&!r?36249:6408;default:return 6408}}var Iz={"depth-clip-control":"EXT_depth_clamp","timer-query-webgl":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"},nT=class extends ox{gl;extensions;testedFeatures=new Set;constructor(e,r,i){super([],i),this.gl=e,this.extensions=r,Mu(e,"EXT_color_buffer_float",r)}*[Symbol.iterator](){let e=this.getFeatures();for(let r of e)this.has(r)&&(yield r);return[]}has(e){return this.disabledFeatures[e]?!1:(this.testedFeatures.has(e)||(this.testedFeatures.add(e),Tz(e)&&Ez(this.gl,e,this.extensions)&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)),this.features.has(e))}initializeFeatures(){let e=this.getFeatures().filter(r=>r!=="polygon-mode-webgl");for(let r of e)this.has(r)}getFeatures(){return[...Object.keys(Iz),...Object.keys(tT)]}getWebGLFeature(e){let r=Iz[e];return Boolean(typeof r=="string"?Mu(this.gl,r,this.extensions):r)}};var oT=class extends nx{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderComponents(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(e){super(),this.gl=e}getParameter(e){return this.limits[e]===void 0&&(this.limits[e]=this.gl.getParameter(e)),this.limits[e]}};function Iu(t,e,r){if(Tne(e))return r(t);let{nocatch:i=!0}=e;Mp(t),mf(t,e);let n;if(i)n=r(t),md(t);else try{n=r(t)}finally{md(t)}return n}function Tne(t){for(let e in t)return!1;return!0}function Rz(t,e,r,i){if(wp(e))return i(t);let n=t;Mp(n.gl);try{return Ene(t,e),mf(n.gl,r),i(t)}finally{md(n.gl)}}function Ene(t,e){let r=t,{gl:i}=r;if(e.cullMode)switch(e.cullMode){case"none":i.disable(2884);break;case"front":i.enable(2884),i.cullFace(1028);break;case"back":i.enable(2884),i.cullFace(1029);break}if(e.frontFace&&i.frontFace(im("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&i.enable(34383),e.depthBias!==void 0&&(i.enable(32823),i.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&t.features.has("provoking-vertex-webgl")){let o=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,s=im("provokingVertex",e.provokingVertex,{first:36429,last:36430});o?.provokingVertexWEBGL(s)}if((e.polygonMode||e.polygonOffsetLine)&&t.features.has("polygon-mode-webgl")){if(e.polygonMode){let o=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,s=im("polygonMode",e.polygonMode,{fill:6914,line:6913});o?.polygonModeWEBGL(1028,s),o?.polygonModeWEBGL(1029,s)}e.polygonOffsetLine&&i.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&i.enable(12288),e.clipDistance1&&i.enable(12289),e.clipDistance2&&i.enable(12290),e.clipDistance3&&i.enable(12291),e.clipDistance4&&i.enable(12292),e.clipDistance5&&i.enable(12293),e.clipDistance6&&i.enable(12294),e.clipDistance7&&i.enable(12295)),e.depthWriteEnabled!==void 0&&i.depthMask(Cne("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?i.enable(2929):i.disable(2929),i.depthFunc(aT("depthCompare",e.depthCompare))),e.stencilWriteMask){let n=e.stencilWriteMask;i.stencilMaskSeparate(1028,n),i.stencilMaskSeparate(1029,n)}if(e.stencilReadMask&&Kt.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let n=e.stencilReadMask||4294967295,o=aT("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?i.enable(2960):i.disable(2960),i.stencilFuncSeparate(1028,o,0,n),i.stencilFuncSeparate(1029,o,0,n)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let n=V3("stencilPassOperation",e.stencilPassOperation),o=V3("stencilFailOperation",e.stencilFailOperation),s=V3("stencilDepthFailOperation",e.stencilDepthFailOperation);i.stencilOpSeparate(1028,o,s,n),i.stencilOpSeparate(1029,o,s,n)}if(e.blendColorOperation||e.blendAlphaOperation){i.enable(3042);let n=Pz("blendColorOperation",e.blendColorOperation||"add"),o=Pz("blendAlphaOperation",e.blendAlphaOperation||"add");i.blendEquationSeparate(n,o);let s=sT("blendColorSrcFactor",e.blendColorSrcFactor||"one"),l=sT("blendColorDstFactor",e.blendColorDstFactor||"zero"),u=sT("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),h=sT("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");i.blendFuncSeparate(s,l,u,h)}}function aT(t,e){return im(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function V3(t,e){return im(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Pz(t,e){return im(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function sT(t,e){return im(t,e,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function Sne(t,e){return`Illegal parameter ${e} for ${t}`}function im(t,e,r){if(!(e in r))throw new Error(Sne(t,e));return r[e]}function Cne(t,e){return e}function lT(t){let e={};return t.addressModeU&&(e[10242]=H3(t.addressModeU)),t.addressModeV&&(e[10243]=H3(t.addressModeV)),t.addressModeW&&(e[32882]=H3(t.addressModeW)),t.magFilter&&(e[10240]=Bz(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=Mne(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[33082]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[33083]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[34892]=34894),t.compare&&(e[34893]=aT("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function H3(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function Bz(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}function Mne(t,e){if(!e)return Bz(t);switch(t){case"nearest":return e==="nearest"?9984:9986;case"linear":return e==="nearest"?9985:9987}}var $l=class extends Xi{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(e,r={}){super(e,r),this.device=e,this.gl=this.device.gl;let i=typeof r=="object"?r.handle:void 0;this.handle=i||this.gl.createBuffer(),e.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=Ine(this.props.usage),this.glUsage=Pne(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(e,r=0,i=e.byteLength+r){let n=this.glTarget;this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,i,this.glUsage),this.gl.bufferSubData(n,r,e),this.gl.bindBuffer(n,null),this.bytesUsed=i,this.byteLength=i,this._setDebugData(e,r,i),this.trackAllocatedMemory(i)}_initWithByteLength(e){Yi(e>=0);let r=e;e===0&&(r=new Float32Array(0));let i=this.glTarget;return this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,r,this.glUsage),this.gl.bindBuffer(i,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.trackAllocatedMemory(e),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(e,r=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,r,e),this.gl.bindBuffer(36663,null),this._setDebugData(e,r,e.byteLength)}async readAsync(e=0,r){return this.readSyncWebGL(e,r)}readSyncWebGL(e=0,r){r=r??this.byteLength-e;let i=new Uint8Array(r),n=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,i,n,r),this.gl.bindBuffer(36662,null),this._setDebugData(i,e,r),i}};function Ine(t){return t&Xi.INDEX?34963:t&Xi.VERTEX?34962:t&Xi.UNIFORM?35345:34962}function Pne(t){return t&Xi.INDEX||t&Xi.VERTEX?35044:t&Xi.UNIFORM?35048:35044}var nm=class extends Cp{device;handle;parameters;constructor(e,r){super(e,r),this.device=e,this.parameters=lT(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(e){for(let[r,i]of Object.entries(e)){let n=Number(r);switch(n){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,n,i);break;default:this.device.gl.samplerParameteri(this.handle,n,i);break}}}};var gf=class extends Ep{device;gl;handle;texture;constructor(e,r){super(e,{...bo.defaultProps,...r}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var Rne={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},cT=class extends bo{MAX_ATTRIBUTES;device;gl;handle;sampler=void 0;view=void 0;glFormat=void 0;type=void 0;dataFormat=void 0;mipmaps=void 0;target;textureUnit=void 0;loaded=!1;_video;constructor(e,r){super(e,{...Rne,format:"rgba8unorm",...r}),this.device=e,this.gl=this.device.gl,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=Bne(this.props),this.loaded=!1,typeof this.props?.data=="string"&&Object.assign(this.props,{data:C3(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}createView(e){return new gf(this.device,{...e,texture:this})}initialize(e={}){if(this.props.dimension==="cube")return this.initializeCube(e);let r=e.data;if(r instanceof Promise)return r.then(z=>this.initialize(Object.assign({},e,{pixels:z,data:z}))),this;let i=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(i&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(e)),this;let{parameters:n={}}=e,{pixels:o=null,pixelStore:s={},textureUnit:l=void 0,mipmaps:u=!0}=e;r||(r=o);let{width:h,height:v,dataFormat:T,type:E,compressed:M=!1}=e,{depth:O=0}=e,F=U3(e.format);return{width:h,height:v,compressed:M,dataFormat:T,type:E}=this._deduceParameters({format:e.format,type:E,dataFormat:T,compressed:M,data:r,width:h,height:v}),this.width=h,this.height=v,this.glFormat=F,this.type=E,this.dataFormat=T,this.textureUnit=l,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),this.mipmaps=u,this.setImageData({data:r,width:h,height:v,depth:O,format:F,type:E,dataFormat:T,parameters:s,compressed:M}),this.setSampler(e.sampler),this._setSamplerParameters(n),this.view=this.createView({...this.props,mipLevelCount:1,arrayLayerCount:1}),u&&this.device.isTextureFormatFilterable(e.format)&&this.generateMipmap(),i&&(this._video={video:r,parameters:n,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(e){let{mipmaps:r=!0,parameters:i={}}=e;return this.setCubeMapImageData(e).then(()=>{this.loaded=!0,r&&this.generateMipmap(e),this.setSampler(e.sampler),this._setSamplerParameters(i)}),this}setSampler(e={}){let r;e instanceof nm?(this.sampler=e,r=e.props):(this.sampler=new nm(this.device,e),r=e);let i=lT(r);return this._setSamplerParameters(i),this}resize(e){let{height:r,width:i,mipmaps:n=!1}=e;return i!==this.width||r!==this.height?this.initialize({width:i,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:n}):this}update(){if(this._video){let{video:e,parameters:r,lastTime:i}=this._video;if(i===e.currentTime||e.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:e,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=e.currentTime}}generateMipmap(e={}){return this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Iu(this.gl,e,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this}setImageData(e){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(e);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:i=null,level:n=0,glFormat:o=this.glFormat,offset:s=0,parameters:l={}}=e,{data:u=null,type:h=this.type,width:v=this.width,height:T=this.height,dataFormat:E=this.dataFormat,compressed:M=!1}=e;u||(u=i),{type:h,dataFormat:E,compressed:M,width:v,height:T}=this._deduceParameters({format:this.props.format,type:h,dataFormat:E,compressed:M,data:u,width:v,height:T});let{gl:O}=this;O.bindTexture(this.target,this.handle);let F=null;if({data:u,dataType:F}=this._getDataType({data:u,compressed:M}),Iu(this.gl,l,()=>{switch(F){case"null":O.texImage2D(r,n,o,v,T,0,E,h,u);break;case"typed-array":O.texImage2D(r,n,o,v,T,0,E,h,u,s);break;case"buffer":this.device.gl.bindBuffer(35052,u.handle||u),this.device.gl.texImage2D(r,n,o,v,T,0,E,h,s),this.device.gl.bindBuffer(35052,null);break;case"browser-object":O.texImage2D(r,n,o,v,T,0,E,h,u);break;case"compressed":for(let[z,W]of u.entries())O.compressedTexImage2D(r,z,W.format,W.width,W.height,0,W.data);break;default:Yi(!1,"Unknown image data type")}}),u&&u.byteLength)this.trackAllocatedMemory(u.byteLength,"Texture");else{let z=z3(this.props.format);this.trackAllocatedMemory(this.width*this.height*z,"Texture")}return this.loaded=!0,this}setSubImageData({target:e=this.target,pixels:r=null,data:i=null,x:n=0,y:o=0,width:s=this.width,height:l=this.height,level:u=0,glFormat:h=this.glFormat,type:v=this.type,dataFormat:T=this.dataFormat,compressed:E=!1,offset:M=0,parameters:O={}}){if({type:v,dataFormat:T,compressed:E,width:s,height:l}=this._deduceParameters({format:this.props.format,type:v,dataFormat:T,compressed:E,data:i,width:s,height:l}),Yi(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=r),i&&i.data){let F=i;i=F.data,s=F.shape[0],l=F.shape[1]}i instanceof $l&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),Iu(this.gl,O,()=>{E?this.gl.compressedTexSubImage2D(e,u,n,o,s,l,h,i):i===null?this.gl.texSubImage2D(e,u,n,o,s,l,T,v,null):ArrayBuffer.isView(i)?this.gl.texSubImage2D(e,u,n,o,s,l,T,v,i,M):typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer?(this.device.gl.bindBuffer(35052,i),this.device.gl.texSubImage2D(e,u,n,o,s,l,T,v,M),this.device.gl.bindBuffer(35052,null)):this.device.gl.texSubImage2D(e,u,n,o,s,l,T,v,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(e={}){return Kt.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,this.handle),e}unbind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,null),e}_getDataType({data:e,compressed:r=!1}){return r?{data:e,dataType:"compressed"}:e===null?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof $l?{data:e.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&e instanceof WebGLBuffer?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}_deduceParameters(e){let{format:r,data:i}=e,{width:n,height:o,dataFormat:s,type:l,compressed:u}=e,h=H0(r);return s=s||h.dataFormat,l=l||h.type,u=u||h.compressed,{width:n,height:o}=this._deduceImageSize(i,n,o),{dataFormat:s,type:l,compressed:u,width:n,height:o,format:r,data:i}}_deduceImageSize(e,r,i){let n;return typeof ImageData<"u"&&e instanceof ImageData?n={width:e.width,height:e.height}:typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement?n={width:e.naturalWidth,height:e.naturalHeight}:typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement?n={width:e.width,height:e.height}:typeof ImageBitmap<"u"&&e instanceof ImageBitmap?n={width:e.width,height:e.height}:typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?n={width:e.videoWidth,height:e.videoHeight}:e?n={width:r,height:i}:n={width:r>=0?r:1,height:i>=0?i:1},Yi(n,"Could not deduced texture size"),Yi(r===void 0||n.width===r,"Deduced texture width does not match supplied width"),Yi(i===void 0||n.height===i,"Deduced texture height does not match supplied height"),n}async setCubeMapImageData(e){let{gl:r}=this,{width:i,height:n,pixels:o,data:s,format:l=6408,type:u=5121}=e,h=o||s,v=await Promise.all(cT.FACES.map(T=>{let E=h[T];return Promise.all(Array.isArray(E)?E:[E])}));this.bind(),cT.FACES.forEach((T,E)=>{v[E].length>1&&this.props.mipmaps!==!1&&Kt.warn(`${this.id} has mipmap and multiple LODs.`)(),v[E].forEach((M,O)=>{i&&n?r.texImage2D(T,O,l,i,n,0,l,u,M):r.texImage2D(T,O,l,l,u,M)})}),this.unbind()}setImageDataForFace(e){let{face:r,width:i,height:n,pixels:o,data:s,format:l=6408,type:u=5121}=e,{gl:h}=this,v=o||s;return this.bind(),v instanceof Promise?v.then(T=>this.setImageDataForFace(Object.assign({},e,{face:r,data:T,pixels:T}))):this.width||this.height?h.texImage2D(r,0,l,i,n,0,l,u,v):h.texImage2D(r,0,l,l,u,v),this}setImageData3D(e){let{level:r=0,dataFormat:i,format:n,type:o,width:s,height:l,depth:u=1,offset:h=0,data:v,parameters:T={}}=e;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let E=H0(n);if(Iu(this.gl,T,()=>{ArrayBuffer.isView(v)&&this.gl.texImage3D(this.target,r,E.format,s,l,u,0,E.dataFormat,E.type,v),v instanceof $l&&(this.gl.bindBuffer(35052,v.handle),this.gl.texImage3D(this.target,r,i,s,l,u,0,n,o,h))}),v&&v.byteLength)this.trackAllocatedMemory(v.byteLength,"Texture");else{let M=z3(this.props.format);this.trackAllocatedMemory(this.width*this.height*this.depth*M,"Texture")}return this.loaded=!0,this}_setSamplerParameters(e){if(!wp(e)){One(e),this.gl.bindTexture(this.target,this.handle);for(let[r,i]of Object.entries(e)){let n=Number(r),o=i;switch(n){case 33082:case 33083:this.gl.texParameterf(this.target,n,o);break;default:this.gl.texParameteri(this.target,n,o);break}}this.gl.bindTexture(this.target,null)}}},ec=cT;Yr(ec,"FACES",[34069,34070,34071,34072,34073,34074]);function Bne(t){switch(t.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(t.dimension)}}function One(t){Kt.log(1,"texture sampler parameters",t)()}var bh=class extends _h{device;gl;handle;get texture(){return this.colorAttachments[0]}constructor(e,r){super(e,r);let i=r.handle===null;if(this.device=e,this.gl=e.gl,this.handle=this.props.handle||i?this.props.handle:this.gl.createFramebuffer(),!i){e.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures();let n=this.gl.bindFramebuffer(36160,this.handle);for(let o=0;o<this.colorAttachments.length;++o){let s=this.colorAttachments[o],l=36064+o;s&&this._attachOne(l,s)}if(this.depthStencilAttachment&&this._attachOne(Mz(this.depthStencilAttachment.props.format),this.depthStencilAttachment),r.check!==!1){let o=this.gl.checkFramebufferStatus(36160);if(o!==36053)throw new Error(`Framebuffer ${Lne(o)}`)}this.gl.bindFramebuffer(36160,n)}}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}createDepthStencilTexture(e){return new ec(this.device,{id:`${this.id}-depth-stencil`,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;e===void 0&&(e=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let i of this.colorAttachments)i.texture.resize({width:e,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.texture.resize({width:e,height:r}),this}_attachOne(e,r){if(Array.isArray(r)){let[i,n=0,o=0]=r;return this._attachTexture(e,i,n,o),i}if(r instanceof ec)return this._attachTexture(e,r,0,0),r;if(r instanceof gf){let i=r;return this._attachTexture(e,i.texture,i.props.baseMipLevel,i.props.baseArrayLayer),r.texture}throw new Error("attach")}_attachTexture(e,r,i,n){let{gl:o}=this.device;switch(o.bindTexture(r.target,r.handle),r.target){case 35866:case 32879:o.framebufferTextureLayer(36160,e,r.target,n,i);break;case 34067:let s=Dne(i);o.framebufferTexture2D(36160,e,s,r.handle,n);break;case 3553:o.framebufferTexture2D(36160,e,3553,r.handle,n);break;default:Yi(!1,"Illegal texture type")}o.bindTexture(r.target,null)}};function Dne(t){return t<34069?t+34069:t}function Lne(t){switch(t){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${t}`}}var uT=class extends Tp{device;presentationSize;_framebuffer=null;constructor(e,r){super(r),this.device=e,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new bh(this.device,{handle:null}),this._framebuffer}update(){let e=this.getPixelSize();(e[0]!==this.presentationSize[0]||e[1]!==this.presentationSize[1])&&(this.presentationSize=e,this.resize())}resize(e){if(this.device.gl&&this.canvas){let r=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(r,e);return}}commit(){}};var Fne={spector:Kt.get("spector")||Kt.get("spectorjs")},Nne="https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",kne=1,wc=null,Oz=!1;async function Dz(t){if(!globalThis.SPECTOR)try{await ux(Nne)}catch(e){Kt.warn(String(e))}}function Lz(t){if(t={...Fne,...t},!t?.spector||(!wc&&globalThis.SPECTOR&&(Kt.probe(kne,"SPECTOR found and initialized")(),wc=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=wc)),!wc))return null;if(Oz||(Oz=!0,wc.spyCanvases(),wc?.onCaptureStarted.add(e=>Kt.info("Spector capture started:",e)()),wc?.onCapture.add(e=>{Kt.info("Spector capture complete:",e)(),wc?.getResultUI(),wc?.resultView.display(),wc?.resultView.addCapture(e)})),t?.canvas){if(typeof t.spector=="string"&&t.spector!==t.canvas.id)return wc;wc?.startCapture(t?.canvas,500),new Promise(e=>setTimeout(e,2e3)).then(e=>{Kt.info("Spector capture stopped after 2 seconds")(),wc?.stopCapture()})}return wc}var Une="https://unpkg.com/webgl-debug@2.0.1/index.js";function Fz(t){return t.luma=t.luma||{},t.luma}async function Nz(){Ol()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await ux(Une))}function kz(t,e={}){return t?e.debug?Vne(t,e):zne(t):null}function zne(t){let e=Fz(t);return e.realContext?e.realContext:t}function Vne(t,e){if(!globalThis.WebGLDebugUtils)return Kt.warn("webgl-debug not loaded")(),t;let r=Fz(t);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...yh,...t});let i=globalThis.WebGLDebugUtils.makeDebugContext(t,Hne.bind(null,e),jne.bind(null,e));for(let s in yh)!(s in i)&&typeof yh[s]=="number"&&(i[s]=yh[s]);class n{}Object.setPrototypeOf(i,Object.getPrototypeOf(t)),Object.setPrototypeOf(n,i);let o=Object.create(n);return r.realContext=t,r.debugContext=o,o.debug=!0,o}function j3(t,e){e=Array.from(e).map(i=>i===void 0?"undefined":i);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${t}(${r})`}function Hne(t,e,r,i){i=Array.from(i).map(l=>l===void 0?"undefined":l);let n=globalThis.WebGLDebugUtils.glEnumToString(e),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,i),s=`${n} in gl.${r}(${o})`;Kt.error(s)();debugger;if(t.throwOnError)throw new Error(s)}function jne(t,e,r){let i="";if(Kt.level>=1&&(i=j3(e,r),Kt.log(1,i)()),t.break&&t.break.length>0&&(i=i||j3(e,r),t.break.every(o=>i.indexOf(o)!==-1)))debugger;for(let n of r)if(n===void 0){if(i=i||j3(e,r),t.throwOnError)throw new Error(`Undefined argument: ${i}`);Kt.error(`Undefined argument: ${i}`)();debugger}}function zz(t){let e=t.split(/\r?\n/),r=[];for(let i of e){if(i.length<=1)continue;let n=i.split(":");if(n.length===2){let[T,E]=n;r.push({message:E.trim(),type:Uz(T),lineNum:0,linePos:0});continue}let[o,s,l,...u]=n,h=parseInt(l,10);isNaN(h)&&(h=0);let v=parseInt(s,10);isNaN(v)&&(v=0),r.push({message:u.join(":").trim(),type:Uz(o),lineNum:h,linePos:v})}return r}function Uz(t){let e=["warning","error","info"],r=t.toLowerCase();return e.includes(r)?r:"info"}var fT=class extends Sp{device;handle;constructor(e,r){switch(super(e,r),this.device=e,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return zz(e)}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)}async _compile(e){e=(n=>n.startsWith("#version ")?n:`#version 100
${n}`)(e);let{gl:i}=this.device;if(i.shaderSource(this.handle,e),i.compileShader(this.handle),Kt.level===0){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}Kt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),Kt.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};var Gne=256,Wne=1024,qne=16384,G3=6144,Xne=[1,2,4,8],hT=class extends D0{device;glParameters;constructor(e,r){super(e,r),this.device=e,Mp(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){md(this.device.gl)}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={...this.glParameters};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),e.scissorRect&&(r.scissorTest=!0,r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(r.colorMask=Xne.map(i=>Boolean(i&e.colorMask))),this.glParameters=r,mf(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=qne,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=Gne,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=Wne,e.clearStencil=this.props.clearStencil),r!==0&&Iu(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){Iu(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl.clearBufferiv(G3,e,r);break;case Uint32Array:this.device.gl.clearBufferuiv(G3,e,r);break;case Float32Array:default:this.device.gl.clearBufferfv(G3,e,r);break}})}};var Yne="Failed to deduce GL constant from typed array";function Vz(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(Yne)}}function _x(t,e){let{clamped:r=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var Kne={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},Zne={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},Ip=class{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(e){return _x(e.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(e){return Yi(e.size),_x(e.type||5126).BYTES_PER_ELEMENT*e.size}static resolve(...e){return new Ip(Kne,...e)}constructor(...e){e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return Ip.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return Ip.getBytesPerVertex(this)}_assign(e={}){return e=S3("Accessor",e,Zne),e.type!==void 0&&(this.type=e.type,(e.type===5124||e.type===5125)&&(this.integer=!0)),e.size!==void 0&&(this.size=e.size),e.offset!==void 0&&(this.offset=e.offset),e.stride!==void 0&&(this.stride=e.stride),e.normalize!==void 0&&(this.normalized=e.normalize),e.normalized!==void 0&&(this.normalized=e.normalized),e.integer!==void 0&&(this.integer=e.integer),e.divisor!==void 0&&(this.divisor=e.divisor),e.buffer!==void 0&&(this.buffer=e.buffer),e.index!==void 0&&(typeof e.index=="boolean"?this.index=e.index?1:0:this.index=e.index),e.instanced!==void 0&&(this.divisor=e.instanced?1:0),e.isInstanced!==void 0&&(this.divisor=e.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function Hz(t){return Jne.includes(t)}var Jne=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],jz={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function W3(t){let e=jz[t];if(!e)throw new Error("uniform");let[r,i,,n]=e;return{format:n,components:i,glType:r}}function Gz(t){let e=jz[t];if(!e)throw new Error("attribute");let[,r,,i,n]=e;return{attributeType:i,vertexFormat:n,components:r}}function Wz(t,e){let r={attributes:[],bindings:[]};r.attributes=Qne(t,e);let i=toe(t,e);for(let l of i){let u=l.uniforms.map(h=>({name:h.name,format:h.format,byteOffset:h.byteOffset,byteStride:h.byteStride,arrayLength:h.arrayLength}));r.bindings.push({type:"uniform",name:l.name,location:l.location,visibility:(l.vertex?1:0)&(l.fragment?2:0),minBindingSize:l.byteLength,uniforms:u})}let n=eoe(t,e),o=0;for(let l of n)if(Hz(l.type)){let{viewDimension:u,sampleType:h}=ioe(l.type);r.bindings.push({type:"texture",name:l.name,location:o,viewDimension:u,sampleType:h}),l.textureUnit=o,o+=1}n.length&&(r.uniforms=n);let s=$ne(t,e);return s?.length&&(r.varyings=s),r}function Qne(t,e){let r=[],i=t.getProgramParameter(e,35721);for(let n=0;n<i;n++){let o=t.getActiveAttrib(e,n);if(!o)throw new Error("activeInfo");let{name:s,type:l}=o,u=t.getAttribLocation(e,s);if(u>=0){let{attributeType:h}=Gz(l),v=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:u,stepMode:v,type:h})}}return r.sort((n,o)=>n.location-o.location),r}function $ne(t,e){let r=[],i=t.getProgramParameter(e,35971);for(let n=0;n<i;n++){let o=t.getTransformFeedbackVarying(e,n);if(!o)throw new Error("activeInfo");let{name:s,type:l,size:u}=o,{glType:h,components:v}=W3(l),T=new Ip({type:h,size:u*v}),E={location:n,name:s,accessor:T};r.push(E)}return r.sort((n,o)=>n.location-o.location),r}function eoe(t,e){let r=[],i=t.getProgramParameter(e,35718);for(let n=0;n<i;n++){let o=t.getActiveUniform(e,n);if(!o)throw new Error("activeInfo");let{name:s,size:l,type:u}=o,{name:h,isArray:v}=noe(s),T=t.getUniformLocation(e,h),E={location:T,name:h,size:l,type:u,isArray:v};if(r.push(E),E.size>1)for(let M=0;M<E.size;M++){let O=`${h}[${M}]`;T=t.getUniformLocation(e,O);let F={...E,name:O,location:T};r.push(F)}}return r}function toe(t,e){let r=(o,s)=>t.getActiveUniformBlockParameter(e,o,s),i=[],n=t.getProgramParameter(e,35382);for(let o=0;o<n;o++){let s={name:t.getActiveUniformBlockName(e,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},l=r(o,35395)||[],u=t.getActiveUniforms(e,l,35383),h=t.getActiveUniforms(e,l,35384),v=t.getActiveUniforms(e,l,35387),T=t.getActiveUniforms(e,l,35388);for(let E=0;E<s.uniformCount;++E){let M=t.getActiveUniform(e,l[E]);if(!M)throw new Error("activeInfo");s.uniforms.push({name:M.name,format:W3(u[E]).format,type:u[E],arrayLength:h[E],byteOffset:v[E],byteStride:T[E]})}i.push(s)}return i.sort((o,s)=>o.location-s.location),i}var roe={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function ioe(t){let e=roe[t];if(!e)throw new Error("sampler");let[r,i]=e;return{viewDimension:r,sampleType:i}}function noe(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function qz(t,e,r,i){let n=t,o=i;o===!0&&(o=1),o===!1&&(o=0);let s=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof i!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,i);case 5126:return t.uniform1fv(e,s);case 35664:return t.uniform2fv(e,s);case 35665:return t.uniform3fv(e,s);case 35666:return t.uniform4fv(e,s);case 5124:return t.uniform1iv(e,s);case 35667:return t.uniform2iv(e,s);case 35668:return t.uniform3iv(e,s);case 35669:return t.uniform4iv(e,s);case 35670:return t.uniform1iv(e,s);case 35671:return t.uniform2iv(e,s);case 35672:return t.uniform3iv(e,s);case 35673:return t.uniform4iv(e,s);case 5125:return n.uniform1uiv(e,s,1);case 36294:return n.uniform2uiv(e,s,2);case 36295:return n.uniform3uiv(e,s,3);case 36296:return n.uniform4uiv(e,s,4);case 35674:return t.uniformMatrix2fv(e,!1,s);case 35675:return t.uniformMatrix3fv(e,!1,s);case 35676:return t.uniformMatrix4fv(e,!1,s);case 35685:return n.uniformMatrix2x3fv(e,!1,s);case 35686:return n.uniformMatrix2x4fv(e,!1,s);case 35687:return n.uniformMatrix3x2fv(e,!1,s);case 35688:return n.uniformMatrix3x4fv(e,!1,s);case 35689:return n.uniformMatrix4x2fv(e,!1,s);case 35690:return n.uniformMatrix4x3fv(e,!1,s)}throw new Error("Illegal uniform")}function Xz(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(t)}}function Yz(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(t)}}var Kz=4,dT=class extends Af{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:i,bufferMode:n=35981}=r;switch(i&&i.length>0&&(this.varyings=i,this.device.gl.transformFeedbackVaryings(this.handle,i,n)),this._linkShaders(),Kt.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=Wz(this.device.gl,this.handle),Kt.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=y3(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":Kt.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e,r){for(let[i,n]of Object.entries(e)){let o=this.shaderLayout.bindings.find(s=>s.name===i)||this.shaderLayout.bindings.find(s=>s.name===`${i}Uniforms`);if(!o){let s=this.shaderLayout.bindings.map(l=>`"${l.name}"`).join(", ");r?.disableWarnings||Kt.warn(`Unknown binding "${i}" in render pipeline "${this.id}", expected one of ${s}`)();continue}switch(n||Kt.warn(`Unsetting binding "${i}" in render pipeline "${this.id}"`)(),o.type){case"uniform":if(!(n instanceof $l)&&!(n.buffer instanceof $l))throw new Error("buffer value");break;case"texture":if(!(n instanceof gf||n instanceof ec||n instanceof bh))throw new Error("texture value");break;case"sampler":Kt.warn(`Ignoring sampler ${i}`)();break;default:throw new Error(o.type)}this.bindings[i]=n}}draw(e){let{renderPass:r,parameters:i=this.props.parameters,topology:n=this.props.topology,vertexArray:o,vertexCount:s,instanceCount:l,isInstanced:u=!1,firstVertex:h=0,transformFeedback:v}=e,T=Xz(n),E=Boolean(o.indexBuffer),M=o.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable()||s===0)return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;if(s===0)return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)(),!0;this.device.gl.useProgram(this.handle),o.bindBeforeRender(r),v&&v.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let O=r;return Rz(this.device,i,O.glParameters,()=>{E&&u?this.device.gl.drawElementsInstanced(T,s||0,M,h,l||0):E?this.device.gl.drawElements(T,s||0,M,h):u?this.device.gl.drawArraysInstanced(T,h,s||0,l||0):this.device.gl.drawArrays(T,h,s||0),v&&v.end()}),o.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=cx(e);Object.keys(r).forEach(i=>{Kt.warn(`Unsupported value "${JSON.stringify(r[i])}" used in setUniforms() for key ${i}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),Kt.time(Kz,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),Kt.timeEnd(Kz,`linkProgram for ${this.id}`)(),Kt.level,!this.device.features.has("compilation-status-async-webgl")){let i=this._getLinkStatus();this._reportLinkStatus(i);return}Kt.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),Kt.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}_reportLinkStatus(e){switch(e){case"success":return;default:throw this.vs.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`)):this.fs?.compilationStatus==="error"?(this.fs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`)):new Error(`Error during ${e}: ${this.device.gl.getProgramInfoLog(this.handle)}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let[,r]of Object.entries(this.bindings))r instanceof ec&&(r.update(),e=e&&r.loaded);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,i=0;for(let n of this.shaderLayout.bindings){let o=this.bindings[n.name]||this.bindings[n.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${n.name} in ${this.id}`);switch(n.type){case"uniform":let{name:s}=n,l=e.getUniformBlockIndex(this.handle,s);if(l===4294967295)throw new Error(`Invalid uniform block name ${s}`);e.uniformBlockBinding(this.handle,i,l),o instanceof $l?e.bindBufferBase(35345,i,o.handle):e.bindBufferRange(35345,i,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),i+=1;break;case"texture":if(!(o instanceof gf||o instanceof ec||o instanceof bh))throw new Error("texture");let u;if(o instanceof gf)u=o.texture;else if(o instanceof ec)u=o;else if(o instanceof bh&&o.colorAttachments[0]instanceof gf)Kt.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),u=o.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+r),e.bindTexture(u.target,u.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${n.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:i,type:n,textureUnit:o}=e,s=this.uniforms[r]??o;s!==void 0&&qz(this.device.gl,i,n,s)}}};var pT=class extends F0{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":ooe(this.device,r.options);break;case"copy-buffer-to-texture":soe(this.device,r.options);break;case"copy-texture-to-buffer":aoe(this.device,r.options);break;case"copy-texture-to-texture":loe(this.device,r.options);break}}};function ooe(t,e){let r=e.source,i=e.destination;t.gl.bindBuffer(36662,r.handle),t.gl.bindBuffer(36663,i.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function soe(t,e){throw new Error("Not implemented")}function aoe(t,e){let{source:r,mipLevel:i=0,aspect:n="all",width:o=e.source.width,height:s=e.source.height,depthOrArrayLayers:l=0,origin:u=[0,0],destination:h,byteOffset:v=0,bytesPerRow:T,rowsPerImage:E}=e;if(n!=="all")throw new Error("not supported");if(i!==0||l!==0||T||E)throw new Error("not implemented");let{framebuffer:M,destroyFramebuffer:O}=Zz(r),F;try{let z=h,W=o||M.width,J=s||M.height,K=H0(M.texture.props.format),ne=K.dataFormat,ge=K.type;t.gl.bindBuffer(35051,z.handle),F=t.gl.bindFramebuffer(36160,M.handle),t.gl.readPixels(u[0],u[1],W,J,ne,ge,v)}finally{t.gl.bindBuffer(35051,null),F!==void 0&&t.gl.bindFramebuffer(36160,F),O&&M.destroy()}}function loe(t,e){let{source:r,destinationMipLevel:i=0,origin:n=[0,0],destinationOrigin:o=[0,0],destination:s}=e,{width:l=e.destination.width,height:u=e.destination.height}=e,{framebuffer:h,destroyFramebuffer:v}=Zz(r),[T,E]=n,[M,O,F]=o,z=t.gl.bindFramebuffer(36160,h.handle),W=null,J;if(s instanceof ec)W=s,l=Number.isFinite(l)?l:W.width,u=Number.isFinite(u)?u:W.height,W.bind(0),J=W.target;else throw new Error("invalid destination");switch(J){case 3553:case 34067:t.gl.copyTexSubImage2D(J,i,M,O,T,E,l,u);break;case 35866:case 32879:t.gl.copyTexSubImage3D(J,i,M,O,F,T,E,l,u);break;default:}W&&W.unbind(),t.gl.bindFramebuffer(36160,z),v&&h.destroy()}function Zz(t){if(t instanceof bo){let{width:e,height:r,id:i}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${i}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var AT=class extends L0{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new pT(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,i){}};var j0=class extends N0{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return CP()==="Chrome"}constructor(e,r){super(e,r),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){let r=e;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r,this.device.gl.bindVertexArray(null)}setBuffer(e,r){let i=r;if(i.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:n,type:o,stride:s,offset:l,normalized:u,integer:h,divisor:v}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,i.handle),h?this.device.gl.vertexAttribIPointer(e,n,o,s,l):this.device.gl.vertexAttribPointer(e,n,o,u,s,l),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,v||0),this.attributes[e]=i,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let r=this.attributes[e];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(e,r)}}_getAccessor(e){let r=this.attributeInfos[e];if(!r)throw new Error(`Unknown attribute location ${e}`);let i=Q2(r.bufferDataType);return{size:r.bufferComponents,type:i,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(e,r=!0){let n=j0.isConstantAttributeZeroSupported(this.device)||e!==0;(r||n)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,r){let i=coe(r),n=i.byteLength*e,o=i.length*e;if(this.buffer&&n!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${n} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:n}),s=s||!uoe(i,this.bufferValue),s){let l=w3(r.constructor,o);T3({target:l,source:i,start:0,count:o}),this.buffer.write(l),this.bufferValue=r}return this.buffer}};function coe(t){return Array.isArray(t)?new Float32Array(t):t}function uoe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var mT=class extends k0{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,r){super(e,r),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(Yz(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let i=this._getVaryingIndex(e),{buffer:n,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(i<0){this.unusedBuffers[e]=n,Kt.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[i]={buffer:n,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(i,n,s,o)}getBuffer(e){if(Jz(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof $l)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:i=0,byteLength:n=e.buffer.byteLength}=e;return{buffer:r,byteOffset:i,byteLength:n}}_getVaryingIndex(e){if(Jz(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:i,byteOffset:n}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,n,i)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,r,i=0,n){let o=r&&r.handle;!o||n===void 0?this.gl.bindBufferBase(35982,e,o):this.gl.bindBufferRange(35982,e,o,i,n)}};function Jz(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var gT=class extends U0{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,n)=>{let o=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>e?(n("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};function q3(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return Yi(!1),0}}function Qz(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return Yi(!1),0}}function $z(t,e){let{sourceX:r=0,sourceY:i=0,sourceFormat:n=6408,sourceAttachment:o=36064}=e||{},{target:s=null,sourceWidth:l,sourceHeight:u,sourceType:h}=e||{},{framebuffer:v,deleteFramebuffer:T}=t5(t);Yi(v);let{gl:E,handle:M}=v;l=l||v.width,u=u||v.height;let O=o-36064;h=h||v.colorAttachments[O]?.texture?.type||5121,s=hoe(s,h,n,l,u),h=h||Vz(s);let F=E.bindFramebuffer(36160,M);return E.readPixels(r,i,l,u,n,h,s),E.bindFramebuffer(36160,F||null),T&&v.destroy(),s}function e5(t,e){let{target:r,sourceX:i=0,sourceY:n=0,sourceFormat:o=6408,targetByteOffset:s=0}=e||{},{sourceWidth:l,sourceHeight:u,sourceType:h}=e||{},{framebuffer:v,deleteFramebuffer:T}=t5(t);Yi(v),l=l||v.width,u=u||v.height;let E=v;h=h||5121;let M=r;if(!M){let F=q3(o),z=Qz(h),W=s+l*u*F*z;M=E.device.createBuffer({byteLength:W})}let O=t.device.createCommandEncoder();return O.copyTextureToBuffer({source:t,width:l,height:u,origin:[i,n],destination:M,byteOffset:s}),O.destroy(),T&&v.destroy(),M}function t5(t){return t instanceof _h?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:foe(t),deleteFramebuffer:!0}}function foe(t,e){let{device:r,width:i,height:n,id:o}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${o}`,width:i,height:n,colorAttachments:[t]})}function hoe(t,e,r,i,n){if(t)return t;e=e||5121;let o=_x(e,{clamped:!1}),s=q3(r);return new o(i*n*s)}var doe=256,poe=1024,Aoe=16384;var moe="clear: bad arguments";function r5(t,e){let{framebuffer:r=null,color:i=null,depth:n=null,stencil:o=null}=e||{},s={};r&&(s.framebuffer=r);let l=0;i&&(l|=Aoe,i!==!0&&(s.clearColor=i)),n&&(l|=doe,n!==!0&&(s.clearDepth=n)),o&&(l|=poe,n!==!0&&(s.clearStencil=n)),Yi(l!==0,moe);let u=t.gl;Iu(u,s,()=>{u.clear(l)})}var yx=1,G0=class extends Yc{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;static isSupported(){return typeof WebGL2RenderingContext<"u"}static attach(e){if(e instanceof G0)return e;if(e?.device instanceof Yc)return e.device;if(!goe(e))throw new Error("Invalid WebGL2RenderingContext");return new G0({gl:e})}static async create(e={}){Kt.groupCollapsed(yx,"WebGLDevice created")();let r=[];e.debug&&r.push(Nz()),e.spector&&r.push(Dz()),typeof e.canvas=="string"&&r.push(Tp.pageLoaded);let i=await Promise.allSettled(r);for(let s of i)s.status==="rejected"&&Kt.error(`Failed to initialize debug libraries ${s.reason}`)();if(Kt.probe(yx+1,"DOM is loaded")(),e.gl?.device)return Kt.warn("reattaching existing device")(),G0.attach(e.gl);let n=new G0(e),o=`Created ${n.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return Kt.probe(yx,o)(),Kt.table(yx,n.info)(),Kt.groupEnd(yx)(),n}constructor(e){super({...e,id:e.id||oa("webgl-device")});let r=e.gl?.device;if(r)throw new Error(`WebGL context already attached to device ${r.id}`);let i=e.gl?.canvas||e.canvas;this.canvasContext=new uT(this,{...e,canvas:i}),this.lost=new Promise(l=>{this._resolveContextLost=l});let n=e.gl||null;if(n||=_z(this.canvasContext.canvas,{...e,onContextLost:l=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})}),!n)throw new Error("WebGL context creation failed");this.handle=n,this.gl=n,this.gl.device=this,this.gl._version=2,e.spector&&(this.spectorJS=Lz({...this.props,canvas:this.handle.canvas})),this.info=yz(this.gl,this._extensions),this.limits=new oT(this.gl),this.features=new nT(this.gl,this._extensions,this.props.disabledFeatures),this.props.initalizeFeatures&&this.features.initializeFeatures(),this.canvasContext.resize();let{enable:o=!0,copyState:s=!1}=e;D3(this.gl,{enable:o,copyState:s,log:(...l)=>Kt.log(1,...l)()}),e.debug&&(this.gl=kz(this.gl,{...e,throwOnError:!0}),this.debug=!0,Kt.level=Math.max(Kt.level,1),Kt.warn("WebGL debug mode activated. Performance reduced.")())}destroy(){}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(e){return iT(this.gl,e,this._extensions)}isTextureFormatFilterable(e){return Sz(this.gl,e,this._extensions)}isTextureFormatRenderable(e){return Cz(this.gl,e,this._extensions)}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._getBufferProps(e);return new $l(this,r)}_createTexture(e){return new ec(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new nm(this,e)}createShader(e){return new fT(this,e)}createFramebuffer(e){return new bh(this,e)}createVertexArray(e){return new j0(this,e)}createTransformFeedback(e){return new mT(this,e)}createQuerySet(e){return new gT(this,e)}createRenderPipeline(e){return new dT(this,e)}beginRenderPass(e){return new hT(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(e){return new AT(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return $z(e,r)}readPixelsToBufferWebGL(e,r){return e5(e,r)}setParametersWebGL(e){mf(this.gl,e)}getParametersWebGL(e){return J2(this.gl,e)}withParametersWebGL(e,r){return Iu(this.gl,e,r)}clearWebGL(e){r5(this,e)}resetWebGL(){Kt.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),Az(this.gl)}gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;loseDevice(){let e=!1,i=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return i&&(e=!0,i.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){Mp(this.gl)}popState(){md(this.gl)}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){r=r||this.gl2||this.gl;let i=Number(e);for(let n in r)if(r[n]===i)return`GL.${n}`;return String(e)}_constants;setConstantAttributeWebGL(e,r){let i=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(i).fill(null);let n=this._constants[e];switch(n&&xoe(n,r)&&Kt.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:_oe(this,e,r);break;case Int32Array:yoe(this,e,r);break;case Uint32Array:voe(this,e,r);break;default:Yi(!1)}}getExtension(e){return Mu(this.gl,e,this._extensions),this._extensions}},wh=G0;Yr(wh,"type","webgl");function goe(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:Boolean(t&&Number.isFinite(t._version))}function _oe(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:Yi(!1)}}function yoe(t,e,r){t.gl.vertexAttribI4iv(e,r)}function voe(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function xoe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var i5,n5,s5={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function _T(){return document.createElement("div")}function boe(t){if(!t.picked)return null;if(t.object===i5)return n5;let e={html:Toe(t.object),style:s5};return n5=e,i5=t.object,e}var woe=new Set(["position","index"]);function Toe(t){let e=_T();for(let r in t){if(woe.has(r))continue;let i=_T();i.className="header",i.textContent=r;let n=_T();n.className="value",n.textContent=Soe(t[r]);let o=_T();Eoe(o,i,n),o.appendChild(i),o.appendChild(n),e.appendChild(o)}return e.innerHTML}function Eoe(t,e,r){Object.assign(e.style,{fontWeight:700,marginRight:"10px",flex:"1 1 0%"}),Object.assign(r.style,{flex:"none",maxWidth:"250px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}),Object.assign(t.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function Soe(t){let e;if(Array.isArray(t)&&t.length>4)e=`Array<${t.length}>`;else if(typeof t=="string")e=t;else if(typeof t=="number")e=String(t);else try{e=JSON.stringify(t)}catch{e="<Non-Serializable Object>"}let r=50;return e.length>r&&(e=e.slice(0,r)),e}function o5(t,e){let r,i=t,n="properties",o=/{[^}]*}/g,s=u=>u.replace(/[{}]/g,""),l=[...new Set(t.match(o).map(s))];for(let u of l){if(u.includes(".")){r=e;let h=u.split(".");for(let v of h)if(r.hasOwnProperty(v))r=r[v];else{r=void 0;break}}else e.hasOwnProperty(u)?r=e[u]:e[n]&&e[n].hasOwnProperty(u)?r=e[n][u]:r=void 0;i=i.replaceAll(`{${u}}`,r)}return i}function X3(t){return t?t.html||t.text?e=>{if(!e.picked)return null;let r={style:t.style||s5};return t.html?r.html=o5(t.html,e.object):r.text=o5(t.text,e.object),r}:boe:null}function a5(t){let e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=t,document.getElementsByTagName("head")[0].appendChild(e)}function l5(t,e){let r=document.createElement("div");return r.style.width=Number.isFinite(t)?`${t}px`:t,r.style.height=`${e}px`,r.style.position="relative",r}var u5=ga(c5()),Coe="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",Z3=u5.default;function f5(t=Coe){a5(t)}function h5(){let t=["mapboxgl-missing-css"];for(let e of t){let r=document.getElementsByClassName(e)[0];r&&r.style&&(r.style.display="none")}}var J3={};function d5(t){if(!J3[t]){let e=document.createElement("script");e.type="text/javascript",e.src=t,document.querySelector("head").appendChild(e),J3[t]=new Promise(i=>{e.onload=i})}return J3[t]}var p5="4.2.0-beta.2";var Moe=globalThis.loaders?.parseImageNode,Q3=typeof Image<"u",$3=typeof ImageBitmap<"u",Ioe=Boolean(Moe),eR=Ad?!0:Ioe;function A5(t){switch(t){case"auto":return $3||Q3||eR;case"imagebitmap":return $3;case"image":return Q3;case"data":return eR;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function m5(){if($3)return"imagebitmap";if(Q3)return"image";if(eR)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function g5(t){let e=Poe(t);if(!e)throw new Error("Not an image");return e}function vx(t){switch(g5(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Poe(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Roe=/^data:image\/svg\+xml/,Boe=/\.svg((\?|#).*)?$/;function yT(t){return t&&(Roe.test(t)||Boe.test(t))}function _5(t,e){if(yT(e)){let i=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return tR(t,e)}function tR(t,e){if(yT(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function vT(t,e,r){let i=_5(t,r),n=self.URL||self.webkitURL,o=typeof i!="string"&&n.createObjectURL(i);try{return await Ooe(o||i,e)}finally{o&&n.revokeObjectURL(o)}}async function Ooe(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";n(new Error(s))}}catch(o){n(o)}})}var Doe={},y5=!0;async function v5(t,e,r){let i;yT(r)?i=await vT(t,e,r):i=tR(t,r);let n=e&&e.imagebitmap;return await Loe(i,n)}async function Loe(t,e=null){if((Foe(e)||!y5)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),y5=!1}return await createImageBitmap(t)}function Foe(t){for(let e in t||Doe)return!1;return!0}function x5(t){return!zoe(t,"ftyp",4)||!(t[8]&96)?null:Noe(t)}function Noe(t){switch(koe(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function koe(t,e,r){return String.fromCharCode(...t.slice(e,r))}function Uoe(t){return[...t].map(e=>e.charCodeAt(0))}function zoe(t,e,r=0){let i=Uoe(e);for(let n=0;n<i.length;++n)if(i[n]!==t[n+r])return!1;return!0}var Th=!1,xx=!0;function om(t){let e=bx(t);return Hoe(e)||Woe(e)||joe(e)||Goe(e)||Voe(e)}function Voe(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=x5(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function Hoe(t){let e=bx(t);return e.byteLength>=24&&e.getUint32(0,Th)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Th),height:e.getUint32(20,Th)}:null}function joe(t){let e=bx(t);return e.byteLength>=10&&e.getUint32(0,Th)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,xx),height:e.getUint16(8,xx)}:null}function Goe(t){let e=bx(t);return e.byteLength>=14&&e.getUint16(0,Th)===16973&&e.getUint32(2,xx)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,xx),height:e.getUint32(22,xx)}:null}function Woe(t){let e=bx(t);if(!(e.byteLength>=3&&e.getUint16(0,Th)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=qoe(),o=2;for(;o+9<e.byteLength;){let s=e.getUint16(o,Th);if(n.has(s))return{mimeType:"image/jpeg",height:e.getUint16(o+5,Th),width:e.getUint16(o+7,Th)};if(!i.has(s))return null;o+=2,o+=e.getUint16(o,Th)}return null}function qoe(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function bx(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function b5(t,e){let{mimeType:r}=om(t)||{},i=globalThis.loaders?.parseImageNode;return Bn(i),await i(t,r)}async function w5(t,e,r){e=e||{};let n=(e.image||{}).type||"auto",{url:o}=r||{},s=Xoe(n),l;switch(s){case"imagebitmap":l=await v5(t,e,o);break;case"image":l=await vT(t,e,o);break;case"data":l=await b5(t,e);break;default:Bn(!1)}return n==="data"&&(l=vx(l)),l}function Xoe(t){switch(t){case"auto":case"data":return m5();default:return A5(t),t}}var Yoe=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Koe=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Zoe={image:{type:"auto",decode:!0}},Eh={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:p5,mimeTypes:Koe,extensions:Yoe,parse:w5,tests:[t=>Boolean(om(new DataView(t)))],options:Zoe};var rR={};function iR(t){if(rR[t]===void 0){let e=Ad?Qoe(t):Joe(t);rR[t]=e}return rR[t]}function Joe(t){let e=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||e,i=globalThis.loaders?.parseImageNode;return Boolean(i)&&r.includes(t)}function Qoe(t){switch(t){case"image/avif":case"image/webp":return $oe(t);default:return!0}}function $oe(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var ese=new bc({id:"deck"}),ur=ese;var nR={};function T5(t){nR=t}function Ks(t,e,r,i){ur.level>0&&nR[t]&&nR[t].call(null,e,r,i)}function tse(t){let e=t[0],r=t[t.length-1];return e==="{"&&r==="}"||e==="["&&r==="]"}var E5={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:tse,parseTextSync:JSON.parse};function rse(){let t="9.0.0-beta.11",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(ur.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:ur,_registerLoggers:T5},em([E5,[Eh,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}var xT=rse();function Sh(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var oR={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function C5(t){let e={};for(let[r,i]of Object.entries(t))e[r]=ise(i);return e}function M5(t,e,r){let i={};for(let[n,o]of Object.entries(e))t&&n in t&&!o.private?(o.validate&&Sh(o.validate(t[n],o),`${r}: invalid ${n}`),i[n]=t[n]):i[n]=o.value;return i}function ise(t){let e=S5(t);if(e!=="object")return{value:t,...oR[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...oR[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=S5(t.value),{...t,...oR[e],type:e}):{type:"object",value:null};throw new Error("props")}function S5(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var I5=`#ifdef MODULE_LOGDEPTH
logdepth_adjustPosition(gl_Position);
#endif
`,P5=`#ifdef MODULE_MATERIAL
gl_FragColor = material_filterColor(gl_FragColor);
#endif
#ifdef MODULE_LIGHTING
gl_FragColor = lighting_filterColor(gl_FragColor);
#endif
#ifdef MODULE_FOG
gl_FragColor = fog_filterColor(gl_FragColor);
#endif
#ifdef MODULE_PICKING
gl_FragColor = picking_filterHighlightColor(gl_FragColor);
gl_FragColor = picking_filterPickingColor(gl_FragColor);
#endif
#ifdef MODULE_LOGDEPTH
logdepth_setFragDepth();
#endif
`;var nse={vertex:I5,fragment:P5},R5=/void\s+main\s*\([^)]*\)\s*\{\n?/,B5=/}\n?[^{}]*$/,sR=[],wx="__LUMA_INJECT_DECLARATIONS__";function O5(t){let e={vertex:{},fragment:{}};for(let r in t){let i=t[r],n=ose(r);typeof i=="string"&&(i={order:0,injection:i}),e[n][r]=i}return e}function ose(t){let e=t.slice(0,2);switch(e){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(e)}}function Tx(t,e,r,i=!1){let n=e==="vertex";for(let o in r){let s=r[o];s.sort((u,h)=>u.order-h.order),sR.length=s.length;for(let u=0,h=s.length;u<h;++u)sR[u]=s[u].injection;let l=`${sR.join(`
`)}
`;switch(o){case"vs:#decl":n&&(t=t.replace(wx,l));break;case"vs:#main-start":n&&(t=t.replace(R5,u=>u+l));break;case"vs:#main-end":n&&(t=t.replace(B5,u=>l+u));break;case"fs:#decl":n||(t=t.replace(wx,l));break;case"fs:#main-start":n||(t=t.replace(R5,u=>u+l));break;case"fs:#main-end":n||(t=t.replace(B5,u=>l+u));break;default:t=t.replace(o,u=>u+l)}}return t=t.replace(wx,""),i&&(t=t.replace(/\}\s*$/,o=>o+nse[e])),t}var sse=1,Zc=class{name;vs;fs;getModuleUniforms;dependencies;deprecations;defines;injections;uniforms={};uniformTypes={};static instantiateModules(e){return e.map(r=>{if(r instanceof Zc)return r;Sh(typeof r!="string",`Shader module use by name is deprecated. Import shader module '${JSON.stringify(r)}' and use it directly.`),r.name||(console.warn("shader module has no name"),r.name=`shader-module-${sse++}`);let i=new Zc(r);return i.dependencies=Zc.instantiateModules(r.dependencies||[]),i})}constructor(e){let{name:r,vs:i,fs:n,dependencies:o=[],uniformTypes:s={},uniformPropTypes:l={},getUniforms:u,deprecations:h=[],defines:v={},inject:T={}}=e;Sh(typeof r=="string"),this.name=r,this.vs=i,this.fs=n,this.getModuleUniforms=u,this.dependencies=Zc.instantiateModules(o),this.deprecations=this._parseDeprecationDefinitions(h),this.defines=v,this.injections=O5(T),this.uniformTypes=s,l&&(this.uniforms=C5(l))}getModuleSource(e){let r;switch(e){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:Sh(!1)}let i=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------
#define MODULE_${i}
${r}
`}getUniforms(e,r){return this.getModuleUniforms?this.getModuleUniforms(e,r):M5(e,this.uniforms,this.name)}getDefines(){return this.defines}checkDeprecations(e,r){this.deprecations.forEach(i=>{i.regex?.test(e)&&(i.deprecated?r.deprecated(i.old,i.new)():r.removed(i.old,i.new)())})}_parseDeprecationDefinitions(e){return e.forEach(r=>{switch(r.type){case"function":r.regex=new RegExp(`\\b${r.old}\\(`);break;default:r.regex=new RegExp(`${r.type} ${r.old};`)}}),e}_defaultGetUniforms(e={}){let r={},i=this.uniforms;for(let n in i){let o=i[n];n in e&&!o.private?(o.validate&&Sh(o.validate(e[n],o),`${this.name}: invalid ${n}`),r[n]=e[n]):r[n]=o.value}return r}};function aR(t){if(t.source&&t.platformInfo.type==="webgpu")return{...t,vs:void 0,fs:void 0};if(!t.vs)throw new Error("no vertex shader");let e=D5(t.platformInfo,t.vs),r;return t.fs&&(r=D5(t.platformInfo,t.fs)),{...t,vs:e,fs:r}}function D5(t,e){if(typeof e=="string")return e;switch(t.type){case"webgpu":if(e?.wgsl)return e.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(e?.glsl)return e.glsl;throw new Error("WebGL does not support WGSL shaders")}}function sm(t){let e=Zc.instantiateModules(t);return ase(e)}function ase(t){let e={},r={};return L5({modules:t,level:0,moduleMap:e,moduleDepth:r}),Object.keys(r).sort((i,n)=>r[n]-r[i]).map(i=>e[i])}function L5(t){let{modules:e,level:r,moduleMap:i,moduleDepth:n}=t;if(r>=5)throw new Error("Possible loop in shader dependency graph");for(let o of e)i[o.name]=o,(n[o.name]===void 0||n[o.name]<r)&&(n[o.name]=r);for(let o of e)o.dependencies&&L5({modules:o.dependencies,level:r+1,moduleMap:i,moduleDepth:n})}function F5(t){switch(t?.gpu.toLowerCase()){case"apple":return`#define APPLE_GPU
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
`;case"nvidia":return`#define NVIDIA_GPU
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
`;case"intel":return`#define INTEL_GPU
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
`;case"amd":return`#define AMD_GPU
`;default:return`#define DEFAULT_GPU
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
`}}function k5(t,e){if(Number(t.match(/^#version[ \t]+(\d+)/m)?.[1]||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(e){case"vertex":return t=N5(t,lse),t;case"fragment":return t=N5(t,cse),t;default:throw new Error(e)}}var U5=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],lse=[...U5,[lR("attribute"),"in $1"],[lR("varying"),"out $1"]],cse=[...U5,[lR("varying"),"in $1"]];function N5(t,e){for(let[r,i]of e)t=t.replace(r,i);return t}function lR(t){return new RegExp(`\\b${t}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function cR(t,e){let r="";for(let i in t){let n=t[i];if(r+=`void ${n.signature} {
`,n.header&&(r+=` ${n.header}`),e[i]){let o=e[i];o.sort((s,l)=>s.order-l.order);for(let s of o)r+=` ${s.injection}
`}n.footer&&(r+=` ${n.footer}`),r+=`}
`}return r}function uR(t){let e={vertex:{},fragment:{}};for(let r of t){let i,n;typeof r!="string"?(i=r,n=i.hook):(i={},n=r),n=n.trim();let[o,s]=n.split(":"),l=n.replace(/\(.+/,""),u=Object.assign(i,{signature:s});switch(o){case"vs":e.vertex[l]=u;break;case"fs":e.fragment[l]=u;break;default:throw new Error(o)}}return e}function z5(t,e){return{name:use(t,e),language:"glsl",version:fse(t)}}function use(t,e="unnamed"){let i=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(t);return i?i[1]:e}function fse(t){let e=100,r=t.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let i=parseInt(r[1],10);Number.isFinite(i)&&(e=i)}if(e!==100&&e!==300)throw new Error(`Invalid GLSL version ${e}`);return e}var H5=`
${wx}
`,hse=`precision highp float;
`;function j5(t){let e=sm(t.modules||[]);return{source:fR(t.platformInfo,{...t,source:t.source,stage:"vertex",modules:e}),getUniforms:hR(e)}}function G5(t){let e=sm(t.modules||[]);return{vs:fR(t.platformInfo,{...t,source:t.vs,stage:"vertex",modules:e}),fs:fR(t.platformInfo,{...t,source:t.fs,stage:"fragment",modules:e}),getUniforms:hR(e)}}function W5(t){let{vs:e,fs:r}=t,i=sm(t.modules||[]);return{vs:V5(t.platformInfo,{...t,source:e,stage:"vertex",modules:i}),fs:V5(t.platformInfo,{...t,source:r,stage:"fragment",modules:i}),getUniforms:hR(i)}}function fR(t,e){let{source:r,stage:i,modules:n,hookFunctions:o=[],inject:s={},log:l}=e;Sh(typeof r=="string","shader source must be a string");let u=r,h="",v=uR(o),T={},E={},M={};for(let F in s){let z=typeof s[F]=="string"?{injection:s[F],order:0}:s[F],W=/^(v|f)s:(#)?([\w-]+)$/.exec(F);if(W){let J=W[2],K=W[3];J?K==="decl"?E[F]=[z]:M[F]=[z]:T[F]=[z]}else M[F]=[z]}let O=t.type!=="webgpu"?n:[];for(let F of O){l&&F.checkDeprecations(u,l);let z=F.getModuleSource(i,"wgsl");h+=z;let W=F.injections[i];for(let J in W){let K=/^(v|f)s:#([\w-]+)$/.exec(J);if(K){let ge=K[2]==="decl"?E:M;ge[J]=ge[J]||[],ge[J].push(W[J])}else T[J]=T[J]||[],T[J].push(W[J])}}return h+=H5,h=Tx(h,i,E),h+=cR(v[i],T),h+=u,h=Tx(h,i,M),h}function V5(t,e){let{id:r,source:i,stage:n,language:o="glsl",modules:s,defines:l={},hookFunctions:u=[],inject:h={},prologue:v=!0,log:T}=e;Sh(typeof i=="string","shader source must be a string");let E=o==="glsl"?z5(i).version:-1,M=t.shaderLanguageVersion,O=E===100?"#version 100":"#version 300 es",z=i.split(`
`).slice(1).join(`
`),W={};s.forEach(me=>{Object.assign(W,me.getDefines())}),Object.assign(W,l);let J="";switch(o){case"wgsl":break;case"glsl":J=v?`${O}
// ----- PROLOGUE -------------------------
${dse({id:r,source:i,stage:n})}
${`#define SHADER_TYPE_${n.toUpperCase()}`}
${F5(t)}
${n==="fragment"?hse:""}
// ----- APPLICATION DEFINES -------------------------
${pse(W)}
`:`${O}
`;break}let K=uR(u),ne={},ge={},j={};for(let me in h){let fe=typeof h[me]=="string"?{injection:h[me],order:0}:h[me],$=/^(v|f)s:(#)?([\w-]+)$/.exec(me);if($){let Z=$[2],we=$[3];Z?we==="decl"?ge[me]=[fe]:j[me]=[fe]:ne[me]=[fe]}else j[me]=[fe]}for(let me of s){T&&me.checkDeprecations(z,T);let fe=me.getModuleSource(n);J+=fe;let $=me.injections[n];for(let Z in $){let we=/^(v|f)s:#([\w-]+)$/.exec(Z);if(we){let he=we[2]==="decl"?ge:j;he[Z]=he[Z]||[],he[Z].push($[Z])}else ne[Z]=ne[Z]||[],ne[Z].push($[Z])}}return J+="// ----- MAIN SHADER SOURCE -------------------------",J+=H5,J=Tx(J,n,ge),J+=cR(K[n],ne),J+=z,J=Tx(J,n,j),o==="glsl"&&E!==M&&(J=k5(J,n)),J.trim()}function hR(t){return function(r){let i={};for(let n of t){let o=n.getUniforms(r,i);Object.assign(i,o)}return i}}function dse(t){let{id:e,source:r,stage:i}=t;return e&&r.indexOf("SHADER_NAME")===-1?`
#define SHADER_NAME ${e}_${i}
`:""}function pse(t={}){let e="";for(let r in t){let i=t[r];(i||Number.isFinite(i))&&(e+=`#define ${r.toUpperCase()} ${t[r]}
`)}return e}var W0=class{_hookFunctions=[];_defaultModules=[];static getDefaultShaderAssembler(){return W0.defaultShaderAssembler=W0.defaultShaderAssembler||new W0,W0.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(r=>r.name===(typeof e=="string"?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){let r=typeof e=="string"?e:e.name;this._defaultModules=this._defaultModules.filter(i=>i.name!==r)}addShaderHook(e,r){r&&(e=Object.assign(r,{hook:e})),this._hookFunctions.push(e)}assembleShader(e){let r=this._getModuleList(e.modules),i=this._hookFunctions,n=aR(e);return{...j5({platformInfo:e.platformInfo,...n,modules:r,hookFunctions:i}),modules:r}}assembleShaderPair(e){let r=aR(e),i=this._getModuleList(e.modules),n=this._hookFunctions,{platformInfo:o}=e;return{...e.platformInfo.shaderLanguage==="wgsl"?G5({platformInfo:o,...r,modules:i,hookFunctions:n}):W5({platformInfo:o,...r,modules:i,hookFunctions:n}),modules:i}}_getModuleList(e=[]){let r=new Array(this._defaultModules.length+e.length),i={},n=0;for(let o=0,s=this._defaultModules.length;o<s;++o){let l=this._defaultModules[o],u=l.name;r[n++]=l,i[u]=!0}for(let o=0,s=e.length;o<s;++o){let l=e[o],u=l.name;i[u]||(r[n++]=l,i[u]=!0)}return r.length=n,Zc.instantiateModules(r)}},Pp=W0;Yr(Pp,"defaultShaderAssembler");function dR(t){if(!t.normalized&&(t.normalized=!0,t.uniformPropTypes&&!t.getUniforms)){let e=new Zc(t);t.getUniforms=e.getUniforms.bind(e)}return t}var Ase=`out vec4 transform_output;
void main() {
transform_output = vec4(0);
}`,mse=`#version 300 es
${Ase}`;function Ex(t){let{input:e,inputChannels:r,output:i}=t||{};if(!e)return mse;if(!r)throw new Error("inputChannels");let n=gse(r),o=q5(e,r);return`#version 300 es
in ${n} ${e};
out vec4 ${i};
void main() {
${i} = ${o};
}`}function gse(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${t}`)}}function q5(t,e){switch(e){case 1:return`vec4(${t}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${t}, 0.0, 1.0)`;case 3:return`vec4(${t}, 1.0)`;case 4:return t;default:throw new Error(`invalid channels: ${e}`)}}var pR=class{constructor(){this.constants=new Map,this.aliases=new Map,this.structs=new Map}},_d=class{constructor(){}get isAstNode(){return!0}get astNodeType(){return""}evaluate(e){throw new Error("Cannot evaluate node")}evaluateString(e){return this.evaluate(e).toString()}},Ss=class extends _d{constructor(){super()}},bT=class extends Ss{constructor(e,r,i,n){super(),this.name=e,this.args=r,this.returnType=i,this.body=n}get astNodeType(){return"function"}},AR=class extends Ss{constructor(e){super(),this.expression=e}get astNodeType(){return"staticAssert"}},mR=class extends Ss{constructor(e,r){super(),this.condition=e,this.body=r}get astNodeType(){return"while"}},gR=class extends Ss{constructor(e){super(),this.body=e}get astNodeType(){return"continuing"}},_R=class extends Ss{constructor(e,r,i,n){super(),this.init=e,this.condition=r,this.increment=i,this.body=n}get astNodeType(){return"for"}},Bp=class extends Ss{constructor(e,r,i,n,o){super(),this.name=e,this.type=r,this.storage=i,this.access=n,this.value=o}get astNodeType(){return"var"}},wT=class extends Ss{constructor(e,r,i){super(),this.name=e,this.type=r,this.value=i}get astNodeType(){return"override"}},TT=class extends Ss{constructor(e,r,i,n,o){super(),this.name=e,this.type=r,this.storage=i,this.access=n,this.value=o}get astNodeType(){return"let"}},ET=class extends Ss{constructor(e,r,i,n,o){super(),this.name=e,this.type=r,this.storage=i,this.access=n,this.value=o}get astNodeType(){return"const"}evaluate(e){return this.value.evaluate(e)}},K0;(function(t){t.increment="++",t.decrement="--"})(K0||(K0={}));(function(t){function e(r){let i=r;if(i=="parse")throw new Error("Invalid value for IncrementOperator");return t[i]}t.parse=e})(K0||(K0={}));var yR=class extends Ss{constructor(e,r){super(),this.operator=e,this.variable=r}get astNodeType(){return"increment"}},Cx;(function(t){t.assign="=",t.addAssign="+=",t.subtractAssin="-=",t.multiplyAssign="*=",t.divideAssign="/=",t.moduloAssign="%=",t.andAssign="&=",t.orAssign="|=",t.xorAssign="^=",t.shiftLeftAssign="<<=",t.shiftRightAssign=">>="})(Cx||(Cx={}));(function(t){function e(r){let i=r;if(i=="parse")throw new Error("Invalid value for AssignOperator");return t[i]}t.parse=e})(Cx||(Cx={}));var vR=class extends Ss{constructor(e,r,i){super(),this.operator=e,this.variable=r,this.value=i}get astNodeType(){return"assign"}},xR=class extends Ss{constructor(e,r){super(),this.name=e,this.args=r}get astNodeType(){return"call"}},bR=class extends Ss{constructor(e,r){super(),this.body=e,this.continuing=r}get astNodeType(){return"loop"}},wR=class extends Ss{constructor(e,r){super(),this.condition=e,this.body=r}get astNodeType(){return"body"}},TR=class extends Ss{constructor(e,r,i,n){super(),this.condition=e,this.body=r,this.elseif=i,this.else=n}get astNodeType(){return"if"}},ER=class extends Ss{constructor(e){super(),this.value=e}get astNodeType(){return"return"}},SR=class extends Ss{constructor(e){super(),this.name=e}get astNodeType(){return"enable"}},ST=class extends Ss{constructor(e,r){super(),this.name=e,this.type=r}get astNodeType(){return"alias"}},CR=class extends Ss{constructor(){super()}get astNodeType(){return"discard"}},MR=class extends Ss{constructor(){super()}get astNodeType(){return"break"}},IR=class extends Ss{constructor(){super()}get astNodeType(){return"continue"}},yd=class extends Ss{constructor(e){super(),this.name=e}get astNodeType(){return"type"}get isStruct(){return!1}get isArray(){return!1}},gd=class extends yd{constructor(e,r){super(e),this.members=r}get astNodeType(){return"struct"}get isStruct(){return!0}getMemberIndex(e){for(let r=0;r<this.members.length;r++)if(this.members[r].name==e)return r;return-1}},CT=class extends yd{constructor(e,r,i){super(e),this.format=r,this.access=i}get astNodeType(){return"template"}},PR=class extends yd{constructor(e,r,i,n){super(e),this.storage=r,this.type=i,this.access=n}get astNodeType(){return"pointer"}},MT=class extends yd{constructor(e,r,i,n){super(e),this.attributes=r,this.format=i,this.count=n}get astNodeType(){return"array"}get isArray(){return!0}},am=class extends yd{constructor(e,r,i){super(e),this.format=r,this.access=i}get astNodeType(){return"sampler"}},Bu=class extends _d{constructor(){super()}},IT=class extends Bu{constructor(e){super(),this.value=e}get astNodeType(){return"stringExpr"}toString(){return this.value}evaluateString(){return this.value}},lm=class extends Bu{constructor(e,r){super(),this.type=e,this.args=r}get astNodeType(){return"createExpr"}},RR=class extends Bu{constructor(e,r){super(),this.name=e,this.args=r}get astNodeType(){return"callExpr"}evaluate(e){switch(this.name){case"abs":return Math.abs(this.args[0].evaluate(e));case"acos":return Math.acos(this.args[0].evaluate(e));case"acosh":return Math.acosh(this.args[0].evaluate(e));case"asin":return Math.asin(this.args[0].evaluate(e));case"asinh":return Math.asinh(this.args[0].evaluate(e));case"atan":return Math.atan(this.args[0].evaluate(e));case"atan2":return Math.atan2(this.args[0].evaluate(e),this.args[1].evaluate(e));case"atanh":return Math.atanh(this.args[0].evaluate(e));case"ceil":return Math.ceil(this.args[0].evaluate(e));case"clamp":return Math.min(Math.max(this.args[0].evaluate(e),this.args[1].evaluate(e)),this.args[2].evaluate(e));case"cos":return Math.cos(this.args[0].evaluate(e));case"degrees":return this.args[0].evaluate(e)*180/Math.PI;case"distance":return Math.sqrt(Math.pow(this.args[0].evaluate(e)-this.args[1].evaluate(e),2));case"dot":case"exp":return Math.exp(this.args[0].evaluate(e));case"exp2":return Math.pow(2,this.args[0].evaluate(e));case"floor":return Math.floor(this.args[0].evaluate(e));case"fma":return this.args[0].evaluate(e)*this.args[1].evaluate(e)+this.args[2].evaluate(e);case"fract":return this.args[0].evaluate(e)-Math.floor(this.args[0].evaluate(e));case"inverseSqrt":return 1/Math.sqrt(this.args[0].evaluate(e));case"log":return Math.log(this.args[0].evaluate(e));case"log2":return Math.log2(this.args[0].evaluate(e));case"max":return Math.max(this.args[0].evaluate(e),this.args[1].evaluate(e));case"min":return Math.min(this.args[0].evaluate(e),this.args[1].evaluate(e));case"mix":return this.args[0].evaluate(e)*(1-this.args[2].evaluate(e))+this.args[1].evaluate(e)*this.args[2].evaluate(e);case"modf":return this.args[0].evaluate(e)-Math.floor(this.args[0].evaluate(e));case"pow":return Math.pow(this.args[0].evaluate(e),this.args[1].evaluate(e));case"radians":return this.args[0].evaluate(e)*Math.PI/180;case"round":return Math.round(this.args[0].evaluate(e));case"sign":return Math.sign(this.args[0].evaluate(e));case"sin":return Math.sin(this.args[0].evaluate(e));case"sinh":return Math.sinh(this.args[0].evaluate(e));case"saturate":return Math.min(Math.max(this.args[0].evaluate(e),0),1);case"smoothstep":return this.args[0].evaluate(e)*this.args[0].evaluate(e)*(3-2*this.args[0].evaluate(e));case"sqrt":return Math.sqrt(this.args[0].evaluate(e));case"step":return this.args[0].evaluate(e)<this.args[1].evaluate(e)?0:1;case"tan":return Math.tan(this.args[0].evaluate(e));case"tanh":return Math.tanh(this.args[0].evaluate(e));case"trunc":return Math.trunc(this.args[0].evaluate(e));default:throw new Error("Non const function: "+this.name)}}},BR=class extends Bu{constructor(e){super(),this.name=e}get astNodeType(){return"varExpr"}},PT=class extends Bu{constructor(e,r){super(),this.name=e,this.initializer=r}get astNodeType(){return"constExpr"}evaluate(e){var r,i;if(this.initializer instanceof lm){let n=(r=this.postfix)===null||r===void 0?void 0:r.evaluateString(e),o=(i=this.initializer.type)===null||i===void 0?void 0:i.name,s=e.structs.get(o),l=s?.getMemberIndex(n);if(l!=-1)return this.initializer.args[l].evaluate(e);console.log(l)}return this.initializer.evaluate(e)}},RT=class extends Bu{constructor(e){super(),this.value=e}get astNodeType(){return"literalExpr"}evaluate(){return this.value}},OR=class extends Bu{constructor(e,r){super(),this.type=e,this.value=r}get astNodeType(){return"bitcastExpr"}},DR=class extends Bu{constructor(e,r){super(),this.type=e,this.args=r}get astNodeType(){return"typecastExpr"}evaluate(e){return this.args[0].evaluate(e)}},BT=class extends Bu{constructor(e){super(),this.contents=e}get astNodeType(){return"groupExpr"}evaluate(e){return this.contents[0].evaluate(e)}},OT=class extends Bu{constructor(){super()}},LR=class extends OT{constructor(e,r){super(),this.operator=e,this.right=r}get astNodeType(){return"unaryOp"}evaluate(e){switch(this.operator){case"+":return this.right.evaluate(e);case"-":return-this.right.evaluate(e);case"!":return this.right.evaluate(e)?0:1;case"~":return~this.right.evaluate(e);default:throw new Error("Unknown unary operator: "+this.operator)}}},Pu=class extends OT{constructor(e,r,i){super(),this.operator=e,this.left=r,this.right=i}get astNodeType(){return"binaryOp"}evaluate(e){switch(this.operator){case"+":return this.left.evaluate(e)+this.right.evaluate(e);case"-":return this.left.evaluate(e)-this.right.evaluate(e);case"*":return this.left.evaluate(e)*this.right.evaluate(e);case"/":return this.left.evaluate(e)/this.right.evaluate(e);case"%":return this.left.evaluate(e)%this.right.evaluate(e);case"==":return this.left.evaluate(e)==this.right.evaluate(e)?1:0;case"!=":return this.left.evaluate(e)!=this.right.evaluate(e)?1:0;case"<":return this.left.evaluate(e)<this.right.evaluate(e)?1:0;case">":return this.left.evaluate(e)>this.right.evaluate(e)?1:0;case"<=":return this.left.evaluate(e)<=this.right.evaluate(e)?1:0;case">=":return this.left.evaluate(e)>=this.right.evaluate(e)?1:0;case"&&":return this.left.evaluate(e)&&this.right.evaluate(e)?1:0;case"||":return this.left.evaluate(e)||this.right.evaluate(e)?1:0;default:throw new Error(`Unknown operator ${this.operator}`)}}},DT=class extends _d{constructor(){super()}},FR=class extends DT{constructor(e,r){super(),this.selector=e,this.body=r}get astNodeType(){return"case"}},NR=class extends DT{constructor(e){super(),this.body=e}get astNodeType(){return"default"}},kR=class extends _d{constructor(e,r,i){super(),this.name=e,this.type=r,this.attributes=i}get astNodeType(){return"argument"}},UR=class extends _d{constructor(e,r){super(),this.condition=e,this.body=r}get astNodeType(){return"elseif"}},zR=class extends _d{constructor(e,r,i){super(),this.name=e,this.type=r,this.attributes=i}get astNodeType(){return"member"}},LT=class extends _d{constructor(e,r){super(),this.name=e,this.value=r}get astNodeType(){return"attribute"}},er,mt;(function(t){t[t.token=0]="token",t[t.keyword=1]="keyword",t[t.reserved=2]="reserved"})(mt||(mt={}));var At=class{constructor(e,r,i){this.name=e,this.type=r,this.rule=i}toString(){return this.name}},We=class{};er=We;We.none=new At("",mt.reserved,"");We.eof=new At("EOF",mt.token,"");We.reserved={asm:new At("asm",mt.reserved,"asm"),bf16:new At("bf16",mt.reserved,"bf16"),do:new At("do",mt.reserved,"do"),enum:new At("enum",mt.reserved,"enum"),f16:new At("f16",mt.reserved,"f16"),f64:new At("f64",mt.reserved,"f64"),handle:new At("handle",mt.reserved,"handle"),i8:new At("i8",mt.reserved,"i8"),i16:new At("i16",mt.reserved,"i16"),i64:new At("i64",mt.reserved,"i64"),mat:new At("mat",mt.reserved,"mat"),premerge:new At("premerge",mt.reserved,"premerge"),regardless:new At("regardless",mt.reserved,"regardless"),typedef:new At("typedef",mt.reserved,"typedef"),u8:new At("u8",mt.reserved,"u8"),u16:new At("u16",mt.reserved,"u16"),u64:new At("u64",mt.reserved,"u64"),unless:new At("unless",mt.reserved,"unless"),using:new At("using",mt.reserved,"using"),vec:new At("vec",mt.reserved,"vec"),void:new At("void",mt.reserved,"void")};We.keywords={array:new At("array",mt.keyword,"array"),atomic:new At("atomic",mt.keyword,"atomic"),bool:new At("bool",mt.keyword,"bool"),f32:new At("f32",mt.keyword,"f32"),i32:new At("i32",mt.keyword,"i32"),mat2x2:new At("mat2x2",mt.keyword,"mat2x2"),mat2x3:new At("mat2x3",mt.keyword,"mat2x3"),mat2x4:new At("mat2x4",mt.keyword,"mat2x4"),mat3x2:new At("mat3x2",mt.keyword,"mat3x2"),mat3x3:new At("mat3x3",mt.keyword,"mat3x3"),mat3x4:new At("mat3x4",mt.keyword,"mat3x4"),mat4x2:new At("mat4x2",mt.keyword,"mat4x2"),mat4x3:new At("mat4x3",mt.keyword,"mat4x3"),mat4x4:new At("mat4x4",mt.keyword,"mat4x4"),ptr:new At("ptr",mt.keyword,"ptr"),sampler:new At("sampler",mt.keyword,"sampler"),sampler_comparison:new At("sampler_comparison",mt.keyword,"sampler_comparison"),struct:new At("struct",mt.keyword,"struct"),texture_1d:new At("texture_1d",mt.keyword,"texture_1d"),texture_2d:new At("texture_2d",mt.keyword,"texture_2d"),texture_2d_array:new At("texture_2d_array",mt.keyword,"texture_2d_array"),texture_3d:new At("texture_3d",mt.keyword,"texture_3d"),texture_cube:new At("texture_cube",mt.keyword,"texture_cube"),texture_cube_array:new At("texture_cube_array",mt.keyword,"texture_cube_array"),texture_multisampled_2d:new At("texture_multisampled_2d",mt.keyword,"texture_multisampled_2d"),texture_storage_1d:new At("texture_storage_1d",mt.keyword,"texture_storage_1d"),texture_storage_2d:new At("texture_storage_2d",mt.keyword,"texture_storage_2d"),texture_storage_2d_array:new At("texture_storage_2d_array",mt.keyword,"texture_storage_2d_array"),texture_storage_3d:new At("texture_storage_3d",mt.keyword,"texture_storage_3d"),texture_depth_2d:new At("texture_depth_2d",mt.keyword,"texture_depth_2d"),texture_depth_2d_array:new At("texture_depth_2d_array",mt.keyword,"texture_depth_2d_array"),texture_depth_cube:new At("texture_depth_cube",mt.keyword,"texture_depth_cube"),texture_depth_cube_array:new At("texture_depth_cube_array",mt.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new At("texture_depth_multisampled_2d",mt.keyword,"texture_depth_multisampled_2d"),texture_external:new At("texture_external",mt.keyword,"texture_external"),u32:new At("u32",mt.keyword,"u32"),vec2:new At("vec2",mt.keyword,"vec2"),vec3:new At("vec3",mt.keyword,"vec3"),vec4:new At("vec4",mt.keyword,"vec4"),bitcast:new At("bitcast",mt.keyword,"bitcast"),block:new At("block",mt.keyword,"block"),break:new At("break",mt.keyword,"break"),case:new At("case",mt.keyword,"case"),continue:new At("continue",mt.keyword,"continue"),continuing:new At("continuing",mt.keyword,"continuing"),default:new At("default",mt.keyword,"default"),discard:new At("discard",mt.keyword,"discard"),else:new At("else",mt.keyword,"else"),enable:new At("enable",mt.keyword,"enable"),fallthrough:new At("fallthrough",mt.keyword,"fallthrough"),false:new At("false",mt.keyword,"false"),fn:new At("fn",mt.keyword,"fn"),for:new At("for",mt.keyword,"for"),function:new At("function",mt.keyword,"function"),if:new At("if",mt.keyword,"if"),let:new At("let",mt.keyword,"let"),const:new At("const",mt.keyword,"const"),loop:new At("loop",mt.keyword,"loop"),while:new At("while",mt.keyword,"while"),private:new At("private",mt.keyword,"private"),read:new At("read",mt.keyword,"read"),read_write:new At("read_write",mt.keyword,"read_write"),return:new At("return",mt.keyword,"return"),storage:new At("storage",mt.keyword,"storage"),switch:new At("switch",mt.keyword,"switch"),true:new At("true",mt.keyword,"true"),alias:new At("alias",mt.keyword,"alias"),type:new At("type",mt.keyword,"type"),uniform:new At("uniform",mt.keyword,"uniform"),var:new At("var",mt.keyword,"var"),override:new At("override",mt.keyword,"override"),workgroup:new At("workgroup",mt.keyword,"workgroup"),write:new At("write",mt.keyword,"write"),r8unorm:new At("r8unorm",mt.keyword,"r8unorm"),r8snorm:new At("r8snorm",mt.keyword,"r8snorm"),r8uint:new At("r8uint",mt.keyword,"r8uint"),r8sint:new At("r8sint",mt.keyword,"r8sint"),r16uint:new At("r16uint",mt.keyword,"r16uint"),r16sint:new At("r16sint",mt.keyword,"r16sint"),r16float:new At("r16float",mt.keyword,"r16float"),rg8unorm:new At("rg8unorm",mt.keyword,"rg8unorm"),rg8snorm:new At("rg8snorm",mt.keyword,"rg8snorm"),rg8uint:new At("rg8uint",mt.keyword,"rg8uint"),rg8sint:new At("rg8sint",mt.keyword,"rg8sint"),r32uint:new At("r32uint",mt.keyword,"r32uint"),r32sint:new At("r32sint",mt.keyword,"r32sint"),r32float:new At("r32float",mt.keyword,"r32float"),rg16uint:new At("rg16uint",mt.keyword,"rg16uint"),rg16sint:new At("rg16sint",mt.keyword,"rg16sint"),rg16float:new At("rg16float",mt.keyword,"rg16float"),rgba8unorm:new At("rgba8unorm",mt.keyword,"rgba8unorm"),rgba8unorm_srgb:new At("rgba8unorm_srgb",mt.keyword,"rgba8unorm_srgb"),rgba8snorm:new At("rgba8snorm",mt.keyword,"rgba8snorm"),rgba8uint:new At("rgba8uint",mt.keyword,"rgba8uint"),rgba8sint:new At("rgba8sint",mt.keyword,"rgba8sint"),bgra8unorm:new At("bgra8unorm",mt.keyword,"bgra8unorm"),bgra8unorm_srgb:new At("bgra8unorm_srgb",mt.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new At("rgb10a2unorm",mt.keyword,"rgb10a2unorm"),rg11b10float:new At("rg11b10float",mt.keyword,"rg11b10float"),rg32uint:new At("rg32uint",mt.keyword,"rg32uint"),rg32sint:new At("rg32sint",mt.keyword,"rg32sint"),rg32float:new At("rg32float",mt.keyword,"rg32float"),rgba16uint:new At("rgba16uint",mt.keyword,"rgba16uint"),rgba16sint:new At("rgba16sint",mt.keyword,"rgba16sint"),rgba16float:new At("rgba16float",mt.keyword,"rgba16float"),rgba32uint:new At("rgba32uint",mt.keyword,"rgba32uint"),rgba32sint:new At("rgba32sint",mt.keyword,"rgba32sint"),rgba32float:new At("rgba32float",mt.keyword,"rgba32float"),static_assert:new At("static_assert",mt.keyword,"static_assert")};We.tokens={decimal_float_literal:new At("decimal_float_literal",mt.token,/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?f?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+f?)|([0-9]+f)/),hex_float_literal:new At("hex_float_literal",mt.token,/-?0x((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+f?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+f?))/),int_literal:new At("int_literal",mt.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new At("uint_literal",mt.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),ident:new At("ident",mt.token,/[a-zA-Z][0-9a-zA-Z_]*/),and:new At("and",mt.token,"&"),and_and:new At("and_and",mt.token,"&&"),arrow:new At("arrow ",mt.token,"->"),attr:new At("attr",mt.token,"@"),attr_left:new At("attr_left",mt.token,"[["),attr_right:new At("attr_right",mt.token,"]]"),forward_slash:new At("forward_slash",mt.token,"/"),bang:new At("bang",mt.token,"!"),bracket_left:new At("bracket_left",mt.token,"["),bracket_right:new At("bracket_right",mt.token,"]"),brace_left:new At("brace_left",mt.token,"{"),brace_right:new At("brace_right",mt.token,"}"),colon:new At("colon",mt.token,":"),comma:new At("comma",mt.token,","),equal:new At("equal",mt.token,"="),equal_equal:new At("equal_equal",mt.token,"=="),not_equal:new At("not_equal",mt.token,"!="),greater_than:new At("greater_than",mt.token,">"),greater_than_equal:new At("greater_than_equal",mt.token,">="),shift_right:new At("shift_right",mt.token,">>"),less_than:new At("less_than",mt.token,"<"),less_than_equal:new At("less_than_equal",mt.token,"<="),shift_left:new At("shift_left",mt.token,"<<"),modulo:new At("modulo",mt.token,"%"),minus:new At("minus",mt.token,"-"),minus_minus:new At("minus_minus",mt.token,"--"),period:new At("period",mt.token,"."),plus:new At("plus",mt.token,"+"),plus_plus:new At("plus_plus",mt.token,"++"),or:new At("or",mt.token,"|"),or_or:new At("or_or",mt.token,"||"),paren_left:new At("paren_left",mt.token,"("),paren_right:new At("paren_right",mt.token,")"),semicolon:new At("semicolon",mt.token,";"),star:new At("star",mt.token,"*"),tilde:new At("tilde",mt.token,"~"),underscore:new At("underscore",mt.token,"_"),xor:new At("xor",mt.token,"^"),plus_equal:new At("plus_equal",mt.token,"+="),minus_equal:new At("minus_equal",mt.token,"-="),times_equal:new At("times_equal",mt.token,"*="),division_equal:new At("division_equal",mt.token,"/="),modulo_equal:new At("modulo_equal",mt.token,"%="),and_equal:new At("and_equal",mt.token,"&="),or_equal:new At("or_equal",mt.token,"|="),xor_equal:new At("xor_equal",mt.token,"^="),shift_right_equal:new At("shift_right_equal",mt.token,">>="),shift_left_equal:new At("shift_left_equal",mt.token,"<<=")};We.storage_class=[er.keywords.function,er.keywords.private,er.keywords.workgroup,er.keywords.uniform,er.keywords.storage];We.access_mode=[er.keywords.read,er.keywords.write,er.keywords.read_write];We.sampler_type=[er.keywords.sampler,er.keywords.sampler_comparison];We.sampled_texture_type=[er.keywords.texture_1d,er.keywords.texture_2d,er.keywords.texture_2d_array,er.keywords.texture_3d,er.keywords.texture_cube,er.keywords.texture_cube_array];We.multisampled_texture_type=[er.keywords.texture_multisampled_2d];We.storage_texture_type=[er.keywords.texture_storage_1d,er.keywords.texture_storage_2d,er.keywords.texture_storage_2d_array,er.keywords.texture_storage_3d];We.depth_texture_type=[er.keywords.texture_depth_2d,er.keywords.texture_depth_2d_array,er.keywords.texture_depth_cube,er.keywords.texture_depth_cube_array,er.keywords.texture_depth_multisampled_2d];We.texture_external_type=[er.keywords.texture_external];We.any_texture_type=[...er.sampled_texture_type,...er.multisampled_texture_type,...er.storage_texture_type,...er.depth_texture_type,...er.texture_external_type];We.texel_format=[er.keywords.r8unorm,er.keywords.r8snorm,er.keywords.r8uint,er.keywords.r8sint,er.keywords.r16uint,er.keywords.r16sint,er.keywords.r16float,er.keywords.rg8unorm,er.keywords.rg8snorm,er.keywords.rg8uint,er.keywords.rg8sint,er.keywords.r32uint,er.keywords.r32sint,er.keywords.r32float,er.keywords.rg16uint,er.keywords.rg16sint,er.keywords.rg16float,er.keywords.rgba8unorm,er.keywords.rgba8unorm_srgb,er.keywords.rgba8snorm,er.keywords.rgba8uint,er.keywords.rgba8sint,er.keywords.bgra8unorm,er.keywords.bgra8unorm_srgb,er.keywords.rgb10a2unorm,er.keywords.rg11b10float,er.keywords.rg32uint,er.keywords.rg32sint,er.keywords.rg32float,er.keywords.rgba16uint,er.keywords.rgba16sint,er.keywords.rgba16float,er.keywords.rgba32uint,er.keywords.rgba32sint,er.keywords.rgba32float];We.const_literal=[er.tokens.int_literal,er.tokens.uint_literal,er.tokens.decimal_float_literal,er.tokens.hex_float_literal,er.keywords.true,er.keywords.false];We.literal_or_ident=[er.tokens.ident,er.tokens.int_literal,er.tokens.uint_literal,er.tokens.decimal_float_literal,er.tokens.hex_float_literal];We.element_count_expression=[er.tokens.int_literal,er.tokens.uint_literal,er.tokens.ident];We.template_types=[er.keywords.vec2,er.keywords.vec3,er.keywords.vec4,er.keywords.mat2x2,er.keywords.mat2x3,er.keywords.mat2x4,er.keywords.mat3x2,er.keywords.mat3x3,er.keywords.mat3x4,er.keywords.mat4x2,er.keywords.mat4x3,er.keywords.mat4x4,er.keywords.atomic,er.keywords.bitcast,...er.any_texture_type];We.attribute_name=[er.tokens.ident,er.keywords.block];We.assignment_operators=[er.tokens.equal,er.tokens.plus_equal,er.tokens.minus_equal,er.tokens.times_equal,er.tokens.division_equal,er.tokens.modulo_equal,er.tokens.and_equal,er.tokens.or_equal,er.tokens.xor_equal,er.tokens.shift_right_equal,er.tokens.shift_left_equal];We.increment_operators=[er.tokens.plus_plus,er.tokens.minus_minus];var FT=class{constructor(e,r,i){this.type=e,this.lexeme=r,this.line=i}toString(){return this.lexeme}isTemplateType(){return We.template_types.indexOf(this.type)!=-1}isArrayType(){return this.type==We.keywords.array}isArrayOrTemplateType(){return this.isArrayType()||this.isTemplateType()}},VR=class{constructor(e){this._tokens=[],this._start=0,this._current=0,this._line=1,this._source=e??""}scanTokens(){for(;!this._isAtEnd();)if(this._start=this._current,!this.scanToken())throw`Invalid syntax at line ${this._line}`;return this._tokens.push(new FT(We.eof,"",this._line)),this._tokens}scanToken(){let e=this._advance();if(e==`
`)return this._line++,!0;if(this._isWhitespace(e))return!0;if(e=="/"){if(this._peekAhead()=="/"){for(;e!=`
`;){if(this._isAtEnd())return!0;e=this._advance()}return this._line++,!0}else if(this._peekAhead()=="*"){this._advance();let i=1;for(;i>0;){if(this._isAtEnd())return!0;if(e=this._advance(),e==`
`)this._line++;else if(e=="*"){if(this._peekAhead()=="/"&&(this._advance(),i--,i==0))return!0}else e=="/"&&this._peekAhead()=="*"&&(this._advance(),i++)}return!0}}let r=We.none;for(;;){let i=this._findType(e),n=this._peekAhead();if(e==">"&&(n==">"||n=="=")){let o=!1,s=this._tokens.length-1;for(let l=0;l<5&&s>=0;++l,--s)if(this._tokens[s].type===We.tokens.less_than){s>0&&this._tokens[s-1].isArrayOrTemplateType()&&(o=!0);break}if(o)return this._addToken(i),!0}if(i===We.none){let o=e,s=0,l=2;for(let u=0;u<l;++u)if(o+=this._peekAhead(u),i=this._findType(o),i!==We.none){s=u;break}if(i===We.none)return r===We.none?!1:(this._current--,this._addToken(r),!0);e=o,this._current+=s+1}if(r=i,this._isAtEnd())break;e+=this._advance()}return r===We.none?!1:(this._addToken(r),!0)}_findType(e){for(let r in We.keywords){let i=We.keywords[r];if(this._match(e,i.rule))return i}for(let r in We.tokens){let i=We.tokens[r];if(this._match(e,i.rule))return i}return We.none}_match(e,r){if(typeof r=="string"){if(r==e)return!0}else{let i=r.exec(e);if(i&&i.index==0&&i[0]==e)return!0}return!1}_isAtEnd(){return this._current>=this._source.length}_isWhitespace(e){return e==" "||e==" "||e=="\r"}_advance(e=0){let r=this._source[this._current];return e=e||0,e++,this._current+=e,r}_peekAhead(e=0){return e=e||0,this._current+e>=this._source.length?"\0":this._source[this._current+e]}_addToken(e){let r=this._source.substring(this._start,this._current);this._tokens.push(new FT(e,r,this._line))}},HR=class{constructor(){this._tokens=[],this._current=0,this._context=new pR}parse(e){this._initialize(e);let r=[];for(;!this._isAtEnd();){let i=this._global_decl_or_directive();if(!i)break;r.push(i)}return r}_initialize(e){if(e)if(typeof e=="string"){let r=new VR(e);this._tokens=r.scanTokens()}else this._tokens=e;else this._tokens=[];this._current=0}_error(e,r){return console.error(e,r),{token:e,message:r,toString:function(){return`${r}`}}}_isAtEnd(){return this._current>=this._tokens.length||this._peek().type==We.eof}_match(e){if(e instanceof At)return this._check(e)?(this._advance(),!0):!1;for(let r=0,i=e.length;r<i;++r){let n=e[r];if(this._check(n))return this._advance(),!0}return!1}_consume(e,r){if(this._check(e))return this._advance();throw this._error(this._peek(),r)}_check(e){if(this._isAtEnd())return!1;let r=this._peek();if(e instanceof Array){let i=r.type;return e.indexOf(i)!=-1}return r.type==e}_advance(){return this._isAtEnd()||this._current++,this._previous()}_peek(){return this._tokens[this._current]}_previous(){return this._tokens[this._current-1]}_global_decl_or_directive(){for(;this._match(We.tokens.semicolon)&&!this._isAtEnd(););if(this._match(We.keywords.alias)){let r=this._type_alias();return this._consume(We.tokens.semicolon,"Expected ';'"),r}if(this._match(We.keywords.enable)){let r=this._enable_directive();return this._consume(We.tokens.semicolon,"Expected ';'"),r}let e=this._attribute();if(this._check(We.keywords.var)){let r=this._global_variable_decl();return r!=null&&(r.attributes=e),this._consume(We.tokens.semicolon,"Expected ';'."),r}if(this._check(We.keywords.override)){let r=this._override_variable_decl();return r!=null&&(r.attributes=e),this._consume(We.tokens.semicolon,"Expected ';'."),r}if(this._check(We.keywords.let)){let r=this._global_let_decl();return r!=null&&(r.attributes=e),this._consume(We.tokens.semicolon,"Expected ';'."),r}if(this._check(We.keywords.const)){let r=this._global_const_decl();return r!=null&&(r.attributes=e),this._consume(We.tokens.semicolon,"Expected ';'."),r}if(this._check(We.keywords.struct)){let r=this._struct_decl();return r!=null&&(r.attributes=e),r}if(this._check(We.keywords.fn)){let r=this._function_decl();return r!=null&&(r.attributes=e),r}return null}_function_decl(){if(!this._match(We.keywords.fn))return null;let e=this._consume(We.tokens.ident,"Expected function name.").toString();this._consume(We.tokens.paren_left,"Expected '(' for function arguments.");let r=[];if(!this._check(We.tokens.paren_right))do{if(this._check(We.tokens.paren_right))break;let o=this._attribute(),s=this._consume(We.tokens.ident,"Expected argument name.").toString();this._consume(We.tokens.colon,"Expected ':' for argument type.");let l=this._attribute(),u=this._type_decl();u!=null&&(u.attributes=l,r.push(new kR(s,u,o)))}while(this._match(We.tokens.comma));this._consume(We.tokens.paren_right,"Expected ')' after function arguments.");let i=null;if(this._match(We.tokens.arrow)){let o=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=o)}let n=this._compound_statement();return new bT(e,r,i,n)}_compound_statement(){let e=[];for(this._consume(We.tokens.brace_left,"Expected '{' for block.");!this._check(We.tokens.brace_right);){let r=this._statement();r!==null&&e.push(r)}return this._consume(We.tokens.brace_right,"Expected '}' for block."),e}_statement(){for(;this._match(We.tokens.semicolon)&&!this._isAtEnd(););if(this._check(We.keywords.if))return this._if_statement();if(this._check(We.keywords.switch))return this._switch_statement();if(this._check(We.keywords.loop))return this._loop_statement();if(this._check(We.keywords.for))return this._for_statement();if(this._check(We.keywords.while))return this._while_statement();if(this._check(We.keywords.continuing))return this._continuing_statement();if(this._check(We.keywords.static_assert))return this._static_assert_statement();if(this._check(We.tokens.brace_left))return this._compound_statement();let e=null;return this._check(We.keywords.return)?e=this._return_statement():this._check([We.keywords.var,We.keywords.let,We.keywords.const])?e=this._variable_statement():this._match(We.keywords.discard)?e=new CR:this._match(We.keywords.break)?e=new MR:this._match(We.keywords.continue)?e=new IR:e=this._increment_decrement_statement()||this._func_call_statement()||this._assignment_statement(),e!=null&&this._consume(We.tokens.semicolon,"Expected ';' after statement."),e}_static_assert_statement(){if(!this._match(We.keywords.static_assert))return null;let e=this._optional_paren_expression();return new AR(e)}_while_statement(){if(!this._match(We.keywords.while))return null;let e=this._optional_paren_expression(),r=this._compound_statement();return new mR(e,r)}_continuing_statement(){if(!this._match(We.keywords.continuing))return null;let e=this._compound_statement();return new gR(e)}_for_statement(){if(!this._match(We.keywords.for))return null;this._consume(We.tokens.paren_left,"Expected '('.");let e=this._check(We.tokens.semicolon)?null:this._for_init();this._consume(We.tokens.semicolon,"Expected ';'.");let r=this._check(We.tokens.semicolon)?null:this._short_circuit_or_expression();this._consume(We.tokens.semicolon,"Expected ';'.");let i=this._check(We.tokens.paren_right)?null:this._for_increment();this._consume(We.tokens.paren_right,"Expected ')'.");let n=this._compound_statement();return new _R(e,r,i,n)}_for_init(){return this._variable_statement()||this._func_call_statement()||this._assignment_statement()}_for_increment(){return this._func_call_statement()||this._increment_decrement_statement()||this._assignment_statement()}_variable_statement(){if(this._check(We.keywords.var)){let e=this._variable_decl();if(e===null)throw this._error(this._peek(),"Variable declaration expected.");let r=null;return this._match(We.tokens.equal)&&(r=this._short_circuit_or_expression()),new Bp(e.name,e.type,e.storage,e.access,r)}if(this._match(We.keywords.let)){let e=this._consume(We.tokens.ident,"Expected name for let.").toString(),r=null;if(this._match(We.tokens.colon)){let n=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=n)}this._consume(We.tokens.equal,"Expected '=' for let.");let i=this._short_circuit_or_expression();return new TT(e,r,null,null,i)}if(this._match(We.keywords.const)){let e=this._consume(We.tokens.ident,"Expected name for const.").toString(),r=null;if(this._match(We.tokens.colon)){let n=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=n)}this._consume(We.tokens.equal,"Expected '=' for const.");let i=this._short_circuit_or_expression();return new ET(e,r,null,null,i)}return null}_increment_decrement_statement(){let e=this._current,r=this._unary_expression();if(r==null)return null;if(!this._check(We.increment_operators))return this._current=e,null;let i=this._consume(We.increment_operators,"Expected increment operator");return new yR(i.type===We.tokens.plus_plus?K0.increment:K0.decrement,r)}_assignment_statement(){let e=null;if(this._check(We.tokens.brace_right))return null;let r=this._match(We.tokens.underscore);if(r||(e=this._unary_expression()),!r&&e==null)return null;let i=this._consume(We.assignment_operators,"Expected assignment operator."),n=this._short_circuit_or_expression();return new vR(Cx.parse(i.lexeme),e,n)}_func_call_statement(){if(!this._check(We.tokens.ident))return null;let e=this._current,r=this._consume(We.tokens.ident,"Expected function name."),i=this._argument_expression_list();return i===null?(this._current=e,null):new xR(r.lexeme,i)}_loop_statement(){if(!this._match(We.keywords.loop))return null;this._consume(We.tokens.brace_left,"Expected '{' for loop.");let e=[],r=this._statement();for(;r!==null;){if(Array.isArray(r))for(let n of r)e.push(n);else e.push(r);r=this._statement()}let i=null;return this._match(We.keywords.continuing)&&(i=this._compound_statement()),this._consume(We.tokens.brace_right,"Expected '}' for loop."),new bR(e,i)}_switch_statement(){if(!this._match(We.keywords.switch))return null;let e=this._optional_paren_expression();this._consume(We.tokens.brace_left,"Expected '{' for switch.");let r=this._switch_body();if(r==null||r.length==0)throw this._error(this._previous(),"Expected 'case' or 'default'.");return this._consume(We.tokens.brace_right,"Expected '}' for switch."),new wR(e,r)}_switch_body(){let e=[];if(this._match(We.keywords.case)){let r=this._case_selectors();this._match(We.tokens.colon),this._consume(We.tokens.brace_left,"Exected '{' for switch case.");let i=this._case_body();this._consume(We.tokens.brace_right,"Exected '}' for switch case."),e.push(new FR(r,i))}if(this._match(We.keywords.default)){this._match(We.tokens.colon),this._consume(We.tokens.brace_left,"Exected '{' for switch default.");let r=this._case_body();this._consume(We.tokens.brace_right,"Exected '}' for switch default."),e.push(new NR(r))}if(this._check([We.keywords.default,We.keywords.case])){let r=this._switch_body();e.push(r[0])}return e}_case_selectors(){var e,r,i,n;let o=[(r=(e=this._shift_expression())===null||e===void 0?void 0:e.evaluate(this._context).toString())!==null&&r!==void 0?r:""];for(;this._match(We.tokens.comma);)o.push((n=(i=this._shift_expression())===null||i===void 0?void 0:i.evaluate(this._context).toString())!==null&&n!==void 0?n:"");return o}_case_body(){if(this._match(We.keywords.fallthrough))return this._consume(We.tokens.semicolon,"Expected ';'"),[];let e=this._statement();if(e==null)return[];e instanceof Array||(e=[e]);let r=this._case_body();return r.length==0?e:[...e,r[0]]}_if_statement(){if(!this._match(We.keywords.if))return null;let e=this._optional_paren_expression(),r=this._compound_statement(),i=[];this._match_elseif()&&(i=this._elseif_statement(i));let n=null;return this._match(We.keywords.else)&&(n=this._compound_statement()),new TR(e,r,i,n)}_match_elseif(){return this._tokens[this._current].type===We.keywords.else&&this._tokens[this._current+1].type===We.keywords.if?(this._advance(),this._advance(),!0):!1}_elseif_statement(e=[]){let r=this._optional_paren_expression(),i=this._compound_statement();return e.push(new UR(r,i)),this._match_elseif()&&this._elseif_statement(e),e}_return_statement(){if(!this._match(We.keywords.return))return null;let e=this._short_circuit_or_expression();return new ER(e)}_short_circuit_or_expression(){let e=this._short_circuit_and_expr();for(;this._match(We.tokens.or_or);)e=new Pu(this._previous().toString(),e,this._short_circuit_and_expr());return e}_short_circuit_and_expr(){let e=this._inclusive_or_expression();for(;this._match(We.tokens.and_and);)e=new Pu(this._previous().toString(),e,this._inclusive_or_expression());return e}_inclusive_or_expression(){let e=this._exclusive_or_expression();for(;this._match(We.tokens.or);)e=new Pu(this._previous().toString(),e,this._exclusive_or_expression());return e}_exclusive_or_expression(){let e=this._and_expression();for(;this._match(We.tokens.xor);)e=new Pu(this._previous().toString(),e,this._and_expression());return e}_and_expression(){let e=this._equality_expression();for(;this._match(We.tokens.and);)e=new Pu(this._previous().toString(),e,this._equality_expression());return e}_equality_expression(){let e=this._relational_expression();return this._match([We.tokens.equal_equal,We.tokens.not_equal])?new Pu(this._previous().toString(),e,this._relational_expression()):e}_relational_expression(){let e=this._shift_expression();for(;this._match([We.tokens.less_than,We.tokens.greater_than,We.tokens.less_than_equal,We.tokens.greater_than_equal]);)e=new Pu(this._previous().toString(),e,this._shift_expression());return e}_shift_expression(){let e=this._additive_expression();for(;this._match([We.tokens.shift_left,We.tokens.shift_right]);)e=new Pu(this._previous().toString(),e,this._additive_expression());return e}_additive_expression(){let e=this._multiplicative_expression();for(;this._match([We.tokens.plus,We.tokens.minus]);)e=new Pu(this._previous().toString(),e,this._multiplicative_expression());return e}_multiplicative_expression(){let e=this._unary_expression();for(;this._match([We.tokens.star,We.tokens.forward_slash,We.tokens.modulo]);)e=new Pu(this._previous().toString(),e,this._unary_expression());return e}_unary_expression(){return this._match([We.tokens.minus,We.tokens.bang,We.tokens.tilde,We.tokens.star,We.tokens.and])?new LR(this._previous().toString(),this._unary_expression()):this._singular_expression()}_singular_expression(){let e=this._primary_expression(),r=this._postfix_expression();return r&&(e.postfix=r),e}_postfix_expression(){if(this._match(We.tokens.bracket_left)){let e=this._short_circuit_or_expression();this._consume(We.tokens.bracket_right,"Expected ']'.");let r=this._postfix_expression();return r&&(e.postfix=r),e}if(this._match(We.tokens.period)){let e=this._consume(We.tokens.ident,"Expected member name."),r=this._postfix_expression(),i=new IT(e.lexeme);return r&&(i.postfix=r),i}return null}_getStruct(e){return this._context.aliases.has(e)?this._context.aliases.get(e).type:this._context.structs.has(e)?this._context.structs.get(e):null}_primary_expression(){if(this._match(We.tokens.ident)){let i=this._previous().toString();if(this._check(We.tokens.paren_left)){let n=this._argument_expression_list(),o=this._getStruct(i);return o!=null?new lm(o,n):new RR(i,n)}if(this._context.constants.has(i)){let n=this._context.constants.get(i);return new PT(i,n.value)}return new BR(i)}if(this._match(We.const_literal))return new RT(parseFloat(this._previous().toString()));if(this._check(We.tokens.paren_left))return this._paren_expression();if(this._match(We.keywords.bitcast)){this._consume(We.tokens.less_than,"Expected '<'.");let i=this._type_decl();this._consume(We.tokens.greater_than,"Expected '>'.");let n=this._paren_expression();return new OR(i,n)}let e=this._type_decl(),r=this._argument_expression_list();return new DR(e,r)}_argument_expression_list(){if(!this._match(We.tokens.paren_left))return null;let e=[];do{if(this._check(We.tokens.paren_right))break;let r=this._short_circuit_or_expression();e.push(r)}while(this._match(We.tokens.comma));return this._consume(We.tokens.paren_right,"Expected ')' for agument list"),e}_optional_paren_expression(){this._match(We.tokens.paren_left);let e=this._short_circuit_or_expression();return this._match(We.tokens.paren_right),new BT([e])}_paren_expression(){this._consume(We.tokens.paren_left,"Expected '('.");let e=this._short_circuit_or_expression();return this._consume(We.tokens.paren_right,"Expected ')'."),new BT([e])}_struct_decl(){if(!this._match(We.keywords.struct))return null;let e=this._consume(We.tokens.ident,"Expected name for struct.").toString();this._consume(We.tokens.brace_left,"Expected '{' for struct body.");let r=[];for(;!this._check(We.tokens.brace_right);){let n=this._attribute(),o=this._consume(We.tokens.ident,"Expected variable name.").toString();this._consume(We.tokens.colon,"Expected ':' for struct member type.");let s=this._attribute(),l=this._type_decl();l!=null&&(l.attributes=s),this._check(We.tokens.brace_right)?this._match(We.tokens.comma):this._consume(We.tokens.comma,"Expected ',' for struct member."),r.push(new zR(o,l,n))}this._consume(We.tokens.brace_right,"Expected '}' after struct body.");let i=new gd(e,r);return this._context.structs.set(e,i),i}_global_variable_decl(){let e=this._variable_decl();return e&&this._match(We.tokens.equal)&&(e.value=this._const_expression()),e}_override_variable_decl(){let e=this._override_decl();return e&&this._match(We.tokens.equal)&&(e.value=this._const_expression()),e}_global_const_decl(){if(!this._match(We.keywords.const))return null;let e=this._consume(We.tokens.ident,"Expected variable name"),r=null;if(this._match(We.tokens.colon)){let o=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=o)}let i=null;if(this._match(We.tokens.equal)){let o=this._short_circuit_or_expression();if(o instanceof lm)i=o;else if(o instanceof PT&&o.initializer instanceof lm)i=o.initializer;else try{let s=o.evaluate(this._context);i=new RT(s)}catch{i=o}}let n=new ET(e.toString(),r,"","",i);return this._context.constants.set(n.name,n),n}_global_let_decl(){if(!this._match(We.keywords.let))return null;let e=this._consume(We.tokens.ident,"Expected variable name"),r=null;if(this._match(We.tokens.colon)){let n=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=n)}let i=null;return this._match(We.tokens.equal)&&(i=this._const_expression()),new TT(e.toString(),r,"","",i)}_const_expression(){if(this._match(We.const_literal))return new IT(this._previous().toString());let e=this._type_decl();this._consume(We.tokens.paren_left,"Expected '('.");let r=[];for(;!this._check(We.tokens.paren_right)&&(r.push(this._const_expression()),!!this._check(We.tokens.comma));)this._advance();return this._consume(We.tokens.paren_right,"Expected ')'."),new lm(e,r)}_variable_decl(){if(!this._match(We.keywords.var))return null;let e="",r="";this._match(We.tokens.less_than)&&(e=this._consume(We.storage_class,"Expected storage_class.").toString(),this._match(We.tokens.comma)&&(r=this._consume(We.access_mode,"Expected access_mode.").toString()),this._consume(We.tokens.greater_than,"Expected '>'."));let i=this._consume(We.tokens.ident,"Expected variable name"),n=null;if(this._match(We.tokens.colon)){let o=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=o)}return new Bp(i.toString(),n,e,r,null)}_override_decl(){if(!this._match(We.keywords.override))return null;let e=this._consume(We.tokens.ident,"Expected variable name"),r=null;if(this._match(We.tokens.colon)){let i=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=i)}return new wT(e.toString(),r,null)}_enable_directive(){let e=this._consume(We.tokens.ident,"identity expected.");return new SR(e.toString())}_type_alias(){let e=this._consume(We.tokens.ident,"identity expected.");this._consume(We.tokens.equal,"Expected '=' for type alias.");let r=this._type_decl();if(r===null)throw this._error(this._peek(),"Expected Type for Alias.");this._context.aliases.has(r.name)&&(r=this._context.aliases.get(r.name).type);let i=new ST(e.toString(),r);return this._context.aliases.set(i.name,i),i}_type_decl(){if(this._check([We.tokens.ident,...We.texel_format,We.keywords.bool,We.keywords.f32,We.keywords.i32,We.keywords.u32])){let i=this._advance(),n=i.toString();return this._context.structs.has(n)?this._context.structs.get(n):this._context.aliases.has(n)?this._context.aliases.get(n).type:new yd(i.toString())}let e=this._texture_sampler_types();if(e)return e;if(this._check(We.template_types)){let i=this._advance().toString(),n=null,o=null;return this._match(We.tokens.less_than)&&(n=this._type_decl(),o=null,this._match(We.tokens.comma)&&(o=this._consume(We.access_mode,"Expected access_mode for pointer").toString()),this._consume(We.tokens.greater_than,"Expected '>' for type.")),new CT(i,n,o)}if(this._match(We.keywords.ptr)){let i=this._previous().toString();this._consume(We.tokens.less_than,"Expected '<' for pointer.");let n=this._consume(We.storage_class,"Expected storage_class for pointer");this._consume(We.tokens.comma,"Expected ',' for pointer.");let o=this._type_decl(),s=null;return this._match(We.tokens.comma)&&(s=this._consume(We.access_mode,"Expected access_mode for pointer").toString()),this._consume(We.tokens.greater_than,"Expected '>' for pointer."),new PR(i,n.toString(),o,s)}let r=this._attribute();if(this._match(We.keywords.array)){let i=null,n=-1,o=this._previous();if(this._match(We.tokens.less_than)){i=this._type_decl(),this._context.aliases.has(i.name)&&(i=this._context.aliases.get(i.name).type);let s="";this._match(We.tokens.comma)&&(s=this._shift_expression().evaluate(this._context).toString()),this._consume(We.tokens.greater_than,"Expected '>' for array."),n=s?parseInt(s):0}return new MT(o.toString(),r,i,n)}return null}_texture_sampler_types(){if(this._match(We.sampler_type))return new am(this._previous().toString(),null,null);if(this._match(We.depth_texture_type))return new am(this._previous().toString(),null,null);if(this._match(We.sampled_texture_type)||this._match(We.multisampled_texture_type)){let e=this._previous();this._consume(We.tokens.less_than,"Expected '<' for sampler type.");let r=this._type_decl();return this._consume(We.tokens.greater_than,"Expected '>' for sampler type."),new am(e.toString(),r,null)}if(this._match(We.storage_texture_type)){let e=this._previous();this._consume(We.tokens.less_than,"Expected '<' for sampler type.");let r=this._consume(We.texel_format,"Invalid texel format.").toString();this._consume(We.tokens.comma,"Expected ',' after texel format.");let i=this._consume(We.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(We.tokens.greater_than,"Expected '>' for sampler type."),new am(e.toString(),r,i)}return null}_attribute(){let e=[];for(;this._match(We.tokens.attr);){let r=this._consume(We.attribute_name,"Expected attribute name"),i=new LT(r.toString(),null);if(this._match(We.tokens.paren_left)){if(i.value=this._consume(We.literal_or_ident,"Expected attribute value").toString(),this._check(We.tokens.comma)){this._advance();do{let n=this._consume(We.literal_or_ident,"Expected attribute value").toString();i.value instanceof Array||(i.value=[i.value]),i.value.push(n)}while(this._match(We.tokens.comma))}this._consume(We.tokens.paren_right,"Expected ')'")}e.push(i)}for(;this._match(We.tokens.attr_left);){if(!this._check(We.tokens.attr_right))do{let r=this._consume(We.attribute_name,"Expected attribute name"),i=new LT(r.toString(),null);if(this._match(We.tokens.paren_left)){if(i.value=[this._consume(We.literal_or_ident,"Expected attribute value").toString()],this._check(We.tokens.comma)){this._advance();do{let n=this._consume(We.literal_or_ident,"Expected attribute value").toString();i.value.push(n)}while(this._match(We.tokens.comma))}this._consume(We.tokens.paren_right,"Expected ')'")}e.push(i)}while(this._match(We.tokens.comma));this._consume(We.tokens.attr_right,"Expected ']]' after attribute declarations")}return e.length==0?null:e}},Op=class{constructor(e,r){this.name=e,this.attributes=r,this.size=0}get isArray(){return!1}get isStruct(){return!1}get isTemplate(){return!1}},NT=class{constructor(e,r,i){this.name=e,this.type=r,this.attributes=i,this.offset=0,this.size=0}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}},q0=class extends Op{constructor(e,r){super(e,r),this.members=[],this.align=0}get isStruct(){return!0}},Sx=class extends Op{constructor(e,r){super(e,r),this.count=0,this.stride=0}get isArray(){return!0}},kT=class extends Op{constructor(e,r,i,n){super(e,i),this.format=r,this.access=n}get isTemplate(){return!0}},Rp;(function(t){t[t.Uniform=0]="Uniform",t[t.Storage=1]="Storage",t[t.Texture=2]="Texture",t[t.Sampler=3]="Sampler",t[t.StorageTexture=4]="StorageTexture"})(Rp||(Rp={}));var X0=class{constructor(e,r,i,n,o,s,l){this.name=e,this.type=r,this.group=i,this.binding=n,this.attributes=o,this.resourceType=s,this.access=l}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get size(){return this.type.size}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}},jR=class{constructor(e,r){this.name=e,this.type=r}},Y0=class{constructor(e,r){this.align=e,this.size=r}},GR=class{constructor(e,r,i,n){this.name=e,this.type=r,this.locationType=i,this.location=n,this.interpolation=null}},UT=class{constructor(e,r,i,n){this.name=e,this.type=r,this.locationType=i,this.location=n}},WR=class{constructor(e,r=null){this.stage=null,this.inputs=[],this.outputs=[],this.name=e,this.stage=r}},qR=class{constructor(){this.vertex=[],this.fragment=[],this.compute=[]}},XR=class{constructor(e,r,i,n){this.name=e,this.type=r,this.attributes=i,this.id=n}},Ru=class{constructor(e){this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new qR,this._types=new Map,e&&this.update(e)}_isStorageTexture(e){return e.name=="texture_storage_1d"||e.name=="texture_storage_2d"||e.name=="texture_storage_2d_array"||e.name=="texture_storage_3d"}update(e){let i=new HR().parse(e);for(let n of i){if(n instanceof gd){let o=this._getTypeInfo(n,null);o instanceof q0&&this.structs.push(o);continue}if(n instanceof ST){this.aliases.push(this._getAliasInfo(n));continue}if(n instanceof wT){let o=n,s=this._getAttributeNum(o.attributes,"id",0),l=o.type!=null?this._getTypeInfo(o.type,o.attributes):null;this.overrides.push(new XR(o.name,l,o.attributes,s));continue}if(this._isUniformVar(n)){let o=n,s=this._getAttributeNum(o.attributes,"group",0),l=this._getAttributeNum(o.attributes,"binding",0),u=this._getTypeInfo(o.type,o.attributes),h=new X0(o.name,u,s,l,o.attributes,Rp.Uniform,o.access);this.uniforms.push(h);continue}if(this._isStorageVar(n)){let o=n,s=this._getAttributeNum(o.attributes,"group",0),l=this._getAttributeNum(o.attributes,"binding",0),u=this._getTypeInfo(o.type,o.attributes),h=this._isStorageTexture(u),v=new X0(o.name,u,s,l,o.attributes,h?Rp.StorageTexture:Rp.Storage,o.access);this.storage.push(v);continue}if(this._isTextureVar(n)){let o=n,s=this._getAttributeNum(o.attributes,"group",0),l=this._getAttributeNum(o.attributes,"binding",0),u=this._getTypeInfo(o.type,o.attributes),h=this._isStorageTexture(u),v=new X0(o.name,u,s,l,o.attributes,h?Rp.StorageTexture:Rp.Texture,o.access);h?this.storage.push(v):this.textures.push(v);continue}if(this._isSamplerVar(n)){let o=n,s=this._getAttributeNum(o.attributes,"group",0),l=this._getAttributeNum(o.attributes,"binding",0),u=this._getTypeInfo(o.type,o.attributes),h=new X0(o.name,u,s,l,o.attributes,Rp.Sampler,o.access);this.samplers.push(h);continue}if(n instanceof bT){let o=this._getAttribute(n,"vertex"),s=this._getAttribute(n,"fragment"),l=this._getAttribute(n,"compute"),u=o||s||l;if(u){let h=new WR(n.name,u.name);h.inputs=this._getInputs(n.args),h.outputs=this._getOutputs(n.returnType),this.entry[u.name].push(h)}continue}}}getBindGroups(){let e=[];function r(i,n){i>=e.length&&(e.length=i+1),e[i]===void 0&&(e[i]=[]),n>=e[i].length&&(e[i].length=n+1)}for(let i of this.uniforms){r(i.group,i.binding);let n=e[i.group];n[i.binding]=i}for(let i of this.storage){r(i.group,i.binding);let n=e[i.group];n[i.binding]=i}for(let i of this.textures){r(i.group,i.binding);let n=e[i.group];n[i.binding]=i}for(let i of this.samplers){r(i.group,i.binding);let n=e[i.group];n[i.binding]=i}return e}_getOutputs(e,r=void 0){if(r===void 0&&(r=[]),e instanceof gd)this._getStructOutputs(e,r);else{let i=this._getOutputInfo(e);i!==null&&r.push(i)}return r}_getStructOutputs(e,r){for(let i of e.members)if(i.type instanceof gd)this._getStructOutputs(i.type,r);else{let n=this._getAttribute(i,"location")||this._getAttribute(i,"builtin");if(n!==null){let o=this._getTypeInfo(i.type,i.type.attributes),s=this._parseInt(n.value),l=new UT(i.name,o,n.name,s);r.push(l)}}}_getOutputInfo(e){let r=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(r!==null){let i=this._getTypeInfo(e,e.attributes),n=this._parseInt(r.value);return new UT("",i,r.name,n)}return null}_getInputs(e,r=void 0){r===void 0&&(r=[]);for(let i of e)if(i.type instanceof gd)this._getStructInputs(i.type,r);else{let n=this._getInputInfo(i);n!==null&&r.push(n)}return r}_getStructInputs(e,r){for(let i of e.members)if(i.type instanceof gd)this._getStructInputs(i.type,r);else{let n=this._getInputInfo(i);n!==null&&r.push(n)}}_getInputInfo(e){let r=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(r!==null){let i=this._getAttribute(e,"interpolation"),n=this._getTypeInfo(e.type,e.attributes),o=this._parseInt(r.value),s=new GR(e.name,n,r.name,o);return i!==null&&(s.interpolation=this._parseString(i.value)),s}return null}_parseString(e){return e instanceof Array&&(e=e[0]),e}_parseInt(e){e instanceof Array&&(e=e[0]);let r=parseInt(e);return isNaN(r)?e:r}_getAlias(e){for(let r of this.aliases)if(r.name==e)return r.type;return null}_getAliasInfo(e){return new jR(e.name,this._getTypeInfo(e.type,null))}_getTypeInfo(e,r){if(this._types.has(e))return this._types.get(e);if(e instanceof MT){let n=e,o=this._getTypeInfo(n.format,n.attributes),s=new Sx(n.name,r);return s.format=o,s.count=n.count,this._types.set(e,s),this._updateTypeInfo(s),s}if(e instanceof gd){let n=e,o=new q0(n.name,r);for(let s of n.members){let l=this._getTypeInfo(s.type,s.attributes);o.members.push(new NT(s.name,l,s.attributes))}return this._types.set(e,o),this._updateTypeInfo(o),o}if(e instanceof am){let n=e,o=n.format instanceof yd,s=n.format?o?this._getTypeInfo(n.format,null):new Op(n.format,null):null,l=new kT(n.name,s,r,n.access);return this._types.set(e,l),this._updateTypeInfo(l),l}if(e instanceof CT){let n=e,o=n.format?this._getTypeInfo(n.format,null):null,s=new kT(n.name,o,r,n.access);return this._types.set(e,s),this._updateTypeInfo(s),s}let i=new Op(e.name,r);return this._types.set(e,i),this._updateTypeInfo(i),i}_updateTypeInfo(e){var r,i;let n=this._getTypeSize(e);if(e.size=(r=n?.size)!==null&&r!==void 0?r:0,e instanceof Sx){let o=this._getTypeSize(e.format);e.stride=(i=o?.size)!==null&&i!==void 0?i:0,this._updateTypeInfo(e.format)}e instanceof q0&&this._updateStructInfo(e)}_updateStructInfo(e){var r;let i=0,n=0,o=0,s=0;for(let l=0,u=e.members.length;l<u;++l){let h=e.members[l],v=this._getTypeSize(h);if(!v)continue;(r=this._getAlias(h.type.name))!==null&&r!==void 0||h.type;let T=v.align,E=v.size;i=this._roundUp(T,i+n),n=E,o=i,s=Math.max(s,T),h.offset=i,h.size=E,this._updateTypeInfo(h.type)}e.size=this._roundUp(s,o+n),e.align=s}_getTypeSize(e){var r;if(e==null)return null;let i=this._getAttributeNum(e.attributes,"size",0),n=this._getAttributeNum(e.attributes,"align",0);if(e instanceof NT&&(e=e.type),e instanceof Op){let o=this._getAlias(e.name);o!==null&&(e=o)}{let o=Ru._typeInfo[e.name];if(o!==void 0){let s=e.format==="f16"?2:1;return new Y0(Math.max(n,o.align/s),Math.max(i,o.size/s))}}{let o=Ru._typeInfo[e.name.substring(0,e.name.length-1)];if(o){let s=e.name[e.name.length-1]==="h"?2:1;return new Y0(Math.max(n,o.align/s),Math.max(i,o.size/s))}}if(e instanceof Sx){let o=e,s=8,l=8,u=this._getTypeSize(o.format);u!==null&&(l=u.size,s=u.align);let h=o.count,v=this._getAttributeNum((r=e?.attributes)!==null&&r!==void 0?r:null,"stride",this._roundUp(s,l));return l=h*v,i&&(l=i),new Y0(Math.max(n,s),Math.max(i,l))}if(e instanceof q0){let o=0,s=0,l=0,u=0,h=0;for(let v of e.members){let T=this._getTypeSize(v.type);T!==null&&(o=Math.max(T.align,o),l=this._roundUp(T.align,l+u),u=T.size,h=l)}return s=this._roundUp(o,h+u),new Y0(Math.max(n,o),Math.max(i,s))}return null}_isUniformVar(e){return e instanceof Bp&&e.storage=="uniform"}_isStorageVar(e){return e instanceof Bp&&e.storage=="storage"}_isTextureVar(e){return e instanceof Bp&&e.type!==null&&Ru._textureTypes.indexOf(e.type.name)!=-1}_isSamplerVar(e){return e instanceof Bp&&e.type!==null&&Ru._samplerTypes.indexOf(e.type.name)!=-1}_getAttribute(e,r){let i=e;if(!i||!i.attributes)return null;let n=i.attributes;for(let o of n)if(o.name==r)return o;return null}_getAttributeNum(e,r,i){if(e===null)return i;for(let n of e)if(n.name==r){let o=n!==null&&n.value!==null?n.value:i;return o instanceof Array&&(o=o[0]),typeof o=="number"?o:typeof o=="string"?parseInt(o):i}return i}_roundUp(e,r){return Math.ceil(r/e)*e}};Ru._typeInfo={f16:{align:2,size:2},i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},atomic:{align:4,size:4},vec2:{align:8,size:8},vec3:{align:16,size:12},vec4:{align:16,size:16},mat2x2:{align:8,size:16},mat3x2:{align:8,size:24},mat4x2:{align:8,size:32},mat2x3:{align:16,size:32},mat3x3:{align:16,size:48},mat4x3:{align:16,size:64},mat2x4:{align:16,size:32},mat3x4:{align:16,size:48},mat4x4:{align:16,size:64}};Ru._textureTypes=We.any_texture_type.map(t=>t.name);Ru._samplerTypes=We.sampler_type.map(t=>t.name);function YR(t){let e={attributes:[],bindings:[]},r;try{r=_se(t)}catch(o){return Kt.error(o.message)(),e}for(let o of r.uniforms){let s=[];for(let l of o.type.members)s.push({name:l.name,type:X5(l.type)});e.bindings.push({type:"uniform",name:o.name,location:o.binding,group:o.group,members:s})}let i=r.entry.vertex[0],n=i?.inputs.length||0;for(let o=0;o<n;o++){let s=i.inputs[o];if(s.locationType==="location"){let l=X5(s.type);e.attributes.push({name:s.name,location:s.location,type:l})}}return e}function X5(t){return t.format?`${t.name}<${t.format.name}>`:t.name}function _se(t){try{return new Ru(t)}catch(e){if(e instanceof Error)throw e;let r="WGSL parse error";throw typeof e=="object"&&e?.message&&(r+=`: ${e.message} `),typeof e=="object"&&e?.token&&(r+=e.token.line||""),new Error(r,{cause:e})}}var yse=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
const float TWO_PI = 6.2831854820251465;
const float PI_2 = 1.5707963705062866;
const float PI_16 = 0.1963495463132858;
const float SIN_TABLE_0 = 0.19509032368659973;
const float SIN_TABLE_1 = 0.3826834261417389;
const float SIN_TABLE_2 = 0.5555702447891235;
const float SIN_TABLE_3 = 0.7071067690849304;
const float COS_TABLE_0 = 0.9807852506637573;
const float COS_TABLE_1 = 0.9238795042037964;
const float COS_TABLE_2 = 0.8314695954322815;
const float COS_TABLE_3 = 0.7071067690849304;
const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;
const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;
const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;
const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;
float sin_taylor_fp32(float a) {
float r, s, t, x;
if (a == 0.0) {
return 0.0;
}
x = -a * a;
s = a;
r = a;
r = r * x;
t = r * INVERSE_FACTORIAL_3;
s = s + t;
r = r * x;
t = r * INVERSE_FACTORIAL_5;
s = s + t;
r = r * x;
t = r * INVERSE_FACTORIAL_7;
s = s + t;
r = r * x;
t = r * INVERSE_FACTORIAL_9;
s = s + t;
return s;
}
void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {
if (a == 0.0) {
sin_t = 0.0;
cos_t = 1.0;
}
sin_t = sin_taylor_fp32(a);
cos_t = sqrt(1.0 - sin_t * sin_t);
}
float tan_taylor_fp32(float a) {
float sin_a;
float cos_a;
if (a == 0.0) {
return 0.0;
}
float z = floor(a / TWO_PI);
float r = a - TWO_PI * z;
float t;
float q = floor(r / PI_2 + 0.5);
int j = int(q);
if (j < -2 || j > 2) {
return 1.0 / 0.0;
}
t = r - PI_2 * q;
q = floor(t / PI_16 + 0.5);
int k = int(q);
int abs_k = int(abs(float(k)));
if (abs_k > 4) {
return 1.0 / 0.0;
} else {
t = t - PI_16 * q;
}
float u = 0.0;
float v = 0.0;
float sin_t, cos_t;
float s, c;
sincos_taylor_fp32(t, sin_t, cos_t);
if (k == 0) {
s = sin_t;
c = cos_t;
} else {
if (abs(float(abs_k) - 1.0) < 0.5) {
u = COS_TABLE_0;
v = SIN_TABLE_0;
} else if (abs(float(abs_k) - 2.0) < 0.5) {
u = COS_TABLE_1;
v = SIN_TABLE_1;
} else if (abs(float(abs_k) - 3.0) < 0.5) {
u = COS_TABLE_2;
v = SIN_TABLE_2;
} else if (abs(float(abs_k) - 4.0) < 0.5) {
u = COS_TABLE_3;
v = SIN_TABLE_3;
}
if (k > 0) {
s = u * sin_t + v * cos_t;
c = u * cos_t - v * sin_t;
} else {
s = u * sin_t - v * cos_t;
c = u * cos_t + v * sin_t;
}
}
if (j == 0) {
sin_a = s;
cos_a = c;
} else if (j == 1) {
sin_a = c;
cos_a = -s;
} else if (j == -1) {
sin_a = -c;
cos_a = s;
} else {
sin_a = -s;
cos_a = -c;
}
return sin_a / cos_a;
}
#endif
float tan_fp32(float a) {
#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
return tan_taylor_fp32(a);
#else
return tan(a);
#endif
}
`,KR={name:"fp32",vs:yse};var vse=new Float32Array([0,1,1,1]),xse=`uniform pickingUniforms {
float isActive;
float isAttribute;
float isHighlightActive;
float useFloatColors;
vec3 highlightedObjectColor;
vec4 highlightColor;
} picking;
out vec4 picking_vRGBcolor_Avalid;
vec3 picking_normalizeColor(vec3 color) {
return picking.useFloatColors > 0.5 ? color : color / 255.0;
}
vec4 picking_normalizeColor(vec4 color) {
return picking.useFloatColors > 0.5 ? color : color / 255.0;
}
bool picking_isColorZero(vec3 color) {
return dot(color, vec3(1.0)) < 0.00001;
}
bool picking_isColorValid(vec3 color) {
return dot(color, vec3(1.0)) > 0.00001;
}
bool isVertexHighlighted(vec3 vertexColor) {
vec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
return
bool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor));
}
void picking_setPickingColor(vec3 pickingColor) {
pickingColor = picking_normalizeColor(pickingColor);
if (bool(picking.isActive)) {
picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));
if (!bool(picking.isAttribute)) {
picking_vRGBcolor_Avalid.rgb = pickingColor;
}
} else {
picking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor));
}
}
void picking_setPickingAttribute(float value) {
if (bool(picking.isAttribute)) {
picking_vRGBcolor_Avalid.r = value;
}
}
void picking_setPickingAttribute(vec2 value) {
if (bool(picking.isAttribute)) {
picking_vRGBcolor_Avalid.rg = value;
}
}
void picking_setPickingAttribute(vec3 value) {
if (bool(picking.isAttribute)) {
picking_vRGBcolor_Avalid.rgb = value;
}
}
`,bse=`uniform pickingUniforms {
float isActive;
float isAttribute;
float isHighlightActive;
float useFloatColors;
vec3 highlightedObjectColor;
vec4 highlightColor;
} picking;
in vec4 picking_vRGBcolor_Avalid;
vec4 picking_filterHighlightColor(vec4 color) {
if (picking.isActive > 0.5) {
return color;
}
bool selected = bool(picking_vRGBcolor_Avalid.a);
if (selected) {
float highLightAlpha = picking.highlightColor.a;
float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);
float highLightRatio = highLightAlpha / blendedAlpha;
vec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio);
return vec4(blendedRGB, blendedAlpha);
} else {
return color;
}
}
vec4 picking_filterPickingColor(vec4 color) {
if (bool(picking.isActive)) {
if (picking_vRGBcolor_Avalid.a == 0.0) {
discard;
}
return picking_vRGBcolor_Avalid;
}
return color;
}
vec4 picking_filterColor(vec4 color) {
vec4 highlightColor = picking_filterHighlightColor(color);
return picking_filterPickingColor(highlightColor);
}
`,zT={name:"picking",vs:xse,fs:bse,uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useFloatColors:"f32",highlightedObjectColor:"vec3<f32>",highlightColor:"vec4<f32>"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useFloatColors:!0,highlightedObjectColor:new Float32Array([0,0,0]),highlightColor:vse},getUniforms:wse};function wse(t={},e){let r={};if(t.highlightedObjectColor!==void 0)if(t.highlightedObjectColor===null)r.isHighlightActive=!1;else{r.isHighlightActive=!0;let i=t.highlightedObjectColor.slice(0,3);r.highlightedObjectColor=i}if(t.highlightColor){let i=Array.from(t.highlightColor,n=>n/255);Number.isFinite(i[3])||(i[3]=1),r.highlightColor=i}return t.isActive!==void 0&&(r.isActive=Boolean(t.isActive),r.isAttribute=Boolean(t.isAttribute)),t.useFloatColors!==void 0&&(r.useFloatColors=Boolean(t.useFloatColors)),r}function ZR(t,e=[],r=0){let i=Math.fround(t),n=t-i;return e[r]=i,e[r+1]=n,e}function Y5(t){return t-Math.fround(t)}function K5(t){let e=new Float32Array(32);for(let r=0;r<4;++r)for(let i=0;i<4;++i){let n=r*4+i;ZR(t[i*4+r],e,n*2)}return e}var Z5=`uniform float ONE;
vec2 split(float a) {
const float SPLIT = 4097.0;
float t = a * SPLIT;
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
float a_hi = t * ONE - (t - a);
float a_lo = a * ONE - a_hi;
#else
float a_hi = t - (t - a);
float a_lo = a - a_hi;
#endif
return vec2(a_hi, a_lo);
}
vec2 split2(vec2 a) {
vec2 b = split(a.x);
b.y += a.y;
return b;
}
vec2 quickTwoSum(float a, float b) {
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
float sum = (a + b) * ONE;
float err = b - (sum - a) * ONE;
#else
float sum = a + b;
float err = b - (sum - a);
#endif
return vec2(sum, err);
}
vec2 twoSum(float a, float b) {
float s = (a + b);
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
float v = (s * ONE - a) * ONE;
float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);
#else
float v = s - a;
float err = (a - (s - v)) + (b - v);
#endif
return vec2(s, err);
}
vec2 twoSub(float a, float b) {
float s = (a - b);
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
float v = (s * ONE - a) * ONE;
float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);
#else
float v = s - a;
float err = (a - (s - v)) - (b + v);
#endif
return vec2(s, err);
}
vec2 twoSqr(float a) {
float prod = a * a;
vec2 a_fp64 = split(a);
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *
a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;
#else
float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;
#endif
return vec2(prod, err);
}
vec2 twoProd(float a, float b) {
float prod = a * b;
vec2 a_fp64 = split(a);
vec2 b_fp64 = split(b);
float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +
a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;
return vec2(prod, err);
}
vec2 sum_fp64(vec2 a, vec2 b) {
vec2 s, t;
s = twoSum(a.x, b.x);
t = twoSum(a.y, b.y);
s.y += t.x;
s = quickTwoSum(s.x, s.y);
s.y += t.y;
s = quickTwoSum(s.x, s.y);
return s;
}
vec2 sub_fp64(vec2 a, vec2 b) {
vec2 s, t;
s = twoSub(a.x, b.x);
t = twoSub(a.y, b.y);
s.y += t.x;
s = quickTwoSum(s.x, s.y);
s.y += t.y;
s = quickTwoSum(s.x, s.y);
return s;
}
vec2 mul_fp64(vec2 a, vec2 b) {
vec2 prod = twoProd(a.x, b.x);
prod.y += a.x * b.y;
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
prod = split2(prod);
#endif
prod = quickTwoSum(prod.x, prod.y);
prod.y += a.y * b.x;
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
prod = split2(prod);
#endif
prod = quickTwoSum(prod.x, prod.y);
return prod;
}
vec2 div_fp64(vec2 a, vec2 b) {
float xn = 1.0 / b.x;
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
vec2 yn = mul_fp64(a, vec2(xn, 0));
#else
vec2 yn = a * xn;
#endif
float diff = (sub_fp64(a, mul_fp64(b, yn))).x;
vec2 prod = twoProd(xn, diff);
return sum_fp64(yn, prod);
}
vec2 sqrt_fp64(vec2 a) {
if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);
if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);
float x = 1.0 / sqrt(a.x);
float yn = a.x * x;
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
vec2 yn_sqr = twoSqr(yn) * ONE;
#else
vec2 yn_sqr = twoSqr(yn);
#endif
float diff = sub_fp64(a, yn_sqr).x;
vec2 prod = twoProd(x * 0.5, diff);
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
return sum_fp64(split(yn), prod);
#else
return sum_fp64(vec2(yn, 0.0), prod);
#endif
}
`;var Tse={ONE:1};function Ese(){return Tse}var Dp={name:"fp64-arithmetic",vs:Z5,getUniforms:Ese,fp64ify:ZR,fp64LowPart:Y5,fp64ifyMatrix4:K5};var Sse=1/Math.PI*180,Cse=1/180*Math.PI,Mse={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Mse}};var Do=globalThis.mathgl.config;function Mx(t,{precision:e=Do.precision}={}){return t=Ise(t),`${parseFloat(t.toPrecision(e))}`}function Jc(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function JR(t){return cm(t)}function QR(t){return va(t)}function cm(t,e){return $R(t,r=>r*Cse,e)}function va(t,e){return $R(t,r=>r*Sse,e)}function Zn(t,e,r){return $R(t,i=>Math.max(e,Math.min(r,i)))}function Oa(t,e,r){return Jc(t)?t.map((i,n)=>Oa(i,e[n],r)):r*e+(1-r)*t}function Cs(t,e,r){let i=Do.EPSILON;r&&(Do.EPSILON=r);try{if(t===e)return!0;if(Jc(t)&&Jc(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!Cs(t[n],e[n]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=Do.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{Do.EPSILON=i}}function Ise(t){return Math.round(t/Do.EPSILON)*Do.EPSILON}function Pse(t){return t.clone?t.clone():new Array(t.length)}function $R(t,e,r){if(Jc(t)){let i=t;r=r||Pse(i);for(let n=0;n<r.length&&n<i.length;++n){let o=typeof t=="number"?t:t[n];r[n]=e(o,n,r)}return r}return e(t)}var Lp=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=e[i+r];return this.check()}toArray(e=[],r=0){for(let i=0;i<this.ELEMENTS;++i)e[r+i]=this[i];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:Jc(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Do)}formatString(e){let r="";for(let i=0;i<this.ELEMENTS;++i)r+=(i>0?", ":"")+Mx(this[i],e);return`${e.printTypes?this.constructor.name:""}[${r}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Cs(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,i){if(i===void 0)return this.lerp(this,e,r);for(let n=0;n<this.ELEMENTS;++n){let o=e[n],s=typeof r=="number"?r:r[n];this[n]=o+i*(s-o)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],e[i]),r[i]);return this.check()}add(...e){for(let r of e)for(let i=0;i<this.ELEMENTS;++i)this[i]+=r[i];return this.check()}subtract(...e){for(let r of e)for(let i=0;i<this.ELEMENTS;++i)this[i]-=r[i];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(Do.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],e),r);return this.check()}get elements(){return this}};function Rse(t,e){if(t.length!==e)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}function jn(t){if(!Number.isFinite(t))throw new Error(`Invalid number ${JSON.stringify(t)}`);return t}function Fp(t,e,r=""){if(Do.debug&&!Rse(t,e))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return t}function Ja(t,e){if(!t)throw new Error(`math.gl assertion ${e}`)}var Np=class extends Lp{get x(){return this[0]}set x(e){this[0]=jn(e)}get y(){return this[1]}set y(e){this[1]=jn(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*this[r];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let r=0;for(let i=0;i<this.ELEMENTS;++i){let n=this[i]-e[i];r+=n*n}return jn(r)}dot(e){let r=0;for(let i=0;i<this.ELEMENTS;++i)r+=this[i]*e[i];return jn(r)}normalize(){let e=this.magnitude();if(e!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=e;return this.check()}multiply(...e){for(let r of e)for(let i=0;i<this.ELEMENTS;++i)this[i]*=r[i];return this.check()}divide(...e){for(let r of e)for(let i=0;i<this.ELEMENTS;++i)this[i]/=r[i];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return Ja(e>=0&&e<this.ELEMENTS,"index is out of range"),jn(this[e])}setComponent(e,r){return Ja(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=r,this.check()}addVectors(e,r){return this.copy(e).add(r)}subVectors(e,r){return this.copy(e).subtract(r)}multiplyVectors(e,r){return this.copy(e).multiply(r)}addScaledVector(e,r){return this.add(new this.constructor(e).multiplyScalar(r))}};var xa={};As(xa,{add:()=>Fse,angle:()=>Qse,ceil:()=>Nse,clone:()=>Bse,copy:()=>Dse,create:()=>J5,cross:()=>Yse,dist:()=>aae,distance:()=>t8,div:()=>sae,divide:()=>e8,dot:()=>Xse,equals:()=>rae,exactEquals:()=>tae,floor:()=>kse,forEach:()=>uae,fromValues:()=>Ose,inverse:()=>Wse,len:()=>iae,length:()=>i8,lerp:()=>Kse,max:()=>zse,min:()=>Use,mul:()=>oae,multiply:()=>$5,negate:()=>Gse,normalize:()=>qse,random:()=>Zse,rotate:()=>Jse,round:()=>Vse,scale:()=>Hse,scaleAndAdd:()=>jse,set:()=>Lse,sqrDist:()=>lae,sqrLen:()=>cae,squaredDistance:()=>r8,squaredLength:()=>n8,str:()=>eae,sub:()=>nae,subtract:()=>Q5,transformMat2:()=>eB,transformMat2d:()=>tB,transformMat3:()=>Ix,transformMat4:()=>Px,zero:()=>$se});var Go=typeof Float32Array<"u"?Float32Array:Array,Ch=Math.random;function Ou(t){return t>=0?Math.round(t):t%.5===0?Math.floor(t):Math.round(t)}var j6e=Math.PI/180;function J5(){let t=new Go(2);return Go!=Float32Array&&(t[0]=0,t[1]=0),t}function Bse(t){let e=new Go(2);return e[0]=t[0],e[1]=t[1],e}function Ose(t,e){let r=new Go(2);return r[0]=t,r[1]=e,r}function Dse(t,e){return t[0]=e[0],t[1]=e[1],t}function Lse(t,e,r){return t[0]=e,t[1]=r,t}function Fse(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function Q5(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function $5(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function e8(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function Nse(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function kse(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function Use(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function zse(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function Vse(t,e){return t[0]=Ou(e[0]),t[1]=Ou(e[1]),t}function Hse(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function jse(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t}function t8(t,e){let r=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(r*r+i*i)}function r8(t,e){let r=e[0]-t[0],i=e[1]-t[1];return r*r+i*i}function i8(t){let e=t[0],r=t[1];return Math.sqrt(e*e+r*r)}function n8(t){let e=t[0],r=t[1];return e*e+r*r}function Gse(t,e){return t[0]=-e[0],t[1]=-e[1],t}function Wse(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function qse(t,e){let r=e[0],i=e[1],n=r*r+i*i;return n>0&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n,t}function Xse(t,e){return t[0]*e[0]+t[1]*e[1]}function Yse(t,e,r){let i=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=i,t}function Kse(t,e,r,i){let n=e[0],o=e[1];return t[0]=n+i*(r[0]-n),t[1]=o+i*(r[1]-o),t}function Zse(t,e){e=e===void 0?1:e;let r=Ch()*2*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function eB(t,e,r){let i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n,t[1]=r[1]*i+r[3]*n,t}function tB(t,e,r){let i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n+r[4],t[1]=r[1]*i+r[3]*n+r[5],t}function Ix(t,e,r){let i=e[0],n=e[1];return t[0]=r[0]*i+r[3]*n+r[6],t[1]=r[1]*i+r[4]*n+r[7],t}function Px(t,e,r){let i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t}function Jse(t,e,r,i){let n=e[0]-r[0],o=e[1]-r[1],s=Math.sin(i),l=Math.cos(i);return t[0]=n*l-o*s+r[0],t[1]=n*s+o*l+r[1],t}function Qse(t,e){let r=t[0],i=t[1],n=e[0],o=e[1],s=Math.sqrt((r*r+i*i)*(n*n+o*o)),l=s&&(r*n+i*o)/s;return Math.acos(Math.min(Math.max(l,-1),1))}function $se(t){return t[0]=0,t[1]=0,t}function eae(t){return`vec2(${t[0]}, ${t[1]})`}function tae(t,e){return t[0]===e[0]&&t[1]===e[1]}function rae(t,e){let r=t[0],i=t[1],n=e[0],o=e[1];return Math.abs(r-n)<=1e-6*Math.max(1,Math.abs(r),Math.abs(n))&&Math.abs(i-o)<=1e-6*Math.max(1,Math.abs(i),Math.abs(o))}var iae=i8,nae=Q5,oae=$5,sae=e8,aae=t8,lae=r8,cae=n8,uae=function(){let t=J5();return function(e,r,i,n,o,s){let l,u;for(r||(r=2),i||(i=0),n?u=Math.min(n*r+i,e.length):u=e.length,l=i;l<u;l+=r)t[0]=e[l],t[1]=e[l+1],o(t,t,s),e[l]=t[0],e[l+1]=t[1];return e}}();function VT(t,e,r){let i=e[0],n=e[1],o=r[3]*i+r[7]*n||1;return t[0]=(r[0]*i+r[4]*n)/o,t[1]=(r[1]*i+r[5]*n)/o,t}function HT(t,e,r){let i=e[0],n=e[1],o=e[2],s=r[3]*i+r[7]*n+r[11]*o||1;return t[0]=(r[0]*i+r[4]*n+r[8]*o)/s,t[1]=(r[1]*i+r[5]*n+r[9]*o)/s,t[2]=(r[2]*i+r[6]*n+r[10]*o)/s,t}function o8(t,e,r){let i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n,t[1]=r[1]*i+r[3]*n,t[2]=e[2],t}function s8(t,e,r){let i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n,t[1]=r[1]*i+r[3]*n,t[2]=e[2],t[3]=e[3],t}function jT(t,e,r){let i=e[0],n=e[1],o=e[2];return t[0]=r[0]*i+r[3]*n+r[6]*o,t[1]=r[1]*i+r[4]*n+r[7]*o,t[2]=r[2]*i+r[5]*n+r[8]*o,t[3]=e[3],t}var _f=class extends Np{constructor(e=0,r=0){super(2),Jc(e)&&arguments.length===1?this.copy(e):(Do.debug&&(jn(e),jn(r)),this[0]=e,this[1]=r)}set(e,r){return this[0]=e,this[1]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this.check()}fromObject(e){return Do.debug&&(jn(e.x),jn(e.y)),this[0]=e.x,this[1]=e.y,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Px(this,this,e),this.check()}transformAsVector(e){return VT(this,this,e),this.check()}transformByMatrix3(e){return Ix(this,this,e),this.check()}transformByMatrix2x3(e){return tB(this,this,e),this.check()}transformByMatrix2(e){return eB(this,this,e),this.check()}};var Da={};As(Da,{add:()=>pae,angle:()=>sB,bezier:()=>Cae,ceil:()=>Aae,clone:()=>fae,copy:()=>hae,create:()=>GT,cross:()=>um,dist:()=>Fae,distance:()=>u8,div:()=>Lae,divide:()=>c8,dot:()=>Rx,equals:()=>Bae,exactEquals:()=>Rae,floor:()=>mae,forEach:()=>Uae,fromValues:()=>qT,hermite:()=>Sae,inverse:()=>wae,len:()=>aB,length:()=>WT,lerp:()=>Tae,max:()=>_ae,min:()=>gae,mul:()=>Dae,multiply:()=>l8,negate:()=>bae,normalize:()=>rB,random:()=>Mae,rotateX:()=>iB,rotateY:()=>nB,rotateZ:()=>oB,round:()=>yae,scale:()=>vae,scaleAndAdd:()=>xae,set:()=>dae,slerp:()=>Eae,sqrDist:()=>Nae,sqrLen:()=>kae,squaredDistance:()=>f8,squaredLength:()=>h8,str:()=>Pae,sub:()=>Oae,subtract:()=>a8,transformMat3:()=>Bx,transformMat4:()=>fm,transformQuat:()=>Ox,zero:()=>Iae});function GT(){let t=new Go(3);return Go!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function fae(t){let e=new Go(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function WT(t){let e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function qT(t,e,r){let i=new Go(3);return i[0]=t,i[1]=e,i[2]=r,i}function hae(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function dae(t,e,r,i){return t[0]=e,t[1]=r,t[2]=i,t}function pae(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function a8(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function l8(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function c8(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function Aae(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function mae(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function gae(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function _ae(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function yae(t,e){return t[0]=Ou(e[0]),t[1]=Ou(e[1]),t[2]=Ou(e[2]),t}function vae(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function xae(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t}function u8(t,e){let r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2];return Math.sqrt(r*r+i*i+n*n)}function f8(t,e){let r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2];return r*r+i*i+n*n}function h8(t){let e=t[0],r=t[1],i=t[2];return e*e+r*r+i*i}function bae(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function wae(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function rB(t,e){let r=e[0],i=e[1],n=e[2],o=r*r+i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function Rx(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function um(t,e,r){let i=e[0],n=e[1],o=e[2],s=r[0],l=r[1],u=r[2];return t[0]=n*u-o*l,t[1]=o*s-i*u,t[2]=i*l-n*s,t}function Tae(t,e,r,i){let n=e[0],o=e[1],s=e[2];return t[0]=n+i*(r[0]-n),t[1]=o+i*(r[1]-o),t[2]=s+i*(r[2]-s),t}function Eae(t,e,r,i){let n=Math.acos(Math.min(Math.max(Rx(e,r),-1),1)),o=Math.sin(n),s=Math.sin((1-i)*n)/o,l=Math.sin(i*n)/o;return t[0]=s*e[0]+l*r[0],t[1]=s*e[1]+l*r[1],t[2]=s*e[2]+l*r[2],t}function Sae(t,e,r,i,n,o){let s=o*o,l=s*(2*o-3)+1,u=s*(o-2)+o,h=s*(o-1),v=s*(3-2*o);return t[0]=e[0]*l+r[0]*u+i[0]*h+n[0]*v,t[1]=e[1]*l+r[1]*u+i[1]*h+n[1]*v,t[2]=e[2]*l+r[2]*u+i[2]*h+n[2]*v,t}function Cae(t,e,r,i,n,o){let s=1-o,l=s*s,u=o*o,h=l*s,v=3*o*l,T=3*u*s,E=u*o;return t[0]=e[0]*h+r[0]*v+i[0]*T+n[0]*E,t[1]=e[1]*h+r[1]*v+i[1]*T+n[1]*E,t[2]=e[2]*h+r[2]*v+i[2]*T+n[2]*E,t}function Mae(t,e){e=e===void 0?1:e;let r=Ch()*2*Math.PI,i=Ch()*2-1,n=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*n,t[1]=Math.sin(r)*n,t[2]=i*e,t}function fm(t,e,r){let i=e[0],n=e[1],o=e[2],s=r[3]*i+r[7]*n+r[11]*o+r[15];return s=s||1,t[0]=(r[0]*i+r[4]*n+r[8]*o+r[12])/s,t[1]=(r[1]*i+r[5]*n+r[9]*o+r[13])/s,t[2]=(r[2]*i+r[6]*n+r[10]*o+r[14])/s,t}function Bx(t,e,r){let i=e[0],n=e[1],o=e[2];return t[0]=i*r[0]+n*r[3]+o*r[6],t[1]=i*r[1]+n*r[4]+o*r[7],t[2]=i*r[2]+n*r[5]+o*r[8],t}function Ox(t,e,r){let i=r[0],n=r[1],o=r[2],s=r[3],l=e[0],u=e[1],h=e[2],v=n*h-o*u,T=o*l-i*h,E=i*u-n*l,M=n*E-o*T,O=o*v-i*E,F=i*T-n*v,z=s*2;return v*=z,T*=z,E*=z,M*=2,O*=2,F*=2,t[0]=l+v+M,t[1]=u+T+O,t[2]=h+E+F,t}function iB(t,e,r,i){let n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[0],o[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),o[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function nB(t,e,r,i){let n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),o[1]=n[1],o[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function oB(t,e,r,i){let n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),o[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),o[2]=n[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function sB(t,e){let r=t[0],i=t[1],n=t[2],o=e[0],s=e[1],l=e[2],u=Math.sqrt((r*r+i*i+n*n)*(o*o+s*s+l*l)),h=u&&Rx(t,e)/u;return Math.acos(Math.min(Math.max(h,-1),1))}function Iae(t){return t[0]=0,t[1]=0,t[2]=0,t}function Pae(t){return`vec3(${t[0]}, ${t[1]}, ${t[2]})`}function Rae(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function Bae(t,e){let r=t[0],i=t[1],n=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=1e-6*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))}var Oae=a8,Dae=l8,Lae=c8,Fae=u8,Nae=f8,aB=WT,kae=h8,Uae=function(){let t=GT();return function(e,r,i,n,o,s){let l,u;for(r||(r=3),i||(i=0),n?u=Math.min(n*r+i,e.length):u=e.length,l=i;l<u;l+=r)t[0]=e[l],t[1]=e[l+1],t[2]=e[l+2],o(t,t,s),e[l]=t[0],e[l+1]=t[1],e[l+2]=t[2];return e}}();var lB=[0,0,0],XT,ot=class extends Np{static get ZERO(){return XT||(XT=new ot(0,0,0),Object.freeze(XT)),XT}constructor(e=0,r=0,i=0){super(-0,-0,-0),arguments.length===1&&Jc(e)?this.copy(e):(Do.debug&&(jn(e),jn(r),jn(i)),this[0]=e,this[1]=r,this[2]=i)}set(e,r,i){return this[0]=e,this[1]=r,this[2]=i,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return Do.debug&&(jn(e.x),jn(e.y),jn(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=jn(e)}angle(e){return sB(this,e)}cross(e){return um(this,this,e),this.check()}rotateX({radians:e,origin:r=lB}){return iB(this,this,r,e),this.check()}rotateY({radians:e,origin:r=lB}){return nB(this,this,r,e),this.check()}rotateZ({radians:e,origin:r=lB}){return oB(this,this,r,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return fm(this,this,e),this.check()}transformAsVector(e){return HT(this,this,e),this.check()}transformByMatrix3(e){return Bx(this,this,e),this.check()}transformByMatrix2(e){return o8(this,this,e),this.check()}transformByQuaternion(e){return Ox(this,this,e),this.check()}};var YT,J0=class extends Np{static get ZERO(){return YT||(YT=new J0(0,0,0,0),Object.freeze(YT)),YT}constructor(e=0,r=0,i=0,n=0){super(-0,-0,-0,-0),Jc(e)&&arguments.length===1?this.copy(e):(Do.debug&&(jn(e),jn(r),jn(i),jn(n)),this[0]=e,this[1]=r,this[2]=i,this[3]=n)}set(e,r,i,n){return this[0]=e,this[1]=r,this[2]=i,this[3]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return Do.debug&&(jn(e.x),jn(e.y),jn(e.z),jn(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=jn(e)}get w(){return this[3]}set w(e){this[3]=jn(e)}transform(e){return fm(this,this,e),this.check()}transformByMatrix3(e){return jT(this,this,e),this.check()}transformByMatrix2(e){return s8(this,this,e),this.check()}transformByQuaternion(e){return Ox(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}};var Q0=class extends Lp{toString(){let e="[";if(Do.printRowMajor){e+="row-major:";for(let r=0;r<this.RANK;++r)for(let i=0;i<this.RANK;++i)e+=` ${this[i*this.RANK+r]}`}else{e+="column-major:";for(let r=0;r<this.ELEMENTS;++r)e+=` ${this[r]}`}return e+="]",e}getElementIndex(e,r){return r*this.RANK+e}getElement(e,r){return this[r*this.RANK+e]}setElement(e,r,i){return this[r*this.RANK+e]=jn(i),this}getColumn(e,r=new Array(this.RANK).fill(-0)){let i=e*this.RANK;for(let n=0;n<this.RANK;++n)r[n]=this[i+n];return r}setColumn(e,r){let i=e*this.RANK;for(let n=0;n<this.RANK;++n)this[i+n]=r[n];return this}};function d8(){let t=new Go(9);return Go!=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}function p8(t,e){if(t===e){let r=e[1],i=e[2],n=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=i,t[7]=n}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}function A8(t,e){let r=e[0],i=e[1],n=e[2],o=e[3],s=e[4],l=e[5],u=e[6],h=e[7],v=e[8],T=v*s-l*h,E=-v*o+l*u,M=h*o-s*u,O=r*T+i*E+n*M;return O?(O=1/O,t[0]=T*O,t[1]=(-v*i+n*h)*O,t[2]=(l*i-n*s)*O,t[3]=E*O,t[4]=(v*r-n*u)*O,t[5]=(-l*r+n*o)*O,t[6]=M*O,t[7]=(-h*r+i*u)*O,t[8]=(s*r-i*o)*O,t):null}function m8(t){let e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8];return e*(h*o-s*u)+r*(-h*n+s*l)+i*(u*n-o*l)}function cB(t,e,r){let i=e[0],n=e[1],o=e[2],s=e[3],l=e[4],u=e[5],h=e[6],v=e[7],T=e[8],E=r[0],M=r[1],O=r[2],F=r[3],z=r[4],W=r[5],J=r[6],K=r[7],ne=r[8];return t[0]=E*i+M*s+O*h,t[1]=E*n+M*l+O*v,t[2]=E*o+M*u+O*T,t[3]=F*i+z*s+W*h,t[4]=F*n+z*l+W*v,t[5]=F*o+z*u+W*T,t[6]=J*i+K*s+ne*h,t[7]=J*n+K*l+ne*v,t[8]=J*o+K*u+ne*T,t}function g8(t,e,r){let i=e[0],n=e[1],o=e[2],s=e[3],l=e[4],u=e[5],h=e[6],v=e[7],T=e[8],E=r[0],M=r[1];return t[0]=i,t[1]=n,t[2]=o,t[3]=s,t[4]=l,t[5]=u,t[6]=E*i+M*s+h,t[7]=E*n+M*l+v,t[8]=E*o+M*u+T,t}function _8(t,e,r){let i=e[0],n=e[1],o=e[2],s=e[3],l=e[4],u=e[5],h=e[6],v=e[7],T=e[8],E=Math.sin(r),M=Math.cos(r);return t[0]=M*i+E*s,t[1]=M*n+E*l,t[2]=M*o+E*u,t[3]=M*s-E*i,t[4]=M*l-E*n,t[5]=M*u-E*o,t[6]=h,t[7]=v,t[8]=T,t}function uB(t,e,r){let i=r[0],n=r[1];return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function y8(t,e){let r=e[0],i=e[1],n=e[2],o=e[3],s=r+r,l=i+i,u=n+n,h=r*s,v=i*s,T=i*l,E=n*s,M=n*l,O=n*u,F=o*s,z=o*l,W=o*u;return t[0]=1-T-O,t[3]=v-W,t[6]=E+z,t[1]=v+W,t[4]=1-h-O,t[7]=M-F,t[2]=E-z,t[5]=M+F,t[8]=1-h-T,t}var fB;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL1ROW0=3]="COL1ROW0",t[t.COL1ROW1=4]="COL1ROW1",t[t.COL1ROW2=5]="COL1ROW2",t[t.COL2ROW0=6]="COL2ROW0",t[t.COL2ROW1=7]="COL2ROW1",t[t.COL2ROW2=8]="COL2ROW2"})(fB||(fB={}));var Vae=Object.freeze([1,0,0,0,1,0,0,0,1]),mo=class extends Q0{static get IDENTITY(){return jae()}static get ZERO(){return Hae()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return fB}constructor(e,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):r.length>0?this.copy([e,...r]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(Vae)}fromObject(e){return this.check()}fromQuaternion(e){return y8(this,e),this.check()}set(e,r,i,n,o,s,l,u,h){return this[0]=e,this[1]=r,this[2]=i,this[3]=n,this[4]=o,this[5]=s,this[6]=l,this[7]=u,this[8]=h,this.check()}setRowMajor(e,r,i,n,o,s,l,u,h){return this[0]=e,this[1]=n,this[2]=l,this[3]=r,this[4]=o,this[5]=u,this[6]=i,this[7]=s,this[8]=h,this.check()}determinant(){return m8(this)}transpose(){return p8(this,this),this.check()}invert(){return A8(this,this),this.check()}multiplyLeft(e){return cB(this,e,this),this.check()}multiplyRight(e){return cB(this,this,e),this.check()}rotate(e){return _8(this,this,e),this.check()}scale(e){return Array.isArray(e)?uB(this,this,e):uB(this,this,[e,e]),this.check()}translate(e){return g8(this,this,e),this.check()}transform(e,r){let i;switch(e.length){case 2:i=Ix(r||[-0,-0],e,this);break;case 3:i=Bx(r||[-0,-0,-0],e,this);break;case 4:i=jT(r||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Fp(i,e.length),i}transformVector(e,r){return this.transform(e,r)}transformVector2(e,r){return this.transform(e,r)}transformVector3(e,r){return this.transform(e,r)}},KT,ZT=null;function Hae(){return KT||(KT=new mo([0,0,0,0,0,0,0,0,0]),Object.freeze(KT)),KT}function jae(){return ZT||(ZT=new mo,Object.freeze(ZT)),ZT}var Zs={};As(Zs,{add:()=>ple,adjoint:()=>Kae,clone:()=>Wae,copy:()=>qae,create:()=>Gae,decompose:()=>ole,determinant:()=>pB,equals:()=>_le,exactEquals:()=>gle,frob:()=>dle,fromQuat:()=>xB,fromQuat2:()=>rle,fromRotation:()=>Qae,fromRotationTranslation:()=>x8,fromRotationTranslationScale:()=>sle,fromRotationTranslationScaleOrigin:()=>ale,fromScaling:()=>Jae,fromTranslation:()=>Zae,fromValues:()=>Xae,fromXRotation:()=>$ae,fromYRotation:()=>ele,fromZRotation:()=>tle,frustum:()=>bB,getRotation:()=>nle,getScaling:()=>b8,getTranslation:()=>ile,identity:()=>v8,invert:()=>dB,lookAt:()=>EB,mul:()=>yle,multiply:()=>Dx,multiplyScalar:()=>Ale,multiplyScalarAndAdd:()=>mle,ortho:()=>TB,orthoNO:()=>T8,orthoZO:()=>ule,perspective:()=>wB,perspectiveFromFieldOfView:()=>cle,perspectiveNO:()=>w8,perspectiveZO:()=>lle,rotate:()=>gB,rotateX:()=>_B,rotateY:()=>yB,rotateZ:()=>vB,scale:()=>mB,set:()=>Yae,str:()=>hle,sub:()=>vle,subtract:()=>E8,targetTo:()=>fle,translate:()=>AB,transpose:()=>hB});function Gae(){let t=new Go(16);return Go!=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}function Wae(t){let e=new Go(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}function qae(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}function Xae(t,e,r,i,n,o,s,l,u,h,v,T,E,M,O,F){let z=new Go(16);return z[0]=t,z[1]=e,z[2]=r,z[3]=i,z[4]=n,z[5]=o,z[6]=s,z[7]=l,z[8]=u,z[9]=h,z[10]=v,z[11]=T,z[12]=E,z[13]=M,z[14]=O,z[15]=F,z}function Yae(t,e,r,i,n,o,s,l,u,h,v,T,E,M,O,F,z){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t[4]=o,t[5]=s,t[6]=l,t[7]=u,t[8]=h,t[9]=v,t[10]=T,t[11]=E,t[12]=M,t[13]=O,t[14]=F,t[15]=z,t}function v8(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 hB(t,e){if(t===e){let r=e[1],i=e[2],n=e[3],o=e[6],s=e[7],l=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=o,t[11]=e[14],t[12]=n,t[13]=s,t[14]=l}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}function dB(t,e){let r=e[0],i=e[1],n=e[2],o=e[3],s=e[4],l=e[5],u=e[6],h=e[7],v=e[8],T=e[9],E=e[10],M=e[11],O=e[12],F=e[13],z=e[14],W=e[15],J=r*l-i*s,K=r*u-n*s,ne=r*h-o*s,ge=i*u-n*l,j=i*h-o*l,me=n*h-o*u,fe=v*F-T*O,$=v*z-E*O,Z=v*W-M*O,we=T*z-E*F,Oe=T*W-M*F,he=E*W-M*z,Le=J*he-K*Oe+ne*we+ge*Z-j*$+me*fe;return Le?(Le=1/Le,t[0]=(l*he-u*Oe+h*we)*Le,t[1]=(n*Oe-i*he-o*we)*Le,t[2]=(F*me-z*j+W*ge)*Le,t[3]=(E*j-T*me-M*ge)*Le,t[4]=(u*Z-s*he-h*$)*Le,t[5]=(r*he-n*Z+o*$)*Le,t[6]=(z*ne-O*me-W*K)*Le,t[7]=(v*me-E*ne+M*K)*Le,t[8]=(s*Oe-l*Z+h*fe)*Le,t[9]=(i*Z-r*Oe-o*fe)*Le,t[10]=(O*j-F*ne+W*J)*Le,t[11]=(T*ne-v*j-M*J)*Le,t[12]=(l*$-s*we-u*fe)*Le,t[13]=(r*we-i*$+n*fe)*Le,t[14]=(F*K-O*ge-z*J)*Le,t[15]=(v*ge-T*K+E*J)*Le,t):null}function Kae(t,e){let r=e[0],i=e[1],n=e[2],o=e[3],s=e[4],l=e[5],u=e[6],h=e[7],v=e[8],T=e[9],E=e[10],M=e[11],O=e[12],F=e[13],z=e[14],W=e[15],J=r*l-i*s,K=r*u-n*s,ne=r*h-o*s,ge=i*u-n*l,j=i*h-o*l,me=n*h-o*u,fe=v*F-T*O,$=v*z-E*O,Z=v*W-M*O,we=T*z-E*F,Oe=T*W-M*F,he=E*W-M*z;return t[0]=l*he-u*Oe+h*we,t[1]=n*Oe-i*he-o*we,t[2]=F*me-z*j+W*ge,t[3]=E*j-T*me-M*ge,t[4]=u*Z-s*he-h*$,t[5]=r*he-n*Z+o*$,t[6]=z*ne-O*me-W*K,t[7]=v*me-E*ne+M*K,t[8]=s*Oe-l*Z+h*fe,t[9]=i*Z-r*Oe-o*fe,t[10]=O*j-F*ne+W*J,t[11]=T*ne-v*j-M*J,t[12]=l*$-s*we-u*fe,t[13]=r*we-i*$+n*fe,t[14]=F*K-O*ge-z*J,t[15]=v*ge-T*K+E*J,t}function pB(t){let e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],v=t[9],T=t[10],E=t[11],M=t[12],O=t[13],F=t[14],z=t[15],W=e*s-r*o,J=e*l-i*o,K=r*l-i*s,ne=h*O-v*M,ge=h*F-T*M,j=v*F-T*O,me=e*j-r*ge+i*ne,fe=o*j-s*ge+l*ne,$=h*K-v*J+T*W,Z=M*K-O*J+F*W;return u*me-n*fe+z*$-E*Z}function Dx(t,e,r){let i=e[0],n=e[1],o=e[2],s=e[3],l=e[4],u=e[5],h=e[6],v=e[7],T=e[8],E=e[9],M=e[10],O=e[11],F=e[12],z=e[13],W=e[14],J=e[15],K=r[0],ne=r[1],ge=r[2],j=r[3];return t[0]=K*i+ne*l+ge*T+j*F,t[1]=K*n+ne*u+ge*E+j*z,t[2]=K*o+ne*h+ge*M+j*W,t[3]=K*s+ne*v+ge*O+j*J,K=r[4],ne=r[5],ge=r[6],j=r[7],t[4]=K*i+ne*l+ge*T+j*F,t[5]=K*n+ne*u+ge*E+j*z,t[6]=K*o+ne*h+ge*M+j*W,t[7]=K*s+ne*v+ge*O+j*J,K=r[8],ne=r[9],ge=r[10],j=r[11],t[8]=K*i+ne*l+ge*T+j*F,t[9]=K*n+ne*u+ge*E+j*z,t[10]=K*o+ne*h+ge*M+j*W,t[11]=K*s+ne*v+ge*O+j*J,K=r[12],ne=r[13],ge=r[14],j=r[15],t[12]=K*i+ne*l+ge*T+j*F,t[13]=K*n+ne*u+ge*E+j*z,t[14]=K*o+ne*h+ge*M+j*W,t[15]=K*s+ne*v+ge*O+j*J,t}function AB(t,e,r){let i=r[0],n=r[1],o=r[2],s,l,u,h,v,T,E,M,O,F,z,W;return e===t?(t[12]=e[0]*i+e[4]*n+e[8]*o+e[12],t[13]=e[1]*i+e[5]*n+e[9]*o+e[13],t[14]=e[2]*i+e[6]*n+e[10]*o+e[14],t[15]=e[3]*i+e[7]*n+e[11]*o+e[15]):(s=e[0],l=e[1],u=e[2],h=e[3],v=e[4],T=e[5],E=e[6],M=e[7],O=e[8],F=e[9],z=e[10],W=e[11],t[0]=s,t[1]=l,t[2]=u,t[3]=h,t[4]=v,t[5]=T,t[6]=E,t[7]=M,t[8]=O,t[9]=F,t[10]=z,t[11]=W,t[12]=s*i+v*n+O*o+e[12],t[13]=l*i+T*n+F*o+e[13],t[14]=u*i+E*n+z*o+e[14],t[15]=h*i+M*n+W*o+e[15]),t}function mB(t,e,r){let i=r[0],n=r[1],o=r[2];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]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function gB(t,e,r,i){let n=i[0],o=i[1],s=i[2],l=Math.sqrt(n*n+o*o+s*s),u,h,v,T,E,M,O,F,z,W,J,K,ne,ge,j,me,fe,$,Z,we,Oe,he,Le,ft;return l<1e-6?null:(l=1/l,n*=l,o*=l,s*=l,h=Math.sin(r),u=Math.cos(r),v=1-u,T=e[0],E=e[1],M=e[2],O=e[3],F=e[4],z=e[5],W=e[6],J=e[7],K=e[8],ne=e[9],ge=e[10],j=e[11],me=n*n*v+u,fe=o*n*v+s*h,$=s*n*v-o*h,Z=n*o*v-s*h,we=o*o*v+u,Oe=s*o*v+n*h,he=n*s*v+o*h,Le=o*s*v-n*h,ft=s*s*v+u,t[0]=T*me+F*fe+K*$,t[1]=E*me+z*fe+ne*$,t[2]=M*me+W*fe+ge*$,t[3]=O*me+J*fe+j*$,t[4]=T*Z+F*we+K*Oe,t[5]=E*Z+z*we+ne*Oe,t[6]=M*Z+W*we+ge*Oe,t[7]=O*Z+J*we+j*Oe,t[8]=T*he+F*Le+K*ft,t[9]=E*he+z*Le+ne*ft,t[10]=M*he+W*Le+ge*ft,t[11]=O*he+J*Le+j*ft,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function _B(t,e,r){let i=Math.sin(r),n=Math.cos(r),o=e[4],s=e[5],l=e[6],u=e[7],h=e[8],v=e[9],T=e[10],E=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+h*i,t[5]=s*n+v*i,t[6]=l*n+T*i,t[7]=u*n+E*i,t[8]=h*n-o*i,t[9]=v*n-s*i,t[10]=T*n-l*i,t[11]=E*n-u*i,t}function yB(t,e,r){let i=Math.sin(r),n=Math.cos(r),o=e[0],s=e[1],l=e[2],u=e[3],h=e[8],v=e[9],T=e[10],E=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n-h*i,t[1]=s*n-v*i,t[2]=l*n-T*i,t[3]=u*n-E*i,t[8]=o*i+h*n,t[9]=s*i+v*n,t[10]=l*i+T*n,t[11]=u*i+E*n,t}function vB(t,e,r){let i=Math.sin(r),n=Math.cos(r),o=e[0],s=e[1],l=e[2],u=e[3],h=e[4],v=e[5],T=e[6],E=e[7];return e!==t&&(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[0]=o*n+h*i,t[1]=s*n+v*i,t[2]=l*n+T*i,t[3]=u*n+E*i,t[4]=h*n-o*i,t[5]=v*n-s*i,t[6]=T*n-l*i,t[7]=E*n-u*i,t}function Zae(t,e){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]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function Jae(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Qae(t,e,r){let i=r[0],n=r[1],o=r[2],s=Math.sqrt(i*i+n*n+o*o),l,u,h;return s<1e-6?null:(s=1/s,i*=s,n*=s,o*=s,u=Math.sin(e),l=Math.cos(e),h=1-l,t[0]=i*i*h+l,t[1]=n*i*h+o*u,t[2]=o*i*h-n*u,t[3]=0,t[4]=i*n*h-o*u,t[5]=n*n*h+l,t[6]=o*n*h+i*u,t[7]=0,t[8]=i*o*h+n*u,t[9]=n*o*h-i*u,t[10]=o*o*h+l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function $ae(t,e){let r=Math.sin(e),i=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ele(t,e){let r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function tle(t,e){let r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=i,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 x8(t,e,r){let i=e[0],n=e[1],o=e[2],s=e[3],l=i+i,u=n+n,h=o+o,v=i*l,T=i*u,E=i*h,M=n*u,O=n*h,F=o*h,z=s*l,W=s*u,J=s*h;return t[0]=1-(M+F),t[1]=T+J,t[2]=E-W,t[3]=0,t[4]=T-J,t[5]=1-(v+F),t[6]=O+z,t[7]=0,t[8]=E+W,t[9]=O-z,t[10]=1-(v+M),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function rle(t,e){let r=new Go(3),i=-e[0],n=-e[1],o=-e[2],s=e[3],l=e[4],u=e[5],h=e[6],v=e[7],T=i*i+n*n+o*o+s*s;return T>0?(r[0]=(l*s+v*i+u*o-h*n)*2/T,r[1]=(u*s+v*n+h*i-l*o)*2/T,r[2]=(h*s+v*o+l*n-u*i)*2/T):(r[0]=(l*s+v*i+u*o-h*n)*2,r[1]=(u*s+v*n+h*i-l*o)*2,r[2]=(h*s+v*o+l*n-u*i)*2),x8(t,e,r),t}function ile(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function b8(t,e){let r=e[0],i=e[1],n=e[2],o=e[4],s=e[5],l=e[6],u=e[8],h=e[9],v=e[10];return t[0]=Math.sqrt(r*r+i*i+n*n),t[1]=Math.sqrt(o*o+s*s+l*l),t[2]=Math.sqrt(u*u+h*h+v*v),t}function nle(t,e){let r=new Go(3);b8(r,e);let i=1/r[0],n=1/r[1],o=1/r[2],s=e[0]*i,l=e[1]*n,u=e[2]*o,h=e[4]*i,v=e[5]*n,T=e[6]*o,E=e[8]*i,M=e[9]*n,O=e[10]*o,F=s+v+O,z=0;return F>0?(z=Math.sqrt(F+1)*2,t[3]=.25*z,t[0]=(T-M)/z,t[1]=(E-u)/z,t[2]=(l-h)/z):s>v&&s>O?(z=Math.sqrt(1+s-v-O)*2,t[3]=(T-M)/z,t[0]=.25*z,t[1]=(l+h)/z,t[2]=(E+u)/z):v>O?(z=Math.sqrt(1+v-s-O)*2,t[3]=(E-u)/z,t[0]=(l+h)/z,t[1]=.25*z,t[2]=(T+M)/z):(z=Math.sqrt(1+O-s-v)*2,t[3]=(l-h)/z,t[0]=(E+u)/z,t[1]=(T+M)/z,t[2]=.25*z),t}function ole(t,e,r,i){e[0]=i[12],e[1]=i[13],e[2]=i[14];let n=i[0],o=i[1],s=i[2],l=i[4],u=i[5],h=i[6],v=i[8],T=i[9],E=i[10];r[0]=Math.sqrt(n*n+o*o+s*s),r[1]=Math.sqrt(l*l+u*u+h*h),r[2]=Math.sqrt(v*v+T*T+E*E);let M=1/r[0],O=1/r[1],F=1/r[2],z=n*M,W=o*O,J=s*F,K=l*M,ne=u*O,ge=h*F,j=v*M,me=T*O,fe=E*F,$=z+ne+fe,Z=0;return $>0?(Z=Math.sqrt($+1)*2,t[3]=.25*Z,t[0]=(ge-me)/Z,t[1]=(j-J)/Z,t[2]=(W-K)/Z):z>ne&&z>fe?(Z=Math.sqrt(1+z-ne-fe)*2,t[3]=(ge-me)/Z,t[0]=.25*Z,t[1]=(W+K)/Z,t[2]=(j+J)/Z):ne>fe?(Z=Math.sqrt(1+ne-z-fe)*2,t[3]=(j-J)/Z,t[0]=(W+K)/Z,t[1]=.25*Z,t[2]=(ge+me)/Z):(Z=Math.sqrt(1+fe-z-ne)*2,t[3]=(W-K)/Z,t[0]=(j+J)/Z,t[1]=(ge+me)/Z,t[2]=.25*Z),t}function sle(t,e,r,i){let n=e[0],o=e[1],s=e[2],l=e[3],u=n+n,h=o+o,v=s+s,T=n*u,E=n*h,M=n*v,O=o*h,F=o*v,z=s*v,W=l*u,J=l*h,K=l*v,ne=i[0],ge=i[1],j=i[2];return t[0]=(1-(O+z))*ne,t[1]=(E+K)*ne,t[2]=(M-J)*ne,t[3]=0,t[4]=(E-K)*ge,t[5]=(1-(T+z))*ge,t[6]=(F+W)*ge,t[7]=0,t[8]=(M+J)*j,t[9]=(F-W)*j,t[10]=(1-(T+O))*j,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function ale(t,e,r,i,n){let o=e[0],s=e[1],l=e[2],u=e[3],h=o+o,v=s+s,T=l+l,E=o*h,M=o*v,O=o*T,F=s*v,z=s*T,W=l*T,J=u*h,K=u*v,ne=u*T,ge=i[0],j=i[1],me=i[2],fe=n[0],$=n[1],Z=n[2],we=(1-(F+W))*ge,Oe=(M+ne)*ge,he=(O-K)*ge,Le=(M-ne)*j,ft=(1-(E+W))*j,Vt=(z+J)*j,Yt=(O+K)*me,mr=(z-J)*me,Er=(1-(E+F))*me;return t[0]=we,t[1]=Oe,t[2]=he,t[3]=0,t[4]=Le,t[5]=ft,t[6]=Vt,t[7]=0,t[8]=Yt,t[9]=mr,t[10]=Er,t[11]=0,t[12]=r[0]+fe-(we*fe+Le*$+Yt*Z),t[13]=r[1]+$-(Oe*fe+ft*$+mr*Z),t[14]=r[2]+Z-(he*fe+Vt*$+Er*Z),t[15]=1,t}function xB(t,e){let r=e[0],i=e[1],n=e[2],o=e[3],s=r+r,l=i+i,u=n+n,h=r*s,v=i*s,T=i*l,E=n*s,M=n*l,O=n*u,F=o*s,z=o*l,W=o*u;return t[0]=1-T-O,t[1]=v+W,t[2]=E-z,t[3]=0,t[4]=v-W,t[5]=1-h-O,t[6]=M+F,t[7]=0,t[8]=E+z,t[9]=M-F,t[10]=1-h-T,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function bB(t,e,r,i,n,o,s){let l=1/(r-e),u=1/(n-i),h=1/(o-s);return t[0]=o*2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*u,t[6]=0,t[7]=0,t[8]=(r+e)*l,t[9]=(n+i)*u,t[10]=(s+o)*h,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*h,t[15]=0,t}function w8(t,e,r,i,n){let o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,n!=null&&n!==1/0){let s=1/(i-n);t[10]=(n+i)*s,t[14]=2*n*i*s}else t[10]=-1,t[14]=-2*i;return t}var wB=w8;function lle(t,e,r,i,n){let o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,n!=null&&n!==1/0){let s=1/(i-n);t[10]=n*s,t[14]=n*i*s}else t[10]=-1,t[14]=-i;return t}function cle(t,e,r,i){let n=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),s=Math.tan(e.leftDegrees*Math.PI/180),l=Math.tan(e.rightDegrees*Math.PI/180),u=2/(s+l),h=2/(n+o);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=h,t[6]=0,t[7]=0,t[8]=-((s-l)*u*.5),t[9]=(n-o)*h*.5,t[10]=i/(r-i),t[11]=-1,t[12]=0,t[13]=0,t[14]=i*r/(r-i),t[15]=0,t}function T8(t,e,r,i,n,o,s){let l=1/(e-r),u=1/(i-n),h=1/(o-s);return t[0]=-2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+r)*l,t[13]=(n+i)*u,t[14]=(s+o)*h,t[15]=1,t}var TB=T8;function ule(t,e,r,i,n,o,s){let l=1/(e-r),u=1/(i-n),h=1/(o-s);return t[0]=-2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=h,t[11]=0,t[12]=(e+r)*l,t[13]=(n+i)*u,t[14]=o*h,t[15]=1,t}function EB(t,e,r,i){let n,o,s,l,u,h,v,T,E,M,O=e[0],F=e[1],z=e[2],W=i[0],J=i[1],K=i[2],ne=r[0],ge=r[1],j=r[2];return Math.abs(O-ne)<1e-6&&Math.abs(F-ge)<1e-6&&Math.abs(z-j)<1e-6?v8(t):(T=O-ne,E=F-ge,M=z-j,n=1/Math.sqrt(T*T+E*E+M*M),T*=n,E*=n,M*=n,o=J*M-K*E,s=K*T-W*M,l=W*E-J*T,n=Math.sqrt(o*o+s*s+l*l),n?(n=1/n,o*=n,s*=n,l*=n):(o=0,s=0,l=0),u=E*l-M*s,h=M*o-T*l,v=T*s-E*o,n=Math.sqrt(u*u+h*h+v*v),n?(n=1/n,u*=n,h*=n,v*=n):(u=0,h=0,v=0),t[0]=o,t[1]=u,t[2]=T,t[3]=0,t[4]=s,t[5]=h,t[6]=E,t[7]=0,t[8]=l,t[9]=v,t[10]=M,t[11]=0,t[12]=-(o*O+s*F+l*z),t[13]=-(u*O+h*F+v*z),t[14]=-(T*O+E*F+M*z),t[15]=1,t)}function fle(t,e,r,i){let n=e[0],o=e[1],s=e[2],l=i[0],u=i[1],h=i[2],v=n-r[0],T=o-r[1],E=s-r[2],M=v*v+T*T+E*E;M>0&&(M=1/Math.sqrt(M),v*=M,T*=M,E*=M);let O=u*E-h*T,F=h*v-l*E,z=l*T-u*v;return M=O*O+F*F+z*z,M>0&&(M=1/Math.sqrt(M),O*=M,F*=M,z*=M),t[0]=O,t[1]=F,t[2]=z,t[3]=0,t[4]=T*z-E*F,t[5]=E*O-v*z,t[6]=v*F-T*O,t[7]=0,t[8]=v,t[9]=T,t[10]=E,t[11]=0,t[12]=n,t[13]=o,t[14]=s,t[15]=1,t}function hle(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]})`}function dle(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])}function ple(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function E8(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function Ale(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function mle(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t[3]=e[3]+r[3]*i,t[4]=e[4]+r[4]*i,t[5]=e[5]+r[5]*i,t[6]=e[6]+r[6]*i,t[7]=e[7]+r[7]*i,t[8]=e[8]+r[8]*i,t[9]=e[9]+r[9]*i,t[10]=e[10]+r[10]*i,t[11]=e[11]+r[11]*i,t[12]=e[12]+r[12]*i,t[13]=e[13]+r[13]*i,t[14]=e[14]+r[14]*i,t[15]=e[15]+r[15]*i,t}function gle(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]}function _le(t,e){let r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],v=t[8],T=t[9],E=t[10],M=t[11],O=t[12],F=t[13],z=t[14],W=t[15],J=e[0],K=e[1],ne=e[2],ge=e[3],j=e[4],me=e[5],fe=e[6],$=e[7],Z=e[8],we=e[9],Oe=e[10],he=e[11],Le=e[12],ft=e[13],Vt=e[14],Yt=e[15];return Math.abs(r-J)<=1e-6*Math.max(1,Math.abs(r),Math.abs(J))&&Math.abs(i-K)<=1e-6*Math.max(1,Math.abs(i),Math.abs(K))&&Math.abs(n-ne)<=1e-6*Math.max(1,Math.abs(n),Math.abs(ne))&&Math.abs(o-ge)<=1e-6*Math.max(1,Math.abs(o),Math.abs(ge))&&Math.abs(s-j)<=1e-6*Math.max(1,Math.abs(s),Math.abs(j))&&Math.abs(l-me)<=1e-6*Math.max(1,Math.abs(l),Math.abs(me))&&Math.abs(u-fe)<=1e-6*Math.max(1,Math.abs(u),Math.abs(fe))&&Math.abs(h-$)<=1e-6*Math.max(1,Math.abs(h),Math.abs($))&&Math.abs(v-Z)<=1e-6*Math.max(1,Math.abs(v),Math.abs(Z))&&Math.abs(T-we)<=1e-6*Math.max(1,Math.abs(T),Math.abs(we))&&Math.abs(E-Oe)<=1e-6*Math.max(1,Math.abs(E),Math.abs(Oe))&&Math.abs(M-he)<=1e-6*Math.max(1,Math.abs(M),Math.abs(he))&&Math.abs(O-Le)<=1e-6*Math.max(1,Math.abs(O),Math.abs(Le))&&Math.abs(F-ft)<=1e-6*Math.max(1,Math.abs(F),Math.abs(ft))&&Math.abs(z-Vt)<=1e-6*Math.max(1,Math.abs(z),Math.abs(Vt))&&Math.abs(W-Yt)<=1e-6*Math.max(1,Math.abs(W),Math.abs(Yt))}var yle=Dx,vle=E8;var tc={};As(tc,{add:()=>SB,ceil:()=>xle,clone:()=>C8,copy:()=>I8,create:()=>S8,cross:()=>Ile,dist:()=>Nle,distance:()=>D8,div:()=>Fle,divide:()=>O8,dot:()=>IB,equals:()=>Ole,exactEquals:()=>F8,floor:()=>ble,forEach:()=>Vle,fromValues:()=>M8,inverse:()=>Mle,len:()=>Ule,length:()=>JT,lerp:()=>PB,max:()=>Tle,min:()=>wle,mul:()=>Lle,multiply:()=>B8,negate:()=>Cle,normalize:()=>MB,random:()=>Ple,round:()=>Ele,scale:()=>CB,scaleAndAdd:()=>Sle,set:()=>P8,sqrDist:()=>kle,sqrLen:()=>zle,squaredDistance:()=>L8,squaredLength:()=>QT,str:()=>Ble,sub:()=>Dle,subtract:()=>R8,transformMat4:()=>RB,transformQuat:()=>BB,zero:()=>Rle});function S8(){let t=new Go(4);return Go!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function C8(t){let e=new Go(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function M8(t,e,r,i){let n=new Go(4);return n[0]=t,n[1]=e,n[2]=r,n[3]=i,n}function I8(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function P8(t,e,r,i,n){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t}function SB(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function R8(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function B8(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function O8(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function xle(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function ble(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function wle(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function Tle(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function Ele(t,e){return t[0]=Ou(e[0]),t[1]=Ou(e[1]),t[2]=Ou(e[2]),t[3]=Ou(e[3]),t}function CB(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function Sle(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t[3]=e[3]+r[3]*i,t}function D8(t,e){let r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(r*r+i*i+n*n+o*o)}function L8(t,e){let r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2],o=e[3]-t[3];return r*r+i*i+n*n+o*o}function JT(t){let e=t[0],r=t[1],i=t[2],n=t[3];return Math.sqrt(e*e+r*r+i*i+n*n)}function QT(t){let e=t[0],r=t[1],i=t[2],n=t[3];return e*e+r*r+i*i+n*n}function Cle(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function Mle(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function MB(t,e){let r=e[0],i=e[1],n=e[2],o=e[3],s=r*r+i*i+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=i*s,t[2]=n*s,t[3]=o*s,t}function IB(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Ile(t,e,r,i){let n=r[0]*i[1]-r[1]*i[0],o=r[0]*i[2]-r[2]*i[0],s=r[0]*i[3]-r[3]*i[0],l=r[1]*i[2]-r[2]*i[1],u=r[1]*i[3]-r[3]*i[1],h=r[2]*i[3]-r[3]*i[2],v=e[0],T=e[1],E=e[2],M=e[3];return t[0]=T*h-E*u+M*l,t[1]=-(v*h)+E*s-M*o,t[2]=v*u-T*s+M*n,t[3]=-(v*l)+T*o-E*n,t}function PB(t,e,r,i){let n=e[0],o=e[1],s=e[2],l=e[3];return t[0]=n+i*(r[0]-n),t[1]=o+i*(r[1]-o),t[2]=s+i*(r[2]-s),t[3]=l+i*(r[3]-l),t}function Ple(t,e){e=e===void 0?1:e;let r,i,n,o,s,l;do r=Ch()*2-1,i=Ch()*2-1,s=r*r+i*i;while(s>=1);do n=Ch()*2-1,o=Ch()*2-1,l=n*n+o*o;while(l>=1);let u=Math.sqrt((1-s)/l);return t[0]=e*r,t[1]=e*i,t[2]=e*n*u,t[3]=e*o*u,t}function RB(t,e,r){let i=e[0],n=e[1],o=e[2],s=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*o+r[12]*s,t[1]=r[1]*i+r[5]*n+r[9]*o+r[13]*s,t[2]=r[2]*i+r[6]*n+r[10]*o+r[14]*s,t[3]=r[3]*i+r[7]*n+r[11]*o+r[15]*s,t}function BB(t,e,r){let i=e[0],n=e[1],o=e[2],s=r[0],l=r[1],u=r[2],h=r[3],v=h*i+l*o-u*n,T=h*n+u*i-s*o,E=h*o+s*n-l*i,M=-s*i-l*n-u*o;return t[0]=v*h+M*-s+T*-u-E*-l,t[1]=T*h+M*-l+E*-s-v*-u,t[2]=E*h+M*-u+v*-l-T*-s,t[3]=e[3],t}function Rle(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function Ble(t){return`vec4(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]})`}function F8(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function Ole(t,e){let r=t[0],i=t[1],n=t[2],o=t[3],s=e[0],l=e[1],u=e[2],h=e[3];return Math.abs(r-s)<=1e-6*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=1e-6*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(n-u)<=1e-6*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(o-h)<=1e-6*Math.max(1,Math.abs(o),Math.abs(h))}var Dle=R8,Lle=B8,Fle=O8,Nle=D8,kle=L8,Ule=JT,zle=QT,Vle=function(){let t=S8();return function(e,r,i,n,o,s){let l,u;for(r||(r=4),i||(i=0),n?u=Math.min(n*r+i,e.length):u=e.length,l=i;l<u;l+=r)t[0]=e[l],t[1]=e[l+1],t[2]=e[l+2],t[3]=e[l+3],o(t,t,s),e[l]=t[0],e[l+1]=t[1],e[l+2]=t[2],e[l+3]=t[3];return e}}();var LB;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(LB||(LB={}));var Hle=45*Math.PI/180,jle=1,OB=.1,DB=500,Gle=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Kr=class extends Q0{static get IDENTITY(){return qle()}static get ZERO(){return Wle()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return LB}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,r,i,n,o,s,l,u,h,v,T,E,M,O,F,z){return this[0]=e,this[1]=r,this[2]=i,this[3]=n,this[4]=o,this[5]=s,this[6]=l,this[7]=u,this[8]=h,this[9]=v,this[10]=T,this[11]=E,this[12]=M,this[13]=O,this[14]=F,this[15]=z,this.check()}setRowMajor(e,r,i,n,o,s,l,u,h,v,T,E,M,O,F,z){return this[0]=e,this[1]=o,this[2]=h,this[3]=M,this[4]=r,this[5]=s,this[6]=v,this[7]=O,this[8]=i,this[9]=l,this[10]=T,this[11]=F,this[12]=n,this[13]=u,this[14]=E,this[15]=z,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(Gle)}fromObject(e){return this.check()}fromQuaternion(e){return xB(this,e),this.check()}frustum(e){let{left:r,right:i,bottom:n,top:o,near:s=OB,far:l=DB}=e;return l===1/0?Xle(this,r,i,n,o,s):bB(this,r,i,n,o,s,l),this.check()}lookAt(e){let{eye:r,center:i=[0,0,0],up:n=[0,1,0]}=e;return EB(this,r,i,n),this.check()}ortho(e){let{left:r,right:i,bottom:n,top:o,near:s=OB,far:l=DB}=e;return TB(this,r,i,n,o,s,l),this.check()}orthographic(e){let{fovy:r=Hle,aspect:i=jle,focalDistance:n=1,near:o=OB,far:s=DB}=e;N8(r);let l=r/2,u=n*Math.tan(l),h=u*i;return this.ortho({left:-h,right:h,bottom:-u,top:u,near:o,far:s})}perspective(e){let{fovy:r=45*Math.PI/180,aspect:i=1,near:n=.1,far:o=500}=e;return N8(r),wB(this,r,i,n,o),this.check()}determinant(){return pB(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let i=this.getScale(r),n=1/i[0],o=1/i[1],s=1/i[2];return e[0]=this[0]*n,e[1]=this[1]*o,e[2]=this[2]*s,e[3]=0,e[4]=this[4]*n,e[5]=this[5]*o,e[6]=this[6]*s,e[7]=0,e[8]=this[8]*n,e[9]=this[9]*o,e[10]=this[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let i=this.getScale(r),n=1/i[0],o=1/i[1],s=1/i[2];return e[0]=this[0]*n,e[1]=this[1]*o,e[2]=this[2]*s,e[3]=this[4]*n,e[4]=this[5]*o,e[5]=this[6]*s,e[6]=this[8]*n,e[7]=this[9]*o,e[8]=this[10]*s,e}transpose(){return hB(this,this),this.check()}invert(){return dB(this,this),this.check()}multiplyLeft(e){return Dx(this,e,this),this.check()}multiplyRight(e){return Dx(this,this,e),this.check()}rotateX(e){return _B(this,this,e),this.check()}rotateY(e){return yB(this,this,e),this.check()}rotateZ(e){return vB(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,r){return gB(this,this,e,r),this.check()}scale(e){return mB(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return AB(this,this,e),this.check()}transform(e,r){return e.length===4?(r=RB(r||[-0,-0,-0,-0],e,this),Fp(r,4),r):this.transformAsPoint(e,r)}transformAsPoint(e,r){let{length:i}=e,n;switch(i){case 2:n=Px(r||[-0,-0],e,this);break;case 3:n=fm(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Fp(n,e.length),n}transformAsVector(e,r){let i;switch(e.length){case 2:i=VT(r||[-0,-0],e,this);break;case 3:i=HT(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Fp(i,e.length),i}transformPoint(e,r){return this.transformAsPoint(e,r)}transformVector(e,r){return this.transformAsPoint(e,r)}transformDirection(e,r){return this.transformAsVector(e,r)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,r,i){return this.identity().translate([e,r,i])}},$T,eE;function Wle(){return $T||($T=new Kr([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze($T)),$T}function qle(){return eE||(eE=new Kr,Object.freeze(eE)),eE}function N8(t){if(t>Math.PI*2)throw Error("expected radians")}function Xle(t,e,r,i,n,o){let s=2*o/(r-e),l=2*o/(n-i),u=(r+e)/(r-e),h=(n+i)/(n-i),v=-1,T=-1,E=-2*o;return t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=u,t[9]=h,t[10]=v,t[11]=T,t[12]=0,t[13]=0,t[14]=E,t[15]=0,t}function k8(){let t=new Go(4);return Go!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function U8(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function FB(t,e,r){r=r*.5;let i=Math.sin(r);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(r),t}function NB(t,e,r){let i=e[0],n=e[1],o=e[2],s=e[3],l=r[0],u=r[1],h=r[2],v=r[3];return t[0]=i*v+s*l+n*h-o*u,t[1]=n*v+s*u+o*l-i*h,t[2]=o*v+s*h+i*u-n*l,t[3]=s*v-i*l-n*u-o*h,t}function z8(t,e,r){r*=.5;let i=e[0],n=e[1],o=e[2],s=e[3],l=Math.sin(r),u=Math.cos(r);return t[0]=i*u+s*l,t[1]=n*u+o*l,t[2]=o*u-n*l,t[3]=s*u-i*l,t}function V8(t,e,r){r*=.5;let i=e[0],n=e[1],o=e[2],s=e[3],l=Math.sin(r),u=Math.cos(r);return t[0]=i*u-o*l,t[1]=n*u+s*l,t[2]=o*u+i*l,t[3]=s*u-n*l,t}function H8(t,e,r){r*=.5;let i=e[0],n=e[1],o=e[2],s=e[3],l=Math.sin(r),u=Math.cos(r);return t[0]=i*u+n*l,t[1]=n*u-i*l,t[2]=o*u+s*l,t[3]=s*u-o*l,t}function j8(t,e){let r=e[0],i=e[1],n=e[2];return t[0]=r,t[1]=i,t[2]=n,t[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),t}function Lx(t,e,r,i){let n=e[0],o=e[1],s=e[2],l=e[3],u=r[0],h=r[1],v=r[2],T=r[3],E,M,O,F,z;return E=n*u+o*h+s*v+l*T,E<0&&(E=-E,u=-u,h=-h,v=-v,T=-T),1-E>1e-6?(M=Math.acos(E),z=Math.sin(M),O=Math.sin((1-i)*M)/z,F=Math.sin(i*M)/z):(O=1-i,F=i),t[0]=O*n+F*u,t[1]=O*o+F*h,t[2]=O*s+F*v,t[3]=O*l+F*T,t}function G8(t,e){let r=e[0],i=e[1],n=e[2],o=e[3],s=r*r+i*i+n*n+o*o,l=s?1/s:0;return t[0]=-r*l,t[1]=-i*l,t[2]=-n*l,t[3]=o*l,t}function W8(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function kB(t,e){let r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{let n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);let o=(n+1)%3,s=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[o*3+o]-e[s*3+s]+1),t[n]=.5*i,i=.5/i,t[3]=(e[o*3+s]-e[s*3+o])*i,t[o]=(e[o*3+n]+e[n*3+o])*i,t[s]=(e[s*3+n]+e[n*3+s])*i}return t}var q8=SB;var X8=CB,Y8=IB,K8=PB,Z8=JT;var J8=QT;var Q8=MB;var $8=function(){let t=GT(),e=qT(1,0,0),r=qT(0,1,0);return function(i,n,o){let s=Rx(n,o);return s<-.999999?(um(t,e,n),aB(t)<1e-6&&um(t,r,n),rB(t,t),FB(i,t,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(um(t,n,o),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+s,Q8(i,i))}}(),MUe=function(){let t=k8(),e=k8();return function(r,i,n,o,s,l){return Lx(t,i,s,l),Lx(e,n,o,l),Lx(r,t,e,2*l*(1-l)),r}}(),IUe=function(){let t=d8();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],Q8(e,kB(e,t))}}();var Yle=[0,0,0,1],Du=class extends Lp{constructor(e=0,r=0,i=0,n=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,r,i,n)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,r,i,n){return this[0]=e,this[1]=r,this[2]=i,this[3]=n,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return kB(this,e),this.check()}fromAxisRotation(e,r){return FB(this,e,r),this.check()}identity(){return U8(this),this.check()}setAxisAngle(e,r){return this.fromAxisRotation(e,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=jn(e)}get y(){return this[1]}set y(e){this[1]=jn(e)}get z(){return this[2]}set z(e){this[2]=jn(e)}get w(){return this[3]}set w(e){this[3]=jn(e)}len(){return Z8(this)}lengthSquared(){return J8(this)}dot(e){return Y8(this,e)}rotationTo(e,r){return $8(this,e,r),this.check()}add(e){return q8(this,this,e),this.check()}calculateW(){return j8(this,this),this.check()}conjugate(){return W8(this,this),this.check()}invert(){return G8(this,this),this.check()}lerp(e,r,i){return i===void 0?this.lerp(this,e,r):(K8(this,e,r,i),this.check())}multiplyRight(e){return NB(this,this,e),this.check()}multiplyLeft(e){return NB(this,e,this),this.check()}normalize(){let e=this.len(),r=e>0?1/e:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,e===0&&(this[3]=1),this.check()}rotateX(e){return z8(this,this,e),this.check()}rotateY(e){return V8(this,this,e),this.check()}rotateZ(e){return H8(this,this,e),this.check()}scale(e){return X8(this,this,e),this.check()}slerp(e,r,i){let n,o,s;switch(arguments.length){case 1:({start:n=Yle,target:o,ratio:s}=e);break;case 2:n=this,o=e,s=r;break;default:n=e,o=r,s=i}return Lx(this,n,o,s),this.check()}transformVector4(e,r=new J0){return BB(r,e,this),Fp(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,r){return this.setAxisAngle(e,r)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}};var eV=1e-6,Kle=6371e3,yf=class{constructor({phi:e=0,theta:r=0,radius:i=1,bearing:n,pitch:o,altitude:s,radiusScale:l=Kle}={}){this.phi=e,this.theta=r,this.radius=i||s||1,this.radiusScale=l||1,n!==void 0&&(this.bearing=n),o!==void 0&&(this.pitch=o),this.check()}toString(){return this.formatString(Do)}formatString({printTypes:e=!1}){let r=Mx;return`${e?"Spherical":""}[rho:${r(this.radius)},theta:${r(this.theta)},phi:${r(this.phi)}]`}equals(e){return Cs(this.radius,e.radius)&&Cs(this.theta,e.theta)&&Cs(this.phi,e.phi)}exactEquals(e){return this.radius===e.radius&&this.theta===e.theta&&this.phi===e.phi}get bearing(){return 180-va(this.phi)}set bearing(e){this.phi=Math.PI-cm(e)}get pitch(){return va(this.theta)}set pitch(e){this.theta=cm(e)}get longitude(){return va(this.phi)}get latitude(){return va(this.theta)}get lng(){return va(this.phi)}get lat(){return va(this.theta)}get z(){return(this.radius-1)*this.radiusScale}set(e,r,i){return this.radius=e,this.phi=r,this.theta=i,this.check()}clone(){return new yf().copy(this)}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this.check()}fromLngLatZ([e,r,i]){return this.radius=1+i/this.radiusScale,this.phi=cm(r),this.theta=cm(e),this.check()}fromVector3(e){return this.radius=WT(e),this.radius>0&&(this.theta=Math.atan2(e[0],e[1]),this.phi=Math.acos(Zn(e[2]/this.radius,-1,1))),this.check()}toVector3(){return new ot(0,0,this.radius).rotateX({radians:this.theta}).rotateZ({radians:this.phi})}makeSafe(){return this.phi=Math.max(eV,Math.min(Math.PI-eV,this.phi)),this}check(){if(!Number.isFinite(this.phi)||!Number.isFinite(this.theta)||!(this.radius>0))throw new Error("SphericalCoordinates: some fields set to invalid numbers");return this}};var Lu={};As(Lu,{EPSILON1:()=>Zle,EPSILON10:()=>oce,EPSILON11:()=>sce,EPSILON12:()=>ace,EPSILON13:()=>lce,EPSILON14:()=>cce,EPSILON15:()=>uce,EPSILON16:()=>fce,EPSILON17:()=>hce,EPSILON18:()=>dce,EPSILON19:()=>pce,EPSILON2:()=>Jle,EPSILON20:()=>Ace,EPSILON3:()=>Qle,EPSILON4:()=>$le,EPSILON5:()=>ece,EPSILON6:()=>tce,EPSILON7:()=>rce,EPSILON8:()=>ice,EPSILON9:()=>nce,PI_OVER_FOUR:()=>gce,PI_OVER_SIX:()=>_ce,PI_OVER_TWO:()=>mce,TWO_PI:()=>yce});var Zle=.1,Jle=.01,Qle=.001,$le=1e-4,ece=1e-5,tce=1e-6,rce=1e-7,ice=1e-8,nce=1e-9,oce=1e-10,sce=1e-11,ace=1e-12,lce=1e-13,cce=1e-14,uce=1e-15,fce=1e-16,hce=1e-17,dce=1e-18,pce=1e-19,Ace=1e-20,mce=Math.PI/2,gce=Math.PI/4,_ce=Math.PI/6,yce=Math.PI*2;var UB=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
struct AmbientLight {
vec3 color;
};
struct PointLight {
vec3 color;
vec3 position;
vec3 attenuation;
};
struct DirectionalLight {
vec3 color;
vec3 direction;
};
uniform AmbientLight lighting_uAmbientLight;
uniform PointLight lighting_uPointLight[MAX_LIGHTS];
uniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];
uniform int lighting_uPointLightCount;
uniform int lighting_uDirectionalLightCount;
uniform bool lighting_uEnabled;
float getPointLightAttenuation(PointLight pointLight, float distance) {
return pointLight.attenuation.x
+ pointLight.attenuation.y * distance
+ pointLight.attenuation.z * distance * distance;
}
#endif
`;var vce={lightSources:{}};function zB(t={}){let{color:e=[0,0,0],intensity:r=1}=t;return e.map(i=>i*r/255)}function xce({ambientLight:t,pointLights:e=[],directionalLights:r=[]}){let i={};return t?i["lighting_uAmbientLight.color"]=zB(t):i["lighting_uAmbientLight.color"]=[0,0,0],e.forEach((n,o)=>{i[`lighting_uPointLight[${o}].color`]=zB(n),i[`lighting_uPointLight[${o}].position`]=n.position,i[`lighting_uPointLight[${o}].attenuation`]=n.attenuation||[1,0,0]}),i.lighting_uPointLightCount=e.length,r.forEach((n,o)=>{i[`lighting_uDirectionalLight[${o}].color`]=zB(n),i[`lighting_uDirectionalLight[${o}].direction`]=n.direction}),i.lighting_uDirectionalLightCount=r.length,i}function tV(t=vce){if("lightSources"in t){let{ambientLight:e,pointLights:r,directionalLights:i}=t.lightSources||{};return e||r&&r.length>0||i&&i.length>0?Object.assign({},xce({ambientLight:e,pointLights:r,directionalLights:i}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in t){let e={pointLights:[],directionalLights:[]};for(let r of t.lights||[])switch(r.type){case"ambient":e.ambientLight=r;break;case"directional":e.directionalLights?.push(r);break;case"point":e.pointLights?.push(r);break;default:}return tV({lightSources:e})}return{}}var Fx={name:"lights",vs:UB,fs:UB,getUniforms:tV,defines:{MAX_LIGHTS:3}};var VB=`uniform float lighting_uAmbient;
uniform float lighting_uDiffuse;
uniform float lighting_uShininess;
uniform vec3 lighting_uSpecularColor;
vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {
vec3 halfway_direction = normalize(light_direction + view_direction);
float lambertian = dot(light_direction, normal_worldspace);
float specular = 0.0;
if (lambertian > 0.0) {
float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
specular = pow(specular_angle, lighting_uShininess);
}
lambertian = max(lambertian, 0.0);
return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;
}
vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
vec3 lightColor = surfaceColor;
if (lighting_uEnabled) {
vec3 view_direction = normalize(cameraPosition - position_worldspace);
lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;
for (int i = 0; i < MAX_LIGHTS; i++) {
if (i >= lighting_uPointLightCount) {
break;
}
PointLight pointLight = lighting_uPointLight[i];
vec3 light_position_worldspace = pointLight.position;
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
}
for (int i = 0; i < MAX_LIGHTS; i++) {
if (i >= lighting_uDirectionalLightCount) {
break;
}
DirectionalLight directionalLight = lighting_uDirectionalLight[i];
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
}
}
return lightColor;
}
vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
vec3 lightColor = vec3(0, 0, 0);
vec3 surfaceColor = vec3(0, 0, 0);
if (lighting_uEnabled) {
vec3 view_direction = normalize(cameraPosition - position_worldspace);
for (int i = 0; i < MAX_LIGHTS; i++) {
if (i >= lighting_uPointLightCount) {
break;
}
PointLight pointLight = lighting_uPointLight[i];
vec3 light_position_worldspace = pointLight.position;
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
}
for (int i = 0; i < MAX_LIGHTS; i++) {
if (i >= lighting_uDirectionalLightCount) {
break;
}
DirectionalLight directionalLight = lighting_uDirectionalLight[i];
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
}
}
return lightColor;
}
`;var bce={};function wce(t){let{ambient:e=.35,diffuse:r=.6,shininess:i=32,specularColor:n=[30,30,30]}=t;return{lighting_uAmbient:e,lighting_uDiffuse:r,lighting_uShininess:i,lighting_uSpecularColor:n.map(o=>o/255)}}function rV(t=bce){if(!("material"in t))return{};let{material:e}=t;return e?wce(e):{lighting_uEnabled:!1}}var Fu={name:"gouraud-lighting",dependencies:[Fx],vs:VB,defines:{LIGHTING_VERTEX:1},getUniforms:rV},kp={name:"phong-lighting",dependencies:[Fx],fs:VB,defines:{LIGHTING_FRAGMENT:1},getUniforms:rV};var iV=`uniform mat4 u_MVPMatrix;
uniform mat4 u_ModelMatrix;
uniform mat4 u_NormalMatrix;
out vec3 pbr_vPosition;
out vec2 pbr_vUV;
#ifdef HAS_NORMALS
# ifdef HAS_TANGENTS
out mat3 pbr_vTBN;
# else
out vec3 pbr_vNormal;
# endif
#endif
void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)
{
vec4 pos = u_ModelMatrix * position;
pbr_vPosition = vec3(pos.xyz) / pos.w;
#ifdef HAS_NORMALS
#ifdef HAS_TANGENTS
vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));
vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));
vec3 bitangentW = cross(normalW, tangentW) * tangent.w;
pbr_vTBN = mat3(tangentW, bitangentW, normalW);
#else
pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));
#endif
#endif
#ifdef HAS_UV
pbr_vUV = uv;
#else
pbr_vUV = vec2(0.,0.);
#endif
}
`;var nV=`precision highp float;
uniform bool pbr_uUnlit;
#ifdef USE_IBL
uniform samplerCube u_DiffuseEnvSampler;
uniform samplerCube u_SpecularEnvSampler;
uniform sampler2D u_brdfLUT;
uniform vec2 u_ScaleIBLAmbient;
#endif
#ifdef HAS_BASECOLORMAP
uniform sampler2D u_BaseColorSampler;
#endif
#ifdef HAS_NORMALMAP
uniform sampler2D u_NormalSampler;
uniform float u_NormalScale;
#endif
#ifdef HAS_EMISSIVEMAP
uniform sampler2D u_EmissiveSampler;
uniform vec3 u_EmissiveFactor;
#endif
#ifdef HAS_METALROUGHNESSMAP
uniform sampler2D u_MetallicRoughnessSampler;
#endif
#ifdef HAS_OCCLUSIONMAP
uniform sampler2D u_OcclusionSampler;
uniform float u_OcclusionStrength;
#endif
#ifdef ALPHA_CUTOFF
uniform float u_AlphaCutoff;
#endif
uniform vec2 u_MetallicRoughnessValues;
uniform vec4 u_BaseColorFactor;
uniform vec3 u_Camera;
#ifdef PBR_DEBUG
uniform vec4 u_ScaleDiffBaseMR;
uniform vec4 u_ScaleFGDSpec;
#endif
in vec3 pbr_vPosition;
in vec2 pbr_vUV;
#ifdef HAS_NORMALS
#ifdef HAS_TANGENTS
in mat3 pbr_vTBN;
#else
in vec3 pbr_vNormal;
#endif
#endif
struct PBRInfo
{
float NdotL;
float NdotV;
float NdotH;
float LdotH;
float VdotH;
float perceptualRoughness;
float metalness;
vec3 reflectance0;
vec3 reflectance90;
float alphaRoughness;
vec3 diffuseColor;
vec3 specularColor;
vec3 n;
vec3 v;
};
const float M_PI = 3.141592653589793;
const float c_MinRoughness = 0.04;
vec4 SRGBtoLINEAR(vec4 srgbIn)
{
#ifdef MANUAL_SRGB
#ifdef SRGB_FAST_APPROXIMATION
vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
#else
vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
#endif
return vec4(linOut,srgbIn.w);;
#else
return srgbIn;
#endif
}
vec3 getNormal()
{
#ifndef HAS_TANGENTS
vec3 pos_dx = dFdx(pbr_vPosition);
vec3 pos_dy = dFdy(pbr_vPosition);
vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));
vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));
vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
#ifdef HAS_NORMALS
vec3 ng = normalize(pbr_vNormal);
#else
vec3 ng = cross(pos_dx, pos_dy);
#endif
t = normalize(t - ng * dot(ng, t));
vec3 b = normalize(cross(ng, t));
mat3 tbn = mat3(t, b, ng);
#else
mat3 tbn = pbr_vTBN;
#endif
#ifdef HAS_NORMALMAP
vec3 n = texture(u_NormalSampler, pbr_vUV).rgb;
n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));
#else
vec3 n = normalize(tbn[2].xyz);
#endif
return n;
}
#ifdef USE_IBL
vec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)
{
float mipCount = 9.0;
float lod = (pbrInputs.perceptualRoughness * mipCount);
vec3 brdf = SRGBtoLINEAR(texture(u_brdfLUT,
vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;
#ifdef USE_TEX_LOD
vec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb;
#else
vec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;
#endif
vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;
vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);
diffuse *= u_ScaleIBLAmbient.x;
specular *= u_ScaleIBLAmbient.y;
return diffuse + specular;
}
#endif
vec3 diffuse(PBRInfo pbrInputs)
{
return pbrInputs.diffuseColor / M_PI;
}
vec3 specularReflection(PBRInfo pbrInputs)
{
return pbrInputs.reflectance0 +
(pbrInputs.reflectance90 - pbrInputs.reflectance0) *
pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
}
float geometricOcclusion(PBRInfo pbrInputs)
{
float NdotL = pbrInputs.NdotL;
float NdotV = pbrInputs.NdotV;
float r = pbrInputs.alphaRoughness;
float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
return attenuationL * attenuationV;
}
float microfacetDistribution(PBRInfo pbrInputs)
{
float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
return roughnessSq / (M_PI * f * f);
}
void PBRInfo_setAmbientLight(inout PBRInfo pbrInputs) {
pbrInputs.NdotL = 1.0;
pbrInputs.NdotH = 0.0;
pbrInputs.LdotH = 0.0;
pbrInputs.VdotH = 1.0;
}
void PBRInfo_setDirectionalLight(inout PBRInfo pbrInputs, vec3 lightDirection) {
vec3 n = pbrInputs.n;
vec3 v = pbrInputs.v;
vec3 l = normalize(lightDirection);
vec3 h = normalize(l+v);
pbrInputs.NdotL = clamp(dot(n, l), 0.001, 1.0);
pbrInputs.NdotH = clamp(dot(n, h), 0.0, 1.0);
pbrInputs.LdotH = clamp(dot(l, h), 0.0, 1.0);
pbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0);
}
void PBRInfo_setPointLight(inout PBRInfo pbrInputs, PointLight pointLight) {
vec3 light_direction = normalize(pointLight.position - pbr_vPosition);
PBRInfo_setDirectionalLight(pbrInputs, light_direction);
}
vec3 calculateFinalColor(PBRInfo pbrInputs, vec3 lightColor) {
vec3 F = specularReflection(pbrInputs);
float G = geometricOcclusion(pbrInputs);
float D = microfacetDistribution(pbrInputs);
vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
vec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV);
return pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib);
}
vec4 pbr_filterColor(vec4 colorUnused)
{
#ifdef HAS_BASECOLORMAP
vec4 baseColor = SRGBtoLINEAR(texture(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;
#else
vec4 baseColor = u_BaseColorFactor;
#endif
#ifdef ALPHA_CUTOFF
if (baseColor.a < u_AlphaCutoff) {
discard;
}
#endif
vec3 color = vec3(0, 0, 0);
if(pbr_uUnlit){
color.rgb = baseColor.rgb;
}
else{
float perceptualRoughness = u_MetallicRoughnessValues.y;
float metallic = u_MetallicRoughnessValues.x;
#ifdef HAS_METALROUGHNESSMAP
vec4 mrSample = texture(u_MetallicRoughnessSampler, pbr_vUV);
perceptualRoughness = mrSample.g * perceptualRoughness;
metallic = mrSample.b * metallic;
#endif
perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
metallic = clamp(metallic, 0.0, 1.0);
float alphaRoughness = perceptualRoughness * perceptualRoughness;
vec3 f0 = vec3(0.04);
vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
diffuseColor *= 1.0 - metallic;
vec3 specularColor = mix(f0, baseColor.rgb, metallic);
float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
vec3 specularEnvironmentR0 = specularColor.rgb;
vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
vec3 n = getNormal();
vec3 v = normalize(u_Camera - pbr_vPosition);
float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
vec3 reflection = -normalize(reflect(v, n));
PBRInfo pbrInputs = PBRInfo(
0.0,
NdotV,
0.0,
0.0,
0.0,
perceptualRoughness,
metallic,
specularEnvironmentR0,
specularEnvironmentR90,
alphaRoughness,
diffuseColor,
specularColor,
n,
v
);
#ifdef USE_LIGHTS
PBRInfo_setAmbientLight(pbrInputs);
color += calculateFinalColor(pbrInputs, lighting_uAmbientLight.color);
for(int i = 0; i < lighting_uDirectionalLightCount; i++) {
if (i < lighting_uDirectionalLightCount) {
PBRInfo_setDirectionalLight(pbrInputs, lighting_uDirectionalLight[i].direction);
color += calculateFinalColor(pbrInputs, lighting_uDirectionalLight[i].color);
}
}
for(int i = 0; i < lighting_uPointLightCount; i++) {
if (i < lighting_uPointLightCount) {
PBRInfo_setPointLight(pbrInputs, lighting_uPointLight[i]);
float attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));
color += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation);
}
}
#endif
#ifdef USE_IBL
color += getIBLContribution(pbrInputs, n, reflection);
#endif
#ifdef HAS_OCCLUSIONMAP
float ao = texture(u_OcclusionSampler, pbr_vUV).r;
color = mix(color, color * ao, u_OcclusionStrength);
#endif
#ifdef HAS_EMISSIVEMAP
vec3 emissive = SRGBtoLINEAR(texture(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;
color += emissive;
#endif
#ifdef PBR_DEBUG
color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);
color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);
color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);
#endif
}
return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
}
`;var hm={name:"pbr",vs:iV,fs:nV,defines:{LIGHTING_FRAGMENT:1},dependencies:[Fx]};var oV="#define SMOOTH_EDGE_RADIUS 0.5",Tce=`
${oV}
struct VertexGeometry {
vec4 position;
vec3 worldPosition;
vec3 worldPositionAlt;
vec3 normal;
vec2 uv;
vec3 pickingColor;
} geometry = VertexGeometry(
vec4(0.0, 0.0, 1.0, 0.0),
vec3(0.0),
vec3(0.0),
vec3(0.0),
vec2(0.0),
vec3(0.0)
);
`,Ece=`
${oV}
struct FragmentGeometry {
vec2 uv;
} geometry;
float smoothedge(float edge, float x) {
return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);
}
`,tE={name:"geometry",vs:Tce,fs:Ece};var Zr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(Zr,"IDENTITY",{get:()=>(ur.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});var Nl={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},ms={common:0,meters:1,pixels:2},Nx={click:{handler:"onClick"},panstart:{handler:"onDragStart"},panmove:{handler:"onDrag"},panend:{handler:"onDragEnd"}},sV={DRAW:"draw",MASK:"mask",TERRAIN:"terrain"};var Sce=Object.keys(Zr).map(t=>`const int COORDINATE_SYSTEM_${t} = ${Zr[t]};`).join(""),Cce=Object.keys(Nl).map(t=>`const int PROJECTION_MODE_${t} = ${Nl[t]};`).join(""),Mce=Object.keys(ms).map(t=>`const int UNIT_${t.toUpperCase()} = ${ms[t]};`).join(""),aV=`${Sce}
${Cce}
${Mce}
uniform projectUniforms {
bool wrapLongitude;
int coordinateSystem;
vec3 commonUnitsPerMeter;
int projectionMode;
float scale;
vec3 commonUnitsPerWorldUnit;
vec3 commonUnitsPerWorldUnit2;
vec4 center;
mat4 modelMatrix;
mat4 viewProjectionMatrix;
vec2 viewportSize;
float devicePixelRatio;
float focalDistance;
vec3 cameraPosition;
vec3 coordinateOrigin;
vec3 commonOrigin;
bool pseudoMeters;
} project;
const float TILE_SIZE = 512.0;
const float PI = 3.1415926536;
const float WORLD_SCALE = TILE_SIZE / (PI * 2.0);
const vec3 ZERO_64_LOW = vec3(0.0);
const float EARTH_RADIUS = 6370972.0;
const float GLOBE_RADIUS = 256.0;
float project_size_at_latitude(float lat) {
float y = clamp(lat, -89.9, 89.9);
return 1.0 / cos(radians(y));
}
float project_size() {
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR &&
project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT &&
project.pseudoMeters == false) {
if (geometry.position.w == 0.0) {
return project_size_at_latitude(geometry.worldPosition.y);
}
float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;
float y2 = y * y;
float y4 = y2 * y2;
float y6 = y4 * y2;
return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;
}
return 1.0;
}
float project_size_at_latitude(float meters, float lat) {
return meters * project.commonUnitsPerMeter.z * project_size_at_latitude(lat);
}
float project_size(float meters) {
return meters * project.commonUnitsPerMeter.z * project_size();
}
vec2 project_size(vec2 meters) {
return meters * project.commonUnitsPerMeter.xy * project_size();
}
vec3 project_size(vec3 meters) {
return meters * project.commonUnitsPerMeter * project_size();
}
vec4 project_size(vec4 meters) {
return vec4(meters.xyz * project.commonUnitsPerMeter, meters.w);
}
mat3 project_get_orientation_matrix(vec3 up) {
vec3 uz = normalize(up);
vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));
vec3 uy = cross(uz, ux);
return mat3(ux, uy, uz);
}
bool project_needs_rotation(vec3 commonPosition, out mat3 transform) {
if (project.projectionMode == PROJECTION_MODE_GLOBE) {
transform = project_get_orientation_matrix(commonPosition);
return true;
}
return false;
}
vec3 project_normal(vec3 vector) {
vec4 normal_modelspace = project.modelMatrix * vec4(vector, 0.0);
vec3 n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter);
mat3 rotation;
if (project_needs_rotation(geometry.position.xyz, rotation)) {
n = rotation * n;
}
return n;
}
vec4 project_offset_(vec4 offset) {
float dy = offset.y;
vec3 commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy;
return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);
}
vec2 project_mercator_(vec2 lnglat) {
float x = lnglat.x;
if (project.wrapLongitude) {
x = mod(x + 180., 360.0) - 180.;
}
float y = clamp(lnglat.y, -89.9, 89.9);
return vec2(
radians(x) + PI,
PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))
) * WORLD_SCALE;
}
vec3 project_globe_(vec3 lnglatz) {
float lambda = radians(lnglatz.x);
float phi = radians(lnglatz.y);
float cosPhi = cos(phi);
float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;
return vec3(
sin(lambda) * cosPhi,
-cos(lambda) * cosPhi,
sin(phi)
) * D;
}
vec4 project_position(vec4 position, vec3 position64Low) {
vec4 position_world = project.modelMatrix * position;
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) {
if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
return vec4(
project_mercator_(position_world.xy),
project_size_at_latitude(position_world.z, position_world.y),
position_world.w
);
}
if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
position_world.xyz += project.coordinateOrigin;
}
}
if (project.projectionMode == PROJECTION_MODE_GLOBE) {
if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
return vec4(
project_globe_(position_world.xyz),
position_world.w
);
}
}
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) {
return vec4(
project_mercator_(position_world.xy) - project.commonOrigin.xy,
project_size(position_world.z),
position_world.w
);
}
}
}
if (project.projectionMode == PROJECTION_MODE_IDENTITY ||
(project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&
(project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {
position_world.xyz -= project.coordinateOrigin;
}
return project_offset_(position_world) + project_offset_(project.modelMatrix * vec4(position64Low, 0.0));
}
vec4 project_position(vec4 position) {
return project_position(position, ZERO_64_LOW);
}
vec3 project_position(vec3 position, vec3 position64Low) {
vec4 projected_position = project_position(vec4(position, 1.0), position64Low);
return projected_position.xyz;
}
vec3 project_position(vec3 position) {
vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);
return projected_position.xyz;
}
vec2 project_position(vec2 position) {
vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);
return projected_position.xy;
}
vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {
return viewProjectionMatrix * position + center;
}
vec4 project_common_position_to_clipspace(vec4 position) {
return project_common_position_to_clipspace(position, project.viewProjectionMatrix, project.center);
}
vec2 project_pixel_size_to_clipspace(vec2 pixels) {
vec2 offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0;
return offset * project.focalDistance;
}
float project_size_to_pixel(float meters) {
return project_size(meters) * project.scale;
}
float project_size_to_pixel(float size, int unit) {
if (unit == UNIT_METERS) return project_size_to_pixel(size);
if (unit == UNIT_COMMON) return size * project.scale;
return size;
}
float project_pixel_size(float pixels) {
return pixels / project.scale;
}
vec2 project_pixel_size(vec2 pixels) {
return pixels / project.scale;
}
`;function Ice(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}return!1}function Nu(t){let e={},r;return i=>{for(let n in i)if(!Ice(i[n],e[n])){r=t(i),e=i;break}return r}}var lV=[0,0,0,0],Pce=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],cV=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Rce=[0,0,0],uV=[0,0,0],Bce=Nu(Dce);function HB(t,e,r=uV){r.length<3&&(r=[r[0],r[1],0]);let i=r,n,o=!0;switch(e===Zr.LNGLAT_OFFSETS||e===Zr.METER_OFFSETS?n=r:n=t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case Nl.WEB_MERCATOR:(e===Zr.LNGLAT||e===Zr.CARTESIAN)&&(n=[0,0,0],o=!1);break;case Nl.WEB_MERCATOR_AUTO_OFFSET:e===Zr.LNGLAT?i=n:e===Zr.CARTESIAN&&(i=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],n=t.unprojectPosition(i),i[0]-=r[0],i[1]-=r[1],i[2]-=r[2]);break;case Nl.IDENTITY:i=t.position.map(Math.fround),i[2]=i[2]||0;break;case Nl.GLOBE:o=!1,n=null;break;default:o=!1}return{geospatialOrigin:n,shaderCoordinateOrigin:i,offsetMode:o}}function Oce(t,e,r){let{viewMatrixUncentered:i,projectionMatrix:n}=t,{viewMatrix:o,viewProjectionMatrix:s}=t,l=lV,u=lV,h=t.cameraPosition,{geospatialOrigin:v,shaderCoordinateOrigin:T,offsetMode:E}=HB(t,e,r);return E&&(u=t.projectPosition(v||T),h=[h[0]-u[0],h[1]-u[1],h[2]-u[2]],u[3]=1,l=tc.transformMat4([],u,s),o=i||o,s=Zs.multiply([],n,o),s=Zs.multiply([],s,Pce)),{viewMatrix:o,viewProjectionMatrix:s,projectionCenter:l,originCommon:u,cameraPosCommon:h,shaderCoordinateOrigin:T,geospatialOrigin:v}}function rE({viewport:t,devicePixelRatio:e=1,modelMatrix:r=null,coordinateSystem:i=Zr.DEFAULT,coordinateOrigin:n=uV,autoWrapLongitude:o=!1}){i===Zr.DEFAULT&&(i=t.isGeospatial?Zr.LNGLAT:Zr.CARTESIAN);let s=Bce({viewport:t,devicePixelRatio:e,coordinateSystem:i,coordinateOrigin:n});return s.wrapLongitude=o,s.modelMatrix=r||cV,s}function Dce({viewport:t,devicePixelRatio:e,coordinateSystem:r,coordinateOrigin:i}){let{projectionCenter:n,viewProjectionMatrix:o,originCommon:s,cameraPosCommon:l,shaderCoordinateOrigin:u,geospatialOrigin:h}=Oce(t,r,i),v=t.getDistanceScales(),T=[t.width*e,t.height*e],E=tc.transformMat4([],[0,0,-t.focalDistance,1],t.projectionMatrix)[3]||1,M={coordinateSystem:r,projectionMode:t.projectionMode,coordinateOrigin:u,commonOrigin:s.slice(0,3),center:n,pseudoMeters:Boolean(t._pseudoMeters),viewportSize:T,devicePixelRatio:e,focalDistance:E,commonUnitsPerMeter:v.unitsPerMeter,commonUnitsPerWorldUnit:v.unitsPerMeter,commonUnitsPerWorldUnit2:Rce,scale:t.scale,wrapLongitude:!1,viewProjectionMatrix:o,modelMatrix:cV,cameraPosition:l};if(h){let O=t.getDistanceScales(h);switch(r){case Zr.METER_OFFSETS:M.commonUnitsPerWorldUnit=O.unitsPerMeter,M.commonUnitsPerWorldUnit2=O.unitsPerMeter2;break;case Zr.LNGLAT:case Zr.LNGLAT_OFFSETS:t._pseudoMeters||(M.commonUnitsPerMeter=O.unitsPerMeter),M.commonUnitsPerWorldUnit=O.unitsPerDegree,M.commonUnitsPerWorldUnit2=O.unitsPerDegree2;break;case Zr.CARTESIAN:M.commonUnitsPerWorldUnit=[1,1,O.unitsPerMeter[2]],M.commonUnitsPerWorldUnit2=[0,0,O.unitsPerMeter2[2]];break;default:break}}return M}var Lce={};function Fce(t=Lce){return"viewport"in t?rE(t):{}}var dm={name:"project",dependencies:[KR,tE],vs:aV,getUniforms:Fce,uniformTypes:{wrapLongitude:"f32",coordinateSystem:"i32",commonUnitsPerMeter:"vec3<f32>",projectionMode:"i32",scale:"f32",commonUnitsPerWorldUnit:"vec3<f32>",commonUnitsPerWorldUnit2:"vec3<f32>",center:"vec4<f32>",modelMatrix:"mat4x4<f32>",viewProjectionMatrix:"mat4x4<f32>",viewportSize:"vec2<f32>",devicePixelRatio:"f32",focalDistance:"f32",cameraPosition:"vec3<f32>",coordinateOrigin:"vec3<f32>",commonOrigin:"vec3<f32>",pseudoMeters:"f32"}};var Nce=`
vec4 project_position_to_clipspace(
vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition
) {
vec3 projectedPosition = project_position(position, position64Low);
mat3 rotation;
if (project_needs_rotation(projectedPosition, rotation)) {
// offset is specified as ENU
// when in globe projection, rotate offset so that the ground alighs with the surface of the globe
offset = rotation * offset;
}
commonPosition = vec4(projectedPosition + offset, 1.0);
return project_common_position_to_clipspace(commonPosition);
}
vec4 project_position_to_clipspace(
vec3 position, vec3 position64Low, vec3 offset
) {
vec4 commonPosition;
return project_position_to_clipspace(position, position64Low, offset, commonPosition);
}
`,Jn={name:"project32",dependencies:[dm],vs:Nce};function jB(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Up(t,e){let r=tc.transformMat4([],e,t);return tc.scale(r,r,1/r[3]),r}function GB(t,e){let r=t%e;return r<0?e+r:r}function fV(t,e,r){return r*e+(1-r)*t}function kx(t,e,r){return t<e?e:t>r?r:t}function kce(t){return Math.log(t)*Math.LOG2E}var $0=Math.log2||kce;function vf(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}var xf=Math.PI,hV=xf/4,ku=xf/180,WB=180/xf,e_=512,iE=4003e4,t_=85.051129,dV=1.5;function Ux(t){return Math.pow(2,t)}function nE(t){return $0(t)}function La(t){let[e,r]=t;vf(Number.isFinite(e)),vf(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let i=e*ku,n=r*ku,o=e_*(i+xf)/(2*xf),s=e_*(xf+Math.log(Math.tan(hV+n*.5)))/(2*xf);return[o,s]}function xl(t){let[e,r]=t,i=e/e_*(2*xf)-xf,n=2*(Math.atan(Math.exp(r/e_*(2*xf)-xf))-hV);return[i*WB,n*WB]}function zx(t){let{latitude:e}=t;vf(Number.isFinite(e));let r=Math.cos(e*ku);return nE(iE*r)-9}function Vx(t){let e=Math.cos(t*ku);return e_/iE/e}function r_(t){let{latitude:e,longitude:r,highPrecision:i=!1}=t;vf(Number.isFinite(e)&&Number.isFinite(r));let n=e_,o=Math.cos(e*ku),s=n/360,l=s/o,u=n/iE/o,h={unitsPerMeter:[u,u,u],metersPerUnit:[1/u,1/u,1/u],unitsPerDegree:[s,l,u],degreesPerUnit:[1/s,1/l,1/u]};if(i){let v=ku*Math.tan(e*ku)/o,T=s*v/2,E=n/iE*v,M=E/l*u;h.unitsPerDegree2=[0,T,E],h.unitsPerMeter2=[M,0,M]}return h}function Hx(t,e){let[r,i,n]=t,[o,s,l]=e,{unitsPerMeter:u,unitsPerMeter2:h}=r_({longitude:r,latitude:i,highPrecision:!0}),v=La(t);v[0]+=o*(u[0]+h[0]*s),v[1]+=s*(u[1]+h[1]*s);let T=xl(v),E=(n||0)+(l||0);return Number.isFinite(n)||Number.isFinite(l)?[T[0],T[1],E]:T}function oE(t){let{height:e,pitch:r,bearing:i,altitude:n,scale:o,center:s}=t,l=jB();Zs.translate(l,l,[0,0,-n]),Zs.rotateX(l,l,-r*ku),Zs.rotateZ(l,l,i*ku);let u=o/e;return Zs.scale(l,l,[u,u,u]),s&&Zs.translate(l,l,Da.negate([],s)),l}function qB(t){let{width:e,height:r,altitude:i,pitch:n=0,offset:o,center:s,scale:l,nearZMultiplier:u=1,farZMultiplier:h=1}=t,{fovy:v=pm(dV)}=t;i!==void 0&&(v=pm(i));let T=v*ku,E=n*ku,M=Am(v),O=M;s&&(O+=s[2]*l/Math.cos(E)/r);let F=T*(.5+(o?o[1]:0)/r),z=Math.sin(F)*O/Math.sin(kx(Math.PI/2-E-F,.01,Math.PI-.01)),W=Math.sin(E)*z+O,J=O*10,K=Math.min(W*h,J);return{fov:T,aspect:e/r,focalDistance:M,near:u,far:K}}function pm(t){return 2*Math.atan(.5/t)*WB}function Am(t){return .5/Math.tan(.5*t*ku)}function i_(t,e){let[r,i,n=0]=t;return vf(Number.isFinite(r)&&Number.isFinite(i)&&Number.isFinite(n)),Up(e,[r,i,n,1])}function Uu(t,e,r=0){let[i,n,o]=t;if(vf(Number.isFinite(i)&&Number.isFinite(n),"invalid pixel coordinate"),Number.isFinite(o))return Up(e,[i,n,o,1]);let s=Up(e,[i,n,0,1]),l=Up(e,[i,n,1,1]),u=s[2],h=l[2],v=u===h?0:((r||0)-u)/(h-u);return xa.lerp([],s,l,v)}function sE(t){let{width:e,height:r,bounds:i,minExtent:n=0,maxZoom:o=24,offset:s=[0,0]}=t,[[l,u],[h,v]]=i,T=Uce(t.padding),E=La([l,kx(v,-t_,t_)]),M=La([h,kx(u,-t_,t_)]),O=[Math.max(Math.abs(M[0]-E[0]),n),Math.max(Math.abs(M[1]-E[1]),n)],F=[e-T.left-T.right-Math.abs(s[0])*2,r-T.top-T.bottom-Math.abs(s[1])*2];vf(F[0]>0&&F[1]>0);let z=F[0]/O[0],W=F[1]/O[1],J=(T.right-T.left)/2/z,K=(T.top-T.bottom)/2/W,ne=[(M[0]+E[0])/2+J,(M[1]+E[1])/2+K],ge=xl(ne),j=Math.min(o,$0(Math.abs(Math.min(z,W))));return vf(Number.isFinite(j)),{longitude:ge[0],latitude:ge[1],zoom:j}}function Uce(t=0){return typeof t=="number"?{top:t,bottom:t,left:t,right:t}:(vf(Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)&&Number.isFinite(t.right)),t)}var pV=Math.PI/180;function aE(t,e=0){let{width:r,height:i,unproject:n}=t,o={targetZ:e},s=n([0,i],o),l=n([r,i],o),u,h,v=t.fovy?.5*t.fovy*pV:Math.atan(.5/t.altitude),T=(90-t.pitch)*pV;return v>T-.01?(u=AV(t,0,e),h=AV(t,r,e)):(u=n([0,0],o),h=n([r,0],o)),[s,l,h,u]}function AV(t,e,r){let{pixelUnprojectionMatrix:i}=t,n=Up(i,[e,0,1,1]),o=Up(i,[e,t.height,1,1]),l=(r*t.distanceScales.unitsPerMeter[2]-n[2])/(o[2]-n[2]),u=xa.lerp([],n,o,l),h=xl(u);return h.push(r),h}var mV=512;function XB(t){let{width:e,height:r,pitch:i=0}=t,{longitude:n,latitude:o,zoom:s,bearing:l=0}=t;(n<-180||n>180)&&(n=GB(n+180,360)-180),(l<-180||l>180)&&(l=GB(l+180,360)-180);let u=$0(r/mV);if(s<=u)s=u,o=0;else{let h=r/2/Math.pow(2,s),v=xl([0,h])[1];if(o<v)o=v;else{let T=xl([0,mV-h])[1];o>T&&(o=T)}}return{width:e,height:r,longitude:n,latitude:o,zoom:s,pitch:i,bearing:l}}var gV=.01,Vce=["longitude","latitude","zoom"],_V={curve:1.414,speed:1.2};function YB(t,e,r,i){let{startZoom:n,startCenterXY:o,uDelta:s,w0:l,u1:u,S:h,rho:v,rho2:T,r0:E}=yV(t,e,i);if(u<gV){let ne={};for(let ge of Vce){let j=t[ge],me=e[ge];ne[ge]=fV(j,me,r)}return ne}let M=r*h,O=Math.cosh(E)/Math.cosh(E+v*M),F=l*((Math.cosh(E)*Math.tanh(E+v*M)-Math.sinh(E))/T)/u,z=1/O,W=n+nE(z),J=xa.scale([],s,F);xa.add(J,J,o);let K=xl(J);return{longitude:K[0],latitude:K[1],zoom:W}}function KB(t,e,r){let i={..._V,...r},{screenSpeed:n,speed:o,maxDuration:s}=i,{S:l,rho:u}=yV(t,e,i),h=1e3*l,v;return Number.isFinite(n)?v=h/(n/u):v=h/o,Number.isFinite(s)&&v>s?0:v}function yV(t,e,r){r=Object.assign({},_V,r);let i=r.curve,n=t.zoom,o=[t.longitude,t.latitude],s=Ux(n),l=e.zoom,u=[e.longitude,e.latitude],h=Ux(l-n),v=La(o),T=La(u),E=xa.sub([],T,v),M=Math.max(t.width,t.height),O=M/h,F=xa.length(E)*s,z=Math.max(F,gV),W=i*i,J=(O*O-M*M+W*W*z*z)/(2*M*W*z),K=(O*O-M*M-W*W*z*z)/(2*O*W*z),ne=Math.log(Math.sqrt(J*J+1)-J),ge=Math.log(Math.sqrt(K*K+1)-K),j=(ge-ne)/i;return{startZoom:n,startCenterXY:v,uDelta:E,w0:M,u1:F,S:j,rho:i,rho2:W,r0:ne,r1:ge}}var jce=`
const int max_lights = 2;
uniform mat4 shadow_uViewProjectionMatrices[max_lights];
uniform vec4 shadow_uProjectCenters[max_lights];
uniform bool shadow_uDrawShadowMap;
uniform bool shadow_uUseShadowMap;
uniform int shadow_uLightId;
uniform float shadow_uLightCount;
out vec3 shadow_vPosition[max_lights];
vec4 shadow_setVertexPosition(vec4 position_commonspace) {
if (shadow_uDrawShadowMap) {
return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);
}
if (shadow_uUseShadowMap) {
for (int i = 0; i < max_lights; i++) {
if(i < int(shadow_uLightCount)) {
vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);
shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;
}
}
}
return gl_Position;
}
`,Gce=`
const int max_lights = 2;
uniform bool shadow_uDrawShadowMap;
uniform bool shadow_uUseShadowMap;
uniform sampler2D shadow_uShadowMap0;
uniform sampler2D shadow_uShadowMap1;
uniform vec4 shadow_uColor;
uniform float shadow_uLightCount;
in vec3 shadow_vPosition[max_lights];
const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);
const vec4 bitUnpackShift = 1.0 / bitPackShift;
const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);
float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {
vec4 rgbaDepth = texture(shadowMap, position.xy);
float z = dot(rgbaDepth, bitUnpackShift);
return smoothstep(0.001, 0.01, position.z - z);
}
vec4 shadow_filterShadowColor(vec4 color) {
if (shadow_uDrawShadowMap) {
vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);
rgbaDepth -= rgbaDepth.gbaa * bitMask;
return rgbaDepth;
}
if (shadow_uUseShadowMap) {
float shadowAlpha = 0.0;
shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);
if(shadow_uLightCount > 1.0) {
shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);
}
shadowAlpha *= shadow_uColor.a / shadow_uLightCount;
float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);
return vec4(
mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),
blendedAlpha
);
}
return color;
}
`,Wce=Nu(Zce),qce=Nu(Jce),Xce=[0,0,0,1],Yce=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function Kce(t,e){let[r,i,n]=t,o=Uu([r,i,n],e);return Number.isFinite(n)?o:[o[0],o[1],0]}function Zce({viewport:t,center:e}){return new Kr(t.viewProjectionMatrix).invert().transform(e)}function Jce({viewport:t,shadowMatrices:e}){let r=[],i=t.pixelUnprojectionMatrix,n=t.isGeospatial?void 0:1,o=[[0,0,n],[t.width,0,n],[0,t.height,n],[t.width,t.height,n],[0,0,-1],[t.width,0,-1],[0,t.height,-1],[t.width,t.height,-1]].map(s=>Kce(s,i));for(let s of e){let l=s.clone().translate(new ot(t.center).negate()),u=o.map(v=>l.transform(v)),h=new Kr().ortho({left:Math.min(...u.map(v=>v[0])),right:Math.max(...u.map(v=>v[0])),bottom:Math.min(...u.map(v=>v[1])),top:Math.max(...u.map(v=>v[1])),near:Math.min(...u.map(v=>-v[2])),far:Math.max(...u.map(v=>-v[2]))});r.push(h.multiplyRight(s))}return r}function Qce(t,e){let{shadowEnabled:r=!0}=t;if(!r||!t.shadowMatrices||!t.shadowMatrices.length)return{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};let i={shadow_uDrawShadowMap:Boolean(t.drawToShadowMap),shadow_uUseShadowMap:t.shadowMaps?t.shadowMaps.length>0:!1,shadow_uColor:t.shadowColor||Xce,shadow_uLightId:t.shadowLightId||0,shadow_uLightCount:t.shadowMatrices.length},n=Wce({viewport:t.viewport,center:e.center}),o=[],s=qce({shadowMatrices:t.shadowMatrices,viewport:t.viewport}).slice();for(let l=0;l<t.shadowMatrices.length;l++){let u=s[l],h=u.clone().translate(new ot(t.viewport.center).negate());e.coordinateSystem===Zr.LNGLAT&&e.projectionMode===Nl.WEB_MERCATOR?(s[l]=h,o[l]=n):(s[l]=u.clone().multiplyRight(Yce),o[l]=h.transform(n))}for(let l=0;l<s.length;l++)i[`shadow_uViewProjectionMatrices[${l}]`]=s[l],i[`shadow_uProjectCenters[${l}]`]=o[l];for(let l=0;l<2;l++)i[`shadow_uShadowMap${l}`]=t.shadowMaps&&t.shadowMaps[l]||t.dummyShadowMap;return i}var n_={name:"shadow",dependencies:[dm],vs:jce,fs:Gce,inject:{"vs:DECKGL_FILTER_GL_POSITION":`
position = shadow_setVertexPosition(geometry.position);
`,"fs:DECKGL_FILTER_COLOR":`
color = shadow_filterShadowColor(color);
`},getUniforms:(t={},e={})=>"viewport"in t&&(t.drawToShadowMap||t.shadowMaps&&t.shadowMaps.length>0)?Qce(t,e):{}};var go={...zT,defaultUniforms:{...zT.defaultUniforms,useFloatColors:!1},inject:{"vs:DECKGL_FILTER_GL_POSITION":`
// for picking depth values
picking_setPickingAttribute(position.z / position.w);
`,"vs:DECKGL_FILTER_COLOR":`
picking_setPickingColor(geometry.pickingColor);
`,"fs:DECKGL_FILTER_COLOR":{order:99,injection:`
// use highlight color if this fragment belongs to the selected object.
color = picking_filterHighlightColor(color);
// use picking color if rendering to picking FBO.
color = picking_filterPickingColor(color);
`}}};var $ce=[tE],eue=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"];function o_(){let t=Pp.getDefaultShaderAssembler();for(let e of $ce)t.addDefaultModule(e);for(let e of eue)t.addShaderHook(e);return t}var tue=[255,255,255],rue=1,iue=0,s_=class{constructor(e={}){this.type="ambient";let{color:r=tue}=e,{intensity:i=rue}=e;this.id=e.id||`ambient-${iue++}`,this.color=r,this.intensity=i}};var nue=[255,255,255],oue=1,sue=[0,0,-1],aue=0,vd=class{constructor(e={}){this.type="directional";let{color:r=nue}=e,{intensity:i=oue}=e,{direction:n=sue}=e,{_shadow:o=!1}=e;this.id=e.id||`directional-${aue++}`,this.color=r,this.intensity=i,this.type="directional",this.direction=new ot(n).normalize().toArray(),this.shadow=o}getProjectedLight(e){return this}};var mm=class{constructor(e,r={id:"pass"}){let{id:i}=r;this.id=i,this.device=e,this.props={...r}}setProps(e){Object.assign(this.props,e)}render(e){}cleanup(){}};var bf=class extends mm{constructor(){super(...arguments),this._lastRenderIndex=-1}render(e){let[r,i]=this.device.canvasContext.getDrawingBufferSize(),n=e.clearCanvas??!0,o=e.clearColor??(n?[0,0,0,0]:!1),s=n?1:!1,l=n?0:!1,u=e.colorMask??15,h={viewport:[0,0,r,i]};e.colorMask&&(h.colorMask=u),e.scissorRect&&(h.scissorRect=e.scissorRect);let v=this.device.beginRenderPass({framebuffer:e.target,parameters:h,clearColor:o,clearDepth:s,clearStencil:l});try{return this._drawLayers(v,e)}finally{v.end()}}_drawLayers(e,r){let{target:i,moduleParameters:n,viewports:o,views:s,onViewportActive:l,clearStack:u=!0}=r;r.pass=r.pass||"unknown",u&&(this._lastRenderIndex=-1);let h=[];for(let v of o){let T=s&&s[v.id];l?.(v);let E=this._getDrawLayerParams(v,r),M=v.subViewports||[v];for(let O of M){let F=this._drawLayersInViewport(e,{target:i,moduleParameters:n,viewport:O,view:T,pass:r.pass,layers:r.layers},E);h.push(F)}}return h}_getDrawLayerParams(e,{layers:r,pass:i,isPicking:n=!1,layerFilter:o,cullRect:s,effects:l,moduleParameters:u},h=!1){let v=[],T=vV(this._lastRenderIndex+1),E={layer:r[0],viewport:e,isPicking:n,renderPass:i,cullRect:s},M={};for(let O=0;O<r.length;O++){let F=r[O],z=this._shouldDrawLayer(F,E,o,M),W={shouldDrawLayer:z};z&&!h&&(W.layerRenderIndex=T(F,z),W.moduleParameters=this._getModuleParameters(F,l,i,u),W.layerParameters={...F.context.deck?.props.parameters,...this.getLayerParameters(F,O,e)}),v[O]=W}return v}_drawLayersInViewport(e,{layers:r,moduleParameters:i,pass:n,target:o,viewport:s,view:l},u){let h=lue(this.device,{moduleParameters:i,target:o,viewport:s});if(l&&l.props.clear){let T=l.props.clear===!0?{color:!0,depth:!0}:l.props.clear;this.device.withParametersWebGL({scissorTest:!0,scissor:h},()=>this.device.clearWebGL(T))}let v={totalCount:r.length,visibleCount:0,compositeCount:0,pickableCount:0};e.setParameters({viewport:h});for(let T=0;T<r.length;T++){let E=r[T],{shouldDrawLayer:M,layerRenderIndex:O,moduleParameters:F,layerParameters:z}=u[T];if(M&&E.props.pickable&&v.pickableCount++,E.isComposite)v.compositeCount++;else if(M){v.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,O),F.viewport=s,E.context.renderPass=e;try{E._drawLayer({renderPass:e,moduleParameters:F,uniforms:{layerIndex:O},parameters:z})}catch(W){E.raiseError(W,`drawing ${E} to ${n}`)}}}return v}shouldDrawLayer(e){return!0}getModuleParameters(e,r){return null}getLayerParameters(e,r,i){return e.props.parameters}_shouldDrawLayer(e,r,i,n){if(!(e.props.visible&&this.shouldDrawLayer(e)))return!1;r.layer=e;let s=e.parent;for(;s;){if(!s.props.visible||!s.filterSubLayer(r))return!1;r.layer=s,s=s.parent}if(i){let l=r.layer.id;if(l in n||(n[l]=i(r)),!n[l])return!1}return e.activateViewport(r.viewport),!0}_getModuleParameters(e,r,i,n){let o=this.device.canvasContext.cssToDeviceRatio(),s=Object.assign(Object.create(e.internalState?.propsInTransition||e.props),{autoWrapLongitude:e.wrapLongitude,viewport:e.context.viewport,mousePosition:e.context.mousePosition,picking:{isActive:0},devicePixelRatio:o});if(r)for(let l of r)Object.assign(s,l.getModuleParameters?.(e));return Object.assign(s,this.getModuleParameters(e,r),n)}};function vV(t=0,e={}){let r={},i=(n,o)=>{let s=n.props._offset,l=n.id,u=n.parent&&n.parent.id,h;if(u&&!(u in e)&&i(n.parent,!1),u in r){let v=r[u]=r[u]||vV(e[u],e);h=v(n,o),r[l]=v}else Number.isFinite(s)?(h=s+(e[u]||0),r[l]=null):h=t;return o&&h>=t&&(t=h+1),e[l]=h,h};return i}function lue(t,{moduleParameters:e,target:r,viewport:i}){let n=e&&e.devicePixelRatio||t.canvasContext.cssToDeviceRatio(),[,o]=t.canvasContext.getDrawingBufferSize(),s=r?r.height:o,l=i;return[l.x*n,s-(l.y+l.height)*n,l.width*n,l.height*n]}var jx=class extends bf{constructor(e,r){super(e,r),this.shadowMap=e.createTexture({width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.depthBuffer=e.createTexture({format:"depth16unorm",width:1,height:1,mipmaps:!1}),this.fbo=e.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[this.shadowMap],depthStencilAttachment:this.depthBuffer})}render(e){let r=this.fbo,i=this.device.canvasContext.cssToDeviceRatio(),n=e.viewports[0],o=n.width*i,s=n.height*i,l=[1,1,1,1];(o!==r.width||s!==r.height)&&r.resize({width:o,height:s}),super.render({...e,clearColor:l,target:r,pass:"shadow"})}getLayerParameters(e,r,i){return{...e.props.parameters,blend:!1,depthRange:[0,1],depthTest:!0}}shouldDrawLayer(e){return e.props.shadowEnabled!==!1}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.shadowMap&&(this.shadowMap.destroy(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.destroy(),this.depthBuffer=null)}};var cue={color:[255,255,255],intensity:1},xV=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],uue=[0,0,0,200/255],zp=class{constructor(e={}){this.id="lighting-effect",this.shadowColor=uue,this.shadow=!1,this.ambientLight=null,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.shadowMaps=[],this.dummyShadowMap=null,this.setProps(e)}setup(e){this.context=e;let{device:r,deck:i}=e;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(r),i._addDefaultShaderModule(n_),this.dummyShadowMap=r.createTexture({width:1,height:1}))}setProps(e){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(let r in e){let i=e[r];switch(i.type){case"ambient":this.ambientLight=i;break;case"directional":this.directionalLights.push(i);break;case"point":this.pointLights.push(i);break;default:}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(r=>r.shadow),this.context&&this.setup(this.context),this.props=e}preRender({layers:e,layerFilter:r,viewports:i,onViewportActive:n,views:o}){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let s=0;s<this.shadowPasses.length;s++)this.shadowPasses[s].render({layers:e,layerFilter:r,viewports:i,onViewportActive:n,views:o,moduleParameters:{shadowLightId:s,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}})}}getModuleParameters(e){let r=this.shadow?{shadowMaps:this.shadowMaps,dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{};return r.lightSources={ambientLight:this.ambientLight,directionalLights:this.directionalLights.map(i=>i.getProjectedLight({layer:e})),pointLights:this.pointLights.map(i=>i.getProjectedLight({layer:e}))},r}cleanup(e){for(let r of this.shadowPasses)r.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,e.deck._removeDefaultShaderModule(n_))}_calculateMatrices(){let e=[];for(let r of this.directionalLights){let i=new Kr().lookAt({eye:new ot(r.direction).negate()});e.push(i)}return e}_createShadowPasses(e){for(let r=0;r<this.directionalLights.length;r++){let i=new jx(e);this.shadowPasses[r]=i,this.shadowMaps[r]=i.shadowMap}}_applyDefaultLights(){let{ambientLight:e,pointLights:r,directionalLights:i}=this;!e&&r.length===0&&i.length===0&&(this.ambientLight=new s_(cue),this.directionalLights.push(new vd(xV[0]),new vd(xV[1])))}};var ZB=class{constructor(e={}){this._pool=[],this.opts={overAlloc:2,poolSize:100},this.setOptions(e)}setOptions(e){Object.assign(this.opts,e)}allocate(e,r,{size:i=1,type:n,padding:o=0,copy:s=!1,initialize:l=!1,maxCount:u}){let h=n||e&&e.constructor||Float32Array,v=r*i+o;if(ArrayBuffer.isView(e)){if(v<=e.length)return e;if(v*e.BYTES_PER_ELEMENT<=e.buffer.byteLength)return new h(e.buffer,0,v)}let T=1/0;u&&(T=u*i+o);let E=this._allocate(h,v,l,T);return e&&s?E.set(e):l||E.fill(0,0,4),this._release(e),E}release(e){this._release(e)}_allocate(e,r,i,n){let o=Math.max(Math.ceil(r*this.opts.overAlloc),1);o>n&&(o=n);let s=this._pool,l=e.BYTES_PER_ELEMENT*o,u=s.findIndex(h=>h.byteLength>=l);if(u>=0){let h=new e(s.splice(u,1)[0],0,o);return i&&h.fill(0),h}return new e(o)}_release(e){if(!ArrayBuffer.isView(e))return;let r=this._pool,{buffer:i}=e,{byteLength:n}=i,o=r.findIndex(s=>s.byteLength>=n);o<0?r.push(i):(o>0||r.length<this.opts.poolSize)&&r.splice(o,0,i),r.length>this.opts.poolSize&&r.shift()}},wf=new ZB;function l_(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function gm(t,e){let r=t%e;return r<0?e+r:r}function wV(t){return[t[12],t[13],t[14]]}function TV(t){return{left:a_(t[3]+t[0],t[7]+t[4],t[11]+t[8],t[15]+t[12]),right:a_(t[3]-t[0],t[7]-t[4],t[11]-t[8],t[15]-t[12]),bottom:a_(t[3]+t[1],t[7]+t[5],t[11]+t[9],t[15]+t[13]),top:a_(t[3]-t[1],t[7]-t[5],t[11]-t[9],t[15]-t[13]),near:a_(t[3]+t[2],t[7]+t[6],t[11]+t[10],t[15]+t[14]),far:a_(t[3]-t[2],t[7]-t[6],t[11]-t[10],t[15]-t[14])}}var bV=new ot;function a_(t,e,r,i){bV.set(t,e,r);let n=bV.len();return{distance:i/n,normal:new ot(-t/n,-e/n,-r/n)}}function Vp(t){return t-Math.fround(t)}var Gx;function lE(t,e){let{size:r=1,startIndex:i=0}=e,n=e.endIndex!==void 0?e.endIndex:t.length,o=(n-i)/r;Gx=wf.allocate(Gx,o,{type:Float32Array,size:r*2});let s=i,l=0;for(;s<n;){for(let u=0;u<r;u++){let h=t[s++];Gx[l+u]=h,Gx[l+u+r]=Vp(h)}l+=r*2}return Gx.subarray(0,o*r*2)}function EV(t){let e=null,r=!1;for(let i of t)i&&(e?(r||(e=[[e[0][0],e[0][1]],[e[1][0],e[1][1]]],r=!0),e[0][0]=Math.min(e[0][0],i[0][0]),e[0][1]=Math.min(e[0][1],i[0][1]),e[1][0]=Math.max(e[1][0],i[1][0]),e[1][1]=Math.max(e[1][1],i[1][1])):e=i);return e}var fue=Math.PI/180,hue=l_(),SV=[0,0,0],due={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};function pue({width:t,height:e,orthographic:r,fovyRadians:i,focalDistance:n,padding:o,near:s,far:l}){let u=t/e,h=r?new Kr().orthographic({fovy:i,aspect:u,focalDistance:n,near:s,far:l}):new Kr().perspective({fovy:i,aspect:u,near:s,far:l});if(o){let{left:v=0,right:T=0,top:E=0,bottom:M=0}=o,O=Zn((v+t-T)/2,0,t)-t/2,F=Zn((E+e-M)/2,0,e)-e/2;h[8]-=O*2/t,h[9]+=F*2/e}return h}var cE=class{constructor(e={}){this._frustumPlanes={},this.id=e.id||this.constructor.displayName||"viewport",this.x=e.x||0,this.y=e.y||0,this.width=e.width||1,this.height=e.height||1,this.zoom=e.zoom||0,this.padding=e.padding,this.distanceScales=e.distanceScales||due,this.focalDistance=e.focalDistance||1,this.position=e.position||SV,this.modelMatrix=e.modelMatrix||null;let{longitude:r,latitude:i}=e;this.isGeospatial=Number.isFinite(i)&&Number.isFinite(r),this._initProps(e),this._initMatrices(e),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}get subViewports(){return null}get metersPerPixel(){return this.distanceScales.metersPerUnit[2]/this.scale}get projectionMode(){return this.isGeospatial?this.zoom<12?Nl.WEB_MERCATOR:Nl.WEB_MERCATOR_AUTO_OFFSET:Nl.IDENTITY}equals(e){return e instanceof cE?this===e?!0:e.width===this.width&&e.height===this.height&&e.scale===this.scale&&Cs(e.projectionMatrix,this.projectionMatrix)&&Cs(e.viewMatrix,this.viewMatrix):!1}project(e,{topLeft:r=!0}={}){let i=this.projectPosition(e),n=i_(i,this.pixelProjectionMatrix),[o,s]=n,l=r?s:this.height-s;return e.length===2?[o,l]:[o,l,n[2]]}unproject(e,{topLeft:r=!0,targetZ:i}={}){let[n,o,s]=e,l=r?o:this.height-o,u=i&&i*this.distanceScales.unitsPerMeter[2],h=Uu([n,l,s],this.pixelUnprojectionMatrix,u),[v,T,E]=this.unprojectPosition(h);return Number.isFinite(s)?[v,T,E]:Number.isFinite(i)?[v,T,i]:[v,T]}projectPosition(e){let[r,i]=this.projectFlat(e),n=(e[2]||0)*this.distanceScales.unitsPerMeter[2];return[r,i,n]}unprojectPosition(e){let[r,i]=this.unprojectFlat(e),n=(e[2]||0)*this.distanceScales.metersPerUnit[2];return[r,i,n]}projectFlat(e){if(this.isGeospatial){let r=La(e);return r[1]=Zn(r[1],-318,830),r}return e}unprojectFlat(e){return this.isGeospatial?xl(e):e}getBounds(e={}){let r={targetZ:e.z||0},i=this.unproject([0,0],r),n=this.unproject([this.width,0],r),o=this.unproject([0,this.height],r),s=this.unproject([this.width,this.height],r);return[Math.min(i[0],n[0],o[0],s[0]),Math.min(i[1],n[1],o[1],s[1]),Math.max(i[0],n[0],o[0],s[0]),Math.max(i[1],n[1],o[1],s[1])]}getDistanceScales(e){return e?r_({longitude:e[0],latitude:e[1],highPrecision:!0}):this.distanceScales}containsPixel({x:e,y:r,width:i=1,height:n=1}){return e<this.x+this.width&&this.x<e+i&&r<this.y+this.height&&this.y<r+n}getFrustumPlanes(){return this._frustumPlanes.near?this._frustumPlanes:(Object.assign(this._frustumPlanes,TV(this.viewProjectionMatrix)),this._frustumPlanes)}panByPosition(e,r){return null}_initProps(e){let r=e.longitude,i=e.latitude;this.isGeospatial&&(Number.isFinite(e.zoom)||(this.zoom=zx({latitude:i})+Math.log2(this.focalDistance)),this.distanceScales=e.distanceScales||r_({latitude:i,longitude:r}));let n=Math.pow(2,this.zoom);this.scale=n;let{position:o,modelMatrix:s}=e,l=SV;if(o&&(l=s?new Kr(s).transformAsVector(o,[]):o),this.isGeospatial){let u=this.projectPosition([r,i,0]);this.center=new ot(l).scale(this.distanceScales.unitsPerMeter).add(u)}else this.center=this.projectPosition(l)}_initMatrices(e){let{viewMatrix:r=hue,projectionMatrix:i=null,orthographic:n=!1,fovyRadians:o,fovy:s=75,near:l=.1,far:u=1e3,padding:h=null,focalDistance:v=1}=e;this.viewMatrixUncentered=r,this.viewMatrix=new Kr().multiplyRight(r).translate(new ot(this.center).negate()),this.projectionMatrix=i||pue({width:this.width,height:this.height,orthographic:n,fovyRadians:o||s*fue,focalDistance:v,padding:h,near:l,far:u});let T=l_();Zs.multiply(T,T,this.projectionMatrix),Zs.multiply(T,T,this.viewMatrix),this.viewProjectionMatrix=T,this.viewMatrixInverse=Zs.invert([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=wV(this.viewMatrixInverse);let E=l_(),M=l_();Zs.scale(E,E,[this.width/2,-this.height/2,1]),Zs.translate(E,E,[1,-1,0]),Zs.multiply(M,E,this.viewProjectionMatrix),this.pixelProjectionMatrix=M,this.pixelUnprojectionMatrix=Zs.invert(l_(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||ur.warn("Pixel project matrix not invertible")()}},bl=cE;(()=>{cE.displayName="Viewport"})();var Wx=class extends bl{constructor(e={}){let{latitude:r=0,longitude:i=0,zoom:n=0,pitch:o=0,bearing:s=0,nearZMultiplier:l=.1,farZMultiplier:u=1.01,nearZ:h,farZ:v,orthographic:T=!1,projectionMatrix:E,repeat:M=!1,worldOffset:O=0,position:F,padding:z,legacyMeterSizes:W=!1}=e,{width:J,height:K,altitude:ne=1.5}=e,ge=Math.pow(2,n);J=J||1,K=K||1;let j,me=null;if(E)ne=E[5]/2,j=pm(ne);else{e.fovy?(j=e.fovy,ne=Am(j)):j=pm(ne);let $;if(z){let{top:Z=0,bottom:we=0}=z;$=[0,Zn((Z+K-we)/2,0,K)-K/2]}me=qB({width:J,height:K,scale:ge,center:F&&[0,0,F[2]*Vx(r)],offset:$,pitch:o,fovy:j,nearZMultiplier:l,farZMultiplier:u}),Number.isFinite(h)&&(me.near=h),Number.isFinite(v)&&(me.far=v)}let fe=oE({height:K,pitch:o,bearing:s,scale:ge,altitude:ne});O&&(fe=new Kr().translate([512*O,0,0]).multiplyLeft(fe)),super({...e,width:J,height:K,viewMatrix:fe,longitude:i,latitude:r,zoom:n,...me,fovy:j,focalDistance:ne}),this.latitude=r,this.longitude=i,this.zoom=n,this.pitch=o,this.bearing=s,this.altitude=ne,this.fovy=j,this.orthographic=T,this._subViewports=M?[]:null,this._pseudoMeters=W,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){let e=this.getBounds(),r=Math.floor((e[0]+180)/360),i=Math.ceil((e[2]-180)/360);for(let n=r;n<=i;n++){let o=n?new Wx({...this,worldOffset:n}):this;this._subViewports.push(o)}}return this._subViewports}projectPosition(e){if(this._pseudoMeters)return super.projectPosition(e);let[r,i]=this.projectFlat(e),n=(e[2]||0)*Vx(e[1]);return[r,i,n]}unprojectPosition(e){if(this._pseudoMeters)return super.unprojectPosition(e);let[r,i]=this.unprojectFlat(e),n=(e[2]||0)/Vx(i);return[r,i,n]}addMetersToLngLat(e,r){return Hx(e,r)}panByPosition(e,r){let i=Uu(r,this.pixelUnprojectionMatrix),n=this.projectFlat(e),o=xa.add([],n,xa.negate([],i)),s=xa.add([],this.center,o),[l,u]=this.unprojectFlat(s);return{longitude:l,latitude:u}}getBounds(e={}){let r=aE(this,e.z||0);return[Math.min(r[0][0],r[1][0],r[2][0],r[3][0]),Math.min(r[0][1],r[1][1],r[2][1],r[3][1]),Math.max(r[0][0],r[1][0],r[2][0],r[3][0]),Math.max(r[0][1],r[1][1],r[2][1],r[3][1])]}fitBounds(e,r={}){let{width:i,height:n}=this,{longitude:o,latitude:s,zoom:l}=sE({width:i,height:n,bounds:e,...r});return new Wx({width:i,height:n,longitude:o,latitude:s,zoom:l})}},Tc=Wx;(()=>{Wx.displayName="WebMercatorViewport"})();var CV=[0,0,0];function JB(t,e,r=!1){let i=e.projectPosition(t);if(r&&e instanceof Tc){let[n,o,s=0]=t,l=e.getDistanceScales([n,o]);i[2]=s*l.unitsPerMeter[2]}return i}function Aue(t){let{viewport:e,modelMatrix:r,coordinateOrigin:i}=t,{coordinateSystem:n,fromCoordinateSystem:o,fromCoordinateOrigin:s}=t;return n===Zr.DEFAULT&&(n=e.isGeospatial?Zr.LNGLAT:Zr.CARTESIAN),o===void 0&&(o=n),s===void 0&&(s=i),{viewport:e,coordinateSystem:n,coordinateOrigin:i,modelMatrix:r,fromCoordinateSystem:o,fromCoordinateOrigin:s}}function QB(t,{viewport:e,modelMatrix:r,coordinateSystem:i,coordinateOrigin:n,offsetMode:o}){let[s,l,u=0]=t;switch(r&&([s,l,u]=tc.transformMat4([],[s,l,u,1],r)),i){case Zr.LNGLAT:return JB([s,l,u],e,o);case Zr.LNGLAT_OFFSETS:return JB([s+n[0],l+n[1],u+(n[2]||0)],e,o);case Zr.METER_OFFSETS:return JB(Hx(n,[s,l,u]),e,o);case Zr.CARTESIAN:default:return e.isGeospatial?[s+n[0],l+n[1],u+n[2]]:e.projectPosition([s,l,u])}}function uE(t,e){let{viewport:r,coordinateSystem:i,coordinateOrigin:n,modelMatrix:o,fromCoordinateSystem:s,fromCoordinateOrigin:l}=Aue(e),{autoOffset:u=!0}=e,{geospatialOrigin:h=CV,shaderCoordinateOrigin:v=CV,offsetMode:T=!1}=u?HB(r,i,n):{},E=QB(t,{viewport:r,modelMatrix:o,coordinateSystem:s,coordinateOrigin:l,offsetMode:T});if(T){let M=r.projectPosition(h||v);Da.sub(E,E,M)}return E}var mue=[255,255,255],gue=1,_ue=[0,0,1],yue=[0,0,1],vue=0,c_=class{constructor(e={}){this.type="point";let{color:r=mue}=e,{intensity:i=gue}=e,{position:n=yue}=e;this.id=e.id||`point-${vue++}`,this.color=r,this.intensity=i,this.type="point",this.position=n,this.attenuation=xue(e),this.projectedLight={...this}}getProjectedLight({layer:e}){let{projectedLight:r}=this,i=e.context.viewport,{coordinateSystem:n,coordinateOrigin:o}=e.props,s=uE(this.position,{viewport:i,coordinateSystem:n,coordinateOrigin:o,fromCoordinateSystem:i.isGeospatial?Zr.LNGLAT:Zr.CARTESIAN,fromCoordinateOrigin:[0,0,0]});return r.color=this.color,r.intensity=this.intensity,r.position=s,r}};function xue(t){return t.attenuation?t.attenuation:"intensity"in t?[0,0,t.intensity||0]:_ue}var qx=class extends c_{getProjectedLight({layer:e}){let{projectedLight:r}=this,i=e.context.viewport,{coordinateSystem:n,coordinateOrigin:o,modelMatrix:s}=e.props,{cameraPosition:l}=rE({viewport:i,modelMatrix:s,coordinateSystem:n,coordinateOrigin:o});return r.color=this.color,r.intensity=this.intensity,r.position=l,r}};var _m=Math.PI/180,bue=1e3*60*60*24,wue=2440588,Tue=2451545,fE=_m*23.4397,Eue=357.5291,Sue=.98560028,Cue=280.147,Mue=360.9856235;function MV(t,e,r){let i=_m*-r,n=_m*e,o=Pue(t),s=kue(o),l=Lue(o,i)-s.rightAscension;return{azimuth:Oue(l,n,s.declination),altitude:Due(l,n,s.declination)}}function hE(t,e,r){let{azimuth:i,altitude:n}=MV(t,e,r);return[Math.sin(i)*Math.cos(n),Math.cos(i)*Math.cos(n),-Math.sin(n)]}function Iue(t){return(typeof t=="number"?t:t.getTime())/bue-.5+wue}function Pue(t){return Iue(t)-Tue}function Rue(t,e){let r=t;return Math.atan2(Math.sin(r)*Math.cos(fE)-Math.tan(e)*Math.sin(fE),Math.cos(r))}function Bue(t,e){let r=t;return Math.asin(Math.sin(e)*Math.cos(fE)+Math.cos(e)*Math.sin(fE)*Math.sin(r))}function Oue(t,e,r){let i=t,n=e,o=r;return Math.atan2(Math.sin(i),Math.cos(i)*Math.sin(n)-Math.tan(o)*Math.cos(n))}function Due(t,e,r){let i=t,n=e,o=r;return Math.asin(Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos(i))}function Lue(t,e){return _m*(Cue+Mue*t)-e}function Fue(t){return _m*(Eue+Sue*t)}function Nue(t){let e=t,r=_m*(1.9148*Math.sin(e)+.02*Math.sin(2*e)+3e-4*Math.sin(3*e)),i=_m*102.9372;return e+r+i+Math.PI}function kue(t){let e=Fue(t),r=Nue(e);return{declination:Bue(r,0),rightAscension:Rue(r,0)}}var Xx=class extends vd{constructor(e){super(e),this.timestamp=e.timestamp}getProjectedLight({layer:e}){let{viewport:r}=e.context;if(r.resolution&&r.resolution>0){let[n,o,s]=hE(this.timestamp,0,0);this.direction=[n,-s,o]}else{let{latitude:n,longitude:o}=r;this.direction=hE(this.timestamp,n,o)}return this}};var Uue=1,zue=1,ym=class{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(e){let{delay:r=0,duration:i=Number.POSITIVE_INFINITY,rate:n=1,repeat:o=1}=e,s=Uue++,l={time:0,delay:r,duration:i,rate:n,repeat:o};return this._setChannelTime(l,this.time),this.channels.set(s,l),s}removeChannel(e){this.channels.delete(e);for(let[r,i]of this.animations)i.channel===e&&this.detachAnimation(r)}isFinished(e){let r=this.channels.get(e);return r===void 0?!1:this.time>=r.delay+r.duration*r.repeat}getTime(e){if(e===void 0)return this.time;let r=this.channels.get(e);return r===void 0?-1:r.time}setTime(e){this.time=Math.max(0,e);let r=this.channels.values();for(let n of r)this._setChannelTime(n,this.time);let i=this.animations.values();for(let n of i){let{animation:o,channel:s}=n;o.setTime(this.getTime(s))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(e,r){let i=zue++;return this.animations.set(i,{animation:e,channel:r}),e.setTime(this.getTime(r)),i}detachAnimation(e){this.animations.delete(e)}update(e){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=e),this.setTime(this.time+(e-this.lastEngineTime)),this.lastEngineTime=e)}_setChannelTime(e,r){let i=r-e.delay,n=e.duration*e.repeat;i>=n?e.time=e.duration*e.rate:(e.time=Math.max(0,i)%e.duration,e.time*=e.rate)}};var Vue=0,Hue={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>console.error(t),stats:Ll.stats.get(`animation-loop-${Vue++}`),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1},Yx=class{device=null;canvas=null;props;animationProps=null;timeline=null;stats;cpuTime;gpuTime;frameRate;display;needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;constructor(e){if(this.props={...Hue,...e},e=this.props,!e.device)throw new Error("No device provided");let{useDevicePixels:r=!0}=this.props;this.stats=e.stats||new Dl({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:e.autoResizeViewport,autoResizeDrawingBuffer:e.autoResizeDrawingBuffer,useDevicePixels:r}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null)}delete(){this.destroy()}setNeedsRedraw(e){return this.needsRedraw=this.needsRedraw||e,this}setProps(e){return"autoResizeViewport"in e&&(this.props.autoResizeViewport=e.autoResizeViewport||!1),"autoResizeDrawingBuffer"in e&&(this.props.autoResizeDrawingBuffer=e.autoResizeDrawingBuffer||!1),"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1),this}async start(){if(this._running)return this;this._running=!0;try{let e;return this._initialized||(this._initialized=!0,await this._initDevice(),this._initialize(),await this.props.onInitialize(this._getAnimationProps())),this._running?(e!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(e){let r=e instanceof Error?e:new Error("Unknown error");throw this.props.onError(r),r}}stop(){return this._running&&(this.animationProps&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(e){return this.timeline=e,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(e=>{this._resolveNextFrame=e})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_setDisplay(e){this.display&&(this.display.destroy(),this.display.animationLoop=null),e&&(e.animationLoop=this),this.display=e}_requestAnimationFrame(){this._running&&(this._animationFrameId=M3(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(I3(this._animationFrameId),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(e){if(this.display){this.display._renderFrame(e);return}this.props.onRender(this._getAnimationProps()),this.device.submit()}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_initializeAnimationProps(){if(!this.device)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:this.device?.canvasContext?.canvas,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:e,height:r,aspect:i}=this._getSizeAndAspect();(e!==this.animationProps.width||r!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),i!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=e,this.animationProps.height=r,this.animationProps.aspect=i,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.canvasContext?.canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let e=document.createElement("div");document.body.appendChild(e),e.style.position="relative";let r=document.createElement("div");r.style.position="absolute",r.style.left="10px",r.style.bottom="10px",r.style.width="300px",r.style.background="white",this.canvas instanceof HTMLCanvasElement&&e.appendChild(this.canvas),e.appendChild(r);let i=this.props.onAddHTML(r);i&&(r.innerHTML=i)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[e,r]=this.device?.canvasContext?.getPixelSize()||[1,1],i=1,n=this.device?.canvasContext?.canvas;return n&&n.clientHeight?i=n.clientWidth/n.clientHeight:e>0&&r>0&&(i=e/r),{width:e,height:r,aspect:i}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.props.autoResizeDrawingBuffer&&this.device?.canvasContext?.resize({useDevicePixels:this.props.useDevicePixels})}_beginFrameTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()}_endFrameTimers(){this.cpuTime.timeEnd()}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(e){e instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[e.offsetX,e.offsetY])}_onMouseleave(e){this._getAnimationProps()._mousePosition=null}};var dE=class{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(e){this.id=e.id||oa("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&Yi(this.indices.usage===Xi.INDEX)}destroy(){this.indices?.destroy();for(let e of Object.values(this.attributes))e.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(e){return e.byteLength/12}};function IV(t,e){if(e instanceof dE)return e;let r=jue(t,e),{attributes:i,bufferLayout:n}=Gue(t,e);return new dE({topology:e.topology||"triangle-list",bufferLayout:n,vertexCount:e.vertexCount,indices:r,attributes:i})}function jue(t,e){if(!e.indices)return;let r=e.indices.value;return t.createBuffer({usage:Xi.INDEX,data:r})}function Gue(t,e){let r=[],i={};for(let[o,s]of Object.entries(e.attributes)){let l=o;switch(o){case"POSITION":l="positions";break;case"NORMAL":l="normals";break;case"TEXCOORD_0":l="texCoords";break;case"COLOR_0":l="colors";break}i[l]=t.createBuffer({data:s.value,id:`${o}-buffer`});let{value:u,size:h,normalized:v}=s;r.push({name:l,format:E3(u,h,v)})}let n=e._calculateVertexCount(e.attributes,e.indices);return{attributes:i,bufferLayout:r,vertexCount:n}}var pE=class{modules;moduleUniforms;moduleBindings;moduleUniformsChanged;constructor(e){let r=sm(Object.values(e).filter(i=>i.dependencies));for(let i of r)e[i.name]=i;Kt.log(1,"Creating ShaderInputs with modules",Object.keys(e))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(let[i,n]of Object.entries(e)){let o=i;this.moduleUniforms[o]=n.defaultUniforms||{},this.moduleBindings[o]={}}}destroy(){}setProps(e){for(let r of Object.keys(e)){let i=r,n=e[i],o=this.modules[i];if(!o){Kt.warn(`Module ${r} not found`)();continue}let s=this.moduleUniforms[i],l=o.getUniforms?.(n,this.moduleUniforms[i])||n;this.moduleUniforms[i]={...s,...l}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){let e={};for(let r of Object.values(this.moduleBindings))Object.assign(e,r);return e}getDebugTable(){let e={};for(let[r,i]of Object.entries(this.moduleUniforms))for(let[n,o]of Object.entries(i))e[`${r}.${n}`]={type:this.modules[r].uniformTypes?.[n],value:String(o)};return e}};var $B=class{device;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};static getDefaultPipelineFactory(e){return e._lumaData.defaultPipelineFactory=e._lumaData.defaultPipelineFactory||new $B(e),e._lumaData.defaultPipelineFactory}constructor(e){this.device=e}createRenderPipeline(e){let r={...Af.defaultProps,...e},i=this._hashRenderPipeline(r);if(!this._renderPipelineCache[i]){let n=this.device.createRenderPipeline({...r,id:r.id?`${r.id}-cached`:void 0});n.hash=i,this._renderPipelineCache[i]={pipeline:n,useCount:0}}return this._renderPipelineCache[i].useCount++,this._renderPipelineCache[i].pipeline}createComputePipeline(e){let r={...tm.defaultProps,...e},i=this._hashComputePipeline(r);if(!this._computePipelineCache[i]){let n=this.device.createComputePipeline({...r,id:r.id?`${r.id}-cached`:void 0});n.hash=i,this._computePipelineCache[i]={pipeline:n,useCount:0}}return this._computePipelineCache[i].useCount++,this._computePipelineCache[i].pipeline}release(e){let r=e.hash,i=e instanceof tm?this._computePipelineCache:this._renderPipelineCache;i[r].useCount--,i[r].useCount===0&&(i[r].pipeline.destroy(),delete i[r])}_hashComputePipeline(e){return`${this._getHash(e.shader.source)}`}_hashRenderPipeline(e){let r=this._getHash(e.vs.source),i=e.fs?this._getHash(e.fs.source):0,n="-",o=this._getHash(JSON.stringify(e.bufferLayout));switch(this.device.type){case"webgl":return`${r}/${i}V${n}BL${o}`;default:let s=this._getHash(JSON.stringify(e.parameters));return`${r}/${i}V${n}T${e.topology}P${s}BL${o}`}}_getHash(e){return this._hashes[e]===void 0&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}},Kx=$B;Yr(Kx,"defaultProps",{...Af.defaultProps});var eO=class{device;_cache={};static getDefaultShaderFactory(e){return e._lumaData.defaultShaderFactory||=new eO(e),e._lumaData.defaultShaderFactory}constructor(e){this.device=e}createShader(e){let r=this._hashShader(e),i=this._cache[r];if(!i){let n=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[r]=i={shader:n,useCount:0}}return i.useCount++,i.shader}release(e){let r=this._hashShader(e),i=this._cache[r];i&&(i.useCount--,i.useCount===0&&(delete this._cache[r],i.shader.destroy()))}_hashShader(e){return`${e.stage}:${e.source}`}},Zx=eO;Yr(Zx,"defaultProps",{...Sp.defaultProps});function PV(t,e){let r={},i="Values";if(t.attributes.length===0&&!t.varyings?.length)return{"No attributes or varyings":{[i]:"N/A"}};for(let n of t.attributes)if(n){let o=`${n.location} ${n.name}: ${n.type}`;r[`in ${o}`]={[i]:n.stepMode||"vertex"}}for(let n of t.varyings||[]){let o=`${n.location} ${n.name}`;r[`out ${o}`]={[i]:JSON.stringify(n.accessor)}}return r}var Qa=null,tO=null;function RV(t,{id:e,minimap:r,opaque:i,top:n="0",left:o="0",rgbaScale:s=1}){Qa||(Qa=document.createElement("canvas"),Qa.id=e,Qa.title=e,Qa.style.zIndex="100",Qa.style.position="absolute",Qa.style.top=n,Qa.style.left=o,Qa.style.border="blue 1px solid",Qa.style.transform="scaleY(-1)",document.body.appendChild(Qa),tO=Qa.getContext("2d")),(Qa.width!==t.width||Qa.height!==t.height)&&(Qa.width=t.width/2,Qa.height=t.height/2,Qa.style.width="400px",Qa.style.height="400px");let l=t.device.readPixelsToArrayWebGL(t),u=tO.createImageData(t.width,t.height),h=0;for(let v=0;v<l.length;v+=4)u.data[h+v+0]=l[v+0]*s,u.data[h+v+1]=l[v+1]*s,u.data[h+v+2]=l[v+2]*s,u.data[h+v+3]=i?255:l[v+3]*s;tO.putImageData(u,0,0)}var u_=2,Wue=1e4,rO=class{device;id;source;vs;fs;pipelineFactory;shaderFactory;userData={};parameters;topology;bufferLayout;isInstanced=void 0;instanceCount=0;vertexCount;indexBuffer=null;bufferAttributes={};constantAttributes={};bindings={};uniforms={};vertexArray;transformFeedback=null;pipeline;shaderInputs;_uniformStore;_attributeInfos={};_gpuGeometry=null;_getModuleUniforms;props;_pipelineNeedsUpdate="newly created";_needsRedraw="initializing";_destroyed=!1;_lastDrawTimestamp=-1;constructor(e,r){this.props={...rO.defaultProps,...r},r=this.props,this.id=r.id||oa("model"),this.device=e,Object.assign(this.userData,r.userData);let i=Object.fromEntries(this.props.modules?.map(l=>[l.name,l])||[]);this.setShaderInputs(r.shaderInputs||new pE(i));let n=que(e),o=(this.props.modules?.length>0?this.props.modules:this.shaderInputs?.getModules())||[];if(this.device.type==="webgpu"&&this.props.source){this.props.shaderLayout||=YR(this.props.source);let{source:l,getUniforms:u}=this.props.shaderAssembler.assembleShader({platformInfo:n,...this.props,modules:o});this.source=l,this._getModuleUniforms=u}else{let{vs:l,fs:u,getUniforms:h}=this.props.shaderAssembler.assembleShaderPair({platformInfo:n,...this.props,modules:o});this.vs=l,this.fs=u,this._getModuleUniforms=h}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&this.setGeometry(r.geometry),this.pipelineFactory=r.pipelineFactory||Kx.getDefaultPipelineFactory(this.device),this.shaderFactory=r.shaderFactory||Zx.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in r&&(this.isInstanced=r.isInstanced),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.vertexCount&&this.setVertexCount(r.vertexCount),r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&this.updateModuleSettings(r.moduleSettings),r.transformFeedback&&(this.transformFeedback=r.transformFeedback),Object.seal(this)}destroy(){this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),this._gpuGeometry?.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");let e=this._needsRedraw;return this._needsRedraw=!1,e}setNeedsRedraw(e){this._needsRedraw||=e}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(e){this.predraw();let r;try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings,{disableWarnings:this.props.disableWarnings}),wp(this.uniforms)||this.pipeline.setUniformsWebGL(this.uniforms);let{indexBuffer:i}=this.vertexArray,n=i?i.byteLength/(i.indexType==="uint32"?4:2):void 0;r=this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:n,transformFeedback:this.transformFeedback||void 0,parameters:this.parameters,topology:this.topology})}finally{this._logDrawCallEnd()}return this._logFramebuffer(e),r?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):this._needsRedraw="waiting for resource initialization",r}setGeometry(e){this._gpuGeometry?.destroy();let r=e&&IV(this.device,e);r&&(this.setTopology(r.topology||"triangle-list"),this.bufferLayout=BV(r.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r)),this._gpuGeometry=r}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){this.bufferLayout=this._gpuGeometry?BV(e,this._gpuGeometry.bufferLayout):e,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(e){fx(e,this.parameters,2)||(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setInstanceCount(e){this.instanceCount=e,this.isInstanced===void 0&&e>0&&(this.isInstanced=!0),this.setNeedsRedraw("instanceCount")}setVertexCount(e){this.vertexCount=e,this.setNeedsRedraw("vertexCount")}setShaderInputs(e){this.shaderInputs=e,this._uniformStore=new ax(this.shaderInputs.modules);for(let r of Object.keys(this.shaderInputs.modules)){let i=this._uniformStore.getManagedUniformBuffer(this.device,r);this.bindings[`${r}Uniforms`]=i}this.setNeedsRedraw("shaderInputs")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setNeedsRedraw("shaderInputs")}setBindings(e){Object.assign(this.bindings,e),this.setNeedsRedraw("bindings")}setTransformFeedback(e){this.transformFeedback=e,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(e){this.vertexArray.setIndexBuffer(e),this.setNeedsRedraw("indexBuffer")}setAttributes(e,r){e.indices&&Kt.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(let[i,n]of Object.entries(e)){let o=this.bufferLayout.find(u=>OV(u).includes(i));if(!o){Kt.warn(`Model(${this.id}): Missing layout for buffer "${i}".`)();continue}let s=OV(o),l=!1;for(let u of s){let h=this._attributeInfos[u];h&&(this.vertexArray.setBuffer(h.location,n),l=!0)}!l&&!(r?.disableWarnings??this.props.disableWarnings)&&Kt.warn(`Model(${this.id}): Ignoring buffer "${n.id}" for unknown attribute "${i}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(e,r){for(let[i,n]of Object.entries(e)){let o=this._attributeInfos[i];o?this.vertexArray.setConstantWebGL(o.location,n):(r?.disableWarnings??this.props.disableWarnings)||Kt.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${i}"`)()}this.setNeedsRedraw("constants")}setUniforms(e){wp(e)||(this.pipeline.setUniformsWebGL(e),Object.assign(this.uniforms,e)),this.setNeedsRedraw("uniforms")}updateModuleSettings(e){let{bindings:r,uniforms:i}=cx(this._getModuleUniforms(e));Object.assign(this.bindings,r),Object.assign(this.uniforms,i),this.setNeedsRedraw("moduleSettings")}_getBindingsUpdateTimestamp(){let e=0;for(let r of Object.values(this.bindings))r instanceof Ep?e=Math.max(e,r.texture.updateTimestamp):r instanceof Xi||r instanceof bo?e=Math.max(e,r.updateTimestamp):r instanceof Cp||(e=Math.max(e,r.buffer.updateTimestamp));return e}_setGeometryAttributes(e){let r={...e.attributes};for(let[i]of Object.entries(r))!this.pipeline.shaderLayout.attributes.find(n=>n.name===i)&&i!=="positions"&&delete r[i];this.vertexCount=e.vertexCount,this.setIndexBuffer(e.indices||null),this.setAttributes(e.attributes,{disableWarnings:!0}),this.setAttributes(r,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate||=e,this.setNeedsRedraw(e)}_updatePipeline(){if(this._pipelineNeedsUpdate){let e=null,r=null;this.pipeline&&(Kt.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),e=this.pipeline.vs,r=this.pipeline.fs),this._pipelineNeedsUpdate=!1;let i=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debug:this.props.debugShaders}),n=null;this.source?n=i:this.fs&&(n=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debug:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:i,fs:n}),this._attributeInfos=W2(this.pipeline.shaderLayout,this.bufferLayout),e&&this.shaderFactory.release(e),r&&this.shaderFactory.release(r)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){let e=Kt.level>3?0:Wue;Kt.level<2||Date.now()-this._lastLogTime<e||(this._lastLogTime=Date.now(),this._logOpen=!0,Kt.group(u_,`>>> DRAWING MODEL ${this.id}`,{collapsed:Kt.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let e=PV(this.pipeline.shaderLayout,this.id);Kt.table(u_,e)();let r=this.shaderInputs.getDebugTable();for(let[n,o]of Object.entries(this.uniforms))r[n]={value:o};Kt.table(u_,r)();let i=this._getAttributeDebugTable();Kt.table(u_,this._attributeInfos)(),Kt.table(u_,i)(),Kt.groupEnd(u_)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(e){let r=Kt.get("framebuffer");if(this._drawCount++,!r||this._drawCount++>3&&this._drawCount%60)return;let i=e.props.framebuffer;i&&RV(i,{id:i.id,minimap:!0})}_getAttributeDebugTable(){let e={};for(let[r,i]of Object.entries(this._attributeInfos))e[i.location]={name:r,type:i.shaderType,values:this._getBufferOrConstantValues(this.vertexArray.attributes[i.location],i.bufferDataType)};if(this.vertexArray.indexBuffer){let{indexBuffer:r}=this.vertexArray,i=r.indexType==="uint32"?new Uint32Array(r.debugData):new Uint16Array(r.debugData);e.indices={name:"indices",type:r.indexType,values:i.toString()}}return e}_getBufferOrConstantValues(e,r){let i=lx(r);return(e instanceof Xi?new i(e.debugData):e).toString()}},Ni=rO;Yr(Ni,"defaultProps",{...Af.defaultProps,source:null,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],isInstanced:void 0,instanceCount:0,vertexCount:0,shaderInputs:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:Pp.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0});function BV(t,e){let r=[...t];for(let i of e){let n=r.findIndex(o=>o.name===i.name);n<0?r.push(i):r[n]=i}return r}function que(t){return{type:t.type,shaderLanguage:t.info.shadingLanguage,shaderLanguageVersion:t.info.shadingLanguageVersion,gpu:t.info.gpu,features:t.features}}function OV(t){return t.attributes?t.attributes?.map(e=>e.attribute):[t.name]}var zu=class{device;model;transformFeedback;static isSupported(e){return e?.info?.type==="webgl"}constructor(e,r=Ni.defaultProps){Yi(zu.isSupported(e),"BufferTransform not yet implemented on WebGPU"),this.device=e,this.model=new Ni(this.device,{id:r.id||"buffer-transform-model",fs:r.fs||Ex(),topology:r.topology||"point-list",...r}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:r.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(e){let r=this.device.beginRenderPass(e);this.model.draw(r),r.end()}update(...e){console.warn("TextureTransform#update() not implemented")}getBuffer(e){return this.transformFeedback.getBuffer(e)}readAsync(e){let r=this.getBuffer(e);if(r instanceof Xi)return r.readAsync();let{buffer:i,byteOffset:n=0,byteLength:o=i.byteLength}=r;return i.readAsync(n,o)}};var Xue="transform_output",Mh=class{device;model;sampler;currentIndex=0;samplerTextureMap=null;bindings=[];resources={};constructor(e,r){this.device=e,this.sampler=e.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new Ni(this.device,{id:r.id||"texture-transform-model",fs:r.fs||Ex({input:r.targetTextureVarying,inputChannels:r.targetTextureChannels,output:Xue}),vertexCount:r.vertexCount,...r}),this._initialize(r),Object.seal(this)}destroy(){}delete(){this.destroy()}run(e){let{framebuffer:r}=this.bindings[this.currentIndex],i=this.device.beginRenderPass({framebuffer:r,...e});this.model.draw(i),i.end()}update(...e){console.warn("TextureTransform#update() not implemented")}getData({packed:e=!1}={}){throw new Error("getData() not implemented")}getTargetTexture(){let{targetTexture:e}=this.bindings[this.currentIndex];return e}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(e){this._updateBindings(e)}_updateBindings(e){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],e)}_updateBinding(e,{sourceBuffers:r,sourceTextures:i,targetTexture:n}){if(e||(e={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(e.sourceTextures,i),Object.assign(e.sourceBuffers,r),n){e.targetTexture=n;let{width:o,height:s}=n;e.framebuffer&&e.framebuffer.destroy(),e.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:o,height:s,colorAttachments:[n]}),e.framebuffer.resize({width:o,height:s})}return e}_setSourceTextureParameters(){let e=this.currentIndex,{sourceTextures:r}=this.bindings[e];for(let i in r)r[i].sampler=this.sampler}};var Fn=class{id;topology;vertexCount;indices;attributes;userData={};constructor(e){let{attributes:r={},indices:i=null,vertexCount:n=null}=e;this.id=e.id||oa("geometry"),this.topology=e.topology,i&&(this.indices=ArrayBuffer.isView(i)?{value:i,size:1}:i),this.attributes={};for(let[o,s]of Object.entries(r)){let l=ArrayBuffer.isView(s)?{value:s}:s;Yi(ArrayBuffer.isView(l.value),`${this._print(o)}: must be typed array or object with value as typed array`),(o==="POSITION"||o==="positions")&&!l.size&&(l.size=3),o==="indices"?(Yi(!this.indices),this.indices=l):this.attributes[o]=l}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=n||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,r){return this}_calculateVertexCount(e,r){if(r)return r.value.length;let i=1/0;for(let n of Object.values(e)){let{value:o,size:s,constant:l}=n;!l&&o&&s>=1&&(i=Math.min(i,o.length/s))}return Yi(Number.isFinite(i)),i}};var Yue=`#version 300 es
in vec2 aClipSpacePosition;
in vec2 aTexCoord;
in vec2 aCoordinate;
out vec2 position;
out vec2 coordinate;
out vec2 uv;
void main(void) {
gl_Position = vec4(aClipSpacePosition, 0., 1.);
position = aClipSpacePosition;
coordinate = aCoordinate;
uv = aTexCoord;
}
`,DV=[-1,-1,1,-1,-1,1,1,1],Jx=class extends Ni{constructor(e,r){let i=DV.map(n=>n===-1?0:n);super(e,{...r,vs:Yue,vertexCount:4,geometry:new Fn({topology:"triangle-strip",vertexCount:4,attributes:{aClipSpacePosition:{size:2,value:new Float32Array(DV)},aTexCoord:{size:2,value:new Float32Array(i)},aCoordinate:{size:2,value:new Float32Array(i)}}})})}};var Vu=class{id;matrix=new Kr;display=!0;position=new ot;rotation=new ot;scale=new ot(1,1,1);userData={};props={};constructor(e={}){let{id:r}=e;this.id=r||oa(this.constructor.name),this._setScenegraphNodeProps(e)}getBounds(){return null}destroy(){}delete(){this.destroy()}setProps(e){return this._setScenegraphNodeProps(e),this}toString(){return`{type: ScenegraphNode, id: ${this.id})}`}setPosition(e){return Yi(e.length===3,"setPosition requires vector argument"),this.position=e,this}setRotation(e){return Yi(e.length===3,"setRotation requires vector argument"),this.rotation=e,this}setScale(e){return Yi(e.length===3,"setScale requires vector argument"),this.scale=e,this}setMatrix(e,r=!0){r?this.matrix.copy(e):this.matrix=e}setMatrixComponents(e){let{position:r,rotation:i,scale:n,update:o=!0}=e;return r&&this.setPosition(r),i&&this.setRotation(i),n&&this.setScale(n),o&&this.updateMatrix(),this}updateMatrix(){let e=this.position,r=this.rotation,i=this.scale;return this.matrix.identity(),this.matrix.translate(e),this.matrix.rotateXYZ(r),this.matrix.scale(i),this}update(e={}){let{position:r,rotation:i,scale:n}=e;return r&&this.setPosition(r),i&&this.setRotation(i),n&&this.setScale(n),this.updateMatrix(),this}getCoordinateUniforms(e,r){Yi(e),r=r||this.matrix;let i=new Kr(e).multiplyRight(r),n=i.invert(),o=n.transpose();return{viewMatrix:e,modelMatrix:r,objectMatrix:r,worldMatrix:i,worldInverseMatrix:n,worldInverseTransposeMatrix:o}}_setScenegraphNodeProps(e){"display"in e&&(this.display=e.display),"position"in e&&this.setPosition(e.position),"rotation"in e&&this.setRotation(e.rotation),"scale"in e&&this.setScale(e.scale),"matrix"in e&&this.setMatrix(e.matrix),Object.assign(this.props,e)}};var Qc=class extends Vu{children;constructor(e={}){e=Array.isArray(e)?{children:e}:e;let{children:r=[]}=e;Kt.assert(r.every(i=>i instanceof Vu),"every child must an instance of ScenegraphNode"),super(e),this.children=r}getBounds(){let e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];return this.traverse((r,{worldMatrix:i})=>{let n=r.getBounds();if(!n)return;let[o,s]=n,l=new ot(o).add(s).divide([2,2,2]);i.transformAsPoint(l,l);let u=new ot(s).subtract(o).divide([2,2,2]);i.transformAsVector(u,u);for(let h=0;h<8;h++){let v=new ot(h&1?-1:1,h&2?-1:1,h&4?-1:1).multiply(u).add(l);for(let T=0;T<3;T++)e[0][T]=Math.min(e[0][T],v[T]),e[1][T]=Math.max(e[1][T],v[T])}}),Number.isFinite(e[0][0])?e:null}destroy(){this.children.forEach(e=>e.destroy()),this.removeAll(),super.destroy()}add(...e){for(let r of e)Array.isArray(r)?this.add(...r):this.children.push(r);return this}remove(e){let r=this.children,i=r.indexOf(e);return i>-1&&r.splice(i,1),this}removeAll(){return this.children=[],this}traverse(e,{worldMatrix:r=new Kr}={}){let i=new Kr(r).multiplyRight(this.matrix);for(let n of this.children)n instanceof Qc?n.traverse(e,{worldMatrix:i}):e(n,{worldMatrix:i})}};var Ih=class extends Vu{model;bounds=null;managedResources;constructor(e){super(e),this.model=e.model,this.managedResources=e.managedResources||[],this.bounds=e.bounds||null,this.setProps(e)}getBounds(){return this.bounds}destroy(){this.model&&(this.model.destroy(),this.model=null),this.managedResources.forEach(e=>e.destroy()),this.managedResources=[]}draw(e){return this.model.draw(e)}};var xd=class extends Fn{constructor(e={}){let{id:r=oa("cube-geometry"),indices:i=!0}=e;super(i?{...e,id:r,topology:"triangle-list",indices:{size:1,value:Kue},attributes:{...rfe,...e.attributes}}:{...e,id:r,topology:"triangle-list",indices:void 0,attributes:{...ife,...e.attributes}})}},Kue=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),Zue=new Float32Array([-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,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,-1,1,-1,1,1,-1,1,-1]),Jue=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),Que=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),$ue=new Float32Array([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,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,-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,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1]),efe=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),tfe=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),rfe={POSITION:{size:3,value:Zue},NORMAL:{size:3,value:Jue},TEXCOORD_0:{size:2,value:Que}},ife={POSITION:{size:3,value:$ue},TEXCOORD_0:{size:2,value:efe},COLOR_0:{size:3,value:tfe}};var Qx=class extends Fn{constructor(e={}){let{id:r=oa("sphere-geometry")}=e,{indices:i,attributes:n}=nfe(e);super({...e,id:r,topology:"triangle-list",indices:i,attributes:{...n,...e.attributes}})}};function nfe(t){let{nlat:e=10,nlong:r=10}=t,o=Math.PI-0,s=0,u=2*Math.PI-s,h=(e+1)*(r+1),v=(W,J,K,ne,ge)=>t.radius||1,T=new Float32Array(h*3),E=new Float32Array(h*3),M=new Float32Array(h*2),O=h>65535?Uint32Array:Uint16Array,F=new O(e*r*6);for(let W=0;W<=e;W++)for(let J=0;J<=r;J++){let K=J/r,ne=W/e,ge=J+W*(r+1),j=ge*2,me=ge*3,fe=u*K,$=o*ne,Z=Math.sin(fe),we=Math.cos(fe),Oe=Math.sin($),he=Math.cos($),Le=we*Oe,ft=he,Vt=Z*Oe,Yt=v(Le,ft,Vt,K,ne);T[me+0]=Yt*Le,T[me+1]=Yt*ft,T[me+2]=Yt*Vt,E[me+0]=Le,E[me+1]=ft,E[me+2]=Vt,M[j+0]=K,M[j+1]=1-ne}let z=r+1;for(let W=0;W<r;W++)for(let J=0;J<e;J++){let K=(W*e+J)*6;F[K+0]=J*z+W,F[K+1]=J*z+W+1,F[K+2]=(J+1)*z+W,F[K+3]=(J+1)*z+W,F[K+4]=J*z+W+1,F[K+5]=(J+1)*z+W+1}return{indices:{size:1,value:F},attributes:{POSITION:{size:3,value:T},NORMAL:{size:3,value:E},TEXCOORD_0:{size:2,value:M}}}}var $x=class extends mm{constructor(e,r){super(e,r);let{module:i,fs:n,id:o}=r,s={depthWriteEnabled:!1,depthCompare:"always"};this.model=new Jx(e,{id:o,fs:n,modules:[i],parameters:s})}render(e){this._renderPass(this.device,e)}delete(){this.model.destroy(),this.model=null}_renderPass(e,r){let{clearCanvas:i,inputBuffer:n,outputBuffer:o}=r,s=[n.width,n.height];this.model.shaderInputs.setProps(r.moduleSettings),this.model.setBindings({texSrc:n.colorAttachments[0]}),this.model.setUniforms({texSize:s});let l=this.device.beginRenderPass({framebuffer:o,parameters:{viewport:[0,0,...s]},clearColor:i?[0,0,0,0]:!1,clearDepth:1});this.model.draw(l),l.end()}};var e1=class{constructor(e,r){this.id=`${e.name}-pass`,this.props=r,dR(e),this.module=e}setup({device:e}){this.passes=ofe(e,this.module,this.id)}setProps(e){this.props=e}preRender(){}postRender(e){let r=this.passes,{target:i}=e,n=e.inputBuffer,o=e.swapBuffer;for(let s=0;s<r.length;s++){let l=s===r.length-1,u=i!==void 0&&l;u&&(o=i);let h=!u||Boolean(e.clearCanvas),v={},T=this.module.passes[s].uniforms;v[this.module.name]={...this.props,...T},r[s].render({clearCanvas:h,inputBuffer:n,outputBuffer:o,moduleSettings:v});let E=o;o=n,n=E}return n}cleanup(){if(this.passes){for(let e of this.passes)e.delete();this.passes=void 0}}};function ofe(t,e,r){return e.passes.map((i,n)=>{let o=lfe(e,i),s=`${r}-${n}`;return new $x(t,{id:s,module:e,fs:o})})}var LV=`#version 300 es
uniform sampler2D texSrc;
uniform vec2 texSize;
in vec2 position;
in vec2 coordinate;
in vec2 uv;
out vec4 fragColor;
`,sfe=t=>`${LV}
void main() {
fragColor = texture(texSrc, coordinate);
fragColor = ${t}(fragColor, texSize, coordinate);
}
`,afe=t=>`${LV}
void main() {
fragColor = ${t}(texSrc, texSize, coordinate);
}
`;function lfe(t,e){if(e.filter){let r=typeof e.filter=="string"?e.filter:`${t.name}_filterColor`;return sfe(r)}if(e.sampler){let r=typeof e.sampler=="string"?e.sampler:`${t.name}_sampleColor`;return afe(r)}return""}var cfe={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant-alpha",blendAlphaDstFactor:"zero"},bd=class extends bf{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):super.render(e)}_drawPickingBuffer({layers:e,layerFilter:r,views:i,viewports:n,onViewportActive:o,pickingFBO:s,deviceRect:{x:l,y:u,width:h,height:v},cullRect:T,effects:E,pass:M="picking",pickZ:O,moduleParameters:F}){this.pickZ=O;let z=this._resetColorEncoder(O),W=[l,u,h,v],J=super.render({target:s,layers:e,layerFilter:r,views:i,viewports:n,onViewportActive:o,cullRect:T,effects:E?.filter(ne=>ne.useInPicking),pass:M,isPicking:!0,moduleParameters:F,clearColor:[0,0,0,0],colorMask:15,scissorRect:W});return this._colorEncoderState=null,{decodePickingColor:z&&ffe.bind(null,z),stats:J}}shouldDrawLayer(e){let{pickable:r,operation:i}=e.props;return r&&i.includes("draw")||i.includes("terrain")||i.includes("mask")}getModuleParameters(){return{picking:{isActive:1,isAttribute:this.pickZ},lightSources:{}}}getLayerParameters(e,r,i){let n={depthMask:!0,depthTest:!0,depthRange:[0,1],...e.props.parameters},{pickable:o,operation:s}=e.props;return!this._colorEncoderState||s.includes("terrain")?n.blend=!1:o&&s.includes("draw")&&(Object.assign(n,cfe),n.blend=!0,n.blendColor=ufe(this._colorEncoderState,e,i)),n}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function ufe(t,e,r){let{byLayer:i,byAlpha:n}=t,o,s=i.get(e);return s?(s.viewports.push(r),o=s.a):(o=i.size+1,o<=255?(s={a:o,layer:e,viewports:[r]},i.set(e,s),n[o]=s):(ur.warn("Too many pickable layers, only picking the first 255")(),o=0)),[0,0,0,o/255]}function ffe(t,e){let r=t.byAlpha[e[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(e)}}var Hp={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},f_=Symbol.for("component"),Hu=Symbol.for("propTypes"),AE=Symbol.for("deprecatedProps"),wd=Symbol.for("asyncPropDefaults"),Ph=Symbol.for("asyncPropOriginal"),Tf=Symbol.for("asyncPropResolved");function Rh(t,e=()=>!0){return Array.isArray(t)?FV(t,e,[]):e(t)?[t]:[]}function FV(t,e,r){let i=-1;for(;++i<t.length;){let n=t[i];Array.isArray(n)?FV(n,e,r):e(n)&&r.push(n)}return r}function mE({target:t,source:e,start:r=0,count:i=1}){let n=e.length,o=i*n,s=0;for(let l=r;s<n;s++)t[l++]=e[s];for(;s<o;)s<o-s?(t.copyWithin(r+s,r,r+s),s*=2):(t.copyWithin(r+s,r,r+o-s),s=o);return t}var t1=class{constructor(e,r,i){this._loadCount=0,this._subscribers=new Set,this.id=e,this.context=i,this.setData(r)}subscribe(e){this._subscribers.add(e)}unsubscribe(e){this._subscribers.delete(e)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(e,r){if(e===this._data&&!r)return;this._data=e;let i=++this._loadCount,n=e;typeof e=="string"&&(n=_a(e)),n instanceof Promise?(this.isLoaded=!1,this._loader=n.then(o=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=o)}).catch(o=>{this._loadCount===i&&(this.isLoaded=!0,this._error=o||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=e);for(let o of this._subscribers)o.onChange(this.getData())}};var r1=class{constructor(e){this.protocol=e.protocol||"resource://",this._context={device:e.device,gl:e.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(e){return e.startsWith(this.protocol)?!0:e in this._resources}add({resourceId:e,data:r,forceUpdate:i=!1,persistent:n=!0}){let o=this._resources[e];o?o.setData(r,i):(o=new t1(e,r,this._context),this._resources[e]=o),o.persistent=n}remove(e){let r=this._resources[e];r&&(r.delete(),delete this._resources[e])}unsubscribe({consumerId:e}){let r=this._consumers[e];if(r){for(let i in r){let n=r[i],o=this._resources[n.resourceId];o&&o.unsubscribe(n)}delete this._consumers[e],this.prune()}}subscribe({resourceId:e,onChange:r,consumerId:i,requestId:n="default"}){let{_resources:o,protocol:s}=this;e.startsWith(s)&&(e=e.replace(s,""),o[e]||this.add({resourceId:e,data:null,persistent:!1}));let l=o[e];if(this._track(i,n,l,r),l)return l.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let e in this._resources)this._resources[e].delete()}_track(e,r,i,n){let o=this._consumers,s=o[e]=o[e]||{},l=s[r],u=l&&l.resourceId&&this._resources[l.resourceId];u&&(u.unsubscribe(l),this.prune()),i&&(l?(l.onChange=n,l.resourceId=i.id):l={onChange:n,resourceId:i.id},s[r]=l,i.subscribe(l))}_prune(){this._pruneRequest=null;for(let e of Object.keys(this._resources)){let r=this._resources[e];!r.persistent&&!r.inUse()&&(r.delete(),delete this._resources[e])}}};var hfe="layerManager.setLayers",dfe="layerManager.activateViewport",vm=class{constructor(e,r){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=l=>{Ks(dfe,this,l),l&&(this.context.viewport=l)};let{deck:i,stats:n,viewport:o,timeline:s}=r||{};this.layers=[],this.resourceManager=new r1({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e?.gl,deck:i,shaderAssembler:o_(),defaultShaderModules:[],renderPass:void 0,stats:n||new Dl({id:"deck.gl"}),viewport:o||new bl({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:s||new ym,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let e of this.layers)this._finalizeLayer(e)}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);for(let i of this.layers){let n=i.getNeedsRedraw(e);r=r||n}return r}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(e){this._needsRedraw=this._needsRedraw||e}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e}getLayers({layerIds:e}={}){return e?this.layers.filter(r=>e.find(i=>r.id.indexOf(i)===0)):this.layers}setProps(e){"debug"in e&&(this._debug=e.debug),"userData"in e&&(this.context.userData=e.userData),"layers"in e&&(this._nextLayers=e.layers),"onError"in e&&(this.context.onError=e.onError)}setLayers(e,r){Ks(hfe,this,r,e),this._lastRenderedLayers=e;let i=Rh(e,Boolean);for(let n of i)n.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){let e=this.needsUpdate();e&&(this.setNeedsRedraw(`updating layers: ${e}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,e)),this._nextLayers=null}addDefaultShaderModule(e){let{defaultShaderModules:r}=this.context;r.find(i=>i.name===e.name)||(r.push(e),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(e){let{defaultShaderModules:r}=this.context,i=r.findIndex(n=>n.name===e.name);i>=0&&(r.splice(i,1),this._defaultShaderModulesChanged=!0)}_handleError(e,r,i){i.raiseError(r,`${e} of ${i}`)}_updateLayers(e,r){let i={};for(let s of e)i[s.id]?ur.warn(`Multiple old layers with same id ${s.id}`)():i[s.id]=s;if(this._defaultShaderModulesChanged){for(let s of e)s.setNeedsUpdate(),s.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}let n=[];this._updateSublayersRecursively(r,i,n),this._finalizeOldLayers(i);let o=!1;for(let s of n)if(s.hasUniformTransition()){o=`Uniform transition in ${s}`;break}this._needsUpdate=o,this.layers=n}_updateSublayersRecursively(e,r,i){for(let n of e){n.context=this.context;let o=r[n.id];o===null&&ur.warn(`Multiple new layers with same id ${n.id}`)(),r[n.id]=null;let s=null;try{this._debug&&o!==n&&n.validateProps(),o?(this._transferLayerState(o,n),this._updateLayer(n)):this._initializeLayer(n),i.push(n),s=n.isComposite?n.getSubLayers():null}catch(l){this._handleError("matching",l,n)}s&&this._updateSublayersRecursively(s,r,i)}}_finalizeOldLayers(e){for(let r in e){let i=e[r];i&&this._finalizeLayer(i)}}_initializeLayer(e){try{e._initialize(),e.lifecycle=Hp.INITIALIZED}catch(r){this._handleError("initialization",r,e)}}_transferLayerState(e,r){r._transferState(e),r.lifecycle=Hp.MATCHED,r!==e&&(e.lifecycle=Hp.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(r){this._handleError("update",r,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=Hp.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=Hp.FINALIZED}catch(r){this._handleError("finalization",r,e)}}};function Ls(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!Ls(t[i],e[i],r-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof t=="object"&&typeof e=="object"){let i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(let o of i)if(!e.hasOwnProperty(o)||!Ls(t[o],e[o],r-1))return!1;return!0}return!1}var i1=class{constructor(e){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=e.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=e.eventManager,this._eventCallbacks={onViewStateChange:e.onViewStateChange,onInteractionStateChange:e.onInteractionStateChange},Object.seal(this),this.setProps(e)}finalize(){for(let e in this.controllers){let r=this.controllers[e];r&&r.finalize()}this.controllers={}}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e,this._needsRedraw=this._needsRedraw||e}updateViewStates(){for(let e in this.controllers){let r=this.controllers[e];r&&r.updateTransition()}}getViewports(e){return e?this._viewports.filter(r=>r.containsPixel(e)):this._viewports}getViews(){let e={};return this.views.forEach(r=>{e[r.id]=r}),e}getView(e){return this.views.find(r=>r.id===e)}getViewState(e){let r=typeof e=="string"?this.getView(e):e,i=r&&this.viewState[r.getViewStateId()]||this.viewState;return r?r.filterViewState(i):i}getViewport(e){return this._viewportMap[e]}unproject(e,r){let i=this.getViewports(),n={x:e[0],y:e[1]};for(let o=i.length-1;o>=0;--o){let s=i[o];if(s.containsPixel(n)){let l=e.slice();return l[0]-=s.x,l[1]-=s.y,s.unproject(l,r)}}return null}setProps(e){e.views&&this._setViews(e.views),e.viewState&&this._setViewState(e.viewState),("width"in e||"height"in e)&&this._setSize(e.width,e.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(e,r){(e!==this.width||r!==this.height)&&(this.width=e,this.height=r,this.setNeedsUpdate("Size changed"))}_setViews(e){e=Rh(e,Boolean),this._diffViews(e,this.views)&&this.setNeedsUpdate("views changed"),this.views=e}_setViewState(e){e?(!Ls(e,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=e):ur.warn("missing `viewState` or `initialViewState`")()}_createController(e,r){let i=r.type;return new i({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:o=>this.getView(e.id)?.makeViewport({viewState:o,width:this.width,height:this.height})})}_updateController(e,r,i,n){let o=e.controller;if(o&&i){let s={...r,...o,id:e.id,x:i.x,y:i.y,width:i.width,height:i.height};return(!n||n.constructor!==o.type)&&(n=this._createController(e,s)),n&&n.setProps(s),n}return null}_rebuildViewports(){let{views:e}=this,r=this.controllers;this._viewports=[],this.controllers={};let i=!1;for(let n=e.length;n--;){let o=e[n],s=this.getViewState(o),l=o.makeViewport({viewState:s,width:this.width,height:this.height}),u=r[o.id],h=Boolean(o.controller);h&&!u&&(i=!0),(i||!h)&&u&&(u.finalize(),u=null),this.controllers[o.id]=this._updateController(o,s,l,u),l&&this._viewports.unshift(l)}for(let n in r){let o=r[n];o&&!this.controllers[n]&&o.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(e=>{e.id&&(this._viewportMap[e.id]=this._viewportMap[e.id]||e)})}_diffViews(e,r){return e.length!==r.length?!0:e.some((i,n)=>!e[n].equals(r[n]))}};var pfe=/([0-9]+\.?[0-9]*)(%|px)/;function Td(t){switch(typeof t){case"number":return{position:t,relative:!1};case"string":let e=pfe.exec(t);if(e&&e.length>=3){let r=e[2]==="%",i=parseFloat(e[1]);return{position:r?i/100:i,relative:r}}default:throw new Error(`Could not parse position string ${t}`)}}function Ed(t,e){return t.relative?Math.round(t.position*e):t.position}var rc=class{constructor(e){let{id:r,x:i=0,y:n=0,width:o="100%",height:s="100%",padding:l=null}=e;this.id=r||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=Td(i),this._y=Td(n),this._width=Td(o),this._height=Td(s),this._padding=l&&{left:Td(l.left||0),right:Td(l.right||0),top:Td(l.top||0),bottom:Td(l.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e?!0:this.ViewportType===e.ViewportType&&Ls(this.props,e.props,2)}makeViewport({width:e,height:r,viewState:i}){i=this.filterViewState(i);let n=this.getDimensions({width:e,height:r});return!n.height||!n.width?null:new this.ViewportType({...i,...this.props,...n})}getViewStateId(){let{viewState:e}=this.props;return typeof e=="string"?e:e?.id||this.id}filterViewState(e){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;let r={...e};for(let i in this.props.viewState)i!=="id"&&(r[i]=this.props.viewState[i]);return r}return e}getDimensions({width:e,height:r}){let i={x:Ed(this._x,e),y:Ed(this._y,r),width:Ed(this._width,e),height:Ed(this._height,r)};return this._padding&&(i.padding={left:Ed(this._padding.left,e),top:Ed(this._padding.top,r),right:Ed(this._padding.right,e),bottom:Ed(this._padding.bottom,r)}),i}get controller(){let e=this.props.controller;return e?e===!0?{type:this.ControllerType}:typeof e=="function"?{type:e}:{type:this.ControllerType,...e}:null}};var Ef=class{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){this.cancel(),this.settings=e,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:e,settings:r}=this;this._handle=e.addChannel({delay:e.getTime(),duration:r.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var NV=()=>{},n1={BREAK:1,SNAP_TO_END:2,IGNORE:3},Afe=t=>t,mfe=n1.BREAK,o1=class{constructor(e){this._onTransitionUpdate=r=>{let{time:i,settings:{interpolator:n,startProps:o,endProps:s,duration:l,easing:u}}=r,h=u(i/l),v=n.interpolateProps(o,s,h);this.propsInTransition=this.getControllerState({...this.props,...v}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=e.getControllerState,this.propsInTransition=null,this.transition=new Ef(e.timeline),this.onViewStateChange=e.onViewStateChange||NV,this.onStateChange=e.onStateChange||NV}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let r=!1,i=this.props;if(this.props=e,!i||this._shouldIgnoreViewportChange(i,e))return!1;if(this._isTransitionEnabled(e)){let n=i;if(this.transition.inProgress){let{interruption:o,endProps:s}=this.transition.settings;n={...i,...o===n1.SNAP_TO_END?s:this.propsInTransition||i}}this._triggerTransition(n,e),r=!0}else this.transition.cancel();return r}updateTransition(){this.transition.update()}_isTransitionEnabled(e){let{transitionDuration:r,transitionInterpolator:i}=e;return(r>0||r==="auto")&&Boolean(i)}_isUpdateDueToCurrentTransition(e){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition):!1}_shouldIgnoreViewportChange(e,r){return this.transition.inProgress?this.transition.settings.interruption===n1.IGNORE||this._isUpdateDueToCurrentTransition(r):this._isTransitionEnabled(r)?r.transitionInterpolator.arePropsEqual(e,r):!0}_triggerTransition(e,r){let i=this.getControllerState(e),n=this.getControllerState(r).shortestPathFrom(i),o=r.transitionInterpolator,s=o.getDuration?o.getDuration(e,r):r.transitionDuration;if(s===0)return;let l=o.initializeProps(e,n);this.propsInTransition={};let u={duration:s,easing:r.transitionEasing||Afe,interpolator:o,interruption:r.transitionInterruption||mfe,startProps:l.start,endProps:l.end,onStart:r.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(r.onTransitionInterrupt),onEnd:this._onTransitionEnd(r.onTransitionEnd)};this.transition.start(u),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return r=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e?.(r)}}};function os(t,e){if(!t)throw new Error(e||"deck.gl: assertion failed.")}var Sd=class{constructor(e){let{compare:r,extract:i,required:n}=e;this._propsToCompare=r,this._propsToExtract=i||r,this._requiredProps=n}arePropsEqual(e,r){for(let i of this._propsToCompare)if(!(i in e)||!(i in r)||!Cs(e[i],r[i]))return!1;return!0}initializeProps(e,r){let i={},n={};for(let o of this._propsToExtract)(o in e||o in r)&&(i[o]=e[o],n[o]=r[o]);return this._checkRequiredProps(i),this._checkRequiredProps(n),{start:i,end:n}}getDuration(e,r){return r.transitionDuration}_checkRequiredProps(e){this._requiredProps&&this._requiredProps.forEach(r=>{let i=e[r];os(Number.isFinite(i)||Array.isArray(i),`${r} is required for transition`)})}};var gfe=["longitude","latitude","zoom","bearing","pitch"],_fe=["longitude","latitude","zoom"],wl=class extends Sd{constructor(e={}){let r=Array.isArray(e)?e:e.transitionProps,i=Array.isArray(e)?{}:e;i.transitionProps=Array.isArray(r)?{compare:r,required:r}:r||{compare:gfe,required:_fe},super(i.transitionProps),this.opts=i}initializeProps(e,r){let i=super.initializeProps(e,r),{makeViewport:n,around:o}=this.opts;if(n&&o){let s=n(e),l=n(r),u=s.unproject(o);i.start.around=o,Object.assign(i.end,{around:l.project(u),aroundPosition:u,width:r.width,height:r.height})}return i}interpolateProps(e,r,i){let n={};for(let o of this._propsToExtract)n[o]=Oa(e[o]||0,r[o]||0,i);if(r.aroundPosition&&this.opts.makeViewport){let o=this.opts.makeViewport({...r,...n});Object.assign(n,o.panByPosition(r.aroundPosition,Oa(e.around,r.around,i)))}return n}};var jp={transitionDuration:0},yfe=300,gE=t=>1-(1-t)*(1-t),h_={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],TRIPLE_PAN:["tripanstart","tripanmove","tripanend"],DOUBLE_TAP:["doubletap"],KEYBOARD:["keydown"]},xm={},ic=class{constructor(e){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new o1({...e,getControllerState:r=>new this.ControllerState(r),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=e.eventManager,this.onViewStateChange=e.onViewStateChange||(()=>{}),this.onStateChange=e.onStateChange||(()=>{}),this.makeViewport=e.makeViewport}set events(e){this.toggleEvents(this._customEvents,!1),this.toggleEvents(e,!0),this._customEvents=e,this.props&&this.setProps(this.props)}finalize(){for(let e in this._events)this._events[e]&&this.eventManager?.off(e,this.handleEvent);this.transitionManager.finalize()}handleEvent(e){this._controllerState=void 0;let r=this._eventStartBlocked;switch(e.type){case"panstart":return r?!1:this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return r?!1:this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"tripanstart":return r?!1:this._onTriplePanStart(e);case"tripanmove":return this._onTriplePan(e);case"tripanend":return this._onTriplePanEnd(e);case"doubletap":return this._onDoubleTap(e);case"wheel":return this._onWheel(e);case"keydown":return this._onKeyDown(e);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(e){let{x:r,y:i}=this.props,{offsetCenter:n}=e;return[n.x-r,n.y-i]}isPointInBounds(e,r){let{width:i,height:n}=this.props;if(r&&r.handled)return!1;let o=e[0]>=0&&e[0]<=i&&e[1]>=0&&e[1]<=n;return o&&r&&r.stopPropagation(),o}isFunctionKeyPressed(e){let{srcEvent:r}=e;return Boolean(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(e){let r=setTimeout(()=>{this._eventStartBlocked===r&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=r}setProps(e){e.dragMode&&(this.dragMode=e.dragMode),this.props=e,"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);let{inertia:r}=e;this.inertia=Number.isFinite(r)?r:r===!0?yfe:0;let{scrollZoom:i=!0,dragPan:n=!0,dragRotate:o=!0,doubleClickZoom:s=!0,touchZoom:l=!0,touchRotate:u=!1,keyboard:h=!0}=e,v=Boolean(this.onViewStateChange);this.toggleEvents(h_.WHEEL,v&&i),this.toggleEvents(h_.PAN,v),this.toggleEvents(h_.PINCH,v&&(l||u)),this.toggleEvents(h_.TRIPLE_PAN,v&&u),this.toggleEvents(h_.DOUBLE_TAP,v&&s),this.toggleEvents(h_.KEYBOARD,v&&h),this.scrollZoom=i,this.dragPan=n,this.dragRotate=o,this.doubleClickZoom=s,this.touchZoom=l,this.touchRotate=u,this.keyboard=h}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,r){this.eventManager&&e.forEach(i=>{this._events[i]!==r&&(this._events[i]=r,r?this.eventManager.on(i,this.handleEvent):this.eventManager.off(i,this.handleEvent))})}updateViewport(e,r=null,i={}){let n={...e.getViewportProps(),...r},o=this.controllerState!==e;if(this.state=e.getState(),this._setInteractionState(i),o){let s=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:n,interactionState:this._interactionState,oldViewState:s,viewId:this.props.id})}}_onTransition(e){this.onViewStateChange({...e,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(e){Object.assign(this._interactionState,e),this.onStateChange(this._interactionState)}_onPanStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.isFunctionKeyPressed(e)||e.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(i=!i);let n=this.controllerState[i?"panStart":"rotateStart"]({pos:r});return this._panMove=i,this.updateViewport(n,jp,{isDragging:!0}),!0}_onPan(e){return this.isDragging()?this._panMove?this._onPanMove(e):this._onPanRotate(e):!1}_onPanEnd(e){return this.isDragging()?this._panMove?this._onPanMoveEnd(e):this._onPanRotateEnd(e):!1}_onPanMove(e){if(!this.dragPan)return!1;let r=this.getCenter(e),i=this.controllerState.pan({pos:r});return this.updateViewport(i,jp,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){let{inertia:r}=this;if(this.dragPan&&r&&e.velocity){let i=this.getCenter(e),n=[i[0]+e.velocityX*r/2,i[1]+e.velocityY*r/2],o=this.controllerState.pan({pos:n}).panEnd();this.updateViewport(o,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:gE},{isDragging:!1,isPanning:!0})}else{let i=this.controllerState.panEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;let r=this.getCenter(e),i=this.controllerState.rotate({pos:r});return this.updateViewport(i,jp,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){let{inertia:r}=this;if(this.dragRotate&&r&&e.velocity){let i=this.getCenter(e),n=[i[0]+e.velocityX*r/2,i[1]+e.velocityY*r/2],o=this.controllerState.rotate({pos:n}).rotateEnd();this.updateViewport(o,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:gE},{isDragging:!1,isRotating:!0})}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;e.srcEvent.preventDefault();let{speed:i=.01,smooth:n=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:o}=e,s=2/(1+Math.exp(-Math.abs(o*i)));o<0&&s!==0&&(s=1/s);let l=this.controllerState.zoom({pos:r,scale:s});return this.updateViewport(l,{...this._getTransitionProps({around:r}),transitionDuration:n?250:1},{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.controllerState.rotateStart({pos:r});return this.updateViewport(i,jp,{isDragging:!0}),!0}_onTriplePan(e){if(!this.touchRotate||!this.isDragging())return!1;let r=this.getCenter(e);r[0]-=e.deltaX;let i=this.controllerState.rotate({pos:r});return this.updateViewport(i,jp,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(e){if(!this.isDragging())return!1;let{inertia:r}=this;if(this.touchRotate&&r&&e.velocityY){let i=this.getCenter(e),n=[i[0],i[1]+=e.velocityY*r/2],o=this.controllerState.rotate({pos:n});this.updateViewport(o,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:gE},{isDragging:!1,isRotating:!0}),this.blockEvents(r)}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.controllerState.zoomStart({pos:r}).rotateStart({pos:r});return xm._startPinchRotation=e.rotation,xm._lastPinchEvent=e,this.updateViewport(i,jp,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let r=this.controllerState;if(this.touchZoom){let{scale:i}=e,n=this.getCenter(e);r=r.zoom({pos:n,scale:i})}if(this.touchRotate){let{rotation:i}=e;r=r.rotate({deltaAngleX:xm._startPinchRotation-i})}return this.updateViewport(r,jp,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),xm._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;let{inertia:r}=this,{_lastPinchEvent:i}=xm;if(this.touchZoom&&r&&i&&e.scale!==i.scale){let n=this.getCenter(e),o=this.controllerState.rotateEnd(),s=Math.log2(e.scale),l=(s-Math.log2(i.scale))/(e.deltaTime-i.deltaTime),u=Math.pow(2,s+l*r/2);o=o.zoom({pos:n,scale:u}).zoomEnd(),this.updateViewport(o,{...this._getTransitionProps({around:n}),transitionDuration:r,transitionEasing:gE},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(r)}else{let n=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return xm._startPinchRotation=null,xm._lastPinchEvent=null,!0}_onDoubleTap(e){if(!this.doubleClickZoom)return!1;let r=this.getCenter(e);if(!this.isPointInBounds(r,e))return!1;let i=this.isFunctionKeyPressed(e),n=this.controllerState.zoom({pos:r,scale:i?.5:2});return this.updateViewport(n,this._getTransitionProps({around:r}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(e){if(!this.keyboard)return!1;let r=this.isFunctionKeyPressed(e),{zoomSpeed:i,moveSpeed:n,rotateSpeedX:o,rotateSpeedY:s}=this.keyboard===!0?{}:this.keyboard,{controllerState:l}=this,u,h={};switch(e.srcEvent.code){case"Minus":u=r?l.zoomOut(i).zoomOut(i):l.zoomOut(i),h.isZooming=!0;break;case"Equal":u=r?l.zoomIn(i).zoomIn(i):l.zoomIn(i),h.isZooming=!0;break;case"ArrowLeft":r?(u=l.rotateLeft(o),h.isRotating=!0):(u=l.moveLeft(n),h.isPanning=!0);break;case"ArrowRight":r?(u=l.rotateRight(o),h.isRotating=!0):(u=l.moveRight(n),h.isPanning=!0);break;case"ArrowUp":r?(u=l.rotateUp(s),h.isRotating=!0):(u=l.moveUp(n),h.isPanning=!0);break;case"ArrowDown":r?(u=l.rotateDown(s),h.isRotating=!0):(u=l.moveDown(n),h.isPanning=!0);break;default:return!1}return this.updateViewport(u,this._getTransitionProps(),h),!0}_getTransitionProps(e){let{transition:r}=this;return!r||!r.transitionInterpolator?jp:e?{...r,transitionInterpolator:new wl({...e,...r.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:r}};var Cd=class{constructor(e,r){this._viewportProps=this.applyConstraints(e),this._state=r}getViewportProps(){return this._viewportProps}getState(){return this._state}};var kV=5,vfe=1.2,s1=class extends Cd{constructor(e){let{width:r,height:i,latitude:n,longitude:o,zoom:s,bearing:l=0,pitch:u=0,altitude:h=1.5,position:v=[0,0,0],maxZoom:T=20,minZoom:E=0,maxPitch:M=60,minPitch:O=0,startPanLngLat:F,startZoomLngLat:z,startRotatePos:W,startBearing:J,startPitch:K,startZoom:ne,normalize:ge=!0}=e;os(Number.isFinite(o)),os(Number.isFinite(n)),os(Number.isFinite(s)),super({width:r,height:i,latitude:n,longitude:o,zoom:s,bearing:l,pitch:u,altitude:h,maxZoom:T,minZoom:E,maxPitch:M,minPitch:O,normalize:ge,position:v},{startPanLngLat:F,startZoomLngLat:z,startRotatePos:W,startBearing:J,startPitch:K,startZoom:ne}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan({pos:e,startPos:r}){let i=this.getState().startPanLngLat||this._unproject(r);if(!i)return this;let o=this.makeViewport(this.getViewportProps()).panByPosition(i,e);return this._getUpdatedState(o)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:n,startBearing:o,startPitch:s}=this.getState();if(!n||o===void 0||s===void 0)return this;let l;return e?l=this._getNewRotation(e,n,s,o):l={bearing:o+r,pitch:s+i},this._getUpdatedState(l)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:e}){return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:r,scale:i}){let{startZoom:n,startZoomLngLat:o}=this.getState();if(o||(n=this.getViewportProps().zoom,o=this._unproject(r)||this._unproject(e)),!o)return this;let{maxZoom:s,minZoom:l}=this.getViewportProps(),u=n+Math.log2(i);u=Zn(u,l,s);let h=this.makeViewport({...this.getViewportProps(),zoom:u});return this._getUpdatedState({zoom:u,...h.panByPosition(o,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(e=2){return this._zoomFromCenter(e)}zoomOut(e=2){return this._zoomFromCenter(1/e)}moveLeft(e=100){return this._panFromCenter([e,0])}moveRight(e=100){return this._panFromCenter([-e,0])}moveUp(e=100){return this._panFromCenter([0,e])}moveDown(e=100){return this._panFromCenter([0,-e])}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}shortestPathFrom(e){let r=e.getViewportProps(),i={...this.getViewportProps()},{bearing:n,longitude:o}=i;return Math.abs(n-r.bearing)>180&&(i.bearing=n<0?n+360:n-360),Math.abs(o-r.longitude)>180&&(i.longitude=o<0?o+360:o-360),i}applyConstraints(e){let{maxZoom:r,minZoom:i,zoom:n}=e;e.zoom=Zn(n,i,r);let{maxPitch:o,minPitch:s,pitch:l}=e;e.pitch=Zn(l,s,o);let{normalize:u=!0}=e;return u&&Object.assign(e,XB(e)),e}_zoomFromCenter(e){let{width:r,height:i}=this.getViewportProps();return this.zoom({pos:[r/2,i/2],scale:e})}_panFromCenter(e){let{width:r,height:i}=this.getViewportProps();return this.pan({startPos:[r/2,i/2],pos:[r/2+e[0],i/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}_unproject(e){let r=this.makeViewport(this.getViewportProps());return e&&r.unproject(e)}_getNewRotation(e,r,i,n){let o=e[0]-r[0],s=e[1]-r[1],l=e[1],u=r[1],{width:h,height:v}=this.getViewportProps(),T=o/h,E=0;s>0?Math.abs(v-u)>kV&&(E=s/(u-v)*vfe):s<0&&u>kV&&(E=1-l/u),E=Zn(E,-1,1);let{minPitch:M,maxPitch:O}=this.getViewportProps(),F=n+180*T,z=i;return E>0?z=i+E*(O-i):E<0&&(z=i-E*(M-i)),{pitch:z,bearing:F}}},bm=class extends ic{constructor(){super(...arguments),this.ControllerState=s1,this.transition={transitionDuration:300,transitionInterpolator:new wl({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(e){e.position=e.position||[0,0,0];let r=this.props;super.setProps(e),(!r||r.height!==e.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...e,...this.state}))}};var iO=class extends rc{constructor(e={}){super(e)}get ViewportType(){return Tc}get ControllerType(){return bm}},Md=iO;(()=>{iO.displayName="MapView"})();var xfe=new zp;function bfe(t,e){let r=t.order??1/0,i=e.order??1/0;return r-i}var a1=class{constructor(e){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=e,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(e){let r=this._defaultEffects;if(!r.find(i=>i.id===e.id)){let i=r.findIndex(n=>bfe(n,e)>0);i<0?r.push(e):r.splice(i,0,e),e.setup(this._context),this._setEffects(this.effects)}}setProps(e){"effects"in e&&(Ls(e.effects,this.effects,1)||this._setEffects(e.effects))}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}getEffects(){return this._resolvedEffects}_setEffects(e){let r={};for(let n of this.effects)r[n.id]=n;let i=[];for(let n of e){let o=r[n.id],s=n;o&&o!==n?o.setProps?(o.setProps(n.props),s=o):o.cleanup(this._context):o||n.setup(this._context),i.push(s),delete r[n.id]}for(let n in r)r[n].cleanup(this._context);this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),e.some(n=>n instanceof zp)||this._resolvedEffects.push(xfe),this._needsRedraw="effects changed"}finalize(){for(let e of this._resolvedEffects)e.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var l1=class extends bf{shouldDrawLayer(e){let{operation:r}=e.props;return r.includes("draw")||r.includes("terrain")}};var wfe="deckRenderer.renderLayers",wm=class{constructor(e){this.device=e,this.gl=e.gl,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new l1(e),this.pickLayersPass=new bd(e),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(e){this.layerFilter!==e.layerFilter&&(this.layerFilter=e.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==e.drawPickingColors&&(this.drawPickingColors=e.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(e){if(!e.viewports.length)return;let r=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...e};i.effects&&this._preRender(i.effects,i);let n=this.lastPostProcessEffect?this.renderBuffers[0]:i.target;this.lastPostProcessEffect&&(i.clearColor=[0,0,0,0],i.clearCanvas=!0);let o=r.render({...i,target:n});i.effects&&this._postRender(i.effects,i),this.renderCount++,Ks(wfe,this,o,e)}needsRedraw(e={clearRedrawFlags:!1}){let r=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),r}finalize(){let{renderBuffers:e}=this;for(let r of e)r.delete();e.length=0}_preRender(e,r){this.lastPostProcessEffect=null,r.preRenderStats=r.preRenderStats||{};for(let i of e)r.preRenderStats[i.id]=i.preRender(r),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:e}=this,r=this.device.canvasContext.getDrawingBufferSize();e.length===0&&[0,1].map(i=>{let n=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"}});e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${i}`,colorAttachments:[n]}))});for(let i of e)i.resize(r)}_postRender(e,r){let{renderBuffers:i}=this,n={...r,inputBuffer:i[0],swapBuffer:i[1]};for(let o of e)if(o.postRender){n.target=o.id===this.lastPostProcessEffect?r.target:void 0;let s=o.postRender(n);n.inputBuffer=s,n.swapBuffer=s===i[0]?i[1]:i[0]}}};var Tfe={pickedColor:null,pickedObjectIndex:-1};function UV({pickedColors:t,decodePickingColor:e,deviceX:r,deviceY:i,deviceRadius:n,deviceRect:o}){let{x:s,y:l,width:u,height:h}=o,v=n*n,T=-1,E=0;for(let M=0;M<h;M++){let O=M+l-i,F=O*O;if(F>v)E+=4*u;else for(let z=0;z<u;z++){if(t[E+3]-1>=0){let J=z+s-r,K=J*J+F;K<=v&&(v=K,T=E)}E+=4}}if(T>=0){let M=t.slice(T,T+4),O=e(M);if(O){let F=Math.floor(T/4/u),z=T/4-F*u;return{...O,pickedColor:M,pickedX:s+z,pickedY:l+F}}ur.error("Picked non-existent layer. Is picking buffer corrupt?")()}return Tfe}function zV({pickedColors:t,decodePickingColor:e}){let r=new Map;if(t){for(let i=0;i<t.length;i+=4)if(t[i+3]-1>=0){let o=t.slice(i,i+4),s=o.join(",");if(!r.has(s)){let l=e(o);l?r.set(s,{...l,color:o}):ur.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(r.values())}function nO({pickInfo:t,viewports:e,pixelRatio:r,x:i,y:n,z:o}){let s=e[0];e.length>1&&(s=Efe(t?.pickedViewports||e,{x:i,y:n}));let l;if(s){let u=[i-s.x,n-s.y];o!==void 0&&(u[2]=o),l=s.unproject(u)}return{color:null,layer:null,viewport:s,index:-1,picked:!1,x:i,y:n,pixel:[i,n],coordinate:l,devicePixel:t&&"pickedX"in t?[t.pickedX,t.pickedY]:void 0,pixelRatio:r}}function VV(t){let{pickInfo:e,lastPickedInfo:r,mode:i,layers:n}=t,{pickedColor:o,pickedLayer:s,pickedObjectIndex:l}=e,u=s?[s]:[];if(i==="hover"){let T=r.index,E=r.layerId,M=s?s.props.id:null;if(M!==E||l!==T){if(M!==E){let O=n.find(F=>F.props.id===E);O&&u.unshift(O)}r.layerId=M,r.index=l,r.info=null}}let h=nO(t),v=new Map;return v.set(null,h),u.forEach(T=>{let E={...h};T===s&&(E.color=o,E.index=l,E.picked=!0),E=oO({layer:T,info:E,mode:i});let M=E.layer;T===s&&i==="hover"&&(r.info=E),v.set(M.id,E),i==="hover"&&M.updateAutoHighlight(E)}),v}function oO({layer:t,info:e,mode:r}){for(;t&&e;){let i=e.layer||null;e.sourceLayer=i,e.layer=t,e=t.getPickingInfo({info:e,mode:r,sourceLayer:i}),t=t.parent}return e}function Efe(t,e){for(let r=t.length-1;r>=0;r--){let i=t[r];if(i.containsPixel(e))return i}return t[0]}var c1=class{constructor(e){this._pickable=!0,this.device=e,this.pickLayersPass=new bd(e),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(e){"layerFilter"in e&&(this.layerFilter=e.layerFilter),"_pickable"in e&&(this._pickable=e._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}pickObject(e){return this._pickClosestObject(e)}pickObjects(e){return this._pickVisibleObjects(e)}getLastPickedObject({x:e,y:r,layers:i,viewports:n},o=this.lastPickedInfo.info){let s=o&&o.layer&&o.layer.id,l=o&&o.viewport&&o.viewport.id,u=s?i.find(E=>E.id===s):null,h=l&&n.find(E=>E.id===l)||n[0],v=h&&h.unproject([e-h.x,r-h.y]);return{...o,...{x:e,y:r,viewport:h,coordinate:v,layer:u}}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float"))){let r=this.device.createFramebuffer({colorAttachments:["rgba32float"],depthStencilAttachment:"depth16unorm"});this.depthFBO=r}let e=this.device.gl;this.pickingFBO?.resize({width:e.canvas.width,height:e.canvas.height}),this.depthFBO?.resize({width:e.canvas.width,height:e.canvas.height})}_getPickable(e){if(this._pickable===!1)return null;let r=e.filter(i=>this.pickLayersPass.shouldDrawLayer(i)&&!i.isComposite);return r.length?r:null}_pickClosestObject({layers:e,views:r,viewports:i,x:n,y:o,radius:s=0,depth:l=1,mode:u="query",unproject3D:h,onViewportActive:v,effects:T}){let E=this.device.canvasContext.cssToDeviceRatio(),M=this._getPickable(e);if(!M||i.length===0)return{result:[],emptyInfo:nO({viewports:i,x:n,y:o,pixelRatio:E})};this._resizeBuffer();let O=this.device.canvasContext.cssToDevicePixels([n,o],!0),F=[O.x+Math.floor(O.width/2),O.y+Math.floor(O.height/2)],z=Math.round(s*E),{width:W,height:J}=this.pickingFBO,K=this._getPickingRect({deviceX:F[0],deviceY:F[1],deviceRadius:z,deviceWidth:W,deviceHeight:J}),ne={x:n-s,y:o-s,width:s*2+1,height:s*2+1},ge,j=[],me=new Set;for(let fe=0;fe<l;fe++){let $;if(K){let we=this._drawAndSample({layers:M,views:r,viewports:i,onViewportActive:v,deviceRect:K,cullRect:ne,effects:T,pass:`picking:${u}`});$=UV({...we,deviceX:F[0],deviceY:F[1],deviceRadius:z,deviceRect:K})}else $={pickedColor:null,pickedObjectIndex:-1};let Z;if($.pickedLayer&&h&&this.depthFBO){let{pickedColors:we}=this._drawAndSample({layers:[$.pickedLayer],views:r,viewports:i,onViewportActive:v,deviceRect:{x:$.pickedX,y:$.pickedY,width:1,height:1},cullRect:ne,effects:T,pass:`picking:${u}:z`},!0);we[3]&&(Z=we[0])}$.pickedLayer&&fe+1<l&&(me.add($.pickedLayer),$.pickedLayer.disablePickingIndex($.pickedObjectIndex)),ge=VV({pickInfo:$,lastPickedInfo:this.lastPickedInfo,mode:u,layers:M,viewports:i,x:n,y:o,z:Z,pixelRatio:E});for(let we of ge.values())we.layer&&j.push(we);if(!$.pickedColor)break}for(let fe of me)fe.restorePickingColors();return{result:j,emptyInfo:ge.get(null)}}_pickVisibleObjects({layers:e,views:r,viewports:i,x:n,y:o,width:s=1,height:l=1,mode:u="query",maxObjects:h=null,onViewportActive:v,effects:T}){let E=this._getPickable(e);if(!E||i.length===0)return[];this._resizeBuffer();let M=this.device.canvasContext.cssToDeviceRatio(),O=this.device.canvasContext.cssToDevicePixels([n,o],!0),F=O.x,z=O.y+O.height,W=this.device.canvasContext.cssToDevicePixels([n+s,o+l],!0),J=W.x+W.width,K=W.y,ne={x:F,y:K,width:J-F,height:z-K},ge=this._drawAndSample({layers:E,views:r,viewports:i,onViewportActive:v,deviceRect:ne,cullRect:{x:n,y:o,width:s,height:l},effects:T,pass:`picking:${u}`}),j=zV(ge),me=new Map,fe=[],$=Number.isFinite(h);for(let Z=0;Z<j.length&&!($&&fe.length>=h);Z++){let we=j[Z],Oe={color:we.pickedColor,layer:null,index:we.pickedObjectIndex,picked:!0,x:n,y:o,pixelRatio:M};Oe=oO({layer:we.pickedLayer,info:Oe,mode:u});let he=Oe.layer.id;me.has(he)||me.set(he,new Set);let Le=me.get(he),ft=Oe.object??Oe.index;Le.has(ft)||(Le.add(ft),fe.push(Oe))}return fe}_drawAndSample({layers:e,views:r,viewports:i,onViewportActive:n,deviceRect:o,cullRect:s,effects:l,pass:u},h=!1){let v=h?this.depthFBO:this.pickingFBO,T={layers:e,layerFilter:this.layerFilter,views:r,viewports:i,onViewportActive:n,pickingFBO:v,deviceRect:o,cullRect:s,effects:l,pass:u,pickZ:h,preRenderStats:{}};for(let J of l)J.useInPicking&&(T.preRenderStats[J.id]=J.preRender(T));let{decodePickingColor:E}=this.pickLayersPass.render(T),{x:M,y:O,width:F,height:z}=o,W=new(h?Float32Array:Uint8Array)(F*z*4);return this.device.readPixelsToArrayWebGL(v,{sourceX:M,sourceY:O,sourceWidth:F,sourceHeight:z,target:W}),{pickedColors:W,decodePickingColor:E}}_getPickingRect({deviceX:e,deviceY:r,deviceRadius:i,deviceWidth:n,deviceHeight:o}){let s=Math.max(0,e-i),l=Math.max(0,r-i),u=Math.min(n,e+i+1)-s,h=Math.min(o,r+i+1)-l;return u<=0||h<=0?null:{x:s,y:l,width:u,height:h}}};var Sfe={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},Cfe="top-left",HV="__root",_E=class{constructor({deck:e,parentElement:r}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,this.parentElement=r}getWidgets(){return this.resolvedWidgets}setProps(e){e.widgets&&!Ls(e.widgets,this.widgets,1)&&this._setWidgets(e.widgets)}finalize(){for(let e of this.getWidgets())this._remove(e);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(let e in this.containers)this.containers[e].remove()}addDefault(e){this.defaultWidgets.find(r=>r.id===e.id)||(this._add(e),this.defaultWidgets.push(e),this._setWidgets(this.widgets))}_setWidgets(e){let r={};for(let i of this.resolvedWidgets)r[i.id]=i;this.resolvedWidgets.length=0;for(let i of this.defaultWidgets)r[i.id]=null,this.resolvedWidgets.push(i);for(let i of e){let n=r[i.id];n?n.viewId!==i.viewId||n.placement!==i.placement?(this._remove(n),this._add(i)):i!==n&&(n.setProps(i.props),i=n):this._add(i),r[i.id]=null,this.resolvedWidgets.push(i)}for(let i in r){let n=r[i];n&&this._remove(n)}this.widgets=e}_add(e){let{viewId:r=null,placement:i=Cfe}=e,n=e.onAdd({deck:this.deck,viewId:r});n&&this._getContainer(r,i).append(n),e._element=n}_remove(e){e.onRemove(),e._element&&e._element.remove(),e._element=void 0}_getContainer(e,r){let i=e||HV,n=this.containers[i];n||(n=document.createElement("div"),n.style.pointerEvents="none",n.style.position="absolute",n.style.overflow="hidden",this.parentElement?.append(n),this.containers[i]=n);let o=n.querySelector(`.${r}`);return o||(o=document.createElement("div"),o.className=r,o.style.position="absolute",Object.assign(o.style,Sfe[r]),n.append(o)),o}_updateContainers(){let e=this.deck.width,r=this.deck.height;for(let i in this.containers){let n=this.lastViewports[i]||null,o=i===HV||n,s=this.containers[i];o?(s.style.display="block",s.style.left=`${n?n.x:0}px`,s.style.top=`${n?n.y:0}px`,s.style.width=`${n?n.width:e}px`,s.style.height=`${n?n.height:r}px`):s.style.display="none"}}onRedraw({viewports:e,layers:r}){let i=e.reduce((o,s)=>(o[s.id]=s,o),{}),{lastViewports:n}=this;for(let o of this.getWidgets()){let{viewId:s}=o;if(s){let l=i[s];l&&(o.onViewportChange&&!l.equals(n[s])&&o.onViewportChange(l),o.onRedraw?.({viewports:[l],layers:r}))}else{if(o.onViewportChange)for(let l of e)l.equals(n[l.id])||o.onViewportChange(l);o.onRedraw?.({viewports:e,layers:r})}}this.lastViewports=i,this._updateContainers()}onHover(e,r){for(let i of this.getWidgets()){let{viewId:n}=i;(!n||n===e.viewport?.id)&&i.onHover?.(e,r)}}onEvent(e,r){let i=Nx[r.type];if(i)for(let n of this.getWidgets()){let{viewId:o}=n;(!o||o===e.viewport?.id)&&n[i.handler]?.(e,r)}}};var Mfe={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"},u1=class{constructor(){this.id="default-tooltip",this.placement="fill",this.props={},this.isVisible=!1}onAdd({deck:e}){let r=document.createElement("div");return r.className="deck-tooltip",Object.assign(r.style,Mfe),this.deck=e,this.element=r,r}onRemove(){this.deck=void 0,this.element=void 0}setProps(){}onViewportChange(e){this.isVisible&&e.id===this.lastViewport?.id&&e!==this.lastViewport&&this.setTooltip(null)}onHover(e){let{deck:r}=this,i=r&&r.props.getTooltip;if(!i)return;let n=i(e);this.lastViewport=e.viewport,this.setTooltip(n,e.x,e.y)}setTooltip(e,r,i){let n=this.element;if(n){if(typeof e=="string")n.innerText=e;else if(e)e.text&&(n.innerText=e.text),e.html&&(n.innerHTML=e.html),e.className&&(n.className=e.className);else{this.isVisible=!1,n.style.display="none";return}this.isVisible=!0,n.style.display="block",n.style.transform=`translate(${r}px, ${i}px)`,e&&typeof e=="object"&&"style"in e&&Object.assign(n.style,e.style)}}};var Tm=ga(jV());var Ife={mousedown:1,mousemove:2,mouseup:4};function Pfe(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return!0;return!1}function GV(t){let e=t.prototype.handler;t.prototype.handler=function(i){let n=this.store;i.button>0&&i.type==="pointerdown"&&(Pfe(n,o=>o.pointerId===i.pointerId)||n.push(i)),e.call(this,i)}}function WV(t){t.prototype.handler=function(r){let i=Ife[r.type];i&1&&r.button>=0&&(this.pressed=!0),i&2&&r.which===0&&(i=4),this.pressed&&(i&4&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[r],changedPointers:[r],pointerType:"mouse",srcEvent:r}))}}GV(Tm.PointerEventInput);WV(Tm.MouseInput);var qV=Tm.Manager,Sf=Tm;var Cf=class{constructor(e,r,i){this.element=e,this.callback=r,this.options={enable:!0,...i}}};var XV=Sf?[[Sf.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[Sf.Rotate,{enable:!1}],[Sf.Pinch,{enable:!1}],[Sf.Swipe,{enable:!1}],[Sf.Pan,{threshold:0,enable:!1}],[Sf.Press,{enable:!1}],[Sf.Tap,{event:"doubletap",taps:2,enable:!1}],[Sf.Tap,{event:"anytap",enable:!1}],[Sf.Tap,{enable:!1}]]:null,sO={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},YV={doubletap:["tap"]},KV={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},d_={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},ZV={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},aO={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"};var JV=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",Em=typeof window<"u"?window:global;var vE=!1;try{let t={get passive(){return vE=!0,!0}};Em.addEventListener("test",null,t),Em.removeEventListener("test",null)}catch{vE=!1}var Rfe=JV.indexOf("firefox")!==-1,{WHEEL_EVENTS:Bfe}=d_,QV="wheel",$V=4.000244140625,Ofe=40,Dfe=.25,f1=class extends Cf{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{if(!this.options.enable)return;let o=n.deltaY;Em.WheelEvent&&(Rfe&&n.deltaMode===Em.WheelEvent.DOM_DELTA_PIXEL&&(o/=Em.devicePixelRatio),n.deltaMode===Em.WheelEvent.DOM_DELTA_LINE&&(o*=Ofe)),o!==0&&o%$V===0&&(o=Math.floor(o/$V)),n.shiftKey&&o&&(o=o*Dfe),this.callback({type:QV,center:{x:n.clientX,y:n.clientY},delta:-o,srcEvent:n,pointerType:"mouse",target:n.target})},this.events=(this.options.events||[]).concat(Bfe),this.events.forEach(n=>e.addEventListener(n,this.handleEvent,vE?{passive:!1}:!1))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===QV&&(this.options.enable=r)}};var{MOUSE_EVENTS:Lfe}=d_,e9="pointermove",t9="pointerover",r9="pointerout",i9="pointerenter",n9="pointerleave",h1=class extends Cf{constructor(e,r,i){super(e,r,i),this.handleEvent=o=>{this.handleOverEvent(o),this.handleOutEvent(o),this.handleEnterEvent(o),this.handleLeaveEvent(o),this.handleMoveEvent(o)},this.pressed=!1;let{enable:n}=this.options;this.enableMoveEvent=n,this.enableLeaveEvent=n,this.enableEnterEvent=n,this.enableOutEvent=n,this.enableOverEvent=n,this.events=(this.options.events||[]).concat(Lfe),this.events.forEach(o=>e.addEventListener(o,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===e9&&(this.enableMoveEvent=r),e===t9&&(this.enableOverEvent=r),e===r9&&(this.enableOutEvent=r),e===i9&&(this.enableEnterEvent=r),e===n9&&(this.enableLeaveEvent=r)}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit(t9,e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit(r9,e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit(i9,e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit(n9,e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":e.which===0&&(this.pressed=!1),this.pressed||this._emit(e9,e);break;case"mouseup":this.pressed=!1;break;default:}}_emit(e,r){this.callback({type:e,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:"mouse",target:r.target})}};var{KEY_EVENTS:Ffe}=d_,o9="keydown",s9="keyup",d1=class extends Cf{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{let o=n.target||n.srcElement;o.tagName==="INPUT"&&o.type==="text"||o.tagName==="TEXTAREA"||(this.enableDownEvent&&n.type==="keydown"&&this.callback({type:o9,srcEvent:n,key:n.key,target:n.target}),this.enableUpEvent&&n.type==="keyup"&&this.callback({type:s9,srcEvent:n,key:n.key,target:n.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(Ffe),e.tabIndex=this.options.tabIndex||0,e.style.outline="none",this.events.forEach(n=>e.addEventListener(n,this.handleEvent))}destroy(){this.events.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e===o9&&(this.enableDownEvent=r),e===s9&&(this.enableUpEvent=r)}};var a9="contextmenu",p1=class extends Cf{constructor(e,r,i){super(e,r,i),this.handleEvent=n=>{this.options.enable&&this.callback({type:a9,center:{x:n.clientX,y:n.clientY},srcEvent:n,pointerType:"mouse",target:n.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,r){e===a9&&(this.options.enable=r)}};var Nfe={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},kfe=1,Ufe=2,zfe=3,Vfe=0,Hfe=1,jfe=2,Gfe=1,Wfe=2,qfe=4;function l9(t){let e=Nfe[t.srcEvent.type];if(!e)return null;let{buttons:r,button:i,which:n}=t.srcEvent,o=!1,s=!1,l=!1;return e===4||e===2&&!Number.isFinite(r)?(o=n===kfe,s=n===Ufe,l=n===zfe):e===2?(o=Boolean(r&Gfe),s=Boolean(r&qfe),l=Boolean(r&Wfe)):e===1&&(o=i===Vfe,s=i===Hfe,l=i===jfe),{leftButton:o,middleButton:s,rightButton:l}}function c9(t,e){let r=t.center;if(!r)return null;let i=e.getBoundingClientRect(),n=i.width/e.offsetWidth||1,o=i.height/e.offsetHeight||1,s={x:(r.x-i.left-e.clientLeft)/n,y:(r.y-i.top-e.clientTop)/o};return{center:r,offsetCenter:s}}var lO={srcElement:"root",priority:0},A1=class{constructor(e){this.handleEvent=r=>{if(this.isEmpty())return;let i=this._normalizeEvent(r),n=r.srcEvent.target;for(;n&&n!==i.rootElement;){if(this._emit(i,n),i.handled)return;n=n.parentNode}this._emit(i,"root")},this.eventManager=e,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,r,i,n=!1,o=!1){let{handlers:s,handlersByElement:l}=this,u=lO;typeof i=="string"||i&&i.addEventListener?u={...lO,srcElement:i}:i&&(u={...lO,...i});let h=l.get(u.srcElement);h||(h=[],l.set(u.srcElement,h));let v={type:e,handler:r,srcElement:u.srcElement,priority:u.priority};n&&(v.once=!0),o&&(v.passive=!0),s.push(v),this._active=this._active||!v.passive;let T=h.length-1;for(;T>=0&&!(h[T].priority>=v.priority);)T--;h.splice(T+1,0,v)}remove(e,r){let{handlers:i,handlersByElement:n}=this;for(let o=i.length-1;o>=0;o--){let s=i[o];if(s.type===e&&s.handler===r){i.splice(o,1);let l=n.get(s.srcElement);l.splice(l.indexOf(s),1),l.length===0&&n.delete(s.srcElement)}}this._active=i.some(o=>!o.passive)}_emit(e,r){let i=this.handlersByElement.get(r);if(i){let n=!1,o=()=>{e.handled=!0},s=()=>{e.handled=!0,n=!0},l=[];for(let u=0;u<i.length;u++){let{type:h,handler:v,once:T}=i[u];if(v({...e,type:h,stopPropagation:o,stopImmediatePropagation:s}),T&&l.push(i[u]),n)break}for(let u=0;u<l.length;u++){let{type:h,handler:v}=l[u];this.remove(h,v)}}}_normalizeEvent(e){let r=this.eventManager.getElement();return{...e,...l9(e),...c9(e,r),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:r}}};var Xfe={events:null,recognizers:null,recognizerOptions:{},Manager:qV,touchAction:"none",tabIndex:0},p_=class{constructor(e=null,r){this._onBasicInput=n=>{let{srcEvent:o}=n,s=KV[o.type];s&&this.manager.emit(s,n)},this._onOtherEvent=n=>{this.manager.emit(n.type,n)},this.options={...Xfe,...r},this.events=new Map,this.setElement(e);let{events:i}=this.options;i&&this.on(i)}getElement(){return this.element}setElement(e){if(this.element&&this.destroy(),this.element=e,!e)return;let{options:r}=this,i=r.Manager;this.manager=new i(e,{touchAction:r.touchAction,recognizers:r.recognizers||XV}).on("hammer.input",this._onBasicInput),r.recognizers||Object.keys(sO).forEach(n=>{let o=this.manager.get(n);o&&sO[n].forEach(s=>{o.recognizeWith(s)})});for(let n in r.recognizerOptions){let o=this.manager.get(n);if(o){let s=r.recognizerOptions[n];delete s.enable,o.set(s)}}this.wheelInput=new f1(e,this._onOtherEvent,{enable:!1}),this.moveInput=new h1(e,this._onOtherEvent,{enable:!1}),this.keyInput=new d1(e,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new p1(e,this._onOtherEvent,{enable:!1});for(let[n,o]of this.events)o.isEmpty()||(this._toggleRecognizer(o.recognizerName,!0),this.manager.on(n,o.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(e,r,i){this._addEventHandler(e,r,i,!1)}once(e,r,i){this._addEventHandler(e,r,i,!0)}watch(e,r,i){this._addEventHandler(e,r,i,!1,!0)}off(e,r){this._removeEventHandler(e,r)}_toggleRecognizer(e,r){let{manager:i}=this;if(!i)return;let n=i.get(e);if(n&&n.options.enable!==r){n.set({enable:r});let o=YV[e];o&&!this.options.recognizers&&o.forEach(s=>{let l=i.get(s);r?(l.requireFailure(e),n.dropRequireFailure(s)):l.dropRequireFailure(e)})}this.wheelInput.enableEventType(e,r),this.moveInput.enableEventType(e,r),this.keyInput.enableEventType(e,r),this.contextmenuInput.enableEventType(e,r)}_addEventHandler(e,r,i,n,o){if(typeof e!="string"){i=r;for(let v in e)this._addEventHandler(v,e[v],i,n,o);return}let{manager:s,events:l}=this,u=aO[e]||e,h=l.get(u);h||(h=new A1(this),l.set(u,h),h.recognizerName=ZV[u]||u,s&&s.on(u,h.handleEvent)),h.add(e,r,i,n,o),h.isEmpty()||this._toggleRecognizer(h.recognizerName,!0)}_removeEventHandler(e,r){if(typeof e!="string"){for(let s in e)this._removeEventHandler(s,e[s]);return}let{events:i}=this,n=aO[e]||e,o=i.get(n);if(o&&(o.remove(e,r),o.isEmpty())){let{recognizerName:s}=o,l=!1;for(let u of i.values())if(u.recognizerName===s&&!u.isEmpty()){l=!0;break}l||this._toggleRecognizer(s,!1)}}};function Gp(){}var Yfe=({isDragging:t})=>t?"grabbing":"grab",u9={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{type:"webgl"},gl:null,glOptions:{},canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:Gp,onWebGLInitialized:Gp,onResize:Gp,onViewStateChange:Gp,onInteractionStateChange:Gp,onBeforeRender:Gp,onAfterRender:Gp,onLoad:Gp,onError:t=>ur.error(t.message,t.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:Yfe,getTooltip:null,debug:!1,drawPickingColors:!1},xE=class{constructor(e){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new Dl({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this._lastPointerDownInfo=null,this._onPointerMove=i=>{let{_pickRequest:n}=this;if(i.type==="pointerleave")n.x=-1,n.y=-1,n.radius=0;else{if(i.leftButton||i.rightButton)return;{let o=i.offsetCenter;if(!o)return;n.x=o.x,n.y=o.y,n.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:n.x,y:n.y}),n.event=i},this._onEvent=i=>{let n=Nx[i.type],o=i.offsetCenter;if(!n||!o||!this.layerManager)return;let s=this.layerManager.getLayers(),l=this.deckPicker.getLastPickedObject({x:o.x,y:o.y,layers:s,viewports:this.getViewports(o)},this._lastPointerDownInfo),{layer:u}=l,h=u&&(u[n.handler]||u.props[n.handler]),v=this.props[n.handler],T=!1;h&&(T=h.call(u,l,i)),T||(v?.(l,i),this.widgetManager.onEvent(l,i))},this._onPointerDown=i=>{let n=i.offsetCenter,o=this._pick("pickObject","pickObject Time",{x:n.x,y:n.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=o.result[0]||o.emptyInfo},this.props={...u9,...e},e=this.props,e.viewState&&e.initialViewState&&ur.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,e.device?this.device=e.device:e.gl&&(e.gl instanceof WebGLRenderingContext&&ur.error("WebGL1 context not supported.")(),this.device=wh.attach(e.gl));let r=this.device;r||(Ll.registerDevices([wh]),r=Ll.createDevice({...e.deviceProps,canvas:this._createCanvas(e)})),this.animationLoop=this._createAnimationLoop(r,e),this.setProps(e),e._typedArrayManagerProps&&wf.setOptions(e._typedArrayManagerProps),this.animationLoop.start()}finalize(){this.animationLoop?.stop(),this.animationLoop?.destroy(),this.animationLoop=null,this._lastPointerDownInfo=null,this.layerManager?.finalize(),this.layerManager=null,this.viewManager?.finalize(),this.viewManager=null,this.effectManager?.finalize(),this.effectManager=null,this.deckRenderer?.finalize(),this.deckRenderer=null,this.deckPicker?.finalize(),this.deckPicker=null,this.eventManager?.destroy(),this.eventManager=null,this.widgetManager?.finalize(),this.widgetManager=null,!this.props.canvas&&!this.props.device&&!this.props.gl&&this.canvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null)}setProps(e){this.stats.get("setProps Time").timeStart(),"onLayerHover"in e&&ur.removed("onLayerHover","onHover")(),"onLayerClick"in e&&ur.removed("onLayerClick","onClick")(),e.initialViewState&&!Ls(this.props.initialViewState,e.initialViewState,3)&&(this.viewState=e.initialViewState),Object.assign(this.props,e),this._setCanvasSize(this.props);let r=Object.create(this.props);Object.assign(r,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop?.setProps(r),this.layerManager&&(this.viewManager.setProps(r),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(r),this.effectManager.setProps(r),this.deckRenderer.setProps(r),this.deckPicker.setProps(r),this.widgetManager.setProps(r)),this.stats.get("setProps Time").timeEnd()}needsRedraw(e={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let r=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);let i=this.viewManager.needsRedraw(e),n=this.layerManager.needsRedraw(e),o=this.effectManager.needsRedraw(e),s=this.deckRenderer.needsRedraw(e);return r=r||i||n||o||s,r}redraw(e){if(!this.layerManager)return;let r=this.needsRedraw({clearRedrawFlags:!0});r=e||r,r&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(r):this._drawLayers(r))}get isInitialized(){return this.viewManager!==null}getViews(){return os(this.viewManager),this.viewManager.views}getViewports(e){return os(this.viewManager),this.viewManager.getViewports(e)}getCanvas(){return this.canvas}pickObject(e){let r=this._pick("pickObject","pickObject Time",e).result;return r.length?r[0]:null}pickMultipleObjects(e){return e.depth=e.depth||10,this._pick("pickObject","pickMultipleObjects Time",e).result}pickObjects(e){return this._pick("pickObjects","pickObjects Time",e)}_addResources(e,r=!1){for(let i in e)this.layerManager.resourceManager.add({resourceId:i,data:e[i],forceUpdate:r})}_removeResources(e){for(let r of e)this.layerManager.resourceManager.remove(r)}_addDefaultEffect(e){this.effectManager.addDefaultEffect(e)}_addDefaultShaderModule(e){this.layerManager.addDefaultShaderModule(e)}_removeDefaultShaderModule(e){this.layerManager?.removeDefaultShaderModule(e)}_pick(e,r,i){os(this.deckPicker);let{stats:n}=this;n.get("Pick Count").incrementCount(),n.get(r).timeStart();let o=this.deckPicker[e]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports(i),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i});return n.get(r).timeEnd(),o}_createCanvas(e){let r=e.canvas;return typeof r=="string"&&(r=document.getElementById(r),os(r)),r||(r=document.createElement("canvas"),r.id=e.id||"deckgl-overlay",(e.parent||document.body).appendChild(r)),Object.assign(r.style,e.style),r}_setCanvasSize(e){if(!this.canvas)return;let{width:r,height:i}=e;if(r||r===0){let n=Number.isFinite(r)?`${r}px`:r;this.canvas.style.width=n}if(i||i===0){let n=Number.isFinite(i)?`${i}px`:i;this.canvas.style.position=e.style?.position||"absolute",this.canvas.style.height=n}}_updateCanvasSize(){let{canvas:e}=this;if(!e)return;let r=e.clientWidth??e.width,i=e.clientHeight??e.height;(r!==this.width||i!==this.height)&&(this.width=r,this.height=i,this.viewManager?.setProps({width:r,height:i}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:r,height:i}))}_createAnimationLoop(e,r){let{gl:i,onError:n,useDevicePixels:o}=r;return new Yx({device:e,useDevicePixels:o,autoResizeDrawingBuffer:!i,autoResizeViewport:!1,onInitialize:s=>this._setDevice(s.device),onRender:this._onRenderFrame.bind(this),onError:n})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let{views:e}=this.props,r=Array.isArray(e)?e:e?[e]:[new Md({id:"default-view"})];return r.length&&this.props.controller&&(r[0].props.controller=this.props.controller),r}_onContextLost(){let{onError:e}=this.props;this.animationLoop&&e&&e(new Error("WebGL context is lost"))}_pickAndCallback(){let{_pickRequest:e}=this;if(e.event){let{result:r,emptyInfo:i}=this._pick("pickObject","pickObject Time",e);this.cursorState.isHovering=r.length>0;let n=i,o=!1;for(let s of r)n=s,o=s.layer?.onHover(s,e.event)||o;o||(this.props.onHover?.(n,e.event),this.widgetManager.onHover(n,e.event)),e.event=null}}_updateCursor(){let e=this.props.parent||this.canvas;e&&(e.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(e){if(this.device=e,!this.animationLoop)return;this.canvas||(this.canvas=this.device.canvasContext?.canvas),this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device instanceof wh&&this.props.onWebGLInitialized(this.device.gl);let r=new ym;r.play(),this.animationLoop.attachTimeline(r),this.eventManager=new p_(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let n in Nx)this.eventManager.on(n,this._onEvent);this.viewManager=new i1({timeline:r,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let i=this.viewManager.getViewports()[0];this.layerManager=new vm(this.device,{deck:this,stats:this.stats,viewport:i,timeline:r}),this.effectManager=new a1({deck:this,device:this.device}),this.deckRenderer=new wm(this.device),this.deckPicker=new c1(this.device),this.widgetManager=new _E({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new u1),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(e,r){let{device:i,gl:n}=this.layerManager.context;this.props.onBeforeRender({device:i,gl:n});let o={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...r};this.deckRenderer?.renderLayers(o),o.pass==="screen"&&this.widgetManager.onRedraw({viewports:o.viewports,layers:o.layers}),this.props.onAfterRender({device:i,gl:n})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),ur.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(e){let r=this.props.onViewStateChange(e)||e.viewState;this.viewState&&(this.viewState={...this.viewState,[e.viewId]:r},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(e){this.cursorState.isDragging=e.isDragging||!1,this.props.onInteractionStateChange(e)}_getFrameStats(){let{stats:e}=this;e.get("frameRate").timeEnd(),e.get("frameRate").timeStart();let r=this.animationLoop.stats;e.get("GPU Time").addTime(r.get("GPU Time").lastTiming),e.get("CPU Time").addTime(r.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:e,stats:r}=this;e.fps=r.get("frameRate").getHz(),e.setPropsTime=r.get("setProps Time").time,e.updateAttributesTime=r.get("Update Attributes").time,e.framesRedrawn=r.get("Redraw Count").count,e.pickTime=r.get("pickObject Time").time+r.get("pickMultipleObjects Time").time+r.get("pickObjects Time").time,e.pickCount=r.get("Pick Count").count,e.gpuTime=r.get("GPU Time").time,e.cpuTime=r.get("CPU Time").time,e.gpuTimePerFrame=r.get("GPU Time").getAverageTime(),e.cpuTimePerFrame=r.get("CPU Time").getAverageTime();let i=Ll.stats.get("Memory Usage");e.bufferMemory=i.get("Buffer Memory").count,e.textureMemory=i.get("Texture Memory").count,e.renderbufferMemory=i.get("Renderbuffer Memory").count,e.gpuMemory=i.get("GPU Memory").count}},Id=xE;(()=>{xE.defaultProps=u9})(),(()=>{xE.VERSION=xT})();function f9(t){switch(t){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return lx(t)}}var h9=Z2;function m1(t,e){return{attribute:t,format:e.size>1?`${e.type}x${e.size}`:e.type,byteOffset:e.offset||0}}function Wp(t){return t.stride||t.size*t.bytesPerElement}function d9(t,e){return t.type===e.type&&t.size===e.size&&Wp(t)===Wp(e)&&(t.offset||0)===(e.offset||0)}function cO(t,e){e.offset&&ur.removed("shaderAttribute.offset","vertexOffset, elementOffset")();let r=Wp(t),i=e.vertexOffset!==void 0?e.vertexOffset:t.vertexOffset||0,n=e.elementOffset||0,o=i*r+n*t.bytesPerElement+(t.offset||0);return{...e,offset:o,stride:r}}function Kfe(t,e){let r=cO(t,e);return{high:r,low:{...r,offset:r.offset+t.size*4}}}var g1=class{constructor(e,r,i){this._buffer=null,this.device=e,this.id=r.id||"",this.size=r.size||1;let n=r.logicalType||r.type,o=n==="float64",{defaultValue:s}=r;s=Number.isFinite(s)?[s]:s||new Array(this.size).fill(0);let l;o?l="float32":!n&&r.isIndexed?l="uint32":l=n||"float32";let u=f9(n||l);this.doublePrecision=o,o&&r.fp64===!1&&(u=Float32Array),this.value=null,this.settings={...r,defaultType:u,defaultValue:s,logicalType:n,type:l,normalized:l.includes("norm"),size:this.size,bytesPerElement:u.BYTES_PER_ELEMENT},this.state={...i,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){let e=this.getAccessor();return e.vertexOffset?e.vertexOffset*Wp(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),wf.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(e=this.id,r=null){let i={};if(this.state.constant){let n=this.value;if(r){let o=cO(this.getAccessor(),r),s=o.offset/n.BYTES_PER_ELEMENT,l=o.size||this.size;i[e]=n.subarray(s,s+l)}else i[e]=n}else i[e]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?i[`${e}64Low`]=i[e]:i[`${e}64Low`]=new Float32Array(this.size)),i}_getBufferLayout(e=this.id,r=null){let i=this.getAccessor(),n=[],o={name:this.id,byteStride:Wp(i),attributes:n};if(this.doublePrecision){let s=Kfe(i,r||{});n.push(m1(e,{...i,...s.high}),m1(`${e}64Low`,{...i,...s.low}))}else if(r){let s=cO(i,r);n.push(m1(e,{...i,...s}))}else n.push(m1(e,i));return o}setAccessor(e){this.state.bufferAccessor=e}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let e=null;if(this.state.constant&&this.value){let r=Array.from(this.value);e=[r,r]}else{let{value:r,numInstances:i,size:n}=this,o=i*n;if(r&&o&&r.length>=o){let s=new Array(n).fill(1/0),l=new Array(n).fill(-1/0);for(let u=0;u<o;)for(let h=0;h<n;h++){let v=r[u++];v<s[h]&&(s[h]=v),v>l[h]&&(l[h]=v)}e=[s,l]}}return this.state.bounds=e,e}setData(e){let{state:r}=this,i;ArrayBuffer.isView(e)?i={value:e}:e instanceof Xi?i={buffer:e}:i=e;let n={...this.settings,...i};if(ArrayBuffer.isView(i.value)){if(!i.type)if(this.doublePrecision&&i.value instanceof Float64Array)n.type="float32";else{let s=h9(i.value);n.type=n.normalized?s.replace("int","norm"):s}n.bytesPerElement=i.value.BYTES_PER_ELEMENT,n.stride=Wp(n)}if(r.bounds=null,i.constant){let o=i.value;if(o=this._normalizeValue(o,[],0),this.settings.normalized&&(o=this.normalizeConstant(o)),!(!r.constant||!this._areValuesEqual(o,this.value)))return!1;r.externalBuffer=null,r.constant=!0,this.value=ArrayBuffer.isView(o)?o:new Float32Array(o)}else if(i.buffer){let o=i.buffer;r.externalBuffer=o,r.constant=!1,this.value=i.value||null}else if(i.value){this._checkExternalBuffer(i);let o=i.value;r.externalBuffer=null,r.constant=!1,this.value=o;let{buffer:s}=this,l=Wp(n),u=(n.vertexOffset||0)*l;if(this.doublePrecision&&o instanceof Float64Array&&(o=lE(o,n)),this.settings.isIndexed){let v=this.settings.defaultType;o.constructor!==v&&(o=new v(o))}let h=o.byteLength+u+l*2;(!s||s.byteLength<h)&&(s=this._createBuffer(h)),s.write(o,u)}return this.setAccessor(n),!0}updateSubBuffer(e={}){this.state.bounds=null;let r=this.value,{startOffset:i=0,endOffset:n}=e;this.buffer.write(this.doublePrecision&&r instanceof Float64Array?lE(r,{size:this.size,startIndex:i,endIndex:n}):r.subarray(i,n),i*r.BYTES_PER_ELEMENT+this.byteOffset)}allocate(e,r=!1){let{state:i}=this,n=i.allocatedValue,o=wf.allocate(n,e+1,{size:this.size,type:this.settings.defaultType,copy:r});this.value=o;let{byteOffset:s}=this,{buffer:l}=this;return(!l||l.byteLength<o.byteLength+s)&&(l=this._createBuffer(o.byteLength+s),r&&n&&l.write(n instanceof Float64Array?lE(n,this):n,s)),i.allocatedValue=o,i.constant=!1,i.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(e){let{value:r}=e;if(!ArrayBuffer.isView(r))throw new Error(`Attribute ${this.id} value is not TypedArray`);let i=this.settings.defaultType,n=!1;if(this.doublePrecision&&(n=r.BYTES_PER_ELEMENT<4),n)throw new Error(`Attribute ${this.id} does not support ${r.constructor.name}`);!(r instanceof i)&&this.settings.normalized&&!("normalized"in e)&&ur.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(e){switch(this.settings.type){case"snorm8":return new Float32Array(e).map(r=>(r+128)/255*2-1);case"snorm16":return new Float32Array(e).map(r=>(r+32768)/65535*2-1);case"unorm8":return new Float32Array(e).map(r=>r/255);case"unorm16":return new Float32Array(e).map(r=>r/65535);default:return e}}_normalizeValue(e,r,i){let{defaultValue:n,size:o}=this.settings;if(Number.isFinite(e))return r[i]=e,r;if(!e){let s=o;for(;--s>=0;)r[i+s]=n[s];return r}switch(o){case 4:r[i+3]=Number.isFinite(e[3])?e[3]:n[3];case 3:r[i+2]=Number.isFinite(e[2])?e[2]:n[2];case 2:r[i+1]=Number.isFinite(e[1])?e[1]:n[1];case 1:r[i+0]=Number.isFinite(e[0])?e[0]:n[0];break;default:let s=o;for(;--s>=0;)r[i+s]=Number.isFinite(e[s])?e[s]:n[s]}return r}_areValuesEqual(e,r){if(!e||!r)return!1;let{size:i}=this;for(let n=0;n<i;n++)if(e[n]!==r[n])return!1;return!0}_createBuffer(e){this._buffer&&this._buffer.destroy();let{isIndexed:r,type:i}=this.settings;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:r?Xi.INDEX:Xi.VERTEX,indexType:r?i:void 0,byteLength:e}),this._buffer}};var p9=[],A9=[];function Js(t,e=0,r=1/0){let i=p9,n={index:-1,data:t,target:[]};return t?typeof t[Symbol.iterator]=="function"?i=t:t.length>0&&(A9.length=t.length,i=A9):i=p9,(e>0||Number.isFinite(r))&&(i=(Array.isArray(i)?i:Array.from(i)).slice(e,r),n.index=e-1),{iterable:i,objectInfo:n}}function bE(t){return t&&t[Symbol.asyncIterator]}function wE(t,e){let{size:r,stride:i,offset:n,startIndices:o,nested:s}=e,l=t.BYTES_PER_ELEMENT,u=i?i/l:r,h=n?n/l:0,v=Math.floor((t.length-h)/u);return(T,{index:E,target:M})=>{if(!o){let W=E*u+h;for(let J=0;J<r;J++)M[J]=t[W+J];return M}let O=o[E],F=o[E+1]||v,z;if(s){z=new Array(F-O);for(let W=O;W<F;W++){let J=W*u+h;M=new Array(r);for(let K=0;K<r;K++)M[K]=t[J+K];z[W-O]=M}}else if(u===r)z=t.subarray(O*r+h,F*r+h);else{z=new t.constructor((F-O)*r);let W=0;for(let J=O;J<F;J++){let K=J*u+h;for(let ne=0;ne<r;ne++)z[W++]=t[K+ne]}}return z}}var m9=[],_1=[[0,1/0]];function g9(t,e){if(t===_1||(e[0]<0&&(e[0]=0),e[0]>=e[1]))return t;let r=[],i=t.length,n=0;for(let o=0;o<i;o++){let s=t[o];s[1]<e[0]?(r.push(s),n=o+1):s[0]>e[1]?r.push(s):e=[Math.min(s[0],e[0]),Math.max(s[1],e[1])]}return r.splice(n,0,e),r}var Jfe={interpolation:{duration:0,easing:t=>t},spring:{stiffness:.05,damping:.5}};function TE(t,e){if(!t)return null;Number.isFinite(t)&&(t={type:"interpolation",duration:t});let r=t.type||"interpolation";return{...Jfe[r],...e,...t,type:r}}var Pd=class extends g1{constructor(e,r){super(e,r,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:_1}),this.constant=!1,this.settings.update=r.update||(r.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(e){this.state.startIndices=e}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:e=!1}={}){let r=this.state.needsRedraw;return this.state.needsRedraw=r&&!e,r}layoutChanged(){return this.state.layoutChanged}setAccessor(e){this.state.layoutChanged||=!d9(e,this.getAccessor()),super.setAccessor(e)}getUpdateTriggers(){let{accessor:e}=this.settings;return[this.id].concat(typeof e!="function"&&e||[])}supportsTransition(){return Boolean(this.settings.transition)}getTransitionSetting(e){if(!e||!this.supportsTransition())return null;let{accessor:r}=this.settings,i=this.settings.transition,n=Array.isArray(r)?e[r.find(o=>e[o])]:e[r];return TE(n,i)}setNeedsUpdate(e=this.id,r){if(this.state.needsUpdate=this.state.needsUpdate||e,this.setNeedsRedraw(e),r){let{startRow:i=0,endRow:n=1/0}=r;this.state.updateRanges=g9(this.state.updateRanges,[i,n])}else this.state.updateRanges=_1}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=m9}setNeedsRedraw(e=this.id){this.state.needsRedraw=this.state.needsRedraw||e}allocate(e){let{state:r,settings:i}=this;return i.noAlloc?!1:i.update?(super.allocate(e,r.updateRanges!==_1),!0):!1}updateBuffer({numInstances:e,data:r,props:i,context:n}){if(!this.needsUpdate())return!1;let{state:{updateRanges:o},settings:{update:s,noAlloc:l}}=this,u=!0;if(s){for(let[h,v]of o)s.call(n,this,{data:r,startRow:h,endRow:v,props:i,numInstances:e});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(let[h,v]of o){let T=Number.isFinite(h)?this.getVertexOffset(h):0,E=Number.isFinite(v)?this.getVertexOffset(v):l||!Number.isFinite(e)?this.value.length:e*this.size;super.updateSubBuffer({startOffset:T,endOffset:E})}this._checkAttributeArray()}else u=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),u}setConstantValue(e){return e===void 0||typeof e=="function"?!1:(this.setData({constant:!0,value:e})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0)}setExternalBuffer(e){let{state:r}=this;return e?(this.clearNeedsUpdate(),r.lastExternalBuffer===e||(r.lastExternalBuffer=e,this.setNeedsRedraw(),this.setData(e)),!0):(r.lastExternalBuffer=null,!1)}setBinaryValue(e,r=null){let{state:i,settings:n}=this;if(!e)return i.binaryValue=null,i.binaryAccessor=null,!1;if(n.noAlloc)return!1;if(i.binaryValue===e)return this.clearNeedsUpdate(),!0;if(i.binaryValue=e,this.setNeedsRedraw(),n.transform||r!==this.startIndices){ArrayBuffer.isView(e)&&(e={value:e});let s=e;os(ArrayBuffer.isView(s.value),`invalid ${n.accessor}`);let l=Boolean(s.size)&&s.size!==this.size;return i.binaryAccessor=wE(s.value,{size:s.size||this.size,stride:s.stride,offset:s.offset,startIndices:r,nested:l}),!1}return this.clearNeedsUpdate(),this.setData(e),!0}getVertexOffset(e){let{startIndices:r}=this;return(r?e<r.length?r[e]:this.numInstances:e)*this.size}getValue(){let e=this.settings.shaderAttributes,r=super.getValue();if(!e)return r;for(let i in e)Object.assign(r,super.getValue(i,e[i]));return r}getBufferLayout(e){this.state.layoutChanged=!1;let r=this.settings.shaderAttributes,i=super._getBufferLayout(),{stepMode:n}=this.settings;if(n==="dynamic"?i.stepMode=e?e.isInstanced?"instance":"vertex":"instance":i.stepMode=n??"vertex",!r)return i;for(let o in r){let s=super._getBufferLayout(o,r[o]);i.attributes.push(...s.attributes)}return i}_autoUpdater(e,{data:r,startRow:i,endRow:n,props:o,numInstances:s}){if(e.constant)return;let{settings:l,state:u,value:h,size:v,startIndices:T}=e,{accessor:E,transform:M}=l,O=u.binaryAccessor||(typeof E=="function"?E:o[E]);os(typeof O=="function",`accessor "${E}" is not a function`);let F=e.getVertexOffset(i),{iterable:z,objectInfo:W}=Js(r,i,n);for(let J of z){W.index++;let K=O(J,W);if(M&&(K=M.call(this,K)),T){let ne=(W.index<T.length-1?T[W.index+1]:s)-T[W.index];if(K&&Array.isArray(K[0])){let ge=F;for(let j of K)e._normalizeValue(j,h,ge),ge+=v}else K&&K.length>v?h.set(K,F):(e._normalizeValue(K,W.target,0),mE({target:h,source:W.target,start:F,count:ne}));F+=ne*v}else e._normalizeValue(K,h,F),F+=v}}_validateAttributeUpdaters(){let{settings:e}=this;if(!(e.noAlloc||typeof e.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){let{value:e}=this,r=Math.min(4,this.size);if(e&&e.length>=r){let i=!0;switch(r){case 4:i=i&&Number.isFinite(e[3]);case 3:i=i&&Number.isFinite(e[2]);case 2:i=i&&Number.isFinite(e[1]);case 1:i=i&&Number.isFinite(e[0]);break;default:i=!1}if(!i)throw new Error(`Illegal attribute generated for ${this.id}`)}}};function uO(t){let{source:e,target:r,start:i=0,size:n,getData:o}=t,s=t.end||r.length,l=e.length,u=s-i;if(l>u){r.set(e.subarray(0,u),i);return}if(r.set(e,i),!o)return;let h=l;for(;h<u;){let v=o(h,e);for(let T=0;T<n;T++)r[i+h]=v[T]||0,h++}}function _9({source:t,target:e,size:r,getData:i,sourceStartIndices:n,targetStartIndices:o}){if(!n||!o)return uO({source:t,target:e,size:r,getData:i}),e;let s=0,l=0,u=i&&((v,T)=>i(v+l,T)),h=Math.min(n.length,o.length);for(let v=1;v<h;v++){let T=n[v]*r,E=o[v]*r;uO({source:t.subarray(s,T),target:e,start:l,end:E,size:r,getData:u}),s=T,l=E}return l<e.length&&uO({source:[],target:e,start:l,size:r,getData:u}),e}function y9(t){let{device:e,settings:r,value:i}=t,n=new Pd(e,r);return n.setData({value:i instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:r.normalized}),n}function EE(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`No defined attribute type for size "${t}"`)}}function SE(t){switch(t){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw new Error("invalid type size")}}function CE(t){t.push(t.shift())}function v9(t,e){let{doublePrecision:r,settings:i,value:n,size:o}=t,s=r&&n instanceof Float64Array?2:1,l=0,{shaderAttributes:u}=t.settings;if(u)for(let h of Object.values(u))l=Math.max(l,h.vertexOffset??0);return(i.noAlloc?n.length:(e+l)*o)*s}function ME({device:t,source:e,target:r}){return(!r||r.byteLength<e.byteLength)&&(r?.destroy(),r=t.createBuffer({byteLength:e.byteLength,usage:e.usage})),r}function IE({device:t,buffer:e,attribute:r,fromLength:i,toLength:n,fromStartIndices:o,getData:s=l=>l}){let l=r.doublePrecision&&r.value instanceof Float64Array?2:1,u=r.size*l,h=r.byteOffset,v=r.settings.bytesPerElement<4?h/r.settings.bytesPerElement*4:h,T=r.startIndices,E=o&&T,M=r.isConstant;if(!E&&e&&i>=n)return e;let O=r.value instanceof Float64Array?Float32Array:r.value.constructor,F=M?r.value:new O(r.getBuffer().readSyncWebGL(h,n*O.BYTES_PER_ELEMENT).buffer);if(r.settings.normalized&&!M){let K=s;s=(ne,ge)=>r.normalizeConstant(K(ne,ge))}let z=M?(K,ne)=>s(F,ne):(K,ne)=>s(F.subarray(K+h,K+h+u),ne),W=e?new Float32Array(e.readSyncWebGL(v,i*4).buffer):new Float32Array(0),J=new Float32Array(n);return _9({source:W,target:J,sourceStartIndices:o,targetStartIndices:T,size:u,getData:z}),(!e||e.byteLength<J.byteLength+v)&&(e?.destroy(),e=t.createBuffer({byteLength:J.byteLength+v,usage:35050})),e.write(J,v),e}var A_=class{constructor({device:e,attribute:r,timeline:i}){this.buffers=[],this.currentLength=0,this.device=e,this.transition=new Ef(i),this.attribute=r,this.attributeInTransition=y9(r),this.currentStartIndices=r.startIndices}get inProgress(){return this.transition.inProgress}start(e,r,i=1/0){this.settings=e,this.currentStartIndices=this.attribute.startIndices,this.currentLength=v9(this.attribute,r),this.transition.start({...e,duration:i})}update(){let e=this.transition.update();return e&&this.onUpdate(),e}setBuffer(e){this.attributeInTransition.setData({buffer:e,normalized:this.attribute.settings.normalized,value:this.attributeInTransition.value})}cancel(){this.transition.cancel()}delete(){this.cancel();for(let e of this.buffers)e.destroy();this.buffers.length=0}};var y1=class extends A_{constructor({device:e,attribute:r,timeline:i}){super({device:e,attribute:r,timeline:i}),this.type="interpolation",this.transform=ehe(e,r)}start(e,r){let i=this.currentLength,n=this.currentStartIndices;if(super.start(e,r,e.duration),e.duration<=0){this.transition.cancel();return}let{buffers:o,attribute:s}=this;CE(o),o[0]=IE({device:this.device,buffer:o[0],attribute:s,fromLength:i,toLength:this.currentLength,fromStartIndices:n,getData:e.enter}),o[1]=ME({device:this.device,source:o[0],target:o[1]}),this.setBuffer(o[1]);let{transform:l}=this,u=l.model,h=Math.floor(this.currentLength/s.size);x9(s)&&(h/=2),u.setVertexCount(h),s.isConstant?(u.setAttributes({aFrom:o[0]}),u.setConstantAttributes({aTo:s.value})):u.setAttributes({aFrom:o[0],aTo:s.getBuffer()}),l.transformFeedback.setBuffers({vCurrent:o[1]})}onUpdate(){let{duration:e,easing:r}=this.settings,{time:i}=this.transition,n=i/e;r&&(n=r(n));let{model:o}=this.transform;o.setUniforms({time:n}),o.device.gl.bindBuffer(34962,null),this.transform.run({discard:!0})}delete(){super.delete(),this.transform.destroy()}},Qfe=`#version 300 es
#define SHADER_NAME interpolation-transition-vertex-shader
uniform float time;
in ATTRIBUTE_TYPE aFrom;
in ATTRIBUTE_TYPE aTo;
out ATTRIBUTE_TYPE vCurrent;
void main(void) {
vCurrent = mix(aFrom, aTo, time);
gl_Position = vec4(0.0);
}
`,$fe=`#version 300 es
#define SHADER_NAME interpolation-transition-vertex-shader
uniform float time;
in ATTRIBUTE_TYPE aFrom;
in ATTRIBUTE_TYPE aFrom64Low;
in ATTRIBUTE_TYPE aTo;
in ATTRIBUTE_TYPE aTo64Low;
out ATTRIBUTE_TYPE vCurrent;
out ATTRIBUTE_TYPE vCurrent64Low;
vec2 mix_fp64(vec2 a, vec2 b, float x) {
vec2 range = sub_fp64(b, a);
return sum_fp64(a, mul_fp64(range, vec2(x, 0.0)));
}
void main(void) {
for (int i=0; i<ATTRIBUTE_SIZE; i++) {
vec2 value = mix_fp64(vec2(aFrom[i], aFrom64Low[i]), vec2(aTo[i], aTo64Low[i]), time);
vCurrent[i] = value.x;
vCurrent64Low[i] = value.y;
}
gl_Position = vec4(0.0);
}
`;function x9(t){return t.doublePrecision&&t.value instanceof Float64Array}function ehe(t,e){let r=e.size,i=EE(r),n=SE(r),o=e.getBufferLayout();return x9(e)?new zu(t,{vs:$fe,bufferLayout:[{name:"aFrom",byteStride:8*r,attributes:[{attribute:"aFrom",format:n,byteOffset:0},{attribute:"aFrom64Low",format:n,byteOffset:4*r}]},{name:"aTo",byteStride:8*r,attributes:[{attribute:"aTo",format:n,byteOffset:0},{attribute:"aTo64Low",format:n,byteOffset:4*r}]}],modules:[Dp],defines:{ATTRIBUTE_TYPE:i,ATTRIBUTE_SIZE:r},moduleSettings:{},varyings:["vCurrent","vCurrent64Low"],bufferMode:35980,disableWarnings:!0}):new zu(t,{vs:Qfe,bufferLayout:[{name:"aFrom",format:n},{name:"aTo",format:o.attributes[0].format}],defines:{ATTRIBUTE_TYPE:i},varyings:["vCurrent"],disableWarnings:!0})}var v1=class extends A_{constructor({device:e,attribute:r,timeline:i}){super({device:e,attribute:r,timeline:i}),this.type="spring",this.texture=nhe(e),this.framebuffer=ohe(e,this.texture),this.transform=ihe(e,r)}start(e,r){let i=this.currentLength,n=this.currentStartIndices;super.start(e,r);let{buffers:o,attribute:s}=this;for(let u=0;u<2;u++)o[u]=IE({device:this.device,buffer:o[u],attribute:s,fromLength:i,toLength:this.currentLength,fromStartIndices:n,getData:e.enter});o[2]=ME({device:this.device,source:o[0],target:o[2]}),this.setBuffer(o[1]);let{model:l}=this.transform;l.setVertexCount(Math.floor(this.currentLength/s.size)),s.isConstant?l.setConstantAttributes({aTo:s.value}):l.setAttributes({aTo:s.getBuffer()})}onUpdate(){let{buffers:e,transform:r,framebuffer:i,transition:n}=this,o=this.settings;r.model.setAttributes({aPrev:e[0],aCur:e[1]}),r.transformFeedback.setBuffers({vNext:e[2]}),r.model.setUniforms({stiffness:o.stiffness,damping:o.damping}),r.run({framebuffer:i,discard:!1,parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]}),CE(e),this.setBuffer(e[1]),this.device.readPixelsToArrayWebGL(i)[0]>0||n.end()}delete(){super.delete(),this.transform.destroy(),this.texture.destroy(),this.framebuffer.destroy()}},the=`#version 300 es
#define SHADER_NAME spring-transition-vertex-shader
#define EPSILON 0.00001
uniform float stiffness;
uniform float damping;
in ATTRIBUTE_TYPE aPrev;
in ATTRIBUTE_TYPE aCur;
in ATTRIBUTE_TYPE aTo;
out ATTRIBUTE_TYPE vNext;
out float vIsTransitioningFlag;
ATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {
ATTRIBUTE_TYPE velocity = cur - prev;
ATTRIBUTE_TYPE delta = dest - cur;
ATTRIBUTE_TYPE spring = delta * stiffness;
ATTRIBUTE_TYPE damper = velocity * -1.0 * damping;
return spring + damper + velocity + cur;
}
void main(void) {
bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;
vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;
vNext = getNextValue(aCur, aPrev, aTo);
gl_Position = vec4(0, 0, 0, 1);
gl_PointSize = 100.0;
}
`,rhe=`#version 300 es
#define SHADER_NAME spring-transition-is-transitioning-fragment-shader
in float vIsTransitioningFlag;
out vec4 fragColor;
void main(void) {
if (vIsTransitioningFlag == 0.0) {
discard;
}
fragColor = vec4(1.0);
}`;function ihe(t,e){let r=EE(e.size),i=SE(e.size);return new zu(t,{vs:the,fs:rhe,bufferLayout:[{name:"aPrev",format:i},{name:"aCur",format:i},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],defines:{ATTRIBUTE_TYPE:r},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function nhe(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}function ohe(t,e){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}var she={interpolation:y1,spring:v1},x1=class{constructor(e,{id:r,timeline:i}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=r,this.device=e,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:r,numInstances:i}){this.numInstances=i||1;for(let n in e){let o=e[n],s=o.getTransitionSetting(r);s&&this._updateAttribute(n,o,s)}for(let n in this.transitions){let o=e[n];(!o||!o.getTransitionSetting(r))&&this._removeTransition(n)}}hasAttribute(e){let r=this.transitions[e];return r&&r.inProgress}getAttributes(){let e={};for(let r in this.transitions){let i=this.transitions[r];i.inProgress&&(e[r]=i.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(let r in this.transitions)this.transitions[r].update()&&(this.needsRedraw=!0);let e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,r,i){let n=this.transitions[e],o=!n||n.type!==i.type;if(o){n&&this._removeTransition(e);let s=she[i.type];s?this.transitions[e]=new s({attribute:r,timeline:this.timeline,device:this.device}):(ur.error(`unsupported transition type '${i.type}'`)(),o=!1)}(o||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(i,this.numInstances))}};var b9="attributeManager.invalidate",ahe="attributeManager.updateStart",lhe="attributeManager.updateEnd",che="attribute.updateStart",uhe="attribute.allocate",fhe="attribute.updateEnd",Mf=class{constructor(e,{id:r="attribute-manager",stats:i,timeline:n}={}){this.mergeBoundsMemoized=Nu(EV),this.id=r,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new x1(e,{id:`${r}-transitions`,timeline:n}),Object.seal(this)}finalize(){for(let e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(let r of e)this.attributes[r]!==void 0&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(e,r){let i=this._invalidateTrigger(e,r);Ks(b9,this,e,i)}invalidateAll(e){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,e);Ks(b9,this,"all")}update({data:e,numInstances:r,startIndices:i=null,transitions:n,props:o={},buffers:s={},context:l={}}){let u=!1;Ks(ahe,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(let h in this.attributes){let v=this.attributes[h],T=v.settings.accessor;v.startIndices=i,v.numInstances=r,o[h]&&ur.removed(`props.${h}`,`data.attributes.${h}`)(),v.setExternalBuffer(s[h])||v.setBinaryValue(typeof T=="string"?s[T]:void 0,e.startIndices)||typeof T=="string"&&!s[T]&&v.setConstantValue(o[T])||v.needsUpdate()&&(u=!0,this._updateAttribute({attribute:v,numInstances:r,data:e,props:o,context:l})),this.needsRedraw=this.needsRedraw||v.needsRedraw()}u&&Ks(lhe,this,r),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:n})}updateTransition(){let{attributeTransitionManager:e}=this,r=e.run();return this.needsRedraw=this.needsRedraw||r,r}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){let r=e.map(i=>this.attributes[i]?.getBounds());return this.mergeBoundsMemoized(r)}getChangedAttributes(e={clearChangedFlags:!1}){let{attributes:r,attributeTransitionManager:i}=this,n={...i.getAttributes()};for(let o in r){let s=r[o];s.needsRedraw(e)&&!i.hasAttribute(o)&&(n[o]=s)}return n}getBufferLayouts(e){return Object.values(this.getAttributes()).map(r=>r.getBufferLayout(e))}_add(e,r){for(let i in e){let n=e[i],o={...n,id:i,size:n.isIndexed&&1||n.size||1,...r};this.attributes[i]=new Pd(this.device,o)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){let e={};for(let r in this.attributes)this.attributes[r].getUpdateTriggers().forEach(n=>{e[n]||(e[n]=[]),e[n].push(r)});this.updateTriggers=e}_invalidateTrigger(e,r){let{attributes:i,updateTriggers:n}=this,o=n[e];return o&&o.forEach(s=>{let l=i[s];l&&l.setNeedsUpdate(l.id,r)}),o}_updateAttribute(e){let{attribute:r,numInstances:i}=e;if(Ks(che,r),r.constant){r.setConstantValue(r.value);return}r.allocate(i)&&Ks(uhe,r,i),r.updateBuffer(e)&&(this.needsRedraw=!0,Ks(fhe,r,i))}};var b1=class extends Ef{get value(){return this._value}_onUpdate(){let{time:e,settings:{fromValue:r,toValue:i,duration:n,easing:o}}=this,s=o(e/n);this._value=Oa(r,i,s)}};var w9=1e-5;function T9(t,e,r,i,n){let o=e-t,l=(r-e)*n,u=-o*i;return l+u+o+e}function hhe(t,e,r,i,n){if(Array.isArray(r)){let o=[];for(let s=0;s<r.length;s++)o[s]=T9(t[s],e[s],r[s],i,n);return o}return T9(t,e,r,i,n)}function E9(t,e){if(Array.isArray(t)){let r=0;for(let i=0;i<t.length;i++){let n=t[i]-e[i];r+=n*n}return Math.sqrt(r)}return Math.abs(t-e)}var w1=class extends Ef{get value(){return this._currValue}_onUpdate(){let{fromValue:e,toValue:r,damping:i,stiffness:n}=this.settings,{_prevValue:o=e,_currValue:s=e}=this,l=hhe(o,s,r,i,n),u=E9(l,r),h=E9(l,s);u<w9&&h<w9&&(l=r,this.end()),this._prevValue=s,this._currValue=l}};var dhe={interpolation:b1,spring:w1},T1=class{constructor(e){this.transitions=new Map,this.timeline=e}get active(){return this.transitions.size>0}add(e,r,i,n){let{transitions:o}=this;if(o.has(e)){let u=o.get(e),{value:h=u.settings.fromValue}=u;r=h,this.remove(e)}if(n=TE(n),!n)return;let s=dhe[n.type];if(!s){ur.error(`unsupported transition type '${n.type}'`)();return}let l=new s(this.timeline);l.start({...n,fromValue:r,toValue:i}),o.set(e,l)}remove(e){let{transitions:r}=this;r.has(e)&&(r.get(e).cancel(),r.delete(e))}update(){let e={};for(let[r,i]of this.transitions)i.update(),e[r]=i.value,i.inProgress||this.remove(r);return e}clear(){for(let e of this.transitions.keys())this.remove(e)}};function C9(t){let e=t[Hu];for(let r in e){let i=e[r],{validate:n}=i;if(n&&!n(t[r],i))throw new Error(`Invalid prop ${r}: ${t[r]}`)}}function M9(t,e){let r=m_({newProps:t,oldProps:e,propTypes:t[Hu],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),i=Ahe(t,e),n=!1;return i||(n=mhe(t,e)),{dataChanged:i,propsChanged:r,updateTriggersChanged:n,extensionsChanged:ghe(t,e),transitionsChanged:phe(t,e)}}function phe(t,e){if(!t.transitions)return!1;let r={},i=t[Hu],n=!1;for(let o in t.transitions){let s=i[o],l=s&&s.type;(l==="number"||l==="color"||l==="array")&&fO(t[o],e[o],s)&&(r[o]=!0,n=!0)}return n?r:!1}function m_({newProps:t,oldProps:e,ignoreProps:r={},propTypes:i={},triggerName:n="props"}){if(e===t)return!1;if(typeof t!="object"||t===null)return`${n} changed shallowly`;if(typeof e!="object"||e===null)return`${n} changed shallowly`;for(let o of Object.keys(t))if(!(o in r)){if(!(o in e))return`${n}.${o} added`;let s=fO(t[o],e[o],i[o]);if(s)return`${n}.${o} ${s}`}for(let o of Object.keys(e))if(!(o in r)){if(!(o in t))return`${n}.${o} dropped`;if(!Object.hasOwnProperty.call(t,o)){let s=fO(t[o],e[o],i[o]);if(s)return`${n}.${o} ${s}`}}return!1}function fO(t,e,r){let i=r&&r.equal;return i&&!i(t,e,r)||!i&&(i=t&&e&&t.equals,i&&!i.call(t,e))?"changed deeply":!i&&e!==t?"changed shallowly":null}function Ahe(t,e){if(e===null)return"oldProps is null, initial diff";let r=!1,{dataComparator:i,_dataDiff:n}=t;return i?i(t.data,e.data)||(r="Data comparator detected a change"):t.data!==e.data&&(r="A new data container was supplied"),r&&n&&(r=n(t.data,e.data)||r),r}function mhe(t,e){if(e===null)return{all:!0};if("all"in t.updateTriggers&&S9(t,e,"all"))return{all:!0};let r={},i=!1;for(let n in t.updateTriggers)n!=="all"&&S9(t,e,n)&&(r[n]=!0,i=!0);return i?r:!1}function ghe(t,e){if(e===null)return!0;let r=e.extensions,{extensions:i}=t;if(i===r)return!1;if(!r||!i||i.length!==r.length)return!0;for(let n=0;n<i.length;n++)if(!i[n].equals(r[n]))return!0;return!1}function S9(t,e,r){let i=t.updateTriggers[r];i=i??{};let n=e.updateTriggers[r];return n=n??{},m_({oldProps:n,newProps:i,triggerName:r})}var _he="count(): argument not an object",yhe="count(): argument not a container";function PE(t){if(!xhe(t))throw new Error(_he);if(typeof t.count=="function")return t.count();if(Number.isFinite(t.size))return t.size;if(Number.isFinite(t.length))return t.length;if(vhe(t))return Object.keys(t).length;throw new Error(yhe)}function vhe(t){return t!==null&&typeof t=="object"&&t.constructor===Object}function xhe(t){return t!==null&&typeof t=="object"}function Sm(t,e){if(!e)return t;let r={...t,...e};if("defines"in e&&(r.defines={...t.defines,...e.defines}),"modules"in e&&(r.modules=(t.modules||[]).concat(e.modules),e.modules.some(i=>i.name==="project64"))){let i=r.modules.findIndex(n=>n.name==="project32");i>=0&&r.modules.splice(i,1)}if("inject"in e)if(!t.inject)r.inject=e.inject;else{let i={...t.inject};for(let n in e.inject)i[n]=(i[n]||"")+e.inject[n];r.inject=i}return r}var bhe={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},hO={};function I9(t,e,r,i){if(r instanceof bo)return r;r.constructor&&r.constructor.name!=="Object"&&(r={data:r});let n=null;r.compressed&&(n={minFilter:"linear",mipmapFilter:r.data.length>1?"nearest":"linear"});let o=e.createTexture({...r,sampler:{...bhe,...n,...i}});return hO[o.id]=t,o}function P9(t,e){!e||!(e instanceof bo)||hO[e.id]===t&&(e.delete(),delete hO[e.id])}var whe={boolean:{validate(t,e){return!0},equal(t,e,r){return Boolean(t)===Boolean(e)}},number:{validate(t,e){return Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)}},color:{validate(t,e){return e.optional&&!t||dO(t)&&(t.length===3||t.length===4)},equal(t,e,r){return Ls(t,e,1)}},accessor:{validate(t,e){let r=RE(t);return r==="function"||r===RE(e.value)},equal(t,e,r){return typeof e=="function"?!0:Ls(t,e,1)}},array:{validate(t,e){return e.optional&&!t||dO(t)},equal(t,e,r){let{compare:i}=r,n=Number.isInteger(i)?i:i?1:0;return i?Ls(t,e,n):t===e}},object:{equal(t,e,r){if(r.ignore)return!0;let{compare:i}=r,n=Number.isInteger(i)?i:i?1:0;return i?Ls(t,e,n):t===e}},function:{validate(t,e){return e.optional&&!t||typeof t=="function"},equal(t,e,r){return!r.compare&&r.ignore!==!1||t===e}},data:{transform:(t,e,r)=>{if(!t)return t;let{dataTransform:i}=r.props;return i?i(t):typeof t.shape=="string"&&t.shape.endsWith("-table")&&Array.isArray(t.data)?t.data:t}},image:{transform:(t,e,r)=>{let i=r.context;return!i||!i.device?null:I9(r.id,i.device,t,{...e.parameters,...r.props.textureParameters})},release:(t,e,r)=>{P9(r.id,t)}}};function R9(t){let e={},r={},i={};for(let[n,o]of Object.entries(t)){let s=o?.deprecatedFor;if(s)i[n]=Array.isArray(s)?s:[s];else{let l=The(n,o);e[n]=l,r[n]=l.value}}return{propTypes:e,defaultProps:r,deprecatedProps:i}}function The(t,e){switch(RE(e)){case"object":return E1(t,e);case"array":return E1(t,{type:"array",value:e,compare:!1});case"boolean":return E1(t,{type:"boolean",value:e});case"number":return E1(t,{type:"number",value:e});case"function":return E1(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function E1(t,e){return"type"in e?{name:t,...whe[e.type],...e}:"value"in e?{name:t,type:RE(e.value),...e}:{name:t,type:"object",value:e}}function dO(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function RE(t){return dO(t)?"array":t===null?"null":typeof t}function B9(t,e){let r;for(let o=e.length-1;o>=0;o--){let s=e[o];"extensions"in s&&(r=s.extensions)}let i=pO(t.constructor,r),n=Object.create(i);n[f_]=t,n[Ph]={},n[Tf]={};for(let o=0;o<e.length;++o){let s=e[o];for(let l in s)n[l]=s[l]}return Object.freeze(n),n}var Ehe="_mergedDefaultProps";function pO(t,e){let r=Ehe;if(e)for(let n of e){let o=n.constructor;o&&(r+=`:${o.extensionName||o.name}`)}let i=O9(t,r);return i||(t[r]=She(t,e||[]))}function She(t,e){if(!t.prototype)return null;let i=Object.getPrototypeOf(t),n=pO(i),o=O9(t,"defaultProps")||{},s=R9(o),l=Object.assign(Object.create(null),n,s.defaultProps),u=Object.assign(Object.create(null),n?.[Hu],s.propTypes),h=Object.assign(Object.create(null),n?.[AE],s.deprecatedProps);for(let v of e){let T=pO(v.constructor);T&&(Object.assign(l,T),Object.assign(u,T[Hu]),Object.assign(h,T[AE]))}return Che(l,t),Ihe(l,u),Mhe(l,h),l[Hu]=u,l[AE]=h,e.length===0&&!AO(t,"_propTypes")&&(t._propTypes=u),l}function Che(t,e){let r=Rhe(e);Object.defineProperties(t,{id:{writable:!0,value:r}})}function Mhe(t,e){for(let r in e)Object.defineProperty(t,r,{enumerable:!1,set(i){let n=`${this.id}: ${r}`;for(let o of e[r])AO(this,o)||(this[o]=i);ur.deprecated(n,e[r].join("/"))()}})}function Ihe(t,e){let r={},i={};for(let n in e){let o=e[n],{name:s,value:l}=o;o.async&&(r[s]=l,i[s]=Phe(s))}t[wd]=r,t[Ph]={},Object.defineProperties(t,i)}function Phe(t){return{enumerable:!0,set(e){typeof e=="string"||e instanceof Promise||bE(e)?this[Ph][t]=e:this[Tf][t]=e},get(){if(this[Tf]){if(t in this[Tf])return this[Tf][t]||this[wd][t];if(t in this[Ph]){let e=this[f_]&&this[f_].internalState;if(e&&e.hasAsyncProp(t))return e.getAsyncProp(t)||this[wd][t]}}return this[wd][t]}}}function AO(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function O9(t,e){return AO(t,e)&&t[e]}function Rhe(t){let e=t.componentName;return e||ur.warn(`${t.name}.componentName not specified`)(),e||t.name}var Bhe=0,BE=class{constructor(...e){this.props=B9(this,e),this.id=this.props.id,this.count=Bhe++}clone(e){let{props:r}=this,i={};for(let n in r[wd])n in r[Tf]?i[n]=r[Tf][n]:n in r[Ph]&&(i[n]=r[Ph][n]);return new this.constructor({...r,...i,...e})}},Cm=BE;(()=>{BE.componentName="Component"})(),(()=>{BE.defaultProps={}})();var Ohe=Object.freeze({}),Mm=class{constructor(e){this.component=e,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let e in this.asyncProps){let r=this.asyncProps[e];r&&r.type&&r.type.release&&r.type.release(r.resolvedValue,r.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||Ohe}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){let r=this.asyncProps[e];return r&&r.resolvedValue}isAsyncPropLoading(e){if(e){let r=this.asyncProps[e];return Boolean(r&&r.pendingLoadCount>0&&r.pendingLoadCount!==r.resolvedLoadCount)}for(let r in this.asyncProps)if(this.isAsyncPropLoading(r))return!0;return!1}reloadAsyncProp(e,r){this._watchPromise(e,Promise.resolve(r))}setAsyncProps(e){this.component=e[f_]||this.component;let r=e[Tf]||{},i=e[Ph]||e,n=e[wd]||{};for(let o in r){let s=r[o];this._createAsyncPropData(o,n[o]),this._updateAsyncProp(o,s),r[o]=this.getAsyncProp(o)}for(let o in i){let s=i[o];this._createAsyncPropData(o,n[o]),this._updateAsyncProp(o,s)}}_fetch(e,r){return null}_onResolve(e,r){}_onError(e,r){}_updateAsyncProp(e,r){if(this._didAsyncInputValueChange(e,r)){if(typeof r=="string"&&(r=this._fetch(e,r)),r instanceof Promise){this._watchPromise(e,r);return}if(bE(r)){this._resolveAsyncIterable(e,r);return}this._setPropValue(e,r)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,r){let i=this.asyncProps[e];return r===i.resolvedValue||r===i.lastValue?!1:(i.lastValue=r,!0)}_setPropValue(e,r){this._freezeAsyncOldProps();let i=this.asyncProps[e];i&&(r=this._postProcessValue(i,r),i.resolvedValue=r,i.pendingLoadCount++,i.resolvedLoadCount=i.pendingLoadCount)}_setAsyncPropValue(e,r,i){let n=this.asyncProps[e];n&&i>=n.resolvedLoadCount&&r!==void 0&&(this._freezeAsyncOldProps(),n.resolvedValue=r,n.resolvedLoadCount=i,this.onAsyncPropUpdated(e,r))}_watchPromise(e,r){let i=this.asyncProps[e];if(i){i.pendingLoadCount++;let n=i.pendingLoadCount;r.then(o=>{this.component&&(o=this._postProcessValue(i,o),this._setAsyncPropValue(e,o,n),this._onResolve(e,o))}).catch(o=>{this._onError(e,o)})}}async _resolveAsyncIterable(e,r){if(e!=="data"){this._setPropValue(e,r);return}let i=this.asyncProps[e];if(!i)return;i.pendingLoadCount++;let n=i.pendingLoadCount,o=[],s=0;for await(let l of r){if(!this.component)return;let{dataTransform:u}=this.component.props;u?o=u(l,o):o=o.concat(l),Object.defineProperty(o,"__diff",{enumerable:!1,value:[{startRow:s,endRow:o.length}]}),s=o.length,this._setAsyncPropValue(e,o,n)}this._onResolve(e,o)}_postProcessValue(e,r){let i=e.type;return i&&this.component&&(i.release&&i.release(e.resolvedValue,i,this.component),i.transform)?i.transform(r,i,this.component):r}_createAsyncPropData(e,r){if(!this.asyncProps[e]){let n=this.component&&this.component.props[Hu];this.asyncProps[e]={type:n&&n[e],lastValue:null,resolvedValue:r,pendingLoadCount:0,resolvedLoadCount:0}}}};var S1=class extends Mm{constructor({attributeManager:e,layer:r}){super(r),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,r){let i=this.layer,n=i?.props.fetch;return n?n(r,{propName:e,layer:i}):super._fetch(e,r)}_onResolve(e,r){let i=this.layer;if(i){let n=i.props.onDataLoad;e==="data"&&n&&n(r,{propName:e,layer:i})}}_onError(e,r){let i=this.layer;i&&i.raiseError(r,`loading ${e} of ${this.layer}`)}};var Dhe="layer.changeFlag",Lhe="layer.initialize",Fhe="layer.update",Nhe="layer.finalize",khe="layer.matched",D9=2**24-1,Uhe=Object.freeze([]),zhe=Nu(({oldViewport:t,viewport:e})=>t.equals(e)),Bh=new Uint8ClampedArray(0),Vhe={data:{type:"data",value:Uhe,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(t,{propName:e,layer:r,loaders:i,loadOptions:n,signal:o})=>{let{resourceManager:s}=r.context;n=n||r.getLoadOptions(),i=i||r.props.loaders,o&&(n={...n,fetch:{...n?.fetch,signal:o}});let l=s.contains(t);return!l&&!n&&(s.add({resourceId:t,data:_a(t,i),persistent:!1}),l=!0),l?s.subscribe({resourceId:t,onChange:u=>r.internalState?.reloadAsyncProp(e,u),consumerId:r.id,requestId:e}):_a(t,i,n)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:Zr.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:t})=>[0,-t*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}},OE=class extends Cm{constructor(){super(...arguments),this.internalState=null,this.lifecycle=Hp.NO_STATE,this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(e){os(this.internalState);let r=this.internalState.viewport||this.context.viewport,i=QB(e,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[n,o,s]=i_(i,r.pixelProjectionMatrix);return e.length===2?[n,o]:[n,o,s]}unproject(e){return os(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,r){os(this.internalState);let i=this.internalState.viewport||this.context.viewport;return uE(e,{viewport:i,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...r})}get isComposite(){return!1}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){let e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setModuleParameters(e){for(let r of this.getModels())r.updateModuleSettings(e)}setShaderModuleProps(...e){for(let r of this.getModels())r.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:e}=this.props;return e===Zr.DEFAULT||e===Zr.LNGLAT||e===Zr.CARTESIAN}onHover(e,r){return this.props.onHover&&this.props.onHover(e,r)||!1}onClick(e,r){return this.props.onClick&&this.props.onClick(e,r)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,r=[]){return r[0]=e+1&255,r[1]=e+1>>8&255,r[2]=e+1>>8>>8&255,r}decodePickingColor(e){os(e instanceof Uint8Array);let[r,i,n]=e;return r+i*256+n*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:PE(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(e){e=Sm(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(let r of this.props.extensions)e=Sm(e,r.getShaders.call(this,r));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){let r=this.getAttributeManager(),{dataChanged:i}=e.changeFlags;if(i&&r)if(Array.isArray(i))for(let n of i)r.invalidateAll(n);else r.invalidateAll();if(r){let{props:n}=e,o=this.internalState.hasPickingBuffer,s=Number.isInteger(n.highlightedObjectIndex)||n.pickable||n.extensions.some(l=>l.getNeedsPickingBuffer.call(this,l));if(o!==s){this.internalState.hasPickingBuffer=s;let{pickingColors:l,instancePickingColors:u}=r.attributes,h=l||u;h&&(s&&h.constant&&(h.constant=!1,r.invalidate(h.id)),!h.value&&!s&&(h.constant=!0,h.value=[0,0,0]))}}}finalizeState(e){for(let i of this.getModels())i.destroy();let r=this.getAttributeManager();r&&r.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(let r of this.getModels())r.draw(e)}getPickingInfo({info:e,mode:r,sourceLayer:i}){let{index:n}=e;return n>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[n]),e}raiseError(e,r){r&&(e=new Error(`${r}: ${e.message}`,{cause:e})),this.props.onError?.(e)||this.context?.onError?.(e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(e){if(!this.internalState)return;let r=this.internalState.viewport;this.internalState.viewport=e,(!r||!zhe({oldViewport:r,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){let r=this.getAttributeManager();r&&(e==="all"?r.invalidateAll():r.invalidate(e))}updateAttributes(e){let r=!1;for(let i in e)e[i].layoutChanged()&&(r=!0);for(let i of this.getModels())this._setModelAttributes(i,e,r)}_updateAttributes(){let e=this.getAttributeManager();if(!e)return;let r=this.props,i=this.getNumInstances(),n=this.getStartIndices();e.update({data:r.data,numInstances:i,startIndices:n,props:r,transitions:r.transitions,buffers:r.data.attributes,context:this});let o=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(o)}_updateAttributeTransition(){let e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){let{uniformTransitions:e}=this.internalState;if(e.active){let r=e.update(),i=Object.create(this.props);for(let n in r)Object.defineProperty(i,n,{value:r[n]});return i}return this.props}calculateInstancePickingColors(e,{numInstances:r}){if(e.constant)return;let i=Math.floor(Bh.length/4);if(this.internalState.usesPickingColorCache=!0,i<r){r>D9&&ur.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),Bh=wf.allocate(Bh,r,{size:4,copy:!0,maxCount:Math.max(r,D9)});let n=Math.floor(Bh.length/4),o=[];for(let s=i;s<n;s++)this.encodePickingColor(s,o),Bh[s*4+0]=o[0],Bh[s*4+1]=o[1],Bh[s*4+2]=o[2]}e.value=Bh.subarray(0,r*4)}_setModelAttributes(e,r,i=!1){if(!Object.keys(r).length)return;if(i){let l=this.getAttributeManager();e.setBufferLayout(l.getBufferLayouts(e)),r=l.getAttributes()}let n=e.userData?.excludeAttributes||{},o={},s={};for(let l in r){if(n[l])continue;let u=r[l].getValue();for(let h in u){let v=u[h];v instanceof Xi?r[l].settings.isIndexed?e.setIndexBuffer(v):o[h]=v:v&&(s[h]=v)}}e.setAttributes(o),e.setConstantAttributes(s)}disablePickingIndex(e){let r=this.props.data;if(!("attributes"in r)){this._disablePickingIndex(e);return}let{pickingColors:i,instancePickingColors:n}=this.getAttributeManager().attributes,o=i||n,s=o&&r.attributes&&r.attributes[o.id];if(s&&s.value){let l=s.value,u=this.encodePickingColor(e);for(let h=0;h<r.length;h++){let v=o.getVertexOffset(h);l[v]===u[0]&&l[v+1]===u[1]&&l[v+2]===u[2]&&this._disablePickingIndex(h)}}else this._disablePickingIndex(e)}_disablePickingIndex(e){let{pickingColors:r,instancePickingColors:i}=this.getAttributeManager().attributes,n=r||i;if(!n)return;let o=n.getVertexOffset(e),s=n.getVertexOffset(e+1);n.buffer.write(new Uint8Array(s-o),o)}restorePickingColors(){let{pickingColors:e,instancePickingColors:r}=this.getAttributeManager().attributes,i=e||r;i&&(this.internalState.usesPickingColorCache&&i.value.buffer!==Bh.buffer&&(i.value=Bh.subarray(0,i.value.length)),i.updateSubBuffer({startOffset:0}))}_initialize(){os(!this.internalState),os(Number.isFinite(this.props.coordinateSystem)),Ks(Lhe,this);let e=this._getAttributeManager();e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new S1({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(ur.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new T1(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(let r of this.props.extensions)r.initializeState.call(this,this.context,r);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){Ks(khe,this,this===e);let{state:r,internalState:i}=e;this!==e&&(this.internalState=i,this.state=r,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let e=this.needsUpdate();if(Ks(Fhe,this,e),!e)return;let r=this.props,i=this.context,n=this.internalState,o=i.viewport,s=this._updateUniformTransition();n.propsInTransition=s,i.viewport=n.viewport||o,this.props=s;try{let l=this._getUpdateParams(),u=this.getModels();if(i.device)this.updateState(l);else try{this.updateState(l)}catch{}for(let v of this.props.extensions)v.updateState.call(this,l,v);let h=this.getModels()[0]!==u[0];this._postUpdate(l,h)}finally{i.viewport=o,this.props=r,this._clearChangeFlags(),n.needsUpdate=!1,n.resetOldProps()}}_finalize(){Ks(Nhe,this),this.finalizeState(this.context);for(let e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,moduleParameters:r=null,uniforms:i={},parameters:n={}}){this._updateAttributeTransition();let o=this.props,s=this.context;this.props=this.internalState.propsInTransition||o;let l=this.props.opacity;i.opacity=Math.pow(l,1/2.2);try{if(r){let{isActive:v,isAttribute:T}=r.picking,{viewport:E,devicePixelRatio:M,coordinateSystem:O,coordinateOrigin:F}=r,{modelMatrix:z}=this.props;this.setModuleParameters(r),this.setShaderModuleProps({picking:{isActive:v,isAttribute:T},project:{viewport:E,devicePixelRatio:M,modelMatrix:z,coordinateSystem:O,coordinateOrigin:F}})}let{getPolygonOffset:u}=this.props,h=u&&u(i)||[0,0];s.device.setParametersWebGL({polygonOffset:h});for(let v of this.getModels())v.setParameters(n);s.device.withParametersWebGL(n,()=>{let v={renderPass:e,moduleParameters:r,uniforms:i,parameters:n,context:s};for(let T of this.props.extensions)T.draw.call(this,v,T);this.draw(v)})}finally{this.props=o}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(e){if(!this.internalState)return;let{changeFlags:r}=this.internalState;for(let n in e)if(e[n]){let o=!1;switch(n){case"dataChanged":let s=e[n],l=r[n];s&&Array.isArray(l)&&(r.dataChanged=Array.isArray(s)?l.concat(s):s,o=!0);default:r[n]||(r[n]=e[n],o=!0)}o&&Ks(Dhe,this,n,e)}let i=Boolean(r.dataChanged||r.updateTriggersChanged||r.propsChanged||r.extensionsChanged);r.propsOrDataChanged=i,r.somethingChanged=i||r.viewportChanged||r.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,r){let i=M9(e,r);if(i.updateTriggersChanged)for(let n in i.updateTriggersChanged)i.updateTriggersChanged[n]&&this.invalidateAttribute(n);if(i.transitionsChanged)for(let n in i.transitionsChanged)this.internalState.uniformTransitions.add(n,r[n],e[n],e.transitions?.[n]);return this.setChangeFlags(i)}validateProps(){C9(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){let r={highlightedObjectColor:e.picked?e.color:null},{highlightColor:i}=this.props;e.picked&&typeof i=="function"&&(r.highlightColor=i(e)),this.setShaderModuleProps({picking:r}),this.setNeedsRedraw()}_getAttributeManager(){let e=this.context;return new Mf(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,r){let{props:i,oldProps:n}=e;this.setNeedsRedraw(),this._updateAttributes();let o=this.state.model;o?.isInstanced&&o.setInstanceCount(this.getNumInstances());let{autoHighlight:s,highlightedObjectIndex:l,highlightColor:u}=i;if(r||n.autoHighlight!==s||n.highlightedObjectIndex!==l||n.highlightColor!==u){let h={};s||(h.highlightedObjectColor=null),Array.isArray(u)&&(h.highlightColor=u),(r||l!==n.highlightedObjectIndex)&&(h.highlightedObjectColor=Number.isFinite(l)&&l>=0?this.encodePickingColor(l):null),this.setShaderModuleProps({picking:h})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let r=!1;r=r||this.internalState.needsRedraw&&this.id;let i=this.getAttributeManager(),n=i?i.getNeedsRedraw(e):!1;if(r=r||n,r)for(let o of this.props.extensions)o.onNeedsRedraw.call(this,o);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,r}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}},On=OE;(()=>{OE.defaultProps=Vhe})(),(()=>{OE.layerName="Layer"})();var Hhe="compositeLayer.renderLayers",mO=class extends On{get isComposite(){return!0}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(e=>e.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(e){}setState(e){super.setState(e),this.setNeedsUpdate()}getPickingInfo({info:e}){let{object:r}=e;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id&&(e.object=r.__source.object,e.index=r.__source.index),e}filterSubLayer(e){return!0}shouldRenderSubLayer(e,r){return r&&r.length}getSubLayerClass(e,r){let{_subLayerProps:i}=this.props;return i&&i[e]&&i[e].type||r}getSubLayerRow(e,r,i){return e.__source={parent:this,object:r,index:i},e}getSubLayerAccessor(e){if(typeof e=="function"){let r={index:-1,data:this.props.data,target:[]};return(i,n)=>i&&i.__source?(r.index=i.__source.index,e(i.__source.object,r)):e(i,n)}return e}getSubLayerProps(e={}){let{opacity:r,pickable:i,visible:n,parameters:o,getPolygonOffset:s,highlightedObjectIndex:l,autoHighlight:u,highlightColor:h,coordinateSystem:v,coordinateOrigin:T,wrapLongitude:E,positionFormat:M,modelMatrix:O,extensions:F,fetch:z,operation:W,_subLayerProps:J}=this.props,K={id:"",updateTriggers:{},opacity:r,pickable:i,visible:n,parameters:o,getPolygonOffset:s,highlightedObjectIndex:l,autoHighlight:u,highlightColor:h,coordinateSystem:v,coordinateOrigin:T,wrapLongitude:E,positionFormat:M,modelMatrix:O,extensions:F,fetch:z,operation:W},ne=J&&e.id&&J[e.id],ge=ne&&ne.updateTriggers,j=e.id||"sublayer";if(ne){let me=this.props[Hu],fe=e.type?e.type._propTypes:{};for(let $ in ne){let Z=fe[$]||me[$];Z&&Z.type==="accessor"&&(ne[$]=this.getSubLayerAccessor(ne[$]))}}Object.assign(K,e,ne),K.id=`${this.props.id}-${j}`,K.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...ge};for(let me of F){let fe=me.getSubLayerProps.call(this,me);fe&&Object.assign(K,fe,{updateTriggers:Object.assign(K.updateTriggers,fe.updateTriggers)})}return K}_updateAutoHighlight(e){for(let r of this.getSubLayers())r.updateAutoHighlight(e)}_getAttributeManager(){return null}_postUpdate(e,r){let i=this.internalState.subLayers,n=!i||this.needsUpdate();if(n){let o=this.renderLayers();i=Rh(o,Boolean),this.internalState.subLayers=i}Ks(Hhe,this,n,i);for(let o of i)o.parent=this}},es=mO;(()=>{mO.layerName="CompositeLayer"})();var DE=Math.PI/180,L9=180/Math.PI,LE=6370972,g_=256;function jhe(){let t=g_/LE,e=Math.PI/180*g_;return{unitsPerMeter:[t,t,t],unitsPerMeter2:[0,0,0],metersPerUnit:[1/t,1/t,1/t],unitsPerDegree:[e,e,t],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,1/t]}}var Rd=class extends bl{constructor(e={}){let{latitude:r=0,longitude:i=0,zoom:n=0,nearZMultiplier:o=.1,farZMultiplier:s=2,resolution:l=10}=e,{height:u,altitude:h=1.5}=e;u=u||1,h=Math.max(.75,h);let v=new Kr().lookAt({eye:[0,-h,0],up:[0,0,1]}),T=Math.pow(2,n);v.rotateX(r*DE),v.rotateZ(-i*DE),v.scale(T/u);let E=Math.atan(.5/h),M=g_*2*T/u;super({...e,height:u,viewMatrix:v,longitude:i,latitude:r,zoom:n,distanceScales:jhe(),fovyRadians:E*2,focalDistance:h,near:o,far:Math.min(2,1/M+1)*h*s}),this.latitude=r,this.longitude=i,this.resolution=l}get projectionMode(){return Nl.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){let r={targetZ:e.z||0},i=this.unproject([0,this.height/2],r),n=this.unproject([this.width/2,0],r),o=this.unproject([this.width,this.height/2],r),s=this.unproject([this.width/2,this.height],r);return o[0]<this.longitude&&(o[0]+=360),i[0]>this.longitude&&(i[0]-=360),[Math.min(i[0],o[0],n[0],s[0]),Math.min(i[1],o[1],n[1],s[1]),Math.max(i[0],o[0],n[0],s[0]),Math.max(i[1],o[1],n[1],s[1])]}unproject(e,{topLeft:r=!0,targetZ:i}={}){let[n,o,s]=e,l=r?o:this.height-o,{pixelUnprojectionMatrix:u}=this,h;if(Number.isFinite(s))h=gO(u,[n,l,s,1]);else{let M=gO(u,[n,l,-1,1]),O=gO(u,[n,l,1,1]),F=((i||0)/LE+1)*g_,z=Da.sqrLen(Da.sub([],M,O)),W=Da.sqrLen(M),J=Da.sqrLen(O),ne=4*((4*W*J-(z-W-J)**2)/16)/z,ge=Math.sqrt(W-ne),j=Math.sqrt(Math.max(0,F*F-ne)),me=(ge-j)/Math.sqrt(z);h=Da.lerp([],M,O,me)}let[v,T,E]=this.unprojectPosition(h);return Number.isFinite(s)?[v,T,E]:Number.isFinite(i)?[v,T,i]:[v,T]}projectPosition(e){let[r,i,n=0]=e,o=r*DE,s=i*DE,l=Math.cos(s),u=(n/LE+1)*g_;return[Math.sin(o)*l*u,-Math.cos(o)*l*u,Math.sin(s)*u]}unprojectPosition(e){let[r,i,n]=e,o=Da.len(e),s=Math.asin(n/o),u=Math.atan2(r,-i)*L9,h=s*L9,v=(o/g_-1)*LE;return[u,h,v]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition(e,r){let i=this.unproject(r);return{longitude:e[0]-i[0]+this.longitude,latitude:e[1]-i[1]+this.latitude}}};function gO(t,e){let r=tc.transformMat4([],e,t);return tc.scale(r,r,1/r[3]),r}var _O=Math.PI/180;function Ghe({height:t,focalDistance:e,orbitAxis:r,rotationX:i,rotationOrbit:n,zoom:o}){let s=r==="Z"?[0,0,1]:[0,1,0],l=r==="Z"?[0,-e,0]:[0,0,e],u=new Kr().lookAt({eye:l,up:s});u.rotateX(i*_O),r==="Z"?u.rotateZ(n*_O):u.rotateY(n*_O);let h=Math.pow(2,o)/t;return u.scale(h),u}var Im=class extends bl{constructor(e){let{height:r,projectionMatrix:i,fovy:n=50,orbitAxis:o="Z",target:s=[0,0,0],rotationX:l=0,rotationOrbit:u=0,zoom:h=0}=e,v=i?i[5]/2:Am(n);super({...e,longitude:void 0,viewMatrix:Ghe({height:r||1,focalDistance:v,orbitAxis:o,rotationX:l,rotationOrbit:u,zoom:h}),fovy:n,focalDistance:v,position:s,zoom:h}),this.projectedCenter=this.project(this.center)}unproject(e,{topLeft:r=!0}={}){let[i,n,o=this.projectedCenter[2]]=e,s=r?n:this.height-n,[l,u,h]=Uu([i,s,o],this.pixelUnprojectionMatrix);return[l,u,h]}panByPosition(e,r){let i=this.project(e),n=[this.width/2+i[0]-r[0],this.height/2+i[1]-r[1],this.projectedCenter[2]];return{target:this.unproject(n)}}};var Whe=new Kr().lookAt({eye:[0,0,1]});function qhe({width:t,height:e,near:r,far:i,padding:n}){let o=-t/2,s=t/2,l=-e/2,u=e/2;if(n){let{left:h=0,right:v=0,top:T=0,bottom:E=0}=n,M=Zn((h+t-v)/2,0,t)-t/2,O=Zn((T+e-E)/2,0,e)-e/2;o-=M,s-=M,l+=O,u+=O}return new Kr().ortho({left:o,right:s,bottom:l,top:u,near:r,far:i})}var Pm=class extends bl{constructor(e){let{width:r,height:i,near:n=.1,far:o=1e3,zoom:s=0,target:l=[0,0,0],padding:u=null,flipY:h=!0}=e,v=Array.isArray(s)?s[0]:s,T=Array.isArray(s)?s[1]:s,E=Math.min(v,T),M=Math.pow(2,E),O;if(v!==T){let F=Math.pow(2,v),z=Math.pow(2,T);O={unitsPerMeter:[F/M,z/M,1],metersPerUnit:[M/F,M/z,1]}}super({...e,longitude:void 0,position:l,viewMatrix:Whe.clone().scale([M,M*(h?-1:1),M]),projectionMatrix:qhe({width:r||1,height:i||1,padding:u,near:n,far:o}),zoom:E,distanceScales:O})}projectFlat([e,r]){let{unitsPerMeter:i}=this.distanceScales;return[e*i[0],r*i[1]]}unprojectFlat([e,r]){let{metersPerUnit:i}=this.distanceScales;return[e*i[0],r*i[1]]}panByPosition(e,r){let i=Uu(r,this.pixelUnprojectionMatrix),n=this.projectFlat(e),o=xa.add([],n,xa.negate([],i)),s=xa.add([],this.center,o);return{target:this.unprojectFlat(s)}}};var Rm=class extends bl{constructor(e){let{longitude:r,latitude:i,modelMatrix:n,bearing:o=0,pitch:s=0,up:l=[0,0,1]}=e,h=new yf({bearing:o,pitch:s===-90?1e-4:90+s}).toVector3().normalize(),v=n?new Kr(n).transformAsVector(h):h,T=Number.isFinite(i)?zx({latitude:i}):0,E=Math.pow(2,T),M=new Kr().lookAt({eye:[0,0,0],center:v,up:l}).scale(E);super({...e,zoom:T,viewMatrix:M}),this.latitude=i,this.longitude=r}};var Bm=20,F9=500,C1=class extends Cd{constructor(e){let{width:r,height:i,position:n=[0,0,0],bearing:o=0,pitch:s=0,longitude:l=null,latitude:u=null,maxPitch:h=90,minPitch:v=-90,startRotatePos:T,startBearing:E,startPitch:M,startZoomPosition:O,startPanPos:F,startPanPosition:z}=e;super({width:r,height:i,position:n,bearing:o,pitch:s,longitude:l,latitude:u,maxPitch:h,minPitch:v},{startRotatePos:T,startBearing:E,startPitch:M,startZoomPosition:O,startPanPos:F,startPanPosition:z}),this.makeViewport=e.makeViewport}panStart({pos:e}){let{position:r}=this.getViewportProps();return this._getUpdatedState({startPanPos:e,startPanPosition:r})}pan({pos:e}){if(!e)return this;let{startPanPos:r=[0,0],startPanPosition:i=[0,0]}=this.getState(),{width:n,height:o,bearing:s,pitch:l}=this.getViewportProps(),u=F9*(e[0]-r[0])/n,h=F9*(e[1]-r[1])/o,v=new yf({bearing:s,pitch:l}),T=new yf({bearing:s,pitch:-90}),E=v.toVector3().normalize(),M=T.toVector3().cross(E).normalize();return this._getUpdatedState({position:new ot(i).add(M.scale(u)).add(E.scale(h))})}panEnd(){return this._getUpdatedState({startPanPos:null,startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:n,startBearing:o,startPitch:s}=this.getState(),{width:l,height:u}=this.getViewportProps();if(!n||o===void 0||s===void 0)return this;let h;if(e){let v=(e[0]-n[0])/l,T=(e[1]-n[1])/u;h={bearing:o-v*180,pitch:s-T*90}}else h={bearing:o-r,pitch:s-i};return this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startBearing:null,startPitch:null})}zoomStart(){return this._getUpdatedState({startZoomPosition:this.getViewportProps().position})}zoom({pos:e,scale:r}){let i=this.getViewportProps(),n=this.getState().startZoomPosition||i.position,o=this.makeViewport(i),{projectionMatrix:s,width:l}=o,h=2*Math.atan(1/s[0])*(e[0]/l-.5),v=this.getDirection(!0);return this._move(v.rotateZ({radians:-h}),Math.log2(r)*Bm,n)}zoomEnd(){return this._getUpdatedState({startZoomPosition:null})}moveLeft(e=Bm){let r=this.getDirection(!0);return this._move(r.rotateZ({radians:Math.PI/2}),e)}moveRight(e=Bm){let r=this.getDirection(!0);return this._move(r.rotateZ({radians:-Math.PI/2}),e)}moveUp(e=Bm){let r=this.getDirection(!0);return this._move(r,e)}moveDown(e=Bm){let r=this.getDirection(!0);return this._move(r.negate(),e)}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}zoomIn(e=Bm){return this._move(new ot(0,0,1),e)}zoomOut(e=Bm){return this._move(new ot(0,0,-1),e)}shortestPathFrom(e){let r=e.getViewportProps(),i={...this.getViewportProps()},{bearing:n,longitude:o}=i;return Math.abs(n-r.bearing)>180&&(i.bearing=n<0?n+360:n-360),o!==null&&r.longitude!==null&&Math.abs(o-r.longitude)>180&&(i.longitude=o<0?o+360:o-360),i}_move(e,r,i=this.getViewportProps().position){let n=e.scale(r);return this._getUpdatedState({position:new ot(i).add(n)})}getDirection(e=!1){return new yf({bearing:this.getViewportProps().bearing,pitch:e?90:90+this.getViewportProps().pitch}).toVector3().normalize()}_getUpdatedState(e){return new C1({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{pitch:r,maxPitch:i,minPitch:n,longitude:o,bearing:s}=e;return e.pitch=Zn(r,n,i),o!==null&&(o<-180||o>180)&&(e.longitude=gm(o+180,360)-180),(s<-180||s>180)&&(e.bearing=gm(s+180,360)-180),e}},Om=class extends ic{constructor(){super(...arguments),this.ControllerState=C1,this.transition={transitionDuration:300,transitionInterpolator:new wl(["position","pitch","bearing"])}}};var yO=class extends rc{constructor(e={}){super(e)}get ViewportType(){return Rm}get ControllerType(){return Om}},M1=yO;(()=>{yO.displayName="FirstPersonView"})();var I1=class extends Cd{constructor(e){let{width:r,height:i,rotationX:n=0,rotationOrbit:o=0,target:s=[0,0,0],zoom:l=0,minRotationX:u=-90,maxRotationX:h=90,minZoom:v=-1/0,maxZoom:T=1/0,startPanPosition:E,startRotatePos:M,startRotationX:O,startRotationOrbit:F,startZoomPosition:z,startZoom:W}=e;super({width:r,height:i,rotationX:n,rotationOrbit:o,target:s,zoom:l,minRotationX:u,maxRotationX:h,minZoom:v,maxZoom:T},{startPanPosition:E,startRotatePos:M,startRotationX:O,startRotationOrbit:F,startZoomPosition:z,startZoom:W}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanPosition:this._unproject(e)})}pan({pos:e,startPosition:r}){let i=this.getState().startPanPosition||r;if(!i)return this;let o=this.makeViewport(this.getViewportProps()).panByPosition(i,e);return this._getUpdatedState(o)}panEnd(){return this._getUpdatedState({startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startRotationX:this.getViewportProps().rotationX,startRotationOrbit:this.getViewportProps().rotationOrbit})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:n,startRotationX:o,startRotationOrbit:s}=this.getState(),{width:l,height:u}=this.getViewportProps();if(!n||o===void 0||s===void 0)return this;let h;if(e){let v=(e[0]-n[0])/l,T=(e[1]-n[1])/u;(o<-90||o>90)&&(v*=-1),h={rotationX:o+T*180,rotationOrbit:s+v*180}}else h={rotationX:o+i,rotationOrbit:s+r};return this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startRotationX:null,startRotationOrbit:null})}shortestPathFrom(e){let r=e.getViewportProps(),i={...this.getViewportProps()},{rotationOrbit:n}=i;return Math.abs(n-r.rotationOrbit)>180&&(i.rotationOrbit=n<0?n+360:n-360),i}zoomStart({pos:e}){return this._getUpdatedState({startZoomPosition:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:r,scale:i}){let{startZoom:n,startZoomPosition:o}=this.getState();if(o||(n=this.getViewportProps().zoom,o=this._unproject(r)||this._unproject(e)),!o)return this;let s=this._calculateNewZoom({scale:i,startZoom:n}),l=this.makeViewport({...this.getViewportProps(),zoom:s});return this._getUpdatedState({zoom:s,...l.panByPosition(o,e)})}zoomEnd(){return this._getUpdatedState({startZoomPosition:null,startZoom:null})}zoomIn(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:e})})}zoomOut(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:1/e})})}moveLeft(e=50){return this._panFromCenter([-e,0])}moveRight(e=50){return this._panFromCenter([e,0])}moveUp(e=50){return this._panFromCenter([0,-e])}moveDown(e=50){return this._panFromCenter([0,e])}rotateLeft(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit-e})}rotateRight(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit+e})}rotateUp(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX-e})}rotateDown(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX+e})}_unproject(e){let r=this.makeViewport(this.getViewportProps());return e&&r.unproject(e)}_calculateNewZoom({scale:e,startZoom:r}){let{maxZoom:i,minZoom:n}=this.getViewportProps();r===void 0&&(r=this.getViewportProps().zoom);let o=r+Math.log2(e);return Zn(o,n,i)}_panFromCenter(e){let{width:r,height:i,target:n}=this.getViewportProps();return this.pan({startPosition:n,pos:[r/2+e[0],i/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{maxZoom:r,minZoom:i,zoom:n,maxRotationX:o,minRotationX:s,rotationOrbit:l}=e;return e.zoom=Array.isArray(n)?[Zn(n[0],i,r),Zn(n[1],i,r)]:Zn(n,i,r),e.rotationX=Zn(e.rotationX,s,o),(l<-180||l>180)&&(e.rotationOrbit=gm(l+180,360)-180),e}},Dm=class extends ic{constructor(){super(...arguments),this.ControllerState=I1,this.transition={transitionDuration:300,transitionInterpolator:new wl({transitionProps:{compare:["target","zoom","rotationX","rotationOrbit"],required:["target","zoom"]}})}}};var vO=class extends rc{constructor(e={}){super(e),this.props.orbitAxis=e.orbitAxis||"Z"}get ViewportType(){return Im}get ControllerType(){return Dm}},P1=vO;(()=>{vO.displayName="OrbitView"})();var xO=class extends I1{constructor(e){super(e),this.zoomAxis=e.zoomAxis||"all"}_calculateNewZoom({scale:e,startZoom:r}){let{maxZoom:i,minZoom:n}=this.getViewportProps();r===void 0&&(r=this.getViewportProps().zoom);let o=Math.log2(e);if(Array.isArray(r)){let[s,l]=r;switch(this.zoomAxis){case"X":s=Zn(s+o,n,i);break;case"Y":l=Zn(l+o,n,i);break;default:let u=Math.min(s+o,l+o);u<n&&(o+=n-u),u=Math.max(s+o,l+o),u>i&&(o+=i-u),s+=o,l+=o}return[s,l]}return Zn(r+o,n,i)}},Lm=class extends ic{constructor(){super(...arguments),this.ControllerState=xO,this.transition={transitionDuration:300,transitionInterpolator:new wl(["target","zoom"])},this.dragMode="pan"}_onPanRotate(){return!1}};var bO=class extends rc{constructor(e={}){super(e)}get ViewportType(){return Pm}get ControllerType(){return Lm}},R1=bO;(()=>{bO.displayName="OrthographicView"})();var wO=class extends s1{applyConstraints(e){let{maxZoom:r,minZoom:i,zoom:n}=e;e.zoom=Zn(n,i,r);let{longitude:o,latitude:s}=e;return(o<-180||o>180)&&(e.longitude=gm(o+180,360)-180),e.latitude=Zn(s,-89,89),e}},Fm=class extends ic{constructor(){super(...arguments),this.ControllerState=wO,this.transition={transitionDuration:300,transitionInterpolator:new wl(["longitude","latitude","zoom"])},this.dragMode="pan"}setProps(e){super.setProps(e),this.dragRotate=!1,this.touchRotate=!1}};var TO=class extends rc{constructor(e={}){super(e)}get ViewportType(){return Rd}get ControllerType(){return Fm}},B1=TO;(()=>{TO.displayName="GlobeView"})();var FE=class{static get componentName(){return Object.prototype.hasOwnProperty.call(this,"extensionName")?this.extensionName:""}constructor(e){e&&(this.opts=e)}equals(e){return this===e?!0:this.constructor===e.constructor&&Ls(this.opts,e.opts,1)}getShaders(e){return null}getSubLayerProps(e){let{defaultProps:r}=e.constructor,i={updateTriggers:{}};for(let n in r)if(n in this.props){let o=r[n],s=this.props[n];i[n]=s,o&&o.type==="accessor"&&(i.updateTriggers[n]=this.props.updateTriggers[n],typeof s=="function"&&(i[n]=this.getSubLayerAccessor(s)))}return i}initializeState(e,r){}updateState(e,r){}onNeedsRedraw(e){}getNeedsPickingBuffer(e){return!1}draw(e,r){}finalizeState(e,r){}},Nm=FE;(()=>{FE.defaultProps={}})(),(()=>{FE.extensionName="LayerExtension"})();var EO={bearing:0,pitch:0,position:[0,0,0]},Xhe={speed:1.2,curve:1.414},O1=class extends Sd{constructor(e={}){super({compare:["longitude","latitude","zoom","bearing","pitch","position"],extract:["width","height","longitude","latitude","zoom","bearing","pitch","position"],required:["width","height","latitude","longitude","zoom"]}),this.opts={...Xhe,...e}}interpolateProps(e,r,i){let n=YB(e,r,i,this.opts);for(let o in EO)n[o]=Oa(e[o]||EO[o],r[o]||EO[o],i);return n}getDuration(e,r){let{transitionDuration:i}=r;return i==="auto"&&(i=KB(e,r,this.opts)),i}};var Bd=class{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;let{attributes:r={}}=e;this.typedArrayManager=wf,this.attributes={},this._attributeDefs=r,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);let{data:r,buffers:i={},getGeometry:n,geometryBuffer:o,positionFormat:s,dataChanged:l,normalize:u=!0}=this.opts;if(this.data=r,this.getGeometry=n,this.positionSize=o&&o.size||(s==="XY"?2:3),this.buffers=i,this.normalize=u,o&&(os(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(o),u||(i.vertexPositions=o)),this.geometryBuffer=i.vertexPositions,Array.isArray(l))for(let h of l)this._rebuildGeometry(h);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:r}){this._rebuildGeometry({startRow:e,endRow:r})}getGeometryFromBuffer(e){let r=e.value||e;return ArrayBuffer.isView(r)?wE(r,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,r){let{attributes:i,buffers:n,_attributeDefs:o,typedArrayManager:s}=this;for(let l in o)if(l in n)s.release(i[l]),i[l]=null;else{let u=o[l];u.copy=r,i[l]=s.allocate(i[l],e,u)}}_forEachGeometry(e,r,i){let{data:n,getGeometry:o}=this,{iterable:s,objectInfo:l}=Js(n,r,i);for(let u of s){l.index++;let h=o?o(u,l):null;e(h,l.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:r,vertexStarts:i,instanceCount:n}=this,{data:o,geometryBuffer:s}=this,{startRow:l=0,endRow:u=1/0}=e||{},h={};if(e||(r=[0],i=[0]),this.normalize||!s)this._forEachGeometry((T,E)=>{let M=T&&this.normalizeGeometry(T);h[E]=M,i[E+1]=i[E]+(M?this.getGeometrySize(M):0)},l,u),n=i[i.length-1];else if(i=o.startIndices,n=i[o.length]||0,ArrayBuffer.isView(s))n=n||s.length/this.positionSize;else if(s instanceof Xi){let T=this.positionSize*4;n=n||s.byteLength/T}else if(s.buffer){let T=s.stride||this.positionSize*4;n=n||s.buffer.byteLength/T}else if(s.value){let T=s.value,E=s.stride/T.BYTES_PER_ELEMENT||this.positionSize;n=n||T.length/E}this._allocate(n,Boolean(e)),this.indexStarts=r,this.vertexStarts=i,this.instanceCount=n;let v={};this._forEachGeometry((T,E)=>{let M=h[E]||T;v.vertexStart=i[E],v.indexStart=r[E];let O=E<i.length-1?i[E+1]:n;v.geometrySize=O-i[E],v.geometryIndex=E,this.updateGeometryAttributes(M,v)},l,u),this.vertexCount=r[r.length-1]}};var SO=85.05113;function MO(t,e,r,i){if(r){if(r.userData._googleMap===t)return r;NE(r)}let n={click:null,rightclick:null,dblclick:null,mousemove:null,mouseout:null},o=new Id({...i,useDevicePixels:i.interleaved?!0:i.useDevicePixels,style:i.interleaved?null:{pointerEvents:"none"},parent:Yhe(e,i.style),views:new Md({repeat:!0}),initialViewState:{longitude:0,latitude:0,zoom:1},controller:!1});for(let s in n)n[s]=t.addListener(s,l=>Zhe(o,s,l));return o.userData._googleMap=t,o.userData._eventListeners=n,o}function Yhe(t,e){let r=document.createElement("div");return r.style.position="absolute",Object.assign(r.style,e),"getPanes"in t?t.getPanes()?.overlayLayer.appendChild(r):t.getMap()?.getDiv().appendChild(r),r}function NE(t){let{_eventListeners:e}=t.userData;for(let r in e)e[r]&&e[r].remove();t.finalize()}function N9(t,e){let{width:r,height:i}=k9(t),n=e.getProjection(),o=t.getBounds();if(!o)return{width:r,height:i,left:0,top:0};let s=o.getNorthEast(),l=o.getSouthWest(),u=n.fromLatLngToDivPixel(s),h=n.fromLatLngToDivPixel(l),v=CO(n,r/2,i/2),T=new google.maps.LatLng(0,v[0]),E=n.fromLatLngToContainerPixel(T),M=n.fromLatLngToDivPixel(T);if(!u||!h||!M||!E)return{width:r,height:i,left:0,top:0};let O=Math.round(M.x-E.x),F=M.y-E.y,z=CO(n,r/2,0),W=CO(n,r/2,i),J=v[1],K=v[0];if(Math.abs(J)>SO){J=J>0?SO:-SO;let $=new google.maps.LatLng(J,K),Z=n.fromLatLngToContainerPixel($);F+=Z.y-i/2}F=Math.round(F);let ge=180*new _f(z).sub(W).verticalAngle()/Math.PI;ge<0&&(ge+=360);let j=t.getHeading()||0,me=t.getZoom()-1,fe;if(ge===0)fe=i?(h.y-u.y)/i:1;else if(ge===j){let $=new _f([u.x,u.y]).sub([h.x,h.y]).len(),Z=new _f([r,-i]).len();fe=Z?$/Z:1}return me+=Math.log2(fe||1),{width:r,height:i,left:O,top:F,zoom:me,bearing:ge,pitch:t.getTilt(),latitude:J,longitude:K}}function IO(t,e){let{width:r,height:i}=k9(t),{center:n,heading:o,tilt:s,zoom:l}=e.getCameraParams(),u=25,h=i?r/i:1,v=.75,T=3e14,E=new Kr().perspective({fovy:u*Math.PI/180,aspect:h,near:v,far:T}),M=.5*E[5];return{width:r,height:i,viewState:{altitude:M,bearing:o,latitude:n.lat(),longitude:n.lng(),pitch:s,projectionMatrix:E,repeat:!0,zoom:l-1}}}function k9(t){let e=t.getDiv().firstChild;return{width:e.offsetWidth,height:e.offsetHeight}}function CO(t,e,r){let i=new google.maps.Point(e,r),n=t.fromContainerPixelToLatLng(i);return[n.lng(),n.lat()]}function Khe(t,e){if(t.pixel)return t.pixel;let r=e.getViewports()[0].project([t.latLng.lng(),t.latLng.lat()]);return{x:r[0],y:r[1]}}function Zhe(t,e,r){if(!t.isInitialized)return;let i={type:e,offsetCenter:Khe(r,t),srcEvent:r};switch(e){case"click":case"rightclick":i.type="click",i.tapCount=1,t._onPointerDown(i),t._onEvent(i);break;case"dblclick":i.type="click",i.tapCount=2,t._onEvent(i);break;case"mousemove":i.type="pointermove",t._onPointerMove(i);break;case"mouseout":i.type="pointerleave",t._onPointerMove(i);break;default:return}}var Jhe=()=>!1,Qhe={depthMask:!0,depthTest:!0,blend:!0,blendFunc:[770,771,1,771],blendEquation:32774};function U9(){}var $he={interleaved:!0},km=class{constructor(e){this.props={},this._map=null,this._deck=null,this._overlay=null,this.setProps({...$he,...e})}setMap(e){if(e===this._map)return;let{VECTOR:r,UNINITIALIZED:i}=google.maps.RenderingType;this._map&&(!e&&this._map.getRenderingType()===r&&this.props.interleaved&&this._overlay.requestRedraw(),this._overlay?.setMap(null),this._map=null),e&&(this._map=e,e.getRenderingType()!==i?this._createOverlay(e):e.addListener("renderingtype_changed",()=>{this._createOverlay(e)}))}setProps(e){if(Object.assign(this.props,e),this._deck){let r=this._deck.getCanvas();if(e.style&&r?.parentElement){let i=r.parentElement.style;Object.assign(i,e.style),e.style=null}this._deck.setProps(e)}}pickObject(e){return this._deck&&this._deck.pickObject(e)}pickMultipleObjects(e){return this._deck&&this._deck.pickMultipleObjects(e)}pickObjects(e){return this._deck&&this._deck.pickObjects(e)}finalize(){this.setMap(null),this._deck&&(NE(this._deck),this._deck=null)}_createOverlay(e){let{interleaved:r}=this.props,{VECTOR:i,UNINITIALIZED:n}=google.maps.RenderingType,o=e.getRenderingType();if(o===n)return;let l=o===i&&google.maps.WebGLOverlayView?google.maps.WebGLOverlayView:google.maps.OverlayView,u=new l;u instanceof google.maps.WebGLOverlayView?(r?(u.onAdd=U9,u.onContextRestored=this._onContextRestored.bind(this),u.onDraw=this._onDrawVectorInterleaved.bind(this)):(u.onAdd=this._onAdd.bind(this),u.onContextRestored=U9,u.onDraw=this._onDrawVectorOverlay.bind(this)),u.onContextLost=this._onContextLost.bind(this)):(u.onAdd=this._onAdd.bind(this),u.draw=this._onDrawRaster.bind(this)),u.onRemove=this._onRemove.bind(this),this._overlay=u,this._overlay.setMap(e)}_onAdd(){this._deck=MO(this._map,this._overlay,this._deck,this.props)}_onContextRestored({gl:e}){if(!this._map||!this._overlay)return;let r=()=>{this._overlay&&this._overlay.requestRedraw()},i=MO(this._map,this._overlay,this._deck,{gl:e,_customRender:r,...this.props});this._deck=i;let n=i.animationLoop;n._renderFrame=()=>{let o=e.getParameter(34964);i.device.withParametersWebGL({},()=>{n.props.onRender(n.animationProps)}),e.bindBuffer(34962,o)}}_onContextLost(){this._deck&&(NE(this._deck),this._deck=null)}_onRemove(){this._deck?.setProps({layerFilter:Jhe})}_onDrawRaster(){if(!this._deck||!this._map)return;let e=this._deck,{width:r,height:i,left:n,top:o,...s}=N9(this._map,this._overlay),l=e.getCanvas();if(l?.parentElement){let h=l.parentElement.style;h.left=`${n}px`,h.top=`${o}px`}let u=1e4;e.setProps({width:r,height:i,viewState:{altitude:u,...s}}),e.redraw()}_onDrawVectorInterleaved({gl:e,transformer:r}){if(!this._deck||!this._map)return;let i=this._deck;if(i.setProps({...IO(this._map,r),width:null,height:null}),i.isInitialized){let n=i.device,o=n.getParametersWebGL(36006);i.setProps({_framebuffer:o}),n.getCanvasContext().resize(),i.needsRedraw({clearRedrawFlags:!0}),n.setParametersWebGL({viewport:[0,0,e.canvas.width,e.canvas.height],scissor:[0,0,e.canvas.width,e.canvas.height],stencilFunc:[519,0,255,519,0,255]}),n.withParametersWebGL(Qhe,()=>{i._drawLayers("google-vector",{clearCanvas:!1})})}}_onDrawVectorOverlay({transformer:e}){if(!this._deck||!this._map)return;let r=this._deck;r.setProps({...IO(this._map,e)}),r.redraw()}};function z9({container:t,onClick:e,onComplete:r,getTooltip:i,googleMapsKey:n,layers:o,mapStyle:s="satellite",initialViewState:l={latitude:0,longitude:0,zoom:1}}){if(!n)return ur.warn("No Google Maps API key set")(),null;let u=new km({layers:o}),h={center:{lat:l.latitude,lng:l.longitude},mapTypeId:s,zoom:l.zoom},v=new window.google.maps.Map(t,h);return u.setMap(v),u}var V9={position:"absolute",top:"0px",left:"0px",width:344,padding:"12px 24px",margin:24,overflowX:"hidden",overflowY:"overlay",outline:"none",maxHeight:"94%",boxSizing:"border-box",backgroundColor:"rgb(255, 255, 255)",fontFamily:'"Fira Sans", sans-serif',zIndex:1};var PO=class{constructor({container:e,props:r}){let{description:i}=r,n=document.createElement("div");n.className="deck-json-description-box",Object.assign(n.style,V9),this.el=n;let o=document.createElement("div");o.innerHTML=i,n.appendChild(o),e.append(n)}remove(){this.el.remove(),this.description=null}static get stringName(){return"description"}},H9=PO;function RO(t,e){let r=document.createElement("div");r.className="deckgl-ui-elements-overlay",r.style.zIndex=1,t.insertAdjacentElement("beforebegin",r);let i=[];for(let n of Object.keys(e))switch(n){case"description":let o=new H9({container:r,props:e});i.push(o);break;default:break}return i}var Kb={};As(Kb,{AGGREGATION_OPERATION:()=>Wo,AmbientLight:()=>s_,ArcLayer:()=>Um,Attribute:()=>Pd,AttributeManager:()=>Mf,BitmapLayer:()=>zm,COORDINATE_SYSTEM:()=>Zr,CPUGridLayer:()=>Jp,ColumnLayer:()=>If,CompositeLayer:()=>es,ContourLayer:()=>sb,Controller:()=>ic,Deck:()=>Id,DeckRenderer:()=>wm,DirectionalLight:()=>vd,FirstPersonController:()=>Om,FirstPersonView:()=>M1,FirstPersonViewport:()=>Rm,FlyToInterpolator:()=>O1,GPUGridLayer:()=>Qp,GeoJsonLayer:()=>Oh,GeohashLayer:()=>qb,GoogleMapsOverlay:()=>km,GreatCircleLayer:()=>mb,GridCellLayer:()=>qm,GridLayer:()=>lb,H3ClusterLayer:()=>Sb,H3HexagonLayer:()=>sg,HeatmapLayer:()=>ub,HexagonLayer:()=>nb,IconLayer:()=>Od,JSONConfiguration:()=>Xd,JSONConverter:()=>xg,Layer:()=>On,LayerExtension:()=>Nm,LayerManager:()=>vm,LightingEffect:()=>zp,LineLayer:()=>Vm,LinearInterpolator:()=>wl,MVTLayer:()=>Wb,MapController:()=>bm,MapView:()=>Md,OPERATION:()=>sV,OrbitController:()=>Dm,OrbitView:()=>P1,OrbitViewport:()=>Im,OrthographicController:()=>Lm,OrthographicView:()=>R1,OrthographicViewport:()=>Pm,PathLayer:()=>Pf,PointCloudLayer:()=>Hm,PointLight:()=>c_,PolygonLayer:()=>Bf,PostProcessEffect:()=>e1,QuadkeyLayer:()=>yb,S2Layer:()=>_b,ScatterplotLayer:()=>jm,ScenegraphLayer:()=>ug,ScreenGridLayer:()=>ib,SimpleMeshLayer:()=>Nh,SolidPolygonLayer:()=>Rf,TRANSITION_EVENTS:()=>n1,TerrainLayer:()=>jb,Tesselator:()=>Bd,TextLayer:()=>Jm,Tile3DLayer:()=>Ub,TileLayer:()=>Fh,TransitionInterpolator:()=>Sd,Transport:()=>zh,TripsLayer:()=>wb,UNIT:()=>ms,VERSION:()=>xT,View:()=>rc,Viewport:()=>bl,WebMercatorViewport:()=>Tc,_AggregationLayer:()=>$c,_BinSorter:()=>Dd,_CPUAggregator:()=>Fd,_CameraLight:()=>qx,_Component:()=>Cm,_ComponentState:()=>Mm,_GPUGridAggregator:()=>Fa,_GeoCellLayer:()=>eu,_GlobeController:()=>Fm,_GlobeView:()=>B1,_GlobeViewport:()=>Rd,_LayersPass:()=>bf,_MultiIconLayer:()=>Ym,_PickLayersPass:()=>bd,_SunLight:()=>Xx,_TextBackgroundLayer:()=>Zm,_Tile2DHeader:()=>rg,_Tileset2D:()=>ig,_WMSLayer:()=>zS,_compareProps:()=>m_,_convertFunctions:()=>Ay,_count:()=>PE,_deepEqual:()=>Ls,_fillArray:()=>mE,_flatten:()=>Rh,_getURLFromTemplate:()=>Lh,_memoize:()=>Nu,_mergeShaders:()=>Sm,_parseExpressionString:()=>vg,_shallowEqualObjects:()=>WY,assert:()=>os,createIterable:()=>Js,fp64LowPart:()=>Vp,getShaderAssembler:()=>o_,gouraudLighting:()=>Fu,log:()=>ur,phongLighting:()=>kp,picking:()=>go,project:()=>dm,project32:()=>Jn,shadow:()=>n_});var j9=`#version 300 es
#define SHADER_NAME arc-layer-vertex-shader
in vec4 instanceSourceColors;
in vec4 instanceTargetColors;
in vec3 instanceSourcePositions;
in vec3 instanceSourcePositions64Low;
in vec3 instanceTargetPositions;
in vec3 instanceTargetPositions64Low;
in vec3 instancePickingColors;
in float instanceWidths;
in float instanceHeights;
in float instanceTilts;
uniform bool greatCircle;
uniform bool useShortestPath;
uniform float numSegments;
uniform float opacity;
uniform float widthScale;
uniform float widthMinPixels;
uniform float widthMaxPixels;
uniform int widthUnits;
out vec4 vColor;
out vec2 uv;
out float isValid;
float paraboloid(float distance, float sourceZ, float targetZ, float ratio) {
float deltaZ = targetZ - sourceZ;
float dh = distance * instanceHeights;
if (dh == 0.0) {
return sourceZ + deltaZ * ratio;
}
float unitZ = deltaZ / dh;
float p2 = unitZ * unitZ + 1.0;
float dir = step(deltaZ, 0.0);
float z0 = mix(sourceZ, targetZ, dir);
float r = mix(ratio, 1.0 - ratio, dir);
return sqrt(r * (p2 - r)) * dh + z0;
}
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
return dir_screenspace * offset_direction * width / 2.0;
}
float getSegmentRatio(float index) {
return smoothstep(0.0, 1.0, index / (numSegments - 1.0));
}
vec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {
float distance = length(source.xy - target.xy);
float z = paraboloid(distance, source.z, target.z, segmentRatio);
float tiltAngle = radians(instanceTilts);
vec2 tiltDirection = normalize(target.xy - source.xy);
vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);
return vec3(
mix(source.xy, target.xy, segmentRatio) + tilt,
z * cos(tiltAngle)
);
}
float getAngularDist (vec2 source, vec2 target) {
vec2 sourceRadians = radians(source);
vec2 targetRadians = radians(target);
vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);
vec2 shd_sq = sin_half_delta * sin_half_delta;
float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;
return 2.0 * asin(sqrt(a));
}
vec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {
vec2 lngLat;
if(abs(angularDist - PI) < 0.001) {
lngLat = (1.0 - t) * source.xy + t * target.xy;
} else {
float a = sin((1.0 - t) * angularDist);
float b = sin(t * angularDist);
vec3 p = source3D.yxz * a + target3D.yxz * b;
lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));
}
float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);
return vec3(lngLat, z);
}
void main(void) {
geometry.worldPosition = instanceSourcePositions;
geometry.worldPositionAlt = instanceTargetPositions;
float segmentIndex = float(gl_VertexID / 2);
float segmentSide = mod(float(gl_VertexID), 2.) == 0. ? -1. : 1.;
float segmentRatio = getSegmentRatio(segmentIndex);
float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));
float nextSegmentRatio = getSegmentRatio(min(numSegments - 1.0, segmentIndex + 1.0));
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
isValid = 1.0;
uv = vec2(segmentRatio, segmentSide);
geometry.uv = uv;
geometry.pickingColor = instancePickingColors;
vec4 curr;
vec4 next;
vec3 source;
vec3 target;
if ((greatCircle || project.projectionMode == PROJECTION_MODE_GLOBE) && project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));
target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));
float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);
vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);
vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);
vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);
if (abs(currPos.x - prevPos.x) > 180.0) {
indexDir = -1.0;
isValid = 0.0;
} else if (abs(currPos.x - nextPos.x) > 180.0) {
indexDir = 1.0;
isValid = 0.0;
}
nextPos = indexDir < 0.0 ? prevPos : nextPos;
nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
if (isValid == 0.0) {
nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;
float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);
currPos = mix(currPos, nextPos, t);
segmentRatio = mix(segmentRatio, nextSegmentRatio, t);
}
vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);
vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);
curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);
next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));
} else {
vec3 source_world = instanceSourcePositions;
vec3 target_world = instanceTargetPositions;
if (useShortestPath) {
source_world.x = mod(source_world.x + 180., 360.0) - 180.;
target_world.x = mod(target_world.x + 180., 360.0) - 180.;
float deltaLng = target_world.x - source_world.x;
if (deltaLng > 180.) target_world.x -= 360.;
if (deltaLng < -180.) source_world.x -= 360.;
}
source = project_position(source_world, instanceSourcePositions64Low);
target = project_position(target_world, instanceTargetPositions64Low);
float antiMeridianX = 0.0;
if (useShortestPath) {
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
antiMeridianX = -(project.coordinateOrigin.x + 180.) / 360. * TILE_SIZE;
}
float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);
if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {
isValid = 0.0;
indexDir = sign(segmentRatio - thresholdRatio);
segmentRatio = thresholdRatio;
}
}
nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
vec3 currPos = interpolateFlat(source, target, segmentRatio);
vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);
if (useShortestPath) {
if (nextPos.x < antiMeridianX) {
currPos.x += TILE_SIZE;
nextPos.x += TILE_SIZE;
}
}
curr = project_common_position_to_clipspace(vec4(currPos, 1.0));
next = project_common_position_to_clipspace(vec4(nextPos, 1.0));
geometry.position = vec4(currPos, 1.0);
}
float widthPixels = clamp(
project_size_to_pixel(instanceWidths * widthScale, widthUnits),
widthMinPixels, widthMaxPixels
);
vec3 offset = vec3(
getExtrusionOffset((next.xy - curr.xy) * indexDir, segmentSide, widthPixels),
0.0);
DECKGL_FILTER_SIZE(offset, geometry);
DECKGL_FILTER_GL_POSITION(curr, geometry);
gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);
vColor = vec4(color.rgb, color.a * opacity);
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var G9=`#version 300 es
#define SHADER_NAME arc-layer-fragment-shader
precision highp float;
in vec4 vColor;
in vec2 uv;
in float isValid;
out vec4 fragColor;
void main(void) {
if (isValid == 0.0) {
discard;
}
fragColor = vColor;
geometry.uv = uv;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var kE=[0,0,0,255],ede={getSourcePosition:{type:"accessor",value:t=>t.sourcePosition},getTargetPosition:{type:"accessor",value:t=>t.targetPosition},getSourceColor:{type:"accessor",value:kE},getTargetColor:{type:"accessor",value:kE},getWidth:{type:"accessor",value:1},getHeight:{type:"accessor",value:1},getTilt:{type:"accessor",value:0},greatCircle:!1,numSegments:{type:"number",value:50,min:1},widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}},UE=class extends On{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:j9,fs:G9,modules:[Jn,go]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceSourceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getSourceColor",defaultValue:kE},instanceTargetColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getTargetColor",defaultValue:kE},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1},instanceHeights:{size:1,transition:!0,accessor:"getHeight",defaultValue:1},instanceTilts:{size:1,transition:!0,accessor:"getTilt",defaultValue:0}})}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{widthUnits:r,widthScale:i,widthMinPixels:n,widthMaxPixels:o,greatCircle:s,wrapLongitude:l,numSegments:u}=this.props,h=this.state.model;h.setUniforms(e),h.setUniforms({numSegments:u,greatCircle:s,widthUnits:ms[r],widthScale:i,widthMinPixels:n,widthMaxPixels:o,useShortestPath:l}),h.setVertexCount(u*2),h.draw(this.context.renderPass)}_getModel(){return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-strip",isInstanced:!0})}},Um=UE;(()=>{UE.layerName="ArcLayer"})(),(()=>{UE.defaultProps=ede})();var tde=new Uint32Array([0,2,1,0,3,2]),rde=new Float32Array([0,1,0,0,1,0,1,1]);function BO(t,e){if(!e)return ide(t);let r=Math.max(Math.abs(t[0][0]-t[3][0]),Math.abs(t[1][0]-t[2][0])),i=Math.max(Math.abs(t[1][1]-t[0][1]),Math.abs(t[2][1]-t[3][1])),n=Math.ceil(r/e)+1,o=Math.ceil(i/e)+1,s=(n-1)*(o-1)*6,l=new Uint32Array(s),u=new Float32Array(n*o*2),h=new Float64Array(n*o*3),v=0,T=0;for(let E=0;E<n;E++){let M=E/(n-1);for(let O=0;O<o;O++){let F=O/(o-1),z=nde(t,M,F);h[v*3+0]=z[0],h[v*3+1]=z[1],h[v*3+2]=z[2]||0,u[v*2+0]=M,u[v*2+1]=1-F,E>0&&O>0&&(l[T++]=v-o,l[T++]=v-o-1,l[T++]=v-1,l[T++]=v-o,l[T++]=v-1,l[T++]=v),v++}}return{vertexCount:s,positions:h,indices:l,texCoords:u}}function ide(t){let e=new Float64Array(12);for(let r=0;r<t.length;r++)e[r*3+0]=t[r][0],e[r*3+1]=t[r][1],e[r*3+2]=t[r][2]||0;return{vertexCount:6,positions:e,indices:tde,texCoords:rde}}function nde(t,e,r){return Oa(Oa(t[0],t[1],r),Oa(t[3],t[2],r),e)}var W9=`#version 300 es
#define SHADER_NAME bitmap-layer-vertex-shader
in vec2 texCoords;
in vec3 positions;
in vec3 positions64Low;
out vec2 vTexCoord;
out vec2 vTexPos;
uniform float coordinateConversion;
const vec3 pickingColor = vec3(1.0, 0.0, 0.0);
void main(void) {
geometry.worldPosition = positions;
geometry.uv = texCoords;
geometry.pickingColor = pickingColor;
gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
vTexCoord = texCoords;
if (coordinateConversion < -0.5) {
vTexPos = geometry.position.xy + project.commonOrigin.xy;
} else if (coordinateConversion > 0.5) {
vTexPos = geometry.worldPosition.xy;
}
vec4 color = vec4(0.0);
DECKGL_FILTER_COLOR(color, geometry);
}
`;var ode=`
vec3 packUVsIntoRGB(vec2 uv) {
// Extract the top 8 bits. We want values to be truncated down so we can add a fraction
vec2 uv8bit = floor(uv * 256.);
// Calculate the normalized remainders of u and v parts that do not fit into 8 bits
// Scale and clamp to 0-1 range
vec2 uvFraction = fract(uv * 256.);
vec2 uvFraction4bit = floor(uvFraction * 16.);
// Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates
float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;
return vec3(uv8bit, fractions) / 255.;
}
`,q9=`#version 300 es
#define SHADER_NAME bitmap-layer-fragment-shader
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D bitmapTexture;
in vec2 vTexCoord;
in vec2 vTexPos;
out vec4 fragColor;
uniform float desaturate;
uniform vec4 transparentColor;
uniform vec3 tintColor;
uniform float opacity;
uniform float coordinateConversion;
uniform vec4 bounds;
/* projection utils */
const float TILE_SIZE = 512.0;
const float PI = 3.1415926536;
const float WORLD_SCALE = TILE_SIZE / PI / 2.0;
// from degrees to Web Mercator
vec2 lnglat_to_mercator(vec2 lnglat) {
float x = lnglat.x;
float y = clamp(lnglat.y, -89.9, 89.9);
return vec2(
radians(x) + PI,
PI + log(tan(PI * 0.25 + radians(y) * 0.5))
) * WORLD_SCALE;
}
// from Web Mercator to degrees
vec2 mercator_to_lnglat(vec2 xy) {
xy /= WORLD_SCALE;
return degrees(vec2(
xy.x - PI,
atan(exp(xy.y - PI)) * 2.0 - PI * 0.5
));
}
/* End projection utils */
// apply desaturation
vec3 color_desaturate(vec3 color) {
float luminance = (color.r + color.g + color.b) * 0.333333333;
return mix(color, vec3(luminance), desaturate);
}
// apply tint
vec3 color_tint(vec3 color) {
return color * tintColor;
}
// blend with background color
vec4 apply_opacity(vec3 color, float alpha) {
if (transparentColor.a == 0.0) {
return vec4(color, alpha);
}
float blendedAlpha = alpha + transparentColor.a * (1.0 - alpha);
float highLightRatio = alpha / blendedAlpha;
vec3 blendedRGB = mix(transparentColor.rgb, color, highLightRatio);
return vec4(blendedRGB, blendedAlpha);
}
vec2 getUV(vec2 pos) {
return vec2(
(pos.x - bounds[0]) / (bounds[2] - bounds[0]),
(pos.y - bounds[3]) / (bounds[1] - bounds[3])
);
}
${ode}
void main(void) {
vec2 uv = vTexCoord;
if (coordinateConversion < -0.5) {
vec2 lnglat = mercator_to_lnglat(vTexPos);
uv = getUV(lnglat);
} else if (coordinateConversion > 0.5) {
vec2 commonPos = lnglat_to_mercator(vTexPos);
uv = getUV(commonPos);
}
vec4 bitmapColor = texture(bitmapTexture, uv);
fragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);
geometry.uv = uv;
DECKGL_FILTER_COLOR(fragColor, geometry);
if (bool(picking.isActive) && !bool(picking.isAttribute)) {
// Since instance information is not used, we can use picking color for pixel index
fragColor.rgb = packUVsIntoRGB(uv);
}
}
`;var sde={image:{type:"image",value:null,async:!0},bounds:{type:"array",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:Zr.DEFAULT,desaturate:{type:"number",min:0,max:1,value:0},transparentColor:{type:"color",value:[0,0,0,0]},tintColor:{type:"color",value:[255,255,255]},textureParameters:{type:"object",ignore:!0,value:null}},zE=class extends On{getShaders(){return super.getShaders({vs:W9,fs:q9,modules:[Jn,go]})}initializeState(){let e=this.getAttributeManager();e.remove(["instancePickingColors"]);let r=!0;e.add({indices:{size:1,isIndexed:!0,update:i=>i.value=this.state.mesh.indices,noAlloc:r},positions:{size:3,type:"float64",fp64:this.use64bitPositions(),update:i=>i.value=this.state.mesh.positions,noAlloc:r},texCoords:{size:2,update:i=>i.value=this.state.mesh.texCoords,noAlloc:r}})}updateState({props:e,oldProps:r,changeFlags:i}){let n=this.getAttributeManager();if(i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll()),e.bounds!==r.bounds){let o=this.state.mesh,s=this._createMesh();this.state.model.setVertexCount(s.vertexCount);for(let l in s)o&&o[l]!==s[l]&&n.invalidate(l);this.setState({mesh:s,...this._getCoordinateUniforms()})}else e._imageCoordinateSystem!==r._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(e){let{image:r}=this.props,i=e.info;if(!i.color||!r)return i.bitmap=null,i;let{width:n,height:o}=r;i.index=0;let s=ade(i.color);return i.bitmap={size:{width:n,height:o},uv:s,pixel:[Math.floor(s[0]*n),Math.floor(s[1]*o)]},i}disablePickingIndex(){this.setState({disablePicking:!0})}restorePickingColors(){this.setState({disablePicking:!1})}_updateAutoHighlight(e){super._updateAutoHighlight({...e,color:this.encodePickingColor(0)})}_createMesh(){let{bounds:e}=this.props,r=e;return X9(e)&&(r=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]]]),BO(r,this.context.viewport.resolution)}_getModel(){return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-list",isInstanced:!1})}draw(e){let{uniforms:r,moduleParameters:i}=e,{model:n,coordinateConversion:o,bounds:s,disablePicking:l}=this.state,{image:u,desaturate:h,transparentColor:v,tintColor:T}=this.props;i.picking.isActive&&l||u&&n&&(n.setUniforms(r),n.setBindings({bitmapTexture:u}),n.setUniforms({desaturate:h,transparentColor:v.map(E=>E/255),tintColor:T.slice(0,3).map(E=>E/255),coordinateConversion:o,bounds:s}),n.draw(this.context.renderPass))}_getCoordinateUniforms(){let{LNGLAT:e,CARTESIAN:r,DEFAULT:i}=Zr,{_imageCoordinateSystem:n}=this.props;if(n!==i){let{bounds:o}=this.props;if(!X9(o))throw new Error("_imageCoordinateSystem only supports rectangular bounds");let s=this.context.viewport.resolution?e:r;if(n=n===e?e:r,n===e&&s===r)return{coordinateConversion:-1,bounds:o};if(n===r&&s===e){let l=La([o[0],o[1]]),u=La([o[2],o[3]]);return{coordinateConversion:1,bounds:[l[0],l[1],u[0],u[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}},zm=zE;(()=>{zE.layerName="BitmapLayer"})(),(()=>{zE.defaultProps=sde})();function ade(t){let[e,r,i]=t,n=(i&240)/256,o=(i&15)/16;return[(e+o)/256,(r+n)/256]}function X9(t){return Number.isFinite(t[0])}var Y9=`#version 300 es
#define SHADER_NAME icon-layer-vertex-shader
in vec2 positions;
in vec3 instancePositions;
in vec3 instancePositions64Low;
in float instanceSizes;
in float instanceAngles;
in vec4 instanceColors;
in vec3 instancePickingColors;
in vec4 instanceIconFrames;
in float instanceColorModes;
in vec2 instanceOffsets;
in vec2 instancePixelOffset;
uniform float sizeScale;
uniform vec2 iconsTextureDim;
uniform float sizeMinPixels;
uniform float sizeMaxPixels;
uniform bool billboard;
uniform int sizeUnits;
out float vColorMode;
out vec4 vColor;
out vec2 vTextureCoords;
out vec2 uv;
vec2 rotate_by_angle(vec2 vertex, float angle) {
float angle_radian = angle * PI / 180.0;
float cos_angle = cos(angle_radian);
float sin_angle = sin(angle_radian);
mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);
return rotationMatrix * vertex;
}
void main(void) {
geometry.worldPosition = instancePositions;
geometry.uv = positions;
geometry.pickingColor = instancePickingColors;
uv = positions;
vec2 iconSize = instanceIconFrames.zw;
float sizePixels = clamp(
project_size_to_pixel(instanceSizes * sizeScale, sizeUnits),
sizeMinPixels, sizeMaxPixels
);
float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;
vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;
pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;
pixelOffset += instancePixelOffset;
pixelOffset.y *= -1.0;
if (billboard) {
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
vec3 offset = vec3(pixelOffset, 0.0);
DECKGL_FILTER_SIZE(offset, geometry);
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
} else {
vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);
DECKGL_FILTER_SIZE(offset_common, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
}
vTextureCoords = mix(
instanceIconFrames.xy,
instanceIconFrames.xy + iconSize,
(positions.xy + 1.0) / 2.0
) / iconsTextureDim;
vColor = instanceColors;
DECKGL_FILTER_COLOR(vColor, geometry);
vColorMode = instanceColorModes;
}
`;var K9=`#version 300 es
#define SHADER_NAME icon-layer-fragment-shader
precision highp float;
uniform float opacity;
uniform sampler2D iconsTexture;
uniform float alphaCutoff;
in float vColorMode;
in vec4 vColor;
in vec2 vTextureCoords;
in vec2 uv;
out vec4 fragColor;
void main(void) {
geometry.uv = uv;
vec4 texColor = texture(iconsTexture, vTextureCoords);
vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);
float a = texColor.a * opacity * vColor.a;
if (a < alphaCutoff) {
discard;
}
fragColor = vec4(color, a);
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var lde=1024,cde=4,Z9=()=>{},J9={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},ude={x:0,y:0,width:0,height:0};function fde(t){return Math.pow(2,Math.ceil(Math.log2(t)))}function hde(t,e,r,i){let n=Math.min(r/e.width,i/e.height),o=Math.floor(e.width*n),s=Math.floor(e.height*n);return n===1?{data:e,width:o,height:s}:(t.canvas.height=s,t.canvas.width=o,t.clearRect(0,0,o,s),t.drawImage(e,0,0,e.width,e.height,0,0,o,s),{data:t.canvas,width:o,height:s})}function D1(t){return t&&(t.id||t.url)}function dde(t,e,r,i){let{width:n,height:o,device:s}=t,l=s.createTexture({format:"rgba8unorm",width:e,height:r,sampler:i}),u=s.createCommandEncoder();return u.copyTextureToTexture({source:t,destination:l,width:n,height:o}),u.finish(),t.destroy(),l}function Q9(t,e,r){for(let i=0;i<e.length;i++){let{icon:n,xOffset:o}=e[i],s=D1(n);t[s]={...n,x:o,y:r}}}function pde({icons:t,buffer:e,mapping:r={},xOffset:i=0,yOffset:n=0,rowHeight:o=0,canvasWidth:s}){let l=[];for(let u=0;u<t.length;u++){let h=t[u],v=D1(h);if(!r[v]){let{height:T,width:E}=h;i+E+e>s&&(Q9(r,l,n),i=0,n=o+n+e,o=0,l=[]),l.push({icon:h,xOffset:i}),i=i+E+e,o=Math.max(o,T)}}return l.length>0&&Q9(r,l,n),{mapping:r,rowHeight:o,xOffset:i,yOffset:n,canvasWidth:s,canvasHeight:fde(o+n+e)}}function Ade(t,e,r){if(!t||!e)return null;r=r||{};let i={},{iterable:n,objectInfo:o}=Js(t);for(let s of n){o.index++;let l=e(s,o),u=D1(l);if(!l)throw new Error("Icon is missing.");if(!l.url)throw new Error("Icon url is missing.");!i[u]&&(!r[u]||l.url!==r[u].url)&&(i[u]={...l,source:s,sourceIndex:o.index})}return i}var L1=class{constructor(e,{onUpdate:r=Z9,onError:i=Z9}){this._loadOptions=null,this._texture=null,this._externalTexture=null,this._mapping={},this._samplerParameters=null,this._pendingCount=0,this._autoPacking=!1,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=cde,this._canvasWidth=lde,this._canvasHeight=0,this._canvas=null,this.device=e,this.onUpdate=r,this.onError=i}finalize(){this._texture?.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(e){let r=this._autoPacking?D1(e):e;return this._mapping[r]||ude}setProps({loadOptions:e,autoPacking:r,iconAtlas:i,iconMapping:n,textureParameters:o}){e&&(this._loadOptions=e),r!==void 0&&(this._autoPacking=r),n&&(this._mapping=n),i&&(this._texture?.delete(),this._texture=null,this._externalTexture=i),o&&(this._samplerParameters=o)}get isLoaded(){return this._pendingCount===0}packIcons(e,r){if(!this._autoPacking||typeof document>"u")return;let i=Object.values(Ade(e,r,this._mapping)||{});if(i.length>0){let{mapping:n,xOffset:o,yOffset:s,rowHeight:l,canvasHeight:u}=pde({icons:i,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=l,this._mapping=n,this._xOffset=o,this._yOffset=s,this._canvasHeight=u,this._texture||(this._texture=this.device.createTexture({format:"rgba8unorm",width:this._canvasWidth,height:this._canvasHeight,sampler:this._samplerParameters||J9})),this._texture.height!==this._canvasHeight&&(this._texture=dde(this._texture,this._canvasWidth,this._canvasHeight,this._samplerParameters||J9)),this.onUpdate(),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(i)}}_loadIcons(e){let r=this._canvas.getContext("2d",{willReadFrequently:!0});for(let i of e)this._pendingCount++,_a(i.url,this._loadOptions).then(n=>{let o=D1(i),s=this._mapping[o],{x:l,y:u,width:h,height:v}=s,{data:T,width:E,height:M}=hde(r,n,h,v);this._texture.setSubImageData({data:T,x:l+(h-E)/2,y:u+(v-M)/2,width:E,height:M}),s.width=E,s.height=M,this._texture.generateMipmap(),this.onUpdate()}).catch(n=>{this.onError({url:i.url,source:i.source,sourceIndex:i.sourceIndex,loadOptions:this._loadOptions,error:n})}).finally(()=>{this._pendingCount--})}};var $9=[0,0,0,255],mde={iconAtlas:{type:"image",value:null,async:!0},iconMapping:{type:"object",value:{},async:!0},sizeScale:{type:"number",value:1,min:0},billboard:!0,sizeUnits:"pixels",sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:"number",value:.05,min:0,max:1},getPosition:{type:"accessor",value:t=>t.position},getIcon:{type:"accessor",value:t=>t.icon},getColor:{type:"accessor",value:$9},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},onIconError:{type:"function",value:null,optional:!0},textureParameters:{type:"object",ignore:!0,value:null}},VE=class extends On{getShaders(){return super.getShaders({vs:Y9,fs:K9,modules:[Jn,go]})}initializeState(){this.state={iconManager:new L1(this.context.device,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceOffsets:{size:2,accessor:"getIcon",transform:this.getInstanceOffset},instanceIconFrames:{size:4,accessor:"getIcon",transform:this.getInstanceIconFrame},instanceColorModes:{size:1,type:"uint8",accessor:"getIcon",transform:this.getInstanceColorMode},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:$9},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instancePixelOffset:{size:2,transition:!0,accessor:"getPixelOffset"}})}updateState(e){super.updateState(e);let{props:r,oldProps:i,changeFlags:n}=e,o=this.getAttributeManager(),{iconAtlas:s,iconMapping:l,data:u,getIcon:h,textureParameters:v}=r,{iconManager:T}=this.state;if(typeof s=="string")return;let E=s||this.internalState.isAsyncPropLoading("iconAtlas");T.setProps({loadOptions:r.loadOptions,autoPacking:!E,iconAtlas:s,iconMapping:E?l:null,textureParameters:v}),E?i.iconMapping!==r.iconMapping&&o.invalidate("getIcon"):(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getIcon))&&T.packIcons(u,h),n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),o.invalidateAll())}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(e){super.finalizeState(e),this.state.iconManager.finalize()}draw({uniforms:e}){let{sizeScale:r,sizeMinPixels:i,sizeMaxPixels:n,sizeUnits:o,billboard:s,alphaCutoff:l}=this.props,{iconManager:u}=this.state,h=u.getTexture();if(h){let v=this.state.model;v.setBindings({iconsTexture:h}),v.setUniforms(e),v.setUniforms({iconsTextureDim:[h.width,h.height],sizeUnits:ms[o],sizeScale:r,sizeMinPixels:i,sizeMaxPixels:n,billboard:s,alphaCutoff:l}),v.draw(this.context.renderPass)}}_getModel(){let e=[-1,-1,1,-1,-1,1,1,1];return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}_onUpdate(){this.setNeedsRedraw()}_onError(e){let r=this.getCurrentLayer()?.props.onIconError;r?r(e):ur.error(e.error.message)()}getInstanceOffset(e){let{width:r,height:i,anchorX:n=r/2,anchorY:o=i/2}=this.state.iconManager.getIconMapping(e);return[r/2-n,i/2-o]}getInstanceColorMode(e){return this.state.iconManager.getIconMapping(e).mask?1:0}getInstanceIconFrame(e){let{x:r,y:i,width:n,height:o}=this.state.iconManager.getIconMapping(e);return[r,i,n,o]}},Od=VE;(()=>{VE.defaultProps=mde})(),(()=>{VE.layerName="IconLayer"})();var eH=`#version 300 es
#define SHADER_NAME line-layer-vertex-shader
in vec3 positions;
in vec3 instanceSourcePositions;
in vec3 instanceTargetPositions;
in vec3 instanceSourcePositions64Low;
in vec3 instanceTargetPositions64Low;
in vec4 instanceColors;
in vec3 instancePickingColors;
in float instanceWidths;
uniform float opacity;
uniform float widthScale;
uniform float widthMinPixels;
uniform float widthMaxPixels;
uniform float useShortestPath;
uniform int widthUnits;
out vec4 vColor;
out vec2 uv;
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
return dir_screenspace * offset_direction * width / 2.0;
}
vec3 splitLine(vec3 a, vec3 b, float x) {
float t = (x - a.x) / (b.x - a.x);
return vec3(x, mix(a.yz, b.yz, t));
}
void main(void) {
geometry.worldPosition = instanceSourcePositions;
geometry.worldPositionAlt = instanceTargetPositions;
vec3 source_world = instanceSourcePositions;
vec3 target_world = instanceTargetPositions;
vec3 source_world_64low = instanceSourcePositions64Low;
vec3 target_world_64low = instanceTargetPositions64Low;
if (useShortestPath > 0.5 || useShortestPath < -0.5) {
source_world.x = mod(source_world.x + 180., 360.0) - 180.;
target_world.x = mod(target_world.x + 180., 360.0) - 180.;
float deltaLng = target_world.x - source_world.x;
if (deltaLng * useShortestPath > 180.) {
source_world.x += 360. * useShortestPath;
source_world = splitLine(source_world, target_world, 180. * useShortestPath);
source_world_64low = vec3(0.0);
} else if (deltaLng * useShortestPath < -180.) {
target_world.x += 360. * useShortestPath;
target_world = splitLine(source_world, target_world, 180. * useShortestPath);
target_world_64low = vec3(0.0);
} else if (useShortestPath < 0.) {
gl_Position = vec4(0.);
return;
}
}
vec4 source_commonspace;
vec4 target_commonspace;
vec4 source = project_position_to_clipspace(source_world, source_world_64low, vec3(0.), source_commonspace);
vec4 target = project_position_to_clipspace(target_world, target_world_64low, vec3(0.), target_commonspace);
float segmentIndex = positions.x;
vec4 p = mix(source, target, segmentIndex);
geometry.position = mix(source_commonspace, target_commonspace, segmentIndex);
uv = positions.xy;
geometry.uv = uv;
geometry.pickingColor = instancePickingColors;
float widthPixels = clamp(
project_size_to_pixel(instanceWidths * widthScale, widthUnits),
widthMinPixels, widthMaxPixels
);
vec3 offset = vec3(
getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels),
0.0);
DECKGL_FILTER_SIZE(offset, geometry);
DECKGL_FILTER_GL_POSITION(p, geometry);
gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var tH=`#version 300 es
#define SHADER_NAME line-layer-fragment-shader
precision highp float;
in vec4 vColor;
in vec2 uv;
out vec4 fragColor;
void main(void) {
geometry.uv = uv;
fragColor = vColor;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var gde=[0,0,0,255],_de={getSourcePosition:{type:"accessor",value:t=>t.sourcePosition},getTargetPosition:{type:"accessor",value:t=>t.targetPosition},getColor:{type:"accessor",value:gde},getWidth:{type:"accessor",value:1},widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}},HE=class extends On{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:eH,fs:tH,modules:[Jn,go]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:[0,0,0,255]},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1}})}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{widthUnits:r,widthScale:i,widthMinPixels:n,widthMaxPixels:o,wrapLongitude:s}=this.props,l=this.state.model;l.setUniforms(e),l.setUniforms({widthUnits:ms[r],widthScale:i,widthMinPixels:n,widthMaxPixels:o,useShortestPath:s?1:0}),l.draw(this.context.renderPass),s&&(l.setUniforms({useShortestPath:-1}),l.draw(this.context.renderPass))}_getModel(){let e=[0,-1,0,0,1,0,1,-1,0,1,1,0];return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}},Vm=HE;(()=>{HE.layerName="LineLayer"})(),(()=>{HE.defaultProps=_de})();var rH=`#version 300 es
#define SHADER_NAME point-cloud-layer-vertex-shader
in vec3 positions;
in vec3 instanceNormals;
in vec4 instanceColors;
in vec3 instancePositions;
in vec3 instancePositions64Low;
in vec3 instancePickingColors;
uniform float opacity;
uniform float radiusPixels;
uniform int sizeUnits;
out vec4 vColor;
out vec2 unitPosition;
void main(void) {
geometry.worldPosition = instancePositions;
geometry.normal = project_normal(instanceNormals);
unitPosition = positions.xy;
geometry.uv = unitPosition;
geometry.pickingColor = instancePickingColors;
vec3 offset = vec3(positions.xy * project_size_to_pixel(radiusPixels, sizeUnits), 0.0);
DECKGL_FILTER_SIZE(offset, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
vColor = vec4(lightColor, instanceColors.a * opacity);
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var iH=`#version 300 es
#define SHADER_NAME point-cloud-layer-fragment-shader
precision highp float;
in vec4 vColor;
in vec2 unitPosition;
out vec4 fragColor;
void main(void) {
geometry.uv = unitPosition;
float distToCenter = length(unitPosition);
if (distToCenter > 1.0) {
discard;
}
fragColor = vColor;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var nH=[0,0,0,255],oH=[0,0,1],yde={sizeUnits:"pixels",pointSize:{type:"number",min:0,value:10},getPosition:{type:"accessor",value:t=>t.position},getNormal:{type:"accessor",value:oH},getColor:{type:"accessor",value:nH},material:!0,radiusPixels:{deprecatedFor:"pointSize"}};function vde(t){let{header:e,attributes:r}=t;if(!(!e||!r)&&(t.length=e.vertexCount,r.POSITION&&(r.instancePositions=r.POSITION),r.NORMAL&&(r.instanceNormals=r.NORMAL),r.COLOR_0)){let{size:i,value:n}=r.COLOR_0;r.instanceColors={size:i,type:"unorm8",value:n}}}var jE=class extends On{getShaders(){return super.getShaders({vs:rH,fs:iH,modules:[Jn,Fu,go]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceNormals:{size:3,transition:!0,accessor:"getNormal",defaultValue:oH},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:nH}})}updateState(e){let{changeFlags:r,props:i}=e;super.updateState(e),r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll()),r.dataChanged&&vde(i.data)}draw({uniforms:e}){let{pointSize:r,sizeUnits:i}=this.props,n=this.state.model;n.setUniforms(e),n.setUniforms({sizeUnits:ms[i],radiusPixels:r}),n.draw(this.context.renderPass)}_getModel(){let e=[];for(let r=0;r<3;r++){let i=r/3*Math.PI*2;e.push(Math.cos(i)*2,Math.sin(i)*2,0)}return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-list",attributes:{positions:new Float32Array(e)}}),isInstanced:!0})}},Hm=jE;(()=>{jE.layerName="PointCloudLayer"})(),(()=>{jE.defaultProps=yde})();var sH=`#version 300 es
#define SHADER_NAME scatterplot-layer-vertex-shader
in vec3 positions;
in vec3 instancePositions;
in vec3 instancePositions64Low;
in float instanceRadius;
in float instanceLineWidths;
in vec4 instanceFillColors;
in vec4 instanceLineColors;
in vec3 instancePickingColors;
uniform float opacity;
uniform float radiusScale;
uniform float radiusMinPixels;
uniform float radiusMaxPixels;
uniform float lineWidthScale;
uniform float lineWidthMinPixels;
uniform float lineWidthMaxPixels;
uniform float stroked;
uniform bool filled;
uniform bool antialiasing;
uniform bool billboard;
uniform int radiusUnits;
uniform int lineWidthUnits;
out vec4 vFillColor;
out vec4 vLineColor;
out vec2 unitPosition;
out float innerUnitRadius;
out float outerRadiusPixels;
void main(void) {
geometry.worldPosition = instancePositions;
outerRadiusPixels = clamp(
project_size_to_pixel(radiusScale * instanceRadius, radiusUnits),
radiusMinPixels, radiusMaxPixels
);
float lineWidthPixels = clamp(
project_size_to_pixel(lineWidthScale * instanceLineWidths, lineWidthUnits),
lineWidthMinPixels, lineWidthMaxPixels
);
outerRadiusPixels += stroked * lineWidthPixels / 2.0;
float edgePadding = antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;
unitPosition = edgePadding * positions.xy;
geometry.uv = unitPosition;
geometry.pickingColor = instancePickingColors;
innerUnitRadius = 1.0 - stroked * lineWidthPixels / outerRadiusPixels;
if (billboard) {
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
vec3 offset = edgePadding * positions * outerRadiusPixels;
DECKGL_FILTER_SIZE(offset, geometry);
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
} else {
vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);
DECKGL_FILTER_SIZE(offset, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
}
vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);
DECKGL_FILTER_COLOR(vFillColor, geometry);
vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);
DECKGL_FILTER_COLOR(vLineColor, geometry);
}
`;var aH=`#version 300 es
#define SHADER_NAME scatterplot-layer-fragment-shader
precision highp float;
uniform bool filled;
uniform float stroked;
uniform bool antialiasing;
in vec4 vFillColor;
in vec4 vLineColor;
in vec2 unitPosition;
in float innerUnitRadius;
in float outerRadiusPixels;
out vec4 fragColor;
void main(void) {
geometry.uv = unitPosition;
float distToCenter = length(unitPosition) * outerRadiusPixels;
float inCircle = antialiasing ?
smoothedge(distToCenter, outerRadiusPixels) :
step(distToCenter, outerRadiusPixels);
if (inCircle == 0.0) {
discard;
}
if (stroked > 0.5) {
float isLine = antialiasing ?
smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :
step(innerUnitRadius * outerRadiusPixels, distToCenter);
if (filled) {
fragColor = mix(vFillColor, vLineColor, isLine);
} else {
if (isLine == 0.0) {
discard;
}
fragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);
}
} else if (!filled) {
discard;
} else {
fragColor = vFillColor;
}
fragColor.a *= inCircle;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var lH=[0,0,0,255],xde={radiusUnits:"meters",radiusScale:{type:"number",min:0,value:1},radiusMinPixels:{type:"number",min:0,value:0},radiusMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:"meters",lineWidthScale:{type:"number",min:0,value:1},lineWidthMinPixels:{type:"number",min:0,value:0},lineWidthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:"accessor",value:t=>t.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:lH},getLineColor:{type:"accessor",value:lH},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}},GE=class extends On{getShaders(){return super.getShaders({vs:sH,fs:aH,modules:[Jn,go]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{radiusUnits:r,radiusScale:i,radiusMinPixels:n,radiusMaxPixels:o,stroked:s,filled:l,billboard:u,antialiasing:h,lineWidthUnits:v,lineWidthScale:T,lineWidthMinPixels:E,lineWidthMaxPixels:M}=this.props,O=this.state.model;O.setUniforms(e),O.setUniforms({stroked:s?1:0,filled:l,billboard:u,antialiasing:h,radiusUnits:ms[r],radiusScale:i,radiusMinPixels:n,radiusMaxPixels:o,lineWidthUnits:ms[v],lineWidthScale:T,lineWidthMinPixels:E,lineWidthMaxPixels:M}),O.draw(this.context.renderPass)}_getModel(){let e=[-1,-1,0,1,-1,0,-1,1,0,1,1,0];return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}},jm=GE;(()=>{GE.defaultProps=xde})(),(()=>{GE.layerName="ScatterplotLayer"})();var __={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function Gm(t,e,r={}){return cH(t,r)!==e?(bde(t,r),!0):!1}function cH(t,e={}){return Math.sign(qp(t,e))}var F1={x:0,y:1,z:2};function qp(t,e={}){let{start:r=0,end:i=t.length,plane:n="xy"}=e,o=e.size||2,s=0,l=F1[n[0]],u=F1[n[1]];for(let h=r,v=i-o;h<i;h+=o)s+=(t[h+l]-t[v+l])*(t[h+u]+t[v+u]),v=h;return s/2}function bde(t,e){let{start:r=0,end:i=t.length,size:n=2}=e,o=(i-r)/n,s=Math.floor(o/2);for(let l=0;l<s;++l){let u=r+l*n,h=r+(o-1-l)*n;for(let v=0;v<n;++v){let T=t[u+v];t[u+v]=t[h+v],t[h+v]=T}}}function DO(t,e,r=2,i,n="xy"){let o=e&&e.length,s=o?e[0]*r:t.length,l=fH(t,0,s,r,!0,i&&i[0],n),u=[];if(!l||l.next===l.prev)return u;let h,v,T,E,M,O,F;if(o&&(l=Mde(t,e,l,r,i,n)),t.length>80*r){E=v=t[0],M=T=t[1];for(let z=r;z<s;z+=r)O=t[z],F=t[z+1],O<E&&(E=O),F<M&&(M=F),O>v&&(v=O),F>T&&(T=F);h=Math.max(v-E,T-M),h=h!==0?32767/h:0}return N1(l,u,r,E,M,h,0),u}function fH(t,e,r,i,n,o,s){let l,u;o===void 0&&(o=qp(t,{start:e,end:r,size:i,plane:s}));let h=F1[s[0]],v=F1[s[1]];if(n===o<0)for(l=e;l<r;l+=i)u=uH(l,t[l+h],t[l+v],u);else for(l=r-i;l>=e;l-=i)u=uH(l,t[l+h],t[l+v],u);return u&&XE(u,u.next)&&(U1(u),u=u.next),u}function Wm(t,e){if(!t)return t;e||(e=t);let r=t,i;do if(i=!1,!r.steiner&&(XE(r,r.next)||Fs(r.prev,r,r.next)===0)){if(U1(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function N1(t,e,r,i,n,o,s){if(!t)return;!s&&o&&Ode(t,i,n,o);let l=t,u,h;for(;t.prev!==t.next;){if(u=t.prev,h=t.next,o?Ede(t,i,n,o):Tde(t)){e.push(u.i/r|0),e.push(t.i/r|0),e.push(h.i/r|0),U1(t),t=h.next,l=h.next;continue}if(t=h,t===l){s?s===1?(t=Sde(Wm(t),e,r),N1(t,e,r,i,n,o,2)):s===2&&Cde(t,e,r,i,n,o):N1(Wm(t),e,r,i,n,o,1);break}}}function Tde(t){let e=t.prev,r=t,i=t.next;if(Fs(e,r,i)>=0)return!1;let n=e.x,o=r.x,s=i.x,l=e.y,u=r.y,h=i.y,v=n<o?n<s?n:s:o<s?o:s,T=l<u?l<h?l:h:u<h?u:h,E=n>o?n>s?n:s:o>s?o:s,M=l>u?l>h?l:h:u>h?u:h,O=i.next;for(;O!==e;){if(O.x>=v&&O.x<=E&&O.y>=T&&O.y<=M&&y_(n,l,o,u,s,h,O.x,O.y)&&Fs(O.prev,O,O.next)>=0)return!1;O=O.next}return!0}function Ede(t,e,r,i){let n=t.prev,o=t,s=t.next;if(Fs(n,o,s)>=0)return!1;let l=n.x,u=o.x,h=s.x,v=n.y,T=o.y,E=s.y,M=l<u?l<h?l:h:u<h?u:h,O=v<T?v<E?v:E:T<E?T:E,F=l>u?l>h?l:h:u>h?u:h,z=v>T?v>E?v:E:T>E?T:E,W=OO(M,O,e,r,i),J=OO(F,z,e,r,i),K=t.prevZ,ne=t.nextZ;for(;K&&K.z>=W&&ne&&ne.z<=J;){if(K.x>=M&&K.x<=F&&K.y>=O&&K.y<=z&&K!==n&&K!==s&&y_(l,v,u,T,h,E,K.x,K.y)&&Fs(K.prev,K,K.next)>=0||(K=K.prevZ,ne.x>=M&&ne.x<=F&&ne.y>=O&&ne.y<=z&&ne!==n&&ne!==s&&y_(l,v,u,T,h,E,ne.x,ne.y)&&Fs(ne.prev,ne,ne.next)>=0))return!1;ne=ne.nextZ}for(;K&&K.z>=W;){if(K.x>=M&&K.x<=F&&K.y>=O&&K.y<=z&&K!==n&&K!==s&&y_(l,v,u,T,h,E,K.x,K.y)&&Fs(K.prev,K,K.next)>=0)return!1;K=K.prevZ}for(;ne&&ne.z<=J;){if(ne.x>=M&&ne.x<=F&&ne.y>=O&&ne.y<=z&&ne!==n&&ne!==s&&y_(l,v,u,T,h,E,ne.x,ne.y)&&Fs(ne.prev,ne,ne.next)>=0)return!1;ne=ne.nextZ}return!0}function Sde(t,e,r){let i=t;do{let n=i.prev,o=i.next.next;!XE(n,o)&&hH(n,i,i.next,o)&&k1(n,o)&&k1(o,n)&&(e.push(n.i/r|0),e.push(i.i/r|0),e.push(o.i/r|0),U1(i),U1(i.next),i=t=o),i=i.next}while(i!==t);return Wm(i)}function Cde(t,e,r,i,n,o){let s=t;do{let l=s.next.next;for(;l!==s.prev;){if(s.i!==l.i&&Fde(s,l)){let u=dH(s,l);s=Wm(s,s.next),u=Wm(u,u.next),N1(s,e,r,i,n,o,0),N1(u,e,r,i,n,o,0);return}l=l.next}s=s.next}while(s!==t)}function Mde(t,e,r,i,n,o){let s=[],l,u,h,v,T;for(l=0,u=e.length;l<u;l++)h=e[l]*i,v=l<u-1?e[l+1]*i:t.length,T=fH(t,h,v,i,!1,n&&n[l+1],o),T===T.next&&(T.steiner=!0),s.push(Lde(T));for(s.sort(Ide),l=0;l<s.length;l++)r=Pde(s[l],r);return r}function Ide(t,e){return t.x-e.x}function Pde(t,e){let r=Rde(t,e);if(!r)return e;let i=dH(r,t);return Wm(i,i.next),Wm(r,r.next)}function Rde(t,e){let r=e,i=t.x,n=t.y,o=-1/0,s;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let E=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(E<=i&&E>o&&(o=E,s=r.x<r.next.x?r:r.next,E===i))return s}r=r.next}while(r!==e);if(!s)return null;let l=s,u=s.x,h=s.y,v=1/0,T;r=s;do i>=r.x&&r.x>=u&&i!==r.x&&y_(n<h?i:o,n,u,h,n<h?o:i,n,r.x,r.y)&&(T=Math.abs(n-r.y)/(i-r.x),k1(r,t)&&(T<v||T===v&&(r.x>s.x||r.x===s.x&&Bde(s,r)))&&(s=r,v=T)),r=r.next;while(r!==l);return s}function Bde(t,e){return Fs(t.prev,t,e.prev)<0&&Fs(e.next,t,t.next)<0}function Ode(t,e,r,i){let n=t;do n.z===0&&(n.z=OO(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,Dde(n)}function Dde(t){let e,r,i=1,n,o,s,l,u,h;do{for(o=t,t=null,h=null,n=0;o;){for(n++,l=o,s=0,r=0;r<i&&(s++,l=l.nextZ,!!l);r++);for(u=i;s>0||u>0&&l;)s!==0&&(u===0||!l||o.z<=l.z)?(e=o,o=o.nextZ,s--):(e=l,l=l.nextZ,u--),h?h.nextZ=e:t=e,e.prevZ=h,h=e;o=l}h.nextZ=null,i*=2}while(n>1);return t}function OO(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Lde(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function y_(t,e,r,i,n,o,s,l){return(n-s)*(e-l)>=(t-s)*(o-l)&&(t-s)*(i-l)>=(r-s)*(e-l)&&(r-s)*(o-l)>=(n-s)*(i-l)}function Fde(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Nde(t,e)&&(k1(t,e)&&k1(e,t)&&kde(t,e)&&(Fs(t.prev,t,e.prev)||Fs(t,e.prev,e))||XE(t,e)&&Fs(t.prev,t,t.next)>0&&Fs(e.prev,e,e.next)>0)}function Fs(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function XE(t,e){return t.x===e.x&&t.y===e.y}function hH(t,e,r,i){let n=qE(Fs(t,e,r)),o=qE(Fs(t,e,i)),s=qE(Fs(r,i,t)),l=qE(Fs(r,i,e));return!!(n!==o&&s!==l||n===0&&WE(t,r,e)||o===0&&WE(t,i,e)||s===0&&WE(r,t,i)||l===0&&WE(r,e,i))}function WE(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function qE(t){return t>0?1:t<0?-1:0}function Nde(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&hH(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function k1(t,e){return Fs(t.prev,t,t.next)<0?Fs(t,e,t.next)>=0&&Fs(t,t.prev,e)>=0:Fs(t,e,t.prev)<0||Fs(t,t.next,e)<0}function kde(t,e){let r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}function dH(t,e){let r=new z1(t.i,t.x,t.y),i=new z1(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function uH(t,e,r,i){let n=new z1(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function U1(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)}var z1=class{constructor(e,r,i){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=e,this.x=r,this.y=i}};function Ec(t,e){let r=e.length,i=t.length;if(i>0){let n=!0;for(let o=0;o<r;o++)if(t[i-r+o]!==e[o]){n=!1;break}if(n)return!1}for(let n=0;n<r;n++)t[i+n]=e[n];return!0}function V1(t,e){let r=e.length;for(let i=0;i<r;i++)t[i]=e[i]}function Xp(t,e,r,i,n=[]){let o=i+e*r;for(let s=0;s<r;s++)n[s]=t[o+s];return n}function YE(t,e,r,i,n=[]){let o,s;if(r&8)o=(i[3]-t[1])/(e[1]-t[1]),s=3;else if(r&4)o=(i[1]-t[1])/(e[1]-t[1]),s=1;else if(r&2)o=(i[2]-t[0])/(e[0]-t[0]),s=2;else if(r&1)o=(i[0]-t[0])/(e[0]-t[0]),s=0;else return null;for(let l=0;l<t.length;l++)n[l]=(s&1)===l?i[s]:o*(e[l]-t[l])+t[l];return n}function H1(t,e){let r=0;return t[0]<e[0]?r|=1:t[0]>e[2]&&(r|=2),t[1]<e[1]?r|=4:t[1]>e[3]&&(r|=8),r}function j1(t,e){let{size:r=2,broken:i=!1,gridResolution:n=10,gridOffset:o=[0,0],startIndex:s=0,endIndex:l=t.length}=e||{},u=(l-s)/r,h=[],v=[h],T=Xp(t,0,r,s),E,M,O=mH(T,n,o,[]),F=[];Ec(h,T);for(let z=1;z<u;z++){for(E=Xp(t,z,r,s,E),M=H1(E,O);M;){YE(T,E,M,O,F);let W=H1(F,O);W&&(YE(T,F,W,O,F),M=W),Ec(h,F),V1(T,F),zde(O,n,M),i&&h.length>r&&(h=[],v.push(h),Ec(h,T)),M=H1(E,O)}Ec(h,E),V1(T,E)}return i?v:v[0]}var pH=0,Ude=1;function G1(t,e=null,r){if(!t.length)return[];let{size:i=2,gridResolution:n=10,gridOffset:o=[0,0],edgeTypes:s=!1}=r||{},l=[],u=[{pos:t,types:s?new Array(t.length/i).fill(Ude):null,holes:e||[]}],h=[[],[]],v=[];for(;u.length;){let{pos:T,types:E,holes:M}=u.shift();Vde(T,i,M[0]||T.length,h),v=mH(h[0],n,o,v);let O=H1(h[1],v);if(O){let F=AH(T,E,i,0,M[0]||T.length,v,O),z={pos:F[0].pos,types:F[0].types,holes:[]},W={pos:F[1].pos,types:F[1].types,holes:[]};u.push(z,W);for(let J=0;J<M.length;J++)F=AH(T,E,i,M[J],M[J+1]||T.length,v,O),F[0]&&(z.holes.push(z.pos.length),z.pos=KE(z.pos,F[0].pos),s&&(z.types=KE(z.types,F[0].types))),F[1]&&(W.holes.push(W.pos.length),W.pos=KE(W.pos,F[1].pos),s&&(W.types=KE(W.types,F[1].types)))}else{let F={positions:T};s&&(F.edgeTypes=E),M.length&&(F.holeIndices=M),l.push(F)}}return l}function AH(t,e,r,i,n,o,s){let l=(n-i)/r,u=[],h=[],v=[],T=[],E=[],M,O,F,z=Xp(t,l-1,r,i),W=Math.sign(s&8?z[1]-o[3]:z[0]-o[2]),J=e&&e[l-1],K=0,ne=0;for(let ge=0;ge<l;ge++)M=Xp(t,ge,r,i,M),O=Math.sign(s&8?M[1]-o[3]:M[0]-o[2]),F=e&&e[i/r+ge],O&&W&&W!==O&&(YE(z,M,s,o,E),Ec(u,E)&&v.push(J),Ec(h,E)&&T.push(J)),O<=0?(Ec(u,M)&&v.push(F),K-=O):v.length&&(v[v.length-1]=pH),O>=0?(Ec(h,M)&&T.push(F),ne+=O):T.length&&(T[T.length-1]=pH),V1(z,M),W=O,J=F;return[K?{pos:u,types:e&&v}:null,ne?{pos:h,types:e&&T}:null]}function mH(t,e,r,i){let n=Math.floor((t[0]-r[0])/e)*e+r[0],o=Math.floor((t[1]-r[1])/e)*e+r[1];return i[0]=n,i[1]=o,i[2]=n+e,i[3]=o+e,i}function zde(t,e,r){r&8?(t[1]+=e,t[3]+=e):r&4?(t[1]-=e,t[3]-=e):r&2?(t[0]+=e,t[2]+=e):r&1&&(t[0]-=e,t[2]-=e)}function Vde(t,e,r,i){let n=1/0,o=-1/0,s=1/0,l=-1/0;for(let u=0;u<r;u+=e){let h=t[u],v=t[u+1];n=h<n?h:n,o=h>o?h:o,s=v<s?v:s,l=v>l?v:l}return i[0][0]=n,i[0][1]=s,i[1][0]=o,i[1][1]=l,i}function KE(t,e){for(let r=0;r<e.length;r++)t.push(e[r]);return t}var Hde=85.051129;function LO(t,e){let{size:r=2,startIndex:i=0,endIndex:n=t.length,normalize:o=!0}=e||{},s=t.slice(i,n);gH(s,r,0,n-i);let l=j1(s,{size:r,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(o)for(let u of l)_H(u,r);return l}function FO(t,e=null,r){let{size:i=2,normalize:n=!0,edgeTypes:o=!1}=r||{};e=e||[];let s=[],l=[],u=0,h=0;for(let T=0;T<=e.length;T++){let E=e[T]||t.length,M=h,O=jde(t,i,u,E);for(let F=O;F<E;F++)s[h++]=t[F];for(let F=u;F<O;F++)s[h++]=t[F];gH(s,i,M,h),Gde(s,i,M,h,r?.maxLatitude),u=E,l[T]=h}l.pop();let v=G1(s,l,{size:i,gridResolution:360,gridOffset:[-180,-180],edgeTypes:o});if(n)for(let T of v)_H(T.positions,i);return v}function jde(t,e,r,i){let n=-1,o=-1;for(let s=r+1;s<i;s+=e){let l=Math.abs(t[s]);l>n&&(n=l,o=s-1)}return o}function Gde(t,e,r,i,n=Hde){let o=t[r],s=t[i-e];if(Math.abs(o-s)>180){let l=Xp(t,0,e,r);l[0]+=Math.round((s-o)/360)*360,Ec(t,l),l[1]=Math.sign(l[1])*n,Ec(t,l),l[0]=o,Ec(t,l)}}function gH(t,e,r,i){let n=t[0],o;for(let s=r;s<i;s+=e){o=t[s];let l=o-n;(l>180||l<-180)&&(o-=Math.round(l/360)*360),t[s]=n=o}}function _H(t,e){let r,i=t.length/e;for(let o=0;o<i&&(r=t[o*e],(r+180)%360===0);o++);let n=-Math.round(r/360)*360;if(n!==0)for(let o=0;o<i;o++)t[o*e]+=n}var W1=class extends Fn{constructor(e){let{indices:r,attributes:i}=qde(e);super({...e,indices:r,attributes:i})}};function qde(t){let{radius:e,height:r=1,nradial:i=10}=t,{vertices:n}=t;n&&(ur.assert(n.length>=i),n=n.flatMap(M=>[M[0],M[1]]),Gm(n,__.COUNTER_CLOCKWISE));let o=r>0,s=i+1,l=o?s*3+1:i,u=Math.PI*2/i,h=new Uint16Array(o?i*3*2:0),v=new Float32Array(l*3),T=new Float32Array(l*3),E=0;if(o){for(let M=0;M<s;M++){let O=M*u,F=M%i,z=Math.sin(O),W=Math.cos(O);for(let J=0;J<2;J++)v[E+0]=n?n[F*2]:W*e,v[E+1]=n?n[F*2+1]:z*e,v[E+2]=(1/2-J)*r,T[E+0]=n?n[F*2]:W,T[E+1]=n?n[F*2+1]:z,E+=3}v[E+0]=v[E-3],v[E+1]=v[E-2],v[E+2]=v[E-1],E+=3}for(let M=o?0:1;M<s;M++){let O=Math.floor(M/2)*Math.sign(.5-M%2),F=O*u,z=(O+i)%i,W=Math.sin(F),J=Math.cos(F);v[E+0]=n?n[z*2]:J*e,v[E+1]=n?n[z*2+1]:W*e,v[E+2]=r/2,T[E+2]=1,E+=3}if(o){let M=0;for(let O=0;O<i;O++)h[M++]=O*2+0,h[M++]=O*2+2,h[M++]=O*2+0,h[M++]=O*2+1,h[M++]=O*2+1,h[M++]=O*2+3}return{indices:h,attributes:{POSITION:{size:3,value:v},NORMAL:{size:3,value:T}}}}var yH=`#version 300 es
#define SHADER_NAME column-layer-vertex-shader
in vec3 positions;
in vec3 normals;
in vec3 instancePositions;
in float instanceElevations;
in vec3 instancePositions64Low;
in vec4 instanceFillColors;
in vec4 instanceLineColors;
in float instanceStrokeWidths;
in vec3 instancePickingColors;
uniform float opacity;
uniform float radius;
uniform float angle;
uniform vec2 offset;
uniform bool extruded;
uniform bool stroked;
uniform bool isStroke;
uniform float coverage;
uniform float elevationScale;
uniform float edgeDistance;
uniform float widthScale;
uniform float widthMinPixels;
uniform float widthMaxPixels;
uniform int radiusUnits;
uniform int widthUnits;
out vec4 vColor;
#ifdef FLAT_SHADING
out vec3 cameraPosition;
out vec4 position_commonspace;
#endif
void main(void) {
geometry.worldPosition = instancePositions;
vec4 color = isStroke ? instanceLineColors : instanceFillColors;
mat2 rotationMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));
float elevation = 0.0;
float strokeOffsetRatio = 1.0;
if (extruded) {
elevation = instanceElevations * (positions.z + 1.0) / 2.0 * elevationScale;
} else if (stroked) {
float widthPixels = clamp(
project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),
widthMinPixels, widthMaxPixels) / 2.0;
float halfOffset = project_pixel_size(widthPixels) / project_size(edgeDistance * coverage * radius);
if (isStroke) {
strokeOffsetRatio -= sign(positions.z) * halfOffset;
} else {
strokeOffsetRatio -= halfOffset;
}
}
float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
float dotRadius = radius * coverage * shouldRender;
geometry.pickingColor = instancePickingColors;
vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);
vec3 centroidPosition64Low = instancePositions64Low;
vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + offset) * dotRadius;
if (radiusUnits == UNIT_METERS) {
offset = project_size(offset);
}
vec3 pos = vec3(offset, 0.);
DECKGL_FILTER_SIZE(pos, geometry);
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
if (extruded && !isStroke) {
#ifdef FLAT_SHADING
cameraPosition = project.cameraPosition;
position_commonspace = geometry.position;
vColor = vec4(color.rgb, color.a * opacity);
#else
vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
vColor = vec4(lightColor, color.a * opacity);
#endif
} else {
vColor = vec4(color.rgb, color.a * opacity);
}
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var vH=`#version 300 es
#define SHADER_NAME column-layer-fragment-shader
precision highp float;
uniform bool extruded;
uniform bool isStroke;
out vec4 fragColor;
in vec4 vColor;
#ifdef FLAT_SHADING
in vec3 cameraPosition;
in vec4 position_commonspace;
#endif
void main(void) {
fragColor = vColor;
geometry.uv = vec2(0.);
#ifdef FLAT_SHADING
if (extruded && !isStroke && !bool(picking.isActive)) {
vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
fragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_commonspace.xyz, normal);
}
#endif
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var ZE=[0,0,0,255],Xde={diskResolution:{type:"number",min:4,value:20},vertices:null,radius:{type:"number",min:0,value:1e3},angle:{type:"number",value:0},offset:{type:"array",value:[0,0]},coverage:{type:"number",min:0,max:1,value:1},elevationScale:{type:"number",min:0,value:1},radiusUnits:"meters",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,extruded:!0,wireframe:!1,filled:!0,stroked:!1,flatShading:!1,getPosition:{type:"accessor",value:t=>t.position},getFillColor:{type:"accessor",value:ZE},getLineColor:{type:"accessor",value:ZE},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}},JE=class extends On{getShaders(){let e={},{flatShading:r}=this.props;return r&&(e.FLAT_SHADING=1),super.getShaders({vs:yH,fs:vH,defines:e,modules:[Jn,r?kp:Fu,go]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getFillColor",defaultValue:ZE},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:ZE},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:!0}})}updateState(e){super.updateState(e);let{props:r,oldProps:i,changeFlags:n}=e,o=n.extensionsChanged||r.flatShading!==i.flatShading;o&&(this.state.models?.forEach(l=>l.destroy()),this.setState(this._getModels()),this.getAttributeManager().invalidateAll());let s=this.getNumInstances();this.state.fillModel.setInstanceCount(s),this.state.wireframeModel.setInstanceCount(s),(o||r.diskResolution!==i.diskResolution||r.vertices!==i.vertices||(r.extruded||r.stroked)!==(i.extruded||i.stroked))&&this._updateGeometry(r)}getGeometry(e,r,i){let n=new W1({radius:1,height:i?2:0,vertices:r,nradial:e}),o=0;if(r)for(let s=0;s<e;s++){let l=r[s],u=Math.sqrt(l[0]*l[0]+l[1]*l[1]);o+=u/e}else o=1;return this.setState({edgeDistance:Math.cos(Math.PI/e)*o}),n}_getModels(){let e=this.getShaders(),r=this.getAttributeManager().getBufferLayouts(),i=new Ni(this.context.device,{...e,id:`${this.props.id}-fill`,bufferLayout:r,isInstanced:!0}),n=new Ni(this.context.device,{...e,id:`${this.props.id}-wireframe`,bufferLayout:r,isInstanced:!0});return{fillModel:i,wireframeModel:n,models:[n,i]}}_updateGeometry({diskResolution:e,vertices:r,extruded:i,stroked:n}){let o=this.getGeometry(e,r,i||n);this.setState({fillVertexCount:o.attributes.POSITION.value.length/3});let s=this.state.fillModel,l=this.state.wireframeModel;s.setGeometry(o),s.setTopology("triangle-strip"),s.setIndexBuffer(null),l.setGeometry(o),l.setTopology("line-list")}draw({uniforms:e}){let{lineWidthUnits:r,lineWidthScale:i,lineWidthMinPixels:n,lineWidthMaxPixels:o,radiusUnits:s,elevationScale:l,extruded:u,filled:h,stroked:v,wireframe:T,offset:E,coverage:M,radius:O,angle:F}=this.props,z=this.state.fillModel,W=this.state.wireframeModel,{fillVertexCount:J,edgeDistance:K}=this.state,ne={...e,radius:O,angle:F/180*Math.PI,offset:E,extruded:u,stroked:v,coverage:M,elevationScale:l,edgeDistance:K,radiusUnits:ms[s],widthUnits:ms[r],widthScale:i,widthMinPixels:n,widthMaxPixels:o};u&&T&&(W.setUniforms(ne),W.setUniforms({isStroke:!0}),W.draw(this.context.renderPass)),z.setUniforms(ne),h&&(z.setVertexCount(J),z.setUniforms({isStroke:!1}),z.draw(this.context.renderPass)),!u&&v&&(z.setVertexCount(J*2/3),z.setUniforms({isStroke:!0}),z.draw(this.context.renderPass))}},If=JE;(()=>{JE.layerName="ColumnLayer"})(),(()=>{JE.defaultProps=Xde})();var Yde={cellSize:{type:"number",min:0,value:1e3},offset:{type:"array",value:[1,1]}},QE=class extends If{_updateGeometry(){let e=new xd;this.state.fillModel.setGeometry(e)}draw({uniforms:e}){let{elevationScale:r,extruded:i,offset:n,coverage:o,cellSize:s,angle:l,radiusUnits:u}=this.props,h=this.state.fillModel;h.setUniforms(e),h.setUniforms({radius:s/2,radiusUnits:ms[u],angle:l,offset:n,extruded:i,coverage:o,elevationScale:r,edgeDistance:1,isStroke:!1}),h.draw(this.context.renderPass)}},qm=QE;(()=>{QE.layerName="GridCellLayer"})(),(()=>{QE.defaultProps=Yde})();function xH(t,e,r,i){let n;if(Array.isArray(t[0])){let o=t.length*e;n=new Array(o);for(let s=0;s<t.length;s++)for(let l=0;l<e;l++)n[s*e+l]=t[s][l]||0}else n=t;return r?j1(n,{size:e,gridResolution:r}):i?LO(n,{size:e}):n}var Kde=1,Zde=2,NO=4,q1=class extends Bd{constructor(e){super({...e,attributes:{positions:{size:3,padding:18,initialize:!0,type:e.fp64?Float64Array:Float32Array},segmentTypes:{size:1,type:Uint8ClampedArray}}})}get(e){return this.attributes[e]}getGeometryFromBuffer(e){return this.normalize?super.getGeometryFromBuffer(e):null}normalizeGeometry(e){return this.normalize?xH(e,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):e}getGeometrySize(e){if(bH(e)){let i=0;for(let n of e)i+=this.getGeometrySize(n);return i}let r=this.getPathLength(e);return r<2?0:this.isClosed(e)?r<3?0:r+2:r}updateGeometryAttributes(e,r){if(r.geometrySize!==0)if(e&&bH(e))for(let i of e){let n=this.getGeometrySize(i);r.geometrySize=n,this.updateGeometryAttributes(i,r),r.vertexStart+=n}else this._updateSegmentTypes(e,r),this._updatePositions(e,r)}_updateSegmentTypes(e,r){let i=this.attributes.segmentTypes,n=e?this.isClosed(e):!1,{vertexStart:o,geometrySize:s}=r;i.fill(0,o,o+s),n?(i[o]=NO,i[o+s-2]=NO):(i[o]+=Kde,i[o+s-2]+=Zde),i[o+s-1]=NO}_updatePositions(e,r){let{positions:i}=this.attributes;if(!i||!e)return;let{vertexStart:n,geometrySize:o}=r,s=new Array(3);for(let l=n,u=0;u<o;l++,u++)this.getPointOnPath(e,u,s),i[l*3]=s[0],i[l*3+1]=s[1],i[l*3+2]=s[2]}getPathLength(e){return e.length/this.positionSize}getPointOnPath(e,r,i=[]){let{positionSize:n}=this;r*n>=e.length&&(r+=1-e.length/n);let o=r*n;return i[0]=e[o],i[1]=e[o+1],i[2]=n===3&&e[o+2]||0,i}isClosed(e){if(!this.normalize)return Boolean(this.opts.loop);let{positionSize:r}=this,i=e.length-r;return e[0]===e[i]&&e[1]===e[i+1]&&(r===2||e[2]===e[i+2])}};function bH(t){return Array.isArray(t[0])}var wH=`#version 300 es
#define SHADER_NAME path-layer-vertex-shader
in vec2 positions;
in float instanceTypes;
in vec3 instanceStartPositions;
in vec3 instanceEndPositions;
in vec3 instanceLeftPositions;
in vec3 instanceRightPositions;
in vec3 instanceLeftPositions64Low;
in vec3 instanceStartPositions64Low;
in vec3 instanceEndPositions64Low;
in vec3 instanceRightPositions64Low;
in float instanceStrokeWidths;
in vec4 instanceColors;
in vec3 instancePickingColors;
uniform float widthScale;
uniform float widthMinPixels;
uniform float widthMaxPixels;
uniform float jointType;
uniform float capType;
uniform float miterLimit;
uniform bool billboard;
uniform int widthUnits;
uniform float opacity;
out vec4 vColor;
out vec2 vCornerOffset;
out float vMiterLength;
out vec2 vPathPosition;
out float vPathLength;
out float vJointType;
const float EPSILON = 0.001;
const vec3 ZERO_OFFSET = vec3(0.0);
float flipIfTrue(bool flag) {
return -(float(flag) * 2. - 1.);
}
vec3 getLineJoinOffset(
vec3 prevPoint, vec3 currPoint, vec3 nextPoint,
vec2 width
) {
bool isEnd = positions.x > 0.0;
float sideOfPath = positions.y;
float isJoint = float(sideOfPath == 0.0);
vec3 deltaA3 = (currPoint - prevPoint);
vec3 deltaB3 = (nextPoint - currPoint);
mat3 rotationMatrix;
bool needsRotation = !billboard && project_needs_rotation(currPoint, rotationMatrix);
if (needsRotation) {
deltaA3 = deltaA3 * rotationMatrix;
deltaB3 = deltaB3 * rotationMatrix;
}
vec2 deltaA = deltaA3.xy / width;
vec2 deltaB = deltaB3.xy / width;
float lenA = length(deltaA);
float lenB = length(deltaB);
vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);
vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);
vec2 perpA = vec2(-dirA.y, dirA.x);
vec2 perpB = vec2(-dirB.y, dirB.x);
vec2 tangent = dirA + dirB;
tangent = length(tangent) > 0. ? normalize(tangent) : perpA;
vec2 miterVec = vec2(-tangent.y, tangent.x);
vec2 dir = isEnd ? dirA : dirB;
vec2 perp = isEnd ? perpA : perpB;
float L = isEnd ? lenA : lenB;
float sinHalfA = abs(dot(miterVec, perp));
float cosHalfA = abs(dot(dirA, miterVec));
float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);
float cornerPosition = sideOfPath * turnDirection;
float miterSize = 1.0 / max(sinHalfA, EPSILON);
miterSize = mix(
min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),
miterSize,
step(0.0, cornerPosition)
);
vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))
* (sideOfPath + isJoint * turnDirection);
bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));
bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));
bool isCap = isStartCap || isEndCap;
if (isCap) {
offsetVec = mix(perp * sideOfPath, dir * capType * 4.0 * flipIfTrue(isStartCap), isJoint);
vJointType = capType;
} else {
vJointType = jointType;
}
vPathLength = L;
vCornerOffset = offsetVec;
vMiterLength = dot(vCornerOffset, miterVec * turnDirection);
vMiterLength = isCap ? isJoint : vMiterLength;
vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);
vPathPosition = vec2(
dot(offsetFromStartOfPath, perp),
dot(offsetFromStartOfPath, dir)
);
geometry.uv = vPathPosition;
float isValid = step(instanceTypes, 3.5);
vec3 offset = vec3(offsetVec * width * isValid, 0.0);
if (needsRotation) {
offset = rotationMatrix * offset;
}
return offset;
}
void clipLine(inout vec4 position, vec4 refPosition) {
if (position.w < EPSILON) {
float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);
position = refPosition + (position - refPosition) * r;
}
}
void main() {
geometry.pickingColor = instancePickingColors;
vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);
float isEnd = positions.x;
vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);
vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);
vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);
vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);
vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);
vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);
geometry.worldPosition = currPosition;
vec2 widthPixels = vec2(clamp(
project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),
widthMinPixels, widthMaxPixels) / 2.0);
vec3 width;
if (billboard) {
vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);
vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);
vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);
clipLine(prevPositionScreen, currPositionScreen);
clipLine(nextPositionScreen, currPositionScreen);
clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));
width = vec3(widthPixels, 0.0);
DECKGL_FILTER_SIZE(width, geometry);
vec3 offset = getLineJoinOffset(
prevPositionScreen.xyz / prevPositionScreen.w,
currPositionScreen.xyz / currPositionScreen.w,
nextPositionScreen.xyz / nextPositionScreen.w,
project_pixel_size_to_clipspace(width.xy)
);
DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);
gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);
} else {
prevPosition = project_position(prevPosition, prevPosition64Low);
currPosition = project_position(currPosition, currPosition64Low);
nextPosition = project_position(nextPosition, nextPosition64Low);
width = vec3(project_pixel_size(widthPixels), 0.0);
DECKGL_FILTER_SIZE(width, geometry);
vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);
geometry.position = vec4(currPosition + offset, 1.0);
gl_Position = project_common_position_to_clipspace(geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
}
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var TH=`#version 300 es
#define SHADER_NAME path-layer-fragment-shader
precision highp float;
uniform float miterLimit;
in vec4 vColor;
in vec2 vCornerOffset;
in float vMiterLength;
in vec2 vPathPosition;
in float vPathLength;
in float vJointType;
out vec4 fragColor;
void main(void) {
geometry.uv = vPathPosition;
if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {
if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {
discard;
}
if (vJointType < 0.5 && vMiterLength > miterLimit + 1.0) {
discard;
}
}
fragColor = vColor;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var EH=[0,0,0,255],Jde={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:"accessor",value:t=>t.path},getColor:{type:"accessor",value:EH},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},kO={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},$E=class extends On{getShaders(){return super.getShaders({vs:wH,fs:TH,modules:[Jn,go]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){this.getAttributeManager().addInstanced({vertexPositions:{size:3,vertexOffset:1,type:"float64",fp64:this.use64bitPositions(),transition:kO,accessor:"getPath",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:"uint8",update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:kO,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:kO,defaultValue:EH},instancePickingColors:{size:4,type:"uint8",accessor:(i,{index:n,target:o})=>this.encodePickingColor(i&&i.__source?i.__source.index:n,o)}}),this.setState({pathTesselator:new q1({fp64:this.use64bitPositions()})})}updateState(e){super.updateState(e);let{props:r,changeFlags:i}=e,n=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){let{pathTesselator:s}=this.state,l=r.data.attributes||{};s.updateGeometry({data:r.data,geometryBuffer:l.getPath,buffers:l,normalize:!r._pathType,loop:r._pathType==="loop",getGeometry:r.getPath,positionFormat:r.positionFormat,wrapLongitude:r.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:i.dataChanged}),this.setState({numInstances:s.instanceCount,startIndices:s.vertexStarts}),i.dataChanged||n.invalidateAll()}i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll())}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(o=>o.__source.index===i)),r}disablePickingIndex(e){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i<r.length;i++)r[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{jointRounded:r,capRounded:i,billboard:n,miterLimit:o,widthUnits:s,widthScale:l,widthMinPixels:u,widthMaxPixels:h}=this.props,v=this.state.model;v.setUniforms(e),v.setUniforms({jointType:Number(r),capType:Number(i),billboard:n,widthUnits:ms[s],widthScale:l,miterLimit:o,widthMinPixels:u,widthMaxPixels:h}),v.draw(this.context.renderPass)}_getModel(){let e=[0,1,2,1,4,2,1,3,4,3,5,4],r=[0,0,0,-1,0,1,1,-1,1,1,1,0];return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-list",attributes:{indices:new Uint16Array(e),positions:{value:new Float32Array(r),size:2}}}),isInstanced:!0})}calculatePositions(e){let{pathTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("positions")}calculateSegmentTypes(e){let{pathTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("segmentTypes")}},Pf=$E;(()=>{$E.defaultProps=Jde})(),(()=>{$E.layerName="PathLayer"})();var LH=ga(PH(),1);var nS=__.CLOCKWISE,RH=__.COUNTER_CLOCKWISE,Yp={isClosed:!0};function dpe(t){if(t=t&&t.positions||t,!Array.isArray(t)&&!ArrayBuffer.isView(t))throw new Error("invalid polygon")}function x_(t){return"positions"in t?t.positions:t}function Z1(t){return"holeIndices"in t?t.holeIndices:null}function ppe(t){return Array.isArray(t[0])}function Ape(t){return t.length>=1&&t[0].length>=2&&Number.isFinite(t[0][0])}function mpe(t){let e=t[0],r=t[t.length-1];return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]}function gpe(t,e,r,i){for(let n=0;n<e;n++)if(t[r+n]!==t[i-e+n])return!1;return!0}function BH(t,e,r,i,n){let o=e,s=r.length;for(let l=0;l<s;l++)for(let u=0;u<i;u++)t[o++]=r[l][u]||0;if(!mpe(r))for(let l=0;l<i;l++)t[o++]=r[0][l]||0;return Yp.start=e,Yp.end=o,Yp.size=i,Gm(t,n,Yp),o}function OH(t,e,r,i,n=0,o,s){o=o||r.length;let l=o-n;if(l<=0)return e;let u=e;for(let h=0;h<l;h++)t[u++]=r[n+h];if(!gpe(r,i,n,o))for(let h=0;h<i;h++)t[u++]=r[n+h];return Yp.start=e,Yp.end=u,Yp.size=i,Gm(t,s,Yp),u}function oS(t,e){dpe(t);let r=[],i=[];if("positions"in t){let{positions:n,holeIndices:o}=t;if(o){let s=0;for(let l=0;l<=o.length;l++)s=OH(r,s,n,e,o[l-1],o[l],l===0?nS:RH),i.push(s);return i.pop(),{positions:r,holeIndices:i}}t=n}if(!ppe(t))return OH(r,0,t,e,0,r.length,nS),r;if(!Ape(t)){let n=0;for(let[o,s]of t.entries())n=BH(r,n,s,e,o===0?nS:RH),i.push(n);return i.pop(),{positions:r,holeIndices:i}}return BH(r,0,t,e,nS),r}function jO(t,e,r){let i=t.length/3,n=0;for(let o=0;o<i;o++){let s=(o+1)%i;n+=t[o*3+e]*t[s*3+r],n-=t[s*3+e]*t[o*3+r]}return Math.abs(n/2)}function DH(t,e,r,i){let n=t.length/3;for(let o=0;o<n;o++){let s=o*3,l=t[s+0],u=t[s+1],h=t[s+2];t[s+e]=l,t[s+r]=u,t[s+i]=h}}function FH(t,e,r,i){let n=Z1(t);n&&(n=n.map(l=>l/e));let o=x_(t),s=i&&e===3;if(r){let l=o.length;o=o.slice();let u=[];for(let h=0;h<l;h+=e){u[0]=o[h],u[1]=o[h+1],s&&(u[2]=o[h+2]);let v=r(u);o[h]=v[0],o[h+1]=v[1],s&&(o[h+2]=v[2])}}if(s){let l=jO(o,0,1),u=jO(o,0,2),h=jO(o,1,2);if(!l&&!u&&!h)return[];l>u&&l>h||(u>h?(r||(o=o.slice()),DH(o,0,2,1)):(r||(o=o.slice()),DH(o,2,0,1)))}return(0,LH.default)(o,n,e)}var J1=class extends Bd{constructor(e){let{fp64:r,IndexType:i=Uint32Array}=e;super({...e,attributes:{positions:{size:3,type:r?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:i,size:1}}})}get(e){let{attributes:r}=this;return e==="indices"?r.indices&&r.indices.subarray(0,this.vertexCount):r[e]}updateGeometry(e){super.updateGeometry(e);let r=this.buffers.indices;if(r)this.vertexCount=(r.value||r).length;else if(this.data&&!this.getGeometry)throw new Error("missing indices buffer")}normalizeGeometry(e){if(this.normalize){let r=oS(e,this.positionSize);return this.opts.resolution?G1(x_(r),Z1(r),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?FO(x_(r),Z1(r),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):r}return e}getGeometrySize(e){if(kH(e)){let r=0;for(let i of e)r+=this.getGeometrySize(i);return r}return x_(e).length/this.positionSize}getGeometryFromBuffer(e){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(e):null}updateGeometryAttributes(e,r){if(e&&kH(e))for(let i of e){let n=this.getGeometrySize(i);r.geometrySize=n,this.updateGeometryAttributes(i,r),r.vertexStart+=n,r.indexStart=this.indexStarts[r.geometryIndex+1]}else{let i=e;this._updateIndices(i,r),this._updatePositions(i,r),this._updateVertexValid(i,r)}}_updateIndices(e,{geometryIndex:r,vertexStart:i,indexStart:n}){let{attributes:o,indexStarts:s,typedArrayManager:l}=this,u=o.indices;if(!u||!e)return;let h=n,v=FH(e,this.positionSize,this.opts.preproject,this.opts.full3d);u=l.allocate(u,n+v.length,{copy:!0});for(let T=0;T<v.length;T++)u[h++]=v[T]+i;s[r+1]=n+v.length,o.indices=u}_updatePositions(e,{vertexStart:r,geometrySize:i}){let{attributes:{positions:n},positionSize:o}=this;if(!n||!e)return;let s=x_(e);for(let l=r,u=0;u<i;l++,u++){let h=s[u*o],v=s[u*o+1],T=o>2?s[u*o+2]:0;n[l*3]=h,n[l*3+1]=v,n[l*3+2]=T}}_updateVertexValid(e,{vertexStart:r,geometrySize:i}){let{positionSize:n}=this,o=this.attributes.vertexValid,s=e&&Z1(e);if(e&&e.edgeTypes?o.set(e.edgeTypes,r):o.fill(1,r,r+i),s)for(let l=0;l<s.length;l++)o[r+s[l]/n-1]=0;o[r+i-1]=0}};function kH(t){return Array.isArray(t)&&t.length>0&&!Number.isFinite(t[0])}var sS=`uniform bool extruded;
uniform bool isWireframe;
uniform float elevationScale;
uniform float opacity;
in vec4 fillColors;
in vec4 lineColors;
in vec3 pickingColors;
out vec4 vColor;
struct PolygonProps {
vec3 positions;
vec3 positions64Low;
vec3 normal;
float elevations;
};
vec3 project_offset_normal(vec3 vector) {
if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {
return normalize(vector * project.commonUnitsPerWorldUnit);
}
return project_normal(vector);
}
void calculatePosition(PolygonProps props) {
vec3 pos = props.positions;
vec3 pos64Low = props.positions64Low;
vec3 normal = props.normal;
vec4 colors = isWireframe ? lineColors : fillColors;
geometry.worldPosition = props.positions;
geometry.pickingColor = pickingColors;
if (extruded) {
pos.z += props.elevations * elevationScale;
}
gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
if (extruded) {
#ifdef IS_SIDE_VERTEX
normal = project_offset_normal(normal);
#else
normal = project_normal(normal);
#endif
geometry.normal = normal;
vec3 lightColor = lighting_getLightColor(colors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
vColor = vec4(lightColor, colors.a * opacity);
} else {
vColor = vec4(colors.rgb, colors.a * opacity);
}
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var UH=`#version 300 es
#define SHADER_NAME solid-polygon-layer-vertex-shader
in vec3 vertexPositions;
in vec3 vertexPositions64Low;
in float elevations;
${sS}
void main(void) {
PolygonProps props;
props.positions = vertexPositions;
props.positions64Low = vertexPositions64Low;
props.elevations = elevations;
props.normal = vec3(0.0, 0.0, 1.0);
calculatePosition(props);
}
`;var zH=`#version 300 es
#define SHADER_NAME solid-polygon-layer-vertex-shader-side
#define IS_SIDE_VERTEX
in vec2 positions;
in vec3 vertexPositions;
in vec3 nextVertexPositions;
in vec3 vertexPositions64Low;
in vec3 nextVertexPositions64Low;
in float elevations;
in float instanceVertexValid;
${sS}
void main(void) {
if(instanceVertexValid < 0.5){
gl_Position = vec4(0.);
return;
}
PolygonProps props;
vec3 pos;
vec3 pos64Low;
vec3 nextPos;
vec3 nextPos64Low;
#if RING_WINDING_ORDER_CW == 1
pos = vertexPositions;
pos64Low = vertexPositions64Low;
nextPos = nextVertexPositions;
nextPos64Low = nextVertexPositions64Low;
#else
pos = nextVertexPositions;
pos64Low = nextVertexPositions64Low;
nextPos = vertexPositions;
nextPos64Low = vertexPositions64Low;
#endif
props.positions = mix(pos, nextPos, positions.x);
props.positions64Low = mix(pos64Low, nextPos64Low, positions.x);
props.normal = vec3(
pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y),
nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x),
0.0);
props.elevations = elevations * positions.y;
calculatePosition(props);
}
`;var VH=`#version 300 es
#define SHADER_NAME solid-polygon-layer-fragment-shader
precision highp float;
in vec4 vColor;
out vec4 fragColor;
void main(void) {
fragColor = vColor;
geometry.uv = vec2(0.);
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var lS=[0,0,0,255],_pe={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:lS},getLineColor:{type:"accessor",value:lS},material:!0},aS={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},cS=class extends On{getShaders(e){return super.getShaders({vs:e==="top"?UH:zH,fs:VH,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[Jn,Fu,go]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let{viewport:e}=this.context,{coordinateSystem:r}=this.props,{_full3d:i}=this.props;e.isGeospatial&&r===Zr.DEFAULT&&(r=Zr.LNGLAT);let n;r===Zr.LNGLAT&&(i?n=e.projectPosition.bind(e):n=e.projectFlat.bind(e)),this.setState({numInstances:0,polygonTesselator:new J1({preproject:n,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let o=this.getAttributeManager(),s=!0;o.remove(["instancePickingColors"]),o.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:s},vertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:aS,accessor:"getPolygon",update:this.calculatePositions,noAlloc:s,shaderAttributes:{nextVertexPositions:{vertexOffset:1}}},instanceVertexValid:{size:1,type:"uint16",stepMode:"instance",update:this.calculateVertexValid,noAlloc:s},elevations:{size:1,stepMode:"dynamic",transition:aS,accessor:"getElevation"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:aS,accessor:"getFillColor",defaultValue:lS},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:aS,accessor:"getLineColor",defaultValue:lS},pickingColors:{size:4,type:"uint8",stepMode:"dynamic",accessor:(l,{index:u,target:h})=>this.encodePickingColor(l&&l.__source?l.__source.index:u,h)}})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(o=>o.__source.index===i)),r}disablePickingIndex(e){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i<r.length;i++)r[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{extruded:r,filled:i,wireframe:n,elevationScale:o}=this.props,{topModel:s,sideModel:l,wireframeModel:u,polygonTesselator:h}=this.state,v={...e,extruded:Boolean(r),elevationScale:o};u&&n&&(u.setInstanceCount(h.instanceCount-1),u.setUniforms(v),u.draw(this.context.renderPass)),l&&i&&(l.setInstanceCount(h.instanceCount-1),l.setUniforms(v),l.draw(this.context.renderPass)),s&&i&&(s.setVertexCount(h.vertexCount),s.setUniforms(v),s.draw(this.context.renderPass))}updateState(e){super.updateState(e),this.updateGeometry(e);let{props:r,oldProps:i,changeFlags:n}=e,o=this.getAttributeManager();(n.extensionsChanged||r.filled!==i.filled||r.extruded!==i.extruded)&&(this.state.models?.forEach(l=>l.destroy()),this.setState(this._getModels()),o.invalidateAll())}updateGeometry({props:e,oldProps:r,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:o}=this.state,s=e.data.attributes||{};o.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:s.getPolygon,buffers:s,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:e._full3d}),this.setState({numInstances:o.instanceCount,startIndices:o.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let{id:e,filled:r,extruded:i}=this.props,n,o,s;if(r){let l=this.getShaders("top");l.defines.NON_INSTANCED_MODEL=1;let u=this.getAttributeManager().getBufferLayouts({isInstanced:!1});n=new Ni(this.context.device,{...l,id:`${e}-top`,topology:"triangle-list",uniforms:{isWireframe:!1},bufferLayout:u,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}if(i){let l=this.getAttributeManager().getBufferLayouts({isInstanced:!0});o=new Ni(this.context.device,{...this.getShaders("side"),id:`${e}-side`,bufferLayout:l,uniforms:{isWireframe:!1},geometry:new Fn({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}),s=new Ni(this.context.device,{...this.getShaders("side"),id:`${e}-wireframe`,bufferLayout:l,uniforms:{isWireframe:!0},geometry:new Fn({topology:"line-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}})}return{models:[o,s,n].filter(Boolean),topModel:n,sideModel:o,wireframeModel:s}}calculateIndices(e){let{polygonTesselator:r}=this.state;e.startIndices=r.indexStarts,e.value=r.get("indices")}calculatePositions(e){let{polygonTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("positions")}calculateVertexValid(e){e.value=this.state.polygonTesselator.get("vertexValid")}},Rf=cS;(()=>{cS.defaultProps=_pe})(),(()=>{cS.layerName="SolidPolygonLayer"})();function uS({data:t,getIndex:e,dataRange:r,replace:i}){let{startRow:n=0,endRow:o=1/0}=r,s=t.length,l=s,u=s;for(let E=0;E<s;E++){let M=e(t[E]);if(l>E&&M>=n&&(l=E),M>=o){u=E;break}}let h=l,T=u-l!==i.length?t.slice(u):void 0;for(let E=0;E<i.length;E++)t[h++]=i[E];if(T){for(let E=0;E<T.length;E++)t[h++]=T[E];t.length=h}return{startRow:l,endRow:l+i.length}}var HH=[0,0,0,255],ype=[0,0,0,255],vpe={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:t=>t.polygon},getFillColor:{type:"accessor",value:ype},getLineColor:{type:"accessor",value:HH},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0},fS=class extends es{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&ur.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:e}){let r=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(r&&Array.isArray(e.dataChanged)){let i=this.state.paths.slice(),n=e.dataChanged.map(o=>uS({data:i,getIndex:s=>s.__source.index,dataRange:o,replace:this._getPaths(o)}));this.setState({paths:i,pathsDiff:n})}else r&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(e={}){let{data:r,getPolygon:i,positionFormat:n,_normalize:o}=this.props,s=[],l=n==="XY"?2:3,{startRow:u,endRow:h}=e,{iterable:v,objectInfo:T}=Js(r,u,h);for(let E of v){T.index++;let M=i(E,T);o&&(M=oS(M,l));let{holeIndices:O}=M,F=M.positions||M;if(O)for(let z=0;z<=O.length;z++){let W=F.slice(O[z-1]||0,O[z]||F.length);s.push(this.getSubLayerRow({path:W},E,T.index))}else s.push(this.getSubLayerRow({path:F},E,T.index))}return s}renderLayers(){let{data:e,_dataDiff:r,stroked:i,filled:n,extruded:o,wireframe:s,_normalize:l,_windingOrder:u,elevationScale:h,transitions:v,positionFormat:T}=this.props,{lineWidthUnits:E,lineWidthScale:M,lineWidthMinPixels:O,lineWidthMaxPixels:F,lineJointRounded:z,lineMiterLimit:W,lineDashJustified:J}=this.props,{getFillColor:K,getLineColor:ne,getLineWidth:ge,getLineDashArray:j,getElevation:me,getPolygon:fe,updateTriggers:$,material:Z}=this.props,{paths:we,pathsDiff:Oe}=this.state,he=this.getSubLayerClass("fill",Rf),Le=this.getSubLayerClass("stroke",Pf),ft=this.shouldRenderSubLayer("fill",we)&&new he({_dataDiff:r,extruded:o,elevationScale:h,filled:n,wireframe:s,_normalize:l,_windingOrder:u,getElevation:me,getFillColor:K,getLineColor:o&&s?ne:HH,material:Z,transitions:v},this.getSubLayerProps({id:"fill",updateTriggers:$&&{getPolygon:$.getPolygon,getElevation:$.getElevation,getFillColor:$.getFillColor,lineColors:o&&s,getLineColor:$.getLineColor}}),{data:e,positionFormat:T,getPolygon:fe}),Vt=!o&&i&&this.shouldRenderSubLayer("stroke",we)&&new Le({_dataDiff:Oe&&(()=>Oe),widthUnits:E,widthScale:M,widthMinPixels:O,widthMaxPixels:F,jointRounded:z,miterLimit:W,dashJustified:J,_pathType:"loop",transitions:v&&{getWidth:v.getLineWidth,getColor:v.getLineColor,getPath:v.getPolygon},getColor:this.getSubLayerAccessor(ne),getWidth:this.getSubLayerAccessor(ge),getDashArray:this.getSubLayerAccessor(j)},this.getSubLayerProps({id:"stroke",updateTriggers:$&&{getWidth:$.getLineWidth,getColor:$.getLineColor,getDashArray:$.getLineDashArray}}),{data:we,positionFormat:T,getPath:Yt=>Yt.path});return[!o&&ft,Vt,o&&ft]}},Bf=fS;(()=>{fS.layerName="PolygonLayer"})(),(()=>{fS.defaultProps=vpe})();function jH(t,e){if(!t)return null;let r="startIndices"in t?t.startIndices[e]:e,i=t.featureIds.value[r];return r!==-1?xpe(t,i,r):null}function xpe(t,e,r){let i={properties:{...t.properties[e]}};for(let n in t.numericProps)i.properties[n]=t.numericProps[n].value[r];return i}function GH(t,e){let r={points:null,lines:null,polygons:null};for(let i in r){let n=t[i].globalFeatureIds.value;r[i]=new Uint8ClampedArray(n.length*3);let o=[];for(let s=0;s<n.length;s++)e(n[s],o),r[i][s*3+0]=o[0],r[i][s*3+1]=o[1],r[i][s*3+2]=o[2]}return r}var WH=`#version 300 es
#define SHADER_NAME multi-icon-layer-fragment-shader
precision highp float;
uniform float opacity;
uniform sampler2D iconsTexture;
uniform float gamma;
uniform bool sdf;
uniform float alphaCutoff;
uniform float sdfBuffer;
uniform float outlineBuffer;
uniform vec4 outlineColor;
in vec4 vColor;
in vec2 vTextureCoords;
in vec2 uv;
out vec4 fragColor;
void main(void) {
geometry.uv = uv;
if (!bool(picking.isActive)) {
float alpha = texture(iconsTexture, vTextureCoords).a;
vec4 color = vColor;
if (sdf) {
float distance = alpha;
alpha = smoothstep(sdfBuffer - gamma, sdfBuffer + gamma, distance);
if (outlineBuffer > 0.0) {
float inFill = alpha;
float inBorder = smoothstep(outlineBuffer - gamma, outlineBuffer + gamma, distance);
color = mix(outlineColor, vColor, inFill);
alpha = inBorder;
}
}
float a = alpha * color.a;
if (a < alphaCutoff) {
discard;
}
fragColor = vec4(color.rgb, a * opacity);
}
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var GO=192/256,qH=[],bpe={getIconOffsets:{type:"accessor",value:t=>t.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]}},hS=class extends Od{getShaders(){return{...super.getShaders(),fs:WH}}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:"getIconOffsets"},instancePickingColors:{type:"uint8",size:3,accessor:(r,{index:i,target:n})=>this.encodePickingColor(i,n)}})}updateState(e){super.updateState(e);let{props:r,oldProps:i}=e,{outlineColor:n}=r;n!==i.outlineColor&&(n=n.map(o=>o/255),n[3]=Number.isFinite(n[3])?n[3]:1,this.setState({outlineColor:n})),!r.sdf&&r.outlineWidth&&ur.warn(`${this.id}: fontSettings.sdf is required to render outline`)()}draw(e){let{sdf:r,smoothing:i,outlineWidth:n}=this.props,{outlineColor:o}=this.state,s=n?Math.max(i,GO*(1-n)):-1;if(e.uniforms={...e.uniforms,sdfBuffer:GO,outlineBuffer:s,gamma:i,sdf:Boolean(r),outlineColor:o},super.draw(e),r&&n){let{iconManager:l}=this.state,u=l.getTexture(),h=this.state.model;u&&(h.setUniforms({outlineBuffer:GO}),h.draw(this.context.renderPass))}}getInstanceOffset(e){return e?Array.from(e).flatMap(r=>super.getInstanceOffset(r)):qH}getInstanceColorMode(e){return 1}getInstanceIconFrame(e){return e?Array.from(e).flatMap(r=>super.getInstanceIconFrame(r)):qH}},Ym=hS;(()=>{hS.defaultProps=bpe})(),(()=>{hS.layerName="MultiIconLayer"})();var Q1=class{constructor({fontSize:e=24,buffer:r=3,radius:i=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:s="normal",fontStyle:l="normal"}={}){this.buffer=r,this.cutoff=n,this.radius=i;let u=this.size=e+r*4,h=this._createCanvas(u),v=this.ctx=h.getContext("2d",{willReadFrequently:!0});v.font=`${l} ${s} ${e}px ${o}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(u*u),this.gridInner=new Float64Array(u*u),this.f=new Float64Array(u),this.z=new Float64Array(u+1),this.v=new Uint16Array(u)}_createCanvas(e){let r=document.createElement("canvas");return r.width=r.height=e,r}draw(e){let{width:r,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:s}=this.ctx.measureText(e),l=Math.ceil(i),u=0,h=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-o))),v=Math.min(this.size-this.buffer,l+Math.ceil(n)),T=h+2*this.buffer,E=v+2*this.buffer,M=Math.max(T*E,0),O=new Uint8ClampedArray(M),F={data:O,width:T,height:E,glyphWidth:h,glyphHeight:v,glyphTop:l,glyphLeft:u,glyphAdvance:r};if(h===0||v===0)return F;let{ctx:z,buffer:W,gridInner:J,gridOuter:K}=this;z.clearRect(W,W,h,v),z.fillText(e,W,W+l);let ne=z.getImageData(W,W,h,v);K.fill(1e20,0,M),J.fill(0,0,M);for(let ge=0;ge<v;ge++)for(let j=0;j<h;j++){let me=ne.data[4*(ge*h+j)+3]/255;if(me===0)continue;let fe=(ge+W)*T+j+W;if(me===1)K[fe]=0,J[fe]=1e20;else{let $=.5-me;K[fe]=$>0?$*$:0,J[fe]=$<0?$*$:0}}XH(K,0,0,T,E,T,this.f,this.v,this.z),XH(J,W,W,h,v,T,this.f,this.v,this.z);for(let ge=0;ge<M;ge++){let j=Math.sqrt(K[ge])-Math.sqrt(J[ge]);O[ge]=Math.round(255-255*(j/this.radius+this.cutoff))}return F}};function XH(t,e,r,i,n,o,s,l,u){for(let h=e;h<e+i;h++)YH(t,r*o+h,o,n,s,l,u);for(let h=r;h<r+n;h++)YH(t,h*o+e,1,i,s,l,u)}function YH(t,e,r,i,n,o,s){o[0]=0,s[0]=-1e20,s[1]=1e20,n[0]=t[e];for(let l=1,u=0,h=0;l<i;l++){n[l]=t[e+l*r];let v=l*l;do{let T=o[u];h=(n[l]-n[T]+v-T*T)/(l-T)/2}while(h<=s[u]&&--u>-1);u++,o[u]=l,s[u]=h,s[u+1]=1e20}for(let l=0,u=0;l<i;l++){for(;s[u+1]<l;)u++;let h=o[u],v=l-h;t[e+l*r]=n[h]+v*v}}var wpe=32,Tpe=[];function Epe(t){return Math.pow(2,Math.ceil(Math.log2(t)))}function KH({characterSet:t,getFontWidth:e,fontHeight:r,buffer:i,maxCanvasWidth:n,mapping:o={},xOffset:s=0,yOffset:l=0}){let u=0,h=s,v=r+i*2;for(let T of t)if(!o[T]){let E=e(T);h+E+i*2>n&&(h=0,u++),o[T]={x:h+i,y:l+u*v+i,width:E,height:v,layoutWidth:E,layoutHeight:r},h+=E+i*2}return{mapping:o,xOffset:h,yOffset:l+u*v,canvasHeight:Epe(l+(u+1)*v)}}function ZH(t,e,r,i){let n=0;for(let o=e;o<r;o++){let s=t[o];n+=i[s]?.layoutWidth||0}return n}function JH(t,e,r,i,n,o){let s=e,l=0;for(let u=e;u<r;u++){let h=ZH(t,u,u+1,n);l+h>i&&(s<u&&o.push(u),s=u,l=0),l+=h}return l}function Spe(t,e,r,i,n,o){let s=e,l=e,u=e,h=0;for(let v=e;v<r;v++)if((t[v]===" "||t[v+1]===" "||v+1===r)&&(u=v+1),u>l){let T=ZH(t,l,u,n);h+T>i&&(s<l&&(o.push(l),s=l,h=0),T>i&&(T=JH(t,l,u,i,n,o),s=o[o.length-1])),l=u,h+=T}return h}function Cpe(t,e,r,i,n=0,o){o===void 0&&(o=t.length);let s=[];return e==="break-all"?JH(t,n,o,r,i,s):Spe(t,n,o,r,i,s),s}function Mpe(t,e,r,i,n,o){let s=0,l=0;for(let u=e;u<r;u++){let h=t[u],v=i[h];v?(l||(l=v.layoutHeight),n[u]=s+v.layoutWidth/2,s+=v.layoutWidth):(ur.warn(`Missing character: ${h} (${h.codePointAt(0)})`)(),n[u]=s,s+=wpe)}o[0]=s,o[1]=l}function QH(t,e,r,i,n){let o=Array.from(t),s=o.length,l=new Array(s),u=new Array(s),h=new Array(s),v=(r==="break-word"||r==="break-all")&&isFinite(i)&&i>0,T=[0,0],E=[0,0],M=0,O=0,F=0;for(let z=0;z<=s;z++){let W=o[z];if((W===`
`||z===s)&&(F=z),F>O){let J=v?Cpe(o,r,i,n,O,F):Tpe;for(let K=0;K<=J.length;K++){let ne=K===0?O:J[K-1],ge=K<J.length?J[K]:F;Mpe(o,ne,ge,n,l,E);for(let j=ne;j<ge;j++){let me=o[j],fe=n[me]?.layoutOffsetY||0;u[j]=M+E[1]/2+fe,h[j]=E[0]}M=M+E[1]*e,T[0]=Math.max(T[0],E[0])}O=F}W===`
`&&(l[O]=0,u[O]=0,h[O]=0,O++)}return T[1]=M,{x:l,y:u,rowWidth:h,size:T}}function $H({value:t,length:e,stride:r,offset:i,startIndices:n,characterSet:o}){let s=t.BYTES_PER_ELEMENT,l=r?r/s:1,u=i?i/s:0,h=n[e]||Math.ceil((t.length-u)/l),v=o&&new Set,T=new Array(e),E=t;if(l>1||u>0){let M=t.constructor;E=new M(h);for(let O=0;O<h;O++)E[O]=t[O*l+u]}for(let M=0;M<e;M++){let O=n[M],F=n[M+1]||h,z=E.subarray(O,F);T[M]=String.fromCodePoint.apply(null,z),v&&z.forEach(v.add,v)}if(v)for(let M of v)o.add(String.fromCodePoint(M));return{texts:T,characterCount:h}}var b_=class{constructor(e=5){this._cache={},this._order=[],this.limit=e}get(e){let r=this._cache[e];return r&&(this._deleteOrder(e),this._appendOrder(e)),r}set(e,r){this._cache[e]?(this.delete(e),this._cache[e]=r,this._appendOrder(e)):(Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[e]=r,this._appendOrder(e))}delete(e){this._cache[e]&&(delete this._cache[e],this._deleteOrder(e))}_deleteOrder(e){let r=this._order.indexOf(e);r>=0&&this._order.splice(r,1)}_appendOrder(e){this._order.push(e)}};function Ipe(){let t=[];for(let e=32;e<128;e++)t.push(String.fromCharCode(e));return t}var Km={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:Ipe(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},ej=1024,tj=.9,rj=1.2,nj=3,dS=new b_(nj);function Ppe(t,e){let r;typeof e=="string"?r=new Set(Array.from(e)):r=new Set(e);let i=dS.get(t);if(!i)return r;for(let n in i.mapping)r.has(n)&&r.delete(n);return r}function Rpe(t,e){for(let r=0;r<t.length;r++)e.data[4*r+3]=t[r]}function ij(t,e,r,i){t.font=`${i} ${r}px ${e}`,t.fillStyle="#000",t.textBaseline="alphabetic",t.textAlign="left"}function oj(t){ur.assert(Number.isFinite(t)&&t>=nj,"Invalid cache limit"),dS=new b_(t)}var $1=class{constructor(){this.props={...Km}}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}get scale(){let{fontSize:e,buffer:r}=this.props;return(e*rj+r*2)/e}setProps(e={}){Object.assign(this.props,e),this._key=this._getKey();let r=Ppe(this._key,this.props.characterSet),i=dS.get(this._key);if(i&&r.size===0){this._atlas!==i&&(this._atlas=i);return}let n=this._generateFontAtlas(r,i);this._atlas=n,dS.set(this._key,n)}_generateFontAtlas(e,r){let{fontFamily:i,fontWeight:n,fontSize:o,buffer:s,sdf:l,radius:u,cutoff:h}=this.props,v=r&&r.data;v||(v=document.createElement("canvas"),v.width=ej);let T=v.getContext("2d",{willReadFrequently:!0});ij(T,i,o,n);let{mapping:E,canvasHeight:M,xOffset:O,yOffset:F}=KH({getFontWidth:z=>T.measureText(z).width,fontHeight:o*rj,buffer:s,characterSet:e,maxCanvasWidth:ej,...r&&{mapping:r.mapping,xOffset:r.xOffset,yOffset:r.yOffset}});if(v.height!==M){let z=T.getImageData(0,0,v.width,v.height);v.height=M,T.putImageData(z,0,0)}if(ij(T,i,o,n),l){let z=new Q1({fontSize:o,buffer:s,radius:u,cutoff:h,fontFamily:i,fontWeight:`${n}`});for(let W of e){let{data:J,width:K,height:ne,glyphTop:ge}=z.draw(W);E[W].width=K,E[W].layoutOffsetY=o*tj-ge;let j=T.createImageData(K,ne);Rpe(J,j),T.putImageData(j,E[W].x,E[W].y)}}else for(let z of e)T.fillText(z,E[z].x,E[z].y+s+o*tj);return{xOffset:O,yOffset:F,mapping:E,data:v,width:v.width,height:v.height}}_getKey(){let{fontFamily:e,fontWeight:r,fontSize:i,buffer:n,sdf:o,radius:s,cutoff:l}=this.props;return o?`${e} ${r} ${i} ${n} ${s} ${l}`:`${e} ${r} ${i} ${n}`}};var sj=`#version 300 es
#define SHADER_NAME text-background-layer-vertex-shader
in vec2 positions;
in vec3 instancePositions;
in vec3 instancePositions64Low;
in vec4 instanceRects;
in float instanceSizes;
in float instanceAngles;
in vec2 instancePixelOffsets;
in float instanceLineWidths;
in vec4 instanceFillColors;
in vec4 instanceLineColors;
in vec3 instancePickingColors;
uniform bool billboard;
uniform float opacity;
uniform float sizeScale;
uniform float sizeMinPixels;
uniform float sizeMaxPixels;
uniform vec4 padding;
uniform int sizeUnits;
out vec4 vFillColor;
out vec4 vLineColor;
out float vLineWidth;
out vec2 uv;
out vec2 dimensions;
vec2 rotate_by_angle(vec2 vertex, float angle) {
float angle_radian = radians(angle);
float cos_angle = cos(angle_radian);
float sin_angle = sin(angle_radian);
mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);
return rotationMatrix * vertex;
}
void main(void) {
geometry.worldPosition = instancePositions;
geometry.uv = positions;
geometry.pickingColor = instancePickingColors;
uv = positions;
vLineWidth = instanceLineWidths;
float sizePixels = clamp(
project_size_to_pixel(instanceSizes * sizeScale, sizeUnits),
sizeMinPixels, sizeMaxPixels
);
dimensions = instanceRects.zw * sizePixels + padding.xy + padding.zw;
vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-padding.xy, padding.zw, positions);
pixelOffset = rotate_by_angle(pixelOffset, instanceAngles);
pixelOffset += instancePixelOffsets;
pixelOffset.y *= -1.0;
if (billboard) {
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
vec3 offset = vec3(pixelOffset, 0.0);
DECKGL_FILTER_SIZE(offset, geometry);
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
} else {
vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);
DECKGL_FILTER_SIZE(offset_common, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
}
vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);
DECKGL_FILTER_COLOR(vFillColor, geometry);
vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);
DECKGL_FILTER_COLOR(vLineColor, geometry);
}
`;var aj=`#version 300 es
#define SHADER_NAME text-background-layer-fragment-shader
precision highp float;
uniform bool stroked;
in vec4 vFillColor;
in vec4 vLineColor;
in float vLineWidth;
in vec2 uv;
in vec2 dimensions;
out vec4 fragColor;
void main(void) {
geometry.uv = uv;
vec2 pixelPosition = uv * dimensions;
if (stroked) {
float distToEdge = min(
min(pixelPosition.x, dimensions.x - pixelPosition.x),
min(pixelPosition.y, dimensions.y - pixelPosition.y)
);
float isBorder = smoothedge(distToEdge, vLineWidth);
fragColor = mix(vFillColor, vLineColor, isBorder);
} else {
fragColor = vFillColor;
}
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var Bpe={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:t=>t.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}},pS=class extends On{getShaders(){return super.getShaders({vs:sj,fs:aj,modules:[Jn,go]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e);let{changeFlags:r}=e;r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{billboard:r,sizeScale:i,sizeUnits:n,sizeMinPixels:o,sizeMaxPixels:s,getLineWidth:l}=this.props,{padding:u}=this.props;u.length<4&&(u=[u[0],u[1],u[0],u[1]]);let h=this.state.model;h.setUniforms(e),h.setUniforms({billboard:r,stroked:Boolean(l),padding:u,sizeUnits:ms[n],sizeScale:i,sizeMinPixels:o,sizeMaxPixels:s}),h.draw(this.context.renderPass)}_getModel(){let e=[0,0,1,0,0,1,1,1];return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}},Zm=pS;(()=>{pS.defaultProps=Bpe})(),(()=>{pS.layerName="TextBackgroundLayer"})();var lj={start:1,middle:0,end:-1},cj={top:1,center:0,bottom:-1},WO=[0,0,0,255],Ope=1,Dpe={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:WO},getBorderWidth:{type:"accessor",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:Km.characterSet},fontFamily:Km.fontFamily,fontWeight:Km.fontWeight,lineHeight:Ope,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:WO},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:t=>t.text},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:WO},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}},AS=class extends es{constructor(){super(...arguments),this.getBoundingRect=(e,r)=>{let{size:[i,n]}=this.transformParagraph(e,r),{fontSize:o}=this.state.fontAtlasManager.props;i/=o,n/=o;let{getTextAnchor:s,getAlignmentBaseline:l}=this.props,u=lj[typeof s=="function"?s(e,r):s],h=cj[typeof l=="function"?l(e,r):l];return[(u-1)*i/2,(h-1)*n/2,i,n]},this.getIconOffsets=(e,r)=>{let{getTextAnchor:i,getAlignmentBaseline:n}=this.props,{x:o,y:s,rowWidth:l,size:[u,h]}=this.transformParagraph(e,r),v=lj[typeof i=="function"?i(e,r):i],T=cj[typeof n=="function"?n(e,r):n],E=o.length,M=new Array(E*2),O=0;for(let F=0;F<E;F++){let z=(1-v)*(u-l[F])/2;M[O++]=(v-1)*u/2+z+o[F],M[O++]=(T-1)*h/2+s[F]}return M}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new $1},this.props.maxWidth>0&&ur.warn("v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(e){let{props:r,oldProps:i,changeFlags:n}=e;(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||r.lineHeight!==i.lineHeight||r.wordBreak!==i.wordBreak||r.maxWidth!==i.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:e}){return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){let{fontSettings:e,fontFamily:r,fontWeight:i}=this.props,{fontAtlasManager:n,characterSet:o}=this.state,s={...e,characterSet:o,fontFamily:r,fontWeight:i};if(!n.mapping)return n.setProps(s),!0;for(let l in s)if(s[l]!==n.props[l])return n.setProps(s),!0;return!1}_updateText(){let{data:e,characterSet:r}=this.props,i=e.attributes?.getText,{getText:n}=this.props,o=e.startIndices,s,l=r==="auto"&&new Set;if(i&&o){let{texts:u,characterCount:h}=$H({...ArrayBuffer.isView(i)?{value:i}:i,length:e.length,startIndices:o,characterSet:l});s=h,n=(v,{index:T})=>u[T]}else{let{iterable:u,objectInfo:h}=Js(e);o=[0],s=0;for(let v of u){h.index++;let T=Array.from(n(v,h)||"");l&&T.forEach(l.add,l),s+=T.length,o.push(s)}}this.setState({getText:n,startIndices:o,numInstances:s,characterSet:l||r})}transformParagraph(e,r){let{fontAtlasManager:i}=this.state,n=i.mapping,o=this.state.getText,{wordBreak:s,lineHeight:l,maxWidth:u}=this.props,h=o(e,r)||"";return QH(h,l,s,u*i.props.fontSize,n)}renderLayers(){let{startIndices:e,numInstances:r,getText:i,fontAtlasManager:{scale:n,atlas:o,mapping:s},styleVersion:l}=this.state,{data:u,_dataDiff:h,getPosition:v,getColor:T,getSize:E,getAngle:M,getPixelOffset:O,getBackgroundColor:F,getBorderColor:z,getBorderWidth:W,backgroundPadding:J,background:K,billboard:ne,fontSettings:ge,outlineWidth:j,outlineColor:me,sizeScale:fe,sizeUnits:$,sizeMinPixels:Z,sizeMaxPixels:we,transitions:Oe,updateTriggers:he}=this.props,Le=this.getSubLayerClass("characters",Ym),ft=this.getSubLayerClass("background",Zm);return[K&&new ft({getFillColor:F,getLineColor:z,getLineWidth:W,padding:J,getPosition:v,getSize:E,getAngle:M,getPixelOffset:O,billboard:ne,sizeScale:fe,sizeUnits:$,sizeMinPixels:Z,sizeMaxPixels:we,transitions:Oe&&{getPosition:Oe.getPosition,getAngle:Oe.getAngle,getSize:Oe.getSize,getFillColor:Oe.getBackgroundColor,getLineColor:Oe.getBorderColor,getLineWidth:Oe.getBorderWidth,getPixelOffset:Oe.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:he.getPosition,getAngle:he.getAngle,getSize:he.getSize,getFillColor:he.getBackgroundColor,getLineColor:he.getBorderColor,getLineWidth:he.getBorderWidth,getPixelOffset:he.getPixelOffset,getBoundingRect:{getText:he.getText,getTextAnchor:he.getTextAnchor,getAlignmentBaseline:he.getAlignmentBaseline,styleVersion:l}}}),{data:u.attributes&&u.attributes.background?{length:u.length,attributes:u.attributes.background}:u,_dataDiff:h,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new Le({sdf:ge.sdf,smoothing:Number.isFinite(ge.smoothing)?ge.smoothing:Km.smoothing,outlineWidth:j/(ge.radius||Km.radius),outlineColor:me,iconAtlas:o,iconMapping:s,getPosition:v,getColor:T,getSize:E,getAngle:M,getPixelOffset:O,billboard:ne,sizeScale:fe*n,sizeUnits:$,sizeMinPixels:Z*n,sizeMaxPixels:we*n,transitions:Oe&&{getPosition:Oe.getPosition,getAngle:Oe.getAngle,getColor:Oe.getColor,getSize:Oe.getSize,getPixelOffset:Oe.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{all:he.getText,getPosition:he.getPosition,getAngle:he.getAngle,getColor:he.getColor,getSize:he.getSize,getPixelOffset:he.getPixelOffset,getIconOffsets:{getTextAnchor:he.getTextAnchor,getAlignmentBaseline:he.getAlignmentBaseline,styleVersion:l}}}),{data:u,_dataDiff:h,startIndices:e,numInstances:r,getIconOffsets:this.getIconOffsets,getIcon:i})]}static set fontAtlasCacheLimit(e){oj(e)}},Jm=AS;(()=>{AS.defaultProps=Dpe})(),(()=>{AS.layerName="TextLayer"})();var eb={circle:{type:jm,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:Od,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:Jm,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPixels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},tb={type:Pf,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},mS={type:Rf,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function w_({type:t,props:e}){let r={};for(let i in e)r[i]=t.defaultProps[e[i]];return r}function gS(t,e){let{transitions:r,updateTriggers:i}=t.props,n={updateTriggers:{},transitions:r&&{getPosition:r.geometry}};for(let o in e){let s=e[o],l=t.props[o];o.startsWith("get")&&(l=t.getSubLayerAccessor(l),n.updateTriggers[s]=i[o],r&&(n.transitions[s]=r[o])),n[s]=l}return n}function fj(t){if(Array.isArray(t))return t;switch(ur.assert(t.type,"GeoJSON does not have type"),t.type){case"Feature":return[t];case"FeatureCollection":return ur.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return[{geometry:t}]}}function qO(t,e,r={}){let i={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:n=0,endRow:o=t.length}=r;for(let s=n;s<o;s++){let l=t[s],{geometry:u}=l;if(u)if(u.type==="GeometryCollection"){ur.assert(Array.isArray(u.geometries),"GeoJSON does not have geometries array");let{geometries:h}=u;for(let v=0;v<h.length;v++){let T=h[v];uj(T,i,e,l,s)}}else uj(u,i,e,l,s)}return i}function uj(t,e,r,i,n){let{type:o,coordinates:s}=t,{pointFeatures:l,lineFeatures:u,polygonFeatures:h,polygonOutlineFeatures:v}=e;if(!Fpe(o,s)){ur.warn(`${o} coordinates are malformed`)();return}switch(o){case"Point":l.push(r({geometry:t},i,n));break;case"MultiPoint":s.forEach(T=>{l.push(r({geometry:{type:"Point",coordinates:T}},i,n))});break;case"LineString":u.push(r({geometry:t},i,n));break;case"MultiLineString":s.forEach(T=>{u.push(r({geometry:{type:"LineString",coordinates:T}},i,n))});break;case"Polygon":h.push(r({geometry:t},i,n)),s.forEach(T=>{v.push(r({geometry:{type:"LineString",coordinates:T}},i,n))});break;case"MultiPolygon":s.forEach(T=>{h.push(r({geometry:{type:"Polygon",coordinates:T}},i,n)),T.forEach(E=>{v.push(r({geometry:{type:"LineString",coordinates:E}},i,n))})});break;default:}}var Lpe={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function Fpe(t,e){let r=Lpe[t];for(ur.assert(r,`Unknown GeoJSON type ${t}`);e&&--r>0;)e=e[0];return e&&Number.isFinite(e[0])}function hj(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function _S(t){return t.geometry.coordinates}function dj(t,e){let r=hj(),{pointFeatures:i,lineFeatures:n,polygonFeatures:o,polygonOutlineFeatures:s}=t;return r.points.data=i,r.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),r.points.getPosition=_S,r.lines.data=n,r.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),r.lines.getPath=_S,r.polygons.data=o,r.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),r.polygons.getPolygon=_S,r.polygonsOutline.data=s,r.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),r.polygonsOutline.getPath=_S,r}function pj(t,e){let r=hj(),{points:i,lines:n,polygons:o}=t,s=GH(t,e);return r.points.data={length:i.positions.value.length/i.positions.size,attributes:{...i.attributes,getPosition:i.positions,instancePickingColors:{size:3,value:s.points}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},r.lines.data={length:n.pathIndices.value.length-1,startIndices:n.pathIndices.value,attributes:{...n.attributes,getPath:n.positions,instancePickingColors:{size:3,value:s.lines}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},r.lines._pathType="open",r.polygons.data={length:o.polygonIndices.value.length-1,startIndices:o.polygonIndices.value,attributes:{...o.attributes,getPolygon:o.positions,pickingColors:{size:3,value:s.polygons}},properties:o.properties,numericProps:o.numericProps,featureIds:o.featureIds},r.polygons._normalize=!1,o.triangles&&(r.polygons.data.attributes.indices=o.triangles.value),r.polygonsOutline.data={length:o.primitivePolygonIndices.value.length-1,startIndices:o.primitivePolygonIndices.value,attributes:{...o.attributes,getPath:o.positions,instancePickingColors:{size:3,value:s.polygons}},properties:o.properties,numericProps:o.numericProps,featureIds:o.featureIds},r.polygonsOutline._pathType="open",r}var Npe=["points","linestrings","polygons"],kpe={...w_(eb.circle),...w_(eb.icon),...w_(eb.text),...w_(tb),...w_(mS),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:t=>t.properties.icon},getText:{type:"accessor",value:t=>t.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}},yS=class extends es{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:e,changeFlags:r}){if(!r.dataChanged)return;let{data:i}=this.props,n=i&&"points"in i&&"polygons"in i&&"lines"in i;this.setState({binary:n}),n?this._updateStateBinary({props:e,changeFlags:r}):this._updateStateJSON({props:e,changeFlags:r})}_updateStateBinary({props:e,changeFlags:r}){let i=pj(e.data,this.encodePickingColor);this.setState({layerProps:i})}_updateStateJSON({props:e,changeFlags:r}){let i=fj(e.data),n=this.getSubLayerRow.bind(this),o={},s={};if(Array.isArray(r.dataChanged)){let u=this.state.features;for(let h in u)o[h]=u[h].slice(),s[h]=[];for(let h of r.dataChanged){let v=qO(i,n,h);for(let T in u)s[T].push(uS({data:o[T],getIndex:E=>E.__source.index,dataRange:h,replace:v[T]}))}}else o=qO(i,n);let l=dj(o,s);this.setState({features:o,featuresDiff:s,layerProps:l})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i,sourceLayer:n}=r;return r.featureType=Npe.find(o=>n.id.startsWith(`${this.id}-${o}-`)),i>=0&&n.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(r.index=this.props.data.points.globalFeatureIds.value[i]),r}_updateAutoHighlight(e){let r=`${this.id}-points-`,i=e.featureType==="points";for(let n of this.getSubLayers())n.id.startsWith(r)===i&&n.updateAutoHighlight(e)}_renderPolygonLayer(){let{extruded:e,wireframe:r}=this.props,{layerProps:i}=this.state,n="polygons-fill",o=this.shouldRenderSubLayer(n,i.polygons?.data)&&this.getSubLayerClass(n,mS.type);if(o){let s=gS(this,mS.props),l=e&&r;return l||delete s.getLineColor,s.updateTriggers.lineColors=l,new o(s,this.getSubLayerProps({id:n,updateTriggers:s.updateTriggers}),i.polygons)}return null}_renderLineLayers(){let{extruded:e,stroked:r}=this.props,{layerProps:i}=this.state,n="polygons-stroke",o="linestrings",s=!e&&r&&this.shouldRenderSubLayer(n,i.polygonsOutline?.data)&&this.getSubLayerClass(n,tb.type),l=this.shouldRenderSubLayer(o,i.lines?.data)&&this.getSubLayerClass(o,tb.type);if(s||l){let u=gS(this,tb.props);return[s&&new s(u,this.getSubLayerProps({id:n,updateTriggers:u.updateTriggers}),i.polygonsOutline),l&&new l(u,this.getSubLayerProps({id:o,updateTriggers:u.updateTriggers}),i.lines)]}return null}_renderPointLayers(){let{pointType:e}=this.props,{layerProps:r,binary:i}=this.state,{highlightedObjectIndex:n}=this.props;!i&&Number.isFinite(n)&&(n=r.points.data.findIndex(l=>l.__source.index===n));let o=new Set(e.split("+")),s=[];for(let l of o){let u=`points-${l}`,h=eb[l],v=h&&this.shouldRenderSubLayer(u,r.points?.data)&&this.getSubLayerClass(u,h.type);if(v){let T=gS(this,h.props),E=r.points;if(l==="text"&&i){let{instancePickingColors:M,...O}=E.data.attributes;E={...E,data:{...E.data,attributes:O}}}s.push(new v(T,this.getSubLayerProps({id:u,updateTriggers:T.updateTriggers,highlightedObjectIndex:n}),E))}}return s}renderLayers(){let{extruded:e}=this.props,r=this._renderPolygonLayer(),i=this._renderLineLayers(),n=this._renderPointLayers();return[!e&&r,i,n,e&&r]}getSubLayerAccessor(e){let{binary:r}=this.state;return!r||typeof e!="function"?super.getSubLayerAccessor(e):(i,n)=>{let{data:o,index:s}=n,l=jH(o,s);return e(l,n)}}},Oh=yS;(()=>{yS.layerName="GeoJsonLayer"})(),(()=>{yS.defaultProps=kpe})();var Wo={SUM:1,MEAN:2,MIN:3,MAX:4};function Aj(t,e){return t+e}function Upe(t,e){return e>t?e:t}function zpe(t,e){return e<t?e:t}function Vpe(t,e){if(Number.isFinite(e))return t.length?e:null;let r=t.map(e).filter(Number.isFinite);return r.length?r.reduce(Aj,0)/r.length:null}function Hpe(t,e){if(Number.isFinite(e))return t.length?t.length*e:null;let r=t.map(e).filter(Number.isFinite);return r.length?r.reduce(Aj,0):null}function jpe(t,e){if(Number.isFinite(e))return t.length?e:null;let r=t.map(e).filter(Number.isFinite);return r.length?r.reduce(Upe,-1/0):null}function Gpe(t,e){if(Number.isFinite(e))return t.length?e:null;let r=t.map(e).filter(Number.isFinite);return r.length?r.reduce(zpe,1/0):null}function T_(t,e,r){let i=Wo[t]||Wo.SUM;switch(e=Wpe(e,r),i){case Wo.MIN:return n=>Gpe(n,e);case Wo.SUM:return n=>Hpe(n,e);case Wo.MEAN:return n=>Vpe(n,e);case Wo.MAX:return n=>jpe(n,e);default:return null}}function Wpe(t,e={}){return Number.isFinite(t)?t:r=>(e.index=r.index,t(r.source,e))}function mj(t,e={}){return r=>(e.indices=r.map(i=>i.index),t(r.map(i=>i.source),e))}var gj={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},Kp=3402823466e29,XO=[32775,32774],YO=[32776,32774],_j=[32776,32775],KO={[Wo.SUM]:32774,[Wo.MEAN]:32774,[Wo.MIN]:XO,[Wo.MAX]:YO};var yj={size:1,operation:Wo.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},vj=4;var xj=`#version 300 es
#define SHADER_NAME gpu-aggregation-to-grid-vs
in vec3 positions;
in vec3 positions64Low;
in vec3 weights;
uniform vec2 cellSize;
uniform vec2 gridSize;
uniform bool projectPoints;
uniform vec2 translation;
uniform vec3 scaling;
out vec3 vWeights;
vec2 project_to_pixel(vec4 pos) {
vec4 result;
pos.xy = pos.xy/pos.w;
result = pos + vec4(translation, 0., 0.);
result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
return result.xy;
}
void main(void) {
vWeights = weights;
vec4 windowPos = vec4(positions, 1.);
if (projectPoints) {
windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
}
vec2 pos = project_to_pixel(windowPos);
vec2 pixelXY64[2];
pixelXY64[0] = vec2(pos.x, 0.);
pixelXY64[1] = vec2(pos.y, 0.);
vec2 gridXY64[2];
gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
float x = floor(gridXY64[0].x);
float y = floor(gridXY64[1].x);
pos = vec2(x, y);
pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
vec2 offset = 1.0 / gridSize;
pos = pos + offset;
gl_Position = vec4(pos, 0.0, 1.0);
gl_PointSize = 1.0;
}
`;var bj=`#version 300 es
#define SHADER_NAME gpu-aggregation-to-grid-fs
precision highp float;
in vec3 vWeights;
out vec4 fragColor;
void main(void) {
fragColor = vec4(vWeights, 1.0);
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var wj=`#version 300 es
#define SHADER_NAME gpu-aggregation-all-vs-64
in vec2 position;
uniform ivec2 gridSize;
out vec2 vTextureCoord;
void main(void) {
vec2 pos = vec2(-1.0, -1.0);
vec2 offset = 1.0 / vec2(gridSize);
pos = pos + offset;
gl_Position = vec4(pos, 0.0, 1.0);
int yIndex = gl_InstanceID / gridSize[0];
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
vec2 yIndexFP64 = vec2(float(yIndex), 0.);
vec2 xIndexFP64 = vec2(float(xIndex), 0.);
vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
gl_PointSize = 1.0;
}
`;var Tj=`#version 300 es
#define SHADER_NAME gpu-aggregation-all-fs
precision highp float;
in vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform bool combineMaxMin;
out vec4 fragColor;
void main(void) {
vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
if (textureColor.a == 0.) {
discard;
}
fragColor.rgb = textureColor.rgb;
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
}
`;var Ej=`#version 300 es
#define SHADER_NAME gpu-aggregation-transform-mean-vs
in vec4 aggregationValues;
out vec4 meanValues;
void main()
{
bool isCellValid = bool(aggregationValues.w > 0.);
meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
meanValues.w = aggregationValues.w;
gl_PointSize = 1.0;
}
`;var qpe={minFilter:"nearest",magFilter:"nearest"};function E_(t,e){let{width:r=1,height:i=1,data:n=null,sampler:o=qpe}=e;return t.createTexture({data:n,format:"rgba32float",mipmaps:!1,sampler:o,width:r,height:i})}function rb(t,e){let{id:r,width:i=1,height:n=1,texture:o}=e;return t.createFramebuffer({id:r,width:i,height:n,colorAttachments:[o]})}var Xpe=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],Sj={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},Ype=["float32-renderable-webgl","texture-blend-float-webgl"],Fa=class{static getAggregationData({aggregationData:e,maxData:r,minData:i,maxMinData:n,pixelIndex:o}){let s=o*vj,l={};return e&&(l.cellCount=e[s+3],l.cellWeight=e[s]),n?(l.maxCellWieght=n[0],l.minCellWeight=n[3]):(r&&(l.maxCellWieght=r[0],l.totalCount=r[3]),i&&(l.minCellWeight=i[0],l.totalCount=i[3])),l}static getCellData({countsData:e,size:r=1}){let i=e.length/4,n=new Float32Array(i*r),o=new Uint32Array(i);for(let s=0;s<i;s++){for(let l=0;l<r;l++)n[s*r+l]=e[s*4+l];o[s]=e[s*4+3]}return{cellCounts:o,cellWeights:n}}static isSupported(e){return Ype.every(r=>e.features.has(r))}constructor(e,r={}){this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=r.id||"gpu-grid-aggregator",this.device=e;let i=["float32-renderable-webgl"];this._hasGPUSupport=i.every(n=>e.features.has(n)),this._hasGPUSupport&&this._setupModels()}delete(){let{gridAggregationModel:e,allAggregationModel:r,meanTransform:i}=this,{textures:n,framebuffers:o,maxMinFramebuffers:s,minFramebuffers:l,maxFramebuffers:u,meanTextures:h,resources:v}=this.state;e?.destroy(),r?.destroy(),i?.destroy(),Zpe([o,n,s,l,u,h,v])}run(e={}){this.setState({results:{}});let r=this._normalizeAggregationParams(e);return this._runAggregation(r)}getData(e){let r={},i=this.state.results;i[e].aggregationData||(i[e].aggregationData=i[e].aggregationBuffer.getData()),r.aggregationData=i[e].aggregationData;for(let n in Sj){let o=Sj[n];(i[e][n]||i[e][o])&&(i[e][n]=i[e][n]||i[e][o].getData(),r[n]=i[e][n])}return r}updateShaders(e={}){this.setState({shaderOptions:e,modelDirty:!0})}_normalizeAggregationParams(e){let r={...gj,...e},{weights:i}=r;return i&&(r.weights=Kpe(i)),r}setState(e){Object.assign(this.state,e)}_getAggregateData(e){let r={},{textures:i,framebuffers:n,maxMinFramebuffers:o,minFramebuffers:s,maxFramebuffers:l,resources:u}=this.state,{weights:h}=e;for(let v in h){r[v]={};let{needMin:T,needMax:E,combineMaxMin:M}=h[v];r[v].aggregationTexture=i[v],r[v].aggregationBuffer=this.device.readPixelsToBufferWebGL(n[v],{target:h[v].aggregationBuffer,sourceType:5126}),T&&E&&M?(r[v].maxMinBuffer=this.device.readPixelsToBufferWebGL(o[v],{target:h[v].maxMinBuffer,sourceType:5126}),r[v].maxMinTexture=u[`${v}-maxMinTexture`]):(T&&(r[v].minBuffer=this.device.readPixelsToBufferWebGL(s[v],{target:h[v].minBuffer,sourceType:5126}),r[v].minTexture=u[`${v}-minTexture`]),E&&(r[v].maxBuffer=this.device.readPixelsToBufferWebGL(l[v],{target:h[v].maxBuffer,sourceType:5126}),r[v].maxTexture=u[`${v}-maxTexture`]))}return this._trackGPUResultBuffers(r,h),r}_renderAggregateData(e){let{cellSize:r,projectPoints:i,attributes:n,moduleSettings:o,numCol:s,numRow:l,weights:u,translation:h,scaling:v}=e,{maxMinFramebuffers:T,minFramebuffers:E,maxFramebuffers:M}=this.state,O=[s,l],F={blend:!0,depthTest:!1,blendFunc:[1,1]},z={cellSize:r,gridSize:O,projectPoints:i,translation:h,scaling:v};for(let W in u){let{needMin:J,needMax:K}=u[W],ne=J&&K&&u[W].combineMaxMin;this._renderToWeightsTexture({id:W,parameters:F,moduleSettings:o,uniforms:z,gridSize:O,attributes:n,weights:u}),ne?this._renderToMaxMinTexture({id:W,parameters:{...F,blendEquation:_j},gridSize:O,minOrMaxFb:T[W],clearParams:{clearColor:[0,0,0,Kp]},combineMaxMin:ne}):(J&&this._renderToMaxMinTexture({id:W,parameters:{...F,blendEquation:XO},gridSize:O,minOrMaxFb:E[W],clearParams:{clearColor:[Kp,Kp,Kp,0]},combineMaxMin:ne}),K&&this._renderToMaxMinTexture({id:W,parameters:{...F,blendEquation:YO},gridSize:O,minOrMaxFb:M[W],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:ne}))}}_renderToMaxMinTexture(e){let{id:r,gridSize:i,minOrMaxFb:n,combineMaxMin:o,clearParams:s={}}=e,{framebuffers:l}=this.state,{allAggregationModel:u}=this;this.device.withParametersWebGL({...s,framebuffer:n,viewport:[0,0,i[0],i[1]]},()=>{this.device.clearWebGL({color:!0}),u.setUniforms({gridSize:i,combineMaxMin:o}),u.setBindings({uSampler:l[r].texture}),u.draw()})}_renderToWeightsTexture(e){let{id:r,parameters:i,moduleSettings:n,uniforms:o,gridSize:s,weights:l}=e,{framebuffers:u,equations:h,weightAttributes:v}=this.state,{gridAggregationModel:T}=this,{operation:E}=l[r],M=E===Wo.MIN?[Kp,Kp,Kp,0]:[0,0,0,0];if(this.device.withParametersWebGL({framebuffer:u[r],viewport:[0,0,s[0],s[1]],clearColor:M},()=>{this.device.clearWebGL({color:!0});let O={weights:v[r]};T.draw({parameters:{...i,blendEquation:h[r]},moduleSettings:n,uniforms:o,attributes:O})}),E===Wo.MEAN){let{meanTextures:O,textures:F}=this.state,z={_sourceTextures:{aggregationValues:O[r]},_targetTexture:F[r],elementCount:F[r].width*F[r].height};this.meanTransform?this.meanTransform.update(z):this.meanTransform=$pe(this.device,z),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),u[r].attach({[36064]:F[r]})}}_runAggregation(e){this._updateModels(e),this._setupFramebuffers(e),this._renderAggregateData(e);let r=this._getAggregateData(e);return this.setState({results:r}),r}_setupFramebuffers(e){let{textures:r,framebuffers:i,maxMinFramebuffers:n,minFramebuffers:o,maxFramebuffers:s,meanTextures:l,equations:u}=this.state,{weights:h}=e,{numCol:v,numRow:T}=e,E={width:v,height:T};for(let M in h){let{needMin:O,needMax:F,combineMaxMin:z,operation:W}=h[M];r[M]=h[M].aggregationTexture||r[M]||E_(this.device,{id:`${M}-texture`,width:v,height:T}),r[M].resize(E);let J=r[M];W===Wo.MEAN&&(l[M]=l[M]||E_(this.device,{id:`${M}-mean-texture`,width:v,height:T}),l[M].resize(E),J=l[M]),i[M]?i[M].attach({[36064]:J}):i[M]=rb(this.device,{id:`${M}-fb`,width:v,height:T,texture:J}),i[M].resize(E),u[M]=KO[W]||KO[Wo.SUM],(O||F)&&(O&&F&&z?n[M]||(J=h[M].maxMinTexture||this._getMinMaxTexture(`${M}-maxMinTexture`),n[M]=rb(this.device,{id:`${M}-maxMinFb`,texture:J})):(O&&(o[M]||(J=h[M].minTexture||this._getMinMaxTexture(`${M}-minTexture`),o[M]=rb(this.device,{id:`${M}-minFb`,texture:J}))),F&&(s[M]||(J=h[M].maxTexture||this._getMinMaxTexture(`${M}-maxTexture`),s[M]=rb(this.device,{id:`${M}-maxFb`,texture:J})))))}}_getMinMaxTexture(e){let{resources:r}=this.state;return r[e]||(r[e]=E_(this.device,{id:"resourceName"})),r[e]}_setupModels({numCol:e=0,numRow:r=0}={}){let{shaderOptions:i}=this.state;if(this.gridAggregationModel?.destroy(),this.gridAggregationModel=Jpe(this.device,i),!this.allAggregationModel){let n=e*r;this.allAggregationModel=Qpe(this.device,n)}}_setupWeightAttributes(e){let{weightAttributes:r}=this.state,{weights:i}=e;for(let n in i)r[n]=e.attributes[n]}_trackGPUResultBuffers(e,r){let{resources:i}=this.state;for(let n in e)if(e[n]){for(let o of Xpe)if(e[n][o]&&r[n][o]!==e[n][o]){let s=`gpu-result-${n}-${o}`;i[s]&&i[s].delete(),i[s]=e[n][o]}}}_updateModels(e){let{vertexCount:r,attributes:i,numCol:n,numRow:o}=e,{modelDirty:s}=this.state;s&&(this._setupModels(e),this.setState({modelDirty:!1})),this._setupWeightAttributes(e),this.gridAggregationModel.setVertexCount(r),this.gridAggregationModel.setAttributes(i),this.allAggregationModel.setInstanceCount(n*o)}};function Kpe(t){let e={};for(let r in t)e[r]={...yj,...t[r]};return e}function Zpe(t){t=Array.isArray(t)?t:[t],t.forEach(e=>{for(let r in e)e[r].delete()})}function Jpe(t,e){let r=Sm({vs:xj,fs:bj,modules:[Dp,Jn]},e);return new Ni(t,{id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:o_(),...r})}function Qpe(t,e){return new Ni(t,{id:"All-Aggregation-Model",vs:wj,fs:Tj,modules:[Dp],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:e,attributes:{position:[0,0]}})}function $pe(t,e){return new Mh(t,{vs:Ej,_targetTextureVarying:"meanValues",...e})}var ju=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function Zp(t,e=!1,r=Float32Array){let i;if(Number.isFinite(t[0]))i=new r(t);else{i=new r(t.length*4);let n=0;for(let o=0;o<t.length;o++){let s=t[o];i[n++]=s[0],i[n++]=s[1],i[n++]=s[2],i[n++]=Number.isFinite(s[3])?s[3]:255}}if(e)for(let n=0;n<i.length;n++)i[n]/=255;return i}var Cj=`#version 300 es
#define SHADER_NAME screen-grid-layer-vertex-shader
#define RANGE_COUNT 6
in vec3 positions;
in vec3 instancePositions;
in vec4 instanceCounts;
in vec3 instancePickingColors;
uniform float opacity;
uniform vec3 cellScale;
uniform vec4 minColor;
uniform vec4 maxColor;
uniform vec4 colorRange[RANGE_COUNT];
uniform vec2 colorDomain;
uniform bool shouldUseMinMax;
uniform sampler2D maxTexture;
out vec4 vColor;
out float vSampleCount;
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
vec4 outColor = vec4(0., 0., 0., 0.);
if (value >= domain.x && value <= domain.y) {
float domainRange = domain.y - domain.x;
if (domainRange <= 0.) {
outColor = colorRange[0];
} else {
float rangeCount = float(RANGE_COUNT);
float rangeStep = domainRange / rangeCount;
float idx = floor((value - domain.x) / rangeStep);
idx = clamp(idx, 0., rangeCount - 1.);
int intIdx = int(idx);
outColor = colorRange[intIdx];
}
}
outColor = outColor / 255.;
return outColor;
}
void main(void) {
vSampleCount = instanceCounts.a;
float weight = instanceCounts.r;
float maxWeight = texture(maxTexture, vec2(0.5)).r;
float step = weight / maxWeight;
vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
vec2 domain = colorDomain;
float domainMaxValid = float(colorDomain.y != 0.);
domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
vec4 rangeColor = quantizeScale(domain, colorRange, weight);
float rangeMinMax = float(shouldUseMinMax);
vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
vColor = vec4(color.rgb, color.a * opacity);
picking_setPickingColor(instancePickingColors);
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
}
`;var Mj=`#version 300 es
#define SHADER_NAME screen-grid-layer-fragment-shader
precision highp float;
in vec4 vColor;
in float vSampleCount;
out vec4 fragColor;
void main(void) {
if (vSampleCount <= 0.0) {
discard;
}
fragColor = vColor;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var eAe=[0,0,0,0],tAe=[0,255,0,255],rAe=["minColor","maxColor","colorRange","colorDomain"],iAe={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:ju},vS=class extends On{getShaders(){return{vs:Cj,fs:Mj,modules:[Jn,go]}}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e);let{oldProps:r,props:i,changeFlags:n}=e,o=this.getAttributeManager();i.numInstances!==r.numInstances?o.invalidateAll():r.cellSizePixels!==i.cellSizePixels&&o.invalidate("instancePositions"),this._updateUniforms(r,i,n)}draw({uniforms:e}){let{parameters:r,maxTexture:i}=this.props,n=this.props.minColor||eAe,o=this.props.maxColor||tAe,s=this.props.colorDomain||[1,0],l=this.state.model;l.setUniforms(e),l.setBindings({maxTexture:i}),l.setUniforms({minColor:n,maxColor:o,colorDomain:s}),l.setParameters({depthWriteEnabled:!1,...r}),l.draw(this.context.renderPass)}calculateInstancePositions(e,{numInstances:r}){let{width:i,height:n}=this.context.viewport,{cellSizePixels:o}=this.props,s=Math.ceil(i/o),{value:l,size:u}=e;for(let h=0;h<r;h++){let v=h%s,T=Math.floor(h/s);l[h*u+0]=v*o/i*2-1,l[h*u+1]=1-T*o/n*2,l[h*u+2]=0}}_getModel(){return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Fn({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}}),isInstanced:!0})}_shouldUseMinMax(){let{minColor:e,maxColor:r,colorDomain:i,colorRange:n}=this.props;return e||r?(ur.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(i||n)}_updateUniforms(e,r,i){let n=this.state.model;if(rAe.some(o=>e[o]!==r[o])&&n.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),e.colorRange!==r.colorRange&&n.setUniforms({colorRange:Zp(r.colorRange)}),e.cellMarginPixels!==r.cellMarginPixels||e.cellSizePixels!==r.cellSizePixels||i.viewportChanged){let{width:o,height:s}=this.context.viewport,{cellSizePixels:l,cellMarginPixels:u}=this.props,h=l>u?u:0,v=new Float32Array([(l-h)/o*2,-(l-h)/s*2,1]);n.setUniforms({cellScale:v})}}},S_=vS;(()=>{vS.layerName="ScreenGridCellLayer"})(),(()=>{vS.defaultProps=iAe})();function Ij(t,e){let r={};for(let i in t)e.includes(i)||(r[i]=t[i]);return r}var ZO=class extends es{initializeAggregationLayer(e){super.initializeState(this.context),this.setState({ignoreProps:Ij(this.constructor._propTypes,e.data.props),dimensions:e})}updateState(e){super.updateState(e);let{changeFlags:r}=e;if(r.extensionsChanged){let i=this.getShaders({});i&&i.defines&&(i.defines.NON_INSTANCED_MODEL=1),this.updateShaders(i)}this._updateAttributes()}updateAttributes(e){this.setState({changedAttributes:e})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:e,mousePosition:r,device:i}=this.context;return Object.assign(Object.create(this.props),{viewport:e,mousePosition:r,picking:{isActive:0},devicePixelRatio:i.canvasContext.cssToDeviceRatio()})}updateShaders(e){}isAggregationDirty(e,r={}){let{props:i,oldProps:n,changeFlags:o}=e,{compareAll:s=!1,dimension:l}=r,{ignoreProps:u}=this.state,{props:h,accessors:v=[]}=l,{updateTriggersChanged:T}=o;if(o.dataChanged)return!0;if(T){if(T.all)return!0;for(let E of v)if(T[E])return!0}if(s)return o.extensionsChanged?!0:m_({oldProps:n,newProps:i,ignoreProps:u,propTypes:this.constructor._propTypes});for(let E of h)if(i[E]!==n[E])return!0;return!1}isAttributeChanged(e){let{changedAttributes:r}=this.state;return e?r&&r[e]!==void 0:!nAe(r)}_getAttributeManager(){return new Mf(this.context.device,{id:this.props.id,stats:this.context.stats})}},$c=ZO;(()=>{ZO.layerName="AggregationLayer"})();function nAe(t){let e=!0;for(let r in t){e=!1;break}return e}function xS(t,e,r){let i=r;return i.domain=()=>t,i.range=()=>e,i}function Pj(t,e){return xS(t,e,i=>hAe(t,e,i))}function oAe(t,e){return xS(t,e,i=>dAe(t,e,i))}function sAe(t,e){let r=t.sort(Rj),i=0,n=Math.max(1,e.length),o=new Array(n-1);for(;++i<n;)o[i-1]=aAe(r,i/n);let s=l=>cAe(o,e,l);return s.thresholds=()=>o,xS(t,e,s)}function Rj(t,e){return t-e}function aAe(t,e){let r=t.length;if(e<=0||r<2)return t[0];if(e>=1)return t[r-1];let i=(r-1)*e,n=Math.floor(i),o=t[n],s=t[n+1];return o+(s-o)*(i-n)}function lAe(t,e){let r=0,i=t.length;for(;r<i;){let n=r+i>>>1;Rj(t[n],e)>0?i=n:r=n+1}return r}function cAe(t,e,r){return e[lAe(t,r)]}function uAe(t,e,r,i){let n=`${i}`,o=e.get(n);return o===void 0&&(o=t.push(i),e.set(n,o)),r[(o-1)%r.length]}function fAe(t,e){let r=new Map,i=[];for(let o of t){let s=`${o}`;r.has(s)||r.set(s,i.push(o))}return xS(t,e,o=>uAe(i,r,e,o))}function hAe(t,e,r){let i=t[1]-t[0];if(i<=0)return ur.warn("quantizeScale: invalid domain, returning range[0]")(),e[0];let n=i/e.length,o=Math.floor((r-t[0])/n),s=Math.max(Math.min(o,e.length-1),0);return e[s]}function dAe(t,e,r){return(r-t[0])/(t[1]-t[0])*(e[1]-e[0])+e[0]}function Bj(t){return t!=null}function pAe(t){let e=[];return t.forEach(r=>{!e.includes(r)&&Bj(r)&&e.push(r)}),e}function Oj(t,e){return(typeof e=="function"?t.map(e):t).filter(Bj)}function Dj(t,e){return Oj(t,e)}function Lj(t,e){return pAe(Oj(t,e))}function Fj(t,e,r){return Math.max(e,Math.min(r,t))}function Nj(t){switch(t){case"quantize":return Pj;case"linear":return oAe;case"quantile":return sAe;case"ordinal":return fAe;default:return Pj}}var Uj=t=>t.length,AAe=3402823466e29,zj=t=>t.points,Vj=t=>t.index,kj=(t,e)=>t<e?-1:t>e?1:t>=e?0:NaN,mAe={getValue:Uj,getPoints:zj,getIndex:Vj,filterData:null},Dd=class{constructor(e=[],r=mAe){this.aggregatedBins=this.getAggregatedBins(e,r),this._updateMinMaxValues(),this.binMap=this.getBinMap()}getAggregatedBins(e,r){let{getValue:i=Uj,getPoints:n=zj,getIndex:o=Vj,filterData:s}=r,l=typeof s=="function",u=e.length,h=[],v=0;for(let T=0;T<u;T++){let E=e[T],M=n(E),O=o(E),F=l?M.filter(s):M;E.filteredPoints=l?F:null;let z=F.length?i(F):null;z!=null&&(h[v]={i:Number.isFinite(O)?O:T,value:z,counts:F.length},v++)}return h}_percentileToIndex(e){let r=this.sortedBins.length;if(r<2)return[0,0];let[i,n]=e.map(l=>Fj(l,0,100)),o=Math.ceil(i/100*(r-1)),s=Math.floor(n/100*(r-1));return[o,s]}getBinMap(){let e={};for(let r of this.aggregatedBins)e[r.i]=r;return e}_updateMinMaxValues(){let e=0,r=0,i=AAe,n=0;for(let o of this.aggregatedBins)e=e>o.counts?e:o.counts,r=r>o.value?r:o.value,i=i<o.value?i:o.value,n+=o.counts;this.maxCount=e,this.maxValue=r,this.minValue=i,this.totalCount=n}getValueRange(e){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((n,o)=>kj(n.value,o.value))),!this.sortedBins.length)return[];let r=0,i=this.sortedBins.length-1;if(Array.isArray(e)){let n=this._percentileToIndex(e);r=n[0],i=n[1]}return[this.sortedBins[r].value,this.sortedBins[i].value]}getValueDomainByScale(e,[r=0,i=100]=[]){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((o,s)=>kj(o.value,s.value))),!this.sortedBins.length)return[];let n=this._percentileToIndex([r,i]);return this._getScaleDomain(e,n)}_getScaleDomain(e,[r,i]){let n=this.sortedBins;switch(e){case"quantize":case"linear":return[n[r].value,n[i].value];case"quantile":return Dj(n.slice(r,i+1),o=>o.value);case"ordinal":return Lj(n,o=>o.value);default:return[n[r].value,n[i].value]}}};var jj=6378e3;function bS(t){return Number.isFinite(t)?t:0}function wS(t,e){let r=t.positions.value,i=1/0,n=-1/0,o=1/0,s=-1/0,l,u;for(let v=0;v<e;v++)u=r[v*3],l=r[v*3+1],i=l<i?l:i,n=l>n?l:n,o=u<o?u:o,s=u>s?u:s;return{xMin:bS(o),xMax:bS(s),yMin:bS(i),yMax:bS(n)}}function gAe(t,e,r,i){let{width:n,height:o}=i,s=r===Zr.CARTESIAN?[-n/2,-o/2]:[-180,-90];ur.assert(r===Zr.CARTESIAN||r===Zr.LNGLAT||r===Zr.DEFAULT);let{xMin:l,yMin:u}=t;return[-1*(Hj(l-s[0],e.xOffset)+s[0]),-1*(Hj(u-s[1],e.yOffset)+s[1])]}function Hj(t,e){let r=t<0?-1:1,i=r<0?Math.abs(t)+e:Math.abs(t);return i=Math.floor(i/e)*e,i*r}function JO(t,e,r=!0){if(!r)return{xOffset:e,yOffset:e};let{yMin:i,yMax:n}=t,o=(i+n)/2;return _Ae(e,o)}function TS(t,e,r,i){let n=JO(t,e,i!==Zr.CARTESIAN),o=gAe(t,n,i,r),{xMin:s,yMin:l,xMax:u,yMax:h}=t,v=u-s+n.xOffset,T=h-l+n.yOffset,E=Math.ceil(v/n.xOffset),M=Math.ceil(T/n.yOffset);return{gridOffset:n,translation:o,width:v,height:T,numCol:E,numRow:M}}function _Ae(t,e){let r=yAe(t),i=vAe(e,t);return{yOffset:r,xOffset:i}}function yAe(t){return t/jj*(180/Math.PI)}function vAe(t,e){return e/jj*(180/Math.PI)/Math.cos(t*Math.PI/180)}function C_(t,e){let r=xAe(t,e),i=bAe(r);return{gridHash:r.gridHash,gridOffset:r.gridOffset,data:i}}function xAe(t,e){let{data:r=[],cellSize:i}=t,{attributes:n,viewport:o,projectPoints:s,numInstances:l}=e,u=n.positions.value,{size:h}=n.positions.getAccessor(),v=e.boundingBox||wAe(n.positions,l),T=e.posOffset||[180,90],E=e.gridOffset||JO(v,i);if(E.xOffset<=0||E.yOffset<=0)return{gridHash:{},gridOffset:E,offsets:[0,0]};let{width:M,height:O}=o,F=Math.ceil(M/E.xOffset),z=Math.ceil(O/E.yOffset),W={},{iterable:J,objectInfo:K}=Js(r),ne=new Array(3);for(let ge of J){K.index++,ne[0]=u[K.index*h],ne[1]=u[K.index*h+1],ne[2]=h>=3?u[K.index*h+2]:0;let[j,me]=s?o.project(ne):ne;if(Number.isFinite(j)&&Number.isFinite(me)){let fe=Math.floor((me+T[1])/E.yOffset),$=Math.floor((j+T[0])/E.xOffset);if(!s||$>=0&&$<F&&fe>=0&&fe<z){let Z=`${fe}-${$}`;W[Z]=W[Z]||{count:0,points:[],lonIdx:$,latIdx:fe},W[Z].count+=1,W[Z].points.push({source:ge,index:K.index})}}}return{gridHash:W,gridOffset:E,offsets:[T[0]*-1,T[1]*-1]}}function bAe({gridHash:t,gridOffset:e,offsets:r}){let i=new Array(Object.keys(t).length),n=0;for(let o in t){let s=o.split("-"),l=parseInt(s[0],10),u=parseInt(s[1],10),h=n++;i[h]={index:h,position:[r[0]+e.xOffset*u,r[1]+e.yOffset*l],...t[o]}}return i}function wAe(t,e){let r=t.value,{size:i}=t.getAccessor(),n=1/0,o=-1/0,s=1/0,l=-1/0,u,h;for(let v=0;v<e;v++)h=r[v*i],u=r[v*i+1],Number.isFinite(h)&&Number.isFinite(u)&&(n=u<n?u:n,o=u>o?u:o,s=h<s?h:s,l=h>l?h:l);return{xMin:s,xMax:l,yMin:n,yMax:o}}var QO=class extends $c{initializeAggregationLayer({dimensions:e}){super.initializeAggregationLayer(e),this.setState({layerData:{},gpuGridAggregator:new Fa(this.context.device,{id:`${this.id}-gpu-aggregator`}),cpuGridAggregator:C_})}updateState(e){super.updateState(e),this.updateAggregationState(e);let{aggregationDataDirty:r,aggregationWeightsDirty:i,gpuAggregation:n}=this.state;if(this.getNumInstances()<=0)return;let o=!1;(r||n&&i)&&(this._updateAggregation(e),o=!0),!n&&(r||i)&&(this._updateWeightBins(),this._uploadAggregationResults(),o=!0),this.setState({aggregationDirty:o})}finalizeState(e){let{count:r}=this.state.weights;r&&r.aggregationBuffer&&r.aggregationBuffer.delete(),this.state.gpuGridAggregator?.delete(),super.finalizeState(e)}updateShaders(e){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(e)}updateAggregationState(e){ur.assert(!1)}allocateResources(e,r){if(this.state.numRow!==e||this.state.numCol!==r){let i=r*e*4*4,{weights:n}=this.state;for(let o in n){let s=n[o];s.aggregationBuffer&&s.aggregationBuffer.delete(),s.aggregationBuffer=this.context.device.createBuffer({byteLength:i,accessor:{size:4,type:5126,divisor:1}})}}}updateResults({aggregationData:e,maxMinData:r,maxData:i,minData:n}){let{count:o}=this.state.weights;o&&(o.aggregationData=e,o.maxMinData=r,o.maxData=i,o.minData=n)}_updateAggregation(e){let{cpuGridAggregator:r,gpuGridAggregator:i,gridOffset:n,posOffset:o,translation:s=[0,0],scaling:l=[0,0,0],boundingBox:u,projectPoints:h,gpuAggregation:v,numCol:T,numRow:E}=this.state,{props:M}=e,{viewport:O}=this.context,F=this.getAttributes(),z=this.getNumInstances();if(v){let{weights:W}=this.state;i.run({weights:W,cellSize:[n.xOffset,n.yOffset],numCol:T,numRow:E,translation:s,scaling:l,vertexCount:z,projectPoints:h,attributes:F,moduleSettings:this.getModuleSettings()})}else{let W=r(M,{gridOffset:n,projectPoints:h,attributes:F,viewport:O,posOffset:o,boundingBox:u});this.setState({layerData:W})}}_updateWeightBins(){let{getValue:e}=this.state,r=new Dd(this.state.layerData.data||[],{getValue:e});this.setState({sortedBins:r})}_uploadAggregationResults(){let{numCol:e,numRow:r}=this.state,{data:i}=this.state.layerData,{aggregatedBins:n,minValue:o,maxValue:s,totalCount:l}=this.state.sortedBins,u=4,h=e*r*u,v=new Float32Array(h).fill(0);for(let O of n){let{lonIdx:F,latIdx:z}=i[O.i],{value:W,counts:J}=O,K=(F+z*e)*u;v[K]=W,v[K+u-1]=J}let T=new Float32Array([s,0,0,o]),E=new Float32Array([s,0,0,l]),M=new Float32Array([o,0,0,l]);this.updateResults({aggregationData:v,maxMinData:T,maxData:E,minData:M})}},Ld=QO;(()=>{QO.layerName="GridAggregationLayer"})();var TAe={...S_.defaultProps,getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"},Gj="positions",EAe={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},ES=class extends Ld{initializeState(){super.initializeAggregationLayer({dimensions:EAe,getCellSize:i=>i.cellSizePixels});let e={count:{size:1,operation:Wo.SUM,needMax:!0,maxTexture:E_(this.context.device,{id:`${this.id}-max-texture`})}};this.setState({supported:!0,projectPoints:!0,weights:e,subLayerData:{attributes:{}},maxTexture:e.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]}),this.getAttributeManager().add({[Gj]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}shouldUpdateState({changeFlags:e}){return this.state.supported&&e.somethingChanged}updateState(e){super.updateState(e)}renderLayers(){if(!this.state.supported)return[];let{maxTexture:e,numRow:r,numCol:i,weights:n}=this.state,{updateTriggers:o}=this.props,{aggregationBuffer:s}=n.count,l=this.getSubLayerClass("cells",S_);return new l(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:o}),{data:{attributes:{instanceCounts:s}},maxTexture:e,numInstances:r*i})}finalizeState(e){super.finalizeState(e);let{aggregationBuffer:r,maxBuffer:i,maxTexture:n}=this.state;r?.delete(),i?.delete(),n?.delete()}getPickingInfo({info:e}){let{index:r}=e;if(r>=0){let{gpuGridAggregator:i,gpuAggregation:n,weights:o}=this.state,s=n?i.getData("count"):o.count;e.object=Fa.getAggregationData({pixelIndex:r,...s})}return e}updateResults({aggregationData:e,maxData:r}){let{count:i}=this.state.weights;i.aggregationData=e,i.aggregationBuffer.write(e),i.maxData=r,i.maxTexture.setImageData({data:r})}updateAggregationState(e){let r=e.props.cellSizePixels,i=e.oldProps.cellSizePixels!==r,{viewportChanged:n}=e.changeFlags,o=e.props.gpuAggregation;this.state.gpuAggregation!==e.props.gpuAggregation&&o&&!Fa.isSupported(this.context.device)&&(ur.warn("GPU Grid Aggregation not supported, falling back to CPU")(),o=!1);let s=o!==this.state.gpuAggregation;this.setState({gpuAggregation:o});let l=this.isAttributeChanged(Gj),{dimensions:u}=this.state,{data:h,weights:v}=u,T=l||s||n||this.isAggregationDirty(e,{compareAll:o,dimension:h}),E=this.isAggregationDirty(e,{dimension:v});this.setState({aggregationDataDirty:T,aggregationWeightsDirty:E});let{viewport:M}=this.context;if(n||i){let{width:O,height:F}=M,z=Math.ceil(O/r),W=Math.ceil(F/r);this.allocateResources(W,z),this.setState({scaling:[O/2,-F/2,1],gridOffset:{xOffset:r,yOffset:r},width:O,height:F,numCol:z,numRow:W})}E&&this._updateAccessors(e),(T||E)&&this._resetResults()}_updateAccessors(e){let{getWeight:r,aggregation:i,data:n}=e.props,{count:o}=this.state.weights;o&&(o.getWeight=r,o.operation=Wo[i]),this.setState({getValue:T_(i,r,{data:n})})}_resetResults(){let{count:e}=this.state.weights;e&&(e.aggregationData=null)}},ib=ES;(()=>{ES.layerName="ScreenGridLayer"})(),(()=>{ES.defaultProps=TAe})();function Wj(){}var qj=["getBins","getDomain","getScaleFunc"],Xj=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],SAe=t=>t.cellSize,Fd=class{constructor(e){this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=e.getCellSize||SAe,this._getAggregator=e.getAggregator,this._addDimension(e.dimensions||Xj)}static defaultDimensions(){return Xj}updateState(e,r){let{oldProps:i,props:n,changeFlags:o}=e;this.updateGetValueFuncs(i,n,o);let s=this.needsReProjectPoints(i,n,o),l=!1;return o.dataChanged||s?(this.getAggregatedData(n,r),l=!0):((this.getDimensionChanges(i,n,o)||[]).forEach(h=>typeof h=="function"&&h()),l=!0),this.setState({aggregationDirty:l}),this.state}setState(e){this.state={...this.state,...e}}setDimensionState(e,r){this.setState({dimensions:{...this.state.dimensions,[e]:{...this.state.dimensions[e],...r}}})}normalizeResult(e={}){return e.hexagons?{data:e.hexagons,...e}:e.layerData?{data:e.layerData,...e}:e}getAggregatedData(e,r){let n=this._getAggregator(e)(e,r);this.setState({layerData:this.normalizeResult(n)}),this.changeFlags={layerData:!0},this.getSortedBins(e)}updateGetValueFuncs(e,r,i){for(let n in this.dimensionUpdaters){let{value:o,weight:s,aggregation:l}=this.dimensionUpdaters[n].getBins.triggers,u=r[o.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[n].getBins,e,r,i)&&(u?u=mj(u,{data:r.data}):u=T_(r[l.prop],r[s.prop],{data:r.data})),u&&this.setDimensionState(n,{getValue:u})}}needsReProjectPoints(e,r,i){return this._getCellSize(e)!==this._getCellSize(r)||this._getAggregator(e)!==this._getAggregator(r)||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPosition)}addDimension(e){this._addDimension(e)}_addDimension(e=[]){e.forEach(r=>{let{key:i}=r;this.dimensionUpdaters[i]=this.getDimensionUpdaters(r),this.state.dimensions[i]={getValue:null,domain:null,sortedBins:null,scaleFunc:Wj}})}getDimensionUpdaters({key:e,accessor:r,pickingInfo:i,getBins:n,getDomain:o,getScaleFunc:s,nullValue:l}){return{key:e,accessor:r,pickingInfo:i,getBins:{updater:this.getDimensionSortedBins.bind(this),...n},getDomain:{updater:this.getDimensionValueDomain.bind(this),...o},getScaleFunc:{updater:this.getDimensionScale.bind(this),...s},attributeAccessor:this.getSubLayerDimensionAttribute(e,l)}}needUpdateDimensionStep(e,r,i,n){return Object.values(e.triggers).some(o=>o.updateTrigger?n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged[o.updateTrigger]):r[o.prop]!==i[o.prop])}getDimensionChanges(e,r,i){let n=[];for(let o in this.dimensionUpdaters){let s=qj.find(l=>this.needUpdateDimensionStep(this.dimensionUpdaters[o][l],e,r,i));s&&n.push(this.dimensionUpdaters[o][s].updater.bind(this,r,this.dimensionUpdaters[o]))}return n.length?n:null}getUpdateTriggers(e){let r=e.updateTriggers||{},i={};for(let n in this.dimensionUpdaters){let{accessor:o}=this.dimensionUpdaters[n];i[o]={},qj.forEach(s=>{Object.values(this.dimensionUpdaters[n][s].triggers).forEach(({prop:l,updateTrigger:u})=>{if(u){let h=r[u];typeof h=="object"&&!Array.isArray(h)?Object.assign(i[o],h):h!==void 0&&(i[o][l]=h)}else i[o][l]=e[l]})})}return i}getSortedBins(e){for(let r in this.dimensionUpdaters)this.getDimensionSortedBins(e,this.dimensionUpdaters[r])}getDimensionSortedBins(e,r){let{key:i}=r,{getValue:n}=this.state.dimensions[i],o=new Dd(this.state.layerData.data||[],{getValue:n,filterData:e._filterData});this.setDimensionState(i,{sortedBins:o}),this.getDimensionValueDomain(e,r)}getDimensionValueDomain(e,r){let{getDomain:i,key:n}=r,{triggers:{lowerPercentile:o,upperPercentile:s,scaleType:l}}=i,u=this.state.dimensions[n].sortedBins.getValueDomainByScale(e[l.prop],[e[o.prop],e[s.prop]]);this.setDimensionState(n,{valueDomain:u}),this.getDimensionScale(e,r)}getDimensionScale(e,r){let{key:i,getScaleFunc:n,getDomain:o}=r,{domain:s,range:l}=n.triggers,{scaleType:u}=o.triggers,{onSet:h}=n,v=e[l.prop],T=e[s.prop]||this.state.dimensions[i].valueDomain,M=Nj(u&&e[u.prop])(T,v);typeof h=="object"&&typeof e[h.props]=="function"&&e[h.props](M.domain()),this.setDimensionState(i,{scaleFunc:M})}getSubLayerDimensionAttribute(e,r){return i=>{let{sortedBins:n,scaleFunc:o}=this.state.dimensions[e],s=n.binMap[i.index];if(s&&s.counts===0)return r;let l=s&&s.value,u=o.domain();return l>=u[0]&&l<=u[u.length-1]?o(l):r}}getSubLayerAccessors(e){let r={};for(let i in this.dimensionUpdaters){let{accessor:n}=this.dimensionUpdaters[i];r[n]=this.getSubLayerDimensionAttribute(e,i)}return r}getPickingInfo({info:e}){let r=e.picked&&e.index>-1,i=null;if(r){let n=this.state.layerData.data[e.index],o={};for(let s in this.dimensionUpdaters){let{pickingInfo:l}=this.dimensionUpdaters[s],{sortedBins:u}=this.state.dimensions[s],h=u.binMap[n.index]&&u.binMap[n.index].value;o[l]=h}i=Object.assign(o,n,{points:n.filteredPoints||n.points})}return e.picked=Boolean(i),e.object=i,e}getAccessor(e){return this.dimensionUpdaters.hasOwnProperty(e)?this.dimensionUpdaters[e].attributeAccessor:Wj}};function Yj(){}var CAe={colorDomain:null,colorRange:ju,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:Yj,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Yj,gridAggregator:C_,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:t=>t.position},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},SS=class extends $c{initializeState(){let e=new Fd({getAggregator:i=>i.gridAggregator,getCellSize:i=>i.cellSize});this.state={cpuAggregator:e,aggregatorState:e.state},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(e){super.updateState(e),this.setState({aggregatorState:this.state.cpuAggregator.updateState(e,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})}getPickingInfo({info:e}){return this.state.cpuAggregator.getPickingInfo({info:e})}_onGetSublayerColor(e){return this.state.cpuAggregator.getAccessor("fillColor")(e)}_onGetSublayerElevation(e){return this.state.cpuAggregator.getAccessor("elevation")(e)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:e,extruded:r,cellSize:i,coverage:n,material:o,transitions:s}=this.props,{cpuAggregator:l}=this.state,u=this.getSubLayerClass("grid-cell",qm),h=this._getSublayerUpdateTriggers();return new u({cellSize:i,coverage:n,material:o,elevationScale:e,extruded:r,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:s&&{getFillColor:s.getColorValue||s.getColorWeight,getElevation:s.getElevationValue||s.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:h}),{data:l.state.layerData.data})}},Jp=SS;(()=>{SS.layerName="CPUGridLayer"})(),(()=>{SS.defaultProps=CAe})();var M_=Math.PI/3,MAe=[0,M_,2*M_,3*M_,4*M_,5*M_];function IAe(t){return t[0]}function PAe(t){return t[1]}function $O(){var t=0,e=0,r=1,i=1,n=IAe,o=PAe,s,l,u;function h(T){var E={},M=[],O,F=T.length;for(O=0;O<F;++O)if(!(isNaN(W=+n.call(null,z=T[O],O,T))||isNaN(J=+o.call(null,z,O,T)))){var z,W,J,K=Math.round(J=J/u),ne=Math.round(W=W/l-(K&1)/2),ge=J-K;if(Math.abs(ge)*3>1){var j=W-ne,me=ne+(W<ne?-1:1)/2,fe=K+(J<K?-1:1),$=W-me,Z=J-fe;j*j+ge*ge>$*$+Z*Z&&(ne=me+(K&1?1:-1)/2,K=fe)}var we=ne+"-"+K,Oe=E[we];Oe?Oe.push(z):(M.push(Oe=E[we]=[z]),Oe.x=(ne+(K&1)/2)*l,Oe.y=K*u)}return M}function v(T){var E=0,M=0;return MAe.map(function(O){var F=Math.sin(O)*T,z=-Math.cos(O)*T,W=F-E,J=z-M;return E=F,M=z,[W,J]})}return h.hexagon=function(T){return"m"+v(T==null?s:+T).join("l")+"z"},h.centers=function(){for(var T=[],E=Math.round(e/u),M=Math.round(t/l),O=E*u;O<i+s;O+=u,++E)for(var F=M*l+(E&1)*l/2;F<r+l/2;F+=l)T.push([F,O]);return T},h.mesh=function(){var T=v(s).slice(0,4).join("l");return h.centers().map(function(E){return"M"+E+"m"+T}).join("")},h.x=function(T){return arguments.length?(n=T,h):n},h.y=function(T){return arguments.length?(o=T,h):o},h.radius=function(T){return arguments.length?(s=+T,l=s*2*Math.sin(M_),u=s*1.5,h):s},h.size=function(T){return arguments.length?(t=e=0,r=+T[0],i=+T[1],h):[r-t,i-e]},h.extent=function(T){return arguments.length?(t=+T[0][0],e=+T[0][1],r=+T[1][0],i=+T[1][1],h):[[t,e],[r,i]]},h.radius(1)}function Kj(t,e){let{data:r,radius:i}=t,{viewport:n,attributes:o}=e,s=r.length?RAe(r,e):null,l=BAe(i,n,s),u=[],{iterable:h,objectInfo:v}=Js(r),T=o.positions.value,{size:E}=o.positions.getAccessor();for(let F of h){v.index++;let z=v.index*E,W=[T[z],T[z+1]];Number.isFinite(W[0])&&Number.isFinite(W[1])?u.push({screenCoord:n.projectFlat(W),source:F,index:v.index}):ur.warn("HexagonLayer: invalid position")()}return{hexagons:$O().radius(l).x(F=>F.screenCoord[0]).y(F=>F.screenCoord[1])(u).map((F,z)=>({position:n.unprojectFlat([F.x,F.y]),points:F,index:z})),radiusCommon:l}}function RAe(t,e){let{attributes:r}=e,i=r.positions.value,{size:n}=r.positions.getAccessor(),o=1/0,s=1/0,l=-1/0,u=-1/0,h;for(h=0;h<n*t.length;h+=n){let v=i[h],T=i[h+1];Number.isFinite(v)&&Number.isFinite(T)&&(o=Math.min(v,o),l=Math.max(v,l),s=Math.min(T,s),u=Math.max(T,u))}return[o,s,l,u].every(Number.isFinite)?[(o+l)/2,(s+u)/2]:null}function BAe(t,e,r){let{unitsPerMeter:i}=e.getDistanceScales(r);return t*i[0]}function Zj(){}var OAe={colorDomain:null,colorRange:ju,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:Zj,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Zj,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:Kj,getPosition:{type:"accessor",value:t=>t.position},material:!0,_filterData:{type:"function",value:null,optional:!0}},CS=class extends $c{initializeState(){let e=new Fd({getAggregator:i=>i.hexagonAggregator,getCellSize:i=>i.radius});this.state={cpuAggregator:e,aggregatorState:e.state,vertices:null},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(e){if(super.updateState(e),e.changeFlags.propsOrDataChanged){let r=this.state.cpuAggregator.updateState(e,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==r.layerData){let{hexagonVertices:i}=r.layerData||{};this.setState({vertices:i&&this.convertLatLngToMeterOffset(i)})}this.setState({aggregatorState:r})}}convertLatLngToMeterOffset(e){let{viewport:r}=this.context;if(Array.isArray(e)&&e.length===6){let i=e[0],n=e[3],o=[(i[0]+n[0])/2,(i[1]+n[1])/2],s=r.projectFlat(o),{metersPerUnit:l}=r.getDistanceScales(o);return e.map(h=>{let v=r.projectFlat(h);return[(v[0]-s[0])*l[0],(v[1]-s[1])*l[1]]})}return ur.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}getPickingInfo({info:e}){return this.state.cpuAggregator.getPickingInfo({info:e})}_onGetSublayerColor(e){return this.state.cpuAggregator.getAccessor("fillColor")(e)}_onGetSublayerElevation(e){return this.state.cpuAggregator.getAccessor("elevation")(e)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:e,extruded:r,coverage:i,material:n,transitions:o}=this.props,{aggregatorState:s,vertices:l}=this.state,u=this.getSubLayerClass("hexagon-cell",If),h=this._getSublayerUpdateTriggers(),v=l?{vertices:l,radius:1}:{radius:s.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new u({...v,diskResolution:6,elevationScale:e,extruded:r,coverage:i,material:n,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:o&&{getFillColor:o.getColorValue||o.getColorWeight,getElevation:o.getElevationValue||o.getElevationWeight}},this.getSubLayerProps({id:"hexagon-cell",updateTriggers:h}),{data:s.layerData.data})}},nb=CS;(()=>{CS.layerName="HexagonLayer"})(),(()=>{CS.defaultProps=OAe})();var ri=.16666666666666666,Dt={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},I_=[Dt.W,Dt.SW,Dt.S],P_=[Dt.S,Dt.SE,Dt.E],R_=[Dt.E,Dt.NE,Dt.N],B_=[Dt.NW,Dt.W,Dt.N],O_=[[-.5,ri],[-.5,-ri],[-ri,-.5],[ri,-.5]],D_=[[-ri,-.5],[ri,-.5],[.5,-ri],[.5,ri]],L_=[[.5,-ri],[.5,ri],[ri,.5],[-ri,.5]],F_=[[-.5,ri],[-.5,-ri],[ri,.5],[-ri,.5]],Jj=[Dt.W,Dt.SW,Dt.SE,Dt.E],Qj=[Dt.S,Dt.SE,Dt.NE,Dt.N],$j=[Dt.NW,Dt.W,Dt.E,Dt.NE],e7=[Dt.NW,Dt.SW,Dt.S,Dt.N],t7=[[-.5,ri],[-.5,-ri],[.5,-ri],[.5,ri]],r7=[[-ri,-.5],[ri,-.5],[ri,.5],[-ri,.5]],DAe=[Dt.NW,Dt.SW,Dt.SE,Dt.NE],i7=[Dt.NW,Dt.SW,Dt.SE,Dt.E,Dt.N],n7=[Dt.W,Dt.SW,Dt.SE,Dt.NE,Dt.N],o7=[Dt.NW,Dt.W,Dt.S,Dt.SE,Dt.NE],s7=[Dt.NW,Dt.SW,Dt.S,Dt.E,Dt.NE],a7=[Dt.NW,Dt.W,[.5,-ri],[.5,ri],Dt.N],l7=[[-ri,-.5],[ri,-.5],Dt.E,Dt.NE,Dt.N],c7=[[-.5,ri],[-.5,-ri],Dt.S,Dt.SE,Dt.E],u7=[Dt.W,Dt.SW,Dt.S,[ri,.5],[-ri,.5]],f7=[Dt.NW,Dt.W,[-ri,-.5],[ri,-.5],Dt.N],h7=[[-.5,ri],[-.5,-ri],Dt.E,Dt.NE,Dt.N],d7=[Dt.S,Dt.SE,Dt.E,[ri,.5],[-ri,.5]],p7=[Dt.W,Dt.SW,Dt.S,[.5,-ri],[.5,ri]],A7=[Dt.W,Dt.SW,Dt.SE,Dt.E,[ri,.5],[-ri,.5]],m7=[[-.5,ri],[-.5,-ri],Dt.S,Dt.SE,Dt.NE,Dt.N],g7=[Dt.NW,Dt.W,[-ri,-.5],[ri,-.5],Dt.E,Dt.NE],_7=[Dt.NW,Dt.SW,Dt.S,[.5,-ri],[.5,ri],Dt.N],N_=[Dt.W,Dt.SW,Dt.S,Dt.E,Dt.NE,Dt.N],k_=[Dt.NW,Dt.W,Dt.S,Dt.SE,Dt.E,Dt.N],MS=[[-.5,ri],[-.5,-ri],[-ri,-.5],[ri,-.5],Dt.E,Dt.NE,Dt.N],IS=[Dt.W,Dt.SW,Dt.S,[.5,-ri],[.5,ri],[ri,.5],[-ri,.5]],PS=[Dt.NW,Dt.W,[-ri,-.5],[ri,-.5],[.5,-ri],[.5,ri],Dt.N],RS=[[-.5,ri],[-.5,-ri],Dt.S,Dt.SE,Dt.E,[ri,.5],[-ri,.5]],y7=[[-.5,ri],[-.5,-ri],[-ri,-.5],[ri,-.5],[.5,-ri],[.5,ri],[ri,.5],[-ri,.5]],v7={0:[],1:[[Dt.W,Dt.S]],2:[[Dt.S,Dt.E]],3:[[Dt.W,Dt.E]],4:[[Dt.N,Dt.E]],5:{0:[[Dt.W,Dt.S],[Dt.N,Dt.E]],1:[[Dt.W,Dt.N],[Dt.S,Dt.E]]},6:[[Dt.N,Dt.S]],7:[[Dt.W,Dt.N]],8:[[Dt.W,Dt.N]],9:[[Dt.N,Dt.S]],10:{0:[[Dt.W,Dt.N],[Dt.S,Dt.E]],1:[[Dt.W,Dt.S],[Dt.N,Dt.E]]},11:[[Dt.N,Dt.E]],12:[[Dt.W,Dt.E]],13:[[Dt.S,Dt.E]],14:[[Dt.W,Dt.S]],15:[]};function Hr(t){return parseInt(t,4)}var x7={[Hr("0000")]:[],[Hr("2222")]:[],[Hr("2221")]:[I_],[Hr("2212")]:[P_],[Hr("2122")]:[R_],[Hr("1222")]:[B_],[Hr("0001")]:[I_],[Hr("0010")]:[P_],[Hr("0100")]:[R_],[Hr("1000")]:[B_],[Hr("2220")]:[O_],[Hr("2202")]:[D_],[Hr("2022")]:[L_],[Hr("0222")]:[F_],[Hr("0002")]:[O_],[Hr("0020")]:[D_],[Hr("0200")]:[L_],[Hr("2000")]:[F_],[Hr("0011")]:[Jj],[Hr("0110")]:[Qj],[Hr("1100")]:[$j],[Hr("1001")]:[e7],[Hr("2211")]:[Jj],[Hr("2112")]:[Qj],[Hr("1122")]:[$j],[Hr("1221")]:[e7],[Hr("2200")]:[t7],[Hr("2002")]:[r7],[Hr("0022")]:[t7],[Hr("0220")]:[r7],[Hr("1111")]:[DAe],[Hr("1211")]:[i7],[Hr("2111")]:[n7],[Hr("1112")]:[o7],[Hr("1121")]:[s7],[Hr("1011")]:[i7],[Hr("0111")]:[n7],[Hr("1110")]:[o7],[Hr("1101")]:[s7],[Hr("1200")]:[a7],[Hr("0120")]:[l7],[Hr("0012")]:[c7],[Hr("2001")]:[u7],[Hr("1022")]:[a7],[Hr("2102")]:[l7],[Hr("2210")]:[c7],[Hr("0221")]:[u7],[Hr("1002")]:[f7],[Hr("2100")]:[h7],[Hr("0210")]:[d7],[Hr("0021")]:[p7],[Hr("1220")]:[f7],[Hr("0122")]:[h7],[Hr("2012")]:[d7],[Hr("2201")]:[p7],[Hr("0211")]:[A7],[Hr("2110")]:[m7],[Hr("1102")]:[g7],[Hr("1021")]:[_7],[Hr("2011")]:[A7],[Hr("0112")]:[m7],[Hr("1120")]:[g7],[Hr("1201")]:[_7],[Hr("2101")]:[N_],[Hr("0121")]:[N_],[Hr("1012")]:[k_],[Hr("1210")]:[k_],[Hr("0101")]:{0:[I_,R_],1:[N_],2:[N_]},[Hr("1010")]:{0:[B_,P_],1:[k_],2:[k_]},[Hr("2121")]:{0:[N_],1:[N_],2:[I_,R_]},[Hr("1212")]:{0:[k_],1:[k_],2:[B_,P_]},[Hr("2120")]:{0:[MS],1:[MS],2:[O_,R_]},[Hr("2021")]:{0:[IS],1:[IS],2:[I_,L_]},[Hr("1202")]:{0:[PS],1:[PS],2:[B_,D_]},[Hr("0212")]:{0:[RS],1:[RS],2:[P_,F_]},[Hr("0102")]:{0:[O_,R_],1:[MS],2:[MS]},[Hr("0201")]:{0:[I_,L_],1:[IS],2:[IS]},[Hr("1020")]:{0:[B_,D_],1:[PS],2:[PS]},[Hr("2010")]:{0:[P_,F_],1:[RS],2:[RS]},[Hr("2020")]:{0:[F_,D_],1:[y7],2:[O_,L_]},[Hr("0202")]:{0:[L_,O_],1:[y7],2:[F_,D_]}};var Qm={ISO_LINES:1,ISO_BANDS:2},LAe={zIndex:0,zOffset:.005};function ob(t,e){return Array.isArray(e)?t<e[0]?0:t<e[1]?1:2:t>=e?1:0}function b7(t){let{cellWeights:e,x:r,y:i,width:n,height:o}=t,s=t.threshold;t.thresholdValue&&(ur.deprecated("thresholdValue","threshold")(),s=t.thresholdValue);let l=r<0,u=r>=n-1,h=i<0,v=i>=o-1,T=l||u||h||v,E={},M={};l||v?M.top=0:(E.top=e[(i+1)*n+r],M.top=ob(E.top,s)),u||v?M.topRight=0:(E.topRight=e[(i+1)*n+r+1],M.topRight=ob(E.topRight,s)),u||h?M.right=0:(E.right=e[i*n+r+1],M.right=ob(E.right,s)),l||h?M.current=0:(E.current=e[i*n+r],M.current=ob(E.current,s));let{top:O,topRight:F,right:z,current:W}=M,J=-1;Number.isFinite(s)&&(J=O<<3|F<<2|z<<1|W),Array.isArray(s)&&(J=O<<6|F<<4|z<<2|W);let K=0;return T||(K=ob((E.top+E.topRight+E.right+E.current)/4,s)),{code:J,meanCode:K}}function eD(t){let{gridOrigin:e,cellSize:r,x:i,y:n,code:o,meanCode:s,type:l=Qm.ISO_LINES}=t,u={...LAe,...t.thresholdData},h=l===Qm.ISO_BANDS?x7[o]:v7[o];Array.isArray(h)||(h=h[s]);let v=u.zIndex*u.zOffset,T=(i+1)*r[0],E=(n+1)*r[1],M=e[0]+T,O=e[1]+E;if(l===Qm.ISO_BANDS){let z=[];return h.forEach(W=>{let J=[];W.forEach(K=>{let ne=M+K[0]*r[0],ge=O+K[1]*r[1];J.push([ne,ge,v])}),z.push(J)}),z}let F=[];return h.forEach(z=>{z.forEach(W=>{let J=M+W[0]*r[0],K=O+W[1]*r[1];F.push([J,K,v])})}),F}function w7({thresholdData:t,cellWeights:e,gridSize:r,gridOrigin:i,cellSize:n}){let o=[],s=[],l=r[0],u=r[1],h=0,v=0;for(let T of t){let{contour:E}=T,{threshold:M}=E;for(let O=-1;O<l;O++)for(let F=-1;F<u;F++){let{code:z,meanCode:W}=b7({cellWeights:e,threshold:M,x:O,y:F,width:l,height:u}),J={type:Qm.ISO_BANDS,gridOrigin:i,cellSize:n,x:O,y:F,width:l,height:u,code:z,meanCode:W,thresholdData:T};if(Array.isArray(M)){J.type=Qm.ISO_BANDS;let K=eD(J);for(let ne of K)s[v++]={vertices:ne,contour:E}}else{J.type=Qm.ISO_LINES;let K=eD(J);for(let ne=0;ne<K.length;ne+=2)o[h++]={start:K[ne],end:K[ne+1],contour:E}}}}return{contourSegments:o,contourPolygons:s}}var T7=[255,255,255,255],FAe=1,NAe=1,kAe={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM",contours:{type:"object",value:[{threshold:NAe}],optional:!0,compare:3},zOffset:.005},E7="positions",UAe={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},BS=class extends Ld{initializeState(){super.initializeAggregationLayer({dimensions:UAe}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:Wo.SUM}}}),this.getAttributeManager().add({[E7]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}updateState(e){super.updateState(e);let r=!1,{oldProps:i,props:n}=e,{aggregationDirty:o}=this.state;(i.contours!==n.contours||i.zOffset!==n.zOffset)&&(r=!0,this._updateThresholdData(e.props)),this.getNumInstances()>0&&(o||r)&&this._generateContours()}renderLayers(){let{contourSegments:e,contourPolygons:r}=this.state.contourData,i=this.getSubLayerClass("lines",Vm),n=this.getSubLayerClass("bands",Rf),o=e&&e.length>0&&new i(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:l=>l.start,getTargetPosition:l=>l.end,getColor:l=>l.contour.color||T7,getWidth:l=>l.contour.strokeWidth||FAe}),s=r&&r.length>0&&new n(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:l=>l.vertices,getFillColor:l=>l.contour.color||T7});return[o,s]}updateAggregationState(e){let{props:r,oldProps:i}=e,{cellSize:n,coordinateSystem:o}=r,{viewport:s}=this.context,l=i.cellSize!==n,u=r.gpuAggregation;this.state.gpuAggregation!==r.gpuAggregation&&u&&!Fa.isSupported(this.context.device)&&(ur.warn("GPU Grid Aggregation not supported, falling back to CPU")(),u=!1);let h=u!==this.state.gpuAggregation;this.setState({gpuAggregation:u});let{dimensions:v}=this.state,T=this.isAttributeChanged(E7),{data:E,weights:M}=v,{boundingBox:O}=this.state;if(T&&(O=wS(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:O})),T||l){let{gridOffset:W,translation:J,width:K,height:ne,numCol:ge,numRow:j}=TS(O,n,s,o);this.allocateResources(j,ge),this.setState({gridOffset:W,boundingBox:O,translation:J,posOffset:J.slice(),gridOrigin:[-1*J[0],-1*J[1]],width:K,height:ne,numCol:ge,numRow:j})}let F=T||h||this.isAggregationDirty(e,{dimension:E,compareAll:u}),z=this.isAggregationDirty(e,{dimension:M});z&&this._updateAccessors(e),(F||z)&&this._resetResults(),this.setState({aggregationDataDirty:F,aggregationWeightsDirty:z})}_updateAccessors(e){let{getWeight:r,aggregation:i,data:n}=e.props,{count:o}=this.state.weights;o&&(o.getWeight=r,o.operation=Wo[i]),this.setState({getValue:T_(i,r,{data:n})})}_resetResults(){let{count:e}=this.state.weights;e&&(e.aggregationData=null)}_generateContours(){let{numCol:e,numRow:r,gridOrigin:i,gridOffset:n,thresholdData:o}=this.state,{count:s}=this.state.weights,{aggregationData:l}=s;l||(l=s.aggregationBuffer.readSyncWebGL(),s.aggregationData=l);let{cellWeights:u}=Fa.getCellData({countsData:l}),h=w7({thresholdData:o,cellWeights:u,gridSize:[e,r],gridOrigin:i,cellSize:[n.xOffset,n.yOffset]});this.setState({contourData:h})}_updateThresholdData(e){let{contours:r,zOffset:i}=e,n=r.length,o=new Array(n);for(let s=0;s<n;s++){let l=r[s];o[s]={contour:l,zIndex:l.zIndex||s,zOffset:i}}this.setState({thresholdData:o})}},sb=BS;(()=>{BS.layerName="ContourLayer"})(),(()=>{BS.defaultProps=kAe})();var S7=`#version 300 es
#define SHADER_NAME gpu-grid-cell-layer-vertex-shader
#define RANGE_COUNT 6
in vec3 positions;
in vec3 normals;
in vec4 colors;
in vec4 elevations;
in vec3 instancePickingColors;
uniform vec2 offset;
uniform bool extruded;
uniform float cellSize;
uniform float coverage;
uniform float opacity;
uniform float elevationScale;
uniform ivec2 gridSize;
uniform vec2 gridOrigin;
uniform vec2 gridOriginLow;
uniform vec2 gridOffset;
uniform vec2 gridOffsetLow;
uniform vec4 colorRange[RANGE_COUNT];
uniform vec2 elevationRange;
uniform vec2 colorDomain;
uniform bool colorDomainValid;
uniform vec2 elevationDomain;
uniform bool elevationDomainValid;
layout(std140) uniform;
uniform ColorData
{
vec4 maxMinCount;
} colorData;
uniform ElevationData
{
vec4 maxMinCount;
} elevationData;
#define EPSILON 0.00001
out vec4 vColor;
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
vec4 outColor = vec4(0., 0., 0., 0.);
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
float domainRange = domain.y - domain.x;
if (domainRange <= 0.) {
outColor = colorRange[0];
} else {
float rangeCount = float(RANGE_COUNT);
float rangeStep = domainRange / rangeCount;
float idx = floor((value - domain.x) / rangeStep);
idx = clamp(idx, 0., rangeCount - 1.);
int intIdx = int(idx);
outColor = colorRange[intIdx];
}
}
return outColor;
}
float linearScale(vec2 domain, vec2 range, float value) {
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
}
return -1.;
}
void main(void) {
vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
float elevation = 0.0;
if (extruded) {
vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
elevation = linearScale(elvDomain, elevationRange, elevations.r);
elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
}
float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
float dotRadius = cellSize / 2. * coverage * shouldRender;
int yIndex = (gl_InstanceID / gridSize[0]);
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
geometry.worldPosition = centroidPosition;
vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
picking_setPickingColor(instancePickingColors);
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
vec3 normals_commonspace = project_normal(normals);
if (extruded) {
vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, normals_commonspace);
vColor = vec4(lightColor, color.a * opacity) / 255.;
} else {
vColor = vec4(color.rgb, color.a * opacity) / 255.;
}
}
`;var C7=`#version 300 es
#define SHADER_NAME gpu-grid-cell-layer-fragment-shader
precision highp float;
in vec4 vColor;
out vec4 fragColor;
void main(void) {
fragColor = vColor;
fragColor = picking_filterColor(fragColor);
}
`;var tD=0,rD=1,zAe={colorDomain:null,colorRange:ju,elevationDomain:null,elevationRange:[0,1e3],elevationScale:{type:"number",min:0,value:1},gridSize:{type:"array",value:[1,1]},gridOrigin:{type:"array",value:[0,0]},gridOffset:{type:"array",value:[0,0]},cellSize:{type:"number",min:0,max:1e3,value:1e3},offset:{type:"array",value:[1,1]},coverage:{type:"number",min:0,max:1,value:1},extruded:!0,material:!0},OS=class extends On{getShaders(){return super.getShaders({vs:S7,fs:C7,modules:[Jn,Fu,go,Dp]})}initializeState(){this.getAttributeManager().addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});let r=this._getModel();this._setupUniformBuffer(r),this.setState({model:r})}_getModel(){return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,geometry:new xd,isInstanced:!0})}draw({uniforms:e}){let{cellSize:r,offset:i,extruded:n,elevationScale:o,coverage:s,gridSize:l,gridOrigin:u,gridOffset:h,elevationRange:v,colorMaxMinBuffer:T,elevationMaxMinBuffer:E}=this.props,M=this.state.model,O=[Vp(u[0]),Vp(u[1])],F=[Vp(h[0]),Vp(h[1])],z=this.getDomainUniforms(),W=Zp(this.props.colorRange);this.bindUniformBuffers(T,E),M.setUniforms(e),M.setUniforms(z),M.setUniforms({cellSize:r,offset:i,extruded:n,elevationScale:o,coverage:s,gridSize:l,gridOrigin:u,gridOriginLow:O,gridOffset:h,gridOffsetLow:F,colorRange:W,elevationRange:v}),M.draw(this.context.renderPass),this.unbindUniformBuffers(T,E)}bindUniformBuffers(e,r){e.bind({target:35345,index:tD}),r.bind({target:35345,index:rD})}unbindUniformBuffers(e,r){e.unbind({target:35345,index:tD}),r.unbind({target:35345,index:rD})}getDomainUniforms(){let{colorDomain:e,elevationDomain:r}=this.props,i={};return e!==null?(i.colorDomainValid=!0,i.colorDomain=e):i.colorDomainValid=!1,r!==null?(i.elevationDomainValid=!0,i.elevationDomain=r):i.elevationDomainValid=!1,i}_setupUniformBuffer(e){let r=e.pipeline.handle,i=this.context.gl,n=i.getUniformBlockIndex(r,"ColorData"),o=i.getUniformBlockIndex(r,"ElevationData");i.uniformBlockBinding(r,n,tD),i.uniformBlockBinding(r,o,rD)}},ab=OS;(()=>{OS.layerName="GPUGridCellLayer"})(),(()=>{OS.defaultProps=zAe})();var VAe={colorDomain:null,colorRange:ju,getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",elevationDomain:null,elevationRange:[0,1e3],getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},cellSize:{type:"number",min:1,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:t=>t.position},extruded:!1,material:!0},HAe={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},M7="positions",DS=class extends Ld{initializeState({device:e}){let r=Fa.isSupported(e);r||ur.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),super.initializeAggregationLayer({dimensions:HAe}),this.setState({gpuAggregation:!1,projectPoints:!1,isSupported:r,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:e.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:e.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"}),this.getAttributeManager().add({[M7]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},color:{size:3,accessor:"getColorWeight"},elevation:{size:3,accessor:"getElevationWeight"}})}updateState(e){if(this.state.isSupported===!1)return;super.updateState(e);let{aggregationDirty:r}=this.state;r&&this.setState({gridHash:null})}getHashKeyForIndex(e){let{numRow:r,numCol:i,boundingBox:n,gridOffset:o}=this.state,s=[i,r],l=[n.xMin,n.yMin],u=[o.xOffset,o.yOffset],h=Math.floor(e/s[0]),v=e-h*s[0],T=Math.floor((h*u[1]+l[1]+90+u[1]/2)/u[1]),E=Math.floor((v*u[0]+l[0]+180+u[0]/2)/u[0]);return`${T}-${E}`}getPositionForIndex(e){let{numRow:r,numCol:i,boundingBox:n,gridOffset:o}=this.state,s=[i,r],l=[n.xMin,n.yMin],u=[o.xOffset,o.yOffset],h=Math.floor(e/s[0]),v=e-h*s[0],T=h*u[1]+l[1];return[v*u[0]+l[0],T]}getPickingInfo({info:e,mode:r}){let{index:i}=e,n=null;if(i>=0){let o=this.state.gpuGridAggregator,s=this.getPositionForIndex(i),l=Fa.getAggregationData({pixelIndex:i,...o.getData("color")}),u=Fa.getAggregationData({pixelIndex:i,...o.getData("elevation")});if(n={colorValue:l.cellWeight,elevationValue:u.cellWeight,count:l.cellCount||u.cellCount,position:s,totalCount:l.totalCount||u.totalCount},r!=="hover"){let{props:h}=this,{gridHash:v}=this.state;if(!v){let{gridOffset:M,translation:O,boundingBox:F}=this.state,{viewport:z}=this.context,W=this.getAttributes();v=C_(h,{gridOffset:M,attributes:W,viewport:z,translation:O,boundingBox:F}).gridHash,this.setState({gridHash:v})}let T=this.getHashKeyForIndex(i),E=v[T];Object.assign(n,E)}}return e.picked=Boolean(n),e.object=n,e}renderLayers(){if(!this.state.isSupported)return null;let{elevationScale:e,extruded:r,cellSize:i,coverage:n,material:o,elevationRange:s,colorDomain:l,elevationDomain:u}=this.props,{weights:h,numRow:v,numCol:T,gridOrigin:E,gridOffset:M}=this.state,{color:O,elevation:F}=h,z=Zp(this.props.colorRange),W=this.getSubLayerClass("gpu-grid-cell",ab);return new W({gridSize:[T,v],gridOrigin:E,gridOffset:[M.xOffset,M.yOffset],colorRange:z,elevationRange:s,colorDomain:l,elevationDomain:u,cellSize:i,coverage:n,material:o,elevationScale:e,extruded:r},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:O.aggregationBuffer,elevations:F.aggregationBuffer}},colorMaxMinBuffer:O.maxMinBuffer,elevationMaxMinBuffer:F.maxMinBuffer,numInstances:T*v})}finalizeState(e){let{color:r,elevation:i}=this.state.weights;[r,i].forEach(n=>{let{aggregationBuffer:o,maxMinBuffer:s}=n;s?.destroy(),o?.destroy()}),super.finalizeState(e)}updateAggregationState(e){let{props:r,oldProps:i}=e,{cellSize:n,coordinateSystem:o}=r,{viewport:s}=this.context,l=i.cellSize!==n,{dimensions:u}=this.state,h=this.isAttributeChanged(M7),v=h||this.isAttributeChanged(),{boundingBox:T}=this.state;if(h&&(T=wS(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:T})),h||l){let{gridOffset:M,translation:O,width:F,height:z,numCol:W,numRow:J}=TS(T,n,s,o);this.allocateResources(J,W),this.setState({gridOffset:M,translation:O,gridOrigin:[-1*O[0],-1*O[1]],width:F,height:z,numCol:W,numRow:J})}let E=v||this.isAggregationDirty(e,{dimension:u.data,compareAll:!0});E&&this._updateAccessors(e),this.setState({aggregationDataDirty:E})}_updateAccessors(e){let{colorAggregation:r,elevationAggregation:i}=e.props,{color:n,elevation:o}=this.state.weights;n.operation=Wo[r],o.operation=Wo[i]}},Qp=DS;(()=>{DS.layerName="GPUGridLayer"})(),(()=>{DS.defaultProps=VAe})();var jAe={...Qp.defaultProps,...Jp.defaultProps,gpuAggregation:!1},LS=class extends es{initializeState(){this.state={useGPUAggregation:!1}}updateState({props:e}){this.setState({useGPUAggregation:!1})}renderLayers(){let{data:e,updateTriggers:r}=this.props,i=this.state.useGPUAggregation?"GPU":"CPU",n=this.state.useGPUAggregation?this.getSubLayerClass("GPU",Qp):this.getSubLayerClass("CPU",Jp);return new n(this.props,this.getSubLayerProps({id:i,updateTriggers:r}),{data:e})}canUseGPUAggregation(e){let{gpuAggregation:r,lowerPercentile:i,upperPercentile:n,getColorValue:o,getElevationValue:s,colorScaleType:l}=e;return!(!r||!Fa.isSupported(this.context.device)||i!==0||n!==100||o!==null||s!==null||l==="quantile"||l==="ordinal")}},lb=LS;(()=>{LS.layerName="GridLayer"})(),(()=>{LS.defaultProps=jAe})();function P7(t){let e=t.map(l=>l[0]),r=t.map(l=>l[1]),i=Math.min.apply(null,e),n=Math.max.apply(null,e),o=Math.min.apply(null,r),s=Math.max.apply(null,r);return[i,o,n,s]}function R7(t,e){return e[0]>=t[0]&&e[2]<=t[2]&&e[1]>=t[1]&&e[3]<=t[3]}var I7=new Float32Array(12);function iD(t,e=2){let r=0;for(let i of t)for(let n=0;n<e;n++)I7[r++]=i[n]||0;return I7}function B7(t,e,r){let[i,n,o,s]=t,l=o-i,u=s-n,h=l,v=u;l/u<e/r?h=e/r*u:v=r/e*l,h<e&&(h=e,v=r);let T=(o+i)/2,E=(s+n)/2;return[T-h/2,E-v/2,T+h/2,E+v/2]}function O7(t,e){let[r,i,n,o]=e;return[(t[0]-r)/(n-r),(t[1]-i)/(o-i)]}var D7=`#version 300 es
#define SHADER_NAME heatp-map-layer-vertex-shader
uniform sampler2D maxTexture;
uniform float intensity;
uniform vec2 colorDomain;
uniform float threshold;
uniform float aggregationMode;
in vec3 positions;
in vec2 texCoords;
out vec2 vTexCoords;
out float vIntensityMin;
out float vIntensityMax;
void main(void) {
gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
vTexCoords = texCoords;
vec4 maxTexture = texture(maxTexture, vec2(0.5));
float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
float minValue = maxValue * threshold;
if (colorDomain[1] > 0.) {
maxValue = colorDomain[1];
minValue = colorDomain[0];
}
vIntensityMax = intensity / maxValue;
vIntensityMin = intensity / minValue;
}
`;var L7=`#version 300 es
#define SHADER_NAME triangle-layer-fragment-shader
precision highp float;
uniform float opacity;
uniform sampler2D weightsTexture;
uniform sampler2D colorTexture;
uniform float aggregationMode;
in vec2 vTexCoords;
in float vIntensityMin;
in float vIntensityMax;
out vec4 fragColor;
vec4 getLinearColor(float value) {
float factor = clamp(value * vIntensityMax, 0., 1.);
vec4 color = texture(colorTexture, vec2(factor, 0.5));
color.a *= min(value * vIntensityMin, 1.0);
return color;
}
void main(void) {
vec4 weights = texture(weightsTexture, vTexCoords);
float weight = weights.r;
if (aggregationMode > 0.5) {
weight /= max(1.0, weights.a);
}
if (weight <= 0.) {
discard;
}
vec4 linearColor = getLinearColor(weight);
linearColor.a *= opacity;
fragColor = linearColor;
}
`;var nD=class extends On{getShaders(){return{vs:D7,fs:L7,modules:[Jn]}}initializeState({device:e}){this.setState({model:this._getModel(e)})}_getModel(e){let{vertexCount:r,data:i,weightsTexture:n,maxTexture:o,colorTexture:s}=this.props;return new Ni(e,{...this.getShaders(),id:this.props.id,bindings:{weightsTexture:n,maxTexture:o,colorTexture:s},attributes:i.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-strip",vertexCount:r})}draw({uniforms:e}){let{model:r}=this.state,{intensity:i,threshold:n,aggregationMode:o,colorDomain:s}=this.props;r.setUniforms({...e,intensity:i,threshold:n,aggregationMode:o,colorDomain:s}),r.draw(this.context.renderPass)}},cb=nD;(()=>{nD.layerName="TriangleLayer"})();var oD=`#version 300 es
in vec3 positions;
in vec3 positions64Low;
in float weights;
out vec4 weightsTexture;
uniform float radiusPixels;
uniform float textureWidth;
uniform vec4 commonBounds;
uniform float weightsScale;
void main()
{
weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
gl_PointSize = radiusTexels * 2.;
vec3 commonPosition = project_position(positions, positions64Low);
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
gl_Position.w = 1.0;
}
`;var sD=`#version 300 es
in vec4 weightsTexture;
out vec4 fragColor;
float gaussianKDE(float u){
return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
}
void main()
{
float dist = length(gl_PointCoord - vec2(0.5, 0.5));
if (dist > 0.5) {
discard;
}
fragColor = weightsTexture * gaussianKDE(2. * dist);
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var F7=`#version 300 es
uniform sampler2D inTexture;
uniform float textureSize;
out vec4 outTexture;
void main()
{
int yIndex = gl_VertexID / int(textureSize);
int xIndex = gl_VertexID - (yIndex * int(textureSize));
vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
outTexture = texture(inTexture, uv);
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
gl_PointSize = 1.0;
}
`;var N7=`#version 300 es
in vec4 outTexture;
out vec4 fragColor;
void main() {
fragColor = outTexture;
fragColor.g = outTexture.r / max(1.0, outTexture.a);
}
`;var GAe=2,aD={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},k7=[0,0],WAe={SUM:0,MEAN:1},qAe={getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:ju,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},XAe=["float32-renderable-webgl","texture-blend-float-webgl"],YAe={data:{props:["radiusPixels"]}},FS=class extends $c{initializeState(){super.initializeAggregationLayer(YAe),this.setState({colorDomain:k7}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e),this._updateHeatmapState(e)}_updateHeatmapState(e){let{props:r,oldProps:i}=e,n=this._getChangeFlags(e);(n.dataChanged||n.viewportChanged)&&(n.boundsChanged=this._updateBounds(n.dataChanged),this._updateTextureRenderingBounds()),n.dataChanged||n.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):n.viewportZoomChanged&&this._debouncedUpdateWeightmap(),r.colorRange!==i.colorRange&&this._updateColorTexture(e),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:e.context.viewport.zoom})}renderLayers(){let{weightsTexture:e,triPositionBuffer:r,triTexCoordBuffer:i,maxWeightsTexture:n,colorTexture:o,colorDomain:s}=this.state,{updateTriggers:l,intensity:u,threshold:h,aggregation:v}=this.props,T=this.getSubLayerClass("triangle",cb);return new T(this.getSubLayerProps({id:"triangle-layer",updateTriggers:l}),{coordinateSystem:Zr.DEFAULT,data:{attributes:{positions:r,texCoords:i}},vertexCount:4,maxTexture:n,colorTexture:o,aggregationMode:WAe[v]||0,weightsTexture:e,intensity:u,threshold:h,colorDomain:s})}finalizeState(e){super.finalizeState(e);let{weightsTransform:r,weightsTexture:i,maxWeightTransform:n,maxWeightsTexture:o,triPositionBuffer:s,triTexCoordBuffer:l,colorTexture:u,updateTimer:h}=this.state;r?.destroy(),i?.destroy(),n?.destroy(),o?.destroy(),s?.destroy(),l?.destroy(),u?.destroy(),h&&clearTimeout(h)}_getAttributeManager(){return new Mf(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(e){let r={},{dimensions:i}=this.state;r.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(e,{compareAll:!0,dimension:i.data})&&"aggregation is dirty",r.viewportChanged=e.changeFlags.viewportChanged;let{zoom:n}=this.state;return(!e.context.viewport||e.context.viewport.zoom!==n)&&(r.viewportZoomChanged=!0),r}_createTextures(){let{textureSize:e,format:r}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...aD,width:e,height:e,format:r}),maxWeightsTexture:this.context.device.createTexture({...aD,width:1,height:1,format:r})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:e}=this.context,{weightsTextureSize:r}=this.props,i=Math.min(r,e.limits.maxTextureDimension2D),n=XAe.every(l=>e.features.has(l)),o=n?"rgba32float":"rgba8unorm",s=n?1:1/255;this.setState({textureSize:i,format:o,weightsScale:s}),n||ur.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(e){let{weightsTransform:r}=this.state,{weightsTexture:i}=this.state,n=this.getAttributeManager();r?.destroy(),r=new Mh(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:n.getBufferLayouts(),vertexCount:1,targetTexture:i,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...e}),this.setState({weightsTransform:r})}_setupResources(){this._createTextures();let{device:e}=this.context,{textureSize:r,weightsTexture:i,maxWeightsTexture:n}=this.state,o=this.getShaders({vs:oD,fs:sD});this._createWeightsTransform(o);let s=this.getShaders({vs:F7,fs:N7}),l=new Mh(e,{id:`${this.id}-max-weights-transform`,bindings:{inTexture:i},uniforms:{textureSize:r},targetTexture:n,...s,vertexCount:r*r,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}});this.setState({weightsTexture:i,maxWeightsTexture:n,maxWeightTransform:l,zoom:null,triPositionBuffer:e.createBuffer({byteLength:48}),triTexCoordBuffer:e.createBuffer({byteLength:48})})}updateShaders(e){this._createWeightsTransform({vs:oD,fs:sD,...e})}_updateMaxWeightValue(){let{maxWeightTransform:e}=this.state;e.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(e=!1){let{viewport:r}=this.context,i=[r.unproject([0,0]),r.unproject([r.width,0]),r.unproject([0,r.height]),r.unproject([r.width,r.height])].map(l=>l.map(Math.fround)),n=P7(i),o={visibleWorldBounds:n,viewportCorners:i},s=!1;if(e||!this.state.worldBounds||!R7(this.state.worldBounds,n)){let l=this._worldToCommonBounds(n),u=this._commonToWorldBounds(l);this.props.coordinateSystem===Zr.LNGLAT&&(u[1]=Math.max(u[1],-85.051129),u[3]=Math.min(u[3],85.051129),u[0]=Math.max(u[0],-360),u[2]=Math.min(u[2],360));let h=this._worldToCommonBounds(u);o.worldBounds=u,o.normalizedCommonBounds=h,s=!0}return this.setState(o),s}_updateTextureRenderingBounds(){let{triPositionBuffer:e,triTexCoordBuffer:r,normalizedCommonBounds:i,viewportCorners:n}=this.state,{viewport:o}=this.context;e.write(iD(n,3));let s=n.map(l=>O7(o.projectPosition(l),i));r.write(iD(s,2))}_updateColorTexture(e){let{colorRange:r}=e.props,{colorTexture:i}=this.state,n=Zp(r,!1,Uint8Array);i&&i?.width===r.length?i.setSubImageData({data:n}):(i?.destroy(),i=this.context.device.createTexture({...aD,data:n,width:r.length,height:1})),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:e,colorDomain:r,aggregation:i}=this.props,{worldBounds:n,textureSize:o,weightsScale:s}=this.state,l=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let u=this._worldToCommonBounds(n,{useLayerCoordinateSystem:!0});if(r&&i==="SUM"){let{viewport:F}=this.context,z=F.distanceScales.metersPerUnit[2]*(u[2]-u[0])/o;this.state.colorDomain=r.map(W=>W*z*s)}else this.state.colorDomain=r||k7;let v=this.getAttributeManager().getAttributes(),T=this.getModuleSettings(),E=v.positions.buffer,M={radiusPixels:e,commonBounds:u,textureWidth:o,weightsScale:s},O=v.weights.buffer;l.model.setAttributes({positions:E,weights:O}),l.model.setVertexCount(this.getNumInstances()),l.model.setUniforms(M),l.model.updateModuleSettings(T),l.run({parameters:{viewport:[0,0,o,o]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(e=!1){let{updateTimer:r}=this.state,{debounceTimeout:i}=this.props;e?(r=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(r),r=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),i)),this.setState({updateTimer:r})}_worldToCommonBounds(e,r={}){let{useLayerCoordinateSystem:i=!1}=r,[n,o,s,l]=e,{viewport:u}=this.context,{textureSize:h}=this.state,{coordinateSystem:v}=this.props,T=i&&(v===Zr.LNGLAT_OFFSETS||v===Zr.METER_OFFSETS),E=T?u.projectPosition(this.props.coordinateOrigin):[0,0],M=h*GAe/u.scale,O,F;return i&&!T?(O=this.projectPosition([n,o,0]),F=this.projectPosition([s,l,0])):(O=u.projectPosition([n,o,0]),F=u.projectPosition([s,l,0])),B7([O[0]-E[0],O[1]-E[1],F[0]-E[0],F[1]-E[1]],M,M)}_commonToWorldBounds(e){let[r,i,n,o]=e,{viewport:s}=this.context,l=s.unprojectPosition([r,i]),u=s.unprojectPosition([n,o]);return l.slice(0,2).concat(u.slice(0,2))}},ub=FS;(()=>{FS.layerName="HeatmapLayer"})(),(()=>{FS.defaultProps=qAe})();function KAe(t){return typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t}function NS(t){if(Array.isArray(t))return t.map(e=>NS(e));if(t&&typeof t=="object"){let e={};for(let[r,i]of Object.entries(t))e[KAe(r)]=NS(i);return e}return t}var gG=ga(mG(),1);function mD(t,e){if(e?._parser&&e._parser!=="fast-xml-parser")throw new Error(e?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:e?.removeNSPrefix,textNodeName:e?.textNodeName,isArray:(n,o,s,l)=>Boolean(e?.arrayPaths?.some(h=>o===h)),...e?._fastXML},i=nge(t,r);return e?.uncapitalizeKeys?NS(i):i}function nge(t,e){return new gG.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(t)}var oge="4.2.0-beta.2",Of={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:oge,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:sge,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(t,e)=>mD(new TextDecoder().decode(t),{...Of.options.xml,...e?.xml}),parseTextSync:(t,e)=>mD(t,{...Of.options.xml,...e?.xml})};function sge(t){return t.startsWith("<?xml")}function _G(t,e){let r=Of.parseTextSync?.(t,e),i=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof i=="string"?i:i.value||i.code||"Unknown error"}var age="4.2.0-beta.2",db={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:age,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:lge,options:{wms:{throwOnError:!1}},parse:async(t,e)=>gD(new TextDecoder().decode(t),e),parseSync:(t,e)=>gD(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>gD(t,e)};function lge(t){return t.startsWith("<?xml")}function gD(t,e){let r={...db.options.wms,...e?.wms},i=_G(t,r),n=r.minimalErrors?i:`WMS Service error: ${i}`;if(r.throwOnError)throw new Error(n);return n}function eg(t){return Array.isArray(t)?t:t?[t]:[]}function pb(t){let e=eg(t);return e.length>0&&e.every(r=>typeof r=="string")?e:[]}function Ab(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseFloat(t);default:return}}function US(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseInt(t,10);default:return}}function tg(t){switch(t){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function _D(t,e){let r=Of.parseTextSync?.(t,e),i=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,n=cge(i);if(e?.inheritedLayerProps)for(let o of n.layers)vG(o,null);return e?.includeRawJSON&&(n.json=i),e?.includeXMLText&&(n.xml=t),n}function cge(t){let e={version:String(t.version||""),name:String(t.Service?.Name||"unnamed"),title:t.Service?.Title?String(t.Service?.Title):void 0,abstract:t.Service?.Abstract?String(t.Service?.Abstract):void 0,keywords:pb(t.Service?.KeywordList?.Keyword),fees:t.Service?.Fees?JSON.stringify(t.Service?.Fees):void 0,accessConstraints:t.Service?.AccessConstraints?JSON.stringify(t.Service?.AccessConstraints):void 0,layerLimit:US(t.Service?.LayerLimit),maxWidth:US(t.Service?.maxWidth),maxHeight:US(t.Service?.maxHeight),layers:[],requests:uge(t.Capability?.Request),exceptions:fge(t.Exception)},r=eg(t.Capability?.Layer);for(let i of r)e.layers.push(yG(i));for(let[i,n]of Object.entries(e))n===void 0&&delete e[i];return e}function uge(t){let e={};for(let[r,i]of Object.entries(t||{})){let n=pb(i?.Format);e[r]={mimeTypes:n}}return e}function fge(t){if(eg(t?.Format).length>0)return{mimeTypes:pb(t)}}function yG(t){let e={title:String(t?.Title||""),name:t?.Name&&String(t?.Name),abstract:t?.Name&&String(t?.Abstract),keywords:pb(t.KeywordList?.Keyword)},r=t?.CRS||t?.SRS;r&&Array.isArray(r)&&r.every(h=>typeof h=="string")&&(e.crs=r);let i=t?.EX_GeographicBoundingBox&&hge(t?.EX_GeographicBoundingBox);i&&(e.geographicBoundingBox=i),i=t?.LatLonBoundingBox&&dge(t?.LatLonBoundingBox),i&&(e.geographicBoundingBox=i);let n=t?.BoundingBox&&pge(t?.BoundingBox);n&&n.length>0&&(e.boundingBoxes=n);let s=eg(t?.Dimension).map(h=>mge(h));s.length&&(e.dimensions=s),t?.opaque&&(e.opaque=tg(t?.opaque)),t?.cascaded&&(e.cascaded=tg(t?.cascaded)),t?.queryable&&(e.queryable=tg(t?.queryable));let l=eg(t?.Layer),u=[];for(let h of l)u.push(yG(h));u.length>0&&(e.layers=u);for(let[h,v]of Object.entries(e))v===void 0&&delete e[h];return e}function hge(t){let{westBoundLongitude:e,northBoundLatitude:r,eastBoundLongitude:i,southBoundLatitude:n}=t;return[[e,n],[i,r]]}function dge(t){let{minx:e,miny:r,maxx:i,maxy:n}=t;return[[e,r],[i,n]]}function pge(t){return eg(t).map(r=>Age(r))}function Age(t){let{CRS:e,SRS:r,minx:i,miny:n,maxx:o,maxy:s,resx:l,resy:u}=t,h={crs:e||r,boundingBox:[[Ab(i),Ab(n)],[Ab(o),Ab(s)]]};return l&&(h.xResolution=l),u&&(h.yResolution=u),h}function mge(t){let{name:e,units:r,value:i}=t,n={name:e,units:r,extent:i};return t.unitSymbol&&(n.unitSymbol=t.unitSymbol),t.default&&(n.defaultValue=t.default),t.multipleValues&&(n.multipleValues=tg(t.multipleValues)),t.nearestValue&&(n.nearestValue=tg(t.nearestValue)),t.current&&(n.current=tg(t.current)),n}function vG(t,e){e?.geographicBoundingBox&&!t.geographicBoundingBox&&(t.geographicBoundingBox=[...e.geographicBoundingBox]),e?.crs&&!t.crs&&(t.crs=[...e.crs]),e?.boundingBoxes&&!t.boundingBoxes&&(t.boundingBoxes=[...e.boundingBoxes]),e?.dimensions&&!t.dimensions&&(t.dimensions=[...e.dimensions]);for(let r of t.layers||[])vG(r,t)}var gge="4.2.0-beta.2",U_={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:gge,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:_ge,options:{wms:{}},parse:async(t,e)=>_D(new TextDecoder().decode(t),e?.wms),parseTextSync:(t,e)=>_D(t,e?.wms)};function _ge(t){return t.startsWith("<?xml")}function yD(t,e){let i=(Of.parseTextSync?.(t,e)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(i)?i:[i]).map(o=>yge(o))}}function yge(t){return{attributes:t||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var xG={...U_,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(t,e)=>yD(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>yD(t,e)};function vD(t,e){return Of.parseTextSync?.(t,e)}var bG={...U_,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(t,e)=>vD(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>vD(t,e)};function wG(t,e){let{type:r="auto"}=t,i=r==="auto"?xge(t.url,e):vge(r,e);if(!i)throw new Error("Not a valid image source type");return i.create(t)}function vge(t,e){for(let r of e)if(r.type===t)return r;return null}function xge(t,e){for(let r of e)if(r.testURL&&r.testURL(t))return r;return null}var TG={type:"wms",testURL:t=>t.toLowerCase().includes("wms"),create:t=>new xD(t)},xD=class extends Eu{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(e){super(e),this.url=e.url,this.data=e.url,this.substituteCRS84=e.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...e.wmsParameters},this.vendorParameters=e.vendorParameters||{}}async getMetadata(){let e=await this.getCapabilities();return this.normalizeMetadata(e)}async getImage(e){let{boundingBox:r,bbox:i,...n}=e,o={bbox:r?[...r[0],...r[1]]:i,...n};return await this.getMap(o)}normalizeMetadata(e){return e}async getCapabilities(e,r){let i=this.getCapabilitiesURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);let s=await U_.parse(o,this.loadOptions);return this.capabilities=s,s}async getMap(e,r){let i=this.getMapURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);try{return await Eh.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}async getFeatureInfo(e,r){let i=this.getFeatureInfoURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),await xG.parse(o,this.loadOptions)}async getFeatureInfoText(e,r){let i=this.getFeatureInfoURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),new TextDecoder().decode(o)}async describeLayer(e,r){let i=this.describeLayerURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),await bG.parse(o,this.loadOptions)}async getLegendGraphic(e,r){let i=this.getLegendGraphicURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);try{return await Eh.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}getCapabilitiesURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetCapabilities",i,r)}getMapURL(e,r){e=this._getWMS130Parameters(e);let i={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetMap",i,r)}getFeatureInfoURL(e,r){e=this._getWMS130Parameters(e);let{boundingBox:i,bbox:n}=e;e.bbox=i?[...i[0],...i[1]]:n;let o={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetFeatureInfo",o,r)}describeLayerURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("DescribeLayer",i,r)}getLegendGraphicURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetLegendGraphic",i,r)}_parseWMSUrl(e){let[r,i]=e.split("?"),n=i.split("&"),o={};for(let s of n){let[l,u]=s.split("=");o[l]=u}return{url:r,parameters:o}}_getWMSUrl(e,r,i){let n=this.url,o=!0,s={service:"WMS",version:r.version,request:e,...r,...this.vendorParameters,...i},l=["transparent","time","elevation"];for(let[u,h]of Object.entries(s))(!l.includes(u)||h)&&(n+=o?"?":"&",o=!1,n+=this._getURLParameter(u,h,r));return encodeURI(n)}_getWMS130Parameters(e){let r={...e};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(e,r,i){switch(e){case"crs":i.version!=="1.3.0"?e="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":i.version==="1.3.0"&&(e="crs");break;case"bbox":let n=this._flipBoundingBox(r,i);n&&(r=n);break;case"x":i.version==="1.3.0"&&(e="i");break;case"y":i.version==="1.3.0"&&(e="j");break;default:}return e=e.toUpperCase(),Array.isArray(r)?`${e}=${r.join(",")}`:`${e}=${r?String(r):""}`}_flipBoundingBox(e,r){if(!Array.isArray(e)||e.length!==4)return null;let i=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),n=e;return i?[n[1],n[0],n[3],n[2]]:n}async _fetchArrayBuffer(e){let r=await this.fetch(e),i=await r.arrayBuffer();return this._checkResponse(r,i),i}_checkResponse(e,r){let i=e.headers["content-type"];if(!e.ok||db.mimeTypes.includes(i)){let n=Wv(this.loadOptions,{wms:{throwOnError:!0}}),o=db.parseSync?.(r,n);throw new Error(o)}}_parseError(e){let r=db.parseSync?.(e,this.loadOptions);return new Error(r)}};var z_=class extends Eu{constructor(e){super(e)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(e){let r=this.getGranularParameters(e),i=this.getURLFromTemplate(r),o=await(await this.fetch(i)).arrayBuffer();return await Eh.parse(o)}getGranularParameters(e){let[[r,i],[n,o]]=e.boundingBox;return{...e,east:r,north:i,south:o,west:n}}getURLFromTemplate(e){let r=this.props.url;for(let[i,n]of Object.entries(e))r=r.replace(`\${${i}}`,String(n)),r=r.replace(`{${i}}`,String(n));return r}};Yr(z_,"type","template"),Yr(z_,"testURL",e=>e.toLowerCase().includes("{"));var bD=class extends z_{data;constructor(e){super(e),this.data=e.url}async getMetadata(){return await this.metadata()}async getImage(e){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(e){throw new Error("not implemented")}metadataURL(e){return`${this.props.url}?f=pjson`}exportImageURL(e){let r=`bbox=${e.bbox[0]},${e.bbox[1]},${e.bbox[2]},${e.bbox[3]}`,i=`size=${e.width},${e.height}`,n={...e,bbox:r,size:i};return delete n.width,delete n.height,this.getUrl("exportImage",n)}getUrl(e,r,i){let n=`${this.props.url}/${e}`,o=!0;for(let[s,l]of Object.entries(r))n+=o?"?":"&",o=!1,Array.isArray(l)?n+=`${s.toUpperCase()}=${l.join(",")}`:n+=`${s.toUpperCase()}=${l?String(l):""}`;return n}async checkResponse(e){if(!e.ok)throw new Error("error")}},EG={type:"arcgis-image-server",testURL:t=>t.toLowerCase().includes("ImageServer"),create:t=>new bD(t)};var bge=[TG,EG];function wD(t){return wG(t,bge)}var SG=6378137*Math.PI;function TD(t){let e=La(t);return e[0]=(e[0]/256-1)*SG,e[1]=(e[1]/256-1)*SG,e}var wge={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(t,e)=>console.error(e,t)}},VS=class extends es{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:e,props:r,oldProps:i}){let{viewport:n}=this.context;e.dataChanged||r.serviceType!==i.serviceType?(this.state.imageSource=this._createImageSource(r),this._loadMetadata(),this.debounce(()=>this.loadImage(n,"image source changed"),0)):Ls(r.layers,i.layers,1)?e.viewportChanged&&this.debounce(()=>this.loadImage(n,"viewport changed")):this.debounce(()=>this.loadImage(n,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:e,image:r,lastRequestParameters:i}=this.state;return r&&new zm({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:i.srs==="EPSG:4326"?Zr.LNGLAT:Zr.CARTESIAN,bounds:e,image:r})}async getFeatureInfoText(e,r){let{lastRequestParameters:i}=this.state;return i?await this.state.imageSource.getFeatureInfoText?.({...i,query_layers:i.layers,x:e,y:r,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(e){if(e.data instanceof Eu)return e.data;if(typeof e.data=="string")return wD({url:e.data,loadOptions:e.loadOptions,type:e.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:e}=this.state;try{this.state.loadCounter++;let r=await e.getMetadata();this.state.imageSource===e&&this.getCurrentLayer()?.props.onMetadataLoad(r)}catch(r){this.getCurrentLayer()?.props.onMetadataLoadError(r)}finally{this.state.loadCounter--}}async loadImage(e,r){let{layers:i,serviceType:n}=this.props;if(n==="wms"&&i.length===0)return;let o=e.getBounds(),{width:s,height:l}=e,u=this.getRequestId(),{srs:h}=this.props;h==="auto"&&(h=e.resolution?"EPSG:4326":"EPSG:3857");let v={width:s,height:l,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:i,crs:h};if(h==="EPSG:3857"){let T=TD([o[0],o[1]]),E=TD([o[2],o[3]]);v.boundingBox=[T,E]}try{this.state.loadCounter++,this.props.onImageLoadStart(u);let T=await this.state.imageSource.getImage(v);this.state.lastRequestId<u&&(this.getCurrentLayer()?.props.onImageLoad(u),this.setState({image:T,bounds:o,lastRequestParameters:v,lastRequestId:u}))}catch(T){this.raiseError(T,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(u,T)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(e,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>e(),r)}},zS=VS;(()=>{VS.layerName="WMSLayer"})(),(()=>{VS.defaultProps=wge})();var Tge={getHeight:{type:"accessor",value:0},greatCircle:!0},HS=class extends Um{},mb=HS;(()=>{HS.layerName="GreatCircleLayer"})(),(()=>{HS.defaultProps=Tge})();var Ege={...Bf.defaultProps},jS=class extends es{indexToBounds(){return null}renderLayers(){let{elevationScale:e,extruded:r,wireframe:i,filled:n,stroked:o,lineWidthUnits:s,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,lineJointRounded:v,lineMiterLimit:T,lineDashJustified:E,getElevation:M,getFillColor:O,getLineColor:F,getLineWidth:z}=this.props,{updateTriggers:W,material:J,transitions:K}=this.props,ne=this.getSubLayerClass("cell",Bf),{updateTriggers:ge,...j}=this.indexToBounds()||{};return new ne({filled:n,wireframe:i,extruded:r,elevationScale:e,stroked:o,lineWidthUnits:s,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,lineJointRounded:v,lineMiterLimit:T,lineDashJustified:E,material:J,transitions:K,getElevation:M,getFillColor:O,getLineColor:F,getLineWidth:z},this.getSubLayerProps({id:"cell",updateTriggers:W&&{...ge,getElevation:W.getElevation,getFillColor:W.getFillColor,getLineColor:W.getLineColor,getLineWidth:W.getLineWidth}}),j)}},eu=jS;(()=>{jS.layerName="GeoCellLayer"})(),(()=>{jS.defaultProps=Ege})();var GS=ga(ED(),1),Sge=3,Cge=30,Mge=2*Cge+1,MG=180/Math.PI;function PG(t,e,r){let i=1<<e;return[(t[0]+r[0])/i,(t[1]+r[1])/i]}function IG(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function RG(t){return[IG(t[0]),IG(t[1])]}function BG(t,[e,r]){switch(t){case 0:return[1,e,r];case 1:return[-e,1,r];case 2:return[-e,-r,1];case 3:return[-1,-r,-e];case 4:return[r,-1,-e];case 5:return[r,e,-1];default:throw new Error("Invalid face")}}function OG([t,e,r]){let i=Math.atan2(r,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*MG,i*MG]}function DG(t){let e=GS.default.fromString(t,!0,10).toString(2);for(;e.length<Sge+Mge;)e="0"+e;let r=e.lastIndexOf("1"),i=e.substring(0,3),n=e.substring(3,r),o=n.length/2,s=GS.default.fromString(i,!0,2).toString(10),l=GS.default.fromString(n,!0,2).toString(4);for(;l.length<o;)l="0"+l;return`${s}/${l}`}function Ige(t,e,r,i){if(i===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let n=e[0];e[0]=e[1],e[1]=n}}function LG(t){let e=t.split("/"),r=parseInt(e[0],10),i=e[1],n=i.length,o=[0,0],s;for(let l=n-1;l>=0;l--){s=n-l;let u=i[l],h=0,v=0;u==="1"?v=1:u==="2"?(h=1,v=1):u==="3"&&(h=1);let T=Math.pow(2,s-1);Ige(T,o,h,v),o[0]+=T*h,o[1]+=T*v}if(r%2===1){let l=o[0];o[0]=o[1],o[1]=l}return{face:r,ij:o,level:s}}var FG=ga(ED(),1);function Pge(t){let e=t.padEnd(16,"0");return FG.default.fromString(e,16)}var Rge=100;function Bge({face:t,ij:e,level:r}){let i=[[0,0],[0,1],[1,1],[1,0],[0,0]],n=Math.max(1,Math.ceil(Rge*Math.pow(2,-r))),o=new Float64Array(4*n*2+2),s=0,l=0;for(let u=0;u<4;u++){let h=i[u].slice(0),v=i[u+1],T=(v[0]-h[0])/n,E=(v[1]-h[1])/n;for(let M=0;M<n;M++){h[0]+=T,h[1]+=E;let O=PG(e,r,h),F=RG(O),z=BG(t,F),W=OG(z);Math.abs(W[1])>89.999&&(W[0]=l);let J=W[0]-l;W[0]+=J>180?-360:J<-180?360:0,o[s++]=W[0],o[s++]=W[1],l=W[0]}}return o[s++]=o[0],o[s++]=o[1],o}function Oge(t){if(typeof t=="string"){if(t.indexOf("/")>0)return t;t=Pge(t)}return DG(t.toString())}function NG(t){let e=Oge(t),r=LG(e);return Bge(r)}var Dge={getS2Token:{type:"accessor",value:t=>t.token}},WS=class extends eu{indexToBounds(){let{data:e,getS2Token:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(i,n)=>NG(r(i,n))}}},_b=WS;(()=>{WS.layerName="S2Layer"})(),(()=>{WS.defaultProps=Dge})();var SD=512;function Lge(t,e){let r=0,i=0,n=1<<t.length,o=n/SD;for(let s=0;s<t.length;s++){n>>=1;let l=parseInt(t[s]);l%2&&(r|=n),l>1&&(i|=n)}return[[r/o,SD-i/o],[(r+e)/o,SD-(i+e)/o]]}function kG(t,e=1){let[r,i]=Lge(t,e),[n,o]=xl(r),[s,l]=xl(i);return[s,o,s,l,n,l,n,o,s,o]}var Fge={getQuadkey:{type:"accessor",value:t=>t.quadkey}},qS=class extends eu{indexToBounds(){let{data:e,extruded:r,getQuadkey:i}=this.props,n=r?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(o,s)=>kG(i(o,s),n),updateTriggers:{getPolygon:n}}}},yb=qS;(()=>{qS.layerName="QuadkeyLayer"})(),(()=>{qS.defaultProps=Fge})();var rg=class{constructor(e){this.index=e,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(e){this._bbox||(this._bbox=e,"west"in e?this.boundingBox=[[e.west,e.south],[e.east,e.north]]:this.boundingBox=[[e.left,e.top],[e.right,e.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:r,onLoad:i,onError:n}){let{index:o,id:s,bbox:l,userData:u,zoom:h}=this,v=this._loaderId;this._abortController=new AbortController;let{signal:T}=this._abortController,E=await r.scheduleRequest(this,F=>F.isSelected?1:-1);if(!E){this._isCancelled=!0;return}if(this._isCancelled){E.done();return}let M=null,O;try{M=await e({index:o,id:s,bbox:l,userData:u,zoom:h,signal:T})}catch(F){O=F||!0}finally{E.done()}if(v===this._loaderId){if(this._loader=void 0,this.content=M,this._isCancelled&&!M){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,O?n(O,this):i(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var sa={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var UG=new ot,Nge=new ot,eA=class{constructor(e=[0,0,0],r=[0,0,0],i){i=i||UG.copy(e).add(r).scale(.5),this.center=new ot(i),this.halfDiagonal=new ot(r).subtract(this.center),this.minimum=new ot(e),this.maximum=new ot(r)}clone(){return new eA(this.minimum,this.maximum,this.center)}equals(e){return this===e||Boolean(e)&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:r}=this,i=Nge.from(e.normal),n=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),o=this.center.dot(i)+e.distance;return o-n>0?sa.INSIDE:o+n<0?sa.OUTSIDE:sa.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=UG.from(e).subtract(this.center),{halfDiagonal:i}=this,n=0,o;return o=Math.abs(r.x)-i.x,o>0&&(n+=o*o),o=Math.abs(r.y)-i.y,o>0&&(n+=o*o),o=Math.abs(r.z)-i.z,o>0&&(n+=o*o),n}};var vb=new ot,zG=new ot,Gu=class{constructor(e=[0,0,0],r=0){this.radius=-0,this.center=new ot,this.fromCenterRadius(e,r)}fromCenterRadius(e,r){return this.center.from(e),this.radius=r,this}fromCornerPoints(e,r){return r=vb.from(r),this.center=new ot().from(e).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Gu(this.center,this.radius)}union(e){let r=this.center,i=this.radius,n=e.center,o=e.radius,s=vb.copy(n).subtract(r),l=s.magnitude();if(i>=l+o)return this.clone();if(o>=l+i)return e.clone();let u=(i+l+o)*.5;return zG.copy(s).scale((-i+u)/l).add(r),this.center.copy(zG),this.radius=u,this}expand(e){let i=vb.from(e).subtract(this.center).magnitude();return i>this.radius&&(this.radius=i),this}transform(e){this.center.transform(e);let r=Zs.getScaling(vb,e);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(e){let r=this.distanceTo(e);return r*r}distanceTo(e){let i=vb.from(e).subtract(this.center);return Math.max(0,i.len()-this.radius)}intersectPlane(e){let r=this.center,i=this.radius,o=e.normal.dot(r)+e.distance;return o<-i?sa.OUTSIDE:o<i?sa.INTERSECTING:sa.INSIDE}};var kge=new ot,Uge=new ot,XS=new ot,YS=new ot,KS=new ot,zge=new ot,Vge=new ot,kd={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Df=class{constructor(e=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new ot().from(e),this.halfAxes=new mo(r)}get halfSize(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2);return[new ot(e).len(),new ot(r).len(),new ot(i).len()]}get quaternion(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2),n=new ot(e).normalize(),o=new ot(r).normalize(),s=new ot(i).normalize();return new Du().fromMatrix3(new mo([...n,...o,...s]))}fromCenterHalfSizeQuaternion(e,r,i){let n=new Du(i),o=new mo().fromQuaternion(n);return o[0]=o[0]*r[0],o[1]=o[1]*r[0],o[2]=o[2]*r[0],o[3]=o[3]*r[1],o[4]=o[4]*r[1],o[5]=o[5]*r[1],o[6]=o[6]*r[2],o[7]=o[7]*r[2],o[8]=o[8]*r[2],this.center=new ot().from(e),this.halfAxes=o,this}clone(){return new Df(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Gu){let r=this.halfAxes,i=r.getColumn(0,XS),n=r.getColumn(1,YS),o=r.getColumn(2,KS),s=kge.copy(i).add(n).add(o);return e.center.copy(this.center),e.radius=s.magnitude(),e}intersectPlane(e){let r=this.center,i=e.normal,n=this.halfAxes,o=i.x,s=i.y,l=i.z,u=Math.abs(o*n[kd.COLUMN0ROW0]+s*n[kd.COLUMN0ROW1]+l*n[kd.COLUMN0ROW2])+Math.abs(o*n[kd.COLUMN1ROW0]+s*n[kd.COLUMN1ROW1]+l*n[kd.COLUMN1ROW2])+Math.abs(o*n[kd.COLUMN2ROW0]+s*n[kd.COLUMN2ROW1]+l*n[kd.COLUMN2ROW2]),h=i.dot(r)+e.distance;return h<=-u?sa.OUTSIDE:h>=u?sa.INSIDE:sa.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=Uge.from(e).subtract(this.center),i=this.halfAxes,n=i.getColumn(0,XS),o=i.getColumn(1,YS),s=i.getColumn(2,KS),l=n.magnitude(),u=o.magnitude(),h=s.magnitude();n.normalize(),o.normalize(),s.normalize();let v=0,T;return T=Math.abs(r.dot(n))-l,T>0&&(v+=T*T),T=Math.abs(r.dot(o))-u,T>0&&(v+=T*T),T=Math.abs(r.dot(s))-h,T>0&&(v+=T*T),v}computePlaneDistances(e,r,i=[-0,-0]){let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,s=this.center,l=this.halfAxes,u=l.getColumn(0,XS),h=l.getColumn(1,YS),v=l.getColumn(2,KS),T=zge.copy(u).add(h).add(v).add(s),E=Vge.copy(T).subtract(e),M=r.dot(E);return n=Math.min(M,n),o=Math.max(M,o),T.copy(s).add(u).add(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),T.copy(s).add(u).subtract(h).add(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),T.copy(s).add(u).subtract(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).add(h).add(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).add(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).subtract(h).add(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).subtract(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),i[0]=n,i[1]=o,i}transform(e){this.center.transformAsPoint(e);let r=this.halfAxes.getColumn(0,XS);r.transformAsPoint(e);let i=this.halfAxes.getColumn(1,YS);i.transformAsPoint(e);let n=this.halfAxes.getColumn(2,KS);return n.transformAsPoint(e),this.halfAxes=new mo([...r,...i,...n]),this}getTransform(){throw new Error("not implemented")}};var VG=new ot,HG=new ot,$a=class{constructor(e=[0,0,1],r=0){this.normal=new ot,this.distance=-0,this.fromNormalDistance(e,r)}fromNormalDistance(e,r){return Ja(Number.isFinite(r)),this.normal.from(e).normalize(),this.distance=r,this}fromPointNormal(e,r){e=VG.from(e),this.normal.from(r).normalize();let i=-this.normal.dot(e);return this.distance=i,this}fromCoefficients(e,r,i,n){return this.normal.set(e,r,i),Ja(Cs(this.normal.len(),1)),this.distance=n,this}clone(){return new $a(this.normal,this.distance)}equals(e){return Cs(this.distance,e.distance)&&Cs(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let r=HG.copy(this.normal).transformAsVector(e).normalize(),i=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(i,r)}projectPointOntoPlane(e,r=[0,0,0]){let i=VG.from(e),n=this.getPointDistance(i),o=HG.copy(this.normal).scale(n);return i.subtract(o).to(r)}};var jG=[new ot([1,0,0]),new ot([0,1,0]),new ot([0,0,1])],GG=new ot,Hge=new ot,wa=class{constructor(e=[]){this.planes=e}fromBoundingSphere(e){this.planes.length=2*jG.length;let r=e.center,i=e.radius,n=0;for(let o of jG){let s=this.planes[n],l=this.planes[n+1];s||(s=this.planes[n]=new $a),l||(l=this.planes[n+1]=new $a);let u=GG.copy(o).scale(-i).add(r);s.fromPointNormal(u,o);let h=GG.copy(o).scale(i).add(r),v=Hge.copy(o).negate();l.fromPointNormal(h,v),n+=2}return this}computeVisibility(e){let r=sa.INSIDE;for(let i of this.planes)switch(e.intersectPlane(i)){case sa.OUTSIDE:return sa.OUTSIDE;case sa.INTERSECTING:r=sa.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(e,r){if(Ja(Number.isFinite(r),"parentPlaneMask is required."),r===wa.MASK_OUTSIDE||r===wa.MASK_INSIDE)return r;let i=wa.MASK_INSIDE,n=this.planes;for(let o=0;o<this.planes.length;++o){let s=o<31?1<<o:0;if(o<31&&!(r&s))continue;let l=n[o],u=e.intersectPlane(l);if(u===sa.OUTSIDE)return wa.MASK_OUTSIDE;u===sa.INTERSECTING&&(i|=s)}return i}};wa.MASK_OUTSIDE=4294967295;wa.MASK_INSIDE=0;wa.MASK_INDETERMINATE=2147483647;var Ett=new ot,Stt=new ot,Ctt=new ot,Mtt=new ot,Itt=new ot;var Ltt=new ot,Ftt=new ot,Ntt=new ot,ktt=new ot,Utt=new ot,ztt=new ot,Vtt=new ot,Htt=new ot,jtt=new ot,Gtt=new ot,Wtt=new ot,qtt=new ot;var Dh=new mo,Gge=new mo,Wge=new mo,ZS=new mo,WG=new mo;function ID(t,e={}){let r=Lu.EPSILON20,i=10,n=0,o=0,s=Gge,l=Wge;s.identity(),l.copy(t);let u=r*qge(l);for(;o<i&&Xge(l)>u;)Yge(l,ZS),WG.copy(ZS).transpose(),l.multiplyRight(ZS),l.multiplyLeft(WG),s.multiplyRight(ZS),++n>2&&(++o,n=0);return e.unitary=s.toTarget(e.unitary),e.diagonal=l.toTarget(e.diagonal),e}function qge(t){let e=0;for(let r=0;r<9;++r){let i=t[r];e+=i*i}return Math.sqrt(e)}var CD=[1,0,0],MD=[2,2,1];function Xge(t){let e=0;for(let r=0;r<3;++r){let i=t[Dh.getElementIndex(MD[r],CD[r])];e+=2*i*i}return Math.sqrt(e)}function Yge(t,e){let r=Lu.EPSILON15,i=0,n=1;for(let h=0;h<3;++h){let v=Math.abs(t[Dh.getElementIndex(MD[h],CD[h])]);v>i&&(n=h,i=v)}let o=CD[n],s=MD[n],l=1,u=0;if(Math.abs(t[Dh.getElementIndex(s,o)])>r){let h=t[Dh.getElementIndex(s,s)],v=t[Dh.getElementIndex(o,o)],T=t[Dh.getElementIndex(s,o)],E=(h-v)/2/T,M;E<0?M=-1/(-E+Math.sqrt(1+E*E)):M=1/(E+Math.sqrt(1+E*E)),l=1/Math.sqrt(1+M*M),u=M*l}return mo.IDENTITY.to(e),e[Dh.getElementIndex(o,o)]=e[Dh.getElementIndex(s,s)]=l,e[Dh.getElementIndex(s,o)]=u,e[Dh.getElementIndex(o,s)]=-u,e}var tA=new ot,Kge=new ot,Zge=new ot,Jge=new ot,Qge=new ot,$ge=new mo,e0e={diagonal:new mo,unitary:new mo};function xb(t,e=new Df){if(!t||t.length===0)return e.halfAxes=new mo([0,0,0,0,0,0,0,0,0]),e.center=new ot,e;let r=t.length,i=new ot(0,0,0);for(let $ of t)i.add($);let n=1/r;i.multiplyByScalar(n);let o=0,s=0,l=0,u=0,h=0,v=0;for(let $ of t){let Z=tA.copy($).subtract(i);o+=Z.x*Z.x,s+=Z.x*Z.y,l+=Z.x*Z.z,u+=Z.y*Z.y,h+=Z.y*Z.z,v+=Z.z*Z.z}o*=n,s*=n,l*=n,u*=n,h*=n,v*=n;let T=$ge;T[0]=o,T[1]=s,T[2]=l,T[3]=s,T[4]=u,T[5]=h,T[6]=l,T[7]=h,T[8]=v;let{unitary:E}=ID(T,e0e),M=e.halfAxes.copy(E),O=M.getColumn(0,Zge),F=M.getColumn(1,Jge),z=M.getColumn(2,Qge),W=-Number.MAX_VALUE,J=-Number.MAX_VALUE,K=-Number.MAX_VALUE,ne=Number.MAX_VALUE,ge=Number.MAX_VALUE,j=Number.MAX_VALUE;for(let $ of t)tA.copy($),W=Math.max(tA.dot(O),W),J=Math.max(tA.dot(F),J),K=Math.max(tA.dot(z),K),ne=Math.min(tA.dot(O),ne),ge=Math.min(tA.dot(F),ge),j=Math.min(tA.dot(z),j);O=O.multiplyByScalar(.5*(ne+W)),F=F.multiplyByScalar(.5*(ge+J)),z=z.multiplyByScalar(.5*(j+K)),e.center.copy(O).add(F).add(z);let me=Kge.set(W-ne,J-ge,K-j).multiplyByScalar(.5),fe=new mo([me[0],0,0,0,me[1],0,0,0,me[2]]);return e.halfAxes.multiplyRight(fe),e}var V_=512,qG=3,XG=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],YG=XG.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),t0e=YG.concat([[.25,.5],[.75,.5]]),rA=class{constructor(e,r,i){this.x=e,this.y=r,this.z=i}get children(){if(!this._children){let e=this.x*2,r=this.y*2,i=this.z+1;this._children=[new rA(e,r,i),new rA(e,r+1,i),new rA(e+1,r,i),new rA(e+1,r+1,i)]}return this._children}update(e){let{viewport:r,cullingVolume:i,elevationBounds:n,minZ:o,maxZ:s,bounds:l,offset:u,project:h}=e,v=this.getBoundingVolume(n,u,h);if(l&&!this.insideBounds(l)||i.computeVisibility(v)<0)return!1;if(!this.childVisible){let{z:E}=this;if(E<s&&E>=o){let M=v.distanceTo(r.cameraPosition)*r.scale/r.height;E+=Math.floor(Math.log2(M))}if(E>=s)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let E of this.children)E.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(let r of this._children)r.getSelected(e);return e}insideBounds([e,r,i,n]){let o=Math.pow(2,this.z),s=V_/o;return this.x*s<i&&this.y*s<n&&(this.x+1)*s>e&&(this.y+1)*s>r}getBoundingVolume(e,r,i){if(i){let u=this.z<1?t0e:this.z<2?YG:XG,h=[];for(let v of u){let T=JS(this.x+v[0],this.y+v[1],this.z);T[2]=e[0],h.push(i(T)),e[0]!==e[1]&&(T[2]=e[1],h.push(i(T)))}return xb(h)}let n=Math.pow(2,this.z),o=V_/n,s=this.x*o+r*V_,l=V_-(this.y+1)*o;return new eA([s,l,e[0]],[s+o,l+o,e[1]])}};function KG(t,e,r,i){let n=t instanceof Rd&&t.resolution?t.projectPosition:null,o=Object.values(t.getFrustumPlanes()).map(({normal:M,distance:O})=>new $a(M.clone().negate(),O)),s=new wa(o),l=t.distanceScales.unitsPerMeter[2],u=r&&r[0]*l||0,h=r&&r[1]*l||0,v=t instanceof Tc&&t.pitch<=60?e:0;if(i){let[M,O,F,z]=i,W=La([M,z]),J=La([F,O]);i=[W[0],V_-W[1],J[0],V_-J[1]]}let T=new rA(0,0,0),E={viewport:t,project:n,cullingVolume:s,elevationBounds:[u,h],minZ:v,maxZ:e,bounds:i,offset:0};if(T.update(E),t instanceof Tc&&t.subViewports&&t.subViewports.length>1){for(E.offset=-1;T.update(E)&&!(--E.offset<-qG););for(E.offset=1;T.update(E)&&!(++E.offset>qG););}return T.getSelected()}var Ud=512,r0e=[-1/0,-1/0,1/0,1/0],iA={type:"object",value:null,validate:(t,e)=>e.optional&&t===null||typeof t=="string"||Array.isArray(t)&&t.every(r=>typeof r=="string"),equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;let r=t.length;if(r!==e.length)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}};function JG(t,e){let r=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])];return[Math.min(...r.map(n=>n[0])),Math.min(...r.map(n=>n[1])),Math.max(...r.map(n=>n[0])),Math.max(...r.map(n=>n[1]))]}function i0e(t){return Math.abs(t.split("").reduce((e,r)=>(e<<5)-e+r.charCodeAt(0)|0,0))}function Lh(t,e){if(!t||!t.length)return null;let{index:r,id:i}=e;if(Array.isArray(t)){let o=i0e(i)%t.length;t=t[o]}let n=t;for(let o of Object.keys(r)){let s=new RegExp(`{${o}}`,"g");n=n.replace(s,String(r[o]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(n=n.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),n}function n0e(t,e,r){let i;if(e&&e.length===2){let[n,o]=e,s=t.getBounds({z:n}),l=t.getBounds({z:o});i=[Math.min(s[0],l[0]),Math.min(s[1],l[1]),Math.max(s[2],l[2]),Math.max(s[3],l[3])]}else i=t.getBounds();return t.isGeospatial?[Math.max(i[0],r[0]),Math.max(i[1],r[1]),Math.min(i[2],r[2]),Math.min(i[3],r[3])]:[Math.max(Math.min(i[0],r[2]),r[0]),Math.max(Math.min(i[1],r[3]),r[1]),Math.min(Math.max(i[2],r[0]),r[2]),Math.min(Math.max(i[3],r[1]),r[3])]}function QG({viewport:t,z:e,cullRect:r}){return(t.subViewports||[t]).map(n=>PD(n,e||0,r))}function PD(t,e,r){if(!Array.isArray(e)){let o=r.x-t.x,s=r.y-t.y,{width:l,height:u}=r,h={targetZ:e},v=t.unproject([o,s],h),T=t.unproject([o+l,s],h),E=t.unproject([o,s+u],h),M=t.unproject([o+l,s+u],h);return[Math.min(v[0],T[0],E[0],M[0]),Math.min(v[1],T[1],E[1],M[1]),Math.max(v[0],T[0],E[0],M[0]),Math.max(v[1],T[1],E[1],M[1])]}let i=PD(t,e[0],r),n=PD(t,e[1],r);return[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[2],n[2]),Math.max(i[3],n[3])]}function o0e(t,e,r){return r?JG(t,r).map(n=>n*e/Ud):t.map(i=>i*e/Ud)}function RD(t,e){return Math.pow(2,t)*Ud/e}function JS(t,e,r){let i=RD(r,Ud),n=t/i*360-180,o=Math.PI-2*Math.PI*e/i,s=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[n,s]}function ZG(t,e,r,i){let n=RD(r,i);return[t/n*Ud,e/n*Ud]}function BD(t,e,r,i,n=Ud){if(t.isGeospatial){let[h,v]=JS(e,r,i),[T,E]=JS(e+1,r+1,i);return{west:h,north:v,east:T,south:E}}let[o,s]=ZG(e,r,i,n),[l,u]=ZG(e+1,r+1,i,n);return{left:o,top:s,right:l,bottom:u}}function s0e(t,e,r,i,n){let o=n0e(t,null,i),s=RD(e,r),[l,u,h,v]=o0e(o,s,n),T=[];for(let E=Math.floor(l);E<h;E++)for(let M=Math.floor(u);M<v;M++)T.push({x:E,y:M,z:e});return T}function OD({viewport:t,maxZoom:e,minZoom:r,zRange:i,extent:n,tileSize:o=Ud,modelMatrix:s,modelMatrixInverse:l,zoomOffset:u=0}){let h=t.isGeospatial?Math.round(t.zoom+Math.log2(Ud/o))+u:Math.ceil(t.zoom)+u;if(typeof r=="number"&&Number.isFinite(r)&&h<r){if(!n)return[];h=r}typeof e=="number"&&Number.isFinite(e)&&h>e&&(h=e);let v=n;return s&&l&&n&&!t.isGeospatial&&(v=JG(n,s)),t.isGeospatial?KG(t,h,i,n):s0e(t,h,o,v||r0e,l)}function DD(t){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(t)}function LD(t){return Number.isFinite(t.west)&&Number.isFinite(t.north)&&Number.isFinite(t.east)&&Number.isFinite(t.south)}function $G(t){let e={},r;return i=>{for(let n in i)if(!a0e(i[n],e[n])){r=t(i),e=i;break}return r}}function a0e(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}return!1}var eW=1,QS=2,l0e="never",c0e="no-overlap",bb="best-available",u0e=5,f0e={[bb]:d0e,[c0e]:p0e,[l0e]:()=>{}},h0e={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},ig=class{constructor(e){this._getCullBounds=$G(QG),this.opts={...h0e,...e},this.setOptions(this.opts),this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new vp({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new Kr,this._modelMatrixInverse=new Kr}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom))}finalize(){for(let e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let e of this._cache.keys()){let r=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(e):r.setNeedsReload()}}update(e,{zRange:r,modelMatrix:i}={zRange:null,modelMatrix:null}){let n=i?new Kr(i):new Kr,o=!n.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!Cs(this._zRange,r)||o){o&&(this._modelMatrixInverse=n.clone().invert(),this._modelMatrix=n),this._viewport=e,this._zRange=r;let l=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=l.map(u=>this._getTile(u,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(l=>this._getTile(l.index,!0)));let s=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),s&&this._frameNumber++,this._frameNumber}isTileVisible(e,r){if(!e.isVisible)return!1;if(r&&this._viewport){let i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:n}=e;for(let[o,s,l,u]of i){let h;if("west"in n)h=n.west<l&&n.east>o&&n.south<u&&n.north>s;else{let v=Math.min(n.top,n.bottom),T=Math.max(n.top,n.bottom);h=n.left<l&&n.right>o&&v<u&&T>s}if(h)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:r,minZoom:i,zRange:n,modelMatrix:o,modelMatrixInverse:s}){let{tileSize:l,extent:u,zoomOffset:h}=this.opts;return OD({viewport:e,maxZoom:r,minZoom:i,zRange:n,tileSize:l,extent:u,modelMatrix:o,modelMatrixInverse:s,zoomOffset:h})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){let{tileSize:r}=this.opts;return{bbox:BD(this._viewport,e.x,e.y,e.z,r)}}getParentIndex(e){let r=Math.floor(e.x/2),i=Math.floor(e.y/2),n=e.z-1;return{x:r,y:i,z:n}}updateTileStates(){let e=this.opts.refinementStrategy||bb,r=new Array(this._cache.size),i=0;for(let n of this._cache.values())r[i++]=n.isVisible,n.isSelected=!1,n.isVisible=!1;for(let n of this._selectedTiles)n.isSelected=!0,n.isVisible=!0;(typeof e=="function"?e:f0e[e])(Array.from(this._cache.values())),i=0;for(let n of this._cache.values())if(r[i++]!==n.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:e=0}=this.opts,r=[],i=0;for(let n of this._cache.values())n.isLoading&&(i++,!n.isSelected&&!n.isVisible&&r.push(n));for(;e>0&&i>e&&r.length>0;)r.shift().abort(),i--}_rebuildTree(){let{_cache:e}=this;for(let r of e.values())r.parent=null,r.children&&(r.children.length=0);for(let r of e.values()){let i=this._getNearestAncestor(r);r.parent=i,i?.children&&i.children.push(r)}}_resizeCache(){let{_cache:e,opts:r}=this,i=r.maxCacheSize||(r.maxCacheByteSize?1/0:u0e*this.selectedTiles.length),n=r.maxCacheByteSize||1/0;if(e.size>i||this._cacheByteSize>n){for(let[s,l]of e)if(!l.isVisible&&!l.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize?l.byteLength:0,e.delete(s),this.opts.onTileUnload?.(l)),e.size<=i&&this._cacheByteSize<=n)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((s,l)=>s.zoom-l.zoom),this._dirty=!1)}_getTile(e,r){let i=this.getTileId(e),n=this._cache.get(i),o=!1;return!n&&r?(n=new rg(e),Object.assign(n,this.getTileMetadata(n.index)),Object.assign(n,{id:i,zoom:this.getTileZoom(n.index)}),o=!0,this._cache.set(i,n),this._dirty=!0):n&&n.needsReload&&(o=!0),n&&o&&n.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),n}_getNearestAncestor(e){let{_minZoom:r=0}=this,i=e.index;for(;this.getTileZoom(i)>r;){i=this.getParentIndex(i);let n=this._getTile(i);if(n)return n}return null}};function d0e(t){for(let e of t)e.state=0;for(let e of t)e.isSelected&&!tW(e)&&FD(e);for(let e of t)e.isVisible=Boolean(e.state&QS)}function p0e(t){for(let r of t)r.state=0;for(let r of t)r.isSelected&&tW(r);let e=Array.from(t).sort((r,i)=>r.zoom-i.zoom);for(let r of e)if(r.isVisible=Boolean(r.state&QS),r.children&&(r.isVisible||r.state&eW))for(let i of r.children)i.state=eW;else r.isSelected&&FD(r)}function tW(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=QS,!0;e=e.parent}return!1}function FD(t){for(let e of t.children)e.isLoaded||e.content?e.state|=QS:FD(e)}var A0e={TilesetClass:ig,data:{type:"data",value:[]},dataComparator:iA.equal,renderSubLayers:{type:"function",value:t=>new Oh(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:bb,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},$S=class extends es{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(r=>r.isLoaded)))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:r}=this.state,i=e.propsOrDataChanged||e.updateTriggersChanged,n=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);r?i&&(r.setOptions(this._getTilesetOptions()),n?r.reloadAll():r.tiles.forEach(o=>{o.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:e,maxCacheSize:r,maxCacheByteSize:i,refinementStrategy:n,extent:o,maxZoom:s,minZoom:l,maxRequests:u,debounceTime:h,zoomOffset:v}=this.props;return{maxCacheSize:r,maxCacheByteSize:i,maxZoom:s,minZoom:l,tileSize:e,refinementStrategy:n,extent:o,maxRequests:u,debounceTime:h,zoomOffset:v,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let e=this.state.tileset,{zRange:r,modelMatrix:i}=this.props,n=e.update(this.context.viewport,{zRange:r,modelMatrix:i}),{isLoaded:o}=e,s=this.state.isLoaded!==o,l=this.state.frameNumber!==n;o&&(s||l)&&this._onViewportLoad(),l&&this.setState({frameNumber:n}),this.state.isLoaded=o}_onViewportLoad(){let{tileset:e}=this.state,{onViewportLoad:r}=this.props;r&&r(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,r){this.props.onTileError(e),r.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){let{data:r,getTileData:i,fetch:n}=this.props,{signal:o}=e;return e.url=typeof r=="string"||Array.isArray(r)?Lh(r,e):null,i?i(e):n&&e.url?n(e.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo(e){let r=e.sourceLayer,i=r.props.tile,n=e.info;return n.picked&&(n.tile=i),n.sourceTile=i,n.sourceTileSubLayer=r,n}_updateAutoHighlight(e){e.sourceTileSubLayer.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{let r=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)r&&e.layers[0]&&Object.keys(r).some(i=>e.layers[0].props[i]!==r[i])&&(e.layers=e.layers.map(i=>i.clone(r)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=Rh(i,Boolean).map(n=>n.clone({tile:e,...r}))}return e.layers})}filterSubLayer({layer:e,cullRect:r}){let{tile:i}=e.props;return this.state.tileset.isTileVisible(i,r)}},Fh=$S;(()=>{$S.defaultProps=A0e})(),(()=>{$S.layerName="TileLayer"})();var m0e={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:t=>t.timestamps}},eC=class extends Pf{getShaders(){let e=super.getShaders();return e.inject={"vs:#decl":`uniform float trailLength;
in float instanceTimestamps;
in float instanceNextTimestamps;
out float vTime;
`,"vs:#main-end":`vTime = instanceTimestamps + (instanceNextTimestamps - instanceTimestamps) * vPathPosition.y / vPathLength;
`,"fs:#decl":`uniform bool fadeTrail;
uniform float trailLength;
uniform float currentTime;
in float vTime;
`,"fs:#main-start":`if(vTime > currentTime || (fadeTrail && (vTime < currentTime - trailLength))) {
discard;
}
`,"fs:DECKGL_FILTER_COLOR":`if(fadeTrail) {
color.a *= 1.0 - (currentTime - vTime) / trailLength;
}
`},e}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(e){let{fadeTrail:r,trailLength:i,currentTime:n}=this.props;e.uniforms={...e.uniforms,fadeTrail:r,trailLength:i,currentTime:n},super.draw(e)}},wb=eC;(()=>{eC.layerName="TripsLayer"})(),(()=>{eC.defaultProps=m0e})();var uo=function(t){t=t||{};var e=typeof t<"u"?t:{},r={},i;for(i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);var n=[],o="";function s(ut){return e.locateFile?e.locateFile(ut,o):o+ut}var l;typeof document<"u"&&document.currentScript&&(o=document.currentScript.src),o.indexOf("blob:")!==0?o=o.substr(0,o.lastIndexOf("/")+1):o="",l=function(St,cr,Xr){var g=new XMLHttpRequest;g.open("GET",St,!0),g.responseType="arraybuffer",g.onload=function(){if(g.status==200||g.status==0&&g.response){cr(g.response);return}var Wr=de(St);if(Wr){cr(Wr.buffer);return}Xr()},g.onerror=Xr,g.send(null)};var u=e.print||console.log.bind(console),h=e.printErr||console.warn.bind(console);for(i in r)r.hasOwnProperty(i)&&(e[i]=r[i]);r=null,e.arguments&&(n=e.arguments);var v=0,T=function(ut){v=ut},E=function(){return v},M=8;function O(ut,St,cr,Xr){switch(cr=cr||"i8",cr.charAt(cr.length-1)==="*"&&(cr="i32"),cr){case"i1":Le[ut>>0]=St;break;case"i8":Le[ut>>0]=St;break;case"i16":Vt[ut>>1]=St;break;case"i32":mr[ut>>2]=St;break;case"i64":To=[St>>>0,(Dn=St,+Hi(Dn)>=1?Dn>0?(Ji(+No(Dn/4294967296),4294967295)|0)>>>0:~~+Un((Dn-+(~~Dn>>>0))/4294967296)>>>0:0)],mr[ut>>2]=To[0],mr[ut+4>>2]=To[1];break;case"float":Jr[ut>>2]=St;break;case"double":or[ut>>3]=St;break;default:mi("invalid type for setValue: "+cr)}}function F(ut,St,cr){switch(St=St||"i8",St.charAt(St.length-1)==="*"&&(St="i32"),St){case"i1":return Le[ut>>0];case"i8":return Le[ut>>0];case"i16":return Vt[ut>>1];case"i32":return mr[ut>>2];case"i64":return mr[ut>>2];case"float":return Jr[ut>>2];case"double":return or[ut>>3];default:mi("invalid type for getValue: "+St)}return null}var z=!1;function W(ut,St){ut||mi("Assertion failed: "+St)}function J(ut){var St=e["_"+ut];return W(St,"Cannot call unknown function "+ut+", make sure it is exported"),St}function K(ut,St,cr,Xr,g){var ki={string:function($n){var ji=0;if($n!=null&&$n!==0){var Gi=($n.length<<2)+1;ji=ce(Gi),$($n,ji,Gi)}return ji},array:function($n){var ji=ce($n.length);return we($n,ji),ji}};function Wr($n){return St==="string"?me($n):St==="boolean"?Boolean($n):$n}var Re=J(ut),Ti=[],An=0;if(Xr)for(var Qn=0;Qn<Xr.length;Qn++){var En=ki[cr[Qn]];En?(An===0&&(An=Qe()),Ti[Qn]=En(Xr[Qn])):Ti[Qn]=Xr[Qn]}var ln=Re.apply(null,Ti);return ln=Wr(ln),An!==0&&_e(An),ln}function ne(ut,St,cr,Xr){cr=cr||[];var g=cr.every(function(Wr){return Wr==="number"}),ki=St!=="string";return ki&&g&&!Xr?J(ut):function(){return K(ut,St,cr,arguments,Xr)}}var ge=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function j(ut,St,cr){for(var Xr=St+cr,g=St;ut[g]&&!(g>=Xr);)++g;if(g-St>16&&ut.subarray&&ge)return ge.decode(ut.subarray(St,g));for(var ki="";St<g;){var Wr=ut[St++];if(!(Wr&128)){ki+=String.fromCharCode(Wr);continue}var Re=ut[St++]&63;if((Wr&224)==192){ki+=String.fromCharCode((Wr&31)<<6|Re);continue}var Ti=ut[St++]&63;if((Wr&240)==224?Wr=(Wr&15)<<12|Re<<6|Ti:Wr=(Wr&7)<<18|Re<<12|Ti<<6|ut[St++]&63,Wr<65536)ki+=String.fromCharCode(Wr);else{var An=Wr-65536;ki+=String.fromCharCode(55296|An>>10,56320|An&1023)}}return ki}function me(ut,St){return ut?j(ft,ut,St):""}function fe(ut,St,cr,Xr){if(!(Xr>0))return 0;for(var g=cr,ki=cr+Xr-1,Wr=0;Wr<ut.length;++Wr){var Re=ut.charCodeAt(Wr);if(Re>=55296&&Re<=57343){var Ti=ut.charCodeAt(++Wr);Re=65536+((Re&1023)<<10)|Ti&1023}if(Re<=127){if(cr>=ki)break;St[cr++]=Re}else if(Re<=2047){if(cr+1>=ki)break;St[cr++]=192|Re>>6,St[cr++]=128|Re&63}else if(Re<=65535){if(cr+2>=ki)break;St[cr++]=224|Re>>12,St[cr++]=128|Re>>6&63,St[cr++]=128|Re&63}else{if(cr+3>=ki)break;St[cr++]=240|Re>>18,St[cr++]=128|Re>>12&63,St[cr++]=128|Re>>6&63,St[cr++]=128|Re&63}}return St[cr]=0,cr-g}function $(ut,St,cr){return fe(ut,ft,St,cr)}var Z=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function we(ut,St){Le.set(ut,St)}function Oe(ut,St){return ut%St>0&&(ut+=St-ut%St),ut}var he,Le,ft,Vt,Yt,mr,Er,Jr,or;function ai(ut){he=ut,e.HEAP8=Le=new Int8Array(ut),e.HEAP16=Vt=new Int16Array(ut),e.HEAP32=mr=new Int32Array(ut),e.HEAPU8=ft=new Uint8Array(ut),e.HEAPU16=Yt=new Uint16Array(ut),e.HEAPU32=Er=new Uint32Array(ut),e.HEAPF32=Jr=new Float32Array(ut),e.HEAPF64=or=new Float64Array(ut)}var Jt=5267040,qt=24128,wi=e.TOTAL_MEMORY||33554432;e.buffer?he=e.buffer:he=new ArrayBuffer(wi),wi=he.byteLength,ai(he),mr[qt>>2]=Jt;function ae(ut){for(;ut.length>0;){var St=ut.shift();if(typeof St=="function"){St();continue}var cr=St.func;typeof cr=="number"?St.arg===void 0?e.dynCall_v(cr):e.dynCall_vi(cr,St.arg):cr(St.arg===void 0?null:St.arg)}}var be=[],je=[],lt=[],Ft=[];function wt(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)kn(e.preRun.shift());ae(be)}function $r(){ae(je)}function xi(){ae(lt)}function Ki(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Zi(e.postRun.shift());ae(Ft)}function kn(ut){be.unshift(ut)}function Zi(ut){Ft.unshift(ut)}var Hi=Math.abs,Un=Math.ceil,No=Math.floor,Ji=Math.min,Bi=0,yn=null,po=null;function kr(ut){Bi++,e.monitorRunDependencies&&e.monitorRunDependencies(Bi)}function dr(ut){if(Bi--,e.monitorRunDependencies&&e.monitorRunDependencies(Bi),Bi==0&&(yn!==null&&(clearInterval(yn),yn=null),po)){var St=po;po=null,St()}}e.preloadedImages={},e.preloadedAudios={};var Ur=null,ci="data:application/octet-stream;base64,";function to(ut){return String.prototype.startsWith?ut.startsWith(ci):ut.indexOf(ci)===0}var Dn,To;Ur="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAOgehWlKfUEEz1zLi+JsiQa2og3wcMfVAWCbHorc0yEDi+Yn/Y6mbQJ11/mfsnG9At6bnG4UQQkBvMCQWKqUUQJVmwwswmOc/3hVgVBL3uj//qqOEOdGOPw/WDN4gnGE/H3ANkCUgND+AA8btKgAHPwTXBqJVSdo+XfRQAqsKrj4fc+zLYbSPQklEmCZHv2FCUP+uDso1NEKYtPhwphUHQptxnyFXYdpB7CddZAMmrkGAt1AxSTqBQUibBVdTsFNBSuX3MV+AJkFocv82SLf5QAqmgj7AY81A23VDSEnLoEDGEJVSeDFzQDYrqvBk70VA8U157pcRGUBWfEF+ZKbsP7KBdLHZTpFAqKYk69AqekDbeGY41MdjQD8AZzHK501A1vcrrjubNkD5LnquvBYhQCbiRRD71QlAqt72EbOH8z8Eu+jL1YbdP4uaox/xUcY/abedg1XfsD+BsUdzJ4KZP5wE9YFySIM/rW1kAKMpbT+rZFthVRhWPy4PKlXIs0A/qMZLlwDnMEHByqEF0I0ZQQYSFD8lUQNBPpY+dFs07UAH8BZImBPWQN9RY0I0sMBA2T7kLfc6qUByFYvfhBKTQMq+0Mis1XxA0XQbeQXMZUBJJ5aEGXpQQP7/SY0a6ThAaMD92b/UIkAs8s8yqXoMQNIegOvCk/U/aOi7NZJP4D8AAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAD/////AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA/////wAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAP////8AAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////BQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAEAAQAAAQEAAAAAAAEAAAABAAAAAQABAAAAAAAAAAAAAAAAAAAAAAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAAGFsZ29zLmMAaDNOZWlnaGJvclJvdGF0aW9ucwBjb29yZGlqay5jAF91cEFwN0NoZWNrZWQAX3VwQXA3ckNoZWNrZWQAZGlyZWN0ZWRFZGdlLmMAZGlyZWN0ZWRFZGdlVG9Cb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0NlbGxCb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbY2VudGVySUpLLmZhY2VdW2ZhY2UyXSA9PSBLSQBfZmFjZUlqa1RvQ2VsbEJvdW5kYXJ5AGgzSW5kZXguYwBjb21wYWN0Q2VsbHMAbGF0TG5nVG9DZWxsAGNlbGxUb0NoaWxkUG9zAHZhbGlkYXRlQ2hpbGRQb3MAbGF0TG5nLmMAY2VsbEFyZWFSYWRzMgBwb2x5Z29uLT5uZXh0ID09IE5VTEwAbGlua2VkR2VvLmMAYWRkTmV3TGlua2VkUG9seWdvbgBuZXh0ICE9IE5VTEwAbG9vcCAhPSBOVUxMAGFkZE5ld0xpbmtlZExvb3AAcG9seWdvbi0+Zmlyc3QgPT0gTlVMTABhZGRMaW5rZWRMb29wAGNvb3JkICE9IE5VTEwAYWRkTGlua2VkQ29vcmQAbG9vcC0+Zmlyc3QgPT0gTlVMTABpbm5lckxvb3BzICE9IE5VTEwAbm9ybWFsaXplTXVsdGlQb2x5Z29uAGJib3hlcyAhPSBOVUxMAGNhbmRpZGF0ZXMgIT0gTlVMTABmaW5kUG9seWdvbkZvckhvbGUAY2FuZGlkYXRlQkJveGVzICE9IE5VTEwAcmV2RGlyICE9IElOVkFMSURfRElHSVQAbG9jYWxpai5jAGNlbGxUb0xvY2FsSWprAGJhc2VDZWxsICE9IG9yaWdpbkJhc2VDZWxsACEob3JpZ2luT25QZW50ICYmIGluZGV4T25QZW50KQBiYXNlQ2VsbCA9PSBvcmlnaW5CYXNlQ2VsbABiYXNlQ2VsbCAhPSBJTlZBTElEX0JBU0VfQ0VMTABsb2NhbElqa1RvQ2VsbAAhX2lzQmFzZUNlbGxQZW50YWdvbihiYXNlQ2VsbCkAYmFzZUNlbGxSb3RhdGlvbnMgPj0gMABncmlkUGF0aENlbGxzADAAdmVydGV4LmMAY2VsbFRvVmVydGV4AGdyYXBoLT5idWNrZXRzICE9IE5VTEwAdmVydGV4R3JhcGguYwBpbml0VmVydGV4R3JhcGgAbm9kZSAhPSBOVUxMAGFkZFZlcnRleE5vZGU=";var Eo=24144;function Xo(ut){return ut}function So(ut){var St=/\b__Z[\w\d_]+/g;return ut.replace(St,function(cr){var Xr=cr;return cr===Xr?cr:Xr+" ["+cr+"]"})}function Us(){var ut=new Error;if(!ut.stack){try{throw new Error(0)}catch(St){ut=St}if(!ut.stack)return"(no stack trace available)"}return ut.stack.toString()}function Fc(){var ut=Us();return e.extraStackTrace&&(ut+=`
`+e.extraStackTrace()),So(ut)}function ql(ut,St,cr,Xr){mi("Assertion failed: "+me(ut)+", at: "+[St?me(St):"unknown filename",cr,Xr?me(Xr):"unknown function"])}function sl(){return Le.length}function Cl(ut,St,cr){ft.set(ft.subarray(St,St+cr),ut)}function al(ut){return e.___errno_location&&(mr[e.___errno_location()>>2]=ut),ut}function Ms(ut){mi("OOM")}function ca(ut){try{var St=new ArrayBuffer(ut);return St.byteLength!=ut?void 0:(new Int8Array(St).set(Le),zs(St),ai(St),1)}catch{}}function Ml(ut){var St=sl(),cr=16777216,Xr=2147483648-cr;if(ut>Xr)return!1;for(var g=16777216,ki=Math.max(St,g);ki<ut;)ki<=536870912?ki=Oe(2*ki,cr):ki=Math.min(Oe((3*ki+2147483648)/4,cr),Xr);var Wr=ca(ki);return!!Wr}var ao=typeof atob=="function"?atob:function(ut){var St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",cr="",Xr,g,ki,Wr,Re,Ti,An,Qn=0;ut=ut.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Wr=St.indexOf(ut.charAt(Qn++)),Re=St.indexOf(ut.charAt(Qn++)),Ti=St.indexOf(ut.charAt(Qn++)),An=St.indexOf(ut.charAt(Qn++)),Xr=Wr<<2|Re>>4,g=(Re&15)<<4|Ti>>2,ki=(Ti&3)<<6|An,cr=cr+String.fromCharCode(Xr),Ti!==64&&(cr=cr+String.fromCharCode(g)),An!==64&&(cr=cr+String.fromCharCode(ki));while(Qn<ut.length);return cr};function oe(ut){try{for(var St=ao(ut),cr=new Uint8Array(St.length),Xr=0;Xr<St.length;++Xr)cr[Xr]=St.charCodeAt(Xr);return cr}catch{throw new Error("Converting base64 string to bytes failed.")}}function de(ut){if(to(ut))return oe(ut.slice(ci.length))}var ve={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},Pe={a:mi,b:T,c:E,d:ql,e:al,f:sl,g:Cl,h:Ml,i:Ms,j:Xo,k:So,l:ca,m:Us,n:Fc,o:Eo,p:qt},ye=function(ut,St,cr){var Xr=new ut.Int8Array(cr),g=new ut.Int32Array(cr),ki=new ut.Uint8Array(cr),Wr=new ut.Float32Array(cr),Re=new ut.Float64Array(cr),Ti=St.o|0,An=St.p|0,Qn=ut.Math.floor,En=ut.Math.abs,ln=ut.Math.sqrt,$n=ut.Math.pow,ji=ut.Math.cos,Gi=ut.Math.sin,an=ut.Math.tan,ea=ut.Math.acos,Yh=ut.Math.asin,Hs=ut.Math.atan,Ko=ut.Math.atan2,fu=ut.Math.ceil,fl=ut.Math.imul,hu=ut.Math.min,Sn=ut.Math.max,ha=ut.Math.clz32,gi=St.b,Fe=St.c,_i=St.d,Kh=St.e,Vc=St.f,Is=St.g,Kf=St.h,Xl=St.i,Ie=24160;function hl(m){return Xr=new Int8Array(m),ki=new Uint8Array(m),g=new Int32Array(m),Wr=new Float32Array(m),Re=new Float64Array(m),cr=m,!0}function hc(m){m=m|0;var A=0;return A=Ie,Ie=Ie+m|0,Ie=Ie+15&-16,A|0}function Hc(){return Ie|0}function rf(m){m=m|0,Ie=m}function Zf(m,A){m=m|0,A=A|0,Ie=m}function Jf(m,A){m=m|0,A=A|0;var y=0,w=0,C=0;return(m|0)<0?(A=2,A|0):(m|0)>13780509?(A=Ct(15,A)|0,A|0):(y=((m|0)<0)<<31>>31,C=ma(m|0,y|0,3,0)|0,w=Fe()|0,y=bn(m|0,y|0,1,0)|0,y=ma(C|0,w|0,y|0,Fe()|0)|0,y=bn(y|0,Fe()|0,1,0)|0,m=Fe()|0,g[A>>2]=y,g[A+4>>2]=m,A=0,A|0)}function jc(m,A,y,w){return m=m|0,A=A|0,y=y|0,w=w|0,du(m,A,y,w,0)|0}function du(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0;if(X=Ie,Ie=Ie+16|0,L=X,!(Zh(m,A,y,w,C)|0))return w=0,Ie=X,w|0;do if((y|0)>=0){if((y|0)>13780509){if(R=Ct(15,L)|0,R|0)break;N=L,L=g[N>>2]|0,N=g[N+4>>2]|0}else R=((y|0)<0)<<31>>31,te=ma(y|0,R|0,3,0)|0,N=Fe()|0,R=bn(y|0,R|0,1,0)|0,R=ma(te|0,N|0,R|0,Fe()|0)|0,R=bn(R|0,Fe()|0,1,0)|0,N=Fe()|0,g[L>>2]=R,g[L+4>>2]=N,L=R;if(sd(w|0,0,L<<3|0)|0,C|0){sd(C|0,0,L<<2|0)|0,R=za(m,A,y,w,C,L,N,0)|0;break}R=Qo(L,4)|0,R?(te=za(m,A,y,w,R,L,N,0)|0,Mi(R),R=te):R=13}else R=2;while(0);return te=R,Ie=X,te|0}function Zh(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0;if(yt=Ie,Ie=Ie+16|0,nt=yt,Ye=yt+8|0,$e=nt,g[$e>>2]=m,g[$e+4>>2]=A,(y|0)<0)return Ye=2,Ie=yt,Ye|0;if(R=w,g[R>>2]=m,g[R+4>>2]=A,R=(C|0)!=0,R&&(g[C>>2]=0),mn(m,A)|0)return Ye=9,Ie=yt,Ye|0;g[Ye>>2]=0;e:do if((y|0)>=1)if(R)for(pe=1,te=0,De=0,$e=1,R=m;;){if(!(te|De)){if(R=Vo(R,A,4,Ye,nt)|0,R|0)break e;if(A=nt,R=g[A>>2]|0,A=g[A+4>>2]|0,mn(R,A)|0){R=9;break e}}if(R=Vo(R,A,g[22384+(De<<2)>>2]|0,Ye,nt)|0,R|0)break e;if(A=nt,R=g[A>>2]|0,A=g[A+4>>2]|0,m=w+(pe<<3)|0,g[m>>2]=R,g[m+4>>2]=A,g[C+(pe<<2)>>2]=$e,m=te+1|0,L=(m|0)==($e|0),N=De+1|0,X=(N|0)==6,mn(R,A)|0){R=9;break e}if($e=$e+(X&L&1)|0,($e|0)>(y|0)){R=0;break}else pe=pe+1|0,te=L?0:m,De=L?X?0:N:De}else for(pe=1,te=0,De=0,$e=1,R=m;;){if(!(te|De)){if(R=Vo(R,A,4,Ye,nt)|0,R|0)break e;if(A=nt,R=g[A>>2]|0,A=g[A+4>>2]|0,mn(R,A)|0){R=9;break e}}if(R=Vo(R,A,g[22384+(De<<2)>>2]|0,Ye,nt)|0,R|0)break e;if(A=nt,R=g[A>>2]|0,A=g[A+4>>2]|0,m=w+(pe<<3)|0,g[m>>2]=R,g[m+4>>2]=A,m=te+1|0,L=(m|0)==($e|0),N=De+1|0,X=(N|0)==6,mn(R,A)|0){R=9;break e}if($e=$e+(X&L&1)|0,($e|0)>(y|0)){R=0;break}else pe=pe+1|0,te=L?0:m,De=L?X?0:N:De}else R=0;while(0);return Ye=R,Ie=yt,Ye|0}function za(m,A,y,w,C,R,L,N){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0,R=R|0,L=L|0,N=N|0;var X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0;if(yt=Ie,Ie=Ie+16|0,nt=yt+8|0,Ye=yt,X=hf(m|0,A|0,R|0,L|0)|0,pe=Fe()|0,De=w+(X<<3)|0,zt=De,kt=g[zt>>2]|0,zt=g[zt+4>>2]|0,te=(kt|0)==(m|0)&(zt|0)==(A|0),!((kt|0)==0&(zt|0)==0|te))do X=bn(X|0,pe|0,1,0)|0,X=Jg(X|0,Fe()|0,R|0,L|0)|0,pe=Fe()|0,De=w+(X<<3)|0,kt=De,zt=g[kt>>2]|0,kt=g[kt+4>>2]|0,te=(zt|0)==(m|0)&(kt|0)==(A|0);while(!((zt|0)==0&(kt|0)==0|te));if(X=C+(X<<2)|0,te&&(g[X>>2]|0)<=(N|0)||(kt=De,g[kt>>2]=m,g[kt+4>>2]=A,g[X>>2]=N,(N|0)>=(y|0)))return kt=0,Ie=yt,kt|0;switch(te=N+1|0,g[nt>>2]=0,X=Vo(m,A,2,nt,Ye)|0,X|0){case 9:{$e=9;break}case 0:{X=Ye,X=za(g[X>>2]|0,g[X+4>>2]|0,y,w,C,R,L,te)|0,X||($e=9);break}default:}e:do if(($e|0)==9){switch(g[nt>>2]=0,X=Vo(m,A,3,nt,Ye)|0,X|0){case 9:break;case 0:{if(X=Ye,X=za(g[X>>2]|0,g[X+4>>2]|0,y,w,C,R,L,te)|0,X|0)break e;break}default:break e}switch(g[nt>>2]=0,X=Vo(m,A,1,nt,Ye)|0,X|0){case 9:break;case 0:{if(X=Ye,X=za(g[X>>2]|0,g[X+4>>2]|0,y,w,C,R,L,te)|0,X|0)break e;break}default:break e}switch(g[nt>>2]=0,X=Vo(m,A,5,nt,Ye)|0,X|0){case 9:break;case 0:{if(X=Ye,X=za(g[X>>2]|0,g[X+4>>2]|0,y,w,C,R,L,te)|0,X|0)break e;break}default:break e}switch(g[nt>>2]=0,X=Vo(m,A,4,nt,Ye)|0,X|0){case 9:break;case 0:{if(X=Ye,X=za(g[X>>2]|0,g[X+4>>2]|0,y,w,C,R,L,te)|0,X|0)break e;break}default:break e}switch(g[nt>>2]=0,X=Vo(m,A,6,nt,Ye)|0,X|0){case 9:break;case 0:{if(X=Ye,X=za(g[X>>2]|0,g[X+4>>2]|0,y,w,C,R,L,te)|0,X|0)break e;break}default:break e}return kt=0,Ie=yt,kt|0}while(0);return kt=X,Ie=yt,kt|0}function Vo(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0;if(y>>>0>6)return C=1,C|0;if(De=(g[w>>2]|0)%6|0,g[w>>2]=De,(De|0)>0){R=0;do y=dc(y)|0,R=R+1|0;while((R|0)<(g[w>>2]|0))}if(De=nr(m|0,A|0,45)|0,Fe()|0,pe=De&127,pe>>>0>121)return C=5,C|0;X=xs(m,A)|0,R=nr(m|0,A|0,52)|0,Fe()|0,R=R&15;e:do if(!R)te=8;else{for(;;){if(L=(15-R|0)*3|0,N=nr(m|0,A|0,L|0)|0,Fe()|0,N=N&7,(N|0)==7){A=5;break}if(Ye=(Zo(R)|0)==0,R=R+-1|0,$e=Sr(7,0,L|0)|0,A=A&~(Fe()|0),nt=Sr(g[(Ye?432:16)+(N*28|0)+(y<<2)>>2]|0,0,L|0)|0,L=Fe()|0,y=g[(Ye?640:224)+(N*28|0)+(y<<2)>>2]|0,m=nt|m&~$e,A=L|A,!y){y=0;break e}if(!R){te=8;break e}}return A|0}while(0);(te|0)==8&&(Ye=g[848+(pe*28|0)+(y<<2)>>2]|0,nt=Sr(Ye|0,0,45)|0,m=nt|m,A=Fe()|0|A&-1040385,y=g[4272+(pe*28|0)+(y<<2)>>2]|0,(Ye&127|0)==127&&(Ye=Sr(g[848+(pe*28|0)+20>>2]|0,0,45)|0,A=Fe()|0|A&-1040385,y=g[4272+(pe*28|0)+20>>2]|0,m=Ga(Ye|m,A)|0,A=Fe()|0,g[w>>2]=(g[w>>2]|0)+1)),N=nr(m|0,A|0,45)|0,Fe()|0,N=N&127;e:do if(yr(N)|0){t:do if((xs(m,A)|0)==1){if((pe|0)!=(N|0))if(fi(N,g[7696+(pe*28|0)>>2]|0)|0){m=ih(m,A)|0,L=1,A=Fe()|0;break}else _i(23313,22416,436,22424);switch(X|0){case 3:{m=Ga(m,A)|0,A=Fe()|0,g[w>>2]=(g[w>>2]|0)+1,L=0;break t}case 5:{m=ih(m,A)|0,A=Fe()|0,g[w>>2]=(g[w>>2]|0)+5,L=0;break t}case 0:return Ye=9,Ye|0;default:return Ye=1,Ye|0}}else L=0;while(0);if((y|0)>0){R=0;do m=td(m,A)|0,A=Fe()|0,R=R+1|0;while((R|0)!=(y|0))}if((pe|0)!=(N|0)){if(!(Lr(N)|0)){if((L|0)!=0|(xs(m,A)|0)!=5)break;g[w>>2]=(g[w>>2]|0)+1;break}switch(De&127){case 8:case 118:break e;default:}(xs(m,A)|0)!=3&&(g[w>>2]=(g[w>>2]|0)+1)}}else if((y|0)>0){R=0;do m=Ga(m,A)|0,A=Fe()|0,R=R+1|0;while((R|0)!=(y|0))}while(0);return g[w>>2]=((g[w>>2]|0)+y|0)%6|0,Ye=C,g[Ye>>2]=m,g[Ye+4>>2]=A,Ye=0,Ye|0}function ze(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0;for(N=Ie,Ie=Ie+16|0,R=N,L=N+8|0,C=(mn(m,A)|0)==0,C=C?1:2;;){if(g[L>>2]=0,te=(Vo(m,A,C,L,R)|0)==0,X=R,te&((g[X>>2]|0)==(y|0)?(g[X+4>>2]|0)==(w|0):0)){m=4;break}if(C=C+1|0,C>>>0>=7){C=7,m=4;break}}return(m|0)==4?(Ie=N,C|0):0}function st(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0;if(Ye=Ie,Ie=Ie+16|0,$e=Ye,nt=Ye+8|0,De=$e,g[De>>2]=m,g[De+4>>2]=A,!y)return nt=w,g[nt>>2]=m,g[nt+4>>2]=A,nt=0,Ie=Ye,nt|0;g[nt>>2]=0;e:do if(mn(m,A)|0)m=9;else{if(R=(y|0)>0,R){C=0,De=m;do{if(m=Vo(De,A,4,nt,$e)|0,m|0)break e;if(A=$e,De=g[A>>2]|0,A=g[A+4>>2]|0,C=C+1|0,mn(De,A)|0){m=9;break e}}while((C|0)<(y|0));if(pe=w,g[pe>>2]=De,g[pe+4>>2]=A,pe=y+-1|0,R){te=0,m=1;do{if(C=22384+(te<<2)|0,(te|0)==5)for(L=g[C>>2]|0,R=0,C=m;;){if(m=$e,m=Vo(g[m>>2]|0,g[m+4>>2]|0,L,nt,$e)|0,m|0)break e;if((R|0)!=(pe|0))if(X=$e,N=g[X>>2]|0,X=g[X+4>>2]|0,m=w+(C<<3)|0,g[m>>2]=N,g[m+4>>2]=X,!(mn(N,X)|0))m=C+1|0;else{m=9;break e}else m=C;if(R=R+1|0,(R|0)>=(y|0))break;C=m}else for(L=$e,X=g[C>>2]|0,N=0,C=m,R=g[L>>2]|0,L=g[L+4>>2]|0;;){if(m=Vo(R,L,X,nt,$e)|0,m|0)break e;if(L=$e,R=g[L>>2]|0,L=g[L+4>>2]|0,m=w+(C<<3)|0,g[m>>2]=R,g[m+4>>2]=L,m=C+1|0,mn(R,L)|0){m=9;break e}if(N=N+1|0,(N|0)>=(y|0))break;C=m}te=te+1|0}while(te>>>0<6);m=$e,L=De,C=g[m>>2]|0,R=A,m=g[m+4>>2]|0}else L=De,C=De,R=A,m=A}else L=w,g[L>>2]=m,g[L+4>>2]=A,L=m,C=m,R=A,m=A;m=(L|0)==(C|0)&(R|0)==(m|0)?0:9}while(0);return nt=m,Ie=Ye,nt|0}function Tt(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0;if(N=Ie,Ie=Ie+48|0,C=N+16|0,R=N+8|0,L=N,y|0)return L=15,Ie=N,L|0;if(te=m,X=g[te+4>>2]|0,y=R,g[y>>2]=g[te>>2],g[y+4>>2]=X,ws(R,C),A=vo(C,A,L)|0,!A){if(y=g[R>>2]|0,R=g[m+8>>2]|0,(R|0)>0){C=g[m+12>>2]|0,A=0;do y=(g[C+(A<<3)>>2]|0)+y|0,A=A+1|0;while((A|0)<(R|0))}A=L,C=g[A>>2]|0,A=g[A+4>>2]|0,R=((y|0)<0)<<31>>31,(A|0)<(R|0)|(A|0)==(R|0)&C>>>0<y>>>0?(A=L,g[A>>2]=y,g[A+4>>2]=R,A=R):y=C,X=bn(y|0,A|0,12,0)|0,te=Fe()|0,A=L,g[A>>2]=X,g[A+4>>2]=te,A=w,g[A>>2]=X,g[A+4>>2]=te,A=0}return te=A,Ie=N,te|0}function Lt(m,A,y,w,C,R,L){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0,R=R|0,L=L|0;var N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0,gt=0,Fr=0,Nr=0,Rr=0,Vr=0,io=0,Vn=0,Hn=0,Ui=0,tn=0,cn=0,co=0,zi=0,Po=0,gl=0,ad=0;if(co=Ie,Ie=Ie+64|0,Hn=co+48|0,Ui=co+32|0,tn=co+24|0,Fr=co+8|0,Nr=co,X=g[m>>2]|0,(X|0)<=0)return cn=0,Ie=co,cn|0;for(Rr=m+4|0,Vr=Hn+8|0,io=Ui+8|0,Vn=Fr+8|0,N=0,Bt=0;;){te=g[Rr>>2]|0,Et=te+(Bt<<4)|0,g[Hn>>2]=g[Et>>2],g[Hn+4>>2]=g[Et+4>>2],g[Hn+8>>2]=g[Et+8>>2],g[Hn+12>>2]=g[Et+12>>2],(Bt|0)==(X+-1|0)?(g[Ui>>2]=g[te>>2],g[Ui+4>>2]=g[te+4>>2],g[Ui+8>>2]=g[te+8>>2],g[Ui+12>>2]=g[te+12>>2]):(Et=te+(Bt+1<<4)|0,g[Ui>>2]=g[Et>>2],g[Ui+4>>2]=g[Et+4>>2],g[Ui+8>>2]=g[Et+8>>2],g[Ui+12>>2]=g[Et+12>>2]),X=us(Hn,Ui,w,tn)|0;e:do if(X)te=0,N=X;else if(te=tn,X=g[te>>2]|0,te=g[te+4>>2]|0,(te|0)>0|(te|0)==0&X>>>0>0){kt=0,Et=0;t:for(;;){if(ad=+Re[Hn>>3],zt=Pa(X|0,te|0,kt|0,Et|0)|0,gl=+(zt>>>0)+4294967296*+(Fe()|0),zi=+(X>>>0)+4294967296*+(te|0),Po=+(kt>>>0)+4294967296*+(Et|0),Re[Fr>>3]=ad*gl/zi+ +Re[Ui>>3]*Po/zi,Re[Vn>>3]=+Re[Vr>>3]*gl/zi+ +Re[io>>3]*Po/zi,X=hp(Fr,w,Nr)|0,X|0){N=X;break}zt=Nr,yt=g[zt>>2]|0,zt=g[zt+4>>2]|0,$e=hf(yt|0,zt|0,A|0,y|0)|0,pe=Fe()|0,X=L+($e<<3)|0,De=X,te=g[De>>2]|0,De=g[De+4>>2]|0;r:do if((te|0)==0&(De|0)==0)gt=X,cn=16;else for(nt=0,Ye=0;;){if((nt|0)>(y|0)|(nt|0)==(y|0)&Ye>>>0>A>>>0){N=1;break t}if((te|0)==(yt|0)&(De|0)==(zt|0))break r;if(X=bn($e|0,pe|0,1,0)|0,$e=Jg(X|0,Fe()|0,A|0,y|0)|0,pe=Fe()|0,Ye=bn(Ye|0,nt|0,1,0)|0,nt=Fe()|0,X=L+($e<<3)|0,De=X,te=g[De>>2]|0,De=g[De+4>>2]|0,(te|0)==0&(De|0)==0){gt=X,cn=16;break}}while(0);if((cn|0)==16&&(cn=0,!((yt|0)==0&(zt|0)==0))&&(Ye=gt,g[Ye>>2]=yt,g[Ye+4>>2]=zt,Ye=R+(g[C>>2]<<3)|0,g[Ye>>2]=yt,g[Ye+4>>2]=zt,Ye=C,Ye=bn(g[Ye>>2]|0,g[Ye+4>>2]|0,1,0)|0,yt=Fe()|0,zt=C,g[zt>>2]=Ye,g[zt+4>>2]=yt),kt=bn(kt|0,Et|0,1,0)|0,Et=Fe()|0,te=tn,X=g[te>>2]|0,te=g[te+4>>2]|0,!((te|0)>(Et|0)|(te|0)==(Et|0)&X>>>0>kt>>>0)){te=1;break e}}te=0}else te=1;while(0);if(Bt=Bt+1|0,!te){cn=21;break}if(X=g[m>>2]|0,(Bt|0)>=(X|0)){N=0,cn=21;break}}return(cn|0)==21?(Ie=co,N|0):0}function Gt(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0,gt=0,Fr=0,Nr=0,Rr=0,Vr=0,io=0,Vn=0,Hn=0,Ui=0,tn=0,cn=0,co=0,zi=0,Po=0,gl=0;if(gl=Ie,Ie=Ie+112|0,cn=gl+80|0,X=gl+72|0,co=gl,zi=gl+56|0,y|0)return Po=15,Ie=gl,Po|0;if(te=m+8|0,Po=_c((g[te>>2]<<5)+32|0)|0,!Po)return Po=13,Ie=gl,Po|0;if(Io(m,Po),Ui=m,tn=g[Ui+4>>2]|0,y=X,g[y>>2]=g[Ui>>2],g[y+4>>2]=tn,ws(X,cn),y=vo(cn,A,co)|0,y)Ui=0,tn=0;else{if(y=g[X>>2]|0,R=g[te>>2]|0,(R|0)>0){L=g[m+12>>2]|0,C=0;do y=(g[L+(C<<3)>>2]|0)+y|0,C=C+1|0;while((C|0)!=(R|0));C=y}else C=y;y=co,R=g[y>>2]|0,y=g[y+4>>2]|0,L=((C|0)<0)<<31>>31,(y|0)<(L|0)|(y|0)==(L|0)&R>>>0<C>>>0?(y=co,g[y>>2]=C,g[y+4>>2]=L,y=L):C=R,Ui=bn(C|0,y|0,12,0)|0,tn=Fe()|0,y=co,g[y>>2]=Ui,g[y+4>>2]=tn,y=0}if(y|0)return Mi(Po),Po=y,Ie=gl,Po|0;if(C=Qo(Ui,8)|0,!C)return Mi(Po),Po=13,Ie=gl,Po|0;if(N=Qo(Ui,8)|0,!N)return Mi(Po),Mi(C),Po=13,Ie=gl,Po|0;Vn=cn,g[Vn>>2]=0,g[Vn+4>>2]=0,Vn=m,Hn=g[Vn+4>>2]|0,y=X,g[y>>2]=g[Vn>>2],g[y+4>>2]=Hn,y=Lt(X,Ui,tn,A,cn,C,N)|0;e:do if(y)Mi(C),Mi(N),Mi(Po);else{t:do if((g[te>>2]|0)>0){for(L=m+12|0,R=0;y=Lt((g[L>>2]|0)+(R<<3)|0,Ui,tn,A,cn,C,N)|0,R=R+1|0,!(y|0);)if((R|0)>=(g[te>>2]|0))break t;Mi(C),Mi(N),Mi(Po);break e}while(0);(tn|0)>0|(tn|0)==0&Ui>>>0>0&&sd(N|0,0,Ui<<3|0)|0,Hn=cn,Vn=g[Hn+4>>2]|0;t:do if((Vn|0)>0|(Vn|0)==0&(g[Hn>>2]|0)>>>0>0){Rr=C,Vr=N,io=C,Vn=N,Hn=C,y=C,gt=C,Fr=N,Nr=N,C=N;r:for(;;){for(zt=0,kt=0,Et=0,Bt=0,R=0,L=0;;){N=co,X=N+56|0;do g[N>>2]=0,N=N+4|0;while((N|0)<(X|0));if(A=Rr+(zt<<3)|0,te=g[A>>2]|0,A=g[A+4>>2]|0,Zh(te,A,1,co,0)|0){N=co,X=N+56|0;do g[N>>2]=0,N=N+4|0;while((N|0)<(X|0));N=Qo(7,4)|0,N|0&&(za(te,A,1,co,N,7,0,0)|0,Mi(N))}for(yt=0;;){Ye=co+(yt<<3)|0,nt=g[Ye>>2]|0,Ye=g[Ye+4>>2]|0;i:do if((nt|0)==0&(Ye|0)==0)N=R,X=L;else{if(pe=hf(nt|0,Ye|0,Ui|0,tn|0)|0,te=Fe()|0,N=w+(pe<<3)|0,A=N,X=g[A>>2]|0,A=g[A+4>>2]|0,!((X|0)==0&(A|0)==0)){De=0,$e=0;do{if((De|0)>(tn|0)|(De|0)==(tn|0)&$e>>>0>Ui>>>0)break r;if((X|0)==(nt|0)&(A|0)==(Ye|0)){N=R,X=L;break i}N=bn(pe|0,te|0,1,0)|0,pe=Jg(N|0,Fe()|0,Ui|0,tn|0)|0,te=Fe()|0,$e=bn($e|0,De|0,1,0)|0,De=Fe()|0,N=w+(pe<<3)|0,A=N,X=g[A>>2]|0,A=g[A+4>>2]|0}while(!((X|0)==0&(A|0)==0))}(nt|0)==0&(Ye|0)==0?(N=R,X=L):(yu(nt,Ye,zi)|0,Jo(m,Po,zi)|0&&($e=bn(R|0,L|0,1,0)|0,L=Fe()|0,De=N,g[De>>2]=nt,g[De+4>>2]=Ye,R=Vr+(R<<3)|0,g[R>>2]=nt,g[R+4>>2]=Ye,R=$e),N=R,X=L)}while(0);if(yt=yt+1|0,yt>>>0>=7)break;R=N,L=X}if(zt=bn(zt|0,kt|0,1,0)|0,kt=Fe()|0,Et=bn(Et|0,Bt|0,1,0)|0,Bt=Fe()|0,L=cn,R=g[L>>2]|0,L=g[L+4>>2]|0,(Bt|0)<(L|0)|(Bt|0)==(L|0)&Et>>>0<R>>>0)R=N,L=X;else break}if((L|0)>0|(L|0)==0&R>>>0>0){R=0,L=0;do Bt=Rr+(R<<3)|0,g[Bt>>2]=0,g[Bt+4>>2]=0,R=bn(R|0,L|0,1,0)|0,L=Fe()|0,Bt=cn,Et=g[Bt+4>>2]|0;while((L|0)<(Et|0)|((L|0)==(Et|0)?R>>>0<(g[Bt>>2]|0)>>>0:0))}if(Bt=cn,g[Bt>>2]=N,g[Bt+4>>2]=X,(X|0)>0|(X|0)==0&N>>>0>0)yt=C,zt=Nr,kt=Hn,Et=Fr,Bt=Vr,C=gt,Nr=y,Fr=io,gt=yt,y=zt,Hn=Vn,Vn=kt,io=Et,Vr=Rr,Rr=Bt;else break t}Mi(io),Mi(Vn),Mi(Po),y=1;break e}else y=N;while(0);Mi(Po),Mi(C),Mi(y),y=0}while(0);return Po=y,Ie=gl,Po|0}function _r(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0;if(pe=Ie,Ie=Ie+176|0,X=pe,(A|0)<1)return qa(y,0,0),te=0,Ie=pe,te|0;for(N=m,N=nr(g[N>>2]|0,g[N+4>>2]|0,52)|0,Fe()|0,qa(y,(A|0)>6?A:6,N&15),N=0;w=m+(N<<3)|0,w=d(g[w>>2]|0,g[w+4>>2]|0,X)|0,!(w|0);){if(w=g[X>>2]|0,(w|0)>0){L=0;do R=X+8+(L<<4)|0,L=L+1|0,w=X+8+(((L|0)%(w|0)|0)<<4)|0,C=hv(y,w,R)|0,C?Kg(y,C)|0:dp(y,R,w)|0,w=g[X>>2]|0;while((L|0)<(w|0))}if(N=N+1|0,(N|0)>=(A|0)){w=0,te=13;break}}return(te|0)==13?(Ie=pe,w|0):(Aa(y),te=w,Ie=pe,te|0)}function hr(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0;if(R=Ie,Ie=Ie+32|0,w=R,C=R+16|0,m=_r(m,A,C)|0,m|0)return y=m,Ie=R,y|0;if(g[y>>2]=0,g[y+4>>2]=0,g[y+8>>2]=0,m=wu(C)|0,m|0)do{A=oi(y)|0;do ii(A,m)|0,L=m+16|0,g[w>>2]=g[L>>2],g[w+4>>2]=g[L+4>>2],g[w+8>>2]=g[L+8>>2],g[w+12>>2]=g[L+12>>2],Kg(C,m)|0,m=nd(C,w)|0;while(m|0);m=wu(C)|0}while(m|0);return Aa(C),m=Or(y)|0,m?(hn(y),L=m,Ie=R,L|0):(L=0,Ie=R,L|0)}function yr(m){return m=m|0,m>>>0>121?(m=0,m|0):(m=g[7696+(m*28|0)+16>>2]|0,m|0)}function Lr(m){return m=m|0,(m|0)==4|(m|0)==117|0}function Fi(m){return m=m|0,g[11120+((g[m>>2]|0)*216|0)+((g[m+4>>2]|0)*72|0)+((g[m+8>>2]|0)*24|0)+(g[m+12>>2]<<3)>>2]|0}function vr(m){return m=m|0,g[11120+((g[m>>2]|0)*216|0)+((g[m+4>>2]|0)*72|0)+((g[m+8>>2]|0)*24|0)+(g[m+12>>2]<<3)+4>>2]|0}function jr(m,A){m=m|0,A=A|0,m=7696+(m*28|0)|0,g[A>>2]=g[m>>2],g[A+4>>2]=g[m+4>>2],g[A+8>>2]=g[m+8>>2],g[A+12>>2]=g[m+12>>2]}function Ci(m,A){m=m|0,A=A|0;var y=0,w=0;if(A>>>0>20)return A=-1,A|0;do if((g[11120+(A*216|0)>>2]|0)!=(m|0))if((g[11120+(A*216|0)+8>>2]|0)!=(m|0))if((g[11120+(A*216|0)+16>>2]|0)!=(m|0))if((g[11120+(A*216|0)+24>>2]|0)!=(m|0))if((g[11120+(A*216|0)+32>>2]|0)!=(m|0))if((g[11120+(A*216|0)+40>>2]|0)!=(m|0))if((g[11120+(A*216|0)+48>>2]|0)!=(m|0))if((g[11120+(A*216|0)+56>>2]|0)!=(m|0))if((g[11120+(A*216|0)+64>>2]|0)!=(m|0))if((g[11120+(A*216|0)+72>>2]|0)!=(m|0))if((g[11120+(A*216|0)+80>>2]|0)!=(m|0))if((g[11120+(A*216|0)+88>>2]|0)!=(m|0))if((g[11120+(A*216|0)+96>>2]|0)!=(m|0))if((g[11120+(A*216|0)+104>>2]|0)!=(m|0))if((g[11120+(A*216|0)+112>>2]|0)!=(m|0))if((g[11120+(A*216|0)+120>>2]|0)!=(m|0))if((g[11120+(A*216|0)+128>>2]|0)!=(m|0))if((g[11120+(A*216|0)+136>>2]|0)==(m|0))m=2,y=1,w=2;else{if((g[11120+(A*216|0)+144>>2]|0)==(m|0)){m=0,y=2,w=0;break}if((g[11120+(A*216|0)+152>>2]|0)==(m|0)){m=0,y=2,w=1;break}if((g[11120+(A*216|0)+160>>2]|0)==(m|0)){m=0,y=2,w=2;break}if((g[11120+(A*216|0)+168>>2]|0)==(m|0)){m=1,y=2,w=0;break}if((g[11120+(A*216|0)+176>>2]|0)==(m|0)){m=1,y=2,w=1;break}if((g[11120+(A*216|0)+184>>2]|0)==(m|0)){m=1,y=2,w=2;break}if((g[11120+(A*216|0)+192>>2]|0)==(m|0)){m=2,y=2,w=0;break}if((g[11120+(A*216|0)+200>>2]|0)==(m|0)){m=2,y=2,w=1;break}if((g[11120+(A*216|0)+208>>2]|0)==(m|0)){m=2,y=2,w=2;break}else m=-1;return m|0}else m=2,y=1,w=1;else m=2,y=1,w=0;else m=1,y=1,w=2;else m=1,y=1,w=1;else m=1,y=1,w=0;else m=0,y=1,w=2;else m=0,y=1,w=1;else m=0,y=1,w=0;else m=2,y=0,w=2;else m=2,y=0,w=1;else m=2,y=0,w=0;else m=1,y=0,w=2;else m=1,y=0,w=1;else m=1,y=0,w=0;else m=0,y=0,w=2;else m=0,y=0,w=1;else m=0,y=0,w=0;while(0);return A=g[11120+(A*216|0)+(y*72|0)+(m*24|0)+(w<<3)+4>>2]|0,A|0}function fi(m,A){return m=m|0,A=A|0,(g[7696+(m*28|0)+20>>2]|0)==(A|0)?(A=1,A|0):(A=(g[7696+(m*28|0)+24>>2]|0)==(A|0),A|0)}function Mn(m,A){return m=m|0,A=A|0,g[848+(m*28|0)+(A<<2)>>2]|0}function rs(m,A){return m=m|0,A=A|0,(g[848+(m*28|0)>>2]|0)==(A|0)?(A=0,A|0):(g[848+(m*28|0)+4>>2]|0)==(A|0)?(A=1,A|0):(g[848+(m*28|0)+8>>2]|0)==(A|0)?(A=2,A|0):(g[848+(m*28|0)+12>>2]|0)==(A|0)?(A=3,A|0):(g[848+(m*28|0)+16>>2]|0)==(A|0)?(A=4,A|0):(g[848+(m*28|0)+20>>2]|0)==(A|0)?(A=5,A|0):((g[848+(m*28|0)+24>>2]|0)==(A|0)?6:7)|0}function js(){return 122}function Va(m){m=m|0;var A=0,y=0,w=0;A=0;do Sr(A|0,0,45)|0,w=Fe()|0|134225919,y=m+(A<<3)|0,g[y>>2]=-1,g[y+4>>2]=w,A=A+1|0;while((A|0)!=122);return 0}function ta(m){return m=m|0,+Re[m+16>>3]<+Re[m+24>>3]|0}function dl(m,A){m=m|0,A=A|0;var y=0,w=0,C=0;return y=+Re[A>>3],!(y>=+Re[m+8>>3])||!(y<=+Re[m>>3])?(A=0,A|0):(w=+Re[m+16>>3],y=+Re[m+24>>3],C=+Re[A+8>>3],A=C>=y,m=C<=w&1,w<y?A&&(m=1):A||(m=0),A=(m|0)!=0,A|0)}function vo(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0;Ye=Ie,Ie=Ie+288|0,pe=Ye+264|0,De=Ye+96|0,te=Ye,N=te,X=N+96|0;do g[N>>2]=0,N=N+4|0;while((N|0)<(X|0));return A=B(A,te)|0,A|0?(nt=A,Ie=Ye,nt|0):(X=te,te=g[X>>2]|0,X=g[X+4>>2]|0,yu(te,X,pe)|0,d(te,X,De)|0,L=+Me(pe,De+8|0),Re[pe>>3]=+Re[m>>3],X=pe+8|0,Re[X>>3]=+Re[m+16>>3],Re[De>>3]=+Re[m+8>>3],te=De+8|0,Re[te>>3]=+Re[m+24>>3],C=+Me(pe,De),zt=+Re[X>>3]-+Re[te>>3],R=+En(+zt),yt=+Re[pe>>3]-+Re[De>>3],w=+En(+yt),!(zt==0|yt==0)&&(zt=+Yw(+R,+w),zt=+fu(+(C*C/+Av(+(zt/+Av(+R,+w)),3)/(L*(L*2.59807621135)*.8))),Re[Ti>>3]=zt,$e=~~zt>>>0,nt=+En(zt)>=1?zt>0?~~+hu(+Qn(zt/4294967296),4294967295)>>>0:~~+fu((zt-+(~~zt>>>0))/4294967296)>>>0:0,(g[Ti+4>>2]&2146435072|0)!=2146435072)?(De=($e|0)==0&(nt|0)==0,A=y,g[A>>2]=De?1:$e,g[A+4>>2]=De?0:nt,A=0):A=1,nt=A,Ie=Ye,nt|0)}function us(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0,pe=0;te=Ie,Ie=Ie+288|0,L=te+264|0,N=te+96|0,X=te,C=X,R=C+96|0;do g[C>>2]=0,C=C+4|0;while((C|0)<(R|0));return y=B(y,X)|0,y|0?(w=y,Ie=te,w|0):(y=X,C=g[y>>2]|0,y=g[y+4>>2]|0,yu(C,y,L)|0,d(C,y,N)|0,pe=+Me(L,N+8|0),pe=+fu(+(+Me(m,A)/(pe*2))),Re[Ti>>3]=pe,y=~~pe>>>0,C=+En(pe)>=1?pe>0?~~+hu(+Qn(pe/4294967296),4294967295)>>>0:~~+fu((pe-+(~~pe>>>0))/4294967296)>>>0:0,(g[Ti+4>>2]&2146435072|0)==2146435072?(w=1,Ie=te,w|0):(X=(y|0)==0&(C|0)==0,g[w>>2]=X?1:y,g[w+4>>2]=X?0:C,w=0,Ie=te,w|0))}function Jh(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0,g[m>>2]=A,g[m+4>>2]=y,g[m+8>>2]=w}function Yg(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0;De=A+8|0,g[De>>2]=0,X=+Re[m>>3],L=+En(+X),te=+Re[m+8>>3],N=+En(+te)/.8660254037844386,L=L+N*.5,y=~~L,m=~~N,L=L-+(y|0),N=N-+(m|0);do if(L<.5)if(L<.3333333333333333)if(g[A>>2]=y,N<(L+1)*.5){g[A+4>>2]=m;break}else{m=m+1|0,g[A+4>>2]=m;break}else if($e=1-L,m=(!(N<$e)&1)+m|0,g[A+4>>2]=m,$e<=N&N<L*2){y=y+1|0,g[A>>2]=y;break}else{g[A>>2]=y;break}else{if(!(L<.6666666666666666))if(y=y+1|0,g[A>>2]=y,N<L*.5){g[A+4>>2]=m;break}else{m=m+1|0,g[A+4>>2]=m;break}if(N<1-L){if(g[A+4>>2]=m,L*2+-1<N){g[A>>2]=y;break}}else m=m+1|0,g[A+4>>2]=m;y=y+1|0,g[A>>2]=y}while(0);do if(X<0)if(m&1){pe=(m+1|0)/2|0,pe=Pa(y|0,((y|0)<0)<<31>>31|0,pe|0,((pe|0)<0)<<31>>31|0)|0,y=~~(+(y|0)-((+(pe>>>0)+4294967296*+(Fe()|0))*2+1)),g[A>>2]=y;break}else{pe=(m|0)/2|0,pe=Pa(y|0,((y|0)<0)<<31>>31|0,pe|0,((pe|0)<0)<<31>>31|0)|0,y=~~(+(y|0)-(+(pe>>>0)+4294967296*+(Fe()|0))*2),g[A>>2]=y;break}while(0);pe=A+4|0,te<0&&(y=y-((m<<1|1|0)/2|0)|0,g[A>>2]=y,m=0-m|0,g[pe>>2]=m),w=m-y|0,(y|0)<0?(C=0-y|0,g[pe>>2]=w,g[De>>2]=C,g[A>>2]=0,m=w,y=0):C=0,(m|0)<0&&(y=y-m|0,g[A>>2]=y,C=C-m|0,g[De>>2]=C,g[pe>>2]=0,m=0),R=y-C|0,w=m-C|0,(C|0)<0&&(g[A>>2]=R,g[pe>>2]=w,g[De>>2]=0,m=w,y=R,C=0),w=(m|0)<(y|0)?m:y,w=(C|0)<(w|0)?C:w,!((w|0)<=0)&&(g[A>>2]=y-w,g[pe>>2]=m-w,g[De>>2]=C-w)}function xn(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0;A=g[m>>2]|0,L=m+4|0,y=g[L>>2]|0,(A|0)<0&&(y=y-A|0,g[L>>2]=y,R=m+8|0,g[R>>2]=(g[R>>2]|0)-A,g[m>>2]=0,A=0),(y|0)<0?(A=A-y|0,g[m>>2]=A,R=m+8|0,C=(g[R>>2]|0)-y|0,g[R>>2]=C,g[L>>2]=0,y=0):(C=m+8|0,R=C,C=g[C>>2]|0),(C|0)<0&&(A=A-C|0,g[m>>2]=A,y=y-C|0,g[L>>2]=y,g[R>>2]=0,C=0),w=(y|0)<(A|0)?y:A,w=(C|0)<(w|0)?C:w,!((w|0)<=0)&&(g[m>>2]=A-w,g[L>>2]=y-w,g[R>>2]=C-w)}function Tr(m,A){m=m|0,A=A|0;var y=0,w=0;w=g[m+8>>2]|0,y=+((g[m+4>>2]|0)-w|0),Re[A>>3]=+((g[m>>2]|0)-w|0)-y*.5,Re[A+8>>3]=y*.8660254037844386}function lo(m,A,y){m=m|0,A=A|0,y=y|0,g[y>>2]=(g[A>>2]|0)+(g[m>>2]|0),g[y+4>>2]=(g[A+4>>2]|0)+(g[m+4>>2]|0),g[y+8>>2]=(g[A+8>>2]|0)+(g[m+8>>2]|0)}function Qf(m,A,y){m=m|0,A=A|0,y=y|0,g[y>>2]=(g[m>>2]|0)-(g[A>>2]|0),g[y+4>>2]=(g[m+4>>2]|0)-(g[A+4>>2]|0),g[y+8>>2]=(g[m+8>>2]|0)-(g[A+8>>2]|0)}function nf(m,A){m=m|0,A=A|0;var y=0,w=0;y=fl(g[m>>2]|0,A)|0,g[m>>2]=y,y=m+4|0,w=fl(g[y>>2]|0,A)|0,g[y>>2]=w,m=m+8|0,A=fl(g[m>>2]|0,A)|0,g[m>>2]=A}function Ha(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;L=g[m>>2]|0,N=(L|0)<0,w=(g[m+4>>2]|0)-(N?L:0)|0,R=(w|0)<0,C=(R?0-w|0:0)+((g[m+8>>2]|0)-(N?L:0))|0,y=(C|0)<0,m=y?0:C,A=(R?0:w)-(y?C:0)|0,C=(N?0:L)-(R?w:0)-(y?C:0)|0,y=(A|0)<(C|0)?A:C,y=(m|0)<(y|0)?m:y,w=(y|0)>0,m=m-(w?y:0)|0,A=A-(w?y:0)|0;e:do switch(C-(w?y:0)|0){case 0:switch(A|0){case 0:return N=m|0?(m|0)==1?1:7:0,N|0;case 1:return N=m|0?(m|0)==1?3:7:2,N|0;default:break e}case 1:switch(A|0){case 0:return N=m|0?(m|0)==1?5:7:4,N|0;case 1:{if(!m)m=6;else break e;return m|0}default:break e}default:}while(0);return N=7,N|0}function ja(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;L=m+8|0,C=g[L>>2]|0,R=(g[m>>2]|0)-C|0,N=m+4|0,C=(g[N>>2]|0)-C|0;do if(R>>>0>715827881|C>>>0>715827881){if(y=(R|0)>0,y){if((2147483647-R|0)<(R|0)||(2147483647-(R<<1)|0)<(R|0))return N=1,N|0}else if((-2147483648-R|0)>(R|0)||(-2147483648-(R<<1)|0)>(R|0))return N=1,N|0;if(A=R*3|0,(C|0)>0){if((2147483647-C|0)<(C|0))return N=1,N|0}else if((-2147483648-C|0)>(C|0))return N=1,N|0;if(w=C<<1,(R|0)>-1){if((A|-2147483648|0)>=(C|0))return N=1,N|0}else if((A^-2147483648|0)<(C|0))return N=1,N|0;if(y){if((2147483647-R|0)<(w|0))A=1;else{y=w;break}return A|0}else{if((-2147483648-R|0)>(w|0))A=1;else{y=w;break}return A|0}}else y=C<<1,A=R*3|0;while(0);w=Zl(+(A-C|0)/7)|0,g[m>>2]=w,C=Zl(+(y+R|0)/7)|0,g[N>>2]=C,g[L>>2]=0,y=(C|0)<(w|0),A=y?w:C,y=y?C:w;do if((y|0)<0){if((A|0)>0){if((A|-2147483648|0)<(y|0)&((y|0)!=-2147483648&(2147483647-A|0)>=(y|0)))break;_i(23313,22444,355,22455)}if((y|0)==-2147483648|(-2147483648-A|0)>(y|0)&&_i(23313,22444,355,22455),(A|0)>-1){if((A|-2147483648|0)<(y|0))break;_i(23313,22444,355,22455)}else{if((A^-2147483648|0)>=(y|0))break;_i(23313,22444,355,22455)}}while(0);return A=C-w|0,(w|0)<0?(y=0-w|0,g[N>>2]=A,g[L>>2]=y,g[m>>2]=0,w=0):(A=C,y=0),(A|0)<0&&(w=w-A|0,g[m>>2]=w,y=y-A|0,g[L>>2]=y,g[N>>2]=0,A=0),R=w-y|0,C=A-y|0,(y|0)<0?(g[m>>2]=R,g[N>>2]=C,g[L>>2]=0,A=C,C=R,y=0):C=w,w=(A|0)<(C|0)?A:C,w=(y|0)<(w|0)?y:w,(w|0)<=0?(N=0,N|0):(g[m>>2]=C-w,g[N>>2]=A-w,g[L>>2]=y-w,N=0,N|0)}function LA(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;L=m+8|0,C=g[L>>2]|0,R=(g[m>>2]|0)-C|0,N=m+4|0,C=(g[N>>2]|0)-C|0;do if(R>>>0>715827881|C>>>0>715827881){if(y=(R|0)>0,y){if((2147483647-R|0)<(R|0))return N=1,N|0}else if((-2147483648-R|0)>(R|0))return N=1,N|0;if(A=R<<1,(C|0)>0){if((2147483647-C|0)<(C|0)||(2147483647-(C<<1)|0)<(C|0))return N=1,N|0}else if((-2147483648-C|0)>(C|0)||(-2147483648-(C<<1)|0)>(C|0))return N=1,N|0;if(w=C*3|0,y){if((2147483647-A|0)<(C|0))return N=1,N|0}else if((-2147483648-A|0)>(C|0))return N=1,N|0;if((C|0)>-1){if((w|-2147483648|0)<(R|0)){y=w;break}else A=1;return A|0}else{if((w^-2147483648|0)<(R|0))A=1;else{y=w;break}return A|0}}else y=C*3|0,A=R<<1;while(0);w=Zl(+(A+C|0)/7)|0,g[m>>2]=w,C=Zl(+(y-R|0)/7)|0,g[N>>2]=C,g[L>>2]=0,y=(C|0)<(w|0),A=y?w:C,y=y?C:w;do if((y|0)<0){if((A|0)>0){if((A|-2147483648|0)<(y|0)&((y|0)!=-2147483648&(2147483647-A|0)>=(y|0)))break;_i(23313,22444,404,22469)}if((y|0)==-2147483648|(-2147483648-A|0)>(y|0)&&_i(23313,22444,404,22469),(A|0)>-1){if((A|-2147483648|0)<(y|0))break;_i(23313,22444,404,22469)}else{if((A^-2147483648|0)>=(y|0))break;_i(23313,22444,404,22469)}}while(0);return A=C-w|0,(w|0)<0?(y=0-w|0,g[N>>2]=A,g[L>>2]=y,g[m>>2]=0,w=0):(A=C,y=0),(A|0)<0&&(w=w-A|0,g[m>>2]=w,y=y-A|0,g[L>>2]=y,g[N>>2]=0,A=0),R=w-y|0,C=A-y|0,(y|0)<0?(g[m>>2]=R,g[N>>2]=C,g[L>>2]=0,A=C,C=R,y=0):C=w,w=(A|0)<(C|0)?A:C,w=(y|0)<(w|0)?y:w,(w|0)<=0?(N=0,N|0):(g[m>>2]=C-w,g[N>>2]=A-w,g[L>>2]=y-w,N=0,N|0)}function gr(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;L=m+8|0,y=g[L>>2]|0,A=(g[m>>2]|0)-y|0,N=m+4|0,y=(g[N>>2]|0)-y|0,w=Zl(+((A*3|0)-y|0)/7)|0,g[m>>2]=w,A=Zl(+((y<<1)+A|0)/7)|0,g[N>>2]=A,g[L>>2]=0,y=A-w|0,(w|0)<0?(R=0-w|0,g[N>>2]=y,g[L>>2]=R,g[m>>2]=0,A=y,w=0,y=R):y=0,(A|0)<0&&(w=w-A|0,g[m>>2]=w,y=y-A|0,g[L>>2]=y,g[N>>2]=0,A=0),R=w-y|0,C=A-y|0,(y|0)<0?(g[m>>2]=R,g[N>>2]=C,g[L>>2]=0,A=C,C=R,y=0):C=w,w=(A|0)<(C|0)?A:C,w=(y|0)<(w|0)?y:w,!((w|0)<=0)&&(g[m>>2]=C-w,g[N>>2]=A-w,g[L>>2]=y-w)}function up(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;L=m+8|0,y=g[L>>2]|0,A=(g[m>>2]|0)-y|0,N=m+4|0,y=(g[N>>2]|0)-y|0,w=Zl(+((A<<1)+y|0)/7)|0,g[m>>2]=w,A=Zl(+((y*3|0)-A|0)/7)|0,g[N>>2]=A,g[L>>2]=0,y=A-w|0,(w|0)<0?(R=0-w|0,g[N>>2]=y,g[L>>2]=R,g[m>>2]=0,A=y,w=0,y=R):y=0,(A|0)<0&&(w=w-A|0,g[m>>2]=w,y=y-A|0,g[L>>2]=y,g[N>>2]=0,A=0),R=w-y|0,C=A-y|0,(y|0)<0?(g[m>>2]=R,g[N>>2]=C,g[L>>2]=0,A=C,C=R,y=0):C=w,w=(A|0)<(C|0)?A:C,w=(y|0)<(w|0)?y:w,!((w|0)<=0)&&(g[m>>2]=C-w,g[N>>2]=A-w,g[L>>2]=y-w)}function of(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;A=g[m>>2]|0,L=m+4|0,y=g[L>>2]|0,N=m+8|0,w=g[N>>2]|0,C=y+(A*3|0)|0,g[m>>2]=C,y=w+(y*3|0)|0,g[L>>2]=y,A=(w*3|0)+A|0,g[N>>2]=A,w=y-C|0,(C|0)<0?(A=A-C|0,g[L>>2]=w,g[N>>2]=A,g[m>>2]=0,y=w,w=0):w=C,(y|0)<0&&(w=w-y|0,g[m>>2]=w,A=A-y|0,g[N>>2]=A,g[L>>2]=0,y=0),R=w-A|0,C=y-A|0,(A|0)<0?(g[m>>2]=R,g[L>>2]=C,g[N>>2]=0,w=R,A=0):C=y,y=(C|0)<(w|0)?C:w,y=(A|0)<(y|0)?A:y,!((y|0)<=0)&&(g[m>>2]=w-y,g[L>>2]=C-y,g[N>>2]=A-y)}function Gc(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;C=g[m>>2]|0,L=m+4|0,A=g[L>>2]|0,N=m+8|0,y=g[N>>2]|0,w=(A*3|0)+C|0,C=y+(C*3|0)|0,g[m>>2]=C,g[L>>2]=w,A=(y*3|0)+A|0,g[N>>2]=A,y=w-C|0,(C|0)<0?(A=A-C|0,g[L>>2]=y,g[N>>2]=A,g[m>>2]=0,C=0):y=w,(y|0)<0&&(C=C-y|0,g[m>>2]=C,A=A-y|0,g[N>>2]=A,g[L>>2]=0,y=0),R=C-A|0,w=y-A|0,(A|0)<0?(g[m>>2]=R,g[L>>2]=w,g[N>>2]=0,C=R,A=0):w=y,y=(w|0)<(C|0)?w:C,y=(A|0)<(y|0)?A:y,!((y|0)<=0)&&(g[m>>2]=C-y,g[L>>2]=w-y,g[N>>2]=A-y)}function pl(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0;(A+-1|0)>>>0>=6||(C=(g[15440+(A*12|0)>>2]|0)+(g[m>>2]|0)|0,g[m>>2]=C,N=m+4|0,w=(g[15440+(A*12|0)+4>>2]|0)+(g[N>>2]|0)|0,g[N>>2]=w,L=m+8|0,A=(g[15440+(A*12|0)+8>>2]|0)+(g[L>>2]|0)|0,g[L>>2]=A,y=w-C|0,(C|0)<0?(A=A-C|0,g[N>>2]=y,g[L>>2]=A,g[m>>2]=0,w=0):(y=w,w=C),(y|0)<0&&(w=w-y|0,g[m>>2]=w,A=A-y|0,g[L>>2]=A,g[N>>2]=0,y=0),R=w-A|0,C=y-A|0,(A|0)<0?(g[m>>2]=R,g[N>>2]=C,g[L>>2]=0,w=R,A=0):C=y,y=(C|0)<(w|0)?C:w,y=(A|0)<(y|0)?A:y,!((y|0)<=0)&&(g[m>>2]=w-y,g[N>>2]=C-y,g[L>>2]=A-y))}function Ca(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;C=g[m>>2]|0,L=m+4|0,A=g[L>>2]|0,N=m+8|0,y=g[N>>2]|0,w=A+C|0,C=y+C|0,g[m>>2]=C,g[L>>2]=w,A=y+A|0,g[N>>2]=A,y=w-C|0,(C|0)<0?(A=A-C|0,g[L>>2]=y,g[N>>2]=A,g[m>>2]=0,w=0):(y=w,w=C),(y|0)<0&&(w=w-y|0,g[m>>2]=w,A=A-y|0,g[N>>2]=A,g[L>>2]=0,y=0),R=w-A|0,C=y-A|0,(A|0)<0?(g[m>>2]=R,g[L>>2]=C,g[N>>2]=0,w=R,A=0):C=y,y=(C|0)<(w|0)?C:w,y=(A|0)<(y|0)?A:y,!((y|0)<=0)&&(g[m>>2]=w-y,g[L>>2]=C-y,g[N>>2]=A-y)}function sf(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;A=g[m>>2]|0,L=m+4|0,w=g[L>>2]|0,N=m+8|0,y=g[N>>2]|0,C=w+A|0,g[m>>2]=C,w=y+w|0,g[L>>2]=w,A=y+A|0,g[N>>2]=A,y=w-C|0,(C|0)<0?(A=A-C|0,g[L>>2]=y,g[N>>2]=A,g[m>>2]=0,w=0):(y=w,w=C),(y|0)<0&&(w=w-y|0,g[m>>2]=w,A=A-y|0,g[N>>2]=A,g[L>>2]=0,y=0),R=w-A|0,C=y-A|0,(A|0)<0?(g[m>>2]=R,g[L>>2]=C,g[N>>2]=0,w=R,A=0):C=y,y=(C|0)<(w|0)?C:w,y=(A|0)<(y|0)?A:y,!((y|0)<=0)&&(g[m>>2]=w-y,g[L>>2]=C-y,g[N>>2]=A-y)}function dc(m){switch(m=m|0,m|0){case 1:{m=5;break}case 5:{m=4;break}case 4:{m=6;break}case 6:{m=2;break}case 2:{m=3;break}case 3:{m=1;break}default:}return m|0}function fs(m){switch(m=m|0,m|0){case 1:{m=3;break}case 3:{m=2;break}case 2:{m=6;break}case 6:{m=4;break}case 4:{m=5;break}case 5:{m=1;break}default:}return m|0}function pc(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;A=g[m>>2]|0,L=m+4|0,y=g[L>>2]|0,N=m+8|0,w=g[N>>2]|0,C=y+(A<<1)|0,g[m>>2]=C,y=w+(y<<1)|0,g[L>>2]=y,A=(w<<1)+A|0,g[N>>2]=A,w=y-C|0,(C|0)<0?(A=A-C|0,g[L>>2]=w,g[N>>2]=A,g[m>>2]=0,y=w,w=0):w=C,(y|0)<0&&(w=w-y|0,g[m>>2]=w,A=A-y|0,g[N>>2]=A,g[L>>2]=0,y=0),R=w-A|0,C=y-A|0,(A|0)<0?(g[m>>2]=R,g[L>>2]=C,g[N>>2]=0,w=R,A=0):C=y,y=(C|0)<(w|0)?C:w,y=(A|0)<(y|0)?A:y,!((y|0)<=0)&&(g[m>>2]=w-y,g[L>>2]=C-y,g[N>>2]=A-y)}function FA(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;C=g[m>>2]|0,L=m+4|0,A=g[L>>2]|0,N=m+8|0,y=g[N>>2]|0,w=(A<<1)+C|0,C=y+(C<<1)|0,g[m>>2]=C,g[L>>2]=w,A=(y<<1)+A|0,g[N>>2]=A,y=w-C|0,(C|0)<0?(A=A-C|0,g[L>>2]=y,g[N>>2]=A,g[m>>2]=0,C=0):y=w,(y|0)<0&&(C=C-y|0,g[m>>2]=C,A=A-y|0,g[N>>2]=A,g[L>>2]=0,y=0),R=C-A|0,w=y-A|0,(A|0)<0?(g[m>>2]=R,g[L>>2]=w,g[N>>2]=0,C=R,A=0):w=y,y=(w|0)<(C|0)?w:C,y=(A|0)<(y|0)?A:y,!((y|0)<=0)&&(g[m>>2]=C-y,g[L>>2]=w-y,g[N>>2]=A-y)}function af(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0;return L=(g[m>>2]|0)-(g[A>>2]|0)|0,N=(L|0)<0,w=(g[m+4>>2]|0)-(g[A+4>>2]|0)-(N?L:0)|0,R=(w|0)<0,C=(N?0-L|0:0)+(g[m+8>>2]|0)-(g[A+8>>2]|0)+(R?0-w|0:0)|0,m=(C|0)<0,A=m?0:C,y=(R?0:w)-(m?C:0)|0,C=(N?0:L)-(R?w:0)-(m?C:0)|0,m=(y|0)<(C|0)?y:C,m=(A|0)<(m|0)?A:m,w=(m|0)>0,A=A-(w?m:0)|0,y=y-(w?m:0)|0,m=C-(w?m:0)|0,m=(m|0)>-1?m:0-m|0,y=(y|0)>-1?y:0-y|0,A=(A|0)>-1?A:0-A|0,A=(y|0)>(A|0)?y:A,((m|0)>(A|0)?m:A)|0}function NA(m,A){m=m|0,A=A|0;var y=0;y=g[m+8>>2]|0,g[A>>2]=(g[m>>2]|0)-y,g[A+4>>2]=(g[m+4>>2]|0)-y}function kA(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0;w=g[m>>2]|0,g[A>>2]=w,C=g[m+4>>2]|0,L=A+4|0,g[L>>2]=C,N=A+8|0,g[N>>2]=0,y=(C|0)<(w|0),m=y?w:C,y=y?C:w;do if((y|0)<0){if((m|0)>0){if((m|-2147483648|0)<(y|0)&((y|0)!=-2147483648&(2147483647-m|0)>=(y|0)))break;return m=1,m|0}if((y|0)==-2147483648|(-2147483648-m|0)>(y|0))return A=1,A|0;if((m|0)>-1){if((m|-2147483648|0)<(y|0))break;return m=1,m|0}else{if((m^-2147483648|0)<(y|0))m=1;else break;return m|0}}while(0);return m=C-w|0,(w|0)<0?(y=0-w|0,g[L>>2]=m,g[N>>2]=y,g[A>>2]=0,w=0):(m=C,y=0),(m|0)<0&&(w=w-m|0,g[A>>2]=w,y=y-m|0,g[N>>2]=y,g[L>>2]=0,m=0),R=w-y|0,C=m-y|0,(y|0)<0?(g[A>>2]=R,g[L>>2]=C,g[N>>2]=0,m=C,C=R,y=0):C=w,w=(m|0)<(C|0)?m:C,w=(y|0)<(w|0)?y:w,(w|0)<=0?(A=0,A|0):(g[A>>2]=C-w,g[L>>2]=m-w,g[N>>2]=y-w,A=0,A|0)}function Il(m){m=m|0;var A=0,y=0,w=0,C=0;A=m+8|0,C=g[A>>2]|0,y=C-(g[m>>2]|0)|0,g[m>>2]=y,w=m+4|0,m=(g[w>>2]|0)-C|0,g[w>>2]=m,g[A>>2]=0-(m+y)}function Al(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;y=g[m>>2]|0,A=0-y|0,g[m>>2]=A,L=m+8|0,g[L>>2]=0,N=m+4|0,w=g[N>>2]|0,C=w+y|0,(y|0)>0?(g[N>>2]=C,g[L>>2]=y,g[m>>2]=0,A=0,w=C):y=0,(w|0)<0?(R=A-w|0,g[m>>2]=R,y=y-w|0,g[L>>2]=y,g[N>>2]=0,C=R-y|0,A=0-y|0,(y|0)<0?(g[m>>2]=C,g[N>>2]=A,g[L>>2]=0,w=A,y=0):(w=0,C=R)):C=A,A=(w|0)<(C|0)?w:C,A=(y|0)<(A|0)?y:A,!((A|0)<=0)&&(g[m>>2]=C-A,g[N>>2]=w-A,g[L>>2]=y-A)}function qi(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0;if(De=Ie,Ie=Ie+64|0,pe=De,N=De+56|0,!(!0&(A&2013265920|0)==134217728&(!0&(w&2013265920|0)==134217728)))return C=5,Ie=De,C|0;if((m|0)==(y|0)&(A|0)==(w|0))return g[C>>2]=0,C=0,Ie=De,C|0;if(L=nr(m|0,A|0,52)|0,Fe()|0,L=L&15,te=nr(y|0,w|0,52)|0,Fe()|0,(L|0)!=(te&15|0))return C=12,Ie=De,C|0;if(R=L+-1|0,L>>>0>1){$h(m,A,R,pe)|0,$h(y,w,R,N)|0,te=pe,X=g[te>>2]|0,te=g[te+4>>2]|0;e:do if((X|0)==(g[N>>2]|0)&&(te|0)==(g[N+4>>2]|0)){L=(L^15)*3|0,R=nr(m|0,A|0,L|0)|0,Fe()|0,R=R&7,L=nr(y|0,w|0,L|0)|0,Fe()|0,L=L&7;do if((R|0)==0|(L|0)==0)g[C>>2]=1,R=0;else if((R|0)==7)R=5;else{if((R|0)==1|(L|0)==1&&mn(X,te)|0){R=5;break}if((g[15536+(R<<2)>>2]|0)!=(L|0)&&(g[15568+(R<<2)>>2]|0)!=(L|0))break e;g[C>>2]=1,R=0}while(0);return C=R,Ie=De,C|0}while(0)}R=pe,L=R+56|0;do g[R>>2]=0,R=R+4|0;while((R|0)<(L|0));return jc(m,A,1,pe)|0,A=pe,!((g[A>>2]|0)==(y|0)&&(g[A+4>>2]|0)==(w|0))&&(A=pe+8|0,!((g[A>>2]|0)==(y|0)&&(g[A+4>>2]|0)==(w|0)))&&(A=pe+16|0,!((g[A>>2]|0)==(y|0)&&(g[A+4>>2]|0)==(w|0)))&&(A=pe+24|0,!((g[A>>2]|0)==(y|0)&&(g[A+4>>2]|0)==(w|0)))&&(A=pe+32|0,!((g[A>>2]|0)==(y|0)&&(g[A+4>>2]|0)==(w|0)))&&(A=pe+40|0,!((g[A>>2]|0)==(y|0)&&(g[A+4>>2]|0)==(w|0)))?(R=pe+48|0,R=((g[R>>2]|0)==(y|0)?(g[R+4>>2]|0)==(w|0):0)&1):R=1,g[C>>2]=R,C=0,Ie=De,C|0}function Ac(m,A,y,w,C){return m=m|0,A=A|0,y=y|0,w=w|0,C=C|0,y=ze(m,A,y,w)|0,(y|0)==7?(C=11,C|0):(w=Sr(y|0,0,56)|0,A=A&-2130706433|(Fe()|0)|268435456,g[C>>2]=m|w,g[C+4>>2]=A,C=0,C|0)}function Pl(m,A,y){return m=m|0,A=A|0,y=y|0,!0&(A&2013265920|0)==268435456?(g[y>>2]=m,g[y+4>>2]=A&-2130706433|134217728,y=0,y|0):(y=6,y|0)}function Gs(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0;return C=Ie,Ie=Ie+16|0,w=C,g[w>>2]=0,!0&(A&2013265920|0)==268435456?(R=nr(m|0,A|0,56)|0,Fe()|0,w=Vo(m,A&-2130706433|134217728,R&7,w,y)|0,Ie=C,w|0):(w=6,Ie=C,w|0)}function lf(m,A){m=m|0,A=A|0;var y=0;switch(y=nr(m|0,A|0,56)|0,Fe()|0,y&7){case 0:case 7:return y=0,y|0;default:}return y=A&-2130706433|134217728,!(!0&(A&2013265920|0)==268435456)||!0&(A&117440512|0)==16777216&(mn(m,y)|0)!=0?(y=0,y|0):(y=Wc(m,y)|0,y|0)}function pu(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0;return C=Ie,Ie=Ie+16|0,w=C,!0&(A&2013265920|0)==268435456?(R=A&-2130706433|134217728,L=y,g[L>>2]=m,g[L+4>>2]=R,g[w>>2]=0,A=nr(m|0,A|0,56)|0,Fe()|0,w=Vo(m,R,A&7,w,y+8|0)|0,Ie=C,w|0):(w=6,Ie=C,w|0)}function Yl(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0;return C=(mn(m,A)|0)==0,A=A&-2130706433,w=y,g[w>>2]=C?m:0,g[w+4>>2]=C?A|285212672:0,w=y+8|0,g[w>>2]=m,g[w+4>>2]=A|301989888,w=y+16|0,g[w>>2]=m,g[w+4>>2]=A|318767104,w=y+24|0,g[w>>2]=m,g[w+4>>2]=A|335544320,w=y+32|0,g[w>>2]=m,g[w+4>>2]=A|352321536,y=y+40|0,g[y>>2]=m,g[y+4>>2]=A|369098752,0}function Ps(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0;return L=Ie,Ie=Ie+16|0,C=L,R=A&-2130706433|134217728,!0&(A&2013265920|0)==268435456?(w=nr(m|0,A|0,56)|0,Fe()|0,w=gc(m,R,w&7)|0,(w|0)==-1?(g[y>>2]=0,R=6,Ie=L,R|0):(_u(m,R,C)|0&&_i(23313,22484,282,22499),A=nr(m|0,A|0,52)|0,Fe()|0,A=A&15,mn(m,R)|0?ml(C,A,w,2,y):$f(C,A,w,2,y),R=0,Ie=L,R|0)):(R=6,Ie=L,R|0)}function Qh(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0;w=Ie,Ie=Ie+16|0,C=w,ei(m,A,y,C),Yg(C,y+4|0),Ie=w}function ei(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0;if(N=Ie,Ie=Ie+16|0,X=N,zr(m,y,X),R=+ea(+(1-+Re[X>>3]*.5)),R<1e-16){g[w>>2]=0,g[w+4>>2]=0,g[w+8>>2]=0,g[w+12>>2]=0,Ie=N;return}if(X=g[y>>2]|0,C=+Re[15920+(X*24|0)>>3],C=+ue(C-+ue(+Ue(15600+(X<<4)|0,m))),Zo(A)|0?L=+ue(C+-.3334731722518321):L=C,C=+an(+R)/.381966011250105,(A|0)>0){m=0;do C=C*2.6457513110645907,m=m+1|0;while((m|0)!=(A|0))}R=+ji(+L)*C,Re[w>>3]=R,L=+Gi(+L)*C,Re[w+8>>3]=L,Ie=N}function zr(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0;if(R=Ie,Ie=Ie+32|0,C=R,id(m,C),g[A>>2]=0,Re[y>>3]=5,w=+ro(16400,C),w<+Re[y>>3]&&(g[A>>2]=0,Re[y>>3]=w),w=+ro(16424,C),w<+Re[y>>3]&&(g[A>>2]=1,Re[y>>3]=w),w=+ro(16448,C),w<+Re[y>>3]&&(g[A>>2]=2,Re[y>>3]=w),w=+ro(16472,C),w<+Re[y>>3]&&(g[A>>2]=3,Re[y>>3]=w),w=+ro(16496,C),w<+Re[y>>3]&&(g[A>>2]=4,Re[y>>3]=w),w=+ro(16520,C),w<+Re[y>>3]&&(g[A>>2]=5,Re[y>>3]=w),w=+ro(16544,C),w<+Re[y>>3]&&(g[A>>2]=6,Re[y>>3]=w),w=+ro(16568,C),w<+Re[y>>3]&&(g[A>>2]=7,Re[y>>3]=w),w=+ro(16592,C),w<+Re[y>>3]&&(g[A>>2]=8,Re[y>>3]=w),w=+ro(16616,C),w<+Re[y>>3]&&(g[A>>2]=9,Re[y>>3]=w),w=+ro(16640,C),w<+Re[y>>3]&&(g[A>>2]=10,Re[y>>3]=w),w=+ro(16664,C),w<+Re[y>>3]&&(g[A>>2]=11,Re[y>>3]=w),w=+ro(16688,C),w<+Re[y>>3]&&(g[A>>2]=12,Re[y>>3]=w),w=+ro(16712,C),w<+Re[y>>3]&&(g[A>>2]=13,Re[y>>3]=w),w=+ro(16736,C),w<+Re[y>>3]&&(g[A>>2]=14,Re[y>>3]=w),w=+ro(16760,C),w<+Re[y>>3]&&(g[A>>2]=15,Re[y>>3]=w),w=+ro(16784,C),w<+Re[y>>3]&&(g[A>>2]=16,Re[y>>3]=w),w=+ro(16808,C),w<+Re[y>>3]&&(g[A>>2]=17,Re[y>>3]=w),w=+ro(16832,C),w<+Re[y>>3]&&(g[A>>2]=18,Re[y>>3]=w),w=+ro(16856,C),!(w<+Re[y>>3])){Ie=R;return}g[A>>2]=19,Re[y>>3]=w,Ie=R}function Au(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0;if(R=+xu(m),R<1e-16){A=15600+(A<<4)|0,g[C>>2]=g[A>>2],g[C+4>>2]=g[A+4>>2],g[C+8>>2]=g[A+8>>2],g[C+12>>2]=g[A+12>>2];return}if(L=+Ko(+ +Re[m+8>>3],+ +Re[m>>3]),(y|0)>0){m=0;do R=R/2.6457513110645907,m=m+1|0;while((m|0)!=(y|0))}w?(R=R/3,y=(Zo(y)|0)==0,R=+Hs(+((y?R:R/2.6457513110645907)*.381966011250105))):(R=+Hs(+(R*.381966011250105)),Zo(y)|0&&(L=+ue(L+.3334731722518321))),Ze(15600+(A<<4)|0,+ue(+Re[15920+(A*24|0)>>3]-L),R,C)}function da(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0;w=Ie,Ie=Ie+16|0,C=w,Tr(m+4|0,C),Au(C,g[m>>2]|0,A,0,y),Ie=w}function ml(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0,gt=0,Fr=0,Nr=0,Rr=0,Vr=0,io=0,Vn=0,Hn=0,Ui=0,tn=0,cn=0,co=0,zi=0;if(cn=Ie,Ie=Ie+272|0,R=cn+256|0,Et=cn+240|0,Hn=cn,Ui=cn+224|0,tn=cn+208|0,Bt=cn+176|0,gt=cn+160|0,Fr=cn+192|0,Nr=cn+144|0,Rr=cn+128|0,Vr=cn+112|0,io=cn+96|0,Vn=cn+80|0,g[R>>2]=A,g[Et>>2]=g[m>>2],g[Et+4>>2]=g[m+4>>2],g[Et+8>>2]=g[m+8>>2],g[Et+12>>2]=g[m+12>>2],Rs(Et,R,Hn),g[C>>2]=0,Et=w+y+((w|0)==5&1)|0,(Et|0)<=(y|0)){Ie=cn;return}X=g[R>>2]|0,te=Ui+4|0,pe=Bt+4|0,De=y+5|0,$e=16880+(X<<2)|0,nt=16960+(X<<2)|0,Ye=Rr+8|0,yt=Vr+8|0,zt=io+8|0,kt=tn+4|0,N=y;e:for(;;){L=Hn+(((N|0)%5|0)<<4)|0,g[tn>>2]=g[L>>2],g[tn+4>>2]=g[L+4>>2],g[tn+8>>2]=g[L+8>>2],g[tn+12>>2]=g[L+12>>2];do;while((Ma(tn,X,0,1)|0)==2);if((N|0)>(y|0)&(Zo(A)|0)!=0){if(g[Bt>>2]=g[tn>>2],g[Bt+4>>2]=g[tn+4>>2],g[Bt+8>>2]=g[tn+8>>2],g[Bt+12>>2]=g[tn+12>>2],Tr(te,gt),w=g[Bt>>2]|0,R=g[17040+(w*80|0)+(g[Ui>>2]<<2)>>2]|0,g[Bt>>2]=g[18640+(w*80|0)+(R*20|0)>>2],L=g[18640+(w*80|0)+(R*20|0)+16>>2]|0,(L|0)>0){m=0;do Ca(pe),m=m+1|0;while((m|0)<(L|0))}switch(L=18640+(w*80|0)+(R*20|0)+4|0,g[Fr>>2]=g[L>>2],g[Fr+4>>2]=g[L+4>>2],g[Fr+8>>2]=g[L+8>>2],nf(Fr,(g[$e>>2]|0)*3|0),lo(pe,Fr,pe),xn(pe),Tr(pe,Nr),co=+(g[nt>>2]|0),Re[Rr>>3]=co*3,Re[Ye>>3]=0,zi=co*-1.5,Re[Vr>>3]=zi,Re[yt>>3]=co*2.598076211353316,Re[io>>3]=zi,Re[zt>>3]=co*-2.598076211353316,g[17040+((g[Bt>>2]|0)*80|0)+(g[tn>>2]<<2)>>2]|0){case 1:{m=Vr,w=Rr;break}case 3:{m=io,w=Vr;break}case 2:{m=Rr,w=io;break}default:{m=12;break e}}uf(gt,Nr,w,m,Vn),Au(Vn,g[Bt>>2]|0,X,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1}if((N|0)<(De|0)&&(Tr(kt,Bt),Au(Bt,g[tn>>2]|0,X,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1),g[Ui>>2]=g[tn>>2],g[Ui+4>>2]=g[tn+4>>2],g[Ui+8>>2]=g[tn+8>>2],g[Ui+12>>2]=g[tn+12>>2],N=N+1|0,(N|0)>=(Et|0)){m=3;break}}if((m|0)==3){Ie=cn;return}else(m|0)==12&&_i(22522,22569,571,22579)}function Rs(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0;X=Ie,Ie=Ie+128|0,w=X+64|0,C=X,R=w,L=20240,N=R+60|0;do g[R>>2]=g[L>>2],R=R+4|0,L=L+4|0;while((R|0)<(N|0));R=C,L=20304,N=R+60|0;do g[R>>2]=g[L>>2],R=R+4|0,L=L+4|0;while((R|0)<(N|0));N=(Zo(g[A>>2]|0)|0)==0,w=N?w:C,C=m+4|0,pc(C),FA(C),Zo(g[A>>2]|0)|0&&(Gc(C),g[A>>2]=(g[A>>2]|0)+1),g[y>>2]=g[m>>2],A=y+4|0,lo(C,w,A),xn(A),g[y+16>>2]=g[m>>2],A=y+20|0,lo(C,w+12|0,A),xn(A),g[y+32>>2]=g[m>>2],A=y+36|0,lo(C,w+24|0,A),xn(A),g[y+48>>2]=g[m>>2],A=y+52|0,lo(C,w+36|0,A),xn(A),g[y+64>>2]=g[m>>2],y=y+68|0,lo(C,w+48|0,y),xn(y),Ie=X}function Ma(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0;if(Ye=Ie,Ie=Ie+32|0,$e=Ye+12|0,N=Ye,nt=m+4|0,De=g[16960+(A<<2)>>2]|0,pe=(w|0)!=0,De=pe?De*3|0:De,C=g[nt>>2]|0,te=m+8|0,L=g[te>>2]|0,pe){if(R=m+12|0,w=g[R>>2]|0,C=L+C+w|0,(C|0)==(De|0))return nt=1,Ie=Ye,nt|0;X=R}else X=m+12|0,w=g[X>>2]|0,C=L+C+w|0;if((C|0)<=(De|0))return nt=0,Ie=Ye,nt|0;do if((w|0)>0){if(w=g[m>>2]|0,(L|0)>0){R=18640+(w*80|0)+60|0,w=m;break}w=18640+(w*80|0)+40|0,y?(Jh($e,De,0,0),Qf(nt,$e,N),sf(N),lo(N,$e,nt),R=w,w=m):(R=w,w=m)}else R=18640+((g[m>>2]|0)*80|0)+20|0,w=m;while(0);if(g[w>>2]=g[R>>2],C=R+16|0,(g[C>>2]|0)>0){w=0;do Ca(nt),w=w+1|0;while((w|0)<(g[C>>2]|0))}return m=R+4|0,g[$e>>2]=g[m>>2],g[$e+4>>2]=g[m+4>>2],g[$e+8>>2]=g[m+8>>2],A=g[16880+(A<<2)>>2]|0,nf($e,pe?A*3|0:A),lo(nt,$e,nt),xn(nt),pe?w=((g[te>>2]|0)+(g[nt>>2]|0)+(g[X>>2]|0)|0)==(De|0)?1:2:w=2,nt=w,Ie=Ye,nt|0}function UA(m,A){m=m|0,A=A|0;var y=0;do y=Ma(m,A,0,1)|0;while((y|0)==2);return y|0}function $f(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0,gt=0,Fr=0,Nr=0,Rr=0,Vr=0,io=0,Vn=0,Hn=0;if(io=Ie,Ie=Ie+240|0,R=io+224|0,Fr=io+208|0,Nr=io,Rr=io+192|0,Vr=io+176|0,zt=io+160|0,kt=io+144|0,Et=io+128|0,Bt=io+112|0,gt=io+96|0,g[R>>2]=A,g[Fr>>2]=g[m>>2],g[Fr+4>>2]=g[m+4>>2],g[Fr+8>>2]=g[m+8>>2],g[Fr+12>>2]=g[m+12>>2],In(Fr,R,Nr),g[C>>2]=0,yt=w+y+((w|0)==6&1)|0,(yt|0)<=(y|0)){Ie=io;return}X=g[R>>2]|0,te=y+6|0,pe=16960+(X<<2)|0,De=kt+8|0,$e=Et+8|0,nt=Bt+8|0,Ye=Rr+4|0,L=0,N=y,w=-1;e:for(;;){if(R=(N|0)%6|0,m=Nr+(R<<4)|0,g[Rr>>2]=g[m>>2],g[Rr+4>>2]=g[m+4>>2],g[Rr+8>>2]=g[m+8>>2],g[Rr+12>>2]=g[m+12>>2],m=L,L=Ma(Rr,X,0,1)|0,(N|0)>(y|0)&(Zo(A)|0)!=0&&(m|0)!=1&&(g[Rr>>2]|0)!=(w|0)){switch(Tr(Nr+(((R+5|0)%6|0)<<4)+4|0,Vr),Tr(Nr+(R<<4)+4|0,zt),Vn=+(g[pe>>2]|0),Re[kt>>3]=Vn*3,Re[De>>3]=0,Hn=Vn*-1.5,Re[Et>>3]=Hn,Re[$e>>3]=Vn*2.598076211353316,Re[Bt>>3]=Hn,Re[nt>>3]=Vn*-2.598076211353316,R=g[Fr>>2]|0,g[17040+(R*80|0)+(((w|0)==(R|0)?g[Rr>>2]|0:w)<<2)>>2]|0){case 1:{m=Et,w=kt;break}case 3:{m=Bt,w=Et;break}case 2:{m=kt,w=Bt;break}default:{m=8;break e}}uf(Vr,zt,w,m,gt),!(oh(Vr,gt)|0)&&!(oh(zt,gt)|0)&&(Au(gt,g[Fr>>2]|0,X,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1)}if((N|0)<(te|0)&&(Tr(Ye,Vr),Au(Vr,g[Rr>>2]|0,X,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1),N=N+1|0,(N|0)>=(yt|0)){m=3;break}else w=g[Rr>>2]|0}if((m|0)==3){Ie=io;return}else(m|0)==8&&_i(22606,22569,736,22651)}function In(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0;X=Ie,Ie=Ie+160|0,w=X+80|0,C=X,R=w,L=20368,N=R+72|0;do g[R>>2]=g[L>>2],R=R+4|0,L=L+4|0;while((R|0)<(N|0));R=C,L=20448,N=R+72|0;do g[R>>2]=g[L>>2],R=R+4|0,L=L+4|0;while((R|0)<(N|0));N=(Zo(g[A>>2]|0)|0)==0,w=N?w:C,C=m+4|0,pc(C),FA(C),Zo(g[A>>2]|0)|0&&(Gc(C),g[A>>2]=(g[A>>2]|0)+1),g[y>>2]=g[m>>2],A=y+4|0,lo(C,w,A),xn(A),g[y+16>>2]=g[m>>2],A=y+20|0,lo(C,w+12|0,A),xn(A),g[y+32>>2]=g[m>>2],A=y+36|0,lo(C,w+24|0,A),xn(A),g[y+48>>2]=g[m>>2],A=y+52|0,lo(C,w+36|0,A),xn(A),g[y+64>>2]=g[m>>2],A=y+68|0,lo(C,w+48|0,A),xn(A),g[y+80>>2]=g[m>>2],y=y+84|0,lo(C,w+60|0,y),xn(y),Ie=X}function Bs(m,A){return m=m|0,A=A|0,A=nr(m|0,A|0,52)|0,Fe()|0,A&15|0}function zA(m,A){return m=m|0,A=A|0,A=nr(m|0,A|0,45)|0,Fe()|0,A&127|0}function Wc(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0;if(!(!0&(A&-16777216|0)==134217728)||(L=nr(m|0,A|0,45)|0,Fe()|0,L=L&127,L>>>0>121))return A=0,A|0;y=nr(m|0,A|0,52)|0,Fe()|0,y=y&15;do if(y|0){for(C=1,w=0;;){if(R=nr(m|0,A|0,(15-C|0)*3|0)|0,Fe()|0,R=R&7,(R|0)!=0&(w^1))if((R|0)==1&(yr(L)|0)!=0){N=0,w=13;break}else w=1;if((R|0)==7){N=0,w=13;break}if(C>>>0<y>>>0)C=C+1|0;else{w=9;break}}if((w|0)==9){if((y|0)==15)N=1;else break;return N|0}else if((w|0)==13)return N|0}while(0);for(;;){if(N=nr(m|0,A|0,(14-y|0)*3|0)|0,Fe()|0,!((N&7|0)==7&!0)){N=0,w=13;break}if(y>>>0<14)y=y+1|0;else{N=1,w=13;break}}return(w|0)==13?N|0:0}function $h(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0;if(R=nr(m|0,A|0,52)|0,Fe()|0,R=R&15,y>>>0>15)return w=4,w|0;if((R|0)<(y|0))return w=12,w|0;if((R|0)==(y|0))return g[w>>2]=m,g[w+4>>2]=A,w=0,w|0;if(C=Sr(y|0,0,52)|0,C=C|m,m=Fe()|0|A&-15728641,(R|0)>(y|0))do A=Sr(7,0,(14-y|0)*3|0)|0,y=y+1|0,C=A|C,m=Fe()|0|m;while((y|0)<(R|0));return g[w>>2]=C,g[w+4>>2]=m,w=0,w|0}function Rl(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0;if(R=nr(m|0,A|0,52)|0,Fe()|0,R=R&15,!((y|0)<16&(R|0)<=(y|0)))return w=4,w|0;C=y-R|0,y=nr(m|0,A|0,45)|0,Fe()|0;e:do if(!(yr(y&127)|0))y=Yn(7,0,C,((C|0)<0)<<31>>31)|0,C=Fe()|0;else{t:do if(R|0){for(y=1;L=Sr(7,0,(15-y|0)*3|0)|0,!!((L&m|0)==0&((Fe()|0)&A|0)==0);)if(y>>>0<R>>>0)y=y+1|0;else break t;y=Yn(7,0,C,((C|0)<0)<<31>>31)|0,C=Fe()|0;break e}while(0);y=Yn(7,0,C,((C|0)<0)<<31>>31)|0,y=ma(y|0,Fe()|0,5,0)|0,y=bn(y|0,Fe()|0,-5,-1)|0,y=od(y|0,Fe()|0,6,0)|0,y=bn(y|0,Fe()|0,1,0)|0,C=Fe()|0}while(0);return L=w,g[L>>2]=y,g[L+4>>2]=C,L=0,L|0}function mn(m,A){m=m|0,A=A|0;var y=0,w=0,C=0;if(C=nr(m|0,A|0,45)|0,Fe()|0,!(yr(C&127)|0))return C=0,C|0;C=nr(m|0,A|0,52)|0,Fe()|0,C=C&15;e:do if(!C)y=0;else for(w=1;;){if(y=nr(m|0,A|0,(15-w|0)*3|0)|0,Fe()|0,y=y&7,y|0)break e;if(w>>>0<C>>>0)w=w+1|0;else{y=0;break}}while(0);return C=(y|0)==0&1,C|0}function eh(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0;if(L=Ie,Ie=Ie+16|0,R=L,q(R,m,A,y),A=R,m=g[A>>2]|0,A=g[A+4>>2]|0,(m|0)==0&(A|0)==0)return Ie=L,0;C=0,y=0;do N=w+(C<<3)|0,g[N>>2]=m,g[N+4>>2]=A,C=bn(C|0,y|0,1,0)|0,y=Fe()|0,re(R),N=R,m=g[N>>2]|0,A=g[N+4>>2]|0;while(!((m|0)==0&(A|0)==0));return Ie=L,0}function mc(m,A,y,w){return m=m|0,A=A|0,y=y|0,w=w|0,(w|0)<(y|0)?(y=A,w=m,gi(y|0),w|0):(y=Sr(-1,-1,((w-y|0)*3|0)+3|0)|0,w=Sr(~y|0,~(Fe()|0)|0,(15-w|0)*3|0)|0,y=~(Fe()|0)&A,w=~w&m,gi(y|0),w|0)}function fp(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0;return C=nr(m|0,A|0,52)|0,Fe()|0,C=C&15,(y|0)<16&(C|0)<=(y|0)?((C|0)<(y|0)&&(C=Sr(-1,-1,((y+-1-C|0)*3|0)+3|0)|0,C=Sr(~C|0,~(Fe()|0)|0,(15-y|0)*3|0)|0,A=~(Fe()|0)&A,m=~C&m),C=Sr(y|0,0,52)|0,y=A&-15728641|(Fe()|0),g[w>>2]=m|C,g[w+4>>2]=y,w=0,w|0):(w=4,w|0)}function th(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0,gt=0,Fr=0,Nr=0,Rr=0,Vr=0;if((y|0)==0&(w|0)==0)return Rr=0,Rr|0;if(C=m,R=g[C>>2]|0,C=g[C+4>>2]|0,!0&(C&15728640|0)==0){if(!((w|0)>0|(w|0)==0&y>>>0>0)||(Rr=A,g[Rr>>2]=R,g[Rr+4>>2]=C,(y|0)==1&(w|0)==0))return Rr=0,Rr|0;C=1;do Fr=m+(C<<3)|0,Nr=g[Fr+4>>2]|0,Rr=A+(C<<3)|0,g[Rr>>2]=g[Fr>>2],g[Rr+4>>2]=Nr,C=C+1|0;while(0<(w|0)|(w|0)==0&C>>>0<y>>>0);return C=0,C|0}if(gt=y<<3,Nr=_c(gt)|0,!Nr)return Rr=13,Rr|0;if($g(Nr|0,m|0,gt|0)|0,Fr=Qo(y,8)|0,!Fr)return Mi(Nr),Rr=13,Rr|0;e:do if(y|0){t:for(;;){C=Nr,kt=g[C>>2]|0,C=g[C+4>>2]|0,Et=nr(kt|0,C|0,52)|0,Fe()|0,Et=Et&15,Bt=Et+-1|0,zt=(y|0)>0;r:do if((Et|0)!=0&zt){if(nt=((y|0)<0)<<31>>31,Ye=Sr(Bt|0,0,52)|0,yt=Fe()|0,Bt>>>0>15){if(!((kt|0)==0&(C|0)==0)){Rr=17;break t}for(R=0;;){if(R=R+1|0,(R|0)>=(y|0))break r;if(w=Nr+(R<<3)|0,yt=g[w>>2]|0,w=g[w+4>>2]|0,!((yt|0)==0&(w|0)==0)){C=w,Rr=17;break t}}}for(R=0,m=kt,w=C;;){if(!((m|0)==0&(w|0)==0)){if(!(!0&(w&117440512|0)==0)){Rr=22;break t}if(N=nr(m|0,w|0,52)|0,Fe()|0,N=N&15,(N|0)<(Bt|0)){C=12,Rr=28;break t}if((N|0)!=(Bt|0)&&(m=m|Ye,w=w&-15728641|yt,N>>>0>=Et>>>0)){L=Bt;do $e=Sr(7,0,(14-L|0)*3|0)|0,L=L+1|0,m=$e|m,w=Fe()|0|w;while(L>>>0<N>>>0)}if(L=hf(m|0,w|0,y|0,nt|0)|0,Fe()|0,te=Fr+(L<<3)|0,N=te,X=g[N>>2]|0,N=g[N+4>>2]|0,(X|0)==0&(N|0)==0)L=te;else for($e=0;;){if(($e|0)>(y|0)){Rr=32;break t}if((X|0)==(m|0)&(N&-117440513|0)==(w|0)){pe=nr(X|0,N|0,56)|0,Fe()|0,pe=pe&7,De=pe+1|0,Vr=nr(X|0,N|0,45)|0,Fe()|0;i:do if(!(yr(Vr&127)|0))N=7;else{if(X=nr(X|0,N|0,52)|0,Fe()|0,X=X&15,!X){N=6;break}for(N=1;;){if(Vr=Sr(7,0,(15-N|0)*3|0)|0,!((Vr&m|0)==0&((Fe()|0)&w|0)==0)){N=7;break i}if(N>>>0<X>>>0)N=N+1|0;else{N=6;break}}}while(0);if((pe+2|0)>>>0>N>>>0){Rr=42;break t}Vr=Sr(De|0,0,56)|0,w=Fe()|0|w&-117440513,De=te,g[De>>2]=0,g[De+4>>2]=0,m=Vr|m}else L=(L+1|0)%(y|0)|0;if(te=Fr+(L<<3)|0,N=te,X=g[N>>2]|0,N=g[N+4>>2]|0,(X|0)==0&(N|0)==0){L=te;break}else $e=$e+1|0}Vr=L,g[Vr>>2]=m,g[Vr+4>>2]=w}if(R=R+1|0,(R|0)>=(y|0))break r;w=Nr+(R<<3)|0,m=g[w>>2]|0,w=g[w+4>>2]|0}}while(0);if((y+5|0)>>>0<11){Rr=85;break}if(yt=Qo((y|0)/6|0,8)|0,!yt){Rr=49;break}r:do if(zt){$e=0,De=0;do{if(N=Fr+($e<<3)|0,w=N,R=g[w>>2]|0,w=g[w+4>>2]|0,!((R|0)==0&(w|0)==0)){X=nr(R|0,w|0,56)|0,Fe()|0,X=X&7,m=X+1|0,te=w&-117440513,Vr=nr(R|0,w|0,45)|0,Fe()|0;i:do if(yr(Vr&127)|0){if(pe=nr(R|0,w|0,52)|0,Fe()|0,pe=pe&15,pe|0)for(L=1;;){if(Vr=Sr(7,0,(15-L|0)*3|0)|0,!((R&Vr|0)==0&(te&(Fe()|0)|0)==0))break i;if(L>>>0<pe>>>0)L=L+1|0;else break}w=Sr(m|0,0,56)|0,R=w|R,w=Fe()|0|te,m=N,g[m>>2]=R,g[m+4>>2]=w,m=X+2|0}while(0);(m|0)==7&&(Vr=yt+(De<<3)|0,g[Vr>>2]=R,g[Vr+4>>2]=w&-117440513,De=De+1|0)}$e=$e+1|0}while(($e|0)!=(y|0));if(zt){if($e=((y|0)<0)<<31>>31,nt=Sr(Bt|0,0,52)|0,Ye=Fe()|0,Bt>>>0>15){if(!((kt|0)==0&(C|0)==0)){C=4,Rr=84;break t}for(C=0;;){if(C=C+1|0,(C|0)>=(y|0)){R=0,C=De;break r}if(Vr=Nr+(C<<3)|0,!((g[Vr>>2]|0)==0&(g[Vr+4>>2]|0)==0)){C=4,Rr=84;break t}}}for(pe=0,R=0,te=kt;;){do if(!((te|0)==0&(C|0)==0)){if(N=nr(te|0,C|0,52)|0,Fe()|0,N=N&15,(N|0)<(Bt|0)){C=12,Rr=84;break t}do if((N|0)==(Bt|0))w=te,N=C;else{if(w=te|nt,m=C&-15728641|Ye,N>>>0<Et>>>0){N=m;break}L=Bt;do Vr=Sr(7,0,(14-L|0)*3|0)|0,L=L+1|0,w=Vr|w,m=Fe()|0|m;while(L>>>0<N>>>0);N=m}while(0);for(L=hf(w|0,N|0,y|0,$e|0)|0,Fe()|0,m=0;;){if((m|0)>(y|0)){Rr=77;break t}if(Vr=Fr+(L<<3)|0,X=g[Vr+4>>2]|0,(X&-117440513|0)==(N|0)&&(g[Vr>>2]|0)==(w|0)){Rr=79;break}if(L=(L+1|0)%(y|0)|0,Vr=Fr+(L<<3)|0,(g[Vr>>2]|0)==(w|0)&&(g[Vr+4>>2]|0)==(N|0))break;m=m+1|0}if((Rr|0)==79&&(Rr=0,!0&(X&117440512|0)==100663296))break;Vr=A+(R<<3)|0,g[Vr>>2]=te,g[Vr+4>>2]=C,R=R+1|0}while(0);if(C=pe+1|0,(C|0)>=(y|0)){C=De;break r}Vr=Nr+(C<<3)|0,pe=C,te=g[Vr>>2]|0,C=g[Vr+4>>2]|0}}else R=0,C=De}else R=0,C=0;while(0);if(sd(Fr|0,0,gt|0)|0,$g(Nr|0,yt|0,C<<3|0)|0,Mi(yt),C)A=A+(R<<3)|0,y=C;else break e}if((Rr|0)==17)!0&(C&117440512|0)==0?(C=4,Rr=28):Rr=22;else if((Rr|0)==32)_i(23313,22674,362,22684);else{if((Rr|0)==42)return Mi(Nr),Mi(Fr),Vr=10,Vr|0;if((Rr|0)==49)return Mi(Nr),Mi(Fr),Vr=13,Vr|0;if((Rr|0)==77)_i(23313,22674,462,22684);else{if((Rr|0)==84)return Mi(yt),Mi(Nr),Mi(Fr),Vr=C,Vr|0;if((Rr|0)==85){$g(A|0,Nr|0,y<<3|0)|0;break}}}if((Rr|0)==22)return Mi(Nr),Mi(Fr),Vr=5,Vr|0;if((Rr|0)==28)return Mi(Nr),Mi(Fr),Vr=C,Vr|0}while(0);return Mi(Nr),Mi(Fr),Vr=0,Vr|0}function ed(m,A,y,w,C,R,L){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0,R=R|0,L=L|0;var N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0;if(yt=Ie,Ie=Ie+16|0,Ye=yt,!((y|0)>0|(y|0)==0&A>>>0>0))return Ye=0,Ie=yt,Ye|0;if((L|0)>=16)return Ye=12,Ie=yt,Ye|0;$e=0,nt=0,De=0,N=0;e:for(;;){if(te=m+($e<<3)|0,X=g[te>>2]|0,te=g[te+4>>2]|0,pe=nr(X|0,te|0,52)|0,Fe()|0,(pe&15|0)>(L|0)){N=12,X=11;break}if(q(Ye,X,te,L),pe=Ye,te=g[pe>>2]|0,pe=g[pe+4>>2]|0,(te|0)==0&(pe|0)==0)X=De;else{X=De;do{if(!((N|0)<(R|0)|(N|0)==(R|0)&X>>>0<C>>>0)){X=10;break e}De=w+(X<<3)|0,g[De>>2]=te,g[De+4>>2]=pe,X=bn(X|0,N|0,1,0)|0,N=Fe()|0,re(Ye),De=Ye,te=g[De>>2]|0,pe=g[De+4>>2]|0}while(!((te|0)==0&(pe|0)==0))}if($e=bn($e|0,nt|0,1,0)|0,nt=Fe()|0,(nt|0)<(y|0)|(nt|0)==(y|0)&$e>>>0<A>>>0)De=X;else{N=0,X=11;break}}return(X|0)==10?(Ye=14,Ie=yt,Ye|0):(X|0)==11?(Ie=yt,N|0):0}function VA(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0;$e=Ie,Ie=Ie+16|0,De=$e;e:do if((y|0)>0|(y|0)==0&A>>>0>0){for(te=0,L=0,R=0,pe=0;;){if(X=m+(te<<3)|0,N=g[X>>2]|0,X=g[X+4>>2]|0,!((N|0)==0&(X|0)==0)&&(X=(Rl(N,X,w,De)|0)==0,N=De,L=bn(g[N>>2]|0,g[N+4>>2]|0,L|0,R|0)|0,R=Fe()|0,!X)){R=12;break}if(te=bn(te|0,pe|0,1,0)|0,pe=Fe()|0,!((pe|0)<(y|0)|(pe|0)==(y|0)&te>>>0<A>>>0))break e}return Ie=$e,R|0}else L=0,R=0;while(0);return g[C>>2]=L,g[C+4>>2]=R,C=0,Ie=$e,C|0}function rh(m,A){return m=m|0,A=A|0,A=nr(m|0,A|0,52)|0,Fe()|0,A&1|0}function xs(m,A){m=m|0,A=A|0;var y=0,w=0,C=0;if(C=nr(m|0,A|0,52)|0,Fe()|0,C=C&15,!C)return C=0,C|0;for(w=1;;){if(y=nr(m|0,A|0,(15-w|0)*3|0)|0,Fe()|0,y=y&7,y|0){w=5;break}if(w>>>0<C>>>0)w=w+1|0;else{y=0,w=5;break}}return(w|0)==5?y|0:0}function td(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0,X=0;if(X=nr(m|0,A|0,52)|0,Fe()|0,X=X&15,!X)return N=A,X=m,gi(N|0),X|0;for(N=1,y=0;;){R=(15-N|0)*3|0,w=Sr(7,0,R|0)|0,C=Fe()|0,L=nr(m|0,A|0,R|0)|0,Fe()|0,R=Sr(dc(L&7)|0,0,R|0)|0,L=Fe()|0,m=R|m&~w,A=L|A&~C;e:do if(!y)if((R&w|0)==0&(L&C|0)==0)y=0;else if(w=nr(m|0,A|0,52)|0,Fe()|0,w=w&15,!w)y=1;else{y=1;t:for(;;){switch(L=nr(m|0,A|0,(15-y|0)*3|0)|0,Fe()|0,L&7){case 1:break t;case 0:break;default:{y=1;break e}}if(y>>>0<w>>>0)y=y+1|0;else{y=1;break e}}for(y=1;;)if(L=(15-y|0)*3|0,C=nr(m|0,A|0,L|0)|0,Fe()|0,R=Sr(7,0,L|0)|0,A=A&~(Fe()|0),L=Sr(dc(C&7)|0,0,L|0)|0,m=m&~R|L,A=A|(Fe()|0),y>>>0<w>>>0)y=y+1|0;else{y=1;break}}while(0);if(N>>>0<X>>>0)N=N+1|0;else break}return gi(A|0),m|0}function Ga(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0;if(w=nr(m|0,A|0,52)|0,Fe()|0,w=w&15,!w)return y=A,w=m,gi(y|0),w|0;for(y=1;R=(15-y|0)*3|0,L=nr(m|0,A|0,R|0)|0,Fe()|0,C=Sr(7,0,R|0)|0,A=A&~(Fe()|0),R=Sr(dc(L&7)|0,0,R|0)|0,m=R|m&~C,A=Fe()|0|A,y>>>0<w>>>0;)y=y+1|0;return gi(A|0),m|0}function mu(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0,X=0;if(X=nr(m|0,A|0,52)|0,Fe()|0,X=X&15,!X)return N=A,X=m,gi(N|0),X|0;for(N=1,y=0;;){R=(15-N|0)*3|0,w=Sr(7,0,R|0)|0,C=Fe()|0,L=nr(m|0,A|0,R|0)|0,Fe()|0,R=Sr(fs(L&7)|0,0,R|0)|0,L=Fe()|0,m=R|m&~w,A=L|A&~C;e:do if(!y)if((R&w|0)==0&(L&C|0)==0)y=0;else if(w=nr(m|0,A|0,52)|0,Fe()|0,w=w&15,!w)y=1;else{y=1;t:for(;;){switch(L=nr(m|0,A|0,(15-y|0)*3|0)|0,Fe()|0,L&7){case 1:break t;case 0:break;default:{y=1;break e}}if(y>>>0<w>>>0)y=y+1|0;else{y=1;break e}}for(y=1;;)if(C=(15-y|0)*3|0,R=Sr(7,0,C|0)|0,L=A&~(Fe()|0),A=nr(m|0,A|0,C|0)|0,Fe()|0,A=Sr(fs(A&7)|0,0,C|0)|0,m=m&~R|A,A=L|(Fe()|0),y>>>0<w>>>0)y=y+1|0;else{y=1;break}}while(0);if(N>>>0<X>>>0)N=N+1|0;else break}return gi(A|0),m|0}function ih(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0;if(w=nr(m|0,A|0,52)|0,Fe()|0,w=w&15,!w)return y=A,w=m,gi(y|0),w|0;for(y=1;L=(15-y|0)*3|0,R=Sr(7,0,L|0)|0,C=A&~(Fe()|0),A=nr(m|0,A|0,L|0)|0,Fe()|0,A=Sr(fs(A&7)|0,0,L|0)|0,m=A|m&~R,A=Fe()|0|C,y>>>0<w>>>0;)y=y+1|0;return gi(A|0),m|0}function gu(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0;if(X=Ie,Ie=Ie+64|0,N=X+40|0,w=X+24|0,C=X+12|0,R=X,Sr(A|0,0,52)|0,y=Fe()|0|134225919,!A)return(g[m+4>>2]|0)>2||(g[m+8>>2]|0)>2||(g[m+12>>2]|0)>2?(L=0,N=0,gi(L|0),Ie=X,N|0):(Sr(Fi(m)|0,0,45)|0,L=Fe()|0|y,N=-1,gi(L|0),Ie=X,N|0);if(g[N>>2]=g[m>>2],g[N+4>>2]=g[m+4>>2],g[N+8>>2]=g[m+8>>2],g[N+12>>2]=g[m+12>>2],L=N+4|0,(A|0)>0)for(m=-1;g[w>>2]=g[L>>2],g[w+4>>2]=g[L+4>>2],g[w+8>>2]=g[L+8>>2],A&1?(gr(L),g[C>>2]=g[L>>2],g[C+4>>2]=g[L+4>>2],g[C+8>>2]=g[L+8>>2],of(C)):(up(L),g[C>>2]=g[L>>2],g[C+4>>2]=g[L+4>>2],g[C+8>>2]=g[L+8>>2],Gc(C)),Qf(w,C,R),xn(R),pe=(15-A|0)*3|0,te=Sr(7,0,pe|0)|0,y=y&~(Fe()|0),pe=Sr(Ha(R)|0,0,pe|0)|0,m=pe|m&~te,y=Fe()|0|y,(A|0)>1;)A=A+-1|0;else m=-1;e:do if((g[L>>2]|0)<=2&&(g[N+8>>2]|0)<=2&&(g[N+12>>2]|0)<=2){if(w=Fi(N)|0,A=Sr(w|0,0,45)|0,A=A|m,m=Fe()|0|y&-1040385,R=vr(N)|0,!(yr(w)|0)){if((R|0)<=0)break;for(C=0;;){if(w=nr(A|0,m|0,52)|0,Fe()|0,w=w&15,w)for(y=1;pe=(15-y|0)*3|0,N=nr(A|0,m|0,pe|0)|0,Fe()|0,te=Sr(7,0,pe|0)|0,m=m&~(Fe()|0),pe=Sr(dc(N&7)|0,0,pe|0)|0,A=A&~te|pe,m=m|(Fe()|0),y>>>0<w>>>0;)y=y+1|0;if(C=C+1|0,(C|0)==(R|0))break e}}C=nr(A|0,m|0,52)|0,Fe()|0,C=C&15;t:do if(C){y=1;r:for(;;){switch(pe=nr(A|0,m|0,(15-y|0)*3|0)|0,Fe()|0,pe&7){case 1:break r;case 0:break;default:break t}if(y>>>0<C>>>0)y=y+1|0;else break t}if(fi(w,g[N>>2]|0)|0)for(y=1;N=(15-y|0)*3|0,te=Sr(7,0,N|0)|0,pe=m&~(Fe()|0),m=nr(A|0,m|0,N|0)|0,Fe()|0,m=Sr(fs(m&7)|0,0,N|0)|0,A=A&~te|m,m=pe|(Fe()|0),y>>>0<C>>>0;)y=y+1|0;else for(y=1;pe=(15-y|0)*3|0,N=nr(A|0,m|0,pe|0)|0,Fe()|0,te=Sr(7,0,pe|0)|0,m=m&~(Fe()|0),pe=Sr(dc(N&7)|0,0,pe|0)|0,A=A&~te|pe,m=m|(Fe()|0),y>>>0<C>>>0;)y=y+1|0}while(0);if((R|0)>0){y=0;do A=td(A,m)|0,m=Fe()|0,y=y+1|0;while((y|0)!=(R|0))}}else A=0,m=0;while(0);return te=m,pe=A,gi(te|0),Ie=X,pe|0}function Zo(m){return m=m|0,(m|0)%2|0|0}function hp(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0;return C=Ie,Ie=Ie+16|0,w=C,A>>>0>15?(w=4,Ie=C,w|0):(g[m+4>>2]&2146435072|0)==2146435072||(g[m+8+4>>2]&2146435072|0)==2146435072?(w=3,Ie=C,w|0):(Qh(m,A,w),A=gu(w,A)|0,w=Fe()|0,g[y>>2]=A,g[y+4>>2]=w,(A|0)==0&(w|0)==0&&_i(23313,22674,786,22697),w=0,Ie=C,w|0)}function cf(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0;if(C=y+4|0,R=nr(m|0,A|0,52)|0,Fe()|0,R=R&15,L=nr(m|0,A|0,45)|0,Fe()|0,w=(R|0)==0,yr(L&127)|0){if(w)return L=1,L|0;w=1}else{if(w)return L=0,L|0;!(g[C>>2]|0)&&!(g[y+8>>2]|0)?w=(g[y+12>>2]|0)!=0&1:w=1}for(y=1;y&1?of(C):Gc(C),L=nr(m|0,A|0,(15-y|0)*3|0)|0,Fe()|0,pl(C,L&7),y>>>0<R>>>0;)y=y+1|0;return w|0}function _u(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0;if(pe=Ie,Ie=Ie+16|0,X=pe,te=nr(m|0,A|0,45)|0,Fe()|0,te=te&127,te>>>0>121)return g[y>>2]=0,g[y+4>>2]=0,g[y+8>>2]=0,g[y+12>>2]=0,te=5,Ie=pe,te|0;e:do if(yr(te)|0&&(R=nr(m|0,A|0,52)|0,Fe()|0,R=R&15,(R|0)!=0)){w=1;t:for(;;){switch(N=nr(m|0,A|0,(15-w|0)*3|0)|0,Fe()|0,N&7){case 5:break t;case 0:break;default:{w=A;break e}}if(w>>>0<R>>>0)w=w+1|0;else{w=A;break e}}for(C=1,w=A;A=(15-C|0)*3|0,L=Sr(7,0,A|0)|0,N=w&~(Fe()|0),w=nr(m|0,w|0,A|0)|0,Fe()|0,w=Sr(fs(w&7)|0,0,A|0)|0,m=m&~L|w,w=N|(Fe()|0),C>>>0<R>>>0;)C=C+1|0}else w=A;while(0);if(N=7696+(te*28|0)|0,g[y>>2]=g[N>>2],g[y+4>>2]=g[N+4>>2],g[y+8>>2]=g[N+8>>2],g[y+12>>2]=g[N+12>>2],!(cf(m,w,y)|0))return te=0,Ie=pe,te|0;if(L=y+4|0,g[X>>2]=g[L>>2],g[X+4>>2]=g[L+4>>2],g[X+8>>2]=g[L+8>>2],R=nr(m|0,w|0,52)|0,Fe()|0,N=R&15,R&1?(Gc(L),R=N+1|0):R=N,!(yr(te)|0))w=0;else{e:do if(!N)w=0;else for(A=1;;){if(C=nr(m|0,w|0,(15-A|0)*3|0)|0,Fe()|0,C=C&7,C|0){w=C;break e}if(A>>>0<N>>>0)A=A+1|0;else{w=0;break}}while(0);w=(w|0)==4&1}if(!(Ma(y,R,w,0)|0))(R|0)!=(N|0)&&(g[L>>2]=g[X>>2],g[L+4>>2]=g[X+4>>2],g[L+8>>2]=g[X+8>>2]);else{if(yr(te)|0)do;while(Ma(y,R,0,0)|0);(R|0)!=(N|0)&&up(L)}return te=0,Ie=pe,te|0}function yu(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0;return R=Ie,Ie=Ie+16|0,w=R,C=_u(m,A,w)|0,C|0?(Ie=R,C|0):(C=nr(m|0,A|0,52)|0,Fe()|0,da(w,C&15,y),C=0,Ie=R,C|0)}function d(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0;if(L=Ie,Ie=Ie+16|0,R=L,w=_u(m,A,R)|0,w|0)return R=w,Ie=L,R|0;w=nr(m|0,A|0,45)|0,Fe()|0,w=(yr(w&127)|0)==0,C=nr(m|0,A|0,52)|0,Fe()|0,C=C&15;e:do if(!w){if(C|0)for(w=1;;){if(N=Sr(7,0,(15-w|0)*3|0)|0,!((N&m|0)==0&((Fe()|0)&A|0)==0))break e;if(w>>>0<C>>>0)w=w+1|0;else break}return ml(R,C,0,5,y),N=0,Ie=L,N|0}while(0);return $f(R,C,0,6,y),N=0,Ie=L,N|0}function _(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0;if(C=nr(m|0,A|0,45)|0,Fe()|0,!(yr(C&127)|0))return C=2,g[y>>2]=C,0;if(C=nr(m|0,A|0,52)|0,Fe()|0,C=C&15,!C)return C=5,g[y>>2]=C,0;for(w=1;;){if(R=Sr(7,0,(15-w|0)*3|0)|0,!((R&m|0)==0&((Fe()|0)&A|0)==0)){w=2,m=6;break}if(w>>>0<C>>>0)w=w+1|0;else{w=5,m=6;break}}return(m|0)==6&&(g[y>>2]=w),0}function p(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0;De=Ie,Ie=Ie+128|0,te=De+112|0,R=De+96|0,pe=De,C=nr(m|0,A|0,52)|0,Fe()|0,N=C&15,g[te>>2]=N,L=nr(m|0,A|0,45)|0,Fe()|0,L=L&127;e:do if(yr(L)|0){if(N|0)for(w=1;;){if(X=Sr(7,0,(15-w|0)*3|0)|0,!((X&m|0)==0&((Fe()|0)&A|0)==0)){C=0;break e}if(w>>>0<N>>>0)w=w+1|0;else break}if(C&1)C=1;else return X=Sr(N+1|0,0,52)|0,pe=Fe()|0|A&-15728641,te=Sr(7,0,(14-N|0)*3|0)|0,pe=p((X|m)&~te,pe&~(Fe()|0),y)|0,Ie=De,pe|0}else C=0;while(0);if(w=_u(m,A,R)|0,!w){C?(Rs(R,te,pe),X=5):(In(R,te,pe),X=6);e:do if(yr(L)|0)if(!N)m=5;else for(w=1;;){if(L=Sr(7,0,(15-w|0)*3|0)|0,!((L&m|0)==0&((Fe()|0)&A|0)==0)){m=2;break e}if(w>>>0<N>>>0)w=w+1|0;else{m=5;break}}else m=2;while(0);sd(y|0,-1,m<<2|0)|0;e:do if(C)for(R=0;;){if(L=pe+(R<<4)|0,UA(L,g[te>>2]|0)|0,L=g[L>>2]|0,N=g[y>>2]|0,(N|0)==-1|(N|0)==(L|0))w=y;else{C=0;do{if(C=C+1|0,C>>>0>=m>>>0){w=1;break e}w=y+(C<<2)|0,N=g[w>>2]|0}while(!((N|0)==-1|(N|0)==(L|0)))}if(g[w>>2]=L,R=R+1|0,R>>>0>=X>>>0){w=0;break}}else for(R=0;;){if(L=pe+(R<<4)|0,Ma(L,g[te>>2]|0,0,1)|0,L=g[L>>2]|0,N=g[y>>2]|0,(N|0)==-1|(N|0)==(L|0))w=y;else{C=0;do{if(C=C+1|0,C>>>0>=m>>>0){w=1;break e}w=y+(C<<2)|0,N=g[w>>2]|0}while(!((N|0)==-1|(N|0)==(L|0)))}if(g[w>>2]=L,R=R+1|0,R>>>0>=X>>>0){w=0;break}}while(0)}return pe=w,Ie=De,pe|0}function b(){return 12}function B(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0,X=0;if(m>>>0>15)return N=4,N|0;if(Sr(m|0,0,52)|0,N=Fe()|0|134225919,!m){y=0,w=0;do yr(w)|0&&(Sr(w|0,0,45)|0,L=N|(Fe()|0),m=A+(y<<3)|0,g[m>>2]=-1,g[m+4>>2]=L,y=y+1|0),w=w+1|0;while((w|0)!=122);return y=0,y|0}y=0,L=0;do{if(yr(L)|0){for(Sr(L|0,0,45)|0,w=1,C=-1,R=N|(Fe()|0);X=Sr(7,0,(15-w|0)*3|0)|0,C=C&~X,R=R&~(Fe()|0),(w|0)!=(m|0);)w=w+1|0;X=A+(y<<3)|0,g[X>>2]=C,g[X+4>>2]=R,y=y+1|0}L=L+1|0}while((L|0)!=122);return y=0,y|0}function k(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0;if(Et=Ie,Ie=Ie+16|0,zt=Et,kt=nr(m|0,A|0,52)|0,Fe()|0,kt=kt&15,y>>>0>15)return kt=4,Ie=Et,kt|0;if((kt|0)<(y|0))return kt=12,Ie=Et,kt|0;if((kt|0)!=(y|0))if(R=Sr(y|0,0,52)|0,R=R|m,N=Fe()|0|A&-15728641,(kt|0)>(y|0)){X=y;do yt=Sr(7,0,(14-X|0)*3|0)|0,X=X+1|0,R=yt|R,N=Fe()|0|N;while((X|0)<(kt|0));yt=R}else yt=R;else yt=m,N=A;Ye=nr(yt|0,N|0,45)|0,Fe()|0;e:do if(yr(Ye&127)|0){if(X=nr(yt|0,N|0,52)|0,Fe()|0,X=X&15,X|0)for(R=1;;){if(Ye=Sr(7,0,(15-R|0)*3|0)|0,!((Ye&yt|0)==0&((Fe()|0)&N|0)==0)){te=33;break e}if(R>>>0<X>>>0)R=R+1|0;else break}if(Ye=w,g[Ye>>2]=0,g[Ye+4>>2]=0,(kt|0)>(y|0)){for(Ye=A&-15728641,nt=kt;;){if($e=nt,nt=nt+-1|0,nt>>>0>15|(kt|0)<(nt|0)){te=19;break}if((kt|0)!=(nt|0))if(R=Sr(nt|0,0,52)|0,R=R|m,X=Fe()|0|Ye,(kt|0)<($e|0))De=R;else{te=nt;do De=Sr(7,0,(14-te|0)*3|0)|0,te=te+1|0,R=De|R,X=Fe()|0|X;while((te|0)<(kt|0));De=R}else De=m,X=A;if(pe=nr(De|0,X|0,45)|0,Fe()|0,!(yr(pe&127)|0))R=0;else{pe=nr(De|0,X|0,52)|0,Fe()|0,pe=pe&15;t:do if(!pe)R=0;else for(te=1;;){if(R=nr(De|0,X|0,(15-te|0)*3|0)|0,Fe()|0,R=R&7,R|0)break t;if(te>>>0<pe>>>0)te=te+1|0;else{R=0;break}}while(0);R=(R|0)==0&1}if(X=nr(m|0,A|0,(15-$e|0)*3|0)|0,Fe()|0,X=X&7,(X|0)==7){C=5,te=42;break}if(R=(R|0)!=0,(X|0)==1&R){C=5,te=42;break}if(De=X+(((X|0)!=0&R)<<31>>31)|0,De|0&&(te=kt-$e|0,te=Yn(7,0,te,((te|0)<0)<<31>>31)|0,pe=Fe()|0,R?(R=ma(te|0,pe|0,5,0)|0,R=bn(R|0,Fe()|0,-5,-1)|0,R=od(R|0,Fe()|0,6,0)|0,R=bn(R|0,Fe()|0,1,0)|0,X=Fe()|0):(R=te,X=pe),$e=De+-1|0,$e=ma(te|0,pe|0,$e|0,(($e|0)<0)<<31>>31|0)|0,$e=bn(R|0,X|0,$e|0,Fe()|0)|0,De=Fe()|0,pe=w,pe=bn($e|0,De|0,g[pe>>2]|0,g[pe+4>>2]|0)|0,De=Fe()|0,$e=w,g[$e>>2]=pe,g[$e+4>>2]=De),(nt|0)<=(y|0)){te=37;break}}if((te|0)==19)_i(23313,22674,1099,22710);else if((te|0)==37){L=w,C=g[L+4>>2]|0,L=g[L>>2]|0;break}else if((te|0)==42)return Ie=Et,C|0}else C=0,L=0}else te=33;while(0);e:do if((te|0)==33)if(Ye=w,g[Ye>>2]=0,g[Ye+4>>2]=0,(kt|0)>(y|0)){for(R=kt;;){if(C=nr(m|0,A|0,(15-R|0)*3|0)|0,Fe()|0,C=C&7,(C|0)==7){C=5;break}if(L=kt-R|0,L=Yn(7,0,L,((L|0)<0)<<31>>31)|0,C=ma(L|0,Fe()|0,C|0,0)|0,L=Fe()|0,Ye=w,L=bn(g[Ye>>2]|0,g[Ye+4>>2]|0,C|0,L|0)|0,C=Fe()|0,Ye=w,g[Ye>>2]=L,g[Ye+4>>2]=C,R=R+-1|0,(R|0)<=(y|0))break e}return Ie=Et,C|0}else C=0,L=0;while(0);return Rl(yt,N,kt,zt)|0&&_i(23313,22674,1063,22725),kt=zt,zt=g[kt+4>>2]|0,((C|0)>-1|(C|0)==-1&L>>>0>4294967295)&((zt|0)>(C|0)|((zt|0)==(C|0)?(g[kt>>2]|0)>>>0>L>>>0:0))?(kt=0,Ie=Et,kt|0):(_i(23313,22674,1139,22710),0)}function V(m,A,y,w,C,R){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0,R=R|0;var L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0;if(De=Ie,Ie=Ie+16|0,L=De,C>>>0>15)return R=4,Ie=De,R|0;if(N=nr(y|0,w|0,52)|0,Fe()|0,N=N&15,(N|0)>(C|0))return R=12,Ie=De,R|0;if(Rl(y,w,C,L)|0&&_i(23313,22674,1063,22725),pe=L,te=g[pe+4>>2]|0,!(((A|0)>-1|(A|0)==-1&m>>>0>4294967295)&((te|0)>(A|0)|((te|0)==(A|0)?(g[pe>>2]|0)>>>0>m>>>0:0))))return R=2,Ie=De,R|0;pe=C-N|0,C=Sr(C|0,0,52)|0,X=Fe()|0|w&-15728641,te=R,g[te>>2]=C|y,g[te+4>>2]=X,te=nr(y|0,w|0,45)|0,Fe()|0;e:do if(yr(te&127)|0){if(N|0)for(L=1;;){if(te=Sr(7,0,(15-L|0)*3|0)|0,!((te&y|0)==0&((Fe()|0)&w|0)==0))break e;if(L>>>0<N>>>0)L=L+1|0;else break}if((pe|0)<1)return R=0,Ie=De,R|0;for(te=N^15,w=-1,X=1,L=1;;){N=pe-X|0,N=Yn(7,0,N,((N|0)<0)<<31>>31)|0,y=Fe()|0;do if(L)if(L=ma(N|0,y|0,5,0)|0,L=bn(L|0,Fe()|0,-5,-1)|0,L=od(L|0,Fe()|0,6,0)|0,C=Fe()|0,(A|0)>(C|0)|(A|0)==(C|0)&m>>>0>L>>>0){A=bn(m|0,A|0,-1,-1)|0,A=Pa(A|0,Fe()|0,L|0,C|0)|0,L=Fe()|0,$e=R,Ye=g[$e>>2]|0,$e=g[$e+4>>2]|0,yt=(te+w|0)*3|0,nt=Sr(7,0,yt|0)|0,$e=$e&~(Fe()|0),w=od(A|0,L|0,N|0,y|0)|0,m=Fe()|0,C=bn(w|0,m|0,2,0)|0,yt=Sr(C|0,Fe()|0,yt|0)|0,$e=Fe()|0|$e,C=R,g[C>>2]=yt|Ye&~nt,g[C+4>>2]=$e,m=ma(w|0,m|0,N|0,y|0)|0,m=Pa(A|0,L|0,m|0,Fe()|0)|0,L=0,A=Fe()|0;break}else{yt=R,nt=g[yt>>2]|0,yt=g[yt+4>>2]|0,Ye=Sr(7,0,(te+w|0)*3|0)|0,yt=yt&~(Fe()|0),L=R,g[L>>2]=nt&~Ye,g[L+4>>2]=yt,L=1;break}else nt=R,C=g[nt>>2]|0,nt=g[nt+4>>2]|0,w=(te+w|0)*3|0,$e=Sr(7,0,w|0)|0,nt=nt&~(Fe()|0),yt=od(m|0,A|0,N|0,y|0)|0,L=Fe()|0,w=Sr(yt|0,L|0,w|0)|0,nt=Fe()|0|nt,Ye=R,g[Ye>>2]=w|C&~$e,g[Ye+4>>2]=nt,L=ma(yt|0,L|0,N|0,y|0)|0,m=Pa(m|0,A|0,L|0,Fe()|0)|0,L=0,A=Fe()|0;while(0);if((pe|0)>(X|0))w=~X,X=X+1|0;else{A=0;break}}return Ie=De,A|0}while(0);if((pe|0)<1)return yt=0,Ie=De,yt|0;for(C=N^15,L=1;;)if(Ye=pe-L|0,Ye=Yn(7,0,Ye,((Ye|0)<0)<<31>>31)|0,yt=Fe()|0,X=R,y=g[X>>2]|0,X=g[X+4>>2]|0,N=(C-L|0)*3|0,w=Sr(7,0,N|0)|0,X=X&~(Fe()|0),$e=od(m|0,A|0,Ye|0,yt|0)|0,nt=Fe()|0,N=Sr($e|0,nt|0,N|0)|0,X=Fe()|0|X,te=R,g[te>>2]=N|y&~w,g[te+4>>2]=X,yt=ma($e|0,nt|0,Ye|0,yt|0)|0,m=Pa(m|0,A|0,yt|0,Fe()|0)|0,A=Fe()|0,(pe|0)<=(L|0)){A=0;break}else L=L+1|0;return Ie=De,A|0}function q(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0;C=nr(A|0,y|0,52)|0,Fe()|0,C=C&15,(A|0)==0&(y|0)==0|((w|0)>15|(C|0)>(w|0))?(w=-1,C=-1,A=0,y=0):(R=mc(A,y,C+1|0,w)|0,y=(Fe()|0)&-15728641,A=Sr(w|0,0,52)|0,A=R|A,y=y|(Fe()|0),R=(mn(A,y)|0)==0,w=R?-1:w),R=m,g[R>>2]=A,g[R+4>>2]=y,g[m+8>>2]=C,g[m+12>>2]=w}function re(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0,X=0,te=0;if(y=m,A=g[y>>2]|0,y=g[y+4>>2]|0,!((A|0)==0&(y|0)==0)&&(w=nr(A|0,y|0,52)|0,Fe()|0,w=w&15,N=Sr(1,0,(w^15)*3|0)|0,A=bn(N|0,Fe()|0,A|0,y|0)|0,y=Fe()|0,N=m,g[N>>2]=A,g[N+4>>2]=y,N=m+8|0,L=g[N>>2]|0,!((w|0)<(L|0)))){for(X=m+12|0,R=w;;){if((R|0)==(L|0)){w=5;break}if(te=(R|0)==(g[X>>2]|0),C=(15-R|0)*3|0,w=nr(A|0,y|0,C|0)|0,Fe()|0,w=w&7,te&((w|0)==1&!0)){w=7;break}if(!((w|0)==7&!0)){w=10;break}if(te=Sr(1,0,C|0)|0,A=bn(A|0,y|0,te|0,Fe()|0)|0,y=Fe()|0,te=m,g[te>>2]=A,g[te+4>>2]=y,(R|0)>(L|0))R=R+-1|0;else{w=10;break}}if((w|0)==5){te=m,g[te>>2]=0,g[te+4>>2]=0,g[N>>2]=-1,g[X>>2]=-1;return}else if((w|0)==7){L=Sr(1,0,C|0)|0,L=bn(A|0,y|0,L|0,Fe()|0)|0,N=Fe()|0,te=m,g[te>>2]=L,g[te+4>>2]=N,g[X>>2]=R+-1;return}else if((w|0)==10)return}}function ue(m){m=+m;var A=0;return A=m<0?m+6.283185307179586:m,+(m>=6.283185307179586?A+-6.283185307179586:A)}function Ee(m,A){return m=m|0,A=A|0,+En(+(+Re[m>>3]-+Re[A>>3]))<17453292519943298e-27?(A=+En(+(+Re[m+8>>3]-+Re[A+8>>3]))<17453292519943298e-27,A|0):(A=0,A|0)}function Ce(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0;return C=+Re[A>>3],w=+Re[m>>3],R=+Gi(+((C-w)*.5)),y=+Gi(+((+Re[A+8>>3]-+Re[m+8>>3])*.5)),y=R*R+y*(+ji(+C)*+ji(+w)*y),+(+Ko(+ +ln(+y),+ +ln(+(1-y)))*2)}function Me(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0;return C=+Re[A>>3],w=+Re[m>>3],R=+Gi(+((C-w)*.5)),y=+Gi(+((+Re[A+8>>3]-+Re[m+8>>3])*.5)),y=R*R+y*(+ji(+C)*+ji(+w)*y),+(+Ko(+ +ln(+y),+ +ln(+(1-y)))*2*6371.007180918475)}function He(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0;return C=+Re[A>>3],w=+Re[m>>3],R=+Gi(+((C-w)*.5)),y=+Gi(+((+Re[A+8>>3]-+Re[m+8>>3])*.5)),y=R*R+y*(+ji(+C)*+ji(+w)*y),+(+Ko(+ +ln(+y),+ +ln(+(1-y)))*2*6371.007180918475*1e3)}function Ue(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0;return R=+Re[A>>3],w=+ji(+R),C=+Re[A+8>>3]-+Re[m+8>>3],L=w*+Gi(+C),y=+Re[m>>3],+ +Ko(+L,+(+Gi(+R)*+ji(+y)-+ji(+C)*(w*+Gi(+y))))}function Ze(m,A,y,w){m=m|0,A=+A,y=+y,w=w|0;var C=0,R=0,L=0,N=0;if(y<1e-16){g[w>>2]=g[m>>2],g[w+4>>2]=g[m+4>>2],g[w+8>>2]=g[m+8>>2],g[w+12>>2]=g[m+12>>2];return}R=A<0?A+6.283185307179586:A,R=A>=6.283185307179586?R+-6.283185307179586:R;do if(R<1e-16)A=+Re[m>>3]+y,Re[w>>3]=A,C=w;else{if(C=+En(+(R+-3.141592653589793))<1e-16,A=+Re[m>>3],C){A=A-y,Re[w>>3]=A,C=w;break}if(L=+ji(+y),y=+Gi(+y),A=L*+Gi(+A)+ +ji(+R)*(y*+ji(+A)),A=A>1?1:A,A=+Yh(+(A<-1?-1:A)),Re[w>>3]=A,+En(+(A+-1.5707963267948966))<1e-16){Re[w>>3]=1.5707963267948966,Re[w+8>>3]=0;return}if(+En(+(A+1.5707963267948966))<1e-16){Re[w>>3]=-1.5707963267948966,Re[w+8>>3]=0;return}if(N=+ji(+A),R=y*+Gi(+R)/N,y=+Re[m>>3],A=(L-+Gi(+A)*+Gi(+y))/+ji(+y)/N,L=R>1?1:R,A=A>1?1:A,A=+Re[m+8>>3]+ +Ko(+(L<-1?-1:L),+(A<-1?-1:A)),A>3.141592653589793)do A=A+-6.283185307179586;while(A>3.141592653589793);if(A<-3.141592653589793)do A=A+6.283185307179586;while(A<-3.141592653589793);Re[w+8>>3]=A;return}while(0);if(+En(+(A+-1.5707963267948966))<1e-16){Re[C>>3]=1.5707963267948966,Re[w+8>>3]=0;return}if(+En(+(A+1.5707963267948966))<1e-16){Re[C>>3]=-1.5707963267948966,Re[w+8>>3]=0;return}if(A=+Re[m+8>>3],A>3.141592653589793)do A=A+-6.283185307179586;while(A>3.141592653589793);if(A<-3.141592653589793)do A=A+6.283185307179586;while(A<-3.141592653589793);Re[w+8>>3]=A}function Ne(m,A){return m=m|0,A=A|0,m>>>0>15?(A=4,A|0):(Re[A>>3]=+Re[20528+(m<<3)>>3],A=0,A|0)}function Ke(m,A){return m=m|0,A=A|0,m>>>0>15?(A=4,A|0):(Re[A>>3]=+Re[20656+(m<<3)>>3],A=0,A|0)}function it(m,A){return m=m|0,A=A|0,m>>>0>15?(A=4,A|0):(Re[A>>3]=+Re[20784+(m<<3)>>3],A=0,A|0)}function pt(m,A){return m=m|0,A=A|0,m>>>0>15?(A=4,A|0):(Re[A>>3]=+Re[20912+(m<<3)>>3],A=0,A|0)}function Ct(m,A){m=m|0,A=A|0;var y=0;return m>>>0>15?(A=4,A|0):(y=Yn(7,0,m,((m|0)<0)<<31>>31)|0,y=ma(y|0,Fe()|0,120,0)|0,m=Fe()|0,g[A>>2]=y|2,g[A+4>>2]=m,A=0,A|0)}function xt(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0;return $e=+Re[A>>3],pe=+Re[m>>3],X=+Gi(+(($e-pe)*.5)),R=+Re[A+8>>3],te=+Re[m+8>>3],L=+Gi(+((R-te)*.5)),N=+ji(+pe),De=+ji(+$e),L=X*X+L*(De*N*L),L=+Ko(+ +ln(+L),+ +ln(+(1-L)))*2,X=+Re[y>>3],$e=+Gi(+((X-$e)*.5)),w=+Re[y+8>>3],R=+Gi(+((w-R)*.5)),C=+ji(+X),R=$e*$e+R*(De*C*R),R=+Ko(+ +ln(+R),+ +ln(+(1-R)))*2,X=+Gi(+((pe-X)*.5)),w=+Gi(+((te-w)*.5)),w=X*X+w*(N*C*w),w=+Ko(+ +ln(+w),+ +ln(+(1-w)))*2,C=(L+R+w)*.5,+(+Hs(+ +ln(+(+an(+(C*.5))*+an(+((C-L)*.5))*+an(+((C-R)*.5))*+an(+((C-w)*.5)))))*4)}function Rt(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0;if(N=Ie,Ie=Ie+192|0,R=N+168|0,L=N,C=yu(m,A,R)|0,C|0)return y=C,Ie=N,y|0;if(d(m,A,L)|0&&_i(23313,22742,386,22751),A=g[L>>2]|0,(A|0)>0){if(w=+xt(L+8|0,L+8+(((A|0)!=1&1)<<4)|0,R)+0,(A|0)!=1){m=1;do C=m,m=m+1|0,w=w+ +xt(L+8+(C<<4)|0,L+8+(((m|0)%(A|0)|0)<<4)|0,R);while((m|0)<(A|0))}}else w=0;return Re[y>>3]=w,y=0,Ie=N,y|0}function Wt(m,A,y){return m=m|0,A=A|0,y=y|0,m=Rt(m,A,y)|0,m|0||(Re[y>>3]=+Re[y>>3]*6371.007180918475*6371.007180918475),m|0}function ar(m,A,y){return m=m|0,A=A|0,y=y|0,m=Rt(m,A,y)|0,m|0||(Re[y>>3]=+Re[y>>3]*6371.007180918475*6371.007180918475*1e3*1e3),m|0}function ir(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0;if(N=Ie,Ie=Ie+176|0,L=N,m=Ps(m,A,L)|0,m|0)return L=m,Ie=N,L|0;if(Re[y>>3]=0,m=g[L>>2]|0,(m|0)<=1)return L=0,Ie=N,L|0;A=m+-1|0,m=0,w=+Re[L+8>>3],C=+Re[L+16>>3],R=0;do m=m+1|0,te=w,w=+Re[L+8+(m<<4)>>3],pe=+Gi(+((w-te)*.5)),X=C,C=+Re[L+8+(m<<4)+8>>3],X=+Gi(+((C-X)*.5)),X=pe*pe+X*(+ji(+w)*+ji(+te)*X),R=R+ +Ko(+ +ln(+X),+ +ln(+(1-X)))*2;while((m|0)<(A|0));return Re[y>>3]=R,L=0,Ie=N,L|0}function Ir(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0;if(N=Ie,Ie=Ie+176|0,L=N,m=Ps(m,A,L)|0,m|0)return L=m,R=+Re[y>>3],R=R*6371.007180918475,Re[y>>3]=R,Ie=N,L|0;if(Re[y>>3]=0,m=g[L>>2]|0,(m|0)<=1)return L=0,R=0,R=R*6371.007180918475,Re[y>>3]=R,Ie=N,L|0;A=m+-1|0,m=0,w=+Re[L+8>>3],C=+Re[L+16>>3],R=0;do m=m+1|0,te=w,w=+Re[L+8+(m<<4)>>3],pe=+Gi(+((w-te)*.5)),X=C,C=+Re[L+8+(m<<4)+8>>3],X=+Gi(+((C-X)*.5)),X=pe*pe+X*(+ji(+te)*+ji(+w)*X),R=R+ +Ko(+ +ln(+X),+ +ln(+(1-X)))*2;while((m|0)!=(A|0));return Re[y>>3]=R,L=0,pe=R,pe=pe*6371.007180918475,Re[y>>3]=pe,Ie=N,L|0}function ti(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0;if(N=Ie,Ie=Ie+176|0,L=N,m=Ps(m,A,L)|0,m|0)return L=m,R=+Re[y>>3],R=R*6371.007180918475,R=R*1e3,Re[y>>3]=R,Ie=N,L|0;if(Re[y>>3]=0,m=g[L>>2]|0,(m|0)<=1)return L=0,R=0,R=R*6371.007180918475,R=R*1e3,Re[y>>3]=R,Ie=N,L|0;A=m+-1|0,m=0,w=+Re[L+8>>3],C=+Re[L+16>>3],R=0;do m=m+1|0,te=w,w=+Re[L+8+(m<<4)>>3],pe=+Gi(+((w-te)*.5)),X=C,C=+Re[L+8+(m<<4)+8>>3],X=+Gi(+((C-X)*.5)),X=pe*pe+X*(+ji(+te)*+ji(+w)*X),R=R+ +Ko(+ +ln(+X),+ +ln(+(1-X)))*2;while((m|0)!=(A|0));return Re[y>>3]=R,L=0,pe=R,pe=pe*6371.007180918475,pe=pe*1e3,Re[y>>3]=pe,Ie=N,L|0}function oi(m){m=m|0;var A=0,y=0,w=0;return A=Qo(1,12)|0,A||_i(22832,22787,49,22845),y=m+4|0,w=g[y>>2]|0,w|0?(w=w+8|0,g[w>>2]=A,g[y>>2]=A,A|0):(g[m>>2]|0&&_i(22862,22787,61,22885),w=m,g[w>>2]=A,g[y>>2]=A,A|0)}function ii(m,A){m=m|0,A=A|0;var y=0,w=0;return w=_c(24)|0,w||_i(22899,22787,78,22913),g[w>>2]=g[A>>2],g[w+4>>2]=g[A+4>>2],g[w+8>>2]=g[A+8>>2],g[w+12>>2]=g[A+12>>2],g[w+16>>2]=0,A=m+4|0,y=g[A>>2]|0,y|0?(g[y+16>>2]=w,g[A>>2]=w,w|0):(g[m>>2]|0&&_i(22928,22787,82,22913),g[m>>2]=w,g[A>>2]=w,w|0)}function hn(m){m=m|0;var A=0,y=0,w=0,C=0;if(m)for(w=1;;){if(A=g[m>>2]|0,A|0)do{if(y=g[A>>2]|0,y|0)do C=y,y=g[y+16>>2]|0,Mi(C);while(y|0);C=A,A=g[A+8>>2]|0,Mi(C)}while(A|0);if(A=m,m=g[m+8>>2]|0,w||Mi(A),m)w=0;else break}}function Or(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0,gt=0,Fr=0,Nr=0,Rr=0,Vr=0,io=0,Vn=0,Hn=0,Ui=0,tn=0,cn=0,co=0,zi=0;if(C=m+8|0,g[C>>2]|0)return zi=1,zi|0;if(w=g[m>>2]|0,!w)return zi=0,zi|0;A=w,y=0;do y=y+1|0,A=g[A+8>>2]|0;while(A|0);if(y>>>0<2)return zi=0,zi|0;cn=_c(y<<2)|0,cn||_i(22948,22787,317,22967),tn=_c(y<<5)|0,tn||_i(22989,22787,321,22967),g[m>>2]=0,Nr=m+4|0,g[Nr>>2]=0,g[C>>2]=0,y=0,Ui=0,Fr=0,De=0;e:for(;;){if(pe=g[w>>2]|0,pe){R=0,L=pe;do{if(X=+Re[L+8>>3],A=L,L=g[L+16>>2]|0,te=(L|0)==0,C=te?pe:L,N=+Re[C+8>>3],+En(+(X-N))>3.141592653589793){zi=14;break}R=R+(N-X)*(+Re[A>>3]+ +Re[C>>3])}while(!te);if((zi|0)==14){zi=0,R=0,A=pe;do gt=+Re[A+8>>3],Hn=A+16|0,Vn=g[Hn>>2]|0,Vn=Vn|0?Vn:pe,Bt=+Re[Vn+8>>3],R=R+(+Re[A>>3]+ +Re[Vn>>3])*((Bt<0?Bt+6.283185307179586:Bt)-(gt<0?gt+6.283185307179586:gt)),A=g[(A|0?Hn:w)>>2]|0;while(A|0)}R>0?(g[cn+(Ui<<2)>>2]=w,Ui=Ui+1|0,C=Fr,A=De):zi=19}else zi=19;if((zi|0)==19){zi=0;do if(y){if(A=y+8|0,g[A>>2]|0){zi=21;break e}if(y=Qo(1,12)|0,!y){zi=23;break e}g[A>>2]=y,C=y+4|0,L=y,A=De}else if(De){C=Nr,L=De+8|0,A=w,y=m;break}else if(g[m>>2]|0){zi=27;break e}else{C=Nr,L=m,A=w,y=m;break}while(0);if(g[L>>2]=w,g[C>>2]=w,L=tn+(Fr<<5)|0,te=g[w>>2]|0,te){for(pe=tn+(Fr<<5)+8|0,Re[pe>>3]=17976931348623157e292,De=tn+(Fr<<5)+24|0,Re[De>>3]=17976931348623157e292,Re[L>>3]=-17976931348623157e292,$e=tn+(Fr<<5)+16|0,Re[$e>>3]=-17976931348623157e292,kt=17976931348623157e292,Et=-17976931348623157e292,C=0,nt=te,X=17976931348623157e292,yt=17976931348623157e292,zt=-17976931348623157e292,N=-17976931348623157e292;R=+Re[nt>>3],gt=+Re[nt+8>>3],nt=g[nt+16>>2]|0,Ye=(nt|0)==0,Bt=+Re[(Ye?te:nt)+8>>3],R<X&&(Re[pe>>3]=R,X=R),gt<yt&&(Re[De>>3]=gt,yt=gt),R>zt?Re[L>>3]=R:R=zt,gt>N&&(Re[$e>>3]=gt,N=gt),kt=gt>0&gt<kt?gt:kt,Et=gt<0&gt>Et?gt:Et,C=C|+En(+(gt-Bt))>3.141592653589793,!Ye;)zt=R;C&&(Re[$e>>3]=Et,Re[De>>3]=kt)}else g[L>>2]=0,g[L+4>>2]=0,g[L+8>>2]=0,g[L+12>>2]=0,g[L+16>>2]=0,g[L+20>>2]=0,g[L+24>>2]=0,g[L+28>>2]=0;C=Fr+1|0}if(Hn=w+8|0,w=g[Hn>>2]|0,g[Hn>>2]=0,w)Fr=C,De=A;else{zi=45;break}}if((zi|0)==21)_i(22765,22787,35,22799);else if((zi|0)==23)_i(22819,22787,37,22799);else if((zi|0)==27)_i(22862,22787,61,22885);else if((zi|0)==45){e:do if((Ui|0)>0){for(Hn=(C|0)==0,io=C<<2,Vn=(m|0)==0,Vr=0,A=0;;){if(Rr=g[cn+(Vr<<2)>>2]|0,Hn)zi=73;else{if(Fr=_c(io)|0,!Fr){zi=50;break}if(Nr=_c(io)|0,!Nr){zi=52;break}t:do if(Vn)y=0;else{for(C=0,y=0,L=m;w=tn+(C<<5)|0,yi(g[L>>2]|0,w,g[Rr>>2]|0)|0?(g[Fr+(y<<2)>>2]=L,g[Nr+(y<<2)>>2]=w,Ye=y+1|0):Ye=y,L=g[L+8>>2]|0,L;)C=C+1|0,y=Ye;if((Ye|0)>0)if(w=g[Fr>>2]|0,(Ye|0)==1)y=w;else for($e=0,nt=-1,y=w,De=w;;){for(te=g[De>>2]|0,w=0,L=0;C=g[g[Fr+(L<<2)>>2]>>2]|0,(C|0)==(te|0)?pe=w:pe=w+((yi(C,g[Nr+(L<<2)>>2]|0,g[te>>2]|0)|0)&1)|0,L=L+1|0,(L|0)!=(Ye|0);)w=pe;if(C=(pe|0)>(nt|0),y=C?De:y,w=$e+1|0,(w|0)==(Ye|0))break t;$e=w,nt=C?pe:nt,De=g[Fr+(w<<2)>>2]|0}else y=0}while(0);if(Mi(Fr),Mi(Nr),y){if(C=y+4|0,w=g[C>>2]|0,w)y=w+8|0;else if(g[y>>2]|0){zi=70;break}g[y>>2]=Rr,g[C>>2]=Rr}else zi=73}if((zi|0)==73){if(zi=0,A=g[Rr>>2]|0,A|0)do Nr=A,A=g[A+16>>2]|0,Mi(Nr);while(A|0);Mi(Rr),A=1}if(Vr=Vr+1|0,(Vr|0)>=(Ui|0)){co=A;break e}}(zi|0)==50?_i(23004,22787,249,23023):(zi|0)==52?_i(23042,22787,252,23023):(zi|0)==70&&_i(22862,22787,61,22885)}else co=0;while(0);return Mi(cn),Mi(tn),zi=co,zi|0}return 0}function yi(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0;if(!(dl(A,y)|0)||(A=ta(A)|0,w=+Re[y>>3],C=+Re[y+8>>3],C=A&C<0?C+6.283185307179586:C,m=g[m>>2]|0,!m))return m=0,m|0;if(A){A=0,te=C,y=m;e:for(;;){for(;L=+Re[y>>3],C=+Re[y+8>>3],y=y+16|0,pe=g[y>>2]|0,pe=pe|0?pe:m,R=+Re[pe>>3],N=+Re[pe+8>>3],L>R?(X=L,L=N):(X=R,R=L,L=C,C=N),w=w==R|w==X?w+2220446049250313e-31:w,!!(w<R|w>X);)if(y=g[y>>2]|0,!y){y=22;break e}if(N=L<0?L+6.283185307179586:L,L=C<0?C+6.283185307179586:C,te=N==te|L==te?te+-2220446049250313e-31:te,X=N+(L-N)*((w-R)/(X-R)),(X<0?X+6.283185307179586:X)>te&&(A=A^1),y=g[y>>2]|0,!y){y=22;break}}if((y|0)==22)return A|0}else{A=0,te=C,y=m;e:for(;;){for(;L=+Re[y>>3],C=+Re[y+8>>3],y=y+16|0,pe=g[y>>2]|0,pe=pe|0?pe:m,R=+Re[pe>>3],N=+Re[pe+8>>3],L>R?(X=L,L=N):(X=R,R=L,L=C,C=N),w=w==R|w==X?w+2220446049250313e-31:w,!!(w<R|w>X);)if(y=g[y>>2]|0,!y){y=22;break e}if(te=L==te|C==te?te+-2220446049250313e-31:te,L+(C-L)*((w-R)/(X-R))>te&&(A=A^1),y=g[y>>2]|0,!y){y=22;break}}if((y|0)==22)return A|0}return 0}function vi(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0;if(Et=Ie,Ie=Ie+32|0,kt=Et+16|0,zt=Et,R=nr(m|0,A|0,52)|0,Fe()|0,R=R&15,nt=nr(y|0,w|0,52)|0,Fe()|0,(R|0)!=(nt&15|0))return kt=12,Ie=Et,kt|0;if(te=nr(m|0,A|0,45)|0,Fe()|0,te=te&127,pe=nr(y|0,w|0,45)|0,Fe()|0,pe=pe&127,te>>>0>121|pe>>>0>121)return kt=5,Ie=Et,kt|0;if(nt=(te|0)!=(pe|0),nt){if(N=rs(te,pe)|0,(N|0)==7)return kt=1,Ie=Et,kt|0;X=rs(pe,te)|0,(X|0)==7?_i(23066,23090,161,23100):(Ye=N,L=X)}else Ye=0,L=0;De=yr(te)|0,$e=yr(pe)|0,g[kt>>2]=0,g[kt+4>>2]=0,g[kt+8>>2]=0,g[kt+12>>2]=0;do if(Ye){if(pe=g[4272+(te*28|0)+(Ye<<2)>>2]|0,N=(pe|0)>0,$e)if(N){te=0,X=y,N=w;do X=mu(X,N)|0,N=Fe()|0,L=fs(L)|0,(L|0)==1&&(L=fs(1)|0),te=te+1|0;while((te|0)!=(pe|0));pe=L,te=X,X=N}else pe=L,te=y,X=w;else if(N){te=0,X=y,N=w;do X=ih(X,N)|0,N=Fe()|0,L=fs(L)|0,te=te+1|0;while((te|0)!=(pe|0));pe=L,te=X,X=N}else pe=L,te=y,X=w;if(cf(te,X,kt)|0,nt||_i(23115,23090,191,23100),N=(De|0)!=0,L=($e|0)!=0,N&L&&_i(23142,23090,192,23100),N){if(L=xs(m,A)|0,(L|0)==7){R=5;break}if(Xr[21872+(L*7|0)+Ye>>0]|0){R=1;break}X=g[21040+(L*28|0)+(Ye<<2)>>2]|0,te=X}else if(L){if(L=xs(te,X)|0,(L|0)==7){R=5;break}if(Xr[21872+(L*7|0)+pe>>0]|0){R=1;break}te=0,X=g[21040+(pe*28|0)+(L<<2)>>2]|0}else te=0,X=0;if((te|X|0)<0)R=5;else{if((X|0)>0){N=kt+4|0,L=0;do sf(N),L=L+1|0;while((L|0)!=(X|0))}if(g[zt>>2]=0,g[zt+4>>2]=0,g[zt+8>>2]=0,pl(zt,Ye),R|0)for(;Zo(R)|0?of(zt):Gc(zt),(R|0)>1;)R=R+-1|0;if((te|0)>0){R=0;do sf(zt),R=R+1|0;while((R|0)!=(te|0))}yt=kt+4|0,lo(yt,zt,yt),xn(yt),yt=51}}else if(cf(y,w,kt)|0,(De|0)!=0&($e|0)!=0)if((pe|0)!=(te|0)&&_i(23173,23090,261,23100),L=xs(m,A)|0,R=xs(y,w)|0,(L|0)==7|(R|0)==7)R=5;else if(Xr[21872+(L*7|0)+R>>0]|0)R=1;else if(L=g[21040+(L*28|0)+(R<<2)>>2]|0,(L|0)>0){N=kt+4|0,R=0;do sf(N),R=R+1|0;while((R|0)!=(L|0));yt=51}else yt=51;else yt=51;while(0);return(yt|0)==51&&(R=kt+4|0,g[C>>2]=g[R>>2],g[C+4>>2]=g[R+4>>2],g[C+8>>2]=g[R+8>>2],R=0),kt=R,Ie=Et,kt|0}function di(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0;if(yt=Ie,Ie=Ie+48|0,te=yt+36|0,L=yt+24|0,N=yt+12|0,X=yt,C=nr(m|0,A|0,52)|0,Fe()|0,C=C&15,$e=nr(m|0,A|0,45)|0,Fe()|0,$e=$e&127,$e>>>0>121)return w=5,Ie=yt,w|0;if(pe=yr($e)|0,Sr(C|0,0,52)|0,zt=Fe()|0|134225919,R=w,g[R>>2]=-1,g[R+4>>2]=zt,!C)return C=Ha(y)|0,(C|0)==7||(C=Mn($e,C)|0,(C|0)==127)?(zt=1,Ie=yt,zt|0):(nt=Sr(C|0,0,45)|0,Ye=Fe()|0,$e=w,Ye=g[$e+4>>2]&-1040385|Ye,zt=w,g[zt>>2]=g[$e>>2]|nt,g[zt+4>>2]=Ye,zt=0,Ie=yt,zt|0);for(g[te>>2]=g[y>>2],g[te+4>>2]=g[y+4>>2],g[te+8>>2]=g[y+8>>2],y=C;;){if(R=y,y=y+-1|0,g[L>>2]=g[te>>2],g[L+4>>2]=g[te+4>>2],g[L+8>>2]=g[te+8>>2],Zo(R)|0){if(C=ja(te)|0,C|0){y=13;break}g[N>>2]=g[te>>2],g[N+4>>2]=g[te+4>>2],g[N+8>>2]=g[te+8>>2],of(N)}else{if(C=LA(te)|0,C|0){y=13;break}g[N>>2]=g[te>>2],g[N+4>>2]=g[te+4>>2],g[N+8>>2]=g[te+8>>2],Gc(N)}if(Qf(L,N,X),xn(X),C=w,Et=g[C>>2]|0,C=g[C+4>>2]|0,Bt=(15-R|0)*3|0,kt=Sr(7,0,Bt|0)|0,C=C&~(Fe()|0),Bt=Sr(Ha(X)|0,0,Bt|0)|0,C=Fe()|0|C,zt=w,g[zt>>2]=Bt|Et&~kt,g[zt+4>>2]=C,(R|0)<=1){y=14;break}}e:do if((y|0)!=13&&(y|0)==14)if((g[te>>2]|0)<=1&&(g[te+4>>2]|0)<=1&&(g[te+8>>2]|0)<=1){y=Ha(te)|0,C=Mn($e,y)|0,(C|0)==127?X=0:X=yr(C)|0;t:do if(y){if(pe){if(C=xs(m,A)|0,(C|0)==7){C=5;break e}if(R=g[21248+(C*28|0)+(y<<2)>>2]|0,(R|0)>0){C=y,y=0;do C=dc(C)|0,y=y+1|0;while((y|0)!=(R|0))}else C=y;if((C|0)==1){C=9;break e}y=Mn($e,C)|0,(y|0)==127&&_i(23200,23090,411,23230),yr(y)|0?_i(23245,23090,412,23230):(Ye=y,nt=R,De=C)}else Ye=C,nt=0,De=y;if(N=g[4272+($e*28|0)+(De<<2)>>2]|0,(N|0)<=-1&&_i(23276,23090,419,23230),!X){if((nt|0)<0){C=5;break e}if(nt|0){R=w,C=0,y=g[R>>2]|0,R=g[R+4>>2]|0;do y=Ga(y,R)|0,R=Fe()|0,Bt=w,g[Bt>>2]=y,g[Bt+4>>2]=R,C=C+1|0;while((C|0)<(nt|0))}if((N|0)<=0){C=Ye,y=58;break}for(R=w,C=0,y=g[R>>2]|0,R=g[R+4>>2]|0;;)if(y=Ga(y,R)|0,R=Fe()|0,Bt=w,g[Bt>>2]=y,g[Bt+4>>2]=R,C=C+1|0,(C|0)==(N|0)){C=Ye,y=58;break t}}if(L=rs(Ye,$e)|0,(L|0)==7&&_i(23066,23090,428,23230),C=w,y=g[C>>2]|0,C=g[C+4>>2]|0,(N|0)>0){R=0;do y=Ga(y,C)|0,C=Fe()|0,Bt=w,g[Bt>>2]=y,g[Bt+4>>2]=C,R=R+1|0;while((R|0)!=(N|0))}if(C=xs(y,C)|0,(C|0)==7&&_i(23313,23090,440,23230),y=Lr(Ye)|0,y=g[(y?21664:21456)+(L*28|0)+(C<<2)>>2]|0,(y|0)<0&&_i(23313,23090,454,23230),!y)C=Ye,y=58;else{L=w,C=0,R=g[L>>2]|0,L=g[L+4>>2]|0;do R=td(R,L)|0,L=Fe()|0,Bt=w,g[Bt>>2]=R,g[Bt+4>>2]=L,C=C+1|0;while((C|0)<(y|0));C=Ye,y=58}}else if((pe|0)!=0&(X|0)!=0){if(y=xs(m,A)|0,R=w,R=xs(g[R>>2]|0,g[R+4>>2]|0)|0,(y|0)==7|(R|0)==7){C=5;break e}if(R=g[21248+(y*28|0)+(R<<2)>>2]|0,(R|0)<0){C=5;break e}if(!R)y=59;else{N=w,y=0,L=g[N>>2]|0,N=g[N+4>>2]|0;do L=Ga(L,N)|0,N=Fe()|0,Bt=w,g[Bt>>2]=L,g[Bt+4>>2]=N,y=y+1|0;while((y|0)<(R|0));y=58}}else y=58;while(0);if((y|0)==58&&X&&(y=59),(y|0)==59&&(Bt=w,(xs(g[Bt>>2]|0,g[Bt+4>>2]|0)|0)==1)){C=9;break}Bt=w,kt=g[Bt>>2]|0,Bt=g[Bt+4>>2]&-1040385,Et=Sr(C|0,0,45)|0,Bt=Bt|(Fe()|0),C=w,g[C>>2]=kt|Et,g[C+4>>2]=Bt,C=0}else C=1;while(0);return Bt=C,Ie=yt,Bt|0}function pi(m,A,y,w,C,R){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0,R=R|0;var L=0,N=0;return N=Ie,Ie=Ie+16|0,L=N,C?m=15:(m=vi(m,A,y,w,L)|0,m||(NA(L,R),m=0)),Ie=N,m|0}function Pi(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0;return L=Ie,Ie=Ie+16|0,R=L,w?y=15:(y=kA(y,R)|0,y||(y=di(m,A,R,C)|0)),Ie=L,y|0}function hi(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0;return X=Ie,Ie=Ie+32|0,L=X+12|0,N=X,R=vi(m,A,m,A,L)|0,R|0?(N=R,Ie=X,N|0):(m=vi(m,A,y,w,N)|0,m|0?(N=m,Ie=X,N|0):(L=af(L,N)|0,N=C,g[N>>2]=L,g[N+4>>2]=((L|0)<0)<<31>>31,N=0,Ie=X,N|0))}function li(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0;return X=Ie,Ie=Ie+32|0,L=X+12|0,N=X,R=vi(m,A,m,A,L)|0,!R&&(R=vi(m,A,y,w,N)|0,!R)?(w=af(L,N)|0,w=bn(w|0,((w|0)<0)<<31>>31|0,1,0)|0,L=Fe()|0,N=C,g[N>>2]=w,g[N+4>>2]=L,N=0,Ie=X,N|0):(N=R,Ie=X,N|0)}function bs(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0,gt=0,Fr=0,Nr=0,Rr=0,Vr=0;if(Rr=Ie,Ie=Ie+48|0,L=Rr+24|0,N=Rr+12|0,Nr=Rr,R=vi(m,A,m,A,L)|0,!R&&(R=vi(m,A,y,w,N)|0,!R)){gt=af(L,N)|0,Fr=((gt|0)<0)<<31>>31,g[L>>2]=0,g[L+4>>2]=0,g[L+8>>2]=0,g[N>>2]=0,g[N+4>>2]=0,g[N+8>>2]=0,vi(m,A,m,A,L)|0&&_i(23313,23090,691,23299),vi(m,A,y,w,N)|0&&_i(23313,23090,696,23299),Il(L),Il(N),gt?(De=g[L>>2]|0,Ye=+(gt|0),kt=L+4|0,$e=g[kt>>2]|0,Et=L+8|0,nt=g[Et>>2]|0,Bt=L,w=De,R=$e,y=nt,yt=+((g[N>>2]|0)-De|0)/Ye,zt=+((g[N+4>>2]|0)-$e|0)/Ye,Ye=+((g[N+8>>2]|0)-nt|0)/Ye):(R=L+4|0,y=L+8|0,kt=R,Et=y,Bt=L,w=g[L>>2]|0,R=g[R>>2]|0,y=g[y>>2]|0,yt=0,zt=0,Ye=0),g[Nr>>2]=w,nt=Nr+4|0,g[nt>>2]=R,$e=Nr+8|0,g[$e>>2]=y;e:do if((gt|0)<0)R=0;else for(pe=0,De=0,R=w;;){te=+(De>>>0)+4294967296*+(pe|0),Vr=yt*te+ +(R|0),X=zt*te+ +(g[kt>>2]|0),te=Ye*te+ +(g[Et>>2]|0),y=~~+Qg(+Vr),L=~~+Qg(+X),R=~~+Qg(+te),Vr=+En(+(+(y|0)-Vr)),X=+En(+(+(L|0)-X)),te=+En(+(+(R|0)-te));do if(Vr>X&Vr>te)y=0-(L+R)|0,w=L;else if(N=0-y|0,X>te){w=N-R|0;break}else{w=L,R=N-L|0;break}while(0);if(g[Nr>>2]=y,g[nt>>2]=w,g[$e>>2]=R,Al(Nr),R=di(m,A,Nr,C+(De<<3)|0)|0,R|0)break e;if(!((pe|0)<(Fr|0)|(pe|0)==(Fr|0)&De>>>0<gt>>>0)){R=0;break e}R=bn(De|0,pe|0,1,0)|0,N=Fe()|0,pe=N,De=R,R=g[Bt>>2]|0}while(0);return Nr=R,Ie=Rr,Nr|0}return Nr=R,Ie=Rr,Nr|0}function Yn(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0;if((y|0)==0&(w|0)==0)return C=0,R=1,gi(C|0),R|0;R=m,C=A,m=1,A=0;do L=(y&1|0)==0&!0,m=ma((L?1:R)|0,(L?0:C)|0,m|0,A|0)|0,A=Fe()|0,y=pv(y|0,w|0,1)|0,w=Fe()|0,R=ma(R|0,C|0,R|0,C|0)|0,C=Fe()|0;while(!((y|0)==0&(w|0)==0));return gi(A|0),m|0}function Ws(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0;if(!(dl(A,y)|0)||(A=ta(A)|0,w=+Re[y>>3],C=+Re[y+8>>3],C=A&C<0?C+6.283185307179586:C,$e=g[m>>2]|0,($e|0)<=0))return $e=0,$e|0;if(De=g[m+4>>2]|0,A){A=0,pe=C,y=-1,m=0;e:for(;;){for(te=m;L=+Re[De+(te<<4)>>3],C=+Re[De+(te<<4)+8>>3],m=(y+2|0)%($e|0)|0,R=+Re[De+(m<<4)>>3],N=+Re[De+(m<<4)+8>>3],L>R?(X=L,L=N):(X=R,R=L,L=C,C=N),w=w==R|w==X?w+2220446049250313e-31:w,!!(w<R|w>X);)if(y=te+1|0,(y|0)>=($e|0)){y=22;break e}else m=te,te=y,y=m;if(N=L<0?L+6.283185307179586:L,L=C<0?C+6.283185307179586:C,pe=N==pe|L==pe?pe+-2220446049250313e-31:pe,X=N+(L-N)*((w-R)/(X-R)),(X<0?X+6.283185307179586:X)>pe&&(A=A^1),m=te+1|0,(m|0)>=($e|0)){y=22;break}else y=te}if((y|0)==22)return A|0}else{A=0,pe=C,y=-1,m=0;e:for(;;){for(te=m;L=+Re[De+(te<<4)>>3],C=+Re[De+(te<<4)+8>>3],m=(y+2|0)%($e|0)|0,R=+Re[De+(m<<4)>>3],N=+Re[De+(m<<4)+8>>3],L>R?(X=L,L=N):(X=R,R=L,L=C,C=N),w=w==R|w==X?w+2220446049250313e-31:w,!!(w<R|w>X);)if(y=te+1|0,(y|0)>=($e|0)){y=22;break e}else m=te,te=y,y=m;if(pe=L==pe|C==pe?pe+-2220446049250313e-31:pe,L+(C-L)*((w-R)/(X-R))>pe&&(A=A^1),m=te+1|0,(m|0)>=($e|0)){y=22;break}else y=te}if((y|0)==22)return A|0}return 0}function ws(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0;if(Ye=g[m>>2]|0,!Ye){g[A>>2]=0,g[A+4>>2]=0,g[A+8>>2]=0,g[A+12>>2]=0,g[A+16>>2]=0,g[A+20>>2]=0,g[A+24>>2]=0,g[A+28>>2]=0;return}if(yt=A+8|0,Re[yt>>3]=17976931348623157e292,zt=A+24|0,Re[zt>>3]=17976931348623157e292,Re[A>>3]=-17976931348623157e292,kt=A+16|0,Re[kt>>3]=-17976931348623157e292,!((Ye|0)<=0)){for($e=g[m+4>>2]|0,te=17976931348623157e292,pe=-17976931348623157e292,De=0,m=-1,R=17976931348623157e292,L=17976931348623157e292,X=-17976931348623157e292,w=-17976931348623157e292,nt=0;y=+Re[$e+(nt<<4)>>3],N=+Re[$e+(nt<<4)+8>>3],m=m+2|0,C=+Re[$e+(((m|0)==(Ye|0)?0:m)<<4)+8>>3],y<R&&(Re[yt>>3]=y,R=y),N<L&&(Re[zt>>3]=N,L=N),y>X?Re[A>>3]=y:y=X,N>w&&(Re[kt>>3]=N,w=N),te=N>0&N<te?N:te,pe=N<0&N>pe?N:pe,De=De|+En(+(N-C))>3.141592653589793,m=nt+1|0,(m|0)!=(Ye|0);)Et=nt,X=y,nt=m,m=Et;De&&(Re[kt>>3]=pe,Re[zt>>3]=te)}}function Io(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0,gt=0,Fr=0,Nr=0,Rr=0;if(Ye=g[m>>2]|0,Ye){if(yt=A+8|0,Re[yt>>3]=17976931348623157e292,zt=A+24|0,Re[zt>>3]=17976931348623157e292,Re[A>>3]=-17976931348623157e292,kt=A+16|0,Re[kt>>3]=-17976931348623157e292,(Ye|0)>0){for(C=g[m+4>>2]|0,$e=17976931348623157e292,nt=-17976931348623157e292,w=0,y=-1,X=17976931348623157e292,te=17976931348623157e292,De=-17976931348623157e292,L=-17976931348623157e292,Et=0;R=+Re[C+(Et<<4)>>3],pe=+Re[C+(Et<<4)+8>>3],Nr=y+2|0,N=+Re[C+(((Nr|0)==(Ye|0)?0:Nr)<<4)+8>>3],R<X&&(Re[yt>>3]=R,X=R),pe<te&&(Re[zt>>3]=pe,te=pe),R>De?Re[A>>3]=R:R=De,pe>L&&(Re[kt>>3]=pe,L=pe),$e=pe>0&pe<$e?pe:$e,nt=pe<0&pe>nt?pe:nt,w=w|+En(+(pe-N))>3.141592653589793,y=Et+1|0,(y|0)!=(Ye|0);)Nr=Et,De=R,Et=y,y=Nr;w&&(Re[kt>>3]=nt,Re[zt>>3]=$e)}}else g[A>>2]=0,g[A+4>>2]=0,g[A+8>>2]=0,g[A+12>>2]=0,g[A+16>>2]=0,g[A+20>>2]=0,g[A+24>>2]=0,g[A+28>>2]=0;if(Nr=m+8|0,y=g[Nr>>2]|0,!((y|0)<=0)){Fr=m+12|0,gt=0;do if(C=g[Fr>>2]|0,w=gt,gt=gt+1|0,zt=A+(gt<<5)|0,kt=g[C+(w<<3)>>2]|0,kt){if(Et=A+(gt<<5)+8|0,Re[Et>>3]=17976931348623157e292,m=A+(gt<<5)+24|0,Re[m>>3]=17976931348623157e292,Re[zt>>3]=-17976931348623157e292,Bt=A+(gt<<5)+16|0,Re[Bt>>3]=-17976931348623157e292,(kt|0)>0){for(Ye=g[C+(w<<3)+4>>2]|0,$e=17976931348623157e292,nt=-17976931348623157e292,C=0,w=-1,yt=0,X=17976931348623157e292,te=17976931348623157e292,pe=-17976931348623157e292,L=-17976931348623157e292;R=+Re[Ye+(yt<<4)>>3],De=+Re[Ye+(yt<<4)+8>>3],w=w+2|0,N=+Re[Ye+(((w|0)==(kt|0)?0:w)<<4)+8>>3],R<X&&(Re[Et>>3]=R,X=R),De<te&&(Re[m>>3]=De,te=De),R>pe?Re[zt>>3]=R:R=pe,De>L&&(Re[Bt>>3]=De,L=De),$e=De>0&De<$e?De:$e,nt=De<0&De>nt?De:nt,C=C|+En(+(De-N))>3.141592653589793,w=yt+1|0,(w|0)!=(kt|0);)Rr=yt,yt=w,pe=R,w=Rr;C&&(Re[Bt>>3]=nt,Re[m>>3]=$e)}}else g[zt>>2]=0,g[zt+4>>2]=0,g[zt+8>>2]=0,g[zt+12>>2]=0,g[zt+16>>2]=0,g[zt+20>>2]=0,g[zt+24>>2]=0,g[zt+28>>2]=0,y=g[Nr>>2]|0;while((gt|0)<(y|0))}}function Jo(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0;if(!(Ws(m,A,y)|0))return C=0,C|0;if(C=m+8|0,(g[C>>2]|0)<=0)return C=1,C|0;for(w=m+12|0,m=0;;){if(R=m,m=m+1|0,Ws((g[w>>2]|0)+(R<<3)|0,A+(m<<5)|0,y)|0){m=0,w=6;break}if((m|0)>=(g[C>>2]|0)){m=1,w=6;break}}return(w|0)==6?m|0:0}function Wa(){return 8}function pa(){return 16}function vu(){return 168}function Ia(){return 8}function Kl(){return 16}function Bl(){return 12}function rd(){return 8}function nh(m){return m=m|0,+(+((g[m>>2]|0)>>>0)+4294967296*+(g[m+4>>2]|0))}function xu(m){m=m|0;var A=0,y=0;return y=+Re[m>>3],A=+Re[m+8>>3],+ +ln(+(y*y+A*A))}function uf(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0;te=+Re[m>>3],X=+Re[A>>3]-te,N=+Re[m+8>>3],L=+Re[A+8>>3]-N,De=+Re[y>>3],R=+Re[w>>3]-De,$e=+Re[y+8>>3],pe=+Re[w+8>>3]-$e,R=(R*(N-$e)-(te-De)*pe)/(X*pe-L*R),Re[C>>3]=te+X*R,Re[C+8>>3]=N+L*R}function oh(m,A){return m=m|0,A=A|0,+En(+(+Re[m>>3]-+Re[A>>3]))<11920928955078125e-23?(A=+En(+(+Re[m+8>>3]-+Re[A+8>>3]))<11920928955078125e-23,A|0):(A=0,A|0)}function ro(m,A){m=m|0,A=A|0;var y=0,w=0,C=0;return C=+Re[m>>3]-+Re[A>>3],w=+Re[m+8>>3]-+Re[A+8>>3],y=+Re[m+16>>3]-+Re[A+16>>3],+(C*C+w*w+y*y)}function id(m,A){m=m|0,A=A|0;var y=0,w=0,C=0;y=+Re[m>>3],w=+ji(+y),y=+Gi(+y),Re[A+16>>3]=y,y=+Re[m+8>>3],C=w*+ji(+y),Re[A>>3]=C,y=w*+Gi(+y),Re[A+8>>3]=y}function gc(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0;if(R=Ie,Ie=Ie+16|0,C=R,w=mn(m,A)|0,(y+-1|0)>>>0>5||(w=(w|0)!=0,(y|0)==1&w))return C=-1,Ie=R,C|0;do if(Ho(m,A,C)|0)w=-1;else if(w){w=((g[21936+(y<<2)>>2]|0)+5-(g[C>>2]|0)|0)%5|0;break}else{w=((g[21968+(y<<2)>>2]|0)+6-(g[C>>2]|0)|0)%6|0;break}while(0);return C=w,Ie=R,C|0}function Ho(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0,te=0;if(te=Ie,Ie=Ie+32|0,L=te+16|0,N=te,w=_u(m,A,L)|0,w|0)return y=w,Ie=te,y|0;R=zA(m,A)|0,X=xs(m,A)|0,jr(R,N),w=Ci(R,g[L>>2]|0)|0;e:do if(yr(R)|0){do switch(R|0){case 4:{m=0;break}case 14:{m=1;break}case 24:{m=2;break}case 38:{m=3;break}case 49:{m=4;break}case 58:{m=5;break}case 63:{m=6;break}case 72:{m=7;break}case 83:{m=8;break}case 97:{m=9;break}case 107:{m=10;break}case 117:{m=11;break}default:{w=1;break e}}while(0);if(C=g[22e3+(m*24|0)+8>>2]|0,A=g[22e3+(m*24|0)+16>>2]|0,m=g[L>>2]|0,(m|0)!=(g[N>>2]|0)&&(N=Lr(R)|0,m=g[L>>2]|0,N|(m|0)==(A|0)&&(w=(w+1|0)%6|0)),(X|0)==3&(m|0)==(A|0)){w=(w+5|0)%6|0,C=22;break}(X|0)==5&(m|0)==(C|0)&&(w=(w+1|0)%6|0),C=22}else C=22;while(0);return(C|0)==22&&(g[y>>2]=w,w=0),y=w,Ie=te,y|0}function Ts(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0;if(Bt=Ie,Ie=Ie+32|0,Et=Bt+24|0,zt=Bt+20|0,Ye=Bt+8|0,nt=Bt+16|0,$e=Bt,X=(mn(m,A)|0)==0,X=X?6:5,pe=nr(m|0,A|0,52)|0,Fe()|0,pe=pe&15,X>>>0<=y>>>0)return w=2,Ie=Bt,w|0;De=(pe|0)==0,!De&&(yt=Sr(7,0,(pe^15)*3|0)|0,(yt&m|0)==0&((Fe()|0)&A|0)==0)?C=y:R=4;e:do if((R|0)==4){if(C=(mn(m,A)|0)!=0,((C?4:5)|0)<(y|0)||Ho(m,A,Et)|0||(R=(g[Et>>2]|0)+y|0,C?C=22288+(((R|0)%5|0)<<2)|0:C=22320+(((R|0)%6|0)<<2)|0,yt=g[C>>2]|0,(yt|0)==7))return w=1,Ie=Bt,w|0;g[zt>>2]=0,C=Vo(m,A,yt,zt,Ye)|0;do if(!C){if(N=Ye,te=g[N>>2]|0,N=g[N+4>>2]|0,L=N>>>0<A>>>0|(N|0)==(A|0)&te>>>0<m>>>0,R=L?te:m,L=L?N:A,!De&&(De=Sr(7,0,(pe^15)*3|0)|0,(te&De|0)==0&(N&(Fe()|0)|0)==0))C=y;else{if(N=(y+-1+X|0)%(X|0)|0,C=mn(m,A)|0,(N|0)<0&&_i(23313,23315,245,23324),X=(C|0)!=0,((X?4:5)|0)<(N|0)&&_i(23313,23315,245,23324),Ho(m,A,Et)|0&&_i(23313,23315,245,23324),C=(g[Et>>2]|0)+N|0,X?C=22288+(((C|0)%5|0)<<2)|0:C=22320+(((C|0)%6|0)<<2)|0,N=g[C>>2]|0,(N|0)==7&&_i(23313,23315,245,23324),g[nt>>2]=0,C=Vo(m,A,N,nt,$e)|0,C|0)break;te=$e,X=g[te>>2]|0,te=g[te+4>>2]|0;do if(te>>>0<L>>>0|(te|0)==(L|0)&X>>>0<R>>>0){if(mn(X,te)|0?R=ze(X,te,m,A)|0:R=g[22384+((((g[nt>>2]|0)+(g[22352+(N<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,C=mn(X,te)|0,(R+-1|0)>>>0>5){C=-1,R=X,L=te;break}if(C=(C|0)!=0,(R|0)==1&C){C=-1,R=X,L=te;break}do if(Ho(X,te,Et)|0)C=-1;else if(C){C=((g[21936+(R<<2)>>2]|0)+5-(g[Et>>2]|0)|0)%5|0;break}else{C=((g[21968+(R<<2)>>2]|0)+6-(g[Et>>2]|0)|0)%6|0;break}while(0);R=X,L=te}else C=y;while(0);N=Ye,te=g[N>>2]|0,N=g[N+4>>2]|0}if((R|0)==(te|0)&(L|0)==(N|0)){if(X=(mn(te,N)|0)!=0,X?m=ze(te,N,m,A)|0:m=g[22384+((((g[zt>>2]|0)+(g[22352+(yt<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,C=mn(te,N)|0,(m+-1|0)>>>0<=5&&(kt=(C|0)!=0,!((m|0)==1&kt)))do if(Ho(te,N,Et)|0)C=-1;else if(kt){C=((g[21936+(m<<2)>>2]|0)+5-(g[Et>>2]|0)|0)%5|0;break}else{C=((g[21968+(m<<2)>>2]|0)+6-(g[Et>>2]|0)|0)%6|0;break}while(0);else C=-1;C=C+1|0,C=(C|0)==6|X&(C|0)==5?0:C}A=L,m=R;break e}while(0);return w=C,Ie=Bt,w|0}while(0);return kt=Sr(C|0,0,56)|0,Et=Fe()|0|A&-2130706433|536870912,g[w>>2]=kt|m,g[w+4>>2]=Et,w=0,Ie=Bt,w|0}function bu(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0;return R=(mn(m,A)|0)==0,w=Ts(m,A,0,y)|0,C=(w|0)==0,R?!C||(w=Ts(m,A,1,y+8|0)|0,w|0)||(w=Ts(m,A,2,y+16|0)|0,w|0)||(w=Ts(m,A,3,y+24|0)|0,w|0)||(w=Ts(m,A,4,y+32|0)|0,w)?(R=w,R|0):Ts(m,A,5,y+40|0)|0:!C||(w=Ts(m,A,1,y+8|0)|0,w|0)||(w=Ts(m,A,2,y+16|0)|0,w|0)||(w=Ts(m,A,3,y+24|0)|0,w|0)||(w=Ts(m,A,4,y+32|0)|0,w|0)?(R=w,R|0):(R=y+40|0,g[R>>2]=0,g[R+4>>2]=0,R=0,R|0)}function ff(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0,N=0,X=0;return X=Ie,Ie=Ie+192|0,C=X,R=X+168|0,L=nr(m|0,A|0,56)|0,Fe()|0,L=L&7,N=A&-2130706433|134217728,w=_u(m,N,R)|0,w|0?(N=w,Ie=X,N|0):(A=nr(m|0,A|0,52)|0,Fe()|0,A=A&15,mn(m,N)|0?ml(R,A,L,1,C):$f(R,A,L,1,C),N=C+8|0,g[y>>2]=g[N>>2],g[y+4>>2]=g[N+4>>2],g[y+8>>2]=g[N+8>>2],g[y+12>>2]=g[N+12>>2],N=0,Ie=X,N|0)}function Cn(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0;return C=Ie,Ie=Ie+16|0,y=C,!(!0&(A&2013265920|0)==536870912)||(w=A&-2130706433|134217728,!(Wc(m,w)|0))?(w=0,Ie=C,w|0):(R=nr(m|0,A|0,56)|0,Fe()|0,R=(Ts(m,w,R&7,y)|0)==0,w=y,w=R&((g[w>>2]|0)==(m|0)?(g[w+4>>2]|0)==(A|0):0)&1,Ie=C,w|0)}function qa(m,A,y){m=m|0,A=A|0,y=y|0;var w=0;(A|0)>0?(w=Qo(A,4)|0,g[m>>2]=w,w||_i(23337,23360,40,23374)):g[m>>2]=0,g[m+4>>2]=A,g[m+8>>2]=0,g[m+12>>2]=y}function Aa(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0;C=m+4|0,R=m+12|0,L=m+8|0;e:for(;;){for(y=g[C>>2]|0,A=0;;){if((A|0)>=(y|0))break e;if(w=g[m>>2]|0,N=g[w+(A<<2)>>2]|0,!N)A=A+1|0;else break}A=w+(~~(+En(+(+$n(10,+ +(15-(g[R>>2]|0)|0))*(+Re[N>>3]+ +Re[N+8>>3])))%+(y|0))>>>0<<2)|0,y=g[A>>2]|0;t:do if(y|0){if(w=N+32|0,(y|0)==(N|0))g[A>>2]=g[w>>2];else{if(y=y+32|0,A=g[y>>2]|0,!A)break;for(;(A|0)!=(N|0);)if(y=A+32|0,A=g[y>>2]|0,!A)break t;g[y>>2]=g[w>>2]}Mi(N),g[L>>2]=(g[L>>2]|0)+-1}while(0)}Mi(g[m>>2]|0)}function wu(m){m=m|0;var A=0,y=0,w=0;for(w=g[m+4>>2]|0,y=0;;){if((y|0)>=(w|0)){A=0,y=4;break}if(A=g[(g[m>>2]|0)+(y<<2)>>2]|0,!A)y=y+1|0;else{y=4;break}}return(y|0)==4?A|0:0}function Kg(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0;if(y=~~(+En(+(+$n(10,+ +(15-(g[m+12>>2]|0)|0))*(+Re[A>>3]+ +Re[A+8>>3])))%+(g[m+4>>2]|0))>>>0,y=(g[m>>2]|0)+(y<<2)|0,w=g[y>>2]|0,!w)return R=1,R|0;R=A+32|0;do if((w|0)!=(A|0)){if(y=g[w+32>>2]|0,!y)return R=1,R|0;for(C=y;;){if((C|0)==(A|0)){C=8;break}if(y=g[C+32>>2]|0,y)w=C,C=y;else{y=1,C=10;break}}if((C|0)==8){g[w+32>>2]=g[R>>2];break}else if((C|0)==10)return y|0}else g[y>>2]=g[R>>2];while(0);return Mi(A),R=m+8|0,g[R>>2]=(g[R>>2]|0)+-1,R=0,R|0}function dp(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0;R=_c(40)|0,R||_i(23390,23360,98,23403),g[R>>2]=g[A>>2],g[R+4>>2]=g[A+4>>2],g[R+8>>2]=g[A+8>>2],g[R+12>>2]=g[A+12>>2],C=R+16|0,g[C>>2]=g[y>>2],g[C+4>>2]=g[y+4>>2],g[C+8>>2]=g[y+8>>2],g[C+12>>2]=g[y+12>>2],g[R+32>>2]=0,C=~~(+En(+(+$n(10,+ +(15-(g[m+12>>2]|0)|0))*(+Re[A>>3]+ +Re[A+8>>3])))%+(g[m+4>>2]|0))>>>0,C=(g[m>>2]|0)+(C<<2)|0,w=g[C>>2]|0;do if(!w)g[C>>2]=R;else{for(;!(Ee(w,A)|0&&Ee(w+16|0,y)|0);)if(C=g[w+32>>2]|0,w=C|0?C:w,!(g[w+32>>2]|0)){L=10;break}if((L|0)==10){g[w+32>>2]=R;break}return Mi(R),L=w,L|0}while(0);return L=m+8|0,g[L>>2]=(g[L>>2]|0)+1,L=R,L|0}function hv(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0;if(C=~~(+En(+(+$n(10,+ +(15-(g[m+12>>2]|0)|0))*(+Re[A>>3]+ +Re[A+8>>3])))%+(g[m+4>>2]|0))>>>0,C=g[(g[m>>2]|0)+(C<<2)>>2]|0,!C)return y=0,y|0;if(!y){for(m=C;;){if(Ee(m,A)|0){w=10;break}if(m=g[m+32>>2]|0,!m){m=0,w=10;break}}if((w|0)==10)return m|0}for(m=C;;){if(Ee(m,A)|0&&Ee(m+16|0,y)|0){w=10;break}if(m=g[m+32>>2]|0,!m){m=0,w=10;break}}return(w|0)==10?m|0:0}function nd(m,A){m=m|0,A=A|0;var y=0;if(y=~~(+En(+(+$n(10,+ +(15-(g[m+12>>2]|0)|0))*(+Re[A>>3]+ +Re[A+8>>3])))%+(g[m+4>>2]|0))>>>0,m=g[(g[m>>2]|0)+(y<<2)>>2]|0,!m)return y=0,y|0;for(;;){if(Ee(m,A)|0){A=5;break}if(m=g[m+32>>2]|0,!m){m=0,A=5;break}}return(A|0)==5?m|0:0}function Zg(){return 23424}function sh(m){return m=+m,+ +Kw(+m)}function Zl(m){return m=+m,~~+sh(m)|0}function _c(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0,yt=0,zt=0,kt=0,Et=0,Bt=0,gt=0,Fr=0;Fr=Ie,Ie=Ie+16|0,$e=Fr;do if(m>>>0<245){if(te=m>>>0<11?16:m+11&-8,m=te>>>3,De=g[5857]|0,y=De>>>m,y&3|0)return A=(y&1^1)+m|0,m=23468+(A<<1<<2)|0,y=m+8|0,w=g[y>>2]|0,C=w+8|0,R=g[C>>2]|0,(R|0)==(m|0)?g[5857]=De&~(1<<A):(g[R+12>>2]=m,g[y>>2]=R),gt=A<<3,g[w+4>>2]=gt|3,gt=w+gt+4|0,g[gt>>2]=g[gt>>2]|1,gt=C,Ie=Fr,gt|0;if(pe=g[5859]|0,te>>>0>pe>>>0){if(y|0)return A=2<<m,A=y<<m&(A|0-A),A=(A&0-A)+-1|0,N=A>>>12&16,A=A>>>N,y=A>>>5&8,A=A>>>y,R=A>>>2&4,A=A>>>R,m=A>>>1&2,A=A>>>m,w=A>>>1&1,w=(y|N|R|m|w)+(A>>>w)|0,A=23468+(w<<1<<2)|0,m=A+8|0,R=g[m>>2]|0,N=R+8|0,y=g[N>>2]|0,(y|0)==(A|0)?(m=De&~(1<<w),g[5857]=m):(g[y+12>>2]=A,g[m>>2]=y,m=De),gt=w<<3,L=gt-te|0,g[R+4>>2]=te|3,C=R+te|0,g[C+4>>2]=L|1,g[R+gt>>2]=L,pe|0&&(w=g[5862]|0,A=pe>>>3,y=23468+(A<<1<<2)|0,A=1<<A,m&A?(m=y+8|0,A=g[m>>2]|0):(g[5857]=m|A,A=y,m=y+8|0),g[m>>2]=w,g[A+12>>2]=w,g[w+8>>2]=A,g[w+12>>2]=y),g[5859]=L,g[5862]=C,gt=N,Ie=Fr,gt|0;if(R=g[5858]|0,R){for(y=(R&0-R)+-1|0,C=y>>>12&16,y=y>>>C,w=y>>>5&8,y=y>>>w,L=y>>>2&4,y=y>>>L,N=y>>>1&2,y=y>>>N,X=y>>>1&1,X=g[23732+((w|C|L|N|X)+(y>>>X)<<2)>>2]|0,y=X,N=X,X=(g[X+4>>2]&-8)-te|0;m=g[y+16>>2]|0,!(!m&&(m=g[y+20>>2]|0,!m));)L=(g[m+4>>2]&-8)-te|0,C=L>>>0<X>>>0,y=m,N=C?m:N,X=C?L:X;if(L=N+te|0,L>>>0>N>>>0){C=g[N+24>>2]|0,A=g[N+12>>2]|0;do if((A|0)==(N|0)){if(m=N+20|0,A=g[m>>2]|0,!A&&(m=N+16|0,A=g[m>>2]|0,!A)){y=0;break}for(;;)if(w=A+20|0,y=g[w>>2]|0,y)A=y,m=w;else if(w=A+16|0,y=g[w>>2]|0,y)A=y,m=w;else break;g[m>>2]=0,y=A}else y=g[N+8>>2]|0,g[y+12>>2]=A,g[A+8>>2]=y,y=A;while(0);do if(C|0){if(A=g[N+28>>2]|0,m=23732+(A<<2)|0,(N|0)==(g[m>>2]|0)){if(g[m>>2]=y,!y){g[5858]=R&~(1<<A);break}}else if(gt=C+16|0,g[((g[gt>>2]|0)==(N|0)?gt:C+20|0)>>2]=y,!y)break;g[y+24>>2]=C,A=g[N+16>>2]|0,A|0&&(g[y+16>>2]=A,g[A+24>>2]=y),A=g[N+20>>2]|0,A|0&&(g[y+20>>2]=A,g[A+24>>2]=y)}while(0);return X>>>0<16?(gt=X+te|0,g[N+4>>2]=gt|3,gt=N+gt+4|0,g[gt>>2]=g[gt>>2]|1):(g[N+4>>2]=te|3,g[L+4>>2]=X|1,g[L+X>>2]=X,pe|0&&(w=g[5862]|0,A=pe>>>3,y=23468+(A<<1<<2)|0,A=1<<A,A&De?(m=y+8|0,A=g[m>>2]|0):(g[5857]=A|De,A=y,m=y+8|0),g[m>>2]=w,g[A+12>>2]=w,g[w+8>>2]=A,g[w+12>>2]=y),g[5859]=X,g[5862]=L),gt=N+8|0,Ie=Fr,gt|0}else De=te}else De=te}else De=te}else if(m>>>0<=4294967231)if(m=m+11|0,te=m&-8,w=g[5858]|0,w){C=0-te|0,m=m>>>8,m?te>>>0>16777215?X=31:(De=(m+1048320|0)>>>16&8,yt=m<<De,N=(yt+520192|0)>>>16&4,yt=yt<<N,X=(yt+245760|0)>>>16&2,X=14-(N|De|X)+(yt<<X>>>15)|0,X=te>>>(X+7|0)&1|X<<1):X=0,y=g[23732+(X<<2)>>2]|0;e:do if(!y)y=0,m=0,yt=61;else for(m=0,N=te<<((X|0)==31?0:25-(X>>>1)|0),R=0;;){if(L=(g[y+4>>2]&-8)-te|0,L>>>0<C>>>0)if(L)m=y,C=L;else{m=y,C=0,yt=65;break e}if(yt=g[y+20>>2]|0,y=g[y+16+(N>>>31<<2)>>2]|0,R=(yt|0)==0|(yt|0)==(y|0)?R:yt,y)N=N<<1;else{y=R,yt=61;break}}while(0);if((yt|0)==61){if((y|0)==0&(m|0)==0){if(m=2<<X,m=(m|0-m)&w,!m){De=te;break}De=(m&0-m)+-1|0,L=De>>>12&16,De=De>>>L,R=De>>>5&8,De=De>>>R,N=De>>>2&4,De=De>>>N,X=De>>>1&2,De=De>>>X,y=De>>>1&1,m=0,y=g[23732+((R|L|N|X|y)+(De>>>y)<<2)>>2]|0}y?yt=65:(N=m,L=C)}if((yt|0)==65)for(R=y;;)if(De=(g[R+4>>2]&-8)-te|0,y=De>>>0<C>>>0,C=y?De:C,m=y?R:m,y=g[R+16>>2]|0,y||(y=g[R+20>>2]|0),y)R=y;else{N=m,L=C;break}if(N|0&&L>>>0<((g[5859]|0)-te|0)>>>0&&(pe=N+te|0,pe>>>0>N>>>0)){R=g[N+24>>2]|0,A=g[N+12>>2]|0;do if((A|0)==(N|0)){if(m=N+20|0,A=g[m>>2]|0,!A&&(m=N+16|0,A=g[m>>2]|0,!A)){A=0;break}for(;;)if(C=A+20|0,y=g[C>>2]|0,y)A=y,m=C;else if(C=A+16|0,y=g[C>>2]|0,y)A=y,m=C;else break;g[m>>2]=0}else gt=g[N+8>>2]|0,g[gt+12>>2]=A,g[A+8>>2]=gt;while(0);do if(R){if(m=g[N+28>>2]|0,y=23732+(m<<2)|0,(N|0)==(g[y>>2]|0)){if(g[y>>2]=A,!A){w=w&~(1<<m),g[5858]=w;break}}else if(gt=R+16|0,g[((g[gt>>2]|0)==(N|0)?gt:R+20|0)>>2]=A,!A)break;g[A+24>>2]=R,m=g[N+16>>2]|0,m|0&&(g[A+16>>2]=m,g[m+24>>2]=A),m=g[N+20>>2]|0,m&&(g[A+20>>2]=m,g[m+24>>2]=A)}while(0);e:do if(L>>>0<16)gt=L+te|0,g[N+4>>2]=gt|3,gt=N+gt+4|0,g[gt>>2]=g[gt>>2]|1;else{if(g[N+4>>2]=te|3,g[pe+4>>2]=L|1,g[pe+L>>2]=L,A=L>>>3,L>>>0<256){y=23468+(A<<1<<2)|0,m=g[5857]|0,A=1<<A,m&A?(m=y+8|0,A=g[m>>2]|0):(g[5857]=m|A,A=y,m=y+8|0),g[m>>2]=pe,g[A+12>>2]=pe,g[pe+8>>2]=A,g[pe+12>>2]=y;break}if(A=L>>>8,A?L>>>0>16777215?y=31:(Bt=(A+1048320|0)>>>16&8,gt=A<<Bt,Et=(gt+520192|0)>>>16&4,gt=gt<<Et,y=(gt+245760|0)>>>16&2,y=14-(Et|Bt|y)+(gt<<y>>>15)|0,y=L>>>(y+7|0)&1|y<<1):y=0,A=23732+(y<<2)|0,g[pe+28>>2]=y,m=pe+16|0,g[m+4>>2]=0,g[m>>2]=0,m=1<<y,!(w&m)){g[5858]=w|m,g[A>>2]=pe,g[pe+24>>2]=A,g[pe+12>>2]=pe,g[pe+8>>2]=pe;break}A=g[A>>2]|0;t:do if((g[A+4>>2]&-8|0)!=(L|0)){for(w=L<<((y|0)==31?0:25-(y>>>1)|0);y=A+16+(w>>>31<<2)|0,m=g[y>>2]|0,!!m;)if((g[m+4>>2]&-8|0)==(L|0)){A=m;break t}else w=w<<1,A=m;g[y>>2]=pe,g[pe+24>>2]=A,g[pe+12>>2]=pe,g[pe+8>>2]=pe;break e}while(0);Bt=A+8|0,gt=g[Bt>>2]|0,g[gt+12>>2]=pe,g[Bt>>2]=pe,g[pe+8>>2]=gt,g[pe+12>>2]=A,g[pe+24>>2]=0}while(0);return gt=N+8|0,Ie=Fr,gt|0}else De=te}else De=te;else De=-1;while(0);if(y=g[5859]|0,y>>>0>=De>>>0)return A=y-De|0,m=g[5862]|0,A>>>0>15?(gt=m+De|0,g[5862]=gt,g[5859]=A,g[gt+4>>2]=A|1,g[m+y>>2]=A,g[m+4>>2]=De|3):(g[5859]=0,g[5862]=0,g[m+4>>2]=y|3,gt=m+y+4|0,g[gt>>2]=g[gt>>2]|1),gt=m+8|0,Ie=Fr,gt|0;if(L=g[5860]|0,L>>>0>De>>>0)return Et=L-De|0,g[5860]=Et,gt=g[5863]|0,Bt=gt+De|0,g[5863]=Bt,g[Bt+4>>2]=Et|1,g[gt+4>>2]=De|3,gt=gt+8|0,Ie=Fr,gt|0;if(g[5975]|0?m=g[5977]|0:(g[5977]=4096,g[5976]=4096,g[5978]=-1,g[5979]=-1,g[5980]=0,g[5968]=0,g[5975]=$e&-16^1431655768,m=4096),N=De+48|0,X=De+47|0,R=m+X|0,C=0-m|0,te=R&C,te>>>0<=De>>>0||(m=g[5967]|0,m|0&&(pe=g[5965]|0,$e=pe+te|0,$e>>>0<=pe>>>0|$e>>>0>m>>>0)))return gt=0,Ie=Fr,gt|0;e:do if(g[5968]&4)A=0,yt=143;else{y=g[5863]|0;t:do if(y){for(w=23876;$e=g[w>>2]|0,!($e>>>0<=y>>>0&&($e+(g[w+4>>2]|0)|0)>>>0>y>>>0);)if(m=g[w+8>>2]|0,m)w=m;else{yt=128;break t}if(A=R-L&C,A>>>0<2147483647)if(m=ah(A|0)|0,(m|0)==((g[w>>2]|0)+(g[w+4>>2]|0)|0)){if((m|0)!=-1){L=A,R=m,yt=145;break e}}else w=m,yt=136;else A=0}else yt=128;while(0);do if((yt|0)==128)if(y=ah(0)|0,(y|0)!=-1&&(A=y,nt=g[5976]|0,Ye=nt+-1|0,A=(Ye&A|0?(Ye+A&0-nt)-A|0:0)+te|0,nt=g[5965]|0,Ye=A+nt|0,A>>>0>De>>>0&A>>>0<2147483647)){if($e=g[5967]|0,$e|0&&Ye>>>0<=nt>>>0|Ye>>>0>$e>>>0){A=0;break}if(m=ah(A|0)|0,(m|0)==(y|0)){L=A,R=y,yt=145;break e}else w=m,yt=136}else A=0;while(0);do if((yt|0)==136){if(y=0-A|0,!(N>>>0>A>>>0&(A>>>0<2147483647&(w|0)!=-1)))if((w|0)==-1){A=0;break}else{L=A,R=w,yt=145;break e}if(m=g[5977]|0,m=X-A+m&0-m,m>>>0>=2147483647){L=A,R=w,yt=145;break e}if((ah(m|0)|0)==-1){ah(y|0)|0,A=0;break}else{L=m+A|0,R=w,yt=145;break e}}while(0);g[5968]=g[5968]|4,yt=143}while(0);if((yt|0)==143&&te>>>0<2147483647&&(Et=ah(te|0)|0,Ye=ah(0)|0,zt=Ye-Et|0,kt=zt>>>0>(De+40|0)>>>0,!((Et|0)==-1|kt^1|Et>>>0<Ye>>>0&((Et|0)!=-1&(Ye|0)!=-1)^1))&&(L=kt?zt:A,R=Et,yt=145),(yt|0)==145){A=(g[5965]|0)+L|0,g[5965]=A,A>>>0>(g[5966]|0)>>>0&&(g[5966]=A),X=g[5863]|0;e:do if(X){for(A=23876;;){if(m=g[A>>2]|0,y=g[A+4>>2]|0,(R|0)==(m+y|0)){yt=154;break}if(w=g[A+8>>2]|0,w)A=w;else break}if((yt|0)==154&&(Bt=A+4|0,(g[A+12>>2]&8|0)==0)&&R>>>0>X>>>0&m>>>0<=X>>>0){g[Bt>>2]=y+L,gt=(g[5860]|0)+L|0,Et=X+8|0,Et=Et&7|0?0-Et&7:0,Bt=X+Et|0,Et=gt-Et|0,g[5863]=Bt,g[5860]=Et,g[Bt+4>>2]=Et|1,g[X+gt+4>>2]=40,g[5864]=g[5979];break}for(R>>>0<(g[5861]|0)>>>0&&(g[5861]=R),y=R+L|0,A=23876;;){if((g[A>>2]|0)==(y|0)){yt=162;break}if(m=g[A+8>>2]|0,m)A=m;else break}if((yt|0)==162&&!(g[A+12>>2]&8|0)){g[A>>2]=R,pe=A+4|0,g[pe>>2]=(g[pe>>2]|0)+L,pe=R+8|0,pe=R+(pe&7|0?0-pe&7:0)|0,A=y+8|0,A=y+(A&7|0?0-A&7:0)|0,te=pe+De|0,N=A-pe-De|0,g[pe+4>>2]=De|3;t:do if((X|0)==(A|0))gt=(g[5860]|0)+N|0,g[5860]=gt,g[5863]=te,g[te+4>>2]=gt|1;else{if((g[5862]|0)==(A|0)){gt=(g[5859]|0)+N|0,g[5859]=gt,g[5862]=te,g[te+4>>2]=gt|1,g[te+gt>>2]=gt;break}if(m=g[A+4>>2]|0,(m&3|0)==1){L=m&-8,w=m>>>3;r:do if(m>>>0<256)if(m=g[A+8>>2]|0,y=g[A+12>>2]|0,(y|0)==(m|0)){g[5857]=g[5857]&~(1<<w);break}else{g[m+12>>2]=y,g[y+8>>2]=m;break}else{R=g[A+24>>2]|0,m=g[A+12>>2]|0;do if((m|0)==(A|0)){if(y=A+16|0,w=y+4|0,m=g[w>>2]|0,m)y=w;else if(m=g[y>>2]|0,!m){m=0;break}for(;;)if(C=m+20|0,w=g[C>>2]|0,w)m=w,y=C;else if(C=m+16|0,w=g[C>>2]|0,w)m=w,y=C;else break;g[y>>2]=0}else gt=g[A+8>>2]|0,g[gt+12>>2]=m,g[m+8>>2]=gt;while(0);if(!R)break;y=g[A+28>>2]|0,w=23732+(y<<2)|0;do if((g[w>>2]|0)!=(A|0)){if(gt=R+16|0,g[((g[gt>>2]|0)==(A|0)?gt:R+20|0)>>2]=m,!m)break r}else{if(g[w>>2]=m,m|0)break;g[5858]=g[5858]&~(1<<y);break r}while(0);if(g[m+24>>2]=R,y=A+16|0,w=g[y>>2]|0,w|0&&(g[m+16>>2]=w,g[w+24>>2]=m),y=g[y+4>>2]|0,!y)break;g[m+20>>2]=y,g[y+24>>2]=m}while(0);A=A+L|0,C=L+N|0}else C=N;if(A=A+4|0,g[A>>2]=g[A>>2]&-2,g[te+4>>2]=C|1,g[te+C>>2]=C,A=C>>>3,C>>>0<256){y=23468+(A<<1<<2)|0,m=g[5857]|0,A=1<<A,m&A?(m=y+8|0,A=g[m>>2]|0):(g[5857]=m|A,A=y,m=y+8|0),g[m>>2]=te,g[A+12>>2]=te,g[te+8>>2]=A,g[te+12>>2]=y;break}A=C>>>8;do if(!A)w=0;else{if(C>>>0>16777215){w=31;break}Bt=(A+1048320|0)>>>16&8,gt=A<<Bt,Et=(gt+520192|0)>>>16&4,gt=gt<<Et,w=(gt+245760|0)>>>16&2,w=14-(Et|Bt|w)+(gt<<w>>>15)|0,w=C>>>(w+7|0)&1|w<<1}while(0);if(A=23732+(w<<2)|0,g[te+28>>2]=w,m=te+16|0,g[m+4>>2]=0,g[m>>2]=0,m=g[5858]|0,y=1<<w,!(m&y)){g[5858]=m|y,g[A>>2]=te,g[te+24>>2]=A,g[te+12>>2]=te,g[te+8>>2]=te;break}A=g[A>>2]|0;r:do if((g[A+4>>2]&-8|0)!=(C|0)){for(w=C<<((w|0)==31?0:25-(w>>>1)|0);y=A+16+(w>>>31<<2)|0,m=g[y>>2]|0,!!m;)if((g[m+4>>2]&-8|0)==(C|0)){A=m;break r}else w=w<<1,A=m;g[y>>2]=te,g[te+24>>2]=A,g[te+12>>2]=te,g[te+8>>2]=te;break t}while(0);Bt=A+8|0,gt=g[Bt>>2]|0,g[gt+12>>2]=te,g[Bt>>2]=te,g[te+8>>2]=gt,g[te+12>>2]=A,g[te+24>>2]=0}while(0);return gt=pe+8|0,Ie=Fr,gt|0}for(A=23876;m=g[A>>2]|0,!(m>>>0<=X>>>0&&(gt=m+(g[A+4>>2]|0)|0,gt>>>0>X>>>0));)A=g[A+8>>2]|0;C=gt+-47|0,m=C+8|0,m=C+(m&7|0?0-m&7:0)|0,C=X+16|0,m=m>>>0<C>>>0?X:m,A=m+8|0,y=L+-40|0,Et=R+8|0,Et=Et&7|0?0-Et&7:0,Bt=R+Et|0,Et=y-Et|0,g[5863]=Bt,g[5860]=Et,g[Bt+4>>2]=Et|1,g[R+y+4>>2]=40,g[5864]=g[5979],y=m+4|0,g[y>>2]=27,g[A>>2]=g[5969],g[A+4>>2]=g[5970],g[A+8>>2]=g[5971],g[A+12>>2]=g[5972],g[5969]=R,g[5970]=L,g[5972]=0,g[5971]=A,A=m+24|0;do Bt=A,A=A+4|0,g[A>>2]=7;while((Bt+8|0)>>>0<gt>>>0);if((m|0)!=(X|0)){if(R=m-X|0,g[y>>2]=g[y>>2]&-2,g[X+4>>2]=R|1,g[m>>2]=R,A=R>>>3,R>>>0<256){y=23468+(A<<1<<2)|0,m=g[5857]|0,A=1<<A,m&A?(m=y+8|0,A=g[m>>2]|0):(g[5857]=m|A,A=y,m=y+8|0),g[m>>2]=X,g[A+12>>2]=X,g[X+8>>2]=A,g[X+12>>2]=y;break}if(A=R>>>8,A?R>>>0>16777215?w=31:(Bt=(A+1048320|0)>>>16&8,gt=A<<Bt,Et=(gt+520192|0)>>>16&4,gt=gt<<Et,w=(gt+245760|0)>>>16&2,w=14-(Et|Bt|w)+(gt<<w>>>15)|0,w=R>>>(w+7|0)&1|w<<1):w=0,y=23732+(w<<2)|0,g[X+28>>2]=w,g[X+20>>2]=0,g[C>>2]=0,A=g[5858]|0,m=1<<w,!(A&m)){g[5858]=A|m,g[y>>2]=X,g[X+24>>2]=y,g[X+12>>2]=X,g[X+8>>2]=X;break}A=g[y>>2]|0;t:do if((g[A+4>>2]&-8|0)!=(R|0)){for(w=R<<((w|0)==31?0:25-(w>>>1)|0);y=A+16+(w>>>31<<2)|0,m=g[y>>2]|0,!!m;)if((g[m+4>>2]&-8|0)==(R|0)){A=m;break t}else w=w<<1,A=m;g[y>>2]=X,g[X+24>>2]=A,g[X+12>>2]=X,g[X+8>>2]=X;break e}while(0);Bt=A+8|0,gt=g[Bt>>2]|0,g[gt+12>>2]=X,g[Bt>>2]=X,g[X+8>>2]=gt,g[X+12>>2]=A,g[X+24>>2]=0}}else gt=g[5861]|0,(gt|0)==0|R>>>0<gt>>>0&&(g[5861]=R),g[5969]=R,g[5970]=L,g[5972]=0,g[5866]=g[5975],g[5865]=-1,g[5870]=23468,g[5869]=23468,g[5872]=23476,g[5871]=23476,g[5874]=23484,g[5873]=23484,g[5876]=23492,g[5875]=23492,g[5878]=23500,g[5877]=23500,g[5880]=23508,g[5879]=23508,g[5882]=23516,g[5881]=23516,g[5884]=23524,g[5883]=23524,g[5886]=23532,g[5885]=23532,g[5888]=23540,g[5887]=23540,g[5890]=23548,g[5889]=23548,g[5892]=23556,g[5891]=23556,g[5894]=23564,g[5893]=23564,g[5896]=23572,g[5895]=23572,g[5898]=23580,g[5897]=23580,g[5900]=23588,g[5899]=23588,g[5902]=23596,g[5901]=23596,g[5904]=23604,g[5903]=23604,g[5906]=23612,g[5905]=23612,g[5908]=23620,g[5907]=23620,g[5910]=23628,g[5909]=23628,g[5912]=23636,g[5911]=23636,g[5914]=23644,g[5913]=23644,g[5916]=23652,g[5915]=23652,g[5918]=23660,g[5917]=23660,g[5920]=23668,g[5919]=23668,g[5922]=23676,g[5921]=23676,g[5924]=23684,g[5923]=23684,g[5926]=23692,g[5925]=23692,g[5928]=23700,g[5927]=23700,g[5930]=23708,g[5929]=23708,g[5932]=23716,g[5931]=23716,gt=L+-40|0,Et=R+8|0,Et=Et&7|0?0-Et&7:0,Bt=R+Et|0,Et=gt-Et|0,g[5863]=Bt,g[5860]=Et,g[Bt+4>>2]=Et|1,g[R+gt+4>>2]=40,g[5864]=g[5979];while(0);if(A=g[5860]|0,A>>>0>De>>>0)return Et=A-De|0,g[5860]=Et,gt=g[5863]|0,Bt=gt+De|0,g[5863]=Bt,g[Bt+4>>2]=Et|1,g[gt+4>>2]=De|3,gt=gt+8|0,Ie=Fr,gt|0}return gt=Zg()|0,g[gt>>2]=12,gt=0,Ie=Fr,gt|0}function Mi(m){m=m|0;var A=0,y=0,w=0,C=0,R=0,L=0,N=0,X=0;if(!m)return;y=m+-8|0,C=g[5861]|0,m=g[m+-4>>2]|0,A=m&-8,X=y+A|0;do if(m&1)N=y,L=y;else{if(w=g[y>>2]|0,!(m&3)||(L=y+(0-w)|0,R=w+A|0,L>>>0<C>>>0))return;if((g[5862]|0)==(L|0)){if(m=X+4|0,A=g[m>>2]|0,(A&3|0)!=3){N=L,A=R;break}g[5859]=R,g[m>>2]=A&-2,g[L+4>>2]=R|1,g[L+R>>2]=R;return}if(y=w>>>3,w>>>0<256)if(m=g[L+8>>2]|0,A=g[L+12>>2]|0,(A|0)==(m|0)){g[5857]=g[5857]&~(1<<y),N=L,A=R;break}else{g[m+12>>2]=A,g[A+8>>2]=m,N=L,A=R;break}C=g[L+24>>2]|0,m=g[L+12>>2]|0;do if((m|0)==(L|0)){if(A=L+16|0,y=A+4|0,m=g[y>>2]|0,m)A=y;else if(m=g[A>>2]|0,!m){m=0;break}for(;;)if(w=m+20|0,y=g[w>>2]|0,y)m=y,A=w;else if(w=m+16|0,y=g[w>>2]|0,y)m=y,A=w;else break;g[A>>2]=0}else N=g[L+8>>2]|0,g[N+12>>2]=m,g[m+8>>2]=N;while(0);if(C){if(A=g[L+28>>2]|0,y=23732+(A<<2)|0,(g[y>>2]|0)==(L|0)){if(g[y>>2]=m,!m){g[5858]=g[5858]&~(1<<A),N=L,A=R;break}}else if(N=C+16|0,g[((g[N>>2]|0)==(L|0)?N:C+20|0)>>2]=m,!m){N=L,A=R;break}g[m+24>>2]=C,A=L+16|0,y=g[A>>2]|0,y|0&&(g[m+16>>2]=y,g[y+24>>2]=m),A=g[A+4>>2]|0,A?(g[m+20>>2]=A,g[A+24>>2]=m,N=L,A=R):(N=L,A=R)}else N=L,A=R}while(0);if(L>>>0>=X>>>0||(m=X+4|0,w=g[m>>2]|0,!(w&1)))return;if(w&2)g[m>>2]=w&-2,g[N+4>>2]=A|1,g[L+A>>2]=A,C=A;else{if((g[5863]|0)==(X|0)){if(X=(g[5860]|0)+A|0,g[5860]=X,g[5863]=N,g[N+4>>2]=X|1,(N|0)!=(g[5862]|0))return;g[5862]=0,g[5859]=0;return}if((g[5862]|0)==(X|0)){X=(g[5859]|0)+A|0,g[5859]=X,g[5862]=L,g[N+4>>2]=X|1,g[L+X>>2]=X;return}C=(w&-8)+A|0,y=w>>>3;do if(w>>>0<256)if(A=g[X+8>>2]|0,m=g[X+12>>2]|0,(m|0)==(A|0)){g[5857]=g[5857]&~(1<<y);break}else{g[A+12>>2]=m,g[m+8>>2]=A;break}else{R=g[X+24>>2]|0,m=g[X+12>>2]|0;do if((m|0)==(X|0)){if(A=X+16|0,y=A+4|0,m=g[y>>2]|0,m)A=y;else if(m=g[A>>2]|0,!m){y=0;break}for(;;)if(w=m+20|0,y=g[w>>2]|0,y)m=y,A=w;else if(w=m+16|0,y=g[w>>2]|0,y)m=y,A=w;else break;g[A>>2]=0,y=m}else y=g[X+8>>2]|0,g[y+12>>2]=m,g[m+8>>2]=y,y=m;while(0);if(R|0){if(m=g[X+28>>2]|0,A=23732+(m<<2)|0,(g[A>>2]|0)==(X|0)){if(g[A>>2]=y,!y){g[5858]=g[5858]&~(1<<m);break}}else if(w=R+16|0,g[((g[w>>2]|0)==(X|0)?w:R+20|0)>>2]=y,!y)break;g[y+24>>2]=R,m=X+16|0,A=g[m>>2]|0,A|0&&(g[y+16>>2]=A,g[A+24>>2]=y),m=g[m+4>>2]|0,m|0&&(g[y+20>>2]=m,g[m+24>>2]=y)}}while(0);if(g[N+4>>2]=C|1,g[L+C>>2]=C,(N|0)==(g[5862]|0)){g[5859]=C;return}}if(m=C>>>3,C>>>0<256){y=23468+(m<<1<<2)|0,A=g[5857]|0,m=1<<m,A&m?(A=y+8|0,m=g[A>>2]|0):(g[5857]=A|m,m=y,A=y+8|0),g[A>>2]=N,g[m+12>>2]=N,g[N+8>>2]=m,g[N+12>>2]=y;return}m=C>>>8,m?C>>>0>16777215?w=31:(L=(m+1048320|0)>>>16&8,X=m<<L,R=(X+520192|0)>>>16&4,X=X<<R,w=(X+245760|0)>>>16&2,w=14-(R|L|w)+(X<<w>>>15)|0,w=C>>>(w+7|0)&1|w<<1):w=0,m=23732+(w<<2)|0,g[N+28>>2]=w,g[N+20>>2]=0,g[N+16>>2]=0,A=g[5858]|0,y=1<<w;e:do if(!(A&y))g[5858]=A|y,g[m>>2]=N,g[N+24>>2]=m,g[N+12>>2]=N,g[N+8>>2]=N;else{m=g[m>>2]|0;t:do if((g[m+4>>2]&-8|0)!=(C|0)){for(w=C<<((w|0)==31?0:25-(w>>>1)|0);y=m+16+(w>>>31<<2)|0,A=g[y>>2]|0,!!A;)if((g[A+4>>2]&-8|0)==(C|0)){m=A;break t}else w=w<<1,m=A;g[y>>2]=N,g[N+24>>2]=m,g[N+12>>2]=N,g[N+8>>2]=N;break e}while(0);L=m+8|0,X=g[L>>2]|0,g[X+12>>2]=N,g[L>>2]=N,g[N+8>>2]=X,g[N+12>>2]=m,g[N+24>>2]=0}while(0);if(X=(g[5865]|0)+-1|0,g[5865]=X,!(X|0)){for(m=23884;m=g[m>>2]|0,m;)m=m+8|0;g[5865]=-1}}function Qo(m,A){m=m|0,A=A|0;var y=0;return m?(y=fl(A,m)|0,(A|m)>>>0>65535&&(y=((y>>>0)/(m>>>0)|0|0)==(A|0)?y:-1)):y=0,m=_c(y)|0,!m||!(g[m+-4>>2]&3)||sd(m|0,0,y|0)|0,m|0}function bn(m,A,y,w){return m=m|0,A=A|0,y=y|0,w=w|0,y=m+y>>>0,gi(A+w+(y>>>0<m>>>0|0)>>>0|0),y|0|0}function Pa(m,A,y,w){return m=m|0,A=A|0,y=y|0,w=w|0,w=A-w-(y>>>0>m>>>0|0)>>>0,gi(w|0),m-y>>>0|0|0}function Xw(m){return m=m|0,(m?31-(ha(m^m-1)|0)|0:32)|0}function dv(m,A,y,w,C){m=m|0,A=A|0,y=y|0,w=w|0,C=C|0;var R=0,L=0,N=0,X=0,te=0,pe=0,De=0,$e=0,nt=0,Ye=0;if(pe=m,X=A,te=X,L=y,$e=w,N=$e,!te)return R=(C|0)!=0,N?R?(g[C>>2]=m|0,g[C+4>>2]=A&0,$e=0,C=0,gi($e|0),C|0):($e=0,C=0,gi($e|0),C|0):(R&&(g[C>>2]=(pe>>>0)%(L>>>0),g[C+4>>2]=0),$e=0,C=(pe>>>0)/(L>>>0)>>>0,gi($e|0),C|0);R=(N|0)==0;do if(L){if(!R){if(R=(ha(N|0)|0)-(ha(te|0)|0)|0,R>>>0<=31){De=R+1|0,N=31-R|0,A=R-31>>31,L=De,m=pe>>>(De>>>0)&A|te<<N,A=te>>>(De>>>0)&A,R=0,N=pe<<N;break}return C?(g[C>>2]=m|0,g[C+4>>2]=X|A&0,$e=0,C=0,gi($e|0),C|0):($e=0,C=0,gi($e|0),C|0)}if(R=L-1|0,R&L|0){N=(ha(L|0)|0)+33-(ha(te|0)|0)|0,Ye=64-N|0,De=32-N|0,X=De>>31,nt=N-32|0,A=nt>>31,L=N,m=De-1>>31&te>>>(nt>>>0)|(te<<De|pe>>>(N>>>0))&A,A=A&te>>>(N>>>0),R=pe<<Ye&X,N=(te<<Ye|pe>>>(nt>>>0))&X|pe<<De&N-33>>31;break}return C|0&&(g[C>>2]=R&pe,g[C+4>>2]=0),(L|0)==1?(nt=X|A&0,Ye=m|0|0,gi(nt|0),Ye|0):(Ye=Xw(L|0)|0,nt=te>>>(Ye>>>0)|0,Ye=te<<32-Ye|pe>>>(Ye>>>0)|0,gi(nt|0),Ye|0)}else{if(R)return C|0&&(g[C>>2]=(te>>>0)%(L>>>0),g[C+4>>2]=0),nt=0,Ye=(te>>>0)/(L>>>0)>>>0,gi(nt|0),Ye|0;if(!pe)return C|0&&(g[C>>2]=0,g[C+4>>2]=(te>>>0)%(N>>>0)),nt=0,Ye=(te>>>0)/(N>>>0)>>>0,gi(nt|0),Ye|0;if(R=N-1|0,!(R&N))return C|0&&(g[C>>2]=m|0,g[C+4>>2]=R&te|A&0),nt=0,Ye=te>>>((Xw(N|0)|0)>>>0),gi(nt|0),Ye|0;if(R=(ha(N|0)|0)-(ha(te|0)|0)|0,R>>>0<=30){A=R+1|0,N=31-R|0,L=A,m=te<<N|pe>>>(A>>>0),A=te>>>(A>>>0),R=0,N=pe<<N;break}return C?(g[C>>2]=m|0,g[C+4>>2]=X|A&0,nt=0,Ye=0,gi(nt|0),Ye|0):(nt=0,Ye=0,gi(nt|0),Ye|0)}while(0);if(!L)te=N,X=0,N=0;else{De=y|0|0,pe=$e|w&0,te=bn(De|0,pe|0,-1,-1)|0,y=Fe()|0,X=N,N=0;do w=X,X=R>>>31|X<<1,R=N|R<<1,w=m<<1|w>>>31|0,$e=m>>>31|A<<1|0,Pa(te|0,y|0,w|0,$e|0)|0,Ye=Fe()|0,nt=Ye>>31|((Ye|0)<0?-1:0)<<1,N=nt&1,m=Pa(w|0,$e|0,nt&De|0,(((Ye|0)<0?-1:0)>>31|((Ye|0)<0?-1:0)<<1)&pe|0)|0,A=Fe()|0,L=L-1|0;while(L|0);te=X,X=0}return L=0,C|0&&(g[C>>2]=m,g[C+4>>2]=A),nt=(R|0)>>>31|(te|L)<<1|(L<<1|R>>>31)&0|X,Ye=(R<<1|0>>>31)&-2|N,gi(nt|0),Ye|0}function od(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0;return te=A>>31|((A|0)<0?-1:0)<<1,X=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,R=w>>31|((w|0)<0?-1:0)<<1,C=((w|0)<0?-1:0)>>31|((w|0)<0?-1:0)<<1,N=Pa(te^m|0,X^A|0,te|0,X|0)|0,L=Fe()|0,m=R^te,A=C^X,Pa((dv(N,L,Pa(R^y|0,C^w|0,R|0,C|0)|0,Fe()|0,0)|0)^m|0,(Fe()|0)^A|0,m|0,A|0)|0}function eP(m,A){m=m|0,A=A|0;var y=0,w=0,C=0,R=0;return R=m&65535,C=A&65535,y=fl(C,R)|0,w=m>>>16,m=(y>>>16)+(fl(C,w)|0)|0,C=A>>>16,A=fl(C,R)|0,gi((m>>>16)+(fl(C,w)|0)+(((m&65535)+A|0)>>>16)|0),m+A<<16|y&65535|0|0}function ma(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0;return C=m,R=y,y=eP(C,R)|0,m=Fe()|0,gi((fl(A,R)|0)+(fl(w,C)|0)+m|m&0|0),y|0|0|0}function Jg(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0,L=0,N=0,X=0,te=0;return C=Ie,Ie=Ie+16|0,N=C|0,L=A>>31|((A|0)<0?-1:0)<<1,R=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,te=w>>31|((w|0)<0?-1:0)<<1,X=((w|0)<0?-1:0)>>31|((w|0)<0?-1:0)<<1,m=Pa(L^m|0,R^A|0,L|0,R|0)|0,A=Fe()|0,dv(m,A,Pa(te^y|0,X^w|0,te|0,X|0)|0,Fe()|0,N)|0,w=Pa(g[N>>2]^L|0,g[N+4>>2]^R|0,L|0,R|0)|0,y=Fe()|0,Ie=C,gi(y|0),w|0}function hf(m,A,y,w){m=m|0,A=A|0,y=y|0,w=w|0;var C=0,R=0;return R=Ie,Ie=Ie+16|0,C=R|0,dv(m,A,y,w,C)|0,Ie=R,gi(g[C+4>>2]|0),g[C>>2]|0|0}function pv(m,A,y){return m=m|0,A=A|0,y=y|0,(y|0)<32?(gi(A>>y|0),m>>>y|(A&(1<<y)-1)<<32-y):(gi(((A|0)<0?-1:0)|0),A>>y-32|0)}function nr(m,A,y){return m=m|0,A=A|0,y=y|0,(y|0)<32?(gi(A>>>y|0),m>>>y|(A&(1<<y)-1)<<32-y):(gi(0),A>>>y-32|0)}function Sr(m,A,y){return m=m|0,A=A|0,y=y|0,(y|0)<32?(gi(A<<y|(m&(1<<y)-1<<32-y)>>>32-y|0),m<<y):(gi(m<<y-32|0),0)}function Yw(m,A){return m=+m,A=+A,m!=m?+A:A!=A?+m:+Sn(+m,+A)}function Av(m,A){return m=+m,A=+A,m!=m?+A:A!=A?+m:+hu(+m,+A)}function Qg(m){return m=+m,m>=0?+Qn(m+.5):+fu(m-.5)}function $g(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0;if((y|0)>=8192)return Is(m|0,A|0,y|0)|0,m|0;if(R=m|0,C=m+y|0,(m&3)==(A&3)){for(;m&3;){if(!y)return R|0;Xr[m>>0]=Xr[A>>0]|0,m=m+1|0,A=A+1|0,y=y-1|0}for(y=C&-4|0,w=y-64|0;(m|0)<=(w|0);)g[m>>2]=g[A>>2],g[m+4>>2]=g[A+4>>2],g[m+8>>2]=g[A+8>>2],g[m+12>>2]=g[A+12>>2],g[m+16>>2]=g[A+16>>2],g[m+20>>2]=g[A+20>>2],g[m+24>>2]=g[A+24>>2],g[m+28>>2]=g[A+28>>2],g[m+32>>2]=g[A+32>>2],g[m+36>>2]=g[A+36>>2],g[m+40>>2]=g[A+40>>2],g[m+44>>2]=g[A+44>>2],g[m+48>>2]=g[A+48>>2],g[m+52>>2]=g[A+52>>2],g[m+56>>2]=g[A+56>>2],g[m+60>>2]=g[A+60>>2],m=m+64|0,A=A+64|0;for(;(m|0)<(y|0);)g[m>>2]=g[A>>2],m=m+4|0,A=A+4|0}else for(y=C-4|0;(m|0)<(y|0);)Xr[m>>0]=Xr[A>>0]|0,Xr[m+1>>0]=Xr[A+1>>0]|0,Xr[m+2>>0]=Xr[A+2>>0]|0,Xr[m+3>>0]=Xr[A+3>>0]|0,m=m+4|0,A=A+4|0;for(;(m|0)<(C|0);)Xr[m>>0]=Xr[A>>0]|0,m=m+1|0,A=A+1|0;return R|0}function sd(m,A,y){m=m|0,A=A|0,y=y|0;var w=0,C=0,R=0,L=0;if(R=m+y|0,A=A&255,(y|0)>=67){for(;m&3;)Xr[m>>0]=A,m=m+1|0;for(w=R&-4|0,L=A|A<<8|A<<16|A<<24,C=w-64|0;(m|0)<=(C|0);)g[m>>2]=L,g[m+4>>2]=L,g[m+8>>2]=L,g[m+12>>2]=L,g[m+16>>2]=L,g[m+20>>2]=L,g[m+24>>2]=L,g[m+28>>2]=L,g[m+32>>2]=L,g[m+36>>2]=L,g[m+40>>2]=L,g[m+44>>2]=L,g[m+48>>2]=L,g[m+52>>2]=L,g[m+56>>2]=L,g[m+60>>2]=L,m=m+64|0;for(;(m|0)<(w|0);)g[m>>2]=L,m=m+4|0}for(;(m|0)<(R|0);)Xr[m>>0]=A,m=m+1|0;return R-y|0}function Kw(m){return m=+m,m>=0?+Qn(m+.5):+fu(m-.5)}function ah(m){m=m|0;var A=0,y=0,w=0;return w=Vc()|0,y=g[An>>2]|0,A=y+m|0,(m|0)>0&(A|0)<(y|0)|(A|0)<0?(Xl(A|0)|0,Kh(12),-1):(A|0)>(w|0)&&!(Kf(A|0)|0)?(Kh(12),-1):(g[An>>2]=A,y|0)}return{___divdi3:od,___muldi3:ma,___remdi3:Jg,___uremdi3:hf,_areNeighborCells:qi,_bitshift64Ashr:pv,_bitshift64Lshr:nr,_bitshift64Shl:Sr,_calloc:Qo,_cellAreaKm2:Wt,_cellAreaM2:ar,_cellAreaRads2:Rt,_cellToBoundary:d,_cellToCenterChild:fp,_cellToChildPos:k,_cellToChildren:eh,_cellToChildrenSize:Rl,_cellToLatLng:yu,_cellToLocalIj:pi,_cellToParent:$h,_cellToVertex:Ts,_cellToVertexes:bu,_cellsToDirectedEdge:Ac,_cellsToLinkedMultiPolygon:hr,_childPosToCell:V,_compactCells:th,_destroyLinkedMultiPolygon:hn,_directedEdgeToBoundary:Ps,_directedEdgeToCells:pu,_edgeLengthKm:Ir,_edgeLengthM:ti,_edgeLengthRads:ir,_emscripten_replace_memory:hl,_free:Mi,_getBaseCellNumber:zA,_getDirectedEdgeDestination:Gs,_getDirectedEdgeOrigin:Pl,_getHexagonAreaAvgKm2:Ne,_getHexagonAreaAvgM2:Ke,_getHexagonEdgeLengthAvgKm:it,_getHexagonEdgeLengthAvgM:pt,_getIcosahedronFaces:p,_getNumCells:Ct,_getPentagons:B,_getRes0Cells:Va,_getResolution:Bs,_greatCircleDistanceKm:Me,_greatCircleDistanceM:He,_greatCircleDistanceRads:Ce,_gridDisk:jc,_gridDiskDistances:du,_gridDistance:hi,_gridPathCells:bs,_gridPathCellsSize:li,_gridRingUnsafe:st,_i64Add:bn,_i64Subtract:Pa,_isPentagon:mn,_isResClassIII:rh,_isValidCell:Wc,_isValidDirectedEdge:lf,_isValidVertex:Cn,_latLngToCell:hp,_llvm_maxnum_f64:Yw,_llvm_minnum_f64:Av,_llvm_round_f64:Qg,_localIjToCell:Pi,_malloc:_c,_maxFaceCount:_,_maxGridDiskSize:Jf,_maxPolygonToCellsSize:Tt,_memcpy:$g,_memset:sd,_originToDirectedEdges:Yl,_pentagonCount:b,_polygonToCells:Gt,_readInt64AsDoubleFromPointer:nh,_res0CellCount:js,_round:Kw,_sbrk:ah,_sizeOfCellBoundary:vu,_sizeOfCoordIJ:rd,_sizeOfGeoLoop:Ia,_sizeOfGeoPolygon:Kl,_sizeOfH3Index:Wa,_sizeOfLatLng:pa,_sizeOfLinkedGeoPolygon:Bl,_uncompactCells:ed,_uncompactCellsSize:VA,_vertexToLatLng:ff,establishStackSpace:Zf,stackAlloc:hc,stackRestore:rf,stackSave:Hc}}(ve,Pe,he),tt=e.___divdi3=ye.___divdi3,rt=e.___muldi3=ye.___muldi3,Se=e.___remdi3=ye.___remdi3,Ge=e.___uremdi3=ye.___uremdi3,ht=e._areNeighborCells=ye._areNeighborCells,Ht=e._bitshift64Ashr=ye._bitshift64Ashr,Zt=e._bitshift64Lshr=ye._bitshift64Lshr,Pt=e._bitshift64Shl=ye._bitshift64Shl,Xt=e._calloc=ye._calloc,Dr=e._cellAreaKm2=ye._cellAreaKm2,Mr=e._cellAreaM2=ye._cellAreaM2,Ot=e._cellAreaRads2=ye._cellAreaRads2,br=e._cellToBoundary=ye._cellToBoundary,sr=e._cellToCenterChild=ye._cellToCenterChild,lr=e._cellToChildPos=ye._cellToChildPos,bi=e._cellToChildren=ye._cellToChildren,pr=e._cellToChildrenSize=ye._cellToChildrenSize,Ii=e._cellToLatLng=ye._cellToLatLng,vn=e._cellToLocalIj=ye._cellToLocalIj,Di=e._cellToParent=ye._cellToParent,Qi=e._cellToVertex=ye._cellToVertex,Li=e._cellToVertexes=ye._cellToVertexes,Xn=e._cellsToDirectedEdge=ye._cellsToDirectedEdge,$i=e._cellsToLinkedMultiPolygon=ye._cellsToLinkedMultiPolygon,Ln=e._childPosToCell=ye._childPosToCell,en=e._compactCells=ye._compactCells,Si=e._destroyLinkedMultiPolygon=ye._destroyLinkedMultiPolygon,Oi=e._directedEdgeToBoundary=ye._directedEdgeToBoundary,yo=e._directedEdgeToCells=ye._directedEdgeToCells,fc=e._edgeLengthKm=ye._edgeLengthKm,ko=e._edgeLengthM=ye._edgeLengthM,Yo=e._edgeLengthRads=ye._edgeLengthRads,zs=e._emscripten_replace_memory=ye._emscripten_replace_memory,Uo=e._free=ye._free,zn=e._getBaseCellNumber=ye._getBaseCellNumber,ll=e._getDirectedEdgeDestination=ye._getDirectedEdgeDestination,cs=e._getDirectedEdgeOrigin=ye._getDirectedEdgeOrigin,zo=e._getHexagonAreaAvgKm2=ye._getHexagonAreaAvgKm2,ys=e._getHexagonAreaAvgM2=ye._getHexagonAreaAvgM2,pn=e._getHexagonEdgeLengthAvgKm=ye._getHexagonEdgeLengthAvgKm,$s=e._getHexagonEdgeLengthAvgM=ye._getHexagonEdgeLengthAvgM,Vs=e._getIcosahedronFaces=ye._getIcosahedronFaces,Qu=e._getNumCells=ye._getNumCells,ua=e._getPentagons=ye._getPentagons,Ua=e._getRes0Cells=ye._getRes0Cells,cl=e._getResolution=ye._getResolution,xe=e._greatCircleDistanceKm=ye._greatCircleDistanceKm,Be=e._greatCircleDistanceM=ye._greatCircleDistanceM,Je=e._greatCircleDistanceRads=ye._greatCircleDistanceRads,vt=e._gridDisk=ye._gridDisk,tr=e._gridDiskDistances=ye._gridDiskDistances,qr=e._gridDistance=ye._gridDistance,sn=e._gridPathCells=ye._gridPathCells,Co=e._gridPathCellsSize=ye._gridPathCellsSize,ts=e._gridRingUnsafe=ye._gridRingUnsafe,vs=e._i64Add=ye._i64Add,Sa=e._i64Subtract=ye._i64Subtract,np=e._isPentagon=ye._isPentagon,$u=e._isResClassIII=ye._isResClassIII,Wh=e._isValidCell=ye._isValidCell,Wf=e._isValidDirectedEdge=ye._isValidDirectedEdge,RA=e._isValidVertex=ye._isValidVertex,ef=e._latLngToCell=ye._latLngToCell,ul=e._llvm_maxnum_f64=ye._llvm_maxnum_f64,Nc=e._llvm_minnum_f64=ye._llvm_minnum_f64,kc=e._llvm_round_f64=ye._llvm_round_f64,cu=e._localIjToCell=ye._localIjToCell,Uc=e._malloc=ye._malloc,zc=e._maxFaceCount=ye._maxFaceCount,qh=e._maxGridDiskSize=ye._maxGridDiskSize,fa=e._maxPolygonToCellsSize=ye._maxPolygonToCellsSize,Mo=e._memcpy=ye._memcpy,uu=e._memset=ye._memset,Xh=e._originToDirectedEdges=ye._originToDirectedEdges,BA=e._pentagonCount=ye._pentagonCount,OA=e._polygonToCells=ye._polygonToCells,qf=e._readInt64AsDoubleFromPointer=ye._readInt64AsDoubleFromPointer,op=e._res0CellCount=ye._res0CellCount,sp=e._round=ye._round,ap=e._sbrk=ye._sbrk,tf=e._sizeOfCellBoundary=ye._sizeOfCellBoundary,lp=e._sizeOfCoordIJ=ye._sizeOfCoordIJ,cp=e._sizeOfGeoLoop=ye._sizeOfGeoLoop,Xf=e._sizeOfGeoPolygon=ye._sizeOfGeoPolygon,Yf=e._sizeOfH3Index=ye._sizeOfH3Index,DA=e._sizeOfLatLng=ye._sizeOfLatLng,P=e._sizeOfLinkedGeoPolygon=ye._sizeOfLinkedGeoPolygon,U=e._uncompactCells=ye._uncompactCells,G=e._uncompactCellsSize=ye._uncompactCellsSize,Q=e._vertexToLatLng=ye._vertexToLatLng,le=e.establishStackSpace=ye.establishStackSpace,ce=e.stackAlloc=ye.stackAlloc,_e=e.stackRestore=ye.stackRestore,Qe=e.stackSave=ye.stackSave;if(e.asm=ye,e.cwrap=ne,e.setValue=O,e.getValue=F,Ur){to(Ur)||(Ur=s(Ur));{kr("memory initializer");var qe=function(ut){ut.byteLength&&(ut=new Uint8Array(ut)),ft.set(ut,M),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,dr("memory initializer")},ct=function(){l(Ur,qe,function(){throw"could not load memory initializer "+Ur})},Nt=de(Ur);if(Nt)qe(Nt.buffer);else if(e.memoryInitializerRequest){var jt=function(){var ut=e.memoryInitializerRequest,St=ut.response;if(ut.status!==200&&ut.status!==0){var cr=de(e.memoryInitializerRequestURL);if(cr)St=cr.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+ut.status+", retrying "+Ur),ct();return}}qe(St)};e.memoryInitializerRequest.response?setTimeout(jt,0):e.memoryInitializerRequest.addEventListener("load",jt)}else ct()}}var dt;po=function ut(){dt||fr(),dt||(po=ut)};function fr(ut){if(ut=ut||n,Bi>0||(wt(),Bi>0))return;function St(){dt||(dt=!0,!z&&($r(),xi(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),Ki()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),St()},1)):St()}e.run=fr;function mi(ut){throw e.onAbort&&e.onAbort(ut),ut+="",u(ut),h(ut),z=!0,"abort("+ut+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=mi,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return fr(),t}(typeof uo=="object"?uo:{}),gn="number",Wi=gn,Tb=gn,nn=gn,on=gn,kl=gn,ui=gn,g0e=[["sizeOfH3Index",gn],["sizeOfLatLng",gn],["sizeOfCellBoundary",gn],["sizeOfGeoLoop",gn],["sizeOfGeoPolygon",gn],["sizeOfLinkedGeoPolygon",gn],["sizeOfCoordIJ",gn],["readInt64AsDoubleFromPointer",gn],["isValidCell",Tb,[nn,on]],["latLngToCell",Wi,[gn,gn,kl,ui]],["cellToLatLng",Wi,[nn,on,ui]],["cellToBoundary",Wi,[nn,on,ui]],["maxGridDiskSize",Wi,[gn,ui]],["gridDisk",Wi,[nn,on,gn,ui]],["gridDiskDistances",Wi,[nn,on,gn,ui,ui]],["gridRingUnsafe",Wi,[nn,on,gn,ui]],["maxPolygonToCellsSize",Wi,[ui,kl,gn,ui]],["polygonToCells",Wi,[ui,kl,gn,ui]],["cellsToLinkedMultiPolygon",Wi,[ui,gn,ui]],["destroyLinkedMultiPolygon",null,[ui]],["compactCells",Wi,[ui,ui,gn,gn]],["uncompactCells",Wi,[ui,gn,gn,ui,gn,kl]],["uncompactCellsSize",Wi,[ui,gn,gn,kl,ui]],["isPentagon",Tb,[nn,on]],["isResClassIII",Tb,[nn,on]],["getBaseCellNumber",gn,[nn,on]],["getResolution",gn,[nn,on]],["maxFaceCount",Wi,[nn,on,ui]],["getIcosahedronFaces",Wi,[nn,on,ui]],["cellToParent",Wi,[nn,on,kl,ui]],["cellToChildren",Wi,[nn,on,kl,ui]],["cellToCenterChild",Wi,[nn,on,kl,ui]],["cellToChildrenSize",Wi,[nn,on,kl,ui]],["cellToChildPos",Wi,[nn,on,kl,ui]],["childPosToCell",Wi,[gn,gn,nn,on,kl,ui]],["areNeighborCells",Wi,[nn,on,nn,on,ui]],["cellsToDirectedEdge",Wi,[nn,on,nn,on,ui]],["getDirectedEdgeOrigin",Wi,[nn,on,ui]],["getDirectedEdgeDestination",Wi,[nn,on,ui]],["isValidDirectedEdge",Tb,[nn,on]],["directedEdgeToCells",Wi,[nn,on,ui]],["originToDirectedEdges",Wi,[nn,on,ui]],["directedEdgeToBoundary",Wi,[nn,on,ui]],["gridDistance",Wi,[nn,on,nn,on,ui]],["gridPathCells",Wi,[nn,on,nn,on,ui]],["gridPathCellsSize",Wi,[nn,on,nn,on,ui]],["cellToLocalIj",Wi,[nn,on,nn,on,gn,ui]],["localIjToCell",Wi,[nn,on,ui,gn,ui]],["getHexagonAreaAvgM2",Wi,[kl,ui]],["getHexagonAreaAvgKm2",Wi,[kl,ui]],["getHexagonEdgeLengthAvgM",Wi,[kl,ui]],["getHexagonEdgeLengthAvgKm",Wi,[kl,ui]],["greatCircleDistanceM",gn,[ui,ui]],["greatCircleDistanceKm",gn,[ui,ui]],["greatCircleDistanceRads",gn,[ui,ui]],["cellAreaM2",Wi,[nn,on,ui]],["cellAreaKm2",Wi,[nn,on,ui]],["cellAreaRads2",Wi,[nn,on,ui]],["edgeLengthM",Wi,[nn,on,ui]],["edgeLengthKm",Wi,[nn,on,ui]],["edgeLengthRads",Wi,[nn,on,ui]],["getNumCells",Wi,[kl,ui]],["getRes0Cells",Wi,[ui]],["res0CellCount",gn],["getPentagons",Wi,[gn,ui]],["pentagonCount",gn],["cellToVertex",Wi,[nn,on,gn,ui]],["cellToVertexes",Wi,[nn,on,ui]],["vertexToLatLng",Wi,[nn,on,ui]],["isValidVertex",Tb,[nn,on]]],_0e=0,y0e=1,v0e=2,x0e=3,oW=4,b0e=5,w0e=6,T0e=7,E0e=8,S0e=9,C0e=10,M0e=11,I0e=12,P0e=13,R0e=14,B0e=15,Tl={};Tl[_0e]="Success";Tl[y0e]="The operation failed but a more specific error is not available";Tl[v0e]="Argument was outside of acceptable range";Tl[x0e]="Latitude or longitude arguments were outside of acceptable range";Tl[oW]="Resolution argument was outside of acceptable range";Tl[b0e]="Cell argument was not valid";Tl[w0e]="Directed edge argument was not valid";Tl[T0e]="Undirected edge argument was not valid";Tl[E0e]="Vertex argument was not valid";Tl[S0e]="Pentagon distortion was encountered";Tl[C0e]="Duplicate input";Tl[M0e]="Cell arguments were not neighbors";Tl[I0e]="Cell arguments had incompatible resolutions";Tl[P0e]="Memory allocation failed";Tl[R0e]="Bounds of provided memory were insufficient";Tl[B0e]="Mode or flags argument was not valid";var sW=1e3,O0e=1001,aW=1002,iC={};iC[sW]="Unknown unit";iC[O0e]="Array length out of bounds";iC[aW]="Got unexpected null value for H3 index";var D0e="Unknown error";function lW(t,e,r){var i=r&&"value"in r,n=new Error((t[e]||D0e)+" (code: "+e+(i?", value: "+r.value:"")+")");return n.code=e,n}function cW(t,e){var r=arguments.length===2?{value:e}:{};return lW(Tl,t,r)}function uW(t,e){var r=arguments.length===2?{value:e}:{};return lW(iC,t,r)}function ng(t){if(t!==0)throw cW(t)}var Ta={};g0e.forEach(function(e){Ta[e[0]]=uo.cwrap.apply(uo,e)});var H_=16;var fW=4,rW=4,nA=8,L0e=8,tC=Ta.sizeOfH3Index(),hW=Ta.sizeOfLatLng(),F0e=Ta.sizeOfCellBoundary(),Vrt=Ta.sizeOfGeoPolygon(),Hrt=Ta.sizeOfGeoLoop(),N0e=Ta.sizeOfLinkedGeoPolygon(),jrt=Ta.sizeOfCoordIJ(),iW={m:"m",m2:"m2",km:"km",km2:"km2",rads:"rads",rads2:"rads2"};function k0e(t){if(typeof t!="number"||t<0||t>15||Math.floor(t)!==t)throw cW(oW,t);return t}function U0e(t){if(!t)throw uW(aW);return t}var Grt=Math.pow(2,32)-1;var z0e=/[^0-9a-fA-F]/;function og(t){if(Array.isArray(t)&&t.length===2&&Number.isInteger(t[0])&&Number.isInteger(t[1]))return t;if(typeof t!="string"||z0e.test(t))return[0,0];var e=parseInt(t.substring(0,t.length-8),H_),r=parseInt(t.substring(t.length-8),H_);return[r,e]}function nW(t){if(t>=0)return t.toString(H_);t=t&2147483647;var e=dW(8,t.toString(H_)),r=(parseInt(e[0],H_)+8).toString(H_);return e=r+e.substring(1),e}function V0e(t,e){return nW(e)+dW(8,nW(t))}function dW(t,e){for(var r=t-e.length,i="",n=0;n<r;n++)i+="0";return i=i+e,i}var Wrt=Math.pow(2,32);function H0e(t,e){e===void 0&&(e=0);var r=uo.getValue(t+tC*e,"i32"),i=uo.getValue(t+tC*e+fW,"i32");return i?V0e(r,i):null}function j0e(t,e){return e===void 0&&(e=0),uo.getValue(t+nA*e,"double")}function G0e(t){return Ta.readInt64AsDoubleFromPointer(t)}function W0e(t,e,r){uo.HEAPU32.set(og(t),e/fW+2*r)}function q0e(t,e){for(var r=e.length,i=0;i<r;i++)W0e(e[i],t,i)}function rC(t){return Z0e(uo.getValue(t,"double"))}function ND(t){return[rC(t),rC(t+nA)]}function pW(t){return[rC(t+nA),rC(t)]}function X0e(t,e,r){for(var i=uo.getValue(t,"i32"),n=t+nA,o=[],s=e?pW:ND,l=0;l<i*2;l+=2)o.push(s(n+nA*l));return r&&o.push(o[0]),o}function Y0e(t,e){for(var r=[],i=e?pW:ND,n,o,s,l;t;){for(r.push(n=[]),o=uo.getValue(t,"i8*");o;){for(n.push(s=[]),l=uo.getValue(o,"i8*");l;)s.push(i(l)),l=uo.getValue(l+nA*2,"i8*");e&&s.push(s[0]),o=uo.getValue(o+rW*2,"i8*")}t=uo.getValue(t+rW*2,"i8*")}return r}function AW(t){var e=og(t),r=e[0],i=e[1];return Boolean(Ta.isPentagon(r,i))}function mW(t){var e=og(t),r=e[0],i=e[1];return Ta.isValidCell(r,i)?Ta.getResolution(r,i):-1}function gW(t,e,r){var i=uo._malloc(hW);uo.HEAPF64.set([t,e].map(K0e),i/nA);var n=uo._malloc(tC);try{return ng(Ta.latLngToCell(i,r,n)),U0e(H0e(n))}finally{uo._free(n),uo._free(i)}}function Eb(t){var e=uo._malloc(hW),r=og(t),i=r[0],n=r[1];try{return ng(Ta.cellToLatLng(i,n,e)),ND(e)}finally{uo._free(e)}}function _W(t,e){var r=uo._malloc(F0e),i=og(t),n=i[0],o=i[1];try{return ng(Ta.cellToBoundary(n,o,r)),X0e(r,e,e)}finally{uo._free(r)}}function yW(t,e){if(!t||!t.length)return[];var r=t.length,i=uo._calloc(r,tC);q0e(i,t);var n=uo._calloc(N0e);try{return ng(Ta.cellsToLinkedMultiPolygon(i,r,n)),Y0e(n,e)}finally{Ta.destroyLinkedMultiPolygon(n),uo._free(n),uo._free(i)}}function vW(t,e){var r=og(t),i=r[0],n=r[1],o=og(e),s=o[0],l=o[1],u=uo._malloc(L0e);try{return ng(Ta.gridDistance(i,n,s,l,u)),G0e(u)}finally{uo._free(u)}}function xW(t,e){k0e(t);var r=uo._malloc(nA);try{switch(e){case iW.m:ng(Ta.getHexagonEdgeLengthAvgM(t,r));break;case iW.km:ng(Ta.getHexagonEdgeLengthAvgKm(t,r));break;default:throw uW(sW,e)}return j0e(r)}finally{uo._free(r)}}function K0e(t){return t*Math.PI/180}function Z0e(t){return t*180/Math.PI}function nC(t,e){e=e===void 0?t[0][0]:e;for(let r of t){let i=r[0]-e;i>180?r[0]-=360:i<-180&&(r[0]+=360)}}function J0e(t,e,r){let[i,n]=Eb(t),o=e.length;nC(e,n);let s=e[0]===e[o-1]?o-1:o;for(let l=0;l<s;l++)e[l][0]=Oa(n,e[l][0],r),e[l][1]=Oa(i,e[l][1],r)}function bW(t,e,r){let i=t(e,r),[n,o]=Eb(i);return[o,n]}function kD(t,e=1){let r=_W(t,!0);return e!==1?J0e(t,r,e):nC(r),r}function wW(t){let e=new Float64Array(t.length*2),r=0;for(let i of t)e[r++]=i[0],e[r++]=i[1];return e}var Q0e=10;function $0e(t,e){let r;return t==null?r=e:typeof t=="object"?r={...t,coverage:e}:r={getHexagon:t,coverage:e},r}var e_e={...Bf.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:t=>t.hexagon},extruded:!0},j_=class extends es{initializeState(){j_._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:e}){return this._shouldUseHighPrecision()?e.propsOrDataChanged:e.somethingChanged}updateState({props:e,changeFlags:r}){if(e.highPrecision!==!0&&(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagon)){let i=this._calculateH3DataProps();this.setState(i)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let e=-1,r=!1,i=!1,{iterable:n,objectInfo:o}=Js(this.props.data);for(let s of n){o.index++;let l=this.props.getHexagon(s,o),u=mW(l);if(e<0){if(e=u,!this.props.highPrecision)break}else if(e!==u){i=!0;break}if(AW(l)){r=!0;break}}return{resolution:e,edgeLengthKM:e>=0?xW(e,"km"):0,hasMultipleRes:i,hasPentagon:r}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:e,hasPentagon:r,hasMultipleRes:i}=this.state,{viewport:n}=this.context;return Boolean(n?.resolution)||i||r||e>=0&&e<=5}return this.props.highPrecision}_updateVertices(e){if(this._shouldUseHighPrecision())return;let{resolution:r,edgeLengthKM:i,centerHex:n}=this.state;if(r<0)return;let o=this.props.centerHexagon||gW(e.latitude,e.longitude,r);if(n===o)return;if(n)try{if(vW(n,o)*i<Q0e)return}catch{}let{unitsPerMeter:s}=e.distanceScales,l=kD(o),[u,h]=Eb(o),[v,T]=e.projectFlat([h,u]);l=l.map(E=>{let M=e.projectFlat(E);return[(M[0]-v)/s[0],(M[1]-T)/s[1]]}),this.setState({centerHex:o,vertices:l})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:e,material:r,coverage:i,extruded:n,wireframe:o,stroked:s,filled:l,lineWidthUnits:u,lineWidthScale:h,lineWidthMinPixels:v,lineWidthMaxPixels:T,getFillColor:E,getElevation:M,getLineColor:O,getLineWidth:F,transitions:z,updateTriggers:W}=this.props;return{elevationScale:e,extruded:n,coverage:i,wireframe:o,stroked:s,filled:l,lineWidthUnits:u,lineWidthScale:h,lineWidthMinPixels:v,lineWidthMaxPixels:T,material:r,getElevation:M,getFillColor:E,getLineColor:O,getLineWidth:F,transitions:z,updateTriggers:{getFillColor:W.getFillColor,getElevation:W.getElevation,getLineColor:W.getLineColor,getLineWidth:W.getLineWidth}}}_renderPolygonLayer(){let{data:e,getHexagon:r,updateTriggers:i,coverage:n}=this.props,o=this.getSubLayerClass("hexagon-cell-hifi",Bf),s=this._getForwardProps();return s.updateTriggers.getPolygon=$0e(i.getHexagon,n),new o(s,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:s.updateTriggers}),{data:e,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(l,u)=>{let h=r(l,u);return wW(kD(h,n))}})}_renderColumnLayer(){let{data:e,getHexagon:r,updateTriggers:i}=this.props,n=this.getSubLayerClass("hexagon-cell",If),o=this._getForwardProps();return o.updateTriggers.getPosition=i.getHexagon,new n(o,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:o.updateTriggers}),{data:e,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:bW.bind(null,r)})}},sg=j_;(()=>{j_.defaultProps=e_e})(),(()=>{j_.layerName="H3HexagonLayer"})(),(()=>{j_._checkH3Lib=()=>{}})();var t_e={getHexagons:{type:"accessor",value:t=>t.hexagons}},oC=class extends eu{initializeState(){sg._checkH3Lib()}updateState({props:e,changeFlags:r}){if(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagons){let{data:i,getHexagons:n}=e,o=[],{iterable:s,objectInfo:l}=Js(i);for(let u of s){l.index++;let h=n(u,l),v=yW(h,!0);for(let T of v){for(let E of T)nC(E);o.push(this.getSubLayerRow({polygon:T},u,l.index))}}this.setState({polygons:o})}}indexToBounds(){let{getElevation:e,getFillColor:r,getLineColor:i,getLineWidth:n}=this.props;return{data:this.state.polygons,getPolygon:o=>o.polygon,getElevation:this.getSubLayerAccessor(e),getFillColor:this.getSubLayerAccessor(r),getLineColor:this.getSubLayerAccessor(i),getLineWidth:this.getSubLayerAccessor(n)}}},Sb=oC;(()=>{oC.layerName="H3ClusterLayer"})(),(()=>{oC.defaultProps=t_e})();var UD=Math.PI/180,sC=new Float32Array(16),TW=new Float32Array(12);function EW(t,e,r){let i=e[0]*UD,n=e[1]*UD,o=e[2]*UD,s=Math.sin(o),l=Math.sin(i),u=Math.sin(n),h=Math.cos(o),v=Math.cos(i),T=Math.cos(n),E=r[0],M=r[1],O=r[2];t[0]=E*T*v,t[1]=E*u*v,t[2]=E*-l,t[3]=M*(-u*h+T*l*s),t[4]=M*(T*h+u*l*s),t[5]=M*v*s,t[6]=O*(u*s+T*l*h),t[7]=O*(-T*s+u*l*h),t[8]=O*v*h}function SW(t){return t[0]=t[0],t[1]=t[1],t[2]=t[2],t[3]=t[4],t[4]=t[5],t[5]=t[6],t[6]=t[8],t[7]=t[9],t[8]=t[10],t[9]=t[12],t[10]=t[13],t[11]=t[14],t.subarray(0,12)}var aC={size:12,accessor:["getOrientation","getScale","getTranslation","getTransformMatrix"],shaderAttributes:{instanceModelMatrixCol0:{size:3,elementOffset:0},instanceModelMatrixCol1:{size:3,elementOffset:3},instanceModelMatrixCol2:{size:3,elementOffset:6},instanceTranslation:{size:3,elementOffset:9}},update(t,{startRow:e,endRow:r}){let{data:i,getOrientation:n,getScale:o,getTranslation:s,getTransformMatrix:l}=this.props,u=Array.isArray(l),h=u&&l.length===16,v=Array.isArray(o),T=Array.isArray(n),E=Array.isArray(s),M=h||!u&&Boolean(l(i[0]));M?t.constant=h:t.constant=T&&v&&E;let O=t.value;if(t.constant){let F;M?(sC.set(l),F=SW(sC)):(F=TW,EW(F,n,o),F.set(s,9)),t.value=new Float32Array(F)}else{let F=e*t.size,{iterable:z,objectInfo:W}=Js(i,e,r);for(let J of z){W.index++;let K;if(M)sC.set(h?l:l(J,W)),K=SW(sC);else{K=TW;let ne=T?n:n(J,W),ge=v?o:o(J,W);EW(K,ne,ge),K.set(E?s:s(J,W),9)}O[F++]=K[0],O[F++]=K[1],O[F++]=K[2],O[F++]=K[3],O[F++]=K[4],O[F++]=K[5],O[F++]=K[6],O[F++]=K[7],O[F++]=K[8],O[F++]=K[9],O[F++]=K[10],O[F++]=K[11]}}}};function lC(t,e){return e===Zr.CARTESIAN||e===Zr.METER_OFFSETS||e===Zr.DEFAULT&&!t.isGeospatial}var CW=`#version 300 es
#define SHADER_NAME simple-mesh-layer-vs
uniform float sizeScale;
uniform bool composeModelMatrix;
in vec3 positions;
in vec3 normals;
in vec3 colors;
in vec2 texCoords;
in vec3 instancePositions;
in vec3 instancePositions64Low;
in vec4 instanceColors;
in vec3 instancePickingColors;
in vec3 instanceModelMatrixCol0;
in vec3 instanceModelMatrixCol1;
in vec3 instanceModelMatrixCol2;
in vec3 instanceTranslation;
out vec2 vTexCoord;
out vec3 cameraPosition;
out vec3 normals_commonspace;
out vec4 position_commonspace;
out vec4 vColor;
void main(void) {
geometry.worldPosition = instancePositions;
geometry.uv = texCoords;
geometry.pickingColor = instancePickingColors;
vTexCoord = texCoords;
cameraPosition = project.cameraPosition;
vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
vec3 pos = (instanceModelMatrix * positions) * sizeScale + instanceTranslation;
if (composeModelMatrix) {
DECKGL_FILTER_SIZE(pos, geometry);
normals_commonspace = project_normal(instanceModelMatrix * normals);
geometry.worldPosition += pos;
gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace);
geometry.position = position_commonspace;
}
else {
pos = project_size(pos);
DECKGL_FILTER_SIZE(pos, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace);
geometry.position = position_commonspace;
normals_commonspace = project_normal(instanceModelMatrix * normals);
}
geometry.normal = normals_commonspace;
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var MW=`#version 300 es
#define SHADER_NAME simple-mesh-layer-fs
precision highp float;
uniform bool hasTexture;
uniform sampler2D sampler;
uniform bool flatShading;
uniform float opacity;
in vec2 vTexCoord;
in vec3 cameraPosition;
in vec3 normals_commonspace;
in vec4 position_commonspace;
in vec4 vColor;
out vec4 fragColor;
void main(void) {
geometry.uv = vTexCoord;
vec3 normal;
if (flatShading) {
normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
} else {
normal = normals_commonspace;
}
vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;
DECKGL_FILTER_COLOR(color, geometry);
vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
fragColor = vec4(lightColor, color.a * opacity);
}
`;function zD(t){let e=t.positions||t.POSITION;ur.assert(e,'no "postions" or "POSITION" attribute in mesh');let r=e.value.length/e.size,i=t.COLOR_0||t.colors;i||(i={size:3,value:new Float32Array(r*3).fill(1)});let n=t.NORMAL||t.normals;n||(n={size:3,value:new Float32Array(r*3).fill(0)});let o=t.TEXCOORD_0||t.texCoords;return o||(o={size:2,value:new Float32Array(r*2).fill(0)}),{positions:e,colors:i,normals:n,texCoords:o}}function IW(t){return t instanceof Fn?(t.attributes=zD(t.attributes),t):t.attributes?new Fn({...t,topology:"triangle-list",attributes:zD(t.attributes)}):new Fn({topology:"triangle-list",attributes:zD(t)})}var r_e=[0,0,0,255],i_e={mesh:{type:"object",value:null,async:!0},texture:{type:"image",value:null,async:!0},sizeScale:{type:"number",value:1,min:0},_instanced:!0,wireframe:!1,material:!0,getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:r_e},getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},textureParameters:{type:"object",ignore:!0,value:null}},cC=class extends On{getShaders(){return super.getShaders({vs:CW,fs:MW,modules:[Jn,kp,go]})}getBounds(){if(this.props._instanced)return super.getBounds();let e=this.state.positionBounds;if(e)return e;let{mesh:r}=this.props;if(!r)return null;if(e=r.header?.boundingBox,!e){let{attributes:i}=IW(r);i.POSITION=i.POSITION||i.positions,e=pd(i)}return this.state.positionBounds=e,e}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{transition:!0,type:"float64",fp64:this.use64bitPositions(),size:3,accessor:"getPosition"},instanceColors:{type:"unorm8",transition:!0,size:this.props.colorFormat.length,accessor:"getColor",defaultValue:[0,0,0,255]},instanceModelMatrix:aC}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState(e){super.updateState(e);let{props:r,oldProps:i,changeFlags:n}=e;if(r.mesh!==i.mesh||n.extensionsChanged){if(this.state.positionBounds=null,this.state.model?.destroy(),r.mesh){this.state.model=this.getModel(r.mesh);let o=r.mesh.attributes||r.mesh;this.setState({hasNormals:Boolean(o.NORMAL||o.normals)})}this.getAttributeManager().invalidateAll()}r.texture!==i.texture&&r.texture instanceof bo&&this.setTexture(r.texture),this.state.model&&this.state.model.setTopology(this.props.wireframe?"line-strip":"triangle-list")}finalizeState(e){super.finalizeState(e),this.state.emptyTexture.delete()}draw({uniforms:e}){let{model:r}=this.state;if(!r)return;let{viewport:i,renderPass:n}=this.context,{sizeScale:o,coordinateSystem:s,_instanced:l}=this.props;r.setUniforms(e),r.setUniforms({sizeScale:o,composeModelMatrix:!l||lC(i,s),flatShading:!this.state.hasNormals}),r.draw(n)}get isLoaded(){return Boolean(this.state?.model&&super.isLoaded)}getModel(e){let r=new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:IW(e),isInstanced:!0}),{texture:i}=this.props,{emptyTexture:n}=this.state;return r.setBindings({sampler:i||n}),r.setUniforms({hasTexture:Boolean(i)}),r}setTexture(e){let{emptyTexture:r,model:i}=this.state;i&&(i.setBindings({sampler:e||r}),i.setUniforms({hasTexture:Boolean(e)}))}},Nh=cC;(()=>{cC.defaultProps=i_e})(),(()=>{cC.layerName="SimpleMeshLayer"})();var Lf;(function(t){t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.LINEAR=9729]="LINEAR",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(Lf||(Lf={}));function Mb(t,e,r,i){let n={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};n.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:o}=i;return o&&(n.bindings.u_DiffuseEnvSampler=o.diffuseEnvSampler,n.bindings.u_SpecularEnvSampler=o.specularEnvSampler,n.bindings.u_brdfLUT=o.brdfLutTexture,n.uniforms.u_ScaleIBLAmbient=[1,1]),i?.pbrDebug&&(n.defines.PBR_DEBUG=1,n.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],n.uniforms.u_ScaleFGDSpec=[0,0,0,0]),r.NORMAL&&(n.defines.HAS_NORMALS=1),r.TANGENT&&i?.useTangents&&(n.defines.HAS_TANGENTS=1),r.TEXCOORD_0&&(n.defines.HAS_UV=1),i?.imageBasedLightingEnvironment&&(n.defines.USE_IBL=1),i?.lights&&(n.defines.USE_LIGHTS=1),e&&n_e(t,e,n),n}function n_e(t,e,r){if(r.uniforms.pbr_uUnlit=Boolean(e.unlit),e.pbrMetallicRoughness&&o_e(t,e.pbrMetallicRoughness,r),e.normalTexture){Cb(t,e.normalTexture,"u_NormalSampler","HAS_NORMALMAP",r);let{scale:i=1}=e.normalTexture;r.uniforms.u_NormalScale=i}if(e.occlusionTexture){Cb(t,e.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",r);let{strength:i=1}=e.occlusionTexture;r.uniforms.u_OcclusionStrength=i}switch(e.emissiveTexture&&(Cb(t,e.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",r),r.uniforms.u_EmissiveFactor=e.emissiveFactor||[0,0,0]),e.alphaMode){case"MASK":let{alphaCutoff:i=.5}=e;r.defines.ALPHA_CUTOFF=1,r.uniforms.u_AlphaCutoff=i;break;case"BLEND":Kt.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),r.parameters.blendColorOperation="add",r.parameters.blendColorSrcFactor="src-alpha",r.parameters.blendColorDstFactor="one-minus-src-alpha",r.parameters.blendAlphaOperation="add",r.parameters.blendAlphaSrcFactor="one",r.parameters.blendAlphaDstFactor="one-minus-src-alpha",r.glParameters.blend=!0,r.glParameters.blendEquation=Lf.FUNC_ADD,r.glParameters.blendFunc=[Lf.SRC_ALPHA,Lf.ONE_MINUS_SRC_ALPHA,Lf.ONE,Lf.ONE_MINUS_SRC_ALPHA];break}}function o_e(t,e,r){e.baseColorTexture&&Cb(t,e.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",r),r.uniforms.u_BaseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&Cb(t,e.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",r);let{metallicFactor:i=1,roughnessFactor:n=1}=e;r.uniforms.u_MetallicRoughnessValues=[i,n]}function Cb(t,e,r,i=null,n){let o=e?.texture?.sampler?.parameters||{},s=e.texture.source.image,l,u={};s.compressed?(l=s,u={[Lf.TEXTURE_MIN_FILTER]:s.data.length>1?Lf.LINEAR_MIPMAP_NEAREST:Lf.LINEAR}):l={data:s};let h=t.createTexture({id:e.uniformName||e.id,parameters:{...o,...u},pixelStore:{[Lf.UNPACK_FLIP_Y_WEBGL]:!1},...l});n.bindings[r]=h,i&&(n.defines[i]=1),n.generatedTextures.push(h)}var PW="4.2.0-beta.2";var uC={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},RW;async function HD(t){PP(t.modules);let e=RP("basis");return e||(RW||=s_e(t),await RW)}async function s_e(t){let e=null,r=null;return[e,r]=await Promise.all([await gh(uC.TRANSCODER,"textures",t),await gh(uC.TRANSCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await a_e(e,r)}function a_e(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(i=>{t(r).then(n=>{let{BasisFile:o,initializeBasis:s}=n;s(),i({BasisFile:o})})})}var VD;async function jD(t){let e=t.modules||{};return e.basisEncoder?e.basisEncoder:(VD=VD||l_e(t),await VD)}async function l_e(t){let e=null,r=null;return[e,r]=await Promise.all([await gh(uC.ENCODER,"textures",t),await gh(uC.ENCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await c_e(e,r)}function c_e(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(i=>{t(r).then(n=>{let{BasisFile:o,KTX2File:s,initializeBasis:l,BasisEncoder:u}=n;l(),i({BasisFile:o,KTX2File:s,BasisEncoder:u})})})}var ag={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var u_e=["","WEBKIT_","MOZ_"],BW={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},fC=null;function OW(t){if(!fC){t=t||f_e()||void 0,fC=new Set;for(let e of u_e)for(let r in BW)if(t&&t.getExtension(`${e}${r}`)){let i=BW[r];fC.add(i)}}return fC}function f_e(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var Cit=new Uint8Array([0]);var DW,LW,FW,NW,kW,UW,zW,VW;(function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB"})(DW||(DW={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(LW||(LW={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(FW||(FW={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(NW||(NW={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}(kW||(kW={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(UW||(UW={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(zW||(zW={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(VW||(VW={}));var tu=[171,75,84,88,32,50,48,187,13,10,26,10];function HW(t){let e=new Uint8Array(t);return!(e.byteLength<tu.length||e[0]!==tu[0]||e[1]!==tu[1]||e[2]!==tu[2]||e[3]!==tu[3]||e[4]!==tu[4]||e[5]!==tu[5]||e[6]!==tu[6]||e[7]!==tu[7]||e[8]!==tu[8]||e[9]!==tu[9]||e[10]!==tu[10]||e[11]!==tu[11])}var h_e={etc1:{basisFormat:0,compressed:!0,format:ag.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:ag.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:ag.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:ag.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:ag.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:ag.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function WD(t,e){if(e.basis.containerFormat==="auto"){if(HW(t)){let i=await jD(e);return jW(i.KTX2File,t,e)}let{BasisFile:r}=await HD(e);return GD(r,t,e)}switch(e.basis.module){case"encoder":let r=await jD(e);switch(e.basis.containerFormat){case"ktx2":return jW(r.KTX2File,t,e);case"basis":default:return GD(r.BasisFile,t,e)}case"transcoder":default:let{BasisFile:i}=await HD(e);return GD(i,t,e)}}function GD(t,e,r){let i=new t(new Uint8Array(e));try{if(!i.startTranscoding())throw new Error("Failed to start basis transcoding");let n=i.getNumImages(),o=[];for(let s=0;s<n;s++){let l=i.getNumLevels(s),u=[];for(let h=0;h<l;h++)u.push(d_e(i,s,h,r));o.push(u)}return o}finally{i.close(),i.delete()}}function d_e(t,e,r,i){let n=t.getImageWidth(e,r),o=t.getImageHeight(e,r),s=t.getHasAlpha(),{compressed:l,format:u,basisFormat:h}=GW(i,s),v=t.getImageTranscodedSizeInBytes(e,r,h),T=new Uint8Array(v);if(!t.transcodeImage(T,e,r,h,0,0))throw new Error("failed to start Basis transcoding");return{width:n,height:o,data:T,compressed:l,format:u,hasAlpha:s}}function jW(t,e,r){let i=new t(new Uint8Array(e));try{if(!i.startTranscoding())throw new Error("failed to start KTX2 transcoding");let n=i.getLevels(),o=[];for(let s=0;s<n;s++){o.push(p_e(i,s,r));break}return[o]}finally{i.close(),i.delete()}}function p_e(t,e,r){let{alphaFlag:i,height:n,width:o}=t.getImageLevelInfo(e,0,0),{compressed:s,format:l,basisFormat:u}=GW(r,i),h=t.getImageTranscodedSizeInBytes(e,0,0,u),v=new Uint8Array(h);if(!t.transcodeImage(v,e,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:o,height:n,data:v,compressed:s,levelSize:h,hasAlpha:i,format:l}}function GW(t,e){let r=t&&t.basis&&t.basis.format;return r==="auto"&&(r=hC()),typeof r=="object"&&(r=e?r.alpha:r.noAlpha),r=r.toLowerCase(),h_e[r]}function hC(){let t=OW();return t.has("astc")?"astc-4x4":t.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:t.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:t.has("etc1")?"etc1":t.has("etc2")?"etc2":"rgb565"}var WW={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:PW,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},qD={...WW,parse:WD};var A_e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},m_e={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},YD=class{name;startTime=0;playing=!0;speed=1;channels=[];constructor(e){Object.assign(this,e)}animate(e){if(!this.playing)return;let i=(e/1e3-this.startTime)*this.speed;this.channels.forEach(({sampler:n,target:o,path:s})=>{b_e(i,n,o,s),__e(o,o._node)})}},dC=class{animations;constructor(e){this.animations=e.animations.map((r,i)=>{let n=r.name||`Animation-${i}`,o=r.samplers.map(({input:l,interpolation:u="LINEAR",output:h})=>({input:qW(e.accessors[l]),interpolation:u,output:qW(e.accessors[h])})),s=r.channels.map(({sampler:l,target:u})=>({sampler:o[l],target:e.nodes[u.node],path:u.path}));return new YD({name:n,channels:s})})}animate(e){this.setTime(e)}setTime(e){this.animations.forEach(r=>r.animate(e))}getAnimations(){return this.animations}};function qW(t){if(!t._animation){let e=m_e[t.componentType],r=A_e[t.type],i=r*t.count,{buffer:n,byteOffset:o}=t.bufferView.data,s=new e(n,o+(t.byteOffset||0),i);if(r===1)t._animation=Array.from(s);else{let l=[];for(let u=0;u<s.length;u+=r)l.push(Array.from(s.slice(u,u+r)));t._animation=l}}return t._animation}var g_e=new Kr;function __e(t,e){if(e.matrix.identity(),t.translation&&e.matrix.translate(t.translation),t.rotation){let r=g_e.fromQuaternion(t.rotation);e.matrix.multiplyRight(r)}t.scale&&e.matrix.scale(t.scale)}var XD=new Du;function y_e(t,e,r,i,n){if(e==="rotation"){XD.slerp({start:r,target:i,ratio:n});for(let o=0;o<XD.length;o++)t[e][o]=XD[o]}else for(let o=0;o<r.length;o++)t[e][o]=n*i[o]+(1-n)*r[o]}function v_e(t,e,{p0:r,outTangent0:i,inTangent1:n,p1:o,tDiff:s,ratio:l}){for(let u=0;u<t[e].length;u++){let h=i[u]*s,v=n[u]*s;t[e][u]=(2*Math.pow(l,3)-3*Math.pow(l,2)+1)*r[u]+(Math.pow(l,3)-2*Math.pow(l,2)+l)*h+(-2*Math.pow(l,3)+3*Math.pow(l,2))*o[u]+(Math.pow(l,3)-Math.pow(l,2))*v}}function x_e(t,e,r){for(let i=0;i<r.length;i++)t[e][i]=r[i]}function b_e(t,{input:e,interpolation:r,output:i},n,o){let s=e[e.length-1],l=t%s,u=e.findIndex(E=>E>=l),h=Math.max(0,u-1);if(!Array.isArray(n[o]))switch(o){case"translation":n[o]=[0,0,0];break;case"rotation":n[o]=[0,0,0,1];break;case"scale":n[o]=[1,1,1];break;default:Kt.warn(`Bad animation path ${o}`)()}Yi(n[o].length===i[h].length);let v=e[h],T=e[u];switch(r){case"STEP":x_e(n,o,i[h]);break;case"LINEAR":if(T>v){let E=(l-v)/(T-v);y_e(n,o,i[h],i[u],E)}break;case"CUBICSPLINE":if(T>v){let E=(l-v)/(T-v),M=T-v,O=i[3*h+1],F=i[3*h+2],z=i[3*u+0],W=i[3*u+1];v_e(n,o,{p0:O,outTangent0:F,inTangent1:z,p1:W,tDiff:M,ratio:E})}break;default:Kt.warn(`Interpolation ${r} not supported`)();break}}var w_e=`
#pragma vscode_glsllint_stage: vert
#if (__VERSION__ < 300)
#define _attr attribute
#else
#define _attr in
#endif
// _attr vec4 POSITION;
_attr vec4 positions;
#ifdef HAS_NORMALS
// _attr vec4 NORMAL;
_attr vec4 normals;
#endif
#ifdef HAS_TANGENTS
_attr vec4 TANGENT;
#endif
#ifdef HAS_UV
// _attr vec2 TEXCOORD_0;
_attr vec2 texCoords;
#endif
void main(void) {
vec4 _NORMAL = vec4(0.);
vec4 _TANGENT = vec4(0.);
vec2 _TEXCOORD_0 = vec2(0.);
#ifdef HAS_NORMALS
_NORMAL = normals;
#endif
#ifdef HAS_TANGENTS
_TANGENT = TANGENT;
#endif
#ifdef HAS_UV
_TEXCOORD_0 = texCoords;
#endif
pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);
gl_Position = u_MVPMatrix * positions;
}
`,T_e=`
#pragma vscode_glsllint_stage: frag
#if (__VERSION__ < 300)
#define fragmentColor gl_FragColor
#else
out vec4 fragmentColor;
#endif
void main(void) {
vec3 pos = pbr_vPosition;
fragmentColor = pbr_filterColor(vec4(1.0));
}
`;function YW(t,e){let{id:r,geometry:i,material:n,vertexCount:o,materialOptions:s,modelOptions:l}=e,u=Mb(t,n,i.attributes,s);Kt.info(4,"createGLTFModel defines: ",u.defines)();let h=[],v={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},T={id:r,geometry:i,topology:i.topology,vertexCount:o,modules:[hm],vs:XW(t,w_e),fs:XW(t,T_e),...l,bindings:{...u.bindings,...l.bindings},defines:{...u.defines,...l.defines},parameters:{...v,...u.parameters,...l.parameters},uniforms:{...u.uniforms,...l.uniforms}},E=new Ni(t,T);return new Ih({managedResources:h,model:E})}function XW(t,e){return`#version 300 es
${e}`}var E_e={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1},pC=class{device;options;gltf;constructor(e,r={}){this.device=e,this.options={...E_e,...r}}instantiate(e){return this.gltf=e,(e.scenes||[]).map(i=>this.createScene(i))}createAnimator(){return Array.isArray(this.gltf.animations)?new dC(this.gltf):null}createScene(e){let i=(e.nodes||[]).map(o=>this.createNode(o));return new Qc({id:e.name||e.id,children:i})}createNode(e){if(!e._node){let i=(e.children||[]).map(o=>this.createNode(o));e.mesh&&i.push(this.createMesh(e.mesh));let n=new Qc({id:e.name||e.id,children:i});if(e.matrix)n.setMatrix(e.matrix);else{if(n.matrix.identity(),e.translation&&n.matrix.translate(e.translation),e.rotation){let o=new Kr().fromQuaternion(e.rotation);n.matrix.multiplyRight(o)}e.scale&&n.matrix.scale(e.scale)}e._node=n}return e._node}createMesh(e){if(!e._mesh){let i=(e.primitives||[]).map((o,s)=>this.createPrimitive(o,s,e)),n=new Qc({id:e.name||e.id,children:i});e._mesh=n}return e._mesh}createPrimitive(e,r,i){let n=e.name||`${i.name||i.id}-primitive-${r}`,o=S_e(e.mode||4),s=e.indices?e.indices.count:this.getVertexCount(e.attributes),l=YW(this.device,{id:n,geometry:this.createGeometry(n,e,o),material:e.material,materialOptions:this.options,modelOptions:this.options.modelOptions,vertexCount:s});return l.bounds=[e.attributes.POSITION.min,e.attributes.POSITION.max],l}getVertexCount(e){throw new Error("getVertexCount not implemented")}createGeometry(e,r,i){let n={};for(let[o,s]of Object.entries(r.attributes)){let{components:l,size:u,value:h}=s;n[o]={size:u??l,value:h}}return new Fn({id:e,topology:i,indices:r.indices.value,attributes:n})}createBuffer(e,r){e.bufferView||(e.bufferView={});let{bufferView:i}=e;return i.lumaBuffers||(i.lumaBuffers={}),i.lumaBuffers[r]||(i.lumaBuffers[r]=this.device.createBuffer({id:`from-${i.id}`,data:i.data||e.value})),i.lumaBuffers[r]}createSampler(e){return e}needsPOT(){return!1}},zd;(function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(zd||(zd={}));function S_e(t){switch(t){case zd.POINTS:return"point-list";case zd.LINES:return"line-list";case zd.LINE_STRIP:return"line-strip";case zd.LINE_LOOP:return"line-loop-webgl";case zd.TRIANGLES:return"triangle-list";case zd.TRIANGLE_STRIP:return"triangle-strip";case zd.TRIANGLE_FAN:return"triangle-fan-webgl";default:throw new Error(t)}}function KD(t,e,r){let i=new pC(t,r),n=i.instantiate(e),o=i.createAnimator();return{scenes:n,animator:o}}var ZD={};As(ZD,{decode:()=>k_e,name:()=>N_e});function Na(t,e){if(!t)throw new Error(e||"assert failed: gltf")}var AC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},mC={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var C_e=1.33,KW=["SCALAR","VEC2","VEC3","VEC4"],M_e=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],I_e=new Map(M_e),P_e={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},R_e={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},B_e={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function gC(t){return KW[t-1]||KW[0]}function G_(t){let e=I_e.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function W_(t,e){let r=B_e[t.componentType],i=P_e[t.type],n=R_e[t.componentType],o=t.count*i,s=t.count*i*n;Na(s>=0&&s<=e.byteLength);let l=mC[t.componentType],u=AC[t.type];return{ArrayType:r,length:o,byteLength:s,componentByteSize:l,numberOfComponentsInElement:u}}function Ib(t){let{images:e,bufferViews:r}=t;e=e||[],r=r||[];let i=e.map(s=>s.bufferView);r=r.filter(s=>!i.includes(s));let n=r.reduce((s,l)=>s+l.byteLength,0),o=e.reduce((s,l)=>{let{width:u,height:h}=l.image;return s+u*h},0);return n+Math.ceil(4*o*C_e)}function ZW(t,e,r){let i=t.bufferViews[r];Na(i);let n=i.buffer,o=e[n];Na(o);let s=(i.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,s,i.byteLength)}function JW(t,e,r){let i=typeof r=="number"?t.accessors?.[r]:r;if(!i)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let n=t.bufferViews?.[i.bufferView||0];if(!n)throw new Error(`No gltf buffer view for accessor ${n}`);let{arrayBuffer:o,byteOffset:s}=e[n.buffer],l=(s||0)+(i.byteOffset||0)+(n.byteOffset||0),{ArrayType:u,length:h,componentByteSize:v,numberOfComponentsInElement:T}=W_(i,n),E=v*T,M=n.byteStride||E;if(typeof n.byteStride>"u"||n.byteStride===E)return new u(o,l,h);let O=new u(h);for(let F=0;F<i.count;F++){let z=new u(o,l+F*M,T);O.set(z,F*T)}return O}function O_e(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var wo=class{gltf;sourceBuffers;byteLength;constructor(e){this.gltf={json:e?.json||O_e(),buffers:e?.buffers||[],images:e?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}hasExtension(e){let r=this.getUsedExtensions().find(n=>n===e),i=this.getRequiredExtensions().find(n=>n===e);return typeof r=="string"||typeof i=="string"}getExtension(e){let r=this.getUsedExtensions().find(n=>n===e),i=this.json.extensions||{};return r?i[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(i=>i===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,r){return(e.extensions||{})[r]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,r){if(typeof r=="object")return r;let i=this.json[e]&&this.json[e][r];if(!i)throw new Error(`glTF file error: Could not find ${e}[${r}]`);return i}getTypedArrayForBufferView(e){e=this.getBufferView(e);let r=e.buffer,i=this.gltf.buffers[r];Na(i);let n=(e.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,n,e.byteLength)}getTypedArrayForAccessor(e){let r=this.getAccessor(e);return JW(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(e){e=this.getAccessor(e);let r=this.getBufferView(e.bufferView),n=this.getBuffer(r.buffer).data,o=r.byteOffset||0;return new Uint8Array(n,o,r.byteLength)}addApplicationData(e,r){return this.json[e]=r,this}addExtraData(e,r){return this.json.extras=this.json.extras||{},this.json.extras[e]=r,this}addObjectExtension(e,r,i){return e.extensions=e.extensions||{},e.extensions[r]=i,this.registerUsedExtension(r),this}setObjectExtension(e,r,i){let n=e.extensions||{};n[r]=i}removeObjectExtension(e,r){let i=e?.extensions||{};if(i[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(r)||n.push(r)}delete i[r]}addExtension(e,r={}){return Na(r),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=r,this.registerUsedExtension(e),r}addRequiredExtension(e,r={}){return Na(r),this.addExtension(e,r),this.registerRequiredExtension(e),r}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===e)||this.json.extensionsRequired.push(e)}removeExtension(e){if(this.json.extensions?.[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let r=this.json.extensionsRemoved;r.includes(e)||r.push(e)}this.json.extensions&&delete this.json.extensions[e],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e)}setDefaultScene(e){this.json.scene=e}addScene(e){let{nodeIndices:r}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(e){let{meshIndex:r,matrix:i}=e;this.json.nodes=this.json.nodes||[];let n={mesh:r};return i&&(n.matrix=i),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(e){let{attributes:r,indices:i,material:n,mode:o=4}=e,l={primitives:[{attributes:this._addAttributes(r),mode:o}]};if(i){let u=this._addIndices(i);l.primitives[0].indices=u}return Number.isFinite(n)&&(l.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(l),this.json.meshes.length-1}addPointCloud(e){let i={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(i),this.json.meshes.length-1}addImage(e,r){let i=om(e),n=r||i?.mimeType,s={bufferView:this.addBufferView(e),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}addBufferView(e,r=0,i=this.byteLength){let n=e.byteLength;Na(Number.isFinite(n)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);let o={buffer:r,byteOffset:i,byteLength:n};return this.byteLength+=yp(n,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(o),this.json.bufferViews.length-1}addAccessor(e,r){let i={bufferView:e,type:gC(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(i),this.json.accessors.length-1}addBinaryBuffer(e,r={size:3}){let i=this.addBufferView(e),n={min:r.min,max:r.max};(!n.min||!n.max)&&(n=this._getAccessorMinMax(e,r.size));let o={size:r.size,componentType:G_(e),count:Math.round(e.length/r.size),min:n.min,max:n.max};return this.addAccessor(i,Object.assign(o,r))}addTexture(e){let{imageIndex:r}=e,i={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(i),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){this.gltf.buffers=[];let e=this.byteLength,r=new ArrayBuffer(e),i=new Uint8Array(r),n=0;for(let o of this.sourceBuffers||[])n=jP(o,i,n);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=e:this.json.buffers=[{byteLength:e}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(e,r){let i=!0;for(;i;){let n=e.indexOf(r);n>-1?e.splice(n,1):i=!1}}_addAttributes(e={}){let r={};for(let i in e){let n=e[i],o=this._getGltfAttributeName(i),s=this.addBinaryBuffer(n.value,n);r[o]=s}return r}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,r){let i={min:null,max:null};if(e.length<r)return i;i.min=[],i.max=[];let n=e.subarray(0,r);for(let o of n)i.min.push(o),i.max.push(o);for(let o=r;o<e.length;o+=r)for(let s=0;s<r;s++)i.min[0+s]=Math.min(i.min[0+s],e[o+s]),i.max[0+s]=Math.max(i.max[0+s],e[o+s]);return i}};function QW(t){return(t%1+1)%1}var $W={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},D_e={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},eq={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Pb(t,e){return eq[e]*$W[t]}function q_(t,e,r,i){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let n=t.getTypedArrayForBufferView(e),o=X_(n,"SCALAR",r,i+1);return o instanceof BigInt64Array||o instanceof BigUint64Array?null:o}function X_(t,e,r,i=1){let n=$W[e],o=D_e[r],s=eq[r],l=i*n,u=l*s,h=t.buffer,v=t.byteOffset;return v%s!==0&&(h=new Uint8Array(h).slice(v,v+u).buffer,v=0),new o(h,v,l)}function Y_(t,e,r){let i=`TEXCOORD_${e.texCoord||0}`,n=r.attributes[i],o=t.getTypedArrayForAccessor(n),s=t.gltf.json,l=e.index,u=s.textures?.[l]?.source;if(typeof u<"u"){let h=s.images?.[u]?.mimeType,v=t.gltf.images?.[u];if(v&&typeof v.width<"u"){let T=[];for(let E=0;E<o.length;E+=2){let M=L_e(v,h,o,E,e.channels);T.push(M)}return T}}return[]}function _C(t,e,r,i,n){if(!r?.length)return;let o=[];for(let v of r){let T=i.findIndex(E=>E===v);T===-1&&(T=i.push(v)-1),o.push(T)}let s=new Uint32Array(o),l=t.gltf.buffers.push({arrayBuffer:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength})-1,u=t.addBufferView(s,l,0),h=t.addAccessor(u,{size:1,componentType:G_(s),count:s.length});n.attributes[e]=h}function L_e(t,e,r,i,n=[0]){let o={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},s=r[i],l=r[i+1],u=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(u=4);let h=F_e(s,l,t,u),v=0;for(let T of n){let E=typeof T=="number"?Object.values(o)[T]:o[T],M=h+E.offset,O=vx(t);if(O.data.length<=M)throw new Error(`${O.data.length} <= ${M}`);let F=O.data[M];v|=F<<E.shift}return v}function F_e(t,e,r,i=1){let n=r.width,o=QW(t)*(n-1),s=Math.round(o),l=r.height,u=QW(e)*(l-1),h=Math.round(u),v=r.components?r.components:i;return(h*n+s)*v}function yC(t,e,r,i,n){let o=[];for(let s=0;s<e;s++){let l=r[s],u=r[s+1]-r[s];if(u+l>i)break;let h=l/n,v=u/n;o.push(t.slice(h,h+v))}return o}function vC(t,e,r){let i=[];for(let n=0;n<e;n++){let o=n*r;i.push(t.slice(o,o+r))}return i}function xC(t,e,r,i){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(i){let n=[],o=new TextDecoder("utf8"),s=0;for(let l=0;l<t;l++){let u=i[l+1]-i[l];if(u+s<=e.length){let h=e.subarray(s,u+s),v=o.decode(h);n.push(v),s+=u}}return n}return[]}var tq="EXT_mesh_features",N_e=tq;async function k_e(t,e){let r=new wo(t);U_e(r,e)}function U_e(t,e){let r=t.gltf.json;if(r.meshes)for(let i of r.meshes)for(let n of i.primitives)z_e(t,n,e)}function z_e(t,e,r){if(!r?.gltf?.loadBuffers)return;let n=e.extensions?.[tq]?.featureIds;if(n)for(let o of n){let s;if(typeof o.attribute<"u"){let l=`_FEATURE_ID_${o.attribute}`,u=e.attributes[l];s=t.getTypedArrayForAccessor(u)}else typeof o.texture<"u"&&r?.gltf?.loadImages?s=Y_(t,o.texture,e):s=[];o.data=s}}var $D={};As($D,{decode:()=>H_e,name:()=>V_e});var JD="EXT_structural_metadata",V_e=JD;async function H_e(t,e){let r=new wo(t);j_e(r,e)}function j_e(t,e){if(!e.gltf?.loadBuffers)return;let r=t.getExtension(JD);r&&(e.gltf?.loadImages&&G_e(t,r),W_e(t,r))}function G_e(t,e){let r=e.propertyTextures,i=t.gltf.json;if(r&&i.meshes)for(let n of i.meshes)for(let o of n.primitives)X_e(t,r,o,e)}function W_e(t,e){let r=e.schema;if(!r)return;let i=r.classes,n=e.propertyTables;if(i&&n)for(let o in i){let s=q_e(n,o);s&&K_e(t,r,s)}}function q_e(t,e){for(let r of t)if(r.class===e)return r;return null}function X_e(t,e,r,i){if(!e)return;let o=r.extensions?.[JD]?.propertyTextures;if(o)for(let s of o){let l=e[s];Y_e(t,l,r,i)}}function Y_e(t,e,r,i){if(!e.properties)return;i.dataAttributeNames||(i.dataAttributeNames=[]);let n=e.class;for(let o in e.properties){let s=`${n}_${o}`,l=e.properties?.[o];if(!l)continue;l.data||(l.data=[]);let u=l.data,h=Y_(t,l,r);h!==null&&(_C(t,s,h,u,r),l.data=u,i.dataAttributeNames.push(s))}}function K_e(t,e,r){let i=e.classes?.[r.class];if(!i)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let n=r.count;for(let o in i.properties){let s=i.properties[o],l=r.properties?.[o];if(l){let u=Z_e(t,e,s,n,l);l.data=u}}}function Z_e(t,e,r,i,n){let o=[],s=n.values,l=t.getTypedArrayForBufferView(s),u=J_e(t,r,n,i),h=Q_e(t,n,i);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=$_e(r,i,l,u);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{o=xC(i,l,u,h);break}case"ENUM":{o=eye(e,r,i,l,u);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return o}function J_e(t,e,r,i){return e.array&&typeof e.count>"u"&&typeof r.arrayOffsets<"u"?q_(t,r.arrayOffsets,r.arrayOffsetType||"UINT32",i):null}function Q_e(t,e,r){return typeof e.stringOffsets<"u"?q_(t,e.stringOffsets,e.stringOffsetType||"UINT32",r):null}function $_e(t,e,r,i){let n=t.array,o=t.count,s=Pb(t.type,t.componentType),l=r.byteLength/s,u;return t.componentType?u=X_(r,t.type,t.componentType,l):u=r,n?i?yC(u,e,i,r.length,s):o?vC(u,e,o):[]:u}function eye(t,e,r,i,n){let o=e.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let s=t.enums?.[o];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let l=s.valueType||"UINT16",u=Pb(e.type,l),h=i.byteLength/u,v=X_(i,e.type,l,h);if(v||(v=i),e.array){if(n)return tye({valuesData:v,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:i.length,elementSize:u,enumEntry:s});let T=e.count;return T?rye(v,r,T,s):[]}return QD(v,0,r,s)}function tye(t){let{valuesData:e,numberOfElements:r,arrayOffsets:i,valuesDataBytesLength:n,elementSize:o,enumEntry:s}=t,l=[];for(let u=0;u<r;u++){let h=i[u],v=i[u+1]-i[u];if(v+h>n)break;let T=h/o,E=v/o,M=QD(e,T,E,s);l.push(M)}return l}function rye(t,e,r,i){let n=[];for(let o=0;o<e;o++){let s=r*o,l=QD(t,s,r,i);n.push(l)}return n}function QD(t,e,r,i){let n=[];for(let o=0;o<r;o++)if(t instanceof BigInt64Array||t instanceof BigUint64Array)n.push("");else{let s=t[e+o],l=iye(i,s);l?n.push(l.name):n.push("")}return n}function iye(t,e){for(let r of t.values)if(r.value===e)return r;return null}var eL={};As(eL,{decode:()=>oye,name:()=>nye});var rq="EXT_feature_metadata",nye=rq;async function oye(t,e){let r=new wo(t);sye(r,e)}function sye(t,e){if(!e.gltf?.loadBuffers)return;let r=t.getExtension(rq);r&&(e.gltf?.loadImages&&aye(t,r),lye(t,r))}function aye(t,e){let r=e.schema;if(!r)return;let i=r.classes,{featureTextures:n}=e;if(i&&n)for(let o in i){let s=i[o],l=uye(n,o);l&&hye(t,l,s)}}function lye(t,e){let r=e.schema;if(!r)return;let i=r.classes,n=e.featureTables;if(i&&n)for(let o in i){let s=cye(n,o);s&&fye(t,r,s)}}function cye(t,e){for(let r in t){let i=t[r];if(i.class===e)return i}return null}function uye(t,e){for(let r in t){let i=t[r];if(i.class===e)return i}return null}function fye(t,e,r){if(!r.class)return;let i=e.classes?.[r.class];if(!i)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let n=r.count;for(let o in i.properties){let s=i.properties[o],l=r.properties?.[o];if(l){let u=dye(t,e,s,n,l);l.data=u}}}function hye(t,e,r){let i=e.class;for(let n in r.properties){let o=e?.properties?.[n];if(o){let s=_ye(t,o,i);o.data=s}}}function dye(t,e,r,i,n){let o=[],s=n.bufferView,l=t.getTypedArrayForBufferView(s),u=pye(t,r,n,i),h=Aye(t,r,n,i);return r.type==="STRING"||r.componentType==="STRING"?o=xC(i,l,u,h):mye(r)&&(o=gye(r,i,l,u)),o}function pye(t,e,r,i){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?q_(t,r.arrayOffsetBufferView,r.offsetType||"UINT32",i):null}function Aye(t,e,r,i){return typeof r.stringOffsetBufferView<"u"?q_(t,r.stringOffsetBufferView,r.offsetType||"UINT32",i):null}function mye(t){let e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(t.type)||typeof t.componentType<"u"&&e.includes(t.componentType)}function gye(t,e,r,i){let n=t.type==="ARRAY",o=t.componentCount,s="SCALAR",l=t.componentType||t.type,u=Pb(s,l),h=r.byteLength/u,v=X_(r,s,l,h);return n?i?yC(v,e,i,r.length,u):o?vC(v,e,o):[]:v}function _ye(t,e,r){let i=t.gltf.json;if(!i.meshes)return[];let n=[];for(let o of i.meshes)for(let s of o.primitives)yye(t,r,e,n,s);return n}function yye(t,e,r,i,n){let o={channels:r.channels,...r.texture},s=Y_(t,o,n);s&&_C(t,e,s,i,n)}var iq="4.2.0-beta.2";var K_=!0,nq=1735152710,iL=12,bC=8,vye=1313821514,xye=5130562,bye=0,wye=0,Tye=1;function Eye(t,e=0){return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}function oq(t,e=0,r={}){let i=new DataView(t),{magic:n=nq}=r,o=i.getUint32(e,!1);return o===n||o===nq}function sq(t,e,r=0,i={}){let n=new DataView(e),o=Eye(n,r+0),s=n.getUint32(r+4,K_),l=n.getUint32(r+8,K_);switch(Object.assign(t,{header:{byteOffset:r,byteLength:l,hasBinChunk:!1},type:o,version:s,json:{},binChunks:[]}),r+=iL,t.version){case 1:return Sye(t,n,r);case 2:return Cye(t,n,r,i={});default:throw new Error(`Invalid GLB version ${t.version}. Only supports version 1 and 2.`)}}function Sye(t,e,r){Bn(t.header.byteLength>iL+bC);let i=e.getUint32(r+0,K_),n=e.getUint32(r+4,K_);return r+=bC,Bn(n===bye),tL(t,e,r,i),r+=i,r+=rL(t,e,r,t.header.byteLength),r}function Cye(t,e,r,i){return Bn(t.header.byteLength>iL+bC),Mye(t,e,r,i),r+t.header.byteLength}function Mye(t,e,r,i){for(;r+8<=t.header.byteLength;){let n=e.getUint32(r+0,K_),o=e.getUint32(r+4,K_);switch(r+=bC,o){case vye:tL(t,e,r,n);break;case xye:rL(t,e,r,n);break;case wye:i.strict||tL(t,e,r,n);break;case Tye:i.strict||rL(t,e,r,n);break;default:break}r+=yp(n,4)}return r}function tL(t,e,r,i){let n=new Uint8Array(e.buffer,r,i),s=new TextDecoder("utf8").decode(n);return t.json=JSON.parse(s),yp(i,4)}function rL(t,e,r,i){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:r,byteLength:i,arrayBuffer:e.buffer}),yp(i,4)}function nL(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;let i=e.baseUri||e.uri;if(!i)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return i.substr(0,i.lastIndexOf("/")+1)+t}var sL={};As(sL,{decode:()=>zye,name:()=>Uye});var Iye="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",Pye="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",Rye=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]),Bye=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),Oye={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Dye={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function aq(t,e,r,i,n,o="NONE"){let s=await Lye();kye(s,s.exports[Dye[n]],t,e,r,i,s.exports[Oye[o||"NONE"]])}var oL;async function Lye(){return oL||(oL=Fye()),oL}async function Fye(){let t=Iye;WebAssembly.validate(Rye)&&(t=Pye,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let e=await WebAssembly.instantiate(Nye(t),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function Nye(t){let e=new Uint8Array(t.length);for(let i=0;i<t.length;++i){let n=t.charCodeAt(i);e[i]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let i=0;i<t.length;++i)e[r++]=e[i]<60?Bye[e[i]]:(e[i]-60)*64+e[++i];return e.buffer.slice(0,r)}function kye(t,e,r,i,n,o,s){let l=t.exports.sbrk,u=i+3&-4,h=l(u*n),v=l(o.length),T=new Uint8Array(t.exports.memory.buffer);T.set(o,v);let E=e(h,i,n,v,o.length);if(E===0&&s&&s(h,u,n),r.set(T.subarray(h,h+i*n)),l(h-l(0)),E!==0)throw new Error(`Malformed buffer data: ${E}`)}var wC="EXT_meshopt_compression",Uye=wC;async function zye(t,e){let r=new wo(t);if(!e?.gltf?.decompressMeshes||!e.gltf?.loadBuffers)return;let i=[];for(let n of t.json.bufferViews||[])i.push(Vye(r,n));await Promise.all(i),r.removeExtension(wC)}async function Vye(t,e){let r=t.getObjectExtension(e,wC);if(r){let{byteOffset:i=0,byteLength:n=0,byteStride:o,count:s,mode:l,filter:u="NONE",buffer:h}=r,v=t.gltf.buffers[h],T=new Uint8Array(v.arrayBuffer,v.byteOffset+i,n),E=new Uint8Array(t.gltf.buffers[e.buffer].arrayBuffer,e.byteOffset,e.byteLength);await aq(E,s,o,T,l,u),t.removeObjectExtension(e,wC)}}var aL={};As(aL,{name:()=>Hye,preprocess:()=>jye});var Z_="EXT_texture_webp",Hye=Z_;function jye(t,e){let r=new wo(t);if(!iR("image/webp")){if(r.getRequiredExtensions().includes(Z_))throw new Error(`gltf: Required extension ${Z_} not supported by browser`);return}let{json:i}=r;for(let n of i.textures||[]){let o=r.getObjectExtension(n,Z_);o&&(n.source=o.source),r.removeObjectExtension(n,Z_)}r.removeExtension(Z_)}var lL={};As(lL,{name:()=>Gye,preprocess:()=>Wye});var TC="KHR_texture_basisu",Gye=TC;function Wye(t,e){let r=new wo(t),{json:i}=r;for(let n of i.textures||[]){let o=r.getObjectExtension(n,TC);o&&(n.source=o.source,r.removeObjectExtension(n,TC))}r.removeExtension(TC)}var dL={};As(dL,{decode:()=>ave,encode:()=>lve,name:()=>ove,preprocess:()=>sve});var lq="4.2.0-beta.2";var cq={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:lq,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function fq(t,e,r){let i=hq(e.metadata),n=[],o=qye(e.attributes);for(let s in t){let l=t[s],u=uq(s,l,o[s]);n.push(u)}if(r){let s=uq("indices",r);n.push(s)}return{fields:n,metadata:i}}function qye(t){let e={};for(let r in t){let i=t[r];e[i.name||"undefined"]=i}return e}function uq(t,e,r){let i=r?hq(r.metadata):void 0;return wP(t,e,i)}function hq(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var dq={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Xye={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},Yye=4,Rb=class{draco;decoder;metadataQuerier;constructor(e){this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,r={}){let i=new this.draco.DecoderBuffer;i.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(r);let n=this.decoder.GetEncodedGeometryType(i),o=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let s;switch(n){case this.draco.TRIANGULAR_MESH:s=this.decoder.DecodeBufferToMesh(i,o);break;case this.draco.POINT_CLOUD:s=this.decoder.DecodeBufferToPointCloud(i,o);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!s.ok()||!o.ptr){let E=`DRACO decompression failed: ${s.error_msg()}`;throw new Error(E)}let l=this._getDracoLoaderData(o,n,r),u=this._getMeshData(o,l,r),h=pd(u.attributes),v=fq(u.attributes,l,u.indices);return{loader:"draco",loaderData:l,header:{vertexCount:o.num_points(),boundingBox:h},...u,schema:v}}finally{this.draco.destroy(i),o&&this.draco.destroy(o)}}_getDracoLoaderData(e,r,i){let n=this._getTopLevelMetadata(e),o=this._getDracoAttributes(e,i);return{geometry_type:r,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:n,attributes:o}}_getDracoAttributes(e,r){let i={};for(let n=0;n<e.num_attributes();n++){let o=this.decoder.GetAttribute(e,n),s=this._getAttributeMetadata(e,n);i[o.unique_id()]={unique_id:o.unique_id(),attribute_type:o.attribute_type(),data_type:o.data_type(),num_components:o.num_components(),byte_offset:o.byte_offset(),byte_stride:o.byte_stride(),normalized:o.normalized(),attribute_index:n,metadata:s};let l=this._getQuantizationTransform(o,r);l&&(i[o.unique_id()].quantization_transform=l);let u=this._getOctahedronTransform(o,r);u&&(i[o.unique_id()].octahedron_transform=u)}return i}_getMeshData(e,r,i){let n=this._getMeshAttributes(r,e,i);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(i.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(e,r,i){let n={};for(let o of Object.values(e.attributes)){let s=this._deduceAttributeName(o,i);o.name=s;let l=this._getAttributeValues(r,o);if(l){let{value:u,size:h}=l;n[s]={value:u,size:h,byteOffset:o.byte_offset,byteStride:o.byte_stride,normalized:o.normalized}}}return n}_getTriangleListIndices(e){let i=e.num_faces()*3,n=i*Yye,o=this.draco._malloc(n);try{return this.decoder.GetTrianglesUInt32Array(e,n,o),new Uint32Array(this.draco.HEAPF32.buffer,o,i).slice()}finally{this.draco._free(o)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),Jye(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let i=Xye[r.data_type];if(!i)return console.warn(`DRACO: Unsupported attribute type ${r.data_type}`),null;let n=r.num_components,s=e.num_points()*n,l=s*i.BYTES_PER_ELEMENT,u=Kye(this.draco,i),h,v=this.draco._malloc(l);try{let T=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,T,u,l,v),h=new i(this.draco.HEAPF32.buffer,v,s).slice()}finally{this.draco._free(v)}return{value:h,size:n}}_deduceAttributeName(e,r){let i=e.unique_id;for(let[s,l]of Object.entries(r.extraAttributes||{}))if(l===i)return s;let n=e.attribute_type;for(let s in dq)if(this.draco[s]===n)return dq[s];let o=r.attributeNameEntry||"name";return e.metadata[o]?e.metadata[o].string:`CUSTOM_ATTRIBUTE_${i}`}_getTopLevelMetadata(e){let r=this.decoder.GetMetadata(e);return this._getDracoMetadata(r)}_getAttributeMetadata(e,r){let i=this.decoder.GetAttributeMetadata(e,r);return this._getDracoMetadata(i)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let r={},i=this.metadataQuerier.NumEntries(e);for(let n=0;n<i;n++){let o=this.metadataQuerier.GetEntryName(e,n);r[o]=this._getDracoMetadataField(e,o)}return r}_getDracoMetadataField(e,r){let i=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,i);let n=Zye(i);return{int:this.metadataQuerier.GetIntEntry(e,r),string:this.metadataQuerier.GetStringEntry(e,r),double:this.metadataQuerier.GetDoubleEntry(e,r),intArray:n}}finally{this.draco.destroy(i)}}_disableAttributeTransforms(e){let{quantizedAttributes:r=[],octahedronAttributes:i=[]}=e,n=[...r,...i];for(let o of n)this.decoder.SkipAttributeTransform(this.draco[o])}_getQuantizationTransform(e,r){let{quantizedAttributes:i=[]}=r,n=e.attribute_type();if(i.map(s=>this.decoder[s]).includes(n)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(e))return{quantization_bits:s.quantization_bits(),range:s.range(),min_values:new Float32Array([1,2,3]).map(l=>s.min_value(l))}}finally{this.draco.destroy(s)}}return null}_getOctahedronTransform(e,r){let{octahedronAttributes:i=[]}=r,n=e.attribute_type();if(i.map(s=>this.decoder[s]).includes(n)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(e))return{quantization_bits:s.quantization_bits()}}finally{this.draco.destroy(s)}}return null}};function Kye(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}function Zye(t){let e=t.size(),r=new Int32Array(e);for(let i=0;i<e;i++)r[i]=t.GetValue(i);return r}function Jye(t){let e=t.size(),r=new Int32Array(e);for(let i=0;i<e;i++)r[i]=t.GetValue(i);return r}var Qye="1.5.6",$ye="1.4.1",cL=`https://www.gstatic.com/draco/versioned/decoders/${Qye}`,Cc={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},uL={[Cc.DECODER]:`${cL}/${Cc.DECODER}`,[Cc.DECODER_WASM]:`${cL}/${Cc.DECODER_WASM}`,[Cc.FALLBACK_DECODER]:`${cL}/${Cc.FALLBACK_DECODER}`,[Cc.ENCODER]:`https://raw.githubusercontent.com/google/draco/${$ye}/javascript/${Cc.ENCODER}`},fL;async function pq(t){let e=t.modules||{};return e.draco3d?fL||=e.draco3d.createDecoderModule({}).then(r=>({draco:r})):fL||=eve(t),await fL}async function eve(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await gh(uL[Cc.FALLBACK_DECODER],"draco",t,Cc.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await gh(uL[Cc.DECODER],"draco",t,Cc.DECODER),await gh(uL[Cc.DECODER_WASM],"draco",t,Cc.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await tve(e,r)}function tve(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(i=>{t({...r,onModuleLoaded:n=>i({draco:n})})})}var EC={...cq,parse:rve};async function rve(t,e){let{draco:r}=await pq(e),i=new Rb(r);try{return i.parseSync(t,e?.draco)}finally{i.destroy()}}function Aq(t){let e={};for(let r in t){let i=t[r];if(r!=="indices"){let n=hL(i);e[r]=n}}return e}function hL(t){let{buffer:e,size:r,count:i}=ive(t);return{value:e,size:r,byteOffset:0,count:i,type:gC(r),componentType:G_(e)}}function ive(t){let e=t,r=1,i=0;return t&&t.value&&(e=t.value,r=t.size||1),e&&(ArrayBuffer.isView(e)||(e=nve(e,Float32Array)),i=e.length/r),{buffer:e,size:r,count:i}}function nve(t,e,r=!1){return t?Array.isArray(t)?new e(t):r&&!(t instanceof e)?new e(t):t:null}var oA="KHR_draco_mesh_compression",ove=oA;function sve(t,e,r){let i=new wo(t);for(let n of mq(i))i.getObjectExtension(n,oA)}async function ave(t,e,r){if(!e?.gltf?.decompressMeshes)return;let i=new wo(t),n=[];for(let o of mq(i))i.getObjectExtension(o,oA)&&n.push(cve(i,o,e,r));await Promise.all(n),i.removeExtension(oA)}function lve(t,e={}){let r=new wo(t);for(let i of r.json.meshes||[])uve(i,e),r.addRequiredExtension(oA)}async function cve(t,e,r,i){let n=t.getObjectExtension(e,oA);if(!n)return;let o=t.getTypedArrayForBufferView(n.bufferView),s=ZA(o.buffer,o.byteOffset),l={...r};delete l["3d-tiles"];let u=await qc(s,EC,l,i),h=Aq(u.attributes);for(let[v,T]of Object.entries(h))if(v in e.attributes){let E=e.attributes[v],M=t.getAccessor(E);M?.min&&M?.max&&(T.min=M.min,T.max=M.max)}e.attributes=h,u.indices&&(e.indices=hL(u.indices)),t.removeObjectExtension(e,oA),fve(e)}function uve(t,e,r=4,i,n){if(!i.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=i.DracoWriter.encodeSync({attributes:t}),s=n?.parseSync?.({attributes:t}),l=i._addFauxAttributes(s.attributes),u=i.addBufferView(o);return{primitives:[{attributes:l,mode:r,extensions:{[oA]:{bufferView:u,attributes:l}}}]}}function fve(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*mq(t){for(let e of t.json.meshes||[])for(let r of e.primitives)yield r}var pL={};As(pL,{decode:()=>Ave,name:()=>hve});var CC="KHR_texture_transform",hve=CC,SC=new ot,dve=new mo,pve=new mo;async function Ave(t,e){if(!new wo(t).hasExtension(CC)||!e.gltf?.loadBuffers)return;let n=t.json.materials||[];for(let o=0;o<n.length;o++)mve(o,t)}function mve(t,e){let r=e.json.materials?.[t],i=[r?.pbrMetallicRoughness?.baseColorTexture,r?.emissiveTexture,r?.normalTexture,r?.occlusionTexture,r?.pbrMetallicRoughness?.metallicRoughnessTexture],n=[];for(let o of i)o&&o?.extensions?.[CC]&&gve(e,t,o,n)}function gve(t,e,r,i){let n=_ve(r,i);if(!n)return;let o=t.json.meshes||[];for(let s of o)for(let l of s.primitives){let u=l.material;Number.isFinite(u)&&e===u&&yve(t,l,n)}}function _ve(t,e){let r=t.extensions?.[CC],{texCoord:i=0}=t,{texCoord:n=i}=r;if(!(e.findIndex(([s,l])=>s===i&&l===n)!==-1)){let s=bve(r);return i!==n&&(t.texCoord=n),e.push([i,n]),{originalTexCoord:i,texCoord:n,matrix:s}}return null}function yve(t,e,r){let{originalTexCoord:i,texCoord:n,matrix:o}=r,s=e.attributes[`TEXCOORD_${i}`];if(Number.isFinite(s)){let l=t.json.accessors?.[s];if(l&&l.bufferView){let u=t.json.bufferViews?.[l.bufferView];if(u){let{arrayBuffer:h,byteOffset:v}=t.buffers[u.buffer],T=(v||0)+(l.byteOffset||0)+(u.byteOffset||0),{ArrayType:E,length:M}=W_(l,u),O=mC[l.componentType],F=AC[l.type],z=u.byteStride||O*F,W=new Float32Array(M);for(let J=0;J<l.count;J++){let K=new E(h,T+J*z,2);SC.set(K[0],K[1],1),SC.transformByMatrix3(o),W.set([SC[0],SC[1]],J*F)}i===n?vve(l,u,t.buffers,W):xve(n,l,e,t,W)}}}}function vve(t,e,r,i){t.componentType=5126,r.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength}),e.buffer=r.length-1,e.byteLength=i.buffer.byteLength,e.byteOffset=0,delete e.byteStride}function xve(t,e,r,i,n){i.buffers.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength});let o=i.json.bufferViews;if(!o)return;o.push({buffer:i.buffers.length-1,byteLength:n.buffer.byteLength,byteOffset:0});let s=i.json.accessors;s&&(s.push({bufferView:o?.length-1,byteOffset:0,componentType:5126,count:e.count,type:"VEC2"}),r.attributes[`TEXCOORD_${t}`]=s.length-1)}function bve(t){let{offset:e=[0,0],rotation:r=0,scale:i=[1,1]}=t,n=new mo().set(1,0,0,0,1,0,e[0],e[1],1),o=dve.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),s=pve.set(i[0],0,0,0,i[1],0,0,0,1);return n.multiplyRight(o).multiplyRight(s)}var AL={};As(AL,{decode:()=>Tve,encode:()=>Eve,name:()=>wve});var lg="KHR_lights_punctual",wve=lg;async function Tve(t){let e=new wo(t),{json:r}=e,i=e.getExtension(lg);i&&(e.json.lights=i.lights,e.removeExtension(lg));for(let n of r.nodes||[]){let o=e.getObjectExtension(n,lg);o&&(n.light=o.light),e.removeObjectExtension(n,lg)}}async function Eve(t){let e=new wo(t),{json:r}=e;if(r.lights){let i=e.addExtension(lg);Na(!i.lights),i.lights=r.lights,delete r.lights}if(e.json.lights){for(let i of e.json.lights){let n=i.node;e.addObjectExtension(n,lg,i)}delete e.json.lights}}var mL={};As(mL,{decode:()=>Cve,encode:()=>Mve,name:()=>Sve});var Bb="KHR_materials_unlit",Sve=Bb;async function Cve(t){let e=new wo(t),{json:r}=e;for(let i of r.materials||[])i.extensions&&i.extensions.KHR_materials_unlit&&(i.unlit=!0),e.removeObjectExtension(i,Bb);e.removeExtension(Bb)}function Mve(t){let e=new wo(t),{json:r}=e;if(e.materials)for(let i of r.materials||[])i.unlit&&(delete i.unlit,e.addObjectExtension(i,Bb,{}),e.addExtension(Bb))}var gL={};As(gL,{decode:()=>Pve,encode:()=>Rve,name:()=>Ive});var Ob="KHR_techniques_webgl",Ive=Ob;async function Pve(t){let e=new wo(t),{json:r}=e,i=e.getExtension(Ob);if(i){let n=Bve(i,e);for(let o of r.materials||[]){let s=e.getObjectExtension(o,Ob);s&&(o.technique=Object.assign({},s,n[s.technique]),o.technique.values=Ove(o.technique,e)),e.removeObjectExtension(o,Ob)}e.removeExtension(Ob)}}async function Rve(t,e){}function Bve(t,e){let{programs:r=[],shaders:i=[],techniques:n=[]}=t,o=new TextDecoder;return i.forEach(s=>{if(Number.isFinite(s.bufferView))s.code=o.decode(e.getTypedArrayForBufferView(s.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(s=>{s.fragmentShader=i[s.fragmentShader],s.vertexShader=i[s.vertexShader]}),n.forEach(s=>{s.program=r[s.program]}),n}function Ove(t,e){let r=Object.assign({},t.values);return Object.keys(t.uniforms||{}).forEach(i=>{t.uniforms[i].value&&!(i in r)&&(r[i]=t.uniforms[i].value)}),Object.keys(r).forEach(i=>{typeof r[i]=="object"&&r[i].index!==void 0&&(r[i].texture=e.getTexture(r[i].index))}),r}var gq=[$D,ZD,sL,aL,lL,dL,AL,mL,gL,pL,eL];function _q(t,e={},r){let i=gq.filter(n=>vq(n.name,e));for(let n of i)n.preprocess?.(t,e,r)}async function yq(t,e={},r){let i=gq.filter(n=>vq(n.name,e));for(let n of i)await n.decode?.(t,e,r)}function vq(t,e){let r=e?.gltf?.excludeExtensions||{};return!(t in r&&!r[t])}var _L="KHR_binary_glTF";function xq(t){let e=new wo(t),{json:r}=e;for(let i of r.images||[]){let n=e.getObjectExtension(i,_L);n&&Object.assign(i,n),e.removeObjectExtension(i,_L)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,e.removeExtension(_L)}var bq={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Lve={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},yL=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(e,r){this.json=e.json;let i=e.json;switch(i.asset&&i.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${i.asset.version}`);return}if(!r.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(i),this._convertTopLevelObjectsToArrays(i),xq(e),this._convertObjectIdsToArrayIndices(i),this._updateObjects(i),this._updateMaterial(i)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(let r in bq)this._convertTopLevelObjectToArray(e,r)}_convertTopLevelObjectToArray(e,r){let i=e[r];if(!(!i||Array.isArray(i))){e[r]=[];for(let n in i){let o=i[n];o.id=o.id||n;let s=e[r].length;e[r].push(o),this.idToIndexMap[r][n]=s}}}_convertObjectIdsToArrayIndices(e){for(let r in bq)this._convertIdsToIndices(e,r);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(let r of e.textures)this._convertTextureIds(r);for(let r of e.meshes)this._convertMeshIds(r);for(let r of e.nodes)this._convertNodeIds(r);for(let r of e.scenes)this._convertSceneIds(r)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(let r of e.primitives){let{attributes:i,indices:n,material:o}=r;for(let s in i)i[s]=this._convertIdToIndex(i[s],"accessor");n&&(r.indices=this._convertIdToIndex(n,"accessor")),o&&(r.material=this._convertIdToIndex(o,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(r=>this._convertIdToIndex(r,"node"))),e.meshes&&(e.meshes=e.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(e,r){e[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),e[r]=[]);for(let i of e[r])for(let n in i){let o=i[n],s=this._convertIdToIndex(o,n);i[n]=s}}_convertIdToIndex(e,r){let i=Lve[r];if(i in this.idToIndexMap){let n=this.idToIndexMap[i][e];if(!Number.isFinite(n))throw new Error(`gltf v1: failed to resolve ${r} with id ${e}`);return n}return e}_updateObjects(e){for(let r of this.json.buffers)delete r.type}_updateMaterial(e){for(let r of e.materials){r.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let i=r.values?.tex||r.values?.texture2d_0||r.values?.diffuseTex,n=e.textures.findIndex(o=>o.id===i);n!==-1&&(r.pbrMetallicRoughness.baseColorTexture={index:n})}}};function wq(t,e={}){return new yL().normalize(t,e)}async function Tq(t,e,r=0,i,n){return Fve(t,e,r,i),wq(t,{normalize:i?.gltf?.normalize}),_q(t,i,n),i?.gltf?.loadBuffers&&t.json.buffers&&await Nve(t,i,n),i?.gltf?.loadImages&&await kve(t,i,n),await yq(t,i,n),t}function Fve(t,e,r,i){if(i.uri&&(t.baseUri=i.uri),e instanceof ArrayBuffer&&!oq(e,r,i)&&(e=new TextDecoder().decode(e)),typeof e=="string")t.json=zP(e);else if(e instanceof ArrayBuffer){let s={};r=sq(s,e,r,i.glb),Na(s.type==="glTF",`Invalid GLB magic string ${s.type}`),t._glb=s,t.json=s.json}else Na(!1,"GLTF: must be ArrayBuffer or string");let n=t.json.buffers||[];if(t.buffers=new Array(n.length).fill(null),t._glb&&t._glb.header.hasBinChunk){let{binChunks:s}=t._glb;t.buffers[0]={arrayBuffer:s[0].arrayBuffer,byteOffset:s[0].byteOffset,byteLength:s[0].byteLength}}let o=t.json.images||[];t.images=new Array(o.length).fill({})}async function Nve(t,e,r){let i=t.json.buffers||[];for(let n=0;n<i.length;++n){let o=i[n];if(o.uri){let{fetch:s}=r;Na(s);let l=nL(o.uri,e),h=await(await r?.fetch?.(l))?.arrayBuffer?.();t.buffers[n]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete o.uri}else t.buffers[n]===null&&(t.buffers[n]={arrayBuffer:new ArrayBuffer(o.byteLength),byteOffset:0,byteLength:o.byteLength})}}async function kve(t,e,r){let i=Uve(t),n=t.json.images||[],o=[];for(let s of i)o.push(zve(t,n[s],s,e,r));return await Promise.all(o)}function Uve(t){let e=new Set,r=t.json.textures||[];for(let i of r)i.source!==void 0&&e.add(i.source);return Array.from(e).sort()}async function zve(t,e,r,i,n){let o;if(e.uri&&!e.hasOwnProperty("bufferView")){let l=nL(e.uri,i),{fetch:u}=n;o=await(await u(l)).arrayBuffer(),e.bufferView={data:o}}if(Number.isFinite(e.bufferView)){let l=ZW(t.json,t.buffers,e.bufferView);o=ZA(l.buffer,l.byteOffset,l.byteLength)}Na(o,"glTF image has no data");let s=await qc(o,[Eh,qD],{...i,mimeType:e.mimeType,basis:i.basis||{format:hC()}},n);s&&s[0]&&(s={compressed:!0,mipmaps:!1,width:s[0].width,height:s[0].height,data:s[0]}),t.images=t.images||[],t.images[r]=s}var Vd={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:iq,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:Vve,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function Vve(t,e={},r){e={...Vd.options,...e},e.gltf={...Vd.options.gltf,...e.gltf};let{byteOffset:i=0}=e;return await Tq({},t,i,e,r)}var Hve={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jve={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Wu={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},Gve={magFilter:Wu.TEXTURE_MAG_FILTER,minFilter:Wu.TEXTURE_MIN_FILTER,wrapS:Wu.TEXTURE_WRAP_S,wrapT:Wu.TEXTURE_WRAP_T},Wve={[Wu.TEXTURE_MAG_FILTER]:Wu.LINEAR,[Wu.TEXTURE_MIN_FILTER]:Wu.NEAREST_MIPMAP_LINEAR,[Wu.TEXTURE_WRAP_S]:Wu.REPEAT,[Wu.TEXTURE_WRAP_T]:Wu.REPEAT};function qve(){return{id:"default-sampler",parameters:Wve}}function Xve(t){return jve[t]}function Yve(t){return Hve[t]}var vL=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(e,r={}){let{json:i,buffers:n=[],images:o=[]}=e,{baseUri:s=""}=e;return Na(i),this.baseUri=s,this.buffers=n,this.images=o,this.jsonUnprocessed=i,this.json=this._resolveTree(e.json,r),this.json}_resolveTree(e,r={}){let i={...e};return this.json=i,e.bufferViews&&(i.bufferViews=e.bufferViews.map((n,o)=>this._resolveBufferView(n,o))),e.images&&(i.images=e.images.map((n,o)=>this._resolveImage(n,o))),e.samplers&&(i.samplers=e.samplers.map((n,o)=>this._resolveSampler(n,o))),e.textures&&(i.textures=e.textures.map((n,o)=>this._resolveTexture(n,o))),e.accessors&&(i.accessors=e.accessors.map((n,o)=>this._resolveAccessor(n,o))),e.materials&&(i.materials=e.materials.map((n,o)=>this._resolveMaterial(n,o))),e.meshes&&(i.meshes=e.meshes.map((n,o)=>this._resolveMesh(n,o))),e.nodes&&(i.nodes=e.nodes.map((n,o)=>this._resolveNode(n,o)),i.nodes=i.nodes.map((n,o)=>this._resolveNodeChildren(n))),e.skins&&(i.skins=e.skins.map((n,o)=>this._resolveSkin(n,o))),e.scenes&&(i.scenes=e.scenes.map((n,o)=>this._resolveScene(n,o))),typeof this.json.scene=="number"&&i.scenes&&(i.scene=i.scenes[this.json.scene]),i}getScene(e){return this._get(this.json.scenes,e)}getNode(e){return this._get(this.json.nodes,e)}getSkin(e){return this._get(this.json.skins,e)}getMesh(e){return this._get(this.json.meshes,e)}getMaterial(e){return this._get(this.json.materials,e)}getAccessor(e){return this._get(this.json.accessors,e)}getCamera(e){return this._get(this.json.cameras,e)}getTexture(e){return this._get(this.json.textures,e)}getSampler(e){return this._get(this.json.samplers,e)}getImage(e){return this._get(this.json.images,e)}getBufferView(e){return this._get(this.json.bufferViews,e)}getBuffer(e){return this._get(this.json.buffers,e)}_get(e,r){if(typeof r=="object")return r;let i=e&&e[r];return i||console.warn(`glTF file error: Could not find ${e}[${r}]`),i}_resolveScene(e,r){return{...e,id:e.id||`scene-${r}`,nodes:(e.nodes||[]).map(i=>this.getNode(i))}}_resolveNode(e,r){let i={...e,id:e?.id||`node-${r}`};return e.mesh!==void 0&&(i.mesh=this.getMesh(e.mesh)),e.camera!==void 0&&(i.camera=this.getCamera(e.camera)),e.skin!==void 0&&(i.skin=this.getSkin(e.skin)),e.meshes!==void 0&&e.meshes.length&&(i.mesh=e.meshes.reduce((n,o)=>{let s=this.getMesh(o);return n.id=s.id,n.primitives=n.primitives.concat(s.primitives),n},{primitives:[]})),i}_resolveNodeChildren(e){return e.children&&(e.children=e.children.map(r=>this.getNode(r))),e}_resolveSkin(e,r){let i=typeof e.inverseBindMatrices=="number"?this.getAccessor(e.inverseBindMatrices):void 0;return{...e,id:e.id||`skin-${r}`,inverseBindMatrices:i}}_resolveMesh(e,r){let i={...e,id:e.id||`mesh-${r}`,primitives:[]};return e.primitives&&(i.primitives=e.primitives.map(n=>{let o={...n,attributes:{},indices:void 0,material:void 0},s=n.attributes;for(let l in s)o.attributes[l]=this.getAccessor(s[l]);return n.indices!==void 0&&(o.indices=this.getAccessor(n.indices)),n.material!==void 0&&(o.material=this.getMaterial(n.material)),o})),i}_resolveMaterial(e,r){let i={...e,id:e.id||`material-${r}`};if(i.normalTexture&&(i.normalTexture={...i.normalTexture},i.normalTexture.texture=this.getTexture(i.normalTexture.index)),i.occlusionTexture&&(i.occlusionTexture={...i.occlusionTexture},i.occlusionTexture.texture=this.getTexture(i.occlusionTexture.index)),i.emissiveTexture&&(i.emissiveTexture={...i.emissiveTexture},i.emissiveTexture.texture=this.getTexture(i.emissiveTexture.index)),i.emissiveFactor||(i.emissiveFactor=i.emissiveTexture?[1,1,1]:[0,0,0]),i.pbrMetallicRoughness){i.pbrMetallicRoughness={...i.pbrMetallicRoughness};let n=i.pbrMetallicRoughness;n.baseColorTexture&&(n.baseColorTexture={...n.baseColorTexture},n.baseColorTexture.texture=this.getTexture(n.baseColorTexture.index)),n.metallicRoughnessTexture&&(n.metallicRoughnessTexture={...n.metallicRoughnessTexture},n.metallicRoughnessTexture.texture=this.getTexture(n.metallicRoughnessTexture.index))}return i}_resolveAccessor(e,r){let i=Xve(e.componentType),n=Yve(e.type),o=i*n,s={...e,id:e.id||`accessor-${r}`,bytesPerComponent:i,components:n,bytesPerElement:o,value:void 0,bufferView:void 0,sparse:void 0};if(e.bufferView!==void 0&&(s.bufferView=this.getBufferView(e.bufferView)),s.bufferView){let l=s.bufferView.buffer,{ArrayType:u,byteLength:h}=W_(s,s.bufferView),v=(s.bufferView.byteOffset||0)+(s.byteOffset||0)+l.byteOffset,T=l.arrayBuffer.slice(v,v+h);s.bufferView.byteStride&&(T=this._getValueFromInterleavedBuffer(l,v,s.bufferView.byteStride,s.bytesPerElement,s.count)),s.value=new u(T)}return s}_getValueFromInterleavedBuffer(e,r,i,n,o){let s=new Uint8Array(o*n);for(let l=0;l<o;l++){let u=r+l*i;s.set(new Uint8Array(e.arrayBuffer.slice(u,u+n)),l*n)}return s.buffer}_resolveTexture(e,r){return{...e,id:e.id||`texture-${r}`,sampler:typeof e.sampler=="number"?this.getSampler(e.sampler):qve(),source:typeof e.source=="number"?this.getImage(e.source):void 0}}_resolveSampler(e,r){let i={id:e.id||`sampler-${r}`,...e,parameters:{}};for(let n in i){let o=this._enumSamplerParameter(n);o!==void 0&&(i.parameters[o]=i[n])}return i}_enumSamplerParameter(e){return Gve[e]}_resolveImage(e,r){let i={...e,id:e.id||`image-${r}`,image:null,bufferView:e.bufferView!==void 0?this.getBufferView(e.bufferView):void 0},n=this.images[r];return n&&(i.image=n),i}_resolveBufferView(e,r){let i=e.buffer,n=this.buffers[i].arrayBuffer,o=this.buffers[i].byteOffset||0;return e.byteOffset&&(o+=e.byteOffset),{id:`bufferView-${r}`,...e,buffer:this.buffers[i],data:new Uint8Array(n,o,e.byteLength)}}_resolveCamera(e,r){let i={...e,id:e.id||`camera-${r}`};return i.perspective,i.orthographic,i}};function cg(t,e){return new vL().postProcess(t,e)}async function Eq(t){let e=[];return t.scenes.forEach(r=>{r.traverse(i=>{Object.values(i.model.uniforms).forEach(n=>{n.loaded===!1&&e.push(n)})})}),await Kve(()=>e.some(r=>!r.loaded))}async function Kve(t){for(;t();)await new Promise(e=>requestAnimationFrame(e))}var Sq=`#version 300 es
#define SHADER_NAME scenegraph-layer-vertex-shader
in vec3 instancePositions;
in vec3 instancePositions64Low;
in vec4 instanceColors;
in vec3 instancePickingColors;
in vec3 instanceModelMatrixCol0;
in vec3 instanceModelMatrixCol1;
in vec3 instanceModelMatrixCol2;
in vec3 instanceTranslation;
uniform float sizeScale;
uniform float sizeMinPixels;
uniform float sizeMaxPixels;
uniform mat4 sceneModelMatrix;
uniform bool composeModelMatrix;
in vec3 positions;
#ifdef HAS_UV
in vec2 texCoords;
#endif
#ifdef MODULE_PBR
#ifdef HAS_NORMALS
in vec3 normals;
#endif
#endif
out vec4 vColor;
#ifndef MODULE_PBR
#ifdef HAS_UV
out vec2 vTEXCOORD_0;
#endif
#endif
void main(void) {
#if defined(HAS_UV) && !defined(MODULE_PBR)
vTEXCOORD_0 = texCoords;
geometry.uv = texCoords;
#endif
geometry.worldPosition = instancePositions;
geometry.pickingColor = instancePickingColors;
mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
vec3 normal = vec3(0.0, 0.0, 1.0);
#ifdef MODULE_PBR
#ifdef HAS_NORMALS
normal = instanceModelMatrix * (sceneModelMatrix * vec4(normals, 0.0)).xyz;
#endif
#endif
float originalSize = project_size_to_pixel(sizeScale);
float clampedSize = clamp(originalSize, sizeMinPixels, sizeMaxPixels);
vec3 pos = (instanceModelMatrix * (sceneModelMatrix * vec4(positions, 1.0)).xyz) * sizeScale * (clampedSize / originalSize) + instanceTranslation;
if(composeModelMatrix) {
DECKGL_FILTER_SIZE(pos, geometry);
geometry.normal = project_normal(normal);
geometry.worldPosition += pos;
gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
}
else {
pos = project_size(pos);
DECKGL_FILTER_SIZE(pos, geometry);
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, geometry.position);
geometry.normal = project_normal(normal);
}
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
#ifdef MODULE_PBR
pbr_vPosition = geometry.position.xyz;
#ifdef HAS_NORMALS
pbr_vNormal = geometry.normal;
#endif
#ifdef HAS_UV
pbr_vUV = texCoords;
#else
pbr_vUV = vec2(0., 0.);
#endif
geometry.uv = pbr_vUV;
#endif
vColor = instanceColors;
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var Cq=`#version 300 es
#define SHADER_NAME scenegraph-layer-fragment-shader
uniform float opacity;
in vec4 vColor;
out vec4 fragColor;
#ifndef MODULE_PBR
#if defined(HAS_UV) && defined(HAS_BASECOLORMAP)
in vec2 vTEXCOORD_0;
uniform sampler2D u_BaseColorSampler;
#endif
#endif
void main(void) {
#ifdef MODULE_PBR
fragColor = vColor * pbr_filterColor(vec4(0));
geometry.uv = pbr_vUV;
#else
#if defined(HAS_UV) && defined(HAS_BASECOLORMAP)
fragColor = vColor * texture(u_BaseColorSampler, vTEXCOORD_0);
geometry.uv = vTEXCOORD_0;
#else
fragColor = vColor;
#endif
#endif
fragColor.a *= opacity;
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;var Mq=[255,255,255,255],Zve={scenegraph:{type:"object",value:null,async:!0},getScene:t=>t&&t.scenes?typeof t.scene=="object"?t.scene:t.scenes[t.scene||0]:t,getAnimator:t=>t&&t.animator,_animations:null,sizeScale:{type:"number",value:1,min:0},sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:Mq},_lighting:"flat",_imageBasedLightingEnvironment:void 0,getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},loaders:[Vd]},MC=class extends On{getShaders(){let e=[Jn,go];return this.props._lighting==="pbr"&&e.push(hm),super.getShaders({vs:Sq,fs:Cq,modules:e})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),accessor:"getPosition",transition:!0},instanceColors:{type:"unorm8",size:this.props.colorFormat.length,accessor:"getColor",defaultValue:Mq,transition:!0},instanceModelMatrix:aC})}updateState(e){super.updateState(e);let{props:r,oldProps:i}=e;r.scenegraph!==i.scenegraph?this._updateScenegraph():r._animations!==i._animations&&this._applyAnimationsProp(this.state.animator,r._animations)}finalizeState(e){super.finalizeState(e),this.state.scenegraph?.destroy()}get isLoaded(){return Boolean(this.state?.scenegraph&&super.isLoaded)}_updateScenegraph(){let e=this.props,{device:r}=this.context,i=null;if(e.scenegraph instanceof Vu)i={scenes:[e.scenegraph]};else if(e.scenegraph&&typeof e.scenegraph=="object"){let l=e.scenegraph,u=l.json?cg(l):l,h=KD(r,u,this._getModelOptions());i={gltf:u,...h},Eq(h).then(()=>{this.setNeedsRedraw()}).catch(v=>{this.raiseError(v,"loading glTF")})}let n={layer:this,device:this.context.device},o=e.getScene(i,n),s=e.getAnimator(i,n);if(o instanceof Qc){this.state.scenegraph?.destroy(),this._applyAnimationsProp(s,e._animations);let l=[];o.traverse(u=>{u instanceof Ih&&l.push(u.model)}),this.setState({scenegraph:o,animator:s,models:l}),this.getAttributeManager().invalidateAll()}else o!==null&&ur.warn("invalid scenegraph:",o)()}_applyAnimationsProp(e,r){if(!e||!r)return;let i=e.getAnimations();Object.keys(r).sort().forEach(n=>{let o=r[n];if(n==="*")i.forEach(s=>{Object.assign(s,o)});else if(Number.isFinite(Number(n))){let s=Number(n);s>=0&&s<i.length?Object.assign(i[s],o):ur.warn(`animation ${n} not found`)()}else{let s=i.find(({name:l})=>l===n);s?Object.assign(s,o):ur.warn(`animation ${n} not found`)()}})}_getModelOptions(){let{_imageBasedLightingEnvironment:e}=this.props,r;return e&&(typeof e=="function"?r=e({gl:this.context.gl,layer:this}):r=e),{imageBasedLightingEnvironment:r,modelOptions:{id:this.props.id,isInstanced:!0,bufferLayout:this.getAttributeManager().getBufferLayouts(),...this.getShaders()},useTangents:!1}}draw({context:e}){if(!this.state.scenegraph)return;this.props._animations&&this.state.animator&&(this.state.animator.animate(e.timeline.getTime()),this.setNeedsRedraw());let{viewport:r,renderPass:i}=this.context,{sizeScale:n,sizeMinPixels:o,sizeMaxPixels:s,opacity:l,coordinateSystem:u}=this.props,h=this.getNumInstances();this.state.scenegraph.traverse((v,{worldMatrix:T})=>{if(v instanceof Ih){let{model:E}=v;E.setInstanceCount(h),E.setUniforms({sizeScale:n,opacity:l,sizeMinPixels:o,sizeMaxPixels:s,composeModelMatrix:lC(r,u),sceneModelMatrix:T,u_Camera:E.uniforms.cameraPosition}),E.draw(i)}})}},ug=MC;(()=>{MC.defaultProps=Zve})(),(()=>{MC.layerName="ScenegraphLayer"})();var Iq=`#version 300 es
#define SHADER_NAME simple-mesh-layer-vs
uniform float sizeScale;
uniform bool composeModelMatrix;
uniform bool pickFeatureIds;
in vec3 positions;
in vec3 normals;
in vec3 colors;
in vec2 texCoords;
in vec4 uvRegions;
in vec3 featureIdsPickingColors;
in vec4 instanceColors;
in vec3 instancePickingColors;
in vec3 instanceModelMatrixCol0;
in vec3 instanceModelMatrixCol1;
in vec3 instanceModelMatrixCol2;
out vec2 vTexCoord;
out vec3 cameraPosition;
out vec3 normals_commonspace;
out vec4 position_commonspace;
out vec4 vColor;
vec2 applyUVRegion(vec2 uv) {
#ifdef HAS_UV_REGIONS
return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;
#else
return uv;
#endif
}
void main(void) {
vec2 uv = applyUVRegion(texCoords);
geometry.uv = uv;
if (pickFeatureIds) {
geometry.pickingColor = featureIdsPickingColors;
} else {
geometry.pickingColor = instancePickingColors;
}
mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
vTexCoord = uv;
cameraPosition = project.cameraPosition;
vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
vec3 pos = (instanceModelMatrix * positions) * sizeScale;
vec3 projectedPosition = project_position(positions);
position_commonspace = vec4(projectedPosition, 1.0);
gl_Position = project_common_position_to_clipspace(position_commonspace);
geometry.position = position_commonspace;
normals_commonspace = project_normal(instanceModelMatrix * normals);
geometry.normal = normals_commonspace;
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
#ifdef MODULE_PBR
pbr_vPosition = geometry.position.xyz;
#ifdef HAS_NORMALS
pbr_vNormal = geometry.normal;
#endif
#ifdef HAS_UV
pbr_vUV = uv;
#else
pbr_vUV = vec2(0., 0.);
#endif
geometry.uv = pbr_vUV;
#endif
DECKGL_FILTER_COLOR(vColor, geometry);
}
`;var Pq=`#version 300 es
#define SHADER_NAME simple-mesh-layer-fs
precision highp float;
uniform bool hasTexture;
uniform sampler2D sampler;
uniform bool flatShading;
uniform float opacity;
in vec2 vTexCoord;
in vec3 cameraPosition;
in vec3 normals_commonspace;
in vec4 position_commonspace;
in vec4 vColor;
out vec4 fragColor;
void main(void) {
#ifdef MODULE_PBR
fragColor = vColor * pbr_filterColor(vec4(0));
geometry.uv = pbr_vUV;
fragColor.a *= opacity;
#else
geometry.uv = vTexCoord;
vec3 normal;
if (flatShading) {
normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
} else {
normal = normals_commonspace;
}
vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;
vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
fragColor = vec4(lightColor, color.a * opacity);
#endif
DECKGL_FILTER_COLOR(fragColor, geometry);
}
`;function Jve(t){let e=t.positions||t.POSITION,r=e.value.length/e.size;t.COLOR_0||t.colors||(t.colors={size:4,value:new Uint8Array(r*4).fill(255),normalized:!0})}var Qve={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},IC=class extends Nh{getShaders(){let e=super.getShaders();return e.modules.push(hm),{...e,vs:Iq,fs:Pq}}initializeState(){let{featureIds:e}=this.props;super.initializeState();let r=this.getAttributeManager();e&&r.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(e){super.updateState(e);let{props:r,oldProps:i}=e;r.pbrMaterial!==i.pbrMaterial&&this.updatePbrMaterialUniforms(r.pbrMaterial)}draw(e){let{featureIds:r}=this.props;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.uniforms.cameraPosition,pickFeatureIds:Boolean(r)}),super.draw(e))}getModel(e){let{id:r,pbrMaterial:i}=this.props,n=this.parseMaterial(i,e);this.setState({parsedPBRMaterial:n});let o=this.getShaders();return Jve(e.attributes),new Ni(this.context.device,{...this.getShaders(),id:r,geometry:e,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...o.defines,...n?.defines,HAS_UV_REGIONS:e.attributes.uvRegions?1:0},parameters:n?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(e){let{model:r}=this.state;if(r){let{mesh:i}=this.props,n=this.parseMaterial(e,i);this.setState({parsedPBRMaterial:n}),r.setBindings(n.bindings),r.setUniforms(n.uniforms)}}parseMaterial(e,r){let i=Boolean(e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture);return Mb(this.context.device,{unlit:i,...e},{NORMAL:r.attributes.normals,TEXCOORD_0:r.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(e){let r=this.props.featureIds,i=new Uint8ClampedArray(r.length*e.size),n=[];for(let o=0;o<r.length;o++)this.encodePickingColor(r[o],n),i[o*3]=n[0],i[o*3+1]=n[1],i[o*3+2]=n[2];e.value=i}finalizeState(e){super.finalizeState(e),this.state.parsedPBRMaterial?.generatedTextures.forEach(r=>r.destroy()),this.setState({parsedPBRMaterial:null})}},Db=IC;(()=>{IC.layerName="MeshLayer"})(),(()=>{IC.defaultProps=Qve})();var Hd=6356752314245179e-9,$ve={radii:[6378137,6378137,Hd],radiiSquared:[6378137*6378137,6378137*6378137,Hd*Hd],oneOverRadii:[1/6378137,1/6378137,1/Hd],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Hd*Hd)],maximumRadius:Math.max(6378137,6378137,Hd),centerToleranceSquared:.1};function PC(t){return t}var fst=new ot;function exe(t,e=[],r=PC){return"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):"x"in t?(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function Rq(t,e=[]){return exe(t,e,Do._cartographicRadians?PC:JR)}function txe(t,e,r=PC){return"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):"x"in e?(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function Bq(t,e){return txe(t,e,Do._cartographicRadians?PC:QR)}var Oq=1e-14,rxe=new ot,Dq={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},xL={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Lb={east:new ot,north:new ot,up:new ot,west:new ot,south:new ot,down:new ot},ixe=new ot,nxe=new ot,oxe=new ot;function bL(t,e,r,i,n,o){let s=Dq[e]&&Dq[e][r];Ja(s&&(!i||i===s));let l,u,h,v=rxe.copy(n);if(Cs(v.x,0,Oq)&&Cs(v.y,0,Oq)){let E=Math.sign(v.z);l=ixe.fromArray(xL[e]),e!=="east"&&e!=="west"&&l.scale(E),u=nxe.fromArray(xL[r]),r!=="east"&&r!=="west"&&u.scale(E),h=oxe.fromArray(xL[i]),i!=="east"&&i!=="west"&&h.scale(E)}else{let{up:E,east:M,north:O}=Lb;M.set(-v.y,v.x,0).normalize(),t.geodeticSurfaceNormal(v,E),O.copy(E).cross(M);let{down:F,west:z,south:W}=Lb;F.copy(E).scale(-1),z.copy(M).scale(-1),W.copy(O).scale(-1),l=Lb[e],u=Lb[r],h=Lb[i]}return o[0]=l.x,o[1]=l.y,o[2]=l.z,o[3]=0,o[4]=u.x,o[5]=u.y,o[6]=u.z,o[7]=0,o[8]=h.x,o[9]=h.y,o[10]=h.z,o[11]=0,o[12]=v.x,o[13]=v.y,o[14]=v.z,o[15]=1,o}var J_=new ot,sxe=new ot,axe=new ot;function Lq(t,e,r=[]){let{oneOverRadii:i,oneOverRadiiSquared:n,centerToleranceSquared:o}=e;J_.from(t);let s=J_.x,l=J_.y,u=J_.z,h=i.x,v=i.y,T=i.z,E=s*s*h*h,M=l*l*v*v,O=u*u*T*T,F=E+M+O,z=Math.sqrt(1/F);if(!Number.isFinite(z))return;let W=sxe;if(W.copy(t).scale(z),F<o)return W.to(r);let J=n.x,K=n.y,ne=n.z,ge=axe;ge.set(W.x*J*2,W.y*K*2,W.z*ne*2);let j=(1-z)*J_.len()/(.5*ge.len()),me=0,fe,$,Z,we;do{j-=me,fe=1/(1+j*J),$=1/(1+j*K),Z=1/(1+j*ne);let Oe=fe*fe,he=$*$,Le=Z*Z,ft=Oe*fe,Vt=he*$,Yt=Le*Z;we=E*Oe+M*he+O*Le-1;let Er=-2*(E*ft*J+M*Vt*K+O*Yt*ne);me=we/Er}while(Math.abs(we)>Lu.EPSILON12);return J_.scale([fe,$,Z]).to(r)}var RC=new ot,Fq=new ot,uxe=new ot,Ff=new ot,fxe=new ot,BC=new ot,Nn=class{constructor(e=0,r=0,i=0){this.centerToleranceSquared=Lu.EPSILON1,Ja(e>=0),Ja(r>=0),Ja(i>=0),this.radii=new ot(e,r,i),this.radiiSquared=new ot(e*e,r*r,i*i),this.radiiToTheFourth=new ot(e*e*e*e,r*r*r*r,i*i*i*i),this.oneOverRadii=new ot(e===0?0:1/e,r===0?0:1/r,i===0?0:1/i),this.oneOverRadiiSquared=new ot(e===0?0:1/(e*e),r===0?0:1/(r*r),i===0?0:1/(i*i)),this.minimumRadius=Math.min(e,r,i),this.maximumRadius=Math.max(e,r,i),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(e){return this===e||Boolean(e&&this.radii.equals(e.radii))}toString(){return this.radii.toString()}cartographicToCartesian(e,r=[0,0,0]){let i=Fq,n=uxe,[,,o]=e;this.geodeticSurfaceNormalCartographic(e,i),n.copy(this.radiiSquared).scale(i);let s=Math.sqrt(i.dot(n));return n.scale(1/s),i.scale(o),n.add(i),n.to(r)}cartesianToCartographic(e,r=[0,0,0]){BC.from(e);let i=this.scaleToGeodeticSurface(BC,Ff);if(!i)return;let n=this.geodeticSurfaceNormal(i,Fq),o=fxe;o.copy(BC).subtract(i);let s=Math.atan2(n.y,n.x),l=Math.asin(n.z),u=Math.sign(Da.dot(o,BC))*Da.length(o);return Bq([s,l,u],r)}eastNorthUpToFixedFrame(e,r=new Kr){return bL(this,"east","north","up",e,r)}localFrameToFixedFrame(e,r,i,n,o=new Kr){return bL(this,e,r,i,n,o)}geocentricSurfaceNormal(e,r=[0,0,0]){return RC.from(e).normalize().to(r)}geodeticSurfaceNormalCartographic(e,r=[0,0,0]){let i=Rq(e),n=i[0],o=i[1],s=Math.cos(o);return RC.set(s*Math.cos(n),s*Math.sin(n),Math.sin(o)).normalize(),RC.to(r)}geodeticSurfaceNormal(e,r=[0,0,0]){return RC.from(e).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(e,r){return Lq(e,this,r)}scaleToGeocentricSurface(e,r=[0,0,0]){Ff.from(e);let i=Ff.x,n=Ff.y,o=Ff.z,s=this.oneOverRadiiSquared,l=1/Math.sqrt(i*i*s.x+n*n*s.y+o*o*s.z);return Ff.multiplyScalar(l).to(r)}transformPositionToScaledSpace(e,r=[0,0,0]){return Ff.from(e).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(e,r=[0,0,0]){return Ff.from(e).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(e,r=0,i=[0,0,0]){Ja(Cs(this.radii.x,this.radii.y,Lu.EPSILON15)),Ja(this.radii.z>0),Ff.from(e);let n=Ff.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-r))return Ff.set(0,0,n).to(i)}};Nn.WGS84=new Nn(6378137,6378137,Hd);var OC=class{item;previous;next;constructor(e,r,i){this.item=e,this.previous=r,this.next=i}};var DC=class{head=null;tail=null;_length=0;get length(){return this._length}add(e){let r=new OC(e,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}splice(e,r){e!==r&&(this.remove(r),this._insert(e,r))}_insert(e,r){let i=e.next;e.next=r,this.tail===e?this.tail=r:i.previous=r,r.next=i,r.previous=e,++this._length}};var LC=class{_list;_sentinel;_trimTiles;constructor(){this._list=new DC,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(e){let r=e._cacheNode;r&&this._list.splice(this._sentinel,r)}add(e,r,i){r._cacheNode||(r._cacheNode=this._list.add(r),i&&i(e,r))}unloadTile(e,r,i){let n=r._cacheNode;n&&(this._list.remove(n),r._cacheNode=null,i&&i(e,r))}unloadTiles(e,r){let i=this._trimTiles;this._trimTiles=!1;let n=this._list,o=e.maximumMemoryUsage*1024*1024,s=this._sentinel,l=n.head;for(;l!==s&&(e.gpuMemoryUsageInBytes>o||i);){let u=l.item;l=l.next,this.unloadTile(e,u,r)}}trim(){this._trimTiles=!0}};function Nq(t,e){Bn(t),Bn(e);let{rtcCenter:r,gltfUpAxis:i}=e,{computedTransform:n,boundingVolume:{center:o}}=t,s=new Kr(n);switch(r&&s.translate(r),i){case"Z":break;case"Y":let T=new Kr().rotateX(Math.PI/2);s=s.multiplyRight(T);break;case"X":let E=new Kr().rotateY(-Math.PI/2);s=s.multiplyRight(E);break;default:break}e.isQuantized&&s.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);let l=new ot(o);e.cartesianModelMatrix=s,e.cartesianOrigin=l;let u=Nn.WGS84.cartesianToCartographic(l,new ot),v=Nn.WGS84.eastNorthUpToFixedFrame(l).invert();e.cartographicModelMatrix=v.multiplyRight(s),e.cartographicOrigin=u,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}var kq=new ot,wL=new ot,TL=new wa([new $a,new $a,new $a,new $a,new $a,new $a]);function zq(t,e){let{cameraDirection:r,cameraUp:i,height:n}=t,{metersPerUnit:o}=t.distanceScales,s=FC(t,t.center),l=Nn.WGS84.eastNorthUpToFixedFrame(s),u=t.unprojectPosition(t.cameraPosition),h=Nn.WGS84.cartographicToCartesian(u,new ot),v=new ot(l.transformAsVector(new ot(r).scale(o))).normalize(),T=new ot(l.transformAsVector(new ot(i).scale(o))).normalize();hxe(t);let E=t.constructor,{longitude:M,latitude:O,width:F,bearing:z,zoom:W}=t,J=new E({longitude:M,latitude:O,height:n,width:F,bearing:z,zoom:W,pitch:0});return{camera:{position:h,direction:v,up:T},viewport:t,topDownViewport:J,height:n,cullingVolume:TL,frameNumber:e,sseDenominator:1.15}}function Vq(t,e,r){if(r===0||t.length<=r)return[t,[]];let i=[],{longitude:n,latitude:o}=e.viewport;for(let[h,v]of t.entries()){let[T,E]=v.header.mbs,M=Math.abs(n-T),O=Math.abs(o-E),F=Math.sqrt(O*O+M*M);i.push([h,F])}let s=i.sort((h,v)=>h[1]-v[1]),l=[];for(let h=0;h<r;h++)l.push(t[s[h][0]]);let u=[];for(let h=r;h<s.length;h++)u.push(t[s[h][0]]);return[l,u]}function hxe(t){let e=t.getFrustumPlanes(),r=Uq(e.near,t.cameraPosition),i=FC(t,r),n=FC(t,t.cameraPosition,wL),o=0;TL.planes[o++].fromPointNormal(i,kq.copy(i).subtract(n));for(let s in e){if(s==="near")continue;let l=e[s],u=Uq(l,r,wL),h=FC(t,u,wL);TL.planes[o++].fromPointNormal(h,kq.copy(i).subtract(h))}}function Uq(t,e,r=new ot){let i=t.normal.dot(e);return r.copy(t.normal).scale(t.distance-i).add(e),r}function FC(t,e,r=new ot){let i=t.unprojectPosition(e);return Nn.WGS84.cartographicToCartesian(i,r)}var dxe=6378137,pxe=6378137,EL=6356752314245179e-9,Q_=new ot;function Hq(t,e){if(t instanceof Df){let{halfAxes:r}=t,i=Axe(r);return Math.log2(EL/(i+e[2]))}else if(t instanceof Gu){let{radius:r}=t;return Math.log2(EL/(r+e[2]))}else if(t.width&&t.height){let{width:r,height:i}=t,n=Math.log2(dxe/r),o=Math.log2(pxe/i);return(n+o)/2}return 1}function SL(t,e,r){Nn.WGS84.cartographicToCartesian([t.xmax,t.ymax,t.zmax],Q_);let i=Math.sqrt(Math.pow(Q_[0]-r[0],2)+Math.pow(Q_[1]-r[1],2)+Math.pow(Q_[2]-r[2],2));return Math.log2(EL/(i+e[2]))}function jq(t,e,r){let[i,n,o,s]=t;return SL({xmin:i,xmax:o,ymin:n,ymax:s,zmin:0,zmax:0},e,r)}function Axe(t){t.getColumn(0,Q_);let e=t.getColumn(1),r=t.getColumn(2);return Q_.add(e).add(r).len()}var nc={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Ul;(function(t){t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE"})(Ul||(Ul={}));var qu;(function(t){t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh"})(qu||(qu={}));var el;(function(t){t.I3S="I3S",t.TILES3D="TILES3D"})(el||(el={}));var jd;(function(t){t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(jd||(jd={}));var Gq={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function Yq(t){return t!=null}var zl=new ot,NC=new ot,mxe=new ot,gxe=new ot,fg=new ot,Wq=new ot,qq=new ot,Xq=new ot;function kC(t,e,r){if(Bn(t,"3D Tile: boundingVolume must be defined"),t.box)return Zq(t.box,e,r);if(t.region)return yxe(t.region);if(t.sphere)return _xe(t.sphere,e,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Kq(t,e){if(t.box)return vxe(e);if(t.region){let[r,i,n,o,s,l]=t.region;return[[va(r),va(i),s],[va(n),va(o),l]]}if(t.sphere)return xxe(e);throw new Error("Unkown boundingVolume type")}function Zq(t,e,r){let i=new ot(t[0],t[1],t[2]);e.transform(i,i);let n=[];if(t.length===10){let h=t.slice(3,6),v=new Du;v.fromArray(t,6);let T=new ot([1,0,0]),E=new ot([0,1,0]),M=new ot([0,0,1]);T.transformByQuaternion(v),T.scale(h[0]),E.transformByQuaternion(v),E.scale(h[1]),M.transformByQuaternion(v),M.scale(h[2]),n=[...T.toArray(),...E.toArray(),...M.toArray()]}else n=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];let o=e.transformAsVector(n.slice(0,3)),s=e.transformAsVector(n.slice(3,6)),l=e.transformAsVector(n.slice(6,9)),u=new mo([o[0],o[1],o[2],s[0],s[1],s[2],l[0],l[1],l[2]]);return Yq(r)?(r.center=i,r.halfAxes=u,r):new Df(i,u)}function _xe(t,e,r){let i=new ot(t[0],t[1],t[2]);e.transform(i,i);let n=e.getScale(NC),o=Math.max(Math.max(n[0],n[1]),n[2]),s=t[3]*o;return Yq(r)?(r.center=i,r.radius=s,r):new Gu(i,s)}function yxe(t){let[e,r,i,n,o,s]=t,l=Nn.WGS84.cartographicToCartesian([va(e),va(n),o],mxe),u=Nn.WGS84.cartographicToCartesian([va(i),va(r),s],gxe),h=new ot().addVectors(l,u).multiplyByScalar(.5);return Nn.WGS84.cartesianToCartographic(h,fg),Nn.WGS84.cartographicToCartesian([va(i),fg[1],fg[2]],Wq),Nn.WGS84.cartographicToCartesian([fg[0],va(n),fg[2]],qq),Nn.WGS84.cartographicToCartesian([fg[0],fg[1],s],Xq),Zq([...h,...Wq.subtract(h),...qq.subtract(h),...Xq.subtract(h)],new Kr)}function vxe(t){let e=Jq(),{halfAxes:r}=t,i=new ot(r.getColumn(0)),n=new ot(r.getColumn(1)),o=new ot(r.getColumn(2));for(let s=0;s<2;s++){for(let l=0;l<2;l++){for(let u=0;u<2;u++)zl.copy(t.center),zl.add(i),zl.add(n),zl.add(o),Qq(e,zl),o.negate();n.negate()}i.negate()}return e}function xxe(t){let e=Jq(),{center:r,radius:i}=t,n=Nn.WGS84.scaleToGeodeticSurface(r,zl),o;n?o=Nn.WGS84.geodeticSurfaceNormal(n):o=new ot(0,0,1);let s=new ot(o[2],-o[1],0);s.len()>0?s.normalize():s=new ot(0,1,0);let l=s.clone().cross(o);for(let u of[s,l,o]){NC.copy(u).scale(i);for(let h=0;h<2;h++)zl.copy(r),zl.add(NC),Qq(e,zl),NC.negate()}return e}function Jq(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function Qq(t,e){Nn.WGS84.cartesianToCartographic(e,zl),t[0][0]=Math.min(t[0][0],zl[0]),t[0][1]=Math.min(t[0][1],zl[1]),t[0][2]=Math.min(t[0][2],zl[2]),t[1][0]=Math.max(t[1][0],zl[0]),t[1][1]=Math.max(t[1][1],zl[1]),t[1][2]=Math.max(t[1][2],zl[2])}var Jst=new ot,Qst=new ot,$st=new Kr,eat=new ot,tat=new ot,rat=new ot;function bxe(t,e){let r=t*e;return 1-Math.exp(-(r*r))}function wxe(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){let r=t.dynamicScreenSpaceErrorComputedDensity,i=t.dynamicScreenSpaceErrorFactor;return bxe(e,r)*i}return 0}function $q(t,e,r){let i=t.tileset,n=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,o=r?n:t.lodMetricValue;if(o===0)return 0;let s=Math.max(t._distanceToCamera,1e-7),{height:l,sseDenominator:u}=e,{viewDistanceScale:h}=i.options,v=o*l*(h||1)/(s*u);return v-=wxe(i,s),v}var CL=new ot,eX=new ot,sA=new ot,tX=new ot,Txe=new ot,ML=new Kr,rX=new Kr;function iX(t,e){if(t.lodMetricValue===0||isNaN(t.lodMetricValue))return"DIG";let r=2*IL(t,e);return r<2?"OUT":!t.header.children||r<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}function IL(t,e){let{topDownViewport:r}=e,i=t.header.mbs[1],n=t.header.mbs[0],o=t.header.mbs[2],s=t.header.mbs[3],l=[...t.boundingVolume.center],u=r.unprojectPosition(r.cameraPosition);Nn.WGS84.cartographicToCartesian(u,CL),eX.copy(CL).subtract(l).normalize(),Nn.WGS84.eastNorthUpToFixedFrame(l,ML),rX.copy(ML).invert(),sA.copy(CL).transform(rX);let h=Math.sqrt(sA[0]*sA[0]+sA[1]*sA[1]),v=h*h/sA[2];tX.copy([sA[0],sA[1],v]);let E=tX.transform(ML).subtract(l).normalize(),O=eX.cross(E).normalize().scale(s).add(l),F=Nn.WGS84.cartesianToCartographic(O),z=r.project([n,i,o]),W=r.project(F);return Txe.copy(z).subtract(W).magnitude()}function nX(t){return{assetGltfUpAxis:t.asset&&t.asset.gltfUpAxis||"Y"}}var Fb=class{_map=new Map;_array;_length;constructor(e=0){this._array=new Array(e),this._length=e}get length(){return this._length}set length(e){this._length=e,e>this._array.length&&(this._array.length=e)}get values(){return this._array}get(e){return Bn(e<this._array.length),this._array[e]}set(e,r){Bn(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=r,this._map.set(r,e)}delete(e){let r=this._map.get(e);r>=0&&(this._array.splice(r,1),this._map.delete(e),this.length--)}peek(){return this._array[this._length-1]}push(e){if(!this._map.has(e)){let r=this.length++;this._array[r]=e,this._map.set(e,r)}}pop(){let e=this._array[--this.length];return this._map.delete(e),e}reserve(e){Bn(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){Bn(e>=0),this.length=e}trim(e){e==null&&(e=this.length),this._array.length=e}reset(){this._array=[],this._map=new Map,this._length=0}find(e){return this._map.has(e)}};var Exe={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},kh=class{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Fb;_emptyTraversalStack=new Fb;_frameNumber=null;traversalFinished(e){return!0}constructor(e){this.options={...Exe,...e}}traverse(e,r,i){this.root=e,this.options={...this.options,...i},this.reset(),this.updateTile(e,r),this._frameNumber=r.frameNumber,this.executeTraversal(e,r)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,r){let i=this._traversalStack;for(e._selectionDepth=1,i.push(e);i.length>0;){let o=i.pop(),s=!1;this.canTraverse(o,r)&&(this.updateChildTiles(o,r),s=this.updateAndPushChildren(o,r,i,o.hasRenderContent?o._selectionDepth+1:o._selectionDepth));let l=o.parent,u=Boolean(!l||l._shouldRefine),h=!s;o.hasRenderContent?o.refine===Ul.ADD?(this.loadTile(o,r),this.selectTile(o,r)):o.refine===Ul.REPLACE&&(this.loadTile(o,r),h&&this.selectTile(o,r)):(this.emptyTiles[o.id]=o,this.loadTile(o,r),h&&this.selectTile(o,r)),this.touchTile(o,r),o._shouldRefine=s&&u}let n=new Date().getTime();(this.traversalFinished(r)||n-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=n,this.options.onTraversalEnd(r))}updateChildTiles(e,r){let i=e.children;for(let n of i)this.updateTile(n,r)}updateAndPushChildren(e,r,i,n){let{loadSiblings:o,skipLevelOfDetail:s}=this.options,l=e.children;l.sort(this.compareDistanceToCamera.bind(this));let u=e.refine===Ul.REPLACE&&e.hasRenderContent&&!s,h=!1,v=!0;for(let T of l)if(T._selectionDepth=n,T.isVisibleAndInRequestVolume?(i.find(T)&&i.delete(T),i.push(T),h=!0):(u||o)&&(this.loadTile(T,r),this.touchTile(T,r)),u){let E;if(T._inRequestVolume?T.hasRenderContent?E=T.contentAvailable:E=this.executeEmptyTraversal(T,r):E=!1,v=v&&E,!v)return!1}return h||(v=!1),v}updateTile(e,r){this.updateTileVisibility(e,r)}selectTile(e,r){this.shouldSelectTile(e)&&(e._selectedFrame=r.frameNumber,this.selectedTiles[e.id]=e)}loadTile(e,r){this.shouldLoadTile(e)&&(e._requestedFrame=r.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}touchTile(e,r){e.tileset._cache.touch(e),e._touchedFrame=r.frameNumber}canTraverse(e,r,i=!1,n=!1){return e.hasChildren?e.hasTilesetContent?!e.contentExpired:!n&&!e.isVisibleAndInRequestVolume?!1:this.shouldRefine(e,r,i):!1}shouldLoadTile(e){return e.hasUnloadedContent||e.contentExpired}shouldSelectTile(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(e,r,i=!1){let n=e._screenSpaceError;return i&&(n=e.getScreenSpaceError(r,!0)),n>e.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(e,r){let i=[];if(this.options.viewportTraversersMap)for(let n in this.options.viewportTraversersMap)this.options.viewportTraversersMap[n]===r.viewport.id&&i.push(n);else i.push(r.viewport.id);e.updateVisibility(r,i)}compareDistanceToCamera(e,r){return e._distanceToCamera-r._distanceToCamera}anyChildrenVisible(e,r){let i=!1;for(let n of e.children)n.updateVisibility(r),i=i||n.isVisibleAndInRequestVolume;return i}executeEmptyTraversal(e,r){let i=!0,n=this._emptyTraversalStack;for(n.push(e);n.length>0;){let o=n.pop(),s=!o.hasRenderContent&&this.canTraverse(o,r,!1,!1),l=!o.hasRenderContent&&o.children.length===0;if(!s&&!o.contentAvailable&&!l&&(i=!1),this.updateTile(o,r),o.isVisibleAndInRequestVolume||(this.loadTile(o,r),this.touchTile(o,r)),s){let u=o.children;for(let h of u)n.push(h)}}return i}};var oX=new ot;function Sxe(t){return t!=null}var hg=class{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=nc.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new Kr;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new kh({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new Kr;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;constructor(e,r,i,n=""){this.header=r,this.tileset=e,this.id=n||r.id,this.url=r.url,this.parent=i,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this._initializeLodMetric(r),this._initializeTransforms(r),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===nc.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===nc.UNLOADED}get contentExpired(){return this.contentState===nc.EXPIRED}get contentFailed(){return this.contentState===nc.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=Kq(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(e,r){switch(this.tileset.type){case el.I3S:return IL(this,e);case el.TILES3D:return $q(this,e,r);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let e=this.tileset._traverser,{skipLevelOfDetail:r}=e.options,i=this.refine===Ul.ADD||r;if(i&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===nc.UNLOADED)return-1;let n=this.parent,s=n&&(!i||this._screenSpaceError===0||n.hasTilesetContent)?n._screenSpaceError:this._screenSpaceError,l=e.root?e.root._screenSpaceError:0;return Math.max(l-s,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=nc.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=nc.UNLOADED,!1;try{let i=this.tileset.getTileUrl(this.contentUrl),n=this.tileset.loader,o={...this.tileset.loadOptions,[n.id]:{...this.tileset.loadOptions[n.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(n.id)}};return this.content=await _a(i,n,o),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=nc.READY,this._onContentLoaded(),!0}catch(i){throw this.contentState=nc.FAILED,i}finally{r.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=nc.UNLOADED,!0}updateVisibility(e,r){if(this._frameNumber===e.frameNumber)return;let i=this.parent,n=i?i._visibilityPlaneMask:wa.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=i?i.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,n),this._visible=this._visibilityPlaneMask!==wa.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=r}visibility(e,r){let{cullingVolume:i}=e,{boundingVolume:n}=this;return i.computeVisibilityWithPlaneMask(n,r)}contentVisibility(){return!0}distanceToTile(e){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(e.camera.position),0))}cameraSpaceZDepth({camera:e}){let r=this.boundingVolume;return oX.subVectors(r.center,e.position),e.direction.dot(oX)}insideViewerRequestVolume(e){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(Sxe(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=nc.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(e){"lodMetricType"in e?this.lodMetricType=e.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in e?this.lodMetricValue=e.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(e){this.transform=e.transform?new Kr(e.transform):new Kr;let r=this.parent,i=this.tileset,n=r&&r.computedTransform?r.computedTransform.clone():i.modelMatrix.clone();this.computedTransform=new Kr(n).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new Kr;this._initialTransform=new Kr(o).multiplyRight(this.transform)}_initializeBoundingVolumes(e){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(e)}_initializeContent(e){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=nc.UNLOADED,this.hasTilesetContent=!1,e.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(e){this.depth=e.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=wa.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(e){return e||this.parent&&this.parent.refine||Ul.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(e){this.boundingVolume=kC(e.boundingVolume,this.computedTransform,this.boundingVolume);let r=e.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=kC(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=kC(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(e=new Kr){let r=e.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(e){switch(e){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return nX(this.tileset.tileset)}}};var UC=class extends kh{compareDistanceToCamera(e,r){return r._distanceToCamera===0&&e._distanceToCamera===0?r._centerZDepth-e._centerZDepth:r._distanceToCamera-e._distanceToCamera}updateTileVisibility(e,r){if(super.updateTileVisibility(e,r),!e.isVisibleAndInRequestVolume)return;let i=e.children.length>0;if(e.hasTilesetContent&&i){let s=e.children[0];this.updateTileVisibility(s,r),e._visible=s._visible;return}if(this.meetsScreenSpaceErrorEarly(e,r)){e._visible=!1;return}let n=e.refine===Ul.REPLACE,o=e._optimChildrenWithinParent===Gq.USE_OPTIMIZATION;if(n&&o&&i&&!this.anyChildrenVisible(e,r)){e._visible=!1;return}}meetsScreenSpaceErrorEarly(e,r){let{parent:i}=e;return!i||i.hasTilesetContent||i.refine!==Ul.ADD?!1:!this.shouldRefine(e,r,!0)}};var zC=class{frameNumberMap=new Map;register(e,r){let i=this.frameNumberMap.get(e)||new Map,n=i.get(r)||0;i.set(r,n+1),this.frameNumberMap.set(e,i)}deregister(e,r){let i=this.frameNumberMap.get(e);if(!i)return;let n=i.get(r)||1;i.set(r,n-1)}isZero(e,r){return(this.frameNumberMap.get(e)?.get(r)||0)===0}};var PL={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},VC=class{_statusMap;pendingTilesRegister=new zC;constructor(){this._statusMap={}}add(e,r,i,n){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:s}}=n;this._statusMap[r]={request:e,callback:i,key:r,frameState:n,status:PL.REQUESTED},this.pendingTilesRegister.register(s,o),e().then(l=>{this._statusMap[r].status=PL.COMPLETED;let{frameNumber:u,viewport:{id:h}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(h,u),this._statusMap[r].callback(l,n)}).catch(l=>{this._statusMap[r].status=PL.ERROR;let{frameNumber:u,viewport:{id:h}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(h,u),i(l)})}}update(e,r){if(this._statusMap[e]){let{frameNumber:i,viewport:{id:n}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(n,i);let{frameNumber:o,viewport:{id:s}}=r;this.pendingTilesRegister.register(s,o),this._statusMap[e].frameState=r}}find(e){return this._statusMap[e]}hasPendingTiles(e,r){return!this.pendingTilesRegister.isZero(e,r)}};var HC=class extends kh{_tileManager;constructor(e){super(e),this._tileManager=new VC}traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}shouldRefine(e,r){return e._lodJudge=iX(e,r),e._lodJudge==="DIG"}updateChildTiles(e,r){let i=e.header.children||[],n=e.children,o=e.tileset;for(let s of i){let l=`${s.id}-${r.viewport.id}`,u=n&&n.find(h=>h.id===l);if(u)u&&this.updateTile(u,r);else{let h=()=>this._loadTile(s.id,o);this._tileManager.find(l)?this._tileManager.update(l,r):(o.tileset.nodePages&&(h=()=>o.tileset.nodePagesTile.formTileFromNodePages(s.id)),this._tileManager.add(h,l,T=>this._onTileLoad(T,e,l),r))}}return!1}async _loadTile(e,r){let{loader:i}=r,n=r.getTileUrl(`${r.url}/nodes/${e}`),o={...r.loadOptions,i3s:{...r.loadOptions.i3s,isTileHeader:!0}};return await _a(n,i,o)}_onTileLoad(e,r,i){let n=new hg(r.tileset,e,r,i);r.children.push(n);let o=this._tileManager.find(n.id).frameState;this.updateTile(n,o),this._frameNumber===o.frameNumber&&(this.traversalFinished(o)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(n,o)}};var Cxe={description:"",ellipsoid:Nn.WGS84,modelMatrix:new Kr,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},jC="Tiles In Tileset(s)",RL="Tiles In Memory",sX="Tiles In View",aX="Tiles To Render",lX="Tiles Loaded",BL="Tiles Loading",cX="Tiles Unloaded",uX="Failed Tile Loads",fX="Points/Vertices",OL="Tile Memory Use",hX="Maximum Screen Space Error",Nb=class{options;loadOptions;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};description="";properties;extras=null;attributions={};credits={};stats;contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1};cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;maximumMemoryUsage=32;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=0;_cacheOverflowBytes=0;_frameNumber=0;_queryParams={};_extensionsUsed=[];_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_traverser;_cache=new LC;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(e,r){this.options={...Cxe,...r},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||Xc.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=e.lodMetricType,this.lodMetricValue=e.lodMetricValue,this.refine=e.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new vp({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=this.options.maximumMemoryUsage*1024*1024,this._cacheOverflowBytes=this.options.memoryCacheOverflow*1024*1024,this.stats=new Dl({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(e)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(e){this.options={...this.options,...e}}getTileUrl(e){if(e.startsWith("data:"))return e;let i=e;return this.queryParams.length&&(i=`${e}${e.includes("?")?"&":"?"}${this.queryParams}`),i}hasExtension(e){return Boolean(this._extensionsUsed.indexOf(e)>-1)}update(e=null){this.tilesetInitializationPromise.then(()=>{!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e&&this.doUpdate(e)})}async selectTiles(e=null){return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(e){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=e instanceof Array?e:[e];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let i=[];for(let n of r){let o=n.id;this._needTraverse(o)?i.push(o):this.traverseCounter--}for(let n of r){let o=n.id;if(this.roots[o]||(this.roots[o]=this._initializeTileHeaders(this.tileset,null)),!i.includes(o))continue;let s=zq(n,this._frameNumber);this._traverser.traverse(this.roots[o],s,this.options)}}_needTraverse(e){let r=e;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[e]),r===e}_onTraversalEnd(e){let r=e.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let i=this.frameStateData[r],n=Object.values(this._traverser.selectedTiles),[o,s]=Vq(n,e,this.options.maximumTilesSelected);i.selectedTiles=o;for(let l of s)l.unselect();i._requestedTiles=Object.values(this._traverser.requestedTiles),i._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let e in this.frameStateData){let r=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(r.selectedTiles),this._requestedTiles=this._requestedTiles.concat(r._requestedTiles),this._emptyTiles=this._emptyTiles.concat(r._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let e of this.selectedTiles)this._tiles[e.id]=e;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(e,r){if(e.length!==r.length)return!0;let i=new Set(e.map(s=>s.id)),n=new Set(r.map(s=>s.id)),o=e.filter(s=>!n.has(s.id)).length>0;return o=o||r.filter(s=>!i.has(s.id)).length>0,o}_loadTiles(){for(let e of this._requestedTiles)e.contentUnloaded&&this._loadTile(e)}_unloadTiles(){this._cache.unloadTiles(this,(e,r)=>e._unloadTile(r))}_updateStats(){let e=0,r=0;for(let i of this.selectedTiles)i.contentAvailable&&i.content&&(e++,i.content.pointCount?r+=i.content.pointCount:r+=i.content.vertexCount);this.stats.get(sX).count=this.selectedTiles.length,this.stats.get(aX).count=e,this.stats.get(fX).count=r,this.stats.get(hX).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(e){this.type===el.I3S&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===el.TILES3D&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===el.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){let e=this.tileset.fullExtent;if(e){let{xmin:i,xmax:n,ymin:o,ymax:s,zmin:l,zmax:u}=e;this.cartographicCenter=new ot(i+(n-i)/2,o+(s-o)/2,l+(u-l)/2),this.cartesianCenter=new ot,Nn.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=SL(e,this.cartographicCenter,this.cartesianCenter);return}let r=this.tileset.store?.extent;if(r){let[i,n,o,s]=r;this.cartographicCenter=new ot(i+(o-i)/2,n+(s-n)/2,0),this.cartesianCenter=new ot,Nn.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=jq(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new ot,this.zoom=1}calculateViewPropsTiles3D(){let e=this.root,{center:r}=e.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new ot,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?(this.cartographicCenter=new ot,Nn.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new ot(0,0,-Nn.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=Hq(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(jC),this.stats.get(BL),this.stats.get(RL),this.stats.get(sX),this.stats.get(aX),this.stats.get(lX),this.stats.get(cX),this.stats.get(uX),this.stats.get(fX),this.stats.get(OL,"memory"),this.stats.get(hX)}_initializeTileHeaders(e,r){let i=new hg(this,e.root,r);if(r&&(r.children.push(i),i.depth=r.depth+1),this.type===el.TILES3D){let n=[];for(n.push(i);n.length>0;){let o=n.pop();this.stats.get(jC).incrementCount();let s=o.header.children||[];for(let l of s){let u=new hg(this,l,o);if(u.contentUrl?.includes("?session=")){let v=new URL(u.contentUrl).searchParams.get("session");v&&(this._queryParams.session=v)}o.children.push(u),u.depth=o.depth+1,n.push(u)}}}return i}_initializeTraverser(){let e;switch(this.type){case el.TILES3D:e=UC;break;case el.I3S:e=HC;break;default:e=kh}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(e){this._destroySubtree(e)}async _loadTile(e){let r;try{this._onStartTileLoading(),r=await e.loadContent()}catch(i){this._onTileLoadError(e,i instanceof Error?i:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(e,r)}}_onTileLoadError(e,r){this.stats.get(uX).incrementCount();let i=r.message||r.toString(),n=e.url;console.error(`A 3D tile failed to load: ${e.url} ${i}`),this.options.onTileError(e,i,n)}_onTileLoad(e,r){if(r){if(this.type===el.I3S){let i=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(jC).reset(),this.stats.get(jC).addCount(i)}e&&e.content&&Nq(e,e.content),this.updateContentTypes(e),this._addTileToCache(e),this.options.onTileLoad(e)}}updateContentTypes(e){if(this.type===el.I3S)switch(e.header.isDracoGeometry&&(this.contentFormats.draco=!0),e.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===el.TILES3D){let{extensionsRemoved:r=[]}=e.content?.gltf||{};r.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),r.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),r.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(BL).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(BL).decrementCount()}_addTileToCache(e){this._cache.add(this,e,r=>r._updateCacheStats(e))}_updateCacheStats(e){this.stats.get(lX).incrementCount(),this.stats.get(RL).incrementCount(),this.gpuMemoryUsageInBytes+=e.gpuMemoryUsageInBytes||0,this.stats.get(OL).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.gpuMemoryUsageInBytes||0,this.stats.get(RL).decrementCount(),this.stats.get(cX).incrementCount(),this.stats.get(OL).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}_destroy(){let e=[];for(this.root&&e.push(this.root);e.length>0;){let r=e.pop();for(let i of r.children)e.push(i);this._destroyTile(r)}this.root=null}_destroySubtree(e){let r=e,i=[];for(i.push(r);i.length>0;){e=i.pop();for(let n of e.children)i.push(n);e!==r&&this._destroyTile(e)}r.children=[]}_destroyTile(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}_initializeTiles3DTileset(e){if(e.queryString){let r=new URLSearchParams(e.queryString),i=Object.fromEntries(r.entries());this._queryParams={...this._queryParams,...i}}if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=e.properties,this.geometricError=e.geometricError,this._extensionsUsed=e.extensionsUsed||[],this.extras=e.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var GC="4.2.0-beta.2";var dg={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},$at=Object.keys(dg);function DL(t,e,r){Bn(t instanceof ArrayBuffer);let i=new TextDecoder("utf8"),n=new Uint8Array(t,e,r);return i.decode(n)}function dX(t,e=0){let r=new DataView(t);return`${String.fromCharCode(r.getUint8(e+0))}${String.fromCharCode(r.getUint8(e+1))}${String.fromCharCode(r.getUint8(e+2))}${String.fromCharCode(r.getUint8(e+3))}`}var Mxe={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},aa={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Tn={...Mxe,...aa};var LL={[aa.DOUBLE]:Float64Array,[aa.FLOAT]:Float32Array,[aa.UNSIGNED_SHORT]:Uint16Array,[aa.UNSIGNED_INT]:Uint32Array,[aa.UNSIGNED_BYTE]:Uint8Array,[aa.BYTE]:Int8Array,[aa.SHORT]:Int16Array,[aa.INT]:Int32Array},Ixe={DOUBLE:aa.DOUBLE,FLOAT:aa.FLOAT,UNSIGNED_SHORT:aa.UNSIGNED_SHORT,UNSIGNED_INT:aa.UNSIGNED_INT,UNSIGNED_BYTE:aa.UNSIGNED_BYTE,BYTE:aa.BYTE,SHORT:aa.SHORT,INT:aa.INT},FL="Failed to convert GL type",Vl=class{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(let r in LL)if(LL[r]===e)return r;throw new Error(FL)}static fromName(e){let r=Ixe[e];if(!r)throw new Error(FL);return r}static getArrayType(e){switch(e){case aa.UNSIGNED_SHORT_5_6_5:case aa.UNSIGNED_SHORT_4_4_4_4:case aa.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=LL[e];if(!r)throw new Error(FL);return r}}static getByteSize(e){return Vl.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(Vl.getArrayType(e))}static createTypedArray(e,r,i=0,n){n===void 0&&(n=(r.byteLength-i)/Vl.getByteSize(e));let o=Vl.getArrayType(e);return new o(r,i,n)}};function pX(t,e){if(!t)throw new Error(`math.gl assertion failed. ${e}`)}function NL(t,e=[0,0,0]){let r=t>>11&31,i=t>>5&63,n=t&31;return e[0]=r<<3,e[1]=i<<2,e[2]=n<<3,e}var ult=1/256;var flt=new _f,hlt=new ot,dlt=new _f,plt=new _f,Alt=new Uint8Array(1);function AX(t,e=255){return Zn(t,0,e)/e*2-1}function mX(t){return t<0?-1:1}function gX(t,e,r,i){if(pX(i),t<0||t>r||e<0||e>r)throw new Error(`x and y must be unsigned normalized integers between 0 and ${r}`);if(i.x=AX(t,r),i.y=AX(e,r),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){let n=i.x;i.x=(1-Math.abs(i.y))*mX(n),i.y=(1-Math.abs(n))*mX(i.y)}return i.normalize()}function kL(t,e,r){return gX(t,e,255,r)}var Gd=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(e,r){this.json=e,this.buffer=r}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return Boolean(this.json[e])}getGlobalProperty(e,r=Tn.UNSIGNED_INT,i=1){let n=this.json[e];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(e,r,i,1,n.byteOffset):n}getPropertyArray(e,r,i){let n=this.json[e];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(r=Vl.fromName(n.componentType)),this._getTypedArrayFromBinary(e,r,i,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(e,r,n)}getProperty(e,r,i,n,o){let s=this.json[e];if(!s)return s;let l=this.getPropertyArray(e,r,i);if(i===1)return l[n];for(let u=0;u<i;++u)o[u]=l[i*n+u];return o}_getTypedArrayFromBinary(e,r,i,n,o){let s=this._cachedTypedArrays,l=s[e];return l||(l=Vl.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+o,n*i),s[e]=l),l}_getTypedArrayFromArray(e,r,i){let n=this._cachedTypedArrays,o=n[e];return o||(o=Vl.createTypedArray(r,i),n[e]=o),o}};var Pxe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Rxe={SCALAR:(t,e)=>t[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},Bxe={SCALAR:(t,e,r)=>{e[r]=t},VEC2:(t,e,r)=>{e[2*r+0]=t[0],e[2*r+1]=t[1]},VEC3:(t,e,r)=>{e[3*r+0]=t[0],e[3*r+1]=t[1],e[3*r+2]=t[2]},VEC4:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT2:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT3:(t,e,r)=>{e[9*r+0]=t[0],e[9*r+1]=t[1],e[9*r+2]=t[2],e[9*r+3]=t[3],e[9*r+4]=t[4],e[9*r+5]=t[5],e[9*r+6]=t[6],e[9*r+7]=t[7],e[9*r+8]=t[8],e[9*r+9]=t[9]},MAT4:(t,e,r)=>{e[16*r+0]=t[0],e[16*r+1]=t[1],e[16*r+2]=t[2],e[16*r+3]=t[3],e[16*r+4]=t[4],e[16*r+5]=t[5],e[16*r+6]=t[6],e[16*r+7]=t[7],e[16*r+8]=t[8],e[16*r+9]=t[9],e[16*r+10]=t[10],e[16*r+11]=t[11],e[16*r+12]=t[12],e[16*r+13]=t[13],e[16*r+14]=t[14],e[16*r+15]=t[15]}};function _X(t,e,r,i){let{componentType:n}=t;Bn(t.componentType);let o=typeof n=="string"?Vl.fromName(n):n,s=Pxe[t.type],l=Rxe[t.type],u=Bxe[t.type];return r+=t.byteOffset,{values:Vl.createTypedArray(o,e,r,s*i),type:o,size:s,unpacker:l,packer:u}}var Uh=t=>t!==void 0;function yX(t,e,r){if(!e)return null;let i=t.getExtension("3DTILES_batch_table_hierarchy"),n=e.HIERARCHY;return n&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=n,i=n),i?Oxe(i,r):null}function Oxe(t,e){let r,i,n,o=t.instancesLength,s=t.classes,l=t.classIds,u=t.parentCounts,h=t.parentIds,v=o;Uh(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,n=getBinaryAccessor(l),l=n.createArrayBufferView(e.buffer,e.byteOffset+l.byteOffset,o));let T;if(Uh(u))for(Uh(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,n=getBinaryAccessor(u),u=n.createArrayBufferView(e.buffer,e.byteOffset+u.byteOffset,o)),T=new Uint16Array(o),v=0,r=0;r<o;++r)T[r]=v,v+=u[r];Uh(h)&&Uh(h.byteOffset)&&(h.componentType=defaultValue(h.componentType,GL.UNSIGNED_SHORT),h.type=AttributeType.SCALAR,n=getBinaryAccessor(h),h=n.createArrayBufferView(e.buffer,e.byteOffset+h.byteOffset,v));let E=s.length;for(r=0;r<E;++r){let z=s[r].length,W=s[r].instances,J=getBinaryProperties(z,W,e);s[r].instances=combine(J,W)}let M=new Array(E).fill(0),O=new Uint16Array(o);for(r=0;r<o;++r)i=l[r],O[r]=M[i],++M[i];let F={classes:s,classIds:l,classIndexes:O,parentCounts:u,parentIndexes:T,parentIds:h};return Fxe(F),F}function $_(t,e,r){if(!t)return;let i=t.parentCounts;return t.parentIds?r(t,e):i>0?Dxe(t,e,r):Lxe(t,e,r)}function Dxe(t,e,r){let i=t.classIds,n=t.parentCounts,o=t.parentIds,s=t.parentIndexes,l=i.length,u=scratchVisited;u.length=Math.max(u.length,l);let h=++marker,v=scratchStack;for(v.length=0,v.push(e);v.length>0;){if(e=v.pop(),u[e]===h)continue;u[e]=h;let T=r(t,e);if(Uh(T))return T;let E=n[e],M=s[e];for(let O=0;O<E;++O){let F=o[M+O];F!==e&&v.push(F)}}return null}function Lxe(t,e,r){let i=!0;for(;i;){let n=r(t,e);if(Uh(n))return n;let o=t.parentIds[e];i=o!==e,e=o}throw new Error("traverseHierarchySingleParent")}function Fxe(t){let e=[],i=t.classIds.length;for(let n=0;n<i;++n)vX(t,n,stack)}function vX(t,e,r){let i=t.parentCounts,n=t.parentIds,o=t.parentIndexes,l=t.classIds.length;if(!Uh(n))return;assert(e<l,`Parent index ${e} exceeds the total number of instances: ${l}`),assert(r.indexOf(e)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(e);let u=Uh(i)?i[e]:1,h=Uh(i)?o[e]:e;for(let v=0;v<u;++v){let T=n[h+v];T!==e&&vX(t,T,r)}r.pop(e)}function Mc(t){return t!=null}var WC=(t,e)=>t,Nxe={HIERARCHY:!0,extensions:!0,extras:!0},pg=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(e,r,i,n={}){Bn(i>=0),this.json=e||{},this.binary=r,this.featureCount=i,this._extensions=this.json?.extensions||{},this._properties={};for(let o in this.json)Nxe[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=yX(this,this.json,this.binary))}getExtension(e){return this.json&&this.json.extensions&&this.json.extensions[e]}memorySizeInBytes(){return 0}isClass(e,r){if(this._checkBatchId(e),Bn(typeof r=="string",r),this._hierarchy){let i=$_(this._hierarchy,e,(n,o)=>{let s=n.classIds[o];return n.classes[s].name===r});return Mc(i)}return!1}isExactClass(e,r){return Bn(typeof r=="string",r),this.getExactClassName(e)===r}getExactClassName(e){if(this._checkBatchId(e),this._hierarchy){let r=this._hierarchy.classIds[e];return this._hierarchy.classes[r].name}}hasProperty(e,r){return this._checkBatchId(e),Bn(typeof r=="string",r),Mc(this._properties[r])||this._hasPropertyInHierarchy(e,r)}getPropertyNames(e,r){this._checkBatchId(e),r=Mc(r)?r:[],r.length=0;let i=Object.keys(this._properties);return r.push(...i),this._hierarchy&&this._getPropertyNamesInHierarchy(e,r),r}getProperty(e,r){if(this._checkBatchId(e),Bn(typeof r=="string",r),this._binaryProperties){let n=this._binaryProperties[r];if(Mc(n))return this._getBinaryProperty(n,e)}let i=this._properties[r];if(Mc(i))return WC(i[e],!0);if(this._hierarchy){let n=this._getHierarchyProperty(e,r);if(Mc(n))return n}}setProperty(e,r,i){let n=this.featureCount;if(this._checkBatchId(e),Bn(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(s){this._setBinaryProperty(s,e,i);return}}if(this._hierarchy&&this._setHierarchyProperty(this,e,r,i))return;let o=this._properties[r];Mc(o)||(this._properties[r]=new Array(n),o=this._properties[r]),o[e]=WC(i,!0)}_checkBatchId(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(e,r){return e.unpack(e.typedArray,r)}_setBinaryProperty(e,r,i){e.pack(i,e.typedArray,r)}_initializeBinaryProperties(){let e=null;for(let r in this._properties){let i=this._properties[r],n=this._initializeBinaryProperty(r,i);n&&(e=e||{},e[r]=n)}return e}_initializeBinaryProperty(e,r){if("byteOffset"in r){let i=r;Bn(this.binary,`Property ${e} requires a batch table binary.`),Bn(i.type,`Property ${e} requires a type.`);let n=_X(i,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:n.values,componentCount:n.size,unpack:n.unpacker,pack:n.packer}}return null}_hasPropertyInHierarchy(e,r){if(!this._hierarchy)return!1;let i=$_(this._hierarchy,e,(n,o)=>{let s=n.classIds[o],l=n.classes[s].instances;return Mc(l[r])});return Mc(i)}_getPropertyNamesInHierarchy(e,r){$_(this._hierarchy,e,(i,n)=>{let o=i.classIds[n],s=i.classes[o].instances;for(let l in s)s.hasOwnProperty(l)&&r.indexOf(l)===-1&&r.push(l)})}_getHierarchyProperty(e,r){return $_(this._hierarchy,e,(i,n)=>{let o=i.classIds[n],s=i.classes[o],l=i.classIndexes[n],u=s.instances[r];return Mc(u)?Mc(u.typedArray)?this._getBinaryProperty(u,l):WC(u[l],!0):null})}_setHierarchyProperty(e,r,i,n){let o=$_(this._hierarchy,r,(s,l)=>{let u=s.classIds[l],h=s.classes[u],v=s.classIndexes[l],T=h.instances[i];return Mc(T)?(Bn(l===r,`Inherited property "${i}" is read-only.`),Mc(T.typedArray)?this._setBinaryProperty(T,v,n):T[v]=WC(n,!0),!0):!1});return Mc(o)}};function aA(t,e,r=0){let i=new DataView(e);if(t.magic=i.getUint32(r,!0),r+=4,t.version=i.getUint32(r,!0),r+=4,t.byteLength=i.getUint32(r,!0),r+=4,t.version!==1)throw new Error(`3D Tile Version ${t.version} not supported`);return r}var ey=4,xX="b3dm tile in legacy format.";function ty(t,e,r){let i=new DataView(e),n;t.header=t.header||{};let o=i.getUint32(r,!0);r+=ey;let s=i.getUint32(r,!0);r+=ey;let l=i.getUint32(r,!0);r+=ey;let u=i.getUint32(r,!0);return r+=ey,l>=570425344?(r-=ey*2,n=o,l=s,u=0,o=0,s=0,console.warn(xX)):u>=570425344&&(r-=ey,n=l,l=o,u=s,o=0,s=0,console.warn(xX)),t.header.featureTableJsonByteLength=o,t.header.featureTableBinaryByteLength=s,t.header.batchTableJsonByteLength=l,t.header.batchTableBinaryByteLength=u,t.header.batchLength=n,r}function ry(t,e,r,i){return r=kxe(t,e,r,i),r=Uxe(t,e,r,i),r}function kxe(t,e,r,i){let{featureTableJsonByteLength:n,featureTableBinaryByteLength:o,batchLength:s}=t.header||{};if(t.featureTableJson={BATCH_LENGTH:s||0},n&&n>0){let l=DL(e,r,n);t.featureTableJson=JSON.parse(l)}return r+=n||0,t.featureTableBinary=new Uint8Array(e,r,o),r+=o||0,r}function Uxe(t,e,r,i){let{batchTableJsonByteLength:n,batchTableBinaryByteLength:o}=t.header||{};if(n&&n>0){let s=DL(e,r,n);t.batchTableJson=JSON.parse(s),r+=n,o&&o>0&&(t.batchTableBinary=new Uint8Array(e,r,o),t.batchTableBinary=new Uint8Array(t.batchTableBinary),r+=o)}return r}function UL(t,e,r){if(!e&&(!t||!t.batchIds||!r))return null;let{batchIds:i,isRGB565:n,pointCount:o=0}=t;if(i&&r){let s=new Uint8ClampedArray(o*3);for(let l=0;l<o;l++){let u=i[l],v=r.getProperty(u,"dimensions").map(T=>T*255);s[l*3]=v[0],s[l*3+1]=v[1],s[l*3+2]=v[2]}return{type:Tn.UNSIGNED_BYTE,value:s,size:3,normalized:!0}}if(e&&n){let s=new Uint8ClampedArray(o*3);for(let l=0;l<o;l++){let u=NL(e[l]);s[l*3]=u[0],s[l*3+1]=u[1],s[l*3+2]=u[2]}return{type:Tn.UNSIGNED_BYTE,value:s,size:3,normalized:!0}}return e&&e.length===o*3?{type:Tn.UNSIGNED_BYTE,value:e,size:3,normalized:!0}:{type:Tn.UNSIGNED_BYTE,value:e||new Uint8ClampedArray,size:4,normalized:!0}}var bX=new ot;function wX(t,e){if(!e)return null;if(t.isOctEncoded16P){let r=new Float32Array((t.pointsLength||0)*3);for(let i=0;i<(t.pointsLength||0);i++)kL(e[i*2],e[i*2+1],bX),bX.toArray(r,i*3);return{type:Tn.FLOAT,size:2,value:r}}return{type:Tn.FLOAT,size:2,value:e}}function TX(t,e,r){return t.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(t.isQuantized=!1,zxe(t,e)):{type:Tn.UNSIGNED_SHORT,value:e,size:3,normalized:!0}:e}function zxe(t,e){let r=new ot,i=new Float32Array(t.pointCount*3);for(let n=0;n<t.pointCount;n++)r.set(e[n*3],e[n*3+1],e[n*3+2]).scale(1/t.quantizedRange).multiply(t.quantizedVolumeScale).add(t.quantizedVolumeOffset).toArray(i,n*3);return i}async function EX(t,e,r,i,n){r=aA(t,e,r),r=ty(t,e,r),r=ry(t,e,r,i),Vxe(t);let{featureTable:o,batchTable:s}=Hxe(t);return await Xxe(t,o,s,i,n),jxe(t,o,i),Gxe(t,o,s),Wxe(t,o),r}function Vxe(t){t.attributes={positions:null,colors:null,normals:null,batchIds:null},t.isQuantized=!1,t.isTranslucent=!1,t.isRGB565=!1,t.isOctEncoded16P=!1}function Hxe(t){let e=new Gd(t.featureTableJson,t.featureTableBinary),r=e.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");e.featuresLength=r,t.featuresLength=r,t.pointsLength=r,t.pointCount=r,t.rtcCenter=e.getGlobalProperty("RTC_CENTER",Tn.FLOAT,3);let i=qxe(t,e);return{featureTable:e,batchTable:i}}function jxe(t,e,r){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.positions){if(e.hasProperty("POSITION"))t.attributes.positions=e.getPropertyArray("POSITION",Tn.FLOAT,3);else if(e.hasProperty("POSITION_QUANTIZED")){let i=e.getPropertyArray("POSITION_QUANTIZED",Tn.UNSIGNED_SHORT,3);if(t.isQuantized=!0,t.quantizedRange=(1<<16)-1,t.quantizedVolumeScale=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Tn.FLOAT,3),!t.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(t.quantizedVolumeOffset=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Tn.FLOAT,3),!t.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");t.attributes.positions=TX(t,i,r)}}if(!t.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function Gxe(t,e,r){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.colors){let i=null;e.hasProperty("RGBA")?(i=e.getPropertyArray("RGBA",Tn.UNSIGNED_BYTE,4),t.isTranslucent=!0):e.hasProperty("RGB")?i=e.getPropertyArray("RGB",Tn.UNSIGNED_BYTE,3):e.hasProperty("RGB565")&&(i=e.getPropertyArray("RGB565",Tn.UNSIGNED_SHORT,1),t.isRGB565=!0),t.attributes.colors=UL(t,i,r)}e.hasProperty("CONSTANT_RGBA")&&(t.constantRGBA=e.getGlobalProperty("CONSTANT_RGBA",Tn.UNSIGNED_BYTE,4))}function Wxe(t,e){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.normals){let r=null;e.hasProperty("NORMAL")?r=e.getPropertyArray("NORMAL",Tn.FLOAT,3):e.hasProperty("NORMAL_OCT16P")&&(r=e.getPropertyArray("NORMAL_OCT16P",Tn.UNSIGNED_BYTE,2),t.isOctEncoded16P=!0),t.attributes.normals=wX(t,r)}}function qxe(t,e){let r=null;if(!t.batchIds&&e.hasProperty("BATCH_ID")&&(t.batchIds=e.getPropertyArray("BATCH_ID",Tn.UNSIGNED_SHORT,1),t.batchIds)){let i=e.getGlobalProperty("BATCH_LENGTH");if(!i)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:n,batchTableBinary:o}=t;r=new pg(n,o,i)}return r}async function Xxe(t,e,r,i,n){let o,s,l,u=t.batchTableJson&&t.batchTableJson.extensions&&t.batchTableJson.extensions["3DTILES_draco_point_compression"];u&&(l=u.properties);let h=e.getExtension("3DTILES_draco_point_compression");if(h){s=h.properties;let T=h.byteOffset,E=h.byteLength;if(!s||!Number.isFinite(T)||!E)throw new Error("Draco properties, byteOffset, and byteLength must be defined");o=(t.featureTableBinary||[]).slice(T,T+E),t.hasPositions=Number.isFinite(s.POSITION),t.hasColors=Number.isFinite(s.RGB)||Number.isFinite(s.RGBA),t.hasNormals=Number.isFinite(s.NORMAL),t.hasBatchIds=Number.isFinite(s.BATCH_ID),t.isTranslucent=Number.isFinite(s.RGBA)}if(!o)return!0;let v={buffer:o,properties:{...s,...l},featureTableProperties:s,batchTableProperties:l,dequantizeInShader:!1};return await Yxe(t,v,i,n)}async function Yxe(t,e,r,i){if(!i)return;let n={...r,draco:{...r?.draco,extraAttributes:e.batchTableProperties||{}}};delete n["3d-tiles"];let o=await qc(e.buffer,EC,n,i),s=o.attributes.POSITION&&o.attributes.POSITION.value,l=o.attributes.COLOR_0&&o.attributes.COLOR_0.value,u=o.attributes.NORMAL&&o.attributes.NORMAL.value,h=o.attributes.BATCH_ID&&o.attributes.BATCH_ID.value,v=s&&o.attributes.POSITION.value.quantization,T=u&&o.attributes.NORMAL.value.quantization;if(v){let M=o.POSITION.data.quantization,O=M.range;t.quantizedVolumeScale=new ot(O,O,O),t.quantizedVolumeOffset=new ot(M.minValues),t.quantizedRange=(1<<M.quantizationBits)-1,t.isQuantizedDraco=!0}T&&(t.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,t.isOctEncodedDraco=!0);let E={};if(e.batchTableProperties)for(let M of Object.keys(e.batchTableProperties))o.attributes[M]&&o.attributes[M].value&&(E[M.toLowerCase()]=o.attributes[M].value);t.attributes={positions:s,colors:UL(t,l,void 0),normals:u,batchIds:h,...E}}var qC={URI:0,EMBEDDED:1};function XC(t,e,r,i){t.rotateYtoZ=!0;let n=(t.byteOffset||0)+(t.byteLength||0)-r;if(n===0)throw new Error("glTF byte length must be greater than 0.");return t.gltfUpAxis=i?.["3d-tiles"]&&i["3d-tiles"].assetGltfUpAxis?i["3d-tiles"].assetGltfUpAxis:"Y",t.gltfArrayBuffer=ZA(e,r,n),t.gltfByteOffset=0,t.gltfByteLength=n,r%4===0||console.warn(`${t.type}: embedded glb is not aligned to a 4-byte boundary.`),(t.byteOffset||0)+(t.byteLength||0)}async function YC(t,e,r,i){let n=r?.["3d-tiles"]||{};if(Kxe(t,e,r),n.loadGLTF){if(!i)return;if(t.gltfUrl){let{fetch:o}=i,s=await o(t.gltfUrl,r);t.gltfArrayBuffer=await s.arrayBuffer(),t.gltfByteOffset=0}if(t.gltfArrayBuffer){let o=await qc(t.gltfArrayBuffer,Vd,r,i);t.gltf=cg(o),t.gpuMemoryUsageInBytes=Ib(t.gltf),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength}}}function Kxe(t,e,r){switch(e){case qC.URI:if(t.gltfArrayBuffer){let i=new Uint8Array(t.gltfArrayBuffer,t.gltfByteOffset),o=new TextDecoder().decode(i);t.gltfUrl=o.replace(/[\s\0]+$/,"")}delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;break;case qC.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function SX(t,e,r,i,n){r=Zxe(t,e,r,i,n),await YC(t,qC.EMBEDDED,i,n);let o=t?.gltf?.extensions;return o&&o.CESIUM_RTC&&(t.rtcCenter=o.CESIUM_RTC.center),r}function Zxe(t,e,r,i,n){r=aA(t,e,r),r=ty(t,e,r),r=ry(t,e,r,i),r=XC(t,e,r,i);let o=new Gd(t.featureTableJson,t.featureTableBinary);return t.rtcCenter=o.getGlobalProperty("RTC_CENTER",Tn.FLOAT,3),r}async function CX(t,e,r,i,n){return r=Jxe(t,e,r,i,n),await YC(t,t.gltfFormat||0,i,n),r}function Jxe(t,e,r,i,n){if(r=aA(t,e,r),t.version!==1)throw new Error(`Instanced 3D Model version ${t.version} is not supported`);r=ty(t,e,r);let o=new DataView(e);if(t.gltfFormat=o.getUint32(r,!0),r+=4,r=ry(t,e,r,i),r=XC(t,e,r,i),!t?.header?.featureTableJsonByteLength||t.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let s=new Gd(t.featureTableJson,t.featureTableBinary),l=s.getGlobalProperty("INSTANCES_LENGTH");if(s.featuresLength=l,!Number.isFinite(l))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");t.eastNorthUp=s.getGlobalProperty("EAST_NORTH_UP"),t.rtcCenter=s.getGlobalProperty("RTC_CENTER",Tn.FLOAT,3);let u=new pg(t.batchTableJson,t.batchTableBinary,l);return Qxe(t,s,u,l),r}function Qxe(t,e,r,i){let n=new Array(i),o=new ot,s=new ot,l=new ot,u=new ot,h=new mo,v=new Du,T=new ot,E={},M=new Kr,O=[],F=[],z=[],W=[];for(let J=0;J<i;J++){let K;if(e.hasProperty("POSITION"))K=e.getProperty("POSITION",Tn.FLOAT,3,J,o);else if(e.hasProperty("POSITION_QUANTIZED")){K=e.getProperty("POSITION_QUANTIZED",Tn.UNSIGNED_SHORT,3,J,o);let Z=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Tn.FLOAT,3);if(!Z)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let we=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Tn.FLOAT,3);if(!we)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let Oe=65535;for(let he=0;he<3;he++)K[he]=K[he]/Oe*we[he]+Z[he]}if(!K)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");o.copy(K),E.translation=o,t.normalUp=e.getProperty("NORMAL_UP",Tn.FLOAT,3,J,O),t.normalRight=e.getProperty("NORMAL_RIGHT",Tn.FLOAT,3,J,F);let ne=!1;if(t.normalUp){if(!t.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");t.hasCustomOrientation=!0}else{if(t.octNormalUp=e.getProperty("NORMAL_UP_OCT32P",Tn.UNSIGNED_SHORT,2,J,O),t.octNormalRight=e.getProperty("NORMAL_RIGHT_OCT32P",Tn.UNSIGNED_SHORT,2,J,F),t.octNormalUp)throw t.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");t.eastNorthUp?(Nn.WGS84.eastNorthUpToFixedFrame(o,M),M.getRotationMatrix3(h)):h.identity()}ne&&(u.copy(s).cross(l).normalize(),h.setColumn(0,s),h.setColumn(1,l),h.setColumn(2,u)),v.fromMatrix3(h),E.rotation=v,T.set(1,1,1);let ge=e.getProperty("SCALE",Tn.FLOAT,1,J,z);Number.isFinite(ge)&&T.multiplyByScalar(ge);let j=e.getProperty("SCALE_NON_UNIFORM",Tn.FLOAT,3,J,O);j&&T.scale(j),E.scale=T;let me=e.getProperty("BATCH_ID",Tn.UNSIGNED_SHORT,1,J,W);me===void 0&&(me=J);let fe=new Kr().fromQuaternion(E.rotation);M.identity(),M.translate(E.translation),M.multiplyRight(fe),M.scale(E.scale);let $=M.clone();n[J]={modelMatrix:$,batchId:me}}t.instances=n}async function MX(t,e,r,i,n,o){r=aA(t,e,r);let s=new DataView(e);for(t.tilesLength=s.getUint32(r,!0),r+=4,t.tiles=[];t.tiles.length<t.tilesLength&&(t.byteLength||0)-r>12;){let l={shape:"tile3d"};t.tiles.push(l),r=await o(e,r,i,n,l)}return r}async function IX(t,e,r,i){if(t.rotateYtoZ=!0,t.gltfUpAxis=r?.["3d-tiles"]?.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",r?.["3d-tiles"]?.loadGLTF){if(!i)return e.byteLength;let n=await qc(e,Vd,r,i);t.gltf=cg(n),t.gpuMemoryUsageInBytes=Ib(t.gltf)}else t.gltfArrayBuffer=e;return e.byteLength}async function zL(t,e=0,r,i,n={shape:"tile3d"}){switch(n.byteOffset=e,n.type=dX(t,e),n.type){case dg.COMPOSITE:return await MX(n,t,e,r,i,zL);case dg.BATCHED_3D_MODEL:return await SX(n,t,e,r,i);case dg.GLTF:return await IX(n,t,r,i);case dg.INSTANCED_3D_MODEL:return await CX(n,t,e,r,i);case dg.POINT_CLOUD:return await EX(n,t,e,r,i);default:throw new Error(`3DTileLoader: unknown type ${n.type}`)}}async function VL(t,e,r){if(new Uint32Array(t.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(t.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let o=PX(t.slice(8,16)),s=new Uint8Array(t,24,o),u=new TextDecoder("utf8").decode(s),h=JSON.parse(u),v=PX(t.slice(16,24)),T=new ArrayBuffer(0);if(v&&(T=t.slice(24+o)),await KC(h,h.tileAvailability,T,r),Array.isArray(h.contentAvailability))for(let E of h.contentAvailability)await KC(h,E,T,r);else await KC(h,h.contentAvailability,T,r);return await KC(h,h.childSubtreeAvailability,T,r),h}async function KC(t,e,r,i){let n=Number.isFinite(e.bitstream)?e.bitstream:e.bufferView;if(typeof n!="number")return;let o=t.bufferViews[n],s=t.buffers[o.buffer];if(!i?.baseUrl)throw new Error("Url is not provided");if(!i.fetch)throw new Error("fetch is not provided");if(s.uri){let u=`${i?.baseUrl||""}/${s.uri}`,v=await(await i.fetch(u)).arrayBuffer();e.explicitBitstream=new Uint8Array(v,o.byteOffset,o.byteLength);return}let l=t.buffers.slice(0,o.buffer).reduce((u,h)=>u+h.byteLength,0);e.explicitBitstream=new Uint8Array(r.slice(l,l+s.byteLength),o.byteOffset,o.byteLength)}function PX(t){let e=new DataView(t),r=e.getUint32(0,!0),i=e.getUint32(4,!0);return r+2**32*i}var ZC={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:GC,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:VL,options:{}};var Xu=null;try{Xu=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function ss(t,e,r){this.low=t|0,this.high=e|0,this.unsigned=!!r}ss.prototype.__isLong__;Object.defineProperty(ss.prototype,"__isLong__",{value:!0});function Hl(t){return(t&&t.__isLong__)===!0}function RX(t){var e=Math.clz32(t&-t);return t?31-e:e}ss.isLong=Hl;var BX={},OX={};function Ag(t,e){var r,i,n;return e?(t>>>=0,(n=0<=t&&t<256)&&(i=OX[t],i)?i:(r=fo(t,0,!0),n&&(OX[t]=r),r)):(t|=0,(n=-128<=t&&t<128)&&(i=BX[t],i)?i:(r=fo(t,t<0?-1:0,!1),n&&(BX[t]=r),r))}ss.fromInt=Ag;function Yu(t,e){if(isNaN(t))return e?Wd:Nf;if(e){if(t<0)return Wd;if(t>=NX)return zX}else{if(t<=-LX)return Ic;if(t+1>=LX)return UX}return t<0?Yu(-t,e).neg():fo(t%ny|0,t/ny|0,e)}ss.fromNumber=Yu;function fo(t,e,r){return new ss(t,e,r)}ss.fromBits=fo;var JC=Math.pow;function jL(t,e,r){if(t.length===0)throw Error("empty string");if(typeof e=="number"?(r=e,e=!1):e=!!e,t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e?Wd:Nf;if(r=r||10,r<2||36<r)throw RangeError("radix");var i;if((i=t.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return jL(t.substring(1),e,r).neg();for(var n=Yu(JC(r,8)),o=Nf,s=0;s<t.length;s+=8){var l=Math.min(8,t.length-s),u=parseInt(t.substring(s,s+l),r);if(l<8){var h=Yu(JC(r,l));o=o.mul(h).add(Yu(u))}else o=o.mul(n),o=o.add(Yu(u))}return o.unsigned=e,o}ss.fromString=jL;function kf(t,e){return typeof t=="number"?Yu(t,e):typeof t=="string"?jL(t,e):fo(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}ss.fromValue=kf;var DX=1<<16,$xe=1<<24,ny=DX*DX,NX=ny*ny,LX=NX/2,FX=Ag($xe),Nf=Ag(0);ss.ZERO=Nf;var Wd=Ag(0,!0);ss.UZERO=Wd;var iy=Ag(1);ss.ONE=iy;var kX=Ag(1,!0);ss.UONE=kX;var HL=Ag(-1);ss.NEG_ONE=HL;var UX=fo(-1,2147483647,!1);ss.MAX_VALUE=UX;var zX=fo(-1,-1,!0);ss.MAX_UNSIGNED_VALUE=zX;var Ic=fo(0,-2147483648,!1);ss.MIN_VALUE=Ic;var wr=ss.prototype;wr.toInt=function(){return this.unsigned?this.low>>>0:this.low};wr.toNumber=function(){return this.unsigned?(this.high>>>0)*ny+(this.low>>>0):this.high*ny+(this.low>>>0)};wr.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Ic)){var r=Yu(e),i=this.div(r),n=i.mul(r).sub(this);return i.toString(e)+n.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=Yu(JC(e,6),this.unsigned),s=this,l="";;){var u=s.div(o),h=s.sub(u.mul(o)).toInt()>>>0,v=h.toString(e);if(s=u,s.isZero())return v+l;for(;v.length<6;)v="0"+v;l=""+v+l}};wr.getHighBits=function(){return this.high};wr.getHighBitsUnsigned=function(){return this.high>>>0};wr.getLowBits=function(){return this.low};wr.getLowBitsUnsigned=function(){return this.low>>>0};wr.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Ic)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,r=31;r>0&&!(e&1<<r);r--);return this.high!=0?r+33:r+1};wr.isZero=function(){return this.high===0&&this.low===0};wr.eqz=wr.isZero;wr.isNegative=function(){return!this.unsigned&&this.high<0};wr.isPositive=function(){return this.unsigned||this.high>=0};wr.isOdd=function(){return(this.low&1)===1};wr.isEven=function(){return(this.low&1)===0};wr.equals=function(e){return Hl(e)||(e=kf(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};wr.eq=wr.equals;wr.notEquals=function(e){return!this.eq(e)};wr.neq=wr.notEquals;wr.ne=wr.notEquals;wr.lessThan=function(e){return this.comp(e)<0};wr.lt=wr.lessThan;wr.lessThanOrEqual=function(e){return this.comp(e)<=0};wr.lte=wr.lessThanOrEqual;wr.le=wr.lessThanOrEqual;wr.greaterThan=function(e){return this.comp(e)>0};wr.gt=wr.greaterThan;wr.greaterThanOrEqual=function(e){return this.comp(e)>=0};wr.gte=wr.greaterThanOrEqual;wr.ge=wr.greaterThanOrEqual;wr.compare=function(e){if(Hl(e)||(e=kf(e)),this.eq(e))return 0;var r=this.isNegative(),i=e.isNegative();return r&&!i?-1:!r&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};wr.comp=wr.compare;wr.negate=function(){return!this.unsigned&&this.eq(Ic)?Ic:this.not().add(iy)};wr.neg=wr.negate;wr.add=function(e){Hl(e)||(e=kf(e));var r=this.high>>>16,i=this.high&65535,n=this.low>>>16,o=this.low&65535,s=e.high>>>16,l=e.high&65535,u=e.low>>>16,h=e.low&65535,v=0,T=0,E=0,M=0;return M+=o+h,E+=M>>>16,M&=65535,E+=n+u,T+=E>>>16,E&=65535,T+=i+l,v+=T>>>16,T&=65535,v+=r+s,v&=65535,fo(E<<16|M,v<<16|T,this.unsigned)};wr.subtract=function(e){return Hl(e)||(e=kf(e)),this.add(e.neg())};wr.sub=wr.subtract;wr.multiply=function(e){if(this.isZero())return this;if(Hl(e)||(e=kf(e)),Xu){var r=Xu.mul(this.low,this.high,e.low,e.high);return fo(r,Xu.get_high(),this.unsigned)}if(e.isZero())return this.unsigned?Wd:Nf;if(this.eq(Ic))return e.isOdd()?Ic:Nf;if(e.eq(Ic))return this.isOdd()?Ic:Nf;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(FX)&&e.lt(FX))return Yu(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,n=this.high&65535,o=this.low>>>16,s=this.low&65535,l=e.high>>>16,u=e.high&65535,h=e.low>>>16,v=e.low&65535,T=0,E=0,M=0,O=0;return O+=s*v,M+=O>>>16,O&=65535,M+=o*v,E+=M>>>16,M&=65535,M+=s*h,E+=M>>>16,M&=65535,E+=n*v,T+=E>>>16,E&=65535,E+=o*h,T+=E>>>16,E&=65535,E+=s*u,T+=E>>>16,E&=65535,T+=i*v+n*h+o*u+s*l,T&=65535,fo(M<<16|O,T<<16|E,this.unsigned)};wr.mul=wr.multiply;wr.divide=function(e){if(Hl(e)||(e=kf(e)),e.isZero())throw Error("division by zero");if(Xu){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?Xu.div_u:Xu.div_s)(this.low,this.high,e.low,e.high);return fo(r,Xu.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Wd:Nf;var i,n,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Wd;if(e.gt(this.shru(1)))return kX;o=Wd}else{if(this.eq(Ic)){if(e.eq(iy)||e.eq(HL))return Ic;if(e.eq(Ic))return iy;var s=this.shr(1);return i=s.div(e).shl(1),i.eq(Nf)?e.isNegative()?iy:HL:(n=this.sub(e.mul(i)),o=i.add(n.div(e)),o)}else if(e.eq(Ic))return this.unsigned?Wd:Nf;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=Nf}for(n=this;n.gte(e);){i=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var l=Math.ceil(Math.log(i)/Math.LN2),u=l<=48?1:JC(2,l-48),h=Yu(i),v=h.mul(e);v.isNegative()||v.gt(n);)i-=u,h=Yu(i,this.unsigned),v=h.mul(e);h.isZero()&&(h=iy),o=o.add(h),n=n.sub(v)}return o};wr.div=wr.divide;wr.modulo=function(e){if(Hl(e)||(e=kf(e)),Xu){var r=(this.unsigned?Xu.rem_u:Xu.rem_s)(this.low,this.high,e.low,e.high);return fo(r,Xu.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};wr.mod=wr.modulo;wr.rem=wr.modulo;wr.not=function(){return fo(~this.low,~this.high,this.unsigned)};wr.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};wr.clz=wr.countLeadingZeros;wr.countTrailingZeros=function(){return this.low?RX(this.low):RX(this.high)+32};wr.ctz=wr.countTrailingZeros;wr.and=function(e){return Hl(e)||(e=kf(e)),fo(this.low&e.low,this.high&e.high,this.unsigned)};wr.or=function(e){return Hl(e)||(e=kf(e)),fo(this.low|e.low,this.high|e.high,this.unsigned)};wr.xor=function(e){return Hl(e)||(e=kf(e)),fo(this.low^e.low,this.high^e.high,this.unsigned)};wr.shiftLeft=function(e){return Hl(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?fo(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):fo(0,this.low<<e-32,this.unsigned)};wr.shl=wr.shiftLeft;wr.shiftRight=function(e){return Hl(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?fo(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):fo(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};wr.shr=wr.shiftRight;wr.shiftRightUnsigned=function(e){return Hl(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?fo(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):e===32?fo(this.high,0,this.unsigned):fo(this.high>>>e-32,0,this.unsigned)};wr.shru=wr.shiftRightUnsigned;wr.shr_u=wr.shiftRightUnsigned;wr.rotateLeft=function(e){var r;return Hl(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?fo(this.high,this.low,this.unsigned):e<32?(r=32-e,fo(this.low<<e|this.high>>>r,this.high<<e|this.low>>>r,this.unsigned)):(e-=32,r=32-e,fo(this.high<<e|this.low>>>r,this.low<<e|this.high>>>r,this.unsigned))};wr.rotl=wr.rotateLeft;wr.rotateRight=function(e){var r;return Hl(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?fo(this.high,this.low,this.unsigned):e<32?(r=32-e,fo(this.high<<r|this.low>>>e,this.low<<r|this.high>>>e,this.unsigned)):(e-=32,r=32-e,fo(this.low<<r|this.high>>>e,this.high<<r|this.low>>>e,this.unsigned))};wr.rotr=wr.rotateRight;wr.toSigned=function(){return this.unsigned?fo(this.low,this.high,!1):this};wr.toUnsigned=function(){return this.unsigned?this:fo(this.low,this.high,!0)};wr.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};wr.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};wr.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};ss.fromBytes=function(e,r,i){return i?ss.fromBytesLE(e,r):ss.fromBytesBE(e,r)};ss.fromBytesLE=function(e,r){return new ss(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)};ss.fromBytesBE=function(e,r){return new ss(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)};var oy=ss;var e1e=16;function kb(t){t==="X"&&(t="");let e=t.padEnd(e1e,"0");return oy.fromString(e,!0,16)}function WL(t){if(t.isZero())return"X";let e=t.countTrailingZeros(),r=e%4;e=(e-r)/4;let i=e;e*=4;let o=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-i-o.length).join("0")+o}function qL(t,e){let r=t1e(t).shiftRightUnsigned(2);return t.add(oy.fromNumber(2*e+1-4).multiply(r))}function t1e(t){return t.and(t.not().add(1))}var r1e=3,i1e=30,n1e=2*i1e+1,VX=180/Math.PI;function jX(t){if(t.length===0)throw new Error(`Invalid Hilbert quad key ${t}`);let e=t.split("/"),r=parseInt(e[0],10),i=e[1],n=i.length,o=0,s=[0,0];for(let l=n-1;l>=0;l--){o=n-l;let u=i[l],h=0,v=0;u==="1"?v=1:u==="2"?(h=1,v=1):u==="3"&&(h=1);let T=Math.pow(2,o-1);o1e(T,s,h,v),s[0]+=T*h,s[1]+=T*v}if(r%2===1){let l=s[0];s[0]=s[1],s[1]=l}return{face:r,ij:s,level:o}}function GX(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<r1e+n1e;)e="0"+e;let r=e.lastIndexOf("1"),i=e.substring(0,3),n=e.substring(3,r),o=n.length/2,s=oy.fromString(i,!0,2).toString(10),l="";if(o!==0)for(l=oy.fromString(n,!0,2).toString(4);l.length<o;)l="0"+l;return`${s}/${l}`}function XL(t,e,r){let i=1<<e;return[(t[0]+r[0])/i,(t[1]+r[1])/i]}function HX(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function YL(t){return[HX(t[0]),HX(t[1])]}function KL(t,[e,r]){switch(t){case 0:return[1,e,r];case 1:return[-e,1,r];case 2:return[-e,-r,1];case 3:return[-1,-r,-e];case 4:return[r,-1,-e];case 5:return[r,e,-1];default:throw new Error("Invalid face")}}function ZL([t,e,r]){let i=Math.atan2(r,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*VX,i*VX]}function o1e(t,e,r,i){if(i===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let n=e[0];e[0]=e[1],e[1]=n}}function WX(t){let e=XL(t.ij,t.level,[.5,.5]),r=YL(e),i=KL(t.face,r);return ZL(i)}var s1e=100;function JL(t){let{face:e,ij:r,level:i}=t,n=[[0,0],[0,1],[1,1],[1,0],[0,0]],o=Math.max(1,Math.ceil(s1e*Math.pow(2,-i))),s=new Float64Array(4*o*2+2),l=0,u=0;for(let h=0;h<4;h++){let v=n[h].slice(0),T=n[h+1],E=(T[0]-v[0])/o,M=(T[1]-v[1])/o;for(let O=0;O<o;O++){v[0]+=E,v[1]+=M;let F=XL(r,i,v),z=YL(F),W=KL(e,z),J=ZL(W);Math.abs(J[1])>89.999&&(J[0]=u);let K=J[0]-u;J[0]+=K>180?-360:K<-180?360:0,s[l++]=J[0],s[l++]=J[1],u=J[0]}}return s[l++]=s[0],s[l++]=s[1],s}function sy(t){let e=a1e(t);return jX(e)}function a1e(t){if(t.indexOf("/")>0)return t;let e=kb(t);return GX(e)}function QL(t){let e=sy(t);return WX(e)}function XX(t){let e;if(t.face===2||t.face===5){let r=null,i=0;for(let n=0;n<4;n++){let o=`${t.face}/${n}`,s=sy(o),l=JL(s);(typeof r>"u"||r===null)&&(r=new Float64Array(4*l.length)),r.set(l,i),i+=l.length}e=qX(r)}else{let r=JL(t);e=qX(r)}return e}function qX(t){if(t.length%2!==0)throw new Error("Invalid corners");let e=[],r=[];for(let i=0;i<t.length;i+=2)e.push(t[i]),r.push(t[i+1]);return e.sort((i,n)=>i-n),r.sort((i,n)=>i-n),{west:e[0],east:e[e.length-1],north:r[r.length-1],south:r[0]}}function $L(t,e){let r=e?.minimumHeight||0,i=e?.maximumHeight||0,n=sy(t),o=XX(n),s=o.west,l=o.south,u=o.east,h=o.north,v=[];return v.push(new ot(s,h,r)),v.push(new ot(u,h,r)),v.push(new ot(u,l,r)),v.push(new ot(s,l,r)),v.push(new ot(s,h,i)),v.push(new ot(u,h,i)),v.push(new ot(u,l,i)),v.push(new ot(s,l,i)),v}function QC(t){let e=t.token,r={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},i=$L(e,r),n=QL(e),o=n[0],s=n[1],l=Nn.WGS84.cartographicToCartesian([o,s,r.maximumHeight]),u=new ot(l[0],l[1],l[2]);i.push(u);let h=xb(i);return[...h.center,...h.halfAxes]}var l1e=4,c1e=8,u1e={QUADTREE:l1e,OCTREE:c1e};function f1e(t,e,r){if(t?.box){let i=kb(t.s2VolumeInfo.token),n=qL(i,e),o=WL(n),s={...t.s2VolumeInfo};switch(s.token=o,r){case"OCTREE":let h=t.s2VolumeInfo,v=h.maximumHeight-h.minimumHeight,T=v/2,E=h.minimumHeight+v/2;h.minimumHeight=E-T,h.maximumHeight=E+T;break;default:break}return{box:QC(s),s2VolumeInfo:s}}}async function tF(t){let{implicitOptions:e,parentData:r={mortonIndex:0,x:0,y:0,z:0},childIndex:i=0,s2VolumeBox:n,loaderOptions:o}=t,{subtree:s,level:l=0,globalData:u={level:0,mortonIndex:0,x:0,y:0,z:0}}=t,{subdivisionScheme:h,subtreeLevels:v,maximumLevel:T,contentUrlTemplate:E,subtreesUriTemplate:M,basePath:O}=e,F={children:[],lodMetricValue:0,contentUrl:""};if(!T)return IP.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${E} won't be loaded...`),F;let z=l+u.level;if(z>T)return F;let W=u1e[h],J=Math.log2(W),K=i&1,ne=i>>1&1,ge=i>>2&1,j=(W**l-1)/(W-1),me=mg(r.mortonIndex,i,J),fe=j+me,$=mg(r.x,K,1),Z=mg(r.y,ne,1),we=mg(r.z,ge,1),Oe=!1;l>=v&&(Oe=eF(s.childSubtreeAvailability,me));let he=mg(u.x,$,l),Le=mg(u.y,Z,l),ft=mg(u.z,we,l);if(Oe){let Jr=`${O}/${M}`,or=$C(Jr,z,he,Le,ft);s=await _a(or,ZC,o),u={mortonIndex:me,x:$,y:Z,z:we,level:l},me=0,fe=0,$=0,Z=0,we=0,l=0}if(!eF(s.tileAvailability,fe))return F;eF(s.contentAvailability,fe)&&(F.contentUrl=$C(E,z,he,Le,ft));let mr=l+1,Er={mortonIndex:me,x:$,y:Z,z:we};for(let Jr=0;Jr<W;Jr++){let or=f1e(n,Jr,h),ai=await tF({subtree:s,implicitOptions:e,loaderOptions:o,parentData:Er,childIndex:Jr,level:mr,globalData:{...u},s2VolumeBox:or});if(ai.contentUrl||ai.children.length){let Jt=z+1,wi=h1e(ai,Jt,{childTileX:$,childTileY:Z,childTileZ:we},e,n);F.children.push(wi)}}return F}function eF(t,e){let r;return Array.isArray(t)?(r=t[0],t.length>1&&IP.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=t,"constant"in r?Boolean(r.constant):r.explicitBitstream?A1e(e,r.explicitBitstream):!1}function h1e(t,e,r,i,n){let{basePath:o,refine:s,getRefine:l,lodMetricType:u,getTileType:h,rootLodMetricValue:v,rootBoundingVolume:T}=i,E=t.contentUrl&&t.contentUrl.replace(`${o}/`,""),M=v/2**e,O=n?.box?{box:n.box}:T,F=d1e(e,O,r);return{children:t.children,contentUrl:t.contentUrl,content:{uri:E},id:t.contentUrl,refine:l(s),type:h(t),lodMetricType:u,lodMetricValue:M,geometricError:M,transform:t.transform,boundingVolume:F}}function d1e(t,e,r){if(e.region){let{childTileX:i,childTileY:n,childTileZ:o}=r,[s,l,u,h,v,T]=e.region,E=2**t,M=(u-s)/E,O=(h-l)/E,F=(T-v)/E,[z,W]=[s+M*i,s+M*(i+1)],[J,K]=[l+O*n,l+O*(n+1)],[ne,ge]=[v+F*o,v+F*(o+1)];return{region:[z,J,W,K,ne,ge]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${JSON.stringify(e)}`)}function mg(t,e,r){return(t<<r)+e}function $C(t,e,r,i,n){let o=p1e({level:e,x:r,y:i,z:n});return t.replace(/{level}|{x}|{y}|{z}/gi,s=>o[s])}function p1e(t){let e={};for(let r in t)e[`{${r}}`]=t[r];return e}function A1e(t,e){let r=Math.floor(t/8),i=t%8;return(e[r]>>i&1)===1}function iF(t,e=""){if(!e)return qu.EMPTY;let i=e.split("?")[0].split(".").pop();switch(i){case"pnts":return qu.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return qu.SCENEGRAPH;default:return i||qu.EMPTY}}function nF(t){switch(t){case"REPLACE":case"replace":return Ul.REPLACE;case"ADD":case"add":return Ul.ADD;default:return t}}function rF(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){let i=new URL(t,`${e}/`);return decodeURI(i.toString())}else if(t.startsWith("/"))return t;return Xc.resolve(e,t)}function YX(t,e){if(!t)return null;let r;if(t.content){let n=t.content.uri||t.content?.url;typeof n<"u"&&(r=rF(n,e))}return{...t,id:r,contentUrl:r,lodMetricType:jd.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:iF(t,r),refine:nF(t.refine)}}async function JX(t,e,r){let i=null,n=ZX(t.root);n&&t.root?i=await KX(t.root,t,e,n,r):i=YX(t.root,e);let o=[];for(o.push(i);o.length>0;){let s=o.pop()||{},l=s.children||[],u=[];for(let h of l){let v=ZX(h),T;v?T=await KX(h,t,e,v,r):T=YX(h,e),T&&(u.push(T),o.push(T))}s.children=u}return i}async function KX(t,e,r,i,n){let{subdivisionScheme:o,maximumLevel:s,availableLevels:l,subtreeLevels:u,subtrees:{uri:h}}=i,v=$C(h,0,0,0,0),T=rF(v,r),E=await _a(T,ZC,n),M=t.content?.uri,O=M?rF(M,r):"",F=e?.root?.refine,z=t.geometricError,W=t.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(W){let ge={box:QC(W),s2VolumeInfo:W};t.boundingVolume=ge}let J=t.boundingVolume,K={contentUrlTemplate:O,subtreesUriTemplate:h,subdivisionScheme:o,subtreeLevels:u,maximumLevel:Number.isFinite(l)?l-1:s,refine:F,basePath:r,lodMetricType:jd.GEOMETRIC_ERROR,rootLodMetricValue:z,rootBoundingVolume:J,getTileType:iF,getRefine:nF};return await m1e(t,r,E,K,n)}async function m1e(t,e,r,i,n){if(!t)return null;let{children:o,contentUrl:s}=await tF({subtree:r,implicitOptions:i,loaderOptions:n}),l,u=null;return s&&(l=s,u={uri:s.replace(`${e}/`,"")}),{...t,id:l,contentUrl:l,lodMetricType:jd.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:iF(t,l),refine:nF(t.refine),content:u||t.content,children:o}}function ZX(t){return t?.extensions?.["3DTILES_implicit_tiling"]||t?.implicitTiling}var eM={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:GC,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:g1e,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function g1e(t,e={},r){let i=e["3d-tiles"]||{},n;return i.isTileset==="auto"?n=r?.url&&r.url.indexOf(".json")!==-1:n=i.isTileset,n?_1e(t,e,r):y1e(t,e,r)}async function _1e(t,e,r){let i=JSON.parse(new TextDecoder().decode(t)),n=r?.url||"",o=v1e(n),s=await JX(i,o,e||{});return{...i,shape:"tileset3d",loader:eM,url:n,queryString:r?.queryString||"",basePath:o,root:s||i.root,type:el.TILES3D,lodMetricType:jd.GEOMETRIC_ERROR,lodMetricValue:i.root?.geometricError||0}}async function y1e(t,e,r){let i={content:{shape:"tile3d",featureIds:null}};return await zL(t,0,e,r,i.content),i.content}function v1e(t){return Xc.dirname(t)}var QX=[0],x1e={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:eM,onTilesetLoad:{type:"function",value:t=>{}},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:(t,e,r)=>{}},_getMeshColor:{type:"function",value:t=>[255,255,255]}},tM=class extends es{initializeState(){"onTileLoadFail"in this.props&&ur.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({props:e,oldProps:r,changeFlags:i}){if(e.data&&e.data!==r.data&&this._loadTileset(e.data),i.viewportChanged){let{activeViewports:n}=this.state;Object.keys(n).length&&(this._updateTileset(n),this.state.lastUpdatedViewports=n,this.state.activeViewports={})}if(i.propsChanged){let{layerMap:n}=this.state;for(let o in n)n[o].needsUpdate=!0}}activateViewport(e){let{activeViewports:r,lastUpdatedViewports:i}=this.state;this.internalState.viewport=e,r[e.id]=e;let n=i?.[e.id];(!n||!e.equals(n))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:e,sourceLayer:r}){let i=r&&r.props.tile;return e.picked&&(e.object=i),e.sourceTile=i,e}filterSubLayer({layer:e,viewport:r}){let{tile:i}=e.props,{id:n}=r;return i.selected&&i.viewportIds.includes(n)}_updateAutoHighlight(e){let r=e.sourceTile,i=this.state.layerMap[r?.id];i&&i.layer&&i.layer.updateAutoHighlight(e)}async _loadTileset(e){let{loadOptions:r={}}=this.props,i=this.props.loader||this.props.loaders,n=Array.isArray(i)?i[0]:i,o={loadOptions:{...r}},s=e;if(n.preload){let h=await n.preload(e,r);h.url&&(s=h.url),h.headers&&(o.loadOptions.fetch={...o.loadOptions.fetch,headers:h.headers}),Object.assign(o,h)}let l=await _a(s,n,o.loadOptions),u=new Nb(l,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...o});this.setState({tileset3d:u,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(u)}_onTileLoad(e){let{lastUpdatedViewports:r}=this.state;this.props.onTileLoad(e),this._updateTileset(r),this.setNeedsUpdate()}_onTileUnload(e){delete this.state.layerMap[e.id],this.props.onTileUnload(e)}_updateTileset(e){if(!e)return;let{tileset3d:r}=this.state,{timeline:i}=this.context,n=Object.keys(e).length;!i||!n||!r||r.selectTiles(Object.values(e)).then(o=>{this.state.frameNumber!==o&&this.setState({frameNumber:o})})}_getSubLayer(e,r){if(!e.content)return null;switch(e.type){case qu.POINTCLOUD:return this._makePointCloudLayer(e,r);case qu.SCENEGRAPH:return this._make3DModelLayer(e);case qu.MESH:return this._makeSimpleMeshLayer(e,r);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${e.content.type}`)}}_makePointCloudLayer(e,r){let{attributes:i,pointCount:n,constantRGBA:o,cartographicOrigin:s,modelMatrix:l}=e.content,{positions:u,normals:h,colors:v}=i;if(!u)return null;let T=r&&r.props.data||{header:{vertexCount:n},attributes:{POSITION:u,NORMAL:h,COLOR_0:v}},{pointSize:E,getPointColor:M}=this.props,O=this.getSubLayerClass("pointcloud",Hm);return new O({pointSize:E},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${e.id}`,tile:e,data:T,coordinateSystem:Zr.METER_OFFSETS,coordinateOrigin:s,modelMatrix:l,getColor:o||M,_offset:0})}_make3DModelLayer(e){let{gltf:r,instances:i,cartographicOrigin:n,modelMatrix:o}=e.content,s=this.getSubLayerClass("scenegraph",ug);return new s({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${e.id}`,tile:e,data:i||QX,scenegraph:r,coordinateSystem:Zr.METER_OFFSETS,coordinateOrigin:n,modelMatrix:o,getTransformMatrix:l=>l.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(e,r){let i=e.content,{attributes:n,indices:o,modelMatrix:s,cartographicOrigin:l,coordinateSystem:u=Zr.METER_OFFSETS,material:h,featureIds:v}=i,{_getMeshColor:T}=this.props,E=r&&r.props.mesh||new Fn({topology:"triangle-list",attributes:b1e(n),indices:o}),M=this.getSubLayerClass("mesh",Db);return new M(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${e.id}`,tile:e,mesh:E,data:QX,getColor:T(e),pbrMaterial:h,modelMatrix:s,coordinateOrigin:l,coordinateSystem:u,featureIds:v,_offset:0})}renderLayers(){let{tileset3d:e,layerMap:r}=this.state;return e?e.tiles.map(i=>{let n=r[i.id]=r[i.id]||{tile:i},{layer:o}=n;return i.selected&&(o?n.needsUpdate&&(o=this._getSubLayer(i,o),n.needsUpdate=!1):o=this._getSubLayer(i)),n.layer=o,o}).filter(Boolean):null}},Ub=tM;(()=>{tM.defaultProps=x1e})(),(()=>{tM.layerName="Tile3DLayer"})();function b1e(t){let e={};return e.positions={...t.positions,value:new Float32Array(t.positions.value)},t.normals&&(e.normals=t.normals),t.texCoords&&(e.texCoords=t.texCoords),t.colors&&(e.colors=t.colors),t.uvRegions&&(e.uvRegions=t.uvRegions),e}var w1e=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function oF(t){return t>>1^-(t&1)}function T1e(t){let e=0,r={};for(let[i,n]of w1e){let o=n===8?t.getFloat64:t.getFloat32;r[i]=o.call(t,e,!0),e+=n}return{header:r,headerEndPosition:e}}function E1e(t,e){let r=e,i=3,n=t.getUint32(r,!0),o=new Uint16Array(n*i);r+=Uint32Array.BYTES_PER_ELEMENT;let s=Uint16Array.BYTES_PER_ELEMENT,l=n*s,u=r,h=u+l,v=h+l,T=0,E=0,M=0;for(let O=0;O<n;O++)T+=oF(t.getUint16(u+s*O,!0)),E+=oF(t.getUint16(h+s*O,!0)),M+=oF(t.getUint16(v+s*O,!0)),o[O]=T,o[O+n]=E,o[O+n*2]=M;return r+=l*3,{vertexData:o,vertexDataEndPosition:r}}function zb(t,e,r,i,n=!0){let o;if(i===2?o=new Uint16Array(t,e,r):o=new Uint32Array(t,e,r),!n)return o;let s=0;for(let l=0;l<o.length;++l){let u=o[l];o[l]=s-u,u===0&&++s}return o}function S1e(t,e,r){let i=r,n=3,s=e.length/n>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;i%s!==0&&(i+=s-i%s);let l=t.getUint32(i,!0);i+=Uint32Array.BYTES_PER_ELEMENT;let u=l*3,h=zb(t.buffer,i,u,s);return i+=u*s,{triangleIndicesEndPosition:i,triangleIndices:h}}function C1e(t,e,r){let i=r,n=3,s=e.length/n>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,l=t.getUint32(i,!0);i+=Uint32Array.BYTES_PER_ELEMENT;let u=zb(t.buffer,i,l,s,!1);i+=l*s;let h=t.getUint32(i,!0);i+=Uint32Array.BYTES_PER_ELEMENT;let v=zb(t.buffer,i,h,s,!1);i+=h*s;let T=t.getUint32(i,!0);i+=Uint32Array.BYTES_PER_ELEMENT;let E=zb(t.buffer,i,T,s,!1);i+=T*s;let M=t.getUint32(i,!0);i+=Uint32Array.BYTES_PER_ELEMENT;let O=zb(t.buffer,i,M,s,!1);return i+=M*s,{edgeIndicesEndPosition:i,westIndices:u,southIndices:v,eastIndices:E,northIndices:O}}function M1e(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function I1e(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function P1e(t,e){let r={};if(t.byteLength<=e)return{extensions:r,extensionsEndPosition:e};let i=e;for(;i<t.byteLength;){let n=t.getUint8(i,!0);i+=Uint8Array.BYTES_PER_ELEMENT;let o=t.getUint32(i,!0);i+=Uint32Array.BYTES_PER_ELEMENT;let s=new DataView(t.buffer,i,o);switch(n){case 1:{r.vertexNormals=M1e(s);break}case 2:{r.waterMask=I1e(s);break}default:}i+=o}return{extensions:r,extensionsEndPosition:i}}var gg={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},R1e={maxDecodingStep:gg.extensions};function sF(t,e){let r=Object.assign({},R1e,e),i=new DataView(t),{header:n,headerEndPosition:o}=T1e(i);if(r.maxDecodingStep<gg.vertices)return{header:n};let{vertexData:s,vertexDataEndPosition:l}=E1e(i,o);if(r.maxDecodingStep<gg.triangleIndices)return{header:n,vertexData:s};let{triangleIndices:u,triangleIndicesEndPosition:h}=S1e(i,s,l);if(r.maxDecodingStep<gg.edgeIndices)return{header:n,vertexData:s,triangleIndices:u};let{westIndices:v,southIndices:T,eastIndices:E,northIndices:M,edgeIndicesEndPosition:O}=C1e(i,s,h);if(r.maxDecodingStep<gg.extensions)return{header:n,vertexData:s,triangleIndices:u,westIndices:v,northIndices:M,eastIndices:E,southIndices:T};let{extensions:F}=P1e(i,O);return{header:n,vertexData:s,triangleIndices:u,westIndices:v,northIndices:M,eastIndices:E,southIndices:T,extensions:F}}function rM(t,e,r,i){let n=i?O1e(i,t.POSITION.value):B1e(e),o=new t.POSITION.value.constructor(n.length*6),s=new t.TEXCOORD_0.value.constructor(n.length*4),l=new e.constructor(n.length*6);for(let h=0;h<n.length;h++){let v=n[h];D1e({edge:v,edgeIndex:h,attributes:t,skirtHeight:r,newPosition:o,newTexcoord0:s,newTriangles:l})}t.POSITION.value=Zv(t.POSITION.value,o),t.TEXCOORD_0.value=Zv(t.TEXCOORD_0.value,s);let u=e instanceof Array?e.concat(l):Zv(e,l);return{attributes:t,triangles:u}}function B1e(t){let e=[];for(let n=0;n<t.length;n+=3)e.push([t[n],t[n+1]]),e.push([t[n+1],t[n+2]]),e.push([t[n+2],t[n]]);e.sort((n,o)=>Math.min(...n)-Math.min(...o)||Math.max(...n)-Math.max(...o));let r=[],i=0;for(;i<e.length;)e[i][0]===e[i+1]?.[1]&&e[i][1]===e[i+1]?.[0]?i+=2:(r.push(e[i]),i++);return r}function O1e(t,e){t.westIndices.sort((i,n)=>e[3*i+1]-e[3*n+1]),t.eastIndices.sort((i,n)=>e[3*n+1]-e[3*i+1]),t.southIndices.sort((i,n)=>e[3*n]-e[3*i]),t.northIndices.sort((i,n)=>e[3*i]-e[3*n]);let r=[];for(let i in t){let n=t[i];for(let o=0;o<n.length-1;o++)r.push([n[o],n[o+1]])}return r}function D1e({edge:t,edgeIndex:e,attributes:r,skirtHeight:i,newPosition:n,newTexcoord0:o,newTriangles:s}){let l=r.POSITION.value.length,u=e*2,h=e*2+1;n.set(r.POSITION.value.subarray(t[0]*3,t[0]*3+3),u*3),n[u*3+2]=n[u*3+2]-i,n.set(r.POSITION.value.subarray(t[1]*3,t[1]*3+3),h*3),n[h*3+2]=n[h*3+2]-i,o.set(r.TEXCOORD_0.value.subarray(t[0]*2,t[0]*2+2),u*2),o.set(r.TEXCOORD_0.value.subarray(t[1]*2,t[1]*2+2),h*2);let v=e*2*3;s[v]=t[0],s[v+1]=l/3+h,s[v+2]=t[1],s[v+3]=l/3+h,s[v+4]=t[0],s[v+5]=l/3+u}function aF(t,e={}){let{bounds:r}=e,{header:i,vertexData:n,triangleIndices:o,westIndices:s,northIndices:l,eastIndices:u,southIndices:h}=sF(t,gg.triangleIndices),v=o,T=L1e(n,i,r),E=pd(T);if(e?.skirtHeight){let{attributes:M,triangles:O}=rM(T,v,e.skirtHeight,{westIndices:s,northIndices:l,eastIndices:u,southIndices:h});T=M,v=O}return{loaderData:{header:{}},header:{vertexCount:v.length,boundingBox:E},schema:void 0,topology:"triangle-list",mode:4,indices:{value:v,size:1},attributes:T}}function L1e(t,e,r){let{minHeight:i,maxHeight:n}=e,[o,s,l,u]=r||[0,0,1,1],h=l-o,v=u-s,T=n-i,E=t.length/3,M=new Float32Array(E*3),O=new Float32Array(E*2);for(let F=0;F<E;F++){let z=t[F]/32767,W=t[F+E]/32767,J=t[F+E*2]/32767;M[3*F+0]=z*h+o,M[3*F+1]=W*v+s,M[3*F+2]=J*T+i,O[2*F+0]=z,O[2*F+1]=W}return{POSITION:{value:M,size:3},TEXCOORD_0:{value:O,size:2}}}var Vb=class{constructor(e=257){this.gridSize=e;let r=e-1;if(r&r-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=r*r*2-2,this.numParentTriangles=this.numTriangles-r*r,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let i=0;i<this.numTriangles;i++){let n=i+2,o=0,s=0,l=0,u=0,h=0,v=0;for(n&1?l=u=h=r:o=s=v=r;(n>>=1)>1;){let E=o+l>>1,M=s+u>>1;n&1?(l=o,u=s,o=h,s=v):(o=l,s=u,l=h,u=v),h=E,v=M}let T=i*4;this.coords[T+0]=o,this.coords[T+1]=s,this.coords[T+2]=l,this.coords[T+3]=u}}createTile(e){return new lF(e,this)}},lF=class{constructor(e,r){let i=r.gridSize;if(e.length!==i*i)throw new Error(`Expected terrain data of length ${i*i} (${i} x ${i}), got ${e.length}.`);this.terrain=e,this.martini=r,this.errors=new Float32Array(e.length),this.update()}update(){let{numTriangles:e,numParentTriangles:r,coords:i,gridSize:n}=this.martini,{terrain:o,errors:s}=this;for(let l=e-1;l>=0;l--){let u=l*4,h=i[u+0],v=i[u+1],T=i[u+2],E=i[u+3],M=h+T>>1,O=v+E>>1,F=M+O-v,z=O+h-M,W=(o[v*n+h]+o[E*n+T])/2,J=O*n+M,K=Math.abs(W-o[J]);if(s[J]=Math.max(s[J],K),l<r){let ne=(v+z>>1)*n+(h+F>>1),ge=(E+z>>1)*n+(T+F>>1);s[J]=Math.max(s[J],s[ne],s[ge])}}}getMesh(e=0){let{gridSize:r,indices:i}=this.martini,{errors:n}=this,o=0,s=0,l=r-1;i.fill(0);function u(M,O,F,z,W,J){let K=M+F>>1,ne=O+z>>1;Math.abs(M-W)+Math.abs(O-J)>1&&n[ne*r+K]>e?(u(W,J,M,O,K,ne),u(F,z,W,J,K,ne)):(i[O*r+M]=i[O*r+M]||++o,i[z*r+F]=i[z*r+F]||++o,i[J*r+W]=i[J*r+W]||++o,s++)}u(0,0,l,l,l,0),u(l,l,0,0,0,l);let h=new Uint16Array(o*2),v=new Uint32Array(s*3),T=0;function E(M,O,F,z,W,J){let K=M+F>>1,ne=O+z>>1;if(Math.abs(M-W)+Math.abs(O-J)>1&&n[ne*r+K]>e)E(W,J,M,O,K,ne),E(F,z,W,J,K,ne);else{let ge=i[O*r+M]-1,j=i[z*r+F]-1,me=i[J*r+W]-1;h[2*ge]=M,h[2*ge+1]=O,h[2*j]=F,h[2*j+1]=z,h[2*me]=W,h[2*me+1]=J,v[T++]=ge,v[T++]=j,v[T++]=me}}return E(0,0,l,l,l,0),E(l,l,0,0,0,l),{vertices:h,triangles:v}}};var Hb=class{constructor(e,r,i=r){this.data=e,this.width=r,this.height=i,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let n=r-1,o=i-1,s=this._addPoint(0,0),l=this._addPoint(n,0),u=this._addPoint(0,o),h=this._addPoint(n,o),v=this._addTriangle(h,s,u,-1,-1,-1);this._addTriangle(s,h,l,v,-1,-1),this._flush()}run(e=1){for(;this.getMaxError()>e;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(e,r){return this.data[this.width*r+e]}_flush(){let e=this.coords;for(let r=0;r<this._pendingLen;r++){let i=this._pending[r],n=2*this.triangles[i*3+0],o=2*this.triangles[i*3+1],s=2*this.triangles[i*3+2];this._findCandidate(e[n],e[n+1],e[o],e[o+1],e[s],e[s+1],i)}this._pendingLen=0}_findCandidate(e,r,i,n,o,s,l){let u=Math.min(e,i,o),h=Math.min(r,n,s),v=Math.max(e,i,o),T=Math.max(r,n,s),E=_g(i,n,o,s,u,h),M=_g(o,s,e,r,u,h),O=_g(e,r,i,n,u,h),F=n-r,z=e-i,W=s-n,J=i-o,K=r-s,ne=o-e,ge=_g(e,r,i,n,o,s),j=this.heightAt(e,r)/ge,me=this.heightAt(i,n)/ge,fe=this.heightAt(o,s)/ge,$=0,Z=0,we=0,Oe=0;for(let he=h;he<=T;he++){let Le=0;E<0&&W!==0&&(Le=Math.max(Le,Math.floor(-E/W))),M<0&&K!==0&&(Le=Math.max(Le,Math.floor(-M/K))),O<0&&F!==0&&(Le=Math.max(Le,Math.floor(-O/F)));let ft=E+W*Le,Vt=M+K*Le,Yt=O+F*Le,mr=!1;for(let Er=u+Le;Er<=v;Er++){if(ft>=0&&Vt>=0&&Yt>=0){mr=!0;let Jr=j*ft+me*Vt+fe*Yt,or=Math.abs(Jr-this.heightAt(Er,he));Oe+=or*or,or>$&&($=or,Z=Er,we=he)}else if(mr)break;ft+=W,Vt+=K,Yt+=F}E+=J,M+=ne,O+=z}(Z===e&&we===r||Z===i&&we===n||Z===o&&we===s)&&($=0),this._candidates[2*l]=Z,this._candidates[2*l+1]=we,this._rms[l]=Oe,this._queuePush(l,$,Oe)}_step(){let e=this._queuePop(),r=e*3+0,i=e*3+1,n=e*3+2,o=this.triangles[r],s=this.triangles[i],l=this.triangles[n],u=this.coords[2*o],h=this.coords[2*o+1],v=this.coords[2*s],T=this.coords[2*s+1],E=this.coords[2*l],M=this.coords[2*l+1],O=this._candidates[2*e],F=this._candidates[2*e+1],z=this._addPoint(O,F);if(_g(u,h,v,T,O,F)===0)this._handleCollinear(z,r);else if(_g(v,T,E,M,O,F)===0)this._handleCollinear(z,i);else if(_g(E,M,u,h,O,F)===0)this._handleCollinear(z,n);else{let W=this._halfedges[r],J=this._halfedges[i],K=this._halfedges[n],ne=this._addTriangle(o,s,z,W,-1,-1,r),ge=this._addTriangle(s,l,z,J,-1,ne+1),j=this._addTriangle(l,o,z,K,ne+2,ge+1);this._legalize(ne),this._legalize(ge),this._legalize(j)}}_addPoint(e,r){let i=this.coords.length>>1;return this.coords.push(e,r),i}_addTriangle(e,r,i,n,o,s,l=this.triangles.length){let u=l/3;return this.triangles[l+0]=e,this.triangles[l+1]=r,this.triangles[l+2]=i,this._halfedges[l+0]=n,this._halfedges[l+1]=o,this._halfedges[l+2]=s,n>=0&&(this._halfedges[n]=l+0),o>=0&&(this._halfedges[o]=l+1),s>=0&&(this._halfedges[s]=l+2),this._candidates[2*u+0]=0,this._candidates[2*u+1]=0,this._queueIndices[u]=-1,this._rms[u]=0,this._pending[this._pendingLen++]=u,l}_legalize(e){let r=this._halfedges[e];if(r<0)return;let i=e-e%3,n=r-r%3,o=i+(e+1)%3,s=i+(e+2)%3,l=n+(r+2)%3,u=n+(r+1)%3,h=this.triangles[s],v=this.triangles[e],T=this.triangles[o],E=this.triangles[l],M=this.coords;if(!F1e(M[2*h],M[2*h+1],M[2*v],M[2*v+1],M[2*T],M[2*T+1],M[2*E],M[2*E+1]))return;let O=this._halfedges[o],F=this._halfedges[s],z=this._halfedges[l],W=this._halfedges[u];this._queueRemove(i/3),this._queueRemove(n/3);let J=this._addTriangle(h,E,T,-1,z,O,i),K=this._addTriangle(E,h,v,J,F,W,n);this._legalize(J+1),this._legalize(K+2)}_handleCollinear(e,r){let i=r-r%3,n=i+(r+1)%3,o=i+(r+2)%3,s=this.triangles[o],l=this.triangles[r],u=this.triangles[n],h=this._halfedges[n],v=this._halfedges[o],T=this._halfedges[r];if(T<0){let j=this._addTriangle(e,s,l,-1,v,-1,i),me=this._addTriangle(s,e,u,j,-1,h);this._legalize(j+1),this._legalize(me+2);return}let E=T-T%3,M=E+(T+2)%3,O=E+(T+1)%3,F=this.triangles[M],z=this._halfedges[M],W=this._halfedges[O];this._queueRemove(E/3);let J=this._addTriangle(s,l,e,v,-1,-1,i),K=this._addTriangle(l,F,e,W,-1,J+1,E),ne=this._addTriangle(F,u,e,z,-1,K+1),ge=this._addTriangle(u,s,e,h,J+2,ne+1);this._legalize(J),this._legalize(K),this._legalize(ne),this._legalize(ge)}_queuePush(e,r,i){let n=this._queue.length;this._queueIndices[e]=n,this._queue.push(e),this._errors.push(r),this._rmsSum+=i,this._queueUp(n)}_queuePop(){let e=this._queue.length-1;return this._queueSwap(0,e),this._queueDown(0,e),this._queuePopBack()}_queuePopBack(){let e=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[e],this._queueIndices[e]=-1,e}_queueRemove(e){let r=this._queueIndices[e];if(r<0){let n=this._pending.indexOf(e);if(n!==-1)this._pending[n]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let i=this._queue.length-1;i!==r&&(this._queueSwap(r,i),this._queueDown(r,i)||this._queueUp(r)),this._queuePopBack()}_queueLess(e,r){return this._errors[e]>this._errors[r]}_queueSwap(e,r){let i=this._queue[e],n=this._queue[r];this._queue[e]=n,this._queue[r]=i,this._queueIndices[i]=r,this._queueIndices[n]=e;let o=this._errors[e];this._errors[e]=this._errors[r],this._errors[r]=o}_queueUp(e){let r=e;for(;;){let i=r-1>>1;if(i===r||!this._queueLess(r,i))break;this._queueSwap(i,r),r=i}}_queueDown(e,r){let i=e;for(;;){let n=2*i+1;if(n>=r||n<0)break;let o=n+1,s=n;if(o<r&&this._queueLess(o,n)&&(s=o),!this._queueLess(s,i))break;this._queueSwap(i,s),i=s}return i>e}};function _g(t,e,r,i,n,o){return(r-n)*(e-o)-(i-o)*(t-n)}function F1e(t,e,r,i,n,o,s,l){let u=t-s,h=e-l,v=r-s,T=i-l,E=n-s,M=o-l,O=u*u+h*h,F=v*v+T*T,z=E*E+M*M;return u*(T*z-F*M)-h*(v*z-F*E)+O*(v*M-T*E)<0}function tY(t,e){let{meshMaxError:r,bounds:i,elevationDecoder:n}=e,{data:o,width:s,height:l}=t,u,h;switch(e.tesselator){case"martini":u=iM(o,s,l,n,e.tesselator),h=$X(r,s,u);break;case"delatin":u=iM(o,s,l,n,e.tesselator),h=eY(r,s,l,u);break;default:s===l&&!(l&s-1)?(u=iM(o,s,l,n,"martini"),h=$X(r,s,u)):(u=iM(o,s,l,n,"delatin"),h=eY(r,s,l,u));break}let{vertices:v}=h,{triangles:T}=h,E=N1e(v,u,s,l,i),M=pd(E);if(e.skirtHeight){let{attributes:O,triangles:F}=rM(E,T,e.skirtHeight);E=O,T=F}return{loaderData:{header:{}},header:{vertexCount:T.length,boundingBox:M},mode:4,indices:{value:Uint32Array.from(T),size:1},attributes:E}}function $X(t,e,r){let i=e+1,o=new Vb(i).createTile(r),{vertices:s,triangles:l}=o.getMesh(t);return{vertices:s,triangles:l}}function eY(t,e,r,i){let n=new Hb(i,e+1,r+1);n.run(t);let{coords:o,triangles:s}=n;return{vertices:o,triangles:s}}function iM(t,e,r,i,n){let{rScaler:o,bScaler:s,gScaler:l,offset:u}=i,h=new Float32Array((e+1)*(r+1));for(let v=0,T=0;T<r;T++)for(let E=0;E<e;E++,v++){let M=v*4,O=t[M+0],F=t[M+1],z=t[M+2];h[v+T]=O*o+F*l+z*s+u}if(n==="martini"){for(let v=(e+1)*e,T=0;T<e;T++,v++)h[v]=h[v-e-1];for(let v=r,T=0;T<r+1;T++,v+=r+1)h[v]=h[v-1]}return h}function N1e(t,e,r,i,n){let o=r+1,s=t.length/2,l=new Float32Array(s*3),u=new Float32Array(s*2),[h,v,T,E]=n||[0,0,r,i],M=(T-h)/r,O=(E-v)/i;for(let F=0;F<s;F++){let z=t[F*2],W=t[F*2+1],J=W*o+z;l[3*F+0]=z*M+h,l[3*F+1]=-W*O+E,l[3*F+2]=e[J],u[2*F+0]=z/r,u[2*F+1]=W/i}return{POSITION:{value:l,size:3},TEXCOORD_0:{value:u,size:2}}}var nM="4.2.0-beta.2";var oM={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:nM,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};var rY={dataType:null,batchType:null,name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:nM,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var k1e={...oM,parse:U1e};async function U1e(t,e,r){let i={...e,mimeType:"application/x.image",image:{...e?.image,type:"data"}},n=await qc(t,[],i,r),o={...k1e.options.terrain,...e?.terrain};return tY(n,o)}var Sft={...rY,parseSync:(t,e)=>aF(t,e?.["quantized-mesh"]),parse:async(t,e)=>aF(t,e?.["quantized-mesh"])};var iY=[1],z1e={...Fh.defaultProps,elevationData:iA,texture:{...iA,optional:!0},meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0,loaders:[oM]};function nY(t){return Array.isArray(t)?t.join(";"):t||""}var sM=class extends es{updateState({props:e,oldProps:r}){let i=e.elevationData!==r.elevationData;if(i){let{elevationData:o}=e,s=o&&(Array.isArray(o)||o.includes("{x}")&&o.includes("{y}"));this.setState({isTiled:s})}let n=i||e.meshMaxError!==r.meshMaxError||e.elevationDecoder!==r.elevationDecoder||e.bounds!==r.bounds;if(!this.state.isTiled&&n){let o=this.loadTerrain(e);this.setState({terrain:o})}e.workerUrl&&ur.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:e,bounds:r,elevationDecoder:i,meshMaxError:n,signal:o}){if(!e)return null;let s=this.getLoadOptions();s={...s,terrain:{skirtHeight:this.state.isTiled?n*2:0,...s?.terrain,bounds:r,meshMaxError:n,elevationDecoder:i}};let{fetch:l}=this.props;return l(e,{propName:"elevationData",layer:this,loadOptions:s,signal:o})}getTiledTerrainData(e){let{elevationData:r,fetch:i,texture:n,elevationDecoder:o,meshMaxError:s}=this.props,{viewport:l}=this.context,u=Lh(r,e),h=n&&Lh(n,e),{signal:v}=e,T=[0,0],E=[0,0];if(l.isGeospatial){let z=e.bbox;T=l.projectFlat([z.west,z.south]),E=l.projectFlat([z.east,z.north])}else{let z=e.bbox;T=[z.left,z.bottom],E=[z.right,z.top]}let M=[T[0],T[1],E[0],E[1]],O=this.loadTerrain({elevationData:u,bounds:M,elevationDecoder:o,meshMaxError:s,signal:v}),F=h?i(h,{propName:"texture",layer:this,loaders:[],signal:v}).catch(z=>null):Promise.resolve(null);return Promise.all([O,F])}renderSubLayers(e){let r=this.getSubLayerClass("mesh",Nh),{color:i,wireframe:n,material:o}=this.props,{data:s}=e;if(!s)return null;let[l,u]=s;return new r(e,{data:iY,mesh:l,texture:u,_instanced:!1,coordinateSystem:Zr.CARTESIAN,getPosition:h=>[0,0,0],getColor:i,wireframe:n,material:o})}onViewportLoad(e){if(!e)return;let{zRange:r}=this.state,i=e.map(s=>s.content).filter(Boolean).map(s=>s[0].header.boundingBox.map(u=>u[2]));if(i.length===0)return;let n=Math.min(...i.map(s=>s[0])),o=Math.max(...i.map(s=>s[1]));(!r||n<r[0]||o>r[1])&&this.setState({zRange:[n,o]})}renderLayers(){let{color:e,material:r,elevationData:i,texture:n,wireframe:o,meshMaxError:s,elevationDecoder:l,tileSize:u,maxZoom:h,minZoom:v,extent:T,maxRequests:E,onTileLoad:M,onTileUnload:O,onTileError:F,maxCacheSize:z,maxCacheByteSize:W,refinementStrategy:J}=this.props;if(this.state.isTiled)return new Fh(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:nY(i),texture:nY(n),meshMaxError:s,elevationDecoder:l}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:u,maxZoom:h,minZoom:v,extent:T,maxRequests:E,onTileLoad:M,onTileUnload:O,onTileError:F,maxCacheSize:z,maxCacheByteSize:W,refinementStrategy:J});if(!i)return null;let K=this.getSubLayerClass("mesh",Nh);return new K(this.getSubLayerProps({id:"mesh"}),{data:iY,mesh:this.state.terrain,texture:n,_instanced:!1,getPosition:ne=>[0,0,0],getColor:e,material:r,wireframe:o})}},jb=sM;(()=>{sM.defaultProps=z1e})(),(()=>{sM.layerName="TerrainLayer"})();var V1e={clipBounds:[0,0,1,1],clipByInstance:void 0},oY=`
uniform vec4 clip_bounds;
bool clip_isInBounds(vec2 position) {
return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];
}
`,H1e={name:"clip-vs",vs:oY},j1e={"vs:#decl":`
out float clip_isVisible;
`,"vs:DECKGL_FILTER_GL_POSITION":`
clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
`,"fs:#decl":`
in float clip_isVisible;
`,"fs:DECKGL_FILTER_COLOR":`
if (clip_isVisible < 0.5) discard;
`},G1e={name:"clip-fs",fs:oY},W1e={"vs:#decl":`
out vec2 clip_commonPosition;
`,"vs:DECKGL_FILTER_GL_POSITION":`
clip_commonPosition = geometry.position.xy;
`,"fs:#decl":`
in vec2 clip_commonPosition;
`,"fs:DECKGL_FILTER_COLOR":`
if (!clip_isInBounds(clip_commonPosition)) discard;
`},aM=class extends Nm{getShaders(){let e="instancePositions"in this.getAttributeManager().attributes;return this.props.clipByInstance!==void 0&&(e=Boolean(this.props.clipByInstance)),this.state.clipByInstance=e,e?{modules:[H1e],inject:j1e}:{modules:[G1e],inject:W1e}}draw({uniforms:e}){let{clipBounds:r}=this.props;if(this.state.clipByInstance)e.clip_bounds=r;else{let i=this.projectPosition([r[0],r[1],0]),n=this.projectPosition([r[2],r[3],0]);e.clip_bounds=[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[0],n[0]),Math.max(i[1],n[1])]}}},ay=aM;(()=>{aM.defaultProps=V1e})(),(()=>{aM.extensionName="ClipExtension"})();function fF(t,e,r){let i=q1e(t),n=Object.keys(i).filter(o=>i[o]!==Array);return X1e(t,{propArrayTypes:i,...e},{numericPropKeys:r&&r.numericPropKeys||n,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function q1e(t){let e={};for(let r of t)if(r.properties)for(let i in r.properties){let n=r.properties[i];e[i]=$1e(n,e[i])}return e}function X1e(t,e,r){let{pointPositionsCount:i,pointFeaturesCount:n,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:l,polygonPositionsCount:u,polygonObjectsCount:h,polygonRingsCount:v,polygonFeaturesCount:T,propArrayTypes:E,coordLength:M}=e,{numericPropKeys:O=[],PositionDataType:F=Float32Array,triangulate:z=!0}=r,W=t[0]&&"id"in t[0],J=t.length>65535?Uint32Array:Uint16Array,K={type:"Point",positions:new F(i*M),globalFeatureIds:new J(i),featureIds:n>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},ne={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new F(o*M),globalFeatureIds:new J(o),featureIds:l>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},ge={type:"Polygon",polygonIndices:u>65535?new Uint32Array(h+1):new Uint16Array(h+1),primitivePolygonIndices:u>65535?new Uint32Array(v+1):new Uint16Array(v+1),positions:new F(u*M),globalFeatureIds:new J(u),featureIds:T>65535?new Uint32Array(u):new Uint16Array(u),numericProps:{},properties:[],fields:[]};z&&(ge.triangles=[]);for(let me of[K,ne,ge])for(let fe of O){let $=E[fe];me.numericProps[fe]=new $(me.positions.length/M)}ne.pathIndices[s]=o,ge.polygonIndices[h]=u,ge.primitivePolygonIndices[v]=u;let j={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let me of t){let fe=me.geometry,$=me.properties||{};switch(fe.type){case"Point":Y1e(fe,K,j,M,$),K.properties.push(uF($,O)),W&&K.fields.push({id:me.id}),j.pointFeature++;break;case"LineString":K1e(fe,ne,j,M,$),ne.properties.push(uF($,O)),W&&ne.fields.push({id:me.id}),j.lineFeature++;break;case"Polygon":Z1e(fe,ge,j,M,$),ge.properties.push(uF($,O)),W&&ge.fields.push({id:me.id}),j.polygonFeature++;break;default:throw new Error("Invalid geometry type")}j.feature++}return Q1e(K,ne,ge,M)}function Y1e(t,e,r,i,n){e.positions.set(t.data,r.pointPosition*i);let o=t.data.length/i;hF(e,n,r.pointPosition,o),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function K1e(t,e,r,i,n){e.positions.set(t.data,r.linePosition*i);let o=t.data.length/i;hF(e,n,r.linePosition,o),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let s=0,l=t.indices.length;s<l;++s){let u=t.indices[s],h=s===l-1?t.data.length:t.indices[s+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(h-u)/i}}function Z1e(t,e,r,i,n){e.positions.set(t.data,r.polygonPosition*i);let o=t.data.length/i;hF(e,n,r.polygonPosition,o),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let s=0,l=t.indices.length;s<l;++s){let u=r.polygonPosition;e.polygonIndices[r.polygonObject++]=u;let h=t.areas[s],v=t.indices[s],T=t.indices[s+1];for(let M=0,O=v.length;M<O;++M){let F=v[M],z=M===O-1?T===void 0?t.data.length:T[0]:v[M+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(z-F)/i}let E=r.polygonPosition;J1e(e,h,v,{startPosition:u,endPosition:E,coordLength:i})}}function J1e(t,e,r,{startPosition:i,endPosition:n,coordLength:o}){if(!t.triangles)return;let s=i*o,l=n*o,u=t.positions.subarray(s,l),h=r[0],v=r.slice(1).map(E=>(E-h)/o),T=DO(u,v,o,e);for(let E=0,M=T.length;E<M;++E)t.triangles.push(i+T[E])}function cF(t,e){let r={};for(let i in t)r[i]={value:t[i],size:e};return r}function Q1e(t,e,r,i){let n={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:i},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:cF(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:i},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:cF(e.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:i},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:cF(r.numericProps,1)}};return n.polygons&&r.triangles&&(n.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),n}function hF(t,e,r,i){for(let n in t.numericProps)if(n in e){let o=e[n];t.numericProps[n].fill(o,r,r+i)}}function uF(t,e){let r={};for(let i in t)e.includes(i)||(r[i]=t[i]);return r}function $1e(t,e){return e===Array||!Number.isFinite(t)?Array:e===Float64Array||Math.fround(t)!==t?Float64Array:Float32Array}function uM(t,e){let r=e?.globalFeatureId;return r!==void 0?ebe(t,r):tbe(t,e?.type)}function ebe(t,e){let r=aY(t);for(let i of r){let n=0,o=i.featureIds.value[0];for(let s=0;s<i.featureIds.value.length;s++){let l=i.featureIds.value[s];if(l!==o){if(e===i.globalFeatureIds.value[n])return lM(i,n,s);n=s,o=l}}if(e===i.globalFeatureIds.value[n])return lM(i,n,i.featureIds.value.length)}throw new Error(`featureId:${e} not found`)}function tbe(t,e){let r=aY(t,e);return rbe(r)}function sY(t,e,r){switch(t.type){case"Point":return sbe(t,e,r);case"LineString":return obe(t,e,r);case"Polygon":return lY(t,e,r);default:let i=t;throw new Error(`Unsupported geometry type: ${i?.type}`)}}function aY(t,e){let r=[];return t.points&&(t.points.type="Point",r.push(t.points)),t.lines&&(t.lines.type="LineString",r.push(t.lines)),t.polygons&&(t.polygons.type="Polygon",r.push(t.polygons)),r}function rbe(t){let e=[];for(let r of t){if(r.featureIds.value.length===0)continue;let i=0,n=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let s=r.featureIds.value[o];s!==n&&(e.push(lM(r,i,o)),i=o,n=s)}e.push(lM(r,i,r.featureIds.value.length))}return e}function lM(t,e,r){let i=sY(t,e,r),n=nbe(t,e,r),o=ibe(t,e,r);return{type:"Feature",geometry:i,properties:n,...o}}function ibe(t,e=0,r){return t.fields&&t.fields[t.featureIds.value[e]]}function nbe(t,e=0,r){let i=Object.assign({},t.properties[t.featureIds.value[e]]);for(let n in t.numericProps)i[n]=t.numericProps[n].value[e];return i}function lY(t,e=-1/0,r=1/0){let{positions:i}=t,n=t.polygonIndices.value.filter(u=>u>=e&&u<=r),o=t.primitivePolygonIndices.value.filter(u=>u>=e&&u<=r);if(!(n.length>2)){let u=[];for(let h=0;h<o.length-1;h++){let v=o[h],T=o[h+1],E=cM(i,v,T);u.push(E)}return{type:"Polygon",coordinates:u}}let l=[];for(let u=0;u<n.length-1;u++){let h=n[u],v=n[u+1],T=lY(t,h,v).coordinates;l.push(T)}return{type:"MultiPolygon",coordinates:l}}function obe(t,e=-1/0,r=1/0){let{positions:i}=t,n=t.pathIndices.value.filter(l=>l>=e&&l<=r);if(!(n.length>2))return{type:"LineString",coordinates:cM(i,n[0],n[1])};let s=[];for(let l=0;l<n.length-1;l++){let u=cM(i,n[l],n[l+1]);s.push(u)}return{type:"MultiLineString",coordinates:s}}function sbe(t,e,r){let{positions:i}=t,n=cM(i,e,r);return n.length>1?{type:"MultiPoint",coordinates:n}:{type:"Point",coordinates:n[0]}}function cM(t,e,r){e=e||0,r=r||t.value.length/t.size;let i=[];for(let n=e;n<r;n++){let o=Array();for(let s=n*t.size;s<(n+1)*t.size;s++)o.push(Number(t.value[s]));i.push(o)}return i}var yF=ga(AY(),1);function mY(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let o=0;o<e;o++){let s=Tbe(t[o]);s!==0&&(n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[t[o]]):i&&i.push(t[o]))}return i&&r.push(i),r}function Tbe(t){let e=0;for(let r=0,i=t.length-1,n,o;r<t.length;i=r++)n=t[r],o=t[i],e+=(o[0]-n[0])*(n[1]+o[1]);return e}function gY(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?Ebe(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function Ebe(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let i=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[i]=n}}var uy=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(e,r,i,n,o){this.properties={},this.extent=i,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,e.readFields(gY,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,i=1,n=0,o=0,s=0,l=[],u;for(;e.pos<r;){if(n<=0){let h=e.readVarint();i=h&7,n=h>>3}if(n--,i===1||i===2)o+=e.readSVarint(),s+=e.readSVarint(),i===1&&(u&&l.push(u),u=[]),u&&u.push([o,s]);else if(i===7)u&&u.push(u[0].slice());else throw new Error(`unknown command ${i}`)}return u&&l.push(u),l}bbox(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,i=1,n=0,o=0,s=0,l=1/0,u=-1/0,h=1/0,v=-1/0;for(;e.pos<r;){if(n<=0){let T=e.readVarint();i=T&7,n=T>>3}if(n--,i===1||i===2)o+=e.readSVarint(),s+=e.readSVarint(),o<l&&(l=o),o>u&&(u=o),s<h&&(h=s),s>v&&(v=s);else if(i!==7)throw new Error(`unknown command ${i}`)}return[l,h,u,v]}_toGeoJSON(e){let r=this.loadGeometry(),i=uy.types[this.type],n,o;switch(this.type){case 1:let l=[];for(n=0;n<r.length;n++)l[n]=r[n][0];r=l,e(r,this);break;case 2:for(n=0;n<r.length;n++)e(r[n],this);break;case 3:for(r=mY(r),n=0;n<r.length;n++)for(o=0;o<r[n].length;o++)e(r[n][o],this);break}r.length===1?r=r[0]:i=`Multi${i}`;let s={type:"Feature",geometry:{type:i,coordinates:r},properties:this.properties};return this.id!==null&&(s.id=this.id),s}toGeoJSON(e){if(typeof e=="function")return this._toGeoJSON(e);let{x:r,y:i,z:n}=e,o=this.extent*Math.pow(2,n),s=this.extent*r,l=this.extent*i;function u(h){for(let v=0;v<h.length;v++){let T=h[v];T[0]=(T[0]+s)*360/o-180;let E=180-(T[1]+l)*360/o;T[1]=360/Math.PI*Math.atan(Math.exp(E*Math.PI/180))-90}}return this._toGeoJSON(u)}};var dM=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(e,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Sbe,this,r),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let r=this._pbf.readVarint()+this._pbf.pos;return new uy(this._pbf,r,this.extent,this._keys,this._values)}};function Sbe(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(Cbe(r)))}function Cbe(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let i=t.readVarint()>>3;e=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null}return e}var pM=class{layers;constructor(e,r){this.layers=e.readFields(Mbe,{},r)}};function Mbe(t,e,r){if(t===3&&r){let i=new dM(r,r.readVarint()+r.pos);i.length&&e&&(e[i.name]=i)}}function _Y(t){let e=t.indices.length,r="Polygon";if(e<=1)return{type:r,data:t.data,areas:[[qp(t.data)]],indices:[t.indices]};let i=[],n=[],o=[],s=[],l,u=0;for(let h,v=0,T;v<e;v++){T=t.indices[v]-u,h=t.indices[v+1]-u||t.data.length;let E=t.data.slice(T,h),M=qp(E);if(M===0){let O=t.data.slice(0,T),F=t.data.slice(h);t.data=O.concat(F),u+=h-T;continue}l===void 0&&(l=M<0),l===M<0?(s.length&&(i.push(o),n.push(s)),s=[T],o=[M]):(o.push(M),s.push(T))}return o&&i.push(o),s.length&&n.push(s),{type:r,areas:i,indices:n,data:t.data}}function yY(t,e,r,i){for(let n=0,o=t.length;n<o;n+=2){t[n]=(t[n]+e)*360/i-180;let s=180-(t[n+1]+r)*360/i;t[n+1]=360/Math.PI*Math.atan(Math.exp(s*Math.PI/180))-90}}function vY(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?Ibe(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function Ibe(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let i=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[i]=n}}var xY,yg,AF,AM,mF,gF,Gb;var mM=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(e,r,i,n,o,s){this.properties={},this.extent=i,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,this._geometryInfo=s,e.readFields(vY,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry,xY=e.readVarint()+e.pos,yg=1,AM=0,mF=0,gF=0,Gb=0;let r=[],i=[];for(;e.pos<xY;)if(AM<=0&&(AF=e.readVarint(),yg=AF&7,AM=AF>>3),AM--,yg===1||yg===2)mF+=e.readSVarint(),gF+=e.readSVarint(),yg===1&&r.push(Gb),i.push(mF,gF),Gb+=2;else if(yg===7){if(Gb>0){let n=r[r.length-1];i.push(i[n],i[n+1]),Gb+=2}}else throw new Error(`unknown command ${yg}`);return{data:i,indices:r}}_toBinaryCoordinates(e){let r=this.loadGeometry(),i;e(r.data,this);let n=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=r.indices.length,i={type:"Point",...r};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=r.indices.length,this._geometryInfo.linePositionsCount+=r.data.length/n,i={type:"LineString",...r};break;case 3:i=_Y(r),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=i.indices.length;for(let s of i.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=i.data.length/n;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:i,properties:this.properties};return this.id!==null&&(o.id=this.id),o}toBinaryCoordinates(e){if(typeof e=="function")return this._toBinaryCoordinates(e);let{x:r,y:i,z:n}=e,o=this.extent*Math.pow(2,n),s=this.extent*r,l=this.extent*i;return this._toBinaryCoordinates(u=>yY(u,s,l,o))}};var gM=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(e,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Pbe,this,r),this.length=this._features.length}feature(e,r){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let i=this._pbf.readVarint()+this._pbf.pos;return new mM(this._pbf,i,this.extent,this._keys,this._values,r)}};function Pbe(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(Rbe(r)))}function Rbe(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let i=t.readVarint()>>3;e=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null}return e}var _M=class{layers;constructor(e,r){this.layers=e.readFields(Bbe,{},r)}};function Bbe(t,e,r){if(t===3&&r){let i=new gM(r,r.readVarint()+r.pos);i.length&&e&&(e[i.name]=i)}}function vF(t,e){let r=Dbe(e),i=e?.gis?.format||e?.mvt?.shape||e?.shape;switch(i){case"columnar-table":return{shape:"columnar-table",data:_F(t,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:bY(t,r)};case"geojson":return bY(t,r);case"binary-geometry":return _F(t,r);case"binary":return _F(t,r);default:throw new Error(i||"undefined shape")}}function _F(t,e){let[r,i]=Obe(t,e),n=fF(r,i);return n.byteLength=t.byteLength,n}function Obe(t,e){let r=[],i={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength<=0)return[r,i];let n=new _M(new yF.default(t));return(e&&Array.isArray(e.layers)?e.layers:Object.keys(n.layers)).forEach(s=>{let l=n.layers[s];if(l)for(let u=0;u<l.length;u++){let h=l.feature(u,i),v=Fbe(h,e,s);r.push(v)}}),[r,i]}function bY(t,e){if(t.byteLength<=0)return[];let r=[],i=new pM(new yF.default(t));return(Array.isArray(e.layers)?e.layers:Object.keys(i.layers)).forEach(o=>{let s=i.layers[o];if(s)for(let l=0;l<s.length;l++){let u=s.feature(l),h=Lbe(u,e,o);r.push(h)}}),r}function Dbe(t){if(!t?.mvt)throw new Error("mvt options required");let e=t.mvt?.coordinates==="wgs84",{tileIndex:r}=t.mvt,i=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.z);if(e&&!i)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return t.mvt}function Lbe(t,e,r){let i=t.toGeoJSON(e.coordinates==="wgs84"?e.tileIndex:Nbe);return e.layerProperty&&(i.properties[e.layerProperty]=r),i}function Fbe(t,e,r){let i=t.toBinaryCoordinates(e.coordinates==="wgs84"?e.tileIndex:kbe);return e.layerProperty&&i.properties&&(i.properties[e.layerProperty]=r),i}function Nbe(t,e){let{extent:r}=e;for(let i=0;i<t.length;i++){let n=t[i];n[0]/=r,n[1]/=r}}function kbe(t,e){let{extent:r}=e;for(let i=0,n=t.length;i<n;++i)t[i]/=r}var Ube="4.2.0-beta.2",yM={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:Ube,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:null}}},zbe={...yM,parse:async(t,e)=>vF(t,e),parseSync:vF,binary:!0};var Vbe={Point:wY,MultiPoint:Hbe,LineString:TY,MultiLineString:jbe,Polygon:EY,MultiPolygon:Gbe};function wY([t,e],[r,i],n){let o=Oa(r[0],i[0],t),s=Oa(r[1],i[1],e);return n.unprojectFlat([o,s])}function xF(t,e,r){return t.map(i=>wY(i,e,r))}function Hbe(t,e,r){return xF(t,e,r)}function TY(t,e,r){return xF(t,e,r)}function jbe(t,e,r){return t.map(i=>TY(i,e,r))}function EY(t,e,r){return t.map(i=>xF(i,e,r))}function Gbe(t,e,r){return t.map(i=>EY(i,e,r))}function SY(t,e,r){let i=r.projectFlat([e.west,e.north]),n=r.projectFlat([e.east,e.south]),o=[i,n];return{...t,coordinates:Vbe[t.type](t.coordinates,o,r)}}var Wbe=["points","lines","polygons"];function bF(t,e,r,i){for(let n of Wbe){let o=t[n]&&qbe(t[n],e,r,i);if(o>=0)return o}return-1}function qbe(t,e,r,i){let n=t.featureIds.value;if(!n.length)return-1;let o=0,s=n[n.length-1]+1;if(i){let u=Xbe(t,i);if(u)o=u[0],s=u[1]+1;else return-1}let l=-1;if(e in t.numericProps){let u=t.numericProps[e].value.findIndex((h,v)=>h===r&&n[v]>=o&&n[v]<s);return u>=0?t.globalFeatureIds.value[u]:-1}else e?l=CY(t.properties,u=>u[e]===r,o,s):t.fields&&(l=CY(t.fields,u=>u.id===r,o,s));return l>=0?Ybe(t,l):-1}function Xbe(t,e){if(!t.__layers){let r={},{properties:i}=t;for(let n=0;n<i.length;n++){let{layerName:o}=i[n];o&&(r[o]?r[o][1]=n:r[o]=[n,n])}t.__layers=r}return t.__layers[e]}function Ybe(t,e){if(!t.__ids){let r=[],i=t.featureIds.value,n=t.globalFeatureIds.value;for(let o=0;o<i.length;o++)r[i[o]]=n[o];t.__ids=r}return t.__ids[e]}function CY(t,e,r,i){for(let n=r;n<i;n++)if(e(t[n],n))return n;return-1}var wF=512,Kbe={...Oh.defaultProps,data:iA,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[yM],binary:!0},vM=class extends Fh{initializeState(){super.initializeState();let e=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:e,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:e,oldProps:r,context:i,changeFlags:n}){n.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:e,oldProps:r,context:i,changeFlags:n}),this._setWGS84PropertyForTiles());let{highlightColor:o}=e;o!==r.highlightColor&&Array.isArray(o)&&this.setState({highlightColor:o})}async _updateTileData(){let e=this.props.data,r=null;if(typeof e=="string"&&!DD(e)){let{onDataLoad:i,fetch:n}=this.props;this.setState({data:null,tileJSON:null});try{r=await n(e,{propName:"data",layer:this,loaders:[]})}catch(o){this.raiseError(o,"loading TileJSON"),e=null}i&&i(r,{propName:"data",layer:this})}else e&&typeof e=="object"&&"tilejson"in e&&(r=e);r&&(e=r.tiles),this.setState({data:e,tileJSON:r})}_getTilesetOptions(){let e=super._getTilesetOptions(),r=this.state.tileJSON,{minZoom:i,maxZoom:n}=this.props;return r&&(Number.isFinite(r.minzoom)&&r.minzoom>i&&(e.minZoom=r.minzoom),Number.isFinite(r.maxzoom)&&(!Number.isFinite(n)||r.maxzoom<n)&&(e.maxZoom=r.maxzoom)),e}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(e){let{data:r,binary:i}=this.state,{index:n,signal:o}=e,s=Lh(r,e);if(!s)return Promise.reject("Invalid URL");let l=this.getLoadOptions(),{fetch:u}=this.props;return l={...l,mimeType:"application/x-protobuf",mvt:{...l?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:n},gis:i?{format:"binary"}:{}},u(s,{propName:"data",layer:this,loadOptions:l,signal:o})}renderSubLayers(e){let{x:r,y:i,z:n}=e.tile.index,o=Math.pow(2,n),s=wF/o,l=-s,u=wF*r/o,h=wF*(1-i/o),v=new Kr().scale([s,l,1]);e.autoHighlight=!1,this.context.viewport.resolution||(e.modelMatrix=v,e.coordinateOrigin=[u,h,0],e.coordinateSystem=Zr.CARTESIAN,e.extensions=[...e.extensions||[],new ay]);let T=super.renderSubLayers(e);return this.state.binary&&!(T instanceof Oh)&&ur.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),T}_updateAutoHighlight(e){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:i,hoveredFeatureLayerName:n}=this.state,o=e.object,s=null,l=null;o&&(s=TF(o,r),l=MY(o));let{highlightColor:u}=this.props;typeof u=="function"&&(u=u(e)),(i!==s||n!==l)&&this.setState({highlightColor:u,hoveredFeatureId:s,hoveredFeatureLayerName:l})}getPickingInfo(e){let r=super.getPickingInfo(e),i=Boolean(this.context.viewport.resolution);if(this.state.binary&&r.index!==-1){let{data:n}=e.sourceLayer.props;r.object=uM(n,{globalFeatureId:r.index})}return r.object&&!i&&(r.object=PY(r.object,r.tile.bbox,this.context.viewport)),r}getSubLayerPropsByTile(e){return{highlightedObjectIndex:this.getHighlightedObjectIndex(e),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(e){let{hoveredFeatureId:r,hoveredFeatureLayerName:i,binary:n}=this.state,{uniqueIdProperty:o,highlightedFeatureId:s}=this.props,l=e.content,u=IY(s);if(!(IY(r)||u))return-1;let v=u?s:r;return Array.isArray(l)?l.findIndex(T=>{let E=TF(T,o)===v,M=u||MY(T)===i;return E&&M}):l&&n?bF(l,o,v,u?"":i):-1}_pickObjects(e){let{deck:r,viewport:i}=this.context,n=i.width,o=i.height,s=i.x,l=i.y,u=[this.id];return r.pickObjects({x:s,y:l,width:n,height:o,layerIds:u,maxObjects:e})}getRenderedFeatures(e=null){let r=this._pickObjects(e),i=new Set,n=[];for(let o of r){let s=TF(o.object,this.props.uniqueIdProperty);s===void 0?n.push(o.object):i.has(s)||(i.add(s),n.push(o.object))}return n}_setWGS84PropertyForTiles(){let e="dataInWGS84";this.state.tileset.selectedTiles.forEach(i=>{i.hasOwnProperty(e)||Object.defineProperty(i,e,{get:()=>{if(!i.content)return null;if(this.state.binary&&Array.isArray(i.content)&&!i.content.length)return[];let{bbox:n}=i;if(i._contentWGS84===void 0&&LD(n)){let o=this.state.binary?uM(i.content):i.content;i._contentWGS84=o.map(s=>PY(s,n,this.context.viewport))}return i._contentWGS84}})})}},Wb=vM;(()=>{vM.layerName="MVTLayer"})(),(()=>{vM.defaultProps=Kbe})();function TF(t,e){if(t.properties&&e)return t.properties[e];if("id"in t)return t.id}function MY(t){return t.properties?.layerName||null}function IY(t){return t!=null&&t!==""}function PY(t,e,r){let i={...t,geometry:{type:t.geometry.type}};return Object.defineProperty(i.geometry,"coordinates",{get:()=>SY(t.geometry,e,r).coordinates}),i}var RY="0123456789bcdefghjkmnpqrstuvwxyz",BY={};for(let t=0;t<RY.length;t++)BY[RY.charAt(t)]=t;var Zbe=-90,Jbe=90,Qbe=-180,$be=180;function ewe(t){let e=!0,r=Jbe,i=Zbe,n=$be,o=Qbe,s,l=0;for(let u=0,h=t.length;u<h;u++){let v=t[u].toLowerCase();l=BY[v];for(let T=4;T>=0;T--){let E=l>>T&1;e?(s=(n+o)/2,E===1?o=s:n=s):(s=(r+i)/2,E===1?i=s:r=s),e=!e}}return[i,o,r,n]}function OY(t){let[e,r,i,n]=ewe(t);return[n,i,n,e,r,e,r,i,n,i]}var twe={getGeohash:{type:"accessor",value:t=>t.geohash}},xM=class extends eu{indexToBounds(){let{data:e,getGeohash:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(i,n)=>OY(r(i,n))}}},qb=xM;(()=>{xM.layerName="GeohashLayer"})(),(()=>{xM.defaultProps=twe})();function fy(t,e=""){if(!t)throw new Error(`JSON conversion error ${e}`)}function LY(t,e){let r=iwe(e),i=t;for(let n of r)i=rwe(i)?i[n]:void 0;return i}function rwe(t){return t!==null&&typeof t=="object"}var DY={};function iwe(t){if(typeof t=="string"){let e=DY[t];return e||(e=t.split("."),DY[t]=e),e}return Array.isArray(t)?t:[t]}var SF={};As(SF,{addBinaryOp:()=>lwe,addUnaryOp:()=>awe,compile:()=>owe,compileAsync:()=>swe,eval:()=>tl,evalAsync:()=>Yb,parse:()=>zY.default});var hy=ga(EF()),zY=ga(EF()),Yb=function t(e,r){try{var i,n=e;switch(n.type){case"ArrayExpression":return Promise.resolve(NY(n.elements,r));case"BinaryExpression":return Promise.resolve(Promise.all([t(n.left,r),t(n.right,r)])).then(function(M){return dy[n.operator](M[0],M[1])});case"CallExpression":var o,s,l,u=function(){if(typeof s=="function"){var M=s,O=M.apply,F=o;return Promise.resolve(NY(n.arguments,r)).then(function(z){return Promise.resolve(O.call(M,F,z))})}},h=n.callee.type==="MemberExpression"?Promise.resolve(FY(n.callee,r)).then(function(M){o=(l=M)[0],s=l[1]}):Promise.resolve(t(n.callee,r)).then(function(M){s=M});return Promise.resolve(h&&h.then?h.then(u):u());case"ConditionalExpression":return Promise.resolve(t(n.test,r)).then(function(M){return Promise.resolve(t(M?n.consequent:n.alternate,r))});case"Identifier":return Promise.resolve(r[n.name]);case"Literal":return Promise.resolve(n.value);case"LogicalExpression":var v=function(M){return i?M:Promise.resolve(Promise.all([t(n.left,r),t(n.right,r)])).then(function(O){return dy[n.operator](O[0],O[1])})},T=n.operator==="||"?(i=1,Promise.resolve(t(n.left,r)).then(function(M){return M||Promise.resolve(t(n.right,r))})):function(){if(n.operator==="&&")return i=1,Promise.resolve(t(n.left,r)).then(function(M){return M&&Promise.resolve(t(n.right,r))})}();return Promise.resolve(T&&T.then?T.then(v):v(T));case"MemberExpression":return Promise.resolve(FY(n,r)).then(function(M){return M[1]});case"ThisExpression":return Promise.resolve(r);case"UnaryExpression":var E=wM[n.operator];return Promise.resolve(t(n.argument,r)).then(function(M){return E.call(wM,M)});default:return Promise.resolve(void 0)}}catch(M){return Promise.reject(M)}},FY=function(t,e){try{return Promise.resolve(Yb(t.object,e)).then(function(r){function i(){if(/^__proto__|prototype|constructor$/.test(n))throw Error('Access to member "'+n+'" disallowed.');return[r,r[n]]}var n,o=function(){if(t.computed)return Promise.resolve(Yb(t.property,e)).then(function(s){n=s});n=t.property.name}();return o&&o.then?o.then(i):i()})}catch(r){return Promise.reject(r)}},NY=function(t,e){try{return Promise.resolve(Promise.all(t.map(function(r){return Yb(r,e)})))}catch(r){return Promise.reject(r)}},nwe={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},dy={"||":function(t,e){return t||e},"&&":function(t,e){return t&&e},"|":function(t,e){return t|e},"^":function(t,e){return t^e},"&":function(t,e){return t&e},"==":function(t,e){return t==e},"!=":function(t,e){return t!=e},"===":function(t,e){return t===e},"!==":function(t,e){return t!==e},"<":function(t,e){return t<e},">":function(t,e){return t>e},"<=":function(t,e){return t<=e},">=":function(t,e){return t>=e},"<<":function(t,e){return t<<e},">>":function(t,e){return t>>e},">>>":function(t,e){return t>>>e},"+":function(t,e){return t+e},"-":function(t,e){return t-e},"*":function(t,e){return t*e},"/":function(t,e){return t/e},"%":function(t,e){return t%e}},wM={"-":function(t){return-t},"+":function(t){return+t},"~":function(t){return~t},"!":function(t){return!t}};function kY(t,e){return t.map(function(r){return tl(r,e)})}function UY(t,e){var r,i=tl(t.object,e);if(r=t.computed?tl(t.property,e):t.property.name,/^__proto__|prototype|constructor$/.test(r))throw Error('Access to member "'+r+'" disallowed.');return[i,i[r]]}function tl(t,e){var r=t;switch(r.type){case"ArrayExpression":return kY(r.elements,e);case"BinaryExpression":return dy[r.operator](tl(r.left,e),tl(r.right,e));case"CallExpression":var i,n,o;return r.callee.type==="MemberExpression"?(i=(o=UY(r.callee,e))[0],n=o[1]):n=tl(r.callee,e),typeof n!="function"?void 0:n.apply(i,kY(r.arguments,e));case"ConditionalExpression":return tl(r.test,e)?tl(r.consequent,e):tl(r.alternate,e);case"Identifier":return e[r.name];case"Literal":return r.value;case"LogicalExpression":return r.operator==="||"?tl(r.left,e)||tl(r.right,e):r.operator==="&&"?tl(r.left,e)&&tl(r.right,e):dy[r.operator](tl(r.left,e),tl(r.right,e));case"MemberExpression":return UY(r,e)[1];case"ThisExpression":return e;case"UnaryExpression":return wM[r.operator](tl(r.argument,e));default:return}}function owe(t){return tl.bind(null,(0,hy.default)(t))}function swe(t){return Yb.bind(null,(0,hy.default)(t))}function awe(t,e){hy.default.addUnaryOp(t),wM[t]=e}function lwe(t,e,r){r?(hy.default.addBinaryOp(t,e),dy[t]=r):(hy.default.addBinaryOp(t,nwe[t]||1),dy[t]=e)}var{parse:cwe,eval:uwe}=SF,CF={"-":t=>t};function vg(t,e){if(t in CF)return CF[t];let r,i=cwe(t);return i.type==="Identifier"?r=n=>LY(n,t):(MF(i,n=>{if(n.type==="CallExpression")throw new Error("Function calls not allowed in JSON expressions")}),r=n=>uwe(i,n)),CF[t]=r,r}function MF(t,e){if(Array.isArray(t))t.forEach(r=>MF(r,e));else if(t&&typeof t=="object"){t.type&&e(t);for(let r in t)MF(t[r],e)}}var py="@@=",IF="@@#",VY="@@type",TM="@@function";var HY=t=>t&&typeof t=="object",Xd=class{constructor(...e){this.typeKey=VY,this.functionKey=TM,this.log=console,this.classes={},this.reactComponents={},this.enumerations={},this.constants={},this.functions={},this.React=null,this.convertFunction=vg,this.preProcessClassProps=(r,i)=>i,this.postProcessConvertedJson=r=>r;for(let r of e)this.merge(r)}merge(e){for(let r in e)switch(r){case"layers":case"views":Object.assign(this.classes,e[r]);break;default:if(r in this){let i=e[r];this[r]=HY(this[r])?Object.assign(this[r],i):i}}}validate(e){return fy(!this.typeKey||typeof this.typeKey=="string"),fy(HY(this.classes)),!0}};function fwe(t){return typeof t=="string"&&t.startsWith(py)}function hwe(t){return t.replace(py,"")}function Ay(t,e){let r={};for(let i in t){let n=t[i];fwe(n)&&(n=hwe(n),n=vg(n,e)),r[i]=n}return r}function jY(t,e,r){let i=r.classes[t],n=r.reactComponents[t];if(!i&&!n){let{log:o}=r;if(o){let s=JSON.stringify(e,null,0).slice(0,40);o.warn(`JSON converter: No registered class of type ${t}(${s}...) `)}return null}return i?dwe(i,e,r):pwe(n,e,r)}function dwe(t,e,r){return r.preProcessClassProps&&(e=r.preProcessClassProps(t,e,r)),e=Ay(e,r),new t(e)}function pwe(t,e,r){let{React:i}=r,{children:n=[]}=e;return delete e.children,r.preProcessClassProps&&(e=r.preProcessClassProps(t,e,r)),e=Ay(e,r),i.createElement(t,e,n)}function GY(t,e,r){let i=r.functions[t];if(!i){let{log:n}=r;if(n){let o=JSON.stringify(e,null,0).slice(0,40);n.warn(`JSON converter: No registered function ${t}(${o}...) `)}return null}return i(e)}function PF(t){return typeof t=="string"?JSON.parse(t):t}var RF=t=>t&&typeof t=="object",xg=class{constructor(e){this.log=console,this.onJSONChange=()=>{},this.json=null,this.convertedJson=null,this.setProps(e)}finalize(){}setProps(e){"configuration"in e&&(this.configuration=e.configuration instanceof Xd?e.configuration:new Xd(e.configuration)),"onJSONChange"in e&&(this.onJSONChange=e.onJSONChange)}mergeConfiguration(e){this.configuration.merge(e)}convert(e){if(!e||e===this.json)return this.convertedJson;this.json=e;let r=PF(e),i=Awe(r,this.configuration);return i=this.configuration.postProcessConvertedJson(i),this.convertedJson=i,i}convertJson(e){return this.convert(e)}};function Awe(t,e){return e=new Xd(e),BF(t,"",e)}function BF(t,e,r){return Array.isArray(t)?t.map((i,n)=>BF(i,String(n),r)):mwe(t,r)?gwe(t,r):RF(t)?TM in t?_we(t,r):OF(t,r):typeof t=="string"?ywe(t,e,r):t}function mwe(t,e){let{typeKey:r}=e;return RF(t)&&Boolean(t[r])}function gwe(t,e){let{typeKey:r}=e,i=t[r],n={...t};return delete n[r],n=OF(n,e),jY(i,n,e)}function _we(t,e){let{functionKey:r}=e,i=t[r],n={...t};return delete n[r],n=OF(n,e),GY(i,n,e)}function OF(t,e){fy(RF(t));let r={};for(let i in t){let n=t[i];r[i]=BF(n,i,e)}return r}function ywe(t,e,r){if(t.startsWith(py)&&r.convertFunction)return t=t.replace(py,""),r.convertFunction(t,r);if(t.startsWith(IF)){if(t=t.replace(IF,""),r.constants[t])return r.constants[t];let[i,n]=t.split(".");return r.enumerations[i][n]}return t}var my={onInitialize:t=>t,onFinalize:t=>t,onMessage:t=>t},zh=class{static setCallbacks({onInitialize:e,onFinalize:r,onMessage:i}){e&&(my.onInitialize=e),r&&(my.onFinalize=r),i&&(my.onMessage=i)}constructor(e="Transport"){this._messageQueue=[],this.userData={},this._destroyed=!1,this.name=e}getRootDOMElement(){return typeof document<"u"?document.body:null}sendJSONMessage(){console.error("Back-channel not implemented for this transport")}sendBinaryMessage(){console.error("Back-channel not implemented for this transport")}_initialize(e={}){let r={transport:this,...e};my.onInitialize(r)}_finalize(e={}){let r={transport:this,...e};my.onFinalize(r),this._destroyed=!0}_messageReceived(e={}){e={transport:this,...e},console.debug("Delivering transport message",e),my.onMessage(e)}static _stringifyJSONSafe(e){let r=new Set;return JSON.stringify(e,(i,n)=>{if(typeof n=="object"&&n!==null){if(r.has(n))try{return JSON.parse(JSON.stringify(n))}catch{return}r.add(n)}return n})}};function WY(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null||Object.keys(t).length!==Object.keys(e).length)return!1;for(let r in t)if(!(r in e)||t[r]!==e[r])return!1;for(let r in e)if(!(r in t))return!1;return!0}var EM=class{constructor(e){this.map=null,this.width=0,this.height=0,this.props={...e},this._initialize(this.props)}finalize(){this.map?.remove(),this.map=null}setProps(e){let r=this.props,i={...this.props,...e};if(this.props=i,!this.map)return;this._update(r,i)&&this.redraw()}redraw(){let e=this.map;e.style&&(e._frame&&(e._frame.cancel(),e._frame=null),e._render())}getMap(){return this.map}_initialize(e){let{mapLib:r,container:i}=e;r.accessToken=e.mapboxApiAccessToken||"",this.map=new e.mapLib.Map({container:i,maxZoom:24,...e.mapOptions,...qY(e.viewState),style:e.mapStyle,interactive:!1,trackResize:!1}),Object.defineProperty(i,"offsetWidth",{get:()=>this.width}),Object.defineProperty(i,"clientWidth",{get:()=>this.width}),Object.defineProperty(i,"offsetHeight",{get:()=>this.height}),Object.defineProperty(i,"clientHeight",{get:()=>this.height}),this.map.resize()}_update(e,r){e.mapStyle!==r.mapStyle&&this.map.setStyle(r.mapStyle);let n=e.width!==r.width||e.height!==r.height;n&&(this.width=r.width,this.height=r.height,this.map.resize());let o=e.viewState,s=r.viewState,l=s.latitude!==o.latitude||s.longitude!==o.longitude||s.zoom!==o.zoom||s.pitch!==o.pitch||s.bearing!==o.bearing;return l&&this.map.jumpTo(qY(s)),n||l}};function qY(t){return{center:[t.longitude,t.latitude],zoom:t.zoom,bearing:t.bearing??0,pitch:t.pitch??0}}var XY={position:"absolute",left:0,top:0,width:"100%",height:"100%"};function vwe(t){let{container:e=document.body}=t;if(typeof e=="string"&&(e=document.getElementById(e)),!e)throw Error("Deck: container not found");window.getComputedStyle(e).position==="static"&&(e.style.position="relative");let i=document.createElement("div");e.appendChild(i),Object.assign(i.style,XY);let n=document.createElement("canvas");return e.appendChild(n),Object.assign(n.style,XY),{container:e,mapCanvas:i,deckCanvas:n}}var bg=class extends Id{constructor(e){if(typeof document>"u")throw Error("Deck can only be used in the browser");let{mapCanvas:r,deckCanvas:i}=vwe(e),n=e.viewState||e.initialViewState,o=Number.isFinite(n&&n.latitude),{map:s=globalThis.mapboxgl||globalThis.maplibregl}=e;super({canvas:i,...e}),s&&s.Map?this._map=o&&new EM({...e,width:0,height:0,viewState:n,container:r,mapLib:s}):this._map=s}getMapboxMap(){return this._map&&this._map.getMap()}finalize(){this._map&&this._map.finalize(),super.finalize()}setProps(e){"mapStyle"in e&&this._map&&this._map.setProps({mapStyle:e.mapStyle}),super.setProps(e)}_drawLayers(e,r){if(this._map){let i=this.getViewports()[0];i&&this._map.setProps({width:i.width,height:i.height,viewState:i})}super._drawLayers(e,r)}};Ll.registerDevices([wh]);var YY=t=>t.charAt(0)===t.charAt(0).toUpperCase(),xwe=t=>t.charAt(0)===t.charAt(0).toLowerCase()&&t.charAt(0)!=="_";function DF(t={},e){let r={},i=Object.keys(t).filter(e);for(let n of i)r[n]=t[n];return r}var bwe={classes:DF(Kb,YY),enumerations:{COORDINATE_SYSTEM:Zr,GL:yh}};em([jv]);var lA=new xg({configuration:bwe});function wwe(t,e){let r={classes:DF(t,YY),functions:DF(t,xwe)};e.mergeConfiguration(r)}function Twe(t,e){if(!t)return;let r={};function i(){Object.values(r).every(o=>o)&&typeof e=="function"&&e()}function n(o,s){wwe(s,lA),r[o]=s,i()}t.forEach(({libraryName:o,resourceUri:s})=>{if(r[o]=!1,o in window){n(o,window[o]);return}Object.defineProperty(window,o,{set:l=>n(o,l),get:()=>r[o]}),d5(s)})}function KY(t,e){let r=lA.convert(t);e.setProps(r)}function Ewe(t,e){return t.filter(r=>r&&r.id&&!e.find(i=>i.id===r.id))}function Swe({mapProvider:t,props:e,mapboxApiKey:r,googleMapsKey:i,handleEvent:n,getTooltip:o,container:s}){let u={...n?{onClick:h=>n("deck-click-event",h),onHover:h=>n("deck-hover-event",h),onResize:h=>n("deck-resize-event",h),onViewStateChange:({viewState:h,interactionState:v,oldViewState:T})=>{let E=new Tc(h);h.nw=E.unproject([0,0]),h.se=E.unproject([E.width,E.height]),n("deck-view-state-change-event",h)},onDragStart:h=>n("deck-drag-start-event",h),onDrag:h=>n("deck-drag-event",h),onDragEnd:h=>n("deck-drag-end-event",h)}:null,getTooltip:o,container:s};switch(t){case"mapbox":return ur.info("Using Mapbox base maps")(),new bg({...u,...e,map:Z3,mapboxApiAccessToken:r,onLoad:h5});case"carto":return ur.info("Using Carto base maps")(),new bg({map:Z3,...u,...e});case"google_maps":return ur.info("Using Google Maps base maps")(),z9({...u,...e,googleMapsKey:i});default:return ur.info("No recognized map provider specified")(),new bg({...u,...e,map:null,mapboxApiAccessToken:null})}}function SM({mapboxApiKey:t,googleMapsKey:e,container:r,jsonInput:i,tooltip:n,handleEvent:o,customLibraries:s,configuration:l}){let u;try{l&&lA.mergeConfiguration(l);let h=i.layers||[],v=lA.convert(i);RO(r,v);let T=(v.layers||[]).filter(z=>z),E=Ewe(h,T),M=X3(n),{mapProvider:O}=v;u=Swe({mapProvider:O,props:v,mapboxApiKey:t,googleMapsKey:e,handleEvent:o,getTooltip:M,container:r}),Twe(s,()=>{if(E.length){let W=(lA.convert({layers:i.layers}).layers||[]).filter(J=>J);W.length>T.length&&u.setProps({layers:W})}})}catch(h){console.error(h)}return u}function CM(){zh.setCallbacks({onInitialize({transport:t}){let{width:e,height:r,customLibraries:i,mapboxApiKey:n,jsonInput:o,tooltip:s}=Pwe(t);f5();let l=t.getRootDOMElement(),u=l5(e,r);l.appendChild(u);let h=JSON.parse(o),v=SM({mapboxApiKey:n,container:u,jsonInput:h,tooltip:s,handleEvent:(T,E)=>Iwe(t,T,E),customLibraries:i});t.userData.deck=v},onFinalize({transport:t}){let{deck:e}=t.userData;e.finalize()},onMessage({transport:t,type:e,json:r,binary:i}){let{deck:n}=t.userData,o;switch(e){case"json":o=lA.convert(r),n.setProps(o);break;case"json-with-binary":o=lA.convert(r);let s=t.jupyterModel.get("data_buffer"),l=Cwe({binary:s,convertedJson:o});n.setProps(l);break;default:}}})}function Cwe({binary:t,convertedJson:e}){for(let r=0;r<e.layers.length;r++){let i=e.layers[r].id,n=e.layers[r];e.layers[r]=n.clone({data:t[i]})}return e}function Mwe(t,e){return e instanceof On?e.id:e}function Iwe(t,e,r){if(e==="hover"&&!r.picked&&r.index===-1)return;let i=JSON.parse(JSON.stringify(r,Mwe));t.sendJSONMessage(e,i)}function Pwe(t){let{jupyterModel:e}=t;if(!e)throw new Error("deck.gl playground currently only works with the Jupyter Widget Transport");return{width:e.get("width"),height:e.get("height"),customLibraries:e.get("custom_libraries"),mapboxApiKey:e.get("mapbox_key"),jsonInput:e.get("json_input"),tooltip:e.get("tooltip")}}var wg=class extends zh{constructor(){super("Jupyter Transport (JavaScript <=> Jupyter Kernel)"),this.jupyterModel=null,this.jupyterView=null}getRootDOMElement(){return this.jupyterView.el}sendJSONMessage(e,r){let i=zh._stringifyJSONSafe({type:e,data:r});this.jupyterModel.send(i)}};var qw={};As(qw,{CONTROL_COMM_PROTOCOL_VERSION:()=>NQ,CONTROL_COMM_TARGET:()=>FQ,CONTROL_COMM_TIMEOUT:()=>kQ,DOMWidgetModel:()=>hk,DOMWidgetView:()=>dk,IJupyterWidgetRegistry:()=>aIe,JUPYTER_WIDGETS_VERSION:()=>kM,JupyterPhosphorPanelWidget:()=>$Me,JupyterPhosphorWidget:()=>jee,LayoutModel:()=>eIe,LayoutView:()=>tIe,ManagerBase:()=>vMe,PROTOCOL_VERSION:()=>UM,StyleModel:()=>rIe,StyleView:()=>iIe,ViewList:()=>sIe,WidgetModel:()=>IA,WidgetView:()=>fv,WrappedError:()=>gMe,assign:()=>Yd,base64ToBuffer:()=>nN,bufferToBase64:()=>iN,bufferToHex:()=>yMe,difference:()=>NM,hexToBuffer:()=>rN,isEqual:()=>Cy,pack_models:()=>fk,put_buffers:()=>cA,reject:()=>jh,remove_buffers:()=>ow,resolvePromisesDict:()=>My,serialize_state:()=>UQ,shims:()=>pk,unpack_models:()=>Ww,uuid:()=>nw});var FM=ga(QY()),RQ=ga(gy()),BQ=ga(EQ()),OQ=ga(PQ()),mMe=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),LM=function(){return LM=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},LM.apply(this,arguments)};function NM(t,e){return t.filter(function(r){return e.indexOf(r)===-1})}function Cy(t,e){return(0,BQ.default)(t,e)}var Yd=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t};function nw(){return RQ.UUID.uuid4()}var gMe=function(t){mMe(e,t);function e(r,i){var n=t.call(this,r)||this;return console.warn("WrappedError has been deprecated!"),i instanceof e?n.error_stack=i.error_stack:n.error_stack=[i],n.error_stack.push(n),n}return e}(Error);function My(t){var e=Object.keys(t),r=[];return e.forEach(function(i){r.push(t[i])}),Promise.all(r).then(function(i){for(var n={},o=0;o<e.length;o++)n[e[o]]=i[o];return n})}function jh(t,e){return function(i){throw e&&console.error(new Error(t)),i}}function cA(t,e,r){for(var i=0;i<e.length;i++){for(var n=e[i],o=t,s=0;s<n.length-1;s++)o=o[n[s]];o[n[n.length-1]]=r[i]}}function ow(t){var e=[],r=[];function i(o,s){if(o.toJSON&&(o=o.toJSON()),Array.isArray(o))for(var l=!1,u=0;u<o.length;u++){var h=o[u];if(h)if(h instanceof ArrayBuffer||ArrayBuffer.isView(h))l||(o=o.slice(),l=!0),e.push(ArrayBuffer.isView(h)?h.buffer:h),r.push(s.concat([u])),o[u]=null;else{var v=i(h,s.concat([u]));v!==h&&(l||(o=o.slice(),l=!0),o[u]=v)}}else if((0,OQ.default)(o))for(var T in o){var l=!1;if(o.hasOwnProperty(T)){var h=o[T];if(h)if(h instanceof ArrayBuffer||ArrayBuffer.isView(h))l||(o=LM({},o),l=!0),e.push(ArrayBuffer.isView(h)?h.buffer:h),r.push(s.concat([T])),delete o[T];else{var v=i(h,s.concat([T]));v!==h&&(l||(o=LM({},o),l=!0),o[T]=v)}}}return o}var n=i(t,[]);return{state:n,buffers:e,buffer_paths:r}}var _Me=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"];function yMe(t){for(var e=new Uint8Array(t),r=[],i=0;i<e.length;i++)r.push(_Me[e[i]]);return r.join("")}function rN(t){for(var e=new Uint8Array(t.length/2),r=0;r<t.length;r+=2)e[r/2]=parseInt(t.slice(r,r+2),16);return e.buffer}function iN(t){return(0,FM.fromByteArray)(new Uint8Array(t))}function nN(t){return(0,FM.toByteArray)(t).buffer}var LQ=ga(gy());var kM="1.2.0",UM="2.1.0";var sw=function(){return sw=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},sw.apply(this,arguments)},uA=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(v){try{h(i.next(v))}catch(T){s(T)}}function u(v){try{h(i.throw(v))}catch(T){s(T)}}function h(v){v.done?o(v.value):n(v.value).then(l,u)}h((i=i.apply(t,e||[])).next())})},fA=function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,n,o,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(h){return function(v){return u([h,v])}}function u(h){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(o=h[0]&2?n.return:h[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,h[1])).done)return o;switch(n=0,o&&(h=[h[0]&2,o.value]),h[0]){case 0:case 1:o=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,n=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!o||h[1]>o[0]&&h[1]<o[3])){r.label=h[1];break}if(h[0]===6&&r.label<o[1]){r.label=o[1],o=h;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(h);break}o[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(v){h=[6,v],n=0}finally{i=o=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},DQ=UM.split(".",1)[0],FQ="jupyter.widget.control",NQ="1.0.0",kQ=4e3,vMe=function(){function t(){this.comm_target_name="jupyter.widget",this._models=Object.create(null)}return t.prototype.display_model=function(e,r,i){var n=this;return i===void 0&&(i={}),this.create_view(r,i).then(function(o){return n.display_view(e,o,i)}).catch(jh("Could not create view",!0))},t.prototype.setViewOptions=function(e){return e===void 0&&(e={}),e},t.prototype.create_view=function(e,r){var i=this;r===void 0&&(r={});var n=e.state_change=e.state_change.then(function(){return i.loadClass(e.get("_view_name"),e.get("_view_module"),e.get("_view_module_version")).then(function(s){var l=new s({model:e,options:i.setViewOptions(r)});return l.listenTo(e,"destroy",l.remove),Promise.resolve(l.render()).then(function(){return l})}).catch(jh("Could not create a view for model id "+e.model_id,!0))}),o=nw();return e.views[o]=n,n.then(function(s){s.once("remove",function(){delete s.model.views[o]},i)}),e.state_change},t.prototype.callbacks=function(e){return{}},t.prototype.get_model=function(e){return this._models[e]},t.prototype.has_model=function(e){return this._models[e]!==void 0},t.prototype.handle_comm_open=function(e,r){var i=(r.metadata||{}).version||"";if(i.split(".",1)[0]!==DQ){var n="Wrong widget protocol version: received protocol version '"+i+"', but was expecting major version '"+DQ+"'";return console.error(n),Promise.reject(n)}var o=r.content.data,s=o.buffer_paths||[],l=(r.buffers||[]).map(function(u){return u instanceof DataView?u:new DataView(u instanceof ArrayBuffer?u:u.buffer)});return cA(o.state,s,l),this.new_model({model_name:o.state._model_name,model_module:o.state._model_module,model_module_version:o.state._model_module_version,comm:e},o.state).catch(jh("Could not create a model.",!0))},t.prototype.new_widget=function(e,r){var i=this;r===void 0&&(r={});var n;if(e.view_name===void 0||e.view_module===void 0||e.view_module_version===void 0)return Promise.reject("new_widget(...) must be given view information in the options.");e.comm?n=Promise.resolve(e.comm):n=this._create_comm(this.comm_target_name,e.model_id,{state:{_model_module:e.model_module,_model_module_version:e.model_module_version,_model_name:e.model_name,_view_module:e.view_module,_view_module_version:e.view_module_version,_view_name:e.view_name}},{version:UM});var o=sw({},e);return n.then(function(s){o.comm=s;var l=i.new_model(o,r);return l.then(function(u){return u.sync("create",u),u})},function(){return o.model_id||(o.model_id=nw()),i.new_model(o,r)})},t.prototype.register_model=function(e,r){var i=this;this._models[e]=r,r.then(function(n){n.once("comm:close",function(){delete i._models[e]})})},t.prototype.new_model=function(e,r){return r===void 0&&(r={}),uA(this,void 0,void 0,function(){var i,n;return fA(this,function(o){switch(o.label){case 0:if(e.model_id)i=e.model_id;else if(e.comm)i=e.model_id=e.comm.comm_id;else throw new Error("Neither comm nor model_id provided in options object. At least one must exist.");return n=this._make_model(e,r),this.register_model(i,n),[4,n];case 1:return[2,o.sent()]}})})},t.prototype._make_model=function(e,r){return r===void 0&&(r={}),uA(this,void 0,void 0,function(){var i,n,o,s,l,u,h;return fA(this,function(v){switch(v.label){case 0:i=e.model_id,n=this.loadClass(e.model_name,e.model_module,e.model_module_version),v.label=1;case 1:return v.trys.push([1,3,,4]),[4,n];case 2:return o=v.sent(),[3,4];case 3:throw s=v.sent(),console.error("Could not instantiate widget"),s;case 4:if(!o)throw new Error("Cannot find model module "+e.model_module+"@"+e.model_module_version+", "+e.model_name);return[4,o._deserialize_state(r,this)];case 5:return l=v.sent(),u={widget_manager:this,model_id:i,comm:e.comm},h=new o(l,u),h.name=e.model_name,h.module=e.model_module,[2,h]}})})},t.prototype._loadFromKernel=function(){return uA(this,void 0,void 0,function(){var e,r,i,n,o,s,l,u,h,v,T,E,M,O=this;return fA(this,function(F){switch(F.label){case 0:return F.trys.push([0,3,,4]),[4,this._create_comm(FQ,nw(),{},{version:NQ})];case 1:return i=F.sent(),[4,new Promise(function(z,W){i.on_msg(function(J){if(e=J.content.data,e.method!=="update_states"){console.warn(`
Unknown `+e.method+` message on the Control channel
`);return}r=(J.buffers||[]).map(function(K){return K instanceof DataView?K:new DataView(K instanceof ArrayBuffer?K:K.buffer)}),z(null)}),i.on_close(function(){return W("Control comm was closed too early")}),i.send({method:"request_states"},{}),setTimeout(function(){return W("Control comm did not respond in time")},kQ)})];case 2:return F.sent(),i.close(),[3,4];case 3:return n=F.sent(),console.warn('Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason:',n),[2,this._loadFromKernelModels()];case 4:for(o=e.states,s={},l={},u=0;u<e.buffer_paths.length;u++)h=e.buffer_paths[u],v=h[0],T=h.slice(1),E=r[u],s[v]||(s[v]=[],l[v]=[]),s[v].push(T),l[v].push(E);return[4,Promise.all(Object.keys(o).map(function(z){return uA(O,void 0,void 0,function(){var W,J;return fA(this,function(K){switch(K.label){case 0:return this.has_model(z)?(J=void 0,[3,3]):[3,1];case 1:return[4,this._create_comm("jupyter.widget",z)];case 2:J=K.sent(),K.label=3;case 3:return W=J,[2,{widget_id:z,comm:W}]}})})}))];case 5:return M=F.sent(),[4,Promise.all(M.map(function(z){var W=z.widget_id,J=z.comm;return uA(O,void 0,void 0,function(){var K,ne,ge,j;return fA(this,function(me){switch(me.label){case 0:K=o[W],W in s&&cA(K,s[W],l[W]),me.label=1;case 1:return me.trys.push([1,7,,8]),J?[4,this.new_model({model_name:K.model_name,model_module:K.model_module,model_module_version:K.model_module_version,model_id:W,comm:J},K.state)]:[3,3];case 2:return me.sent(),[3,6];case 3:return[4,this.get_model(W)];case 4:return ne=me.sent(),[4,ne.constructor._deserialize_state(K.state,this)];case 5:ge=me.sent(),ne.set_state(ge),me.label=6;case 6:return[3,8];case 7:return j=me.sent(),console.error(j),[3,8];case 8:return[2]}})})}))];case 6:return F.sent(),[2]}})})},t.prototype._loadFromKernelModels=function(){return uA(this,void 0,void 0,function(){var e,r,i=this;return fA(this,function(n){switch(n.label){case 0:return[4,this._get_comm_info()];case 1:return e=n.sent(),[4,Promise.all(Object.keys(e).map(function(o){return uA(i,void 0,void 0,function(){var s,l,u;return fA(this,function(h){switch(h.label){case 0:return this.has_model(o)?[2]:[4,this._create_comm(this.comm_target_name,o)];case 1:return s=h.sent(),l="",u=new LQ.PromiseDelegate,s.on_msg(function(v){if(v.parent_header.msg_id===l&&v.header.msg_type==="comm_msg"&&v.content.data.method==="update"){var T=v.content.data,E=T.buffer_paths||[],M=v.buffers||[];cA(T.state,E,M),u.resolve({comm:s,msg:v})}}),l=s.send({method:"request_state"},this.callbacks(void 0)),[2,u.promise]}})})}))];case 2:return r=n.sent(),[4,Promise.all(r.map(function(o){return uA(i,void 0,void 0,function(){var s;return fA(this,function(l){switch(l.label){case 0:return o?(s=o.msg.content,[4,this.new_model({model_name:s.data.state._model_name,model_module:s.data.state._model_module,model_module_version:s.data.state._model_module_version,comm:o.comm},s.data.state)]):[2];case 1:return l.sent(),[2]}})})}))];case 3:return n.sent(),[2]}})})},t.prototype.clear_state=function(){var e=this;return My(this._models).then(function(r){Object.keys(r).forEach(function(i){return r[i].close()}),e._models=Object.create(null)})},t.prototype.get_state=function(e){var r=this;e===void 0&&(e={});var i=Object.keys(this._models).map(function(n){return r._models[n]});return Promise.all(i).then(function(n){return UQ(n,e)})},t.prototype.set_state=function(e){var r=this;if(!(e.version_major&&e.version_major<=2))throw"Unsupported widget state format";var i=e.state,n=this._get_comm_info().then(function(o){return Promise.all(Object.keys(i).map(function(s){var l={base64:nN,hex:rN},u=i[s],h=u.state;if(u.buffers){var v=u.buffers.map(function(M){return M.path}),T=u.buffers.map(function(M){return new DataView(l[M.encoding](M.data))});cA(u.state,v,T)}if(r.has_model(s))return r.get_model(s).then(function(M){return M.constructor._deserialize_state(h||{},r).then(function(O){return M.set_state(O),M})});var E={model_id:s,model_name:u.model_name,model_module:u.model_module,model_module_version:u.model_module_version};return o.hasOwnProperty(s)?r._create_comm(r.comm_target_name,s).then(function(M){return E.comm=M,r.new_model(E)}):r.new_model(E,h)}))});return n},t.prototype.disconnect=function(){var e=this;Object.keys(this._models).forEach(function(r){e._models[r].then(function(i){i.comm_live=!1})})},t.prototype.resolveUrl=function(e){return Promise.resolve(e)},t.prototype.filterExistingModelState=function(e){var r=this,i=e.state;return i=Object.keys(i).filter(function(n){return!r.has_model(n)}).reduce(function(n,o){return n[o]=i[o],n},{}),sw(sw({},e),{state:i})},t}();function UQ(t,e){e===void 0&&(e={});var r={};return t.forEach(function(i){var n=i.model_id,o=ow(i.serialize(i.get_state(e.drop_defaults))),s=o.buffers.map(function(l,u){return{data:iN(l),path:o.buffer_paths[u],encoding:"base64"}});r[n]={model_name:i.name,model_module:i.module,model_module_version:i.get("_model_module_version"),state:o.state},s.length>0&&(r[n].buffers=s)}),{version_major:2,version_minor:0,state:r}}var sN=function(){return sN=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},sN.apply(this,arguments)};function zQ(t,e,r){if(t==null)return this;var i;if(typeof t=="object"?(i=t,r=e):(i={})[t]=e,r||(r={}),!this._validate(i,r))return!1;var n=r.unset,o=r.silent,s=[],l=this._changing;this._changing=!0;try{l||(this._previousAttributes=sN({},this.attributes),this.changed={});var u=this.attributes,h=this.changed,v=this._previousAttributes;for(var T in i)e=i[T],Cy(u[T],e)||s.push(T),Cy(v[T],e)?delete h[T]:h[T]=e,n?delete u[T]:u[T]=e;if(this.id=this.get(this.idAttribute),!o){s.length&&(this._pending=r);for(var E=0;E<s.length;E++)this.trigger("change:"+s[E],this,u[s[E]],r)}if(l)return this;if(!o)for(;this._pending;)r=this._pending,this._pending=!1,this.trigger("change",this,r)}finally{this._pending=!1,this._changing=!1}return this}var Hee=ga(G4()),uk=ga(H4());var See=ga(G4()),LMe=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),kw=Element.prototype,FMe=kw.matches||kw.webkitMatchesSelector||kw.mozMatchesSelector||kw.msMatchesSelector||kw.oMatchesSelector||function(e){for(var r=(this.document||this.ownerDocument).querySelectorAll(e),i=r.length;--i>=0&&r.item(i)!==this;);return i>-1},Cee=function(t){LMe(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype._removeElement=function(){this.undelegateEvents(),this.el.parentNode&&this.el.parentNode.removeChild(this.el)},e.prototype._setElement=function(r){this.el=r},e.prototype._setAttributes=function(r){for(var i in r)i in this.el?this.el[i]=r[i]:this.el.setAttribute(i,r[i])},e.prototype.delegate=function(r,i,n){typeof i!="string"&&(n=i,i=null),this._domEvents===void 0&&(this._domEvents=[]);var o=this.el,s=i?function(l){for(var u=l.target||l.srcElement;u&&u!==o;u=u.parentNode)if(FMe.call(u,i))return l.delegateTarget=u,n.handleEvent?n.handleEvent(l):n(l)}:n;return this.el.addEventListener(r,s,!1),this._domEvents.push({eventName:r,handler:s,listener:n,selector:i}),s},e.prototype.undelegate=function(r,i,n){if(typeof i=="function"&&(n=i,i=null),this.el&&this._domEvents)for(var o=this._domEvents.slice(),s=o.length;s--;){var l=o[s],u=l.eventName===r&&(n?l.listener===n:!0)&&(i?l.selector===i:!0);u&&(this.el.removeEventListener(l.eventName,l.handler,!1),this._domEvents.splice(s,1))}return this},e.prototype.undelegateEvents=function(){if(this.el&&this._domEvents){for(var r=this._domEvents.length,i=0;i<r;i++){var n=this._domEvents[i];this.el.removeEventListener(n.eventName,n.handler,!1)}this._domEvents.length=0}return this},e}(See.View);var rr;(function(t){function e(me,fe,$,Z){$===void 0&&($=0),Z===void 0&&(Z=-1);var we=me.length;if(we===0)return-1;$<0?$=Math.max(0,$+we):$=Math.min($,we-1),Z<0?Z=Math.max(0,Z+we):Z=Math.min(Z,we-1);var Oe;Z<$?Oe=Z+1+(we-$):Oe=Z-$+1;for(var he=0;he<Oe;++he){var Le=($+he)%we;if(me[Le]===fe)return Le}return-1}t.firstIndexOf=e;function r(me,fe,$,Z){$===void 0&&($=-1),Z===void 0&&(Z=0);var we=me.length;if(we===0)return-1;$<0?$=Math.max(0,$+we):$=Math.min($,we-1),Z<0?Z=Math.max(0,Z+we):Z=Math.min(Z,we-1);var Oe;$<Z?Oe=$+1+(we-Z):Oe=$-Z+1;for(var he=0;he<Oe;++he){var Le=($-he+we)%we;if(me[Le]===fe)return Le}return-1}t.lastIndexOf=r;function i(me,fe,$,Z){$===void 0&&($=0),Z===void 0&&(Z=-1);var we=me.length;if(we===0)return-1;$<0?$=Math.max(0,$+we):$=Math.min($,we-1),Z<0?Z=Math.max(0,Z+we):Z=Math.min(Z,we-1);var Oe;Z<$?Oe=Z+1+(we-$):Oe=Z-$+1;for(var he=0;he<Oe;++he){var Le=($+he)%we;if(fe(me[Le],Le))return Le}return-1}t.findFirstIndex=i;function n(me,fe,$,Z){$===void 0&&($=-1),Z===void 0&&(Z=0);var we=me.length;if(we===0)return-1;$<0?$=Math.max(0,$+we):$=Math.min($,we-1),Z<0?Z=Math.max(0,Z+we):Z=Math.min(Z,we-1);var Oe;$<Z?Oe=$+1+(we-Z):Oe=$-Z+1;for(var he=0;he<Oe;++he){var Le=($-he+we)%we;if(fe(me[Le],Le))return Le}return-1}t.findLastIndex=n;function o(me,fe,$,Z){$===void 0&&($=0),Z===void 0&&(Z=-1);var we=i(me,fe,$,Z);return we!==-1?me[we]:void 0}t.findFirstValue=o;function s(me,fe,$,Z){$===void 0&&($=-1),Z===void 0&&(Z=0);var we=n(me,fe,$,Z);return we!==-1?me[we]:void 0}t.findLastValue=s;function l(me,fe,$,Z,we){Z===void 0&&(Z=0),we===void 0&&(we=-1);var Oe=me.length;if(Oe===0)return 0;Z<0?Z=Math.max(0,Z+Oe):Z=Math.min(Z,Oe-1),we<0?we=Math.max(0,we+Oe):we=Math.min(we,Oe-1);for(var he=Z,Le=we-Z+1;Le>0;){var ft=Le>>1,Vt=he+ft;$(me[Vt],fe)<0?(he=Vt+1,Le-=ft+1):Le=ft}return he}t.lowerBound=l;function u(me,fe,$,Z,we){Z===void 0&&(Z=0),we===void 0&&(we=-1);var Oe=me.length;if(Oe===0)return 0;Z<0?Z=Math.max(0,Z+Oe):Z=Math.min(Z,Oe-1),we<0?we=Math.max(0,we+Oe):we=Math.min(we,Oe-1);for(var he=Z,Le=we-Z+1;Le>0;){var ft=Le>>1,Vt=he+ft;$(me[Vt],fe)>0?Le=ft:(he=Vt+1,Le-=ft+1)}return he}t.upperBound=u;function h(me,fe,$){if(me===fe)return!0;if(me.length!==fe.length)return!1;for(var Z=0,we=me.length;Z<we;++Z)if($?!$(me[Z],fe[Z]):me[Z]!==fe[Z])return!1;return!0}t.shallowEqual=h;function v(me,fe){fe===void 0&&(fe={});var $=fe.start,Z=fe.stop,we=fe.step;if(we===void 0&&(we=1),we===0)throw new Error("Slice `step` cannot be zero.");var Oe=me.length;$===void 0?$=we<0?Oe-1:0:$<0?$=Math.max($+Oe,we<0?-1:0):$>=Oe&&($=we<0?Oe-1:Oe),Z===void 0?Z=we<0?-1:Oe:Z<0?Z=Math.max(Z+Oe,we<0?-1:0):Z>=Oe&&(Z=we<0?Oe-1:Oe);var he;we<0&&Z>=$||we>0&&$>=Z?he=0:we<0?he=Math.floor((Z-$+1)/we+1):he=Math.floor((Z-$-1)/we+1);for(var Le=[],ft=0;ft<he;++ft)Le[ft]=me[$+ft*we];return Le}t.slice=v;function T(me,fe,$){var Z=me.length;if(!(Z<=1)&&(fe<0?fe=Math.max(0,fe+Z):fe=Math.min(fe,Z-1),$<0?$=Math.max(0,$+Z):$=Math.min($,Z-1),fe!==$)){for(var we=me[fe],Oe=fe<$?1:-1,he=fe;he!==$;he+=Oe)me[he]=me[he+Oe];me[$]=we}}t.move=T;function E(me,fe,$){fe===void 0&&(fe=0),$===void 0&&($=-1);var Z=me.length;if(!(Z<=1))for(fe<0?fe=Math.max(0,fe+Z):fe=Math.min(fe,Z-1),$<0?$=Math.max(0,$+Z):$=Math.min($,Z-1);fe<$;){var we=me[fe],Oe=me[$];me[fe++]=Oe,me[$--]=we}}t.reverse=E;function M(me,fe,$,Z){$===void 0&&($=0),Z===void 0&&(Z=-1);var we=me.length;if(!(we<=1)&&($<0?$=Math.max(0,$+we):$=Math.min($,we-1),Z<0?Z=Math.max(0,Z+we):Z=Math.min(Z,we-1),!($>=Z))){var Oe=Z-$+1;if(fe>0?fe=fe%Oe:fe<0&&(fe=(fe%Oe+Oe)%Oe),fe!==0){var he=$+fe;E(me,$,he-1),E(me,he,Z),E(me,$,Z)}}}t.rotate=M;function O(me,fe,$,Z){$===void 0&&($=0),Z===void 0&&(Z=-1);var we=me.length;if(we!==0){$<0?$=Math.max(0,$+we):$=Math.min($,we-1),Z<0?Z=Math.max(0,Z+we):Z=Math.min(Z,we-1);var Oe;Z<$?Oe=Z+1+(we-$):Oe=Z-$+1;for(var he=0;he<Oe;++he)me[($+he)%we]=fe}}t.fill=O;function F(me,fe,$){var Z=me.length;fe<0?fe=Math.max(0,fe+Z):fe=Math.min(fe,Z);for(var we=Z;we>fe;--we)me[we]=me[we-1];me[fe]=$}t.insert=F;function z(me,fe){var $=me.length;if(fe<0&&(fe+=$),!(fe<0||fe>=$)){for(var Z=me[fe],we=fe+1;we<$;++we)me[we-1]=me[we];return me.length=$-1,Z}}t.removeAt=z;function W(me,fe,$,Z){$===void 0&&($=0),Z===void 0&&(Z=-1);var we=e(me,fe,$,Z);return we!==-1&&z(me,we),we}t.removeFirstOf=W;function J(me,fe,$,Z){$===void 0&&($=-1),Z===void 0&&(Z=0);var we=r(me,fe,$,Z);return we!==-1&&z(me,we),we}t.removeLastOf=J;function K(me,fe,$,Z){$===void 0&&($=0),Z===void 0&&(Z=-1);var we=me.length;if(we===0)return 0;$<0?$=Math.max(0,$+we):$=Math.min($,we-1),Z<0?Z=Math.max(0,Z+we):Z=Math.min(Z,we-1);for(var Oe=0,he=0;he<we;++he)$<=Z&&he>=$&&he<=Z&&me[he]===fe||Z<$&&(he<=Z||he>=$)&&me[he]===fe?Oe++:Oe>0&&(me[he-Oe]=me[he]);return Oe>0&&(me.length=we-Oe),Oe}t.removeAllOf=K;function ne(me,fe,$,Z){$===void 0&&($=0),Z===void 0&&(Z=-1);var we,Oe=i(me,fe,$,Z);return Oe!==-1&&(we=z(me,Oe)),{index:Oe,value:we}}t.removeFirstWhere=ne;function ge(me,fe,$,Z){$===void 0&&($=-1),Z===void 0&&(Z=0);var we,Oe=n(me,fe,$,Z);return Oe!==-1&&(we=z(me,Oe)),{index:Oe,value:we}}t.removeLastWhere=ge;function j(me,fe,$,Z){$===void 0&&($=0),Z===void 0&&(Z=-1);var we=me.length;if(we===0)return 0;$<0?$=Math.max(0,$+we):$=Math.min($,we-1),Z<0?Z=Math.max(0,Z+we):Z=Math.min(Z,we-1);for(var Oe=0,he=0;he<we;++he)$<=Z&&he>=$&&he<=Z&&fe(me[he],he)||Z<$&&(he<=Z||he>=$)&&fe(me[he],he)?Oe++:Oe>0&&(me[he-Oe]=me[he]);return Oe>0&&(me.length=we-Oe),Oe}t.removeAllWhere=j})(rr||(rr={}));function ou(t){var e;return typeof t.iter=="function"?e=t.iter():e=new NMe(t),e}function Ei(t,e){for(var r=0,i=ou(t),n;(n=i.next())!==void 0;)if(e(n,r++)===!1)return}function Mee(t,e){for(var r=0,i=ou(t),n;(n=i.next())!==void 0;)if(!e(n,r++))return!1;return!0}function Iee(t,e){for(var r=0,i=ou(t),n;(n=i.next())!==void 0;)if(e(n,r++))return!0;return!1}function Pee(t){for(var e=0,r=[],i=ou(t),n;(n=i.next())!==void 0;)r[e++]=n;return r}var NMe=function(){function t(e){this._index=0,this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},t}(),J2t=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?e:this.next()}},t}(),Q2t=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?this._source[e]:this.next()}},t}(),$2t=function(){function t(e,r){r===void 0&&(r=Object.keys(e)),this._index=0,this._source=e,this._keys=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?[e,this._source[e]]:this.next()}},t}(),eTt=function(){function t(e){this._fn=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},t.prototype.next=function(){return this._fn.call(void 0)},t}();function q4(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Hg(ou(t.map(ou)))}var Hg=function(){function t(e){this._cloned=!1,this._source=e,this._active=void 0}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone());return e._active=this._active&&this._active.clone(),e._cloned=!0,this._cloned=!0,e},t.prototype.next=function(){if(this._active===void 0){var e=this._source.next();if(e===void 0)return;this._active=this._cloned?e.clone():e}var r=this._active.next();return r!==void 0?r:(this._active=void 0,this.next())},t}();function su(){return new kMe}var kMe=function(){function t(){}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t},t.prototype.next=function(){},t}();var tTt=function(){function t(e,r){this._source=e,this._index=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._index)},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return[this._index++,e]},t}();function Ree(t,e){return new UMe(ou(t),e)}var UMe=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){for(var e=this._fn,r=this._source,i;(i=r.next())!==void 0;)if(e(i,this._index++))return i},t}();function rv(t,e){for(var r=0,i=ou(t),n;(n=i.next())!==void 0;)if(e(n,r++))return n}function Bee(t,e){var r=ou(t),i=r.next();if(i!==void 0){for(var n=i;(i=r.next())!==void 0;)e(i,n)>0&&(n=i);return n}}function bA(t,e){return new zMe(ou(t),e)}var zMe=function(){function t(e,r){this._index=0,this._source=e,this._fn=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){var e=this._source.next();if(e!==void 0)return this._fn.call(void 0,e,this._index++)},t}();var rTt=function(){function t(e,r,i){this._index=0,this._start=e,this._stop=r,this._step=i,this._length=W4.rangeLength(e,r,i)}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._start,this._stop,this._step);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++},t}(),W4;(function(t){function e(r,i,n){return n===0?1/0:r>i&&n>0||r<i&&n<0?0:Math.ceil((i-r)/n)}t.rangeLength=e})(W4||(W4={}));function X4(t,e,r){var i=0,n=ou(t),o=n.next();if(o===void 0&&r===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(o===void 0)return r;var s=n.next();if(s===void 0&&r===void 0)return o;if(s===void 0)return e(r,o,i++);var l;r===void 0?l=e(o,s,i++):l=e(e(r,o,i++),s,i++);for(var u;(u=n.next())!==void 0;)l=e(l,u,i++);return l}function Uw(t){return new VMe(t,1)}var VMe=function(){function t(e,r){this._value=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._value,this._count)},t.prototype.next=function(){if(!(this._count<=0))return this._count--,this._value},t}();function Oee(t){var e;return typeof t.retro=="function"?e=t.retro():e=new HMe(t),e}var HMe=function(){function t(e){this._source=e,this._index=e.length-1}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index<0||this._index>=this._source.length))return this._source[this._index--]},t}();var iTt=function(){function t(e,r){this._source=e,this._step=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._step)},t.prototype.next=function(){for(var e=this._source.next(),r=this._step-1;r>0;--r)this._source.next();return e},t}(),tv;(function(t){function e(s,l,u){u===void 0&&(u=0);for(var h=new Array(l.length),v=0,T=u,E=l.length;v<E;++v,++T){if(T=s.indexOf(l[v],T),T===-1)return null;h[v]=T}return h}t.findIndices=e;function r(s,l,u){u===void 0&&(u=0);var h=e(s,l,u);if(!h)return null;for(var v=0,T=0,E=h.length;T<E;++T){var M=h[T]-u;v+=M*M}return{score:v,indices:h}}t.matchSumOfSquares=r;function i(s,l,u){u===void 0&&(u=0);var h=e(s,l,u);if(!h)return null;for(var v=0,T=u-1,E=0,M=h.length;E<M;++E){var O=h[E];v+=O-T-1,T=O}return{score:v,indices:h}}t.matchSumOfDeltas=i;function n(s,l,u){for(var h=[],v=0,T=0,E=l.length;v<E;){for(var M=l[v],O=l[v];++v<E&&l[v]===O+1;)O++;T<M&&h.push(s.slice(T,M)),M<O+1&&h.push(u(s.slice(M,O+1))),T=O+1}return T<s.length&&h.push(s.slice(T)),h}t.highlight=n;function o(s,l){return s<l?-1:s>l?1:0}t.cmp=o})(tv||(tv={}));var nTt=function(){function t(e,r){this._source=e,this._count=r}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._count)},t.prototype.next=function(){if(!(this._count<=0)){var e=this._source.next();if(e!==void 0)return this._count--,e}},t}();var oTt=function(){function t(e){this._source=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.map(function(e){return e.clone()}))},t.prototype.next=function(){for(var e=new Array(this._source.length),r=0,i=this._source.length;r<i;++r){var n=this._source[r].next();if(n===void 0)return;e[r]=n}return e},t}();var Dee;(function(t){function e(r){var i=document.body,n=function(o){o.preventDefault(),o.stopPropagation(),o.clipboardData.setData("text",r),i.removeEventListener("copy",n,!0)};i.addEventListener("copy",n,!0),document.execCommand("copy")}t.copyText=e})(Dee||(Dee={}));var ho;(function(t){function e(o){var s=window.getComputedStyle(o),l=parseFloat(s.borderTopWidth)||0,u=parseFloat(s.borderLeftWidth)||0,h=parseFloat(s.borderRightWidth)||0,v=parseFloat(s.borderBottomWidth)||0,T=parseFloat(s.paddingTop)||0,E=parseFloat(s.paddingLeft)||0,M=parseFloat(s.paddingRight)||0,O=parseFloat(s.paddingBottom)||0,F=u+E+M+h,z=l+T+O+v;return{borderTop:l,borderLeft:u,borderRight:h,borderBottom:v,paddingTop:T,paddingLeft:E,paddingRight:M,paddingBottom:O,horizontalSum:F,verticalSum:z}}t.boxSizing=e;function r(o){var s=window.getComputedStyle(o),l=parseFloat(s.minWidth)||0,u=parseFloat(s.minHeight)||0,h=parseFloat(s.maxWidth)||1/0,v=parseFloat(s.maxHeight)||1/0;return h=Math.max(l,h),v=Math.max(u,v),{minWidth:l,minHeight:u,maxWidth:h,maxHeight:v}}t.sizeLimits=r;function i(o,s,l){var u=o.getBoundingClientRect();return s>=u.left&&s<u.right&&l>=u.top&&l<u.bottom}t.hitTest=i;function n(o,s){var l=o.getBoundingClientRect(),u=s.getBoundingClientRect();if(!(u.top<=l.top&&u.bottom>=l.bottom)){if(u.top<l.top&&u.height<=l.height){o.scrollTop-=l.top-u.top;return}if(u.bottom>l.bottom&&u.height>=l.height){o.scrollTop-=l.top-u.top;return}if(u.top<l.top&&u.height>l.height){o.scrollTop-=l.bottom-u.bottom;return}if(u.bottom>l.bottom&&u.height<l.height){o.scrollTop-=l.bottom-u.bottom;return}}}t.scrollIntoViewIfNeeded=n})(ho||(ho={}));var nl;(function(t){t.IS_MAC=!!navigator.platform.match(/Mac/i),t.IS_WIN=!!navigator.platform.match(/Win/i),t.IS_IE=/Trident/.test(navigator.userAgent),t.IS_EDGE=/Edge/.test(navigator.userAgent);function e(r){return t.IS_MAC?r.metaKey:r.ctrlKey}t.accelKey=e})(nl||(nl={}));var jf;(function(t){function e(n){if(n in Hf.specificityCache)return Hf.specificityCache[n];var o=Hf.calculateSingle(n);return Hf.specificityCache[n]=o}t.calculateSpecificity=e;function r(n){if(n in Hf.validityCache)return Hf.validityCache[n];var o=!0;try{Hf.testElem.querySelector(n)}catch{o=!1}return Hf.validityCache[n]=o}t.isValid=r;function i(n,o){return Hf.protoMatchFunc.call(n,o)}t.matches=i})(jf||(jf={}));var Hf;(function(t){t.specificityCache=Object.create(null),t.validityCache=Object.create(null),t.testElem=document.createElement("div"),t.protoMatchFunc=function(){var v=Element.prototype;return v.matches||v.matchesSelector||v.mozMatchesSelector||v.msMatchesSelector||v.oMatchesSelector||v.webkitMatchesSelector||function(T){var E=this,M=E.ownerDocument?E.ownerDocument.querySelectorAll(T):[];return Array.prototype.indexOf.call(M,E)!==-1}}();function e(v){v=v.split(",",1)[0];var T=0,E=0,M=0;function O(F){var z=v.match(F);return z===null?!1:(v=v.slice(z[0].length),!0)}for(v=v.replace(h," $1 ");v.length>0;){if(O(r)){T++;continue}if(O(i)){E++;continue}if(O(n)){E++;continue}if(O(s)){M++;continue}if(O(l)){E++;continue}if(O(o)){M++;continue}if(!O(u))return 0}return T=Math.min(T,255),E=Math.min(E,255),M=Math.min(M,255),T<<16|E<<8|M}t.calculateSingle=e;var r=/^#[^\s\+>~#\.\[:]+/,i=/^\.[^\s\+>~#\.\[:]+/,n=/^\[[^\]]+\]/,o=/^[^\s\+>~#\.\[:]+/,s=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,l=/^:[^\s\+>~#\.\[:]+/,u=/^[\s\+>~\*]+/,h=/:not\(([^\)]+)\)/g})(Hf||(Hf={}));var Lee=function(){function t(e){this._root=new la.LeafNode,this.cmp=e}return Object.defineProperty(t.prototype,"isEmpty",{get:function(){return this._root.size===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._root.size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"first",{get:function(){var e=la.firstLeaf(this._root);return e.size>0?e.items[0]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"last",{get:function(){var e=la.lastLeaf(this._root);return e.size>0?e.items[e.size-1]:void 0},enumerable:!0,configurable:!0}),t.prototype.iter=function(){return la.iterItems(this._root)},t.prototype.retro=function(){return la.retroItems(this._root)},t.prototype.slice=function(e,r){return la.sliceItems(this._root,e,r)},t.prototype.retroSlice=function(e,r){return la.retroSliceItems(this._root,e,r)},t.prototype.at=function(e){return la.itemAt(this._root,e)},t.prototype.has=function(e,r){return la.hasItem(this._root,e,r)},t.prototype.indexOf=function(e,r){return la.indexOf(this._root,e,r)},t.prototype.get=function(e,r){return la.getItem(this._root,e,r)},t.prototype.assign=function(e){this.clear(),this.update(e)},t.prototype.insert=function(e){var r=la.insertItem(this._root,e,this.cmp);return this._root=la.maybeSplitRoot(this._root),r},t.prototype.update=function(e){var r=this;Ei(e,function(i){r.insert(i)})},t.prototype.delete=function(e,r){var i=la.deleteItem(this._root,e,r);return this._root=la.maybeExtractRoot(this._root),i},t.prototype.remove=function(e){var r=la.removeItem(this._root,e);return this._root=la.maybeExtractRoot(this._root),r},t.prototype.clear=function(){la.clear(this._root),this._root=new la.LeafNode},t}();(function(t){function e(r,i){var n=new t(i);return n.assign(r),n}t.from=e})(Lee||(Lee={}));var la;(function(t){var e=function(){function he(){this.items=[],this.sizes=[],this.children=[]}return Object.defineProperty(he.prototype,"type",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(he.prototype,"size",{get:function(){return this.sizes[this.sizes.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(he.prototype,"width",{get:function(){return this.children.length},enumerable:!0,configurable:!0}),he}();t.BranchNode=e;var r=function(){function he(){this.next=null,this.prev=null,this.items=[]}return Object.defineProperty(he.prototype,"type",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(he.prototype,"size",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),Object.defineProperty(he.prototype,"width",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),he}();t.LeafNode=r;function i(he){for(;he.type===0;)he=he.children[0];return he}t.firstLeaf=i;function n(he){for(;he.type===0;)he=he.children[he.children.length-1];return he}t.lastLeaf=n;function o(he){var Le=i(he);return new ge(Le,0,-1)}t.iterItems=o;function s(he){var Le=n(he);return new j(Le,Le.size-1,-1)}t.retroItems=s;function l(he,Le,ft){Le===void 0?Le=0:Le<0?Le=Math.max(0,Le+he.size):Le=Math.min(Le,he.size),ft===void 0?ft=he.size:ft<0?ft=Math.max(0,ft+he.size):ft=Math.min(ft,he.size);var Vt=Math.max(0,ft-Le);if(Vt===0)return su();for(;he.type===0;){var Yt=me(he.sizes,Le);Yt>0&&(Le-=he.sizes[Yt-1]),he=he.children[Yt]}return new ge(he,Le,Vt)}t.sliceItems=l;function u(he,Le,ft){Le===void 0?Le=he.size-1:Le<0?Le=Math.max(-1,Le+he.size):Le=Math.min(Le,he.size-1),ft===void 0?ft=-1:ft<0?ft=Math.max(-1,ft+he.size):ft=Math.min(ft,he.size-1);var Vt=Math.max(0,Le-ft);if(Vt===0)return su();for(;he.type===0;){var Yt=me(he.sizes,Le);Yt>0&&(Le-=he.sizes[Yt-1]),he=he.children[Yt]}return new j(he,Le,Vt)}t.retroSliceItems=u;function h(he,Le){if(Le<0&&(Le+=he.size),!(Le<0||Le>=he.size)){for(;he.type===0;){var ft=me(he.sizes,Le);ft>0&&(Le-=he.sizes[ft-1]),he=he.children[ft]}return he.items[Le]}}t.itemAt=h;function v(he,Le,ft){for(;he.type===0;){var Vt=fe(he.items,Le,ft);he=he.children[Vt]}var Yt=$(he.items,Le,ft);return Yt>=0}t.hasItem=v;function T(he,Le,ft){for(var Vt=0;he.type===0;){var Yt=fe(he.items,Le,ft);Yt>0&&(Vt+=he.sizes[Yt-1]),he=he.children[Yt]}var mr=$(he.items,Le,ft);return mr>=0?Vt+mr:-Vt+mr}t.indexOf=T;function E(he,Le,ft){for(;he.type===0;){var Vt=fe(he.items,Le,ft);he=he.children[Vt]}var Yt=$(he.items,Le,ft);return Yt>=0?he.items[Yt]:void 0}t.getItem=E;function M(he,Le,ft){if(he.type===1){var Vt=$(he.items,Le,ft),Yt;return Vt>=0?(Yt=he.items[Vt],he.items[Vt]=Le):(Yt=void 0,rr.insert(he.items,-Vt-1,Le)),Yt}var mr=fe(he.items,Le,ft),Er=he.children[mr],Jr=Er.size,or=M(Er,Le,ft),ai=Er.size;if(he.items[mr]=Er.items[0],Jr===ai)return or;if(Er.width>K){var Jt=we(Er);rr.insert(he.children,mr+1,Jt),rr.insert(he.items,mr+1,Jt.items[0])}return Z(he,mr),or}t.insertItem=M;function O(he,Le,ft){if(he.type===1){var Vt=$(he.items,Le,ft);return Vt<0?void 0:rr.removeAt(he.items,Vt)}var Yt=fe(he.items,Le,ft),mr=he.children[Yt],Er=mr.size,Jr=O(mr,Le,ft),or=mr.size;return Er===or||(he.items[Yt]=mr.items[0],mr.width<ne&&(Yt=Oe(he,Yt)),Z(he,Yt)),Jr}t.deleteItem=O;function F(he,Le){if(Le<0&&(Le+=he.size),!(Le<0||Le>=he.size)){if(he.type===1)return rr.removeAt(he.items,Le);var ft=me(he.sizes,Le);ft>0&&(Le-=he.sizes[ft]);var Vt=he.children[ft],Yt=F(Vt,Le);return he.items[ft]=Vt.items[0],Vt.width<ne&&(ft=Oe(he,ft)),Z(he,ft),Yt}}t.removeItem=F;function z(he){he.type===0?(Ei(he.children,z),he.children.length=0,he.sizes.length=0,he.items.length=0):(he.items.length=0,he.next=null,he.prev=null)}t.clear=z;function W(he){if(he.width<=K)return he;var Le=new e,ft=we(he);return Le.sizes[0]=he.size,Le.sizes[1]=he.size+ft.size,Le.children[0]=he,Le.children[1]=ft,Le.items[0]=he.items[0],Le.items[1]=ft.items[0],Le}t.maybeSplitRoot=W;function J(he){if(he.type===1||he.children.length>1)return he;var Le=he.children.pop();return z(he),Le}t.maybeExtractRoot=J;var K=32,ne=K>>1,ge=function(){function he(Le,ft,Vt){this._node=Le,this._index=ft,this._count=Vt}return he.prototype.iter=function(){return this},he.prototype.clone=function(){return new he(this._node,this._index,this._count)},he.prototype.next=function(){if(!(this._node===null||this._count===0))return this._index>=this._node.size?(this._node=this._node.next,this._index=0,this.next()):(this._count>0&&this._count--,this._node.items[this._index++])},he}(),j=function(){function he(Le,ft,Vt){this._node=Le,this._index=ft,this._count=Vt}return he.prototype.iter=function(){return this},he.prototype.clone=function(){return new he(this._node,this._index,this._count)},he.prototype.next=function(){if(!(this._node===null||this._count===0))return this._index>=this._node.size&&(this._index=this._node.size-1),this._index<0?(this._node=this._node.prev,this._index=this._node?this._node.size-1:-1,this.next()):(this._count>0&&this._count--,this._node.items[this._index--])},he}();function me(he,Le){for(var ft=he.length,Vt=0;Vt<ft;++Vt)if(he[Vt]>Le)return Vt;return ft-1}function fe(he,Le,ft){for(var Vt=he.length,Yt=1;Yt<Vt;++Yt)if(ft(he[Yt],Le)>0)return Yt-1;return Vt-1}function $(he,Le,ft){for(var Vt=he.length,Yt=0;Yt<Vt;++Yt){var mr=ft(he[Yt],Le);if(mr===0)return Yt;if(mr>0)return-Yt-1}return-Vt-1}function Z(he,Le){for(var ft=he.sizes,Vt=he.children,Yt=Le>0?ft[Le-1]:0,mr=Vt.length;Le<mr;++Le)Yt=ft[Le]=Yt+Vt[Le].size;ft.length=Vt.length}function we(he){if(he.type===1){for(var Le=new r,ft=he.items,Vt=Le.items,Yt=ne,mr=ft.length;Yt<mr;++Yt)Vt.push(ft[Yt]);return ft.length=ne,he.next&&(he.next.prev=Le),Le.next=he.next,Le.prev=he,he.next=Le,Le}for(var Er=new e,Jr=he.children,or=Er.children,Yt=ne,mr=Jr.length;Yt<mr;++Yt)or.push(Jr[Yt]);Jr.length=ne;for(var ai=he.items,Jt=Er.items,Yt=ne,mr=ai.length;Yt<mr;++Yt)Jt.push(ai[Yt]);return ai.length=ne,Z(he,ne),Z(Er,0),Er}function Oe(he,Le){var ft,Vt,Yt,mr,Er,Jr,or=he.children[Le],ai=Le===0?he.children[Le+1]:he.children[Le-1],Jt=Le===0,qt=or.type===1,wi=ai.width>ne;if(qt&&wi&&Jt){var ae=or,be=ai;return ae.items.push(be.items.shift()),he.items[Le+1]=be.items[0],Le}if(qt&&wi&&!Jt){var ae=or,be=ai;return ae.items.unshift(be.items.pop()),he.items[Le]=ae.items[0],Le-1}if(qt&&!wi&&Jt){var ae=or,be=ai;return(ft=be.items).unshift.apply(ft,ae.items),rr.removeAt(he.children,Le),rr.removeAt(he.items,Le+1),ae.prev&&(ae.prev.next=be),be.prev=ae.prev,z(ae),Le}if(qt&&!wi&&!Jt){var ae=or,be=ai;return(Vt=be.items).push.apply(Vt,ae.items),rr.removeAt(he.children,Le),rr.removeAt(he.items,Le),ae.next&&(ae.next.prev=be),be.next=ae.next,z(ae),Le-1}if(!qt&&wi&&Jt){var ae=or,be=ai;return ae.children.push(be.children.shift()),ae.items.push(be.items.shift()),he.items[Le+1]=be.items[0],Z(ae,ae.width-1),Z(be,0),Le}if(!qt&&wi&&!Jt){var ae=or,be=ai;return ae.children.unshift(be.children.pop()),ae.items.unshift(be.items.pop()),he.items[Le]=ae.items[0],Z(ae,0),Z(be,be.width-1),Le-1}if(!qt&&!wi&&Jt){var ae=or,be=ai;return(Yt=be.children).unshift.apply(Yt,ae.children),(mr=be.items).unshift.apply(mr,ae.items),rr.removeAt(he.children,Le),rr.removeAt(he.items,Le+1),Z(be,0),ae.children.length=0,z(ae),Le}if(!qt&&!wi&&!Jt){var ae=or,be=ai;return(Er=be.children).push.apply(Er,ae.children),(Jr=be.items).push.apply(Jr,ae.items),rr.removeAt(he.children,Le),rr.removeAt(he.items,Le),Z(be,0),ae.children.length=0,z(ae),Le-1}throw"unreachable"}})(la||(la={}));var WI=function(){function t(){this._first=null,this._last=null,this._size=0}return Object.defineProperty(t.prototype,"isEmpty",{get:function(){return this._size===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"first",{get:function(){return this._first?this._first.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"last",{get:function(){return this._last?this._last.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstNode",{get:function(){return this._first},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastNode",{get:function(){return this._last},enumerable:!0,configurable:!0}),t.prototype.iter=function(){return new t.ForwardValueIterator(this._first)},t.prototype.retro=function(){return new t.RetroValueIterator(this._last)},t.prototype.nodes=function(){return new t.ForwardNodeIterator(this._first)},t.prototype.retroNodes=function(){return new t.RetroNodeIterator(this._last)},t.prototype.assign=function(e){var r=this;this.clear(),Ei(e,function(i){r.addLast(i)})},t.prototype.push=function(e){this.addLast(e)},t.prototype.pop=function(){return this.removeLast()},t.prototype.shift=function(e){this.addFirst(e)},t.prototype.unshift=function(){return this.removeFirst()},t.prototype.addFirst=function(e){var r=new ep.LinkedListNode(this,e);return this._first?(r.next=this._first,this._first.prev=r,this._first=r):(this._first=r,this._last=r),this._size++,r},t.prototype.addLast=function(e){var r=new ep.LinkedListNode(this,e);return this._last?(r.prev=this._last,this._last.next=r,this._last=r):(this._first=r,this._last=r),this._size++,r},t.prototype.insertBefore=function(e,r){if(!r||r===this._first)return this.addFirst(e);if(!(r instanceof ep.LinkedListNode)||r.list!==this)throw new Error("Reference node is not owned by the list.");var i=new ep.LinkedListNode(this,e),n=r,o=n.prev;return i.next=n,i.prev=o,n.prev=i,o.next=i,this._size++,i},t.prototype.insertAfter=function(e,r){if(!r||r===this._last)return this.addLast(e);if(!(r instanceof ep.LinkedListNode)||r.list!==this)throw new Error("Reference node is not owned by the list.");var i=new ep.LinkedListNode(this,e),n=r,o=n.next;return i.next=o,i.prev=n,n.next=i,o.prev=i,this._size++,i},t.prototype.removeFirst=function(){var e=this._first;if(e)return e===this._last?(this._first=null,this._last=null):(this._first=e.next,this._first.prev=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value},t.prototype.removeLast=function(){var e=this._last;if(e)return e===this._first?(this._first=null,this._last=null):(this._last=e.prev,this._last.next=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value},t.prototype.removeNode=function(e){if(!(e instanceof ep.LinkedListNode)||e.list!==this)throw new Error("Node is not owned by the list.");var r=e;r===this._first&&r===this._last?(this._first=null,this._last=null):r===this._first?(this._first=r.next,this._first.prev=null):r===this._last?(this._last=r.prev,this._last.next=null):(r.next.prev=r.prev,r.prev.next=r.next),r.list=null,r.next=null,r.prev=null,this._size--},t.prototype.clear=function(){for(var e=this._first;e;){var r=e.next;e.list=null,e.prev=null,e.next=null,e=r}this._first=null,this._last=null,this._size=0},t}();(function(t){function e(s){var l=new t;return l.assign(s),l}t.from=e;var r=function(){function s(l){this._node=l}return s.prototype.iter=function(){return this},s.prototype.clone=function(){return new s(this._node)},s.prototype.next=function(){if(this._node){var l=this._node;return this._node=l.next,l.value}},s}();t.ForwardValueIterator=r;var i=function(){function s(l){this._node=l}return s.prototype.iter=function(){return this},s.prototype.clone=function(){return new s(this._node)},s.prototype.next=function(){if(this._node){var l=this._node;return this._node=l.prev,l.value}},s}();t.RetroValueIterator=i;var n=function(){function s(l){this._node=l}return s.prototype.iter=function(){return this},s.prototype.clone=function(){return new s(this._node)},s.prototype.next=function(){if(this._node){var l=this._node;return this._node=l.next,l}},s}();t.ForwardNodeIterator=n;var o=function(){function s(l){this._node=l}return s.prototype.iter=function(){return this},s.prototype.clone=function(){return new s(this._node)},s.prototype.next=function(){if(this._node){var l=this._node;return this._node=l.prev,l}},s}();t.RetroNodeIterator=o})(WI||(WI={}));var ep;(function(t){var e=function(){function r(i,n){this.list=null,this.next=null,this.prev=null,this.list=i,this.value=n}return r}();t.LinkedListNode=e})(ep||(ep={}));var Y4=function(t,e){return Y4=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},Y4(t,e)};function jMe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Y4(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var au=function(){function t(e){this.type=e}return Object.defineProperty(t.prototype,"isConflatable",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.conflate=function(e){return!1},t}(),iv=function(t){jMe(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"isConflatable",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.conflate=function(r){return!0},e}(au),xr;(function(t){function e($,Z){var we=v.get($);if(!we||we.length===0){J($,Z);return}var Oe=Mee(Oee(we),function(he){return he?W(he,$,Z):!0});Oe&&J($,Z)}t.sendMessage=e;function r($,Z){if(!Z.isConflatable){K($,Z);return}var we=Iee(h,function(Oe){return Oe.handler!==$||!Oe.msg||Oe.msg.type!==Z.type||!Oe.msg.isConflatable?!1:Oe.msg.conflate(Z)});we||K($,Z)}t.postMessage=r;function i($,Z){var we=v.get($);we&&we.indexOf(Z)!==-1||(we?we.push(Z):v.set($,[Z]))}t.installMessageHook=i;function n($,Z){var we=v.get($);if(we){var Oe=we.indexOf(Z);Oe!==-1&&(we[Oe]=null,ge(we))}}t.removeMessageHook=n;function o($){var Z=v.get($);Z&&Z.length>0&&(rr.fill(Z,null),ge(Z)),Ei(h,function(we){we.handler===$&&(we.handler=null,we.msg=null)})}t.clearData=o;function s(){O||M===0||(z(M),O=!0,ne(),O=!1)}t.flush=s;function l(){return E}t.getExceptionHandler=l;function u($){var Z=E;return E=$,Z}t.setExceptionHandler=u;var h=new WI,v=new WeakMap,T=new Set,E=function($){console.error($)},M=0,O=!1,F=function(){var $=typeof requestAnimationFrame=="function";return $?requestAnimationFrame:setImmediate}(),z=function(){var $=typeof cancelAnimationFrame=="function";return $?cancelAnimationFrame:clearImmediate}();function W($,Z,we){var Oe=!0;try{typeof $=="function"?Oe=$(Z,we):Oe=$.messageHook(Z,we)}catch(he){E(he)}return Oe}function J($,Z){try{$.processMessage(Z)}catch(we){E(we)}}function K($,Z){h.addLast({handler:$,msg:Z}),M===0&&(M=F(ne))}function ne(){if(M=0,!h.isEmpty){var $={handler:null,msg:null};for(h.addLast($);;){var Z=h.removeFirst();if(Z===$)return;Z.handler&&Z.msg&&e(Z.handler,Z.msg)}}}function ge($){T.size===0&&F(j),T.add($)}function j(){T.forEach(me),T.clear()}function me($){rr.removeAllWhere($,fe)}function fe($){return $===null}})(xr||(xr={}));var lc=function(){function t(e){this._pid=jg.nextPID(),this.name=e.name,this._create=e.create,this._coerce=e.coerce||null,this._compare=e.compare||null,this._changed=e.changed||null}return t.prototype.get=function(e){var r,i=jg.ensureMap(e);return this._pid in i?r=i[this._pid]:r=i[this._pid]=this._createValue(e),r},t.prototype.set=function(e,r){var i,n=jg.ensureMap(e);this._pid in n?i=n[this._pid]:i=n[this._pid]=this._createValue(e);var o=this._coerceValue(e,r);this._maybeNotify(e,i,n[this._pid]=o)},t.prototype.coerce=function(e){var r,i=jg.ensureMap(e);this._pid in i?r=i[this._pid]:r=i[this._pid]=this._createValue(e);var n=this._coerceValue(e,r);this._maybeNotify(e,r,i[this._pid]=n)},t.prototype._createValue=function(e){var r=this._create;return r(e)},t.prototype._coerceValue=function(e,r){var i=this._coerce;return i?i(e,r):r},t.prototype._compareValue=function(e,r){var i=this._compare;return i?i(e,r):e===r},t.prototype._maybeNotify=function(e,r,i){var n=this._changed;n&&!this._compareValue(r,i)&&n(e,r,i)},t}();(function(t){function e(r){jg.ownerData.delete(r)}t.clearData=e})(lc||(lc={}));var jg;(function(t){t.ownerData=new WeakMap,t.nextPID=function(){var r=0;return function(){var i=Math.random(),n=(""+i).slice(2);return"pid-"+n+"-"+r++}}();function e(r){var i=t.ownerData.get(r);return i||(i=Object.create(null),t.ownerData.set(r,i),i)}t.ensureMap=e})(jg||(jg={}));var Wn=function(){function t(e){this._blockedCount=0,this.sender=e}return t.prototype.block=function(e){this._blockedCount++;try{e()}finally{this._blockedCount--}},t.prototype.connect=function(e,r){return Lc.connect(this,e,r)},t.prototype.disconnect=function(e,r){return Lc.disconnect(this,e,r)},t.prototype.emit=function(e){this._blockedCount||Lc.emit(this,e)},t}();(function(t){function e(h,v){var T=Lc.blockedProperty;T.set(h,T.get(h)+1);try{v()}finally{T.set(h,T.get(h)-1)}}t.blockAll=e;function r(h,v){Lc.disconnectBetween(h,v)}t.disconnectBetween=r;function i(h){Lc.disconnectSender(h)}t.disconnectSender=i;function n(h){Lc.disconnectReceiver(h)}t.disconnectReceiver=n;function o(h){Lc.disconnectAll(h)}t.disconnectAll=o;function s(h){Lc.disconnectAll(h)}t.clearData=s;function l(){return Lc.exceptionHandler}t.getExceptionHandler=l;function u(h){var v=Lc.exceptionHandler;return Lc.exceptionHandler=h,v}t.setExceptionHandler=u})(Wn||(Wn={}));var Lc;(function(t){t.exceptionHandler=function(J){console.error(J)};function e(J,K,ne){ne=ne||void 0;var ge=u.get(J.sender);if(ge||(ge=[],u.set(J.sender,ge)),E(ge,J,K,ne))return!1;var j=ne||K,me=h.get(j);me||(me=[],h.set(j,me));var fe={signal:J,slot:K,thisArg:ne};return ge.push(fe),me.push(fe),!0}t.connect=e;function r(J,K,ne){ne=ne||void 0;var ge=u.get(J.sender);if(!ge||ge.length===0)return!1;var j=E(ge,J,K,ne);if(!j)return!1;var me=ne||K,fe=h.get(me);return j.signal=null,O(ge),O(fe),!0}t.disconnect=r;function i(J,K){var ne=u.get(J);if(!(!ne||ne.length===0)){var ge=h.get(K);!ge||ge.length===0||(Ei(ge,function(j){j.signal&&j.signal.sender===J&&(j.signal=null)}),O(ne),O(ge))}}t.disconnectBetween=i;function n(J){var K=u.get(J);!K||K.length===0||(Ei(K,function(ne){if(ne.signal){var ge=ne.thisArg||ne.slot;ne.signal=null,O(h.get(ge))}}),O(K))}t.disconnectSender=n;function o(J){var K=h.get(J);!K||K.length===0||(Ei(K,function(ne){if(ne.signal){var ge=ne.signal.sender;ne.signal=null,O(u.get(ge))}}),O(K))}t.disconnectReceiver=o;function s(J){n(J),o(J)}t.disconnectAll=s;function l(J,K){if(!(t.blockedProperty.get(J.sender)>0)){var ne=u.get(J.sender);if(!(!ne||ne.length===0))for(var ge=0,j=ne.length;ge<j;++ge){var me=ne[ge];me.signal===J&&M(me,K)}}}t.emit=l;var u=new WeakMap,h=new WeakMap,v=new Set,T=function(){var J=typeof requestAnimationFrame=="function";return J?requestAnimationFrame:setImmediate}();function E(J,K,ne,ge){return rv(J,function(j){return j.signal===K&&j.slot===ne&&j.thisArg===ge})}function M(J,K){var ne=J.signal,ge=J.slot,j=J.thisArg;try{ge.call(j,ne.sender,K)}catch(me){t.exceptionHandler(me)}}function O(J){v.size===0&&T(F),v.add(J)}function F(){v.forEach(z),v.clear()}function z(J){rr.removeAllWhere(J,W)}function W(J){return J.signal===null}t.blockedProperty=new lc({name:"blocked",create:function(){return 0}})})(Lc||(Lc={}));var K4=function(t,e){return K4=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},K4(t,e)};function Nee(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");K4(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var wA=function(){function t(e){this._fn=e}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return!this._fn},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){if(this._fn){var e=this._fn;this._fn=null,e()}},t}(),yTt=function(t){Nee(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._disposed=new Wn(r),r}return Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._disposed.emit(void 0),Wn.clearData(this))},e}(wA),Z4=function(){function t(){this._isDisposed=!1,this._items=new Set}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(function(e){e.dispose()}),this._items.clear())},t.prototype.contains=function(e){return this._items.has(e)},t.prototype.add=function(e){this._items.add(e)},t.prototype.remove=function(e){this._items.delete(e)},t.prototype.clear=function(){this._items.clear()},t}();(function(t){function e(r){var i=new t;return Ei(r,function(n){i.add(n)}),i}t.from=e})(Z4||(Z4={}));var Fee=function(t){Nee(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._disposed=new Wn(r),r}return Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._disposed.emit(void 0),Wn.clearData(this))},e}(Z4);(function(t){function e(r){var i=new t;return Ei(r,function(n){i.add(n)}),i}t.from=e})(Fee||(Fee={}));var TA=function(){function t(e){var r=this;this._onScrollFrame=function(){if(r._scrollTarget){var i=r._scrollTarget,n=i.element,o=i.edge,s=i.distance,l=Wl.SCROLL_EDGE_SIZE-s,u=Math.pow(l/Wl.SCROLL_EDGE_SIZE,2),h=Math.max(1,Math.round(u*Wl.SCROLL_EDGE_SIZE));switch(o){case"top":n.scrollTop-=h;break;case"left":n.scrollLeft-=h;break;case"right":n.scrollLeft+=h;break;case"bottom":n.scrollTop+=h;break}requestAnimationFrame(r._onScrollFrame)}},this._disposed=!1,this._dropAction="none",this._override=null,this._currentTarget=null,this._currentElement=null,this._promise=null,this._scrollTarget=null,this._resolve=null,this.document=e.document||document,this.mimeData=e.mimeData,this.dragImage=e.dragImage||null,this.proposedAction=e.proposedAction||"copy",this.supportedActions=e.supportedActions||"all",this.source=e.source||null}return t.prototype.dispose=function(){if(!this._disposed){if(this._disposed=!0,this._currentTarget){var e=Wl.createMouseEvent("pointerup",-1,-1);Wl.dispatchDragLeave(this,this._currentTarget,null,e)}this._finalize("none")}},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),t.prototype.start=function(e,r){var i=this;if(this._disposed)return Promise.resolve("none");if(this._promise)return this._promise;this._addListeners(),this._attachDragImage(e,r),this._promise=new Promise(function(o,s){i._resolve=o});var n=Wl.createMouseEvent("pointermove",e,r);return document.dispatchEvent(n),this._promise},t.prototype.handleEvent=function(e){switch(e.type){case"mousemove":this._evtMouseMove(e);break;case"mouseup":this._evtMouseUp(e);break;case"pointermove":this._evtMouseMove(e);break;case"pointerup":this._evtMouseUp(e);break;case"keydown":this._evtKeyDown(e);break;default:e.preventDefault(),e.stopPropagation();break}},t.prototype.moveDragImage=function(e,r){if(this.dragImage){var i=this.dragImage.style;i.top=r+"px",i.left=e+"px"}},t.prototype._evtMouseMove=function(e){e.preventDefault(),e.stopPropagation(),this._updateCurrentTarget(e),this._updateDragScroll(e),this.moveDragImage(e.clientX,e.clientY)},t.prototype._evtMouseUp=function(e){if(e.preventDefault(),e.stopPropagation(),e.button===0){if(this._updateCurrentTarget(e),!this._currentTarget){this._finalize("none");return}if(this._dropAction==="none"){Wl.dispatchDragLeave(this,this._currentTarget,null,e),this._finalize("none");return}var r=Wl.dispatchDrop(this,this._currentTarget,e);this._finalize(r)}},t.prototype._evtKeyDown=function(e){e.preventDefault(),e.stopPropagation(),e.keyCode===27&&this.dispose()},t.prototype._addListeners=function(){document.addEventListener("mousedown",this,!0),document.addEventListener("mousemove",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("mouseenter",this,!0),document.addEventListener("mouseleave",this,!0),document.addEventListener("mouseover",this,!0),document.addEventListener("mouseout",this,!0),document.addEventListener("pointerdown",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("pointerup",this,!0),document.addEventListener("pointerenter",this,!0),document.addEventListener("pointerleave",this,!0),document.addEventListener("pointerover",this,!0),document.addEventListener("pointerout",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("keyup",this,!0),document.addEventListener("keypress",this,!0),document.addEventListener("contextmenu",this,!0)},t.prototype._removeListeners=function(){document.removeEventListener("mousedown",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("mouseenter",this,!0),document.removeEventListener("mouseleave",this,!0),document.removeEventListener("mouseover",this,!0),document.removeEventListener("mouseout",this,!0),document.removeEventListener("pointerdown",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointerenter",this,!0),document.removeEventListener("pointerleave",this,!0),document.removeEventListener("pointerover",this,!0),document.removeEventListener("pointerout",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("keyup",this,!0),document.removeEventListener("keypress",this,!0),document.removeEventListener("contextmenu",this,!0)},t.prototype._updateDragScroll=function(e){var r=Wl.findScrollTarget(e);!this._scrollTarget&&!r||(this._scrollTarget||setTimeout(this._onScrollFrame,500),this._scrollTarget=r)},t.prototype._updateCurrentTarget=function(e){var r=this._currentTarget,i=this._currentTarget,n=this._currentElement,o=this.document.elementFromPoint(e.clientX,e.clientY);this._currentElement=o,o!==n&&o!==i&&Wl.dispatchDragExit(this,i,o,e),o!==n&&o!==i&&(i=Wl.dispatchDragEnter(this,o,i,e)),i!==r&&(this._currentTarget=i,Wl.dispatchDragLeave(this,r,i,e));var s=Wl.dispatchDragOver(this,i,e);this._setDropAction(s)},t.prototype._attachDragImage=function(e,r){if(this.dragImage){this.dragImage.classList.add("lm-mod-drag-image"),this.dragImage.classList.add("p-mod-drag-image");var i=this.dragImage.style;i.pointerEvents="none",i.position="fixed",i.top=r+"px",i.left=e+"px";var n=this.document instanceof Document?this.document.body:this.document.firstElementChild;n.appendChild(this.dragImage)}},t.prototype._detachDragImage=function(){if(this.dragImage){var e=this.dragImage.parentNode;e&&e.removeChild(this.dragImage)}},t.prototype._setDropAction=function(e){if(e=Wl.validateAction(e,this.supportedActions),!(this._override&&this._dropAction===e))switch(e){case"none":this._dropAction=e,this._override=t.overrideCursor("no-drop",this.document);break;case"copy":this._dropAction=e,this._override=t.overrideCursor("copy",this.document);break;case"link":this._dropAction=e,this._override=t.overrideCursor("alias",this.document);break;case"move":this._dropAction=e,this._override=t.overrideCursor("move",this.document);break}},t.prototype._finalize=function(e){var r=this._resolve;this._removeListeners(),this._detachDragImage(),this._override&&(this._override.dispose(),this._override=null),this.mimeData.clear(),this._disposed=!0,this._dropAction="none",this._currentTarget=null,this._currentElement=null,this._scrollTarget=null,this._promise=null,this._resolve=null,r&&r(e)},t}();(function(t){function e(i,n){n===void 0&&(n=document);var o=++r,s=n instanceof Document?n.body:n.firstElementChild;return s.style.cursor=i,s.classList.add("lm-mod-override-cursor"),s.classList.add("p-mod-override-cursor"),new wA(function(){o===r&&(s.style.cursor="",s.classList.remove("lm-mod-override-cursor"),s.classList.remove("p-mod-override-cursor"))})}t.overrideCursor=e;var r=0})(TA||(TA={}));var Wl;(function(t){t.SCROLL_EDGE_SIZE=20;function e(E,M){return h[E]&v[M]?E:"none"}t.validateAction=e;function r(E,M,O){var F=document.createEvent("MouseEvent");return F.initMouseEvent(E,!0,!0,window,0,0,0,M,O,!1,!1,!1,!1,0,null),F}t.createMouseEvent=r;function i(E){for(var M=E.clientX,O=E.clientY,F=document.elementFromPoint(M,O);F;F=F.parentElement){var z=F.hasAttribute("data-lm-dragscroll");if(z=z||F.hasAttribute("data-p-dragscroll"),!!z){var W=0,J=0;F===document.body&&(W=window.pageXOffset,J=window.pageYOffset);var K=F.getBoundingClientRect(),ne=K.top+J,ge=K.left+W,j=ge+K.width,me=ne+K.height;if(!(M<ge||M>=j||O<ne||O>=me)){var fe=M-ge+1,$=O-ne+1,Z=j-M,we=me-O,Oe=Math.min(fe,$,Z,we);if(!(Oe>t.SCROLL_EDGE_SIZE)){var he=void 0;switch(Oe){case we:he="bottom";break;case $:he="top";break;case Z:he="right";break;case fe:he="left";break;default:throw"unreachable"}var Le=F.scrollWidth-F.clientWidth,ft=F.scrollHeight-F.clientHeight,Vt=void 0;switch(he){case"top":Vt=ft>0&&F.scrollTop>0;break;case"left":Vt=Le>0&&F.scrollLeft>0;break;case"right":Vt=Le>0&&F.scrollLeft<Le;break;case"bottom":Vt=ft>0&&F.scrollTop<ft;break;default:throw"unreachable"}if(Vt)return{element:F,edge:he,distance:Oe}}}}}return null}t.findScrollTarget=i;function n(E,M,O,F){if(!M)return null;var z=T("lm-dragenter",E,F,O),W=!M.dispatchEvent(z);if(W||(z=T("p-dragenter",E,F,O),W=!M.dispatchEvent(z),W))return M;var J=E.document instanceof Document?E.document.body:E.document.firstElementChild;return M===J?O:(z=T("lm-dragenter",E,F,O),J.dispatchEvent(z),z=T("p-dragenter",E,F,O),J.dispatchEvent(z),J)}t.dispatchDragEnter=n;function o(E,M,O,F){if(M){var z=T("lm-dragexit",E,F,O);M.dispatchEvent(z),z=T("p-dragexit",E,F,O),M.dispatchEvent(z)}}t.dispatchDragExit=o;function s(E,M,O,F){if(M){var z=T("lm-dragleave",E,F,O);M.dispatchEvent(z),z=T("p-dragleave",E,F,O),M.dispatchEvent(z)}}t.dispatchDragLeave=s;function l(E,M,O){if(!M)return"none";var F=T("lm-dragover",E,O,null),z=!M.dispatchEvent(F);return z||(F=T("p-dragover",E,O,null),z=!M.dispatchEvent(F),z)?F.dropAction:"none"}t.dispatchDragOver=l;function u(E,M,O){if(!M)return"none";var F=T("lm-drop",E,O,null),z=!M.dispatchEvent(F);return z||(F=T("p-drop",E,O,null),z=!M.dispatchEvent(F),z)?F.dropAction:"none"}t.dispatchDrop=u;var h={none:0,copy:1,link:2,move:4},v={none:h.none,copy:h.copy,link:h.link,move:h.move,"copy-link":h.copy|h.link,"copy-move":h.copy|h.move,"link-move":h.link|h.move,all:h.copy|h.link|h.move};function T(E,M,O,F){var z=document.createEvent("MouseEvent");return z.initMouseEvent(E,!0,!0,window,0,O.screenX,O.screenY,O.clientX,O.clientY,O.ctrlKey,O.altKey,O.shiftKey,O.metaKey,O.button,F),z.dropAction="none",z.mimeData=M.mimeData,z.proposedAction=M.proposedAction,z.supportedActions=M.supportedActions,z.source=M.source,z}})(Wl||(Wl={}));var qg=ga(gy());var cc=ga(gy());function nv(){return Q4.keyboardLayout}var J4=function(){function t(e,r,i){i===void 0&&(i=[]),this.name=e,this._codes=r,this._keys=t.extractKeys(r),this._modifierKeys=t.convertToKeySet(i)}return t.prototype.keys=function(){return Object.keys(this._keys)},t.prototype.isValidKey=function(e){return e in this._keys},t.prototype.isModifierKey=function(e){return e in this._modifierKeys},t.prototype.keyForKeydownEvent=function(e){return this._codes[e.keyCode]||""},t}();(function(t){function e(i){var n=Object.create(null);for(var o in i)n[i[o]]=!0;return n}t.extractKeys=e;function r(i){for(var n=Object(null),o=0,s=i.length;o<s;++o)n[i[o]]=!0;return n}t.convertToKeySet=r})(J4||(J4={}));var GMe=new J4("en-us",{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",27:"Escape",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",93:"ContextMenu",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Meta"},["Shift","Ctrl","Alt","Meta"]),Q4;(function(t){t.keyboardLayout=GMe})(Q4||(Q4={}));var $4=function(){return $4=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},$4.apply(this,arguments)},ov=function(){function t(){this._timerID=0,this._replaying=!1,this._keystrokes=[],this._keydownEvents=[],this._keyBindings=[],this._exactKeyMatch=null,this._commands=Object.create(null),this._commandChanged=new Wn(this),this._commandExecuted=new Wn(this),this._keyBindingChanged=new Wn(this)}return Object.defineProperty(t.prototype,"commandChanged",{get:function(){return this._commandChanged},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"commandExecuted",{get:function(){return this._commandExecuted},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keyBindingChanged",{get:function(){return this._keyBindingChanged},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keyBindings",{get:function(){return this._keyBindings},enumerable:!0,configurable:!0}),t.prototype.listCommands=function(){return Object.keys(this._commands)},t.prototype.hasCommand=function(e){return e in this._commands},t.prototype.addCommand=function(e,r){var i=this;if(e in this._commands)throw new Error("Command '"+e+"' already registered.");return this._commands[e]=EA.createCommand(r),this._commandChanged.emit({id:e,type:"added"}),new wA(function(){delete i._commands[e],i._commandChanged.emit({id:e,type:"removed"})})},t.prototype.notifyCommandChanged=function(e){if(e!==void 0&&!(e in this._commands))throw new Error("Command '"+e+"' is not registered.");this._commandChanged.emit({id:e,type:e?"changed":"many-changed"})},t.prototype.describedBy=function(e){var r=this._commands[e];return r?r.describedBy||{args:null}:{args:null}},t.prototype.label=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.label.call(void 0,r):""},t.prototype.mnemonic=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.mnemonic.call(void 0,r):-1},t.prototype.icon=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.icon.call(void 0,r):""},t.prototype.iconClass=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.iconClass.call(void 0,r):""},t.prototype.iconLabel=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.iconLabel.call(void 0,r):""},t.prototype.caption=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.caption.call(void 0,r):""},t.prototype.usage=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.usage.call(void 0,r):""},t.prototype.className=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.className.call(void 0,r):""},t.prototype.dataset=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.dataset.call(void 0,r):{}},t.prototype.isEnabled=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.isEnabled.call(void 0,r):!1},t.prototype.isToggled=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.isToggled.call(void 0,r):!1},t.prototype.isToggleable=function(e,r){var i=this._commands[e];return i?i.isToggleable:!1},t.prototype.isVisible=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];return i?i.isVisible.call(void 0,r):!1},t.prototype.execute=function(e,r){r===void 0&&(r=cc.JSONExt.emptyObject);var i=this._commands[e];if(!i)return Promise.reject(new Error("Command '"+e+"' not registered."));var n;try{n=i.execute.call(void 0,r)}catch(s){n=Promise.reject(s)}var o=Promise.resolve(n);return this._commandExecuted.emit({id:e,args:r,result:o}),o},t.prototype.addKeyBinding=function(e){var r=this,i=EA.createKeyBinding(e);return this._keyBindings.push(i),this._keyBindingChanged.emit({binding:i,type:"added"}),new wA(function(){rr.removeFirstOf(r._keyBindings,i),r._keyBindingChanged.emit({binding:i,type:"removed"})})},t.prototype.processKeydownEvent=function(e){if(!(this._replaying||t.isModifierKeyPressed(e))){var r=t.keystrokeForKeydownEvent(e);if(!r){this._replayKeydownEvents(),this._clearPendingState();return}this._keystrokes.push(r);var i=EA.matchKeyBinding(this._keyBindings,this._keystrokes,e),n=i.exact,o=i.partial;if(!n&&!o){this._replayKeydownEvents(),this._clearPendingState();return}if(e.preventDefault(),e.stopPropagation(),n&&!o){this._executeKeyBinding(n),this._clearPendingState();return}n&&(this._exactKeyMatch=n),this._keydownEvents.push(e),this._startTimer()}},t.prototype._startTimer=function(){var e=this;this._clearTimer(),this._timerID=window.setTimeout(function(){e._onPendingTimeout()},EA.CHORD_TIMEOUT)},t.prototype._clearTimer=function(){this._timerID!==0&&(clearTimeout(this._timerID),this._timerID=0)},t.prototype._replayKeydownEvents=function(){this._keydownEvents.length!==0&&(this._replaying=!0,this._keydownEvents.forEach(EA.replayKeyEvent),this._replaying=!1)},t.prototype._executeKeyBinding=function(e){var r=e.command,i=e.args;if(!this.hasCommand(r)||!this.isEnabled(r,i)){var n=this.hasCommand(r)?"enabled":"registered",o=e.keys.join(", "),s="Cannot execute key binding '"+o+"':",l="command '"+r+"' is not "+n+".";console.warn(s+" "+l);return}this.execute(r,i)},t.prototype._clearPendingState=function(){this._clearTimer(),this._exactKeyMatch=null,this._keystrokes.length=0,this._keydownEvents.length=0},t.prototype._onPendingTimeout=function(){this._timerID=0,this._exactKeyMatch?this._executeKeyBinding(this._exactKeyMatch):this._replayKeydownEvents(),this._clearPendingState()},t}();(function(t){function e(l){for(var u="",h=!1,v=!1,T=!1,E=!1,M=0,O=l.split(/\s+/);M<O.length;M++){var F=O[M];F==="Accel"?nl.IS_MAC?v=!0:T=!0:F==="Alt"?h=!0:F==="Cmd"?v=!0:F==="Ctrl"?T=!0:F==="Shift"?E=!0:F.length>0&&(u=F)}return{cmd:v,ctrl:T,alt:h,shift:E,key:u}}t.parseKeystroke=e;function r(l){var u="",h=e(l);return h.ctrl&&(u+="Ctrl "),h.alt&&(u+="Alt "),h.shift&&(u+="Shift "),h.cmd&&nl.IS_MAC&&(u+="Cmd "),u+h.key}t.normalizeKeystroke=r;function i(l){var u;return nl.IS_WIN?u=l.winKeys||l.keys:nl.IS_MAC?u=l.macKeys||l.keys:u=l.linuxKeys||l.keys,u.map(r)}t.normalizeKeys=i;function n(l){return typeof l=="string"?u(l):l.map(u).join(", ");function u(h){var v=[],T=nl.IS_MAC?" ":"+",E=e(h);return E.ctrl&&v.push("Ctrl"),E.alt&&v.push("Alt"),E.shift&&v.push("Shift"),nl.IS_MAC&&E.cmd&&v.push("Cmd"),v.push(E.key),v.map(EA.formatKey).join(T)}}t.formatKeystroke=n;function o(l){var u=nv(),h=u.keyForKeydownEvent(l);return u.isModifierKey(h)}t.isModifierKeyPressed=o;function s(l){var u=nv(),h=u.keyForKeydownEvent(l);if(!h||u.isModifierKey(h))return"";var v=[];return l.ctrlKey&&v.push("Ctrl"),l.altKey&&v.push("Alt"),l.shiftKey&&v.push("Shift"),l.metaKey&&nl.IS_MAC&&v.push("Cmd"),v.push(h),v.join(" ")}t.keystrokeForKeydownEvent=s})(ov||(ov={}));var EA;(function(t){t.CHORD_TIMEOUT=1e3;function e(K){var ne,ge;return!K.icon||typeof K.icon=="string"?(ge=O(K.iconClass||K.icon,u),ne=ge):(ge=O(K.iconClass,u),ne=O(K.icon,M)),{execute:K.execute,describedBy:$4({args:null},K.describedBy),label:O(K.label,u),mnemonic:O(K.mnemonic,h),icon:ne,iconClass:ge,iconLabel:O(K.iconLabel,u),caption:O(K.caption,u),usage:O(K.usage,u),className:O(K.className,u),dataset:O(K.dataset,E),isEnabled:K.isEnabled||v,isToggled:K.isToggled||T,isToggleable:K.isToggleable||!!K.isToggled,isVisible:K.isVisible||v}}t.createCommand=e;function r(K){return{keys:ov.normalizeKeys(K),selector:F(K),command:K.command,args:K.args||cc.JSONExt.emptyObject}}t.createKeyBinding=r;function i(K,ne,ge){for(var j=null,me=!1,fe=1/0,$=0,Z=0,we=K.length;Z<we;++Z){var Oe=K[Z],he=z(Oe.keys,ne);if(he!==0){if(he===2){!me&&W(Oe.selector,ge)!==-1&&(me=!0);continue}var Le=W(Oe.selector,ge);if(!(Le===-1||Le>fe)){var ft=jf.calculateSpecificity(Oe.selector);(!j||Le<fe||ft>=$)&&(j=Oe,fe=Le,$=ft)}}}return{exact:j,partial:me}}t.matchKeyBinding=i;function n(K){K.target.dispatchEvent(J(K))}t.replayKeyEvent=n;function o(K){return nl.IS_MAC?s.hasOwnProperty(K)?s[K]:K:l.hasOwnProperty(K)?l[K]:K}t.formatKey=o;var s={Backspace:"\u232B",Tab:"\u21E5",Enter:"\u21A9",Shift:"\u21E7",Ctrl:"\u2303",Alt:"\u2325",Escape:"\u238B",PageUp:"\u21DE",PageDown:"\u21DF",End:"\u2198",Home:"\u2196",ArrowLeft:"\u2190",ArrowUp:"\u2191",ArrowRight:"\u2192",ArrowDown:"\u2193",Delete:"\u2326",Cmd:"\u2318"},l={Escape:"Esc",PageUp:"Page Up",PageDown:"Page Down",ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",Delete:"Del"},u=function(){return""},h=function(){return-1},v=function(){return!0},T=function(){return!1},E=function(){return{}},M=function(){};function O(K,ne){return K===void 0?ne:typeof K=="function"?K:function(){return K}}function F(K){if(K.selector.indexOf(",")!==-1)throw new Error("Selector cannot contain commas: "+K.selector);if(!jf.isValid(K.selector))throw new Error("Invalid selector: "+K.selector);return K.selector}function z(K,ne){if(K.length<ne.length)return 0;for(var ge=0,j=ne.length;ge<j;++ge)if(K[ge]!==ne[ge])return 0;return K.length>ne.length?2:1}function W(K,ne){for(var ge=ne.target,j=ne.currentTarget,me=0;ge!==null;ge=ge.parentElement,++me){if(ge.hasAttribute("data-lm-suppress-shortcuts")||ge.hasAttribute("data-p-suppress-shortcuts"))return-1;if(jf.matches(ge,K))return me;if(ge===j)return-1}return-1}function J(K){var ne=document.createEvent("Event"),ge=K.bubbles||!0,j=K.cancelable||!0;return ne.initEvent(K.type||"keydown",ge,j),ne.key=K.key||"",ne.keyCode=K.keyCode||0,ne.which=K.keyCode||0,ne.ctrlKey=K.ctrlKey||!1,ne.altKey=K.altKey||!1,ne.shiftKey=K.shiftKey||!1,ne.metaKey=K.metaKey||!1,ne.view=K.view||window,ne}})(EA||(EA={}));var ek=function(t,e){return ek=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},ek(t,e)};function WMe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ek(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var qI=function(){function t(e){this.type="text",this.content=e}return t}(),XI=function(){function t(e,r,i,n){this.type="element",this.tag=e,this.attrs=r,this.children=i,this.renderer=n}return t}(),RTt=function(t){WMe(e,t);function e(r,i,n){return t.call(this,r,i,[],n||void 0)||this}return e}(XI);function so(t){for(var e={},r,i=[],n=1,o=arguments.length;n<o;++n){var s=arguments[n];typeof s=="string"?i.push(new qI(s)):s instanceof qI||s instanceof XI?i.push(s):s instanceof Array?l(i,s):(n===1||n===2)&&s&&typeof s=="object"&&("render"in s?r=s:e=s)}return new XI(t,e,i,r);function l(u,h){for(var v=0,T=h;v<T.length;v++){var E=T[v];typeof E=="string"?u.push(new qI(E)):(E instanceof qI||E instanceof XI)&&u.push(E)}}}(function(t){t.a=t.bind(void 0,"a"),t.abbr=t.bind(void 0,"abbr"),t.address=t.bind(void 0,"address"),t.area=t.bind(void 0,"area"),t.article=t.bind(void 0,"article"),t.aside=t.bind(void 0,"aside"),t.audio=t.bind(void 0,"audio"),t.b=t.bind(void 0,"b"),t.bdi=t.bind(void 0,"bdi"),t.bdo=t.bind(void 0,"bdo"),t.blockquote=t.bind(void 0,"blockquote"),t.br=t.bind(void 0,"br"),t.button=t.bind(void 0,"button"),t.canvas=t.bind(void 0,"canvas"),t.caption=t.bind(void 0,"caption"),t.cite=t.bind(void 0,"cite"),t.code=t.bind(void 0,"code"),t.col=t.bind(void 0,"col"),t.colgroup=t.bind(void 0,"colgroup"),t.data=t.bind(void 0,"data"),t.datalist=t.bind(void 0,"datalist"),t.dd=t.bind(void 0,"dd"),t.del=t.bind(void 0,"del"),t.dfn=t.bind(void 0,"dfn"),t.div=t.bind(void 0,"div"),t.dl=t.bind(void 0,"dl"),t.dt=t.bind(void 0,"dt"),t.em=t.bind(void 0,"em"),t.embed=t.bind(void 0,"embed"),t.fieldset=t.bind(void 0,"fieldset"),t.figcaption=t.bind(void 0,"figcaption"),t.figure=t.bind(void 0,"figure"),t.footer=t.bind(void 0,"footer"),t.form=t.bind(void 0,"form"),t.h1=t.bind(void 0,"h1"),t.h2=t.bind(void 0,"h2"),t.h3=t.bind(void 0,"h3"),t.h4=t.bind(void 0,"h4"),t.h5=t.bind(void 0,"h5"),t.h6=t.bind(void 0,"h6"),t.header=t.bind(void 0,"header"),t.hr=t.bind(void 0,"hr"),t.i=t.bind(void 0,"i"),t.iframe=t.bind(void 0,"iframe"),t.img=t.bind(void 0,"img"),t.input=t.bind(void 0,"input"),t.ins=t.bind(void 0,"ins"),t.kbd=t.bind(void 0,"kbd"),t.label=t.bind(void 0,"label"),t.legend=t.bind(void 0,"legend"),t.li=t.bind(void 0,"li"),t.main=t.bind(void 0,"main"),t.map=t.bind(void 0,"map"),t.mark=t.bind(void 0,"mark"),t.meter=t.bind(void 0,"meter"),t.nav=t.bind(void 0,"nav"),t.noscript=t.bind(void 0,"noscript"),t.object=t.bind(void 0,"object"),t.ol=t.bind(void 0,"ol"),t.optgroup=t.bind(void 0,"optgroup"),t.option=t.bind(void 0,"option"),t.output=t.bind(void 0,"output"),t.p=t.bind(void 0,"p"),t.param=t.bind(void 0,"param"),t.pre=t.bind(void 0,"pre"),t.progress=t.bind(void 0,"progress"),t.q=t.bind(void 0,"q"),t.rp=t.bind(void 0,"rp"),t.rt=t.bind(void 0,"rt"),t.ruby=t.bind(void 0,"ruby"),t.s=t.bind(void 0,"s"),t.samp=t.bind(void 0,"samp"),t.section=t.bind(void 0,"section"),t.select=t.bind(void 0,"select"),t.small=t.bind(void 0,"small"),t.source=t.bind(void 0,"source"),t.span=t.bind(void 0,"span"),t.strong=t.bind(void 0,"strong"),t.sub=t.bind(void 0,"sub"),t.summary=t.bind(void 0,"summary"),t.sup=t.bind(void 0,"sup"),t.table=t.bind(void 0,"table"),t.tbody=t.bind(void 0,"tbody"),t.td=t.bind(void 0,"td"),t.textarea=t.bind(void 0,"textarea"),t.tfoot=t.bind(void 0,"tfoot"),t.th=t.bind(void 0,"th"),t.thead=t.bind(void 0,"thead"),t.time=t.bind(void 0,"time"),t.title=t.bind(void 0,"title"),t.tr=t.bind(void 0,"tr"),t.track=t.bind(void 0,"track"),t.u=t.bind(void 0,"u"),t.ul=t.bind(void 0,"ul"),t.var_=t.bind(void 0,"var"),t.video=t.bind(void 0,"video"),t.wbr=t.bind(void 0,"wbr")})(so||(so={}));var tp;(function(t){function e(i){return Gg.createDOMNode(i)}t.realize=e;function r(i,n){var o=Gg.hostMap.get(n)||[],s=Gg.asContentArray(i);Gg.hostMap.set(n,s),Gg.updateContent(n,o,s)}t.render=r})(tp||(tp={}));var Gg;(function(t){t.hostMap=new WeakMap;function e(M){return M?M instanceof Array?M:[M]:[]}t.asContentArray=e;function r(M){var O=arguments[1]||null,F=arguments[2]||null;if(O)O.insertBefore(r(M),F);else{if(M.type==="text")return document.createTextNode(M.content);if(O=document.createElement(M.tag),s(O,M.attrs),M.renderer)return M.renderer.render(O,{attrs:M.attrs,children:M.children}),O;for(var z=0,W=M.children.length;z<W;++z)r(M.children[z],O)}return O}t.createDOMNode=r;function i(M,O,F){if(O!==F){for(var z=E(M,O),W=O.slice(),J=M.firstChild,K=F.length,ne=0;ne<K;++ne){if(ne>=W.length){r(F[ne],M);continue}var ge=W[ne],j=F[ne];if(ge===j){J=J.nextSibling;continue}if(ge.type==="text"&&j.type==="text"){J.textContent!==j.content&&(J.textContent=j.content),J=J.nextSibling;continue}if(ge.type==="text"||j.type==="text"){rr.insert(W,ne,j),r(j,M,J);continue}if(!ge.renderer!=!j.renderer){rr.insert(W,ne,j),r(j,M,J);continue}var me=j.attrs.key;if(me&&me in z){var fe=z[me];fe.vNode!==ge&&(rr.move(W,W.indexOf(fe.vNode,ne+1),ne),M.insertBefore(fe.element,J),ge=fe.vNode,J=fe.element)}if(ge===j){J=J.nextSibling;continue}var $=ge.attrs.key;if($&&$!==me){rr.insert(W,ne,j),r(j,M,J);continue}if(ge.tag!==j.tag){rr.insert(W,ne,j),r(j,M,J);continue}l(J,ge.attrs,j.attrs),j.renderer?j.renderer.render(J,{attrs:j.attrs,children:j.children}):i(J,ge.children,j.children),J=J.nextSibling}n(M,W,K,!0)}}t.updateContent=i;function n(M,O,F,z){for(var W=O.length-1;W>=F;--W){var J=O[W],K=z?M.lastChild:M.childNodes[W];J.type==="text"||(J.renderer&&J.renderer.unrender?J.renderer.unrender(K,{attrs:J.attrs,children:J.children}):n(K,J.children,0,!1)),z&&M.removeChild(K)}}var o={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function s(M,O){for(var F in O)F in o||(F.substr(0,2)==="on"?M[F]=O[F]:M.setAttribute(F,O[F]));O.className!==void 0&&M.setAttribute("class",O.className),O.htmlFor!==void 0&&M.setAttribute("for",O.htmlFor),O.dataset&&u(M,O.dataset),O.style&&v(M,O.style)}function l(M,O,F){if(O!==F){var z;for(z in O)z in o||z in F||(z.substr(0,2)==="on"?M[z]=null:M.removeAttribute(z));for(z in F)z in o||O[z]===F[z]||(z.substr(0,2)==="on"?M[z]=F[z]:M.setAttribute(z,F[z]));O.className!==F.className&&(F.className!==void 0?M.setAttribute("class",F.className):M.removeAttribute("class")),O.htmlFor!==F.htmlFor&&(F.htmlFor!==void 0?M.setAttribute("for",F.htmlFor):M.removeAttribute("for")),O.dataset!==F.dataset&&h(M,O.dataset||{},F.dataset||{}),O.style!==F.style&&T(M,O.style||{},F.style||{})}}function u(M,O){for(var F in O)M.setAttribute("data-"+F,O[F])}function h(M,O,F){for(var z in O)z in F||M.removeAttribute("data-"+z);for(var W in F)O[W]!==F[W]&&M.setAttribute("data-"+W,F[W])}function v(M,O){var F=M.style,z;for(z in O)F[z]=O[z]}function T(M,O,F){var z=M.style,W;for(W in O)W in F||(z[W]="");for(W in F)O[W]!==F[W]&&(z[W]=F[W])}function E(M,O){for(var F=M.firstChild,z=Object.create(null),W=0,J=O;W<J.length;W++){var K=J[W];K.type==="element"&&K.attrs.key&&(z[K.attrs.key]={vNode:K,element:F}),F=F.nextSibling}return z}})(Gg||(Gg={}));var tk=function(t,e){return tk=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},tk(t,e)};function ks(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");tk(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var ol=function(){return ol=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},ol.apply(this,arguments)};function qMe(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function XMe(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var o=arguments[e],s=0,l=o.length;s<l;s++,n++)i[n]=o[s];return i}var SA=function(){function t(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1}return t}(),lu;(function(t){function e(o,s){var l=o.length;if(l===0)return s;for(var u=0,h=0,v=0,T=0,E=0,M=0;M<l;++M){var O=o[M],F=O.minSize,z=O.maxSize,W=O.sizeHint;O.done=!1,O.size=Math.max(F,Math.min(W,z)),v+=O.size,u+=F,h+=z,O.stretch>0&&(T+=O.stretch,E++)}if(s===v)return 0;if(s<=u){for(var M=0;M<l;++M){var O=o[M];O.size=O.minSize}return s-u}if(s>=h){for(var M=0;M<l;++M){var O=o[M];O.size=O.maxSize}return s-h}var J=.01,K=l;if(s<v){for(var ne=v-s;E>0&&ne>J;)for(var ge=ne,j=T,M=0;M<l;++M){var O=o[M];if(!(O.done||O.stretch===0)){var me=O.stretch*ge/j;O.size-me<=O.minSize?(ne-=O.size-O.minSize,T-=O.stretch,O.size=O.minSize,O.done=!0,K--,E--):(ne-=me,O.size-=me)}}for(;K>0&&ne>J;)for(var me=ne/K,M=0;M<l;++M){var O=o[M];O.done||(O.size-me<=O.minSize?(ne-=O.size-O.minSize,O.size=O.minSize,O.done=!0,K--):(ne-=me,O.size-=me))}}else{for(var ne=s-v;E>0&&ne>J;)for(var ge=ne,j=T,M=0;M<l;++M){var O=o[M];if(!(O.done||O.stretch===0)){var me=O.stretch*ge/j;O.size+me>=O.maxSize?(ne-=O.maxSize-O.size,T-=O.stretch,O.size=O.maxSize,O.done=!0,K--,E--):(ne-=me,O.size+=me)}}for(;K>0&&ne>J;)for(var me=ne/K,M=0;M<l;++M){var O=o[M];O.done||(O.size+me>=O.maxSize?(ne-=O.maxSize-O.size,O.size=O.maxSize,O.done=!0,K--):(ne-=me,O.size+=me))}}return 0}t.calc=e;function r(o,s,l){o.length===0||l===0||(l>0?i(o,s,l):n(o,s,-l))}t.adjust=r;function i(o,s,l){for(var u=0,h=0;h<=s;++h){var v=o[h];u+=v.maxSize-v.size}for(var T=0,h=s+1,E=o.length;h<E;++h){var v=o[h];T+=v.size-v.minSize}l=Math.min(l,u,T);for(var M=l,h=s;h>=0&&M>0;--h){var v=o[h],O=v.maxSize-v.size;O>=M?(v.sizeHint=v.size+M,M=0):(v.sizeHint=v.size+O,M-=O)}for(var F=l,h=s+1,E=o.length;h<E&&F>0;++h){var v=o[h],O=v.size-v.minSize;O>=F?(v.sizeHint=v.size-F,F=0):(v.sizeHint=v.size-O,F-=O)}}function n(o,s,l){for(var u=0,h=s+1,v=o.length;h<v;++h){var T=o[h];u+=T.maxSize-T.size}for(var E=0,h=0;h<=s;++h){var T=o[h];E+=T.size-T.minSize}l=Math.min(l,u,E);for(var M=l,h=s+1,v=o.length;h<v&&M>0;++h){var T=o[h],O=T.maxSize-T.size;O>=M?(T.sizeHint=T.size+M,M=0):(T.sizeHint=T.size+O,M-=O)}for(var F=l,h=s;h>=0&&F>0;--h){var T=o[h],O=T.size-T.minSize;O>=F?(T.sizeHint=T.size-F,F=0):(T.sizeHint=T.size-O,F-=O)}}})(lu||(lu={}));var rk=function(){function t(e){this._label="",this._caption="",this._mnemonic=-1,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new Wn(this),this._isDisposed=!1,this.owner=e.owner,e.label!==void 0&&(this._label=e.label),e.mnemonic!==void 0&&(this._mnemonic=e.mnemonic),e.icon!==void 0?typeof e.icon=="string"?(this._icon=null,this._iconClass=e.icon):this._icon=e.icon:this._icon=null,e.iconClass!==void 0&&(this._iconClass=e.iconClass),e.iconLabel!==void 0&&(this._iconLabel=e.iconLabel),e.iconRenderer!==void 0&&(this._icon=e.iconRenderer),e.caption!==void 0&&(this._caption=e.caption),e.className!==void 0&&(this._className=e.className),e.closable!==void 0&&(this._closable=e.closable),this._dataset=e.dataset||{}}return Object.defineProperty(t.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"label",{get:function(){return this._label},set:function(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mnemonic",{get:function(){return this._mnemonic},set:function(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"icon",{get:function(){return this._icon===null?this.iconClass:this._icon},set:function(e){if(typeof e=="string")this._icon=null,this.iconClass=e;else{if(this._icon===e)return;this._icon=e,this._changed.emit(void 0)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconClass",{get:function(){return this._iconClass},set:function(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconLabel",{get:function(){return this._iconLabel},set:function(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconRenderer",{get:function(){return this._icon||void 0},set:function(e){this.icon=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"caption",{get:function(){return this._caption},set:function(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return this._className},set:function(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"closable",{get:function(){return this._closable},set:function(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataset",{get:function(){return this._dataset},set:function(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(this._isDisposed=!0,Wn.clearData(this))},t}(),Br=function(){function t(e){e===void 0&&(e={}),this._flags=0,this._layout=null,this._parent=null,this._disposed=new Wn(this),this._hiddenMode=t.HiddenMode.Display,this.node=YI.createNode(e),this.addClass("lm-Widget"),this.addClass("p-Widget")}return t.prototype.dispose=function(){this.isDisposed||(this.setFlag(t.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&t.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),Wn.clearData(this),xr.clearData(this),lc.clearData(this))},Object.defineProperty(t.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this.testFlag(t.Flag.IsDisposed)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isAttached",{get:function(){return this.testFlag(t.Flag.IsAttached)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this.testFlag(t.Flag.IsHidden)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this.testFlag(t.Flag.IsVisible)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return YI.titleProperty.get(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this.node.id},set:function(e){this.node.id=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataset",{get:function(){return this.node.dataset},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hiddenMode",{get:function(){return this._hiddenMode},set:function(e){this._hiddenMode!==e&&(this.isHidden&&this._toggleHidden(!1),e==t.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=e,this.isHidden&&this._toggleHidden(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){var r=new t.ChildMessage("child-removed",this);xr.sendMessage(this._parent,r)}if(this._parent=e,this._parent&&!this._parent.isDisposed){var r=new t.ChildMessage("child-added",this);xr.sendMessage(this._parent,r)}this.isDisposed||xr.sendMessage(this,t.Msg.ParentChanged)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){return this._layout},set:function(e){if(this._layout!==e){if(this.testFlag(t.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}},enumerable:!0,configurable:!0}),t.prototype.children=function(){return this._layout?this._layout.iter():su()},t.prototype.contains=function(e){for(var r=e;r;r=r._parent)if(r===this)return!0;return!1},t.prototype.hasClass=function(e){return this.node.classList.contains(e)},t.prototype.addClass=function(e){this.node.classList.add(e)},t.prototype.removeClass=function(e){this.node.classList.remove(e)},t.prototype.toggleClass=function(e,r){return r===!0?(this.node.classList.add(e),!0):r===!1?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)},t.prototype.update=function(){xr.postMessage(this,t.Msg.UpdateRequest)},t.prototype.fit=function(){xr.postMessage(this,t.Msg.FitRequest)},t.prototype.activate=function(){xr.postMessage(this,t.Msg.ActivateRequest)},t.prototype.close=function(){xr.sendMessage(this,t.Msg.CloseRequest)},t.prototype.show=function(){if(this.testFlag(t.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&xr.sendMessage(this,t.Msg.BeforeShow),this.clearFlag(t.Flag.IsHidden),this.node.removeAttribute("aria-hidden"),this._toggleHidden(!1),this.isAttached&&(!this.parent||this.parent.isVisible)&&xr.sendMessage(this,t.Msg.AfterShow),this.parent)){var e=new t.ChildMessage("child-shown",this);xr.sendMessage(this.parent,e)}},t.prototype.hide=function(){if(!this.testFlag(t.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&xr.sendMessage(this,t.Msg.BeforeHide),this.setFlag(t.Flag.IsHidden),this.node.setAttribute("aria-hidden","true"),this._toggleHidden(!0),this.isAttached&&(!this.parent||this.parent.isVisible)&&xr.sendMessage(this,t.Msg.AfterHide),this.parent)){var e=new t.ChildMessage("child-hidden",this);xr.sendMessage(this.parent,e)}},t.prototype.setHidden=function(e){e?this.hide():this.show()},t.prototype.testFlag=function(e){return(this._flags&e)!==0},t.prototype.setFlag=function(e){this._flags|=e},t.prototype.clearFlag=function(e){this._flags&=~e},t.prototype.processMessage=function(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(t.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(t.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":!this.isHidden&&(!this.parent||this.parent.isVisible)&&this.setFlag(t.Flag.IsVisible),this.setFlag(t.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(t.Flag.IsVisible),this.clearFlag(t.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e);break}},t.prototype.notifyLayout=function(e){this._layout&&this._layout.processParentMessage(e)},t.prototype.onCloseRequest=function(e){this.parent?this.parent=null:this.isAttached&&t.detach(this)},t.prototype.onResize=function(e){},t.prototype.onUpdateRequest=function(e){},t.prototype.onFitRequest=function(e){},t.prototype.onActivateRequest=function(e){},t.prototype.onBeforeShow=function(e){},t.prototype.onAfterShow=function(e){},t.prototype.onBeforeHide=function(e){},t.prototype.onAfterHide=function(e){},t.prototype.onBeforeAttach=function(e){},t.prototype.onAfterAttach=function(e){},t.prototype.onBeforeDetach=function(e){},t.prototype.onAfterDetach=function(e){},t.prototype.onChildAdded=function(e){},t.prototype.onChildRemoved=function(e){},t.prototype._toggleHidden=function(e){if(e)switch(this._hiddenMode){case t.HiddenMode.Display:this.addClass("lm-mod-hidden"),this.addClass("p-mod-hidden");break;case t.HiddenMode.Scale:this.node.style.transform="scale(0)";break;case t.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1";break}else switch(this._hiddenMode){case t.HiddenMode.Display:this.removeClass("lm-mod-hidden"),this.removeClass("p-mod-hidden");break;case t.HiddenMode.Scale:this.node.style.transform="";break;case t.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex="";break}},t}();(function(t){(function(o){o[o.Display=0]="Display",o[o.Scale=1]="Scale",o[o.ContentVisibility=2]="ContentVisibility"})(t.HiddenMode||(t.HiddenMode={})),function(o){o[o.IsDisposed=1]="IsDisposed",o[o.IsAttached=2]="IsAttached",o[o.IsHidden=4]="IsHidden",o[o.IsVisible=8]="IsVisible",o[o.DisallowLayout=16]="DisallowLayout"}(t.Flag||(t.Flag={})),function(o){o.BeforeShow=new au("before-show"),o.AfterShow=new au("after-show"),o.BeforeHide=new au("before-hide"),o.AfterHide=new au("after-hide"),o.BeforeAttach=new au("before-attach"),o.AfterAttach=new au("after-attach"),o.BeforeDetach=new au("before-detach"),o.AfterDetach=new au("after-detach"),o.ParentChanged=new au("parent-changed"),o.UpdateRequest=new iv("update-request"),o.FitRequest=new iv("fit-request"),o.ActivateRequest=new iv("activate-request"),o.CloseRequest=new iv("close-request")}(t.Msg||(t.Msg={}));var e=function(o){ks(s,o);function s(l,u){var h=o.call(this,l)||this;return h.child=u,h}return s}(au);t.ChildMessage=e;var r=function(o){ks(s,o);function s(l,u){var h=o.call(this,"resize")||this;return h.width=l,h.height=u,h}return s}(au);t.ResizeMessage=r,function(o){o.UnknownSize=new o(-1,-1)}(r=t.ResizeMessage||(t.ResizeMessage={}));function i(o,s,l){if(l===void 0&&(l=null),o.parent)throw new Error("Cannot attach a child widget.");if(o.isAttached||o.node.isConnected)throw new Error("Widget is already attached.");if(!s.isConnected)throw new Error("Host is not attached.");xr.sendMessage(o,t.Msg.BeforeAttach),s.insertBefore(o.node,l),xr.sendMessage(o,t.Msg.AfterAttach)}t.attach=i;function n(o){if(o.parent)throw new Error("Cannot detach a child widget.");if(!o.isAttached||!o.node.isConnected)throw new Error("Widget is not attached.");xr.sendMessage(o,t.Msg.BeforeDetach),o.node.parentNode.removeChild(o.node),xr.sendMessage(o,t.Msg.AfterDetach)}t.detach=n})(Br||(Br={}));var YI;(function(t){t.titleProperty=new lc({name:"title",create:function(r){return new rk({owner:r})}});function e(r){return r.node||document.createElement(r.tag||"div")}t.createNode=e})(YI||(YI={}));var CA=function(){function t(e){e===void 0&&(e={}),this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}return t.prototype.dispose=function(){this._parent=null,this._disposed=!0,Wn.clearData(this),lc.clearData(this)},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fitPolicy",{get:function(){return this._fitPolicy},set:function(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){var r=this._parent.node.style;r.minWidth="",r.minHeight="",r.maxWidth="",r.maxHeight="",this._parent.fit()}},enumerable:!0,configurable:!0}),t.prototype.processParentMessage=function(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e);break}},t.prototype.init=function(){var e=this;Ei(this,function(r){r.parent=e.parent})},t.prototype.onResize=function(e){Ei(this,function(r){xr.sendMessage(r,Br.ResizeMessage.UnknownSize)})},t.prototype.onUpdateRequest=function(e){Ei(this,function(r){xr.sendMessage(r,Br.ResizeMessage.UnknownSize)})},t.prototype.onBeforeAttach=function(e){Ei(this,function(r){xr.sendMessage(r,e)})},t.prototype.onAfterAttach=function(e){Ei(this,function(r){xr.sendMessage(r,e)})},t.prototype.onBeforeDetach=function(e){Ei(this,function(r){xr.sendMessage(r,e)})},t.prototype.onAfterDetach=function(e){Ei(this,function(r){xr.sendMessage(r,e)})},t.prototype.onBeforeShow=function(e){Ei(this,function(r){r.isHidden||xr.sendMessage(r,e)})},t.prototype.onAfterShow=function(e){Ei(this,function(r){r.isHidden||xr.sendMessage(r,e)})},t.prototype.onBeforeHide=function(e){Ei(this,function(r){r.isHidden||xr.sendMessage(r,e)})},t.prototype.onAfterHide=function(e){Ei(this,function(r){r.isHidden||xr.sendMessage(r,e)})},t.prototype.onChildRemoved=function(e){this.removeWidget(e.child)},t.prototype.onFitRequest=function(e){},t.prototype.onChildShown=function(e){},t.prototype.onChildHidden=function(e){},t}();(function(t){function e(o){return sv.horizontalAlignmentProperty.get(o)}t.getHorizontalAlignment=e;function r(o,s){sv.horizontalAlignmentProperty.set(o,s)}t.setHorizontalAlignment=r;function i(o){return sv.verticalAlignmentProperty.get(o)}t.getVerticalAlignment=i;function n(o,s){sv.verticalAlignmentProperty.set(o,s)}t.setVerticalAlignment=n})(CA||(CA={}));var jw=function(){function t(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute"}return t.prototype.dispose=function(){if(!this._disposed){this._disposed=!0;var e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height=""}},Object.defineProperty(t.prototype,"minWidth",{get:function(){return this._minWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minHeight",{get:function(){return this._minHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxWidth",{get:function(){return this._maxWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxHeight",{get:function(){return this._maxHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this.widget.isHidden},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this.widget.isVisible},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isAttached",{get:function(){return this.widget.isAttached},enumerable:!0,configurable:!0}),t.prototype.fit=function(){var e=ho.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight},t.prototype.update=function(e,r,i,n){var o=Math.max(this._minWidth,Math.min(i,this._maxWidth)),s=Math.max(this._minHeight,Math.min(n,this._maxHeight));if(o<i)switch(CA.getHorizontalAlignment(this.widget)){case"left":break;case"center":e+=(i-o)/2;break;case"right":e+=i-o;break;default:throw"unreachable"}if(s<n)switch(CA.getVerticalAlignment(this.widget)){case"top":break;case"center":r+=(n-s)/2;break;case"bottom":r+=n-s;break;default:throw"unreachable"}var l=!1,u=this.widget.node.style;if(this._top!==r&&(this._top=r,u.top=r+"px"),this._left!==e&&(this._left=e,u.left=e+"px"),this._width!==o&&(l=!0,this._width=o,u.width=o+"px"),this._height!==s&&(l=!0,this._height=s,u.height=s+"px"),l){var h=new Br.ResizeMessage(o,s);xr.sendMessage(this.widget,h)}},t}(),sv;(function(t){t.horizontalAlignmentProperty=new lc({name:"horizontalAlignment",create:function(){return"center"},changed:e}),t.verticalAlignmentProperty=new lc({name:"verticalAlignment",create:function(){return"top"},changed:e});function e(r){r.parent&&r.parent.layout&&r.parent.update()}})(sv||(sv={}));var $I=function(t){ks(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._widgets=[],r}return e.prototype.dispose=function(){for(;this._widgets.length>0;)this._widgets.pop().dispose();t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"widgets",{get:function(){return this._widgets},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return ou(this._widgets)},e.prototype.addWidget=function(r){this.insertWidget(this._widgets.length,r)},e.prototype.insertWidget=function(r,i){i.parent=this.parent;var n=this._widgets.indexOf(i),o=Math.max(0,Math.min(r,this._widgets.length));if(n===-1){rr.insert(this._widgets,o,i),this.parent&&this.attachWidget(o,i);return}o===this._widgets.length&&o--,n!==o&&(rr.move(this._widgets,n,o),this.parent&&this.moveWidget(n,o,i))},e.prototype.removeWidget=function(r){this.removeWidgetAt(this._widgets.indexOf(r))},e.prototype.removeWidgetAt=function(r){var i=rr.removeAt(this._widgets,r);i&&this.parent&&this.detachWidget(r,i)},e.prototype.init=function(){var r=this;t.prototype.init.call(this),Ei(this,function(i,n){r.attachWidget(n,i)})},e.prototype.attachWidget=function(r,i){var n=this.parent.node.children[r];this.parent.isAttached&&xr.sendMessage(i,Br.Msg.BeforeAttach),this.parent.node.insertBefore(i.node,n),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.AfterAttach)},e.prototype.moveWidget=function(r,i,n){this.parent.isAttached&&xr.sendMessage(n,Br.Msg.BeforeDetach),this.parent.node.removeChild(n.node),this.parent.isAttached&&xr.sendMessage(n,Br.Msg.AfterDetach);var o=this.parent.node.children[i];this.parent.isAttached&&xr.sendMessage(n,Br.Msg.BeforeAttach),this.parent.node.insertBefore(n.node,o),this.parent.isAttached&&xr.sendMessage(n,Br.Msg.AfterAttach)},e.prototype.detachWidget=function(r,i){this.parent.isAttached&&xr.sendMessage(i,Br.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.AfterDetach)},e}(CA),zw;(function(t){function e(r){return Math.max(0,Math.floor(r))}t.clampDimension=e})(zw||(zw={}));var Vw=zw,Xg=function(t){ks(e,t);function e(r){var i=t.call(this)||this;return i.widgetOffset=0,i._fixed=0,i._spacing=4,i._dirty=!1,i._hasNormedSizes=!1,i._sizers=[],i._items=[],i._handles=[],i._box=null,i._alignment="start",i._orientation="horizontal",i.renderer=r.renderer,r.orientation!==void 0&&(i._orientation=r.orientation),r.alignment!==void 0&&(i._alignment=r.alignment),r.spacing!==void 0&&(i._spacing=zw.clampDimension(r.spacing)),i}return e.prototype.dispose=function(){Ei(this._items,function(r){r.dispose()}),this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(r){this._orientation!==r&&(this._orientation=r,this.parent&&(this.parent.dataset.orientation=r,this.parent.fit()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this._alignment},set:function(r){this._alignment!==r&&(this._alignment=r,this.parent&&(this.parent.dataset.alignment=r,this.parent.update()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this._spacing},set:function(r){r=zw.clampDimension(r),this._spacing!==r&&(this._spacing=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"handles",{get:function(){return this._handles},enumerable:!0,configurable:!0}),e.prototype.absoluteSizes=function(){return this._sizers.map(function(r){return r.size})},e.prototype.relativeSizes=function(){return ip.normalize(this._sizers.map(function(r){return r.size}))},e.prototype.setRelativeSizes=function(r,i){i===void 0&&(i=!0);for(var n=this._sizers.length,o=r.slice(0,n);o.length<n;)o.push(0);for(var s=ip.normalize(o),l=0;l<n;++l){var u=this._sizers[l];u.sizeHint=s[l],u.size=s[l]}this._hasNormedSizes=!0,i&&this.parent&&this.parent.update()},e.prototype.moveHandle=function(r,i){var n=this._handles[r];if(!(!n||n.classList.contains("lm-mod-hidden"))){var o;if(this._orientation==="horizontal"?o=i-n.offsetLeft:o=i-n.offsetTop,o!==0){for(var s=0,l=this._sizers;s<l.length;s++){var u=l[s];u.size>0&&(u.sizeHint=u.size)}lu.adjust(this._sizers,r,o),this.parent&&this.parent.update()}}},e.prototype.init=function(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,t.prototype.init.call(this)},e.prototype.attachWidget=function(r,i){var n=new jw(i),o=ip.createHandle(this.renderer),s=ip.averageSize(this._sizers),l=ip.createSizer(s);rr.insert(this._items,r,n),rr.insert(this._sizers,r,l),rr.insert(this._handles,r,o),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.node.appendChild(o),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.AfterAttach),this.parent.fit()},e.prototype.moveWidget=function(r,i,n){rr.move(this._items,r,i),rr.move(this._sizers,r,i),rr.move(this._handles,r,i),this.parent.fit()},e.prototype.detachWidget=function(r,i){var n=rr.removeAt(this._items,r),o=rr.removeAt(this._handles,r);rr.removeAt(this._sizers,r),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.node.removeChild(o),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.AfterDetach),n.dispose(),this.parent.fit()},e.prototype.onBeforeShow=function(r){t.prototype.onBeforeShow.call(this,r),this.parent.update()},e.prototype.onBeforeAttach=function(r){t.prototype.onBeforeAttach.call(this,r),this.parent.fit()},e.prototype.onChildShown=function(r){this.parent.fit()},e.prototype.onChildHidden=function(r){this.parent.fit()},e.prototype.onResize=function(r){this.parent.isVisible&&this._update(r.width,r.height)},e.prototype.onUpdateRequest=function(r){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(r){this.parent.isAttached&&this._fit()},e.prototype.updateItemPosition=function(r,i,n,o,s,l,u){var h=this._items[r];if(!h.isHidden){var v=this._handles[r].style;i?(n+=this.widgetOffset,h.update(n,o,u,s),n+=u,v.top=o+"px",v.left=n+"px",v.width=this._spacing+"px",v.height=s+"px"):(o+=this.widgetOffset,h.update(n,o,l,u),o+=u,v.top=o+"px",v.left=n+"px",v.width=l+"px",v.height=this._spacing+"px")}},e.prototype._fit=function(){for(var r=0,i=-1,n=0,o=this._items.length;n<o;++n)this._items[n].isHidden?(this._handles[n].classList.add("lm-mod-hidden"),this._handles[n].classList.add("p-mod-hidden")):(this._handles[n].classList.remove("lm-mod-hidden"),this._handles[n].classList.remove("p-mod-hidden"),i=n,r++);i!==-1&&(this._handles[i].classList.add("lm-mod-hidden"),this._handles[i].classList.add("p-mod-hidden")),this._fixed=this._spacing*Math.max(0,r-1)+this.widgetOffset*this._items.length;for(var s=this._orientation==="horizontal",l=s?this._fixed:0,u=s?0:this._fixed,n=0,o=this._items.length;n<o;++n){var h=this._items[n],v=this._sizers[n];if(v.size>0&&(v.sizeHint=v.size),h.isHidden){v.minSize=0,v.maxSize=0;continue}h.fit(),v.stretch=e.getStretch(h.widget),s?(v.minSize=h.minWidth,v.maxSize=h.maxWidth,l+=h.minWidth,u=Math.max(u,h.minHeight)):(v.minSize=h.minHeight,v.maxSize=h.maxHeight,u+=h.minHeight,l=Math.max(l,h.minWidth))}var T=this._box=ho.boxSizing(this.parent.node);l+=T.horizontalSum,u+=T.verticalSum;var E=this.parent.node.style;E.minWidth=l+"px",E.minHeight=u+"px",this._dirty=!0,this.parent.parent&&xr.sendMessage(this.parent.parent,Br.Msg.FitRequest),this._dirty&&xr.sendMessage(this.parent,Br.Msg.UpdateRequest)},e.prototype._update=function(r,i){this._dirty=!1;for(var n=0,o=0,s=this._items.length;o<s;++o)n+=+!this._items[o].isHidden;if(!(n===0&&this.widgetOffset===0)){r<0&&(r=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=ho.boxSizing(this.parent.node));var l=this._box.paddingTop,u=this._box.paddingLeft,h=r-this._box.horizontalSum,v=i-this._box.verticalSum,T=0,E=0,M=this._orientation==="horizontal";if(n>0){var O=void 0;if(M?O=Math.max(0,h-this._fixed):O=Math.max(0,v-this._fixed),this._hasNormedSizes){for(var F=0,z=this._sizers;F<z.length;F++){var W=z[F];W.sizeHint*=O}this._hasNormedSizes=!1}var J=lu.calc(this._sizers,O);if(J>0)switch(this._alignment){case"start":break;case"center":T=0,E=J/2;break;case"end":T=0,E=J;break;case"justify":T=J/n,E=0;break;default:throw"unreachable"}}for(var o=0,s=this._items.length;o<s;++o){var K=this._items[o],ne=K.isHidden?0:this._sizers[o].size+T;this.updateItemPosition(o,M,M?u+E:u,M?l:l+E,v,h,ne);var ge=this.widgetOffset+(this._handles[o].classList.contains("lm-mod-hidden")?0:this._spacing);M?u+=ne+ge:l+=ne+ge}}},e}($I);(function(t){function e(i){return ip.stretchProperty.get(i)}t.getStretch=e;function r(i,n){ip.stretchProperty.set(i,n)}t.setStretch=r})(Xg||(Xg={}));var ip;(function(t){t.stretchProperty=new lc({name:"stretch",create:function(){return 0},coerce:function(s,l){return Math.max(0,Math.floor(l))},changed:o});function e(s){var l=new SA;return l.sizeHint=Math.floor(s),l}t.createSizer=e;function r(s){var l=s.createHandle();return l.style.position="absolute",l}t.createHandle=r;function i(s){return s.reduce(function(l,u){return l+u.size},0)/s.length||0}t.averageSize=i;function n(s){var l=s.length;if(l===0)return[];var u=s.reduce(function(h,v){return h+Math.abs(v)},0);return u===0?s.map(function(h){return 1/l}):s.map(function(h){return h/u})}t.normalize=n;function o(s){s.parent&&s.parent.layout instanceof Xg&&s.parent.fit()}})(ip||(ip={}));var YMe=function(t){ks(e,t);function e(r){var i=t.call(this,ol(ol({},r),{orientation:r.orientation||"vertical"}))||this;return i._titles=[],i.titleSpace=r.titleSpace||22,i}return Object.defineProperty(e.prototype,"titleSpace",{get:function(){return this.widgetOffset},set:function(r){r=Vw.clampDimension(r),this.widgetOffset!==r&&(this.widgetOffset=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"titles",{get:function(){return this._titles},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(this._titles.length=0,t.prototype.dispose.call(this))},e.prototype.updateTitle=function(r,i){var n=this._titles[r],o=n.classList.contains("lm-mod-expanded"),s=KI.createTitle(this.renderer,i.title,o);this._titles[r]=s,this.parent.node.replaceChild(s,n)},e.prototype.attachWidget=function(r,i){var n=KI.createTitle(this.renderer,i.title);rr.insert(this._titles,r,n),this.parent.node.appendChild(n),i.node.setAttribute("role","region"),i.node.setAttribute("aria-labelledby",n.id),t.prototype.attachWidget.call(this,r,i)},e.prototype.moveWidget=function(r,i,n){rr.move(this._titles,r,i),t.prototype.moveWidget.call(this,r,i,n)},e.prototype.detachWidget=function(r,i){var n=rr.removeAt(this._titles,r);this.parent.node.removeChild(n),t.prototype.detachWidget.call(this,r,i)},e.prototype.updateItemPosition=function(r,i,n,o,s,l,u){var h=this._titles[r].style;h.top=o+"px",h.left=n+"px",h.height=this.widgetOffset+"px",i?h.width=s+"px":h.width=l+"px",t.prototype.updateItemPosition.call(this,r,i,n,o,s,l,u)},e}(Xg),KI;(function(t){function e(r,i,n){n===void 0&&(n=!0);var o=r.createSectionTitle(i);return o.style.position="absolute",o.setAttribute("aria-label",i.label+" Section"),o.setAttribute("aria-expanded",n?"true":"false"),o.setAttribute("aria-controls",i.owner.id),n&&o.classList.add("lm-mod-expanded"),o}t.createTitle=e})(KI||(KI={}));var Gw=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this)||this;return i.addClass("lm-Panel"),i.addClass("p-Panel"),i.layout=ik.createLayout(r),i}return Object.defineProperty(e.prototype,"widgets",{get:function(){return this.layout.widgets},enumerable:!0,configurable:!0}),e.prototype.addWidget=function(r){this.layout.addWidget(r)},e.prototype.insertWidget=function(r,i){this.layout.insertWidget(r,i)},e}(Br),ik;(function(t){function e(r){return r.layout||new $I}t.createLayout=e})(ik||(ik={}));var Hw=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{layout:nk.createLayout(r)})||this;return i._handleMoved=new Wn(i),i._pressData=null,i.addClass("lm-SplitPanel"),i.addClass("p-SplitPanel"),i}return e.prototype.dispose=function(){this._releaseMouse(),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"orientation",{get:function(){return this.layout.orientation},set:function(r){this.layout.orientation=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this.layout.alignment},set:function(r){this.layout.alignment=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this.layout.spacing},set:function(r){this.layout.spacing=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderer",{get:function(){return this.layout.renderer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"handleMoved",{get:function(){return this._handleMoved},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"handles",{get:function(){return this.layout.handles},enumerable:!0,configurable:!0}),e.prototype.relativeSizes=function(){return this.layout.relativeSizes()},e.prototype.setRelativeSizes=function(r,i){i===void 0&&(i=!0),this.layout.setRelativeSizes(r,i)},e.prototype.handleEvent=function(r){switch(r.type){case"mousedown":this._evtMouseDown(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseup":this._evtMouseUp(r);break;case"pointerdown":this._evtMouseDown(r);break;case"pointermove":this._evtMouseMove(r);break;case"pointerup":this._evtMouseUp(r);break;case"keydown":this._evtKeyDown(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("mousedown",this),this.node.addEventListener("pointerdown",this)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("mousedown",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()},e.prototype.onChildAdded=function(r){r.child.addClass("lm-SplitPanel-child"),r.child.addClass("p-SplitPanel-child"),this._releaseMouse()},e.prototype.onChildRemoved=function(r){r.child.removeClass("lm-SplitPanel-child"),r.child.removeClass("p-SplitPanel-child"),this._releaseMouse()},e.prototype._evtKeyDown=function(r){this._pressData&&(r.preventDefault(),r.stopPropagation()),r.keyCode===27&&this._releaseMouse()},e.prototype._evtMouseDown=function(r){if(r.button===0){var i=this.layout,n=rr.findFirstIndex(i.handles,function(v){return v.contains(r.target)});if(n!==-1){r.preventDefault(),r.stopPropagation(),document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);var o,s=i.handles[n],l=s.getBoundingClientRect();i.orientation==="horizontal"?o=r.clientX-l.left:o=r.clientY-l.top;var u=window.getComputedStyle(s),h=TA.overrideCursor(u.cursor);this._pressData={index:n,delta:o,override:h}}}},e.prototype._evtMouseMove=function(r){r.preventDefault(),r.stopPropagation();var i,n=this.layout,o=this.node.getBoundingClientRect();n.orientation==="horizontal"?i=r.clientX-o.left-this._pressData.delta:i=r.clientY-o.top-this._pressData.delta,n.moveHandle(this._pressData.index,i)},e.prototype._evtMouseUp=function(r){r.button===0&&(r.preventDefault(),r.stopPropagation(),this._releaseMouse())},e.prototype._releaseMouse=function(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("mouseup",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))},e}(Gw);(function(t){var e=function(){function n(){}return n.prototype.createHandle=function(){var o=document.createElement("div");return o.className="lm-SplitPanel-handle",o.classList.add("p-SplitPanel-handle"),o},n}();t.Renderer=e,t.defaultRenderer=new e;function r(n){return Xg.getStretch(n)}t.getStretch=r;function i(n,o){Xg.setStretch(n,o)}t.setStretch=i})(Hw||(Hw={}));var nk;(function(t){function e(r){return r.layout||new Xg({renderer:r.renderer||Hw.defaultRenderer,orientation:r.orientation,alignment:r.alignment,spacing:r.spacing})}t.createLayout=e})(nk||(nk={}));var ok=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,ol(ol({},r),{layout:sk.createLayout(r)}))||this;return i._widgetSizesCache=new WeakMap,i.addClass("lm-AccordionPanel"),i}return Object.defineProperty(e.prototype,"renderer",{get:function(){return this.layout.renderer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"titleSpace",{get:function(){return this.layout.titleSpace},set:function(r){this.layout.titleSpace=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"titles",{get:function(){return this.layout.titles},enumerable:!0,configurable:!0}),e.prototype.addWidget=function(r){t.prototype.addWidget.call(this,r),r.title.changed.connect(this._onTitleChanged,this)},e.prototype.collapse=function(r){var i=this.layout.widgets[r];i&&!i.isHidden&&this._toggleExpansion(r)},e.prototype.expand=function(r){var i=this.layout.widgets[r];i&&i.isHidden&&this._toggleExpansion(r)},e.prototype.insertWidget=function(r,i){t.prototype.insertWidget.call(this,r,i),i.title.changed.connect(this._onTitleChanged,this)},e.prototype.handleEvent=function(r){switch(t.prototype.handleEvent.call(this,r),r.type){case"click":this._evtClick(r);break;case"keydown":this._eventKeyDown(r);break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),t.prototype.onBeforeAttach.call(this,r)},e.prototype.onAfterDetach=function(r){t.prototype.onAfterDetach.call(this,r),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)},e.prototype._onTitleChanged=function(r){var i=rr.findFirstIndex(this.widgets,function(n){return n.contains(r.owner)});i>=0&&(this.layout.updateTitle(i,r.owner),this.update())},e.prototype._computeWidgetSize=function(r){var i=this.layout,n=i.widgets[r];if(n){var o=n.isHidden,s=i.absoluteSizes(),l=(o?-1:1)*this.spacing,u=s.reduce(function(M,O){return M+O}),h=XMe(s);if(o){var E=this._widgetSizesCache.get(n);if(!E)return;h[r]+=E;var T=h.map(function(O){return O-E>0}).lastIndexOf(!0);T===-1?h.forEach(function(O,F){F!==r&&(h[F]-=s[F]/u*(E-l))}):h[T]-=E-l}else{var v=s[r];this._widgetSizesCache.set(n,v),h[r]=0;var T=h.map(function(M){return M>0}).lastIndexOf(!0);if(T===-1)return;h[T]=s[T]+v+l}return h.map(function(M){return M/(u+l)})}},e.prototype._evtClick=function(r){var i=r.target;if(i){var n=rr.findFirstIndex(this.titles,function(o){return o.contains(i)});n>=0&&(r.preventDefault(),r.stopPropagation(),this._toggleExpansion(n))}},e.prototype._eventKeyDown=function(r){if(!r.defaultPrevented){var i=r.target,n=!1;if(i){var o=rr.findFirstIndex(this.titles,function(v){return v.contains(i)});if(o>=0){var s=r.keyCode.toString();if(r.key.match(/Space|Enter/)||s.match(/13|32/))i.click(),n=!0;else if(this.orientation==="horizontal"?r.key.match(/ArrowLeft|ArrowRight/)||s.match(/37|39/):r.key.match(/ArrowUp|ArrowDown/)||s.match(/38|40/)){var l=r.key.match(/ArrowLeft|ArrowUp/)||s.match(/37|38/)?-1:1,u=this.titles.length,h=(o+u+l)%u;this.titles[h].focus(),n=!0}else r.key==="End"||s==="35"?(this.titles[this.titles.length-1].focus(),n=!0):(r.key==="Home"||s==="36")&&(this.titles[0].focus(),n=!0)}n&&r.preventDefault()}}},e.prototype._toggleExpansion=function(r){var i=this.titles[r],n=this.layout.widgets[r],o=this._computeWidgetSize(r);o&&this.setRelativeSizes(o,!1),n.isHidden?(i.classList.add("lm-mod-expanded"),i.setAttribute("aria-expanded","true"),n.show()):(i.classList.remove("lm-mod-expanded"),i.setAttribute("aria-expanded","false"),n.hide())},e}(Hw);(function(t){var e=function(r){ks(i,r);function i(){var n=r.call(this)||this;return n.titleClassName="lm-AccordionPanel-title",n._titleID=0,n._titleKeys=new WeakMap,n._uuid=++i._nInstance,n}return i.prototype.createCollapseIcon=function(n){return document.createElement("span")},i.prototype.createSectionTitle=function(n){var o=document.createElement("h3");o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.id=this.createTitleKey(n),o.className=this.titleClassName;for(var s in n.dataset)o.dataset[s]=n.dataset[s];var l=o.appendChild(this.createCollapseIcon(n));l.className="lm-AccordionPanel-titleCollapser";var u=o.appendChild(document.createElement("span"));return u.className="lm-AccordionPanel-titleLabel",u.textContent=n.label,u.title=n.caption||n.label,o},i.prototype.createTitleKey=function(n){var o=this._titleKeys.get(n);return o===void 0&&(o="title-key-"+this._uuid+"-"+this._titleID++,this._titleKeys.set(n,o)),o},i._nInstance=0,i}(Hw.Renderer);t.Renderer=e,t.defaultRenderer=new e})(ok||(ok={}));var sk;(function(t){function e(r){return r.layout||new YMe({renderer:r.renderer||ok.defaultRenderer,orientation:r.orientation,alignment:r.alignment,spacing:r.spacing,titleSpace:r.titleSpace})}t.createLayout=e})(sk||(sk={}));var Gf=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this)||this;return i._fixed=0,i._spacing=4,i._dirty=!1,i._sizers=[],i._items=[],i._box=null,i._alignment="start",i._direction="top-to-bottom",r.direction!==void 0&&(i._direction=r.direction),r.alignment!==void 0&&(i._alignment=r.alignment),r.spacing!==void 0&&(i._spacing=Vw.clampDimension(r.spacing)),i}return e.prototype.dispose=function(){Ei(this._items,function(r){r.dispose()}),this._box=null,this._items.length=0,this._sizers.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"direction",{get:function(){return this._direction},set:function(r){this._direction!==r&&(this._direction=r,this.parent&&(this.parent.dataset.direction=r,this.parent.fit()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this._alignment},set:function(r){this._alignment!==r&&(this._alignment=r,this.parent&&(this.parent.dataset.alignment=r,this.parent.update()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this._spacing},set:function(r){r=Vw.clampDimension(r),this._spacing!==r&&(this._spacing=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),e.prototype.init=function(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,t.prototype.init.call(this)},e.prototype.attachWidget=function(r,i){rr.insert(this._items,r,new jw(i)),rr.insert(this._sizers,r,new SA),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.AfterAttach),this.parent.fit()},e.prototype.moveWidget=function(r,i,n){rr.move(this._items,r,i),rr.move(this._sizers,r,i),this.parent.update()},e.prototype.detachWidget=function(r,i){var n=rr.removeAt(this._items,r);rr.removeAt(this._sizers,r),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.AfterDetach),n.dispose(),this.parent.fit()},e.prototype.onBeforeShow=function(r){t.prototype.onBeforeShow.call(this,r),this.parent.update()},e.prototype.onBeforeAttach=function(r){t.prototype.onBeforeAttach.call(this,r),this.parent.fit()},e.prototype.onChildShown=function(r){this.parent.fit()},e.prototype.onChildHidden=function(r){this.parent.fit()},e.prototype.onResize=function(r){this.parent.isVisible&&this._update(r.width,r.height)},e.prototype.onUpdateRequest=function(r){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(r){this.parent.isAttached&&this._fit()},e.prototype._fit=function(){for(var r=0,i=0,n=this._items.length;i<n;++i)r+=+!this._items[i].isHidden;this._fixed=this._spacing*Math.max(0,r-1);for(var o=Wg.isHorizontal(this._direction),s=o?this._fixed:0,l=o?0:this._fixed,i=0,n=this._items.length;i<n;++i){var u=this._items[i],h=this._sizers[i];if(u.isHidden){h.minSize=0,h.maxSize=0;continue}u.fit(),h.sizeHint=e.getSizeBasis(u.widget),h.stretch=e.getStretch(u.widget),o?(h.minSize=u.minWidth,h.maxSize=u.maxWidth,s+=u.minWidth,l=Math.max(l,u.minHeight)):(h.minSize=u.minHeight,h.maxSize=u.maxHeight,l+=u.minHeight,s=Math.max(s,u.minWidth))}var v=this._box=ho.boxSizing(this.parent.node);s+=v.horizontalSum,l+=v.verticalSum;var T=this.parent.node.style;T.minWidth=s+"px",T.minHeight=l+"px",this._dirty=!0,this.parent.parent&&xr.sendMessage(this.parent.parent,Br.Msg.FitRequest),this._dirty&&xr.sendMessage(this.parent,Br.Msg.UpdateRequest)},e.prototype._update=function(r,i){this._dirty=!1;for(var n=0,o=0,s=this._items.length;o<s;++o)n+=+!this._items[o].isHidden;if(n!==0){r<0&&(r=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=ho.boxSizing(this.parent.node));var l=this._box.paddingTop,u=this._box.paddingLeft,h=r-this._box.horizontalSum,v=i-this._box.verticalSum,T;switch(this._direction){case"left-to-right":T=lu.calc(this._sizers,Math.max(0,h-this._fixed));break;case"top-to-bottom":T=lu.calc(this._sizers,Math.max(0,v-this._fixed));break;case"right-to-left":T=lu.calc(this._sizers,Math.max(0,h-this._fixed)),u+=h;break;case"bottom-to-top":T=lu.calc(this._sizers,Math.max(0,v-this._fixed)),l+=v;break;default:throw"unreachable"}var E=0,M=0;if(T>0)switch(this._alignment){case"start":break;case"center":E=0,M=T/2;break;case"end":E=0,M=T;break;case"justify":E=T/n,M=0;break;default:throw"unreachable"}for(var o=0,s=this._items.length;o<s;++o){var O=this._items[o];if(!O.isHidden){var F=this._sizers[o].size;switch(this._direction){case"left-to-right":O.update(u+M,l,F+E,v),u+=F+E+this._spacing;break;case"top-to-bottom":O.update(u,l+M,h,F+E),l+=F+E+this._spacing;break;case"right-to-left":O.update(u-M-F-E,l,F+E,v),u-=F+E+this._spacing;break;case"bottom-to-top":O.update(u,l-M-F-E,h,F+E),l-=F+E+this._spacing;break;default:throw"unreachable"}}}}},e}($I);(function(t){function e(o){return Wg.stretchProperty.get(o)}t.getStretch=e;function r(o,s){Wg.stretchProperty.set(o,s)}t.setStretch=r;function i(o){return Wg.sizeBasisProperty.get(o)}t.getSizeBasis=i;function n(o,s){Wg.sizeBasisProperty.set(o,s)}t.setSizeBasis=n})(Gf||(Gf={}));var Wg;(function(t){t.stretchProperty=new lc({name:"stretch",create:function(){return 0},coerce:function(n,o){return Math.max(0,Math.floor(o))},changed:i}),t.sizeBasisProperty=new lc({name:"sizeBasis",create:function(){return 0},coerce:function(n,o){return Math.max(0,Math.floor(o))},changed:i});function e(n){return n==="left-to-right"||n==="right-to-left"}t.isHorizontal=e;function r(n){return Math.max(0,Math.floor(n))}t.clampSpacing=r;function i(n){n.parent&&n.parent.layout instanceof Gf&&n.parent.fit()}})(Wg||(Wg={}));var kee=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{layout:ak.createLayout(r)})||this;return i.addClass("lm-BoxPanel"),i.addClass("p-BoxPanel"),i}return Object.defineProperty(e.prototype,"direction",{get:function(){return this.layout.direction},set:function(r){this.layout.direction=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this.layout.alignment},set:function(r){this.layout.alignment=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this.layout.spacing},set:function(r){this.layout.spacing=r},enumerable:!0,configurable:!0}),e.prototype.onChildAdded=function(r){r.child.addClass("lm-BoxPanel-child"),r.child.addClass("p-BoxPanel-child")},e.prototype.onChildRemoved=function(r){r.child.removeClass("lm-BoxPanel-child"),r.child.removeClass("p-BoxPanel-child")},e}(Gw);(function(t){function e(o){return Gf.getStretch(o)}t.getStretch=e;function r(o,s){Gf.setStretch(o,s)}t.setStretch=r;function i(o){return Gf.getSizeBasis(o)}t.getSizeBasis=i;function n(o,s){Gf.setSizeBasis(o,s)}t.setSizeBasis=n})(kee||(kee={}));var ak;(function(t){function e(r){return r.layout||new Gf(r)}t.createLayout=e})(ak||(ak={}));var Uee=function(t){ks(e,t);function e(r){var i=t.call(this,{node:rp.createNode()})||this;return i._activeIndex=-1,i._items=[],i._results=null,i.addClass("lm-CommandPalette"),i.addClass("p-CommandPalette"),i.setFlag(Br.Flag.DisallowLayout),i.commands=r.commands,i.renderer=r.renderer||e.defaultRenderer,i.commands.commandChanged.connect(i._onGenericChange,i),i.commands.keyBindingChanged.connect(i._onGenericChange,i),i}return e.prototype.dispose=function(){this._items.length=0,this._results=null,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"searchNode",{get:function(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputNode",{get:function(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this._items},enumerable:!0,configurable:!0}),e.prototype.addItem=function(r){var i=rp.createItem(this.commands,r);return this._items.push(i),this.refresh(),i},e.prototype.addItems=function(r){var i=this,n=r.map(function(o){return rp.createItem(i.commands,o)});return n.forEach(function(o){return i._items.push(o)}),this.refresh(),n},e.prototype.removeItem=function(r){this.removeItemAt(this._items.indexOf(r))},e.prototype.removeItemAt=function(r){var i=rr.removeAt(this._items,r);i&&this.refresh()},e.prototype.clearItems=function(){this._items.length!==0&&(this._items.length=0,this.refresh())},e.prototype.refresh=function(){if(this._results=null,this.inputNode.value!==""){var r=this.node.getElementsByClassName("lm-close-icon")[0];r.style.display="inherit"}else{var r=this.node.getElementsByClassName("lm-close-icon")[0];r.style.display="none"}this.update()},e.prototype.handleEvent=function(r){switch(r.type){case"click":this._evtClick(r);break;case"keydown":this._evtKeyDown(r);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)},e.prototype.onActivateRequest=function(r){if(this.isAttached){var i=this.inputNode;i.focus(),i.select()}},e.prototype.onUpdateRequest=function(r){var i=this.inputNode.value,n=this.contentNode,o=this._results;if(o||(o=this._results=rp.search(this._items,i),this._activeIndex=i?rr.findFirstIndex(o,rp.canActivate):-1),!i&&o.length===0){tp.render(null,n);return}if(i&&o.length===0){var s=this.renderer.renderEmptyMessage({query:i});tp.render(s,n);return}for(var l=this.renderer,u=this._activeIndex,h=new Array(o.length),v=0,T=o.length;v<T;++v){var E=o[v];if(E.type==="header"){var M=E.indices,O=E.category;h[v]=l.renderHeader({category:O,indices:M})}else{var F=E.item,M=E.indices,z=v===u;h[v]=l.renderItem({item:F,indices:M,active:z})}}if(tp.render(h,n),u<0||u>=o.length)n.scrollTop=0;else{var W=n.children[u];ho.scrollIntoViewIfNeeded(n,W)}},e.prototype._evtClick=function(r){if(r.button===0){if(r.target.classList.contains("lm-close-icon")){this.inputNode.value="",this.refresh();return}var i=rr.findFirstIndex(this.contentNode.children,function(n){return n.contains(r.target)});i!==-1&&(r.preventDefault(),r.stopPropagation(),this._execute(i))}},e.prototype._evtKeyDown=function(r){if(!(r.altKey||r.ctrlKey||r.metaKey||r.shiftKey))switch(r.keyCode){case 13:r.preventDefault(),r.stopPropagation(),this._execute(this._activeIndex);break;case 38:r.preventDefault(),r.stopPropagation(),this._activatePreviousItem();break;case 40:r.preventDefault(),r.stopPropagation(),this._activateNextItem();break}},e.prototype._activateNextItem=function(){if(!(!this._results||this._results.length===0)){var r=this._activeIndex,i=this._results.length,n=r<i-1?r+1:0,o=n===0?i-1:n-1;this._activeIndex=rr.findFirstIndex(this._results,rp.canActivate,n,o),this.update()}},e.prototype._activatePreviousItem=function(){if(!(!this._results||this._results.length===0)){var r=this._activeIndex,i=this._results.length,n=r<=0?i-1:r-1,o=n===i-1?0:n+1;this._activeIndex=rr.findLastIndex(this._results,rp.canActivate,n,o),this.update()}},e.prototype._execute=function(r){if(this._results){var i=this._results[r];if(i){if(i.type==="header"){var n=this.inputNode;n.value=i.category.toLowerCase()+" ",n.focus(),this.refresh();return}i.item.isEnabled&&(this.commands.execute(i.item.command,i.item.args),this.inputNode.value="",this.refresh())}}},e.prototype._toggleFocused=function(){var r=document.activeElement===this.inputNode;this.toggleClass("lm-mod-focused",r),this.toggleClass("p-mod-focused",r)},e.prototype._onGenericChange=function(){this.refresh()},e}(Br);(function(t){var e=function(){function r(){}return r.prototype.renderHeader=function(i){var n=this.formatHeader(i);return so.li({className:"lm-CommandPalette-header p-CommandPalette-header"},n)},r.prototype.renderItem=function(i){var n=this.createItemClass(i),o=this.createItemDataset(i);return i.item.isToggleable?so.li({className:n,dataset:o,role:"checkbox","aria-checked":""+i.item.isToggled},this.renderItemIcon(i),this.renderItemContent(i),this.renderItemShortcut(i)):so.li({className:n,dataset:o},this.renderItemIcon(i),this.renderItemContent(i),this.renderItemShortcut(i))},r.prototype.renderEmptyMessage=function(i){var n=this.formatEmptyMessage(i);return so.li({className:"lm-CommandPalette-emptyMessage p-CommandPalette-emptyMessage"},n)},r.prototype.renderItemIcon=function(i){var n=this.createIconClass(i);return typeof i.item.icon=="string"?so.div({className:n},i.item.iconLabel):so.div({className:n},i.item.icon,i.item.iconLabel)},r.prototype.renderItemContent=function(i){return so.div({className:"lm-CommandPalette-itemContent p-CommandPalette-itemContent"},this.renderItemLabel(i),this.renderItemCaption(i))},r.prototype.renderItemLabel=function(i){var n=this.formatItemLabel(i);return so.div({className:"lm-CommandPalette-itemLabel p-CommandPalette-itemLabel"},n)},r.prototype.renderItemCaption=function(i){var n=this.formatItemCaption(i);return so.div({className:"lm-CommandPalette-itemCaption p-CommandPalette-itemCaption"},n)},r.prototype.renderItemShortcut=function(i){var n=this.formatItemShortcut(i);return so.div({className:"lm-CommandPalette-itemShortcut p-CommandPalette-itemShortcut"},n)},r.prototype.createItemClass=function(i){var n="lm-CommandPalette-item";n+=" p-CommandPalette-item",i.item.isEnabled||(n+=" lm-mod-disabled",n+=" p-mod-disabled"),i.item.isToggled&&(n+=" lm-mod-toggled",n+=" p-mod-toggled"),i.active&&(n+=" lm-mod-active",n+=" p-mod-active");var o=i.item.className;return o&&(n+=" "+o),n},r.prototype.createItemDataset=function(i){return ol(ol({},i.item.dataset),{command:i.item.command})},r.prototype.createIconClass=function(i){var n="lm-CommandPalette-itemIcon";n+=" p-CommandPalette-itemIcon";var o=i.item.iconClass;return o?n+" "+o:n},r.prototype.formatHeader=function(i){return!i.indices||i.indices.length===0?i.category:tv.highlight(i.category,i.indices,so.mark)},r.prototype.formatEmptyMessage=function(i){return"No commands found that match '"+i.query+"'"},r.prototype.formatItemShortcut=function(i){var n=i.item.keyBinding;return n?ov.formatKeystroke(n.keys):null},r.prototype.formatItemLabel=function(i){return!i.indices||i.indices.length===0?i.item.label:tv.highlight(i.item.label,i.indices,so.mark)},r.prototype.formatItemCaption=function(i){return i.item.caption},r}();t.Renderer=e,t.defaultRenderer=new e})(Uee||(Uee={}));var rp;(function(t){function e(){var E=document.createElement("div"),M=document.createElement("div"),O=document.createElement("div"),F=document.createElement("input"),z=document.createElement("ul"),W=document.createElement("button");return M.className="lm-CommandPalette-search",O.className="lm-CommandPalette-wrapper",F.className="lm-CommandPalette-input",W.className="lm-close-icon",z.className="lm-CommandPalette-content",M.classList.add("p-CommandPalette-search"),O.classList.add("p-CommandPalette-wrapper"),F.classList.add("p-CommandPalette-input"),z.classList.add("p-CommandPalette-content"),F.spellcheck=!1,O.appendChild(F),O.appendChild(W),M.appendChild(O),E.appendChild(M),E.appendChild(z),E}t.createNode=e;function r(E,M){return new T(E,M)}t.createItem=r;function i(E,M){var O=l(E,M);return O.sort(h),v(O)}t.search=i;function n(E){return E.type==="item"&&E.item.isEnabled}t.canActivate=n;function o(E){return E.trim().replace(/\s+/g," ")}function s(E){return E.replace(/\s+/g,"").toLowerCase()}function l(E,M){M=s(M);for(var O=[],F=0,z=E.length;F<z;++F){var W=E[F];if(W.isVisible){if(!M){O.push({matchType:3,categoryIndices:null,labelIndices:null,score:0,item:W});continue}var J=u(W,M);J&&(W.isEnabled||(J.score+=1e3),O.push(J))}}return O}function u(E,M){for(var O=E.category.toLowerCase(),F=E.label.toLowerCase(),z=O+" "+F,W=1/0,J=null,K=/\b\w/g;;){var ne=K.exec(z);if(!ne)break;var ge=tv.matchSumOfDeltas(z,M,ne.index);if(!ge)break;ge&&ge.score<=W&&(W=ge.score,J=ge.indices)}if(!J||W===1/0)return null;for(var j=O.length+1,me=rr.lowerBound(J,j,function(Oe,he){return Oe-he}),fe=J.slice(0,me),$=J.slice(me),Z=0,we=$.length;Z<we;++Z)$[Z]-=j;return fe.length===0?{matchType:0,categoryIndices:null,labelIndices:$,score:W,item:E}:$.length===0?{matchType:1,categoryIndices:fe,labelIndices:null,score:W,item:E}:{matchType:2,categoryIndices:fe,labelIndices:$,score:W,item:E}}function h(E,M){var O=E.matchType-M.matchType;if(O!==0)return O;var F=E.score-M.score;if(F!==0)return F;var z=0,W=0;switch(E.matchType){case 0:z=E.labelIndices[0],W=M.labelIndices[0];break;case 1:case 2:z=E.categoryIndices[0],W=M.categoryIndices[0];break}if(z!==W)return z-W;var J=E.item.category.localeCompare(M.item.category);if(J!==0)return J;var K=E.item.rank,ne=M.item.rank;return K!==ne?K<ne?-1:1:E.item.label.localeCompare(M.item.label)}function v(E){var M=new Array(E.length);rr.fill(M,!1);for(var O=[],F=0,z=E.length;F<z;++F)if(!M[F]){var W=E[F],J=W.item,K=W.categoryIndices,ne=J.category;O.push({type:"header",category:ne,indices:K});for(var ge=F;ge<z;++ge)if(!M[ge]){var j=E[ge],me=j.item,fe=j.labelIndices;me.category===ne&&(O.push({type:"item",item:me,indices:fe}),M[ge]=!0)}}return O}var T=function(){function E(M,O){this._commands=M,this.category=o(O.category),this.command=O.command,this.args=O.args||qg.JSONExt.emptyObject,this.rank=O.rank!==void 0?O.rank:1/0}return Object.defineProperty(E.prototype,"label",{get:function(){return this._commands.label(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"icon",{get:function(){return this._commands.icon(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"iconClass",{get:function(){return this._commands.iconClass(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"iconLabel",{get:function(){return this._commands.iconLabel(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"caption",{get:function(){return this._commands.caption(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"className",{get:function(){return this._commands.className(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"dataset",{get:function(){return this._commands.dataset(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"isEnabled",{get:function(){return this._commands.isEnabled(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"isToggled",{get:function(){return this._commands.isToggled(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"isToggleable",{get:function(){return this._commands.isToggleable(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"isVisible",{get:function(){return this._commands.isVisible(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"keyBinding",{get:function(){var M=this,O=M.command,F=M.args;return rr.findLastValue(this._commands.keyBindings,function(z){return z.command===O&&qg.JSONExt.deepEqual(z.args,F)})||null},enumerable:!0,configurable:!0}),E}()})(rp||(rp={}));var lv=function(t){ks(e,t);function e(r){var i=t.call(this,{node:uc.createNode()})||this;return i._childIndex=-1,i._activeIndex=-1,i._openTimerID=0,i._closeTimerID=0,i._items=[],i._childMenu=null,i._parentMenu=null,i._aboutToClose=new Wn(i),i._menuRequested=new Wn(i),i.addClass("lm-Menu"),i.addClass("p-Menu"),i.setFlag(Br.Flag.DisallowLayout),i.commands=r.commands,i.renderer=r.renderer||e.defaultRenderer,i}return e.prototype.dispose=function(){this.close(),this._items.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"aboutToClose",{get:function(){return this._aboutToClose},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"menuRequested",{get:function(){return this._menuRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parentMenu",{get:function(){return this._parentMenu},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childMenu",{get:function(){return this._childMenu},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rootMenu",{get:function(){for(var r=this;r._parentMenu;)r=r._parentMenu;return r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leafMenu",{get:function(){for(var r=this;r._childMenu;)r=r._childMenu;return r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-Menu-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeItem",{get:function(){return this._items[this._activeIndex]||null},set:function(r){this.activeIndex=r?this._items.indexOf(r):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(r){(r<0||r>=this._items.length)&&(r=-1),r!==-1&&!uc.canActivate(this._items[r])&&(r=-1),this._activeIndex!==r&&(this._activeIndex=r,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this._items},enumerable:!0,configurable:!0}),e.prototype.activateNextItem=function(){var r=this._items.length,i=this._activeIndex,n=i<r-1?i+1:0,o=n===0?r-1:n-1;this.activeIndex=rr.findFirstIndex(this._items,uc.canActivate,n,o)},e.prototype.activatePreviousItem=function(){var r=this._items.length,i=this._activeIndex,n=i<=0?r-1:i-1,o=n===r-1?0:n+1;this.activeIndex=rr.findLastIndex(this._items,uc.canActivate,n,o)},e.prototype.triggerActiveItem=function(){if(this.isAttached){var r=this.activeItem;if(r){if(this._cancelOpenTimer(),this._cancelCloseTimer(),r.type==="submenu"){this._openChildMenu(!0);return}this.rootMenu.close();var i=r.command,n=r.args;this.commands.isEnabled(i,n)?this.commands.execute(i,n):console.log("Command '"+i+"' is disabled.")}}},e.prototype.addItem=function(r){return this.insertItem(this._items.length,r)},e.prototype.insertItem=function(r,i){this.isAttached&&this.close(),this.activeIndex=-1;var n=Math.max(0,Math.min(r,this._items.length)),o=uc.createItem(this,i);return rr.insert(this._items,n,o),this.update(),o},e.prototype.removeItem=function(r){this.removeItemAt(this._items.indexOf(r))},e.prototype.removeItemAt=function(r){this.isAttached&&this.close(),this.activeIndex=-1;var i=rr.removeAt(this._items,r);i&&this.update()},e.prototype.clearItems=function(){this.isAttached&&this.close(),this.activeIndex=-1,this._items.length!==0&&(this._items.length=0,this.update())},e.prototype.open=function(r,i,n){if(n===void 0&&(n={}),!this.isAttached){var o=n.forceX||!1,s=n.forceY||!1;uc.openRootMenu(this,r,i,o,s),this.activate()}},e.prototype.handleEvent=function(r){switch(r.type){case"keydown":this._evtKeyDown(r);break;case"mouseup":this._evtMouseUp(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseenter":this._evtMouseEnter(r);break;case"mouseleave":this._evtMouseLeave(r);break;case"mousedown":this._evtMouseDown(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("keydown",this),this.node.addEventListener("mouseup",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseenter",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("contextmenu",this),document.addEventListener("mousedown",this,!0)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mouseup",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseenter",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("contextmenu",this),document.removeEventListener("mousedown",this,!0)},e.prototype.onActivateRequest=function(r){this.isAttached&&this.node.focus()},e.prototype.onUpdateRequest=function(r){for(var i=this,n=this._items,o=this.renderer,s=this._activeIndex,l=uc.computeCollapsed(n),u=new Array(n.length),h=function(E,M){var O=n[E],F=E===s,z=l[E];u[E]=o.renderItem({item:O,active:F,collapsed:z,onfocus:function(){i.activeIndex=E}})},v=0,T=n.length;v<T;++v)h(v);tp.render(u,this.contentNode)},e.prototype.onCloseRequest=function(r){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;var i=this._childMenu;i&&(this._childIndex=-1,this._childMenu=null,i._parentMenu=null,i.close());var n=this._parentMenu;n&&(this._parentMenu=null,n._childIndex=-1,n._childMenu=null,n.activate()),this.isAttached&&this._aboutToClose.emit(void 0),t.prototype.onCloseRequest.call(this,r)},e.prototype._evtKeyDown=function(r){r.preventDefault(),r.stopPropagation();var i=r.keyCode;if(i===13){this.triggerActiveItem();return}if(i===27){this.close();return}if(i===37){this._parentMenu?this.close():this._menuRequested.emit("previous");return}if(i===38){this.activatePreviousItem();return}if(i===39){var n=this.activeItem;n&&n.type==="submenu"?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next");return}if(i===40){this.activateNextItem();return}var o=nv().keyForKeydownEvent(r);if(o){var s=this._activeIndex+1,l=uc.findMnemonic(this._items,o,s);l.index!==-1&&!l.multiple?(this.activeIndex=l.index,this.triggerActiveItem()):l.index!==-1?this.activeIndex=l.index:l.auto!==-1&&(this.activeIndex=l.auto)}},e.prototype._evtMouseUp=function(r){r.button===0&&(r.preventDefault(),r.stopPropagation(),this.triggerActiveItem())},e.prototype._evtMouseMove=function(r){var i=rr.findFirstIndex(this.contentNode.children,function(o){return ho.hitTest(o,r.clientX,r.clientY)});if(i!==this._activeIndex){if(this.activeIndex=i,i=this.activeIndex,i===this._childIndex){this._cancelOpenTimer(),this._cancelCloseTimer();return}this._childIndex!==-1&&this._startCloseTimer(),this._cancelOpenTimer();var n=this.activeItem;!n||n.type!=="submenu"||!n.submenu||this._startOpenTimer()}},e.prototype._evtMouseEnter=function(r){for(var i=this._parentMenu;i;i=i._parentMenu)i._cancelOpenTimer(),i._cancelCloseTimer(),i.activeIndex=i._childIndex},e.prototype._evtMouseLeave=function(r){if(this._cancelOpenTimer(),!this._childMenu){this.activeIndex=-1;return}var i=r.clientX,n=r.clientY;if(ho.hitTest(this._childMenu.node,i,n)){this._cancelCloseTimer();return}this.activeIndex=-1,this._startCloseTimer()},e.prototype._evtMouseDown=function(r){this._parentMenu||(uc.hitTestMenus(this,r.clientX,r.clientY)?(r.preventDefault(),r.stopPropagation()):this.close())},e.prototype._openChildMenu=function(r){r===void 0&&(r=!1);var i=this.activeItem;if(!i||i.type!=="submenu"||!i.submenu){this._closeChildMenu();return}var n=i.submenu;if(n!==this._childMenu){e.saveWindowData(),this._closeChildMenu(),this._childMenu=n,this._childIndex=this._activeIndex,n._parentMenu=this,xr.sendMessage(this,Br.Msg.UpdateRequest);var o=this.contentNode.children[this._activeIndex];uc.openSubmenu(n,o),r&&(n.activeIndex=-1,n.activateNextItem()),n.activate()}},e.prototype._closeChildMenu=function(){this._childMenu&&this._childMenu.close()},e.prototype._startOpenTimer=function(){var r=this;this._openTimerID===0&&(this._openTimerID=window.setTimeout(function(){r._openTimerID=0,r._openChildMenu()},uc.TIMER_DELAY))},e.prototype._startCloseTimer=function(){var r=this;this._closeTimerID===0&&(this._closeTimerID=window.setTimeout(function(){r._closeTimerID=0,r._closeChildMenu()},uc.TIMER_DELAY))},e.prototype._cancelOpenTimer=function(){this._openTimerID!==0&&(clearTimeout(this._openTimerID),this._openTimerID=0)},e.prototype._cancelCloseTimer=function(){this._closeTimerID!==0&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)},e.saveWindowData=function(){uc.saveWindowData()},e}(Br);(function(t){var e=function(){function r(){}return r.prototype.renderItem=function(i){var n=this.createItemClass(i),o=this.createItemDataset(i),s=this.createItemARIA(i);return so.li(ol({className:n,dataset:o,tabindex:"0",onfocus:i.onfocus},s),this.renderIcon(i),this.renderLabel(i),this.renderShortcut(i),this.renderSubmenu(i))},r.prototype.renderIcon=function(i){var n=this.createIconClass(i);return typeof i.item.icon=="string"?so.div({className:n},i.item.iconLabel):so.div({className:n},i.item.icon,i.item.iconLabel)},r.prototype.renderLabel=function(i){var n=this.formatLabel(i);return so.div({className:"lm-Menu-itemLabel p-Menu-itemLabel"},n)},r.prototype.renderShortcut=function(i){var n=this.formatShortcut(i);return so.div({className:"lm-Menu-itemShortcut p-Menu-itemShortcut"},n)},r.prototype.renderSubmenu=function(i){return so.div({className:"lm-Menu-itemSubmenuIcon p-Menu-itemSubmenuIcon"})},r.prototype.createItemClass=function(i){var n="lm-Menu-item";n+=" p-Menu-item",i.item.isEnabled||(n+=" lm-mod-disabled",n+=" p-mod-disabled"),i.item.isToggled&&(n+=" lm-mod-toggled",n+=" p-mod-toggled"),i.item.isVisible||(n+=" lm-mod-hidden",n+=" p-mod-hidden"),i.active&&(n+=" lm-mod-active",n+=" p-mod-active"),i.collapsed&&(n+=" lm-mod-collapsed",n+=" p-mod-collapsed");var o=i.item.className;return o&&(n+=" "+o),n},r.prototype.createItemDataset=function(i){var n,o=i.item,s=o.type,l=o.command,u=o.dataset;return s==="command"?n=ol(ol({},u),{type:s,command:l}):n=ol(ol({},u),{type:s}),n},r.prototype.createIconClass=function(i){var n="lm-Menu-itemIcon";n+=" p-Menu-itemIcon";var o=i.item.iconClass;return o?n+" "+o:n},r.prototype.createItemARIA=function(i){var n={};switch(i.item.type){case"separator":n.role="presentation";break;case"submenu":n["aria-haspopup"]="true",i.item.isEnabled||(n["aria-disabled"]="true");break;default:i.item.isEnabled||(n["aria-disabled"]="true"),n.role="menuitem"}return n},r.prototype.formatLabel=function(i){var n=i.item,o=n.label,s=n.mnemonic;if(s<0||s>=o.length)return o;var l=o.slice(0,s),u=o.slice(s+1),h=o[s],v=so.span({className:"lm-Menu-itemMnemonic p-Menu-itemMnemonic"},h);return[l,v,u]},r.prototype.formatShortcut=function(i){var n=i.item.keyBinding;return n?ov.formatKeystroke(n.keys):null},r}();t.Renderer=e,t.defaultRenderer=new e})(lv||(lv={}));var uc;(function(t){t.TIMER_DELAY=300,t.SUBMENU_OVERLAP=3;var e=null,r=0;function i(){return r>0?(r--,e):v()}function n(){e=v(),r++}t.saveWindowData=n;function o(){var F=document.createElement("div"),z=document.createElement("ul");return z.className="lm-Menu-content",z.classList.add("p-Menu-content"),F.appendChild(z),z.setAttribute("role","menu"),F.tabIndex=0,F}t.createNode=o;function s(F){return F.type!=="separator"&&F.isEnabled&&F.isVisible}t.canActivate=s;function l(F,z){return new O(F.commands,z)}t.createItem=l;function u(F,z,W){for(var J=F;J;J=J.childMenu)if(ho.hitTest(J.node,z,W))return!0;return!1}t.hitTestMenus=u;function h(F){var z=new Array(F.length);rr.fill(z,!1);for(var W=0,J=F.length;W<J;++W){var K=F[W];if(K.isVisible){if(K.type!=="separator")break;z[W]=!0}}for(var ne=J-1;ne>=0;--ne){var K=F[ne];if(K.isVisible){if(K.type!=="separator")break;z[ne]=!0}}for(var ge=!1;++W<ne;){var K=F[W];K.isVisible&&(K.type!=="separator"?ge=!1:ge?z[W]=!0:ge=!0)}return z}t.computeCollapsed=h;function v(){return{pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset,clientWidth:document.documentElement.clientWidth,clientHeight:document.documentElement.clientHeight}}function T(F,z,W,J,K){var ne=i(),ge=ne.pageXOffset,j=ne.pageYOffset,me=ne.clientWidth,fe=ne.clientHeight;xr.sendMessage(F,Br.Msg.UpdateRequest);var $=fe-(K?W:0),Z=F.node,we=Z.style;we.opacity="0",we.maxHeight=$+"px",Br.attach(F,document.body);var Oe=Z.getBoundingClientRect(),he=Oe.width,Le=Oe.height;!J&&z+he>ge+me&&(z=ge+me-he),!K&&W+Le>j+fe&&(W>j+fe?W=j+fe-Le:W=W-Le),we.transform="translate("+Math.max(0,z)+"px, "+Math.max(0,W)+"px",we.opacity="1"}t.openRootMenu=T;function E(F,z){var W=i(),J=W.pageXOffset,K=W.pageYOffset,ne=W.clientWidth,ge=W.clientHeight;xr.sendMessage(F,Br.Msg.UpdateRequest);var j=ge,me=F.node,fe=me.style;fe.opacity="0",fe.maxHeight=j+"px",Br.attach(F,document.body);var $=me.getBoundingClientRect(),Z=$.width,we=$.height,Oe=ho.boxSizing(F.node),he=z.getBoundingClientRect(),Le=he.right-t.SUBMENU_OVERLAP;Le+Z>J+ne&&(Le=he.left+t.SUBMENU_OVERLAP-Z);var ft=he.top-Oe.borderTop-Oe.paddingTop;ft+we>K+ge&&(ft=he.bottom+Oe.borderBottom+Oe.paddingBottom-we),fe.transform="translate("+Math.max(0,Le)+"px, "+Math.max(0,ft)+"px",fe.opacity="1"}t.openSubmenu=E;function M(F,z,W){for(var J=-1,K=-1,ne=!1,ge=z.toUpperCase(),j=0,me=F.length;j<me;++j){var fe=(j+W)%me,$=F[fe];if(s($)){var Z=$.label;if(Z.length!==0){var we=$.mnemonic;if(we>=0&&we<Z.length){Z[we].toUpperCase()===ge&&(J===-1?J=fe:ne=!0);continue}K===-1&&Z[0].toUpperCase()===ge&&(K=fe)}}}return{index:J,multiple:ne,auto:K}}t.findMnemonic=M;var O=function(){function F(z,W){this._commands=z,this.type=W.type||"command",this.command=W.command||"",this.args=W.args||qg.JSONExt.emptyObject,this.submenu=W.submenu||null}return Object.defineProperty(F.prototype,"label",{get:function(){return this.type==="command"?this._commands.label(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.label:""},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"mnemonic",{get:function(){return this.type==="command"?this._commands.mnemonic(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.mnemonic:-1},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"icon",{get:function(){return this.type==="command"?this._commands.icon(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.icon:this.iconClass},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"iconClass",{get:function(){return this.type==="command"?this._commands.iconClass(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.iconClass:""},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"iconLabel",{get:function(){return this.type==="command"?this._commands.iconLabel(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.iconLabel:""},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"caption",{get:function(){return this.type==="command"?this._commands.caption(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.caption:""},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"className",{get:function(){return this.type==="command"?this._commands.className(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.className:""},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"dataset",{get:function(){return this.type==="command"?this._commands.dataset(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.dataset:{}},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"isEnabled",{get:function(){return this.type==="command"?this._commands.isEnabled(this.command,this.args):this.type==="submenu"?this.submenu!==null:!0},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"isToggled",{get:function(){return this.type==="command"?this._commands.isToggled(this.command,this.args):!1},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"isVisible",{get:function(){return this.type==="command"?this._commands.isVisible(this.command,this.args):this.type==="submenu"?this.submenu!==null:!0},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"keyBinding",{get:function(){if(this.type==="command"){var z=this,W=z.command,J=z.args;return rr.findLastValue(this._commands.keyBindings,function(K){return K.command===W&&qg.JSONExt.deepEqual(K.args,J)})||null}return null},enumerable:!0,configurable:!0}),F}()})(uc||(uc={}));var jTt=function(){function t(e){this._groupByTarget=!0,this._idTick=0,this._items=[],this._sortBySelector=!0;var r=e.groupByTarget,i=e.sortBySelector,n=qMe(e,["groupByTarget","sortBySelector"]);this.menu=new lv(n),this._groupByTarget=r!==!1,this._sortBySelector=i!==!1}return t.prototype.addItem=function(e){var r=this,i=ZI.createItem(e,this._idTick++);return this._items.push(i),new wA(function(){rr.removeFirstOf(r._items,i)})},t.prototype.open=function(e){var r=this;if(lv.saveWindowData(),this.menu.clearItems(),this._items.length===0)return!1;var i=ZI.matchItems(this._items,e,this._groupByTarget,this._sortBySelector);return!i||i.length===0?!1:(Ei(i,function(n){r.menu.addItem(n)}),this.menu.open(e.clientX,e.clientY),!0)},t}(),ZI;(function(t){function e(s,l){var u=i(s.selector),h=s.rank!==void 0?s.rank:1/0;return ol(ol({},s),{selector:u,rank:h,id:l})}t.createItem=e;function r(s,l,u,h){var v=l.target;if(!v)return null;var T=l.currentTarget;if(!T||!T.contains(v)&&(v=document.elementFromPoint(l.clientX,l.clientY),!v||!T.contains(v)))return null;for(var E=[],M=s.slice();v!==null;){for(var O=[],F=0,z=M.length;F<z;++F){var W=M[F];W&&jf.matches(v,W.selector)&&(O.push(W),M[F]=null)}if(O.length!==0&&(u&&O.sort(h?o:n),E.push.apply(E,O)),v===T)break;v=v.parentElement}return u||E.sort(h?o:n),E}t.matchItems=r;function i(s){if(s.indexOf(",")!==-1)throw new Error("Selector cannot contain commas: "+s);if(!jf.isValid(s))throw new Error("Invalid selector: "+s);return s}function n(s,l){var u=s.rank,h=l.rank;return u!==h?u<h?-1:1:s.id-l.id}function o(s,l){var u=jf.calculateSpecificity(s.selector),h=jf.calculateSpecificity(l.selector);return u!==h?h-u:n(s,l)}})(ZI||(ZI={}));var cv=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{node:Ju.createNode()})||this;return i._currentIndex=-1,i._titles=[],i._titlesEditable=!1,i._previousTitle=null,i._dragData=null,i._addButtonEnabled=!1,i._tabMoved=new Wn(i),i._currentChanged=new Wn(i),i._addRequested=new Wn(i),i._tabCloseRequested=new Wn(i),i._tabDetachRequested=new Wn(i),i._tabActivateRequested=new Wn(i),i.addClass("lm-TabBar"),i.addClass("p-TabBar"),i.contentNode.setAttribute("role","tablist"),i.setFlag(Br.Flag.DisallowLayout),i._document=r.document||document,i.tabsMovable=r.tabsMovable||!1,i.titlesEditable=r.titlesEditable||!1,i.allowDeselect=r.allowDeselect||!1,i.addButtonEnabled=r.addButtonEnabled||!1,i.insertBehavior=r.insertBehavior||"select-tab-if-needed",i.name=r.name||"",i.orientation=r.orientation||"horizontal",i.removeBehavior=r.removeBehavior||"select-tab-after",i.renderer=r.renderer||e.defaultRenderer,i}return e.prototype.dispose=function(){this._releaseMouse(),this._titles.length=0,this._previousTitle=null,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabMoved",{get:function(){return this._tabMoved},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabActivateRequested",{get:function(){return this._tabActivateRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addRequested",{get:function(){return this._addRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabCloseRequested",{get:function(){return this._tabCloseRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabDetachRequested",{get:function(){return this._tabDetachRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"document",{get:function(){return this._document},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"titlesEditable",{get:function(){return this._titlesEditable},set:function(r){this._titlesEditable=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTitle",{get:function(){return this._titles[this._currentIndex]||null},set:function(r){this.currentIndex=r?this._titles.indexOf(r):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentIndex",{get:function(){return this._currentIndex},set:function(r){if((r<0||r>=this._titles.length)&&(r=-1),this._currentIndex!==r){var i=this._currentIndex,n=this._titles[i]||null,o=r,s=this._titles[o]||null;this._currentIndex=o,this._previousTitle=n,this.update(),this._currentChanged.emit({previousIndex:i,previousTitle:n,currentIndex:o,currentTitle:s})}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(r){this._name=r,r?this.contentNode.setAttribute("aria-label",r):this.contentNode.removeAttribute("aria-label")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(r){this._orientation!==r&&(this._releaseMouse(),this._orientation=r,this.dataset.orientation=r,this.contentNode.setAttribute("aria-orientation",r))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addButtonEnabled",{get:function(){return this._addButtonEnabled},set:function(r){this._addButtonEnabled!==r&&(this._addButtonEnabled=r,r?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"titles",{get:function(){return this._titles},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-TabBar-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addButtonNode",{get:function(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]},enumerable:!0,configurable:!0}),e.prototype.addTab=function(r){return this.insertTab(this._titles.length,r)},e.prototype.insertTab=function(r,i){this._releaseMouse();var n=Ju.asTitle(i),o=this._titles.indexOf(n),s=Math.max(0,Math.min(r,this._titles.length));return o===-1?(rr.insert(this._titles,s,n),n.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(s,n),n):(s===this._titles.length&&s--,o===s||(rr.move(this._titles,o,s),this.update(),this._adjustCurrentForMove(o,s)),n)},e.prototype.removeTab=function(r){this.removeTabAt(this._titles.indexOf(r))},e.prototype.removeTabAt=function(r){this._releaseMouse();var i=rr.removeAt(this._titles,r);i&&(i.changed.disconnect(this._onTitleChanged,this),i===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(r,i))},e.prototype.clearTabs=function(){if(this._titles.length!==0){this._releaseMouse();for(var r=0,i=this._titles;r<i.length;r++){var n=i[r];n.changed.disconnect(this._onTitleChanged,this)}var o=this.currentIndex,s=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),o!==-1&&this._currentChanged.emit({previousIndex:o,previousTitle:s,currentIndex:-1,currentTitle:null})}},e.prototype.releaseMouse=function(){this._releaseMouse()},e.prototype.handleEvent=function(r){switch(r.type){case"mousedown":this._evtMouseDown(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseup":this._evtMouseUp(r);break;case"pointerdown":this._evtMouseDown(r);break;case"pointermove":this._evtMouseMove(r);break;case"pointerup":this._evtMouseUp(r);break;case"dblclick":this._evtDblClick(r);break;case"keydown":this._evtKeyDown(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("mousedown",this),this.node.addEventListener("pointerdown",this),this.node.addEventListener("dblclick",this)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("mousedown",this),this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("dblclick",this),this._releaseMouse()},e.prototype.onUpdateRequest=function(r){for(var i=this._titles,n=this.renderer,o=this.currentTitle,s=new Array(i.length),l=0,u=i.length;l<u;++l){var h=i[l],v=h===o,T=v?u:u-l-1;s[l]=n.renderTab({title:h,current:v,zIndex:T})}tp.render(s,this.contentNode)},e.prototype._evtDblClick=function(r){if(this.titlesEditable){var i=this.contentNode.children,n=rr.findFirstIndex(i,function(T){return ho.hitTest(T,r.clientX,r.clientY)});if(n!==-1){var o=this.titles[n],s=i[n].querySelector(".lm-TabBar-tabLabel");if(s&&s.contains(r.target)){var l=o.label||"",u=s.innerHTML;s.innerHTML="";var h=document.createElement("input");h.classList.add("lm-TabBar-tabInput"),h.value=l,s.appendChild(h);var v=function(){h.removeEventListener("blur",v),s.innerHTML=u};h.addEventListener("dblclick",function(T){return T.stopPropagation()}),h.addEventListener("blur",v),h.addEventListener("keydown",function(T){T.key==="Enter"?(h.value!==""&&(o.label=o.caption=h.value),v()):T.key==="Escape"&&v()}),h.select(),h.focus(),s.children.length>0&&s.children[0].focus()}}}},e.prototype._evtKeyDown=function(r){r.preventDefault(),r.stopPropagation(),r.keyCode===27&&this._releaseMouse()},e.prototype._evtMouseDown=function(r){if(!(r.button!==0&&r.button!==1)&&!this._dragData){var i=this.addButtonEnabled&&this.addButtonNode.contains(r.target),n=this.contentNode.children,o=rr.findFirstIndex(n,function(l){return ho.hitTest(l,r.clientX,r.clientY)});if(!(o===-1&&!i)&&(r.preventDefault(),r.stopPropagation(),this._dragData={tab:n[o],index:o,pressX:r.clientX,pressY:r.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("mouseup",this,!0),this.document.addEventListener("pointerup",this,!0),!(r.button===1||i))){var s=n[o].querySelector(this.renderer.closeIconSelector);s&&s.contains(r.target)||(this.tabsMovable&&(this.document.addEventListener("mousemove",this,!0),this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===o?this.currentIndex=-1:this.currentIndex=o,this.currentIndex!==-1&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}}},e.prototype._evtMouseMove=function(r){var i=this._dragData;if(i){r.preventDefault(),r.stopPropagation();var n=this.contentNode.children;if(!(!i.dragActive&&!Ju.dragExceeded(i,r))){if(!i.dragActive){var o=i.tab.getBoundingClientRect();this._orientation==="horizontal"?(i.tabPos=i.tab.offsetLeft,i.tabSize=o.width,i.tabPressPos=i.pressX-o.left):(i.tabPos=i.tab.offsetTop,i.tabSize=o.height,i.tabPressPos=i.pressY-o.top),i.tabLayout=Ju.snapTabLayout(n,this._orientation),i.contentRect=this.contentNode.getBoundingClientRect(),i.override=TA.overrideCursor("default"),i.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),i.tab.classList.add("p-mod-dragging"),this.addClass("p-mod-dragging"),i.dragActive=!0}if(!i.detachRequested&&Ju.detachExceeded(i,r)){i.detachRequested=!0;var s=i.index,l=r.clientX,u=r.clientY,h=n[s],v=this._titles[s];if(this._tabDetachRequested.emit({index:s,title:v,tab:h,clientX:l,clientY:u}),i.dragAborted)return}Ju.layoutTabs(n,i,r,this._orientation)}}},e.prototype._evtMouseUp=function(r){var i=this;if(!(r.button!==0&&r.button!==1)){var n=this._dragData;if(n){if(r.preventDefault(),r.stopPropagation(),this.document.removeEventListener("mousemove",this,!0),this.document.removeEventListener("mouseup",this,!0),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!n.dragActive){this._dragData=null;var o=this.addButtonEnabled&&this.addButtonNode.contains(r.target);if(o){this._addRequested.emit(void 0);return}var s=this.contentNode.children,l=rr.findFirstIndex(s,function(T){return ho.hitTest(T,r.clientX,r.clientY)});if(l!==n.index)return;var u=this._titles[l];if(!u.closable)return;if(r.button===1){this._tabCloseRequested.emit({index:l,title:u});return}var h=s[l].querySelector(this.renderer.closeIconSelector);if(h&&h.contains(r.target)){this._tabCloseRequested.emit({index:l,title:u});return}return}if(r.button===0){Ju.finalizeTabPosition(n,this._orientation),n.tab.classList.remove("lm-mod-dragging"),n.tab.classList.remove("p-mod-dragging");var v=Ju.parseTransitionDuration(n.tab);setTimeout(function(){if(!n.dragAborted){i._dragData=null,Ju.resetTabPositions(i.contentNode.children,i._orientation),n.override.dispose(),i.removeClass("lm-mod-dragging"),i.removeClass("p-mod-dragging");var T=n.index,E=n.targetIndex;E===-1||T===E||(rr.move(i._titles,T,E),i._adjustCurrentForMove(T,E),i._tabMoved.emit({fromIndex:T,toIndex:E,title:i._titles[E]}),xr.sendMessage(i,Br.Msg.UpdateRequest))}},v)}}}},e.prototype._releaseMouse=function(){var r=this._dragData;r&&(this._dragData=null,this.document.removeEventListener("mousemove",this,!0),this.document.removeEventListener("mouseup",this,!0),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),r.dragAborted=!0,r.dragActive&&(Ju.resetTabPositions(this.contentNode.children,this._orientation),r.override.dispose(),r.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging"),r.tab.classList.remove("p-mod-dragging"),this.removeClass("p-mod-dragging")))},e.prototype._adjustCurrentForInsert=function(r,i){var n=this.currentTitle,o=this._currentIndex,s=this.insertBehavior;if(s==="select-tab"||s==="select-tab-if-needed"&&o===-1){this._currentIndex=r,this._previousTitle=n,this._currentChanged.emit({previousIndex:o,previousTitle:n,currentIndex:r,currentTitle:i});return}o>=r&&this._currentIndex++},e.prototype._adjustCurrentForMove=function(r,i){this._currentIndex===r?this._currentIndex=i:this._currentIndex<r&&this._currentIndex>=i?this._currentIndex++:this._currentIndex>r&&this._currentIndex<=i&&this._currentIndex--},e.prototype._adjustCurrentForRemove=function(r,i){var n=this._currentIndex,o=this.removeBehavior;if(n!==r){n>r&&this._currentIndex--;return}if(this._titles.length===0){this._currentIndex=-1,this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:-1,currentTitle:null});return}if(o==="select-tab-after"){this._currentIndex=Math.min(r,this._titles.length-1),this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if(o==="select-tab-before"){this._currentIndex=Math.max(0,r-1),this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if(o==="select-previous-tab"){this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(r,this._titles.length-1),this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}this._currentIndex=-1,this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:-1,currentTitle:null})},e.prototype._onTitleChanged=function(r){this.update()},e}(Br);(function(t){var e=function(){function r(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap,this._uuid=++r._nInstance}return r.prototype.renderTab=function(i){var n=i.title.caption,o=this.createTabKey(i),s=o,l=this.createTabStyle(i),u=this.createTabClass(i),h=this.createTabDataset(i),v=this.createTabARIA(i);return i.title.closable?so.li(ol({id:s,key:o,className:u,title:n,style:l,dataset:h},v),this.renderIcon(i),this.renderLabel(i),this.renderCloseIcon(i)):so.li(ol({id:s,key:o,className:u,title:n,style:l,dataset:h},v),this.renderIcon(i),this.renderLabel(i))},r.prototype.renderIcon=function(i){var n=i.title,o=this.createIconClass(i);return typeof n.icon=="string"?so.div({className:o},n.iconLabel):so.div({className:o},n.icon,n.iconLabel)},r.prototype.renderLabel=function(i){return so.div({className:"lm-TabBar-tabLabel p-TabBar-tabLabel"},i.title.label)},r.prototype.renderCloseIcon=function(i){return so.div({className:"lm-TabBar-tabCloseIcon p-TabBar-tabCloseIcon"})},r.prototype.createTabKey=function(i){var n=this._tabKeys.get(i.title);return n===void 0&&(n="tab-key-"+this._uuid+"-"+this._tabID++,this._tabKeys.set(i.title,n)),n},r.prototype.createTabStyle=function(i){return{zIndex:""+i.zIndex}},r.prototype.createTabClass=function(i){var n="lm-TabBar-tab";return n+=" p-TabBar-tab",i.title.className&&(n+=" "+i.title.className),i.title.closable&&(n+=" lm-mod-closable",n+=" p-mod-closable"),i.current&&(n+=" lm-mod-current",n+=" p-mod-current"),n},r.prototype.createTabDataset=function(i){return i.title.dataset},r.prototype.createTabARIA=function(i){return{role:"tab","aria-selected":i.current.toString()}},r.prototype.createIconClass=function(i){var n="lm-TabBar-tabIcon";n+=" p-TabBar-tabIcon";var o=i.title.iconClass;return o?n+" "+o:n},r._nInstance=0,r}();t.Renderer=e,t.defaultRenderer=new e,t.addButtonSelector=".lm-TabBar-addButton"})(cv||(cv={}));var Ju;(function(t){t.DRAG_THRESHOLD=5,t.DETACH_THRESHOLD=20;function e(){var v=document.createElement("div"),T=document.createElement("ul");T.setAttribute("role","tablist"),T.className="lm-TabBar-content",T.classList.add("p-TabBar-content"),v.appendChild(T);var E=document.createElement("div");return E.className="lm-TabBar-addButton lm-mod-hidden",v.appendChild(E),v}t.createNode=e;function r(v){return v instanceof rk?v:new rk(v)}t.asTitle=r;function i(v){var T=window.getComputedStyle(v);return 1e3*(parseFloat(T.transitionDuration)||0)}t.parseTransitionDuration=i;function n(v,T){for(var E=new Array(v.length),M=0,O=v.length;M<O;++M){var F=v[M],z=window.getComputedStyle(F);T==="horizontal"?E[M]={pos:F.offsetLeft,size:F.offsetWidth,margin:parseFloat(z.marginLeft)||0}:E[M]={pos:F.offsetTop,size:F.offsetHeight,margin:parseFloat(z.marginTop)||0}}return E}t.snapTabLayout=n;function o(v,T){var E=Math.abs(T.clientX-v.pressX),M=Math.abs(T.clientY-v.pressY);return E>=t.DRAG_THRESHOLD||M>=t.DRAG_THRESHOLD}t.dragExceeded=o;function s(v,T){var E=v.contentRect;return T.clientX<E.left-t.DETACH_THRESHOLD||T.clientX>=E.right+t.DETACH_THRESHOLD||T.clientY<E.top-t.DETACH_THRESHOLD||T.clientY>=E.bottom+t.DETACH_THRESHOLD}t.detachExceeded=s;function l(v,T,E,M){var O,F,z,W;M==="horizontal"?(O=T.pressX,F=E.clientX-T.contentRect.left,z=E.clientX,W=T.contentRect.width):(O=T.pressY,F=E.clientY-T.contentRect.top,z=E.clientY,W=T.contentRect.height);for(var J=T.index,K=F-T.tabPressPos,ne=K+T.tabSize,ge=0,j=v.length;ge<j;++ge){var me=void 0,fe=T.tabLayout[ge],$=fe.pos+(fe.size>>1);if(ge<T.index&&K<$)me=T.tabSize+T.tabLayout[ge+1].margin+"px",J=Math.min(J,ge);else if(ge>T.index&&ne>$)me=-T.tabSize-fe.margin+"px",J=Math.max(J,ge);else if(ge===T.index){var Z=z-O,we=W-(T.tabPos+T.tabSize);me=Math.max(-T.tabPos,Math.min(Z,we))+"px"}else me="";M==="horizontal"?v[ge].style.left=me:v[ge].style.top=me}T.targetIndex=J}t.layoutTabs=l;function u(v,T){var E;T==="horizontal"?E=v.contentRect.width:E=v.contentRect.height;var M;if(v.targetIndex===v.index)M=0;else if(v.targetIndex>v.index){var O=v.tabLayout[v.targetIndex];M=O.pos+O.size-v.tabSize-v.tabPos}else{var O=v.tabLayout[v.targetIndex];M=O.pos-v.tabPos}var F=E-(v.tabPos+v.tabSize),z=Math.max(-v.tabPos,Math.min(M,F));T==="horizontal"?v.tab.style.left=z+"px":v.tab.style.top=z+"px"}t.finalizeTabPosition=u;function h(v,T){Ei(v,function(E){T==="horizontal"?E.style.left="":E.style.top=""})}t.resetTabPositions=h})(Ju||(Ju={}));var KMe=function(t){ks(e,t);function e(r){var i=t.call(this)||this;return i._spacing=4,i._dirty=!1,i._root=null,i._box=null,i._items=new Map,i.renderer=r.renderer,r.spacing!==void 0&&(i._spacing=Vw.clampDimension(r.spacing)),i._document=r.document||document,i._hiddenMode=r.hiddenMode!==void 0?r.hiddenMode:Br.HiddenMode.Display,i}return e.prototype.dispose=function(){var r=this.iter();this._items.forEach(function(i){i.dispose()}),this._box=null,this._root=null,this._items.clear(),Ei(r,function(i){i.dispose()}),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"hiddenMode",{get:function(){return this._hiddenMode},set:function(r){var i=this;this._hiddenMode!==r&&(this._hiddenMode=r,Ei(this.tabBars(),function(n){n.titles.length>1&&n.titles.forEach(function(o){o.owner.hiddenMode=i._hiddenMode})}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this._spacing},set:function(r){r=Vw.clampDimension(r),this._spacing!==r&&(this._spacing=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this._root===null},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return this._root?this._root.iterAllWidgets():su()},e.prototype.widgets=function(){return this._root?this._root.iterUserWidgets():su()},e.prototype.selectedWidgets=function(){return this._root?this._root.iterSelectedWidgets():su()},e.prototype.tabBars=function(){return this._root?this._root.iterTabBars():su()},e.prototype.handles=function(){return this._root?this._root.iterHandles():su()},e.prototype.moveHandle=function(r,i,n){var o=r.classList.contains("lm-mod-hidden");if(o=o||r.classList.contains("p-mod-hidden"),!(!this._root||o)){var s=this._root.findSplitNode(r);if(s){var l;s.node.orientation==="horizontal"?l=i-r.offsetLeft:l=n-r.offsetTop,l!==0&&(s.node.holdSizes(),lu.adjust(s.node.sizers,s.index,l),this.parent&&this.parent.update())}}},e.prototype.saveLayout=function(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}},e.prototype.restoreLayout=function(r){var i=this,n=new Set,o;r.main?o=Ea.normalizeAreaConfig(r.main,n):o=null;var s=this.widgets(),l=this.tabBars(),u=this.handles();this._root=null,Ei(s,function(h){n.has(h)||(h.parent=null)}),Ei(l,function(h){h.dispose()}),Ei(u,function(h){h.parentNode&&h.parentNode.removeChild(h)}),n.forEach(function(h){h.parent=i.parent}),o?this._root=Ea.realizeAreaConfig(o,{createTabBar:function(h){return i._createTabBar()},createHandle:function(){return i._createHandle()}},this._document):this._root=null,this.parent&&(n.forEach(function(h){i.attachWidget(h)}),this.parent.fit())},e.prototype.addWidget=function(r,i){i===void 0&&(i={});var n=i.ref||null,o=i.mode||"tab-after",s=null;if(this._root&&n&&(s=this._root.findTabNode(n)),n&&!s)throw new Error("Reference widget is not in the layout.");switch(r.parent=this.parent,o){case"tab-after":this._insertTab(r,n,s,!0);break;case"tab-before":this._insertTab(r,n,s,!1);break;case"split-top":this._insertSplit(r,n,s,"vertical",!1);break;case"split-left":this._insertSplit(r,n,s,"horizontal",!1);break;case"split-right":this._insertSplit(r,n,s,"horizontal",!0);break;case"split-bottom":this._insertSplit(r,n,s,"vertical",!0);break}this.parent&&(this.attachWidget(r),this.parent.fit())},e.prototype.removeWidget=function(r){this._removeWidget(r),this.parent&&(this.detachWidget(r),this.parent.fit())},e.prototype.hitTestTabAreas=function(r,i){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=ho.boxSizing(this.parent.node));var n=this.parent.node.getBoundingClientRect(),o=r-n.left-this._box.borderLeft,s=i-n.top-this._box.borderTop,l=this._root.hitTestTabNodes(o,s);if(!l)return null;var u=l.tabBar,h=l.top,v=l.left,T=l.width,E=l.height,M=this._box.borderLeft+this._box.borderRight,O=this._box.borderTop+this._box.borderBottom,F=n.width-M-(v+T),z=n.height-O-(h+E);return{tabBar:u,x:o,y:s,top:h,left:v,right:F,bottom:z,width:T,height:E}},e.prototype.init=function(){var r=this;t.prototype.init.call(this),Ei(this,function(i){r.attachWidget(i)}),Ei(this.handles(),function(i){r.parent.node.appendChild(i)}),this.parent.fit()},e.prototype.attachWidget=function(r){this.parent.node!==r.node.parentNode&&(this._items.set(r,new jw(r)),this.parent.isAttached&&xr.sendMessage(r,Br.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.isAttached&&xr.sendMessage(r,Br.Msg.AfterAttach))},e.prototype.detachWidget=function(r){if(this.parent.node===r.node.parentNode){this.parent.isAttached&&xr.sendMessage(r,Br.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&xr.sendMessage(r,Br.Msg.AfterDetach);var i=this._items.get(r);i&&(this._items.delete(r),i.dispose())}},e.prototype.onBeforeShow=function(r){t.prototype.onBeforeShow.call(this,r),this.parent.update()},e.prototype.onBeforeAttach=function(r){t.prototype.onBeforeAttach.call(this,r),this.parent.fit()},e.prototype.onChildShown=function(r){this.parent.fit()},e.prototype.onChildHidden=function(r){this.parent.fit()},e.prototype.onResize=function(r){this.parent.isVisible&&this._update(r.width,r.height)},e.prototype.onUpdateRequest=function(r){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(r){this.parent.isAttached&&this._fit()},e.prototype._removeWidget=function(r){if(this._root){var i=this._root.findTabNode(r);if(i){if(Ea.removeAria(r),i.tabBar.titles.length>1){if(i.tabBar.removeTab(r.title),this._hiddenMode===Br.HiddenMode.Scale&&i.tabBar.titles.length==1){var n=i.tabBar.titles[0].owner;n.hiddenMode=Br.HiddenMode.Display}return}if(i.tabBar.dispose(),this._root===i){this._root=null;return}this._root.holdAllSizes();var o=i.parent;i.parent=null;var s=rr.removeFirstOf(o.children,i),l=rr.removeAt(o.handles,s);if(rr.removeAt(o.sizers,s),l.parentNode&&l.parentNode.removeChild(l),o.children.length>1){o.syncHandles();return}var u=o.parent;o.parent=null;var h=o.children[0],v=o.handles[0];if(o.children.length=0,o.handles.length=0,o.sizers.length=0,v.parentNode&&v.parentNode.removeChild(v),this._root===o){h.parent=null,this._root=h;return}var T=u,E=T.children.indexOf(o);if(h instanceof Ea.TabLayoutNode){h.parent=T,T.children[E]=h;return}var M=rr.removeAt(T.handles,E);rr.removeAt(T.children,E),rr.removeAt(T.sizers,E),M.parentNode&&M.parentNode.removeChild(M);for(var O=0,F=h.children.length;O<F;++O){var z=h.children[O],W=h.handles[O],J=h.sizers[O];rr.insert(T.children,E+O,z),rr.insert(T.handles,E+O,W),rr.insert(T.sizers,E+O,J),z.parent=T}h.children.length=0,h.handles.length=0,h.sizers.length=0,h.parent=null,T.syncHandles()}}},e.prototype._insertTab=function(r,i,n,o){if(r!==i){if(!this._root){var s=new Ea.TabLayoutNode(this._createTabBar());s.tabBar.addTab(r.title),this._root=s,Ea.addAria(r,s.tabBar);return}n||(n=this._root.findFirstTabNode()),n.tabBar.titles.indexOf(r.title)===-1&&(this._removeWidget(r),r.hide());var l;if(i?l=n.tabBar.titles.indexOf(i.title):l=n.tabBar.currentIndex,this._hiddenMode===Br.HiddenMode.Scale)if(n.tabBar.titles.length===0)r.hiddenMode=Br.HiddenMode.Display;else if(n.tabBar.titles.length==1){var u=n.tabBar.titles[0].owner;u.hiddenMode=Br.HiddenMode.Scale}else r.hiddenMode=Br.HiddenMode.Scale;else r.hiddenMode=this._hiddenMode;n.tabBar.insertTab(l+(o?1:0),r.title),Ea.addAria(r,n.tabBar)}},e.prototype._insertSplit=function(r,i,n,o,s){if(!(r===i&&n&&n.tabBar.titles.length===1)){this._removeWidget(r);var l=new Ea.TabLayoutNode(this._createTabBar());if(l.tabBar.addTab(r.title),Ea.addAria(r,l.tabBar),!this._root){this._root=l;return}if(!n||!n.parent){var u=this._splitRoot(o),h=s?u.children.length:0;u.normalizeSizes();var v=Ea.createSizer(n?1:Ea.GOLDEN_RATIO);rr.insert(u.children,h,l),rr.insert(u.sizers,h,v),rr.insert(u.handles,h,this._createHandle()),l.parent=u,u.normalizeSizes(),u.syncHandles();return}var T=n.parent;if(T.orientation===o){var E=T.children.indexOf(n);T.normalizeSizes();var M=T.sizers[E].sizeHint/=2,O=E+(s?1:0);rr.insert(T.children,O,l),rr.insert(T.sizers,O,Ea.createSizer(M)),rr.insert(T.handles,O,this._createHandle()),l.parent=T,T.syncHandles();return}var F=rr.removeFirstOf(T.children,n),z=new Ea.SplitLayoutNode(o);z.normalized=!0,z.children.push(n),z.sizers.push(Ea.createSizer(.5)),z.handles.push(this._createHandle()),n.parent=z;var W=s?1:0;rr.insert(z.children,W,l),rr.insert(z.sizers,W,Ea.createSizer(.5)),rr.insert(z.handles,W,this._createHandle()),l.parent=z,z.syncHandles(),rr.insert(T.children,F,z),z.parent=T}},e.prototype._splitRoot=function(r){var i=this._root;if(i instanceof Ea.SplitLayoutNode&&i.orientation===r)return i;var n=this._root=new Ea.SplitLayoutNode(r);return i&&(n.children.push(i),n.sizers.push(Ea.createSizer(0)),n.handles.push(this._createHandle()),i.parent=n),n},e.prototype._fit=function(){var r=0,i=0;if(this._root){var n=this._root.fit(this._spacing,this._items);r=n.minWidth,i=n.minHeight}var o=this._box=ho.boxSizing(this.parent.node);r+=o.horizontalSum,i+=o.verticalSum;var s=this.parent.node.style;s.minWidth=r+"px",s.minHeight=i+"px",this._dirty=!0,this.parent.parent&&xr.sendMessage(this.parent.parent,Br.Msg.FitRequest),this._dirty&&xr.sendMessage(this.parent,Br.Msg.UpdateRequest)},e.prototype._update=function(r,i){if(this._dirty=!1,!!this._root){r<0&&(r=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=ho.boxSizing(this.parent.node));var n=this._box.paddingTop,o=this._box.paddingLeft,s=r-this._box.horizontalSum,l=i-this._box.verticalSum;this._root.update(n,o,s,l,this._spacing,this._items)}},e.prototype._createTabBar=function(){var r=this.renderer.createTabBar(this._document);return r.orientation="horizontal",this.parent&&(r.parent=this.parent,this.attachWidget(r)),r},e.prototype._createHandle=function(){var r=this.renderer.createHandle(),i=r.style;return i.position="absolute",i.top="0",i.left="0",i.width="0",i.height="0",this.parent&&this.parent.node.appendChild(r),r},e}(CA),Ea;(function(t){t.GOLDEN_RATIO=.618;function e(E){var M=new SA;return M.sizeHint=E,M.size=E,M}t.createSizer=e;function r(E,M){var O;return E.type==="tab-area"?O=u(E,M):O=h(E,M),O}t.normalizeAreaConfig=r;function i(E,M,O){var F;return E.type==="tab-area"?F=v(E,M,O):F=T(E,M,O),F}t.realizeAreaConfig=i;var n=function(){function E(M){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;var O=new SA,F=new SA;O.stretch=0,F.stretch=1,this.tabBar=M,this.sizers=[O,F]}return Object.defineProperty(E.prototype,"top",{get:function(){return this._top},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"left",{get:function(){return this._left},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),E.prototype.iterAllWidgets=function(){return q4(Uw(this.tabBar),this.iterUserWidgets())},E.prototype.iterUserWidgets=function(){return bA(this.tabBar.titles,function(M){return M.owner})},E.prototype.iterSelectedWidgets=function(){var M=this.tabBar.currentTitle;return M?Uw(M.owner):su()},E.prototype.iterTabBars=function(){return Uw(this.tabBar)},E.prototype.iterHandles=function(){return su()},E.prototype.findTabNode=function(M){return this.tabBar.titles.indexOf(M.title)!==-1?this:null},E.prototype.findSplitNode=function(M){return null},E.prototype.findFirstTabNode=function(){return this},E.prototype.hitTestTabNodes=function(M,O){return M<this._left||M>=this._left+this._width||O<this._top||O>=this._top+this._height?null:this},E.prototype.createConfig=function(){var M=this.tabBar.titles.map(function(F){return F.owner}),O=this.tabBar.currentIndex;return{type:"tab-area",widgets:M,currentIndex:O}},E.prototype.holdAllSizes=function(){},E.prototype.fit=function(M,O){var F=0,z=0,W=1/0,J=1/0,K=O.get(this.tabBar),ne=this.tabBar.currentTitle,ge=ne?O.get(ne.owner):void 0,j=this.sizers,me=j[0],fe=j[1];return K&&K.fit(),ge&&ge.fit(),K&&!K.isHidden?(F=Math.max(F,K.minWidth),z+=K.minHeight,me.minSize=K.minHeight,me.maxSize=K.maxHeight):(me.minSize=0,me.maxSize=0),ge&&!ge.isHidden?(F=Math.max(F,ge.minWidth),z+=ge.minHeight,fe.minSize=ge.minHeight,fe.maxSize=1/0):(fe.minSize=0,fe.maxSize=1/0),{minWidth:F,minHeight:z,maxWidth:W,maxHeight:J}},E.prototype.update=function(M,O,F,z,W,J){this._top=O,this._left=M,this._width=F,this._height=z;var K=J.get(this.tabBar),ne=this.tabBar.currentTitle,ge=ne?J.get(ne.owner):void 0;if(lu.calc(this.sizers,z),K&&!K.isHidden){var j=this.sizers[0].size;K.update(M,O,F,j),O+=j}if(ge&&!ge.isHidden){var j=this.sizers[1].size;ge.update(M,O,F,j)}},E}();t.TabLayoutNode=n;var o=function(){function E(M){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=M}return E.prototype.iterAllWidgets=function(){var M=bA(this.children,function(O){return O.iterAllWidgets()});return new Hg(M)},E.prototype.iterUserWidgets=function(){var M=bA(this.children,function(O){return O.iterUserWidgets()});return new Hg(M)},E.prototype.iterSelectedWidgets=function(){var M=bA(this.children,function(O){return O.iterSelectedWidgets()});return new Hg(M)},E.prototype.iterTabBars=function(){var M=bA(this.children,function(O){return O.iterTabBars()});return new Hg(M)},E.prototype.iterHandles=function(){var M=bA(this.children,function(O){return O.iterHandles()});return q4(this.handles,new Hg(M))},E.prototype.findTabNode=function(M){for(var O=0,F=this.children.length;O<F;++O){var z=this.children[O].findTabNode(M);if(z)return z}return null},E.prototype.findSplitNode=function(M){var O=this.handles.indexOf(M);if(O!==-1)return{index:O,node:this};for(var F=0,z=this.children.length;F<z;++F){var W=this.children[F].findSplitNode(M);if(W)return W}return null},E.prototype.findFirstTabNode=function(){return this.children.length===0?null:this.children[0].findFirstTabNode()},E.prototype.hitTestTabNodes=function(M,O){for(var F=0,z=this.children.length;F<z;++F){var W=this.children[F].hitTestTabNodes(M,O);if(W)return W}return null},E.prototype.createConfig=function(){var M=this.orientation,O=this.createNormalizedSizes(),F=this.children.map(function(z){return z.createConfig()});return{type:"split-area",orientation:M,children:F,sizes:O}},E.prototype.syncHandles=function(){var M=this;Ei(this.handles,function(O,F){O.setAttribute("data-orientation",M.orientation),F===M.handles.length-1?(O.classList.add("lm-mod-hidden"),O.classList.add("p-mod-hidden")):(O.classList.remove("lm-mod-hidden"),O.classList.remove("p-mod-hidden"))})},E.prototype.holdSizes=function(){Ei(this.sizers,function(M){M.sizeHint=M.size})},E.prototype.holdAllSizes=function(){Ei(this.children,function(M){return M.holdAllSizes()}),this.holdSizes()},E.prototype.normalizeSizes=function(){var M=this.sizers.length;if(M!==0){this.holdSizes();var O=X4(this.sizers,function(F,z){return F+z.sizeHint},0);O===0?Ei(this.sizers,function(F){F.size=F.sizeHint=1/M}):Ei(this.sizers,function(F){F.size=F.sizeHint/=O}),this.normalized=!0}},E.prototype.createNormalizedSizes=function(){var M=this.sizers.length;if(M===0)return[];var O=this.sizers.map(function(z){return z.size}),F=X4(O,function(z,W){return z+W},0);return F===0?Ei(O,function(z,W){O[W]=1/M}):Ei(O,function(z,W){O[W]=z/F}),O},E.prototype.fit=function(M,O){for(var F=this.orientation==="horizontal",z=Math.max(0,this.children.length-1)*M,W=F?z:0,J=F?0:z,K=1/0,ne=1/0,ge=0,j=this.children.length;ge<j;++ge){var me=this.children[ge].fit(M,O);F?(J=Math.max(J,me.minHeight),W+=me.minWidth,this.sizers[ge].minSize=me.minWidth):(W=Math.max(W,me.minWidth),J+=me.minHeight,this.sizers[ge].minSize=me.minHeight)}return{minWidth:W,minHeight:J,maxWidth:K,maxHeight:ne}},E.prototype.update=function(M,O,F,z,W,J){var K=this.orientation==="horizontal",ne=Math.max(0,this.children.length-1)*W,ge=Math.max(0,(K?F:z)-ne);this.normalized&&(Ei(this.sizers,function(we){we.sizeHint*=ge}),this.normalized=!1),lu.calc(this.sizers,ge);for(var j=0,me=this.children.length;j<me;++j){var fe=this.children[j],$=this.sizers[j].size,Z=this.handles[j].style;K?(fe.update(M,O,$,z,W,J),M+=$,Z.top=O+"px",Z.left=M+"px",Z.width=W+"px",Z.height=z+"px",M+=W):(fe.update(M,O,F,$,W,J),O+=$,Z.top=O+"px",Z.left=M+"px",Z.width=F+"px",Z.height=W+"px",O+=W)}},E}();t.SplitLayoutNode=o;function s(E,M){E.node.setAttribute("role","tabpanel");var O=M.renderer;if(O instanceof cv.Renderer){var F=O.createTabKey({title:E.title,current:!1,zIndex:0});E.node.setAttribute("aria-labelledby",F)}}t.addAria=s;function l(E){E.node.removeAttribute("role"),E.node.removeAttribute("aria-labelledby")}t.removeAria=l;function u(E,M){if(E.widgets.length===0)return null;var O=[];if(Ei(E.widgets,function(z){M.has(z)||(M.add(z),O.push(z))}),O.length===0)return null;var F=E.currentIndex;return F!==-1&&(F<0||F>=O.length)&&(F=0),{type:"tab-area",widgets:O,currentIndex:F}}function h(E,M){for(var O=E.orientation,F=[],z=[],W=0,J=E.children.length;W<J;++W){var K=r(E.children[W],M);K&&(K.type==="tab-area"||K.orientation!==O?(F.push(K),z.push(Math.abs(E.sizes[W]||0))):(F.push.apply(F,K.children),z.push.apply(z,K.sizes)))}return F.length===0?null:F.length===1?F[0]:{type:"split-area",orientation:O,children:F,sizes:z}}function v(E,M,O){var F=M.createTabBar(O);return Ei(E.widgets,function(z){z.hide(),F.addTab(z.title),t.addAria(z,F)}),F.currentIndex=E.currentIndex,new n(F)}function T(E,M,O){var F=new o(E.orientation);return Ei(E.children,function(z,W){var J=i(z,M,O),K=e(E.sizes[W]),ne=M.createHandle();F.children.push(J),F.handles.push(ne),F.sizers.push(K),J.parent=F}),F.syncHandles(),F.normalizeSizes(),F}})(Ea||(Ea={}));var zee=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this)||this;i._drag=null,i._tabsMovable=!0,i._tabsConstrained=!1,i._addButtonEnabled=!1,i._pressData=null,i._layoutModified=new Wn(i),i._addRequested=new Wn(i),i.addClass("lm-DockPanel"),i.addClass("p-DockPanel"),i._document=r.document||document,i._mode=r.mode||"multiple-document",i._renderer=r.renderer||e.defaultRenderer,i._edges=r.edges||Qs.DEFAULT_EDGES,r.tabsMovable!==void 0&&(i._tabsMovable=r.tabsMovable),r.tabsConstrained!==void 0&&(i._tabsConstrained=r.tabsConstrained),r.addButtonEnabled!==void 0&&(i._addButtonEnabled=r.addButtonEnabled),i.dataset.mode=i._mode;var n={createTabBar:function(){return i._createTabBar()},createHandle:function(){return i._createHandle()}};return i.layout=new KMe({document:i._document,renderer:n,spacing:r.spacing,hiddenMode:r.hiddenMode}),i.overlay=r.overlay||new e.Overlay,i.node.appendChild(i.overlay.node),i}return e.prototype.dispose=function(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"hiddenMode",{get:function(){return this.layout.hiddenMode},set:function(r){this.layout.hiddenMode=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"layoutModified",{get:function(){return this._layoutModified},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addRequested",{get:function(){return this._addRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderer",{get:function(){return this.layout.renderer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this.layout.spacing},set:function(r){this.layout.spacing=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._mode},set:function(r){if(this._mode!==r){this._mode=r,this.dataset.mode=r;var i=this.layout;switch(r){case"multiple-document":Ei(i.tabBars(),function(n){n.show()});break;case"single-document":i.restoreLayout(Qs.createSingleDocumentConfig(this));break;default:throw"unreachable"}xr.postMessage(this,Qs.LayoutModified)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabsMovable",{get:function(){return this._tabsMovable},set:function(r){this._tabsMovable=r,Ei(this.tabBars(),function(i){i.tabsMovable=r})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabsConstrained",{get:function(){return this._tabsConstrained},set:function(r){this._tabsConstrained=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addButtonEnabled",{get:function(){return this._addButtonEnabled},set:function(r){this._addButtonEnabled=r,Ei(this.tabBars(),function(i){i.addButtonEnabled=r})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.layout.isEmpty},enumerable:!0,configurable:!0}),e.prototype.widgets=function(){return this.layout.widgets()},e.prototype.selectedWidgets=function(){return this.layout.selectedWidgets()},e.prototype.tabBars=function(){return this.layout.tabBars()},e.prototype.handles=function(){return this.layout.handles()},e.prototype.selectWidget=function(r){var i=rv(this.tabBars(),function(n){return n.titles.indexOf(r.title)!==-1});if(!i)throw new Error("Widget is not contained in the dock panel.");i.currentTitle=r.title},e.prototype.activateWidget=function(r){this.selectWidget(r),r.activate()},e.prototype.saveLayout=function(){return this.layout.saveLayout()},e.prototype.restoreLayout=function(r){this._mode="multiple-document",this.layout.restoreLayout(r),(nl.IS_EDGE||nl.IS_IE)&&xr.flush(),xr.postMessage(this,Qs.LayoutModified)},e.prototype.addWidget=function(r,i){i===void 0&&(i={}),this._mode==="single-document"?this.layout.addWidget(r):this.layout.addWidget(r,i),xr.postMessage(this,Qs.LayoutModified)},e.prototype.processMessage=function(r){r.type==="layout-modified"?this._layoutModified.emit(void 0):t.prototype.processMessage.call(this,r)},e.prototype.handleEvent=function(r){switch(r.type){case"lm-dragenter":this._evtDragEnter(r);break;case"lm-dragleave":this._evtDragLeave(r);break;case"lm-dragover":this._evtDragOver(r);break;case"lm-drop":this._evtDrop(r);break;case"mousedown":this._evtMouseDown(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseup":this._evtMouseUp(r);break;case"pointerdown":this._evtMouseDown(r);break;case"pointermove":this._evtMouseMove(r);break;case"pointerup":this._evtMouseUp(r);break;case"keydown":this._evtKeyDown(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("pointerdown",this)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()},e.prototype.onChildAdded=function(r){Qs.isGeneratedTabBarProperty.get(r.child)||(r.child.addClass("lm-DockPanel-widget"),r.child.addClass("p-DockPanel-widget"))},e.prototype.onChildRemoved=function(r){Qs.isGeneratedTabBarProperty.get(r.child)||(r.child.removeClass("lm-DockPanel-widget"),r.child.removeClass("p-DockPanel-widget"),xr.postMessage(this,Qs.LayoutModified))},e.prototype._evtDragEnter=function(r){r.mimeData.hasData("application/vnd.lumino.widget-factory")&&(r.preventDefault(),r.stopPropagation())},e.prototype._evtDragLeave=function(r){r.preventDefault(),!(this._tabsConstrained&&r.source!==this)&&(r.stopPropagation(),this.overlay.hide(1))},e.prototype._evtDragOver=function(r){r.preventDefault(),this._tabsConstrained&&r.source!==this||this._showOverlay(r.clientX,r.clientY)==="invalid"?r.dropAction="none":(r.stopPropagation(),r.dropAction=r.proposedAction)},e.prototype._evtDrop=function(r){if(r.preventDefault(),this.overlay.hide(0),r.proposedAction==="none"){r.dropAction="none";return}var i=r.clientX,n=r.clientY,o=Qs.findDropTarget(this,i,n,this._edges),s=o.zone,l=o.target;if(this._tabsConstrained&&r.source!==this||s==="invalid"){r.dropAction="none";return}var u=r.mimeData,h=u.getData("application/vnd.lumino.widget-factory");if(typeof h!="function"){r.dropAction="none";return}var v=h();if(!(v instanceof Br)){r.dropAction="none";return}if(v.contains(this)){r.dropAction="none";return}var T=l?Qs.getDropRef(l.tabBar):null;switch(s){case"root-all":this.addWidget(v);break;case"root-top":this.addWidget(v,{mode:"split-top"});break;case"root-left":this.addWidget(v,{mode:"split-left"});break;case"root-right":this.addWidget(v,{mode:"split-right"});break;case"root-bottom":this.addWidget(v,{mode:"split-bottom"});break;case"widget-all":this.addWidget(v,{mode:"tab-after",ref:T});break;case"widget-top":this.addWidget(v,{mode:"split-top",ref:T});break;case"widget-left":this.addWidget(v,{mode:"split-left",ref:T});break;case"widget-right":this.addWidget(v,{mode:"split-right",ref:T});break;case"widget-bottom":this.addWidget(v,{mode:"split-bottom",ref:T});break;case"widget-tab":this.addWidget(v,{mode:"tab-after",ref:T});break;default:throw"unreachable"}r.dropAction=r.proposedAction,r.stopPropagation(),this.activateWidget(v)},e.prototype._evtKeyDown=function(r){r.preventDefault(),r.stopPropagation(),r.keyCode===27&&(this._releaseMouse(),xr.postMessage(this,Qs.LayoutModified))},e.prototype._evtMouseDown=function(r){if(r.button===0){var i=this.layout,n=r.target,o=rv(i.handles(),function(T){return T.contains(n)});if(o){r.preventDefault(),r.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("mouseup",this,!0),this._document.addEventListener("mousemove",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);var s=o.getBoundingClientRect(),l=r.clientX-s.left,u=r.clientY-s.top,h=window.getComputedStyle(o),v=TA.overrideCursor(h.cursor,this._document);this._pressData={handle:o,deltaX:l,deltaY:u,override:v}}}},e.prototype._evtMouseMove=function(r){if(this._pressData){r.preventDefault(),r.stopPropagation();var i=this.node.getBoundingClientRect(),n=r.clientX-i.left-this._pressData.deltaX,o=r.clientY-i.top-this._pressData.deltaY,s=this.layout;s.moveHandle(this._pressData.handle,n,o)}},e.prototype._evtMouseUp=function(r){r.button===0&&(r.preventDefault(),r.stopPropagation(),this._releaseMouse(),xr.postMessage(this,Qs.LayoutModified))},e.prototype._releaseMouse=function(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("mouseup",this,!0),this._document.removeEventListener("mousemove",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))},e.prototype._showOverlay=function(r,i){var n=Qs.findDropTarget(this,r,i,this._edges),o=n.zone,s=n.target;if(o==="invalid")return this.overlay.hide(100),o;var l,u,h,v,T=ho.boxSizing(this.node),E=this.node.getBoundingClientRect();switch(o){case"root-all":l=T.paddingTop,u=T.paddingLeft,h=T.paddingRight,v=T.paddingBottom;break;case"root-top":l=T.paddingTop,u=T.paddingLeft,h=T.paddingRight,v=E.height*Qs.GOLDEN_RATIO;break;case"root-left":l=T.paddingTop,u=T.paddingLeft,h=E.width*Qs.GOLDEN_RATIO,v=T.paddingBottom;break;case"root-right":l=T.paddingTop,u=E.width*Qs.GOLDEN_RATIO,h=T.paddingRight,v=T.paddingBottom;break;case"root-bottom":l=E.height*Qs.GOLDEN_RATIO,u=T.paddingLeft,h=T.paddingRight,v=T.paddingBottom;break;case"widget-all":l=s.top,u=s.left,h=s.right,v=s.bottom;break;case"widget-top":l=s.top,u=s.left,h=s.right,v=s.bottom+s.height/2;break;case"widget-left":l=s.top,u=s.left,h=s.right+s.width/2,v=s.bottom;break;case"widget-right":l=s.top,u=s.left+s.width/2,h=s.right,v=s.bottom;break;case"widget-bottom":l=s.top+s.height/2,u=s.left,h=s.right,v=s.bottom;break;case"widget-tab":var M=s.tabBar.node.getBoundingClientRect().height;l=s.top,u=s.left,h=s.right,v=s.bottom+s.height-M;break;default:throw"unreachable"}return this.overlay.show({top:l,left:u,right:h,bottom:v}),o},e.prototype._createTabBar=function(){var r=this._renderer.createTabBar(this._document);return Qs.isGeneratedTabBarProperty.set(r,!0),this._mode==="single-document"&&r.hide(),r.tabsMovable=this._tabsMovable,r.allowDeselect=!1,r.addButtonEnabled=this._addButtonEnabled,r.removeBehavior="select-previous-tab",r.insertBehavior="select-tab-if-needed",r.tabMoved.connect(this._onTabMoved,this),r.currentChanged.connect(this._onCurrentChanged,this),r.tabCloseRequested.connect(this._onTabCloseRequested,this),r.tabDetachRequested.connect(this._onTabDetachRequested,this),r.tabActivateRequested.connect(this._onTabActivateRequested,this),r.addRequested.connect(this._onTabAddRequested,this),r},e.prototype._createHandle=function(){return this._renderer.createHandle()},e.prototype._onTabMoved=function(){xr.postMessage(this,Qs.LayoutModified)},e.prototype._onCurrentChanged=function(r,i){var n=i.previousTitle,o=i.currentTitle;n&&n.owner.hide(),o&&o.owner.show(),(nl.IS_EDGE||nl.IS_IE)&&xr.flush(),xr.postMessage(this,Qs.LayoutModified)},e.prototype._onTabAddRequested=function(r){this._addRequested.emit(r)},e.prototype._onTabActivateRequested=function(r,i){i.title.owner.activate()},e.prototype._onTabCloseRequested=function(r,i){i.title.owner.close()},e.prototype._onTabDetachRequested=function(r,i){var n=this;if(!this._drag){r.releaseMouse();var o=i.title,s=i.tab,l=i.clientX,u=i.clientY,h=new qg.MimeData,v=function(){return o.owner};h.setData("application/vnd.lumino.widget-factory",v);var T=s.cloneNode(!0);this._drag=new TA({document:this._document,mimeData:h,dragImage:T,proposedAction:"move",supportedActions:"move",source:this}),s.classList.add("lm-mod-hidden"),s.classList.add("p-mod-hidden");var E=function(){n._drag=null,s.classList.remove("lm-mod-hidden"),s.classList.remove("p-mod-hidden")};this._drag.start(l,u).then(E)}},e}(Br);(function(t){var e=function(){function i(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.classList.add("p-DockPanel-overlay"),this.node.classList.add("p-mod-hidden"),this.node.style.position="absolute"}return i.prototype.show=function(n){var o=this.node.style;o.top=n.top+"px",o.left=n.left+"px",o.right=n.right+"px",o.bottom=n.bottom+"px",clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"),this.node.classList.remove("p-mod-hidden"))},i.prototype.hide=function(n){var o=this;if(!this._hidden){if(n<=0){clearTimeout(this._timer),this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden"),this.node.classList.add("p-mod-hidden");return}this._timer===-1&&(this._timer=window.setTimeout(function(){o._timer=-1,o._hidden=!0,o.node.classList.add("lm-mod-hidden"),o.node.classList.add("p-mod-hidden")},n))}},i}();t.Overlay=e;var r=function(){function i(){}return i.prototype.createTabBar=function(n){var o=new cv({document:n});return o.addClass("lm-DockPanel-tabBar"),o.addClass("p-DockPanel-tabBar"),o},i.prototype.createHandle=function(){var n=document.createElement("div");return n.className="lm-DockPanel-handle",n.classList.add("p-DockPanel-handle"),n},i}();t.Renderer=r,t.defaultRenderer=new r})(zee||(zee={}));var Qs;(function(t){t.GOLDEN_RATIO=.618,t.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},t.LayoutModified=new iv("layout-modified"),t.isGeneratedTabBarProperty=new lc({name:"isGeneratedTabBar",create:function(){return!1}});function e(n){if(n.isEmpty)return{main:null};var o=Pee(n.widgets()),s=n.selectedWidgets().next(),l=s?o.indexOf(s):-1;return{main:{type:"tab-area",widgets:o,currentIndex:l}}}t.createSingleDocumentConfig=e;function r(n,o,s,l){if(!ho.hitTest(n.node,o,s))return{zone:"invalid",target:null};var u=n.layout;if(u.isEmpty)return{zone:"root-all",target:null};if(n.mode==="multiple-document"){var h=n.node.getBoundingClientRect(),v=o-h.left+1,T=s-h.top+1,E=h.right-o,M=h.bottom-s,O=Math.min(T,E,M,v);switch(O){case T:if(T<l.top)return{zone:"root-top",target:null};break;case E:if(E<l.right)return{zone:"root-right",target:null};break;case M:if(M<l.bottom)return{zone:"root-bottom",target:null};break;case v:if(v<l.left)return{zone:"root-left",target:null};break;default:throw"unreachable"}}var F=u.hitTestTabAreas(o,s);if(!F)return{zone:"invalid",target:null};if(n.mode==="single-document")return{zone:"widget-all",target:F};var z=F.x-F.left+1,W=F.y-F.top+1,J=F.left+F.width-F.x,K=F.top+F.height-F.y,ne=F.tabBar.node.getBoundingClientRect().height;if(W<ne)return{zone:"widget-tab",target:F};var ge=Math.round(F.width/3),j=Math.round(F.height/3);if(z>ge&&J>ge&&W>j&&K>j)return{zone:"widget-all",target:F};z/=ge,W/=j,J/=ge,K/=j;var me=Math.min(z,W,J,K),fe;switch(me){case z:fe="widget-left";break;case W:fe="widget-top";break;case J:fe="widget-right";break;case K:fe="widget-bottom";break;default:throw"unreachable"}return{zone:fe,target:F}}t.findDropTarget=r;function i(n){return n.titles.length===0?null:n.currentTitle?n.currentTitle.owner:n.titles[n.titles.length-1].owner}t.getDropRef=i})(Qs||(Qs={}));var GTt=function(){function t(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new Wn(this),this._currentChanged=new Wn(this)}return t.prototype.dispose=function(){var e=this;this._counter<0||(this._counter=-1,Wn.clearData(this),Ei(this._widgets,function(r){r.node.removeEventListener("focus",e,!0),r.node.removeEventListener("blur",e,!0)}),this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0)},Object.defineProperty(t.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activeChanged",{get:function(){return this._activeChanged},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._counter<0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentWidget",{get:function(){return this._currentWidget},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activeWidget",{get:function(){return this._activeWidget},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"widgets",{get:function(){return this._widgets},enumerable:!0,configurable:!0}),t.prototype.focusNumber=function(e){var r=this._numbers.get(e);return r===void 0?-1:r},t.prototype.has=function(e){return this._numbers.has(e)},t.prototype.add=function(e){if(!this._numbers.has(e)){var r=e.node.contains(document.activeElement),i=r?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,i),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),r&&this._setWidgets(e,e)}},t.prototype.remove=function(e){var r=this;if(this._numbers.has(e)&&(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),rr.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget===e)){var i=Ree(this._widgets,function(o){return r._numbers.get(o)!==-1}),n=Bee(i,function(o,s){var l=r._numbers.get(o),u=r._numbers.get(s);return l-u})||null;this._setWidgets(n,null)}},t.prototype.handleEvent=function(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e);break}},t.prototype._setWidgets=function(e,r){var i=this._currentWidget;this._currentWidget=e;var n=this._activeWidget;this._activeWidget=r,i!==e&&this._currentChanged.emit({oldValue:i,newValue:e}),n!==r&&this._activeChanged.emit({oldValue:n,newValue:r})},t.prototype._evtFocus=function(e){var r=this._nodes.get(e.currentTarget);r!==this._currentWidget&&this._numbers.set(r,this._counter++),this._setWidgets(r,r)},t.prototype._evtBlur=function(e){var r=this._nodes.get(e.currentTarget),i=e.relatedTarget;if(!i){this._setWidgets(this._currentWidget,null);return}if(!r.node.contains(i)&&!rv(this._widgets,function(n){return n.node.contains(i)})){this._setWidgets(this._currentWidget,null);return}},t.prototype._onWidgetDisposed=function(e){this.remove(e)},t}(),lk=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,r)||this;return i._dirty=!1,i._rowSpacing=4,i._columnSpacing=4,i._items=[],i._rowStarts=[],i._columnStarts=[],i._rowSizers=[new SA],i._columnSizers=[new SA],i._box=null,r.rowCount!==void 0&&ka.reallocSizers(i._rowSizers,r.rowCount),r.columnCount!==void 0&&ka.reallocSizers(i._columnSizers,r.columnCount),r.rowSpacing!==void 0&&(i._rowSpacing=ka.clampValue(r.rowSpacing)),r.columnSpacing!==void 0&&(i._columnSpacing=ka.clampValue(r.columnSpacing)),i}return e.prototype.dispose=function(){Ei(this._items,function(r){var i=r.widget;r.dispose(),i.dispose()}),this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"rowCount",{get:function(){return this._rowSizers.length},set:function(r){r!==this.rowCount&&(ka.reallocSizers(this._rowSizers,r),this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnCount",{get:function(){return this._columnSizers.length},set:function(r){r!==this.columnCount&&(ka.reallocSizers(this._columnSizers,r),this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowSpacing",{get:function(){return this._rowSpacing},set:function(r){r=ka.clampValue(r),this._rowSpacing!==r&&(this._rowSpacing=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnSpacing",{get:function(){return this._columnSpacing},set:function(r){r=ka.clampValue(r),this._columnSpacing!==r&&(this._columnSpacing=r,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),e.prototype.rowStretch=function(r){var i=this._rowSizers[r];return i?i.stretch:-1},e.prototype.setRowStretch=function(r,i){var n=this._rowSizers[r];n&&(i=ka.clampValue(i),n.stretch!==i&&(n.stretch=i,this.parent&&this.parent.update()))},e.prototype.columnStretch=function(r){var i=this._columnSizers[r];return i?i.stretch:-1},e.prototype.setColumnStretch=function(r,i){var n=this._columnSizers[r];n&&(i=ka.clampValue(i),n.stretch!==i&&(n.stretch=i,this.parent&&this.parent.update()))},e.prototype.iter=function(){return bA(this._items,function(r){return r.widget})},e.prototype.addWidget=function(r){var i=rr.findFirstIndex(this._items,function(n){return n.widget===r});i===-1&&(this._items.push(new jw(r)),this.parent&&this.attachWidget(r))},e.prototype.removeWidget=function(r){var i=rr.findFirstIndex(this._items,function(o){return o.widget===r});if(i!==-1){var n=rr.removeAt(this._items,i);this.parent&&this.detachWidget(r),n.dispose()}},e.prototype.init=function(){var r=this;t.prototype.init.call(this),Ei(this,function(i){r.attachWidget(i)})},e.prototype.attachWidget=function(r){this.parent.isAttached&&xr.sendMessage(r,Br.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.isAttached&&xr.sendMessage(r,Br.Msg.AfterAttach),this.parent.fit()},e.prototype.detachWidget=function(r){this.parent.isAttached&&xr.sendMessage(r,Br.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&xr.sendMessage(r,Br.Msg.AfterDetach),this.parent.fit()},e.prototype.onBeforeShow=function(r){t.prototype.onBeforeShow.call(this,r),this.parent.update()},e.prototype.onBeforeAttach=function(r){t.prototype.onBeforeAttach.call(this,r),this.parent.fit()},e.prototype.onChildShown=function(r){this.parent.fit()},e.prototype.onChildHidden=function(r){this.parent.fit()},e.prototype.onResize=function(r){this.parent.isVisible&&this._update(r.width,r.height)},e.prototype.onUpdateRequest=function(r){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(r){this.parent.isAttached&&this._fit()},e.prototype._fit=function(){for(var r=0,i=this.rowCount;r<i;++r)this._rowSizers[r].minSize=0;for(var r=0,i=this.columnCount;r<i;++r)this._columnSizers[r].minSize=0;for(var n=this._items.filter(function(W){return!W.isHidden}),r=0,i=n.length;r<i;++r)n[r].fit();var o=this.rowCount-1,s=this.columnCount-1;n.sort(ka.rowSpanCmp);for(var r=0,i=n.length;r<i;++r){var l=n[r],u=e.getCellConfig(l.widget),h=Math.min(u.row,o),v=Math.min(u.row+u.rowSpan-1,o);ka.distributeMin(this._rowSizers,h,v,l.minHeight)}n.sort(ka.columnSpanCmp);for(var r=0,i=n.length;r<i;++r){var l=n[r],u=e.getCellConfig(l.widget),T=Math.min(u.column,s),E=Math.min(u.column+u.columnSpan-1,s);ka.distributeMin(this._columnSizers,T,E,l.minWidth)}if(this.fitPolicy==="set-no-constraint"){xr.sendMessage(this.parent,Br.Msg.UpdateRequest);return}for(var M=o*this._rowSpacing,O=s*this._columnSpacing,r=0,i=this.rowCount;r<i;++r)M+=this._rowSizers[r].minSize;for(var r=0,i=this.columnCount;r<i;++r)O+=this._columnSizers[r].minSize;var F=this._box=ho.boxSizing(this.parent.node);O+=F.horizontalSum,M+=F.verticalSum;var z=this.parent.node.style;z.minWidth=O+"px",z.minHeight=M+"px",this._dirty=!0,this.parent.parent&&xr.sendMessage(this.parent.parent,Br.Msg.FitRequest),this._dirty&&xr.sendMessage(this.parent,Br.Msg.UpdateRequest)},e.prototype._update=function(r,i){this._dirty=!1,r<0&&(r=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=ho.boxSizing(this.parent.node));var n=this._box.paddingTop,o=this._box.paddingLeft,s=r-this._box.horizontalSum,l=i-this._box.verticalSum,u=this.rowCount-1,h=this.columnCount-1,v=u*this._rowSpacing,T=h*this._columnSpacing;lu.calc(this._rowSizers,Math.max(0,l-v)),lu.calc(this._columnSizers,Math.max(0,s-T));for(var E=0,M=n,O=this.rowCount;E<O;++E)this._rowStarts[E]=M,M+=this._rowSizers[E].size+this._rowSpacing;for(var E=0,M=o,O=this.columnCount;E<O;++E)this._columnStarts[E]=M,M+=this._columnSizers[E].size+this._columnSpacing;for(var E=0,O=this._items.length;E<O;++E){var F=this._items[E];if(!F.isHidden){var z=e.getCellConfig(F.widget),W=Math.min(z.row,u),J=Math.min(z.column,h),K=Math.min(z.row+z.rowSpan-1,u),ne=Math.min(z.column+z.columnSpan-1,h),ge=this._columnStarts[J],j=this._rowStarts[W],me=this._columnStarts[ne]+this._columnSizers[ne].size-ge,fe=this._rowStarts[K]+this._rowSizers[K].size-j;F.update(ge,j,me,fe)}}},e}(CA);(function(t){function e(i){return ka.cellConfigProperty.get(i)}t.getCellConfig=e;function r(i,n){ka.cellConfigProperty.set(i,ka.normalizeConfig(n))}t.setCellConfig=r})(lk||(lk={}));var ka;(function(t){t.cellConfigProperty=new lc({name:"cellConfig",create:function(){return{row:0,column:0,rowSpan:1,columnSpan:1}},changed:l});function e(u){var h=Math.max(0,Math.floor(u.row||0)),v=Math.max(0,Math.floor(u.column||0)),T=Math.max(1,Math.floor(u.rowSpan||0)),E=Math.max(1,Math.floor(u.columnSpan||0));return{row:h,column:v,rowSpan:T,columnSpan:E}}t.normalizeConfig=e;function r(u){return Math.max(0,Math.floor(u))}t.clampValue=r;function i(u,h){var v=t.cellConfigProperty.get(u.widget),T=t.cellConfigProperty.get(h.widget);return v.rowSpan-T.rowSpan}t.rowSpanCmp=i;function n(u,h){var v=t.cellConfigProperty.get(u.widget),T=t.cellConfigProperty.get(h.widget);return v.columnSpan-T.columnSpan}t.columnSpanCmp=n;function o(u,h){for(h=Math.max(1,Math.floor(h));u.length<h;)u.push(new SA);u.length>h&&(u.length=h)}t.reallocSizers=o;function s(u,h,v,T){if(!(v<h)){if(h===v){var E=u[h];E.minSize=Math.max(E.minSize,T);return}for(var M=0,O=h;O<=v;++O)M+=u[O].minSize;if(!(M>=T))for(var F=(T-M)/(v-h+1),O=h;O<=v;++O)u[O].minSize+=F}}t.distributeMin=s;function l(u){u.parent&&u.parent.layout instanceof lk&&u.parent.fit()}})(ka||(ka={}));var Vee=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{node:JI.createNode()})||this;return i._activeIndex=-1,i._tabFocusIndex=0,i._menus=[],i._childMenu=null,i.addClass("lm-MenuBar"),i.addClass("p-MenuBar"),i.setFlag(Br.Flag.DisallowLayout),i.renderer=r.renderer||e.defaultRenderer,i._forceItemsPosition=r.forceItemsPosition||{forceX:!0,forceY:!0},i}return e.prototype.dispose=function(){this._closeChildMenu(),this._menus.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"childMenu",{get:function(){return this._childMenu},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeMenu",{get:function(){return this._menus[this._activeIndex]||null},set:function(r){this.activeIndex=r?this._menus.indexOf(r):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(r){(r<0||r>=this._menus.length)&&(r=-1),this._activeIndex!==r&&(this._activeIndex=r,r!==-1&&(this._tabFocusIndex=r),this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"menus",{get:function(){return this._menus},enumerable:!0,configurable:!0}),e.prototype.openActiveMenu=function(){this._activeIndex!==-1&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))},e.prototype.addMenu=function(r){this.insertMenu(this._menus.length,r)},e.prototype.insertMenu=function(r,i){this._closeChildMenu();var n=this._menus.indexOf(i),o=Math.max(0,Math.min(r,this._menus.length));if(n===-1){rr.insert(this._menus,o,i),i.addClass("lm-MenuBar-menu"),i.addClass("p-MenuBar-menu"),i.aboutToClose.connect(this._onMenuAboutToClose,this),i.menuRequested.connect(this._onMenuMenuRequested,this),i.title.changed.connect(this._onTitleChanged,this),this.update();return}o===this._menus.length&&o--,n!==o&&(rr.move(this._menus,n,o),this.update())},e.prototype.removeMenu=function(r){this.removeMenuAt(this._menus.indexOf(r))},e.prototype.removeMenuAt=function(r){this._closeChildMenu();var i=rr.removeAt(this._menus,r);i&&(i.aboutToClose.disconnect(this._onMenuAboutToClose,this),i.menuRequested.disconnect(this._onMenuMenuRequested,this),i.title.changed.disconnect(this._onTitleChanged,this),i.removeClass("lm-MenuBar-menu"),i.removeClass("p-MenuBar-menu"),this.update())},e.prototype.clearMenus=function(){if(this._menus.length!==0){this._closeChildMenu();for(var r=0,i=this._menus;r<i.length;r++){var n=i[r];n.aboutToClose.disconnect(this._onMenuAboutToClose,this),n.menuRequested.disconnect(this._onMenuMenuRequested,this),n.title.changed.disconnect(this._onTitleChanged,this),n.removeClass("lm-MenuBar-menu"),n.removeClass("p-MenuBar-menu")}this._menus.length=0,this.update()}},e.prototype.handleEvent=function(r){switch(r.type){case"keydown":this._evtKeyDown(r);break;case"mousedown":this._evtMouseDown(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseleave":this._evtMouseLeave(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("contextmenu",this)},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()},e.prototype.onActivateRequest=function(r){this.isAttached&&(this.activeIndex=0)},e.prototype.onUpdateRequest=function(r){for(var i=this,n=this._menus,o=this.renderer,s=this._activeIndex,l=this._tabFocusIndex>=0&&this._tabFocusIndex<n.length?this._tabFocusIndex:0,u=new Array(n.length),h=function(E,M){var O=n[E].title,F=E===s;F&&n[E].items.length==0&&(F=!1),u[E]=o.renderItem({title:O,active:F,tabbable:E===l,onfocus:function(){i.activeIndex=E}})},v=0,T=n.length;v<T;++v)h(v);tp.render(u,this.contentNode)},e.prototype._evtKeyDown=function(r){var i=r.keyCode;if(i===9){this.activeIndex=-1;return}if(r.preventDefault(),r.stopPropagation(),i===13||i===32||i===38||i===40){this.openActiveMenu();return}if(i===27){this._closeChildMenu(),this.activeIndex=-1,this.node.blur();return}if(i===37){var n=this._activeIndex,o=this._menus.length;this.activeIndex=n===0?o-1:n-1;return}if(i===39){var n=this._activeIndex,o=this._menus.length;this.activeIndex=n===o-1?0:n+1;return}var s=nv().keyForKeydownEvent(r);if(s){var l=this._activeIndex+1,u=JI.findMnemonic(this._menus,s,l);u.index!==-1&&!u.multiple?(this.activeIndex=u.index,this.openActiveMenu()):u.index!==-1?this.activeIndex=u.index:u.auto!==-1&&(this.activeIndex=u.auto)}},e.prototype._evtMouseDown=function(r){if(ho.hitTest(this.node,r.clientX,r.clientY)){r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation();var i=rr.findFirstIndex(this.contentNode.children,function(o){return ho.hitTest(o,r.clientX,r.clientY)});if(i===-1){this._closeChildMenu();return}if(r.button===0)if(this._childMenu)this._closeChildMenu(),this.activeIndex=i;else{var n=this._positionForMenu(i);lv.saveWindowData(),this.activeIndex=i,this._openChildMenu(n)}}},e.prototype._evtMouseMove=function(r){var i=rr.findFirstIndex(this.contentNode.children,function(o){return ho.hitTest(o,r.clientX,r.clientY)});if(i!==this._activeIndex&&!(i===-1&&this._childMenu)){var n=this._positionForMenu(i);lv.saveWindowData(),this.activeIndex=i,this._childMenu&&this._openChildMenu(n)}},e.prototype._positionForMenu=function(r){var i=this.contentNode.children[r],n=i.getBoundingClientRect(),o=n.left,s=n.bottom;return{top:s,left:o}},e.prototype._evtMouseLeave=function(r){this._childMenu||(this.activeIndex=-1)},e.prototype._openChildMenu=function(r){var i;r===void 0&&(r={});var n=this.activeMenu;if(!n){this._closeChildMenu();return}var o=this._childMenu;if(o!==n){this._childMenu=n,o?o.close():document.addEventListener("mousedown",this,!0),xr.sendMessage(this,Br.Msg.UpdateRequest);var s=r.left,l=r.top;(typeof s>"u"||typeof l>"u")&&(i=this._positionForMenu(this._activeIndex),s=i.left,l=i.top),o||(this.addClass("lm-mod-active"),this.addClass("p-mod-active")),n.items.length>0&&n.open(s,l,this._forceItemsPosition)}},e.prototype._closeChildMenu=function(){if(this._childMenu){this.removeClass("lm-mod-active"),this.removeClass("p-mod-active"),document.removeEventListener("mousedown",this,!0);var r=this._childMenu;this._childMenu=null,r.close(),this.activeIndex=-1}},e.prototype._onMenuAboutToClose=function(r){r===this._childMenu&&(this.removeClass("lm-mod-active"),this.removeClass("p-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)},e.prototype._onMenuMenuRequested=function(r,i){if(r===this._childMenu){var n=this._activeIndex,o=this._menus.length;switch(i){case"next":this.activeIndex=n===o-1?0:n+1;break;case"previous":this.activeIndex=n===0?o-1:n-1;break}this.openActiveMenu()}},e.prototype._onTitleChanged=function(){this.update()},e}(Br);(function(t){var e=function(){function r(){}return r.prototype.renderItem=function(i){var n=this.createItemClass(i),o=this.createItemDataset(i),s=this.createItemARIA(i);return so.li(ol({className:n,dataset:o,tabindex:i.tabbable?"0":"-1",onfocus:i.onfocus},s),this.renderIcon(i),this.renderLabel(i))},r.prototype.renderIcon=function(i){var n=this.createIconClass(i);return typeof i.title.icon=="string"?so.div({className:n},i.title.iconLabel):so.div({className:n},i.title.icon,i.title.iconLabel)},r.prototype.renderLabel=function(i){var n=this.formatLabel(i);return so.div({className:"lm-MenuBar-itemLabel p-MenuBar-itemLabel"},n)},r.prototype.createItemClass=function(i){var n="lm-MenuBar-item";return n+=" p-MenuBar-item",i.title.className&&(n+=" "+i.title.className),i.active&&(n+=" lm-mod-active",n+=" p-mod-active"),n},r.prototype.createItemDataset=function(i){return i.title.dataset},r.prototype.createItemARIA=function(i){return{role:"menuitem","aria-haspopup":"true"}},r.prototype.createIconClass=function(i){var n="lm-MenuBar-itemIcon";n+=" p-MenuBar-itemIcon";var o=i.title.iconClass;return o?n+" "+o:n},r.prototype.formatLabel=function(i){var n=i.title,o=n.label,s=n.mnemonic;if(s<0||s>=o.length)return o;var l=o.slice(0,s),u=o.slice(s+1),h=o[s],v=so.span({className:"lm-MenuBar-itemMnemonic p-MenuBar-itemMnemonic"},h);return[l,v,u]},r}();t.Renderer=e,t.defaultRenderer=new e})(Vee||(Vee={}));var JI;(function(t){function e(){var i=document.createElement("div"),n=document.createElement("ul");return n.className="lm-MenuBar-content",n.classList.add("p-MenuBar-content"),i.appendChild(n),n.setAttribute("role","menubar"),i}t.createNode=e;function r(i,n,o){for(var s=-1,l=-1,u=!1,h=n.toUpperCase(),v=0,T=i.length;v<T;++v){var E=(v+o)%T,M=i[E].title;if(M.label.length!==0){var O=M.mnemonic;if(O>=0&&O<M.label.length){M.label[O].toUpperCase()===h&&(s===-1?s=E:u=!0);continue}l===-1&&M.label[0].toUpperCase()===h&&(l=E)}}return{index:s,multiple:u,auto:l}}t.findMnemonic=r})(JI||(JI={}));var WTt=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{node:QI.createNode()})||this;return i._onRepeat=function(){if(i._repeatTimer=-1,!!i._pressData){var n=i._pressData.part;if(n!=="thumb"){i._repeatTimer=window.setTimeout(i._onRepeat,20);var o=i._pressData.mouseX,s=i._pressData.mouseY;if(n==="decrement"){if(!ho.hitTest(i.decrementNode,o,s))return;i._stepRequested.emit("decrement");return}if(n==="increment"){if(!ho.hitTest(i.incrementNode,o,s))return;i._stepRequested.emit("increment");return}if(n==="track"){if(!ho.hitTest(i.trackNode,o,s))return;var l=i.thumbNode;if(ho.hitTest(l,o,s))return;var u=l.getBoundingClientRect(),h=void 0;i._orientation==="horizontal"?h=o<u.left?"decrement":"increment":h=s<u.top?"decrement":"increment",i._pageRequested.emit(h);return}}}},i._value=0,i._page=10,i._maximum=100,i._repeatTimer=-1,i._pressData=null,i._thumbMoved=new Wn(i),i._stepRequested=new Wn(i),i._pageRequested=new Wn(i),i.addClass("lm-ScrollBar"),i.addClass("p-ScrollBar"),i.setFlag(Br.Flag.DisallowLayout),i._orientation=r.orientation||"vertical",i.dataset.orientation=i._orientation,r.maximum!==void 0&&(i._maximum=Math.max(0,r.maximum)),r.page!==void 0&&(i._page=Math.max(0,r.page)),r.value!==void 0&&(i._value=Math.max(0,Math.min(r.value,i._maximum))),i}return Object.defineProperty(e.prototype,"thumbMoved",{get:function(){return this._thumbMoved},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stepRequested",{get:function(){return this._stepRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageRequested",{get:function(){return this._pageRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(r){this._orientation!==r&&(this._releaseMouse(),this._orientation=r,this.dataset.orientation=r,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(r){r=Math.max(0,Math.min(r,this._maximum)),this._value!==r&&(this._value=r,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"page",{get:function(){return this._page},set:function(r){r=Math.max(0,r),this._page!==r&&(this._page=r,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this._maximum},set:function(r){r=Math.max(0,r),this._maximum!==r&&(this._maximum=r,this._value=Math.min(this._value,r),this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"decrementNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-button")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"incrementNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-button")[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trackNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-track")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"thumbNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-thumb")[0]},enumerable:!0,configurable:!0}),e.prototype.handleEvent=function(r){switch(r.type){case"mousedown":this._evtMouseDown(r);break;case"mousemove":this._evtMouseMove(r);break;case"mouseup":this._evtMouseUp(r);break;case"keydown":this._evtKeyDown(r);break;case"contextmenu":r.preventDefault(),r.stopPropagation();break}},e.prototype.onBeforeAttach=function(r){this.node.addEventListener("mousedown",this),this.update()},e.prototype.onAfterDetach=function(r){this.node.removeEventListener("mousedown",this),this._releaseMouse()},e.prototype.onUpdateRequest=function(r){var i=this._value*100/this._maximum,n=this._page*100/(this._page+this._maximum);i=Math.max(0,Math.min(i,100)),n=Math.max(0,Math.min(n,100));var o=this.thumbNode.style;this._orientation==="horizontal"?(o.top="",o.height="",o.left=i+"%",o.width=n+"%",o.transform="translate("+-i+"%, 0%)"):(o.left="",o.width="",o.top=i+"%",o.height=n+"%",o.transform="translate(0%, "+-i+"%)")},e.prototype._evtKeyDown=function(r){if(r.preventDefault(),r.stopPropagation(),r.keyCode===27){var i=this._pressData?this._pressData.value:-1;this._releaseMouse(),i!==-1&&this._moveThumb(i)}},e.prototype._evtMouseDown=function(r){if(r.button===0&&(this.activate(),!this._pressData)){var i=QI.findPart(this,r.target);if(i){r.preventDefault(),r.stopPropagation();var n=TA.overrideCursor("default");if(this._pressData={part:i,override:n,delta:-1,value:-1,mouseX:r.clientX,mouseY:r.clientY},document.addEventListener("mousemove",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0),i==="thumb"){var o=this.thumbNode,s=o.getBoundingClientRect();this._orientation==="horizontal"?this._pressData.delta=r.clientX-s.left:this._pressData.delta=r.clientY-s.top,o.classList.add("lm-mod-active"),o.classList.add("p-mod-active"),this._pressData.value=this._value;return}if(i==="track"){var s=this.thumbNode.getBoundingClientRect(),l=void 0;this._orientation==="horizontal"?l=r.clientX<s.left?"decrement":"increment":l=r.clientY<s.top?"decrement":"increment",this._repeatTimer=window.setTimeout(this._onRepeat,350),this._pageRequested.emit(l);return}if(i==="decrement"){this.decrementNode.classList.add("lm-mod-active"),this.decrementNode.classList.add("p-mod-active"),this._repeatTimer=window.setTimeout(this._onRepeat,350),this._stepRequested.emit("decrement");return}if(i==="increment"){this.incrementNode.classList.add("lm-mod-active"),this.incrementNode.classList.add("p-mod-active"),this._repeatTimer=window.setTimeout(this._onRepeat,350),this._stepRequested.emit("increment");return}}}},e.prototype._evtMouseMove=function(r){if(this._pressData&&(r.preventDefault(),r.stopPropagation(),this._pressData.mouseX=r.clientX,this._pressData.mouseY=r.clientY,this._pressData.part==="thumb")){var i=this.thumbNode.getBoundingClientRect(),n=this.trackNode.getBoundingClientRect(),o,s;this._orientation==="horizontal"?(o=r.clientX-n.left-this._pressData.delta,s=n.width-i.width):(o=r.clientY-n.top-this._pressData.delta,s=n.height-i.height);var l=s===0?0:o*this._maximum/s;this._moveThumb(l)}},e.prototype._evtMouseUp=function(r){r.button===0&&(r.preventDefault(),r.stopPropagation(),this._releaseMouse())},e.prototype._releaseMouse=function(){this._pressData&&(clearTimeout(this._repeatTimer),this._repeatTimer=-1,this._pressData.override.dispose(),this._pressData=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0),this.thumbNode.classList.remove("lm-mod-active"),this.decrementNode.classList.remove("lm-mod-active"),this.incrementNode.classList.remove("lm-mod-active"),this.thumbNode.classList.remove("p-mod-active"),this.decrementNode.classList.remove("p-mod-active"),this.incrementNode.classList.remove("p-mod-active"))},e.prototype._moveThumb=function(r){r=Math.max(0,Math.min(r,this._maximum)),this._value!==r&&(this._value=r,this.update(),this._thumbMoved.emit(r))},e}(Br),QI;(function(t){function e(){var i=document.createElement("div"),n=document.createElement("div"),o=document.createElement("div"),s=document.createElement("div"),l=document.createElement("div");return n.className="lm-ScrollBar-button",o.className="lm-ScrollBar-button",n.dataset.action="decrement",o.dataset.action="increment",s.className="lm-ScrollBar-track",l.className="lm-ScrollBar-thumb",n.classList.add("p-ScrollBar-button"),o.classList.add("p-ScrollBar-button"),s.classList.add("p-ScrollBar-track"),l.classList.add("p-ScrollBar-thumb"),s.appendChild(l),i.appendChild(n),i.appendChild(s),i.appendChild(o),i}t.createNode=e;function r(i,n){return i.thumbNode.contains(n)?"thumb":i.trackNode.contains(n)?"track":i.decrementNode.contains(n)?"decrement":i.incrementNode.contains(n)?"increment":null}t.findPart=r})(QI||(QI={}));var qTt=function(t){ks(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._widget=null,r}return e.prototype.dispose=function(){if(this._widget){var r=this._widget;this._widget=null,r.dispose()}t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"widget",{get:function(){return this._widget},set:function(r){r&&(r.parent=this.parent),this._widget!==r&&(this._widget&&this._widget.dispose(),this._widget=r,this.parent&&r&&this.attachWidget(r))},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return this._widget?Uw(this._widget):su()},e.prototype.removeWidget=function(r){this._widget===r&&(this._widget=null,this.parent&&this.detachWidget(r))},e.prototype.init=function(){var r=this;t.prototype.init.call(this),Ei(this,function(i){r.attachWidget(i)})},e.prototype.attachWidget=function(r){this.parent.isAttached&&xr.sendMessage(r,Br.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.isAttached&&xr.sendMessage(r,Br.Msg.AfterAttach)},e.prototype.detachWidget=function(r){this.parent.isAttached&&xr.sendMessage(r,Br.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&xr.sendMessage(r,Br.Msg.AfterDetach)},e}(CA),ZMe=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,r)||this;return i._dirty=!1,i._items=[],i._box=null,i._hiddenMode=r.hiddenMode!==void 0?r.hiddenMode:Br.HiddenMode.Display,i}return Object.defineProperty(e.prototype,"hiddenMode",{get:function(){return this._hiddenMode},set:function(r){var i=this;this._hiddenMode!==r&&(this._hiddenMode=r,this.widgets.length>1&&this.widgets.forEach(function(n){n.hiddenMode=i._hiddenMode}))},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){Ei(this._items,function(r){r.dispose()}),this._box=null,this._items.length=0,t.prototype.dispose.call(this)},e.prototype.attachWidget=function(r,i){this._hiddenMode===Br.HiddenMode.Scale&&this._items.length>0?(this._items.length===1&&(this.widgets[0].hiddenMode=Br.HiddenMode.Scale),i.hiddenMode=Br.HiddenMode.Scale):i.hiddenMode=Br.HiddenMode.Display,rr.insert(this._items,r,new jw(i)),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.BeforeAttach),this.parent.node.appendChild(i.node),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.AfterAttach),this.parent.fit()},e.prototype.moveWidget=function(r,i,n){rr.move(this._items,r,i),this.parent.update()},e.prototype.detachWidget=function(r,i){var n=rr.removeAt(this._items,r);this.parent.isAttached&&xr.sendMessage(i,Br.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&xr.sendMessage(i,Br.Msg.AfterDetach),n.widget.node.style.zIndex="",this._hiddenMode===Br.HiddenMode.Scale&&(i.hiddenMode=Br.HiddenMode.Display,this._items.length===1&&(this._items[0].widget.hiddenMode=Br.HiddenMode.Display)),n.dispose(),this.parent.fit()},e.prototype.onBeforeShow=function(r){t.prototype.onBeforeShow.call(this,r),this.parent.update()},e.prototype.onBeforeAttach=function(r){t.prototype.onBeforeAttach.call(this,r),this.parent.fit()},e.prototype.onChildShown=function(r){this.parent.fit()},e.prototype.onChildHidden=function(r){this.parent.fit()},e.prototype.onResize=function(r){this.parent.isVisible&&this._update(r.width,r.height)},e.prototype.onUpdateRequest=function(r){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(r){this.parent.isAttached&&this._fit()},e.prototype._fit=function(){for(var r=0,i=0,n=0,o=this._items.length;n<o;++n){var s=this._items[n];s.isHidden||(s.fit(),r=Math.max(r,s.minWidth),i=Math.max(i,s.minHeight))}var l=this._box=ho.boxSizing(this.parent.node);r+=l.horizontalSum,i+=l.verticalSum;var u=this.parent.node.style;u.minWidth=r+"px",u.minHeight=i+"px",this._dirty=!0,this.parent.parent&&xr.sendMessage(this.parent.parent,Br.Msg.FitRequest),this._dirty&&xr.sendMessage(this.parent,Br.Msg.UpdateRequest)},e.prototype._update=function(r,i){this._dirty=!1;for(var n=0,o=0,s=this._items.length;o<s;++o)n+=+!this._items[o].isHidden;if(n!==0){r<0&&(r=this.parent.node.offsetWidth),i<0&&(i=this.parent.node.offsetHeight),this._box||(this._box=ho.boxSizing(this.parent.node));for(var l=this._box.paddingTop,u=this._box.paddingLeft,h=r-this._box.horizontalSum,v=i-this._box.verticalSum,o=0,s=this._items.length;o<s;++o){var T=this._items[o];T.isHidden||(T.widget.node.style.zIndex=""+o,T.update(u,l,h,v))}}},e}($I),JMe=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,{layout:ck.createLayout(r)})||this;return i._widgetRemoved=new Wn(i),i.addClass("lm-StackedPanel"),i.addClass("p-StackedPanel"),i}return Object.defineProperty(e.prototype,"hiddenMode",{get:function(){return this.layout.hiddenMode},set:function(r){this.layout.hiddenMode=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"widgetRemoved",{get:function(){return this._widgetRemoved},enumerable:!0,configurable:!0}),e.prototype.onChildAdded=function(r){r.child.addClass("lm-StackedPanel-child"),r.child.addClass("p-StackedPanel-child")},e.prototype.onChildRemoved=function(r){r.child.removeClass("lm-StackedPanel-child"),r.child.removeClass("p-StackedPanel-child"),this._widgetRemoved.emit(r.child)},e}(Gw),ck;(function(t){function e(r){return r.layout||new ZMe}t.createLayout=e})(ck||(ck={}));var XTt=function(t){ks(e,t);function e(r){r===void 0&&(r={});var i=t.call(this)||this;i._currentChanged=new Wn(i),i._addRequested=new Wn(i),i.addClass("lm-TabPanel"),i.addClass("p-TabPanel"),i.tabBar=new cv(r),i.tabBar.addClass("lm-TabPanel-tabBar"),i.stackedPanel=new JMe,i.stackedPanel.addClass("lm-TabPanel-stackedPanel"),i.tabBar.addClass("p-TabPanel-tabBar"),i.stackedPanel.addClass("p-TabPanel-stackedPanel"),i.tabBar.tabMoved.connect(i._onTabMoved,i),i.tabBar.currentChanged.connect(i._onCurrentChanged,i),i.tabBar.tabCloseRequested.connect(i._onTabCloseRequested,i),i.tabBar.tabActivateRequested.connect(i._onTabActivateRequested,i),i.tabBar.addRequested.connect(i._onTabAddRequested,i),i.stackedPanel.widgetRemoved.connect(i._onWidgetRemoved,i),i._tabPlacement=r.tabPlacement||"top";var n=av.directionFromPlacement(i._tabPlacement),o=av.orientationFromPlacement(i._tabPlacement);i.tabBar.orientation=o,i.tabBar.dataset.placement=i._tabPlacement;var s=new Gf({direction:n,spacing:0});return Gf.setStretch(i.tabBar,0),Gf.setStretch(i.stackedPanel,1),s.addWidget(i.tabBar),s.addWidget(i.stackedPanel),i.layout=s,i}return Object.defineProperty(e.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentIndex",{get:function(){return this.tabBar.currentIndex},set:function(r){this.tabBar.currentIndex=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentWidget",{get:function(){var r=this.tabBar.currentTitle;return r?r.owner:null},set:function(r){this.tabBar.currentTitle=r?r.title:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabsMovable",{get:function(){return this.tabBar.tabsMovable},set:function(r){this.tabBar.tabsMovable=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addButtonEnabled",{get:function(){return this.tabBar.addButtonEnabled},set:function(r){this.tabBar.addButtonEnabled=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabPlacement",{get:function(){return this._tabPlacement},set:function(r){if(this._tabPlacement!==r){this._tabPlacement=r;var i=av.directionFromPlacement(r),n=av.orientationFromPlacement(r);this.tabBar.orientation=n,this.tabBar.dataset.placement=r,this.layout.direction=i}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addRequested",{get:function(){return this._addRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"widgets",{get:function(){return this.stackedPanel.widgets},enumerable:!0,configurable:!0}),e.prototype.addWidget=function(r){this.insertWidget(this.widgets.length,r)},e.prototype.insertWidget=function(r,i){i!==this.currentWidget&&i.hide(),this.stackedPanel.insertWidget(r,i),this.tabBar.insertTab(r,i.title),i.node.setAttribute("role","tabpanel");var n=this.tabBar.renderer;if(n instanceof cv.Renderer){var o=n.createTabKey({title:i.title,current:!1,zIndex:0});i.node.setAttribute("aria-labelledby",o)}},e.prototype._onCurrentChanged=function(r,i){var n=i.previousIndex,o=i.previousTitle,s=i.currentIndex,l=i.currentTitle,u=o?o.owner:null,h=l?l.owner:null;u&&u.hide(),h&&h.show(),this._currentChanged.emit({previousIndex:n,previousWidget:u,currentIndex:s,currentWidget:h}),(nl.IS_EDGE||nl.IS_IE)&&xr.flush()},e.prototype._onTabAddRequested=function(r,i){this._addRequested.emit(r)},e.prototype._onTabActivateRequested=function(r,i){i.title.owner.activate()},e.prototype._onTabCloseRequested=function(r,i){i.title.owner.close()},e.prototype._onTabMoved=function(r,i){this.stackedPanel.insertWidget(i.toIndex,i.title.owner)},e.prototype._onWidgetRemoved=function(r,i){i.node.removeAttribute("role"),i.node.removeAttribute("aria-labelledby"),this.tabBar.removeTab(i.title)},e}(Br),av;(function(t){function e(o){return i[o]}t.orientationFromPlacement=e;function r(o){return n[o]}t.directionFromPlacement=r;var i={top:"horizontal",left:"vertical",right:"vertical",bottom:"horizontal"},n={top:"top-to-bottom",left:"left-to-right",right:"right-to-left",bottom:"bottom-to-top"}})(av||(av={}));var uv=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),MA=function(){return MA=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},MA.apply(this,arguments)},QMe="IPY_MODEL_";function Ww(t,e){if(Array.isArray(t)){var r=[];return t.forEach(function(n,o){r.push(Ww(n,e))}),Promise.all(r)}else if(t instanceof Object){var i={};return Object.keys(t).forEach(function(n){i[n]=Ww(t[n],e)}),My(i)}else return typeof t=="string"&&t.slice(0,10)==="IPY_MODEL_"?e.get_model(t.slice(10,t.length)):Promise.resolve(t)}function fk(t,e){if(Array.isArray(t)){for(var r=[],i=0,n=t;i<n.length;i++){var o=n[i];r.push(fk(o,e))}return r}else{if(t instanceof IA)return""+QMe+t.model_id;if(t instanceof Object&&typeof t!="string"){var s={};Object.keys(t).forEach(function(l){s[l]=fk(t[l],e)})}else return t}}var IA=function(t){uv(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.defaults=function(){return{_model_module:"@jupyter-widgets/base",_model_name:"WidgetModel",_model_module_version:kM,_view_module:"@jupyter-widgets/base",_view_name:null,_view_module_version:kM,_view_count:null}},e.prototype.isNew=function(){return!1},e.prototype.initialize=function(r,i){this._expectedEchoMsgIds={},this._attrsToUpdate={},t.prototype.initialize.call(this,r,i),this.widget_manager=i.widget_manager,this.model_id=i.model_id;var n=i.comm;this.views=Object.create(null),this.state_change=Promise.resolve(),this._closed=!1,this._state_lock=null,this._msg_buffer=null,this._msg_buffer_callbacks=null,this._pending_msgs=0,this._buffered_state_diff={},n?(this.comm=n,n.on_close(this._handle_comm_closed.bind(this)),n.on_msg(this._handle_comm_msg.bind(this)),this.comm_live=!0):this.comm_live=!1},Object.defineProperty(e.prototype,"comm_live",{get:function(){return this._comm_live},set:function(r){this._comm_live=r,this.trigger("comm_live_update")},enumerable:!0,configurable:!0}),e.prototype.send=function(r,i,n){if(this.comm!==void 0){var o={method:"custom",content:r};this.comm.send(o,i,{},n)}},e.prototype.close=function(r){var i=this;if(r===void 0&&(r=!1),!this._closed){this._closed=!0,this.comm&&!r&&this.comm.close(),this.stopListening(),this.trigger("destroy",this),this.comm&&delete this.comm;var n=Object.keys(this.views).map(function(o){return i.views[o].then(function(s){return s.remove()})});return delete this.views,Promise.all(n).then(function(){})}},e.prototype._handle_comm_closed=function(r){this.trigger("comm:close"),this.close(!0)},e.prototype._handle_comm_msg=function(r){var i=this,n=r.content.data,o=n.method;switch(o){case"update":case"echo_update":return this.state_change=this.state_change.then(function(){var s,l,u,h=n.state,v=(s=n.buffer_paths,s??[]),T=(u=(l=r.buffers)===null||l===void 0?void 0:l.slice(0,v.length),u??[]).map(function(O){return O instanceof DataView?O:new DataView(O instanceof ArrayBuffer?O:O.buffer)});if(cA(h,v,T),r.parent_header&&o==="echo_update"){var E=r.parent_header.msg_id,M=Object.keys(h).filter(function(O){return i._expectedEchoMsgIds.hasOwnProperty(O)});M.forEach(function(O){var F=i._expectedEchoMsgIds[O]!==E;F?delete h[O]:(delete i._expectedEchoMsgIds[O],i._msg_buffer!==null&&Object.prototype.hasOwnProperty.call(i._msg_buffer,O)&&delete h[O])})}return i.constructor._deserialize_state(h,i.widget_manager)}).then(function(s){i.set_state(s)}).catch(jh("Could not process update msg for model id: "+this.model_id,!0)),this.state_change;case"custom":return this.trigger("msg:custom",n.content,r.buffers),Promise.resolve()}},e.prototype.set_state=function(r){this._state_lock=r;try{this.set(r)}catch(i){console.error("Error setting state: "+i.message)}finally{this._state_lock=null}},e.prototype.get_state=function(r){var i=this.attributes;if(r){var n=this.defaults,o=typeof n=="function"?n.call(this):n,s={};return Object.keys(i).forEach(function(l){Cy(i[l],o[l])||(s[l]=i[l])}),s}else return MA({},i)},e.prototype._handle_status=function(r){if(this.comm!==void 0&&r.content.execution_state==="idle"&&(this._pending_msgs--,this._pending_msgs<0&&(console.error("Jupyter Widgets message throttle: Pending messages < 0 (="+this._pending_msgs+"), which is unexpected. Resetting to 0 to continue."),this._pending_msgs=0),this._msg_buffer!==null&&this._pending_msgs<1)){var i=this.send_sync_message(this._msg_buffer,this._msg_buffer_callbacks);this.rememberLastUpdateFor(i),this._msg_buffer=null,this._msg_buffer_callbacks=null}},e.prototype.callbacks=function(r){return this.widget_manager.callbacks(r)},e.prototype.set=function(r,i,n){var o=zQ.call(this,r,i,n);if(this._buffered_state_diff!==void 0){var s=this.changedAttributes()||{};if(this._state_lock)for(var l=0,u=Object.keys(this._state_lock);l<u.length;l++){var h=u[l];s[h]===this._state_lock[h]&&delete s[h]}this._buffered_state_diff=Yd(this._buffered_state_diff,s)}return o},e.prototype.sync=function(r,i,n){var o=this;if(n===void 0&&(n={}),this.comm===void 0)throw"Syncing error: no comm channel defined";var s=r==="patch"?n.attrs:i.get_state(n.drop_defaults);if(this._state_lock)for(var l=0,u=Object.keys(this._state_lock);l<u.length;l++){var h=u[l];s[h]===this._state_lock[h]&&delete s[h]}Object.keys(s).forEach(function(M){o._attrsToUpdate[M]=!0});var v=this.serialize(s);if(Object.keys(v).length>0){var T=n.callbacks||this.callbacks();if(this._pending_msgs>=1){switch(r){case"patch":this._msg_buffer=Yd(this._msg_buffer||{},v);break;case"update":case"create":this._msg_buffer=v;break;default:throw"unrecognized syncing method"}this._msg_buffer_callbacks=T}else{var E=this.send_sync_message(s,T);this.rememberLastUpdateFor(E)}}},e.prototype.rememberLastUpdateFor=function(r){var i=this;Object.keys(this._attrsToUpdate).forEach(function(n){i._expectedEchoMsgIds[n]=r}),this._attrsToUpdate={}},e.prototype.serialize=function(r){for(var i=this.constructor.serializers||{},n=0,o=Object.keys(r);n<o.length;n++){var s=o[n];try{i[s]&&i[s].serialize?r[s]=i[s].serialize(r[s],this):r[s]=JSON.parse(JSON.stringify(r[s])),r[s]&&r[s].toJSON&&(r[s]=r[s].toJSON())}catch(l){throw console.error("Error serializing widget state attribute: ",s),l}}return r},e.prototype.send_sync_message=function(r,i){var n=this;if(i===void 0&&(i={}),!this.comm)return"";try{i={shell:MA({},i.shell),iopub:MA({},i.iopub),input:i.input};var o=i.iopub.status;i.iopub.status=function(u){n._handle_status(u),o&&o(u)};var s=ow(r),l=this.comm.send({method:"update",state:s.state,buffer_paths:s.buffer_paths},i,{},s.buffers);return this._pending_msgs++,l}catch(u){console.error("Could not send widget sync message",u)}return""},e.prototype.save_changes=function(r){if(this.comm_live){var i={patch:!0};r&&(i.callbacks=r),this.save(this._buffered_state_diff,i),this._buffered_state_diff={}}},e.prototype.on_some_change=function(r,i,n){var o=this;this.on("change",function(){r.some(o.hasChanged,o)&&i.apply(n,arguments)},this)},e.prototype.toJSON=function(r){return"IPY_MODEL_"+this.model_id},e._deserialize_state=function(r,i){var n=this.serializers,o;if(n){o={};for(var s in r)n[s]&&n[s].deserialize?o[s]=n[s].deserialize(r[s],i):o[s]=r[s]}else o=r;return My(o)},e}(Hee.Model);var hk=function(t){uv(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.defaults=function(){return Yd(t.prototype.defaults.call(this),{_dom_classes:[]})},e.serializers=MA(MA({},IA.serializers),{layout:{deserialize:Ww},style:{deserialize:Ww}}),e}(IA);var fv=function(t){uv(e,t);function e(r){return t.call(this,r)||this}return e.prototype.initialize=function(r){var i=this;this.listenTo(this.model,"change",function(){var n=Object.keys(i.model.changedAttributes()||{});n[0]==="_view_count"&&n.length===1||i.update()}),this.options=r.options,this.once("remove",function(){typeof i.model.get("_view_count")=="number"&&(i.model.set("_view_count",i.model.get("_view_count")-1),i.model.save_changes())}),this.once("displayed",function(){typeof i.model.get("_view_count")=="number"&&(i.model.set("_view_count",i.model.get("_view_count")+1),i.model.save_changes())}),this.displayed=new Promise(function(n,o){i.once("displayed",n)})},e.prototype.update=function(r){},e.prototype.render=function(){},e.prototype.create_child_view=function(r,i){return i===void 0&&(i={}),i=MA({parent:this},i),this.model.widget_manager.create_view(r,i).catch(jh("Could not create child view",!0))},e.prototype.callbacks=function(){return this.model.callbacks(this)},e.prototype.send=function(r,i){this.model.send(r,this.callbacks(),i)},e.prototype.touch=function(){this.model.save_changes(this.callbacks())},e.prototype.remove=function(){return t.prototype.remove.call(this),this.trigger("remove"),this},e}(Cee);var jee=function(t){uv(e,t);function e(r){var i=this,n=r.view;return delete r.view,i=t.call(this,r)||this,i._view=n,i}return e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._view&&this._view.remove(),this._view=null)},e.prototype.processMessage=function(r){t.prototype.processMessage.call(this,r),this._view.processPhosphorMessage(r)},e}(Br);var $Me=function(t){uv(e,t);function e(r){var i=this,n=r.view;return delete r.view,i=t.call(this,r)||this,i._view=n,i}return e.prototype.processMessage=function(r){t.prototype.processMessage.call(this,r),this._view.processPhosphorMessage(r)},e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._view&&this._view.remove(),this._view=null)},e}(Gw);var dk=function(t){uv(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.initialize=function(r){var i=this;t.prototype.initialize.call(this,r),this.listenTo(this.model,"change:_dom_classes",function(n,o){var s=n.previous("_dom_classes");i.update_classes(s,o)}),this.layoutPromise=Promise.resolve(),this.listenTo(this.model,"change:layout",function(n,o){i.setLayout(o,n.previous("layout"))}),this.stylePromise=Promise.resolve(),this.listenTo(this.model,"change:style",function(n,o){i.setStyle(o,n.previous("style"))}),this.displayed.then(function(){i.update_classes([],i.model.get("_dom_classes")),i.setLayout(i.model.get("layout")),i.setStyle(i.model.get("style"))}),this._comm_live_update(),this.listenTo(this.model,"comm_live_update",function(){i._comm_live_update()})},e.prototype.setLayout=function(r,i){var n=this;r&&(this.layoutPromise=this.layoutPromise.then(function(o){return o&&(o.unlayout(),n.stopListening(o.model),o.remove()),n.create_child_view(r).then(function(s){return n.displayed.then(function(){return s.trigger("displayed"),n.listenTo(s.model,"change",function(){xr.postMessage(n.pWidget,Br.ResizeMessage.UnknownSize)}),xr.postMessage(n.pWidget,Br.ResizeMessage.UnknownSize),s})}).catch(jh("Could not add LayoutView to DOMWidgetView",!0))}))},e.prototype.setStyle=function(r,i){var n=this;r&&(this.stylePromise=this.stylePromise.then(function(o){return o&&(o.unstyle(),n.stopListening(o.model),o.remove()),n.create_child_view(r).then(function(s){return n.displayed.then(function(){return s.trigger("displayed"),s})}).catch(jh("Could not add styleView to DOMWidgetView",!0))}))},e.prototype.update_classes=function(r,i,n){n===void 0&&(n=this.el),NM(r,i).map(function(o){n.classList?n.classList.remove(o):n.setAttribute("class",n.getAttribute("class").replace(o,""))}),NM(i,r).map(function(o){n.classList?n.classList.add(o):n.setAttribute("class",n.getAttribute("class").concat(" ",o))})},e.prototype.update_mapped_classes=function(r,i,n){var o=this.model.previous(i),s=r[o]?r[o]:[];o=this.model.get(i);var l=r[o]?r[o]:[];this.update_classes(s,l,n||this.el)},e.prototype.set_mapped_classes=function(r,i,n){var o=this.model.get(i),s=r[o]?r[o]:[];this.update_classes([],s,n||this.el)},e.prototype._setElement=function(r){this.pWidget&&this.pWidget.dispose(),this.$el=r instanceof uk.default?r:(0,uk.default)(r),this.el=this.$el[0],this.pWidget=new jee({node:r,view:this})},e.prototype.remove=function(){return this.pWidget&&this.pWidget.dispose(),t.prototype.remove.call(this)},e.prototype.processPhosphorMessage=function(r){switch(r.type){case"after-attach":this.trigger("displayed");break}},e.prototype._comm_live_update=function(){this.model.comm_live?this.pWidget.removeClass("jupyter-widgets-disconnected"):this.pWidget.addClass("jupyter-widgets-disconnected")},e}(fv);var Gee=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),Wee={align_content:null,align_items:null,align_self:null,border:null,bottom:null,display:null,flex:null,flex_flow:null,height:null,justify_content:null,justify_items:null,left:null,margin:null,max_height:null,max_width:null,min_height:null,min_width:null,overflow:null,overflow_x:null,overflow_y:null,order:null,padding:null,right:null,top:null,visibility:null,width:null,object_fit:null,object_position:null,grid_auto_columns:null,grid_auto_flow:null,grid_auto_rows:null,grid_gap:null,grid_template_rows:null,grid_template_columns:null,grid_template_areas:null,grid_row:null,grid_column:null,grid_area:null},eIe=function(t){Gee(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.defaults=function(){return Yd(t.prototype.defaults.call(this),{_model_name:"LayoutModel",_view_name:"LayoutView"},Wee)},e}(IA);var tIe=function(t){Gee(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.initialize=function(r){this._traitNames=[],t.prototype.initialize.call(this,r);for(var i=0,n=Object.keys(Wee);i<n.length;i++){var o=n[i];this.registerTrait(o)}},e.prototype.registerTrait=function(r){var i=this;if(this._traitNames.push(r),r==="overflow_x"||r==="overflow_y"){this.listenTo(this.model,"change:"+r,function(n,o){i.handleOverflowChange(r,o)}),this.handleOverflowChange(r,this.model.get(r));return}this.listenTo(this.model,"change:"+r,function(n,o){i.handleChange(r,o)}),this.handleChange(r,this.model.get(r))},e.prototype.css_name=function(r){return r.replace(/_/g,"-")},e.prototype.handleChange=function(r,i){var n=this.options.parent;n?i===null?n.el.style.removeProperty(this.css_name(r)):n.el.style[this.css_name(r)]=i:console.warn("Style not applied because a parent view does not exist")},e.prototype.handleOverflowChange=function(r,i){var n=this.options.parent;n?i===null?this.model.get("overflow")===null&&n.el.style.removeProperty(this.css_name(r)):n.el.style[this.css_name(r)]=i:console.warn("Style not applied because a parent view does not exist")},e.prototype.unlayout=function(){var r=this,i=this.options.parent;this._traitNames.forEach(function(n){i?i.el.style.removeProperty(r.css_name(n)):console.warn("Style not removed because a parent view does not exist")},this)},e}(fv);var qee=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),rIe=function(t){qee(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.defaults=function(){var r=this.constructor;return Yd(t.prototype.defaults.call(this),{_model_name:"StyleModel",_view_name:"StyleView"},Object.keys(r.styleProperties).reduce(function(i,n){return i[n]=r.styleProperties[n].default,i},{}))},e.styleProperties={},e}(IA);var iIe=function(t){qee(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.initialize=function(r){this._traitNames=[],t.prototype.initialize.call(this,r);for(var i=this.model.constructor,n=0,o=Object.keys(i.styleProperties);n<o.length;n++){var s=o[n];this.registerTrait(s)}this.style()},e.prototype.registerTrait=function(r){var i=this;this._traitNames.push(r),this.listenTo(this.model,"change:"+r,function(n,o){i.handleChange(r,o)})},e.prototype.handleChange=function(r,i){var n=this.options.parent;if(n){var o=this.model.constructor,s=o.styleProperties,l=s[r].attribute,u=s[r].selector,h=u?n.el.querySelectorAll(u):[n.el];if(i===null)for(var v=0;v!==h.length;++v)h[v].style.removeProperty(l);else for(var v=0;v!==h.length;++v)h[v].style[l]=i}else console.warn("Style not applied because a parent view does not exist")},e.prototype.style=function(){for(var r=0,i=this._traitNames;r<i.length;r++){var n=i[r];this.handleChange(n,this.model.get(n))}},e.prototype.unstyle=function(){var r=this.options.parent,i=this.model.constructor,n=i.styleProperties;this._traitNames.forEach(function(o){if(r)for(var s=n[o].attribute,l=n[o].selector,u=l?r.el.querySelectorAll(l):[r.el],h=0;h!==u.length;++h)u[h].style.removeProperty(s);else console.warn("Style not removed because a parent view does not exist")},this)},e}(fv);var nIe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(v){try{h(i.next(v))}catch(T){s(T)}}function u(v){try{h(i.throw(v))}catch(T){s(T)}}function h(v){v.done?o(v.value):n(v.value).then(l,u)}h((i=i.apply(t,e||[])).next())})},oIe=function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,n,o,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(h){return function(v){return u([h,v])}}function u(h){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(o=h[0]&2?n.return:h[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,h[1])).done)return o;switch(n=0,o&&(h=[h[0]&2,o.value]),h[0]){case 0:case 1:o=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,n=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!o||h[1]>o[0]&&h[1]<o[3])){r.label=h[1];break}if(h[0]===6&&r.label<o[1]){r.label=o[1],o=h;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(h);break}o[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(v){h=[6,v],n=0}finally{i=o=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},pk;(function(t){var e;(function(r){var i=function(){function o(s){this.targets=Object.create(null),this.comms=Object.create(null),this.kernel=null,this.jsServicesKernel=null,this.init_kernel(s)}return o.prototype.init_kernel=function(s){this.kernel=s,this.jsServicesKernel=s},o.prototype.new_comm=function(s,l,u,h,v,T){return nIe(this,void 0,void 0,function(){var E,M;return oIe(this,function(O){return E=this.jsServicesKernel.createComm(s,v),M=new n(E),this.register_comm(M),M.open(l,u,h,T),[2,M]})})},o.prototype.register_target=function(s,l){var u=this,h=this.jsServicesKernel.registerCommTarget(s,function(v,T){var E=new n(v);u.register_comm(E);try{return l(E,T)}catch(M){E.close(),console.error(M),console.error(new Error("Exception opening new comm"))}});this.targets[s]=h},o.prototype.unregister_target=function(s,l){var u=this.targets[s];u.dispose(),delete this.targets[s]},o.prototype.register_comm=function(s){return this.comms[s.comm_id]=Promise.resolve(s),s.kernel=this.kernel,s.comm_id},o}();r.CommManager=i;var n=function(){function o(s){this.jsServicesComm=null,this.kernel=null,this.jsServicesComm=s}return Object.defineProperty(o.prototype,"comm_id",{get:function(){return this.jsServicesComm.commId},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"target_name",{get:function(){return this.jsServicesComm.targetName},enumerable:!0,configurable:!0}),o.prototype.open=function(s,l,u,h){var v=this.jsServicesComm.open(s,u,h);return this._hookupCallbacks(v,l),v.msg.header.msg_id},o.prototype.send=function(s,l,u,h){var v=this.jsServicesComm.send(s,u,h);return this._hookupCallbacks(v,l),v.msg.header.msg_id},o.prototype.close=function(s,l,u,h){var v=this.jsServicesComm.close(s,u,h);return this._hookupCallbacks(v,l),v.msg.header.msg_id},o.prototype.on_msg=function(s){this.jsServicesComm.onMsg=s.bind(this)},o.prototype.on_close=function(s){this.jsServicesComm.onClose=s.bind(this)},o.prototype._hookupCallbacks=function(s,l){l&&(s.onReply=function(u){l.shell&&l.shell.reply&&l.shell.reply(u)},s.onStdin=function(u){l.input&&l.input(u)},s.onIOPub=function(u){if(l.iopub){if(l.iopub.status&&u.header.msg_type==="status")l.iopub.status(u);else if(l.iopub.clear_output&&u.header.msg_type==="clear_output")l.iopub.clear_output(u);else if(l.iopub.output)switch(u.header.msg_type){case"display_data":case"execute_result":case"stream":case"error":l.iopub.output(u);break;default:break}}})},o}();r.Comm=n})(e=t.services||(t.services={}))})(pk||(pk={}));var sIe=function(){function t(e,r,i){this.initialize(e,r,i)}return t.prototype.initialize=function(e,r,i){this._handler_context=i||this,this._models=[],this.views=[],this._create_view=e,this._remove_view=r||function(n){n.remove()}},t.prototype.update=function(e,r,i,n){var o=i||this._remove_view,s=r||this._create_view;n=n||this._handler_context;for(var l=0;l<e.length&&!(l>=this._models.length||e[l]!==this._models[l]);l++);for(var u=l,h=this.views.splice(u,this.views.length-u),v=0;v<h.length;v++)h[v].then(function(T){o.call(n,T)});for(;l<e.length;l++)this.views.push(Promise.resolve(s.call(n,e[l],l)));return this._models=e.slice(),Promise.all(this.views)},t.prototype.remove=function(){var e=this;return Promise.all(this.views).then(function(r){r.forEach(function(i){return e._remove_view.call(e._handler_context,i)}),e.views=[],e._models=[]})},t.prototype.dispose=function(){this.views=null,this._models=null},t}();var Xee=ga(gy()),aIe=new Xee.Token("jupyter.extensions.jupyterWidgetRegistry");function lIe(t){switch(t){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"float32":return Float32Array;case"float64":return Float64Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`Unrecognized dtype ${t}`)}}function Yee(t,e){if(!t)return null;for(let r in t){let i=t[r].attributes;for(let n in i){let{dtype:o,value:s}=i[n],l=lIe(o);i[n].value=new l(s.buffer)}}return t}var PA=null,Ak=qw&&hk;if(Ak){class t extends Ak{defaults(){return{...super.defaults(),_model_name:PA.model_name,_model_module:PA.model_module,_model_module_version:PA.model_module_version,_view_name:PA.view_name,_view_module:PA.view_module,_view_module_version:PA.view_module_version,custom_libraries:[],json_input:null,mapbox_key:null,selected_data:[],data_buffer:null,tooltip:null,width:"100%",height:500,js_warning:!1}}static get serializers(){return{...Ak.serializers,data_buffer:{deserialize:Yee}}}static get model_name(){return"JupyterTransportModel"}static get model_module(){return Uv}static get model_module_version(){return kv}static get view_name(){return"JupyterTransportView"}static get view_module(){return Uv}static get view_module_version(){return kv}}PA=t}var Kee=PA;var Jee=null,Zee=qw&&dk;if(Zee){class t extends Zee{initialize(){this.listenTo(this.model,"destroy",this.remove),this.transport=new wg,this.transport.jupyterModel=this.model,this.transport.jupyterView=this,this.transport._initialize(),super.initialize.apply(this,arguments)}remove(){this.transport&&(this.transport._finalize(),this.transport.jupyterModel=null,this.transport.jupyterView=null,this.transport=null)}render(){super.render(),this.model.on("change:json_input",this.onJsonChanged.bind(this)),this.model.on("change:data_buffer",this.onDataBufferChanged.bind(this)),this.onDataBufferChanged()}onJsonChanged(){let r=JSON.parse(this.model.get("json_input"));this.transport._messageReceived({type:"json",json:r})}onDataBufferChanged(){let r=this.model.get("json_input"),i=this.model.get("data_buffer");r&&i?this.transport._messageReceived({type:"json-with-binary",json:r,binary:i}):this.transport._messageReceived({type:"json",json:r})}}Jee=t}var Qee=Jee;var mk={};As(mk,{Buffer:()=>Xi,BufferTransform:()=>zu,CubeGeometry:()=>xd,Device:()=>Yc,Framebuffer:()=>_h,Geometry:()=>Fn,GroupNode:()=>Qc,Model:()=>Ni,ModelNode:()=>Ih,ScenegraphNode:()=>Vu,SphereGeometry:()=>Qx,Texture:()=>bo,TextureTransform:()=>Mh,attachDevice:()=>pIe,createDevice:()=>AIe,enforceWebGL2:()=>mIe,getAvailableDevices:()=>fIe,getSupportedDevices:()=>hIe,registerDevices:()=>uIe,setDefaultDeviceProps:()=>dIe,stats:()=>cIe});var{stats:cIe,registerDevices:uIe,getAvailableDevices:fIe,getSupportedDevices:hIe,setDefaultDeviceProps:dIe,attachDevice:pIe,createDevice:AIe,enforceWebGL2:mIe}=Ll;var gk={};As(gk,{fetchFile:()=>B0,load:()=>_a,parse:()=>xp,registerLoaders:()=>em});var $ee=document.body&&document.body.getAttribute("data-base-url");$ee&&(window.__webpack_public_path__=`${$ee}nbextensions/pydeck/nb_extension`);CM();globalThis.deck=globalThis.deck||{};Object.assign(globalThis.deck,Kb);globalThis.luma=globalThis.luma||{};Object.assign(globalThis.luma,mk);globalThis.loaders=globalThis.loaders||{};Object.assign(globalThis.loaders,gk);return B6(gIe);})();
return __exports__;
});
//# sourceMappingURL=index.js.map